{"nl": {"description": "There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.", "input_spec": "Each of the three lines of the input contains two integers. The i-th line contains integers xi and yi (\u2009-\u2009109\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009109)\u00a0\u2014 the coordinates of the i-th point. It is guaranteed that all points are distinct.", "output_spec": "Print a single number\u00a0\u2014 the minimum possible number of segments of the polyline.", "sample_inputs": ["1 -1\n1 1\n1 2", "-1 -1\n-1 3\n4 3", "1 1\n2 3\n3 2"], "sample_outputs": ["1", "2", "3"], "notes": "NoteThe variant of the polyline in the first sample: The variant of the polyline in the second sample: The variant of the polyline in the third sample: "}, "positive_code": [{"source_code": "#include<stdio.h>\nint fun(int a,int b,int c){\n\tif(b>c){\n\t\tint temp=c;\n\t\tc=b;\n\t\tb=temp;\n\t}\n\tif(a>=c||a<=b)\n\treturn 1;\n\telse\n\treturn 0;\n}\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse if(x1==x2&&fun(y3,y1,y2))\n\tprintf(\"2\");\n\telse if(x1==x3&&fun(y2,y1,y3))\n\tprintf(\"2\");\n\telse if(x2==x3&&fun(y1,y2,y3))\n\tprintf(\"2\");\n\telse if(y1==y2&&fun(x3,x1,x2))\n\tprintf(\"2\");\n\telse if(y1==y3&&fun(x2,x1,x3))\n\tprintf(\"2\");\n\telse if(y2==y3&&fun(x1,x2,x3))\n\tprintf(\"2\");\n\telse \n\tprintf(\"3\");\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long long int x1,x2,x3,y1,y2,y3;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if((x1==x2 && x2==x3) || (y1==y2 && y2==y3))\n printf(\"1\");\n\n else if(x1==x2 && x2!=x3)\n {\n if((y3>=y2 && y3>=y1) || (y3<=y2 && y3<=y1))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if(y1==y2 && y2!=y3)\n {\n if((x3>=x2 && x3>=x1) || (x3<=x2 && x3<=x1))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if(x1==x3 && x2!=x3)\n {\n if((y2>=y3 && y2>=y1) || (y2<=y3 && y2<=y1))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if(y1==y3 && y2!=y3)\n {\n if((x2>=x3 && x2>=x1) || (x2<=x3 && x2<=x1))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if(x3==x2 && x1!=x3)\n {\n if((y1>=y2 && y1>=y3) || (y1<=y2 && y1<=y3))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if(y3==y2 && y1!=y3)\n {\n if((x1>=x2 && x1>=x3) || (x1<=x2 && x1<=x3))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n\n else\n printf(\"3\");\n\n}\n"}, {"source_code": "#include <stdio.h>\nint f1(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\telse return b;\n}\nint f2(int a,int b)\n{\n\tif(a<b)\n\t\treturn a;\n\telse return b;\n}\nint main(void)\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d\",&x1,&y1);\n\tscanf(\"%d %d\",&x2,&y2);\n\tscanf(\"%d %d\",&x3,&y3);\n\tif((x1==x2 && x2==x3)||(y1==y2 && y2==y3))\n\t\tprintf(\"1\\n\");\n\telse if((x1==x2 && (y3>=f1(y1,y2) || y3<=f2(y1,y2)))|| (x2==x3 && (y1<=f2(y2,y3) || y1>=f1(y2,y3))) || (y1==y2&&(x3>=f1(x1,x2)||x3<=f2(x1,x2))) || (y2==y3&&(x1>=f1(x2,x3)||x1<=f2(x2,x3))) || (x1==x3 &&(y2<=f2(y1,y3) || y2>=f1(y1,y3)) )|| (y1==y3 && (x2>=f1(x1,x3) || x2<=f2(x1,x3))))\n\t\tprintf(\"2\\n\");\n\telse printf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint midd;\nint mid(int num1,int num2,int num3)\n{\n if(num2>num3&&num2<num1)\n {\n midd=num2;\n return ;\n }\n if(num2<num3&&num2>num1)\n {\n midd=num2;\n return ;\n }\n else\n mid(num3,num1,num2);\n}\nint main()\n{\n int x1,y1;\n scanf(\"%d%d\",&x1,&y1);\n int x2,y2;\n scanf(\"%d%d\",&x2,&y2);\n int x3,y3;\n scanf(\"%d%d\",&x3,&y3);\n if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n {\n printf(\"1\\n\");\n return 0;\n }\n if(x1!=x2&&x1!=x3&&x2!=x3&&y1!=y2&&y1!=y3&&y2!=y3)\n {\n printf(\"3\\n\");\n return 0;\n }\n if(x1!=x2&&x1!=x3&&x2!=x3)\n {\n mid(x1,x2,x3);\n if(midd==x1&&y1!=y2&&y1!=y3)\n {\n printf(\"3\\n\");\n return 0;\n }\n if(midd==x2&&y2!=y1&&y2!=y3)\n {\n printf(\"3\\n\");\n return 0;\n }\n if(midd==x3&&y3!=y2&&y3!=y1)\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n if(y1!=y2&&y1!=y3&&y2!=y3)\n {\n mid(y1,y2,y3);\n if(midd==y1&&x1!=x2&&x1!=x3)\n {\n printf(\"3\\n\");\n return 0;\n }\n if(midd==y2&&x2!=x1&&x2!=x3)\n {\n printf(\"3\\n\");\n return 0;\n }\n if(midd==y3&&x3!=x2&&x3!=x1)\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n printf(\"2\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint swap(int a,int d,int b,int e,int c,int f)\n{\n\tif(a==b)\n\t{\n\t\tif((d<e&&f>d&&f<e)||(d>e&&f<d&&f>e))return 3;\n\t\telse return 2;\n\t}\n\tif(a==c)\n\t{\n\t\tif((d<f&&e>d&&e<f)||((d>f&&e<d&&e>f)))return 3;\n\t\telse return 2;\n\t}\n\tif(b==c)\n\t{\n\t\tif((e<f&&d>e&&d<f)||(e>f&&d<e&&d>f))return 3;\n\t\telse return 2;\n\t}\n}\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse if(y1!=y2&&y2!=y3&&y3!=y1)printf(\"3\\n\"); \n\t\telse\tprintf(\"%d\\n\",swap(y1,x1,y2,x2,y3,x3));\n\t}\n\telse printf(\"%d\\n\",swap(x1,y1,x2,y2,x3,y3));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint i,j,a,b,x[5],y[5];\nint main()\n{\n\tfor(i=1;i<=3;i++)\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t\t\n\tif(x[1]==x[2] && x[2]==x[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(y[1]==y[2] && y[2]==y[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]!=x[2] && x[2]!=x[3] && x[1]!=x[3] && y[1]!=y[3] && y[1]!=y[2] && y[2]!=y[3])\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[2] && x[2]!=x[3] && ((y[1]<y[3] && y[2]>y[3]) || (y[1]>y[3] && y[2]<y[3])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[3] && x[3]!=x[2] && ((y[1]<y[2] && y[3]>y[2]) || (y[1]>y[2] && y[3]<y[2])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\n\tif(x[3]==x[2] && x[2]!=x[1] && ((y[3]<y[1] && y[2]>y[1]) || (y[3]>y[1] && y[2]<y[1])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t////////////////////////////////////////////////////////////////////////////////////\n\tif(y[1]==y[2] && y[2]!=y[3] && ((x[1]<x[3] && x[2]>x[3]) || (x[1]>x[3] && x[2]<x[3])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(y[1]==y[3] && y[3]!=y[2] && ((x[1]<x[2] && x[3]>x[2]) || (x[1]>x[2] && x[3]<x[2])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\n\tif(y[3]==y[2] && y[2]!=y[1] && ((x[3]<x[1] && x[2]>x[1]) || (x[3]>x[1] && x[2]<x[1])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\t\n\telse\n\t\tprintf(\"2\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint f1(int a,int b)\n{\n\tif(a>b) return a;\n\telse return b;\n}\nint f2(int a,int b)\n{\n\tif(a<b) return a;\n\telse return b;\n}\nint x1,y1,x2,y2,x3,y3;\nint main()\n{\n\tscanf(\"%d %d\",&x1,&y1);\n\tscanf(\"%d %d\",&x2,&y2);\n\tscanf(\"%d %d\",&x3,&y3);\n\tif((x1==x2 && x2==x3)||(y1==y2 && y2==y3))\n\t\tprintf(\"1\");\n\telse if((x1==x2 && (y3>=f1(y1,y2) || y3<=f2(y1,y2)))|| (x2==x3 && (y1<=f2(y2,y3) || y1>=f1(y2,y3))) || (y1==y2&&(x3>=f1(x1,x2)||x3<=f2(x1,x2))) || (y2==y3&&(x1>=f1(x2,x3)||x1<=f2(x2,x3))) || (x1==x3 &&(y2<=f2(y1,y3) || y2>=f1(y1,y3)) )|| (y1==y3 && (x2>=f1(x1,x3) || x2<=f2(x1,x3))))\n\t\tprintf(\"2\");\n\telse printf(\"3\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[7],i,j,b,c,d,e,f;\n for (i=0;i<6;i++)\n scanf(\"%d\",&a[i]);\n for (i=b=c=0;i<6;i+=2)\n for (j=i+2;j<6;j+=2)\n {if (a[i]==a[j]) b++,e=i+1,f=j+1;\n if (a[i+1]==a[j+1]) c++,e=i,f=j;}\n if (b==3||c==3) i=1;\n else if (c==1&&(b==1||(a[e]>a[6-e-f]&&a[f]>a[6-e-f])||(a[e]<a[6-e-f]&&a[f]<a[6-e-f]))) i=2;\n else if (b==1&&((a[e]>a[9-e-f]&&a[f]>a[9-e-f])||(a[e]<a[9-e-f]&&a[f]<a[9-e-f]))) i=2;\n else i=3;\n printf(\"%d\\n\",i);\n return 0;\n}\n/*2016-02-01 11:27:42.611*/"}, {"source_code": "#include<stdio.h>\n\nint min(int a, int b)\n{\n return a < b ? a : b;\n}\nint max(int a, int b)\n{\n return a > b ? a : b;\n}\nint main()\n{\n long x1, y1, x2, y2, x3, y3, count;\n scanf(\"%ld %ld\", &x1, &y1);\n scanf(\"%ld %ld\", &x2, &y2);\n scanf(\"%ld %ld\", &x3, &y3);\n\nif(x1==x2 && x2==x3)\n\t\tcount=1;\n\n\telse if(y1==y2 && y2==y3)\n\t\tcount=1;\n\n\telse if(x1==x2 && (y3<=min(y1,y2) || max(y1,y2)<=y3))\n\t\tcount=2;\n\n\telse if(x1==x3 && (y2<=min(y1,y3) || max(y1,y3)<=y2))\n\t\tcount=2;\n\n\telse if(x2==x3 && (y1<=min(y2,y3) || max(y2,y3)<=y1))\n\t\tcount=2;\n\n\telse if(y1==y2 && (x3<=min(x1,x2) || max(x1,x2)<=x3))\n\t\tcount=2;\n\n\telse if(y1==y3 && (x2<=min(x1,x3) || max(x1,x3)<=x2))\n\t\tcount=2;\n\n\telse if(y2==y3 && (x1<=min(x2,x3) || max(x2,x3)<=x1))\n\t\tcount=2;\n\n\telse\n\t\tcount=3;\n\n printf(\"%ld\", count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x1, x2, x3, y1, y2, y3, n;\n scanf(\"%d %d %d %d %d %d\", &x1, &y1, &x2, &y2, &x3, &y3);\n if((x1==x2 && x2==x3) || (y1 == y2 && y2 == y3))\n printf(\"1\\n\");\n else if((x1==x2 && ((y3 >= y1 && y3 >=y2) || ((y3<=y1 && y3<=y2)))) ||\n (x3==x2 && ((y1 >= y2 && y1 >=y3) || ((y1<=y2 && y1<=y3)))) ||\n (x1==x3 && ((y2 >= y1 && y2 >=y3) || ((y2<=y1 && y2<=y3)))) ||\n (y3==y2 && ((x1 >= x2 && x1 >=x3) || ((x1<=x2 && x1<=x3)))) ||\n (y1==y3 && ((x2 >= x1 && x2 >=x3) || ((x2<=x1 && x2<=x3)))) ||\n (y1==y2 && ((x3 >= x1 && x3 >=x2) || ((x3<=x1 && x3<=x2)))))\n printf(\"2\\n\");\n else\n printf(\"3\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint m[5][5];\nint cap(int n);\nint iguales(int i);\nint min(int x,int y);\nint max(int x,int y);\nint into(int v, int x, int y);\nint ret(int n,int x,int y, int z);\nint main(){\n scanf(\"%d %d %d %d %d %d\",&m[0][0],&m[1][0],&m[0][1],&m[1][1],&m[0][2],&m[1][2]);\n if(iguales(0) || iguales(1)){\n printf(\"1\");\n }else if(cap(0) || cap(1)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales(int i){\n return m[i][0]==m[i][1] && m[i][1]==m[i][2];\n}\nint cap(int n){\n return ret(n,0,1,2) || ret (n,1,2,0) || ret (n,2,0,1);\n}\nint ret(int n,int x,int y, int z){\n return m[n][x]==m[n][y] && !into(m[!n][z],m[!n][x],m[!n][y]);\n}\nint into(int v, int x, int y){\n return v>min(x,y) && v<max(x,y);\n}\nint min(int x,int y){\n if(x<y){\n return x;\n }else{\n return y;\n }\n}\nint max(int x,int y){\n if(x>y){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nstruct p{\n int x;\n int y;\n}p[3],q[3];\nint main()\n{\n\tint c=0,i=0,j=0;\n\tfor(i=0;i<3;i++)\n\tscanf(\"%d %d\",&p[i].x,&p[i].y);\n q[0]=p[0];\n q[1]=p[1];\n q[2]=p[2];\n for(i=0;i<3;i++)\n {\n \tfor(j=i;j<3;j++)\n \t{\n \t\tif(p[i].x > p[j].x )\n \t\t{\n \t\t\tstruct p t;\n \t\t\tt.x = p[j].x;\n \t\t\tt.y = p[j].y;\n \t\t\tp[j] = p[i];\n \t\t\tp[i]=t;\n\n \t\t}\n \t}\n }\n\n for(i=0;i<3;i++)\n {\n \tfor(j=i;j<3;j++)\n \t{\n \t\tif(q[i].y > q[j].y )\n \t\t{\n \t\t\tstruct p t;\n \t\t\tt.x = q[j].x;\n \t\t\tt.y = q[j].y;\n \t\t\tq[j] = q[i];\n \t\t\tq[i]=t;\n\n \t\t}\n \t}\n }\n\n if((p[0].x==p[1].x && p[1].x==p[2].x)|| (q[0].y==q[1].y&& q[1].y==q[2].y))\n c=1;\n else if( (p[0].x!=p[1].x && p[1].x!=p[2].x )&& (q[0].y!=q[1].y && q[1].y!=q[2].y ) )\n \tc=3;\n else if( (p[0].x==p[1].x || p[1].x==p[2].x) && (q[0].y==q[1].y || q[1].y==q[2].y))\n \tc=2;\n else if( (p[0].x!=p[1].x && p[1].x!=p[2].x && ((p[0].y==p[1].y && (p[2].y > p[0].y || p[2].y < p[0].y)) || (p[1].y==p[2].y && (p[2].y > p[0].y || p[2].y < p[0].y))) )\n || (q[0].y!=q[1].y && q[1].y!=q[2].y && ((q[0].x==q[1].x && (q[2].x > q[0].x || q[2].x < q[0].x)) || (q[1].x==q[2].x && (q[2].x > q[0].x || q[2].x < q[0].x))) ))\n \tc=2;\n else c=3;\n printf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n = 3, flag = 3, X[10], Y[10];\n\nvoid run(){\n int i, j, k;\n if (X[0] == X[1] && X[1] == X[2]) flag = 1;\n else{\n for (i = 0; i < n; i++){\n for (j = i + 1; j < n; j++){\n for (k = 0; k < n; k++){\n if (k == i || k == j) continue;\n if (Y[i] == Y[j] && ((X[k] <= X[i] && X[k] <= X[j]) || (X[k] >= X[i] && X[k] >= X[j]))){\n flag = 2;\n }\n }\n }\n }\n }\n}\n\nint main(){\n int i, j, k;\n for (i = 0; i < n; i++) scanf(\"%d %d\", &X[i], &Y[i]);\n\n run();\n if (flag != 1){\n for (i = 0; i < n; i++) k = X[i], X[i] = Y[i], Y[i] = k;\n run();\n }\n\n printf(\"%d\\n\", flag);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint x[5];\nint y[5];\n\nmain(){\n int i;\n for(i = 0; i < 3; i++){\n scanf(\"%d %d\", x+i, y+i);\n }\n if((x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2])){\n printf(\"1\");\n return 0;\n }\n if(x[0] == x[1]){\n if(y[0] >= y[1] && (y[2] >= y[0] || y[2] <= y[1])){\n printf(\"2\");\n return 0;\n }\n if(y[0] < y[1] && (y[2] <= y[0] || y[2] >= y[1])){\n printf(\"2\");\n return 0;\n }\n }\n if(x[0] == x[2]){\n if(y[0] >= y[2] && (y[1] >= y[0] || y[1] <= y[2])){\n printf(\"2\");\n return 0;\n }\n if(y[0] < y[2] && (y[1] <= y[0] || y[1] >= y[2])){\n printf(\"2\");\n return 0;\n }\n }\n if(x[2] == x[1]){\n if(y[2] >= y[1] && (y[0] >= y[2] || y[0] <= y[1])){\n printf(\"2\");\n return 0;\n }\n if(y[2] < y[1] && (y[0] <= y[2] || y[0] >= y[1])){\n printf(\"2\");\n return 0;\n }\n }\n if(y[0] == y[1]){\n if(x[0] >= x[1] && (x[2] >= x[0] || x[2] <= x[1])){\n printf(\"2\");\n return 0;\n }\n if(x[0] < x[1] && (x[2] <= x[0] || x[2] >= x[1])){\n printf(\"2\");\n return 0;\n }\n }\n if(y[0] == y[2]){\n if(x[0] >= x[2] && (x[1] >= x[0] || x[1] <= x[2])){\n printf(\"2\");\n return 0;\n }\n if(x[0] < x[2] && (x[1] <= x[0] || x[1] >= x[2])){\n printf(\"2\");\n return 0;\n }\n }\n if(y[2] == y[1]){\n if(x[2] >= x[1] && (x[0] >= x[2] || x[0] <= x[1])){\n printf(\"2\");\n return 0;\n }\n if(x[2] < x[1] && (x[0] <= x[2] || x[0] >= x[1])){\n printf(\"2\");\n return 0;\n }\n }\n printf(\"3\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b)\n{\n\treturn a<b?a:b;\n}\n\nint max(int a, int b)\n{\n\treturn a>b?a:b;\n}\n\nint bw(int i, int j, int k)\n{\n\t return min(i,j) <=k && k <=max(i,j);\n}\n\nint f(int x[],int y[],int i, int j, int k)\n{\n\treturn (x[k] == x[i] || x[k] == x[j]) && bw(y[i],y[j],y[k]) || \n\t\t(y[k] == y[i] || y[k] == y[j]) && bw(x[i],x[j],x[k]);\n}\n\nint main()\n{\n\tint x[3],y[3];\n\tint i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t}\n\n\tint ans = 0;int flag=0;\n\tif((x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2]))\n\t\tans = 1;\n\telse\n\t{\n\t\tif(f(x,y,0,1,2) || f(x,y,0,2,1) || f(x,y,1,2,0))\n\t\t\tans = 2;\n\t\telse\n\t\t\tans = 3;\n\t}\n\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong int i,j,k,n;\n\tlong int x1,x2,x3,y1,y2,y3;\n\tscanf(\"%ld %ld\",&x1,&y1);\n\tscanf(\"%ld %ld\",&x2,&y2);\n\tscanf(\"%ld %ld\",&x3,&y3);\n\n\tif((x1==x2 && x2==x3) || (y1==y2 && y2==y3))\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\n\tif((x1==x2))\n\t{\n\t\tif((y1>=y3 && y2>=y3) || (y1<=y3 && y2<=y3))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif((y1==y2))\n\t{\n\t\tif((x1>=x3 && x2>=x3) ||(x1<=x3 && x2<=x3))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tif((x1==x3))\n\t{\n\t\tif((y1>=y2 && y3>=y2) || (y1<=y2 && y3<=y2))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif((y1==y3))\n\t{\n\t\tif((x1>=x2 && x3>=x2) || (x1<=x2 && x3<=x2))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tif((x2==x3))\n\t{\n\t\tif((y2>=y1 && y3>=y1) || (y2<=y1 && y3<=y1))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif((y2==y3))\n\t{\n\t\tif((x2>=x1 && x3>=x1) || (x2<=x1 && x3<=x1))\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"3\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"3\\n\");\n\treturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tlong long int a[3];\n\tlong long int b[3];\n\tint i,j;\n\t\n\tfor(i=0;i<3;i++)\n\tscanf(\"%lld%lld\", &a[i],&b[i]);\n\t\n\tif((a[0]==a[1] && a[1]==a[2]) || (b[0]==b[1] && b[1]==b[2]))\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\t{\n\t\tint flag=0;\n\t\tfor(i=0;i<2;i++)\n\t\t{\n\t\t\tfor(j=i+1;j<3;j++)\n\t\t\t{\n\t\t\t\tif(a[j]==a[i])\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\tbreak;\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\t/*printf(\"%d\\t%d\\n\", i,j);*/\n\t\t\tif((b[3-i-j]>=b[i] && b[3-i-j]>=b[j]) || (b[3-i-j]<=b[i] && b[3-i-j]<=b[j]))\n\t\t\tprintf(\"2\");\n\t\t\t\n\t\t\telse\n\t\t\tprintf(\"3\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=0;i<2;i++)\n\t\t\t{\n\t\t\t\tfor(j=i+1;j<3;j++)\n\t\t\t\t{\n\t\t\t\t\tif(b[j]==b[i])\n\t\t\t\t\t{\n\t\t\t\t\t\tflag=1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(flag==1)\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\t/*printf(\"%d\\t%d\\n\", i,j);*/\n\t\t\t\tif((a[3-i-j]>=a[i] && a[3-i-j]>=a[j]) || (a[3-i-j]<=a[i] && a[3-i-j]<=a[j]))\n\t\t\t\tprintf(\"2\");\n\t\t\t\t\n\t\t\t\telse\n\t\t\t\tprintf(\"3\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"3\");\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t__int64 a1,a2,b1,b2,c1,c2;\n\twhile(scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d\",&a1,&a2,&b1,&b2,&c1,&c2)!=EOF)\n\t{\n\t\tif((a1==b1&&a1==c1)||(a2==b2&&a2==c2))printf(\"1\\n\");\n\t\telse if(a1==b1&&((a2<=c2&&b2<=c2)||(a2>=c2&&b2>=c2)))printf(\"2\\n\");\n\t\telse if(a1==c1&&((a2<=b2&&b2>=c2)||(a2>=b2&&b2<=c2)))printf(\"2\\n\");\n\t\telse if(b1==c1&&((a2<=c2&&b2>=a2)||(a2>=c2&&b2<=a2)))printf(\"2\\n\");\n\t\telse if(a2==b2&&((a1<=c1&&b1<=c1)||(a1>=c1&&b1>=c1)))printf(\"2\\n\");\n\t\telse if(a2==c2&&((a1<=b1&&b1>=c1)||(a1>=b1&&b1<=c1)))printf(\"2\\n\");\n\t\telse if(b2==c2&&((a1<=c1&&b1>=a1)||(a1>=c1&&b1<=a1)))printf(\"2\\n\");\n\t\telse printf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef long long int LLI;\n\n\n\n#define TRUE (1==1)\n#define FALSE (!TRUE)\n#define fo3(i,a,b) for(i=((int)a);i<=((int)b);i++)\n#define of3(i,a,b) for(i=((int)a);i>=((int)b);i--)\n#define in1(n) scanf(\"%d\",&(n))\n#define LL1(n) scanf(\"%I64d\",&(n))\n#define in2(n,m) scanf(\"%d%d\",&(n),&(m))\n#define pri(n) printf(\"%d\\n\",n)\n#define prs(n) printf(\"%s\\n\",n)\n#define prL(n) printf(\"%I64d\\n\",n)\n#define strin(n) scanf(\"%s\",n)\n#define newint(n) (int*)calloc((n),sizeof(int))\n#define arrint(ret,n,i) fo3(i,1,n) in1(ret[i-1])\n#define newLLI(n) (LLI*)calloc((n),sizeof(LLI))\n#define arrLLI(ret,n,i) fo3(i,1,n) LL1(ret[i-1])\n\nvoid fastWrite(FILE * ofp, int x) {\n int i = 12;\n char buff[i];\n buff[i] = 0;\n int neg = 0;\n if (x < 0){\n x = -x;\n neg = 1;\n }\n if (x == 0)\n buff[--i] = '0';\n else while (x != 0) {\n buff[--i] = (x % 10) + '0';\n x /= 10;\n }\n if (neg)\n buff[--i] = '-';\n fwrite(buff + i, sizeof(char), (12 - i), ofp);\n}\n\nvoid fastSpace(FILE * ofp){\n fwrite(\" \", sizeof(char), 1, ofp);\n}\nvoid fastNewLine(FILE * ofp) {\n fwrite(\"\\n\", sizeof(char), 1, ofp);\n}\n\ntypedef struct AL AL;\nstruct AL{\n int * vals;\n int size;\n int cap;\n};\nAL * ALCreate(int s) {\n AL * ret = (AL *) calloc(1, sizeof(AL));\n if (s == 0) ret->vals = NULL;\n else ret->vals = (int *) calloc(s, sizeof(int));\n ret->size = 0; ret->cap = s;\n return ret;\n}\nvoid ALAdd(AL * list, int ele) {\n if (list->cap == list->size) {\n int nC = ((list->cap << 1) | 1);\n list->vals = realloc(list->vals, sizeof(int) * nC);\n list->cap = nC;\n }\n list->vals[list->size++] = ele;\n}\n\n\ntypedef struct Pair {\n int fi, se;\n} Pair;\n\nint comp(Pair ** arr, int f, int s) {// CHANGE THIS\n if (arr[f]->fi != arr[s]->fi)\n return arr[f]->fi - arr[s]->fi;\n return arr[f]->se - arr[s]->se;\n}\n\nvoid sort(Pair ** arr, int size) { \n int i;\n if (size < 6) {\n int nSize = 0;\n Pair * swp;\n while (size != 0) {\n nSize = 0;\n for (i = 0; i < size - 1; i++) \n if (comp(arr, i, i + 1) > 0) { \n nSize = i + 1;\n swp = arr[i];\n arr[i] = arr[i + 1];\n arr[i + 1] = swp;\n }\n size = nSize;\n }\n return;\n }\n Pair ** tmp = (Pair **)calloc(size, sizeof(Pair *)); // CHANGE THIS\n int lSize = (size >> 1);\n int rSize = size - lSize;\n sort(arr, lSize); sort(arr + lSize, rSize);\n int lPtr = 0, rPtr = 0;\n int ptr = 0;\n while (ptr != size) {\n if (lPtr == lSize){\n tmp[ptr] = arr[lSize + (rPtr++)];\n } else if (rPtr == rSize || comp(arr, lPtr, lSize + rPtr) <= 0){ // CHANGE THIS\n tmp[ptr] = arr[lPtr++];\n } else {\n tmp[ptr] = arr[lSize + (rPtr++)];\n }\n ptr++;\n }\n for (i = 0; i < size; i++)\n arr[i] = tmp[i];\n free(tmp);\n}\n\nint bc(int x) {\n if (x <= 1)\n return x;\n return (x&1) + bc(x>>1);\n}\n\nint gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}\n\n#define MAX 100000\n#define NULL_CARRY -1\n#define NULL_VALUE 0\n\nLLI h1, h2;\n\nint carry[4 * MAX];\nint st[4 * MAX];\nint en[4 * MAX];\nLLI ans[2][4 * MAX];\n\n\nvoid init2(int index, int s, int e) {\n //printf(\"%d %d %d\\n\", index, s, e);\n st[index] = s;\n en[index] = e;\n ans[0][index] = 0;\n ans[1][index] = 0;\n carry[index] = NULL_CARRY;\n if (s == e)\n return;\n int mid = (s + e) >> 1;\n init2(index << 1, s, mid);\n init2((index << 1) | 1, mid + 1, e);\n}\n\n// Inclusive s and e\nvoid ITInit(int s, int e) {\n init2(1, s, e);\n}\n\nLLI fastExpo(LLI exp, LLI base, LLI mod) {\n if (exp == 0)\n return 1;\n if (exp == 1)\n return base % mod;\n LLI tmp = fastExpo(exp >> 1, base, mod);\n tmp *= tmp;\n tmp %= mod; \n if (exp & 1)\n tmp = (tmp * base) % mod;\n return tmp;\n}\n\n\nLLI aoMem[2][MAX + 10];\nLLI feMem[2][MAX + 10];\nvoid genAllOnes() {\n int i;\n LLI tmp1 = 0;\n LLI tmp2 = 0;\n LLI tmp3 = 1;\n LLI tmp4 = 1;\n fo3(i,0, MAX+9) {\n aoMem[TRUE][i] = tmp1;\n tmp1 = tmp1 * 10 + 1;\n tmp1 %= h1;\n aoMem[FALSE][i] = tmp2;\n tmp2 = tmp2 * 10 + 1;\n tmp2 %= h2;\n feMem[TRUE][i] = tmp3;\n tmp3 *= 10;\n tmp3 %= h1;\n feMem[FALSE][i] = tmp4;\n tmp4 *= 10;\n tmp4 %= h2;\n }\n}\nLLI allOnes(int len, LLI mod) {\n return aoMem[mod==h1][len];\n}\n\nLLI agg(int pre, int suf, int pow, LLI mod) {\n LLI mult = feMem[mod==h1][pow];\n mult *= suf;\n mult += pre;\n mult %= mod;\n //printf(\" returning from agg!\\n\");\n return mult;\n}\n\nvoid ITComp(int index) {\n if (carry[index] == NULL_CARRY) {\n ans[0][index] = agg(ans[0][index<<1], ans[0][(index<<1)|1], en[index<<1] - st[index<<1] + 1, h1);\n ans[1][index] = agg(ans[1][index<<1], ans[1][(index<<1)|1], en[index<<1] - st[index<<1] + 1, h2);\n } else {\n ans[0][index] = allOnes(en[index] - st[index] + 1, h1) * carry[index];\n ans[0][index] %= h1;\n ans[1][index] = allOnes(en[index] - st[index] + 1, h2) * carry[index];\n ans[1][index] %= h2;\n }\n}\n\nvoid push(int index) {\n if (carry[index] == NULL_CARRY)\n return;\n if (st[index] != en[index]) {\n carry[index<<1] = carry[index];\n ITComp(index<<1);\n carry[(index<<1)|1] = carry[index];\n ITComp((index<<1)|1);\n }\n carry[index] = NULL_CARRY;\n}\n\n\nvoid set2(int index, int s, int e, int value) {\n if (st[index] >= s && e >= en[index]) {\n carry[index] = value;\n ITComp(index);\n return;\n }\n if (st[index] > e || s > en[index])\n return;\n push(index);\n set2(index<<1, s, e, value);\n set2((index<<1)|1, s, e, value);\n ITComp(index);\n}\n\nvoid ITSet(int s, int e, int value) {\n set2(1, s, e, value);\n}\n\nLLI get2(int index, int type, int s, int e) {\n if (st[index] >= s && e >= en[index]) {\n //printf(\" Starting Push!\\n\");\n //push(index);\n ITComp(index);\n //printf(\" Out of Push!\\n\");\n if (type == 0) {\n //prL(agg(0, ans[type][index], st[index] - s, h1));\n return agg(0, ans[type][index], st[index] - s, h1);\n } \n return agg(0, ans[type][index], st[index] - s, h2);\n }\n if (st[index] > e || s > en[index])\n return NULL_VALUE;\n push(index);\n LLI ret = get2(index<<1, type, s, e) + get2((index<<1)|1, type, s, e);\n if (type == 0 && ret >= h1)\n ret -= h1;\n if (type == 1 && ret >= h2)\n ret -= h2;\n return ret;\n}\n\nLLI get(int type, int s, int e) {\n return get2(1, type, s, e);\n}\n\nint check2a(LLI x1, LLI y1, LLI x2, LLI y2, LLI x3, LLI y3) {\n return (x1 == x2 && ((y3 >= y1 && y3 >= y2) || (y3 <= y1 && y3 <= y2)));\n}\nint check2(LLI x1, LLI y1, LLI x2, LLI y2, LLI x3, LLI y3) {\n if (check2a(x1, y1, x2, y2, x3, y3))\n return TRUE;\n if (check2a(x3, y3, x1, y1, x2, y2))\n return TRUE;\n if (check2a(x2, y2, x3, y3, x1, y1))\n return TRUE;\n if (check2a(y1, x1, y2, x2, y3, x3))\n return TRUE;\n if (check2a(y3, x3, y1, x1, y2, x2))\n return TRUE;\n if (check2a(y2, x2, y3, x3, y1, x1))\n return TRUE;\n return FALSE;\n}\n\n\nint main(void) {\n LLI x1,x2,x3,y1,y2,y3;\n LL1(x1);\n LL1(y1);\n LL1(x2);\n LL1(y2);\n LL1(x3);\n LL1(y3);\n if ((x1 == x2 && x2 == x3) || (y1 == y2 && y2 == y3)) {\n pri(1);\n return 0;\n }\n if (check2(x1,y1,x2,y2,x3,y3)){\n pri(2);\n return 0;\n }\n pri(3);\n return 0;\n}"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\nint xx[3], yy[3];\n\nint check(int i, int j, int k) {\n\treturn xx[i] == xx[j] && (yy[k] <= yy[i] && yy[k] <= yy[j] || yy[k] >= yy[i] && yy[k] >= yy[j]) || yy[i] == yy[j] && (xx[k] <= xx[i] && xx[k] <= xx[j] || xx[k] >= xx[i] && xx[k] >= xx[j]);\n}\n\nint main() {\n\tint i;\n\n\tfor (i = 0; i < 3; i++)\n\t\tscanf(\"%d%d\", &xx[i], &yy[i]);\n\tif (xx[0] == xx[1] && xx[1] == xx[2] || yy[0] == yy[1] && yy[1] == yy[2])\n\t\tprintf(\"1\\n\");\n\telse if (check(0, 1, 2) || check(1, 2, 0) || check(2, 0, 1))\n\t\tprintf(\"2\\n\");\n\telse\n\t\tprintf(\"3\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n#define min(a, b) (a < b ? a : b)\n#define max(a, b) (a > b ? a : b)\n\nint main( void ) {\n\tint X[3], Y[3];\n\t\n\tfor( int i = 0; i < 3; i++ )\n\t\tscanf(\"%i %i\", &X[i], &Y[i]);\n\t\n\tif( (X[0] == X[1]) && (X[1] == X[2]) ) {\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif( (Y[0] == Y[1]) && (Y[1] == Y[2]) ) {\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tbool Two = false;\n\tfor( int i = 0; i < 3; i++ )\n\t\tfor( int j = i + 1; j < 3; j++ ) {\n\t\t\tbool c1 = (Y[3-i-j] <= min(Y[i], Y[j])) || (Y[3-i-j] >= max(Y[i], Y[j]));\n\t\t\tif( (X[i] == X[j]) && c1 )\n\t\t\t\tTwo = true;\n\t\t\t\n\t\t\tbool c2 = (X[3-i-j] <= min(X[i], X[j])) || (X[3-i-j] >= max(X[i], X[j]));\n\t\t\tif( (Y[i] == Y[j]) && c2 )\n\t\t\t\tTwo = true;\n\t\t\t\t\n\t\t}\n\t\n\tputs( Two ? \"2\" : \"3\" );\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint max(int a, int b)\n{\n\treturn a > b ? a : b;\n}\n\nint min(int a, int b)\n{\n\treturn a < b ? a : b;\n}\n\nint main()\n{\n\tint x1, y1, x2, y2, x3, y3;\n\n\tscanf(\"%d %d %d %d %d %d\", &x1, &y1, &x2, &y2, &x3, &y3);\n\n\tif (x1 == x2 && x2 == x3 || y1 == y2 && y2 == y3)\n\t\tputs(\"1\");\n\telse if (x1 == x2 && (y3 >= max(y1, y2) || y3 <= min(y1, y2)) || x1 == x3 && (y2 >= max(y1, y3) || y2 <= min(y1, y3)) || x3 == x2 && (y1 >= max(y3, y2) || y1 <= min(y3, y2)) || y1 == y2 && (x3 >= max(x1, x2) || x3 <= min(x1, x2)) || y1 == y3 && (x2 >= max(x1, x3) || x2 <= min(x1, x3)) || y3 == y2 && (x1 >= max(x3, x2) || x1 <= min(x3, x2)))\n\t\tputs(\"2\");\n\telse\n\t\tputs(\"3\");\n}"}, {"source_code": "#include<stdio.h>\n\nlong long a[4];\nlong long b[4];\nint n,j;\nint t,i;\nint ans;\nint q,p;\n\nint abs(int x) {\n return x > 0 ? x : -x;\n}\n\nint main() {\n int n = 3;\n for(i=0;i<n;i++) {\n scanf(\"%d %d\", &p, &q);\n a[i] = (long long)p;\n b[i] = (long long)q;\n }\n ans = 3;\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(b[i] > b[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n if (b[0] == b[1]) {\n if ((a[0] - a[2]) * (a[1] - a[2]) >= 0) ans = 2;\n }\n if (b[2] == b[1]) {\n if ((a[2] - a[0]) * (a[1] - a[0]) >= 0) ans = 2;\n }\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(a[i] > a[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n if (a[0] == a[1]) {\n if ((b[0] - b[2]) * (b[1] - b[2]) >= 0) ans = 2;\n }\n if (a[2] == a[1]) {\n if ((b[2] - b[0]) * (b[1] - b[0]) >= 0) ans = 2;\n }\n if (a[0] == a[1] && a[1] == a[2]) ans = 1;\n if (b[0] == b[1] && b[1] == b[2]) ans = 1;\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint find(int a, int b){\n\tint mark[3] = {0, 0, 0};\n\tint i;\n\tmark[a]++;\n\tmark[b]++;\n\tfor(i=0; i<3; i++) if(mark[i] != 1) return i;\n}\n\nint main(){\n\tint x[3], y[3];\n\tint i, j;\n\tint share;\n\tfor(i=0; i<3; i++) scanf(\"%d%d\", &x[i], &y[i]);\n\tif(x[0] == x[1] && x[1] == x[2]){\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\tif(y[0] == y[1] && y[1] == y[2]){\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\tfor(i=0; i<3; i++){\n\t\tfor(j=i+1; j<3; j++){\n\t\t\tif(y[i] == y[j]){\n\t\t\t\tif(x[i] < x[j] && (x[j] <= x[find(i,j)] || x[find(i,j)] <= x[i])){\n\t\t\t\t\tprintf(\"2\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif(x[j] < x[i] && (x[i] <= x[find(i,j)] || x[find(i,j)] <= x[j])){\n\t\t\t\t\tprintf(\"2\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\tfor(i=0; i<3; i++){\n\t\tfor(j=i+1; j<3; j++){\n\t\t\tif(x[i] == x[j]){\n\t\t\t\tif(y[i] < y[j] && (y[j] <= y[find(i,j)] || y[find(i,j)] <= y[i])){\n\t\t\t\t\tprintf(\"2\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif(y[j] < y[i] && (y[i] <= y[find(i,j)] || y[find(i,j)] <= y[j])){\n\t\t\t\t\tprintf(\"2\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\tprintf(\"3\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse if(x1==x2&&(y3-y1)*(y3-y2)>=0)\n\tprintf(\"2\");\n\telse if(x1==x3&&(y2-y1)*(y2-y3)>=0)\n\tprintf(\"2\");\n\telse if(x2==x3&&(y1-y2)*(y1-y3)>=0)\n\tprintf(\"2\");\n\telse if(y1==y2&&(x3-x1)*(x3-x2)>=0)\n\tprintf(\"2\");\n\telse if(y1==y3&&(x2-x1)*(x2-x3)>=0)\n\tprintf(\"2\");\n\telse if(y2==y3&&(x1-x2)*(x1-x3)>=0)\n\tprintf(\"2\");\n\telse \n\tprintf(\"3\");\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1!=x2&&x1!=x3&&y1!=y2&&y1!=y3&&x2!=x3&&y2!=y3)\n\tprintf(\"3\");\n\telse if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse\n\tprintf(\"2\");\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1!=x2&&x1!=x3&&y1!=y2&&y1!=y3)\n\tprintf(\"3\");\n\telse if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse\n\tprintf(\"2\");\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse if(x1==x2&&(y3-y1)*(y3-y2)>0)\n\tprintf(\"2\");\n\telse if(x1==x3&&(y2-y1)*(y2-y3)>0)\n\tprintf(\"2\");\n\telse if(x2==x3&&(y1-y2)*(y1-y3)>0)\n\tprintf(\"2\");\n\telse if(y1==y2&&(x3-x1)*(x3-x2)>0)\n\tprintf(\"2\");\n\telse if(y1==y3&&(x2-x1)*(x2-x3)>0)\n\tprintf(\"2\");\n\telse if(y2==y3&&(x1-x2)*(x1-x3)>0)\n\tprintf(\"2\");\n\telse \n\tprintf(\"3\");\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n\tprintf(\"1\");\n\telse if(x1==x2&&(y3-y1)*(y3-y2)<0)\n\tprintf(\"3\");\n\telse if(x1==x3&&(y2-y1)*(y2-y3)<0)\n\tprintf(\"3\");\n\telse if(x2==x3&&(y1-y2)*(y1-y3)<0)\n\tprintf(\"3\");\n\telse if(y1==y2&&(x3-x1)*(x3-x2)<0)\n\tprintf(\"3\");\n\telse if(y1==y3&&(x2-x1)*(x2-x3)<0)\n\tprintf(\"3\");\n\telse if(y2==y3&&(x1-x2)*(x1-x3)<0)\n\tprintf(\"3\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3&&y1!=y2&&y1!=y3&&y2!=y3)\n\tprintf(\"3\");\n\telse \n\tprintf(\"2\");\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long long int x1,x2,x3,y1,y2,y3;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if((x1==x2 && x2==x3) || (y1==y2 && y2==y3))\n printf(\"1\");\n\n else if((x1==x2 && x2!=x3)|| (y1==y2 && y2!=y3))\n {\n if(((y3>=y2 && y3>=y1) || (y3<=y2 && y3<=y1)) || ((x3>=x2 && x3>=x1) || (x3<=x2 && x3<=x1)))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if((x1==x3 && x2!=x3)|| (y1==y3 && y2!=y3))\n {\n if(((y2>=y3 && y2>=y1) || (y2<=y3 && y2<=y1)) || ((x2>=x3 && x2>=x1) || (x2<=x3 && x2<=x1)))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n else if((x3==x2 && x1!=x3)|| (y3==y2 && y1!=y3))\n {\n if(((y1>=y2 && y1>=y3) || (y1<=y2 && y1<=y3)) || ((x1>=x2 && x1>=x3) || (x1<=x2 && x1<=x3)))\n printf(\"2\");\n\n else\n printf(\"3\");\n }\n\n else\n printf(\"3\");\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d\",&x1,&y1);\n\tscanf(\"%d %d\",&x2,&y2);\n\tscanf(\"%d %d\",&x3,&y3);\n\tif((x1==x2 && x2==x3)||(y1==y2 && y2==y3))\n\t\tprintf(\"1\\n\");\n\telse if((x1==x2 && (y2==y3 || y1==y3))|| (x2==x3 && (y3==y1 || y2==y1)) || (y1==y2&&(x2==x3||x1==x3)) || (y2==y3&&x3==x1) || (x1==x3 &&(y3==y2 || y1==y2) )|| y1==y3 && (x1==x2 || x3==x2))\n\t\tprintf(\"2\\n\");\n\telse printf(\"3\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d %d\",&x1,&y1);\n\tscanf(\"%d %d\",&x2,&y2);\n\tscanf(\"%d %d\",&x3,&y3);\n\tif((x1==x2 && x2==x3)||(y1==y2 && y2==y3))\n\t\tprintf(\"1\\n\");\n\telse if(x1==x2 || x2==x3 || y1==y2 || y2==y3 || x1==x3 || y1==y3)\n\t\tprintf(\"2\\n\");\n\telse printf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n freopen(\"a.in\",\"r\",stdin);\n int x1,y1;\n scanf(\"%d%d\",&x1,&y1);\n int x2,y2;\n scanf(\"%d%d\",&x2,&y2);\n int x3,y3;\n scanf(\"%d%d\",&x3,&y3);\n if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n {\n printf(\"1\\n\");\n return 0;\n }\n if((x1==x2&&x1!=x3)||(y1==y2&&y1!=y3)||(x1==x3&&x1!=x2)||(y1==y3&&y1!=y2))\n {\n printf(\"2\\n\");\n return 0;\n }\n if((x1!=x2&&x1!=x3)||(y1!=y2&&y1!=y3))\n {\n printf(\"3\\n\");\n return 0;\n }\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int x1,y1;\n scanf(\"%d%d\",&x1,&y1);\n int x2,y2;\n scanf(\"%d%d\",&x2,&y2);\n int x3,y3;\n scanf(\"%d%d\",&x3,&y3);\n if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n {\n printf(\"1\\n\");\n return 0;\n }\n if((x1!=x2&&x1!=x3&&x2!=x3)||(y1!=y2&&y1!=y3&&y2!=y3))\n {\n printf(\"3\\n\");\n return 0;\n }\n printf(\"2\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int x1,y1;\n scanf(\"%d%d\",&x1,&y1);\n int x2,y2;\n scanf(\"%d%d\",&x2,&y2);\n int x3,y3;\n scanf(\"%d%d\",&x3,&y3);\n if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n {\n printf(\"1\\n\");\n return 0;\n }\n if((x1==x2&&x1!=x3)||(y1==y2&&y1!=y3)||(x1==x3&&x1!=x2)||(y1==y3&&y1!=y2)||(x2==x3&&x2!=x1)||(y2==y3&&y2!=y1))\n {\n printf(\"2\\n\");\n return 0;\n }\n if((x1!=x2&&x1!=x3)||(y1!=y2&&y1!=y3))\n {\n printf(\"3\\n\");\n return 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int x1,y1;\n scanf(\"%d%d\",&x1,&y1);\n int x2,y2;\n scanf(\"%d%d\",&x2,&y2);\n int x3,y3;\n scanf(\"%d%d\",&x3,&y3);\n if((x1==x2&&x1==x3)||(y1==y2&&y1==y3))\n {\n printf(\"1\\n\");\n return 0;\n }\n if((x1==x2&&x1!=x3)||(y1==y2&&y1!=y3))\n {\n printf(\"2\\n\");\n return 0;\n }\n if((x1!=x2&&x1!=x3)||(y1!=y2&&y1!=y3))\n {\n printf(\"3\\n\");\n return 0;\n }\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse if(y1==y2||y2==y3||y1==y3)printf(\"2\\n\"); \n\t\telse printf(\"3\\n\");\n\t}\n\telse printf(\"2\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint swap(int a,int b,int c,int d,int e,int f)\n{\n\tif(a==b)\n\t{\n\t\tif(f>d&&f<e)return 3;\n\t\telse return 2;\n\t}\n\tif(a==c)\n\t{\n\t\tif(e>d&&f<f)return 3;\n\t\telse return 2;\n\t}\n\tif(b==c)\n\t{\n\t\tif(d>e&&f<f)return 3;\n\t\telse return 2;\n\t}\n}\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse printf(\"%d\\n\",swap(y1,y2,y3,x1,x2,x3));\n\t}\n\telse printf(\"%d\\n\",swap(x1,x2,x3,y1,y2,y3));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse if(y1==y2||y2==y3||y1==y3)printf(\"2\\n\"); \n\t\telse printf(\"3\\n\");\n\t}\n\telse if(y1==y2||y2==y3||y1==y3)printf(\"2\\n\");\n\telse printf(\"3\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint swap(int a,int b,int c,int d,int e,int f)\n{\n\tif(a==b)\n\t{\n\t\tif(f>d&&f<e)return 3;\n\t\telse return 2;\n\t}\n\tif(a==c)\n\t{\n\t\tif(e>d&&f<f)return 3;\n\t\telse return 2;\n\t}\n\tif(b==c)\n\t{\n\t\tif(d>e&&f<f)return 3;\n\t\telse return 2;\n\t}\n}\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse if(y1!=y2&&y2!=y3&&y3!=y1)printf(\"3\\n\"); \n\t\telse\tprintf(\"%d\\n\",swap(y1,y2,y3,x1,x2,x3));\n\t}\n\telse printf(\"%d\\n\",swap(x1,x2,x3,y1,y2,y3));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x1,y1,x2,y2,x3,y3;\n\tscanf(\"%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3);\n\tif(x1==x2&&x2==x3)printf(\"1\\n\");\n\telse if(x1!=x2&&x2!=x3&&x1!=x3)\n\t{\n\t\tif(y1==y2&&y2==y3)printf(\"1\\n\");\n\t\telse printf(\"3\\n\");\n\t}\n\telse if(y1==y2||y2==y3||y1==y3)printf(\"2\\n\");\n\telse printf(\"3\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint i,j,a,b,x[5],y[5];\nint main()\n{\n\tfor(i=1;i<=3;i++)\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t\t\n\tif(x[1]==x[2] && x[2]==x[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(y[1]==y[2] && y[2]==y[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]!=x[2] && x[2]!=x[3] && x[1]!=x[3] && y[1]!=y[3] && y[1]!=y[2] && y[2]!=y[3])\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[2] && x[2]!=x[3] && ((x[1]<x[3] && x[2]>x[3]) || (x[1]>x[3] && x[2]<x[3])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[3] && x[3]!=x[2] && ((x[1]<x[2] && x[3]>x[2]) || (x[1]>x[2] && x[3]<x[2])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\n\tif(x[3]==x[2] && x[2]!=x[1] && ((x[3]<x[1] && x[2]>x[1]) || (x[3]>x[1] && x[2]<x[1])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\telse\n\t\tprintf(\"2\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint i,j,a,b,x[5],y[5];\nint main()\n{\n\tfor(i=1;i<=3;i++)\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t\t\n\tif(x[1]==x[2] && x[2]==x[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(y[1]==y[2] && y[2]==y[3])\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]!=x[2] && x[2]!=x[3] && x[1]!=x[3] && y[1]!=y[3] && y[1]!=y[2] && y[2]!=y[3])\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[2] && x[2]!=x[3] && ((y[1]<y[3] && y[2]>y[3]) || (y[1]>y[3] && y[2]<y[3])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\tif(x[1]==x[3] && x[3]!=x[2] && ((y[1]<y[2] && y[3]>y[2]) || (y[1]>y[2] && y[3]<y[2])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\n\tif(x[3]==x[2] && x[2]!=x[1] && ((y[3]<y[1] && y[2]>y[1]) || (y[3]>y[1] && y[2]<y[1])))\n\t{\n\t\tprintf(\"3\");\n\t\treturn 0;\n\t}\n\t\n\telse\n\t\tprintf(\"2\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint x1,x2,x3,y1,y2,y3;\nint main()\n{\n\tscanf(\"%d %d\",&x1,&y1);\n\tscanf(\"%d %d\",&x2,&y2);\n\tscanf(\"%d %d\",&x3,&y3);\n\tif (x1==x2 && x2==x3)\n\t\tprintf(\"1\");\n\telse if (y1==y2 && y2==y3)\n\t\tprintf(\"1\");\n\telse if (x1==x2 && x2!=x3)\n\t\tprintf(\"2\");\n\telse if (x2==x3 && x1!=x2)\n\t\tprintf(\"2\");\n\telse if (y1==y2 && y2!=y3)\n\t\tprintf(\"2\");\n\telse if (y2==y3 && y1!=y2)\n\t\tprintf(\"2\");\n\telse if (x1!=x2 && x1!=x3 && x2!=x3)\n\t\tprintf(\"3\");\n\telse if (y1!=y2 && y1!=y3 && y2!=y3)\n\t\tprintf(\"3\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,b,c,d,e,f,s;\n while(scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f) !=EOF)\n {\n if(a==c&&c==e||b==d&&d==f)\n s=1;\n else if(a==c||c==e&&b==d||d==f)\n s=2;\n else\n s=3;\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n/*2016-01-30 20:04:48.149*/"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,b,c,d,e,f,s;\n while(scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f) !=EOF)\n {\n if(a==c&&c==e||b==d&&d==f)\n s=1;\n else if(a==c||c==e||a==e&&b==d||d==f||b==f)\n s=2;\n else\n s=3;\n printf(\"%d\\n\",s);\n }\n return 0;\n}\n/*2016-01-30 20:09:59.604*/"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long x1, y1, x2, y2, x3, y3, count;\n scanf(\"%ld %ld\", &x1, &y1);\n scanf(\"%ld %ld\", &x2, &y2);\n scanf(\"%ld %ld\", &x3, &y3);\n\n if((x1==x2 && x2==x3 && x1==x3) || (y1==y2 && y2==y3 && y1==y3))\n count=1;\n\n else if((x1==x2 || x2==x3 || x1==x3) || (y1==y2 || y2==y3 || y1==y3))\n count=2;\n\n else\n count=3;\n\n printf(\"%ld\", count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long x1, y1, x2, y2, x3, y3, count;\n scanf(\"%ld %ld\", &x1, &y1);\n scanf(\"%ld %ld\", &x2, &y2);\n scanf(\"%ld %ld\", &x3, &y3);\n\n if((x1==x2 && x2==x3 && x1==x3) || (y1==y2 && y2==y3 && y1==y3))\n count=1;\n else if(x1==x2 && (y1==y3 || y2==y3))\n count=2;\n else if(x2==x3 && (y1==y2 || y1==y3))\n count=2;\n else if(x1==x3 && (y1==y2 || y2==y3))\n count=2;\n else if(y1==y2 && (x1==x3 || x2==x3))\n count=2;\n else if(y2==y3 && (x1==x2 || x1==x3))\n count=2;\n else if(y1==y3 && (x1==x2 || x2==x3))\n count=2;\n else if(x1==x2 && ((x3<x2 && x3<x1) || (x3>x2 && x3>x1) ) )\n count=2;\n else if(x2==x3 && ((x1<x2 && x1<x3) || (x1>x2 && x1>x3) ))\n count=2;\n else if(x2==x3 && ((x1<x2 && x1<x3)|| (x1>x2 && x1>x3)))\n count=2;\n else if(y1==y2 && ((y3<y2 && y3<y1) || (y3>y2 && y3>y1) ) )\n count=2;\n else if(y2==y3 && ((y1<y2 && y1<y3) || (y1>y2 && y1>y3) ))\n count=2;\n else if(y2==y3 && ((y1<y2 && y1<y3)|| (y1>y2 && y1>y3)))\n count=2;\n else\n count=3;\n\n printf(\"%ld\", count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long x1, y1, x2, y2, x3, y3, count;\n scanf(\"%ld %ld\", &x1, &y1);\n scanf(\"%ld %ld\", &x2, &y2);\n scanf(\"%ld %ld\", &x3, &y3);\n\n if((x1==x2 && x2==x3 && x1==x3) || (y1==y2 && y2==y3 && y1==y3))\n count=1;\n else if(x1==x2 && (y1==y3 || y2==y3))\n count=2;\n else if(x2==x3 && (y1==y2 || y1==y3))\n count=2;\n else if(x1==x3 && (y1==y2 || y2==y3))\n count=2;\n else if(y1==y2 && (x1==x3 || x2==x3))\n count=2;\n else if(y2==y3 && (x1==x2 || x1==x3))\n count=2;\n else if(y1==y3 && (x1==x2 || x2==x3))\n count=2;\n else\n count=3;\n\n printf(\"%ld\", count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x1, x2, x3, y1, y2, y3, n;\n scanf(\"%d %d %d %d %d %d\", &x1, &y1, &x2, &y2, &x3, &y3);\n if((x1==x2 && x2==x3) || (y1 == y2 && y2 == y3))\n printf(\"1\\n\");\n else if(x1==x2 || x2==x3 || x1==x3 || y1==y2 || y2==y3 || y1==y3)\n printf(\"2\\n\");\n else\n printf(\"3\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x1, x2, x3, y1, y2, y3, n;\n scanf(\"%d %d %d %d %d %d\", &x1, &y1, &x2, &y2, &x3, &y3);\n if((x1==x2 && x2==x3) || (y1 == y2 && y2 == y3))\n printf(\"1\\n\");\n else if((x1==x2 && ((y3 > y1 && y3 >y2) || ((y3<y1 && y3<y2)))) ||\n (x3==x2 && ((y1 > y2 && y1 >y3) || ((y1<y2 && y1<y3)))) ||\n (x1==x3 && ((y2 > y1 && y2 >y3) || ((y2<y1 && y2<y3)))) ||\n (y3==y2 && ((x1 > x2 && x1 >x3) || ((x1<x2 && x1<x3)))) ||\n (y1==y3 && ((x2 > x1 && x2 >x3) || ((x2<x1 && x2<x3)))) ||\n (y1==y2 && ((x3 > x1 && x3 >x2) || ((x3<x1 && x3<x2)))))\n printf(\"2\\n\");\n else\n printf(\"3\\n\");\n return 0;\n}\n"}, {"source_code": "int iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) || iguales2(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3 && n3==n1;\n}\n"}, {"source_code": "#include<stdio.h>\nint iguales2(int n1,int n2,int n3);\nint iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) && iguales2(y1,y2,y3)){\n printf(\"2\");\n }else if(x1==-494824697 && y1==-964138793){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3 || n3==n1;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3 && n3==n1;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int x,int y);\nint max(int x,int y);\nint ret(int a,int b,int y);\nint cap(int n1,int n2,int n3);\nint into(int v, int x, int y);\nint iguales(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3,r;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales(x1,x2,x3) || iguales(y1,y2,y3)){\n printf(\"1\");\n }else if(cap(x1,x2,x3) || cap(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales(int n1,int n2,int n3){\n return n1==n2 && n2==n3;\n}\nint cap(int n1,int n2,int n3){\n return ret(n1,n2,n3) || ret(n1,n3,n2) || ret(n2,n3,n1);\n}\nint ret(int a,int b,int y){\n return a==b && into(y,a,b);\n}\nint into(int v, int x, int y){\n return v>=min(x,y) && v<=max(x,y);\n}\nint min(int x,int y){\n if(x<y){\n return x;\n }else{\n return y;\n }\n}\nint max(int x,int y){\n if(x>y){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint iguales3(int n1,int n2,int n3);\nint distintos3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3,r;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(distintos3(x1,x2,x3) || distintos3(y1,y2,y3)){\n printf(\"3\");\n }else{\n printf(\"2\");\n }\n return 0;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3;\n}\nint distintos3(int n1,int n2,int n3){\n return n1!=n2 && n2!=n3 && n3!=n1;\n}"}, {"source_code": "#include<stdio.h>\nint iguales2(int n1,int n2,int n3);\nint iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) || iguales2(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3 || n3==n1;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3;\n}"}, {"source_code": "#include<stdio.h>\nint iguales2(int n1,int n2,int n3);\nint iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) || iguales2(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3 || n3==n1;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3 && n3==n1;\n}"}, {"source_code": "#include<stdio.h>\nint iguales2(int n1,int n2,int n3);\nint iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) && iguales2(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3 || n3==n1;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3 && n3==n1;\n}"}, {"source_code": "#include<stdio.h>\nint m[5][5];\nint cap(int n);\nint iguales(int i);\nint min(int x,int y);\nint max(int x,int y);\nint into(int v, int x, int y);\nint ret(int n,int x,int y, int z);\nint main(){\n scanf(\"%d %d %d %d %d %d\",&m[0][0],&m[1][0],&m[0][1],&m[1][1],&m[0][2],&m[1][2]);\n if(iguales(0) || iguales(1)){\n printf(\"1\");\n }else if(cap(0) || cap(1)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales(int i){\n return m[i][0]==m[i][1] && m[i][1]==m[i][2];\n}\nint cap(int n){\n return ret(n,0,1,2) || ret (n,1,2,0) || ret (n,2,0,1);\n}\nint ret(int n,int x,int y, int z){\n return m[n][x]==m[n][y] && !into(m[!n][z],m[!n][x],m[!n][y]);\n}\nint into(int v, int x, int y){\n return v>=min(x,y) && v<=max(x,y);\n}\nint min(int x,int y){\n if(x<y){\n return x;\n }else{\n return y;\n }\n}\nint max(int x,int y){\n if(x>y){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint iguales2(int n1,int n2,int n3);\nint iguales3(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales3(x1,x2,x3) || iguales3(y1,y2,y3)){\n printf(\"1\");\n }else if(iguales2(x1,x2,x3) || iguales2(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales2(int n1,int n2,int n3){\n return n1==n2 || n2==n3;\n}\nint iguales3(int n1,int n2,int n3){\n return n1==n2 && n2==n3;\n}"}, {"source_code": "#include<stdio.h>\nint min(int x,int y);\nint max(int x,int y);\nint ret(int a,int b,int y);\nint cap(int n1,int n2,int n3);\nint into(int v, int x, int y);\nint iguales(int n1,int n2,int n3);\nint main(){\n int x1,x2,x3,y1,y2,y3,r;\n scanf(\"%d %d %d %d %d %d\",&x1,&y1,&x2,&y2,&x3,&y3);\n if(iguales(x1,x2,x3) || iguales(y1,y2,y3)){\n printf(\"1\");\n }else if(cap(x1,x2,x3) || cap(y1,y2,y3)){\n printf(\"2\");\n }else{\n printf(\"3\");\n }\n return 0;\n}\nint iguales(int n1,int n2,int n3){\n return n1==n2 && n2==n3;\n}\nint cap(int n1,int n2,int n3){\n return ret(n1,n2,n3) || ret(n1,n3,n2) || ret(n2,n3,n1);\n}\nint ret(int a,int b,int y){\n return a==b && !into(y,a,b);\n}\nint into(int v, int x, int y){\n return v>=min(x,y) && v<=max(x,y);\n}\nint min(int x,int y){\n if(x<y){\n return x;\n }else{\n return y;\n }\n}\nint max(int x,int y){\n if(x>y){\n return x;\n }else{\n return y;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n = 3, flag = 3, X[10], Y[10];\n\nvoid run(){\n int i, j, k;\n if (X[0] == X[1] && X[1] == X[2]) flag = 1;\n else{\n for (i = 0; i < n; i++){\n for (j = i + 1; j < n; j++){\n for (k = 0; k < n; k++){\n if (k == i || k == j) continue;\n if (Y[i] == Y[j] && ((X[i] >= X[k] && X[j] >= X[k]) || (X[i] <= X[k] && X[j] <= X[k]))){\n flag = 2;\n return;\n }\n }\n }\n }\n }\n}\n\nint main(){\n int i, j, k;\n for (i = 0; i < n; i++) scanf(\"%d %d\", &X[i], &Y[i]);\n\n run();\n if (flag == 3){\n for (i = 0; i < n; i++) k = X[i], X[i] = Y[i], Y[i] = k;\n run();\n }\n\n printf(\"%d\\n\", flag);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint f(int x[],int i, int j, int k)\n{\n\treturn (x[k] == x[i] || x[k] == x[j]);\n}\n\nint main()\n{\n\tint x[3],y[3];\n\tint i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t}\n\n\tint ans = 0;int flag=0;\n\tif((x[0] == x[1] && x[1] == x[2]) && (y[0] == y[1] && y[1] == y[2]))\n\t\tans = 1;\n\telse\n\t{\n\t\tif(f(x,0,1,2) || f(x,0,2,1) || f(x,1,2,0))\n\t\t\tans = 2;\n\t\telse\n\t\t\tans = 3;\n\t}\n\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main()\n{\n\tint x[3],y[3];\n\tint i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t}\n\n\tint ans = 0;\n\tif(x[0] == x[1] && x[1] == x[2])\n\t\tans = 1; else\n\tif(y[0] == y[1] && y[1] == y[2])\n\t\tans = 1;else\n\tif(x[0]!=x[1] && x[1]!=x[2] && y[0] != y[1] && y[1] !=y[2] && x[0] !=x[2] && y[0] != y[2])\n\t\tans = 3;\n\telse\n\t\tans = 2;\n\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(int x[],int i, int j, int k)\n{\n\treturn (x[k] == x[i] || x[k] == x[j]);\n}\n\nint main()\n{\n\tint x[3],y[3];\n\tint i;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d %d\",&x[i],&y[i]);\n\t}\n\n\tint ans = 0;int flag=0;\n\tif((x[0] == x[1] && x[1] == x[2]) || (y[0] == y[1] && y[1] == y[2]))\n\t\tans = 1;\n\telse\n\t{\n\t\tif(f(x,0,1,2) || f(x,0,2,1) || f(x,1,2,0))\n\t\t\tans = 2;\n\t\telse\n\t\t\tans = 3;\n\t}\n\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tlong long int x1,y1,x2,y2,x3,y3;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\", &x1,&y1,&x2,&y2,&x3,&y3);\n\t\n\tif((y1==y2 && y2==y3) || (x1==x2 && x2==x3))\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\t{\n\t\tfloat s1=((float)y2-y1)/((float)x2-x1);\n\t\tfloat s2=((float)y3-y2)/((float)x3-x2);\n\t\tfloat s3=((float)y1-y3)/((float)x1-x3);\n\t\t\n\t\tif((int)(-1*s1*s2*s3)!=0 && ((int)(-1*s1*s2*s3)==s1 || (int)(-1*s1*s2*s3)==s2 || (int)(-1*s1*s2*s3)==s3))\n\t\tprintf(\"2\");\n\t\t\n\t\telse if((s1==0 || s2==0 || s3==0) && (x2-x1==0 || x3-x2==0 || x3-x1==0))\n\t\tprintf(\"2\");\n\t\t\n\t\telse\n\t\tprintf(\"3\");\n\t}\n\treturn 0;\n}\n\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tlong long int x1,y1,x2,y2,x3,y3;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\", &x1,&y1,&x2,&y2,&x3,&y3);\n\t\n\tif((y1==y2 && y2==y3) || (x1==x2 && x2==x3))\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\t{\n\t\tif((x2==x1 || x2==x3 || x3==x1) || (y2==y1 || y2==y3 || y3==y1))\n\t\tprintf(\"2\");\n\t\t\n\t\telse\n\t\tprintf(\"3\");\n\t}\n\treturn 0;\n}\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t__int64 a1,a2,b1,b2,c1,c2;\n\twhile(scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d\",&a1,&a2,&b1,&b2,&c1,&c2)!=EOF)\n\t{\n\t\tif((a1==b1&&a1==c1)||(a2==b2&&a2==c2))printf(\"1\\n\");\n\t\telse if(a1==b1&&((a2<=c2&&b2<=c2)||(a2>=c2&&b2>=c2)))printf(\"2\\n\");\n\t\telse if(a1==c1&&((a2<=b2&&b2>=c2)||(a2>=b2&&b2<=c2)))printf(\"2\\n\");\n\t\telse if(b1==c1&&((a2<=c2&&b2>=a2)||(a2>=c2&&b2<=a2)))printf(\"2\\n\");\n\t\telse printf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint a[4];\nint b[4];\nint n,j;\nint t,i;\nint ans, tmp;\n\nint abs(int x) {\n return x > 0 ? x : -x;\n}\n\nint main() {\n int n = 3;\n for(i=0;i<n;i++) {\n scanf(\"%d %d\", a+i,b+i);\n }\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(b[i] > b[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n //horizontal\n ans = 3;\n if ((a[0] - a[1]) * (a[2] - a[1]) <= 0) {\n tmp = 3;\n if(a[1] == a[0]) tmp --;\n if(a[2] == a[0]) tmp --;\n if (tmp < ans) ans = tmp;\n }\n tmp = 3;\n if (b[1] == b[0]) tmp --;\n if (b[2] == b[1]) tmp --;\n if (tmp < ans) ans = tmp;\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[4];\nlong long b[4];\nint n,j;\nint t,i;\nint ans;\nint q,p;\n\nint abs(int x) {\n return x > 0 ? x : -x;\n}\n\nint main() {\n int n = 3;\n for(i=0;i<n;i++) {\n scanf(\"%d %d\", &p, &q);\n a[i] = (long long)p;\n b[i] = (long long)q;\n }\n ans = 3;\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(b[i] > b[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n if (b[0] == b[1]) {\n if ((a[0] - a[2]) * (a[1] - a[2]) > 0) ans = 2;\n }\n if (b[2] == b[1]) {\n if ((a[2] - a[0]) * (a[1] - a[0]) > 0) ans = 2;\n }\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(a[i] > a[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n if (a[0] == a[1]) {\n if ((b[0] - b[2]) * (b[1] - b[2]) > 0) ans = 2;\n }\n if (a[2] == a[1]) {\n if ((b[2] - b[0]) * (b[1] - b[0]) > 0) ans = 2;\n }\n if (a[0] == a[1] && a[1] == a[2]) ans = 1;\n if (b[0] == b[1] && b[1] == b[2]) ans = 1;\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint a[4];\nint b[4];\nint n,j;\nint t,i;\nint ans, tmp;\n\nint abs(int x) {\n return x > 0 ? x : -x;\n}\n\nint main() {\n int n = 3;\n for(i=0;i<n;i++) {\n scanf(\"%d %d\", a+i,b+i);\n }\n for(i=0;i<n;i++) {\n for(j=i+1;j<n;j++) {\n if(b[i] > b[j]) {\n t=a[i];a[i]=a[j];a[j]=t;\n t=b[i];b[i]=b[j];b[j]=t;\n }\n }\n }\n //horizontal\n ans = 3;\n if ((a[0] - a[1]) * (a[2] - a[1]) <= 0) {\n tmp = 3;\n if(a[1] == a[0]) tmp --;\n if(a[2] == a[1]) tmp --;\n if (tmp < ans) ans = tmp;\n }\n tmp = 3;\n if (b[1] == b[0]) tmp --;\n if (b[2] == b[1]) tmp --;\n if (tmp < ans) ans = tmp;\n printf(\"%d\\n\", ans);\n}\n"}], "src_uid": "36fe960550e59b046202b5811343590d"} {"nl": {"description": "Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. Initially, each hole has $$$a_i$$$ stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next holes in a counter-clockwise direction.Note that the counter-clockwise order means if the player takes the stones from hole $$$i$$$, he will put one stone in the $$$(i+1)$$$-th hole, then in the $$$(i+2)$$$-th, etc. If he puts a stone in the $$$14$$$-th hole, the next one will be put in the first hole.After the move, the player collects all the stones from holes that contain even number of stones. The number of stones collected by player is the score, according to Resli.Resli is a famous Mancala player. He wants to know the maximum score he can obtain after one move.", "input_spec": "The only line contains 14 integers $$$a_1, a_2, \\ldots, a_{14}$$$ ($$$0 \\leq a_i \\leq 10^9$$$)\u00a0\u2014 the number of stones in each hole. It is guaranteed that for any $$$i$$$ ($$$1\\leq i \\leq 14$$$) $$$a_i$$$ is either zero or odd, and there is at least one stone in the board.", "output_spec": "Output one integer, the maximum possible score after one move.", "sample_inputs": ["0 1 1 0 0 0 0 0 0 7 0 0 0 0", "5 1 1 1 1 0 0 0 0 0 0 0 0 0"], "sample_outputs": ["4", "8"], "notes": "NoteIn the first test case the board after the move from the hole with $$$7$$$ stones will look like 1 2 2 0 0 0 0 0 0 0 1 1 1 1. Then the player collects the even numbers and ends up with a score equal to $$$4$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n long long a[14], b[14], ans = 0;\n for(int i = 0; i < 14; i++) scanf(\"%lld\", a+i);\n for(int i = 0; i < 14; i++){\n long long t = a[i];\n memcpy(b, a, sizeof(a));\n b[i] = 0;\n if(t / 14ll) for(int j = 0; j < 14; j++) b[j] += t / 14;\n t %= 14;\n for(int j = 1; t--; j++) b[(i+j)%14]++;\n t = 0;\n for(int j = 0; j < 14; j++) t += b[j] % 2 ? 0 : b[j];\n ans = ans > t ? ans : t;\n }\n printf(\"%lld\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,w=1,j;\nlong long int a[15]={0},t,b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\nfor(j=1;j<=14;j++)\n{if (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}}\n//for (r=1;r<=14;r++) printf(\"\\n%d %lld\",r,s[r]);\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tint i,j;\n\tlong long ini[14],mod[14],rep,r,res=0,can;\n\tfor(i=0;i<14;i++){\n\t\tscanf(\"%lld\",&ini[i]);\n\t}\n\tfor(i=0;i<14;i++){\n\t\tcan=0;\n\t\tfor(j=0;j<14;j++)mod[j]=ini[j];\n\t\trep=mod[i];\n\t\tmod[i]=0;\n\t\tr=rep%14;\n\t\trep/=14;\n\t\tj=i+1;\n\t\twhile(r){\n\t\t\tmod[(j%14)]++;\n\t\t\tj++;\n\t\t\tr--;\n\t\t}\n\t\tfor(j=0;j<14;j++){\n\t\t\tmod[j]+=rep;\n\t\t\tif(mod[j]%2==0)can+=mod[j];\n\t\t}\n\t\tif(can>res)res=can;\n\t}\n\tprintf(\"%lld\\n\",res);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a[14];\n\tfor(int i=0;i<14;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint b[14]={0};\n\tlong long ans=0;\n\tfor(int i=0;i<14;i++){\n\t\tlong long sum=0;\n\t\tfor(int j=0;j<14;j++){\n\t\t\tb[j]=a[j];\n\t\t}\n\t\tb[i]=0;\n\t\tint num=a[i];\n\t\tint m=num/14;\n\t\tnum%=14;\n\t\tint j=i;\n\t\tfor(int j=0;j<14;j++){\n\t\t\tb[j]+=m;\n\t\t}\n\t\twhile(num--){\n\t\t\tb[(++j)%14]++;\n\t\t}\n\t\tfor(int i=0;i<14;i++){\n\t\t\tif(b[i]%2==0){\n\t\t\t\tsum+=b[i];\n\t\t\t}\n\t\t}\n\t\tif(ans<sum){\n\t\t\tans=sum;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n int A[20],B[20],i,j,count,m,n,k;\n long long int max=-1,sum;\n for(i=1;i<=14;i++)\n {\n scanf(\"%d\",&A[i]);\n B[i] = A[i];\n }\n \n for(i=1;i<=14;i++)\n {\n count=1; sum=0;\n if(A[i]>0)\n {\n m = A[i]/14;\n n = A[i]%14;\n B[i] =0;\n for(j=1;j<=14;j++)\n {\n B[j]= B[j]+ m ;\n }\n k=i;\n while(count<=n)\n {\n if(k+1 ==14)\n B[14]++;\n else\n B[(k+1)%14]++;\n k++;\n count++;\n }\n for(j=1;j<=14;j++)\n {\n if(B[j]%2==0)\n {\n sum = sum + B[j];\n }\n }\n \n if(sum>=max)\n max = sum;\n for(j=1;j<=14;j++)\n {\n B[j]=A[j];\n }\n \n }\n }\n printf(\"%lld\",max);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nstatic long long v[14], vaux[14];\n\nint main(void)\n{\n int imax, i, j;\n long long nmax, total = 0, trip, ctotal;\n\n nmax = imax = 0;\n\n for (i = 0; i < 14; i++) {\n scanf(\"%lld\", &v[i]);\n }\n\n for (i = 0; i < 14; i++) {\n imax = i;\n nmax = v[imax];\n memcpy(vaux, v, sizeof vaux);\n v[imax] = 0;\n trip = nmax / 14;\n for (j = 0; j < 14; j++) {\n v[j] += trip;\n }\n\n trip = nmax % 14;\n while (trip) {\n ++imax;\n imax %= 14;\n v[imax]++;\n trip--;\n }\n\n ctotal = 0;\n for (j = 0; j < 14; j++) {\n if (v[j] % 2 == 0) {\n ctotal += v[j];\n }\n }\n\n if (ctotal > total) {\n total = ctotal;\n }\n\n memcpy(v, vaux, sizeof vaux);\n }\n\n printf(\"%lld\\n\", total);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long a[15],temp[15],ans=0,y;\nlong long check(int x)\n{\n long long koto=temp[x]/14;\n long long rem=temp[x]%14;\n long long ret=0;\n temp[x]=0;\n for(int i=x+1;i<=14;i++)\n temp[i]+=koto;\n for(int i=1;i<=x;i++)\n temp[i]+=koto;\n for(int i=x+1;rem>0 && i<=14;i++,rem--)\n temp[i]++;\n for(int i=1;rem>0 && i<=x;i++,rem--)\n temp[i]++;\n for(int i=1;i<=14;i++)\n if(temp[i]%2==0)\n ret+=temp[i];\n return ret;\n}\nint main()\n{\n for(int i=1;i<=14;i++)\n scanf(\"%I64d\",&a[i]);\n for(int z=1;z<=14;z++)\n {\n for(int i=1;i<=14;i++)\n temp[i]=a[i];\n y=check(z);\n if(y>ans)\n ans=y;\n }\n printf(\"%I64d\",ans);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n for(long long int j = 0; j<14;j++) d[j] = a[j];\n long long int b = a[i];\n d[i] = 0;\n if(i!=13) c = i+1;\n else c = 0;\n if((b>0)&&(b<=14))\n {\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }\n else if(b>0)\n {\n long long int m = b/14; long long int n = b%14 ;\n for(long long int j = 0; j < 14; j++) d[j] = d[j]+m;\n for(long long int j = 1;j<=n;j++) \n {\n d[c]++;\n if(c!=13) c++;\n else c = 0;\n }\n }\n for(long long int j = 0; j<14; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n if(c1>c2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n for(long long int j = 0; j<14;j++) d[j] = a[j];\n long long int b = a[i];\n d[i] = 0;\n if(i!=13) c = i+1;\n else c = 0;\n /*if((b>0)&&(b<=14))\n {\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }*/\n if(b>0)\n {\n long long int m = b/14; long long int n = b%14 ;\n for(long long int j = 0; j < 14; j++) d[j] = d[j]+m;\n for(long long int j = 1;j<=n;j++) \n {\n d[c]++;\n if(c!=13) c++;\n else c = 0;\n }\n }\n for(long long int j = 0; j<14; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n if(c1>c2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t//code\n\tlong long int a[14],c=0;\n\tfor(int i=0;i<14;i++)\n\t scanf(\"%lld\",a+i);\n\tlong long int b[14];\n\tfor(int i=0;i<14;i++)\n\t{\n\t if(a[i]==0) continue;\n\t for(int j=0;j<14;j++)\n\t b[j]=a[j];\n\t long long int m1=a[i]/14,m2=a[i]%14,s=0;\n\t b[i]=0;\n\t for(int j=0;j<14;j++)\n\t b[j]=b[j]+m1;\n\t int j=i;\n\t while(m2--)//do something\n\t {\n\t if(j==13) j=0;\n\t else j++;\n\t b[j]++;\n\t }\n for(j=0;j<14;j++)\n if(b[j]%2==0) s=s+b[j];\n if(s>c) c=s;\n\t}\n\tprintf(\"%lld\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long a[14];\n\n\tlong long b[14];\n\n\tlong long earn,max;\n\tlong long total;\n\n\tint i,j;\n\n\tfor (i=0;i<14;i++)\n\t\tscanf(\"%lld\",a+i);\n\n\tmax = 0;\n\n\tfor (i=0;i<14;i++)\n\t{\n\t\tearn = 0;\n\t\tfor (j=0;j<14;j++)\n\t\t\tb[j]=a[j];\n\n\t\tif (b[i])\n\t\t{\n\t\t\ttotal = b[i];\n\t\t\tb[i] = 0;\n\n\t\t\tfor (j=0;j<14;j++)\n\t\t\t{\n\t\t\t b[j]+=(total/14);\n\t\t\t}\n\n\t\t\ttotal = total%14;\n\n\t\t\tj=1;\n\t\t\twhile (total)\n\t\t\t{\n\t\t\t\tb[(i+j)%14]++;\n\t\t\t\ttotal--;\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\tfor (j=0;j<14;j++)\n\t\t\t{\n\t\t\t\tif ((b[j]%2)==0) earn+=b[j];\n\t\t\t}\n\t\t}\n\n\t\tif (earn>max) max = earn;\n\t}\n\tprintf(\"%lld\\n\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#define n 14\nint main(){\n long long count=0,max=0,x,y,z,a[14],c[14];\n for(int i=0;i<14;i++){\n scanf(\"%I64d\",&a[i]);\n }\n \n for(int i=0;i<14;i++){\n c[i]=a[i];}\n \n for(int i=0;i<n;i++){\n \tlong t = i;\n \tif(c[i]==0);\n \telse if(c[i]<14){ x =c[i]; c[i]=0;\n\t\t\tfor(int i=0;i<x;i++){\n\t\t\t\tc[(t+i+1)%14]+=1;\n\t\t\t}}\n \telse {\n \t\t x =c[i]; c[i]=0;\n \t\ty = x/14;\n \t\tfor(int i=0;i<n;i++){\n \t\t\tc[i]+=y;\n\t\t\t}\n\t\t\ty = x%14;\n\t\t\tfor(int i=0;i<y;i++){\n\t\t\t\tc[(t+i+1)%14]+=1;\n\t\t\t}\n\t\t}\n\t\n\t\n\n\tfor(int i=0;i<n;i++){\n\t\tif(c[i]%2==0)count+=c[i];\n\t}\n\tif(count>max)max=count;\n\tcount = 0;\n\tfor(int i=0;i<14;i++)c[i]=a[i];\n\t\n\t}\n\tprintf(\"%I64d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,w=1,j;\nlong long int a[15]={0},t,b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\nfor(j=1;j<=14;j++)\n{if (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}}\n//for (r=1;r<=14;r++) printf(\"\\n%d %lld\",r,s[r]);\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main(){\n\tlong long int a[14];\n\tlong long int b[14];\n\tfor (int i = 0; i < 14; ++i)\n\t{\n\t\tscanf(\"%I64d\", &a[i]);\n\t\tb[i]= a[i];\n\t}\n\tlong long int ret= 0;\n\tfor (int i = 0; i < 14; ++i)\n\t{\n\t\tlong long int ans= 0;\n\t\tlong long int x= a[i] % (long long)14;\n\t\tb[i]= a[i] / (long long)14;\n\t\tfor (int j = 1; j <= x; ++j)\n\t\t{\n\t\t\tb[(j+i)%14]= b[(j+i)%14]+ 1 + a[i]/ (long long)14;\n\t\t}\n\t\tif(x== 0){\n\t\t\tfor (int j = 1; j < 14; ++j)\n\t\t\t{\n\t\t\t\tb[(j+i)%14]= b[(j+i)%14]+ a[i]/ (long long)14;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor (int j = x+1; j < 14; ++j)\n\t\t\t{\n\t\t\t\tb[(j+i)%14]= b[(j+i)%14]+ a[i]/ (long long)14;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < 14; ++j)\n\t\t{\n\t\t\t//printf(\"%d \", b[j]);\n\t\t\tif(b[j]%2==0){\n\t\t\t\tans= ans+ b[j];\n\t\t\t}\n\t\t}\n\t\t//printf(\"\\n\");\n\t\tfor (int j = 0; j < 14; ++j)\n\t\t{\n\t\t\tb[j]= a[j];\n\t\t}\n\t\t//printf(\"%d \", ans);\n\t\tif(ans> ret)ret= ans;\n\n\t}\n\t\t\n\tprintf(\"%I64d\", ret);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nlong long read()\n{\n char ch = getchar();\n long long f = 1;\n long long x = 0;\n while(ch < '0' || ch > '9'){if(ch == '-')f = 0;ch = getchar();}\n while(ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}\n return f?x:x*-1;\n}\nint main()\n{\n long long a[15] = {};\n for(long long i = 1;i <= 14;i ++)\n {\n a[i] = read();\n }\n long long max = 0;\n long long temp[15] = {};\n for(long long i = 1;i <= 14;i ++)\n {\n for(long long j = 1;j <= 14;j ++)\n {\n temp[j] = a[j];\n }\n\n if(temp[i] != 0)\n {\n long long t = temp[i];\n temp[i] = 0;\n long long q = t / 14;\n long long w = t % 14;\n\n for(long long l = 1;l <= 14;l ++)\n {\n temp[l] += q;\n }\n long long x = i + 1;\n for(long long l = 0;l < w;l ++)\n {\n if(x > 14)\n {\n x = 1;\n }\n temp[x ++] ++;\n }\n }\n long long sum = 0;\n for(long long j = 1;j <= 14;j ++)\n {\n if(temp[j] % 2 == 0)\n {\n sum += temp[j];\n }\n }\n if(sum > max)\n {\n max = sum;\n }\n }\n printf(\"%lld\",max);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n\n#define uint uint64_t\n\nint\nmain()\n{\n const uint L = 14;\n uint a[L];\n for (uint i = 0; i < L; ++i) {\n scanf(\"%\"SCNu64, &a[i]);\n }\n \n uint max = 0;\n for (uint i = 0; i < L; ++i) {\n uint x = a[i] / 14;\n uint y = a[i] % 14;\n uint r;\n if (x % 2 == 0)\n r = x;\n else\n r = 0;\n for (uint j = 0; j < L-1; ++j) {\n uint z = a[(i+1+j)%L] + x + (j<y);\n if (z % 2 == 0)\n r += z;\n }\n if (r > max)\n max = r;\n }\n printf(\"%\"PRIu64\"\\n\", max);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult+=b; \n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h> \n#define ll long long\n\nint main()\n{\n\tll a[14],b[14]={0},c[14];\t//b\u6570\u7ec4\u7528\u6765\u5b58\u50a8\u6bcf\u6b21\u6a21\u62df\u7684\u7ed3\u679c\uff0ca\u6570\u7ec4\u7528\u6765\u6a21\u62df. \n\tll i,k,g,m,n,max;\n\t\n\tfor(i=0;i<14;i++)\n\t\tscanf(\"%lld\",&c[i]);\n\t\n\tfor(i=0;i<14;i++)\n\t{\n\t\tfor(n=0;n<14;n++)\n\t\t\ta[n]=c[n];\n\t\t\n\t\tg=a[i]/14; //g\u662f\u6bcf\u4e2a\u6d1e\u90fd\u8981\u52a0\u7684\u4e2a\u6570 \n\t\tm=a[i]%14;\t //m\u662f\u5faa\u73af\u7684\u6b21\u6570 \n\t\ta[i]=0; //\u6a21\u62df\u5c06\u77f3\u5934\u53d6\u51fa \n\t\t\n\t\tfor(n=0;n<14;n++)\n\t\t\ta[n]+=g;\n\t\t\n\t\tfor(k=1;k<=m;k++)\n\t\t{\n\t\t\ta[(k+i)%14]+=1;\n\t\t}\n\t\t\n\t\tfor(n=0;n<14;n++)\n\t\t{\n\t\t\tif(a[n]%2==0)\n\t\t\t\tb[i]+=a[n];\n\t\t}\n\t}\n\t\n\tmax=b[0];\n\t\n\tfor(i=1;i<14;i++)\n\t{\n\t\tif(max<b[i])\n\t\t\tmax=b[i];\n\t}\n\t\n\t\n\tprintf(\"%lld\",max);\n\t\n\treturn 0; \n} "}, {"source_code": "/* Coached by rainboy */\n#include <stdio.h>\n\nint main() {\n\tstatic int aa[14];\n\tint i;\n\tlong long max;\n\n\tfor (i = 0; i < 14; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmax = 0;\n\tfor (i = 0; i < 14; i++)\n\t\tif (aa[i] > 0) {\n\t\t\tstatic int bb[14];\n\t\t\tint j, a;\n\t\t\tlong long sum;\n\n\t\t\ta = aa[i];\n\t\t\tfor (j = 0; j < 14; j++) {\n\t\t\t\tbb[j] = j == i ? 0 : aa[j];\n\t\t\t\tbb[j] += a / 14;\n\t\t\t}\n\t\t\tfor (j = i + 1; j <= i + (a % 14); j++)\n\t\t\t\tbb[j % 14]++;\n\t\t\tsum = 0;\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tsum += (bb[j] % 2 == 0 ? bb[j] : 0);\n\t\t\tif (max < sum)\n\t\t\t\tmax = sum;\n\t\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tstatic int aa[14];\n\tint i;\n\tlong long max;\n\n\tfor (i = 0; i < 14; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmax = 0;\n\tfor (i = 0; i < 14; i++)\n\t\tif (aa[i] > 0) {\n\t\t\tstatic int bb[14];\n\t\t\tint j, a;\n\t\t\tlong long sum;\n\n\t\t\ta = aa[i];\n\t\t\tfor (j = 0; j < 14; j++) {\n\t\t\t\tbb[j] = j == i ? 0 : aa[j];\n\t\t\t\tbb[j] += a / 14;\n\t\t\t}\n\t\t\tfor (j = i + 1; j <= i + (a % 14); j++)\n\t\t\t\tbb[j % 14]++;\n\t\t\tsum = 0;\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tsum += (bb[j] % 2 == 0 ? bb[j] : 0);\n\t\t\tif (max < sum)\n\t\t\t\tmax = sum;\n\t\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n long long arr[14];\n int i,j;\n for(i=0; i<14; ++i){\n scanf(\"%lld\", &arr[i]);\n }\n long long brr[14];\n long long k=0;\n long long r;\n long long q;\n long long rem,div;\n for(i=0; i<14; ++i){\n if(arr[i]!=0){\n for(j=0; j<14; ++j){\n brr[j]=arr[j];\n }\n q=brr[i];\n brr[i]=0;\n j=i+1;\n while(q>0 && j<14){\n ++brr[j];\n --q;\n ++j;\n }\n div=q/14;\n rem=q%14;\n if(div!=0){\n for(j=0; j<14; ++j){\n brr[j]+=div;\n }\n }\n for(j=0; j<rem; ++j){\n ++brr[j];\n }\n r=0;\n for(j=0; j<14; ++j){\n if(brr[j]%2==0){\n r+=brr[j];\n }\n }\n if(r>k){\n k=r;\n }\n }\n }\n printf(\"%lld\", k);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a[14];\n int b[14];\n for(int i = 0; i < 14; ++i) {\n scanf(\"%d\", &a[i]);\n }\n long long ans = 0;\n for(int i = 0; i < 14; ++i) {\n if(a[i]) {\n memcpy(b, a, sizeof(a));\n b[i] = 0;\n for(int j = 0; j < 14; ++j) {\n b[(i + j + 1) % 14] += a[i] / 14 + (a[i] % 14 > j);\n }\n long long cur = 0;\n for(int j = 0; j < 14; ++j) {\n if(!(b[j] & 1)) {\n cur += b[j];\n }\n }\n if(ans < cur) {\n ans = cur;\n }\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h> \n#define ll long long\n\nint main()\n{\n\tll a[14],b[14]={0},c[14];\t//b\u6570\u7ec4\u7528\u6765\u5b58\u50a8\u6bcf\u6b21\u6a21\u62df\u7684\u7ed3\u679c\uff0ca\u6570\u7ec4\u7528\u6765\u6a21\u62df. \n\tll i,k,g,m,n,max;\n\t\n\tfor(i=0;i<14;i++)\n\t\tscanf(\"%lld\",&c[i]);\n\t\n\tfor(i=0;i<14;i++)\n\t{\n\t\tfor(n=0;n<14;n++)\n\t\t\ta[n]=c[n];\n\t\t\n\t\tg=a[i]/14; //g\u662f\u6bcf\u4e2a\u6d1e\u90fd\u8981\u52a0\u7684\u4e2a\u6570 \n\t\tm=a[i]%14;\t //m\u662f\u5faa\u73af\u7684\u6b21\u6570 \n\t\ta[i]=0; //\u6a21\u62df\u5c06\u77f3\u5934\u53d6\u51fa \n\t\t\n\t\tfor(n=0;n<14;n++)\n\t\t\ta[n]+=g;\n\t\t\n\t\tfor(k=1;k<=m;k++)\n\t\t{\n\t\t\ta[(k+i)%14]+=1;\n\t\t}\n\t\t\n\t\tfor(n=0;n<14;n++)\n\t\t{\n\t\t\tif(a[n]%2==0)\n\t\t\t\tb[i]+=a[n];\n\t\t}\n\t}\n\t\n\tmax=b[0];\n\t\n\tfor(i=1;i<14;i++)\n\t{\n\t\tif(max<b[i])\n\t\t\tmax=b[i];\n\t}\n\t\n\t\n\tprintf(\"%lld\",max);\n\t\n\treturn 0; \n} "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define N 14\nint main()\n{\n long long int a[N];\n long long int b[N];\n long long int max = 0;\n for(int i=0;i<N;i++)\n scanf(\"%lld\",a+i);\n for(int i=0;i<N;i++)\n {\n if(!a[i]) continue;\n long long int temp = 0;\n int n = a[i]/N;\n int m = a[i]%N;\n for(int j =0;j<N;j++)\n b[j] = 0;\n for(int j=1;j<=m;j++)\n {\n b[(j+i)%N]++;\n }\n for(int j=0;j<N;j++)\n {\n if(j!=i)\n b[j] += a[j] + n;\n else b[j] += n;\n if((b[j]&1)==0)\n temp += b[j];\n }\n max = (max>temp)?max:temp;\n }\n printf(\"%lld\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long par,maxi,a[15],i,j,k,nr,test[15];\n\nint main()\n{\n for(i=1;i<=14;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=1;i<=14;i++)\n {\n par=0;\n for(j=1;j<=14;j++)\n test[j]=a[j];\n nr=test[i];\n test[i]=0;\n k=i+1;\n if(k==15)\n k=1;\n while(nr%14!=0)\n {\n nr--;\n test[k]++;\n k++;\n if(k==15)\n k=1;\n }\n for(k=1;k<=14;k++)\n test[k]+=nr/14;\n\n for(j=1;j<=14;j++)\n if(test[j]%2==0)\n par+=test[j];\n\n if(par>maxi)\n maxi=par;\n }\n\n printf(\"%I64d\",maxi);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\nint main()\n{\nint arr[14];\nint temp[14];\nint i,j;\nlong long int max=INT_MIN;\nfor(i=0;i<14;i++)\n{\n\tscanf(\"%d\",&arr[i]);\n}\nfor(i=0;i<14;i++)\n{\n\tfor(j=0;j<14;j++)\n\t\ttemp[j]=arr[j];\n\tif(arr[i]==0)\n\t\tcontinue;\n\tint stones=arr[i];\n\ttemp[i]=0;\n\tint cur=(i+1)%14;\n\tfor(j=0;j<14;j++)\n\t{\n\t\ttemp[j]+=(stones/14);\n\t}\n\tstones=stones%14;\n\twhile(stones)\n\t{\n\t\ttemp[cur]+=1;\n\t\tstones--;\n\t\tcur++;\n\t\tcur=cur%14;\n\t}\n\tlong long int score=0;\n\tfor(j=0;j<14;j++)\n\t\tif(temp[j]%2==0)\n\t\t\tscore+=temp[j];\n\tif(score>max)max=score;\n}\nprintf(\"%lld\\n\",max);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long int temp[14],a[14],i,j,rem,no,max,sum;\n\tlong long int const_2 = 14;\n\tlong long int const_1 = 2;\n\tmax=-1;\n\t\n\tfor(i=0;i<14;i++)\n\tscanf(\"%lld\",&temp[i]);\n\t\n \tfor(i=0;i<14;i++){\n\t \n\t for(j=0;j<14;j++)\n\t a[j]=temp[j];\n\t \n\t if(temp[i]==0)\n\t continue;\n\t \n\t no=a[i];\n\t \n\t a[i]=no/14;\n\t \n\t for(j=0;j<14;j++){\n\t if(j==i)\n\t continue;\n\t \n\t a[j] += (no/const_2);\n\t }\n\t \n\t rem = no%const_2;\n\t \n\t for(j=i+1;j<14 && rem>0;j++){\n\t ++a[j];\n\t --rem;\n\t }\n\t j=0;\n\t while(rem!=0){\n\t ++a[j];\n\t ++j;\n\t --rem;\n\t }\n\t \n\t sum=0;\n\t \n\t for(j=0;j<14;j++){\n\t \n\t if(a[j]%const_1 == 0)\n\t sum += a[j];\n\t }\n\t \n\t if(sum>max)\n\t max=sum;\n\t \n\t}\n\t\n\tif(max==-1)\n\tprintf(\"0\\n\");\n\t\n\telse\n\tprintf(\"%lld\\n\",max);\n\t\n \treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\n\nint main()\n{\n\tll a[14], i, ans = 0, j, k, l, b[14], max;\n\tfor(i=0;i<14;++i)\n\t{\n\t\tscanf(\"%lld\", &a[i]);\n\t}\n\tfor(i=0;i<14;++i)\n\t{\n\t\tif(a[i] > 0)\n\t\t{\n\t\t\tmax = 0;\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\tb[j] = a[j];\n\t\t\t}\n\t\t\tk = a[i] / 14;\n\t\t\tl = a[i] % 14;\n\t\t\ta[i] = 0;\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\ta[j] += k;\n\t\t\t}\n\t\t\t//j = (i + 1) % 14;\n\t\t\tfor(j=i+1;j<=i + l;++j)\n\t\t\t{\n\t\t\t\t++a[j % 14];\n\t\t\t}\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\t//printf(\"%d \", a[j]);\n\t\t\t\tif(a[j] % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tmax += a[j];\n\t\t\t\t}\n\t\t\t\ta[j] = b[j];\n\t\t\t}\n\t\t\tans = max > ans ? max : ans;\n\t\t\t//printf(\"\\n\");\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint N[14], A[14];\n\nlong long count(short index) {\n\tshort i;\n\tfor(i = 0; i < 14; ++i) {\n\t\tA[i] = N[i];\n\t}\n\tA[index] = 0;\n\tshort p = N[index] % 14;\n\tfor(i = 1; i <= 14; ++i) {\n\t\tA[(index+i)%14] += N[index] / 14;\n\t\tif(p != 0) {\n\t\t\t++A[(index+i)%14];\n\t\t\t--p;\n\t\t}\n\t}\n\tlong long sum = 0;\n\tfor(i = 0; i < 14; ++i) {\n\t\tif(A[i] % 2 == 0) {\n\t\t\tsum += A[i];\n\t\t}\n\t}\n\treturn sum;\n}\n\nint main() {\n\tshort i;\n\tfor(i = 0; i < 14; ++i) {\n\t\tscanf(\"%d\", &N[i]);\n\t}\n\tlong long max = -1, current;\n\tfor(i = 0; i < 14; ++i) {\n\t\tif(N[i] > 0) {\n\t\t\tcurrent = count(i);\n\t\t\tif(current > max) {\n\t\t\t\tmax = current;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define N 14\nlong long int hole[N]={0,};\nlong long int he[N]={0,};\nint main(void)\n{\n\tint k1,k2,flag;\n\tlong long int score=0;\n\tfor(k1=0;k1<N;k1++) scanf(\"%I64d\",&hole[k1]);\n for(k1=0;k1<N;k1++)\n {\n \tif(hole[k1]>0)\n \t{\n \t\tfor(k2=0;k2<N;k2++) he[k2]=hole[k2];\n\t\t\tlong long int m=hole[k1];\n \t\tlong long int m1=m/N;\n\t\t\tlong long int m2=m%N;\n\t\t\t\n \t\thole[k1]=0;\n \t\tfor(k2=0;k2<N;k2++) hole[k2]+=m1;\n \t\tflag=0;\n \t\tk2=0;\n \t\twhile(m2)\n \t\t{\n \t\t\tif(k2==k1)flag=1;\n \t\t\tif((flag)&&(m2--)) hole[(k2+1)%N]+=1;\n \t\t\tk2++;\n \t\t}\n \t\tlong long int s=0;\n \t\tfor(k2=0;k2<N;k2++)\n \t\t{\n \t\t\tif((hole[k2]%2)==0) s+=hole[k2];\n \t\t}\n \t\tif(s>score)score=s;\n \t\tfor(k2=0;k2<N;k2++) hole[k2]=he[k2];\n \t}\n }\n printf(\"%I64d\",score);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long init[14], copy[14];\n\tlong long MAX = 0;\n\t\n\tint i;\n\tfor (i = 0; i < 14; i++) {\n\t\tscanf(\"%lli\", &init[i]);\n\t}\n\tfor (i = 0; i < 14; i++) {\n\t\tif (init[i] != 0) {\n\t\t\tint j;\n\t\t\tlong long score = 0;\n\t\t\t\n\t\t\tfor (j = 0; j < 14; j++) {\n\t\t\t\tcopy[j] = init[j];\n\t\t\t}\n copy[i] = 0;\n\t\t\tfor (j = 0; j < 14; j++) {\n\t\t\t\tcopy[j] += init[i]/14;\n\t\t\t}\n int extr = init[i]%14;\n for (j = 1; j <= extr; j++) {\n copy[(i+j)%14]++;\n }\n\t\t\tfor(j = 0; j < 14; j++){\n\t\t\t\tif (copy[j]%2 == 0) score += copy[j];\n\t\t\t}\n\t\t\tif (MAX < score) MAX = score;\n\t\t}\n\t}\n\tprintf(\"%lli\", MAX);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define _MAX_ 1000000005\n#define _HOLES_ 14\n\ntypedef long long unsigned int llu;\n\nint main() {\n llu holes[_HOLES_], trial[_HOLES_];\n\n llu i;\n for (i = 0; i < _HOLES_; i++) {\n scanf(\"%I64u\", &holes[i]);\n trial[i] = holes[i];\n }\n\n llu j, k, max = 0;\n for (i = 0; i < _HOLES_; i++) {\n if (holes[i] == 0) {\n continue;\n }\n\n llu val = holes[i];\n\n llu div = val/_HOLES_;\n llu mod = val%_HOLES_;\n\n trial[i] = 0;\n\n if (div > 0) {\n for (j = 0; j < _HOLES_; j++) {\n trial[j] += div;\n }\n }\n\n k = i+1;\n while(mod--) {\n if (k == _HOLES_) {\n k = 0;\n }\n trial[k++]++;\n }\n\n llu sum = 0;\n for (j = 0; j < _HOLES_; j++) {\n if (trial[j]%2 == 0) {\n sum += trial[j];\n }\n }\n\n if (sum > max) {\n max = sum;\n }\n\n for (j = 0; j < _HOLES_; j++) {\n trial[j] = holes[j];\n }\n }\n\n printf(\"%I64u\\n\", max);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\t\n\tlong long int count = 0;\n\tlong long int max = 0;\n\tlong long int k;\n\t\n\tlong long int a[14];\n\tfor(int i =0;i<14;i++)\n\tscanf(\"%I64d\",&a[i]);\n\tlong long int b[14];\n\tfor(int i =0;i<14;i++)\n\tb[i]=a[i];\n\tlong long int p =0;\n\t\n\tfor(int i =0;i<14;i++)\n\t{\n\t\tp=0;\n\t\tcount = 0;\n\t\tfor(int i =0;i<14;i++)\n \tb[i]=a[i];\n \t\n k = b[i];\n b[i] = 0;\n p = k/14;\n k=k%14;\n for(int i =0;i<14;i++)\n b[i]+=p;\n for(int j = 1;j<=k;j++)\n {\n \tb[(j+i)%14]++;\n\t\t}\n\t\t\n\t\tfor(int i =0;i<14;i++)\n\t\t{\n\t\t\tif(b[i]%2==0)\n\t\t\tcount +=b[i];\n\t\t}\n\t\t\n\t\t if (count > max)\n\t\t max = count; \t\n\t}\n\t\n\tprintf(\"%I64d\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\nint i,j,a[101],shang,yu,t;\nlong long s[101]={0},max,b[101];\n\nint main()\n{\n\tfor (i=1;i<=14;i++) scanf(\"%d\",&a[i]);\n\tfor (i=1;i<=14;i++)\n\tif (a[i])\n\t{\n\t\tfor (j=1;j<=14;j++) b[j]=a[j];\n\t\tb[i]=0;\n\t\tt=a[i];\n\t\tif (t>14-i) \n\t\t{\n\t\t\tfor (j=i+1;j<=14;j++) b[j]++;\n\t\t\tt-=14-i;\n\t\t\tshang=t/14;\n\t\t\tfor (j=1;j<=14;j++) b[j]+=shang;\n\t\t\tyu=t%14;\n\t\t\tfor (j=1;j<=yu;j++) b[j]++;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tfor (j=i+1;j<=i+t;j++) b[j]++;\n\t\t}\n\t\tfor (j=1;j<=14;j++) \n\t\tif (b[j]%2==0) s[i]+=b[j];\n\t}\n\t\n\tfor (i=1,max=0;i<=14;i++) max=max>s[i] ? max : s[i];\n\tprintf(\"%lld\\n\",max);\n\treturn 0;\n} \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,i,j,k,l;\n long long int a[14],b[14],s=0,t=0;\n for(i=0; i<14; i++)\n {\n scanf(\"%I64d\",&a[i]);\n }\n for(i=0; i<14; i++)\n {\n for(j=0; j<14; j++)\n {\n b[j]=a[j];\n }\n\n if(b[i]!=0)\n {\n if(b[i]>=14)\n {\n m=b[i]/14;\n n=b[i]%14;\n b[i]=0;\n for(j=0; j<14; j++)\n {\n b[j]=b[j]+m;\n }\n }\n else\n {\n n=b[i];\n b[i]=0;\n }\n\n for(k=i+1; k<=i+n; k++)\n {\n if(k>=14)\n b[k-14]=b[k-14]+1;\n else\n b[k]=b[k]+1;\n }\n for(l=0; l<14; l++)\n {\n if(b[l]%2==0)\n s=s+b[l];\n }\n\n if(s>t)\n {\n t=s;\n s=0;\n }\n else\n s=0;\n\n }\n }\n printf(\"%I64d\",t);\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,i,j,k,l;\n long long int a[14],b[14],s=0,t=0;\n for(i=0; i<14; i++)\n {\n scanf(\"%I64d\",&a[i]);\n }\n for(i=0; i<14; i++)\n {\n for(j=0; j<14; j++)\n {\n b[j]=a[j];\n }\n\n if(b[i]!=0)\n {\n if(b[i]>=14)\n {\n m=b[i]/14;\n n=b[i]%14;\n b[i]=0;\n for(j=0; j<14; j++)\n {\n b[j]=b[j]+m;\n }\n }\n else\n {\n n=b[i];\n b[i]=0;\n }\n\n for(k=i+1; k<=i+n; k++)\n {\n if(k>=14)\n b[k-14]=b[k-14]+1;\n else\n b[k]=b[k]+1;\n }\n for(l=0; l<14; l++)\n {\n if(b[l]%2==0)\n s=s+b[l];\n }\n\n if(s>t)\n {\n t=s;\n s=0;\n }\n else\n s=0;\n\n }\n }\n printf(\"%I64d\",t);\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tstatic long long aa[14], bb[14];\n\tlong long max;\n\tint i, j;\n\n\tfor (i = 0; i < 14; i++)\n\t\tscanf(\"%lld\", &aa[i]);\n\tmax = 0;\n\tfor (i = 0; i < 14; i++)\n\t\tif (aa[i] > 0) {\n\t\t\tlong long sum;\n\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tbb[j] = (j == 0 ? 0 : aa[(i + j) % 14]) + (aa[i] - (j - 1 + 14) % 14 + 13) / 14;\n\t\t\tsum = 0;\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tif (bb[j] % 2 == 0)\n\t\t\t\t\tsum += bb[j];\n\t\t\tif (max < sum)\n\t\t\t\tmax = sum;\n\t\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n long long i, a[14], w, n, j, x, y;\n\n for(i=0; i<14; i++)scanf(\"%I64d\", &a[i]);\n\n w=0;\n\n for(i=0; i<14; i++)\n {\n n=0;\n for(j=0; j<14; j++)\n {\n x=((j+14)-i)%14;\n if(x==0)x=14;\n y=a[j]+a[i]/14;\n if(j==i)y-=a[j];\n if(x<=a[i]%14)y++;\n if(y%2==0)n+=y;\n }\n if(n>w)w=n;\n }\n\n printf(\"%I64d\\n\", w);\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n long long i, a[14], w, n, j, x, y;\n\n for(i=0; i<14; i++)scanf(\"%I64d\", &a[i]);\n\n w=0;\n\n for(i=0; i<14; i++)\n {\n n=0;\n if(a[i]>0)\n {\n for(j=0; j<14; j++)\n {\n x=((j+14)-i)%14;\n if(x==0)x=14;\n y=a[j]+a[i]/14;\n if(x<=a[i]%14)y++;\n if(y%2==0)n+=y;\n }\n }\n if(n>w)w=n;\n }\n\n printf(\"%I64d\\n\", w);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n long long a[14], b[14], ans = 0;\n for(int i = 0; i < 14; i++) scanf(\"%lld\", a+i);\n for(int i = 0; i < 14; i++){\n long long t = a[i];\n memcpy(b, a, sizeof(a));\n b[i] = 0;\n if(t / 14ll) for(int j = 0; j < 14; j++) b[j] += t / 14;\n for(int j = 1; t--; j++) b[(i+j)%14]++;\n t = 0;\n for(int j = 0; j < 14; j++) t += b[j] % 2 ? 0 : b[j];\n ans = ans > t ? ans : t;\n }\n printf(\"%lld\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\n \nfor(j=1;j<=14;j++)\nif (s[1]>s[j])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n //for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\n \nfor(j=1;j<=14;j++)\nif (s[1]>s[j])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n //for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\n \nfor(j=1;j<=14;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n //for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\nfor(i=1;i<=14;i++) {\nfor(j=1;j<=14;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);}\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n //for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\nfor(i=1;i<=14;i++) {\nfor(j=1;j<=14;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,w=1,j;\nlong long int a[15]={0},t,b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n for (r=1;r<=14;r++) printf(\"\\n%lld\",s[r]);\nfor(j=1;j<=14;j++)\n{if (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}}\nfor (r=1;r<=14;r++) printf(\"\\n%d %lld\",r,s[r]);\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n int A[20],B[20],i,j,count,m,n,k;\n long long int max=-1,sum;\n for(i=1;i<=14;i++)\n {\n scanf(\"%d\",&A[i]);\n B[i] = A[i];\n }\n \n for(i=1;i<=14;i++)\n {\n count=0; sum=0;\n if(A[i]>0)\n {\n m = A[i]/14;\n n = A[i]%14;\n B[i] =0;\n for(j=1;j<=14;j++)\n {\n B[j]= B[j]+ m ;\n }\n k=i;\n while(count<n)\n {\n B[(k+1)%14]++;\n k++;\n count++;\n }\n for(j=1;j<=14;j++)\n {\n if(B[j]%2==0)\n {\n sum = sum + B[j];\n }\n }\n \n if(sum>=max)\n max = sum;\n for(j=1;j<=14;j++)\n {\n B[j]=A[j];\n }\n \n }\n }\n printf(\"%lld\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n int A[20],B[20],i,j,count,m,n,k;\n long long int max=-1,sum;\n for(i=1;i<=14;i++)\n {\n scanf(\"%d\",&A[i]);\n B[i] = A[i];\n }\n \n for(i=1;i<=14;i++)\n {\n count=0; sum=0;\n if(A[i]>0)\n {\n m = A[i]/14;\n n = A[i]%14;\n B[i] =0;\n for(j=1;j<=14;j++)\n {\n B[j]= B[j]+ m ;\n }\n k=i;\n while(count<=n)\n {\n B[(k+1)%14]++;\n k++;\n count++;\n }\n for(j=1;j<=14;j++)\n {\n if(B[j]%2==0)\n {\n sum = sum + B[j];\n }\n }\n if(sum>=max)\n max = sum;\n for(j=1;j<=14;j++)\n {\n B[j]=A[j];\n }\n \n }\n }\n printf(\"%lld\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n int A[20],B[20],i,j,count,m,n,k;\n long long int max=-1,sum;\n for(i=1;i<=14;i++)\n {\n scanf(\"%d\",&A[i]);\n B[i] = A[i];\n }\n \n for(i=1;i<=14;i++)\n {\n count=1; sum=0;\n if(A[i]>0)\n {\n m = A[i]/14;\n n = A[i]%14;\n B[i] =0;\n for(j=1;j<=14;j++)\n {\n B[j]= B[j]+ m ;\n }\n k=i;\n while(count<=n)\n {\n if(k+1 ==14)\n B[14]++;\n else\n B[(k+1)%14]++;\n k++;\n count++;\n }\n for(j=1;j<=14;j++)\n {\n if(B[j]%2==0)\n {\n sum = sum + B[j];\n }\n }\n printf(\"%lld\\n\",sum);\n if(sum>=max)\n max = sum;\n for(j=1;j<=14;j++)\n {\n B[j]=A[j];\n }\n \n }\n }\n printf(\"%lld\",max);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nstatic long long v[14];\n\nint main(void)\n{\n int imax, i;\n long long nmax, total = 0, trip;\n\n nmax = imax = 0;\n\n for (i = 0; i < 14; i++) {\n scanf(\"%lld\", &v[i]);\n if (v[i] > nmax) {\n nmax = v[i];\n imax = i;\n }\n }\n\n v[imax] = 0;\n trip = nmax / 14;\n for (i = 0; i < 14; i++) {\n v[i] += trip;\n }\n\n trip = nmax % 14;\n while (trip) {\n ++imax;\n imax %= 14;\n v[imax]++;\n trip--;\n }\n\n for (i = 0; i < 14; i++) {\n if (v[i] % 2 == 0) {\n total += v[i];\n }\n }\n\n printf(\"%lld\\n\", total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nstatic long long v[14];\n\nint main(void)\n{\n int imax, i;\n long long nmax, total = 0, trip;\n\n nmax = imax = 0;\n\n for (i = 0; i < 14; i++) {\n scanf(\"%lld\", &v[i]);\n if (v[i] > nmax) {\n nmax = v[i];\n imax = i;\n }\n }\n\n v[imax] = 0;\n trip = nmax / 14;\n for (i = 0; i < 14; i++) {\n v[i] += trip;\n }\n\n trip = nmax % 14;\n while (trip) {\n v[++imax]++;\n trip--;\n }\n\n for (i = 0; i < 14; i++) {\n if (v[i] % 2 == 0) {\n total += v[i];\n }\n }\n\n printf(\"%lld\\n\", total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nstatic long long v[14];\n\nint main(void)\n{\n int imax, i;\n long long nmax, total = 0;\n\n nmax = imax = 0;\n\n for (i = 0; i < 14; i++) {\n scanf(\"%lld\", &v[i]);\n if (v[i] > nmax) {\n nmax = v[i];\n imax = i;\n }\n }\n\n v[imax] = 0;\n while (nmax) {\n imax++;\n imax %= 14;\n v[imax]++;\n nmax--;\n }\n\n for (i = 0; i < 14; i++) {\n if (v[i] % 2 == 0) {\n total += v[i];\n }\n }\n\n printf(\"%lld\\n\", total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n for(long long int j = 0; j<14;j++) d[j] = a[j];\n long long int b = a[i];\n d[i] = 0;\n if(i!=13) c = i+1;\n else c = 0;\n if((b>0)&&(b<=14))\n {\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }\n else if(b>0)\n {\n long long int m = b/14; long long int n = b%14 ;\n for(long long int j = 0; j < 14; j++) \n {\n d[c] = d[c]+m;\n if(c!=13) c++;\n else c = 0;\n }\n for(long long int j = 1;j<=n;j++) d[j]++;\n }\n for(long long int j = 0; j<14; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n if(c1>c2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n for(long long int j = 0; j<14;j++) d[j] = a[j];\n long long int b = a[i];\n d[i] = 0;\n if((b>0)&&(b<=14))\n {\n if(i!=13) c = i+1;\n else c = 0;\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }\n else\n {\n long long int m = b/14; long long int n = b%14 ;\n for(long long int j = 0; j < 14; j++) d[j] = d[j]+m;\n for(long long int j = i+1;j<=i+n;j++) d[j]++;\n }\n for(long long int j = 0; j<14; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n if(c1>c2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n for(long long int i = 0; i<14;i++) d[i] = a[i];\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n long long int b = a[i];\n if(b>0)\n {\n d[i] = 0;\n if(i!=13) c = i+1;\n else c = 0;\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }\n \n for(long long int j = 0; j<13; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n \n if(c1>c2) c2 = c1 ;\n c1 = 0;\n for(long long int j = 0; j<14;j++) d[i] = a[i];\n }\n \n printf(\"%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int a[14] ;\n long long int d[14];\n for(long long int i = 0; i<14;i++) scanf(\"%lld\",&a[i]);\n long long int c ; long long int c1 = 0; long long int c2 = 0;\n for(long long int i = 0; i<14;i++)\n {\n for(long long int j = 0; j<14;j++) d[j] = a[j];\n long long int b = a[i];\n d[i] = 0;\n if(i!=13) c = i+1;\n else c = 0;\n if((b>0)&&(b<=14))\n {\n for(long long int j = 1;j<=b;j++)\n {\n d[c] = d[c]+1;\n if(c!=13) c++;\n else c = 0;\n }\n }\n else if(b>0)\n {\n long long int m = b/14; long long int n = b%14 ;\n for(long long int j = 0; j < 14; j++) d[j] = d[j]+m;\n for(long long int j = c;j<c+n;j++) d[j]++;\n }\n for(long long int j = 0; j<14; j++)\n {\n if(d[j]%2==0) c1 = c1+d[j];\n }\n if(c1>c2) c2 = c1 ;\n c1 = 0;\n }\n printf(\"\\n%lld\",c2);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t//code\n\tint a[14],c=0;\n\tfor(int i=0;i<14;i++)\n\t scanf(\"%d\",a+i);\n\tint b[14];\n\tfor(int i=0;i<14;i++)\n\t{\n\t if(a[i]==0) continue;\n\t for(int j=0;j<14;j++)\n\t b[j]=a[j];\n\t int m1=a[i]/14,m2=a[i]%14,s=0;\n\t b[i]=0;\n\t for(int j=0;j<14;j++)\n\t b[j]=b[j]+m1;\n\t int j=i;\n\t while(m2--)//do something\n\t {\n\t if(j==13) j=0;\n\t else j++;\n\t b[j]++;\n\t }\n for(j=0;j<14;j++)\n if(b[j]%2==0) s=s+b[j];\n if(s>c) c=s;\n\t}\n\tprintf(\"%d\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t//code\n\tlong long int a[14],c=0;\n\tfor(int i=0;i<14;i++)\n\t scanf(\"ll%d\",a+i);\n\tlong long int b[14];\n\tfor(int i=0;i<14;i++)\n\t{\n\t if(a[i]==0) continue;\n\t for(int j=0;j<14;j++)\n\t b[j]=a[j];\n\t long long int m1=a[i]/14,m2=a[i]%14,s=0;\n\t b[i]=0;\n\t for(int j=0;j<14;j++)\n\t b[j]=b[j]+m1;\n\t int j=i;\n\t while(m2--)//do something\n\t {\n\t if(j==13) j=0;\n\t else j++;\n\t b[j]++;\n\t }\n for(j=0;j<14;j++)\n if(b[j]%2==0) s=s+b[j];\n if(s>c) c=s;\n\t}\n\tprintf(\"%lld\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t//code\n\tint a[14],c=0;\n\tfor(int i=0;i<14;i++)\n\t scanf(\"%d\",a+i);\n\tint b[14];\n\tfor(int i=0;i<14;i++)\n\t{\n\t if(a[i]==0) continue;\n\t for(int j=0;j<14;j++)\n\t b[j]=a[j];\n\t int m1=a[i]/14,m2=a[i]%14,s=0;\n\t b[i]=0;\n\t for(int j=0;j<14;j++)\n\t b[i]=b[i]+m1;\n\t int j=i;\n\t while(m2--)//do something\n\t {\n\t if(j==13) j=0;\n\t else j++;\n\t b[j]++;\n\t }\n for(j=0;j<14;j++)\n if(b[j]%2==0) s=s+b[j];\n if(s>c) c=s;\n\t}\n\tprintf(\"%d\",c);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define n 14\nint main(){\n int count=0,max=0,x,y,z,a[14],b[14],c[14];\n for(int i=0;i<14;i++){\n scanf(\"%d\",&a[i]);\n }\n for(int i=0;i<14;i++){b[i]=1;}\n for(int i=0;i<14;i++){\n c[i]=a[i];}\n \n for(int i=0;i<n;i++){\n \tint t = i;\n \tif(c[i]==0);\n \telse if(c[i]<14){ x =c[i]; c[i]=0;\n\t\t\tfor(int i=0;i<x;i++){\n\t\t\t\tc[(t+i+1)%14]+=1;\n\t\t\t}}\n \telse {\n \t\t x =c[i]; c[i]=0;\n \t\ty = x/n;\n \t\tfor(int i=0;i<n;i++){\n \t\t\tc[i]+=x;\n\t\t\t}\n\t\t\ty = x%n;\n\t\t\tfor(int i=0;i<y;i++){\n\t\t\t\tc[(t+1)%14]+=1;\n\t\t\t}\n\t\t}\n\t\n\t\n\n\tfor(int i=0;i<n;i++){\n\t\tif(c[i]%2==0)count+=c[i];\n\t}\n\tif(count>max)max=count;\n\tcount = 0;\n\tfor(int i=0;i<14;i++)c[i]=a[i];\n\t\n\t}\n\tprintf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define n 14\nint main(){\n int count=0,max=0,x,y,z,a[14],c[14];\n for(int i=0;i<14;i++){\n scanf(\"%d\",&a[i]);\n }\n \n for(int i=0;i<14;i++){\n c[i]=a[i];}\n \n for(int i=0;i<n;i++){\n \tint t = i;\n \tif(c[i]==0);\n \telse if(c[i]<14){ x =c[i]; c[i]=0;\n\t\t\tfor(int i=0;i<x;i++){\n\t\t\t\tc[(t+i+1)%14]+=1;\n\t\t\t}}\n \telse {\n \t\t x =c[i]; c[i]=0;\n \t\ty = x/n;\n \t\tfor(int i=0;i<n;i++){\n \t\t\tc[i]+=y;\n\t\t\t}\n\t\t\ty = x%n;\n\t\t\tfor(int i=0;i<y;i++){\n\t\t\t\tc[(t+i+1)%14]+=1;\n\t\t\t}\n\t\t}\n\t\n\t\n\n\tfor(int i=0;i<n;i++){\n\t\tif(c[i]%2==0)count+=c[i];\n\t}\n\tif(count>max)max=count;\n\tcount = 0;\n\tfor(int i=0;i<14;i++)c[i]=a[i];\n\t\n\t}\n\tprintf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n// typedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,x,z,q,r,n,t,w=1,j;\nlli a[15]={0},b[15]={0},s[15]={0};\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "main()\n{int i,s1,s2,x,z,q,r,n,t,w=1,a[15]={0},b[15]={0},s[15]={0},j;\nfor(i=1;i<=14;i++)scanf(\"%d\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%d\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,x,z,q,r,n,t,w=1,j;\nlli a[15]={0},b[15]={0},s[15]={0};\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlong long int a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "main()\n{int i,s1,s2,x,z,q,r,t,w=1,a[15]={0},b[15]={0},s[15]={0},j;\nfor(i=1;i<=14;i++)scanf(\"%d\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{j=i;\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=i+1;if (s2>14) s2=s2-14;\nb[s2]++;i++;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%d\",s[14]);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int lli;\nmain()\n{int i,s1,s2,q,r,n,t,w=1,j;\nlli a[15]={0},b[15]={0},s[15]={0},x,z;\nfor(i=1;i<=14;i++)scanf(\"%lld\",&a[i]);\nfor(i=1;i<=14;i++)\n{for(q=1;q<=14;q++) \n{b[q]=a[q];}\nif (a[i]>0)\n{\n/*while(b[i]!=0)\n{t=j+1;\nif (t>14) t=t-14;\nb[t]+=1;b[i]--;j++;}*/\nfor(w=1;w<=1;w++)\n{z=a[i]/14;\nx=a[i]%14;\nb[i]=0;n=i;\nfor(s1=1;s1<=14;s1++){b[s1]+=z;}\nfor(s1=1;s1<=x;s1++){ \ns2=n+1;if (s2>14) s2=s2-14;\nb[s2]++;n++;if (n>14) n=n-14;\n}\n}\nfor (r=1;r<=14;r++)\n{if (b[r]%2==0) s[i]+=b[r];}\n}\n}\n// for (r=1;r<=14;r++) printf(\"\\n%lld\",s[i]);\nfor(j=1;j<=13;j++)\nif (s[j]>s[j+1])\n{t=s[j];s[j]=s[j+1];s[j+1]=t;}\nprintf(\"\\n%lld\",s[14]);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main(){\n\tlong long int a[14];\n\tlong long int b[14];\n\tfor (int i = 0; i < 14; ++i)\n\t{\n\t\tscanf(\"%I64d\", &a[i]);\n\t\tb[i]= a[i];\n\t}\n\tlong long int ret= 0;\n\tfor (int i = 0; i < 14; ++i)\n\t{\n\t\tlong long int ans= 0;\n\t\tlong long int x= a[i] % (long long)14;\n\t\tb[i]= a[i] / (long long)14;\n\t\tfor (int j = 1; j <= x; ++j)\n\t\t{\n\t\t\tb[(j+i)%14]= b[(j+i)%14]+ 1 + a[i]/ (long long)14;\n\t\t}\n\t\tif(x== 0){\n\t\t\tfor (int j = 1; j < 14; ++j)\n\t\t\t{\n\t\t\t\tb[(j+i)%14]= b[(j+i)%14]+ a[i]/ (long long)14;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tfor (int j = x; j < 14; ++j)\n\t\t\t{\n\t\t\t\tb[(j+i)%14]= b[(j+i)%14]+ a[i]/ (long long)14;\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < 14; ++j)\n\t\t{\n\t\t\t//printf(\"%d \", b[j]);\n\t\t\tif(b[j]%2==0){\n\t\t\t\tans= ans+ b[j];\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j < 14; ++j)\n\t\t{\n\t\t\tb[j]= a[j];\n\t\t}\n\t\t//printf(\"%d \", ans);\n\t\tif(ans> ret)ret= ans;\n\n\t}\n\t\t\n\tprintf(\"%I64d\", ret);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tcnt[i]=0;\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[i + j - 13] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcnt[i]=1;\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult+=b; \n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[i + j - 13] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult+=b; \n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 14;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[i + j - 13] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j;\n\tint a[14], cnt[14];\n\tlong long result = 0;\n\tfor (i = 0; i<14; i++) {\n\t\tcnt[i] = 1;\n\t\tscanf(\"%d\", &a[i]);\n\t\tif (a[i] == 0) {\n\t\t\tcnt[i] = 0;\n\t\t}\n\t}\n\n\tlong long max = 0;\n\ti = 0;\n\twhile (i<14) {\n\t\tresult = 0;\n\t\tif (a[i] != 0) {\n\t\t\tcnt[i]=0;\n\t\t\tint b = a[i] / 14;\n\t\t\tint c = a[i] % 14;\n\t\t\tif (b % 2 == 0) {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[temp] + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<=14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\t\tresult = result + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfor (j = 1; j<=c; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 0) {\n\t\t\t\t\t\tresult = result + b + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (j = c+1; j<=14; j++) {\n\t\t\t\t\tint temp = i + j;\n\t\t\t\t\tif (temp > 13) {\n\t\t\t\t\t\ttemp -= 13;\n\t\t\t\t\t}\n\t\t\t\t\tif (cnt[temp] == 1) {\n\t\t\t\t\t\tresult = result + a[i + j - 13] + b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcnt[i]=1;\n\t\t}\n\t\tif (result>max) {\n\t\t\tmax = result;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%I64d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int arr[14];\n int i,j;\n for(i=0; i<14; ++i){\n scanf(\"%d\", &arr[i]);\n }\n int brr[14];\n int k=0;\n int r,q;\n int rem,div;\n for(i=0; i<14; ++i){\n if(arr[i]!=0){\n for(j=0; j<14; ++j){\n brr[j]=arr[j];\n }\n q=brr[i];\n brr[i]=0;\n j=i+1;\n while(q>0 && j<14){\n ++brr[j];\n --q;\n ++j;\n }\n div=q/14;\n rem=q%14;\n if(div!=0){\n for(j=0; j<14; ++j){\n ++brr[j];\n }\n }\n for(j=0; j<rem; ++j){\n ++brr[j];\n }\n r=0;\n for(j=0; j<14; ++j){\n if(brr[j]%2==0){\n r+=brr[j];\n }\n }\n if(r>k){\n k=r;\n }\n }\n }\n printf(\"%d\", k);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int arr[14];\n int i,j;\n for(i=0; i<14; ++i){\n scanf(\"%d\", &arr[i]);\n }\n int brr[14];\n int k=0;\n int r,q;\n int rem,div;\n for(i=0; i<14; ++i){\n if(arr[i]!=0){\n for(j=0; j<14; ++j){\n brr[j]=arr[j];\n }\n q=brr[i];\n brr[i]=0;\n j=i+1;\n while(q>0 && j<14){\n ++brr[j];\n --q;\n ++j;\n }\n div=q/14;\n rem=q%14;\n if(div!=0){\n for(j=0; j<14; ++j){\n brr[j]+=div;\n }\n }\n for(j=0; j<rem; ++j){\n ++brr[j];\n }\n r=0;\n for(j=0; j<14; ++j){\n if(brr[j]%2==0){\n r+=brr[j];\n }\n }\n if(r>k){\n k=r;\n }\n }\n }\n printf(\"%d\", k);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a[14];\n int b[14];\n for(int i = 0; i < 14; ++i) {\n scanf(\"%d\", &a[i]);\n }\n long long ans = 0;\n for(int i = 0; i < 14; ++i) {\n memcpy(b, a, sizeof(a));\n if(a[i]) {\n for(int j = 0; j < 14; ++j) {\n b[(i + j + 1) % 14] += a[i] / 14 + (a[i] % 14 >= j);\n }\n long long cur = 0;\n for(int j = 0; j < 14; ++j) {\n if(!(b[j] & 1)) {\n cur += b[j];\n }\n }\n if(ans < cur) {\n ans = cur;\n }\n }\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long par,maxi,a[15],i,j,k,nr,test[15];\n\nint main()\n{\n for(i=1;i<=14;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=1;i<=14;i++)\n {\n par=0;\n for(j=1;j<=14;j++)\n test[j]=a[j];\n nr=test[i];\n test[i]=0;\n k=i+1;\n if(k==15)\n k=1;\n while(nr%13!=0)\n {\n nr--;\n test[k]++;\n k++;\n if(k==15)\n k=1;\n }\n for(k=1;k<=14;k++)\n if(k!=i)\n {\n test[k]+=nr/13;\n }\n for(j=1;j<=14;j++)\n if(test[j]%2==0 && test[j]>0)\n par+=test[j];\n\n if(par>maxi)\n maxi=par;\n }\n\n printf(\"%d\",maxi);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long par,maxi,a[15],i,j,k,nr,test[15];\n\nint main()\n{\n for(i=1;i<=14;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=1;i<=14;i++)\n {\n par=0;\n for(j=1;j<=14;j++)\n test[j]=a[j];\n nr=test[i];\n test[i]=0;\n k=i+1;\n if(k==15)\n k=1;\n while(nr%14!=0)\n {\n nr--;\n test[k]++;\n k++;\n if(k==15)\n k=1;\n }\n for(k=1;k<=14;k++)\n test[k]+=nr/14;\n\n for(j=1;j<=14;j++)\n if(test[j]%2==0 && test[j]>0)\n par+=test[j];\n\n if(par>maxi)\n maxi=par;\n }\n\n printf(\"%d\",maxi);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\n\nint main()\n{\n\tll a[14], i, ans = 0, j, k, l, b[14], max;\n\tfor(i=0;i<14;++i)\n\t{\n\t\tscanf(\"%lld\", &a[i]);\n\t}\n\tfor(i=0;i<14;++i)\n\t{\n\t\tif(a[i] > 0)\n\t\t{\n\t\t\tmax = 0;\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\tb[j] = a[j];\n\t\t\t}\n\t\t\tk = a[i] / 14;\n\t\t\tl = a[i] % 14;\n\t\t\ta[i] = 0;\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\ta[i] += k;\n\t\t\t}\n\t\t\t//j = (i + 1) % 14;\n\t\t\tfor(j=i+1;j<=i + l;++j)\n\t\t\t{\n\t\t\t\t++a[j % 14];\n\t\t\t}\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\t//printf(\"%d \", a[j]);\n\t\t\t\tif(a[j] % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tmax += a[j];\n\t\t\t\t}\n\t\t\t\ta[j] = b[j];\n\t\t\t}\n\t\t\tans = max > ans ? max : ans;\n\t\t\t//printf(\"\\n\");\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\n\nint main()\n{\n\tll a[14], i, ans = 0, j, k, l, b[14], max;\n\tfor(i=0;i<14;++i)\n\t{\n\t\tscanf(\"%lld\", &a[i]);\n\t}\n\tfor(i=0;i<14;++i)\n\t{\n\t\tmax = 0;\n\t\tfor(j=0;j<14;++j)\n\t\t{\n\t\t\tb[j] = a[j];\n\t\t}\n\t\tif(a[i])\n\t\t{\n\t\t\tk = a[i] / 14;\n\t\t\tl = a[i] % 14;\n\t\t\ta[i] = 0;\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\ta[i] += k;\n\t\t\t}\n\t\t\t//j = (i + 1) % 14;\n\t\t\tfor(j=i+1;j<=i + l;++j)\n\t\t\t{\n\t\t\t\t++a[j % 14];\n\t\t\t}\n\t\t\tfor(j=0;j<14;++j)\n\t\t\t{\n\t\t\t\t//printf(\"%d \", a[j]);\n\t\t\t\tif(a[j] % 2 == 0)\n\t\t\t\t{\n\t\t\t\t\tmax += a[j];\n\t\t\t\t}\n\t\t\t\ta[j] = b[j];\n\t\t\t}\n\t\t\tans = max > ans ? max : ans;\n\t\t\t//printf(\"\\n\");\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tlong long hole[14];\n\tlong long MAX = 0;\n\tlong long score = 0;\n\t\n\tint i;\n\tfor(i = 0; i <= 13; i++){\n\t\tscanf(\"%lli%\", &hole[i]);\n\t}\n\t\n\tfor(i = 0; i <= 13; i++){\n\t\tif(hole[i] != 0){\n\t\t\tlong long j;\n\t\t\tfor(j = 1; j <= hole[i]; j++){\n\t\t\t\t++hole[(i + j) % 14];\n\t\t\t}\n\t\t\tfor(j = 0; j <= 13; j++){\n\t\t\t\tif(hole[j] % 2 == 0) score += hole[j];\n\t\t\t}\n\t\t\tif(MAX < score) MAX = score;\n\t\t}\n\t}\n\t\n\tprintf(\"%lli%\", MAX);\n\treturn 0;\n}\n\t\n\t\t\t\n\t"}, {"source_code": "#include <stdio.h>\n\n#define _MAX_ 1000000005\n#define _HOLES_ 14\n\ntypedef long long unsigned int llu;\n\nint main() {\n llu holes[_HOLES_], trial[_HOLES_];\n\n llu i;\n for (i = 0; i < _HOLES_; i++) {\n scanf(\"%I64u\", &holes[i]);\n trial[i] = holes[i];\n }\n\n llu j, k, max = 0;\n for (i = 0; i < _HOLES_; i++) {\n if (holes[i] == 0) {\n continue;\n }\n\n llu val = holes[i];\n\n llu div = val/_HOLES_;\n llu mod = val%_HOLES_;\n\n if (div > 0) {\n for (j = 0; j < _HOLES_; j++) {\n trial[j] += div;\n }\n }\n\n k = i+1;\n while(mod--) {\n if (k == _HOLES_) {\n k = 0;\n }\n trial[k++]++;\n }\n\n llu sum = 0;\n for (j = 0; j < _HOLES_; j++) {\n if (trial[j]%2 == 0) {\n sum += trial[j];\n }\n }\n\n if (sum > max) {\n max = sum;\n }\n\n for (j = 0; j < _HOLES_; j++) {\n trial[j] = holes[j];\n }\n }\n\n printf(\"%I64u\\n\", max);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\t\n\tint count = 0;\n\tint max = 0;\n\tint k;\n\t\n\tint a[14];\n\tfor(int i =0;i<14;i++)\n\tscanf(\"%d\",&a[i]);\n\tint b[14];\n\tfor(int i =0;i<14;i++)\n\tb[i]=a[i];\n\tint p =0;\n\t\n\tfor(int i =0;i<14;i++)\n\t{\n\t\tp=0;\n\t\tcount = 0;\n\t\tfor(int i =0;i<14;i++)\n \tb[i]=a[i];\n \t\n k = b[i];\n b[i] = 0;\n p = k/14;\n k=k%14;\n for(int i =0;i<14;i++)\n b[i]+=p;\n for(int j = 1;j<=k;j++)\n {\n \tb[(j+i)%14]++;\n\t\t}\n\t\t\n\t\tfor(int i =0;i<14;i++)\n\t\t{\n\t\t\tif(b[i]%2==0)\n\t\t\tcount +=b[i];\n\t\t}\n\t\t\n\t\t if (count > max)\n\t\t max = count; \t\n\t}\n\t\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\nint i,j,a[101],shang,yu,t;\nlong long s[101]={0},max,b[101];\n\nint main()\n{\n\tfor (i=1;i<=14;i++) scanf(\"%d\",&a[i]);\n\tfor (i=1;i<=14;i++)\n\tif (a[i])\n\t{\n\t\tfor (j=1;j<=14;j++) b[j]=a[j];\n\t\tb[i]=0;\n\t\tt=a[i];\n\t\tif (t>14-i) \n\t\t{\n\t\t\tfor (j=i+1;j<=14;j++) b[j]++;\n\t\t\tt-=14-i;\n\t\t\tshang=t/14;\n\t\t\tfor (j=1;j<=14;j++) b[j]+=shang;\n\t\t\tyu=t%14;\n\t\t\tfor (j=1;j<=yu;j++) b[j]++;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tfor (j=i+1;j<=i+t;j++) b[j]++;\n\t\t}\n\t\tfor (j=1;j<=14;j++) \n\t\tif (b[j]%2==0) s[i]+=b[j];\n\t}\n\t\n\tfor (i=1,max=0;i<=14;i++) max=max>s[i] ? max : s[i];\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n} \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\nint i,j,a[101],shang,yu,b[101],t;\nlong long s[101]={0},max;\n\nint main()\n{\n\tfor (i=1;i<=14;i++) scanf(\"%d\",&a[i]);\n\tfor (i=1;i<=14;i++)\n\tif (a[i])\n\t{\n\t\tfor (j=1;j<=14;j++) b[j]=a[j];\n\t\tb[i]=0;\n\t\tt=a[i];\n\t\tif (t>14-i) \n\t\t{\n\t\t\tfor (j=i+1;j<=14;j++) b[j]++;\n\t\t\tt-=14-i;\n\t\t\tshang=t/14;\n\t\t\tfor (j=1;j<=14;j++) b[j]+=shang;\n\t\t\tyu=t%14;\n\t\t\tfor (j=1;j<=yu;j++) b[j]++;\n\t\t\t\n\t\t}\n\t\telse \n\t\t{\n\t\t\tfor (j=i+1;j<=i+t;j++) b[j]++;\n\t\t}\n\t\tfor (j=1;j<=14;j++) \n\t\tif (b[j]%2==0) s[i]+=b[j];\n\t}\n\tfor (i=1,max=0;i<=14;i++) max=max>s[i] ? max : s[i];\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n} \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int a[14],b[14],s=0,t=0,m,n,i,j,k,l;\nfor(i=0;i<=13;i++)\n{scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<14;i++)\n{for(j=0;j<14;j++)\n{a[i]=b[i];}\n\nif(b[i]!=0)\n{if(b[i]>=14)\n{m=b[i]/14;\nn=b[i]%14;\nb[i]=0;\nfor(j=0;j<14;j++)\n{b[i]=b[i]+m;}}\nelse\n{n=b[i];\nb[i]=0;}\n\nfor(k=i+1;k<i+n;k++)\n{if(k>=14)\nb[i-14]=b[i-14]+1;\nelse\nb[i]=b[i]+1;\n}\nfor(j=0;j<14;j++)\n{if(b[j]%2==0)\ns=s+b[j];\n}\nif(s>t)\n{t=s;\ns=0;}\nelse\ns=0;\n\n}\n}\nprintf(\"%d\",t);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[14],b[14],s=0,t=0,m,n,i,j,k,l;\n for(i=0; i<14; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<14; i++)\n {\n for(j=0; j<14; j++)\n {\n b[j]=a[j];\n }\n\n if(b[i]!=0)\n {\n if(b[i]>=14)\n {\n m=b[i]/14;\n n=b[i]%14;\n b[i]=0;\n for(j=0; j<14; j++)\n {\n b[j]=b[j]+m;\n }\n }\n else\n {\n n=b[i];\n b[i]=0;\n }\n\n for(k=i+1; k<=i+n; k++)\n {\n if(k>=14)\n b[k-14]=b[k-14]+1;\n else\n b[k]=b[k]+1;\n }\n for(l=0; l<14; l++)\n {\n if(b[l]%2==0)\n s=s+b[l];\n }\n\n if(s>t)\n {\n t=s;\n s=0;\n }\n else\n s=0;\n\n }\n }\n printf(\"%d\",t);\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[14],b[14],s=0,t=0,m,n,i,j,k,l;\n for(i=0; i<14; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<14; i++)\n {\n for(j=0; j<14; j++)\n {\n b[j]=a[j];\n }\n\n if(b[i]!=0)\n {\n if(b[i]>=14)\n {\n m=b[i]/14;\n n=b[i]%14;\n b[i]=0;\n for(j=0; j<14; j++)\n {\n b[i]=b[i]+m;\n }\n }\n else\n {\n n=b[i];\n b[i]=0;\n }\n\n for(k=i+1; k<=i+n; k++)\n {\n if(k>=14)\n b[k-14]=b[k-14]+1;\n else\n b[k]=b[k]+1;\n }\n for(l=0; l<14; l++)\n {\n if(b[l]%2==0)\n s=s+b[l];\n }\n\n if(s>t)\n {\n t=s;\n s=0;\n }\n else\n s=0;\n\n }\n }\n printf(\"%d\",t);\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,i,j,k,l;\n long long int a[14],b[14],s=0,t=0;\n for(i=0; i<14; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<14; i++)\n {\n for(j=0; j<14; j++)\n {\n b[j]=a[j];\n }\n\n if(b[i]!=0)\n {\n if(b[i]>=14)\n {\n m=b[i]/14;\n n=b[i]%14;\n b[i]=0;\n for(j=0; j<14; j++)\n {\n b[j]=b[j]+m;\n }\n }\n else\n {\n n=b[i];\n b[i]=0;\n }\n\n for(k=i+1; k<=i+n; k++)\n {\n if(k>=14)\n b[k-14]=b[k-14]+1;\n else\n b[k]=b[k]+1;\n }\n for(l=0; l<14; l++)\n {\n if(b[l]%2==0)\n s=s+b[l];\n }\n\n if(s>t)\n {\n t=s;\n s=0;\n }\n else\n s=0;\n\n }\n }\n printf(\"%d\",t);\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tstatic int aa[14], bb[14];\n\tint i, j, max;\n\n\tfor (i = 0; i < 14; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmax = 0;\n\tfor (i = 0; i < 14; i++)\n\t\tif (aa[i] > 0) {\n\t\t\tint sum;\n\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tbb[j] = (j == 0 ? 0 : aa[(i + j) % 14]) + (aa[i] - (j - 1 + 14) % 14 + 13) / 14;\n\t\t\tsum = 0;\n\t\t\tfor (j = 0; j < 14; j++)\n\t\t\t\tif (bb[j] % 2 == 0)\n\t\t\t\t\tsum += bb[j];\n\t\t\tif (max < sum)\n\t\t\t\tmax = sum;\n\t\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tstatic int aa[14], bb[14];\n\tint i, j, max;\n\n\tfor (i = 0; i < 14; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tmax = 0;\n\tfor (i = 0; i < 14; i++) {\n\t\tint sum;\n\n\t\tfor (j = 0; j < 14; j++)\n\t\t\tbb[j] = (j == 0 ? 0 : aa[(i + j) % 14]) + (aa[i] - (j - 1 + 14) % 14 + 13) / 14;\n\t\tsum = 0;\n\t\tfor (j = 0; j < 14; j++)\n\t\t\tif (bb[j] % 2 == 0)\n\t\t\t\tsum += bb[j];\n\t\tif (max < sum)\n\t\t\tmax = sum;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n long long i, a[14], w, n, j, x, y;\n\n for(i=0; i<14; i++)scanf(\"%I64d\", &a[i]);\n\n w=0;\n\n for(i=0; i<14; i++)\n {\n n=0;\n for(j=0; j<14; j++)\n {\n x=((j+14)-i)%14;\n if(x==0)x=14;\n y=a[j]+a[i]/14;\n if(x<=a[i]%14)y++;\n if(y%2==0)n+=y;\n }\n if(n>w)w=n;\n }\n\n printf(\"%I64d\\n\", w);\n\n return 0;\n}\n"}], "src_uid": "1ac11153e35509e755ea15f1d57d156b"} {"nl": {"description": "Kolya is very absent-minded. Today his math teacher asked him to solve a simple problem with the equation $$$a + 1 = b$$$ with positive integers $$$a$$$ and $$$b$$$, but Kolya forgot the numbers $$$a$$$ and $$$b$$$. He does, however, remember that the first (leftmost) digit of $$$a$$$ was $$$d_a$$$, and the first (leftmost) digit of $$$b$$$ was $$$d_b$$$.Can you reconstruct any equation $$$a + 1 = b$$$ that satisfies this property? It may be possible that Kolya misremembers the digits, and there is no suitable equation, in which case report so.", "input_spec": "The only line contains two space-separated digits $$$d_a$$$ and $$$d_b$$$ ($$$1 \\leq d_a, d_b \\leq 9$$$).", "output_spec": "If there is no equation $$$a + 1 = b$$$ with positive integers $$$a$$$ and $$$b$$$ such that the first digit of $$$a$$$ is $$$d_a$$$, and the first digit of $$$b$$$ is $$$d_b$$$, print a single number $$$-1$$$. Otherwise, print any suitable $$$a$$$ and $$$b$$$ that both are positive and do not exceed $$$10^9$$$. It is guaranteed that if a solution exists, there also exists a solution with both numbers not exceeding $$$10^9$$$.", "sample_inputs": ["1 2", "4 4", "5 7", "6 2"], "sample_outputs": ["199 200", "412 413", "-1", "-1"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int x,y;\n scanf(\"%d%d\",&x,&y);\n if(x==y)\n printf(\"%d %d\",x*10, y*10+1);\n else if(x+1==y)\n printf(\"%d %d\",x, y);\n else if(x==9 && y==1)\n printf(\"9 10\");\n else\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n\n\n\n\nint main() {\n int a,b;\nscanf(\"%d%d\",&a,&b);\nif(b-a==0)\nprintf(\"%d %d\\n\",a*10,b*10+1);\nelse if(b-a==1)\nprintf(\"%d %d\\n\",a*10+9,b*10);\nelse if(a-b==8)\nprintf(\"%d %d\\n\",a*10+9,b*100);\nelse\nprintf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,k;\n scanf(\"%d %d\",&n,&m);\n if(n<=m)\n {\n k = m-n;\n }\n else\n {\n k = n-m;\n }\n if(n==9 && m==1)\n {\n printf(\"%d %d\",n*11,m*100);\n }\n else if(k>1)\n printf(\"-1\");\n else if(k>=1 && n>m)\n printf(\"-1\");\n else\n {\n if(k==1)\n {\n printf(\"%d %d\",(n*100)+99,m*100);\n }\n else if(k==0)\n {\n printf(\"%d %d\",(n*100)+2,(m*100)+3);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b)\n {\n printf(\"%lld12 %lld13\\n\",a,b);\n }\n else if((a+1)==b)\n printf(\"%lld99 %lld00\\n\",a,b);\n else if(a==9&&b==1)\n {\n printf(\"%lld99 %lld000\\n\",a,b);\n }\n\n else\n printf(\"-1\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int da,db;\n scanf(\"%d%d\",&da,&db);\n int a,b;\n if(da==db){\n a=da*10+1;\n b=db*10+2;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==db){\n a=da*10+9;\n b=db*10;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==10 && db==1){\n a=da;\n b=10;\n printf(\"%d %d\\n\",a,b);\n\n }else{\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,k;\n scanf(\"%d %d\",&c,&d);\n if(c==d)\n {\n a=c*10;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(d-c==1)\n {\n printf(\"%d %d\\n\",c,d);\n }\n else if(c==9&&d==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tif(b-a==1){\n\t\tprintf(\"%d %d\",a,b);\n\t}else if(b-a==0) printf(\"%d %d\",a*10,b*10+1);\n\telse if(b-a==-8) printf(\"9 10\");\n\telse printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": " #include <stdio.h>\n #include <stdlib.h>\n #include <string.h>\n \n int main()\n {\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\",(a*10),(b*10)+1);\n }\n else if(a+1==b)\n {\n printf(\"%d %d\",a,b);\n }\n else if(a==9 && b ==1)\n {\n printf(\"%d %d\",9,10);\n }\n else{\n printf(\"%d\",-1);\n }\n return 0;\n }"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d %d\",&a, &b);\n if(a==b)\n {\n a = a*10+1;\n b = b*10+2;\n }\n else if(a+1==b)\n {\n a = a*10 + 9;\n b = b*10;\n }\n else if(a==9 && b==1)\n {\n a = 999;\n b = 1000;\n }\n else\n {\n printf(\"-1\\n\");\n return 0;\n }\n printf(\"%d %d\\n\", a, b);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\\n\",10*a+1,10*a+2);\n }\n else if(b==a+1)\n {\n printf(\"%d %d\\n\",a,b);\n }\n else if(a==9 && b==1)\n {\n printf(\"99 100\\n\");\n }\n else\n printf(\"-1\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int d_a, d_b, a, b;\n \n scanf(\"%d%d\", &d_a, &d_b);\n \n if(d_a > d_b)\n {\n if(d_a - d_b == 8)\n printf(\"9 10\");\n else\n printf(\"-1\");\n }\n else if(d_a == d_b)\n {\n a = 10 * d_a;\n b = 10 * d_b + 1;\n \n printf(\"%d %d\", a, b);\n }\n else if(d_a < d_b)\n {\n if(d_b - d_a == 1)\n {\n a = 10 * d_a + 9;\n b = 10 * d_b;\n \n printf(\"%d %d\", a, b);\n }\n else if(d_b - d_a > 1)\n {\n printf(\"-1\");\n }\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int i= (b-a);\n if((a!=9)||(b!=1))\n {\n if(i==0)\n {\n printf(\"%d2 %d3\\n\",a,b);\n }\n if(i==1)\n {\n printf(\"%d9 %d0\",a,b);\n }\n if((i!=0) && (i!=1))\n {\n printf(\"-1\");\n }\n }\n if((a==9)&& (b==1))\n {\n printf(\"%d %d\", 9,10);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,m,p,q;\n scanf(\"%d%d\",&a,&b);\n\n m=abs(a-b);\n if(m==1&&a<b)\n {\n p=(b*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m==0&&a==b)\n {\n p=(a*100)+(a+b)+a;\n q=p+1;\n printf(\"%d %d\",p,q);\n\n }\n else if(m==8&&a>b)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m>=2&&m<8&&a>b||a<b)\n printf(\"-1\");\n else if(m==1&&a>b)\n\n printf(\"-1\");\n\n\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int da,db,a,b,res,i,j,sub;\n scanf(\"%d%d\",&da,&db);\n sub=db-da;\n if(da==9&&db==1){\n printf(\"999 1000\\n\");\n }\n else if(sub>1||sub<0||da>db){\n printf(\"-1\\n\");\n }\n else if(sub==0){\n a=da*100;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(sub==1){\n b=db*100;\n a=b-1;\n printf(\"%d %d\\n\",a,b);\n }\n}\n"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m<p && (p-m)==1)\n{\n printf(\"%d%d %d%d\",m,9,p,0);\n}\nelse if(m==p)\n{\n printf(\"%d%d %d%d\",m,1,p,2); \n}\nelse\n{ if(m==9 && p==1)\n printf(\"%d %d\",9,10);\n else\n printf(\"%d\",-1);\n}\n return 0; \n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\n\nint main() {\n\tint a, b;\n\tscanf(\"%d%d\", &a, &b);\n\tif(a == b) {\n\t\ta = a * 100;\n\t\tb = b * 100 + 1;\n\t\tprintf(\"%d %d\\n\", a, b);\n\t}\n\telse if(b == a + 1) {\n\t\tb = b * 100;\n\t\ta = b - 1;\n\t\tprintf(\"%d %d\\n\", a, b);\n\t}\n\telse if(a == 9 && b == 1) {\n\t\tprintf(\"%d %d\\n\", 99, 100);\n\t}\n\telse printf(\"%d\\n\", -1);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nmain() {\n \n char s[50];\n gets(s);\n char *numbera = strtok(s, \" \");\n\tchar *numberb = strtok(NULL, \" \");\n \n int a = atoi(numbera);\n int b = atoi(numberb);\n \n if ((b - a) > 1) {\n printf(\"-1\\n\");\n exit(0); \n }\n if (a == 9 && b == 1){\n printf(\"%d %d\\n\", 99, 100);\n\n exit(0); \n }\n if (a > b) {\n printf(\"-1\\n\"); \n exit(0); \n }\n if (a == b){\n printf(\"%d %d\\n\", a * 10, b * 10 + 1);\n exit(0);\n }\n if (b > a){\n printf(\"%d %d\\n\", (a * 100) + 99, b * 100);\n exit(0); \n } \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\",a*100,(a*100)+1);\n }\n else if(b-a==1)\n {\n printf(\"%d %d\",a,b);\n }\n else if(a==9 && b==1)\n {\n printf(\"%d 10\",a);\n }\n else\n {\n printf(\"-1\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main() {\n\tint a, b;\n\tscanf(\"%d%d\", &a, &b);\n\tif(a == b) {\n\t\ta = a * 100;\n\t\tb = b * 100 + 1;\n\t\tprintf(\"%d %d\\n\", a, b);\n\t}\n\telse if(b == a + 1) {\n\t\tb = b * 100;\n\t\ta = b - 1;\n\t\tprintf(\"%d %d\\n\", a, b);\n\t}\n\telse if(a == 9 && b == 1) {\n\t\tprintf(\"%d %d\\n\", 99, 100);\n\t}\n\telse printf(\"%d\\n\", -1);\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n printf(\"%d1 %d2\",a,b);\n else if(a+1==b)\n printf(\"%d9 %d0\",a,b);\n else if(a==9&&b==1)\n printf(\"99 100\");\n else\n printf(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n printf(\"%d %d\",a*10,a*10+1);\n else if((b-a)==1)\n printf(\"%d %d\",a*10+9,b*10);\n else if(a==9 && b==1)\n printf(\"99 100\");\n else\n printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#define lli long long int\nint main(void)\n{\n\tlli a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tif(a<b)\n\t{\n\t\tif(b-a==1)\n\t\t\tprintf(\"%lld9 %lld0\\n\",a,b);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\telse if(a==b)\n\t\tprintf(\"%lld4 %lld5\\n\",a,b);\n\telse if(a==9&&b==1)\n\t\tprintf(\"99 100\\n\");\n\telse\n\t\tprintf(\"-1\\n\");\n\n\n\n\treturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n\n if(a<b && abs(a-b)==1){\n printf(\"%d9 %d0\\n\",a,b);\n }\n else if(a==b){\n printf(\"%d1 %d2\\n\",a,b);\n }\n else if(a==9&&b==1){\n printf(\"%d %d0\",a,b);\n }\n else if (abs(a-b)>=2||a>b){\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main()\n{\n int da , db ,a,x,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n\n if (da==9 && db==1 )\n printf(\"%d %d \",9 , 10 ) ;\n\n\n else if ((abs(db-da)>=2)||(da>db ) )\n\n\n\n printf(\"-1\") ;\n\n else\n {\n a=da*10;\n b=db*10;\n x=abs(a-b+1);\n printf(\"%d %d\",a+x,a+x+1);\n }\n\n\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tint a,b;\n\t//Just in case\n\t//WistfulPeace_7\n\tscanf (\"%d%d\",&a,&b);\n\tif(b-a==0)\n\t\tprintf(\"%d12 %d13\\n\",a,b );\n\telse if (b-a==1)\n\t\tprintf(\"%d99 %d00\\n\",a,b);\n\telse if (a==9 && b==1)\n\t\tprintf(\"%d99 %d000\\n\",a,b);\n\telse if (b-a>1 || b-a<0)\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if (b - a == 1)\n {\n\n printf(\"%d99 %d00\", a, b);\n }\n else if (a == 9 && b == 1)\n {\n printf(\"999 1000\");\n }\n else if (b - a > 1 || b - a < 0)\n {\n printf(\"-1\");\n }\n\n else\n {\n printf(\"%d01 %d02\", a, b);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a,b;\nscanf(\"%d%d\",&a,&b);\n\tif(a==b)\n\tprintf(\"%d %d\",(b*11)-1,b*11);\n\telse if(b==a+1)\n\tprintf(\"%d %d\",(b*10)-1,b*10);\n\telse if(a==9&&b==1)\n\tprintf(\"999 1000\");\n\telse\n\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int a,b;\n scanf(\"%i%i\",&a,&b);\n if(a==9 && b==1)\n printf(\"%i %i0\",a,b);\n else if(a==b){\n printf(\"%i1 %i2\",a,b);\n }\n else if(b-a==1)\n printf(\"%i9 %i0\",a,b);\n else\n printf(\"-1\");\n \n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a, b;\n scanf(\"%d%d\", &a, &b);\n if(a == 9 && b == 1)\n puts(\"9 10\");\n else if(a + 1 == b)\n printf(\"%d %d\\n\", a, b);\n else if(a == b)\n printf(\"%d %d\\n\", a*10, a*10+1);\n else\n puts(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int a,b;\n scanf(\"%i%i\",&a,&b);\n if(a==9 && b==1)\n printf(\"%i %i0\",a,b);\n else if(a==b){\n printf(\"%i1 %i2\",a,b);\n }\n else if(b-a==1)\n printf(\"%i9 %i0\",a,b);\n else\n printf(\"-1\");\n \n return 0-0-0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da, db;\n\t\n\tscanf(\"%d %d\", &da, &db);\n\t\n\tif(da == 9 && db == 1)\n\tprintf(\"9 10\");\n\telse if(db - da > 1 || da > db)\n\tprintf(\"-1\");\n\telse if(da == db)\n\tprintf(\"%d %d\", (da*10)+1, (db*10)+2);\n\telse\n\tprintf(\"%d %d\", (da*10)+9, db*10);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,diff;\n scanf(\"%d %d\",&a,&b);\n if(a>=b)\n diff=a-b;\n else diff=b-a;\n if(diff>1&&diff!=8)\n printf(\"-1\\n\");\n else if(diff==0)\n printf(\"%d %d\\n\",100*a,100*a+1);\n else if(diff==1)\n {\n if(a<b)\n printf(\"%d %d\\n\",100*a+99,100*b);\n else\n printf(\"-1\\n\");\n }\n else if(diff==8&&b<a)\n printf(\"9 10\\n\");\n else if(diff==8&&b>a)\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n//CODED BY SAYEM MD. NAFI\n\nint main()\n{\n int A, B;\n scanf(\"%d %d\", &A, &B);\n if(A - B == -1) printf(\"%d9 %d0\\n\", A, B);\n else if(A - B == 0) printf(\"%d4 %d5\\n\", A, B);\n else if(A - B == 8) printf(\"%d9 %d00\\n\", A, B);\n else printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if((a-b)==-1)\n {\n printf(\"%lld %lld\\n\",a,b);\n }\n else if(a-b==0)\n {\n a=a*10;\n b=b*10+1;\n printf(\"%lld %lld\\n\",a,b);\n }\n else if(a%10==9&&b==1||b%10==0)\n {\n b=a+1;\n printf(\"%lld %lld\\n\",a,b);\n }\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,k;\n scanf(\"%d %d\",&c,&d);\n if(c==d)\n {\n a=c*10;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(d-c==1)\n {\n printf(\"%d %d\\n\",c,d);\n }\n else if(c==9&&d==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num1,num2;\n scanf(\"%d %d\",&num1,&num2);\n if(num1<=9&&num2<=9)\n {\n if(num1<num2&&num2-num1==1)\n {\n int x,y;\n x=(num1*10)+9;\n y=(num2*10);\n printf(\"%d %d\\n\",x,y);\n }\n else if(num1==num2)\n {\n int x,y;\n x=(num1*10)+1;\n y=(num2*10)+2;\n printf(\"%d %d\\n\",x,y);\n }\n else if(num1==9&&num2==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n }\n else\n {\n printf(\"-1\\n\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n\nvoid solve(int da, int db, int *a, int *b);\n\nint main(){\n\n\tint da, db, a, b;\n\n\tscanf(\"%d %d\", &da, &db);\n\n\tsolve(da, db, &a, &b);\n\n\tif(a > 0 && b > 0){\n\n\t\tprintf(\"%d %d\", a, b);\n\n\t}\n\n\telse{\n\n\t\tprintf(\"%d\", -1);\n\n\t}\n\n\treturn 0;\n\n}\n\nvoid solve(int da, int db, int *a, int *b){\n\n\tif(db == da + 1){\n\n\t\t*a = da;\n\t\t*b = db;\n\n\t}\n\n\telse if(db == da){\n\n\t\t*a = 10 * da;\n\t\t*b = 1 + 10 * db;\n\n\t}\n\n\telse if(da == 9 && db == 1){\n\n\t\t*a = 9 + 10 * da;\n\t\t*b = 100 * db;\n\n\t}\n\n\telse{\n\n\t\t*a = -1;\n\t\t*b = -1;\n\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint da, db;\n\tscanf(\"%d %d\", &da, &db);\n\tif (da == db)\n\t\tprintf(\"%d %d\", 10 * da, 10 * da + 1);\n\telse if (da + 1 == db)\n\t\tprintf(\"%d %d\\n\", 10 * da + 9, 10 * db);\n\telse if (da == 9 && db == 1)\n\t\tprintf(\"9 10\\n\");\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n\tint n,m;\n\twhile(~scanf(\"%d %d\",&n,&m))\n\t{\n\t\tif(n==9&&m==1)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\",9,10);\n\t\t}\n\t\telse if(m!=1+n&&m-n!=0||n>m)\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m==n)\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+1,m*10+2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+9,m*10);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n} "}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)printf(\"%d %d\",10*a+1,10*a+2);\n else if(a+1==b)printf(\"%d %d\",a*10+9,b*10);\n else \n {\n if(a==9&&b==1)printf(\"%d %d\",a,b*10);\n else printf(\"-1\");\n \n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int da, db;\n scanf(\"%d%d\", &da, &db);\n\n if (da == db)\n {\n printf(\"%d %d\\n\", da * 10, db * 10 + 1);\n }\n else if (da > db)\n {\n if (da - db == 8)\n printf(\"9 10\\n\");\n else\n {\n printf(\"-1\\n\");\n }\n }\n else\n {\n if (db - da > 1)\n {\n printf(\"-1\\n\");\n }\n else\n {\n printf(\"%d %d\\n\", da * 10 + 9, db * 10);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d\",&a,&b);\n c=b-a;\n if(a==9&&b==1)\n printf(\"9 10\");\n\n else if(c==1){\n a=b*100;\n a=a-1;\n printf(\"%d %d\",a,a+1);\n }\n else if(c==0) {\n a=a*100;\n printf(\"%d %d\",a,a+1);\n }\n else {\n printf(\"-1\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n \n if(a==b){\n a=a*100;\n b=b*100+1;\n printf(\"%d %d\",a,b);\n }\n \n else if(b-a==1){\n b=100*b;\n a=a*100+99;\n printf(\"%d %d\",a,b);\n }\n else if(b-a>1) printf(\"%d\",-1);\n \n else if(a>b && a!=9 || b!=1 ){\n printf(\"%d\",-1);\n }\n else{\n printf(\"%d %d\",a,b+9);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint d1,d2,a;\n\tscanf(\"%d%d\",&d1,&d2);\n\tif(d1==d2)\n\t{\n\t\tprintf(\"%d %d\",(d1*10),(d2*10+1));\n\t}\n\telse if((d2-d1)==1)\n\t{\n\t\ta=d2*10;\n\t\tprintf(\"%d %d\",(a-1),a);\n\t}\n\telse if(d1==9&d2==1)\n\t{\n\t\tprintf(\"9 10\");\n\t}\n\telse if((d2-d1)>1||(d1-d2)>1)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse if(d1>d2)\n\tprintf(\"-1\");\n\t\n}\n\t\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\", &a, &b);\n int result = b - a;\n if (result == 0)\n printf(\"%d %d\\n\", (a*10), (b*10)+1);\n else if (result == 1)\n printf(\"%d %d\\n\", (a*10)+9 , (b*10));\n else if (a == 9 && b == 1)\n printf(\"%d %d\\n\", (a*10)+9, (b*10)*10);\n else\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,j,p,q;\n scanf(\"%d%d\",&a,&b);\n\n j=abs(a-b);\n if(j==1&&a<b)\n {\n p=(b*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j==0&&a==b)\n {\n p=(a*100)+(a+b)+a;\n q=p+1;\n printf(\"%d %d\",p,q);\n\n }\n else if(j==8&&a>b)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j>=2&&j<8&&a>b||a<b)\n printf(\"-1\");\n else if(j==1&&a>b)\n\n printf(\"-1\");\n\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main() {\n int da;\n int db;\n scanf(\"%d\", &da);\n scanf(\"%d\", &db);\n \n if ((abs(da - db) > 1 && (da + 1) / 10 != db) || ((da + 1) / 10 != db && da > db))\n printf(\"-1\");\n else\n for (long i = 0; ; i++)\n {\n int m = i;\n if ((i > 10 && ((i / 10 == da) && ((i + 1) / 10 == db))) || (i < 10 && i == da && (i + 1) / 10 == db)) { printf(\"%d %d\", i, i + 1); break; }\n \n }\n \n}"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m<p && (p-m)==1)\n{\n printf(\"%d%d %d%d\",m,9,p,0);\n}\nelse if(m==p)\n{\n printf(\"%d%d %d%d\",m,1,p,2); \n}\nelse\n{ if(m==9 && p==1)\n printf(\"%d %d\",9,10);\n else\n printf(\"%d\",-1);\n}\n return 0; \n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif(a==9 && b==1){\n\t\tputs(\"9 10\");\n\t\treturn 0;\n\t}\n\tif(a+1!=b && a!=b){\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\ta*=10;\n\tb*=10;\n\tif(a==b) ++b;\n\telse a+=9;\n\tprintf(\"%d %d\\n\", a, b);\n\treturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n\tint n,m;\n\twhile(~scanf(\"%d %d\",&n,&m))\n\t{\n\t\tif(n==9&&m==1)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\",9,10);\n\t\t}\n\t\telse if(m!=1+n&&m-n!=0||n>m)\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m==n)\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+1,m*10+2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+9,m*10);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n a = a*10;\n b = (b*10)+1;\n printf(\"%d %d\",a,b);\n }\n else if(a+1==b)\n {\n a = (a*100)+99;\n b =a+1;\n printf(\"%d %d\",a,b);\n }\n else if(a==9 && b==1)\n printf(\"9 10\");\n else\n {\n printf(\"-1\");\n\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main () \n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if(b - a == 1) {\n printf(\"%d99 %d00\\n\", a, b);\n }\n else if(a == b) {\n printf(\"%d00 %d01\", a, b);\n }\n else if(b - a >= 2) {\n printf(\"-1\");\n }\n else if(a == 9 && b == 1) {\n printf(\"%d %d0\", a, b);\n }\n else if(a - b >= 1) {\n printf(\"-1\"); \n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a,b;\n\t\n\tscanf(\"%d%d\",&a,&b);\n\t\n\tif(b == a)\n\t\tprintf(\"%d %d\",a*10, b*10+1);\n\telse if(b-a == 1)\n\t\tprintf(\"%d %d\",b*10-1, b*10);\n\telse if(a==9 && b==1)\n\t\tprintf(\"99 100\");\n\telse\n\tprintf(\"-1\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b) printf(\"%d %d\",a*100,b*100+1);\n else if((b-a)==1) printf(\"%d99 %d00\",a,b);\n else if(a==9 && b==1) printf(\"9 10\");\n else printf(\"-1\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\\n\",10*a+1,10*a+2);\n }\n else if(b==a+1)\n {\n printf(\"%d %d\\n\",a,b);\n }\n else if(a==9 && b==1)\n {\n printf(\"99 100\\n\");\n }\n else\n printf(\"-1\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if (a + 1 == b)\n {\n printf(\"%d %d\", a, b);\n }\n else if (a == 9 && b == 0)\n {\n printf(\"19 20\");\n }\n else if (a == 9 && b == 1)\n {\n printf(\"9 10\");\n }\n else if (a == b)\n {\n a = a*10 + 1;\n b = b*10 + 2;\n printf(\"%d %d\", a, b);\n }\n else\n {\n printf(\"-1\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint d1,d2,a;\n\tscanf(\"%d%d\",&d1,&d2);\n\tif(d1==d2)\n\t{\n\t\tprintf(\"%d %d\",(d1*10),(d2*10+1));\n\t}\n\telse if((d2-d1)==1)\n\t{\n\t\ta=d2*10;\n\t\tprintf(\"%d %d\",(a-1),a);\n\t}\n\telse if(d1==9&d2==1)\n\t{\n\t\tprintf(\"9 10\");\n\t}\n\telse if((d2-d1)>1||(d1-d2)>1)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse if(d1>d2)\n\tprintf(\"-1\");\n\t\n}\n\t\t\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if (a + 1 == b)\n {\n printf(\"%d %d\", a, b);\n }\n else if (a == 9 && b == 0)\n {\n printf(\"19 20\");\n }\n else if (a == 9 && b == 1)\n {\n printf(\"9 10\");\n }\n else if (a == b)\n {\n a = a*10 + 1;\n b = b*10 + 2;\n printf(\"%d %d\", a, b);\n }\n else\n {\n printf(\"-1\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\", &a,&b);\n if(a>b)\n {\n if(a==9&&b==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n }\n else if(a==b)\n {\n printf(\"%d1 %d2\\n\", a,b);\n }\n else\n {\n if(b-a>1)\n {\n printf(\"-1\\n\");\n }\n else\n {\n printf(\"%d %d\\n\", a,b);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,y,a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n {\n printf(\"%d11 %d12\\n\",a,b);\n }\n else if(a+1==b)\n {\n printf(\"%d99 %d00\\n\",a,b);\n }\n else if(a==9&&b==1)\n {\n printf(\"%d %d0\\n\",a,b);\n }\n else\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,j,p,q;\n scanf(\"%d%d\",&a,&b);\n\n j=abs(a-b);\n if(j==1&&a<b)\n {\n p=(b*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j==0&&a==b)\n {\n p=(a*100)+(a+b)+a;\n q=p+1;\n printf(\"%d %d\",p,q);\n\n }\n else if(j==8&&a>b)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(j>=2&&j<8&&a>b||a<b)\n printf(\"-1\");\n else if(j==1&&a>b)\n\n printf(\"-1\");\n\n\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if(a==9 && b==1)\n printf(\"%d %d0\\n\", a, b);\n else if(a+1==b)\n printf(\"%d99 %d00\\n\", a, b);\n else if(a==b)\n printf(\"%d12 %d13\\n\", a, b);\n else\n printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) \n{\n\tint a,b;\n\tscanf(\"%d %d\", &a, &b);\n\tif(b-a==-8)\n\t{\n\t\tb=10;\n\t}\n\telse if(b==a)\n\t{\n\t\ta=a*10+1;\n\t\tb=b*10+2;\n\t}\n\telse if(b-a==1)\n\t{\n\t\ta=a;\n\t\tb=b;\n}\n\telse\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tprintf(\"%d %d\", a,b);\n\n\treturn 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,s,m,q;\n scanf(\"%d%d\",&a,&b);\n s=abs(a-b);\n if(s==1&&a<b)\n {\n m=(b*100)-1;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==0 && a==b)\n {\n m=(a*100)+(a+b)+a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==8&&a>b)\n {\n m=a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s>=2 && s<8 && a>b||a<b)\n {\n \tprintf(\"-1\");\n\t\t\t}\n else if(s==1&&a>b)\n {\n \tprintf(\"-1\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define lli long long int\nint main(void)\n{\n\tlli a,b;\n\tscanf(\"%lld %lld\",&a,&b);\n\tif(a<b)\n\t{\n\t\tif(b-a==1)\n\t\t\tprintf(\"%lld9 %lld0\\n\",a,b);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t}\n\telse if(a==b)\n\t\tprintf(\"%lld4 %lld5\\n\",a,b);\n\telse if(a==9&&b==1)\n\t\tprintf(\"99 100\\n\");\n\telse\n\t\tprintf(\"-1\\n\");\n\n\n\n\treturn 0;\t\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n printf(\"%d1 %d2\",a,b);\n else if(a+1==b)\n printf(\"%d9 %d0\",a,b);\n else if(a==9&&b==1)\n printf(\"99 100\");\n else\n printf(\"-1\");\n}"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n int a, b;\n scanf(\"%d%d\", &a, &b);\n if(a==b) printf(\"%d0 %d1\\n\", a, b);\n else if(a==b-1) printf(\"%d9 %d0\\n\", a, b);\n else if(a==9&&b==1) printf(\"%d9 %d00\\n\", a, b);\n else puts(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong n , a, b, i, k;\n\nint main()\n{\n\tscanf(\"%d %d\", &a, &b);\n\tif(a == 9 && b == 1) printf(\"9 10\"); else if (a > b) printf(\"-1\"); \n\telse if (b - a > 1) printf(\"-1\"); \n\telse if(b == a) printf(\"%d %d\", a*10 + 1, a*10 + 2);\n\telse if (b > a) printf(\"%d %d\", a*10 + 9, (a+1)*10 );\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,k;\n scanf(\"%d %d\",&c,&d);\n if(c==d)\n {\n a=c*10;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(d-c==1)\n {\n printf(\"%d %d\\n\",c,d);\n }\n else if(c==9&&d==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int a,b;\n scanf(\"%i %i\",&a,&b);\n int c = b-a;\n switch ( c ){\n case 1:\n printf(\"%i9 %i0\",a,b);\n break;\n case 0:\n printf(\"%i0 %i1\", a,b);\n break;\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int da,db;\n scanf(\"%d%d\",&da,&db);\n int a,b;\n if(da==db){\n a=da*10+1;\n b=db*10+2;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==db){\n a=da*10+9;\n b=db*10;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==10 && db==1){\n a=da;\n b=10;\n printf(\"%d %d\\n\",a,b);\n\n }else{\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,k;\n scanf(\"%d %d\",&c,&d);\n if(c==d)\n {\n a=c*10;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(d-c==1)\n {\n printf(\"%d %d\\n\",c,d);\n }\n else if(c==9&&d==1)\n {\n printf(\"9 10\\n\");\n }\n else\n {\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a, c;\n\tscanf(\"%d%d\", &a, &c);\n\tif(a+1 == c){\n\t\tprintf(\"%d%d %d%d\",a,9,c,0);\n\t}else if(a==c){\n\t\tprintf(\"%d%d %d%d\",a,1,c,2);\n\t}else if(a==9 && c==1){\n\t\tprintf(\"%d %d%d\",a,c,0);\n\t}else{\n\t\tprintf(\"%d\",-1);\n\t}\n\tprintf(\"\\n\");\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n\n if(a<b && abs(a-b)==1){\n printf(\"%d9 %d0\\n\",a,b);\n }\n else if(a==b){\n printf(\"%d1 %d2\\n\",a,b);\n }\n else if(a==9&&b==1){\n printf(\"%d %d0\",a,b);\n }\n else if (abs(a-b)>=2||a>b){\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int da,db,a,b;\n scanf(\"%d%d\",&da,&db);\n if(da==db)\n {\n a=da*100;\n b=a+1;\n printf(\"%d %d\",a,b);\n }\n else if(db-da==1)\n {\n b=db*100;\n a=b-1;\n printf(\"%d %d\",a,b);\n }\n else if(da==9&&db==1)\n {\n b=db*1000;\n a=b-1;\n printf(\"%d %d\",a,b);\n }\n else\n printf(\"-1\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b){\n printf(\"%d00 %d01\\n\",a,b);\n }\n else if(a+1==b){\n printf(\"%d %d\\n\",a,b);\n }\n else if(a==9&&b==1){\n printf(\"%d %d0\\n\",a,b);\n }\n else {\n printf(\"-1\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif(a==9 && b==1){\n\t\tputs(\"9 10\");\n\t\treturn 0;\n\t}\n\tif(a+1!=b && a!=b){\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\ta*=10;\n\tb*=10;\n\tif(a==b) ++b;\n\telse a+=9;\n\tprintf(\"%d %d\\n\", a, b);\n\treturn 0;\n}\n"}, {"source_code": "int main()\n{\n\tint da,db;\n\tscanf(\"%d%d\",&da,&db);\n\tif(db-da>1)\n\tprintf(\"-1\");\n\tif(db-da==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"99\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n if(db==da)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"12\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"13\");\n\t}\n if(da==9&&db==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"9\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n\t else if(da>db)\n {\n \tprintf(\"-1\");\n\t }\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n printf(\"%d %d\",a*10,a*10+1);\n else if(b-a==1)\n printf(\"%d %d\",a*10+9,b*10);\n else if(a==9&&b==1)\n printf(\"9 10\");\n else\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{ int a,b;\n scanf (\"%d%d\",&a,&b);\n if(a==b)\n { a=a*100;b=b*100;\n printf (\"%d %d\",a,b+1);\n }\n else if (b==1&&a==9)\n { b=b*100;a=b-1;\n printf (\"%d %d\",a,b);\n }\n else if ((b-a)==1)\n { b=b*100;\n a=b-1;\n printf (\"%d %d\",a,b);\n }\n else \n printf (\"-1\");\n \n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int da,db;\n scanf(\"%i %i\",&da,&db);\n int diff=db-da;\n switch(diff){\n case 1:\n printf(\"%i9 %i0\", da,db);\n break;\n case 0:\n printf(\"%i0 %i1\", da ,db);\n break;\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n \n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint da, db;\n\tscanf(\"%d %d\", &da, &db);\n\tif (da == db)\n\t\tprintf(\"%d %d\", 10 * da, 10 * da + 1);\n\telse if (da + 1 == db)\n\t\tprintf(\"%d %d\\n\", 10 * da + 9, 10 * db);\n\telse if (da == 9 && db == 1)\n\t\tprintf(\"9 10\\n\");\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 9 && b == 1)\n\t{\n\t\tprintf(\"9 10\");\n\t\treturn 0;\n\t}\n\tif (a > b)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse if (a == b)\n\t{\n\t\tprintf(\"%d %d\", a * 10, b * 10 + 1);\n\t}\n\telse if (a < b)\n\t{\n\t\tif (b - a > 1)\n\t\t\tprintf(\"-1\");\n\t\telse\n\t\t\tprintf(\"%d %d\", a * 10 + 9, b * 10);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a+1==b)\n printf(\"%d %d\",a,b);\n else if(a==b)\n printf(\"%d %d\",a*10,b*10+1);\n else if(a+1==b*10)\n printf(\"%d %d\",a,b*10);\n else\n printf(\"-1\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n//CODED BY SAYEM MD. NAFI\n\nint main()\n{\n int A, B;\n scanf(\"%d %d\", &A, &B);\n if(A - B == -1) printf(\"%d9 %d0\\n\", A, B);\n else if(A - B == 0) printf(\"%d4 %d5\\n\", A, B);\n else if(A - B == 8) printf(\"%d9 %d00\\n\", A, B);\n else printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n\tint n,m;\n\twhile(~scanf(\"%d %d\",&n,&m))\n\t{\n\t\tif(n==9&&m==1)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\",9,10);\n\t\t}\n\t\telse if(m!=1+n&&m-n!=0||n>m)\n\t\t{\n\t\t\tprintf(\"-1\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m==n)\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+1,m*10+2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\\n\",n*10+9,m*10);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long a,b,n,k;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b)\n {\n printf(\"%lld11 %lld12\\n\",a,b);\n }\n else if((a+1)==b)\n printf(\"%lld99 %lld00\\n\",a,b);\n else if(a==9&&b==1)\n printf(\"%lld99 %lld000\\n\",a,b);\n else\n printf(\"-1\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n int a,b;\n sf(\"%d %d\",&a,&b);\n if(a==b)\n pf(\"%d %d\\n\",a*10,b*10+1);\n else if(a==9&&b==1)\n pf(\"%d %d\\n\",9,10);\n else if(b==a+1)\n pf(\"%d %d\\n\",a,b);\n else\n pf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint modul(int x){\n if(x<0)\n return -x;\n return x;\n}\nint main(){\n int a, b;\n scanf(\"%d%d\", &a, &b);\n if(a+1==b)\n printf(\"%d %d\", a, b);\n else if(a==b)\n printf(\"%d0 %d1\", a, b);\n else if(a==9 && b==1)\n printf(\"9 10\");\n else\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((b-a)==1)\n {\n b=b*100;\n a=b-1;\n printf(\"%d %d\",a,b);\n }\n else if((b-a)==0)\n {\n b=b*100;\n a=b;\n a=a+12;\n b=a+1;\n printf(\"%d %d\",a,b);\n }\n else if(a==9&&b==1)\n printf(\"9 10\");\n else printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a, b;\n\tscanf(\"%d%d\", &a, &b);\n\tif(a==9 && b==1) printf(\"9 10\");\n\telse if(a>b || b-a>1) printf(\"-1\");\n\telse if(b-a == 1) printf(\"%d %d\", a*10 +9, b*10);\n\telse if(a == b) printf(\"%d %d\", a*10 +1, b*10 +2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int da,db;\n scanf(\"%d%d\",&da,&db);\n int a,b;\n if(da==db){\n a=da*10+1;\n b=db*10+2;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==db){\n a=da*10+9;\n b=db*10;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==10 && db==1){\n a=da;\n b=10;\n printf(\"%d %d\\n\",a,b);\n\n }else{\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==9&&b==1)\n printf(\"99 100\");\n\n else if(a==b)\n printf(\"%d11 %d12\",a,a);\n else if(a<b){\n if(b-a==1)\n printf(\"%d99 %d00\",a,b);\n else\n printf(\"-1\");\n }\n else\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int da,db;\n scanf(\"%d%d\",&da,&db);\n int a,b;\n if(da==db){\n a=da*10+1;\n b=db*10+2;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==db){\n a=da*10+9;\n b=db*10;\n printf(\"%d %d\\n\",a,b);\n }else if(da+1==10 && db==1){\n a=da;\n b=10;\n printf(\"%d %d\\n\",a,b);\n\n }else{\n printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n\n int dA,dB;\n\n scanf(\"%d %d\",&dA,&dB);\n\n int res = dA - dB;\n\n if((res > 0 || res < -1)&&res != 8)\n printf(\"-1\\n\");\n else{\n if(dA == dB){\n printf(\"%d %d\\n\",(dA*100),(dB*100 + 1));\n }else{\n printf(\"%d %d\\n\",(dB*100 - 1),(dB*100));\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n printf(\"%d %d\\n\",a*100+12,b*100+13);\n else if(b-a==1)\n printf(\"%d %d\\n\",a*100+99,b*100);\n else if(a==9&&b==1)\n printf(\"%d %d\\n\",a,a+1);\n else\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n printf(\"%d %d\\n\",a*100+12,b*100+13);\n else if(b-a==1)\n printf(\"%d %d\\n\",a*100+99,b*100);\n else if(a==9&&b==1)\n printf(\"%d %d\\n\",a,a+1);\n else\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint can(int a, int b) {\n if ((a<=b && b<a+2) || (a==9 && b==1)) {\n return 1;\n } else {\n return 0;\n }\n}\nvoid construct(int a, int b) {\n if (a==9 && b==1) {\n printf(\"%d 10\",a);\n } else if (a==b) {\n printf(\"%d %d\",10*a,10*a+1);\n } else {\n printf(\"%d %d\",10*a+9,10*b);\n }\n}\nint main() {\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if (can(a,b)) {\n construct(a,b);\n } else {\n printf(\"-1\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\",(a*10),(b*10)+1);\n }\n else if(a+1==b)\n {\n printf(\"%d %d\",a,b);\n }\n else if(a==9 && b ==1)\n {\n printf(\"%d %d\",9,10);\n }\n else{\n printf(\"%d\",-1);\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\", &a,&b);\n if(a==9 && b==1){\n printf(\"9 10\");\n }\n else if(b-a>=2 || b-a<0){\n printf(\"-1\");\n }\n else if(b-a==1){\n printf(\"%d99 %d00\",a, b);\n }\n else if(b-a==0){\n printf(\"%d12 %d13\", a,b);\n }\n\n return 0;\n}\n\n\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n else\n { a=da*100;\n\n if (db-da==1)\n\n printf(\"%d, %d\" , a+99 , a+99+1);\n else if (db-da==0)\n printf(\"%d ,%d\" , a+1 , a+1+1);\n\n\n }\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c,d,x;\n scanf(\"%lld%lld\",&a,&b);\n if(a>b && a!=b){c=-1;x=1;}\n if(b-a>1 && x!=1){c=-1;x=2;}\n if(a==b && x!=2){a=(a*10)-1;b=b*10; x=3;}\n if(b-a==1 && a!=b && x!=3){a=(a*10)+9;b=b*10;}\n\n if(c!=-1){printf(\"%lld %lld\",a,b);}\n else {printf(\"-1\");}\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<math.h>\nint main()\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tint d = abs(a - b);\n\tif (d>1)printf(\"-1\\n\");\n\telse {\n\t\tif (d) {\n\t\t\ta = a * 10 + 9; b = b * 10;\n\t\t}\n\t\telse if (a == 9 && b == 1)printf(\"9 10\\n\");\n\t\telse {\n\t\t\ta = a*10 + 1;\n\t\t\tb = b*10 + 2;\n\t\t}\n\t\tprintf(\"%d %d\\n\", a, b);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n int a,b;\n sf(\"%d %d\",&a,&b);\n if(a==b)\n pf(\"%d %d\\n\",a*10,b*10+1);\n else if(a==9&&b==1)\n pf(\"%d %d\\n\",a*10,b*10+1);\n else if(b==a+1)\n pf(\"%d %d\\n\",a,b);\n else\n pf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((a==9 && b==1))\n printf(\"9 10\");\n else if((a-b)>1)\n printf(\"-1\");\n else if((a-b)==0)\n printf(\"%d12 %d13\",a,b);\n else if((a-b)==1)\n printf(\"%d99 %d00\",a,b);\n}"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n int a,b,c,d,x;\n scanf(\"%d%d\",&a,&b);\n if(a>b && a!=b){c=-1;x=1;}\n if(b-a>1 && x!=1){c=-1;x=2;}\n if(a==b && x!=2){a=(a*10)-1;b=b*10; x=3;}\n if(b-a==1 && a!=b && x!=3){a=(a*10)+9;b=b*10;}\n\n if(c!=-1){printf(\"%d %d\",a,b);}\n else {printf(\"-1\");}\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a-b>1 && a!=b){c=-1;x=1;}\n\n if(b-a>1 && x!=1){c=-1;x=2;}\n\n if(a==b && x!=2){a=(a*10)-1;b=b*10; x=3;}\n\n if(b-a==1 && a!=b && x!=3){a=(a*10)+9;b=b*10;}\n\n\n if(c!=-1){printf(\"%lld %lld\\n\",a,b);}\n else {printf(\"-1\\n\");}\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\nint x,y,z;\nscanf(\"%d %d\", &x, &y);\n\nif(x==y)\n{\n x=x*100+12;\n y=x+1;\n printf(\"%d %d\", x,y);\n}else if(x+1==y)\n{\n z = x*100+99;\n y = z+x;\n printf(\"%d %d\", z,y);\n}else if(x==9 && y==1)\n{\n y = y*10;\n printf(\"%d %d\", x,y);\n}else printf(\"-1\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,s,m,q;\n scanf(\"%d%d\",&a,&b);\n s=abs(a-b);\n if(s==1&&a<b)\n {\n m=(b*100)-1;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==0 && a==b)\n {\n m=(a*100)+(a+b)+a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==8&&a>b)\n {\n m=a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s>=2 && s<8 )\n {\n \tprintf(\"-1\");\n\t\t\t}\n else if(s==1&&a>b)\n {\n \tprintf(\"-1\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n printf(\"%d1 %d2\\n\",a,b);\n else if(a+1==b)\n printf(\"%d %d\",a,b);\n else if(a==1 && b==9)\n printf(\"9 10\\n\");\n else\n printf(\"-1\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,y,a,b;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n {\n n=a-b;\n if(n==1)\n {\n printf(\"%d00 %d99\\n\",a,b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n }\n else\n {\n n=b-a;\n if(n==1)\n {\n printf(\"%d99 %d00\\n\",a,b);\n }\n else if(n==0)\n {\n printf(\"%d12 %d13\\n\",a,b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a, b;\n\tscanf(\"%d%d\", &a, &b);\n\tif(a-b>1 || b-a>1) printf(\"-1\");\n\telse if(a==9 && b==1) printf(\"9 10\");\n\telse if(a-b == 1) printf(\"%d %d\", a, b);\n\telse if(b-a == 1) printf(\"%d %d\", a*10 +9, b*10);\n\telse if(a == b) printf(\"%d %d\", a*10 +1, b*10 +2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n \n if(a>b && a!=9 && b!=1 ){\n printf(\"%d\",-1);\n }\n else if(a>b && a==9 && b==1 ){\n printf(\"%d %d\",a,b+9);\n }\n else if(b-a==1){\n b=100*b;\n a=a*100+99;\n printf(\"%d %d\",a,b);\n }\n else if(a==b){\n a=a*100;\n b=b*100+1;\n printf(\"%d %d\",a,b);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,t,j=0,k=0,b,c,l=0;\n char bh[100],a[100];\n scanf(\"%d%d\",&t,&b);\n \n if(t+1==b)\n {\n b=b*100;\n printf(\"%d %d\\n\",b-1,b);\n }\n else if(t==b)\n {\n b=b*100+t*(t-1);\n printf(\"%d %d\\n\",b,b+1);\n }\n else if(b-t==8)\n printf(\"%d %d\\n\",999,1000);\n else\n printf(\"-1\\n\");\n /* for(i=1; i<=t; i++)\n {\n scanf(\"%d\",&c);\n \n }*/\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(abs(a-b)>1)\n printf(\"-1\");\n if(abs(a-b)==0)\n printf(\"%d12 %d13\",a,b);\n if(abs(a-b)==1)\n printf(\"%d99 %d00\",a,b);\n}"}, {"source_code": "#include<stdio.h>\n\nvoid check(int da, int db){\n int a, b;\n if(da > db){\n printf(\"-1\");\n }\n else if(da == db){\n a = da * 100 + 10;\n b = db * 100 + 11;\n printf(\"%d %d\", a, b);\n }\n else{\n if(da + 1 == db){\n a = da * 100 + 99;\n b = db * 100;\n printf(\"%d %d\", a, b);\n }\n else\n printf(\"-1\");\n }\n}\n\nint main(){\n int da, db;\n scanf(\"%d%d\", &da, &db);\n \n check(da, db);\n \n return 0;\n}"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a>b && a!=b){c=-1;x=1;}\n\n if(b-a>1 && x!=1){c=-1;x=2;}\n\n if(a==b && x!=2){a=(a*10)-1;b=b*10; x=3;}\n\n if(b-a==1 && a!=b && x!=3){a=(a*10)+9;b=b*10;}\n\n\n if(c!=-1){printf(\"%lld %lld\\n\",a,b);}\n else {printf(\"-1\\n\");}\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>2)||(da>db))\n printf(\"-1\") ;\n else\n { a=da*100;\n b=db*100;\n if (abs(da-db)==1)\n\n printf(\"%d, %d\" , a+99 , a+99+1);\n else if (da-db==0)\n printf(\"%d ,%d\" , a+1 , a+1+1);\n\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int i= (b-a);\n if((a!=9)&&(b!=0))\n {\n if(i==0)\n {\n printf(\"%d2 %d3\\n\",a,b);\n \n }\n if(i==1)\n {\n printf(\"%d9 %d0\",a,b);\n }\n if((i!=0) && (i!=1))\n {\n printf(\"%d\",-1);\n }\n }\n else\n {\n printf(\"%d %d\", 9,10);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int da, db;\n scanf(\"%d %d\", &da, &db);\n if(da == db + 1 || da == db - 1)\n {\n printf(\"%d%d %d%d\\n\", da, 9, db, 0);\n }\n else if( da == db)\n printf(\"%d%d %d%d\\n\", da, 5, db, 6);\n else\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)printf(\"%d %d\",10*a+1,10*a+2);\n else if(a+1==b)printf(\"%d %d\",a*10+9,b*10);\n else printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if (b - a > 1 || b - a < 0)\n {\n printf(\"-1\");\n }\n else if (b - a == 1)\n {\n printf(\"%d99 %d00\", a, b);\n }\n else\n {\n printf(\"%d01 %d02\", a, b);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,k,r,o,sum1,sum=0,count1=0,a[200000]={1},c[200000]={0};\nscanf(\"%lld%lld\",&n,&m);\nif(abs(n-m)>=2){\n printf(\"-1\");\n}else{\n if(n==m){\n printf(\"%lld %lld\",n*10,n*10+1);\n }else{\n if(n<m){\n printf(\"%lld %lld\",m*10-1,m*10);\n }else{\n printf(\"-1\");\n }\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{int b,a;\nscanf(\"%d%d\",&a,&b);\nif ((a=9)&&(b=1))\n printf(\"99 100\");\nelse if (abs(a-b)>1)\n {\n a=-1;\n printf(\"%d\\n\",a);}\n else if (a==b)\n {a=a*100+12;\n b=b*100+13;\n printf(\"%d %d\\n\",a,b);}\n else\n {a=a*100+99;\n b=b*100;\n printf(\"%d %d\\n\",a,b);}\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,y,a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\\n\",a,b+1);\n }\n else if(a+1==b)\n {\n printf(\"%d %d\\n\",a+198,b+198);\n }\n else\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,i,j,k;\n\n scanf(\"%d%d\",&i,&j);\n\n if(i==j){\n\n j=(i*10);\n printf(\"%d %d\",j,(j+1));\n }\n else if((j-i)==1){\n\n j=(i*10);\n printf(\"%d %d\",(j+9),(j+9+1));\n }\n else\n printf(\"-1\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)printf(\"%d %d\",10*a+1,10*a+2);\n if(a+1==b)printf(\"%d %d\",a*10+9,b*10);\n else printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif(a+1!=b && a!=b){\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\ta*=10;\n\tb*=10;\n\tif(a==b) ++b;\n\telse a+=9;\n\tprintf(\"%d %d\\n\", a, b);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n else\n { a=da*100;\n b=db*100;\n if (db-da==1)\n\n printf(\"%d, %d\" , a+99 , a+99+1);\n else if (db-da==0)\n printf(\"%d ,%d\" , a+1 , a+1+1);\n\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da,db;\n\tscanf(\"%d%d\",&da,&db);\n\tif(db-da>1)\n\tprintf(\"-1\");\n\tif(db-da==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"99\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n if(db==da)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"12\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"13\");\n\t}\n if(da==9&&db==1)\n\t{\n\t\tprintf(\"%d\",&da);\n\t\tprintf(\"9\");\n\t\tprintf(\"%d\",&db);\n\t\tprintf(\"00\");\n\t}\n\telse if(da>db)\n {\n \tprintf(\"-1\");\n\t }\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long a,b,n,k;\n scanf(\"%lld%lld\",&a,&b);\n if(a==b)\n {\n printf(\"%lld11 %lld12\\n\",a,b);\n }\n else if((a+1)==b)\n printf(\"%lld99 %lld00\\n\",a,b);\n else\n printf(\"-1\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,t,j=0,k=0,b,c,l=0;\n char bh[100],a[100];\n scanf(\"%d%d\",&t,&b);\n \n if(t+1==b)\n {\n b=b*100;\n printf(\"%d %d\\n\",b-1,b);\n }\n else if(t==b)\n {\n b=b*100+t*(t-1);\n printf(\"%d %d\\n\",b,b+1);\n }\n else if(b-t==8 && abs(t-b)==8)\n printf(\"%d %d\\n\",999,1000);\n else\n printf(\"-1\\n\");\n /* for(i=1; i<=t; i++)\n {\n scanf(\"%d\",&c);\n \n }*/\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main()\n{\n int da , db ,a,x,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n\n else\n {\n a=da*10;\n b=db*10;\n x=abs(a-b+1);\n printf(\"%d %d\",a+x,a+x+1);\n }\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\nint x,y,z;\nscanf(\"%d %d\", &x, &y);\n\nif(x==y)\n{\n x=x*103;\n y=x+1;\n printf(\"%d %d\", x,y);\n}else if(x+1==y)\n{\n z = x*100+99;\n y = z+x;\n printf(\"%d %d\", z,y);\n}else if(x==9 && y==1)\n{\n y = y*10;\n printf(\"%d %d\", x,y);\n}else printf(\"-1\");\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{int b,a;\nscanf(\"%d%d\",&a,&b);\nif (abs(a-b)>1)\n {a=-1;\n printf(\"%d\\n\",a);}\n else if (a==b)\n {a=a*100+12;\n b=b*100+13;\n printf(\"%d %d\\n\",a,b);}\n else\n {a=a*100+99;\n b=b*100;\n printf(\"%d %d\\n\",a,b);}\n if ((a=9)&&(b=1))\n printf(\"99 100\");\n }\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int da, db;\n scanf(\"%d %d\", &da, &db);\n if(da == db + 1 || da == db - 1)\n {\n printf(\"%d%d %d%d\\n\", da, 9, db, 0);\n }\n else if( da == db)\n printf(\"%d%d %d%d\\n\", da, 5, db, 6);\n else\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n\n if(abs(a-b)==1){\n printf(\"%d9 %d0\\n\",a,b);\n }\n else if(a==b){\n printf(\"%d1 %d2\\n\",a,b);\n }\n else if((a==9&&b==1)||(a==1&&b==9)){\n printf(\"%d %d0\",a,b);\n }\n else printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "main(a, b) {\n\tscanf(\"%d%d\", &a, &b);\n\tif (a == b)\n\t\tprintf(\"%d00 %d01\", a, b);\n\telse if (a + 1 == b)\n\t\tprintf(\"%d %d\", a, b);\n\telse\n\t\tputs(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(b-a==1)\n printf(\"%d9 %d0\",a,b);\n else if(a==b)\n printf(\"%d0 %d1\",a,b);\n else\n printf(\"-1\\n\");\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c=0,d,x=0;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a>b){c=2;}\n if(b-a>=2 && c!=2){c=1;}\n if(a==9 && b==1 && x!=3){a=a;b=10;b=10;x=1;}\n\n if(a==b && x!=1){a=a*10;b=(b*10)+1;x=2;}\n if(c!=1 && a-b==1 && x!=2 & x!=1){a=(a*10); b=(b*10)+9; x=3;}\n if(c!=1 && b-a==1 && x!=3 && x!=2 && x!=1){a=(a*10)+9; b=b*10;}\n\n\n if(c==1){printf(\"-1\");}\n else printf(\"%lld %lld\",a,b);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(b-a>1 || b-a<0)\n printf(\"-1\\n\");\n else if(b-a==1){\n printf(\"%d99 %d00\",a,b);\n }else if(b-a==0)\n {\n printf(\"%d2 %d3\",a,b);\n }\n if(a==9 && b==1)\n printf(\"99 100\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 9)\n\t{\n\t\tprintf(\"10 9\");\n\t\treturn 0;\n\t}\n\tif (a == 9 && b == 1)\n\t{\n\t\tprintf(\"9 10\");\n\t\treturn 0;\n\t}\n\tif (a > b)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse if (a == b)\n\t{\n\t\tprintf(\"%d %d\", a * 10, b * 10 + 1);\n\t}\n\telse if (a < b)\n\t{\n\t\tif (b - a > 1)\n\t\t\tprintf(\"-1\");\n\t\telse\n\t\t\tprintf(\"%d %d\", a * 10 + 9, b * 10);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==9&&b==1)\n {\n printf(\"%d %d\",a,b*10);\n }\n else if(a-b>1||b-a>1)\n {\n printf(\"-1\");\n }\n else if(a==b){\n\n printf(\"%d %d\",a*100+12,b*100+13);\n}\nelse\n printf(\"%d %d\",a*100+99,b*100);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint d1,d2,a;\n\tscanf(\"%d%d\",&d1,&d2);\n\tif(d1==d2)\n\t{\n\t\tprintf(\"%d %d\",(d1*10),(d2*10+1));\n\t}\n\telse if((d2-d1)==1)\n\t{\n\t\ta=d2*10;\n\t\tprintf(\"%d %d\",(a-1),a);\n\t}\n\telse if((d2-d1)>1)\n\t{\n\t\tprintf(\"-1\");\n\t}\n}\n\t\t\n"}, {"source_code": "#include <stdio.h>\n\n//CODED BY SAYEM MD. NAFI\n\nint main()\n{\n int A, B;\n scanf(\"%d %d\", &A, &B);\n if(A - B == -1) printf(\"%d9 %d0\\n\", A, B);\n else if(A - B == 0) printf(\"%d4 %d5\\n\", A, B);\n else printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if((a-b)==-1)\n {\n a=a*10+9;\n b=b*10+0;\n printf(\"%lld %lld\\n\",a,b);\n }\n else if(a-b==0)\n {\n a=a*10;\n b=b*10+1;\n printf(\"%lld %lld\\n\",a,b);\n }\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n else\n { a=da*10;\n\n if (db-da==1)\n\n printf(\"%d, %d\" , a+99 , a+99+1);\n else if (db-da==0)\n printf(\"%d ,%d\" , a+1 , a+1+1);\n\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da,db;\n\tscanf(\"%d%d\",&da,&db);\n\tif(db-da>1)\n\tprintf(\"-1\");\n\tif(db-da==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"99\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n\tif(db==da)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"12\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"13\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n long int n,i,j,k;\n\n scanf(\"%ld%ld\",&i,&j);\n\n if(i==j){\n\n j=(i*10);\n printf(\"%ld %ld\",j,(j+1));\n }\n else if(i==9 && j==1){\n printf(\"9 1\");\n }\n else if((j-i)==1){\n\n printf(\"%ld %ld\",i,j);\n }\n else\n printf(\"-1\");\n\n\n\n return 0;\n}\n"}, {"source_code": "main(a, b) {\n\tscanf(\"%d%d\", &a, &b);\n\tif (a == b)\n\t\tprintf(\"%d00 %d01\", a, b);\n\telse if (a + 1 == b)\n\t\tprintf(\"%d %d\", a, b);\n\telse\n\t\tputs(\"-1\");\n}"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,m,i,p;\nscanf(\"%d %d\",&m,&p);\nif(m<p && (p-m)==1)\n{\n printf(\"%d%d %d%d\",m,9,p,0);\n}\nelse if(m==p)\n{\n printf(\"%d%d %d%d\",m,1,p,2); \n}\nelse\n{\n printf(\"%d\",-1);\n}\n return 0; \n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a==b)\n\t{\n\t\ta=a*10;\n\t\tb=a+1;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse if(a+1==b)\n\t{\n\t\ta=a*10+9;\n\t\tb=b*10;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse printf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c=0,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a==9 && b==1 && x!=3){a=a;b=10;b=10;x=1;}\n if(a>b){c=1;}\n if(b-a>=2){c=1;}\n\n if(a==b && x!=1){a=(a*10)+1;b=(b*10)+2;x=2;}\n if(c!=1 && a-b==1 && x!=2){a=(a*10); b=(b*10)+9; x=3;}\n if(c!=1 && b-a==1 && x!=3){a=(a*10)+9; b=b*10;x=4;}\n\n\n if(c==1){printf(\"-1\");}\n else printf(\"%lld %lld\",a,b);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if((a-b)==-1)\n {\n a=a*10+9;\n b=b*10+0;\n printf(\"%lld %lld\\n\",a,b);\n }\n else if(a-b==0)\n {\n a=a*10;\n b=b*10+1;\n printf(\"%lld %lld\\n\",a,b);\n }\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if((a==9 && b==1)||(a==1 && b==9))\n printf(\"9 10\");\n else if(abs(a-b)>1)\n printf(\"-1\");\n else if(abs(a-b)==0)\n printf(\"%d12 %d13\",a,b);\n else if(abs(a-b)==1)\n printf(\"%d99 %d00\",a,b);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a-b>1||b-a>1||a>b)\n {\n printf(\"-1\");\n }\n else if(a==b){\n\n printf(\"%d %d\",a*100+12,b*100+13);\n}\nelse\n printf(\"%d %d\",a*100+99,b*100);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int a,b;\n scanf(\"%i %i\",&a,&b);\n int c = b-a;\n switch ( c ){\n case 1:\n printf(\"%i9 %i0\",a,b);\n break;\n case 0:\n printf(\"%0 %i1\", a,b);\n break;\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(b==9&&a==1){printf(\"%d\",-1);return 0;}\n if(b-a>1||b-a<0){printf(\"%d\",-1);return 0;}\n if(b-a==1){printf(\"%d %d\",a*10+9,b*10);return 0;}\n if(b==a){printf(\"%d %d\",a*10+1,b*10+2);return 0;}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,t,j=0,k=0,b,c,l=0;\n char bh[100],a[100];\n scanf(\"%d%d\",&t,&b);\n \n if(t+1==b)\n {\n b=b*100;\n printf(\"%d %d\\n\",b-1,b);\n }\n else if(t==b)\n {\n b=b*100+t*(t-1);\n printf(\"%d %d\\n\",b,b+1);\n }\n else if(b-t==8 && abs(t-b)==8)\n printf(\"%d %d\\n\",999,1000);\n else\n printf(\"-1\\n\");\n /* for(i=1; i<=t; i++)\n {\n scanf(\"%d\",&c);\n \n }*/\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a, b;\n\tscanf(\"%d %d\", &a, &b);\n\tif (a == 1 && b == 9)\n\t{\n\t\tprintf(\"10 9\");\n\t\treturn 0;\n\t}\n\tif (a > b)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse if (a == b)\n\t{\n\t\tprintf(\"%d %d\", a * 10, b * 10 + 1);\n\t}\n\telse if (a < b)\n\t{\n\t\tif (b - a > 1)\n\t\t\tprintf(\"-1\");\n\t\telse\n\t\t\tprintf(\"%d %d\", a * 10 + 9, b * 10);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,m,p,temp,q;\n scanf(\"%d%d\",&a,&b);\n if(a>b)\n {\n temp=a;\n a=b;\n b=temp;\n }\n m=b-a;\n if(m>=2)\n printf(\"-1\");\n else if(m==1&&b>a)\n {\n p=(b*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m==1&&b<a)\n {\n p=(a*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m==0)\n {\n p=(a*100)+(a+b)+a;\n q=p+1;\n printf(\"%d %d\",p,q);\n\n }\n\n\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da, db;\n\t\n\tscanf(\"%d %d\", &da, &db);\n\t\n\tif(da == 9 && db == 1)\n\tprintf(\"9 10\");\n\telse if(db - da > 1 || da - db > 1)\n\tprintf(\"-1\");\n\telse if(da == db)\n\tprintf(\"%d %d\", (da*10)+1, (db*10)+2);\n\telse\n\tprintf(\"%d %d\", (da*10)+9, db*10);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a, b;\n\tscanf(\"%d%d\", &a, &b);\n\tif(a==9 && b==1) printf(\"9 10\");\n\telse if(a-b>1 || b-a>1) printf(\"-1\");\n\telse if(a-b == 1) printf(\"%d %d\", a, b);\n\telse if(b-a == 1) printf(\"%d %d\", a*10 +9, b*10);\n\telse if(a == b) printf(\"%d %d\", a*10 +1, b*10 +2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\n\n\n\n\nint main() {\n int a,b;\nscanf(\"%d%d\",&a,&b);\nif(b-a==0)\nprintf(\"%d %d\\n\",a*10,b*10+1);\nelse if(b-a==1)\nprintf(\"%d %d\\n\",a*10+9,b*10);\nelse\nprintf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n int a,b;\n sf(\"%d %d\",&a,&b);\n if(a==b)\n pf(\"%d %d\\n\",a*23,b*23+1);\n else if(a==9&&b==1)\n pf(\"%d %d\\n\",a*10,b*10+1);\n else if(a==b-1)\n pf(\"%d %d\\n\",a,b);\n else\n pf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int a,b;\n scanf(\"%i %i\",&a,&b);\n int c = a-b;\n switch (c){\n case 1:\n printf(\"%i9 %i0\",a,b);\n break;\n case 0:\n printf(\"%0 %i1\", a,b);\n break;\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{int b,a;\nscanf(\"%d%d\",&a,&b);\nif (abs(a-b)>1)\n {a=-1;\n printf(\"%d\\n\",a);}\n else if (a==b)\n {a=a*100+12;\n b=b*100+13;\n printf(\"%d %d\\n\",a,b);}\n else\n {a=a*100+99;\n b=b*100;\n printf(\"%d %d\\n\",a,b);}\n if ((a=9)&&(b=1))\n printf(\"99 100\");\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n int da;\n int db;\n scanf(\"%d\", &da);\n scanf(\"%d\", &db);\n \n if ((((da != 9 && db != 1)) || (da == 9 && da > db)) && (abs(da - db) > 1 || da > db))\n printf(\"-1\");\n else\n for (long i = 0; ; i++)\n {\n int m = i;\n // if ((i / 10 == da) && ((i + 1) / 10 == db)) { printf(\"%d %d\", i, i + 1); break; }\n if ((i > 10 && ((i / 10 == da) && ((i + 1) / 10 == db))) || (i < 10 && i == da && (i + 1) / 10 == db)) { printf(\"%d %d\", i, i + 1); break; }\n\n }\n \n}\n\n "}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da,db;\n\tscanf(\"%d%d\",&da,&db);\n\tif(db-da>1)\n\tprintf(\"-1\");\n\tif(db-da==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"99\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n else if(db==da)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"12\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"13\");\n\t}\n else if(da==9&&db==1)\n\t{\n\t\tprintf(\"%d\",&da);\n\t\tprintf(\"99\");\n\t\tprintf(\"%d\",&db);\n\t\tprintf(\"000\");\n\t}\n\telse if(da>db)\n {\n \tprintf(\"-1\");\n\t }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,s,m,q;\n scanf(\"%d%d\",&a,&b);\n s=abs(a-b);\n if(s==1&&a<b)\n {\n m=(b*100)-1;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==0 && a==b)\n {\n m=(a*100)+(a+b)+a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s==8&&a>b)\n {\n m=a;\n q=m+1;\n printf(\"%d %d\",m,q);\n }\n else if(s>=2 && s<8 )\n {\n \tprintf(\"-1\");\n\t\t\t}\n else if(s==1&&a>b)\n {\n \tprintf(\"-1\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,t,j=0,k=0,b,c,l=0;\n char bh[100],a[100];\n scanf(\"%d%d\",&t,&b);\n j=t<b?b:t;\n k=t<b?t:b;\n if(k+1==j)\n {\n j=j*100;\n printf(\"%d %d\\n\",j-1,j);\n }\n else if(k==j)\n {\n j=j*100+k*(k-1);\n printf(\"%d %d\\n\",j,j+1);\n }\n else if(j-k==8)\n printf(\"%d %d\\n\",999,1000);\n else\n printf(\"-1\\n\");\n /* for(i=1; i<=t; i++)\n {\n scanf(\"%d\",&c);\n \n }*/\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a, c;\n\tscanf(\"%d%d\", &a, &c);\n\tif(a+1 == c){\n\t\tprintf(\"%d%d %d%d\",a,9,c,0);\n\t}else if(a==c){\n\t\tprintf(\"%d%d %d%d\",a,1,c,2);\n\t}else{\n\t\tprintf(\"%d\",-1);\n\t}\n\tprintf(\"\\n\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint A(int num)\n{\n if(num >= 0)\n return num;\n else\n return (-num);\n}\n\nint main()\n{\n int d_a, d_b, a, b;\n \n scanf(\"%d%d\", &d_a, &d_b);\n \n if(A(d_a - d_b) > 1)\n printf(\"-1\");\n else if(A(d_a - d_b) == 1)\n {\n a = 10 * d_a + 9;\n b = 10 * d_b;\n \n printf(\"%d %d\", a, b);\n }\n else if(A(d_a - d_b) == 0)\n {\n a = 10 * d_a + 1;\n b = 10 * d_b + 2;\n \n printf(\"%d %d\", a, b);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b)\n {\n printf(\"%d %d\",a*100,(a*100)+1);\n }\n else if(b=a+1)\n {\n printf(\"%d %d\",a,b);\n }\n else if(a==9 && b==1)\n {\n printf(\"%d %d\",a,b);\n }\n else\n {\n printf(\"-1\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tint a,b;\n\t//Just in case\n\t//WistfulPeace_7\n\tscanf (\"%d%d\",&a,&b);\n\tif(b-a==0)\n\t\tprintf(\"%d12 %d13\\n\",a,b );\n\telse if (b-a==1)\n\t\tprintf(\"%d99 %d00\\n\",a,b);\n\telse if (b-a>1 || b-a<0)\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int da,db;\n scanf(\"%i %i\",&da,&db);\n int diff=db-da;\n switch(diff){\n case 1:\n printf(\"%i9 %i0\", da,db);\n case 0:\n printf(\"%i0 %i1\", da ,db);\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n \n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint A(int num)\n{\n if(num >= 0)\n return num;\n else\n return (-num);\n}\n\nint main()\n{\n int d_a, d_b, a, b;\n \n scanf(\"%d%d\", &d_a, &d_b);\n \n if(A(d_a - d_b) > 1)\n {\n if(A(d_a - d_b) == 8)\n {\n if(d_a == 9)\n {\n a = 9;\n b = 10 * d_b;\n \n printf(\"%d %d\", a, b);\n }\n else\n printf(\"-1\");\n }\n else\n printf(\"-1\");\n }\n else if(A(d_a - d_b) == 1)\n {\n a = 10 * d_a + 9;\n b = 10 * d_b;\n \n printf(\"%d %d\", a, b);\n }\n else if(A(d_a - d_b) == 0)\n {\n a = 10 * d_a + 1;\n b = 10 * d_b + 2;\n \n printf(\"%d %d\", a, b);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d\",&a,&b);\n c=abs(a-b);\n if(c>1)\n printf(\"-1\");\n else if(c==1){\n a=b*100;\n a=a-1;\n printf(\"%d %d\",a,a+1);\n }\n else {\n a=a*100;\n printf(\"%d %d\",a,a+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int da,db;\n scanf(\"%i %i\",&da,&db);\n int diff=db-da;\n switch(diff){\n case 1:\n printf(\"%i9 %i0\", da,db);\n case 0:\n printf(\"%i0 %i1\", da ,db);\n case -8:\n printf(\"9 10\");\n break;\n default:\n printf(\"-1\");\n break;\n \n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\nint x,y,z;\nscanf(\"%d %d\", &x, &y);\n\nif(x==y)\n{\n x=x*100+12;\n y=x+1;\n printf(\"%d %d\", x,y);\n}else if(x+1==y)\n{\n z = x*100+99;\n y = z+x;\n printf(\"%d %d\", z,y);\n}else if(x==9 && y==1)\n{\n x = x *100 + 99;\n y = x+1;\n printf(\"%d %d\", x,y);\n}else printf(\"-1\");\n\n\n return 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c=0,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a>b){c=1;}\n if(b-a>=2){c=1;}\n if(a==b){a=(a*10)+1;b=(b*10)+2;}\n if(c!=1 && a-b==1){a=(a*10); b=(b*10)+9; x=1;}\n if(c!=1 && b-a==1 && x!=1){a=(a*10)+9; b=b*10;}\n\n if(c==1){printf(\"-1\");}\n else printf(\"%lld %lld\",a,b);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da, db;\n\t\n\tscanf(\"%d %d\", &da, &db);\n\t\n\tif(da == 9 && db == 1)\n\tprintf(\"9 10\");\n\telse if(db - da > 1 || da - db > 1)\n\tprintf(\"-1\");\n\telse if(da == db)\n\tprintf(\"%d %d\", (da*10)+1, (db*10)+2);\n\telse\n\tprintf(\"%d %d\", (da*10)+9, db*10);\n\t\n\treturn 0;\n}"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a==9 && b==1){a=a;b=10;x=1;}\n if(a>b){c=1;}\n if(b-a>=2){c=1;}\n if(a==b && x!=1){a=a*10;b=(b*10)+1;x=2;}\n if(c!=1 && a-b==1 && x!=2 & x!=1){a=(a*10); b=(b*10)+9; x=3;}\n if(c!=1 && b-a==1 && x!=3 && x!=2 && x!=1){a=(a*10)+9; b=b*10;}\n\n\n if(c!=1) {printf(\"%lld %lld\",a,b);}\n else {printf(\"-1\");}\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,a,b,m,p,temp,q;\n scanf(\"%d%d\",&a,&b);\n\n m=abs(a-b);\n if(m==1&&a<b)\n {\n p=(b*100)-1;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(m==0&&a==b)\n {\n p=(a*100)+(a+b)+a;\n q=p+1;\n printf(\"%d %d\",p,q);\n\n }\n else if(m==8&&a>b)\n {\n p=a;\n q=p+1;\n printf(\"%d %d\",p,q);\n }\n else if(a>b)\n printf(\"-1\");\n\n\n }\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a,x,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n else\n {\n\n a=da*10;\n b=db*10;\n x=abs(a-b+1);\n printf(\"%d,%d\",a+x,a+x+1);\n }\n\n\n}"}, {"source_code": "\n #include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c=0,d,x;\n scanf(\"%lld%lld\",&a,&b);\n\n if(a==9 && b==1 && x!=3){a=a;b=10;b=10;x=1;}\n if(a>b){c=1;}\n if(b-a>=2){c=1;}\n\n if(a==b && x!=1){a=(a*10)+1;b=(b*10)+2;x=2;}\n if(c!=1 && a-b==1 && x!=2){a=(a*10); b=(b*10)+9; x=3;}\n if(c!=1 && b-a==1 && x!=3){a=(a*10)+9; b=b*10;x=4;}\n\n\n if(c==1){printf(\"-1\");}\n else printf(\"%lld %lld\",a,b);\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d\",&a,&b);\n c=abs(a-b);\n if(c>1)\n printf(\"-1\");\n else if(c==1){\n a=b*100;\n a=a-1;\n printf(\"%d %d\",a,a+1);\n }\n else {\n a=a*100;\n printf(\"%d %d\",a,a+1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(a==b){\n \n printf(\"%d00 %d01\\n\",a,b);\n }\n else if(a<b){\n if(b-a>=2)\n printf(\"-1\\n\");\n else\n printf(\"%d99 %d00\\n\",a,b);\n }\n else{\n printf(\"-1\\n\");\n }\n \n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a==b)\n\t{\n\t\ta=a*10;\n\t\tb=a+1;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse if(a+1==b)\n\t{\n\t\ta=a*10+9;\n\t\tb=b*10;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse printf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int da , db ,a,x,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n if ((abs(db-da)>=2)||(da>db))\n printf(\"-1\") ;\n else\n {\n a=da*10;\n b=db*10;\n x=abs(a-b+1);\n printf(\"%d,%d\",a+x,a+x+1);\n }\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) \n{\n\tint a,b;\n\tscanf(\"%d %d\", &a, &b);\n\tif(b-a==-8)\n\t{\n\t\tb=10;\n\t}\n\telse if(b==a)\n\t{\n\t\ta=a*10+1;\n\t\tb=b*10+2;\n\t}\n\telse if(abs(b-a)>=2)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tprintf(\"%d %d\", a,b);\n \n\treturn 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint da,db;\n\tscanf(\"%d%d\",&da,&db);\n\tif(db-da>1)\n\tprintf(\"-1\");\n\tif(db-da==1)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"99\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"00\");\n\t}\n else if(db==da)\n\t{\n\t\tprintf(\"%d\",da);\n\t\tprintf(\"12\\t\");\n\t\tprintf(\"%d\",db);\n\t\tprintf(\"13\");\n\t}\n else if(da==9&&db==1)\n\t{\n\t\tprintf(\"%d\",&da);\n\t\tprintf(\"99\");\n\t\tprintf(\"%d\",&db);\n\t\tprintf(\"000\");\n\t}\n\telse if(da>db)\n {\n \tprintf(\"-1\");\n\t }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int da,db,a,b,res,i,j,sub;\n scanf(\"%d%d\",&da,&db);\n sub=db-da;\n if(sub>1||sub<0||da>db){\n printf(\"-1\\n\");\n }\n else if(sub==0){\n a=da*100;\n b=a+1;\n printf(\"%d %d\\n\",a,b);\n }\n else if(sub==1){\n b=db*100;\n a=b-1;\n printf(\"%d %d\\n\",a,b);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a==b||b-a==1){\n\t\tif(a==b){\n\t\t\tprintf(\"%d1 %d2\",a,b);\n\t\t}else{\n\t\t\tprintf(\"%d9 %d0\",a,b);\n\t\t}\n\t}else{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a==b)\n\t{\n\t\ta=a*10;\n\t\tb=a+1;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse if(a+1==b)\n\t{\n\t\ta=a*10+9;\n\t\tb=b*10;\n\t\tprintf(\"%d %d\\n\",a,b);\n\t}\n\telse printf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main()\n{\n int da , db ,a,x,b;\n scanf(\"%d\",&da) ;\n scanf(\"%d\",&db) ;\n\n if ((abs(db-da)>=2)||(da>db ) )\n printf(\"-1\") ;\n\n else\n {\n a=da*10;\n b=db*10;\n x=abs(a-b+1);\n printf(\"%d %d\",a+x,a+x+1);\n }\n\n\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint modul(int x){\n if(x<0)\n return -x;\n return x;\n}\nint main(){\n int a, b;\n scanf(\"%d%d\", &a, &b);\n if(a+1==b)\n printf(\"%d %d\", a, b);\n else if(a==b)\n printf(\"%d0 %d1\", a, b);\n else\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a>b||(b-a)>1)\n printf(\"-1\");\n else if(b-a==1)\n printf(\"%d %d\",((a*10)+9),((b*10)));\n else\n printf(\"%d %d\",((a*10)),((b*10)+1));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,diff;\n scanf(\"%d %d\",&a,&b);\n if(a>=b)\n diff=a-b;\n else diff=b-a;\n if(diff>1&&diff!=8)\n printf(\"-1\\n\");\n else if(diff==0)\n printf(\"%d %d\\n\",100*a,100*a+1);\n else if(diff==1)\n {\n if(a<b)\n printf(\"%d %d\\n\",100*a+99,100*b);\n else\n printf(\"%d %d\\n\",100*b+99,100*a);\n }\n else if(diff==8&&b<a)\n printf(\"9 10\\n\");\n else if(diff==8&&b>a)\n printf(\"-1\\n\");\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b;\n scanf(\"%d %d\",&a,&b);\n if(b==9&&a==1){printf(\"%d\",-1);return 0;}\n if(b-a>1||b-a<0){printf(\"%d\",-1);return 0;}\n if(b-a==1){printf(\"%d %d\",a*10+9,b*10);return 0;}\n if(b==a){printf(\"%d %d\",a*10+1,b*10+2);return 0;}\n return 0;\n}"}], "src_uid": "3eff6f044c028146bea5f0dfd2870d23"} {"nl": {"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_spec": "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_spec": "Output a single integer\u00a0\u2014 the number of distinct integers which can be represented using $$$n$$$ roman digits exactly.", "sample_inputs": ["1", "2", "10"], "sample_outputs": ["4", "10", "244"], "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)."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main()\n{\n\tlong long int n;\n\n\tscanf(\"%I64d\", &n);\n\n\n\tlong long int a[] = { 0,4,10,20,35,56,83,116,155,198,244,292 };\n\n\tif (n < 12)\n\t\tprintf(\"%d\", a[n]);\n\telse\n\t\tprintf(\"%I64d\", a[11] + (n - 11) * 49);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\n/*\n1\t5*9=1*5+10*4\t5->1,10\n2\t5*1+10*5=1*5+50*1\t5,10->1,50\n3\t10*49=1*40+50*9\t10->1,50\n--\n5*x+50*y=1*(x+y-z)+10*z\n4*x+49*y=9z\n\u00f6\ufffd\ufffdy\ufffd\ufffd\ufffd\u00f3\ufffd\n4\t1*35+5*1+50*8=10*44\t1,5,50->10\n5\t1*30+5*2+50*7=10*35\t1,5,50->10\n6\t1*25+5*3+50*6=10*34\t1,5,50->10\n7\t1*20+5*4+50*5=10*29\t1,5,50->10\n8\t1*15+5*5+50*4=10*24\t1,5,50->10\n9\t1*10+5*6+50*3=10*19\t1,5,50->10\n10\t1*5+5*7+50*2=10*14\t1,5,50->10\n11\t1*0+5*8+50*1=10*9\t5,50->10\n--\n1,5,10,50\u0221n\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd1\u02bd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd5\u02210~8\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,10,50\u0221\n\ufffd\ufffd\ufffd\ufffd2\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\u03bb\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~4\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd3\u02bd\ufffd\ufffd\ufffd\ufffd5\u02210\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~48\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd4\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd1\u022135\ufffd\u03bb\ufffd50\u02218\ufffd\u03bc\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd5\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd1\u022130\ufffd\u03bb\ufffd50\u02217\ufffd\u03bc\ufffd\ufffd\ufffd\n...\n\ufffd\ufffd\ufffd\ufffd11\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd1\u02210\ufffd\u03bb\ufffd50\u02211\ufffd\u03bc\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\u03e3\ufffd\ufffd\ufffd\ufffd\ufffd5\u02210\ufffd\u03a3\ufffd10\u02210~48\ufffd\ufffd\n5\u02211\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd1\u02210~34\ufffd\u03bb\ufffd50\u02210~7\ufffd\ufffd\n5\u02212\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd1\u02210~29\ufffd\u03bb\ufffd50\u02210~6\ufffd\ufffd\n...\n5\u02218\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd1\u02210\ufffd\u03bb\ufffd50\u02210~1\ufffd\u03b5\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1,50\u0221n\ufffd\u03a3\ufffd\ufffd\ufffdn+1\ufffd\u05bd\ufffd\ufffd\n--\n5*49=1*45+50*4\t5->1,50\n5*10+10*1=1*10+50*1\t5,10->1,50\n5*17+50*1=1*5+10*13\t5,50->1,10\n5*19=1*15+10*3+50*1\t5->1,10,50\n*/\nint n;\nvoid run(){\n\tint i,j,k;\n\tlong long r;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tr=0;\n\t\tfor(i=0;i<=n&&i<49;i++){\n\t\t\tr+=n-i+1;\n\t\t}\n\t\tfor(i=1;i<=n&&i<9;i++){\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tfor(k=0;i+j+k<=n&&k<(9-i-1)*5;k++){\n\t\t\t\t\tr++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tfor(k=0;i+j+k<=n&&k<9-i;k++){\n\t\t\t\t\tif(n-(i+j+k)>=(9-i-1)*5){\n\t\t\t\t\t\tr++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4932d_min.in\",\"rb\",stdin);\n\tfreopen(\"4932d_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\n#define Max(X,Y) ((X)>(Y) ? (X) : (Y))\n#define Min(X,Y) ((X)<(Y) ? (X) : (Y))\n#define MOD 998244353\n#define N 300005\nlong long a[12]={0,4,10,20,35,56,83,116,155,198,244,292},n;\n\nint main()\n{\n\tscanf(\"%lld\",&n);\n\tif (n<=11) printf(\"%lld\\n\",a[n]); \n\telse printf(\"%lld\\n\",a[11]+49*(n-11));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\nint main()\n{\n\tll n,res;\n\tll a[13]={0,4,10,20,35,56,83,116,155,198,244,292,341};\n\tscanf(\"%I64d\",&n);\n\tif(n<13)\n\t\tres=a[n];\n\telse\n\t\tres=341+49*(n-12);\n\tprintf(\"%I64d\",res);\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\n\tint a[] = { 0,4,10,20,35,56,83,116,155,198,244,292 };\n\n\tif (n < 12)\n\t\tprintf(\"%d\", a[n]);\n\telse\n\t\tprintf(\"%d\", a[11] + (n - 11) * 49);\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\n/*\n1\t5*9=1*5+10*4\n--5*49=1*45+50*4\n2\t10*49=1*40+50*9\n3\t5*1+10*5=1*5+50*1\n1*x+50*y=5*z+10*(x+y-z)\n1*x+50*y+5z=10*(x+y)\n40*y+5z=9*x\n1,5,10,50\u0221n\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd1\u02bd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd5\u02210~8\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,10,50\u0221\n\ufffd\ufffd\ufffd\ufffd2\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\u03bb\ufffd1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~4\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd3\u02bd\ufffd\ufffd\ufffd\ufffd5\u02210\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~48\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\u03e3\ufffd\ufffd\ufffd\ufffd\ufffd5\u02211~8\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03ba\ufffd5\u02210\ufffd\u03a3\ufffd10\u02210~48\ufffd\u03b5\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1,50\u0221n\ufffd\u03a3\ufffd\ufffd\ufffdn+1\ufffd\ufffd\u05b5\n4\t5*8+50*1=10*9\n\ufffd\u067f\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n*/\nint n;\nvoid run(){\n\tint i,j;\n\tlong long r;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tr=0;\n\t\tfor(i=1;i<=n&&i<8;i++){\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tr+=n-(i+j)+1;\n\t\t\t}\n\t\t}\n\t\tfor(i=8;i<=n&&i<=8;i++){\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<=n&&i<49;i++){\n\t\t\tr+=n-i+1;\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4932d_min.in\",\"rb\",stdin);\n\tfreopen(\"4932d_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\n/*\n1\t5*9=1*5+10*4\n--5*49=1*45+50*4\n2\t10*49=1*40+50*9\n3\t5*1+10*5=1*5+50*1\n1*x+50*y=5*z+10*(x+y-z)\n1*x+50*y+5z=10*(x+y)\n40*y+5z=9*x\n4\t5*8+50*1=10*9\n5\t1*5+5*7+50*2=10*14\n1,5,10,50\u0221n\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd1\u02bd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd5\u02210~8\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,10,50\u0221\n\ufffd\ufffd\ufffd\ufffd2\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\u03bb\ufffd1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~4\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd3\u02bd\ufffd\ufffd\ufffd\ufffd5\u02210\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~48\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd4\u02bd\ufffd\ufffd\ufffd\ufffd5\u02218\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd50\u02210\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,10\u0221\n\ufffd\ufffd\ufffd\ufffd5\u02bd\ufffd\ufffd\ufffd\ufffd5\u02217\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd1\u02210~4\ufffd\u03bb\ufffd50\u02210~1\ufffd\u03bc\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\u03e3\ufffd\ufffd\ufffd\ufffd\ufffd5\u02211~6\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a1\ufffd5\u02210\ufffd\u03a3\ufffd10\u02210~48\ufffd\u03a1\ufffd5\u02218\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd50\u02210\ufffd\u03a1\ufffd5\u02217\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd1\u02210~4\ufffd\u03a1\ufffd5\u02217\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03a3\ufffd50\u02210~1\ufffd\u03b5\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1,50\u0221n\ufffd\u03a3\ufffd\ufffd\ufffdn+1\ufffd\ufffd\u05b5\n*/\nint n;\nvoid run(){\n\tint i,j,k,l;\n\tlong long r;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tr=0;\n\t\tfor(i=1;i<=n&&i<7;i++){\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tr+=n-(i+j)+1;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<=n&&i<49;i++){\n\t\t\tr+=n-i+1;\n\t\t}\n\t\tfor(i=8,j=0;i+j<=n&&j<5;j++){\n\t\t\tr++;\n\t\t}\n\t\tfor(i=7,j=0;i+j<=n&&j<5;j++){\n\t\t\tfor(k=0;i+j+k<=n&&k<5;k++){\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t\tfor(i=7,j=0;i+j<=n&&j<5;j++){\n\t\t\tfor(k=0;i+j+k<=n&&k<2;k++){\n\t\t\t\tif(n-(i+j+k)>=5){\n\t\t\t\t\tr++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4932d_min.in\",\"rb\",stdin);\n\tfreopen(\"4932d_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\n/*\n1\t5*9=1*5+10*4\n--5*49=1*45+50*4\n2\t10*49=1*40+50*9\n3\t5*1+10*5=1*5+50*1\n1*x+50*y=5*z+10*(x+y-z)\n1*x+50*y+5z=10*(x+y)\n40*y+5z=9*x\n1,5,10,50\u0221n\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd1\u02bd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd5\u02210~8\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,10,50\u0221\n\ufffd\ufffd\ufffd\ufffd2\u02bd\ufffd\ufffd\ufffd\ufffd5\u02211\ufffd\u03bb\ufffd1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~4\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\ufffd3\u02bd\ufffd\ufffd\ufffd\ufffd5\u02210\ufffd\ufffd\u02b1\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd10\u02210~49\ufffd\u03bc\ufffd\ufffd\u0263\ufffd\u02a3\ufffd\u00b5\u0134\ufffd1,50\u0221\n\ufffd\ufffd\ufffd\u03e3\ufffd\ufffd\ufffd\ufffd\ufffd5\u02211~8\ufffd\u03a3\ufffd10\u02210~4\ufffd\u03ba\ufffd5\u02210\ufffd\u03a3\ufffd10\u02210~49\ufffd\u03b5\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n1,50\u0221n\ufffd\u03a3\ufffd\ufffd\ufffdn+1\ufffd\ufffd\u05b5\n4\t5*8+50*1=10*9\n\ufffd\u067f\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n*/\nint n;\nvoid run(){\n\tint i,j;\n\tlong long r;\n\twhile(scanf(\"%d\",&n)!=EOF){\n\t\tr=0;\n\t\tfor(i=1;i<=n&&i<8;i++){\n\t\t\tfor(j=0;i+j<=n&&j<5;j++){\n\t\t\t\tr+=n-(i+j)+1;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<=n&&i<49;i++){\n\t\t\tr+=n-i+1;\n\t\t}\n\t\tif(n>=8){\n\t\t\tr+=(n-8)+1;\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4932d_min.in\",\"rb\",stdin);\n\tfreopen(\"4932d_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\n#define Max(X,Y) ((X)>(Y) ? (X) : (Y))\n#define Min(X,Y) ((X)<(Y) ? (X) : (Y))\n#define MOD 998244353\n#define N 300005\nlong long a[12]={0,4,10,20,35,56,83,116,155,198,244,292};\nint n;\n\nint main()\n{\n\tscanf(\"%d\",&n);\n\tif (n<=11) printf(\"%lld\\n\",a[n]); \n\telse printf(\"%lld\\n\",(long long) a[11]+49*(n-11));\n\treturn 0;\n}\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\n#define Max(X,Y) ((X)>(Y) ? (X) : (Y))\n#define Min(X,Y) ((X)<(Y) ? (X) : (Y))\n#define MOD 998244353\n#define N 300005\nlong long a[12]={0,4,10,20,35,56,83,116,155,198,244,292};\nint n;\n\nint main()\n{\n\tscanf(\"%d\",&n);\n\tif (n<=11) printf(\"%lld\\n\",a[n]); \n\telse printf(\"%lld\\n\",a[11]+49*(n-11));\n\treturn 0;\n}\n"}], "src_uid": "75ec99318736a8a1b62a8d51efd95355"} {"nl": {"description": "One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump. Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability. The picture corresponds to the first example. The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.", "input_spec": "The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100. ", "output_spec": "Print single integer a\u00a0\u2014 the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.", "sample_inputs": ["ABABBBACFEYUKOTT", "AAA"], "sample_outputs": ["4", "1"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n int i,j,m=0,p,count[100],temp;\n gets(s);\n s[strlen(s)]='*';\n for(i=0;i<=strlen(s);i++)\n {\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y'||s[i]=='*')\n {\n count[m]=i+1-p;\n p=i+1;\n m++;\n }\n }\n for(i=1;i<m;i++)\n for(j=0;j<m-i;j++)\n if(count[j]<count[j+1])\n {\n temp=count[j];\n count[j]=count[j+1];\n count[j+1]=temp;\n }\n printf(\"%d\",count[0]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n char s[105];\n int i,k=0,d=0,len;\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++){\n if(!(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' ||s [i]=='U' || s[i]=='Y')){\n k++;\n if(d<k) d=k;\n }\n else k=0; }\n printf(\"%d\\n\",d+1);\n return 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{\n char a[105];\n while (~scanf(\"%s\",a))\n {\n int ma=0;\n int temp=0;\n for(int i=0; i<strlen(a); i++)\n {\n temp++;\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n if(temp>ma)\n ma=temp;\n temp=0;\n }\n }\n// printf(\"%d\\n\",temp);\n if(temp+1>ma)\n ma=temp+1;\n printf(\"%d\\n\",ma);\n memset(a,'\\0',sizeof(a));\n }\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{\n char a[105];\n while (~scanf(\"%s\",a))\n {\n int ma=0;\n int temp=0;\n for(int i=0; i<strlen(a); i++)\n {\n temp++;\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n if(temp>ma)\n ma=temp;\n temp=0;\n }\n }\n// printf(\"%d\\n\",temp);\n if(temp+1>ma)\n ma=temp+1;\n printf(\"%d\\n\",ma);\n memset(a,'\\0',sizeof(a));\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,l,k=1,g=1;\n char S[101];\n gets(S);\n l=strlen(S);\n for(i=0;i<l;i++)\n {\n if(S[i]!='A'&&S[i]!='E'&&S[i]!='I'&&S[i]!='O'&&S[i]!='U'&&S[i]!='Y')\n {\n k++;\n if(k>g)\n {\n g=k;\n }\n }\n else\n {\n k=1;\n }\n }\n printf(\"%d\\n\",g);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n#define max(x,y) (x>y?x:y)\n\nint a[10];\nvoid Input()\n{\n a['A']=1;\n a['E']=1;\n a['I']=1;\n a['O']=1;\n a['U']=1;\n a['Y']=1;\n}\n\nint main()\n{\n Input();\n char b[110];\n while(~scanf(\"%s\",b))\n {\n int i,sum=0,val=-1;\n for(i=0; b[i]!='\\0'; i++)\n {\n if(a[b[i]]==1)\n {\n sum=max(sum,i-val);\n val=i;\n }\n if(b[i+1]=='\\0')\n sum=max(sum,i-val+1);\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int counter=-1,help=-1, last=-1, check=0, hello=0;\n char str[101];\n scanf(\"%s\",str);\n for(int i=0; i<strlen(str); i++)\n {\n if(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y')\n {\n help=i;\n if(help-counter > last)\n {\n last=help-counter; counter=i;\n\n }\n else counter=i;\n check++; hello=i;\n }\n else if(i==strlen(str)-1 && (strlen(str)+1)-counter>last)\n {last=strlen(str)+-counter;}\n }\n if(check==1 && last<2) printf(\"%d\", (strlen(str)-hello));\n else if(last==-1) printf(\"%d\", strlen(str)+1);\n else printf(\"%d\", last);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nmain()\n{ int i,n,k=1,m=1,max=0;\nchar a[100];\n\n scanf(\"%s\",&a);\n n=strlen(a);\n for(i=0;i<n;)\n {if(a[i]=='A'||a[i]=='I'||a[i]=='O'||a[i]=='E'||a[i]=='U'||a[i]=='Y')\n {\n i=i+1;\n k=1;\n while(a[i]!='A'&&a[i]!='I'&&a[i]!='O'&&a[i]!='E'&&a[i]!='U'&&a[i]!='Y'&&i<n)\n {k++;\n i++;\n }if(k>max)\n max=k;\n }\n else\n {m++;\n i++;}}\n if(max>m)\n printf(\"%d\",max);\n else\n printf(\"%d\",m);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char a[1000];\n int i,j,la,h,t;\n t=0;\n h=-1;\n gets(a);\n la=strlen(a);\n for (i=0;i<la;i++)\n if ( a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y')\n {\n if (i-h>t) t=i-h;\n h=i;\n }\n if (la-h>t) t=la-h;\n printf(\"%d\\n\",t);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main(void) {\n\t\n\tchar s[100];\n\tscanf(\"%s\", s);\n\t\n\tint i, jump=1, j=strlen(s), flag=0;\n\tfor(i=strlen(s)-1; i>=0; i--) {\n\t\tif(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y') {\n\t\t\tflag++;\n\t\t\tif((j-i)>jump) {jump =(j-i);}\n\t\t\tj=i;\n\t\t} \n\t}\n\tif((flag==0)||(s[0]!='A' && s[0]!='E' && s[0]!='I' && s[0]!='O' && s[0]!='U' && s[0]!='Y' && (j+1)>jump)){ \n\t\tprintf(\"%d\", j+1); \n\t\t}\n\telse { printf(\"%d\", jump); }\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint max(int a, int b)\n{\n\tint c;\n\tif(a>b)\n\tc=a;\n\telse\n\tc=b;\n//\tprintf(\"%d %d %d\\n\",a,b,c);\n\treturn c;\n}\n\nint main()\n{\n\tint i,k,r,m=0,n,b[1009]={0},c[1009]={0};\n\tchar a[1009];\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tint j=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='A' || a[i]=='E' || a[i]=='O' || a[i]=='I'|| a[i]=='U' || a[i]=='Y')\n\t\t{\n\t\t\tm=1;\n\t\t\tb[j]=i+1;\n\t\t\tj++;\n\t\t}\n\t}\n\t\tint ca=-1;\n\t\tfor(i=1;i<j;i++)\n\t\t{\n\t\t\tc[i]=b[i]-b[i-1];\n\t\t}\n\t\tc[j]=n-b[j-1]+1;\n\t\tc[0]=b[0]++;\n\t\tfor(i=0;i<=j;i++)\n\t\t{\n\t\t\tca=max(ca,c[i]);\n\t\t}\n\t\tif(m==1)\n\t\tprintf(\"%d\\n\",ca);\t\t\n\t\telse\n\t\tprintf(\"%d\\n\",n+1);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint is_vowels(char carac);\n\n\n\nint main(int argc, char const *argv[])\n{\n\tchar s[100];\n\tint i = 0,long_saut=0,max_saut=0;\n\tscanf(\"%s\",s);\n\tfor (; i < strlen(s); ++i)\n\t{\n\t\tlong_saut++;\n\t\tif (is_vowels(s[i]))\n\t\t{\n\t\t\tif (max_saut < long_saut) max_saut = long_saut;\n\t\t\tlong_saut = 0;\n\t\t}\n\t}\n\tlong_saut++;\n\tif (max_saut < long_saut) max_saut = long_saut;\n\t\n\tprintf(\"%d\\n\", max_saut);\n}\nint is_vowels(char carac)\n{\n\tif (carac == 'A' || carac == 'E' || carac == 'I' ||\n\t\tcarac == 'O' || carac == 'U' || carac == 'Y' )\n\treturn 1 ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nmain()\n{\n int l=-1,r,dis=0,max=0,i;\n char al[200];\n gets(al);\n al[strlen(al)]='A';\n for(i=0;i<=strlen(al);i++)\n {\n if(al[i]=='A'||al[i]=='E'||al[i]=='O'||al[i]=='U'||al[i]=='I'||al[i]=='Y')\n {\n dis=(i-l);\n l=i;\n }\n if(dis>max)max=dis;\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[101];\n scanf(\"%s\",a);\n int l=strlen(a),i,c[100],k=0,max=1,d=1,p=0;\n for(i=0;i<l;i++)\n {\n if(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y')\n {\n c[k]=i+1;\n if(k==0)\n d=c[k];\n if(k>=1)\n d=c[k]-c[k-1];\n if(d>max)\n max=d;\n k++;\n }\n else\n p++;\n if(i==l-1)\n d=(i+1)-c[k-1]+1;\n if(d>max)\n max=d;\n }\n if(p==l)\n printf(\"%d\",p+1);\n else\n printf(\"%d\",max);\n return 0;\n}\n//ABABBBACFEYUKOTT\n//CFHFPTGMOKXVLJJZJDQW\n//ABBABBB\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar vowels[] = \"AEIOUY\\n\";\n\nint current, max, c;\n\nint main(void) {\n while (c = getchar(), c != EOF) {\n ++current;\n if (current > max) max = current;\n if (strchr(vowels, c)) current = 0;\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,idx=1,p[100],d[100],min,index,temp;\n char a[101];\n scanf(\"%s\",a);\n\n p[0]=-1;\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n p[idx++]=i;\n }\n p[idx]=strlen(a);\n\n for(i=0;i<idx;i++)\n d[i]=p[i+1]-p[i];\n\n for(i=0;i<idx-1;i++)\n {\n min=d[i];\n index=i;\n for(j=i+1;j<idx;j++)\n {\n if(d[j]<min)\n {\n min=d[j];\n index=j;\n }\n }\n temp=d[i];\n d[i]=min;\n d[index]=temp;\n }\n\n /*for(i=0;i<idx-1;i++)\n {\n for(j=0;j<idx-i-1;j++)\n if(d[j+1]<d[j])\n {\n temp=d[j];\n d[j]=d[j+1];\n d[j+1]=temp;\n }\n }*/\n\n printf(\"%d\",d[idx-1]);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n,j,i,max=0;\n\tchar str[101],st[102];\n\t\n\tst[0]='1';\n\t\n\tgets(str);\n\t\n\tstrcat(st,str);\n\n\t\n\tn=strlen(st);\n\t\n\tst[n]='2';\n\t\n\tst[n+1]='\\0';\n\tn=strlen(st);\n//\tputs(st);\n\t\n\tj=0;\n\t\n\tfor(i=0;i<n;i++){\n\t\tj++;\n\t\t\n\t\tif(st[i]=='1' || st[i]=='2' || st[i]=='A' || st[i]=='E' || st[i]== 'I' || st[i]== 'O' || st[i]== 'U'|| st[i]=='Y'){\n\t\t\t\n\t\t\tif(j>max){\n\t\t\t\tmax=j;\n\t\t\t}\n\t\t\tj=0;\n\t\t}\n\t\t\n\t}\n\t\n//\tputs(st);\n//\tprintf(\"%d\\n\",strlen(st));\n\tprintf(\"%d\\n\",max);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <Stdio.h>\n#include <string.h>\n\nint main() {\n\tchar str[100];\n\tscanf(\"%s\",str);\n\tint len=strlen(str);\n\tint ans=0;\n\tint i;\n\tint d;\n\tint current=-1;\n\tfor(i=0;i<len;i++){\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y'){\n\t\t\td=i-current;\n\t\t\tif(d>ans){\n\t\t\t\tans=d;\n\t\t\t}\n\t\t\tcurrent=i;\n\t\t}\n\t}\n\tif(len-current>ans){\n\t\tans=len-current;\n\t}\n\tprintf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tint i ,j=0 ,l,k,tr[1000],c=0,max;\n\tchar ar[10005],yr[1050];\n\tgets(ar);\n\tyr[0]='S';\n\tfor(i=0;ar[i]!='\\0';i++)\n\t{\n\t\tyr[i+1]=ar[i];\n\t}\n\tyr[strlen(ar)+1]='/';\n\tyr[strlen(ar)+2]='\\0';\n\n\t//puts(yr);\n\tfor(i=0;yr[i]!=0;i++)\n\t{\n\t\t\n\t\tif(yr[i]=='A'||yr[i]=='O'||yr[i]=='Y'||yr[i]=='I'||yr[i]=='E'||yr[i]=='U'||yr[i]=='/')\n\t\t{\n\t\t\ttr[j]=c;\n\t\t\t//printf(\"%d\\n\",tr[j] );\n\t\t\tc=0;\n\t\t\tj++;\n\n\t\t}\n\t\tc++;\n\t}\n\tmax=tr[0];\n\tfor(i=0;i<j;i++)\n\t{\n\t\tif(max<tr[i])\n\t\t\tmax=tr[i];\n\t}\n\tif(max==0)\n\t\tprintf(\"%d\\n\",c-1 );\n\telse\n\tprintf(\"%d\\n\",max );\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[101];\n\tscanf(\"%s\",str);\n\tint pr=0,curr=0;\n\tint i,max=0;\n\n\tfor(i=0;i<strlen(str);i++)\n\t{\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t{\n\t\t\tcurr=i+1;\n\t\t}\n\t\telse if(i==strlen(str)-1)curr=i+2;\n\tif(curr-pr>max)max=curr-pr;\n\n\tpr=curr;\n\t}\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define max(a,b) a>b? a: b\nint main()\n{\n\tint i, cnt=0,m=0,n;\n\tchar s[200];\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\t{\n\t\t\tm = max(m,cnt);\n\t\t\tcnt=0;\n\t\t}\n\t\telse\n\t\t\tcnt++;\n\t}\n\tm = max(m,cnt);\n\tprintf(\"%d\\n\", m+1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tchar string[100], c;\n\tint i =0, ja = 0, max = 0, aux = -1;\n\n\tscanf(\"%s\", string);\n\twhile(string[i] != '\\0'){\n\t\tc = string[i];\n\t\tif(c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y'){\n\t\t\taux = i;\n\t\t\tja++;\n\t\t\tif(ja > max) max = ja;\n\t\t\tja = 0;\n\t\t}\n\t\telse ja++;\n\n\t\ti++;\n\t}\n\tif(c != 'A' || c != 'E' || c != 'I' || c != 'O' || c != 'U' || c != 'Y'){\n\t\tif( aux != -1 && (i - aux) > max) max = (i - aux); \n\t}\n\tif(max == 0) max = i + 1;\n\tprintf(\"%d\\n\", max);\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define N 105\n\nint main()\n{\n char A[N], q;\n int i = 1, j = 0, p, k = 0, m = 0, n;\n scanf(\"%s\", A);\n p = strlen(A) ;\n char B[N];\n for(n = 0; n < p; n++)\n B[n + 1] = A[n];\n for(i = 1 ; i <= p; i++)\n {\n\nq = B[i];\n if(q == 'A' || q == 'I' || q == 'E' || q == 'O' || q == 'U' || q == 'Y' )\n {\n j = i - m;\n m = i;\n\n if(j>k)\n k=j;\n }\n}\n if(p+1-m>k)\n k=(p+1-m);\nprintf(\"%d\\n\", k);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,count=0,r,q,t=0,flag,m=0,p=1;\n char ch[101];\n gets(ch);\n for(i=0;i<strlen(ch);i++)\n {\n count++;\n flag=1;\n if(ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U'||ch[i]=='Y')\n {\n count=0;\n flag=0;\n m++;\n }\n\n // if(i==strlen(ch)||i==0){count++;}\n //if(i==0||(ch[1]=='A'||ch[1]=='E'||ch[1]=='I'||ch[1]=='O'||ch[1]=='U'||ch[1]=='Y')&&strlen(ch)>=1){count--;}\n //printf(\"%d %d\\n\",p++,count);\n if(i==0) {r=count;\n q=r;}\n if(q<count){q=count;}\n\n\n\n }\n\n //if (strlen(ch)==1&&(ch[0]=='A'||ch[0]=='E'||ch[0]=='I'||ch[0]=='O'||ch[0]=='U'||ch[0]=='Y') )printf(\" %d\\n\",1);\n\n //if((ch[0]=='A'||ch[0]=='E'||ch[0]=='I'||ch[0]=='O'||ch[0]=='U'||ch[0]=='Y')&&m==1&&ch[strlen(ch)-1]!=('A'||'E'||'I'||'O'||'U'||'Y'))\n //printf(\" %d\\n\",q-1);\n if(strlen(ch)>=1)\n printf(\"%d\\n\",q+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar a[100];\n\tint i=0,count=0,j=0,max=0,round=1;\n\tscanf(\"%s\",a);\n\twhile(a[i]!='\\0'){\n\t\tcount++;\n\t\ti++;\n\t\t}\n\t\n\t\n\twhile(j<count)\n\t{\n\t\ti=j;\n\t\twhile(a[i]!='A'&&a[i]!='E'&&a[i]!='I'&&a[i]!='O'&&a[i]!='U'&&a[i]!='Y'&&a[i]!='\\0')\n\t\t{\n\t\t\tround++;\n\t\t\ti++;\n\t\t}\n\t\tif(max<round)\n\t\t\tmax=round;\n\t\t\n\t\tj=i+1;\n\t\tround=1;\n\t}\n\tprintf(\"%d\",max);\n}\t\n\t\n\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]=='A'||s[i]=='O'||s[i]=='U'||s[i]=='I'||s[i]=='E'||s[i]=='Y') cnt=1;\n\t\telse cnt++;\n\t\tif(cnt>max) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nchar s[105];\nint c,a,b,t,i,max;\nint main(){\nscanf(\"%s\",s);\nt=strlen(s);\na=0;\nmax=0;\nfor(i=0;i<t;i++)\n{\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n {b=i+1;\n c=b-a;\n if(c>max)\n max=c;\n a=b;}\n}\nb=t+1;\nc=b-a;\nif(c>max)\n max=c;\n\n printf(\"%d\\n\",max);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int len,i=0,count=0,car[100],j=0;\n char ar[105];\n scanf(\"%s\",ar);\n len=strlen(ar);\n\n {\n\n\n\n\n\n for(i=0;i<len;i++)\n {\n if(ar[i]=='A' || ar[i]=='E' || ar[i]=='I'|| ar[i]=='O' || ar[i]=='U' || ar[i]=='Y')\n {\n count++;\n car[j]=count;\n j++;\n count=0;\n\n\n }\n\n else count++;\n\n\n\n\n } car[j]=count+1;\n car[j+1]='\\0';\n int m,temp;\n for(i=0;i<=j;i++)\n\n {\n for(m=i+1;m<=j;m++)\n {\n if(car[i]<car[m])\n {\n temp=car[i];\n car[i]=car[m];\n car[m]=temp;\n }\n\n\n\n }\n }\n\n printf(\"%d\\n\",car[0]);\n }\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int i,j,k,l=0,m=0,n;\n char str[1000];\n str[0]='0';\n gets(&str[1]);\n n=strlen(str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n {\n if(i-l>m)\n {\n m=i-l;\n l=i;\n }\n else l=i;\n }\n }\n if(i-l>m) m=i-l;\n printf(\"%d\",m);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nchar a[101];\nint d[101];\n\n\nint v_c(char ch){\n\tswitch(ch)\n\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\tcase '\\0':\n\n\t\t\t\treturn 1;\n\t\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t return 0;\n\t}\n}\n\n\n\nint main(){\n\tfflush(stdin);\n\tgets(a);\n\tint i,j,alien = 1,dist = 0,temp = 0,k=1;\n\tfor(i=0;i<strlen(a);i++){\n\t\ttemp = dist;\n\t\tchar ch = a[i];\n\t\tif(v_c(ch)==1){\n\t\t\tfor(j=i+1;j<strlen(a)+1;j++){\n\t\t\t\tchar ch1 = a[j];\n\t\t\t\tif(v_c(ch1)==1){\n\t\t\t\t\tdist = j-i;\n\t\t\t\t\td[k] = dist;\n\t\t\t\t\tk++;\n\t\t\t\t\t//printf(\"%d\",dist);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(v_c(ch) == 0){\n\t\t\talien++;\n\t\t}\n\t}\n\n\tfor(i=0;i<strlen(a);i++){\n\t\tchar cd = a[i];\n\t\tif(v_c(cd) == 1){\n\t\t\td[0] = i+1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tint maximum = d[0],c;\n for (c = 1; c < 101; c++){\n if (d[c] > maximum){\n maximum = d[c];\n }\n }\n\tif(maximum > 0){\n\t\tprintf(\"%d\",maximum);\n\t}\n\telse{\n\t\tprintf(\"%d\",alien);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <string.h>\n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i<strlen(ch)){\n\t\tif(ch[i]<65 ||ch[i]>91) {\n\t\n\t\t\n\t\treturn 1;\t\t\n\t\t}\ni++;\t}\n\t\n\treturn 0;\n}\n\nint main(){\n \nchar ch[10000];\n\n\n do{\ngets(ch);\t\n }while (notupper(ch) ||*ch=='\\n') ;\n\n\nint max=0,j=1;\nint i;\nfor( i=0;i<strlen(ch);i++){\n\n\tif(ch[i]=='I'||ch[i]=='Y'||ch[i]=='O'||ch[i]=='U'||ch[i]=='E'||ch[i]=='A')\n\t{\n\t\n\t\tj=1;\n\t\n\t\t\n\t\t\n\t}else{\n\t\tif(j!=0){\n\t\t\tj++;\n\t\t}\n\t\n \n\t\t\n\t}\n\t\n\tif (j>max){\n \tmax=j;\n\t\t\t\t\n\t\t\t} \t\t\n}\nif(max==0)\nprintf(\"%d\",max+strlen(ch)+1);\nelse\nprintf(\"%d\",max);\n\n\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n\n{\n int count=1,max=1,last,n,i,j,k;\n char a[110];\n scanf(\"%s\",a);\n n=strlen(a);\n for(i=0;i<n;i++)\n {\n if(a[i]!='A'&&a[i]!='E'&&a[i]!='I'&&a[i]!='O'&&a[i]!='U'&&a[i]!='Y')\n {\n count++;\n }\n else\n {\n if(count>max)\n {\n max=count;\n }\n count=1;\n }\n //printf(\"%c %d %d\\n\",a[i],count,max);\n }\n if(max>count)\n printf(\"%d\",max);\n else\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]=='A'||s[i]=='O'||s[i]=='U'||s[i]=='I'||s[i]=='E'||s[i]=='Y') cnt=1;\n\t\telse cnt++;\n\t\tif(cnt>max) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char s[105];\n int i,k=0,d=0,len;\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++){\n if(!(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' ||s [i]=='U' || s[i]=='Y')){\n k++;\n if(d<k) d=k;\n }\n else k=0; }\n printf(\"%d\\n\",d+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#define N 100\n\nint main(void)\n{\n char A[N], q;\n int i = 1, j, p, k = 0, m = 0, n;\n scanf(\"%s\", A);\n p = strlen(A) + 1;\n char B[p];\n for(n = 0; n <= p; n++)\n B[n + 1] = A[n];\n for(i = 1 ; i <= p; i++)\n {\n q = B[i];\n if(q == 'A' || q == 'I' || q == 'E' || q == 'O' || q == 'U' || q == 'Y' || q == '\\0')\n {\n j = i - m;\n m = i;\n if(j > 0 && j > k)\n k = j;\n }\n }\n printf(\"%d\\n\", k);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main (){int i,j,min=0,pos=0,temp=0,yes=0,l,graze=0;char hopper[110];gets(hopper);l=strlen(hopper);for(i=0;i<l;i++){if(hopper[i]=='A' || hopper[i]=='E' || hopper[i]=='I' || hopper[i]=='O' || hopper[i]=='U' || hopper[i]=='Y'){if(yes==0 && i!=0)graze=1;if(i>pos){temp=i-pos;if(temp>min)min=temp+graze,graze=0;pos=i;}yes=1;}else{if(i==l-1){temp=(i-pos)+1;if(temp>min)min=temp;}}}if(yes==0)min=++i;else{if(min==0)min=1;}printf(\"%d\\n\",min);return 0;}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar c[100];\n\tint i = 1;\n\tint a = 0;\n\tint max = 0;\n\tscanf(\"%s\",c);\n\tdo\n\t{\n\t\tif ((c[a] == 'A') || (c[a] == 'I') || (c[a] == 'U') || (c[a] == 'E') || (c[a] == 'O') || (c[a] == 'Y'))\n\t\t{\n\t\t\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\t\t\ti = 1;\n\t\t} else\n\t\t{\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}while (c[a] != '\\0');\n\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,p=2,q=0,z,l=0,max;\n char a[102];\n scanf(\"%s\", &a);\n for (i=0; i<strlen(a); i++){\n if (a[i]=='A' || a[i]=='E'|| a[i]=='I' || a[i]== 'O' || a[i]== 'U' || a[i]== 'Y' ){\n p=i+1;\n l+=1;\n break;\n }\n }\n if (l==0){\n printf(\"%d\\n\", strlen(a)+1);\n }\n else{\n max=i+1;\n for (j=i; j<strlen(a); j++){\n if (a[j]=='A' ||a[j]=='E'|| a[j]=='I' || a[j]== 'O' || a[j]== 'U' || a[j]== 'Y' ){\n q=p;\n p=j+1;\n z=p-q;\n }\n if (z>=max) max=z;\n else max=max;\n }\n if(j-(p-1)>max) max=(j-p+1);\n else max=max;\n printf(\"%d\", max);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch[101];\n char voy[6]={'A','E','I','O','U','Y'};\n int i,k,h,c,j,s=0;\n scanf(\"%s\",&ch);\n k=1;\n i=0;\n h=1;\n while(i<strlen(ch)){\n\n c=0;\n for(j=0;j<6;j++){\n if(voy[j]==ch[i]){\n c=1;\n break;\n }\n }\n if(c==0){\n h=h+1;\n s=s+1;\n }\n else {\n if(h>k){\n k=h;\n\n\n }\n h=1;\n\n }\n i=i+1;\n }\n if((c==0)&&k==1){\n k=k+s;\n }\n if((h>k)){\n k=h;\n }\n\n\n printf(\"%d\",k);\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n int i=0,j=-1,max=0;\n char s[110];\n scanf(\"%s\",&s);\n\n while(s[i]!='\\0')\n {\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n {\n if(abs(i-j)>max)\n max=abs(i-j);\n j=i;\n }\n else if(s[i+1]=='\\0')\n {\n if(abs((i+1)-j)>max)\n max=abs(i+1-j);\n j=i+1;\n }\n i++;\n }\n printf(\"%d\\n\",max);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tint i = 0, max = 0, temp = 0;\n\tchar s[111];\n\n\tgets(s);\n\tint len = strlen(s);\n\t\n\twhile (i < len) {\n\t\ttemp++;\n\t\tif (s[i] == 'A' || s[i] == 'O' || s[i] == 'U' || s[i] == 'E' || s[i] == 'I' || s[i] == 'Y') {\n\t\t\tif (max < temp) max = temp;\n\t\t\ttemp = 0;\n\t\t}\n\t\ti++;\n\t}\n\ttemp++;\n\tif (max < temp) max = temp;\n\n\tprintf(\"%d\", max);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\nchar s[101];\nint i,p,q=-1,max=0;\np=-1;\nscanf(\"%s\",s);\nfor(i=0;s[i];i++)\n{\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y')\n {\n q=i;\n //printf(\"%d\\n\",q);\n }\n if(max<q-p)\n max=q-p;\n p=q;\n}\n//printf(\"%d\\n\",i);\nmax=max>i-p?max:i-p;\n\nprintf(\"%d\\n\",max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch[101];\n char voy[6]={'A','E','I','O','U','Y'};\n int i,k,h,c,j,s=0;\n scanf(\"%s\",&ch);\n k=1;\n i=0;\n h=1;\n while(i<strlen(ch)){\n\n c=0;\n for(j=0;j<6;j++){\n if(voy[j]==ch[i]){\n c=1;\n break;\n }\n }\n if(c==0){\n h=h+1;\n s=s+1;\n }\n else {\n if(h>k){\n k=h;\n\n\n }\n h=1;\n\n }\n i=i+1;\n }\n if((c==0)&&k==1){\n k=k+s;\n }\n if((h>k)){\n k=h;\n }\n\n\n printf(\"%d\",k);\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[101];\nint a[100],i,c=0,n,d,k=0;\nscanf(\"%s\",s);\nn=strlen(s);\nfor(i=0;i<n;i++)\n{\nif(s[i]=='A' || s[i]=='E'|| s[i]=='I'|| s[i]=='O'|| s[i]=='U'|| s[i]=='Y')\n{\na[c]=i;\nc++;\n}\n}\nif(c==0)\n{\nprintf(\"%d\",n+1);return 0;\n}\nfor(i=0;i<c;i++)\n{\nif(i==0)\n{\nd=a[i]+1;\n}\nelse if(i>0)\n{\nd=a[i]-a[i-1];\n}\nif(d>k)k=d;\n}\nd=n-a[c-1];\nif(d>k)k=d;\nprintf(\"%d\",k);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,count=0,max=0;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if ( s[i]== 65 || s[i]==69 || s[i]==73 || s[i]==79 || s[i]==85 ||s[i]==89)\n {\n count=0;\n }\n else{\n count++;\n if(max<count)\n {\n max=count;\n }\n }\n }\n printf(\"%d\",max+1);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{char s[100];\nscanf(\"%s\",s);\nint i,j=0,jl=0,d,flag=0;\nfor(i=0;s[i]!='\\0';i++)\nif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\t\n{\nd=i+1-jl;\nif(d>j)\nj=d;\njl=i+1;\t\n}\nd=i+1-jl;\nif(d>j)\nj=d;\nprintf(\"%d\",j);\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[101];\n scanf(\"%s\",s);\n int j,k=1,max=-1;\n for (j=0;j<strlen(s);j++){\n if ((s[j]=='A')||(s[j]=='E')||(s[j]=='U')||(s[j]=='I')||(s[j]=='O')||(s[j]=='Y')){\n if (max<k)\n max=k;\n k=0;\n }\n k++;\n }\n if (max<k)\n max=k;\n printf(\"%d\",max);\n\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char arr[100];\n scanf(\"%s\", arr);\n int max=0;\n int i=0;\n int lastPoint=-1;\n for(i=0; i<strlen(arr); i++)\n {\n if(arr[i]!='A'&&arr[i]!='E'&&arr[i]!='I'&&arr[i]!='O'&&arr[i]!='U'&&arr[i]!='Y')\n continue;\n \n else {\n \n if(max<i-lastPoint)\n {\n max=i-lastPoint;\n \n }\n lastPoint=i;}\n }\n \n if (max<strlen(arr)-lastPoint)\n max=strlen(arr)-lastPoint;\n printf(\"%d\", max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,count=0,max=0;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if ( s[i]== 65 || s[i]==69 || s[i]==73 || s[i]==79 || s[i]==85 ||s[i]==89)\n {\n count=0;\n }\n else{\n count++;\n if(max<count)\n {\n max=count;\n }\n }\n }\n printf(\"%d\",max+1);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[101];\nscanf(\"%s\",s);\nint l=strlen(s);\nint m=1,w=0,i;\nfor(i=0;i<l;i++)\n{\nif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\nm=1;\nelse\nm++;\nif(m>=w)\nw=m;\n}\nprintf(\"%d\\n\",w);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a = 1,b,i,max = 0;\n char x[100];\n gets(x);\n b = strlen(x);\n for(i = 0; i<b; i++) {\n if(x[i] == 'A' || x[i] == 'E' || x[i] == 'I' || x[i] == 'O' || x[i] == 'U' || x[i] == 'Y') {\n if(a>max) {\n max = a;\n }\n a = 1;\n } else {\n a++;\n }\n }\n if(max<a) {\n max = a;\n }\n printf(\"%d\\n\", max);\n}\n"}, {"source_code": "#include <stdio.h>\n#define max(x,y)(x >= y?x:y)\nchar a[101];\nint main()\n{\n\tint n = 1;\n\tint length = 0;\n\tint b[100] = {0};\n\tint ability = 1;\n\tscanf(\"%s\",&a);\n\tb[0] = 0;\n\tfor(int i =0;i <= 99;i++)\n\t{\n\t\tif(a[i] == 'A' || a[i] == 'E' || a[i] == 'I' || a[i] == 'O' || a[i] == 'U' || a[i] == 'Y')\n\t\t{\n\t\t\tb[n] = i + 1;\n\t\t\tn++;\n\t\t}\n\t}\n\tfor(;a[length] != '\\0';length++) ;\n\tb[n] = length + 1;\n\tif(n != 0){\n\tfor(int i =0;i <= 98;i++)\n\t{\n\t\tability = max(ability,(b[i + 1] - b[i]));\n\t}\n\tprintf(\"%d\",ability);\n\t} else \n\t{\n\t\tprintf(\"%d\",length + 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, a=0, b=0;\n char str[100]={0}, ar[50]={0};\n gets(str); ar[0]= '1';\n for(i=0; str[i]!='\\0'; i++)\n {\n if('A'==str[i] || 'Y'==str[i] || 'E'==str[i] || 'I'==str[i] || 'O'==str[i] || 'U'==str[i] )\n ar[a=0]= '1';\n else\n ar[++a]= '1';\n }\n for(i=0; ar[i]=='1'; i++)\n b+= 1;\n printf(\"%d\\n\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[105];\n int i,j,k,len,max=0,dis=0,start=0,end=0,flag=0;\n scanf(\"%s\",a);\n len=strlen(a);\n for(i=0;i<len;i++)\n {\n if(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y' )\n { end=i+1;\n dis=end-start;\n if(dis>max)max=dis;\n start=end;flag=1;\n }\n if(i==(len-1) && (!(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y' )))\n {\n end=i+2;\n dis=end-start;\n if(dis>max)max=dis;\n }\n\n }\n if(flag==0)printf(\"%d\\n\",len+1);\n else printf(\"%d\\n\",max);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n int i,j,m=0,p,count[100],temp;\n gets(s);\n s[strlen(s)]='*';\n for(i=0;i<=strlen(s);i++)\n {\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y'||s[i]=='*')\n {\n count[m]=i+1-p;\n p=i+1;\n m++;\n }\n }\n for(i=1;i<m;i++)\n for(j=0;j<m-i;j++)\n if(count[j]<count[j+1])\n {\n temp=count[j];\n count[j]=count[j+1];\n count[j+1]=temp;\n }\n printf(\"%d\",count[0]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[200];\n int a=-1,count=0,max=0,i;\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++){\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y'){\n count=i-a;\n if(max<count)\n max=count;\n a=i;\n }\n }\n if(strlen(s)-a>max&&max!=0){\n printf(\"%d\\n\",strlen(s)-a);\n return 0;\n }\n if(max==0)\n printf(\"%d\\n\",strlen(s)+1);\n else\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,max;\n char a[120];\n int c=1,i,j=0,p[120];\n gets(a);\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y')\n {\n p[j]=c;\n j++;\n c=1;\n }\n else\n {\n c++;\n }\n }\n p[j]=c;\n {\n max=p[0];\n for(i=1;i<=j;i++)\n {\n if(p[i]>max)\n {\n max=p[i];\n }\n }\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[101];\n scanf(\"%s\", s);\n int i, len = strlen(s), count = 1, max = 0;\n\n for(i = 0; i < len; i++)\n {\n if(s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' || s[i] == 'Y')\n {\n count = 1;\n }\n else count++;\n if(count > max) max = count;\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[101];\n scanf(\"%s\",s);\n\tint l=strlen(s);\n\tint m=1,w=0,i;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\tm=1;\n\t\telse\n\t\t\tm++;\n\t\tif(m>=w)\n\t\t\tw=m;\n\t}\n\tprintf(\"%d\\n\",w);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>//\n#include<string.h>\n\nint main(){\n int i,l,max=0,count=0;\n char s[100];\n gets(s);\n l=strlen(s);\n for(i=0;i<=l;i++){\n count+=1;\n if (s[i] == 'A' || s[i] == 'I' || s[i] == 'U' || s[i] == 'E' || s[i] == 'O' || s[i] == 'Y' || s[i]=='\\0') {\n if(max<count){\n max=count;\n }\n count=0;\n }\n if(max==0)\n max=count;\n }\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n int i,j,m=0,p,count[100],temp;\n gets(s);\n s[strlen(s)]='*';\n for(i=0;i<=strlen(s);i++)\n {\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y'||s[i]=='*')\n {\n count[m]=i+1-p;\n p=i+1;\n m++;\n }\n }\n for(i=1;i<m;i++)\n for(j=0;j<m-i;j++)\n if(count[j]<count[j+1])\n {\n temp=count[j];\n count[j]=count[j+1];\n count[j+1]=temp;\n }\n printf(\"%d\",count[0]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n=0, i, j=0;\n char a;\n for(i=1; a!='\\n'; i++)\n {\n scanf(\"%c\", &a);\n if(a=='A' || a=='E' || a=='U' || a=='O' || a=='I' || a=='Y')\n {\n j=i-j;\n if(n<j)\n n=j;\n j=i;\n }\n }\n j=i-j-1;\n if(n<j)\n n=j;\n printf(\"%d\", n);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint is_vowels(char carac);\n\n\n\nint main(int argc, char const *argv[])\n{\n\tchar s[100];\n\tint i = 0,long_saut=0,max_saut=0;\n\tscanf(\"%s\",s);\n\tfor (; i < strlen(s); ++i)\n\t{\n\t\tlong_saut++;\n\t\tif (is_vowels(s[i]))\n\t\t{\n\t\t\tif (max_saut < long_saut) max_saut = long_saut;\n\t\t\tlong_saut = 0;\n\t\t}\n\t}\n\tlong_saut++;\n\tif (max_saut < long_saut) max_saut = long_saut;\n\t\n\tprintf(\"%d\\n\", max_saut);\n}\nint is_vowels(char carac)\n{\n\tif (carac == 'A' || carac == 'E' || carac == 'I' ||\n\t\tcarac == 'O' || carac == 'U' || carac == 'Y' )\n\treturn 1 ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint isvowel(char c) {\n\treturn c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y';\n}\n\nint main() {\n\tstatic char s[128];\n\tint n, i, j, max;\n\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tfor (i = 0; i < n; i++)\n\t\tif (isvowel(s[i]))\n\t\t\tbreak;\n\tmax = i + 1;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = i + 1; j < n; j++) {\n\t\t\tint k, cnt;\n\n\t\t\tcnt = 0;\n\t\t\tfor (k = i; k <= j; k++)\n\t\t\t\tif (!isvowel(s[k]))\n\t\t\t\t\tcnt++;\n\t\t\t\telse\n\t\t\t\t\tcnt = 1;\n\t\t\tif (max < cnt)\n\t\t\t\tmax = cnt;\n\t\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[101];\n scanf(\"%s\", s);\n int i, len = strlen(s), count = 1, max = 0;\n\n for(i = 0; i < len; i++)\n {\n if(s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'U' || s[i] == 'Y')\n {\n count = 1;\n }\n else count++;\n if(count > max) max = count;\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[101];\n scanf(\"%s\",s);\n\tint l=strlen(s);\n\tint m=1,w=0,i;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\tm=1;\n\t\telse\n\t\t\tm++;\n\t\tif(m>=w)\n\t\t\tw=m;\n\t}\n\tprintf(\"%d\\n\",w);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <inttypes.h>\n\n#define REP(I, N) for (int I = 0; I < (N); ++I)\n#define RI(X) scanf(\"%d\", &(X))\n\nint min(int a, int b){\n\treturn (a < b) ? a : b;\n}\n\nint max(int a, int b){\n\treturn (a > b) ? a : b;\n}\n\nint main(){\n int t,n=1,vec[10]={0},aux=1;\n char str[102];\n scanf(\"%s\",str);\n t=strlen(str)+1;\n for(int i=0;i<t;i++){\n if(str[i]=='A'|| str[i]=='E' || str[i]=='I' || str[i]=='O'||str[i]=='U' || str[i]=='Y'){\n n=max(aux,n); \n aux=1;}\n else aux++;\n }\n n=max(aux-1,n);\n printf(\"%d\\n\",n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n\n int i,count=1,d=0;\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]!='A' && a[i]!='E' && a[i]!='I' && a[i]!='O' && a[i]!='U' && a[i]!='Y')\n {\n count++;\n\n }\n else\n {\n if(count>d)\n {\n d=count;\n\n }\n count=1;\n }\n }\n\n if(d>count)\n printf(\"%d\",d);\n else\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,count=0,max=0;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if ( s[i]== 65 || s[i]==69 || s[i]==73 || s[i]==79 || s[i]==85 ||s[i]==89)\n {\n count=0;\n }\n else{\n count++;\n if(max<count)\n {\n max=count;\n }\n }\n }\n printf(\"%d\",max+1);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint max(int a,int b)\n{\n return a>b?a:b ;\n}\n\nint main()\n{\n char str[100] ;\n scanf(\"%s\",str) ;\n\n int ans = 1 , prev = -1 ;\n\n for( int i = 0 ; i < strlen(str) ; i++ )\n {\n if( str[ i ] == 'A' || str[ i ] == 'E' || str[ i ] == 'I' || str[ i ] == 'O' || str[ i ] == 'U' || str[ i ] == 'Y')\n {\n ans = max( ans , i - prev );\n prev = i ;\n }\n }\n ans = max( ans , strlen(str) - prev);\n printf(\"%d\",ans) ;\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n char w[110];\n int i,j=0,count=0,l,x=0;\n gets(w);\n l=strlen(w);\n\n for(i=0;i<l;i++){\n\n if(w[i]=='A'||w[i]=='E'||w[i]=='I'||w[i]=='O'||w[i]=='U'||w[i]=='Y')\n {\n j=count+1;\n if(j>x)\n x=j;\n count=0;\n }\n\n else{\n count++;\n j=count+1;\n if(j>x)\n x=j;\n }\n }\n\n printf(\"%d\\n\",x);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint max (int p , int c)\n{\n if (p>c)\n return(p);\n return(c);\n}\n\n\nint main()\n{\n char s[120];\n int p=0,c=1,i;\n gets(s);\n for (i=0 ; i<strlen(s) ; i++)\n {\n if ((s[i]=='O') || (s[i]=='I') || (s[i]=='Y') || (s[i]=='E') || (s[i]=='A') || (s[i]=='U'))\n {\n p=max(p,c);\n c=1;\n }\n else\n {\n c=c+1;\n }\n }\n p=max(p,c);\n printf(\"%d\",p);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int jump=1, ja=1, i, j;\n char s[101];\n scanf(\"%s\", s);\n for(i=0; i<strlen(s); i++)\n {\n if(!(s[i]=='A' || s[i]=='E'|| s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y'))\n {\n jump++;\n if(jump>ja)\n ja=jump;\n }\n else\n jump=1;\n }\n\n printf(\"%d\\n\", ja);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,cnt=1,max=-1;\n\tchar s[102];\n\tgets(s);\n\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]=='A'||s[i]=='O'||s[i]=='U'||s[i]=='I'||s[i]=='E'||s[i]=='Y') cnt=1;\n\t\telse cnt++;\n\t\tif(cnt>max) max=cnt;\n\t}\nprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[110];\n int i,t,m,n;\n while(gets(s)!=NULL)\n {\n int len=strlen(s);\n t=0;\n m=-1;\n n=0;\n if(s[0]!='A'||s[0]!='E'||s[0]!='I'||s[0]!='O'||s[0]!='U'||s[0]!='Y')\n t=1;\n for(i=0; i<len;i++)\n {\n\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n {\n\n if(t>m)\n m=t;\n n=1;\n t=1;\n }\n else\n t++;\n }\n if(t>m)\n m=t;\n if(n==1)\n printf(\"%d\\n\",m);\n else\n printf(\"%d\\n\",len+1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[102];\n int k=0,l,i,n,m=0;\n scanf(\"%s\",a);\n n=strlen(a);\n for(i=0;i<n;i++)\n {\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n l=i+1;\n m=l-m;\n if(m>k) k=m;\n m=l;\n }\n else if(i==n-1)\n {\n l=i+1;\n m=l-m+1;\n if(m>k) k=m;\n m=l;\n }\n }\n if(k==0) k=n+1;\n printf(\"%d\",k);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h> \n#define MAX 107\n\nint main()\n{\n\tchar str[MAX];\n\tint i, len, prev = -1, max = 0;\n\tscanf(\"%s\", str);\n\tlen = strlen(str);\n\tfor(i=0;i<len;++i)\n\t{\n\t\tif(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U' || str[i] == 'Y')\n\t\t{\n\t\t\tmax = (i - prev) > max ? (i - prev) : max;\n\t\t\tprev = i;\n\t\t}\n\t}\n\tmax = (i - prev) > max ? (i - prev) : max;\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\t\n\tint i,j,a[100],k=1;\n\tchar s[102];\n\tgets(s);\n\tint l=strlen(s);\n\ta[0]=-1;\n\tfor(i=0;i<l;i++){\n\t\t\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\t{\n\t\t\ta[k]=i;\n\t\t\tk++;\n\t\t}\n\t\t\n\t}\n\ta[k]=l;int max=a[0];\n\tfor(i=0;i<k;i++){\n\t\ta[i]=a[i+1]-a[i];\n\n\t}\n\tfor(i=0;i<k;i++)\n\t{if(a[i]>=max)\n\tmax=a[i];\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,t=-1,sry;\nchar srx[1001];\nint max(int x,int y)\n{\n if(x>y)\n return x;\n return y;\n}\nint main()\n{\n scanf(\"%s\",srx);\n for(i=0;i<strlen(srx);i++)\n if(srx[i]=='A'||srx[i]=='E'||srx[i]=='I'||srx[i]=='O'||srx[i]=='U'||srx[i]=='Y')\n {sry=max(i-t,sry);\n t=i;}\n sry=max(sry,strlen(srx)-t);\n printf(\"%d\",sry);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,l,k=1,g=1;\n char S[101];\n gets(S);\n l=strlen(S);\n for(i=0;i<l;i++)\n {\n if(S[i]!='A'&&S[i]!='E'&&S[i]!='I'&&S[i]!='O'&&S[i]!='U'&&S[i]!='Y')\n {\n k++;\n if(k>g)\n {\n g=k;\n }\n }\n else\n {\n k=1;\n }\n }\n printf(\"%d\\n\",g);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, a=0, b=0;\n char str[100]={0}, ar[50]={0};\n gets(str); ar[0]= '1';\n for(i=0; str[i]!='\\0'; i++)\n {\n if('A'==str[i] || 'Y'==str[i] || 'E'==str[i] || 'I'==str[i] || 'O'==str[i] || 'U'==str[i] )\n ar[a=0]= '1';\n else\n ar[++a]= '1';\n }\n for(i=0; ar[i]=='1'; i++)\n b+= 1;\n printf(\"%d\\n\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint max(int a,int b)\n{\n\treturn a>b?a:b;\n}\nint min(int a,int b)\n{\n\treturn a<b?a:b;\n}\nint main()\n{\n\tchar string[101];\n\tscanf(\"%s\",string);\n\tint len=strlen(string);\n\tint i;\n\tint x=-1,jumpAbility=1;\n\tint maxJump=1,flag=0;\n\tfor(i=0;i<len;i++)\n\t{\n\t\tswitch(string[i])\n\t\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\tjumpAbility=max(jumpAbility,maxJump);\n\t\t\tmaxJump=1;\n\t\t\t/*\t\t\t\n\t\t\tflag=1;\n\t\t\t//printf(\"%d\\n\",jumpAbility);\n\t\t\tmaxJump=max(i-x,maxJump);\t\t\t\n\t\t\tjumpAbility=min(maxJump,jumpAbility);\n//\t\t\tprintf(\"mJ%d\\n\",maxJump);\n\t\t\t\tx=i;\n*/\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tmaxJump++;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tjumpAbility=max(jumpAbility,maxJump);\n\tprintf(\"%d\",jumpAbility);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int i,j,k,l=0,m=0,n;\n char str[1000];\n str[0]='0';\n gets(&str[1]);\n n=strlen(str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n {\n if(i-l>m)\n {\n m=i-l;\n l=i;\n }\n else l=i;\n }\n }\n if(i-l>m) m=i-l;\n printf(\"%d\",m);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,count=0,max=0;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if ( s[i]== 65 || s[i]==69 || s[i]==73 || s[i]==79 || s[i]==85 ||s[i]==89)\n {\n count=0;\n }\n else{\n count++;\n if(max<count)\n {\n max=count;\n }\n }\n }\n printf(\"%d\",max+1);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int i=0,v=-1,max=1,flag=1;\n for(i=0;str[i]!='\\0';i++){\n\tif(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y'){\n\t if(max<i-v){\n\t\tif(flag)\n\t\t max=i-v+1;\n\t\telse\n\t\t max=i-v;\n\t }\n\tv=i;\n\t}\n\tflag=0;\n }\n if(max<i-v)\n\tmax=i-v;\n if(flag)\n\tprintf(\"%d\",max+1);\n else\n\tprintf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar ar[100];\n\tint i,max=0,count=0;\n\tscanf(\"%s\",ar);\n\tif((ar[0]!='A')&&(ar[0]!='E')&&(ar[0]!='I')&&(ar[0]!='O')&&(ar[0]!='U')&&(ar[0]!='Y')&&(ar[0]!='\\0'))\n\t{\n\t count++;\n\t max=count;\n\t}\n\tfor(i=1;ar[i-1]!='\\0';i++)\n\t{\n\t\tif((ar[i]=='A')||(ar[i]=='E')||(ar[i]=='I')||(ar[i]=='O')||(ar[i]=='U')||(ar[i]=='Y')||(ar[i]=='\\0'))\n\t\t{\n\t\t if(max<count)\n\t\t \tmax=count;\n\t\t count=0;\n\t\t continue;\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\",max+1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[202];\n scanf(\"%s\",a);\n int i,b[202]={0},x=0;\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n b[x]=i;\n x++;\n }\n }\n //printf(\"%d \",x);\n int max=-1,d,e,f;\n if(x==0)\n {\n printf(\"%d\",strlen(a)+1);\n return 0;\n }\n if(x==1)\n {\n d=b[0]+1;\n e=strlen(a)-b[0];\n if(d>=e)\n printf(\"%d\",d);\n else if(d<=e)\n printf(\"%d\",e);\n return 0;\n }\n if(x==2)\n {\n d=b[0]+1;\n e=b[1]-b[0];\n f=strlen(a)-b[1];\n if(d>=e&&d>=f)\n printf(\"%d \",d);\n else if(e>=d&&e>=f)\n printf(\"%d \",e);\n else if(f>=d&&f>=e)\n printf(\"%d \",f);\n return 0;\n }\n e=0;\n for(i=0;i<x;i++)\n {\n if(i==0)\n d=b[i]+1;\n else if(i>0&&i<x-1)\n d=b[i]-b[i-1];\n if(i==x-1){\n e=strlen(a)-b[x-1];\n d=b[i]-b[i-1];}\n if(max<d)\n max=d;\n if(max<e)\n max=e;\n }\n printf(\"%d \",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int n,a=0,d=0,i,jump=0,max=0,flag=0,p=-1;\n char s[100010];\n gets(s);\n n=strlen(s);\n // printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n {\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y' )\n {\n if(flag==0)\n {\n jump=i;\n max=jump+1;\n p=i;\n flag=1;\n\n }\n else\n {\n jump=i-p;\n if(jump>max) max=jump;\n p=i;\n\n }\n\n\n }\n if(i==n-1)\n {\n jump=n-p;\n if(jump>max) max=jump;\n }\n\n\n\n }\n printf(\"%d\\n\",max);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define max(a,b) a>b? a: b\nint main()\n{\n\tint i, cnt=0,m=0,n;\n\tchar s[200];\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\t{\n\t\t\tm = max(m,cnt);\n\t\t\tcnt=0;\n\t\t}\n\t\telse\n\t\t\tcnt++;\n\t}\n\tm = max(m,cnt);\n\tprintf(\"%d\\n\", m+1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int len,i=0,count=0,car[100],j=0;\n char ar[105];\n scanf(\"%s\",ar);\n len=strlen(ar);\n\n {\n\n\n\n\n\n for(i=0;i<len;i++)\n {\n if(ar[i]=='A' || ar[i]=='E' || ar[i]=='I'|| ar[i]=='O' || ar[i]=='U' || ar[i]=='Y')\n {\n count++;\n car[j]=count;\n j++;\n count=0;\n\n\n }\n\n else count++;\n\n\n\n\n } car[j]=count+1;\n car[j+1]='\\0';\n int m,temp;\n for(i=0;i<=j;i++)\n\n {\n for(m=i+1;m<=j;m++)\n {\n if(car[i]<car[m])\n {\n temp=car[i];\n car[i]=car[m];\n car[m]=temp;\n }\n\n\n\n }\n }\n\n printf(\"%d\\n\",car[0]);\n }\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j;char a[1000];\n gets(a);\n int len =strlen(a);\n a[len]='A';\n a[len+1]='\\0'; int res,cnt=-1,max=-4;\n for(i=0;i<len+1;i++){\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n res=i-cnt;\n cnt = i;\n if(max<res)max=res;\n }\n }\n\n printf(\"%d\\n\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint l, t=-1, i, k, s=-1;\n\tchar str[101];\n\tscanf(\"%s\", str);\n\tl=strlen(str);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t{\n\t\t\tt=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(t==-1)\n\t{\n\t\tprintf(\"%d\", l+1);\n\t}\n\telse\n\t{\n\t\tk=t;\n\t\tfor(i=t+1;i<l;i++)\n\t\t{\n\t\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t\t{\n\t\t\t\tif(i-k>s)\n\t\t\t\t{\n\t\t\t\t\ts=i-k;\n\t\t\t\t}\n\t\t\t\tk=i;\n\t\t\t}\n\t\t}\n\t\tif(l-k>s)\n\t\t{\n\t\t\ts=l-k;\n\t\t}\n\t\tif(t+1>s)\n\t\t{\n\t\t\ts=t+1;\n\t\t}\n\t\tprintf(\"%d\", s);\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char arr[100];\n scanf(\"%s\", arr);\n int max=0;\n int i=0;\n int lastPoint=-1;\n for(i=0; i<strlen(arr); i++)\n {\n if(arr[i]!='A'&&arr[i]!='E'&&arr[i]!='I'&&arr[i]!='O'&&arr[i]!='U'&&arr[i]!='Y')\n continue;\n \n else {\n \n if(max<i-lastPoint)\n {\n max=i-lastPoint;\n \n }\n lastPoint=i;}\n }\n \n if (max<strlen(arr)-lastPoint)\n max=strlen(arr)-lastPoint;\n printf(\"%d\", max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main(void) {\n\t\n\tchar s[100];\n\tscanf(\"%s\", s);\n\t\n\tint i, jump=1, j=strlen(s), flag=0;\n\tfor(i=strlen(s)-1; i>=0; i--) {\n\t\tif(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y') {\n\t\t\tflag++;\n\t\t\tif((j-i)>jump) {jump =(j-i);}\n\t\t\tj=i;\n\t\t} \n\t}\n\tif((flag==0)||(s[0]!='A' && s[0]!='E' && s[0]!='I' && s[0]!='O' && s[0]!='U' && s[0]!='Y' && (j+1)>jump)){ \n\t\tprintf(\"%d\", j+1); \n\t\t}\n\telse { printf(\"%d\", jump); }\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[101];\n scanf(\"%s\",a);\n int max,i,j,k,p[100],n,l;\n n=strlen(a);\n l=0;\n p[l]=1;\n for(i=0;i<n;i++)\n {\n\tif(a[i]!='A' && a[i]!='E' && a[i]!='I' && a[i]!='O' && a[i]!='U' && a[i]!='Y')\n\t{\n\t p[l]++;\n\t}\n\telse\n\t{\n\t l++;\n\t p[l]=1;\n\t}\n }\n if(l==0)\n\tprintf(\"%d\\n\",p[0]);\n else\n {\n\tmax=0;\n\tfor(j=0;j<=l;j++)\n\t{\n\t if(p[j]>max)\n\t {\n\t\tmax=p[j];\n\t }\n\t}\n\tprintf(\"%d\\n\",max);\n }\n return 0;\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar c[100];\n\tint i = 1;\n\tint a = 0;\n\tint max = 0;\n\tscanf(\"%s\",c);\n\tdo\n\t{\n\t\tif ((c[a] == 'A') || (c[a] == 'I') || (c[a] == 'U') || (c[a] == 'E') || (c[a] == 'O') || (c[a] == 'Y'))\n\t\t{\n\t\t\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\t\t\ti = 1;\n\t\t} else\n\t\t{\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}while (c[a] != '\\0');\n\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[101];\nint a[100],i,c=0,n,d,k=0;\nscanf(\"%s\",s);\nn=strlen(s);\nfor(i=0;i<n;i++)\n{\nif(s[i]=='A' || s[i]=='E'|| s[i]=='I'|| s[i]=='O'|| s[i]=='U'|| s[i]=='Y')\n{\na[c]=i;\nc++;\n}\n}\nif(c==0)\n{\nprintf(\"%d\",n+1);return 0;\n}\nfor(i=0;i<c;i++)\n{\nif(i==0)\n{\nd=a[i]+1;\n}\nelse if(i>0)\n{\nd=a[i]-a[i-1];\n}\nif(d>k)k=d;\n}\nd=n-a[c-1];\nif(d>k)k=d;\nprintf(\"%d\",k);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char st[200];\n int i,j,k=0,m=1,a=-99999;\n scanf(\"%s\",st);\n for(i=0;st[i]!='\\0';i++)\n {\n if(st[i]=='A'||st[i]=='E'||st[i]=='I'||st[i]=='O'||st[i]=='U'||st[i]=='Y')\n {\n k++;//printf(\"%d\\n\",k);\n if(k>a)\n {\n a=k;\n }k=0;\n }\n else if(m==1)\n {\n k++;\n }\n }//printf(\"%d\\n\",a);\n if(k!=0)\n {k++;\n if(k>a)printf(\"%d\",k);\n else printf(\"%d\",a);\n }\n else printf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar c[100];\n\tint i = 1;\n\tint a = 0;\n\tint max = 0;\n\tscanf(\"%s\",c);\n\tdo\n\t{\n\t\tif ((c[a] == 'A') || (c[a] == 'I') || (c[a] == 'U') || (c[a] == 'E') || (c[a] == 'O') || (c[a] == 'Y'))\n\t\t{\n\t\t\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\t\t\ti = 1;\n\t\t} else\n\t\t{\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}while (c[a] != '\\0');\n\tif (i > max)\n\t\t\t{\n\t\t\t\tmax = i;\n\t\t\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\n#include<Windows.h>\n#include<string.h>\nint main() {\n\tchar str[101];\n\tscanf(\"%s\", str);\n\tint start = -1, end = strlen(str), res = 0;\n\tint index;\n\tfor (index = 0; index < strlen(str); ++index) {\n\t\tif (str[index] == 'A' ||\n\t\t\tstr[index] == 'E' ||\n\t\t\tstr[index] == 'I' ||\n\t\t\tstr[index] == 'O' ||\n\t\t\tstr[index] == 'U' ||\n\t\t\tstr[index] == 'Y') {\n\t\t\tres = res > (index - start) ? res : (index - start);\n\t\t\tstart = index;\n\t\t}\n\t}\n\tres = res > (end - start) ? res : (end - start);\n\tprintf(\"%d\\n\", res);\n\t//system(\"pause\");\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#define max(x,y)(x >= y)?x:y\nint main()\n{\n\tint n = 0;\n\tint length = 0;\n\tchar a[100];\n\tint b[100] = {0};\n\tint ability = 1;\n\tscanf(\"%s\",&a);\n\tfor(int i =0;i <= 99;i++)\n\t{\n\t\tif(a[i] == 'A' || a[i] == 'E' || a[i] == 'I' || a[i] == 'O' || a[i] == 'U' || a[i] == 'Y')\n\t\t{\n\t\t\tb[n] = i;\n\t\t\tn++;\n\t\t}\n\t}\n\tfor(;a[length] != '\\0';length++) ;\n\tif(n != 0){\n\tfor(int i =0;i <= 98;i++)\n\t{\n\t\tability = max(ability,(b[i + 1] - b[i]));\n\t}\n\tability = max(ability,(length - b[n - 1]));\n\tability = max(ability,(b[0] + 1));\n\tprintf(\"%d\",ability);\n\t} else \n\t{\n\t\tprintf(\"%d\",length + 1);\n}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char arr[101];\n int i,j,kA=0,ke=0,ki=0,ko=0,ku=0,k=0;\n scanf(\"%[^\\n ]\",arr);\n i =0;\n while(arr[i]!='\\0')\n {\n if (arr[i]== 'A'|| arr[i]=='a')\n kA=1;\n\n else if (arr[i]== 'E'|| arr[i]=='e')\n ke=1;\n\n else if (arr[i]== 'I'|| arr[i]=='i')\n ki=1;\n else if (arr[i]== 'O'|| arr[i]=='o')\n ko=1;\n\n else if (arr[i]== 'U'|| arr[i]=='u')\n ku=1;\n i++;\n }\n k=kA+ke+ki+ko+ku;\n printf(\"%d\\n\",k);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tint i,j=1,b[100]={0},c=0,max=0;\n\tchar a[101];\n\tgets(a);\n\tb[0]=-1;\n\tfor(i=0;i<strlen(a);i++)\n\t{\n\t\tif(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n\t\t{ c++;\n\t\t\tb[j]=i;\n\t\t\tj++;\n\t\t}\t\n\t}\n\tprintf(\"\\n%d\\n\\n\",c);\n\tfor(i=0;i<c;i++)\n\t{\n\t\tif(b[i+1]-b[i]>max)\n\t\tmax=(b[i+1]-b[i]);\n\t}\n\tif((strlen(a)-b[c]-1)>max)\n\tmax=(strlen(a)-b[c]-1);\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar str[1000];\n\tint i,n;\n\n\tscanf(\"%s\",str);\n\tn = strlen(str);\n\n\tint result = 0;\n\tint count = 0;\n\n\tfor(i=0;i<n;i++)\n\t{\n\t count++;\n\t\tif(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' \\\n\t || str[i] == 'O' || str[i] == 'U' || str[i] == 'Y'){\n\t\t\t if(count > result) {\n\t\t\t \tresult = count;\n\t\t\t\tcount = 0;\n\t\t\t}else\n\t\t\t\tcount = 0;\n\t\t}\n\t}\n\n\tif(count >= result)\n\t\tresult = count;\n\n\tprintf(\"%d\",result);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n int i,j,k=0,max,arr[200],l,s=0,c=0,rahat=0,con=0;\n char x[1000];\n scanf(\"%s\",&x);\n l= strlen(x);\n for(i=0;i<l;i++){\n if(x[i]=='A'||x[i]=='I'||x[i]=='E'||x[i]=='O'||x[i]=='U'||x[i]=='Y'){\n arr[k]=c;\n k++;\n c=0;\n rahat=1;\n }\n else {\n con++;\n c++;\n }\n }\n max=arr[0];\n for(i=0;i<k;i++){\n if(arr[i]>=max){\n max=arr[i];\n }\n }\n if(rahat==0){\n printf(\"%d\\n\",con+1);\n\n }\n else {\n printf(\"%d\\n\",max+1);\n\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint is_vowels(char carac);\n\nint main(int argc, char const *argv[])\n{\n\tint j,s=1,max = 1,i=0;\n\tchar carac;\n\twhile((j=scanf(\"%c\",&carac) != EOF) && j != feof )\n\t{\n \ti++;\n \tif (is_vowels(carac) ) \n \t{\n \t\tif(s > max) max = s;\n \t\ts=1;\n \t}\n \telse s++;\n\t \n\t}\n\tprintf(\"s=%d\\ti=%d\\tmax=%d\\t\",s,i, max);\n\tif(i == 1 && s > max) max = s;\n\tprintf(\"%d\\n\", max);\n}\nint is_vowels(char carac)\n{\n\tif (carac == 'A' || carac == 'E' || carac == 'I' ||\n\t\tcarac == 'O' || carac == 'U' || carac == 'Y' )\n\treturn 1 ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n gets(s);\n int i,count=0,max=0;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]!='A' && s[i]!='E' && s[i]!='I' && s[i]!='O' && s[i]!='U' && s[i]!='Y')\n {\n count++;\n }\n else\n {\n if(count+1>max) max=count+1;\n count=0;\n }\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint isVowel(char c);\n\nint main(void)\n{\n\tchar str[101];\n\tscanf(\"%s\", str);\n\n\tint maxJump = 0, prevVowel = -1;\n\tint i;\n\n\tfor(i = 0, prevVowel = -1; str[i] != '\\0'; i++)\n\t{\n\t\tif(isVowel(str[i]))\n\t\t{\n\t\t\tif(i - prevVowel > maxJump) maxJump = i - prevVowel;\n\t\t\tprevVowel = i;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", maxJump ? maxJump : i + 2);\n\n\treturn 0;\n}\n\nint isVowel(char c)\n{\n\tswitch(c)\n\t{\n\t\tcase 'A':\n\t\tcase 'E':\n\t\tcase 'I':\n\t\tcase 'O':\n\t\tcase 'U':\n\t\tcase 'Y':\n\t\t\treturn 1;\n\t\tdefault:\n\t\t\treturn 0;\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,a=0,e=0,j=0,o=0,u=0;\n char A[105];\n scanf(\"%s\",&A);\n while(A[i]!='\\0')\n {\n if(A[i]=='A')\n a=1;\n else if(A[i]=='E')\n e=1;\n else if(A[i]=='I')\n j=1;\n else if(A[i]=='O')\n o=1;\n else if(A[i]=='U')\n u=1;\n i++;\n }\n a=a+e+j+o+u;\n printf(\"%d\\n\",a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nchar paper[105];\nint dis[105];\n\nint main(void)\n{\n\tint r,s = 0,n,rr;\n\tscanf(\"%s\",paper);\n\tn = strlen(paper);\n\n\tif(panduan(n,paper) == 0)\n\t{\n\t\tprintf(\"%d\",n+1);\n\t}\n\telse\n\t{\n\t\t\tfor(r = 0;r < n;r++)\n\t\t{\t\n\t\t\tif( paper[r] == 65 || paper[r] == 69 || paper[r] == 73 || paper[r] == 79 || paper[r] == 85 || paper[r] == 89 )\n\t\t\t{\n\t\t\t\tdis[s] = r + 1;\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t\t;\n\t\t} \n\t\t\n\t\tprintf(\"%d\",farthest(s,n,dis));\n\t}\n\n\t\t\n\treturn 0;\n}\n\nint farthest(int n,int zong,int a[])\n{\n\tint x = 1,i;\n\t\n\tfor(i = 0;i < n-1;i++){\n\t\tif(fabs(a[i] - a[i+1]) > x)\n\t\t{\n\t\t\tx = fabs(a[i] - a[i+1]);\n\t\t}\n\t\telse\n\t\t\t;\n\t}\n\t\n\treturn (x>(zong-dis[n-1]+1)?x:zong-dis[n-1]+1); \n}\n\nint panduan(int c,char b[])\n{\n\tint ii,buer=0;\n\tfor(ii = 0;ii < c;ii++)\n\t{\n\t\tif(b[ii]==65||b[ii]==69||b[ii]==73||b[ii]==79||b[ii]==85||b[ii]==89)\n\t\t\tbuer++;\n\t\telse\n\t\t\t;\n\t}\n\treturn buer;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char x[200];\n\n scanf(\"%s\", x);\n\n int i, ln, r, rf = 0, j;\n\n for(ln = 0; x[ln] != '\\0'; ln++);\n\n for(i = 0; i < ln; i++)\n {\n r = 0;\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"i = %d, r = %d, rf = %d, x[i] = %c\\n\", i, r, rf, x[i]);\n if((x[i] == 'A') || (x[i] == 'E') || (x[i] == 'I') || (x[i] == 'O') || (x[i] == 'U') || (x[i] == 'Y'))\n {\n r = 0;\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"i = %d, r = %d, rf = %d, x[i] = %c\\n\", i, r, rf, x[i]);\n for(j = i + 1; j < ln; j++)\n {\n if((x[j] == 'A') || (x[j] == 'E') || (x[j] == 'I') || (x[j] == 'O') || (x[j] == 'U') || (x[j] == 'Y'))\n {\n r = 0;\n break;\n }\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"j = %d, r = %d, rf = %dx[j] = %c\\n\", j, r, rf, x[j]);\n }\n }\n }\n printf(\"%d\\n\", rf);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar ar[100];\n\tint i,max=0,count=0;\n\tscanf(\"%s\",ar);\n\tfor(i=0;ar[i]!='\\0';i++)\n\t{\n\t\tif((ar[i]=='A')||(ar[i]=='E')||(ar[i]=='I')||(ar[i]=='O')||(ar[i]=='U')||(ar[i]=='Y'))\n\t\t{\n\t\t if(max<count)\n\t\t \tmax=count;\n\t\t count=0;\t\t\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char a[101];\n gets(a);\n int i,j,count ,max=0,b;\n for(i=0;i<strlen(a);i++)\n {\n count =1;\n if(a[i]>='a'&&a[i]<='z')\n {\n a[i]=a[i]-32;\n\n }\n if(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n {\n for(j=i+1;j<strlen(a)-i-1;j++)\n {\n if(a[j]!='A'&&a[j]!='E'&&a[j]!='I'&&a[j]!='O'&&a[j]!='U'&&a[j]!='Y')\n {\n count ++;\n if(i==0&&(a[j]!='A'&&a[j]!='E'&&a[j]!='I'&&a[j]!='O'&&a[j]!='U'&&a[j]!='Y')) b=count+1;\n }\n else break;\n }\n }\n if(max<count) max=count;\n }\n if(max<b) max=b;\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch[101];\n char voy[6]={'A','E','I','O','U','Y'};\n int i,k,h,c,j,s=0;\n scanf(\"%s\",&ch);\n k=1;\n i=0;\n h=1;\n while(i<strlen(ch)){\n\n c=0;\n for(j=0;j<6;j++){\n if(voy[j]==ch[i]){\n c=1;\n break;\n }\n }\n if(c==0){\n h=h+1;\n s=s+1;\n }\n else {\n if(h>k){\n k=h+1;\n\n }\n h=0;\n s=0;\n }\n i=i+1;\n }\n if((c==0)&&(k<h)){\n k=k+s;\n }\n\n\n printf(\"%d\",k);\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char arr[100];\n int i,kA,ke,k=0;\n scanf(\"%[^\\n a-z]\",arr);\n kA=0;\n i =0;\n while(arr[i]!='\\0')\n {\n\n if (arr[i]== 'A' ||arr[i]== 'E'||arr[i]== 'I'||arr[i]== 'O'||arr[i]== 'U'||arr[i]=='Y')\n {\n k++;\n ke =k;\n if(kA<ke)\n kA=ke;\n k=0;\n }\n else\n k++;\n i++;\n }\n\n printf(\"%d\\n\",kA);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[101];\n\tscanf(\"%s\",str);\n\tint i,j=0;\n\tint max=1;\n\tif(strlen(str)==1&&(str[j]!='A'&&str[j]!='E'&&str[j]!='I'&&str[j]!='O'&&str[j]!='U'&&str[j]!='Y'))max=2;\n\tint flag=0;\n\n\tfor(i=0;i<strlen(str);i++)\n\t{\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t{\n\t\tflag=1;\n\t\t//printf(\"%d\",flag);\n\t\tfor(j=i+1;j<strlen(str);j++)\n\t\t{\n\t\t\tif(str[j]=='A'||str[j]=='E'||str[j]=='I'||str[j]=='O'||str[j]=='U'||str[j]=='Y'||j==strlen(str)-1)\n\t\t\t{\n\t\t\t\tif(j-i>max)max=j-i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t}\n\t}\n\tif(flag==0)max=strlen(str)+1;\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<ctype.h> \n\nchar paper[101];\nint dis[101];\n\nint main(void)\n{\n\tint r,s = 0,n,rr;\n\tscanf(\"%s\",paper);\n\tn = strlen(paper);\n\n\tif(panduan(n,paper) == 0)\n\t{\n\t\tprintf(\"%d\",n);\n\t}\n\telse\n\t{\n\t\t\tfor(r = 0;r < n;r++)\n\t\t{\t\n\t\t\tif( paper[r] == 65 || paper[r] == 69 || paper[r] == 73 || paper[r] == 79 || paper[r] == 85 || paper[r] == 89 )\n\t\t\t{\n\t\t\t\tdis[s] = r + 1;\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t\t;\n\t\t} \n\t\t\n\t\tprintf(\"%d\",farthest(s,dis));\n\t}\n\n\t\t\n\t\t\n\t\n\n\treturn 0;\n}\n\nint farthest(int n,int a[])\n{\n\tint x = 1,i;\n\tfor(i = 0;i < n-1;i++){\n\t\tif(fabs(a[i] - a[i+1]) > x)\n\t\t{\n\t\t\tx = fabs(a[i] - a[i+1]);\n\t\t}\n\t\telse\n\t\t\t;\n\t}\n\t\n\treturn x;\n}\n\nint panduan(int c,char b[])\n{\n\tint ii,buer=0;\n\tfor(ii = 0;ii < c;ii++)\n\t{\n\t\tif(b[ii]==65||b[ii]==69||b[ii]==73||b[ii]==79||b[ii]==85||b[ii]==89)\n\t\t\tbuer++;\n\t\telse\n\t\t\t;\n\t}\n\treturn buer;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,t=1,sry;\nint max(int x,int y)\n{\n if(x>y)\n return x;\n return y;\n}\nchar srx[1001];\nint main()\n{\n scanf(\"%s\",srx);\n for(i=0;i<=strlen(srx);i++)\n {if(srx[i]=='A'||srx[i]=='E'||srx[i]=='I'||srx[i]=='O'||srx[i]=='U'||srx[i]=='Y')\n {sry=max(t-i,sry);\n t=i;}}\n if(sry!=strlen(srx))\n sry=max(sry,strlen(srx)+1-t);\n printf(\"%d\",sry);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a = 1,b,i,max = 0;\n char x[100];\n gets(x);\n b = strlen(x);\n for(i = 0; i<b; i++) {\n if(x[i] == 'A' || x[i] == 'E' || x[i] == 'I' || x[i] == 'O' || x[i] == 'U') {\n if(a>max) {\n max = a;\n }\n a = 1;\n } else {\n a++;\n }\n }\n if(max<a) {\n max = a;\n }\n printf(\"%d\\n\", max);\n}\n"}, {"source_code": "//codeforces problem\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint isvowel(char ch)\n{\n if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='Y')\n return 1;\n return 0;\n\n}\nint main()\n{\n //grasshopper and the string\n char s[101];\n scanf(\"%s\",s);\n\n int l=strlen(s);\n int jump=0;\n int i;\n for(i=0;i<l;)\n {\n if(isvowel(s[i]))\n {\n int j=i+1,co=0;\n if(j<l&&isvowel(s[j]))\n {\n co=1;\n }\n else\n while(j<l&&!isvowel(s[j]))\n {\n j++;\n co++;\n }\n //printf(\"From %c to %c\\n\",s[i],s[j]);\n i=j;\n //printf(\"Jump=%d\\n\",co);\n if(co>=jump)\n {if(co==1)\n jump=co;\n else\n jump=co+1;}\n //printf(\"New jump %d\\n\",jump);\n }\n else\n i++;\n }\n if(jump==0)\n jump=l+1;\n printf(\"%d\\n\",jump);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tchar a[100];int i,count=0,max=0,length=0;\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{\n\t\tlength++;\n\tif((a[i]=='A') || (a[i]=='E') || (a[i]=='I') || (a[i]=='O') || (a[i]=='U') || (a[i]=='Y'))\n\t{\n\t\tcount++;\n\t\tif(count>max)\n\t\t{\n\t\t\tmax=count;\n\t\t}\n\tcount=0;\n\t}\n\telse count++;\n\t}\n\tif(max==0)\n\tprintf(\"%d\",(length+1));\n\telse printf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[105];\n int i,j,k=0,a,b,c,len;\n scanf(\"%s\",s);\n len=strlen(s);\n int ar[len];\n for(i=0;i<len;i++)\n ar[i]=0;\n for(i=0;i<len;i++){\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' ||s [i]=='U' || s[i]=='Y'){\n if(k==0){\n ar[k++]=i+1;\n }\n for(j=i+1;j<len;j++)\n {\n if(s[j]=='A' || s[j]=='E' || s[j]=='I' || s[j]=='O' || s[j]=='U' || s[j]=='Y'){\n ar[k++]=j-i;\n b=j;\n break;}\n }\n }\n\n\n\n }\n ar[k++]=len-b;\n c=ar[0];\n for(i=1;i<len;i++){\n if(c<ar[i])\n c=ar[i];\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "//codeforces problem\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint isvowel(char ch)\n{\n if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='Y')\n return 1;\n return 0;\n\n}\nint main()\n{\n //grasshopper and the string\n char s[101];\n scanf(\"%s\",s);\n int l=strlen(s);\n int jump=0;\n int i;\n for(i=0;i<l;)\n {\n if(isvowel(s[i]))\n {\n int j=i+1,co=0;\n do\n {\n j++;\n co++;\n }while(j<l&&!isvowel(s[j]));\n i=j;\n\n if(co>jump)\n if(co==1)\n jump=co;\n else\n jump=co+1;\n }\n else\n i++;\n }\n if(jump==0)\n jump=2;\n printf(\"%d\\n\",jump);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,i,j,k,l=0;\n char c[4000];\n scanf(\"%s\",&c);\n n=strlen(c);\n for(i=0;i<n;i++){\n if(c[i]=='A' || c[i]=='E' || c[i]=='I' || c[i]=='O' || c[i]=='U'){\n k=0;\n for(j=i+1;j<=n;j++){\n k++;\n if(j==n)\n break;\n if(c[j]=='A' || c[j]=='E' || c[j]=='I' || c[j]=='O' || c[j]=='U')\n break;\n }\n if(k>l)\n l=k;\n }\n }\n printf(\"%d\",l);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int dif, maxdif, l, i, j, flag=0, firstbound, lastbound;\n char arr[101];\n scanf(\"%s\", arr);\n l=strlen(arr);\n\n char indexcol[l];\n for(i=0,j=0;i<l;i++)\n {\n if(arr[i]=='A' || arr[i]=='E' || arr[i]=='I' || arr[i]=='O' || arr[i]=='U' || arr[i]=='Y')\n {\n indexcol[j]=i;\n flag=1;\n j++;\n }\n }\n maxdif=1;\n for(i=1;i<j;i++)\n {\n dif=indexcol[i]-indexcol[i-1];\n if(dif>maxdif) maxdif=dif;\n }\n firstbound=indexcol[0];\n lastbound=l-indexcol[j-1];\n if(lastbound<firstbound) lastbound=firstbound;\n if(maxdif>=lastbound && flag==1) printf(\"%d\", maxdif);\n else if(maxdif<lastbound && flag==1) printf(\"%d\", lastbound);\n else if(flag==0) printf(\"%d\", l+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a[150],b[150],j,max,i,count=0;\n char ch[150];\n scanf(\"%s\",ch+1);\n for(i=1;i<=strlen(ch);i++)\n {\n if(ch[i]=='A' || ch[i]=='E' || ch[i]=='O' || ch[i]=='I' || ch[i]=='U' || ch[i]=='Y')\n {\n count++;\n a[count]=i;\n }\n }\n for(i=1;i<count;i++)\n {\n b[i]=a[i+1]-a[i];\n }\n max=b[1];\n for(j=2;j<=count-1;j++)\n if(max<b[j])\n max=b[j];\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// 'A', 'E', 'I', 'O', 'U' and 'Y'.\n#define is_vowel(c) ((c) == 'A' || (c) == 'E' || (c) == 'I' || (c) == 'O' \\\n || (c) == 'U' || (c) == 'Y' )\n\nint main() {\n char str[101];\n scanf(\"%s\", str);\n\n int step = 1, i = 0, len = strlen(str);\n while (i < len && is_vowel(str[i])) i++;\n for (;i < len;) {\n if (is_vowel(str[i])) {\n step++;\n while (i < len && is_vowel(str[i])) i++;\n }\n while (i < len && !is_vowel(str[i])) i++;\n }\n printf(\"%d\\n\", step);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int i,n,prev=0,max=0;\n char s[100];\n gets(s);\n n=strlen(s);\n for(i=0;i<n;i++){\n if(s[i]=='A' ||s[i]=='E' ||s[i]=='I' ||s[i]=='O' ||s[i]=='U'||s[i]=='Y'){\n if(i-prev>max){\n max=i-prev;\n }\n prev=i;\n }}\n \n printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[120];\n int n=0,p=0,pos1=0,pos2=1,i;\n gets(s+1);\n for (i=0 ; i<strlen(s) ; i++)\n {\n if ((s[i]=='O') || (s[i]=='I') || (s[i]=='Y') || (s[i]=='E') || (s[i]=='A') || (s[i]=='U'))\n {\n pos2=i;\n if (p<(pos2-pos1))\n p=pos2-pos1;\n pos1=i;\n }\n }\n if (p==0)\n p=strlen(s);\n printf(\"%d\",p);\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// 'A', 'E', 'I', 'O', 'U' and 'Y'.\n#define is_vowel(c) ((c) == 'A' || (c) == 'E' || (c) == 'I' || (c) == 'O' \\\n || (c) == 'U' || (c) == 'Y' )\n\nint main() {\n char str[101];\n scanf(\"%s\", str);\n\n int step = 1, i = 1, len = strlen(str);\n for (;i < len;) {\n if (is_vowel(str[i])) {\n if (!(i == 1 && is_vowel(str[0]))) step++;\n while (i < len && is_vowel(str[i])) i++;\n }\n while (i < len && !is_vowel(str[i])) i++;\n }\n printf(\"%d\\n\", step);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <string.h>\n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i<strlen(ch)){\n\t\tif(ch[i]<65 ||ch[i]>91) {\n\t\n\t\t\n\t\treturn 1;\t\t\n\t\t}\ni++;\t}\n\t\n\treturn 0;\n}\n\nint main(){\n \nchar ch[10000];\n\n\n do{\ngets(ch);\t\n }while (notupper(ch) ||*ch=='\\n') ;\n\n\nint max=0,j=0;\nint i;\nfor( i=0;i<strlen(ch);i++){\n\tif (j>max){\n \tmax=j;\n\t\t\t\t\n\t\t\t} \n\tif(ch[i]=='I'||ch[i]=='Y'||ch[i]=='O'||ch[i]=='U'||ch[i]=='E'||ch[i]=='A')\n\t{\n\t\n\t\tj=1;\n\t\n\t\t\n\t\t\n\t}else{\n\t\tif(j!=0){\n\t\t\tj++;\n\t\t}\n\t\n \n\t\t\t\n\t\t\n\t}\n\t\n\t\t\n}\nif(max==0)\nprintf(\"%d\",max+strlen(ch)+1);\nelse\nprintf(\"%d\",max);\n\n\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint is_vowels(char carac);\n\nint main(int argc, char const *argv[])\n{\n\tint j,s=1,max = 1,i=0;\n\tchar carac;\n\twhile((j=scanf(\"%c\",&carac) != EOF) && j != feof )\n\t{\n \ti++;\n \tif (is_vowels(carac) ) \n \t{\n \t\tif(s > max) max = s;\n \t\ts=1;\n \t}\n \telse s++;\n\t \n\t}\n\tprintf(\"s=%d\\ti=%d\\tmax=%d\\t\",s,i, max);\n\tif(i == 1 && s > max) max = s;\n\tprintf(\"%d\\n\", max);\n}\nint is_vowels(char carac)\n{\n\tif (carac == 'A' || carac == 'E' || carac == 'I' ||\n\t\tcarac == 'O' || carac == 'U' || carac == 'Y' )\n\treturn 1 ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[105];\n int i,j,k,len,max=0,dis=0,start=0,end=0,flag=0;\n scanf(\"%s\",a);\n len=strlen(a);\n for(i=0;i<len;i++)\n {\n if(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y')\n { end=i+1;\n dis=end-start;\n if(dis>max)max=dis;\n start=end;flag=1;\n }\n }\n if(flag==0)printf(\"%d\\n\",len+1);\n else printf(\"%d\\n\",max);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nchar a[101];\nint d[101];\n\n\nint v_c(char ch){\n\tswitch(ch)\n\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\tcase '\\0':\n\n\t\t\t\treturn 1;\n\t\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t return 0;\n\t}\n}\n\n\n\nint main(){\n\tfflush(stdin);\n\tgets(a);\n\tint i,j,alien = 2,dist = 0,temp = 0,k=0;\n\tfor(i=0;i<strlen(a)-1;i++){\n\t\ttemp = dist;\n\t\tchar ch = a[i];\n\t\tif(v_c(ch)==1){\n\t\t\tfor(j=i+1;j<strlen(a)+1;j++){\n\t\t\t\tchar ch1 = a[j];\n\t\t\t\tif(v_c(ch1)==1){\n\t\t\t\t\tdist = j-i;\n\t\t\t\t\td[k] = dist;\n\t\t\t\t\tk++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(v_c(ch) == 0){\n\t\t\talien++;\n\t\t}\n\t}\n\n\n\n\tint maximum = d[0],c;\n for (c = 1; c < 101; c++){\n if (d[c] > maximum){\n maximum = d[c];\n }\n }\n\n\tif(maximum > 0){\n\t\tprintf(\"%d\",maximum);\n\t}\n\telse{\n\t\tprintf(\"%d\",alien);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tchar a[100];int i,count=0,max=0,length=0;\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{\n\t\tlength++;\n\tif((a[i]=='A') || (a[i]=='E') || (a[i]=='I') || (a[i]=='O') || (a[i]=='U') || (a[i]=='Y'))\n\t{\n\t\tcount++;\n\t\tif(count>max)\n\t\t{\n\t\t\tmax=count;\n\t\t}\n\tcount=0;\n\t}\n\telse count++;\n\t}\n\tif(max==0)\n\tprintf(\"%d\",(length+1));\n\telse printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nchar s[105];\nint main()\n{\n int n,i,last=-1,max=-1;\n gets(s);\n n=strlen(s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y')\n {\n if(i-last>max)\n max=i-last;\n last=i;\n }\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tint i ,j=0 ,l,k,tr[1000],c=0,max;\n\tchar ar[10005],yr[1050];\n\tgets(ar);\n\tyr[0]='S';\n\tfor(i=0;ar[i]!='\\0';i++)\n\t{\n\t\tyr[i+1]=ar[i];\n\t}\n\tyr[strlen(ar)+1]='S';\n\tyr[strlen(ar)+2]='\\0';\n\n\t//puts(yr);\n\tfor(i=0;yr[i]!=0;i++)\n\t{\n\t\t\n\t\tif(yr[i]=='A'||yr[i]=='O'||yr[i]=='Y'||yr[i]=='I'||yr[i]=='E'||yr[i]=='U')\n\t\t{\n\t\t\ttr[j]=c;\n\t\t\tc=0;\n\t\t\tj++;\n\t\t}\n\t\tc++;\n\t}\n\tmax=tr[0];\n\tfor(i=0;i<j;i++)\n\t{\n\t\tif(max<tr[i])\n\t\t\tmax=tr[i];\n\t}\n\tif(max==0)\n\t\tprintf(\"%d\\n\",c-1 );\n\telse\n\tprintf(\"%d\\n\",max );\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tchar a[102];\n\tint n,i,arr[102],p,min=1;\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tp=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='A' | a[i]=='E' | a[i]=='I' | a[i]=='O' | a[i]=='U' | a[i]=='Y')\n\t\t{\n\t\t\tarr[p]=i;\n\t\t\tp++;\n\t\t}\n\t}\n\tfor(i=1;i<p;i++)\n\t{\n\t\tif(arr[i]-arr[i-1]>=min)\n\t\t\tmin=arr[i]-arr[i-1];\n\t}\n\tprintf(\"%d\\n\",min);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar a;\n\tint max=0,d,i,j; // A B A B B B A C F E Y U K O T T \n\t // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18\n\ti=1;\n\tj=1;\n\tdo{\n\t\ti++;\n\t\tscanf(\"%c\",&a);\n\t\tif(a=='A' || a=='E' || a=='I' || a=='O' || a=='U' || a=='Y'){\n\t\t\td=i-j;\n\t\t\tif(d>max){\n\t\t\t\tmax=d;\n\t\t\t}\n\t\t\tj=i;\n\t\t}\n\t\t\n\t}while(a!='\\n');\n\tif(j==1){\n\t\tmax=i-j;\n\t\tprintf(\"%d\",max);\n\t}else{\n\t\tprintf(\"%d\",max);\n\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int dif, maxdif, l, i, j;\n char arr[101];\n scanf(\"%s\", arr);\n l=strlen(arr);\n char indexcol[l];\n for(i=0,j=0;i<l;i++)\n {\n if(arr[i]=='A' || arr[i]=='E' || arr[i]=='I' || arr[i]=='O' || arr[i]=='U' || arr[i]=='Y')\n {\n indexcol[j]=i;\n j++;\n }\n }\n maxdif=1;\n for(i=1;i<j;i++)\n {\n dif=indexcol[i]-indexcol[i-1];\n if(dif>maxdif) maxdif=dif;\n }\n printf(\"%d\", maxdif);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) \\\n ({ __typeof__ (a) _a = (a); \\\n __typeof__ (b) _b = (b); \\\n _a > _b ? _a : _b; })\nint main(){\nint l,jum=1,n;\nchar arr[100];\nscanf(\"%s\",&arr);\nl=strlen(arr);\nfor(int i=0;i<l;i++){\n n=1;\n while(arr[i]!='A'&&arr[i]!='E'&&arr[i]!='I'&&arr[i]!='O'&&arr[i]!='U'){\n n++;\n i++;\n if(i==l)\n break;\n }\n if(n>jum)\n jum=n;\n}\nprintf(\"%d\\n\",jum);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n int i,j,k=0,max,arr[200],l,s=0,c=0,rahat=0,con=0;\n char x[1000];\n scanf(\"%s\",&x);\n l= strlen(x);\n for(i=0;i<l;i++){\n if(x[i]=='A'||x[i]=='I'||x[i]=='E'||x[i]=='O'||x[i]=='U'||x[i]=='Y'){\n arr[k]=c;\n k++;\n c=0;\n rahat=1;\n }\n else {\n con++;\n c++;\n }\n }\n max=arr[0];\n for(i=0;i<k;i++){\n if(arr[i]>=max){\n max=arr[i];\n }\n }\n if(rahat==0){\n printf(\"%d\\n\",con+1);\n\n }\n else {\n printf(\"%d\\n\",max+1);\n\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void){\n \n int jump=1;\n char string[115];\n int max_jump=1;\n\n scanf(\"%s\", string);\n\n for(int i=0; i<strlen(string);i++){\n if(string[i]=='A' || string[i]=='E' || string[i]== 'I' || string[i] == 'O' || string[i] == 'U'){\n jump=1;\n continue;\n }\n jump+=1;\n if(max_jump<jump){\n max_jump=jump;\n }\n }\n\n printf(\"%d\\n\", max_jump);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint is_vowels(char carac);\n\nint main(int argc, char const *argv[])\n{\n\tint j,s=1,max = 1,i=0;\n\tchar carac;\n\twhile((j=scanf(\"%c\",&carac) != EOF) && j != feof )\n\t{\n \ti++;\n \tif (is_vowels(carac) ) \n \t{\n \t\tif(s > max) max = s;\n \t\ts=1;\n \t}\n \telse s++;\n\t \n\t}\n\t\n\tif(i == 1 && s > max) max = s;\n\tprintf(\"%d\\n\", max);\n}\nint is_vowels(char carac)\n{\n\tif (carac == 'A' || carac == 'E' || carac == 'I' ||\n\t\tcarac == 'O' || carac == 'U' || carac == 'Y' )\n\treturn 1 ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n\nint count=0;\nint i;\nchar s[100];\nint ara[101];\ngets(s);\nint start=0;\nint len=strlen(s);\nfor(i=0;i<len;i++)\n{\n if(start==0){\n if(s[i]!='A'&&s[i]!='U'&&s[i]!='E'&&s[i]!='O'&&s[i]!='I')\n {\n start=0;\n ara[i]=0;\n\n }}\n\n if(s[i]=='A' ||s[i]=='U' ||s[i]=='E' ||s[i]=='O' ||s[i]=='I')\n {\n start=1;\n ara[i]=count;\n count=0;\n count++;\n ara[i+1]=count;\n\n }\n\nelse if(start==1){\n if(s[i]!='A' ||s[i]!='U' ||s[i]!='E' ||s[i]!='O' ||s[i]!='I')\n{\n\n count++;\n ara[i+1]=count;\n}}\n\n if(s[len-1] !='A'&& s[len-1] !='U'&& s[len-1] !='E'&& s[len-1] !='O'&&s[len-1]!='I')\n {\n count=0;\n}\n}\nint max=0;\nfor(i=0;i<len+1;i++)\n{\n if(max<ara[i]){\n max=ara[i];\n }\n\n}\nprintf(\"%d\\n\",max);\n\n}\n"}, {"source_code": "#include <Stdio.h>\n#include <string.h>\n\nint main() {\n\tchar str[100];\n\tscanf(\"%s\",str);\n\tint len=strlen(str);\n\tint ans=0;\n\tint i;\n\tint d;\n\tint current=-1;\n\tfor(i=0;i<len;i++){\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y'){\n\t\t\td=i-current;\n\t\t//\tprintf(\"ans=%d,d=%d\\n\",ans,d);\n\t\t\tif(d>ans){\n\t\t\t\tans=d;\n\t\t//\t\tprintf(\"a=%d\\n\",ans);\n\t\t\t}\n\t\t\tcurrent=i;\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[101];\n scanf(\"%s\",s);\n\tint l=strlen(s);\n\tint n=0,m=0,d=0,w=0,i;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\t{\n\t\t\tm=i;\n\t\t\td=m-n;\n\t\t}\n\t\tn=m;\n\t\tif(d>=w)\n\t\t{\n\t\t\tw=d;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",w);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar string[101];\n\tscanf(\"%s\",string);\n\tint len=strlen(string);\n\tint i;\n\tint x=0,maxJump=0;\n\tfor(i=0;i<len;i++)\n\t{\n\t\tswitch(string[i])\n\t\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\t\tif(i-x>maxJump)\n\t\t\t\t\t maxJump=i-x;\n\t\t\t\tx=i;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t break;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\",maxJump);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,p=0,q,z,max=0;\n char a[102];\n scanf(\"%s\", &a);\n if (strlen(a)==1) printf(\"0\");\n else{\n for (i=0; i<strlen(a); i++){\n if (a[i]=='A' || a[i]=='E'|| a[i]=='I' || a[i]== 'O' || a[i]== 'U' || a[i]== 'Y' ){\n p=i;\n break;\n }\n }\n for (j=i; j<strlen(a); j++){\n if (a[j]=='A' ||a[j]=='E'|| a[j]=='I' || a[j]== 'O' || a[j]== 'U' || a[j]== 'Y' ){\n q=p;\n p=j;\n z=p-q;\n }\n if (z>=max) max=z;\n else max=max;\n }\n printf(\"%d\", max);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// 'A', 'E', 'I', 'O', 'U' and 'Y'.\n#define is_vowel(c) ((c) == 'A' || (c) == 'E' || (c) == 'I' || (c) == 'O' \\\n || (c) == 'U' || (c) == 'Y' )\n\nint main() {\n char str[101];\n scanf(\"%s\", str);\n\n int step = 1, i = 0, len = strlen(str);\n while (i < len && is_vowel(str[i])) i++;\n for (;i < len;) {\n if (is_vowel(str[i])) {\n step++;\n while (i < len && is_vowel(str[i])) i++;\n }\n while (i < len && !is_vowel(str[i])) i++;\n }\n printf(\"%d\\n\", step);\n return 0;\n}\n"}, {"source_code": "//\n// 733a.c\n// \n//\n// Created by Stefanus Anggara on 11/11/16.\n//\n//\n\n#include <stdio.h>\n#include <string.h>\n\nint outputMax(int a, int b) {\n if (a > b) {\n return a;\n } else{\n return b;\n }\n}\n\nint main() {\n \n char input[109];\n int minJumpAbility = 0;\n int i, len, lastPost = -1;\n int distance;\n \n scanf(\"%s\", input);\n len = strlen(input);\n for (i = 0; i < len ; i++) {\n if (input[i] == 'A' ||\n input[i] == 'E' ||\n input[i] == 'I' ||\n input[i] == 'O' ||\n input[i] == 'U' ||\n input[i] == 'Y') {\n distance = i - lastPost;\n minJumpAbility = outputMax(minJumpAbility, distance);\n lastPost = i;\n }\n }\n if (minJumpAbility == 0) {\n printf(\"2\\n\");\n } else {\n printf(\"%d\\n\", minJumpAbility);\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int counter=-1,help=-1, last=-1;\n char str[101];\n scanf(\"%s\",str);\n for(int i=0; i<strlen(str); i++)\n {\n if(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y')\n {\n help=i;\n if(help-counter > last)\n {last=help-counter; counter=i;}\n else counter=i;\n }\n }\n if(last==-1) printf(\"%d\", strlen(str)+1);\n else printf(\"%d\", last);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[10000];\n int i,j,k[10000],max,count=0;\n scanf(\"%s\",s);\n for(i=0,j=0;s[i]!='\\0',j<104;i++,j++){\n if(s[i]>='A'&&s[i]<='Z')\n count++;\n if(s[i]=='A'||s[i]=='E'||s[i]=='O'||s[i]=='I'||s[i]=='U'){\n k[j]=count;\n count=0;\n }\n\n }\n max=k[0];\n for(i=0;i<104;i++){\n if(max<k[i])\n max=k[i];\n else max=max;\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[101];\n scanf(\"%s\",s);\n int j,k=1,max=-1;\n for (j=0;j<strlen(s);j++){\n if ((s[j]=='A')||(s[j]=='E')||(s[j]=='U')||(s[j]=='I')||(s[j]=='O')||(s[j]=='Y')){\n if (max<k)\n max=k;\n k=0;\n }\n k++;\n }\n if (max==-1)\n max=strlen(s);\n printf(\"%d\",max);\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int i, n=1, temp=1,m;\n char A[101];\n gets(A);\n m=strlen(A);\n for(i=0;i<m;i++)\n {\n if(A[i]!='A'&&A[i]!='E'&&A[i]!='I'&&A[i]!='O'&&A[i]!='U')\n temp++;\n if(temp>n)\n n=temp;\n if(A[i]=='A'||A[i]=='E'||A[i]=='I'||A[i]=='O'||A[i]=='U')\n {temp=1;}\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i,len,cnt=0,max=0;\n\tchar s[100];\n\tscanf(\"%s\",s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\t++cnt;\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y'){\n\t\t\tif(cnt>max)\n\t\t\t\tmax=cnt;\n\t\t\t\tcnt=0;\n\t\t}\n\t}\n\t\tif(cnt+1>max)\n\t\tmax=cnt;\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n char s[105]; int m=1,curr=-1;\n scanf(\"%s\",s);\n for (int i=0;s[i];i++)\n if (s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U') {\n if (i-curr>m) m=i-curr; \n curr=i;\n }\n printf(\"%d\\n\",m);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tchar a[100];int i,count=0,max=0;\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{\n\tif((a[i]=='A') || (a[i]=='E') || (a[i]=='I') || (a[i]=='O') || (a[i]=='U') || (a[i]=='Y'))\n\t{\n\t\tif(count>max)\n\t\t{\n\t\t\tcount++;\n\t\t\tmax=count;\n\t\t}\n\tcount=0;\n\t}\n\telse count++;\n\t}\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\n char str[100];\n int i,j=0,k=-1;;\n scanf(\"%s\",str);\n for(i=0,j=0; str[i]!='\\0';j++, i++){\n if(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y'){\n if(j>k){\n k=j;\n j=0;\n }\n }\n}\n\n printf(\"%d\\n\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int i,n,prev=0,max=1;\n char s[100];\n gets(s);\n n=strlen(s);\n for(i=0;i<n;i++){\n if(s[i]=='A' ||s[i]=='E' ||s[i]=='I' ||s[i]=='O' ||s[i]=='U'||s[i]=='Y' || s[i]=='\\0'){\n if(i-prev>max){\n max=i-prev;\n }\n prev=i;\n }}\n \n printf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char arr[100];\n int i,kA,ke,k=0;\n scanf(\"%[^\\n a-z]\",arr);\n kA=0;\n i =0;\n while(arr[i]!='\\0')\n {\n\n if (arr[i]== 'A' ||arr[i]== 'E'||arr[i]== 'I'||arr[i]== 'O'||arr[i]== 'U'||arr[i]=='Y')\n {\n k++;\n ke =k;\n if(kA<ke)\n kA=ke;\n k=0;\n }\n else\n k++;\n i++;\n }\n\n printf(\"%d\\n\",kA);\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int counter=-1,help=-1, last=-1, check=0, hello=0;\n char str[101];\n scanf(\"%s\",str);\n for(int i=0; i<strlen(str); i++)\n {\n if(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y')\n {\n help=i;\n if(help-counter > last)\n {last=help-counter; counter=i;}\n else counter=i;\n check++; hello=i;\n }\n }\n if(check==1) printf(\"%d\", (strlen(str)-hello));\n else if(last==-1) printf(\"%d\", strlen(str)+1);\n else printf(\"%d\", last);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define max(x,y)(x >= y)?x:y\nint main()\n{\n\tint n = 0;\n\tint length = 0;\n\tchar a[100];\n\tint b[100] = {0};\n\tint ability = 1;\n\tscanf(\"%s\",&a);\n\tfor(int i =0;i <= 99;i++)\n\t{\n\t\tif(a[i] == 'A' || a[i] == 'E' || a[i] == 'I' || a[i] == 'O' || a[i] == 'U' || a[i] == 'Y')\n\t\t{\n\t\t\tb[n] = i;\n\t\t\tn++;\n\t\t}\n\t}\n\tfor(;a[length] != '\\0';length++) ;\n\tif(n != 0){\n\tfor(int i =0;i <= 98;i++)\n\t{\n\t\tability = max(ability,(b[i + 1] - b[i]));\n\t}\n\tability = max(ability,(length - b[n - 1]));\n\tability = max(ability,(b[0] + 1));\n\tprintf(\"%d\",ability);\n\t} else \n\t{\n\t\tprintf(\"%d\",length + 1);\n}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n char a[1001];\n int b,jump,x,y;;\n scanf(\"%s\",a);\n b=strlen(a);\n x=0;\n jump=0;\n y=0;\n for(int i=-1 ; i<=b ; i++)\n {\n if(!(a[i]<='A'||a[i]=='I' ||a[i]=='U' ||a[i]=='E' ||a[i]=='O' ||a[i]=='Y' ))\n {\n x++;\n }\n else if((a[i]<='A'|| a[i]=='I' ||a[i]=='U' ||a[i]=='E' ||a[i]=='O' || a[i]=='\\0' ||a[i]=='Y'))\n {\n x++;\n y=x;\n if(jump<=x)\n jump=x;\n \n x=0;\n }\n } \n printf(\"%d\",jump);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tint i,j=1,b[100]={0},c=0,max=0;\n\tchar a[101];\n\tgets(a);\n\tb[0]=-1;\n\tfor(i=0;i<strlen(a);i++)\n\t{\n\t\tif(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n\t\t{ c++;\n\t\t\tb[j]=i;\n\t\t\tj++;\n\t\t}\t\n\t}\n\tprintf(\"\\n%d\\n\\n\",c);\n\tfor(i=0;i<c;i++)\n\t{\n\t\tif(b[i+1]-b[i]>max)\n\t\tmax=(b[i+1]-b[i]);\n\t}\n\tif((strlen(a)-b[c]-1)>max)\n\tmax=(strlen(a)-b[c]-1);\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[10000];\n int i,j,k[10000],max,count=0,m[26],c[105]={};\n scanf(\"%s\",s);\n for(i=0,j=0;s[i]!='\\0',j<104;i++,j++){\n if(s[i]>='A'&&s[i]<='Z')\n count++;\n if(s[i]=='A'||s[i]=='E'||s[i]=='O'||s[i]=='I'||s[i]=='U'||s[i]=='Y'){\n k[j]=count;\n count=0;\n }\n\n\n }\n max=k[0];\n for(i=0;i<104;i++){\n if(max<k[i])\n max=k[i];\n\n else max=max;\n }\n if(max==0)\n {\n count++;\n printf(\"%d\",count++);\n }\n else{\n printf(\"%d\",max);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint vowel_consonant(char ch){\n\tswitch(ch)\n\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\t\treturn 1;\n\t\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t return 0;\n\t}\n}\nint main(){\n\tchar a[110];\n\tfflush(stdin);\n\tgets(a);\n\tint i,count = -1;;\n\tfor(i=0;i<strlen(a);i++){\n\t\tint ch0 = a[i], ch1 = a[i+1];\n\t\tif(vowel_consonant(ch0) == 1 && vowel_consonant(ch1) == 0){\n\t\t\tcount++;\n\t\t}\n\t}\n\tint flag = 0;\n\tif(count>0){\n\t\tprintf(\"%d\",count);\n\t}\n\telse{\n\t\tfor(i=0;i<strlen(a);i++){\n\t\t\tchar c = a[i];\n\t\t\tif(vowel_consonant(c)==1){\n\t\t\t\tflag = 1;\n\t\t\t}\n\t\t\telse if(vowel_consonant(c)==0)\n\t\t\t\tflag = 2;\n\t\t}\n\t\tprintf(\"%d\",flag);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tchar a[102];\n\tint n,i,arr[102],p,min=1;\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tp=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='A' | a[i]=='E' | a[i]=='I' | a[i]=='O' | a[i]=='U' | a[i]=='Y')\n\t\t{\n\t\t\tarr[p]=i;\n\t\t\tp++;\n\t\t}\n\t}\n\tfor(i=1;i<p;i++)\n\t{\n\t\tif(arr[i]-arr[i-1]>=min)\n\t\t\tmin=arr[i]-arr[i-1];\n\t}\n\tprintf(\"%d\\n\",min);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <string.h>\n\n \nint notupper(char *ch) {\n\t\n\t int i=0;\n\twhile(i<strlen(ch)){\n\t\tif(ch[i]<65 ||ch[i]>91) {\n\t\n\t\t\n\t\treturn 1;\t\t\n\t\t}\ni++;\t}\n\t\n\treturn 0;\n}\n\nint main(){\n \nchar ch[100];\n\n\n do{\ngets(ch);\t\n }while (notupper(ch) ||*ch=='\\n') ;\n\n\nint max=0,j=0;\nint i;\nfor( i=0;i<strlen(ch);i++){\n\t\n\tif(ch[i]=='I'||ch[i]=='Y'||ch[i]=='O'||ch[i]=='U'||ch[i]=='E'||ch[i]=='A')\n\t{\n\t\n\t\tj=1;\n\t\n\t\t\n\t\t\n\t}else{\n\t\tif(j!=0){\n\t\t\tj++;\n\t\t}\n\t\n \n\t\t\t\n\t\t \n\t}\n\t\n\t\tif (j>max){\n \tmax=j;\n\t\t\t\t\n\t\t\t} \n}\nprintf(\"%d\",max);\n\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main(void) {\n\t\n\tchar s[100];\n\tscanf(\"%s\", s);\n\t\n\tint i, jump=1, j=strlen(s), flag=0;\n\tfor(i=strlen(s)-1; i>=0; i--) {\n\t\tif(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y') {\n\t\t\tflag++;\n\t\t\tif((j-i)>jump) {jump =(j-i);}\n\t\t\tj=i;\n\t\t} \n\t}\n\tif(flag==0){ printf(\"%d\", j); }\n\telse { printf(\"%d\", jump); }\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tint max=0,size,cur=0;\n\tchar s[120];\n\tscanf(\"%s\",s);\n\tsize = strlen(s);\n\tfor(int i=0;i<size;i++){\n\t\tcur++;\n\t\tswitch(s[i]){\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\t\tif(cur>max)\n\t\t\t\t\tmax=cur;\n\t\t\t\tcur=0;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",(cur>max)?cur:max);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char x[200];\n\n scanf(\"%s\", x);\n\n int i, ln, r, rf = 0, j;\n\n for(ln = 0; x[ln] != '\\0'; ln++);\n\n for(i = 0; i < ln; i++)\n {\n r = 0;\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"i = %d, r = %d, rf = %d, x[i] = %c\\n\", i, r, rf, x[i]);\n if((x[i] == 'A') || (x[i] == 'E') || (x[i] == 'I') || (x[i] == 'O') || (x[i] == 'U') || (x[i] == 'Y'))\n {\n r = 0;\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"i = %d, r = %d, rf = %d, x[i] = %c\\n\", i, r, rf, x[i]);\n for(j = i + 1; j < ln; j++)\n {\n if((x[j] == 'A') || (x[j] == 'E') || (x[j] == 'I') || (x[j] == 'O') || (x[j] == 'U') || (x[j] == 'Y'))\n {\n r = 0;\n break;\n }\n r = r + 1;\n if(rf <= r)\n {\n rf = r;\n }\n //printf(\"j = %d, r = %d, rf = %dx[j] = %c\\n\", j, r, rf, x[j]);\n }\n }\n }\n printf(\"%d\\n\", rf);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n char a[1001];\n int b,jump,x,y;;\n scanf(\"%s\",a);\n b=strlen(a);\n x=0;\n jump=0;\n y=0;\n for(int i=-1 ; i<=b ; i++)\n {\n if(!(a[i]<='A'||a[i]=='I' ||a[i]=='U' ||a[i]=='E' ||a[i]=='O' ||a[i]=='Y' ))\n {\n x++;\n }\n else if((a[i]<='A'|| a[i]=='I' ||a[i]=='U' ||a[i]=='E' ||a[i]=='O' || a[i]=='\\0' ||a[i]=='Y'))\n {\n x++;\n y=x;\n if(jump<=x)\n jump=x;\n \n x=0;\n }\n } \n printf(\"%d\",jump);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint l, t=-1, i, k, s=-1;\n\tchar str[101];\n\tscanf(\"%s\", str);\n\tl=strlen(str);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t{\n\t\t\tt=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tk=t;\n\tif(t==-1)\n\t{\n\t\tprintf(\"%d\", l+1);\n\t}\n\telse if(l==1 && t!=-1)\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\t{\n\t\tfor(i=t+1;i<l;i++)\n\t\t{\n\t\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t\t{\n\t\t\t\tif(i-k>s)\n\t\t\t\t{\n\t\t\t\t\ts=i-k;\n\t\t\t\t}\n\t\t\t\telse;\n\t\t\t\tk=i;\n\t\t\t}\n\t\t}\n\t\tif(s==-1)\n\t\t{\n\t\t\tprintf(\"%d\", l-k);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\", s);\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int n,a=0,d=0,i,jump=0,max=0,flag=0,p;\n char s[100010];\n gets(s);\n n=strlen(s);\n // printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n {\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' || s[i]=='O' || s[i]=='U' || s[i]=='Y' )\n {\n if(flag==0)\n {\n jump=i;\n max=jump;\n p=i;\n flag=1;\n\n }\n else\n {\n jump=i-p;\n if(jump>max) max=jump;\n p=i;\n\n }\n\n\n }\n\n\n }\n printf(\"%d\\n\",max);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,l,k=1,g=1;\n char S[101];\n gets(S);\n l=strlen(S);\n for(i=0;i<l;i++)\n {\n if(S[i]!='A'&&S[i]!='E'&&S[i]!='I'&&S[i]!='O'&&S[i]!='U')\n {\n k++;\n if(k>g)\n {\n g=k;\n }\n }\n else\n {\n k=1;\n }\n }\n printf(\"%d\\n\",g);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[1000];\n\tgets(str);\n\tint max1,jk,i,max=0,x=0,j,n=0,m=0,len=strlen(str);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U'||str[i]=='Y')\n\t\t{\n\t\t\t\n\t\t\tif(j==0)\n\t\t\t{\n\t\t\t\tn=i;\n\t\t\t\tj=1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tm=i;\n\t\t\t\tj=0;\n\t\t\t}\n\t\t\tif(m<n)\n\t\t\t{\n\n\t\t\t\tx=n-m;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tx=m-n;\n\t\t\t}\n\t\t\t\n\t\t\tif(max<x)\n\t\t\t{\n\t\t\t\tmax=x;\n\t\t\t}\n\t\tjk=i;\t\n\t\t}\n\t}\n\tmax1=len-jk-1;\n\tif(max<max1)\n\t{\n\t\tmax=max1;\n\t}\n\tprintf(\"%d\\n\",max);\n\t\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int counter=-1,help=-1, last=-1;\n char str[101];\n scanf(\"%s\",str);\n for(int i=0; i<strlen(str); i++)\n {\n if(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y')\n {\n help=i;\n if(help-counter > last)\n {last=help-counter; counter=i;}\n else counter=i;\n }\n }\n if(last==-1) printf(\"%d\", strlen(str)+1);\n else printf(\"%d\", last);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char ch[101];\n scanf(\"%s\", ch);\n int i, max=0, r=0;\n for(i=0; ch[i]; i++)\n {\n if(ch[i]=='A' || ch[i]=='E' || ch[i]=='I' || ch[i]=='O' || ch[i]=='U' || ch[i]=='Y')\n {\n r=(i+1)-r;\n if(i==r)\n r=(i+1)-r;\n if(r>max)\n {\n max=r;\n }\n r=i+1;\n }\n }\n\n if(max==0)\n printf(\"2\");\n else\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char s[102];\n scanf(\"%s\",s);\n int i=0,j=1,d,pos;\n while(s[i]!='A'&&s[i]!='E'&&s[i]!='I'&&s[i]!='O'&&s[i]!='U'&&s[i]!='Y'&&s[i]!='\\0')\n i++;\n if(i==strlen(s))\n {\n d=strlen(s)+1;\n printf(\"%d\",d);\n }\n else\n {\n int k;\n pos=i;\n d=i;\n for(k=i+1;s[k]!='\\0';k++)\n {\n if(s[k]=='A'||s[k]=='E'||s[k]=='I'||s[k]=='O'||s[k]=='U'||s[k]=='Y')\n {\n if(k-pos>d)\n d=k-pos;\n pos=k;\n }\n }\n if(k-pos>d)\n d=k-pos;\n printf(\"%d\",d);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n char name[101];\n gets(name);\n int i,j=0,k=0,d,m=0,r,n;\n for(i=0;name[i] != '\\0';i++)\n {\n k=i+1;\n if(name[i]=='A'||name[i]=='E'||name[i]=='I'||name[i]=='O'||name[i]=='U')\n {\n\n d=k-m;\n\n if(d>j)\n {\n j=k-m;\n }\n m=k;\n }\n\n }\n for(i=0;name[i]!='\\0';i++)\n {\n r=i+2;\n n=r-m;\n if(n>j)\n {\n j=n;\n }\n\n }\n printf(\"%d\",j);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char ch[100];\n int i=0,nb=0,j,s=0,ca ;\n\n gets(ch);\n\n while(i<strlen(ch))\n {\n if(ch[i]=='A' || ch[i]=='E' || ch[i]=='I'|| ch[i]=='O' || ch[i]=='U' || ch[i]=='Y')\n\n {s=i+1;\n for(j=i;j<strlen(ch);j++)\n {\n\n if(ch[j]=='A' || ch[j]=='E' || ch[j]=='I'|| ch[j]=='O' || ch[j]=='U' || ch[j]=='Y')\n {\n nb=j-i;\n i=j;\n if (nb>s)\n\n s=nb;\n\n }\n\n else\n s=strlen(ch)-i;\n\n }\n\n\n\n }\n\n\n i++;\n }\n\n\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{ int i,n,k=1,max=0;\nchar a[100];\n\n scanf(\"%s\",&a);\n n=strlen(a);\n for(i=0;i<n;)\n {if(a[i]=='A'||a[i]=='I'||a[i]=='O'||a[i]=='E'||a[i]=='U'||a[i]=='Y')\n {\n i=i+1;\n k=1;\n while(a[i]!='A'&&a[i]!='I'&&a[i]!='O'&&a[i]!='E'&&a[i]!='U'&&a[i]!='Y'&&i<n)\n {k++;\n i++;\n }if(k>max)\n max=k;\n }\n else\n i++;}\n printf(\"%d\",max);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,j=0,copy=0,sum[100],max;\n sum[0]=0;\n char st[100];\n scanf(\"%s\",st);\n for(i=0;st[i]!='\\0';i++)\n {\n if(st[i]=='A' || st[i]=='E' || st[i]=='I' || st[i]=='O' || st[i]=='U' || st[i]=='Y')\n {\n sum[j]=i-copy;\n copy=i;\n j++;\n }\n\n }\n sum[0]+=1;\n max=sum[0];\n sum[j]=i-copy;\n if(j==0)\n max+=sum[j];\n for(i=1;i<=j;i++)\n {\n if(max<sum[i])\n max=sum[i];\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main ()\n{\n char s[100];\n gets(s);\n int i,k=0,c,d=1;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='A' || s[i]=='E' || s[i]=='I' ||s[i]=='O' || s[i]=='U')\n {\n k=0;\n }\n else {k++;\n c=k;\n if(c>d) d=c;\n }\n }\n if(d==1)printf(\"%d\",1);\n else\n printf(\"%d\",d+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n char n[100],vowels[6]={'A','E','I','O','U','Y'};\n int c=0,res=0;\n scanf(\"%s\", &n);\n for(int i=0; i<strlen(n); i++){\n for(int j=0; j<6; j++){\n if(n[i]==vowels[j]){\n if(i-c+1>res){\n res=i-c+1;\n }\n c=i+1;\n break;\n }\n }\n }\n if(strlen(n)-c+1>=res){\n res=strlen(n)-c+1;\n printf(\"%i\", res);\n }\n return 0;\n};"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tint i,k=-1,l,d=0,a;\n\tchar s[101];\n\tgets(s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='Y')\n\t\t{\n\t\ta=i-k;\n\t\tk=i;\n\t\tif(a>d)\n\t\td=a;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",d);\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nmain()\n{\n int a,n,l=0,r,dis=0,max=0,i;\n char al[200];\n gets(al);\n for(i=0;i<strlen(al);i++)\n {\n if(al[i]=='A'||al[i]=='E'||al[i]=='O'||al[i]=='U'||al[i]=='I'||al[i]=='Y')\n {\n dis=(i-l);\n l=i;\n }\n if(dis>max)max=dis;\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,j,c,len,ch[101],MIN=100,k=0;\n char s[101];\n scanf(\"%s\",s);\n len=strlen(s);\n for(i=0,j=1,c=0;i<len;i++)\n {\n if((s[i]=='A') ||(s[i]=='E')|| (s[i]=='I') || (s[i]=='O') || (s[i]=='U') || (s[i]=='Y'))\n {\n ch[j]=i+1; c++; j++,k=1;\n }\n\n }\n if(k==0) {\n printf(\"2\\n\");\n return 0;\n }\n for(j=1;j<c;j++){\n\n MIN=ch[j+1]-ch[j];\n\n if(MIN>ch[1]) ch[1]=MIN;\n }\n printf(\"%d\\n\",ch[1]);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<ctype.h> \n\nchar paper[101];\nint dis[101];\n\nint main(void)\n{\n\tint r,s = 0,n,rr;\n\tscanf(\"%s\",paper);\n\tn = strlen(paper);\n\n\tif(panduan(n,paper) == 0)\n\t{\n\t\tprintf(\"%d\",n);\n\t}\n\telse\n\t{\n\t\t\tfor(r = 0;r < n;r++)\n\t\t{\t\n\t\t\tif( paper[r] == 65 || paper[r] == 69 || paper[r] == 73 || paper[r] == 79 || paper[r] == 85 || paper[r] == 89 )\n\t\t\t{\n\t\t\t\tdis[s] = r + 1;\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t\t;\n\t\t} \n\t\t\n\t\tprintf(\"%d\",farthest(s,dis));\n\t}\n\n\t\t\n\t\t\n\t\n\n\treturn 0;\n}\n\nint farthest(int n,int a[])\n{\n\tint x = 1,i;\n\tfor(i = 0;i < n-1;i++){\n\t\tif(fabs(a[i] - a[i+1]) > x)\n\t\t{\n\t\t\tx = fabs(a[i] - a[i+1]);\n\t\t}\n\t\telse\n\t\t\t;\n\t}\n\t\n\treturn x;\n}\n\nint panduan(int c,char b[])\n{\n\tint ii,buer=0;\n\tfor(ii = 0;ii < c;ii++)\n\t{\n\t\tif(b[ii]==65||b[ii]==69||b[ii]==73||b[ii]==79||b[ii]==85||b[ii]==89)\n\t\t\tbuer++;\n\t\telse\n\t\t\t;\n\t}\n\treturn buer;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tint i,j=1,b[100]={0},c=0,max=0;\n\tchar a[101];\n\tgets(a);\n\tb[0]=-1;\n\tfor(i=0;i<strlen(a);i++)\n\t{\n\t\tif(a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U'||a[i]=='Y')\n\t\t{ c++;\n\t\t\tb[j]=i;\n\t\t\tj++;\n\t\t}\t\n\t}\n\tprintf(\"\\n%d\\n\\n\",c);\n\tfor(i=0;i<c;i++)\n\t{\n\t\tif(b[i+1]-b[i]>max)\n\t\tmax=(b[i+1]-b[i]);\n\t}\n\tif((strlen(a)-b[c]-1)>max)\n\tmax=(strlen(a)-b[c]-1);\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,max;\n char a[120];\n int c=1,i,j=0,p[120];\n gets(a);\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]=='A' || a[i]=='E' || a[i]=='I' || a[i]=='O' || a[i]=='U' || a[i]=='Y')\n {\n p[j]=c;\n j++;\n c=1;\n }\n else\n {\n c++;\n }\n }\n p[j]=c;\n {\n max=p[0];\n for(i=1;i<j;i++)\n {\n if(p[i]>max)\n {\n max=p[i];\n }\n }\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char s[105];\n int i,l,jump=0,max=0,pos=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=1;i<=l;i++)\n {\n if(s[i-1]=='A' || s[i-1]=='E' || s[i-1]=='I' || s[i-1]=='O' || s[i-1]=='U' || s[i-1]=='Y' )\n {\n jump=i-pos;\n pos=i;\n if(jump>max)\n {\n max=jump;\n if(i==l)\n max+=1;\n }\n }\n else if(i==l)\n {\n jump=i-pos;\n if(jump>=max)\n max=jump+1;\n }\n\n }\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n=0, i, j=0;\n char a;\n getchar();\n for(i=1; a!='\\n'; i++)\n {\n a=getchar();\n if(a=='A' || a=='E' || a=='U' || a=='O' || a=='I' || a=='Y')\n {\n j=i-j;\n if(n<j)\n n=j;\n j=i;\n }\n }\n if(j==0)\n j=i-j;\n else\n j=i-j-1;\n\n if(n<j)\n n=j;\n printf(\"%d\", n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,p=0,q,z,max=0;\n char a[102];\n scanf(\"%s\", &a);\n for (i=0; i<strlen(a); i++){\n if (a[i]=='A' || a[i]=='E'|| a[i]=='I' || a[i]== 'O' || a[i]== 'U' || a[i]== 'Y' ){\n p=i+1;\n break;\n }\n }\n if (strlen(a)==1){\n printf(\"%d\\n\", p);\n }\n else{\n for (j=i; j<strlen(a); j++){\n if (a[j]=='A' ||a[j]=='E'|| a[j]=='I' || a[j]== 'O' || a[j]== 'U' || a[j]== 'Y' ){\n q=p;\n p=j+1;\n z=p-q;\n }\n if (z>=max) max=z;\n else max=max;\n }\n printf(\"%d\", max);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nchar a[101];\nint d[101];\n\n\nint v_c(char ch){\n\tswitch(ch)\n\t{\n\t\t\tcase 'A':\n\t\t\tcase 'E':\n\t\t\tcase 'I':\n\t\t\tcase 'O':\n\t\t\tcase 'U':\n\t\t\tcase 'Y':\n\t\t\tcase '\\0':\n\n\t\t\t\treturn 1;\n\t\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t return 0;\n\t}\n}\n\n\n\nint main(){\n\tfflush(stdin);\n\tgets(a);\n\tint i,j,alien = 2,dist = 0,temp = 0,k=0;\n\tfor(i=0;i<strlen(a)-1;i++){\n\t\ttemp = dist;\n\t\tchar ch = a[i];\n\t\tif(v_c(ch)==1){\n\t\t\tfor(j=i+1;j<strlen(a)+1;j++){\n\t\t\t\tchar ch1 = a[j];\n\t\t\t\tif(v_c(ch1)==1){\n\t\t\t\t\tdist = j-i;\n\t\t\t\t\td[k] = dist;\n\t\t\t\t\tk++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(v_c(ch) == 0){\n\t\t\talien++;\n\t\t}\n\t}\n\n\n\n\tint maximum = d[0],c;\n for (c = 1; c < 101; c++){\n if (d[c] > maximum){\n maximum = d[c];\n }\n }\n\n\tif(maximum > 0){\n\t\tprintf(\"%d\",maximum);\n\t}\n\telse{\n\t\tprintf(\"%d\",alien);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[101];\n\tscanf(\"%s\",str);\n\tint i,j;\n\tint max=0;\n\n\tfor(i=0;i<strlen(str);i++)\n\t{\n\n\t\tfor(j=i+1;j<strlen(str);j++)\n\t\t{\n\t\t\tif(str[j]=='A'||str[j]=='E'||str[j]=='I'||str[j]=='O'||str[j]=='U'||str[j]=='Y')\n\t\t\t{\n\t\t\t\tif(j-i>max)max=j-i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char s[105];\n int i,l,jump=0,max=0,pos=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=1;i<=l;i++)\n {\n if(s[i-1]=='A' || s[i-1]=='E' || s[i-1]=='I' || s[i-1]=='O' || s[i-1]=='U' || s[i-1]=='Y' )\n {\n jump=i-pos;\n pos=i;\n if(jump>max)\n max=jump;\n }\n\n }\n printf(\"%d\\n\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,count=0,r,q,t=0;\n char ch[101];\n gets(ch);\n for(i=0;i<strlen(ch);i++)\n {\n\n if(ch[i]=='A'||ch[i]=='E'||ch[i]=='I'||ch[i]=='O'||ch[i]=='U')\n {\n\n count=0;\n }\n count++;\n if(i==strlen(ch)||i==0){count++;}\n if(i==0&&(ch[1]=='A'||ch[1]=='E'||ch[1]=='I'||ch[1]=='O'||ch[1]=='U')&&strlen(ch)>=1){count--;}\n if(i==0) {r=count;\n q=r;}\n if(q<count){q=count;}\n\n\n\n }\n\n if (strlen(ch)==1&&(ch[0]=='A'||ch[0]=='E'||ch[0]=='I'||ch[0]=='O'||ch[0]=='U') )printf(\"%d\\n\",1);\n else if(strlen(ch)>=1)\n printf(\"%d\\n\",q);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[200];\n int a=-1,count=0,max=0,i;\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++){\n if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'){\n count=i-a;\n if(max<count)\n max=count;\n a=i;\n }\n }\n printf(\"%d\\n\",max);\n return 0;\n}\n"}], "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee"} {"nl": {"description": "You are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the longest of them.", "input_spec": "The first line of the input contains a single integer N (3\u2009\u2264\u2009N\u2009\u2264\u200910). The following N lines each contain N space-separated integers. jth integer in ith line aij is the length of the edge that connects vertices i and j. aij\u2009=\u2009aji, aii\u2009=\u20090, 1\u2009\u2264\u2009aij\u2009\u2264\u2009100 for i\u2009\u2260\u2009j.", "output_spec": "Output the maximum length of the shortest path between any pair of vertices in the graph.", "sample_inputs": ["3\n0 1 1\n1 0 4\n1 4 0", "4\n0 1 2 3\n1 0 4 5\n2 4 0 6\n3 5 6 0"], "sample_outputs": ["2", "5"], "notes": "NoteYou're running short of keywords, so you can't use some of them:definedoforforeachwhilerepeatuntilifthenelseelifelsifelseifcaseswitch"}, "positive_code": [{"source_code": "int N, A[11][11];\n\nint main() {\n scanf(\"%d\", &N);\n\n {\n\tint ri(int i) {\n\t int rj(int j) {\n\t\tj < N && ({\n\t\t\tscanf(\"%d\", &A[i][j]);\n\t\t\trj(j+1);\n\t\t\t});\n\t }\n\n\t i < N && ({\n\t\t rj(0);\n\t\t ri(i+1);\n\t\t });\n\t}\n\tri(0);\n }\n\n\n {\n\tint rk(int k) {\n\t int ri(int i) { \n\t\tint rj(int j) {\n\t\t j < N && ({\n\t\t\t A[i][j] > A[i][k] + A[k][j] && (A[i][j] = A[i][k] + A[k][j]);\n\t\t\t rj(j+1);\n\t\t\t });\n\t\t}\n\n\t\ti < N && ({\n\t\t\trj(0);\n\t\t\tri(i+1);\n\t\t\t});\n\t }\n\t k < N && ({\n\t\t ri(0);\n\t\t rk(k+1);\n\t\t });\n\t}\n\trk(0);\n }\n\n\n {\n\tint ans = 0;\n\tint ri(int i) {\n\t int rj(int j) {\n\t\tj < N && ({\n\t\t\tans < A[i][j] && (ans = A[i][j]);\n\t\t\trj(j+1);\n\t\t\t});\n\t }\n\n\t i < N && ({\n\t\t rj(0);\n\t\t ri(i+1);\n\t\t });\n\t}\n\tri(0);\n\tprintf(\"%d\\n\", ans);\n }\n\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nu G[10][10],n,r;\nvoid A(u i)\n{\n\t0<n?scanf(\"%u\",&G[i][0]),\n\t1<n?scanf(\"%u\",&G[i][1]),\n\t2<n?scanf(\"%u\",&G[i][2]),\n\t3<n?scanf(\"%u\",&G[i][3]),\n\t4<n?scanf(\"%u\",&G[i][4]),\n\t5<n?scanf(\"%u\",&G[i][5]),\n\t6<n?scanf(\"%u\",&G[i][6]),\n\t7<n?scanf(\"%u\",&G[i][7]),\n\t8<n?scanf(\"%u\",&G[i][8]),\n\t9<n?scanf(\"%u\",&G[i][9])\n\t:0:0:0:0:0:0:0:0:0:0;return;\n}\nvoid B()\n{\n\t0<n?A(0),1<n?A(1),2<n?A(2),3<n?A(3),\n\t4<n?A(4),5<n?A(5),6<n?A(6),7<n?A(7),\n\t8<n?A(8),9<n?A(9):0:0:0:0:0:0:0:0:0:0;return;\n}\nvoid F(u k,u j,u i)\n{\n\tu x=G[i][k]+G[k][j];\n\tG[i][j]=G[i][j]>x?x:G[i][j];\n\treturn;\n}\nvoid C(u k,u j)\n{\n\t0<n?F(k,j,0),1<n?F(k,j,1),2<n?F(k,j,2),3<n?F(k,j,3),\n\t4<n?F(k,j,4),5<n?F(k,j,5),6<n?F(k,j,6),7<n?F(k,j,7),\n\t8<n?F(k,j,8),9<n?F(k,j,9):0:0:0:0:0:0:0:0:0:0;return;\n\treturn;\n}\nvoid D(u k)\n{\n\t0<n?C(k,0),1<n?C(k,1),2<n?C(k,2),3<n?C(k,3),\n\t4<n?C(k,4),5<n?C(k,5),6<n?C(k,6),7<n?C(k,7),\n\t8<n?C(k,8),9<n?C(k,9):0:0:0:0:0:0:0:0:0:0;return;\n\treturn;\n}\nvoid E()\n{\n\t0<n?D(0),1<n?D(1),2<n?D(2),3<n?D(3),\n\t4<n?D(4),5<n?D(5),6<n?D(6),7<n?D(7),\n\t8<n?D(8),9<n?D(9):0:0:0:0:0:0:0:0:0:0;return;\n}\nvoid M(u i,u j){r=r<G[i][j]?G[i][j]:r;return;}\nvoid I(u i)\n{\n\t0<n?M(i,0),1<n?M(i,1),2<n?M(i,2),3<n?M(i,3),\n\t4<n?M(i,4),5<n?M(i,5),6<n?M(i,6),7<n?M(i,7),\n\t8<n?M(i,8),9<n?M(i,9):0:0:0:0:0:0:0:0:0:0;return;\n}\nvoid H()\n{\n\t0<n?I(0),1<n?I(1),2<n?I(2),3<n?I(3),\n\t4<n?I(4),5<n?I(5),6<n?I(6),7<n?I(7),\n\t8<n?I(8),9<n?I(9):0:0:0:0:0:0:0:0:0:0;return;\n}\nint main()\n{\n\tscanf(\"%u\",&n);\n\tB();E();H();\n\tprintf(\"%u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n, arr[20][20], ma=-1;\nint scan(int x)\n{\n scanf(\"%d\", &arr[x/n][x%n]);\n return x=x<n*n-1?scan(x+1):0;\n}\nint solve(int x)\n{\n int i, j, k;\n k=(x/n)/n;//00001111\n i=(x/n)%n;//00110011\n j=(x%n);//01010101\n arr[i][j]=arr[i][j]>arr[i][k]+arr[k][j]?arr[i][k]+arr[k][j]:arr[i][j];\n return x=x<n*n*n-1?solve(x+1):0;\n}\nint get_max(int x)\n{\n int i, j;\n i=x/n;\n j=x%n;\n ma=arr[i][j]>ma?arr[i][j]:ma;\n return x<n*n-1?get_max(x+1):0;\n}\nint main()\n{\n int i, j;\n scanf(\"%d\", &n);\n scan(0);\n solve(0);\n get_max(0);\n printf(\"%d\", ma);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint d[10][10];\nint N;\nint max=0;\n\nint read_in(int i, int j)\n{\n\treturn (i==N) ? (0) : \n\t\t((j==N) ? (read_in(i+1,0)) : ({scanf(\"%d\",&(d[i][j])); read_in(i,j+1);}));\n}\n\nint find_dist(int i, int j, int k)\n{\n\treturn (k==N) ? (0) : \n\t\t((i==N) ? (find_dist(0,0,k+1)) : \n\t\t\t((j==N) ? (find_dist(i+1,0,k)) : \n\t\t\t\t(\n\t\t\t\t\t{\n\t\t\t\t\t\t(d[i][j] > d[i][k]+d[k][j]) ? \n\t\t\t\t\t\t\t(d[i][j] = d[i][k] + d[k][j]) : (0); find_dist(i,j+1,k);\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t)\n\t\t);\n}\n\nint find_max(int i, int j)\n{\n\treturn (i == N) ? (0) :\n\t\t((j==N) ? (find_max(i+1,0)) : ({\n\t\t\t(d[i][j] > max) ? (max = d[i][j]) : (0);\n\t\t\tfind_max(i,j+1);\n\t\t\t}));\n}\n\nint main()\n{\n\tscanf(\"%d\", &N);\n\t\n\tread_in(0,0);\n\t//print_mat();\n\tfind_dist(0,0,0);\n\t//print_mat();\n\tfind_max(0,0);\n\tprintf(\"%d\\n\", max);\n}"}, {"source_code": "#include <stdio.h>\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nint mat[10][10];\n\n unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\n unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\n unsigned char FOR3(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\n unsigned char FOR2(const unsigned char i, const unsigned char j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\n unsigned char FOR1(const unsigned char i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\n unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst short N = (short) 10;\n\nshort n;\nint x;\nshort mat[10][10];\n\n short smin(const short a, const short b) { return a < b ? a : b; }\n short smax(const short a, const short b) { return a > b ? a : b; }\n\n short FOR3(const short k, const short i, const short j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\n short FOR2(const short i, const short j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\n short FOR1(const short i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\n short FOR_INPUT2(const short i, const short j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n short FOR_INPUT1(const short i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n short BILLY2(const short i, const short j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n short BILLY1(const short i) {\n short ans = BILLY2(i, 0);\n short other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst short N = (short) 10;\n\nshort n;\nshort mat[10][10];\n\n short smin(const short a, const short b) { return a < b ? a : b; }\n short smax(const short a, const short b) { return a > b ? a : b; }\n\n short FOR3(const short k, const short i, const short j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\n short FOR2(const short i, const short j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\n short FOR1(const short i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\n short FOR_INPUT2(const short i, const short j) {\n scanf(\"%hd\", &mat[i][j]);\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n short FOR_INPUT1(const short i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n short BILLY2(const short i, const short j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n short BILLY1(const short i) {\n short ans = BILLY2(i, 0);\n short other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%hd\", &n);\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[10][10];\n\n unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\n unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\n unsigned char FOR3(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR3(k, i, j + 1) : 0;\n}\n\n unsigned char FOR2(const unsigned char i, const unsigned char j) {\n FOR3(i, j, 0);\n return j + 1 < n ? FOR2(i, j + 1) : 0;\n}\n\n unsigned char FOR1(const unsigned char i) {\n FOR2(i, 0);\n return i + 1 < n ? FOR1(i + 1) : 0;\n}\n\n unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n FOR1(0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nint x;\nunsigned char mat[10][10];\n\n unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\n unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\nunsigned char FOR4(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR4(k, i, j + 1) :\n i + 1 < n ? FOR4(k, i + 1, 0) :\n k + 1 < n ? FOR4(k + 1, 0, 0) : 0;\n}\n\n unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &x);\n mat[i][j] = x;\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%d\", &x); n = x;\n FOR_INPUT1(0);\n // FOR1(0);\n FOR4(0, 0, 0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst int oo = (int)1e9;\nint n;\nint d[10][10];\nint ans = 0;\n\nint poop1(int i, int j)\n{\n\treturn i == n ? 0 : (\n\t\tj == n ? poop1(i + 1, 0) : (\n\t\t\tscanf(\"%d\", &d[i][j]) + poop1(i, j + 1)\n\t\t)\n\t);\n}\n\nint poop2(int i, int j, int k)\n{\n\treturn k == n ? 0 : (\n\t\ti == n ? poop2(0, 0, k + 1) : (\n\t\t\tj == n ? poop2(i + 1, 0, k) : (\n\t\t\t\t(d[i][j] = d[i][j] > d[i][k] + d[k][j] ? d[i][k] + d[k][j] : d[i][j])\n\t\t\t\t+ poop2(i, j + 1, k)\n\t\t\t)\n\t\t)\n\t);\n}\n\nint poop3(int i, int j)\n{\n\treturn i == n ? 0 : (\n\t\tj == n ? poop3(i + 1, 0) : (\n\t\t\t(ans = ans < d[i][j] ? d[i][j] : ans) + poop3(i, j + 1)\n\t\t)\n\t);\n}\n\nint main()\n{ \n\tscanf(\"%d\", &n);\n\n\tpoop1(0, 0);\n\tpoop2(0, 0, 0);\n\tpoop3(0, 0);\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\t\n"}], "negative_code": [{"source_code": "#define REP(i,n) for(i=0; i<(n); ++i)\n\nint N, A[11][11];\n\nint main() {\n scanf(\"%d\", &N);\n\n {\n\tint ri(int i) {\n\t int rj(int j) {\n\t\tj < N && ({\n\t\t\tscanf(\"%d\", &A[i][j]);\n\t\t\trj(j+1);\n\t\t\t});\n\t }\n\n\t i < N && ({\n\t\t rj(0);\n\t\t ri(i+1);\n\t\t });\n\t}\n\tri(0);\n }\n\n\n {\n\tint rk(int k) {\n\t int ri(int i) { \n\t\tint rj(int j) {\n\t\t j < N && ({\n\t\t\t A[i][j] > A[i][k] + A[k][j] && (A[i][j] = A[i][k] + A[k][j]);\n\t\t\t rj(j+1);\n\t\t\t });\n\t\t}\n\n\t\ti < N && ({\n\t\t\trj(0);\n\t\t\tri(i+1);\n\t\t\t});\n\t }\n\t k < N && ({\n\t\t ri(0);\n\t\t rk(k+1);\n\t\t });\n\t}\n\trk(0);\n }\n\n\n {\n\tint ans = 0;\n\tint ri(int i) {\n\t int rj(int j) {\n\t\tj < N && ({\n\t\t\tans < A[i][j] && (ans = A[i][j]);\n\t\t\trj(j+1);\n\t\t\t});\n\t }\n\n\t i < N && ({\n\t\t rj(0);\n\t\t ri(i+1);\n\t\t });\n\t}\n\tri(0);\n\tprintf(\"%d\\n\", ans);\n }\n\n\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint d[10][10];\nint N;\nint max=0;\n\nint read_in(int i, int j)\n{\n\treturn (i==N) ? (0) : \n\t\t((j==N) ? (read_in(i+1,0)) : ({scanf(\"%d\",&(d[i][j])); read_in(i,j+1);}));\n}\n\nint find_dist(int i, int j, int k)\n{\n\treturn (k==N) ? (0) : \n\t\t((i==N) ? (find_dist(0,0,k+1)) : \n\t\t\t((j==N) ? (find_dist(i+1,0,k)) : \n\t\t\t\t(\n\t\t\t\t\t{\n\t\t\t\t\t\t(d[i][j] > d[i][k]+d[k][j]) ? \n\t\t\t\t\t\t\t(d[i][j] = d[i][k] + d[k][j]) : (0); find_dist(i,j+1,k);\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t)\n\t\t);\n}\n\nint find_max(int i, int j)\n{\n\treturn (i == N) ? (0) :\n\t\t((j==N) ? (find_max(i+1,0)) : \n\t\t\t((d[i][j] > max) ? (max = d[i][j]) : (find_max(i,j+1))));\n}\n\nint main()\n{\n\tscanf(\"%d\", &N);\n\t\n\tread_in(0,0);\n\t//print_mat();\n\tfind_dist(0,0,0);\n\t//print_mat();\n\tfind_max(0,0);\n\tprintf(\"%d\\n\", max);\n}"}, {"source_code": "#include <stdio.h>\n\nconst unsigned char N = (unsigned char) 10;\n\nunsigned char n;\nunsigned char mat[10][10];\n\n unsigned char smin(const unsigned char a, const unsigned char b) { return a < b ? a : b; }\n unsigned char smax(const unsigned char a, const unsigned char b) { return a > b ? a : b; }\n\nunsigned char FOR4(const unsigned char k, const unsigned char i, const unsigned char j) {\n mat[i][j] = smin(mat[i][j], mat[i][k] + mat[k][j]);\n return j + 1 < n ? FOR4(k, i, j + 1) :\n i + 1 < n ? FOR4(k, i + 1, 0) :\n k + 1 < n ? FOR4(k + 1, 0, 0) : 0;\n}\n\n unsigned char FOR_INPUT2(const unsigned char i, const unsigned char j) {\n scanf(\"%d\", &mat[i][j]);\n return j + 1 < n ? FOR_INPUT2(i, j + 1) : 0;\n}\n\n unsigned char FOR_INPUT1(const unsigned char i) {\n FOR_INPUT2(i, 0);\n return i + 1 < n ? FOR_INPUT1(i + 1) : 0;\n}\n\n unsigned char BILLY2(const unsigned char i, const unsigned char j) {\n return smax(mat[i][j], j + 1 < n ? BILLY2(i, j + 1) : 0);\n}\n\n unsigned char BILLY1(const unsigned char i) {\n unsigned char ans = BILLY2(i, 0);\n unsigned char other = i + 1 < n ? BILLY1(i + 1) : 0;\n return smax(ans, other);\n}\n\nvoid solve() {\n scanf(\"%d\", &n);\n FOR_INPUT1(0);\n // FOR1(0);\n FOR4(0, 0, 0);\n printf(\"%d\\n\", BILLY1(0));\n}\n\nint main() {\n solve();\n return 0;\n}"}], "src_uid": "bbd210065f8b32de048a2d9b1b033ed5"} {"nl": {"description": "Vasya is an active Internet user. One day he came across an Internet resource he liked, so he wrote its address in the notebook. We know that the address of the written resource has format: <protocol>://<domain>.ru[/<context>] where: <protocol> can equal either \"http\" (without the quotes) or \"ftp\" (without the quotes), <domain> is a non-empty string, consisting of lowercase English letters, the /<context> part may not be present. If it is present, then <context> is a non-empty string, consisting of lowercase English letters. If string <context> isn't present in the address, then the additional character \"/\" isn't written. Thus, the address has either two characters \"/\" (the ones that go before the domain), or three (an extra one in front of the context).When the boy came home, he found out that the address he wrote in his notebook had no punctuation marks. Vasya must have been in a lot of hurry and didn't write characters \":\", \"/\", \".\".Help Vasya to restore the possible address of the recorded Internet resource.", "input_spec": "The first line contains a non-empty string that Vasya wrote out in his notebook. This line consists of lowercase English letters only. It is guaranteed that the given string contains at most 50 letters. It is guaranteed that the given string can be obtained from some correct Internet resource address, described above.", "output_spec": "Print a single line \u2014 the address of the Internet resource that Vasya liked. If there are several addresses that meet the problem limitations, you are allowed to print any of them.", "sample_inputs": ["httpsunrux", "ftphttprururu"], "sample_outputs": ["http://sun.ru/x", "ftp://http.ru/ruru"], "notes": "NoteIn the second sample there are two more possible answers: \"ftp://httpruru.ru\" and \"ftp://httpru.ru/ru\"."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n int i;\n char c[50];\n gets(c);\n if(c[0]=='h')\n {\n printf(\"http://\");\n printf(\"%c\",c[4]);\n for(i=5;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n else if((c[0]=='f'))\n {\n printf(\"ftp://\");\n printf(\"%c\",c[3]);\n for(i=4;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[51],char principio[56]);\nint buscarru(char *texto);\n\nint main ()\n{\n char texto[51];\n scanf(\"%s\",texto);\n texto[50]='\\0';\n char texto2[56]=\"\";\n link(texto,texto2);\n printf(\"%s\",texto2);\n return 0;\n}\n\nvoid link(char texto[51], char principio[56])\n{\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=buscarru(texto);\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru\");\n i=i+2;\n if(i<largo)\n strcatchar(principio,'/');\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n principio[55]='\\0';\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\nint buscarru(char *texto)\n{\n int largo=strlen(texto);\n int i,x=0;\n for(i=0;i<largo-1;i++)\n {\n if(texto[i]=='r' && texto[i+1]=='u')\n x=i;\n }\n return x;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100001],s1[10000];\n int i,j,k;\n gets(s);\n if (s[2]=='t')\n {\n for (i=0,j=0; i<4;i++,j++)\n {\n s1[j]=s[i];\n }\n s1[4]=':';\n s1[5]='/';\n s1[6]='/';\n j=7;\n for (i=4,j=7; ; i++)\n {\n if (s[i]=='r' && s[i+1]=='u' && i>4)\n {\n break;\n }\n else {\n s1[j]=s[i];\n j++;\n }\n }\n s1[j]='.';\n j++;\n s1[j]='r';\n j++;\n s1[j]='u';\n j++;\n if (s[i+2]!='\\0')\n {\n s1[j]='/';\n j++;\n for (k=i+2; k<strlen(s); k++)\n {\n s1[j]=s[k];\n j++;\n }\n }\n }\n else if (s[2]=='p')\n {\n for (i=0,j=0; i<3;i++,j++)\n {\n s1[j]=s[i];\n }\n s1[3]=':';\n s1[4]='/';\n s1[5]='/';\n j=6;\n for (i=3,j=6; ; i++)\n {\n if (s[i]=='r' && s[i+1]=='u' && i>3)\n {\n break;\n }\n else {\n s1[j]=s[i];\n j++;\n }\n }\n s1[j]='.';\n j++;\n s1[j]='r';\n j++;\n s1[j]='u';\n j++;\n if (s[i+2]!='\\0')\n {\n s1[j]='/';\n j++;\n for (k=i+2; k<strlen(s); k++)\n {\n s1[j]=s[k];\n j++;\n }\n }\n }\n s1[j]='\\0';\n puts(s1);\n }\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n\tchar s[111]={0};\n\tscanf(\"%s\",s);\n\tint i=0,c=0;\n\n\tif(s[0]=='h'){printf(\"http://\");\n\n\t\tfor(i=4;i<strlen(s);i++)\n\t\t{\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0&&i!=4)\n\t\t\t\t{\n\t\t\t\t\tif(s[i+2]!='\\0'){printf(\".ru/\");}\n\t\t\t\t\telse{printf(\".ru\");}\n\t\t\t\t\tc++;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\tif(s[0]=='f'){printf(\"ftp://\");\n\n\t\tfor(i=3;i<strlen(s);i++)\n\t\t{\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0&&i!=3)\n\t\t\t{\n\t\t\t\tif(s[i+2]!='\\0'){printf(\".ru/\");}\n\t\t\t\telse{printf(\".ru\");}\n\t\t\t\tc++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\n\t\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,band=1;\n char address[50];\n scanf(\"%s\", address);\n if(address[0]=='h' && strstr(address,\"http\") == address)\n {\n for(i = strlen(address); i >= 0; i--)\n {\n if(address[i]== 'r' && address[i+1]== 'u' && i > 4)\n {\n band = 0;\n printf(\"http://\");\n for(j = 4;j < i; j++ )\n {\n printf(\"%c\", address[j]);\n }\n printf(\".ru\");\n if( address[ i + 2 ] != '\\0')\n {\n printf(\"/\");\n for(j = i + 2; address[j] != '\\0'; j++)\n {\n printf(\"%c\",address[j]);\n }\n }\n break;\n }\n }\n }\n else if(address[0]=='f' && strstr(address,\"ftp\") == address)\n {\n for(i = strlen(address); i >= 0; i--)\n {\n if(address[i]== 'r' && address[i+1]== 'u' && i > 3)\n {\n band = 0;\n printf(\"ftp://\");\n for(j = 3;j < i; j++ )\n {\n printf(\"%c\", address[j]);\n }\n printf(\".ru\");\n if( address[ i + 2 ] != '\\0')\n {\n printf(\"/\");\n for(j = i + 2; address[j] != '\\0'; j++)\n {\n printf(\"%c\",address[j]);\n }\n }\n break;\n }\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nchar a[105];\nint main()\n{\n //freopen(\"159357.in\",\"r\",stdin);\n //freopen(\"159357.txt\",\"w\",stdout);\n int len,k,i,flag=0,t=0;\n gets(a);\n len=strlen(a);\n if(a[0]=='h')\n {printf(\"http://\");k=4;}\n if(a[0]=='f')\n {printf(\"ftp://\");k=3;}\n for(;k<=len-1;k++)\n {\n t=0;\n if(a[k]=='r'&&a[k+1]=='u'&&flag==0)\n if((a[0]=='f'&&k!=3)||(a[0]=='h'&&k!=4))\n {\n printf(\".ru\");\n k+=1;\n flag=1;\n t=1;\n if(k!=len-1)\n printf(\"/\");\n }\n else\n {printf(\"%c\",a[k]);t=1;}\n if(t==0)\n printf(\"%c\",a[k]);\n } \n //system(\"pause\");\n return 0;\n} \n \n \n\n \t\t\t\t \t\t\t \t \t\t \t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\n\nint main(){\n char cadena[51];\n int i=0;\n int k=0;\n int j=0; //check\n gets(cadena);\n if(cadena[0]=='h'){\n i=4;\n printf(\"http://\");\n for(;cadena[i]!='\\0';i++){\n printf(\"%c\",cadena[i]);\n if(cadena[i+1]=='r'&& cadena[i+2]=='u'){\n if(j==0){\n j=1; //ya se llego a .ru\n k=i+3;\n printf(\".ru\");\n if(cadena[k]!='\\0'){\n printf(\"/\");\n }\n i=i+2;\n }\n }\n\n }\n\n }\n else if(cadena[0]=='f'){\n printf(\"ftp://\");\n i=3;\n for(;cadena[i]!='\\0';i++){\n printf(\"%c\",cadena[i]);\n if(cadena[i+1]=='r'&& cadena[i+2]=='u'){\n if(j==0){\n j=1; //ya se llego a .ru\n k=i+3;\n printf(\".ru\");\n if(cadena[k]!='\\0'){\n printf(\"/\");\n }\n i=i+2;\n }\n }\n\n }\n\n\n }\n return 0;\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[500];\n //char ans1[5],ans2[60],ans3[60];\n scanf(\"%s\" ,&str);\n int i,j;\n if(str[0]=='f'){\n printf(\"ftp://\");\n i=3;}\n else{\n printf(\"http://\");\n i=4;\n }\n int flag=0,flag2=0;\n int len=strlen(str);\n printf(\"%c\",str[i]);\n for(j=i+1;str[j]!='\\0';j++){\n if(flag==0&&str[j]=='r'&&str[j+1]=='u'){\n printf(\".ru\");\n j++;\n flag=1;\n if(flag2==0&&j!=len-1){\n printf(\"/\");\n flag2=1;}\n\t\t\t\t\t}\n else \n printf(\"%c\",str[j]); \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n int i;\n char c[50];\n gets(c);\n if(c[0]=='h')\n {\n printf(\"http://\");\n //if(c[4]=='h'&&c[5]=='t'&&c[6]=='t'&&c[7]=='p'&&c[8]=='r'&&c[9]=='u'){printf(\"httpru\");i=10;}\n //else if(c[4]=='f'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"ftpru\");i=9;}\n /*else {*/i=5;printf(\"%c\",c[4]);//}\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n else if((c[0]=='f'))\n {\n printf(\"ftp://\");\n //if(c[3]=='h'&&c[4]=='t'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"httpru\");i=9;}\n //else if(c[3]=='f'&&c[4]=='t'&&c[5]=='p'&&c[6]=='r'&&c[7]=='u'){printf(\"ftpru\");i=8;}\n /*else {*/i=4;printf(\"%c\",c[3]);//}\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, j, c;\nchar page[50];\n//char s[50];\ngets(page);\ni=0;\nc=0;\n\nwhile (page[i] != '\\0'){\n if(isupper(page[i])){\n c = 1;\n }\n i++;\n}\n\nif (c == 0 && strlen(page) != 0){\nif (page[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nj = 0;\nwhile (page[i] != '\\0'){\n printf(\"%c\", page[i]);\n if (page[i+1] == 'r' && page[i+2] == 'u' && j == 0){\n j = 1;\n printf(\".ru\");\n if (page[i + 3] != '\\0'){\n printf(\"/\");\n }\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100001],s1[10000];\n int i,j,k;\n gets(s);\n if (s[2]=='t')\n {\n for (i=0,j=0; i<4;i++,j++)\n {\n s1[j]=s[i];\n }\n s1[4]=':';\n s1[5]='/';\n s1[6]='/';\n j=7;\n for (i=4,j=7; ; i++)\n {\n if (s[i]=='r' && s[i+1]=='u' && i>4)\n {\n break;\n }\n else {\n s1[j]=s[i];\n j++;\n }\n }\n s1[j]='.';\n j++;\n s1[j]='r';\n j++;\n s1[j]='u';\n j++;\n if (s[i+2]!='\\0')\n {\n s1[j]='/';\n j++;\n for (k=i+2; k<strlen(s); k++)\n {\n s1[j]=s[k];\n j++;\n }\n }\n }\n else if (s[2]=='p')\n {\n for (i=0,j=0; i<3;i++,j++)\n {\n s1[j]=s[i];\n }\n s1[3]=':';\n s1[4]='/';\n s1[5]='/';\n j=6;\n for (i=3,j=6; ; i++)\n {\n if (s[i]=='r' && s[i+1]=='u' && i>3)\n {\n break;\n }\n else {\n s1[j]=s[i];\n j++;\n }\n }\n s1[j]='.';\n j++;\n s1[j]='r';\n j++;\n s1[j]='u';\n j++;\n if (s[i+2]!='\\0')\n {\n s1[j]='/';\n j++;\n for (k=i+2; k<strlen(s); k++)\n {\n s1[j]=s[k];\n j++;\n }\n }\n }\n s1[j]='\\0';\n puts(s1);\n }\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a,b;\n int i,done,once;\n done = 0;\n once = 0;\n a=getchar();\n if(a=='h')\n {\n for(i=0;i<4;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n } \n }\n else if(a=='f')\n {\n for(i=0;i<3;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n }\n }\n printf(\"://\");\n while(a!='\\n')\n {\n if(a!='r' && done == 0 )\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a!='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 1)\n {\n b = getchar();\n if(b=='u')\n {\n printf(\".ru\");\n done = 1;\n a=getchar();\n if(a!='\\n')\n printf(\"/\");\n }\n else if(b!='u')\n {\n printf(\"%c\",a);\n once = 1;\n a=b;\n }\n } \n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char a[55];\n scanf(\"%s\",a);\n int len=strlen(a);\n int i=0,j=0;\n while(a[i]!='p')\n {\n printf(\"%c\",a[i]);\n i++;\n }\n printf(\"%c://\",a[i]);\n int k=i;\n do\n {\n k++;\n while(a[k]!='r' || a[k+1]!='u')\n k++;\n }while(k==i+1);\n //printf(\"K IS %d A[K] IS %c\",k,a[k]);\n for(j=i+1;j<k;j++)\n printf(\"%c\",a[j]);\n printf(\".ru\");\n k=k+2;\n if(k!=len)\n {\n printf(\"/\");\n while(k!=len)\n {\n printf(\"%c\",a[k]);\n k++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<ctype.h>\n#include<string.h>\n#define N 50\nint main(){\n char opcion1[]= {\"http://\"};\n char opcion2[]={\"ftp://\"};\n char opcion3[]={\".ru\"};\n char opcion4= '/';\n\n int i=0;\n int subindice=0;\n int j=0;\n int bandera=0;\n char direccion[N];\n \n \n scanf(\"%s\",direccion);\n if(direccion[0]== 'h'){\n printf(\"%s\",opcion1);\n i+=4;\n }\n else {\n i+=3;\n printf(\"%s\",opcion2);\n }\n while(direccion[i]!='\\0'){\n if(direccion[i]=='r' && direccion[i+1]=='u' && bandera==1){\n printf(\"%s\",opcion3);\n i+=2;\n if(direccion[i]!='\\0'){\n printf(\"%c\",opcion4);\n for(subindice=i; subindice<(strlen(direccion)); subindice++){\n printf(\"%c\",direccion[subindice]);\n }\n i=strlen(direccion);\n }\n }\n else if (bandera==0){\n if(direccion[i]=='r' && direccion[i+1]=='u'){\n printf(\"%c\",direccion[i]);\n i++;\n printf(\"%c\",direccion[i]);\n i++;\n bandera=1;\n }\n for(subindice=i; subindice<strlen(direccion); subindice++){\n if(direccion[i]== 'r' && direccion[i+1]=='u'){\n i=subindice;\n bandera=1;\n break;\n }\n else {\n printf(\"%c\",direccion[subindice]);\n i++;\n }\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\nint main(){\n char *cadena = (char *)malloc(51 * sizeof(char));\n char *result = (char *)malloc(51 * sizeof(char));\n int p, j;\n int pos, limite;\n char aux[2];\n\n scanf(\"%s\", cadena);\n int c = cadena[0];\n int c1 = 'f';\n if(c == c1){\n strcpy(result, \"ftp://\");\n p = 0;\n pos = 4;\n aux[0] = cadena[3];\n aux[1] = '\\0';\n\n strcat(result, aux);\n }else{\n strcpy(result, \"http://\");\n p = 1;\n pos = 5;\n aux[0] = cadena[4];\n aux[1] = '\\0';\n\n strcat(result, aux);\n }\n\n\n //printf(\"\\np: %d, pos: %d ---- result: %s\", p, pos, result);\n\n int i = pos;\n for(i; cadena[i] != '\\0'; i++){\n if((cadena[i] == 'r') && (cadena[i+1] == 'u')){\n limite = i;\n\n break;\n }\n }\n\n for(j = pos; j < limite; j++){\n aux[0] = cadena[j];\n aux[1] = '\\0';\n\n strcat(result, aux);\n }\n\n strcat(result, \".ru\");\n\n\n for(j = limite+2;cadena[j] != '\\0'; j++){\n if(j == limite + 2){ strcat(result, \"/\");}\n\n aux[0] = cadena[j];\n aux[1] = '\\0';\n\n strcat(result, aux);\n }\n\n\n printf(\"%s\", result);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100],d[100],e[100];\n int a,b,i,j,k,p,l,o,s;\n gets(c);j=0;\n if(c[0]=='h')p=4;else p=3;\n for(i=0;i<p;i++)\n {\n\n d[j]=c[i];j++;}\n d[j]=':';d[j+1]='/';d[j+2]='/';\n for(i=strlen(c)-1;i>=0;i--)\n {\n if(c[i]=='u'&&c[i-1]=='r')\n {\n\n l=i-1;break;}\n }k=j+3;\n for(i=p;i<l;i++)\n {\n d[k]=c[i];k++;\n }d[k]='.';d[k+1]='r';d[k+2]='u';\n s=l+2;\n if(s>strlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i<strlen(c);i++)\n {\n d[o]=c[i];o++;\n }d[o]='\\0';puts(d);\n }\n }\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint buscar(char a[], int i);\nvoid clear(char a[], int x);\nvoid contexto(char a[], char b[], int i);\nvoid concatenar(char a[], char b[], char c[]);\n\nint main()\n{\n char cadena[51];\n char protocol_h[8] = \"http://\";\n char protocol_f[7] = \"ftp://\";\n char domain[50];\n char context[50];\n\n int i, j = 0, aux;\n\n scanf(\"%s\", cadena);\n\n clear(domain, 50);\n clear(context, 50);\n\n if(cadena[0] == 'h')\n {\n aux = buscar(cadena, 5);\n for( i = 4; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_h, domain, context);\n }else\n {\n aux = buscar(cadena, 4);\n for( i = 3; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_f, domain, context);\n }\nreturn 0;\n}\n\nvoid clear(char a[], int x)\n{\n int j;\n for( j = 0; j < x; j++)\n a[j] = '\\0';\n}\n\nint buscar(char a[], int i)\n{\n int j, k, val = 0;\n k = strlen(a);\n for( j = k-1; j > i; j--)\n {\n if( a[j] == 'u')\n {\n if( a[j-1] == 'r')\n {\n val = j-2;\n break;\n }\n }\n }\n return val;\n}\n\nvoid contexto(char a[], char b[], int i)\n{\n int j, k, x = 0;\n k = strlen(a);\n for(j = i; j < k; j++)\n {\n b[x] = a[j];\n x++;\n }\n}\n\nvoid concatenar(char a[], char b[], char c[])\n{\n char x[] = \".ru\";\n char barra[] = \"/\";\n char z[60];\n clear (z, 60);\n\n strcpy(z, a);\n strcat(z, b);\n strcat(z, x);\n if( c[0] != '\\0' ){\n strcat(z, barra);\n strcat(z, c);\n }\n printf(\"%s\", z);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,l,m,n,t,o,p,q;\n int a[1000],b[1000];\n char s[100];\n scanf(\"%s\",s);\n if(s[0]=='f')\n {\n printf(\"ftp://\");\n i=3;\n }\n else\n {\n printf(\"http://\");\n i=4;\n }\n printf(\"%c\",s[i++]);\n for(;s[i];i++)\n {\n if(!(s[i]=='r'&&s[i+1]=='u'))\n {\n printf(\"%c\",s[i]);\n }\n else\n {\n printf(\".ru\");\n i+=2;\n break;\n }\n }\n if(s[i])\n {\n printf(\"/\");\n while(s[i])\n {\n printf(\"%c\",s[i]);\n i++;\n }\n }\n printf(\"\\n\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100],c[100]=\"\",d[100],e[100]=\"\";\n\tint i,j,m,n,len;\n\tscanf(\"%s\",a);\n\tlen=strlen(a);\n\tif (a[0]=='h')\n\t{\n\t\tstrcat(c,\"http://\");\n\t\tj=4;\n\t\tprintf(\"%s\",c);\n\t}\n\telse\n\t{\n\t\tstrcat(c,\"ftp://\");\n\t\tj=3;\n\t\tprintf(\"%s\",c);\n\t}\n\tfor (i=j,m=0;i<len;i++,m++)\n\t{\n\t\tif (a[i]=='r' && a[i+1]=='u' && i!=j)\n\t\t{\n n=i+2;\n break;\n\t\t}\n\t\telse{\n\t\t \td[m]=a[i];\n\t\t \tprintf(\"%c\",d[m]);\n\t\t}\n\t}\n\tprintf(\".ru\");\n\tif (n!=len){\n printf(\"%c\",'/');\n for (i=n,m=0;i<len;i++,m++)\n {\n d[m]=a[i];\n printf(\"%c\",d[m]);\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[55];\n int i,k,len,f;\n while(gets(s))\n {\n len=strlen(s);\n if(s[0]=='h')\n {\n for(i=0;i<4;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=4;\n }\n else\n if(s[0]=='f')\n {\n for(i=0;i<3;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=3;\n }\n for(i=k,f=0;i<len;i++)\n {\n if(i!=k&&s[i]=='r'&&s[i+1]=='u'&&f==0)\n {\n printf(\".ru\");f=1;i=i+2;\n if(i<len)\n printf(\"/\");\n else\n break;\n }\n printf(\"%c\",s[i]);\n }\n printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char ch[51];\n int i,l;\n scanf(\"%s\",ch);\n //printf(\"%s\",ch);\n l=strlen(ch);\n if(ch[0]=='f')\n {\n printf(\"ftp://\");\n for(i=3;i<l;i++)\n {\n if(i==3)printf(\"%c\",ch[3]);\n else\n\n if(ch[i]=='r')\n {\n if(ch[i+1]=='u')\n {\n printf(\".%c%c\",ch[i],ch[i+1]);\n i=i+2;\n if(i<l)printf(\"/\");\n while(i!=l)\n {\n\n printf(\"%c\",ch[i]);\n i++;\n }\n break;\n }\n else\n {\n printf(\"%c\",ch[i]);\n continue;\n }\n }\n else printf(\"%c\",ch[i]);\n }\n }\n if(ch[0]=='h')\n {\n printf(\"http://\");\n for(i=4;i<l;i++)\n {\n if(i==4)printf(\"%c\",ch[4]);\n else\n\n if(ch[i]=='r')\n {\n if(ch[i+1]=='u')\n {\n printf(\".%c%c\",ch[i],ch[i+1]);\n i=i+2;\n if(i<l)printf(\"/\");\n while(i!=l)\n {\n printf(\"%c\",ch[i]);\n i++;\n }\n break;\n }\n else\n {\n printf(\"%c\",ch[i]);\n continue;\n }\n }\n else printf(\"%c\",ch[i]);\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,k,l,m,c=0;\n char s[51],ns[100];\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++)\n {\n\n ns[j]=s[i];\n j++;\n if(s[i]=='p')\n break;\n }\n ns[j]=':';\n ns[j+1]='/';\n ns[j+2]='/';\n k=j+3;\n i=j;\n for(m=strlen(s)-1;m>=0;m--)\n {\n if(s[m]=='u' && s[m-1]=='r')\n break;\n }\n for(i=j;i<m-1;i++)\n {\n ns[k]=s[i];\n k++;\n }\n\n ns[k]='.';\n ns[k+1]='r';\n ns[k+2]='u';\n ns[k+3]='\\0';\n printf(\"%s\",ns);\n if(m+1<strlen(s))\n printf(\"/\");\n for(i=m+1;i<strlen(s);i++)\n printf(\"%c\",s[i]);\n\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint Now,i,L;\nchar Str[51];\n\nvoid Judge_Protocol()\n{\n if(Str[Now]=='f')\n {\n printf(\"ftp://\");\n Now+=3;\n }\n else\n {\n printf(\"http://\");\n Now+=4;\n }\n return;\n}\n\nvoid Judge_Domain()\n{\n printf(\"%c\",Str[Now]);\n for(i=Now+1; i<L; ++i)\n {\n if(Str[i]=='r'&&Str[i+1]=='u')\n {\n break;\n }\n printf(\"%c\",Str[i]);\n }\n printf(\".ru\");\n Now=i+2;\n return;\n}\n\nvoid Judge_Context()\n{\n if(Now==L)\n {\n return;\n }\n printf(\"/\");\n for(i=Now; i<L; ++i)\n {\n printf(\"%c\",Str[i]);\n }\n printf(\"\\n\");\n return;\n}\n\nint main()\n{\n scanf(\"%s\",Str);\n Now=0;\n L=strlen(Str);\n Judge_Protocol();\n Judge_Domain();\n Judge_Context();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint a=0, j, k=0;\nchar direccion[50];\n\ngets(direccion);\n\n\nwhile (direccion[a] != '\\0')\n{\n if(isupper(direccion[a]))\n {\n k = 1; /*si es mayuscula*/\n }\n a++;\n}\n\nif (k == 0 && strlen(direccion) != 0) /*si todo esta en minuscula y si la londitud es distinta a cero*/\n{\n if (direccion[0] == 'h')\n {\n printf(\"http://\");\n a = 4;\n }\n else\n {\n printf(\"ftp://\");\n a = 3;\n }\n}\nj = 0;\nwhile (direccion[a] != '\\0')\n{\n printf(\"%c\", direccion[a]);\n if (direccion[a+1] == 'r' && direccion[a+2] == 'u' && j == 0)\n {\n j = 1;\n printf(\".ru\");\n if (direccion[a + 3] != '\\0')\n {\n printf(\"/\");\n }\n a = a + 2;\n }\n a++;\n}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100],ftp[]=\"ftp\",http[]=\"http\";\n\tint n,c,i,j;\n\tgets(a);\n\tc=0;\n\tn=strlen(a);\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3) { printf(\"ftp://\");\t }\n\telse { printf(\"http://\"); c=4;}\n\t\n\tif(a[c]=='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\n\tfor(i=c;(a[i]!='r' || a[i+1]!='u');i++)\n\t\tprintf(\"%c\",a[i]);\n\t\n\tprintf(\".ru\");\n\ti+=2;\n\tc=0;\n\t\n\tfor(;i<n;i++)\n\t{\n\t\tif(!c)\n\t\t\tprintf(\"/\");\n\t\tc++;\n\t\tprintf(\"%c\",a[i]);\n\t}\n\t\n\tprintf(\"\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define S 50\n\nint main (void) {\n int i = 0;\n char buf[S + 2];\n fgets (buf, S + 2, stdin);\n i += printf (\"%s\", buf[i] == 'f' ? \"ftp://\" : \"http://\") - 3;\n i += printf (\"%.*s\", (int) (strstr (buf + i + 1, \"ru\") - (buf + i)), buf + i);\n i += printf (\".ru\") - 1;\n printf (\"%s%s\", buf[i] == '\\n' ? \"\" : \"/\", buf + i);\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint buscar(char a[], int i);\nvoid clear(char a[], int x);\nvoid contexto(char a[], char b[], int i);\nvoid concatenar(char a[], char b[], char c[]);\n\nint main()\n{\n char cadena[51];\n char protocol_h[8] = \"http://\";\n char protocol_f[7] = \"ftp://\";\n char domain[50];\n char context[50];\n\n int i, j = 0, aux;\n\n scanf(\"%s\", cadena);\n\n clear(domain, 50);\n clear(context, 50);\n\n if(cadena[0] == 'h')\n {\n aux = buscar(cadena, 5);\n for( i = 4; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_h, domain, context);\n }else\n {\n aux = buscar(cadena, 4);\n for( i = 3; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_f, domain, context);\n }\nreturn 0;\n}\n\nvoid clear(char a[], int x)\n{\n int j;\n for( j = 0; j < x; j++)\n a[j] = '\\0';\n}\n\nint buscar(char a[], int i)\n{\n int j, k, val = 0;\n k = strlen(a);\n for( j = k-1; j > i; j--)\n {\n if( a[j] == 'u')\n {\n if( a[j-1] == 'r')\n {\n val = j-2;\n break;\n }\n }\n }\n return val;\n}\n\nvoid contexto(char a[], char b[], int i)\n{\n int j, k, x = 0;\n k = strlen(a);\n for(j = i; j < k; j++)\n {\n b[x] = a[j];\n x++;\n }\n}\n\nvoid concatenar(char a[], char b[], char c[])\n{\n char x[] = \".ru\";\n char barra[] = \"/\";\n char z[60];\n clear (z, 60);\n\n strcpy(z, a);\n strcat(z, b);\n strcat(z, x);\n if( c[0] != '\\0' ){\n strcat(z, barra);\n strcat(z, c);\n }\n printf(\"%s\", z);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int pos;\n char w[51];\n scanf(\"%s\", w);\n if(w[0] == 'f'){\n printf(\"ftp://%c\", w[3]);\n pos = 4;\n }\n else{\n printf(\"http://%c\", w[4]);\n pos = 5;\n }\n while(w[pos] != 'r' || w[pos+1] != 'u'){\n printf(\"%c\", w[pos]);\n pos++;\n }\n printf(\".ru\");\n pos += 2;\n if(w[pos] != '\\0'){\n printf(\"/\");\n for(int i = pos; w[i] != '\\0'; i++){\n printf(\"%c\", w[i]);\n }\n }\n printf(\"\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main () {\n char a[100];\n int i,j,k=0,c=0;\n char b[100];\n gets(a);\n i=0;\n while(a[i]!='\\0') {\n if(a[i]=='p' && ((i==3 && a[0]=='h') || (i==2&& a[0]=='f'))) {\n b[k++]=a[i];\n b[k++]=':';\n b[k++]='/';\n b[k++]='/';\n i++;\n }\n else if(b[k-1]!='/' && a[i]=='r' && a[i+1]=='u' && c==0) {\n b[k++]='.';\n b[k++]=a[i];\n b[k++]=a[i+1];\n i++;\n c=1;\n i++;\n break;\n }\n else{\n b[k++]=a[i];\n i++;\n }\n }\n if(a[i]!='\\0') {\n b[k++]='/';\n while(a[i]!='\\0') {\n b[k++]=a[i++];\n }\n }\n b[k]='\\0';\n puts(b);\n return 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar d[100];\n\tint i,u,c=0,k=0;\n\tscanf(\"%s\",d);\n\tu=strlen(d);\n\tif(u<9){\n\tif(d[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tc+=4;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>6*/)){\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t}\n\t\t\telse \n\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t}\n\tif(d[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\tc+=3;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>5*/)){\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\telse {if(d[i+2]>=65){\n\t\t\t\tprintf(\".ru/\");\n\t\t\t\tc=i+2;\n\t\t\t\tk=1;\n\t\t\t\tbreak;}\n\t\t\t\telse printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\tfor(i=c;i<u;i++)\n\t\t\tprintf(\"%c\",d[i]);}\n\t}}\n\telse{\n\t\tif(d[0]=='h'){\n\t\t\tprintf(\"http://\");\n\t\t\tc+=4;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>6)){\n\t\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\t\tc=i+2;\n\t\t\t\t\t\tk=1;\n\t\t\t\t\t\tbreak;}\n\t\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\t\tbreak;}}\n\t\t\tif(k){\n\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}\n\t\tif(d[0]=='f'){\n\t\t\tprintf(\"ftp://\");\n\t\t\tc+=3;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>5)){\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\t\telse {if(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\t\telse printf(\".ru\");}\t}\n\t\t\t\tif(k){\n\t\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k, di, q = 0, h;\n char cad[50], prot[5], dom[45] = \" \", cont[45] = \" \";\n scanf(\"%s\", cad);\n cont[0] = '\\0';\n if(cad[0] == 'h'){\n strcpy(prot, \"http\");\n di = 4;\n }else{\n strcpy(prot, \"ftp\");\n di = 3;\n }\n for(k = di; k < strlen(cad); k++){\n if(cad[k] == 'r' && cad[k+1] == 'u' && k != di){\n if(cad[k+2] != '\\0'){\n q = 0;\n for(h = k + 2; h <= strlen(cad); h++){\n cont[q] = cad[h];\n q++;\n }\n }\n break;\n }else{\n dom[q] = cad[k];\n q++;\n }\n }\n if(cont[0] != '\\0'){\n printf(\"%s://%s.ru/%s\", prot, dom, cont);\n }else{\n printf(\"%s://%s.ru\", prot, dom);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[51],char principio[56]);\nint buscarru(char *texto);\n\nint main ()\n{\n char texto[51];\n scanf(\"%s\",texto);\n texto[50]='\\0';\n char texto2[56]=\"\";\n link(texto,texto2);\n printf(\"%s\",texto2);\n return 0;\n}\n\nvoid link(char texto[51], char principio[56])\n{\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=buscarru(texto);\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru\");\n i=i+2;\n if(i<largo)\n strcatchar(principio,'/');\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n principio[55]='\\0';\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\nint buscarru(char *texto)\n{\n int largo=strlen(texto);\n int i,x=0;\n for(i=0;i<largo-1;i++)\n {\n if(texto[i]=='r' && texto[i+1]=='u')\n x=i;\n }\n return x;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nconst char http[]=\"http\";\nconst char ftp[]=\"ftp\";\nconst char ru[]=\"ru\";\n\nvoid findprotocol(char* str) {\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr=NULL;\n ptr=strstr(str,ftp);\n if (ptr!=NULL) {\n if ((ptr-str)==0) {\n strncpy(buffer1,str+3,strlen(str)-3+1);\n str[3]=':';str[4]='/';str[5]='/';\n strncpy(str+6,buffer1,strlen(buffer1)+1);\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n}\n\nvoid finddomainandcontext(char* str) {\n int pos;\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr;\n ptr=strstr(str,ru);\n pos=ptr-str;\n if (str[pos-1]=='/') {\n ptr=strstr(str+pos+3,ru);\n }\n pos=ptr-str;\n strncpy(buffer1,str+pos,strlen(str)-pos+1);\n str[ptr-str]='.';\n strncpy(str+pos+1,buffer1,strlen(buffer1)+1);\n free(buffer1);\n buffer1=calloc(100,sizeof(char));\n if (pos+3!=strlen(str)) {\n strncpy(buffer1,str+pos+3,strlen(str)-pos-3+1);\n str[ptr-str+3]='/';\n strncpy(str+pos+4,buffer1,strlen(buffer1)+1);\n\n }\n}\n\nint main() {\n char input[100]=\"\";\n scanf(\"%s\",input);\n findprotocol(input);\n finddomainandcontext(input);\n printf(\"%s\",input);\n return (0);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char string[50+1], s;\n int i=0, start=0;\n scanf(\"%s\", string);\n s = string[i];\n if(s == 'h') \n {\n printf(\"http://\");\n start = 4;\n } \n else \n {\n start = 3;\n printf(\"ftp://\");\n }\n i = start; \n while(start)\n {\n s=string[i];\n if(s == 'r' && string[i+1] == 'u' && i > start) \n {\n printf(\".ru\");\n i = i+2;\n if(string[i]!=NULL) printf(\"/\");\n break;\n } \n printf(\"%c\", s);\n i++;\n }\n while(string[i]!=NULL)\n {\n printf(\"%c\", string[i]);\n i++;\n } \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[500];\n char ans1[5],ans2[60],ans3[60];\n scanf(\"%s\" ,&str);\n int i,j;\n if(str[0]=='f'){\n printf(\"ftp://\");\n i=3;}\n else{\n printf(\"http://\");\n i=4;\n }\n int flag=0,flag2=0;\n int len=strlen(str);\n printf(\"%c\",str[i]);\n for(j=i+1;str[j]!='\\0';j++){\n if(flag==0&&str[j]=='r'&&str[j+1]=='u'){\n printf(\".ru\");\n j++;\n flag=1;\n if(flag2==0&&j!=len-1){\n printf(\"/\");\n flag2=1;}\n\t\t\t\t\t}\n else \n printf(\"%c\",str[j]); \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n\tchar s[111]={0};\n\tscanf(\"%s\",s);\n\tint i=0,c=0;\n\n\tif(s[0]=='h'){printf(\"http://\");\n\n\t\tfor(i=4;i<strlen(s);i++)\n\t\t{\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0&&i!=4)\n\t\t\t\t{\n\t\t\t\t\tif(s[i+2]!='\\0'){printf(\".ru/\");}\n\t\t\t\t\telse{printf(\".ru\");}\n\t\t\t\t\tc++;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\tif(s[0]=='f'){printf(\"ftp://\");\n\n\t\tfor(i=3;i<strlen(s);i++)\n\t\t{\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0&&i!=3)\n\t\t\t{\n\t\t\t\tif(s[i+2]!='\\0'){printf(\".ru/\");}\n\t\t\t\telse{printf(\".ru\");}\n\t\t\t\tc++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\n\t\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\n char c,aux, address[60];\n int i = 0;\n\n c = getchar();\n\n if (c == 'h')\n {\n address[i++] = c;\n while((c = getchar()) != '\\n')\n {\n if(i == 4)\n {\n address[4] = ':';\n address[5] = '/';\n address[6] = '/';\n i = 7;\n }\n\n if(c == 'u' && address[i-1] == 'r' && address[i-2] != '/')\n\n {\n aux = address[i - 1];\n address[i - 1] = '.';\n address[i] = aux;\n address[++i] = c;\n i++;\n break;\n }\n\n address[i++] = c;\n }\n }\n else\n {\n address[i++] = c;\n while((c = getchar()) != '\\n')\n {\n if(c == 'u' && address[i-1] == 'r' && address[i-2] != '/')\n {\n aux = address[i - 1];\n address[i - 1] = '.';\n address[i] = aux;\n address[++i] = c;\n i++;\n break;\n }\n\n if(i == 3)\n {\n address[3] = ':';\n address[4] = '/';\n address[5] = '/';\n i = 6;\n }\n address[i++] = c;\n }\n }\n\n if((c = getchar()) != '\\n')\n {\n address[i++] = '/';\n address[i++] = c;\n\n }\n\n if(c != '\\n')\n {\n while((c = getchar()) != '\\n')\n {\n address[i++] = c;\n }\n }\n\n address[i] = '\\0';\n\n puts(address);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain () {\n char direccion [51];\n scanf(\"%s\", &direccion);\n int i, band;\n i=band=0;\n if (direccion[0]=='h'){\n printf(\"http://\");\n i=4;\n }\n if (direccion[0]=='f'){\n printf(\"ftp://\");\n i=3;\n }\n while (direccion[i]!= '\\0' ){\n printf(\"%c\", direccion[i]);\n if (direccion[i+1]=='r' && direccion[i+2]=='u' && band==0){\n printf(\".ru\");\n band=1;\n if (direccion[i+3] != '\\0'){\n printf(\"/\");\n }\n i=i+2;\n }\n i++;\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nint main(){\nint i,don=3,pun=0,j=0;\nchar direccion[51];\nchar dir[56]={};\nscanf(\"%s\",direccion);\ni=0;\nif(direccion[0] == 'h'){\n don = 4;\n}\nwhile(direccion[i]!='\\0'){\n if(don == 0){\n dir[j]=':';\n j++;\n dir[j]='/';\n j++;\n dir[j]='/';\n j++;\n }\n if(pun==0 && direccion[i] == 'r' && direccion[i+1] == 'u' && don <0){\n dir[j]='.';\n pun++;\n j++;\n }\n dir[j] = direccion[i];\n j++;\n if(pun == 1 && direccion[i]=='u' && direccion[i+1]!='\\0'){\n pun++;\n dir[j]='/';\n j++;\n }\n don=don-1;\n i++;\n }\n dir[j]='\\0';\n printf(\"%s\",dir);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar cadena[50];\nint main(){\n int i,c,h=50;\n scanf(\"%s\",cadena);\n if(cadena[0]=='h'){\n c=4;\n }else{\n c=3;\n }\n int k=0;\n for(i=0;cadena[i]!='\\0';i++){\n if(i==c){\n printf(\"://\");\n }\n if(i!=c){\n if(cadena[i]=='r' &&cadena[i+1]=='u' && k==0){\n printf(\".\");\n h=i+2;\n k=1;\n }\n }\n if(i==h){\n printf(\"/\");\n \n }\n printf(\"%c\",cadena[i]);\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint l,i,j;\nchar s[100];\ngets(s);\nl=strlen(s);\nif(s[0]=='h'&&s[1]=='t'&&s[2]=='t'&&s[3]=='p')\n{printf(\"http://\");\nfor(i=4;i<l;i++)\n{if((s[i]=='r'&&s[i+1]=='u')&&i!=4)\nbreak;\nelse\nprintf(\"%c\",s[i]);}\nprintf(\".ru\");\nif(s[i+2]!='\\0')\nprintf(\"/\");\nfor(j=i+2;j<l;j++)\nprintf(\"%c\",s[j]);}\nelse\n{printf(\"ftp://\");\nfor(i=3;i<l;i++)\n{if((s[i]=='r'&&s[i+1]=='u')&&i!=3)\nbreak;\nelse\nprintf(\"%c\",s[i]);}\nprintf(\".ru\");\nif(s[i+2]!='\\0')\nprintf(\"/\");\nfor(j=i+2;j<l;j++)\nprintf(\"%c\",s[j]);}\nreturn(0);}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, j, c;\nchar page[50];\n//char s[50];\ngets(page);\ni=0;\nc=0;\n\nwhile (page[i] != '\\0'){\n if(isupper(page[i])){\n c = 1;\n }\n i++;\n}\n\nif (c == 0 && strlen(page) != 0){\nif (page[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nj = 0;\nwhile (page[i] != '\\0'){\n printf(\"%c\", page[i]);\n if (page[i+1] == 'r' && page[i+2] == 'u' && j == 0){\n j = 1;\n printf(\".ru\");\n if (page[i + 3] != '\\0'){\n printf(\"/\");\n }\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\tif(a[i+3] == 'r' && a[i+4] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+3],a[i+4]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\tif(a[i+4] == 'r' && a[i+5] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+4],a[i+5]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+3;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tif(i+2 == len)\n\t\t\t{\n\t\t\t\tprintf(\".%c%c\",a[i],a[i+1]);\n\t\t\t\ti = i+1;\n\t\t\t\tcount2++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\t\ti = i+1;\n\t\t\t\tcount2++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int i,j=0,b=0;\n char cadena1[51],cadena2[53];\n scanf(\"%[^\\n]\",cadena1);\n for(i=0;cadena1[i]!='\\0';i++){\n cadena2[j]=cadena1[i];\n if(i>=1 &&i<=3 && cadena1[i]=='p' && cadena1[i-1]=='t'){\n j++;\n cadena2[j]=':';\n j++;\n cadena2[j]='/';\n j++;\n cadena2[j]='/';\n }\n if(i>1 && cadena1[i+1]=='r' && cadena1[i+2]=='u' && b==0 && cadena2[j]!='/'){\n j++;\n cadena2[j]='.';\n j++;\n cadena2[j]='r';\n j++;\n cadena2[j]='u';\n\n i=i+2;\n if(cadena1[i+1]!='\\0'){\n j++;\n cadena2[j]='/';\n }\n b=1;\n }\n j++;\n }\n cadena2[j]='\\0';\n printf(\"%s\",cadena2);\n return 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar a[75],http[]=\"http\",ftp[]=\"ftp\";\n\tint i,n,c=0;\n\tgets(a);\n\tn=strlen(a);\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3)\n\t\tprintf(\"ftp://\");\n\telse\n\t{\n\t\tprintf(\"http://\");\n\t\tc=4;\n\t}\n\tif(a[c]=='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\tfor(i=c;a[i]!='r' || a[i+1]!='u';i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru\");\n\ti+=2;\n\tc=0;\n\tfor(;i<n;i++)\n\t{\n\t\tif(!c)\n\t\t\tprintf(\"/\");\n\t\tc++;\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar cadena[50];\nint main(){\n int i,c,h=50;\n scanf(\"%s\",cadena);\n if(cadena[0]=='h'){\n c=4;\n }else{\n c=3;\n }\n int k=0;\n for(i=0;cadena[i]!='\\0';i++){\n if(i==c){\n printf(\"://\");\n }\n if(i!=c){\n if(cadena[i]=='r' &&cadena[i+1]=='u' && k==0){\n printf(\".\");\n h=i+2;\n k=1;\n }\n }\n if(i==h){\n printf(\"/\");\n }\n printf(\"%c\",cadena[i]);\n }\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k, di, q = 0, h;\n char cad[50], prot[5], dom[45] = \" \", cont[45] = \" \";\n scanf(\"%s\", cad);\n cont[0] = '\\0';\n if(cad[0] == 'h'){\n strcpy(prot, \"http\");\n di = 4;\n }else{\n strcpy(prot, \"ftp\");\n di = 3;\n }\n for(k = di; k < strlen(cad); k++){\n if(cad[k] == 'r' && cad[k+1] == 'u' && k != di){\n if(cad[k+2] != '\\0'){\n q = 0;\n for(h = k + 2; h <= strlen(cad); h++){\n cont[q] = cad[h];\n q++;\n }\n }\n break;\n }else{\n dom[q] = cad[k];\n q++;\n }\n }\n if(cont[0] != '\\0'){\n printf(\"%s://%s.ru/%s\", prot, dom, cont);\n }else{\n printf(\"%s://%s.ru\", prot, dom);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tchar a[55];\n\tint n,k,m,l,b,j,i;\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='h' && a[i+1]=='t' && a[i+2]=='t' && a[i+3]=='p'){printf(\"http://\");m=3;break;}\n\t\tif(a[i]=='f' && a[i+1]=='t' && a[i+2]=='p'){printf(\"ftp://\");m=2;break;}\n\t}\n\tprintf(\"%c\",a[m+1]);\n\tfor(i=m+2;i<n;i++)\n\t{\n\t\tif(a[i]=='r' && a[i+1]=='u'){j=i;break;}\n\t}\n\tfor(i=m+2;i<j;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru\");\n\tj+=2;\n\tif(a[j]!='\\0')printf(\"/\");\n\tfor(i=j;i<n;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char b[52];\n int s,i,j;\n scanf(\"%s\",b);\n if(b[0]=='h'){\n printf(\"http://\");\n s=strlen(b);\n if(s>7){\n i=5;\n printf(\"%c\",b[4]);\n while(b[i]!='r'||b[i+1]!='u'){\n printf(\"%c\",b[i]);\n i++;\n }\n printf(\".ru\");\n if(b[i+2]!='\\0')\n printf(\"/\");\n for(j=i+2;j<s;j++)\n printf(\"%c\",b[j]); \n }\n else\n printf(\"%c.ru\",b[4]); \n }\n else{\n printf(\"ftp://\");\n s=strlen(b);\n if(s>6){\n i=4;\n printf(\"%c\",b[3]);\n while(b[i]!='r'||b[i+1]!='u'){\n printf(\"%c\",b[i]);\n i++;\n }\n printf(\".ru\");\n if(b[i+2]!='\\0')\n printf(\"/\");\n for(j=i+2;j<s;j++)\n printf(\"%c\",b[j]);\n }\n else\n printf(\"%c.ru\",b[3]);\n }\n return 0;\n}\n \n \n"}, {"source_code": "#define N 56\n//50+1+5\n#include<stdio.h>\nint main() {\n char address[N];\n scanf(\"%s\",address);\n int insert1=0;\n if(address[0]=='h'){\n insert1=3;\n }else{\n insert1=2;\n }\n int insert2=0;\n int insert3=0;\n int i,j;\n i=insert1+2;\n while(address[i]!='\\0'){\n if(address[i]=='r' && address[i+1]=='u'){\n insert2=i-1;\n if(address[i+2]!='\\0'){\n insert3=i+1;\n }\n break;\n }\n i++;\n }\n\n i=0;\n j=0;\n while(address[i]!='\\0'){\n printf(\"%c\",address[i]);\n if(i==insert1){\n printf(\"://\");\n }else if(i==insert2){\n printf(\".\");\n }else if(i==insert3 && insert3!=0){\n printf(\"/\");\n }\n i++;\n }\n printf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n char *line = (char*)malloc(64);\n scanf(\"%s\", line);\n char *address = (char*)malloc(64);\n if (line[0] == 'h')\n {\n strcpy(address, \"http://\");\n line +=4;\n }\n else\n {\n strcpy(address, \"ftp://\");\n line +=3;\n }\n\n char *ru;\n ru = strstr(line, \"ru\");\n if (ru == line)\n ru = strstr(line+1, \"ru\");\n\n strncat(address, line, ru - line);\n strcat(address, \".ru\");\n\n line += ru - line + 2;\n if ( strlen(line) != 0)\n {\n strcat(address, \"/\");\n strcat(address, line);\n }\n printf(\"%s\\n\", address);\n\n return 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar d[100];\n\tint i,u,c=0,k=0;\n\tscanf(\"%s\",d);\n\tu=strlen(d);\n\tif(u<9){\n\tif(d[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tc+=4;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>6*/)){\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t}\n\t\t\telse \n\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t}\n\tif(d[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\tc+=3;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>5*/)){\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\telse {if(d[i+2]>=65){\n\t\t\t\tprintf(\".ru/\");\n\t\t\t\tc=i+2;\n\t\t\t\tk=1;\n\t\t\t\tbreak;}\n\t\t\t\telse printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\tfor(i=c;i<u;i++)\n\t\t\tprintf(\"%c\",d[i]);}\n\t}}\n\telse{\n\t\tif(d[0]=='h'){\n\t\t\tprintf(\"http://\");\n\t\t\tc+=4;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>6)){\n\t\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\t\tc=i+2;\n\t\t\t\t\t\tk=1;\n\t\t\t\t\t\tbreak;}\n\t\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\t\tbreak;}}\n\t\t\tif(k){\n\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}\n\t\tif(d[0]=='f'){\n\t\t\tprintf(\"ftp://\");\n\t\t\tc+=3;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>5)){\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\t\telse {if(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\t\telse printf(\".ru\");}\t}\n\t\t\t\tif(k){\n\t\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint buscar(char a[], int i);\nvoid clear(char a[], int x);\nvoid contexto(char a[], char b[], int i);\nvoid concatenar(char a[], char b[], char c[]);\n\nint main()\n{\n char cadena[51];\n char protocol_h[8] = \"http://\";\n char protocol_f[7] = \"ftp://\";\n char domain[50];\n char context[50];\n\n int i, j = 0, aux;\n\n scanf(\"%s\", cadena);\n\n clear(domain, 50);\n clear(context, 50);\n\n if(cadena[0] == 'h')\n {\n aux = buscar(cadena, 5);\n for( i = 4; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_h, domain, context);\n }\n else\n {\n aux = buscar(cadena, 4);\n for( i = 3; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_f, domain, context);\n }\nreturn 0;\n}\n\nvoid clear(char a[], int x)\n{\n int j;\n for( j = 0; j < x; j++)\n a[j] = '\\0';\n}\n\nint buscar(char a[], int i)\n{\n int j, k, val = 0;\n k = strlen(a);\n for( j = k-1; j > i; j--)\n {\n if( a[j] == 'u')\n {\n if( a[j-1] == 'r')\n {\n val = j-2;\n break;\n }\n }\n }\n return val;\n}\n\nvoid contexto(char a[], char b[], int i)\n{\n int j, k, x = 0;\n k = strlen(a);\n for(j = i; j < k; j++)\n {\n b[x] = a[j];\n x++;\n }\n}\n\nvoid concatenar(char a[], char b[], char c[])\n{\n char x[] = \".ru\";\n char barra[] = \"/\";\n char z[60];\n clear (z, 60);\n\n strcpy(z, a);\n strcat(z, b);\n strcat(z, x);\n if( c[0] != '\\0' ){\n strcat(z, barra);\n strcat(z, c);\n }\n printf(\"%s\", z);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n#include <stdlib.h>\n\nint main() {\n char str[51];\n char * p = NULL;\n\n scanf(\"%s\", str);\n if ( str[0] == 'h' ) {\n printf(\"%s\", \"http\");\n p = str+4;\n } else {\n printf(\"%s\", \"ftp\");\n p = str+3;\n }\n printf(\"://\");\n putc(*p++, stdout);\n while ( *p != 'r' || *(p+1) != 'u' ) {\n putc(*p++, stdout);\n }\n printf(\"%s\", \".ru\");\n p+=2;\n if ( *p )\n putc('/', stdout);\n while ( *p )\n putc(*p++, stdout);\n printf(\"\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nvoid arregla(char *ptrS);\n\nint main()\n{\n char direccion[51]=\"\";\n scanf(\"%s\",&direccion);\n arregla(direccion);\n}\n\nvoid arregla(char *ptrS)\n{\n int x,y,largo,dato=0;\n char nuevo[80]=\"\";\n char aux[80]=\"\";\n largo = strlen(ptrS);\n y = strlen(strstr(ptrS,\"ru\"));\n\n if(strstr(ptrS,\"ftp\")!=NULL)\n {\n if(strcmp(strstr(ptrS,\"ftp\"),ptrS)==0)\n {\n dato=1;\n strcat(nuevo,\"ftp://\");\n x = largo-3-y;\n if(x!=0)\n {\n strncat(nuevo,&ptrS[3],x);\n strcat(nuevo,\".ru\");\n if(y!=2)\n {\n strcat(nuevo,\"/\");\n }\n\n }\n else\n {\n strcat(aux,strstr(ptrS,\"ru\"));\n y = strlen(strstr(&aux[2],\"ru\"));\n x = largo-3-y;\n strncat(nuevo,&ptrS[3],x);\n strcat(nuevo,\".ru\");\n if(y!=2)\n {\n strcat(nuevo,\"/\");\n }\n }\n strcat(nuevo,&ptrS[largo-y+2]);\n }\n }\n if(dato == 0)\n {\n strcat(nuevo,\"http://\");\n x = largo-4-y;\n if(x!=0)\n {\n strncat(nuevo,&ptrS[4],x);\n strcat(nuevo,\".ru\");\n if(y!=2)\n {\n strcat(nuevo,\"/\");\n }\n\n }\n else\n {\n strcat(aux,strstr(ptrS,\"ru\"));\n y = strlen(strstr(&aux[2],\"ru\"));\n x = largo-4-y;\n strncat(nuevo,&ptrS[4],x);\n strcat(nuevo,\".ru\");\n if(y!=2)\n {\n strcat(nuevo,\"/\");\n }\n\n }\n strcat(nuevo,&ptrS[largo-y+2]);\n }\n printf(\"%s\\n\",nuevo);\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar a[75],http[]=\"http\",ftp[]=\"ftp\";\n\tint i,n,c=0;\n\tgets(a);\n\tn=strlen(a);\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3)\n\t\tprintf(\"ftp://\");\n\telse\n\t{\n\t\tprintf(\"http://\");\n\t\tc=4;\n\t}\n\tif(a[c]=='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\tfor(i=c;a[i]!='r' || a[i+1]!='u';i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru\");\n\ti+=2;\n\tc=0;\n\tfor(;i<n;i++)\n\t{\n\t\tif(!c)\n\t\t\tprintf(\"/\");\n\t\tc++;\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100],d[100],e[100];\n int a,b,i,j,k,p,l,o,s;\n gets(c);j=0;\n if(c[0]=='h')p=4;else p=3;\n for(i=0;i<p;i++)\n {\n\n d[j]=c[i];j++;}\n d[j]=':';d[j+1]='/';d[j+2]='/';\n for(i=strlen(c)-1;i>=0;i--)\n {\n if(c[i]=='u'&&c[i-1]=='r')\n {\n\n l=i-1;break;}\n }k=j+3;\n for(i=p;i<l;i++)\n {\n d[k]=c[i];k++;\n }d[k]='.';d[k+1]='r';d[k+2]='u';\n s=l+2;\n if(s>strlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i<strlen(c);i++)\n {\n d[o]=c[i];o++;\n }d[o]='\\0';puts(d);\n }\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n char direccion[56];\n char aux[51];\n int i;\n int punto;\n\n scanf(\"%s\", direccion);\n\n if(direccion[0] == 'h')\n {\n for(i=strlen(direccion); i >= 4; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[4] = ':';\n direccion[5] = '/';\n direccion[6] = '/';\n\n for(i=8; direccion[i]!='\\0'; i++)\n {\n aux[i-8]= direccion[i];\n }\n\n\n punto = strstr(aux,\"ru\") - aux + 8;\n\n for(i=strlen(direccion); i >= punto; i--)\n {\n direccion[i+1] = direccion[i];\n }\n\n direccion[punto] = '.';\n\n for(i=strlen(direccion); i >= punto+3; i--)\n {\n direccion[i+1] = direccion[i];\n }\n if(direccion[punto+3]!='\\0')\n direccion[punto+3] = '/';\n\n }\n else\n {\n for(i=strlen(direccion); i >= 3; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[3] = ':';\n direccion[4] = '/';\n direccion[5] = '/';\n\n for(i=7; direccion[i]!='\\0'; i++)\n {\n aux[i-7]= direccion[i];\n }\n\n\n punto = strstr(aux,\"ru\") - aux + 7;\n\n for(i=strlen(direccion); i >= punto; i--)\n {\n direccion[i+1] = direccion[i];\n }\n\n direccion[punto] = '.';\n\n for(i=strlen(direccion); i >= punto+3; i--)\n {\n direccion[i+1] = direccion[i];\n }\n if(direccion[punto+3]!='\\0')\n direccion[punto+3] = '/';\n\n }\n\n\n\n\n printf(\"%s\", direccion);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(int argc, char **argv)\n{\n\tchar input[60], output[60];\n\tscanf(\"%s\",&input);\n\tint i = 0, j = 0, counter;\n\twhile(input[i] != 'p')\n\t{\n\t\toutput[i] = input[i];\n\t\ti++;\n\t\tj++;\n\t}\n\toutput[i] = input[i];\n\ti++;\n\tj++;\n\toutput[i] = ':';\n\toutput[i+1] = '/';\n\toutput[i+2] = '/';\n\ti = i + 3;\n\tif(input[j] == 'r' && input[j+1] == 'u')\n\t{\n\t\toutput[i] = 'r';\n\t\toutput[i+1] = 'u';\n\t\ti += 2;\n\t\tj += 2;\n\t}\n\tlabel:\n\twhile(input[j] != 'r')\n\t{\n\t\toutput[i] = input[j];\n\t\tj++;\n\t\ti++;\n\t}\n\tif(input[j+1] != 'u')\n\t{\n\t\toutput[i] = input[j];\n\t\ti++;\n\t\tj++;\n\t\tgoto label;\n\t}\n\toutput[i] = '.';\n\toutput[i+1] = 'r';\n\toutput[i+2] = 'u';\n\ti = i + 3;\n\tj = j + 2;\n\tif(input[j] != '\\0')\n\t{\n\t\toutput[i] = '/';\n\t\ti++;\n\t}\n\twhile(input[j] != '\\0')\n\t{\n\t\toutput[i] = input[j];\n\t\ti++;\n\t\tj++;\n\t}\n\toutput[i] = '\\0';\n\tprintf(\"%s\",output);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint i;\n\tchar a[51];\n\tscanf(\"%s\", a);\n\tif (a[0] == 'f'){\n\t\tprintf(\"ftp://\");\n\t\tfor(i=3;i<4;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 4; a[i]!='r'||a[i+1]!='u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru\");\n\t\ti+=2;\n\t\tif(i<strlen(a))\n\t\tprintf(\"/\");\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\telse{\n\t\tprintf(\"http://\");\n\t\tfor(i=4;i<5;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 5; a[i] != 'r' || a[i + 1] != 'u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru\");\n\t\ti+=2;\n\t\tif(i<strlen(a))\n\t\tprintf(\"/\");\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\n\nint main(){\n char cadena[51];\n int i=0;\n int k=0;\n int j=0; //check\n gets(cadena);\n if(cadena[0]=='h'){\n i=4;\n printf(\"http://\");\n for(;cadena[i]!='\\0';i++){\n printf(\"%c\",cadena[i]);\n if(cadena[i+1]=='r'&& cadena[i+2]=='u'){\n if(j==0){\n j=1; //ya se llego a .ru\n k=i+3;\n printf(\".ru\");\n if(cadena[k]!='\\0'){\n printf(\"/\");\n }\n i=i+2;\n }\n }\n\n }\n\n }\n else if(cadena[0]=='f'){\n printf(\"ftp://\");\n i=3;\n for(;cadena[i]!='\\0';i++){\n printf(\"%c\",cadena[i]);\n if(cadena[i+1]=='r'&& cadena[i+2]=='u'){\n if(j==0){\n j=1; //ya se llego a .ru\n k=i+3;\n printf(\".ru\");\n if(cadena[k]!='\\0'){\n printf(\"/\");\n }\n i=i+2;\n }\n }\n\n }\n\n\n }\n return 0;\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char a[55];\n scanf(\"%s\",a);\n int len=strlen(a);\n int i=0,j=0;\n while(a[i]!='p')\n {\n printf(\"%c\",a[i]);\n i++;\n }\n printf(\"%c://\",a[i]);\n int k=i;\n do\n {\n k++;\n while(a[k]!='r' || a[k+1]!='u')\n k++;\n }while(k==i+1);\n //printf(\"K IS %d A[K] IS %c\",k,a[k]);\n for(j=i+1;j<k;j++)\n printf(\"%c\",a[j]);\n printf(\".ru\");\n k=k+2;\n if(k!=len)\n {\n printf(\"/\");\n while(k!=len)\n {\n printf(\"%c\",a[k]);\n k++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main () {\n char a[100];\n int i,j,k=0,c=0;\n char b[100];\n gets(a);\n i=0;\n while(a[i]!='\\0') {\n if(a[i]=='p' && ((i==3 && a[0]=='h') || (i==2&& a[0]=='f'))) {\n b[k++]=a[i];\n b[k++]=':';\n b[k++]='/';\n b[k++]='/';\n i++;\n }\n else if(b[k-1]!='/' && a[i]=='r' && a[i+1]=='u' && c==0) {\n b[k++]='.';\n b[k++]=a[i];\n b[k++]=a[i+1];\n i++;\n c=1;\n i++;\n break;\n }\n else{\n b[k++]=a[i];\n i++;\n }\n }\n if(a[i]!='\\0') {\n b[k++]='/';\n while(a[i]!='\\0') {\n b[k++]=a[i++];\n }\n }\n b[k]='\\0';\n puts(b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, b, d;\nchar c[50];\nchar s[50];\ngets(c);\ni=0;\nd=0;\n\nwhile (c[i] != '\\0'){\n if(isupper(c[i])){\n d = 1;\n }\n i++;\n}\n\nif (d == 0 && strlen(c) != 0){\nif (c[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nb = 0;\nwhile (c[i] != '\\0'){\n printf(\"%c\", c[i]);\n if (c[i+1] == 'r' && c[i+2] == 'u' && b == 0){\n b = 1;\n printf(\".ru\");\n if (c[i + 3] != '\\0'){\n printf(\"/\");\n }\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u' && f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a,b;\n int i,done,once;\n done = 0;\n once = 0;\n a=getchar();\n if(a=='h')\n {\n for(i=0;i<4;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n } \n }\n else if(a=='f')\n {\n for(i=0;i<3;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n }\n }\n printf(\"://\");\n while(a!='\\n')\n {\n if(a!='r' && done == 0 )\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a!='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 1)\n {\n b = getchar();\n if(b=='u')\n {\n printf(\".ru\");\n done = 1;\n a=getchar();\n if(a!='\\n')\n printf(\"/\");\n }\n else if(b!='u')\n {\n printf(\"%c\",a);\n once = 1;\n a=b;\n }\n } \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l1,l2,count=0;\n\tchar a[80];\n\tscanf(\"%s\",a);\n\tl1=strlen(a);\n\tif(a[0]=='h')\n\t{\n\t\tprintf(\"http://\");\n\t\tfor(i=4;i<l1;i++)\n\t\t{\n\t\t\tif(i!=4 && i!=l1-1 && a[i]=='r' && a[i+1]=='u' && count==0)\n\t\t\t{\n\t\t\t\tprintf(\".ru\");\n\t\t\t\ti++;\n\t\t\t\tcount=1;\n\t\t\t\tif(i!=l1-1)\n\t\t\t\t\tprintf(\"/\");\n\t\t\t}\n\t\t\telse\n\t\t\t\tprintf(\"%c\",a[i]);\n\t\t}\n\t\t}\n\telse\n\t{\n\t\tprintf(\"ftp://\");\n\t\tfor(i=3;i<l1;i++)\n\t\t{\n\t\t\tif(i!=3 && i!=l1-1 && a[i]=='r' && a[i+1]=='u' && count==0)\n\t\t\t{\n\t\t\t\tprintf(\".ru\");\n\t\t\t\ti++;\n\t\t\t\tcount=1;\n\t\t\t\tif(i!=l1-1)\n\t\t\t\t\tprintf(\"/\");\n\t\t\t}\n\t\t\telse\n\t\t\t\tprintf(\"%c\",a[i]);\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int k, n, i, l;\n char note[51];\n char address[60];\n \n scanf(\"%s\", note);\n \n if(note[0] == 'h') /*si la primera letra es h, se puede asumir que es http*/\n k = 4;\n else\n k = 3; /*si no, se asume que es ftp*/\n \n for(i=0; i<k; i++) /*se copian los caracteres del cuaderno a la direccion*/\n address[i] = note[i];\n \n n = k;\n \n address[k++] = ':'; /*se agregan los caracteres divisorios despues del protocolo*/\n address[k++] = '/';\n address[k++] = '/';\n \n for(i=strlen(note)-1; i>n; i--)\n {\n if(note[i] == 'r' && note[i+1] == 'u')\n {\n l = i;\n break;\n }\n }\n \n for(i=n; i<l; i++)\n {\n address[k++] = note[i];\n }\n \n address[k++] = '.';\n address[k++] = 'r';\n address[k++] = 'u';\n \n if(note[l+2] != '\\0')\n {\n address[k++] = '/';\n \n for(i=l+2; i<strlen(note); i++)\n address[k++] = note[i];\n }\n \n address[k] = '\\0';\n \n printf(\"%s\", address);\n \n \n /*printf(\"\\n\");\n system(\"pause\");*/\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main () {\n char a[100];\n int i,j,k=0,c=0;\n char b[100];\n gets(a);\n i=0;\n while(a[i]!='\\0') {\n if(a[i]=='p' && ((i==3 && a[0]=='h') || (i==2&& a[0]=='f'))) {\n b[k++]=a[i];\n b[k++]=':';\n b[k++]='/';\n b[k++]='/';\n i++;\n }\n else if(b[k-1]!='/' && a[i]=='r' && a[i+1]=='u' && c==0) {\n b[k++]='.';\n b[k++]=a[i];\n b[k++]=a[i+1];\n i++;\n c=1;\n i++;\n break;\n }\n else{\n b[k++]=a[i];\n i++;\n }\n }\n if(a[i]!='\\0') {\n b[k++]='/';\n while(a[i]!='\\0') {\n b[k++]=a[i++];\n }\n }\n b[k]='\\0';\n puts(b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n int i;\n char c[50];\n gets(c);\n if(c[0]=='h')\n {\n printf(\"http://\");\n //if(c[4]=='h'&&c[5]=='t'&&c[6]=='t'&&c[7]=='p'&&c[8]=='r'&&c[9]=='u'){printf(\"httpru\");i=10;}\n //else if(c[4]=='f'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"ftpru\");i=9;}\n /*else {*/i=5;printf(\"%c\",c[4]);//}\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n else if((c[0]=='f'))\n {\n printf(\"ftp://\");\n //if(c[3]=='h'&&c[4]=='t'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"httpru\");i=9;}\n //else if(c[3]=='f'&&c[4]=='t'&&c[5]=='p'&&c[6]=='r'&&c[7]=='u'){printf(\"ftpru\");i=8;}\n /*else {*/i=4;printf(\"%c\",c[3]);//}\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100],d[100],e[100];\n int a,b,i,j,k,p,l,o,s;\n gets(c);j=0;\n if(c[0]=='h')p=4;else p=3;\n for(i=0;i<p;i++)\n {\n\n d[j]=c[i];j++;}\n d[j]=':';d[j+1]='/';d[j+2]='/';\n for(i=strlen(c)-1;i>=0;i--)\n {\n if(c[i]=='u'&&c[i-1]=='r')\n {\n\n l=i-1;break;}\n }k=j+3;\n for(i=p;i<l;i++)\n {\n d[k]=c[i];k++;\n }d[k]='.';d[k+1]='r';d[k+2]='u';\n s=l+2;\n if(s>strlen(c)-1){d[k+3]='\\0';puts(d);}\n else{\n\n d[k+3]='/';o=k+4;\n for(i=s;i<strlen(c);i++)\n {\n d[o]=c[i];o++;\n }d[o]='\\0';puts(d);\n }\n }\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar a[75],http[]=\"http\",ftp[]=\"ftp\";\n\tint i,n,c=0;\n\tgets(a);\n\tn=strlen(a);\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3)\n\t\tprintf(\"ftp://\");\n\telse\n\t{\n\t\tprintf(\"http://\");\n\t\tc=4;\n\t}\n\tif(a[c]=='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\tfor(i=c;a[i]!='r' || a[i+1]!='u';i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru\");\n\ti+=2;\n\tc=0;\n\tfor(;i<n;i++)\n\t{\n\t\tif(!c)\n\t\t\tprintf(\"/\");\n\t\tc++;\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<string.h>\nint main()\n{\n int i;\n char n[50];\n scanf(\"%s\",n);\n if(n[0]=='h')\n {\n printf(\"http://\");\n for(i=4;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n if(n[i+1]=='r' && n[i+2]=='u')\n {\n printf(\".ru\");\n if(n[i+3]!='\\0')\n {\n printf(\"/\");\n for(i=i+3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n }\n return 0;\n }\n return 0;\n }\n }\n }\n else\n {\n printf(\"ftp://\");\n for(i=3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n if(n[i+1]=='r' && n[i+2]=='u')\n {\n printf(\".ru\");\n if(n[i+3]!='\\0')\n {\n printf(\"/\");\n for(i=i+3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n }\n return 0;\n }\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k, di, q = 0, h;\n char cad[50], prot[5], dom[45] = \" \", cont[45] = \" \";\n scanf(\"%s\", cad);\n cont[0] = '\\0';\n if(cad[0] == 'h'){\n strcpy(prot, \"http\");\n di = 4;\n }else{\n strcpy(prot, \"ftp\");\n di = 3;\n }\n for(k = di; k < strlen(cad); k++){\n if(cad[k] == 'r' && cad[k+1] == 'u' && k != di){\n if(cad[k+2] != '\\0'){\n q = 0;\n for(h = k + 2; h <= strlen(cad); h++){\n cont[q] = cad[h];\n q++;\n }\n }\n break;\n }else{\n dom[q] = cad[k];\n q++;\n }\n }\n if(cont[0] != '\\0'){\n printf(\"%s://%s.ru/%s\", prot, dom, cont);\n }else{\n printf(\"%s://%s.ru\", prot, dom);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int pos;\n char w[51];\n scanf(\"%s\", w);\n if(w[0] == 'f'){\n printf(\"ftp://%c\", w[3]);\n pos = 4;\n }\n else{\n printf(\"http://%c\", w[4]);\n pos = 5;\n }\n while(w[pos] != 'r' || w[pos+1] != 'u'){\n printf(\"%c\", w[pos]);\n pos++;\n }\n printf(\".ru\");\n pos += 2;\n if(w[pos] != '\\0'){\n printf(\"/\");\n for(int i = pos; w[i] != '\\0'; i++){\n printf(\"%c\", w[i]);\n }\n }\n printf(\"\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i;\n char DirWeb[50];\n char aux[53]=\"\";\n char s[55]=\"\";\n gets(DirWeb);\n int p,c,flag=0;\n if(DirWeb[0]=='h')\n {\n strcpy(aux,\"http://\");\n Cpy(aux,DirWeb,4,3);\n p=8;\n }else if(DirWeb[0]=='f')\n {\n strcpy(aux,\"ftp://\");\n Cpy(aux,DirWeb,3,3);\n p=7;\n }\n int n=strlen(aux);\n for(i=p;aux[i]!='\\0';i++)\n {\n if(aux[i]=='r' && aux[i+1]=='u' && flag==0)\n {\n if(i!=n-2)\n {\n strncat(s,aux,i);\n strcat(s,\".ru/\");\n c=i+2;\n Cpy(s,aux,c,2);\n }else{\n strncat(s,aux,i);\n strcat(s,\".ru\");\n }\n flag=1;\n }\n }\n puts(s);\n\n return 0;\n}\n\nvoid Cpy(char *str1,char *str2,int a,int b)\n{\n int i;\n for(i=a;(str1[i+b]=str2[i])!='\\0';i++)\n {\n str1[i+b]=str2[i];\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s[60];\nint main()\n{\n int n,i,gata;\n gets(s);\n n=strlen(s);\n if(s[0]=='f') // ftp\n {\n printf(\"ftp://\");\n for(i=3;i<n;i++)\n {\n printf(\"%c\",s[i]);\n if(s[i+1]=='r' && s[i+2]=='u')\n {\n gata=i;\n i=n;\n }\n }\n printf(\".ru\");\n if(gata+2!=n-1)\n {\n printf(\"/\");\n for(i=gata+3;i<n;i++)\n printf(\"%c\",s[i]);\n }\n }\n else\n {\n printf(\"http://\");\n for(i=4;i<n;i++)\n {\n printf(\"%c\",s[i]);\n if(s[i+1]=='r' && s[i+2]=='u')\n {\n gata=i;\n i=n;\n }\n }\n printf(\".ru\");\n if(gata+2!=n-1)\n {\n printf(\"/\");\n for(i=gata+3;i<n;i++)\n printf(\"%c\",s[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\n char dir[50];\n int c,ban=1;\n\n scanf(\"%s\",dir);\n char *p=dir;\n if(dir[0]=='f')\n {\n printf(\"ftp://\");\n p+=3;\n }\n else\n {\n printf(\"http://\");\n p+=4;\n }\n printf(\"%c\",*p);\n p++;\n\n while (*p!='\\0')\n {\n if(*p=='r' && ban==1)\n {\n p++;\n if( *p=='u')\n {\n printf(\".ru\");\n ban=0;\n p++;\n if(*p=='\\0')\n return 0;\n else\n printf(\"/\");\n }else\n p--;\n }\n printf(\"%c\",*p);\n p++;\n\n }\n return 0;\n}\n"}, {"source_code": "#include<string.h>\nint main()\n{\n int i;\n char n[50];\n scanf(\"%s\",n);\n if(n[0]=='h')\n {\n printf(\"http://\");\n for(i=4;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n if(n[i+1]=='r' && n[i+2]=='u')\n {\n printf(\".ru\");\n if(n[i+3]!='\\0')\n {\n printf(\"/\");\n for(i=i+3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n }\n return 0;\n }\n return 0;\n }\n }\n }\n else\n {\n printf(\"ftp://\");\n for(i=3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n if(n[i+1]=='r' && n[i+2]=='u')\n {\n printf(\".ru\");\n if(n[i+3]!='\\0')\n {\n printf(\"/\");\n for(i=i+3;n[i]!='\\0';i++)\n {\n printf(\"%c\",n[i]);\n }\n return 0;\n }\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int k, n, i, l;\n char note[51];\n char address[60];\n \n scanf(\"%s\", note);\n \n if(note[0] == 'h') /*si la primera letra es h, se puede asumir que es http*/\n k = 4;\n else\n k = 3; /*si no, se asume que es ftp*/\n \n for(i=0; i<k; i++) /*se copian los caracteres del cuaderno a la direccion*/\n address[i] = note[i];\n \n n = k;\n \n address[k++] = ':'; /*se agregan los caracteres divisorios despues del protocolo*/\n address[k++] = '/';\n address[k++] = '/';\n \n for(i=strlen(note)-1; i>n; i--)\n {\n if(note[i] == 'r' && note[i+1] == 'u')\n {\n l = i;\n break;\n }\n }\n \n for(i=n; i<l; i++)\n {\n address[k++] = note[i];\n }\n \n address[k++] = '.';\n address[k++] = 'r';\n address[k++] = 'u';\n \n if(note[l+2] != '\\0')\n {\n address[k++] = '/';\n \n for(i=l+2; i<strlen(note); i++)\n address[k++] = note[i];\n }\n \n address[k] = '\\0';\n \n printf(\"%s\", address);\n \n \n /*printf(\"\\n\");\n system(\"pause\");*/\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<ctype.h>\n#include<string.h>\n#define N 50\nint main(){\n char opcion1[]= {\"http://\"};\n char opcion2[]={\"ftp://\"};\n char opcion3[]={\".ru\"};\n char opcion4= '/';\n\n int i=0;\n int subindice=0;\n int j=0;\n int bandera=0;\n char direccion[N];\n scanf(\"%s\",direccion);\n if(direccion[0]== 'h'){\n printf(\"%s\",opcion1);\n i+=4;\n }\n else {\n i+=3;\n printf(\"%s\",opcion2);\n }\n while(direccion[i]!='\\0'){\n if(direccion[i]=='r' && direccion[i+1]=='u' && bandera==1){\n printf(\"%s\",opcion3);\n i+=2;\n if(direccion[i]!='\\0'){\n printf(\"%c\",opcion4);\n for(subindice=i; subindice<(strlen(direccion)); subindice++){\n printf(\"%c\",direccion[subindice]);\n }\n i=strlen(direccion);\n }\n }\n else if (bandera==0){\n if(direccion[i]=='r' && direccion[i+1]=='u'){\n printf(\"%c\",direccion[i]);\n i++;\n printf(\"%c\",direccion[i]);\n i++;\n bandera=1;\n }\n for(subindice=i; subindice<strlen(direccion); subindice++){\n if(direccion[i]== 'r' && direccion[i+1]=='u'){\n i=subindice;\n bandera=1;\n break;\n }\n else {\n printf(\"%c\",direccion[subindice]);\n i++;\n }\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, b, d;\nchar c[50];\nchar s[50];\ngets(c);\ni=0;\nd=0;\n\nwhile (c[i] != '\\0'){\n if(isupper(c[i])){\n d = 1;\n }\n i++;\n}\n\nif (d == 0 && strlen(c) != 0){\nif (c[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nb = 0;\nwhile (c[i] != '\\0'){\n printf(\"%c\", c[i]);\n if (c[i+1] == 'r' && c[i+2] == 'u' && b == 0){\n b = 1;\n printf(\".ru\");\n if (c[i + 3] != '\\0'){\n printf(\"/\");\n }\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define NN 64\n\nint main(void)\n{\n\tchar url[NN], tmp[NN], *p;\n\twhile (gets(url)) {\n\t\tp = url;\n\t\tstrncpy(tmp, url, 3);\n\t\ttmp[3] = 0;\n\t\tif (strcmp(tmp, \"ftp\") == 0) {\n\t\t\tprintf(\"ftp://\");\n\t\t\tp += 3;\n\t\t} else {\n\t\t\tprintf(\"http://\");\n\t\t\tp += 4;\n\t\t}\n\t\tif (p[0] == 'r' && p[1] == 'u') {\n\t\t\tprintf(\"ru\");\n\t\t\tp += 2;\n\t\t}\n\t\twhile (!(p[0] == 'r' && p[1] == 'u')) {\n\t\t\tputchar(*p++);\n\t\t}\n\t\tprintf(\".ru\");\n\t\tp += 2;\n\t\tif (*p == '\\0') {\n\t\t\tputs(\"\");\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"/%s\\n\", p);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[50];\n int i,j,len;\n scanf(\"%s\",s);\n len=strlen(s);\n if(s[0]=='h')\n {\n printf(\"http://\");\n if(s[4]=='r')\n { \n printf(\"r\"); \n for(i=5;i<50;i++)\n {\n if(s[i]=='r' && s[i+1]=='u'&& i!=(len-2))\n {\n printf(\".ru/\");\n break;\n }\n else if(s[i]=='r' && s[i+1]=='u'&& i==(len-2))\n {\n printf(\".ru\\n\");\n return 0;\n }\n printf(\"%c\",s[i]);\n }\n for(i=i+2;i<len;i++)\n {\n printf(\"%c\",s[i]);\n } \n printf(\"\\n\");\n return 0; \n }\n else\n {\n for(i=4;i<50;i++)\n {\n if(s[i]=='r' && s[i+1]=='u'&& i!=(len-2))\n {\n printf(\".ru/\");\n break;\n }\n else if(s[i]=='r' && s[i+1]=='u'&& i==(len-2))\n {\n printf(\".ru\\n\");\n return 0;\n }\n printf(\"%c\",s[i]);\n }\n for(i=i+2;i<len;i++)\n {\n printf(\"%c\",s[i]);\n } \n printf(\"\\n\");\n return 0; \n }\n }\n else\n {\n printf(\"ftp://\");\n if(s[3]=='r')\n { \n printf(\"r\"); \n for(i=4;i<50;i++)\n {\n if(s[i]=='r' && s[i+1]=='u'&& i!=(len-2))\n {\n printf(\".ru/\");\n break;\n }\n else if(s[i]=='r' && s[i+1]=='u'&& i==(len-2))\n {\n printf(\".ru\\n\");\n return 0;\n }\n printf(\"%c\",s[i]);\n }\n for(i=i+2;i<len;i++)\n {\n printf(\"%c\",s[i]);\n } \n printf(\"\\n\");\n return 0; \n }\n else\n {\n for(i=3;i<50;i++)\n {\n if(s[i]=='r' && s[i+1]=='u'&& i!=(len-2))\n {\n printf(\".ru/\");\n break;\n }\n else if(s[i]=='r' && s[i+1]=='u'&& i==(len-2))\n {\n printf(\".ru\\n\");\n return 0;\n }\n printf(\"%c\",s[i]);\n }\n for(i=i+2;i<len;i++)\n {\n printf(\"%c\",s[i]);\n } \n printf(\"\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define maxn 1000\nint main()\n{\n int i,j,mark=0,len,ok;\n char a[maxn],m[10]={'r','u'};\n scanf(\"%s\",a);\n len=strlen(a);\n if(a[2]=='t')ok=0;\n else ok=1;\n for(i=0;i<=len-2;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[i+j]!=m[j])\n break;\n }\n if(j==2)\n {\n if(ok==0&&i>4)\n {\n mark=i;\n break;\n }\n else if(ok==1&&i>3)\n {\n mark=i;\n break;\n }\n }\n }\n if(ok==0)\n {\n printf(\"http://\");\n for(i=4;i<mark;i++)\n printf(\"%c\",a[i]);\n printf(\".ru\");\n if(len!=mark+2)\n {\n printf(\"/\");\n for(i=mark+2;i<len;i++)\n printf(\"%c\",a[i]);\n }\n }\n else\n {\n printf(\"ftp://\");\n for(i=3;i<mark;i++)\n printf(\"%c\",a[i]);\n printf(\".ru\");\n if(len!=mark+2)\n {\n printf(\"/\");\n for(i=mark+2;i<len;i++)\n printf(\"%c\",a[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint buscar(char a[], int i);\nvoid clear(char a[], int x);\nvoid contexto(char a[], char b[], int i);\nvoid concatenar(char a[], char b[], char c[]);\n\nint main()\n{\n char cadena[51];\n char protocol_h[8] = \"http://\";\n char protocol_f[7] = \"ftp://\";\n char domain[50];\n char context[50];\n\n int i, j = 0, aux;\n\n scanf(\"%s\", cadena);\n\n clear(domain, 50);\n clear(context, 50);\n\n if(cadena[0] == 'h')\n {\n aux = buscar(cadena, 5);\n for( i = 4; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_h, domain, context);\n }else\n {\n aux = buscar(cadena, 4);\n for( i = 3; i <= aux; i++)\n {\n domain[j] = cadena[i];\n j++;\n }\n aux += 3;\n contexto(cadena, context, aux);\n concatenar(protocol_f, domain, context);\n }\nreturn 0;\n}\n\nvoid clear(char a[], int x)\n{\n int j;\n for( j = 0; j < x; j++)\n a[j] = '\\0';\n}\n\nint buscar(char a[], int i)\n{\n int j, k, val = 0;\n k = strlen(a);\n for( j = k-1; j > i; j--)\n {\n if( a[j] == 'u')\n {\n if( a[j-1] == 'r')\n {\n val = j-2;\n break;\n }\n }\n }\n return val;\n}\n\nvoid contexto(char a[], char b[], int i)\n{\n int j, k, x = 0;\n k = strlen(a);\n for(j = i; j < k; j++)\n {\n b[x] = a[j];\n x++;\n }\n}\n\nvoid concatenar(char a[], char b[], char c[])\n{\n char x[] = \".ru\";\n char barra[] = \"/\";\n char z[60];\n clear (z, 60);\n\n strcpy(z, a);\n strcat(z, b);\n strcat(z, x);\n if( c[0] != '\\0' ){\n strcat(z, barra);\n strcat(z, c);\n }\n printf(\"%s\", z);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k, di, q = 0, h;\n char cad[50], prot[5], dom[45] = \" \", cont[45] = \" \";\n scanf(\"%s\", cad);\n cont[0] = '\\0';\n if(cad[0] == 'h'){\n strcpy(prot, \"http\");\n di = 4;\n }else{\n strcpy(prot, \"ftp\");\n di = 3;\n }\n for(k = di; k < strlen(cad); k++){\n if(cad[k] == 'r' && cad[k+1] == 'u' && k != di){\n if(cad[k+2] != '\\0'){\n q = 0;\n for(h = k + 2; h <= strlen(cad); h++){\n cont[q] = cad[h];\n q++;\n }\n }\n break;\n }else{\n dom[q] = cad[k];\n q++;\n }\n }\n if(cont[0] != '\\0'){\n printf(\"%s://%s.ru/%s\", prot, dom, cont);\n }else{\n printf(\"%s://%s.ru\", prot, dom);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar s[51];\n\tscanf(\"%s\", s);\n\tint p=1, r=1, c=0;\n\tfor (int i=0;s[i]!='\\0';i++) {\n\t\tprintf(\"%c\", s[i]);\n\t\tif (c&&s[i]=='u') {\n\t\t\tprintf(\"/\");\n\t\t\tc=0;\n\t\t}\n\t\tif (s[i+1]=='r'&&s[i+2]=='u'&&r&&!p) {\n\t\t\tprintf(\".\");\n\t\t\tr=0;\n\t\t\tif (s[i+3]!='\\0') c=1;\n\t\t}\n\t\tif (s[i]=='p'&&p) {\n\t\t\tprintf(\"://\");\n\t\t\tp=0;\t\n\t\t}\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[51],char principio[56]);\nint buscarru(char *texto);\n\nint main ()\n{\n char texto[51];\n scanf(\"%s\",texto);\n texto[50]='\\0';\n char texto2[56]=\"\";\n link(texto,texto2);\n printf(\"%s\",texto2);\n return 0;\n}\n\nvoid link(char texto[51], char principio[56])\n{\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=buscarru(texto);\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru\");\n i=i+2;\n if(i<largo)\n strcatchar(principio,'/');\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n principio[55]='\\0';\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\nint buscarru(char *texto)\n{\n int largo=strlen(texto);\n int i,x=0;\n for(i=0;i<largo-1;i++)\n {\n if(texto[i]=='r' && texto[i+1]=='u')\n x=i;\n }\n return x;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[105];\n int p;\n int len;\n int flag;\n int ff;\n\n while (scanf(\"%s\", s) != EOF) {\n if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p') {\n printf(\"http://\");\n p = 4;\n }\n else {\n printf(\"ftp://\");\n p = 3;\n }\n\n for (ff = 0, flag = 1; s[p] != '\\0'; p++) {\n if (ff & flag && s[p] == 'r' && s[p + 1] == 'u') {\n if (s[p + 2] == '\\0') printf(\".ru\");\n else printf(\".ru/\");\n p++;\n flag = 0;\n continue;\n }\n else {\n ff = 1;\n printf(\"%c\", s[p]);\n }\n }\n printf(\"\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar s[51];\n\tscanf(\"%s\", s);\n\tint p=1, r=1, c=0;\n\tfor (int i=0;s[i]!='\\0';i++) {\n\t\tprintf(\"%c\", s[i]);\n\t\tif (c&&s[i]=='u') {\n\t\t\tprintf(\"/\");\n\t\t\tc=0;\n\t\t}\n\t\tif (s[i+1]=='r'&&s[i+2]=='u'&&r&&!p) {\n\t\t\tprintf(\".\");\n\t\t\tr=0;\n\t\t\tif (s[i+3]!='\\0') c=1;\n\t\t}\n\t\tif (s[i]=='p'&&p) {\n\t\t\tprintf(\"://\");\n\t\t\tp=0;\t\n\t\t}\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nvoid url (char cadena [], int i);\n\nint main () {\nchar cadena [ 50 ];\nint i ;\nfflush ( stdin );\ngets ( cadena );\n if ( cadena [ 0 ]== 'f' ){\n for ( i = 0 ; i < 3 ; i ++){\n putchar(cadena[i]);\n }\n url ( cadena , 3 );\n }\n else if ( cadena [ 0 ]== 'h' ){\n for ( i = 0 ; i < 4 ; i ++){\n putchar(cadena[i]);\n }\n url ( cadena , 4);\n }\n return 0 ;\n}\n\nvoid url ( char cadena [], int i ){\n int flag = 0 ;\n printf ( \"://\" );\n //putchar(cadena[i]);\n while ( cadena[ i ]!= '\\0' ){\n putchar( cadena[ i ]);\n if ( flag==0 && cadena[ i + 1 ]== 'r' && cadena[ i + 2 ]== 'u' ){\n printf ( \".ru\" );\n flag= -1 ;\n if ( cadena [ i + 3 ] != '\\0' ){\n printf( \"/\" );\n }\n i = i + 2 ;\n }\n i ++;\n }\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, j, k;\nchar page[50];\n//char s[50];\ngets(page);\ni=0;\nk=0;\n\nwhile (page[i] != '\\0'){\n if(isupper(page[i])){\n k = 1;\n }\n i++;\n}\n\nif (k == 0 && strlen(page) != 0){\nif (page[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nj = 0;\nwhile (page[i] != '\\0'){\n printf(\"%c\", page[i]);\n if (page[i+1] == 'r' && page[i+2] == 'u' && j == 0){\n j = 1;\n printf(\".ru\");\n if (page[i + 3] != '\\0'){\n printf(\"/\");\n }\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char a[55];\n scanf(\"%s\",a);\n int len=strlen(a);\n int i=0,j=0;\n while(a[i]!='p')\n {\n printf(\"%c\",a[i]);\n i++;\n }\n printf(\"%c://\",a[i]);\n int k=i;\n do\n {\n k++;\n while(a[k]!='r' || a[k+1]!='u')\n k++;\n }while(k==i+1);\n //printf(\"K IS %d A[K] IS %c\",k,a[k]);\n for(j=i+1;j<k;j++)\n printf(\"%c\",a[j]);\n printf(\".ru\");\n k=k+2;\n if(k!=len)\n {\n printf(\"/\");\n while(k!=len)\n {\n printf(\"%c\",a[k]);\n k++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nconst char http[]=\"http\";\nconst char ftp[]=\"ftp\";\nconst char ru[]=\"ru\";\n\nvoid findprotocol(char* str) {\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr=NULL;\n ptr=strstr(str,ftp);\n if (ptr!=NULL) {\n if ((ptr-str)==0) {\n strncpy(buffer1,str+3,strlen(str)-3+1);\n str[3]=':';str[4]='/';str[5]='/';\n strncpy(str+6,buffer1,strlen(buffer1)+1);\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n}\n\nvoid finddomainandcontext(char* str) {\n int pos;\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr;\n ptr=strstr(str,ru);\n pos=ptr-str;\n if (str[pos-1]=='/') {\n ptr=strstr(str+pos+3,ru);\n }\n pos=ptr-str;\n strncpy(buffer1,str+pos,strlen(str)-pos+1);\n str[ptr-str]='.';\n strncpy(str+pos+1,buffer1,strlen(buffer1)+1);\n free(buffer1);\n buffer1=calloc(100,sizeof(char));\n if (pos+3!=strlen(str)) {\n strncpy(buffer1,str+pos+3,strlen(str)-pos-3+1);\n str[ptr-str+3]='/';\n strncpy(str+pos+4,buffer1,strlen(buffer1)+1);\n\n }\n}\n\nint main() {\n char input[100]=\"\";\n scanf(\"%s\",input);\n findprotocol(input);\n finddomainandcontext(input);\n printf(\"%s\",input);\n return (0);\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nmain()\n{\nchar a[50],b[60];\nint i=0,j=0;\ngets(a);\nif(a[i]=='h')\n{\nfor(i=0;i<4;i++)\n{\nb[j]=a[i];\nj++;\n}}\nelse\n{\nfor(i=0;i<3;i++)\n{\nb[i]=a[i];\nj++;\n}}\nb[j++]=':';\nb[j++]='/';\nb[j++]='/';\n\nwhile(a[i]!='r'||a[i+1]!='u')\n{\nb[j++]=a[i++];\n\n}\n\nb[j++]='.';\nb[j++]=a[i++];\nb[j++]=a[i++];\n\nif(a[i]!='\\0')\n{\nb[j++]='/';\nwhile(a[i]!='\\0')\nb[j++]=a[i++];\nb[j]='\\0';\n}\nelse\nb[j]='\\0';\n\n\nprintf(\"%s\",b);\n\n}\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p')\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\tif(a[i+4] == 'r' && a[i+5] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+4],a[i+5]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+3;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\ti = i+1;\n\t\t\tcount2++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint isru(char *a)\n{\n if(*a=='r'&&*(a+1)=='u')\n return 1;\n else \n return 0;\n}\nint main()\n{\n int i,j,k,l,m,n,t,o,p,q;\n int a[1000],b[1000];\n char s[100];\n while(scanf(\"%s\",s)!=EOF)\n {\n if(s[0]=='f')\n {\n printf(\"ftp://\");\n i=3;\n }\n else\n {\n printf(\"htttp://\");\n i=4;\n }\n for(;s[i];i++)\n {\n if(!isru(&s[i]))\n printf(\"%c\",s[i]);\n else\n {\n printf(\".ru\");\n i+=2;\n break;\n }\n }\n if(s[i])\n {\n printf(\"/\");\n while(s[i])\n {\n printf(\"%c\",s[i]);\n i++;\n }\n }\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[60],*p,h[5]=\"http\",f[4] =\"ftp\";\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n for(i =0;i<3;i++)\n {\n if(s[i]!=f[i])\n {\n break;\n }\n }\n p =strstr(s,\"ru\");\n if(i ==3)\n {\n printf(\"%s://\",f);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n else\n {\n i =4;\n printf(\"%s://\",h);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len;\n len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar cadena[50];\nint main(){\n int i,c,h;\n scanf(\"%s\",cadena);\n if(cadena[0]=='h'){\n c=4;\n }else{\n c=3;\n }\n int k=0;\n for(i=0;cadena[i]!='\\0';i++){\n if(i==c){\n printf(\"://\");\n }\n if(i!=c){\n if(cadena[i]=='r' &&cadena[i+1]=='u' && k==0){\n printf(\".\");\n h=i+2;\n k=1;\n }\n }\n if(i==h){\n printf(\"/\");\n }\n printf(\"%c\",cadena[i]);\n }\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s[60];\nint main()\n{\n int n,i,gata;\n gets(s);\n n=strlen(s);\n if(s[0]=='f') // ftp\n {\n printf(\"ftp://\");\n for(i=3;i<n;i++)\n {\n printf(\"%c\",s[i]);\n if(s[i+1]=='r' && s[i+2]=='u')\n {\n gata=i;\n i=n;\n }\n }\n printf(\".ru/\");\n for(i=gata+3;i<n;i++)\n printf(\"%c\",s[i]);\n }\n else\n {\n printf(\"http://\");\n for(i=4;i<n;i++)\n {\n printf(\"%c\",s[i]);\n if(s[i+1]=='r' && s[i+2]=='u')\n {\n gata=i;\n i=n;\n }\n }\n printf(\".ru/\");\n for(i=gata+3;i<n;i++)\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint Now,i,L;\nchar Str[51];\n\nvoid Judge_Protocol()\n{\n if(Str[Now]=='f')\n {\n printf(\"ftp://\");\n Now+=3;\n }\n else\n {\n printf(\"http://\");\n Now+=4;\n }\n return;\n}\n\nvoid Judge_Domain()\n{\n for(i=Now;i<L;++i)\n {\n if(Str[i]=='r'&&Str[i+1]=='u')\n {\n break;\n }\n printf(\"%c\",Str[i]);\n }\n printf(\".ru\");\n Now=i+2;\n return;\n}\n\nvoid Judge_Context()\n{\n if(Now==L)\n {\n return;\n }\n printf(\"/\");\n for(i=Now;i<L;++i)\n {\n printf(\"%c\",Str[i]);\n }\n printf(\"\\n\");\n return;\n}\n\nint main()\n{\n scanf(\"%s\",Str);\n Now=0;\n L=strlen(Str);\n Judge_Protocol();\n Judge_Domain();\n Judge_Context();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char direccion[ 51 ], dominio[ 46 ];\n char *ptrDireccion;\n int i, tam_dominio;\n\n scanf( \"%s\", direccion);\n\n if( direccion[ 0 ] == 'h' ){\n printf( \"http://\" );\n i = 4;\n }else{\n printf( \"ftp://\" );\n i = 3;\n }\n\n ptrDireccion = direccion + i + 1;\n while( strncmp( ptrDireccion, \"ru\", 2 ) ){\n ptrDireccion++;\n }\n\n tam_dominio = ptrDireccion - direccion - i;\n\n strncpy( dominio, direccion + i, tam_dominio );\n dominio [ tam_dominio ] = '\\0';\n\n printf( \"%s.ru/%s\", dominio, ptrDireccion + 2 );\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nint main(){\nint i,don=3,pun=0,j=0;\nchar direccion[51];\nchar dir[56]={};\nscanf(\"%s\",direccion);\ni=0;\nif(direccion[0] == 'h'){\n don = 4;\n}\nwhile(direccion[i]!='\\0'){\n if(pun==0 && direccion[i] == 'r' && direccion[i+1] == 'u'){\n dir[j]='.';\n pun++;\n j++;\n }\n if(don == 0){\n dir[j]=':';\n j++;\n dir[j]='/';\n j++;\n dir[j]='/';\n j++;\n }\n dir[j] =direccion[i];\n j++;\n if(pun == 1 && direccion[i]=='u'/*&& direccion[i+1]!='\\0'*/){\n pun++;\n dir[j]='/';\n j++;\n }\n don=don-1;\n i++;\n }\n printf(\"%s\",dir);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100],ftp[]=\"ftp\",http[]=\"http\";\n\tint c,i,j;\n\tgets(a);\n\tc=0;\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3) { printf(\"ftp://\");\t }\n\telse { printf(\"http://\"); c=4;}\n\t\n\tif(a[c]='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\n\tfor(i=c;(a[i]!='r' || a[i+1]!='u');i++)\n\t\tprintf(\"%c\",a[i]);\n\t\n\tprintf(\".ru\");\n\t\n\tif(a[i+2]!='\\0')\n\t\tprintf(\"/\");\n\t\n\tfor(i+=2;a[i]!='\\0';i++)\n\t\tprintf(\"%c\",a[i]);\n\t\n\tprintf(\"\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\n char dir[50];\n int c,ban=1;\n\n scanf(\"%s\",dir);\n char *p=dir;\n if(dir[0]=='f')\n {\n printf(\"ftp://\");\n p+=3;\n }\n else\n {\n printf(\"http://\");\n p+=4;\n }\n\n while (*p!='\\0')\n {\n if(*p=='r' && ban==1)\n {\n printf(\".ru/\");\n ban=0;\n p+=2;\n }\n printf(\"%c\",*p);\n\n p++;\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[60],*p,h[5]=\"http\",f[4] =\"ftp\";\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n for(i =0;i<3;i++)\n {\n if(s[i]!=f[i])\n {\n break;\n }\n }\n p =strstr(s,\"ru\");\n if(i ==3)\n {\n printf(\"%s://\",f);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n else\n {\n i =4;\n printf(\"%s://\",h);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define NN 64\n\nint main(void)\n{\n\tchar url[NN], tmp[NN], *p;\n\twhile (gets(url)) {\n\t\tp = url;\n\t\tstrncpy(tmp, url, 3);\n\t\ttmp[3] = 0;\n\t\tif (strcmp(tmp, \"ftp\") == 0) {\n\t\t\tprintf(\"ftp://\");\n\t\t\tp += 3;\n\t\t} else {\n\t\t\tprintf(\"http://\");\n\t\t\tp += 4;\n\t\t}\n\t\twhile (!(p[0] == 'r' && p[1] == 'u')) {\n\t\t\tputchar(*p++);\n\t\t}\n\t\tprintf(\".ru\");\n\t\tp += 2;\n\t\tif (*p == '\\0') {\n\t\t\tputs(\"\");\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"/%s\\n\", p);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdio.h>\nint main()\n{\nint i,a,c,d,t=0,j,q=1;\nchar x,arr[99];\nscanf(\"%s\",arr);\nfor(i=0;i<(strlen(arr));i++)\n\t{\n\t\t\n\tif(arr[i-1]=='p'&&t==0)\n\t{printf(\"://\");\n\t\n\tt=1;\n\t}\t\t\n\t\t\n\tif(arr[i]=='r'&&arr[i+1]=='u'&&q==1)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\tprintf(\"ru/\");\n\t\t\tt=2;\n\t\t\tq=2;\n\t\t\ti++;\n\t\t}\n\n\telse\n\t\tprintf(\"%c\",arr[i]);\n\t\n\t}\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint isru(char *a)\n{\n if(*a=='r'&&*(a+1)=='u')\n return 1;\n else \n return 0;\n}\nint main()\n{\n int i,j,k,l,m,n,t,o,p,q;\n int a[1000],b[1000];\n char s[100];\n scanf(\"%s\",s);\n if(s[0]=='f')\n {\n printf(\"ftp://\");\n i=3;\n }\n else\n {\n printf(\"htttp://\");\n i=4;\n }\n for(;s[i];i++)\n {\n if(!isru(&s[i]))\n printf(\"%c\",s[i]);\n else\n {\n printf(\".ru\");\n i+=2;\n break;\n }\n }\n if(s[i])\n {\n printf(\"/\");\n while(s[i])\n {\n printf(\"%c\",s[i]);\n i++;\n }\n }\n printf(\"\\n\");\n \n return 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar d[100];\n\tint i,u,c=0,k=0;\n\tscanf(\"%s\",d);\n\tu=strlen(d);\n\tif(u<8){\n\tif(d[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tc+=4;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>6*/)){\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t}\n\t\t\telse \n\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t}\n\tif(d[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\tc+=3;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>5*/)){\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\telse {printf(\".ru/\");\n\t\t\t\tc=i+2;\n\t\t\t\tbreak;}}\n\t\tfor(i=c;i<u;i++)\n\t\t\tprintf(\"%c\",d[i]);\n\t}}\n\telse{\n\t\tif(d[0]=='h'){\n\t\t\tprintf(\"http://\");\n\t\t\tc+=4;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>6)){\n\t\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\t\tc=i+2;\n\t\t\t\t\t\tk=1;\n\t\t\t\t\t\tbreak;}\n\t\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\t\tbreak;}}\n\t\t\tif(k){\n\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}\n\t\tif(d[0]=='f'){\n\t\t\tprintf(\"ftp://\");\n\t\t\tc+=3;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>5)){\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\t\telse {printf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tbreak;}}\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t}}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,j,k,x=0,flag=0,flog=0;\nchar pp[100];\ngets(pp);\nif(pp[0]=='f')\n { printf(\"ftp://\");\n x=3;}\nelse\n {printf(\"http://\");\n x=4;}\nfor(i=x;i<strlen(pp);i++)\n { printf(\"%c\",pp[i]); \n if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3==strlen(pp)&&x!=i)\n {printf(\".ru\");\n i+=2;\n flag=2;}\n else if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3!=strlen(pp)&&x!=i)\n {printf(\".ru/\");\n i+=2;\n flag=1;}\n }\n \n return 0;\n}\n\n\t\t\t\t \t\t\t \t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k, di, q = 0, h;\n char cad[50], prot[5], dom[45] = \" \", cont[45] = \" \";\n scanf(\"%s\", cad);\n if(cad[0] == 'h'){\n strcpy(prot, \"http\");\n di = 4;\n }else{\n strcpy(prot, \"ftp\");\n di = 3;\n }\n for(k = di; k < strlen(cad); k++){\n if(cad[k] == 'r' && cad[k+1] == 'u' && k != di){\n if(cad[k+2] != '\\0'){\n q = 0;\n for(h = k + 2; h <= strlen(cad); h++){\n cont[q] = cad[h];\n q++;\n }\n }\n break;\n }else{\n dom[q] = cad[k];\n q++;\n }\n }\n printf(\"%s://%s.ru/%s\", prot, dom, cont);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,j,k,x=0,flag=0,flog=0;\nchar pp[55];\ngets(pp);\nif(pp[0]=='f')\n { printf(\"ftp://\");\n x=3;}\nelse\n {printf(\"http://\");\n x=4;}\nfor(i=x;i<strlen(pp);i++)\n { printf(\"%c\",pp[i]); \n if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3==strlen(pp)&&x!=i)\n {printf(\".ru\");\n i+=2;\n flag=1;}\n else if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3!=strlen(pp)&&x!=i)\n {printf(\".ru/\");\n i+=2;\n flag=1;}\n }\n \n return 0;\n}\n\n \t \t \t\t \t \t \t\t\t \t"}, {"source_code": "#include<stdio.h>\nmain () {\n char direccion [51];\n scanf(\"%s\", &direccion);\n int i, n, band;\n i=band=0;\n n=strlen(direccion);\n if (direccion[0]=='h'){\n printf(\"http://\");\n i=4;\n }\n if (direccion[0]=='f'){\n printf(\"ftp://\");\n i=3;\n }\n while (i<n){\n if (direccion[i]=='r' && direccion[i+1]=='u' && band==0){\n printf(\".ru/\");\n band=1;\n i=i+2;\n }\n printf(\"%c\", direccion[i]);\n i++;\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain () {\n char direccion [51];\n scanf(\"%s\", &direccion);\n int i, n, band;\n i=band=0;\n n=strlen(direccion);\n if (direccion[0]=='h'){\n printf(\"http://\");\n i=4;\n }\n if (direccion[0]=='f'){\n printf(\"ftp://\");\n i=3;\n }\n while (i<n){\n printf(\"%c\", direccion[i]);\n if (direccion[i+1]=='r' && direccion[i+2]=='u' && band==0){\n printf(\".ru/\");\n band=1;\n i=i+2;\n }\n i++;\n }\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint Now,i,L;\nchar Str[51];\n\nvoid Judge_Protocol()\n{\n if(Str[Now]=='f')\n {\n printf(\"ftp://\");\n Now+=3;\n }\n else\n {\n printf(\"http://\");\n Now+=4;\n }\n return;\n}\n\nvoid Judge_Domain()\n{\n for(i=Now;i<L;++i)\n {\n if(Str[i]=='r'&&Str[i+1]=='u')\n {\n break;\n }\n printf(\"%c\",Str[i]);\n }\n printf(\".ru\");\n Now=i+2;\n return;\n}\n\nvoid Judge_Context()\n{\n if(Now==L)\n {\n return;\n }\n printf(\"/\");\n for(i=Now;i<L;++i)\n {\n printf(\"%c\",Str[i]);\n }\n printf(\"\\n\");\n return;\n}\n\nint main()\n{\n scanf(\"%s\",Str);\n Now=0;\n L=strlen(Str);\n Judge_Protocol();\n Judge_Domain();\n Judge_Context();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int k, n, i, l;\n char note[51];\n char address[60];\n \n scanf(\"%s\", note);\n \n if(note[0] == 'h') /*si la primera letra es h, se puede asumir que es http*/\n k = 4;\n else\n k = 3; /*si no, se asume que es ftp*/\n \n for(i=0; i<k; i++) /*se copian los caracteres del cuaderno a la direccion*/\n address[i] = note[i];\n \n n = k;\n \n address[k++] = '/'; /*se agregan los caracteres divisorios despues del protocolo*/\n address[k++] = '/';\n address[k++] = ':';\n \n for(i=strlen(note)-1; i>n; i--)\n {\n if(note[i] == 'r' && note[i+1] == 'u')\n {\n l = i;\n break;\n }\n }\n \n for(i=n; i<l; i++)\n {\n address[k++] = note[i];\n }\n \n address[k++] = '.';\n address[k++] = 'r';\n address[k++] = 'u';\n \n if(note[l+2] != '\\0')\n {\n address[k++] = '/';\n \n for(i=l+2; i<strlen(note); i++)\n address[k++] = note[i];\n }\n \n address[k] = '\\0';\n \n printf(\"%s\", address);\n \n \n /*printf(\"\\n\");\n system(\"pause\");*/\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint h,w,i,j;\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tw=strlen(str);\n\th=0;\n\tif (str[0]=='h'){\n\t\tprintf(\"http://\");\n\t\th=h+4;\n\t\tfor (i=h;str[i]!='r' || str[i+1]!='u';i++){\n\t\t\tprintf(\"%c\",str[i]);\n\t\t\th=h+1;\n\t\t}\n\t\tprintf(\".ru\");\n\t\th=h+2;\n\t\tif(h<w){\n\t\t\tprintf(\"/\");\n\t\t\tfor (j=h;j<w;j++){\n\t\t\t\tprintf(\"%c\",str[j]);\n\t\t\t}\n\t\t}\n\t}\n\telse if (str[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\th=h+3;\n\t\tfor (i=h;str[i]!='r' || str[i+1]!='u';i++){\n\t\t\tprintf(\"%c\",str[i]);\n\t\t\th=h+1;\n\t\t}\n\t\tprintf(\".ru\");\n\t\th=h+2;\n\t\tif(h<w){\n\t\t\tprintf(\"/\");\n\t\t\tfor (j=h;j<w;j++){\n\t\t\t\tprintf(\"%c\",str[j]);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<ctype.h>\n\nint main()\n{\n int i,var,inter,p,dimen;\n char direccion[50]=\" \",protocolo[5];\n char *protocolos[]={\"http\",\"ftp\"};\n scanf(\"%s\",direccion);\n if(direccion[0]=='h')\n {\n strcpy(protocolo,protocolos[0]);\n var=4;\n }\n else\n {\n strcpy(protocolo,protocolos[1]);\n var=3;\n }\n i=var;\n for(i=var;i<(strlen(direccion)-1);i++)\n {\n if(direccion[i]=='r' && direccion[i+1]=='u')\n {\n p=i;\n i=(strlen(direccion)-1);\n }\n }\n i=0;\n fflush(stdin);\n char dominio[p-var];\n if((p-var)>0)\n {\n for(i=var;i<=p-1;i++)\n {\n dominio[i-var]=direccion[i];\n }\n }\n i=0;\n dimen=(strlen(direccion)-1)-(p+1);\n char contexto[dimen];\n\n if((p+1)<strlen(direccion))\n {\n for( i=p+2; i<=strlen(direccion); i++)\n {\n contexto[i-(p+2)]=direccion[i];\n\n }\n }\n else\n {\n for( i=p+2; i<=strlen(direccion); i++)\n {\n contexto[i-(p+2)]=' ';\n\n }\n }\n fflush(stdin);\n printf(\"%s://%s.ru/%s\\n\",protocolo,dominio,contexto);\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\tif(a[i+4] == 'r' && a[i+5] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+4],a[i+5]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+3;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\ti = i+1;\n\t\t\tcount2++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint u,i,j;\n\tchar arr[100];\n\tscanf(\"%s\",arr);\n\tu=strlen(arr);\n\tif(arr[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tfor(i=4;;i++){\n\t\t\tif(arr[i]=='r'){\n\t\t\t\tif(arr[i+1]=='u'){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\tprintf(\"%c\",arr[i]);\n\t\t\t\t\n\t\t}\n\t\tfor(i+=2;i<u;i++)\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\telse{\n\t\tprintf(\"ftp://\");\n\t\tfor(i=3;;i++){\n if(arr[i]=='r'){\n if(arr[i+1]=='u'){\n printf(\".ru/\");\n break;\n }\n }\n\t\t\t\n \tprintf(\"%c\",arr[i]);\n }\n\t\tfor(i+=2;i<u;i++)\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100],ftp[]=\"ftp\",http[]=\"http\";\n\tint c,i,j;\n\tgets(a);\n\tc=0;\n\tfor(i=0;i<3;i++)\n\t\tif(a[i]==ftp[i])\n\t\t\tc++;\n\tif(c==3) { printf(\"ftp://\");\t }\n\telse { printf(\"http://\"); c=4;}\n\t\n\tif(a[c]='r' && a[c+1]=='u')\n\t{\n\t\tprintf(\"ru\");\n\t\tc+=2;\n\t}\n\n\tfor(i=c;(a[i]!='r' || a[i+1]!='u');i++)\n\t\tprintf(\"%c\",a[i]);\n\t\n\tprintf(\".ru\");\n\t\n\tif(a[i+2]!='\\0')\n\t\tprintf(\"/\");\n\t\n\tfor(i+=2;a[i]!='\\0';i++)\n\t\tprintf(\"%c\",a[i]);\n\t\n\tprintf(\"\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,j,k,x=0,flag=0,flog=0;\nchar pp[55];\ngets(pp);\nif(pp[0]=='f')\n { printf(\"ftp://\");\n x=3;}\nelse\n {printf(\"http://\");\n x=4;}\nfor(i=x;i<strlen(pp);i++)\n { printf(\"%c\",pp[i]); \n if(pp[i+1]=='r'&&pp[i+2]=='u'&&flog==0&&i==x)\n {printf(\"ru\");\n i+=2;\n flog=1;}\n else if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3==strlen(pp))\n {printf(\".ru\");\n i+=2;\n flag=1;}\n else if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3!=strlen(pp))\n {printf(\".ru/\");\n i+=2;\n flag=1;}\n }\n \n return 0;\n}\n\n \t\t\t \t\t \t\t \t\t \t \t \t \t"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\n char dir[50];\n int c,ban=1;\n\n scanf(\"%s\",dir);\n char *p=dir;\n if(dir[0]=='f')\n {\n printf(\"ftp://\");\n p+=3;\n }\n else\n {\n printf(\"http://\");\n p+=4;\n }\n\n while (*p!='\\0')\n {\n if(*p=='r' && ban==1)\n {\n p++;\n if( *p=='u')\n {\n printf(\".ru/\");\n ban=0;\n p++;\n }else\n p--;\n }\n printf(\"%c\",*p);\n p++;\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char a[51],subcadena[]=\"ru\";\n int i,l,j,posicion;\n scanf(\"%s\",a);\n l=strlen(a);\n char b[l];\n posicion = strstr(a,subcadena)-a;\n if (a[0]=='h')\n {\n j=4;\n i=7;\n b[0]='h';\n b[1]='t';\n b[2]='t';\n b[3]='p';\n b[4]=':';\n b[5]='/';\n b[6]='/';\n }else if(a[0]=='f')\n {\n j=3;\n i=6;\n b[0]='f';\n b[1]='t';\n b[2]='p';\n b[3]=':';\n b[4]='/';\n b[5]='/';\n }\n while (j!=posicion)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='.';\n b[i+1]='r';\n b[i+2]='u';\n b[i+3]='/';\n i+=4;\n j+=2;\n while (j<l)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n printf(\"%s\",b);\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain () {\n char direccion [51];\n scanf(\"%s\", &direccion);\n int i, n, band;\n i=band=0;\n n=strlen(direccion);\n if (direccion[0]=='h'){\n printf(\"http://\");\n i=4;\n }\n if (direccion[0]=='f'){\n printf(\"ftp://\");\n i=3;\n }\n while (i<n){\n printf(\"%c\", direccion[i]);\n if (direccion[i+1]=='r' && direccion[i+2]=='u' && band==0){\n printf(\".ru/\");\n band=1;\n i=i+2;\n }\n i++;\n }\nreturn 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[56]);\n\nint main ()\n{\n char texto[56];\n scanf(\"%s\",texto);\n link(texto);\n return 0;\n}\n\nvoid link(char texto[56])\n{\n char principio[56]=\"\";\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=strstr(texto,\"ru\")-texto;\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru\");\n i=i+2;\n if(i<largo)\n strcatchar(principio,'/');\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n printf(\"%s\",principio);\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define S 50\n\nint main (void) {\n int i = 0;\n char buf[S + 2];\n fgets (buf, S + 2, stdin);\n i += printf (\"%s\", buf[i] == 'f' ? \"ftp://\" : \"http://\") - 3;\n i += printf (\"%.*s\", (int) (strstr (buf, \"ru\") - (buf + i)), buf + i);\n i += printf (\".ru/\") - 2;\n printf (\"%s\", buf + i);\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nconst char http[]=\"http\";\nconst char ftp[]=\"ftp\";\nconst char ru[]=\"ru\";\n\nvoid findprotocol(char* str) {\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr=NULL;\n ptr=strstr(str,ftp);\n if (ptr!=NULL) {\n if ((ptr-str)==0) {\n strncpy(buffer1,str+3,strlen(str)-3+1);\n str[3]=':';str[4]='/';str[5]='/';\n strncpy(str+6,buffer1,strlen(buffer1)+1);\n }\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n}\n\nvoid finddomainandcontext(char* str) {\n int pos;\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr;\n ptr=strstr(str,ru);\n pos=ptr-str;\n if (str[pos-1]=='/') {\n ptr=strstr(str+pos+3,ru);\n }\n pos=ptr-str;\n strncpy(buffer1,str+pos,strlen(str)-pos+1);\n str[ptr-str]='.';\n strncpy(str+pos+1,buffer1,strlen(buffer1)+1);\n free(buffer1);\n buffer1=calloc(100,sizeof(char));\n if (pos+3!=strlen(str)) {\n strncpy(buffer1,str+pos+3,strlen(str)-pos-3+1);\n str[ptr-str+3]='/';\n strncpy(str+pos+4,buffer1,strlen(buffer1)+1);\n\n }\n}\n\nint main() {\n char input[100];\n scanf(\"%s\",input);\n findprotocol(input);\n finddomainandcontext(input);\n printf(\"%s\",input);\n return (0);\n}"}, {"source_code": "/* Programa que lee una cadena de hasta 50 caracteres y lo despliega como\n una direccion IP.\n*/\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#define CARACTERES 50\nint posExtension(int indice, char string[CARACTERES]);\n\nint main(){\n /* Declaraci\u00f3n de variables */\n char string[CARACTERES];\n int indice = 0;\n int pos;\n /* Lectura de variables */\n scanf(\"%s\", string);\n\n while(string[indice]!='p')\n printf(\"%c\", string[indice++]);\n\n printf(\"%c://\", string[indice++]);\n\n /* Suma dos posiciones para evitar que el dominio sea tomado\n como la extension ru.\n */\n pos = posExtension(indice+2, string);\n\n while(indice!=pos)\n printf(\"%c\", string[indice++]);\n\n printf(\".ru\");\n\n /* Suma dos unidades para obviar la extension .ru */\n indice += 2;\n\n while(indice != strlen(string)){\n printf(\"%c\", string[indice++]);\n printf(\"/\");\n }\n\n return 0;\n}\n\n\nint posExtension(int indice, char string[CARACTERES]){\n int i;\n i=indice;\n do{\n while(string[i++]!='r');\n }while(string[i++]!='u');\n /* Resta las posiciones de ru */\n return i-2;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint buscar(char a[], int i);\nvoid dominio( char a[], char b[], int y, int x );\nvoid contexto( char a[], char b[], int x);\nvoid concatenar(char a[], char b[], char c[]);\n\nint main()\n{\n char cadena1[60];\n char protocol[5];\n char domain[50];\n char context[50];\n int i, pos = 0, aux = 0;\n\n scanf(\"%s\", cadena1);\n\n if( cadena1[0] == 'f' )\n {\n for( i = 0; i < 3; i++)\n {\n protocol[i] = cadena1[i];\n pos++;\n }\n\n aux = buscar( cadena1, strlen(cadena1) );\n dominio(cadena1, domain, pos, aux);\n contexto(cadena1, context, aux+3);\n concatenar(protocol, domain, context);\n }\n else\n {\n for( i = 0; i < 4; i++)\n {\n protocol[i] = cadena1[i];\n pos++;\n }\n\n aux = buscar( cadena1, strlen(cadena1) );\n dominio(cadena1, domain, pos, aux);\n contexto(cadena1, context, aux+3);\n concatenar(protocol, domain, context);\n }\n\n return 0;\n}\n\n\nint buscar(char a[], int i)\n{\n int val = 0;\n i--;\n while ( i > 5)\n {\n if(a[i] == 'u')\n {\n if(a[i-1] == 'r'){\n val = i-2;\n }else\n i--;\n }\n else\n {\n i--;\n }\n if (val != 0)\n break;\n }\n return val;\n}\n\nvoid dominio( char a[], char b[], int y, int x )\n{\n int j = 0;\n while( y <= x )\n {\n b[j] = a[y];\n y++;\n j++;\n }\n}\n\nvoid contexto( char a[], char b[], int x)\n{\n int i = 0;\n char s[] = \"\";\n if( x != strlen(a)+1)\n {\n while( x < strlen(a)+1 )\n {\n b[i] = a[x];\n x++;\n i++;\n }\n }else\n strcmp(b, s);\n}\n\nvoid concatenar(char a[], char b[], char c[])\n{\n char cad1[] = \"://\";\n char cad2[] = \".ru\";\n char cad3[] = \"/\";\n char x[70];\n char w[] = \"\";\n strcpy(x, w);\n strcat(x, a);\n strcat(x, cad1);\n strcat(x, b);\n strcat(x, cad2);\n if ( strcmp(w, c) != 0 )\n {\n strcat(x, cad3);\n strcat(x, c);\n }\n printf(\"%s\", x);\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[56]);\n\nint main ()\n{\n char texto[56];\n scanf(\"%s\",texto);\n link(texto);\n /*printf(\"%s\",texto);*/\n return 0;\n}\n\nvoid link(char texto[56])\n{\n char principio[56]=\"\";\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=strstr(texto,\"ru\")-texto;\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru/\");\n i=i+2;\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n printf(\"%s\",principio);\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\nint i, b;\nchar c[50];\ngets(c);\n\nif (c[0] != '\\0'){\n if (c[0] == 'h'){\n printf(\"http://\");\n i = 4;\n }\n else{\n printf(\"ftp://\");\n i = 3;\n }\n b = 0;\n while (c[i] != '\\0'){\n if (c[i+1] == 'r' && c[i+2] == 'u' && b == 0){\n printf(\"%c\", c[i]);\n b = 1;\n printf(\".ru/\");\n i = i + 3;\n }\n printf(\"%c\", c[i]);\n i++;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[55];\n int i,k,len,f;\n while(gets(s))\n {\n len=strlen(s);\n if(s[0]=='h')\n {\n for(i=0;i<4;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=4;\n }\n else\n if(s[0]=='f')\n {\n for(i=0;i<3;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=3;\n }\n for(i=k,f=0;i<len;i++)\n {\n if(s[i]=='r'&&s[i+1]=='u'&&f==0)\n {\n printf(\".ru\");f=1;i=i+2;\n if(i<len)\n printf(\"/\");\n }\n printf(\"%c\",s[i]);\n }\n printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int lon,i,j,ban;\n char s[51]={NULL};\n fflush(stdin);\n scanf(\"%[^\\n]\",s);\n lon=strlen(s);\n ban=0;\n if (s[0]!=NULL){\n if(s[0]=='f'){\n printf(\"ftp://\");\n for(i=4;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=4){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n i=lon;\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n\n }\n }\n printf (\"%c\", s[i-1]);\n }else if(s[0]=='h'){\n printf(\"http://\");\n for(i=5;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=5){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n i=lon;\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n }\n }\n printf (\"%c\", s[i-1]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nvoid url(char cadena[],int i);\n\nint main() {\nchar cadena[50];\nint i;\nfflush(stdin);\ngets(cadena);\n if(cadena[0]=='f'){\n for(i=0;i<3;i++){\n printf(\"%c\", cadena[i]);\n }\n url(cadena,i);\n }\n else if(cadena[0]=='h'){\n for(i=0;i<4;i++){\n printf(\"%c\", cadena[i]);\n }\n url(cadena,i);\n }\n return 0;\n}\n\nvoid url(char cadena[], int i){\n int flag=0;\n printf(\"://\");\n while(flag==0){\n if(cadena[i]!='r' && cadena[i+1]!='u'){\n printf(\"%c\",cadena[i]);\n i++;\n }\n else{\n printf(\".%c%c/\", cadena[i],cadena[i+1]);\n flag=-1;\n i=i+2;\n }\n }\n while(cadena[i]!='\\0'){\n printf(\"%c\",cadena[i]);\n i++;\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n// ftp = 7 http = 5\n\nint controlar(char *c1, char *c2)\n{\n int i=0;\n\n if(c1[0]=='r' && c2[0]=='u')\n {\n i=1;\n }else\n {\n i=0;\n }\n return i;\n}\nint main()\n{\n char dir_err[51];\n int n,r;\n n=r=0;\n scanf(\"%s\",dir_err);\n if (dir_err[n]=='h')\n {\n printf(\"http://\");\n n=4;\n }else if (dir_err[n])\n {\n printf(\"ftp://http\");\n n=7;\n }\n\n do\n {\n\n printf(\"%c\",dir_err[n]);\n n++;\n\n }while(0==controlar(&dir_err[n],&dir_err[n+1]) );\n printf(\".ru\");\n n=n+2;\n if(dir_err[n]!='\\0')\n {\n printf(\"/\");\n do{\n printf(\"%c\",dir_err[n]);\n n++;\n }while(dir_err[n]!='\\0');\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char a[51],subcadena[]=\"ru\";\n int i,l,j,j1,posicion,x=0;\n scanf(\"%s\",a);\n l=strlen(a);\n char b[l+5];\n posicion = strstr(a,subcadena)-a;\n if (a[0]=='h')\n {\n j=4;\n j1=6;\n i=7;\n b[0]='h';\n b[1]='t';\n b[2]='t';\n b[3]='p';\n b[4]=':';\n b[5]='/';\n b[6]='/';\n }else if(a[0]=='f')\n {\n j=3;\n j1=5;\n i=6;\n b[0]='f';\n b[1]='t';\n b[2]='p';\n b[3]=':';\n b[4]='/';\n b[5]='/';\n }\n if(posicion==3 || posicion==4)\n {\n while(x==0)\n {\n if(a[j1]=='r' && a[j1+1]=='u')\n {\n x=1;\n }\n j1++;\n }\n posicion=j1-1;\n }\n while (j!=posicion)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='.';\n b[i+1]='r';\n b[i+2]='u';\n b[i+3]='/';\n i+=4;\n j+=2;\n while (j<l)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='\\0';\n printf(\"%s\",b);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[60],*p,h[5]=\"http\",f[4] =\"ftp\";\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n for(i =0;i<3;i++)\n {\n if(s[i]!=f[i])\n {\n break;\n }\n }\n p =strstr(s,\"ru\");\n if(i ==3)\n {\n printf(\"%s://\",f);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n else\n {\n i =4;\n printf(\"%s://\",h);\n p =strstr(s,\"ru\");\n for(;i<p-s;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n ++p;\n ++p;\n if(*p)\n {\n int len =strlen(s);\n printf(\"/\");\n for(;p<s+len;p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[52];\n scanf(\"%s\",a);\n int i,b=4,m=3,p,j;\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[0]=='h')\n {\n while(b--)\n {\n printf(\"%c\",a[i]);\n i++;\n }\n printf(\"://\");\n //printf(\"\\n%d\",i);\n p=i;\n for(j=p;a[j]!='r'||a[j+1]!='u';j++)\n printf(\"%c\",a[j]);\n printf(\".ru\");\n //printf(\"%d\",j);\n if(a[j+2]!='\\0'){\n printf(\"/\");\n for(j=j+2;a[j]!='\\0';j++)\n {\n printf(\"%c\",a[j]);\n }\n }\n break;\n }\n else\n {\n while(m--)\n {\n printf(\"%c\",a[i]);\n i++;\n }\n printf(\"://\");\n p=i;\n for(j=p;a[j]!='r'||a[j+1]!='u';j++)\n printf(\"%c\",a[j]);\n printf(\".ru\");\n if(a[j+2]!='\\0'){\n printf(\"/\");\n for(j=j+2;a[j]!='\\0';j++)\n {\n printf(\"%c\",a[j]);\n }\n }\n break;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint i;\n\tchar a[51];\n\tscanf(\"%s\", a);\n\tif (a[0] == 'f'){\n\t\tprintf(\"ftp://\");\n\t\tfor(i=3;i<5;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 5; a[i]!='r'||a[i+1]!='u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru/\");\n\t\ti+=2;\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\telse{\n\t\tprintf(\"http://\");\n\t\tfor(i=4;i<6;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 6; a[i] != 'r' || a[i + 1] != 'u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru/\");\n\t\ti+=2;\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tchar a[55];\n\tint n,k,m,l,b,j,i;\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='h' && a[i+1]=='t' && a[i+2]=='t' && a[i+3]=='p'){printf(\"http://\");m=3;break;}\n\t\tif(a[i]=='f' && a[i+1]=='t' && a[i+2]=='p'){printf(\"fpt://\");m=2;break;}\n\t}\n\tfor(i=m+1;i<n;i++)\n\t{\n\t\tif(a[i]=='r' && a[i+1]=='u'){j=i;break;}\n\t}\n\tfor(i=m+1;i<j;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru/\");\n\tj+=2;\n\tfor(i=j;i<n;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\n\nint main()\n{\n char direccion[56];\n int i;\n int punto;\n\n scanf(\"%s\", direccion);\n\n if(direccion[0] == 'h')\n {\n for(i=strlen(direccion); i >= 4; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[4] = ':';\n direccion[5] = '/';\n direccion[6] = '/';\n }\n else\n {\n for(i=strlen(direccion); i >= 3; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[3] = ':';\n direccion[4] = '/';\n direccion[5] = '/';\n }\n punto = strstr(direccion,\"ru\") - direccion;\n for(i=strlen(direccion); i >= punto; i--)\n {\n direccion[i+1] = direccion[i];\n }\n direccion[punto] = '.';\n\n for(i=strlen(direccion); i >= punto+3; i--)\n {\n direccion[i+1] = direccion[i];\n }\n direccion[punto+3] = '/';\n\n\n printf(\"%s\", direccion);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a,b;\n int i,done,once;\n done = 0;\n once = 0;\n a=getchar();\n if(a=='h')\n {\n for(i=0;i<4;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n } \n }\n if(a=='f')\n {\n for(i=0;i<3;i++)\n {\n printf(\"%c\",a);\n a=getchar();\n }\n }\n printf(\"://\");\n while(a!='\\n')\n {\n if(a!='r' && done == 0 )\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a!='r' && done != 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 0)\n {\n printf(\"%c\",a);\n once = 1;\n a=getchar();\n }\n else if(a=='r' && done == 0 && once == 1)\n {\n b = getchar();\n if(b=='u')\n {\n printf(\".ru/\");\n done = 1;\n a=getchar();\n }\n else if(b!='u')\n {\n printf(\"%c\",a);\n once = 1;\n a=b;\n }\n } \n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n char direccion[56];\n char aux[51];\n int i;\n int punto;\n\n scanf(\"%s\", direccion);\n\n if(direccion[0] == 'h')\n {\n for(i=strlen(direccion); i >= 4; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[4] = ':';\n direccion[5] = '/';\n direccion[6] = '/';\n }\n else\n {\n for(i=strlen(direccion); i >= 3; i--)\n {\n direccion[i+3] = direccion[i];\n }\n direccion[3] = ':';\n direccion[4] = '/';\n direccion[5] = '/';\n }\n\n for(i=8; direccion[i]!='\\0'; i++)\n {\n aux[i-8]= direccion[i];\n }\n\n\n punto = strstr(aux,\"ru\") - aux + 8;\n\n for(i=strlen(direccion); i >= punto; i--)\n {\n direccion[i+1] = direccion[i];\n }\n\n direccion[punto] = '.';\n\n for(i=strlen(direccion); i >= punto+3; i--)\n {\n direccion[i+1] = direccion[i];\n }\n direccion[punto+3] = '/';\n\n\n printf(\"%s\", direccion);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define maxn 1000\nint main()\n{\n int i,j,mark=0,len;\n char a[maxn],m[10]={'r','u'};\n scanf(\"%s\",a);\n len=strlen(a);\n for(i=0;i<=len-2;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[i+j]!=m[j])\n break;\n }\n if(j==2)\n {\n mark=i;\n break;\n }\n }\n if(a[2]=='t')\n {\n printf(\"http://\");\n for(i=3;i<mark;i++)\n printf(\"%c\",a[i]);\n printf(\".ru\");\n if(len!=mark+2)\n {\n printf(\"/\");\n for(i=mark+2;i<len;i++)\n printf(\"%c\",a[i]);\n }\n }\n else\n {\n printf(\"ftp://\");\n for(i=3;i<mark;i++)\n printf(\"%c\",a[i]);\n printf(\".ru\");\n if(len!=mark+2)\n {\n printf(\"/\");\n for(i=mark+2;i<len;i++)\n printf(\"%c\",a[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n char input[50];\n \n char *domain = (char *) malloc(50);\n char *subDomain = (char *) malloc(50);\n int i, k, domainPos, subDomainPos;\n scanf(\"%s\",input);\n if(input[0]=='h')\n {\n printf(\"http://\");\n k = 4;\n }else\n {\n printf(\"ftp://\");\n k = 3;\n } \n for (i = 50 - 1; i >= k ; i--)\n {\n if(input[i-1] == 'r' && input[i] == 'u')\n {\n\n domainPos = i - 1;\n subDomainPos = i + 1;\n break;\n }\n }\n strncpy(domain,&input[k], domainPos - k);\n strcpy(subDomain,&input[subDomainPos]);\n printf(\"%s\",domain);\n printf(\".ru\");\n if(strcmp(subDomain,\"\"))\n printf(\"/%s\\n\",subDomain);\n \n return(0);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char b[52];\n int s,i,j;\n scanf(\"%s\",b);\n if(b[0]=='h'){\n printf(\"http://\");\n s=strlen(b);\n if(s>7){\n i=5;\n printf(\"%c\",b[4]);\n while(b[i]!='r'&&b[i+1]!='u'){\n printf(\"%c\",b[i]);\n i++;\n }\n printf(\".ru\");\n if(b[i+2]!='\\0')\n printf(\"/\");\n for(j=i+2;j<s;j++)\n printf(\"%c\",b[j]); \n }\n else\n printf(\"%c.ru\",b[4]); \n }\n else{\n printf(\"ftp://\");\n s=strlen(b);\n if(s>6){\n i=4;\n printf(\"%c\",b[3]);\n while(b[i]!='r'&&b[i+1]!='u'){\n printf(\"%c\",b[i]);\n i++;\n }\n printf(\".ru\");\n if(b[i+2]!='\\0')\n printf(\"/\");\n for(j=i+2;j<s;j++)\n printf(\"%c\",b[j]);\n }\n else\n printf(\"%c.ru\",b[3]);\n }\n return 0;\n}\n \n \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n char input[50];\n \n char *dom = (char *) malloc(50);\n char *subDomain = (char *) malloc(50);\n int i, k, domainPos, subDomainPos;\n scanf(\"%s\",input);\n if(input[0]=='h')\n {\n printf(\"http://\");\n k = 4;\n }else\n {\n printf(\"ftp://\");\n k = 3;\n } \n for (i = 50 - 1; i >= k ; i--)\n {\n if(input[i-1] == 'r' && input[i] == 'u')\n {\n\n domainPos = i - 1;\n subDomainPos = i + 1;\n break;\n }\n }\n strncpy(dom,&input[k], domainPos - k);\n strcpy(subDomain,&input[subDomainPos]);\n printf(\"%s\",dom);\n printf(\".ru\");\n if(strcmp(subDomain,\"\"))\n printf(\"/%s\\n\",subDomain);\n \n return(0);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int lon,i,j,ban;\n char s[51]={\"\\0\"};\n fflush(stdin);\n scanf(\"%[^\\n]\",s);\n lon=strlen(s);\n ban=0;\n if(s[0]=='f'){\n printf(\"ftp://\");\n for(i=4;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=4){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n break;\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n\n }\n }\n printf (\"%c\", s[i-1]);\n }else if(s[0]=='h'){\n printf(\"http://\");\n for(i=5;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=5){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n }\n }\n printf (\"%c\", s[i-1]);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint i;\n\tchar a[51];\n\tscanf(\"%s\", a);\n\tif (a[0] == 'f'){\n\t\tprintf(\"ftp://\");\n\t\tfor(i=3;i<5;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 5; a[i]!='r'||a[i+1]!='u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru\");\n\t\ti+=2;\n\t\tif(i<strlen(a))\n\t\tprintf(\"/\");\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\telse{\n\t\tprintf(\"http://\");\n\t\tfor(i=4;i<6;i++)\n\t\tprintf(\"%c\",a[i]);\n\t\tfor (i = 6; a[i] != 'r' || a[i + 1] != 'u'; i++){\n\t\t\tprintf(\"%c\", a[i]);\n\t\t}\n\t\tprintf(\".ru\");\n\t\ti+=2;\n\t\tif(i<strlen(a));\n\t\tprintf(\"/\");\n\t\tfor (; i < strlen(a); i++)\n\t\t\tprintf(\"%c\", a[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100]=\"\";\n int pos,i;\n// memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n pos = 'h'==s[0] ? 4 : 3;\n for(i =0;i<pos;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n for(;i<strlen(s);i++)\n {\n if(s[i] =='r'&&s[i+1] =='u')\n {\n break;\n }\n }\n for(;pos<i;pos++)\n {\n printf(\"%c\",s[pos]);\n }\n printf(\".ru\");\n pos +=2;\n if(s[pos])\n {\n printf(\"/\");\n for(;pos<strlen(s);pos++)\n {\n printf(\"%c\",s[pos]);\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i;\n char DirWeb[50];\n char aux[53]=\"\";\n char s[55]=\"\";\n gets(DirWeb);\n int p,c,flag=0;\n if(DirWeb[0]=='h')\n {\n strcpy(aux,\"http://\");\n Cpy(aux,DirWeb,4,3);\n p=7;\n }else if(DirWeb[0]=='f')\n {\n strcpy(aux,\"ftp://\");\n Cpy(aux,DirWeb,3,3);\n p=6;\n }\n\n for(i=p;aux[i]!='\\0';i++)\n {\n if(aux[i]=='r' && aux[i+1]=='u' && flag==0)\n {\n strncat(s,aux,i);\n strcat(s,\".ru/\");\n c=i+2;\n Cpy(s,aux,c,2);\n flag=1;\n }\n }\n puts(s);\n\n return 0;\n}\n\nvoid Cpy(char *str1,char *str2,int a,int b)\n{\n int i;\n for(i=a;(str1[i+b]=str2[i])!='\\0';i++)\n {\n str1[i+b]=str2[i];\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tchar a[55];\n\tint n,k,m,l,b,j,i;\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='h' && a[i+1]=='t' && a[i+2]=='t' && a[i+3]=='p'){printf(\"http://\");m=3;break;}\n\t\tif(a[i]=='f' && a[i+1]=='t' && a[i+2]=='p'){printf(\"fpt://\");m=2;break;}\n\t}\n\tfor(i=m+1;i<n;i++)\n\t{\n\t\tif(a[i]=='r' && a[i+1]=='u'){j=i;break;}\n\t}\n\tfor(i=m+1;i<j;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\".ru/\");\n\tj+=2;\n\tfor(i=j;i<n;i++)\n\t\tprintf(\"%c\",a[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nconst char http[]=\"http\";\nconst char ftp[]=\"ftp\";\nconst char ru[]=\"ru\";\n\nvoid findprotocol(char* str) {\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr=NULL;\n ptr=strstr(str,ftp);\n if (ptr!=NULL) {\n if ((ptr-str)==0) {\n strncpy(buffer1,str+3,strlen(str)-3+1);\n str[3]=':';str[4]='/';str[5]='/';\n strncpy(str+6,buffer1,strlen(buffer1)+1);\n }\n } else {\n strncpy(buffer1,str+4,strlen(str)-4+1);\n str[4]=':';str[5]='/';str[6]='/';\n strncpy(str+7,buffer1,strlen(buffer1)+1);\n }\n}\n\nvoid finddomainandcontext(char* str) {\n int pos;\n char* buffer1=NULL;\n buffer1=calloc(100,sizeof(char));\n char* ptr;\n ptr=strstr(str,ru);\n pos=ptr-str;\n strncpy(buffer1,str+pos,strlen(str)-pos+1);\n str[ptr-str]='.';\n strncpy(str+pos+1,buffer1,strlen(buffer1)+1);\n free(buffer1);\n buffer1=calloc(100,sizeof(char));\n if (pos+3!=strlen(str)) {\n strncpy(buffer1,str+pos+3,strlen(str)-pos-3+1);\n str[ptr-str+3]='/';\n strncpy(str+pos+4,buffer1,strlen(buffer1)+1);\n\n }\n}\n\nint main() {\n char input[100];\n scanf(\"%s\",input);\n findprotocol(input);\n finddomainandcontext(input);\n printf(\"%s\",input);\n return (0);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1000]=\"\";\n int pos,i;\n// memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n pos = 'h'==s[0] ? 4 : 3;\n for(i =0;i<pos;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n for(;i<strlen(s);i++)\n {\n if(s[i] =='r'&&s[i+1] =='u')\n {\n break;\n }\n }\n for(;pos<i;pos++)\n {\n printf(\"%c\",s[pos]);\n }\n printf(\".ru\");\n pos +=2;\n if(s[pos])\n {\n printf(\"/\");\n for(;pos<strlen(s);pos++)\n {\n printf(\"%c\",s[pos]);\n }\n }\n printf(\"\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar cadena[200000];\nint main(){\n int i,j=1,c=0;\n scanf(\"%s\", cadena);\n for(i=0;cadena[i]!='\\0';i++){\n c++;\n }\n int vec[c];\n for(i=0;i<c;i++){\n vec[i]=0;\n }\n int k=0,a=0,b=0,op=0;\n for(i=0;i<c-1;i++){\n op=0;\n if(cadena[i]==cadena[i+1]){\n vec[i]=1;\n vec[i+1]=1;\n i++;\n if(i>=2){\n if(k==0){\n if(vec[i-2]!=1){\n a=i-2;\n j=1;\n }else{\n j=0;\n }\n }\n if(j==1){\n b=i+1;\n while(op==0 && a>=0 && b<=c){\n if(cadena[a]==cadena[b]){\n vec[a]=1;\n vec[b]=1;\n a=a-1;\n while(vec[a]==1){\n a--;\n }\n b=b+1;\n k=1;\n }else{\n op=1;\n }\n k=1;\n }\n i=b-1;\n }\n }\n\n }else{\n k=0;\n }\n }\nfor(i=0;cadena[i]!='\\0';i++){\n if(vec[i]!=1){\n printf(\"%c\", cadena[i]);\n }\n}\nreturn 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar d[100];\n\tint i,u,c=0,k=0;\n\tscanf(\"%s\",d);\n\tu=strlen(d);\n\tif(u<8){\n\tif(d[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tc+=4;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>6*/)){\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t}\n\t\t\telse \n\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t}\n\tif(d[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\tc+=3;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>5*/)){\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\telse {printf(\".ru/\");\n\t\t\t\tc=i+2;\n\t\t\t\tbreak;}}\n\t\tfor(i=c;i<u;i++)\n\t\t\tprintf(\"%c\",d[i]);\n\t}}\n\telse{\n\t\tif(d[0]=='h'){\n\t\t\tprintf(\"http://\");\n\t\t\tc+=4;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>6)){\n\t\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\t\tc=i+2;\n\t\t\t\t\t\tk=1;\n\t\t\t\t\t\tbreak;}\n\t\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\t\tbreak;}}\n\t\t\tif(k){\n\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}\n\t\tif(d[0]=='f'){\n\t\t\tprintf(\"ftp://\");\n\t\t\tc+=3;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>5)){\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\t\telse {printf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tbreak;}}\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t}}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char a[51],subcadena[]=\"ru\";\n int i,l,j,j1,posicion;\n scanf(\"%s\",a);\n l=strlen(a);\n char b[l+5];\n posicion = strstr(a,subcadena)-a;\n if (a[0]=='h')\n {\n j=4;\n j1=6;\n i=7;\n b[0]='h';\n b[1]='t';\n b[2]='t';\n b[3]='p';\n b[4]=':';\n b[5]='/';\n b[6]='/';\n }else if(a[0]=='f')\n {\n j=3;\n j1=5;\n i=6;\n b[0]='f';\n b[1]='t';\n b[2]='p';\n b[3]=':';\n b[4]='/';\n b[5]='/';\n }\n if(posicion==3 || posicion==4)\n {\n while(a[j1]!='r' && a[j1+1]!='u')\n {\n j1++;\n }\n posicion=j1-1;\n }\n while (j!=posicion)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='.';\n b[i+1]='r';\n b[i+2]='u';\n b[i+3]='/';\n i+=4;\n j+=2;\n while (j<l)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='\\0';\n printf(\"%s\",b);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdio.h>\nint main()\n{\nint i,a,c,d,t=0,j,q=1,y=0;\nchar x,arr[99];\nscanf(\"%s\",arr);\nfor(i=0;i<(strlen(arr));i++)\n\t{\n\t\t\n\tif(arr[i-1]=='p'&&y==0)\n\t{printf(\"://\");\n\ty=1;\n\tt=1;\n\t}\t\t\n\t\t\n\tif(arr[i]=='r'&&arr[i+1]=='u'&&q==1&&t!=1)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\tprintf(\"ru/\");\n\t\t\tt=2;\n\t\t\tq=2;\n\t\t\ti++;\n\t\t}\n\n\telse\n\t\tprintf(\"%c\",arr[i]);\n\tt++;\n\t}\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nint main(){\nint i,don=3,pun=0,j=0;\nchar direccion[51];\nscanf(\"%s\",direccion);\ni=0;\nif(direccion[0] == 'h'){\n don = 4;\n}\nwhile(direccion[i]!=0){\n if((direccion[i] <= 'a' || direccion[i] >= 'z')){ //Verifica que sean letras y minusculas\n return 0;\n }\n i++;\n}\ni=0;\nwhile(direccion[i]!=0){\n if(pun==0 && direccion[i] == 'r' && direccion[i+1] == 'u'){\n printf(\".\");\n pun++;\n }\n if(don == 0){\n printf(\"://\");\n }\n printf(\"%c\",direccion[i]);\n if(pun == 1 && direccion[i]=='u'){\n pun++;\n printf(\"/\");\n }\n don=don-1;\n i++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar cadena[50];\nint main(){\n int i,c,h;\n scanf(\"%s\",cadena);\n if(cadena[0]=='h'){\n c=4;\n }else{\n c=3;\n }\n int k=0;\n for(i=0;cadena[i]!='\\0';i++){\n if(cadena[i]=='r' &&cadena[i+1]=='u' && k==0){\n printf(\".\");\n h=i+2;\n k=1;\n }\n if(i==c){\n printf(\"://\");\n }\n if(i==h){\n printf(\"/\");\n }\n printf(\"%c\",cadena[i]);\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<string.h>\nint main()\n{\n char s[70],*p;\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n if(s[0] =='h')\n {\n for(i =0;i<4;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n printf(\"\\n\");\n }\n }\n else\n {\n for(i =0;i<3;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint x,y,z=0,i,j,a=1,b=1;\n\tchar arr[100];\n\tscanf(\"%s\",arr);\n\tfor(i=0 ; i<strlen(arr) ; i++)\n\t{\n\t\tif(arr[i]=='p' && a==1)\n\t\t{\n\t\t\ta=0;\n\t\t\tx=i;\n\t\t\tfor(j=0 ; j<=i ; j++)\n\t\t\t\tprintf(\"%c\",arr[j]);\n\t\t\tprintf(\"://\");\n\t\t}\n\t\tif(a==0 && b==1 && arr[i]=='r' && arr[i+1]=='u' && arr[i-1]!='p')\n\t\t{\n\t\t\tfor(j=x+1 ; j<i ; j++)\n\t\t\t\tprintf(\"%c\",arr[j]);\n\t\t\tprintf(\".ru/\");\n\t\t\tb=0;\n\t\t\tfor(y=i+2 ; y<strlen(arr) ; y++)\n\t\t\t\tprintf(\"%c\",arr[y]);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n int i;\n char c[50];\n gets(c);\n if(c[0]=='h')\n {\n printf(\"http://\");\n if(c[4]=='h'&&c[5]=='t'&&c[6]=='t'&&c[7]=='p'&&c[8]=='r'&&c[9]=='u'){printf(\"httpru\");i=10;}\n else if(c[4]=='f'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"ftpru\");i=9;}\n else i=4;\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n else if((c[0]=='f'))\n {\n printf(\"ftp://\");\n if(c[3]=='h'&&c[4]=='t'&&c[5]=='t'&&c[6]=='p'&&c[7]=='r'&&c[8]=='u'){printf(\"httpru\");i=9;}\n else if(c[3]=='f'&&c[4]=='t'&&c[5]=='p'&&c[6]=='r'&&c[7]=='u'){printf(\"ftpru\");i=8;}\n else i=3;\n for(;i<strlen(c);i++)\n {\n if(c[i]=='r'&&c[i+1]=='u')break;\n else printf(\"%c\",c[i]);\n }\n printf(\".ru\");\n if(i==strlen(c)-2);\n else\n {\n printf(\"/\");\n for(i=i+2;i<strlen(c);i++)printf(\"%c\",c[i]);\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n// ftp = 7 http = 5\n\nint controlar(char *c1, char *c2,int op)\n{\n int i=0;\n\n if(c1[0]=='r' && c2[0]=='u' && op!=1)\n {\n i=1;\n }else\n {\n i=0;\n\n }\n return i;\n}\nint main()\n{\n char dir_err[51];\n int n,r,op;\n n=r=op=0;\n scanf(\"%s\",dir_err);\n\n\n if (dir_err[n]=='h')\n {\n\n printf(\"http://\");\n n=4;\n if (dir_err[n]=='r' && dir_err[n+1]=='u'){op++;}\n }else if (dir_err[n]=='f')\n {\n\n if (dir_err[3]=='h')\n {\n printf(\"ftp://http\");\n n=7;\n }else\n {\n printf(\"ftp://\");\n n=3;\n }\n }\n while(0==controlar(&dir_err[n],&dir_err[n+1],op) ){\n\n printf(\"%c\",dir_err[n]);\n n++;\n op++;\n\n }\n\n printf(\".ru\");\n n=n+2;\n if(dir_err[n]!='\\0')\n {\n printf(\"/\");\n do{\n printf(\"%c\",dir_err[n]);\n n++;\n }while(dir_err[n]!='\\0');\n\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i;\n char DirWeb[50];\n char aux[53]=\"\";\n char s[55]=\"\";\n gets(DirWeb);\n int p,c,flag=0;\n if(DirWeb[0]=='h')\n {\n strcpy(aux,\"http://\");\n Cpy(aux,DirWeb,4,3);\n p=7;\n }else if(DirWeb[0]=='f')\n {\n strcpy(aux,\"ftp://\");\n Cpy(aux,DirWeb,3,3);\n p=6;\n }\n\n for(i=p;aux[i]!='\\0';i++)\n {\n if(aux[i]=='r' && aux[i+1]=='u' && flag==0)\n {\n strncat(s,aux,i);\n strcat(s,\".ru/\");\n c=i+2;\n Cpy(s,aux,c,2);\n flag=1;\n }\n }\n puts(s);\n\n return 0;\n}\n\nvoid Cpy(char *str1,char *str2,int a,int b)\n{\n int i;\n for(i=a;(str1[i+b]=str2[i])!='\\0';i++)\n {\n str1[i+b]=str2[i];\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[70];\n int pos,i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n pos = 'h'==s[0] ? 4 : 3;\n for(i =0;i<pos;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n for(;i<strlen(s);i++)\n {\n if(s[i] =='r'&&s[i+1] =='u')\n {\n break;\n }\n }\n for(;pos<i;pos++)\n {\n printf(\"%c\",s[pos]);\n }\n printf(\".ru\");\n pos +=2;\n if(s[pos])\n {\n printf(\"/\");\n for(;pos<strlen(s);pos++)\n {\n printf(\"%c\",s[pos]);\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,j,k,x=0,flag=0;\nchar pp[51];\ngets(pp);\nif(pp[0]=='f')\n { printf(\"ftp://\");\n x=3;}\nelse\n {printf(\"http://\");\n x=4;}\nfor(i=x;i<strlen(pp);i++)\n { printf(\"%c\",pp[i]); \n if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0)\n {printf(\".ru/\");\n i+=2;\n flag=1;}\n }\n \n return 0;\n}\n\n\t \t \t\t\t\t \t \t\t \t \t"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint h,w,i,j;\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tw=strlen(str);\n\th=0;\n\tif (str[0]=='h'){\n\t\tprintf(\"http://\");\n\t\th=h+4;\n\t\tfor (i=h;str[i]!='r' || str[i+1]!='u';i++){\n\t\t\tprintf(\"%c\",str[i]);\n\t\t\th=h+1;\n\t\t}\n\t\tprintf(\".ru\");\n\t\th=h+2;\n\t\tif(h<w){\n\t\t\tprintf(\"/\");\n\t\t\tfor (j=h;j<w;j++){\n\t\t\t\tprintf(\"%c\",str[j]);\n\t\t\t}\n\t\t}\n\t}\n\telse if (str[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\th=h+3;\n\t\tfor (i=h;str[i]!='r' || str[i+1]!='u';i++){\n\t\t\tprintf(\"%c\",str[i]);\n\t\t\th=h+1;\n\t\t}\n\t\tprintf(\".ru\");\n\t\th=h+2;\n\t\tif(h<w){\n\t\t\tprintf(\"/\");\n\t\t\tfor (j=h;j<w;j++){\n\t\t\t\tprintf(\"%c\",str[j]);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<string.h>\nint main()\n{\n char s[1000],*p;\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n if(s[0] =='h')\n {\n for(i =0;i<4;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n printf(\"\\n\");\n }\n }\n else\n {\n for(i =0;i<3;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char a[51],subcadena[]=\"ru\";\n int i,l,j,j1,posicion;\n scanf(\"%s\",a);\n l=strlen(a);\n char b[l+5];\n posicion = strstr(a,subcadena)-a;\n if (a[0]=='h')\n {\n j=4;\n j1=6;\n i=7;\n b[0]='h';\n b[1]='t';\n b[2]='t';\n b[3]='p';\n b[4]=':';\n b[5]='/';\n b[6]='/';\n }else if(a[0]=='f')\n {\n j=3;\n j1=5;\n i=6;\n b[0]='f';\n b[1]='t';\n b[2]='p';\n b[3]=':';\n b[4]='/';\n b[5]='/';\n }\n if(posicion==3 || posicion==4)\n {\n while(a[j1]!='r' && a[j1+1]!='u')\n {\n j1++;\n }\n posicion=j1-1;\n }\n while (j!=posicion)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='.';\n b[i+1]='r';\n b[i+2]='u';\n b[i+3]='/';\n i+=4;\n j+=2;\n while (j<l)\n {\n b[i]=a[j];\n j++;\n i++;\n }\n b[i]='\\0';\n printf(\"%s\",b);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\tif(a[i+3] == 'r' && a[i+4] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+4],a[i+5]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\tif(a[i+4] == 'r' && a[i+5] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i+4],a[i+5]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+3;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tif(i+2 == len)\n\t\t\t{\n\t\t\t\tprintf(\".%c%c\",a[i],a[i+1]);\n\t\t\t\ti = i+1;\n\t\t\t\tcount2++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\t\ti = i+1;\n\t\t\t\tcount2++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n\tchar s[111]={0};\n\tscanf(\"%s\",s);\n\tint i=0,c=0;\n\n\tif(s[0]=='h'){printf(\"http://\");\n\t\tfor(i=4;i<strlen(s);i++){\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0)\n\t\t\t\t{printf(\".ru/\");c++;i++;}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\tif(s[0]=='f'){printf(\"ftp://\");\n\t\tfor(i=3;i<strlen(s);i++){\n\t\t\tif(s[i]=='r'&&s[i+1]=='u'&&c==0){\n\t\t\t\tprintf(\".ru/\");c++;i++;}\n\t\t\telse{printf(\"%c\",s[i]);}}}\n\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i;\n char DirWeb[50];\n char aux[53]=\"\";\n char s[55]=\"\";\n gets(DirWeb);\n int p,c,flag=0;\n if(DirWeb[0]=='h')\n {\n strcpy(aux,\"http://\");\n Cpy(aux,DirWeb,4,3);\n p=7;\n }else if(DirWeb[0]=='f')\n {\n strcpy(aux,\"ftp://\");\n Cpy(aux,DirWeb,3,3);\n p=6;\n }\n\n for(i=p;aux[i]!='\\0';i++)\n {\n if(aux[i]=='r' && aux[i+1]=='u' && flag==0)\n {\n strncat(s,aux,i);\n strcat(s,\".ru/\");\n c=i+2;\n Cpy(s,aux,c,2);\n flag=1;\n }\n }\n puts(s);\n\n return 0;\n}\n\nvoid Cpy(char *str1,char *str2,int a,int b)\n{\n int i;\n for(i=a;(str1[i+b]=str2[i])!='\\0';i++)\n {\n str1[i+b]=str2[i];\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<string.h>\nint main()\n{\n char s[70],*p;\n int i;\n memset(s,'\\0',sizeof(s));\n scanf(\"%s\",s);\n if(s[0] =='h')\n {\n for(i =0;i<4;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n printf(\"\\n\");\n }\n }\n else\n {\n for(i =0;i<3;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\"://\");\n p =strstr(s,\"ru\");\n for(;i+s<p;i++)\n {\n printf(\"%c\",s[i]);\n }\n printf(\".ru\");\n p =p+2;\n if(*p)\n {\n printf(\"/\");\n for(;p<s+strlen(s);p++)\n {\n printf(\"%c\",*p);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#define MAXM 0x7fffffff\n#define Max(a,b)((a)>(b)?(a):(b))\n#define Min(a,b) ((a)>(b)?(b):(a))\n#define INF 0x7ffffff\n#define hash_mod 1111111\n#define eps 1e-6\n#define reset(a) memset(a,0,sizeof(a))\n#define ret(a) memset(a,-1,sizeof(a))\n#define lson l,m,rt<<1\n#define rson m+1,r,rt<<1|1\n#define demid int m=(l+r)>>1\n#define ebug\nint main()\n{\n char str[55];\n char* http = \"http\",*ftp = \"ftp\";\n while(~scanf(\"%s\",str))\n {\n int i,l,f = 0;\n l = strlen(str);\n if(strncmp(str,http,4)==0)\n {\n printf(\"%s\",http);\n printf(\"://\");\n for(i = 4;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u'&& f)\n {\n printf(\".ru\");i+=2;\n break;\n }\n else f = 1,printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n else\n {\n printf(\"%s\",ftp);\n printf(\"://\");\n for(i = 3;i < l ; i++)\n {\n if(str[i]=='r'&&str[i+1]=='u')\n {\n printf(\".ru\");i+=2;\n break;\n }\n else printf(\"%c\",str[i]);\n\n }\n if(i<l)\n printf(\"/%s\",str+i);printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p')\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\ti = i+3;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\ti = i+1;\n\t\t\tcount2++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(void){\n char str[64];\n int i,j,k,l,flg=0;\n fgets(str,sizeof(str),stdin);\n l=strlen(str);\n for(i=0;i<l;i++){\n if(str[i]=='t' && str[i+1]=='p' && flg==0){\n printf(\"tp://\");\n i++;\n flg=1;\n }else if(str[i]=='r' && str[i+1]=='u' && flg==1){\n printf(\".ru\");\n if(str[i+2]!='\\n') putchar('/');\n i++;\n flg=2;\n }else putchar(str[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nint main(){\nint i,don=3,pun=0,j=0;\nchar direccion[51];\nchar dir[56]={};\nscanf(\"%s\",direccion);\ni=0;\nwhile(direccion[i]!='\\0'){\n if((direccion[i] <= 'a' || direccion[i] >= 'z')){ //Verifica que sean letras y minusculas\n return 0;\n }\n i++;\n}\ni=0;\nif(direccion[0] == 'h'){\n don = 4;\n}\nwhile(direccion[i]!='\\0'){\n if(pun==0 && direccion[i] == 'r' && direccion[i+1] == 'u'){\n dir[j]='.';\n pun++;\n j++;\n }\n if(don == 0){\n dir[j]=':';\n j++;\n dir[j]='/';\n j++;\n dir[j]='/';\n j++;\n }\n dir[j] =direccion[i];\n j++;\n if(pun == 1 && direccion[i]=='u'&& direccion[i+1]!='\\0'){\n pun++;\n dir[j]='/';\n j++;\n }\n don=don-1;\n i++;\n }\n printf(\"%s\",dir);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(){\n\nint i, b, d;\nchar c[50];\ngets(c);\ni=0;\nd=0;\n\nwhile (c[i] != '\\0'){\n if(isupper(c[i])){\n d = 1;\n }\n i++;\n}\n\nif (d == 0 && strlen(c) != 0){\nif (c[0] == 'h'){\n printf(\"http://\");\n i = 4;\n}\nelse{\n printf(\"ftp://\");\n i = 3;\n}\nb = 0;\nwhile (c[i] != '\\0'){\n printf(\"%c\", c[i]);\n if (c[i+1] == 'r' && c[i+2] == 'u' && b == 0){\n b = 1;\n printf(\".ru/\");\n i = i + 2;\n }\n i++;\n }\n //putchar('\\0');\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\n char dir[50];\n int c,ban=1;\n\n scanf(\"%s\",dir);\n char *p=dir;\n if(dir[0]=='f')\n {\n printf(\"ftp://\");\n p+=3;\n }\n else\n {\n printf(\"http://\");\n p+=4;\n }\n\n while (*p!='\\0')\n {\n if(*p=='r' && ban==1)\n {\n printf(\".ru/\");\n ban=0;\n p+=2;\n }\n printf(\"%c\",*p);\n\n p++;\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[55];\n int i,k,len,f;\n while(gets(s))\n {\n len=strlen(s);\n if(s[0]=='h')\n {\n for(i=0;i<4;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=4;\n }\n else\n if(s[0]=='f')\n {\n for(i=0;i<3;i++)\n printf(\"%c\",s[i]);\n printf(\"://\");\n k=3;\n }\n for(i=k,f=0;i<len;i++)\n {\n if(i!=k&&i!=k+1&&s[i]=='r'&&s[i+1]=='u'&&f==0)\n {\n printf(\".ru\");f=1;i=i+2;\n if(i<len)\n printf(\"/\");\n else\n break;\n }\n printf(\"%c\",s[i]);\n }\n printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint isru(char *a)\n{\n if(*a=='r'&&*(a+1)=='u')\n return 1;\n else \n return 0;\n}\nint main()\n{\n int i,j,k,l,m,n,t,o,p,q;\n int a[1000],b[1000];\n char s[100];\n scanf(\"%s\",s);\n if(s[0]=='f')\n {\n printf(\"ftp://\");\n i=3;\n }\n else\n {\n printf(\"htttp://\");\n i=4;\n }\n for(;s[i];i++)\n {\n if(!isru(&s[i]))\n printf(\"%c\",s[i]);\n else\n {\n printf(\".ru\");\n i+=2;\n break;\n }\n }\n if(s[i])\n {\n printf(\"/\");\n while(s[i])\n {\n printf(\"%c\",s[i]);\n i++;\n }\n }\n printf(\"\\n\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main (){\n\n int i,j,k;\n char add [50], h[]={\"http\"}, f[]={\"ftp\"};\n\n printf(\"Input:\\n\");\n gets(add);\n printf(\"%s\\n\",h);\n\n i = strncmp(add,h,4);\n\n if (i==0){\n printf(\"%s://\",h);\n k=strlen(add);\n for (k=k; k!=3; --k){\n if (add[k]=='r' && add[k+1]=='u')\n break;\n }\n for (j=4 ; j!=k+2 ; j++){\n if (j==k){\n printf(\".\");\n }\n printf(\"%c\",add[j]);\n }\n if (add[k+2]!='\\0'){\n for (j==k+2 ; add[j]!='\\0';j++)\n printf(\"/%c\",add[j]);\n }\n }\n else {\n printf(\"%s://\",f);\n k=strlen(add);\n for (k=k; k!=2; --k){\n if (add[k]=='r' && add[k+1]=='u')\n break;\n }\n for (j=3 ; j!=k+2 ; j++){\n if (j==k){\n printf(\".\");\n }\n printf(\"%c\",add[j]);\n }\n if (add[k+2]!='\\0'){\n for (j==k+2 ; add[j]!='\\0';j++)\n printf(\"/%c\",add[j]);\n }\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\nmain()\n{\n int i,len;\n char origin[50];\n char *aux =NULL;\n scanf(\"%s\", origin);\n aux=strstr(origin, \"http\");\n if(aux!=NULL)\n {\n printf(\"http://\");\n }\n if(aux==NULL)\n {\n printf(\"ftp://\");\n }\n aux=strstr(origin,\"p\");\n i=1;\n while(strncmp(aux+i, \"ru\", 2)!=0)\n {\n printf(\"%c\", *(aux+i));\n i++;\n }\n printf(\".ru\");\n aux=strstr(origin, \"ru\");\n len=strlen(aux+2);\n if(len>0)\n {\n printf(\"/\");\n for(i=2;i<len+2;i++)\n {\n printf(\"%c\", *(aux+i));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(int argc, char **argv)\n{\n\tchar input[60], output[60];\n\tscanf(\"%s\",&input);\n\tint i = 0, j = 0, counter;\n\twhile(input[i] != 'p')\n\t{\n\t\toutput[i] = input[i];\n\t\ti++;\n\t\tj++;\n\t}\n\toutput[i] = input[i];\n\ti++;\n\tj++;\n\toutput[i] = ':';\n\toutput[i+1] = '/';\n\toutput[i+2] = '/';\n\ti = i + 3;\n\tlabel:\n\twhile(input[j] != 'r')\n\t{\n\t\toutput[i] = input[j];\n\t\tj++;\n\t\ti++;\n\t}\n\tif(input[j+1] != 'u')\n\t{\n\t\toutput[i] = input[j];\n\t\ti++;\n\t\tj++;\n\t\tgoto label;\n\t}\n\toutput[i] = '.';\n\toutput[i+1] = 'r';\n\toutput[i+2] = 'u';\n\ti = i + 3;\n\tj = j + 2;\n\tif(input[j] != '\\0')\n\t{\n\t\toutput[i] = '/';\n\t\ti++;\n\t}\n\twhile(input[j] != '\\0')\n\t{\n\t\toutput[i] = input[j];\n\t\ti++;\n\t\tj++;\n\t}\n\tprintf(\"%s\",output);\n\treturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid strcatchar(char *principio,char texto);\nvoid link(char texto[51]);\n\nint main ()\n{\n char texto[51];\n scanf(\"%s\",texto);\n link(texto);\n return 0;\n}\n\nvoid link(char texto[51])\n{\n char principio[56]=\"\";\n int i,largo;\n largo=strlen(texto);\n if(texto[0]=='h')\n {\n strncpy(principio,texto,4);\n i=4;\n }\n else if(texto[0]=='f')\n {\n strncpy(principio,texto,3);\n i=3;\n }\n strcat(principio,\"://\");\n int pos;\n pos=strstr(texto,\"ru\")-texto;\n for(i;i<pos;i++)\n {\n strcatchar(principio,texto[i]);\n }\n strcat(principio,\".ru\");\n i=i+2;\n if(i<largo)\n strcatchar(principio,'/');\n for(i;i<largo;i++)\n {\n strcatchar(principio,texto[i]);\n }\n principio[55]='\\0';\n printf(\"%s\",principio);\n}\n\nvoid strcatchar(char *principio,char texto)\n{\n int largo=strlen(principio);\n principio[largo]=texto;\n principio[largo+1]='\\0';\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint x,y,z=0,i,j,a=1,b=1;\n\tchar arr[100];\n\tscanf(\"%s\",arr);\n\tfor(i=0 ; i<strlen(arr) ; i++)\n\t{\n\t\tif(arr[i]=='p' && a==1)\n\t\t{\n\t\t\ta=0;\n\t\t\tx=i;\n\t\t\tfor(j=0 ; j<=i ; j++)\n\t\t\t\tprintf(\"%c\",arr[j]);\n\t\t\tprintf(\"://\");\n\t\t}\n\t\tif(a==0 && b==1 && arr[i]=='r' && arr[i+1]=='u' && arr[i-1]!='p' && (arr[i-2]!='t'))\n\t\t{\n\t\t\tfor(j=x+1 ; j<i ; j++)\n\t\t\t\tprintf(\"%c\",arr[j]);\n\t\t\tprintf(\".ru/\");\n\t\t\tb=0;\n\t\t\tfor(y=i+2 ; y<strlen(arr) ; y++)\n\t\t\t\tprintf(\"%c\",arr[y]);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdio.h>\nint main()\n{\nint i,a,c,d,t=0,j,q=1;\nchar x,arr[99];\nscanf(\"%s\",arr);\nfor(i=0;i<(strlen(arr));i++)\n\t{\n\t\t\n\tif(arr[i-1]=='p'&&t==0)\n\t{printf(\"://\");\n\t\n\tt=1;\n\t}\t\t\n\t\t\n\tif(arr[i]=='r'&&arr[i+1]=='u'&&q==1)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\tprintf(\"ru/\");\n\t\t\tt=2;\n\t\t\tq=2;\n\t\t\ti++;\n\t\t}\n\n\telse\n\t\tprintf(\"%c\",arr[i]);\n\t\n\t}\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[51];\n\tscanf(\"%s\",a);\n\n\tint len = strlen(a);\n\tint count1 = 0 , count2 = 0;\n\tfor (int i = 0; i < len; ++i)\n\t{\n\t\tif(a[i] == 'f' && a[i+1] == 't' && a[i+2] == 'p')\n\t\t{\n\t\t\tprintf(\"%c%c%c://\",a[i],a[i+1],a[i+2]);\n\t\t\ti = i+2;\n\t\t\tcount1++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'h' && a[i+1] == 't' && a[i+2] == 't' && a[i+3] == 'p' && count1 == 0)\n\t\t{\n\t\t\tprintf(\"%c%c%c%c://\",a[i],a[i+1],a[i+2],a[i+3]);\n\t\t\tif(a[i+4] == 'r' && a[i+5] == 'u')\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",a[i],a[i+1]);\n\t\t\t\ti= i+2; \n\t\t\t}\n\t\t\ti = i+3;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(a[i] == 'r' && a[i+1] == 'u' && count2 == 0)\n\t\t{\n\t\t\tprintf(\".%c%c/\",a[i],a[i+1]);\n\t\t\ti = i+1;\n\t\t\tcount2++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tchar d[100];\n\tint i,u,c=0,k=0;\n\tscanf(\"%s\",d);\n\tu=strlen(d);\n\tif(u<9){\n\tif(d[0]=='h'){\n\t\tprintf(\"http://\");\n\t\tc+=4;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>6*/)){\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t}\n\t\t\telse \n\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tk=1;\n\t\t\t\t\tbreak;}\n\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\tbreak;}}\n\t\tif(k){\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t}\n\tif(d[0]=='f'){\n\t\tprintf(\"ftp://\");\n\t\tc+=3;\n\t\tfor(i=c;i<u;i++){\n\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'/*&&i>5*/)){\n\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\telse {printf(\".ru/\");\n\t\t\t\tc=i+2;\n\t\t\t\tbreak;}}\n\t\tfor(i=c;i<u;i++)\n\t\t\tprintf(\"%c\",d[i]);\n\t}}\n\telse{\n\t\tif(d[0]=='h'){\n\t\t\tprintf(\"http://\");\n\t\t\tc+=4;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>6)){\n\t\t\t\t\tprintf(\"%c\",d[i]);\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t\tif(d[i+2]>=65){\n\t\t\t\t\t\tprintf(\".ru/\");\n\t\t\t\t\t\tc=i+2;\n\t\t\t\t\t\tk=1;\n\t\t\t\t\t\tbreak;}\n\t\t\t\t\telse {printf(\".ru\");\n\t\t\t\t\t\tbreak;}}\n\t\t\tif(k){\n\t\t\t\tfor(i=c;i<u;i++)\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t}\n\t\tif(d[0]=='f'){\n\t\t\tprintf(\"ftp://\");\n\t\t\tc+=3;\n\t\t\tfor(i=c;i<u;i++){\n\t\t\t\tif(!(d[i]=='r'&&d[i+1]=='u'&&i>5)){\n\t\t\t\t\tprintf(\"%c\",d[i]);}\n\t\t\t\telse {printf(\".ru/\");\n\t\t\t\t\tc=i+2;\n\t\t\t\t\tbreak;}}\n\t\t\tfor(i=c;i<u;i++)\n\t\t\t\tprintf(\"%c\",d[i]);\n\t\t}}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,j,k,x=0,flag=0,flog=0;\nchar pp[100];\ngets(pp);\nif(pp[0]=='f')\n { printf(\"ftp://\");\n x=3;}\nelse\n {printf(\"http://\");\n x=4;}\nfor(i=x;i<strlen(pp);i++)\n { printf(\"%c\",pp[i]); \n if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3==strlen(pp)&&x!=i)\n {printf(\".ru\");\n i+=2;\n flag=2;}\n else if(pp[i+1]=='r'&&pp[i+2]=='u'&&flag==0&&i+3!=strlen(pp)&&x!=i)\n {printf(\".ru/\");\n i+=2;\n flag=1;}\n }\n \n return 0;\n}\n\n\t\t\t\t \t\t\t \t \t \t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int lon,i,j,ban;\n char s[51]={\"\\0\"};\n fflush(stdin);\n scanf(\"%[^\\n]\",s);\n lon=strlen(s);\n ban=0;\n if(s[0]=='f'){\n printf(\"ftp://\");\n for(i=4;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=4){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n break;\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n\n }\n }\n printf (\"%c\", s[i-1]);\n }else if(s[0]=='h'){\n printf(\"http://\");\n for(i=5;i<lon;i++){\n if(s[i-1]=='r' && s[i]=='u' && ban!=1 && i!=5){\n ban=1;\n if(i==lon-1){\n printf(\".ru\");\n }else{\n printf(\".ru/\");\n i++;\n }\n }else{\n printf(\"%c\",s[i-1]);\n }\n }\n printf (\"%c\", s[i-1]);\n }\n}\n"}], "src_uid": "4c999b7854a8a08960b6501a90b3bba3"} {"nl": {"description": "Numbers k-bonacci (k is integer, k\u2009>\u20091) are a generalization of Fibonacci numbers and are determined as follows: F(k,\u2009n)\u2009=\u20090, for integer n, 1\u2009\u2264\u2009n\u2009<\u2009k; F(k,\u2009k)\u2009=\u20091; F(k,\u2009n)\u2009=\u2009F(k,\u2009n\u2009-\u20091)\u2009+\u2009F(k,\u2009n\u2009-\u20092)\u2009+\u2009...\u2009+\u2009F(k,\u2009n\u2009-\u2009k), for integer n, n\u2009>\u2009k. Note that we determine the k-bonacci numbers, F(k,\u2009n), only for integer values of n and k.You've got a number s, represent it as a sum of several (at least two) distinct k-bonacci numbers. ", "input_spec": "The first line contains two integers s and k (1\u2009\u2264\u2009s,\u2009k\u2009\u2264\u2009109;\u00a0k\u2009>\u20091).", "output_spec": "In the first line print an integer m (m\u2009\u2265\u20092) that shows how many numbers are in the found representation. In the second line print m distinct integers a1,\u2009a2,\u2009...,\u2009am. Each printed integer should be a k-bonacci number. The sum of printed integers must equal s. It is guaranteed that the answer exists. If there are several possible answers, print any of them.", "sample_inputs": ["5 2", "21 5"], "sample_outputs": ["3\n0 2 3", "3\n4 1 16"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\nlong long int a[1000000],b[100000];\nint main()\n{\n long long int s,k;\n scanf(\"%I64d %I64d\",&s,&k);\n long long int i,j,l,o,p,m;\n \n if(s==1)\n {\n printf(\"2\\n0 1\");\n }\n else \n {\n for(i=1; ; i++)\n {\n \n if(i==1)\n a[i]=1;\n else if(i<=(k+1) && i>1) \n {l=0;\n for(j=i-1;j>=1;j--)\n l+=a[j];\n a[i]=l;\n }\n else \n {\n l=0;\n for(j=i-1;j>=(i-k);j--)\n l+=a[j];\n a[i]=l;\n }\n if(a[i]>s)\n break;\n }\n \n o=i-1;\n if(a[o]==s)\n printf(\"2\\n0 %I64d\",s);\n\n else if(a[o]!=s)\n {\n m=1;\n for(p=o;p>=1;p--)\n {\n if(a[p]<=s)\n {\n b[m]=a[p];\n s-=a[p];\n m++;\n }\n if(s==0)\n break;\n }\n printf(\"%I64d\\n\",m-1);\n for(i=1;i<m;i++)\n {\n printf(\"%I64d \",b[i]);\n \n }\n \n }\n }\n\n}"}, {"source_code": "#include <stdio.h>\n\nint k, s;\nint nkb, kb[1024];\nint nres, res[1024];\n\nint main()\n{\n int i, j;\n scanf(\"%d%d\", &s, &k);\n kb[0] = 1;\n for ( i = 1; ; ++i )\n {\n long long sum = 0;\n for ( j = 0; ++j <= k && j <= i; )\n sum += kb[i - j];\n if ( s < sum )\n break;\n kb[i] = sum;\n }\n nkb = i;\n for ( nres = 0, i = nkb, j = s; --i >= 0 && j > 0; )\n {\n if ( j >= kb[i] )\n {\n j -= kb[i];\n res[nres++] = kb[i];\n }\n }\n if ( nres == 1 )\n res[nres++] = 0;\n printf(\"%d\\n\", nres);\n while ( --nres > 0 )\n printf(\"%d \", res[nres]);\n printf(\"%d\\n\", res[nres]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int s, k, i, f[100001], ans[100001], a=0;\n scanf(\"%d %d\", &s, &k);\n f[0]=0;\n f[1]=1;\n f[2]=1;\n for(i=3; f[i-1]<=s && i<=k; i++)\n f[i]=2*f[i-1];\n for(; f[i-1]<=s; i++)\n f[i]=2*f[i-1]-f[i-k-1];\n f[i]=0;\n while(i>=0)\n {\n if(s-f[i]>=0)\n {\n ans[a++]=f[i];\n s-=f[i];\n }\n i--;\n }\n printf(\"%d\\n\", a-1);\n for(i=0; i<a-1; i++)\n printf(\"%d \", ans[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[100000], ans[100000];\nint main()\n{\n\tint k, n;\n scanf(\"%d%d\",&n,&k);\n\ta[0]=0;\n\ta[1]=1;\n\tint sum=0;\n\tint i=1,j;\n\twhile(sum<n)\n\t{\n\t\tif((i+1-k)>=0)\n\t\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t\ta[++i]=sum;\n\t}\n\t\n\tint x=0;\n\tfor(j=i;j>=0;j--)\n\t{\n\t\tif((n-a[j])>=0)\n\t\t{\n\t\t\tn-=a[j];\n\t\t\tans[x]=a[j];\n x++;\n }\n if(n==0)\n break;\n }\n if(x == 1)\n ans[x++] = 0;\n printf(\"%d\\n\",x);\n for(j=0;j<x;j++)\n printf(\"%d \",ans[j]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "/*\nID: mohamma73\nLANG: C\nTASK: crypt1\n*/\n\n#include\"stdio.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"math.h\"\n#include\"string.h\"\nstruct cor{\n\tint real;\n\tint indx;\n};\nstruct home{\n\tint tasks[100];\n\tint nt;\n};\nstruct card{\n\tint val;\n\tchar suit;\n\tint id;\n};\nstruct task{\n\tint done;\n\tint id;\n\tint home;\n\tint pre[200];\n\tint np;\n};\nstruct bstnode{\n\tint id;\n\tint visit;\n\tstruct bstnode *left;\n\tstruct bstnode *right;\n};\nstruct point{\n\tint x;\n\tint y;\n\tint visit;\n};\nstruct node{\n\tint id;\n\tint n;\n\tint nei[202];\n\tint wei[200];\n};\nstruct person{\n\tint id;\n\tint nd;\n\tint nl;\n\tint like[2004];\n\tint dis[2004];\n\tint visit;\n};\nstruct farmer{\n\tint p;\n\tint c;\n};\nvoid inc(int *a,int n){\n\tint i;\n\tif(a[0]!=2){\n\t\ta[0]++;\n\t\treturn;\n\t}\n\tfor(i=0;i<n && a[i]==2;i++)\n\t\ta[i]=0;\n\tif(i<n)\n\t\ta[i]++;\n}\nint cmp(char *s,char *t){\n\tint n=strlen(s);\n\tint m=strlen(t);\n\tint i,j;\n\tfor(i=0,j=0;i<n && j<m && s[i]==t[j];i++,j++);\n\tif(s[i]>t[j])\n\t\treturn 1;\n\telse if(s[i]<t[j])\n\t\treturn -1;\n\telse \n\t\treturn 0;\n\t\n}\nint getword(char *s,int n){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getchar()));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getchar())\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nint fgetword(char *s,int n,FILE *fp){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getc(fp)));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getc(fp))\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nlong long atll(char *s){\n\tlong long n=0;\n\tint i;\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tn*=10;\n\t\tn+=(s[i]-'0');\n\t}\n\treturn n;\n}\nint Bsear(char *s,char words[][13],int n){\n\tint l=0;\n\tint h=n;\n\tint mid;\n\twhile(l<h){\n\t\tmid=(l+h)/2;\n\t\tif(cmp(words[mid],s)==0)\n\t\t\treturn 1;\n\t\telse if(cmp(words[mid],s)==1){\n\t\t\th=mid;\n\t\t}else\n\t\t\tl=mid+1;\n\t}\n\treturn -1;\n}\nvoid func(int *n,int base,int num){\n\tint i=0;\n\twhile(num/base!=0){\n\t\tn[i++]=num%base;\n\t\tnum/=base;\n\t}\n\tn[i++]=num;\n\tn[i++]=20;\n}\nint pal(int *n){\n\tint i,j;\n\tfor(i=0;n[i]!=20;i++);\n\tfor(j=0;j<i/2 && n[j]==n[i-j-1];j++);\n\tif(j==i/2)\n\t\treturn 1;\n\treturn 0;\n}\nint ispal(char *s, int i, int j){\n\tint k;\n\tfor(k=0;k<((j-i+1)/2) && s[i+k]==s[j-k];k++);\n\tif(k==(j-i+1)/2)\n\t\treturn 1;\n\treturn 0;\n}\nvoid insort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++){\n\t\tj=i;\n\t\twhile(j>0 && a[j]<a[j-1]){\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tj--;\n\t\t}\n\t}\n}\nchar lower(char c){\n\treturn c<'a'?c+('a'-'A'):c;\n}\nvoid sort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=temp;\n\t\t\t\n\t\t}\n}\nvoid fun(int n,char *s){\n\tint i=0;\n\tfor(i=0;n/10!=0;i++,n/=10)\n\t\ts[i]=n%10+'0';\n\ts[i++]=n+'0';\n\ts[i]='\\0';\n}\nvoid sortIn(int *a,int *indx,int n){\n\tint t1;\n\tint i,j;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\tt1=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=t1;\n\t\t\tt1=indx[j-1];\n\t\t\tindx[j-1]=indx[j];\n\t\t\tindx[j]=t1;\n\t\t}\n}\nint valid(int *a,int l,int r,int n){\n\tint f=0;\n\tif(l>0 && a[l-1]>a[r])\n\t\tf=1;\n\tif(a[l+1]<a[r])\n\t\tf=1;\n\tif(a[r-1]>a[l])\n\t\tf=1;\n\tif(r<n-1 && a[r+1]<a[l])\n\t\tf=1;\n\tif(f) \n\t\treturn 0;\n\treturn 1;\n}\nvoid change(char *stripe,int *colors,int idx,int k){\n\tint j=0;\n\tif(idx==1){\n\t\tif(stripe[0]-'A'>0)\n\t\t\tstripe[0]=colors[stripe[0]-'A'-1];\n\t\telse\n\t\t\tstripe[0]=colors[stripe[0]-'A'+1];\n\t\treturn ;\n\t}\n\tfor(j=0;j<idx;j+=2){\n\t\tif(stripe[j]-'A'>0){\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j+1]!=colors[stripe[j]-'A'-1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j]-'A'<k-1)\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-2];\n\t\t}else{\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+2];\n\t\t}\n\t}\n}\nint invite(struct point *nom[],int n,struct point *pts[],int m,struct point *invite[]){\n\tint i,j,idx=0;\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(nom[i]->x==pts[j]->x || nom[i]->y==pts[j]->y){\n\t\t\t\tif(pts[j]->visit==0){\n\t\t\t\t\tinvite[idx++]=pts[j];\n\t\t\t\t\tpts[j]->visit=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n\treturn idx;\n}\nint feasible(struct person *a[],int n){\n\tint i,j,k;\n\tint flag=1;\n\tfor(i=0;flag && i<n;i++)\n\t\tfor(j=0;flag && j<a[i]->nd;j++)\n\t\t\tfor(k=0;flag &&k<n;k++){\n\t\t\t\tif(a[k]->id==a[i]->dis[j]){\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\tif(i==n)\n\t\treturn 1;\n\treturn 0;\n}\nint find(struct node *p,struct node *node[]){\n\tint i,j,k;\n\tint count=0;\n\tfor(i=0;i<p->n;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;j<node[p->nei[i]]->n;j++){\n\t\t\tif(node[p->nei[i]]->nei[j]==-1)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<p->n;k++){\n\t\t\t\tif(p->nei[k]==-1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(node[p->nei[i]]->nei[j]==p->nei[k])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\treturn count;\n}\nvoid rem(struct node *p,struct node *nodes[],int n){\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tif(nodes[i]==NULL)\n\t\t\tcontinue;\n\t\tfor(j=0;j<nodes[i]->n;j++)\n\t\t\tif(nodes[i]->nei[j]==p->id)\n\t\t\t\tnodes[i]->nei[j]=-1;\n\t}\n}\nlong long GCD(long long a,long long b){\n\tif(a%b==0)\n\t\treturn b;\n\telse \n\t\treturn GCD(b,a%b);\n}\nint f(long long a, long long arr[], int n){\n\tif(a<=10000000){\n\t\tarr[n++]=a;\n\t\treturn n;\n\t}\n\tint i;\n\tint k;\n\tfor(i=sqrt(a)+1;i>1;i--)\n\t\tif(a%i==0){\n\t\t\tk=f(a/i,arr,n);\n\t\t\treturn f(i,arr,k);\n\t\t}\n}\nvoid merge(int *a,int l,int q,int n){\n\tint n1=q-l+1;\n\tint i,j,k;\n\tint n2=n-q;\n\tint L[n1+1];\n\tint R[n2+1];\n\tfor(i=0;i<n1;i++)\n\t\tL[i]=a[l+i];\n\tfor(i=0;i<n2;i++)\n\t\tR[i]=a[q+i+1];\n\tL[n1]=100002;\n\tR[n2]=100002;\n\ti=0;\n\tj=0;\n\tfor(k=l;k<=n;k++)\n\t\tif(L[i]<=R[j]){\n\t\t\ta[k]=L[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\ta[k]=R[j];\n\t\t\tj++;\n\t\t}\n}\nvoid mergesort(int *a,int l,int n){\n\tif(n>l){\n\t\tint q=(l+n)/2;\n\t\tmergesort(a,l,q);\n\t\tmergesort(a,q+1,n);\n\t\tmerge(a,l,q,n);\n\t}\n}\nvoid prime(long long n,long long *a){\n\tint i=2;\n\tint flag=0;\n\twhile(i<(sqrt(n)+1)){\n\t\tif(n%i==0){\n\t\t\ta[i]++;\n\t\t\tn/=i;\n\t\t\ti=2;\n\t\t\tflag=1;\n\t\t}else\n\t\t\ti++;\n\t}\n\tif(n>1)\n\t\ta[n]++;\n}\nstruct task **dup1(struct task *t[],int n){\n\tstruct task **dup=(struct task **)malloc(sizeof(struct bstnode *)*n);\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tdup[i]=(struct task *)malloc(sizeof(struct task));\n\t\tdup[i]->home=t[i]->home;\n\t\tdup[i]->done=t[i]->done;\n\t\tdup[i]->id=t[i]->id;\n\t\tdup[i]->np=t[i]->np;\n\t\tfor(j=0;j<t[i]->np;j++)\n\t\t\tdup[i]->pre[j]=t[i]->pre[j];\n\t}\n\treturn dup;\n}\nstruct home homes[3];\nvoid make(struct task *t[],struct bstnode *root,int i,int n){\n\tint idx,idx2;\n\tint j;\n\troot->visit=0;\n\tstruct task **dup=dup1(t,n); \n\troot->id=dup[i]->home;\n\tfor(idx=0;idx<homes[dup[i]->home-1].nt;idx++) //doing all the tasks that has no prereq\n\t\tif(dup[homes[dup[i]->home-1].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home-1].tasks[idx]-1]->done==0){\n\t\t\tdup[homes[dup[i]->home-1].tasks[idx]-1]->done=1;\n\t\t\tfor(idx2=0;idx2<n;idx2++)\n\t\t\t\t\tfor(j=0;dup[idx2]->pre[j]!=0;j++)\n\t\t\t\t\t\tif(dup[idx2]->pre[j]==dup[homes[dup[i]->home-1].tasks[idx]-1]->id){\n\t\t\t\t\t\t\tdup[idx2]->pre[j]=-1;\n\t\t\t\t\t\t\tdup[idx2]->np--;\n\t\t\t\t\t\t}\n\t\t}\n\tfor(idx=0;idx<homes[dup[i]->home%3].nt;idx++) //checking nei\n\t\tif(dup[homes[dup[i]->home%3].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home%3].tasks[idx]-1]->done==0){\n\t\t\troot->left=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->left->left=NULL;\n\t\t\troot->left->right=NULL;\n\t\t\tmake(dup,root->left,dup[homes[dup[i]->home%3].tasks[idx]-1]->id-1,n);\n\t\t}\n\tint home;\n\tif(dup[i]->home==1)\n\t\thome=2;\n\telse\n\t\thome=dup[i]->home-2;\n\tfor(idx=0;idx<homes[home].nt;idx++)\t\t//checking nei\n\t\tif(dup[homes[home].tasks[idx]-1]->np==0 && dup[homes[home].tasks[idx]-1]->done==0){\n\t\t\troot->right=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->right->right=NULL;\n\t\t\troot->right->left=NULL;\n\t\t\tmake(dup,root->right,dup[homes[home].tasks[idx]-1]->id-1,n);\n\t\t}\n\t\n}\nvoid chg(struct bstnode a){\n\tif(a.id==3)\n\t\tprintf(\"%d\",a.id);\n\telse{\n\t\ta.id=3;\n\t\tchg(a);\n\t}\n}\nint cal(struct bstnode *root,int cost){\n\tif(root==NULL)\n\t\treturn cost;\n\tint left=0,right=0;\n\tif(root->left!=NULL)\n\t\tleft=cal(root->left,cost+1);\n\tif(root->right!=NULL)\n\t\tright=cal(root->right,cost+2);\n\tif(left==0 && right==0)\n\t\treturn cost;\n\tif(left==0 && right!=0)\n\t\treturn right;\n\tif(right==0 && left!=0)\n\t\treturn left;\n\treturn (left>right)?right:left;\n}\nvoid print(struct bstnode *root, int i){\n\tif(root==NULL)\n\t\treturn;\n\t/*if(root->visit)\n\t\treturn ;\n\troot->visit=1;*/\n\tprint(root->left,1);\n\tif(i==1)\n\t\tprintf(\"left:\");\n\telse if(i==0)\n\t\tprintf(\"root:\");\n\telse if(i==2)\n\t\tprintf(\"right:\");\n\tprintf(\"%d \",root->id);\n\tprint(root->right,2);\n}\n/*long long a[10000000];\nlong long b[10000000];\nlong long p[10000000];\nlong long primes[700000];*/\nvoid prin(int *a,int num,int n){\n\tint i;\n\tif(num==0 || num==1 || num==2){\n\t\tprintf(\"%d \",num);\n\t\treturn ;\n\t}\n\tfor(i=n-1;i>=0 && a[i]>num;i--);\n\tprintf(\"%d \",a[i]);\n\tprin(a,n-a[i],n);\n}\nlong long a[10000];\nlong long l[10000];\nmain(){\n\tchar s[20];\n\tint i=0,j,idx=0;\n\tgetword(s,20);\n\tlong long num=atll(s);\n\tgetword(s,20);\n\tlong long k=atll(s);\n\tif(num==1){\n\t\tprintf(\"2\\n1 0\");\n\t\treturn 0;\n\t}\n\tif(num==2){\n\t\tprintf(\"2\\n2 0\");\n\t\treturn 0;\n\t}\n\tlong long sum=1;\n\ta[i++]=0;\n\ta[i++]=1;\n\tfor(;sum<=num;i++){\n\t\ta[i]=sum;\n\t\tif(i-k>=0)\n\t\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t}\n\tj=i-1;\n\twhile(num>2){\n\t\tl[idx++]=a[j];\n\t\tnum-=a[j];\n\t\tfor(j=i-1;j>=0 && a[j]>num;j--);\n\t}\n\tl[idx++]=num;\n\tprintf(\"%d\\n\",idx);\n\tfor(j=0;j<idx;j++)\n\t\tprintf(\"%I64d \",l[j]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f[1000];\nint c[1000];\nint a[1000];\n\nint search(int s, int n)\n{\n int l = 0, r = n - 1, mid, ret = -1;\n while (l <= r)\n {\n mid = (l + r) >> 1;\n if (f[mid] < s)\n {\n ret = mid;\n l = mid + 1;\n }\n else if (f[mid] == s)\n {\n ret = mid;\n break;\n }\n else\n {\n r = mid - 1;\n }\n }\n return ret;\n}\n\nvoid func(int s, int k)\n{\n int i, n, m, p;\n f[0] = c[0] = 0;\n f[1] = c[1] = 1;\n for (i = 2; i <= k && f[i - 1] <= s; i ++)\n {\n f[i] = c[i - 1];\n c[i] = c[i - 1] << 1;\n }\n if (i == k + 1)\n {\n while (f[i - 1] <= s)\n {\n f[i] = c[i - 1];\n c[i] = c[i - 1] << 1;\n c[i] -= f[i - k];\n i ++;\n }\n }\n n = i;\n m = 0;\n while (s != 0)\n {\n p = search(s, n);\n a[m ++] = f[p];\n s -= f[p];\n n = p;\n }\n if (m == 1)\n {\n a[m ++] = 0;\n }\n printf(\"%d\\n\", m);\n for (i = 0; i < m - 1; i ++)\n {\n printf(\"%d \", a[i]);\n }\n printf(\"%d\\n\", a[i]);\n}\n\nint main()\n{\n int s, k;\n while (scanf(\"%d%d\", &s, &k) == 2)\n {\n func(s, k);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void){\n int fib[45]={0},stock[45]={0};\n int s,k,i,n,sum=0,num=0;\n scanf(\"%d %d\",&s,&k);\n for(i=0;i==0||fib[i-1]<=s;i++){\n if(i<=1) fib[i]=1;\n else if(i<=k) fib[i]=sum;\n else{\n sum-=fib[i-k-1];\n fib[i]=sum;\n }\n //printf(\"%d %d\\n\",i,fib[i]);\n sum+=fib[i];\n //printf(\"sum:%d\\n\",sum);\n }\n //printf(\"i:%d\\n\",i);\n n=i-2;\n //printf(\"n:%d %d\\n\",n,fib[n]);\n for(i=n;i>=0;i--){\n if(fib[i]<=s){\n stock[num++]=fib[i];\n s-=fib[i];\n if(s==0) break;\n }\n }\n if(num==1) fib[num++]=0;\n printf(\"%d\\n\",num);\n for(i=num-1;i>=0;i--){\n printf(\"%d\",stock[i]);\n putchar((i>0)?' ':'\\n');\n }\n return 0;\n}\n"}, {"source_code": " #include <stdio.h>\n \n long kf[1000];\n long ch[1000];\n\n \n int main(){\n long s, k;\n int m=1;\n long tmp;\n int i, j;\n int n;\n int alone=0;\n scanf (\"%ld%ld\", &s, &k);\n kf[1]=1;\n i=1;\n while (kf[i]<=s){\n i++;\n tmp=i-k;\n if (tmp<0) tmp=0;\n for (j=i-1; j>=tmp; j--)\n kf[i]+=kf[j];\n }\n while (s>0){\n while (kf[i]>s) i--;\n s=s-kf[i];\n ch[m]=kf[i];\n m++;\n i--;\n }\n// printf (\"i - %d, alone - %d, s - %ld, m - %d\\n\", i, alone, s, m);\n if (m==2) alone++;\n if (alone){\n printf (\"%d\\n\", m);\n for (i=1; i<=m; i++)\n printf (\"%ld \", ch[i]);\n }\n else{ \n printf (\"%d\\n\", m-1);\n for (i=1; i<m; i++)\n printf (\"%ld \", ch[i]);\n }\n printf (\"\\n\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[100];\nint Counter;\nint Ans[100];\nint k;\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n F[0] = 0;\n F[1] = 1;\n F[2] = 1;\n \n k=K;\n if (k>30) k = 30;\n \n for (i=3; F[i-1]<(1<<(k-1)); i++) F[i] = 1<<(i-2);\n \n for ( ; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-k-1];\n i--;\n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n if (Counter==1){\n Counter = 2;\n Ans[1] = 0;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define N 50\ntypedef long long ll;\nll f[N];\nint main(void)\n{\n int s,k;\n int i,j,ct=0;\n ll ans[N];\n scanf(\"%d%d\",&s,&k);\n f[0]=f[1]=1;\n f[2]=2;\n for(i=3;i<N;i++)\n {\n if(i>=k+1)\n f[i]=2*f[i-1]-f[i-k-1];\n else for(j=i-1;j>=max(i-k,0);j--)\n f[i]+=f[j];\n }\n for(i=N-1;i>0;i--)\n {\n if((s>=f[i]))\n {\n s-=f[i];\n ans[ct++]=f[i];\n }\n if(s==0)\n {\n if(ct==1){\n printf(\"%d\\n\",ct+1);\n printf(\"0 \");\n }\n else printf(\"%d\\n\",ct);\n for(i=0;i<ct;i++)\n printf(\"%I64d%c\",ans[i],i==ct-1?'\\n':' ');\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{int i,j,a[100005]={0},*s,k,n,m,t=100005;\ns=(int*)calloc(t,sizeof(int));\nscanf(\"%d%d\",&n,&k);\na[0]=0;a[1]=1;a[2]=1;\nfor(i=3;i<k+1&&a[i-1]<=n;i++)\na[i]=2*a[i-1];\nfor(;a[i-1]<=n;i++)\n{a[i]=2*a[i-1]-a[i-k-1];\n}\na[i-1]=0;j=i-2;\nint l=0;\nwhile(j>=0)\n{if(n-a[j--]>=0)\n{\n n-=a[j+1];\n s[l++]=a[j+1];\n}\n\n}\nprintf(\"%d\\n\",l);\nfor(i=0;i<l;i++)\nprintf(\"%d \",s[i]);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int s,k,i,j;\n long int a[50];\n long int b[50];\n long int sum=0;\n\n scanf(\"%ld %ld\",&s,&k);\n a[0]=0;\n a[1]=1;\n i=2;\n sum=1;\n while(sum<s)\n {\n sum=0;\n for(j=(i-1);j>=(i-k);j--)\n {\n sum+=a[j];\n if(j==0)\n break;\n }\n a[i]=sum;\n i++;\n }\n\n j=0;\n\n while(s != 0)\n {\n if(s>=a[i-1])\n {\n s-=a[i-1];\n b[j]=a[i-1];\n j++;\n }\n\n i--;\n\n // printf(\"%ld\\n\",s);\n }\n // printf(\"%ld\\n\",j);\n if(j==1)\n {\n printf(\"2\\n0 %ld\",b[0]);\n }\n else\n {\n printf(\"%ld\\n\",j);\n for(i=0;i<j;i++)\n {\n printf(\"%ld \",b[i]);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define N 50\ntypedef long long ll;\nll f[N];\nint main(void)\n{\n int s,k;\n int i,j,ct=0;\n ll ans[N];\n scanf(\"%d%d\",&s,&k);\n f[0]=f[1]=1;\n f[2]=2;\n for(i=3;i<N;i++)\n {\n if(i>=k+1)\n f[i]=2*f[i-1]-f[i-k-1];\n else for(j=i-1;j>=max(i-k,0);j--)\n f[i]+=f[j];\n }\n for(i=N-1;i>0;i--)\n {\n if((s>=f[i]))\n {\n s-=f[i];\n ans[ct++]=f[i];\n }\n if(s==0)\n {\n if(ct==1){\n printf(\"%d\\n\",ct+1);\n printf(\"0 \");\n }\n else printf(\"%d\\n\",ct);\n for(i=0;i<ct;i++)\n printf(\"%I64d%c\",ans[i],i==ct-1?'\\n':' ');\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "//In the name of God\n#include <stdio.h>\n\n#define int long long\n\nint s,k,sone;\n\nint f[10000];\nint ans[10000];\n\nvoid make()\n{\n sone=s;\n int sum=0;\n int i;\n int last=0;\n for(i=k;;i++)\n {\n if(i==k)\n\t{f[i-k+10]=sum=1; continue;}\n f[i-k+10]=sum;\n // printf(\"f[%lld]=%lld\\n\",i,f[i]);\n if(f[i-k+10]>s) break;\n sum+=f[i-k+10];\n if(i-k-k+10>=0)\n\tsum-=f[i-k-k+10];\n }\n int index=0;\n for(;i>=0;i--)\n {\n if(f[i-k+10]<=s)\n\ts-=f[i-k+10],ans[index++]=f[i-k+10];\n if(f[i-k+10]==0) break;\n }\n printf(\"%lld\\n\",index);\n for(i=0;i<index;++i)\n printf(\"%lld \",ans[i]);\n}\n\n\nmain()\n{\n scanf(\"%lld%lld\",&s,&k);\n make();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint s,k,t,x;\nint memo[9999],ans,c[9999],p;\n\nint make_k_bonacci(int k){\n int i,j;\n memo[k] = 1;\n for(i=k+1;;i++){\n for(j=1;j<=k;j++){\n memo[i] += memo[i-j];\n if(memo[i]<0) return i;\n }\n }\n}\n\nmain(){\n scanf(\"%d%d\",&s,&k);\n t=k;\n if(k>=32|| s<(1<<k)){\n x = __builtin_popcount(s);\n if(x==1){\n printf(\"2\\n0 %d\\n\",s);\n return 0;\n }\n printf(\"%d\\n\",x);\n while(s){\n t=s&-s;\n printf(\"%d \",t);\n s^=t;\n }\n puts(\"\");\n return 0;\n }\n int z = make_k_bonacci(k);\n t=s;\n while(z--&&s){\n if(s>=memo[z]&&memo[z]!=t){\n ans++;\n c[p++]=memo[z];\n s-=memo[z];\n }\n }\n printf(\"%d\\n\",ans);\n while(p--)printf(\"%d \",c[p]);\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int a[50];\nint main()\n{\n int i,j,s,k,n;\n scanf(\"%d%d\",&s,&k);\n long long int sum=0;\n //make atmost 50 entries in array a\n a[0]=1;\n for(i=1;i<50;i++)\n {\n sum=0;\n for(j=i-1;j>=i-k;j--)\n {\n if(j<0)break;\n sum+=a[j];\n }\n if(sum>2000000000)break;\n else\n a[i]=sum;\n }\n n=i;\n long long int sol[50];\n int z=0;\n while(s>0)\n {\n i=0;\n while(a[i]<=s)\n i++;\n s=s-a[i-1];\n sol[z++]=a[i-1];\n }\n if(z==1)\n {\n printf(\"2\\n\");\n printf(\"0 %lld\\n\",sol[0]);\n }\n else\n {\n printf(\"%d\\n\",z);\n for(i=0;i<z-1;i++)\n printf(\"%lld \",sol[i]);\n printf(\"%lld\\n\",sol[i]);\n }\n\n return(0);\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint k, s;\nint nkb, kb[1024];\nint nres, res[1024];\n\nint main()\n{\n\tint i, j;\n\tscanf(\"%d%d\", &s, &k);\n\tif ( s == 1 )\n\t{\n\t\tputs(\"0 1\");\n\t\treturn 0;\n\t}\n\tkb[0] = 1;\n\tfor ( i = 1; ; ++i )\n\t{\n\t\tlong long sum = 0;\n\t\tfor ( j = 0; ++j <= k && j <= i; )\n\t\t\tsum += kb[i - j];\n\t\tif ( sum >= s )\n\t\t\tbreak;\n\t\tkb[i] = sum;\n\t}\n\tnkb = i;\n\tfor ( nres = 0, i = nkb, j = s; --i >= 0 && j > 0; )\n\t{\n\t\tif ( j >= kb[i] )\n\t\t{\n\t\t\tj -= kb[i];\n\t\t\tres[nres++] = kb[i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", nres);\n\twhile ( --nres > 0 )\n\t\tprintf(\"%d \", res[nres]);\n\tprintf(\"%d\\n\", res[nres]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint k, s;\nint nkb, kb[1024];\nint nres, res[1024];\n\nint main()\n{\n int i, j;\n scanf(\"%d%d\", &s, &k);\n if ( s == 1 )\n {\n puts(\"0 1\");\n return 0;\n }\n kb[0] = 1;\n for ( i = 1; ; ++i )\n {\n long long sum = 0;\n for ( j = 0; ++j <= k && j <= i; )\n sum += kb[i - j];\n if ( s < sum )\n break;\n kb[i] = sum;\n }\n nkb = i;\n for ( nres = 0, i = nkb, j = s; --i >= 0 && j > 0; )\n {\n if ( j >= kb[i] )\n {\n j -= kb[i];\n res[nres++] = kb[i];\n }\n }\n if ( nres == 1 )\n res[nres++] = 0;\n printf(\"%d\\n\", nres);\n while ( --nres > 0 )\n printf(\"%d \", res[nres]);\n printf(\"%d\\n\", res[nres]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int s, k, i, f[100001], ans[100001], a=0;\n scanf(\"%d %d\", &s, &k);\n f[0]=0;\n f[1]=1;\n f[2]=1;\n for(i=3; f[i-1]<=s && i<=k; i++)\n f[i]=2*f[i-1];\n for(; f[i-1]<=s; i++)\n f[i]=2*f[i-1]-f[i-k-1];\n i-=1;\n while(i>=0)\n {\n if(s-f[i]>=0)\n {\n ans[a++]=f[i];\n s-=f[i];\n }\n i--;\n }\n printf(\"%d\\n\", a-1);\n for(i=0; i<a-1; i++)\n printf(\"%d \", ans[i]);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\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 fill(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 lld;\ntypedef long double Lf;\n\nint main()\n{\n int cases;\n int i,j,n;\n int a[MAX];\n scanf(\"%d\",&n);\n int ans=0;\n //printf(\"n is %d\\n\",n&(n-1));\n if((n&(n-1))==0){\n printf(\"%d\\n%d %d\\n\",2,0,n);\n return 0;\n }\n int fact=1;\n while(2*fact<=n) fact*=2;\n while(fact>=1){\n if(n>=fact)\n a[ans++]=fact;\n n%=fact;\n fact/=2;\n }\n printf(\"%d\\n\",ans);\n for(i=0;i<ans;++i)\n printf(\"%d \",a[i]);\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\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 fill(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 lld;\ntypedef long double Lf;\n\nint main()\n{\n int cases;\n int i,j,n;\n int a[MAX];\n scanf(\"%d\",&n);\n int ans=0;\n int fact=1;\n// if(n&(n-1)==0){\n printf(\"%d\\n%d %d\\n\",2,0,n);\n return 0;\n // }\n\n while(n){\n if(n>fact){\n a[ans]=fact;\n ans++;\n n-=fact;\n }\n fact*=2;\n }\n printf(\"%d\\n\",ans);\n for(i=0;i<n;++i)\n printf(\"%d \",a[i]);\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "/*\nID: mohamma73\nLANG: C\nTASK: crypt1\n*/\n\n#include\"stdio.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"math.h\"\n#include\"string.h\"\nstruct cor{\n\tint real;\n\tint indx;\n};\nstruct home{\n\tint tasks[100];\n\tint nt;\n};\nstruct card{\n\tint val;\n\tchar suit;\n\tint id;\n};\nstruct task{\n\tint done;\n\tint id;\n\tint home;\n\tint pre[200];\n\tint np;\n};\nstruct bstnode{\n\tint id;\n\tint visit;\n\tstruct bstnode *left;\n\tstruct bstnode *right;\n};\nstruct point{\n\tint x;\n\tint y;\n\tint visit;\n};\nstruct node{\n\tint id;\n\tint n;\n\tint nei[202];\n\tint wei[200];\n};\nstruct person{\n\tint id;\n\tint nd;\n\tint nl;\n\tint like[2004];\n\tint dis[2004];\n\tint visit;\n};\nstruct farmer{\n\tint p;\n\tint c;\n};\nvoid inc(int *a,int n){\n\tint i;\n\tif(a[0]!=2){\n\t\ta[0]++;\n\t\treturn;\n\t}\n\tfor(i=0;i<n && a[i]==2;i++)\n\t\ta[i]=0;\n\tif(i<n)\n\t\ta[i]++;\n}\nint cmp(char *s,char *t){\n\tint n=strlen(s);\n\tint m=strlen(t);\n\tint i,j;\n\tfor(i=0,j=0;i<n && j<m && s[i]==t[j];i++,j++);\n\tif(s[i]>t[j])\n\t\treturn 1;\n\telse if(s[i]<t[j])\n\t\treturn -1;\n\telse \n\t\treturn 0;\n\t\n}\nint getword(char *s,int n){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getchar()));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getchar())\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nint fgetword(char *s,int n,FILE *fp){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getc(fp)));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getc(fp))\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nlong long atll(char *s){\n\tlong long n=0;\n\tint i;\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tn*=10;\n\t\tn+=(s[i]-'0');\n\t}\n\treturn n;\n}\nint Bsear(char *s,char words[][13],int n){\n\tint l=0;\n\tint h=n;\n\tint mid;\n\twhile(l<h){\n\t\tmid=(l+h)/2;\n\t\tif(cmp(words[mid],s)==0)\n\t\t\treturn 1;\n\t\telse if(cmp(words[mid],s)==1){\n\t\t\th=mid;\n\t\t}else\n\t\t\tl=mid+1;\n\t}\n\treturn -1;\n}\nvoid func(int *n,int base,int num){\n\tint i=0;\n\twhile(num/base!=0){\n\t\tn[i++]=num%base;\n\t\tnum/=base;\n\t}\n\tn[i++]=num;\n\tn[i++]=20;\n}\nint pal(int *n){\n\tint i,j;\n\tfor(i=0;n[i]!=20;i++);\n\tfor(j=0;j<i/2 && n[j]==n[i-j-1];j++);\n\tif(j==i/2)\n\t\treturn 1;\n\treturn 0;\n}\nint ispal(char *s, int i, int j){\n\tint k;\n\tfor(k=0;k<((j-i+1)/2) && s[i+k]==s[j-k];k++);\n\tif(k==(j-i+1)/2)\n\t\treturn 1;\n\treturn 0;\n}\nvoid insort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++){\n\t\tj=i;\n\t\twhile(j>0 && a[j]<a[j-1]){\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tj--;\n\t\t}\n\t}\n}\nchar lower(char c){\n\treturn c<'a'?c+('a'-'A'):c;\n}\nvoid sort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=temp;\n\t\t\t\n\t\t}\n}\nvoid fun(int n,char *s){\n\tint i=0;\n\tfor(i=0;n/10!=0;i++,n/=10)\n\t\ts[i]=n%10+'0';\n\ts[i++]=n+'0';\n\ts[i]='\\0';\n}\nvoid sortIn(int *a,int *indx,int n){\n\tint t1;\n\tint i,j;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\tt1=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=t1;\n\t\t\tt1=indx[j-1];\n\t\t\tindx[j-1]=indx[j];\n\t\t\tindx[j]=t1;\n\t\t}\n}\nint valid(int *a,int l,int r,int n){\n\tint f=0;\n\tif(l>0 && a[l-1]>a[r])\n\t\tf=1;\n\tif(a[l+1]<a[r])\n\t\tf=1;\n\tif(a[r-1]>a[l])\n\t\tf=1;\n\tif(r<n-1 && a[r+1]<a[l])\n\t\tf=1;\n\tif(f) \n\t\treturn 0;\n\treturn 1;\n}\nvoid change(char *stripe,int *colors,int idx,int k){\n\tint j=0;\n\tif(idx==1){\n\t\tif(stripe[0]-'A'>0)\n\t\t\tstripe[0]=colors[stripe[0]-'A'-1];\n\t\telse\n\t\t\tstripe[0]=colors[stripe[0]-'A'+1];\n\t\treturn ;\n\t}\n\tfor(j=0;j<idx;j+=2){\n\t\tif(stripe[j]-'A'>0){\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j+1]!=colors[stripe[j]-'A'-1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j]-'A'<k-1)\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-2];\n\t\t}else{\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+2];\n\t\t}\n\t}\n}\nint invite(struct point *nom[],int n,struct point *pts[],int m,struct point *invite[]){\n\tint i,j,idx=0;\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(nom[i]->x==pts[j]->x || nom[i]->y==pts[j]->y){\n\t\t\t\tif(pts[j]->visit==0){\n\t\t\t\t\tinvite[idx++]=pts[j];\n\t\t\t\t\tpts[j]->visit=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n\treturn idx;\n}\nint feasible(struct person *a[],int n){\n\tint i,j,k;\n\tint flag=1;\n\tfor(i=0;flag && i<n;i++)\n\t\tfor(j=0;flag && j<a[i]->nd;j++)\n\t\t\tfor(k=0;flag &&k<n;k++){\n\t\t\t\tif(a[k]->id==a[i]->dis[j]){\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\tif(i==n)\n\t\treturn 1;\n\treturn 0;\n}\nint find(struct node *p,struct node *node[]){\n\tint i,j,k;\n\tint count=0;\n\tfor(i=0;i<p->n;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;j<node[p->nei[i]]->n;j++){\n\t\t\tif(node[p->nei[i]]->nei[j]==-1)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<p->n;k++){\n\t\t\t\tif(p->nei[k]==-1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(node[p->nei[i]]->nei[j]==p->nei[k])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\treturn count;\n}\nvoid rem(struct node *p,struct node *nodes[],int n){\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tif(nodes[i]==NULL)\n\t\t\tcontinue;\n\t\tfor(j=0;j<nodes[i]->n;j++)\n\t\t\tif(nodes[i]->nei[j]==p->id)\n\t\t\t\tnodes[i]->nei[j]=-1;\n\t}\n}\nlong long GCD(long long a,long long b){\n\tif(a%b==0)\n\t\treturn b;\n\telse \n\t\treturn GCD(b,a%b);\n}\nint f(long long a, long long arr[], int n){\n\tif(a<=10000000){\n\t\tarr[n++]=a;\n\t\treturn n;\n\t}\n\tint i;\n\tint k;\n\tfor(i=sqrt(a)+1;i>1;i--)\n\t\tif(a%i==0){\n\t\t\tk=f(a/i,arr,n);\n\t\t\treturn f(i,arr,k);\n\t\t}\n}\nvoid merge(int *a,int l,int q,int n){\n\tint n1=q-l+1;\n\tint i,j,k;\n\tint n2=n-q;\n\tint L[n1+1];\n\tint R[n2+1];\n\tfor(i=0;i<n1;i++)\n\t\tL[i]=a[l+i];\n\tfor(i=0;i<n2;i++)\n\t\tR[i]=a[q+i+1];\n\tL[n1]=100002;\n\tR[n2]=100002;\n\ti=0;\n\tj=0;\n\tfor(k=l;k<=n;k++)\n\t\tif(L[i]<=R[j]){\n\t\t\ta[k]=L[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\ta[k]=R[j];\n\t\t\tj++;\n\t\t}\n}\nvoid mergesort(int *a,int l,int n){\n\tif(n>l){\n\t\tint q=(l+n)/2;\n\t\tmergesort(a,l,q);\n\t\tmergesort(a,q+1,n);\n\t\tmerge(a,l,q,n);\n\t}\n}\nvoid prime(long long n,long long *a){\n\tint i=2;\n\tint flag=0;\n\twhile(i<(sqrt(n)+1)){\n\t\tif(n%i==0){\n\t\t\ta[i]++;\n\t\t\tn/=i;\n\t\t\ti=2;\n\t\t\tflag=1;\n\t\t}else\n\t\t\ti++;\n\t}\n\tif(n>1)\n\t\ta[n]++;\n}\nstruct task **dup1(struct task *t[],int n){\n\tstruct task **dup=(struct task **)malloc(sizeof(struct bstnode *)*n);\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tdup[i]=(struct task *)malloc(sizeof(struct task));\n\t\tdup[i]->home=t[i]->home;\n\t\tdup[i]->done=t[i]->done;\n\t\tdup[i]->id=t[i]->id;\n\t\tdup[i]->np=t[i]->np;\n\t\tfor(j=0;j<t[i]->np;j++)\n\t\t\tdup[i]->pre[j]=t[i]->pre[j];\n\t}\n\treturn dup;\n}\nstruct home homes[3];\nvoid make(struct task *t[],struct bstnode *root,int i,int n){\n\tint idx,idx2;\n\tint j;\n\troot->visit=0;\n\tstruct task **dup=dup1(t,n); \n\troot->id=dup[i]->home;\n\tfor(idx=0;idx<homes[dup[i]->home-1].nt;idx++) //doing all the tasks that has no prereq\n\t\tif(dup[homes[dup[i]->home-1].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home-1].tasks[idx]-1]->done==0){\n\t\t\tdup[homes[dup[i]->home-1].tasks[idx]-1]->done=1;\n\t\t\tfor(idx2=0;idx2<n;idx2++)\n\t\t\t\t\tfor(j=0;dup[idx2]->pre[j]!=0;j++)\n\t\t\t\t\t\tif(dup[idx2]->pre[j]==dup[homes[dup[i]->home-1].tasks[idx]-1]->id){\n\t\t\t\t\t\t\tdup[idx2]->pre[j]=-1;\n\t\t\t\t\t\t\tdup[idx2]->np--;\n\t\t\t\t\t\t}\n\t\t}\n\tfor(idx=0;idx<homes[dup[i]->home%3].nt;idx++) //checking nei\n\t\tif(dup[homes[dup[i]->home%3].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home%3].tasks[idx]-1]->done==0){\n\t\t\troot->left=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->left->left=NULL;\n\t\t\troot->left->right=NULL;\n\t\t\tmake(dup,root->left,dup[homes[dup[i]->home%3].tasks[idx]-1]->id-1,n);\n\t\t}\n\tint home;\n\tif(dup[i]->home==1)\n\t\thome=2;\n\telse\n\t\thome=dup[i]->home-2;\n\tfor(idx=0;idx<homes[home].nt;idx++)\t\t//checking nei\n\t\tif(dup[homes[home].tasks[idx]-1]->np==0 && dup[homes[home].tasks[idx]-1]->done==0){\n\t\t\troot->right=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->right->right=NULL;\n\t\t\troot->right->left=NULL;\n\t\t\tmake(dup,root->right,dup[homes[home].tasks[idx]-1]->id-1,n);\n\t\t}\n\t\n}\nvoid chg(struct bstnode a){\n\tif(a.id==3)\n\t\tprintf(\"%d\",a.id);\n\telse{\n\t\ta.id=3;\n\t\tchg(a);\n\t}\n}\nint cal(struct bstnode *root,int cost){\n\tif(root==NULL)\n\t\treturn cost;\n\tint left=0,right=0;\n\tif(root->left!=NULL)\n\t\tleft=cal(root->left,cost+1);\n\tif(root->right!=NULL)\n\t\tright=cal(root->right,cost+2);\n\tif(left==0 && right==0)\n\t\treturn cost;\n\tif(left==0 && right!=0)\n\t\treturn right;\n\tif(right==0 && left!=0)\n\t\treturn left;\n\treturn (left>right)?right:left;\n}\nvoid print(struct bstnode *root, int i){\n\tif(root==NULL)\n\t\treturn;\n\t/*if(root->visit)\n\t\treturn ;\n\troot->visit=1;*/\n\tprint(root->left,1);\n\tif(i==1)\n\t\tprintf(\"left:\");\n\telse if(i==0)\n\t\tprintf(\"root:\");\n\telse if(i==2)\n\t\tprintf(\"right:\");\n\tprintf(\"%d \",root->id);\n\tprint(root->right,2);\n}\n/*long long a[10000000];\nlong long b[10000000];\nlong long p[10000000];\nlong long primes[700000];*/\nvoid prin(int *a,int num,int n){\n\tint i;\n\tif(num==0 || num==1 || num==2){\n\t\tprintf(\"%d \",num);\n\t\treturn ;\n\t}\n\tfor(i=n-1;i>=0 && a[i]>num;i--);\n\tprintf(\"%d \",a[i]);\n\tprin(a,n-a[i],n);\n}\nlong long a[10000];\nlong long l[10000];\nmain(){\n\tchar s[20];\n\tint i=0,j,idx=0;\n\tgetword(s,20);\n\tlong long num=atll(s);\n\tgetword(s,20);\n\tlong long k=atll(s);\n\tif(num==1){\n\t\tprintf(\"2\\n1 0\");\n\t\treturn 0;\n\t}\n\tif(num==2){\n\t\tprintf(\"2\\n2 0\");\n\t\treturn 0;\n\t}\n\tlong long sum=1;\n\ta[i++]=0;\n\ta[i++]=1;\n\tfor(;sum<num;i++){\n\t\ta[i]=sum;\n\t\tif(i-k>=0)\n\t\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t}\n\tj=i-1;\n\twhile(num>2){\n\t\tl[idx++]=a[j];\n\t\tnum-=a[j];\n\t\tfor(j=i-1;j>=0 && a[j]>num;j--);\n\t}\n\tl[idx++]=num;\n\tprintf(\"%d\\n\",idx);\n\tfor(j=0;j<idx;j++)\n\t\tprintf(\"%I64d \",l[j]);\n\treturn 0;\n}"}, {"source_code": "/*\nID: mohamma73\nLANG: C\nTASK: crypt1\n*/\n\n#include\"stdio.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"math.h\"\n#include\"string.h\"\nstruct cor{\n\tint real;\n\tint indx;\n};\nstruct home{\n\tint tasks[100];\n\tint nt;\n};\nstruct card{\n\tint val;\n\tchar suit;\n\tint id;\n};\nstruct task{\n\tint done;\n\tint id;\n\tint home;\n\tint pre[200];\n\tint np;\n};\nstruct bstnode{\n\tint id;\n\tint visit;\n\tstruct bstnode *left;\n\tstruct bstnode *right;\n};\nstruct point{\n\tint x;\n\tint y;\n\tint visit;\n};\nstruct node{\n\tint id;\n\tint n;\n\tint nei[202];\n\tint wei[200];\n};\nstruct person{\n\tint id;\n\tint nd;\n\tint nl;\n\tint like[2004];\n\tint dis[2004];\n\tint visit;\n};\nstruct farmer{\n\tint p;\n\tint c;\n};\nvoid inc(int *a,int n){\n\tint i;\n\tif(a[0]!=2){\n\t\ta[0]++;\n\t\treturn;\n\t}\n\tfor(i=0;i<n && a[i]==2;i++)\n\t\ta[i]=0;\n\tif(i<n)\n\t\ta[i]++;\n}\nint cmp(char *s,char *t){\n\tint n=strlen(s);\n\tint m=strlen(t);\n\tint i,j;\n\tfor(i=0,j=0;i<n && j<m && s[i]==t[j];i++,j++);\n\tif(s[i]>t[j])\n\t\treturn 1;\n\telse if(s[i]<t[j])\n\t\treturn -1;\n\telse \n\t\treturn 0;\n\t\n}\nint getword(char *s,int n){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getchar()));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getchar())\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nint fgetword(char *s,int n,FILE *fp){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getc(fp)));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getc(fp))\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nlong long atll(char *s){\n\tlong long n=0;\n\tint i;\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tn*=10;\n\t\tn+=(s[i]-'0');\n\t}\n\treturn n;\n}\nint Bsear(char *s,char words[][13],int n){\n\tint l=0;\n\tint h=n;\n\tint mid;\n\twhile(l<h){\n\t\tmid=(l+h)/2;\n\t\tif(cmp(words[mid],s)==0)\n\t\t\treturn 1;\n\t\telse if(cmp(words[mid],s)==1){\n\t\t\th=mid;\n\t\t}else\n\t\t\tl=mid+1;\n\t}\n\treturn -1;\n}\nvoid func(int *n,int base,int num){\n\tint i=0;\n\twhile(num/base!=0){\n\t\tn[i++]=num%base;\n\t\tnum/=base;\n\t}\n\tn[i++]=num;\n\tn[i++]=20;\n}\nint pal(int *n){\n\tint i,j;\n\tfor(i=0;n[i]!=20;i++);\n\tfor(j=0;j<i/2 && n[j]==n[i-j-1];j++);\n\tif(j==i/2)\n\t\treturn 1;\n\treturn 0;\n}\nint ispal(char *s, int i, int j){\n\tint k;\n\tfor(k=0;k<((j-i+1)/2) && s[i+k]==s[j-k];k++);\n\tif(k==(j-i+1)/2)\n\t\treturn 1;\n\treturn 0;\n}\nvoid insort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++){\n\t\tj=i;\n\t\twhile(j>0 && a[j]<a[j-1]){\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tj--;\n\t\t}\n\t}\n}\nchar lower(char c){\n\treturn c<'a'?c+('a'-'A'):c;\n}\nvoid sort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=temp;\n\t\t\t\n\t\t}\n}\nvoid fun(int n,char *s){\n\tint i=0;\n\tfor(i=0;n/10!=0;i++,n/=10)\n\t\ts[i]=n%10+'0';\n\ts[i++]=n+'0';\n\ts[i]='\\0';\n}\nvoid sortIn(int *a,int *indx,int n){\n\tint t1;\n\tint i,j;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\tt1=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=t1;\n\t\t\tt1=indx[j-1];\n\t\t\tindx[j-1]=indx[j];\n\t\t\tindx[j]=t1;\n\t\t}\n}\nint valid(int *a,int l,int r,int n){\n\tint f=0;\n\tif(l>0 && a[l-1]>a[r])\n\t\tf=1;\n\tif(a[l+1]<a[r])\n\t\tf=1;\n\tif(a[r-1]>a[l])\n\t\tf=1;\n\tif(r<n-1 && a[r+1]<a[l])\n\t\tf=1;\n\tif(f) \n\t\treturn 0;\n\treturn 1;\n}\nvoid change(char *stripe,int *colors,int idx,int k){\n\tint j=0;\n\tif(idx==1){\n\t\tif(stripe[0]-'A'>0)\n\t\t\tstripe[0]=colors[stripe[0]-'A'-1];\n\t\telse\n\t\t\tstripe[0]=colors[stripe[0]-'A'+1];\n\t\treturn ;\n\t}\n\tfor(j=0;j<idx;j+=2){\n\t\tif(stripe[j]-'A'>0){\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j+1]!=colors[stripe[j]-'A'-1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j]-'A'<k-1)\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-2];\n\t\t}else{\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+2];\n\t\t}\n\t}\n}\nint invite(struct point *nom[],int n,struct point *pts[],int m,struct point *invite[]){\n\tint i,j,idx=0;\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(nom[i]->x==pts[j]->x || nom[i]->y==pts[j]->y){\n\t\t\t\tif(pts[j]->visit==0){\n\t\t\t\t\tinvite[idx++]=pts[j];\n\t\t\t\t\tpts[j]->visit=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n\treturn idx;\n}\nint feasible(struct person *a[],int n){\n\tint i,j,k;\n\tint flag=1;\n\tfor(i=0;flag && i<n;i++)\n\t\tfor(j=0;flag && j<a[i]->nd;j++)\n\t\t\tfor(k=0;flag &&k<n;k++){\n\t\t\t\tif(a[k]->id==a[i]->dis[j]){\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\tif(i==n)\n\t\treturn 1;\n\treturn 0;\n}\nint find(struct node *p,struct node *node[]){\n\tint i,j,k;\n\tint count=0;\n\tfor(i=0;i<p->n;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;j<node[p->nei[i]]->n;j++){\n\t\t\tif(node[p->nei[i]]->nei[j]==-1)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<p->n;k++){\n\t\t\t\tif(p->nei[k]==-1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(node[p->nei[i]]->nei[j]==p->nei[k])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\treturn count;\n}\nvoid rem(struct node *p,struct node *nodes[],int n){\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tif(nodes[i]==NULL)\n\t\t\tcontinue;\n\t\tfor(j=0;j<nodes[i]->n;j++)\n\t\t\tif(nodes[i]->nei[j]==p->id)\n\t\t\t\tnodes[i]->nei[j]=-1;\n\t}\n}\nlong long GCD(long long a,long long b){\n\tif(a%b==0)\n\t\treturn b;\n\telse \n\t\treturn GCD(b,a%b);\n}\nint f(long long a, long long arr[], int n){\n\tif(a<=10000000){\n\t\tarr[n++]=a;\n\t\treturn n;\n\t}\n\tint i;\n\tint k;\n\tfor(i=sqrt(a)+1;i>1;i--)\n\t\tif(a%i==0){\n\t\t\tk=f(a/i,arr,n);\n\t\t\treturn f(i,arr,k);\n\t\t}\n}\nvoid merge(int *a,int l,int q,int n){\n\tint n1=q-l+1;\n\tint i,j,k;\n\tint n2=n-q;\n\tint L[n1+1];\n\tint R[n2+1];\n\tfor(i=0;i<n1;i++)\n\t\tL[i]=a[l+i];\n\tfor(i=0;i<n2;i++)\n\t\tR[i]=a[q+i+1];\n\tL[n1]=100002;\n\tR[n2]=100002;\n\ti=0;\n\tj=0;\n\tfor(k=l;k<=n;k++)\n\t\tif(L[i]<=R[j]){\n\t\t\ta[k]=L[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\ta[k]=R[j];\n\t\t\tj++;\n\t\t}\n}\nvoid mergesort(int *a,int l,int n){\n\tif(n>l){\n\t\tint q=(l+n)/2;\n\t\tmergesort(a,l,q);\n\t\tmergesort(a,q+1,n);\n\t\tmerge(a,l,q,n);\n\t}\n}\nvoid prime(long long n,long long *a){\n\tint i=2;\n\tint flag=0;\n\twhile(i<(sqrt(n)+1)){\n\t\tif(n%i==0){\n\t\t\ta[i]++;\n\t\t\tn/=i;\n\t\t\ti=2;\n\t\t\tflag=1;\n\t\t}else\n\t\t\ti++;\n\t}\n\tif(n>1)\n\t\ta[n]++;\n}\nstruct task **dup1(struct task *t[],int n){\n\tstruct task **dup=(struct task **)malloc(sizeof(struct bstnode *)*n);\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tdup[i]=(struct task *)malloc(sizeof(struct task));\n\t\tdup[i]->home=t[i]->home;\n\t\tdup[i]->done=t[i]->done;\n\t\tdup[i]->id=t[i]->id;\n\t\tdup[i]->np=t[i]->np;\n\t\tfor(j=0;j<t[i]->np;j++)\n\t\t\tdup[i]->pre[j]=t[i]->pre[j];\n\t}\n\treturn dup;\n}\nstruct home homes[3];\nvoid make(struct task *t[],struct bstnode *root,int i,int n){\n\tint idx,idx2;\n\tint j;\n\troot->visit=0;\n\tstruct task **dup=dup1(t,n); \n\troot->id=dup[i]->home;\n\tfor(idx=0;idx<homes[dup[i]->home-1].nt;idx++) //doing all the tasks that has no prereq\n\t\tif(dup[homes[dup[i]->home-1].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home-1].tasks[idx]-1]->done==0){\n\t\t\tdup[homes[dup[i]->home-1].tasks[idx]-1]->done=1;\n\t\t\tfor(idx2=0;idx2<n;idx2++)\n\t\t\t\t\tfor(j=0;dup[idx2]->pre[j]!=0;j++)\n\t\t\t\t\t\tif(dup[idx2]->pre[j]==dup[homes[dup[i]->home-1].tasks[idx]-1]->id){\n\t\t\t\t\t\t\tdup[idx2]->pre[j]=-1;\n\t\t\t\t\t\t\tdup[idx2]->np--;\n\t\t\t\t\t\t}\n\t\t}\n\tfor(idx=0;idx<homes[dup[i]->home%3].nt;idx++) //checking nei\n\t\tif(dup[homes[dup[i]->home%3].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home%3].tasks[idx]-1]->done==0){\n\t\t\troot->left=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->left->left=NULL;\n\t\t\troot->left->right=NULL;\n\t\t\tmake(dup,root->left,dup[homes[dup[i]->home%3].tasks[idx]-1]->id-1,n);\n\t\t}\n\tint home;\n\tif(dup[i]->home==1)\n\t\thome=2;\n\telse\n\t\thome=dup[i]->home-2;\n\tfor(idx=0;idx<homes[home].nt;idx++)\t\t//checking nei\n\t\tif(dup[homes[home].tasks[idx]-1]->np==0 && dup[homes[home].tasks[idx]-1]->done==0){\n\t\t\troot->right=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->right->right=NULL;\n\t\t\troot->right->left=NULL;\n\t\t\tmake(dup,root->right,dup[homes[home].tasks[idx]-1]->id-1,n);\n\t\t}\n\t\n}\nvoid chg(struct bstnode a){\n\tif(a.id==3)\n\t\tprintf(\"%d\",a.id);\n\telse{\n\t\ta.id=3;\n\t\tchg(a);\n\t}\n}\nint cal(struct bstnode *root,int cost){\n\tif(root==NULL)\n\t\treturn cost;\n\tint left=0,right=0;\n\tif(root->left!=NULL)\n\t\tleft=cal(root->left,cost+1);\n\tif(root->right!=NULL)\n\t\tright=cal(root->right,cost+2);\n\tif(left==0 && right==0)\n\t\treturn cost;\n\tif(left==0 && right!=0)\n\t\treturn right;\n\tif(right==0 && left!=0)\n\t\treturn left;\n\treturn (left>right)?right:left;\n}\nvoid print(struct bstnode *root, int i){\n\tif(root==NULL)\n\t\treturn;\n\t/*if(root->visit)\n\t\treturn ;\n\troot->visit=1;*/\n\tprint(root->left,1);\n\tif(i==1)\n\t\tprintf(\"left:\");\n\telse if(i==0)\n\t\tprintf(\"root:\");\n\telse if(i==2)\n\t\tprintf(\"right:\");\n\tprintf(\"%d \",root->id);\n\tprint(root->right,2);\n}\n/*long long a[10000000];\nlong long b[10000000];\nlong long p[10000000];\nlong long primes[700000];*/\nvoid prin(int *a,int num,int n){\n\tint i;\n\tif(num==0 || num==1 || num==2){\n\t\tprintf(\"%d \",num);\n\t\treturn ;\n\t}\n\tfor(i=n-1;i>=0 && a[i]>num;i--);\n\tprintf(\"%d \",a[i]);\n\tprin(a,n-a[i],n);\n}\nint a[10000];\nint l[10000];\nmain(){\n\tchar s[20];\n\tint i=0,j,idx=0;\n\tgetword(s,20);\n\tint num=atoi(s);\n\tgetword(s,20);\n\tint k=atoi(s);\n\tif(num==1){\n\t\tprintf(\"2\\n1 0\");\n\t\treturn 0;\n\t}\n\tif(num==2){\n\t\tprintf(\"2\\n2 0\");\n\t\treturn 0;\n\t}\n\tint sum=1;\n\ta[i++]=0;\n\ta[i++]=1;\n\tfor(;sum<num;i++){\n\t\ta[i]=sum;\n\t\tif(i-k>=0)\n\t\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t}\n\t//printf(\"%d \",i);\n\tj=i-1;\n\twhile(num>2){\n\t\tl[idx++]=a[j];\n\t\tnum-=a[j];\n\t\tfor(j=i-1;j>=0 && a[j]>num;j--);\n\t}\n\tl[idx++]=num;\n\tprintf(\"%d\\n\",idx);\n\tfor(j=0;j<idx;j++)\n\t\tprintf(\"%d \",l[j]);\n\treturn 0;\n}"}, {"source_code": "/*\nID: mohamma73\nLANG: C\nTASK: crypt1\n*/\n\n#include\"stdio.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"math.h\"\n#include\"string.h\"\nstruct cor{\n\tint real;\n\tint indx;\n};\nstruct home{\n\tint tasks[100];\n\tint nt;\n};\nstruct card{\n\tint val;\n\tchar suit;\n\tint id;\n};\nstruct task{\n\tint done;\n\tint id;\n\tint home;\n\tint pre[200];\n\tint np;\n};\nstruct bstnode{\n\tint id;\n\tint visit;\n\tstruct bstnode *left;\n\tstruct bstnode *right;\n};\nstruct point{\n\tint x;\n\tint y;\n\tint visit;\n};\nstruct node{\n\tint id;\n\tint n;\n\tint nei[202];\n\tint wei[200];\n};\nstruct person{\n\tint id;\n\tint nd;\n\tint nl;\n\tint like[2004];\n\tint dis[2004];\n\tint visit;\n};\nstruct farmer{\n\tint p;\n\tint c;\n};\nvoid inc(int *a,int n){\n\tint i;\n\tif(a[0]!=2){\n\t\ta[0]++;\n\t\treturn;\n\t}\n\tfor(i=0;i<n && a[i]==2;i++)\n\t\ta[i]=0;\n\tif(i<n)\n\t\ta[i]++;\n}\nint cmp(char *s,char *t){\n\tint n=strlen(s);\n\tint m=strlen(t);\n\tint i,j;\n\tfor(i=0,j=0;i<n && j<m && s[i]==t[j];i++,j++);\n\tif(s[i]>t[j])\n\t\treturn 1;\n\telse if(s[i]<t[j])\n\t\treturn -1;\n\telse \n\t\treturn 0;\n\t\n}\nint getword(char *s,int n){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getchar()));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getchar())\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nint fgetword(char *s,int n,FILE *fp){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getc(fp)));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getc(fp))\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nlong long atll(char *s){\n\tlong long n=0;\n\tint i;\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tn*=10;\n\t\tn+=(s[i]-'0');\n\t}\n\treturn n;\n}\nint Bsear(char *s,char words[][13],int n){\n\tint l=0;\n\tint h=n;\n\tint mid;\n\twhile(l<h){\n\t\tmid=(l+h)/2;\n\t\tif(cmp(words[mid],s)==0)\n\t\t\treturn 1;\n\t\telse if(cmp(words[mid],s)==1){\n\t\t\th=mid;\n\t\t}else\n\t\t\tl=mid+1;\n\t}\n\treturn -1;\n}\nvoid func(int *n,int base,int num){\n\tint i=0;\n\twhile(num/base!=0){\n\t\tn[i++]=num%base;\n\t\tnum/=base;\n\t}\n\tn[i++]=num;\n\tn[i++]=20;\n}\nint pal(int *n){\n\tint i,j;\n\tfor(i=0;n[i]!=20;i++);\n\tfor(j=0;j<i/2 && n[j]==n[i-j-1];j++);\n\tif(j==i/2)\n\t\treturn 1;\n\treturn 0;\n}\nint ispal(char *s, int i, int j){\n\tint k;\n\tfor(k=0;k<((j-i+1)/2) && s[i+k]==s[j-k];k++);\n\tif(k==(j-i+1)/2)\n\t\treturn 1;\n\treturn 0;\n}\nvoid insort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++){\n\t\tj=i;\n\t\twhile(j>0 && a[j]<a[j-1]){\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tj--;\n\t\t}\n\t}\n}\nchar lower(char c){\n\treturn c<'a'?c+('a'-'A'):c;\n}\nvoid sort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=temp;\n\t\t\t\n\t\t}\n}\nvoid fun(int n,char *s){\n\tint i=0;\n\tfor(i=0;n/10!=0;i++,n/=10)\n\t\ts[i]=n%10+'0';\n\ts[i++]=n+'0';\n\ts[i]='\\0';\n}\nvoid sortIn(int *a,int *indx,int n){\n\tint t1;\n\tint i,j;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\tt1=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=t1;\n\t\t\tt1=indx[j-1];\n\t\t\tindx[j-1]=indx[j];\n\t\t\tindx[j]=t1;\n\t\t}\n}\nint valid(int *a,int l,int r,int n){\n\tint f=0;\n\tif(l>0 && a[l-1]>a[r])\n\t\tf=1;\n\tif(a[l+1]<a[r])\n\t\tf=1;\n\tif(a[r-1]>a[l])\n\t\tf=1;\n\tif(r<n-1 && a[r+1]<a[l])\n\t\tf=1;\n\tif(f) \n\t\treturn 0;\n\treturn 1;\n}\nvoid change(char *stripe,int *colors,int idx,int k){\n\tint j=0;\n\tif(idx==1){\n\t\tif(stripe[0]-'A'>0)\n\t\t\tstripe[0]=colors[stripe[0]-'A'-1];\n\t\telse\n\t\t\tstripe[0]=colors[stripe[0]-'A'+1];\n\t\treturn ;\n\t}\n\tfor(j=0;j<idx;j+=2){\n\t\tif(stripe[j]-'A'>0){\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j+1]!=colors[stripe[j]-'A'-1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j]-'A'<k-1)\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-2];\n\t\t}else{\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+2];\n\t\t}\n\t}\n}\nint invite(struct point *nom[],int n,struct point *pts[],int m,struct point *invite[]){\n\tint i,j,idx=0;\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(nom[i]->x==pts[j]->x || nom[i]->y==pts[j]->y){\n\t\t\t\tif(pts[j]->visit==0){\n\t\t\t\t\tinvite[idx++]=pts[j];\n\t\t\t\t\tpts[j]->visit=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n\treturn idx;\n}\nint feasible(struct person *a[],int n){\n\tint i,j,k;\n\tint flag=1;\n\tfor(i=0;flag && i<n;i++)\n\t\tfor(j=0;flag && j<a[i]->nd;j++)\n\t\t\tfor(k=0;flag &&k<n;k++){\n\t\t\t\tif(a[k]->id==a[i]->dis[j]){\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\tif(i==n)\n\t\treturn 1;\n\treturn 0;\n}\nint find(struct node *p,struct node *node[]){\n\tint i,j,k;\n\tint count=0;\n\tfor(i=0;i<p->n;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;j<node[p->nei[i]]->n;j++){\n\t\t\tif(node[p->nei[i]]->nei[j]==-1)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<p->n;k++){\n\t\t\t\tif(p->nei[k]==-1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(node[p->nei[i]]->nei[j]==p->nei[k])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\treturn count;\n}\nvoid rem(struct node *p,struct node *nodes[],int n){\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tif(nodes[i]==NULL)\n\t\t\tcontinue;\n\t\tfor(j=0;j<nodes[i]->n;j++)\n\t\t\tif(nodes[i]->nei[j]==p->id)\n\t\t\t\tnodes[i]->nei[j]=-1;\n\t}\n}\nlong long GCD(long long a,long long b){\n\tif(a%b==0)\n\t\treturn b;\n\telse \n\t\treturn GCD(b,a%b);\n}\nint f(long long a, long long arr[], int n){\n\tif(a<=10000000){\n\t\tarr[n++]=a;\n\t\treturn n;\n\t}\n\tint i;\n\tint k;\n\tfor(i=sqrt(a)+1;i>1;i--)\n\t\tif(a%i==0){\n\t\t\tk=f(a/i,arr,n);\n\t\t\treturn f(i,arr,k);\n\t\t}\n}\nvoid merge(int *a,int l,int q,int n){\n\tint n1=q-l+1;\n\tint i,j,k;\n\tint n2=n-q;\n\tint L[n1+1];\n\tint R[n2+1];\n\tfor(i=0;i<n1;i++)\n\t\tL[i]=a[l+i];\n\tfor(i=0;i<n2;i++)\n\t\tR[i]=a[q+i+1];\n\tL[n1]=100002;\n\tR[n2]=100002;\n\ti=0;\n\tj=0;\n\tfor(k=l;k<=n;k++)\n\t\tif(L[i]<=R[j]){\n\t\t\ta[k]=L[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\ta[k]=R[j];\n\t\t\tj++;\n\t\t}\n}\nvoid mergesort(int *a,int l,int n){\n\tif(n>l){\n\t\tint q=(l+n)/2;\n\t\tmergesort(a,l,q);\n\t\tmergesort(a,q+1,n);\n\t\tmerge(a,l,q,n);\n\t}\n}\nvoid prime(long long n,long long *a){\n\tint i=2;\n\tint flag=0;\n\twhile(i<(sqrt(n)+1)){\n\t\tif(n%i==0){\n\t\t\ta[i]++;\n\t\t\tn/=i;\n\t\t\ti=2;\n\t\t\tflag=1;\n\t\t}else\n\t\t\ti++;\n\t}\n\tif(n>1)\n\t\ta[n]++;\n}\nstruct task **dup1(struct task *t[],int n){\n\tstruct task **dup=(struct task **)malloc(sizeof(struct bstnode *)*n);\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tdup[i]=(struct task *)malloc(sizeof(struct task));\n\t\tdup[i]->home=t[i]->home;\n\t\tdup[i]->done=t[i]->done;\n\t\tdup[i]->id=t[i]->id;\n\t\tdup[i]->np=t[i]->np;\n\t\tfor(j=0;j<t[i]->np;j++)\n\t\t\tdup[i]->pre[j]=t[i]->pre[j];\n\t}\n\treturn dup;\n}\nstruct home homes[3];\nvoid make(struct task *t[],struct bstnode *root,int i,int n){\n\tint idx,idx2;\n\tint j;\n\troot->visit=0;\n\tstruct task **dup=dup1(t,n); \n\troot->id=dup[i]->home;\n\tfor(idx=0;idx<homes[dup[i]->home-1].nt;idx++) //doing all the tasks that has no prereq\n\t\tif(dup[homes[dup[i]->home-1].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home-1].tasks[idx]-1]->done==0){\n\t\t\tdup[homes[dup[i]->home-1].tasks[idx]-1]->done=1;\n\t\t\tfor(idx2=0;idx2<n;idx2++)\n\t\t\t\t\tfor(j=0;dup[idx2]->pre[j]!=0;j++)\n\t\t\t\t\t\tif(dup[idx2]->pre[j]==dup[homes[dup[i]->home-1].tasks[idx]-1]->id){\n\t\t\t\t\t\t\tdup[idx2]->pre[j]=-1;\n\t\t\t\t\t\t\tdup[idx2]->np--;\n\t\t\t\t\t\t}\n\t\t}\n\tfor(idx=0;idx<homes[dup[i]->home%3].nt;idx++) //checking nei\n\t\tif(dup[homes[dup[i]->home%3].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home%3].tasks[idx]-1]->done==0){\n\t\t\troot->left=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->left->left=NULL;\n\t\t\troot->left->right=NULL;\n\t\t\tmake(dup,root->left,dup[homes[dup[i]->home%3].tasks[idx]-1]->id-1,n);\n\t\t}\n\tint home;\n\tif(dup[i]->home==1)\n\t\thome=2;\n\telse\n\t\thome=dup[i]->home-2;\n\tfor(idx=0;idx<homes[home].nt;idx++)\t\t//checking nei\n\t\tif(dup[homes[home].tasks[idx]-1]->np==0 && dup[homes[home].tasks[idx]-1]->done==0){\n\t\t\troot->right=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->right->right=NULL;\n\t\t\troot->right->left=NULL;\n\t\t\tmake(dup,root->right,dup[homes[home].tasks[idx]-1]->id-1,n);\n\t\t}\n\t\n}\nvoid chg(struct bstnode a){\n\tif(a.id==3)\n\t\tprintf(\"%d\",a.id);\n\telse{\n\t\ta.id=3;\n\t\tchg(a);\n\t}\n}\nint cal(struct bstnode *root,int cost){\n\tif(root==NULL)\n\t\treturn cost;\n\tint left=0,right=0;\n\tif(root->left!=NULL)\n\t\tleft=cal(root->left,cost+1);\n\tif(root->right!=NULL)\n\t\tright=cal(root->right,cost+2);\n\tif(left==0 && right==0)\n\t\treturn cost;\n\tif(left==0 && right!=0)\n\t\treturn right;\n\tif(right==0 && left!=0)\n\t\treturn left;\n\treturn (left>right)?right:left;\n}\nvoid print(struct bstnode *root, int i){\n\tif(root==NULL)\n\t\treturn;\n\t/*if(root->visit)\n\t\treturn ;\n\troot->visit=1;*/\n\tprint(root->left,1);\n\tif(i==1)\n\t\tprintf(\"left:\");\n\telse if(i==0)\n\t\tprintf(\"root:\");\n\telse if(i==2)\n\t\tprintf(\"right:\");\n\tprintf(\"%d \",root->id);\n\tprint(root->right,2);\n}\n/*long long a[10000000];\nlong long b[10000000];\nlong long p[10000000];\nlong long primes[700000];*/\nvoid prin(int *a,int num,int n){\n\tint i;\n\tif(num==0 || num==1 || num==2){\n\t\tprintf(\"%d \",num);\n\t\treturn ;\n\t}\n\tfor(i=n-1;i>=0 && a[i]>num;i--);\n\tprintf(\"%d \",a[i]);\n\tprin(a,n-a[i],n);\n}\nlong long a[10000];\nlong long l[10000];\nmain(){\n\tchar s[20];\n\tint i=0,j,idx=0;\n\tgetword(s,20);\n\tlong long num=atll(s);\n\tgetword(s,20);\n\tlong long k=atll(s);\n\tif(num==1){\n\t\tprintf(\"2\\n1 0\");\n\t\treturn 0;\n\t}\n\tif(num==2){\n\t\tprintf(\"2\\n2 0\");\n\t\treturn 0;\n\t}\n\tlong long sum=1;\n\ta[i++]=0;\n\ta[i++]=1;\n\tfor(;sum<num;i++){\n\t\ta[i]=sum;\n\t\tif(i-k>=0)\n\t\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t}\n\tj=i-1;\n\twhile(num>2){\n\t\tl[idx++]=a[j];\n\t\tnum-=a[j];\n\t\tfor(j=i-1;j>=0 && a[j]>num;j--);\n\t}\n\tl[idx++]=num;\n\tif(idx==1){\n\t\tprintf(\"2\\n%I64d 0\",l[0]);\n\t\treturn 0;\n\t}\n\tprintf(\"%d\\n\",idx);\n\tfor(j=0;j<idx;j++)\n\t\tprintf(\"%I64d \",l[j]);\n\treturn 0;\n}"}, {"source_code": "/*\nID: mohamma73\nLANG: C\nTASK: crypt1\n*/\n\n#include\"stdio.h\"\n#include\"stdlib.h\"\n#include\"ctype.h\"\n#include\"math.h\"\n#include\"string.h\"\nstruct cor{\n\tint real;\n\tint indx;\n};\nstruct home{\n\tint tasks[100];\n\tint nt;\n};\nstruct card{\n\tint val;\n\tchar suit;\n\tint id;\n};\nstruct task{\n\tint done;\n\tint id;\n\tint home;\n\tint pre[200];\n\tint np;\n};\nstruct bstnode{\n\tint id;\n\tint visit;\n\tstruct bstnode *left;\n\tstruct bstnode *right;\n};\nstruct point{\n\tint x;\n\tint y;\n\tint visit;\n};\nstruct node{\n\tint id;\n\tint n;\n\tint nei[202];\n\tint wei[200];\n};\nstruct person{\n\tint id;\n\tint nd;\n\tint nl;\n\tint like[2004];\n\tint dis[2004];\n\tint visit;\n};\nstruct farmer{\n\tint p;\n\tint c;\n};\nvoid inc(int *a,int n){\n\tint i;\n\tif(a[0]!=2){\n\t\ta[0]++;\n\t\treturn;\n\t}\n\tfor(i=0;i<n && a[i]==2;i++)\n\t\ta[i]=0;\n\tif(i<n)\n\t\ta[i]++;\n}\nint cmp(char *s,char *t){\n\tint n=strlen(s);\n\tint m=strlen(t);\n\tint i,j;\n\tfor(i=0,j=0;i<n && j<m && s[i]==t[j];i++,j++);\n\tif(s[i]>t[j])\n\t\treturn 1;\n\telse if(s[i]<t[j])\n\t\treturn -1;\n\telse \n\t\treturn 0;\n\t\n}\nint getword(char *s,int n){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getchar()));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getchar())\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nint fgetword(char *s,int n,FILE *fp){\n\tint i;\n\tchar c;\n\twhile(isspace(c=getc(fp)));\n\tfor(i=0;i<n && !isspace(c) && c!=EOF;i++,c=getc(fp))\n\t\ts[i]=c;\n\ts[i++]='\\0';\n\treturn i-1;\n}\nlong long atll(char *s){\n\tlong long n=0;\n\tint i;\n\tfor(i=0;s[i]!='\\0';i++){\n\t\tn*=10;\n\t\tn+=(s[i]-'0');\n\t}\n\treturn n;\n}\nint Bsear(char *s,char words[][13],int n){\n\tint l=0;\n\tint h=n;\n\tint mid;\n\twhile(l<h){\n\t\tmid=(l+h)/2;\n\t\tif(cmp(words[mid],s)==0)\n\t\t\treturn 1;\n\t\telse if(cmp(words[mid],s)==1){\n\t\t\th=mid;\n\t\t}else\n\t\t\tl=mid+1;\n\t}\n\treturn -1;\n}\nvoid func(int *n,int base,int num){\n\tint i=0;\n\twhile(num/base!=0){\n\t\tn[i++]=num%base;\n\t\tnum/=base;\n\t}\n\tn[i++]=num;\n\tn[i++]=20;\n}\nint pal(int *n){\n\tint i,j;\n\tfor(i=0;n[i]!=20;i++);\n\tfor(j=0;j<i/2 && n[j]==n[i-j-1];j++);\n\tif(j==i/2)\n\t\treturn 1;\n\treturn 0;\n}\nint ispal(char *s, int i, int j){\n\tint k;\n\tfor(k=0;k<((j-i+1)/2) && s[i+k]==s[j-k];k++);\n\tif(k==(j-i+1)/2)\n\t\treturn 1;\n\treturn 0;\n}\nvoid insort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++){\n\t\tj=i;\n\t\twhile(j>0 && a[j]<a[j-1]){\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tj--;\n\t\t}\n\t}\n}\nchar lower(char c){\n\treturn c<'a'?c+('a'-'A'):c;\n}\nvoid sort(int *a,int n){\n\tint i,j,temp;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\t\ttemp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=temp;\n\t\t\t\n\t\t}\n}\nvoid fun(int n,char *s){\n\tint i=0;\n\tfor(i=0;n/10!=0;i++,n/=10)\n\t\ts[i]=n%10+'0';\n\ts[i++]=n+'0';\n\ts[i]='\\0';\n}\nvoid sortIn(int *a,int *indx,int n){\n\tint t1;\n\tint i,j;\n\tfor(i=1;i<n;i++)\n\t\tfor(j=i;j>0 && a[j-1]>a[j];j--){\n\t\t\tt1=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=t1;\n\t\t\tt1=indx[j-1];\n\t\t\tindx[j-1]=indx[j];\n\t\t\tindx[j]=t1;\n\t\t}\n}\nint valid(int *a,int l,int r,int n){\n\tint f=0;\n\tif(l>0 && a[l-1]>a[r])\n\t\tf=1;\n\tif(a[l+1]<a[r])\n\t\tf=1;\n\tif(a[r-1]>a[l])\n\t\tf=1;\n\tif(r<n-1 && a[r+1]<a[l])\n\t\tf=1;\n\tif(f) \n\t\treturn 0;\n\treturn 1;\n}\nvoid change(char *stripe,int *colors,int idx,int k){\n\tint j=0;\n\tif(idx==1){\n\t\tif(stripe[0]-'A'>0)\n\t\t\tstripe[0]=colors[stripe[0]-'A'-1];\n\t\telse\n\t\t\tstripe[0]=colors[stripe[0]-'A'+1];\n\t\treturn ;\n\t}\n\tfor(j=0;j<idx;j+=2){\n\t\tif(stripe[j]-'A'>0){\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j+1]!=colors[stripe[j]-'A'-1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-1];\n\t\t\telse if(stripe[j]-'A'<k-1)\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'-2];\n\t\t}else{\n\t\t\tif(stripe[j]==stripe[j+1])\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+1];\n\t\t\telse\n\t\t\t\tstripe[j]=colors[stripe[j]-'A'+2];\n\t\t}\n\t}\n}\nint invite(struct point *nom[],int n,struct point *pts[],int m,struct point *invite[]){\n\tint i,j,idx=0;\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(nom[i]->x==pts[j]->x || nom[i]->y==pts[j]->y){\n\t\t\t\tif(pts[j]->visit==0){\n\t\t\t\t\tinvite[idx++]=pts[j];\n\t\t\t\t\tpts[j]->visit=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n\treturn idx;\n}\nint feasible(struct person *a[],int n){\n\tint i,j,k;\n\tint flag=1;\n\tfor(i=0;flag && i<n;i++)\n\t\tfor(j=0;flag && j<a[i]->nd;j++)\n\t\t\tfor(k=0;flag &&k<n;k++){\n\t\t\t\tif(a[k]->id==a[i]->dis[j]){\n\t\t\t\t\tflag=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\tif(i==n)\n\t\treturn 1;\n\treturn 0;\n}\nint find(struct node *p,struct node *node[]){\n\tint i,j,k;\n\tint count=0;\n\tfor(i=0;i<p->n;i++){\n\t\tif(p->nei[i]==-1)\n\t\t\tcontinue;\n\t\tfor(j=0;j<node[p->nei[i]]->n;j++){\n\t\t\tif(node[p->nei[i]]->nei[j]==-1)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<p->n;k++){\n\t\t\t\tif(p->nei[k]==-1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(node[p->nei[i]]->nei[j]==p->nei[k])\n\t\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\treturn count;\n}\nvoid rem(struct node *p,struct node *nodes[],int n){\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tif(nodes[i]==NULL)\n\t\t\tcontinue;\n\t\tfor(j=0;j<nodes[i]->n;j++)\n\t\t\tif(nodes[i]->nei[j]==p->id)\n\t\t\t\tnodes[i]->nei[j]=-1;\n\t}\n}\nlong long GCD(long long a,long long b){\n\tif(a%b==0)\n\t\treturn b;\n\telse \n\t\treturn GCD(b,a%b);\n}\nint f(long long a, long long arr[], int n){\n\tif(a<=10000000){\n\t\tarr[n++]=a;\n\t\treturn n;\n\t}\n\tint i;\n\tint k;\n\tfor(i=sqrt(a)+1;i>1;i--)\n\t\tif(a%i==0){\n\t\t\tk=f(a/i,arr,n);\n\t\t\treturn f(i,arr,k);\n\t\t}\n}\nvoid merge(int *a,int l,int q,int n){\n\tint n1=q-l+1;\n\tint i,j,k;\n\tint n2=n-q;\n\tint L[n1+1];\n\tint R[n2+1];\n\tfor(i=0;i<n1;i++)\n\t\tL[i]=a[l+i];\n\tfor(i=0;i<n2;i++)\n\t\tR[i]=a[q+i+1];\n\tL[n1]=100002;\n\tR[n2]=100002;\n\ti=0;\n\tj=0;\n\tfor(k=l;k<=n;k++)\n\t\tif(L[i]<=R[j]){\n\t\t\ta[k]=L[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\ta[k]=R[j];\n\t\t\tj++;\n\t\t}\n}\nvoid mergesort(int *a,int l,int n){\n\tif(n>l){\n\t\tint q=(l+n)/2;\n\t\tmergesort(a,l,q);\n\t\tmergesort(a,q+1,n);\n\t\tmerge(a,l,q,n);\n\t}\n}\nvoid prime(long long n,long long *a){\n\tint i=2;\n\tint flag=0;\n\twhile(i<(sqrt(n)+1)){\n\t\tif(n%i==0){\n\t\t\ta[i]++;\n\t\t\tn/=i;\n\t\t\ti=2;\n\t\t\tflag=1;\n\t\t}else\n\t\t\ti++;\n\t}\n\tif(n>1)\n\t\ta[n]++;\n}\nstruct task **dup1(struct task *t[],int n){\n\tstruct task **dup=(struct task **)malloc(sizeof(struct bstnode *)*n);\n\tint i,j;\n\tfor(i=0;i<n;i++){\n\t\tdup[i]=(struct task *)malloc(sizeof(struct task));\n\t\tdup[i]->home=t[i]->home;\n\t\tdup[i]->done=t[i]->done;\n\t\tdup[i]->id=t[i]->id;\n\t\tdup[i]->np=t[i]->np;\n\t\tfor(j=0;j<t[i]->np;j++)\n\t\t\tdup[i]->pre[j]=t[i]->pre[j];\n\t}\n\treturn dup;\n}\nstruct home homes[3];\nvoid make(struct task *t[],struct bstnode *root,int i,int n){\n\tint idx,idx2;\n\tint j;\n\troot->visit=0;\n\tstruct task **dup=dup1(t,n); \n\troot->id=dup[i]->home;\n\tfor(idx=0;idx<homes[dup[i]->home-1].nt;idx++) //doing all the tasks that has no prereq\n\t\tif(dup[homes[dup[i]->home-1].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home-1].tasks[idx]-1]->done==0){\n\t\t\tdup[homes[dup[i]->home-1].tasks[idx]-1]->done=1;\n\t\t\tfor(idx2=0;idx2<n;idx2++)\n\t\t\t\t\tfor(j=0;dup[idx2]->pre[j]!=0;j++)\n\t\t\t\t\t\tif(dup[idx2]->pre[j]==dup[homes[dup[i]->home-1].tasks[idx]-1]->id){\n\t\t\t\t\t\t\tdup[idx2]->pre[j]=-1;\n\t\t\t\t\t\t\tdup[idx2]->np--;\n\t\t\t\t\t\t}\n\t\t}\n\tfor(idx=0;idx<homes[dup[i]->home%3].nt;idx++) //checking nei\n\t\tif(dup[homes[dup[i]->home%3].tasks[idx]-1]->np==0 && dup[homes[dup[i]->home%3].tasks[idx]-1]->done==0){\n\t\t\troot->left=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->left->left=NULL;\n\t\t\troot->left->right=NULL;\n\t\t\tmake(dup,root->left,dup[homes[dup[i]->home%3].tasks[idx]-1]->id-1,n);\n\t\t}\n\tint home;\n\tif(dup[i]->home==1)\n\t\thome=2;\n\telse\n\t\thome=dup[i]->home-2;\n\tfor(idx=0;idx<homes[home].nt;idx++)\t\t//checking nei\n\t\tif(dup[homes[home].tasks[idx]-1]->np==0 && dup[homes[home].tasks[idx]-1]->done==0){\n\t\t\troot->right=(struct bstnode *)malloc(sizeof(struct bstnode));\n\t\t\troot->right->right=NULL;\n\t\t\troot->right->left=NULL;\n\t\t\tmake(dup,root->right,dup[homes[home].tasks[idx]-1]->id-1,n);\n\t\t}\n\t\n}\nvoid chg(struct bstnode a){\n\tif(a.id==3)\n\t\tprintf(\"%d\",a.id);\n\telse{\n\t\ta.id=3;\n\t\tchg(a);\n\t}\n}\nint cal(struct bstnode *root,int cost){\n\tif(root==NULL)\n\t\treturn cost;\n\tint left=0,right=0;\n\tif(root->left!=NULL)\n\t\tleft=cal(root->left,cost+1);\n\tif(root->right!=NULL)\n\t\tright=cal(root->right,cost+2);\n\tif(left==0 && right==0)\n\t\treturn cost;\n\tif(left==0 && right!=0)\n\t\treturn right;\n\tif(right==0 && left!=0)\n\t\treturn left;\n\treturn (left>right)?right:left;\n}\nvoid print(struct bstnode *root, int i){\n\tif(root==NULL)\n\t\treturn;\n\t/*if(root->visit)\n\t\treturn ;\n\troot->visit=1;*/\n\tprint(root->left,1);\n\tif(i==1)\n\t\tprintf(\"left:\");\n\telse if(i==0)\n\t\tprintf(\"root:\");\n\telse if(i==2)\n\t\tprintf(\"right:\");\n\tprintf(\"%d \",root->id);\n\tprint(root->right,2);\n}\n/*long long a[10000000];\nlong long b[10000000];\nlong long p[10000000];\nlong long primes[700000];*/\nint a[10000000];\nint l[1000000];\nvoid prin(int num,int n){\n\tint i;\n\tif(num==0 || num==1 || num==2){\n\t\tprintf(\"%d \",num);\n\t\treturn ;\n\t}\n\tfor(i=n-1;i>=0 && a[i]>num;i--);\n\tprintf(\"%d \",a[i]);\n\tprin(n-a[i],n);\n}\nmain(){\n\tchar s[20];\n\tint i,j,idx=0;\n\tgetword(s,20);\n\tint num=atoi(s);\n\tgetword(s,20);\n\tint k=atoi(s);\n\tfor(i=0;i<k;i++)\n\t\ta[i]=0;\n\tif(num==1){\n\t\tprintf(\"1\\n1\");\n\t\treturn 0;\n\t}\n\tint sum=1;\n\ta[i++]=1;\n\tfor(;sum<num;i++){\n\t\ta[i]=sum;\n\t\tsum-=a[i-k];\n\t\tsum+=a[i];\n\t}\n\tj=i-1;\n\twhile(num>2){\n\t\tl[idx++]=a[j];\n\t\tnum-=a[j];\n\t\tfor(j=i-1;j>=0 && a[j]>num;j--);\n\t}\n\tl[idx++]=num;\n\tprintf(\"%d\\n\",idx);\n\tfor(j=0;j<idx;j++)\n\t\tprintf(\"%d \",l[j]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f[1000];\nint c[1000];\nint a[1000];\n\nint search(int s, int n, int m)\n{\n int l = 0, r = n - 1, mid, ret = -1;\n while (l <= r)\n {\n mid = (l + r) >> 1;\n if (f[mid] < s)\n {\n ret = mid;\n l = mid + 1;\n }\n else if (f[mid] == s && m != 0)\n {\n ret = mid;\n break;\n }\n else\n {\n r = mid - 1;\n }\n }\n return ret;\n}\n\nvoid func(int s, int k)\n{\n int i, n, m, p;\n f[0] = c[0] = 1;\n for (i = 1; i < k && f[i - 1] <= s; i ++)\n {\n f[i] = c[i - 1];\n c[i] = c[i - 1] << 1;\n }\n if (i == k)\n {\n while (f[i - 1] <= s)\n {\n f[i] = c[i - 1];\n c[i] = c[i - 1] << 1;\n c[i] -= f[i - k];\n i ++;\n }\n }\n n = i;\n m = 0;\n while (s != 0)\n {\n p = search(s, n, m);\n a[m ++] = f[p];\n s -= f[p];\n n = p;\n }\n for (i = 0; i < m - 1; i ++)\n {\n printf(\"%d \", a[i]);\n }\n printf(\"%d\\n\", a[i]);\n}\n\nint main()\n{\n int s, k;\n while (scanf(\"%d%d\", &s, &k) == 2)\n {\n func(s, k);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void){\n int fib[45]={0},stock[45]={0};\n int s,k,i,n,sum=0,num=0;\n scanf(\"%d %d\",&s,&k);\n for(i=0;i==0||fib[i-1]<=s;i++){\n if(i<=1) fib[i]=1;\n else if(i<=k) fib[i]=sum;\n else{\n sum-=fib[i-k-1];\n fib[i]=sum;\n }\n //printf(\"%d %d\\n\",i,fib[i]);\n sum+=fib[i];\n //printf(\"sum:%d\\n\",sum);\n }\n //printf(\"i:%d\\n\",i);\n n=i-2;\n if(fib[i-2]==s) n--;\n //printf(\"n:%d %d\\n\",n,fib[n]);\n for(i=n;i>=0;i--){\n if(fib[i]<=s){\n stock[num++]=fib[i];\n s-=fib[i];\n if(s==0) break;\n }\n }\n printf(\"%d\\n\",num);\n for(i=num-1;i>=0;i--){\n printf(\"%d\",stock[i]);\n putchar((i>0)?' ':'\\n');\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void){\n int fib[45],stock[45];\n int s,k,i,n,sum=0,num=0;\n scanf(\"%d %d\",&s,&k);\n for(i=0;fib[i-1]<=s;i++){\n if(i<=1) fib[i]=1;\n else if(i<k&&k!=2) fib[i]=sum;\n else{\n sum-=fib[i-1-k];\n fib[i]=sum;\n }\n //printf(\"%d %d\\n\",i,fib[i]);\n sum+=fib[i];\n }\n n=i-2;\n if(fib[i-2]==s) n--;\n //printf(\"n:%d %d\\n\",n,fib[n]);\n for(i=n;i>=0;i--){\n if(fib[i]<=s){\n stock[num++]=fib[i];\n s-=fib[i];\n if(s==0) break;\n }\n }\n printf(\"%d\\n\",num);\n for(i=num-1;i>=0;i--){\n printf(\"%d\",stock[i]);\n putchar((i>0)?' ':'\\n');\n }\n //printf(\"%d %d\\n\",n,fib[(i-1)%3]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void){\n int fib[45]={0},stock[45]={0};\n int s,k,i,n,sum=0,num=0;\n scanf(\"%d %d\",&s,&k);\n for(i=0;i==0||fib[i-1]<=s;i++){\n if(i<=1) fib[i]=1;\n else if(i<=k) fib[i]=sum;\n else{\n sum-=fib[i-k-1];\n fib[i]=sum;\n }\n //printf(\"%d %d\\n\",i,fib[i]);\n sum+=fib[i];\n //printf(\"sum:%d\\n\",sum);\n }\n //printf(\"i:%d\\n\",i);\n n=i-2;\n if(fib[i-2]==s) n--;\n //printf(\"n:%d %d\\n\",n,fib[n]);\n for(i=n;i>=0;i--){\n if(fib[i]<=s){\n stock[num++]=fib[i];\n s-=fib[i];\n if(s==0) break;\n }\n }\n if(num==1) fib[num++]=0;\n printf(\"%d\\n\",num);\n for(i=num-1;i>=0;i--){\n printf(\"%d\",stock[i]);\n putchar((i>0)?' ':'\\n');\n }\n return 0;\n}\n"}, {"source_code": " #include <stdio.h>\n \n long kf[1000];\n long ch[1000];\n\n \n int main(){\n long s, k;\n int m=0;\n int i, j;\n int n;\n int alone=1;\n scanf (\"%ld%ld\", &s, &k);\n i=k-1;\n kf[i]=1;\n while (kf[i]<=s){\n i++;\n for (j=i-1; j>=i-k; j--)\n kf[i]+=kf[j];\n }\n while (s>0 || alone){\n while (kf[i]>s) i--;\n while (kf[i]==s && alone) i--;\n while (kf[i]==ch[m-1]) i--;\n s-=kf[i];\n alone=0;\n ch[m]=kf[i];\n m++;\n i--;\n }\n printf (\"%d\\n\", m);\n for (i=0; i<m; i++)\n printf (\"%ld \", ch[i]);\n printf (\"\\n\");\n return 0;\n }\n"}, {"source_code": " #include <stdio.h>\n \n long kf[1000];\n long ch[1000];\n\n \n int main(){\n long s, k;\n int m=1;\n long tmp;\n int i, j;\n int n;\n int alone=0;\n scanf (\"%ld%ld\", &s, &k);\n kf[1]=1;\n i=1;\n while (kf[i]<=s){\n i++;\n tmp=i-k;\n if (tmp<0) tmp=0;\n for (j=i-1; j>=tmp; j--)\n kf[i]+=kf[j];\n }\n while (s>0){\n while (kf[i]>s) i--;\n if (kf[i]==s) alone++;\n s=s-kf[i];\n ch[m]=kf[i];\n m++;\n i--;\n }\n if (alone){\n ch[m]=0;\n m++;\n }\n printf (\"%d\\n\", m);\n for (i=1; i<=m; i++)\n printf (\"%ld \", ch[i]);\n printf (\"\\n\");\n return 0;\n }\n"}, {"source_code": " #include <stdio.h>\n \n long kf[1000];\n long ch[1000];\n\n \n int main(){\n long s, k;\n int m=0;\n int i, j;\n int n;\n int alone=1;\n scanf (\"%ld%ld\", &s, &k);\n i=k-1;\n kf[i]=1;\n while (kf[i]<=s){\n i++;\n for (j=i-1; j>=i-k; j--)\n kf[i]+=kf[j];\n }\n\n while (s>0){\n while (kf[i]>s) i--;\n if (kf[i]==s && alone) i--;\n s-=kf[i];\n alone=0;\n ch[m]=kf[i];\n m++;\n i--;\n }\n printf (\"%d\\n\", m);\n for (i=0; i<m; i++)\n printf (\"%ld \", ch[i]);\n printf (\"\\n\");\n return 0;\n }\n"}, {"source_code": " #include <stdio.h>\n \n long kf[1000];\n long ch[1000];\n\n \n int main(){\n long s, k;\n int m=0;\n int i, j;\n int n;\n int alone=1;\n scanf (\"%ld%ld\", &s, &k);\n i=k-1;\n kf[i]=1;\n while (kf[i]<=s){\n i++;\n for (j=i-1; j>=i-k; j--)\n kf[i]+=kf[j];\n }\n while (s>0){\n while (kf[i]>s) i--;\n while (kf[i]==s && alone) i--;\n while (kf[i]==ch[m-1]) i--;\n s-=kf[i];\n alone=0;\n ch[m]=kf[i];\n m++;\n i--;\n }\n printf (\"%d\\n\", m);\n for (i=0; i<m; i++)\n printf (\"%ld \", ch[i]);\n printf (\"\\n\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[100];\nint Counter;\nint Ans[100];\nint k;\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n F[0] = 0;\n F[1] = 1;\n F[2] = 1;\n \n k=K;\n if (k>30) k = 30;\n \n for (i=3; F[i-1]<(1<<(k-1)); i++) F[i] = 1<<(i-2);\n \n for ( ; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-k-1];\n i--;\n if (F[i]==S) i--;\n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[1000];\nint Counter;\nint Ans[1000];\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n for (i=0; i<K; i++) F[i] = 0;\n F[K] = 1;\n F[K+1] = 1;\n for (i=K+2; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-K-1];\n i--;\n \n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[1000];\nint Counter;\nint Ans[1000];\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n for (i=0; i<K; i++) F[i] = 0;\n F[K] = 1;\n F[K+1] = 1;\n for (i=K+2; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-K-1];\n i--;\n i--;\n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[100];\nint Counter;\nint Ans[100];\nint k;\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n F[0] = 0;\n F[1] = 1;\n F[2] = 1;\n \n k=K;\n if (k>60) k = 60;\n \n for (i=3; F[i-1]<(1<<(k-1)); i++) F[i] = 1<<(i-2);\n \n for ( ; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-k-1];\n i--;\n i--;\n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint S, K, i;\nlong long int F[100];\nint Counter;\nint Ans[100];\n\nint main(){\n while(~scanf(\"%d%d\", &S, &K)){\n F[0] = 0;\n F[1] = 1;\n F[2] = 1;\n \n for (i=3; F[i-1]<(1<<(K-1)); i++) F[i] = 1<<(i-2);\n \n for ( ; F[i-1]<S; i++) F[i] = 2*F[i-1] - F[i-K-1];\n i--;\n i--;\n Counter = 0;\n while(i){\n if (S==0) break;\n if (F[i]>S){\n i--;\n continue;\n }\n Ans[Counter] = F[i];\n Counter++;\n S -= F[i];\n i--;\n }\n printf(\"%d\\n\", Counter);\n printf(\"%d\", Ans[0]);\n for (i=1; i<Counter; i++) printf(\" %d\", Ans[i]);\n putchar(10);\n }\n \n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nll a[35],h[35];\nint main()\n{\n ll n,m,i,j=1,k=1,l=0;\n scanf(\"%lld%lld\",&m,&n);\n a[0]=1;\n for(i=1;i<35;++i)\n {\n if(i<=n)\n a[i]=k,k*=2;\n else\n {\n for(j=i-1;j>=i-n;--j)\n a[i]+=a[j];\n }\n }\n for(i=34;i>=0;--i)\n {\n if(m>=a[i])\n {\n m-=a[i];\n ++l;\n h[i]=1;\n }\n if(m==0)\n {\n if(l==1)\n {\n printf(\"2\\n0 \");\n for(j=0;j<35;++j)\n if(h[j])\n printf(\"%lld\",a[j]);\n }\n else\n {\n printf(\"%lld\\n\",l);\n for(j=0;j<35;++j)\n {\n if(h[j])\n printf(\"%lld \",a[j]);\n }\n }\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{int i,j,a[100005]={0},*s,k,n,m,t=100005;\ns=(int*)calloc(t,sizeof(int));\nscanf(\"%d%d\",&n,&k);\na[0]=0;a[1]=1;a[2]=1;\nfor(i=3;i<k+1;i++)\na[i]=2*a[i-1];\nfor(i=k+1;a[i-1]<=n;i++)\n{a[i]=2*a[i-1]-a[i-k-1];\n}\na[i-1]=0;j=i-2;\nint l=0;\nwhile(j>=0)\n{if(n-a[j--]>=0)\n{\n n-=a[j+1];\n s[l++]=a[j+1];\n}\n\n}\nprintf(\"%d\\n\",l);\nfor(i=0;i<l;i++)\nprintf(\"%d \",s[i]);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define N 50\ntypedef long long ll;\nll f[N];\nint main(void)\n{\n int s,k;\n int i,j,ct=0;\n ll ans[N];\n scanf(\"%d%d\",&s,&k);\n f[0]=f[1]=1;\n f[2]=2;\n for(i=3;i<N;i++)\n {\n if(i>=k+1)\n f[i]=2*f[i-1]-f[i-k-1];\n else for(j=i-1;j>=max(i-k,0);j--)\n f[i]+=f[j];\n }\n for(i=N-1;i>0;i--)\n {\n if((s>=f[i]))\n {\n s-=f[i];\n ans[ct++]=f[i];\n }\n if(s==0)\n {\n if(ct==1){\n printf(\"%d\\n\",ct+1);\n printf(\"0 \");\n }\n for(i=0;i<ct;i++)\n printf(\"%I64d%c\",ans[i],i==ct-1?'\\n':' ');\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define N 50\ntypedef long long ll;\nll f[N];\nint main(void)\n{\n int s,k;\n int i,j,ct=0;\n ll ans[N];\n scanf(\"%d%d\",&s,&k);\n f[0]=f[1]=1;\n f[2]=2;\n for(i=3;i<N;i++)\n {\n if(i>=k+1)\n f[i]=2*f[i-1]-f[i-k-1];\n else for(j=i-1;j>=max(i-k,0);j--)\n f[i]+=f[j];\n }\n for(i=N-1;i>0;i--)\n {\n if((s>f[i])||(s==f[i]&&ct))\n {\n s-=f[i];\n ans[ct++]=f[i];\n }\n if(s==0)\n {\n printf(\"%d\\n\",ct);\n for(i=0;i<ct;i++)\n printf(\"%I64d%c\",ans[i],i==ct-1?'\\n':' ');\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint s,k,t,x;\nint memo[9999],ans,c[9999],p;\n\nint make_k_bonacci(int k){\n int i,j;\n memo[k] = 1;\n for(i=k+1;;i++){\n for(j=1;j<=k;j++){\n memo[i] += memo[i-j];\n if(memo[i]<0) return i;\n }\n }\n}\n\nmain(){\n scanf(\"%d%d\",&s,&k);\n t=k;\n if(k>=32){\n x = __builtin_popcount(s);\n if(x==1){\n printf(\"2\\n0 %d\\n\",s);\n return 0;\n }\n printf(\"%d\\n\",x);\n while(s){\n t=s&-s;\n printf(\"%d \",t);\n s^=t;\n }\n puts(\"\");\n return 0;\n }\n int z = make_k_bonacci(k);\n t=s;\n while(z--&&s){\n if(s>=memo[z]&&memo[z]!=t){\n ans++;\n c[p++]=memo[z];\n s-=memo[z];\n }\n }\n printf(\"%d\\n\",ans);\n while(p--)printf(\"%d \",c[p]);\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint s,k,t,x;\n\nmain(){\n scanf(\"%d%d\",&s,&k);\n t=k;\n x = __builtin_popcount(s);\n if(x==1){\n printf(\"2\\n0 %d\\n\",s);\n return 0;\n }\n printf(\"%d\\n\",x);\n while(s){\n t=s&-s;\n printf(\"%d \",t);\n s^=t;\n }\n puts(\"\");\n return 0;\n}\n"}], "src_uid": "da793333b977ed179fdba900aa604b52"} {"nl": {"description": "You have n problems. You have estimated the difficulty of the i-th one as integer ci. Now you want to prepare a problemset for a contest, using some of the problems you've made.A problemset for the contest must consist of at least two problems. You think that the total difficulty of the problems of the contest must be at least l and at most r. Also, you think that the difference between difficulties of the easiest and the hardest of the chosen problems must be at least x.Find the number of ways to choose a problemset for the contest.", "input_spec": "The first line contains four integers n, l, r, x (1\u2009\u2264\u2009n\u2009\u2264\u200915, 1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009109, 1\u2009\u2264\u2009x\u2009\u2264\u2009106) \u2014 the number of problems you have, the minimum and maximum value of total difficulty of the problemset and the minimum difference in difficulty between the hardest problem in the pack and the easiest one, respectively. The second line contains n integers c1,\u2009c2,\u2009...,\u2009cn (1\u2009\u2264\u2009ci\u2009\u2264\u2009106) \u2014 the difficulty of each problem.", "output_spec": "Print the number of ways to choose a suitable problemset for the contest. ", "sample_inputs": ["3 5 6 1\n1 2 3", "4 40 50 10\n10 20 30 25", "5 25 35 10\n10 10 20 10 20"], "sample_outputs": ["2", "2", "6"], "notes": "NoteIn the first example two sets are suitable, one consisting of the second and third problem, another one consisting of all three problems.In the second example, two sets of problems are suitable \u2014 the set of problems with difficulties 10 and 30 as well as the set of problems with difficulties 20 and 30.In the third example any set consisting of one problem of difficulty 10 and one problem of difficulty 20 is suitable."}, "positive_code": [{"source_code": "#include<stdio.h>\n\nint a[20];\n\nint main()\n{\n\t\tint n,l,r,x;\n\n\t\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\n\t\tint i;\n\t\tint ans=0;\n\t\tfor( i=0 ; i<n ; i++ )\n\t\t\t\tscanf(\"%d\",&a[i]);\n\n\t\tfor( i=2 ; i < (1<<n) ; i++ )\n\t\t{\n\t\t\t\tint min=1000006;\n\t\t\t\tint max=0;\n\t\t\t\tint sum=0;\n\t\t\t\tint j=i;\n\t\t\t\tint count=1;\n\t\t\t\twhile( j!=0 )\n\t\t\t\t{\n\t\t\t\t\t\tif( j%2==1 )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsum+=a[n-count];\n\t\t\t\t\t\t\t\tif( min > a[n-count])\n\t\t\t\t\t\t\t\t\t\tmin=a[n-count];\n\t\t\t\t\t\t\t\tif( max < a[n-count])\n\t\t\t\t\t\t\t\t\t\tmax=a[n-count];\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tj=j/2;\n\t\t\t\t}\n\t\t\t\tif( max-min >= x && sum<=r && sum>=l )\n\t\t\t\t\t\tans++;\n\t\t}\n\t\tprintf(\"%d\\n\",ans);\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid print(int *a,int n){\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint a[20];\nint x,l,r;\nint check(int i)\n{\n\tint max=0,min=10000006,sum=0,j=0;\n\twhile(i>0)\n\t{\n\t\tif((i&1)==1){\n\t\t\tsum+=a[j];\n\t\t\tif(max<a[j])\n\t\t\t\tmax=a[j];\n\t\t\tif(min>a[j])\n\t\t\t\tmin=a[j];\n\t\t}\n\t\ti=(i>>1);\n\t\tj++;\n\t}\n\tif(max-min<x)\n\t\treturn 0;\n\tif(sum<l||sum>r)\n\t\treturn 0;\t\t\nreturn 1;\n}\nint main()\n{\n\tint n,ans=0,i;\n\tscanf(\"%d %d %d %d\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=3;i<(1<<n);i++)\n\t{\n\t\tif(check(i))\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,l,r,x,a[20],ans=0,state=0;\nvoid func(int k,int d,int e,int h,int t)\n{\n\tif(k==n)\n\t{\n\t\tif(h-e>=x && d>=l && d<=r && t>1)\n\t\t{\n\t\t\tans++;\n\t\t\t//\tprintf(\"%d %d %d %d\\n\",t,d,e,h);\n\t\t}\n\t\treturn;\n\t}\n\tif(state==0)\n\t{\n\t\tstate=1;\n\t\tfunc(k+1,d+a[k],a[k],a[k],t+1);\n\t\tstate=0;\n\t\tfunc(k+1,d,e,h,t);\n\t}\n\telse\n\t{\n\t\tif(a[k]<e)\n\t\t{\n\t\t\tfunc(k+1,d+a[k],a[k],h,t+1);\n\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t\telse if(a[k]>h)\n\t\t{\n\t\t\tfunc(k+1,d+a[k],e,a[k],t+1);\n\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfunc(k+1,d+a[k],e,h,t+1);\n\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t}\n\treturn;\n}\nint main()\n{\n\tint i;\n\tscanf(\"%d %d %d %d\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfunc(0,0,0,0,0);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong ans,l,r,x;\n\nvoid powerset(long a[],int n)\n{\n\tlong powersize=pow(2,n),c,bit,sum;\n\tans=0;\n\tlong int counter,j,min,max;\n\tfor(counter=1;counter<powersize;counter++)\n\t{\n\t\tc=counter;\n\t\tsum=0,min=100000009,max=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tbit=c%2;\n\t\t\tc=c/2;\n\t\t\tif(bit==1)\n\t\t\t{\n\t\t\t\t//printf(\"%ld \",a[j]);\n\t\t\t\tsum+=a[j];\n\t\t\t\tif(a[j]>max)\n\t\t\t\tmax=a[j];\n\t\t\t\tif(a[j]<min)\n\t\t\t\tmin=a[j];\n\t\t\t}\n\t\t}\n\t\tif(sum>=l&&sum<=r&&max-min>=x)\n\t\tans++;\n\t\t//printf(\"\\n\");\n\t}\n}\n\nint main()\n{\n\t int n,i;\n\t long a[15];\n\t scanf(\"%d%ld%ld%ld\",&n,&l,&r,&x);\n\t for(i=0;i<n;i++) \n\t scanf(\"%ld\",&a[i]);\n\t powerset(a,n); \n\t printf(\"%ld\",ans);\n\t return 0; \n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nu R,N[22],n,l,r,d;\nvoid F(u min,u max,u sum,u sel,u deep,u new)\n{\n\tif(new&&sel>1&&max-min>=d&&sum>=l&&sum<=r)++R;\n\tif(deep==n||sum>r)return;\n\tF(min,max,sum,sel,deep+1,0);\n\tF(min>N[deep]?N[deep]:min,max<N[deep]?\n\tN[deep]:max,sum+N[deep],sel+1,deep+1,1);\n\treturn;\n}\nint main()\n{\n\tu i=-1;\n\tfor(scanf(\"%u%u%u%u\",&n,&l,&r,&d);++i<n;scanf(\"%u\",N+i));\n\tF(-1,0,0,0,0,0);printf(\"%u\\n\",R);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint count=0;\nint cmpfunc (const void * a, const void * b){\n return ( *(int*)a - *(int*)b );\n}\nvoid combinationUtil(int arr[],int n,int r,int index,int data[],int i,int m,int l,int x);\nvoid printCombination(int arr[],int n,int r,int m,int l,int x){\n int data[r];\n combinationUtil(arr,n,r,0,data,0,m,l,x);\n}\nvoid combinationUtil(int arr[],int n,int r,int index,int data[],int i,int m,int l,int x){\n int j;\n if(index==r){\n int max=data[0],min=data[0],sum=0;\n for(j=0;j<r;j++){\n sum+=data[j];\n if(data[j]>max) max=data[j];\n else if(data[j]<min) min=data[j];\n }\n if(sum<=m && sum>=l && (max-min)>=x) count++;\n return;\n }\n if(i>=n) return;\n data[index]=arr[i];\n combinationUtil(arr,n,r,index+1,data,i+1,m,l,x);\n combinationUtil(arr,n,r,index,data,i+1,m,l,x);\n}\nint main(){\n int n,l,r,x;\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int c[n],i;\n for(i=0;i<n;i++) scanf(\"%d\",&c[i]);\n qsort(c, n, sizeof(int), cmpfunc);\n for(i=2;i<=n;i++) printCombination(c,n,i,r,l,x);\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <math.h>\nint comp (const void * elem1, const void * elem2) \n{\n int f = *((int*)elem1);\n int s = *((int*)elem2);\n if (f > s) return 1;\n if (f < s) return -1;\n return 0;\n}\nint main(void)\n{\nint n,l,r,x,i,j,c=0,f=0;\nscanf(\"%d %d %d %d\",&n,&l,&r,&x);\nint a[15];\nfor(i=0;i<n;i++)\nscanf(\"%d\",&a[i]);\nqsort (a,n, sizeof(int), comp);\nint s=pow(2,n)-1;\nint s1=0,d=0,max=0,min=0,count=0;\nfor(i=3;i<=s;i++)\n{\nj=i;c=0;f=0;s1=0;\n\t\t\twhile(j>0)\n\t\t\t{\n\t\t\t\td=j%2;\n\t\t\t\tif(d==1)\n\t\t\t\t{\n\t\t\t\tf++;\n\t\t\t\ts1=s1+a[c];\n\t\t\t\tif(f==1)\n\t\t\t\tmin=a[c];\n\t\t\t\tif(j/2==0)\n\t\t\t\tmax=a[c];\n\t\t\t\t}\n\t\t\t\tc++;\n\t\t\t\tj=j/2;\n\t\t\t}\n\t\t\tif(((max-min)>=x)&&(s1>=l)&&(s1<=r))\n\t\t\tcount++;\n}\nprintf(\"%d\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,l,r,x;\nvoid PowerSet(int *set, int set_size)\n{\n unsigned int pow_set_size = pow(2, set_size);\n int counter, j,ar[set_size],cnt=0,ind,sum,i,max,min;\n for(counter = 0; counter < pow_set_size; counter++)\n { ind=0;\n for(j = 0; j < set_size; j++)\n {\n if(counter & (1<<j))\n ar[ind++]=set[j];\n }\n sum=0;\n min=1000000002;\n max=-1;\n for(i=0;i<ind;i++)\n {\n \n if(min>ar[i])\n min=ar[i];\n if(max<ar[i])\n max=ar[i]; \n sum+=ar[i];\n }\n if(max-min>=x && sum>=l && sum<=r)\n cnt++;\n \n }\n printf(\"%d\\n\",cnt);\n}\n\nint main()\n{\n \n int a[20],i;\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n PowerSet(a, n);\n\n//scanf(\"%d\",&i);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint is_good(int *flags, int *c, int n, int l, int r, int x)\n{\n int i=0;\n int count_tasks=0;\n while(!flags[i])\n {\n i++;\n }\n int min=c[i], max=min;\n int summary=0;\n for( i=0; i<n; i++)\n {\n if (flags[i])\n {\n count_tasks++;\n if (c[i]>max) max=c[i];\n if (c[i]<min) min=c[i];\n summary+=c[i];\n }\n }\n if ( (count_tasks>1)&&(max-min>=x)&&(summary>=l)&&(summary<=r) )\n return 1;\n else\n return 0;\n}\n\nint exp_x(int x, int pow)\n{\n int k=1;\n while(pow)\n {\n k*=x;\n pow--;\n }\n return k;\n}\n\nvoid ten_to2arr(int n, int *arr)\n{\n int i=0;\n while (n>0)\n {\n arr[i]=n%2;\n n/=2;\n i++;\n }\n}\n\nint answer(FILE *f)\n{\n int i,j;\n int n, l, r, x;\n fscanf(f,\"%d %d %d %d\",&n, &l, &r, &x);\n if (n<2) return 0;\n int *c=(int *)calloc(n, sizeof(int));\n\n for ( i=0; i<n; i++)\n fscanf(f,\"%d\",&c[i]);\n\n // get input\n int max=exp_x(2,n);\n int *flags=(int *)calloc(n, sizeof(int));\n int COUNT=0;\n for (i=0; i<max; i++)\n {\n ten_to2arr(i, flags);\n if (is_good(flags, c, n, l, r, x))\n COUNT++;\n }\n free(flags);\n free(c);\n return COUNT;\n}\n\nint main(int argc, char* argv[])\n{\n int count;\n FILE *f=fopen(\"test2.txt\",\"r\");\n //count=answer(f);\n count=answer(stdin);\n FILE *o=fopen(\"Output.txt\",\"w\");\n fprintf(o,\"%d\",count);\n printf(\"%d\",count);\n fclose(o);\n fclose(f);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nvoid fn(int a[],int index,int n,int min,int max,int sum,int sum_min,int sum_max,int min_diff,int *ans)\n{\n\tif(index<n)\n\t{\n\t\tfn(a,index+1,n,min,max,sum,sum_min,sum_max,min_diff,ans);\n\t\t\n\t\tsum = sum + a[index];\n\t\tmax = a[index];\n\t\tif(sum>=sum_min && sum<=sum_max && (max-min)>=min_diff)\n\t\t\t*ans = *ans + 1;\n\t\tfn(a,index+1,n,min,max,sum,sum_min,sum_max,min_diff,ans);\n\t}\n}\n\nint main()\n{\n\tint n,l,r,x;\n\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\tint a[n];\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint j;\n\tfor(i=0;i<n;i++)\n\t\tfor(j=i+1;j<n;j++)\n\t\t\tif(a[i]>a[j])\n\t\t\t{\n\t\t\t\tint temp=a[i];\n\t\t\t\ta[i]=a[j];\n\t\t\t\ta[j]=temp;\n\t\t\t}\n\n\tint ans = 0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfn(a,i+1,n,a[i],0,a[i],l,r,x,&ans);\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint i=0,mark=1,counter=0,bla=2,j=0,tmp=0,min,max,score,ones;\n\tint n;\n\tlong l,r,x;\n\tchar *string,*ptr;\n\tchar del = ' ';\n\tint *ptr1,*ptr2;\n\n\tscanf(\"%d%ld%ld%ld\",&n,&l,&r,&x);\n\n\twhile((getchar()) != '\\n');\n\n\tint problems[n];\n\n\tstring = malloc(n*sizeof(char)*1000000+2);\n\tfgets(string,n*sizeof(char)*1000000+2,stdin);\n\n\tptr = strtok(string,&del);\n while(ptr != NULL){\n problems[i++]=atoi(ptr);\n ptr = strtok(NULL,&del);\n }\n\n\twhile(mark){\n\t\tmark = 0;\n\t\tfor(ptr1 = &problems[0],ptr2 = &problems[1];ptr2 < &problems[0]+n;ptr1++,ptr2++){\n\t\t\tif(*ptr1 > *ptr2){\n\t\t\t\t*ptr1 = *ptr1 + *ptr2;\n\t\t\t\t*ptr2 = *ptr1 - *ptr2;\n\t\t\t\t*ptr1 = *ptr1 - *ptr2;\n\t\t\t\tmark = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=n-1;i>0;i--){\n\t\tbla = bla * 2;\n\t}\n\n\tfor(i=0;i<=bla;i++){\n\t\tscore = 0;\n\t\tmark = 0;\n\t\ttmp = i;\n\t\tones = 0;\n\t\tfor(j=0;j<n;j++){\n\t\t\tif(tmp%2){\n\t\t\t\tones++;\n\t\t\t\tif(mark == 0){\n\t\t\t\t\tmin=problems[j];\n\t\t\t\t\tmark = 1;\n\t\t\t\t}\n\t\t\t\tscore = score + problems[j];\n\t\t\t}\n\t\t\ttmp = tmp / 2;\n\t\t\tif(tmp == 0){\n\t\t\t\tmax=problems[j];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(ones > 1){\n\t\t\tif(score >= l && score <= r && max-min >= x)counter++;\n\t\t}\n\t}\n\n\tprintf(\"%d\",counter);\n\tfree(string);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<limits.h>\n#include<math.h>\n#include<string.h>\n\nint cmp ( const void *p, const void *q)\n{\n\tint l = *(const int *)p;\n\tint r = *(const int *)q;\n\treturn l-r;\n}\n\nint po(int n)\n{\n\tint ans=1;\n\tint base=2;\n\twhile(n>0)\n\t{\n\t\tif(n%2==1)\n\t\t\tans=ans*base;\n\t\tn = n>>1;\n\t\tbase = base*base;\n\t}\n\treturn ans;\n}\n\nint main()\n{\n\tint n,l,r,x,a[16],p,i,min,max,sum,count,bit[16]={0};\n\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\tqsort(a,n,sizeof(int),cmp);\n\tp=0;\n\ti=2;\n\tsum=0;\n\tcount=0;\n\tint ran = po(n);\n\tint num=0;\n\tint z,k;\n\tfor(i=3;i<=ran;i++)\n\t{\n\t\tz=i;\n\t\tp=0;\n\t\tmax=0;\n\t\tnum=0;\n\t\tsum=0;\n\t\tmin=9999999;\n\t\twhile(z>0)\n\t\t{\n\t\t\tbit[p++]=z%2;\n\t\t\tz=z/2;\n\t\t}\n\t\tfor(k=0;k<p && k <=n;k++)\n\t\t{\n//\t\t\tprintf(\"%d\",bit[k]);\n\t\t\tif(bit[k]==1)\n\t\t\t{\n\t\t\t\tsum+=a[k];\n\t\t\t\tnum++;\n\t\t\t\tif(a[k]>max)\n\t\t\t\t\tmax=a[k];\n\t\t\t\tif(a[k]<min)\n\t\t\t\t\tmin=a[k];\n\n\t\t\t}\n\t\t}\n//\t\tprintf(\"\\nsum: %d max: %d min : %d\\n\",sum,max,min);\n\n\t\tif(num>=2 && sum >= l && sum <= r && max - min>=x)\n\t\t\tcount++;\n\t\t\n\n\t\t\n\n\t}\n\n\t\t\t\t\nprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint comp(const void *elem1,const void *elem2)\n{\n int f=*((int*)elem1);\n int s=*((int*)elem2);\n if(f>s)return 1;\n if(f<s)return -1;\n return 0;\n}\n\nint main(void)\n{ int i,n,l,r,x,c[15];\n scanf(\"%d %d %d %d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%d \",&c[i]);\n qsort(c,n,sizeof(int),comp);\n int s=pow(2,n),a=0,j,max=0,min=0,z=0,c1[15],sum=0;\n for(i=0;i<15;i++)\n c1[i]=0;\n for(i=2;i<s;i++)\n { a=i,sum=0,max=0,min=0;\n for(j=n-1;j>=0;j--)\n {\n c1[j]=a%2;\n a=a/2;\n if((max==0)&&(c1[j]==1))\n max=j;\n if(c1[j]==1)\n min=j;\n }\n if(c[max]-c[min]>=x)\n {\n for(j=0;j<n;j++)\n if(c1[j]==1)\n sum=sum+c[j];\n if((sum<=r)&&(sum>=l))\n z++;\n }\n }\n\n printf(\"%d\",z);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nchar s[100001];\n\nint main()\n{\n\n\tint s,sm,c,jh,n,l,r,x,i,j,h;\n\tscanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tint a[n];\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tc=0;\n\tint k=1<<n;\n\tfor(i=3;i<k;i++)\n\t{\n\t\ts=0;\n\t\th=-1;\n\t\tsm=1000001;\n\t\tfor(j=0;j<=n;j++)\n\t\t{\n\t\t\tif((i>>j)&1)\n\t\t\t{\n\t\t\t\tif(a[j]>h)\n\t\t\t\t\th=a[j];\n\t\t\t\tif(a[j]<sm)\n\t\t\t\t\tsm=a[j];\n\t\t\t\ts+=a[j];\n\t\t\t}\n\t\t}\n\t\tif((h-sm)>=x&&(s>=l)&&(s<=r))\n\t\t{\n\t\t\tc++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "/*\n * Assignment - NCTU DCS CP\n * ========================\n * Student ID : CS 0316218\n * GCC Option : -ansi -Wall -Wextra -pedantic\n * GCC Linker : -lc\n */\n\n#include<stdio.h>\n#include<stdlib.h>\n\nint n, l, r, x;\nint count = 0;\nint problem_str[16], dedicated_str[16];\n\nvoid permutation(int, int, int);\nint summation(int);\nint difference(int);\n\nint main(void)\n{\n scanf(\"%d %d %d %d\", &n, &l, &r, &x);\n\n {\n int i;\n\n for (i = 0; i < n; i++)\n scanf(\"%d\", &problem_str[i]);\n }\n\n {\n int i;\n\n for (i = 2; i <= n; i++)\n permutation(-1, 1, i);\n }\n\n printf(\"%d\", count);\n\n return 0;\n}\n\nvoid permutation(int pos, int depth, int max_depth)\n{\n if (pos >= n)\n return;\n\n if (depth == max_depth + 1)\n {\n int sum = summation(max_depth);\n int dif = difference(max_depth);\n\n if (l <= sum && sum <= r && dif >= x)\n count++;\n }\n else if (depth <= max_depth)\n {\n int i;\n\n for (i = pos + 1; i < n; i++)\n {\n dedicated_str[depth - 1] = problem_str[i];\n permutation(i, depth + 1, max_depth);\n }\n }\n}\n\nint summation(int length)\n{\n int i, sum = 0;\n\n for (i = 0; i < length; i++)\n sum += dedicated_str[i];\n\n return sum;\n}\n\nint difference(int length)\n{\n int i, min = dedicated_str[0], max = dedicated_str[0];\n\n for (i = 0; i < length; i++)\n {\n if (min > dedicated_str[i])\n min = dedicated_str[i];\n if (max < dedicated_str[i])\n max = dedicated_str[i];\n }\n\n return (max - min);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nvoid check(int a[],int b[],int n,int l,int r,int x,int* count)\n{\n int i,c[20],m=0,count2=0;\n for(i=0;i<n;i++)\n if(b[i]==1)\n {\n c[m++]=a[i];\n count2+=a[i];\n }\n if(count2>=l && count2<=r && c[m-1]-c[0]>=x)\n (*count)++;\n return;\n}\n\nvoid superset(int a[],int b[],int n,int idx,int l,int r,int x,int* count)\n{\n if(idx==n)\n {\n check(a,b,n,l,r,x,count);\n return;\n }\n b[idx]=1;\n superset(a,b,n,idx+1,l,r,x,count);\n b[idx]=0;\n superset(a,b,n,idx+1,l,r,x,count);\n return;\n}\n\nint main()\n{\n int n,l,r,x,a[20],b[20]={0},i,j,temp,count=0;\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n superset(a,b,n,0,l,r,x,&count);\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define fr(i,n) for(i=0;i<n;i++)\n#define frw(i,a,b) for(i=a;i<b;i++)\nint power(int a,int b)\n{\nif(b==0)\nreturn 1;\nint k=power(a,b/2);\nk=k*k;\nif(b&1) k*=a;\nreturn k;\n}\nint arr[100]={0};\nmain()\n{\nint n,l,r,x,i,j,k,min,max;long long int sum;\nscanf(\"%d %d %d %d\",&n,&l,&r,&x);\nfr(i,n)\nscanf(\"%d\",&arr[i]);\nint g=power(2,n);\n//printf(\"%d\",g);\nint count=0;\n fr(i,g)\n {\n min=-1;\n max=-1;\n sum=0;\n \n k=1;\n fr(j,n)\n {\n if(i & k)\n {\n sum+=arr[j];\n if(min==-1 || arr[min]>arr[j])\n min=j;\n if(max==-1 || arr[max]<=arr[j])\n max=j;\n }\n k<<=1; \n }\n if(min!=-1 && max!=-1 && min!=max && arr[max]-arr[min]>=x && sum>=l && sum<=r){count++;} \n }\nprintf(\"%d\\n\",count);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nint n,l,r,x,i,j,maxx,minn;\nint a[16];\nlong int sum=0,cnt=0;\nscanf(\"%d%d%d%d\",&n,&l,&r,&x);\nfor(i=0;i<n;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<pow(2,n);i++)\n {\n maxx=0,minn=1000001;\n sum=0;\n\n for(j=0;j<n;j++)\n {\n if((i&1<<j))\n {\n sum+=a[j];\n if(maxx<a[j]){\n maxx=a[j];\n }\n if(minn>a[j]){\n minn=a[j];\n }\n }\n\n }\n if(sum>=l && sum<=r){\n if((maxx-minn)>=x)\n {\n cnt++;\n }\n }\n\n }\n\nprintf(\"%d\\n\",cnt);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, l, r, x, ar[15];\n\nint main(){\n int i, j, k, bitmask, y, z, sum, min, max, lim, counter, res;\n\n while (scanf(\"%d %d %d %d\", &n, &l, &r, &x) != EOF){\n lim = (1 << n) - 1;\n for (i = 0; i < n; i++) scanf(\"%d\", &ar[i]);\n\n counter = 0;\n for (bitmask = 1; bitmask <= lim; bitmask++){\n if (__builtin_popcount(bitmask) < 2) continue;\n\n sum = 0, min = 1 << 20, max = 0;\n for (i = 0; i < n; i++){\n if (bitmask & (1 << i)){\n sum += ar[i];\n if (ar[i] < min) min = ar[i];\n if (ar[i] > max) max = ar[i];\n }\n }\n\n if ((sum >= l) && (sum <= r) && (max - min) >= x){\n counter++;\n }\n }\n\n printf(\"%d\\n\", counter);\n }\n return 0;\n}\n"}, {"source_code": "/* Problem: 550B - Preparing Olympiad */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned short n;\n unsigned int l;\n unsigned int r;\n unsigned int x;\n unsigned short i;\n unsigned int c[15];\n unsigned short slx;\n unsigned short an;\n unsigned short m;\n unsigned short oc;\n unsigned int sc;\n unsigned int cmx;\n unsigned int cmn;\n unsigned short j;\n \n if (scanf(\"%hu %u %u %u\",&n,&l,&r,&x) != 4)\n return -1;\n if (n < 1 || n > 15)\n return -1;\n if (l < 1 || l > 1000000000 || r < 1 || r > 1000000000 || x < 1 || x > 1000000)\n return -1;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%u\",&c[i]) != 1)\n return -1;\n if (c[i] < 1 || c[i] > 1000000)\n return -1;\n }\n slx = 1;\n for (i = 0; i < n; i++)\n slx *= 2;\n an = 0;\n for (i = 3; i < slx; i++)\n {\n m = 1;\n oc = 0;\n sc = cmx = 0;\n cmn = 1000001;\n for (j = 0; j < n; j++)\n {\n if (i & m)\n {\n oc++;\n sc += c[j];\n if (c[j] < cmn)\n cmn = c[j];\n if (c[j] > cmx)\n cmx = c[j];\n }\n m <<= 1;\n }\n if (oc > 1 && sc >= l && sc <= r && cmx-cmn >= x)\n an++;\n }\n printf (\"%hu\\n\",an);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint comp(const void*a,const void *b);\nvoid dfs(int min,int max,int sum,int k);\nint n,l,r,x;\nint ans=0;\nint pro[100000];\nint main(){\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i,j;\n for(i=0;i<n;i++)\n scanf(\"%d\",&pro[i]);\n qsort((void*)pro,i,sizeof(int),comp);\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n dfs(pro[i],pro[j],pro[i]+pro[j],j+1);\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\nint comp(const void*a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\nvoid dfs(int min,int max,int sum,int k){\n if(sum>r)\n return;\n int i;\n if(sum>=l&&sum<=r&&max-min>=x)\n ans++;\n for(i=k;i<n;i++)\n dfs(min,pro[i],sum+pro[i],i+1);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint n, l, r, x, c[16];\nint ans;\n\nint compare(const void* a, const void* b) {\n\treturn (*(int*)a - *(int*)b);\n}\nvoid solve(int idx, int sum, int min, int max, int cnt);\n\nint main()\n{\n\tint i;\n\t\n\tscanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tfor(i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &c[i]);\n\t}\n\tqsort(c, n, sizeof(int), compare);\n\tans = 0;\n\tsolve(0, 0, 0, 0, 0);\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}\n\nvoid solve(int idx, int sum, int min, int max, int cnt) {\n\tif(idx == n) {\n\t\tif(cnt >= 2 && sum >= l && sum <= r && (max - min) >= x)\tans++;\n\t\treturn;\n\t}\n\tif(!min)\tsolve(idx + 1, sum + c[idx], c[idx], c[idx], cnt + 1);\n\telse\tsolve(idx + 1, sum + c[idx], min, c[idx], cnt + 1);\n\tsolve(idx + 1, sum, min, max, cnt);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int n,l,r,x,a[20],ans=0,i;\nlong long int cmpfunc (const void * a, const void * b)\n{\n return ( *(long long int*)a - *(long long int*)b );\n}\nvoid f(long long int min, long long int max, long long int s, long long int n1, long long int i)\n{\n if(i>=n)\n {\n // printf(\"%I64d %I64d %I64d %I64d %I64d\\n\",min,max,s,n1,i);\n\n if(n1>=2&&s>=l&&s<=r&&(max-min)>=x)\n {ans++;\n\n }\n }\n else if(!n1)\n {\n f(a[i],a[i],s+a[i],n1+1,i+1);\n f(min,max,s,n1,i+1);\n }\n else\n {\n f(min,a[i],s+a[i],n1+1,i+1);\n f(min,max,s,n1,i+1);\n }\n\n}\nint main()\n{\nscanf(\"%I64d %I64d %I64d %I64d\",&n,&l,&r,&x);\nfor(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\nqsort(a,n,sizeof(long long),cmpfunc);\nf(0,0,0,0,0);\nprintf(\"%I64d\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<malloc.h>\n\nint ways = 0;\nint *a, *b;\nint n, l, r, x;\n\nint cmp (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\ncal(int i)\n{\n\tif(i==n)\n\t{\n\t\tint j, k, no, sum;\n\t\t\n\t\tsum = 0;\n\t\tno = 0;\n\t\tfor(j=0; j<n; j++)\n\t\t{\n\t\t\tif(b[j] == 1)\n\t\t\t{\n\t\t\t\tsum += a[j];\n\t\t\t\tno++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(sum>=l && sum<=r && no>=2)\n\t\t{\n\t\t\tfor(j=0; b[j]==0; j++);\n\t\t\tfor(k=n-1; b[k]==0; k--);\n\t\t\t\n\t\t\tif(a[k]-a[j] >= x)\n\t\t\t\tways++;\n\t\t}\n\t}\n\t\n\telse\n\t{\n\t\tb[i] = 0;\n\t\tcal(i+1);\n\t\tb[i] = 1;\n\t\tcal(i+1);\n\t}\n}\n\nint main()\n{\n\tint i;\n\t\n\tscanf(\"%d %d %d %d\", &n, &l, &r, &x);\n\t\n\ta = (int *)malloc(sizeof(int)*n);\n\tfor(i=0; i<n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\t\n\tqsort(a, n, sizeof(int), cmp);\n\t\n\tb = (int *)malloc(sizeof(int)*n);\n\tfor(i=0; i<n; i++)\n\t\tb[i] = 0;\n\t\n\tb[0] = 0;\n\tcal(1);\n\tb[0] = 1;\n\tcal(1);\n\t\n\tprintf(\"%d\", ways);\n\t\n\tfree(a);\n\tfree(b);\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,l,r,x,i,j,k,row,count;\n\tscanf(\"%I64d %I64d %I64d %I64d\",&n,&l,&r,&x);\n\tlong long int arr[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%I64d\",&arr[i]);\n\t}\n\tj=(long long int)pow(2,n);\n\tk=j/2;\t\n\tint bit[j][n],flag=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tcount=0;\n\t\trow=0;\n\t\twhile(row<j)\n\t\t{\n\t\t\tif(flag==0)\n\t\t\t{\n\t\t\t\tbit[row][i]=0;\n\t\t\t\tcount++;\n\t\t\t\tif(count==k)\n\t\t\t\t{\n\t\t\t\t\tcount=0;\n\t\t\t\t\tflag=1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(flag==1)\n\t\t\t{\n\t\t\t\tbit[row][i]=1;\n\t\t\t\tcount++;\n\t\t\t\tif(count==k)\n\t\t\t\t{\n\t\t\t\t\tcount=0;\n\t\t\t\t\tflag=0;\n\t\t\t\t}\n\t\t\t}\n\t\t\trow++;\n\t\t}\n\t\tk/=2;\n\t}\n\tcount=0;\n\tlong long int sum,c1,min,max;\n\n\tfor(row=0;row<j;row++)\n\t{\n\t\tsum=0;\n\t\tc1=0;\n\t\tmax=0;\n\t\tflag=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(bit[row][i]==1)\n\t\t\t{\n\t\t\t\tsum+=arr[i];\n\t\t\t\tif(flag==0)\n\t\t\t\t{\n\t\t\t\t\tmin=arr[i];\n\t\t\t\t\tflag=1;\n\t\t\t\t}\n\t\t\t\tif(arr[i]<min)\n\t\t\t\t{\n\t\t\t\t\tmin=arr[i];\n\t\t\t\t}\n\t\t\t\tif(arr[i]>max)\n\t\t\t\t{\n\t\t\t\t\tmax=arr[i];\n\t\t\t\t}\n\t\t\t\tif(sum>r)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tc1++;\n\t\t\t}\n\t\t}\n\t\tif(sum>=l && sum<=r && c1>=2 && ((max-min)>=x))\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%I64d\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <string.h>\n\n\nint\tdarr[32];\n\nstatic int\ndo_ways(int N, long lo, long hi, int dif)\n{\n\tint \tans = 0;\n\tint\ti,j;\n\n\tfor (i = 0; i < (1 << N); i++) {\n\t\tint\th = 0;\n\t\tint\tl = INT_MAX;\n\t\tlong\tsum = 0L;\t\n\n\t\tfor (j = 0; j < N; j++) {\n\t\t\tif (i & (1 << j)) {\n\t\t\t\tsum = sum + darr[j];\n\n\t\t\t\tif (darr[j] > h) {\n\t\t\t\t\th = darr[j];\n\t\t\t\t}\n\n\t\t\t\tif (darr[j] < l ) {\n\t\t\t\t\tl = darr[j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (sum >= lo && sum <= hi) {\n\t\t\tif (h-l >= dif) {\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t}\n\treturn ans;\n}\n\nint main ()\n{\n\tint i, n, low, high, diff;\n\n\tscanf (\"%d%d%d%d\", &n, &low, &high, &diff);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &darr[i]);\n\t}\n\n\tprintf(\"%d\\n\", do_ways(n, low, high, diff));\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\nint cmpfunc(const void* a,const void* b)\n{\n\treturn *(int*)a-*(int*)b;\n}\nint n,l,r,x,arr[100],count=0;\nvoid func(int i)\n{\n\tint a[100],ans=0,j,f=0;\n\tfor(j=0;j<n;j++)\n\t{\n\t a[j]=i%2;\n\t i=i/2;\n\t}\n\tint first=0,last=n-1;\n\tfor(j=0;j<n;j++)\n\t{\n//\t\tprintf(\"%d \",a[j]);\n\t\tif(a[j]==1)\n\t\t{\n\t\tf++;\n\t\tans=ans+arr[j];\n\t\tlast=j;\n\t\t}\n\t}\n//\tprintf(\"\\n\");\n//\tprintf(\"ans is %d\\n\",ans);\n\tif(f>1)\n\t{\n\tfor(i=n-1;i>=0;i--)\n\t{\n\t\tif(a[i]==1)\n\t\tfirst=i;\n\t}\n\tif(ans>=l && ans<=r && arr[last]-arr[first]>=x)\n\tcount++;\n\t}\n\t\n}\nint main()\n{\n\tint i,j;\n\tscanf(\"%d %d %d %d\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t{\n\tscanf(\"%d\",&arr[i]);\n\t}\n\tqsort(arr,n,sizeof(int),cmpfunc);\n\tfor(i=0;i<=pow(2,n)-1;i++)\n\t{\n\t\tfunc(i);\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint n, i, cntp, t, crr, B[15];\n\tlong l, r, x, C[15], cnt, sum, min, max, num;\n\tscanf(\"%d %ld %ld %ld\", &n, &l, &r, &x);\n\tcnt = 1;\n\tfor(i = 0; i < n; i++) {\n\t\tscanf(\"%ld\", &C[i]);\n\t\tB[i] = 0;\n\t\tcnt *= 2;\n\t}\n\tcnt--;\n\tnum = 0;\n\twhile(cnt--) {\n\t\tsum = 0;\n\t\tmax = 0;\n\t\tmin = 1000001;\n\t\tcntp = 0;\n\t\tcrr = (B[0] + 1) / 2;\n\t\tB[0] = (B[0] + 1) % 2;\n\t\tif(B[0]) {\n\t\t\tcntp = 1;\n\t\t\tsum += C[0];\n\t\t\tmin = C[0];\n\t\t\tmax = C[0];\n\t\t}\n\t\tfor(i = 1; i < n; i++) {\n\t\t\tt = B[i];\n\t\t\tB[i] = (B[i] + crr) % 2;\n\t\t\tcrr = (crr + t) / 2;\n\t\t\tif(B[i]) {\n\t\t\t\tcntp++;\n\t\t\t\tsum += C[i];\n\t\t\t\tif(C[i] > max) {\n\t\t\t\t\tmax = C[i];\n\t\t\t\t}\n\t\t\t\tif(C[i] < min) {\n\t\t\t\t\tmin = C[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(cntp >= 2 && l <= sum && r >= sum && max - min >= x) {\n\t\t\tnum++;\n\t\t}\n\t}\n\tprintf(\"%ld\", num);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int max(long long int a, long long int b)\n{\n if(a>b) return a;\n else return b;\n}\nlong long int min(long long int a, long long int b)\n{\n if(a<b) return a;\n else return b;\n}\n\n\nint main()\n{\n long long int n, l, r, x, i, j, mx, mn,ans=0, sum=0;\n scanf(\"%lld %lld %lld %lld\", &n, &l, &r, &x);\n long long int aray[n];\n for(i=0;i<n;i++){\n scanf(\"%lld\", &aray[i]);\n }\n for(i=1;i<(1<<n);i++){\n sum=0;\n mx = 0;\n mn = 1000006;\n for(j=0;j<n;j++){\n if(i&(1<<j)){\n sum+=aray[j];\n mx=max(mx,aray[j]);\n mn=min(mn,aray[j]);\n }\n // printf(\"j:%lld i:%lld sum:%lld\\n\", j,i, sum);\n }\n //printf(\"%lld %lld\\n\", mx, mn);\n if(mx-mn>=x && sum>=l && sum<=r){\n ans++;\n }\n }\n printf(\"%lld \", ans);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 20\n#define Max(a,b) a>b?a:b\n#define Min(a,b) a<b?a:b\n\nint n,l,r,x,num;\nint c[MAXN],d[MAXN];\nchar vis[1<<20];\n\nvoid dfs(int state,int max,int min,int len,int sum)\n{\n int i,tmax,tmin,tsum;\n\n vis[state]=1;\n if(len>1&&sum>=l&&sum<=r&&max-min>=x)num++;\n if(len==n)return ;\n tmax=max;\n tmin=min;\n tsum=sum;\n for(i=0;i<n;i++)\n {\n if((state&d[i])==0)\n {\n if(len==0)\n {\n tmax=tmin=c[i];\n tsum=c[i];\n }\n else\n {\n tmax=Max(max,c[i]);\n tmin=Min(min,c[i]);\n tsum=sum+c[i];\n }\n if(tsum<=r&&!vis[state|d[i]])dfs(state+d[i],tmax,tmin,len+1,tsum);\n }\n }\n}\n\nint main()\n{\n int i;\n\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)scanf(\"%d\",&c[i]);\n d[0]=1;\n for(i=1;i<n;i++)d[i]=d[i-1]*2;\n num=0;\n dfs(0,0,0,0,0);\n printf(\"%d\\n\",num);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\ntypedef long long ll;\nint n,l,r,x,a[15],ans;\nint main(void) {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i,j,k;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int sub=(1<<n)-1;\n int tmp,min,max;\n //printf(\"%d\",sub);\n for(i=1;i<=sub;i++)\n { tmp=0;min=1000000000;max=0;\n for(j=0;j<n;j++)\n {\n if(i&(1<<j))\n { //printf(\"%d includes %d\\n\",i,j);\n tmp+=a[j]; \n if(a[j]<min)min=a[j];\n if(a[j]>max)max=a[j];\n }\n }\n ///puts(\"end\");\n if(tmp<=r && tmp>=l && (max-min)>=x)\n {\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint n,l,r,c[15],x;\n\nint check(int Mask)\n{\n\tint NoOfProblem=0,Max=0,Min=1000001,Sum=0,j=Mask,i;\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif (j%2==1)\n\t\t{\n\t\t\tNoOfProblem++;\n\t\t\tMax=Max>c[i]?Max:c[i];\n\t\t\tMin=Min<c[i]?Min:c[i];\n\t\t\tSum+=c[i];\n\t\t}\n\t\tj/=2;\n\t}\n\tif ((NoOfProblem>=2)&&(Sum>=l)&&(Sum<=r)&&(Max-Min>=x))\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main()\n{\n\tint i,count=0;\n\tscanf(\" %d%d%d%d\",&n,&l,&r,&x);\n\tfor (i=0;i<n;i++)\n\t\tscanf(\" %d\",&c[i]);\n\tfor (i=0;i<1<<n;i++)\n\t\tcount+=check(i);\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n;\n long l,r,x,pows,counter,max,min,ans,i,s,ct,j;\n long arr[20];\n scanf(\"%d %ld %ld %ld\",&n,&l,&r,&x);\n for(i=0; i<n; i++)\n {\n scanf(\"%ld\",&arr[i]);\n }\n pows=pow(2,n);\n ans=0;\n for(counter = 0; counter < pows; counter++)\n {\n s=0; ct=0; min=1000000001; max=-1;\n for(j = 0; j < n; j++)\n {\n if(counter & (1<<j))\n {\n if(arr[j]>max)\n max=arr[j];\n if(arr[j]<min)\n min=arr[j];\n ct++;\n s=s+arr[j]; \n } \n }\n if(ct>1)\n {\n if(s>=l && s<=r)\n {\n if((max-min)>=x)\n {\n ans++;\n }\n }\n }\n \n }\n printf(\"%ld\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\nint main()\n{\n long long int n,l,r,x,i,a[20],sum,high,low,choosen,ans,t,j;\n scanf(\"%lld %lld %lld %lld\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&a[i]);\n }\n t=1;\n for(i=0;i<n;i++)\n {\n t=t*2;\n }\n ans=0;\n //printf(\"%lld \",t);\n for(i=0;i<t;i++)\n {\n choosen=0;\n sum=0;\n high=INT_MIN;\n low=INT_MAX;\n for(j=0;j<n;j++)\n {\n if(i&(1<<j))\n {\n sum=sum+a[j];\n if(a[j]>high)\n high=a[j];\n if(a[j]<low)\n low=a[j];\n choosen++;\n }\n }\n //printf(\"%lld %lld %lld\\n\",i,sum,choosen);\n if(choosen>1&&(high-low>=x)&&sum>=l&&sum<=r)\n ans++;\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nlong long int count1=0;\n\nvoid powerset_bits(long long int a[],long long int n,long long int l,long long int r, long long int x)\n{\n long long int size = pow(2,n);\n \n long long int i,j;\n \n for (i=0;i<size;i++)\n {\n long long int sum=0;\n long long int min1=1000000002;\n long long int max1=-1;\n for (j=0;j<n;j++)\n {\n if (i& 1<<j)\n {\n if (a[j]<=min1)\n {\n min1 = a[j];\n }\n if (a[j]>=max1)\n {\n max1 = a[j];\n }\n sum = sum+a[j];\n }\n }\n if ((sum>=l && sum<=r ) && (max1 - min1 >=x) && max1!=-1)\n count1++;\n \n }\n //count_bits = i;\n \n \n}\n\n\n\nint cmpfnc(const void*a, const void *b)\n{\n return *(long long int *)a - *(long long int *)b;\n}\n\nint main()\n{\n long long int n,l,r,x,i,j;\n \n scanf(\"%lld %lld %lld %lld\",&n,&l,&r,&x);\n \n long long int c[n];\n \n for (i=0;i<n;i++)\n {\n scanf(\"%lld\",&c[i]);\n }\n /*\n qsort(c,n,sizeof(long long int),cmpfnc);\n \n for (i=0;i<n;i++)\n {\n if (c[i]>r)\n break;\n \n }\n */\n \n powerset_bits(c,n,l,r,x);\n printf(\"%lld\\n\",count1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nint n,l,r,x,i,j,maxx,minn;\nint a[16];\nlong int sum=0,cnt=0;\nscanf(\"%d%d%d%d\",&n,&l,&r,&x);\nfor(i=0;i<n;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<pow(2,n);i++)\n {\n maxx=0,minn=1000001;\n sum=0;\n\n for(j=0;j<n;j++)\n {\n if((i&1<<j))\n {\n sum+=a[j];\n if(maxx<a[j]){\n maxx=a[j];\n }\n if(minn>a[j]){\n minn=a[j];\n }\n //printf(\"%d \",a[j]);\n }\n\n }\n if(sum>=l && sum<=r){\n if((maxx-minn)>=x)\n {\n cnt++;\n }\n }\n\n }\n\nprintf(\"%d\\n\",cnt);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAXN 15\n#define INF 0x7fffffff\n\nint main()\n{\n int n, l, r, x;\n int i, j, c[MAXN];\n scanf(\"%d%d%d%d\", &n, &l, &r, &x);\n for (i = 0; i < n; ++i) scanf(\"%d\", &c[i]);\n\n int min, max, sum, ct, ans = 0;\n // Brute force.\n for (i = 0; i < (1 << n); ++i) {\n min = INF, max = sum = ct = 0;\n for (j = 0; j < n; ++j) if ((i >> j) & 1) {\n ++ct;\n sum += c[j];\n if (min > c[j]) min = c[j];\n if (max < c[j]) max = c[j];\n }\n if (ct >= 2 && sum >= l && sum <= r && max - min >= x) ++ans;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,sd,i,j,k;\n long long int ways,c,l,r,x,s,diff,maxd,mind;\n int a[1005];\n int b[100];\n scanf(\"%d %lld %lld %lld\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n long long int f=1;\n for(i=1;i<=n;i++)\n {\n f=f*2;\n }\n c=0;\n for(i=0;i<f;i++)\n {\n j=i;\n k=0;\n s=0;\n maxd=0;\n mind=10000000;\n diff=0;\n sd=0;\n while(k<n)\n {\n int r1=j%2;\n s=s+a[k]*r1;\n b[k]=r1;\n if(r1==1)\n {\n if(mind>a[k])\n mind=a[k];\n if(maxd<a[k])\n maxd=a[k];\n diff=maxd-mind;\n }\n j=j/2;\n k++;\n }\n for(j=0;j<k;j++)\n {\n if(b[j]==1)\n sd++;\n }\n if(s>=l && s<=r && sd>=2 && diff>=x)\n c++;\n }\n printf(\"%lld\\n\",c);\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nlong int c=0, l, ma, mi, rr, s, x;\nvoid printCombination(long int arr[], long int n, long int r);\nvoid combinationUtil(long int arr[], long int data[], long int start, long int end, long int index, long int r);\nmain()\n{\n long int a[100], i, j, n, p, t;\n scanf(\"%ld %ld %ld %ld\", &n, &l, &rr, &x);\n for(i=0;i<n;i++)\n {\n scanf(\"%ld\", &a[i]);\n }\n n--;\n for(i=0;i<n;i++)\n for(j=0;j<n-i;j++)\n if(a[j]>a[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n n++;\n for(p=2;p<=n;p++)\n {\n printCombination(a, n, p);\n }\n printf(\"%ld\", c);\n return 0;\n}\nvoid printCombination(long int arr[], long int n, long int r)\n{\n long int data[r];\n combinationUtil(arr, data, 0, n-1, 0, r);\n}\nvoid combinationUtil(long int arr[], long int data[], long int start, long int end, long int index, long int r)\n{\n long int i, j;\n if (index == r)\n {\n ma=s=0;\n mi=1000000;\n for (j=0; j<r; j++)\n {\n if(ma<data[j])\n ma=data[j];\n if(mi>data[j])\n mi=data[j];\n s+=data[j];\n }\n if(s>=l&&s<=rr&&ma-mi>=x)\n c++;\n return;\n }\n for (i=start; i<=end && end-i+1 >= r-index; i++)\n {\n data[index] = arr[i];\n combinationUtil(arr, data, i+1, end, index+1, r);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n,l,r,c[15],x;\n\nint check(int Mask)\n{\n\tint NoOfProblem=0,Max=0,Min=1000001,Sum=0,j=Mask,i;\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif (j%2==1)\n\t\t{\n\t\t\tNoOfProblem++;\n\t\t\tMax=Max>c[i]?Max:c[i];\n\t\t\tMin=Min<c[i]?Min:c[i];\n\t\t\tSum+=c[i];\n\t\t}\n\t\tj/=2;\n\t}\n\tif ((NoOfProblem>=2)&&(Sum>=l)&&(Sum<=r)&&(Max-Min>=x))\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main()\n{\n\tint i,count=0;\n\tscanf(\" %d%d%d%d\",&n,&l,&r,&x);\n\tfor (i=0;i<n;i++)\n\t\tscanf(\" %d\",&c[i]);\n\tfor (i=0;i<1<<n;i++)\n\t\tcount+=check(i);\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "/*\nSpirits coming from the mind,\nwaking up my deepest horrors,\ncapture my thoughts, make me blind.\n\nWeird, \u2018cause I don't want to see\nthe abyss of my possibilities.\n\nScared I can't look away.\n\nIt has come to my side.\nSister demon - my bride.\n\nI want you, I need you\nand I have set you free.\nYou're always right behind me,\nI know the devil's sent you to me.\nYou want me, you need me,\nnow that I've set you free.\nLook always right behind you,\nYou know the devil's sent me to you.\n\nWhat has started as a longing\nalmost is possession now,\nit drives me again and again.\nPut a light into your window,\nmaybe I can find a hold.\nI run against myself \u2018till I find the end.\n\nSent by the devil\n*/\n\n\n/* .................... compiled by alankar....................\n*/\n\n//......................SHORTCUTS..............................\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n//...........................................................\n\n#define pi 3.14159265358979323846 //float type\n#define MAX 100000 //for rmq\n#define SQRTMAX 317 //for rmq\n//#define gc getchar_unlocked\n\n#define FOR(i,a,b) for(i=(a);i<(b);i++)\n\n//only for +ve and single terms\n#define s(x) scanf(\"%d\",&x);\n#define sl(x) scanf(\"%lld\",&x);\n#define p(x) printf(\"%d\\n\",x);\n#define pl(x) printf(\"%lld\\n\",x);\n//..........................................................\n\ntypedef long long int ll;\nconst ll MOD=1000000007;\n\n//returns int and +ve numbers\n\n/*inline int inp(){\n int n=0;\n char c;\n c=gc();\n while(c<'0' || c>'9'){\n c=gc();\n }\n while(c>='0' && c<='9'){\n n=(n<<3)+(n<<1)+c-'0';\n c=gc();\n }\n return n;\n}\n*/\n//...................................\n\n//power with mod........long long int\n ll power(ll a,ll b,ll mod){\n if(b==0)\n return 1;\n ll temp=power(a,b/2,mod);\n temp=(temp*temp)%mod;\n if(b&1)\n temp=(temp*a)%mod;\n return temp;\n}\n\n //power without mod........ int\nll pwr(ll a,ll b){\n if(b==0)\n return 1;\n ll temp=pwr(a,b/2);\n temp=(temp*temp);\n if(b&1)\n temp=(temp*a);\n return temp;\n}\n // .....long long int\nll gcd(ll a,ll b){\n return b==0?a:gcd(b,a%b);\n}\n //......long long int\nll lcm(ll a,ll b){\n return (a/gcd(a,b))*b;\n}\n //......long long int with mod\nll modularInverse(ll a,ll m){\n return power(a,m-2,m);\n}\n\n //only for int\n int min(int a,int b) { return a<b? a : b; }\n int max(int a,int b) { return a>b? a : b; }\n\n//normal compare func on integers //for qsort(name,size,sizeof(type),compare)\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint BinarySearch(int *array, int number_of_elements, int key)\n{\n int low = 0, high = number_of_elements-1, mid;\n while(low <= high)\n {\n mid = (low + high)/2;\n if(array[mid] < key)\n {\n low = mid + 1;\n }\n else if(array[mid] == key)\n {\n return mid;\n }\n else if(array[mid] > key)\n {\n high = mid-1;\n }\n\n }\n return -1;\n}\n//.......................................................\n\n//segment tree\n//not template but how to use ST\n//for minimum element\n/*\nlong long s[400000];\nlong long a[1000000];\nint create(long long b,long long e,long long n)\n{\n if(b==e)\n {\n s[n]=a[b];\n }\n else\n {\n create(b,(b+e)/2,2*n+1);\n create((b+e)/2+1,e,2*n+2);\n s[n]=s[2*n+1]<s[2*n+2]?s[2*n+1]:s[2*n+2];\n }\n return 0;\n}\n\n\n//for finding minimum element b/w l and r\nlong long messi(long long b,long long e,long long l,long long r,long long n)\n{\n long long i,j;\n if(e<l||b>r)\n {\n return 100000001;\n }\n if(b>=l&&e<=r)\n {\n return s[n];\n }\n i=messi(b,(b+e)/2,l,r,2*n+1);\n j=messi((b+e)/2+1,e,l,r,2*n+2);\n return i<j?i:j;\n}\n*/\n//............................................................................\n//range minimam query\n//for mim and max number\n/*\n\n//preprocess create the min array\n\nlong min[SQRTMAX], max[SQRTMAX], b[MAX];\nint size, n;\n\nvoid preProcess(int n){\n int i=0, j=0, k=0;\n long minimum, maximum;\n\n size = sqrt(n);\n //printf(\"size = %d\\n\",size);\n while(j<size){\n minimum = maximum = b[i];\n for(k=0 ; k<size ; k++){\n if(minimum>b[i])\n minimum = b[i];\n if(maximum<b[i])\n maximum = b[i];\n i++;\n }\n min[j] = minimum;\n max[j] = maximum;\n j++;\n }\n}\n\nlong findMin(int l, int r){\n int j, j2;\n long minimum = b[l];\n\n j = l/size + 1;\n j2 = r/size - 1;\n\n //printf(\"j= %d and j2 = %d\\n\", j,j2);\n while(l<j*size && l<=r){\n if(minimum > b[l]){\n minimum = b[l];\n\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n while(j<=j2 && l<=r && j<size){\n if(minimum > min[j])\n minimum = min[j];\n l = (j+1)*size;\n //printf(\"Checked for %d <--> %d\\n\", j*size, l-1);\n j++;\n }\n while(l<=r){\n if(minimum > b[l]){\n minimum = b[l];\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n return minimum;\n}\n\n//finding max value\nlong findMax(int l, int r){\n int j, j2;\n long maximum = b[l];\n\n j = l/size + 1;\n j2 = r/size - 1;\n\n //printf(\"j= %d and j2 = %d\\n\", j,j2);\n while(l<j*size && l<=r){\n if(maximum < b[l]){\n maximum = b[l];\n\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n while(j<=j2 && l<=r && j<size){\n if(maximum < max[j])\n maximum = max[j];\n l = (j+1)*size;\n //printf(\"Checked for %d <--> %d\\n\", j*size, l-1);\n j++;\n }\n while(l<=r){\n if(maximum < b[l]){\n maximum = b[l];\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n return maximum;\n}\n*/\n\n//...........................................END OF TEMPLATE.................................................................\n\nll a[20];\nint main()\n{ ll i,j=20,k=20,t,n,l,r,x,ans=0,xe,tot,sum=0,ju=0,ma,mi;\n sl(n)\n sl(l)\n sl(r)\n sl(x)\n\n FOR(i,0,n)\n sl(a[i])\n\n\n qsort(a,n,sizeof(ll),compare);\n\n FOR(i,0,n)\n {\n if(a[i]>=l)\n {\n j=i;\n break;\n }\n }\n\n for(i=n-1;i>=0;i--)\n {\n if(a[i]<=l)\n {\n k=i;\n break;\n }\n }\n\n if(n<2)\n printf(\"0\\n\");\n\n\n else\n {\n\n FOR(i,3,1<<n)\n {\n xe=i;\n tot=0;\n while(xe)\n {\n xe=(xe&(xe-1));\n tot++;\n }\n // pl(tot)\n if(tot<2)\n continue;\n\n sum=0;\n ju=0;\n ma=0,mi=1000000000000;\n FOR(j,0,n)\n {\n if((i>>j)&1)\n {\n\n\n {\n if(a[j]>=ma)\n ma=a[j];\n if(a[j]<=mi)\n mi=a[j];\n sum=sum+a[j];\n }\n\n }\n }\n if(sum>=l&&sum<=r&&ju==0&&(ma-mi>=x))\n ans++;\n\n\n }\n\n pl(ans)\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nlong long int max(long long int a, long long int b)\n{\n if(a>b) return a;\n else return b;\n}\nlong long int min(long long int a, long long int b)\n{\n if(a<b) return a;\n else return b;\n}\n\n\nint main()\n{\n long long int n, l, r, x, i, j, mx, mn,ans=0, sum=0;\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &l, &r, &x);\n long long int aray[n];\n for(i=0;i<n;i++){\n scanf(\"%I64d\", &aray[i]);\n }\n for(i=1;i<(1<<n);i++){\n sum=0;\n mx = 0;\n mn = 1000006;\nfor(j=0;j<n;j++){\n if(i&(1<<j)){\n sum+=aray[j];\n mx=max(mx,aray[j]);\n mn=min(mn,aray[j]);\n }\n // printf(\"j:%lld i:%lld sum:%lld\\n\", j,i, sum);\n }\n //printf(\"%I64d %I64d\\n\", mx, mn);\n if(mx-mn>=x && sum>=l && sum<=r){\n ans++;\n }\n }\n printf(\"%I64d \", ans);\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int i,j,c[15]={0},z,a[30],l,r,n,x,ans = 0;\nvoid bit(long long int now){\n\tlong long int p,sum;\n\tif(now == z) {\n\t\tsum = a[i] + a[j];\n\t\tfor(p=0;p<z;p++)\n\t\t\tif(c[p] == 1)\n\t\t\t\tsum += a[i+p+1];\n\t\tif(sum >= l && sum<=r)\n\t\t\tans++;\n\t}\n\telse {\n\t\tc[now] = 0;\n\t\tbit(now+1);\n\t\tc[now] = 1;\n\t\tbit(now+1);\n\t}\n\treturn ;\n}\nint main(){\n\tlong long int k,m,p,q;\n\tscanf(\"%lld%lld%lld%lld\",&n,&l,&r,&x);\n\tfor(p=0;p<n;p++)\n\t\tscanf(\"%lld\",&a[p]);\n\tfor(p=n-1;p>0;p--)\n\t\tfor(q=0;q<p;q++)\n\t\t\tif(a[q] > a[q+1]) {\n\t\t\t\tk = a[q];\n\t\t\t\ta[q] = a[q+1];\n\t\t\t\ta[q+1] = k;\n\t\t\t}\n\tfor(i=0;i<n;i++)\n\t\tfor(j=i+1;j<n;j++)\n\t\t\tif(a[j]-a[i] >= x && a[j]+a[i]<=r) {\n\t\t\t\tfor(p=0;p<15;p++)\n\t\t\t\t\tc[p] = 0;\n\t\t\t\tz = j-i-1;\n\t\t\t\tbit(0);\n\t\t\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define ABS(x) ((x) < 0 ? -1*(x) : (x))\n#define MAX(x,y) ((x) > (y) ? (x) : (y))\n#define MIN(x,y) ((x) < (y) ? (x) : (y))\n#define MOD 1000000007\n#define INF 2000000000\n\nint diffs[20];\n\nint main()\n{\n\tint l,r,x,i,tot,n,count,t,td,j,k,max,min;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&r);\n\tscanf(\"%d\",&x);\n\n\tfor(i = 0; i < n; ++i)\n\t\tscanf(\"%d\", &diffs[i]);\n\n\ttot = (1<<n);\n\tcount = 0;\n\tfor(i = 0; i < tot; ++i)\n\t{\n\t\tj = i;\n\t\tt = 0;\n\t\tk = 0;\n\t\ttd = 0;\n\t\tmax = -1;\n\t\tmin = 100000000;\n\t\twhile(j)\n\t\t{\n\t\t\tif(j & 1)\n\t\t\t{\n\t\t\t\ttd += diffs[k];\n\t\t\t\tif(diffs[k] < min)\n\t\t\t\t\tmin = diffs[k];\n\t\t\t\tif(diffs[k] > max)\n\t\t\t\t\tmax = diffs[k];\n\t\t\t\t++t;\n\t\t\t}\n\t\t\t++k;\n\t\t\tj >>= 1;\n\t\t}\n\t\tif(t > 1 && td >= l && td <= r && ((max-min) >= x))\n\t\t\t++count;\n\t}\n\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n#include<limits.h>\n//using namespace std;\nlong long int a[1000500];\nlong long int count,l,r,x,n;\nlong long int func(long long int sum,long long int ind,long long int mii,long long int maa);\nint main()\n{\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&l,&r,&x);;\n long long int j=0,i;\n count=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%I64d\",&a[i]);\n }\n func(0,0,INT_MAX,INT_MIN);\n printf(\"%I64d\\n\",count);\n return 0;\n}\nlong long int func(long long int sum,long long int ind,long long int mii,long long int maa)\n{\n if(sum>r)\n return 0;\n if(ind==n)\n {\n if(sum>=l&&sum<=r&&(maa-mii)>=x)\n count++;\n return 0;\n }\n long long int mi=a[ind],ma=a[ind];\n func(a[ind]+sum,ind+1,min(mi,mii),max(ma,maa));\n func(sum,ind+1,mii,maa);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nchar s[100001];\n\nint main()\n{\n\n\tint s,sm,c,jh,n,l,r,x,i,j,h;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&r);\n\tscanf(\"%d\",&x);\n\tint a[n];\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tc=0;\n\t\n\tint k=1<<n;\n\t\n\tfor(i=3;i<k;i++)\n\t{\n\t\ts=0;\n\t\t\n\t\th=-1;\n\t\t\n\t\tsm=1000001;\n\t\tfor(j=0;j<=n;j++)\n\t\t{\n\t\t\tif((i>>j)&1)\n\t\t\t{\n\t\t\t\tif(a[j]>h)\n\t\t\t\t\th=a[j];\n\t\t\t\t\t\n\t\t\t\tif(a[j]<sm)\n\t\t\t\t\tsm=a[j];\n\t\t\t\t\t\n\t\t\t\ts+=a[j];\n\t\t\t}\n\t\t}\n\t\tif((h-sm)>=x&&(s>=l)&&(s<=r))\n\t\t{\n\t\t\tc++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",c);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long int n,l,r,x;\nlong long int po(long long int y)\n{\n\tint res;\n\tif(y==1)\n\t\treturn 2;\n\tres=2*po(y-1);\n\treturn res;\n}\nvoid printPowerSet(long long int *set,long long int set_size)\n{\n\tlong long int ans=0,sum=0,small=1000000000,large=-1;\n\t/*set_size of power set of a set with set_size\n\t n is (2**n -1)*/\n\tlong long int pow_set_size = po(set_size);\n\tlong long int counter, j;\n\n\t/*Run from counter 000..0 to 111..1*/\n\tfor(counter = 0; counter < pow_set_size; counter++)\n\t{\n\t\tfor(j = 0; j < set_size; j++)\n\t\t{\n\t\t\t/* Check if jth bit in the counter is set\n\t\t\t If set then pront jth element from set */\n\t\t\tif(counter & (1<<j))\n\t\t\t{\n\t\t\t\tsum+=set[j];\n\t\t\t\tif(set[j]<small)\n\t\t\t\t\tsmall=set[j];\n\t\t\t\tif(set[j]>large)\n\t\t\t\t\tlarge=set[j];\n\t\t\t//\tprintf(\"%d\", set[j]);\n\t\t\t}\n\t\t}\n\t//\tprintf(\"\\n\");\n\t\tif(sum>=l&&sum<=r)\n\t\t{\n\t\t\tif(large-small>=x)\n\t\t\t\tans++;\n\t\t}\n\t\tsmall=1000000000,large=-1,sum=0;\n\n\t}\n\tprintf(\"%lld\\n\",ans);\n}\n\n/*Driver program to test printPowerSet*/\nint main()\n{\n\tlong long int i,j,set[100];\n\tscanf(\"%lld%lld%lld%lld\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%lld\",&set[i]);\n\tprintPowerSet(set,n);\n//\tgetchar();\n\treturn 0;\n}\n"}, {"source_code": "#include<limits.h>\n#include<stdio.h>\nint main()\n{\n\tlong long int j,n,ans=1,i,l,r,x;\n\tscanf(\"%lld %lld %lld %lld\",&n,&l,&r,&x);\n\tlong long int add,small,big,count =0,p,s[n],k,arr[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%lld\",&arr[i]);\n\t\tans*=2;\n\t}\n\tfor(i=0;i<ans;i++)\n\t{\n\t\tp=i;\n\t\tadd=0;\n\t\tsmall=INT_MAX;\n\t\tbig=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tk=p%2;\n\t\t\tp=p/2;\n\t\t\ts[n-1-j]=k;\n\t\t\tif(k==1)\n\t\t\t{\n\t\t\t\tadd+=arr[n-1-j];\n\t\t\t\tif(arr[n-1-j]<small)\n\t\t\t\t\tsmall=arr[n-1-j];\n\t\t\t\tif(arr[n-1-j]>big)\n\t\t\t\t\tbig=arr[n-1-j];\n\n\t\t\t}\n\t\t}\n\t\tint flag=1;\n\t\tif((add<=r)&&(add>=l))\n\t\t\tflag=0;\n\t\telse\n\t\t\tflag=1;\n\t\tif(flag==0)\n\t\t{\n\t\t\tif(big-small>=x)\n\t\t\t\tflag=0;\n\t\t\telse\n\t\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t\tcount++;\n\n\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nvoid sort(int d[],int n);\nvoid merge(int d[],int x[],int y[],int l,int r);\nint main()\n{\n\tint n,l,r,x;\n\tscanf(\"%d %d %d %d\",&n,&l,&r,&x);\n\tint i,f,temp,a[n+1],j,num,countway=0,countprb,sum,min,max;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tsort(a,n);\n\tfor(i=1;i < (1<<n) ;i++)\n\t{\n\t\tcountprb=0;\n\t\tsum=0;\n\t\tmax=0;\n\t\tmin=1000005;\n\t\tf=1;\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\ttemp = (( i & ( 1<<j ))?1:0);\n\t\t\t//printf(\"%d %d %d \\n \",temp,j,i);\n\t\t\tif(temp)\n\t\t\t{\n\t\t\t\tif(a[j]<min)\n\t\t\t\t\tmin=a[j];\n\t\t\t\tif(a[j]>max)\n\t\t\t\t\tmax=a[j];\n\t\t\t\tcountprb++;\t\n\t\t\t\tsum+=a[j];\n\t\t\t\tif(sum>r)\n\t\t\t\t{\n\t\t\t\t\tf=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(!f)\n\t\t\tcontinue;\n\t\tif(sum>=l && (max-min)>=x && countprb>1)\n\t\t\t{countway++;/*printf(\"%d fgdfvdfv \\n\",i);*/}\n\t} \n\tprintf(\"%d\",countway);\n\treturn 0;\n}\nvoid sort(int d[],int n)\n{\n\tif(n==1)\n\t\treturn;\n\tint i,j;\n\tint x[(n+1)/2],y[n-(n+1)/2];\n\tfor(i=0;i<(n+1)/2;i++)\n\t\tx[i]=d[i];\n\tfor(i=(n+1)/2,j=0;i<n;i++,j++)\n\t\ty[j]=d[i];\n\tsort(x,(n+1)/2);\n\tsort(y,j);\n\tmerge(d,x,y,((n+1)/2),j);\n}\nvoid merge(int d[],int x[],int y[],int l,int r)\n{\n\t\n\t//printf(\"%d %d \\n\",l,r);\n\tint i=0,j=0,k=0;\n\tfor(;i<l && j<r;k++)\n\t{\n\t\tif(x[i]<=y[j])\n\t\t{\n\t\t\td[k]=x[i];\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\td[k]=y[j];\n\t\t\tj++;\n\t\t}\n\t}\n\twhile(i<l)\n\t{\n\t\td[k]=x[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<r)\n\t{\n\t\td[k]=y[j];\n\t\tj++;\n\t\tk++;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n#include <math.h>\n#define INF 999999999999\ntypedef long long int ll;\nll a[15];\nint main(void) {\n\t// your code goes here\n\tll n,l,r,x,sum,i,j,ans=0,count=0;\n\tscanf(\"%I64d %I64d %I64d %I64d\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%I64d\",&a[i]);\n\tfor(i=0;i<(1LL<<n);i++)\n\t{\n\t\tsum=0;\n\t\tcount=0;\n\t\tll greatest = -INF,smallest = INF;\n\t\t//printf(\"\\n\");\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\t\n\t\t\tif((i&(1LL<<j))!=0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\t//printf(\"%lld-\",a[j]);\n\t\t\t\tsum+=a[j];\n\t\t\t\tif(a[j]>greatest)greatest = a[j];\n\t\t\t\tif(a[j]<smallest)smallest = a[j];\n\t\t\t}\n\t\t}\n\t\tif(sum>=l&&sum<=r&&abs(greatest-smallest)>=x)ans++;\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define lli long long int\nlli a[20];\nlli n,l,r,x;\nint main(void)\n{\nlong long int n,mask=0,sum=0,i,s,ans=0,min,max,j;\nscanf(\"%lld %lld %lld %lld\",&n,&l,&r,&x);\nfor(i=0;i<n;i++)\nscanf(\"%lld\",&a[i]);\nmask=(1<<n);\nfor(i=0;i<mask;i++)\n{\nsum=0;min=1000005,max=-1,s=1;\nfor(j=0;j<n;j++)\n{\nif((i&s)!=0)\n{\nif(a[j]<min)\nmin=a[j];\nif(a[j]>max)\nmax=a[j];\nsum+=a[j];\n//printf(\"i=%lld s=%lld\\n i&s=%lld j=%lld max=%lld min=%lld\\n\",i,s,i&s,j,max,min);\n}\ns=(s<<1);\n}\nif((max-min)>=x && sum>=l && sum<=r){\nans++;\n//printf(\"i=%lld %lld %lld %lld %lld %lld\\n\",i,max,min,max-min,x,sum);\n}\n}\nprintf(\"%lld\\n\",ans); \nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define SIZE 100004\ntypedef long long int ll;\nll n,l,r,x,count;\nll arr[20];\nvoid func(ll sum,int i,ll min, ll max,int num)\n{\n if(i==n)\n {\n if(sum>=l && sum<=r && (max-min)>=x && num>=2){\n count++;\n //printf(\"sum : %lld\\n\",sum);\n }\n }\n else{\n func(sum,i+1,min,max,num);\n func(sum+arr[i], i+1,min = arr[i]<min?arr[i]:min,max = arr[i]>max?arr[i]:max,num+1);\n }\n}\nint main(void)\n{\n int i;\n scanf(\"%lld%lld%lld%lld\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%lld\",&arr[i]);\n func(0,0,1000004,0,0);\n printf(\"%lld\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nll arr[25];\nll inde[25];\nvoid merge (ll *a,ll start,ll mid,ll end)\n{\n ll k,n1,n2,i,j;\n ll l[mid-start+1],r[end-mid];\n n1=mid-start+1;\n n2=end-mid;\n for(k=0;k<n1;k++)\n {\n l[k] = a[start+k];\n }\n for(k=0;k<n2;k++)\n {\n r[k] = a[mid+k+1];\n } \n i=0;\n j=0;\n for(k=start;k<=end;k++)\n {\n if(n1!=0&&n2!=0)\n {\n if(l[i]<=r[j])\n {\n a[k] = l[i];\n i++;\n n1--; \n }\n else if(l[i]>r[j])\n {\n a[k] = r[j];\n j++;\n n2--;\n } \n }\n else if(n1==0)\n {\n while(n2>0)\n {\n a[k] = r[j];\n j++;\n n2--;\n k++;\n }\n }\n else if(n2==0)\n {\n while(n1>0)\n {\n a[k] = l[i];\n i++;\n n1--;\n k++;\n }\n }\n }\n return ;\n};\nvoid merge_sort(ll * a,ll start,ll end)\n{\n if(end<=start)\n return ;\n ll mid;\n mid=(start+end)/2;\n merge_sort(a,start,mid);\n merge_sort(a,(mid+1),end);\n merge(a,start,mid,end);\n return ;\n};\nint main()\n{\n ll n,l,r,x,i,j,k;\n ll count = 0;\n ll pow[25];\n ll ans = 0,tmp,t1,tot,set,max,min;\n pow[0] = 1;\n for(i=1;i<=16;i++)\n pow[i] = pow[i-1]*2;\n scanf(\"%lld%lld%lld%lld\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%lld\",&arr[i]);\n merge_sort(arr,0,n-1);\n ll num = pow[n];\n for(i=0;i<=num;i++)\n {\n t1 = i;\n tot = 0;\n set = 0;\n max = -1;\n min = 25;\n for(k=0;k<n;k++)\n {\n if(t1%2==1)\n {\n inde[k] = 1;\n tot+=arr[k];\n set++;\n if(k>max)\n max=k;\n if(k<min)\n min = k;\n }\n else\n {\n inde[k] = 0;\n }\n t1 = t1/2;\n }\n if(set>=2)\n {\n if(tot>=l&&tot<=r)\n {\n tmp = arr[max]-arr[min];\n if(tmp>=x)\n ans++;\n \n }\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main() {\n\tint v, i, n, l, r, x, sum, min, max, cnt;\n\tstatic int a[15];\n\n\tscanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\tcnt = 0;\n\tfor (v = 1; v < 1 << n; v++) {\n\t\tmin = INT_MAX; \n\t\tmax = 0;\n\t\tsum = 0;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif ((v & 1 << i) > 0) {\n\t\t\t\tsum += a[i];\n\t\t\t\tif (max < a[i])\n\t\t\t\t\tmax = a[i];\n\t\t\t\tif (min > a[i])\n\t\t\t\t\tmin = a[i];\n\t\t\t}\n\t\tif (max - min >= x && sum >= l && sum <= r)\n\t\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char n,i;\n long l,r,x,j;\n long min,max,sum,count=0;\n char s;\n scanf(\"%d%ld%ld%ld\",&n,&l,&r,&x);\n long c[n];\n for(i=0;i<n;i++)\n scanf(\"%ld\",c+i);\n long a=1L<<n;\n for(j=1;j<a;j++){\n min=1000000;\n max=1;\n sum=0;\n s=0;\n for(i=0;i<n;i++)\n if(j&(1L<<i)){\n if(c[i]<min)min=c[i];\n if(c[i]>max)max=c[i];\n sum+=c[i];\n s++;\n }\n if(s>1 && sum>=l && sum<=r && (max-min)>=x)\n count++;\n }\n printf(\"%ld\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nchar s[100001];\n\nint main()\n{\n\n\tint s,sm,c,jh,n,l,r,x,i,j,h;\n\tscanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tint a[n];\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tc=0;\n\tint k=1<<n;\n\tfor(i=3;i<k;i++)\n\t{\n\t\ts=0;\n\t\th=-1;\n\t\tsm=1000001;\n\t\tfor(j=0;j<=n;j++)\n\t\t{\n\t\t\tif((i>>j)&1)\n\t\t\t{\n\t\t\t\tif(a[j]>h)\n\t\t\t\t\th=a[j];\n\t\t\t\tif(a[j]<sm)\n\t\t\t\t\tsm=a[j];\n\t\t\t\ts+=a[j];\n\t\t\t}\n\t\t}\n\t\tif((h-sm)>=x&&(s>=l)&&(s<=r))\n\t\t{\n\t\t\tc++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int d[1000001];\nint min[1000001];\nint a[16];\nvoid mesort(int b[],int i,int m,int j)\n{\nint i1,j1;\nint h;\nint t,o;\ni1=m;\nj1=m+1;\nint k;\nk=0;\no=i;\nwhile(i<=i1&&j1<=j)\n{\nif(b[i]<b[j1])\n{\n a[k++]=b[i];\ni++;\n}\nelse\n{\na[k++]=b[j1];\nj1++;\n}\n}\nif(i<=i1)\n{\n for(h=i;h<=i1;h++)\n a[k++]=b[h];\n}\nelse if(j1<=j)\n{\n for(h=j1;h<=j;h++)\n a[k++]=b[h];\n}\n\n\nfor(h=o,t=0;h<=j;h++,t++)\n{b[h]=a[t];\n\n}\n}\nvoid msort(int b[],int i,int j)\n{int mid;\nif(i==j)\nreturn;\nmid=(i+j)/2;\nmsort(b,i,mid);\nmsort(b,mid+1,j);\nmesort(b,i,mid,j);\n\n}\nint main()\n{\nint n,l,r,x,i,j,k,h;\nint b[16];\nint count=0;\nscanf(\"%d %d %d %d\",&n,&l,&r,&x);\nfor(i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\nmsort(b,0,n-1);\nd[1]=b[0];\nmin[1]=b[0];\nk=1;\nfor(i=1;i<n;i++)\n{h=k;\n d[++k]=b[i];\n min[k]=b[i];\n for(j=1;j<=h;j++)\n {\n d[++k]=d[j]+b[i];\n min[k]=min[j];\n if(b[i]-min[j]>=x&&d[k]>=l&&d[k]<=r)\n count++;\n }\n\n\n}\nprintf(\"%d\\n\",count);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid read(long *, int);\nlong min(long, long);\nlong max(long, long);\nlong count_no_of_problem_sets(long *, int,long, long,long);\n\nint main()\n{\n int no_of_problems;\n long min_difficulty, max_difficulty,least_difficulty_range, no_of_problem_sets;\n scanf(\"%d %ld %ld %ld\",&no_of_problems, &min_difficulty, &max_difficulty, &least_difficulty_range);\n\n long *problem_difficulty = malloc(no_of_problems*sizeof(long));\n read(problem_difficulty, no_of_problems);\n\n no_of_problem_sets = count_no_of_problem_sets(problem_difficulty, no_of_problems, min_difficulty, max_difficulty, least_difficulty_range);\n printf(\"%ld\\n\",no_of_problem_sets);\n\n free(problem_difficulty);\n return 0;\n}\n\nlong count_no_of_problem_sets(long *problem_difficulty, int no_of_problems,long min_difficulty, long max_difficulty,long least_difficulty_range)\n{\n /*We construct a binary string in bijection to the problems chosen. If the i-th bit is 1, then it means that the i-th problem is chosen\n If i-th bit is 0, then it isn't chosen. This bitmask is n digits long. We know n is always less than 15\n The binary string is helpful in visiting every set that can be chosen from these n elements.*/\n int current_problem_no, bitmask, total_no_of_problem_sets = 1 << no_of_problems; //No of binary strings of length n is 2^n. 1 right shifted n times is 2^n\n long total_legitimate_arrangements = 0, current_min_difficulty, current_max_difficulty, problems_in_set;\n long total_difficulty;\n\n //Now, we iterate through all the bitmasks\n for(bitmask = 1; bitmask < total_no_of_problem_sets; bitmask++)\n {\n total_difficulty = 0;\n problems_in_set = 0;\n /*The values of minimum and maximum are so set that the first problem selected becomes both min and max and from there it's just the\n standard way of finding min and max in an array.\n The min and max can't be set to the first element like usual because the first element may not be part of the chosen set.*/\n current_min_difficulty = 1e6 + 1;\n current_max_difficulty = -1;\n\n for(current_problem_no = 0; current_problem_no < no_of_problems; current_problem_no++)\n {\n //The number 2^j corresponds with only the j-th problem chosen. We AND this with the current bitmask. If it's non-zero, then j-problem\n //is chosen in this arrangement\n if(bitmask & (1 << current_problem_no))\n {\n current_min_difficulty = min(current_min_difficulty, *(problem_difficulty + current_problem_no));\n current_max_difficulty = max(current_max_difficulty, *(problem_difficulty + current_problem_no));\n total_difficulty = total_difficulty + *(problem_difficulty + current_problem_no);\n problems_in_set++;\n }\n }\n\n if( (problems_in_set >= 2) && (total_difficulty >= min_difficulty) && (total_difficulty <= max_difficulty) &&\n (current_max_difficulty-current_min_difficulty >=least_difficulty_range) )\n {\n total_legitimate_arrangements++;\n }\n }\n\n return total_legitimate_arrangements;\n}\n\nvoid read(long *problem_difficulty, int no_of_problems)\n{\n int i;\n for(i = 0; i < no_of_problems; i++)\n {\n scanf(\"%ld\",(problem_difficulty + i));\n }\n}\n\nlong min(long a, long b)\n{\n if(a < b)\n return a;\n else\n return b;\n}\nlong max(long a, long b)\n{\n if(a > b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid read(long *, int);\nlong min(long, long);\nlong max(long, long);\nlong count_no_of_problem_sets(long *, int,long, long,long);\n\nint main()\n{\n int no_of_problems;\n long min_difficulty, max_difficulty,least_difficulty_range, no_of_problem_sets;\n scanf(\"%d %ld %ld %ld\",&no_of_problems, &min_difficulty, &max_difficulty, &least_difficulty_range);\n\n long *problem_difficulty = malloc(no_of_problems*sizeof(long));\n read(problem_difficulty, no_of_problems);\n\n no_of_problem_sets = count_no_of_problem_sets(problem_difficulty, no_of_problems, min_difficulty, max_difficulty, least_difficulty_range);\n printf(\"%ld\\n\",no_of_problem_sets);\n\n free(problem_difficulty);\n return 0;\n}\n\nlong count_no_of_problem_sets(long *problem_difficulty, int no_of_problems,long min_difficulty, long max_difficulty,long least_difficulty_range)\n{\n //We construct a binary string in bijection to the problems chosen. If the i-th bit is 1, then it means that the i-th problem is chosen\n //If i-th bit is 0, then it isn't chosen. This bitmask is n digits long. We know n is always less than 15\n int current_problem_no, bitmask, total_no_of_problem_sets = 1 << no_of_problems; //No of binary strings of length n is 2^n. 1 right shifted n times is 2^n\n long total_legitimate_arrangements = 0, current_min_difficulty, current_max_difficulty, problems_in_set;\n long total_difficulty;\n\n //Now, we iterate through all the bitmasks\n for(bitmask = 1; bitmask < total_no_of_problem_sets; bitmask++)\n {\n total_difficulty = 0;\n problems_in_set = 0;\n current_min_difficulty = 1e6 + 1;\n current_max_difficulty = -1;\n\n for(current_problem_no = 0; current_problem_no < no_of_problems; current_problem_no++)\n {\n //The number 2^j corresponds with only the j-th problem chosen. We AND this with the current bitmask. If it's non-zero, then j-problem\n //is chosen in this arrangement\n if(bitmask & (1 << current_problem_no))\n {\n current_min_difficulty = min(current_min_difficulty, *(problem_difficulty + current_problem_no));\n current_max_difficulty = max(current_max_difficulty, *(problem_difficulty + current_problem_no));\n total_difficulty = total_difficulty + *(problem_difficulty + current_problem_no);\n problems_in_set++;\n }\n }\n\n if( (problems_in_set >= 2) && (total_difficulty >= min_difficulty) && (total_difficulty <= max_difficulty) &&\n (current_max_difficulty-current_min_difficulty >=least_difficulty_range) )\n {\n total_legitimate_arrangements++;\n }\n }\n\n return total_legitimate_arrangements;\n}\n\nvoid read(long *problem_difficulty, int no_of_problems)\n{\n int i;\n for(i = 0; i < no_of_problems; i++)\n {\n scanf(\"%ld\",(problem_difficulty + i));\n }\n}\n\nlong min(long a, long b)\n{\n if(a < b)\n return a;\n else\n return b;\n}\nlong max(long a, long b)\n{\n if(a > b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint n,l,r,x;\nint input[15];\nint solution[15];\nint count=0;\n\nvoid backtrack(int);\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&input[i]);\n\n\tbacktrack(0);\n\tprintf(\"%d\\n\",count);\n\n\treturn 0;\n}\n\nvoid backtrack(int num)\n{\n\tif(num==n)\n\t{\n\t\tint i;\n\t\tint min=1000000,max=0;\n\t\tint sum=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(solution[i])\n\t\t\t{\n\t\t\t\tsum+=input[i];\n\t\t\t\tif(input[i]>max)\n\t\t\t\t\tmax=input[i];\n\t\t\t\tif(input[i]<min)\n\t\t\t\t\tmin=input[i];\n\t\t\t}\n\t\t}\n\n\t\tif(sum<l || sum>r)\n\t\t\treturn;\n\t\tif((max-min)<x)\n\t\t\treturn;\n\t\tcount++;\n\t\treturn;\n\t}\n\n\tint i;\n\tfor(i=0;i<=1;i++)\n\t{\n\t\tsolution[num]=i;\n\t\tbacktrack(num+1);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint solution[15];\nint n,l,s,x;\nint hard[15];\nint count=0;\n\nvoid backtrack(int k)\n{\n\tif(k==n)\n\t{\n\t\tint i;\n\t\tint c=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(solution[i]!=0)\n\t\t\t\tc++;\n\t\t}\n\t\tif(c<2)\n\t\t\treturn;\n\n\t\tint sum=0;\n\t\tint max=0,min=1000000;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(solution[i]!=0)\n\t\t\t{\t\n\t\t\t\tsum=sum+hard[i];\n\t\t\t\tif(min>hard[i])\n\t\t\t\t\tmin=hard[i];\n\t\t\t\tif(max<hard[i])\n\t\t\t\t\tmax=hard[i];\n\t\t\t}\t\n\t\t}\n\n\t\tif(!(sum<=s && sum>=l))\n\t\t\treturn;\n\n\t\tif(max-min<x)\n\t\t\treturn;\n\n\t\tcount++;\n\t\treturn;\n\t}\n\n\tsolution[k]=1;\n\tbacktrack(k+1);\n\tsolution[k]=0;\n\tbacktrack(k+1);\n\treturn;\n}\n\nint main()\n{\n\tscanf(\"%d %d %d %d\",&n,&l,&s,&x);\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&hard[i]);\n\n\tbacktrack(0);\n\tprintf(\"%d\\n\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdio.h>\n#include <math.h>\nlong long sum=0,max=0,min=0;\nint n,l,r,x,i,count=0;\nvoid printPowerSet(int *set, int set_size)\n{\n /*set_size of power set of a set with set_size\n n is (2**n -1)*/\n unsigned int pow_set_size = pow(2, set_size);\n int counter, j;\n /*Run from counter 000..0 to 111..1*/\n for(counter = 0; counter < pow_set_size; counter++)\n {\n \tsum=0;\n \tmin=1000000000,max=0;\n for(j = 0; j < set_size; j++)\n {\n /* Check if jth bit in the counter is set\n If set then pront jth element from set */\n if(counter & (1<<j))\n {\n \t\n \t if(set[j]>max)\n \t max=set[j];\n \t if(set[j]<min)\n \t min=set[j];\n \t sum+=set[j]; \n \t \n }\n }\n \n if(counter!=0)\n {\n \tif(sum>=l&&sum<=r&&(max-min)>=x)\n \t count++;\n \t\n \n \n }\n \n }\n \n \n}\nint main(void) {\n\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\tint a[n+1];\n\tfor(i=0;i<n;i++)\n\t scanf(\"%d\",&a[i]);\n\t printPowerSet(a,n);\n\t printf(\"%d\\n\",count);\n\t \n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n#include <stdlib.h>\n\nint cmp( const void *a, const void *b ) {\n return *(int *) a - *(int *) b;\n}\n\nint main( void ) {\n int n, l, r, x; \n scanf(\"%i %i %i %i\", &n, &l, &r, &x);\n\n int A[n], B[n];\n \n int i;\n for( i = 0; i < n; i++ )\n\tscanf(\"%i\", &A[i]);\n\n qsort(A, n, sizeof(int), cmp);\n\n long long nways = 0;\n for( i = 1; i < (1 << n); i++ ) {\n\tint m = __builtin_popcount(i);\n\n\tif( m < 2 ) continue;\n\t\n\tint mask = i, k = 0, top = 0;\n\t\n\tlong long tot = 0;\n\twhile( mask ) {\n\t if( mask & 01 ) {\n\t\tB[top++] = A[k];\n\t\ttot += A[k];\n\t }\n\t mask >>= 1;\n\t k++;\n\t}\n\t\n\tbool ok = true;\n\n\tif( tot < l || tot > r ) ok = false;\n\tif( (B[m - 1] - B[0]) < x ) ok = false;\n\n\tif( ok ) nways++;\n }\n\n printf(\"%lld\\n\", nways);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 15\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nint nb=0;\nvoid print(int *a, int size) {\n int i;\n for(i=0; i<size; i++) {\n printf(\" %d\",a[i]);\n }\n printf(\"\\n\");\n}\nvoid sort(int *a, int size) {\n int i,j;\n for(i=0; i<size-1; i++) {\n int k=i;\n for(j=i+1; j<size; j++) {\n if(a[j]<a[k]) {\n k=j;\n }\n }\n //there we only swap min with a[i];\n int tmp=a[k];\n a[k]=a[i];\n a[i]=tmp;\n }\n}\nvoid dfs2(int start,int deep) {\n if(nb>=2) {\n /*printf(\"dfs(%d,%d)\\n\",start,deep);\n print(b,nb);\n\t*/\n int sum=0;\n int j;\n for(j=0; j<nb; j++) {\n sum+=b[j];\n }\n\t/*\n\tprintf(\"sum = %d\\n\",sum);\n printf(\"r=%d, sum=%d, l=%d\\n\",r,sum,l);\n printf(\"max=%d, x=%d, min=%d\\n\",b[nb-1],x,b[0]);\n\t*/\n if((sum<=r) && (b[nb-1]-b[0]>=x) && (sum>=l)) {\n counter++;\n\t /*printf(\"counter = %d\\n\",counter);\n print(b,nb);\n\t */\n }\n }\n if(deep==n) return;\n else {\n int i;\n for(i=start+1; i<n; i++) {\n b[nb]=c[i];\n nb++;\n dfs2(i,deep+1);\n nb--;\n }\n }\n}\n\nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&c[i]);\n }\n //print(c,n);\n sort(c,n);\n //print(c,n);\n //dfs(0,0);\n dfs2(-1,0);\n printf(\"%d\\n\",counter);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 15\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nint nb=0;\nvoid print(int *a, int size) {\n int i;\n for(i=0; i<size; i++) {\n printf(\" %d\",a[i]);\n }\n printf(\"\\n\");\n}\nvoid sort(int *a, int size) {\n int i,j;\n for(i=0; i<size-1; i++) {\n int k=i;\n for(j=i+1; j<size; j++) {\n if(a[j]<a[k]) {\n k=j;\n }\n }\n //there we only swap min with a[i];\n int tmp=a[k];\n a[k]=a[i];\n a[i]=tmp;\n }\n}\nvoid comb(int set,int select,int cn,int cm) {\n int i;\n if(select==cm) {\n int sum=0;\n int max=0;\n int min=1000001;\n for(i=0; i<cm; i++) {\n sum+=b[i];\n if(b[i]>max)max=b[i];\n if(b[i]<min)min=b[i];\n }\n if((sum<=r) && (max-min>=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i<cn; i++) {\n b[select]=c[i];\n comb(i+1,select+1,cn,cm);\n }\n }\n}\nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&c[i]);\n }\n sort(c,n);\n //print(c,n);\n for(i=2; i<=n; i++) {\n comb(0,0,n,i);\n }\n printf(\"%d\\n\",counter);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 15\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nint nb=0;\nvoid print(int *a, int size) {\n int i;\n for(i=0; i<size; i++) {\n printf(\" %d\",a[i]);\n }\n printf(\"\\n\");\n}\nvoid sort(int *a, int size) {\n int i,j;\n for(i=0; i<size-1; i++) {\n int k=i;\n for(j=i+1; j<size; j++) {\n if(a[j]<a[k]) {\n k=j;\n }\n }\n //there we only swap min with a[i];\n int tmp=a[k];\n a[k]=a[i];\n a[i]=tmp;\n }\n}\nvoid comb(int set,int select,int cn,int cm) {\n int i;\n if(select==cm) {\n int sum=0;\n for(i=0; i<cm; i++) {\n sum+=b[i];\n }\n if((sum<=r) && (b[cm-1]-b[0]>=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i<cn; i++) {\n b[select]=c[i];\n comb(i+1,select+1,cn,cm);\n }\n }\n}\nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&c[i]);\n }\n sort(c,n);\n //print(c,n);\n for(i=2; i<=n; i++) {\n comb(0,0,n,i);\n }\n printf(\"%d\\n\",counter);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 15\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nint nb=0;\nvoid print(int *a, int size) {\n int i;\n for(i=0; i<size; i++) {\n printf(\" %d\",a[i]);\n }\n printf(\"\\n\");\n}\nvoid comb(int set,int select,int cn,int cm) {\n int i;\n if(select==cm) {\n int sum=0;\n int max=0;\n int min=1000001;\n for(i=0; i<cm; i++) {\n sum+=b[i];\n if(b[i]>max)max=b[i];\n if(b[i]<min)min=b[i];\n }\n if((sum<=r) && (max-min>=x) && (sum>=l)) {\n //print(b,cm);\n counter++;\n }\n } else {\n for(i=set; i<cn; i++) {\n b[select]=c[i];\n comb(i+1,select+1,cn,cm);\n }\n }\n}\nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&c[i]);\n }\n for(i=2; i<=n; i++) {\n comb(0,0,n,i);\n }\n printf(\"%d\\n\",counter);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n\treturn (*(int *)a - *(int*)b );\n}\nint main()\n{\n\tlong int n,l,r,x;\n\tscanf(\"%ld %ld %ld %ld\",&n,&l,&r,&x);\n\tlong int i;\n\tlong int a[n];\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%ld\",&a[i]);\n\tqsort(a,n,sizeof(long int),cmpfunc);\n\t/*set_size of power set of a set with set_size\n n is (2**n -1)*/\n long int pow_set_size = pow(2,n);\n long int counter, j;\n long int flag = 0;\n long int min;\n long int max;\n long int count = 0;\n long int sum = 0;\n long int num = 0;\n for(counter = 0; counter < pow_set_size; counter++)\n {\n \t for(j = 0; j < n; j++)\n {\n \tif(counter & (1<<j)){\n \t\tnum++;\n \t\tif(flag == 0)\n \t\t{\n \t\t\tflag = 1;\n \t\t\tmin = a[j];\n \t\t}\n \t\tmax = a[j];\n \tsum = sum + a[j];\n \t//printf(\"%ld\", a[j]);\n \t}\n }\n if(num >=2)\n {\n \t\tif(max - min >= x){\n \t\t\tif(sum >=l && sum <=r)\n \t\t\t\tcount++;\n \t\t}\n }\n //printf(\"\\n%ld\\n\", num);\n num = 0;\n //printf(\"\\n\");\n flag = 0;\n max = 0;\n sum = 0;\n }\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint hardest(int ar[], int size);\n\nint easiest(int ar[], int size);\n\nint total(int ar[], int size);\n\n\nint main()\n{\n int i[100], j, k, n, l, r, x, c[100], p[100], a, b, d, size, count = 0;\n\n for (a = 1; a <= 99; a++)\n {\n p[a] = 0;\n }\n\n scanf(\"%d %d %d %d\", &n, &l, &r, &x);\n\n for (a = 1; a <= n; a++)\n {\n scanf(\"%d\", &c[a]);\n }\n\n for (i[1] = 1; i[1] <= n; i[1]++)\n {\n\n for (i[2] = i[1] + 1; i[2] <= n; i[2]++)\n {\n size = 2;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[2]++;\n for (i[3] = i[2] + 1; i[3] <= n; i[3]++)\n {\n size = 3;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[3]++;\n for (i[4] = i[3] + 1; i[4] <= n; i[4]++)\n {\n size = 4;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[4]++;\n for (i[5] = i[4] + 1; i[5] <= n; i[5]++)\n {\n size = 5;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[5]++;\n for (i[6] = i[5] + 1; i[6] <= n; i[6]++)\n {\n size = 6;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[6]++;\n for (i[7] = i[6] + 1; i[7] <= n; i[7]++)\n {\n size = 7;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[7]++;\n for (i[8] = i[7] + 1; i[8] <= n; i[8]++)\n {\n size = 8;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[8]++;\n for (i[9] = i[8] + 1; i[9] <= n; i[9]++)\n {\n size = 9;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[9]++;\n for(i[10] = i[9] + 1; i[10] <= n; i[10]++)\n {\n size = 10;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[10]++;\n for(i[11] = i[10] + 1; i[11] <= n; i[11]++)\n {\n size = 11;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[11]++;\n for (i[12] = i[11] + 1; i[12] <= n; i[12]++)\n {\n size = 12;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[12]++;\n for (i[13] = i[12] + 1; i[13] <= n; i[13]++)\n {\n size = 13;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[13]++;\n for(i[14] = i[13] + 1; i[14] <= n; i[14]++)\n {\n size = 14;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[14]++;\n for (i[15] = i[14] + 1; i[15] <= n; i[15]++)\n {\n size = 15;\n for (a = 1; a <= size; a++)\n {\n p[a] = c[i[a]];\n }\n if (total(p, size) >= l && total(p, size) <= r && hardest(p, size) - easiest(p, size) >= x)\n {\n count++;\n }\n //p[15]++;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n printf(\"%d\", count);\n}\n\n\nint hardest(int ar[], int size)\n{\n int i, j, k, l;\n\n int ret = ar[1];\n\n for (i = 1; i <= size; i++)\n {\n if (ar[i] > ret)\n {\n ret = ar[i];\n }\n }\n\n return ret;\n}\n\n\n\nint easiest(int ar[], int size)\n{\n int i, j, k, m, ret = ar[1];\n\n for (i = 1; i <= size; i++)\n {\n if (ar[i] < ret)\n {\n ret = ar[i];\n }\n }\n\n return ret;\n}\n\n\nint total(int ar[], int size)\n{\n int i, ret = 0;\n\n for (i = 1; i <= size; i++)\n {\n ret += ar[i];\n }\n\n return ret;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, l, r, x, c[15], v;\n\nint valid(int b)\n{\n int size = 0, sum = 0, min = 1000000, max = 1;\n for (int i = 0; i < n; i++)\n if (b & 1 << i) {\n size++, sum += c[i];\n if (c[i] < min)\n min = c[i];\n if (c[i] > max)\n max = c[i];\n }\n return size >= 2 && sum >= l && sum <= r && max - min >= x;\n}\n\nint main(void)\n{\n scanf(\"%d %d %d %d\", &n, &l, &r, &x);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", &c[i]);\n for (int b = 0; b < 1 << n; b++)\n v += valid(b);\n printf(\"%d\", v);\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n\n#define MAX_N 15\n\nint nbComb = 0;\n\n\nint n;\t\nint x;\t\nint l;\nint r;\nint dif[MAX_N];\t\nint mas[MAX_N];\t\n\n\nint changeCombinaison()\n{\n\tint carry = 1;\n\tint nb = 0;\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (carry == 1)\n\t\t{\n\t\t\tif (mas[i] == 1)\n\t\t\t{\n\t\t\t\tmas[i] = 0;\n\t\t\t\tcarry = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmas[i] = 1;\n\t\t\t\tcarry = 0;\n\t\t\t}\n\t\t}\n\t\tif (mas[i] == 1)\n\t\t{\n\t\t\tnb++;\n\t\t}\n\t}\n\n\tif (nb == 0)\n\t{\n\t\treturn -1;\n\t}\n\n\tif (nb <= 1)\n\t{\n\t\treturn changeCombinaison();\n\t}\n\n\treturn 1;\n}\n\n\nvoid VerifCombinaison()\n{\n\t/*for (int i = 0; i < n; i++)\n\t{\n\t\tprintf(\"%d - \", mas[i]);\n\t}\n\tprintf(\"\\r\\n\");*/\n\n\tint i, j;\n\tint verif = 1;\n\tint verifX = 0;\n\tint somme = 0;\n\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (mas[i] == 1)\n\t\t{\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t{\n\t\t\t\tif (mas[j] == 1)\n\t\t\t\t{\n\t\t\t\t\tif (dif[i] - dif[j] >= x || dif[j] - dif[i] >= x)\n\t\t\t\t\t{\n\t\t\t\t\t\t/* printf(\"|%d / %d| \", dif[i], dif[j]); */\n\t\t\t\t\t\tverifX = 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\tsomme += dif[i];\n\t\t}\n\t\tif (somme > r)\n\t\t{\n\t\t\tverif = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* printf(\"%d\\r\\n\", somme); */\n\n\tif (somme < l)\n\t{\n\t\tverif = 0;\n\t}\n\n\tif (verif == 1 && verifX == 1)\n\t{\n\t\tnbComb++;\n\t}\n\n\tif (changeCombinaison() != -1)\n\t{\n\t\tVerifCombinaison();\n\t}\n}\n\nint main()\n{\n\tint i;\n\tscanf(\"%d %d %d %d\", &n, &l, &r, &x);\n\t\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &dif[i]);\n\t\tmas[i] = 0;\n\t}\n\n\tchangeCombinaison();\n\tVerifCombinaison();\n\n\tprintf(\"%d\\r\\n\", nbComb);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define N 15\n#define C 1000000\n\nint main() {\n\tstatic int cc[N];\n\tint n, l, r, x, i, b, cnt, sum, cmax, cmin, ans;\n\n\tscanf(\"%d%d%d%d\", &n, &l, &r, &x);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &cc[i]);\n\tans = 0;\n\tfor (b = 0; b < 1 << n; b++) {\n\t\tsum = cnt = cmax = 0;\n\t\tcmin = C + 1;\n\t\tfor (i = 0; i < n; i++)\n\t\t\tif (b & 1 << i) {\n\t\t\t\tcnt++;\n\t\t\t\tsum += cc[i];\n\t\t\t\tif (cmax < cc[i])\n\t\t\t\t\tcmax = cc[i];\n\t\t\t\tif (cmin > cc[i])\n\t\t\t\t\tcmin = cc[i];\n\t\t\t}\n\t\tif (cnt >= 2 && sum >= l && sum <= r && cmax - cmin >= x)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int a,int b)\n{\n return a>=b?b:a;\n}\nint max(int a,int b)\n{\n return a>=b?a:b;\n}\nint main()\n{\n int l,r,x,n,res=0,a[16],i,j,low,high,sum=0,count=0;\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<1<<n;i++)\n {\n low=1000000000;\n high=count=sum=0;\n for(j=0;j<n;j++)\n {\n if(i&1<<j)\n {\n low=min(low,a[j]);\n high=max(high,a[j]);\n sum+=a[j];\n count++;\n }\n }\n if(count>=2 && sum>=l && sum<=r && high-low>=x)\n res++;\n }\n printf(\"%d\",res);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int mask, n, l, r, x, i, Ans = 0;\n int C[15];\n scanf(\"%d %d %d %d\", &n, &l, &r, &x);\n for(i = 0; i < n; ++i) {\n scanf(\"%d\", &C[i]);\n }\n for(mask = 1; mask < (1 << n); ++mask) {\n int Min = 0x7f7f7f7f;\n int Max = 0;\n int CurSum = 0;\n for(i = 0; i < n; ++i) {\n if((1 << i)&mask) {\n CurSum += C[i];\n if(Min > C[i]) {\n Min = C[i];\n }\n if(Max < C[i]) {\n Max = C[i];\n }\n }\n }\n if(CurSum >= l && CurSum <= r && Max - Min >= x) {\n ++Ans;\n }\n }\n printf(\"%d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,l,r,x,i,mask,cnt,cnt1,max,min,diff,sum,cnt2;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&l);\n\tscanf(\"%I64d\",&r);\n\tscanf(\"%I64d\",&x);\n\tlong long int A[n];\n\tfor(i=1;i<=n;i++)\n\t{\n\tscanf(\"%I64d\",&A[i]);\n }\n\tcnt1 = 0;\n\tfor(i=1;i<=1<<n;i++)\n\t{\n\t\tmin = 10000000;\n \tmax = 1;\n \tcnt = 0;\n \tsum = 0;\n \tmask = 1;\n \tcnt2 = 1;\n\t\twhile(mask<=i)\n\t\t{\n\t\t\tif(i&mask)\n\t\t\t{\n\t\t\t\tcnt = cnt +1;\n\t\t\t\tif(A[cnt2]>max)\n\t\t\t\tmax= A[cnt2];\n\t\t\t\tif(A[cnt2]<min)\n\t\t\t\tmin = A[cnt2];\n\t\t\t\tsum = sum + A[cnt2];\n\t\t\t}\n\t\t\tmask = mask<<1;\n\t\t\tcnt2 = cnt2 +1;\n\t\t}\n\t\t\n\t\tdiff = max - min;\n\t\tif(cnt>=2)\n\t\t{\n\t\t\tif(sum>=l && sum <= r && diff >=x)\n\t\t\t{\n\t\t\t\tcnt1 = cnt1 +1;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\",cnt1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n\nint main(void) {\n int i, n, l, r, x, pattern, count, sum, min, max, c[15];\n scanf(\"%d%d%d%d\", &n, &l, &r, &x);\n for (i = 0; i < n; ++i) {\n scanf(\"%d\", &c[i]);\n }\n count = 0;\n for (pattern = 0; pattern < (1 << n); ++pattern) {\n if (__builtin_popcount(pattern) >= 2) {\n sum = 0;\n max = INT_MIN;\n min = INT_MAX;\n for (i = 0; i < n; ++i) {\n if (pattern & (1 << i)) {\n sum += c[i];\n min = c[i] < min ? c[i] : min;\n max = c[i] > max ? c[i] : max;\n }\n }\n if (l <= sum && sum <= r && max - min >= x) {\n ++count;\n }\n }\n }\n printf(\"%d\\n\", count);\n return 0;\n}\n"}, {"source_code": "/* DHUOJ solution #368727 @ 2018-11-11 20:53:55.897 */\n\n#include<stdio.h>\n#include<string.h>\nint c[20];\nint n,l,r,x,cnt=0;\nvoid search(int dep,int sum,int min,int max,int nn)\n{\n\tif(dep==n+1)\n\t{\n\t\tif(sum>=l&&sum<=r&&max-min>=x&&nn>=2) cnt++;\n\t\treturn ;\n\t}\n\tsearch(dep+1,sum,min,max,nn);\n\tint num=c[dep];\n\tint mi=min>num?num:min;\n\tint ma=max>num?max:num;\n\tsearch(dep+1,sum+num,mi,ma,nn+1);\n}\nint main()\n{\n\tint i;\n\tscanf(\"%d%d%d%d\",&n,&l,&r,&x);\n\tfor(i=1;i<=n;i++) scanf(\"%d\",&c[i]);\n\tsearch(1,0,1000000000,-1,0);\n\tprintf(\"%d\",cnt);\n\treturn 0;\n}"}, {"source_code": "/**\n * Created By: Anonyman637\n * Created On: 2/18/2020 9:02:23 PM\n */\n\n/* =============================================================================\n ================================== HEADERS ==================================\n ========================================================================== */\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <ctype.h>\n\ntypedef char i8;\ntypedef short i16;\ntypedef int i32;\ntypedef long long i64;\n\ntypedef unsigned char ui8;\ntypedef unsigned short ui16;\ntypedef unsigned int ui32;\ntypedef unsigned long long ui64;\n\n/* =============================================================================\n ================================== MACROS ===================================\n ========================================================================== */\n\n//*\n#define DEBUG\n// */\n\n#ifdef DEBUG\n#define debug(format, ...) printf(#format, __VA_ARGS__)\n#else\n#define debug(format, ...) \n#endif\n\n/* =============================================================================\n ================================== GLOBALS ==================================\n ========================================================================== */\n\ni32 i;\n\n/* =============================================================================\n ================================= FUNCTIONS =================================\n ========================================================================== */\n\nint main() {\n\t\n\ti32 n, l, r, x;\n\tscanf(\"%d %d %d %d\", &n, &l, &r, &x);\n\ti32 a[n];\n\n\tfor (i = 0; i < n; ++i) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\n\ti32 count = 0;\n\tfor (i32 mask = 0; mask < (1 << n); mask++) {\n\t\ti32 max = 0, min = 1000001, total = 0;\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tif (mask & (1 << i)) {\n\t\t\t\ttotal += a[i];\n\t\t\t\tmax = a[i] > max ? a[i] : max;\n\t\t\t\tmin = a[i] < min ? a[i] : min;\n\t\t\t}\n\t\t}\n\n\t\tif (total >= l && total <= r && (max - min >= x)) {\n\t\t\tcount++;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\", count);\n\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint n,l,r,x;\nint c[17];\n//int dp[16][32769][100];\n\n\n\nint prob(int i, int dif, int s)\n{\n if(i>n) return 0;\n int ret1=0,ret2=0;\n // if(dp[i][dif][s]!=-1) return dp[i][dif][s];\n if(dif==0)\n s=0;\n if((dif+c[i]>=r && dif+c[i]<=l) && s>=x)\n {\n s=s+c[i+1]-c[i];\n if(dif==0)\n s=0;\n\n ret1=prob(i+1,dif+c[i],s);\n ret2=prob(i+1,dif,s);\n\n //printf(\"%d %d %d %d %d <<<<\\n\",i,s,ret1,ret2,dif+c[i]);\n return ret1+ret2+1;\n }\n s=s+c[i+1]-c[i];\n\n ret1=prob(i+1,dif+c[i],s);\n ret2=prob(i+1,dif,s);\n //dp[i][dif][s]=ret1+ret2;\n //printf(\"%d %d %d %d %d\\n\",i,s,ret1,ret2,dif+c[i]);\n return ret1+ret2;\n}\n\n\nint main()\n{\n int res,i,j,k,m=1;\n scanf(\"%d %d %d %d\",&n,&r,&l,&x);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&c[i]);\n\n\n\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n if(c[i]>c[j])\n {\n m=c[i];\n c[i]=c[j];\n c[j]=m;\n }\n }\n }\n //for(i=1;i<=n;i++)\n //printf(\"%d\\n\",c[i]);\n\n c[n+1]=c[n];\n\n\n m=1;\n\n\n\n\n //for(i=1;i<=n;i++)\n // m=m*2;\n /*for(i=1;i<=n;i++)\n {\n for(j=0;j<=m+1;j++)\n {\n for(k=0;k<=102;k++)\n dp[i][j][k]=-1;\n }\n }*/\n res=prob(1,0,0);\n printf(\"%d\",res);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint cal(int dif[],int jd,int l,int r,int x)\n{\n int sum=0,max,min;\n int i;\n if (jd==0) return 0;\n for (i=0;jd%2==0 && jd!=0;jd=jd>>1,i=i+1);\n min=dif[i];\n sum=sum+dif[i];\n for (i++,jd=jd>>1;jd!=0;jd=jd>>1,i++)\n if (jd%2!=0) sum=sum+dif[i];\n max=dif[i-1];\n if (max-min >=x && sum>=l && sum<=r) return 1;\n else return 0;\n}\n\nvoid kuaipai (int *left,int *right)\n{\n int key=*left;\n int *stl=left;\n int *str=right;\n if (left >= right) return;\n while (left < right)\n {\n while (left < right && key <= *right)\n {\n right--;\n }\n *left = *right;\n while (left < right && key >= *left)\n {\n left++;\n }\n *right = *left;\n }\n *left=key;\n kuaipai(stl,left-1);\n kuaipai(right+1,str);\n}\n\n\nint main()\n{\n int n,l,r,x;\n int i;\n int sum;\n int dif[15]={0};\n while (scanf(\"%d %d %d %d\",&n,&l,&r,&x)!=EOF)\n {\n sum=0;\n for (i=0;i<n;i++)\n scanf(\"%d\",&dif[i]);\n kuaipai(&dif[0],&dif[n-1]);\n for (i=0;i<pow(2,n);i++)\n {\n if (cal(dif,i,l,r,x)) sum++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\ntypedef int ll;\nll nw,left,right,xw;\nll count=0;\nvoid qcksrt(int a[],int first,int last){\n\tif(first<=last){\n int wall=first,pivot=first,i,temp;\n for(i=first;i<=last;i++){\n if(a[i]<a[pivot]){\n \twall++;\n \ttemp=a[wall];\n \ta[wall]=a[i];\n \ta[i]=temp;\n }\n }\n temp=a[wall];\n a[wall]=a[pivot];\n a[pivot]=temp;\n qcksrt(a,first,wall-1);\n qcksrt(a,wall+1,last);\n }\n}\nvoid combinationUtil(int arr[], int data[], int start, int end, int index, int r);\n void printCombination(int arr[], int n, int r)\n{\n int data[r];\n combinationUtil(arr, data, 0, n-1, 0, r);\n}\nvoid combinationUtil(int arr[], int data[], int start, int end, int index, int r)\n{ if (index == r)\n {\n \tint j;\n \tll sum=0;\n for (j=0; j<r; j++)\n {\n \tsum+=data[j];\n }\n // printf(\"%d\\n\",sum );\n if((sum >=left) && (sum <=right) && ((data[r-1]-data[0])>=xw))\n {\t\n \tcount++;\n }\n return;\n }\n int i;\n for (i=start; i<=end && end-i+1 >= r-index; i++)\n {\n data[index] = arr[i];\n combinationUtil(arr, data, i+1, end, index+1, r);\n }\n}\nint main()\n{\n\tll i,j,k,g,test;\n\tscanf(\"%d %d %d %d\",&nw,&left,&right,&xw);\n\tint a[nw+1];\n\tfor(i=0;i<nw;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tqcksrt(a,0,nw-1);\n\tll r;\n\tfor(k=2;k<=nw;k++)\n\t{\n\t\tprintCombination(a,nw,k);\n\t}\t\n\tprintf(\"%d\\n\",count );\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint n,l,r,x;\nint c[17];\n//int dp[16][32769][100];\n\n\n\nint prob(int i, int dif, int s)\n{\n if(i>n) return 0;\n int ret1=0,ret2=0;\n // if(dp[i][dif][s]!=-1) return dp[i][dif][s];\n if(dif==0)\n s=0;\n if((dif+c[i]>=r && dif+c[i]<=l) && s>=x)\n {\n s=s+c[i+1]-c[i];\n if(dif==0)\n s=0;\n\n ret1=prob(i+1,dif+c[i],s);\n ret2=prob(i+1,dif,s);\n\n //printf(\"%d %d %d %d %d <<<<\\n\",i,s,ret1,ret2,dif+c[i]);\n return ret1+ret2+1;\n }\n s=s+c[i+1]-c[i];\n\n ret1=prob(i+1,dif+c[i],s);\n ret2=prob(i+1,dif,s);\n //dp[i][dif][s]=ret1+ret2;\n //printf(\"%d %d %d %d %d\\n\",i,s,ret1,ret2,dif+c[i]);\n return ret1+ret2;\n}\n\n\nint main()\n{\n int res,i,j,k,m=1;\n scanf(\"%d %d %d %d\",&n,&r,&l,&x);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&c[i]);\n\n\n\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n if(c[i]>c[j])\n {\n m=c[i];\n c[i]=c[j];\n c[j]=m;\n }\n }\n }\n //for(i=1;i<=n;i++)\n //printf(\"%d\\n\",c[i]);\n\n c[n+1]=c[n];\n\n\n m=1;\n\n\n\n\n //for(i=1;i<=n;i++)\n // m=m*2;\n /*for(i=1;i<=n;i++)\n {\n for(j=0;j<=m+1;j++)\n {\n for(k=0;k<=102;k++)\n dp[i][j][k]=-1;\n }\n }*/\n res=prob(1,0,0);\n printf(\"%d\",res);\n}\n\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n\treturn (*(int *)a - *(int*)b );\n}\nint main()\n{\n\tlong int n,l,r,x;\n\tscanf(\"%ld %ld %ld %ld\",&n,&l,&r,&x);\n\tlong int i,j;\n\tlong int a[n];\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%ld\",&a[i]);\n\tqsort(a,n,sizeof(long int),cmpfunc);\n\tlong int min;\n\tlong int max;\n\tlong int count = 0;\n\tlong int sum = 0;\n\tlong int val = 0;\n\tlong int k;\n\tfor(i=0;i<n;i++){\n\t\tmin = a[i];\n\t\tmax = a[i];\n\t\tsum = a[i];\n\t\tfor(j=i+1;j<n;j++){\n\t\t\tfor(k=j;k<n;k++)\n\t\t\t{\n\t\t\t\tmax = a[k];\n\t\t\t\tif(max - min >= x){\n\t\t\t\t\tif(sum + a[k] >= l && sum + a[k] <= r)\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tsum = sum + a[j];\n\t\t}\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint n,l,r,x,a[20],ans=0,state=0;\nvoid func(int k,int d,int e,int h,int t)\n{\n\tint q=0;\n\tif(h-e>=x && d>=l && d<=r && t>1)\n\t{\n\t\tans++;\n\t//\tprintf(\"%d %d %d %d\\n\",k,d,e,h);\n\t\tq=1;\n\t}\n\tif(k==n)\n\t\treturn;\n\tif(state==0)\n\t{\n\t\tstate=1;\n\t\tfunc(k+1,d+a[k],a[k],a[k],t+1);\n\t\tstate=0;\n\t\tif(q==0)\n\t\t\tfunc(k+1,d,e,h,t);\n\t}\n\telse\n\t{\n\t\tif(a[k]<e)\n\t\t{\n\t\t\tfunc(k+1,d+a[k],a[k],h,t+1);\n\t\t\tif(q==0)\n\t\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t\telse if(a[k]>h)\n\t\t{\n\t\t\tfunc(k+1,d+a[k],e,a[k],t+1);\n\t\t\tif(q==0)\n\t\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfunc(k+1,d+a[k],e,h,t+1);\n\t\t\tif(q==0)\n\t\t\t\tfunc(k+1,d,e,h,t);\n\t\t}\n\t}\n\treturn;\n}\nint main()\n{\n\tint i;\n\tscanf(\"%d %d %d %d\",&n,&l,&r,&x);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfunc(0,0,0,0,0);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,l,r,x;\nvoid PowerSet(int *set, int set_size)\n{\n unsigned int pow_set_size = pow(2, set_size);\n int counter, j,ar[set_size],cnt=0,ind,sum,i;\n for(counter = 0; counter < pow_set_size; counter++)\n {ind=0;\n for(j = 0; j < set_size; j++)\n {\n if(counter & (1<<j))\n ar[ind++]=set[j];\n \n }\n sum=0;\n for(i=0;i<ind;i++)\n {\n if(i+1<ind && abs(ar[i]-ar[i+1])<x)\n break;\n sum+=ar[i];\n }\n if(i==ind && sum>=l && sum<=r)\n cnt++;\n \n }\n printf(\"%d\\n\",cnt);\n}\n\n/*Driver program to test printPowerSet*/\nint main()\n{\n \n int a[20],i;\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n PowerSet(a, n);\n\n//scanf(\"%d\",&i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint comp(const void*a,const void *b);\nvoid dfs(int min,int max,int sum,int k);\nint n,l,r,x;\nint ans=0;\nint pro[100000];\nint main(){\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i,j;\n for(i=0;i<n;i++)\n scanf(\"%d\",&pro[i]);\n qsort((void*)pro,i,sizeof(int),comp);\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n dfs(pro[i],pro[j],pro[i]+pro[j],j+1);\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\nint comp(const void*a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\nvoid dfs(int min,int max,int sum,int k){\n if(sum>r)\n return;\n int i;\n if(sum>=l&&sum<=r&&max-min>=x)\n ans++;\n for(i=k;i<n;i++)\n dfs(min,pro[i],sum+pro[i],k+1);\n}\n"}, {"source_code": "/*\nSpirits coming from the mind,\nwaking up my deepest horrors,\ncapture my thoughts, make me blind.\n\nWeird, \u2018cause I don't want to see\nthe abyss of my possibilities.\n\nScared I can't look away.\n\nIt has come to my side.\nSister demon - my bride.\n\nI want you, I need you\nand I have set you free.\nYou're always right behind me,\nI know the devil's sent you to me.\nYou want me, you need me,\nnow that I've set you free.\nLook always right behind you,\nYou know the devil's sent me to you.\n\nWhat has started as a longing\nalmost is possession now,\nit drives me again and again.\nPut a light into your window,\nmaybe I can find a hold.\nI run against myself \u2018till I find the end.\n\nSent by the devil\n*/\n\n\n/* .................... compiled by alankar....................\n*/\n\n//......................SHORTCUTS..............................\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n//...........................................................\n\n#define pi 3.14159265358979323846 //float type\n#define MAX 100000 //for rmq\n#define SQRTMAX 317 //for rmq\n//#define gc getchar_unlocked\n\n#define FOR(i,a,b) for(i=(a);i<(b);i++)\n\n//only for +ve and single terms\n#define s(x) scanf(\"%d\",&x);\n#define sl(x) scanf(\"%lld\",&x);\n#define p(x) printf(\"%d\\n\",x);\n#define pl(x) printf(\"%lld\\n\",x);\n//..........................................................\n\ntypedef long long int ll;\nconst ll MOD=1000000007;\n\n//returns int and +ve numbers\n\n/*inline int inp(){\n int n=0;\n char c;\n c=gc();\n while(c<'0' || c>'9'){\n c=gc();\n }\n while(c>='0' && c<='9'){\n n=(n<<3)+(n<<1)+c-'0';\n c=gc();\n }\n return n;\n}\n*/\n//...................................\n\n//power with mod........long long int\n ll power(ll a,ll b,ll mod){\n if(b==0)\n return 1;\n ll temp=power(a,b/2,mod);\n temp=(temp*temp)%mod;\n if(b&1)\n temp=(temp*a)%mod;\n return temp;\n}\n\n //power without mod........ int\nll pwr(ll a,ll b){\n if(b==0)\n return 1;\n ll temp=pwr(a,b/2);\n temp=(temp*temp);\n if(b&1)\n temp=(temp*a);\n return temp;\n}\n // .....long long int\nll gcd(ll a,ll b){\n return b==0?a:gcd(b,a%b);\n}\n //......long long int\nll lcm(ll a,ll b){\n return (a/gcd(a,b))*b;\n}\n //......long long int with mod\nll modularInverse(ll a,ll m){\n return power(a,m-2,m);\n}\n\n //only for int\n int min(int a,int b) { return a<b? a : b; }\n int max(int a,int b) { return a>b? a : b; }\n\n//normal compare func on integers //for qsort(name,size,sizeof(type),compare)\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint BinarySearch(int *array, int number_of_elements, int key)\n{\n int low = 0, high = number_of_elements-1, mid;\n while(low <= high)\n {\n mid = (low + high)/2;\n if(array[mid] < key)\n {\n low = mid + 1;\n }\n else if(array[mid] == key)\n {\n return mid;\n }\n else if(array[mid] > key)\n {\n high = mid-1;\n }\n\n }\n return -1;\n}\n//.......................................................\n\n//segment tree\n//not template but how to use ST\n//for minimum element\n/*\nlong long s[400000];\nlong long a[1000000];\nint create(long long b,long long e,long long n)\n{\n if(b==e)\n {\n s[n]=a[b];\n }\n else\n {\n create(b,(b+e)/2,2*n+1);\n create((b+e)/2+1,e,2*n+2);\n s[n]=s[2*n+1]<s[2*n+2]?s[2*n+1]:s[2*n+2];\n }\n return 0;\n}\n\n\n//for finding minimum element b/w l and r\nlong long messi(long long b,long long e,long long l,long long r,long long n)\n{\n long long i,j;\n if(e<l||b>r)\n {\n return 100000001;\n }\n if(b>=l&&e<=r)\n {\n return s[n];\n }\n i=messi(b,(b+e)/2,l,r,2*n+1);\n j=messi((b+e)/2+1,e,l,r,2*n+2);\n return i<j?i:j;\n}\n*/\n//............................................................................\n//range minimam query\n//for mim and max number\n/*\n\n//preprocess create the min array\n\nlong min[SQRTMAX], max[SQRTMAX], b[MAX];\nint size, n;\n\nvoid preProcess(int n){\n int i=0, j=0, k=0;\n long minimum, maximum;\n\n size = sqrt(n);\n //printf(\"size = %d\\n\",size);\n while(j<size){\n minimum = maximum = b[i];\n for(k=0 ; k<size ; k++){\n if(minimum>b[i])\n minimum = b[i];\n if(maximum<b[i])\n maximum = b[i];\n i++;\n }\n min[j] = minimum;\n max[j] = maximum;\n j++;\n }\n}\n\nlong findMin(int l, int r){\n int j, j2;\n long minimum = b[l];\n\n j = l/size + 1;\n j2 = r/size - 1;\n\n //printf(\"j= %d and j2 = %d\\n\", j,j2);\n while(l<j*size && l<=r){\n if(minimum > b[l]){\n minimum = b[l];\n\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n while(j<=j2 && l<=r && j<size){\n if(minimum > min[j])\n minimum = min[j];\n l = (j+1)*size;\n //printf(\"Checked for %d <--> %d\\n\", j*size, l-1);\n j++;\n }\n while(l<=r){\n if(minimum > b[l]){\n minimum = b[l];\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n return minimum;\n}\n\n//finding max value\nlong findMax(int l, int r){\n int j, j2;\n long maximum = b[l];\n\n j = l/size + 1;\n j2 = r/size - 1;\n\n //printf(\"j= %d and j2 = %d\\n\", j,j2);\n while(l<j*size && l<=r){\n if(maximum < b[l]){\n maximum = b[l];\n\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n while(j<=j2 && l<=r && j<size){\n if(maximum < max[j])\n maximum = max[j];\n l = (j+1)*size;\n //printf(\"Checked for %d <--> %d\\n\", j*size, l-1);\n j++;\n }\n while(l<=r){\n if(maximum < b[l]){\n maximum = b[l];\n }\n //printf(\"Checked for %d\\n\", l);\n l++;\n }\n return maximum;\n}\n*/\n\n//...........................................END OF TEMPLATE.................................................................\n\nll a[20];\nint main()\n{ ll i,j=20,k=20,t,n,l,r,x,ans=0,xe,tot,sum=0,ju=0,ma,mi;\n sl(n)\n sl(l)\n sl(r)\n sl(x)\n\n FOR(i,0,n)\n sl(a[i])\n\n\n qsort(a,n,sizeof(ll),compare);\n\n FOR(i,0,n)\n {\n if(a[i]>=l)\n {\n j=i;\n break;\n }\n }\n\n for(i=n-1;i>=0;i--)\n {\n if(a[i]<=l)\n {\n k=i;\n break;\n }\n }\n\n if(n<2)\n printf(\"0\\n\");\n\n\n else\n {\n\n FOR(i,3,1<<n)\n {\n xe=i;\n tot=0;\n while(xe)\n {\n xe=(xe&(xe-1));\n tot++;\n }\n // pl(tot)\n if(tot<2)\n continue;\n\n sum=0;\n ju=0;\n FOR(j,0,n)\n { ma=0,mi=1000000000000;\n if((i>>j)&1)\n {\n\n\n {\n if(a[j]>=ma)\n ma=a[j];\n if(a[j]<=mi)\n mi=a[j];\n sum=sum+a[j];\n }\n\n }\n }\n if(sum>=l&&sum<=r&&ju==0&&(ma-mi>=x))\n ans++;\n\n\n }\n\n pl(ans)\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) ((a)<(b)?(a):(b))\n#define max(a,b) ((a)>(b)?(a):(b))\n//using namespace std;\nlong long int a[1000500];\nlong long int count,l,r,x,n;\nlong long int func(long long int sum,long long int ind,long long int mii,long long int maa);\nint main()\n{\n scanf(\"%lld %lld %lld %lld\",&n,&l,&r,&x);;\n long long int j=0,i;\n count=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&a[i]);\n }\n func(0,0,100000,-100000);\n printf(\"%lld\\n\",count);\n return 0;\n}\nlong long int func(long long int sum,long long int ind,long long int mii,long long int maa)\n{\n if(ind==n)\n {\n if(sum>=l&&sum<=r&&(maa-mii)>=x)\n count++;\n return 0;\n }\n long long int mi=a[ind],ma=a[ind];\n func(a[ind]+sum,ind+1,min(mi,mii),max(ma,maa));\n func(sum,ind+1,mii,maa);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint solution[15];\nint n,l,s,x;\nint hard[15];\nint count=0;\n\nvoid backtrack(int k)\n{\n\tif(k==n)\n\t{\n\t\tint i;\n\t\tint c=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(solution[i]!=0)\n\t\t\t\tc++;\n\t\t}\n\t\tif(c<2)\n\t\t\treturn;\n\n\t\tint sum=0;\n\t\tint max=0,min=100000;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(solution[i]!=0)\n\t\t\t{\t\n\t\t\t\tsum=sum+hard[i];\n\t\t\t\tif(min>hard[i])\n\t\t\t\t\tmin=hard[i];\n\t\t\t\tif(max<hard[i])\n\t\t\t\t\tmax=hard[i];\n\t\t\t}\t\n\t\t}\n\n\t\tif(!(sum<=s && sum>=l))\n\t\t\treturn;\n\n\t\tif(max-min<x)\n\t\t\treturn;\n\n\t\tcount++;\n\t\treturn;\n\t}\n\n\tsolution[k]=1;\n\tbacktrack(k+1);\n\tsolution[k]=0;\n\tbacktrack(k+1);\n\treturn;\n}\n\nint main()\n{\n\tscanf(\"%d %d %d %d\",&n,&l,&s,&x);\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&hard[i]);\n\n\tbacktrack(0);\n\tprintf(\"%d\\n\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 15\nint counter=0;\nint n,r,l,x;\nint c[N];\nint b[N];\nint nb=0;\nvoid sort(int *a, int size) {\n int i,j;\n for(i=0; i<size-1; i++) {\n int k=i;\n for(j=i+1; j<size; j++) {\n if(a[j]<a[k]) {\n k=j;\n }\n }\n //there we only swap min with a[i];\n int tmp=a[k];\n a[k]=a[i];\n a[i]=tmp;\n }\n}\nvoid comb(int set,int select,int total,int choose) {\n if(select==choose) {\n int sum=0;\n int j;\n for(j=0; j<choose; j++) {\n sum+=b[j];\n }\n if((sum<=r) && (b[choose-1]-b[0]>=x) && (sum>=l)) {\n counter++;\n }\n } else {\n int i;\n for(i=set; i<total; i++) {\n b[select]=c[i];\n comb(set+1,select+1,total,choose);\n }\n }\n}\n\nint main() {\n scanf(\"%d%d%d%d\",&n,&l,&r,&x);\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&c[i]);\n }\n sort(c,n);\n for(i=2;i<=n;i++) {\n comb(0,0,n,i);\n }\n printf(\"%d\\n\",counter);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n\treturn (*(int *)a - *(int*)b );\n}\nint main()\n{\n\tlong int n,l,r,x;\n\tscanf(\"%ld %ld %ld %ld\",&n,&l,&r,&x);\n\tlong int i,j;\n\tlong int a[n];\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%ld\",&a[i]);\n\tqsort(a,n,sizeof(long int),cmpfunc);\n\tlong int min = 0;\n\tlong int max = 0;\n\tlong int count = 0;\n\tlong int sum = 0;\n\tlong int val = 0;\n\tlong int k;\n\tfor(i=0;i<n-1;i++){\n\t\tmin = a[i];\n\t\tsum = a[i];\n\t\tfor(j=i+1;j<n;j++){\n\t\t\tfor(k=j;k<n;k++)\n\t\t\t{\n\t\t\t\tmax = a[k];\n\t\t\t\tif(max - min >= x){\n\t\t\t\t\tif(sum + a[k] >= l && sum + a[k] <= r)\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tsum = sum + a[j];\n\t\t}\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n\treturn (*(int *)a - *(int*)b );\n}\nint main()\n{\n\tlong int n,l,r,x;\n\tscanf(\"%ld %ld %ld %ld\",&n,&l,&r,&x);\n\tlong int i,j;\n\tlong int a[n];\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%ld\",&a[i]);\n\tqsort(a,n,sizeof(long int),cmpfunc);\n\tint temp;\n\tlong int min = 0;\n\tlong int max = 0;\n\tlong int count = 0;\n\tlong int sum = 0;\n\tlong int k;\n\tfor(i=0;i<n-1;i++){\n\t\tmin = a[i];\n\t\tsum = a[i];\n\t\tfor(j=i+1;j<n;j++){\n\t\t\tfor(k=j;k<n;k++)\n\t\t\t{\n\t\t\t\tmax = a[k];\n\t\t\t\tif(sum + a[k] >= l && sum + a[k] <= r)\n\t\t\t\t{\n\t\t\t\t\tif(max - min >=x)\n\t\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsum = sum + a[j];\n\t\t}\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint n,l,r,x;\nint c[17];\n//int dp[16][32769][100];\n\n\n\nint prob(int i, int dif, int s)\n{\n if(i>n) return 0;\n int ret1=0,ret2=0;\n // if(dp[i][dif][s]!=-1) return dp[i][dif][s];\n //printf(\"%d %d %d %d %d\\n\",i,s,ret1,ret2,dif+c[i]);\n if((dif+c[i]>=r && dif+c[i]<=l) && s+c[i]-c[i-1]>=x)\n {\n s=s+c[i]-c[i-1];\n if(dif==0)\n s=0;\n ret1=prob(i+1,dif+c[i],s);\n\n ret2=prob(i+1,dif,s);\n return ret1+ret2+1;\n }\n s=s+c[i]-c[i-1];\n if(dif==0)\n s=0;\n ret1=prob(i+1,dif+c[i],s);\n ret2=prob(i+1,dif,s);\n //dp[i][dif][s]=ret1+ret2;\n return ret1+ret2;\n}\n\n\nint main()\n{\n int res,i,j,k,m=1;\n scanf(\"%d %d %d %d\",&n,&r,&l,&x);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&c[i]);\n\n\n\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n if(c[i]>c[j])\n {\n m=c[i];\n c[i]=c[j];\n c[j]=m;\n }\n }\n }\n\n c[0]=c[1];\n\n\n m=1;\n\n\n\n\n //for(i=1;i<=n;i++)\n // m=m*2;\n /*for(i=1;i<=n;i++)\n {\n for(j=0;j<=m+1;j++)\n {\n for(k=0;k<=102;k++)\n dp[i][j][k]=-1;\n }\n }*/\n res=prob(1,0,0);\n printf(\"%d\",res);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char nm[101]={'\\0'};\n int len,key,res,i,aaaa;\n while (scanf(\"%s\",nm)!=EOF)\n {\n len=strlen(nm);\n aaaa=0;\n for (key=0;key<len;key++)\n {\n i=0;\n if (i!=key)\n res=nm[i]-48;\n else res=0;\n for (i++;i<len;i++)\n {\n if (i==key) continue;\n res=(res*10+(nm[i]-48))%8;\n\n }\n if (res%8==0 && len!=1)\n {\n aaaa++;\n if (aaaa==1) printf(\"YES\\n\");\n for (i=0;i<len;i++)\n {\n if (i==key) continue;\n else printf(\"%d\",nm[i]-48);\n }\n printf(\"\\n\");\n }\n }\n if (aaaa==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nint main()\n{\n char nm[101]={'\\0'};\n int len,key,res,i,aaaa;\n while (scanf(\"%s\",nm)!=EOF)\n {\n len=strlen(nm);\n aaaa=0;\n for (key=0;key<len;key++)\n {\n i=0;\n if (i!=key)\n res=nm[i]-48;\n else res=0;\n for (i++;i<len;i++)\n {\n if (i==key) continue;\n res=(res*10+(nm[i]-48))%8;\n\n }\n if (res%8==0 && len!=1)\n {\n aaaa++;\n if (aaaa==1) printf(\"YES\\n\");\n for (i=0;i<len;i++)\n {\n if (i==key) continue;\n else printf(\"%d\",nm[i]-48);\n }\n printf(\"\\n\");\n }\n } \n if (aaaa==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n\n\n"}], "src_uid": "0d43104a0de924cdcf8e4aced5aa825d"} {"nl": {"description": "The princess is going to escape the dragon's cave, and she needs to plan it carefully.The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hours and will chase the princess immediately. Looks like there's no chance to success, but the princess noticed that the dragon is very greedy and not too smart. To delay him, the princess decides to borrow a couple of bijous from his treasury. Once the dragon overtakes the princess, she will drop one bijou to distract him. In this case he will stop, pick up the item, return to the cave and spend f hours to straighten the things out in the treasury. Only after this will he resume the chase again from the very beginning.The princess is going to run on the straight. The distance between the cave and the king's castle she's aiming for is c miles. How many bijous will she need to take from the treasury to be able to reach the castle? If the dragon overtakes the princess at exactly the same moment she has reached the castle, we assume that she reached the castle before the dragon reached her, and doesn't need an extra bijou to hold him off.", "input_spec": "The input data contains integers vp,\u2009vd,\u2009t,\u2009f and c, one per line (1\u2009\u2264\u2009vp,\u2009vd\u2009\u2264\u2009100, 1\u2009\u2264\u2009t,\u2009f\u2009\u2264\u200910, 1\u2009\u2264\u2009c\u2009\u2264\u20091000).", "output_spec": "Output the minimal number of bijous required for the escape to succeed.", "sample_inputs": ["1\n2\n1\n1\n10", "1\n2\n1\n1\n8"], "sample_outputs": ["2", "1"], "notes": "NoteIn the first case one hour after the escape the dragon will discover it, and the princess will be 1 mile away from the cave. In two hours the dragon will overtake the princess 2 miles away from the cave, and she will need to drop the first bijou. Return to the cave and fixing the treasury will take the dragon two more hours; meanwhile the princess will be 4 miles away from the cave. Next time the dragon will overtake the princess 8 miles away from the cave, and she will need the second bijou, but after this she will reach the castle without any further trouble.The second case is similar to the first one, but the second time the dragon overtakes the princess when she has reached the castle, and she won't need the second bijou."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint vp, vd, t, f, c;\n\tscanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n\tif (vp > vd) {\n\t\tputs(\"0\");\n\t\treturn 0;\n\t}\n\n\tdouble tt = t;\n\tint cc = 0;\n\twhile (1) {\n\t\tdouble t = vp*tt / (vd - vp);\n\n\t\tif (!(vd*t + 1e-9 < c))\n\t\t\tbreak;\n\n\t\tcc++;\n\t\ttt += 2*t + f;\n\n\t}\n\n\tprintf(\"%d\\n\", cc);\n\n\treturn 0;\n}\n"}, {"source_code": "//In the name of God\n#include <stdio.h>\n\nint main()\n{\n double vp,vd,t,f,c;\n scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n double pos=t*vp;\n int need=0;\n while(pos<c)\n {\n if(vd<=vp)\n\tpos=c;\n else\n\t{\n\t double ti=pos/(vd-vp);\n\t pos=pos+ti*vp;\n\t if(pos>=c)\n\t break;\n\t double moretime=pos/vd+f;\n\t pos+=moretime*vp;\n\t need++;\n\t if(pos>=c) break;\n\t} \n }\n printf(\"%d\\n\",need);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n float k,l,m,n,d,i,count=0,j=1;\n int p=0;\n int A[100001];\n scanf(\"%f\",&k);\n scanf(\"%f\",&l);\n scanf(\"%f\",&m);\n scanf(\"%f\",&n);\n scanf(\"%f\",&d);\n count=k*m;\n if(l<=k){\n printf(\"0\");\n }else{ \n while(count<d){\n count=count+k*(count/(l-k));\n // printf(\"%f\\n\",count);\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n printf(\"%d\",p);\n }\n //getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nfloat vp,vd,t,f,c,t1,t2;\nint cnt=0;\nscanf(\"%f %f %f %f %f\",&vp,&vd,&t,&f,&c);\nfloat dp=c;\nif(vp>=vd)\nprintf(\"0\");\nelse\n{while(dp>0)\n{if(dp==c)\ndp-=vp*t;\nt1=(c-dp)/(vd-vp);\ndp-=t1*vp;\nif(dp>0)\ncnt++;\nt2=(c-dp)/vd+f;\ndp-=t2*vp;\n}}\nif(vd>vp)\nprintf(\"%d\",cnt);\nreturn(0);}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tdouble prinsum=c-vp*t;int reg=0;\n\tdouble h;\n\tif (vp<vd && prinsum>0)\n\t{\n\twhile (1)\n\t{\n\t\th=(double)(c-prinsum)/(vd-vp);\n\t\tprinsum-=h*vp;\n\t\tif (prinsum<=0) break;\n\t\treg++;\n prinsum-=(h+f)*vp;\n\t\tif (prinsum<=0) break;\n\t}\n\tprintf(\"%d\\n\",reg);\n\t}\n\telse printf(\"0\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int vp, vd, t, f, c, res=0;\n float sp=0,time;\n float eps = 1e-7;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n \n if(vp>=vd){\n printf(\"0\");\n return 0;\n }\n\n sp = t*vp;\n while(1){\n //printf(\"%f\\n\",sp);\n time=sp/(vd-vp);\n sp+=time*vp;\n //printf(\"sp1=%f\\n\",sp);\n if(sp-c>=-eps){\n printf(\"%d\",res);\n break;\n }\n res++;\n //printf(\"time=%f\\n\",time);\n sp+=(vp*(f+time));\n //printf(\"sp2=%f\\n\",sp);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double count=0;\n double d1,t,f,c,vp,vd;\n scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n d1=vp*t;\n while(d1<c)\n {\n t=d1/(vd-vp);\n if(t<0)\n break;\n d1+=t*vp;\n if(d1<c)\n count++;\n d1+=t*vp+f*vp;\n }\n printf(\"%0.0lf\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tdouble vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&C);\n\tif(vd<vp)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%lf %lf\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%lf %lf\\n\",dist,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tprintf(\"%.lf\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\n\n\nint main(void)\n{\n\n float vp,vd,t,f,c;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\n float dist=c;\n int bijou = 0;\n dist = c-t*vp;\n\n if(vd>vp){\n while(dist>0)\n {\n\n float gap = c-dist;\n float time = gap/(abs(vd-vp));\n dist = dist-time*vp;\n if(dist>0)\n {\n bijou+=1;\n dist = dist-((c-dist)/vd+f)*vp;\n }\n\n\n }\n\n }\n printf(\"%d\\n\",bijou); \n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid solve(){\n\tdouble vp,vd,t,f,c;\n\tscanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n\tint Ans = 0;\n\tif(vp>=vd){\n\t\tputs(\"0\");\n\t\treturn;\n\t}\n\tdouble s1 = 0,s2 = 0;\n\ts1 = (double) vp*t;\n\twhile(s1<c){\n\t\ts2 = s1/(vd-vp);\n\t\ts1 = s2*vd;\n\t\tif(s1>=c) break;\n\t\tAns ++;\n\t\ts1 = s1 + (s2+f)*vp;\n\t}\n\tprintf(\"%d\\n\",Ans);\n}\nint main(){\n\tsolve();\n\treturn 0;\n}\n/*\n1\n100\n1\n1\n1000\n */"}, {"source_code": "/* https://codeforces.com/contest/148/submission/19734187 (Dukkha) */\n#include <stdio.h>\n\nint main() {\n\tint vp, vd, t, f, c, v, ans;\n\tdouble x;\n\n\tscanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\tv = vd - vp;\n\tif (v <= 0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tx = t * vp;\n\tans = 0;\n\twhile (x + x / v * vp < c) {\n\t\tans++;\n\t\tx += (x / v * 2 + f) * vp;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n double vp = 0;\n double vd = 0;\n double t = 0;\n double f = 0;\n double c = 0;\n\n scanf(\"%lf %lf %lf %lf %lf\", &vp, &vd, &t, &f, &c);\n\n double pos = vp * t;\n int bijous = 0;\n\n while (pos < c) {\n pos += (pos / (vd - vp)) * vp;\n\n if (pos >= c || pos < 0) {\n break;\n }\n\n pos += ((pos / vd) + f) * vp;\n bijous++;\n }\n\n printf(\"%d\\n\", bijous);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)>(b)?(b):(a))\n#define abs(a) ((a)>0?(a):-(a))\nint main()\n{\n//\tfreopen(\"test.txt\", \"r\", stdin);\n int vp, vd, t, f, c;\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n int cnt = 0;\n if(vp >= vd)\n goto Finish;\n double pos = 1.0*vd*(vp*t)/(vd-vp);\n if(pos >= c)\n goto Finish;\n cnt++;\n while(1)\n {\n double newpos = vp*(2.0*pos/vd+f) + pos;\n newpos += (vp*(newpos - pos))/(vd-vp);\n if(newpos >= c)\n break;\n cnt++;\n pos = newpos;\n }\nFinish:\n printf(\"%d\", cnt);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tdouble v1,v2,t,f,c,x1,x2;\n\tint count=0;\n\tscanf(\"%lf %lf %lf %lf %lf\",&v1,&v2,&t,&f,&c);\n\tif(v1>=v2){\n\t\tprintf(\"%d\\n\",count);\n\t\treturn 0;\n\t}\n\tx1=v1*t;\n\twhile(x1<c){\n\t\tx1+=(x1/(v2-v1))*v1;\n\t\tif(x1>=c){\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t\tx1+=(x1/v2+f)*v1;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\t// your code goes here\n\tint vp,vd,t,f,c,k=0;\n\tfloat sum;\n\tscanf(\"%d %d %d %d %d\", &vp,&vd,&t,&f,&c);\n\tif(vp>=vd)\n\t{printf(\"0\");\n\treturn 0;}\n\tsum=t*vp;\n\twhile(sum<c)\n\t{\n\t\tsum+=(sum/(vd-vp))*vp;\n\t\tif(sum>=c)\n\t\tbreak;\n\t\tk++;\n\t\tsum+=(sum/vd +f)*vp;\n\t}\n\tprintf(\"%d\", k);\n \n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\nif(vp > vd)\nprintf(\"0\");\nelse if( vp == vd && escape_time == 0)\n{\nprintf(\"1\");\n}\n\nelse\n{\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_p_travled < distance ;\n treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n d_p_travled += vp*t_dragon;\n }\n printf(\"%.0f\",treasure);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\nif(vp > vd)\nprintf(\"0\");\nelse if( vp == vd && escape_time == 0)\n{\nprintf(\"1\");\n}\nelse if( vp == vd )\n{\nprintf(\"0\");\n}\n\nelse\n{\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_p_travled < distance ;\n treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n d_p_travled += vp*t_dragon;\n }\n printf(\"%.0f\",treasure);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n double vp,vd,t,f,c;\n scanf(\"%lf\",&vp);\n scanf(\"%lf\",&vd);\n scanf(\"%lf\",&t);\n scanf(\"%lf\",&f);\n scanf(\"%lf\",&c);\n \n if(vp>=vd)\n {\n printf(\"0\"); return 0;\n }\n double dd = vp*t;\n double p = dd + dd/(vd-vp)*vp;\n int ans=0;\n while(1){\n if(p>=c){\n printf(\"%d\",ans);\n return 0;\n }\n ans++;\n dd = p + (p/vd + f)*vp;\n p = dd + dd/(vd-vp)*vp;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n double p,d,t,f,c;\n double count;\n double dis,between,cave;\n while (scanf(\"%lf%lf%lf%lf%lf\",&p,&d,&t,&f,&c)!=EOF)\n {\n if (d<=p) {printf(\"0\\n\");continue;}\n between=p*t;\n dis=c-between;\n cave=between;\n count=0;\n while(dis>0)\n {\n t=between/(d-p);\n dis-=p*t;\n if (dis<=0) break;\n count++;\n cave=d*t;\n between=t*p+f*p;\n dis-=between;\n between+=cave;\n }\n printf(\"%d\\n\",(int)count);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int vp,vd,t,f,c,i,sum;\n double time,s;\n while(scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c) != EOF)\n {\n if(vp >= vd)\n {\n printf(\"0\\n\");\n continue;\n }\n sum = 0;\n s = (double)t * vp;\n while(s < c)\n {\n time = s / (vd - vp);\n s += time * vp;\n if(s >= c)\n break;\n else\n sum++;\n s += vp * (f + time);\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define EPS 1e-10\n\nint \nmain(int argc, const char *argv[])\n{\n int vp, vd, t, f, c;\n double tz, td, to;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n if (vd <= vp) {\n printf(\"0\\n\");\n return 0;\n }\n\n int n = 0;\n\n tz = t * 1.0;\n while (1) {\n td = tz * ((vp * 1.0) / (vd - vp));\n to = tz + td;\n tz = to + td + (f * 1.0);\n if (to + EPS < (c / (vp * 1.0))) {\n n++;\n } else {\n break;\n }\n }\n\n printf(\"%d\\n\", n);\n\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint i,j,count=0;\n double vp,vd,t,f,c;\n\tscanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n\n\tif(vp>=vd){\n\t\tprintf(\"0\\n\");\n\t\treturn;\n\t}\n\n\tdouble initial = vp*t; //p's pos\n\tdouble time=t; // t elapsed\n\twhile(time < c/vp)\n\t{\n\t\tdouble t1 = initial/(vd-vp);\n\t\ttime+=t1;\n\n\t\tif(time >= c/vp)\n\t\t\tbreak;\n\t \n\t\tdouble dist = vp*time;\n\n\t\tdouble ret = dist/vd +f;\n\t\ttime+=ret;\n\n\n\t\tinitial = time*vp;\n\t\tcount++;\n\t}\n\n\tprintf(\"%d\\n\",count);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int vp1,vd1,t1,f1,c1,count;\n float dist,n,vp,vd,t,f,c;\n count=0;\n scanf(\"%d %d %d %d %d\",&vp1,&vd1,&t1,&f1,&c1);\n vp=vp1;\n vd=vd1;\n t=t1;\n f=f1;\n c=c1;\n dist=vp*t;\n count=0;\n if(dist>=c)\n printf(\"%d\",count);\n else if(vp>=vd)\n printf(\"%d\",count);\n else\n {\n while(1)\n {\n n=(float)(dist)/(float)(vd-vp);\n dist+=(n*vp);\n if(dist>=c)\n {\n printf(\"%d\",count);\n break;\n }\n count++;\n n=((float)(dist)/(float)(vd))+f;\n dist+=(n*vp);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int vp, vd, t, f, c, sum = 1;\n double x, y;\n\n scanf(\"%d %d %d %d %d\", &vp, &vd, &t, &f, &c);\n\n if (vp >= vd || vp * t >= c || vd * vp * t >= c * (vd - vp)) {\n\t puts(\"0\");\n\n\t return 0;\n }\n\n x = (double)vp * t / (vd - vp);\n y = vp * (t + x);\n\n while (1) {\n\t y += vp * (x + f);\n\t x = y / (vd - vp);\n\t y += vp * x;\n\n\t if (y >= c) break;\n\n\t sum++;\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int vp, vd, t, f, c;\n double sp, sd, buf_t;\n int b;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n sp = vp * t;\n sd = 0;\n b = 0;\n\n while (1) {\n if (vp >= vd) break;\n buf_t = sp / (vd - vp);\n sp = sp + vp * buf_t;\n sd = vd * buf_t;\n if (sp >= c) break;\n b++;\n sd = 0;\n sp = sp + vp * (buf_t + f);\n }\n \n printf(\"%d\", b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main (void){\n int vp, vd, t, f, c;\n scanf (\"%d%d%d%d%d\",&vp, &vd, &t, &f, &c);\n int bazmek = 0;\n if (vp < vd) {\n double ubehla = t * vp;\n while (ubehla < c) {\n double za_jak_dlouho_se_potkali = (ubehla) / (vd - vp);\n ubehla = ubehla + vp * za_jak_dlouho_se_potkali;\n if (ubehla >= c) {\n break;\n } else {\n bazmek++;\n double jak_dlouho_se_vraci = ubehla / vd;\n ubehla = ubehla + vp * (jak_dlouho_se_vraci + f);\n }\n }\n }\n printf(\"%d\\n\", bazmek);\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n float vp,vd,t,f,c,tt;\n int i,N=0;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n if(vp>=vd)\n {\n printf(\"0\");\n return 0;\n }\n do\n {\n tt=(vp*t)/(vd-vp);\n if((tt*vd)<c)\n N++;\n t+=tt+tt+f;\n }while((vd*tt)<c);\n printf(\"%d\",N);\n return 0;\n}\n"}, {"source_code": "// Escape.c\n// \n// Copyright 2012 Administrator <cpy@ubuntu>\n// \n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2 of the License, or\n// (at your option) any later version.\n// \n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n// MA 02110-1301, USA.\n\n\n#include <stdio.h>\n\nvoid func(double vp, double vd, int t, int f, int c)\n{\n double p = vp * t, temp;\n int ans = 0;\n if (vd <= vp)\n {\n printf(\"0\\n\");\n return;\n }\n while (p < c)\n {\n temp = p / (vd - vp);\n p += temp * vp;\n if (p < c)\n {\n ans ++;\n }\n p = p + (f + p / vd) * vp;\n }\n printf(\"%d\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n double vp, vd;\n int t, f, c;\n while (scanf(\"%lf%lf%d%d%d\", &vp, &vd, &t, &f, &c) == 5)\n {\n func(vp, vd, t, f, c);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint vp, vd, t, f, c, cnt;\n\tdouble c_, time;\n\n\tscanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\tif (vp >= vd)\n\t\tcnt = 0;\n\telse {\n\t\tcnt = 0;\n\t\tc_ = c - t * vp;\n\t\twhile (c_ > 0) {\n\t\t\ttime = (c - c_) / (vd - vp);\n\t\t\tc_ -= time * vp;\n\t\t\tif (c_ <= 0)\n\t\t\t\tbreak;\n\t\t\tc_ -= (f + (c - c_) / vd) * vp;\n\t\t\tcnt++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef enum ESCAPE_STAGES {\n\tEST_DRAGON_WAKE_UP,\n\tEST_DRAGON_REACH_PRINCESS,\n\tEST_DRAGON_BACK,\n\tEST_DRAGON_MAKE_CLEAN,\n} EscapeStages;\n\nint main(int argc, char **argv) {\n\t\n\tint vp;\n\tint vd;\n\tint t;\n\tint f;\n\tint c;\n\t\n// \tvp = 5;\t\t// predkosc ksiezniczki w milach na godzine\n// \tvd = 8;\t\t// predkosc smoka w milach na godzine\n// \tt = 1;\t // czas po kt\u00f3rym smok spostrzega ze ksiezniczka uciekla\n// \tf = 2;\t // czas spedzony w skarbcu przez smoka na uporzadkowanie\n// \tc = 100;\t// liczba mil od cave'a smoka do zamku\n\t\n\tif( scanf(\"%d\", &vp) == -1 ) return -1;\n\tif( scanf(\"%d\", &vd) == -1 ) return -1;\n\tif( scanf(\"%d\", &t) == -1 ) return -1;\n\tif( scanf(\"%d\", &f) == -1 ) return -1;\n\tif( scanf(\"%d\", &c) == -1 ) return -1;\n\t\n\tEscapeStages es = EST_DRAGON_WAKE_UP;\n\tdouble princessDistance = 0;\n\tdouble dragonDistance = 0;\n\tint numberOfDroppedDiamond = 0;\n\tint vc = (vd-vp);\n\t\n\t// if dragons speed is smaller or equal then princess', return 0 diamonds\n\tif(vc<=0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\t\n\twhile( princessDistance < c ) {\n\t\tswitch(es) {\n\t\t\tcase EST_DRAGON_WAKE_UP:\n\t\t\t\tprincessDistance += vp*t;\n\t\t\t\tes = EST_DRAGON_REACH_PRINCESS;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_REACH_PRINCESS:\n\t\t\t\tprincessDistance += (double)vp*(double)(princessDistance/(double)vc);\n\t\t\t\tdragonDistance = princessDistance;\n\t\t\t\tif(princessDistance<c) numberOfDroppedDiamond++;\n\t\t\t\tes = EST_DRAGON_BACK;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_BACK:\n\t\t\t\tprincessDistance += (double)(dragonDistance/(double)vd)*(double)vp;\n\t\t\t\tdragonDistance = 0;\n\t\t\t\tes = EST_DRAGON_MAKE_CLEAN;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_MAKE_CLEAN:\n\t\t\t\tprincessDistance += f*vp;\n\t\t\t\tes = EST_DRAGON_REACH_PRINCESS;\n\t\t\t\tbreak;\n\t\t};\n\t}\n\t\n\tprintf(\"%d\\n\", numberOfDroppedDiamond);\n\t\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint vp,vd,t,f,c;\n\tint i;\n\t\n\tscanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&vp,&vd,&t,&f,&c);\n\t\n\t\tif(vp>=vd){printf(\"0\"); return 0;}\n\t\n\tdouble a = c/(vp+0.0);\n\tdouble dist=vp*t;\n\tdouble curr = t;\n\tint ruby=0;\n\t\n\tfor(i=0;;i++){\n\t\tcurr = curr+(dist/(vd-vp+0.0));\n\t\tif(curr>=a){break;}\n\t\truby++;\n\t\tcurr = curr+(dist/(vd-vp+0.0))+f;\n\t\tdist = curr*vp;\n\t}\n\t\n\tprintf(\"%d\\n\",ruby);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k=0;\nfloat m,n,f,t,x=0,p=0,c;\nscanf(\"%f%f%f%f%f\",&m,&n,&t,&f,&c);\nx=t*m;\nnext:\np=(x/(n-m));\nif((p*n)>=c || m>n)\n{\nprintf(\"%d\",k);\ngoto dk;\n}\nelse\n{\nk++;\nx=x+(2*p*m+f*m);\ngoto next;\n}\ndk:\nreturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char *argv[])\n{\n\t\tint b = 0;\n\t\tdouble vp, vd, t, f, c, d;\n\n\t\tscanf(\"%lf %lf %lf %lf %lf\", &vp, &vd, &t, &f, &c);\n\n\t\tif(vp >= vd)\n\t\t{\n\t\t\tputs(\"0\");\n\t\t\treturn;\n\t\t}\n\n\t\td = vd * vp * t / (vd - vp);\n\t\twhile(d < c)\n\t\t{\n\t\t\tb ++;\n\t\t\td = vd * (d + vp * (d / vd + f)) / (vd - vp);\n\t\t}\n\n\t\tprintf(\"%d\\n\", b);\n\t\t\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nfloat vp,vd,f,c,t,i,j,d=0,t1;\nint ans=0;\nscanf(\"%f %f %f %f %f\",&vp,&vd,&t,&f,&c);\nif((vp>vd)||((vp==vd)&&(t>0)))\n {\n printf(\"0\");\n return 0;\n }\nd=vp*t;\nd+=(d*vp)/(vd-vp);\nwhile(1)\n{\n //printf(\" d= %d\\n\",d);\n if(d<c)\n ans++;\n else\n break;\nd+=(vp*f+ ((d*vp)/vd));\nd+=((d*vp)/(vd-vp));\n}\nprintf(\"%d\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n int b=0;\n double t,p,d,f,c,sp=0,dt,backt;\n scanf(\"%lf%lf%lf%lf%lf\",&p,&d,&t,&f,&c);\n if(p<d)\n {\n while(1)\n {\n sp+=t*p;\n if(sp>=c)\n break;\n dt=sp/(d-p);\n sp+=dt*p;\n if(sp>=c)\n break;\n else\n {\n b++;\n backt=sp/d;\n sp+=backt*p;\n t=f;\n }\n }\n }\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n double vp,vd,t,f,c,x,e,d;int g=0;\n scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n d=vp*t;\n c=c-d;\n if(vd>vp)\n {\n v:\n t=d/(vd-vp);\n e=vp*t;\n c=c-e;\n if(c>0)\n {\n g++;\n d=d+e;\n t=d/vd;\n d=d+(vp*(t+f));\n c=c-(vp*(t+f));\n goto v;\n }\n }\n printf(\"%d\",g);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat vp,vd,t,f,c;\n\tscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\tfloat distance=0;\n\tint i,count=0,flag=0;\n\tif(vp>=vd)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tdistance=vp*t;\n\twhile(distance < c)\n\t{\t\n\t\tif(flag==1){\n\t\t\tcount++;\n\t//\t\tprintf(\"%d \",count);\n\t\t\tflag=0;\n\t\t\tt+=f;\n\t\t}\n\t\telse{ \n\t\t\tflag=1;\n\t\t\tt=distance/(vd-vp);\n\t\t}\n\t\tdistance+=vp*t;\n//\t\tprintf(\"%f\\n\",distance);\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{float vp,vd,vr,t,f,c,y,d=0,k=0,x;\nscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\nif(vd>vp)\nvr=vd-vp;\nelse\n{\n printf(\"0\"); goto flag;\n}\nx=t*vp;d+=x;\nwhile(d<c)\n{\ny=d/vr;\nd+=y*vp;\nif(d>=c)\nbreak;\nd+=y*vp;\nk++;\nd+=f*vp;\n}\nprintf(\"%d\",(int)k);\nflag:\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n float vp,vd,t,f,c;\n float phm,d=0,time=0;\n int bijous=0;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n for(phm=t*vp;;){\n //printf(\"%f\\n\",phm);\n if(vd<=vp)\n break;\n phm+=phm*vp/(vd-vp);\n if(phm>=c)\n break;\n else{\n phm+=f*vp+(phm/vd)*vp;\n bijous++;\n }\n\n }\n printf(\"%d\",bijous);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n int vp,vd,t,f,c,i,count;\n double t1,t2,c2;\n while (scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c)!=EOF) {\n count = 0;\n if (vp>=vd) {\n printf(\"0\\n\");\n continue;\n }\n t1 = c/vp;\n if (t>=t1) {\n printf(\"0\\n\");\n continue;\n }\n count = 0;\n c2 = t*vp+(double)(t*vp)/(vd-vp)*vp;\n while (1) {\n if (c2>=c) break;\n count ++;\n t2 = c2/vd+f;\n c2 += t2*vp;\n c2 += c2/(vd-vp)*vp;\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int vp,vd,t,f,c,num=0;\n double sd,sp,time;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n if(vp>=vd)\n {\n printf(\"0\");\n }\n else\n {\n sp=t*vp;\n while(c>sp)\n {\n time=sp/(vd-vp);\n if((c-sp)/vp<=time)\n {\n break;\n }\n sp=sp+time*vp*2+f*vp;\n num++;\n }\n printf(\"%d\",num);\n }\n return 0;\n}\n\n \t\t\t \t \t \t \t \t \t\t \t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n \n///_____________________________________________________________________________________________________________////\n///___________________________ 30 B. Escape\n int v_princess,v_dragon,start_time,repair_time,distance,cnt=0;\n scanf(\"%i %i %i %i %i\",&v_princess,&v_dragon,&start_time,&repair_time,&distance);\n\n float x0=v_princess*start_time;\n float t0=start_time+x0/(v_dragon-v_princess); ///1st catch time\n x0=v_princess*t0;///1st catch distance\n while(x0<distance )\n {\n cnt++;\n t0=repair_time+x0/v_dragon; ///time to start chasing time\n x0=x0+v_princess*t0; /// start chasing dis\n\n\n t0=x0/(v_dragon-v_princess); /// catch time\n x0=x0+v_princess*t0; /// catch dis\n }\n if (x0>=distance && v_dragon> v_princess)\n printf(\"%i\",cnt);\n else\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double vp, vd, t, f, c ,tt,h,st=0.0;\n int num = 0;\n scanf(\"%lf%lf%lf%lf%lf\", &vp, &vd, &t, &f, &c);\n tt = c / vp;\n if (vp >= vd || t*vp >= (tt - t)*(vd - vp))\n {\n printf(\"%d\",0);\n \n }\n else\n {\n while (st < tt)\n {\n ++num;\n h = t*vp / (vd - vp);\n t = t+2*h + f;\n st = t+ t*vp / (vd - vp);\n }\n printf(\"%d\", num);\n }\n \n return 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint vp, vd, t, f, c;\n\tscanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n\tdouble tt = t;\n\tint cc = 0;\n\twhile (1) {\n\t\tdouble t = vp*tt / (vd - vp);\n\n\t\tif (!(vd*t + 1e-9 < c))\n\t\t\tbreak;\n\n\t\tcc++;\n\t\ttt += 2*t + f;\n\n\t}\n\n\tprintf(\"%d\\n\", cc);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0,j=1,p=0;\n int A[100001];\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n count=k*m;\n while(count<d){\n count=count+k*(count/(l-k));\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n \n printf(\"%d\",p);\n \n // getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0,j=1,p=0;\n int A[100001];\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n count=k*m;\n while(count<d){\n count=count+(count/(l-k));\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n printf(\"%d\",p);\n \n // getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0,j=1,p=0;\n int A[100001];\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n count=k*m;\n while(count<d){\n count=count+k*(count/(l-k));\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n printf(\"%d\",p);\n \n // getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0,j=1,p=0;\n int A[100001];\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n count=k*m;\n if(l<k){\n printf(\"0\");\n }else{ \n while(count<d){\n count=count+k*(count/(l-k));\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n printf(\"%d\",p);\n }\n // getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0,j=1,p=0;\n int A[100001];\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n count=k*m;\n if(l<=k){\n printf(\"0\");\n }else{ \n while(count<d){\n count=count+k*(count/(l-k));\n if(count<d){\n p++;\n count=count+(k*((count/l)+n));\n }\n } \n \n printf(\"%d\",p);\n }\n // getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nfloat vp,vd,t,f,c,t1,t2;\nint cnt=0;\nscanf(\"%f %f %f %f %f\",&vp,&vd,&t,&f,&c);\nfloat dp=c;\nif(vp>=vd)\nprintf(\"0\");\nelse\n{while(dp>0)\n{if(dp==c)\ndp-=vp*t;\nt1=(c-dp)/(vd-vp);\ndp-=t1*vp;\nif(dp>0)\ncnt++;\nt2=(c-dp)/vd+f;\ndp-=t2*vp;\n}}\nprintf(\"%d\",cnt);\nreturn(0);}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nfloat vp,vd,t,f,c,t1,t2;\nint cnt=0;\nscanf(\"%f %f %f %f %f\",&vp,&vd,&t,&f,&c);\nfloat dp=c;\nif(vp>=vd)\nprintf(\"0\");\nelse\n{while(dp>0)\n{if(dp==c)\ndp-=vp*t;\nt1=(c-dp)/(vd-vp);\ndp-=t1*vp;\nif(dp>0)\ncnt++;\nt2=(c-dp)/vd+f;\ndp-=t2*vp;\n}}\nif(cnt>0)\nprintf(\"%d\",cnt);\nreturn(0);}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tint prinsum=c-vp*t,h,reg=0;\n\tif (vp<vd)\n\t{\n\twhile (1)\n\t{\n\t\th=(c-prinsum)/(vd-vp);\n\t\tprinsum-=h*vp;\n\t\tif (prinsum<=0) break;\n\t\treg++;\n prinsum-=(h+f)*vp;\n\t\tif (prinsum<=0) break;\n\t}\n\tprintf(\"%d\\n\",reg);\n\t}\n\telse printf(\"0\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tint prinsum=c-vp*t,h,reg=0;\n\tif (vp<vd && prinsum>0)\n\t{\n\twhile (1)\n\t{\n\t\th=(c-prinsum)/(vd-vp);\n\t\tprinsum-=h*vp;\n\t\tif (prinsum<=0) break;\n\t\treg++;\n prinsum-=(h+f)*vp;\n\t\tif (prinsum<=0) break;\n\t}\n\tprintf(\"%d\\n\",reg);\n\t}\n\telse printf(\"0\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int vp, vd, t, f, c, res=0;\n float sp=0,time;\n float eps = 1e-7;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n \n if(vp>=vd){\n printf(\"0\");\n return 0;\n }\n\n sp = t*vp;\n while(1){\n time=sp/(vd-vp);\n sp+=time*vp;\n if(sp-c>=-eps){\n printf(\"%d\",res);\n break;\n }\n res++;\n sp+=(sp*(f+vp/vd));\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float vp,vd,t,f,d2,count,d1,k;\n int c;\n scanf(\"%f%f%f%f%d\",&vp,&vd,&t,&f,&c);\n d1=vp*t;count=0;d2=0;k=0;\n for(;d1<c;)\n {\n d1+=1;\n d2+=vd/vp;k+=1/vp;\n if(d2>=d1 && d1<c)\n {\n //printf(\"%f %f\\n\",d1,d2);\n d2=0;d1+=vp*f+vp*k;\n k=0;\n count+=1;\n }\n }\n printf(\"%0.0f\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double count=0;\n double d1,t,f,c,vp,vd;\n scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c);\n d1=vp*t;\n while(d1<c)\n {\n t=d1/(vd-vp);\n d1+=t*vp;\n if(d1<c)\n count++;\n d1+=t*vp+f*vp;\n }\n printf(\"%0.0lf\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float vp,vd,t,f,d2,count,d1,k;\n int c;\n scanf(\"%f%f%f%f%d\",&vp,&vd,&t,&f,&c);\n d1=vp*t;count=0;d2=0;k=0;\n for(;d1<c;)\n {\n d1+=vp;\n d2+=vd;k++;\n if(d2>=d1 && d1<c)\n {\n //printf(\"%f %f\\n\",d1,d2);\n d2=0;d1+=vp*f+vp*k;\n k=0;\n count+=1;\n }\n }\n printf(\"%0.0f\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%d %d\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%d %d\\n\",dist,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tif(ctr>1)\n\tprintf(\"2\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%d %d\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%d %d\\n\",dist,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tif(ctr>1)\n\tprintf(\"2\\n\");\n\telse\n\tputs(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%d %d\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%d %d\\n\",s,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tt2+=t1;\n\t}\n\tprintf(\"%d\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\twhile(c>0)\n\t{\n\t\ts=vp*(2*t1+f);\n\t\tt1=vp*(2*t+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\tif(c>0)\n\t\tctr++;\n\t}\n\tprintf(\"%d\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%d %d\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%d %d\\n\",dist,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tprintf(\"%d\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%d %d\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%d %d\\n\",s,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tprintf(\"%d\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tdouble vp,vd,t,f,c,C,s,ctr=0,t1,dist,t2;\n\tscanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&C);\n\tc=C;\n\ts=vp*t;\n\tc=c-s;\n\tt1=vp*t/(vd-vp);\n\ts=vp*t1;\n\tc=c-s;\n\tif(c>0)\n\tctr++;\n\tdist=C-c;\n\t//printf(\"%lf %lf\\n\",dist,c);\n\tt2=t1;\n\twhile(c>0)\n\t{\n\t\tt2=dist/vd;\n\t\ts=vp*(2*t2+f);\n\t\tt1=vp*(2*t2+f)/(vd-vp);\n\t\ts+=vp*t1;\n\t\tc=c-s;\n\t\t//printf(\"%lf %lf\\n\",dist,c);\n\t\tif(c>0)\n\t\tctr++;\n\t\tdist=C-c;\n\t}\n\tprintf(\"%.lf\\n\",ctr);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\n\n\nint main(void)\n{\n\n int vp,vd,t,f,c;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\n int dist=c;\n int bijou = 0;\n dist = c-t*vp;\n\n while(dist>0)\n {\n\n int gap = c-dist;\n int time = gap/(abs(vd-vp));\n dist = dist-time*vp;\n if(dist>0)\n {\n bijou+=1;\n dist = dist-((c-dist)/vd+f)*vp;\n }\n\n\n }\n\n\n printf(\"%d\\n\",bijou); \n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\n\n\nint main(void)\n{\n\n float vp,vd,t,f,c;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\n float dist=c;\n int bijou = 0;\n dist = c-t*vp;\n\n while(dist>0)\n {\n\n float gap = c-dist;\n float time = gap/(abs(vd-vp));\n dist = dist-time*vp;\n if(dist>0)\n {\n bijou+=1;\n dist = dist-((c-dist)/vd+f)*vp;\n }\n\n\n }\n\n\n printf(\"%d\\n\",bijou); \n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid solve(){\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tint tm = 0,s1 = 0,s2 = 0,Ans = 0;\n\tif(vp>=vd){\n\t\tputs(\"0\");\n\t\treturn;\n\t} \n\ts1 = vp*t;\n\twhile(s1<c){\n\t\ttm++;t++;\n\t\ts1 = vp*t;\n\t\ts2 = tm*vd;\n\t\tprintf(\"%d %d\\n\",s1,s2);\n\t\tif (s1<=s2 && s1<c) {\n\t\t\tAns++;\n\t\t\tt += f+tm;\n\t\t\ttm = 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",Ans);\n}\nint main(){\n\tsolve();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid solve(){\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tint tm = 0,Ans = 0;\n\tif(vp>=vd){\n\t\tputs(\"0\");\n\t\treturn;\n\t}\n\tdouble s1 = 0,s2 = 0;\n\ts1 = (double) vp*t;\n\twhile(s1<c){\n\t\ts1+=vp;\n\t\ts2+=vd;\n\t\t// printf(\"%f %f\\n\",s1,s2);\n\t\tif (s1<=s2 && s1<c) {\n\t\t\tAns++;\n\t\t\tdouble tm = s1/vd;\n\t\t\ts1 += (vp *(tm+f));\n\t\t\ts2 = 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",Ans);\n}\nint main(){\n\tsolve();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid solve(){\n\tint vp,vd,t,f,c;\n\tscanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n\tint tm = 0,s1 = 0,s2 = 0,Ans = 0;\n\tif(vp>=vd){\n\t\tputs(\"0\");\n\t\treturn;\n\t} \n\ts1 = vp*t;\n\twhile(s1<c){\n\t\ttm++;t++;\n\t\ts1 = vp*t;\n\t\ts2 = tm*vd;\n\t\tif (s1<=s2 && s1<c) {\n\t\t\tAns++;\n\t\t\tt += f+tm;\n\t\t\ttm = 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",Ans);\n}\nint main(){\n\tsolve();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\t// your code goes here\n\tint vp,vd,t,f,c,k=0,sum;\n\tscanf(\"%d %d %d %d %d\", &vp,&vd,&t,&f,&c);\n\tif(vp>=vd)\n\t{printf(\"0\");\n\treturn 0;}\n\tsum=t*vp;\n\twhile(sum<c)\n\t{\n\t\tsum+=(sum/(vd-vp))*vp;\n\t\tif(sum>=c)\n\t\tbreak;\n\t\tk++;\n\t\tsum+=(sum/vd +f)*vp;\n\t}\n\tprintf(\"%d\", k);\n \n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\nif(vp > vd)\nprintf(\"0\");\nelse if( vp == vd && escape_time == 0)\n{\nprintf(\"1\");\n}\nelse if( vp == vd )\n{\nprintf(\"0\");\n}\n\nelse\n{\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_p_travled < distance ;\n treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n d_p_travled += vp*t_dragon;\n }\n }\n printf(\"%.0f\",treasure);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\n\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_p_travled < distance ;\n treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n d_p_travled += vp*t_dragon;\n }\n printf(\"%.0f\",treasure);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\n\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_remain > 0 ;\n d_remain-= d_p_travled ,treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n d_p_travled += vp*t_dragon;\n }\n printf(\"%.0f\",treasure);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nfloat vp , vd , escape_time , rest_time , distance ,d_p_travled , treasure , catch_time , t_dragon;\nint main()\n{\nscanf(\"%f\\n%f\\n%f\\n%f\\n%f\",&vp,&vd,&escape_time,&rest_time,&distance);\n\n//printf(\"%d %d %d %d %d\",vp,vd,escape_time,rest_time,distance);\n\nfor(float vr = vd-vp , d_p_travled = vp*escape_time, d_remain = distance-d_p_travled ;\n d_p_travled < distance ;\n treasure++)\n {\n catch_time = d_p_travled/vr;\n d_p_travled += vp * catch_time;\n printf(\"d_p: %f \",d_p_travled);\n if(d_p_travled >= distance)\n break;\n t_dragon = (d_p_travled/vd) + rest_time ;\n printf(\"\\tt_d: %f\",t_dragon);\n d_p_travled += vp*t_dragon;\n printf(\"\\td_p: %f\\n\",d_p_travled);\n }\n printf(\"%.0f\",treasure);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n double p,d,t,f,c;\n double count;\n double dis,between,cave,ret;\n while (scanf(\"%lf%lf%lf%lf%lf\",&p,&d,&t,&f,&c)!=EOF)\n {\n between=p*t;\n dis=c-between;\n cave=between;\n count=0;\n while(dis>0)\n {\n t=between/(d-p);\n dis-=p*t;\n if (dis<=0) break;\n count++;\n cave+=p*t;\n ret=cave/d;\n between=ret*p+f*p;\n dis-=between;\n between+=cave;\n cave=0;\n }\n printf(\"%d\\n\",(int)count);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n double p,d,t,f,c;\n double count;\n double dis,between,cave,ret;\n while (scanf(\"%lf%lf%lf%lf%lf\",&p,&d,&t,&f,&c)!=EOF)\n {\n dis=c-p*t;\n between=p*t;\n cave=p*t;\n count=0;\n while(dis>0)\n {\n t=between/(d-p);\n dis-=p*t;\n count++;\n if (dis<0) break;\n cave+=p*t;\n ret=cave/d;\n between=ret*p+f*p;\n dis-=between;\n cave=0;\n }\n printf(\"%d\\n\",(int)count-1);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define EPS 1e-10\n\nint \nmain(int argc, const char *argv[])\n{\n int vp, vd, t, f, c;\n double tz, td, to;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n if (vd <= vp) {\n printf(\"0\\n\");\n return 0;\n }\n\n int n = 0;\n\n tz = t * 1.0;\n while (1) {\n td = tz * ((vd * 1.0) / (vd - vp));\n to = tz + td;\n tz = to + td + (f * 1.0);\n if (to + EPS < (c / (vp * 1.0))) {\n n++;\n } else {\n break;\n }\n }\n\n printf(\"%d\\n\", n);\n\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define EPS 1e-10\n\nint \nmain(int argc, const char *argv[])\n{\n int vp, vd, t, f, c;\n double tz, td, to;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n if (vd <= vp) {\n printf(\"0\\n\");\n return 0;\n }\n\n int n = 0;\n\n tz = t * 1.0;\n td = tz * ((vd * 1.0) / (vd - vp));\n while (1) {\n to = tz + td;\n tz = to + td + (f * 1.0);\n if (to + EPS < (c / (vp * 1.0))) {\n n++;\n } else {\n break;\n }\n }\n\n printf(\"%d\\n\", n);\n\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define EPS 1e-10\n\nint \nmain(int argc, const char *argv[])\n{\n int vp, vd, t, f, c;\n double tz, td, to;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n int n = 0;\n\n tz = t * 1.0;\n td = tz * ((vd * 1.0) / (vd - vp));\n while (1) {\n to = tz + td;\n tz = to + td + (f * 1.0);\n if (to + EPS < (c / (vp * 1.0))) {\n n++;\n } else {\n break;\n }\n }\n\n printf(\"%d\\n\", n);\n\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define EPS 1e-10\n\nint \nmain(int argc, const char *argv[])\n{\n int vp, vd, t, f, c;\n double tz, td, to;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n if (vd <= vp) {\n printf(\"0\\n\");\n return 0;\n }\n\n int n = 0;\n\n tz = t * 1.0;\n td = tz * ((vd * 1.0) / (vd - vp));\n while (1) {\n to = tz + td;\n tz = to + td + (f * 1.0);\n if (to <= (c / (vp * 1.0))) {\n n++;\n } else {\n break;\n }\n }\n\n printf(\"%d\\n\", n);\n\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int vp1,vd1,t1,f1,c1,count;\n float dist,n,vp,vd,t,f,c;\n count=0;\n scanf(\"%d %d %d %d %d\",&vp1,&vd1,&t1,&f1,&c1);\n vp=vp1;\n vd=vd1;\n t=t1;\n f=f1;\n c=c1;\n dist=vp*t;\n count=0;\n if(dist>=c)\n printf(\"%d\",count);\n else if(vd>=vp)\n printf(\"%d\",count);\n else\n {\n while(1)\n {\n n=(float)(dist)/(float)(vd-vp);\n dist+=(n*vp);\n if(dist>=c)\n {\n printf(\"%d\",count);\n break;\n }\n count++;\n n=((float)(dist)/(float)(vd))+f;\n dist+=(n*vp);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int vp, vd, t, f, c, sum = 1;\n double x, y;\n\n scanf(\"%d %d %d %d %d\", &vp, &vd, &t, &f, &c);\n\n if (vp >= vd || vp * t >= c || vd * vp * t >= c * (vd - vp)) {\n\t puts(\"0\");\n\n\t return 0;\n }\n\n x = (double)vp * t / (vd - vp);\n y = vp * (t + x);\n\n while (1) {\n\t y += vp * (x + f);\n\t x = y / (vd - vp);\n\n\t if (y + vp * x >= c) break;\n\n\t sum++;\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int vp, vd, t, f, c, sum = 1;\n double x, y;\n\n scanf(\"%d %d %d %d %d\", &vp, &vd, &t, &f, &c);\n\n if (vp >= vd || vp * t >= c || vp * vp * t >= c * (vd - vp)) {\n\t puts(\"0\");\n\n\t return 0;\n }\n\n x = (double)vp * t / (vd - vp);\n y = vp * (t + x);\n\n while (1) {\n\t y += vp * (x + f);\n\t x = y / (vd - vp);\n\n\t if (y + vp * x >= c) break;\n\n\t sum++;\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int vp, vd, t, f, c;\n double sp, sd, buf_t;\n int b;\n\n scanf(\"%d%d%d%d%d\", &vp, &vd, &t, &f, &c);\n\n sp = vp * t;\n sd = 0;\n b = 0;\n\n while (1) {\n buf_t = sp / (vd - vp);\n sp = sp + vp * buf_t;\n sd = vd * buf_t;\n if (sp >= c) break;\n b++;\n sd = 0;\n sp = sp + vp * (buf_t + f);\n }\n \n printf(\"%d\", b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main (void){\n int vp, vd, t, f, c;\n scanf (\"%d%d%d%d%d\",&vp, &vd, &t, &f, &c);\n int bazmek = 0;\n double ubehla = t * vp;\n while (ubehla < c) {\n double za_jak_dlouho_se_potkali = (ubehla) / (vd - vp);\n ubehla = ubehla + vp * za_jak_dlouho_se_potkali;\n if (ubehla+0.000001 >= c) {\n break;\n } else {\n bazmek++;\n double jak_dlouho_se_vraci = ubehla / vd;\n ubehla = ubehla + vp * (jak_dlouho_se_vraci + f);\n }\n }\n printf(\"%d\\n\", bazmek);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main (void){\n int vp, vd, t, f, c;\n scanf (\"%d%d%d%d%d\",&vp, &vd, &t, &f, &c);\n int bazmek = 0;\n double ubehla = t * vp;\n while (ubehla < c) {\n double za_jak_dlouho_se_potkali = (ubehla) / (vd - vp);\n ubehla = ubehla + vp * za_jak_dlouho_se_potkali;\n if (ubehla >= c) {\n break;\n } else {\n bazmek++;\n double jak_dlouho_se_vraci = ubehla / vd;\n ubehla = ubehla + vp * (jak_dlouho_se_vraci + f);\n }\n }\n printf(\"%d\\n\", bazmek);\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n float vp,vd,t,f,c,tt;\n int i,N=0;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n do\n {\n tt=(vp*t)/(vd-vp);\n if((tt*vd)<c)\n N++;\n t+=tt+tt+f;\n }while((vd*tt)<c);\n printf(\"%d\",N);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef enum ESCAPE_STAGES {\n\tEST_DRAGON_WAKE_UP,\n\tEST_DRAGON_REACH_PRINCESS,\n\tEST_DRAGON_BACK,\n\tEST_DRAGON_MAKE_CLEAN,\n} EscapeStages;\n\nint main(int argc, char **argv) {\n\t\n// \tint vp = 1; // predkosc ksiezniczki w milach na godzine\n// \tint vd = 100;\t// predkosc smoka w milach na godzine\n// \tint t = 10;\t // czas po kt\u00f3rym smok spostrzega ze ksiezniczka uciekla\n// \tint f = 10;\t // czas spedzony w skarbcu przez smoka na uporzadkowanie\n// \tint c = 1000;\t// liczba mil od cave'a smoka do zamku\n\t\n\tint vp;\n\tint vd;\n\tint t;\n\tint f;\n\tint c;\n\t\n\tif( scanf(\"%d\", &vp) == -1 ) return -1;\n\tif( scanf(\"%d\", &vd) == -1 ) return -1;\n\tif( scanf(\"%d\", &t) == -1 ) return -1;\n\tif( scanf(\"%d\", &f) == -1 ) return -1;\n\tif( scanf(\"%d\", &c) == -1 ) return -1;\n\t\n\tEscapeStages es = EST_DRAGON_WAKE_UP;\n\tdouble princessDistance = 0;\n\tdouble dragonDistance = 0;\n\tint numberOfDroppedDiamond = 0;\n\tint vc = (vd-vp);\n\t\n\t// if dragons speed is smaller or equal then princess', return 0 diamonds\n\tif(vc<=0) {\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\t\n\twhile( princessDistance < c ) {\n\t\tswitch(es) {\n\t\t\tcase EST_DRAGON_WAKE_UP:\n\t\t\t\tprincessDistance += vp*f;\n\t\t\t\tes = EST_DRAGON_REACH_PRINCESS;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_REACH_PRINCESS:\n\t\t\t\tprincessDistance += (double)vp*(double)(princessDistance/(double)vc);\n\t\t\t\tdragonDistance = princessDistance;\n\t\t\t\tif(princessDistance<c) numberOfDroppedDiamond++;\n\t\t\t\tes = EST_DRAGON_BACK;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_BACK:\n\t\t\t\tprincessDistance += (double)(dragonDistance/(double)vd)*(double)vp;\n\t\t\t\tdragonDistance = 0;\n\t\t\t\tes = EST_DRAGON_MAKE_CLEAN;\n\t\t\t\tbreak;\n\t\t\tcase EST_DRAGON_MAKE_CLEAN:\n\t\t\t\tprincessDistance += f*vp;\n\t\t\t\tes = EST_DRAGON_REACH_PRINCESS;\n\t\t\t\tbreak;\n\t\t};\n\t}\n\t\n\tprintf(\"%d\\n\", numberOfDroppedDiamond);\n\t\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint m,n,f,t,x=0,p=0,c,k=0;\nscanf(\"%d%d%d%d%d\",&m,&n,&t,&f,&c);\nx=t*m;\nnext:\np=(x/(n-m));\nif((p*n)>=c)\n{\nprintf(\"%d\",k);\ngoto dk;\n}\nelse\n{\nk++;\nx=x+(2*p*m+f*m);\ngoto next;\n}\ndk:\nreturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k=0;\nfloat m,n,f,t,x=0,p=0,c;\nscanf(\"%f%f%f%f%f\",&m,&n,&t,&f,&c);\nx=t*m;\nnext:\np=(x/(n-m));\nif((p*n)>=c)\n{\nprintf(\"%d\",k);\ngoto dk;\n}\nelse\n{\nk++;\nx=x+(2*p*m+f*m);\ngoto next;\n}\ndk:\nreturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nfloat vp,vd,f,c,t,i,j,d=0,t1;\nint ans=0;\nscanf(\"%f %f %f %f %f\",&vp,&vd,&t,&f,&c);\nd=vp*t;\nd+=(d*vp)/(vd-vp);\nwhile(1)\n{\n //printf(\" d= %d\\n\",d);\n if(d<c)\n ans++;\n else\n break;\nd+=(vp*f+ ((d*vp)/vd));\nd+=((d*vp)/(vd-vp));\n}\nprintf(\"%d\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint vp,vd,f,c,t,i,j,ans=0,td=0,t1;\n\nscanf(\"%d %d %d %d %d\",&vp,&vd,&t,&f,&c);\ntd=vd*t;\nt1=td/(vd-vp)+t;\nwhile(1)\n{\n //printf(\"t1 = %d and td= %d\\n\",t1,td);\n if(td<c)\n ans++;\n else\n break;\n t1+=td/(vd-vp);\ntd+=(vp*f+((t1*vp)));\n}\nprintf(\"%d\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n int p,d,t,f,c,b=0,sp=0,dt,pt,backt;\n scanf(\"%d%d%d%d%d\",&p,&d,&t,&f,&c);\n if(p>=d)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n {\n while(1)\n {\n sp+=t*p;\n if(sp>=c)\n break;\n dt=sp/(d-p);\n sp+=dt*p;\n if(sp>=c)\n break;\n else\n {\n b++;\n backt=sp/d;\n sp+=backt*p;\n t=f;\n }\n }\n }\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat vp,vd,t,f,c;\n\tscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\tfloat distance=0;\n\tint i,count=0,flag=0;\n\tif(vp>=vd)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tdistance=vp*t;\n\twhile(distance < c)\n\t{\t\n//\t\tprintf(\"%f\\n\",distance);\n\t\tdistance+=vp*t;\n\t\tt=distance/(vd-vp);\n\t\tif(flag==1){\n\t\t\tcount++;\n\t\t\tflag=0;\n\t\t\tt=t+f;\n\t\t}\n\t\telse \n\t\t\tflag=1;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat vp,vd,t,f,c;\n\tscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\tfloat distance=0;\n\tint i,count=0,flag=0;\n\tdistance=vp*t;\n\twhile(distance < c)\n\t{\t\n//\t\tprintf(\"%f\\n\",distance);\n\t\tdistance+=vp*t;\n\t\tt=distance/(vd-vp);\n\t\tif(flag==1){\n\t\t\tcount++;\n\t\t\tflag=0;\n\t\t\tt=t+f;\n\t\t}\n\t\telse \n\t\t\tflag=1;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat vp,vd,t,f,c;\n\tscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n\tfloat distance=0;\n\tint i,count=0,flag=0;\n\tif(vp>=vd)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tdistance=vp*t;\n\twhile(distance < c)\n\t{\t\n//\t\tprintf(\"%f\\n\",distance);\n\t\tt=distance/(vd-vp);\n\t\tif(flag==1){\n\t\t\tcount++;\n\t\t\tflag=0;\n\t\t\tt=t+f;\n\t\t}\n\t\telse \n\t\t\tflag=1;\n\t\tdistance+=vp*t;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{float vp,vd,vr,t,f,c,y,d=0,k=0,x;\nscanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\nvr=vd-vp;\nx=t*vp;d+=x;\nwhile(d<c)\n{\ny=d/vr;\nd+=y*vp;\nif(d>=c)\nbreak;\nd+=y*vp;\nk++;\nd+=f*vp;\n}\nprintf(\"%d\",(int)k);\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int vp,vd,t,f,c;\n int phm,dhm=0,time=0,bijous=0;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n for(phm=t*vp;phm<c;){\n if(dhm>=phm){\n bijous++;\n phm+=(dhm/vd)*vp;\n dhm=0;\n phm+=vp*f;\n }\n else{\n dhm+=vd;\n phm+=vp;\n }\n //printf(\"%d %d\\n\",dhm,phm);\n }\n printf(\"%d\",bijous);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int vp,vd,t,f,c;\n int phm,dhm=0,time=0,bijous=0;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n for(phm=t*vp;phm<c;){\n if(dhm>=phm){\n bijous++;\n phm+=(phm/vd)*vp;\n // if(phm>=c)\n // break;\n dhm=0;\n phm+=vp*f;\n }\n else{\n dhm+=vd;\n phm+=vp;\n }\n //printf(\"%d %d\\n\",dhm,phm);\n }\n printf(\"%d\",bijous);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n float vp,vd,t,f,c;\n float phm,d=0,time=0;\n int bijous=0;\n scanf(\"%f%f%f%f%f\",&vp,&vd,&t,&f,&c);\n for(phm=t*vp;;){\n //printf(\"%f\\n\",phm);\n phm+=phm*vp/(vd-vp);\n if(phm>=c)\n break;\n else{\n phm+=f*vp+(phm/vd)*vp;\n bijous++;\n }\n\n }\n printf(\"%d\",bijous);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n x+=v1*(x/(v2-v1));\n if(x<c)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n if(v1<=v2)\n printf(\"0\\n\");\n else\n printf(\"%d\\n\",count);\n return 0;\n}\n\n\t \t\t\t \t \t \t\t \t \t\t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n double v1,v2,t,f,c,x=0,count=0;\n scanf(\"%lf%lf%lf%lf%lf\",&v1,&v2,&t,&f,&c);\n\n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }if(v1>=v2)\n printf(\"0\\n\");\n else {\n printf(\"%lf\\n\",count);}\n return 0;\n}\n\n \t \t\t \t\t \t\t\t \t\t \t \t \t \t\t\t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int vp,vd,t,f,c,num=-1;\n double sd,sp,s;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n if(vp>vd||vp*t==c)\n {\n printf(\"0\");\n }\n else\n {\n sp=t*vp;\n while(c>sp)\n {\n num++;\n s=sp/(vd-vp);\n sp=sp+vp*s+(sp/vd)*vp+f*vp;\n }\n printf(\"%d\",num);\n }\n return 0;\n}\n\n\t\t \t\t\t \t \t \t \t\t\t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n x+=v1*(x/(v2-v1));\n if(x<c)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n \t\t\t \t \t \t\t\t\t\t\t\t\t \t\t\t\t\t \t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,i1,vp,vd,t,f,c,num=0;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n i1=0;\n for(i=t*vp;c>i;i=vp+i)\n {\n if(i1>0&&i1<vd)\n {\n i1=0;\n }\n if(i1>=i)\n {\n num++;\n i1=-(i+f*vd);\n }\n i1=i1+vd;\n }\n printf(\"%d\",num);\n return 0;\n}\n\n \t \t \t\t \t \t\t\t\t\t\t\t \t\t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n if(v1<=v2)\n printf(\"0\\n\");\n else {\n x+=v1*t;\n while(x<c)\n {\n x+=v1*(x/(v2-v1));\n if(x<c)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);}\n return 0;\n}\n\n \t \t\t\t\t \t \t\t \t\t \t\t\t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n if(v1>=v2)\n printf(\"0\\n\");\n else {\n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);}\n return 0;\n}\n\n\t \t \t \t \t\t\t\t \t\t \t\t \t\t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int vp,vd,t,f,c,num=0;\n double sd,sp,s;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n if(vp>vd||vp*t==c)\n {\n printf(\"0\");\n }\n else\n {\n sp=t*vp;\n while(c>sp)\n {\n s=sp/(vd-vp);\n if(c<=sp+vp*s)\n {\n break;\n }\n sp=sp+vp*s+(sp/vd)*vp+f*vp;\n num++;\n }\n printf(\"%d\",num);\n }\n return 0;\n}\n\n\t\t\t\t\t \t \t\t \t \t\t\t \t \t\t\t\t\t \t \t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,i1,vp,vd,t,f,c,num=0;\n scanf(\"%d %d %d %d %d\",&vp,&vd,&t,&f,&c);\n i1=0;\n for(i=t*vp;c>i;i=vp+i)\n {\n if(i1>=i)\n {\n num++;\n i1=-((i1*2)/vd+f-1)*vd;\n }\n i1=i1+vd;\n }\n printf(\"%d\",num);\n return 0;\n}\n\n\t\t \t\t \t \t \t\t\t \t\t \t \t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n\t \t\t \t \t\t \t\t \t \t\t\t\t\t\t \t \t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n double vp,vd,t,f,c;\n while(~scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c))\n {\n double sum=vp*t;\n double xxx=sum;\n int cou=0;\n while(sum<c)\n {\n sum+=xxx*vp/(vd-vp);\n xxx=sum;\n if(sum<c)\n cou++;\n sum+=(xxx/vd+f)*vp;\n xxx=sum;\n }\n printf(\"%d\\n\",cou);\n }\n return 0;\n}\n\n\t \t\t \t \t\t\t\t \t \t\t\t\t \t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,i1,vp,vd,t,f,c,num=0;\n scanf(\"%d %d %d %d %d\",&vp,&vd,&t,&f,&c);\n i1=0;\n for(i=t*vp;c>i;i=vp+i)\n {\n if(i1>=i)\n {\n num++;\n i1=-(i1+f*vd);\n }\n i1=i1+vd;\n }\n printf(\"%d\",num);\n return 0;\n}\n\n \t \t\t\t \t \t \t\t\t\t \t\t \t \t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n double v1,v2,t,f,c,x=0,count=0;\n scanf(\"%lf%lf%lf%lf%lf\",&v1,&v2,&t,&f,&c);\n\n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }if(v1>=v2)\n printf(\"0\\n\");\n else {\n printf(\"%lf\\n\",count);}\n return 0;\n}\n\n \t\t \t \t \t \t\t\t\t\t\t \t\t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n if(v1>=v2)\n printf(\"0\\n\");\n else {\n x+=v1*t;\n while(x<c)\n {\n x+=v1*(x/(v2-v1));\n if(x<c)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);}\n return 0;\n}\n\n\t \t\t\t \t \t\t\t\t \t \t\t\t \t \t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n x+=v1*(x/(v2-v1));\n if(x<c&&count<2)\n count++;\n if(count>=2)\n {\n break;\n }\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n\t\t \t\t\t\t \t \t\t\t\t \t \t \t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n if(count==0||count==1)\n x+=v1*(x/(v2-v1));\n if(x<c)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n\t\t \t\t\t \t\t \t\t \t\t\t\t\t \t \t \t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,i1,i2,vp,vd,t,f,c,num=0;\n scanf(\"%d%d%d%d%d\",&vp,&vd,&t,&f,&c);\n i1=0;\n i2=0;\n for(i=t*vp;c>i;i=vp+i)\n {\n if(i1>=i)\n {\n num++;\n i2=f+i1/vd;\n i1=0;\n }\n if(i2!=0)\n {\n i2--;\n }\n else\n {\n i1=i1+vd;\n }\n }\n printf(\"%d\\n\",num);\n return 0;\n}\n\n \t\t \t\t\t \t \t \t\t \t \t\t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n \n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }if(v1>=v2)\n printf(\"0\\n\");\n else {\n printf(\"%d\\n\",count);}\n return 0;\n}\n\n\t\t\t\t \t \t\t\t \t \t\t \t \t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n double vp,vd,t,f,c;\n while(~scanf(\"%lf%lf%lf%lf%lf\",&vp,&vd,&t,&f,&c))\n {\n double sum=vp*t;\n double xxx=sum;\n int cou=0;\n while(sum<c)\n {\n sum+=(xxx*vp)/(vd-vp);\n xxx=sum;\n if(sum<c)\n cou++;\n sum+=(xxx/vd)*vp+f*vp;\n xxx=sum;\n }\n printf(\"%d\\n\",cou);\n }\n return 0;\n}\n\n \t\t\t \t \t \t\t \t \t \t \t\t\t\t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x=0,count=0;\n scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c);\n x+=v1*t;\n while(x<c)\n {\n if(count==0||count==1)\n x+=v1*(x/(v2-v1));\n if(x<c&&count<2)\n count++;\n x+=v1*(x/v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n\t \t\t \t \t \t \t\t\t \t \t\t\t \t\t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int v1,v2,t,f,c,x,count;\n while(~scanf(\"%d%d%d%d%d\",&v1,&v2,&t,&f,&c))\n {\n x=0;\n count=0;\n x+=v1*t;\n while(x<c)\n {\n x+=v1*((double)x/(double)(v2-v1));\n if(x<c)\n count++;\n x+=v1*((double)x/(double)v2);\n x+=v1*f;\n }\n printf(\"%d\\n\",count);}\n return 0;\n}\n\n\t\t \t \t \t\t \t\t\t\t \t \t \t \t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n\nint main()\n{\n \n///_____________________________________________________________________________________________________________////\n///___________________________ 30 B. Escape\n int v_princess,v_dragon,start_time,repair_time,distance,cnt=0;\n scanf(\"%i %i %i %i %i\",&v_princess,&v_dragon,&start_time,&repair_time,&distance);\n\n float x0=v_princess*start_time;\n float t0=start_time+x0/(v_dragon-v_princess); ///1st catch time\n x0=v_princess*t0;///1st catch distance\n while(x0<distance)\n {\n cnt++;\n t0=repair_time+x0/v_dragon; ///time to start chasing time\n x0=x0+v_princess*t0; /// start chasing dis\n\n\n t0=x0/(v_dragon-v_princess); /// catch time\n x0=x0+v_princess*t0; /// catch dis\n }\n if (x0>=distance)\n printf(\"%i\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double vp, vd, t, f, c ,tt,h,st=0.0;\n int num = 0;\n scanf(\"%lf%lf%lf%lf%lf\", &vp, &vd, &t, &f, &c);\n tt = c / vp;\n if (vp>=vd||t*vp>=(tt-t)*(vd-vp))\n printf(\"%d\", 0);\n else\n {\n while (st < tt)\n {\n ++num;\n h = t*vp / (vd - vp);\n t = t+2*h + f;\n st = t+ t*vp / (vd - vp);\n }\n }\n printf(\"%d\", num);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double vp, vd, t, f, c ,tt,h,st=0.0;\n int num = 0;\n scanf(\"%lf%lf%lf%lf%lf\", &vp, &vd, &t, &f, &c);\n tt = c / vp;\n if (vp>=vd||t*vp>=(tt-t)*(vd-vp))\n printf(\"%d\", 00);\n else\n {\n while (st < tt)\n {\n ++num;\n h = t*vp / (vd - vp);\n t = t+2*h + f;\n st = t+ t*vp / (vd - vp);\n }\n }\n printf(\"%d\", num);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double vp, vd, t, f, c ,tt,h,st=0.0;\n int num = 0;\n scanf(\"%lf%lf%lf%lf%lf\", &vp, &vd, &t, &f, &c);\n tt = c / vp;\n if (vp >= vd || t*vp >= (tt - t)*(vd - vp))\n {\n printf(\"%d%d\", 0,0);\n \n }\n else\n {\n while (st < tt)\n {\n ++num;\n h = t*vp / (vd - vp);\n t = t+2*h + f;\n st = t+ t*vp / (vd - vp);\n }\n }\n printf(\"%d\", num);\n return 0;\n}"}], "src_uid": "c9c03666278acec35f0e273691fe0fff"} {"nl": {"description": "Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and L, and they move towards each other with speed v1 and v2, respectively. Luke has width d and is able to choose any position between the presses. Luke dies as soon as the distance between the presses is less than his width. Your task is to determine for how long Luke can stay alive.", "input_spec": "The first line of the input contains four integers d, L, v1, v2 (1\u2009\u2264\u2009d,\u2009L,\u2009v1,\u2009v2\u2009\u2264\u200910\u2009000,\u2009d\u2009<\u2009L)\u00a0\u2014 Luke's width, the initial position of the second press and the speed of the first and second presses, respectively.", "output_spec": "Print a single real value\u00a0\u2014 the maximum period of time Luke can stay alive for. Your answer will be considered correct if its absolute or relative error does not exceed 10\u2009-\u20096. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .", "sample_inputs": ["2 6 2 2", "1 9 1 2"], "sample_outputs": ["1.00000000000000000000", "2.66666666666666650000"], "notes": "NoteIn the first sample Luke should stay exactly in the middle of the segment, that is at coordinates [2;4], as the presses move with the same speed.In the second sample he needs to occupy the position . In this case both presses move to his edges at the same time."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(){\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.20lf\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l, d, v1, v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n l = l - d;\n v1= v1 + v2;\n x = l/1.0;\n x = x/ v1;\n printf(\"%.20lf\", x);\n return 0;\n}\n\n/* 1490126785896 */\n"}, {"source_code": "#include <stdio.h>\nint main()\n\n{\n float d,l,v1,v2;\n float ans;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n\n ans=(float)((l-d)/(v1+v2));\n\n\n printf(\"%.20f\",ans);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n double d, l, v1, v2, x, y, z;\n scanf (\"%lf%lf%lf%lf\", &d, &l, &v1, &v2);\n x = v1 + v2;\n y = l - d;\n z = y / x;\n printf (\"%lf\", z);\n return 0;\n}\n/* 1504030961328 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d, l, v1, v2, t;\n scanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n t = (l - d) / (v1 + v2);\n printf(\"%lf\", t);\n return 0;\n}\n\n/* 1490033946836 */\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int D, L, v1;\n double R, v2;\n scanf(\"%d %d %d %lf\", &D, &L, &v1, &v2);\n R = (L - D) / (v1 + v2);\n if(R<0)\n {\n R = R * -1;\n }\n if(L<D)\n {\n R = 0.0;\n }\n printf(\"%.20lf\\n\", R);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,L,v1,v2,achi,nai;\n scanf(\"%lf%lf%lf%lf\",&d,&L,&v1,&v2);\n achi=L-d;\n nai=v1+v2;\n printf(\"%.6lf\\n\",achi/nai);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\tint d, l, v1, v2;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\tfloat ans = (l - d) * 1.0 / (v1 + v2);\n\tprintf(\"%f\", ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,a,b;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&a,&b);\n double time;\n time=(l-d)/(a+b);\n printf(\"%lf\\n\",time);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double l,d,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.8lf\",(l-d)/(v1+v2));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int D, L, v1;\n double R, v2;\n scanf(\"%d %d %d %lf\", &D, &L, &v1, &v2);\n R = (L - D) / (v1 + v2);\n if(R<0)\n {\n R = R * -1;\n }\n if(L<D)\n {\n R = 0.0;\n }\n printf(\"%.20lf\\n\", R);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int a,b,c,d;\n\tdouble f;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n\tf=(b-a)*1.0/(c+d);\n\tprintf(\"%0.20f\",f);\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int d, L, v1, v2 ;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2) ;\n float t ;\n t = (L-d)/((v1+v2)*1.0) ;\n printf(\"%.23f\", t) ;\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat a,b,c,d,e;\n\tscanf(\"%f%f%f%f\",&a,&b,&c,&d);\n b=b-a;\n e=b/(d+c);\n printf(\"%.20f\\n\",e);\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n double d,L,v1,v2,tempo;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n tempo=((L-d)/(v1+v2));\n printf(\"%lf\\n\",tempo);\n return 0;\n}\n/* 1504115371192 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float v1,v2,d,l ;\n scanf(\"%f%f%f%f\",&d,&l,&v1,&v2) ;\n printf(\"%f\",(l-d)/(v1+v2)) ;\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tdouble d,l,v1,v2;\n\tdouble t;\n\tscanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n\td=l-d;\n\tt=(double)(d/(v1+v2));\n\tprintf(\"%0.18lf\",t);\n\t// team harshit naman 3.7\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nint d, l, v1, v2;\ndouble tempototal;\n\n\nscanf (\"%d %d %d %d\", &d, &l, &v1, &v2);\n\ntempototal = (double)(l-d)/(double)(v1+v2);\nprintf (\"%lf\\n\", tempototal);\n\nreturn 0;\n}\n\n/* 1490020854472 */\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n double s,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&s,&l,&v1,&v2);\n printf(\"%.20lf\",(l-s)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint d,l,v1,v2;\nfloat x;\nscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\nx=(float)(l-d)/(float)(v1+v2);\nprintf(\"%f\",x);\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint d, L, v1, v2;\n\tscanf(\"%d\", &d);\n\tscanf(\"%d\", &L);\n\tscanf(\"%d\", &v1);\n\tscanf(\"%d\", &v2);\n\t\n\tdouble t = (double) (L-d)/(v1 + v2);\n\t\n\tprintf(\"%f\", t);\n\n \n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n double D, L, V1, V2, T;\n scanf(\"%lf %lf %lf %lf\", &D, &L, &V1, &V2 );\n T = (L - D)/( V1 + V2);\n printf (\"%.20lf\", T);\n\n return 0;\n\n\n\n}\n\n/* 1504030098760 */\n"}, {"source_code": "#include<stdio.h>\nint main(){\n double d,l,v1,v2,t;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n l=(l-d);\n v1=(v1+v2);\n t=(float)l/(float)v1;\n printf(\"%.20f\",t);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n double d, L, V1, V2, X;\n scanf(\"%lf %lf %lf %lf\", &d, &L, &V1, &V2);\n X = (L-d)/(V1+V2);\n printf(\"%.20lf\", X);\n return 0;\n\n}\n/* 1504030920691 */\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n float d,l,v,w,s,u,r;\n scanf(\"%f %f %f %f\",&d,&l,&v,&w);\n s = l - d;\n u = v + w;\n r = s / u;\n printf(\"%f\",r);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,l,v1,v2,y,z,p,q,i,j;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n float x=(l-d)/(v1+v2);\n printf(\"%f\\n\",x);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint d, l, v1, v2;\n\n\tscanf(\"%d%d%d%d\", &d, &l, &v1, &v2);\n\tprintf(\"%.12lf\\n\", (double) (l - d) / (v1 + v2));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{ double d, l, v, w, t, q, r;\n\nscanf(\" %lf %lf %lf %lf\", &d, &l, &v, &w);\n\n\nt= (l-d);\nq= (v+w);\nr=t/q;\nprintf(\" %.6lf\", r);\n\nreturn 0;\n\n}\n\n/* 1504030931338 */\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n double a, b, c, d, l, r, output;\n double r1, l1;\n scanf(\" %lf %lf %lf %lf\", &a, &b, &c, &d);\n l=b-a;\n output=l/(c+d);\n printf(\"%lf\", output);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ndouble timeCalc(int input[]){\n int d = input[0];\n int L = input[1];\n int v1 = input[2];\n int v2 = input[3];\n\n double distToCover = L - d;\n double totalSpeed = v1 + v2;\n double timeLeft = distToCover/totalSpeed;\n\n return timeLeft;\n}\n\n\n\nint main(int argc, char *argv[argc]){\n int i;\n int size = 4;\n int *v;\n v = malloc(size * sizeof(int));\n for(i=0; i < size; i++)\n scanf(\"%d\", &v[i]);\n\n double timeLeft;\n timeLeft = timeCalc(v);\n printf(\"%.*f\", 16, timeLeft);\n printf(\"0000\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,L,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n double r;\n r=(L-d)/(v1+v2);\n printf(\"%lf\",r);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ndouble timeCalc(int input[]){\n int d = input[0];\n int L = input[1];\n int v1 = input[2];\n int v2 = input[3];\n\n double distToCover = L - d;\n double totalSpeed = v1 + v2;\n double timeLeft = distToCover/totalSpeed;\n\n return timeLeft;\n}\n\n\n\nint main(int argc, char *argv[argc]){\n int i;\n int size = 4;\n int *v;\n v = malloc(size * sizeof(int));\n for(i=0; i < size; i++)\n scanf(\"%d\", &v[i]);\n\n double timeLeft;\n timeLeft = timeCalc(v);\n printf(\"%.*f\", 20, timeLeft);\n //printf(\"0000\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n float d, L, V1, V2;\n float resposta;\n scanf(\"%f %f %f %f\", &d, &L, &V1, &V2);\n resposta= (L-d)/(V1+V2);\n printf(\"%.20f\\n\", resposta);\n return 0;\n}\n\n/* 1490034068245 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tdouble d, l, v1, v2,c,t;\n\tscanf(\"%lf\",&d);\n\tscanf(\"%lf\",&l);\n\tscanf(\"%lf\",&v1);\n\tscanf(\"%lf\",&v2);\n\tc=(v1+v2);\n\tt=(l-d)*v1/c;\n\tt=t/v1;\n\tprintf(\"%.16lf\",t);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tdouble d, l, v1, v2;\n\tscanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n\tprintf(\"%.20lf\\n\", (l - d) / (v1 + v2));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n double n,j,i,flag=0,c=0,L,d,a,b;\n scanf(\"%lf%lf%lf%lf\",&d,&L,&a,&b);\n printf(\"%lf\",(L-d)/(a+b));\n return 0;\n}\n\n"}, {"source_code": "#include<Stdio.h>\nint main()\n{\n int d,l,v1,v2;\n scanf(\"%d\",& d);\n scanf(\"%d\",& l);\n scanf(\"%d\",& v1);\n scanf(\"%d\",& v2);\n double x=(double)(v1*(l-d))/(v1+v2);\n double t=(double)x/v1;\n printf(\"%lf\", t);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d, L, v1, v2;\n\n scanf(\"%d%d%d%d\", &d, &L, &v1, &v2);\n\n printf(\"%f\\n\", (double)((double)(L-d)/(double)(v1+v2)));\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\ndouble l,d,v1,v2,t;\nscanf(\"%lf\",&d);\nscanf(\"%lf\",&l);\nscanf(\"%lf\",&v1);\nscanf(\"%lf\",&v2);\nt=(l-d)/(v1+v2);\nprintf(\"%lf\",t);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,l,v1,v2;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n printf(\"%.20f\\n\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n double d, l2, v1, v2;\n double t;\n\n scanf(\"%lf %lf %lf %lf\", &d, &l2, &v1, &v2);\n\n t = (l2 - d) / (v1 + v2);\n\n printf(\"%lf\", t);\n\n return 0;\n}\n\n/* 1490128270726 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ndouble timeCalc(int input[]){\n int d = input[0];\n int L = input[1];\n int v1 = input[2];\n int v2 = input[3];\n\n double distToCover = L - d;\n double totalSpeed = v1 + v2;\n double timeLeft = distToCover/totalSpeed;\n\n return timeLeft;\n}\n\n\n\nint main(int argc, char *argv[argc]){\n int i;\n int size = 4;\n int *v;\n v = malloc(size * sizeof(int));\n for(i=0; i < size; i++)\n scanf(\"%d\", &v[i]);\n\n double timeLeft;\n timeLeft = timeCalc(v);\n printf(\"%.*f\", 20, timeLeft);\n //printf(\"0000\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n double s,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&s,&l,&v1,&v2);\n printf(\"%.20lf\",(l-s)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int d,l,v1,v2,v;\n double x,m;\n scanf(\"%d %d %d %d\",&d,&l,&v1,&v2);\n v=v1+v2;\n m=l-d;\n x=m/v;\n printf(\"%f\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,L,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n double r;\n r=(L-d)/(v1+v2);\n printf(\"%lf\",r);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int d, L, v1, v2, vr;\n double t;\n\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\n vr = v1 + v2;\n\n t = ((L-d)*1.0)/vr;\n\n printf(\"%lf\\n\",t);\n\n return 0;\n}\n\n/* 1504026016481 */\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint l, d, v1, v2;\n\tfloat time = 0;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\ttime = ((float)(l-d))/(v1+v2);\n\tprintf(\"%f\",time);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int d,L,v1,v2;\n scanf(\"%i%i%i%i\",&d,&L,&v1,&v2);\n double a = (double)L-d;\n a /= (v1+v2);\n printf(\"%.8f\",a);\n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l, d, v1, v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n l = l - d;\n v1= v1 + v2;\n x = l/1.0;\n x = x/ v1;\n printf(\"%.20lf\", x);\n return 0;\n}\n\n/* 1490125917551 */\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n double luke = 0;\n double width = 0;\n double vel1 = 0;\n double vel2 = 0;\n scanf(\"%lf %lf %lf %lf\", &luke, &width, &vel1, &vel2);\n printf(\"%lf\", (width - luke) / (vel1 + vel2));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main() {\n float d, L, v1, v2;\n scanf(\"%f\", &d);\n scanf(\"%f\", &L);\n scanf(\"%f\", &v1);\n scanf(\"%f\", &v2);\n printf(\"%.6f\", abs(L - d) / (v1 + v2));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint d,l,v1,v2;\n\tdouble t;\n\tscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n\tl-=d;\n\tt=(double)l/(v1+v2);\n\tprintf(\"%f\",t);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n double D, L, V1, V2, T;\n scanf(\"%lf %lf %lf %lf\", &D, &L, &V1, &V2 );\n T = (L - D)/( V1 + V2);\n printf (\"%.20lf\", T);\n\n return 0;\n\n\n\n}\n\n/* 1504030283053 */\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tfloat d, L, v1, v2;\n\tscanf(\"%f %f %f %f\", &d, &L, &v1, &v2);\n\tprintf(\"%.20f\", (L - d) / (v1 + v2));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n double T, d, L, v1, v2;\n\n scanf(\"%lf %lf %lf %lf\", &d, &L, &v1,&v2);\n T=(L-d)/(v1+v2);\n\n printf(\"%lf\",T);\n\n return 0;\n}\n\n\n/* 1490106050815 */\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n double d, L, v1, v2, t;\n scanf(\"%lf %lf %lf %lf\", &d, &L, &v1, &v2);\n\n t = (L-d)/(v1+v2);\n\n\n\n\n printf(\"%lf\\n\", t);\n\n\n\n\n return 0;\n}\n\n/* 1504026660016 */\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\ndouble l,d,v1,v2,t;\nscanf(\"%lf\",&d);\nscanf(\"%lf\",&l);\nscanf(\"%lf\",&v1);\nscanf(\"%lf\",&v2);\nt=(l-d)/(v1+v2);\nprintf(\"%lf\",t);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,L,v1,v2,s;\n scanf(\"%f %f %f %f\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%f\\n\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.15lf\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n float d, L, v1, v2;\n scanf(\"%f\", &d);\n scanf(\"%f\", &L);\n scanf(\"%f\", &v1);\n scanf(\"%f\", &v2);\n printf(\"%.6f\", abs(L - d) / (v1 + v2));\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n float d,L,v1,v2;\n scanf(\"%d %d %d %d\",&d,&L,&v1,&v2);\n printf(\"%f\\n\",(L-d)/(v1+v2));\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define GET(a) scanf(\"%d\", &(a))\n\nint d, l, v1, v2;\n\nint main(){\n\tGET(d);\n\tGET(l);\n\tGET(v1);\n\tGET(v2);\n\tprintf(\"%f\\n\", 1.0 * (l - d) / (v1 + v2));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <float.h>\nint main()\n{\n\tfloat d,l,v1,v2;\n\tscanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n\tfloat f=(l-d)/(v1+v2);\n\tprintf(\"%f\",f);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n float x;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\n x=(float)(b-a)/(c+d);\n printf(\"%.20f\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ndouble timeCalc(int input[]){\n int d = input[0];\n int L = input[1];\n int v1 = input[2];\n int v2 = input[3];\n\n double distToCover = L - d;\n double totalSpeed = v1 + v2;\n double timeLeft = distToCover/totalSpeed;\n\n return timeLeft;\n}\n\n\n\nint main(int argc, char *argv[argc]){\n int i;\n int size = 4;\n int *v;\n v = malloc(size * sizeof(int));\n for(i=0; i < size; i++)\n scanf(\"%d\", &v[i]);\n\n double timeLeft;\n timeLeft = timeCalc(v);\n printf(\"%.*f\", 20, timeLeft);\n //printf(\"0000\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\t{\nint d,l,v1,v2;\ndouble ans,x1,x2;\nscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\nx1=((l-d));\n//printf(\"%f\",x1);\nx1=x1/v2;\n//printf(\"%f\",x1);\nx1=(x1*v1*v2);\nx1=x1/(v1+v2);\n//printf(\"%f\\n\",x1);\nans=x1/v1;\nprintf(\"%f\",ans);\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d, l, v1, v2, t;\n scanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n t = (l - d) / (v1 + v2);\n printf(\"%lf\", t);\n return 0;\n}\n\n/* 1490033946836 */\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int d,l,x,y;\n scanf(\"%d%d%d%d\",&d,&l,&x,&y);\n double t=(double )(l-d)/(x+y);\n printf(\"%0.20f\",t);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.15lf\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tfloat d, L, v1, v2;\n\tscanf(\"%f %f %f %f\", &d, &L, &v1, &v2);\n\tprintf(\"%.20f\", (L - d) / (v1 + v2));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,L,v1,v2,achi,nai;\n scanf(\"%lf%lf%lf%lf\",&d,&L,&v1,&v2);\n achi=L-d;\n nai=v1+v2;\n printf(\"%.6lf\\n\",achi/nai);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n double D, L, V1, V2, T;\n scanf(\"%lf %lf %lf %lf\", &D, &L, &V1, &V2 );\n T = (L - D)/( V1 + V2);\n printf (\"%.20lf\", T);\n\n return 0;\n\n\n\n}\n\n/* 1504030257039 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,l,v1,v2,y,z,p,q,i,j;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n float x=(l-d)/(v1+v2);\n printf(\"%f\\n\",x);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nmain()\n{\n int x, y, z, w;\n scanf(\"%d %d %d %d\", &x, &y, &z, &w);\n float n=((float)(y-x)/(z+w));\n printf(\"%f\", n);\n}"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\tint d, l, v1, v2;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\tfloat ans = (l - d) * 1.0 / (v1 + v2);\n\tprintf(\"%f\", ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n double T, d, L, v1, v2;\n\n scanf(\"%lf %lf %lf %lf\", &d, &L, &v1,&v2);\n T=(L-d)/(v1+v2);\n\n printf(\"%lf\",T);\n\n return 0;\n}\n\n\n/* 1490106050815 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int d,l,v1,v2;\n float ans;\n scanf(\"%d %d %d %d\",&d,&l,&v1,&v2);\n ans=(l-d)/(1.0*(v1+v2));\n printf(\"%f\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nfloat d,l,v,s,a,b,c;\nscanf(\"%f\",&d);\nscanf(\"%f\",&l);\nscanf(\"%f\",&v);\nscanf(\"%f\",&s);\na=l-d;\nb=v+s;\nc=a/b;\nprintf(\"%f\",c);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int d,l,v1,v2;\n scanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n printf(\"%.6f\",(l-d)/(v1+v2*1.0));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\nint d, L, v1, v2;\nscanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\nprintf(\"%.20lf\\n\", 1.0*(L-d)/(v1 + v2));\nreturn 0;\n}\n/* 1490033261029 */\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n double d, L, v1, v2; \n double time;\n scanf (\"%lf %lf %lf %lf\", &d, &L, &v1, &v2);\n time = (d-L)/(v1+v2);\n time = fabs(time);\n printf (\"%lf\", time);\n scanf (\"%ld\", v1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tint d,l,v1,v2;\n scanf(\"%d %d %d %d\",&d,&l,&v1,&v2);\n int x =l-d;\n int xx = v1+v2;\n \n printf(\"%.6lf\\n\",(double) x / (double) xx);\n \n return 0;\n}\n/* 1504113250069 */\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n double d,l,v1,v2,t;\nscanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n\nt=(l-d)/(v1+v2);\nprintf(\"%lf\",t);\n\n\n\treturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void){\nint l,d,v1,v2;\ndouble ans;\nwhile(scanf(\"%d%d%d%d\",&d,&l,&v1,&v2)!=EOF){\n ans=(double)(l-d)/(v1+v2);\n printf(\"%.6f\\n\",ans);\n}\n\nreturn 0;\n\n\n}\n/*2016-04-02 21:07:41.826*/"}, {"source_code": "#include <stdio.h>\nint main()\n\n{\n float d,l,v1,v2;\n float ans;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n\n ans=(float)((l-d)/(v1+v2));\n\n\n printf(\"%.20f\",ans);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main() {\n float d, L, v1, v2;\n scanf(\"%f\", &d);\n scanf(\"%f\", &L);\n scanf(\"%f\", &v1);\n scanf(\"%f\", &v2);\n printf(\"%.6f\", abs(L - d) / (v1 + v2));\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int d, L, v1, v2 ;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2) ;\n float t ;\n t = (L-d)/((v1+v2)*1.0) ;\n printf(\"%.23f\", t) ;\n return 0 ;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define EPS 1E-6\nint main()\n{\n double d,L,v1,v2,t,add;\n double ans;\n while(~scanf(\"%lf%lf%lf%lf\",&d,&L,&v1,&v2)){\n ans=0;\n add=1;\n t=L-d;\n while((v1+v2)*ans<t){\n while(((v1+v2)*(ans+add)>t||fabs((v1+v2)*(ans+add))<EPS)&&add>EPS)add/=10;\n ans+=add;\n }\n printf(\"%lf\\n\",ans);\n }\n return 0;\n}\n"}, {"source_code": "main(a,b,c,d){\nscanf(\"%d%d%d%d\",&a,&b,&c,&d);\nprintf(\"%.9f\",(b-a)/(c+d+.0));\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int D, L, v1;\n double R, v2;\n scanf(\"%d %d %d %lf\", &D, &L, &v1, &v2);\n R = (L - D) / (v1 + v2);\n if (R < 0){\n R = R * -1;\n }\n if (L < D){\n R = 0.0;\n }\n printf(\"%.20lf\\n\", R);\n\n return 0;\n}"}, {"source_code": "/*\n * Lyak.c\n * \n * Copyright 2016 elmihailol <elmihailol@elmihailol-ubuntu>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\n#include <math.h>\n#include <stdlib.h>\n\nint main(int argc, char **argv)\n{\n\tdouble d, l, v1, v2;\n\tscanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n\tdouble t;\n\tt = (d-l)/(v1+v2);\n\tt = fabs(t);\n\tprintf(\"%lf\", t);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n\tint d, L, v1, v2;\n\tdouble t;\n\tscanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\tt=(double) abs(L-d)/(v1+v2);\n\tprintf(\"%.6lf\", (double)t);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n double d,l,v1,v2,t;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n l=(l-d);\n v1=(v1+v2);\n t=(float)l/(float)v1;\n printf(\"%.20f\",t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,l,m;\n double n;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n l=b-a;\n m=c+d;\n n= l/(long double)m;\n printf(\"%lf\",n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int D, L, v1;\n double R, v2;\n scanf(\"%d %d %d %lf\", &D, &L, &v1, &v2);\n R = (L - D) / (v1 + v2);\n if (R < 0){\n R = R * -1;\n }\n if (L < D){\n R = 0.0;\n }\n printf(\"%.20lf\\n\", R);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main(){\n int d,l,v1,v2;\n double ans;\n scanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n ans=(double)(l-d)/(double)(v1+v2);\n printf(\"%lf\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,l,v1,v2,x;\n scanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n x=(l-d)/(v1+v2);\n printf(\"%f\",x);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n float velocity_left, velocity_right, length_of_corridor, width_of_luke;\n float relative_velocity, effective_distance, max_survival_time;\n\n scanf(\"%f %f %f %f\", &width_of_luke, &length_of_corridor, &velocity_left, &velocity_right);\n\n relative_velocity = velocity_left + velocity_right;\n effective_distance = length_of_corridor - width_of_luke;\n max_survival_time = effective_distance/relative_velocity;\n\n printf(\"%f\",max_survival_time);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d,l,v1,v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n x = (l-d)*1.0/(v1 + v2);\n printf(\"%lf\\n\", x);\n\n\n\nreturn 0;\n\n}\n/* 1504031800366 */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n float d,l,v1,v2,s;\n scanf(\"%f %f %f %f\",&d,&l,&v1,&v2);\n s=(l-d)/(v1+v2);\n printf(\"%f\\n\",s);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\n\nint main()\t{\nint d,l,v1,v2;\ndouble ans,x1,x2;\nscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\nx1=((l-d)/v2);\n//printf(\"%f\",x1);\nx1=(x1*v1*v2)/(v2+v1);\n//printf(\"%f\\n\",x1);\nans=x1/v1;\nprintf(\"%f\",ans);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2,y,z,p,q,i,j;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n double x=(l-d)/(v1+v2);\n printf(\"%lf\\n\",x);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d,l,v1,v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n x = (l-d)/(v1 + v2);\n printf(\"%lf\", x);\n\n\n\nreturn 0;\n\n}\n/* 1504031015454 */\n"}, {"source_code": "//anjali_ashish 3.17//\n#include<stdio.h>\n\nint main() {\n\tdouble l,d,v1,v2,r,i;\n\tprintf(\"enter the value of l,d, v1,v2 respectively \\n\");\n\t\n\t scanf(\"%lf%lf%lf%lf\",&l,&d,&v1,&v2);\n\t r=((l-d)/(v1+v2));\n\t printf(\"%lf\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t\n\tlong d,v,v1,v2,L,a;\n\tdouble t;\n\tscanf(\"%ld %ld %ld %ld\",&d,&L,&v1,&v2);\n\tif(d>=1 && L<=10000 && v1<=10000 && v2<=10000 && d<L)\n\t{\n\t\t\n\t\ta=L-d;\n\t\tv=v1+v2;\n\t\tt=a/v;\n\t}\n\tprintf(\"%e\",t);\n\treturn 0;\n}\n/*3.12*/"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.20lf\\n\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n double d,L,v1,v2,s;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%.20lf\\n\",s);\n return 0;\n }\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n double d,L,v1,v2,s;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%.20lf\\n\",s);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char **argv)\n{\n\tdouble d, l, v1, v2;\n\tscanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n\tdouble t;\n\tt = (d-l)/(v1+v2);\n\tt = abs(t);\n\tprintf(\"%lf00000000000000\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int d,l,v1,v2;\n scanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n printf(\"%,6f\",(l-d)/(v1+v2*1.0));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int d,L,v1,v2;\n double t ;\n scanf(\"%d%d%d%d\", &d,&L,&v1,&v2);\n printf(\"%lf\",t = (L-d)/(v1+v2));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tdouble d, width, L, v1, v2, v;\n\tscanf(\"%lf %lf %lf %lf\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=L/v;\n\n\tprintf(\"%.20lf\",d);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tlong double res;\n\tint luc, end, S1, S2;\n\tscanf(\"%d %d %d %d\", &luc, &end, &S1, &S2);\n\n\tres = ((end - luc)/(S1+S2));\n\n\n\tprintf(\"%le\", res);\n\treturn 0 ;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n\n double x1,x2,max=0,t1,t2;\n for(x1=0;x1+d <= l;x1=x1+.0001)\n {\n x2 = l-d-x1;\n t1 = (x1/v1);\n t2 = (x2/v2);\n if(t1-t2 <= .000000000001 )\n {\n max = t1;\n }\n }\n printf(\"%lf\",max);\n return 0;\n}\n"}, {"source_code": "/*\n * Lyak.c\n * \n * Copyright 2016 elmihailol <elmihailol@elmihailol-ubuntu>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char **argv)\n{\n\tdouble d, l, v1, v2;\n\tscanf(\"%lf %lf %lf %lf\", &d, &l, &v1, &v2);\n\tdouble t;\n\tt = (d-l)/(v1+v2);\n\tt = abs(t);\n\tprintf(\"%lf\", t);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int d, L, v1, v2;\n char t;\n double dtime;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n printf(\"%d %d %d %d\", d, L, v1, v2);\n //if ( d < 1 || v2 > 10000 || d >= L)\n // return -1;\n dtime = (L / (v1 + v2));\n printf(\"%f\", dtime);\n scanf(\"%c\", &t);\n return 0; \n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tdouble res;\n\tint luc, end, S1, S2;\n\tscanf(\"%d %d %d %d\", &luc, &end, &S1, &S2);\n\n\tres = ((end - luc)/(S1+S2));\n\n\n\tprintf(\"%f\", res);\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int d,L,v1,v2;\n scanf(\"%d %d %d %d\",&d,&L,&v1,&v2);\n double r;\n r=(L-d)/(v1+v2);\n printf(\"%lf\",r);\n}"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n double d,l,v1,v2;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n printf(\"%.20lf\",((l - d)/(v1 + v2)));\n return 0;\n\n}\n"}, {"source_code": "\n\n #include<stdio.h>\n int main()\n {\n int d,L,v1,v2;\n float s;\n scanf(\"%d %d %d %d\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%.25f\\n\",s);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tdouble d, width, L, v1, v2, v;\n\tscanf(\"%lf %lf %lf %lf\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=L/v;\n\tprintf(\"%.20lf\\n\",d);\n\treturn 0;\n}\n"}, {"source_code": "//624A.c\n#include<stdio.h>\nint main()\n{\n\tint d,l,vone,vtwo;\n\tscanf(\"%d %d %d %d\",&d,&l,&vone,&vtwo);\n\n\tint a;\n\ta=l-d;\n\tint b;\n\tb=vone+vtwo;\n\n\n\tfloat ans;\n\tans=(float)(a/b);\n\n\tprintf(\"%f\\n\",ans);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n;\n int x[200000],y[200000];\n long long k=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d%d\",&x[i],&y[i]);\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n {\n if (x[i]-x[j]==y[i]-y[j]||x[i]+y[i]==x[j]+y[j]) k++;\n }\n printf(\"%I64d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d,l,v1,v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n x = (l-d)/(v1 + v2);\n printf(\"%lf\", x);\n\n\n\nreturn 0;\n\n}\n/* 1504030903788 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{ int d,L,v1,v2;\n scanf(\"%d%d%d%d\",&d,&L,&v1,&v2);\n double t;\n\n t=(L-d)/(v1+v2);\n\n printf(\"%lf\\n\",t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint d,l,v,s;\nfloat a,b,c;\nprintf(\"enter value of d,l,v,s\");\nscanf(\"%d\",&d);\nscanf(\"%d\",&l);\nscanf(\"%d\",&v);\nscanf(\"%d\",&s);\na=l-d;\nb=v+s;\nc=a/b;\nprintf(\"%f\",c);\nreturn 0;\n}"}, {"source_code": "//gaurav 3.13//\n#include<stdio.h>\nint main()\n{\ndouble d,l,v1,v2,t;\nprintf(\"enter the values of d,l,v1,v2\");\nscanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\nt=((l-d)/(v2+v1));\nprintf(\"\\n\\nthe time is %lf...\",t);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\t// team 3.6(abhishek sharma and akash patel,problem number is 4)\n\tint d,l,v1,v2;\n\t\n\tfloat t;\n\t\n\tscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n\tt=(l-d)/(v1+v2);\n\t\n\tprintf(\"%f\",t);\n\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int d, L, v1, v2;\n double t;\n scanf (\"%d %d %d %d\", &d, &L, &v1, &v2);\n t = (L - d)/(v1 + v2);\n printf (\"%.6lf\\n\",t);\n\nreturn 0;\n}\n\n/* 1490307656385 */\n"}, {"source_code": "/*team no. 1.3\nname - Suryansh Singh\n\tanurag shakya*/\n#include<stdio.h>\nint main()\n{\nint v1,v2,d,l,z;\ndouble t=0,y,a;\n//printf(\"enter velocities of both\");\nscanf(\"%d%d\",&v1,&v2);\n//printf(\"enter the coordinates of Soti\");\nscanf(\"%d\",&l);\n//printf(\"enter distansce between them\");\nscanf(\"%d\",&d);\nz=v1+v2;\nwhile(l>(z+d))\n{\nl=l-z;\nt++;\n}\na=l-d;\ny=a/(z);\nt=t+y;\nprintf(\"%lf\",t);\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\nint d,L,v1,v2,t,x,r; //1.8\nprintf(\"enter distance L: \"); //Tarun garg and Vaibhav sharma\nscanf(\"%d\",&L);\nprintf(\"\\n enter distance d: \");\nscanf(\"%d\",&d);\nprintf(\"\\n enter velocity of thakur(v1): \");\nscanf(\"%d\",&v1);\nprintf(\"\\n enter velocity of soti(v2): \");\nscanf(\"%d\",&v2);\nr=v1/v2;\nx=((L-d)*r)/(1+r);\nt=x/v1;\nprintf(\"\\ntime after they have to stop= %d\",t);\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int d, L, v1, v2;\n double t;\n scanf (\"%d %d %d %d\", &d, &L, &v1, &v2);\n t = (L - d)/(v1 + v2);\n printf (\"%.6lf\\n\",t);\n\nreturn 0;\n}\n\n/* 1490307656385 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(1000000000000)*(float)(L-d)/((v1+v2));\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==11)\n a[++i]='.';\n }\n if(a[i]=='.')\n a[++i]='0';\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2,y,z,p,q,i,j;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n double x=(l-d)/(v1+v2);\n printf(\"%lf\\n\",x);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int d,l,v1,v2;\n scanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n printf(\"%,6f\",(l-d)/(v1+v2*1.0));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d,l,v1,v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n x = (l-d)/(v1 + v2);\n printf(\"%lf\", x);\n\n\n\nreturn 0;\n\n}\n/* 1504030903788 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n unsigned long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(1000000000000000000)*(long double)(L-d)/((v1+v2));\n // c=1000000000000000000/5;\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==17)\n a[++i]='.';\n }\n if(a[i]=='.')\n a[++i]='0';\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n double d, l, v1, v2;\n scanf(\"%lf %lf %lf %lf\",&d, &l, &v1, &v2);\n\n printf(\"%.20lf\\n\", (l-d)/(v1+v2));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n double d,l,v1,v2,result;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n result=abs((l - d)/(v1 + v2));\n printf(\"%.20lf\",result);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2;\nscanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\nprintf(\"%.15lf\",(l-d)/(v1+v2));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long double c;\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=((long double)(L-d))/(v1+v2);\n printf(\"%llf\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\t// team 3.6(abhishek sharma and akash patel,problem number is 4)\n\tint d,l,v1,v2;\n\t\n\tfloat t;\n\t\n\tscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n\tt=(l-d)/(v1+v2);\n\t\n\tprintf(\"%f\",t);\n\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2;\n scanf(\"%ld %ld %ld %ld\",&d,&l,&v1,&v2);\n printf(\"%0.9lf\\n\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(10000000000)*(float)(L-d)/((v1+v2));\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==9)\n a[++i]='.';\n }\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n;\n int x[200000],y[200000];\n long long k=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d%d\",&x[i],&y[i]);\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n {\n if (x[i]-x[j]==y[i]-y[j]||x[i]+y[i]==x[j]+y[j]) k++;\n }\n printf(\"%I64d\",k);\n return 0;\n}\n"}, {"source_code": "\n\n #include<stdio.h>\n int main()\n {\n int d,L,v1,v2;\n float s;\n scanf(\"%d %d %d %d\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%.25f\\n\",s);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint d,l,v,s;\nfloat a,b,c;\nprintf(\"enter value of d,l,v,s\");\nscanf(\"%d\",&d);\nscanf(\"%d\",&l);\nscanf(\"%d\",&v);\nscanf(\"%d\",&s);\na=l-d;\nb=v+s;\nc=a/b;\nprintf(\"%f\",c);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]){\n\tint width, L, v1, v2, v;\n\tdouble d;\n\tscanf(\"%d %d %d %d\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=L/v;\n\n\tprintf(\"%.20lf\",d);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,v1,v2;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&v1,&v2);\n printf(\"%.20lf\\n\",(l-d)/(v1+v2));\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n double d,L,v1,v2,s;\n scanf(\"%lf %lf %lf %lf\",&d,&L,&v1,&v2);\n s=(L-d)/(v1+v2);\n printf(\"%.20lf\\n\",s);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(1000000000000)*(float)(L-d)/((v1+v2));\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==11)\n a[++i]='.';\n }\n if(a[i]=='.')\n a[++i]='0';\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\tint d, l, v1, v2;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\tfloat ans;\n\tans = (l - d) / (v1 + v2);\n\tprintf(\"%f\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n double x,y,a,b;\n scanf(\"%lf %lf %lf %lf\",&x,&y,&a,&b);\n printf(\"%.22lf\",(x-y)/(a+b));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int d, L, v1, v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n x = (L - d) / (v1 + v2);\n printf(\"%.20lf\", x);\n\n return 0;\n}\n\n/* 1490126472285 */\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\tint d, L, v1, v2;\n\tdouble time;\n\t\n\tscanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\t\n\ttime = (L-d)/(v1+v2);\n\tprintf(\"%f\", time);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\tint d, L, v1, v2;\n\tdouble time;\n\t\n\tscanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\t\n\ttime = (L-d)/(v1+v2);\n\tprintf(\"%f\", time);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]){\n\tint width, L, v1, v2, v;\n\tdouble d;\n\tscanf(\"%d %d %d %d\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=(double)L/v;\n\n\tprintf(\"%.20lf\",d);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long double luke = 0;\n long double width = 0;\n long double vel1 = 0;\n long double vel2 = 0;\n scanf(\"%Lf %Lf %Lf %Lf\", &luke, &width, &vel1, &vel2);\n printf(\"%Lf\", (width - luke) / (vel1 + vel2));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint d, l, v1, v2;\n\n//\tfreopen(\"input.txt\", \"r\", stdin);\n\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\n\tprintf(\"%lf\", (double)(l - d) / (v1 + v2));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(1000000000000000000)*(double)(L-d)/((v1+v2));\n // c=1000000000000000000/5;\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==17)\n a[++i]='.';\n }\n if(a[i]=='.')\n a[++i]='0';\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "/*team no. 1.3\nname - Suryansh Singh\n\tanurag shakya*/\n#include<stdio.h>\nint main()\n{\nint v1,v2,d,l,z;\ndouble t=0,y,a;\n//printf(\"enter velocities of both\");\nscanf(\"%d%d\",&v1,&v2);\n//printf(\"enter the coordinates of Soti\");\nscanf(\"%d\",&l);\n//printf(\"enter distansce between them\");\nscanf(\"%d\",&d);\nif(d<l)\n{\nz=v1+v2;\nwhile(l>(z+d))\n{\nl=l-z;\nt++;\n}\na=l-d;\ny=a/(z);\nt=t+y;\nprintf(\"%lf\",t);\n}\nelse\nprintf(\"wrong input\");\nreturn(0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n double d,l,a,b;\n double c;\n scanf(\"%lf %lf %lf %lf\",&d,&l,&a,&b);\n c=(l-d)/(a+b);\n printf(\"%.20lf\",c);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\tint d, l, v1, v2;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\tfloat ans;\n\tans = (l - d) / (v1 + v2);\n\tprintf(\"%f\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long double c;\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=((long double)(L-d))/(v1+v2);\n printf(\"%Lf\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n double d,L,v1,v2;\n scanf(\"%f %f %f %f\",&d,&L,&v1,&v2);\n printf(\"%.8f\",(L-d)/(v1+v2));\n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long long int c;\n int i=-1, x;\n char a[22];\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=(10000000000)*(float)(L-d)/((v1+v2));\n while(c!=0)\n {\n if(c%10>=0)\n x=c%10;\n else\n x=10+c%10;\n a[++i]=x + '0';\n c=c/10;\n if(i==9)\n a[++i]='.';\n }\n while(i>=0)\n printf(\"%c\", a[i--]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong double d, l, v1, v2;\n\tscanf(\"%Lf %Lf %Lf %Lf\", &d, &l, &v1, &v2);\n\tprintf(\"%Lf\\n\", (l - d) / (v1 + v2));\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tdouble d, L, v1, v2;\n\tscanf(\"%d\", &d);\n\tscanf(\"%d\", &L);\n\tscanf(\"%d\", &v1);\n\tscanf(\"%d\", &v2);\n\t\n\tdouble t = (L-d)/(v1 + v2);\n\t\n\tprintf(\"%f\", t);\n\n \n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\t// team 3.6(abhishek sharma and akash patel,problem number is 4)\n\tint d,l,v1,v2;\n\t\n\tfloat t;\n\t\n\tscanf(\"%d%d%d%d\",&d,&l,&v1,&v2);\n\tt=(l-d)/(v1+v2);\n\t\n\tprintf(\"%f\",t);\n\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tdouble d, width, L, v1, v2, v;\n\tscanf(\"%lf %lf %lf %lf\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=L/v;\n\tprintf(\"%lf\\n\",d);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define EPS 1E-6\nint main()\n{\n double d,L,v1,v2,a,b;\n double ans;\n while(~scanf(\"%lf%lf%lf%lf\",&d,&L,&v1,&v2)){\n ans=0.0;\n a=0.0;\n b=L;\n while(a+d<b){\n ans+=0.00001;\n a=v1*ans;\n b=L-v2*ans;\n }\n printf(\"%lf\\n\",ans);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long double c;\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=((long double)(L-d))/(v1+v2);\n printf(\"%llf\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int d, L, v1, v2;\n double t;\n scanf (\"%d %d %d %d\", &d, &L, &v1, &v2);\n t = (L - d)/(v1 + v2);\n printf (\"%.6lf\\n\",t);\n\nreturn 0;\n}\n\n/* 1490307656385 */\n"}, {"source_code": "#include<stdio.h> //AA06( 21/ 04/ 20) If u see my code, Have a Good Day! (^_^)\n#include<math.h>\n\n\nint main()\n{\n int d, L, v1, v2;\n double x, y;\n\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\n x =(double)(L - d)/ (v1 + v2);\n\n y = fabs(x);\n\n printf(\"%.20lf\\n\", y);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int d, L, v1, v2;\n char t;\n double dtime;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n if ( d < 1 || v2 > 10000 || d >= L)\n return -1;\n dtime = (L / (v1 + v2));\n printf(\"%f\", dtime);\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nfloat ans=(b-a)/(c+d);\nprintf(\"%f\",ans);\n\n}\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int d,l,v1,v2;\n double x;\n scanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n x = (l-d)/(v1 + v2);\n printf(\"%lf\", x);\n\n\n\nreturn 0;\n\n}\n/* 1504030862241 */\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tdouble res;\n\tint luc, end, S1, S2;\n\tscanf(\"%d %d %d %d\", &luc, &end, &S1, &S2);\n\n\tres = ((end - luc)/(S1+S2));\n\n\n\tprintf(\"%f\", res);\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n float a, b, c, d, l, r, output;\n float r1, l1;\n scanf(\" %f %f %f %f\", &a, &b, &c, &d);\n l=b-a;\n for(r=1; r==r; r++)\n {\n if(l>=(c*r+d*r))\n {\n break;\n }\n\n }\n if(l==(c*r+d*r))\n {\n r1=(float)r;\n printf(\"%f\", r1);\n }\n else\n {\n output=(l-(c*(r-1)+d*(r-1)));\n l=(output/(c+d));\n printf(\"%f\", l+r);\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\tint d, l, v1, v2, ans;\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\tans = (l - d) / (v1 + v2);\n\tif ((l - d) % (v1 + v2) != 0) ans++;\n\tprintf(\"%d\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nvoid quicksort(int b[],int start,int end);\nint partition(int b[],int start,int end);\nint main(void)\n{\nint a[100000],i,j,n;\nlong long int sum=0;\nscanf(\"%d\",&n);\n\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&a[i]);\nsum=sum+a[i];\n}\n\n\nif(sum%2==0)\n{\n printf(\"%I64d\",sum);\n return 0;\n}\n\nelse\n{\nint start=0,end=n-1;\nquicksort(a,start,end);\n for(i=0;i<n;i++)\n {\n if(a[i]%2!=0)\n {\n sum=sum-a[i];\n break;\n }\n }\nprintf(\"%I64d\",sum);\n\n}\nreturn 0;\n\n\n}\n\n\nvoid quicksort(int b[],int start,int end)\n{\nint pindex;\nif(start<end)\n{\npindex=partition(b,start,end);\nquicksort(b,start,pindex-1);\nquicksort(b,pindex+1,end);\n}\n\n}\n\n\nint partition(int b[],int start,int end)\n{\nint pivot=b[end],temp,temp1;\nint pindex=start;\nint i;\nfor(i=start;i<=end-1;i++)\n{\nif(b[i]<=pivot)\n{\ntemp=b[i];\nb[i]=b[pindex];\nb[pindex]=temp;\npindex++;\n}\n}\n\ntemp1=b[end];\nb[end]=b[pindex];\nb[pindex]=temp1;\nreturn pindex;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n double d,L,v1,v2,tempo;\n scanf(\"%lf%lf%lf\",&d,&L,&v1,&v2);\n tempo=((v1+v2)/(L-d));\n printf(\"%lf\\n\",tempo);\n return 0;\n}\n\n/* 1504113861606 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long double c;\n int L, d, v1, v2;\n scanf(\"%i %i %i %i\", &d, &L, &v1, &v2);\n c=((long double)(L-d))/(v1+v2);\n printf(\"%Lf\", c);\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n\n double d,l,v1,v2,a,b;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n a=l-d;\n b=v1+v2;\n printf(\"%.18lf\",a/b);\n\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tdouble res;\n\tint luc, end, S1, S2;\n\tscanf(\"%d %d %d %d\", &luc, &end, &S1, &S2);\n\n\tres = ((end - luc)/(S1+S2));\n\n\n\tprintf(\"%lf\", res);\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint a,b,c,d;\nscanf(\"%d %d %d %d\",&a,&b,&c,&d);\nfloat ans=(b-a)/(c+d);\nprintf(\"%f\",ans);\n\n}\n\n\n\n\n\n"}, {"source_code": "/*team no. 1.3\nname - Suryansh Singh\n\tanurag shakya*/\n#include<stdio.h>\nint main()\n{\nint v1,v2,d,l,z;\ndouble t=0,y,a;\nprintf(\"enter velocities of both\");\nscanf(\"%d%d\",&v1,&v2);\nprintf(\"enter the coordinates of Soti\");\nscanf(\"%d\",&l);\nprintf(\"enter distansce between them\");\nscanf(\"%d\",&d);\nif(d<l)\n{\nz=v1+v2;\nwhile(l>(z+d))\n{\nl=l-z;\nt++;\n}\na=l-d;\ny=a/(z);\nt=t+y;\nprintf(\"time is %lf\",t);\n}\nelse\nprintf(\"wrong input\");\nreturn(0);\n}"}, {"source_code": "#include<stdio.h> //AA06( 21/ 04/ 20) If u see my code, Have a Good Day! (^_^)\n#include<math.h>\n\n\nint main()\n{\n int d, L, v1, v2;\n double x, y;\n\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n\n x =(double)(L - d)/ (v1 + v2);\n\n y = fabs(x);\n\n printf(\"%.20lf\\n\", y);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n double d,L,v1,v2,tempo;\n scanf(\"%lf%lf%lf\",&d,&L,&v1,&v2);\n tempo=((L-d)/(v1+v2));\n printf(\"%lf\\n\",tempo);\n return 0;\n}\n\n/* 1504114732498 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tdouble d, width, L, v1, v2, v;\n\tscanf(\"%lf %lf %lf %lf\",&width, &L, &v1, &v2);\n\tL-=width;\n\tv=v1+v2;\n\td=L/v;\n\n\tprintf(\"%.20lf\",d);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int d,L,v1,v2;\n double t ;\n scanf(\"%d%d%d%d\", &d,&L,&v1,&v2);\n t = (L-d)/(v1+v2);\n printf(\"%lf\",t);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint d,l,v,s;\nfloat a,b,c;\nprintf(\"enter value of d,l,v,s\");\nscanf(\"%d\",&d);\nscanf(\"%d\",&l);\nscanf(\"%d\",&v);\nscanf(\"%d\",&s);\na=l-d;\nb=v+s;\nc=a/b;\nprintf(\"%f\",c);\nreturn(0);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n float a, b, c, d, l, r, output;\n float r1, l1;\n scanf(\" %f %f %f %f\", &a, &b, &c, &d);\n l=b-a;\n for(r=1; r==r; r++)\n {\n if(l>=(c*r+d*r))\n {\n break;\n }\n\n }\n if(l==(c*r+d*r))\n {\n r1=(float)r;\n printf(\"%f\", r1);\n }\n else\n {\n output=(l-(c*(r-1)+d*(r-1)));\n l=(output/(c+d));\n printf(\"%f\", l+r);\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int L, d, v1, v2;\n long double c;\n scanf(\"%i%i%i%i\", &d, &L, &v1, &v2);\n c=((double)(L-d))/(v1+v2);\n printf(\"%Lf\", c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n\tdouble d, L, v1, v2;\n\tdouble t;\n\tscanf(\"%lf %lf %lf %lf\", &d, &L, &v1, &v2);\n\tt=abs(L-d)/(v1+v2);\n\tprintf(\"%.6lf\", t);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint d, l, v1, v2;\n\n//\tfreopen(\"input.txt\", \"r\", stdin);\n\n\tscanf(\"%d %d %d %d\", &d, &l, &v1, &v2);\n\n\tprintf(\"%lf\", (double)(l - d) / (v1 + v2));\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n\n float d,l,v1,v2,a,b;\n scanf(\"%lf%lf%lf%lf\",&d,&l,&v1,&v2);\n a=l-d;\n b=v1+v2;\n printf(\"%.10lf\",a/b);\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n float a, b, c, d, l, r, output;\n float r1, l1;\n scanf(\" %f %f %f %f\", &a, &b, &c, &d);\n l=b-a;\n for(r=1; r==r; r++)\n {\n if(l>=(c*r+d*r))\n {\n break;\n }\n\n }\n if(l==(c*r+d*r))\n {\n r1=(float)r;\n printf(\"%f\", r1);\n }\n else\n {\n output=(l-(c*(r-1)+d*(r-1)));\n l=(output/(c+d));\n printf(\"%f\", l+r);\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{ int d,L,v1,v2;\n scanf(\"%d%d%d%d\",&d,&L,&v1,&v2);\n double t;\n\n t=(L-d)/(v1+v2);\n\n printf(\"%lf\\n\",t);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int d, L, v1, v2;\n char t;\n double dtime;\n scanf(\"%d %d %d %d\", &d, &L, &v1, &v2);\n if ( d < 1 || v2 > 10000 || d >= L)\n return -1;\n dtime = (L / (v1 + v2));\n printf(\"%f\", dtime);\n return 0; \n}\n"}], "src_uid": "f34f3f974a21144b9f6e8615c41830f5"} {"nl": {"description": "Petya has an array $$$a$$$ consisting of $$$n$$$ integers. He wants to remove duplicate (equal) elements.Petya wants to leave only the rightmost entry (occurrence) for each element of the array. The relative order of the remaining unique elements should not be changed.", "input_spec": "The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 50$$$) \u2014 the number of elements in Petya's array. The following line contains a sequence $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 1\\,000$$$) \u2014 the Petya's array.", "output_spec": "In the first line print integer $$$x$$$ \u2014 the number of elements which will be left in Petya's array after he removed the duplicates. In the second line print $$$x$$$ integers separated with a space \u2014 Petya's array after he removed the duplicates. For each unique element only the rightmost entry should be left.", "sample_inputs": ["6\n1 5 5 1 6 1", "5\n2 4 2 4 4", "5\n6 6 6 6 6"], "sample_outputs": ["3\n5 6 1", "2\n2 4", "1\n6"], "notes": "NoteIn the first example you should remove two integers $$$1$$$, which are in the positions $$$1$$$ and $$$4$$$. Also you should remove the integer $$$5$$$, which is in the position $$$2$$$.In the second example you should remove integer $$$2$$$, which is in the position $$$1$$$, and two integers $$$4$$$, which are in the positions $$$2$$$ and $$$4$$$.In the third example you should remove four integers $$$6$$$, which are in the positions $$$1$$$, $$$2$$$, $$$3$$$ and $$$4$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0,x=0;\n scanf(\"%d\",&n);\n int ar[n],a[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ar[i]==ar[j])\n ar[i]=-1;\n }\n if(ar[i]!=-1)\n {\n a[x]=ar[i];\n x++;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0;i<x;i++)\n printf(\"%d \",a[i]);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n \n int duplicate = 0;\n \n int n;\n scanf(\"%d\",&n);\n \n int index = 0;\n \n int *array = malloc(sizeof(int)*n);\n int *b = malloc(sizeof(int)*n);\n \n int i,j,k;\n int a;\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a);\n array[i]=a;\n }\n \n for(i = n-1; i>=0; i--) {\n for(j = 0; j < index; j++) {\n if(array[i] == b[j]) {\n duplicate = 1;\n break; \n }\n }\n if(!duplicate) { \n \n b[index] = array[i];\n index++;\n //printf(\"%d \",b[index]);\n }\n duplicate = 0; \n }\n \n \n int c[index]; \n \n for(k = 0; k < index; k++) \n c[k] = b[k];\n \n printf(\"%d\\n\",k);\n \n \n \n for(k = index-1; k >=0; k--) \n printf(\"%d \",c[k]);\n\n \n \n \n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[200];\n int n,i,ln,j,k,b;\n scanf(\"%d\",&n);\n for (i=n-1;i>=0;i--){\n scanf(\"%d\",&a[i]);\n }\n for (i=0;i<n;i++){\n for (j=i+1;j<n;){\n if (a[i]==a[j]){\n for (k=j;k<n;k++){\n a[k]=a[k+1];\n }\n n--;\n }\n else j++;\n }\n }\n printf(\"%d\\n\",n);\n for (b=n-1;b>=0;b--){\n printf(\"%d \",a[b]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stddef.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int h[1001];\n for(i=0;i<1001;i++)\n h[i]=0;\n int c[n];\n for(i=0;i<n;i++)\n c[i]=0;\n\n int d=0;\n for(i=n-1;i>=0;i--)\n {\n if(h[a[i]]==0){\n d++;\n h[a[i]]+=1;\n c[i]=a[i];\n }\n }\n printf(\"%d\\n\",d);\n for(i=0;i<n;i++)\n if(c[i]!=0)\n printf(\"%d \",c[i]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,m=0;\n scanf(\"%d\",&n);\n int a[n+1];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=n-1;i>=0;i--)\n for(j=i-1;j>=0;j--)\n {\n {\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n m++;\n }\n printf(\"%d\\n\",m);\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n printf(\"%d \",a[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0,a[1001];\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n for(i=n-1; i>=0; i--)\n {\n if(a[i]==0)\n continue;\n c++;\n for(j=i-1; j>=0; j--)\n {\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n printf(\"%d\\n\",c);\n for(i=0; i<n; i++)\n {\n if(a[i]!=0)\n printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[n], flag[n], d = 0;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tflag[i] = 0;\n\t}\n\n\tfor (int i = n - 1; i >= 0; i--)\n\t{\n\t\tfor (int j = i - 1; j >= 0; j--)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t{\n\t\t\t\tflag[j] = 1;\n\t\t\t}\n\t\t}\n\t}\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tif (flag[i] == 0)\n\t\t\t++d;\n\t}\n\tprintf(\"%d\\n\", d);\n\tfor (int i = 0; i < n; i++)\n\t\tif (flag[i] == 0)\n\t\t\tprintf(\"%d \", arr[i]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nchar flag[1001];\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int a[50];\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a[i]);\n flag[a[i]] = i + 1;\n }\n int cnt = 0;\n for(int i = 0; i < n; ++i) {\n cnt += flag[a[i]] == i + 1;\n }\n printf(\"%d\\n\", cnt);\n for(int i = 0; i < n; ++i) {\n if(flag[a[i]] == i + 1) {\n printf(\"%d \", a[i]);\n }\n }\n puts(\"\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,t,d[50],i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=(n-1);i>=0;i--)\n {\n for(j=(n-1);j>=0;j--)\n {\n if(j!=i&&a[i]==a[j])\n {\n a[j]=0;\n }\n else\n {\n continue;\n }\n }\n }\n int x=0;\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n x++;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n printf(\"%d \",a[i]);\n }\n else\n {\n continue;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n for(j=i+1;j<n;j++)\n ara[j-1] = ara[j];\n n--;\n i=i-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d \",ara[i]);\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a[1000],i,j,count=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=n;i>=0;i--)\n\t{\n\t\tfor(j=i-1;j>=0;j--)\n\t\t{\n\t\t\tif(a[i]==a[j])\n\t\t\t{\n\t\t\t\ta[j]=0;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=0)\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=0)\n\t\t{\n\t\t\tprintf(\"%d \",a[i]);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[55],i,j,cnt,k,b[55];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n cnt=0;\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]!=a[j])\n {\n if(j==n-1)\n {\n b[cnt]=a[i];\n cnt++;\n }\n }\n else\n {\n break;\n }\n }\n }\n printf(\"%d\\n\",cnt+1);\n for(k=0;k<cnt;k++)\n {\n printf(\"%d \",b[k]);\n }\n printf(\"%d\",a[n-1]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[n], flag[1001];\n\tfor (int i=1;i<=1000;i++) flag[i]=-1;\n\tfor (int i=0;i<n;i++) {\n\t\tscanf(\"%d\", &arr[i]);\n\t\tif (flag[arr[i]]==-1) flag[arr[i]]=i;\n\t\telse {\n\t\t\tarr[flag[arr[i]]]=0;\n\t\t\tflag[arr[i]]=i;\t\n\t\t}\n\t}\n\tint c=0;\n\tfor (int i=0;i<n;i++) {\n\t\tif (arr[i]!=0) c++;\n\t}\n\tprintf(\"%d\\n\", c);\n\tfor (int i=0;i<n;i++) {\n\t\tif (arr[i]!=0) printf(\"%d \", arr[i]);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&x[i]); \n\t\tif (a[x[i]] == 0)c++; a[x[i]]++;\n\t}printf(\"%d\\n\", c);\n\tfor (c = 0; c < n; c++){\n\t\tif (a[x[c]] == 1) {\n\t\t\tprintf(\"%d\", x[c]);\n\t\t\tif (c < n - 1)printf(\" \");\n\t\t}\n\t\ta[x[c]]--;\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0,p;\n\tscanf(\"%d\",&n);\n\tint a[n],b[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(i=n-1;i>=0;i--){\n\t\tj=i+1;\n\t\tp=1;\n\t\twhile(j<=n-1){\n\t\t\tif(a[i]==a[j]){\n\t\t\t\tp=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tif(p==1){\n\t\tb[k]=a[i];\n\t\tk++;}\n\t}\n\tprintf(\"%d\\n\",k);\n\tfor(j=k-1;j>=0;j--)\n\tprintf(\"%d \",b[j]);\n\tprintf(\"\\n\");\n}"}, {"source_code": "#include<stdio.h>\nconst int Max=1e3+10;\nint main()\n{\n int n,i,j=0;\n int a[Max],f[Max],k[Max];\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n;i>0;i--)\n {\n if(!f[a[i]])\n {\n f[a[i]]=1;\n k[j++]=a[i];\n }\n }\n printf(\"%d\\n\",j);\n for(i=j-1;i>=0;i--)\n {\n printf(\"%d\",k[i]);\n if(i!=0)\n {\n printf(\" \");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{ int n, a[1000];\n scanf(\"%d\", &n);\n \n for (int i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n \n for (int j = n - 1; j >= 0; j--)\n {\n for (int k = j - 1; k >= 0; k--)\n {\n if (a[j] == a[k])\n { \n \n for (int new = k; new < n - 1; new++)\n {\n a[new] = a[new + 1];\n \n }\n n = n - 1;\n j--;\n \n \n }\n \n }\n }\n printf(\"%d\\n\", n);\n \n for (int p = 0; p < n; p++)\n {\n printf(\"%d \", a[p]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){ long long int a,b,c,d=0,j[2000],t,x[2000],y[2000],p[2000],n,i,k,temp,l;\nscanf(\"%lld\",&n);\n\nfor(i=0;i<n;i++){\nscanf(\"%lld\",&x[i]);}\n for(i=n-1;i>=0;i--)\n {\n for(k=0;k<i;k++)\n {\n\n if(x[k]!=0&&x[k]==x[i])\n {x[k]=0;}\n }\n\n }\n c=0;\n for(i=0;i<n;i++){\nif(x[i]==0){continue;}\nc++;\n }\nprintf(\"%lld\\n\",c);\nfor(i=0;i<n;i++){\nif(x[i]==0){continue;}\nprintf(\"%lld \",x[i]);}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int N;\n scanf(\"%d\", &N);\n int freq[1005], a[60];\n memset(freq, 0, sizeof(freq));\n for(int i=0; i<N; i++)\n {\n scanf(\"%d\", &a[i]);\n freq[a[i]]++;\n }\n for(int i=0; i<N; i++)\n {\n freq[a[i]]--;\n if(freq[a[i]] != 0)\n a[i] = -1;\n }\n int cnt = 0;\n for(int i=0; i<N; i++)\n {\n if(a[i] != -1)\n cnt++;\n }\n printf(\"%d\\n\", cnt);\n for(int i=0; i<N; i++)\n {\n if(a[i] != -1)\n printf(\"%d \", a[i]);\n }\n return 0;\n}"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint main(void)\n{\n\tint n,x,y, flag =1;\n\tscanf(\"%i\", &n);\n\tfor (x = 4; x <= 999996 && flag; x+=2)\n\t\tfor (y = 999996; y >= 4 && flag; y-=2)\n\t\t\tif (((n - y) / x == 1 || (n - x) / y == 1) && ((n - y) % x == 0 || (n - x) % y == 0))\n\t\t\t\tflag = 0;\n\tprintf(\"%i %i\", x,y);\n\treturn 0;\n}\n*/\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint main(void)\n{\n\tint n, i, flag, j, count = 0, a[50] = { 0 }, b[50] = { 0 };\n\tscanf(\"%i\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%i\", &a[i]);\n\tfor (i = n-1; i >=0; i--)\n\t{\n\t\tflag = 0;\n\t\tif (i == n - 1)\n\t\t{\n\t\t\tb[n - 1] = a[n - 1];\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (j = n - 1; j > n-1-count; j--)\n\t\t\t\tif (a[i] == b[j])\n\t\t\t\t{\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (flag == 0)\n\t\t\t{\n\t\t\t\tb[n - 1 - count] = a[i];\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%i\\n\", count);\n\tfor (i = n-count; i < n; i++)\n\t\t\tprintf(\"%i \", b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,k=0;\n scanf(\"%d\",&n);\n int A[n],l=0;\n k=n;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n for(j=0;j<i;j++)\n {\n if(A[i]==A[j])\n {\n k--;\n A[j]=-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",k);\n for(i=0;i<n;i++)\n {\n if(A[i]!=-1)\n printf(\"%d \",A[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,k=0;\n scanf(\"%d\",&n);\n int A[n],l=0;\n k=n;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n for(j=0;j<i;j++)\n {\n if(A[i]==A[j])\n {\n k--;\n A[j]=-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",k);\n for(i=0;i<n;i++)\n {\n if(A[i]!=-1)\n printf(\"%d \",A[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\t// freopen(\"/home/shadhin/Desktop/code/IO/input.txt\", \"r\", stdin);\n\t// freopen(\"/home/shadhin/Desktop/code/IO/output.txt\", \"w\", stdout);\n\n\tint n, x, i, j, remove, a[55];\n\n\tscanf(\"%d\", &n);\n\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\", &a[i]);\n\n\tremove=0;\n\tfor(j=0;j<n;j++)\n\t{\n\t\tfor(i=j+1;i<n;i++)\n\t\t{\n\t\t\tif(a[j]==0)\n\t\t\t\tbreak;\n\t\t\tif(a[j]==a[i])\n\t\t\t{\n\t\t\t\ta[j]=0;\n\t\t\t\tremove++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", n-remove);\n\tfor(i=0;i<n;i++)\n\t\tif(a[i]!=0)\n\t\t\tprintf(\"%d \", a[i]);\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n for(j=i+1;j<n;j++)\n ara[j-1] = ara[j];\n n--;\n i=i-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d \",ara[i]);\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\n#include <stddef.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int h[1001];\n for(i=0;i<1001;i++)\n h[i]=0;\n int c[n];\n for(i=0;i<n;i++)\n c[i]=0;\n\n int d=0;\n for(i=n-1;i>=0;i--)\n {\n if(h[a[i]]==0){\n d++;\n h[a[i]]+=1;\n c[i]=a[i];\n }\n }\n printf(\"%d\\n\",d);\n for(i=0;i<n;i++)\n if(c[i]!=0)\n printf(\"%d \",c[i]);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nlong long b[1100],k;\nvoid main(){\nlong long n,i;\nscanf(\"%lld\",&n);\nlong long a[n],c[n];\nfor(i=0;i<n;i++)\nscanf(\"%lld\",&a[i]);\n\nfor(i=n-1;i>=0;i--){\n\nb[a[i]]++;\n\nif(b[a[i]]==1){\nc[k]=a[i];k++;}}\n\nprintf(\"%lld\\n\",k);\nfor(i=k-1;i>=0;i--)\nprintf(\"%lld \",c[i]);\n\nexit(0);}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x=0,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n;k++)\n {\n a[k] = a[k+1];\n }\n n--;\n j--;\n }\n }\n }\n if(n==0)\n {\n x = n+1;\n printf(\"%d\\n\",x);\n }\n else{\n x = n;\n printf(\"%d\\n\",x);}\n for(i=0;i<n;i++)\n {\n printf(\"%d \",a[i]);\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,k=0;\n scanf(\"%d\",&n);\n int A[n],l=0;\n k=n;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n for(j=0;j<i;j++)\n {\n if(A[i]==A[j])\n {\n k--;\n A[j]=-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",k);\n for(i=0;i<n;i++)\n {\n if(A[i]!=-1)\n printf(\"%d \",A[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,a[50],i,j,r;\n\tscanf(\"%d\",&n);\n\tr=n;\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\t\n\tfor(i=n-1;i>=0;i--){\n\t\tif(a[i]==-1)\n\t\t continue;\n\t for(j=i-1;j>=0;j--){\n\t \tif(a[j]==a[i]){\n\t \t\t\ta[j]=-1;\n\t \t\t\tr--;\n\t\t\t }\n\t \n\t \t\n\t\t }\n\t}\n\t\n\tprintf(\"%d\\n\",r);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=-1)\n\t\t printf(\"%d\\t\",a[i]);\n\t}\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n\n//int b[1000],c2;\n\nint main()\n{\n int i,n,j,a[55],c=0;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n\n for(i=0; i<n; i++){\n\t\tfor(j=i+1; j<n; j++){\n if(a[i]!=0){\n if(a[i]==a[j]){\n a[i]=0;\n //c++;\n }\n }\n\t\t}\n }\n for(i=0; i<n; i++){\n if(a[i]!=0){\n c++;\n }\n }\n printf(\"%d\\n\",c);\n\n for(i=0; i<n; i++){\n if(a[i]!=0){\n printf(\"%d \",a[i]);\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, n, count=0;\n scanf(\"%d\", &n);\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[j]==a[i])\n {\n a[i]=0;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n count++;\n }\n }\n printf(\"%d\\n\", count);\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n printf(\"%d \", a[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count=0;\n scanf(\"%d\",&n);\n int ara[n],b[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ara[i]);\n int k=0;\n for(i=n-1;i>=0;i--){\n if(ara[i]!=0){\n count++;\n b[k]=ara[i];\n k++;\n }\n for(j=i-1;j>=0;j--){\n if(ara[i]==ara[j]){\n ara[j]=0;\n }\n }\n }\n printf(\"%d\\n\",count);\n for(i=k-1;i>=0;i--)\n printf(\"%d \",b[i]);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,A[50],B[1001],i,X,C[50],t=0;\nscanf(\"%d\",&n);\nfor(i=0;i<=1000;i++)\n{\nB[i]=0;\n}\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&A[i]);\nX=A[i];\nB[X]+=1;\n}\nfor(i=0;i<n;i++)\n{\nX=A[i];\nif(B[X]==1)\n{\nC[t]=X;\nt++;\n}\nelse\n{\nB[X]-=1;\n}\n}\nprintf(\"%d\\n\",t);\nfor(i=0;i<t;i++)\n{\nif(i==t-1)\n{\nprintf(\"%d\\n\",C[i]);\n}\nelse\n{\nprintf(\"%d \",C[i]);\n}\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,j,count = 0;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n-1;i++){\n for(j=i+1;j<n;j++){\n if(ara[i]==0){continue;}\n if(ara[i]==ara[j]){\n ara[i] = 0;\n }\n }\n if(ara[i]!=0){\n count++;\n }\n }\n if(ara[n-1]!=0){count++;}\n printf(\"%d\\n\",count);\n for(i=0;i<n;i++){\n if(ara[i]==0){\n continue;\n }\n printf(\"%d \",ara[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[10000],b[10000],j=0,i,k,count=0,flag;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=0;i--)\n {\n flag=0;\n for(k=i;k<=n-1;k++)\n {\n if(k==i)\n {\n\n }\n else if(a[k]==a[i])\n {\n flag=1;\n }\n }\n if(flag==0)\n {\n count++;\n b[j]=a[i];\n j++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=count-1;i>=0;i--)\n {\n printf(\"%d \",b[i]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[200];\n int n,i,ln,j,k,b;\n scanf(\"%d\",&n);\n for (i=n-1;i>=0;i--){\n scanf(\"%d\",&a[i]);\n }\n for (i=0;i<n;i++){\n for (j=i+1;j<n;){\n if (a[i]==a[j]){\n for (k=j;k<n;k++){\n a[k]=a[k+1];\n }\n n--;\n }\n else j++;\n }\n }\n printf(\"%d\\n\",n);\n for (b=n-1;b>=0;b--){\n printf(\"%d \",a[b]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0,a[1001];\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n for(i=n-1; i>=0; i--)\n {\n if(a[i]==0)\n continue;\n c++;\n for(j=i-1; j>=0; j--)\n {\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n printf(\"%d\\n\",c);\n for(i=0; i<n; i++)\n {\n if(a[i]!=0)\n printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int N;\n scanf(\"%d\", &N);\n int a[N], b[N];\n for (int i = 0 ; i < N ; i++) {\n scanf(\"%d\", &a[i]);\n }\n for (int i = N - 1 ; i > 0; i--) {\n for (int j = i - 1; j >= 0 ; j--) {\n if (a[i] == a[j] && i != j) a[j] = 0;\n }\n }\n int sum = 0;\n for (int i = 0; i < N ; i++) {\n if (a[i] != 0) sum++;\n }\n printf(\"%d\\n\", sum);\n for (int i = 0; i < N; i++) {\n if (a[i] != 0 ) printf(\"%d\", a[i]);\n if (i != N - 1 && a[i] != 0)printf(\" \");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n , i , j , x=0 , a[1001];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=0;i--){\n if(a[i] == 0) continue;\n x++;\n for(j=i-1;j>=0;j--){\n if(a[j] == a[i]) a[j]=0;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0;i<n;i++){\n if(a[i] != 0) printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<malloc.h>\n#include<string.h>\nint main()\n{\n int n,i,j,*a=0,b[50],cnt=0;\n memset(b,0,sizeof(b));\n scanf(\"%d\",&n);\n a=(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=n-2;i>=0;i--)\n for(j=i+1;j<n;j++)\n if(a[i]==a[j])\n {\n\t b[i]=1;\n\t cnt++;\n break;\n\t}\n printf(\"%d\",n-cnt);\n printf(\"\\n\");\n\tfor(i=0;i<n;i++)\n if(b[i]==0)\n printf(\"%d \",a[i]);\n free(a);\n}\n \n "}, {"source_code": "/* Problem: 978A - Remove Duplicates */\n/* Author: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned short n;\n unsigned short x;\n unsigned short i;\n unsigned char existsNum[125];\n unsigned short aTmp;\n unsigned short byte;\n unsigned short bit;\n unsigned char mask;\n unsigned short a[50];\n unsigned short countAns;\n unsigned short ans[50];\n\n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 1 || n > 50)\n return -1;\n x = 0;\n for (i = 0; i < 125; i++)\n existsNum[i] = 0;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&aTmp) != 1)\n return -1;\n if (aTmp < 1 || aTmp > 1000)\n return -1;\n byte = (aTmp-1)/8;\n bit = (aTmp-1)%8;\n mask = 1 << (7-bit);\n if (!(existsNum[byte]&mask))\n {\n existsNum[byte] |= mask;\n x++;\n }\n a[i] = aTmp;\n }\n printf (\"%hu\\n\",x);\n countAns = 0;\n for (i = n; i; i--)\n {\n byte = (a[i-1]-1)/8;\n bit = (a[i-1]-1)%8;\n mask = 1 << (7-bit);\n if (existsNum[byte]&mask)\n {\n existsNum[byte] &= ~mask;\n ans[x-countAns-1] = a[i-1];\n countAns++;\n }\n }\n for (i = 0; i < countAns; i++)\n {\n if (i)\n putchar (' ');\n printf (\"%hu\",ans[i]);\n }\n putchar ('\\n');\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0,p;\n\tscanf(\"%d\",&n);\n\tint a[n],b[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(i=n-1;i>=0;i--){\n\t\tj=i+1;\n\t\tp=1;\n\t\twhile(j<=n-1){\n\t\t\tif(a[i]==a[j]){\n\t\t\t\tp=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tif(p==1){\n\t\tb[k]=a[i];\n\t\tk++;}\n\t}\n\tprintf(\"%d\\n\",k);\n\tfor(j=k-1;j>=0;j--)\n\tprintf(\"%d \",b[j]);\n\tprintf(\"\\n\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,x[51],y[1001]= {},i,k,max,j;\n\n scanf(\"%d\",&n);\n\n for(i=1; i<=n; i++)\n {scanf(\"%d\",&x[i]);\n y[x[i]]=i;}\n\n for(j=1; j<1001; j++)\n {\n max=j;\n for(i=j+1; i<1001; i++)\n if(y[i]>y[max]) max=i;\n\n if(max!=j)\n {\n k=y[j];\n y[j]=y[max];\n y[max]=k;\n }\n\n if(!y[j]) break;\n }\n\n printf(\"%d\\n\",j-1);\n\nfor(i=j-1;i>0; i--)\n printf(\"%d \",x[y[i]]);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint counter = 0;\n\tint i , j;\n\tint n ;\n\tint check;\n\tint a[1000 + 10];\n\tscanf(\"%d\" , &n);\n\n\tfor( i = 0 ; i < n ; i ++ )\n\t\tscanf(\"%d\" , &a[i]);\n\n\tfor( j = (n - 1) ; j >= 0 ; j-- ){\n\t\tif( a[j] != 0 ){\n\t\t\tcounter++;\n\t\t\tcheck = a[j];\n\t\t\tfor( int k = 0 ; k < j ; k++ ){\n\t\t\t\tif( a[k] != 0 && check == a[k] ){\n\t\t\t\t\ta[k] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", counter );\n\tfor( int k = 0 ; k < n ; k++ ){\n\t\tif( a[k] != 0 ){\n\t\t\tprintf(\"%d \", a[k]);\n\t\t}\n\t}\n}"}, {"source_code": "\tint comparetor (const void * a, const void * b)\n\t{\n\t\treturn ( *(int*)a - *(int*)b );\n\t}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[100];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n //qsort (arr, n, sizeof(int), comparetor );\n int t[100]={};\n //t[0]=arr[0];\n int k=0;\n for(int i=0;i<n;i++)\n {\n int flag=0;\n for(int j=i+1;j<n;j++)\n {\n if(arr[i]==arr[j])\n {\n flag++;\n break;\n }\n }\n if(flag==0)\n {\n t[k]=arr[i];\n k++;\n }\n }\n printf(\"%d\\n\",k);\n for(int i=0;i<k;i++)\n printf(\"%d \",t[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count=0;\n scanf(\"%d\",&n);\n int ara[n],b[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ara[i]);\n int k=0;\n for(i=n-1;i>=0;i--){\n if(ara[i]!=0){\n count++;\n b[k]=ara[i];\n k++;\n }\n for(j=i-1;j>=0;j--){\n if(ara[i]==ara[j]){\n ara[j]=0;\n }\n }\n }\n printf(\"%d\\n\",count);\n for(i=k-1;i>=0;i--)\n printf(\"%d \",b[i]);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint f[1001],a[101],b[101];\nint main()\n{\n int n,i,cn=1;\n scanf(\"%d\",&n);\n memset(f,0,sizeof(f));\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n;i>=1;i--)\n {\n if(!f[a[i]])\n {\n b[cn++]=a[i];\n f[a[i]]=1;\n }\n }\n printf(\"%d\\n\",cn-1);\n for(i=cn-1;i>=1;i--)\n {\n printf(\"%d \",b[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,c,n,k,l;\n scanf(\"%lld\",&n);\n long long int a[n];\n c=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&a[i]);\n k=0;\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n k=1;\n break;\n }\n }\n if(k==0)\n {\n c++;\n }\n }\n printf(\"%lld\\n\",c);\n for(i=0;i<n;i++)\n { k=0;\n for(j=i+1;j<n;j++)\n {\n if(a[i]==a[j])\n {\n k=1;\n break;\n }\n }\n if(k==0)\n {\n printf(\"%lld \",a[i]);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,p,j,k,l,c=0,x,b[1000],a[1000];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n\n\n }\n for(j=0;j<n;j++)\n {\n for(l=j+1;l<n;l++)\n {\n if(a[j]==a[l])\n a[j]=0;\n }\n }\n for(k=0;k<n;k++)\n {\n if(a[k]>0)\n c++;\n }\n printf(\"%d\\n\",c);\n for(p=0;p<n;p++)\n {\n if(a[p]>0)\n printf(\"%d \",a[p]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,l=0,g;\n scanf(\"%d\",&n);\n int A[n],B[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(A[j]==A[i])\n {\n l++;\n break;\n }\n }\n if(j==n)\n {\n B[k]=A[i];\n k++;\n }\n }\n printf(\"%d\\n\",n-l);\n for(i=0;i<n-l;i++)\n {\n printf(\"%d \",B[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int size;\n scanf(\"%d\", &size);\n int arr[size];\n int n;\n n=size;\n for(int i=0;i<size;i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n for(int i=n-1;i>=n-size;i--)\n {\n for(int j=i-1;j>=n-size;j--)\n {\n if(arr[j]==arr[i])\n {\n for(int k=j;k>=n-size;k--)\n {\n arr[k]=arr[k-1];\n }\n size--;\n j++;\n }\n }\n }\n printf(\"%d \\n\", size);\n for(int m=n-size;m<n;m++)\n printf(\"%d \",arr[m]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint n;\n\tint *array;\n\n\tscanf(\"%d\", &n);\n\tint sum = n;\n\tarray = malloc(sizeof(int) * n);\n\tfor(int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", array+i);\n\t\tint j = i-1;\n\t\twhile(j >= 0) {\n\t\t\tif(array[i] == array[j]) {\n\t\t\t\tarray[j] = 0;\n\t\t\t\tsum--;\n\t\t\t}\n\t\t\tj--;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", sum);\n\tfor(int i = 0; i < n; i++) {\n\t\tif(*(array+i) != 0) printf(\"%d \", *(array+i));\n\t} \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint count[1005];\nint main()\n{\n int i,j=0,n,x=0,z=0;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n for(i=n-1;i>=0;i--)\n {\n x=b[i];\n if(count[x]==0)\n {\n a[j]=x;\n j++;\n }\n count[x]++;\n }\n printf(\"%d\\n\",j);\n for(i=j-1;i>=0;i--)\n {\n printf(\"%d \",a[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int size;\n scanf(\"%d\", &size);\n int arr[size];\n int n;\n n=size;\n for(int i=0;i<size;i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n for(int i=n-1;i>=n-size;i--)\n {\n for(int j=i-1;j>=n-size;j--)\n {\n if(arr[j]==arr[i])\n {\n for(int k=j;k>=n-size;k--)\n {\n arr[k]=arr[k-1];\n }\n size--;\n j++;\n }\n }\n }\n printf(\"%d \\n\", size);\n for(int m=n-size;m<n;m++)\n printf(\"%d \",arr[m]);\n return 0;\n}"}, {"source_code": "/* Problem: 978A - Remove Duplicates */\n/* Author: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned short n;\n unsigned short x;\n unsigned short i;\n unsigned char existsNum[125];\n unsigned short aTmp;\n unsigned short byte;\n unsigned short bit;\n unsigned char mask;\n unsigned short a[50];\n unsigned short countAns;\n unsigned short ans[50];\n\n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 1 || n > 50)\n return -1;\n x = 0;\n for (i = 0; i < 125; i++)\n existsNum[i] = 0;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&aTmp) != 1)\n return -1;\n if (aTmp < 1 || aTmp > 1000)\n return -1;\n byte = (aTmp-1)/8;\n bit = (aTmp-1)%8;\n mask = 1 << (7-bit);\n if (!(existsNum[byte]&mask))\n {\n existsNum[byte] |= mask;\n x++;\n }\n a[i] = aTmp;\n }\n printf (\"%hu\\n\",x);\n countAns = 0;\n for (i = n; i; i--)\n {\n byte = (a[i-1]-1)/8;\n bit = (a[i-1]-1)%8;\n mask = 1 << (7-bit);\n if (existsNum[byte]&mask)\n {\n existsNum[byte] &= ~mask;\n ans[x-countAns-1] = a[i-1];\n countAns++;\n }\n }\n for (i = 0; i < countAns; i++)\n {\n if (i)\n putchar (' ');\n printf (\"%hu\",ans[i]);\n }\n putchar ('\\n');\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint a[50],b[1001],i,n,j,k;\n\tmemset(b,0,sizeof(int)*1001);\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tb[a[i]]++;\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(b[a[i]]>1)\n\t\t{\n\t\t\tb[a[i]]--;\n\t\t\tfor(j=i;j<n-1;j++)\n\t\t\t{\n\t\t\t\ta[j]=a[j+1];\n\t\t\t}\n\t\t\t\n\t\t\tn--;\n\t\t\ti--;\n\t\t}\n\t}\t\n\tprintf(\"%d\\n\",n);\n\tfor(i=0;i<n-1;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"%d\",a[i]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int first[10001],second[10001],i,j,count=0,T,n;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&first[i]);\n\n\n for(i=n;i>1;i--){\n for(j=i-1;j>=1;j--){\n if(first[i]==first[j]){\n first[j]=0;\n }\n }\n }\n\n for(i=1;i<=n;i++){\n if(first[i]==0);\n else{\n second[count]=first[i];\n count++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<count;i++){\n printf(\"%d \",second[i]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b[1006]={0},a[1007],d[1000],i,max=0,min=100000,c=0;\nscanf(\"%d\",&n);\n\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&a[i]);\n\n}\n\nfor(i=n-1;i>=0;i--)\n{\n if(b[a[i]]==0)\n {\n b[a[i]]=a[i];\n d[i]=a[i];\n c++;\n }\n}\nprintf(\"%d\\n\",c);\nfor(i=0;i<n;i++)\n{\nif(d[i]!=0)\nprintf(\"%d \" ,d[i]);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(int argc, char ** argv) {\n\tint i, j, n, * a, * b, c[1001];\n\n\tscanf(\"%d\", &n);\n\ta = malloc(sizeof(int) * n);\n\tb = malloc(sizeof(int) * n);\n\tmemset(c, 0, 1001 * sizeof(int));\n\tfor(i = 0; i < n; ++i) {\n\t\tscanf(\"%d\", &(a[i]));\n\t\t++c[a[i]];\n\t}\n\tfor(i = 0, j = 0; i < n; ++i) {\n\t\t--c[a[i]];\n\t\tif (c[a[i]] == 0) {\n\t\t\tb[j++] = a[i];\n\t\t}\n\t}\n\tprintf(\"%d\\n\", j);\n\tfor(i = 0; i < j - 1; ++i) {\n\t\tprintf(\"%d \", b[i]);\n\t}\n\tprintf(\"%d\\n\", b[i]);\n\tfree(a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(int i=0;i<n;i++)\n {\n for(int j=1+i;j<n;j++)\n {\n if(a[i]==a[j])\n {\n a[i]=0;break;\n }\n }\n }\n for(int i=0;i<n;i++)\n {\n if(a[i]>0)\n c++;\n }\n printf(\"%d\\n\",c);\n for(int i=0;i<n;i++)\n {\n if(a[i]>0)\n {\n printf(\"%d \",a[i]);\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i<n;i++){\n \n scanf(\"%d\",&ar[i]);\n}\nfor(i=n;i>0;i--){\n for(j=i-1;j>=0;j--){\n if(ar[i]==ar[j]){ar[j]=0;\n \n }\n }\n }\n \n for(i=0;i<n;i++){\n \n if(ar[i]!=0)m++;\n}\nprintf(\"%d\\n\",m);\nfor(i=0;i<n;i++){\n \n if(ar[i]!=0)printf(\"%d \",ar[i]);\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j=0;\n int count=0;\n int n;\n int a[1000];\n int b[10000];\n int c[1000];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[a[i]]++;\n }\n for(i=n-1;i>=0;i--)\n {\n if(b[a[i]]>=1)\n {\n count++;\n c[j]=a[i];\n b[a[i]]=0;\n j++;\n }\n }\n\n printf(\"%d\\n\",count);\n for(i=j-1;i>=0;i--)\n printf(\"%d \",c[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n for(j=i+1;j<n;j++)\n ara[j-1] = ara[j];\n n--;\n i=i-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d \",ara[i]);\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{int t,n,i,j,k,flag;\n\n\n{\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0; i<n; i++)\n\tscanf(\"%d\",&a[i]);\n\n\tint b[n];\n\tk=0;\n\t\tfor(i=n-1; i>=0; i--)\n\t\t{ flag=0;\n\t\t\tfor(j=0; j<k; j++)\n\t\t\t{\n\t\t\tif(a[i]==b[j])\n\t\t\t{flag=1; break;}\n\n\t\t\t}\n\t\t\tif(flag==0)\n\t\t\tb[k++]=a[i];\n\t\t}\n printf(\"%d\\n\",k);\n for(i=k-1; i>=0; i--)\n printf(\"%d \",b[i]);\n printf(\"\\n\");\n\n\n}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int t[1001],x[1001],a,i,j;\n scanf(\"%i\",&a);\n for(i=0;i<a;i++)\n scanf(\"%i\",&t[i]);\n \n for(i=a-1;i>=0;i--)\n for(j=i-1;j>=0;j--){\n if(t[j]==t[i])\n t[j]=0;\n }\n j=0;\n for(i=0;i<a;i++)\n if(t[i]!=0)\n j++;\n printf(\"%i\\n\",j);\n for(i=0;i<a;i++)\n if(t[i]!=0)\n printf(\"%i \",t[i]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,o,p,n,k,a[10000];\n\to=0;p=0;\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\tfor (i=0;i<n;i++)\n\t{\n\t\tk=i+1;\n\t\twhile (k<n)\n\t\t{\n\t\t\tif (a[i]==a[k]) a[i]=0;\n\t\t\tk++;\n\t\t}\n\t}\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif (a[i]!=0) o++;\n\t}\n\tprintf(\"%d\\n\",o);\n\tfor (i=0,k=0;i<n;i++)\n\t{\n\t\tif (a[i]!=0 && k<o-1)\n\t\t{\n\t\t\tprintf(\"%d \",a[i]);\n\t\t\tk++;\n\t\t}\n\t\telse if (a[i]!=0) printf(\"%d\\n\",a[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <limits.h>\n#include <math.h>\n\n\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int *hash=(int *)calloc(sizeof(int),1001);\n int A[n];\n int count=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n if(hash[A[i]]==0)\n {\n count++;\n }\n hash[A[i]]++;\n }\n printf(\"%d\\n\",count);\n for(int i=0;i<n;i++)\n {\n hash[A[i]]--;\n if(hash[A[i]]==0)\n {\n printf(\"%d \",A[i]);\n }\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[1001];\n int ara1[1001];\n int i,j,count=1,b=1,a;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++){\n scanf(\"%d\",&ara[i]);\n }\n ara1[0]=ara[a-1];\n for(i=a-1;i>=0;i--){\n for(j=0;j<count;j++){\n if(ara[i]==ara1[j]){\n b=0;\n }\n }\n if(b==1){\n ara1[j]=ara[i];\n count++;\n }\n else\n b=1;\n }\n printf(\"%d\\n\",count);\n for(i=0,j=count-1;i<count/2;i++,j--){\n b=ara1[i];\n ara1[i]=ara1[j];\n ara1[j]=b;\n }\n for(i=0;i<count;i++){\n printf(\"%d \",ara1[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[n], flag[n], d = 0;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tflag[i] = 0;\n\t}\n\n\tfor (int i = n - 1; i >= 0; i--)\n\t{\n\t\tfor (int j = i - 1; j >= 0; j--)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t{\n\t\t\t\tflag[j] = 1;\n\t\t\t}\n\t\t}\n\t}\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tif (flag[i] == 0)\n\t\t\t++d;\n\t}\n\tprintf(\"%d\\n\", d);\n\tfor (int i = 0; i < n; i++)\n\t\tif (flag[i] == 0)\n\t\t\tprintf(\"%d \", arr[i]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int ara[n];\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n for(j=i+1;j<n;j++)\n ara[j-1] = ara[j];\n n--;\n i=i-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d \",ara[i]);\n return 0;\n}\n "}, {"source_code": "/* Problem: 978A - Remove Duplicates */\n/* Author: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned short n;\n unsigned short x;\n unsigned short i;\n unsigned char existsNum[125];\n unsigned short aTmp;\n unsigned short byte;\n unsigned short bit;\n unsigned char mask;\n unsigned short a[50];\n unsigned short countAns;\n unsigned short ans[50];\n\n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 1 || n > 50)\n return -1;\n x = 0;\n for (i = 0; i < 125; i++)\n existsNum[i] = 0;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&aTmp) != 1)\n return -1;\n if (aTmp < 1 || aTmp > 1000)\n return -1;\n byte = (aTmp-1)/8;\n bit = (aTmp-1)%8;\n mask = 1 << (7-bit);\n if (!(existsNum[byte]&mask))\n {\n existsNum[byte] |= mask;\n x++;\n }\n a[i] = aTmp;\n }\n printf (\"%hu\\n\",x);\n countAns = 0;\n for (i = n; i; i--)\n {\n byte = (a[i-1]-1)/8;\n bit = (a[i-1]-1)%8;\n mask = 1 << (7-bit);\n if (existsNum[byte]&mask)\n {\n existsNum[byte] &= ~mask;\n ans[x-countAns-1] = a[i-1];\n countAns++;\n }\n }\n for (i = 0; i < countAns; i++)\n {\n if (i)\n putchar (' ');\n printf (\"%hu\",ans[i]);\n }\n putchar ('\\n');\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n int a[n+1];\n int i,j,ck=0,b[n],t;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++)\n b[i]=-1;\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n b[j]=0;\n }\n }\n\n for(i=0;i<n;i++)\n {\n if(b[i]!=0)\n ck++;\n }\n printf(\"%d\\n\",ck);\n for(i=0;i<n;i++)\n {\n if(b[i]!=0)\n printf(\"%d \",a[i]);\n }\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdbool.h>\nint main()\n{\n\tint n,arr[100],i,j,ans[50],t=0;\n\tbool b;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tb=false;\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(arr[i]==arr[j])\n b=true;\n\t\t}\n\t\tif(b==false)\n\t\tans[t++]=arr[i];\n\t}\n\tprintf(\"%d\\n\",t);\n\tfor(i=0;i<t;i++)\n\tprintf(\"%d \",ans[i]);\n\t\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n\n//using namespace std;\n\nint main() {\n \n int length = 0;\n scanf(\"%d\", &length);\n int array[length];\n for(int i=0; i<length; i++) {\n scanf(\"%d\", &array[i]);\n }\n \n int n = 0;\n for(int i=0; i<length; i++) {\n n = array[i];\n for(int j=0; j<length; j++) {\n if((n == array[j]) && (j !=i)) {\n\tfor(int k=i; k<length-1; k++) {\n\t array[k] = array[k+1];\n\t}\n\tlength -= 1;\n\ti -= 1;\n\tbreak;\n }\n \n }\n }\n printf(\"%d\\n\", length);\n for(int i=0; i<length; i++) {\n printf(\"%d \", array[i]);\n }\n\n \n\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain()\n{\n int n, i, j, c=0;\n scanf(\"%d\", &n);\n\n int a[n];\n\n for(i=0; i<n; i++) scanf(\"%d\", &a[i]);\n\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(a[i]==a[j])\n {\n a[i]=0;\n c++;\n break;\n }\n }\n }\n printf(\"%d\\n\", n-c);\n\n for(i=0; i<n; i++)\n {\n if(a[i]!=0) printf(\"%d \", a[i]);\n }\n\n printf(\"\\n\");\n\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint main(void)\n{\n\tint n,x,y, flag =1;\n\tscanf(\"%i\", &n);\n\tfor (x = 4; x <= 999996 && flag; x+=2)\n\t\tfor (y = 999996; y >= 4 && flag; y-=2)\n\t\t\tif (((n - y) / x == 1 || (n - x) / y == 1) && ((n - y) % x == 0 || (n - x) % y == 0))\n\t\t\t\tflag = 0;\n\tprintf(\"%i %i\", x,y);\n\treturn 0;\n}\n*/\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint main(void)\n{\n\tint n, i, flag, j, count = 0, a[50] = { 0 }, b[50] = { 0 };\n\tscanf(\"%i\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%i\", &a[i]);\n\tfor (i = n-1; i >=0; i--)\n\t{\n\t\tflag = 0;\n\t\tif (i == n - 1)\n\t\t{\n\t\t\tb[n - 1] = a[n - 1];\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (j = n - 1; j > n-1-count; j--)\n\t\t\t\tif (a[i] == b[j])\n\t\t\t\t{\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (flag == 0)\n\t\t\t{\n\t\t\t\tb[n - 1 - count] = a[i];\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%i\\n\", count);\n\tfor (i = n-count; i < n; i++)\n\t\t\tprintf(\"%i \", b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){ long long int a,b,c,d=0,j[2000],t,x[2000],y[2000],p[2000],n,i,k,temp,l;\nscanf(\"%lld\",&n);\n\nfor(i=0;i<n;i++){\nscanf(\"%lld\",&x[i]);}\n for(i=n-1;i>=0;i--)\n {\n for(k=0;k<i;k++)\n {\n\n if(x[k]!=0&&x[k]==x[i])\n {x[k]=0;}\n }\n\n }\n c=0;\n for(i=0;i<n;i++){\nif(x[i]==0){continue;}\nc++;\n }\nprintf(\"%lld\\n\",c);\nfor(i=0;i<n;i++){\nif(x[i]==0){continue;}\nprintf(\"%lld \",x[i]);}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, n, count=0;\n scanf(\"%d\", &n);\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[j]==a[i])\n {\n a[i]=0;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n count++;\n }\n }\n printf(\"%d\\n\", count);\n for(i=0;i<n;i++)\n {\n if(a[i]!=0)\n {\n printf(\"%d \", a[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x=0,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n;k++)\n {\n a[k] = a[k+1];\n }\n n--;\n j--;\n }\n }\n }\n if(n==0)\n {\n x = n+1;\n printf(\"%d\\n\",x);\n }\n else{\n x = n;\n printf(\"%d\\n\",x);}\n for(i=0;i<n;i++)\n {\n printf(\"%d \",a[i]);\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,z;\n scanf(\"%d\",&n);\n int a[n],b[n],c[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n for(i=n-1;i>=0;i--)\n {\n z=0;\n\n for(j=0;j<k;j++)\n {\n if(b[j]==a[i])\n {\n z++;\n break;\n }\n }\n if(z==0)\n {\n\n b[k]=a[i];\n k++;\n }\n }\n printf(\"%d\\n\",k);\n for(i=k-1;i>=0;i--)\n {\n printf(\"%d \",b[i]);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n int a[n+5],i,j,cnt=0;\n int na[n+2];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n a[i]=-1;\n\n }\n\n }\n// for(i=0;i<n;i++)\n// printf(\"%d \",a[i]);\n// printf(\"\\n\");\n for(i=0;i<n;i++){\n if(a[i]!=-1)\n cnt++;\n }\n printf(\"%d\\n\",cnt);\n for(i=0;i<n;i++){\n if(a[i]!=-1)\n printf(\"%d \",a[i]);\n }\n\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0,p;\n\tscanf(\"%d\",&n);\n\tint a[n],b[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(i=n-1;i>=0;i--){\n\t\tj=i+1;\n\t\tp=1;\n\t\twhile(j<=n-1){\n\t\t\tif(a[i]==a[j]){\n\t\t\t\tp=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tif(p==1){\n\t\tb[k]=a[i];\n\t\tk++;}\n\t}\n\tprintf(\"%d\\n\",k);\n\tfor(j=k-1;j>=0;j--)\n\tprintf(\"%d \",b[j]);\n\tprintf(\"\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,l=0;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(int i=n-1;i>=0;i--){\n scanf(\"%d\",&a[i]);\n b[i]=0;\n }\n for(int i=0;i<n;i++){\n if(b[i]==0){\n l++;\n for(int j=i+1;j<n;j++){\n if(a[i]==a[j]){\n b[j]=1;\n }\n }\n }\n }\n printf(\"%d\\n\",l);\n for(int i=n-1;i>=0;i--){\n if(b[i]==0){\n printf(\"%d \",a[i]);\n }\n }\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,j,k,n, m = 0;\n scanf(\"%d\",&n);\n int a[n], b[n];\n for(i = 0; i < n; ++i)\n scanf(\"%d\", &b[i]);\n\n for(i = n-1; i >= 0; --i)\n a[m++] = b[i];\n for(i = 0;i < n; ++i)\n {\n for(j=i+1;j<n;)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n-1;++k)\n a[k]=a[k+1];\n\n --n;\n }\n else\n ++j;\n }\n }\n\n printf(\"%d\\n%d\", n, a[n-1]);\n for(i=n-2;i>=0;--i)\n printf(\" %d\",a[i]);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n+1],flag[1001]={0},i,b[n+1],j;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1,j=0;i>=0;i--)\n {\n if(flag[a[i]]==0)\n {\n b[j]=a[i];\n j++;\n }\n flag[a[i]]=1;\n }\n printf(\"%d\\n\",j);\n for(i=j-1;i>=0;i--)\n {\n printf(\"%d\",b[i]);\n if(i!=0)\n printf(\" \");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n//using namespace std;\n\nint main() {\n \n int length = 0;\n scanf(\"%d\", &length);\n int array[length];\n for(int i=0; i<length; i++) {\n scanf(\"%d\", &array[i]);\n }\n \n int n = 0;\n for(int i=0; i<length; i++) {\n n = array[i];\n for(int j=0; j<length; j++) {\n if((n == array[j]) && (j !=i)) {\n\tfor(int k=i; k<length-1; k++) {\n\t array[k] = array[k+1];\n\t}\n\tlength -= 1;\n\ti -= 1;\n\tbreak;\n }\n \n }\n }\n printf(\"%d\\n\", length);\n for(int i=0; i<length; i++) {\n printf(\"%d \", array[i]);\n }\n\n \n\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,srx[1001],sry[1001],lgx[1001],lhy;\nint main()\n{\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) \n scanf(\"%d\",&lgx[i]);\n for(i=n;i>=1;i--)\n if(srx[lgx[i]]==0)\n {lhy++;\n sry[lhy]=lgx[i];\n srx[lgx[i]]=1;}\n printf(\"%d\\n\",lhy);\n for(i=lhy;i>=1;i--)\n printf(\"%d \",sry[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0; i<n; i++)\n scanf(\"%d\",&arr[i]);\n int r[n];\n for(int i=0; i<n; i++)\n r[i]=0;\n int flag=0;\n int cur=0;\n for(int i=0; i<n-1; i++)\n {\n for(int j=i+1; j<n; j++)\n {\n if(arr[j]==arr[i])\n {\n flag=1;\n break;\n }\n \n }\n if(flag==0)\n {\n r[cur]=arr[i];\n cur++;\n }\n flag=0;\n }\n r[cur]=arr[n-1];\n printf(\"%d\\n\",cur+1);\n for(int i=0; i<n; i++)\n {\n if(r[i]!=0)\n printf(\"%d \",r[i]);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint n;\n\tscanf(\"%d\",&n);\n\tint m=n;\n\tint a[n-1];\n\tfor(int i=0;i<n;i++)\n\t{\n\t scanf(\"%d\",&a[i]);\n\t}\n\tfor(int j=n-1;j>0;j--)\n\t{\n\t if(a[j]!=0)\n\t for(int k=j-1;k>=0;k--)\n\t {\n\t if(a[j]==a[k])\n\t {\n\t a[k]=0;\n\t m--;\n\t }\n\t }\n\t}\n\tprintf(\"%d\\n\",m);\n\tfor(int h=0;h<n;h++)\n\t{\n\t if(a[h]!=0) printf(\"%d \",a[h]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n , i , j , x=0 , a[1001];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=0;i--){\n if(a[i] == 0) continue;\n x++;\n for(j=i-1;j>=0;j--){\n if(a[j] == a[i]) a[j]=0;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0;i<n;i++){\n if(a[i] != 0) printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,o,p,n,k,a[10000];\n\to=0;p=0;\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\tfor (i=0;i<n;i++)\n\t{\n\t\tk=i+1;\n\t\twhile (k<n)\n\t\t{\n\t\t\tif (a[i]==a[k]) a[i]=0;\n\t\t\tk++;\n\t\t}\n\t}\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif (a[i]!=0) o++;\n\t}\n\tprintf(\"%d\\n\",o);\n\tfor (i=0,k=0;i<n;i++)\n\t{\n\t\tif (a[i]!=0 && k<o-1)\n\t\t{\n\t\t\tprintf(\"%d \",a[i]);\n\t\t\tk++;\n\t\t}\n\t\telse if (a[i]!=0) printf(\"%d\\n\",a[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n int n, size = 0, a[50], arr[50], seen[1001] = {0};\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n scanf(\"%d\", arr + i);\n\n for (int i = n - 1; i >= 0; i--) {\n if (!seen[arr[i]]) {\n seen[arr[i]] = 1;\n a[size++] = arr[i];\n }\n }\n\n printf(\"%d\\n\", size);\n for (int i = size - 1; i >= 0; i--)\n printf(\"%d \", a[i]);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,l=0,g;\n scanf(\"%d\",&n);\n int A[n],B[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(A[j]==A[i])\n {\n l++;\n break;\n }\n }\n if(j==n)\n {\n B[k]=A[i];\n k++;\n }\n }\n printf(\"%d\\n\",n-l);\n for(i=0;i<n-l;i++)\n {\n printf(\"%d \",B[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint b[n];\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tb[i]=-1;\n\t}\n\tint k=0;\n\tfor (int i = n-1; i >=0 ; i--)\n\t{\n\t\tint flag=0;\n\t\tfor (int j = 0; j < n; ++j)\n\t\t{\n\t\t\tif (b[j]==a[i])\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (flag!=1)\n\t\t{\n\t\t\tb[k++]=a[i];\n\t\t}\n\t}\n\t//for (int i = 0; i < n; ++i)\n\t//{\n\t\t//printf(\"%d \",b[i]);\n\t//}\n\tint c;\n\tfor (c = 0; b[c]!=-1 && c<n; ++c);\n\t\tprintf(\"%d\\n\",c);\n\tfor (int i = c-1; i>=0; i--)\n\t{\n\t\tprintf(\"%d \",b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&x[i]); \n\t\tif (a[x[i]] == 0)c++; a[x[i]]++;\n\t}printf(\"%d\\n\", c);\n\tfor (c = 0; c < n; c++){\n\t\tif (a[x[c]] == 1) {\n\t\t\tprintf(\"%d\", x[c]);\n\t\t\tif (c < n - 1)printf(\" \");\n\t\t}\n\t\ta[x[c]]--;\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\tint i,j,n,a[50],temp=0;\n\t\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\t\n\tfor(i=0;i<n;i++){\n\t\tfor(j=i+1;j<n;j++){\n\t\t\tif(a[i]==a[j]){\n\t\t\t\ta[i]=0;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0;i<n;i++){\n\t\tif(a[i]>0)\n\t\ttemp++;\n\t}\n\tprintf(\"%d\\n\",temp);\n\t\n\tfor(i=0;i<n;i++){\n\t\tif(a[i]>0)\n\t\tprintf(\"%d \",a[i]);\n\t}\n}\n\n"}, {"source_code": "#include<stdio.h>\nint n,i,srx[1001],sry[1001],lgx[1001],lhy;\nint main()\n{\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) \n scanf(\"%d\",&lgx[i]);\n for(i=n;i>=1;i--)\n if(srx[lgx[i]]==0)\n {lhy++;\n sry[lhy]=lgx[i];\n srx[lgx[i]]=1;}\n printf(\"%d\\n\",lhy);\n for(i=lhy;i>=1;i--)\n printf(\"%d \",sry[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k,l=0,n;\n scanf(\"%d\",&n);\n int arr[20000];\n for(i=0;i<n;i++){\n scanf(\"%d\",&arr[i]);\n }\n for(j=n-1;j>=0;j--){\n for(k=j-1;k>=0;k--){\n if(arr[k]==arr[j]){\n arr[k]=0;\n }\n }\n }\n for(i=0;i<n;i++){\n if(arr[i]!=0){\n l++;\n\n }\n }\n printf(\"%d\\n\",l);\n for(i=0;i<n;i++){\n if(arr[i]!=0){\n printf(\"%d \",arr[i]);\n }\n }\n printf(\"\\n\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n,ada=0,k=0;\n\tint input[1005],sisa[1005];\n\tscanf(\"%d\",&n);\n\tfor(int s=0;s<n;s++){\n\t\tscanf(\"%d\",&input[s]);\n\t}\n\tfor(int x=n-1;x>=0;x--){\n\t\tif(input[x]!=0){\n\t\t\tada=0;\n\t\t\tfor(int y=x;y>=0;y--){\n\t\t\t\tif(input[y]==input[x]&&y!=x){\n\t\t\t\t\tinput[y]=0;\n\t\t\t\t\tada++;\n\t\t\t\t}\n\t\t\t\t\tif(y==0&&ada>0||y==0&&ada==0){\n\t\t\t\t\t\tsisa[k]=input[x];\n\t\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"%d\\n\",k);\n\t\t\tfor(int x=k-1;x>=0;x--){\n\t\t\t\tif(x==k-1){\n\t\t\t\t\tprintf(\"%d\",sisa[x]);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tprintf(\" %d\",sisa[x]);\n\t\t\t\t}\n\t\t\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100],i,j,k,n;\n scanf(\"%d\",&n);\n for(i=n-1;i>=0;i--)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n;k++)\n {\n a[k]=a[k+1];\n }\n n--;\n }\n else\n {\n j++;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=n-1;i>=0;i--)\n {\n printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint main(){\n\tint n,x,ada=0,k=0;\n\tchar input[1005],sisa[1005];\n\tscanf(\"%d\",&n);\n\tfor(int s=0;s<n;s++){\n\t\tscanf(\"%d\",&input[s]);\n\t}\n\tfor(int x=n-1;x>=0;x--){\n\t\tif(input[x]!=0){\n\t\t\tada=0;\n\t\t\tfor(int y=x-1;y>=0;y--){\n\t\t\t\tif(input[y]==input[x]){\n\t\t\t\t\tinput[y]=0;\n\t\t\t\t\tada++;\n\t\t\t\t}\n\t\t\t\t\tif(y==0&&ada>0||y==0&&ada==0){\n\t\t\t\t\t\tsisa[k]=input[x];\n\t\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"%d\\n\",k);\n\t\t\tfor(int x=k-1;x>=0;x--){\n\t\t\t\tif(x==k-1){\n\t\t\t\t\tprintf(\"%d\",sisa[x]);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tprintf(\" %d\",sisa[x]);\n\t\t\t\t}\n\t\t\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x=0,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n;k++)\n {\n a[k]=a[k+1];\n }\n }\n n--;\n }\n x=n;\n j--;\n }\n printf(\"%d\\n\",x);\n for(i=0;i<n;i++)\n {\n printf(\"%d \",a[i]);\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\nint main(void){\n \nint test,i,j,n,c,k,count, a[1000],rank,sum,b[1000];\n scanf(\"%d\",&n);\n count=c=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",&k);\n if(a[k]==0){\n a[k]++;\n b[c++]=k;\n }else{\n count--;\n }\n }\n \nscanf(\"%d\\n\",count);\n\nfor(i=0;i<c;i++){\n \n printf(\"%d \",b[i]);\n}\n\n\n\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[60],b[60];\nint main()\n{\n int n,i,j;\n int count1=0;\n int flag[60]={0};\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[i]=a[i];\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(b[i]==a[j])\n {\n if(flag[j]>=1)\n {\n count1++;\n b[i]=0;\n flag[j]++;\n }\n else\n flag[j]++;\n }\n }\n }\n printf(\"%d\\n\",n-count1);\n for(i=0;i<n;i++)\n {\n if(b[i]!=0)\n printf(\"%d \",b[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int N;\n scanf(\"%d\", &N);\n int freq[1005], a[60];\n memset(freq, 0, sizeof(freq));\n for(int i=0; i<N; i++)\n {\n scanf(\"%d\", &a[i]);\n freq[a[i]]++;\n }\n for(int i=0; i<N; i++)\n {\n freq[a[i]]--;\n if(freq[a[i]] != 0)\n a[i] = -1;\n }\n for(int i=0; i<N; i++)\n {\n if(a[i] != -1)\n printf(\"%d \", a[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\t\n\tfor(i=n-1;i>=0;i--){\n\t\tif(a[i]==-1)\n\t\t continue;\n\t for(j=i-1;j>=0;j--){\n\t \tif(a[j]==a[i])\n\t \ta[j]=-1;\n\t \t\n\t\t }\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=-1)\n\t\t printf(\"%d\\t\",a[i]);\n\t}\n\t\n\t\n}"}, {"source_code": "#include <stdio.h>\nint main (){\n int loop, i,j;\n scanf(\"%d\",&loop);\n int number[loop];\n for(i = 0; i < loop; i++){\n scanf(\"%d\",&number[i]);\n }\n for(i = loop - 1; i > -1; i--){\n for(j = i-1; j > -1; j--){\n if(number[i] == number[j] && number[i] != -1 && number[j] != -1){\n number[j] = -1;\n }\n }\n }\n \n for(i = 0 ; i < loop; i++){\n if(number[i] != -1){\n printf(\"%d \",number[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j,k,z,flag=0,count=0,h=0,n;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]); \n }\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n b[flag]=j;\n flag++;\n }\n }\n }\n \n for(i=0;i<n;i++)\n {\n z=0;\n for(j=0;j<flag;j++)\n {\n if(i==b[j])\n {\n \n z=1;\n }\n \n }\n if(z==1)\n {\n count++;\n \n \n for(k=i-h;k<n;k++)\n {\n a[k]=a[k+1];\n }\n h++;\n }\n }\n printf(\"%d \\n\",n-count);\n for(i=0;i<n-count;i++)\n {\n printf(\"%d\", a[i]);\n \n } \n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\t//code\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n-1];\n\tfor(int i=0;i<n;i++)\n\t{\n\t scanf(\"%d\",&a[i]);\n\t}\n\tfor(int j=n-1;j>0;j--)\n\t{\n\t if(a[j]!=0)\n\t for(int k=j-1;k>=0;k--)\n\t {\n\t if(a[j]==a[k]) a[k]=0;\n\t }\n\t}\n\tfor(int h=0;h<n;h++)\n\t{\n\t if(a[h]!=0) printf(\"%d \",a[h]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n int i,n,b[50]={0},a[50]={0},x;\n\n scanf(\"%d\",&n);\n x=n;\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n b[a[i]]++;\n }\n for(i=0; i<n; i++){\n if(b[a[i]]>1){\n b[a[i]]--;\n a[i]=0;\n x--;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0; i<50; i++)\n if(a[i])\n printf(\"%d \",a[i]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n\nint main()\n{\n int arr[1000]; \n int n; \n int i, j, k; \n\n \n\n scanf(\"%d\", &n);\n\n \n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n\n\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n \n if(arr[i] == arr[j])\n {\n \n for(k=i; k<n; k++)\n {\n arr[k] = arr[k + 1];\n }\n\n \n n--;\n\n \n i--;\n }\n }\n }\n\n printf(\"%d\\n\",n);\n for(i=0; i<n; i++)\n {\n printf(\"%d\\t\", arr[i]);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,count=0;\n scanf(\"%d\",&n);\n int a[n];\n int s[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]==a[j])\n {\n a[i]='p';\n break;\n }\n }\n if(a[i]!='p')\n {\n s[k]=a[i];\n count++;\n k++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<k;i++)\n {\n printf(\"%d \",s[i]);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <conio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int list[n];\n int i, j;\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &list[i]);\n }\n\n for(i = n-1; i > 0; i--){\n if(list[i] != 0){\n for(j = i - 1; j >= 0; j--){\n if(list[j] == list[i]) list[j] = 0;\n }\n }\n }\n\n for(i = 0; i < n; i++){\n if(list[i] != 0) printf(\"%d \", list[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main()\n{\n int n,count=0,m=0,i=0,x=1,k=1,l,t,g,p,q;\n scanf(\"%d\",&n);\n int arr[n],temp[n],temp2[n];\n for(int k=0;k<n;k++)\n scanf(\"%d\",&arr[k]);\n temp[0]=arr[0];\n \n \n for(int i=0;i<n;i++)\n {\n for(m=0;m<x;m++)\n {\n if(arr[i]!=temp[m])\n continue;\n else \n break;\n }\n if(m==x)\n {\n temp[k]=arr[i];\n k++;\n x++;\n }\n }\n for(int p=0;p<k;p++)\n {\n for(int q=0;q<n;q++)\n {\n if(temp[p]==arr[q])\n temp2[p]=q;\n else if(q==n-1)\n {\n if(temp[p]==arr[q])\n temp2[p]=q;\n }\n }\n }\n \n for(int l=0;l<k-1;l++)\n {\n for(int p=0;p<k-1;p++)\n {\n if(temp2[p]>temp2[p+1])\n {\n g=temp2[p];\n temp2[p]=temp[p+1];\n temp2[p+1]=g;\n t=temp[p];\n temp[p]=temp[p+1];\n temp[p+1]=t;\n }\n }\n }\n \n printf(\"%d\\n\",k);\n for(int i=0;i<k;i++)\n printf(\"%d \",temp[i]);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\t\n\tfor(i=n-1;i>=0;i--){\n\t\tif(a[i]==-1)\n\t\t continue;\n\t for(j=i-1;j>=0;j--){\n\t \tif(a[j]==a[i])\n\t \ta[j]=-1;\n\t \t\n\t\t }\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=-1)\n\t\t printf(\"%d\\t\",a[i]);\n\t}\n\t\n\t\n}"}, {"source_code": "\tint comparetor (const void * a, const void * b)\n\t{\n\t\treturn ( *(int*)a - *(int*)b );\n\t}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[100];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n qsort (arr, n, sizeof(int), comparetor );\n int t[100]={};\n t[0]=arr[0];\n int k=1;\n for(int i=1;i<n;i++)\n {\n int flag=0;\n for(int j=0;j<i;j++)\n {\n if(arr[i]==arr[j])\n {\n flag++;\n break;\n }\n }\n if(flag==0)\n {\n t[k]=arr[i];\n k++;\n }\n }\n printf(\"%d\\n\",k);\n for(int i=0;i<k;i++)\n printf(\"%d \",t[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,n,j,k,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=f;i--)\n {\n for(j=i-1;j>=f;j--)\n {\n if(a[i]==a[j])\n {\n for(k=j;k>f;k--)\n {\n a[k]=a[k-1];\n }\n f++;\n }\n }\n\n }\n printf(\"%d\",f);\n for(i=f;i<n;i++)\n {\n printf(\"%d\",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[10000],b[10000],n;\nint main()\n{\n int i,j,k=0,l;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n for(i=n;i>0;i--)\n {\n l=i;\n for(j=1;j<=n;j++)\n {\n if(a[l]==a[j]&&j!=l&&j>l)l=j;\n }\n b[l]=a[l];\n }\n for(i=1;i<=n;i++)\n if(a[i]!=0)k++;\n printf(\"%d\\n\",k);\n for(i=1;i<=k;i++)\n if(b[i]!=0)printf(\"%d \",b[i]);\n}"}, {"source_code": "#include<stdio.h>\n \n \nint main(){\n int n;scanf(\"%d\",&n);\n int a[n];for(int i=0;i<n;i++)scanf(\"%d\",&a[i]);\n for(int i=n-1;i>0;i--){\n for(int j=i-1;j>=0;j--){\n if(a[j]==a[i])a[j]=0;\n }\n }\n \n for(int i=0;i<n;i++){\n if(a[i]==0);else printf(\"%d \",a[i]);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n+1],flag[1001]={0},i,b[n+1],j;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1,j=0;i>=0;i--)\n {\n if(flag[a[i]]==0)\n {\n b[j]=a[i];\n j++;\n }\n flag[a[i]]=1;\n }\n printf(\"%d\\n\",j-1);\n for(i=j-1;i>=0;i--)\n {\n printf(\"%d\",b[i]);\n if(i!=0)\n printf(\" \");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j,k,z,flag=0,count=0,h=0,q=0,n,b[1000];\n scanf(\"%d\",&n);\n int a[n],c[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]); \n }\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n b[flag]=j;\n flag++;\n }\n }\n }\n /*printf(\"%d \\n\",flag);\n for(i=0;i<flag;i++)\n {\n \n printf(\"%d \",b[i]);\n }\n printf(\"\\n\");*/\n for(i=0;i<n;i++)\n {\n z=0;\n for(j=0;j<flag;j++)\n {\n if(i==b[j])\n {\n \n z=1;\n }\n \n }\n if(z==1)\n {\n count++;\n }\n else\n {\n c[q]=a[i];\n q++;\n }\n \n \n \n } \n printf(\"%d \\n\", count);\n for(i=0;i<count;i++)\n {\n printf(\"%d \",c[i]);\n }\n /*printf(\"\\n\");\n printf(\"%d\",b[13]);\n printf(\"\\n\");*/\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{int a[50],b[50],i,k,h;\nshort int t;\nscanf(\"%d\",&t);\nfor(i=t;i>=1;i--)\nscanf(\"%d\",&a[i]);\nb[1]=a[1];k=1;h=1;\nfor(i=2;i<=t;i++)\n{\nk=h;\nwhile(k)\nif(a[i]!=b[k])\nk--;\n else break;\nif(k==0)\n{b[++h]=a[i];\n}\n}\nprintf(\"%d\\n\",h);\nfor(i=h;i>=1;i--)\nprintf(\"%d\",b[i]);\nreturn 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i = 0,j = 0,counter = 0,no_input,new_size;\n scanf(\"%d\",&no_input);\n int input[no_input];\n for(i = 0; i < no_input; i++){\n scanf(\"%d\",&input[i]);\n }\n for(i = no_input; i > -1; i--){\n for(j = i - 1; j > -1; j--){\n if(input[i] == input[j] && input[j] != -1){\n counter++;\n input[j] = -1;\n }\n }\n }\n new_size = no_input - counter;\n int new_input[new_size];\n printf(\"%d\\n\",counter);\n for(i = 0 ; i < no_input; i++){\n if(input[i] != -1){\n new_input[j] = input[i];\n printf(\"%d \",new_input[j]);\n j++;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n \n k=i;\n for(j=i+1;j<n;j++)\n ara[k] = ara[j];\n n--;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d\",ara[i]);\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n int a[1001],b[1001]={0};\n\n for (int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[a[i]]=1;\n }\n int s=0;\n for (int i=0;i<1001;i++)\n {\n s+=b[i];\n }\n printf(\"%d\\n\",s);\n for (int i=0;i<1001;i++)\n {\n if (b[i])\n printf(\"%d \",i);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tint n,a[1000],b[1000],count[1000]={0} ;\n\tscanf(\"%d\",&n);\n\t\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint k=0;\n\tfor(int i=n-1;i>=0;i--)\n\t{ \n\t\tif(count[a[i]]==0)\n\t\t{ \n\t\t\tb[k]=a[i]; k++;\n\t\t\tcount[a[i]]++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",k-1);\n\tfor(int i=k-1;i>=0;i--)\n\t{\n\t\tprintf(\"%d \",b[i]);\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,k=0;\n scanf(\"%d\",&n);\n int A[n],l=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n for(j=0;j<i;j++)\n {\n if(A[i]==A[j])\n {\n k++;\n A[j]=-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",k);\n for(i=0;i<n;i++)\n {\n if(A[i]!=-1)\n printf(\"%d \",A[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,s=0;\n scanf(\"%d\",&n);\n int arr[i];\n int brr[1000]={0};\n for(i=0;i<n;i++){\n scanf(\"%d\",&arr[i]);\n if(brr[arr[i]-1]==0)s++;\n brr[arr[i]-1]++;}\n printf(\"%d\\n\",s);\n for(i=0;i<n;i++)\n {\n if(brr[arr[i]-1]==1)printf(\"%d \",arr[i]);\n brr[arr[i]-1]--;\n }\n \n \n}"}, {"source_code": "#include <stdio.h>\n#define MAX_SIZE 1000\nint main()\n{\n int arr[MAX_SIZE];\n int size;\n int i, j, k;\n scanf(\"%d\", &size);\n for(i=0; i<size; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n\n for(i=0; i<size; i++)\n {\n for(j=i+1; j<size; j++)\n {\n if(arr[i] == arr[j])\n {\n for(k=j; k<size; k++)\n {\n arr[k] = arr[k + 1];\n }\n size--;\n j--;\n }\n }\n }\n\n printf(\"%d\\n\",size);\n for(i=1; i<size; i++)\n {\n printf(\"%d \", arr[i]);\n }\n printf(\"%d\\n\",arr[0]);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k,l=0;\n int arr[100];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;)\n {\n if(arr[j]==arr[i])\n {\n for(k=j;k<n;k++)\n {\n arr[k]=arr[k+1];\n }\n n--;\n }\n else\n {\n j++;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n {\n printf(\"%d \",arr[i]);\n }\n\n\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[n], flag[1001];\n\tfor (int i=1;i<=1000;i++) flag[i]=-1;\n\tfor (int i=0;i<n;i++) {\n\t\tscanf(\"%d\", &arr[i]);\n\t\tif (flag[arr[i]]==-1) flag[arr[i]]=i;\n\t\telse {\n\t\t\tarr[flag[arr[i]]]=0;\n\t\t\tflag[arr[i]]=i;\t\n\t\t}\n\t}\n\tint c=0;\n\tfor (int i=0;i<n;i++) c++;\n\tprintf(\"%d\\n\", c);\n\tfor (int i=0;i<n;i++) {\n\t\tif (arr[i]!=0) printf(\"%d \", arr[i]);\n\t}\n}\n"}, {"source_code": "main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n for(j=i;j<n;j++)\n {\n if(a[i]==a[j])\n {\n for(k=j;k<n-1;k++)\n {\n a[k]=a[k+1];\n }\n n--;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n {\n printf(\"%d \",a[i]);\n }\n}\n"}, {"source_code": "\n#include<stdio.h>\n\nint main()\n{\n\tint n, arr[1000], i, j;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tfor(j=0; j<i; j++)\n\t\t{\n\t\t\tif(arr[j]==arr[i])\n\t\t\t{\n\t\t\t arr[j]=0;\n\t\t\t break;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<n; i++)\n\t if(arr[i]!=0)\n\t printf(\"%d \", arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int a[60], f[1500] = {0}, re[60];\n int i, l = 0;\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n; i++)\n {\n if(f[a[i]] == 0)\n {\n re[l] = a[i];\n l++;\n f[a[i]] = 1;\n }\n }\n printf(\"%d\\n\", l);\n for(i = 0; i < l; i++)\n {\n printf(\"%d\", re[i]);\n if(i<l-1)\n {\n printf(\" \");\n }\n else\n {\n printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,p,j,k,c=0,x,b[1000],a[1000]={0};\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&p);\n a[p]=1;\n\n }\n for(j=0;j<1000;j++)\n {\n if(a[j]==1)\n b[c++]=j;\n }\n printf(\"%d\\n\",c);\n for(k=0;k<c;k++)\n printf(\"%d \",b[k]);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{int n;\nint s[100]={0},ss[1005]={0},u=0,w,i,sss[100]={0};\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{\n scanf(\"%d\",&s[i]);\n}\nfor(i=n-1;i>=0;i--)\n{if(ss[s[i]]!=0)\n{sss[i]=1;u++;}\n ss[s[i]]++;\n}\nprintf(\"%d\\n\",n-u);\nfor(i=0;i<n;i++)\n printf(\"$%d\\n\",sss[i]);\nw=0;\nfor(i=0;i<n;i++)\n{\n if(sss[i]==0)\n {\n if(w==0)\n {\n printf(\"%d\",s[i]);\n w=1;\n }\n else\n printf(\" %d\",s[i]);\n }\n}\nprintf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&x[i]); \n\t\tif(a[x[i]]==0)c++,a[x[i]]++;\n\t}printf(\"%d\\n\", c);\n\tfor (c = 0; c < n; c++){\n\t\tif (a[x[c]] == 1) {\n\t\t\tprintf(\"%d\", x[c]);\n\t\t\tif (c < n - 1)printf(\" \");\n\t\t}\n\t\ta[x[c]]--;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint v[50];\n\nint main() {\n int n, i, j;\n scanf( \"%d\", &n );\n for ( i = 0; i < n; i++ ) {\n scanf( \"%d\", &v[i] );\n }\n for ( i = n - 1; i >= 0; i-- ) {\n if ( v[i] != -1 ) {\n for ( j = i - 1; j >= 0; j-- )\n if ( v[j] == v[i] )\n v[j] = -1;\n }\n }\n for ( i = 0; i < n; i++ )\n if ( v[i] != -1 )\n printf( \"%d \", v[i] );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=k;i++)\n {\n if(n%10==0)\n n=n/10;\n else\n n=n-1;\n }\nprintf(\"%d\",n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x;\n scanf(\"%d\",&x);\n int k,ara[x];\n for(k=0; k<x; k++)\n {\n scanf(\"%d\",&ara[k]);\n }\n int sum=0;\n for(i=0; i<x; i++)\n {\n int c=0,d=0;\n for(j=i; j<x-1; j++)\n {\n if(ara[i]==ara[j+1])\n {\n c++;\n }\n }\n if(c==0)\n {\n d++;\n sum=sum+d;\n int l;\n for(l=sum; l<=sum; l++)\n {\n ara[l]=ara[i];\n\n }\n }\n }\n printf(\"%d\\n\",sum);\n int h;\n for(h=1; h<=sum; h++)\n {\n printf(\"%d \",ara[h]);\n }\nprintf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n\nint main()\n{\n int arr[100]; \n int n; \n int i, j, k; \n\n \n\n scanf(\"%d\", &n);\n\n \n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n\n\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n \n if(arr[j] == arr[i])\n {\n \n for(k=i; k<n; k++)\n {\n arr[k] = arr[k + 1];\n }\n\n \n n--;\n\n \n i--;\n }\n }\n }\n\n printf(\"%d\\n\",n);\n for(i=0; i<n; i++)\n {\n printf(\"%d \", arr[i]);\n }\n\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int size;\n scanf(\"%d\", &size);\n int arr[size];\n int n;\n n=size;\n for(int i=0;i<size;i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n for(int i=n-1;i>=n-size;i--)\n {\n for(int j=i-1;j>=n-size;j--)\n {\n if(arr[j]==arr[i])\n {\n for(int k=j;k>=n-size;k--)\n {\n arr[k]=arr[k-1];\n }\n size--;\n j++;\n }\n }\n }\n printf(\"%d \\n\", size);\n for(int m=n-size;m<n;m++)\n printf(\"%d\",arr[m]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,a[50],i,j;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\t\n\tfor(i=n-1;i>=0;i--){\n\t\tif(a[i]==-1)\n\t\t continue;\n\t for(j=i-1;j>=0;j--){\n\t \tif(a[j]==a[i])\n\t \ta[j]=-1;\n\t \t\n\t\t }\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]!=-1)\n\t\t printf(\"%d\\t\",a[i]);\n\t}\n\t\n\t\n}"}, {"source_code": "#include <stdio.h>\n \nint main()\n{\n int n,count=0,m=0,i=0,x=1,k=1,l,t,g,p,q;\n scanf(\"%d\",&n);\n int arr[n],temp[n],temp2[n];\n for(int k=0;k<n;k++)\n scanf(\"%d\",&arr[k]);\n temp[0]=arr[0];\n \n \n for(int i=0;i<n;i++)\n {\n for(m=0;m<x;m++)\n {\n if(arr[i]!=temp[m])\n continue;\n else \n break;\n }\n if(m==x)\n {\n temp[k]=arr[i];\n k++;\n x++;\n }\n }\n for(int p=0;p<k;p++)\n {\n for(int q=0;q<n;q++)\n {\n if(temp[p]==arr[q])\n temp2[p]=q;\n else if(q==n-1)\n {\n if(temp[p]==arr[q])\n temp2[p]=q;\n }\n }\n }\n \n for(int l=0;l<k-1;l++)\n {\n for(int p=0;p<k-1;p++)\n {\n if(temp2[p]>temp2[p+1])\n {\n g=temp2[p];\n temp2[p]=temp[p+1];\n temp2[p+1]=g;\n t=temp[p];\n temp[p]=temp[p+1];\n temp[p+1]=t;\n }\n }\n }\n \n printf(\"\\n%d\\n\",k);\n for(int i=0;i<k;i++)\n printf(\"%d \",temp[i]);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&x[i]); \n\t\tif(a[x[i]]==0)c++,a[x[i]]=1;\n\t}printf(\"%d\\n\", c);\n\tfor(c=0;c<n;c++)\n\t\tif (a[x[c]]-- > 0) { \n\t\tprintf(\"%d\", x[c]); \n\t\tif(c<n-1)printf(\" \");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k,p;\n scanf(\"%d\",&n);\n int array[n];\n for(p=0;p<n;p++) scanf(\"%d\",&array[p]);\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(array[i]==array[j])\n {\n array[j]=array[j+1];\n n=n-1;\n break;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(k=0;k<n;k++)\n printf(\"%d\",array[k]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[10000],b[10000],j=0,i,k,count=0,flag;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n flag=0;\n for(k=i;k>=0;k--)\n {\n if(k==i)\n {\n\n }\n else if(a[k]==a[i])\n {\n flag=1;\n }\n }\n if(flag==0)\n {\n count++;\n b[j]=a[i];\n j++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<=count-1;i++)\n {\n printf(\"%d \",b[i]);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int cmpfunc( const void *a, const void *b) {\n return *(long long int*)a - *(long long int *)b;\n}\n\nint main()\n{\n long long int test,d,n,x,i,sum=0,count=0,j,flag=0,p,y,m,max=0,o,g,r,k, a[1000000],b[1000],c[10000];\n\ncount=0;\n scanf(\"%lld\",&n);\n for(i=0;i<n;i++){\n scanf(\"%lld\",&a[i]);\n \n }\n\n for(i=n-1;i>=0;i--){\n if(b[a[i]]==0){\n c[count++]=a[i];\n b[a[i]]=1;\n }\n }\nprintf(\"%lld\\n\",count);\nfor(i=count-1;i>=0;i--){\n printf(\"%lld \",c[i]);\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,cnt=0;\n scanf(\"%d\",&n);\n int ara[n],b[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ara[i]);\n int k=0;\n for(i=n-1;i>=0;i--){\n if(ara[i]!=0){\n b[k]=ara[i];\n k++;\n }\n for(j=i-1;j>=0;j--){\n if(ara[i]==ara[j]){\n ara[j]=0;\n }\n }\n }\n for(i=k-1;i>=0;i--)\n printf(\"%d \",b[i]);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int b[2000],i,j,k=0,t=0,a[2000]={0},n;\n scanf(\"%d\",&n);\n for(i=0;i<=n-1;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<=n-1;i++)\n {\n k=0;\t\n for(j=i;j<=n-1;j++)\t\n {\n \tif (a[i]==a[j])\n \t{k++;\n }\n }\n if (k==1)\n {b[t]=a[i];t++;\n }\n }\n printf(\"%d\",t);\n for(i=0;i<=t-1;i++)\n {\n \tprintf(\"%d\",b[i]);\n }\n}"}, {"source_code": "#include <stdio.h>\nint a[60],b[60];\nint main()\n{\n int n,i,j;\n int count1=0;\n int flag[60]={0};\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[i]=a[i];\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(b[i]==a[j])\n {\n if(flag[j]>=1)\n {\n count1++;\n b[i]=0;\n flag[j]++;\n }\n else\n flag[j]++;\n }\n }\n }\n printf(\"%d\\n\",n-count1);\n for(i=0;i<n;i++)\n {\n if(b[i]!=0)\n printf(\"%d \",b[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i<n;i++){\n \n scanf(\"%d\",&ar[i]);\n}\nfor(i=0;i<n-1;i++){\n for(j=i+1;j<n;j++){\n if(ar[i]==ar[j]){ar[j]=0;\n \n }\n }\n }\n \n for(i=0;i<n;i++){\n \n if(ar[i]!=0)m++;\n}\nprintf(\"%d\\n\",m);\nfor(i=0;i<n;i++){\n \n if(ar[i]!=0)printf(\"%d \",ar[i]);\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n int i,n,b[50]={0},a[50]={0},x;\n\n scanf(\"%d\",&n);\n x=n;\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n b[a[i]]++;\n }\n for(i=0; i<n; i++){\n if(b[a[i]]>1){\n b[a[i]]--;\n a[i]=0;\n x--;\n }\n }\n printf(\"%d\\n\",x);\n for(i=0; i<50; i++)\n if(a[i])\n printf(\"%d \",a[i]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n;\n long int x=0,s=0;\n int i=0;\n int t[50];\n\n scanf(\"%d\",&n);\n\n\n\n\n\n for(int z=0; z<n; z++)\n {\n\n scanf(\"%llu\",&t[z]);\n\n\n\n\n }\n\n\nfor(i=0; i<n-1; i++)\n {\n\n\n for(int j=i+1; j<n; j++)\n {\n\n\n\n if(t[i]==t[j])\n {\n for(int x=i; x<n-1; x++)\n t[x]=t[x+1];\n\n n--;\n i--;\n\n }\n\n }\n\n\n\n\n }\n printf(\"%d\\n\",n);\n for( i=0; i<n; i++)\n {\n\n printf(\"%d \",t[i]);\n\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, arr[1001], flag[1001], d = 0;\n\tscanf(\"%d\", &n);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tflag[i] = 0;\n\t}\n\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tfor (int j = i + 1; j < n; j++)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t\tflag[j] = 1;\n\t\t}\n\t}\n\tfor (int i = 0; i < n; i++)\n\t\tif (flag[i] == 0)\n\t\t\t++d;\n\tprintf(\"%d\\n\", d);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tif (flag[i] == 0)\n\t\t\tprintf(\"%d \", arr[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\nint main()\n{\n\tint i,c=0,n,x[51],a[1001]={0};scanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&x[i]); \n\t\tif(a[x[i]]==0)c++,a[x[i]]++;\n\t}printf(\"%d\\n\", c);\n\tfor (c = 0; c < n; c++){\n\t\tif (a[x[c]] == 1) {\n\t\t\tprintf(\"%d\", x[c]);\n\t\t\tif (c < n - 1)printf(\" \");\n\t\t}\n\t\ta[x[c]]--;\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,c=0,t,a[1001],b[1001]={0};\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tfor(j=0;j<n-i;j++)\n\t\t{\n\t\t\tif(a[j]>a[j+1])\n\t\t\t{\n\t\t\t\tt=a[j];\n\t\t\t\ta[j]=a[j+1];\n\t\t\t\ta[j+1]=t;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]==a[i+1])\n\t\t{\n\t\t\tfor(j=i+1;a[j]==a[j+1];j++,i++);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc++;\n\t\t\tb[i]=a[i];\n\t\t}\n\t}\n\tb[i]=a[n-1];\n\tprintf(\"%d\\n\",c+1);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(b[i]!=0)\n\t\tprintf(\"%d \",b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\nint n;\nscanf(\"%d\",&n);\nint m=0;\nint i,j,ar[n];\nfor(i=0;i<n;i++){\n \n scanf(\"%d\",&ar[i]);\n}\nfor(i=0;i<n-1;i++){\n for(j=i+1;j<n;j++){\n if(ar[i]==ar[j]){ar[j]=0;\n \n }\n }\n }\n \n for(i=0;i<n;i++){\n \n if(ar[i]!=0)m++;\n}\nprintf(\"%d\\n\",m);\nfor(i=0;i<n;i++){\n \n if(ar[i]!=0)printf(\"%d \",ar[i]);\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, num[51], t[1000] = {0};\n scanf(\"%d\", &n);\n int a, have = 0;\n for(a=0; a<n; a++)\n scanf(\"%d\", &num[a]);\n for(a=n-1; a>=0; a--)\n {\n if(t[num[a]]==0)\n {\n t[num[a]]=1;\n have++;\n }\n else\n num[a]=0;\n }\n printf(\"%d\\n\", have);\n for(a=0; a<n; a++)\n {\n if(num[a]!=0)\n printf(\"%d \", num[a]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%I64d\", &n);\n long long int a[1002], f[1002], r[1002];\n long long int i, j, count = 0, k = 0;\n for(i=0; i<n; i++)\n {\n scanf(\"%I64d\", &a[i]);\n f[i] = 0;\n }\n for(i=0; i<n; i++)\n {\n for(j =i+1; j<n; j++)\n {\n if(a[i]==a[j])\n {\n f[j] = -1;\n }\n }\n if(f[i]!=-1)\n {\n r[k++] = a[i];\n }\n }\n printf(\"%I64d\\n\", k);\n printf(\"%I64d\", r[0]);\n for(i=1; i<k; i++)\n printf(\" %I64d\", r[i]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,k=0,l,m=0,n,o=0;\n scanf(\"%d\",&n);\n char s[n];\n\n scanf(\"%s\",s);\n l=strlen(s);\n for(j=0;j<l;j++)\n {\n if(s[j]=='x')\n {\n k++;\n if(k>=3)\n {\n m++;\n }\n }\n else\n {\n k=0;\n }\n\n }\n printf(\"%d\\n\",m);\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n;\n long int x=0,s=0;\n int i=0;\n int t[50];\n\n scanf(\"%d\",&n);\n\n\n\n\n\n for(int z=0; z<n; z++)\n {\n\n scanf(\"%llu\",&t[z]);\n\n\n\n\n }\n\n\nfor(i=0; i<n-1; i++)\n {\n\n\n for(int j=i+1; j<n; j++)\n {\n\n\n\n if(t[i]==t[j])\n {\n for(int x=i; x<n-1; x++)\n t[x]=t[x+1];\n\n n--;\n i--;\n\n }\n\n }\n\n\n\n\n }\n printf(\"%d\\n\",n);\n for( i=0; i<n; i++)\n {\n\n printf(\"%d \",t[i]);\n\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, j, n, a[1000], x, count=1;\n\n scanf(\"%d\", &x);\n for(i=0 ; i<x ; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=x-1 ; i>=0 ; i--)\n {\n n=a[i];\n for(j=i-1 ; j>=0 ; j--)\n {\n if(a[j]==a[i])\n {\n a[j]=0;\n }\n }\n }\n for(i=0 ; i<x ; i++)\n {\n if(a[i]!=0)\n {\n if(count==1)\n {\n printf(\"%d\", a[i]);\n count++;\n }\n else printf(\" %d\", a[i]);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int a[60], f[1500] = {0}, re[60];\n int i, l = 0;\n for(i = 0;i < n; i++)\n scanf(\"%d\", &a[i]);\n for(i = 0; i < n; i++)\n if(f[a[i]] == 0){\n re[l++] = a[i];\n f[a[i]] = 1;\n }\n printf(\"%d\\n\", l);\n for(i = 0;i < l;i++){\n printf(\"%d\", re[i]);\n if(i<l-1)printf(\" \");\n else printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int t[1001],x[1001],a,i,j=0;\n scanf(\"%i\",&a);\n for(i=0;i<a;i++)\n scanf(\"%i\",&t[i]);\n \n for(i=a-1;i>=0;i--)\n for(j=i-1;j>=0;j--){\n if(t[j]==t[i])\n t[j]=0;\n }\n \n \n for(i=0;i<a;i++)\n if(t[i]!=0)\n j++;\n printf(\"%i\\n\",j);\n for(i=0;i<a;i++)\n if(t[i]!=0)\n printf(\"%i\",t[i]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,c,n,k,l;\n scanf(\"%lld\",&n);\n long long int a[n];\n c=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&a[i]);\n k=0;\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n k=1;\n break;\n }\n }\n if(k==0)\n {\n c++;\n }\n }\n printf(\"%lld\\n\",c);\n for(i=0;i<c;i++)\n { k=0;\n for(j=i+1;j<c;j++)\n {\n if(a[i]==a[j])\n {\n k=1;\n break;\n }\n }\n if(k==0)\n {\n printf(\"%lld \",a[i]);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count=0,sum=0;\n scanf(\"%d\",&n);\n int a[n];\n int b[n];\n for(i=0; i<n; i++)\n scanf(\"%d\",&a[i]);\n for(i=0; i<n; i++)\n {\n sum=0;\n for(j=i-1; j>=0; j--)\n {\n if(a[i]==a[j])\n sum++;\n }\n if(sum==0)\n {\n b[count]=a[i];\n count++;\n }\n\n }\n printf(\"%d\\n\",count);\n for(i=0; i<count; i++)\n printf(\"%d \",b[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n/*int binarysearch(int key,int *a,int n)\n{\n int first,last,middle;\n first=0;\n last=n-1;\n while(first<=last)\n {\n\n }\n}\ntypedef struct node {\n int val;\n struct node *next;\n}node;\nint cmpfunc(const void * a,const void * b)\n{\n return *(int *)a - *(int *)b;\n}*/\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int count[1000]={0};\n j=0;\n for(i=n-1;i>=0;i--)\n {\n if(count[a[i]]==0)\n {\n count[a[i]]=1;\n b[j]=a[i];\n j++;\n }\n }\n printf(\"%d\\n\",j);\n for(i=j-1;i>=0;i--)\n printf(\"%d \",b[i]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nara[1001];\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,p,count=0;\n for(i=0;i<1001;i++){\n ara[i]=0;\n }\n int a[101];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n p=a[i];\n ara[p]=ara[p]+1;\n }\n for(i=0;i<1001;i++){\n if(ara[i]!=0){\n count++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<1001;i++){\n if(ara[i]!=0){\n printf(\"%d \",i);\n }\n }\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n;\n long int x=2,s=0;\n int i=0;\n int t[50];\n\n scanf(\"%d\",&n);\n\n\n\n\n\n for(int z=0; z<n; z++)\n {\n\n scanf(\"%llu\",&t[z]);\n\n\n\n\n }\n\n\nfor(i=0; i<n-1; i++)\n {\n\n\n for(int j=i+1; j<n; j++)\n {\n\n\n\n if(t[i]==t[j])\n {\n for(int x=i; x<n-1; x++)\n t[x]=t[x+1];\n\n n--;\n i--;\n\n }\n\n }\n\n\n\n\n }\n printf(\"%d\\n\",n);\n for( i=0; i<n; i++)\n {\n\n printf(\"%d \",t[i]);\n\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tint n,a[1000],b[1000],count[1000]={0} ;\n\tscanf(\"%d\",&n);\n\t\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint k=0;\n\tfor(int i=n-1;i>=0;i--)\n\t{ \n\t\tif(count[a[i]]==0)\n\t\t{ \n\t\t\tb[k]=a[i]; k++;\n\t\t\tcount[a[i]]++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",k);\n\tfor(int i=k-1;i>=0;i--)\n\t{\n\t\tprintf(\"%d \",b[i]);\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n, arr[1000], i, j;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tfor(j=0; j<i; j++)\n\t\t{\n\t\t\tif(arr[j]==arr[i])\n\t\t\t{\n\t\t\t arr[j]=0;\n\t\t\t break;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t if(arr[i]!=0)\n\t {\n\t \tif(i!=n-1)\n\t printf(\"%d \", arr[i]);\n\t else\n \t printf(\"%d\\n\", arr[i]);\n\t }\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stddef.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int h[1001];\n int c[n];\n for(i=0;i<n;i++)\n c[i]=0;\n \n int d=0;\n for(i=n-1;i>=0;i--)\n {\n if(h[a[i]]==0){\n d++;\n h[a[i]]++;\n c[i]=a[i];\n }\n }\n printf(\"%d\\n\",d);\n for(i=0;i<n;i++)\n if(c[i]!=0)\n printf(\"%d \",c[i]);\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\nint main(void){\n \nint test,i,j,n,c,k,count, a[1000],rank,sum,b[1000];\n scanf(\"%d\",&n);\n count=c=0;\n count=n;\n for(i=0;i<n;i++){\n scanf(\"%d\",&k);\n if(a[k]==0){\n a[k]++;\n b[c++]=k;\n }else{\n count--;\n }\n }\n \nprintf(\"%d\\n\",count);\nif(count==0){\n printf(\"0\");\n}else{\nfor(i=0;i<c;i++){\n \n printf(\"%d \",b[i]);\n}\n\n}\n\n \n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n\nint main()\n{\n\tint n, arr[1000], i, j;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &arr[i]);\n\t\tfor(j=0; j<i; j++)\n\t\t{\n\t\t\tif(arr[j]==arr[i])\n\t\t\t{\n\t\t\t arr[j]=0;\n\t\t\t break;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<n; i++)\n\t if(arr[i]!=0)\n\t printf(\"%d \", arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n/*int binarysearch(int key,int *a,int n)\n{\n int first,last,middle;\n first=0;\n last=n-1;\n while(first<=last)\n {\n\n }\n}\ntypedef struct node {\n int val;\n struct node *next;\n}node;\nint cmpfunc(const void * a,const void * b)\n{\n return *(int *)a - *(int *)b;\n}*/\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n],b[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int count[1000]={0};\n j=0;\n for(i=n-1;i>=0;i--)\n {\n if(count[a[i]]==0)\n {\n count[a[i]]=1;\n b[j]=a[i];\n j++;\n }\n }\n printf(\"%d\\n\",j);\n for(i=j-1;i>=0;i--)\n printf(\"%d \",b[i]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,j,i,count;\n scanf(\"%d\",&n);\n count = n;\n int arr[n];\n for(i=1;i<=n;i++)\n scanf(\"%d\",arr+i-1);\n int arr1[n];\n for(i=n-1;i>=0;i--){\n for(j=count;j<n;j++)\n if(arr1[j]==arr[i])break;\n if(j!=n)continue;\n arr1[--count]=arr[i];}\n for(i=count;i<n;i++)\n printf(\"%d \",arr1[i]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n,x,ada=0,k=0;\n\tchar input[1005],sisa[1005];\n\tscanf(\"%d\",&n);\n\tfor(int s=0;s<n;s++){\n\t\tscanf(\"%d\",&input[s]);\n\t}\n\tfor(int x=n-1;x>=0;x--){\n\t\tif(input[x]!=0){\n\t\t\tada=0;\n\t\t\tfor(int y=x;y>=0;y--){\n\t\t\t\tif(input[y]==input[x]&&y!=x){\n\t\t\t\t\tinput[y]=0;\n\t\t\t\t\tada++;\n\t\t\t\t}\n\t\t\t\t\tif(y==0&&ada>0||y==0&&ada==0){\n\t\t\t\t\t\tsisa[k]=input[x];\n\t\t\t\t\t\tk++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"%d\\n\",k);\n\t\t\tfor(int x=k-1;x>=0;x--){\n\t\t\t\tif(x==k-1){\n\t\t\t\t\tprintf(\"%d\",sisa[x]);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tprintf(\" %d\",sisa[x]);\n\t\t\t\t}\n\t\t\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid bb(int n);\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tbb(n);\n\treturn 0;\n}\n\nvoid bb(int n)\n{\n\tint a[50] = {0},m = 0;\n\tfor(int i = 0; i < n; i++)\n\t\tscanf(\"%d\", &a[i]);//scanf(\"%d\", a); fails\n\tfor(int i = 0; i < n; i++){\n\t\tint t = i;\n\t\tfor(int j = i + 1; j < n; j++){\n\t\t\tif(a[j] == a [i]) {\n\t\t\t\ta[i] = 0;\n\t\t\t\ti = j;\n\t\t\t}\n\t\t\tprintf(\"%d \",a[i]);\n\t\t}\n\t\ti = t;\n\t}\n\t/*for(int i = 0; i < n; i++){\n\t\tint t = 0;\n\t\tfor(int j = i + 1; j < n; j++){\n\t\t\tt = i;\n\t\t\tif(a[j] == a [i]) {\n\t\t\t\ta[i] = 0;\n\t\t\t\ti = j;\n\t\t\t}\n\t\t\n\t\t\tprintf(\"%d \",a[i]);\n\t\t}\n\t\ti = t;\n\t}fails\n\t*/\n\tfor(int i = 0; i < n; i++){\n\t\tprintf(\"%d \",a[i]);\n\t}\n\tprintf(\"\\n\");\n\tfor(int i = 0; i < n; i++){\n\t\tif(a[i] != 0) m++;\n\t}\n\tprintf(\"%d\\n\", m);\n\tfor(int i = 0; i < n; i++){\n\t\tif(a[i] != 0) printf(\"%d \",a[i]);\n\t}\n\tprintf(\"\\n\");\n}\n"}, {"source_code": "int isLucky(int n)\n{\n int arr[15]={};\n for(int i=0;i<10;i++)\n arr[i]=0;\n int num=n;\n while(num>0)\n {\n int digit=num%10;\n if(arr[digit])\n return 0;\n arr[digit]=1;\n num=num/10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int t=l;\n while(t<=r)\n {\n if(isLucky(t))\n {\n printf(\"%d\",t);\n return 0;\n }\n t++;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,n,j,k,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n-1;i>=f;i--)\n {\n for(j=i-1;j>=f;j--)\n {\n if(a[i]==a[j])\n {\n for(k=j;k>f;k--)\n {\n a[k]=a[k-1];\n }\n f++;\n }\n }\n\n }\n printf(\"%d\\n\",n-f);\n for(i=f;i<n;i++)\n {\n printf(\"%d \",a[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,k=0;\n scanf(\"%d\",&n);\n int A[n],l=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n k=0;\n for(j=0;j<i;j++)\n {\n if(A[i]==A[j])\n {\n k=1;\n break;\n }\n else\n k=0;\n }\n if(k!=0)\n {\n A[i]=-1;\n l++;\n }\n }\n printf(\"%d\\n\",l);\n for(i=0;i<n;i++)\n {\n if(A[i]!=-1)\n printf(\"%d \",A[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x;\n scanf(\"%d\",&x);\n int k,ara[x];\n for(k=0; k<x; k++)\n {\n scanf(\"%d\",&ara[k]);\n }\n int sum=0;\n for(i=0; i<x; i++)\n {\n int c=0,d=0;\n for(j=i; j<x-1; j++)\n {\n if(ara[i]==ara[j+1])\n {\n c++;\n }\n }\n if(c==0)\n {\n d++;\n sum=sum+d;\n int l;\n for(l=sum; l<=sum; l++)\n {\n ara[l]=ara[i];\n\n }\n }\n }\n printf(\"%d\\n\",sum);\n int h;\n for(h=1; h<=sum; h++)\n {\n printf(\"%d \",ara[h]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nint main()\n{\n int n,i,j=-1,x[100],z[100];\n bool y[100]={false};\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) \tscanf(\"%d\",&x[i]);\n \n for(i=n;i>=1;i--){\n \tif(y[x[i]]==0){\n \t\tj++;\n \t\tz[j]=x[i];\n \t\ty[x[i]]=1;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",j+1);\n\t\n\tfor(i=j;i>=0;i--){\n\t\tprintf(\"%d \",z[i]);\n\t} \n\tprintf(\"\\n\");\n\t\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=k;i++)\n {\n if(n%10==0)\n n=n/10;\n else\n n=n-1;\n }\nprintf(\"%d\",n);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, a[51] = {0}, b[51], c=0, i, j, m, x=0;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &m);\n if(a[m] == 0)\n {\n for(j = x; j < n; j++ )\n {\n c++;\n a[m] = 1;\n b[j] = m;\n x++;\n break;\n }\n }\n\n }\n\n printf(\"%d\\n\", c);\n for(i = 0; i < c; i++)\n {\n printf(\"%d \", b[i]);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n {\n int i, j, k, size;\n\n scanf(\"%d\", &size);\n \n int arr[size];\n\n for (i = 0; i < size; i++)\n scanf(\"%d\", &arr[i]);\n\n\n for (i = 0; i < size; i++) {\n for (j = i + 1; j < size;) {\n if (arr[j] == arr[i]) {\n for (k = j; k < size; k++) {\n arr[k] = arr[k + 1];\n }\n size--;\n } else\n j++;\n }\n }\n printf(\"%d\\n\",size);\n\n for (i = 0; i < size; i++) {\n printf(\"%d \", arr[i]);\n }\n\n return (0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[51],i,c=0,d=0,b[51];\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n scanf(\"%d\",&a[i]);\n for(int j=0; j<n; j++)\n {\n for(i=0; i<j; i++)\n if(a[j]==a[i])\n {\n c++;\n break;\n }\n if(c==0)\n b[d++]=a[j];\n c=0;\n }\n printf(\"%d\\n\",d);\n for(i=0; i<d; i++)\n printf(\"%d \",b[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <conio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int list[n];\n int i, j, count = 0;\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &list[i]);\n }\n\n for(i = n-1; i > 0; i--){\n if(list[i] != 0){\n for(j = i - 1; j >= 0; j--){\n if(list[j] == list[i]) list[j] = 0;\n }\n count++;\n }\n }\n\n printf(\"%d\\n\", count);\n for(i = 0; i < n; i++){\n if(list[i] != 0) printf(\"%d \", list[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nconst int VM = 1001;\nconst int N = 50;\n\nint main() {\n int nr = 0, ultim[VM], v[N], n;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &v[i]);\n if (ultim[v[i]] == 0) {\n nr++;\n }\n ultim[v[i]] = i + 1;\n }\n printf(\"%d\\n\", nr);\n for (int i = 0; i < n; i++) {\n if (ultim[v[i]] == i + 1) {\n printf(\"%d \", v[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, m, i, j=0, a[100], b[100], s[] = {0,0,0,0,0,0,0,0,0,0,0};\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=n-1, j=0; i>=0; i--)\n {\n m = a[i];\n if(s[m]==0)\n {\n s[m] = s[m]+1;\n b[j] = a[i];\n j++;\n }\n }\n printf(\"%d\\n\", j);\n for(i=j-1; i>=0; i--)\n {\n if(j==0)\n {\n printf(\"%d\\n\", b[i]);\n }\n else\n {\n printf(\"%d \", b[i]);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n int a[n+1];\n int i,j,ck=0,b[n],t;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++)\n b[i]=-1;\n for(i=n-1;i>=0;i--)\n {\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n b[j]=0;\n }\n }\n\n for(i=0;i<n;i++)\n {\n if(b[i]==0)\n ck++;\n }\n printf(\"%d\\n\",ck);\n for(i=0;i<n;i++)\n {\n if(b[i]!=0)\n printf(\"%d \",a[i]);\n }\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int a[50]= {0},b[50]= {0},ok=0;\n scanf(\"%d\",&n);\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n if(ok==0)\n b[0]=a[i],ok++;\n for(int j=0; j<ok; j++)\n {\n if(a[i]==b[j])\n break;\n else if(j==ok-1&&a[i]!=b[j])\n b[ok++]=a[i];\n }\n }\n printf(\"%d\\n\",ok);\n for(int i=0; i<ok; i++)\n i==0?printf(\"%d\",b[i]):printf(\" %d\",b[i]);\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,count=0;\n scanf(\"%d\",&n);\n int a[n];\n int s[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]==a[j])\n {\n a[i]='p';\n break;\n }\n }\n if(a[i]!='p')\n {\n s[k]=a[i];\n count++;\n k++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<k;i++)\n {\n printf(\"%d \",s[i]);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,c,n,k,l;\n scanf(\"%lld\",&n);\n long long int a[n],b[1000];\n c=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%lld\",&a[i]);\n k=0;\n for(j=i-1;j>=0;j--)\n {\n if(a[i]==a[j])\n {\n k=1;\n break;\n }\n }\n if(k==0)\n {\n b[c]=a[i];\n c++;\n }\n }\n printf(\"%lld\\n\",c);\n for(i=0;i<c;i++)\n {\n printf(\"%lld \",b[i]);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint f[53],a[53],b[53];\nint main()\n{\n int n,i,cn=1,sum=0;\n memset(f,0,sizeof(f));\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=n;i>=1;i--)\n {\n if(!f[a[i]])\n {\n sum++;\n b[cn++]=a[i];\n f[a[i]]=1;\n }\n }\n printf(\"%d\\n\",sum);\n for(i=cn-1;i>=1;i--)\n {\n if(i==cn-1)\n printf(\"%d\",b[i]);\n else printf(\" %d\",b[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[i]==ara[j])\n {\n \n k=i;\n for(j=i+1;j<n;j++)\n ara[k] = ara[j];\n n--;\n }\n }\n }\n printf(\"%d\\n\",n);\n for(i=0;i<n;i++)\n printf(\"%d\",ara[i]);\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nara[1001];\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,j,p,count=0;\n for(i=0;i<1001;i++){\n ara[i]=0;\n }\n int a[101];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n p=a[i];\n ara[p]=ara[p]+1;\n }\n for(i=0;i<1001;i++){\n if(ara[i]!=0){\n count++;\n }\n }\n printf(\"%d\\n\",count);\n for(i=0;i<1001;i++){\n if(ara[i]!=0){\n printf(\"%d \",i);\n }\n }\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n;\n long s=0;\n int i=0;\n int t[50];\n\n scanf(\"%d\",&n);\n\n\n\n\n\n for(int z=0; z<n; z++)\n {\n\n scanf(\"%llu\",&t[z]);\n\n\n\n\n }\n\n\nfor(i=0; i<n-1; i++)\n {\n\n\n for(int j=i+1; j<n; j++)\n {\n\n\n\n if(t[i]==t[j])\n {\n for(int x=i; x<n-1; x++)\n t[x]=t[x+1];\n\n n--;\n i--;\n\n }\n\n }\n\n\n\n\n }\n printf(\"%d\\n\",n);\n for( i=0; i<n; i++)\n {\n\n printf(\"%d \",t[i]);\n\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int t[1001],x[1001],a,i,j=0;\n scanf(\"%i\",&a);\n for(i=0;i<a;i++)\n scanf(\"%i\",&t[i]);\n \n for(i=a-1;i>=0;i--)\n for(j=i-1;j>=0;j--){\n if(t[j]==t[i])\n t[j]=0;\n }\n \n \n for(i=0;i<a;i++)\n if(t[i]!=0)\n j++;\n printf(\"%i\\n\",j);\n for(i=0;i<a;i++)\n if(t[i]!=0)\n printf(\"%i\",t[i]);\n}"}], "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a"} {"nl": {"description": "Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games!Since you are so curious about Bitland, I'll give you the chance of peeking at one of these games.BitLGM and BitAryo are playing yet another of their crazy-looking genius-needed Bitlandish games. They've got a sequence of n non-negative integers a1,\u2009a2,\u2009...,\u2009an. The players make moves in turns. BitLGM moves first. Each player can and must do one of the two following actions in his turn: Take one of the integers (we'll denote it as ai). Choose integer x (1\u2009\u2264\u2009x\u2009\u2264\u2009ai). And then decrease ai by x, that is, apply assignment: ai\u2009=\u2009ai\u2009-\u2009x. Choose integer x . And then decrease all ai by x, that is, apply assignment: ai\u2009=\u2009ai\u2009-\u2009x, for all i. The player who cannot make a move loses.You're given the initial sequence a1,\u2009a2,\u2009...,\u2009an. Determine who wins, if both players plays optimally well and if BitLGM and BitAryo start playing the described game in this sequence.", "input_spec": "The first line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20093). The next line contains n integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009<\u2009300).", "output_spec": "Write the name of the winner (provided that both players play optimally well). Either \"BitLGM\" or \"BitAryo\" (without the quotes).", "sample_inputs": ["2\n1 1", "2\n1 2", "3\n1 2 1"], "sample_outputs": ["BitLGM", "BitAryo", "BitLGM"], "notes": null}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define A\t300\n\nint solve2(int a1, int a2) {\n\tstatic char dp[A + 1][A + 1];\n\tint i1, i2, i;\n\n\tfor (i1 = 0; i1 <= a1; i1++)\n\t\tfor (i2 = 0; i2 <= a2; i2++) {\n\t\t\tif (dp[i1][i2])\n\t\t\t\tcontinue;\n\t\t\tfor (i = 1; i1 + i <= a1; i++)\n\t\t\t\tdp[i1 + i][i2] = 1;\n\t\t\tfor (i = 1; i2 + i <= a2; i++)\n\t\t\t\tdp[i1][i2 + i] = 1;\n\t\t\tfor (i = 1; i1 + i <= a1 && i2 + i <= a2; i++)\n\t\t\t\tdp[i1 + i][i2 + i] = 1;\n\t\t}\n\treturn dp[a1][a2];\n}\n\nint solve3(int a1, int a2, int a3) {\n\tstatic char dp[A + 1][A + 1][A + 1];\n\tint i1, i2, i3, i;\n\n\tfor (i1 = 0; i1 <= a1; i1++)\n\t\tfor (i2 = 0; i2 <= a2; i2++)\n\t\t\tfor (i3 = 0; i3 <= a3; i3++) {\n\t\t\t\tif (dp[i1][i2][i3])\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (i = 1; i1 + i <= a1; i++)\n\t\t\t\t\tdp[i1 + i][i2][i3] = 1;\n\t\t\t\tfor (i = 1; i2 + i <= a2; i++)\n\t\t\t\t\tdp[i1][i2 + i][i3] = 1;\n\t\t\t\tfor (i = 1; i3 + i <= a3; i++)\n\t\t\t\t\tdp[i1][i2][i3 + i] = 1;\n\t\t\t\tfor (i = 1; i1 + i <= a1 && i2 + i <= a2 && i3 + i <= a3; i++)\n\t\t\t\t\tdp[i1 + i][i2 + i][i3 + i] = 1;\n\t\t\t}\n\treturn dp[a1][a2][a3];\n}\n\nint main() {\n\tint n, a1, a2, a3;\n\n\tscanf(\"%d%d\", &n, &a1);\n\tif (n == 1) {\n\t\tprintf(a1 ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\t\treturn 0;\n\t}\n\tscanf(\"%d\", &a2);\n\tif (n == 2) {\n\t\tprintf(solve2(a1, a2) ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\t\treturn 0;\n\t}\n\tscanf(\"%d\", &a3);\n\tprintf(solve3(a1, a2, a3) ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar a[301][301][301];\nchar b[301][301];\n\nint main()\n{\n int n, x, y, z, f, i, j, k;\n \n scanf(\"%d\", &n);\n \n if (n == 1) {\n scanf(\"%d\", &x);\n \n if (x == 0) {\n f = 1;\n } else {\n f = 0;\n }\n } else if (n == 2) {\n scanf(\"%d %d\", &x, &y);\n \n for (i = 0; i <= 300; i++) {\n for (j = 0; j <= 300; j++) {\n int f = 0;\n \n for (k = 0; k < i; k++) {\n if (b[k][j] == 0) f = 1;\n }\n \n for (k = 0; k < j; k++) {\n if (b[i][k] == 0) f = 1;\n }\n \n for (k = 1; k <= i && k <= j; k++) {\n if (b[i - k][j - k] == 0) f = 1;\n }\n \n b[i][j] = f;\n }\n }\n \n f = 1 - b[x][y];\n } else {\n scanf(\"%d %d %d\", &x, &y, &z);\n \n for (i = 0; i <= 300; i++) a[0][i][i] = b[i][i] = 1;\n \n for (i = 1; i <= 300; i++) {\n int c[301] = {0};\n \n for (j = 1; j + i >= j * 2; j *= 2) ;\n \n for (; j <= 300; j++) {\n if (c[j] == 1) continue;\n \n for (k = j + 1; k <= 300; k++) {\n if (b[j][k] == 0 && c[k] == 0) {\n a[i][j][k] = b[j][k] = c[k] = 1;\n \n break;\n }\n }\n }\n }\n \n if (x > y) {\n int tmp = x;\n x = y;\n y = tmp;\n }\n \n if (y > z) {\n int tmp = y;\n y = z;\n z = tmp;\n }\n \n if (x > y) {\n int tmp = x;\n x = y;\n y = tmp;\n }\n \n f = a[x][y][z];\n }\n \n if (f == 0) {\n puts(\"BitLGM\");\n } else {\n puts(\"BitAryo\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define MAX 300\nint win[301][301];\nvoid solve(int a,int b){\n\tint i,j,k,l;\n\tfor(i=1;i<=a;i++){\n\t\tfor(j=1;j<=b;j++){\n\t\t\tint mink = (i>j)?j:i;\n\t\t\tfor(k=1;k<=mink;k++)\n\t\t\t\tif(win[i-k][j-k]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=i;l++)\n\t\t\t\tif(win[i-l][j]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=j;l++)\n\t\t\t\tif(win[i][j-l]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n}\nint main(){\n\tint n,a,b,c,i,j,k;\n\twin[0][0]=0;\n\twin[1][1]=1;\n\twin[1][0]=1;\n\twin[0][1]=1;\n\twin[2][0]=1;\n\twin[0][2]=1;\n\tfor(i=1;i<=300;i++){\n\t\twin[i][0]=1;win[0][i]=1;\n\t}\n\tsolve(300,300);\n\t//for(i=0;i<=10;i++){\n\t//\tfor(j=0;j<=10;j++)\n\t//\t\tprintf(\"%d \",win[i][j]);\n\t//printf(\"\\n\");\t\n\t//}\n\tscanf(\"%d\",&n);\n\t\tif(n==1){\n\t\t\tscanf(\"%d\",&a);\n\t\t\tif(a==0)\n\t\t\t\tprintf(\"BitAryo\");\n\t\t\telse\n\t\t\t\tprintf(\"BitLGM\");\n\t\t}\n\t\telse if(n==2){\n\t\t\tscanf(\"%d %d\",&a,&b);\n\t\t\tif(win[a][b])\n\t\t\t\tprintf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\n\t\telse if(n==3){\n\t\t\tscanf(\"%d %d %d\",&a,&b,&c);\n\t\t\tif((a^b^c)!=0)printf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint n;\nint a[3];\nchar dp[300*300*300];\nlong long step = 0;\n\nvoid calculate_result(int index, long long index1){\n if(index >= n){\n if(index1 == 0){\n dp[0] = 0;\n return;\n }\n int i, min = 300,j;\n long long index2 = index1;\n for(i=0;i<n;i++){\n min = (min > (index2 % 300) ) ? (index2 % 300) : min;\n index2 /= 300;\n }\n int win = 0;\n for(i=1;i<=min;i++){\n if(dp[index1 - i*step] == 0){\n win = 1;\n break;\n }\n }\n index2 = index1;\n long long pos = 1;\n if(win == 0){\n for(i=0;i<n;i++){\n int num = index2 % 300;\n for(j=1;j<=num;j++){\n if(dp[index1 - pos*j] == 0){\n win = 1;\n break;\n }\n }\n if( win == 1 )\n break;\n index2 /= 300;\n pos *= 300;\n }\n }\n if(win == 1)\n dp[index1] = 1;\n return;\n }\n int i;\n for(i=0;i<=a[index];i++){\n calculate_result(index+1, index1*300 + i);\n }\n}\n\nint main(){\n scanf(\"%d\", &n);\n int i;\n for(i=0;i<n;i++)\n scanf(\"%d\", &a[i]);\n memset(dp, 0, sizeof(char)*300*300*300);\n for(i=0;i<n;i++)\n step = step*300 + 1;\n if(n == 1){\n if(a[0]){\n printf(\"BitLGM\\n\");\n }\n else{\n printf(\"BitAryo\\n\");\n }\n }\n else if(n == 3){\n if(a[0] ^ a[1] ^ a[2]){\n printf(\"BitLGM\\n\");\n }\n else{\n printf(\"BitAryo\\n\");\n }\n }\n else{\n calculate_result(0,0);\n long long ans_index = 0;\n for(i=0;i<n;i++){\n ans_index = ans_index*300 + a[i];\n }\n if(dp[ans_index] == 1){\n printf(\"BitLGM\\n\");\n }\n else{\n printf(\"BitAryo\\n\");\n }\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define A\t300\n\nint solve2(int a1, int a2) {\n\tstatic char dp[A + 1][A + 1];\n\tint i1, i2, i;\n\n\tdp[0][0] = 0;\n\tfor (i1 = 0; i1 <= a1; i1++)\n\t\tfor (i2 = 0; i2 <= a2; i2++) {\n\t\t\tif (dp[i1][i2])\n\t\t\t\tcontinue;\n\t\t\tfor (i = 1; i1 + i <= a1; i++)\n\t\t\t\tdp[i1 + i][i2] = 1;\n\t\t\tfor (i = 1; i2 + i <= a2; i++)\n\t\t\t\tdp[i1][i2 + i] = 1;\n\t\t\tfor (i = 1; i1 + i <= a1 && i2 + i <= a2; i++)\n\t\t\t\tdp[i1 + i][i2 + i] = 1;\n\t\t}\n\treturn dp[a1][a2];\n}\n\nint solve3(int a1, int a2, int a3) {\n\tstatic char dp[A + 1][A + 1][A + 1];\n\tint i1, i2, i3, i;\n\n\tdp[0][0][0] = 0;\n\tfor (i1 = 0; i1 <= a1; i1++)\n\t\tfor (i2 = 0; i2 <= a2; i2++)\n\t\t\tfor (i3 = 0; i3 <= a2; i3++) {\n\t\t\t\tif (dp[i1][i2][i3])\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (i = 1; i1 + i <= a1; i++)\n\t\t\t\t\tdp[i1 + i][i2][i3] = 1;\n\t\t\t\tfor (i = 1; i2 + i <= a2; i++)\n\t\t\t\t\tdp[i1][i2 + i][i3] = 1;\n\t\t\t\tfor (i = 1; i3 + i <= a3; i++)\n\t\t\t\t\tdp[i1][i2][i3 + i] = 1;\n\t\t\t\tfor (i = 1; i1 + i <= a1 && i2 + i <= a2 && i3 + i <= a3; i++)\n\t\t\t\t\tdp[i1 + i][i2 + i][i3 + i] = 1;\n\t\t\t}\n\treturn dp[a1][a2][a3];\n}\n\nint main() {\n\tint n, a1, a2, a3;\n\n\tscanf(\"%d%d\", &n, &a1);\n\tif (n == 1) {\n\t\tprintf(a1 ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\t\treturn 0;\n\t}\n\tscanf(\"%d\", &a2);\n\tif (n == 2) {\n\t\tprintf(solve2(a1, a2) ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\t\treturn 0;\n\t}\n\tscanf(\"%d\", &a3);\n\tprintf(solve3(a1, a2, a3) ? \"BitLGM\\n\" : \"BitAryo\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define MAX 300\nint win[301][301];\nvoid solve(int a,int b){\n\tint i,j,k,l;\n\tfor(i=1;i<=a;i++){\n\t\tfor(j=1;j<=b;j++){\n\t\t\tfor(k=1;k<=i;k++)\n\t\t\t\tif(win[i-k][j-k]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=i;l++)\n\t\t\t\tif(win[i-l][j]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=j;l++)\n\t\t\t\tif(win[i][j-l]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n}\nint main(){\n\tint n,a,b,c,i,j,k;\n\twin[0][0]=0;\n\twin[1][1]=1;\n\twin[1][0]=1;\n\twin[0][1]=1;\n\twin[2][0]=1;\n\twin[0][2]=1;\n\tfor(i=1;i<=300;i++){\n\t\twin[i][0]=1;win[0][i]=1;\n\t}\n\tsolve(300,300);\n\t//for(i=0;i<=10;i++){\n\t//\tfor(j=0;j<=10;j++)\n\t//\t\tprintf(\"%d \",win[i][j]);\n\t//printf(\"\\n\");\t\n\t//}\n\tscanf(\"%d\",&n);\n\t\tif(n==1){\n\t\t\tscanf(\"%d\",&a);\n\t\t\tif(n==0)\n\t\t\t\tprintf(\"BitAryo\");\n\t\t\telse\n\t\t\t\tprintf(\"BitLGM\");\n\t\t}\n\t\telse if(n==2){\n\t\t\tscanf(\"%d %d\",&a,&b);\n\t\t\tif(win[a][b])\n\t\t\t\tprintf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\n\t\telse if(n==3){\n\t\t\tscanf(\"%d %d %d\",&a,&b,&c);\n\t\t\tif((a^b^c)!=0)printf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define MAX 300\nint win[301][301];\nvoid solve(int a,int b){\n\tint i,j,k,l;\n\tfor(i=1;i<=a;i++){\n\t\tfor(j=1;j<=b;j++){\n\t\t\tfor(k=1;k<=i;k++)\n\t\t\t\tif(win[i-k][j-k]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=i;l++)\n\t\t\t\tif(win[i-l][j]==0)\n\t\t\t\t\twin[i][j]=1;break;\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=j;l++)\n\t\t\t\tif(win[i][j-l]==0)\n\t\t\t\t\twin[i][j]=1;break;\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n}\nint main(){\n\tint n,a,b,c,i,j,k;\n\twin[0][0]=0;\n\twin[1][1]=1;\n\twin[1][0]=1;\n\twin[0][1]=1;\n\twin[2][0]=1;\n\twin[0][2]=1;\n\tfor(i=1;i<=300;i++){\n\t\twin[i][0]=1;win[0][i]=1;\n\t}\n\tsolve(300,300);\n\t//for(i=0;i<=10;i++){\n\t//\tfor(j=0;j<=10;j++)\n\t//\t\tprintf(\"%d \",win[i][j]);\n\t//printf(\"\\n\");\t\n\t//}\n\tscanf(\"%d\",&n);\n\t\tif(n==1){\n\t\t\tscanf(\"%d\",&a);\n\t\t\tif(n==0)\n\t\t\t\tprintf(\"BitAryo\");\n\t\t\telse\n\t\t\t\tprintf(\"BitLGM\");\n\t\t}\n\t\telse if(n==2){\n\t\t\tscanf(\"%d %d\",&a,&b);\n\t\t\tif(win[a][b])\n\t\t\t\tprintf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\n\t\telse if(n==3){\n\t\t\tscanf(\"%d %d %d\",&a,&b,&c);\n\t\t\tif((a^b^c)!=0)printf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define MAX 300\nint win[301][301];\nvoid solve(int a,int b){\n\tint i,j,k,l;\n\tfor(i=1;i<=a;i++){\n\t\tfor(j=1;j<=b;j++){\n\t\t\tint mink = (i>j)?j:i;\n\t\t\tfor(k=1;k<=mink;k++)\n\t\t\t\tif(win[i-k][j-k]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=i;l++)\n\t\t\t\tif(win[i-l][j]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t\tif(win[i][j]==0){\n\t\t\tfor(l=1;l<=j;l++)\n\t\t\t\tif(win[i][j-l]==0){\n\t\t\t\t\twin[i][j]=1;break;}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\t\n\t}\n}\nint main(){\n\tint n,a,b,c,i,j,k;\n\twin[0][0]=0;\n\twin[1][1]=1;\n\twin[1][0]=1;\n\twin[0][1]=1;\n\twin[2][0]=1;\n\twin[0][2]=1;\n\tfor(i=1;i<=300;i++){\n\t\twin[i][0]=1;win[0][i]=1;\n\t}\n\tsolve(300,300);\n\t//for(i=0;i<=10;i++){\n\t//\tfor(j=0;j<=10;j++)\n\t//\t\tprintf(\"%d \",win[i][j]);\n\t//printf(\"\\n\");\t\n\t//}\n\tscanf(\"%d\",&n);\n\t\tif(n==1){\n\t\t\tscanf(\"%d\",&a);\n\t\t\tif(n==0)\n\t\t\t\tprintf(\"BitAryo\");\n\t\t\telse\n\t\t\t\tprintf(\"BitLGM\");\n\t\t}\n\t\telse if(n==2){\n\t\t\tscanf(\"%d %d\",&a,&b);\n\t\t\tif(win[a][b])\n\t\t\t\tprintf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\n\t\telse if(n==3){\n\t\t\tscanf(\"%d %d %d\",&a,&b,&c);\n\t\t\tif((a^b^c)!=0)printf(\"BitLGM\");\n\t\t\telse\n\t\t\t\tprintf(\"BitAryo\");\n\t\t}\nreturn 0;\n}\n"}], "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7"} {"nl": {"description": "Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.The ticket is considered lucky if the sum of first three digits equals to the sum of last three digits.", "input_spec": "You are given a string consisting of 6 characters (all characters are digits from 0 to 9) \u2014 this string denotes Luba's ticket. The ticket can start with the digit 0.", "output_spec": "Print one number \u2014 the minimum possible number of digits Luba needs to replace to make the ticket lucky.", "sample_inputs": ["000000", "123456", "111000"], "sample_outputs": ["0", "2", "1"], "notes": "NoteIn the first example the ticket is already lucky, so the answer is 0.In the second example Luba can replace 4 and 5 with zeroes, and the ticket will become lucky. It's easy to see that at least two replacements are required.In the third example Luba can replace any zero with 3. It's easy to see that at least one replacement is required."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint str[7],i,j,b,tkt,sf,sn,opt,dif,rem,temp,check;\n\n\tscanf(\"%d\",&tkt);\n\tb = tkt;\n\n\tfor (i = 5; i >= 0; --i)\n\t{\n\t\tstr[i] = b%10;\n\t\tb/=10;\n\t}\n\n\tsf = str[0] + str[1] + str[2];\n\tsn = str[3] + str[4] + str[5];\n\n\tif(sn<sf)\n\t{\n\t\tdif = sf - sn;\n\n\t\ttemp = str[0];\n\t\tstr[0] = str[3];\n\t\tstr[3] = temp;\n\n\t\ttemp = str[1];\n\t\tstr[1] = str[4];\n\t\tstr[4] = temp;\n\n\t\ttemp = str[2];\n\t\tstr[2] = str[5];\n\t\tstr[5] = temp;\n\t}\n\telse\n\t\tdif = sn - sf;\n\n\tif(dif == 0)\n\t\topt = 0;\n\telse if(dif > 18)\n\t\topt = 3;\n\telse if(dif > 0 && dif <= 9)\n\t{\n\t\tfor(i = 0, check = 0; i < 6; ++i)\n\t\t{\n\t\t\tif(i < 3)\n\t\t\t{\n\t\t\t\tif(str[i] + dif <= 9)\n\t\t\t\t{\n\t\t\t\t\tcheck = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(str[i] - dif >= 0)\n\t\t\t\t{\n\t\t\t\t\tcheck = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(check)\n\t\t\topt = 1;\n\t\telse\n\t\t\topt = 2;\n\t}\n\telse\n\t{\n\t\tfor(i = 0, check = 0; i < 6; ++i)\n\t\t{\n\t\t\tif(i < 3)\n\t\t\t{\n\t\t\t\trem = 9 - str[i];\n\t\t\t\tfor(j = 0, check = 0; j < 6; ++j)\n\t\t\t\t{\n\t\t\t\t\tif(j < 3)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(rem + 9-str[j] >= dif && i != j)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcheck = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t if(str[j] + rem >= dif)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcheck = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\trem = str[i];\n\t\t\t\tfor(j = 0, check = 0; j < 6; ++j)\n\t\t\t\t{\n\t\t\t\t\tif(j < 3)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(rem + 9-str[j] >= dif)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcheck = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t if(rem + str[j] >= dif && i != j)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcheck = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(check)\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif(check)\n\t\t\topt = 2;\n\t\telse\n\t\t\topt = 3;\n\t}\n\n\tprintf(\"%d\\n\",opt);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nchar x[10];\nint y[10];\nint ans = 10;\nvoid func(int s, int t)\n{\n\tif(s==7)\n\t{\n\t\tif(y[1]+y[2]+y[3]==y[4]+y[5]+y[6]) ans = ans<t?ans:t;\n\t\treturn;\n\t}\n\tfor(int i=0;i<=9;i++)\n\t{\n\t\ty[s] = i;\n\t\tfunc(s+1,t+1);\n\t}\n\ty[s] = x[s];\n\tfunc(s+1,t);\n}\nint main()\n{\n\tscanf(\"%s\",x+1);\n\tfor(int i=1;i<=6;i++) x[i]-='0';\n\tfunc(1,0);\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\n\nvoid swap(int *a,int *b)\n{\n int temp;\n temp=*a;\n *a=*b;\n *b=temp;\n}\n\nint string(char a[])\n{\n int i,b=0,c=0,w,y1;\n int x[10];\n for(i=0; a[i] != '\\0'; i++)\n x[i]=a[i] - '0';\n\n for(i=0;i<6;i++)\n {\n if(i<3)\n b=b+x[i];\n else\n c=c+x[i];\n }\n\n for(i=0;i<2;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[0]>x[1])\n swap(&x[0],&x[1]);\n\n for(i=3;i<5;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[3]>x[4])\n swap(&x[3],&x[4]);\n\n w=b-c;\n if(w<0)\n w=-w;\n\n if(w==0)\n return 0;\n\n while(1)\n {\n if(b<c)\n {\n if((9-x[0])>=w || x[5]>=w)\n y1=1;\n else if((18-x[0]-x[1])>=w || (x[4]+x[5])>=w || (9-x[0]+x[5])>=w)\n y1=2;\n else\n y1=3;\n\n break;\n }\n else\n {\n for(i=0;i<3;i++)\n swap(&x[i],&x[i+3]);\n swap(&b,&c);\n }\n }\n return y1;\n}\n\nint main()\n{\n char a[10];\n int b;\n scanf(\"%s\",a);\n b=string(a);\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compar(const void *a, const void *b);\nint compar(const void *a, const void *b) {\n int *x = (int *)a, *y = (int *)b;\n return *x - *y;\n}\n\nint main() {\n int num1[3], num2[3];\n int i;\n for(i = 0; i < 3; ++i)\n num1[i] = getchar() - '0';\n for(i = 0; i < 3; ++i)\n num2[i] = getchar() - '0';\n qsort(num1, 3, sizeof(int), compar);\n qsort(num2, 3, sizeof(int), compar);\n int sum1 = num1[0] + num1[1] + num1[2];\n int sum2 = num2[0] + num2[1] + num2[2];\n if (sum1 == sum2) {\n printf(\"0\\n\");\n return 0;\n }\n int *smaller, *bigger, bigsum, smallsum;\n if (sum1 > sum2) {\n smaller = num2;\n bigger = num1;\n bigsum = sum1, smallsum = sum2;\n } else {\n smaller = num1;\n bigger = num2;\n bigsum = sum2, smallsum = sum1;\n }\n int count = 0;\n int *docker = bigger + 2, *ticker = smaller;\n while (bigsum > smallsum) {\n if (*docker > 9 - *ticker) {\n // dock\n bigsum -= *docker;\n --docker;\n }\n else {\n // tick\n smallsum += 9 - *ticker;\n ++ticker;\n }\n ++count;\n }\n printf(\"%d\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nchar str[7];\nint arr[6],arrc[6];\nint func(int change[],int siz,int pos)\n{\n if(siz==0 || pos==siz) return(arr[0]+arr[1]+arr[2]==arr[3]+arr[4]+arr[5]);\n int i;\n int temp=arr[change[pos]];\n for(i=0;i<=9;i++)\n {\n if(i==temp) continue;\n arr[change[pos]]=i;\n if(func(change,siz,pos+1)) return 1;\n }\n arr[change[pos]]=temp;\n return 0;\n}\nint main()\n{\n int i,j;\n scanf(\"%s\",str);\n for(i=0;i<6;i++)\n {arr[i]=arrc[i]=(int)str[i]-'0';}\n int change[6];\n int ans=6;\n for(i=0;i<(1<<6);i++)\n {\n int cnt=0;\n for(j=0;j<6;j++)\n {\n if(i&(1<<j)) change[cnt++]=j;\n }\n if(func(change,cnt,0) && cnt<ans)\n ans=cnt;\n for(j=0;j<6;j++) arr[j]=arrc[j];\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nvoid Swap(char a[6])\n{\n\tchar b;\n\tfor (int i = 0; i < 3; i++)\n\t{\n\t\tb = a[i];\n\t\ta[i] = a[5 - i];\n\t\ta[5 - i] = b;\n\t}\n}\n\nint main()\n{\n\tchar number[6], ch, l = 0, r = 0, ans = 0, min, max, imin, imax;\n\tint i;\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tch = getchar();\n\t\tnumber[i] = ch - '0';\n\t\tl += number[i];\n\t}\n\tfor (i = 3; i < 6; i++)\n\t{\n\t\tch = getchar();\n\t\tnumber[i] = ch - '0';\n\t\tr += number[i];\n\t}\n\tif (l < r)\n\t{\n\t\tSwap(number);\n\t\tch = l;\n\t\tl = r;\n\t\tr = ch;\n\t}\n\twhile (l != r)\n\t{\n\t\tmin = 10;\n\t\tmax = -1;\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tif (max < number[i])\n\t\t\t{\n\t\t\t\tmax = number[i];\n\t\t\t\timax = i;\n\t\t\t}\n\t\t\tif (min > number[5 - i])\n\t\t\t{\n\t\t\t\tmin = number[5 - i];\n\t\t\t\timin = 5 - i;\n\t\t\t}\n\t\t}\n\t\tif (max > 9 - min)\n\t\t{\n\t\t\tch = number[imax];\n\t\t\tnumber[imax] -= l - r;\n\t\t\tif (number[imax] < 0)\n\t\t\t\tnumber[imax] = 0;\n\t\t\tl += number[imax] - ch;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tch = number[imin];\n\t\t\tnumber[imin] += l - r;\n\t\t\tif (number[imin] > 9)\n\t\t\t\tnumber[imin] = 9;\n\t\t\tr += number[imin] - ch;\n\t\t}\n\t\tans++;\n\t}\n\tprintf(\"%hhi\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\ntypedef unsigned int uint;\n\nint cmpfuncAZ(const void *a, const void *b) {\n return *(uint*)a - *(uint*)b;\n}\nint cmpfuncZA(const void *a, const void *b) {\n return *(uint*)b - *(uint*)a;\n}\n\nvoid sort(uint b[], bool order) {\n if (order) {\n qsort(b, 3, sizeof(uint), cmpfuncZA);\n } else {\n qsort(b, 3, sizeof(uint), cmpfuncAZ);\n }\n}\n\nuint sum(uint b[]) {\n uint res = 0;\n for (uint i = 0; i < 3; i++) res += b[i];\n return res;\n}\n\nint main() {\n uint left[3], right[3], n[6];\n \n for (uint i = 0; i < 6; i++) {\n char c;\n scanf(\"%c\", &c);\n n[i] = atoi(&c);\n }\n\n for (uint i = 0; i < 3; i++) {\n left[i] = n[i];\n right[i] = n[i+3];\n }\n\n int diff = sum(left) - sum(right);\n\n if (diff < 0) {\n sort(left, false);\n sort(right, true);\n for (uint i = 0; i < 3; i++)\n left[i] = 9 - left[i];\n diff = -1 * diff;\n } else\n if (diff > 0) {\n sort(left, true);\n sort(right, false);\n for (uint i = 0; i < 3; i++)\n right[i] = 9 - right[i];\n } else {\n puts(\"0\\n\");\n return 0;\n }\n\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", left[i]);\n // puts(\"\\n\");\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", right[i]);\n // puts(\"\\n\");\n\n uint costL = 0, costR = 0, costLR = 0, tmp;\n\n // Change left side\n tmp = 0;\n while (tmp < diff) {\n tmp += left[costL];\n costL++;\n }\n\n // Change right side\n tmp = 0;\n while (tmp < diff) {\n tmp += right[costR];\n costR++;\n }\n\n // Change both sides\n tmp = 0;\n uint i = 0, j = 0;\n\n while (tmp < diff) {\n if (costLR % 2 == 0) {\n tmp += left[i];\n i++;\n } else {\n tmp += right[j];\n j++;\n }\n costLR++;\n }\n\n uint costs[3] = {costL, costR, costLR};\n sort(costs, false);\n\n // for(uint i = 0 ; i < 3; i++) printf(\"%d \", costs[i]);\n // puts(\"\\n\");\n\n printf(\"%d\\n\", costs[0]);\n\n return 0;\n}"}, {"source_code": "#define N\t6\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define V(a)\t\t\t((a).type == FIRST ? 9 - (a).value : (a).value)\n#define VALUE(a, positive)\t((positive) ? 9 - V(a) : V(a))\n\ntypedef struct {\n\tenum {FIRST, SECOND} type;\n\tint value;\n} digit_t;\n\ndigit_t a[N];\n\nvoid getdata(digit_t a[]) {\n\tfor (int i = N / 2; i < N; i++)\n\t\ta[i].type = SECOND;\n\tfor (int i = 0; i < N; i++)\n\t\ta[i].value = getchar() - '0';\n}\n\nint find_diff(digit_t a[]) {\n\tint sum = 0;\n\tfor (int i = 0; i < N / 2; i++)\n\t\tsum += a[i].value;\n\tfor (int i = N / 2; i < N; i++)\n\t\tsum -= a[i].value;\n\treturn sum;\n}\n\nint cmp(const void *p1, const void *p2, void *arg) {\n\tconst digit_t \n\t\t*a = p1,\n\t\t*b = p2;\n\tconst bool *positive = arg;\n\n\tint \n\t\tvalue1 = VALUE(*a, *positive), \n\t\tvalue2 = VALUE(*b, *positive);\n\treturn value1 - value2;\n}\n\nvoid swap(void *a, void *b, size_t size) {\n\tvoid *tmp = malloc(size);\n\tmemcpy(tmp, a, size);\n\tmemcpy(a, b, size);\n\tmemcpy(b, tmp, size);\n\tfree(tmp);\n}\n\nvoid sort(digit_t a[], bool positive) {\n\tfor (int i = 0; i < N - 1; i++)\n\t\tfor (int j = i + 1; j < N; j++)\n\t\t\tif (VALUE(a[i], positive) > VALUE(a[j], positive))\n\t\t\t\tswap(&a[i], &a[j], sizeof *a);\n}\n\nvoid solve(digit_t a[]) {\n\tint diff = find_diff(a);\n\n\tbool positive = diff > 0;\n\tsort(a, positive);\n\n\tdiff = abs(diff);\n\tfor (int i = 0; i <= N; i++) {\n\t\tif (diff <= 0) {\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\texit(EXIT_SUCCESS);\n\t\t}\n\t\tdiff -= VALUE(a[N - i - 1], positive);\n\t\tfprintf(stderr, \"Used digit %d with value %d\\n\", a[N - i - 1].value, VALUE(a[N - i - 1], positive));\n\t}\n}\n\nint main(void) {\n\tgetdata(a);\n\tsolve(a);\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <string.h>\n\nint valid (char word[]) {\n int sum1 = 0, i, sum2 = 0;\n for(i = 0; i < 3; i++) {\n sum1 += word[i] - '0';\n sum2 += word[i + 3] - '0';\n }\n return sum1 == sum2;\n}\n\nint fill (int pos, char word[], char base[]) {\n int i;\n if(pos == 6) {\n if(valid(word) == 0) {\n return 100;\n }\n int change = 0;\n for(i = 0; i < 6; i++) {\n if(base[i] != word[i]) change++;\n }\n return change;\n }\n int ans = 100;\n for(i = 0; i < 10; i++) {\n word[pos] = (char)(i + '0');\n int check = fill(pos+1, word, base);\n if(check < ans) ans = check;\n word[pos] = '?';\n }\n return ans;\n}\n\nint main() {\n char base[6], word[6];\n scanf(\"%s\", base);\n printf(\"%d\\n\", fill(0, word, base));\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[10];\n int i,j,num1,num2,sum,b[10];\n while(~scanf(\"%s\",a))\n {\n num1=num2=sum=0;\n for(i=0;i<3;i++)\n {\n b[i]=a[i]-'0';\n num1+=a[i]-'0';\n }\n for(i=3;i<6;i++)\n {\n b[i]=a[i]-'0';\n num2+=a[i]-'0';\n }\n /* if(num1<num2)\n while(num1<num2)\n {\n int min=9,j;\n for(i=1;i<3;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num1+='9'-a[j];\n a[j]='9';\n sum++;\n }\n else while(num1>num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num2+='9'-a[j];\n a[j]='9';\n sum++;\n }*/\n for(i=0;i<2;i++)\n for(j=i+1;j<3;j++)\n if(b[i]>b[j]) {int tmp=b[i];b[i]=b[j];b[j]=tmp;}\n for(i=3;i<5;i++)\n for(j=i+1;j<6;j++)\n if(b[i]>b[j]) {int tmp=b[i];b[i]=b[j];b[j]=tmp;}\n // for(i=0;i<6;i++) printf(\"%d\\t\",b[i]);\n if(num1<num2)\n {\n i=0;j=5;\n while(num1<num2)\n {\n if(9-b[i]>b[j]) {num1+=9-b[i];i++;}\n else {num2-=b[j];j--;}\n sum++;\n }\n }\n else\n {\n i=3;j=2;\n while(num1>num2)\n {\n if(9-b[i]>b[j]) {num2+=9-b[i];i++;}\n else {num1-=b[j];j--;}\n sum++;\n }\n }\n printf(\"%d\\n\",sum);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compar(const void *a, const void *b)\n{\n return *(const int *)b - *(const int *)a;\n}\n\nint main()\n{\n char s[7];\n scanf(\"%s\", s);\n int prefix = 0, suffix = 0;\n for (int i = 0; i < 3; i++)\n prefix += s[i] - '0';\n for (int i = 3; i < 6; i++)\n suffix += s[i] - '0';\n if (prefix == suffix) {\n puts(\"0\");\n } else {\n int a[6], j = 0;\n if (prefix > suffix) {\n for (int i = 0; i < 3; i++)\n a[j++] = s[i] - '0';\n for (int i = 3; i < 6; i++)\n a[j++] = '9' - s[i];\n } else {\n for (int i = 0; i < 3; i++)\n a[j++] = '9' - s[i];\n for (int i = 3; i < 6; i++)\n a[j++] = s[i] - '0';\n }\n qsort(a, 6, sizeof(int), compar);\n int diff = abs(prefix - suffix), cnt = 0;\n for (int i = 0; diff > 0 && i < 6; i++) {\n diff -= a[i];\n cnt++;\n }\n printf(\"%d\\n\", cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n char string[6];\n int dizi[6];\n scanf(\"%s\",string);\n for(int i = 0; i < 6; i++)\n {\n dizi[i] = string[i] - 48;\n }\n int fP = dizi[0] + dizi[1] + dizi[2];\n int sP = dizi[3] + dizi[4] + dizi[5];\n int fark = fP - sP;\n int absFark = abs(fark);\n if(fark == 0)\n {\n printf(\"0\\n\");\n return 0;\n } else if(fark < 0)\n {\n //sola eklenecek\n dizi[0] = 9 - dizi[0];\n dizi[1] = 9 - dizi[1];\n dizi[2] = 9 - dizi[2];\n } else\n {\n //sa\u011fa eklenecek\n dizi[3] = 9 - dizi[3];\n dizi[4] = 9 - dizi[4];\n dizi[5] = 9 - dizi[5];\n }\n int yuk;\n for(int i = 0; i < 6; i++)\n {\n for(int k = 0; k < 6; k++)\n {\n if(dizi[i] > dizi[k])\n {\n yuk = dizi[i];\n dizi[i] = dizi[k];\n dizi[k] = yuk;\n }\n }\n }\n for(int i = 0; i < 6; i++)\n {\n if(absFark <= dizi[i])\n {\n printf(\"%d\\n\", i + 1);\n return 0;\n } else{\n absFark -= dizi[i];\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MaxNum 6\n\nint main()\n{\n char Ticket[MaxNum];\n int First,Second,i,Max1=0,Min1=10,Max2=0,Min2=10,tst1,tst2,Index[MaxNum-2],Mid1,Mid2;\n gets(Ticket);\n for(i=0;i<6;i++){\n Ticket[i]-=48;\n if(i<3 && Ticket[i]>Max1){\n Max1=Ticket[i];\n Index[0]=i;\n }\n if(i>2 && Ticket[i]>Max2){\n Max2=Ticket[i];\n Index[2]=i;\n }\n if(i<3 && Ticket[i]<Min1){\n Min1=Ticket[i];\n Index[1]=i;\n }\n if(i>2 && Ticket[i]<Min2){\n Min2=Ticket[i];\n Index[3]=i;\n }\n //printf(\"%d \",Ticket[i]);\n }\n for(i=0;i<6;i++){\n if(i<3 && Index[0]!=i && Index[1]!=i){\n Mid1=Ticket[i];\n }\n if(i>2 && Index[2]!=i && Index[3]!=i){\n Mid2=Ticket[i];\n }\n }\n\n First=Ticket[0]+Ticket[1]+Ticket[2];\n Second=Ticket[3]+Ticket[4]+Ticket[5];\n if(First==Second){\n printf(\"0\");\n }\n else{\n if(First<Second){\n tst1=First+9-Min1;\n tst2=Second-Max2;\n if(tst2<=First || tst1>=Second){\n printf(\"1\");\n }\n else if(tst1>=tst2 || tst2-Mid2<=First || tst1-Mid1+9>=Second){\n printf(\"2\");\n }\n else{\n printf(\"3\");\n }\n }\n else{\n tst1=First-Max1;\n tst2=Second+9-Min2;\n if(tst2>=First || tst1<=Second){\n printf(\"1\");\n }\n else if(tst1<=tst2 || tst1-Mid1<=Second || tst2-Mid2+9>=First){\n printf(\"2\");\n }\n else{\n printf(\"3\");\n }\n }\n }\n //printf(\"\\nMin1=%d Mid1=%d Max1=%d Min2=%d Mid2=%d Max2=%d\\n\",Min1,Mid1,Max1,Min2,Mid2,Max2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( - *(char*)a + *(char*)b );\n}\n\nmain()\n{\n int i, n, j, k, s1 = 0, s2 = 0, sum = 0;\n char st[7];\n scanf(\"%s\", &st);\n int ar[6];\n for(i = 0; i<6; i++)\n ar[i] = st[i] - '0';\n\n for(i = 0; i<3; i++)\n s1 += ar[i];\n\n for(i = 3; i<6; i++)\n s2 += ar[i];\n\n k = abs(s2-s1);\n\n if(k==0)\n {\n printf(\"0\");\n return 0;\n }\n\n if(s1>s2)\n {\n for(i = 3; i<6; i++)\n ar[i] = 9 - ar[i];\n }\n if(s1<s2)\n {\n for(i = 0; i<3; i++)\n ar[i] = 9 - ar[i];\n }\n\n\n\n //for(i = 0; i<6; i++)\n //printf(\"%d \", ar[i]);\n\n qsort(ar, 6, sizeof(int), cmpfunc);\n\n for(i = 0; i<6; i++)\n {\n if(sum>=k)\n {\n printf(\"%d\", i);\n return 0;\n }\n sum += ar[i];\n }\n\n //printf(\"%d %d\", s1, s2);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n return *(int *)a - *(int *)b;\n}\n\nint main(void) {\n int i = 0, s1 = 0, s2 = 0;\n int cnt = 0, *p = 0, *q = 0;\n char num[7] = {0, };\n int a1[3] = {0, }, a2[3] = {0, };\n int *lower = 0, *higher = 0, lsum = 0, hsum = 0;\n \n scanf(\"%s\", num);\n for (i=0;i<3;i++) {\n a1[i] = num[i] - '0';\n a2[i] = num[i + 3] - '0';\n \n s1 += a1[i];\n s2 += a2[i];\n }\n \n qsort(a1, 3, sizeof(int), compare);\n qsort(a2, 3, sizeof(int), compare);\n \n if (s1 == s2) {\n printf(\"0\\n\");\n return 0;\n } else if (s1 > s2) {\n lower = a2;\n higher = a1;\n hsum = s1;\n lsum = s2;\n } else {\n lower = a1;\n higher = a2;\n hsum = s2;\n lsum = s1;\n }\n \n p = higher + 2;\n q = lower;\n \n while (hsum > lsum) {\n if (*p > 9 - *q) {\n hsum -= *p;\n p--;\n } else {\n lsum += 9 - *q;\n q++;\n }\n \n cnt++;\n }\n \n printf(\"%d\\n\", cnt);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k,m,n,t1,t2;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[2]+a[0]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[3]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[0]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[3]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n\n for(i=0;i<5;i++)\n for(j=i+1;j<6;j++)\n {\n for(m=0;m<10;m++)\n {\n for(n=0;n<10;n++)\n {\n t1=a[i];\n t2=a[j];\n a[i]=m;\n a[j]=n;\n if(a[0]+a[1]+a[2]==a[3]+a[4]+a[5])\n {\n printf(\"2\\n\");\n return 0;\n }\n a[i]=t1;\n a[j]=t2;\n\n }\n }\n }\n\n\n }\n printf(\"3\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k,m,n,t1,t2;\n for(i=0;i<6;i++)\n for(m=0;m<10;m++)\n {\n t1=a[i];\n a[i]=m;\n if(a[0]+a[1]+a[2]==a[3]+a[4]+a[5])\n {\n printf(\"1\\n\");\n return 0;\n }\n a[i]=t1;\n\n }\n\n for(i=0;i<5;i++)\n for(j=i+1;j<6;j++)\n {\n for(m=0;m<10;m++)\n {\n for(n=0;n<10;n++)\n {\n t1=a[i];\n t2=a[j];\n a[i]=m;\n a[j]=n;\n if(a[0]+a[1]+a[2]==a[3]+a[4]+a[5])\n {\n printf(\"2\\n\");\n return 0;\n }\n a[i]=t1;\n a[j]=t2;\n\n }\n }\n }\n\n\n }\n printf(\"3\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char c;\n long a[10],x,y,i,j,t,cha,add[10],del[10];\n for (i=1;i<=6;i++)\n {\n scanf(\"%c\",&c);\n a[i]=c-48;\n }\n x=0;\n for (i=1;i<=3;i++)\n x+=a[i];\n y=0;\n for (i=4;i<=6;i++)\n y+=a[i];\n for (i=1;i<=3;i++)\n {\n del[i]=a[i];//first del\n add[i]=9-a[i];//first add\n }\n for (i=4;i<=6;i++)\n {\n del[i]=9-a[i];\n add[i]=a[i];\n }\n for (i=1;i<6;i++)\n for (j=i+1;j<=6;j++)\n if (del[i]<del[j])\n {\n t=del[i];\n del[i]=del[j];\n del[j]=t;\n }\n for (i=1;i<6;i++)\n for (j=i+1;j<=6;j++)\n if (add[i]<add[j])\n {\n t=add[i];\n add[i]=add[j];\n add[j]=t;\n }\n if (x==y)\n printf(\"0\\n\");\n else if (x>y)//first del\n {\n cha=x-y;\n i=0;\n while (cha>0)\n {\n i++;\n cha-=del[i];\n }\n printf(\"%ld\\n\",i);\n }\n else//first add\n {\n cha=y-x;\n i=0;\n while (cha>0)\n {\n i++;\n cha-=add[i];\n }\n printf(\"%ld\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint sum(int n) {\n\tint res;\n\n\tfor (res = 0; n > 0; n /= 10)\n\t\tres += n % 10;\n\n\treturn res;\n}\n\nint ndiff(int a, int b) {\n\tint res;\n\n\tfor (res = 0; a > 0 || b > 0; a /= 10, b /= 10)\n\t\tif (a % 10 != b % 10)\n\t\t\tres++;\n\n\treturn res;\n}\n\nint main(void) {\n\tint number, mindf = 6;\n\n\tscanf(\"%d\", &number);\n\n\tfor (int i = 0; i <= 999999; ++i) {\n\t\tif (sum(i % 1000) == sum(i / 1000)) {\n\t\t\tint df = ndiff(i, number);\n\n\t\t\tif (df < mindf)\n\t\t\t\tmindf = df;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\\n\", mindf);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define FOR(i,a,b) for(int i = (a); i < (b); i++)\n\nint main(){\n\n\tint b[6];\n\n\tFOR(i,0,6) scanf(\"%1d\", &b[i]);\n\n\tint aux;\n\tint aux2;\n\n\tif(b[0] + b[1] + b[2] == b[3] + b[4] + b[5]){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < 6; ++i){\n\t\taux = b[i];\n\n\t\tfor (int j = 0; j < 10; ++j){\t\n\t\t\tb[i] = j;\n\n\t\t\tif(b[0] + b[1] + b[2] == b[3] + b[4] + b[5]){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\n\t\tb[i] = aux;\n\t}\n\n\tfor (int i = 0; i < 6; ++i){\n\t\taux = b[i];\n\n\t\tfor (int j = i + 1; j < 6; ++j){\n\t\t\taux2 = b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a){\t\n\t\t\t\tb[i] = a;\n\n\t\t\t\tfor (int c = 0; c < 10; ++c){\n\t\t\t\t\tb[j] = c;\n\n\t\t\t\t\tif(b[0] + b[1] + b[2] == b[3] + b[4] + b[5]){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tb[j] = aux2;\n\t\t\t}\n\t\t\tb[i] = aux;\n\t\t}\n\t\tb[i] = aux;\n\t}\n\n\tprintf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define FOR(i,a,b) for(int i = (a); i < (b); i++)\n\nint main(){\n\n\tint b[6];\n\n\tFOR(i,0,6) scanf(\"%1d\", &b[i]);\n\n\tint soma1 = b[0] + b[1] + b[2];\n\tint soma2 = b[3] + b[4] + b[5];\n\n\tint soma;\n\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma = soma1 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma2){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma = soma2 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma1){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 3; ++j)\n\t\t{\n\t\t\tsoma = soma1 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma2){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 6; ++j)\n\t\t{\n\t\t\tsoma = soma2 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma1){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tint aux1, aux2;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = 3; j < 6; ++j)\n\t\t{\n\t\t\taux1 = soma1 - b[i];\n\t\t\taux2 = soma2 - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(aux1 + a == aux2 + b){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint vec[6];\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", vec + i);\n\t}\n\n\tif (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] +vec[5])\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < 10; ++i)\n\t{\n\t\tif (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (vec[0] + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if ( i + vec[1] + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] + i)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tfor (int j = 0; j < 10; ++j)\n\t{\n\t\tfor (int i = 0; i < 10; ++i)\n\t\t{\n\t\t\tif (vec[0] + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (j + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (j + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + j)\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + j)\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (j + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + j + vec[2] == i + vec[4] +vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + j == i + vec[4] +vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (j + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + j + vec[2] == vec[3] + i +vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + j == vec[3] + i + vec[5])\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (j + vec[1] + vec[2] == vec[3] + vec[4] + i)\n\n\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + j + vec[2] == vec[3] + vec[4] + i)\n\t\t\t\t\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (vec[0] + vec[1] + j == vec[3] + vec[4] + i)\n\t\t\t\t\t\t\t{\n\t\t\t\tprintf(\"2\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int k = 0; k < 10; ++k)\n\t{\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (k + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + k)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n int i, j, k, s1=0, s2=0, d, c=0;\n char b[6];\n int a[6];\n for(i=0; i<6; ++i) {\n scanf(\"%c\", &b[i]);\n a[i] = b[i] - 48;\n }\n\n for(i=0; i<3; ++i)\n s1+=a[i];\n\n for(i=3; i<6; ++i)\n s2+=a[i];\n\n d = s1 - s2;\n\n if(d>0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^ a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^ a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n i=0;\n j=3;\n\n while(d>0){\n if(a[i] > 9-a[j]){\n d -= a[i];\n c++;\n i++;\n }\n else {\n d -= 9-a[j];\n j++;\n c++;\n }\n }\n printf(\"%d\", c);\n }\n else if(d<0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^ a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^ a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n d = -d;\n i=0;\n j=3;\n while(d>0){\n if(9-a[i] > a[j]){\n d -= 9-a[i];\n c++;\n i++;\n }\n else {\n d -= a[j];\n c++;\n j++;\n }\n }\n printf(\"%d\", c);\n }\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b)\n{\n return (*(int*)a > *(int*)b) - (*(int*)a < *(int*)b);\n}\n\nint main() {\n int ar[6];\n for (int i = 0; i < 6; i++) {\n char t;\n scanf(\"%c\", &t);\n ar[i] = t - '0';\n }\n if (ar[0] + ar[1] + ar[2] > ar[3] + ar[4] + ar[5])\n {\n ar[0] = 9 - ar[0];\n ar[1] = 9 - ar[1];\n ar[2] = 9 - ar[2];\n } else {\n ar[3] = 9 - ar[3];\n ar[4] = 9 - ar[4];\n ar[5] = 9 - ar[5];\n }\n qsort(ar, 6, sizeof(int), compare);\n int sum = 0;\n for (int i = 0; i < 6; i++)\n sum += ar[i];\n if (sum == 27)\n {\n printf(\"0\");\n return 0;\n }\n if (sum < 27)\n {\n for (int i = 0; i < 6; i++)\n {\n sum += 9 - ar[i];\n if (sum >= 27)\n {\n printf(\"%i\", i + 1);\n return 0;\n }\n }\n } else {\n for (int i = 0; i < 6; i++)\n {\n sum -= ar[5 - i];\n if (sum <= 27)\n {\n printf(\"%i\", i + 1);\n return 0;\n }\n }\n }\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint i,b,sf,sn,max,maxn,smax,min,minn,smin,tkt,opt,str[7];\n\n\tscanf(\"%d\",&tkt);\n\n\tb = tkt;\n \n\tfor (i = 5; i >= 0; --i)\n\t{\n\t\tstr[i] = b%10;\n\n\t\tb = b/10;\n\t}\n\n\tsf = str[0] + str[1] + str[2];\n\tsn = str[3] + str[4] + str[5];\n\n\tmin = str[0];\n\tfor(i = 1; i < 6; ++i)\n\t{\n\t\tif(min > str[i])\n\t\t\tmin = str[i];\n\t}\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(str[i] == min)\n\t\t{\n\t\t\tminn = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tsmin = 10;\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(smin >= str[i] && i != minn)\n\t\t\tsmin = str[i];\n\t}\n\n\tmax = str[0];\n\tfor(i = 1; i < 6; ++i)\n\t{\n\t\tif(max < str[i])\n\t\t\tmax = str[i];\n\t}\n\tfor (i = 0; i < 6; ++i)\n\t{\n\t\tif(str[i] == max)\n\t\t{\n\t\t\tmaxn = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tsmax = -1;\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(smax <= str[i] && i != maxn)\n\t\t\tsmax = str[i];\n\t}\n\n\tif (sn == sf)\n\t\topt = 0;\n\telse if (sf-sn > 0)\n\t{\n\t if ((sf-sn >0) && (sf-sn <=9))\n\t {\n\t\t if((sf-sn + min > 9) && (max+sn-sf < 0))\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sf-sn >9) && (sf-sn <=18))\n\t {\n\t\t if((sf-sn + min + smin > 18) && (max + smax +sn-sf < 0))\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sf-sn >18) && (sf-sn <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\telse\n\t{\n\t if ((sn-sf >0) && (sn-sf <=9))\n\t {\n\t\t if((sn-sf + min > 9) && (max + sf-sn < 0))\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sn-sf >9) && (sn-sf <=18))\n\t {\n\t\t if((sn-sf + min + smin > 18) && (max + smax + sf-sn < 0))\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sn-sf >18) && (sn-sf <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\n\tprintf (\"%d\\n\",opt);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint i,b,sf,sn,max,smax,min,smin,tkt,opt,str[7],temp;\n\n\tscanf(\"%d\",&tkt);\n\n\tb = tkt;\n \n\tfor (i = 5; i >= 0; --i)\n\t{\n\t\tstr[i] = b%10;\n\n\t\tb = b/10;\n\t}\n\n\tsf = str[0] + str[1] + str[2];\n\tsn = str[3] + str[4] + str[5];\n\n\tmin = str[0];\n\tfor(i = 1; i < 6; ++i)\n\t{\n\t\tif(min > str[i])\n\t\t\tmin = str[i];\n\t}\n\n\tsmin = min;\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(smin > str[i] && str[i] > min)\n\t\t\tsmin = str[i];\n\t}\n\n\tmax = str[0];\n\tfor(i = 1; i < 6; ++i)\n\t{\n\t\tif(max < str[i])\n\t\t\tmax = str[i];\n\t}\n\n\tsmax = max;\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(smax < str[i] && str[i] < max)\n\t\t\tsmax = str[i];\n\t}\n\n\tif (sn == sf)\n\t\topt = 0;\n\telse if (sf-sn > 0)\n\t{\n\t if ((sf-sn >0) && (sf-sn <=9))\n\t {\n\t\t if((sf-sn + min > 9) && (max+sn-sf < 0))\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sf-sn >9) && (sf-sn <=18))\n\t {\n\t\t if((sf-sn + min + smin > 18) && (max + smax +sn-sf < 0))\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sf-sn >18) && (sf-sn <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\telse\n\t{\n\t if ((sn-sf >0) && (sn-sf <=9))\n\t {\n\t\t if((sn-sf + min > 9) && (max + sf-sn < 0))\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sn-sf >9) && (sn-sf <=18))\n\t {\n\t\t if((sn-sf + min + smin > 18) && (max + smax + sf-sn < 0))\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sn-sf >18) && (sn-sf <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\n\tprintf (\"%d\\n\",opt);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint i,b,sf,sn,min,smin,tkt,opt,str[7],temp;\n\n\tscanf(\"%d\",&tkt);\n\n\tb = tkt;\n \n\tfor (i = 5; i >= 0; --i)\n\t{\n\t\tstr[i] = b%10;\n\n\t\tb = b/10;\n\t}\n\n\tsf = str[0] + str[1] + str[2];\n\tsn = str[3] + str[4] + str[5];\n\n\tsmin = min;\n\tfor(i = 0; i < 6; ++i)\n\t{\n\t\tif(smin > str[i] && str[i] > min)\n\t\t\tsmin = str[i];\n\t}\n\t\n\tmin = str[0];\n\tfor(i = 1; i < 6; ++i)\n\t{\n\t\tif(min > str[i])\n\t\t\tmin = str[i];\n\t}\n\n\tif (sn == sf)\n\t\topt = 0;\n\telse if (sf-sn > 0)\n\t{\n\t if ((sf-sn >0) && (sf-sn <=9))\n\t {\n\t\t if(sf-sn + min > 9)\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sf-sn >9) && (sf-sn <=18))\n\t {\n\t\t if(sf-sn + min + smin > 18)\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sf-sn >18) && (sf-sn <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\telse\n\t{\n\t if ((sn-sf >0) && (sn-sf <=9))\n\t {\n\t\t if(sn-sf + min > 9)\n\t\t\t opt = 2;\n\t\t else\n\t\t\t opt = 1;\n\t }\n\t else if ((sn-sf >9) && (sn-sf <=18))\n\t {\n\t\t if(sn-sf + min + smin > 18)\n\t\t\t opt = 3;\n\t\t else\n\t\t\t opt = 2;\n\t }\n\t else if ((sn-sf >18) && (sn-sf <=27))\n\t {\n\t\t opt = 3;\n\t }\n\t}\n\n\tprintf (\"%d\\n\",opt);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid swap(int *a,int *b)\n{\n int temp;\n temp=*a;\n *a=*b;\n *b=temp;\n}\n\nint string(char a[])\n{\n int i,b=0,c=0,w,y1,y2;\n int x[10];\n for(i=0; a[i] != '\\0'; i++)\n x[i]=a[i] - '0';\n\n for(i=0;i<6;i++)\n {\n if(i<3)\n b=b+x[i];\n else\n c=c+x[i];\n }\n\n for(i=0;i<2;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[0]>x[1])\n swap(&x[0],&x[1]);\n\n for(i=3;i<5;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[3]>x[4])\n swap(&x[3],&x[4]);\n\n w=b-c;\n if(w<0)\n w=-w;\n\n if(w==0)\n return 0;\n\n while(1)\n {\n if(b<c)\n {\n if((9-x[0])>=w)\n y1=1;\n else if((9-x[0]-x[1])>=w)\n y1=2;\n else\n y1=3;\n\n if(x[5]>w)\n y2=1;\n else if((x[4]+x[5])>w)\n y2=2;\n else\n y2=3;\n break;\n }\n else\n {\n for(i=0;i<3;i++)\n swap(&x[i],&x[i+3]);\n swap(&b,&c);\n }\n }\n if(y1<y2)\n return y1;\n else\n return y2;\n}\n\nint main()\n{\n char a[10];\n int b;\n scanf(\"%s\",a);\n b=string(a);\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid swap(int *a,int *b)\n{\n int temp;\n temp=*a;\n *a=*b;\n *b=temp;\n}\n\nint string(char a[])\n{\n int i,b=0,c=0,w,y1,y2;\n int x[10];\n for(i=0; a[i] != '\\0'; i++)\n x[i]=a[i] - '0';\n\n for(i=0;i<6;i++)\n {\n if(i<3)\n b=b+x[i];\n else\n c=c+x[i];\n }\n\n for(i=0;i<2;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[0]>x[1])\n swap(&x[0],&x[1]);\n\n for(i=3;i<5;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[3]>x[4])\n swap(&x[3],&x[4]);\n\n w=b-c;\n if(w<0)\n w=-w;\n\n if(w==0)\n return 0;\n\n while(1)\n {\n if(b<c)\n {\n if((9-x[0])>=w)\n y1=1;\n else if((9-x[0]-x[1])>=w)\n y1=2;\n else\n y1=3;\n\n if(x[5]>=w)\n y2=1;\n else if((x[4]+x[5])>=w)\n y2=2;\n else\n y2=3;\n break;\n }\n else\n {\n for(i=0;i<3;i++)\n swap(&x[i],&x[i+3]);\n swap(&b,&c);\n }\n }\n if(y1<y2)\n return y1;\n else\n return y2;\n}\n\nint main()\n{\n char a[10];\n\n scanf(\"%s\",a);\n int b;\n b=string(a);\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid swap(int *a,int *b)\n{\n int temp;\n temp=*a;\n *a=*b;\n *b=temp;\n}\n\nint string(char a[])\n{\n int i,b=0,c=0,w,y1;\n int x[10];\n for(i=0; a[i] != '\\0'; i++)\n x[i]=a[i] - '0';\n\n for(i=0;i<6;i++)\n {\n if(i<3)\n b=b+x[i];\n else\n c=c+x[i];\n }\n\n for(i=0;i<2;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[0]>x[1])\n swap(&x[0],&x[1]);\n\n for(i=3;i<5;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[3]>x[4])\n swap(&x[3],&x[4]);\n\n w=b-c;\n if(w<0)\n w=-w;\n\n if(w==0)\n return 0;\n\n while(1)\n {\n if(b<c)\n {\n if((9-x[0])>=w || x[5]>=w)\n y1=1;\n else if((9-x[0]-x[1])>=w || (x[4]+x[5])>=w || (9-x[0]+x[5])>=w)\n y1=2;\n else\n y1=3;\n\n break;\n }\n else\n {\n for(i=0;i<3;i++)\n swap(&x[i],&x[i+3]);\n swap(&b,&c);\n }\n }\n return y1;\n}\n\nint main()\n{\n char a[10];\n int b;\n scanf(\"%s\",a);\n b=string(a);\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid swap(int *a,int *b)\n{\n int temp;\n temp=*a;\n *a=*b;\n *b=temp;\n}\n\nint string(char a[])\n{\n int i,b=0,c=0,w,y1,y2;\n int x[10];\n for(i=0; a[i] != '\\0'; i++)\n x[i]=a[i] - '0';\n\n for(i=0;i<6;i++)\n {\n if(i<3)\n b=b+x[i];\n else\n c=c+x[i];\n }\n\n for(i=0;i<2;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[0]>x[1])\n swap(&x[0],&x[1]);\n\n for(i=3;i<5;i++)\n if(x[i]>x[i+1])\n swap(&x[i],&x[i+1]);\n if(x[3]>x[4])\n swap(&x[3],&x[4]);\n\n w=b-c;\n if(w<0)\n w=-w;\n\n if(w==0)\n return 0;\n\n while(1)\n {\n if(b<c)\n {\n if((9-x[0])>=w)\n y1=1;\n else if((9-x[0]-x[1])>=w)\n y1=2;\n else\n y1=3;\n\n if(x[5]>=w)\n y2=1;\n else if((x[4]+x[5])>=w)\n y2=2;\n else\n y2=3;\n break;\n }\n else\n {\n for(i=0;i<3;i++)\n swap(&x[i],&x[i+3]);\n swap(&b,&c);\n }\n }\n if(y1<y2)\n return y1;\n else\n return y2;\n}\n\nint main()\n{\n char a[10];\n int b;\n scanf(\"%s\",a);\n b=string(a);\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compar(const void *a, const void *b);\nint compar(const void *a, const void *b) {\n int *x = (int *)a, *y = (int *)b;\n return *x - *y;\n}\n\nint main() {\n int num1[3], num2[3];\n int i;\n for(i = 0; i < 3; ++i)\n num1[i] = getchar() - '0';\n for(i = 0; i < 3; ++i)\n num2[i] = getchar() - '0';\n qsort(num1, 3, sizeof(int), compar);\n qsort(num2, 3, sizeof(int), compar);\n int sum1 = num1[0] + num1[1] + num1[2];\n int sum2 = num2[0] + num2[1] + num2[2];\n if (sum1 == sum2) {\n printf(\"0\\n\");\n return 0;\n }\n int *smaller, *bigger, bigsum, smallsum;\n if (sum1 > sum2) {\n smaller = num2;\n bigger = num1;\n bigsum = sum1, smallsum = sum2;\n } else {\n smaller = num1;\n bigger = num2;\n bigsum = sum2, smallsum = sum1;\n }\n smallsum += 9 - smaller[0];\n if (smallsum >= bigsum) {\n printf(\"1\\n\");\n return 0;\n }\n smallsum += 9 - smaller[1];\n if (smallsum >= bigsum) {\n printf(\"2\\n\");\n return 0;\n }\n printf(\"3\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar number[6], ch, l = 0, r = 0, ans = 0, m, im;\n\tint i;\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tch = getchar();\n\t\tnumber[i] = ch - '0';\n\t\tl += number[i];\n\t}\n\tfor (i = 3; i < 6; i++)\n\t{\n\t\tch = getchar();\n\t\tnumber[i] = ch - '0';\n\t\tr += number[i];\n\t}\n\twhile (r != l)\n\t{\n\t\tif (r < l)\n\t\t{\n\t\t\tm = 10;\n\t\t\tfor (i = 0; i < 3; i++)\n\t\t\t\tif (m > number[i])\n\t\t\t\t{\n\t\t\t\t\tm = number[i];\n\t\t\t\t\tim = i;\n\t\t\t\t}\n\t\t\tnumber[im] += l - r;\n\t\t\tnumber[im] %= 10;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm = 10;\n\t\t\tfor (i = 3; i < 6; i++)\n\t\t\t\tif (m > number[i])\n\t\t\t\t{\n\t\t\t\t\tm = number[i];\n\t\t\t\t\tim = i;\n\t\t\t\t}\n\t\t\tnumber[im] += r - l;\n\t\t\tnumber[im] %= 10;\n\t\t}\n\t\tr = 0;\n\t\tl = 0;\n\t\tfor (i = 0; i < 3; i++)\n\t\t{\n\t\t\tr += number[i];\n\t\t\tl += number[3 + i];\n\t\t}\n\t\tans++;\n\t}\n\tprintf(\"%hhi\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\ntypedef unsigned int uint;\n\n\nvoid sort(uint b[], bool order) {\n const uint n = 3;\n for (uint i = 0; i < n; i++)\n for (uint j = 0; j < n - 1; j++)\n if ((b[j] < b[j + 1]) == order) {\n uint tmp = b[j];\n b[j] = b[j+1];\n b[j+1] = tmp;\n } else break;\n}\n\nuint sum(uint b[]) {\n uint res = 0;\n for (uint i = 0; i < 3; i++) res += b[i];\n return res;\n}\n\nint main() {\n uint left[3], right[3], n[6];\n \n for (uint i = 0; i < 6; i++) {\n char c;\n scanf(\"%c\", &c);\n n[i] = atoi(&c);\n }\n\n for (uint i = 0; i < 3; i++) {\n left[i] = n[i];\n right[i] = n[i+3];\n }\n\n int diff = sum(left) - sum(right);\n\n if (diff < 0) {\n sort(left, false);\n sort(right, true);\n for (uint i = 0; i < 3; i++)\n left[i] = 9 - left[i];\n diff = -1 * diff;\n } else\n if (diff > 0) {\n sort(left, true);\n sort(right, false);\n for (uint i = 0; i < 3; i++)\n right[i] = 9 - right[i];\n } else {\n puts(\"0\\n\");\n return 0;\n }\n\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", left[i]);\n // puts(\"\\n\");\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", right[i]);\n // puts(\"\\n\");\n\n uint costL = 0, costR = 0, tmp;\n\n // Change left side\n tmp = 0;\n while (tmp < diff) {\n tmp += left[costL];\n costL++;\n }\n\n // Change right side\n tmp = 0;\n while (tmp < diff) {\n tmp += right[costR];\n costR++;\n }\n\n printf(\"%d\\n\", (costL <= costR)? costL : costR);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\ntypedef unsigned int uint;\n\nint cmpfuncAZ(const void *a, const void *b) {\n return *(uint*)a - *(uint*)b;\n}\nint cmpfuncZA(const void *a, const void *b) {\n return *(uint*)b - *(uint*)a;\n}\n\nvoid sort(uint b[], bool order) {\n if (order) {\n qsort(b, 3, sizeof(uint), cmpfuncZA);\n } else {\n qsort(b, 3, sizeof(uint), cmpfuncAZ);\n }\n}\n\nuint sum(uint b[]) {\n uint res = 0;\n for (uint i = 0; i < 3; i++) res += b[i];\n return res;\n}\n\nint main() {\n uint left[3], right[3], n[6];\n \n for (uint i = 0; i < 6; i++) {\n char c;\n scanf(\"%c\", &c);\n n[i] = atoi(&c);\n }\n\n for (uint i = 0; i < 3; i++) {\n left[i] = n[i];\n right[i] = n[i+3];\n }\n\n int diff = sum(left) - sum(right);\n\n if (diff < 0) {\n sort(left, false);\n sort(right, true);\n for (uint i = 0; i < 3; i++)\n left[i] = 9 - left[i];\n diff = -1 * diff;\n } else\n if (diff > 0) {\n sort(left, true);\n sort(right, false);\n for (uint i = 0; i < 3; i++)\n right[i] = 9 - right[i];\n } else {\n puts(\"0\\n\");\n return 0;\n }\n\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", left[i]);\n // puts(\"\\n\");\n // for (uint i = 0; i < 3; i++)\n // printf(\"%d \", right[i]);\n // puts(\"\\n\");\n\n uint costL = 0, costR = 0, costLR = 0, tmp;\n\n // Change left side\n tmp = 0;\n while (tmp <= diff) {\n tmp += left[costL];\n costL++;\n }\n\n // Change right side\n tmp = 0;\n while (tmp <= diff) {\n tmp += right[costR];\n costR++;\n }\n\n // Change both sides\n tmp = 0;\n uint i = 0, j = 0;\n\n while (tmp < diff) {\n if (costLR % 2 == 0) {\n tmp += left[i];\n i++;\n } else {\n tmp += right[j];\n j++;\n }\n costLR++;\n }\n\n uint costs[3] = {costL, costR, costLR};\n sort(costs, false);\n printf(\"%d\\n\", costs[0]);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[10];\n int i,j,num1,num2,sum,b[10];\n while(~scanf(\"%s\",a))\n {\n num1=num2=sum=0;\n for(i=0;i<3;i++)\n {\n b[i]=a[i]-'0';\n num1+=a[i]-'0';\n }\n for(i=3;i<6;i++)\n {\n b[i]=a[i]-'0';\n num2+=a[i]-'0';\n }\n /* if(num1<num2)\n while(num1<num2)\n {\n int min=9,j;\n for(i=1;i<3;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num1+='9'-a[j];\n a[j]='9';\n sum++;\n }\n else while(num1>num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num2+='9'-a[j];\n a[j]='9';\n sum++;\n }*/\n for(i=0;i<2;i++)\n for(j=i+1;j<3;j++)\n if(b[i]>b[j]) {int tmp=b[i];b[i]=b[j];b[j]=tmp;}\n for(i=3;i<5;i++)\n for(j=i+1;j<6;j++)\n if(b[i]>b[j]) {int tmp=b[i];b[i]=b[j];b[j]=tmp;}\n if(num1<num2)\n {\n i=0;j=5;\n while(num1<num2)\n {\n if(9-b[i]>b[j]) {i++;num1+=9-b[i];}\n else {j--;num2-=b[j];}\n sum++;\n }\n }\n else\n {\n i=3;j=2;\n while(num1>num2)\n {\n if(9-b[i]>b[j]) {i++;num2+=9-b[i];}\n else {j--;num1-=b[j];}\n sum++;\n }\n }\n printf(\"%d\\n\",sum);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[10];\n int i,num1,num2,sum;\n while(~scanf(\"%s\",a))\n {\n num1=num2=sum=0;\n for(i=0;i<3;i++)\n {\n num1+=a[i]-'0';\n }\n for(i=3;i<6;i++)\n {\n num2+=a[i]-'0';\n }\n if(num1<num2)\n while(num1<num2)\n {\n int min=9,j;\n for(i=1;i<3;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num1+='9'-a[j];\n a[j]='9';\n sum++;\n }\n else while(num1>num2)\n {\n int min=9,j;\n for(i=3;i<6;i++)\n if(a[i]-'0'<min) {min=a[i]-'0';j=i;}\n num2+='9'-a[j];\n a[j]='9';\n sum++;\n }\n printf(\"%d\\n\",sum);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n char string[6];\n int dizi[6];\n scanf(\"%s\",string);\n for(int i = 0; i < 6; i++)\n {\n dizi[i] = string[i] - 48;\n }\n int fP = dizi[0] + dizi[1] + dizi[2];\n int sP = dizi[3] + dizi[4] + dizi[5];\n int fark = abs(fP - sP);\n if(fark == 0)\n {\n printf(\"0\\n\");\n return 0;\n }\n int yuk;\n for(int i = 0; i < 6; i++)\n {\n for(int k = 0; k < 6; k++)\n {\n if(abs(dizi[i] * 2 - 9) > abs(dizi[k] * 2 - 9))\n {\n yuk = dizi[i];\n dizi[i] = dizi[k];\n dizi[k] = yuk;\n }\n }\n }\n for(int i = 0; i < 6; i++)\n {\n yuk = abs(dizi[i] * 2 - 9);\n if(yuk >= fark)\n {\n printf(\"%d\\n\", i + 1);\n return 0;\n } else{\n fark -= yuk;\n }\n }\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n char string[6];\n int dizi[6];\n scanf(\"%s\",string);\n for(int i = 0; i < 6; i++)\n {\n dizi[i] = string[i] - 48;\n }\n int fP = dizi[0] + dizi[1] + dizi[2];\n int sP = dizi[3] + dizi[4] + dizi[5];\n int fark = abs(fP - sP);\n if(fark == 0)\n {\n printf(\"0\\n\");\n return 0;\n }\n int yuk;\n for(int i = 0; i < 6; i++)\n {\n dizi[i] = dizi[i] < 4.5 ? 9 - dizi[i]: dizi[i];\n }\n for(int i = 0; i < 6; i++)\n {\n for(int k = 0; k < 6; k++)\n {\n if(dizi[i] > dizi[k])\n {\n yuk = dizi[i];\n dizi[i] = dizi[k];\n dizi[k] = yuk;\n }\n }\n }\n for(int i = 0; i < 6; i++)\n {\n if(dizi[i] >= fark)\n {\n printf(\"%d\\n\", i + 1);\n return 0;\n } else{\n fark -= dizi[i];\n }\n }\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint array[6]={0};\n\tint t1=0,t2=0,s=0,t,a=0,b;\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tscanf(\"%c\",&b);\n\t\tb-=48;\n\t\tt1+=b;\n\t}\n\tfor(int i=3;i<6;i++)\n\t{\n\t\tscanf(\"%c\",&b);\n\t\tb-=48;\n\t\tt2+=b;\n\t}\n\tfor(int i=0;i<3;i++)\n\t{\n\t\tfor(int k=i+1;k<3;k++)\n\t\t{\n\t\t\tif(array[k]<array[i])\n\t\t\t{\n\t\t\t\tt=array[k];\n\t\t\t\tarray[k]=array[i];\n\t\t\t\tarray[i]=t;\n\t\t\t}\n\t\t}\n\t}\n\tfor(int i=3;i<6;i++)\n\t{\n\t\tfor(int k=i+1;k<6;k++)\n\t\t{\n\t\t\tif(array[k]<array[i])\n\t\t\t{\n\t\t\t\tt=array[k];\n\t\t\t\tarray[k]=array[i];\n\t\t\t\tarray[i]=t;\n\t\t\t}\n\t\t}\n\t}\n\tif(t1>t2)\n\t{\n\t\tfor(int i=3;i<6;i++)\n\t\t{\n\t\t\ta+=9-array[i];\n\t\t\ts++;\n\t\t\tif(t1-t2<=a) break;\n\t\t}\n\t}\n\telse if(t2>t1)\n\t{\n\t\tfor(int i=0;i<3;i++)\n\t\t{\n\t\t\ta+=9-array[i];\n\t\t\ts++;\n\t\t\tif(t2-t1<=a) break;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MaxNum 6\n\nint main()\n{\n char Ticket[MaxNum];\n int First,Second,i,Max1=0,Min1=10,Max2=0,Min2=10,tst1,tst2;\n gets(Ticket);\n for(i=0;i<6;i++){\n Ticket[i]-=48;\n if(i<3 && Ticket[i]>Max1){\n Max1=Ticket[i];\n }\n if(i>2 && Ticket[i]>Max2){\n Max2=Ticket[i];\n }\n if(i<3 && Ticket[i]<Min1){\n Min1=Ticket[i];\n }\n if(i>2 && Ticket[i]<Min2){\n Min2=Ticket[i];\n }\n //printf(\"%d \",Ticket[i]);\n }\n First=Ticket[0]+Ticket[1]+Ticket[2];\n Second=Ticket[3]+Ticket[4]+Ticket[5];\n if(First==Second){\n printf(\"0\");\n }\n else{\n if(First<Second){\n tst1=First+9-Min1;\n tst2=Second-Max2;\n if(tst2<=First || tst1>=Second){\n printf(\"1\");\n }\n else if(tst1>=tst2){\n printf(\"2\");\n }\n else{\n printf(\"3\");\n }\n }\n else{\n tst1=First-Max1;\n tst2=Second+9-Min2;\n if(tst2>=First || tst1<=Second){\n printf(\"1\");\n }\n else if(tst1<=tst2){\n printf(\"2\");\n }\n else{\n printf(\"3\");\n }\n }\n }\n //printf(\"\\nMin1=%d Min2=%d Max1=%d Max2=%d\\n\",Min1,Min2,Max1,Max2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n return *(int *)a - *(int *)b;\n}\n\nint main(void) {\n int i = 0, cnt = 0;\n int a1diff = 0, a2diff = 0;\n int a1sum = 0, a2sum = 0;\n char num[7] = {0, };\n int a1[3] = {0, }, a2[3] = {0, };\n \n scanf(\"%s\", num);\n \n for (i=0;i<3;i++) {\n a1[i] = num[i] - '0';\n a1sum += a1[i];\n }\n \n for (i=0;i<3;i++) {\n a2[i] = num[i + 3] - '0';\n a2sum += a2[i];\n }\n \n if (a1sum == a2sum) {\n printf(\"0\\n\");\n return 0;\n }\n \n qsort(a1, 3, sizeof(int), compare);\n qsort(a2, 3, sizeof(int), compare);\n \n a1diff = a2sum - a1sum;\n a2diff = a1sum - a2sum;\n \n if (a1diff > 0) {\n for (i=0;i<3;i++) {\n a1diff -= (9 - a1[i]);\n cnt++;\n if (a1diff <= 0) {\n break;\n }\n }\n } else if (a2diff > 0) {\n for (i=0;i<3;i++) {\n a2diff -= (9 - a2[i]);\n cnt++;\n if (a2diff <= 0) {\n break;\n }\n }\n }\n \n printf(\"%d\\n\", cnt);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[2]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[5]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(y==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[2]+a[0]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[3]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[0]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[3]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[2]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[5]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(y==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[2]+a[0]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[3]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[0]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[3]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[4]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[0]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[5]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[3]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[1]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[4]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(y==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[2]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n if(b==858022)\n {\n printf(\"2\\n\");\n return 0;\n }\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n y=a[0]+a[1]+a[2];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[2]+a[0]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[3]+a[5]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(x==(a[0]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n if(y==(a[4]+a[3]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[4]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[0]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[5]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[3]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[1]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(y==(a[4]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(y==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a[6]={0},b,i=0,c;\n scanf(\"%d\",&b);\n while(b)\n {\n a[i]=b%10;\n i++;\n b=b/10;\n }\n int x,y;\n x=a[5]+a[4]+a[3];\n if(x==y)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n\n {\n int j,k;\n for(i=0;i<10;i++)\n if(x==(a[2]+a[1]+i))\n {\n printf(\"1\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n if(x==(a[2]+j+i))\n {\n printf(\"2\\n\");\n return 0;\n }\n for(i=0;i<10;i++)\n for(j=0;j<10;j++)\n for(k=0;k<10;k++)\n if(x==(k+j+i))\n {\n printf(\"3\\n\");\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint sum(int n) {\n\tint res;\n\n\tfor (res = 0; n > 0; n /= 10)\n\t\tres += n % 10;\n\n\treturn res;\n}\n\nint ndiff(int a, int b) {\n\tint res;\n\n\tfor (res = 0; a > 0 || b > 0; a /= 10, b /= 10)\n\t\tif (a % 10 != b % 10)\n\t\t\tres++;\n\n\treturn res;\n}\n\nint main(void) {\n\tint number, mindf = 6;\n\n\tscanf(\"%d\", &number);\n\n\tfor (int i = 0; i < 999999; ++i) {\n\t\tif (sum(i % 1000) == sum(i / 1000)) {\n\t\t\tint df = ndiff(i, number);\n\n\t\t\tif (df < mindf)\n\t\t\t\tmindf = df;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\\n\", mindf);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint sum(int n) {\n\tint res;\n\n\tfor (res = 0; n > 0; n /= 10)\n\t\tres += n % 10;\n\n\treturn res;\n}\n\nint ndiff(int a, int b) {\n\tint res;\n\n\tfor (res = 0; a > 0 || b > 0; a /= 10, b /= 10)\n\t\tif (a % 10 != b % 10)\n\t\t\tres++;\n\n\treturn res;\n}\n\nint main(void) {\n\tint number;\n\n\tscanf(\"%d\", &number);\n\t//printf(\"%d\\n\", sum(number));\n\n\tint n1 = number % 1000;\n\tint n2 = number / 1000;\n\n\tint s1 = sum(n1);\n\tint s2 = sum(n2);\n\n\tint number2 = number;\n\tint n0 = number;\n\n\twhile (s1 != s2) {\n\t\tnumber++;\n\n\t\tn1 = number % 1000;\n\t\tn2 = number / 1000;\n\n\t\ts1 = sum(n1);\n\t\ts2 = sum(n2);\n\n\t\t//printf(\"%d\\n\", s1 - s2);\n\t}\n\n\tdo {\n\t\tnumber2--;\n\n\t\tn1 = number2 % 1000;\n\t\tn2 = number2 / 1000;\n\n\t\ts1 = sum(n1);\n\t\ts2 = sum(n2);\n\n\t\t//printf(\"%d\\n\", s1 - s2);\n\t} while (s1 != s2);\n\n\t//~ printf(\"%d\\n\", number);\n\t//~ printf(\"%d\\n\", number2);\n\n\t//~ printf(\"%d\\n\", ndiff(number, n0));\n\t//~ printf(\"%d\\n\", ndiff(number2, n0));\n\n\tint d1 = ndiff(number, n0);\n\tint d2 = ndiff(number2, n0);\n\n\tprintf(\"%d\\n\", d1 > d2 ? d2 : d1);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint sum(int n) {\n\tint res;\n\n\tfor (res = 0; n > 0; n /= 10)\n\t\tres += n % 10;\n\n\treturn res;\n}\n\nint ndiff(int a, int b) {\n\tint res;\n\n\tfor (res = 0; a > 0 || b > 0; a /= 10, b /= 10)\n\t\tif (a % 10 != b % 10)\n\t\t\tres++;\n\n\treturn res;\n}\n\nint main(void) {\n\tint number;\n\n\tscanf(\"%d\", &number);\n\t//printf(\"%d\\n\", sum(number));\n\n\tint n1 = number % 1000;\n\tint n2 = number / 1000;\n\n\tint s1 = sum(n1);\n\tint s2 = sum(n2);\n\n\tint number2 = number;\n\tint n0 = number;\n\n\twhile (s1 != s2) {\n\t\tnumber++;\n\n\t\tn1 = number % 1000;\n\t\tn2 = number / 1000;\n\n\t\ts1 = sum(n1);\n\t\ts2 = sum(n2);\n\n\t\t//printf(\"%d\\n\", s1 - s2);\n\t}\n\n\tdo {\n\t\tnumber2--;\n\n\t\tn1 = number2 % 1000;\n\t\tn2 = number2 / 1000;\n\n\t\ts1 = sum(n1);\n\t\ts2 = sum(n2);\n\n\t\t//printf(\"%d\\n\", s1 - s2);\n\t} while (s1 != s2);\n\n\t//~ printf(\"%d\\n\", number);\n\t//~ printf(\"%d\\n\", number2);\n\n\t//~ printf(\"%d\\n\", ndiff(number, n0));\n\t//~ printf(\"%d\\n\", ndiff(number2, n0));\n\n\n\tprintf(\"%d\\n\", ndiff(number, n0) > ndiff(number2, n0) ? number2 : number);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\tint zeros = 0;\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t\tif(bilhete[i] == 0){\n\t\t\tzeros++;\n\t\t}\n\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(diferenca < 9){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca == 9 && zeros != 0){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca < 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(diferenca == 18 && zeros >= 2){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tif(cont == 5){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\n\tif(diferenca < 9){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca <= 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\tint zeros = 0;\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t\tif(bilhete[i] == 0){\n\t\t\tzeros++;\n\t\t}\n\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tif(cont == 5){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t}\n\n\telse if(diferenca <= 9 && zeros > 0){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca < 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(diferenca == 18 && zeros >= 2){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2)/10;\n\n\tprintf(\"%d\\n\", diferenca + 1);\n\n}"}, {"source_code": "#include <stdio.h>\n\n#define FOR(i,a,b) for(int i = (a); i < (b); i++)\n\nint main(){\n\n\tint b[6];\n\n\tFOR(i,0,6) scanf(\"%1d\", &b[i]);\n\n\tint soma1 = b[0] + b[1] + b[2];\n\tint soma2 = b[3] + b[4] + b[5];\n\n\tint soma;\n\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma = soma1 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma2){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma = soma2 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma1){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 3; ++j)\n\t\t{\n\t\t\tsoma = soma1 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma2){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 3; ++j)\n\t\t{\n\t\t\tsoma = soma2 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma1){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define FOR(i,a,b) for(int i = (a); i < (b); i++)\n\nint main(){\n\n\tint b[6];\n\n\tFOR(i,0,6) scanf(\"%1d\", &b[i]);\n\n\tint soma1 = b[0] + b[1] + b[2];\n\tint soma2 = b[3] + b[4] + b[5];\n\n\tint soma;\n\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma = soma1 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma2){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma = soma2 - b[i];\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tif(soma + j == soma1){\n\t\t\t\tprintf(\"1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 3; ++j)\n\t\t{\n\t\t\tsoma = soma1 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma2){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tfor (int j = i + 1; j < 6; ++j)\n\t\t{\n\t\t\tsoma = soma2 - b[i] - b[j];\n\n\t\t\tfor (int a = 0; a < 10; ++a)\n\t\t\t{\n\t\t\t\tfor (int b = 0; b < 10; ++b)\n\t\t\t\t{\n\t\t\t\t\tif(soma + a + b == soma1){\n\t\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"3\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tif(cont == 5){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\n\tif(diferenca < 9){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca < 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\tint zeros = 0;\n\tint noves = 0;\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t\tif(bilhete[i] == 0){\n\t\t\tzeros++;\n\t\t}\n\t\telse if(bilhete[i] == 9){\n\t\t\tnoves++;\n\t\t}\n\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\n\tif(soma1 == soma2){\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(diferenca < 9){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca == 9 && (zeros != 0 || noves != 0)){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca < 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(diferenca == 18 && (zeros >= 2||noves>=2)){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n\n\tint bilhete[7];\n\tint zeros = 0;\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", &bilhete[i]);\n\t\tif(bilhete[i] == 0){\n\t\t\tzeros++;\n\t\t}\n\n\t}\n\n\tint igual = bilhete[0];\n\tint cont = 0;\n\n\tfor (int i = 1; i < 6; ++i)\n\t{\n\t\tif(bilhete[i] == igual){\n\t\t\tcont++;\n\t\t}\n\t}\n\n\tif(cont == 5){\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\n\tint soma1 = 0, soma2 = 0;\n\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tsoma1 += bilhete[i];\n\t}\n\n\tfor (int i = 3; i < 6; ++i)\n\t{\n\t\tsoma2 += bilhete[i];\n\t}\n\n\tint diferenca = fabs(soma1 - soma2);\n\n\tif(diferenca <= 9 && zeros != 0){\n\t\tprintf(\"1\\n\");\n\t}\n\telse if(diferenca >= 9 && diferenca < 18){\n\t\tprintf(\"2\\n\");\n\t}\n\telse if(diferenca == 18 && zeros >= 2){\n\t\tprintf(\"2\\n\");\n\t}\n\telse{\n\t\tprintf(\"3\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint vec[6];\n\tint dvec[3];\n\tint evec[3];\n\tint conte = 0;\n\tint contd = 0;\t\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", vec + i);\n\t}\n\n\tif (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] +vec[5])\n\t{\n\t\tprintf(\"%d\\n\", contd);\n\t\treturn 0;\n\t}\n\n\tfor (int k = 0; k < 10; ++k)\n\t{\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (k + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + k)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint vec[6];\n\tint dvec[3];\n\tint evec[3];\n\tint conte = 0;\n\tint contd = 0;\t\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", vec + i);\n\t}\n\n\tif (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] +vec[5])\n\t{\n\t\tprintf(\"%d\\n\", contd);\n\t\treturn 0;\n\t}\n\n\tfor (int k = 0; k < 10; ++k)\n\t{\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if ( i + vec[1] + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] + i)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + vec[4] + i)\n\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + vec[4] + i)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + vec[4] + i)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (k + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + k)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint vec[6];\n\tint dvec[3];\n\tint evec[3];\n\tint conte = 0;\n\tint contd = 0;\t\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", vec + i);\n\t}\n\n\tif (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] +vec[5])\n\t{\n\t\tprintf(\"%d\\n\", contd);\n\t\treturn 0;\n\t}\n\n\tfor (int k = 0; k < 10; ++k)\n\t{\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if ( i + vec[1] + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] + i)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + i + vec[2] == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == vec[3] + i + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + vec[4] + j)\n\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + vec[4] + j)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + vec[4] + j)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (k + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + k)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint vec[6];\n\tint dvec[3];\n\tint evec[3];\n\tint conte = 0;\n\tint contd = 0;\t\n\n\tfor (int i = 0; i < 6; ++i)\n\t{\n\t\tscanf(\"%1d\", vec + i);\n\t}\n\n\tif (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] +vec[5])\n\t{\n\t\tprintf(\"%d\\n\", contd);\n\t\treturn 0;\n\t}\n\n\tfor (int k = 0; k < 10; ++k)\n\t{\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (vec[0] + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == i + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == i + vec[4] +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + i + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + i +vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (j + vec[1] + vec[2] == vec[3] + vec[4] + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"2\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + j + vec[2] == vec[3] + vec[4] + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + j == vec[3] + vec[4] + j)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\", contd);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int j = 0; j < 10; ++j)\n\t\t{\n\t\t\tfor (int i = 0; i < 10; ++i)\n\t\t\t{\n\t\t\t\tif (k + j + i == vec[3] + vec[4] + vec[5])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\telse if (vec[0] + vec[1] + vec[2] == i + j + k)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"3\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n int i, j, k, s1=0, s2=0, d, c1=0, c2=0, c=0;\n char b[6];\n int a[6];\n for(i=0; i<6; ++i) {\n scanf(\"%c\", &b[i]);\n a[i] = b[i] - 48;\n }\n\n for(i=0; i<3; ++i)\n s1+=a[i];\n\n for(i=3; i<6; ++i)\n s2+=a[i];\n\n d = s1 - s2;\n\n if(d>0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=0; i<3; ++i){\n if(a[i] > 9-a[i+3]){\n c++;\n d -= a[i];\n }\n else{\n c++;\n d -= 9-a[i+3];\n }\n if(d<=0) break;\n }\n printf(\"%d\", c);\n }\n else if(d<0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n d = -d;\n for(i=0; i<3; ++i){\n if(9-a[i] > a[i+3]){\n c++;\n d -= 9-a[i];\n }\n else{\n c++;\n d -= a[i+3];\n }\n if(d<0) break;\n }\n printf(\"%d\", c);\n }\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n int i, j, k, s1=0, s2=0, d, c1=0, c2=0;\n char b[6];\n int a[6];\n for(i=0; i<6; ++i) {\n scanf(\"%c\", &b[i]);\n a[i] = b[i] - 48;\n }\n\n for(i=0; i<3; ++i)\n s1+=a[i];\n\n for(i=3; i<6; ++i)\n s2+=a[i];\n\n d = s1 - s2;\n\n if(d>0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = d;\n for(i=0; i<3; ++i)\n if(a[i]){\n c1++;\n d1 -= a[i];\n if(d1<=0) break;\n }\n\n\n d1 = d;\n for(i=3; i<6; i++){\n c2++;\n d1 -= 9-a[i];\n if(d1<=0) break;\n }\n// printf(\"%d %d\\n\", c1, c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else if(d<0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = -d;\n for(i=0; i<3; ++i){\n c1++;\n d1 -= 9-a[i];\n d1 -= a[i];\n if(d1<=0) break;\n }\n\n// printf(\"%d\\n\", c1);\n\n d1 = -d;\n\n for(i=3; i<6; i++){\n if(a[i]){\n c2++;\n d1 -= a[i];\n if(d1<=0) break;\n }\n }\n// printf(\"%d\\n\", c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n int i, j, k, s1=0, s2=0, d, c1=0, c2=0;\n char b[6];\n int a[6];\n for(i=0; i<6; ++i) {\n scanf(\"%c\", &b[i]);\n a[i] = b[i] - 48;\n }\n\n for(i=0; i<3; ++i)\n s1+=a[i];\n\n for(i=3; i<6; ++i)\n s2+=a[i];\n\n d = s1 - s2;\n\n if(d>0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = d;\n for(i=0; i<3; ++i)\n if(a[i]){\n c1++;\n d1 -= a[i];\n if(d1<=0) break;\n }\n\n\n d1 = d;\n for(i=3; i<6; i++){\n c2++;\n d1 -= 9-a[i];\n if(d1<=0) break;\n }\n// printf(\"%d %d\\n\", c1, c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else if(d<0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = -d;\n for(i=0; i<3; ++i){\n c1++;\n d1 -= 9-a[i];\n if(d1<=0) break;\n }\n\n// printf(\"%d\\n\", c1);\n\n d1 = -d;\n\n for(i=3; i<6; i++){\n if(a[i]){\n c2++;\n d1 -= a[i];\n if(d1<=0) break;\n }\n }\n// printf(\"%d\\n\", c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n int i, j, k, s1=0, s2=0, d, c1=0, c2=0;\n char b[6];\n int a[6];\n for(i=0; i<6; ++i) {\n scanf(\"%c\", &b[i]);\n a[i] = b[i] - 48;\n }\n\n for(i=0; i<3; ++i)\n s1+=a[i];\n\n for(i=3; i<6; ++i)\n s2+=a[i];\n\n d = s1 - s2;\n\n if(d>0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = d;\n for(i=0; i<3; ++i)\n if(a[i]){\n c1++;\n d1 -= a[i];\n if(d1<0) break;\n }\n\n\n d1 = d;\n for(i=3; i<6; i++){\n c2++;\n d1 -= 9-a[i];\n if(d1<0) break;\n }\n// printf(\"%d %d\\n\", c1, c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else if(d<0){\n for(i=0; i<3-1; ++i){\n for(j=i; j<3; ++j){\n if(a[i]>a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n for(i=3; i<6-1; ++i){\n for(j=i; j<6; ++j){\n if(a[i]<a[j]){\n a[i] = a[i] ^ a[j];\n a[j] = a[i] ^a[j];\n a[i] = a[i] ^ a[j];\n }\n }\n }\n int d1 = -d;\n for(i=0; i<3; ++i){\n c1++;\n d1 -= 9-a[i];\n d1 -= a[i];\n if(d1<0) break;\n }\n\n// printf(\"%d\\n\", c1);\n\n d1 = -d;\n\n for(i=3; i<6; i++){\n if(a[i]){\n c2++;\n d1 -= a[i];\n if(d1<0) break;\n }\n }\n// printf(\"%d\\n\", c2);\n printf(\"%d\", c1<c2 ? c1:c2);\n }\n else printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b)\n{\n return (*(int*)a > *(int*)b) - (*(int*)a < *(int*)b);\n}\n\nint main() {\n int ar[6];\n for (int i = 0; i < 6; i++) {\n char t;\n scanf(\"%c\", &t);\n ar[i] = t - '0';\n }\n if (ar[0] + ar[1] + ar[2] > ar[3] + ar[4] + ar[5])\n {\n ar[0] = 9 - ar[0];\n ar[1] = 9 - ar[1];\n ar[2] = 9 - ar[2];\n } else {\n ar[3] = 9 - ar[3];\n ar[4] = 9 - ar[4];\n ar[5] = 9 - ar[5];\n }\n qsort(ar, 6, sizeof(int), compare);\n int sum = 0;\n for (int i = 0; i < 6; i++)\n sum += ar[i];\n if (sum == 27)\n {\n printf(\"0\");\n return 0;\n }\n if (sum < 27)\n {\n for (int i = 0; i < 6; i++)\n {\n sum += 9 - ar[i];\n if (sum > 27)\n {\n printf(\"%i\", i + 1);\n return 0;\n }\n }\n } else {\n for (int i = 0; i < 6; i++)\n {\n sum -= ar[5 - i];\n if (sum < 27)\n {\n printf(\"%i\", i + 1);\n return 0;\n }\n }\n }\n}"}], "src_uid": "09601fd1742ffdc9f822950f1d3e8494"} {"nl": {"description": "Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for k burles. Assume that there is an unlimited number of such shovels in the shop.In his pocket Polycarp has an unlimited number of \"10-burle coins\" and exactly one coin of r burles (1\u2009\u2264\u2009r\u2009\u2264\u20099).What is the minimum number of shovels Polycarp has to buy so that he can pay for the purchase without any change? It is obvious that he can pay for 10 shovels without any change (by paying the requied amount of 10-burle coins and not using the coin of r burles). But perhaps he can buy fewer shovels and pay without any change. Note that Polycarp should buy at least one shovel.", "input_spec": "The single line of input contains two integers k and r (1\u2009\u2264\u2009k\u2009\u2264\u20091000, 1\u2009\u2264\u2009r\u2009\u2264\u20099)\u00a0\u2014 the price of one shovel and the denomination of the coin in Polycarp's pocket that is different from \"10-burle coins\". Remember that he has an unlimited number of coins in the denomination of 10, that is, Polycarp has enough money to buy any number of shovels.", "output_spec": "Print the required minimum number of shovels Polycarp has to buy so that he can pay for them without any change. ", "sample_inputs": ["117 3", "237 7", "15 2"], "sample_outputs": ["9", "1", "2"], "notes": "NoteIn the first example Polycarp can buy 9 shovels and pay 9\u00b7117\u2009=\u20091053 burles. Indeed, he can pay this sum by using 10-burle coins and one 3-burle coin. He can't buy fewer shovels without any change.In the second example it is enough for Polycarp to buy one shovel.In the third example Polycarp should buy two shovels and pay 2\u00b715\u2009=\u200930 burles. It is obvious that he can pay this sum without any change. "}, "positive_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,r,m,i,x;\n scanf(\"%d %d\",&k,&r);\n if(k<10)\n {\n for(i=2; i<=9; i++)\n {\n m=k*i;\n if(m%10==0||m%10==r)\n break;\n }\n x=m/k;\n }\n if(k>=10&&k%10==0||r==k%10||r==k)\n {\n x=1;\n }\n else if(k>10&&k%10!=0)\n {\n for(i=2; i<=9; i++)\n {\n m=k*i;\n if(m%10==0||m%10==r)\n break;\n }\n x=m/k;\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint value=0 ;\nint priceMade=0;\nint k,r;\nscanf(\"%d %d\",&k,&r);\nint flag=1;\nwhile(flag){\n\tif((priceMade%10==0&&priceMade!=0)||priceMade%10==r){\n\t break;\n\n}\n\t++value;\npriceMade+=k;\n}\n\nprintf(\"%d\",value);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n\tunsigned short int spade, nom;\n\n\tscanf(\"%hu %hu\", &spade, &nom);\n\n\tunsigned short n = 1;\n\n\twhile((spade * n) % 10 != nom && (spade * n) % 10 != 0) n++;\n\n\tprintf(\"%d\", n);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,r,temp,count;\n scanf(\" %d %d\",&k,&r);\n\n if(k==r)\n {\n printf(\"1\");\n return 0;\n }\n else if(k%10 == 0)\n {\n printf(\"1\");\n return 0;\n }\n else if(k%10 == r)\n {\n printf(\"1\");\n return 0;\n }\n else\n {\n count = 1;\n temp =k;\n while(temp % 10 != r && temp %10 != 0)\n {\n temp += k;\n count ++;\n }\n printf(\"%d\",count);\n return 0;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,r,t,m,s,i,j,ans,n;\n scanf(\"%d%d\",&k,&r);\n\n for(i=1; ; i++)\n {\n m=10*i+r;\n n=10*i;\n s=0;\n for(j=1; ; j++)\n {\n t=k*j;\n if(m==t || n==t || t==r)\n {\n s=1;\n ans=j;\n break;\n }\n else if(m<t)\n {\n s=0;\n break;\n }\n\n }\n if(s==1) break;\n\n }\n\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,k,r,s1,s2,s,flag=0;;\n scanf(\"%lld %lld\",&k,&r);\n for(i=1;;i++)\n {\n if(((k*i)-r)%10==0 || (k*i)%10==0)\n {\n printf(\"%lld\\n\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "# include<stdio.h>\nint main()\n{int k,r;\nscanf(\"%d %d\",&k,&r);\nint i,c,d;\nfor(i=1;i<=10;i++)\n{if((k*i)%10==r)\n{c=i; break;}\n else c=10;\n}\nfor(i=1;i<=10;i++)\n{if((k*i)%10==0)\n{d=i; break;}\n else d=10;\n}\nif(c<d)\nprintf(\"%d\",c);\nelse printf(\"%d\",d);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,min=0,y;\n scanf (\"%d\",&n);\n scanf (\"%d\",&m);\n for (i=1;i<=9;i++)\n {\n y=(n%10)*i;\n y=y%10;\n if (y%m==0 && (y==m || y==0) )\n {\n min=i;\n break;\n }\n }\n if (min!=0)\n {\n printf (\"%d\",min);\n }\n else\n {\n printf (\"%d\",min=10);\n }\n\n}\n"}, {"source_code": "# include<stdio.h>\nint main()\n{int k,r;\nscanf(\"%d %d\",&k,&r);\nint i,c,d;\nfor(i=1;i<=10;i++)\n{if((k*i)%10==r)\n{c=i; break;}\n else c=10;\n}\nfor(i=1;i<=10;i++)\n{if((k*i)%10==0)\n{d=i; break;}\n else d=10;\n}\nif(c<d)\nprintf(\"%d\",c);\nelse printf(\"%d\",d);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,r,i;\nlong long sum=0;\nscanf(\"%d %d\",&k,&r);\nfor(i=1;i<=10;i++)\n{\nint p=k*i;\nif((p%10==0) || (p%10==r))\nbreak;\n}\nprintf(\"%d\\n\",i);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,s=1,n;\n\n scanf(\"%d %d\",&k,&r);\n n=k;\n while(n%10!=r&&n%10!=0)\n {\n s++;\n n=k*s;\n\n }\n\n\n printf(\"%d\",s);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i;\n long long sum=0;\n scanf(\"%d%d\",&n,&k);\n for( i=1;i<=10;i++){\n int p=n*i;\n if(p%10==0 || p%10==k)\n break;\n }\n printf(\"%d\",i);\n}\n\n"}, {"source_code": " #include<stdio.h>\n\n int main(){\n int k,r;\n scanf(\"%i %i\",&k,&r);\n int t=k,g=1;\n while(t%10!=r&&t%10!=0){\n t+=k;\n g++;\n }\n printf(\"%i\",g);\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,min=0,y;\n scanf (\"%d\",&n);\n scanf (\"%d\",&m);\n for (i=1;i<=9;i++)\n {\n y=(n%10)*i;\n y=y%10;\n if (y%m==0 && (y==m || y==0) )\n {\n min=i;\n break;\n }\n }\n if (min!=0)\n {\n printf (\"%d\",min);\n }\n else\n {\n printf (\"%d\",min=10);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,p;\n scanf(\"%d %d\",&k,&r);\n for(i=1;;i++){\n p=k*i;\n if(p%10==r||p%10==0){\n break;\n }\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint srx,n,i;\nint main()\n{\n scanf(\"%d%d\",&n,&srx);\n for(i=1;i<=10;i++)\n if(n*i%10==0||n*i%10==srx)\n {printf(\"%d\",i);\n break;}\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n\n{\n int k,r;\n scanf(\"%d %d\", &k, &r);\n \n for(int i=1; i<=10;i++){\n if((k*i-r)%10==0){\n printf(\"%d\",i);\n break;\n }\n else if((k*i)%10==0){\n printf(\"%d\",i);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n int k,p,r,i;\n scanf(\"%d %d\",&k,&r);\n i=1;\n p=k;\n if((k%10==0)||(k%10==r))\n printf(\"%d\",1);\n else {\n while ((p%10!=r)&&(p%10!=0)){\n p=p+k;\n i++; \n }\n printf(\"%d\",i);\n }\n\n return (0);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i;\n scanf(\"%d %d\",&k,&r);\n if(k%10==0)\n\tprintf(\"1\\n\");\n else\n {\n\tfor(i=1;i<=9;i++)\n\t{\n\t if(r%2==1 && k%2==1)\n\t {\n\t\tif( ( k*i - r )%10==0)\n\t\t{\n\t\t printf(\"%d\\n\",i);\n\t\t break;\n\t\t}\n\n\t }\n\t else if(r%2==1 && k%2==0)\n\t {\n\t\tprintf(\"5\\n\");\n\t\tbreak;\n\t }\n\t else\n\t {\n\t\tif( (k*i-r)%10==0 || (k*i)%10==0 )\n\t\t{\n\t\t printf(\"%d\\n\",i);\n\t\t break;\n\t\t}\n\t }\n\n\n\t}\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,r,b=0,c,j,k,l,m,d,n,count=0,a=0;\n scanf(\"%d %d\",&k,&r);\n b=r;\n c=k;\n if(k==1){\n printf(\"%d\",r);\n return 0;}\n for(i=1;;i++){\n \n \n if((b%k)==0){\n printf(\"%d\\n\",b/k);\n break;\n }\n b=b+10;\n \n a=a+10;\n if(a%k==0)\n {\n printf(\"%d\\n\",a/k);\n break;\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int k,r;\n\tscanf(\"%ld\",&k);\n\tscanf(\"%ld\",&r);\n\tlong int s,n=1,m;\n\ts=k*n-r;\n\twhile(1)\n\t{\n\t\t//printf(\"ss\\n\");\n if((k*n-r)%10==0||k*n%10==0&&n!=0)\n {\n \t m=n;\n \t break;\n\t\t }\n\t\t n++;\n\t}\n\tprintf(\"%ld\\n\",m);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n=0,d=0,k,r,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tif(k==1)\n\t{\n\t\tprintf(\"%d\",r);\n\t}\n\telse\n\t{\n\tfor(i=1,j=0;;i++)\n\t{\n\t\tif(k==r)\n\t\t{\n\t\t\tn=1;\n\t\t\tbreak;\n\t\t}\n\t\n\t\n\t\t else if((j*10+r)%k==0)\n\t\t{\n\t\t\t//printf(\"heloo\");\n\t\t\t//printf(\"%d\",j);\n\t\t\tn=(j*10+r)/k;\n\t\t\tbreak;\n\t\t}\n\t\t\telse if(i*10%k==0)\n\t\t{\n\t\t\t//printf(\"helllo\");\n\t\t\tn=i*10/k;\n\t\t\tbreak;\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint dig(int num){\n\treturn num%10;\n}\nint main(void) {\n\tint k,r,ans;\n\tint val,n;\n\tscanf(\"%d%d\",&k,&r);\n\tint i;\n\tif(k%10==0)\n\t\tans=1;\n\telse if(k%5==0&&r!=5)\n\t\tans=2;\n\telse if(k%5==0&&r==5)\n\t\tans=1;\n\telse {\n\t\tfor(i=1;i<=9;i++){\n\t\t\tn=k*i;\n\t\t\tval=dig(n);\n\t\t\t//printf(\"%d \",val);\n\t\t\tif(val==r||val==0){\n\t\t\t\tans=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int i,value=0,r=0,x=0,t;\n scanf(\"%d%d\",&value,&r);\n if(r==value)\n {\n x=value/r;\n }\n else if(value<r)\n {\n if(r%value==0)\n {\n x=r/value;\n }\n else\n {\n\n for(i=1; i<=1000; i++)\n {\n if((10*i)%value==0)\n {\n x=(10*i)/value;\n break;\n\n }\n else if(((10*i)+r)%value==0)\n {\n x=((10*i)+r)/value;\n break;\n\n }\n else\n continue;\n\n }\n }\n }\n else\n {\n\n for(i=1; i<=1000; i++)\n {\n if((10*i)%value==0)\n {\n x=(10*i)/value;\n break;\n\n }\n else if(((10*i)+r)%value==0)\n {\n x=((10*i)+r)/value;\n break;\n\n }\n else\n continue;\n\n }\n }\n printf(\"%d\",x);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,p;\n scanf(\"%d %d\",&k, &r);\n p=k;\n for(i=0;i<=100;i++)\n {\n k=p+(p*i);\n if(k%10==0)\n {\n printf(\"%d\",k/p);\n break;\n }\n else if((k%10)==r)\n {\n printf(\"%d\",k/p);\n break;\n }\n\n\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,r,rem,i=1,x;\n scanf(\"%d %d\",&k,&r);\n rem=k%10;\n if(rem==0)\n {\n printf(\"1\\n\");\n }\n else\n {\n while(1)\n {\n x=rem*i;\n i++;\n if((x%10)==r || (x%10)==0)\n break;\n }\n printf(\"%d\\n\",i-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k, r, i;\n scanf(\"%d %d\", &k, &r);\n\n for(i = 1; i <= 10; i++){\n int temp = (k * i) % 10;\n if(temp == r || temp == 0) break;\n }\n printf(\"%d\\n\", i);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k,r,n,i,v;\n\n\tscanf(\"%d %d\", &k, &r);\n\n\tn = k % 10;\n\n\tif ((n!=0) && (n!=5)) {\n\t\tfor (i = 1; i < 10; ++i)\n\t\t{\n\t\t\tif (((n*i)%10)==r)\n\t\t\t{\n\t\t\t\tv = i;\n\t\t\t\ti = 10;\n\t\t\t}\n\t\t\telse if (((n*i)%10)==0)\n\t\t\t{\n\t\t\t v = i;\n\t\t\t i = 10;\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tif (n==0){\n\t\t\tv = 1;\n\t\t}\n\t\telse{\n\t\t\tif (r!=5)\n\t\t\t{\n\t\t\t\tv=2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tv=1;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", v);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n=0,d=0,k,r,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tif(k==1)\n\t{\n\t\tprintf(\"%d\",r);\n\t}\n\telse\n\t{\n\tfor(i=1,j=0;;i++)\n\t{\n\t\tif(k==r)\n\t\t{\n\t\t\tn=1;\n\t\t\tbreak;\n\t\t}\n\t\n\t\n\t\t else if((j*10+r)%k==0)\n\t\t{\n\t\t\t//printf(\"heloo\");\n\t\t\t//printf(\"%d\",j);\n\t\t\tn=(j*10+r)/k;\n\t\t\tbreak;\n\t\t}\n\t\t\telse if(i*10%k==0)\n\t\t{\n\t\t\t//printf(\"helllo\");\n\t\t\tn=i*10/k;\n\t\t\tbreak;\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint a,b,c,d=1,e,f;\nscanf(\"%d %d\",&a,&b);\nc=a%10;\nif(c==0 || c==b){\nprintf(\"1\");\n}\nelse if(c==5){\n printf(\"2\");\n }\nelse{\nfor(e=0;e<9;e++){\nd=d+1;\nf=c*d;\nf=f%10;\nif(f==0||f==b){\nprintf(\"%d\",d);\nbreak;\n}\n}\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k, r, i, ch=0;\n scanf(\"%d%d\",&k,&r);\n if(k%10==0||k%10==r)\n {\n printf(\"1\\n\");\n ch++;\n }\n else if((k*2)%10==0||(k*2)%10==r)\n {\n printf(\"2\\n\");\n ch++;\n }\n else\n {\n i=1;\n int mod=k%10;\n for(i=1; i<=10; i++)\n {\n if(((mod*i)%10)==r)\n {\n printf(\"%d\\n\",i);\n ch++;\n break;\n }\n }\n }\n if(ch==0)\n printf(\"5\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,n,j,m;\n scanf(\"%d %d\",&n,&j);\n for(i=1;;i++){\n if((n*i)%10==0) break;\n m=n*i-j;\n if (m%10==0) {\n break;\n }\n }\n printf (\"%d\",i);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=1,x,y,k,r;\n scanf(\"%d%d\",&k,&r);\n for(i=1;i<=10;i++)\n {\n x=k*i;\n if(x%10==r || x%10==0)\n break;\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i=1;\n\tscanf(\"%d%d\",&k,&r);\n\twhile(i)\n\t{\n\t\tif((i*k)%10==0||(i*k)%10==r)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,s=1,n;\n\n scanf(\"%d %d\",&k,&r);\n n=k;\n while(n%10!=r&&n%10!=0)\n {\n s++;\n n=k*s;\n\n }\n\n\n printf(\"%d\",s);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int k, r, i = 1,rem,n;\n scanf(\"%d%d\",&k,&r);\n while (1)\n {\n n = k*i;\n rem = (n)%10;\n if (rem == r || rem == 0)\n {\n printf(\"%d\",i);\n break;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,d,l,m,a=0;\n scanf(\"%d%d\",&k,&r);\n d=k%10;\n if(d==r)\n {\n printf(\"1\");\n }\n else if(d!=r)\n {\n if(k%10==0)\n {\n printf(\"1\");\n }\n else if(k%5==0)\n {\n printf(\"2\");\n }\n else\n {\n /*if(k/10==0)\n {\n\n printf(\"%d\",r/k);\n }\n else\n {*/\n\n\n\n for(i=1;i<=9;i++)\n {\n l=k*i;\n m=l%10;\n a++;\n\n if(m==r||m==0)\n {\n\n //printf(\"%d\\n%d\\n\",l,m);\n printf(\"%d\",a);\n break;\n }\n\n\n }\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint k,r,i;\n\tscanf(\"%d%d\",&k,&r);\n\tfor(i=1;i<=9;i++)\n\t{\n\t\tif((k*i)%10==r||(k*i)%10==0)\n\t\t{printf(\"%d\",i);\n\t\treturn 0;\n\t\t}\n\t\t\n\t}\n\tprintf(\"10\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, const char * argv[]) {\n unsigned int price, m;\n scanf(\"%u %u\", &price, &m);\n for(unsigned int i = 1; i<10; i++){\n if(((price*i)%10 == 0) || ((price*i)%10 == m))\n return printf(\"%u\", i) & 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint k, r, count, i;\n\tscanf(\"%d %d\", &k, &r);\n\tint a=k%10;\n\tfor (i=1;i<10;i++){\n\t\tcount = (a*i)%10;\n\t\tif (count==r || count==0){\n\t\t\tprintf(\"%d\", i);\n\t\t\tbreak;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r;\n\tscanf(\"%d%d\",&k,&r);\n\tint i=1;\n\tint t=k;\n\twhile(t%10!=0&&t%10!=r)\n\t\tt=k*(++i);\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,r,m,i,x;\n scanf(\"%d %d\",&k,&r);\n if(k<10)\n {\n for(i=2; i<=9; i++)\n {\n m=k*i;\n if(m%10==0||m%10==r)\n break;\n }\n x=m/k;\n }\n if(k>=10&&k%10==0||r==k%10||r==k)\n {\n x=1;\n }\n else if(k>10&&k%10!=0)\n {\n for(i=2; i<=9; i++)\n {\n m=k*i;\n if(m%10==0||m%10==r)\n break;\n }\n x=m/k;\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint srx,n,i;\nint main()\n{\n scanf(\"%d%d\",&n,&srx);\n for(i=1;i<=10;i++)\n if(n*i%10==0||n*i%10==srx)\n {printf(\"%d\",i);\n break;}\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int k, r, i = 1,rem,n;\n scanf(\"%d%d\",&k,&r);\n while (1)\n {\n n = k*i;\n rem = (n)%10;\n if (rem == r || rem == 0)\n {\n printf(\"%d\",i);\n break;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int k, r;\n scanf(\"%d%d\", &k, &r);\n int i = 1;\n while ( (( k * i - r) % 10 != 0) && ((k * i) % 10 != 0) )\n {\n i++;\n }\n\n printf(\"%d\", i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,r,i;\n scanf(\"%d%d\",&k,&r);\n if(k%10==0 ||r==k ||(k-r)%10==0){\n printf(\"1\");\n return 0;\n }\n else if(k%5==0){\n printf(\"2\");\n return 0;\n }\n \n else if(k%2==0 && r%2==1){\n printf(\"5\");\n return 0;\n }\n else{\n for(i=1;;i++){\n \n if((k*i-r)%10==0){\n printf(\"%d\",i);\n break;\n \n }\n \n }\n\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,k,ans,sum,j;\n while(scanf(\"%d%d\",&n,&k)==2)\n {\n n=n%10;\n if(n==0||n==k)\n {\n ans=1;\n }\n else\n {\n for(i=1; i<11; i++)\n {\n j=n;\n j=j*i;\n if(j%10==0||j%10==k)\n {\n ans=i;\n break;\n }\n }\n }\n\n printf(\"%d\\n\",ans);\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include <ctype.h>\n\nint main()\n{\n int n,r,s=0,x=0,p=0;\n scanf(\"%d %d\",&n,&r);\n\n int R = roundUp(n,10);\n int temp = n%r;\n\n do\n {\n s++;\n\n\n }while((n*s)%10 !=0 && (n*s)%10 !=r);\n printf(\"%d\",s);\n// }\n//// if(((temp!=0))&&(10%(n%r))==0&&(n>10))\n//// {\n// do\n// {\n// x++;\n// }while((n*x)%10!=0);\n// printf(\"%d\\n\",x);\n//// return 0;\n//// }\n//\n// do\n// {\n// s++;\n// }while(((R*s)-(r*s))%10 != 0);\n//\n// printf(\"%d\",(s-1));\n\n return 0;\n}\nint string_length(char s[]) {\n int c = 0;\n while (s[c] != '\\0')\n c++;\n\n return c;\n}\nint roundUp(int numToRound, int multiple)\n{\n if (multiple == 0)\n return numToRound;\n\n int remainder = numToRound % multiple;\n if (remainder == 0)\n return numToRound;\n\n return numToRound + multiple - remainder;\n}\n\n"}, {"source_code": "// Codeforces A. Buy a Shovel\n// Created by Abdulrahman Elsayed on 02/07/2020\n\n#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n // Define and read variables\n int k, r, output;\n scanf(\"%d %d\", &k, &r);\n \n if ((r % k) == 0)\n output = r / k;\n else\n { \n for (int i = 1; i <= k; i++)\n {\n if (((10 * i + r) % k) == 0)\n {\n output = (10 * i + r) / k;\n break;\n }\n else if (((10 * i) % k) == 0)\n {\n output = (10 * i) / k;\n break;\n }\n } \n }\n \n printf(\"%d\\n\", output);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int k, r, i = 1,rem,n;\n scanf(\"%d%d\",&k,&r);\n while (1)\n {\n n = k*i;\n rem = (n)%10;\n if (rem == r || rem == 0)\n {\n printf(\"%d\",i);\n break;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n //11........................ A. Buy a Shovel\n int Price1 , CoinsNum,i,x=0;\n scanf(\"%i %i\",&Price1,&CoinsNum);\n for (i=1;i<10;i++)\n {\n if((Price1 *i-CoinsNum)%10==0)\n {\n x=i;\n break;\n }\n\n }\n\nif (x==0)\n for (i=1;i<10;i++)\n {\n if((Price1 *i)%10==0)\n {\n x=i;\n break;\n }\n\n }\n\n printf(\"%i\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i=1;\n\tscanf(\"%d%d\",&k,&r);\n\twhile(i)\n\t{\n\t\tif((i*k)%10==0||(i*k)%10==r)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n\nint main(){\n\n const int D = 10;\n int p,u,k,r;scanf(\"%d %d\", &k, &r);\n for(p = 1; p <= D; p++){\n u = p * k;\n if((u % D == 0) || (u % D == r)){printf(\"%d\\n\", p); break;}\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,flag=0;\n while((scanf(\"%d %d\",&a,&b))==2)\n {int i=1;\n while(1)\n {\n\n\n if(a==1)\n {\n flag=1;\n break;\n }\n if((a*i)%10==0)\n {\n flag=0;\n break;\n\n }\n if((a*i)%10==b)\n {\n flag=0;\n break;\n\n }\n i++;\n\n\n }\n if(flag==0){\n printf(\"%d\\n\",i);\n }\n else if(flag==1){\n printf(\"%d\\n\",b);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\n\n\nint min_num(int k,int r){\n\tint i = 1;//,j = 1;\n\t\n\twhile(~scanf(\"%d%d\",&k,&r)){\n\t\twhile((i * k - r) % 10 != 0 && (i * k) % 10 != 0){\n\t\t\ti++;\n\t\t}\n\t\t\n\t/*\twhile((j * k) % 10 != 0){\n\t\t\tj++;\n\t\t}*/\n\t\tprintf(\"%d\\n\",i);\n\t\ti = 1;\n\t}\n}\n\nint main(void){\n\tint k,r;\n\t\n\tmin_num(k,r);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int k, r, i = 0;\n scanf(\"%d%d\", &k, &r);\n while ((k*i)%10 != r){\n i++;\n if (!((k*i)%10)) break;\n }\n printf(\"%d\\n\", i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int k,r,i=0;\n scanf(\"%d %d\",&k,&r);\n int val=k;\n if(k%10==0){\n i=1;\n }\n else{\n while(5<10){\n i++;\n if((val-r)%10==0){\n break;\n }\n else{\n val+=k;\n if(val%10==0){\n i++;\n break;\n }\n }\n }\n }\n\n printf(\"%d\\n\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int k, r, i, t, min, p=0;\n scanf(\"%d%d\", &k, &r);\n for(i=1; i<=10; i++)\n {\n t = (k*i) % 10;\n if(t==r)\n {\n min = i;\n p=1;\n break;\n }\n }\n if(p==1)\n {\n printf(\"%d\", min);\n }\n else\n {\n for(i=1; i<=10; i++)\n {\n t= (k*i)%10;\n if(t == 0)\n {\n printf(\"%d\", i);\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint k,r;\n\tscanf(\"%d %d\",&k,&r);\n\tif(k==r || k==10)\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\n\tint x=k/10,i;\n\tfor(i=x;;i++)\n\t{\n\t\tif((10*i+r)%k==0)\n\t\t{\n\t\t\tprintf(\"%d\", (10*i+r)/k);\n\t\t\treturn 0;\n\t\t}\n\t\tif((10*i)%k==0 && i!=0)\n\t\t{\n\t\t\tprintf(\"%d\", 10*i/k);\n\t\t\treturn 0;\n\t\t}\n\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,k,r,s1,s2,s,flag=0;;\n scanf(\"%lld %lld\",&k,&r);\n for(i=1;;i++)\n {\n if(((k*i)-r)%10==0 || (k*i)%10==0)\n {\n printf(\"%lld\\n\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": " #include <stdio.h>\n int main() {\n int i,j,k,m,f,l,n;\n scanf(\"%d %d\",&k,&f);\n n=k;\n for(i=1;;i++){\n if(n%10==f || n%10==0){\n m=i;\n break;\n }\n else{\n n=k*(i+1);\n continue;\n }\n }\n printf(\"%d\",m);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,k,r;\n\tscanf(\"%d %d\",&k,&r);\n\tfor (i=1;i<=10;i++)\n\t{\n\t\tint temp= i * k;\n\t\tif (temp%10==r || temp%10==0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() \n{\n\tint k, r, sum, count = 1;\n\tscanf(\"%u %u\\n\", &k, &r);\n\tsum = k;\n\n\twhile (1)\n\t{\n\t\tif ((sum-r) % 10 == 0)\n\t\t\tif (sum > r)\n\t\t\t\tbreak;\n\t\tif (sum % 10 == 0)\n\t\t\tbreak;\n\t\tif (sum == r)\n\t\t\tbreak;\n\t\tsum += k;\n\t\tcount++;\n\t}\n\n\tprintf(\"%u\\n\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i,j;\n\tfor(i=1;i<1000;i++)\n\t{\n\t\tif((a*i)%10==0||(a*i-b)%10==0)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t\n\t}\n\t}\n\treturn 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint k;\nint r;\nint i;\n\nint main() {\n\tscanf(\"%d %d\", &k, &r);\n\tfor (i = 1; i <= 10; i++) {\n\t\tif (r == k * i % 10 || k * i % 10 == 0) {\n\t\t\tprintf(\"%d\", i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int k,r,f,i=0;\n\n scanf(\"%d %d\",&k,&r);\n\n //printf(\"k1\");\n f=k%10;\n while(1){\n if((i*f)%10==r || ((i*f)%10==0 && i!=0))\n break;\n else\n i++;\n }\n //printf(\"k2\");\n\n printf(\"%d\",i);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint k,r;\n\tscanf(\"%d %d\",&k,&r);\n\tif(k==r || k==10)\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\n\tint x=k/10,i;\n\tfor(i=x;;i++)\n\t{\n\t\tif((10*i+r)%k==0)\n\t\t{\n\t\t\tprintf(\"%d\", (10*i+r)/k);\n\t\t\treturn 0;\n\t\t}\n\t\tif((10*i)%k==0 && i!=0)\n\t\t{\n\t\t\tprintf(\"%d\", 10*i/k);\n\t\t\treturn 0;\n\t\t}\n\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,r;\n\tint i;\n\tscanf(\"%d%d\",&a,&r);\n\tfor(i=1;;i++)\n\t{\n\t\tif(i*a%10==r||i*a%10==0)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int k,coins,i,n;\n scanf(\"%d %d\",&k,&coins);\n if (k%10==0)\n printf(\"1\\n\");\n else if(k%2==0 && coins%2!=0)\n \tprintf(\"5\\n\");\n else if (k%5==0&& coins==5)\n \tprintf(\"1\\n\");\n else if(k%5==0)\n \t printf(\"2\\n\");\n else\n {\n for (i=1; ;i++)\n {\n n=(k*i)-coins;\n if (n%10==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,r,i=1;\n scanf(\"%d %d\",&k,&r);\n while(1)\n {\n n=k*i;\n if(n%10==0)\n {\n break;\n }\n if((i*k)==r)\n {\n break;\n }\n if(k==r)\n {\n break;\n }\n n=n-r;\n if(n>9)\n {\n if(n%10==0)\n {\n break;\n }\n }\n i++;\n }\n //printf(\"%d\\n\",n);\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "int main() {\n int a,b,i;\n scanf(\"%d%d\",&a,&b);\n for(i=1;(i*(a%10))%10!=b && (i*a)%10!=0;i++);\n printf(\"%d\",i);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j;\n scanf(\"%d %d\",&k,&r);\n for(i=1;;i++)\n {\n for(j=0;(j*10)<=(k*i);j++)\n {\n\n\n if(((j*10+r)==(k*i))||((j*10)==(k*i)))\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n\n }\n\n printf(\"0\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main (){\nint k,r,palas=0, n,x=1;\nscanf (\"%i\",&k);\nscanf (\"%i\",&r);\nn=k;\ndo{\npalas=palas+1;\nn=k*palas;\nx=n%10;\nif (x==0)\n{\nprintf (\"%i\",palas);\nreturn 0;\n}\nelse\nx=x-r;\n}\nwhile(x!=0);\nprintf (\"%i\",palas);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint k,r,i;\n\tscanf(\"%d %d\" , &k , &r);\n\tfor( i = 1; ; i++) {\n\t\tif((k*i - r)%10 == 0)\n\t\t\tbreak;\n\t\telse if((k*i)%10 == 0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int pr,c,i,rm,k;\n scanf(\"%d%d\",&pr,&c);\n i=1;\n for(;;++i)\n {\n k=pr*i;\n rm=k%10;\n if (rm==0)\n {\n printf(\"%d\",i);\n break;\n }\n else if (rm==c)\n {\n printf(\"%d\",i);\n break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include <ctype.h>\n\nint main()\n{\n int n,r,s=0,x=0,p=0;\n scanf(\"%d %d\",&n,&r);\n\n int R = roundUp(n,10);\n int temp = n%r;\n\n do\n {\n s++;\n\n\n }while((n*s)%10 !=0 && (n*s)%10 !=r);\n printf(\"%d\",s);\n// }\n//// if(((temp!=0))&&(10%(n%r))==0&&(n>10))\n//// {\n// do\n// {\n// x++;\n// }while((n*x)%10!=0);\n// printf(\"%d\\n\",x);\n//// return 0;\n//// }\n//\n// do\n// {\n// s++;\n// }while(((R*s)-(r*s))%10 != 0);\n//\n// printf(\"%d\",(s-1));\n\n return 0;\n}\nint string_length(char s[]) {\n int c = 0;\n while (s[c] != '\\0')\n c++;\n\n return c;\n}\nint roundUp(int numToRound, int multiple)\n{\n if (multiple == 0)\n return numToRound;\n\n int remainder = numToRound % multiple;\n if (remainder == 0)\n return numToRound;\n\n return numToRound + multiple - remainder;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint a,b,c,d=1,e,f;\nscanf(\"%d %d\",&a,&b);\nc=a%10;\nif(c==0 || c==b){\nprintf(\"1\");\n}\nelse if(c==5){\n printf(\"2\");\n }\nelse{\nfor(e=0;e<9;e++){\nd=d+1;\nf=c*d;\nf=f%10;\nif(f==0||f==b){\nprintf(\"%d\",d);\nbreak;\n}\n}\n}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int k,r,f,i=0;\n\n scanf(\"%d %d\",&k,&r);\n\n //printf(\"k1\");\n f=k%10;\n while(1){\n if((i*f)%10==r || ((i*f)%10==0 && i!=0))\n break;\n else\n i++;\n }\n //printf(\"k2\");\n\n printf(\"%d\",i);\n\n return 0;\n}\n"}, {"source_code": "/*bai 49 732A */\n\n#include<stdio.h>\n\nint check(int n, int k){\n\tint r=n%10;\n\tif(r==k) return 1;\n\treturn 0;\n\t\n}\nint main(){\n\tint k,r;\n\tscanf(\"%d%d\",&k,&r);\n\tk=k%10;\n\tint i,sum;\n\tfor(i=1;;i++){\n\t\tsum = i*k%10;\n\t\tif(sum==r||sum==0) break;\n\t}\n\tprintf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i, n, k;\n scanf(\"%d %d\", &n, &k);\n for (i=1; i<10; i++) {\n if (((i*n) % 10 == 0) || ((i*n) % 10 == k)) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n\nint main(){\n\n const int D = 10;\n int p,u,k,r;scanf(\"%d %d\", &k, &r);\n for(p = 1; p <= D; p++){\n u = p * k;\n if((u % D == 0) || (u % D == r)){printf(\"%d\\n\", p); break;}\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, r, i;\n scanf(\"%d %d\", &k, &r);\n k = k%10;\n if(k == 0)\n {\n printf(\"1\");\n return 0;\n }\n if(k == r)\n {\n printf(\"1\");\n return 0;\n }\n for(i = 1; i <= 9; i++)\n {\n if((k*i)%10 == r || (k*i)%10 == 0)\n {\n printf(\"%d\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define s(a) long long int a; scanf(\"%lld\",&a);\n#define rep(n) long long int i; for(i=0;i<n;i++)\n#define rev(n) long long int i; for(i=n-1;i>=0;i--)\n#define p(a) printf(\"%lld\\n\",a);\n#define Pf printf\n#define ll long long int\n#define ret return\nint main()\n{long long int f=0,i;\n s(k)s(r)\n for(i=1;i<10000000;i++)if(((k*i)%10-r%10==0||(k*i)%10==0)){f=1;break;}\n Pf(\"%lld\\n\",i);\n ret 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i;\n scanf(\"%d %d\",&k,&r);\n for(i=1;i<10;i++)\n {\n if((k*i%10==r)||(k*i%10==0)) break;\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include <stdio.h>\nint k,r;\nint n,m,i;\nint main(void) {\nscanf(\"%d %d\",&k,&r);\ni=0;\nwhile(1){\n if (((i*k)%10)==r || ( ((i*k)%10)==0 && i>0)) {\n printf(\"%d\",i);\n return 0;\n };\n i++;\n}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,i=1,r;\n\n scanf(\"%d %d\",&n,&k);\n if(n%10==0) printf(\"1\");\n else if(n%2==0&&k%2==1) printf(\"5\");\n else if(n%10==5&&k!=5) printf(\"2\");\n else\n {\n while((((n%10)*i)%10)-k!=0) i++;\n printf(\"%d\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() \n{\n\tint k, r, sum, count = 1;\n\tscanf(\"%u %u\\n\", &k, &r);\n\tsum = k;\n\n\twhile (1)\n\t{\n\t\tif ((sum-r) % 10 == 0)\n\t\t\tif (sum > r)\n\t\t\t\tbreak;\n\t\tif (sum % 10 == 0)\n\t\t\tbreak;\n\t\tif (sum == r)\n\t\t\tbreak;\n\t\tsum += k;\n\t\tcount++;\n\t}\n\n\tprintf(\"%u\\n\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,r,b=0,c,j,k,l,m,d,n,count=0,a=0;\n scanf(\"%d %d\",&k,&r);\n b=r;\n c=k;\n if(k==1){\n printf(\"%d\",r);\n return 0;}\n for(i=1;;i++){\n \n \n if((b%k)==0){\n printf(\"%d\\n\",b/k);\n break;\n }\n b=b+10;\n \n a=a+10;\n if(a%k==0)\n {\n printf(\"%d\\n\",a/k);\n break;\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint k, r, count, i;\n\tscanf(\"%d %d\", &k, &r);\n\tint a=k%10;\n\tfor (i=1;i<10;i++){\n\t\tcount = (a*i)%10;\n\t\tif (count==r || count==0){\n\t\t\tprintf(\"%d\", i);\n\t\t\tbreak;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i=0,p;\n scanf(\"%d %d\",&k,&r);\n if(k%10==5 && r!=5)\n {\n printf(\"2\");\n return 0;\n }\n if(k%10==0)\n {\n printf(\"1\");\n return 0;\n }\n if(k%10==8 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==2 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==6 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==4 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n do\n {\n i++;\n p = k*i;\n }while(p%10!=r);\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint k,r,n,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tn=k%10;\n\tif(n==0)\n\tprintf(\"1\");\n\tif(n!=0)\n\t{\n\t\tfor(i=1;i<10;i++)\n\t\t{\n\t\t\tj=i*n;\n\t\t\tif(j%10==r)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(j%10==0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,a;\n scanf(\"%d%d\",&k,&r);\n if(k%10==0)\n {\n printf(\"1\");\n }\n if(k%10!=0)\n {\n for(i=1;;i++)\n {\n a=k*i-r;\n if(a%10==0){\n printf(\"%d\",i);\n break;\n }\n else\n if(k*i%10==0)\n {printf(\"%d\",i);\n break;\n }\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,d,l,m,a=0;\n scanf(\"%d%d\",&k,&r);\n d=k%10;\n if(d==r)\n {\n printf(\"1\");\n }\n else if(d!=r)\n {\n if(k%10==0)\n {\n printf(\"1\");\n }\n else if(k%5==0)\n {\n printf(\"2\");\n }\n else\n {\n /*if(k/10==0)\n {\n\n printf(\"%d\",r/k);\n }\n else\n {*/\n\n\n\n for(i=1;i<=9;i++)\n {\n l=k*i;\n m=l%10;\n a++;\n\n if(m==r||m==0)\n {\n\n //printf(\"%d\\n%d\\n\",l,m);\n printf(\"%d\",a);\n break;\n }\n\n\n }\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\n\nint main() {\n // insert code here...\n int a, b;\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n for(int n = 1; n < 1000000000; n ++){\n if(b % a == 0 && b / a >= 1){\n printf(\"%d\", b / a);\n break;\n }\n if((10 * n) % a == 0 && (10 * n) / a >= 1){\n printf(\"%d\", (10 * n) / a);\n break;\n }\n if((10 * n + b) % a == 0 && (10 * n + b) / a >= 1){\n printf(\"%d\", (10 * n + b) / a);\n break;\n }\n \n \n \n }\n \n \n \n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k, r, i;\n 1<=k<=1000, 1<=r<=9;\n\n scanf(\"%d%d\", &k, &r);\n\n if(k%10==r)\n printf(\"1\\n\");\n\n else if(k%10==0)\n printf(\"1\\n\");\n\n else if(k%10!=r)\n {\n for(i=2; i<10; i++)\n {\n if((k*i)%10==r)\n {\n printf(\"%d\\n\", i);\n break;\n }\n\n\n else if((k*i)%10==0)\n {\n printf(\"%d\\n\", i);\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i,j;\n\tfor(i=1;i<1000;i++)\n\t{\n\t\tif((a*i)%10==0||(a*i-b)%10==0)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t\n\t}\n\t}\n\treturn 0;\n\t}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,k,i,c=0;\n scanf(\"%d%d\",&k,&r);\n for(i=1;i<=10;i++)\n {c++;\n if((k*i)%10==r||(k*i)%10==0)\n { break;}\n }\n printf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\n\nint main() {\n // insert code here...\n int a, b;\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n for(int n = 1; n < 1000000000; n ++){\n if(b % a == 0 && b / a >= 1){\n printf(\"%d\", b / a);\n break;\n }\n if((10 * n) % a == 0 && (10 * n) / a >= 1){\n printf(\"%d\", (10 * n) / a);\n break;\n }\n if((10 * n + b) % a == 0 && (10 * n + b) / a >= 1){\n printf(\"%d\", (10 * n + b) / a);\n break;\n }\n \n \n \n }\n \n \n \n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, const char * argv[]) {\n unsigned int price, m;\n scanf(\"%u %u\", &price, &m);\n for(unsigned int i = 1; i<10; i++){\n if(((price*i)%10 == 0) || ((price*i)%10 == m))\n return printf(\"%u\", i) & 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int pr,c,i,rm,k;\n scanf(\"%d%d\",&pr,&c);\n i=1;\n for(;;++i)\n {\n k=pr*i;\n rm=k%10;\n if (rm==0)\n {\n printf(\"%d\",i);\n break;\n }\n else if (rm==c)\n {\n printf(\"%d\",i);\n break;\n }\n }\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int k;\n int r;\n scanf(\"%d \", &k);\n scanf(\"%d\", &r);\n for(int iter=1; iter<10; iter++)\n {\n if ((k*iter-r)%10==0)\n {\n printf(\"%d\", iter);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,t;\n scanf(\"%d %d\",&k,&t);\n int n,i=0;\n n=k;\n while(1){\n if(k%10==0||(k+t)%n==0){break;}\n i++;\n k+=n;\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int k,coins,i,n;\n scanf(\"%d %d\",&k,&coins);\n \n if(k%2==0 && coins%2!=0)\n \tprintf(\"5\\n\");\n else\n {\n for (i=1; ;i++)\n {\n n=(k*i)-coins;\n if (n%10==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int k, r, a;\n \n scanf(\"%d %d\", &k, &r);\n \n a = k % 10;\n \n if (a == 0)\n {\n puts(\"1\");\n return 0;\n }\n\n for(int i = 1; i < 10; i++)\n {\n if ((a * i) % 10 == r)\n {\n if (i > 5 && i % 2 == 0)\n {\n puts(\"5\");\n return 0;\n }\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n \n if (a == 5)\n {\n puts(\"2\");\n return 0;\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r,i=1;\n\tscanf(\"%d%d\",&k,&r);\n\twhile(i<10)\n\t{\n\t\tif(k*i%10==0)\n break;\n else if(k*i-r%10==0)\n break;\n else\n i++; \n }\n\tprintf(\"%d\",i);\n\treturn 0; \n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,r,i;\n scanf(\"%d%d\",&k,&r);\n for (i=0;;i++){\n if ((i*k)%10==0){\n printf(\"%d\",r);\n break;\n }\n else if ((i*k)%10==r){\n printf(\"%d\",i);\n break;\n }\n }\n\n\n\n\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint price,Rcoin,shovels;\n\t\n\tscanf(\"%d %d\", &price,&Rcoin);\n\tshovels = 1;\n\t\n\tif ((price < 10)&&(price!=Rcoin))\n\t\tshovels = 0;\n\t\n\telse {\n\t\t\n\tif (price%10 == 0)\n\t\tshovels = price/10;\n\telse{\n\t\twhile(((shovels*price)-Rcoin)%10 != 0){\n\t\t\tshovels++;\n\t\t\tif((shovels*price)%10 == 0) break;\n\t\t};\n\t}\n\t\t\n\t}\n\tprintf(\"%d\\n\",shovels);\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main() {\n FILE *fp;\n fp=fopen(\"D.txt\",\"r\");\n int k,b,r;\n int n;\n fscanf(fp,\"%d %d\",&k,&r);\n n=1;\n while(1){\n if(((n*k-r)%10==0)||((n*k)%10==0)){\n printf(\"%d\",n);\n return 0;\n }else\n n=n+1;\n }\n }\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,ans;\n char s[100];\n scanf(\"%d%d\",&k,&r);\n\n if(k%10==0)\n printf(\"1\\n\");\n else if(k%5==0)\n printf(\"2\\n\");\n\n else if((k%r)==0 || (k%10)==r)\n {\n for(i=1;i<=10;i++)\n {\n ans=k*i;\n if((ans%10)==r)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n else\n printf(\"10\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, const char * argv[]) {\n unsigned int price, m, sum;\n scanf(\"%u %u\", &price, &m);\n if(price<10){\n if(price == m)\n return printf(\"%u\", 1) & 0;\n if(!(price%2)){\n for(sum = price; sum%10!=0; sum+=price);\n return printf(\"%u\", sum/price) & 0;\n }\n goto dubanov_hui;\n \n }\ndubanov_hui:\n for(unsigned int i = 1; i<10; i++){\n if(((price*i)%10 == 0) || ((price*i-m)%10 == 0))\n return printf(\"%u\", i) & 0;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,k,r,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tif(k==1)\n\t{\n\t\tprintf(\"%d\",r);\n\t}\n\telse\n\t{\n\tfor(i=1,j=0;;i++)\n\t{\n\t\tif(k==r)\n\t\t{\n\t\t\tn=1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(i*10%k==0)\n\t\t{\n\t\t\t//printf(\"helllo\");\n\t\t\tn=i*10/k;\n\t\t\tbreak;\n\t\t}\n\t\n\t\t else if((j*10+r)%k==0)\n\t\t{\n\t\t\t//printf(\"heloo\");\n\t\t\tn=(j*10+r)/k;\n\t\t\tbreak;\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n\t}\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int k,r,x=0;\n scanf(\"%d %d\",&k,&r);\n while(x++)\n {\n if(((k*x)%10==r)||((k*x)%10==0))\n {\n break;\n }\n }\n printf(\"%d\",x);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n117 3 15 2\nc=7 5\n\n21 7=3 5 10 15 20 25 30 35\n14 4\n21 1\n28 8\n35 5\n42 2\n49 9\n57 7\n63 3\n70 0\n\n\n\n*/\nint main()\n{\n int a,b,c, i, cont=0;\n scanf(\"%d %d\", &a, &b);\n\n c=a%10;\n for(i=1; i<10;i++){\n if((c*a)%10 == 0){\n printf(\"%d\", i);\n cont++;\n break;\n }\n else if((c*i)%10 == b){\n printf(\"%d\", i);\n cont++;\n break;\n }\n\n }\n\n if(cont==0) printf(\"%d\", b);\n\n return 0;\n}\n\n/* 1516491849297 */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int k,r,c=1,count=1;\n scanf(\"%d%d\",&k,&r); // r is the denomination we have and k is\n int x=k,s=0;\n if(k%10==0)\n {\n printf(\"1\");\n return 0;\n }\n if(k<10)\n {\n\n }\n k-=r;\n while(k%10!=0 || k%r!=0 )\n {\n c++;\n s+=x;\n if(s%10==0 ||s%r==0)\n {count++;break;}\n k-=r;\n }\n if(c<=count)\n printf(\"%d\",c);\n else\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tfor(i=1;i<=9;i++)\n\t{\n\t\tif((((k%10)*i)%10)==r)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(k%5==0&&k%10!=0)\n\t\tprintf(\"2\\n\");\n\telse if(k%10==0)\n\t\tprintf(\"1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "int main()\n{\n int k,r,n=0,f=0;\n scanf(\"%d %d\",&k,&r);\n if(k<10)\n n=1;\n if(k>=10)\n {\n while(!f)\n {\n n++;\n if((n*k%10==r)||(n*k%10==0))\n f=1;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i=0,p;\n scanf(\"%d %d\",&k,&r);\n if(k%10==5)\n {\n printf(\"2\");\n return 0;\n }\n if(k%10==0)\n {\n printf(\"1\");\n return 0;\n }\n if(k%10==8 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==2 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==6 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n if(k%10==4 && r%2!=0)\n {\n printf(\"5\");\n return 0;\n }\n do\n {\n i++;\n p = k*i;\n }while(p%10!=r);\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint k, r, count;\n\tscanf(\"%d\", &k);\n\tscanf(\"%d\", &r);\n\tif (k%r==0){\n\t\tcount=k/r;\n\t\tcount=count%10;\n\t}\n\telse {\n\t\tcount=k%10;\n\t\tcount=count/r;\n\t}\n\tprintf(\"%d\", count);\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int k, r, n, temp;\n int i = 1, j;\n scanf (\"%d %d\", &k, &r);\n n = k;\n while (n % 10 != 0) {\n i++;\n n = k * i;\n }\n if (i < 10) {\n printf(\"%d\\n\", i);\n return 0;\n }\n n = r;\n for(temp = 1; ; temp++) {\n if (n % k == 0) break;\n else n = n + 10;\n }\n j = n/k;\n printf(\"%d\\n\", j);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint k,r,i,j,m,n;\n\tscanf(\"%d %d\" , &k , &r);\n\tfor( i = 1; i <=9; i++) {\n\t\tif((k*i - r)%10 == 0){\n\t\t\tm = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i = 1 ; i <= 10 ; i++) {\n\t\tif((k*i)%10 == 0) {\n\t\t\tn = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(m<n) printf(\"%d\\n\",m);\n\telse printf(\"%d\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint s,t,i;\n\tscanf(\"%d%d\",&s,&t);\n\tint o=s%10;\n\tfor(i=1;i<=9;i++)\n\t{\n\t\tif((o*i)%10==t) break;\n\t}\n\tif(o==0) i=1;\n\telse if(o==5) if(i>2) i=2;\n\tprintf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum=0,b,x,j;\n scanf(\"%d\",&x);\n for(j=0;j<x;j++){\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n }\n\n if(sum%n==0){\n b=sum/n;\n printf(\"%d\\n\",b);\n }\n else{\n b=(sum/n)+1;\n printf(\"%d\\n\",b);\n }\n sum=0;\n }\n return 0;\n\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int k,r,x=1;\n scanf(\"%d %d\",&k,&r);\n while(((k*x%10==r)&&(k*x%10==0)))\n {\n\n x++;\n\n }\n printf(\"%d\",x);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i;\n\tscanf(\"%d%d\",&k,&r);\n\tfor(i=1;;i++)\n\t{\n\t int i=1;\n\t\tif((i%k)%10==0||(i*k)%10==r)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,p;\n scanf(\"%d %d\",&k, &r);\n p=k;\n for(i=0;i<=100;i++)\n {\n k=k+(p*i);\n if(k%10==0)\n {\n printf(\"%d\",k/p);\n break;\n }\n else if((k%10)==r)\n {\n printf(\"%d\",k/p);\n break;\n }\n\n\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint k, r, count, scount, a;\n\tscanf(\"%d\", &k);\n\tscanf(\"%d\", &r);\n\ta=k;\n\tif (k%r==0){\n\t\tcount=k/r;\n\t\tcount=count%10;\n\t}\n\telse if (k<r){\n\t\twhile (k<=r){\n\t\t\tk=k+a;\n\t\t\tscount++;\n\t\t}\n\t\tcount=scount;\n\t}\n\telse if (k%10==0){\n\t\tcount=1;\n\t}\n\telse {\n\t\tcount=k%10;\n\t\tcount=count/r;\n\t}\n\tprintf(\"%d\", count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,d=0,g,min=10,l=10;\n scanf(\"%d %d\",&k,&r);\n k=k%10;\n for(i=1;i<10;i++)\n {\n d=k*i;\n d=d%10;\n if(d%r==0 && d!=0)\n {\n if(d/r<min)\n {\n min=d/r;\n g=i;\n }\n }\n if((k*i)%10==0)\n if(i<l)\n l=i;\n }\n if(g*min<=l)\n printf(\"%d\",g);\n else\n printf(\"%d\",l);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i ,k,r,temp;\n\tscanf(\"%d %d\",&k,&r);\nif(k%5==0 && k%10!=0)\nprintf(\"2\");\nelse if(k%10==0)\nprintf(\"1\");\nelse\n{\n\n\tfor(i=1;i<=1000;i++)\n\t{\n\t\ttemp=k*i;\n\t\t\n\t\tif(temp%10==r)\n\t\tbreak;\n\t}\n\tprintf(\"%d\",i);\n\t\n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i=1,p=0;\n scanf(\"%d %d\",&n,&k);\n for(i=1;((n*i)%10)==k;i++){\n if(((n*i)%10)!=k){\n p++;\n }\n }\n if(i==1) printf(\"1\");\n else {\n printf(\"%d\",p);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,ans;\n scanf(\"%d%d\",&k,&r);\n\n if(k%10==0)\n printf(\"1\\n\");\n else if(k%5==0)\n printf(\"2\\n\");\n\n else\n {\n for(i=1;i<=10;i++)\n {\n ans=k*i;\n if((ans%10)==r)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum=0,b,x,j;\n scanf(\"%d\",&x);\n for(j=0;j<x;j++){\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n }\n\n if(sum%n==0){\n b=sum/n;\n printf(\"%d\\n\",b);\n }\n else{\n b=(sum/n)+1;\n printf(\"%d\\n\",b);\n }\n sum=0;\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,t;\n scanf(\"%d %d\",&k,&t);\n int n,i=0;\n n=k;\n while(1){\n if((k+t)%n==0){break;}\n if(k%10==0){i++;break;}\n i++;\n if((n-t)%10==0)break;\n k+=n;\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>/*\\n || */\nint main()\n{\n int k,r,i,j;\n scanf(\"%d %d\",&k,&r);\n if(k==1 && r==1)\n printf(\"1\");\n for(i=1;i<k;i++)\n {\n j=i*k;\n if(j%10==0){\n printf(\"%d\",i);\n break;\n }\n else if(j%10==r){\n printf(\"%d\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,d=0,g,min=10,l=10;\n scanf(\"%d %d\",&k,&r);\n k=k%10;\n for(i=1;i<10;i++)\n {\n d=k*i;\n d=d%10;\n if(d%r==0 && d!=0)\n {\n if(d/r<min)\n {\n min=d/r;\n g=i;\n }\n }\n if((k*i)%10==0)\n if(i<l)\n l=i;\n }\n if(g*min<=l)\n printf(\"%d\",g);\n else\n printf(\"%d\",l);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() \n{\n\tunsigned k, r, sum, count = 1;\n\tscanf(\"%u %u\\n\", &k, &r);\n\tsum = k;\n\n\twhile (((sum-r) % 10 != 0)&&(sum % 10 != 0))\n\t{\n\t\tsum += k;\n\t\tcount++;\n\t}\n\n\tprintf(\"%u\\n\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,d,l,m,a=0;\n scanf(\"%d%d\",&k,&r);\n d=k%10;\n if(d==r)\n {\n printf(\"1\");\n }\n else if(d!=r)\n {\n if(k%10==0)\n {\n printf(\"1\");\n }\n else if(k%5==0)\n {\n printf(\"2\");\n }\n else\n {\n if(k/10==0)\n {\n if(r%k==0)\n {\n printf(\"%d\",r/k);\n }\n }\n for(i=2;i<=9;i++)\n {\n l=k*i;\n m=l%10;\n a++;\n }\n if(m==r)\n {\n\n printf(\"%d\",a+1);\n }\n\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint k,r;\n\tint n=1,i=1;;\n\tscanf(\"%d%d\",&k,&r);\n\tint t;\n\tt=k;\n\tif(k%10==0)\n\t{\n\tprintf(\"1\\n\");\t\n\t}\n\telse\n\t{\n\twhile(k%10!=0&&((k%10)!=r))\n\t{\n\t\tk=t*i;\n\t\tn++;\n\t\tprintf(\"%d\\n\",k);\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",n-1);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,cnt=0,i,c;\n scanf(\"%d%d\",&a,&b);\n c=a;\n if(a<10&&a==b)\n {\n printf(\"1\");\n return 0;\n }\n if(a%5==0)\n {\n for(;;)\n {\n if(a%10==0) break;\n else {\n a=a+a;\n cnt++;\n }\n \n }\n \n }\n else{\n for(;;)\n {\n \n if((a-b)%10==0)\n break;\n else\n {\n a=a+c;\n cnt++;\n if(a%10==0)break;\n }\n }}\n printf(\"%d\",cnt+1);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint k,r;\n\t//FILE *f=fopen(\"muaxeng.inp\",\"rt\");\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&r);\n\tif(k==1){\n\t\tprintf(\"%d\",r);\n\t\t}\n\t\telse{\n\t\t\n\tfor(int i=1;i<=k;i++){\n\t\tif(i*k%10==0){\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t\tif(((i*k)-r)%10==0){\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t}}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint k,r;\n\t//FILE *f=fopen(\"muaxeng.inp\",\"rt\");\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&r);\n\t\n\tfor(int i=1;i<=k;i++){\n\t\tif(i*k%10==0){\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t\tif(((i*k)-r)%10==0){\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r,i=1;\n\tscanf(\"%d%d\",&k,&r);\n if(k%5 == 0)\n\t{ \n r=0;\n\t\twhile((k*i-r)%10 != 0 && i<10)\n\t\t{\n\t\t\ti++; \n\t\t}\n\t}\n\telse\n\t{\n\t\twhile((k*i-r)%10 != 0 && i<10)\n\t\t{\n\t\t\ti++; \n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\n\treturn 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r,i,j;\n\tscanf(\"%d%d\",&k,&r);\n\tfor(i=1;i<=9;i++)\n\t{\n\t\tif((((k%10)*i)%10)==r)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tif(k%5==0&&k%10!=0)\n\t\tprintf(\"2\\n\");\n\telse if(k%10==0)\n\t\tprintf(\"1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint r,k,x,i;\n\tscanf(\"%d%d\",&k,&r);\n\tfor(i=1;i<=9;i++)\n\t{ x=i*k;\n\t\n\t if((x%10)==r)\n\t {\n\t printf(\"%d\",i);\n\t return 0;\n\t}\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n int k, r;\n int remain;\n\n scanf(\"%d %d\", &k, &r);\n remain = k % 10;\n\n for(int i=1; ;){\n if(remain <= r){\n printf(\"%d\", i);\n break;\n }\n i++;\n remain = k * i % 10;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,cnt=0,i,c;\n scanf(\"%d%d\",&a,&b);\n c=a;\n if(a<10&&a==b)\n {\n printf(\"1\");\n return 0;\n }\n if(a%5==0)\n {\n for(;;)\n {\n if(a%10==0) break;\n else {\n a=a+a;\n cnt++;\n }\n \n }\n \n }\n else{\n for(;;)\n {\n \n if((a-b)%10==0)\n break;\n else\n {\n a=a+c;\n cnt++;\n if(a%10==0)break;\n }\n }}\n printf(\"%d\",cnt+1);\n}"}, {"source_code": "#include <stdio.h>\n//#include <stdlib.h>\n//#include <string.h>\n//#include <ctype.h>\n\nint main()\n{\n int k,r,total,i,n;\n //int dig;\n\n scanf(\"%d %d\",&k,&r);\n\n if(k>=1 && k<=1000 && r>=1 && r<=9){\n\n if(k<r){\n printf(\"%d\",r);\n return 0;\n }\n else if(((k%10)==r) || ((k%10)==0)){\n printf(\"1\");\n return 0;\n }\n else if((k%10)==5){\n printf(\"2\");\n return 0;\n }\n else{\n /*n=k;\n while(n!=0){\n dig++;\n n=n/10;\n }*/\n\n n=k%10;\n for(i=1;i<=9;i++){\n if(((r*i)%10)==n){\n total=i;\n break;\n }\n }\n printf(\"%d\",total);\n }\n }\n else\n return 0;\n\n return 0;\n}\n"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include <ctype.h>\n\nint main()\n{\n int n,r,s=0,x=0;\n scanf(\"%d %d\",&n,&r);\n\n int R = roundUp(n,10);\n int temp = n%r;\n if((n%10==0)||(n-r)%10==0)\n {\n printf(\"1\");\n return 0;\n }\n if(((temp!=0))&&(10%(n%r))==0&&(n>10))\n {\n do\n {\n s++;\n }while((n*s)%10!=0);\n printf(\"%d\",s);\n return 0;\n }\n\n do\n {\n s++;\n }while(((R*s)-(r*s))%10 != 0);\n\n printf(\"%d\",(s-1));\n\n return 0;\n}\nint string_length(char s[]) {\n int c = 0;\n while (s[c] != '\\0')\n c++;\n\n return c;\n}\nint roundUp(int numToRound, int multiple)\n{\n if (multiple == 0)\n return numToRound;\n\n int remainder = numToRound % multiple;\n if (remainder == 0)\n return numToRound;\n\n return numToRound + multiple - remainder;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,n=100,a=0;\n\t\t\t\tscanf(\"%d %d\",&k,&r);\n\t\t\t\tfor(i=1;i<n;i++)\n\t\t\t{\n\t\t\t\t\t\t\t\tfor(j=1;(k*i>=10*j);j++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tif(k*i==10*j)\n\t\t\t\t\t\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprintf(\"%d\\n\",i);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ta=1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\t\t\telse if(k*i==((10*j)+r))\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tprintf(\"%d\\n\",i);\n\t\t\t\t\t\t\t\t\t\t\t\ta=1;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\nelse;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\n\t\tif(a)\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\t\t}\n\t\t\t\t\t\t\t\treturn 0;\n\t}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,r,rem,i,x;\n scanf(\"%d %d\",&k,&r);\n rem=k%10;\n if(rem==0)\n {\n printf(\"1\\n\");\n }\n else\n {\n i=1;\n while(1)\n {\n if((x%10)==r || (x%10)==0)\n break;\n x=rem*i;\n i++;\n }\n printf(\"%d\\n\",i-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,d=0,g=0,min=10,l=10;\n scanf(\"%d %d\",&k,&r);\n k=k%10;\n if(k==1 && r==1)\n {\n printf(\"1\");\n return 0;\n }\n else\n {\n for(i=1;i<10;i++)\n {\n d=k*i;\n d=d%10;\n if(d%r==0 && d!=0)\n {\n if(d/r<min)\n {\n min=d/r;\n g=i;\n }\n }\n if((k*i)%10==0)\n if(i<l)\n l=i;\n }\n }\n if(g<=l)\n printf(\"%d\",g);\n else\n printf(\"%d\",l);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() { \n int k, r, n;\n \n scanf(\"%d %d\", &k, &r);\n\n n = 1;\n while ((n * k - r) % 10 != 0 && (n * k) & 10 != 0) {\n n += 1;\n }\n printf(\"%d\\n\", n); \n\n return 0;\n}\n"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include <ctype.h>\n\nint main()\n{\n int n,r,s=0,x=0;\n scanf(\"%d %d\",&n,&r);\n\n int R = roundUp(n,10);\n int temp = n%r;\n if((n%10==0)||(n-r)%10==0)\n {\n printf(\"1\");\n return 0;\n }\n if(((temp!=0))&&(10%(n%r))==0&&(n<10))\n {\n do\n {\n s++;\n }while((n*s)%10!=0);\n printf(\"%d\",s);\n return 0;\n }\n\n do\n {\n s++;\n }while(((R*s)-(r*s))%10 != 0);\n\n printf(\"%d\",(s-1));\n\n return 0;\n}\nint string_length(char s[]) {\n int c = 0;\n while (s[c] != '\\0')\n c++;\n\n return c;\n}\nint roundUp(int numToRound, int multiple)\n{\n if (multiple == 0)\n return numToRound;\n\n int remainder = numToRound % multiple;\n if (remainder == 0)\n return numToRound;\n\n return numToRound + multiple - remainder;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,k,l,p=1;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n for(i=1;i<11;i++){\n p=p*k;\n if(p%10==l){\n printf(\"%d\",i);\n \n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,k,rem,p,i=1,total=0;\n scanf(\"%d%d\",&n,&k);\n rem=n%10;\n total=n;\n while(1)\n {\n p=rem*i;\n if(p%10==k)\n {\n break;\n }\n\n total=total*i;\n if(total%10==0)\n {\n break;\n }\n i++;\n\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int k,coins,i,n;\n scanf(\"%d %d\",&k,&coins);\n \n if(k%2==0 && coins%2!=0)\n \tprintf(\"5\\n\");\n else\n {\n for (i=1; ;i++)\n {\n n=(k*i)-coins;\n if (n%10==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,k,i;\n scanf(\"%d%d\",&k,&r);\n for(i=1;i<=10;i++)\n {\n if((k*i)%10==r)\n break;\n }\n printf(\"%d\",i);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,i,z;\n scanf(\"%d%d\",&x,&y);\n if(x%10==0)\n {\n printf(\"1\\n\");\n }\n else if(x%10==5)\n {\n printf(\"2\\n\");\n }\n else\n {\n for(i=1;i<=9;i++){\n z=x*i-y;\n if(z%10==0)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n\n }\n }\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b;\n int count = 1 ;\n scanf(\"%d%d\", &a, &b);\n while(count++)\n {\n if(a*count % 10 == 0)\n {\n break;\n }\n if((a*count-b) % 10 == 0)\n {\n break;\n }\n if((a-b) % 10 == 0)\n {\n printf(\"1\");\n return 0;\n }\n }\n printf(\"%d\", count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n117 3 15 2\nc=7 5\n\n21 7=3 5 10 15 20 25 30 35\n14 4\n21 1\n28 8\n35 5\n42 2\n49 9\n57 7\n63 3\n70 0\n\n\n\n*/\nint main()\n{\n int a,b,c, i, cont=0;\n scanf(\"%d %d\", &a, &b);\n\n c=a%10;\n for(i=1; i<10;i++){\n if((c*a)%10 == 0){\n printf(\"%d\", i);\n cont++;\n break;\n }\n else if((c*i)%10 == b){\n printf(\"%d\", i);\n cont++;\n break;\n }\n\n }\n\n if(cont==0) printf(\"%d\", b);\n\n return 0;\n}\n\n/* 1516491849297 */\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n int k, r;\n int remain;\n\n scanf(\"%d %d\", &k, &r);\n remain = k % 10;\n\n for(int i=1; ;i++){\n if(remain <= r){\n printf(\"%d\", i);\n break;\n }\n remain = k * i % 10;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint price,Rcoin,shovels;\n\t\n\tscanf(\"%d %d\", &price,&Rcoin);\n\tshovels = 1;\n\t\n\tif ((price < 10)&&(price!=Rcoin))\n\t\tshovels = 0;\n\t\n\telse {\n\t\t\n\tif (price%10 == 0)\n\t\tshovels = price/10;\n\telse{\n\t\twhile(((shovels*price)-Rcoin)%10 != 0){\n\t\t\tshovels++;\n\t\t\tif((shovels*price)%10 == 0) break;\n\t\t};\n\t}\n\t\t\n\t}\n\tprintf(\"%d\\n\",shovels);\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "// Codeforces A. Buy a Shovel\n// Created by Abdulrahman Elsayed on 02/07/2020\n\n#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n // Define and read variables\n int k, r, output;\n scanf(\"%d %d\", &k, &r);\n \n if (k == r)\n {\n printf(\"1\\n\");\n return 0;\n }\n else\n { \n for (int i = 1; i <= k; i++)\n {\n if (((10 * i + r) % k) == 0)\n {\n output = (10 * i + r) / k;\n break;\n }\n else if (((10 * i) % k) == 0)\n {\n output = (10 * i) / k;\n break;\n }\n } \n }\n \n printf(\"%d\\n\", output);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int i,value=0,r=0,x=0,t;\n scanf(\"%d%d\",&value,&r);\n if(r==value)\n {\n x=value/r;\n }\n else if(value<r)\n {\n x=r/value;\n\n for(i=1; i<=1000; i++)\n {\n if((10*i)%value==0)\n {\n x=(10*i)/value;\n break;\n\n }\n else if(((10*i)+r)%value==0)\n {\n x=((10*i)+r)/value;\n break;\n\n }\n else\n continue;\n\n }\n }\n else\n {\n\n for(i=1; i<=1000; i++)\n {\n if((10*i)%value==0)\n {\n x=(10*i)/value;\n break;\n\n }\n else if(((10*i)+r)%value==0)\n {\n x=((10*i)+r)/value;\n break;\n\n }\n else\n continue;\n\n }\n }\n printf(\"%d\",x);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,x,i,y,j,z,l,m;\n scanf(\"%d%d\",&k, &r);\n if(k%10==0){\n x=1;\n }\n else{\n y=k%10;\n if(y==r){\n x=1;\n }\n else{\n for(i=2;i<10;i++){\n j=k*i;\n if(j%10==0){\n m=i;\n break;\n }\n else if(j%10!=0){\n z=j%10;\n if(z==r){\n l=i;\n }\n else{\n continue;\n }\n }\n }\n if(m<l){\n x=m;\n }\n else{\n x=l;\n }\n }\n }\n printf(\"%d\", x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long int k;\n scanf(\"%ld\",&k);\n int r,a,b;\n scanf(\"%d\",&r);\n for(int i=1;i<k;i++){\n b=k*i;\n a=k%10;\n if(a==0||a==r){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n// #include <bits/stdc++.h>\n// using namespace std;\nint main()\n{\n int k , r , n;\n scanf(\"%d%d\",&k,&r);\n \n if(1==r){\n if(k%10==0)\n printf(\"0\");\n else\n printf(\"%d\",k%10);\n return 0;\n }\n if(k%10==r){\n printf(\"1\");\n }\n else{\n for(int i =1;i<=10;i++){\n n = i*k;\n if(n%10==r||n%10==0){\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int e,i,a,k,r,c,d,j;\n d=0;\n scanf(\"%d%d\",&k,&r);\n for(i=1;;i++){\n j=k*i;\n c=j%10;\n d++;\n if(r==c)\n break;\n }\n e=0;\n for(i=1;;i++){\n j=k*i;\n a=j%10;\n e++;\n if(a==0)\n break;\n }\n if(e>c)\n printf(\"%d\",c);\n else\n printf(\"%d\",e);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int k,r,c=1,count=0;\n scanf(\"%d%d\",&k,&r);\n int x=k,s=0;\n if(k%10==0)\n {\n printf(\"1\");\n return 0;\n }\n k-=r;\n while(k%10!=0)\n {\n c++;\n if(k<10)\n {\n s+=x;\n count++;\n if(s%10==0)\n {\n printf(\"%d\",count);\n return 0;\n }\n }\n k-=r;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "// Codeforces A. Buy a Shovel\n// Created by Abdulrahman Elsayed on 02/07/2020\n\n#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n // Define and read variables\n int k, r, output1, output2;\n scanf(\"%d %d\", &k, &r);\n \n output1 = 10;\n \n for (int i = 1; i < k; i++)\n if (((10 * i + r) % k) == 0)\n {\n output2 = (10 * i + r) / k;\n break;\n }\n else if (((10 * i) % k) == 0)\n {\n output2 = (10 * i) / k;\n break;\n }\n \n if (output1 < output2)\n printf(\"%d\\n\", output1);\n else \n printf(\"%d\\n\", output2);\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,k,r,i=1;\n scanf(\"%d %d\",&k,&r);\n m=k%10;\n if(m==0)\n i=1;\n else if(k%2==0 && r%2==1)\n i=10;\n else if((r%2==1 && k%2==1) || (r%2==0 && k%2==0))\n {\n while(i<10)\n {\n if(r==((m*i)%10))\n break;\n i++;\n }\n }\n else {\n if(k%10==5)\n i=2;\n else {\n while(i<10)\n {\n if(r==((m*i)%10))\n break;\n i++;\n }\n }\n }\n printf(\"%d\\n\",i);\n}\n"}, {"source_code": "int main()\n{\n int k,r,n=0,f=0;\n scanf(\"%d %d\",&k,&r);\n if(k<10)\n n=1;\n if(k>=10)\n {\n while(!f)\n {\n n++;\n if((n*k%10==r)||(n*k%10==0))\n f=1;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,r,z,p,i;\n\ti=1,p=1;\n\tscanf(\"%d%d\",&k,&r);\n\tif(k==r){\n\tprintf(\"1\");\n\treturn 0;}\n\twhile(p!=r && p!=0)\n\t{\n\t\tz=k*i;\n\t\tp=z%10;\t\n\t\ti++;\n\t}printf(\"%d\",i-1);\n}"}, {"source_code": "#include <stdio.h>\n\nint k;\nint r;\nint i;\n\nint main() {\n\tscanf(\"%d %d\", &k, &r);\n\tfor (i = 1; i <= 10; i++) {\n\t\tif (r == k * i % 10) {\n\t\t\tprintf(\"%d\", i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,d,l,m,a=0;\n scanf(\"%d%d\",&k,&r);\n d=k%10;\n if(d==r)\n {\n printf(\"1\");\n }\n else if(d!=r)\n {\n if(k%10==0)\n {\n printf(\"1\");\n }\n else if(k%5==0)\n {\n printf(\"2\");\n }\n else\n {\n if(k/10==0)\n {\n if(r%k==0)\n {\n printf(\"%d\",r/k);\n }\n }\n for(i=2;i<=9;i++)\n {\n l=k*i;\n m=l%10;\n a++;\n }\n if(m==r)\n {\n\n printf(\"%d\",a+1);\n }\n\n\n }\n }\n return 0;\n}\n"}, {"source_code": "int main() {\n int a,b,i;\n scanf(\"%d%d\",&a,&b);\n for(i=1;(i*a)%10!=b;i++);\n printf(\"%d\",i);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int shovel,coin,total,count=0,digit,a;\n scanf(\"%d\",&shovel);\n scanf(\"%d\",&coin);\n digit=shovel%10;\n a=shovel;\n\n\n if(digit==0)\n {\n printf(\"%d\",1);\n }\n else if(digit==5)\n {\n printf(\"2\");\n }\n else if(digit==coin)\n {\n printf(\"%d\",1);\n }\n else\n {\n while(shovel%10!=coin)\n {\n count=count+1;\n shovel=shovel+a;\n if(shovel%10==0)\n {\n break;\n }\n\n }\n printf(\"%d\",count+1);\n\n\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, r;\n int i=1;\n int ans=NULL;\n int ans1=NULL;\n\n scanf(\"%d %d\", &k, &r);\n\n int last_dig_k = k%10;\n\n if(last_dig_k==r || last_dig_k==0)\n {\n printf(\"1\\n\");\n }\n else if(last_dig_k==5)\n {\n printf(\"2\\n\");\n }\n else if(k==1 || k<r)\n {\n printf(\"%d\\n\", r/k);\n }\n else\n {\n\n while(1){\n // ans = r*i;\n //if((ans%10) == last_dig_k) break;\n ans1 = last_dig_k*i;\n if((ans1%10) == 0) break;\n if((ans1%10) == r) break;\n i++;\n }\n\n printf(\"%d\", i);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain ()\n{\n int a,c,i,j,r;\n int b;\n scanf(\"%d%d\",&a,&b);i=0;\n if(a==117){\n printf(\"9\\n\");\n }\n else{\n while(r!=0){i++;\n a=a*i;\n r=a%10;\n if (r==b)\n break;\n }\n printf(\"%d\",i);}\n }\n \n \n \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, r;\n int i=1;\n int ans=NULL;\n int ans1=NULL;\n\n scanf(\"%d %d\", &k, &r);\n\n int last_dig_k = k%10;\n\n if(last_dig_k==r || last_dig_k==0)\n {\n printf(\"1\\n\");\n }\n else if(last_dig_k==5)\n {\n printf(\"2\\n\");\n }\n else if(k==1 || k<r)\n {\n printf(\"%d\\n\", r/k);\n }\n else\n {\n\n while(1){\n // ans = r*i;\n //if((ans%10) == last_dig_k) break;\n ans1 = last_dig_k*i;\n if((ans1%10) == 0) break;\n if((ans1%10) == r) break;\n i++;\n }\n\n printf(\"%d\", i);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,t,n=1,p;\n scanf(\"%d %d\",&k,&r);\n t=k%10;\n for(int i=2;t!=r&&t!=0;i++)\n {\n p=i*k;\n t=p%10;\n if(t==0)\n n++;\n if(t==r)\n {\n n++;\n break;\n }\n else\n n++;\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,r,i;\n scanf(\"%d %d\",&k,&r);\n for(i=1;i<=10;i++){\n if(i*k%10==0||(i*k-r)==0){\n break;\n }\n }\n printf(\"%d\",i-1);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int p,r,t2,i,t1;\n scanf(\"%d%d\",&p,&r);\n for(i=1;i<=10;i++)\n {\n if((p*i)%10==0)\n {\n t1=i;\n break;\n }\n }\n for(i=1;i<=10;i++)\n {\n if(((p*i)-r)%10==0)\n {\n t2=i;\n break;\n }\n }\n if (t1>t2)\n printf(\"%d\",t2);\n else\n printf(\"%d\",t1);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n\n int n,a,ans1,ans2,b,i,j=0;\n scanf(\"%d %d\",&n,&a);\nif(a==1||n==1)\n{\n\n printf(\"%d\",n*a);\n}\nelse{\n for(i=1;i<n;i++)\n {\n ans1=10*i;\n if((ans1+a)%n==0)\n {\n printf(\"%d\",(ans1+a)/n);\n break;\n }\n else if(ans1%n==0)\n {\n printf(\"%d\",ans1/n);\n break;\n }\n\n }\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdlib.h>\n#include <string.h>\n#include <stdio.h>\nint main()\n{\n int k,r,i=1,j;\n scanf(\"%d%d\",&k,&r);\n while(i++)\n {\n if((10*i+r)%k==0)\n {\n j=(10*i+r)/k;\n break;\n }\n if((10*i)%k==0){\n j=(10*i)/k;break;\n }\n }\n printf(\"%d\\n\",j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int sc,rb,ans=0,temp;\n scanf(\"%d%d\",&sc,&rb);\n while(1)\n {\n temp=sc*ans;\n if((temp-rb)%10==0||temp%10==0)\n break;\n ans++;\n }\n printf(\"%d\\n\",ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num,i,even=0,odd=0;\n scanf(\"%d\",&num);\n int a[num];\n for(i=0;i<num;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]%2==0)\n {\n even++;\n }\n else\n {\n odd++;\n }\n }\n if(odd==1)\n {\n printf(\"1\");\n }\n else if(even>odd)\n {\n printf(\"%d\",even);\n }\n else\n {\n printf(\"%d\",odd);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r;\n int x,i,j,l;\n scanf(\"%d%d\",&k,&r);\n i=k%10;\n for(j=1;j<10;j++)\n {\n l=r*j;\n if(l%10==i) break;\n x=0;\n }\n if(j==10&&x==0)\n {\n j=1;\n while(k%10!=0&&k!=r)\n {\n j++;\n k=k*j;\n }\n }\n if(i==0) j=1;\n printf(\"%d\",j);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,n=100,a=0;\n\t\t\t\tscanf(\"%d %d\",&k,&r);\n\t\t\t\tfor(i=1;i<n;i++)\n\t\t\t{\n\t\t\t\t\t\t\t\tfor(j=1;(k*i>=10*j);j++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(k<10)\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprintf(\"%d\",r);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ta=1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\telse\tif(k*i==10*j)\n\t\t\t\t\t\t\t\t\t\t\t\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprintf(\"%d\\n\",i);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ta=1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t\t\t\t\t\t\telse if(k*i==((10*j)+r))\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tprintf(\"%d\\n\",i);\n\t\t\t\t\t\t\t\t\t\t\t\ta=1;\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\nelse;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\n\t\tif(a)\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\t\t}\n\t\t\t\t\t\t\t\treturn 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint k, r;\n\tscanf(\"%d\", &k);\n\tscanf(\"%d\", &r);\n\tk = k%10;\n\tint i;\n\tfor(i=1; i<=10; i++){\n\t\tif((k*i)%10 == r){\n\t\t\tprintf(\"%d\", i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,i,z;\n scanf(\"%d%d\",&x,&y);\n if(x%10==0 || x==y)\n {\n printf(\"1\\n\");\n return 0;\n }\n\n else if(x%10==5)\n {\n printf(\"2\\n\");\n return 0;\n }\n\n else\n {\n for(i=1;i<=9;i++){\n z=x*i;\n if(z%10==0)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n else\n {\n z=z-y;\n if(z%10==0)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n }\n\n }\n }\n\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i;\n scanf(\"%d %d\",&k,&r);\n if(k%10==0)\n\tprintf(\"1\\n\");\n else\n {\n\tfor(i=1;i<=9;i++)\n\t{\n\t if(r%2==1)\n\t {\n\t\tif( ( k*i - r )%10==0)\n\t\t{\n\t\t printf(\"%d\\n\",i);\n\t\t break;\n\t\t}\n\n\t }\n\t else\n\t {\n\t\tif( (k*i-r)%10==0 || (k*i)%10==0 )\n\t\t{\n\t\t printf(\"%d\\n\",i);\n\t\t break;\n\t\t}\n\t }\n\n\n\t}\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tint k,r,temp,i;\n\tscanf(\"%d %d\",&k,&r);\n\ttemp=k%10;\n\ti=2;\n\twhile((temp!=r)&&(i<10))\n\t{\n\t\ttemp=(k*i)%10;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",i-1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <string.h>\n#include <stdio.h>\nint main()\n{\n int k,r,i=1,j,c;\n scanf(\"%d%d\",&k,&r);\n while(i++)\n {\n if((10*i+r)%k==0)\n {\n j=(10*i+r)/k;\n break;\n }\n if((10*i)%k==0){\n j=(10*i)/k;break;\n }\n if((r)%k==0)\n {\n j=(r)/k;\n break;\n }\n }\n printf(\"%d\\n\",j);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n// #include <bits/stdc++.h>\n// using namespace std;\nint main()\n{\n int k , r , n;\n scanf(\"%d%d\",&k,&r);\n \n if(1==r){\n printf(\"%d\",k%10);\n return 0;\n }\n if(k%10==r){\n printf(\"1\");\n }\n else{\n for(int i =1;i<=10;i++){\n n = i*k;\n if(n%10==r||n%10==0){\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,t,s;\n scanf(\"%d\",&k);\n scanf(\"%d\",&r);\n\n for(i=1;i<10;i++){\n t=k*i;\n s=t%10;\n if(s==r ) break;\n if(t%2==0 && r%2==0) break;\n }\n printf(\"%d\",i);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,i,j,d=0,g,min=10,l=10;\n scanf(\"%d %d\",&k,&r);\n k=k%10;\n for(i=1;i<10;i++)\n {\n d=k*i;\n d=d%10;\n if(d%r==0 && d!=0)\n {\n if(d/r<min)\n {\n min=d/r;\n g=i;\n }\n }\n if((k*i)%10==0)\n if(i<l)\n l=i;\n }\n if(l<=g)\n printf(\"%d\",l);\n else\n printf(\"%d\",g);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, const char * argv[]) {\n unsigned int price, m, sum;\n scanf(\"%u %u\", &price, &m);\n for(unsigned int i = 1; i<10; i++){\n if(((price*i)%10 == 0) || ((price*i-m)%10 == 0))\n return printf(\"%u\", i) & 0;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n int k, r;\n int remain;\n\n scanf(\"%d %d\", &k, &r);\n remain = k % 10;\n\n for(int i=1; ;){\n if(remain%r == 0){\n printf(\"%d\", i);\n break;\n }\n i++;\n remain = k * i % 10;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,i=1,r;\n\n scanf(\"%d %d\",&n,&k);\n if(n%10==0) printf(\"1\");\n else if(n%2==0&&k%2==1) printf(\"10\");\n else if(n%10==5&&k!=5) printf(\"2\");\n else\n {\n while((((n%10)*i)%10)-k!=0) i++;\n printf(\"%d\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,r,n=1,i,k1,l,m,o=1;\n scanf(\"%d%d\",&k,&r);\n k1=k%10;\n while(o)\n {\n k=k%10;\n if(!k||k==r)\n {\n l=n;o=0;\n }\n k+=k1;\n n++;\n }\n n=1;\n k=k1;o=1;\n while(o){\n {\n k=k%10;\n for(i=1;i<=10;i++)if(((i*r)%10)==k)\n {\n m=i*n;o=0;\n }\n }\n k+=k1;\n n++;\n }\n printf(\"%d\",(m>l)?l:m);\n return 0;\n}\n"}], "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3"} {"nl": {"description": "Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces made of three blocks.The students don\u2019t want to use too many blocks, but they also want to be unique, so no two students\u2019 towers may contain the same number of blocks. Find the minimum height necessary for the tallest of the students' towers.", "input_spec": "The first line of the input contains two space-separated integers n and m (0\u2009\u2264\u2009n,\u2009m\u2009\u2264\u20091\u2009000\u2009000, n\u2009+\u2009m\u2009>\u20090)\u00a0\u2014 the number of students using two-block pieces and the number of students using three-block pieces, respectively.", "output_spec": "Print a single integer, denoting the minimum possible height of the tallest tower.", "sample_inputs": ["1 3", "3 2", "5 0"], "sample_outputs": ["9", "8", "10"], "notes": "NoteIn the first case, the student using two-block pieces can make a tower of height 4, and the students using three-block pieces can make towers of height 3, 6, and 9 blocks. The tallest tower has a height of 9 blocks.In the second case, the students can make towers of heights 2, 4, and 8 with two-block pieces and towers of heights 3 and 6 with three-block pieces, for a maximum height of 8 blocks."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{int m,n,i;\n scanf(\"%d%d\",&n,&m);\n for(i=1; ;++i)\n if(i/2>=n&&i/3>=m&&(i/2+i/3-i/6)>=m+n)\n break;\n\n\n printf(\"%d\\n\",i);return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint max(int x,int y)\n{\n\treturn x>y?x:y;\n}\nint min(int x,int y)\n{\n\treturn x>y?y:x;\n}\nint main() \n{ \n int n,m; \n while(scanf(\"%d %d\",&n,&m)!=EOF) \n { \n n*=2; //A\ufffd\u0734\ufffd\ufffd\ufffd\ufffd\u07f5\ufffd \n m*=3; //B\ufffd\u0734\ufffd\ufffd\ufffd\ufffd\u07f5\ufffd \n int i; \n for(i=6;i<=min(n,m);i+=6) \n { \n if(n>m) //\ufffd\ufffd\ufffd\ufffd\ufffd\u02b1A\ufffd\ufffdB\ufffd\ufffd\ufffd\u07f6\u0238\ufffd \ufffd\ufffd\u00f4\ufffd\ufffdB\ufffd\ufffd\ufffd\ufffd \n m+=3; \n else //\u036c\ufffd\ufffd \n n+=2; \n } \n printf(\"%d\\n\",max(n,m)); \n } \n} \n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint i,n,m,n2,n3,n6;\n\tn2=n3=n6=0;\n\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;;i++){\n\t\tif(i%2==0) n2++;\n\t\tif(i%3==0) n3++;\n\t\tif(i%6==0) n6++;\n\t\tif(n2>=n && n3>=m && n+m<=n2+n3-n6) break;\n\t}\n\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\ntypedef long long ll;\nchar op[205];\n\nint main()\n{\n ll n, m, c, i, j=0, t;\n scanf(\"%I64d\", &n);\n scanf(\"%I64d\", &m);\n t=n+m;\n for(i=2;j<t; i++)\n {\n if(i%2==0&&i%3==0)\n {\n if(n>m)\n {\n n--;\n j++;\n }\n else\n {\n m--;\n j++;\n }\n c=i;\n }\n else if(i%2==0&&n>0)\n {\n n--;\n j++;\n c=i;\n }\n else if(i%3==0&&m>0)\n {\n m--;\n j++;\n c=i;\n }\n }\n printf(\"%I64d\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n,m;\n\nint check(int a)\n{\n\tif((a/2<n) || (a/3<m) || (a/2+a/3-a/6<m+n))\n\treturn 0;\n\treturn 1;\n}\n\nint main()\n{\n\tint l=0,r=10000000,mid;\n\twhile(scanf(\"%d%d\",&n,&m)!=EOF)\n\t{\n\t\tl=0; r=10000000;\n\t\twhile(l+1<r)\n\t\t{\n\t\t\tmid=(l+r)/2;\n\t\t\tif(check(mid))\n\t\t\t{\n\t\t\t\tr=mid;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tl=mid;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",r);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,k,n1=0,m1=0,max;\n\tscanf(\"%d%d\",&n,&m);\n\tif(2*n>3*m)max=2*n;\n\telse max=3*m;\n\tfor(i=2;;i++)\n\t{\n\t\tif(i%2==0 && i%3 !=0)n1++;\n\t\tif(i%2!=0 && i%3 ==0)m1++;\n\t\tj=i/6;\n\t\tif(j+n1+m1==m+n && i>=max)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse if(j+n1+m1==m+n && i<=max)\n\t\t{\n\t\t\tprintf(\"%d\\n\",max);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint k=1,ans=0,m3=0;\n\twhile(m3<a+b)\n\t{\n\t\tif(k%6==0)\n\t\tm3++;\n\t\telse if(k%2==0){\n\t\tif(a>0)\n\t\ta--;}\n\t\telse if(k%3==0){\n\t\tif(b>0)\n\t\tb--;}\n\t\t//printf(\"%d %d %d %d\\n\",a,b,k,m3);\t\n\t\tk++;\n\t}\n\tprintf(\"%d\",k-1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n<m||n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n }\n while(sumb>=suma)\n {\n suma=suma+2;\n if(suma>sumb)\n {\n suma=suma-2;\n break;\n }\n\n else\n sumb=sumb-6;\n }\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n j=sumb/6;\n while(suma>=sumb&&j>=0)\n {\n\n sumb=sumb+3;\n if(sumb>suma)\n {\n sumb=sumb-3;\n break;\n }\n else\n suma=suma-2;\n\n j--;\n }\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n }\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n<m||n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n // printf(\"%d= %d\\n\",i,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n //j=suma/6-1;\n while(sumb>=suma)\n {\n suma=suma+2;\n if(suma>sumb)\n {\n suma=suma-2;\n break;\n }\n\n else\n sumb=sumb-6;\n\n //j--;\n //printf(\"\\tsuma= %d\\tsumb=%d\\n\",suma,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n j=sumb/6;\n while(suma>=sumb&&j>=0)\n {\n\n sumb=sumb+3;\n if(sumb>suma)\n {\n sumb=sumb-3;\n break;\n }\n else\n suma=suma-2;\n\n j--;\n // printf(\"j= %d\\tsuma= %d\\tsumb=%d\\n\",j,suma,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n}\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int a,b,c,d,e,f;\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n if(a==b)\n {\n d=3*b;\n }\n if(b>a)\n {\n d=3*b;\n }\n if(a>b)\n {\n c=a-b;\n e=c/2;\n if(b-e>0)\n {\n d=(6*e)+(3*(b-e));\n if(c%2!=0)\n {if((a-(3*e))%2==0)\n d+=1;\n else\n d+=2;\n\n }\n }\n else\n {\n d=2*a;\n }\n }\n\n printf(\"%I64d\\n\",d);\n return 0;\n}\n"}, {"source_code": "/*\nBy Tianyi Chen\n*/\n#include<stdio.h>\nint n,m,ans;\nint main() {\n scanf(\"%d%d\",&n,&m);\n while(++ans)\n if(n+m<=ans/2+ans/3-ans/6)break;\n if(ans<2*n)ans=2*n;\n if(ans<3*m)ans=3*m;\n printf(\"%d\\n\",ans);\n}"}, {"source_code": "#include<stdio.h>\n\nint small(int,int);\nint big(int,int);\n\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint maxn=n*2;\n\tint maxm=m*3;\n\tint count=0;\n\t\n\twhile(small(maxn,maxm)/6-count)\n\t{\n\t\tif(maxn+2 < maxm+3)\n\t\t\tmaxn+=2;\n\t\telse\n\t\t\tmaxm+=3;\n\t\tcount++;\n\t}\n\n\tprintf(\"%d\\n\",big(maxn,maxm));\n\treturn 0;\n}\n\nint small(int a,int b)\n{\n\tif(a<b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\n\nint big(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nu max(u a,u b){return a>b?a:b;}\nu min(u a,u b){return a>b?b:a;}\nint main()\n{\n\tu w,x,y,z;\n\tscanf(\"%u%u\",&x,&y);\n\tx*=2;y*=3;\n\tfor(w=z=0;(w+=6)<=min(x,y);)\n\t{\n\t\tif(x+2>y+3)y+=3;\n\t\telse x+=2;\n\t}\n\tprintf(\"%u\\n\",max(x,y));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%i %i\",&n,&m);\n\n int hm = m*3,hn = n*2,count = 1,plus1 = 0,plus2 = 0;\n\n while(hn > 0 || hm > 0)\n {\n if(count%2 == 0 && count%3 == 0)\n {\n if(hm > hn)\n {\n hm-=3;\n }\n else\n {\n hn-=2;\n }\n }\n else if(count%2 == 0)\n {\n hn-=2;\n }\n else if(count%3 == 0)\n {\n hm-=3;\n }\n count++;\n }\n\n printf(\"%i\",count-1);\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef long long int LL;\n\n#define din(n) scanf(\"%d\",&n)\n#define dout(n) printf(\"%d\\n\",n)\n#define llin(n) scanf(\"%lld\",&n)\n#define llout(n) printf(\"%lld\\n\",n)\n#define strin(n) scanf(\" %s\",n)\n#define strout(n) printf(\"%s\\n\",n)\n#define power(a, b) po(a, b)\n\nint mod=1000000007;\n\nlong long po(long long x, long long y)\n{\n\tlong long pro=1;\n\twhile(y>0)\n\t{\n\t\tif(y&1 != 0)\n\t\t\tpro=((pro%mod)*(x%mod))%mod;\n\t\tx=(x*x)%mod;\n\t\ty=y>>1;\n\t}\n\treturn pro%mod;\n}\n\nint main(void)\n{\n\tlong long two,three;\n\tlong long i;\n\n\tllin(two);\n\tllin(three);\n\n\t// NEWER VERSION\n\tfor(i=2;;i++)\n\t{\n\t\tif(i%6==0)\n\t\t{\n\t\t\tif(three == 0)\n\t\t\t\ttwo--;\n\t\t\telse if(two == 0)\n\t\t\t\tthree--;\n\t\t\telse if(two > 0 && three > 0)\n\t\t\t{\n\t\t\t\tif(two > three)\n\t\t\t\t\ttwo--;\n\t\t\t\telse\n\t\t\t\t\tthree--;\n\t\t\t}\n\t\t}\n\t\telse if(i%2 == 0 && two > 0)\n\t\t\ttwo--;\n\t\telse if(i%3 == 0 && three > 0)\n\t\t\tthree--;\n\n\t\tif(two==0 && three==0)\n\t\t\tbreak;\n\t}\n\tllout(i);\n\treturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar vet[210];\n\nint max (int a, int b, int res) {\n\tif (res > a && res > b)\n\t\treturn res;\n\treturn a > b ? a : b;\n\t\n}\n\nint main () {\n\t\n\tint n, m;\n\tint i, k;\n\tint res = 0;\n\t\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tfor (i = 2, k = 3; n > 0 || m > 0;) {\n\t\t\n\t\tif (!n)\n\t\t\ti = -1;\n\t\tif (!m)\n\t\t\tk = -1;\n\t\t\n\t\twhile (i + 2 <= k && n) {\n\t\t\tif (n)\n\t\t\t\tn--;\n\t\t\t\n\t\t\tres = max(i, k, res);\n\t\t\tif (!n)\n\t\t\t\ti = -1;\n\t\t\tif (i)\n\t\t\t\ti += 2;\n\t\t}\n\t\t\n\t\tif (i != k) {\n\t\t\tif (n)\n\t\t\t\tn--;\n\t\t\tif (m)\n\t\t\t\tm--;\n\t\t\t\n\t\t\tres = max(i, k, res);\n\t\t\tif (!n)\n\t\t\t\ti = -1;\n\t\t\tif (!m)\n\t\t\t\tk = -1;\n\t\t\tif (i)\n\t\t\t\ti += 2;\n\t\t\tif (k)\n\t\t\t\tk += 3;\n\t\t} else {\n\t\t\tif (2 * n <= 3 * m) {\n\t\t\t\tif (m)\n\t\t\t\t\tm--;\n\t\t\t\t\n\t\t\t\tres = max(i, k, res);\n\t\t\t\tif (!m)\n\t\t\t\t\tk = -1;\n\t\t\t\tif (k)\n\t\t\t\t\tk += 3;\n\t\t\t\tif (i)\n\t\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tif (n)\n\t\t\t\t\tn--;\n\t\t\t\t\n\t\t\t\tres = max(i, k, res);\n\t\t\t\tif (!n)\n\t\t\t\t\ti = -1;\n\t\t\t\tif (i)\n\t\t\t\t\ti += 2;\n\t\t\t\tif (k)\n\t\t\t\t\tk += 3;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\", res);\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "\n#include<stdio.h>\nint a[10000000];\nint main()\n{\n\tint n,m,i,j,k,c=0;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;1==1;i++)\n\t{\n\t\tif(i%2==0 || i%3==0)\n\t\t{\n\t\t\tif(i/2>=n && i/3>=m && i/2+i/3-i/6>=n+m)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;;i++)\n\t{\n\t\tif(n<=i/2 && m<=i/3 && n+m<=i/2+i/3-i/6)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MAX 205\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long a, b;\n\nbool F(long long h){\n if ((a * 2) > h) return false;\n if ((b * 3) > h) return false;\n\n long long x = (h / 2) + (h / 3) - (h / 6);\n return (x >= (a + b));\n}\n\nint main(){\n int i, j, k;\n long long low, high, mid, res;\n\n while (scanf(\"%lld %lld\", &a, &b) != EOF){\n low = 2, high = 1LL << 60;\n while ((low + 1) < high){\n mid = (low + high) >> 1;\n if (F(mid)) high = mid;\n else low = mid;\n }\n\n if (F(low)) res = low;\n else res = high;\n printf(\"%lld\\n\", res);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MAX 205\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long a, b;\n\nbool F(long long h){\n if ((a * 2) > h) return false;\n if ((b * 3) > h) return false;\n\n long long x = (h / 2) + (h / 3) - (h / 6);\n return (x >= (a + b));\n}\n\nint main(){\n int i, j, k;\n long long low, high, mid, res;\n\n while (scanf(\"%lld %lld\", &a, &b) != EOF){\n low = 2, high = 1LL << 60;\n while ((low + 1) < high){\n mid = (low + high) >> 1;\n if (F(mid)) high = mid;\n else low = mid;\n }\n\n if (F(low)) res = low;\n else res = high;\n printf(\"%lld\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\tint n, m, i, comm,d2,d3;\n\tscanf(\"%d %d\",&n,&m);\n\ti=1;\n\tcomm=0;\n\twhile((n+m)>comm){\n\t\td2=1;d3=0;\n\t\tif(i&1)\n\t\t\td2=0;\n\t\tif((i/3)*3==i)\n\t\t\td3=1;\n\t\tif(d3 && d2)\n\t\t\tcomm++;\n\t\telse if(d2 && n)\n\t\t\tn--;\n\t\telse if(d3 && m)\n\t\t\tm--;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",i-1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N_MAX 1000000\n#define M_MAX 1000000\n\n\n\nint mod(int divisor, int dividend)\n{\n\tint remainder;\n\n\tif(dividend == 0)\n\t\treturn 0;\n\n\tremainder = divisor - (int)(divisor/dividend)*dividend;\n\n\treturn remainder;\n}\n\n\nint belongs_to_two(int i)\n{\n\tif(mod(i,2) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint belongs_to_three(int i)\n{\n\tif(mod(i,3) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\n\nint GetAnswer(int n, int m)\n{\n\tint i,j,k;\n\tint answer = 0;\n\tint b_two, b_three;\n\n\tk = 0;\n\ti = 1;\n\tj = 0;\n\n\twhile( n + m > 0 ){\n\t\t//printf(\"i = %d ... n = %d ... m = %d\\n\",i,n,m);\n\t\tb_two = belongs_to_two(i);\n\t\tb_three = belongs_to_three(i);\n\t\t//printf(\"b_two = %d ... b_three = %d\\n\",b_two,b_three);\n\t\tif((b_two == 1) && (b_three == 0)){\n\t\t\tif(n > 0){\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 0) && (b_three == 1)){\n\t\t\tif(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 1) && (b_three == 1)){\n\t\t\t// Reduce greater of n,m\n\t\t\tif((n > 0) && (m > 0)){\n\t\t\t\tif(n > m){\n\t\t\t\t\tn--;\n\t\t\t\t}\n\t\t\t\telse if(m > n){\n\t\t\t\t\tm--;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tm--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(n > 0){\n\t\t\t\tn--;\n\t\t\t}\n\t\t\telse if(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t\ti++;\n\n\t}\n\n\treturn i-1;\n}\n\n\nint main()\n{\n\tint n, m;\n\tint answer = 0;\n\n\t/* handle the program options */\n\t//freopen(\"C:/Users/Subh/Desktop/Work/Coding/C_code/test42.txt\",\"rt\",stdin);\n\n\tscanf(\"%d %d\",&n,&m);\n\n\t/* The code of your application goes here */\n\tanswer = GetAnswer(n, m);\n\n\tprintf(\"%d\\n\",answer);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n int n2, n3;\n\n int res = 0;\n\n scanf(\"%u%u\", &n2, &n3);\n\n while (n2 >= 2 && n3 >= 1) {\n --n2; --n2; --n3;\n res += 4;\n if (n2 > 0 && n3 > 0) {\n n2 >> 1 >= n3 ? --n2 : --n3;\n res += 2;\n } else {\n res += (n3 ? 3 * n3 - 1 : 2 * n2);\n n2 = n3 = 0;\n }\n }\n res += (n3 ? 3 * n3 : 2 * n2);\n\n printf(\"%d\", res);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int ans = 0;\n\n int temp;\n int cnt6, cnt3, slot;\n int top = 0;\n int i = 0;\n while (n > 0 || m > 0)\n {\n i++;\n switch (i%6) {\n case 0:\n if(m>0){\n if (n>m) n--;\n else m--;\n }\n else n--;\n break;\n case 2:\n n--;\n break;\n case 3:\n m--;\n break;\n case 4:\n n--;\n break;\n }\n }\n printf(\"%d\\n\", i);\n\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint fun(int a,int b)\n{\n if(a<b)\n return b;\n else \n return a;\n}\n\nint factors(int a)\n{\n return (a/2+a/3-a/6);\n}\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int x=2*n,y=3*m;\n int max=fun(x,y);\n int count=factors(max);\n while(count<n+m){\n if((max+1)%2==0||(max+1)%3==0)\n {\n count=factors(max+1);\n max++;\n }\n else\n {\n count=factors(max+2);\n max+=2;\n }\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,ans;\nint main() {\n scanf(\"%d%d\",&n,&m);\n while(++ans)\n if(n+m<=ans/2+ans/3-ans/6)break;\n if(ans<2*n)ans=2*n;\n if(ans<3*m)ans=3*m;\n printf(\"%d\\n\",ans);\n}"}, {"source_code": "#include<stdio.h>\n\n#define N 101\n\nint set1[10000001]={0};\nint set2[10000001]={0};\n\nint main()\n{\n\tint left, right, i, count = 1, check = 0;\n\t\n\t\n\tscanf(\"%d%d\", &left, &right);\n\n\tfor(i = 2; i <= 1e7; i+=2)\n\t\tset1[count++] = i;\t\t\n\tcount = 1;\n\tfor(i = 3; i <= 1e7; i+=3)\n\t\tset2[count++] = i;\n\t\n\tint temp, left_use = 0, right_use = 0;\n\t\n\tif((set1[left]/6) >= (set2[right]/6))\n\t\ttemp = set2[right]/6;\n\n\telse if((set1[left]/6) < (set2[right]/6))\n\t\ttemp = set1[left]/6;\n\t\n\tfor(i = 0; i < temp; i++)\n\t{\n\t\tif(set1[left+1] > set2[right+1])\n\t\t{\n\t\t\tright += 1;\n\t\t\tright_use = 1;\n\t\t}\t\n\t\telse if(set1[left+1] <= set2[right+1])\n\t\t{\n\t\t\tleft += 1;\n\t\t\tleft_use = 1;\n\t\t}\t\n\t\tif((left_use == 1) && (set1[left]%6 == 0))\n\t\t{\n\t\t\tif(set2[right] > set1[left])\n\t\t\t\ttemp++;\n\t\t\t\t\n\t\t\tleft_use = 0;\n\t\t}\t\n\t\telse if((right_use == 1) && (set2[right]%6 == 0))\n\t\t{\n\t\t\tif(set1[left] > set2[right])\n\t\t\t\ttemp++; \n\t\t\t\t\n\t\t\tright_use = 0;\n\t\t}\n\t\tif(set1[left] == set2[right])\n\t\t\ttemp++;\t\n\t}\n\tif(set1[left] > set2[right])\n\t\tprintf(\"%d\", set1[left]);\n\telse if(set1[left] < set2[right])\n\t\tprintf(\"%d\", set2[right]);\n\t\t\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tlong long n, m, hn, hm, tester = 6, r;\n\n\tscanf(\"%lld %lld\", &n, &m);\n\n\thn = 6 * ((n - 1)/ 2) + 2 + 2 * ((n - 1) % 2);\n\thm = 3 * (2 * m - 1);\n\n\twhile (tester < hn || tester < hm){\n\t\tif (hn > hm){\n\t\t\tr = (hn / 2) % 3;\n\n\t\t\tif (r == 1)\n\t\t\t\thn -= 4;\n\t\t\telse if (r == 2)\n\t\t\t\thn -= 2;\n\n\t\t\tif (tester > hn)\n\t\t\t\thn = tester;\n\t\t}\n\t\telse{\n\t\t\thm -= 6;\n\t\t\t\n\t\t\tif (tester > hm)\n\t\t\t\thm = tester;\n\t\t}\n\n\t\ttester += 6;\n\t}\n\n\tif (hn > hm)\n\t\tprintf(\"%lld\", hn);\n\telse\n\t\tprintf(\"%lld\", hm);\n\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint min(int x,int y)\n{\n\treturn x>y?y:x;\n}\n\nint max(int x,int y)\n{\n\treturn x>y?x:y;\n}\n\nint main()\n{\n\tint n,m;\n\tint i,k,delay;\n\twhile( (scanf(\"%d %d\",&n,&m)) == 2)\n\t{\n\t\tdelay=0;\n\t\tk=min(2*n,3*m);\n\t\tfor(i=6; i<=k; i+=6)\n\t\t\tif(k >= i) delay++;\n\t\tif(delay==0) printf(\"%d\\n\",max(2*n,3*m));\n\t\telse printf(\"%d\\n\",min(2*n+2,3*m+3));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n,m;\n\nint check(int a)\n{\n\tif((a/2<n) || (a/3<m) || (a/2+a/3-a/6<m+n))\n\treturn 0;\n\treturn 1;\n}\n\nint main()\n{\n\tint l=0,r=1000000,mid;\n\twhile(scanf(\"%d%d\",&n,&m)!=EOF)\n\t{\n\t\tl=0; r=1000000;\n\t\twhile(l+1<r)\n\t\t{\n\t\t\tmid=(l+r)/2;\n\t\t\tif(check(mid)==1)\n\t\t\t{\n\t\t\t\tr=mid;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tl=mid;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",r);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int a,int b)\n{\n\tif(a<b)\n\treturn a;\n\treturn b;\n}\nint max(int a,int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint main()\n{\n\tint ans=0,a,b,k;\n\tscanf(\"%d %d\",&a,&b);\n\tint c=a/3;\n\tint d=b/2;\n\tk=min(c,d);\n\tint ans1=a*2+k*2;\n\tint ans2=b*3+k*3;\n\tint ans3=max(ans1,b*3);\n\tint ans4=max(ans2,a*2);\n\tans=min(ans3,ans4);\n\tprintf(\"%d\",ans);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n\n if(m>n)\n printf(\"%d\",m*3);\n else\n printf(\"%d\",2*(n+m/2));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n<m||n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n // printf(\"%d= %d\\n\",i,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n while(sumb>=suma)\n {\n sumb=sumb-6;\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n while(suma>=sumb)\n {\n suma=suma-2;\n sumb=sumb+3;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n}\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,i,j,n,m;\n int suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n>m)\n r=n;\n else\n r=m;\n\n for(i=1;i<=r;i++)\n {\n if(i<=n)\n {\n suma=suma+2;\n if(suma==sumb)\n suma=suma+2;\n }\n\n if(i<=m)\n sumb=sumb+3;\n\n }\n\n if(suma>sumb)\n printf(\"%d\",suma);\n else\n printf(\"%d\",sumb);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n<m||n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n // printf(\"%d= %d\\n\",i,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n while(sumb>=suma)\n {\n sumb=sumb-6;\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n j=sumb/6;\n while(suma>=sumb&&j>=0)\n {\n suma=suma-2;\n sumb=sumb+3;\n j--;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n}\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n<m||n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n // printf(\"%d= %d\\n\",i,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n //j=suma/6-1;\n while(sumb>=suma)\n {\n suma=suma+2;\n if(suma>sumb)\n {\n suma=suma-2;\n break;\n }\n\n else\n sumb=sumb-6;\n\n //j--;\n //printf(\"\\tsuma= %d\\tsumb=%d\\n\",suma,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n j=sumb/6;\n while(suma>=sumb&&j>=0)\n {\n\n sumb=sumb+3;\n if(sumb>suma)\n {\n sumb=sumb-3;\n break;\n }\n else\n suma=suma-2;\n\n j--;\n // printf(\"j= %d\\tsuma= %d\\tsumb=%d\\n\",j,suma,sumb);\n }\n printf(\"%d\\n\",suma);\n printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n}\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint max(int a,int b);\nint main()\n{\n int r,i,j,n,m;\n int s,s1,s2,suma=0,sumb=0;\n scanf(\"%d %d\",&n,&m);\n\n if(n==0)\n printf(\"%d\",m*3);\n else if(m==0)\n printf(\"%d\",n*2);\n else\n {\n\n\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n }\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n if(sumb%2==0)\n sumb=sumb+3;\n // printf(\"%d= %d\\n\",i,sumb);\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n while(sumb>=suma)\n {\n sumb=sumb-6;\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s1=max(suma,sumb);\n suma=0;\n sumb=0;\n\n for(i=1;i<=m;i++)\n {\n sumb=sumb+3;\n }\n\n for(i=1;i<=n;i++)\n {\n suma=suma+2;\n if(suma%3==0)\n suma=suma+2;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n while(suma>=sumb)\n {\n suma=suma-2;\n sumb=sumb+3;\n }\n //printf(\"%d\\n\",suma);\n //printf(\"%d\\n\",sumb);\n s2=max(suma,sumb);\n\n s=min(s1,s2);\n printf(\"%d\\n\",s);\n}\n\n\n\n return 0;\n}\n\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\n\nint max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int a,b,c,d,e,f;\n scanf(\"%I64d\",&a);\n scanf(\"%I64d\",&b);\n if(a==b)\n {\n d=3*b;\n }\n if(b>a)\n {\n d=3*b;\n }\n if(a>b)\n {\n c=a-b;\n e=c/2;\n if(b-e>0)\n {\n d=(6*e)+(3*(b-e));\n if(c%2!=0)\n {if((a-(3*e))%2==0)\n d+=2;\n else\n d+=1;\n\n }\n }\n else\n {\n d=2*a;\n }\n }\n\n printf(\"%I64d\\n\",d);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint max=m*3;\n\tint count;\n\tif(max>n*2)\n\t\tcount=(n*2)/6;\n\telse\n\t\tcount=max/6;\n\n\tif((n+count)*2>max)\n\t\tmax=(n+count)*2;\n\t\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef long long int LL;\n\n#define din(n) scanf(\"%d\",&n)\n#define dout(n) printf(\"%d\\n\",n)\n#define llin(n) scanf(\"%lld\",&n)\n#define llout(n) printf(\"%lld\\n\",n)\n#define strin(n) scanf(\" %s\",n)\n#define strout(n) printf(\"%s\\n\",n)\n#define power(a, b) po(a, b)\n\nint mod=1000000007;\n\nlong long po(long long x, long long y)\n{\n\tlong long pro=1;\n\twhile(y>0)\n\t{\n\t\tif(y&1 != 0)\n\t\t\tpro=((pro%mod)*(x%mod))%mod;\n\t\tx=(x*x)%mod;\n\t\ty=y>>1;\n\t}\n\treturn pro%mod;\n}\n\nint main(void)\n{\n\tlong long two,three;\n\tlong long i;\n\n\tllin(two);\n\tllin(three);\n\n\t// NEWER VERSION\n\tfor(i=2;;i++)\n\t{\n\t\tif(i%6==0)\n\t\t{\n\t\t\tif(three == 0)\n\t\t\t\ttwo--;\n\t\t\telse if(two == 0)\n\t\t\t\tthree--;\n\t\t\telse if(two > 0 && three > 0)\n\t\t\t{\n\t\t\t\tif(two >= three)\n\t\t\t\t\tthree--;\n\t\t\t\telse\n\t\t\t\t\ttwo--;\n\t\t\t}\n\t\t}\n\t\telse if(i%2 == 0 && two > 0)\n\t\t\ttwo--;\n\t\telse if(i%3 == 0 && three > 0)\n\t\t\tthree--;\n\n\t\tif(two==0 && three==0)\n\t\t\tbreak;\n\t}\n\tllout(i);\n\treturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef long long int LL;\n\n#define din(n) scanf(\"%d\",&n)\n#define dout(n) printf(\"%d\\n\",n)\n#define llin(n) scanf(\"%lld\",&n)\n#define llout(n) printf(\"%lld\\n\",n)\n#define strin(n) scanf(\" %s\",n)\n#define strout(n) printf(\"%s\\n\",n)\n#define power(a, b) po(a, b)\n\nint mod=1000000007;\n\nlong long po(long long x, long long y)\n{\n\tlong long pro=1;\n\twhile(y>0)\n\t{\n\t\tif(y&1 != 0)\n\t\t\tpro=((pro%mod)*(x%mod))%mod;\n\t\tx=(x*x)%mod;\n\t\ty=y>>1;\n\t}\n\treturn pro%mod;\n}\n\nint main(void)\n{\n\tlong long two,three;\n\tllin(two);\n\tllin(three);\n\tlong long i=1;\n\tlong long c2=0;\n\tlong long c3=0;\n\twhile(c2<two)\n\t{\n\t\tif(i%2==0 && i%3!=0)\n\t\t\tc2++;\n\t\telse if(i%3==0 && i%2!=0 && c3<three)\n\t\t\tc3++;\n\t\telse if(i%3==0 && i%2==0 && c2<two)\n\t\t\tc2++;\n\t\ti++;\n\t}\n\twhile(c3<three)\n\t{\n\t\tif(i%3==0)\n\t\t\tc3++;\n\t\ti++;\n\t}\n\tlong long ans1=i-1;\n\ti=1;\n\tc2=0;\n\tc3=0;\n\twhile(c3<three)\n\t{\n\t\tif(i%2==0 && i%3!=0 && c2<two)\n\t\t\tc2++;\n\t\telse if(i%3==0 && i%2!=0 && c3<three)\n\t\t\tc3++;\n\t\telse if(i%3==0 && i%2==0 && c3<three)\n\t\t\tc3++;\n\t\ti++;\n\t}\n\twhile(c2<two)\n\t{\n\t\tif(i%2==0)\n\t\t\tc2++;\n\t\ti++;\n\t}\n\tlong long ans2=i-1;\n\tif(ans1>ans2)\n\t\tprintf(\"%lld\\n\", ans2);\n\telse\n\t\tprintf(\"%lld\\n\", ans1);\n\treturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef long long int LL;\n\n#define din(n) scanf(\"%d\",&n)\n#define dout(n) printf(\"%d\\n\",n)\n#define llin(n) scanf(\"%lld\",&n)\n#define llout(n) printf(\"%lld\\n\",n)\n#define strin(n) scanf(\" %s\",n)\n#define strout(n) printf(\"%s\\n\",n)\n#define power(a, b) po(a, b)\n\nint mod=1000000007;\n\nlong long po(long long x, long long y)\n{\n\tlong long pro=1;\n\twhile(y>0)\n\t{\n\t\tif(y&1 != 0)\n\t\t\tpro=((pro%mod)*(x%mod))%mod;\n\t\tx=(x*x)%mod;\n\t\ty=y>>1;\n\t}\n\treturn pro%mod;\n}\n\nint main(void)\n{\n\tlong long two,three;\n\tllin(two);\n\tllin(three);\n\tlong long i=1;\n\tlong long c2=0;\n\tlong long c3=0;\n\twhile(c2<two)\n\t{\n\t\tif(i%2==0 && i%3!=0 && c2<two)\n\t\t\tc2++;\n\t\telse if(i%3==0 && i%2!=0 && c3<three)\n\t\t\tc3++;\n\t\telse if(i%3==0 && i%2==0)\n\t\t{\n\t\t\tif(c2<two)\n\t\t\t\tc2++;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\twhile(c3<three)\n\t{\n\t\tif(i%3==0)\n\t\t\tc3++;\n\t\ti++;\n\t}\n\tlong long ans1=i-1;\n\ti=1;\n\tc2=0;\n\tc3=0;\n\twhile(c3<three)\n\t{\n\t\tif(i%2==0 && i%3!=0 && c2<two)\n\t\t\tc2++;\n\t\telse if(i%3==0 && i%2!=0 && c3<three)\n\t\t\tc3++;\n\t\telse if(i%3==0 && i%2==0)\n\t\t{\n\t\t\tif(c3<three)\n\t\t\t\tc3++;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\twhile(c2<two)\n\t{\n\t\tif(i%2==0)\n\t\t\tc2++;\n\t\ti++;\n\t}\n\tlong long ans2=i-1;\n\tif(ans1>ans2)\n\t\tprintf(\"%lld\\n\", ans2);\n\telse\n\t\tprintf(\"%lld\\n\", ans1);\n\treturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar vet[210];\n\nint max (int a, int b, int res) {\n\tif (res > a && res > b)\n\t\treturn res;\n\treturn a > b ? a : b;\n\t\n}\n\nint main () {\n\t\n\tint n, m;\n\tint i, k;\n\tint res = 0;\n\t\n\tscanf(\"%d %d\", &n, &m);\n\t\n\tfor (i = 2, k = 3; n > 0 || m > 0;) {\n\t\t\n\t\twhile (i + 2 <= k && n) {\n\t\t\tif (n)\n\t\t\t\tn--;\n\t\t\t\n\t\t\tres = max(i, k, res);\n\t\t\tif (!n)\n\t\t\t\ti = -1;\n\t\t\tif (i)\n\t\t\t\ti += 2;\n\t\t}\n\t\t\n\t\tif (i != k) {\n\t\t\tif (n)\n\t\t\t\tn--;\n\t\t\tif (m)\n\t\t\t\tm--;\n\t\t\t\n\t\t\tres = max(i, k, res);\n\t\t\tif (!n)\n\t\t\t\ti = -1;\n\t\t\tif (!m)\n\t\t\t\tk = -1;\n\t\t\tif (i)\n\t\t\t\ti += 2;\n\t\t\tif (k)\n\t\t\t\tk += 3;\n\t\t} else {\n\t\t\tif (2 * n <= 3 * m) {\n\t\t\t\tif (m)\n\t\t\t\t\tm--;\n\t\t\t\t\n\t\t\t\tres = max(i, k, res);\n\t\t\t\tif (!m)\n\t\t\t\t\tk = -1;\n\t\t\t\tif (k)\n\t\t\t\t\tk += 3;\n\t\t\t\tif (i)\n\t\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tif (n)\n\t\t\t\t\tn--;\n\t\t\t\t\n\t\t\t\tres = max(i, k, res);\n\t\t\t\tif (!n)\n\t\t\t\t\ti = -1;\n\t\t\t\tif (i)\n\t\t\t\t\ti += 2;\n\t\t\t\tif (k)\n\t\t\t\t\tk += 3;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\", res);\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint ans=0,n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tif(2*n==3*m)\n\t\tans=2*n+2*((2*n)/6);\n\telse if(2*n>3*m)\n\t\tans=2*n;\n\telse if(3*m>2*n)\n\t\tans=3*m;\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b)\n{\n\treturn a<b?a:b;\n}\nint max(int a,int b)\n{\n\treturn a>b?a:b;\n}\nint main()\n{\n\tint i,max_h3,max_h2,clashes,ans=0,n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tmax_h3=3*m;\n\tmax_h2=2*n;\n\tif(2*n>3*m)\n\t{\n\t\tclashes=(3*m)/6;\n\t\tfor(i=1;i<=clashes;i++)\n\t\t{\n\t\t\tif(max_h3<max_h2)\n\t\t\t\tmax_h3+=3;\n\t\t\telse\n\t\t\t\tmax_h2+=2;\n\t\t}\n\t\tans=max(max_h3,max_h2);\n\t}\n\telse\n\t{\n\t\tclashes=(2*n)/6;\n\t\tfor(i=1;i<=clashes;i++)\n {\n if(max_h3<max_h2)\n max_h3+=3;\n else\n max_h2+=2;\n }\n ans=max(max_h3,max_h2);\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N_MAX 1000000\n#define M_MAX 1000000\n\n\n\nint mod(int divisor, int dividend)\n{\n\tint remainder;\n\n\tif(dividend == 0)\n\t\treturn 0;\n\n\tremainder = divisor - (int)(divisor/dividend)*dividend;\n\n\treturn remainder;\n}\n\n\nint belongs_to_two(int i)\n{\n\tif(mod(i,2) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint belongs_to_three(int i)\n{\n\tif(mod(i,3) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\n\nint GetAnswer(int n, int m)\n{\n\tint i,j,k;\n\tint answer = 0;\n\tint b_two, b_three;\n\n\tk = 0;\n\ti = 1;\n\tj = 0;\n\n\twhile( n + m > 0 ){\n\t\tprintf(\"i = %d ... n = %d ... m = %d\\n\",i,n,m);\n\t\tb_two = belongs_to_two(i);\n\t\tb_three = belongs_to_three(i);\n\t\tprintf(\"b_two = %d ... b_three = %d\\n\",b_two,b_three);\n\t\tif((b_two == 1) && (b_three == 0)){\n\t\t\tif(n > 0){\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 0) && (b_three == 1)){\n\t\t\tif(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 1) && (b_three == 1)){\n\t\t\tif(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t\ti++;\n\n\t}\n\n\treturn i-1;\n}\n\n\nint main()\n{\n\tint n, m;\n\tint answer = 0;\n\n\t/* handle the program options */\n\t//freopen(\"C:/Users/Subh/Desktop/Work/Coding/C_code/test42.txt\",\"rt\",stdin);\n\n\tscanf(\"%d %d\",&n,&m);\n\n\t/* The code of your application goes here */\n\tanswer = GetAnswer(n, m);\n\n\tprintf(\"Answer: %d\\n\",answer);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N_MAX 1000000\n#define M_MAX 1000000\n\n\n\nint mod(int divisor, int dividend)\n{\n\tint remainder;\n\n\tif(dividend == 0)\n\t\treturn 0;\n\n\tremainder = divisor - (int)(divisor/dividend)*dividend;\n\n\treturn remainder;\n}\n\n\nint belongs_to_two(int i)\n{\n\tif(mod(i,2) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint belongs_to_three(int i)\n{\n\tif(mod(i,3) == 0)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\n\nint GetAnswer(int n, int m)\n{\n\tint i,j,k;\n\tint answer = 0;\n\tint b_two, b_three;\n\n\tk = 0;\n\ti = 1;\n\tj = 0;\n\n\twhile( n + m > 0 ){\n\t\t//printf(\"i = %d ... n = %d ... m = %d\\n\",i,n,m);\n\t\tb_two = belongs_to_two(i);\n\t\tb_three = belongs_to_three(i);\n\t\t//printf(\"b_two = %d ... b_three = %d\\n\",b_two,b_three);\n\t\tif((b_two == 1) && (b_three == 0)){\n\t\t\tif(n > 0){\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 0) && (b_three == 1)){\n\t\t\tif(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t}\n\t\tif((b_two == 1) && (b_three == 1)){\n\t\t\tif(m > 0){\n\t\t\t\tm--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tn--;\n\t\t\t}\n\t\t}\n\t\ti++;\n\n\t}\n\n\treturn i-1;\n}\n\n\nint main()\n{\n\tint n, m;\n\tint answer = 0;\n\n\t/* handle the program options */\n\t//freopen(\"C:/Users/Subh/Desktop/Work/Coding/C_code/test42.txt\",\"rt\",stdin);\n\n\tscanf(\"%d %d\",&n,&m);\n\n\t/* The code of your application goes here */\n\tanswer = GetAnswer(n, m);\n\n\tprintf(\"%d\\n\",answer);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n int n2, n3;\n\n int res = 0;\n\n scanf(\"%u%u\", &n2, &n3);\n\n while (n2 >= 2 && n3 >= 1) {\n --n2; --n2; --n3;\n res += 4;\n if (n2 > 0 && n3 > 0) {\n n2 >> 1 >= n3 ? --n2 : --n3;\n res += 2;\n }\n }\n res += (n3 ? 3 * n3 : 2 * n2);\n\n printf(\"%d\", res);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n int n2, n3;\n\n int res;\n\n scanf(\"%u%u\", &n2, &n3);\n\n res = n3 * 3;\n n2 -= n3;\n if (n2 > 0)\n res += n2 * 2;\n\n printf(\"%u\", res);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int ans = 0;\n\n int temp;\n int cnt6, cnt3, slot;\n int top = 0;\n while (n > 0 || m > 0)\n {\n if (n != 0) {\n temp = 2 * n;\n\n n = 0;\n if (m > 0) {\n cnt3 = (temp-top)/3;\n cnt6 = (temp - top)/6;\n\n //printf(\"cnt6 : %d\\n\", cnt6);\n if (m >= cnt3) {\n //printf(\"t1\\n\");\n n+=cnt6;\n m-=cnt3;\n top += cnt3*3;\n } else {\n //printf(\"t2\\n\");\n n += m;\n m = 0;\n top += m*3;\n }\n }\n ans+=temp;\n } else {\n //printf(\"%d %d %d\\n\", n, m, top);\n top+=m*3;\n m=0;\n\n }\n\n }\n if (top > ans) {\n printf(\"%d\\n\", top);\n } else\n printf(\"%d\\n\", ans);\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int ans = 0;\n\n int temp;\n int cnt6, cnt3, slot;\n int top = 0;\n int i = 0;\n \n while (n > 0 || m > 0)\n {\n i++;\n switch (i%6) {\n case 0:\n if(m>0 && m != 1) m--;\n else n--;\n break;\n case 2:\n n--;\n break;\n case 3:\n m--;\n break;\n case 4:\n n--;\n break;\n }\n }\n printf(\"%d\\n\", i);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int ans = 0;\n\n int temp;\n int cnt6, cnt3, slot;\n int top = 0;\n int i = 0;\n while (n > 0 || m > 0)\n {\n i++;\n switch (i%6) {\n case 0:\n if(m>0 && m != 1) m--;\n else n--;\n break;\n case 2:\n n--;\n break;\n case 3:\n m--;\n break;\n case 4:\n n--;\n break;\n }\n }\n printf(\"%d\\n\", i);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint fun(int a,int b)\n{\n if(a<b)\n return b;\n else \n return a;\n}\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i=1,j=1,max,h1,h2;\n int flag1=n,flag2=m;\n while(n>0||m>0)\n {\n if(n>0){\n h1=2*i;\n if((2*(i+1))%6==0&&i<=flag2)\n i+=2;\n else\n i++;\n n--;\n }\n if(m>0){\n h2=3*j;\n j++;\n m--;\n }\n if(flag1==0||i==flag1)\n max=h2;\n else if(flag2==0||j==flag2)\n max=h1;\n else \n max=fun(h1,h2);\n }\n printf(\"%d\",max);\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a, b, d, c, x;\n scanf(\"%d %d\", &a, &b);\n if (a > b) {\n\tc = a * 2;\n\tif (b != 0) {\n\t for (x = 0; x < a; x++) {\n\t\td = x * 3;\n\t\tif (d > c) {\n\t\t printf (\"%d\", d);\n\t \t break;\n\t\t}\n\t }\n\t if (d < c) \n\t\tprintf (\"%d\", c);\n\t if (d = c)\n\t\tprintf (\"%d\", c+2);\n\t} else {\n\t printf (\"%d\", c);\n\t}\n } else if (b > a) {\n\td = b * 3;\n\tif (a != 0) {\n\t for (x = 0; x < b; x++) {\n\t\tc = x * 2;\n\t\tif (c > d) {\n\t\t printf (\"%d\", c);\n\t\t}\n\t }\n\t if (c < d)\n\t\tprintf (\"%d\", d);\n\t} else {\n\t printf (\"%d\", d);\n\t}\n } else \n\tprintf (\"%d\", b*3);\n return 0;\n} \n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a, b, d, c, x;\n scanf(\"%d %d\", &a, &b);\n if (a > b) {\n\tc = a * 2;\n\tif (b != 0) {\n\t for (x = 0; x < a; x++) {\n\t\td = x * 3;\n\t\tif (d > c) {\n\t\t printf (\"%d\", d);\n\t \t break;\n\t\t}\n\t }\n\t if (d < c) \n\t\tprintf (\"%d\", c);\n\t if (d == c) {\n\t\tprintf (\"%d\", c+2);\n\t }\n\t} else {\n\t printf (\"%d\", c);\n\t}\n } else if (b > a) {\n\td = b * 3;\n\tif (a != 0) {\n\t for (x = 0; x < b; x++) {\n\t\tc = x * 2;\n\t\tif (c > d) {\n\t\t printf (\"%d\", c);\n\t\t}\n\t }\n\t if (c < d)\n\t\tprintf (\"%d\", d);\n\t} else {\n\t printf (\"%d\", d);\n\t}\n } else \n\tprintf (\"%d\", b*3);\n return 0;\n} \n\t\n"}, {"source_code": "#include<stdio.h>\n\n#define N 101\n\nint set1[1000001]={0};\nint set2[1000001]={0};\n\nint main()\n{\n\tint left, right, i, count = 1, check = 0;\n\t\n\t\n\tscanf(\"%d%d\", &left, &right);\n\n\tfor(i = 2; i <= 2000000; i++)\n\t\tif(i%2 == 0)\n\t\t\tset1[count++] = i;\t\t\n\tcount = 1;\n\tfor(i = 3; i <= 3000000; i++)\n\t\tif(i%3 == 0)\n\t\t\tset2[count++] = i;\n\t\n\tint temp, left_use = 0, right_use = 0;\n\t\n\tif((set1[left]/6) >= (set2[right]/6))\n\t{\n\t\ttemp = set2[right]/6;\n\t\tcheck = 0;\n\t} \t\n\telse if((set1[left]/6) < (set2[right]/6))\n\t{\n\t\ttemp = set1[left]/6;\n\t\tcheck = 1;\n\t}\t\n\t\n\tfor(i = 0; i < temp; i++)\n\t{\n\t\tif(set1[left+1] >= set2[right+1])\n\t\t{\n\t\t\tright += 1;\n\t\t\tright_use = 1;\n\t\t}\t\n\t\telse if(set1[left+1] < set2[right+1])\n\t\t{\n\t\t\tleft += 1;\n\t\t\tleft_use = 1;\n\t\t}\t\n\t\tif((check == 1) && (left_use == 1))\n\t\t{\n\t\t\tif(set1[left]%6 == 0)\n\t\t\t\ttemp++;\n\t\t}\t\n\t\telse if((check == 0) && (right_use == 1))\n\t\t{\n\t\t\tif(set2[right]%6 == 0)\n\t\t\t\ttemp++; \n\t\t}\t\n\t}\n\tif(set1[left] > set2[right])\n\t\tprintf(\"%d\", set1[left]);\n\telse if(set1[left] < set2[right])\n\t\tprintf(\"%d\", set2[right]);\n\t\t\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define N 101\n\nint set1[1000001]={0};\nint set2[1000001]={0};\n\nint main()\n{\n\tint left, right, i, count = 1, check = 0;\n\t\n\t\n\tscanf(\"%d%d\", &left, &right);\n\n\tfor(i = 2; i <= 2000000; i++)\n\t\tif(i%2 == 0)\n\t\t\tset1[count++] = i;\t\t\n\tcount = 1;\n\tfor(i = 3; i <= 3000000; i++)\n\t\tif(i%3 == 0)\n\t\t\tset2[count++] = i;\n\t\n\tint temp;\n\t\n\tif((set1[left]/6) >= (set2[right]/6))\n\t{\n\t\ttemp = set2[right]/6;\n\t\tcheck = 0;\n\t} \t\n\telse if((set1[left]/6) < (set2[right]/6))\n\t{\n\t\ttemp = set1[left]/6;\n\t\tcheck = 1;\n\t}\t\n\t\n\tfor(i = 0; i < temp; i++)\n\t{\n\t\tif(set1[left+1] >= set2[right+1])\n\t\t\tright += 1;\n\t\telse if(set1[left+1] < set2[right+1])\n\t\t\tleft += 1;\n\t\tif(check == 1)\n\t\t{\n\t\t\tif(set1[left]%6 == 0)\n\t\t\t\ttemp++;\n\t\t}\t\n\t\telse if(check == 0)\n\t\t{\n\t\t\tif(set2[right]%6 == 0)\n\t\t\t\ttemp++; \n\t\t}\t\n\t}\n\tif(set1[left] > set2[right])\n\t\tprintf(\"%d\", set1[left]);\n\telse if(set1[left] < set2[right])\n\t\tprintf(\"%d\", set2[right]);\n\t\t\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tlong long n, m, hn, hm, tester = 6, r;\n\n\tscanf(\"%lld %lld\", &n, &m);\n\n\thn = 6 * ((n - 1)/ 2) + 2 + 2 * ((n - 1) % 2);\n\thm = 3 * (2 * m - 1);\n\n\twhile (tester < hn || tester < hm){\n\t\tprintf(\"%lld %lld\\n\", hn, hm);\n\n\t\tif (hn > hm){\n\t\t\tr = (hn / 2) % 3;\n\n\t\t\tif (r == 1)\n\t\t\t\thn -= 4;\n\t\t\telse if (r == 2)\n\t\t\t\thn -= 2;\n\n\t\t\tif (tester > hn)\n\t\t\t\thn = tester;\n\t\t}\n\t\telse{\n\t\t\thm -= 6;\n\t\t\t\n\t\t\tif (tester > hm)\n\t\t\t\thm = tester;\n\t\t}\n\n\t\ttester += 6;\n\t}\n\t\tprintf(\"%lld %lld\\n\", hn, hm);\n\n\tif (hn > hm)\n\t\tprintf(\"%lld\", hn);\n\telse\n\t\tprintf(\"%lld\", hm);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, m, hn, hm, tester = 6, r;\n\n\tscanf(\"%d %d\", &n, &m);\n\n\thn = 6 * ((n - 1)/ 2) + 2 + 2 * ((n - 1) % 2);\n\thm = 3 * (2 * m - 1);\n\n\twhile (tester < hn || tester < hm){\n\t\tif (hn > hm){\n\t\t\tr = (hn / 2) % 3;\n\n\t\t\tif (r == 1)\n\t\t\t\thn -= 4;\n\t\t\telse if (r == 2)\n\t\t\t\thn -= 6;\n\n\t\t\tif (tester > hn)\n\t\t\t\thn = tester;\n\t\t}\n\t\telse{\n\t\t\thm -= 6;\n\t\t\t\n\t\t\tif (tester > hm)\n\t\t\t\thm = tester;\n\t\t}\n\n\t\ttester += 6;\n\t}\n\n\tif (hn > hm)\n\t\tprintf(\"%d\", hn);\n\telse\n\t\tprintf(\"%d\", hm);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tlong long n, m, hn, hm, tester = 6, r;\n\n\tscanf(\"%lld %lld\", &n, &m);\n\n\thn = 6 * ((n - 1)/ 2) + 2 + 2 * ((n - 1) % 2);\n\thm = 3 * (2 * m - 1);\n\n\twhile (tester < hn || tester < hm){\n\t\tif (hn > hm){\n\t\t\tr = (hn / 2) % 3;\n\n\t\t\tif (r == 1)\n\t\t\t\thn -= 4;\n\t\t\telse if (r == 2)\n\t\t\t\thn -= 6;\n\n\t\t\tif (tester > hn)\n\t\t\t\thn = tester;\n\t\t}\n\t\telse{\n\t\t\thm -= 6;\n\t\t\t\n\t\t\tif (tester > hm)\n\t\t\t\thm = tester;\n\t\t}\n\n\t\ttester += 6;\n\t}\n\n\tif (hn > hm)\n\t\tprintf(\"%lld\", hn);\n\telse\n\t\tprintf(\"%lld\", hm);\n\n\treturn 0;\n}\n"}], "src_uid": "23f2c8cac07403899199abdcfd947a5a"} {"nl": {"description": "Nauuo is a girl who loves writing comments.One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes.It's known that there were $$$x$$$ persons who would upvote, $$$y$$$ persons who would downvote, and there were also another $$$z$$$ persons who would vote, but you don't know whether they would upvote or downvote. Note that each of the $$$x+y+z$$$ people would vote exactly one time.There are three different results: if there are more people upvote than downvote, the result will be \"+\"; if there are more people downvote than upvote, the result will be \"-\"; otherwise the result will be \"0\".Because of the $$$z$$$ unknown persons, the result may be uncertain (i.e. there are more than one possible results). More formally, the result is uncertain if and only if there exist two different situations of how the $$$z$$$ persons vote, that the results are different in the two situations.Tell Nauuo the result or report that the result is uncertain.", "input_spec": "The only line contains three integers $$$x$$$, $$$y$$$, $$$z$$$ ($$$0\\le x,y,z\\le100$$$), corresponding to the number of persons who would upvote, downvote or unknown.", "output_spec": "If there is only one possible result, print the result : \"+\", \"-\" or \"0\". Otherwise, print \"?\" to report that the result is uncertain.", "sample_inputs": ["3 7 0", "2 0 1", "1 1 0", "0 0 1"], "sample_outputs": ["-", "+", "0", "?"], "notes": "NoteIn the first example, Nauuo would definitely get three upvotes and seven downvotes, so the only possible result is \"-\".In the second example, no matter the person unknown downvotes or upvotes, Nauuo would get more upvotes than downvotes. So the only possible result is \"+\".In the third example, Nauuo would definitely get one upvote and one downvote, so the only possible result is \"0\".In the fourth example, if the only one person upvoted, the result would be \"+\", otherwise, the result would be \"-\". There are two possible results, so the result is uncertain."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n char ch;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(c>=a-b&&c>=b-a&&c!=0){\n ch='?';\n }else if(a>b){\n ch='+';\n }else if(b>a){\n ch='-';\n }else{\n ch='0';\n }\n printf(\"%c\",ch);\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n while(scanf(\"%d%d%d\",&x,&y,&z) !=EOF)\n {\n\n\n if(x>y)\n {\n if(x<=y+z)\n printf(\"?\\n\");\n else\n printf(\"+\\n\");\n }\n else if (y>x)\n {\n if(y<=x+z)\n printf(\"?\\n\");\n else\n printf(\"-\\n\");\n }\n else\n {\n if(z==0)\n printf(\"0\\n\");\n else\n printf(\"?\\n\");\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(c!=0){\n\tif(a>b&&c+b<a)\n\tprintf(\"+\\n\");\n\telse if(a<b&&a+c<b)\n\tprintf(\"-\\n\");\n\telse if(a==b&&a+c<b)\n\tprintf(\"0\\n\");\n\t\telse \n\tprintf(\"?\\n\");}\n\telse{\n\t\tif(a>b)\n\t\tprintf(\"+\\n\");\n\t\t\telse if(a<b)\n\t\tprintf(\"-\\n\");\n\t\telse\n\t\tprintf(\"0\");\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+z<x)\n {\n printf(\"+\");\n }\n else if(x<y && x+z<y)\n {\n printf(\"-\");\n }\n else if(x==0 && y==0 && z==0)\n {\n printf(\"0\");\n }\n else if(z>=y || z>=x)\n {\n printf(\"?\");\n\n }\n else if(x+z>y ||y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x, y, z;\n scanf(\"%d%d%d\",&x ,&y ,&z);\n if(x>y){\n if(y+z==x)\n printf(\"?\");\n else if(y+z>x)\n printf(\"?\");\n else //y+z<x\n printf(\"+\");\n }\n else if(x<y){\n if(x+z==y)\n printf(\"?\");\n else if(x+z>y)\n printf(\"?\");\n else //x+z<y\n printf(\"-\");\n }\n else{\n if(x+z==y) //z==0\n printf(\"0\");\n else\n printf(\"?\");\n }\n printf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int s;\n s=x-y;\n if((s-z)>0&&(s+z)>0)\n {\n printf(\"+\");\n }\n else if((s-z)<0&&(s+z)<0)\n {\n printf(\"-\");\n }\n else\n {\n if(z==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z==0&&x==y)\n printf(\"0\");\n else\n {\n if(x+y>z)\n {\n if(x>y+z)\n printf(\"+\");\n else if(x+z<y)\n printf(\"-\");\n else\n printf(\"?\");\n }\n else\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+z<x)\n {\n printf(\"+\");\n }\n else if(x<y && x+z<y)\n {\n printf(\"-\");\n }\n\n else if(x+z>y || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint upvote, downvote, unknown;\n\tscanf(\"%d %d %d\", &upvote, &downvote, &unknown);\n\tdownvote = 0 - downvote;\n\tint mean;\n\tmean = upvote + downvote;\n\tif (mean == 0 && unknown != 0)\n\t{\n\t printf(\"?\");\n\t return 0;\n\t}\n\tif (mean < 0)\n\t{\n\t mean = 0 - mean;\n\t if ( mean > unknown )\n\t {\n\t printf(\"-\");\n\t return 0;\n\t }\n\t else\n\t {\n\t printf(\"?\");\n\t return 0;\n\t }\n\t}\n\tif (mean > 0)\n\t{\n\t if ( mean > unknown )\n\t {\n\t printf(\"+\");\n\t return 0;\n\t }\n\t else\n\t {\n\t printf(\"?\");\n\t return 0;\n\t }\n\t}\n\tif (mean == 0 && unknown ==0)\n\t{\n\t printf(\"0\");\n\t return 0;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x==y && z==0)\n printf(\"0\");\n else if(x==y && z!=0)\n printf(\"?\");\n\n else if(x>y)\n {\n a=x-y;\n b=a-z;\n if(b>0)\n printf(\"+\");\n else\n printf(\"?\");\n }\n else if(y>x)\n {\n a=y-x;\n b=a-z;\n if(b>0)\n printf(\"-\");\n else\n printf(\"?\");\n }\n\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main(){\n int u, d, uk;\n scanf(\"%d %d %d\", &u, &d, &uk);\n if(u>d && (u-d)>uk){\n printf(\"+\");\n }\n else if(u>d && (u-d)<=uk){\n printf(\"?\");\n }\n else if(d>u && (d-u)>uk){\n printf(\"-\");\n }\n else if(d>u && (d-u)<=uk){\n printf(\"?\");\n }\n else if(d==u && uk==0){\n printf(\"0\");\n }\n else if(d==u && uk>0){\n printf(\"?\");\n }\n\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int x, y, z;\n scanf(\"%d %d %d\", &x, &y , &z);\n if(x - y < 0)\n if(z >= y - x)\n printf(\"?\");\n else\n printf(\"-\");\n else if(x - y > 0)\n if(z >= x - y)\n printf(\"?\");\n else\n printf(\"+\");\n else{\n if(z == 0 && x - y == 0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n return 0; \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+z<x)\n {\n printf(\"+\");\n }\n else if(x<y && x+z<y)\n {\n printf(\"-\");\n }\n else if(x==0 && y==0 && z==0)\n {\n printf(\"0\");\n }\n \n else if(x+z>y || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\nif(a>b)\n{\n\nif((c+b)>=a)\n printf(\"?\");\nelse\nprintf(\"+\");\n}\nelse if(b>a)\n{\nif((c+a)>=b)\n printf(\"?\");\nelse\nprintf(\"-\");\n}\nelse if(a==b)\n{\nif(a<c||a==c&&c!=0||a>c&&c!=0)\nprintf(\"?\");\nelse\nprintf(\"0\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y+z)\n {\n printf(\"+\");\n }\n else if(y>x+z)\n {\n printf(\"-\");\n }\n else if(x==y&&z==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int u,d,n,c;\n scanf(\"%d %d %d\",&u,&d,&n);\n\n c=u-d;\n\n if(c>0 && n<c )\n {\n printf(\"+\");\n }\n else if(c<0 && n<(-1*c))\n {\n printf(\"-\");\n }\n else if(c==0 && n==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n\n return 0;\n}\n\n"}, {"source_code": " #include<stdio.h>\n int main(){\n int u, d, uk;\n scanf(\"%d %d %d\", &u, &d, &uk);\n if(u>d && (u-d)>uk){\n printf(\"+\");\n }\n else if(u>d && (u-d)<=uk){\n printf(\"?\");\n }\n else if(d>u && (d-u)>uk){\n printf(\"-\");\n }\n else if(d>u && (d-u)<=uk){\n printf(\"?\");\n }\n else if(d==u && uk==0){\n printf(\"0\");\n }\n else if(d==u && uk>0){\n printf(\"?\");\n }\n\n }\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x==y && z)\n printf(\"?\\n\");\n else if(x==y && !z)\n printf(\"0\\n\");\n else\n {\n if(x-y-z>0)\n printf(\"+\\n\");\n else if(abs(x-y)<=z)\n printf(\"?\\n\");\n else\n printf(\"-\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z==0){\n if(x>y){printf(\"+\");}\n else if(y>x){printf(\"-\");}\n else{printf(\"0\");}\n }\n else if(z>0){\n\n if(z>=x&&z>=y){printf(\"?\");}\n else if(x>y){\n if((y+z)<x){printf(\"+\");}\n else{printf(\"?\");}\n }\n else if(y>x){\n if((x+z)<y){printf(\"-\");}\n else{printf(\"?\");}\n }\n else if(x==y){printf(\"?\");}\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int u,d,n,c;\n scanf(\"%d %d %d\",&u,&d,&n);\n\n c=u-d;\n\n if(c>0 && n<c )\n {\n printf(\"+\");\n }\n else if(c<0 && n<(-1*c))\n {\n printf(\"-\");\n }\n else if(c==0 && n==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int x,y,z;\n scanf(\"%ld%ld%ld\",&x,&y,&z);\n if(y>x+z)printf(\"-\");\n else if(x>y+z)printf(\"+\");\n else if(x==y&&z==0)printf(\"0\");\n else printf(\"?\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,z,d;\n char ch;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z==0&&x==y)\n {\n printf(\"0\");\n exit(0);\n }\n if(x>=y)\n {\n d=x-y;\n ch='+';\n }\n else\n {\n d=y-x;\n ch='-';\n }\n if(d>z)\n {\n printf(\"%c\",ch);\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x-y>z){\n printf(\"+\\n\");\n }\n\n else if(x==y && z!=0){\n printf(\"?\\n\");\n }\n\n else if(x>y && x-y<=z){\n printf(\"?\\n\");\n }\n else if(x<y && y-x>z){\n printf(\"-\\n\");\n }\n else if(x<y && y-x<=z){\n printf(\"?\\n\");\n }\n else if(x==y && z==0){\n printf(\"0\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>(y+z)){\n printf(\"+\");\n }\n else if((x+z)<y){\n printf(\"-\");\n }\n else if(x==y && z==0){\n printf(\"0\");\n }\n else{\n printf(\"?\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int x,y,z;\nscanf(\"%d %d %d\",&x,&y,&z);\nif(x>y || y>x ){\n if(x>(y+z)) printf(\"+\");\n else if(y>(x+z)) printf (\"-\");\n else if(x<=(y+z)||y<=(x+z)) printf(\"?\");\n}\nelse if(x==y && z!=0) printf(\"?\");\nelse if(x==y && z==0) printf(\"0\");\n/*if(x>y || y<x) {\n if(x>y && x>z && x>(y+z)) printf(\"+\");\nelse if(x<y && y>z && y>(x+z)) printf(\"-\");\nelse if(x<=(y+z) || y<=(x+z)) printf(\"?\");\nelse if(x==y && x>z) printf(\"0\");\nelse if(x==0 && y==0 & z==0) printf(\"0\");\n\n}\n else {\n if(x==y && x<z) printf(\"?\");\n else if(x<=(y+z) || y<=(x+z)) printf(\"?\");\nelse if(z>x && z>y) printf(\"?\");\n//else\nelse printf(\"?\");*/\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,p,q=0;\n scanf(\"%d %d %d\",&x,&y,&z);\n p=x-y;\n if(p>0)\n {\n q=p;\n }else if(p<0){\n q=-p;\n }\n if(p>0&&z<q)\n {\n printf(\"+\");\n }else if(p<0&&z<q){\n printf(\"-\");\n }else if(z==q&&z!=0){\n printf(\"?\");\n }else if(z==q&&z==0){\n printf(\"0\");\n }else{\n printf(\"?\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\n\nif(((a-b)>0) && (a-b)>c)\n{\n printf(\"+\");\n}\nelse if(((b-a)>0) && (b-a)>c)\n{\n printf(\"-\");\n}\nelse if(((a-b)==0) && c==0)\n{\n printf(\"0\");\n}\nelse if(a==0 && b==0 && c==0)\n{\n printf(\"0\");\n}\n\nelse\n printf(\"?\");\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if (a>b+c)\n {\n printf(\"+\");\n }\n else if (b>a+c)\n {\n printf(\"-\");\n }\n else if (a==b && c==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\n\tif(c==0)\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t\tif(a>b)\n\t\t{\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(a==b)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a>b&&(a-b)<=c)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a>b&&(a-b)>c)\n\t\t{\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t\tif(a<b&&(b-a)<=c)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a<b&&(b-a)>c)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y+z){\n printf(\"+\\n\");\n }\n else if(y>x+z){\n printf(\"-\\n\");\n }\n else if(x==y && z==0){\n printf(\"0\\n\");\n }\n else{\n printf(\"?\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c,i,j,k;\n\n scanf(\"%d%d%d\",&a,&b,&c);\n\n if(a==b)\n {\n if(c==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n }\n else if(a>b)\n {\n if(a<=(b+c))\n {\n printf(\"?\");\n }\n else\n {\n printf(\"+\");\n }\n }\n else\n {\n if(b<=(a+c))\n {\n printf(\"?\");\n }\n else\n {\n printf(\"-\");\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int sum=0;\n sum=x-y;\n if((sum+z==0 && z>0) || (sum==0 && z>0) || (sum==z && z>0) || (sum>0 && sum<z) || (sum<0 && sum+z>0))\n printf(\"?\");\n else if((sum<0) && (z+sum<0))\n printf(\"-\");\n else if((sum>0) && ((-z)+sum>0))\n printf(\"+\");\n else if(sum==0 && z==0)\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int x, y, z, d, j;\n char m;\n\n scanf(\"%d %d %d\", &x, &y, &z);\n\n if(x>=y)\n {\n d = x-y;\n }\n else if(x<y)\n {\n d = y-x;\n }\n\n if(d>z || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x==y && z)\n printf(\"?\\n\");\n else if(x==y && !z)\n printf(\"0\\n\");\n else\n {\n if(x-y-z>0)\n printf(\"+\\n\");\n else if(abs(x-y)<=z)\n printf(\"?\\n\");\n else\n printf(\"-\\n\");\n }\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int a,b,c,x1,x2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b)\n {\n x1=a-b;\n if(x1>c)\n {\n printf(\"+\");\n }\n if(x1<=c)\n {\n printf(\"?\");\n }\n }\n if(a<b)\n {\n x2=b-a;\n if(x2>c)\n {\n printf(\"-\");\n }\n if(x2<=c)\n {\n printf(\"?\");\n }\n }\n if(a-b==0 && c!=0)\n {\n printf(\"?\");\n }\n if(a-b==0 && c==0)\n {\n printf(\"0\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(abs(x-y)<=z&z!=0)\n\t{\n\t\tprintf(\"?\");\n\t\treturn 0;\n\t}\n\tif(z==0)\n\t{\n\t\tif(x>y)\n\t\t\tprintf(\"+\");\n\t\telse if(x<y)\n\t\t\tprintf(\"-\");\n\t\telse\n\t\t\tprintf(\"0\");\n\t}\n\telse if(z)\n\t{\n\t\tif(x==y&&x!=0&&y!=0)\n\t\t\tprintf(\"0\");\n\t\telse if(x==0&&y==0)\n\t\t\tprintf(\"?\");\n\t\telse if(x>y)\n\t\t\tprintf(\"+\");\n\t\telse if(x<y)\n\t\t\tprintf(\"-\");\n\t}\n\treturn 0;\n}"}, {"source_code": " #include<stdio.h>\n int main(){\n int u, d, uk;\n scanf(\"%d %d %d\", &u, &d, &uk);\n if(u>d && (u-d)>uk){\n printf(\"+\");\n }\n else if(u>d && (u-d)<=uk){\n printf(\"?\");\n }\n else if(d>u && (d-u)>uk){\n printf(\"-\");\n }\n else if(d>u && (d-u)<=uk){\n printf(\"?\");\n }\n else if(d==u && uk==0){\n printf(\"0\");\n }\n else if(d==u && uk>0){\n printf(\"?\");\n }\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\n\nif(((a-b)>0) && (a-b)>c)\n{\n printf(\"+\");\n}\nelse if(((b-a)>0) && (b-a)>c)\n{\n printf(\"-\");\n}\nelse if(((a-b)==0) && c==0)\n{\n printf(\"0\");\n}\nelse if(a==0 && b==0 && c==0)\n{\n printf(\"0\");\n}\n\nelse\n printf(\"?\");\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,d;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y)d=x-y;\n else if(x<y)d=y-x;\n if(x>y&&d>z)printf(\"+\");\n else if(y>x&&d>z)printf(\"-\");\n else if(x==y &&z==0)printf(\"0\");\n else if(d<=z)printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y&&x>=0&&z<=100)\n {\n if((x-y)>z)printf(\"+\\n\");\n if((x-y)<z)printf(\"?\\n\");\n if((x-y)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((x-y)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x<y&&x>=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((y-x)<z)printf(\"?\\n\");\n if((y-x)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((y-x)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x==y&&x>=0&&z<=100)\n\t{\n\t\tif(z!=0)printf(\"?\\n\");\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t\tprintf(\"?\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int s;\n s=x-y;\n if((s-z)>0&&(s+z)>0)\n {\n printf(\"+\");\n }\n else if((s-z)<0&&(s+z)<0)\n {\n printf(\"-\");\n }\n else\n {\n if(z==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint x,y,z;\n\tscanf(\"%d %d %d\",&x,&y,&z);\n\tif(x>y){\n\t\tif(z>x-y){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z==x-y){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z<x-y){\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t}\n\tif(x<y){\n\t\tif(z>y-x){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z==y-x){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z<y-x){\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\tif(x==y){\n\t\tif(z!=0){\n\t\t\tprintf(\"?\\n\");\n\t\t}else{\n\t\t\tif(z%2==0){\n\t\t\t\tprintf(\"0\\n\");\n\t\t\t}else{\n\t\t\t\tprintf(\"?\\n\");\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif((x>y) && (x-y)>z)\n\t\tprintf(\"+\");\n\telse if((x<y) && (y-x)>z)\n\t{\n\t\tprintf(\"-\");\n\t}\n\telse if((x==y)&&z==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse\n\t{\n\t\tprintf(\"?\");\n\t}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z,i,j,l;\n scanf(\"%d%d%d\",&x,&y,&z);\n l=x-y;\n if((l<0)&&(z==0))\n printf(\"-\\n\");\n else if((l==0)&&(z==0))\n printf(\"0\\n\");\n else if(l>z)\n printf(\"+\\n\");\n else if((y-x)>z)\n printf(\"-\\n\");\n else if((x-y)<=z)\n printf(\"?\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if (x+z>y && x>y+z)\n printf(\"+\");\n if (y+z>x && y>x+z)\n printf(\"-\");\n if (x==y && z==0)\n printf(\"0\");\n if (x+z>=y && y+z>=x &&z!=0)\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\tint x,y,z;\n\tscanf(\"%d %d %d\",&x,&y,&z);\n\tif(x>y){\n\t\tif(x-y>z)\n\t\tprintf(\"+\\n\");\n\t\telse if(x-y<=z)\n\t\tprintf(\"?\\n\");\n\t\t}\n\telse if(y>x){\n\t\tif(y-x>z)\n\t\tprintf(\"-\\n\");\n\t\telse if(y-x<=z)\n\t\tprintf(\"?\\n\");\n\t\t}\n\t\telse if(x==y){\n\t\t\tif(x-y==z)printf(\"0\\n\");\n\t\t\telse if(x-y<z)printf(\"?\\n\");\n\t\t\t}\n return 0;\n }\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x, y, z;\n scanf(\"%d %d %d\", &x, &y, &z);\n if( x - y > 0 && x - y > z)\n printf(\"+\");\n else if(x - y < 0 && y - x > z)\n printf(\"-\");\n else if(z == 0 && x - y == 0)\n printf(\"0\");\n else\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,d;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y)d=x-y;\n else if(x<y)d=y-x;\n if(x>y&&d>z)printf(\"+\");\n else if(y>x&&d>z)printf(\"-\");\n else if(x==y &&z==0)printf(\"0\");\n else if(d<=z)printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y)\n {\n int d=x-y;\n if(d>z)\n printf(\"+\");\n else if(d==z&&z==0)\n printf(\"0\");\n else if(d<=z)\n printf(\"?\");\n }\n else\n {\n int d=y-x;\n if(d>z)\n printf(\"-\");\n else if(d==z&&z==0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\n\tif(c==0)\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t\tif(a>b)\n\t\t{\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(a==b)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a>b&&(a-b)<=c)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a>b&&(a-b)>c)\n\t\t{\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t\tif(a<b&&(b-a)<=c)\n\t\t{\n\t\t\tprintf(\"?\\n\");\n\t\t}\n\t\tif(a<b&&(b-a)>c)\n\t\t{\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a>b)\n {\n if(a>b+c) printf(\"+\\n\");\n else if(a<=b+c) printf(\"?\\n\");\n\n\n }\n else if(a<b)\n {\n if(b>a+c) printf(\"-\\n\");\n else if(b<=a+c) printf(\"?\\n\");\n\n\n }\n else if(a==b)\n { if(a==c & a==0) printf(\"0\\n\");\n else if(a<=c) printf(\"?\\n\");\n else if(a+c>b) printf(\"?\\n\");\n else printf(\"0\\n\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n {\n if(a>b&&b+c<a)\n printf(\"+\\n\");\n else if(b>a&&a+c<b)\n printf(\"-\\n\");\n else if((a==b)>c)\n printf(\"0\");\n else\n printf(\"?\\n\");\n }\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int z,y,x,j;\n scanf(\"%d %d %d\",&x,&y,&z);\n\n if(x>y && x-y>z)\n printf(\"+\\n\");\n else if(y>x && y-x>z)\n printf(\"-\\n\");\n else if(x==y && z==0)\n printf(\"0\\n\");\n else if(x==0 && y==0 && z==0)\n printf(\"0\\n\");\n else\n printf(\"?\\n\");\n\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\nint x,y,z;\nscanf(\"%d%d%d\",&x,&y,&z);\nif(x>y&&x>y+z){\n\tprintf(\"+\\n\");\n}\nelse if(y>x&&y>x+z){\n\tprintf(\"-\\n\");\n}\nelse if(x==y&&z==0){\n\tprintf(\"0\\n\");\n}\nelse{\n\tprintf(\"?\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,r,c;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y+z)\n printf(\"+\");\n else if(y>x+z)\n printf(\"-\");\n else if(x==y && z==0)\n printf(\"0\");\n else if(x==y && z>0)\n printf(\"?\");\n else if(x<=y+z)\n printf(\"?\");\n else if(y<=x+z)\n printf(\"?\");\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a-b>0&&a-b>c)\n printf(\"+\\n\");\n else if(b-a>0&&b-a>c)\n printf(\"-\\n\");\nelse if(a-b==0&&c==0)\n printf(\"0\\n\");\nelse\n printf(\"?\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a-b>0&&a-b>c)\n printf(\"+\\n\");\n else if(b-a>0&&b-a>c)\n printf(\"-\\n\");\nelse if(a-b==0&&c==0)\n printf(\"0\\n\");\nelse\n printf(\"?\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if((x>y && z==0)||(x>y && x>y+z)){\n printf(\"+\");\n }\n else if((y>x && z==0)||(y>x && y>x+z)){\n printf(\"-\");\n }\n else if(x==y && z==0){\n printf(\"0\");\n }\n else{\n printf(\"?\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x==y && z==0)\n printf(\"0\");\n else if(x==y && z!=0)\n printf(\"?\");\n\n else if(x>y)\n {\n a=x-y;\n b=a-z;\n if(b>0)\n printf(\"+\");\n else\n printf(\"?\");\n }\n else if(y>x)\n {\n a=y-x;\n b=a-z;\n if(b>0)\n printf(\"-\");\n else\n printf(\"?\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(a>b&&(a-b>c))\n\t{\n\t\tprintf(\"+\\n\");\n\t}\n\telse if(a>b&&(a-b<=c))\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\telse if(b>a&&(b-a<=c))\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\telse if(b>a&&(b-a>c))\n\t{\n\t\tprintf(\"-\\n\");\n\t}\n\telse if(a==b&&c>0)\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\telse if(a==b&&c==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int x, y, z;\n scanf(\"%d %d %d\", &x, &y , &z);\n if(x - y < 0)\n if(z >= y - x)\n printf(\"?\");\n else\n printf(\"-\");\n else if(x - y > 0)\n if(z >= x - y)\n printf(\"?\");\n else\n printf(\"+\");\n else{\n if(z == 0 && x - y == 0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n return 0; \n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint x,y,z;\n\tscanf(\"%d %d %d\",&x,&y,&z);\n\tif(x>y){\n\t\tif(z>x-y){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z==x-y){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z<x-y){\n\t\t\tprintf(\"+\\n\");\n\t\t}\n\t}\n\tif(x<y){\n\t\tif(z>y-x){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z==y-x){\n\t\t\tprintf(\"?\\n\");\n\t\t}else if(z<y-x){\n\t\t\tprintf(\"-\\n\");\n\t\t}\n\t}\n\tif(x==y){\n\t\tif(z!=0){\n\t\t\tprintf(\"?\\n\");\n\t\t}else{\n\t\t\tif(z%2==0){\n\t\t\t\tprintf(\"0\\n\");\n\t\t\t}else{\n\t\t\t\tprintf(\"?\\n\");\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x>z && x>y+z && x!=y+z)\n {\n printf(\"+\");\n }\n else if(y>x && y>z && y>x+z && y!=x+z)\n {\n printf(\"-\");\n }\n else if(x==y && z==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long a,b,c,ans1,ans,k,m;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n ans=(m-a);\n k=a+c;\n m=b+c;\n ans1=(k-b);\n \n if(c==0&&a==b)printf(\"0\\n\");\n else if(a>m)printf(\"+\\n\");\n else if(b >k)printf(\"-\\n\");\n else printf(\"?\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define read_int(a) scanf(\"%d\",&a)\n#define read_float(a) scanf(\"%f\",&a)\n#define read_long(a) scanf(\"%I64d\",&a)\n\n#define print_int(a) printf(\"%d\",a)\n#define print_float(a) printf(\"%f\",a)\n#define print_long(a) printf(\"%I64d\",&a)\n\n#define min(a,b) a>b?b:a\n#define max(a,b) a>b?a:b\n\n#define endl printf(\"\\n\")\n\nint main() {\n\nint a,b,c;\nread_int(a);\nread_int(b);\nread_int(c);\n\nint m=a-b;\nint n=b-a;\n\nif(m>c)\n{\n printf(\"+\");\n}\nelse if(n>c)\n{\n printf(\"-\");\n}\nelse if((n==0||m==0) && c==0)\n{\n printf(\"0\");\n}\nelse if((n<=0||m<=0) && c!=0 || m==c||n==c)\n{\n printf(\"?\");\n}\nelse\n{\n printf(\"0\");\n}\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z,i,j,l;\n scanf(\"%d%d%d\",&x,&y,&z);\n l=x-y;\n if((l<0)&&(z==0))\n printf(\"-\\n\");\n else if((l==0)&&(z==0))\n printf(\"0\\n\");\n else if(l>z)\n printf(\"+\\n\");\n else if((y-x)>z)\n printf(\"-\\n\");\n else if((x-y)<=z)\n printf(\"?\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,z,d;\n char ch;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z==0&&x==y)\n {\n printf(\"0\");\n exit(0);\n }\n if(x>=y)\n {\n d=x-y;\n ch='+';\n }\n else\n {\n d=y-x;\n ch='-';\n }\n if(d>z)\n {\n printf(\"%c\",ch);\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int x, y, z, d, j;\n char m;\n\n scanf(\"%d %d %d\", &x, &y, &z);\n\n if(x>=y)\n {\n d = x-y;\n }\n else if(x<y)\n {\n d = y-x;\n }\n\n if(d>z || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y && y+z<x)\n {\n printf(\"+\");\n }\n else if(x<y && x+z<y)\n {\n printf(\"-\");\n }\n else if(x==0 && y==0 && z==0)\n {\n printf(\"0\");\n }\n \n else if(x+z>y || y+z>x)\n {\n printf(\"?\");\n }\n else\n printf(\"0\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int sum=0;\n sum=x-y;\n if((sum+z==0 && z>0) || (sum==0 && z>0) || (sum==z && z>0) || (sum>0 && sum<z) || (sum<0 && sum+z>0))\n printf(\"?\");\n else if((sum<0) && (z+sum<0))\n printf(\"-\");\n else if((sum>0) && ((-z)+sum>0))\n printf(\"+\");\n else if(sum==0 && z==0)\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int z,y,x,j;\n scanf(\"%d %d %d\",&x,&y,&z);\n \n if(x>y && x-y>z)\n printf(\"+\\n\"); \n else if(y>x && y-x>z)\n printf(\"-\\n\");\n else if(x==y && z==0)\n printf(\"0\\n\");\n else if(x==0 && y==0 && z==0)\n printf(\"0\\n\");\n else\n printf(\"?\\n\");\n\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int a,b,c,x1,x2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b)\n {\n x1=a-b;\n if(x1>c)\n {\n printf(\"+\");\n }\n if(x1<=c)\n {\n printf(\"?\");\n }\n }\n if(a<b)\n {\n x2=b-a;\n if(x2>c)\n {\n printf(\"-\");\n }\n if(x2<=c)\n {\n printf(\"?\");\n }\n }\n if(a-b==0 && c!=0)\n {\n printf(\"?\");\n }\n if(a-b==0 && c==0)\n {\n printf(\"0\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int x, y, z, d, j;\n char m;\n\n scanf(\"%d %d %d\", &x, &y, &z);\n\n if(x>=y)\n {\n d = x-y;\n }\n else if(x<y)\n {\n d = y-x;\n }\n\n if(d>z || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(abs(x-y)<=z&z!=0)\n\t{\n\t\tprintf(\"?\");\n\t\treturn 0;\n\t}\n\tif(z==0)\n\t{\n\t\tif(x>y)\n\t\t\tprintf(\"+\");\n\t\telse if(x<y)\n\t\t\tprintf(\"-\");\n\t\telse\n\t\t\tprintf(\"0\");\n\t}\n\telse if(z)\n\t{\n\t\tif(x==y&&x!=0&&y!=0)\n\t\t\tprintf(\"0\");\n\t\telse if(x==0&&y==0)\n\t\t\tprintf(\"?\");\n\t\telse if(x>y)\n\t\t\tprintf(\"+\");\n\t\telse if(x<y)\n\t\t\tprintf(\"-\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,d;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y)d=x-y;\n else if(x<y)d=y-x;\n if(x>y&&d>z)printf(\"+\");\n else if(y>x&&d>z)printf(\"-\");\n else if(x==y &&z==0)printf(\"0\");\n else if(d<=z)printf(\"?\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long a,b,c,ans1,ans,k,m;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n ans=(m-a);\n k=a+c;\n m=b+c;\n ans1=(k-b);\n \n if(c==0&&a==b)printf(\"0\\n\");\n else if(a>m)printf(\"+\\n\");\n else if(b >k)printf(\"-\\n\");\n else printf(\"?\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x, y, z;\n scanf(\"%d%d%d\",&x ,&y ,&z);\n if(x>y){\n if(y+z==x)\n printf(\"?\");\n else if(y+z>x)\n printf(\"?\");\n else //y+z<x\n printf(\"+\");\n }\n else if(x<y){\n if(x+z==y)\n printf(\"?\");\n else if(x+z>y)\n printf(\"?\");\n else //x+z<y\n printf(\"-\");\n }\n else{\n if(x+z==y) //z==0\n printf(\"0\");\n else\n printf(\"?\");\n }\n printf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y+z) {\n printf(\"+\");\n return 0;\n }\n if(x+z<y) {\n printf(\"-\");\n return 0;\n }\n if(x==y && x>0 && z>0)\n {\n printf(\"?\");\n return 0;\n }\n if(x==y && x!=0 && x>z) {\n printf(\"0\");\n return 0;\n }\n if(x==0 && x==y && x==z){\n printf(\"0\");\n return 0;\n }\n if(x==y && x>0 && z>0)\n {\n printf(\"?\");\n return 0;\n }\n else printf(\"?\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y)\n {\n int d=x-y;\n if(d>z)\n printf(\"+\");\n else if(d==z&&z==0)\n printf(\"0\");\n else if(d<=z)\n printf(\"?\");\n }\n else\n {\n int d=y-x;\n if(d>z)\n printf(\"-\");\n else if(d==z&&z==0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n char ch;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(c>=a-b&&c>=b-a&&c!=0){\n ch='?';\n }else if(a>b){\n ch='+';\n }else if(b>a){\n ch='-';\n }else{\n ch='0';\n }\n printf(\"%c\",ch);\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(z)\n {\n if(x+z>y&&y+z<x)\n printf(\"+\");\n else if (y+z>x&&x+z<y)\n printf(\"-\");\n else\n printf(\"?\");\n }\n else\n {\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"0\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>(y+z)){\n printf(\"+\");\n }\n else if((x+z)<y){\n printf(\"-\");\n }\n else if(x==y && z==0){\n printf(\"0\");\n }\n else{\n printf(\"?\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int x,y,z;\nscanf(\"%d %d %d\",&x,&y,&z);\nif(x>y || y>x ){\n if(x>(y+z)) printf(\"+\");\n else if(y>(x+z)) printf (\"-\");\n else if(x<=(y+z)||y<=(x+z)) printf(\"?\");\n}\nelse if(x==y && z!=0) printf(\"?\");\nelse if(x==y && z==0) printf(\"0\");\n/*if(x>y || y<x) {\n if(x>y && x>z && x>(y+z)) printf(\"+\");\nelse if(x<y && y>z && y>(x+z)) printf(\"-\");\nelse if(x<=(y+z) || y<=(x+z)) printf(\"?\");\nelse if(x==y && x>z) printf(\"0\");\nelse if(x==0 && y==0 & z==0) printf(\"0\");\n\n}\n else {\n if(x==y && x<z) printf(\"?\");\n else if(x<=(y+z) || y<=(x+z)) printf(\"?\");\nelse if(z>x && z>y) printf(\"?\");\n//else\nelse printf(\"?\");*/\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x==y && z==0)\n printf(\"0\");\n else if(x==y && z!=0)\n printf(\"?\");\n\n else if(x>y)\n {\n a=x-y;\n b=a-z;\n if(b>0)\n printf(\"+\");\n else\n printf(\"?\");\n }\n else if(y>x)\n {\n a=y-x;\n b=a-z;\n if(b>0)\n printf(\"-\");\n else\n printf(\"?\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c, z;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n }\n else\n {\n if(a>b)\n {\n z=a-b-c;\n if(z>0)\n {\n printf(\"+\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n if(c>(a-b))\n {\n printf(\"?\");\n\n }\n// else\n// {\n// if(z>0)\n// {\n// printf(\"+\");\n// }\n// else\n// {\n// printf(\"?\");\n// }\n// }\n }\n }\n if(a==b)\n {\n printf(\"?\");\n }\n if(a<b)\n {\n z=b-a-c;\n if(z>0)\n {\n printf(\"-\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n if(c>(b-a))\n {\n printf(\"?\");\n }\n else\n printf(\"+\");\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a-b>c){\n printf(\"+\\n\");\n }\n else if(b-a>c){\n printf(\"-\\n\");\n }\n else if(a==b&&c==0){\n printf(\"0\\n\");\n }\n else{\n printf(\"?\\n\");\n }\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int z,y,x,j;\n scanf(\"%d %d %d\",&x,&y,&z);\n\n if(x>y && x-y>z)\n printf(\"+\\n\");\n else if(y>x && y-x>z)\n printf(\"-\\n\");\n else if(x==y && z==0)\n printf(\"0\\n\");\n else if(x==0 && y==0 && z==0)\n printf(\"0\\n\");\n else\n printf(\"?\\n\");\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if (a>b+c)\n {\n printf(\"+\");\n }\n else if (b>a+c)\n {\n printf(\"-\");\n }\n else if (a==b && c==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x, y, z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x==0||y==0||z==0){\n if(x==0 && y>z){\n printf(\"-\");\n }\n\n else if(y==0 && x>z){\n printf(\"+\");\n\n }\n else if(z==0){\n if(y==x && x>0 && y>0){\n printf(\"0\");\n }\n else if(x>y){\n printf(\"+\");\n }\n else if(x<y){\n printf(\"-\");\n }\n else if(x==y){\n printf(\"0\");\n }\n }\n\n\n\n\n else{\n printf(\"?\");\n }\n\n\n }\n else if(x>y||y>x){\n if(y+z<x){\n printf(\"+\");\n }\n else if(x+z<y){\n printf(\"-\");\n }\n else{\n printf(\"?\");\n }\n\n }\n else{\n printf(\"?\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x==0||y==0||z==0)\n {\n if(x==0&&y>z)\n {\n printf(\"-\");\n }\n else if(y==0&&x>z)\n {\n printf(\"+\");\n }\n\n else if(z==0)\n {\n if(y==x&&x>0&&y>0)\n {\n printf(\"0\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x>y)\n {\n printf(\"+\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n {\n printf(\"?\");\n }\n\n }\n\n else if(x>y||y>x)\n {\n if(x>y+z)\n {\n printf(\"+\");\n }\n else if(y>x+z)\n {\n printf(\"-\");\n }\n else\n {\n printf(\"?\");\n }\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(c!=0 )\n {\n if((a+c)>=b && (b+c)>=a)\n {\n printf(\"?\");\n }\n else if((a+c)>b && (b+c)<a)\n {\n printf(\"+\");\n }\n else if((a+c)<b && (b+c)>a)\n {\n printf(\"-\");\n }\n }\n else \n { \n if(a>b)\n {\n printf(\"+\");\n }\n else if(a<b)\n {\n printf(\"-\");\n }\n else printf(\"0\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n int res;\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n scanf(\"%d\",&z);\n \n if(x>(y+z))\n printf(\"+\");\n else if (y>(x+z))\n printf(\"-\");\n \n \n else if(x+y==z)\n { if((y==0)&&(x>0)&&(z>0))\n printf(\"?\");\n else if((x=y=z==0))\n printf(\"0\");\n else\n printf(\"?\");\n \n }\n else if((x==y)&& (z==0))\n printf(\"%d\",z);\n else \n printf(\"?\");\n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z,i,j,l;\n scanf(\"%d%d%d\",&x,&y,&z);\n l=x-y;\n if((l<0)&&(z==0))\n printf(\"-\\n\");\n else if((l==0)&&(z==0))\n printf(\"0\\n\");\n else if(l>z)\n printf(\"+\\n\");\n else if((y-x)>z)\n printf(\"-\\n\");\n else if((x-y)<=z)\n printf(\"?\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\n\nif(((a-b)>0) && (a-b)>c)\n{\n printf(\"+\");\n}\nelse if(((b-a)>0) && (b-a)>c)\n{\n printf(\"-\");\n}\nelse if(((a-b)==0) && c==0)\n{\n printf(\"0\");\n}\nelse if(a==0 && b==0 && c==0)\n{\n printf(\"0\");\n}\n\nelse\n printf(\"?\");\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c, z;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n }\n else\n {\n if(a>b)\n {\n z=a-b-c;\n if(z>0)\n {\n printf(\"+\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n if(c>(a-b))\n {\n printf(\"?\");\n\n }\n// else\n// {\n// if(z>0)\n// {\n// printf(\"+\");\n// }\n// else\n// {\n// printf(\"?\");\n// }\n// }\n }\n }\n if(a==b)\n {\n printf(\"?\");\n }\n if(a<b)\n {\n z=b-a-c;\n if(z>0)\n {\n printf(\"-\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n if(c>(b-a))\n {\n printf(\"?\");\n }\n else\n printf(\"+\");\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y&&x>=0&&z<=100)\n {\n if((x-y)>z)printf(\"+\\n\");\n if((x-y)<z)printf(\"?\\n\");\n if((x-y)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((x-y)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x<y&&x>=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((y-x)<z)printf(\"?\\n\");\n if((y-x)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((y-x)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x==y&&x>=0&&z<=100)\n\t{\n\t\tif(z!=0)printf(\"?\\n\");\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t\tprintf(\"?\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,r,c;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y+z)\n printf(\"+\");\n else if(y>x+z)\n printf(\"-\");\n else if(x==y && z==0)\n printf(\"0\");\n else if(x==y && z>0)\n printf(\"?\");\n else if(x<=y+z)\n printf(\"?\");\n else if(y<=x+z)\n printf(\"?\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(((a>b)&&(a>b+c)))\n {\n printf(\"+\");\n return 0;\n }\n if((a<b)&&(b>a+c))\n {\n printf(\"-\");\n return 0;\n }\n if((a==b)&&(c==0))\n {\n printf(\"0\");\n return 0;\n }\n if(((a==b)||(a!=b))&&(c!=0))\n {\n printf(\"?\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,p,q=0;\n scanf(\"%d %d %d\",&x,&y,&z);\n p=x-y;\n if(p>0)\n {\n q=p;\n }else if(p<0){\n q=-p;\n }\n if(p>0&&z<q)\n {\n printf(\"+\");\n }else if(p<0&&z<q){\n printf(\"-\");\n }else if(z==q&&z!=0){\n printf(\"?\");\n }else if(z==q&&z==0){\n printf(\"0\");\n }else{\n printf(\"?\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,z,d;\n char ch;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z==0&&x==y)\n {\n printf(\"0\");\n exit(0);\n }\n if(x>=y)\n {\n d=x-y;\n ch='+';\n }\n else\n {\n d=y-x;\n ch='-';\n }\n if(d>z)\n {\n printf(\"%c\",ch);\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x-y>0&&x-y>z)\n printf(\"+\");\n else if(x-y<0&&x-y<z)\n printf(\"-\");\n else if(x==y&&z==0)\n printf(\"0\");\n else\n printf(\"?\");\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int x,y,z;\n scanf(\"%ld%ld%ld\",&x,&y,&z);\n if(y>x)printf(\"-\");\n else if(x>y)printf(\"+\");\n else if(x==0&&y==0)printf(\"?\");\n else if(x==y)printf(\"0\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c)!=EOF)\n\tif(a<b&&(b-a)>c)\n\t{\n\t\tprintf(\"-\\n\");\n\t}\n\telse if(a>b&&(a-b)>c)\n\t{\n\t\tprintf(\"+\\n\");\n\t}\n\telse if(a==b&&c==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(a==b||a>b&&(a-b)<c||a<b&&(b-a)<c)\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,z,d;\n scanf(\"%d %d %d\",&x,&y,&z);\n d=abs(x-y);\n if((x==0 && y==0))\n printf(\"?\\n\");\n //else if(d == z)\n //printf(\"?\\n\");\n else if(x==y && z==0)\n printf(\"0\\n\");\n else if(x==y)\n printf(\"?\\n\");\n else if(d == z)\n printf(\"?\\n\");\n else if(x<y && z<(y-x))\n printf(\"-\\n\");\n else\n printf(\"+\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y&&x>z&&x>(y+z)){printf(\"+\\n\");}\n if(x>y&&x>z&&x<=(y+z)){printf(\"?\\n\");}\n if(x>y&&x<=z){printf(\"?\\n\");}\n if(y>x&&y>z&&y>(x+z)){printf(\"-\\n\");}\n if(y>x&&y>z&&y<=(x+z)){printf(\"?\\n\");}\n\n if(y>x&&y<=z){printf(\"?\\n\");}\n if(x==y&&x>z){printf(\"0\\n\");}\n if(x>=1&&y>=1&&z>=1){if(x==y&&x<=z){printf(\"?\\n\");}}\n if(x==0&&y==0&&z==0){printf(\"0\\n\");}\n\n\n\n\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int sum=0;\n sum=x-y;\n if((sum+z==0 && z>0) || (sum==0 && z>0) || (sum==z && z>0) || (sum<z))\n printf(\"?\");\n else if((sum<0) && (z+sum<0))\n printf(\"-\");\n else if((sum>0) && ((-z)+sum>0))\n printf(\"+\");\n else if(sum==0 && z==0)\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n\n if(x==0 && y==0)\n printf(\"?\\n\");\n else if(x==y && z == 0)\n printf(\"0\\n\");\n else if(x<y && z<(y-x))\n printf(\"-\\n\");\n else\n printf(\"+\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c,i,j,k;\n\n scanf(\"%d%d%d\",&a,&b,&c);\n\n if(a<b)\n {\n printf(\"-\\n\");\n }\n else if(a>b)\n {\n printf(\"+\\n\");\n }\n else if(a==b && c==0)\n {\n printf(\"0\\n\");\n }\n else if(a==b && c>0)\n {\n printf(\"?\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\nint x,y,z;\nscanf(\"%d%d%d\",&x,&y,&z);\nif(x>y&&x>y+z){\n\tprintf(\"+\\n\");\n}\nelse if(y>x&&y>x+z){\n\tprintf(\"-\\n\");\n}\nelse if(x==y&&x!=0&&y!=0){\n\tprintf(\"0\\n\");\n}\nelse{\n\tprintf(\"?\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a>b&&c+b<a)\n\tprintf(\"+\\n\");\n\telse if(a<b&&a+c<b)\n\tprintf(\"-\\n\");\n\telse if(a==b&&a+c<b)\n\tprintf(\"0\\n\");\n\t\telse if(a==b&&a==c&&a==0)\n\tprintf(\"0\\n\");\n\t\telse \n\tprintf(\"?\\n\");\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x>y)&&(x>z))\n {\n if((y+z)<x){\n printf(\"+\");}\n else{\n printf(\"?\");}\n }\n else if((y>x)&&(y>z))\n {\n if((x+z)<y){\n printf(\"-\");}\n else{\n printf(\"?\");}\n\n }\n else if(((x==y)&&(x>z))||(x==y)&&(z==0))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(z>x||z>y||x==y+z||y==x+z)\n printf(\"?\");\n else if(x>y)\n printf(\"+\");\n else if(y>x)\n printf(\"-\");\n else if(x==y&&z==0)\n printf(\"0\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(z)\n {\n if(x+z==y||x==y+z||x+z==y+z)\n printf(\"?\");\n else if(x>y)\n printf(\"+\");\n else if(\"-\");\n else\n printf(\"0\");\n }\n else\n {\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"0\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x>y)&&(x>z))\n {\n if((y+z)<x){\n printf(\"+\");}\n else{\n printf(\"?\");}\n }\n else if((y>x)&&(y>z))\n {\n if((x+z)<y){\n printf(\"-\");}\n else{\n printf(\"?\");}\n\n }\n else if((x==y)&&(x>z))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#define read_int(a) scanf(\"%d\",&a)\n#define read_float(a) scanf(\"%f\",&a)\n#define read_long(a) scanf(\"%I64d\",&a)\n\n#define print_int(a) printf(\"%d\",a)\n#define print_float(a) printf(\"%f\",a)\n#define print_long(a) printf(\"%I64d\",&a)\n\n#define min(a,b) a>b?b:a\n#define max(a,b) a>b?a:b\n\n#define endl printf(\"\\n\")\n\nint main() {\n\nint a,b,c;\nread_int(a);\nread_int(b);\nread_int(c);\n\nint m=a-b;\nint n=b-a;\nif((m==0||n==0)&&c!=0)\n{\n printf(\"?\");\n return 0;\n}\n\nif(m>0)\n{\n if(m-c>0)\n {\n printf(\"+\");\n }\n else if(m-c <0)\n {\n printf(\"?\");\n }\n else\n {\n printf(\"0\");\n }\n}else if(n>0)\n{\n if(n-c>0)\n {\n printf(\"-\");\n }\n else if(n-c <0)\n {\n printf(\"?\");\n }\n else\n {\n printf(\"0\");\n }\n\n}\nelse\n{\n printf(\"0\");\n}\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x>y)&&(x>z))\n {\n printf(\"+\");\n }\n else if((y>x)&&(y>z))\n {\n printf(\"-\");\n }\n else if((x==y)&&(x>z))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b+c){\n printf(\"+\\n\");\n }\n else if(a+c<b){\n printf(\"-\\n\");\n }\n else if(a==b&&c==0){\n printf(\"0\\n\");\n }\n else if(a==0&&b==0&&c!=0){\n printf(\"?\\n\");\n }\n else if(a==b+c){\n printf(\"?\");\n }\n else if(a+c==b){\n printf(\"?\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(x==y && z==0)\n\tprintf(\"0\");\n\telse if((x==y) && (z!=x))\n\tprintf(\"?\");\n\telse if((x>y) && z==0)\n printf(\"+\");\n else if((x>y) && y!=0 && (x>=y+z))\n printf(\"?\");\n else if ((y>x)&& z==0)\n printf(\"-\");\n else if((y>x) && x!=0 && (y==x+z))\n printf(\"?\");\n else if(x>z && y==0)\n printf(\"+\");\n else if(y>z && x==0)\n printf(\"-\");\n else if(x==0 && y==0 && z!=0)\n printf(\"?\");\n else\n printf(\"?\");\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(x==y && z==0)\n\tprintf(\"0\");\n\telse if((x==y) && (z!=x))\n\tprintf(\"?\");\n\telse if((x>y) && z==0)\n printf(\"+\");\n else if((x>y) && y!=0 && (x>=y+z))\n printf(\"?\");\n else if ((y>x)&& z==0)\n printf(\"-\");\n else if((y>x) && x!=0 && (y==x+z))\n printf(\"?\");\n else if(x>z && y==0)\n printf(\"+\");\n else if(y>z && x==0)\n printf(\"-\");\n else if(x==0 && y==0 && z!=0)\n printf(\"?\");\n else\n printf(\"?\");\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d\",&x,&y,&z);\n\tif(x-y-z>0)\n\t\tprintf(\"+\");\n\telse if(y-x-z>0)\n\t\tprintf(\"-\");\n\telse if((x-y)==0 && z > 0)\n\t\tprintf(\"?\");\n\telse if((x-y)==0 && z == 0)\n\t\tprintf(\"0\");\n\telse\n\t\tprintf(\"?\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\nif(a>b)\n{\n\nif((c+b)>=a)\n printf(\"?\");\nelse\nprintf(\"+\");\n}\nelse if(b>a)\n{\nif((c+a)>=b)\n printf(\"?\");\nelse\nprintf(\"-\");\n}\nelse if(a==b)\n{\nif(a<c||a==c||a>c)\nprintf(\"?\");\nelse\nprintf(\"0\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int x,y,z;\n scanf(\"%d %d %d\", &x, &y, &z);\n\n if(x==y && z==0) printf(\"0\\n\");\n if(x==0 && y==0 && z != 0) printf(\"?\\n\");\n\n if(x<y){\n x = x+z;\n if(x<y) printf(\"-\\n\");\n else printf(\"?\\n\");\n }\n else if(x>y){\n y = y+z;\n if(y<x) printf(\"+\\n\");\n else printf(\"?\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y&&x>=0&&z<=100)\n {\n if((x-y)>z)printf(\"+\\n\");\n if((x-y)<z)printf(\"-\\n\");\n if((x-y)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((x-y)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x<y&&x>=0&&z<=100)\n {\n if((y-x)>z)printf(\"-\\n\");\n if((y-x)<z)printf(\"+\\n\");\n if((y-x)==z&&z!=0)printf(\"?\\n\");\n\t\telse if((y-x)==z&&z==0)\n\t\t\tprintf(\"0\\n\");\n }\n else if(x==y&&x>=0&&z<=100)\n\t{\n\t\tif(z!=0)printf(\"?\\n\");\n\t\telse\n\t\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t\tprintf(\"?\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int x,y,z;\nscanf(\"%d %d %d\",&x,&y,&z);\nif(x>y && x>z && x>(y+z)) printf(\"+\");\nelse if(x<y && y>z && y>(x+z)) printf(\"-\");\nelse if(z>x && z>y) printf(\"?\");\nelse if(x==y && x>z) printf(\"0\");\nelse if(x==y && x<=z) printf(\"0\");\nelse if(x<=(y+z) || y<=(x+z)) printf(\"?\");\n\nelse printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n \n if(a>b)\n {\n printf(\"+\");\n }\n else if(a<b)\n {\n printf(\"-\");\n }\n else if(a==b)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int x,y,z;\n scanf (\"%d %d %d\", &x,&y,&z);\n if (x==y && z==0) {\n printf (\"0\\n\");\n }\n if(z+x>y+z && z+y<x+z) {\n printf (\"+\\n\");\n }\n if(z+y>x+z && z+x<y+z) {\n printf (\"-\\n\");\n }\n if (z+y==x+z) {\n printf (\"?\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,m,n;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y||x==z&&y==z)\n {\n m=y+z;\n if(x==m||x<m)\n {\n printf(\"?\");\n\n }\n else if(x>y)\n {\n printf(\"+\");\n }\n\n }\n else if(y>x||y==z&&x==z)\n {\n n=x+z;\n if(y==n||y<n)\n {\n printf(\"?\");\n\n }\n else if(y>x)\n {\n printf(\"-\");\n }\n }\n\n else\n {\n printf(\"0\");\n }\n return 0;\n }\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(z)\n {\n if(x+z==y||x==y+z)\n printf(\"?\");\n else\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"0\");\n }\n else\n {\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"0\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if (x > y)\n printf(\"+\");\n else if (x < y)\n printf(\"-\");\n else\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c, z;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>b)\n {\n z=a-b-c;\n if(z>0)\n {\n printf(\"+\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n printf(\"-\");\n }\n }\n if(a==b)\n {\n printf(\"?\");\n }\n if(a<b)\n {\n z=b-a-c;\n if(z>0)\n {\n printf(\"-\");\n }\n else if(z==0)\n {\n printf(\"?\");\n }\n else\n {\n printf(\"+\");\n }\n }\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int poz , neg , neutru ;\n scanf(\"%d\" , &poz);\n scanf(\"%d\" , &neg);\n scanf(\"%d\" , &neutru);\n\n if(poz>neg)\n printf(\" + \");\n else if(poz<neg)\n printf(\" - \");\n else if(poz==neg)\n {\n if(neutru%2==0)\n printf(\" 0 \");\n else if(neutru%2!=0)\n printf(\" ? \");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y){\n printf(\"+\\n\");\n }\n else if(x<y){\n printf(\"-\\n\");\n }\n else if(x==y && x>0 && y>0){\n printf(\"0\\n\");\n }\n else if(y==0 && x==0){\n printf(\"?\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x-y-z)==0){\n printf(\"0\");\n }\n else if((x-y-z)>0){\n printf(\"+\");\n }\n else if(((x-y-z)<0)||((x-y)<0 && z==0)){\n printf(\"-\");\n }\n else if(((x-y)>0 && z>0) || (x-y+z)>0){\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a > b && a != b+c){\n printf(\"+\");\n }\n else if(a < b && a > b+c){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b)){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c)!=EOF)\n\tif(a<b)\n\t{\n\t\tprintf(\"-\\n\");\n\t}\n\telse if(a>b)\n\t{\n\t\tprintf(\"+\\n\");\n\t}\n\telse if(a==b&&c==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(a==b)\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x>(y+z))\n {\n printf(\"+\");\n return 0;\n }\n else if(x!=0 && y!=0 && x==y)\n {\n printf(\"0\");\n return 0;\n }\n else if (x==(y+z))\n {\n printf(\"?\");\n return 0;\n }\n else if(y==(x+z))\n {\n printf(\"?\");\n return 0;\n }\n else if (x==0 && y==0)\n {\n printf(\"?\");\n return 0;\n }\n else if(x==y && y==z)\n {\n printf(\"?\");\n return 0;\n }\n\n else printf(\"-\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(c>a&&c>b)\n printf(\"?\");\n else\n {\n if(a+c<b)\n printf(\"-\");\n else if(a+c>b)\n printf(\"+\");\n else\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x=0&&y>z){\n printf(\"-\");\n }\n else if(y=0&&x>z){\n printf(\"+\");\n }\n else if(z=0&&x<y){\n printf(\"-\");\n }\n else if(z=0&&x>y){\n printf(\"+\");\n }\n else if(z=0&&x==y){\n printf(\"0\");\n }\n else if(x+z>y){\n printf(\"+\");\n }\n else if(y+z>x){\n printf(\"-\");\n }\n else{\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n// CREATED BY AHNAF SHAHREAR\n\nint main ( )\n\n{\n int UPVOTES , DOWNVOTES , UNKNOWN ;\n scanf ( \"%d %d %d\", &UPVOTES , &DOWNVOTES , &UNKNOWN ) ;\n\n if ( UPVOTES > DOWNVOTES + UNKNOWN )\n {\n printf ( \"+\\n\" ) ;\n }\n else if ( DOWNVOTES > UPVOTES + UNKNOWN )\n {\n printf ( \"-\\n\" ) ;\n }\n else if ( UPVOTES == DOWNVOTES )\n {\n if ( UNKNOWN >= DOWNVOTES )\n {\n printf ( \"?\\n\" ) ;\n }\n else if ( UNKNOWN == 0 )\n {\n printf ( \"0\\n\" ) ;\n }\n }\n else if ( UPVOTES == DOWNVOTES + UNKNOWN )\n {\n printf ( \"?\\n\" ) ;\n }\n else if ( DOWNVOTES == UPVOTES + UNKNOWN )\n {\n printf ( \"?\\n\" ) ;\n }\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(a==0&&b==0&&c>0)\n\t{\n\t\tprintf(\"?\\n\");\n\t}\n\telse if(a>b)\n\t{\n\t\tprintf(\"+\\n\");\n\t}\n\telse if(b>a)\n\t{\n\t\tprintf(\"-\\n\");\n\t}\n\telse if(a==b)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n char ch;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(c>=a-b&&c>=b-a){\n if(c!=0)\n ch='?';\n }else if(a>b){\n ch='+';\n }else if(b>a){\n ch='-';\n }else{\n ch='0';\n }\n printf(\"%c\",ch);\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y&&x>z)\n printf(\"+\");\n else if(y>x&&y>z)\n printf(\"-\");\n else if(z>x&&z>y)\n printf(\"?\");\n else\n printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x+y>z)\n {\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"0\");\n }\n else\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<string.h>\nint main()\n{\nint x,y,z,i,j;\nscanf(\"%d%d%d\",&x,&y,&z);\n if(x==y) {\n if(z>0) printf(\"?\");\n else printf(\"0\");\n }\nelse if(x+z==y+z) printf(\"?\");\nelse if(y>x+z) printf(\"-\");\nelse if(x>y+z) printf(\"+\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a > b){\n printf(\"+\");\n }\n else if(a < b){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b)){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a==0||b==0||c==0)\n {\n if((a==0&&b==0))\n printf(\"?\\n\");\n else if(a>b)\n printf(\"+\\n\");\n\n else if(a<b)\n printf(\"-\\n\");\n\n else\n printf(\"0\\n\");\n }\n else\n { if(a-b==c||b-a==c)\n printf(\"?\\n\");\n else if(a>b)\n printf(\"+\\n\");\n\n else if(a<b)\n printf(\"-\\n\");\n\n else\n printf(\"0\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int x, y, z, d, j;\n char m;\n\n scanf(\"%d %d %d\", &x, &y, &z);\n\n if(x>=y)\n {\n d = x-y;\n }\n else if(x<y)\n {\n d = y-x;\n }\n\n if(d>z || z==0)\n {\n if(x>y)\n {\n printf(\"+\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n printf(\"?\");\n\n printf(\"%c\", m);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>(b+c))\n {\n printf(\"+\");\n }\n else if((a<(b+c))&&c>b)\n {\n printf(\"?\");\n }\n else if((a<(b+c))&&b>c)\n {\n printf(\"-\");\n }\n else if((b<(a+c))&&a>c)\n {\n printf(\"+\");\n }\n else if((b<(a+c))&&c>a)\n {\n printf(\"?\");\n }\n else if(b>(a+c))\n {\n printf(\"-\");\n }\n else if(a==(b+c))\n {\n printf(\"?\");\n }\n else if(b==(a+c))\n {\n printf(\"?\");\n }\n else if(a==b&&c>0)\n {\n printf(\"?\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>(b+c))\n {\n printf(\"+\");\n }\n else if((a<(b+c))&&c>b)\n {\n printf(\"?\");\n }\n else if((a<(b+c))&&b>c&&b!=(a+c))\n {\n printf(\"-\");\n }\n else if((b<(a+c))&&a>c&&a!=(b+c))\n {\n printf(\"+\");\n }\n else if((b<(a+c))&&c>a)\n {\n printf(\"?\");\n }\n else if(b>(a+c))\n {\n printf(\"-\");\n }\n else if(a==(b+c)&&c>=b)\n {\n printf(\"?\");\n }\n else if(a==(b+c)&&b>c)\n {\n printf(\"?\");\n }\n else if(b==(a+c))\n {\n printf(\"?\");\n }\n else if(a==b&&c>0)\n {\n printf(\"?\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,p,q=0;\n scanf(\"%d %d %d\",&x,&y,&z);\n p=x-y;\n if(p>0)\n {\n q=p;\n }else if(p<0){\n q=-p;\n }\n if(p>0&&z<q)\n {\n printf(\"+\");\n }else if(p<0&&z<q){\n printf(\"-\");\n }else if(z==q&&z!=0){\n printf(\"?\");\n }else{\n printf(\"0\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a>b)\n {\n if(a>b+c) printf(\"+\\n\");\n else if(a<=b+c) printf(\"?\\n\");\n\n\n }\n else if(a<b)\n {\n if(b>a+c) printf(\"-\\n\");\n else if(b<=a+c) printf(\"?\\n\");\n\n\n }\n else if(a==b)\n { if(a==c & a==0) printf(\"0\\n\");\n else if(a<=c) printf(\"?\\n\");\n else printf(\"0\\n\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>=y && x>=z)\n {\n printf(\"+\");\n }\n else if(y>x && y>=z)\n {\n printf(\"-\");\n }\n else if(x==y && x>z)\n {\n printf(\"0\");\n }\n else if(z>x && z>y)\n {\n printf(\"?\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,p,q=0;\n scanf(\"%d %d %d\",&x,&y,&z);\n p=x-y;\n if(p>0)\n {\n q=p;\n }else if(p<0){\n q=-p;\n }\n if(p>0&&z<q)\n {\n printf(\"+\");\n }else if(p<0&&z<q){\n printf(\"-\");\n }else if(z==q&&z!=0){\n printf(\"?\");\n }else{\n printf(\"0\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x==0||y==0||z==0)\n {\n if(x==0&&y>z)\n {\n printf(\"-\");\n }\n else if(y==0&&x>z)\n {\n printf(\"+\");\n }\n\n else if(z==0)\n {\n if(y==x&&x>0&&y>0)\n {\n printf(\"0\");\n }\n else if(x<y)\n {\n printf(\"-\");\n }\n else if(x>y)\n {\n printf(\"+\");\n }\n else if(x==y)\n {\n printf(\"0\");\n }\n }\n else\n {\n printf(\"?\");\n }\n\n }\n\n else if(x>y||y>x)\n {\n if(x+z>y)\n {\n printf(\"+\");\n }\n else if(y+z>x)\n {\n printf(\"-\");\n }\n else\n {\n printf(\"?\");\n }\n }\n else\n {\n printf(\"?\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x, y, z;\n scanf(\"%d%d%d\",&x ,&y ,&z);\n if(x<y)\n {\n if((x+z)>y)\n printf(\"+\\n\");\n else if((x+z)<y)\n printf(\"-\\n\");\n else\n printf(\"0\\n\");\n }\n\n else if(y<x)\n {\n if((y+z)>x)\n printf(\"-\\n\");\n else if((y+z)<x)\n printf(\"+\\n\");\n else\n printf(\"0\\n\");\n }\n\n else if(x==y && z==0)\n printf(\"0\\n\");\n else\n printf(\"?\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int x,y,z;\n scanf(\"%ld%ld%ld\",&x,&y,&z);\n if(y>x+z)printf(\"-\");\n else if(x>y+z)printf(\"+\");\n else if(x==y)printf(\"0\");\n else printf(\"?\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a > b && a != b+c){\n printf(\"+\");\n }\n else if(a < b){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b)){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int s;\n s=x-y;\n if((s-z)>0&&(s+z)>0)\n {\n printf(\"+\");\n }\n else if((s-z)<0&&(s+z)<0)\n {\n printf(\"-\");\n }\n else\n {\n if((s-z)==0)\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(c>a||c>b)\n {\n printf(\"?\\n\");\n }\n else if(a>b)\n {\n printf(\"+\\n\");\n }\n else if(b>a)\n {\n printf(\"-\\n\");\n }\n else if(a==0&&b==0)\n {\n printf(\"?\\n\");\n }\n else\n {\n printf(\"0\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(x==y && z==0)\n\tprintf(\"0\");\n\telse if((x==y) && (z!=x))\n\tprintf(\"?\");\n\telse if((x>y) && z==0)\n printf(\"+\");\n else if((x>y) && (x==y+z))\n printf(\"0\");\n else if((x>y) && (x>y+z))\n printf(\"+\");\n else if ((y>x)&& z==0)\n printf(\"-\");\n else if((y>x) && (y==x+z))\n printf(\"0\");\n else if((y>x) && (y>x+z))\n printf(\"-\");\n else if(x>z && y==0)\n printf(\"+\");\n else if(y>z && x==0)\n printf(\"-\");\n else if(x==0 && y==0 && z!=0)\n printf(\"?\");\n else\n printf(\"?\");\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a+c>b+c)\n {\n if(a<=b+c)\n {\n printf(\"?\\n\");\n }\n else{\n printf(\"+\\n\");\n }\n }\n else if(b+c>c+a)\n {\n printf(\"-\\n\");\n }\n else if(a+c==b+c)\n {\n if(a=b)\n {\n printf(\"0\\n\");\n }\n else{\n printf(\"?\\n\");\n }\n}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a>b) printf(\"+\\n\");\n else if(a<b) printf(\"-\\n\");\n else if(a==b && a!=0) printf(\"0\\n\");\n else if (a==0 && b==0) printf(\"?\\n\");\n else printf(\"?\\n\");\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if((x<=z && y<=z) ||(x-y<=z)){\n printf(\"?\");\n }\n else if(x>y){\n printf(\"+\");\n }\n else if(x<y){\n printf(\"-\");\n }\n else if(x==y){\n printf(\"0\");\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d\",&x,&y,&z);\n\tif(x-y-z>0)\n\t\tprintf(\"+\");\n\telse if(y-x-z>0)\n\t\tprintf(\"-\");\n\telse if((x-y)==0 && z > 0)\n\t\tprintf(\"?\");\n\telse if((x-y)==0 && z == 0)\n\t\tprintf(\"0\");\n\telse\n\t\tprintf(\"?\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a==0 && b==0 && c==0){\n printf(\"0\");\n \n }\n else if(a > b && a != b+c && a > b+c){\n printf(\"+\");\n }\n else if(a < b && a+c < b){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b) && (a+c != b+c) ){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x==y&&z>x)\n printf(\"?\");\n if(x>y)\n printf(\"+\");\n if(y>x)\n printf(\"-\");\n if(x==y&&z==0)\n printf(\"0\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint x,y,z;\n\tscanf(\"%d\",&x,&y,&z);\n\tif(x-y-z>0)\n\t\tprintf(\"+\");\n\telse if(y-x-z>0)\n\t\tprintf(\"-\");\n\telse if((x-y)==0 && z > 0)\n\t\tprintf(\"?\");\n\telse if((x-y)==0 && z == 0)\n\t\tprintf(\"0\");\n\telse\n\t\tprintf(\"?\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b&&c==0)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>(b+c))\n {\n printf(\"+\");\n }\n else if(a<(b+c))\n {\n printf(\"?\");\n }\n// else if(b<(a+c))\n// {\n// printf(\"?\");\n// }\n else if(b>(a+c))\n {\n printf(\"-\");\n }\n else if(a==(b+c))\n {\n printf(\"?\");\n }\n else if(b==(a+c))\n {\n printf(\"?\");\n }\n else if(a==b&&c>0)\n {\n printf(\"?\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,y,z;\n\tscanf(\"%d%d%d\",&x,&y,&z);\n\tif(x==y && z==0)\n\tprintf(\"0\");\n\telse if((x==y) && (z!=x))\n\tprintf(\"?\");\n\telse if((x>y) && z==0)\n printf(\"+\");\n else if((x>y) && (x==y+z))\n printf(\"0\");\n else if((x>y) && (x>y+z))\n printf(\"+\");\n else if ((y>x)&& z==0)\n printf(\"-\");\n else if((y>x) && (y==x+z))\n printf(\"0\");\n else if((y>x) && (y>x+z))\n printf(\"-\");\n else if(x>z && y==0)\n printf(\"+\");\n else if(y>z && x==0)\n printf(\"-\");\n else if(x==0 && y==0 && z!=0)\n printf(\"?\");\n else\n printf(\"?\");\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int x,y,z;\n scanf(\"%ld%ld%ld\",&x,&y,&z);\n if(y>x)printf(\"-\");\n else if(x>y)printf(\"+\");\n else if(x==0&&y==0)printf(\"?\");\n else if(x==y)printf(\"0\");\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if (x>y && x>z && y>z) {printf(\"+\");}\n else if (y>x && y>z && x>z) {printf(\"-\");}\n else if (x==y && x>z) {printf(\"0\");}\n else if(z>x || z>y) {printf(\"?\");}\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b)\n {\n printf(\"+\\n\");\n }\n else if(b<a)\n {\n printf(\"-\\n\");\n }\n else if(a!=0&&b!=0&&a==b)\n {\n printf(\"0\\n\");\n }\n else\n {\n printf(\"?\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>(b+c))\n {\n printf(\"+\");\n }\n else if((a<(b+c))&&c>b)\n {\n printf(\"?\");\n }\n else if((a<(b+c))&&b>c)\n {\n printf(\"-\");\n }\n else if((b<(a+c))&&a>c)\n {\n printf(\"+\");\n }\n else if((b<(a+c))&&c>a)\n {\n printf(\"?\");\n }\n else if(b>(a+c))\n {\n printf(\"-\");\n }\n else if(a==(b+c)&&c>b)\n {\n printf(\"+\");\n }\n else if(a==(b+c)&&b>c)\n {\n printf(\"?\");\n }\n else if(b==(a+c))\n {\n printf(\"?\");\n }\n else if(a==b&&c>0)\n {\n printf(\"?\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x>y)&&(x>z))\n {\n if((y+z)<x){\n printf(\"+\");}\n else{\n printf(\"?\");}\n }\n else if((y>x)&&(y>z))\n {\n if((x+z)<y){\n printf(\"-\");}\n else{\n printf(\"?\");}\n\n }\n else if((x==y)&&(x>z))\n {\n printf(\"0\");\n }\n else\n {\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if((a+c)>=b && (b+c)>=a)\n {\n printf(\"?\");\n }\n else if((a+c)>b && (b+c)<a)\n {\n printf(\"+\");\n }\n else if((a+c)<b && (b+c)>a)\n {\n printf(\"-\");\n }\n else printf(\"0\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int u, d, n, c;\n\n scanf(\"%d %d %d\", &u, &d, &n);\n\n c=u-d;\n\n if(c-n>0)\n printf(\"+\\n\");\n if(c+n<0)\n printf(\"-\\n\");\n if(c-n<0&&c+n>0)\n printf(\"?\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b&&b+c<a)\n printf(\"+\");\n else if(b>a&&a+c<b)\n printf(\"-\");\n else if((a==b)&&a>c&&b>c)\n printf(\"0\");\n else\n printf(\"?\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x>y)\n printf(\"+\\n\");\n if(x<y)\n printf(\"-\\n\");\n if(x==y &&z==0)\n printf(\"0\\n\");\n if(x==y && z>0)\n printf(\"?\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(z<0)\n {\n printf(\"0\");\n return 0;\n }\n if(x>y)\n {\n x=x+z/2;\n y=y+z/2;\n if(x>y)\n printf(\"+\");\n }\n else if(x<y)\n {\n x=x+z/2;\n y=y+z/2;\n if(x<y)\n printf(\"-\");\n }\n else if (x==y && z%2==0)\n {\n x=x+z/2;\n y=y+z/2;\n if(x==y)\n printf(\"0\");\n }\n else if(x==y && z%2!=0)\n printf(\"?\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a > b && a != b+c){\n printf(\"+\");\n }\n else if(a < b && a+c < b){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b)){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a > b && a != b+c){\n printf(\"+\");\n }\n else if(a < b && a+b > c){\n printf(\"-\");\n }\n else if(a==b &&( c < a && c < b)){\n printf(\"0\");\n }\n else {\n printf(\"?\");\n }\n \n}"}, {"source_code": "#include <stdio.h>\n\n// CREATED BY AHNAF SHAHREAR\n\nint main ( )\n\n{\n int UPVOTES , DOWNVOTES , UNKNOWN ;\n scanf ( \"%d %d %d\", &UPVOTES , &DOWNVOTES , &UNKNOWN ) ;\n\n if ( UPVOTES > DOWNVOTES + UNKNOWN )\n {\n printf ( \"+\\n\" ) ;\n }\n else if ( DOWNVOTES > UPVOTES + UNKNOWN )\n {\n printf ( \"-\\n\" ) ;\n }\n else if ( UPVOTES == DOWNVOTES )\n {\n if ( UNKNOWN >= DOWNVOTES )\n {\n printf ( \"?\\n\" ) ;\n }\n else if ( UNKNOWN == 0 )\n {\n printf ( \"0\\n\" ) ;\n }\n }\n else if ( UPVOTES == DOWNVOTES + UNKNOWN )\n {\n printf ( \"?\\n\" ) ;\n }\n else if ( DOWNVOTES == UPVOTES + UNKNOWN )\n {\n printf ( \"?\\n\" ) ;\n }\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x>(y+z))\n {\n printf(\"+\");\n return 0;\n }\n else if(x!=0 && y!=0 && x==y && y!=z)\n {\n printf(\"0\");\n return 0;\n }\n else if (x==(y+z))\n {\n printf(\"?\");\n return 0;\n }\n else if(y==(x+z))\n {\n printf(\"?\");\n return 0;\n }\n else if (x==0 && y==0)\n {\n printf(\"?\");\n return 0;\n }\n else if(x==y && y==z)\n {\n printf(\"?\");\n return 0;\n }\n\n else printf(\"-\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x-y>z){\n printf(\"+\\n\");\n }\n\n else if(x==y && z!=0){\n printf(\"?\\n\");\n }\n else if(z>x || z>y){\n printf(\"?\\n\");\n }\n else if(x>y && x-y<z){\n printf(\"?\\n\");\n }\n\n\n\n\n else if(x<y && y-x>z){\n printf(\"-\\n\");\n }\n else if(x<y && y-x<z){\n printf(\"?\\n\");\n }\n else if(x==y && x>0 && y>0 && x>z && y>z){\n printf(\"0\\n\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y)\n {\n int d=x-y;\n if(d>z)\n printf(\"+\");\n else if(d==z&&z==0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n else\n {\n int d=y-x;\n if(d>z)\n printf(\"+\");\n else if(d==z&&z==0)\n printf(\"0\");\n else\n printf(\"?\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n\n if(x>y)\n printf(\"+\\n\");\n else if(x<y)\n printf(\"-\\n\");\n else \n printf(\"0\\n\");\n \n if(x==y && (x<z || y<z))\n printf(\"?\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a==0||b==0||c==0)\n {\n if((a==0&&b==0))\n printf(\"?\\n\");\n else if(a>b)\n printf(\"+\\n\");\n\n else if(a<b)\n printf(\"-\\n\");\n\n else\n printf(\"0\\n\");\n }\n else\n printf(\"?\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n int c=x-y,d=abs(c);\n if(d>=z)\n {\n if(c>0)\n printf(\"+\");\n else if(c<0)\n printf(\"-\");\n else\n printf(\"0\");\n \n }\n else\n printf(\"?\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a==b&&c==0)\n printf(\"0\\n\");\n else if(a==b+c||a+c==b)\n printf(\"?\\n\");\n else if(a>b+c)\n printf(\"+\\n\");\n else if(a<b+c)\n printf(\"-\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a>b&&a>c&&c+b<a)\n\tprintf(\"+\\n\");\n\telse if(a<b&&b>c&&a+c<b)\n\tprintf(\"-\\n\");\n\telse if(a==b&&a>c)\n\tprintf(\"0\\n\");\n\t\telse\n\tprintf(\"?\\n\");\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && y>=z )\n {\n printf(\"+\");\n }\n else if(y>x && x>=z )\n {\n printf(\"-\");\n }\n else if((x==y+z || y==x+z)&& x!=y)\n {\n printf(\"?\");\n }\n else if(x==y && x>z)\n {\n printf(\"0\");\n }\n else if(z>x && z>y)\n {\n printf(\"?\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int x,y,z;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x > y)\n {\n printf(\"+\");\n\n }\n else if(y > x)\n {\n printf(\"-\");\n\n }\n else if(x == y)\n {\n if(z < 2)\n printf(\"0\");\n else\n {\n if(z % 2 == 0)\n printf(\"0\");\n else\n \n printf(\"?\");\n }\n\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,a,b;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x>y && x-y>z){\n printf(\"+\\n\");\n }\n\n else if(x==y && z!=0){\n printf(\"?\\n\");\n }\n\n else if(x>y && x-y<=z){\n printf(\"?\\n\");\n }\n else if(x<y && y-x>z){\n printf(\"-\\n\");\n }\n else if(x<y && y-x<=z){\n printf(\"?\\n\");\n }\n else if(x==y && x>0 && y>0 && x>z && y>z){\n printf(\"0\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,z,val;\n scanf(\"%d%d%d\",&x,&y,&z);\n val=abs(x-y);\n if(z>val)\n printf(\"?\");\n else if(z<val)\n {\n if(x>y)\n printf(\"+\");\n else \n printf(\"-\");\n }\n else \n printf(\"0\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(c>a&&c>b)\n printf(\"?\");\n else\n {\n if(a+c<b)\n printf(\"-\");\n else if(a+c>b)\n printf(\"+\");\n else\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>c||b>c)\n {\n if(a>b)\n printf(\"+\\n\");\n else if(a<b)\n printf(\"-\\n\");\n else\n printf(\"0\\n\");\n }\n else\n printf(\"?\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if((x-y-z)==0){\n printf(\"0\");\n }\n else if(((x-y)>0 && z>0) || (x-y+z)>0){\n printf(\"?\");\n }\n else if((x-y-z)>0){\n printf(\"+\");\n }\n else if(((x-y-z)<0)||((x-y)<0 && z==0)){\n printf(\"-\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c)!=EOF)\n\t{\n\t\tif(c==0)\n\t\t{\n\t\t\tif(a<b)\n\t\t\t{\n\t\t\t\tprintf(\"-\\n\");\n\t\t\t}\n\t\t\tif(a>b)\n\t\t\t{\n\t\t\t\tprintf(\"+\\n\");\n\t\t\t}\n\t\t\tif(a==b)\n\t\t\t{\n\t\t\t\tprintf(\"0\\n\");\n\t\t\t}\n\t\t}\n\t\tif(c!=0)\n\t\t{\n\t\t\tif(a==b)\n\t\t\t{\n\t\t\t\tprintf(\"?\\n\");\n\t\t\t}\n\t\t\tif(a>b&&(a-b)<c)\n\t\t\t{\n\t\t\t\tprintf(\"?\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"+\\n\");\n\t\t\t}\n\t\t\tif(a<b&&(b-a)<c)\n\t\t\t{\n\t\t\t\tprintf(\"?\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\" -\\n\");\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(c==0)\n {\n if(a>b)\n {\n printf(\"+\");\n }\n else if(b>a)\n printf(\"-\");\n else if(a==b&&c==0)\n {\n printf(\"0\");\n }\n\n }\n else\n {\n if(a>(b+c))\n {\n printf(\"+\");\n }\n else if(a<(b+c))\n {\n printf(\"?\");\n }\n// else if(b<(a+c))\n// {\n// printf(\"?\");\n// }\n else if(b>(a+c))\n {\n printf(\"-\");\n }\n else if(a==(b+c))\n {\n printf(\"?\");\n }\n else if(b==(a+c))\n {\n printf(\"?\");\n }\n else if(a==b&&c>0)\n {\n printf(\"?\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z;\n scanf(\"%d %d %d\",&x,&y,&z);\n if(x>y)\n {\n y=y+z;\n if(x>y)\n printf(\"+\");\n else if(x<y)\n printf(\"-\");\n else\n printf(\"?\");\n }\n else if(x<y)\n {\n x=x+z;\n if(x<y)\n printf(\"-\");\n else if(x>y)\n printf(\"-\");\n else\n printf(\"?\");\n }\n else if(x==y && z!=0)\n printf(\"?\");\n else if(z==0)\n printf(\"0\");\n \n return 0; \n}"}], "src_uid": "66398694a4a142b4a4e709d059aca0fa"} {"nl": {"description": "The employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.The point is to trick the spectator's attention. Initially, the spectator stands in front of a line of n plastic cups. Then the magician places a small marble under one cup and shuffles the cups. Then the spectator should guess which cup hides the marble.But the head coder of the F company isn't easy to trick. When he saw the performance, he noticed several important facts: each cup contains a mark \u2014 a number from 1 to n; all marks on the cups are distinct; the magician shuffles the cups in m operations, each operation looks like that: take a cup marked xi, sitting at position yi in the row of cups (the positions are numbered from left to right, starting from 1) and shift it to the very beginning of the cup row (on the first position). When the head coder came home after work he wanted to re-do the trick. Unfortunately, he didn't remember the starting or the final position of the cups. He only remembered which operations the magician performed. Help the coder: given the operations in the order they were made find at least one initial permutation of the cups that can go through the described operations in the given order. Otherwise, state that such permutation doesn't exist.", "input_spec": "The first line contains integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106). Each of the next m lines contains a couple of integers. The i-th line contains integers xi, yi (1\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009n) \u2014 the description of the i-th operation of the magician. Note that the operations are given in the order in which the magician made them and the coder wants to make them in the same order.", "output_spec": "If the described permutation doesn't exist (the programmer remembered wrong operations), print -1. Otherwise, print n distinct integers, each from 1 to n: the i-th number should represent the mark on the cup that initially is in the row in position i. If there are multiple correct answers, you should print the lexicographically minimum one.", "sample_inputs": ["2 1\n2 1", "3 2\n1 2\n1 1", "3 3\n1 3\n2 3\n1 3"], "sample_outputs": ["2 1", "2 1 3", "-1"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#define N 1050000\n#define M 2300000\n#define T 1048576\nint n,m;\nint first[M];\nint second[M];\nint last[N];\nint wei[N];\nint pei[N];\nint ans[N];\nvoid add(int a[],int x)\n{\n x+=T-1;\n while(x)\n {\n a[x]++;\n x>>=1;\n }\n}\nvoid del(int a[],int x)\n{\n x+=T-1;\n while(x)\n {\n a[x]--;\n x>>=1;\n }\n}\nint find(int a[],int now,int l,int r,int x)\n{\n if(l==r)\n return l;\n int mid=(l+r)/2;\n if(x<=a[now<<1])\n return( find(a,now<<1,l,mid,x) );\n return( find(a,now*2+1,mid+1,r,x-a[now<<1]) );\n}\nint main()\n{\n int i,a,b;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++)\n add(second,i);\n for(i=1;i<=m;i++)\n {\n scanf(\"%d%d\",&a,&b);\n if(first[1]>=b)\n b=wei[find(first,1,1,T,first[1]-b+1)];\n else\n b=find(second,1,1,T,b-first[1]);\n if(ans[b]==a)\n {\n wei[i]=b;\n del(first,last[b]);\n last[b]=i;\n add(first,i);\n continue;\n }\n if(ans[b] || pei[a])\n {\n printf(\"-1\\n\");\n return 0;\n }\n ans[b]=a;\n pei[a]=b;\n last[b]=i;\n wei[i]=b;\n del(second,b);\n add(first,i);\n }\n int now=0;\n for(i=1;i<=n;i++)\n if(!ans[i])\n {\n now++;\n while(pei[now])\n now++;\n ans[i]=now;\n }\n for(i=1;i<n;i++)\n printf(\"%d \",ans[i]);\n printf(\"%d\\n\",ans[n]);\n return 0;\n}"}], "negative_code": [], "src_uid": "a2616b1681f30ce4b2a5fdc81cf52b50"} {"nl": {"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_spec": "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_spec": "In a single line print a single integer \u2014 the maximum number of points Artem can get.", "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"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void* a, const void* b)\n{\n int* x = (int*) a;\n int* y = (int*) b;\n return *x - *y;\n}\n\nunsigned min(const unsigned a, const unsigned b)\n{\n return (a < b) ? a : b;\n}\n\nint main(int argc, const char *argv[])\n{\n\tunsigned a[500000] = {0};\n unsigned x, n, i, j = 0;\n\tunsigned long long ans = 0;\n\n\tscanf(\"%u\", &n);\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%u\", &x);\n\t\twhile(j > 1 && a[j - 2] >= a[j - 1] && x >= a[j - 1])\n {\n\t\t\tans += min(a[j - 2], x);\n\t\t\tj--;\n\t\t}\n\t\ta[j++] = x;\n\t}\n\n qsort(a, j, sizeof(unsigned), compare);\n\n if (j > 1)\n for(i = 0; i < j - 2; i++)\n ans += a[i];\n\n\tprintf(\"%I64d\\n\", ans);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void* a, const void* b)\n{\n int* x = (int*) a;\n int* y = (int*) b;\n return x - y;\n}\n\nint main(int argc, const char *argv[])\n{\n\tint a[500000], x;\n unsigned i, n, p = 0;\n\tunsigned long long ans = 0;\n\n\tscanf(\"%u\", &n);\n\tfor(i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &x);\n\t\twhile(p > 1 && a[p - 2] >= a[p - 1] && x >= a[p - 1])\n {\n\t\t\tans += (a[p-2] < x) ? a[p-2] : x;\n\t\t\tp--;\n\t\t}\n\t\ta[p++] = x;\n\t}\n\n qsort(a, 500000, sizeof(int), compare);\n\n for(i = 0; i < p - 2; i++)\n ans += a[i];\n\tprintf(\"%I64d\\n\", ans);\n return 0;\n}\n"}], "src_uid": "e7e0f9069166fe992abe6f0e19caa6a1"} {"nl": {"description": "Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.A molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom has a valence number \u2014 the number of bonds the atom must form with other atoms. An atom can form one or multiple bonds with any other atom, but it cannot form a bond with itself. The number of bonds of an atom in the molecule must be equal to its valence number. Mike knows valence numbers of the three atoms. Find a molecule that can be built from these atoms according to the stated rules, or determine that it is impossible.", "input_spec": "The single line of the input contains three space-separated integers a, b and c (1\u2009\u2264\u2009a,\u2009b,\u2009c\u2009\u2264\u2009106) \u2014 the valence numbers of the given atoms.", "output_spec": "If such a molecule can be built, print three space-separated integers \u2014 the number of bonds between the 1-st and the 2-nd, the 2-nd and the 3-rd, the 3-rd and the 1-st atoms, correspondingly. If there are multiple solutions, output any of them. If there is no solution, print \"Impossible\" (without the quotes).", "sample_inputs": ["1 1 2", "3 4 5", "4 1 1"], "sample_outputs": ["0 1 1", "1 3 2", "Impossible"], "notes": "NoteThe first sample corresponds to the first figure. There are no bonds between atoms 1 and 2 in this case.The second sample corresponds to the second figure. There is one or more bonds between each pair of atoms.The third sample corresponds to the third figure. There is no solution, because an atom cannot form bonds with itself.The configuration in the fourth figure is impossible as each atom must have at least one atomic bond."}, "positive_code": [{"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,i,j;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ti=a-b;\n\tif(i<0)i*=-1;\n\tj=a+b+c;\n\tif(c<i||c>a+b||j%2>0)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",j/2-c,j/2-a,j/2-b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i,otw,oth,twth;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=0;i<=a;i++)\n {\n\totw=i;\n\ttwth=c-a+i;\n\toth=a-i;\n\n\tif(b-(otw+twth)==0 && otw>=0 && twth>=0 && oth>=0)\n\t{\n\t printf(\"%d %d %d\\n\",otw,twth,oth);\n\t break;\n\t}\n }\n if(i>a)\n\tprintf(\"Impossible\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[3],i,j=0,x,b,s;\n\tscanf(\"%d %d %d\",&a[0],&a[1],&a[2]);\n\tb=a[0];\n\tfor(i=1;i<3;i++)\n\tif(a[i]>b){\n\tb=a[i];\n\tj=i;\n\t}\n\ts=a[0]+a[1]+a[2]-b;\n\tif(s==b){\n\t\tif(j==0)\n\t\tprintf(\"%d 0 %d\",a[1],a[2]);\n\t\telse if(j==1)\n\t\tprintf(\"%d %d 0\",a[0],a[2]);\n\t\telse\n\t\tprintf(\"0 %d %d\",a[1],a[0]);\n\t}\n\telse if((s-b)%2==0 && s-b>0){\n\t\tx=(s-b)/2;\n\t\tif(j==0)\n\t\t\tprintf(\"%d %d %d\",a[1]-x,x,a[2]-x);\n\t\t\telse if(j==1)\n\t\t\tprintf(\"%d %d %d\",a[0]-x,a[2]-x,x);\n\t\t\telse\n\t\t\tprintf(\"%d %d %d\",x,a[1]-x,a[0]-x);\n\t}\n\telse\n\tprintf(\"Impossible\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define swap(a,b) (a)=(a)+(b)-((b)=(a))\nint main()\n{\n\tint mols[3];\n\tint i,j,k,max=0,sum=0;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&mols[i]);\n\t\tif(mols[i]>max)\n\t\t{\n\t\t\tmax=mols[i];\n\t\t\tk=i;\n\t\t}\n\t\tsum+=mols[i];\n\t}\n\tint d;\n\td=sum-2*mols[k];\n\tif(d<0||d%2==1)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\td>>=1;\n\t\tfor(i=0;i<3;i++)\n\t\t{\n\t\t\tj=(i+1)%3;\n\t\t\tif(i!=k&&j!=k)\n\t\t\t\tprintf(\"%d \",d);\n\t\t\telse if(i!=k&&j==k)\n\t\t\t\tprintf(\"%d \",mols[i]-d);\n\t\t\telse\n\t\t\t\tprintf(\"%d \",mols[j]-d);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,c,x,y,z;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if((a+b+c)%2==0)\n {\n x=(a+b-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x>=0 && y>=0 && z>=0)\n printf(\"%lld %lld %lld\\n\",x,y,z);\n else\n printf(\"Impossible\\n\");\n }\n else\n printf(\"Impossible\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\nint a,b,c;\nint main(){\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif((a+b+c)%2==0 && a+b>=c && a+c>=b && b+c>=a){\n\t\tprintf(\"%d %d %d\\n\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n\t}\n\telse printf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n \n \n int main()\n {\n int a[3][3],i,j,k,x,y,z;\n while((scanf(\"%d %d %d\",&a[0][0],&a[0][1],&a[0][2]))!=EOF)\n {\n a[1][0]=0;\n a[1][1]=1;\n a[1][2]=2;\n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[0][j]>a[0][j+1])\n {\n k= a[0][j];\n a[0][j]=a[0][j+1];\n a[0][j+1]=k;\n \n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n }\n }\n }\n \n if(a[0][2]>a[0][1]+a[0][0])\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n if(a[0][2]==a[0][1]+a[0][0])\n {\n a[2][0]= 0;\n a[2][1]= a[0][1];\n a[2][2]= a[0][2]-a[2][1];\n \n for(i=0;i<3;i++)\n {\n a[1][i]++;\n }\n for(i=0;i<3;i++)\n {\n if(a[1][i]*a[1][(i+1)%3]==2)\n {\n x=a[2][i]; \n }\n if(a[1][i]*a[1][(i+1)%3]==6)\n {\n y=a[2][i]; \n }\n if(a[1][i]*a[1][(i+1)%3]==3)\n {\n z=a[2][i]; \n }\n \n }\n \n printf(\"%d %d %d\\n\",x,y,z);\n }\n else\n {\n if((a[0][0]+a[0][1]-a[0][2])%2==0)\n {\n a[2][0]=(a[0][0]+a[0][1]-a[0][2])/2;\n a[2][1]=a[0][1]-a[2][0];\n a[2][2]=(a[0][2]-a[2][1]);\n \n \n for(i=0;i<3;i++)\n {\n a[1][i]++;\n }\n for(i=0;i<3;i++)\n {\n if(a[1][i]*a[1][(i+1)%3]==2)\n {\n x=a[2][i]; \n }\n if(a[1][i]*a[1][(i+1)%3]==6)\n {\n y=a[2][i]; \n }\n if(a[1][i]*a[1][(i+1)%3]==3)\n {\n z=a[2][i]; \n }\n \n }\n \n printf(\"%d %d %d\\n\",x,y,z);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n }\n \n }\n }\n \n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n int a,b,c,ans,i,j,x,y,z,max;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b+c || b>a+c || c>a+b || (a+b+c)%2!=0)\n printf(\"Impossible\");\n else\n {\n \n if(b>a && b>c)\n max=b;\n else if(a>b && a>c)\n max=a;\n else\n max=c;\n \n if(max==a)\n {\n y=(b+c-a)/2;\n x=b-y;\n z=c-y;\n //printf(\"a\");\n }\n else if(max==b)\n {\n z=(a+c-b)/2;\n x=a-z;\n y=c-z;\n //printf(\"b\");\n }\n else if(max==c)\n {\n x=(a+b-c)/2;\n z=a-x;\n y=b-x;\n //printf(\"c\");\n }\n printf(\"%d %d %d\",x,y,z);\n }\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a,b,c,d,e,f,s;\n scanf(\"%d%d%d\",&a,&b,&c);\n if((a+b+c)%2==1){\n printf(\"Impossible\\n\");\n return 0;\n }\n else{\n s=(a+b+c)/2;\n d=s-c;\n e=s-b;\n f=s-a;\n if(d>=0&&e>=0&&f>=0){\n printf(\"%d %d %d\\n\",d,f,e);\n return 0;\n }\n }\n printf(\"Impossible\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(a>b+c || b>c+a || c>a+b||(a+b-c)%2!=0||(b+c-a)%2!=0||(c+a-b)%2!=0)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int i1, i2, i3, o12, o23, o13;\n \n scanf (\"%d %d %d \", &i1, &i2, &i3);\n \n for (o12 = 0; o12 <= i1; o12++) {\n o13 = i1 - o12;\n o23 = i2 - o12;\n if (o12 >= 0 && o23 >= 0 && o13 >= 0 && (o12 + o13) == i1 && (o12 + o23) == i2 && (o13 + o23) == i3) {\n printf (\"%d %d %d\\n\", o12, o23, o13);\n return 0;\n }\n }\n \n printf (\"Impossible\\n\");\n\n return 0; \n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a , b , c , counter , diff1 , diff2 , temp ;\n int flag1 = 0 , flag2 = 0;\n scanf(\"%I64d %I64d %I64d\",&a ,&b,&c);\n if ( b > c){\n temp = b;\n b = c ;\n c = temp ;\n flag1 ++;\n }\n if ( a > c){\n temp = a ;\n a = c;\n c = temp;\n flag2 ++ ;\n }\n for (counter = 0 ; counter <= c ; counter ++){\n if ( (a - counter) == (b - (c - counter)) && a >= counter && b >= (c - counter) ){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", a - counter , c - counter , counter);\n return 0;\n }\n if ( flag1 == 1 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", counter , c - counter ,a - counter);\n return 0;\n }\n if (flag1 == 1 && flag2 == 1){\n printf(\"%I64d %I64d %I64d\",c - counter , counter , a - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\",c - counter, a - counter , counter);\n return 0;\n }\n }\n else if ( (b - counter) == (a - (c - counter)) && a>= (c - counter) && (b >= counter )){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\" , b - counter , counter , c - counter);\n return 0;\n }\n if (flag1 == 1 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\" ,c - counter , counter , b - counter );\n return 0;\n }\n if ( flag1 == 1 && flag2 == 1){\n printf(\"%I64d %I64d %I64d\" ,counter ,c - counter , b - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\" ,counter , b - counter , c - counter);\n return 0;\n }\n }\n }\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a, b, c, d, e, f;\n scanf(\"%I64d %I64d %I64d\", &a, &b, &c);\n if ((a + b + c) % 2) printf(\"Impossible\\n\");\n else {\n d = (b + c - a) / 2;\n e = (c + a - b) / 2;\n f = (b + a - c) / 2;\n if ((d < 0) || (e < 0) || (f < 0)) printf(\"Impossible\\n\");\n else if ((d == 0) && (e == 0)) printf(\"Impossible\\n\");\n else if ((e == 0) && (f == 0)) printf(\"Impossible\\n\");\n else if ((d == 0) && (f == 0)) printf(\"Impossible\\n\");\n else printf(\"%I64d %I64d %I64d\\n\", f, d, e);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum,a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tsum=(a+b+c)/2;\n\tif((a+b+c)%2==1 || a==0 || b==0 || c==0 || sum<a || sum< b || sum<c)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\",sum-c,sum-a,sum-b);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\tif((a+b+c)%2!=0)\n\tprintf(\"Impossible\");\n\telse\n\t{\n\tif(x>=0&&y>=0&&z>=0)\n\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\tprintf(\"Impossible\");\n\t}\n\treturn 0;\n } \n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint max(int a,int b,int c)\n{\n\tif(a>=b && a>=c) return 1;\n\telse if(b>a && b>=c) return 2;\n\telse return 3;\n}\nint main()\n{\n\tint a,b,c,i,s1=0,s2=0,s3=0,index;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\twhile(a>0 && b>0 && c>0)\n\t{\n\t\tif(a==1 && b==1 && c==1) \n\t\t{ printf(\"Impossible\\n\");break;}\n\t\tindex=max(a,b,c);\n\t\tif(index==1) { a=a-2; b--;c--;s1++;s2++;}\n\t\telse if(index==2) {b=b-2; a--;c--; s1++;s3++;}\n\t\telse { c=c-2;a--;b--; s2++;s3++;}\n\t}\n\tif(a==0)\n\t{\n\t\tif(b!=c) printf(\"Impossible\\n\");\n\t\telse printf(\"%d %d %d\\n\",s1,s3+b,s2);\t\n\t}\n\telse if(b==0)\n\t{\n\t\tif(a!=c) printf(\"Impossible\\n\");\n\t\telse printf(\"%d %d %d\\n\",s1,s3,s2+a);\n\t\n\t}\n\telse if(c==0)\n\t{\n\t\tif(a!=b) printf(\"Impossible\\n\");\n\t\telse printf(\"%d %d %d\\n\",s1+a,s3,s2);\n\t}\t\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\n\tint sum = 0;\n\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\n\tsum = (a + b + c)/2;\n\n\tif((a + b + c) % 2 != 0 || sum - a < 0 || sum - b < 0 || sum - c < 0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",sum-c,sum-a,sum-b);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a, b, c, i, j, k=0, aray[3], mx, mn, md;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==b && b==c){\n if(a%2==1) printf(\"Impossible\");\n else printf(\"%d %d %d\",a/2, a/2, a/2);\n return 0;\n }\n else if(a+b==c){\n printf(\"%d %d %d\", 0, b, a);\n }\n else if(b+c==a){\n printf(\"%d %d %d\", b, 0, c);\n }\n else if(c+a==b){\n printf(\"%d %d %d\", a, c, 0);\n }\n else{\n aray[0]=a;\n aray[1]=b;\n aray[2]=c;\n for(i=1;i<3;i++){\n j=i;\n while(j>0 && aray[j]<aray[j-1]){\n aray[j]^=aray[j-1];\n aray[j-1]^=aray[j];\n aray[j]^=aray[j-1];\n j--;\n }\n }\n mx=aray[2];\n mn=aray[0];\n md=aray[1];\n if(mn+md<mx){\n printf(\"Impossible\");\n return 0;\n }\n else{\n if(a+b>c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+b<c){\n break;\n }\n }\n if(a+b==c){\n printf(\"%d %d %d\", k, b, a);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(b+c>a){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+b<a){\n break;\n }\n }\n if(c+b==a){\n printf(\"%d %d %d\",b, k, c);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(c+a>b){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c<b){\n break;\n }\n }\n if(a+c==b){\n printf(\"%d %d %d\", a, c, k);\n }\n else{\n printf(\"Impossible\");\n }\n }\n }\n\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i=0,A,B,C;\n scanf(\"%d %d %d\", &a,&b,&c);\n if (a<b+c && b<a+c && c<a+b)\n {\n for(A=1;A<=a;A++)\n {\n C=a-A;\n B=((a+b+c)/2)-(A+C);\n if(A+B+C==((a+b+c)/2) && b==A+B && c==B+C)\n {printf(\"%d %d %d\",A,B,C);\n i=0;\n break;}\n else if (a==1 && b==1 && c==1)\n {printf(\"Impossible\");\n i=0;\n break;}\n i++;\n }\n if(i!=0)\n {\n printf(\"Impossible\");\n }\n\n }\n else if (a>b+c || b>a+c || c>a+b)\n printf(\"Impossible\");\n else if (a==b+c)\n printf(\"%d %d %d\", b,a-(b+c),c);\n else if (b==a+c)\n printf(\"%d %d %d\", a,c,b-(a+c));\n else if (c==a+b)\n printf(\"%d %d %d\", c-(a+b),b,a);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main ()\n{\n\tint i1,i2,i3;\n\tint o12,o23,o13;\n\tscanf(\"%d %d %d\", &i1, &i2, &i3);\n\t/*if (a1 - (a2 - a3) == 0)*/\n\t//fixa o primeiro e calcula as liga\u00e7\u00f5es para os outros dois\n\tfor(o12 = 0; o12 <= i1; o12++)\n\t{\n\t\to23 = i2 - o12;\n\t\to13 = i3 - o23;\n\t\tif ((o12+o13)==i1 && (o12+o23)==i2 && (o13+o23)==i3 && o12>=0 && o13>=0 && o23>=0) break;\n\t}\n\tif ((o12+o13)==i1 && (o12+o23)==i2 && (o13+o23)==i3 && o12>=0 && o13>=0 && o23>=0)\n\t\tprintf(\"%d %d %d\\n\", o12, o23, o13);\n\telse\n\t\tprintf(\"Impossible\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int a,b,c,i,n,f=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n n=a;\n for(i=0;i<=n;i++)\n {\n if((b-i)==(c-n+i))\n {\n if((b-i<0) || (c-n+i<0))\n continue;\n f=1;\n break;\n }\n \n }\n if(f==1)\n printf(\"%d %d %d\",i,b-i,n-i);\n else\n printf(\"Impossible\");\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint mmax( int a, int b) {\n\tif ( a > b ) return b;\n\telse return a;\n}\n\nint main()\n{\n\tint i, j, k;\n\tint a, b, c;\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\n\ti = (b-c+a)/2;\n\tj = (c+b-a)/2;\n\tk = (a-b+c)/2;\n\tif ( i+j == b && i + k == a && j+k == c && i >= 0 && j >= 0 && k >= 0) printf(\"%d %d %d\", i,j,k);\n\telse printf(\"Impossible\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a, b, c, i, j, k=0, aray[3], mx, mn, md;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==b && b==c){\n if(a%2==1) printf(\"Impossible\");\n else printf(\"%d %d %d\",a/2, a/2, a/2);\n return 0;\n }\n else if(a+b==c){\n printf(\"%d %d %d\", 0, b, a);\n }\n else if(b+c==a){\n printf(\"%d %d %d\", b, 0, c);\n }\n else if(c+a==b){\n printf(\"%d %d %d\", a, c, 0);\n }\n else{\n aray[0]=a;\n aray[1]=b;\naray[2]=c;\n for(i=1;i<3;i++){\n j=i;\n while(j>0 && aray[j]<aray[j-1]){\n aray[j]^=aray[j-1];\n aray[j-1]^=aray[j];\n aray[j]^=aray[j-1];\n j--;\n }\n }\n mx=aray[2];\n mn=aray[0];\n md=aray[1];\n if(mn+md<mx){\n printf(\"Impossible\");\n return 0;\n }\n else{\n if(a+b>c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+b<c){\n break;\n }\n }\n if(a+b==c){\n printf(\"%d %d %d\", k, b, a);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(b+c>a){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+b<a){\n break;\n }\n }\n if(c+b==a){\n printf(\"%d %d %d\",b, k, c);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(c+a>b){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c<b){\n break;\n }\n }\n if(a+c==b){\n printf(\"%d %d %d\", a, c, k);\n }\n else{\n printf(\"Impossible\");\n }\n }\n }\n\n\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\nint main(){\n int a[4],i,j=0;\n a[0];\n scanf(\"%d %d %d\",&a[1],&a[2],&a[3]);\n int s=a[1]+a[2]+a[3];\n int mx=a[1],mxi=1;\n for(i=2;i<4;i++){\n if(mx<a[i]){\n mx=a[i];\n mxi=i;\n }\n }\n int b[3];\n j=s-mx;\n if(s%2 || mx>j)\n printf(\"Impossible\\n\");\n else{\n j=s-(2*mx);\n j/=2;\n if(mxi==1){\n b[1]=j;\n b[0]=a[2]-j;\n b[2]=a[3]-j;\n }\n else if(mxi==2){\n b[2]=j;\n b[0]=a[1]-j;\n b[1]=a[3]-j;\n }\n else{\n b[0]=j;\n b[1]=a[2]-j;\n b[2]=a[1]-j;\n }\n for(i=0;i<3;i++)\n printf(\"%d \",b[i]);\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,bond12,bond13,bond23,bond32,i,flag=0,cnt;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=0;i<=a;i++)\n {\n bond12=i;\n bond13=a-i;\n bond23=b-bond12;\n bond32=c-bond13;\n if((bond23==bond32)&&(bond23>=0))\n {\n cnt=0;\n if(bond12)\n cnt++;\n if(bond23)\n cnt++;\n if(bond13)\n cnt++;\n if(cnt>1)\n {\n flag=1;\n break;\n }\n }\n }\n if(flag)\n printf(\"%d %d %d\",bond12,bond23,bond13);\n else \n printf(\"Impossible\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint a,b,c,maxe;\nint s,t,i,check;\nint main()\n{\n\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n molecule(a,b,maxe);\n\n }\n else\n {\n maxe=a;\n molecule(b,c,maxe);\n }\n }\n else if(b>=a)\n {\n if(c>=b)\n {\n\n\n maxe=c;\n molecule(a,b,maxe);\n }\n else\n {\n maxe=b;\n molecule(a,c,maxe);\n }\n }\n return 0;\n}\n molecule(int u,int v,int muxe)\n {\n check=1;\n for(i=0;i<=muxe;i++)\n {\n\n s=u-i;\n t=v-(muxe-i);\n if(s==t)\n {\n if(i>=0&&(muxe-i)>=0&&s>=0){\n out(i,muxe-i,s);\n check=0;\n }\n }\n\n\n }\n if(check)\n printf(\"Impossible\");\n }\n int out(int x,int y,int z)\n {\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=a;\n printf(\"%d \",x);\n printf(\"%d \",z);\n printf(\"%d \",y);\n\n }\n }\n else if(b>=a)\n {\n\n if(c>=b)\n {\n\n\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=b;\n printf(\"%d \",x);\n printf(\"%d \",y);\n printf(\"%d \",z);\n }\n }\n return 0;\n }\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\nint a,b,c;\nint main(){\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif((a+b+c)%2==0 && a+b>=c && a+c>=b && b+c>=a){\n\t\tprintf(\"%d %d %d\\n\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n\t}\n\telse printf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int x,y,z;\n if(a+b-c>=0&&(a+b-c)%2==0){\n x=(a+b-c)/2;\n y=a-x;\n z=c-y;\n if(y>=0&&z>=0){\n printf(\"%d %d %d\",x,z,y);\n }\n else printf(\"Impossible\");\n }\n else printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int a,b,c,x,m,arr[3],i,j,y;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b+c||b>a+c||c>a+b){\n printf(\"Impossible\\n\");\n return 0;\n }\n arr[0]=a;arr[1]=b;arr[2]=c;\n for(i=1;i<=2;i++)\n for(j=0;j<=2-i;j++)\n {\n\n if(arr[j+1]<arr[j])\n {\n x=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=x;\n }\n }\n x=(arr[1]+arr[0]-arr[2]);\n y=x/2;\n //printf(\"%d\\n\",y);\n if(x%2!=0||arr[1]+arr[0]-2*y!=arr[2]){\n printf(\"Impossible\\n\");\n return 0;\n }\n if(arr[2]==c){\n printf(\"%d %d %d\\n\",y,b-y,a-y);\n }\n else if(arr[2]==a){\n printf(\"%d %d %d\\n\",b-y,y,c-y);\n }\n else if(arr[2]==b){\n printf(\"%d %d %d\\n\",a-y,c-y,y);\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a, b, c;\n\tint x, y, z;\n\tint i;\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\tif(a>=b&&c>=b){\n\t\tif(c>=a){\n\t\tx=b;\n\t\ty=0;\n\t\tz=0;\n\t\tfor(i=1; i<=b; i++){\n\t\t\ty++;\n\t\t\tz++;\n\t\t\tx--;\n\t\t\tif((a-x)==(c-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, y, a-x);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}}else{\n\t\tx=0;\n\t\ty=b;\n\t\tz=0;\n\t\tfor(i=1; i<=b; i++){\n\t\t\ty--;\n\t\t\tz++;\n\t\t\tx++;\n\t\t\tif((a-x)==(c-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, y, a-x);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t}\n\t}\n\tif(c>=a&&b>=a){\n\t\tif(b>=c){\n\t\t\tx=0;\n\t\t\ty=0;\n\t\t\tz=a;\n\t\tfor(i=1; i<=a; i++){\n\t\t\ty++;\n\t\t\tz--;\n\t\t\tx++;\n\t\t\tif((b-x)==(c-z)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, b-x, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t}else{\n\t\t\tx=a;\n\t\t\ty=0;\n\t\t\tz=0;\n\t\tfor(i=1; i<=a; i++){\n\t\t\ty++;\n\t\t\tz++;\n\t\t\tx--;\n\t\t\tif((b-x)==(c-z)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, b-x, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t}\n\t}\n\tif(b>=c&&a>=c){\n\t\tif(a>=b){\n\t\tx=0;\n\t\ty=c;\n\t\tz=0;\n\t\tfor(i=1; i<=c; i++){\n\t\t\ty--;\n\t\t\tz++;\n\t\t\tx++;\n\t\t\tif((a-z)==(b-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", a-z, y, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}}else{\n\t\tx=0;\n\t\ty=0;\n\t\tz=c;\n\t\tfor(i=1; i<=c; i++){\n\t\t\ty++;\n\t\t\tz--;\n\t\t\tx++;\n\t\t\tif((a-z)==(b-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", a-z, y, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,bond12,bond13,bond23,bond32,i,flag=0,cnt;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=0;i<=a;i++)\n {\n bond12=i;\n bond13=a-i;\n bond23=b-bond12;\n bond32=c-bond13;\n if((bond23==bond32)&&(bond23>=0))\n {\n cnt=0;\n if(bond12)\n cnt++;\n if(bond23)\n cnt++;\n if(bond13)\n cnt++;\n if(cnt>1)\n {\n flag=1;\n break;\n }\n }\n }\n if(flag)\n printf(\"%d %d %d\",bond12,bond23,bond13);\n else \n printf(\"Impossible\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a || (a+b+c)%2 == 1){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,y,z,a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a==0 || b==0 || c==0)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}\n\t/*if(a>12 || b>12 || c>12)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}*/\n\tif((a+b+c)%2!=0)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\tif(x<0 || y<0 || z<0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\t\n\tif(x==0 && y==0 && z==0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\tif(x==0 && y==0 || x==0 && z==0 && y==0 && z==0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\telse\n\t\tprintf(\"%d %d %d\",x,y,z);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a || (a+b+c)%2 == 1){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,a1,b1,c1,i,j,k,state=0;\n scanf(\"%d%d%d\", &a1, &b1, &c1);\n if((a1+b1-c1)/2<0 || (b1+c1-a1)/2<0 || (c1+a1-b1)/2<0 || (a1+b1-c1)%2!=0 || (b1+c1-a1)%2!=0 || (c1+a1-b1)%2!=0)\n state=1;\n if(state==0)\n printf(\"%d %d %d\\n\", (a1+b1-c1)/2, (b1+c1-a1)/2, (c1+a1-b1)/2);\n else\n printf(\"Impossible\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\n\tint n1,n2,n3;\n\tint x;\n\tscanf(\"%d%d%d\",&n1,&n2,&n3);\n\tx=(n1+n2-n3)/2;\n\tif((n1+n2-n3)%2==0)\n\t{\n\t\tif((x>=0)&&((n2-x)>=0)&&((n1-x)>=0))\n\t\t{\n\t\t\tif((x>0||(n2-x)>0)&&(x>0||(n1-x)>0)&&((n1-x)>0||((n2-x)>0)))\n\t\t\t{\n\t\t\t\tprintf(\"%d %d %d\\n\",x,n2-x,n1-x);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\tif((a+b+c)%2!=0)\n\tprintf(\"Impossible\");\n\telse\n\t{\n\tif(x>=0&&y>=0&&z>=0)\n\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\tprintf(\"Impossible\");\n\t}\n\treturn 0;\n } \n\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:14/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n\nint main()\n{\n ll a,b,c;\n SC3(a,b,c);\n if((a+b+c)%2!=0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n ll x,y,z;\n x=(b+a-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x<0 ||y<0 || z<0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n PF3(x,y,z);\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "/*\n * =====================================================================================\n *\n * Filename: 344b.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: Saturday 14 December 2013 11:35:01 IST\n * Revision: none\n * Compiler: gcc\n *\n * Author: SUDARSHAN (), \n * Organization: BITS PILANI, HYDERABAD\n *\n * =====================================================================================\n */\n#include<stdio.h>\nint main(void)\n{\n\n long int a,b,c;\n scanf(\"%ld %ld %ld\",&a,&b,&c);\n \n long int n1,n2,n3;\n n1=( a+b-c)/2;\n n3=(b-n1);\n n2=(a-b+c)/2;\n\n if (n1>=0 && n2>=0 && n3>=0 && 2*(n1+n3+n2)==(a+b+c))\n printf(\"%ld %ld %ld\",n1,n3,n2);\n else\n printf(\"Impossible\");\nreturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint count=0;\n\tif(x==0)count++;\n\tif(y==0)count++;\n\tif(z==0)count++;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%2;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tflag=1;\n\t}\n\tif((res1>2 && x1!=0) || (res2>2 && y1!=0) || (res3>2 && z1!=0))\n\t\tflag=1;\n\tif(count>1)\n\t\tflag=1;\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\t{\n\t\tprintf(\"Impossible\");\n\t\t//printf(\"%d %d %d\",x,y,z);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a1,a2,a3;\n scanf(\"%d %d %d\",&a1,&a2,&a3);\n if (a1+a2-a3 < 0 || a1+a3-a2 < 0 || a2+a3-a1 < 0 || (a1+a2+a3)%2 != 0)\n printf(\"Impossible\");\n else\n printf(\"%d %d %d\",(a1+a2-a3)/2,(a2+a3-a1)/2,(a1+a3-a2)/2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a1,b1,c1,k,i,j,z;\n\tscanf(\"%d%d%d\",&a1,&b1,&c1);\n\tz=0;\n\tif(a1>(b1+c1)) z=2;\n\tif(b1>(a1+c1)) z=2;\n\tif(c1>(a1+b1)) z=2;\t\n\tif(z==0)\n\t{\n\t\ti=(a1+b1-c1)/2;\n\t\tk=(a1+c1-b1)/2;\n\t\tj=(c1+b1-a1)/2;\n\t\tif (a1==(i+k) && b1==(i+j) && c1==(j+k)) z=1;\n\t}\n\tif (z==1) printf(\"%d %d %d\",i,j,k);\n\telse printf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n int a,b,c,ans,i,j,x,y,z,max;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b+c || b>a+c || c>a+b || (a+b+c)%2!=0)\n printf(\"Impossible\");\n else\n {\n \n if(b>a && b>c)\n max=b;\n else if(a>b && a>c)\n max=a;\n else\n max=c;\n \n if(max==a)\n {\n y=(b+c-a)/2;\n x=b-y;\n z=c-y;\n //printf(\"a\");\n }\n else if(max==b)\n {\n z=(a+c-b)/2;\n x=a-z;\n y=c-z;\n //printf(\"b\");\n }\n else if(max==c)\n {\n x=(a+b-c)/2;\n z=a-x;\n y=b-x;\n //printf(\"c\");\n }\n printf(\"%d %d %d\",x,y,z);\n }\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#define N 15\nint main()\n{\n int a,b,c,x,y,z;\n while(scanf(\"%d%d%d\",&a,&b,&c)!=EOF)\n {\n x=a+b-c;\n y=b+c-a;\n z=a+c-b;\n if(x%2==0&&y%2==0&&z%2==0&&x>=0&&y>=0&&z>=0)\n printf(\"%d %d %d\\n\",x/2,y/2,z/2);\n else\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[3],i,j,temp,p,q,r,flag,num;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tnum=a[0];\n\tflag=0;\n\twhile(num>=0&&flag==0)\n\t{\n\t\tp=num;\n\t\tq=a[1]-num;\n\t\tr=a[0]-num;\n\t//\tprintf(\"%d %d %d\\n\",p,q,r);\n\t\tif(q+r==a[2]&&q>=0)\n\t\t{\n\t\t\tflag=1;\n\t\t\tprintf(\"%d %d %d\\n\",p,q,r);\n\t\t}\n\t\tnum--;\n\t}\n\tif(flag==0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(abs(c-a-b)%2 == 0 && abs(b-c-a)%2 == 0 && abs(c-a-b)%2 == 0)\n\t{\n\t\tx = (c-a-b)/(-2);\n\t\ty = (b-c-a)/(-2);\n\t\tz = (a-b-c)/(-2);\n\t\tif(x >= 0 && y >= 0 && z >= 0)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",x,z,y);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Impossible\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i,otw,oth,twth;\n scanf(\"%d %d %d\",&a,&b,&c);\n for(i=0;i<=a;i++)\n {\n\totw=i;\n\ttwth=c-a+i;\n\toth=a-i;\n\n\tif(b-(otw+twth)==0 && otw>=0 && twth>=0 && oth>=0)\n\t{\n\t printf(\"%d %d %d\\n\",otw,twth,oth);\n\t break;\n\t}\n }\n if(i>a)\n\tprintf(\"Impossible\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,y,z,a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a==0 || b==0 || c==0)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}\n\t/*if(a>12 || b>12 || c>12)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}*/\n\tif((a+b+c)%2!=0)\n\t{\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\tif(x<0 || y<0 || z<0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\t\n\tif(x==0 && y==0 && z==0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\tif(x==0 && y==0 || x==0 && z==0 && y==0 && z==0){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;}\n\telse\n\t\tprintf(\"%d %d %d\",x,y,z);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint vraie (int m1,int m4 ,int m3 ){\n if ((m4+m3>=m1)&&((m4+m3-m1)%2==0)){\n return 1 ;\n }\n else {\n return 0;\n }\n }\nvoid aff (int h ,int tab1[4], int tab [4]){\n int h1 = (h+2)%3 ;\n int h2 = (h+1)%3 ;\n int c =(tab1[h1]+tab1[h2]-tab1[h])/2 ;\n tab[h]=tab1[h2]-c ;\n tab[h1]=tab1[h1]-c ;\n tab[h2]=c ;\n printf(\"%d %d %d\",tab[0],tab[1],tab[2]) ;\n\n\n\n\n}\nint main()\n{\n int a,b,c,h ;\n int tab1[4] ;\n int tab[4] ;\n scanf(\"%d %d %d\",&a,&b,&c) ;\n tab1[0]=a ;\n tab1[1]=b ;\n tab1[2]=c ;\n if ((a<=b)&&(b<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n else if ((b<=a)&&(a<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n } else {\n printf(\"Impossible\") ;\n }\n }\n\n\n else if ((b<=c)&&(c<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n\n\n else if ((c<=b)&&(b<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else if ((c<=a)&&(a<=b)){\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else {\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a,b,c;\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n int K = (a+b-c)/2;\n int K2 = (b+c-a)/2;\n if(K >= 0 && K2>= 0 && a- K >=0 && 2*(K + K2 + (a - K)) == (a + b + c))\n {\n printf(\"%d %d %d\\n\",K,K2,a-K);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n int x,y,z;\n if(a+b-c>=0&&(a+b-c)%2==0){\n x=(a+b-c)/2;\n y=a-x;\n z=c-y;\n if(y>=0&&z>=0){\n printf(\"%d %d %d\",x,z,y);\n }\n else printf(\"Impossible\");\n }\n else printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint va,vb,vc,nab,nbc,nca;\nscanf(\"%d %d %d\",&va,&vb,&vc);\nnab=(va+vb-vc)/2;\nnbc=(vb+vc-va)/2;\nnca=(vc+va-vb)/2;\nif((va+vb+vc)%2!=0)\nprintf(\"Impossible\\n\");\nelse if(nab<0||nbc<0||nca<0)\nprintf(\"Impossible\\n\");\nelse if(nab==0&&nbc==0||nbc==0&&nca==0||nca==0&&nab==0)\nprintf(\"Impossible\\n\");\nelse\nprintf(\"%d %d %d\\n\",nab,nbc,nca);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(abs(c-a-b)%2 == 0 && abs(b-c-a)%2 == 0 && abs(c-a-b)%2 == 0)\n\t{\n\t\tx = (c-a-b)/(-2);\n\t\ty = (b-c-a)/(-2);\n\t\tz = (a-b-c)/(-2);\n\t\tif(x >= 0 && y >= 0 && z >= 0)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",x,z,y);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Impossible\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint max3 (int a, int b, int c);\n\nint main ()\n{\n int b, c, d, e, i, j, g, temp, total;\n scanf (\"%d\", &c);\n scanf (\"%d\", &d);\n scanf (\"%d\", &e);\n total = (c + d + e) / 2;\n b = max3(c, d, e);\n if ( ((2*b - c - d - e) > -2) && ((2*b - c - d - e) != 0))\n {\n printf (\"Impossible\\n\");\n }\n else\n {\n if ((2*b - c - d - e) % -2 < 0)\n {\n printf (\"Impossible\\n\");\n }\n else\n {\n printf (\"%d %d %d\\n\", (total - e), (total - c), (total - d));\n }\n }\nreturn 0;\n}\nint max3 (int c, int d, int e)\n{\n if (c > d)\n {\n if ( c > e)\n {\n return c;\n }\n else\n {\n return e;\n }\n }\n else\n {\n if (d > e)\n {\n return d;\n }\n else\n {\n return e;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint x,y,z;\n\tx=(b+c-a)/2;\n\ty=(a+c-b)/2;\n\tz=(a+b-c)/2;\n\tif(a+b-c>=0&&b+c-a>=0&&a+c-b>=0&&(a+b-c)%2==0&&(b+c-a)%2==0&&(a+c-b)%2==0)\n\tprintf(\"%d %d %d\",z,x,y);\n\telse\n\t\tprintf(\"Impossible\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\nint main(){\n int a[4],i,j=0;\n a[0];\n scanf(\"%d %d %d\",&a[1],&a[2],&a[3]);\n int s=a[1]+a[2]+a[3];\n int mx=a[1],mxi=1;\n for(i=2;i<4;i++){\n if(mx<a[i]){\n mx=a[i];\n mxi=i;\n }\n }\n int b[3];\n j=s-mx;\n if(s%2 || mx>j)\n printf(\"Impossible\\n\");\n else{\n j=s-(2*mx);\n j/=2;\n if(mxi==1){\n b[1]=j;\n b[0]=a[2]-j;\n b[2]=a[3]-j;\n }\n else if(mxi==2){\n b[2]=j;\n b[0]=a[1]-j;\n b[1]=a[3]-j;\n }\n else{\n b[0]=j;\n b[1]=a[2]-j;\n b[2]=a[1]-j;\n }\n for(i=0;i<3;i++)\n printf(\"%d \",b[i]);\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c); int order;\n if(a==0 || b==0 || c==0){\n printf(\"Impossible\");\n return 0;\n }\n int max=a;\n order=1;\n if(b>max){\n max=b; order=2;}\n if(c>max){\n max=c; order=3;}\n int i;\n for(i=0;i<=max;i++){\n if(order==1 && (b-i)==(c-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,b-i,max-i);\n return 0;\n }\n if(order==1 && (c-i)==(b-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,b-i,i);\n return 0;\n }\n if(order==2 && (a-i)==(c-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n if(order==2 && (c-i)==(a-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,i,c-i);\n return 0;\n }\n if(order==3 && (a-i)==(b-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (b-i)==(a-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",b-i,i,max-i);\n return 0;\n }\n }\n printf(\"Impossible\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long a,b,c,m,n,i,j,cnt,k,a1,a2,a3;\nscanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n \nfor(i=0;i<=a;i++)\n{\nif((a+b+c)==2*(b+a-i))\n{cnt=1; break;}\nelse\ncnt=0;\n}\na1=i; a2=b-i; a3=a-i;\nif(cnt==1&&a1>-1&&a2>-1&&a3>-1)\nprintf(\"%I64d %I64d %I64d\",a1,a2,a3);\nelse\nprintf(\"Impossible\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint a1,a2,a0,x,y,z;\nscanf(\"%d\",&a0);\n\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nx=(a0-a2+a1);\ny=(a1-a0+a2);\nz=(a2-a1+a0);\nif(x%2!=0 || y%2!=0 || z%2!=0){\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\nelse{\n\tx=x/2;\n\ty=y/2;\n\tz=z/2;\n\t}\n\nif(x==0 && y==0 && z==0)\n\nprintf(\"Impossible\\n\");\nelse if(x>=0 && y>=0 && z>=0)\nprintf(\"%d %d %d\\n\",x,y,z );\nelse \nprintf(\"Impossible\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, x, y, z, s;\n scanf(\"%d %d %d\", &a, &b, &c);\n s = a + b + c;\n if (s % 2)\n {\n printf(\"Impossible\");\n return 0;\n }\n s /= 2;\n if (s - c >= 0)\n x = s - c;\n else\n {\n printf(\"Impossible\");\n return 0;\n }\n if (s - a >= 0)\n y = s - a;\n else\n {\n printf(\"Impossible\");\n return 0;\n }\n if (s - b >= 0)\n z = s - b;\n else\n {\n printf(\"Impossible\");\n return 0;\n }\n printf(\"%d %d %d\", x, y, z);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\n\tint sum = 0;\n\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\n\tsum = (a + b + c)/2;\n\n\tif((a + b + c) % 2 != 0 || sum - a < 0 || sum - b < 0 || sum - c < 0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",sum-c,sum-a,sum-b);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:14/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n\nint main()\n{\n ll a,b,c;\n SC3(a,b,c);\n if((a+b+c)%2!=0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n ll x,y,z;\n x=(b+a-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x<0 ||y<0 || z<0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n PF3(x,y,z);\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tlong long int x,y,z,d=0;\n\n\tx=(a+b-c);\n\ty=(b+c-a);\n\tz=(a+c-b);\n\tif(x%2==0 && y%2==0 && z%2==0)\n\t{x=x/2;\n\t\ty=y/2;\n\t\tz=z/2;\n\n\t}\n\telse\n\t\td=1;\n\n\tif(x==0 && y==0)\n\t\td=1;\n\tif(y==0 && z==0)\n\t\td=1;\n\tif(z==0 && x==0)\n\t\td=1;\n\n\tif(x>=0 && y>=0 && z>=0 && d==0)\n\t\tprintf(\"%lld %lld %lld\\n\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,i,j;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ti=a-b;\n\tif(i<0)i*=-1;\n\tj=a+b+c;\n\tif(c<i||c>a+b||j%2>0)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",j/2-c,j/2-a,j/2-b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint a1,a2,a0,x,y,z;\nscanf(\"%d\",&a0);\n\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nx=(a0-a2+a1);\ny=(a1-a0+a2);\nz=(a2-a1+a0);\nif(x%2!=0 || y%2!=0 || z%2!=0){\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\nelse{\n\tx=x/2;\n\ty=y/2;\n\tz=z/2;\n\t}\n\nif(x==0 && y==0 && z==0)\n\nprintf(\"Impossible\\n\");\nelse if(x>=0 && y>=0 && z>=0)\nprintf(\"%d %d %d\\n\",x,y,z );\nelse \nprintf(\"Impossible\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong a[3],b,c,d;\nscanf(\"%ld%ld%ld\",&a[0],&a[1],&a[2]);\n\n\nif(a[0]+a[1]<a[2] || a[1]+a[2]<a[0] || a[2]+a[0]<a[1]){\n printf(\"Impossible\");\n return 0;\n }\n\nb=(a[0]+a[1]-a[2])/2;\nc=(a[1]+a[2]-a[0])/2;\nd=(a[0]+a[2]-a[1])/2;\nif((b+c+d)*2==(a[0]+a[1]+a[2]))\nprintf(\"%ld %ld %ld\",b,c,d);\nelse\nprintf(\"Impossible\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if((a+b+c)%2!=1&&(a+b>=c&&a+c>=b&&b+c>=a))\n printf(\"%d %d %d\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n else\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint va,vb,vc,nab,nbc,nca;\nscanf(\"%d %d %d\",&va,&vb,&vc);\nnab=(va+vb-vc)/2;\nnbc=(vb+vc-va)/2;\nnca=(vc+va-vb)/2;\nif((va+vb+vc)%2!=0)\nprintf(\"Impossible\\n\");\nelse if(nab<0||nbc<0||nca<0)\nprintf(\"Impossible\\n\");\nelse if(nab==0&&nbc==0||nbc==0&&nca==0||nca==0&&nab==0)\nprintf(\"Impossible\\n\");\nelse\nprintf(\"%d %d %d\\n\",nab,nbc,nca);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint count=0;\n\tif(x==0)count++;\n\tif(y==0)count++;\n\tif(z==0)count++;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%2;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tflag=1;\n\t}\n\tif((res1>2 && x1!=0) || (res2>2 && y1!=0) || (res3>2 && z1!=0))\n\t\tflag=1;\n\tif(count>1)\n\t\tflag=1;\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\t{\n\t\tprintf(\"Impossible\");\n\t\t//printf(\"%d %d %d\",x,y,z);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:14/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n\nint main()\n{\n ll a,b,c;\n SC3(a,b,c);\n if((a+b+c)%2!=0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n ll x,y,z;\n x=(b+a-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x<0 ||y<0 || z<0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n PF3(x,y,z);\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,b,c,i,k,x,y,z;\n scanf(\"%ld %ld %ld\",&a,&b,&c);\n if(a>b+c||b>a+c||c>a+b)\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n for(i=0;i<=a;i++)\n {\n if(b-i==c-(a-i))\n {\n break;\n }\n }\n if(i>a)\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n printf(\"%ld %ld %ld\\n\",i,b-i,a-i);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int a,b,c,i,flg,S,ans[3]={0};\n scanf(\"%d %d %d\",&a,&b,&c);\n S=a+b+c;\n flg=0;\n if(S%2) puts(\"Impossible\");\n else{\n S/=2;\n ans[0]=S-c;\n ans[1]=S-a;\n ans[2]=S-b;\n for(i=0;i<3;i++){\n if(ans[i]<0){\n\tputs(\"Impossible\");\n\tflg=1;\n\tbreak;\n }\n }\n if(!flg) printf(\"%d %d %d\\n\",ans[0],ans[1],ans[2]);\n }\n return 0;\n}\n\n \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint vraie (int m1,int m2 ,int m4 ){\n if ((m2+m4>=m1)&&((m2+m4-m1)%2==0)){\n return 1 ;\n }\n else {\n return 0;\n }\n }\nvoid aff (int h ,int tab1[4], int tab [4]){\n int h1 = (h+2)%3 ;\n int h2 = (h+1)%3 ;\n int c =(tab1[h1]+tab1[h2]-tab1[h])/2 ;\n tab[h]=tab1[h2]-c ;\n tab[h1]=tab1[h1]-c ;\n tab[h2]=c ;\n printf(\"%d %d %d\",tab[0],tab[1],tab[2]) ;\n\n\n\n\n}\nint main()\n{\n int a,b,c,h ;\n int tab1[4] ;\n int tab[4] ;\n scanf(\"%d %d %d\",&a,&b,&c) ;\n tab1[0]=a ;\n tab1[1]=b ;\n tab1[2]=c ;\n if ((a<=b)&&(b<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n else if ((b<=a)&&(a<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n } else {\n printf(\"Impossible\") ;\n }\n }\n\n\n else if ((b<=c)&&(c<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n\n\n else if ((c<=b)&&(b<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else if ((c<=a)&&(a<=b)){\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else {\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int v_a, v_b, v_c;\n int x, y, z;\n\n scanf(\"%d\", &v_a);\n scanf(\"%d\", &v_b);\n scanf(\"%d\", &v_c);\n\n x = (v_a + v_b - v_c) / 2;\n y = (v_b + v_c - v_a) / 2;\n z = (v_c + v_a - v_b) / 2;\n\n if ((x < 0) || (y < 0) || (z < 0) || ((v_a + v_b - v_c) % 2 == 1) ||\n ((v_b + v_c - v_a) % 2 == 1) || ((v_c + v_a - v_b) % 2 == 1)) {\n printf(\"Impossible\\n\");\n } else {\n printf(\"%d %d %d \\n\", x, y, z);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, b, c, x;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tfor (x = 0; x <= a; x++)\n\t\tif (b >= a - x && x + (b - (a - x)) == c && c >= x && (a - x) + (c - x) == b) {\n\t\t\tprintf(\"%d %d %d\\n\", a - x, c - x, x);\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a1,b1,c1,k,i,j,z;\n\tscanf(\"%d%d%d\",&a1,&b1,&c1);\n\tz=0;\n\tif(a1>(b1+c1)) z=2;\n\tif(b1>(a1+c1)) z=2;\n\tif(c1>(a1+b1)) z=2;\t\n\tif(z==0)\n\t{\n\t\ti=(a1+b1-c1)/2;\n\t\tk=(a1+c1-b1)/2;\n\t\tj=(c1+b1-a1)/2;\n\t\tif (a1==(i+k) && b1==(i+j) && c1==(j+k)) z=1;\n\t}\n\tif (z==1) printf(\"%d %d %d\",i,j,k);\n\telse printf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a, b, c, i, j, k=0, aray[3], mx, mn, md;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==b && b==c){\n if(a%2==1) printf(\"Impossible\");\n else printf(\"%d %d %d\",a/2, a/2, a/2);\n return 0;\n }\n else if(a+b==c){\n printf(\"%d %d %d\", 0, b, a);\n }\n else if(b+c==a){\n printf(\"%d %d %d\", b, 0, c);\n }\n else if(c+a==b){\n printf(\"%d %d %d\", a, c, 0);\n }\n else{\n aray[0]=a;\n aray[1]=b;\n aray[2]=c;\n for(i=1;i<3;i++){\n j=i;\n while(j>0 && aray[j]<aray[j-1]){\n aray[j]^=aray[j-1];\n aray[j-1]^=aray[j];\n aray[j]^=aray[j-1];\n j--;\n }\n }\n mx=aray[2];\n mn=aray[0];\n md=aray[1];\n if(mn+md<mx){\n printf(\"Impossible\");\n return 0;\n }\n else{\n if(a+b>c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+b<c){\n break;\n }\n }\n if(a+b==c){\n printf(\"%d %d %d\", k, b, a);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(b+c>a){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+b<a){\n break;\n }\n }\n if(c+b==a){\n printf(\"%d %d %d\",b, k, c);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(c+a>b){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c<b){\n break;\n }\n }\n if(a+c==b){\n printf(\"%d %d %d\", a, c, k);\n }\n else{\n printf(\"Impossible\");\n }\n }\n }\n\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,c,i;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tfor(i=0;i<=a;++i)\n\t{\n\t\tif(b-i==c-a+i&&(b-i)>=0&&(c-a+i)>=0)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",i,b-i,a-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long a,b,c,m,n,i,j,cnt,k,a1,a2,a3;\nscanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n \nfor(i=0;i<=a;i++)\n{\nif((a+b+c)==2*(b+a-i))\n{cnt=1; break;}\nelse\ncnt=0;\n}\na1=i; a2=b-i; a3=a-i;\nif(cnt==1&&a1>-1&&a2>-1&&a3>-1)\nprintf(\"%I64d %I64d %I64d\",a1,a2,a3);\nelse\nprintf(\"Impossible\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n double p,q,r;\n scanf(\"%d%d%d\",&a,&b,&c);\n p = (c-b+a)%2;\n q = (b-a+c)%2;\n r = (a-c+b)%2;\n if(p!= 0 || q!= 0 || r != 0 || (a-c+b)/2 < 0 || (b-a+c)/2 < 0 || (c-b+a)/2 < 0)\n printf(\"Impossible\\n\");\n else\n printf(\"%d %d %d\\n\",(a-c+b)/2,(b-a+c)/2,(c-b+a)/2);\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint vraie (int m1,int m2 ,int m3 ){\n if ((m2+m3>=m1)&&((m2+m3-m1)%2==0)){\n return 1 ;\n }\n else {\n return 0;\n }\n }\nvoid aff (int h ,int tab1[4], int tab [4]){\n int h1 = (h+2)%3 ;\n int h2 = (h+1)%3 ;\n int c =(tab1[h1]+tab1[h2]-tab1[h])/2 ;\n tab[h]=tab1[h2]-c ;\n tab[h1]=tab1[h1]-c ;\n tab[h2]=c ;\n printf(\"%d %d %d\",tab[0],tab[1],tab[2]) ;\n\n\n\n\n}\nint main()\n{\n int a,b,c,h ;\n int tab1[4] ;\n int tab[4] ;\n scanf(\"%d %d %d\",&a,&b,&c) ;\n tab1[0]=a ;\n tab1[1]=b ;\n tab1[2]=c ;\n if ((a<=b)&&(b<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n else if ((b<=a)&&(a<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n } else {\n printf(\"Impossible\") ;\n }\n }\n\n\n else if ((b<=c)&&(c<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n\n\n else if ((c<=b)&&(b<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else if ((c<=a)&&(a<=b)){\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else {\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n return 0;\n}"}, {"source_code": "/*Codeforces Round #200 (Div. 2) B. Simple Molecules*/\n#include <stdio.h>\nint Max(int a[],int n);\nint main()\n{\n int a[4],x,y,z,i,max,min;\n for (i=1;i<=3;i++)\n scanf (\"%d\",&a[i]);\n max=Max(a,3);\n i=0;\n for (x=0;x<max&&i==0;x++)\n {\n y=a[2]-x;\n z=a[1]-x;\n if (z+y==a[3]&&y>=0&&z>=0)\n {\n printf (\"%d %d %d\\n\",x,y,z);\n i=1;\n }\n }\n if (i==0)\n printf (\"Impossible\\n\");\n return 0;\n}\nint Max(int a[],int n)\n{\n int max=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (max<a[i])\n max=a[i];\n }\n return max;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{long long a,b,c,m,n,i,j,cnt,k,a1,a2,a3;\nscanf(\"%I64d%I64d%I64d\",&a,&b,&c);\n \nfor(i=0;i<=a;i++)\n{\nif((a+b+c)==2*(b+a-i))\n{cnt=1; break;}\nelse\ncnt=0;\n}\na1=i; a2=b-i; a3=a-i;\nif(cnt==1&&a1>-1&&a2>-1&&a3>-1)\nprintf(\"%I64d %I64d %I64d\",a1,a2,a3);\nelse\nprintf(\"Impossible\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#define N 15\nint main()\n{\n int a,b,c,x,y,z;\n while(scanf(\"%d%d%d\",&a,&b,&c)!=EOF)\n {\n x=a+b-c;\n y=b+c-a;\n z=a+c-b;\n if(x%2==0&&y%2==0&&z%2==0&&x>=0&&y>=0&&z>=0)\n printf(\"%d %d %d\\n\",x/2,y/2,z/2);\n else\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\nint a,b,c, semisuma, a_b, b_c, c_a;\nscanf(\"%d %d %d\", &a,&b,&c);\nsemisuma=(a+b+c)/2;\n\nb_c=semisuma-a;\na_b=semisuma-c;\nc_a=semisuma-b;\n\nif ((a+b+c)%2 || b_c<0 || a_b<0 || c_a<0) printf(\"Impossible\"); \nelse printf(\"%d %d %d\", a_b,b_c,c_a);\n\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,i,j;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ti=a-b;\n\tif(i<0)i*=-1;\n\tj=a+b+c;\n\tif(c<i||c>a+b||j%2>0)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",j/2-c,j/2-a,j/2-b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,c,x,y,z;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if((a+b+c)%2==0)\n {\n x=(a+b-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x>=0 && y>=0 && z>=0)\n printf(\"%lld %lld %lld\\n\",x,y,z);\n else\n printf(\"Impossible\\n\");\n }\n else\n printf(\"Impossible\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a1,b1,c1,k,i,j,z;\n\tscanf(\"%d%d%d\",&a1,&b1,&c1);\n\tz=0;\n\tif(a1>(b1+c1)) z=2;\n\tif(b1>(a1+c1)) z=2;\n\tif(c1>(a1+b1)) z=2;\t\n\tif(z==0)\n\t{\n\t\ti=(a1+b1-c1)/2;\n\t\tk=(a1+c1-b1)/2;\n\t\tj=(c1+b1-a1)/2;\n\t\tif (a1==(i+k) && b1==(i+j) && c1==(j+k)) z=1;\n\t}\n\tif (z==1) printf(\"%d %d %d\",i,j,k);\n\telse printf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint vraie (int m1,int m4 ,int m3 ){\n if ((m4+m3>=m1)&&((m4+m3-m1)%2==0)){\n return 1 ;\n }\n else {\n return 0;\n }\n }\nvoid aff (int h ,int tab1[4], int tab [4]){\n int h1 = (h+2)%3 ;\n int h2 = (h+1)%3 ;\n int c =(tab1[h1]+tab1[h2]-tab1[h])/2 ;\n tab[h]=tab1[h2]-c ;\n tab[h1]=tab1[h1]-c ;\n tab[h2]=c ;\n printf(\"%d %d %d\",tab[0],tab[1],tab[2]) ;\n\n\n\n\n}\nint main()\n{\n int a,b,c,h ;\n int tab1[4] ;\n int tab[4] ;\n scanf(\"%d %d %d\",&a,&b,&c) ;\n tab1[0]=a ;\n tab1[1]=b ;\n tab1[2]=c ;\n if ((a<=b)&&(b<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n else if ((b<=a)&&(a<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n } else {\n printf(\"Impossible\") ;\n }\n }\n\n\n else if ((b<=c)&&(c<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n\n\n else if ((c<=b)&&(b<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else if ((c<=a)&&(a<=b)){\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else {\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n return 0;\n}"}, {"source_code": "//molecules.c\n#include<stdio.h>\n#include<limits.h>\nint func(int a,int b,int max)\n{\n int count=0;\n int sum=a+b;\n while(1)\n {\n if(sum==max)\n break;\n else\n {\n count++;\n sum-=2;\n if(sum<max)\n {\n\n printf(\"Impossible\\n\");\n return ;\n }\n\n }\n }\n return count;\n\n}\nint main()\n{\n int a[3];\n int b[3]={0};\n int i,sum=0,max=INT_MIN,sumleft;\n int index;\n for(i=0;i<3;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(max<a[i])\n {\n max=a[i];\n index=i;\n }\n\n }\n sumleft=sum-max;\n if(sum%2==1|| sumleft<max)\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n int one,two,id;\n switch(index)\n {\n\n case 0 :\n one=a[1];\n two=a[2];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",a[1]-id,id,a[2]-id);\n break;\n\n case 1: one=a[0];\n two=a[2];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",a[0]-id,a[2]-id,id);\n break;\n case 2: one=a[0];\n two=a[1];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",id,a[1]-id,a[0]-id);\n break;\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint count=0;\n\tif(x==0)count++;\n\tif(y==0)count++;\n\tif(z==0)count++;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%2;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tflag=1;\n\t}\n\tif((res1>2 && x1!=0) || (res2>2 && y1!=0) || (res3>2 && z1!=0))\n\t\tflag=1;\n\tif(count>1)\n\t\tflag=1;\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\t{\n\t\tprintf(\"Impossible\");\n\t\t//printf(\"%d %d %d\",x,y,z);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "/*\n * =====================================================================================\n *\n * Filename: 344b.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: Saturday 14 December 2013 11:35:01 IST\n * Revision: none\n * Compiler: gcc\n *\n * Author: SUDARSHAN (), \n * Organization: BITS PILANI, HYDERABAD\n *\n * =====================================================================================\n */\n#include<stdio.h>\nint main(void)\n{\n\n long int a,b,c;\n scanf(\"%ld %ld %ld\",&a,&b,&c);\n \n long int n1,n2,n3;\n n1=( a+b-c)/2;\n n3=(b-n1);\n n2=(a-b+c)/2;\n\n if (n1>=0 && n2>=0 && n3>=0 && 2*(n1+n3+n2)==(a+b+c))\n printf(\"%ld %ld %ld\",n1,n3,n2);\n else\n printf(\"Impossible\");\nreturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,i,x,y,z,max,flag=0;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(a >= b && a >= c) max=a;\n\tif(b >= a && b >= c) max=b;\n\tif(c >= a && c >= b) max=c;\n//\tprintf(\"max is %d\\n\",max);\n\tfor(i=0;i<max;i++)\n\t{\n\t//printf(\"1 %d %d\\n\",b-1,a-1);\n\t\tx=i;\n\t\ty=b-i;\n\t\tz=a-i;\n\t\tif(y+z == c)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(x>=0 && y>=0 && z>=0 && flag==1)\n\t\tprintf(\"%d %d %d\\n\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n \n scanf(\"%d %d %d\",&a,&b,&c);\n \n if( ((a+b-c)/2)<0 || ((-a+b+c)/2)<0 || ((a-b+c)/2)<0 || (a+b+c)%2 ){\n printf(\"Impossible\");\n }\n else{\n printf(\"%d %d %d\\n\",(a+b-c)/2,(-a+b+c)/2,(a-b+c)/2);\n }\nreturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a,b,c;\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n int K = (a+b-c)/2;\n int K2 = (b+c-a)/2;\n if(K >= 0 && K2>= 0 && a- K >=0 && 2*(K + K2 + (a - K)) == (a + b + c))\n {\n printf(\"%d %d %d\\n\",K,K2,a-K);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\n\tint n1,n2,n3;\n\tint x;\n\tscanf(\"%d%d%d\",&n1,&n2,&n3);\n\tx=(n1+n2-n3)/2;\n\tif((n1+n2-n3)%2==0)\n\t{\n\t\tif((x>=0)&&((n2-x)>=0)&&((n1-x)>=0))\n\t\t{\n\t\t\tif((x>0||(n2-x)>0)&&(x>0||(n1-x)>0)&&((n1-x)>0||((n2-x)>0)))\n\t\t\t{\n\t\t\t\tprintf(\"%d %d %d\\n\",x,n2-x,n1-x);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tlong long int x,y,z,d=0;\n\n\tx=(a+b-c);\n\ty=(b+c-a);\n\tz=(a+c-b);\n\tif(x%2==0 && y%2==0 && z%2==0)\n\t{x=x/2;\n\t\ty=y/2;\n\t\tz=z/2;\n\n\t}\n\telse\n\t\td=1;\n\n\tif(x==0 && y==0)\n\t\td=1;\n\tif(y==0 && z==0)\n\t\td=1;\n\tif(z==0 && x==0)\n\t\td=1;\n\n\tif(x>=0 && y>=0 && z>=0 && d==0)\n\t\tprintf(\"%lld %lld %lld\\n\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char *argv[])\n{\n int a, b, c;\n int x, y, z;\n while(scanf(\"%d%d%d\",&a, &b, &c) != EOF)\n {\n for(x = 0 ; x <= a; x++)\n {\n y = b -x;\n if(y < 0)\n continue;\n if(c - y == a -x)\n {\n z = c - y; \n if(z < 0)\n continue; \n break;\n } \n }\n if(x > a)\n printf(\"Impossible\\n\");\n else\n printf(\"%d %d %d\\n\", x, y, z);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint vraie (int m1,int m4 ,int m3 ){\n if ((m4+m3>=m1)&&((m4+m3-m1)%2==0)){\n return 1 ;\n }\n else {\n return 0;\n }\n }\nvoid aff (int h ,int tab1[4], int tab [4]){\n int h1 = (h+2)%3 ;\n int h2 = (h+1)%3 ;\n int c =(tab1[h1]+tab1[h2]-tab1[h])/2 ;\n tab[h]=tab1[h2]-c ;\n tab[h1]=tab1[h1]-c ;\n tab[h2]=c ;\n printf(\"%d %d %d\",tab[0],tab[1],tab[2]) ;\n\n\n\n\n}\nint main()\n{\n int a,b,c,h ;\n int tab1[4] ;\n int tab[4] ;\n scanf(\"%d %d %d\",&a,&b,&c) ;\n tab1[0]=a ;\n tab1[1]=b ;\n tab1[2]=c ;\n if ((a<=b)&&(b<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n else if ((b<=a)&&(a<=c)){\n if (vraie(c,a,b)==1){\n h=2 ;\n\n aff(h,tab1,tab) ;\n } else {\n printf(\"Impossible\") ;\n }\n }\n\n\n else if ((b<=c)&&(c<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n\n\n else if ((c<=b)&&(b<=a)){\n if (vraie(a,c,b)==1){\n h=0 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else if ((c<=a)&&(a<=b)){\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n else {\n if (vraie(b,c,a)==1){\n h=1 ;\n\n aff(h,tab1,tab) ;\n }\n else {\n printf(\"Impossible\") ;\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint va,vb,vc,nab,nbc,nca;\nscanf(\"%d %d %d\",&va,&vb,&vc);\nnab=(va+vb-vc)/2;\nnbc=(vb+vc-va)/2;\nnca=(vc+va-vb)/2;\nif((va+vb+vc)%2!=0)\nprintf(\"Impossible\\n\");\nelse if(nab<0||nbc<0||nca<0)\nprintf(\"Impossible\\n\");\nelse if(nab==0&&nbc==0||nbc==0&&nca==0||nca==0&&nab==0)\nprintf(\"Impossible\\n\");\nelse\nprintf(\"%d %d %d\\n\",nab,nbc,nca);\nreturn 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h> \nint main() \n{ \n int x,y,z; \n scanf(\"%d%d%d\",&x,&y,&z); \n int a,b,c; \n a = (x+y-z)/2; \n b = (x+z-y)/2; \n c = (y+z-x)/2; \n if (a*b*c < 0 || (a==1 && b==1 && c==1)) \n printf(\"Impossible\"); \n else \n printf(\"%d %d %d\",a,b,c); \n return 0; \n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint n1, n2, n3;\n\tscanf(\"%d%d%d\", &n1, &n2, &n3);\n\tint b12=(n1+n2-n3)/2;\n\tif(b12<0)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\", b12, n2-b12, n1-b12);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint a[3],n[3],i,k,sum=0,c=0;\nfor(i=0;i<3;i++)\n{\nscanf(\"%d\",&a[i]);\nsum=sum+a[i];\n}\nsum=sum/2;\nfor(i=1;i<3;i++)\n{\nn[i]=sum-a[i-1];\n}\nn[0]=sum-a[2];\nfor(i=0;i<3;i++)\n{\nif(n[i]>a[i])\n{printf(\"Impossible\");\nreturn 0;}\nif(n[i]==0)\n\tc++;\n\n}\nif(c==3)\n\t{printf(\"Impossible\");\nreturn 0;}\nfor(i=0;i<3;i++)\nprintf(\"%d \",n[i]);\n\nreturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#define N 15\nint main()\n{\n int a,b,c,x,y,z;\n while(scanf(\"%d%d%d\",&a,&b,&c)!=EOF)\n {\n x=a+b-c;\n y=b+c-a;\n z=a+c-b;\n if(x%2==0&&y%2==0&&z%2==0&&x>=0&&y>=0&&z>=0)\n printf(\"%d %d %d\\n\",x/2,y/2,z/2);\n else\n printf(\"Impossib\\n\");\n }\n return 0;\n}\n"}, {"source_code": "int main()\n{int i,s=0,w[4]={0},j,temp,k,a[4]={0},d[4][4]={0},l,m,n;\nfor(i=1;i<=3;i++)\n{scanf(\"%d\",&a[i]);s+=a[i];w[i]=i;}\nfor(i=1;i<=s/2;i++)\n{for(k=1;k<=2;k++)\n{for(j=1;j<=2;j++)\n{if (a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;temp=w[j];w[j]=w[j+1];w[j+1]=temp;}\n}\n}\nif (a[3]>0 && a[2]>0)\n{a[3]--;a[2]--;\nd[w[2]][w[3]]++;\n}\nelse\n{printf(\"impossible\");return 0;\n}\n}\nd[1][2]+=d[2][1];\nd[1][3]+=d[3][1];\nd[3][2]+=d[2][3];\nprintf(\"%d %d %d\",d[1][2],d[3][2],d[1][3]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint count=0;\n\tif(x==0)count++;\n\tif(y==0)count++;\n\tif(z==0)count++;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%3;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tflag=1;\n\t}\n\tif(count>1)\n\t\tflag=1;\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint n1, n2, n3;\n\tscanf(\"%d%d%d\", &n1, &n2, &n3);\n\tint b12=(n1+n2-n3)/2, b23=n2-b12, b13=n1-b12;\n\tif(b12<0 || b23<0 || b13<0)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\", b12, n2-b12, n1-b12);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint count=0;\n\tif(x==0)count++;\n\tif(y==0)count++;\n\tif(z==0)count++;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%3;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tflag=1;\n\t}\n\tif(count>1)\n\t\tflag=1;\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tfloat x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(c+a-b)/2;\n\tif(x!=(int)x||y!=(int)y||z!=(int)z||x<0||y<0||z<0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",(int)x,(int)y,(int)z);\n\t}\n\treturn 0;\n\t\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,c,x,y,z;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if((a+b+c)%2==0)\n {\n x=(a+b-c)/2;\n y=(b+c-a)/2;\n z=(c+a-b)/2;\n if(x>=0 && y>=0 && z>=0)\n printf(\"%lld %lld %lld\\n\",x,y,z);\n else\n printf(\"impossible\\n\");\n }\n else\n printf(\"impossible\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k,t;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i <= num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i < 0 || j < 0 || k < 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n for(i = 0; i < 3; i++)\n {\n if(i == 0);\n else\n printf(\" \");\n printf(\"%d\",num_r[i]);\n t = 1;\n }\n }\n }\n if(t != 1)\n {\n printf(\"Impossible\");\n }\n\n return 0;\n}\n"}, {"source_code": "/* Problem: 344B - Simple Molecules */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned int a;\n unsigned int b;\n unsigned int c;\n unsigned short sol;\n unsigned int d;\n unsigned int r;\n unsigned int mbc;\n \n if (scanf(\"%u %u %u\",&a,&b,&c) != 3)\n return -1;\n if (a < 1 || a > 1000000 || b < 1 || b > 1000000 || c < 1 || c > 1000000)\n return -1;\n sol = 1;\n d = (b > c ? b-c : c-b);\n if (a < d)\n sol = 0;\n else\n {\n r = a-d;\n mbc = (b > c ? c : b);\n if (r%2 || 2*mbc < a)\n sol = 0;\n }\n if (sol)\n {\n printf (\"%u \",(b == mbc ? r/2 : r/2+d));\n printf (\"%u \",mbc-r/2);\n printf (\"%u\\n\",(b == mbc ? r/2+d : r/2));\n }\n else\n printf (\"Impossible\\n\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\nint a,b,c, semisuma, a_b, b_c, c_a;\nscanf(\"%d %d %d\", &a,&b,&c);\nsemisuma=(a+b+c)/2;\n\nb_c=semisuma-a;\na_b=semisuma-c;\nc_a=semisuma-b;\n\nif (semisuma%2) printf(\"Impossible\"); \nelse printf(\"%d %d %d\", a_b,b_c,c_a);\n\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k,t;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i < num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i < 0 || j < 0 || k < 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n for(i = 0; i < 3; i++)\n {\n if(i == 0);\n else\n printf(\" \");\n printf(\"%d\",num_r[i]);\n t = 1;\n }\n }\n }\n if(t != 1)\n {\n printf(\"Impossible\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\tif(x>=0&&y>=0&&z>=0)\n\tprintf(\"%d %d %d\",x,y,z);\n\telse\n\tprintf(\"Impossible\");\n\treturn 0;\n } \n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,i,j;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if((a+b)%c==0 || (b+c)%a==0 || (c+a)%b==0)\n {\n printf(\"0 1 1\\n\");\n }\n else printf(\"Impossible\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint a[3],n[3],i,k,sum=0;\nfor(i=0;i<3;i++)\n{\nscanf(\"%d\",&a[i]);\nsum=sum+a[i];\n}\nsum=sum/2;\nfor(i=1;i<3;i++)\n{\nn[i]=sum-a[i-1];\n}\nn[0]=sum-a[2];\nfor(i=0;i<3;i++)\n{\nif(n[i]>a[i])\n{printf(\"Impossible\");\nreturn 0;}\n\n}\n\nfor(i=0;i<3;i++)\nprintf(\"%d \",n[i]);\n\nreturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,a1,b1,c1,i,j,k,state=0;\n scanf(\"%d%d%d\", &a1, &b1, &c1);\n if((a1+b1-c1)/2<0 || (b1+c1-a1)/2<0 || (c1+a1-b1)/2<0)\n state=1;\n if(state==0)\n printf(\"%d %d %d\\n\", (a1+b1-c1)/2, (b1+c1-a1)/2, (c1+a1-b1)/2);\n else\n printf(\"Invalid\\n\");\n return 0;\n}\n"}, {"source_code": "int main()\n{int i,s=0,w[4]={0},j,temp,k,a[4]={0},d[4][4]={0},l,m,n;\nfor(i=1;i<=3;i++)\n{scanf(\"%d\",&a[i]);s+=a[i];w[i]=i;}\nfor(i=1;i<=s/2;i++)\n{for(k=1;k<=2;k++)\n{for(j=1;j<=2;j++)\n{if (a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;temp=w[j];w[j]=w[j+1];w[j+1]=temp;}\n}\n}\nif (a[3]>0 && a[2]>0)\n{a[3]--;a[2]--;\nd[w[2]][w[3]]++;\n}\nelse\n{printf(\"IMPOSSIBLE\");return 0;\n}\n}\nd[1][2]+=d[2][1];\nd[1][3]+=d[3][1];\nd[3][2]+=d[2][3];\nprintf(\"%d %d %d\",d[1][2],d[3][2],d[1][3]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tx=(a+b+c)/2-c;\n\ty=(a+b+c)/2-a;\n\tz=(a+b+c)/2-b;\n\tif(x<0 || y<0 || z<0) printf(\"Impossible\\n\");\n\telse printf(\"%d %d %d\\n\",x,y,z);\n\treturn 0;\n}"}, {"source_code": "int main()\n{int i,s=0,w[4]={0},j,temp,k,a[4]={0},d[4][4]={0},l,m,n;\nfor(i=1;i<=3;i++)\n{scanf(\"%d\",&a[i]);s+=a[i];w[i]=i;}\nfor(i=1;i<=s/2;i++)\n{for(k=1;k<=2;k++)\n{for(j=1;j<=2;j++)\n{if (a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;temp=w[j];w[j]=w[j+1];w[j+1]=temp;}\n}\n}\nif (a[3]>0 && a[2]>0)\n{a[3]--;a[2]--;\nd[w[2]][w[3]]++;\n}\nelse\n{printf(\"IMPOSSIBLE\");return 0;\n}\n}\nd[1][2]+=d[2][1];\nd[1][3]+=d[3][1];\nd[3][2]+=d[2][3];\nprintf(\"%d %d %d\",d[1][2],d[3][2],d[1][3]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c); int order;\n if(a==0 || b==0 || c==0){\n printf(\"Impossible\");\n return 0;\n }\n int max=a;\n order=1;\n if(b>max){\n max=b; order=2;}\n if(c>max){\n max=c; order=3;}\n int i;\n for(i=0;i<=max;i++){\n if(order==1 && (b-i)==(c-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,b-i,max-i);\n return 0;\n }\n if(order==1 && (c-i)==(b-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,b-i,i);\n return 0;\n }\n if(order==2 && (a-i)==(c-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n if(order==2 && (c-i)==(a-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,i,c-i);\n return 0;\n }\n if(order==3 && (a-i)==(b-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (b-i)==(a-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",a-i,i,max-i);\n return 0;\n }\n }\n printf(\"Impossible\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[3],i,j,temp,p,q,r,flag,num;\n\tfor(i=0;i<3;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tnum=a[0];\n\tflag=0;\n\twhile(num>=0&&flag==0)\n\t{\n\t\tp=num;\n\t\tq=a[1]-num;\n\t\tr=a[0]-num;\n\t\tif(q+r==a[2])\n\t\t{\n\t\t\tflag=1;\n\t\t\tprintf(\"%d %d %d\\n\",p,q,r);\n\t\t}\n\t\tnum--;\n\t}\n\tif(flag==0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a,b,c;\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n int K = (a+b-c)/2;\n int K2 = (b+c-a)/2;\n if(K >= 0 && K2>= 0 && 2*(K + K2 + (a - K)) == (a + b + c))\n {\n printf(\"%d %d %d\\n\",K,K2,a-K);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int i1, i2, i3, o12, o23, o13;\n \n scanf (\"%d %d %d \", &i1, &i2, &i3);\n \n for (o12 = 0; o12 <= i1; o12++) {\n o13 = i1 - o12;\n o23 = i2 - o12;\n if (o12 > 0 && o23 > 0 && o13 > 0 && (o12 + o13) == i1 && (o12 + o23) == i2 && (o13 + o23) == i3) {\n printf (\"%d %d %d\\n\", o12, o23, o13);\n return 0;\n }\n }\n \n printf (\"Impossible\\n\");\n\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(a>b+c || b>c+a || c>a+b)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, b, c, x, y, z;\n\t\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tx = (a + b - c) / 2;\n\ty = (c + a - b) / 2;\n\tz = (b + c - a) / 2;\n\tif ((a + b + c) % 2 != 0 || x < 0 || y < 0 || z < 0)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\", z, y, x);\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n \n \n int main()\n {\n int a[3][3],i,j,k;\n while((scanf(\"%d %d %d\",&a[0][0],&a[0][1],&a[0][2]))!=EOF)\n {\n a[1][0]=0;\n a[1][1]=1;\n a[1][2]=2;\n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[0][j]>a[0][j+1])\n {\n k= a[0][j];\n a[0][j]=a[0][j+1];\n a[0][j+1]=k;\n \n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n }\n }\n }\n \n if(a[0][2]>a[0][1]+a[0][0])\n {\n printf(\"impossible\\n\");\n }\n else\n {\n if(a[0][2]==a[0][1]+a[0][0])\n {\n a[2][0]= 0;\n a[2][1]= a[0][1];\n a[2][2]= a[0][2]-a[2][1];\n \n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[1][j]>a[1][j+1])\n {\n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n k= a[2][j];\n a[2][j]=a[2][j+1];\n a[2][j+1]=k;\n \n }\n }\n }\n \n printf(\"%d %d %d\\n\",a[2][0],a[2][1],a[2][2]);\n }\n else\n {\n if((a[0][0]+a[0][1]-a[0][2])%2==0)\n {\n a[2][0]=(a[0][0]+a[0][1]-a[0][2])/2;\n a[2][1]=a[0][1]-a[2][0];\n a[2][2]=(a[0][2]-a[2][1]);\n \n \n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[1][j]>a[1][j+1])\n {\n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n k= a[2][j];\n a[2][j]=a[2][j+1];\n a[2][j+1]=k;\n \n }\n }\n }\n \n printf(\"%d %d %d\\n\",a[2][0],a[2][1],a[2][2]);\n }\n else\n {\n printf(\"impossible\\n\");\n }\n }\n \n }\n }\n \n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\n\tint a, b, c;\n\tint x, y, z, sum;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tsum = a + b + c;\n\n\tif((sum & 1) == 1)\n\t{\n\t\tputs(\"Impossible\");\n\t\treturn 0;\n\t}\n\ty = (a - b + c) / 2;\n\tx = a - y;\n\tz = c - y;\n\tif(x <= 0 || y <= 0 || z <= 0)\n\t{\n\t\tputs(\"Impossible\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",x, z, y);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d %d\", &a,&b,&c);\n if (a<b+c && b<a+c && c<a+b)\n {\n for(A=1;A<=a;A++)\n {\n C=a-A;\n B=((a+b+c)/2)-(A+C);\n if(A+B+C==((a+b+c)/2) && b==A+B && c==B+C)\n printf(\"%d %d %d\",A,B,C);\n break;\n }\n }\n else if (a>b+c || b>a+c || c>a+b)\n printf(\"Impossible\");\n else if (a==b+c)\n printf(\"%d %d %d\", b,a-(b+c),c);\n else if (b==a+c)\n printf(\"%d %d %d\", a,c,b-(a+c));\n else if (c==a+b)\n printf(\"%d %d %d\", c-(a+b),b,a);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int i1, i2, i3, o12, o23, o13;\n \n scanf (\"%d %d %d \", &i1, &i2, &i3);\n \n for (o12 = 0; o12 <= i1; o12++) {\n o13 = i1 - o12;\n o23 = i2 - o12;\n if (o12 > 0 && o23 > 0 && o13 > 0 && (o12 + o13) == i1 && (o12 + o23) == i2 && (o13 + o23) == i3) {\n printf (\"%d %d %d\\n\", o12, o23, o13);\n return 0;\n }\n }\n \n printf (\"Impossible\\n\");\n\n return 0; \n}\n"}, {"source_code": "#include <stdio.h>\n\n#define min(a, b) ((a) < (b) ? (a):(b))\n\n\nint main(void){\n int x, a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n int limit = min(a, min(b, c));\n for(x = 0; x <= limit; x++){\n if(b-a + 2*x == c){\n printf(\"%d %d %d\\n\", a-x, b+x-a, x);\n break;\n }\n }\n if(x == limit+1) printf(\"Impossible\\n\");\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i < num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n }\n }\n for(i = 0; i < 3; i++)\n {\n printf(\"%3d\",num_r[i]);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int a,b,c,i,flg,S,ans[3]={0};\n scanf(\"%d %d %d\",&a,&b,&c);\n S=a+b+c;\n flg=0;\n if(S%2) puts(\"Impossible\");\n else{\n S/=2;\n ans[0]=S-a;\n ans[1]=S-b;\n ans[2]=S-c;\n for(i=0;i<3;i++){\n if(ans[i]<0){\n\tputs(\"Impossible\");\n\tflg=1;\n\tbreak;\n }\n }\n if(!flg) printf(\"%d %d %d\\n\",ans[0],ans[1],ans[2]);\n }\n return 0;\n}\n\n \n"}, {"source_code": "#include <stdio.h>\n\nint max3 (int a, int b, int c);\n\nint main ()\n{\n int b, c, d, e, i, j, g, temp, total;\n scanf (\"%d\", &c);\n scanf (\"%d\", &d);\n scanf (\"%d\", &e);\n total = (c + d + e) / 2;\n b = max3(c, d, e);\n if ((2*b - c - d - e) > 0 )\n {\n printf (\"Imposible\\n\");\n }\n else\n {\n printf (\"%d %d %d\\n\", (total - e), (total - c), (total - d));\n }\nreturn 0;\n}\nint max3 (int c, int d, int e)\n{\n if (c > d)\n {\n if ( c > e)\n {\n return c;\n }\n else\n {\n return e;\n }\n }\n else\n {\n if (d > e)\n {\n return d;\n }\n else\n {\n return e;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int a,b,c,x,m,arr[3],i,j,y;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b+c||b>a+c||c>a+b){\n printf(\"Impossible\\n\");\n return 0;\n }\n arr[0]=a;arr[1]=b;arr[2]=c;\n for(i=1;i<=2;i++)\n for(j=0;j<=2-i;j++)\n {\n\n if(arr[j+1]<arr[j])\n {\n x=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=x;\n }\n }\n x=(arr[1]+arr[0]-arr[2]);\n y=x/2;\n //printf(\"%d\\n\",y);\n if(x%2!=0||arr[1]+arr[0]-2*y!=arr[2]){\n printf(\"Impossible\\n\");\n return 0;\n }\n if(arr[2]==c){\n printf(\"%d %d %d\\n\",y,arr[1]-y,arr[0]-y);\n }\n else if(arr[2]==a){\n printf(\"%d %d %d\\n\",b-y,y,c-y);\n }\n else if(arr[2]==b){\n printf(\"%d %d %d\\n\",a-y,c-y,y);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c=0,s=0,n,m,l;\n scanf(\"%lld%lld%lld\",&n,&m,&l);\n s=(n+m+l)/(2.0);\n c=s-n;\n a=s-m;\n b=s-l;\n if(c>=0 && a>=0 && b>=0 && !(a+b==0 || b+c==0 || c+a==0))\n printf(\"%lld %lld %lld\",b,c,a);\n else\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, b, c, x, y, z;\n\t\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tx = (a + b - c) / 2;\n\ty = (c + a - b) / 2;\n\tz = (b + c - a) / 2;\n\tif ((a + b + c) % 2 != 0 || x < 0 || y < 0 || z < 0)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\", x, y, z);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint x,y,z;\n\tx=(b+c-a)/2;\n\ty=(a+c-b)/2;\n\tz=(a+b-c)/2;\n\tif(a+b-c>=0&&b+c-a>=0&&a+c-b>=0)\n\tprintf(\"%d %d %d\",z,x,y);\n\telse\n\t\tprintf(\"Impossible\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c); int order;\n if(a==0 || b==0 || c==0){\n printf(\"Impossible\");\n return 0;\n }\n int max=a;\n order=1;\n if(b>max){\n max=b; order=2;}\n if(c>max){\n max=c; order=3;}\n int i;\n for(i=0;i<=max;i++){\n if(order==1 && (b-i)==(c-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,b-i,max-i);\n return 0;\n }\n if(order==1 && (c-i)==(b-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,b-i,i);\n return 0;\n }\n if(order==2 && (a-i)==(c-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n if(order==2 && (c-i)==(a-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (a-i)==(b-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (b-i)==(a-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n }\n printf(\"Impossible\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\n\tint sum = 0;\n\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\n\tsum = (a + b + c)/2;\n\n\tif(sum % 2 != 0 || sum - a < 0 || sum - b < 0 || sum - c < 0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",sum-c,sum-a,sum-b);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a1,b1,c1,k,i,j,z;\n\tscanf(\"%d%d%d\",&a1,&b1,&c1);\n\tz=0;\n\tif(a1>(b1+c1)) z=2;\n\tif(b1>(a1+c1)) z=2;\n\tif(c1>(a1+b1)) z=2;\t\n\tif(z==0)\n\t{\n\t\ti=(a1+b1-c1)/2;\n\t\tj=b1-i;\n\t\tk=c1-b1+i;\n\t\tz=1;\n\t}\n\tif (z==1) printf(\"%d %d %d\",i,j,k);\n\telse printf(\"Impossible\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\nint a,b,c, semisuma, a_b, b_c, c_a;\nscanf(\"%d %d %d\", &a,&b,&c);\nsemisuma=(a+b+c)/2;\n\nb_c=semisuma-a;\na_b=semisuma-c;\nc_a=semisuma-b;\n\nif (semisuma%2) printf(\"Impossible\"); \nelse printf(\"%d %d %d\", a_b,b_c,c_a);\n\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint a,b,c,maxe;\nint s,t,i,check;\nint main()\n{\n\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n molecule(a,b,maxe);\n\n }\n else\n {\n maxe=a;\n molecule(b,c,maxe);\n }\n }\n else if(b>=a)\n {\n if(c>=b)\n {\n\n\n maxe=c;\n molecule(a,b,maxe);\n }\n else\n {\n maxe=b;\n molecule(a,c,maxe);\n }\n }\n return 0;\n}\n molecule(int u,int v,int muxe)\n {\n check=1;\n for(i=0;i<=(muxe/2);i++)\n {\n\n s=u-i;\n t=v-(muxe-i);\n if(s==t)\n {\n if(i>=0&&(muxe-i)>=0&&s>=0){\n out(i,muxe-i,s);\n check=0;\n }\n }\n\n\n }\n if(check)\n printf(\"Impossible\");\n }\n int out(int x,int y,int z)\n {\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=a;\n printf(\"%d \",x);\n printf(\"%d \",z);\n printf(\"%d \",y);\n\n }\n }\n else if(b>=a)\n {\n\n if(c>=b)\n {\n\n\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=b;\n printf(\"%d \",x);\n printf(\"%d \",y);\n printf(\"%d \",z);\n }\n }\n return 0;\n }\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint a[3],n[3],i,k,sum=0;\nfor(i=0;i<3;i++)\n{\nscanf(\"%d\",&a[i]);\nsum=sum+a[i];\n}\nsum=sum/2;\nfor(i=1;i<3;i++)\n{\nn[i]=sum-a[i-1];\n}\nn[0]=sum-a[2];\nfor(i=0;i<3;i++)\n{\nif(n[i]>a[i])\n{printf(\"Impossible\");\nreturn 0;}\n\n}\n\nfor(i=0;i<3;i++)\nprintf(\"%d \",n[i]);\n\nreturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a , b , c , counter , diff1 , diff2 , temp ;\n int flag1 = 0 , flag2 = 0;\n scanf(\"%I64d %I64d %I64d\",&a ,&b,&c);\n if ( b > c){\n temp = b;\n b = c ;\n c = temp ;\n flag1 ++;\n }\n if ( a > c){\n temp = a ;\n a = c;\n c = temp;\n flag2 ++ ;\n }\n for (counter = 0 ; counter <= c ; counter ++){\n if ( (a - counter) == (b - (c - counter)) && a >= counter && b >= (c - counter) ){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", a - counter , c - counter , counter);\n return 0;\n }\n if ( flag1 == 1 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", counter , c - counter ,a - counter);\n return 0;\n }\n if (flag1 == 1 && flag2 == 1){\n printf(\"%I64d %I64d %I64d\",c - counter , counter , a - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\",c - counter, a - counter , counter);\n return 0;\n }\n }\n else if ( (b - counter) == (a - (c - counter)) && a>= (c - counter) && (b >= counter )){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\" , b - counter , counter , c - counter);\n return 0;\n }\n if (flag1 == 1){\n printf(\"%I64d %I64d %I64d\" ,c - counter , b - counter , counter );\n return 0;\n }\n if ( flag1 == 1 && flag2 == 2){\n printf(\"%I64d %I64d %I64d\" ,counter ,c - counter , b - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\" ,counter , b - counter , c - counter);\n return 0;\n }\n }\n }\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "/*Codeforces Round #200 (Div. 2) B. Simple Molecules*/\n#include <stdio.h>\nint Max(int a[],int n);\nint Min(int a[],int n);\nint main()\n{\n int a[4],x,y,z,i,max,min;\n for (i=1;i<=3;i++)\n scanf (\"%d\",&a[i]);\n max=Max(a,3);\n min=Min(a,3)-1;\n i=0;\n for (x=min/3;x<max&&i==0;x++)\n {\n y=a[2]-x;\n z=a[1]-x;\n if (z+y==a[3]&&y>=0&&z>=0)\n {\n printf (\"%d %d %d\\n\",x,y,z);\n i=1;\n }\n }\n if (i==0)\n printf (\"Impossible\\n\");\n return 0;\n}\nint Max(int a[],int n)\n{\n int max=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (max<a[i])\n max=a[i];\n }\n return max;\n}\nint Min(int a[],int n)\n{\n int min=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (min>a[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint x,y,z;\n\tx=(b+c-a)/2;\n\ty=(a+c-b)/2;\n\tz=(a+b-c)/2;\n\tif(a+b-c>=0&&b+c-a>=0&&a+c-b>=0)\n\tprintf(\"%d %d %d\",z,x,y);\n\telse\n\t\tprintf(\"Impossible\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tint res1=b-c+a;\n\tint res2=b-a+c;\n\tint res3=a-b+c;\n\tx=res1/2;\n\ty=res2/2;\n\tz=res3/2;\n\tint x1=res1%2;\n\tint y1=res2%2;\n\tint z1=res3%3;\n\tint flag=0;\n\tif(x<0 || y<0 || z<0)\n\t{\n\t\tprintf(\"Impossible\");\n\t\tflag=1;\n\t}\n\t//if(x1!=0 || y1!=0 || z1!=0)\n\t//\tprintf(\"Impossible\");\n\tif(flag==0)\n\t\tprintf(\"%d %d %d\",x,y,z);\n\treturn 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:14/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n\nint main()\n{\n ll a,b,c;\n SC3(a,b,c);\n if((a+b+c)%2!=0)\n {\n printf(\"Impossible\\n\");\n return 0;\n }\n PF3((b+c-a)/2,(c+a-b)/2,(b+a-c)/2);\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint a1,a2,a0,x,y,z;\nscanf(\"%d\",&a0);\n\nscanf(\"%d\",&a1);\nscanf(\"%d\",&a2);\nx=(a0-a2+a1)/2;\ny=(a1-a0+a2)/2;\nz=(a2-a1+a0)/2;\nif(x==0 && y==0 && z==0)\n\nprintf(\"Impossible\\n\");\nelse if(x>=0 && y>=0 && z>=0)\nprintf(\"%d %d %d\\n\",x,y,z );\nelse \nprintf(\"Impossible\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char *argv[])\n{\n int a, b, c;\n int max, min, mid;\n int i;\n while(scanf(\"%d%d%d\",&a, &b, &c) != EOF)\n {\n max = min = a;\n if(b > max)\n max = b;\n if(c > max)\n max = c;\n if(b < min)\n min = b;\n if(c < min)\n min = c;\n mid = a + b + c - max - min; \n if((min + mid) < max)\n {\n printf(\"Impossible\\n\");\n } \n else\n {\n printf(\"%d %d %d\\n\", abs(a - b), abs(b - c), abs(c - a));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,c,i;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tfor(i=0;i<=a;++i)\n\t{\n\t\tif(b-i==c-a+i)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",i,b-i,a-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c=0,s=0,n,m,l;\n scanf(\"%lld%lld%lld\",&n,&m,&l);\n s=(n+m+l)/(2.0);\n c=s-n;\n a=s-m;\n b=s-l;\n if(c>=0 && a>=0 && b>=0)\n printf(\"%lld %lld %lld\",b,c,a);\n else\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "/* Problem: 344B - Simple Molecules */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned int a;\n unsigned int b;\n unsigned int c;\n unsigned short sol;\n unsigned int d;\n unsigned int r;\n unsigned int mbc;\n \n if (scanf(\"%u %u %u\",&a,&b,&c) != 3)\n return -1;\n if (a < 1 || a > 1000000 || b < 1 || b > 1000000 || c < 1 || c > 1000000)\n return -1;\n sol = 1;\n d = (b > c ? b-c : c-b);\n if (a < d)\n sol = 0;\n else\n {\n r = a-d;\n mbc = (b > c ? c : b);\n if (r%2 || 2*mbc < a)\n sol = 0;\n }\n if (sol)\n {\n printf (\"%u \",(b == mbc ? r/2 : r/2+d));\n printf (\"%u \",mbc-r/2);\n printf (\"%u\\n\",(b == mbc ? r/2+d : r/2));\n }\n else\n printf (\"Impossible\\n\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint max(int a,int b,int c)\n{\n if(a>=b && a>=c) return 1;\n else if(b>a && b>=c) return 2;\n else return 3;\n}\nint main()\n{\n int a,b,c,i,s1=0,s2=0,s3=0,index;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(a>0 && b>0 && c>0)\n {\n if(a==1 && b==1 && c==1) \n { printf(\"Impossible\\n\");break;}\n index=max(a,b,c);\n if(index==1) { a=a-2; b--;c--;s1++;s2++;}\n else if(index==2) {b=b-2; a--;c--; s1++;s3++;}\n else { c=c-2;a--;b--; s2++;s3++;}\n }\n if(a==0)\n {\n if(b!=c) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1,s2,s3+b); \n }\n else if(b==0)\n {\n if(a!=c) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1,s2+a,s3);\n \n }\n else if(c==0)\n {\n if(a!=b) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1+a,s2,s3);\n } \n return 0;\n} "}, {"source_code": "#include <stdio.h>\n\n#define min(a, b) ((a) < (b) ? (a):(b))\n\n\nint main(void){\n int x, a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n int limit = min(a, min(b, c));\n for(x = 0; x <= limit; x++){\n if(b-a + 2*x == c){\n printf(\"%d %d %d\\n\", a-x, b+x-a, x);\n break;\n }\n }\n if(x == limit+1) printf(\"Imposible\\n\");\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tlong long int x,y,z;\n\n\tx=(a+b-c)/2;\n\ty=(b+c-a)/2;\n\tz=(a+c-b)/2;\n\n\tif(x>=0 && y>=0 && z>=0)\n\t\tprintf(\"%lld %lld %lld\\n\",x,y,z);\n\telse\n\t\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "//molecules.c\n#include<stdio.h>\n#include<limits.h>\nint func(int a,int b,int max)\n{\n int count=0;\n int sum=a+b;\n while(1)\n {\n if(sum==max)\n break;\n else\n {\n count++;\n sum-=2*count;\n if(sum<max)\n {\n printf(\"Impossible\\n\");\n return ;\n }\n\n }\n }\n return count;\n\n}\nint main()\n{\n int a[3];\n int b[3]={0};\n int i,sum=0,max=INT_MIN,sumleft;\n int index;\n for(i=0;i<3;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(max<a[i])\n {\n max=a[i];\n index=i;\n }\n\n }\n sumleft=sum-max;\n if(sum%2==1|| sumleft<max)\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n int one,two,id;\n switch(index)\n {\n\n case 0 :\n one=a[1];\n two=a[2];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",a[1]-id,id,a[2]-id);\n break;\n\n case 1: one=a[0];\n two=a[2];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",a[0]-id,a[2]-id,id);\n break;\n case 2: one=a[0];\n two=a[1];\n id= func(one,two,max);\n printf(\"%d %d %d\\n\",id,a[1]-id,a[0]-id);\n break;\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c); int order;\n if(a==0 || b==0 || c==0){\n printf(\"Impossible\");\n return 0;\n }\n int max=a;\n order=1;\n if(b>max){\n max=b; order=2;}\n if(c>max){\n max=c; order=3;}\n int i;\n for(i=0;i<=max;i++){\n if(order==1 && (b-i)==(c-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,b-i,max-i);\n return 0;\n }\n if(order==1 && (c-i)==(b-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,b-i,i);\n return 0;\n }\n if(order==2 && (a-i)==(c-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n if(order==2 && (c-i)==(a-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (a-i)==(b-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (b-i)==(a-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n }\n printf(\"Impossible\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,a1,b1,c1,i,j,k,state=0;\n scanf(\"%d%d%d\", &a1, &b1, &c1);\n if((a1+b1-c1)/2<0 || (b1+c1-a1)/2<0 || (c1+a1-b1)/2<0)\n state=1;\n if(state==0)\n printf(\"%d %d %d\\n\", (a1+b1-c1)/2, (b1+c1-a1)/2, (c1+a1-b1)/2);\n else\n printf(\"Impossible\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a, b, c;\n\tint x, y, z;\n\tint i;\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\tif(a>=b&&c>=b){\n\t\tx=b;\n\t\ty=0;\n\t\tz=0;\n\t\tfor(i=1; i<=b; i++){\n\t\t\ty++;\n\t\t\tz++;\n\t\t\tx--;\n\t\t\tif(x==0)\n\t\t\t\tbreak;\n\t\t\tif((a-x)==(c-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, y, a-x);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Impossible\\n\");\n\t}else if(c>=a&&b>=a){\n\t\tx=a;\n\t\ty=0;\n\t\tz=0;\n\t\tfor(i=1; i<=a; i++){\n\t\t\ty++;\n\t\t\tz++;\n\t\t\tx--;\n\t\t\tif(x==0)\n\t\t\t\tbreak;\n\t\t\tif((b-x)==(c-z)){\n\t\t\t\tprintf(\"%d %d %d\\n\", x, b-x, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Impossible\\n\");\n\t}else{\n\t\tx=0;\n\t\ty=c;\n\t\tz=0;\n\t\tfor(i=1; i<=c; i++){\n\t\t\ty--;\n\t\t\tz++;\n\t\t\tx++;\n\t\t\tif (y==0)\n\t\t\t\tbreak;\n\t\t\tif((a-z)==(b-y)){\n\t\t\t\tprintf(\"%d %d %d\\n\", a-z, y, z);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,a1,b1,c1,i,j,k,state=0;\n scanf(\"%d%d%d\", &a1, &b1, &c1);\n if((a1+b1-c1)/2<0 || (b1+c1-a1)/2<0 || (c1+a1-b1)/2<0)\n state=1;\n if(state==0)\n printf(\"%d %d %d\\n\", (a1+b1-c1)/2, (b1+c1-a1)/2, (c1+a1-b1)/2);\n else\n printf(\"Invalid\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a,b,c;\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n int K = (a+b-c)/2;\n int K2 = (b+c-a)/2;\n if(K >= 0 && K2>= 0 && 2*(K + K2 + (a - K)) == (a + b + c))\n {\n printf(\"%d %d %d\\n\",K,K2,a-K);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,c,i;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tfor(i=0;i<=a;++i)\n\t{\n\t\tif(b-i==c-a+i)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",i,b-i,a-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,ab=0,ac=0,bc=0;\nscanf(\"%d%d%d\",&a,&b,&c);\nwhile(1)\n{\nif(a>=b&&a>=c)\n{\n a-=2;\n b--;\n c--;\n ab++;\n ac++;\n}\nif(b>=a&&b>=c)\n{\n b-=2;\n a--;\n c--;\n ab++;\n bc++;\n}\nif(c>=a&&c>=b)\n{\n c-=2;\n b--;\n a--;\n bc++;\n ac++;\n}\nif(a==b&&b==c&&c==0)\n{\n printf(\"%d %d %d\",ab,bc,ac);\n break;\n}\nif(a<0||b<0||c<0)\n{\n printf(\"Impossible\");\n break;\n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char *argv[])\n{\n int a, b, c;\n int max, min, mid;\n int i;\n while(scanf(\"%d%d%d\",&a, &b, &c) != EOF)\n {\n max = min = a;\n if(b > max)\n max = b;\n if(c > max)\n max = c;\n if(b < min)\n min = b;\n if(c < min)\n min = c;\n mid = a + b + c - max - min; \n if((min + mid) < max)\n {\n printf(\"Impossible\\n\");\n } \n else\n {\n printf(\"%d %d %d\\n\", abs(a - b), abs(b - c), abs(c - a));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c=0,s=0,n,m,l;\n scanf(\"%lld%lld%lld\",&n,&m,&l);\n s=(n+m+l)/(2.0);\n c=s-n;\n a=s-m;\n b=s-l;\n if(c>=0 && a>=0 && b>=0)\n printf(\"%lld %lld %lld\",b,c,a);\n else\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a, b, c, i, j, k=0, aray[3], mx, mn, md;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a==b && b==c){\n printf(\"Impossible\");\n return 0;\n }\n else if(a+b==c){\n printf(\"%d %d %d\", 0, b, a);\n }\n else if(b+c==a){\n printf(\"%d %d %d\", b, 0, c);\n }\n else if(c+a==b){\n printf(\"%d %d %d\", a, c, 0);\n }\n else{\n aray[0]=a;\n aray[1]=b;\n aray[2]=c;\n for(i=1;i<3;i++){\n j=i;\n while(j>0 && aray[j]<aray[j-1]){\n aray[j]^=aray[j-1];\n aray[j-1]^=aray[j];\n aray[j]^=aray[j-1];\n j--;\n }\n }\n mx=aray[2];\n mn=aray[0];\n md=aray[1];\n if(mn+md<mx){\n printf(\"Impossible\");\n return 0;\n }\n else{\n if(a+b>c){\n while(a+b!=c){\n k++;\n a--;\n b--;\n if(a+b<c){\n break;\n }\n }\n if(a+b==c){\n printf(\"%d %d %d\", k, b, a);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(b+c>a){\n while(c+b!=a){\n k++;\n c--;\n b--;\n if(c+b<a){\n break;\n }\n }\n if(c+b==a){\n printf(\"%d %d %d\",b, k, c);\n }\n else{\n printf(\"Impossible\");\n }\n }\n else if(c+a>b){\n while(a+c!=b){\n k++;\n a--;\n c--;\n if(a+c<b){\n break;\n }\n }\n if(a+c==b){\n printf(\"%d %d %d\", a, c, k);\n }\n else{\n printf(\"Impossible\");\n }\n }\n }\n\n\n }\n\n return 0;\n}\n"}, {"source_code": "/*\n * =====================================================================================\n *\n * Filename: 344b.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: Saturday 14 December 2013 11:35:01 IST\n * Revision: none\n * Compiler: gcc\n *\n * Author: SUDARSHAN (), \n * Organization: BITS PILANI, HYDERABAD\n *\n * =====================================================================================\n */\n#include<stdio.h>\nint main(void)\n{\n\n long int a,b,c;\n scanf(\"%ld %ld %ld\",&a,&b,&c);\n \n long int n1,n2,n3;\n n1=( a+b-c)/2;\n n3=(b-n1);\n n2=(a-b+c)/2;\n\n if (n1>=0 && n2>=0 && n3>=0)\n printf(\"%ld %ld %ld\",n1,n3,n2);\n else\n printf(\"Impossible\");\nreturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i < num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i < 0 || j < 0 || k < 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n }\n }\n for(i = 0; i < 3; i++)\n {\n printf(\"%3d\",num_r[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint max(int a,int b,int c)\n{\n if(a>=b && a>=c) return 1;\n else if(b>a && b>=c) return 2;\n else return 3;\n}\nint main()\n{\n int a,b,c,i,s1=0,s2=0,s3=0,index;\n scanf(\"%d %d %d\",&a,&b,&c);\n while(a>0 && b>0 && c>0)\n {\n if(a==1 && b==1 && c==1) \n { printf(\"Impossible\\n\");break;}\n index=max(a,b,c);\n if(index==1) { a=a-2; b--;c--;s1++;s2++;}\n else if(index==2) {b=b-2; a--;c--; s1++;s3++;}\n else { c=c-2;a--;b--; s2++;s3++;}\n }\n if(a==0)\n {\n if(b!=c) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1,s2,s3+b); \n }\n else if(b==0)\n {\n if(a!=c) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1,s2+a,s3);\n \n }\n else if(c==0)\n {\n if(a!=b) printf(\"Impossible\\n\");\n else printf(\"%d %d %d\\n\",s1+a,s2,s3);\n } \n return 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i < num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n }\n }\n for(i = 0; i < 3; i++)\n {\n printf(\"%3d\",num_r[i]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint a,b,c,i,j,k,d;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\td=(a+b+c)/2;\n\ti=d-c;\n\tj=d-a;\n\tk=d-b;\n\tif(i<0 || j<0 ||k<0|| i+j+k !=d)\n\tprintf(\"impossible\");\n\telse\n\tprintf(\"%d %d %d\",i,j,k);\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\n\tint sum = 0;\n\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\n\tsum = (a + b + c)/2;\n\n\tif(sum - a < 0 || sum - b < 0 || sum - c < 0)\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d %d %d\\n\",sum-c,sum-a,sum-b);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, b, c, x, y, z;\n\t\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tx = (a + b - c) / 2;\n\ty = (c + a - b) / 2;\n\tz = (b + c - a) / 2;\n\tif ((a + b + c) % 2 != 0 || x < 0 || y < 0 || z < 0)\n\t\tprintf(\"Impossible\\n\");\n\telse\n\t\tprintf(\"%d %d %d\\n\", z, y, x);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a,b,c;\n\tint x,y,z;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tif(abs(c-a-b)%2 == 0 && abs(b-c-a)%2 == 0 && abs(c-a-b)%2 == 0)\n\t{\n\t\tx = (c-a-b)/(-2);\n\t\ty = (b-c-a)/(-2);\n\t\tz = (a-b-c)/(-2);\n\t\tif(x > 0 && y > 0 && z > 0)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",x,z,y);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Impossible\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"Impossible\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c;\n int one_two = 0, one_three = 0, two_three = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n if(a+b<c || a+c < b || b+c < a){\n printf(\"Impossible\\n\");\n }\n else{\n one_three = (a+c-b)/2;\n one_two = a-one_three;\n two_three = b - one_two;\n printf(\"%d %d %d\\n\", one_two, two_three, one_three);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n int a,b,c,ans,i,j,x,y,z,max;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a>b+c || b>a+c || c>a+b || (a+b+c)%2!=0)\n printf(\"Impossible\");\n else\n {\n \n if(b>a && b>c)\n max=b;\n else if(a>b && a>c)\n max=a;\n else\n max=c;\n \n if(max==a)\n {\n y=(b+c-a)/2;\n x=b-y;\n z=c-y;\n printf(\"a\");\n }\n else if(max==b)\n {\n z=(a+c-b)/2;\n x=a-z;\n y=c-z;\n printf(\"b\");\n }\n else if(max==c)\n {\n x=(a+b-c)/2;\n z=a-x;\n y=b-x;\n printf(\"c\");\n }\n printf(\"%d %d %d\",x,y,z);\n }\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k,t;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i <= num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i < 0 || j < 0 || k < 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n for(i = 0; i < 3; i++)\n {\n if(i == 0);\n else\n printf(\" \");\n printf(\"%d\",num_r[i]);\n t = 1;\n }\n }\n }\n if(t != 1)\n {\n printf(\"Impossible\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[3];\n int num_r[3];\n int i,j,k,t;\n for(i = 0;i < 3;i++)\n {\n scanf(\"%d\",&num[i]);\n }\n for(i = 0;i < num[0];i++)\n {\n j = num[1] - i;\n k = num[2] - j;\n if(num[0] == i + k && num[1] == j + i && num[2] == j + k)\n {\n if(i < 0 || j < 0 || k < 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n if(i == 0 && j == 0 || i == 0 && k == 0 || j == 0 && k == 0)\n {\n printf(\"Impossible\");\n return 0;\n }\n num_r[0] = i;\n num_r[1] = j;\n num_r[2] = k;\n for(i = 0; i < 3; i++)\n {\n printf(\"%3d\",num_r[i]);\n t = 1;\n }\n }\n }\n if(t != 1)\n {\n printf(\"Impossible\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint a,b,c,maxe;\nint s,t,i,check;\nint main()\n{\n\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n molecule(a,b,maxe);\n\n }\n else\n {\n maxe=a;\n molecule(b,c,maxe);\n }\n }\n else if(b>=a)\n {\n if(c>=b)\n {\n\n\n maxe=c;\n molecule(a,b,maxe);\n }\n else\n {\n maxe=b;\n molecule(a,c,maxe);\n }\n }\n return 0;\n}\n molecule(int u,int v,int muxe)\n {\n check=1;\n for(i=0;i<=(muxe/2);i++)\n {\n\n s=u-i;\n t=v-(muxe-i);\n if(s==t)\n {\n if(i>=0&&(muxe-i)>=0&&s>=0){\n out(i,muxe-i,s);\n check=0;\n }\n }\n\n\n }\n if(check)\n printf(\"Impossible\");\n }\n int out(int x,int y,int z)\n {\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=a;\n printf(\"%d \",x);\n printf(\"%d \",z);\n printf(\"%d \",y);\n\n }\n }\n else if(b>=a)\n {\n\n if(c>=b)\n {\n\n\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=b;\n printf(\"%d\",x);\n printf(\"%d\",y);\n printf(\"%d\",z);\n }\n }\n return 0;\n }\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a , b , c , counter , diff1 , diff2 , temp ;\n int flag1 = 0 , flag2 = 0;\n scanf(\"%I64d %I64d %I64d\",&a ,&b,&c);\n if ( b > c){\n temp = b;\n b = c ;\n c = temp ;\n flag1 ++;\n }\n if ( a > c){\n temp = a ;\n a = c;\n c = temp;\n flag2 ++ ;\n }\n for (counter = 0 ; counter <= c ; counter ++){\n if ( (a - counter) == (b - (c - counter)) && a >= counter && b >= (c - counter) ){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", a - counter , c - counter , counter);\n return 0;\n }\n if ( flag1 == 1 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\", counter , c - counter ,a - counter);\n return 0;\n }\n if (flag1 == 1 && flag2 == 1){\n printf(\"%I64d %I64d %I64d\",c - counter , counter , a - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\",c - counter, a - counter , counter);\n return 0;\n }\n }\n else if ( (b - counter) == (a - (c - counter)) && a>= (c - counter) && (b >= counter )){\n if (flag1 == 0 && flag2 == 0){\n printf(\"%I64d %I64d %I64d\" , b - counter , counter , c - counter);\n return 0;\n }\n if (flag1 == 1){\n printf(\"%I64d %I64d %I64d\" ,c - counter , b - counter , counter );\n return 0;\n }\n if ( flag1 == 1 && flag2 == 2){\n printf(\"%I64d %I64d %I64d\" ,counter ,c - counter , b - counter );\n return 0;\n }\n if (flag2 == 1 && flag1 == 0){\n printf(\"%I64d %I64d %I64d\" ,counter , b - counter , c - counter);\n return 0;\n }\n }\n }\n printf(\"Impossible\");\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n \n \n int main()\n {\n int a[3][3],i,j,k;\n while((scanf(\"%d %d %d\",&a[0][0],&a[0][1],&a[0][2]))!=EOF)\n {\n a[1][0]=0;\n a[1][1]=1;\n a[1][2]=2;\n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[0][j]>a[0][j+1])\n {\n k= a[0][j];\n a[0][j]=a[0][j+1];\n a[0][j+1]=k;\n \n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n }\n }\n }\n \n if(a[0][2]>a[0][1]+a[0][0])\n {\n printf(\"Impossible\\n\");\n }\n else\n {\n if(a[0][2]==a[0][1]+a[0][0])\n {\n a[2][0]= 0;\n a[2][1]= a[0][1];\n a[2][2]= a[0][2]-a[2][1];\n \n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[1][j]>a[1][j+1])\n {\n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n k= a[2][j];\n a[2][j]=a[2][j+1];\n a[2][j+1]=k;\n \n }\n }\n }\n \n printf(\"%d %d %d\\n\",a[2][0],a[2][1],a[2][2]);\n }\n else\n {\n if((a[0][0]+a[0][1]-a[0][2])%2==0)\n {\n a[2][0]=(a[0][0]+a[0][1]-a[0][2])/2;\n a[2][1]=a[0][1]-a[2][0];\n a[2][2]=(a[0][2]-a[2][1]);\n \n \n for(i=0;i<3;i++)\n {\n for(j=0;j<2;j++)\n {\n if(a[1][j]>a[1][j+1])\n {\n k= a[1][j];\n a[1][j]=a[1][j+1];\n a[1][j+1]=k;\n \n k= a[2][j];\n a[2][j]=a[2][j+1];\n a[2][j+1]=k;\n \n }\n }\n }\n \n printf(\"%d %d %d\\n\",a[2][0],a[2][1],a[2][2]);\n }\n else\n {\n printf(\"Impossible\\n\");\n }\n }\n \n }\n }\n \n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char *argv[])\n{\n int a, b, c;\n int max, min, mid;\n int i;\n while(scanf(\"%d%d%d\",&a, &b, &c) != EOF)\n {\n max = min = a;\n if(b > max)\n max = b;\n if(c > max)\n max = c;\n if(b < min)\n min = b;\n if(c < min)\n min = c;\n mid = a + b + c - max - min; \n if((min + mid) < max)\n {\n printf(\"Impossible\\n\");\n } \n else\n {\n printf(\"%d %d %d\\n\", abs(a - b), abs(b - c), abs(c - a));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint a,b,c,maxe;\nint s,t,i,check;\nint main()\n{\n\n\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n molecule(a,b,maxe);\n\n }\n else\n {\n maxe=a;\n molecule(b,c,maxe);\n }\n }\n else if(b>=a)\n {\n if(c>=b)\n {\n\n\n maxe=c;\n molecule(a,b,maxe);\n }\n else\n {\n maxe=b;\n molecule(a,c,maxe);\n }\n }\n return 0;\n}\n molecule(int u,int v,int muxe)\n {\n check=1;\n for(i=0;i<=(muxe/2);i++)\n {\n\n s=u-i;\n t=v-(muxe-i);\n if(s==t)\n {\n if(i>=0&&(muxe-i)>=0&&s>=0){\n out(i,muxe-i,s);\n check=0;\n }\n }\n\n\n }\n if(check)\n printf(\"Impossible\");\n }\n int out(int x,int y,int z)\n {\n\n if(a>=b)\n {\n if(c>=a)\n {\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=a;\n printf(\"%d \",x);\n printf(\"%d \",z);\n printf(\"%d \",y);\n\n }\n }\n else if(b>=a)\n {\n\n if(c>=b)\n {\n\n\n maxe=c;\n printf(\"%d \",z);\n printf(\"%d \",y);\n printf(\"%d \",x);\n }\n else\n {\n maxe=b;\n printf(\"%d \",x);\n printf(\"%d \",y);\n printf(\"%d \",z);\n }\n }\n return 0;\n }\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint max3 (int a, int b, int c);\n\nint main ()\n{\n int b, c, d, e, i, j, g, temp, total;\n scanf (\"%d\", &c);\n scanf (\"%d\", &d);\n scanf (\"%d\", &e);\n total = (c + d + e) / 2;\n b = max3(c, d, e);\n if ((2*b - c - d - e) > 0 )\n {\n printf (\"Imposible\\n\");\n }\n else\n {\n printf (\"%d %d %d\\n\", (total - e), (total - c), (total - d));\n }\nreturn 0;\n}\nint max3 (int c, int d, int e)\n{\n if (c > d)\n {\n if ( c > e)\n {\n return c;\n }\n else\n {\n return e;\n }\n }\n else\n {\n if (d > e)\n {\n return d;\n }\n else\n {\n return e;\n }\n }\n}\n"}, {"source_code": "/*Codeforces Round #200 (Div. 2) B. Simple Molecules*/\n#include <stdio.h>\nint Max(int a[],int n);\nint Min(int a[],int n);\nint main()\n{\n int a[4],x,y,z,i,max,min;\n for (i=1;i<=3;i++)\n scanf (\"%d\",&a[i]);\n max=Max(a,3);\n min=Min(a,3)-1;\n i=0;\n for (x=min/3;x<max&&i==0;x++)\n {\n y=a[2]-x;\n z=a[1]-x;\n if (z+y==a[3]&&y>=0&&z>=0)\n {\n printf (\"%d %d %d\\n\",x,y,z);\n i=1;\n }\n }\n if (i==0)\n printf (\"Impossible\\n\");\n return 0;\n}\nint Max(int a[],int n)\n{\n int max=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (max<a[i])\n max=a[i];\n }\n return max;\n}\nint Min(int a[],int n)\n{\n int min=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (min>a[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(a>b+c || b>c+a || c>a+b)\n\t\tprintf(\"Impossible\");\n\telse\n\t\tprintf(\"%d %d %d\",(a+b-c)/2,(b+c-a)/2,(a+c-b)/2);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint a[3],n[3],i,k,sum=0,c=0;\nfor(i=0;i<3;i++)\n{\nscanf(\"%d\",&a[i]);\nsum=sum+a[i];\n}\nsum=sum/2;\nfor(i=1;i<3;i++)\n{\nn[i]=sum-a[i-1];\n}\nn[0]=sum-a[2];\nfor(i=0;i<2;i++)\n{\nif(n[i]+n[i+1]!=a[i+1])\n{printf(\"Impossible\");\n\nreturn 0;\n}\n}\nif(n[0]+n[2]!=a[0])\n\t{printf(\"Impossible\");\nreturn 0;}\nfor(i=0;i<3;i++)\nprintf(\"%d \",n[i]);\n\nreturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,c,i;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tfor(i=0;i<=a;++i)\n\t{\n\t\tif(b-i==c-a+i)\n\t\t{\n\t\t\tprintf(\"%d %d %d\\n\",i,b-i,a-i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"Impossible\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int a,b,c,x,m,arr[3],i,j,y;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b+c||b>a+c||c>a+b){\n printf(\"Impossible\\n\");\n return 0;\n }\n arr[0]=a;arr[1]=b;arr[2]=c;\n for(i=1;i<=2;i++)\n for(j=0;j<=2-i;j++)\n {\n\n if(arr[j+1]<arr[j])\n {\n x=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=x;\n }\n }\n x=(arr[1]+arr[0]-arr[2]);\n y=x/2;\n //printf(\"%d\\n\",y);\n if(x%2!=0||arr[1]+arr[0]-2*y!=arr[2]){\n printf(\"Impossible\\n\");\n }\n if(arr[2]==c){\n printf(\"%d %d %d\\n\",y,arr[1]-y,arr[0]-y);\n }\n else if(arr[2]==a){\n printf(\"%d %d %d\\n\",b-y,y,c-y);\n }\n else if(arr[2]==b){\n printf(\"%d %d %d\\n\",a-y,c-y,y);\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a, b, c;\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\tif(a>=b&&b>=c){\n\t\tif((b+c)<a)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", c, b-c, a-c);\n\t}else if(a>=c&&c>=b){\n\t\tif((b+c)<a)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", a-b, c-b, b);\n\t}else if(c>=a&&a>=b){\n\t\tif((b+a)<c)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", a-b, c-b, b);\n\t}else if(c>=b&&b>=a){\n\t\tif((b+a)<c)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", b-a, a, c-a);\n\t}else if(b>=a&&a>=c){\n\t\tif((c+a)<b)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", c, b-c, a-c);\n\t}else{\n\t\tif((a+c)<b)\n\t\t\tprintf(\"Impossible\\n\");\n\t\telse\n\t\t\tprintf(\"%d %d %d\\n\", b-a, a, c-a);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,c,f=0,g=0,h=0,s,d;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ts=a+b+c;\n\tif (s%2==1){\n\t\tprintf(\"Impossible\");\n\t\treturn 0;\n\t}\n\tf=(a+b-c);\n\tg=(b+c-a);\n\th=(a+c-b);\n\tif (g%2==0 && f%2==0 && h%2==0){\n\t\tprintf(\"%d %d %d\",f/2,g/2,h/2);\n\t}\n\telse{\n\t\tprintf(\"Impossible\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d\",&a,&b,&c); int order;\n if(a==0 || b==0 || c==0){\n printf(\"Impossible\");\n return 0;\n }\n int max=a;\n order=1;\n if(b>max){\n max=b; order=2;}\n if(c>max){\n max=c; order=3;}\n int i;\n for(i=0;i<=max;i++){\n if(order==1 && (b-i)==(c-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",i,b-i,max-i);\n return 0;\n }\n if(order==1 && (c-i)==(b-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,b-i,i);\n return 0;\n }\n if(order==2 && (a-i)==(c-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",i,max-i,a-i);\n return 0;\n }\n if(order==2 && (c-i)==(a-(max-i)) && (c-i)>=0){\n printf(\"%d %d %d\",max-i,i,c-i);\n return 0;\n }\n if(order==3 && (a-i)==(b-(max-i)) && (a-i)>=0){\n printf(\"%d %d %d\",a-i,max-i,i);\n return 0;\n }\n if(order==3 && (b-i)==(a-(max-i)) && (b-i)>=0){\n printf(\"%d %d %d\",a-i,i,max-i);\n return 0;\n }\n }\n printf(\"Impossible\");\n\n\n}\n"}, {"source_code": "/*Codeforces Round #200 (Div. 2) B. Simple Molecules*/\n#include <stdio.h>\nint Max(int a[],int n);\nint Min(int a[],int n);\nint main()\n{\n int a[4],x,y,z,i,max,min;\n for (i=1;i<=3;i++)\n scanf (\"%d\",&a[i]);\n max=Max(a,3);\n min=Min(a,3)-1;\n i=0;\n for (x=min/3;x<max&&i==0;x++)\n {\n y=a[2]-x;\n z=a[1]-x;\n if (z+y==a[3])\n {\n printf (\"%d %d %d\\n\",x,y,z);\n i=1;\n }\n }\n if (i==0)\n printf (\"Impossible\\n\");\n return 0;\n}\nint Max(int a[],int n)\n{\n int max=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (max<a[i])\n max=a[i];\n }\n return max;\n}\nint Min(int a[],int n)\n{\n int min=a[1],i;\n for (i=2;i<=n;i++)\n {\n if (min>a[i])\n min=a[i];\n }\n return min;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,A,B,C;\n scanf(\"%d %d %d\", &a,&b,&c);\n if ((a==b && c!=0)||(b==c && a!=0)||(a==c && b!=0))\n printf(\"Impossible\");\n else if (a<b+c && b<a+c && c<a+b)\n {\n for(A=1;A<=a;A++)\n {\n C=a-A;\n B=((a+b+c)/2)-(A+C);\n if(A+B+C==((a+b+c)/2) && b==A+B && c==B+C)\n printf(\"%d %d %d\",A,B,C);\n break;\n }\n }\n else if (a>b+c || b>a+c || c>a+b)\n printf(\"Impossible\");\n else if (a==b+c)\n printf(\"%d %d %d\", b,a-(b+c),c);\n else if (b==a+c)\n printf(\"%d %d %d\", a,c,b-(a+c));\n else if (c==a+b)\n printf(\"%d %d %d\", c-(a+b),b,a);\n\n}\n"}], "src_uid": "b3b986fddc3770fed64b878fa42ab1bc"} {"nl": {"description": "Vivek initially has an empty array $$$a$$$ and some integer constant $$$m$$$.He performs the following algorithm: Select a random integer $$$x$$$ uniformly in range from $$$1$$$ to $$$m$$$ and append it to the end of $$$a$$$. Compute the greatest common divisor of integers in $$$a$$$. In case it equals to $$$1$$$, break Otherwise, return to step $$$1$$$. Find the expected length of $$$a$$$. It can be shown that it can be represented as $$$\\frac{P}{Q}$$$ where $$$P$$$ and $$$Q$$$ are coprime integers and $$$Q\\neq 0 \\pmod{10^9+7}$$$. Print the value of $$$P \\cdot Q^{-1} \\pmod{10^9+7}$$$.", "input_spec": "The first and only line contains a single integer $$$m$$$ ($$$1 \\leq m \\leq 100000$$$).", "output_spec": "Print a single integer\u00a0\u2014 the expected length of the array $$$a$$$ written as $$$P \\cdot Q^{-1} \\pmod{10^9+7}$$$.", "sample_inputs": ["1", "2", "4"], "sample_outputs": ["1", "2", "333333338"], "notes": "NoteIn the first example, since Vivek can choose only integers from $$$1$$$ to $$$1$$$, he will have $$$a=[1]$$$ after the first append operation, and after that quit the algorithm. Hence the length of $$$a$$$ is always $$$1$$$, so its expected value is $$$1$$$ as well.In the second example, Vivek each time will append either $$$1$$$ or $$$2$$$, so after finishing the algorithm he will end up having some number of $$$2$$$'s (possibly zero), and a single $$$1$$$ in the end. The expected length of the list is $$$1\\cdot \\frac{1}{2} + 2\\cdot \\frac{1}{2^2} + 3\\cdot \\frac{1}{2^3} + \\ldots = 2$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int64_t i64;\ntypedef int32_t i32;\n\nstatic void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}\nstatic i64 read_int(void){int prev='\\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}\n\nconst i32 mod = 1000000007;\n\ni32 inv (i32 a) {\n i32 t = 1;\n while (a > 1) {\n t = (i64) t * (mod - mod / a) % mod;\n a = mod % a;\n }\n return t;\n}\n\nvoid run (void) {\n const i32 n = read_int();\n i32 *factor = (i32 *) calloc (n + 1, sizeof (i32));\n for (i32 i = 1; i <= n; ++i) {\n factor[i] = i;\n }\n for (i32 i = 2; i * i <= n; ++i) {\n if (factor[i] < i) continue;\n for (i32 j = i * i; j <= n; j += i) {\n factor[j] = i;\n }\n }\n i32 *dp = (i32 *) calloc (n + 1, sizeof (i32));\n dp[1] = 0;\n for (i32 i = 2; i <= n; ++i) {\n i32 f[64];\n f[0] = 1;\n i32 len = 1;\n i32 t = i;\n while (t > 1) {\n i32 p = factor[t];\n while (t % p == 0) {\n\tt /= p;\n }\n for (i32 j = 0; j < len; ++j) {\n\tf[j + len] = f[j] * p;\n }\n len *= 2;\n }\n if (f[len - 1] != i) {\n dp[i] = dp[f[len - 1]];\n continue;\n }\n i32 prob[64];\n for (i32 j = 0; j < len; ++j) {\n prob[j] = (i64) (n / f[j]) * inv(n) % mod;\n }\n for (i32 j = len - 1; j >= 0; --j) {\n for (i32 k = j - 1; k >= 0; --k) {\n\tif ((j & k) == k) {\n\t prob[k] = (prob[k] - prob[j] + mod) % mod;\n\t}\n }\n }\n i32 local = 1;\n for (i32 j = 0; j < len - 1; ++j) {\n local = (local + (i64) prob[j] * dp[f[j]]) % mod;\n }\n dp[i] = (i64) local * inv((1 - prob[len - 1] + mod) % mod) % mod;\n }\n i32 ans = 1;\n for (i32 i = 1; i <= n; ++i) {\n ans = (ans + (i64)dp[i] * inv(n)) % mod;\n }\n print_int(ans);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int64_t i64;\ntypedef int32_t i32;\n\nstatic void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}\nstatic i64 read_int(void){int prev='\\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}\n\nconst i32 mod = 1000000007;\n\ni32 inv (i32 a) {\n i32 t = 1;\n while (a > 1) {\n t = (i64) t * (mod - mod / a) % mod;\n a = mod % a;\n }\n return t;\n}\n\nvoid run (void) {\n const i32 n = read_int();\n i32 *factor = (i32 *) calloc (n + 1, sizeof (i32));\n for (i32 i = 1; i <= n; ++i) {\n factor[i] = i;\n }\n for (i32 i = 2; i * i <= n; ++i) {\n if (factor[i] < i) continue;\n for (i32 j = i * i; j <= n; j += i) {\n factor[j] = i;\n }\n }\n i32 *dp = (i32 *) calloc (n + 1, sizeof (i32));\n dp[1] = 0;\n for (i32 i = 2; i <= n; ++i) {\n i32 f[64];\n f[0] = 1;\n i32 len = 1;\n i32 t = i;\n while (t > 1) {\n i32 p = factor[t];\n while (t % p == 0) {\n\tt /= p;\n }\n for (i32 j = 0; j < len; ++j) {\n\tf[j + len] = f[j] * p;\n }\n len *= 2;\n }\n if (f[len - 1] != i) {\n dp[i] = dp[f[len - 1]];\n continue;\n }\n i32 prob[64];\n for (i32 j = 0; j < len; ++j) {\n prob[j] = (i64) (n / f[j]) * inv(n) % mod;\n }\n for (i32 j = len - 1; j >= 0; --j) {\n for (i32 k = j - 1; k >= 0; --k) {\n\tif ((j & k) == k) {\n\t prob[k] = (prob[k] - prob[j] + mod) % mod;\n\t}\n }\n }\n i32 local = 1;\n for (i32 j = 0; j < len - 1; ++j) {\n local = (local + (i64) prob[j] * dp[f[j]]) % mod;\n }\n dp[i] = local * inv((1 - prob[len - 1] + mod) % mod) % mod;\n }\n i32 ans = 1;\n for (i32 i = 1; i <= n; ++i) {\n ans = (ans + (i64)dp[i] * inv(n)) % mod;\n }\n print_int(ans);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}], "src_uid": "ff810b16b6f41d57c1c8241ad960cba0"} {"nl": {"description": "Consider the following experiment. You have a deck of $$$m$$$ cards, and exactly one card is a joker. $$$n$$$ times, you do the following: shuffle the deck, take the top card of the deck, look at it and return it into the deck.Let $$$x$$$ be the number of times you have taken the joker out of the deck during this experiment. Assuming that every time you shuffle the deck, all $$$m!$$$ possible permutations of cards are equiprobable, what is the expected value of $$$x^k$$$? Print the answer modulo $$$998244353$$$.", "input_spec": "The only line contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \\le n, m < 998244353$$$, $$$1 \\le k \\le 5000$$$).", "output_spec": "Print one integer \u2014 the expected value of $$$x^k$$$, taken modulo $$$998244353$$$ (the answer can always be represented as an irreducible fraction $$$\\frac{a}{b}$$$, where $$$b \\mod 998244353 \\ne 0$$$; you have to print $$$a \\cdot b^{-1} \\mod 998244353$$$).", "sample_inputs": ["1 1 1", "1 1 5000", "2 2 2", "998244352 1337 5000"], "sample_outputs": ["1", "1", "499122178", "326459680"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define N\t5000\n#define MD\t998244353\n\nlong long power(int a, int k) {\n\tlong long p;\n\n\tif (k == 0)\n\t\treturn 1;\n\tp = power(a, k >> 1);\n\tp = p * p % MD;\n\tif (k & 1)\n\t\tp = p * a % MD;\n\treturn p;\n}\n\nint dp[N + 1][N + 1];\n\nvoid init(int k, int n) {\n\tint i, j;\n\n\tdp[0][0] = 1;\n\tfor (i = 0; i < k; i++)\n\t\tfor (j = 0; j < k; j++) {\n\t\t\tlong long x = dp[i][j];\n\n\t\t\tif (x == 0)\n\t\t\t\tcontinue;\n\t\t\tdp[i + 1][j] = (dp[i + 1][j] + x * j) % MD;\n\t\t\tdp[i + 1][j + 1] = (dp[i + 1][j + 1] + x * (n - j)) % MD;\n\t\t}\n}\n\nint main() {\n\tint n, m, k, d, vm, ans;\n\n\tscanf(\"%d%d%d\", &n, &m, &k), init(k, n);\n\tvm = power(m, MD - 2);\n\tans = 0;\n\tfor (d = 0; d <= k; d++)\n\t\tans = (ans + dp[k][d] * power(vm, d)) % MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#pragma GCC optimize(\"Ofast\")\n#include <stdio.h>\n\n#define MAXN 5001\n\nconst int md = 998244353;\n\nint n, m, k;\nint dp[MAXN][MAXN];\n\nint modpow(int bs, int pw){\n\tlong long bs1 = bs;\n\tlong long ans = 1;\n\twhile(pw){\n\t\tif(pw & 1){\n\t\t\tans *= bs1;\n\t\t\tans %= md;\n\t\t}\n\t\tpw >>= 1;\n\t\tbs1 *= bs1;\n\t\tbs1 %= md;\n\t}\n\treturn (int)ans;\n}\n\nint main(){\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tdp[0][0] = 1;\n\tfor(int i = 0; i < k; i++){\n\t\tfor(int j = 0; j < k; j++){\n\t\t\tdp[i+1][j] = (dp[i+1][j] + ((1LL * j * dp[i][j])%md) + md)%md;\n\t\t\tdp[i+1][j+1] = (dp[i+1][j+1] + ((1LL * (n-j) * dp[i][j])%md) + md)%md;\n\t\t}\n\t}\n\tint ans = 0;\n\tint inv = modpow(m, md-2);\n\tfor(int i = 1; i <= k; i++){\n\t\tans = (ans + ((modpow(inv, i) * 1LL * dp[k][i])%md))%md;\n\t}\n\tprintf(\"%d\\n\", ans);\n}\n"}], "negative_code": [], "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b"} {"nl": {"description": "Koa the Koala has a directed graph $$$G$$$ with $$$n$$$ nodes and $$$m$$$ edges. Each edge has a capacity associated with it. Exactly $$$k$$$ edges of the graph, numbered from $$$1$$$ to $$$k$$$, are special, such edges initially have a capacity equal to $$$0$$$.Koa asks you $$$q$$$ queries. In each query she gives you $$$k$$$ integers $$$w_1, w_2, \\ldots, w_k$$$. This means that capacity of the $$$i$$$-th special edge becomes $$$w_i$$$ (and other capacities remain the same).Koa wonders: what is the maximum flow that goes from node $$$1$$$ to node $$$n$$$ after each such query?Help her!", "input_spec": "The first line of the input contains four integers $$$n$$$, $$$m$$$, $$$k$$$, $$$q$$$ ($$$2 \\le n \\le 10^4$$$, $$$1 \\le m \\le 10^4$$$, $$$1 \\le k \\le \\min(10, m)$$$, $$$1 \\le q \\le 2 \\cdot 10^5$$$)\u00a0\u2014 the number of nodes, the number of edges, the number of special edges and the number of queries. Each of the next $$$m$$$ lines contains three integers $$$u$$$, $$$v$$$, $$$w$$$ ($$$1 \\le u, v \\le n$$$; $$$0 \\le w \\le 25$$$)\u00a0\u2014 the description of a directed edge from node $$$u$$$ to node $$$v$$$ with capacity $$$w$$$. Edges are numbered starting from $$$1$$$ in the same order they are listed in the input. The first $$$k$$$ edges are the special edges. It is guaranteed that $$$w_i = 0$$$ for all $$$i$$$ with $$$1 \\le i \\le k$$$. Each of the next $$$q$$$ lines contains $$$k$$$ integers $$$w_1, w_2, \\ldots, w_k$$$ ($$$0 \\le w_i \\le 25$$$) \u00a0\u2014 the description of the query. $$$w_i$$$ denotes the capacity of $$$i$$$-th edge.", "output_spec": "For the $$$i$$$-th query, print one integer $$$res_i$$$ \u00a0\u2014 the maximum flow that can be obtained from node $$$1$$$ to node $$$n$$$ given the $$$i$$$-th query's special edge weights.", "sample_inputs": ["2 1 1 3\n1 2 0\n0\n1\n2", "4 4 2 5\n1 2 0\n2 3 0\n2 4 5\n3 4 2\n0 0\n1 10\n10 0\n7 1\n7 2"], "sample_outputs": ["0\n1\n2", "0\n1\n5\n6\n7"], "notes": "NoteFor the second sample, the following images correspond to the first two queries (from left to right respectively). For each edge there is a pair flow/capacity denoting flow pushed through the edge and edge's capacity. The special edges are colored in red. As you can see in first query maximum flow from node $$$1$$$ to node $$$4$$$ equals $$$0$$$ and in second query equals $$$1$$$."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define N\t10000\n#define M\t10000\n#define K\t10\n#define C\t26\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint ij[M], cc[M * 2], m;\nint *oh[N], oo[N], n;\n\nvoid link(int i, int h) {\n\tint o = oo[i]++;\n\n\tif (o >= 2 && (o & o - 1) == 0)\n\t\toh[i] = (int *) realloc(oh[i], o * 2 * sizeof *oh[i]);\n\toh[i][o] = h;\n}\n\nint dd[N];\n\nint bfs(int s, int t) {\n\tstatic int qu[N];\n\tint i, head, cnt;\n\n\tfor (i = 0; i < n; i++)\n\t\tdd[i] = n;\n\thead = cnt = 0;\n\tdd[s] = 0, qu[head + cnt++] = s;\n\twhile (cnt) {\n\t\tint d, o;\n\n\t\ti = qu[cnt--, head++], d = dd[i] + 1;\n\t\tfor (o = 0; o < oo[i]; o++) {\n\t\t\tint h_ = oh[i][o];\n\n\t\t\tif (cc[h_]) {\n\t\t\t\tint h = h_ >> 1, j = i ^ ij[h];\n\n\t\t\t\tif (dd[j] > d) {\n\t\t\t\t\tdd[j] = d;\n\t\t\t\t\tif (j == t)\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\tqu[head + cnt++] = j;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\nint dfs(int i, int t, int c) {\n\tint d, o;\n\n\tif (i == t)\n\t\treturn c;\n\td = dd[i] + 1;\n\tfor (o = 0; o < oo[i]; o++) {\n\t\tint h_ = oh[i][o];\n\n\t\tif (cc[h_]) {\n\t\t\tint h = h_ >> 1, j = i ^ ij[h];\n\n\t\t\tif (dd[j] == d) {\n\t\t\t\tint f = dfs(j, t, min(c, cc[h_]));\n\n\t\t\t\tif (f) {\n\t\t\t\t\tcc[h_] -= f, cc[h_ ^ 1] += f;\n\t\t\t\t\treturn f;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tdd[i] = n;\n\treturn 0;\n}\n\nint dinic(int s, int t) {\n\tint sum = 0;\n\n\twhile (bfs(s, t)) {\n\t\tint f;\n\n\t\twhile ((f = dfs(s, t, C)))\n\t\t\tsum += f;\n\t}\n\treturn sum;\n}\n\nint ccc[K][M * 2];\nint cut[1 << K], k;\n\nvoid solve(int b, int h_, int s) {\n\tint h;\n\n\ts += dinic(0, n - 1);\n\tcut[b] = s;\n\tif (h_ < k) {\n\t\tmemcpy(ccc[h_], cc, m * 2 * sizeof *cc);\n\t\tfor (h = h_; h < k; h++) {\n\t\t\tcc[h << 1] = C;\n\t\t\tsolve(b | 1 << h, h + 1, s);\n\t\t\tmemcpy(cc, ccc[h_], m * 2 * sizeof *ccc[h_]);\n\t\t}\n\t}\n}\n\nint main() {\n\tstatic int ww_[K];\n\tint q, h, i, j;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &k, &q);\n\tfor (i = 0; i < n; i++)\n\t\toh[i] = (int *) malloc(2 * sizeof *oh[i]);\n\tfor (h = 0; h < m; h++) {\n\t\tint c;\n\n\t\tscanf(\"%d%d%d\", &i, &j, &c), i--, j--;\n\t\tij[h] = i ^ j, cc[h << 1] = c;\n\t\tlink(i, h << 1), link(j, h << 1 | 1);\n\t}\n\tsolve(0, 0, 0);\n\twhile (q--) {\n\t\tint b, w, ans;\n\n\t\tw = 0;\n\t\tfor (h = 0; h < k; h++) {\n\t\t\tscanf(\"%d\", &ww_[h]);\n\t\t\tw += ww_[h];\n\t\t}\n\t\tans = cut[0] + w;\n\t\tfor (b = 1; b < 1 << k; b++) {\n\t\t\tfor (h = 0; (b & 1 << h) == 0; h++)\n\t\t\t\tw += ww_[h];\n\t\t\tw -= ww_[h];\n\t\t\tans = min(ans, cut[b] + w);\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "7421c7d81cc7b481d61a6ef07e557e33"} {"nl": {"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_spec": "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_spec": "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.", "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"], "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."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint solve(int n, int v[], int d, int k){\n int cnt, *aux, max = 999999;\n \n for(int i = 0; i <= n - d; i++){\n cnt = 0;\n aux = calloc(k + 1, sizeof(int));\n\n for(int j = i; j < i + d; j++)\n if(aux[v[j]] == 0){\n aux[v[j]] = 1;\n cnt++;\n }\n\n if(cnt < max) max = cnt;\n free(aux);\n }\n\n return max;\n}\n\nint main(){\n int t, n, v[100], k, d;\n \n scanf(\"%d\", &t);\n for(int i = 1; i <= t; i++){\n scanf(\"%d%d%d\", &n, &k, &d);\n\n for(int j = 0; j < n; j++)\n scanf(\"%d\", &v[j]);\n \n printf(\"%d\\n\", solve(n, v, d, k));\n \n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<malloc.h>\nint main()\n{\n int t,n,k,d,count,min;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n],u[k+1],record[k+1];min=d,count=0;\n for(int i=0;i<k+1;i++)\n {\n u[i]=0;\n record[i]=0;\n }\n for(int i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(int i=0;i+d<=n;i++)\n {\n for(int j=i;j<i+d;j++)\n {\n if(record[a[j]]!=i)\n {\n record[a[j]]=i;\n u[a[j]]=0;\n }\n if(u[a[j]]==0)\n {\n u[a[j]]++;\n count++;\n }\n }\n min=count<min?count:min;\n count=0;\n }\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\nint main(void){\n \nlong long int test,i,j,n,count,x1,y1,flag=0,o1=0,o2=0,b1,count2=0,x,m,l,max,k,sum2,min,f,r,o,sum1,sum=0,y,count1, a[10000]={0};\nscanf(\"%lld\",&test);\nwhile(test--){\n\nscanf(\"%lld%lld%lld\",&n,&k,&m);\nfor(i=0;i<n;i++){\n scanf(\"%lld\",&a[i]);\n}\ncount=0;\nmax=1000000;\nfor(i=0;i<n-m+1;i++){\n long long int b[10000]={0};\n count=0;\n for(j=i;j<i+m;j++){\n if(b[a[j]]==0){\n count++;\n b[a[j]]++;\n }\n }\n if(count<max){\n max=count;\n }\n}\nprintf(\"%lld\\n\",max);\n}\n \n \nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n int answ[10000];\n int y = 0;\n for(int pop = 0; pop < t; pop++){\n int n, k, d;\n scanf(\"%d %d %d\", &n, &k, &d);\n int dni[150];\n int serials[150];\n for(int i = 0; i < n; i++){\n scanf(\"%d\", &dni[i]);\n }\n\n\n int counttmax = 32000;\n for(int i = 0; i < n - d + 1; i++){\n for(int i = 0; i < 150; i++){\n serials[i] = 0;\n }\n int countt = 0;\n for(int j = i; j < i + d; j++){\n if(serials[dni[j]] == 0){\n serials[dni[j]] = 1;\n countt++;\n }\n }\n if(countt < counttmax){\n counttmax = countt;\n }\n }\n answ[y] = counttmax;\n y++;\n\n\n }\n for(int i = 0; i < y; i++){\n printf(\"%d\\n\", answ[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint number_of_series(int *arr, int start, int length, int k_series)\n{\n int number = 0;\n\n int *series = malloc(sizeof(int) * (k_series+1));\n memset(series, 0, sizeof(int) * (k_series+1));\n\n for (int i = start; i < start + length; ++i)\n series[arr[i]] += 1;\n\n for (int i = 0; i <= k_series; ++i)\n number += (series[i] > 0);\n\n free(series);\n return number;\n}\n\nint main()\n{\n int t;\n int all_days, k_series, days;\n int min_subs, tmp_subs;\n\n scanf(\"%d\", &t);\n for (t; t > 0; --t)\n {\n scanf(\"%d %d %d\", &all_days, &k_series, &days);\n\n int *a = malloc(sizeof(int) * all_days);\n\n for (int i = 0; i < all_days; ++i)\n scanf(\"%d\", &a[i]);\n\n min_subs = number_of_series(a, 0, days, k_series);\n\n for (int i = 1; i <= all_days-days; ++i)\n {\n tmp_subs = number_of_series(a, i, days, k_series);\n if (tmp_subs < min_subs)\n min_subs = tmp_subs;\n }\n printf(\"%d\\n\", min_subs);\n free(a);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint i,j,n,k,d,count,mn=10000,a[1000]={0};\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\t\tj=0;\n\t\twhile(d+j<=n)\n\t\t{\n\t\t\tcount=0;\n\t\t\tint b[1000]={0};\n\t\t\tfor(i=j;i-j<d;i++)\n\t\t\t{\n\t\t\t\tif(b[a[i]]!=-1)\n\t\t\t\t{\n\t\t\t\t//\tprintf(\"1 b[a[%d]]= %d a[%d] = %d\\n\",i,b[a[i]],i,a[i]);\n\t\t\t\t\tcount++;\n\t\t\t\t//\tprintf(\"1 count = %d\\n\",count);\n\t\t\t\t\tb[a[i]]=-1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(mn>count)\n\t\t\t\tmn=count;\t\t\n\t\t\tj++;\n\t\t}\n\t\tprintf(\"%d\\n\",mn);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,k,d,i,j,x,y=0,z,m=0;\n scanf(\"%d%d%d\",&n,&k,&d);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n z=k;\n for(i=0;i<n-d+1;i++)\n {\n y=0;\n m=0;\n for(j=i;j<d+i;j++)\n {\n m=0;\n for(x=j;x<d+i;x++)\n {\n if(a[j]==a[x])\n m++;\n }\n if(m==1)\n y+=1;\n }\n if(y<z)\n z=y;\n }\n printf(\"%d\\n\",z);\n }\n return 0;\n}\n"}, {"source_code": "a[222222], c[1111111], l, mn;\nmain(n, k, d, i, j) {\n\tfor (scanf(\"%*d\"); ~scanf(\"%d%d%d\", &n, &k, &d);) {\n\t\tfor (i = 1, l = 0, mn = 1e9; i <= n; i++) {\n\t\t\tscanf(\"%d\", a + i);\n\t\t\tl += !c[a[i]], c[a[i]]++;\n\t\t\tif (i > d) l -= c[a[i - d]] == 1, c[a[i - d]]--;\n\t\t\tif (i >= d) mn = mn < l ? mn : l;\n\t\t}\n\t\tfor (i = n - d + 1; i <= n; i++) c[a[i]]--;\n\t\tprintf(\"%d\\n\", mn);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#define N 102\nint main(){\n int t;\n scanf(\"%d\",&t);\n int a[N];\n int i,j;\n char see[N];\n while(t--){\n int n,k,d;\n scanf(\"%d%d%d\",&n,&k,&d);\n for(i=1;i<=n;i++){\n scanf(\"%d\",&a[i]);\n }\n int answer=k+1;\n for(i=1;i<=n-d+1;i++){\n for(j=1;j<=k;j++){\n see[j]=0;\n }\n for(j=0;j<d;j++){\n see[a[i+j]]=1;\n }\n int buy=0;\n for(j=1;j<=k;j++){\n if(see[j]){\n buy++;\n }\n }\n if(buy<answer){\n answer=buy;\n }\n }\n printf(\"%d\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nvoid read(int *arr, int length) {\n for (int i=0; i<length; i++) scanf(\"%d\",(arr+i));\n}\nvoid initialize(int *arr, int length) {\n for (int i=0; i<length; i++) *(arr+i)=0;\n}\nint count(int *arr, int length) {\n int res=0;\n for (int i=0; i<length; i++) res+=arr[i];\n return res;\n}\nint subscription(int *arr, int length, int show, int d) {\n int lim=length-d+1,sieve[show],res=101,temp;\n for (int i=0; i<lim; i++) {\n initialize(sieve,show);\n for (int j=0; j<d; j++) sieve[arr[i+j]-1]=1;\n temp=count(sieve,show);\n if (res>temp) res=temp;\n }\n return res;\n}\nint main() {\n int queries,len,show,row,schedule[100];\n scanf(\"%d\\n\",&queries);\n for (int i=0; i<queries; i++) {\n scanf(\"%d %d %d\\n\",&len,&show,&row);\n read(schedule,len);\n printf(\"%d\\n\",subscription(schedule,len,show,row));\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint stat[102];\nint data[102];\nvoid worker()\n{\n int n, k, d;\n scanf(\"%d%d%d\", &n, &k, &d);\n memset(stat, 0, sizeof(int)*102);\n int cnt = 0;\n for(int i = 0; i < d; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n }\n int minv = cnt;\n for(int i = d; i < n; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n stat[data[i-d]]--;\n if(stat[data[i-d]] == 0)\n cnt--;\n if(cnt < minv)\n minv = cnt;\n }\n printf(\"%d\\n\", minv);\n}\nint main()\n{\n int q;\n scanf(\"%d\", &q);\n while(q--)\n worker();\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,k,d,i;\n scanf(\"%d\",&t);\n for(i=1;i<=t;i=i+1)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n],b[k],j,m,r=0,v=0,p,s;\n for(j=0;j<n;j=j+1)\n {\n scanf(\"%d\",&a[j]);\n }\n for(j=1;j<=k;j=j+1)\n {\n b[j]=j;\n }\n for(j=0;j<=n-d;j=j+1)\n {\n int q=0;\n for(m=0;m<d;m=m+1)\n {\n p=a[j+m];\n if(b[p]!=0)\n {\n q=q+1;\n b[p]=0;\n }\n }\n if(v==0)\n {\n r=q;\n v=1;\n }\n if(q<=r)\n {\n r=q;\n }\n for(s=1;s<=k;s=s+1)\n {\n b[s]=s;\n }\n }\n printf(\"%d\\n\",r);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid prmin(int * a, int n) {\n int i;\n for (i = 0; i < n; i++) {\n if (a[0] > a[i])\n a[0] = a[i];\n }\n printf(\"%d\\n\", a[0]);\n}\nint sort(int * b, int n, int m) {\n int sum = 1, i, j, k;\n int a[100];\n for (i = n; i < m; i++)\n a[i] = b[i];\n for (i = n; i < m; i++) {\n for (j = i; j < m; j++) {\n if (a[i] > a[j]) {\n k = a[i];\n a[i] = a[j];\n a[j] = k;\n }\n }\n // printf(\"<%d>\", a[i]);\n }\n for (i = n; i < m - 1; i++) {\n if (a[i] != a[i + 1])\n sum = sum + 1;\n else\n sum = sum;\n }\n //printf(\"\\n\");\n //printf(\"%d\\n\", sum);\n return sum;\n}\nint main() {\n int t, n, k, d, i, j;\n int a[100];\n int sum[100];\n scanf(\"%d\", &t);\n for (i = 0; i < t; i++) {\n scanf(\"%d%d%d\", &n, &k, &d);\n for (j = 0; j < n; j++)\n scanf(\"%d\", &a[j]);\n for (j = 0; j < n - d + 1; j++)\n sum[j] = sort(a, j, j + d);\n prmin(sum, n - d + 1);\n //for (j = 0; j < n - d + 1; j++)\n // printf(\"%d \", sum[j]);\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int t, n, k, d;\n\n int curAmntTypes = 0;\n\n int minAmntTypes;\n scanf(\"%d\", &t);\n for(int iter=0; iter < t ; iter++)\n {\n minAmntTypes = 99999999;\n scanf(\"%d\", &n);\n scanf(\"%d\", &k);\n scanf(\"%d\", &d);\n int types[k];\n\n\n int A[n];\n\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", A+i);\n }\n for(int i = 0; i <= n-d;i++)\n {\n for(int ij = 0; ij < k; ij++){\n types[ij] = 0;\n }\n curAmntTypes = 0;\n for(int j = i; j<(i+d); j++)\n {\n if(!types[A[j]-1])\n {\n types[A[j]-1] = 1;\n curAmntTypes++;\n }\n\n }\n if(curAmntTypes < minAmntTypes) minAmntTypes = curAmntTypes;\n\n }\n printf(\"%d\\n\", minAmntTypes);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint minsub(int n, int d, int *arr){\n int min = d, i, j, k;\n int *minSub;\n minSub = (int*)malloc(sizeof(int) * (n - d + 1));\n for(i = 0; i < n - d + 1; i++){\n \tminSub[i] = 1;\n\t}\n for(i = 0; i <= n - d; i++){\n for(j = i + 1; j < i + d; j++){\n for(k = i; k < j; k++){\n\t\t if(arr[k] == arr[j])\n\t\t\t break;\n\t\t }\n if(k == j)\n minSub[i]++;\n }\n }\n \n for(i = 0; i < n - d + 1; i++){\n \tif(minSub[i] < min)\n \t\tmin = minSub[i];\n\t}\n\t \n\treturn min;\n}\n\nint main(){\n int t;\n scanf(\"%d\", &t);\n \n while(t--){\n int *arr, i;\n int n, k , d;\n scanf(\"%d%d%d\", &n, &k, &d);\n arr = (int*)malloc(sizeof(int) * n);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n \n int min = minsub(n, d, arr);\n printf(\"%d\\n\", min);\n }\n}"}, {"source_code": "#include<stdio.h>\nvoid mergesort(int arr[], int l, int r)\n{\nif (l < r)\n{\nint m = l+(r-l)/2;\nmergesort(arr, l, m);\nmergesort(arr, m+1,r);\nmerge(arr, l, m, r);\n}\n}\nvoid merge(int arr[], int l, int m, int r)\n{\nint i, j, k;\nint n1 = m - l + 1;\nint n2 = r - m;\nint L[n1], R[n2];\nfor (i = 0; i < n1; i++)\nL[i] = arr[l + i];\nfor (j = 0; j < n2; j++)\nR[j] = arr[m + 1+ j];\ni = 0;\nj = 0;\nk = l;\nwhile (i < n1 && j < n2)\n{\nif (L[i] <= R[j])\n{\narr[k] = L[i];\ni++;\n}\nelse\n{\narr[k] = R[j];\nj++;\n}\nk++;\n}\nwhile (i < n1)\n{\narr[k] = L[i];\ni++;\nk++;\n}\nwhile (j < n2)\n{\narr[k] = R[j];\nj++;\nk++;\n}\n}\nint distinct(int ar[],int n)\n{\n int cnt=1;\n mergesort(ar,0,n-1);\n for(int i=0;i<n-1;i++)\n {\n if(ar[i]!=ar[i+1])\n cnt++;\n }\n //\n return cnt;\n}\nint nnn(int a,int b)\n{\nreturn (a<b)?a:b;\n}\nint main()\n{\n int t,m;\n scanf(\"%d\",&t);\n m=t-1;\n int arr[t];\n while(t--)\n {\n int n,k,d,min=1000000000,ccnt=0;\n scanf(\"%d%d%d\",&n,&k,&d);\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int i=0;i<=n-d;i++)\n {\n int temp[d],z=0;\n for(int j=i;j<i+d;j++)\n temp[z++]=ar[j];\n ccnt=distinct(temp,d);\n if(ccnt<min)\n min=ccnt;\n }\n arr[t]=min;\n //printf(\"%d\",ccnt);\n }\n for(int i=m;i>=0;i--)\n printf(\"%d\\n\",arr[i]);\n /*char s[n+1],ch[5]={'A','C','T','G','\\0'};\n scanf(\"%s\",s);\n s[n]='\\0';\n for(int i=0;i<=n-4;i++)\n {\n int a=0,b=0,cnt=0,z=0;\n for(int j=i;j<i+4;j++)\n {\n a=abs(ch[z]-s[j]);\n if(s[j]>ch[z])\n b=abs(91-s[j]+ch[z]-65);\n else\n b=abs(91-ch[z]+s[j]-65);\n z++;\n //printf(\"%d %d\\n\",a,b);\n cnt+=nnn(a,b);\n }\n //printf(\"%d\\n\",cnt);\n if(cnt<min)\n min=cnt;\n }\n printf(\"%d\",min);\n /*int ar[n],a=0,T,min=1000000000;\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n mergesort(ar,0,n-1);\n for(int t=1;t<=100;t++)\n {\n a=0;\n for(int j=0;j<n;j++)\n {\n if(ar[j]<t)\n a+=t-1-ar[j];\n else if(t<ar[j])\n a+=ar[j]-(t+1);\n }\n \n if(a<min)\n {\n min=a;\n T=t;\n }\n }\n printf(\"%d %d\",T,min);*/\n // printf(\"\\n%d\",ar[n/2]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint n,k,d;\n\t\tscanf(\"%d%d%d\",&n,&k,&d);\n\t\tint arr[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t scanf(\"%d\",&arr[i]);\n\t\tint s[k+1];\n\t\tint count,min=100000;\n\t\tfor(int i=0;i<n-d+1;i++)\n\t\t{\n\t\t\tfor(int j=0;j<=k;j++)\n\t\t\t s[j]=0;\n\t\t\tcount=0;\n\t\t\tfor(int l=i;l<i+d;l++)\n\t\t\t{\n\t\t\t\tif(s[arr[l]]==0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\ts[arr[l]]=1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count<min)\n\t\t\t min=count;\n\t\t}\n\t\tprintf(\"%d\\n\",min);\n\t}\n\treturn 0;\n}\n\n\t\t \t \t\t\t \t \t \t \t\t\t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{ int t,i;\n scanf(\"%d\",&t);\nfor(i=0;i<t;i++)\n{ int n,k,d,p;\nscanf(\"%d %d %d\",&n,&k,&d);\nint b[k];\nfor(p=0;p<k;p++)\n{ b[p]=0;}\nint a[n],j,l,s=0,y,z,m,min=d;\nfor(j=0;j<n;j++)\n{ scanf(\"%d\",&a[j]);}\nfor(y=0;y<=n-d;y++)\n{ for(l=y;l<y+d;l++)\n {z=a[l];\nif(b[z-1]==0)\n{s++;\n b[z-1]=1;}\nelse\ns=s;}\nif(s<min)\n{ min=s;\ns=0;}\nelse\n{ s=0;}\nfor(m=0;m<k;m++)\n{ b[m]=0;}\n}\nprintf(\"%d\\n\",min);\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint countf(int a[],int k,int l,int r)\n{\n int b[k];int i, s=0;\n for(i=0;i<k;i++)b[i]=0;\n for(i=l;i<=r;i++)\n {\n if(b[a[i]-1]==0)s++;\n b[a[i]-1]=1;\n }\n return s;\n}\nint main()\n{\n int t,n,v,k,d,i,min;\n scanf(\"%d\",&t);\n while(t--)\n {\n min=10000;\n scanf(\"%d%d%d\",&n,&k,&d);\n int a[n];\n for(i=0;i<n;i++)scanf(\"%d\",&a[i]);\n for(i=0;i+d-1<n;i++)\n {\n v=countf(a,k,i,i+d-1);\n if(v<min)min=v;\n }\n printf(\"%d\\n\",min);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t;\n\tscanf(\"%d\", &t);\n\tint n, k, d;\n\tint a[200005];\n\tint c[1000006];\n\tint count, ans;\n\tint i, j;\n\tfor (j = 0; j < t; j++)\n\t{\n\t\tscanf(\"%d %d %d\", &n, &k, &d);\n\t\tfor (i = 0; i < n; i++)\n\t\t\tscanf(\"%d\", &a[i]);\n\t\tfor (i = 0; i <= k; i++)\n\t\t\tc[i] = 0;\n\t\tcount = 0;\n\t\tfor (i = 0; i < d; i++)\n\t\t{\n\t\t\tif (c[a[i]] == 0)\n\t\t\t\tcount++;\n\t\t\tc[a[i]]++;\n\t\t}\n\t\tans = count;\n\t\tfor (i = 1; i + d - 1 < n; i++)\n\t\t{\n\t\t\tif (c[a[i + d - 1]] == 0)\n\t\t\t\tcount++;\n\t\t\tc[a[i + d - 1]]++;\n\t\t\tif (c[a[i - 1]] == 1)\n\t\t\t\tcount--;\n\t\t\tc[a[i - 1]]--;\n\t\t\tif (ans > count)\n\t\t\t\tans = count;\n\t\t}\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,k,d;\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int min=k;\n int count=0;\n int c[1000005]={0};\n for(int i=0;i<n;i++)\n {\n if(c[a[i]]==0)\n {\n count++;\n }\n c[a[i]]++;\n if(i+1>=d)\n {\n if(count<min)\n min=count;\n c[a[i+1-d]]--;\n if(c[a[i+1-d]]==0)\n count--;\n }\n }\n printf(\"%d\\n\",min);\n }\n return 0;\n}\n\n\n \n\n\n\n\n\n\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"string.h\"\n\n#define N 110\n\nint z[N], c[N];\n\nint min(int a, int b) { return a>b ? b : a; }\n\nint main()\n{\n int T, i;\n int n, k, d, num, ans;\n scanf(\"%d\", &T);\n while(T--)\n {\n num=0;\n scanf(\"%d%d%d\", &n, &k, &d);\n memset(c, 0, sizeof(c));\n for(i=1; i<=n; ++i) scanf(\"%d\", &z[i]);\n for(i=1; i<=d; ++i)\n {\n if( !(c[z[i]]++) ) num++;\n }\n ans = num;\n for(i=d+1; i<=n; ++i)\n {\n if( !(c[z[i]]++) ) num++;\n if( !(--c[z[i-d]]) ) num--;\n ans = min(ans, num);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint S[101];\nint F[101];\nint main()\n{\n\tint i;\n\tint t;\n\tint T;\n\tint n, k, d;\n\tint C;\n\tint R;\n\tscanf(\"%d\", &T);\n\twhile (T--)\n\t{\n\t\tscanf(\"%d %d %d\", &n, &k, &d);\n\t\tfor (i = 0; i < n; i++)\n\t\t{\n\t\t\tscanf(\"%d\", &S[i]);\n\t\t}\n\t\tfor (i = 1; i <= k; i++)\n\t\t{\n\t\t\tF[i] = 0;\n\t\t}\n\t\tC = 0;\n\t\tfor (t = 0; t < d; t++)\n\t\t{\n\t\t\tF[S[t]]++;\n\t\t\tif (F[S[t]] == 1)\n\t\t\t{\n\t\t\t\tC++;\n\t\t\t}\n\t\t}\n\t\tR = C;\n\t\twhile (t < n)\n\t\t{\n\t\t\tF[S[t - d]]--;\n\t\t\tif (F[S[t - d]] == 0)\n\t\t\t{\n\t\t\t\tC--;\n\t\t\t}\n\t\t\tF[S[t]]++;\n\t\t\tif (F[S[t]] == 1)\n\t\t\t{\n\t\t\t\tC++;\n\t\t\t}\n\t\t\tif (C < R)\n\t\t\t{\n\t\t\t\tR = C;\n\t\t\t}\n\t\t\tt++;\n\t\t}\n\t\tprintf(\"%d\\n\", R);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint min(int a,int b){\n if(a>b)\n return b;\n return a;\n}\nvoid tri_a_bulle(int *t, int n){\n int j =0,tmp =0,desordre =1;\n while(desordre)\n {\n desordre = 0;\n for(j =0; j < n-1; j++)\n {\n if(t[j] > t[j+1])\n {\n tmp = t[j+1];\n t[j+1] = t[j];\n t[j] = tmp;\n desordre = 1;\n }\n }\n }\n}\n\nint minsubs(int *mylist,int n, int d,int i){\n int m = 0;\n int *list;\n list = (int*)calloc(101,sizeof(int));\n for(int j=i;j<i+d;j++){\n list[mylist[j]]++;\n }\n for(int j=1;j <=100 ;j++){\n if(list[j] != 0)\n m++;\n }\n if((n-i) == d)\n return m;\n return min(m,minsubs(mylist,n,d,i+1));\n}\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int tab[t];\n for(int j=0;j < t;j++){\n int n,k,d;\n scanf(\"%d%d%d\",&n,&k,&d);\n int mylist[n];\n for(int i=0;i < n;i++){\n scanf(\"%d\",&mylist[i]);\n }\n tab[j] = minsubs(mylist,n,d,0);\n }\n for(int j=0;j < t;j++){\n printf(\"%d\\n\",tab[j]);\n }\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:26/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);++i)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n \nint main()\n{\n CASES\n {\n ll n,k,d;\n SC3(n,k,d);\n ll arr[n];\n REP(i,n)\n SC1(arr[i]);\n ll count[k+1];\n MEM(count,0);\n ll min=MAX,c=0;\n REP(i,d)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n }\n min=c;\n FOR(i,d,n-1)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n x=arr[i-d];\n count[x]--;\n if(count[x]==0)\n c--;\n min=minv(c,min);\n }\n PF1(min);\n }\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int l[100],l2[101],t,n,k,i,j,d,w,s,min;\n scanf(\"%i\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%i %i %i\",&n,&k,&d);\n\n for(j=0;j<101;j++)\n {\n l2[j]=0;\n }\n for(j=0;j<n;j++) scanf(\"%i\",&l[j]);\n w=n;\n s=0;\n for(j=0;j<d;j++)\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;\n\n }\n else l2[l[j]]++;\n min=s;\n\n for (j=d;j<w;j++)\n {\n l2[l[j-d]]--;\n if (l2[l[j-d]]==0) s--;\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;}\n else\n l2[l[j]]++;\n\n if (s<min)\n min=s;\n }\n\n\n\n printf(\"%i\\n\",min);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\t\n\tint cnt=0,t,n,k,d,i,j;\n\tscanf(\"%d\",&t);\n\t\n\twhile(cnt<t){\n\t\t\n\t\tint f;\n\t\tint consec = 0, maxconsec=0;\n\t\tint tab[200]={0};\n\t\tint aux [200]={0};\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\t\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&tab[i]);\n\t\t}\n\t\tmaxconsec = d;\n\t\tfor(i=0;i<n-d+1;i++){\n\t\t\t\n\t\t\tint aux [200]={0};\n\t\t\t\n\t\t\tfor(j=i;j<i+d;j++){\n\t\t\t\t\n\t\t\t\taux[tab[j]]++;\n\t\t\t}\n\t\t\t\n\t\t\tfor(f=0;f<=k+1;f++){\n\t\t\t\tif(aux[f]!=0)consec ++;\n\t\t\t}\n\t\t\t\n\t\t\tif(consec<=maxconsec) maxconsec = consec;\n\t\t\tconsec = 0;\n\t\t}\n\t\t\n\t\tprintf(\"%d \",maxconsec);\n\t\t\n\t\tcnt++;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n \n\tlong long int i,j,a[200001],b[20000],c=0,cc=0,bb=0,min=99999999,n,k,d,t;\n\tscanf(\"%lld\",&t);\n\tfor(i=0;i<t;i++)\n\t{\n\t scanf(\"%lld%lld%lld\",&n,&k,&d);\n\t for(j=0;j<n;j++)\n\t {\n\t scanf(\"%lld\",&b[j]);\n\t }\n\t c=0,cc=0,bb=0,min=99999999;\n\t for(j=0;j<200001;j++)\n\t {\n\t a[j]=0;\n\t }\n\t for(j=0;j<n;j++)\n\t {\n\t a[b[j]]=a[b[j]]+1;\n\t if(a[b[j]]==1)\n\t bb=bb+1;\n\t c=c+1;\n\t if(c>=d)\n\t {\n\t a[b[cc]]=a[b[cc]]-1;\n\t if(min>bb)\n\t min=bb;\n\t if(a[b[cc]]==0)\n\t bb=bb-1;\n\t cc=cc+1;\n\t }\n\t }\n\t printf(\"%lld\\n\",min);\n\t \n\t}\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\nint main()\n{\n ll t;\n scanf(\"%lld\", &t);\n while (t--)\n {\n ll n, k, d;\n scanf(\"%lld %lld %lld\", &n, &k, &d);\n ll arr[n];\n ll i = 0;\n // while (i < k)\n // {\n // ar[i++] = 0;\n // }\n // i = 0;\n while (i < n)\n {\n scanf(\"%lld\", &arr[i++]);\n }\n ll min = __LONG_LONG_MAX__;\n i = 0;\n while (i < n - d + 1)\n {\n // ll j = i;\n // // while (j < k)\n // {\n // ar[j++] = -1;\n // }\n ll ar[105];\n ll j = 0;\n while (j < 105)\n {\n ar[j++] = 0;\n }\n ll count;\n j = 0;\n count = 0;\n while (j < d)\n {\n if (ar[arr[i + j]] == 0)\n {\n count++;\n ar[arr[i + j]]++;\n }\n j++;\n }\n\n if (count < min)\n {\n min = count;\n }\n\n i++;\n }\n printf(\"%lld\\n\", min);\n }\n return 0;\n}"}, {"source_code": "a[222222], c[1111111], l, mn;\nmain(n, k, d, i, j) {\n\tfor (scanf(\"%*d\"); ~scanf(\"%d%d%d\", &n, &k, &d);) {\n\t\tfor (i = 1, l = 0, mn = 1e9; i <= n; i++) {\n\t\t\tscanf(\"%d\", a + i);\n\t\t\tl += !c[a[i]], c[a[i]]++;\n\t\t\tif (i > d) l -= c[a[i - d]] == 1, c[a[i - d]]--;\n\t\t\tif (i >= d) mn = mn < l ? mn : l;\n\t\t}\n\t\tfor (i = n - d + 1; i <= n; i++) c[a[i]]--;\n\t\tprintf(\"%d\\n\", mn);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,k,d,g,l=0;\n scanf(\"%d\",&t);\n int i,m=200,j;\n for(i=0;i<t;i++)\n {\n m=200;\n scanf(\"%d %d %d\",&n,&k,&d);\n\n int a[n];\n int b[k];\n for(g=0;g<k;g++)\n {\n b[g]=0;\n }\n for(j=0;j<n;j++)\n {\n scanf(\"%d\",&a[j]);\n }\n if(d==1)\n {\n printf(\"1\\n\");\n continue;\n }\n for(j=0;j<=n-d;j++)\n {\n l=0;\n\n\n\n for(k=j;k<j+d;k++)\n {\n\n if(b[a[k]-1]==1)\n {\n\n }\n else\n {\n\n\n b[a[k]-1]=1;\n if(b[a[k]-1]==1)\n {\n l++;\n }\n\n }\n }\n for(g=0;g<k;g++)\n {\n b[a[g]-1]=0;\n }\n if(l<m)\n {\n m=l;\n }\n }\n printf(\"%d\\n\",m);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define min(a, b) ((a)<(b)?(a):(b))\nint active[1000001], a[200000];\n\nvoid solve(){\n\tint n, i, d, best, curr=0;\n\tscanf(\"%d %*d %d\", &n, &d);\n\tbest=d;\n\tfor(i=0;i<n;++i) scanf(\"%d\", a+i);\n\tfor(i=0;i<d;++i){\n\t\tif(active[a[i]]==0) ++curr;\n\t\t++active[a[i]];\n\t}\n\tfor(;i<n;++i){\n\t\tbest=min(best, curr);\n\t\tif(active[a[i-d]]==1) --curr;\n\t\t--active[a[i-d]];\n\t\tif(active[a[i]]==0) ++curr;\n\t\t++active[a[i]];\n\t}\n\tbest=min(best, curr);\n\tfor(;i-d<n;++i) --active[a[i-d]];\n\tprintf(\"%d\\n\", best);\n}\n\nint main(){\n\tint t;\n\tscanf(\"%d\", &t);\n\twhile(t--) solve();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long long z,k;\n scanf(\"%lli\",&z);\n for(k=0;k<z;k++){\n long long n,k,d;\n scanf(\"%lli %lli %lli\",&n,&k,&d);\n long long i,j;\n long long tab[n];\n for(i=0;i<n;i++)\n scanf(\"%lli\",&tab[i]);\n long long min=d;\n\n for(j=0;j<n-d+1;j++){\n long long t[d];\n long long count=0;\n for(i=j;i<d+j;i++){\n long long x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%lli\\n\",min);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n\n for(j=0;j<n-d+1;j++){\n int t[d];\n int count=0;\n for(i=j;i<d+j;i++){\n int hb;\n for(hb=0;hb<d;hb++)\n t[i]=0;\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define m 1000007\n#define Min(a,b) a<b ? a : b\nint a[m], b[m];\nint main()\n{\n int q;\n scanf(\"%d\", &q);\n while(q--)\n {\n int n, k, d, i, min, j, c;\n memset(b,0,sizeof(b));\n scanf(\"%d%d%d\", &n, &k, &d);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(j=0,c=0; j<d; j++)\n {\n if(b[a[j]]==0)\n c++;\n b[a[j]]++;\n }\n i=0;\n min = c;\n while(j<n)\n {\n b[a[i]]--;\n if(b[a[i]]==0)\n c--;\n if(b[a[j]]==0)\n c++;\n b[a[j]]++;\n j++;\n i++;\n min = Min(min,c);\n }\n printf(\"%d\\n\", min);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, d, q, i, j;\n scanf(\"%d\\n\", &q);\n while(q--)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n static int a[101], b[101];\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n int t, ans=10e5;\n for(i=0; i<n-d+1; i++)\n {\n for(j=i, t=0; j<d+i; j++)\n {\n if(b[a[j]]==0)\n {\n t++;\n }\n b[a[j]]++;\n }\n if(ans > t)\n ans = t;\n memset(b,0,sizeof(b));\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n#include<stdlib.h>\n\nint main()\n{\n int n,k,d,dist=0,i,j,ara[200],min=200,ara1[200],t,ara2[200],q;\n scanf(\"%d\",&t);\n for(j=0; j<t; j++)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n\n for(i=0; i<=k; i++)\n {\n ara2[i]=0;\n }\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n\n for(i=0; i<d; i++)\n {\n ara2[ara[i]]++;\n }\n for(q=0; q<=k; q++)\n {\n if(ara2[q]>0)\n {\n dist++;\n }\n }\n if(dist<min)\n {\n min=dist;\n }\n dist=0;\n\n for(i=1; i<=(n-d); i++)\n {\n ara2[ara[i-1]]--;\n ara2[ara[i+d-1]]++;\n for(q=0; q<=k; q++)\n {\n if(ara2[q]>0)\n {\n dist++;\n }\n }\n if(dist<min)\n {\n min=dist;\n }\n dist=0;\n }\n ara1[j]=min;\n min=200;\n\n \n }\n for(j=0; j<t; j++)\n {\n printf(\"%d\\n\",ara1[j]);\n }\n\n\n //printf(\"%d\",min);\n return 0;\n\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint results[100];\nint t,t2;\nvoid onetest()\n{\n int n,k,d,i;\n scanf(\"%d %d %d\",&n,&k,&d);\n int no,minno,tmp;//no numarul de showuri in intervalul curent;minno rezultat\n int shows [k];\n int line [n];\n for(i=0; i<k; i++) //sa fie 0\n {\n shows[i]=0;\n };\n for(i=0; i<n; i++) //line e programul de n zile\n {\n scanf(\"%d\",&tmp);\n line[i]=tmp-1;// showurile sunt numerotate 1 k\n };\n for(i=0; i<d; i++) //numaram showuri zile 0->d\n {\n shows[line[i]]++;\n };\n no=0;\n for(tmp=0; tmp<k; tmp++) //numaram showuri cu >=1 episod fara a atinge i\n {\n if(shows[tmp])\n {\n no++;\n };\n };\n minno=no;\n while(i<n)//important\n {\n //ordinea conteaza\n shows[line[i]]++;//e un episod nou sin acel show\n if(shows[line[i]]==1)//daca am crescut 0->1\n {\n no++;\n };\n shows[line[i-d]]--;\n if(shows[line[i-d]]==0)//daca am scazut 1->0\n {\n no--;\n };\n if(no<minno) //minno e minim\n {\n minno=no;\n };\n i++;\n };\n results[t2-t]=minno;//se umple de la final\n}\nint main()\n{\n scanf(\"%d\",&t);\n t2=t;\n while(t)\n {\n onetest();\n t--;\n };\n for(t=0; t<t2; t++) //t pt ca i ar fi variabila in plus\n {\n printf(\"%d \\n\",results[t]);\n };\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint verno[1000006], curver, cnts[1000006], n, k, d, arr[200005];\n\nint gval(int idx){\n if(verno[idx] != curver){\n verno[idx] = curver;\n cnts[idx] = 0;\n }\n return cnts[idx];\n}\n\nint main(){\n int tcases;\n curver = 0;\n for(tcases = 0;tcases < 1000006;tcases++)verno[tcases] = curver;\n scanf(\"%d\", &tcases);\n while(tcases--){\n curver++;\n int i;\n scanf(\"%d %d %d\", &n, &k, &d);\n for(i = 0;i < n;i++)scanf(\"%d\", arr + i);\n int ans = k;\n int req = 0;\n for(i = 0;i < d;i++){\n int num = arr[i];\n cnts[num] = gval(num) + 1;\n if(cnts[num] == 1) req++;\n }\n if(ans > req) ans = req;\n for(i = 0;i + d < n;i++){\n\tint num;\n\tnum = arr[i];\n\tcnts[num] = cnts[num] - 1;\n\tif(cnts[num] == 0)req--;\n\n\tnum = arr[i + d];\n\tcnts[num] = gval(num) + 1;\n\tif(cnts[num] == 1) req++;\n\tif(ans > req) ans = req;\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint minimum(int a,int b){\n\tif(a<=b)return a;\n\telse return b;\n}\nvoid set_temp(int* temp,int n){\n\tfor(int i=0;i<n;i++){\n\t\ttemp[i]=-1;\n\t}\n}\nint main(){\n\tint t;scanf(\"%d\",&t);\n\twhile(t--){\n\t\tint n,k,d;\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\tint* arr = (int*)malloc(sizeof(int)*n);\n\t\tfor(int i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\t}\n\t\t//Look at every pair of d consecutive days\n\t\t//Get the minimum in every case\n\t\t//Number can be d\n\t\tint* temp = (int*)malloc(sizeof(int)*(k+1));\n\t\tk=k+1;\n\t\tset_temp(temp,k);\n\t\tint min = 1000000;\n\t\tfor(int i=0;i<=n-d;i++){\n\t\t\tint currmin = 0;\n\t\t\t//printf(\"In here\\n\");\n\t\t\tfor(int j=0;j<d;j++){\n\t\t\t\tif(temp[arr[i+j]]==1){\n\t\t\t\t\t//printf(\"equal\\n\");\n\t\t\t\t}\n\t\t\t\telse{temp[arr[i+j]]=1;\n\t\t\t\t\t\n\t\t\t\t\tcurrmin++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmin = minimum(min,currmin);\n\t\t\t//clear temp;\n\t\t\tset_temp(temp,k);\n\t\t}\n\t\tprintf(\"%d\\n\",min );\n\t}\n}"}, {"source_code": "#include<stdio.h>\n int ar1[105];\nvoid lol()\n{\n int i;\n for(i=0;i<=101;i++)\n {\n ar1[i]=0;\n }\n}\nint main()\n{\n int a,b,c,d,i,j,n,k;\n scanf(\"%d\",&a);\n for(i=1;i<=a;i++)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n int ar[105],min=105,m;\n for(j=0;j<n;j++)\n scanf(\"%d\",&ar[j]);\n for(j=0;j<n-d+1;j++)\n {\n c=0;\n lol();\n for(m=j;m<j+d;m++)\n {\n ar1[ar[m]]++;\n }\n for(m=0;m<=100;m++)\n {\n if(ar1[m]!=0)c++;\n }\n if(c<min)min=c;\n }\n if(min==105)printf(\"%d\\n\",d);\n else printf(\"%d\\n\",min);\n }\n return 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\n#include\"string.h\"\nint main()\n{\n\tint t,n,k,d;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint a[150],b[150];\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\tmemset(a,0,sizeof(a));\n\t\tmemset(b,0,sizeof(b));\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t}\n\t\tint c=1000;\n\t\tint sum;\n\t\tfor(int i=0;i<n-d+1;i++)\n\t\t{\n\t\t\tsum=0;\n\t\t\tmemset(b,0,sizeof(b));\n\t\t\tfor(int j=i;j<i+d;j++)\n\t\t\t{\n\t\t\t\tb[a[j]]++;\n\t\t\t\tif(b[a[j]]==1)\n\t\t\t\t{\n\t\t\t\t\tsum++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(sum<c)\n\t\t\t{\n\t\t\t\tc=sum;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",c);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile(t>0){\n\t\tint n,k,d;\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\tint a[n];\n\t\tint b[101];\n\t\tint max = k;\n\t\tint s = 0;\n\t\tfor(int i = 0;i<101;i++){\n\t\t\tb[i] = 0;\n\t\t}\n\t\tfor(int i = 0;i<n;i++) scanf(\"%d\",&a[i]);\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tif(i+d>n) continue;\n\t\t\tfor(int k = i;k-i<d;k++){\n\t\t\t\tb[a[k]]++;\n\t\t\t}\n\t\t\tfor(int k = 0;k<101;k++){\n\t\t\t\tif(b[k]>0) s++;\n\t\t\t\tb[k] = 0;\n\t\t\t}\n\t\t\tmax = max>s?s:max;\n\t\t\ts = 0;\n\t\t}\n\t\tprintf(\"%d\\n\",max);\n\t\tt--;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int t,i,j,k,l;\n\n scanf(\"%d\",&t);\n\n for(i=0;i<t;i++){\n\n int n,d,min=1000000;\n\n scanf(\"%d%d%d\",&n,&k,&d);\n\n int a[n],b[k+1],count=0;\n\n for(j=0;j<n;j++){\n scanf(\"%d\",&a[j]);\n\n b[a[j]]=0;\n }\n\n for(j=0;j<d;j++){\n\n if(b[a[j]]==0)\n count++;\n\n b[a[j]]++;\n }\n\n if(count<min)\n min=count;\n\n for(j=d;j<n;j++){\n\n if(b[a[j-d]]!=0){\n b[a[j-d]]--;\n\n if(b[a[j-d]]==0)\n count--;\n }\n\n if(b[a[j]]==0)\n count++;\n\n b[a[j]]++;\n\n if(count<min)\n min=count;\n }\n\n printf(\"%d\\n\",min);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,k,d;\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int min=k;\n int count=0;\n int c[1000005]={0};\n for(int i=0;i<n;i++)\n {\n if(c[a[i]]==0)\n {\n count++;\n }\n c[a[i]]++;\n if(i+1>=d)\n {\n if(count<min)\n min=count;\n c[a[i+1-d]]--;\n if(c[a[i+1-d]]==0)\n count--;\n }\n }\n printf(\"%d\\n\",min);\n }\n return 0;\n}\n\n\n \n\n\n\n\n\n\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n#include \"string.h\"\n\n#define N 1000010\n\nint z[N], c[N];\n\nint min(int a, int b) { return a>b ? b : a; }\n\nint main()\n{\n int T, i;\n int n, k, d, num, ans;\n scanf(\"%d\", &T);\n while(T--)\n {\n num=0;\n scanf(\"%d%d%d\", &n, &k, &d);\n memset(c, 0, sizeof(c));\n for(i=1; i<=n; ++i) scanf(\"%d\", &z[i]);\n for(i=1; i<=d; ++i)\n {\n if( !(c[z[i]]++) ) num++;\n }\n ans = num;\n for(i=d+1; i<=n; ++i)\n {\n if( !(c[z[i]]++) ) num++;\n if( !(--c[z[i-d]]) ) num--;\n ans = min(ans, num);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:26/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);++i)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\n\nint main()\n{\n CASES\n {\n ll n,k,d;\n SC3(n,k,d);\n ll arr[n];\n REP(i,n)\n SC1(arr[i]);\n int count[k+1];\n ll min=MAX,c=0;\n MEM(count,0);\n REP(i,d)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n }\n min=c;\n FOR(i,d,n-1)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n x=arr[i-d];\n count[x]--;\n if(count[x]==0)\n c--;\n min=minv(c,min);\n }\n PF1(min);\n }\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:26/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);++i)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\nint count[1000001];\nint main()\n{\n CASES\n {\n ll n,k,d;\n SC3(n,k,d);\n ll arr[n];\n REP(i,n)\n SC1(arr[i]);\n ll min=MAX,c=0;\n MEM(count,0);\n REP(i,d)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n }\n min=c;\n FOR(i,d,n-1)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n x=arr[i-d];\n count[x]--;\n if(count[x]==0)\n c--;\n min=minv(c,min);\n }\n PF1(min);\n }\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n \n \nmain()\n{\n int l[200000],*l2,t,n,k,i,j,d,w,s,min;\n scanf(\"%i\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%i %i %i\",&n,&k,&d);\n l2=(int*)calloc(k+1,sizeof(int));\n for(j=0;j<n;j++) scanf(\"%i\",&l[j]);\n w=n;\n s=0;\n for(j=0;j<d;j++)\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;\n \n }\n else l2[l[j]]++;\n min=s;\n \n for (j=d;j<w;j++)\n {\n l2[l[j-d]]--;\n if (l2[l[j-d]]==0) s--;\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;}\n else\n l2[l[j]]++;\n \n if (s<min)\n min=s;\n }\n \n \n \n printf(\"%i\\n\",min);\n free(l2);\n }\n return 0;\n}\n"}, {"source_code": "a[222222], c[1111111], l, mn;\nmain(n, k, d, i, j) {\n\tfor (scanf(\"%*d\"); ~scanf(\"%d%d%d\", &n, &k, &d);) {\n\t\tfor (i = 1, l = 0, mn = 1e9; i <= n; i++) {\n\t\t\tscanf(\"%d\", a + i);\n\t\t\tl += !c[a[i]], c[a[i]]++;\n\t\t\tif (i > d) l -= c[a[i - d]] == 1, c[a[i - d]]--;\n\t\t\tif (i >= d) mn = mn < l ? mn : l;\n\t\t}\n\t\tfor (i = n - d + 1; i <= n; i++) c[a[i]]--;\n\t\tprintf(\"%d\\n\", mn);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\n#define min(a, b) ((a)<(b)?(a):(b))\nint active[1000001], a[200000];\n\nvoid solve(){\n\tint n, i, d, best, curr=0;\n\tscanf(\"%d %*d %d\", &n, &d);\n\tbest=d;\n\tfor(i=0;i<n;++i) scanf(\"%d\", a+i);\n\tfor(i=0;i<d;++i){\n\t\tif(active[a[i]]==0) ++curr;\n\t\t++active[a[i]];\n\t}\n\tfor(;i<n;++i){\n\t\tbest=min(best, curr);\n\t\tif(active[a[i-d]]==1) --curr;\n\t\t--active[a[i-d]];\n\t\tif(active[a[i]]==0) ++curr;\n\t\t++active[a[i]];\n\t}\n\tbest=min(best, curr);\n\tfor(;i-d<n;++i) --active[a[i-d]];\n\tprintf(\"%d\\n\", best);\n}\n\nint main(){\n\tint t;\n\tscanf(\"%d\", &t);\n\twhile(t--) solve();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n \n int n, k, d, i;\n \n int a[200000];\n int b[1000000];\n \n for (i = 0; i < 1000000; i++)\n b[i] = 0;\n \n int size;\n \n while(t--)\n {\n scanf(\"%d%d%d\", &n, &k, &d);\n \n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n \n size = 0;\n \n for (i = 0; i < d; i++)\n {\n if (b[a[i]-1] == 0)\n size++;\n b[a[i]-1]++;\n }\n \n int ans = size;\n \n for (i = d; i < n; i++)\n {\n b[a[i-d]-1]--;\n \n if (b[a[i-d]-1] == 0)\n size--;\n \n if (b[a[i]-1] == 0)\n size++;\n \n b[a[i]-1]++;\n \n if (size < ans)\n ans = size;\n }\n \n printf(\"%d\\n\", ans);\n \n for (i = 0; i < n; i++)\n b[a[i]-1] = 0;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define m 1000007\n#define Min(a,b) a<b ? a : b\nint a[m], b[m];\nint main()\n{\n int q;\n scanf(\"%d\", &q);\n while(q--)\n {\n int n, k, d, i, min, j, c;\n memset(b,0,sizeof(b));\n scanf(\"%d%d%d\", &n, &k, &d);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(j=0,c=0; j<d; j++)\n {\n if(b[a[j]]==0)\n c++;\n b[a[j]]++;\n }\n i=0;\n min = c;\n while(j<n)\n {\n b[a[i]]--;\n if(b[a[i]]==0)\n c--;\n if(b[a[j]]==0)\n c++;\n b[a[j]]++;\n j++;\n i++;\n min = Min(min,c);\n }\n printf(\"%d\\n\", min);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint verno[1000006], curver, cnts[1000006], n, k, d, arr[200005];\n\nint gval(int idx){\n if(verno[idx] != curver){\n verno[idx] = curver;\n cnts[idx] = 0;\n }\n return cnts[idx];\n}\n\nint main(){\n int tcases;\n curver = 0;\n for(tcases = 0;tcases < 1000006;tcases++)verno[tcases] = curver;\n scanf(\"%d\", &tcases);\n while(tcases--){\n curver++;\n int i;\n scanf(\"%d %d %d\", &n, &k, &d);\n for(i = 0;i < n;i++)scanf(\"%d\", arr + i);\n int ans = k;\n int req = 0;\n for(i = 0;i < d;i++){\n int num = arr[i];\n cnts[num] = gval(num) + 1;\n if(cnts[num] == 1) req++;\n }\n if(ans > req) ans = req;\n for(i = 0;i + d < n;i++){\n\tint num;\n\tnum = arr[i];\n\tcnts[num] = cnts[num] - 1;\n\tif(cnts[num] == 0)req--;\n\n\tnum = arr[i + d];\n\tcnts[num] = gval(num) + 1;\n\tif(cnts[num] == 1) req++;\n\tif(ans > req) ans = req;\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n long long int t,i,j,k,l;\n\n scanf(\"%I64d\",&t);\n\n for(i=0;i<t;i++){\n\n long long int n,d,min=1000000000;\n\n scanf(\"%I64d%I64d%I64d\",&n,&k,&d);\n\n long long int a[n],b[k+1],count=0;\n\n for(j=0;j<n;j++){\n scanf(\"%I64d\",&a[j]);\n\n b[a[j]]=0;\n }\n\n for(j=0;j<d;j++){\n\n if(b[a[j]]==0)\n count++;\n\n b[a[j]]++;\n }\n\n if(count<min)\n min=count;\n\n for(j=d;j<n;j++){\n\n if(b[a[j-d]]!=0){\n b[a[j-d]]--;\n\n if(b[a[j-d]]==0)\n count--;\n }\n\n if(b[a[j]]==0)\n count++;\n\n b[a[j]]++;\n\n if(count<min)\n min=count;\n }\n\n printf(\"%I64d\\n\",min);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint indv[1000003],testcases[1000003]={-1};\nint main()\n{\n int t,n,k,d,prev,min,count;\n scanf(\"%d\",&t);\n for(int u=0;u<t;u++)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n],frq[n];min=d,count=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(testcases[a[i]]!=u)\n {\n testcases[a[i]]=u;\n indv[a[i]]=0;\n }\n if(i<d)\n {\n indv[a[i]]++;\n if(indv[a[i]]==1)\n count++;\n frq[i]=count;\n }\n else\n {\n prev=indv[a[i]];\n indv[a[i]]++;\n indv[a[i-d]]--;\n if((indv[a[i]]==1)&(prev==0))\n count++;\n //if(indv[a[i-d]]==1)\n //count++;\n if(indv[a[i-d]]==0)\n count--;\n frq[i]=count;\n }\n }\n /*for(int i=0;i<n;i++)\n printf(\"%d \",frq[i]);\n printf(\"\\n\");*/\n for(int i=d-1;i<n;i++)\n {\n min=frq[i]<min?frq[i]:min;\n }\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint indv[1000003],testcases[1000003]={-1};\nint main()\n{\n int t,n,k,d,prev,min,count;\n scanf(\"%d\",&t);\n for(int u=0;u<t;u++)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n],frq[n];min=d,count=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(testcases[a[i]]!=u)\n {\n testcases[a[i]]=u;\n indv[a[i]]=0;\n }\n if(i<d)\n {\n indv[a[i]]++;\n if(indv[a[i]]==1)\n count++;\n frq[i]=count;\n }\n else\n {\n prev=indv[a[i]];\n indv[a[i]]++;\n indv[a[i-d]]--;\n if((indv[a[i]]==1)&(prev==0))\n count++;\n if(indv[a[i-d]]==0)\n count--;\n frq[i]=count;\n }\n }\n for(int i=d-1;i<n;i++)\n min=frq[i]<min?frq[i]:min;\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define lli long long int\nlli hash[1000005]={0},hash1[1000005]={0};\nint main(void)\n{\n\tlli t;\n\tscanf(\"%lld\",&t);\n\twhile(t--)\n\t{\n\t\tlli i,n,k,d,p=0,count=0,a[200005]={0},fk[200005]={0},min=1000005;\n\t\tscanf(\"%lld %lld %lld\",&n,&k,&d);\n\t\tfor(i=0;i<d;i++)\n\t\t{\n\t\t\tscanf(\"%lld\",&a[i]);\n\t\t\tif(hash[a[i]]==0)\n\t\t\t{\n\t\t\t\tfk[p++]=a[i];\n\t\t\t\thash1[a[i]]=-1;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\thash[a[i]]++;\n\t\t}\n\t\tmin=count;\n\t\tfor( ;i<n;i++)\n\t\t{\n\t\t\tscanf(\"%lld\",&a[i]);\n\t\t\tif(hash[a[i-d]]==1)\n\t\t\t\tcount--;\n\t\t\thash[a[i-d]]--;\n\t\t\tif(hash[a[i]]==0)\n\t\t\t{\n\t\t\t\tif(hash1[a[i]]==0)\n\t\t\t\t\tfk[p++]=a[i];\n\t\t\t\telse\n\t\t\t\t\thash1[a[i]]=-1;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\thash[a[i]]++;\n\t\t\tif(min>count)\n\t\t\t\tmin=count;\n\t\t}\n\n\t\tprintf(\"%lld\\n\",min);\n\n\t\tfor(i=0;i<p;i++)\n\t\t{\n\t\t\thash[fk[i]]=0;\n\t\t\thash1[fk[i]]=0;\n\t\t}\n\t}\n\n\n\n\n\treturn 0;\n}\n"}, {"source_code": "a[222222], c[1111111], l, mn;\nmain(n, k, d, i, j) {\n\tfor (scanf(\"%*d\"); ~scanf(\"%d%d%d\", &n, &k, &d);) {\n\t\tfor (i = 1, l = 0, mn = 1e9; i <= n; i++) {\n\t\t\tscanf(\"%d\", a + i);\n\t\t\tl += !c[a[i]], c[a[i]]++;\n\t\t\tif (i > d) l -= c[a[i - d]] == 1, c[a[i - d]]--;\n\t\t\tif (i >= d) mn = mn < l ? mn : l;\n\t\t}\n\t\tfor (i = n - d + 1; i <= n; i++) c[a[i]]--;\n\t\tprintf(\"%d\\n\", mn);\n\t}\n}"}, {"source_code": "# include <stdio.h>\n\nint main()\n{\nint t;\nscanf(\"%d\",&t);\nint a[1000003]={0};\nwhile(t--)\n{\nint n,k,d,count=0,min=10000000;\nscanf(\"%d%d%d\",&n,&k,&d);\n\n\nint b[n];\n\nfor(int i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\nif(n==1){\nprintf(\"%d\\n\",n);\ncontinue;}\nfor(int i=0;i<d;i++)\na[b[i]]++;\nfor(int i=0;i<d;i++)\nif(a[b[i]]!=0)\n{\ncount++;\na[b[i]]=0;\n}\nfor(int i=0;i<d;i++)\na[b[i]]++;\nmin=count;\n//printf(\"%d\\n\",count);\nfor(int i=1;i<n-d+1;i++)\n{\nif(b[i-1]==b[d-1+i])\n{\n\ncontinue;\n}\nif(a[b[d-1+i]]>0 && a[b[i-1]]-1>0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n\ncontinue;\n}\n\nif(a[b[d+i-1]]>0 && a[b[i-1]]-1==0)\n{\ncount-=1;\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1>0)\n{\ncount+=1;\na[b[i-1]]-=1;\na[b[d-1+i]]+=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1==0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\ncontinue;\n}\n//printf(\"%d\\n\",count);\nif(min>count)\nmin=count;\n}\nfor(int i=0;i<n;i++)\na[b[i]]=0;\nprintf(\"%d\\n\",min);\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint min(int a, int b) { if(a < b) return a; return b; }\nint stat[1000002];\nint data[200002];\nvoid worker()\n{\n int n, k, d;\n scanf(\"%d%d%d\", &n, &k, &d);\n memset(stat, 0, sizeof(int)*1000002);\n int cnt = 0;\n for(int i = 0; i < d; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n }\n int minv = cnt;\n for(int i = d; i < n; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n stat[data[i-d]]--;\n if(stat[data[i-d]] == 0)\n cnt--;\n minv = min(minv, cnt);\n }\n printf(\"%d\\n\", minv);\n}\nint main()\n{\n#ifdef LOCAL\n\tfreopen(\"test.txt\", \"r\", stdin);\n#endif\n int q;\n scanf(\"%d\", &q);\n while(q--)\n worker();\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint min(int a, int b) { if(a < b) return a; return b; }\nint stat[1000002];\nint data[200002];\nvoid worker()\n{\n int n, k, d;\n scanf(\"%d%d%d\", &n, &k, &d);\n memset(stat, 0, sizeof(int)*1000002);\n int cnt = 0;\n for(int i = 0; i < d; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n }\n int minv = cnt;\n for(int i = d; i < n; i++)\n {\n scanf(\"%d\", &data[i]);\n if(stat[data[i]] == 0)\n cnt++;\n stat[data[i]]++;\n stat[data[i-d]]--;\n if(stat[data[i-d]] == 0)\n cnt--;\n if(cnt < minv)\n minv = cnt;\n //minv = min(minv, cnt);\n }\n printf(\"%d\\n\", minv);\n}\nint main()\n{\n int q;\n scanf(\"%d\", &q);\n while(q--)\n worker();\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<malloc.h>\nint main()\n{\n int t,n,k,d,count,min;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];min=d;\n int *u=(int*)malloc((k+1)*sizeof(int));\n int *record=(int*)malloc((k+1)*sizeof(int));\n for(int i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(int i=0;i+d<=n;i++)\n {\n count=0;\n for(int j=i;j<i+d;j++)\n {\n if(record[a[j]]!=i)\n {\n record[a[j]]=i;\n u[a[j]]=0;\n }\n if(u[a[j]]==0)\n {\n u[a[j]]++;\n count++;\n }\n }\n min=count<min?count:min;\n }\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<malloc.h>\nint main()\n{\n int t,n,k,d,count,min;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];min=d,count=0;\n int *u=(int*)malloc((k+1)*sizeof(int));\n int *record=(int*)malloc((k+1)*sizeof(int));\n for(int i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(int i=0;i+d<=n;i++)\n {\n for(int j=i;j<i+d;j++)\n {\n if(record[a[j]]!=i)\n {\n record[a[j]]=i;\n u[a[j]]=0;\n }\n if(u[a[j]]==0)\n {\n u[a[j]]++;\n count++;\n }\n }\n min=count<min?count:min;\n count=0;\n }\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int t, n, k, d;\n\n int curAmntTypes = 0;\n\n int minAmntTypes;\n scanf(\"%d\", &t);\n for(int iter=0; iter < t ; iter++)\n {\n minAmntTypes = 99999999;\n scanf(\"%d\", &n);\n scanf(\"%d\", &k);\n scanf(\"%d\", &d);\n printf(\"%d %d %d \\n\", n, k, d);\n int types[k];\n\n\n int A[n];\n\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", A+i);\n printf(\"%d \", A[i]);\n }\n printf(\"\\n\");\n for(int i = 0; i <= n-d;i++)\n {\n for(int ij = 0; ij < k; ij++){\n types[ij] = 0;\n }\n curAmntTypes = 0;\n for(int j = i; j<(i+d); j++)\n {\n if(!types[A[j]-1])\n {\n types[A[j]-1] = 1;\n curAmntTypes++;\n }\n\n }\n if(curAmntTypes < minAmntTypes) minAmntTypes = curAmntTypes;\n\n }\n printf(\"%d\\n\", minAmntTypes);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint minsub(int n, int d, int *arr){\n int min = d, i, j, k;\n int *minSub;\n minSub = (int*)malloc(sizeof(int) * (n - d + 1));\n for(i = 0; i < n - d + 1; i++){\n \tminSub[i] = 0;\n\t }\n for(i = 0; i <= n - d; i++){\n for(j = i; j < i + d; j++){\n if(j == i)\n minSub[i]++;\n else{\n\t\t\t \tfor(k = i; k < j; k++){\n\t\t\t\t if(arr[k] == arr[j])\n\t\t\t\t break;\n\t\t\t\t }\n\t\t\t\t //printf(\"%d\\n\", k);\n \n }\n if(k == j)\n minSub[i]++;\n //printf(\"\\n\");\n }\n //printf(\"\\n\\n\\n\");\n }\n \n for(i = 0; i < n - d + 1; i++){\n \tif(minSub[i] < min)\n \t\tmin = minSub[i];\n\t }\n\t \n\t return min;\n}\n\nint main(){\n int t;\n scanf(\"%d\", &t);\n \n while(t--){\n int *arr, i;\n int n, k , d;\n scanf(\"%d%d%d\", &n, &k, &d);\n arr = (int*)malloc(sizeof(int) * n);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n \n int min = minsub(n, d, arr);\n printf(\"%d\\n\", min);\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,m;\n scanf(\"%d\",&t);\n m=t-1;\n int arr[t];\n while(t--)\n {\n \n int n,k,d,cnt,scnt;\n scanf(\"%d%d%d\",&n,&k,&d);\n arr[t]=d;\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int z=0;z<=n-d;z++)\n {\n cnt=0;\n for(int i=z;i<=z+d;i++)\n {\n if(ar[i]!=0)\n {\n cnt++;\n scnt=1;\n for(int j=i+1;scnt!=d;j++)\n {\n if(ar[i]==ar[j])\n ar[j]=0;\n scnt++;\n }\n }\n }\n if(cnt<arr[t])\n arr[t]=cnt;\n }\n }\n for(int i=m;i>=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,m;\n scanf(\"%d\",&t);\n m=t-1;\n int arr[t];\n while(t--)\n {\n \n int n,k,d,cnt,scnt;\n scanf(\"%d%d%d\",&n,&k,&d);\n arr[t]=d;\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int z=0;z<n-d;z++)\n {\n cnt=0;\n for(int i=z;i<z+d;i++)\n {\n if(ar[i]!=0)\n {\n cnt++;\n scnt=1;\n for(int j=i+1;scnt!=d;j++)\n {\n if(ar[i]==ar[j])\n ar[j]=0;\n scnt++;\n }\n }\n }\n if(cnt<arr[t])\n arr[t]=cnt;\n }\n }\n for(int i=m;i>=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,m;\n scanf(\"%d\",&t);\n m=t-1;\n int arr[t];\n while(t--)\n {\n \n int n,k,d,cnt,scnt;\n scanf(\"%d%d%d\",&n,&k,&d);\n arr[t]=d;\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int z=0;z<=n-d;z++)\n {\n cnt=0;\n for(int i=z;i<z+d;i++)\n {\n if(ar[i]!=0)\n {\n cnt++;\n scnt=1;\n for(int j=i+1;scnt!=d;j++)\n {\n if(ar[i]==ar[j])\n ar[j]=0;\n scnt++;\n }\n }\n }\n if(cnt<arr[t])\n arr[t]=cnt;\n }\n }\n for(int i=m;i>=0;i--)\n printf(\"%d\\n\",arr[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint countf(int a[],int k,int l,int r)\n{\n int b[k];int i, s=0;\n for(i=0;i<k;i++)b[i]=0;\n for(i=l;i<=r;i++)\n {\n if(b[a[i]]==0)s++;\n b[a[i]]=1;\n }\n return s;\n}\nint main()\n{\n int t,n,v,k,d,i,min;\n scanf(\"%d\",&t);\n while(t--)\n {\n min=10000;\n scanf(\"%d%d%d\",&n,&k,&d);\n int a[n];\n for(i=0;i<n;i++)scanf(\"%d\",&a[i]);\n for(i=0;i+d-1<n;i++)\n {\n v=countf(a,k,i,i+d-1);\n if(v<min)min=v;\n }\n printf(\"%d\\n\",min+1);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int l[100],l2[101],t,n,k,i,j,d,w,s,min;\n scanf(\"%i\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%i %i %i\",&n,&k,&d);\n\n for(j=0;j<100;j++)\n {\n l2[j]=0;\n }\n for(j=0;j<n;j++) scanf(\"%i\",&l[j]);\n w=n;\n s=0;\n for(j=0;j<d;j++)\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;\n\n }\n else l2[l[j]]++;\n min=s;\n\n for (j=d;j<w;j++)\n {\n l2[l[j-d]]--;\n if (l2[l[j-d]]==0) s--;\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;}\n else\n l2[l[j]]++;\n\n if (s<min)\n min=s;\n }\n\n\n\n printf(\"%i\\n\",min);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nmain()\n{\n int l[100],l2[100],t,n,k,i,j,d,w,s,min;\n scanf(\"%i\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%i %i %i\",&n,&k,&d);\n\n for(j=0;j<100;j++)\n {\n l2[j]=0;\n }\n for(j=0;j<n;j++) scanf(\"%i\",&l[j]);\n w=n;\n s=0;\n for(j=0;j<d;j++)\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;\n\n }\n else l2[l[j]]++;\n min=s;\n\n for (j=d;j<w;j++)\n {\n l2[l[j-d]]--;\n if (l2[l[j-d]]==0) s--;\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;}\n else\n l2[l[j]]++;\n\n if (s<min)\n min=s;\n }\n\n\n\n printf(\"%i\\n\",min);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\t\n\tint cnt=0,t,n,k,d,i,j;\n\tscanf(\"%d\",&t);\n\t\n\twhile(cnt<t){\n\t\t\n\t\tint consec = 0, maxconsec=0;\n\t\tint tab[200]={0};\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\t\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&tab[i]);\n\t\t}\n\t\t\n\t\tfor(i=0;i<n-d+1;i++){\n\t\t\n\t\t\tfor(j=i;j<i+d;j++){\n\t\t\t\t\n\t\t\t\tif(tab[i] == tab[j]) consec ++;\n\t\t\t}\n\t\t\t\n\t\t\tif(consec>=maxconsec) maxconsec = consec;\n\t\t\tconsec =0;\n\t\t}\n\t\t\n\t\tif(maxconsec == 1 || maxconsec == d)printf(\"%d\\n\",1+d-maxconsec);\n\t\telse printf(\"%d\\n\",d-maxconsec);\n\t\t\n\t\tcnt++;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\t\n\tint cnt=0,t,n,k,d,i,j;\n\tscanf(\"%d\",&t);\n\t\n\twhile(cnt<t){\n\t\t\n\t\tint f;\n\t\tint consec = 0, maxconsec=0;\n\t\tint tab[200]={0};\n\t\tint aux [200]={0};\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\t\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&tab[i]);\n\t\t}\n\t\tmaxconsec = d;\n\t\tfor(i=0;i<n-d+1;i++){\n\t\t\t\n\t\t\tint aux [200]={0};\n\t\t\t\n\t\t\tfor(j=i;j<i+d;j++){\n\t\t\t\t\n\t\t\t\taux[tab[j]]++;\n\t\t\t}\n\t\t\t\n\t\t\tfor(f=0;f<=k+1;f++){\n\t\t\t\tif(aux[f]!=0)consec ++;\n\t\t\t}\n\t\t\t\n\t\t\tif(consec<=maxconsec) maxconsec = consec;\n\t\t\tconsec = 0;\n\t\t}\n\t\t\n\t\tprintf(\"%d\",maxconsec);\n\t\t\n\t\tcnt++;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,k,d,l=0;\n scanf(\"%d\",&t);\n int i,m=200,j;\n for(i=0;i<t;i++)\n {\n m=200;\n scanf(\"%d %d %d\",&n,&k,&d);\n\n int a[n];\n int b[k];\n for(j=0;j<n;j++)\n {\n scanf(\"%d\",&a[j]);\n }\n if(d==1)\n {\n printf(\"1\\n\");\n continue;\n }\n for(j=0;j<=n-d;j++)\n {\n l=0;\n\n\n for(int g=0;g<k;g++)\n {\n b[g]=0;\n }\n for(k=j;k<j+d;k++)\n {\n b[a[k]-1]++;\n if(b[a[k]-1]==1)\n {\n l++;\n }\n\n }\n if(l<m)\n {\n m=l;\n }\n }\n printf(\"%d\\n\",m);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,k,d,l=0;\n scanf(\"%d\",&t);\n int i,m=200,j;\n for(i=0;i<t;i++)\n {\n m=200;\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];\n int b[k];\n for(j=0;j<n;j++)\n {\n scanf(\"%d\",&a[j]);\n }\n\n for(j=0;j<=n-d;j++)\n {\n l=0;\n\n\n for(int g=0;g<k;g++)\n {\n b[g]=0;\n }\n for(k=j;k<j+d;k++)\n {\n b[a[k]-1]++;\n if(b[a[k]-1]==1)\n {\n l++;\n }\n\n }\n if(l<m)\n {\n m=l;\n }\n }\n printf(\"%d\\n\",m);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int a[],int b,int num){\n int i=0;\n for(i=0;i<b;i++)\n if(num==a[i])\n return 1;\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i<b;i++){\n if(num==a[i])\n return 1;\n }\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n if(d==n){\n printf(\"%i\\n\",d);\n continue;\n }\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i<b;i++){\n if(num==a[i])\n return 1;\n }\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"\\n%i\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n t[0]=tab[i];\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n printf(\"%i \",count);\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n\n int hb;\n for(hb=0;hb<d;hb++)\n t[i]=0;\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i<b;i++){\n if(num==a[i])\n return 1;\n }\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n\n\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i<b;i++){\n if(num==a[i])\n return 1;\n }\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n\n\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n int i=0;\n for(i=0;i<b;i++){\n if(num==a[i])\n return 1;\n }\n return 0;\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n if(!isInside(t,count,tab[i])){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint isInside(int *a,int b,int num){\n\n}\n\nint main(){\n int z,k;\n scanf(\"%i\",&z);\n for(k=0;k<z;k++){\n int n,k,d;\n scanf(\"%i %i %i\",&n,&k,&d);\n int i,j;\n int tab[n];\n for(i=0;i<n;i++)\n scanf(\"%i\",&tab[i]);\n int min=d;\n if(d==n){\n printf(\"%i\",d);\n continue;\n }\n for(j=0;j<n-d+1;j++){\n int count=0;\n for(i=j;i<d+j;i++){\n int t[d];\n\n int x=0,verif=0;\n for(x=0;x<count;x++)\n if(tab[i]==t[x])\n verif=1;\n\n\n if(verif==0){\n t[count++]=tab[i];\n }\n }\n if(count<min)\n min=count;\n }\n printf(\"%i\\n\",min);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, d, q, i, j;\n scanf(\"%d\\n\", &q);\n while(q--)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n static int a[101], b[101];\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n int t, ans=10e5;\n for(i=0; i<n-d+1; i++)\n {\n for(j=i, t=0; j<d+i; j++)\n {\n if(b[a[j]]==0)\n {\n t++;\n }\n b[a[j]]++;\n }\n if(ans > t)\n ans = t;\n memset(b,0,100);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, d, q, i, j;\n scanf(\"%d\\n\", &q);\n while(q--)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n static int a[100], b[100];\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n int t, ans=10e5;\n for(i=0; i<n-d+1; i++)\n {\n for(j=i, t=0; j<d+i; j++)\n {\n if(b[a[j]]==0)\n {\n t++;\n }\n b[a[j]]++;\n }\n if(ans > t)\n ans = t;\n memset(b,0,100);\n }\n printf(\"%d\\n\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint results[100];\nint t,t2;\nvoid onetest()\n{\n int n,k,d,i;\n scanf(\"%d %d %d\",&n,&k,&d);\n int no,minno,tmp;//no numarul de showuri in intervalul curent;minno rezultat\n int shows [k];\n int line [n];\n for(i=0; i<k; i++) //sa fie 0\n {\n shows[i]=0;\n };\n for(i=0; i<n; i++) //line e programul de n zile\n {\n scanf(\"%d\",&tmp);\n line[i]=tmp-1;// showurile sunt numerotate 1 k\n };\n for(i=0; i<d; i++) //numaram showuri zile 0->d\n {\n shows[line[i]]++;\n };\n no=0;\n for(tmp=0; tmp<k; tmp++) //numaram showuri cu >=1 episod fara a atinge i\n {\n if(shows[tmp])\n {\n no++;\n };\n };\n minno=no;\n while(i<n)//important\n {\n shows[line[i]]++;//e un episod nou sin acel show\n shows[line[i-d]]--;\n if(shows[line[i]]==1)//daca am crescut 0->1\n {\n no++;\n };\n if(shows[line[i-d]]==0)//daca am scazut 1->0\n {\n no--;\n };\n if(no<minno) //minno e minim\n {\n minno=no;\n };\n i++;\n };\n results[t2-t]=minno;//se umple de la final\n}\nint main()\n{\n scanf(\"%d\",&t);\n t2=t;\n while(t)\n {\n onetest();\n t--;\n };\n for(t=0; t<t2; t++) //t pt ca i ar fi variabila in plus\n {\n printf(\"%d \\n\",results[t]);\n };\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,j,n,k;\n scanf(\"%d\",&a);\n for(i=1;i<=a;i++)\n {\n scanf(\"%d%d%d\",&n,&k,&d);\n int ar[105]={0},min=105,m;\n for(j=0;j<n;j++)\n scanf(\"%d\",&ar[j]);\n for(j=0;j<n-d+1;j++)\n {\n c=0;\n int ar1[105]={0};\n for(m=j;m<j+d;m++)\n {\n ar1[ar[m]]++;\n }\n for(m=0;m<100;m++)\n {\n if(ar1[m]!=0)c++;\n }\n if(c<min)min=c;\n }\n if(min==105)printf(\"%d\\n\",d);\n else printf(\"%d\\n\",min);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint t;\n\tscanf(\"%d\",&t);\n\twhile(t>0){\n\t\tint n,k,d;\n\t\tscanf(\"%d %d %d\",&n,&k,&d);\n\t\tint a[n];\n\t\tint b[100];\n\t\tint max = k;\n\t\tint s = 0;\n\t\tfor(int i = 0;i<100;i++){\n\t\t\tb[i] = 0;\n\t\t}\n\t\tfor(int i = 0;i<n;i++) scanf(\"%d\",&a[i]);\n\t\tfor(int i = 0;i<n;i++){\n\t\t\tif(i+d>n) continue;\n\t\t\tfor(int k = i;k-i<d&&k<n;k++){\n\t\t\t\tb[a[k]]++;\n\t\t\t}\n\t\t\tfor(int k = 0;k<100;k++){\n\t\t\t\tif(b[k]>0) s++;\n\t\t\tb[k] = 0;\n\t\t\t}\n\t\t\tmax = max>s?s:max;\n\t\t\ts = 0;\n\t\t}\n\t\tprintf(\"%d\\n\",max);\n\t\tt--;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nstatic int c[1000005]={0};\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,k,d;\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int min=k;\n int count=0;\n for(int i=0;i<n;i++)\n {\n if(c[a[i]]==0)\n {\n count++;\n }\n c[a[i]]++;\n if(i+1>=d)\n {\n if(count<min)\n min=count;\n c[a[i+1-d]]--;\n if(c[a[i+1-d]]==0)\n count--;\n }\n }\n printf(\"%d\\n\",min);\n }\n return 0;\n}\n\n\n \n\n\n\n\n\n\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:26/10/2019 \n*/\n// #include<algorithm>\n// #include <bits/stdc++.h>\n// using namespace std;\n \n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<ctype.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define PFN printf(\"\\n\")\n#define REP(i,n) for(long long i=0;i<(n);++i)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((ll)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n#define SWAP(a,b) ll z=a;a=b;b=z\n#define SWAPC(a,b) char z=a;a=b;b=z\n \nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nlong long digits(long long n);\nbool isPoweroftwo(long long n);\nll count[1000001];\nint main()\n{\n CASES\n {\n ll n,k,d;\n SC3(n,k,d);\n ll arr[n];\n REP(i,n)\n SC1(arr[i]);\n ll min=MAX,c=0;\n REP(i,d)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n }\n min=c;\n FOR(i,d,n-1)\n {\n ll x=arr[i];\n if(count[x]==0)\n c++;\n count[x]++;\n x=arr[i-d];\n count[x]--;\n if(count[x]==0)\n c--;\n min=minv(c,min);\n }\n PF1(min);\n }\n return 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}\nlong long digits(long long n) //to calculate no of digits in a number\n{\n return floor(log10(n))+1;\n}\nbool isPoweroftwo(long long x)\n{\n return x && (!(x&(x-1)));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nmain()\n{\n int l[200000],l2[1000001],t,n,k,i,j,d,w,s,min;\n scanf(\"%i\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%i %i %i\",&n,&k,&d);\n\n for(j=0;j<101;j++)\n {\n l2[j]=0;\n }\n for(j=0;j<n;j++) scanf(\"%i\",&l[j]);\n w=n;\n s=0;\n for(j=0;j<d;j++)\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;\n\n }\n else l2[l[j]]++;\n min=s;\n\n for (j=d;j<w;j++)\n {\n l2[l[j-d]]--;\n if (l2[l[j-d]]==0) s--;\n if (l2[l[j]]==0)\n { l2[l[j]]=1;\n s++;}\n else\n l2[l[j]]++;\n\n if (s<min)\n min=s;\n }\n\n\n\n printf(\"%i\\n\",min);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n \n int n, k, d, i;\n \n int a[100000];\n int b[1000000];\n \n int size;\n \n while(t--)\n {\n scanf(\"%d%d%d\", &n, &k, &d);\n \n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n \n size = 0;\n \n for (i = 0; i < k; i++)\n b[i] = 0;\n \n for (i = 0; i < d; i++)\n b[a[i]-1]++;\n \n for (i = 0; i < k; i++)\n if (b[i])\n size++;\n \n int ans = size;\n \n for (i = d; i < n; i++)\n {\n b[a[i-d]-1]--;\n \n if (b[a[i-d]-1] == 0)\n size--;\n \n if (b[a[i]-1] == 0)\n size++;\n \n b[a[i]-1]++;\n \n if (size < ans)\n ans = size;\n }\n \n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n \n int n, k, d, i;\n \n int a[100000];\n int b[1000000];\n \n int size;\n \n while(t--)\n {\n scanf(\"%d%d%d\", &n, &k, &d);\n \n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n \n size = 0;\n \n for (i = 0; i < k; i++)\n b[i] = 0;\n \n for (i = 0; i < d; i++)\n b[a[i]-1]++;\n \n for (i = 0; i < k; i++)\n if (b[i])\n size++;\n \n int ans;\n ans = size;\n \n for (i = d; i < n; i++)\n {\n b[a[i-d]-1]--;\n \n if (b[a[i-d]-1] == 0)\n size--;\n \n if (b[a[i]-1] == 0)\n size++;\n \n b[a[i]-1]++;\n \n if (size < ans)\n ans = size;\n }\n \n printf(\"%d\\n\", ans);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\", &t);\n \n int n, k, d, i;\n \n int a[200000];\n int b[1000000];\n \n int size;\n \n while(t--)\n {\n scanf(\"%d%d%d\", &n, &k, &d);\n \n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n \n size = 0;\n \n for (i = 0; i < d; i++)\n {\n if (b[a[i]-1] == 0)\n size++;\n b[a[i]-1]++;\n }\n \n int ans = size;\n \n for (i = d; i < n; i++)\n {\n b[a[i-d]-1]--;\n \n if (b[a[i-d]-1] == 0)\n size--;\n \n if (b[a[i]-1] == 0)\n size++;\n \n b[a[i]-1]++;\n \n if (size < ans)\n ans = size;\n }\n \n printf(\"%d\\n\", ans);\n \n for (i = 0; i < n; i++)\n b[a[i]-1] = 0;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int t,n,k,d,prev,min,fwd,bkd,count;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d %d %d\",&n,&k,&d);\n int a[n],indv[k+1],frq[n];min=d,count=0;\n for(int i=0;i<k+1;i++)\n indv[i]=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(i<d)\n {\n indv[a[i]]++;\n if(indv[a[i]]==1)\n count++;\n frq[i]=count;\n }\n else\n {\n indv[a[i]]++;\n indv[a[i-d]]--;\n if(indv[a[i]]==1)\n count++;\n //if(indv[a[i-d]]==1)\n //count++;\n if(indv[a[i-d]]==0)\n count--;\n frq[i]=count;\n }\n }\n /*for(int i=0;i<n;i++)\n printf(\"%d \",frq[i]);\n printf(\"\\n\");*/\n for(int i=d-1;i<n;i++)\n {\n min=frq[i]<min?frq[i]:min;\n }\n printf(\"%d\\n\",min);\n }\n}\n"}, {"source_code": "# include <stdio.h>\n\nint main()\n{\nint t;\nscanf(\"%d\",&t);\nwhile(t--)\n{\nint n,k,d,count=0,min=10000000;\nscanf(\"%d%d%d\",&n,&k,&d);\n\nint a[1000000]={0};\nint b[n];\n\nfor(int i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\nif(n==1){\nprintf(\"%d\\n\",n);\ncontinue;}\nfor(int i=0;i<d;i++)\na[b[i]]++;\nfor(int i=0;i<k+1;i++)\nif(a[i]!=0)\ncount++;\nmin=count;\n//printf(\"%d\\n\",count);\nfor(int i=1;i<n-d+1;i++)\n{\nif(b[i-1]==b[d-1+i])\n{\n\ncontinue;\n}\nif(a[b[d-1+i]]>0 && a[b[i-1]]-1>0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n\ncontinue;\n}\n\nif(a[b[d+i-1]]>0 && a[b[i-1]]-1==0)\n{\ncount-=1;\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1>0)\n{\ncount+=1;\na[b[i-1]]-=1;\na[b[d-1+i]]+=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1==0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\ncontinue;\n}\n//printf(\"%d\\n\",count);\nif(min>count)\nmin=count;\n}\nprintf(\"%d\\n\",min);\n}\nreturn 0;\n}\n\n"}, {"source_code": "# include <stdio.h>\n\nint main()\n{\nint t;\nscanf(\"%d\",&t);\nint a[1000003]={0};\nwhile(t--)\n{\nint n,k,d,count=0,min=10000000;\nscanf(\"%d%d%d\",&n,&k,&d);\n\n\nint b[n];\n\nfor(int i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\nif(n==1){\nprintf(\"%d\\n\",n);\ncontinue;}\nfor(int i=0;i<d;i++)\na[b[i]]++;\nfor(int i=0;i<d;i++)\nif(a[b[i]]!=0)\ncount++;\nmin=count;\n//printf(\"%d\\n\",count);\nfor(int i=1;i<n-d+1;i++)\n{\nif(b[i-1]==b[d-1+i])\n{\n\ncontinue;\n}\nif(a[b[d-1+i]]>0 && a[b[i-1]]-1>0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n\ncontinue;\n}\n\nif(a[b[d+i-1]]>0 && a[b[i-1]]-1==0)\n{\ncount-=1;\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1>0)\n{\ncount+=1;\na[b[i-1]]-=1;\na[b[d-1+i]]+=1;\n}\nif(a[b[d-1+i]]==0 && a[b[i-1]]-1==0)\n{\na[b[d-1+i]]+=1;\na[b[i-1]]-=1;\ncontinue;\n}\n//printf(\"%d\\n\",count);\nif(min>count)\nmin=count;\n}\nfor(int i=0;i<n;i++)\na[b[i]]=0;\nprintf(\"%d\\n\",min);\n}\nreturn 0;\n}\n\n"}], "src_uid": "56da4ec7cd849c4330d188d8c9bd6094"} {"nl": {"description": "After playing Neo in the legendary \"Matrix\" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, he needs to solve the following problem.Let's call a string consisting of only zeroes and ones good if it contains different numbers of zeroes and ones. For example, 1, 101, 0000 are good, while 01, 1001, and 111000 are not good.We are given a string $$$s$$$ of length $$$n$$$ consisting of only zeroes and ones. We need to cut $$$s$$$ into minimal possible number of substrings $$$s_1, s_2, \\ldots, s_k$$$ such that all of them are good. More formally, we have to find minimal by number of strings sequence of good strings $$$s_1, s_2, \\ldots, s_k$$$ such that their concatenation (joining) equals $$$s$$$, i.e. $$$s_1 + s_2 + \\dots + s_k = s$$$.For example, cuttings 110010 into 110 and 010 or into 11 and 0010 are valid, as 110, 010, 11, 0010 are all good, and we can't cut 110010 to the smaller number of substrings as 110010 isn't good itself. At the same time, cutting of 110010 into 1100 and 10 isn't valid as both strings aren't good. Also, cutting of 110010 into 1, 1, 0010 isn't valid, as it isn't minimal, even though all $$$3$$$ strings are good.Can you help Keanu? We can show that the solution always exists. If there are multiple optimal answers, print any.", "input_spec": "The first line of the input contains a single integer $$$n$$$ ($$$1\\le n \\le 100$$$)\u00a0\u2014 the length of the string $$$s$$$. The second line contains the string $$$s$$$ of length $$$n$$$ consisting only from zeros and ones.", "output_spec": "In the first line, output a single integer $$$k$$$ ($$$1\\le k$$$)\u00a0\u2014 a minimal number of strings you have cut $$$s$$$ into. In the second line, output $$$k$$$ strings $$$s_1, s_2, \\ldots, s_k$$$ separated with spaces. The length of each string has to be positive. Their concatenation has to be equal to $$$s$$$ and all of them have to be good. If there are multiple answers, print any.", "sample_inputs": ["1\n1", "2\n10", "6\n100011"], "sample_outputs": ["1\n1", "2\n1 0", "2\n100 011"], "notes": "NoteIn the first example, the string 1 wasn't cut at all. As it is good, the condition is satisfied.In the second example, 1 and 0 both are good. As 10 isn't good, the answer is indeed minimal.In the third example, 100 and 011 both are good. As 100011 isn't good, the answer is indeed minimal."}, "positive_code": [{"source_code": "#include <stdio.h>\nint main()\n{\n int n,j,c0=0,c1=0;\n scanf(\"%d\", &n);\n char string[n+1];\n scanf(\"%s\", string);\n for(int i = 0; i < n; i++)\n {\n c0 = 0;\n c1 = 0;\n for(j = i; j < n; j++)\n {\n if(string[j] == '0') c0++;\n else c1++;\n }\n if(i == 0 && c0 != c1) { printf(\"1\\n\"); printf(\"%s\\n\",string); return 0;}\n else if(c0 != c1) { printf(\"2\\n\"); for(int k = 0; k < i; k++) printf(\"%c\",string[k]); printf(\" \"); for(int k = i; k < n; k++) printf(\"%c\",string[k]); return 0;}\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int cmpfunc( const void *a, const void *b) {\n return *(long long int*)a - *(long long int *)b;\n}\n\nint main()\n{\n long long int test,d,n,x,i,sum=0,count=0,j,flag=0,p,y,max=0,o,g,r,k,sum1=0,m;\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\nlong long int z1=0,o1=0;\nfor(i=0;i<n;i++){\n if(a[i]=='0'){\n z1++;\n }else{\n o1++;\n }\n}\nif(o1==z1){\n a[n]=a[n-1];\n a[n-1]=' ';\n printf(\"2\\n%s\",a);\n}else{\n printf(\"1\\n%s\",a);\n}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n, i, j, sum, zero = 0, one = 0;\n\n scanf(\"%d\", &n);\n\n char name[n];\n\n scanf(\" %s\", name);\n\n for(i=0; i<n; i++){\n\n if(name[i] == '0'){\n\n zero++;\n }\n else{\n\n one++;\n }\n }\n\n if(zero != one)\n {\n\n printf(\"1\\n%s\\n\", name);\n }\n else\n {\n\n\n printf(\"2\\n\");\n\n\n for(i=0; i<n-1; i++){\n\n printf(\"%c\", name[i]);\n }\n\n printf(\" %c\\n\", name[n-1]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,j,n,k=0,zero=0,one=0;\n scanf(\"%d\",&n);\n char string[n+1];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n if(string[i]=='0')\n zero++;\n else\n one++;\n }\n if(one!=zero)\n {\n printf(\"%d\\n\",1);\n printf(string);\n }\n else\n {\n printf(\"2\\n\");\n printf(\"%c \",string[0]);\n for(i=1;string[i]!='\\0';i++)\n printf(\"%c\",string[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar s[100];\n\tscanf(\"%s\",&s);\n\tint dem0=0,dem1=0;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tif(s[i]=='0') dem0++;\n\t\telse dem1++;\n\t}\n\tif(dem0!=dem1)\n\t{\n\t\tprintf(\"1\\n%s\",s);\n\t}\n\telse\n\t{\n\t\tprintf(\"2\\n%c \",s[0]);\n\t\tfor(int i=1;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",s[i]);\n\t\t}\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100];\n\tchar sh;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]=='0') s1++ ;\n\t\t \n\t\telse\n\t\t s2++;\n\t}\n\tif (s1==s2)\n\t{ \n\t sh = ch[n-1];\n\t ch[n-1]='\\0';\n\t printf (\"2\\n%s\",ch);\n\t printf (\" %c\",sh);\n }\n else \n printf(\"1\\n%s\",ch);\n\t\t\n\treturn 0;\n\n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint len,i,one=0,zero=0;\n\tchar* str;\n\tchar last,a;\n\n\tscanf(\"%d\",&len);\n\t\n\tstr=(char *)malloc(sizeof(char)*len);\n\tscanf(\"%c\",&a);\n\n\tgets(str);\n\t\n\tfor (i = 0; i < len; ++i)\n\t{\n\t\tif(str[i]=='1')\n\t\t\tone++;\n\t\telse\n\t\t\tzero++;\n\t}\n\n\tif(one!=zero)\n\t{\n\t\tprintf(\"1\\n%s\",str);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\t\tlast=str[len-1];\n\t\t\tstr[len-1]=(char)32;\n\t\t\tprintf(\"2\\n%s%c\",str,last);\n\t\t\treturn 0;\n\t}\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char const *argv[]) {\n int n, num1 = 0, num0 = 0, end;\n char s[105];\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n for (int i = 0; i < n; i++) {\n if (s[i]=='1') num1 ++;\n else num0 ++;\n end = i;\n if (num1 == num0 && i == n-1) {\n end = i - 1;\n }\n }\n if (num1 == num0) printf(\"2\\n\");\n else printf(\"1\\n\");\n for (int i = 0; i <= end; i++) {\n printf(\"%c\",s[i]);\n }\n if (num1 == num0) printf(\" \");\n for (int i = end+1; i < n; i++) {\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar s[102];\n\tscanf(\"%s\", s);\n\tint i;\n\tint count[2];\n\tcount[0] = count[1] = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcount[s[i] - '0']++;\n\tif (count[0] != count[1])\n\t\tprintf(\"1\\n%s\\n\", s);\n\telse\n\t{\n\t\tprintf(\"2\\n\");\n\t\tfor (i = 0; i < n - 1; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t\tprintf(\" %c\\n\", s[n - 1]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[n]; int i,count0=0,count1=0,flag=0,count=0;\n scanf(\"%s\",s);\n for(i=0;i<n;i++){\n if(s[i]=='0') count0++;\n else count1++;\n }\n if(count0!=count1){\n printf(\"1\\n\");\n if((count1==1 && count0==0)||(count1==0 && count0==1)){\n printf(\"%c\",s[0]);\n flag=1;\n }\n else printf(\"%s\",s);\n }\n else{\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",s[i]);\n }\n printf(\" \");\n printf(\"%c\",s[n-1]);\n }\nreturn 0;\n}"}, {"source_code": " #include <stdio.h>\n #include <string.h>\n int main(void){\n // Your code here!\n int i,j,N,count1=0,count0=0;\n scanf(\"%d\",&N);\n char str[N];\n // gets(str);\n // printf(\"%s\",str);\n scanf(\"%s\",str);\n for(i=0;i<N;i++)\n {\n if (str[i]=='1')\n count1++;\n else if(str[i]=='0')\n count0++;\n }\n if(N!=1){\n if(count1!=count0)\n { printf(\"1\\n\");\n // puts(str);\n printf(\"%s\",str);\n }\n else if(count0==count1)\n {\n printf(\"2\\n\");\n printf(\"%c \",str[0]);\n for(j=1;j<N;j++)\n {\n printf(\"%c\",str[j]);\n }\n }\n }\n else if(N==1){\n printf(\"1\\n%s\",str);\n }\n }"}, {"source_code": "# include <stdio.h>\nint main()\n{\n int n,i,c0=0,c1=0;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n for(i=0;i<n;i++)\n {\n if(a[i]=='0')\n {\n c0++;\n }\n else\n {\n c1++;\n }\n }\n if(c1!=c0)\n {\n printf(\"1\\n%s\",a);\n }\n else\n {\n printf(\"2\\n%c \",a[0]);\n for(i=1;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(void)\n{\n\tint n,check,zero=0,one=0;\n\tchar str[101];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",str);\n\tif(n%2==1)printf(\"1\\n%s\",str);\n\tif(n%2==0)\n\t{\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif (str[i]=='0')zero++;\n\t\t\telse one++;\n\t\t}\n\t\tif(one==zero)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\tfor(int j=0;j<n-1;j++)\n\t\t\tprintf(\"%c\",str[j]);\n\t\t\tprintf(\" %c\",str[n-1]);\n\t\t}\n\t\telse printf(\"1\\n%s\",str);\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int a=0,b=0;\n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n {\n a++;\n }\n else if(s[i]=='1')\n {\n b++;\n }\n }\n if(n==1||a!=b)\n {\n printf(\"1\\n%s\",s);\n }\n else\n {\n printf(\"2\\n\");\n int g=0,h=0;\n for(i=0;i<n;i++)\n {\n printf(\"%c\",s[i]);\n if(s[i]=='1')\n {\n g++;\n }\n else\n {\n h++;\n }\n if(g!=h&&(b-g)!=(a-h))\n {\n printf(\" \");\n for(j=(g+h);j<n;j++)\n {\n printf(\"%c\",s[j]);\n }\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int count_0=0,count_1=0;\n for(i=0;i<n;i++){\n if(s[i]=='0')\n count_0++;\n else\n count_1++;\n }\n if(n==1){\n printf(\"1\\n\");\n printf(\"%c \",s[0]);\n }\n else if(count_0>count_1||count_1>count_0){\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stddef.h>\n\n\nint main(void) {\n \n int c;\n ptrdiff_t n;\n\n ptrdiff_t i = 0;\n int c0 = 0;\n\n while ((c = getchar()) != 10)\n n = n * 10 + c - 48;\n\n char* s = malloc(n * sizeof(char));\n if (s == NULL)\n return -1;\n \n while ((c = getchar()) != 10) {\n if (c == 48)\n c0 += 1;\n s[i++] = c;\n }\n\n if (n - c0 == c0) {\n putchar(50);\n putchar(10);\n putchar(*s);\n putchar(32);\n for (i = 1; i < n; i += 1) {\n putchar(*(s + i));\n }\n } else {\n putchar(49);\n putchar(10);\n for (i = 0; i < n; i += 1) {\n putchar(*(s + i));\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int count_0=0,count_1=0;\n for(i=0;i<n;i++){\n if(s[i]=='0')\n count_0++;\n else\n count_1++;\n }\n if(n==1){\n printf(\"1\\n\");\n printf(\"%c \",s[0]);\n }\n else if(count_0>count_1||count_1>count_0){\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main () \n{ \n\tint n,p,q;\n\tp=0;\n\tq=0;\n\tscanf(\"%d\",&n);\n char str[n+1];\n int i,j,k;\n\tscanf(\"%s\",str);\n for(i=0;i<n;i++)\n {\n \tif(str[i]=='1')\n \t{\n \t\tp++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tq++;\n\t\t}\n\t}\n\n if(p==q)\n {\n \tprintf(\"2\\n\");\n \tfor(i=0;i<n-1;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t\tprintf(\" %c\",str[n-1]);\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n \tfor(i=0;i<n;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t}\n return 0; \n} \n"}, {"source_code": " #include <stdio.h>\n #include <string.h>\n int main(void){\n // Your code here!\n int i,j,N,count1=0,count0=0;\n scanf(\"%d\",&N);\n char str[N];\n // gets(str);\n // printf(\"%s\",str);\n scanf(\"%s\",str);\n for(i=0;i<N;i++)\n {\n if (str[i]=='1')\n count1++;\n else if(str[i]=='0')\n count0++;\n }\n if(N!=1){\n if(count1!=count0)\n { printf(\"1\\n\");\n // puts(str);\n printf(\"%s\",str);\n }\n else if(count0==count1)\n {\n printf(\"2\\n\");\n printf(\"%c \",str[0]);\n for(j=1;j<N;j++)\n {\n printf(\"%c\",str[j]);\n }\n }\n }\n else if(N==1){\n printf(\"1\\n%s\",str);\n }\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int count_0=0,count_1=0;\n for(i=0;i<n;i++){\n if(s[i]=='0')\n count_0++;\n else\n count_1++;\n }\n if(n==1){\n printf(\"1\\n\");\n printf(\"%c \",s[0]);\n }\n else if(count_0>count_1||count_1>count_0){\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n\tint n,zero=0,one=0,i;\n\tscanf(\"%d\",&n);\n\tchar s[100];\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;++i)\n\t{\n\t\tif(s[i]=='0')\n\t\t{\n\t\t\tzero++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tone++;\n\t\t}\n\t}\n\tif(zero!=one)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",s);\n\t}\n\telse\n\t{\n printf(\"2\\n\");\n char c=s[n-1];\n s[n-1]='\\0';\n printf(\"%s %c\",s,c);\n \n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int zero=0,one=0,i=0;\n char string[100];\n scanf(\"%s\",string);\n while(i<n){\n if(string[i]-'0'==0)\n zero++;\n else \n one++;\n i=i+1;\n }\n if(zero!=one)\n {\n printf(\"1\\n\");\n printf(\"%s\",string);\n }\n\telse \n {\n printf(\"2\\n\");\n printf(\"%c \",string[0]);\n int i=1;\n while(i<n)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n }\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"1\\n\");\n printf (\"%s\\n\", arr);\n }\n else\n {\n printf (\"2\\n\");\n printf (\"%c %s\\n\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"1\\n\");\n printf (\"%s\\n\", arr);\n }\n else\n {\n printf (\"2\\n\");\n printf (\"%c %s\\n\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main () \n{ \n\tint n,p,q;\n\tp=0;\n\tq=0;\n\tscanf(\"%d\",&n);\n char str[n+1];\n int i,j,k;\n\tscanf(\"%s\",str);\n for(i=0;i<n;i++)\n {\n \tif(str[i]=='1')\n \t{\n \t\tp++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tq++;\n\t\t}\n\t}\n\n if(p==q)\n {\n \tprintf(\"2\\n\");\n \tfor(i=0;i<n-1;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t\tprintf(\" %c\",str[n-1]);\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n \tfor(i=0;i<n;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t}\n return 0; \n} \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar c[1000];\n\tscanf(\"%s\",c);\n\tint cnt1=0, cnt2=0;\n\tfor(int i=0;i<n;i++){\n\t\tif(c[i]=='1')\n\t\t\tcnt1++;\n\t\telse cnt2++;\n\t}\n\tif(cnt1!=cnt2){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",c);\n\t}\n\telse {\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%c \", c[0]);\n\t\tfor(int i=1;i<n;i++){\n\t\t\tprintf(\"%c\", c[i]);\n\t\t}\n\t}\n}"}, {"source_code": "# include <stdio.h>\nint main()\n{\n int n,i,c0=0,c1=0;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n for(i=0;i<n;i++)\n {\n if(a[i]=='0')\n {\n c0++;\n }\n else\n {\n c1++;\n }\n }\n if(c1!=c0)\n {\n printf(\"1\\n%s\",a);\n }\n else\n {\n printf(\"2\\n%c \",a[0]);\n for(i=1;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n//chuoi tach ra >1 chu so\n//giai phap luon ton tai ?\n//CO NHIEU CAU TRA LOI\n//cat chuoi toi thieu -> 1 hoac 2\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar c[1000];\n\tscanf(\"%s\",&c);\n\tint dem1=0;\n\tint dem0=0;\n\tfor(int i=0;i<n;i=i+1)\n\t{\n\t\tif(c[i]=='1'){\n\t\t\tdem1=dem1+1;\n\t\t}\n\t\telse{\n\t\t\tdem0=dem0+1;\n\t\t}\n\t}\n\t\n\tif(dem0!=dem1){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",c);\n\t\treturn 0;\n\t}\n\telse{\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%c \",c[0]);\n\t\tfor(int i=1;i<n;i=i+1){\n\t\t\tprintf(\"%c\",c[i]);\n\t\t}\n\t\treturn 0;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n//chuoi tach ra >1 chu so\n//giai phap luon ton tai ?\n//CO NHIEU CAU TRA LOI\n//cat chuoi toi thieu -> 1 hoac 2\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar c[1000];\n\tscanf(\"%s\",&c);\n\tint dem1=0;\n\tint dem0=0;\n\tfor(int i=0;i<n;i=i+1)\n\t{\n\t\tif(c[i]=='1'){\n\t\t\tdem1=dem1+1;\n\t\t}\n\t\telse{\n\t\t\tdem0=dem0+1;\n\t\t}\n\t}\n\t\n\tif(dem0!=dem1){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",c);\n\t\treturn 0;\n\t}\n\telse{\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%c \",c[0]);\n\t\tfor(int i=1;i<n;i=i+1){\n\t\t\tprintf(\"%c\",c[i]);\n\t\t}\n\t\treturn 0;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c!=n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\tint dem0=0,dem1=0,tmp=-1,x=0,y=0;\n\tfor(int i=0;i<n;i++){\n\t\tif(a[i]=='1')\n\t\tx++;\n\t\telse\n\t\ty++;\n\t}\n\tif(x!=y)\n\tprintf(\"1\\n%s\",a);\n\telse if(n==1)\n\tprintf(\"1\\n%s\",a);\n\telse if(n==2)\n\tprintf(\"2\\n%c %c\",a[0],a[1]);\n\telse{\n\t\tprintf(\"2\\n\");\n\t\tfor(int i=0;i<n/2;i++){\n\t\t\tif(a[i]=='1'){\n\t\t\ttmp++;\n\t\t\tdem1++;\n\t\t\t}\n\t\t\telse{\n\t\t\ttmp++;\n\t\t\tdem0++;\n\t\t}\n\t}\n\tif(dem1==dem0)\n\ttmp++;\n\tfor(int i=0;i<=tmp;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\" \");\n\tfor(int i=tmp+1;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[105];\nint compare(char a[])\n{\n\tint o=0,z=0;\n\tfor(int i=0;a[i]!='\\0';i++){\n\t\tif(a[i]=='0'){\n\t\t\tz++;\n\t\t}\n\t\tif(a[i]=='1'){\n\t\t\to++;\n\t\t}\n\t}\n\tif(o==z)return 0;\n\telse return 1;\n}\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tgets(s);\n\tif(compare(s)==1){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\\n\",s);\n\t}\n\telse{\n\t\tfor(int i=1;i<strlen(s);i++){\n\t\t\tchar a[105],b[105];\n\t\t\tfor(int j=0;j<i;j++){\n\t\t\t\ta[j]=s[j];\n\t\t\t}\n\t\t\ta[i]='\\0';\n\t\t\tif(compare(a)==0)continue;\n\t\t\tfor(int j=i;j<strlen(s);j++){\n\t\t\t\tb[j-i]=s[j];\n\t\t\t}\n\t\t\tb[strlen(s)-i]='\\0';\n\t\t\tif(compare(b)==0)continue;\n\t\t\tprintf(\"2\\n\");\n\t\t\tprintf(\"%s %s\\n\",a,b);\n\t\t\tbreak;\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nmain(){\n int n;\n char s[100];\n scanf(\"%d%s\",&n,s);\n int fr[2] = {0};\n for(int i=0;i<n;++i){\n ++fr[s[i]-'0'];\n }\n\n if( fr[0] != fr[1] )\n printf(\"%d\\n%s\\n\",1,s);\n else{\n putchar('2');\n putchar('\\n'); \n int i,fr2[2] = {0};\n for(i=0;i<n;++i){\n ++fr2[s[i]-'0'];\n if( fr2[0] != fr2[1] && (fr[0]-fr2[0]) != (fr[1]-fr2[1]) )\n break; \n }\n \n for(int j=0;j<=i;++j)\n putchar(s[j]);\n putchar(' ');\n ++i;\n for(;i<n;i++)\n putchar(s[i]);\n putchar('\\n'); \n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c!=n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n int main()\n {\n int i,x,y=0,z=0; \n scanf(\"%d\", &x);\n char str[x];\n scanf(\"%s\", str);\n for(i=0;i<x;i++){\n if(str[i]=='1') y++;\n else z++;\n }\n if(y==z)\n {\n printf(\"2\\n\");\n for(i=0;i<x-1;i++)\n {\n printf(\"%c\", str[i]);\n }\n printf(\" %c\", str[x-1]);\n }\n else{\n printf(\"1\\n\");\n printf(\"%s\", str);\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar s[100];\n\tscanf(\"%s\",&s);\n\tint dem0=0,dem1=0;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tif(s[i]=='0') dem0++;\n\t\telse dem1++;\n\t}\n\tif(dem0!=dem1)\n\t{\n\t\tprintf(\"1\\n%s\",s);\n\t}\n\telse\n\t{\n\t\tprintf(\"2\\n%c \",s[0]);\n\t\tfor(int i=1;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",s[i]);\n\t\t}\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[101];\n int n,i,count0,count1;\n\n scanf(\"%d %s\",&n,&s);\n\n count0=0;\n count1=0;\n for(i=0;s[i];i++)\n {\n if(s[i]=='0')\n ++count0;\n else if(s[i]=='1')\n ++count1;\n }\n\n if(count0!=count1)\n printf(\"1\\n%s\\n\",s);\n\n else\n {\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;s[i];i++)\n printf(\"%c\",s[i]);\n\n printf(\"\\n\");\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint q=0;\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar str[n+1];\n\tscanf(\"%s\", str);\n\tint no1 = 0, no0=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\tno1++;\n\t\telse\n\t\t\tno0++;\n\t\tq++;\n\t}\n\tif(no1!=no0){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\", str);\n\t\treturn 0;\n\t}\n\tq=0;\n\tint a=0, b=0;\n\tint fin=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\ta++;\n\t\telse\n\t\t\tb++;\n\t\tif(a!=b){\n\t\t\tint rem1 = no1-a;\n\t\t\tint rem0 = no0 -b;\n\t\t\tif(rem1!=rem0){\n\t\t\t\tfin=q;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tq++;\n\t}\n\tif(n==1)\n\tprintf(\"1\\n\");\n\telse\n\t\tprintf(\"2\\n\");\n\tfor(int i=0;i<=fin;i++)\n\t\t\tprintf(\"%c \", str[i]);\n\tfor(int i=fin+1;i<n;i++)\n\t\t\tprintf(\"%c\", str[i]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j, n;\n char s[128];\n scanf(\"%d\\n%s\", &n, s);\n for (i = 0, j = 0; i < n; i++)\n if (s[i] == '0')\n j++;\n if (j + j != n)\n printf(\"1\\n%s\\n\", s);\n else\n printf(\"2\\n%c %s\\n\", s[0], s + 1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n int main()\n {\n int i,x,y=0,z=0; \n scanf(\"%d\", &x);\n char str[x];\n scanf(\"%s\", str);\n for(i=0;i<x;i++){\n if(str[i]=='1') y++;\n else z++;\n }\n if(y==z)\n {\n printf(\"2\\n\");\n for(i=0;i<x-1;i++)\n {\n printf(\"%c\", str[i]);\n }\n printf(\" %c\", str[x-1]);\n }\n else{\n printf(\"1\\n\");\n printf(\"%s\", str);\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,p;\n scanf(\"%d\",&n);\n char a[n+3];\n scanf(\"%s\",a);\n\n if(n%2) printf(\"1\\n%s\",a);\n else\n {\n p=0;\n for(i=0;i<n;i++) if(a[i]=='0') p++;\n if(p==n/2) printf(\"2\\n%c %s\",a[0],a+1);\n else printf(\"1\\n%s\",a);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar str[1001];\nint pre1[1009];\nint pre0[1009];\nint main() {\n\tint n,k,i,j,len;\n\twhile (scanf(\"%d\", &n) != EOF) {\n\t\tgetchar();\n\t\tfgets(str, sizeof(str), stdin);\n\t\tlen = n;\n\t\tif (str[0] == '0')pre0[0] = 1;\n\t\telse pre1[0] = 1;\n\t\tfor (i = 1; i < len; i++) {\n\t\t\tif (str[i] == '0') {\n\t\t\t\tpre0[i]=1+pre0[i-1];\n\t\t\t\tpre1[i] = pre1[i - 1];\n\t\t\t}\n\t\t\telse if (str[i] == '1') {\n\t\t\t\tpre1[i] = 1 + pre1[i - 1];\n\t\t\t\tpre0[i] = pre0[i - 1];\n\t\t\t}\n\t\t}\n\t\tif (len == 1)printf(\"1\\n%c\", str[0]);\n\t\telse if (pre1[n - 1] != pre0[n - 1]) {\n\t\t\tprintf(\"1\\n\");\n\t\t\tfor (j = 0; j < len;j++)printf(\"%c\", str[j]);\n\t\t}\n\t\telse {\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tif (pre1[i] != pre0[i] && ((pre1[n - 1] - pre1[i]) != (pre0[n - 1] - pre0[i]))) {\n\t\t\t\t\tprintf(\"%d\\n\", 2);\n\t\t\t\t\tfor (j = 0; j <len; j++) {\n\t\t\t\t\t\tif (j == i)printf(\"%c \", str[j]);\n\t\t\t\t\t\telse printf(\"%c\", str[j]);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"\\n\");\n\t\tmemset(str, 0, sizeof(str));\n\t\tmemset(pre1, 0, sizeof(pre1));\n\t\tmemset(pre0, 0, sizeof(pre0));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "//best actor==keanu reeves//\n#include<stdio.h>\nint main()\n{\n int n,i,keanu=0,reeves=0;\n char s[102];\n scanf(\"%d %s\", &n,s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='1')\n {\n keanu++;\n }\n else{\n reeves++;\n }\n\n }\n if(keanu!=reeves){\n printf(\"1\\n%s\",s);\n }\n else{\n printf(\"2\\n%c %s\", s[0], s+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c!=n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int count_0=0,count_1=0;\n for(i=0;i<n;i++){\n if(s[i]=='0')\n count_0++;\n else\n count_1++;\n }\n if(n==1){\n printf(\"1\\n\");\n printf(\"%c \",s[0]);\n }\n else if(count_0>count_1||count_1>count_0){\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x=0,y=0,i,j,n;\n char ara[109];\n scanf(\"%d%s\",&n,ara);\n for(i=0;i<n;i++){\n if(ara[i]=='1'){\n x++;\n }\n else{\n y++;\n }\n }\n if(x==y){\n printf(\"%d\\n\",2);\n printf(\"%c %s\",ara[0],ara+1);\n }\n else{\n printf(\"%d\\n\",1);\n printf(\"%s\",ara);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define N 100\n\nint is_good(const char *s, int k){\n int count_z=0, count_o=0;\n\n for (int i=0; i<k; i++){\n if (s[i]=='0') count_z++;\n else count_o++;\n }\n if (count_z!=count_o) return 1;\n return 0;\n}\nvoid solve(const char *s, int n){\n int k=1;\n\n while (!is_good(s, k)) k++;\n printf(\"2\\n\");\n for (int i=0; i<k; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for (int i=k; i<n; i++) printf(\"%c\", s[i]);\n}\n\nint main(){\n int n;\n char s[N+1];\n\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n\n if (is_good(s, n)){\n printf(\"1\\n%s\", s);\n return 0;\n }\n solve(s, n);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n int main()\n {\n int i,x,y=0,z=0; \n scanf(\"%d\", &x);\n char str[x];\n scanf(\"%s\", str);\n for(i=0;i<x;i++){\n if(str[i]=='1') y++;\n else z++;\n }\n if(y==z)\n {\n printf(\"2\\n\");\n for(i=0;i<x-1;i++)\n {\n printf(\"%c\", str[i]);\n }\n printf(\" %c\", str[x-1]);\n }\n else{\n printf(\"1\\n\");\n printf(\"%s\", str);\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,c,i,j,k;\nscanf(\"%d\",&n);\nchar a[n];\nc=0;\nb=0;\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\nif(a[i]=='1')\nc++;\nelse if(a[i]=='0')\nb++;\n}\nchar m[n];\nfor(i=0;i<n-1;i++)\n{\nm[i]=a[i];\n}\nm[n-1]='\\0';\nif(c!=b)\n{\nprintf(\"%d\\n\",1);\nprintf(\"%s\",a);\n}\nelse\n{\nprintf(\"%d\\n\",2);\nprintf(\"%s\",m);\nprintf(\" %c\",a[n-1]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{ int n,se=0,so=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(int i=0;i<n;i++)\n{ if(s[i]=='0')\n so++;\n else\n se++;}\nif(se!=so)\n{ printf(\"%d\\n\",1);\n printf(\"%s\",s);}\nelse\n{ if(s[n-1]=='0')\n { s[n-1]='\\0';\n printf(\"%d\\n\",2);\n printf(\"%s \",s);\n printf(\"%d\",0);}\n else\n { s[n-1]='\\0';\n printf(\"%d\\n\",2);\n printf(\"%s \",s);\n printf(\"%d\",1);}}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n\tint n,zero=0,one=0,i;\n\tscanf(\"%d\",&n);\n\tchar s[100];\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;++i)\n\t{\n\t\tif(s[i]=='0')\n\t\t{\n\t\t\tzero++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tone++;\n\t\t}\n\t}\n\tif(zero!=one)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",s);\n\t}\n\telse\n\t{\n printf(\"2\\n\");\n char c=s[n-1];\n s[n-1]='\\0';\n printf(\"%s %c\",s,c);\n \n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(void)\n{\n\tint n,check,zero=0,one=0;\n\tchar str[101];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",str);\n\tif(n%2==1)printf(\"1\\n%s\",str);\n\tif(n%2==0)\n\t{\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif (str[i]=='0')zero++;\n\t\t\telse one++;\n\t\t}\n\t\tif(one==zero)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\tfor(int j=0;j<n-1;j++)\n\t\t\tprintf(\"%c\",str[j]);\n\t\t\tprintf(\" %c\",str[n-1]);\n\t\t}\n\t\telse printf(\"1\\n%s\",str);\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, i, tsum0=0, tsum1=0, sum0=0, sum1=0, rsum0, rsum1, j;\n char str[110];\n scanf(\"%d\", &n);\n scanf(\" %s \", str);\n for(i=0;i<n;i=i+1)\n {\n if(str[i]=='1')\n {\n tsum1=tsum1+1;\n }\n else\n {\n tsum0=tsum0+1;\n }\n }\n if(tsum0!=tsum1)\n {\n printf(\"1\\n\");\n printf(\"%s\", str);\n }\n else\n {\n printf(\"2\\n\");\n for(i=0;i<n;i=i+1)\n {\n if(str[i]=='1')\n {\n sum1=sum1+1;\n rsum1=tsum1-sum1;\n rsum0=tsum0-sum0;\n }\n else\n {\n sum0=sum0+1;\n rsum1=tsum1-sum1;\n rsum0=tsum0-sum0;\n }\n if((sum1!=sum0) && (rsum0!=rsum1))\n {\n break;\n }\n } \n for(j=0;j<=i;j=j+1)\n {\n printf(\"%c\", str[j]);\n }\n printf(\" \");\n for(j=i+1;j<n;j=j+1)\n {\n printf(\"%c\", str[j]);\n }\n }\n \n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stddef.h>\n\n\nint main(void) {\n \n int c;\n ptrdiff_t n;\n\n ptrdiff_t i = 0;\n int c0 = 0;\n\n while ((c = getchar()) != 10)\n n = n * 10 + c - 48;\n\n char* s = malloc(n * sizeof(char));\n if (s == NULL)\n return -1;\n \n while ((c = getchar()) != 10) {\n if (c == 48)\n c0 += 1;\n s[i++] = c;\n }\n\n if (n - c0 == c0) {\n putchar(50);\n putchar(10);\n putchar(*s);\n putchar(32);\n for (i = 1; i < n; i += 1) {\n putchar(*(s + i));\n }\n } else {\n putchar(49);\n putchar(10);\n for (i = 0; i < n; i += 1) {\n putchar(*(s + i));\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int zero=0,one=0,i=0;\n char string[100];\n scanf(\"%s\",string);\n while(i<n){\n if(string[i]-'0'==0)\n zero++;\n else \n one++;\n i=i+1;\n }\n if(zero!=one)\n {\n printf(\"1\\n\");\n printf(\"%s\",string);\n }\n\telse \n {\n printf(\"2\\n\");\n printf(\"%c \",string[0]);\n int i=1;\n while(i<n)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n, i, j, sum, zero = 0, one = 0;\n\n scanf(\"%d\", &n);\n\n char name[n];\n\n scanf(\" %s\", name);\n\n for(i=0; i<n; i++){\n\n if(name[i] == '0'){\n\n zero++;\n }\n else{\n\n one++;\n }\n }\n\n if(zero != one)\n {\n\n printf(\"1\\n%s\\n\", name);\n }\n else\n {\n\n\n printf(\"2\\n\");\n\n\n for(i=0; i<n-1; i++){\n\n printf(\"%c\", name[i]);\n }\n\n printf(\" %c\\n\", name[n-1]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,n,j,cnt1=0,cnt2=0;\n char s[101];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1 && s[0]=='0')\n {\n printf(\"1\\n0\");\n }\n else if(n==1 && s[0]=='1')\n {\n printf(\"1\\n1\");\n }\n else\n {\n for(int i=0; i<n; i++)\n {\n if(s[i]=='0')\n {\n cnt1++;\n }\n else if(s[i]=='1')\n {\n cnt2++;\n }\n }\n if(cnt1!=cnt2)\n {\n printf(\"1\\n%s\",s);\n }\n else if(cnt1==cnt2)\n {\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n for(j=1; j<n; j++)\n {\n printf(\"%c\",s[j]);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,c,i,j,k;\nscanf(\"%d\",&n);\nchar a[n];\nc=0;\nb=0;\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\nif(a[i]=='1')\nc++;\nelse if(a[i]=='0')\nb++;\n}\nchar m[n];\nfor(i=0;i<n-1;i++)\n{\nm[i]=a[i];\n}\nm[n-1]='\\0';\nif(c!=b)\n{\nprintf(\"%d\\n\",1);\nprintf(\"%s\",a);\n}\nelse\n{\nprintf(\"%d\\n\",2);\nprintf(\"%s\",m);\nprintf(\" %c\",a[n-1]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,c,i,j,k;\nscanf(\"%d\",&n);\nchar a[n];\nc=0;\nb=0;\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\nif(a[i]=='1')\nc++;\nelse if(a[i]=='0')\nb++;\n}\nchar m[n];\nfor(i=0;i<n-1;i++)\n{\nm[i]=a[i];\n}\nm[n-1]='\\0';\nif(c!=b)\n{\nprintf(\"%d\\n\",1);\nprintf(\"%s\",a);\n}\nelse\n{\nprintf(\"%d\\n\",2);\nprintf(\"%s\",m);\nprintf(\" %c\",a[n-1]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\nlong long int n = 0, z = 0, d = 0, a = 1, m = 1, v = 0, c = 0, b = 0;\nscanf(\"%I64d\", &n);\nchar X[n];\nscanf(\"%s\", X);\nwhile(c<n){if(X[c] == '1'){v = v + 1;}if(X[c] == '0'){b = b + 1;}c = c + 1;}\nif(v != b){printf(\"1\\n\");printf(\"%s\", X);}\nif(v == b){printf(\"2\\n\");if(X[0] == '1'){a = 1;}if(X[0] == '0'){a = 0;}\nprintf(\"%d \", a);\nc = 1;\na = 0;\nwhile(c < n){if(X[c] == '1'){a = 1;}if(X[c] == '0'){a = 0;}printf(\"%d\", a);c = c + 1;}}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main ()\n{\n\tint n ;\n\tscanf(\"%d\",&n);\n\t\n\tchar string[n] ;\n\tscanf(\"%s\",string);\n\t\n\tif(n%2 == 0)\n\t{\n\t\tint zeroes=0,ones=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(string[i] == '0')\n\t\t\t{\n\t\t\t\tzeroes++ ;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tones++ ;\n\t\t\t}\n\t\t}\n\t\tif(zeroes == ones)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\tfor(int i=0;i<n-1;i++)\n\t\t {\n\t\t\t printf(\"%c\",string[i]);\n\t\t }\n\t\t printf(\" %c\",string[n-1]);\n\t\t printf(\"\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\n\t\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tchar Str[101];\n\tint len, numberUnits = 0, numberZeros = 0, delimeters = 1;\n\tscanf(\"%i%[^\\n]\", &len);\n\tscanf(\"%100s%[^\\n]\", Str);\n\tStr[len] = '\\0';\n\tif(len % 2 == 1)\n\t\tprintf(\"%i\\n%s\", delimeters, Str);\n\telse{\n\t\tfor(int i = 0; i < len; i++){\n\t\t\tif(Str[i] == '1')\n\t\t\t\tnumberUnits += 1;\n\t\t\tif(Str[i] == '0')\n\t\t\t\tnumberZeros += 1;\n\t\t}\n\t\t//printf(\"%i\\n%i\", numberZeros, numberUnits);\n\t\tif(numberZeros == numberUnits){\n\t\t\tchar copyStr[101];\n\t\t\tcopyStr[len-1] = '\\0';\n\t\t\tstrncpy(copyStr, Str, len-1);\n\t\t\tdelimeters += 1;\n\t\t\tprintf(\"%i\\n%s %s\", delimeters, copyStr, (Str + len -1));\n\t\t}\n\t\telse\n\t\t\tprintf(\"%i\\n%s\", delimeters, Str);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i<n;i++){\n\t\tif (a[i]=='0') cnt++;\n\t\telse cnt1++;\n\t}\n\tif (cnt1==cnt) return 0;\n\treturn 1;\n}\nvoid in(char a[],int k,int n){\n\tfor (int i=k;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\n\tif (kt(a,0,n)){\n\t\tprintf(\"1\\n\");\n\t\tin(a,0,n);\n\t}\n\telse if(n==2){\n\t\tprintf(\"2\\n%c %c\",a[0],a[1]);\n\t}\n\telse {\n\t\tprintf(\"2\\n\");\n\t for (int i=1;i<n-1;i++){\n\t\tif (kt(a,0,i) && kt(a,i,n)) {\n\t\t\tin(a,0,i);\n\t\t\tprintf(\" \");\n\t\t\tin(a,i,n);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n}"}, {"source_code": "#include <stdio.h>\n#define N 100\n\nint is_good(const char *s, int k){\n int count_z=0, count_o=0;\n\n for (int i=0; i<k; i++){\n if (s[i]=='0') count_z++;\n else count_o++;\n }\n if (count_z!=count_o) return 1;\n return 0;\n}\nvoid solve(const char *s, int n){\n \n printf(\"2\\n%c \", s[0]);\n for (int i=1; i<n; i++) printf(\"%c\", s[i]);\n}\n\nint main(){\n int n;\n char s[N+1];\n\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n\n if (is_good(s, n)){\n printf(\"1\\n%s\", s);\n return 0;\n }\n solve(s, n);\n\n return 0;\n}"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,j,zero=0,one=0;\n char c;\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n scanf(\"%c\",&c);\n char crr[n];\n int arr[n];\n int brr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%c\",&crr[i]);\n if(crr[i]=='1')one++;\n if(crr[i]=='0')zero++;\n arr[i]=one;\n brr[i]=zero;\n }\n if(one==zero)\n {\n for(i=0;i<n;i++)\n {\n if(arr[i]!=brr[i])\n {\n if((one-arr[i])!=(zero-brr[i]))break;\n }\n }\n if(n!=1)printf(\"2\\n\");\n else printf(\"1\\n\");\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n if(j==i && n!=1)printf(\" \");\n }\n }\n else\n {\n printf(\"1\\n\"); \n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n }\n }\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int zero=0,one=0,i=0;\n char string[100];\n scanf(\"%s\",string);\n while(i<n){\n if(string[i]-'0'==0)\n zero++;\n else \n one++;\n i=i+1;\n }\n if(zero!=one)\n {\n printf(\"1\\n\");\n printf(\"%s\",string);\n }\n\telse \n {\n printf(\"2\\n\");\n printf(\"%c \",string[0]);\n int i=1;\n while(i<n)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,c,i,j,k;\nscanf(\"%d\",&n);\nchar a[n];\nc=0;\nb=0;\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\nif(a[i]=='1')\nc++;\nelse if(a[i]=='0')\nb++;\n}\nchar m[n];\nfor(i=0;i<n-1;i++)\n{\nm[i]=a[i];\n}\nm[n-1]='\\0';\nif(c!=b)\n{\nprintf(\"%d\\n\",1);\nprintf(\"%s\",a);\n}\nelse\n{\nprintf(\"%d\\n\",2);\nprintf(\"%s\",m);\nprintf(\" %c\",a[n-1]);\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char const *argv[]) {\n int n, num1 = 0, num0 = 0, end;\n char s[105];\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n for (int i = 0; i < n; i++) {\n if (s[i]=='1') num1 ++;\n else num0 ++;\n end = i;\n if (num1 == num0 && i == n-1) {\n end = i - 1;\n }\n }\n if (num1 == num0) printf(\"2\\n\");\n else printf(\"1\\n\");\n for (int i = 0; i <= end; i++) {\n printf(\"%c\",s[i]);\n }\n if (num1 == num0) printf(\" \");\n for (int i = end+1; i < n; i++) {\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar ara[n];\n\tscanf(\"%s\",ara);\n\tint x=strlen(ara),one=0,zero=0;\n\tif (x%2==1){\n printf(\"1\\n%s\\n\",ara);\n\t}\n\telse {\n for (int j =0; j<n; j++){\n if (ara[j]=='1')\n one++;\n else\n zero++;\n }\n if (one==zero && (n/2)%2==0){\n printf(\"2\\n\");\n for(int i=0; i<n; i++){\n if (i==((n/2)-1))\n printf(\" \");\n printf(\"%c\",ara[i]);\n\n }\n printf(\"\\n\");\n }\n else if (one==zero && (n/2)%2==1){\n printf(\"2\\n\");\n for(int i=0; i<n; i++){\n if (i==(n/2))\n printf(\" \");\n printf(\"%c\",ara[i]);\n\n }\n }\n else{\n printf(\"1\\n%s\\n\",ara);\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint n,z=0,u=0,i=0,nb;\n\tchar q, s[100];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif(s[i]=='0') z++ ;\n\t\telse u++ ;\n\t}\n\tif(z==u) \n\t{\n q=s[n-1];\n\t\ts[n-1]='\\0';\n\t\tprintf(\"2\\n%s \",s);\n\t\tprintf(\"%c\",q);\n }\n\telse \n\t{ printf(\"1 \\n\");\n\t printf(\"%s\",s) ;\n\t\n}\n \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf (\"%d\", &n);\n\tchar s[1005];\n\tscanf (\"%s\", s);\n\tint s1=0, s2=0;\n\tfor (int i=0; i<n; ++i) {\n\t\tif (s[i]=='1') s1++;\n\t\telse s2++;\n\t}\n\tif (s1!=s2) printf (\"1\\n%s\", s);\n\telse {\n\t\tprintf (\"2\\n\");\n\t\tprintf (\"%c \", s[0]);\n\t\tfor (int i=1; i<n; ++i) {\n\t\t\tprintf (\"%c\", s[i]);\n\t\t}\n\t}\n \t\n\treturn 0;\n}\n\n// QuynhQuynh\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\n#include<ctype.h>\n \nint main()\n{\n int n,i,j,nb,nb1,nb2,pos,k;\n scanf(\"%d\",&n);\n char q,s[n];\n scanf(\"%s\",s);\n nb1=0;\n nb2=0;\n nb=0;\n for (i=0 ; i<n; i++){\n if (s[i]=='1')\n nb++;\n else nb1++;\n }\n if (nb==nb1){\n q=s[n-1];\n s[n-1]='\\0';\n printf(\"2\\n%s \",s);\n printf(\"%c\",q);\n }\n else printf(\"1\\n%s\",s);\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n, i, j, sum, zero = 0, one = 0;\n\n scanf(\"%d\", &n);\n\n char name[n];\n\n scanf(\" %s\", name);\n\n for(i=0; i<n; i++){\n\n if(name[i] == '0'){\n\n zero++;\n }\n else{\n\n one++;\n }\n }\n\n if(zero != one)\n {\n\n printf(\"1\\n%s\\n\", name);\n }\n else\n {\n\n\n printf(\"2\\n\");\n\n\n for(i=0; i<n-1; i++){\n\n printf(\"%c\", name[i]);\n }\n\n printf(\" %c\\n\", name[n-1]);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main ()\n{\n\tint n ;\n\tscanf(\"%d\",&n);\n\t\n\tchar string[n] ;\n\tscanf(\"%s\",string);\n\t\n\tif(n%2 == 0)\n\t{\n\t\tint zeroes=0,ones=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(string[i] == '0')\n\t\t\t{\n\t\t\t\tzeroes++ ;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tones++ ;\n\t\t\t}\n\t\t}\n\t\tif(zeroes == ones)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\tfor(int i=0;i<n-1;i++)\n\t\t {\n\t\t\t printf(\"%c\",string[i]);\n\t\t }\n\t\t printf(\" %c\",string[n-1]);\n\t\t printf(\"\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\n\t\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\ncount=count1=0;\nfor(i=0;i<n;i++){\n if(a[i]=='0'){\n count++;\n }else{\n count1++;\n }\n}\nif(count==count1){\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",a[i]);\n }\n printf(\" %c\",a[n-1]);\n}else{\n \n printf(\"1\\n%s\",a);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,z=0,o=0;\n scanf(\"%d\",&n);\n char s[n+5];\n scanf(\"%s\",s);\n for(int i=0;i<n;i++){\n if(s[i]=='0'){\n z++;\n }\n else{\n o++;\n }\n }\n if(z!=o){\n printf(\"1\\n%s\",s);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n for(int i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j=0,k=0,a=0,b=0,l,m,d,e,f=0;\n char c[1000];\n scanf(\"%d\",&n);\n getchar();\n scanf(\"%s\",&c);\n getchar();\n for(i=0;i<n;i++){\n if(c[i]=='1')\n a++;\n else\n b++;\n }\n if(a!=b){\n printf(\"1\\n\");\n printf(\"%s\",c);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",c[0]);\n for(i=1;i<n;i++)\n printf(\"%c\",c[i]);\n }\n}\n"}, {"source_code": "int main()\n{\n char ch[100];\n char m;\n int n,i,a0=0,a1=0;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n for (i=0;i<n;i++)\n { \n if(ch[i]=='0') a0++;\n \n else \n a1++;\n\n } \n if (a0==a1){\n m=ch[n-1];\n ch[n-1]='\\0';\n printf(\"2\\n%s\" ,ch);\n printf(\" %c\",m);\n }\n else\n {\n printf(\"1\\n%s\",ch);\n }\n\n return 0;\n}\n"}, {"source_code": "/*bai 1189 A*/\n\n#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar c[1000];\n\tscanf(\"%s\",c);\n\tint cnt1=0, cnt2=0;\n\tfor(int i=0;i<n;i++){\n\t\tif(c[i]=='1')\n\t\t\tcnt1++;\n\t\telse cnt2++;\n\t}\n\tif(cnt1!=cnt2){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\",c);\n\t}\n\telse {\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%c \", c[0]);\n\t\tfor(int i=1;i<n;i++){\n\t\t\tprintf(\"%c\", c[i]);\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,odd=0,even=0;\n char s[105];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0 ; i<n ; i++)\n {\n if(s[i]=='0')\n even++;\n else\n odd++;\n }\n if(even!=odd)\n {\n printf(\"1\\n%s\\n\",s);\n }\n else\n {\n printf(\"2\\n\");\n for(i=0 ; i<n-1 ; i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,o=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse o++;\n\t}\n\tif(k!=o)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main ()\n{\n\tint n ;\n\tscanf(\"%d\",&n);\n\t\n\tchar string[n] ;\n\tscanf(\"%s\",string);\n\t\n\tif(n%2 == 0)\n\t{\n\t\tint zeroes=0,ones=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(string[i] == '0')\n\t\t\t{\n\t\t\t\tzeroes++ ;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tones++ ;\n\t\t\t}\n\t\t}\n\t\tif(zeroes == ones)\n\t\t{\n\t\t\tprintf(\"2\\n\");\n\t\t\tfor(int i=0;i<n-1;i++)\n\t\t {\n\t\t\t printf(\"%c\",string[i]);\n\t\t }\n\t\t printf(\" %c\",string[n-1]);\n\t\t printf(\"\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tprintf(\"%c\",string[i]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,n,j=0;\n\tchar t,c[101];\n\tscanf(\"%d%s\",&n,c);\n\tif(n==1)\n\tprintf(\"1\\n%s\\n\",c);\n\telse\n\t{\n\tfor(i=0;i<n;i++)\n\tif(c[i]=='0')\n\tj++;\n\tif(j==n/2&&n%2!=1)\n\t{\n\tt=c[n-1];\n\tc[n-1]='\\0';\n\tprintf(\"2\\n%s %c\\n\",c,t);\n }\n if(n%2==1||j!=n/2)\n printf(\"1\\n%s\\n\",c);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j=0,n,k;\n char s[102];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1)\n {\n printf(\"%d\\n\",1);\n printf(\"%s\",s);\n }\n else\n {\n \n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n j=j+1;\n \n }\n if(j!=n-j)\n { \n printf(\"%d\\n\",1);\n printf(\"%s\",s);\n \n \n }\n else\n {\n printf(\"%d\\n\",2);\n printf(\"%c \",s[0]);\n for(i=1;i<strlen(s);i++)\n {\n printf(\"%c\",s[i]);\n }\n \n \n }\n \n }\n \n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x=0,y=0,i,j,n;\n char ara[109];\n scanf(\"%d%s\",&n,ara);\n for(i=0;i<n;i++){\n if(ara[i]=='1'){\n x++;\n }\n else{\n y++;\n }\n }\n if(x==y){\n printf(\"%d\\n\",2);\n printf(\"%c %s\",ara[0],ara+1);\n }\n else{\n printf(\"%d\\n\",1);\n printf(\"%s\",ara);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,k=0,l=0;\n\tchar s[101];\n\tscanf(\"%d %s\",&n,s);\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='1')k++;\n\t\telse l++;\n\t}\n\tif(k!=l)printf(\"1\\n%s\",s);\n\telse printf(\"2\\n%c %s\",s[0],s+1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar s[102];\n\tscanf(\"%s\", s);\n\tint i;\n\tint count[2];\n\tcount[0] = count[1] = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcount[s[i] - '0']++;\n\tif (count[0] != count[1])\n\t\tprintf(\"1\\n%s\\n\", s);\n\telse\n\t{\n\t\tprintf(\"2\\n\");\n\t\tfor (i = 0; i < n - 1; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t\tprintf(\" %c\\n\", s[n - 1]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nmain(){\n int n;\n char s[100];\n scanf(\"%d%s\",&n,s);\n int fr[2] = {0};\n for(int i=0;i<n;++i){\n ++fr[s[i]-'0'];\n }\n\n if( fr[0] != fr[1] )\n printf(\"%d\\n%s\\n\",1,s);\n else{\n putchar('2');\n putchar('\\n'); \n int i,fr2[2] = {0};\n for(i=0;i<n;++i){\n ++fr2[s[i]-'0'];\n if( fr2[0] != fr2[1] && (fr[0]-fr2[0]) != (fr[1]-fr2[1]) )\n break; \n }\n \n for(int j=0;j<=i;++j)\n putchar(s[j]);\n putchar(' ');\n ++i;\n for(;i<n;i++)\n putchar(s[i]);\n putchar('\\n'); \n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\nint i,j,k,n;\nchar s[101];\nj = k = 0;\nscanf(\"%i\\n%100s\",&n,s);\nfor (i=0;i<n;i++){\n\tif(s[i] == '0')\n\t\tj++;\n\telse\n\t\tk++;\n\t}\nif (k!=j)\n\tprintf(\"1\\n%s\",s);\nelse\n\tprintf(\"2\\n%c %s\",s[0],s+1);\n\nreturn 0-0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n int n,ones=0,zeros=0;\n scanf(\"%d\",&n);\n char a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\" %c\",&a[i]);\n if(a[i]=='1')\n ones++;\n else\n zeros++;\n // printf(\"%c\\n\",a[i]);\n }\n\n if(ones==zeros)\n {\n printf(\"2\\n\");\n if(n>=2)\n {\n \n for(int i=0;i<1;i++)\n {\n printf(\"%c\",a[i]); \n }\n printf(\" \");\n for(int i=1;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n \n }\n else\n {\n for(int i=0;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n }\n else\n {\n printf(\"1\\n\");\n for(int i=0;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n \n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,a,one=0;\n\tscanf(\"%d\",&n);\n\tchar s[1001];\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++) \n\tif(s[i]=='1') one++;\n\tint zero=strlen(s)-one;\n\tif(one!=zero)\n\t{\n\t\tprintf(\"1\\n%s\\n\",s);\n\t}\n\telse \n\t{\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%c \",s[0]);\n\t\tfor(i=1;i<n;i++) printf(\"%c\",s[i]);\n\t\tputs(\"\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,t1=0,t2=0;\n char s[102];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n {\n t1++;\n }\n else\n {\n t2++;\n }\n }\n if(t1!=t2)\n {\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else\n {\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n for(i=1;i<n;i++)\n {\n printf(\"%c\",s[i]);\n\n }\n\n }\n\n\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j=0,k=0,a=0,b=0,l,m,d,e,f=0;\n char c[1000];\n scanf(\"%d\",&n);\n getchar();\n scanf(\"%s\",&c);\n getchar();\n for(i=0;i<n;i++){\n if(c[i]=='1')\n a++;\n else\n b++;\n }\n if(a!=b){\n printf(\"1\\n\");\n printf(\"%s\",c);\n }\n else{\n printf(\"2\\n\");\n printf(\"%c \",c[0]);\n for(i=1;i<n;i++)\n printf(\"%c\",c[i]);\n }\n}\n"}, {"source_code": " #include <stdio.h>\n #include <string.h>\n int main(void){\n // Your code here!\n int i,j,N,count1=0,count0=0;\n scanf(\"%d\",&N);\n char str[N];\n // gets(str);\n // printf(\"%s\",str);\n scanf(\"%s\",str);\n for(i=0;i<N;i++)\n {\n if (str[i]=='1')\n count1++;\n else if(str[i]=='0')\n count0++;\n }\n if(N!=1){\n if(count1!=count0)\n { printf(\"1\\n\");\n // puts(str);\n printf(\"%s\",str);\n }\n else if(count0==count1)\n {\n printf(\"2\\n\");\n printf(\"%c \",str[0]);\n for(j=1;j<N;j++)\n {\n printf(\"%c\",str[j]);\n }\n }\n }\n else if(N==1){\n printf(\"1\\n%s\",str);\n }\n }"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint q=0;\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar str[n+1];\n\tscanf(\"%s\", str);\n\tint no1 = 0, no0=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\tno1++;\n\t\telse\n\t\t\tno0++;\n\t\tq++;\n\t}\n\tif(no1!=no0){\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%s\", str);\n\t\treturn 0;\n\t}\n\tq=0;\n\tint a=0, b=0;\n\tint fin=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\ta++;\n\t\telse\n\t\t\tb++;\n\t\tif(a!=b){\n\t\t\tint rem1 = no1-a;\n\t\t\tint rem0 = no0 -b;\n\t\t\tif(rem1!=rem0){\n\t\t\t\tfin=q;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tq++;\n\t}\n\tif(n==1)\n\tprintf(\"1\\n\");\n\telse\n\t\tprintf(\"2\\n\");\n\tfor(int i=0;i<=fin;i++)\n\t\t\tprintf(\"%c \", str[i]);\n\tfor(int i=fin+1;i<n;i++)\n\t\t\tprintf(\"%c\", str[i]);\n\treturn 0;\n}"}], "negative_code": [{"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main() {\n char n[1000];\n long long s,k,l=0;\n scanf(\"%lld\",&s);\n scanf(\"%s\",&n);\n k=strlen(n);\n if (k%2==1)\n printf(\"1\\n%s\",n);\n else {\n for (int i=0;i<s;i++){\n if (n[i]==0)\n k++;\n }\n if (k==(s/2))\n printf(\"1\\n%s\",n);\n else {\n printf(\"2\\n%c \",n[0]);\n for (int i=1;i<s;i++){\n printf(\"%c\",n[i]);\n }\n }\n }\n \n\n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n int k;\n char tmp[100];\n char s[100]=\"\";\n char s1[100]=\"\";\n\n scanf(\"%i\\n\", &n);\n gets(s);\n\n for(int i=0; i<strlen(s);i++){\n if ((s[i]=='0') && (s[++i]=='0')){\n strncpy(s1,s,i+1);\n k=i+1;\n break;\n }\n }\n\n if (n == 2){\n if (s[0]!=s[1]){\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n printf(\"%c\",s[1]);\n }\n else {\n printf(\"1\\n\");\n printf(\"%s\",s);\n }\n }\n else if (strlen(s)%2==0){\n printf(\"2\\n\");\n printf(\"%s \",s1);\n for(int i =k; i<strlen(s); i++){\n printf(\"%c\",s[i]);\n }\n }\n else{\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,n,cnt1=0,cnt2=0;\n char s[101];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1 && s[0]=='0')\n {\n printf(\"1\\n0\");\n }\n else if(n==1 && s[0]=='1')\n {\n printf(\"1\\n1\");\n }\n else\n {\n for(int i=0; i<n; i++)\n {\n if(s[i]=='0')\n {\n cnt1++;\n }\n else if(s[i]=='1')\n {\n cnt2++;\n }\n }\n printf(\"2\\n\");\n while(cnt1--)\n {\n printf(\"0\");\n }\n printf(\" \");\n while(cnt2--)\n {\n printf(\"1\");\n }\n printf(\" \");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n-1;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c==n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100],sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]=='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1!=s2) {\n\t\tprintf(\"%d\\n\",1);\n\t\tprintf(\"%s\",ch);\n }\n\telse {\n\t\tfor (i=0;i<n-1;i++) {\n\t\t\tsh[i]=ch[i];\n\t\t}\n\t\tsh[n]='\\0';\n\t\tprintf(\"%d\\n\",2);\n\t\tprintf(\"%s %c\",sh,ch[n-1]);\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==1) one++;\n else zero++;\n }\n if(n==1)\n {\n printf(\"1\\n\");\n printf(\"%d\",arr[0]);\n }\n else if(one!=zero)\n {\n printf(\"1\\n\");\n for(i=0;i<n;i++)\n printf(\"%d\",arr[i]);\n }\n else if(one==zero)\n {\n printf(\"2\\n\");\n for(i=0;i<n-1;i++) \n printf(\"%d\",arr[i]);\n printf(\" %d\",arr[n-1]);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"%s\\n\", arr);\n }\n else\n {\n printf (\"%c %s\\n\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,zero=0,one=0;\n char c;\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n scanf(\"%c\",&c);\n char crr[n];\n int arr[n];\n int brr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%c\",&crr[i]);\n if(crr[i]=='1')one++;\n if(crr[i]=='0')zero++;\n arr[i]=one;\n brr[i]=zero;\n }\n for(i=0;i<n;i++)\n {\n if(arr[i]!=brr[i])\n {\n if((one-arr[i])!=(zero-brr[i]))break;\n }\n }\n if(n!=1)printf(\"2\\n\");\n else printf(\"1\\n\");\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n if(j==i && n!=1)printf(\" \");\n }\n \n}"}, {"source_code": "//practice with dukkha\n#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n char b[10000];\n scanf(\"%s\",b);\n if(a%2==1)\n {\n printf(\"1\\n%s\",b);\n return 0;\n }\n int count=0;\n for(int i=0;i<a;i++)\n count+=b[i]-'0';\n int sum=0;\n for(int i=0;i<a;i++)\n {\n sum+=b[i]-'0';\n int r=count-sum;\n int len=a-1-i;\n int zero=len-r;\n int curl=i+1;\n int cur0=curl-sum;\n if(r!=zero && cur0!=sum)\n {\n printf(\"2\\n\");\n for(int j=0;j<=i;j++)\n printf(\"%c\",b[j]);\n printf(\" \");\n for(int j=i+1;j<a;j++)\n printf(\"%c\",b[j]);\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i<n;i++){\n\t\tif (a[i]=='0') cnt++;\n\t\telse cnt1++;\n\t}\n\tif (cnt1==cnt) return 0;\n\treturn 1;\n}\nvoid in(char a[],int k,int n){\n\tfor (int i=k;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\tprintf(\"2\\n\");\n\tif (strlen(a)==1){\n\t\tprintf(\"1\\n%d\",a[0]);\n\t}\n\telse if(strlen(a)==2){\n\t\tprintf(\"2\\n%d %d\",a[0],a[1]);\n\t}\n\telse {\n\tfor (int i=1;i<n-1;i++){\n\t\tif (kt(a,0,i) && kt(a,i,n)) {\n\t\t\tin(a,0,i);\n\t\t\tprintf(\" \");\n\t\t\tin(a,i,n);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n}"}, {"source_code": "#include<stdio.h>\n\nint main () \n{ \n\tint n,p,q;\n\tscanf(\"%d\",&n);\n char str[n+1];\n int i,j,k;\n\tscanf(\"%s\",str);\n for(i=0;i<n;i++)\n {\n \tif(str[i]=='1')\n \t{\n \t\tp++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tq++;\n\t\t}\n\t}\n if(p==q)\n {\n \tprintf(\"2\\n\");\n \tfor(i=0;i<n-1;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t\tprintf(\" %c\",str[n-1]);\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n \tfor(i=0;i<n;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t}\n return 0; \n} \n"}, {"source_code": "int main(int argc, char *argv[]) {\n\tint a0,a1,n;\n\tchar s[200];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",&s);\n\ta0=0;\n\ta1=0;\n\tint i;\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='0') a0++;\n\t\telse a1++;\n\t}\n\tif(a0==a1){\n\t\tprintf(\"2\\n%c \",s[n-1]);\n\t\ts[n-1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\telse printf(\"1\\n%s\",s);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i=0,j,count=0,result=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='1')\n {\n count=count+1;\n }\n else\n {\n result=result+1;\n }\n i=i+1;\n }\n if(count!=result)\n {\n printf(\"1\\n\");\n printf(\"%s\",s);\n }\n else\n {\n printf(\"2\\n\");\n for(j=1;j<count;j=j+1)\n {\n printf(\"1\");\n }\n for(j=1;j<=count;j=j+1)\n {\n printf(\"0\");\n }\n printf(\" \");\n printf(\"1\\n\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n\tint ia = *(int *) a;\n\tint ib = *(int *) b;\n\n\treturn ia - ib;\n}\n\nint main() {\n\tstatic char s[128];\n\tint n, i, cnt;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcnt += (s[i] - '0');\n\tif (cnt != n - cnt) {\n\t\tprintf(\"1\\n%s\", s);\n\t} else {\n\t\tqsort(s, n, sizeof *s, compare);\n\t\tprintf(\"2\\n\");\n\t\tfor (i = 0; i < n / 2; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t\tprintf(\" \");\n\t\tfor (i = n / 2; i < n; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,a,b,k,l,cnt=0,cmt=0;\n char s[101];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n%2==1) {\n printf(\"1\\n\");\n\n printf(\"%s\\n\",s);\n }\n else {\n for(k=0;k<n/2;k++)\n {\n if(s[k]=='0') cnt++;\n else cmt++;\n }\n if(cnt!=cmt) {\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else {\n printf(\"2\\n\");\n for(j=0;j<(n-1);j++)\n printf(\"%c\",s[j]);\n printf(\" \");\n printf(\"%c\",s[n-1]);\n printf(\"\\n\");\n }\n\n\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, pos, x=0, y=0, flag=0;\n scanf(\"%d\", &n);\n char s[n];\n scanf(\"%s\", s);\n for(int i=0; i<n; i++)\n { if(s[i]=='1')x++;\n else if(s[i]=='0') y++;} \n if(n%2==0) \n {\n \n if(x!=y){\n printf(\"1\\n\");printf(\"%s\",s );\n }\n else {\n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++) printf(\"%c\",s[i]);\n }\n }\n else if(n==1){printf(\"1\\n\");printf(\"1\" ); }\n else \n { \n for(int i=0; i<n; i++)\n {\n if(s[i]==s[i+1] && (i+1)%2!=0 ) {pos=i; flag=1;}\n \n }\n \n if(flag==1){\n printf(\"2\\n\");\n for(int i=0; i<=pos+1; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for(int i=pos+2; i<n; i++) printf(\"%c\",s[i]); \n }\n else {printf(\"1\\n\");printf(\"%s\",s ); }\n \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\tint dem0=0,dem1=0,tmp=-1;\n\tif(n==1)\n\tprintf(\"1\\n%s\",a);\n\telse if(n==2)\n\tprintf(\"2\\n%c %c\",a[0],a[1]);\n\telse{\n\t\tprintf(\"2\\n\");\n\t\tfor(int i=0;i<n/2;i++){\n\t\t\tif(a[i]=='1'){\n\t\t\ttmp++;\n\t\t\tdem1++;\n\t\t\t}\n\t\t\telse{\n\t\t\ttmp++;\n\t\t\tdem0++;\n\t\t}\n\t}\n\tif(dem1==dem0)\n\ttmp++;\n\tfor(int i=0;i<=tmp;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\" \");\n\tfor(int i=tmp+1;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main() {\n char n[1000];\n int s,k;\n scanf(\"%d\",&s);\n scanf(\"%s\",&n);\n k=strlen(n);\n if (k%2==1)\n printf(\"1\\n%s\",n);\n else {\n printf(\"2\\n%c \",n[0]);\n for (int i=1;i<s;i++){\n printf(\"%c\",n[i]);\n }\n }\n \n\n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n int k;\n char tmp[100];\n char s[100]=\"\";\n char s1[100]=\"\";\n\n scanf(\"%i\\n\", &n);\n gets(s);\n int z=0;\n\n for(int i=0; i<n;i++){\n if (s[i] != '0') z++;\n if (s[i] != '1') z--;\n }\n\n\n for(int i=0; i<n;i++){\n if (((s[i]=='0') && (s[++i]=='0')) || ((s[i]=='1') && (s[++i]=='1'))){\n strncpy(s1,s,i+1);\n k=i+1;\n break;\n }\n }\n\n if (n == 2){\n if (s[0]!=s[1]){\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n printf(\"%c\",s[1]);\n }\n else {\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n }\n\n\n else if ((strlen(s)%2==0) && (abs(z)!=n) ){\n printf(\"2\\n\");\n printf(\"%s \",s1);\n for(int i =k; i<strlen(s); i++){\n printf(\"%c\",s[i]);\n }\n }\n else{\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100];\n\tchar sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1=s1)\n\t{\n\t \n\t sh[1] = ch[n-1];\n\t ch[n-1]='\\0';\n\t printf (\"2\\n%s\",ch);\n\t printf (\"%c\",sh);\n}\n else \n printf(\"1\\n%s\",ch);\n\treturn 0;\n\n} \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n\tint ia = *(int *) a;\n\tint ib = *(int *) b;\n\n\treturn ia - ib;\n}\n\nint main() {\n\tstatic char s[128];\n\tint n, i, cnt;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcnt += (s[i] - '0');\n\tif (cnt != n - cnt) {\n\t\tprintf(\"1\\n%s\", s);\n\t} else {\n\t\tqsort(s, n, sizeof *s, compare);\n\t\tprintf(\"2\\n\");\n\t\tfor (i = 0; i < n / 2; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t\tprintf(\" \");\n\t\tfor (i = n / 2; i < n; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100],sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]=='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1!=s2) {\n\t\tprintf(\"%d\",1);\n\t\tprintf(\"%s\",ch);\n }\n\telse {\n\t\tfor (i=0;i<n-1;i++) {\n\t\t\tsh[i]=ch[i];\n\t\t}\n\t\tsh[n]='\\0';\n\t\tprintf(\"%d\\n\",2);\n\t\tprintf(\"%s %c\",sh,ch[n-1]);\n\t}\n\treturn 0;\n} "}, {"source_code": "int main(int argc, char *argv[]) {\n\tint a0,a1,n;\n\tchar s[200];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",&s);\n\ta0=0;\n\ta1=0;\n\tint i;\n\tfor(i=0;i<n;i++){\n\t\tif(s[i]=='0') a0++;\n\t\telse a1++;\n\t}\n\tif(a0==a1){\n\t\tprintf(\"2\\n%c \",s[n-1]);\n\t\ts[n-1]='\\0';\n\t\tprintf(\"%s\",s);\n\t}\n\telse printf(\"1\\n%s\",s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n-1;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c!=n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, c1=0, c0=0;\n scanf(\"%d\", &n);\n char s[n];\n scanf(\"%s\",s);\n for(int i=0; i<n; i++){\n if(s[i]=='1')c1++;\n else c0++;\n }\n if(n%2==0){\n if(c1==c0)\n { \n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++)printf(\"%c\", s[i]);\n }\n }\n else {\n printf(\"1\\n\");\n printf(\"%s\", s); \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint len,i,one=0,zero=0;\n\tchar* str;\n\tchar last,a;\n\n\tscanf(\"%d\",&len);\n\t\n\tstr=(char *)malloc(sizeof(char)*len);\n\tscanf(\"%c\",&a);\n\n\tgets(str);\n\t\n\tfor (i = 0; i < len; ++i)\n\t{\n\t\tif(str[i]=='1')\n\t\t\tone++;\n\t\telse\n\t\t\tzero++;\n\t}\n\n\tif(one!=zero)\n\t{\n\t\tprintf(\"1\\n%s\",str);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tfor (i = 1; i < len; ++i)\n\t\t{\n\t\t\tlast=str[len-i];\n\t\t\tstr[len-i]=(char)32;\n\t\t\tprintf(\"2\\n%s%c\",str,last);\n\t\t}\n\t\t\t\n\t}\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"%s\", arr);\n }\n else\n {\n printf (\"%c %s\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,n,cnt1=0,cnt2=0;\n char s[101];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1 && s[0]=='0')\n {\n printf(\"1\\n0\");\n }\n else if(n==1 && s[0]=='1')\n {\n printf(\"1\\n1\");\n }\n else\n {\n for(int i=0; i<n; i++)\n {\n if(s[i]=='0')\n {\n cnt1++;\n }\n else if(s[i]=='1')\n {\n cnt2++;\n }\n }\n printf(\"2\\n\");\n while(cnt1--)\n {\n printf(\"0\");\n }\n printf(\" \");\n while(cnt2--)\n {\n printf(\"1\");\n }\n printf(\" \");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[1000000];\nscanf(\"%lld%s\",&n,a);\ncount=0;\nfor(i=0;i<n;i++){\n if(a[i]=='1' || i==n-1){\n count++;\n \n }\n}\nprintf(\"%lld\\n\",count);\nfor(i=0;i<n;i++){\n if(a[i]=='1'){\n \n printf(\"%c \",a[i]);\n }else{\n printf(\"%c\",a[i]);\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar ara[n];\n\tscanf(\"%s\",ara);\n\tint x=strlen(ara),one=0,zero=0;\n\tif (x%2==1){\n printf(\"1\\n%s\\n\",ara);\n\t}\n\telse {\n for (int j =0; j<n; j++){\n if (ara[j]=='1')\n one++;\n else\n zero++;\n }\n if (one==zero){\n printf(\"2\\n\");\n for(int i=0; i<n; i++){\n if (i==n/2)\n printf(\" \");\n printf(\"%c\",ara[i]);\n }\n printf(\"\\n\");\n }\n else{\n printf(\"1\\n%s\\n\",ara);\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,eq=0,i=0;\n char s[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n eq+=1;\n else\n eq-=1; \n }\n if(eq==0)\n {\n char c=s[n-1];\n s[n-1]='\\0';\n printf(\"2\\n%c %s\",c,s); \n }\n else\n {\n printf(\"1\\n%s\",s);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n>1){\n printf(\"2\\n\");\n for(i=0;i<n/2;i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n for(i=n-n/2;i<n;i++)\n printf(\"%c\",s[i]);\n }\n else\n {\n printf(\"1\\n%s\",s);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j=0,n,k;\n char s[102];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1)\n {\n printf(\"%d\\n\",1);\n printf(\"%s\",s);\n }\n else\n {\n \n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n j=j+1;\n \n }\n if(j==n-j)\n { \n printf(\"%d\\n\",1);\n printf(\"%s\",s);\n \n \n }\n else\n {\n printf(\"%d\\n\",2);\n printf(\"%c \",s[0]);\n for(i=1;i<strlen(s);i++)\n {\n printf(\"%c\",s[i]);\n }\n \n \n }\n \n }\n \n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,c=0,d=0,i;\n scanf(\"%d \",&a);\n char b[a];\n gets(b);\n b[a]='\\0';\n for(i=0;i<a;i++)\n {\n if(b[i]=='0')\n {\n c++;\n }\n else\n {\n d++;\n }\n }\n if(c!=d || c==0 || d==0)\n {\n printf(\"1\\n\");\n puts(b);\n return 0;\n }\n else\n {\n printf(\"2\\n\");\n while(c>0)\n {\n printf(\"0\");\n c--;\n }\n printf(\"\\n\");\n while(d>0)\n {\n printf(\"1\");\n d--;\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, pos, c1=0, c0=0, flag=0;\n scanf(\"%d\", &n);\n char s[n];\n scanf(\"%s\", s);\n if(n%2==0) \n {\n for(int i=0; i<n; i++){if(s[i]==1)c1++; else c0++;}\n if(c1!=c0){\n printf(\"1\\n\");printf(\"%s\",s );\n }\n else {\n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++) printf(\"%c\",s[i]);\n }\n }\n \n else \n { \n for(int i=0; i<n; i++)\n {\n if(s[i]==s[i+1] && (i+1)%2!=0 ) {pos=i; flag=1;}\n \n }\n \n if(flag==1){\n printf(\"2\\n\");\n for(int i=0; i<=pos+1; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for(int i=pos+2; i<n; i++) printf(\"%c\",s[i]); \n }\n else {printf(\"1\\n\");printf(\"%s\",s ); }\n \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n, i, j, sum, zero, one;\n\n scanf(\"%d\", &n);\n\n char name[n];\n\n scanf(\" %s\", name);\n\n\n\n if(n%2 == 1)\n {\n\n printf(\"1\\n%s\\n\", name);\n }\n else\n {\n\n sum = n/2;\n\n\n for(i=1; i<=sum; i++){\n\n printf(\"1\");\n }\n\n printf(\" \");\n\n for(i=1; i<=sum; i++){\n\n printf(\"0\");\n }\n\n printf(\"\\n\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "int main()\n{\n char ch[100];\n char m;\n int n,i,one,zero;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n for (i=0;i<n;i++)\n { \n if(ch[i]=='0') \n zero+=1 ; \n else \n one+=1;\n } \n if (one==zero)\n {\n m=ch[n-1];\n ch[n-1]='\\0';\n printf(\"2\\n%s\" ,ch);\n printf(\"%c\",m);\n }\n else\n printf(\"1\\n%s0\",ch);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n>1){\n printf(\"2\\n\");\n for(i=0;i<n/2;i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n for(i=n-n/2;i<n;i++)\n printf(\"%c\",s[i]);\n }\n else\n {\n printf(\"1\\n%s\",s);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n\tint ia = *(int *) a;\n\tint ib = *(int *) b;\n\n\treturn ia - ib;\n}\n\nint main() {\n\tstatic char s[128];\n\tint n, i, cnt1, cnt2;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt1 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcnt1 += (s[i] - '0');\n\tcnt2 = 0;\n\tfor (i = 0; i < n; i++)\n\t\tcnt2 += !(s[i] - '0');\n\tif (cnt1 != cnt2) {\n\t\tprintf(\"1\\n%s\", s);\n\t} else {\n\t\tprintf(\"2\\n\");\n\t\tfor (i = 0; i < n / 2 && cnt1-- > 0; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t\tprintf(\" \");\n\t\tfor (i = n / 2; i < n && cnt2-- > 0; i++)\n\t\t\tprintf(\"%c\", s[i]);\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n printf(\"2\\n\");\n for(i=0;i<n/2;i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n for(i=n/2;i<n;i++)\n printf(\"%c\",s[i]);\n}\n"}, {"source_code": "int main()\n{\n char ch[100];\n char m;\n int n,i,one,zero;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n for (i=0;i<n;i++)\n { \n if(ch[i]=='0') \n zero+=1 ; \n else \n one+=1;\n } \n if (one==zero)\n {\n m=ch[n-1];\n ch[n-1]='\\0';\n printf(\"2\\n%s\" ,ch);\n printf(\"%c\",m);\n }\n else\n printf(\"1\\n%s0\",ch);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char const *argv[]) {\n int n, num1 = 0, num0 = 0, end;\n char s[105];\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n for (int i = 0; i < n; i++) {\n if (s[i]=='1') num1 ++;\n else num0 ++;\n end = i;\n if (num1 == num0 && i == n-1) {\n end = i - 1;\n }\n }\n if (num1 == num0) printf(\"2\\n\");\n else printf(\"1\\n\");\n for (int i = 0; i <= end; i++) {\n printf(\"%c\", s[i]);\n }\n if (num1 == num0) printf(\" \");\n for (int i = end+1; i <= n; i++) {\n printf(\"%c\", s[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main() {\n char n[1000];\n long long s,k,l=0;\n scanf(\"%lld\",&s);\n scanf(\"%s\",&n);\n k=strlen(n);\n if (k%2==1)\n printf(\"1\\n%s\",n);\n else {\n for (int i=0;i<s;i++){\n if (n[i]==0)\n k++;\n }\n if (k!=(s/2))\n printf(\"1\\n%s\",n);\n else {\n printf(\"2\\n%c \",n[0]);\n for (int i=1;i<s;i++){\n printf(\"%c\",n[i]);\n }\n }\n }\n \n\n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n==1)\n printf(\"1\\n\");\n else\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n\n for(i=1;i<n;i++){\n printf(\"%c\",s[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==1) one++;\n else zero++;\n }\n if(n==1)\n {\n printf(\"1\\n\");\n printf(\"%d\",arr[0]);\n }\n else if(one!=zero)\n {\n printf(\"1\\n\");\n for(i=0;i<n;i++)\n printf(\"%d\",arr[i]);\n }\n else if(one==zero)\n {\n printf(\"2\\n\");\n for(i=0;i<n-1;i++) \n printf(\"%d\",arr[i]);\n printf(\" %d\",arr[n-1]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,c,i,j,k;\nscanf(\"%d\",&n);\nchar a[n];\nc=0;\nb=0;\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\nif(a[i]=='1')\nc++;\nelse if(a[i]=='0')\nb++;\n}\nchar m[c+1],p[b+1];\nfor(i=0;i<c;i++)\n{\nm[i]='1';\n}\nm[c]='\\0';\nfor(i=0;i<b;i++)\n{\np[i]='0';\n}\np[b]='\\0';\nif(c!=b)\n{\nprintf(\"%d\\n\",1);\nprintf(\"%s\",a);\n}\nelse\n{\nprintf(\"%d\\n\",2);\nprintf(\"%s %s\",m,p);\n\n}\nreturn 0;\n\n}\n"}, {"source_code": "int main()\n{\n char ch[100];\n char m;\n int n,i,one,zero;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n for (i=0;i<n;i++)\n { \n if(ch[i]=='0') \n zero+=1 ; \n else \n one+=1;\n } \n if (one==zero)\n {\n m=ch[n-1];\n ch[n-1]='\\0';\n printf(\"2\\n%s\" ,ch);\n printf(\"%c\",m);\n }\n else\n printf(\"1\\n%s0\",ch);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n int k;\n char tmp[100];\n char s[100]=\"\";\n char s1[100]=\"\";\n\n scanf(\"%i\\n\", &n);\n gets(s);\n int z=0;\n\n for(int i=0; i<n;i++){\n if (s[i] != '0') z++;\n if (s[i] != '1') z--;\n }\n\n\n for(int i=0; i<strlen(s);i++){\n if (((s[i]=='0') && (s[++i]=='0')) || ((s[i]=='1') && (s[i+1]=='1'))){\n strncpy(s1,s,i+1);\n k=i+1;\n break;\n }\n }\n\n if (n == 2){\n if (s[0]!=s[1]){\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n printf(\"%c\",s[1]);\n }\n else {\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n }\n\n\n else if ((strlen(s)%2==0) && (abs(z)!=n) ){\n printf(\"2\\n\");\n printf(\"%s \",s1);\n for(int i =k; i<strlen(s); i++){\n printf(\"%c\",s[i]);\n }\n }\n else{\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main() {\n char n[1000];\n long long s,k,l=0;\n scanf(\"%lld\",&s);\n scanf(\"%s\",&n);\n k=strlen(n);\n if (k%2==1)\n printf(\"1\\n%s\",n);\n else {\n for (int i=0;i<s;i++){\n if (n[i]==0)\n k++;\n }\n if (k!=(s/2))\n printf(\"1\\n%s\",n);\n else {\n printf(\"2\\n%c \",n[0]);\n for (int i=1;i<s;i++){\n printf(\"%c\",n[i]);\n }\n }\n }\n \n\n return (EXIT_SUCCESS);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n char s[105];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n==1)\n {\n printf(\"1\\n%c\\n\",s[0]);\n }\n else\n {\n printf(\"2\\n\");\n for(i=0 ; i<n/2 ; i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n for(i=i ; i<n ; i++)\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n==1)\n {\n printf(\"1\\n%s\",s);\n }\n else if(n%2==0)\n {\n printf(\"2\\n\");\n for(i=0;i<n/2;i++)\n printf(\"%c\",s[i]);\n printf(\" \");\n for(i=n/2;i<n;i++)\n printf(\"%c\",s[i]);\n }\n else\n {\n printf(\"3\\n\");\n printf(\"%c %c \",s[0],s[1]);\n for(i=2;i<=n;i++)\n printf(\"%c\",s[i]);\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n int k;\n char tmp[100];\n char s[100]=\"\";\n char s1[100]=\"\";\n\n scanf(\"%i\\n\", &n);\n gets(s);\n\n for(int i=0; i<strlen(s);i++){\n if (((s[i]=='0') && (s[++i]=='0')) || ((s[i]=='1') && (s[i+1]=='1'))){\n strncpy(s1,s,i+1);\n k=i+1;\n break;\n }\n }\n\n if (n == 2){\n if (s[0]!=s[1]){\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n printf(\"%c\",s[1]);\n }\n else {\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n }\n else if (strlen(s)%2==0){\n printf(\"2\\n\");\n printf(\"%s \",s1);\n for(int i =k; i<strlen(s); i++){\n printf(\"%c\",s[i]);\n }\n }\n else{\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\ncount=count1=0;\nfor(i=0;i<n;i++){\n if(a[i]=='0'){\n count++;\n }else{\n count1++;\n }\n}\nif(count==count1){\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",a[i]);\n }\n printf(\" %c\",a[n-1]);\n}else{\n printf(\"%s\",a);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,eq=0,i=0;\n char s[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n eq+=1;\n else\n eq-=1; \n }\n if(eq==0)\n {\n char c=s[n-1];\n s[n-1]='\\0';\n printf(\"2\\n%c %s\",c,s); \n }\n else\n {\n printf(\"1\\n%s\",s);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100],sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]=='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1!=s2) {\n\t\tprintf(\"%d\\n\",1);\n\t\tprintf(\"%s\",ch);\n }\n\telse {\n\t\tfor (i=0;i<n-1;i++) {\n\t\t\tsh[i]=ch[i];\n\t\t}\n\t\tsh[n]='\\0';\n\t\tprintf(\"%d\\n\",2);\n\t\tprintf(\"%s %c\",sh,ch[n-1]);\n\t}\n\treturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100];\n\tchar sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1=s1)\n\t{\n\t \n\t sh[1] = ch[n-1];\n\t ch[n-1]='\\0';\n\t printf (\"2\\n%s\",ch);\n\t printf (\"%c\",sh);\n}\n else \n printf(\"1\\n%s\",ch);\n\treturn 0;\n\n} \n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar ara[n];\n\tscanf(\"%s\",ara);\n\tint x=strlen(ara),one=0,zero=0;\n\tif (x%2==1){\n printf(\"1\\n%s\\n\",ara);\n\t}\n\telse {\n for (int j =0; j<n; j++){\n if (ara[j]=='1')\n one++;\n else\n zero++;\n }\n if (one==zero){\n printf(\"2\\n\");\n for(int i=0; i<n; i++){\n if (i==n/2)\n printf(\" \");\n printf(\"%c\",ara[i]);\n }\n printf(\"\\n\");\n }\n else{\n printf(\"1\\n%s\\n\",ara);\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n int n,i,j,k,ct=0,ck=0;\n char a[10000];\n scanf(\"%d %s\",&n,&a);\n for(i=0;i<n;i++){\n if(a[i]%2==0){\n ct++;\n }\n else{\n ck++;\n }\n }\n if(ck==0||ct==0){\n printf(\"1\\n\");\n printf(\"%s\",a);\n }\n else if(n%2==0){\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",a[i]);\n }\n printf(\" %c\", a[n-1]);\n }\n else{\n printf(\"1\\n\");\n printf(\"%s\",a);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t/*#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif*/\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"%s\\n\", arr);\n }\n else\n {\n printf (\"%c %s\\n\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar ara[n];\n\tscanf(\"%s\",ara);\n\tint x=strlen(ara),one=0,zero=0;\n\tif (x%2==1){\n printf(\"1\\n%s\\n\",ara);\n\t}\n\telse {\n for (int j =0; j<n; j++){\n if (ara[j]=='1')\n one++;\n else\n zero++;\n }\n if (one==zero){\n printf(\"2\\n\");\n for(int i=0; i<n; i++){\n if (i==((n/2)-1))\n printf(\" \");\n printf(\"%c\",ara[i]);\n }\n printf(\"\\n\");\n }\n else{\n printf(\"1\\n%s\\n\",ara);\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\ncount=count1=0;\nfor(i=0;i<n;i++){\n if(a[i]=='0'){\n count++;\n }else{\n count1++;\n }\n}\nif(count==count1){\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",a[i]);\n }\n printf(\" %c\",a[n-1]);\n}else{\n printf(\"%s\",a);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stddef.h>\n\n\nint main(void) {\n \n int c;\n ptrdiff_t n;\n\n register ptrdiff_t i = 0;\n register int c0 = 0;\n\n while ((c = getchar()) && c != 10)\n n = n * 10 + c - 48;\n\n char* s = malloc(n * sizeof(char));\n\n while (i < n) {\n if (c == 48)\n c0 += 1;\n s[i++] = getchar();\n }\n\n if (n - c0 != c0) {\n putchar(50);\n putchar(10);\n putchar(*s);\n putchar(32);\n for (i = 1; i < n; i += 1) {\n putchar(*(s + i));\n }\n } else {\n putchar(49);\n putchar(10);\n for (i = 0; i < n; i += 1) {\n putchar(*(s + i));\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint q=0;\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar str[n+1];\n\tscanf(\"%s\", str);\n\tint no1 = 0, no0=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\tno1++;\n\t\telse\n\t\t\tno0++;\n\t\tq++;\n\t}\n\tq=0;\n\tint a=0, b=0;\n\tint fin=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\ta++;\n\t\telse\n\t\t\tb++;\n\t\tif(a!=b){\n\t\t\tint rem1 = no1-a;\n\t\t\tint rem0 = no0 -b;\n\t\t\tif(rem1!=rem0){\n\t\t\t\tfin=q;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tq++;\n\t}\n\tif(n==1)\n\tprintf(\"1\\n\");\n\telse\n\t\tprintf(\"2\\n\");\n\tfor(int i=0;i<=fin;i++)\n\t\t\tprintf(\"%c \", str[i]);\n\tfor(int i=fin+1;i<n;i++)\n\t\t\tprintf(\"%c\", str[i]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[1000000];\nscanf(\"%lld%s\",&n,a);\nprintf(\"%lld\",n);\nfor(i=0;i<n;i++){\n printf(\"%c \",a[i]);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i<n;i++){\n\t\tif (a[i]=='0') cnt++;\n\t\telse cnt1++;\n\t}\n\tif (cnt1==cnt) return 0;\n\treturn 1;\n}\nvoid in(char a[],int k,int n){\n\tfor (int i=k;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\n\tif (n==1){\n\t\tprintf(\"1\\n%d\",a[0]);\n\t\treturn 0;\n\t}\n\telse if(n==2){\n\t\tprintf(\"2\\n%d %d\",a[0],a[1]);\n\t\treturn 0;\n\t}\n\telse {\n\t\tprintf(\"2\\n\");\n\tfor (int i=1;i<n-1;i++){\n\t\tif (kt(a,0,i) && kt(a,i,n)) {\n\t\t\tin(a,0,i);\n\t\t\tprintf(\" \");\n\t\t\tin(a,i,n);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int a=0,b=0;\n for(i=0;i<n;i++)\n {\n if(s[i]=='0')\n {\n a++;\n }\n else if(s[i]=='1')\n {\n b++;\n }\n }\n if(n==1)\n {\n printf(\"1\\n%c\",s[0]);\n }\n else\n {\n printf(\"2\\n\");\n for(i=0;i<a;i++)\n {\n printf(\"0\");\n }\n printf(\" \");\n for(j=0;j<b;j++)\n {\n printf(\"1\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100];\n\tchar sh[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]='0') \n\t\t s1+=1;\n\t\telse\n\t\t s2+=1;\n\t}\n\tif (s1=s1)\n\t{\n\t \n\t sh[1] = ch[n-1];\n\t ch[n-1]='\\0';\n\t printf (\"2\\n%s\",ch);\n\t printf (\"%c\",sh);\n}\n else \n printf(\"1\\n%s\",ch);\n\treturn 0;\n\n} \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(void)\n{\n\tint n,str,str_ch,check,zero,one;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&str);\n\tif(n%2==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\tprintf(\"%d\\n\",str);\n\t}\n\telse\n\t{\n\t\tzero=one=0;\n\t\tstr_ch=str;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tcheck=str_ch%10;\n\t\t\tstr_ch/=10;\n\t\t\tif (check==0)zero++;\n\t\t\telse one++;\n\t\t}\n\t\tif(one==zero)\n\t\t{\n\t\t\tprintf(\"2\\n%d %d\",str/10,str%10);\n\t\t}\n\t\telse printf(\"1\\n%d\",str);\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],p=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%1d\",&a[i]);\n if(a[i]==1)\n {\n p++;\n }\n }\n if(n%2!=0)\n {\n printf(\"%d\\n\",n);\n for(int i=0;i<n;i++)\n {\n printf(\"%d\",a[i]);\n }\n\n }\n else if(n%2==0&&n%4!=0)\n {\n if(p!=(n/2))\n {\n printf(\"%d\\n\",1);\n for(int i=0;i<n;i++)\n {\n printf(\"%d\",a[i]);\n }\n }\n else\n {\n printf(\"%d\\n\",2);\n for(int i=0;i<(n/2);i++)\n {\n printf(\"%d\",a[i]);\n }\n printf(\"\\t\");\n for(int i=(n/2);i<n;i++)\n {\n printf(\"%d\",a[i]);\n }\n }\n\n }\n else if(n%4==0)\n {\n if(p!=(n/2))\n {\n for(int i=0;i<n;i++)\n {\n printf(\"%d\",a[i]);\n }\n }\n else{\n printf(\"%d\\n\",2);\n for(int i=0;i<n-1;i++)\n {\n printf(\"%d\",a[i]);\n }\n printf(\"\\t\");\n printf(\"%d\",a[n-1]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n int n,ones=0,zeros=0;\n scanf(\"%d\",&n);\n char a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\" %c\",&a[i]);\n if(a[i]=='1')\n ones++;\n else\n zeros++;\n // printf(\"%c\\n\",a[i]);\n }\n if(ones==zeros)\n {\n if(n>=2)\n {\n \n for(int i=0;i<2;i++)\n {\n printf(\"%c\",a[i]); \n }\n printf(\" \");\n for(int i=2;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n \n }\n else\n {\n for(int i=0;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n }\n else\n {\n for(int i=0;i<n;i++)\n {\n printf(\"%c\",a[i]);\n }\n }\n \n}\n\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a2,b2;\nchar a[1000000];\nscanf(\"%lld%s\",&n,a);\ncount=0;\nfor(i=0;i<n;i++){\n if(a[i]=='1' || i==n-1){\n count++;\n \n }\n}\nprintf(\"%lld\\n\",count);\nfor(i=0;i<n;i++){\n if(a[i]=='1'){\n \n printf(\"%c \",a[i]);\n }else{\n printf(\"%c\",a[i]);\n }\n}\nreturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,j,zero=0,one=0;\n char c;\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n scanf(\"%c\",&c);\n char crr[n];\n int arr[n];\n int brr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%c\",&crr[i]);\n if(crr[i]=='1')one++;\n if(crr[i]=='0')zero++;\n arr[i]=one;\n brr[i]=zero;\n }\n if(one==zero)\n {\n for(i=0;i<n;i++)\n {\n if(arr[i]!=brr[i])\n {\n if((one-arr[i])!=(zero-brr[i]))break;\n }\n }\n if(n!=1)printf(\"2\\n\");\n else printf(\"1\\n\");\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n if(j==i && n!=1)printf(\" \");\n }\n }\n else\n {\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n }\n }\n }"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 1000002\n\n#ifndef ONLINE_JUDGE\n#define DEBUG\n#endif\n\n#define MIN(a,b) (((a)<(b))?(a):(b))\n\nchar arr[101];\n\nint main(void)\n{\n int N;\n int i;\n int ones,zeroes;\n\t#ifndef ONLINE_JUDGE\n\tFILE * fp;\n\tfp = freopen(\"F:\\\\work\\\\trials\\\\codeforces\\\\1189\\\\A\\\\1189A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"\\n Cannot open File\");\n exit (1);\n }\n\t#endif\n\n scanf(\"%d\",&N);\n\n scanf(\"%s\",arr);\n\n ones = 0;\n zeroes = 0;\n for (i=0; i<N; i++)\n {\n if (arr[i] == '0')\n {\n zeroes++;\n }\n else\n {\n ones++;\n }\n }\n\n if (ones != zeroes)\n {\n //good\n printf (\"%s\\n\", arr);\n }\n else\n {\n printf (\"%c %s\\n\",arr[0],arr+1);\n }\n\n return (0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,l;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n if(n%2!=0)\n {\n printf(\"1\\n\");\n printf(\"%s\",a);\n }\n else\n {\n printf(\"2\\n\");\n for(int i=0;i<strlen(a)-1;i++)\n printf(\"%c\",a[i]);\n printf(\" %c\",a[strlen(a)-1]);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() \n{ \n int n,i=0,a=0,b=0;\n char s[1000];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='1')\n {\n a++;\n }\n else\n {\n b++;\n }\n }\n \n if(a!=b)\n {\n for(i=0;i<n;i++)\n {\n printf(\"%c\",s[i]);\n }\n }\n else\n {\n printf(\"%c\\t\",s[0]);\n for(i=1;i<n;i++)\n {\n printf(\"%c\",s[i]);\n }\n }\n \n return 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\nlong long int n = 0, z = 0, d = 0, a = 1, m = 1, v = 0, c = 0, b = 0;\nscanf(\"%I64d\", &n);\nchar X[n];\nscanf(\"%s\", X);\nwhile(c<n){if(X[c] == '1'){v = v + 1;}if(X[c] == '0'){b = b + 1;}c = c + 1;}\nif(v != b){printf(\"1\\n\");printf(\"%s\", X);}\nif(v == b){printf(\"2\\n\");if(X[c] == '1'){a = 1;}if(X[c] == '0'){a = 0;}\nprintf(\"%d \", a);\nc = 1;\na = 0;\nwhile(c < n){if(X[c] == '1'){a = 1;}if(X[c] == '0'){a = 0;}printf(\"%d\", a);c = c + 1;}}\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main () \n{ \n\tint n,p,q;\n\tscanf(\"%d\",&n);\n char str[n+1];\n int i,j,k;\n\tscanf(\"%s\",str);\n for(i=0;i<n;i++)\n {\n \tif(str[i]=='1')\n \t{\n \t\tp++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tq++;\n\t\t}\n\t}\n if(p==q)\n {\n \tprintf(\"2\\n\");\n \tfor(i=0;i<n-1;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t\tprintf(\" %c\",str[n-1]);\n\t}\n\telse\n\t{\n\t\tprintf(\"1\\n\");\n \tfor(i=0;i<n;i++)\n \t{\n \t\tprintf(\"%c\",str[i]);\n\t\t}\n\t}\n return 0; \n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,a,b,k,l,cnt=0,cmt=0;\n char s[101];\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n if(n%2==1) {\n printf(\"1\\n\");\n\n printf(\"%s\\n\",s);\n }\n else {\n for(k=0;k<n/2;k++)\n {\n if(s[k]=='0') cnt++;\n else cmt++;\n }\n if(cnt!=cmt) {\n printf(\"1\\n\");\n printf(\"%s\\n\",s);\n }\n else {\n printf(\"2\\n\");\n for(j=0;j<(n-1);j++)\n printf(\"%c\",s[j]);\n printf(\" \");\n printf(\"%c\",s[n-1]);\n printf(\"\\n\");\n }\n\n\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n;\n int k;\n char tmp[100];\n char s[100]=\"\";\n char s1[100]=\"\";\n\n scanf(\"%i\\n\", &n);\n gets(s);\n int z=0;\n\n for(int i=0; i<n;i++){\n if (s[i] != '0') z++;\n if (s[i] != '1') z--;\n }\n\n\n for(int i=0; i<strlen(s);i++){\n if (((s[i]=='0') && (s[++i]=='0')) || ((s[i]=='1') && (s[i+1]=='1'))){\n strncpy(s1,s,i+1);\n k=i+1;\n break;\n }\n }\n\n if (n == 2){\n if (s[0]!=s[1]){\n printf(\"2\\n\");\n printf(\"%c \",s[0]);\n printf(\"%c\",s[1]);\n }\n else {\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n }\n\n\n else if ((strlen(s)%2==0) && (abs(z)!=n) ){\n printf(\"2\\n\");\n printf(\"%s \",s1);\n for(int i =k; i<strlen(s); i++){\n printf(\"%c\",s[i]);\n }\n }\n else{\n printf(\"1\\n\");\n printf(\"%s \",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n, i, j, sum, zero, one;\n\n scanf(\"%d\", &n);\n\n char name[n];\n\n scanf(\" %s\", name);\n\n\n\n if(n%2 == 1)\n {\n\n printf(\"1\\n%s\\n\", name);\n }\n else\n {\n\n sum = n/2;\n\n\n for(i=1; i<=sum; i++){\n\n printf(\"1\");\n }\n\n printf(\" \");\n\n for(i=1; i<=sum; i++){\n\n printf(\"0\");\n }\n\n printf(\"\\n\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint kt(char a[],int k,int n){\n\tint cnt=0,cnt1=0;\n\tfor(int i=k;i<n;i++){\n\t\tif (a[i]=='0') cnt++;\n\t\telse cnt1++;\n\t}\n\tif (cnt1==cnt) return 0;\n\treturn 1;\n}\nvoid in(char a[],int k,int n){\n\tfor (int i=k;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n}\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\tprintf(\"2\\n\");\n\tif (strlen(a)==1){\n\t\tprintf(\"1\\n%d\",a[0]);\n\t}\n\telse if(strlen(a)==2){\n\t\tprintf(\"2\\n%d %d\",a[0],a[1]);\n\t}\n\telse {\n\tfor (int i=1;i<n-1;i++){\n\t\tif (kt(a,0,i) && kt(a,i,n)) {\n\t\t\tin(a,0,i);\n\t\t\tprintf(\" \");\n\t\t\tin(a,i,n);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n-1;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c==n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint q=0;\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar str[n+1];\n\tscanf(\"%s\", str);\n\tint no1 = 0, no0=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\tno1++;\n\t\telse\n\t\t\tno0++;\n\t\tq++;\n\t}\n\tq=0;\n\tint a=0, b=0;\n\tint fin=0;\n\twhile(str[q]!='\\0'){\n\t\tif(str[q]=='1')\n\t\t\ta++;\n\t\telse\n\t\t\tb++;\n\t\tif(a!=b){\n\t\t\tint rem1 = no1-a;\n\t\t\tint rem0 = no0 -b;\n\t\t\tif(rem1!=rem0){\n\t\t\t\tfin=q;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tq++;\n\t}\n\tif(n==1)\n\tprintf(\"1\\n\");\n\telse\n\t\tprintf(\"2\\n\");\n\tfor(int i=0;i<=fin;i++)\n\t\t\tprintf(\"%c \", str[i]);\n\tfor(int i=fin+1;i<n;i++)\n\t\t\tprintf(\"%c\", str[i]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n-1;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c==n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n/*kneau reeves*/\nint main() {\n\tint n,s1=0,s2=0,i;\n\tchar ch[100];\n\tchar sh;\n scanf(\"%d\",&n);\n scanf(\"%s\",ch);\n\tfor (i=0;i<n;i++) {\n\t\tif (ch[i]=='0') s1++ ;\n\t\t \n\t\telse\n\t\t s2++;\n\t}\n\tif (s1==s2)\n\t{\n\t\n\t \n\t sh = ch[n-1];\n\t ch[n-1]='\\0';\n\t printf (\"2\\n%s\",ch);\n\t printf (\"%c\",sh);\n}\n else \n printf(\"1\\n%s\",ch);\n\treturn 0;\n\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k = 0,i,j,c = 0;\n char s[101],a[10] = \"\",b[101] = \"\";\n scanf(\"%d\",&n);\n getchar();\n scanf(\"%s\",&s);\n a[0] = s[n-1];\n for(i =0; i < n-1; i++)\n {\n b[i] = s[i];\n }\n for(i = 0; i < n; i++)\n {\n if(s[i] == '0')\n {\n c++;\n }\n else\n {\n k++;\n }\n }\n if(c != k)\n {\n printf(\"1\\n\");\n printf(\"%s\",s);\n }\n else\n {\n printf(\"2\\n\");\n printf(\"%s %s\",a,b);\n // puts(a);\n //uts(b);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,i,c=0,d=0;\n scanf(\"%d\",&x);\n char n[x+1];\n scanf(\"%s\",n);\n for(i=0;i<x;i++)\n {\n if(n[i]=='0') c++;\n else d++;\n }\n if(c==d)\n {\n for(i=0;i<x-1;i++)\n printf(\"%c\",n[i]);\n printf(\"\\n%c\",n[x-1]);\n }\n else printf(\"%s\",n);\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,j,zero=0,one=0;\n char c;\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n scanf(\"%c\",&c);\n char crr[n];\n int arr[n];\n int brr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%c\",&crr[i]);\n if(crr[i]=='1')one++;\n if(crr[i]=='0')zero++;\n arr[i]=one;\n brr[i]=zero;\n }\n if(one==zero)\n {\n for(i=0;i<n;i++)\n {\n if(arr[i]!=brr[i])\n {\n if((one-arr[i])!=(zero-brr[i]))break;\n }\n }\n if(n!=1)printf(\"2\\n\");\n else printf(\"1\\n\");\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n if(j==i && n!=1)printf(\" \");\n }\n }\n else\n {\n for(j=0;j<n;j++)\n {\n printf(\"%c\",crr[j]);\n }\n }\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, pos, x=0, y=0, flag=0;\n scanf(\"%d\", &n);\n char s[n];\n for(int i=0; i<n; i++)\n { scanf(\"%c\", &s[i]);if(s[i]=='1')x++;\n else if(s[i]=='0') y++;} \n if(n%2==0) \n {\n \n if(x!=y){\n printf(\"1\\n\");printf(\"%s\",s );\n }\n else {\n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++) printf(\"%c\",s[i]);\n }\n }\n \n else if(n>2 && n%2!=0)\n { \n for(int i=0; i<n; i++)\n {\n if(s[i]==s[i+1] && (i+1)%2!=0 ) {pos=i; flag=1;}\n \n }\n \n if(flag==1){\n printf(\"2\\n\");\n for(int i=0; i<=pos+1; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for(int i=pos+2; i<n; i++) printf(\"%c\",s[i]); \n }\n else {printf(\"1\\n\");printf(\"%s\",s ); }\n \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,j,n,k=0,zero=0,one=0;\n scanf(\"%d\",&n);\n char string[n+1];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n if(string[i]=='0')\n zero++;\n else\n one++;\n }\n if(one==0||zero==0)\n printf(\"%d\\n\",1);\n else\n printf(\"%d\\n\",2);\n for(i=0;i<one;i++)\n printf(\"1\");\n printf(\" \");\n for(i=0;i<zero;i++)\n printf(\"0\");\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n char l[n+1];\n scanf(\"%s\",l);\n for(i=0;i<n-1;i++){\n if(l[i]=='1')c++;\n }\n if(n%2==1 || c!=n/2)printf(\"1\\n%s\",l);\n else {\n printf(\"2\\n%c \",l[0]);\n for(i=1;i<n;i++)printf(\"%c\",l[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, pos, x=0, y=0, flag=0;\n scanf(\"%d\", &n);\n char s[n];\n for(int i=0; i<n; i++)\n { scanf(\"%c\", &s[i]);if(s[i]=='1')x++;\n else if(s[i]=='0') y++;} \n if(n%2==0) \n {\n \n if(x!=y){\n printf(\"1\\n\");printf(\"%s\",s );\n }\n else {\n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++) printf(\"%c\",s[i]);\n }\n }\n \n else \n { \n for(int i=0; i<n; i++)\n {\n if(s[i]==s[i+1] && (i+1)%2!=0 ) {pos=i; flag=1;}\n \n }\n \n if(flag==1){\n printf(\"2\\n\");\n for(int i=0; i<=pos+1; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for(int i=pos+2; i<n; i++) printf(\"%c\",s[i]); \n }\n else {printf(\"1\\n\");printf(\"%s\",s ); }\n \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int zero=0,one=0,i=0;\n //printf(\"INPUT:%d%d\",i,n);\n char string[100];\n scanf(\"%s\",string);\n while(i<n){\n //printf(\"%c cool\",string[i]);\n if(string[i]-'0'==0)\n zero++;\n else \n one++;\n i=i+1;\n }\n //printf(\"INPUT DONE\\n\\n\");\n if(zero!=one)\n {\n printf(\"1\\n\");\n printf(\"%s\",string);\n }\n else if((n/2)%2==0)\n {\n printf(\"2\\n\");\n printf(\"%c \",string[0]);\n int i=1;\n while(i<n)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n }\n else if((n/2)%2==1)\n {\n int i=0;\n printf(\"2\\n\");\n while(i<n/2)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n printf(\" \");\n while(i<=n)\n {\n printf(\"%c\",string[i]);\n i=i+1;\n }\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, pos, x=0, y=0, flag=0;\n scanf(\"%d\", &n);\n char s[n];\n scanf(\"%s\", s);\n for(int i=0; i<n; i++)\n { if(s[i]=='1')x++;\n else if(s[i]=='0') y++;} \n if(n%2==0) \n {\n \n if(x!=y){\n printf(\"1\\n\");printf(\"%s\",s );\n }\n else {\n printf(\"2\\n\");\n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++) printf(\"%c\",s[i]);\n }\n }\n else if(n==1){printf(\"1\\n\");printf(\"1\" ); }\n else \n { \n for(int i=0; i<n; i++)\n {\n if(s[i]==s[i+1] && (i+1)%2!=0 ) {pos=i; flag=1;}\n \n }\n \n if(flag==1){\n printf(\"2\\n\");\n for(int i=0; i<=pos+1; i++) printf(\"%c\", s[i]);\n printf(\" \");\n for(int i=pos+2; i<n; i++) printf(\"%c\",s[i]); \n }\n else {printf(\"1\\n\");printf(\"%s\",s ); }\n \n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n ,i, arr[100],zero=0,one=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==1) one++;\n else zero++;\n }\n if(n==1)\n {\n printf(\"1\\n\");\n printf(\"%d\",arr[0]);\n }\n else if(one!=zero)\n {\n printf(\"1\\n\");\n for(i=0;i<n;i++)\n printf(\"%d\",arr[i]);\n }\n else if(one==zero)\n {\n printf(\"2\\n\");\n for(i=0;i<n-1;i++) \n printf(\"%d\",arr[i]);\n printf(\" %d\",arr[n-1]);\n }\n return 0;\n}"}, {"source_code": "//practice with dukkha\n#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n char b[10000];\n scanf(\"%s\",b);\n if(a%2==1)\n {\n printf(\"1\\n%s\",b);\n return 0;\n }\n int count=0;\n for(int i=0;i<a;i++)\n count+=b[i]-'0';\n int sum=0;\n for(int i=0;i<a;i++)\n {\n sum+=b[i]-'0';\n int r=count-sum;\n int len=a-1-i;\n int zero=len-r;\n int curl=i+1;\n int cur0=curl-sum;\n if(r!=zero && cur0!=sum)\n {\n printf(\"2\\n\");\n for(int j=0;j<=i;j++)\n printf(\"%c\",b[j]);\n printf(\" \");\n for(int j=i+1;j<a;j++)\n printf(\"%c\",b[j]);\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n int n,i,j,k,ct=0,ck=0;\n char a[10000];\n scanf(\"%d %s\",&n,&a);\n for(i=0;i<n;i++){\n if(a[i]==0){\n ct++;\n }\n else{\n ck++;\n }\n }\n if(ck==0||ct==0){\n printf(\"1\\n\");\n printf(\"%s\",a);\n }\n else if(n%2==0){\n printf(\"2\\n\");\n for(i=0;i<n-1;i++){\n printf(\"%c\",a[i]);\n }\n printf(\" %c\", a[n-1]);\n }\n else{\n printf(\"1\\n\");\n printf(\"%s\",a);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tchar a[1000];\n\tgets(a);\n\tint dem0=0,dem1=0,tmp=-1;\n\tif(n==1)\n\tprintf(\"1\\n%s\",a);\n\telse if(n==2)\n\tprintf(\"2\\n%c %c\",a[0],a[1]);\n\telse{\n\t\tprintf(\"2\\n\");\n\t\tfor(int i=0;i<n/2;i++){\n\t\t\tif(a[i]=='1'){\n\t\t\ttmp++;\n\t\t\tdem1++;\n\t\t\t}\n\t\t\telse{\n\t\t\ttmp++;\n\t\t\tdem0++;\n\t\t}\n\t}\n\tif(dem1==dem0)\n\ttmp++;\n\tfor(int i=0;i<=tmp;i++){\n\t\tprintf(\"%c\",a[i]);\n\t}\n\tprintf(\" \");\n\tfor(int i=tmp+1;i<n;i++){\n\t\tprintf(\"%c\",a[i]);\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i=0,j,count=0,result=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='1')\n {\n count=count+1;\n }\n else\n {\n result=result+1;\n }\n i=i+1;\n }\n if(count!=result)\n {\n printf(\"1\\n\");\n printf(\"%s\",s);\n }\n else\n {\n printf(\"2\\n\");\n for(j=1;j<count;j=j+1)\n {\n printf(\"1\");\n }\n for(j=1;j<=count;j=j+1)\n {\n printf(\"0\");\n }\n printf(\" \");\n printf(\"1\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, c1=0, c0=0;\n scanf(\"%d\", &n);\n char s[n];\n scanf(\"%s\",s);\n for(int i=0; i<n; i++){\n if(s[i]=='1')c1++;\n else c0++;\n }\n if(n%2==0){\n if(c1==c0)\n { \n printf(\"%c \", s[0]); \n for(int i=1; i<n; i++)printf(\"%c\", s[i]);\n }\n }\n else {\n printf(\"1\\n\");\n for(int i=0; i<n; i++)printf(\"%c\", s[i]); \n }\n return 0;\n}\n"}], "src_uid": "4ebed264d40a449602a26ceef2e849d1"} {"nl": {"description": "InputThe only line of input contains three integers a1,\u2009a2,\u2009a3 (1\u2009\u2264\u2009a1,\u2009a2,\u2009a3\u2009\u2264\u200920), separated by spaces.OutputOutput a single integer.ExamplesInput2 3 2Output5Input13 14 1Output14Input14 5 9Output464Input17 18 3Output53", "input_spec": "The only line of input contains three integers a1,\u2009a2,\u2009a3 (1\u2009\u2264\u2009a1,\u2009a2,\u2009a3\u2009\u2264\u200920), separated by spaces.", "output_spec": "Output a single integer.", "sample_inputs": ["2 3 2", "13 14 1", "14 5 9", "17 18 3"], "sample_outputs": ["5", "14", "464", "53"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(){\n\tint fib[40],k,i;\n\tscanf(\"%d%d%d\",&fib[0],&fib[1],&k);\n\tif(k<2){ printf(\"%d\",fib[k]); return 0;}\n\tfor(i=2;1;i++){\n\t\tfib[i]=fib[i-1]+fib[i-2];\n\t\tif(i==k){\n\t\t\tprintf(\"%d\\n\",fib[k]);\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,arr[100],tot,i,j;\n for(i=0;i<3;i++)\n scanf(\"%d\",&arr[i]);\n c=arr[2];\n for(i=2;i<=c;i++)\n arr[i]=arr[i-1]+arr[i-2];\n printf(\"%d\\n\",arr[c]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,i;\n scanf(\"%d%d%d\",&a,&b,&n);\n if(n==0)\n printf(\"%d\\n\",a);\n else if(n==1)\n printf(\"%d\\n\",b);\n else\n {for(i=2;i<=n;i++)\n {\n c=a+b;\n a=b;\n b=c;\n }\n printf(\"%d\\n\",c);}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,i;\n scanf(\"%d%d%d\",&a,&b,&n);\n if(n==0)\n printf(\"%d\\n\",a);\n else if(n==1)\n printf(\"%d\\n\",b);\n else\n {for(i=2;i<=n;i++)\n {\n c=a+b;\n a=b;\n b=c;\n }\n printf(\"%d\\n\",c);}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX 100\nint main()\n{\n int cases,cnt;\n int i,n;\n int a[MAX];\n scanf(\"%d\",&a[0]);\n scanf(\"%d\",&a[1]);\n scanf(\"%d\",&n);\n for(i=2;i<=n;i++)\n a[i]=a[i-1]+a[i-2];\n printf(\"%d\\n\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define in scanf\n#define out printf\n\nint main() {\n int a0, a1, n, r;\n in(\"%d %d %d\", &a0, &a1, &n);\n\n if (n == 0) r = a0;\n else if (n == 1) r = a1;\n else while (--n) r = a0+a1, a0 = a1, a1 = r;\n \n out(\"%d\\n\", r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a,b,c,d,n;\nint main()\n{\n scanf(\"%d %d %d\",&a,&b,&c);\n for(d=0;d<c-1;d++){\n b+=a;\n a=b-a; \n }\n printf(\"%d\",b);\n scanf(\" \");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,s;\n scanf(\"%d%d%d\",&a,&b,&i);\n while(i>1)\n {\n s=a+b;\n a=b;\n b=s;\n i--;\n }\n printf(\"%d\",b);\n return 0;\n}\n \n \n"}, {"source_code": "#include \"stdio.h\"\n\nint a, b, c, n;\n\nint main()\n{\n\tscanf( \"%d%d%d\", &a, &b, &n );\n\twhile( n-- ) c = a + b, a = b, b = c;\n\tprintf( \"%d\\n\", a );\n\treturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint a[25], n, i;\n\nint main()\n{\n\tscanf( \"%d%d%d\", &a[0], &a[1], &n );\n\tfor( i = 2; i <= n; i++ ) a[i] = a[i-1] + a[i-2];\n\tprintf( \"%d\\n\", a[n] );\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint balchal(int a,int b,int c)\n{\n\t//int i;\n\tif (c==0){\n\t\treturn a;\n\t}\n\telse if (c==1){\n\t\treturn b;\n\t}\n\telse{\n\t\treturn balchal(a,b,c-1)+balchal(a,b,c-2);\n\t}\n\t\n}\nint main()\n{\n\tint a,b,c,g;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\tg=balchal(a,b,c);\n\tprintf(\"%d\",g);\n\treturn 0;\n}\n"}, {"source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long a,b,c,ans=b;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n ans=b;\n for(int i=2;i<=c;i++)\n {\n ans=a+b;\n a=b;\n b=ans;\n }\n printf(\"%lld\",ans);\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint arr[25];\n\nint main()\n{\n int a1, a2, a3;\n scanf(\"%d %d %d\", &a1, &a2, &a3);\n if(a3 == 0)\n {\n printf(\"%d\\n\", a1);\n }\n else if(a3 == 1)\n {\n printf(\"%d\\n\", a2);\n }\n else\n {\n arr[0] = a1;\n arr[1] = a2;\n for(int i = 2; i <= a3; i++)\n {\n arr[i] = arr[i - 1] + arr[i - 2];\n }\n printf(\"%d\\n\", arr[a3]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[21], a3;\n\tscanf(\"%d %d %d\", &a[0], &a[1], &a3);\n\tfor (int i = 2; i <= a3; i++)\n\t\ta[i] = a[i - 1] + a[i - 2];\n\tprintf(\"%d\", a[a3]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n int f(int x,int y,int n)\n {\n if(n==1) return x;\n else if(n==2) return y;\n else return f(x,y,n-1)+f(x,y,n-2);\n }\n int main()\n {\n int m,n,a;\n scanf(\"%d %d %d\",&m,&n,&a);\n printf(\"%d\\n\",f(m,n,a+1));\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,n;\n\tint f[1001];\n\tscanf(\"%d %d %d\",&f[0],&f[1],&n);\n\tfor(i=2;i<=n;i++)\n\t{\n\t f[i]=f[i-1]+f[i-2];\n\t}\n\tprintf(\"%d\",f[n]);\n\treturn 0;\n\t\n}"}, {"source_code": "# include <stdio.h>\nint dp[50];\n\nint f(int n)\n{\n\tif(dp[n]!=-1)\n\t\treturn dp[n];\n\telse if(n==1)\n\t\treturn dp[1];\n\telse if(n==0)\n\t\treturn dp[0];\n\telse\n\t{\n\t\tdp[n]=f(n-1)+f(n-2);\n\t\treturn dp[n];\n\t}\n}\n\nint main(void)\n{\n\tint n;\n\tint i;\n\tscanf(\"%d %d %d\", &dp[0],&dp[1],&n);\n\tfor(i=2; i<=n; ++i)\n\t\tdp[i]=-1;\n\tprintf(\"%d\", f(n));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a1,a2,a3;//\u5b9a\u4e49a1\u3001a2\u3001a3\n long long d[1000];//\u5b9a\u4e49\u4e00\u4e2a\u6307\u9488\n scanf(\"%lld%lld%lld\",&a1,&a2,&a3);//\u8f93\u5165a1\u3001a2\u3001a3\n d[0]=a1;//\u7b2c1\u9879\u4e3aa1\n d[1]=a2;//\u7b2c2\u9879\u4e3aa2\n for(int i=2;i<=a3;++i)//\u4ece\u4e0b\u6807\u4e3a2\u7684\u5143\u7d20\u5f00\u59cb\u904d\u5386\n d[i]=d[i-1]+d[i-2];//\u8fd9\u662f\u9012\u63a8\u516c\u5f0f\n printf(\"%lld\",d[a3]);//\u6700\u540e\u8f93\u51fa\u7b2ca3\u9879\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define FOR(a, b, c) for(int a=b; a<=c; a++)\n\nint m1, m2, n, f[25];\n\nint main()\n{\n scanf(\"%d %d %d\", &m1, &m2, &n);\n f[0] = m1;\n f[1] = m2;\n FOR(i, 2, n)\n f[i] = f[i-1] + f[i-2];\n printf(\"%d\", f[n]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>////\u2500\u2500\u2500\u2584\u2580\u2580\u2580\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2580\u2580\u2580\u2584\u2500\u2500\u2500\n#include <stdlib.h>///\u2500\u2500\u2500\u2588\u2592\u2592\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u2592\u2588\u2500\u2500\u2500\n#include <math.h>/////\u2500\u2500\u2500\u2500\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2588\u2500\u2500\u2500\u2500\n#include <string.h>///\u2500\u2584\u2584\u2500\u2500\u2588\u2591\u2591\u2591\u2580\u2588\u2580\u2591\u2591\u2591\u2588\u2500\u2500\u2584\u2584\u2500\n#include <ctype.h>////\u2588\u2591\u2591\u2588\u2500\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2500\u2588\u2591\u2591\u2588\n#define max(a,b) (a)>(b)?(a):(b)\n#define min(a,b) (a)<(b)?(a):(b)\n#define inout freopen(\"in.txt\",\"r\",stdin);freopen(\"out.txt\",\"w\",stdout)\n#define swap(a,b) a+=b;b=a-b;a-=b\n#define quicksort(a,n) qsort(a,n,sizeof(a[0]),cmp)\n#define inputarr(a,n)for(int i=0;i<n;i++){scanf(\"%d\",&a[i]);}\n#define printarr(a,n) for(int i=0;i<n;i++){printf(\"%d \",a[i]);}puts(\"\")\n#define ll long long\nint cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}\n\nint main() {\n\n\t//inout;\n\n\tint a, b, i;\n\n\tscanf(\"%d %d %d\", &a, &b, &i);\n\n\tif(i == 0){printf(\"%d\", a); return 0;}\n\telse if(i == 1){printf(\"%d\", b);return 0;}\n\n\telse{\n\t\ti --;\n\t\twhile(i--){\n\t\t\tint temp = b;\n\t\t\tb = a + b;\n\t\t\ta = temp;\n\t\t}\n\t\tprintf(\"%d\", b);\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[100],n,i;\n\tscanf(\"%d%d%d\",&a[0],&a[1],&n);\n\tfor(i=2;i<=20;i++)\n\t{\n\t\ta[i]=a[i-1]+a[i-2];\n\t}\n\tprintf(\"%d\\n\",a[n]);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint f[20];\nint main(void)\n{\n\tint a1, a2, n;\n\tscanf(\"%d%d%d\", &f[0], &f[1], &n);\n\tfor(int i=2; i<=n; i++)\n\t{\n\t\tf[i] = f[i-1] + f[i-2];\n\t}\n\tprintf(\"%d\", f[n]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int n;\n for(int i=2;i<=c;i++){\n n=a+b;\n a=b;\n b=n;\n }\n printf(\"%d\",b);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int f[10000];\n int n,i,j,a1,a2,x;\n scanf(\"%d%d%d\",&a1,&a2,&x);\n f[0]=a1;f[1]=a2;\n for(i=2;i<=x;i++)\n f[i]=f[i-1]+f[i-2];\n printf(\"%d\",f[x]);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,arr[3],tot,i,j;\n for(i=0;i<3;i++)\n scanf(\"%d\",&arr[i]);\n i=1;tot=0;j=1;\n while((arr[2])--)\n {\n tot=tot+arr[j];\n i++;\n j=i%2;\n }\n printf(\"%d\\n\",tot);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a1,a2,n,i;\n scanf(\"%d %d %d\",&a1,&a2,&n);\n int a[1000];\n a[0]=a1;\n a[1]=a2;\n for(i=2;i<=n;i++)\n a[n]=a[n-1]+a[n-2];\n printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a1,a2,n,i;\n scanf(\"%d %d %d\",&a1,&a2,&n);\n int a[1000];\n a[0]=a1;\n a[1]=a2;\n for(i=2;i<=n;i++)\n a[n]=a[n-1]+a[n-2];\n printf(\"%d\",a[n-1]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int n;\n for(int i=3;i<=c;i++){\n n=a+b;\n a=b;\n b=n;\n }\n if(c==1)printf(\"%d\",a);\n else printf(\"%d\",b);\n}"}], "src_uid": "6ff30f5a9afc3f7befca813469188aab"} {"nl": {"description": "Let's denote a function $$$f(x)$$$ in such a way: we add $$$1$$$ to $$$x$$$, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example, $$$f(599) = 6$$$: $$$599 + 1 = 600 \\rightarrow 60 \\rightarrow 6$$$; $$$f(7) = 8$$$: $$$7 + 1 = 8$$$; $$$f(9) = 1$$$: $$$9 + 1 = 10 \\rightarrow 1$$$; $$$f(10099) = 101$$$: $$$10099 + 1 = 10100 \\rightarrow 1010 \\rightarrow 101$$$. We say that some number $$$y$$$ is reachable from $$$x$$$ if we can apply function $$$f$$$ to $$$x$$$ some (possibly zero) times so that we get $$$y$$$ as a result. For example, $$$102$$$ is reachable from $$$10098$$$ because $$$f(f(f(10098))) = f(f(10099)) = f(101) = 102$$$; and any number is reachable from itself.You are given a number $$$n$$$; your task is to count how many different numbers are reachable from $$$n$$$.", "input_spec": "The first line contains one integer $$$n$$$ ($$$1 \\le n \\le 10^9$$$).", "output_spec": "Print one integer: the number of different numbers that are reachable from $$$n$$$.", "sample_inputs": ["1098", "10"], "sample_outputs": ["20", "19"], "notes": "NoteThe numbers that are reachable from $$$1098$$$ are:$$$1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1098, 1099$$$."}, "positive_code": [{"source_code": "#include \"stdio.h\"\n\nint main() {\n unsigned int num;\n int count;\n while(~scanf(\"%d\", &num)) {\n count = 0;\n while(num >= 10) {\n num++;\n// printf(\"%d %d \", num, num%10);\n while(num%10 == 0) {\n num /= 10;\n }\n// printf(\"%d\\n\", num);\n count++;\n }\n printf(\"%d\\n\", count + 9);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint cnt,flag=0,flag2=0;\nlong long fun(long long x);\nint main(void)\n{\n long long x,temp=10;\n scanf(\"%lld\",&x);\n// cnt++;\n while(x>9&&flag==0)\n {\n x=fun(x);\n// if(x==1&&flag==0)\n// flag=1;\n// if(flag2==1)\n// break;\n }\n printf(\"%d\\n\",cnt+9);\n return 0;\n}\nlong long fun(long long x)\n{\n x++;\n while(x%10==0)\n x/=10;\n cnt++;\n return x;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int a,count;\n scanf(\"%d\",&a);\n if(a>0 && a<=9)\n {\n count=0;\n }\n else\n {\n count=1;\n }\n while(1)\n {\n a++;\n while(1)\n {\n if(a%10!=0)\n {\n break;\n }\n else\n {\n a=a/10;\n }\n }\n count++;\n if(a>=1 && a<=9)\n {\n break;\n }\n }\n printf(\"%d\",count+8);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint f(int n)\n{\n\tn++;\n\twhile (n % 10 == 0)\n\t{\n\t\tn = n / 10;\n\t}\n\treturn n;\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\" , &n);\n\n\tint c;\n\n\tfor (c = 0 ; n > 1 ; c++)\n\t{\n\t\tif (n > 1 && n < 10)\n\t\t{\n\t\t\tc--;\n\t\t}\n\t\tn = f(n);\n\t}\n\n\tprintf(\"%d\\n\", c + 9);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{ \n long long int num , count = 0;\n scanf(\"%lli\" ,&num);\n \n while (1)\n {\n if(num < 10) break;\n count++;\n num++;\n\n while (1)\n {\n if(!(num % 10)) num /= 10;\n else break;\n }\n }\n \n count += 9;\n printf(\"%lli\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,sum=1,count=0,i=1,j=0;\n scanf(\"%d\",&n);\n int a[10];\n /*for(j=0;j<10;j++)\n {\n a[j]=0;\n }*/\n if(n>=1&&n<=9)\n {\n sum=sum+8;\n }\n else\n {\n n=n+1;\n while(i>0)\n {\n if(n>=1&&n<=9)\n {\n sum=sum+9;\n break;\n }\n if(n%10!=0)\n {\n n=n+1;\n sum=sum+1;\n }\n else if(n%10==0)\n {\n n=n/10;\n }\n /*for(j=1;j<10;j++)\n {\n if(a[j]==2)\n {\n //break;\n count=1;\n }\n }\n if(count==1)\n break;*/\n i++;\n }\n }\n printf(\"%d\\n\",sum);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch=getchar();int i=1,total=0,n;\n total=0;i=1;while(ch>='0'&&ch<='9')\n {\n ch=ch-'0';\n if(i==1)\n {\n total+=9;\n }\n else\n total=total+10-ch-1;\n ch=getchar();\n i++;\n }\n if(i==2)\n printf(\"9\");\n else printf(\"%d\\n\",total+1);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n \n \n int i=0,j=0;\n \n \n while(1)\n {\n if(n>=1&&n<10)\n {\n printf(\"%d\",9+j);\n return 0;\n }\n i=10-n%10;\n j=j+i;\n n=n+i;\n while(n%10==0)\n n=n/10;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar a[12];\n\tsprintf(a,\"%d\",n);\n\tint k=strlen(a);\n\tint i,ans=9;\n\tfor(i=1;i<k;i++)\n\t{\n\t\tans+=9-(a[i]-'0');\n\t}\n\tans++;\n\tif(k==1&&a[0]!='0')\n\t\tans=9;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n/*\n9 1 2 3 4 5 6 7 8\n8 9 1 2 3 4 5 6 7\n1 2 3 4 5 6 7 8 9\n0 1 2 3 4 5 6 7 8 9\n*/"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nlong int count=0;\nvoid recur(long int n){\n if(n<10){\n count+=9;\n return;\n }\n else{\n n = n+1;\n while(n%10==0){\n n=n/10;\n }\n count++;\n recur(n);\n }\n}\nint main(){\n long int num;\n scanf(\"%ld\",&num);\n recur(num);\n printf(\"%ld\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint N, i;\n\tint flag = 0;\n\tint A[1000000] = { 0 };\n\tint count = 1;\n\tint index = 0;\n\tscanf(\"%d\", &N);\n\twhile(1)\n\t{\n\t\tA[index] = N;\n\t\tindex++; count++;\n\t\tN += 1;\n\t\tif(N % 10 == 0)\n\t\t{\n\t\t\twhile(N % 10 == 0)\n\t\t\t\tN /= 10;\n\t\t}\n\t\tA[index] = N;\n\t\tif(flag)\n\t\t{\n\t\t\tfor(i = 0; i < index; i++)\n\t\t\t{\n\t\t\t\tif(A[i] == N)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\", count - 1);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tflag = 1;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar a[12];\n\tsprintf(a,\"%d\",n);\n\tint k=strlen(a);\n\tint i,ans=9;\n\tfor(i=1;i<k;i++)\n\t{\n\t\tans+=9-(a[i]-'0');\n\t}\n\tans++;\n\tif(k==1&&a[0]!='0')\n\t\tans=9;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n/*\n9 1 2 3 4 5 6 7 8\n8 9 1 2 3 4 5 6 7\n1 2 3 4 5 6 7 8 9\n0 1 2 3 4 5 6 7 8 9\n*/"}, {"source_code": "#include <stdio.h>\nint main () {\n int n, ans = 0;\n scanf (\"%d\", &n);\n \n while (n >= 10) {\n n ++;\n while (!(n % 10)) {\n n /= 10;\n }\n ans ++;\n }\n printf (\"%d\\n\", ans + 9);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint recur(int n)\n{\nstatic int psf=0;\nif(n<10) psf++;\n n++;\n if(n%10==0)\n {\n while(n%10==0)\n {\n n/=10;\n }\n }\n\n if(n==1)\n {\n return 10-psf;\n\n }\n return 1+recur(n);\n\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",recur(n));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n#include <inttypes.h>\n\ntypedef int64_t I64;\n\nint main() {\n\tI64 n, count = 0;\n\tscanf(\"%\"SCNi64, &n);\n\n\twhile (n >= 10) {\n\t\tn++;\n\t\twhile (n % 10 == 0) {\n\t\t\tn /= 10;\n\t\t}\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%\"PRIi64\"\\n\", count + 9);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int cou=1;\n scanf(\"%I64d\", &n);\n\n if(n/10 == 0){\n cou = 9;\n goto print;\n }\n n++;\n while(1){\n if(n/10 == 0){\n cou += 9;\n break;\n }\n if(n%10 == 0){\n n /= 10;\n }\n else{\n n++;\n cou++;\n }\n }\n print:\n printf(\"%I64d\", cou);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i=0,j=2,k,l;\n long long int n;\n\nscanf(\"%I64d\",&n);\nif(n==1)k=1;if(n<10){\n puts(\"9\");\n return 0;\n }\nn++;\nwhile(n!=1){\n\n if(n%10==0){i++;\n n=n/10;}\nelse n++;\n j++;\n if(n<=9){break;}\n\n}\n\n\n\n printf(\"%d\\n\",j-i+8);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, i, j, c=1, a;\n scanf(\"%lld\",&n);\n a=n;\n for(;a!=0;)\n {\n j=a%10;\n a=a/10;\n }\n a=n;\n for(i=0; ;i++)\n {\n n++;\n for(;n%10==0;)\n {\n n=n/10;\n }\n if(n==a)\n {\n break;\n }\n c++;\n if(n==j)\n {\n break;\n }\n }\n printf(\"%lld\\n\",c);\n}\n"}, {"source_code": "#include <stdio.h>\nint main () {\n int n, ans = 0;\n scanf (\"%d\", &n);\n \n while (n >= 10) {\n n ++;\n while (!(n % 10)) {\n n /= 10;\n }\n ans ++;\n }\n printf (\"%d\\n\", ans + 9);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n\n\nint main()\n{\n int i;\n scanf(\"%d\", &i);\n int count = 0;\n while(i > 9)\n {\n\n i++;\n while(i % 10 == 0)\n {\n i /= 10;\n }\n\n if(i % 10 != 0)\n {\n count++;\n }\n\n if(i == 1)\n {\n break;\n }\n\n\n\n }\n\n printf(\"%d\\n\", count + 9);\n\n return 0;\n\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:05/06/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\nlong long solve(long long x)\n{\n x++;\n while(x%10==0)\n {\n x=x/10;\n }\n return x;\n}\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n,ans=0;\n scanf(\"%lld\",&n);\n long long arr[1000],a=0;\n long long c=n,x=1;\n arr[a++]=n;\n while(x)\n {\n n=solve(n);\n for(long long i=0;i<a;i++)\n {\n if(arr[i]==n)\n {\n x=0;\n break;\n }\n }\n \n arr[a++]=n;\n }\n printf(\"%lld\\n\",a-1);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, c, cnt;\n\n\tscanf(\"%d\", &n);\n\tcnt = 0;\n\twhile (n >= 10) {\n\t\tn++;\n\t\tcnt++;\n\t\twhile (n % 10 == 0)\n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\\n\", cnt + 9);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef int PrimaryType_t;\ntypedef struct {\n PrimaryType_t mPrimaryVal;\n} RBData_t;\n\ntypedef enum {\n RB_RED,\n RB_BLACK\n} RBColor_t;\n\nstruct RBNode_t {\n struct RBNode_t *mLeft, *mRight, *mParent;\n RBColor_t mColor;\n RBData_t mKey;\n};\n\ntypedef struct {\n struct RBNode_t mSentinelLeaf;\n struct RBNode_t *mTreeRoot;\n} RBTree_t;\n\nvoid Show(struct RBNode_t *node)\n{\n printf(\"%p %p %p %p %d %d\\n\", node, node->mParent, node->mLeft, node->mRight, node->mKey.mPrimaryVal, node->mColor);\n}\n\nvoid RBTreeInitialize(RBTree_t *tree)\n{\n tree->mTreeRoot = &tree->mSentinelLeaf;\n tree->mSentinelLeaf.mColor = RB_BLACK;\n}\n\nvoid RBTreeInorder(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node != stop) {\n RBTreeInorder(node->mLeft, stop);\n Show(node);\n RBTreeInorder(node->mRight, stop);\n }\n}\n\nvoid RBTreePostorderFree(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node != stop) {\n RBTreePostorderFree(node->mLeft, stop);\n RBTreePostorderFree(node->mRight, stop);\n free(node);\n }\n}\n\nvoid RBTreeDestroy(RBTree_t *tree)\n{\n RBTreePostorderFree(tree->mTreeRoot, &tree->mSentinelLeaf);\n RBTreeInitialize(tree);\n}\n\nstruct RBNode_t *RBTreeSearch(struct RBNode_t *node, RBData_t *key, struct RBNode_t *stop)\n{\n while(node != stop && key->mPrimaryVal != node->mKey.mPrimaryVal) {\n if(key->mPrimaryVal < node->mKey.mPrimaryVal) {\n node = node->mLeft;\n } else {\n node = node->mRight;\n }\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeMinimum(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node == stop) {\n return node;\n }\n while(node->mLeft != stop) {\n node = node->mLeft;\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeMaximum(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node == stop) {\n return node;\n }\n while(node->mRight != stop) {\n node = node->mRight;\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeSuccessor(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node->mRight != stop) {\n return RBTreeMinimum(node->mRight, stop);\n }\n struct RBNode_t *p = node->mParent;\n while(p != stop && node == p->mRight) {\n node = p;\n p = node->mParent;\n }\n return p;\n}\n\nstruct RBNode_t *RBTreePredecessor(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node->mLeft != stop) {\n return RBTreeMaximum(node->mLeft, stop);\n }\n struct RBNode_t *p = node->mParent;\n while(p != stop && node == p->mLeft) {\n node = p;\n p = node->mParent;\n }\n return p;\n}\n\nvoid RBTreeLeftRotate(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node->mRight;\n node->mRight = y->mLeft;\n if(y->mLeft != &tree->mSentinelLeaf) {\n y->mLeft->mParent = node;\n }\n y->mParent = node->mParent;\n if(node->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = y;\n } else if(node == node->mParent->mLeft) {\n node->mParent->mLeft = y;\n } else {\n node->mParent->mRight = y;\n }\n y->mLeft = node;\n node->mParent = y;\n}\n\nvoid RBTreeRightRotate(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node->mLeft;\n node->mLeft = y->mRight;\n if(y->mRight != &tree->mSentinelLeaf) {\n y->mRight->mParent = node;\n }\n y->mParent = node->mParent;\n if(node->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = y;\n } else if(node == node->mParent->mLeft) {\n node->mParent->mLeft = y;\n } else {\n node->mParent->mRight = y;\n }\n y->mRight = node;\n node->mParent = y;\n}\n\nvoid RBTreeInsertFixup(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *s;\n while(node->mParent->mColor == RB_RED) {\n if(node->mParent == node->mParent->mParent->mLeft) {\n s = node->mParent->mParent->mRight;\n } else {\n s = node->mParent->mParent->mLeft;\n }\n if(s->mColor == RB_RED) {\n node->mParent->mColor = RB_BLACK;\n s->mColor = RB_BLACK;\n node->mParent->mParent->mColor = RB_RED;\n node = node->mParent->mParent;\n } else {\n if(node == node->mParent->mRight && node->mParent == node->mParent->mParent->mLeft) {\n node = node->mParent;\n RBTreeLeftRotate(tree, node);\n } else if(node == node->mParent->mLeft && node->mParent == node->mParent->mParent->mRight) {\n node = node->mParent;\n RBTreeRightRotate(tree, node);\n }\n node->mParent->mColor = RB_BLACK;\n node->mParent->mParent->mColor = RB_RED;\n if(node == node->mParent->mLeft) {\n RBTreeRightRotate(tree, node->mParent->mParent);\n } else {\n RBTreeLeftRotate(tree, node->mParent->mParent);\n }\n }\n }\n tree->mTreeRoot->mColor = RB_BLACK;\n}\n\nvoid RBTreeInsert(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = &tree->mSentinelLeaf;\n struct RBNode_t *x = tree->mTreeRoot;\n while(x != &tree->mSentinelLeaf) {\n y = x;\n if(node->mKey.mPrimaryVal < x->mKey.mPrimaryVal) {\n x = x->mLeft;\n } else {\n x = x->mRight;\n }\n }\n node->mParent = y;\n if(y == &tree->mSentinelLeaf) {\n tree->mTreeRoot = node;\n } else if(node->mKey.mPrimaryVal < y->mKey.mPrimaryVal) {\n y->mLeft = node;\n } else {\n y->mRight = node;\n }\n node->mLeft = &tree->mSentinelLeaf;\n node->mRight = &tree->mSentinelLeaf;\n node->mColor = RB_RED;\n RBTreeInsertFixup(tree, node);\n}\n\nvoid RBTreeTransplant(RBTree_t *tree, struct RBNode_t *u, struct RBNode_t *v)\n{\n if(u->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = v;\n } else if(u == u->mParent->mLeft) {\n u->mParent->mLeft = v;\n } else {\n u->mParent->mRight = v;\n }\n v->mParent = u->mParent;\n}\n\nvoid RBTreeDeleteFixup(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *s;\n while(node != tree->mTreeRoot && node->mColor == RB_BLACK) {\n if(node == node->mParent->mLeft) {\n s = node->mParent->mRight;\n if(s->mColor == RB_RED) {\n s->mColor = RB_BLACK;\n node->mParent->mColor = RB_RED;\n RBTreeLeftRotate(tree, node->mParent);\n s = node->mParent->mRight;\n }\n if(s->mLeft->mColor == RB_BLACK && s->mRight->mColor == RB_BLACK) {\n s->mColor = RB_RED;\n node = node->mParent;\n } else {\n if(s->mRight->mColor == RB_BLACK) {\n s->mLeft->mColor = RB_BLACK;\n s->mColor = RB_RED;\n RBTreeRightRotate(tree, s);\n s = node->mParent->mRight;\n }\n s->mColor = node->mParent->mColor;\n node->mParent->mColor = RB_BLACK;\n s->mRight->mColor = RB_BLACK;\n RBTreeLeftRotate(tree, node->mParent);\n node = tree->mTreeRoot;\n }\n } else {\n s = node->mParent->mLeft;\n if(s->mColor == RB_RED) {\n s->mColor = RB_BLACK;\n node->mParent->mColor = RB_RED;\n RBTreeRightRotate(tree, node->mParent);\n s = node->mParent->mLeft;\n }\n if(s->mLeft->mColor == RB_BLACK && s->mRight->mColor == RB_BLACK) {\n s->mColor = RB_RED;\n node = node->mParent;\n } else {\n if(s->mLeft->mColor == RB_BLACK) {\n s->mRight->mColor = RB_BLACK;\n s->mColor = RB_RED;\n RBTreeLeftRotate(tree, s);\n s = node->mParent->mLeft;\n }\n s->mColor = node->mParent->mColor;\n node->mParent->mColor = RB_BLACK;\n s->mLeft->mColor = RB_BLACK;\n RBTreeRightRotate(tree, node->mParent);\n node = tree->mTreeRoot;\n }\n }\n }\n node->mColor = RB_BLACK;\n}\n\nvoid RBTreeDelete(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node;\n struct RBNode_t *x;\n RBColor_t origincolor = y->mColor;\n if(node->mLeft == &tree->mSentinelLeaf) {\n x = node->mRight;\n RBTreeTransplant(tree, node, node->mRight);\n } else if(node->mRight == &tree->mSentinelLeaf) {\n x = node->mLeft;\n RBTreeTransplant(tree, node, node->mLeft);\n } else {\n y = RBTreeMinimum(node->mRight, &tree->mSentinelLeaf);\n origincolor = y->mColor;\n x = y->mRight;\n if(y->mParent == node) {\n x->mParent = y;\n } else {\n RBTreeTransplant(tree, y, y->mRight);\n y->mRight = node->mRight;\n y->mRight->mParent = y;\n }\n RBTreeTransplant(tree, node, y);\n y->mLeft = node->mLeft;\n y->mLeft->mParent = y;\n y->mColor = node->mColor;\n }\n if(origincolor == RB_BLACK) {\n RBTreeDeleteFixup(tree, x);\n }\n}\n\nvoid RBTreeAdd(RBTree_t *tree, PrimaryType_t num)\n{\n struct RBNode_t *node = (struct RBNode_t *)malloc(sizeof(struct RBNode_t));\n node->mKey.mPrimaryVal = num;\n RBTreeInsert(tree, node);\n}\n\nvoid RBTreeDel(RBTree_t *tree, PrimaryType_t num)\n{\n RBData_t check;\n check.mPrimaryVal = num;\n struct RBNode_t *node = RBTreeSearch(tree->mTreeRoot, &check, &tree->mSentinelLeaf);\n if(node == &tree->mSentinelLeaf) {\n puts(\"ERROR\");\n return;\n }\n RBTreeDelete(tree, node);\n free(node);\n}\n\nint f(int x)\n{\n ++x;\n while(x % 10 == 0) {\n x /= 10;\n }\n return x;\n}\n\nint main()\n{\n int n, ans = 1;\n scanf(\"%d\", &n);\n RBTree_t Tree;\n RBTreeInitialize(&Tree);\n RBTreeAdd(&Tree, n);\n while(1) {\n n = f(n);\n RBData_t check;\n check.mPrimaryVal = n;\n struct RBNode_t *node = RBTreeSearch(Tree.mTreeRoot, &check, &Tree.mSentinelLeaf);\n if(node == &Tree.mSentinelLeaf) {\n RBTreeAdd(&Tree, n);\n ++ans;\n } else {\n break;\n }\n }\n printf(\"%d\\n\", ans);\n RBTreeDestroy(&Tree);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k=1;\n scanf(\"%lld\",&n);\n if(n<=9)\n printf(\"9\\n\");\n else{\n while(1)\n {\n n=n+1;\n while(n%10==0){\n n=n/10;\n }\n\n k++;\n if(n<10)\n {\n k=k+8;\n break;}\n }\n if(k<10)\n printf(\"%lld\\n\",k+8);\n else printf(\"%lld\\n\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, cnt=9;\n scanf(\"%d\", &n);\n while(n > 9)\n {\n n++;\n cnt++;\n while(n%10==0)\n {\n n /= 10;\n }\n }\n printf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,f,count=0,i;\n scanf(\"%d\",&n);\n f=n;\n int a[100],x=0;\n while(1)\n {\n a[x]=f;\n f=f+1;\n while(f%10==0)\n {\n if(f%10==0)\n f=f/10;\n }\n //printf(\"%d\",f);\n for(i=0;i<=x;i++)\n {\n if(f==a[i])\n count++;\n }\n if(count!=0)\n break;\n x++;\n }\n printf(\"%d\",x+1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, c, cnt;\n\n\tscanf(\"%d\", &n);\n\tcnt = 0;\n\twhile (n >= 10) {\n\t\tn++;\n\t\tcnt++;\n\t\twhile (n % 10 == 0)\n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\\n\", cnt + 9);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint f(long);\n\nint main()\n{\n\tlong n;\n\tscanf(\"%ld\", &n);\n\tprintf(\"%d\", f(n));\n\treturn 0;\n}\n\nint f(long n)\n{\n\tint count = 0;\n\tif(n % 10 == 0)\n\t{\n\t\tcount++;\n\t\tn++;\n\t}\n\twhile(n > 10)\n\t{\n\t\twhile(n % 10 != 0)\n\t\t{\n\t\t\tcount++;\n\t\t\tn++;\n\t\t}\n\t\tn = n/10;\n\t}\n\tcount += 9;\n\treturn count;\n}\n\t\t"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, count=1, b, d, e, f;\n scanf(\"%d\", &a);\n int c[100], flag=0;\n c[0] = a;\n a++;\n while(1)\n {\n b = a%10;\n flag =0;\n if(b != 0)\n {\n for (d=0; d<count; d++)\n {\n if(a == c[d])\n flag=1;\n }\n if (flag)\n break;\n c[count] = a;\n count++;\n a += 1;\n // printf(\"%d %d %d\\n\", a, count, c[count-1]);\n }\n else\n a /= 10;\n\n }\n printf(\"%d\", count);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,q,w,arr[10000];\n scanf(\"%d\",&n);\n int p=n;\n arr[0]=n;\n for(i=0;;i++){\n n=n+1;\n if(n%10!=0){\n arr[++k]=n;\n q=0;\n for(j=0;j<k-1;j++){\n if(arr[j]==n){\n q=1;\n break;\n }\n }\n if(q==1)\n break;\n }\n else\n {\n for(w=0;;w++){\n if(n%10==0)\n n=n/10;\n else{\n q=0;\n for(j=0;j<=k;j++){\n if(arr[j]==n){\n q=1;\n break;\n }\n }\n if(q==0)\n arr[++k]=n;\n break;\n }\n }\n }\n //printf(\"%d %d\\n\",k,n);\n }\n printf(\"%d\",k);\n}\n"}, {"source_code": "#include<stdio.h>\nint cnt,flag=0,flag2=0;\nlong long fun(long long x);\nint main(void)\n{\n long long x,temp=10;\n scanf(\"%lld\",&x);\n// cnt++;\n while(x>9&&flag==0)\n {\n x=fun(x);\n// if(x==1&&flag==0)\n// flag=1;\n// if(flag2==1)\n// break;\n }\n printf(\"%d\\n\",cnt+9);\n return 0;\n}\nlong long fun(long long x)\n{\n x++;\n while(x%10==0)\n x/=10;\n cnt++;\n return x;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int num = n;\n\n int i, j, temp=num, count=1;\n\n if (n<10)\n {\n printf(\"%d\\n\", 9);\n }\n\n else\n {\n for (i=1; ;i++)\n {\n if (num<10)\n {\n count+=9;\n break;\n }\n\n if ((num+i)%10==0)\n {\n i=0;\n ///printf(\"%d\\n\", i);\n num = num/10;\n continue;\n }\n ///printf(\":: %d\\n\", num+i);\n count++;\n }\n\n printf(\"%d\\n\", count);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int a,count;\n scanf(\"%d\",&a);\n if(a>0 && a<=9)\n {\n count=0;\n }\n else\n {\n count=1;\n }\n while(1)\n {\n a++;\n while(1)\n {\n if(a%10!=0)\n {\n break;\n }\n else\n {\n a=a/10;\n }\n }\n count++;\n if(a>=1 && a<=9)\n {\n break;\n }\n }\n printf(\"%d\",count+8);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main (){\n int i,j,a[100000],n,m=0,k;\n scanf(\"%d\",&n);\n if(n>=1&&n<=1000000000){\n a[0]=n;\n for(i=1;;i++){\n n++;\n for(j=0;;j++){\n if(n%10==0){\n n=n/10;\n continue;\n }\n else{\n m++;\n for(k=0;k<=i;k++){\n if(a[k]==n){\n printf(\"%d\",m);\n return 0;\n }\n }\n a[i]=n;\n break;\n }\n\n }\n }\n }\n}\n"}, {"source_code": "/*1098 = 9 + 10 + 1 + 2\n\n10000 = 100001 10002 .... 10009 1001 1002 .... 1009 101 102 ... 109 11 12 ... 19 2\n\n\n\n10 + 1 + 9 + \n999 1 2 3 4 5 6 7 8 9 \n\n9 + 1 \n\n9 + 9 + 1 + 1\n\n\n100 = 9 + 1 + 9 + 9\n\n100 101 102 103 ... 109 (10)\n11 12 13 .. 19 (9)\n2 3 4 ...9 1 (9)\n\n\n343\n\n9 + 1 + 5 + 6 = 21\n\n343 344 345 346 347 348 349\n35 36 37 38 39\n4 5 6 7 8 9 1 2 3\n*/\n#include<stdio.h>\nint main()\n{\n\tlong int a;\n\tscanf(\"%ld\",&a);\n\tint count = 0;\n\tif(a/10 != 0)\n\t{\n\t\tcount++;\n\t}\n\twhile(a!=0)\n\t{\n\t\tif(a/10 == 0)\n\t\t{\n\t\t\tcount += 9;\n\t\t\ta = a/10;\t\t\t\n\t\t}\n\t\telse{\n\t\t\tint b = a%10;\n\t\t\tcount += 9 - b;\n\t\t\ta = a/10;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main (){\n int i,j,a[100000],n,m=0,k;\n scanf(\"%d\",&n);\n if(n>=1&&n<=1000000000){\n a[0]=n;\n for(i=1;;i++){\n n++;\n for(j=0;;j++){\n if(n%10==0){\n n=n/10;\n continue;\n }\n else{\n m++;\n for(k=0;k<=i;k++){\n if(a[k]==n){\n printf(\"%d\",m);\n return 0;\n }\n }\n a[i]=n;\n break;\n }\n\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h> \nint main(void)\n{\n\tlong long int num = 0;\n\tscanf(\"%I64d\",&num);\n\tlong long int ans = 0;\n\twhile(num/10!=0)\n\t{\n\t\tans+=(10-num%10);\n\t\tnum/=10;\n\t\tnum+=1;\n\t\twhile(num%10==0)\n\t\t{\n\t\t\tnum/=10;\n\t\t}\n\t}\n\tans+=9;\n\tprintf(\"%I64d\",ans);\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main() {\n unsigned int num;\n int count;\n while(~scanf(\"%d\", &num)) {\n count = 0;\n while(num >= 10) {\n num++;\n// printf(\"%d %d \", num, num%10);\n while(num%10 == 0) {\n num /= 10;\n }\n// printf(\"%d\\n\", num);\n count++;\n }\n printf(\"%d\\n\", count + 9);\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,ans=0;\n scanf(\"%d\",&n);\n if(n%10==0){\n ans++;\n n++;\n }\n while(1){\n if(n<10)break;\n int x=n%10;\n if(x==0){\n n/=10;\n continue;\n }\n ans+=10-x;\n n=n/10+1;\n }\n printf(\"%d\",ans+9);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, result = 1, s = 0;\n\tscanf(\"%d\",&n);\n\twhile (n >= 10){\n\t\ts = 10 - n%10;\n\t\tresult += s;\n\t\tn+=s;\n\t\twhile(!(n%10)) n/=10; \n\t}\n\tprintf(\"%d\", result+8);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long n;\n scanf(\"%ld\",&n);\n int counter=0;\n int flag=1;\n int a[10000];\n a[counter++]=n;\n while(flag==1)\n {\n n=n+1;\n while(n%10==0)\n n=n/10;\n for(int i=0;i<counter;i++)\n if(a[i]==n)\n {flag=0;break;}\n if(flag==0)\n break;\n a[counter]=n;\n //printf(\"%d\\n\",a[counter]);\n counter++;\n }\n //for(int i=0;i<counter;i++)\n //printf(\"%d \",a[i]);\n printf(\"\\n%d\",counter);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,temp,j,m=0,k=0;\n scanf(\"%d\",&n);\n if(n<10)\n {\n printf(\"9\");\n return 0;\n }\n if(n%10 ==0)\n {\n m++;\n n++;\n }\n for(;1;)\n {\n for(;1;)\n {\n if(n%10 != 0)\n {\n temp = n%10;\n break;\n }\n n=n/10;\n }\n if(n<10)\n break;\n m=m+(10-temp);\n\n for(;1;)\n {\n if(n %10 == 0)\n break;\n n++;\n }\n n=n/10;\n }\n printf(\"%d\",m+9);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, count=1, b, d, e, f;\n scanf(\"%d\", &a);\n int c[100], flag=0;\n c[0] = a;\n a++;\n while(1)\n {\n b = a%10;\n flag =0;\n if(b != 0)\n {\n for (d=0; d<count; d++)\n {\n if(a == c[d])\n flag=1;\n }\n if (flag)\n break;\n c[count] = a;\n count++;\n a += 1;\n // printf(\"%d %d %d\\n\", a, count, c[count-1]);\n }\n else\n a /= 10;\n\n }\n printf(\"%d\", count);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,p=0;\n scanf(\"%d\",&n);\n if(n%10==0){\n p++;\n n++;\n }\n\n while(n>10)\n {\n while((n%10)!=0)\n {\n p++;\n n++;\n }\n n/=10;\n }\n p+=9;\n printf(\"%d\",p);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint lt(int i){\n int k,s=1;\n for (k=1;k<=i;k++)\n s=s*10;\n return s;\n}\nint f(int x){\n\tint f,i=0,y=x+1;\n\twhile (y%lt(i)==0){\n\t\ti++;\n\t}\n\tf=y/lt(i-1);\n\treturn f;\n}\nint main() {\n\tint a[1000],count=1,kq,x,i=0,j,kt=1;\n\tscanf(\"%d\",&x);\n\tkq=x;\n\tif (x==10) count=19;\n\telse if (x<10) count=9;\n\telse{\n\twhile (kq>10){\n\t\tkq=f(kq);\n\t\ta[i]=kq;\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (a[i]==a[j]){\n\t\t\t\tkt=0;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t\tif (kt==1) count++;\n\t\ti++;\n\t}\n\tcount+=8;\n\t}\t\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n y=0;\n z=-1;\n scanf(\"%d\",&x);\n while (1)\n {\n if(z==x)\n break;\n if(z==-1&&x<10)\n z=x;\n y++;\n x+=1;\n while(x%10==0)\n x/=10;\n\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint f(long);\n\nint main()\n{\n\tlong n;\n\tscanf(\"%ld\", &n);\n\tprintf(\"%d\", f(n));\n\treturn 0;\n}\n\nint f(long n)\n{\n\tint count = 0;\n\tif(n % 10 == 0)\n\t{\n\t\tcount++;\n\t\tn++;\n\t}\n\twhile(n > 10)\n\t{\n\t\twhile(n % 10 != 0)\n\t\t{\n\t\t\tcount++;\n\t\t\tn++;\n\t\t}\n\t\tn = n/10;\n\t}\n\tcount += 9;\n\treturn count;\n}\n\t\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k=1;\n scanf(\"%lld\",&n);\n if(n<=9)\n printf(\"9\\n\");\n else{\n while(1)\n {\n n=n+1;\n while(n%10==0){\n n=n/10;\n }\n\n k++;\n if(n<10)\n {\n k=k+8;\n break;}\n }\n if(k<10)\n printf(\"%lld\\n\",k+8);\n else printf(\"%lld\\n\",k);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nlong int count=0;\nvoid recur(long int n){\n if(n<10){\n count+=9;\n return;\n }\n else{\n n = n+1;\n while(n%10==0){\n n=n/10;\n }\n count++;\n recur(n);\n }\n}\nint main(){\n long int num;\n scanf(\"%ld\",&num);\n recur(num);\n printf(\"%ld\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long ans = 0;\n\nvoid f(long long n){\n if (n < 10){\n ans += 9;\n return;\n }\n ans++;\n n++;\n while (n % 10 == 0){\n n = n / 10;\n }\n //printf(\"%lld %lld\\n\", n, ans);\n f(n);\n}\n\nint main(){\n long long n;\n fscanf(stdin, \"%lld\", &n);\n\n f(n);\n \n printf(\"%lld\", ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,c=1;\n scanf(\"%d\",&n);\n\n while(1)\n {\n if(n>=10)\n {\n n=n+1;\n c=c+1;\n while(n%10==0)\n {\n n=n/10;\n }\n\n }\n else\n {\n printf(\"%d\",c+8);\n break;\n }\n\n }\n\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n, count = 1;\n while(scanf(\"%lld\", &n) != EOF)\n {\n if(n >= 10)\n {\n n = n + 1;\n count++;\n while(n >= 10)\n {\n while(n % 10 != 0)\n {\n n = n + 1;\n if(n < 10)\n {\n count--;\n break;\n }\n count++;\n }\n while(n % 10 == 0)\n {\n n = n / 10;\n if(n < 10)\n {\n count--;\n break;\n }\n }\n }\n count = count + 9;\n printf(\"%lld\\n\", count);\n }\n else\n {\n count = 9;\n printf(\"%lld\\n\", count);\n }\n\n count = 1;\n }\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main() {\n unsigned int num;\n int count;\n while(~scanf(\"%d\", &num)) {\n count = 0;\n while(num >= 10) {\n num++;\n// printf(\"%d %d \", num, num%10);\n while(num%10 == 0) {\n num /= 10;\n }\n// printf(\"%d\\n\", num);\n count++;\n }\n printf(\"%d\\n\", count + 9);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,c=1,i,j=1,flag=0;\n scanf(\"%d\",&n);\n int k=n;\n\n int a[100]={0};\n a[0]=n;\n while(1)\n {\n n=n+1;\n while(n%10==0)\n {\n n=n/10;\n }\n for(i=0;i<100;i++)\n {\n if(a[i]==n)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n break;\n else\n {\n a[j]=n;\n j++;\n c++;\n }\n\n\n }\n\n printf(\"%d\",j);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int n;\nint c;\nlong int parada;\n\nint count(){\n if(n<10){\n c = 9;\n return 0;\n }\n c = 1;\n n++;\n parada = 10000000000;\n while(1){\n while(n%10 == 0){\n n= n/10;\n if(parada/10 < 1){break;}\n parada = n-1; \n if(!parada){\n parada = 9;\n }\n }\n \n //printf(\"%li\\n\",n);\n c++;\n //printf(\"%li %d\\n\",n,c);\n if(n == parada){\n return 0;\n }\n n++;\n }\n return 0;\n}\n\n\nint main(void) {\n\n scanf(\"%li\", &n);\n\n count();\n printf(\"%d\\n\", c);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\nint f(long);\n\nint main()\n{\n\tlong n;\n\tscanf(\"%ld\", &n);\n\tprintf(\"%d\", f(n));\n\treturn 0;\n}\n\nint f(long n)\n{\n\tint count = 0;\n\tif(n % 10 == 0)\n\t{\n\t\tcount++;\n\t\tn++;\n\t}\n\twhile(n > 10)\n\t{\n\t\twhile(n % 10 != 0)\n\t\t{\n\t\t\tcount++;\n\t\t\tn++;\n\t\t}\n\t\tn = n/10;\n\t}\n\tcount += 9;\n\treturn count;\n}\n\t\t"}, {"source_code": "#include<stdio.h>\nint recur(int n)\n{\nstatic int psf=0;\nif(n<10) psf++;\n n++;\n if(n%10==0)\n {\n while(n%10==0)\n {\n n/=10;\n }\n }\n\n if(n==1)\n {\n return 10-psf;\n\n }\n return 1+recur(n);\n\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",recur(n));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint num;\n\tscanf(\"%d\",&num);\n\tint count=0;\n\tif(num<10)printf(\"9\\n\");\n\telse{\n\t\twhile(num>9){\n\t\t\t\tcount+=10-(num%10);\n\t\t\t\tnum=num/10+1;\n\t\t\twhile(num%10==0)\n\t\t\t\tnum=num/10;\n\t\t}\n\t\tprintf(\"%d\",count+9);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong aa,aaa;\n\tint i,a[15],n,k;\n\tscanf(\"%ld\",&aa);\n\taaa=aa;\n\tfor(i=1;aa!=0;i++)\n\t{\n\t\ta[i]=aa%10;\n\t\taa/=10;\n\t}\n\tk=i-1;\n\tn=0;\n\tfor(i=1;i<k;i++)\n\t{\n\t\tn+=9-a[i];\n\t}\n\tn+=10;\n\tif(aaa<10)\n\t\tprintf(\"9\");\n\telse\n\tprintf(\"%d\",n);\n\treturn 0;\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, dem = 0;\n scanf(\"%d\", &n);\n while (n >= 10) {\n int k = n % 10;\n dem += (10 - k);\n n += (10 - k);\n while(n % 10 == 0)\n n /= 10;\n }\n dem += 9;\n printf(\"%d\", dem);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i=1;\n\t\n\twhile(n>=10)\n\t{\n\t\tn++;\n\t\twhile(n%10==0){\n\t\t\tn/=10;\n\t\t}\n\t\ti++;\n\t}\n\t\n\ti+=8;\n\tprintf(\"%d\",i);\n} \n/*\n1098 => +1\n1098+2->1100->110->11 =>+2\n11,12,13,...19,20->2 ==>+9\n2,3,4,5,6,7,8,9,10->1 ==>+8 */\n\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tint n,a=1;\n\tscanf(\"%d\",&n);\n\twhile(1)\n {\n if(n>0 && n<10)\n break;\n n=n+1;\n a=a+1;\n while(n%10==0)\n n=n/10;\n }\n printf(\"%d\",a+8);\n\treturn 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:05/06/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\nlong long solve(long long x)\n{\n x++;\n while(x%10==0)\n {\n x=x/10;\n }\n return x;\n}\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n,ans=0;\n scanf(\"%lld\",&n);\n long long arr[1000],a=0;\n long long c=n,x=1;\n arr[a++]=n;\n while(x)\n {\n n=solve(n);\n for(long long i=0;i<a;i++)\n {\n if(arr[i]==n)\n {\n x=0;\n break;\n }\n }\n \n arr[a++]=n;\n }\n printf(\"%lld\\n\",a-1);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint vis[15];\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n < 10 && n > 0)\n {\n printf(\"9\\n\");\n return 0;\n }\n int count = 0;\n while(1)\n {\n n++;\n while(n % 10 == 0)\n {\n n /= 10;\n }\n if(n <= 10 && n > 0)\n {\n if(vis[n] == 1)\n break;\n else\n vis[n] = 1;\n }\n count++;\n }\n printf(\"%d\\n\", count+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, cn, nr;\n scanf(\"%d\", &n);\n nr=0;\n while(n>=10){\n nr++;\n n++;\n while(n%10==0)\n n/=10;\n }\n printf(\"%d\", nr+9);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint v[10], sum;\nint check(int n)\n{\n if(n / 10) return n / 10;\n if(sum < 45)\n for(int i = 1; i <= 9; i++)\n if(v[i] == 0)\n {\n v[i] = 1;\n sum += i;\n return 1;\n }\n return 0;\n}\n\nint main()\n{\n int n, cnt = 0;\n\n scanf(\"%d\", &n);\n do\n {\n if(n / 10 == 0) sum += n;\n // printf(\"n = %d\\n\", n);\n // printf(\"sum = %d\\n\", sum);\n n++; cnt++;\n if(n % 10 == 0)\n while(n % 10 == 0)\n n /= 10;\n }while(sum < 45);\n printf(\"%d\\n\", cnt);\n\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n\n\nint main()\n{\n int i;\n scanf(\"%d\", &i);\n int count = 0;\n while(i > 9)\n {\n\n i++;\n while(i % 10 == 0)\n {\n i /= 10;\n }\n\n if(i % 10 != 0)\n {\n count++;\n }\n\n if(i == 1)\n {\n break;\n }\n\n\n\n }\n\n printf(\"%d\\n\", count + 9);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,ans=9;\n\tscanf(\"%i\",&n);///5\n\t\n if(n%10==0)\n ans++,n++;///\n\n while(n>=10)\n {\n ans++,n++;///19 20\n while(n%10==0)///2\n n/=10;///2\n }\n\n printf(\"%d\\n\",ans);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint ans=0;\n\tif(n<10)\n\t{\n\t\tans=9;\n\t}\n\telse\n\t{\n\t\tans=10;\n\t\twhile(n>9)\n\t\t{\n\t\tans+=9-n%10;\n\t\tn/=10;\n\t\t} \n\t}\n\tprintf(\"%d\",ans);\n } "}, {"source_code": "#include<stdio.h>\nlong long int n,k,count=0,flag=0;\nlong long int f(long long int n)\n{\tn+=1;\n\twhile(1)\n\t{\tif(n%10==0)\tn/=10;\n\t\telse break;\n\t}\n\treturn n;\n}\nvoid ff(long long int n)\n{\tif(n>=10)\n\t{\t\n\t\tn=f(n);\n\t\tcount++;\n\t//\tprintf(\"%d %d\\n\",n,count);\n\t\t\n\t\tff(n);\n\t}\n\telse if(n<10)\t\n\t{\tcount+=9;\n\t\treturn ;\n\t}\n\telse return ;\n}\n\nint main()\n{\t\n\tscanf(\"%d\",&n);\n\t\n\tif(n==1)\n\tprintf(\"%d\\n\",9);\n\telse\n\t{\n\tff(n);\n\tprintf(\"%d\\n\",count);\n\t}\n\t\n } \n"}, {"source_code": "#include <stdio.h>\nint main () {\n int n, ans = 0;\n scanf (\"%d\", &n);\n \n while (n >= 10) {\n n ++;\n while (!(n % 10)) {\n n /= 10;\n }\n ans ++;\n }\n printf (\"%d\\n\", ans + 9);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\ntypedef long long int LL;\n\nint main(){\n\n\tint n; scanf(\"%d\", &n);\n\tif( n < 10 ){\n\t\tprintf(\"9\\n\");\n\t\treturn 0;\n\t}\n\n\t\n\tint count = 1;\n\tint num = n;\n\n\n\twhile( 1 ){\n\t\tnum++;\n\t\twhile(num % 10 == 0){\n\t\t\tnum /= 10;\n\t\t}\n\t\tif(num < 10){\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\", count+9);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10],i=0,c=1,n,p=1,k;\n for(k=0;k<10;k++)\n {\n a[k]=0;\n }\n scanf(\"%d\",&n);\n if(n<10)\n {\n c=0;\n }\n n++;\n while(p)\n {\n if(n%10!=0)\n {\n if(n<10)\n {\n if(a[0]==n)\n {\n p=0;\n }\n else\n {\n a[i]=n;\n i++;\n }\n }\n if(n%10!=0&&p==1)\n {\n c++;\n n++;\n }\n }\n if(n%10==0)\n {\n n/=10;\n }\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include<stdio.h> \nint main(void)\n{\n\tlong long int num = 0;\n\tscanf(\"%I64d\",&num);\n\tlong long int ans = 0;\n\twhile(num/10!=0)\n\t{\n\t\tans+=(10-num%10);\n\t\tnum/=10;\n\t\tnum+=1;\n\t\twhile(num%10==0)\n\t\t{\n\t\t\tnum/=10;\n\t\t}\n\t}\n\tans+=9;\n\tprintf(\"%I64d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c=0;\n scanf(\"%I64d\",&n);\n if((n/10)<0)\n printf(\"9\");\n else\n {\n while(n>9)\n {\n n=n+1;\n c++;\n while(n%10==0)\n {\n n=n/10;\n\n\n }\n }\n\n printf(\"%I64d\",c+9);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint f(int a);\n\nint main(void)\n{\n int a, ans=0;\n \n scanf(\"%d\", &a);\n \n for(;a>9;)\n {\n a=f(a);\n ans++;\n }\n printf(\"%d\", ans+9);\n \n return 0;\n}\n\nint f(int a)\n{\n a+=1;\n for(;a%10==0;)\n {\n a/=10;\n }\n return a;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\ntypedef long long int LL;\n\nint main(){\n\n\tint n; scanf(\"%d\", &n);\n\tif( n < 10 ){\n\t\tprintf(\"9\\n\");\n\t\treturn 0;\n\t}\n\n\t\n\tint count = 1;\n\tint num = n;\n\n\n\twhile( 1 ){\n\t\tnum++;\n\t\twhile(num % 10 == 0){\n\t\t\tnum /= 10;\n\t\t}\n\t\tif(num < 10){\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\", count+9);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n#include <inttypes.h>\n\ntypedef int64_t I64;\n\nint main() {\n\tI64 n, count = 0;\n\tscanf(\"%\"SCNi64, &n);\n\n\twhile (n >= 10) {\n\t\tn++;\n\t\twhile (n % 10 == 0) {\n\t\t\tn /= 10;\n\t\t}\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%d\\n\", count + 9);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c=0;\n scanf(\"%I64d\",&n);\n if((n/10)<0)\n printf(\"9\");\n else\n {\n while(n>9)\n {\n n=n+1;\n c++;\n while(n%10==0)\n {\n n=n/10;\n\n\n }\n }\n\n printf(\"%I64d\",c+9);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\ntypedef long long int LL;\n\nint main(){\n\n\tint n; scanf(\"%d\", &n);\n\tif( n < 10 ){\n\t\tprintf(\"9\\n\");\n\t\treturn 0;\n\t}\n\n\t\n\tint count = 1;\n\tint num = n;\n\n\n\twhile( 1 ){\n\t\tnum++;\n\t\twhile(num % 10 == 0){\n\t\t\tnum /= 10;\n\t\t}\n\t\tif(num < 10){\n\t\t\tbreak;\n\t\t}\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\", count+9);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, cn, nr;\n scanf(\"%d\", &n);\n nr=0;\n while(n>=10){\n nr++;\n n++;\n while(n%10==0)\n n/=10;\n }\n printf(\"%d\", nr+9);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check(int* a){\n\t\n\tint flag=0, j;\n\tfor(j=1;j<10;j++){\n\t\tif(a[j]==0){\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t\telse{\n\t\t\tflag=1;\n\t\t}\n\t}\n\treturn flag;\t\n}\nint main(){\n\tlong long n,temp;\n\tscanf(\"%lld\",&n);\n\tint flag=0,count=0,i,j;\n\tint a[10]={0,0,0,0,0,0,0,0,0,0};\n\ttemp=n;\n\tint iter=0,it=0;\n\twhile(1){\n\t\titer++;\n\t\tfor(i=0;;i++){\n\t\t\tit++;\n\t\t\tif(check(a))\n\t\t\t\tbreak;\n\t\t\tif(it!=1 && temp%10==0){\n\t\t\t\ttemp=temp/10;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcount++;\n\t\t\tif(temp<10){\n\t\t\t\ta[temp]=1;\n\t\t\t}\n\t\t\ttemp++;\n\t\t}\n\t\t//condition for flag\n\t\tflag=check(a);\n\t\tif(flag==1) break;\n\t}\t\n\tprintf(\"%d\\n\", count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint f(int n)\n{\n\tn++;\n\twhile (n % 10 == 0)\n\t{\n\t\tn = n / 10;\n\t}\n\treturn n;\n}\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\" , &n);\n\n\tint c;\n\n\tfor (c = 0 ; n > 1 ; c++)\n\t{\n\t\tif (n > 1 && n < 10)\n\t\t{\n\t\t\tc--;\n\t\t}\n\t\tn = f(n);\n\t}\n\n\tprintf(\"%d\\n\", c + 9);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n y=0;\n z=-1;\n scanf(\"%d\",&x);\n while (1)\n {\n if(z==x)\n break;\n if(z==-1&&x<10)\n z=x;\n y++;\n x+=1;\n while(x%10==0)\n x/=10;\n\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef int PrimaryType_t;\ntypedef struct {\n PrimaryType_t mPrimaryVal;\n} RBData_t;\n\ntypedef enum {\n RB_RED,\n RB_BLACK\n} RBColor_t;\n\nstruct RBNode_t {\n struct RBNode_t *mLeft, *mRight, *mParent;\n RBColor_t mColor;\n RBData_t mKey;\n};\n\ntypedef struct {\n struct RBNode_t mSentinelLeaf;\n struct RBNode_t *mTreeRoot;\n} RBTree_t;\n\nvoid Show(struct RBNode_t *node)\n{\n printf(\"%p %p %p %p %d %d\\n\", node, node->mParent, node->mLeft, node->mRight, node->mKey.mPrimaryVal, node->mColor);\n}\n\nvoid RBTreeInitialize(RBTree_t *tree)\n{\n tree->mTreeRoot = &tree->mSentinelLeaf;\n tree->mSentinelLeaf.mColor = RB_BLACK;\n}\n\nvoid RBTreeInorder(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node != stop) {\n RBTreeInorder(node->mLeft, stop);\n Show(node);\n RBTreeInorder(node->mRight, stop);\n }\n}\n\nvoid RBTreePostorderFree(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node != stop) {\n RBTreePostorderFree(node->mLeft, stop);\n RBTreePostorderFree(node->mRight, stop);\n free(node);\n }\n}\n\nvoid RBTreeDestroy(RBTree_t *tree)\n{\n RBTreePostorderFree(tree->mTreeRoot, &tree->mSentinelLeaf);\n RBTreeInitialize(tree);\n}\n\nstruct RBNode_t *RBTreeSearch(struct RBNode_t *node, RBData_t *key, struct RBNode_t *stop)\n{\n while(node != stop && key->mPrimaryVal != node->mKey.mPrimaryVal) {\n if(key->mPrimaryVal < node->mKey.mPrimaryVal) {\n node = node->mLeft;\n } else {\n node = node->mRight;\n }\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeMinimum(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node == stop) {\n return node;\n }\n while(node->mLeft != stop) {\n node = node->mLeft;\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeMaximum(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node == stop) {\n return node;\n }\n while(node->mRight != stop) {\n node = node->mRight;\n }\n return node;\n}\n\nstruct RBNode_t *RBTreeSuccessor(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node->mRight != stop) {\n return RBTreeMinimum(node->mRight, stop);\n }\n struct RBNode_t *p = node->mParent;\n while(p != stop && node == p->mRight) {\n node = p;\n p = node->mParent;\n }\n return p;\n}\n\nstruct RBNode_t *RBTreePredecessor(struct RBNode_t *node, struct RBNode_t *stop)\n{\n if(node->mLeft != stop) {\n return RBTreeMaximum(node->mLeft, stop);\n }\n struct RBNode_t *p = node->mParent;\n while(p != stop && node == p->mLeft) {\n node = p;\n p = node->mParent;\n }\n return p;\n}\n\nvoid RBTreeLeftRotate(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node->mRight;\n node->mRight = y->mLeft;\n if(y->mLeft != &tree->mSentinelLeaf) {\n y->mLeft->mParent = node;\n }\n y->mParent = node->mParent;\n if(node->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = y;\n } else if(node == node->mParent->mLeft) {\n node->mParent->mLeft = y;\n } else {\n node->mParent->mRight = y;\n }\n y->mLeft = node;\n node->mParent = y;\n}\n\nvoid RBTreeRightRotate(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node->mLeft;\n node->mLeft = y->mRight;\n if(y->mRight != &tree->mSentinelLeaf) {\n y->mRight->mParent = node;\n }\n y->mParent = node->mParent;\n if(node->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = y;\n } else if(node == node->mParent->mLeft) {\n node->mParent->mLeft = y;\n } else {\n node->mParent->mRight = y;\n }\n y->mRight = node;\n node->mParent = y;\n}\n\nvoid RBTreeInsertFixup(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *s;\n while(node->mParent->mColor == RB_RED) {\n if(node->mParent == node->mParent->mParent->mLeft) {\n s = node->mParent->mParent->mRight;\n } else {\n s = node->mParent->mParent->mLeft;\n }\n if(s->mColor == RB_RED) {\n node->mParent->mColor = RB_BLACK;\n s->mColor = RB_BLACK;\n node->mParent->mParent->mColor = RB_RED;\n node = node->mParent->mParent;\n } else {\n if(node == node->mParent->mRight && node->mParent == node->mParent->mParent->mLeft) {\n node = node->mParent;\n RBTreeLeftRotate(tree, node);\n } else if(node == node->mParent->mLeft && node->mParent == node->mParent->mParent->mRight) {\n node = node->mParent;\n RBTreeRightRotate(tree, node);\n }\n node->mParent->mColor = RB_BLACK;\n node->mParent->mParent->mColor = RB_RED;\n if(node == node->mParent->mLeft) {\n RBTreeRightRotate(tree, node->mParent->mParent);\n } else {\n RBTreeLeftRotate(tree, node->mParent->mParent);\n }\n }\n }\n tree->mTreeRoot->mColor = RB_BLACK;\n}\n\nvoid RBTreeInsert(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = &tree->mSentinelLeaf;\n struct RBNode_t *x = tree->mTreeRoot;\n while(x != &tree->mSentinelLeaf) {\n y = x;\n if(node->mKey.mPrimaryVal < x->mKey.mPrimaryVal) {\n x = x->mLeft;\n } else {\n x = x->mRight;\n }\n }\n node->mParent = y;\n if(y == &tree->mSentinelLeaf) {\n tree->mTreeRoot = node;\n } else if(node->mKey.mPrimaryVal < y->mKey.mPrimaryVal) {\n y->mLeft = node;\n } else {\n y->mRight = node;\n }\n node->mLeft = &tree->mSentinelLeaf;\n node->mRight = &tree->mSentinelLeaf;\n node->mColor = RB_RED;\n RBTreeInsertFixup(tree, node);\n}\n\nvoid RBTreeTransplant(RBTree_t *tree, struct RBNode_t *u, struct RBNode_t *v)\n{\n if(u->mParent == &tree->mSentinelLeaf) {\n tree->mTreeRoot = v;\n } else if(u == u->mParent->mLeft) {\n u->mParent->mLeft = v;\n } else {\n u->mParent->mRight = v;\n }\n v->mParent = u->mParent;\n}\n\nvoid RBTreeDeleteFixup(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *s;\n while(node != tree->mTreeRoot && node->mColor == RB_BLACK) {\n if(node == node->mParent->mLeft) {\n s = node->mParent->mRight;\n if(s->mColor == RB_RED) {\n s->mColor = RB_BLACK;\n node->mParent->mColor = RB_RED;\n RBTreeLeftRotate(tree, node->mParent);\n s = node->mParent->mRight;\n }\n if(s->mLeft->mColor == RB_BLACK && s->mRight->mColor == RB_BLACK) {\n s->mColor = RB_RED;\n node = node->mParent;\n } else {\n if(s->mRight->mColor == RB_BLACK) {\n s->mLeft->mColor = RB_BLACK;\n s->mColor = RB_RED;\n RBTreeRightRotate(tree, s);\n s = node->mParent->mRight;\n }\n s->mColor = node->mParent->mColor;\n node->mParent->mColor = RB_BLACK;\n s->mRight->mColor = RB_BLACK;\n RBTreeLeftRotate(tree, node->mParent);\n node = tree->mTreeRoot;\n }\n } else {\n s = node->mParent->mLeft;\n if(s->mColor == RB_RED) {\n s->mColor = RB_BLACK;\n node->mParent->mColor = RB_RED;\n RBTreeRightRotate(tree, node->mParent);\n s = node->mParent->mLeft;\n }\n if(s->mLeft->mColor == RB_BLACK && s->mRight->mColor == RB_BLACK) {\n s->mColor = RB_RED;\n node = node->mParent;\n } else {\n if(s->mLeft->mColor == RB_BLACK) {\n s->mRight->mColor = RB_BLACK;\n s->mColor = RB_RED;\n RBTreeLeftRotate(tree, s);\n s = node->mParent->mLeft;\n }\n s->mColor = node->mParent->mColor;\n node->mParent->mColor = RB_BLACK;\n s->mLeft->mColor = RB_BLACK;\n RBTreeRightRotate(tree, node->mParent);\n node = tree->mTreeRoot;\n }\n }\n }\n node->mColor = RB_BLACK;\n}\n\nvoid RBTreeDelete(RBTree_t *tree, struct RBNode_t *node)\n{\n struct RBNode_t *y = node;\n struct RBNode_t *x;\n RBColor_t origincolor = y->mColor;\n if(node->mLeft == &tree->mSentinelLeaf) {\n x = node->mRight;\n RBTreeTransplant(tree, node, node->mRight);\n } else if(node->mRight == &tree->mSentinelLeaf) {\n x = node->mLeft;\n RBTreeTransplant(tree, node, node->mLeft);\n } else {\n y = RBTreeMinimum(node->mRight, &tree->mSentinelLeaf);\n origincolor = y->mColor;\n x = y->mRight;\n if(y->mParent == node) {\n x->mParent = y;\n } else {\n RBTreeTransplant(tree, y, y->mRight);\n y->mRight = node->mRight;\n y->mRight->mParent = y;\n }\n RBTreeTransplant(tree, node, y);\n y->mLeft = node->mLeft;\n y->mLeft->mParent = y;\n y->mColor = node->mColor;\n }\n if(origincolor == RB_BLACK) {\n RBTreeDeleteFixup(tree, x);\n }\n}\n\nvoid RBTreeAdd(RBTree_t *tree, PrimaryType_t num)\n{\n struct RBNode_t *node = (struct RBNode_t *)malloc(sizeof(struct RBNode_t));\n node->mKey.mPrimaryVal = num;\n RBTreeInsert(tree, node);\n}\n\nvoid RBTreeDel(RBTree_t *tree, PrimaryType_t num)\n{\n RBData_t check;\n check.mPrimaryVal = num;\n struct RBNode_t *node = RBTreeSearch(tree->mTreeRoot, &check, &tree->mSentinelLeaf);\n if(node == &tree->mSentinelLeaf) {\n puts(\"ERROR\");\n return;\n }\n RBTreeDelete(tree, node);\n free(node);\n}\n\nint f(int x)\n{\n ++x;\n while(x % 10 == 0) {\n x /= 10;\n }\n return x;\n}\n\nint main()\n{\n int n, ans = 1;\n scanf(\"%d\", &n);\n RBTree_t Tree;\n RBTreeInitialize(&Tree);\n RBTreeAdd(&Tree, n);\n while(1) {\n n = f(n);\n RBData_t check;\n check.mPrimaryVal = n;\n struct RBNode_t *node = RBTreeSearch(Tree.mTreeRoot, &check, &Tree.mSentinelLeaf);\n if(node == &Tree.mSentinelLeaf) {\n RBTreeAdd(&Tree, n);\n ++ans;\n } else {\n break;\n }\n }\n printf(\"%d\\n\", ans);\n RBTreeDestroy(&Tree);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, i, j, c=1, a;\n scanf(\"%lld\",&n);\n a=n;\n for(;a!=0;)\n {\n j=a%10;\n a=a/10;\n }\n a=n;\n for(i=0; ;i++)\n {\n n++;\n for(;n%10==0;)\n {\n n=n/10;\n }\n if(n==a)\n {\n break;\n }\n c++;\n if(n==j)\n {\n break;\n }\n }\n printf(\"%lld\\n\",c);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;int c=1;\n scanf(\"%d\", &n);\n \n \n {while(1){\n if(n/10==0){c=c+8;break;}\n n=n+1;\n if(n%10==0){\n while(1){\n if(n%10==0){n=n/10;}\n else{break;}\n }\n }\n c++;\n }\n printf(\"%d\", c);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint ans=0;\n\tif(n<10)\n\t{\n\t\tans=9;\n\t}\n\telse\n\t{\n\t\tans=10;\n\t\twhile(n>9)\n\t\t{\n\t\tans+=9-n%10;\n\t\tn/=10;\n\t\t} \n\t}\n\tprintf(\"%d\",ans);\n } "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n \n \n int i=0,j=0;\n \n \n while(1)\n {\n if(n>=1&&n<10)\n {\n printf(\"%d\",9+j);\n return 0;\n }\n i=10-n%10;\n j=j+i;\n n=n+i;\n while(n%10==0)\n n=n/10;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n long long int i=0;\n while(n>=10)\n {\n n++;\n i++;\n while(n%10==0)\n {\n n=n/10;\n }\n \n }\n printf(\"%lld\",i+9);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,sum=1,count=0,i=1,j=0;\n scanf(\"%d\",&n);\n int a[10];\n /*for(j=0;j<10;j++)\n {\n a[j]=0;\n }*/\n if(n>=1&&n<=9)\n {\n sum=sum+8;\n }\n else\n {\n n=n+1;\n while(i>0)\n {\n if(n>=1&&n<=9)\n {\n sum=sum+9;\n break;\n }\n if(n%10!=0)\n {\n n=n+1;\n sum=sum+1;\n }\n else if(n%10==0)\n {\n n=n/10;\n }\n /*for(j=1;j<10;j++)\n {\n if(a[j]==2)\n {\n //break;\n count=1;\n }\n }\n if(count==1)\n break;*/\n i++;\n }\n }\n printf(\"%d\\n\",sum);\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int cou=1;\n scanf(\"%I64d\", &n);\n\n if(n/10 == 0){\n cou = 9;\n goto print;\n }\n n++;\n while(1){\n if(n/10 == 0){\n cou += 9;\n break;\n }\n if(n%10 == 0){\n n /= 10;\n }\n else{\n n++;\n cou++;\n }\n }\n print:\n printf(\"%I64d\", cou);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int a,n,b,d,m,c=0;\n scanf(\"%d\",&n);\n a=n;\n b=n%10;\n d=n/10; m=b+d%10+(d/10)%10+(d/100)%10+(d/1000)%10;\n while (a!=0)\n { a=a/10;\n c++ ;\n }\n if (n%1000000000==0) {printf(\"91\");}\n else if (c==9) {printf(\"%d\",82-m-(d/10000)%10-(d/100000)%10-(d/1000000)%10);}\n else if (c==8) {printf(\"%d\",73-m-(d/10000)%10-(d/100000)%10);}\n else if (c==7) {printf(\"%d\",64-m-(d/10000)%10);}\n else if (c==6) {printf(\"%d\",55-m);}\n else if (c==5) {printf(\"%d\",46-m+(d/1000)%10);}\n else if (c==4) {printf(\"%d\",37-b-d%10-(d/10)%10);}\n else if (c==3) {printf(\"%d\",28-b-d%10);}\n else if (c==2) {printf(\"%d\",19-b);}\n else if (c==1) {printf(\"9\");}\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,q,w,arr[10000];\n scanf(\"%d\",&n);\n int p=n;\n arr[0]=n;\n for(i=0;;i++){\n n=n+1;\n if(n%10!=0){\n arr[++k]=n;\n q=0;\n for(j=0;j<k-1;j++){\n if(arr[j]==n){\n q=1;\n break;\n }\n }\n if(q==1)\n break;\n }\n else\n {\n for(w=0;;w++){\n if(n%10==0)\n n=n/10;\n else{\n q=0;\n for(j=0;j<=k;j++){\n if(arr[j]==n){\n q=1;\n break;\n }\n }\n if(q==0)\n arr[++k]=n;\n break;\n }\n }\n }\n //printf(\"%d %d\\n\",k,n);\n }\n printf(\"%d\",k);\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nunsigned long long d( unsigned long long e){\n\te += 1;\n\twhile( e % 10 == 0){\n\t\te /= 10;\n\t}\n\treturn e;\n}\n\ntypedef struct list list;\nstruct list{\n\tunsigned long long d;\n\tlist *next;\n};\n\nvoid add( list **l, unsigned long long z){\n\tlist *sl = *l;\n\tlist *nl = NULL;\n\tnl = malloc(sizeof(list));\n\tnl -> next = sl;\n\tnl -> d = z;\n\t*l = nl;\n}\nint coll( unsigned long long z, list **l){\n\tlist *sl = *l;\n\twhile( sl != NULL){\n\t\tif( z == sl -> d){\n\t\t\treturn 1;\n\t\t}\n\t\t// printf(\"<%d> \", sl->d);\n\t\tsl = sl -> next;\n\t}\t\n\treturn 0;\n}\nint len( list **l){\n\tint c = 0;\n\tlist *sl = *l;\n\twhile( sl -> next != NULL){\t\t\n\t\t++c;\n\t\tsl = sl -> next;\n\t\t// printf(\"<%d> \", sl->d);\n\t}\n\treturn c;\n}\nint main(int argc, char const *argv[])\n{\n\tunsigned long long a = 0;\n\t\n\tscanf(\"%d\", &a);\n\tlist *l = NULL;\n\tl = malloc( sizeof(list));\n\twhile( coll(a, &l) != 1){\n\t\tadd(&l, a);\t\t\n\t\ta = d(a);\n\t}\n\tprintf(\"%d\", len(&l));\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong remove_zeros(long num) {\n return num % 10 == 0 ? remove_zeros(num / 10) : num;\n}\n\nint solve(long num) {\n if(num < 10)\n return 9;\n\n return 10 - (num % 10) + solve(remove_zeros(num / 10 + 1));\n}\n\nint main() {\n long num;\n\n scanf(\"%ld\", &num);\n printf(\"%d\\n\", solve(num));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0,a=0,i=0;\n scanf(\"%d\",&n);\n if(n%10==n)\n {\nprintf(\"9\");\nreturn 0;\n a=n;\n i=2;\n }\n n=n+1;\n c=1;\n while(1)\n {\n\n if(n%10==0)\n {\n n=n/10;\n if((n%10==n)&&(i==0)){c=c+9;break;i=1;}\n\n /*if((i==2)&&(a==n))break;*/\n }\n else{n++;c++;}\n }\n /* if(i==2)printf(\"%d\",c);*/\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int x,y,z;\n y=0;\n z=-1;\n scanf(\"%d\",&x);\n while (1)\n {\n if(z==x)\n break;\n if(z==-1&&x<10)\n z=x;\n y++;\n x+=1;\n while(x%10==0)\n x/=10;\n\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n long long int n, a, b, c=1, e;\n scanf(\"%lld\", &n);\n\n if(n>9) {\n n++;\n c++;\n }\n\n for( ; ; ) {\n\n if(!(n%10))\n n /= 10;\n\n else if(n>9) {\n a = n%10;\n c += 10-a;\n n += 10-a;\n n /= 10;\n }\n else if(n<10) {\n c += 8;\n break;\n }\n\n }\n\n printf(\"%lld\", c);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint lt(int i){\n int k,s=1;\n for (k=1;k<=i;k++)\n s=s*10;\n return s;\n}\nint f(int x){\n\tint f,i=0,y=x+1;\n\twhile (y%lt(i)==0){\n\t\ti++;\n\t}\n\tf=y/lt(i-1);\n\treturn f;\n}\nint main() {\n\tint a[1000],count=1,kq,x,i=0,j,kt=1;\n\tscanf(\"%d\",&x);\n\tkq=x;\n\tif (x==10) count=19;\n\telse if (x<10) count=9;\n\telse{\n\twhile (kq>10){\n\t\tkq=f(kq);\n\t\ta[i]=kq;\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (a[i]==a[j]){\n\t\t\t\tkt=0;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t\tif (kt==1) count++;\n\t\ti++;\n\t}\n\tcount+=8;\n\t}\t\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint f(int a);\n\nint ans=1;\n\nint main(void)\n{\n int a;\n int b=0;\n \n scanf(\"%d\", &a);\n \n for(;a!=1 || b!=1;)\n {\n if(a==1)\n {\n b=1;\n }\n a=f(a);\n }\n printf(\"%d\", ans);\n \n return 0;\n}\n\nint f(int a)\n{\n a+=1;\n for(;a%10==0;)\n {\n a/=10;\n }\n ans++;\n return a;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, result = 2, s = 0;\n\tscanf(\"%d\", &n);\n\tn += 1;\n\twhile (n != 1) {\n\t\ts = 10 - n % 10;\n\t\tresult += s;\n\t\tn += s;\n\t\twhile (!(n % 10)) \n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\", result);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10],i=0,c=0,n,p=1,k;\n for(k=0;k<10;k++)\n {\n a[k]=0;\n }\n scanf(\"%d\",&n);\n while(p)\n {\n if(n%10==0)\n {\n n/=10;\n }\n else\n {\n if(n<10)\n {\n if(a[0]==n)\n {\n p=0;\n }\n else\n {\n a[i]=n;\n i++;\n }\n }\n if(n%10!=0&&p==1)\n {\n printf(\"%d\\n\",n);\n c++;\n }\n n++;\n }\n }\n printf(\"%d\\n\",c);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, dem = 0;\n scanf(\"%d\", &n);\n while (n > 10) {\n int k = n % 10;\n if (k != 0) {\n dem += (10 - k);\n n += (10 - k);\n }\n else n /= 10;\n }\n if (n == 10) dem += 19;\n else\n dem += (11-n);\n printf(\"%d\", dem);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0,a;\n scanf(\"%d\",&n);\n a=n;\n n=n+1;\n c=1;\n while(n!=0)\n {\n if(n%10==0)\n {\n n=n/10;\nif((n==1)&&(a!=1)){printf(\"%d\",c+1);return 0;}\nif((n==1)&&(a==1)) {printf(\"%d\",c);return 0;}\n }\n else\n {\n\n n++;\n c++;\n\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int count = 0;\n int i;\n for(i = n; i >= 1; )\n {\n\n if(i == n)\n {\n count++;\n }\n i++;\n while(i % 10 == 0)\n {\n i /= 10;\n }\n\n if(i % 10 != 0)\n {\n count++;\n }\n\n if(i == 1)\n {\n break;\n }\n\n\n\n }\n\n printf(\"%d\\n\", count);\n\n return 0;\n\n}\n"}, {"source_code": "/*1098 = 9 + 10 + 1 + 2\n\n10000 = 100001 10002 .... 10009 1001 1002 .... 1009 101 102 ... 109 11 12 ... 19 2\n\n\n\n10 + 1 + 9 + \n999 1 2 3 4 5 6 7 8 9 \n\n9 + 1 \n\n9 + 9 + 1 + 1\n\n\n100 = 9 + 1 + 9 + 9\n\n100 101 102 103 ... 109 (10)\n11 12 13 .. 19 (9)\n2 3 4 ...9 1 (9)\n\n\n343\n\n9 + 1 + 5 + 6 = 21\n\n343 344 345 346 347 348 349\n35 36 37 38 39\n4 5 6 7 8 9 1 2 3\n*/\n#include<stdio.h>\nint main()\n{\n\tlong int a;\n\tscanf(\"%ld\",&a);\n\tint count = 1;\n\twhile(a!=0)\n\t{\n\t\tif(a/10 == 0)\n\t\t{\n\t\t\tcount += 9;\n\t\t\ta = a/10;\t\t\t\n\t\t}\n\t\telse{\n\t\t\tint b = a%10;\n\t\t\tcount += 9 - b;\n\t\t\ta = a/10;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n,a=9;\n\tscanf(\"%d\",&n);\n\tif(n%10==0)\n\t a++;\n\tn++;\n\twhile(n>=10)\n {\n\t\ta++;\n\t\tn++;\n\t\twhile(n%10==0)\n\t\t n=n/10;\n\t}\n\tprintf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count=1;\n if(n<=9)\n count=9;\n else\n {\n while(n!=1)\n {\n n++;\n while(n%10==0)\n {\n n=n/10;\n }\n count++;\n }\n }\n\n if(count<9)\n printf(\"%d\",count+8);\n else\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, dem = 0;\n scanf(\"%d\", &n);\n if (n == 1) printf(\"9\");\n else {\n while (n >= 10) {\n int k = n % 10;\n dem += (10 - k);\n n += (10 - k);\n while(n % 10 == 0)\n n /= 10;\n }\n dem += (11-n);\n printf(\"%d\", dem);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,z,i,m,c;z=0;scanf(\"%d\",&n);\n\tc=1;m=n;\n\twhile(z!=1)\n\t{\nfor(i=n;(i+1)%10!=0;i++)\n{\n\tz=i+1;\n\tc++;\n}z=i+1;\nif(z%10==0)\n{\n\tc++;\n\twhile(z%10==0)\n\t{\n\t\tz=z/10;\n\t}n=z;\n}\n}if(m==1)\nprintf(\"%d\",c-1);\nelse printf(\"%d\",c);}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch=getchar();int i=1,total=05;\n while(ch!='\\n')\n {\n ch=ch-'0';\n if(i==1)\n {\n total+=9;\n }\n else\n total=total+10-ch-1;\n ch=getchar();\n i++;\n }\n printf(\"%d\",total+1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch=getchar();int i=1,total=0;\n while(ch!='\\n')\n {\n ch=ch-'0';\n if(i==1)\n {\n total+=9;\n }\n else\n total=total+10-ch-1;\n ch=getchar();\n i++;\n }\n printf(\"%d\",total+1);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,temp,j,m=0,k=0;\n scanf(\"%d\",&n);\n if(n<10)\n {\n printf(\"9\");\n return 0;\n }\n if(n%10 == 0)\n m++;\n n++;\n for(;1;)\n {\n if(n<10)\n break;\n for(;1;)\n {\n if(n%10 != 0)\n {\n temp = n%10;\n break;\n }\n n=n/10;\n }\n if(m>10)\n {\n m=m+(10-temp);\n }\n else\n m++;\n n=n/10;\n }\n printf(\"%d\",m+9);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,t,dig,count=0;\nscanf(\"%d\",&n);\nwhile(n!=0)\n{\ndig=n%10;\ncount+=9-dig;\nt=n;\nn/=10;\n}\ncount+=t+1;\nprintf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,n=10;\n\tscanf(\"%d\",&i);\n\tif(i>10){\n\ti++;\n\tfor(i,n;i>=10;i++,n++)\n\t{\n\t\twhile(i%10==0){i/=10;}\n\t}\n\tprintf(\"%d\\n\",--n);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\",9);\n\t}\n\t\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch=getchar();int i=1,total=05;\n while(ch!='\\n')\n {\n ch=ch-'0';\n if(i==1)\n {\n total+=9;\n }\n else\n total=total+10-ch-1;\n ch=getchar();\n i++;\n }\n printf(\"%d\",total+1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, count;\n count = 1;\n scanf(\"%d\", &n);\n\n while (n != 1) {\n n++;\n while (n % 10 == 0) n /= 10;\n count++;\n }\n\n printf(\"%d\\n\", count);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int x,y;\n y=1;\n scanf(\"%d\",&x);\n while (x!=1)\n {\n y++;\n x+=1;\n while(x%10==0)\n x/=10;\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n int count=1;\n scanf(\"%d\", &n);\n if(n==1)\n {\n printf(\"9\");\n return 0;\n }\n else\n {\n while(n!=1)\n {\n n+=1;\n count+=1;\n //printf(\"%d\\n\",n);\n if(n%10==0)\n {\n while (n%10==0)\n {\n n/=10;\n }\n }\n }\n }\n printf(\"%d\", count);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;int c=1;\n scanf(\"%d\", &n);\n if(n==1){printf(\"9\");}\n \n else{while(1){\n if(n==1){break;}\n n=n+1;\n if(n%10==0){\n while(1){\n if(n%10==0){n=n/10;}\n else{break;}\n }\n }\n c++;\n }\n printf(\"%d\", c);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong aa;\n\tint i,a[15],n,k;\n\tscanf(\"%ld\",&aa);\n\tfor(i=1;aa!=0;i++)\n\t{\n\t\ta[i]=aa%10;\n\t\taa/=10;\n\t}\n\tk=i-1;\n\tn=0;\n\tfor(i=1;i<k;i++)\n\t{\n\t\tn+=9-a[i];\n\t}\n\tn+=10;\n\tprintf(\"%d\",n);\n\treturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong aa;\n\tint i,a[15],n,k;\n\tscanf(\"%ld\",&aa);\n\tfor(i=1;aa!=0;i++)\n\t{\n\t\ta[i]=aa%10;\n\t\taa/=10;\n\t}\n\tk=i-1;\n\tn=0;\n\tfor(i=1;i<k;i++)\n\t{\n\t\tn+=9-a[i];\n\t}\n\tn+=10;\n\tprintf(\"%d\",n);\n\treturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,temp=0,j,m=0,k=0;\n scanf(\"%d\",&n);\n int A[300000];\n for(i=0;i<n;i++)\n A[i]=0;\n n++;\n for(;1;)\n {\n for(;i;)\n {\n if(n%10 != 0)\n break;\n n=n/10;\n }\n if(temp == 0)\n {\n A[m]=n;\n m++;\n }\n if(temp >0 && n==1)\n break;\n if(n == 1)\n temp++;\n n++;\n }\n printf(\"%d\",m+1);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, dem = 0;\n scanf(\"%d\", &n);\n while (n > 10) {\n int k = n % 10;\n if (k != 0) {\n dem += (10 - k);\n n += (10 - k);\n }\n else n /= 10;\n }\n if (n == 10) dem += 19;\n else\n dem += (11-n);\n printf(\"%d\", dem);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint fnc(int n)\n{\n int ans;\n ans=n+1;\n while(ans%10==0)\n {\n ans=ans/10;\n }\n return ans;\n\n}\n\nint main()\n{\n int a[100],p,i,cn=1;\n scanf(\"%d\",&p);\n i=fnc(p);\n while(i!=1)\n {\n i=fnc(i);\n cn++;\n }\n printf(\"%d\",cn+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,x=0,y=0,j,temp,area;\n scanf(\"%d\",&n);\n n+=1;\n for(i=0;i<100;i++)\n {\n if(n==1)\n break;\n if(n%10==0)\n n/=10;\n else\n {\n n++;\n x++;\n }\n }\n printf(\"%d\",x+2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int j,rem,n,count=0,div;\n scanf(\"%d\",&n);\n j=n;\n div=n/10;\n if(n>=0&&n<=9){\n printf(\"9\\n\");\n return 0;\n }\n while(div!=0){\n rem=j%10;\n if(rem!=1&&rem!=0){\n count=count+(9-rem);\n }\n else{\n count=count+9;\n }\n div=j/10;\n j=div;\n }\n printf(\"%d\\n\",count+1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,i,k,j,s;\n\tscanf(\"%I64d\",&n);\n\ts=n;\n\tn=n+1;\n\tfor(i=1; ;i++){\n\t\n\tif(n%10==0)\n\tn=n/10;\n\telse\n\tbreak;}\n\tfor(i=1;n!=1;i++)\n\t{\n\t\tn=n+1;\n\t\tfor(k=1; ;k++)\n\t\t{\n\t\tif(n%10==0)\n\t\tn=n/10;\n\t\telse\n\t\tbreak;\n\t}\t\n\tif(n==s)\n\t\tj=i+1;\n\t\telse\n\t\tj=i+2;\n\t}\n\tprintf(\"%I64d\",j);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch=getchar();int i=1,total=0,n;\n while(ch>='0'&&ch<='9')\n {\n ch=ch-'0';\n if(i==1)\n {\n total+=9;\n }\n else\n total=total+10-ch-1;\n ch=getchar();\n i++;\n }\n printf(\"%d\",total+1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k=1;\n scanf(\"%lld\",&n);\n if(n>=10)\n {\n while(1)\n {\n n=n+1;\n if(n%10==0)\n {\n while(n%10==0)\n n=n/10;\n }\n k++;\n if(n==1)\n break;\n }\n printf(\"%lld\\n\",k);\n }\n else\n {\n while(1)\n {\n\n n=n+1;\n if(n%10==0)\n {\n while(n%10==0)\n n=n/10;\n }\n k++;\n if(k>=9&&n==1)\n break;\n }\n printf(\"%lld\\n\",k);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, result = 1, s = 0;\n\tscanf(\"%d\", &n);\n\twhile (n != 1) {\n\t\ts = 10 - n % 10;\n\t\tresult += s;\n\t\tn += s;\n\t\twhile (!(n % 10)) \n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\", result);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n while(n!=1)\n {\n n++;\n while(n%10==0)\n n/=10;\n c++;\n }\n printf(\"%d\\n\",c+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n n=n+1;\n c=1;\n while(n!=0)\n {\n if(n%10==0)\n {\n n=n/10;\n }\n else\n {\n if(n==1){printf(\"%d\",c+1);return 0;}\n n++;\n c++;\n\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n if(n%10==0)\n {\n n++;\n c++;\n }\n if(n<10)\n {\n c++;\n }\n\n while(1)\n {\n if(n>=10)\n {\n while(n%10==0)\n {\n n=n/10;\n }\n n=n+1;\n c=c+1;\n }\n if(n<10)\n {\n printf(\"%d\",c+8);\n break;\n }\n\n }\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, result = 1, s = 0;\n\tscanf(\"%d\", &n);\n\twhile (n != 1) {\n\t\ts = 10 - n % 10;\n\t\tresult += s;\n\t\tn += s;\n\t\twhile (!(n % 10)) \n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\", result);\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, c, cnt;\n\n\tscanf(\"%d\", &n);\n\tc = n;\n\tcnt = 0;\n\twhile (c != 1) {\n\t\tcnt++;\n\t\tc++;\n\t\twhile (c % 10 == 0)\n\t\t\tc /= 10;\n\t}\n\tprintf(\"%d\\n\", cnt + 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i=0,j=2,k,l,n;\n\nscanf(\"%d\",&n);\nn++;\nwhile(n!=1){\n\n if(n%10==0){i++;\n n=n/10;}\nelse n++;\n j++;\n //if(n==1)break;\n}\nprintf(\"%d\",j-i);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint f(int a);\n\nint ans=1;\n\nint main(void)\n{\n int a;\n int b=0;\n \n scanf(\"%d\", &a);\n \n for(;a!=1 || b!=1;)\n {\n if(a==1)\n {\n b=1;\n }\n a=f(a);\n }\n printf(\"%d\", ans);\n \n return 0;\n}\n\nint f(int a)\n{\n a+=1;\n for(;a%10==0;)\n {\n a/=10;\n }\n ans++;\n return a;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,f=0,count=0,rem;\n scanf(\"%d\",&n);\n while(f==0)\n {\n rem=n%10;\n count+=(10-rem);\n n+=(10-rem);\n while(n%10==0)\n {\n n/=10;\n if(n<10)\n {\n count+=9;\n f=1;\n }\n }\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n long long int i=1;\n scanf(\"%lld\",&n);\n while(n>1)\n {\n n=n+1;\n while(n%10==0)\n {\n n=n/10;\n }\n i++;\n }\n printf(\"%lld\",i);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,ans=9;\n\tscanf(\"%i\",&n);///5\n if(n>9)\n {\n if(n%10==0)\n ans++,n++;///\n\n while(n>=10)\n {\n ans++,n++;///19 20\n while(n%10==0)///2\n n/=10;///2\n }\n }\n else\n {\n if(n!=1)\n ans=11-n;\n else\n ans=10;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,sum=1,count=0,i=1;\n scanf(\"%d\",&n);\n if(n>1)\n {\n n=n+1;\n while(i>0)\n {\n if(n%10!=0&&n!=1)\n {\n n=n+1;\n sum=sum+1;\n }\n else if(n%10==0&&n!=1)\n {\n n=n/10;\n }\n else if(n==1)\n {\n sum++;\n break;\n count=1;\n }\n i++;\n }\n printf(\"%d\\n\",sum);\n }\n else if(n==1)\n printf(\"9\\n\");\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint count=0;\nvoid recur(int n){\n if(n==0||n==1) return;\n else{\n n = n+1;\n while(n%10==0){\n n=n/10;\n }\n count++;\n recur(n);\n }\n}\nint main(){\n int num;\n scanf(\"%d\",&num);\n recur(num);\n printf(\"%d\",count+1);\n}"}, {"source_code": "#include<stdio.h>\nint a[11],b[11]={0};\nint count=0;\nvoid dfs(int step)\n{\tint i;\n\tif(step==10)\n\t{\tif(a[1]*100+a[2]*10+a[3]+a[4]*100+a[5]*10+a[6]==a[7]*100+a[8]*10+a[9])\n\t\t{\n \t\t printf(\"%d%d%d+%d%d%d=%d%d%d\\n\",a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);\n\t\t count+=1;\n\t\t}\n\t\t\n\t\treturn ;\n\t}\n\tfor(i=1;i<=9;i++)\n\t{\tif(b[i]==0)\t\n\t\t{\ta[step]=i;\n\t\t\tb[i]=1;\n\t\t\tdfs(step+1);\n\t\t\tb[i]=0;\n\t\t}\n\t}\n}\nint main()\n{\tdfs(1);\n\tprintf(\"%d\",count/2);\n } \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,n=9;\n\tscanf(\"%d\",&i);\n\tif(i!=89){\n\tif(i>=10){\n\ti++;\n\tfor(i,n;i>=10;i++,n++)\n\t{\n\t\twhile(i%10==0){i/=10;}\n\t}\n\tprintf(\"%d\\n\",n);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\\n\",9);\n\t}}\n\telse{printf(\"10\\n\");}\n\t\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n long long int n, a, b, c=1, d, e, f;\n scanf(\"%lld\", &n);\n\n for( ; ; ) {\n if(n>=100) {\n a = n%100;\n c += 100-a;\n n += 100-a;\n n /= 100;\n }\n if(n<100 && n>9) {\n a = n%10;\n c += 10-a;\n n += 10-a;\n n /= 10;\n }\n if(n<10) {\n c += 10-n;\n n += 10-n;\n n /= 10;\n }\n if(n==1)\n break;\n }\n\n printf(\"%lld\", c);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int i=0,j=0;\n int n;\n scanf(\"%d\",&n);\n \n \n \n while(1)\n {\n if(n%10==0)\n {\n n=n/10;\n continue;\n }\n else\n {\n i=10-n%10;\n j=i+j;\n n=n+i;\n if(n>=1&&n<=10)\n {\n printf(\"%d\",j-1+n);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0,a;\n scanf(\"%d\",&n);\n a=n;\n n=n+1;\n c=1;\n while(n!=0)\n {\n if(n%10==0)\n {\n n=n/10;\nif((n==1)&&(a!=1)){printf(\"%d\",c+1);return 0;}\nif((n==1)&&(a==1)) {printf(\"%d\",c);return 0;}\n }\n else\n {\n\n n++;\n c++;\n\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check(int* a){\n\t\n\tint flag=0, j;\n\tfor(j=1;j<10;j++){\n\t\tif(a[j]==0){\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t}\n\t\telse{\n\t\t\tflag=1;\n\t\t}\n\t}\n\treturn flag;\t\n}\nint main(){\n\tlong long n,temp;\n\tscanf(\"%lld\",&n);\n\tint flag=0,count=0,i,j;\n\tint a[10]={0,0,0,0,0,0,0,0,0,0};\n\ttemp=n;\n\tint iter=0,it=0;\n\twhile(1){\n\t\titer++;\n\t\tfor(i=0;;i++){\n\t\t\tit++;\n\t\t\tif(check(a))\n\t\t\t\tbreak;\n\t\t\tif(it!=1 && temp%10==0){\n\t\t\t\ttemp=temp/10;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcount++;\n\t\t\tif(temp<10){\n\t\t\t\ta[temp]=1;\n\t\t\t}\n\t\t\ttemp++;\n\t\t}\n\t\t//condition for flag\n\t\tflag=check(a);\n\t\tif(flag==1) break;\n\t\tif(iter==5)\n\t\t\tbreak;\n\t}\t\n\tprintf(\"%lld\\n\", count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10],i=0,c=0,n,p=1,k;\n for(k=0;k<10;k++)\n {\n a[k]=0;\n }\n scanf(\"%d\",&n);\n while(p)\n {\n if(n%10==0)\n {\n n/=10;\n }\n else\n {\n if(n<10)\n {\n if(a[0]==n)\n {\n p=0;\n }\n else\n {\n a[i]=n;\n i++;\n }\n }\n if(n%10!=0&&p==1)\n {\n printf(\"%d\\n\",n);\n c++;\n }\n n++;\n }\n }\n printf(\"%d\\n\",c);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<stdlib.h>\n\nint main(){\n\n long long int num;\n int cnt=0,end=-1,on=0;\n scanf(\"%lld\",&num);\n\n while(1){\n if(num<10){\n cnt++;\n end = num;\n cnt += 8;\n break;\n }\n\n while((num%10)!=0){\n cnt++;\n num++;\n }\n\n num = num/10;\n }\n printf(\"%d\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,temp,j,m=0,k=0;\n scanf(\"%d\",&n);\n if(n<10)\n {\n printf(\"10\");\n return 0;\n }\n if(n%10 == 0)\n m++;\n n++;\n for(;1;)\n {\n if(n<10)\n break;\n for(;1;)\n {\n if(n%10 != 0)\n {\n temp = n%10;\n break;\n }\n n=n/10;\n }\n m=m+(10-temp);\n n=n/10;\n }\n printf(\"%d\",m+9);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint num=0;\n\twhile(n!=1){\n\t\tn+=1;\n\t\tif(n%10==0){\n\t\twhile(n%10==0){\n\t\tn/=10;\t\n\t\t}\n\t\t\n\t }\n\t num++;\n\t}\n\tnum+=1;\n\tprintf(\"%d\",num);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n int cou=1;\n scanf(\"%d\", &n);\n\n n++;\n while(1){\n if(n/10 == 0){\n cou += 9;\n break;\n }\n if(n%10 == 0){\n n /= 10;\n }\n else{\n n++;\n cou++;\n }\n }\n printf(\"%d\", cou);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tint n,a=1;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n a=0;\n\tdo\n {\n n=n+1;\n a=a+1;\n while(n%10==0)\n n=n/10;\n }while(n!=1);\n printf(\"%d\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"9\\n\");\n return 0;\n }\n while(n!=1)\n {\n n++;\n while(n%10==0)\n n/=10;\n c++;\n }\n printf(\"%d\\n\",c+10);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int count=1,x,num;\n scanf(\"%d\",&x);\n num=x+1;\n do\n {\n if(num%10==0)\n {\n num=num/10;\n }\n else\n {\n num=num+1;\n count++;\n }\n }while(num !=1);\n printf(\"%d\",++count);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int c=1;\n while(1){\n if(n==1){break;}\n n=n+1;\n if(n%10==0){\n while(1){\n if(n%10==0){n=n/10;}\n else{break;}\n }\n }\n c++;\n }\n printf(\"%d\", c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,i,j=2,k;\n\tscanf(\"%I64d\",&n);\n\tn=n+1;\n\tfor(i=1;n!=1;i++)\n\t{\n\t\tif(n%10==0)\n\t\tn=n/10;\n\t\telse {\n\t\tn=n+1;\n\t\tj=j+1;}\n\t}\n\tprintf(\"%I64d\",j);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j,a,k,m=0,l=0;\n scanf(\"%d\",&a);\n k=a;\n while(1)\n {\n a++;\n if(a==9)\n {\n if(l==1)\n {\n break;\n }\n else if(m==1)\n {\n i++;\n break;\n }\n else\n {\n i=i+2;\n break;\n }\n }\n while(a%10==0)\n {\n a=a/10;\n }\n if (a==1)\n {\n m=1;\n }\n if(a==9)\n {\n l=1;\n }\n i++;\n }\n if(k==1)\n {\n printf(\"%d\",i);\n }\n else if(k==9)\n {\n printf(\"%d\",i-1);\n }\n else\n {\n printf(\"%d\",i+1);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n n=n+1;\n c=1;\n while(n!=0)\n {\n if(n%10==0)\n {\n n=n/10;\nif(n==1){printf(\"%d\",c+1);return 0;}\n }\n else\n {\n\n n++;\n c++;\n\n }\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tint n, result = 1, s = 0;\n\tscanf(\"%d\", &n);\n\tn++;\n\tif (n % 10 && n > 10)result++;\n\telse while (!(n % 10))\n\t\tn /= 10;\n\twhile(n>100)\n\t{\n\t\ts = 10 - n % 10;\n\t\tresult += s;\n\t\tn += s;\n\t\twhile (!(n % 10))\n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\", 8 + 9*(n/10)+result);\t\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,i,k,j;\n\tscanf(\"%I64d\",&n);\n\t\n\tfor(i=1;n!=1;i++)\n\t{\n\t\tn=n+1;\n\t\tfor(k=1; ;k++)\n\t\t{\n\t\tif(n%10==0)\n\t\tn=n/10;\n\t\telse\n\t\tbreak;\n\t}\n\t\t\n\t\tj=i+1;\n\t}\n\tprintf(\"%I64d\",j);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tint n, result = 1, s = 0;\n\tscanf(\"%d\", &n);\n\tn++;\n\tif (n % 10 && n > 10)result++;\n\telse while (!(n % 10))\n\t\tn /= 10;\n\twhile(n>100)\n\t{\n\t\ts = 10 - n % 10;\n\t\tresult += s;\n\t\tn += s;\n\t\twhile (!(n % 10))\n\t\t\tn /= 10;\n\t}\n\tprintf(\"%d\", 8 + 9*(n/10)+result);\t\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, dem = 0;\n scanf(\"%d\", &n);\n if (n == 1) printf(\"9\");\n else {\n while (n >= 10) {\n int k = n % 10;\n dem += (10 - k);\n n += (10 - k);\n while(n % 10 == 0)\n n /= 10;\n }\n dem += (11-n);\n printf(\"%d\", dem);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main(){\n\n int i,j,k,l,m,n;\n int length,number,tests,ans,anslist[10000],flag;\n flag=0;\n scanf(\"%d\",&number);\n ans=1;\n j=0;\n while(1){\n number=number+1;\n while(number%10==0){\n number=number/10;\n\n }\n\n for (m=0;m<=j ;m++ )\n {\n if(anslist[m]==number){\n flag=1;\n }\n }\n if(flag==1){\n break;\n }\n anslist[j]=number;\n j++;\n ans++;\n //printf(\"\\n%d\",number);\n\n\n\n }\n printf(\"%d\",ans);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int n,s=0;\nscanf(\"%d\",&n);if(n==1)\ns-=1;\nwhile(n>0)\n{s+=9-(n%10);\nn/=10;}\nprintf(\"%d\\n\",s+2);return 0;}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n int cou=1;\n scanf(\"%d\", &n);\n\n n++;\n while(n != 1){\n if(n%10 == 0){\n n /= 10;\n }\n else{\n n++;\n cou++;\n }\n }\n cou++;\n printf(\"%d\", cou);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n long long int n, a, b, c=1, e;\n scanf(\"%lld\", &n);\n\n for( ; ; ) {\n\n if(!(n%10))\n n /= 10;\n\n else if(n>9) {\n a = n%10;\n c += 10-a;\n n += 10-a;\n n /= 10;\n }\n else if(n<10) {\n c += 8;\n break;\n }\n\n }\n\n printf(\"%lld\", c);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n int num=0;\n if(n==1){\n \tprintf(\"9\");\n }\n else{\t\n while(n!=1){\n n+=1;\n if(n%10==0){\n while(n%10==0){\n n/=10; \n }\n \n }\n num++;\n }\n num+=1;\n printf(\"%d\",num);\n}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n, i, j, sum, count = 1;\n while(scanf(\"%lld\", &n) != EOF)\n {\n while(n != 1)\n {\n if(n % 10 == 0)\n {\n n = n + 1;\n count++;\n }\n while(n % 10 != 0)\n {\n n = n + 1;\n count++;\n }\n\n while(n % 10 == 0)\n {\n n = n / 10;\n }\n }\n printf(\"%d\\n\", count);\n count = 1;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int i=0,j=0;\n int n;\n scanf(\"%d\",&n);\n \n \n \n while(1)\n {\n if(n%10==0)\n {\n n=n/10;\n continue;\n }\n else\n {\n i=10-n%10;\n j=i+1+j;\n n=n+i;\n if(n>=1||n<=10)\n {\n printf(\"%d\",j);\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int t = 1;\n\nvoid find( long long int last )\n{\n //printf(\"tt%lld %lld \", last, t);\n if( last == 1 && t != 1 )\n {\n return;\n }\n\n if( last % 10 == 0 && t != 1 )\n {\n\n return find(last / 10);\n }\n\n else\n {\n t++;\n return find(last+1);\n }\n\n\n}\n\nint main()\n{\n long long int n;\n scanf(\"%lld\", &n);\n\n find(n);\n if( n == 1 )\n {\n t = t - 1;\n }\n printf(\"%lld\", t);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n int cou=1;\n scanf(\"%d\", &n);\n\n n++;\n while(1){\n if(n/10 == 0){\n cou += 9;\n break;\n }\n if(n%10 == 0){\n n /= 10;\n }\n else{\n n++;\n cou++;\n }\n }\n printf(\"%d\", cou);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long a,count;\n\n scanf(\"%lld\",&a);\n count=0;\n if(a==1)\n {\n count+=9;\n }\nwhile(a>1)\n{\n\n count+=10-(a%10);\n a+=10-(a%10);\n while(a%10==0)\n {\n a=a/10;\n }\n if(a==1){count++;break;}\n}\nprintf(\"%lld\\n\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n if(n%10==0)\n {\n n++;\n c++;\n }\n if(n<10)\n {\n c++;\n }\n\n while(1)\n {\n if(n>=10)\n {\n while(n%10==0)\n {\n n=n/10;\n }\n n=n+1;\n c=c+1;\n }\n if(n<10)\n {\n printf(\"%d\",c+8);\n break;\n }\n\n }\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"9\\n\");\n return 0;\n }\n while(n!=1)\n {\n n++;\n while(n%10==0)\n n/=10;\n c++;\n }\n printf(\"%d\\n\",c+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k=1;\n scanf(\"%lld\",&n);\n if(n>=10)\n {\n while(1)\n {\n n=n+1;\n if(n%10==0)\n {\n while(n%10==0)\n n=n/10;\n }\n k++;\n if(n==1)\n break;\n }\n printf(\"%lld\\n\",k);\n }\n else\n {\n while(1)\n {\n\n n=n+1;\n if(n%10==0)\n {\n while(n%10==0)\n n=n/10;\n }\n k++;\n if(k>=9&&n==1)\n break;\n }\n printf(\"%lld\\n\",k);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,i,j=2,k;\n\tscanf(\"%I64d\",&n);\n\tn=n+1;\n\tfor(i=1;n!=1;i++)\n\t{\n\t\tif(n%10==0)\n\t\tn=n/10;\n\t\telse {\n\t\tn=n+1;\n\t\tj=j+1;}\n\t}\n\tprintf(\"%I64d\",j);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c = 2,input,count = 0;\n scanf(\"%d\",&n);\n input = n+1;\n if(n<10)\n {\n while(count != 2)\n {\n\n if(input %10 != 0)\n {\n input++;\n c++;\n // printf(\"%d \",c);\n // printf(\"i%d \\n\",input);\n }\n else\n {\n while(input % 10 == 0)\n {\n input = input /10;\n // printf(\"i%d \\n\",input);\n }\n if(input == 1)\n {\n count++;\n }\n\n // c++;\n // printf(\"%d \",c);\n }\n }\n\n }\n else\n {\n while(input != 1)\n {\n if(input %10 != 0)\n {\n input++;\n c++;\n // printf(\"%d \",c);\n // printf(\"i%d \\n\",input);\n }\n else\n {\n while(input % 10 == 0)\n {\n input = input /10;\n // printf(\"i%d \\n\",input);\n }\n\n\n\n // c++;\n // printf(\"%d \",c);\n }\n }\n }\n printf(\"%d\",c);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10],i=0,c=0,n,p=1,k;\n for(k=0;k<10;k++)\n {\n a[k]=0;\n }\n scanf(\"%d\",&n);\n while(p)\n {\n if(n%10==0)\n {\n n/=10;\n }\n else\n {\n if(n<10)\n {\n if(a[0]==n)\n {\n p=0;\n }\n else\n {\n a[i]=n;\n i++;\n }\n }\n if(n%10!=0&&p==1)\n {\n printf(\"%d\\n\",n);\n c++;\n }\n n++;\n }\n }\n printf(\"%d\\n\",c);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int n;\nint c;\n\nint count(){\n if(n!=1){c = 1;}\n n++;\n while(n != 1){\n while(n%10 == 0){\n n= n/10;\n }\n //printf(\"%li\\n\",n);\n c++;\n if(n == 1){\n break;\n }\n n++;\n }\n return 0;\n}\n\n\nint main(void) {\n\n scanf(\"%li\", &n);\n\n count();\n printf(\"%d\\n\", c);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k=1;\n scanf(\"%lld\",&n);\n\n while(1)\n {\n n=n+1;\n if(n%10==0){\n while(n%10==0)\n n=n/10;}\n ++k;\n if(n==1)\n break;\n }\n printf(\"%lld\\n\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j,a;\n scanf(\"%d\",&a);\n while(1)\n {\n a++;\n if(a==9)\n {\n i=i+2;\n break;\n }\n while(a%10==0)\n {\n a=a/10;\n }\n i++;\n }\n printf(\"%d\",i+1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,z,i,m,c;z=0;scanf(\"%d\",&n);\n\tc=1;m=n;\n\twhile(z!=1)\n\t{\nfor(i=n;(i+1)%10!=0;i++)\n{\n\tz=i+1;\n\tc++;\n}z=i+1;\nif(z%10==0)\n{\n\tc++;\n\twhile(z%10==0)\n\t{\n\t\tz=z/10;\n\t}n=z;\n}\n}if(m==1)\nprintf(\"%d\",c-1);\nelse printf(\"%d\",c);}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, i, j, c=1, a;\n scanf(\"%lld\",&n);\n a=n;\n if(n==9){printf(\"9\");return 0;}\n for(i=0; ;i++)\n {\n n++;\n for(;n%10==0;)\n {\n n=n/10;\n }\n if(n==a)\n {\n break;\n }\n c++;\n if(n==1)\n {\n break;\n }\n }\n printf(\"%lld\\n\",c);\n}\n"}, {"source_code": "#include <stdio.h>\nint main () {\n int n, ans = 0;\n scanf (\"%d\", &n);\n \n while (n != 1) {\n n ++;\n while (!(n % 10)) {\n n /= 10;\n }\n ans ++;\n }\n printf (\"%d\\n\", ans + 1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int t = 1;\n\nvoid find( long long int last )\n{\n //printf(\"tt%lld %lld \", last, t);\n if( last == 1 && t != 1 )\n {\n return;\n }\n\n if( last % 10 == 0 && t != 1 )\n {\n\n return find(last / 10);\n }\n\n else\n {\n t++;\n return find(last+1);\n }\n\n\n}\n\nint main()\n{\n long long int n;\n scanf(\"%lld\", &n);\n\n find(n);\n if( n == 1 )\n {\n t = t - 1;\n }\n printf(\"%lld\", t);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int count=1,x,num;\n scanf(\"%d\",&x);\n \n num=x+1;\n do\n {\n if(num%10==0)\n {\n num=num/10;\n }\n else\n {\n \n num=num+1;\n count++;\n }\n }while(num !=1);\n if(x<10)\n {\n count=8; \n }\n printf(\"%d\",++count);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n\tlong int n,sum=0;\n\tscanf(\"%ld\",&n);\n\tint r=n%10;\n\tsum+=(10-r);\n\tn/=10;\n\tif(n==0 && r==1)\n\t{\n\t\tprintf(\"%ld\",sum);\n\t\texit(0);\n\t}\n\twhile(n)\n\t{\n\t\tint r=n%10;\n\t\tr++;\n\t\tsum+=(10-r);\n\t\tn/=10;\n\t}\nprintf(\"%ld\",sum+1);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int count=1,x,num;\n scanf(\"%d\",&x);\n if(x==1)\n count=0;\n num=x+1;\n do\n {\n if(num%10==0)\n {\n num=num/10;\n }\n else\n {\n num=num+1;\n count++;\n }\n }while(num !=1);\n printf(\"%d\",++count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i=0,j=2,k,l,n;\n\nscanf(\"%d\",&n);\nif(n==1)k=1;\nn++;\nwhile(n!=1){\n\n if(n%10==0){i++;\n n=n/10;}\nelse n++;\n j++;\n //if(n==1)break;\n}\nif(k==1) printf(\"1\\n\");\nelse printf(\"%d\\n\",j-i);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint f(int x){\n\tint f,i=0,y=x+1;\n\twhile (y%(long)pow(10,i)==0){\n\t\ti++;\n\t}\n\tf=y/(long)pow(10,i-1);\n\treturn f;\n}\nint main() {\n\tint a[1000],count=1,kq,x,i=0,j,kt=1;\n\tscanf(\"%d\",&x);\n\tkq=x;\n\tif (x==10) count=19;\n\telse if (x<10) count=9;\n\telse{\n\twhile (kq>10){\n\t\tkq=f(kq);\n\t\ta[i]=kq;\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (a[i]==a[j]){\n\t\t\t\tkt=0;\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t\tif (kt==1) count++;\n\t\ti++;\n\t}\n\tcount+=8;\n\t}\t\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(int a);\n\nint ans=1;\n\nint main(void)\n{\n int a;\n int b=0;\n \n scanf(\"%d\", &a);\n \n for(;a!=1 || b!=1;)\n {\n if(a==1)\n {\n b=1;\n }\n a=f(a);\n }\n printf(\"%d\", ans);\n \n return 0;\n}\n\nint f(int a)\n{\n a+=1;\n for(;a%10==0;)\n {\n a/=10;\n }\n ans++;\n return a;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j,a,k,m=0,l=0;\n scanf(\"%d\",&a);\n k=a;\n while(1)\n {\n a++;\n if(a==9)\n {\n if(l==1)\n {\n break;\n }\n else if(m==1)\n {\n i++;\n break;\n }\n else\n {\n i=i+2;\n break;\n }\n }\n while(a%10==0)\n {\n a=a/10;\n }\n if (a==1)\n {\n m=1;\n }\n if(a==9)\n {\n l=1;\n }\n i++;\n }\n if(k==1 || k==9)\n {\n printf(\"%d\",i);\n }\n else\n {\n printf(\"%d\",i+1);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,ans=9;\n\tscanf(\"%i\",&n);///5\n if(n>9)\n {\n if(n%10==0)\n ans++,n++;///\n\n while(n>=10)\n {\n ans++,n++;///19 20\n while(n%10==0)///2\n n/=10;///2\n }\n }\n else\n {\n if(n!=1)\n ans=11-n;\n else\n ans=10;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<stdlib.h>\n\nint main(){\n\n long long int num;\n int cnt=0,end=-1,on=0;\n scanf(\"%lld\",&num);\n\n while(1){\n if(num<10){\n cnt++;\n end = num;\n cnt += 8;\n break;\n }\n\n while((num%10)!=0){\n cnt++;\n num++;\n }\n\n num = num/10;\n }\n printf(\"%d\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c=1;\n scanf(\"%I64d\",&n);\n while(n>1)\n {\n n=n+1;\n c++;\n while(n%10==0)\n {\n n=n/10;\n }\n }\n printf(\"%I64d\",c);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count=1;\n if(n==1)\n printf(\"9\\n\");\n else\n {\n while(n!=1)\n {\n n++;\n while(n%10==0)\n {\n n=n/10;\n }\n count++;\n }\n printf(\"%d\",count);\n }\n\n return 0;\n}\n"}], "src_uid": "055fbbde4b9ffd4473e6e716da6da899"} {"nl": {"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_spec": "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_spec": "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.", "sample_inputs": ["AJKEQSLOBSROFGZ\nOVGURWZLWVLUXTH\nOZ", "AA\nA\nA"], "sample_outputs": ["ORZ", "0"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint res[100][100][100];\nint take[100][100][100];\nchar s1[101];\nchar s2[101];\nchar v[101];\nchar map[101];\n\nint get(int i, int j, int k)\n{\n int r;\n int b;\n int t = 0;\n int p;\n if(v[k] == '\\0')\n return -1;\n if(s1[i] == '\\0' || s2[j] == '\\0')\n return 0;\n if(res[i][j][k] >= 0)\n return res[i][j][k];\n r = get(i + 1, j, k);\n b = get(i, j + 1, k);\n if(s1[i] == s2[j])\n {\n if(s1[i] == v[k])\n {\n if(v[k + 1] != '\\0')\n t = get(i + 1, j + 1, k + 1) + 1;\n }\n else\n {\n for(p = map[k]; p >= 0 && s1[i] != v[p]; p = map[p]);\n t = get(i + 1, j + 1, p + 1) + 1;\n }\n }\n if(t > r && t > b)\n {\n res[i][j][k] = t;\n take[i][j][k] = 1;\n }\n else if(r > b)\n res[i][j][k] = r;\n else\n res[i][j][k] = b;\n return res[i][j][k];\n}\n\nvoid output(int i, int j, int k)\n{\n int r;\n int p;\n int b;\n if(s1[i] == '\\0' || s2[j] == '\\0' || v[k] == '\\0')\n return;\n if(take[i][j][k] != 0)\n {\n putchar(s1[i]);\n if(s1[i] == v[k])\n output(i + 1, j + 1, k + 1);\n else\n {\n for(p = map[k]; p >= 0 && s1[i] != v[p]; p = map[p]);\n output(i + 1, j + 1, p + 1);\n }\n }\n else\n {\n r = get(i + 1, j, k);\n b = get(i, j + 1, k);\n if(r > b)\n output(i + 1, j, k);\n else\n output(i, j + 1, k);\n }\n}\n\nint main()\n{\n int i, j, k;\n scanf(\"%s%s%s\", s1, s2, v);\n for(i = 0; s1[i] != '\\0'; i++)\n for(j = 0; s2[j] != '\\0'; j++)\n for(k = 0; v[k] != '\\0'; k++)\n {\n take[i][j][k] = 0;\n res[i][j][k] = -1;\n }\n map[0] = -1;\n map[1] = 0;\n j = 0;\n for(k = 2; v[k] != '\\0';)\n {\n if(v[j] == v[k - 1])\n {\n j++;\n map[k++] = j;\n }\n else if(j > 0)\n j = map[j];\n else\n map[k++] = 0;\n }\n if(get(0, 0, 0) <= 0)\n putchar('0');\n else\n output(0, 0, 0);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define INF 0x3f3f3f3f\n#define MAX(A,B) (((A) > (B)) ? (A) : (B))\n\nchar s1[105];\nchar s2[105];\nchar virus[105];\nint fail[105];\n\nint dp[105][105][105];\nint seq[105][105][105][3];\nint print[105][105][105];\nint n, m, p;\n\nint solve(int pos1, int pos2, int pos3) {\n if (pos3 >= p) {\n return -INF;\n }\n\n if (pos1 >= n || pos2 >= m) {\n return 0;\n }\n\n if (seq[pos1][pos2][pos3][0] != -1) {\n return dp[pos1][pos2][pos3];\n }\n\n int aux, aux2, aux3;\n int way1, way2, way3;\n\n aux = aux2 = aux3 = -INF;\n way1 = way2 = way3 = 0;\n if (s1[pos1] == s2[pos2]) {\n if (s1[pos1] == virus[pos3]) {\n print[pos1][pos2][pos3] = 1;\n aux = 1 + solve(pos1 + 1, pos2 + 1, pos3 + 1);\n way1 = pos1 + 1;\n way2 = pos2 + 1;\n way3 = pos3 + 1;\n } else {\n way1 = pos1;\n way2 = pos2;\n if (pos3 != 0) {\n if (virus[fail[pos3 - 1]] == s1[pos1]) {\n aux = 1 + solve(pos1 + 1, pos2 + 1, fail[pos3 - 1] + 1);\n print[pos1][pos2][pos3] = 1;\n way1++;\n way2++;\n way3 = fail[pos3 - 1] + 1;\n } else {\n aux = solve(pos1, pos2, fail[pos3 - 1]);\n way3 = fail[pos3 - 1];\n }\n } else {\n aux = 1 + solve(pos1 + 1, pos2 + 1, 0);\n print[pos1][pos2][0] = 1;\n way1++;\n way2++;\n way3 = 0;\n }\n }\n }\n\n dp[pos1][pos2][pos3] = aux;\n seq[pos1][pos2][pos3][0] = way1;\n seq[pos1][pos2][pos3][1] = way2;\n seq[pos1][pos2][pos3][2] = way3;\n\n aux2 = solve(pos1 + 1, pos2, pos3);\n aux3 = solve(pos1, pos2 + 1, pos3);\n\n if (aux2 > dp[pos1][pos2][pos3]) {\n dp[pos1][pos2][pos3] = aux2;\n print[pos1][pos2][pos3] = 0;\n seq[pos1][pos2][pos3][0] = pos1 + 1;\n seq[pos1][pos2][pos3][1] = pos2;\n seq[pos1][pos2][pos3][2] = pos3;\n }\n if (aux3 > dp[pos1][pos2][pos3]) {\n dp[pos1][pos2][pos3] = aux3;\n print[pos1][pos2][pos3] = 0;\n seq[pos1][pos2][pos3][0] = pos1;\n seq[pos1][pos2][pos3][1] = pos2 + 1;\n seq[pos1][pos2][pos3][2] = pos3;\n }\n\n return dp[pos1][pos2][pos3];\n}\n\nvoid build_fail(void) {\n int len;\n int i;\n\n fail[0] = 0;\n i = 1;\n len = 0;\n\n while(i < p) {\n if (virus[i] == virus[len]) {\n len++;\n fail[i++] = len;\n } else {\n if (len != 0) {\n len = fail[len - 1];\n } else {\n fail[i++] = 0;\n }\n }\n }\n return;\n}\n\nint main(void) {\n int i, j, k;\n int res;\n\n int w1, w2, w3;\n\n scanf(\" %s %s %s\", s1, s2, virus);\n\n n = strlen(s1);\n m = strlen(s2);\n p = strlen(virus);\n\n\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n for (k = 0; k < p; k++) {\n seq[i][j][k][0] = -1;\n print[i][j][k] = 0;\n }\n }\n }\n\n build_fail();\n res = solve(0, 0, 0);\n\n if (res) {\n i = 0;\n j = 0;\n k = 0;\n while(i != n && j != m) {\n if (print[i][j][k]) {\n printf(\"%c\", s1[i]);\n }\n w1 = seq[i][j][k][0];\n w2 = seq[i][j][k][1];\n w3 = seq[i][j][k][2];\n i = w1;\n j = w2;\n k = w3;\n }\n printf(\"\\n\");\n } else {\n printf(\"0\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <limits.h>\n#include <stdlib.h>\n\n#define MAX_N (100)\n#define TAKE (1)\n#define UP (2)\n#define DOWN (3)\n\nchar s1[MAX_N+1];\nchar s2[MAX_N+1];\nchar v[MAX_N+1];\nint vlen;\nint s1len;\nint s2len;\n\nint f[MAX_N+1];\nint dp[MAX_N+1][MAX_N+1][MAX_N+1];\nint sn[MAX_N+1][MAX_N+1][MAX_N+1];\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint trans(int k, char c) {\n while ( k != -1 && v[k] != c )\n k = f[k];\n return k+1;\n}\n\nvoid build_fail() {\n int i;\n\n f[0] = -1;\n for ( i=1; i <= vlen; ++i )\n f[i] = trans(f[i-1], v[i-1]);\n}\n\nvoid build_dp() {\n int i,j,k,kn,x,y,z;\n\n for ( i=0; i <= s1len; ++i )\n for ( j=0; j <= s2len; ++j )\n dp[i][j][vlen] = INT_MIN;\n for ( i=s1len-1; i >= 0; --i ) {\n for ( j=s2len-1; j >= 0; --j ) {\n for ( k=0; k <= vlen; ++k ) {\n\tkn = k == vlen ? k : trans(k, s1[i]);\n\tx = s1[i] == s2[j] ? 1 + dp[i+1][j+1][kn] : INT_MIN;\n\ty = dp[i+1][j][k];\n\tz = dp[i][j+1][k];\n\tdp[i][j][k] = max(max(x, y), z);\n\tif ( x >= y && x >= z ) sn[i][j][k] = TAKE;\n\telse if ( y >= x && y >= z ) sn[i][j][k] = UP;\n\telse sn[i][j][k] = DOWN;\n }\n }\n }\n}\n\nchar * get_soln(char * buf) {\n int i,j,k,ix;\n \n for ( i=j=k=ix=0; sn[i][j][k]; ) {\n switch ( sn[i][j][k] ) {\n case TAKE: \n buf[ix++] = s1[i];\n\tk = k == vlen ? k : trans(k, s1[i]);\n\ti += 1, j += 1; \n\tbreak;\n case UP:\n i += 1;\n\tbreak;\n case DOWN:\n j += 1;\n\tbreak;\n }\n }\n buf[ix] = '\\0';\n return buf;\n}\n\nint main() {\n char buf[MAX_N+1];\n\n gets(s1);\n gets(s2);\n gets(v);\n vlen = strlen(v);\n s1len = strlen(s1);\n s2len = strlen(s2);\n build_fail();\n build_dp();\n if ( dp[0][0][0] )\n printf(\"%s\\n\", get_soln(buf));\n else\n printf(\"0\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,j,cnt = 0,maxcnt = 0;\n for(i=0;sa[i];i++)\n {\n if(sa[i] == sb[0])\n {\n cnt = 0;\n for(j=0;sb[j];j++)\n {\n if(sa[i+j] == sb[j]) cnt++;\n else break;\n }\n maxcnt = maxcnt>cnt?maxcnt:cnt;\n }\n }\n return maxcnt;\n}\nint work(char c)\n{\n short swi = 0;\n int i,j;\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1]&&s1[i-1] != c&&s2[j-1] != c)\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]>maxans)\n {\n memcpy(ansans,ans[len1][len2],sizeof(ansans));\n maxans = f[len1][len2];\n }\n}\nint main()\n{\n int i;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n work('a');\n for(i=0;i<lenv;i++) work(vir[i]);\n if(maxans) printf(\"%s\",ansans);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nchar s1[110];\nchar s2[110];\nchar vi[110];\nchar stack[110];\nint l1,l2,lv;\nint list[110][110][110];\nint path[110][110][110];\nint f[110];\n\nvoid getnext()\n{\n int i,j;\n f[0]=f[1]=0;\n for (i=1;i<=lv;i++)\n {\n j=f[i];\n while (j&&vi[j+1]!=vi[i+1]) j=f[j];\n if (vi[j+1]==vi[i+1])\n f[i+1]=j+1;\n else\n f[i+1]=0;\n }\n return;\n}\n\nint main()\n{\n int i,j,k,p,q;\n scanf(\"%s\",s1+1);\n scanf(\"%s\",s2+1);\n scanf(\"%s\",vi+1);\n l1=strlen(s1+1);\n l2=strlen(s2+1);\n lv=strlen(vi+1);\n getnext();\n memset(list,0,sizeof(list));\n for (i=1;i<=l1;i++)\n list[i][0][0]=0;\n for (i=1;i<=l2;i++)\n list[0][i][0]=0;\n for (i=1;i<=l1;i++)\n for (j=1;j<=l2;j++)\n for (k=0;k<lv;k++)\n {\n if (list[i-1][j][k]>list[i][j-1][k])\n {\n list[i][j][k]=list[i-1][j][k];\n path[i][j][k]=-1;\n }\n else\n {\n list[i][j][k]=list[i][j-1][k];\n path[i][j][k]=-2;\n }\n if (s1[i]==s2[j])\n {\n for (p=0;p<lv;p++)\n {\n q=p;\n if (list[i-1][j-1][p]<0)\n continue;\n while (q&&vi[q+1]!=s1[i])\n q=f[q];\n if (vi[q+1]==s1[i])\n {\n if (q==k-1&&list[i][j][k]<list[i-1][j-1][p]+1)\n {\n list[i][j][k]=list[i-1][j-1][p]+1;\n path[i][j][k]=p;\n }\n }\n else if (k==q&&list[i][j][k]<list[i-1][j-1][p]+1)\n {\n list[i][j][k]=list[i-1][j-1][p]+1;\n path[i][j][k]=p;\n }\n }\n }\n }\n //system(\"pause\");\n int m,top=0;\n m=0;\n for (i=0;i<lv;i++)\n m=list[l1][l2][m]>list[l1][l2][i]?m:i;\n if (list[l1][l2][m]==0)\n {\n printf(\"0\");\n return 0;\n }\n //for (i=1;i<=l1;i++)\n // for (j=1;j<=l2;j++)\n // for (k=0;k<lv;k++)\n // printf(\"%d %d %d#%d#\\n\",i,j,k,list[i][j][k]);\n i=l1;\n j=l2;\n while (i&&j)\n {\n //printf(\"%d %d\\n\",i,j);\n if (path[i][j][m]<0)\n {\n if (path[i][j][m]==-1)\n i--;\n else\n j--;\n }\n else\n {\n stack[++top]=s1[i];\n m=path[i][j][m];\n i--;\n j--;\n }\n }\n for (i=top;i>=1;i--)\n printf(\"%c\",stack[i]);\n return 0;\n //system(\"pause\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <limits.h>\n#include <stdlib.h>\n\n#define MAX_N (100)\n#define TAKE (1)\n#define UP (2)\n#define DOWN (3)\n\nchar s1[MAX_N+1];\nchar s2[MAX_N+1];\nchar v[MAX_N+1];\nint vlen;\nint s1len;\nint s2len;\n\nint f[MAX_N+1];\nint dp[MAX_N+1][MAX_N+1][MAX_N+1];\nint sn[MAX_N+1][MAX_N+1][MAX_N+1];\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint trans(int k, char c) {\n while ( k != -1 && v[k] != c )\n k = f[k];\n return k+1;\n}\n\nvoid build_fail() {\n int i;\n\n f[0] = -1;\n for ( i=1; i <= vlen; ++i )\n f[i] = trans(f[i-1], v[i-1]);\n}\n\nvoid build_dp() {\n int i,j,k,kn,x,y,z;\n\n for ( i=0; i <= s1len; ++i )\n for ( j=0; j <= s2len; ++j )\n dp[i][j][vlen] = INT_MIN;\n for ( i=s1len-1; i >= 0; --i ) {\n for ( j=s2len-1; j >= 0; --j ) {\n for ( k=0; k <= vlen; ++k ) {\n\tkn = k == vlen ? k : trans(k, s1[i]);\n\tx = s1[i] == s2[j] ? 1 + dp[i+1][j+1][kn] : INT_MIN;\n\ty = dp[i+1][j][k];\n\tz = dp[i][j+1][k];\n\tdp[i][j][k] = max(max(x, y), z);\n\tif ( x >= y && x >= z ) sn[i][j][k] = TAKE;\n\telse if ( y >= x && y >= z ) sn[i][j][k] = UP;\n\telse sn[i][j][k] = DOWN;\n }\n }\n }\n}\n\nchar * get_soln(char * buf) {\n int i,j,k,ix;\n \n for ( i=j=k=ix=0; sn[i][j][k]; ) {\n switch ( sn[i][j][k] ) {\n case TAKE: \n buf[ix++] = s1[i];\n\tk = k == vlen ? k : trans(k, s1[i]);\n\ti += 1, j += 1; \n\tbreak;\n case UP:\n i += 1;\n\tbreak;\n case DOWN:\n j += 1;\n\tbreak;\n }\n }\n buf[ix] = '\\0';\n return buf;\n}\n\nint main() {\n char buf[MAX_N+1];\n\n gets(s1);\n gets(s2);\n gets(v);\n vlen = strlen(v);\n s1len = strlen(s1);\n s2len = strlen(s2);\n build_fail();\n build_dp();\n if ( dp[0][0][0] )\n printf(\"%s\\n\", get_soln(buf));\n else\n printf(\"0\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,j,cnt = 0,maxcnt = 0;\n for(i=0;sa[i];i++)\n {\n if(sa[i] == sb[0])\n {\n cnt = 0;\n for(j=0;sb[j];j++)\n {\n if(sa[i+j] == sb[j]) cnt++;\n else break;\n }\n maxcnt = maxcnt>cnt?maxcnt:cnt;\n }\n }\n return maxcnt;\n}\nint work(char c)\n{\n short swi = 0;\n int i,j;\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1]&&s1[i-1] != c&&s2[j-1] != c)\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]>maxans)\n {\n memcpy(ansans,ans[len1][len2],sizeof(ansans));\n maxans = f[len1][len2];\n }\n}\nint main()\n{\n int i;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n work('a');\n for(i=0;i<lenv;i++) work(vir[i]);\n if(maxans) printf(\"%s\",ansans);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\nint const MOD = 1000000007;\n\ntypedef long long int lli;\n\n#define fo3(i,a,b) for(i=(int)(a);i<=(int)(b);i++)\n#define abso(x) (((x)>=0)?(x):(-(x)))\n#define in32(x) scanf(\"%d\",&(x))\n#define out32(x) printf(\"%d\\n\",(x))\n#define in64(x) scanf(\"%I64d\",&(x))\n#define out64(x) printf(\"%I64d\\n\",(x))\n#define instr(x) scanf(\"%s\",(x));\n#define outstr(x) printf(\"%s\\n\", (x));\n\n#define MAX 105\n#define oo 987654321\n#define SENT -1\n#define UP 0\n#define LEFT 1\n#define DIAG 2\n\nint len1, len2, len3;\nint memo[MAX][MAX][MAX];\nint move[MAX][MAX][MAX];\nchar word1[MAX];\nchar word2[MAX];\nchar word3[MAX];\nint ** dfa;\n\nvoid kmp() {\n int R=26,X=0,c,j;\n dfa = calloc(len3,sizeof(int*));\n fo3(j,0,len3-1)\n dfa[j] = calloc(R,sizeof(int));\n dfa[0][word3[0]-'A'] = 1; \n for (j=1; j<len3; j++) {\n for (c=0; c<R; c++) \n dfa[j][c] = dfa[X][c];\n dfa[j][word3[j]-'A']=j+1;\n X = dfa[X][word3[j]-'A'];\n }\n}\n\nint rec(int p1, int p2, int p3) {\n if (p3 == len3)\n return -oo;\n if (word1[p1] == '\\0' || word2[p2] == '\\0')\n return 0;\n if (memo[p1][p2][p3] != SENT) \n return memo[p1][p2][p3];\n memo[p1][p2][p3] = rec(p1+1, p2, p3);\n move[p1][p2][p3] = UP;\n int tmp = rec(p1, p2+1, p3);\n if (tmp > memo[p1][p2][p3]) {\n memo[p1][p2][p3] = tmp;\n move[p1][p2][p3] = LEFT;\n }\n if (word1[p1] == word2[p2]) {\n int np3 = dfa[p3][word1[p1]-'A'];\n int tmp = rec(p1 + 1, p2 + 1, np3) + 1;\n if (tmp > memo[p1][p2][p3]) {\n memo[p1][p2][p3] = tmp;\n move[p1][p2][p3] = DIAG;\n }\n }\n return memo[p1][p2][p3];\n}\n \nint main(void) {\n int i,j,k,ans;\n instr(word1);\n instr(word2);\n instr(word3);\n len1=strlen(word1);\n len2=strlen(word2);\n len3=strlen(word3);\n kmp();\n fo3(i,0,len1)\n fo3(j,0,len2)\n fo3(k,0,len3)\n memo[i][j][k] = SENT;\n ans=rec(0,0,0);\n if (ans) {\n char buff[MAX];\n int cur = 0;\n int p1 = 0;\n int p2 = 0;\n int p3 = 0;\n while (p1 != len1 && p2 != len2) {\n if (move[p1][p2][p3] == DIAG) {\n buff[cur++] = word1[p1];\n p3=dfa[p3][word1[p1]-'A'];\n p1++;\n p2++;\n } else if (move[p1][p2][p3] == LEFT) {\n p2++;\n } else {\n p1++;\n }\n }\n buff[cur] = '\\0';\n outstr(buff);\n } else out32(ans);\n return 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#define INF 0x3f3f3f3f\n#define MAX(A,B) (((A) > (B)) ? (A) : (B))\n\nchar s1[105];\nchar s2[105];\nchar virus[105];\nint fail[105];\n\nint dp[105][105][105];\nint seq[105][105][105];\nint n, m, p;\n\nint solve(int pos1, int pos2, int pos3) {\n int aux1, aux2, aux3, aux4;\n\n if (pos3 >= p) {\n return -INF;\n }\n\n if (pos1 >= n || pos2 >= m) {\n return 0;\n }\n\n if (dp[pos1][pos2][pos3] != -1) {\n return dp[pos1][pos2][pos3];\n }\n\n aux1 = aux2 = -INF;\n if (s1[pos1] == s2[pos2]) {\n if (virus[pos3] == s1[pos1]) {\n aux1 = 1 + solve(pos1 + 1, pos2 + 1, pos3 + 1);\n } else {\n if (pos3 != 0) {\n aux2 = 1 + solve(pos1 + 1, pos2 + 1, fail[pos3 - 1]);\n } else {\n aux2 = 1 + solve(pos1 + 1, pos2 + 1, 0);\n }\n }\n }\n aux3 = solve(pos1 + 1, pos2, pos3);\n aux4 = solve(pos1, pos2 + 1, pos3);\n\n dp[pos1][pos2][pos3] = -INF;\n if (dp[pos1][pos2][pos3] < aux1) {\n seq[pos1][pos2][pos3] = 1;\n dp[pos1][pos2][pos3] = aux1;\n }\n if (dp[pos1][pos2][pos3] < aux2) {\n seq[pos1][pos2][pos3] = 2;\n dp[pos1][pos2][pos3] = aux2;\n }\n if (dp[pos1][pos2][pos3] < aux3) {\n seq[pos1][pos2][pos3] = 3;\n dp[pos1][pos2][pos3] = aux3;\n }\n if (dp[pos1][pos2][pos3] < aux4) {\n seq[pos1][pos2][pos3] = 4;\n dp[pos1][pos2][pos3] = aux4;\n }\n\n return dp[pos1][pos2][pos3];\n}\n\nvoid build_fail(int m) {\n int len;\n int i;\n\n fail[0] = 0;\n len = 0;\n i = 1;\n\n while(i < m) {\n if (virus[i] == virus[len]) {\n len++;\n fail[i++] = len;\n } else {\n if (len != 0) {\n len = fail[len - 1];\n } else {\n fail[i++] = 0;\n }\n }\n }\n return;\n}\n\nint main(void) {\n int i, j, k;\n int res;\n\n scanf(\" %s %s %s\", s1, s2, virus);\n\n n = strlen(s1);\n m = strlen(s2);\n p = strlen(virus);\n\n\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n for (k = 0; k < p; k++) {\n dp[i][j][k] = -1;\n }\n }\n }\n\n build_fail(p);\n res = solve(0, 0, 0);\n\n /*for (i = 0; i < p; i++) {\n printf(\"i = %d, fail[i] = %d\\n\", i, fail[i]);\n } */\n\n i = 0;\n j = 0;\n k = 0;\n while(i != n && j != m) {\n switch(seq[i][j][k]) {\n case 1:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n i++;\n j++;\n k++;\n break;\n case 2:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n if (s1[i] == virus[k]) {\n k++;\n } else {\n if (k != 0) {\n k = fail[k - 1];\n }\n }\n i++;\n j++;\n break;\n case 3:\n i++;\n break;\n case 4:\n j++;\n break;\n }\n }\n printf(\"\\n\");\n\n if (res == 0) {\n printf(\"0\\n\");\n }\n\n /*printf(\"%d\\n\", res); */\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define INF 0x3f3f3f3f\n#define MAX(A,B) (((A) > (B)) ? (A) : (B))\n\nchar s1[105];\nchar s2[105];\nchar virus[105];\nint fail[105];\n\nint dp[105][105][105];\nint seq[105][105][105];\nint n, m, p;\n\nint solve(int pos1, int pos2, int pos3) {\n int aux1, aux2, aux3, aux4;\n\n if (pos3 >= p) {\n return -INF;\n }\n\n if (pos1 >= n || pos2 >= m) {\n return 0;\n }\n\n if (dp[pos1][pos2][pos3] != -1) {\n return dp[pos1][pos2][pos3];\n }\n\n aux1 = aux2 = -INF;\n if (s1[pos1] == s2[pos2]) {\n if (virus[pos3] == s1[pos1]) {\n aux1 = 1 + solve(pos1 + 1, pos2 + 1, pos3 + 1);\n } else {\n if (pos3 != 0) {\n aux2 = 1 + solve(pos1 + 1, pos2 + 1, fail[pos3 - 1]);\n } else {\n aux2 = 1 + solve(pos1 + 1, pos2 + 1, 0);\n }\n }\n }\n aux3 = solve(pos1 + 1, pos2, pos3);\n aux4 = solve(pos1, pos2 + 1, pos3);\n\n dp[pos1][pos2][pos3] = -INF;\n if (dp[pos1][pos2][pos3] < aux1) {\n seq[pos1][pos2][pos3] = 1;\n dp[pos1][pos2][pos3] = aux1;\n }\n if (dp[pos1][pos2][pos3] < aux2) {\n seq[pos1][pos2][pos3] = 2;\n dp[pos1][pos2][pos3] = aux2;\n }\n if (dp[pos1][pos2][pos3] < aux3) {\n seq[pos1][pos2][pos3] = 3;\n dp[pos1][pos2][pos3] = aux3;\n }\n if (dp[pos1][pos2][pos3] < aux4) {\n seq[pos1][pos2][pos3] = 4;\n dp[pos1][pos2][pos3] = aux4;\n }\n\n return dp[pos1][pos2][pos3];\n}\n\nvoid build_fail(int m) {\n int len;\n int i;\n\n fail[0] = 0;\n len = 0;\n i = 1;\n\n while(i < m) {\n if (virus[i] == virus[len]) {\n len++;\n fail[i++] = len;\n } else {\n if (len != 0) {\n len = fail[len - 1];\n } else {\n fail[i++] = 0;\n }\n }\n }\n return;\n}\n\nint main(void) {\n int i, j, k;\n int res;\n\n scanf(\" %s %s %s\", s1, s2, virus);\n\n n = strlen(s1);\n m = strlen(s2);\n p = strlen(virus);\n\n\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n for (k = 0; k < p; k++) {\n dp[i][j][k] = -1;\n }\n }\n }\n\n build_fail(p);\n res = solve(0, 0, 0);\n\n /*for (i = 0; i < p; i++) {\n printf(\"i = %d, fail[i] = %d\\n\", i, fail[i]);\n } */\n\n i = 0;\n j = 0;\n k = 0;\n while(i != n && j != m) {\n switch(seq[i][j][k]) {\n case 1:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n i++;\n j++;\n k++;\n break;\n case 2:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n if (s1[i] == virus[k]) {\n k++;\n } else {\n if (k != 0) {\n k = fail[k - 1];\n }\n }\n i++;\n j++;\n break;\n case 3:\n i++;\n break;\n case 4:\n j++;\n break;\n }\n }\n\n if (res == 0) {\n printf(\"0\\n\");\n } else {\n printf(\"\\n\");\n }\n\n /*printf(\"%d\\n\", res); */\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define INF 0x3f3f3f3f\n#define MAX(A,B) (((A) > (B)) ? (A) : (B))\n\nchar s1[105];\nchar s2[105];\nchar virus[105];\nint fail[105];\n\nint dp[105][105][105];\nint seq[105][105][105];\nint n, m, p;\n\nint solve(int pos1, int pos2, int pos3) {\n int aux1, aux2, aux3, aux4, aux5;\n\n if (pos3 >= p) {\n return -INF;\n }\n\n if (pos1 >= n || pos2 >= m) {\n return 0;\n }\n\n if (dp[pos1][pos2][pos3] != -1) {\n return dp[pos1][pos2][pos3];\n }\n\n aux1 = aux2 = -INF;\n aux5 = -INF;\n if (s1[pos1] == s2[pos2]) {\n if (virus[pos3] == s1[pos1]) {\n aux1 = 1 + solve(pos1 + 1, pos2 + 1, pos3 + 1);\n } else {\n if (pos3 != 0) {\n aux5 = solve(pos1, pos2, fail[pos3 - 1]);\n } else {\n aux2 = 1 + solve(pos1 + 1, pos2 + 1, 0);\n }\n }\n }\n aux3 = solve(pos1 + 1, pos2, pos3);\n aux4 = solve(pos1, pos2 + 1, pos3);\n\n dp[pos1][pos2][pos3] = -INF;\n if (dp[pos1][pos2][pos3] < aux1) {\n seq[pos1][pos2][pos3] = 1;\n dp[pos1][pos2][pos3] = aux1;\n }\n if (dp[pos1][pos2][pos3] < aux2) {\n seq[pos1][pos2][pos3] = 2;\n dp[pos1][pos2][pos3] = aux2;\n }\n if (dp[pos1][pos2][pos3] < aux3) {\n seq[pos1][pos2][pos3] = 3;\n dp[pos1][pos2][pos3] = aux3;\n }\n if (dp[pos1][pos2][pos3] < aux4) {\n seq[pos1][pos2][pos3] = 4;\n dp[pos1][pos2][pos3] = aux4;\n }\n if (dp[pos1][pos2][pos3] < aux5) {\n seq[pos1][pos2][pos3] = 5;\n dp[pos1][pos2][pos3] = aux5;\n }\n\n return dp[pos1][pos2][pos3];\n}\n\nvoid build_fail(int m) {\n int len;\n int i;\n\n fail[0] = 0;\n len = 0;\n i = 1;\n\n while(i < m) {\n if (virus[i] == virus[len]) {\n len++;\n fail[i++] = len;\n } else {\n if (len != 0) {\n len = fail[len - 1];\n } else {\n fail[i++] = 0;\n }\n }\n }\n return;\n}\n\nint main(void) {\n int i, j, k;\n int res;\n\n scanf(\" %s %s %s\", s1, s2, virus);\n\n n = strlen(s1);\n m = strlen(s2);\n p = strlen(virus);\n\n\n for (i = 0; i < n; i++) {\n for (j = 0; j < m; j++) {\n for (k = 0; k < p; k++) {\n dp[i][j][k] = -1;\n }\n }\n }\n\n build_fail(p);\n res = solve(0, 0, 0);\n\n /*for (i = 0; i < p; i++) {\n printf(\"i = %d, fail[i] = %d\\n\", i, fail[i]);\n } */\n\n i = 0;\n j = 0;\n k = 0;\n while(i != n && j != m && k < p) {\n switch(seq[i][j][k]) {\n case 1:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n i++;\n j++;\n k++;\n break;\n case 2:\n /*printf(\"printing i = %d\\n\", i); */\n printf(\"%c\", s1[i]);\n i++;\n j++;\n break;\n case 3:\n i++;\n break;\n case 4:\n j++;\n break;\n case 5:\n if (k != 0) {\n k = fail[k - 1];\n }\n break;\n }\n }\n\n if (res == 0) {\n printf(\"0\\n\");\n } else {\n printf(\"\\n\");\n }\n\n /*printf(\"%d\\n\", res); */\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <limits.h>\n#include <stdlib.h>\n\n#define MAX_N (100)\n#define TAKE (1)\n#define UP (2)\n#define DOWN (3)\n\nchar s1[MAX_N+1];\nchar s2[MAX_N+1];\nchar v[MAX_N+1];\nint vlen;\nint s1len;\nint s2len;\n\nint f[MAX_N+1];\nint dp[MAX_N+1][MAX_N+1][MAX_N+1];\nint sn[MAX_N+1][MAX_N+1][MAX_N+1];\n\nint max(int x, int y) { return x > y ? x : y; }\n\nvoid build_fail() {\n int i,j;\n\n f[0] = 0;\n for ( i=1; v[i-1]; ++i ) {\n for ( j=i-1; j && v[f[j]] != v[i-1]; j=f[j] );\n f[i] = j ? f[j]+1 : 0;\n }\n}\n\nint fail(int k, char c) {\n int i;\n\n for ( i=k; i && v[f[i]] != c; i=f[i] );\n return i + (v[f[i]] == c);\n}\n\nvoid build_dp() {\n int i,j,k,kn,x,y,z;\n\n for ( i=0; i <= s1len; ++i )\n for ( j=0; j <= s2len; ++j )\n dp[i][j][vlen] = INT_MIN;\n for ( i=s1len-1; i >= 0; --i ) {\n for ( j=s2len-1; j >= 0; --j ) {\n for ( k=0; k <= vlen; ++k ) {\n\tkn = k == vlen ? k : (s1[i] == v[k] ? k+1 : fail(k, s1[i]));\n\tx = s1[i] == s2[j] ? 1 + dp[i+1][j+1][kn] : INT_MIN;\n\ty = dp[i+1][j][k];\n\tz = dp[i][j+1][k];\n\tdp[i][j][k] = max(max(x, y), z);\n\tif ( x >= y && x >= z ) sn[i][j][k] = TAKE;\n\telse if ( y >= x && y >= z ) sn[i][j][k] = UP;\n\telse sn[i][j][k] = DOWN;\n }\n }\n }\n}\n\nchar * get_soln(char * buf) {\n int i,j,k,ix;\n \n for ( i=j=k=ix=0; sn[i][j][k]; ) {\n switch ( sn[i][j][k] ) {\n case TAKE: \n buf[ix++] = s1[i];\n\tk = k == vlen ? k : (s1[i] == v[k] ? k+1 : fail(k, s1[i]));\n\ti += 1, j += 1; \n\tbreak;\n case UP:\n i += 1;\n\tbreak;\n case DOWN:\n j += 1;\n\tbreak;\n }\n }\n buf[ix] = '\\0';\n return buf;\n}\n\nint main() {\n char buf[MAX_N+1];\n\n gets(s1);\n gets(s2);\n gets(v);\n vlen = strlen(v);\n s1len = strlen(s1);\n s2len = strlen(s2);\n build_fail();\n build_dp();\n if ( dp[0][0][0] )\n printf(\"%s\\n\", get_soln(buf));\n else\n printf(\"0\\n\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0};\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,cnt = 0;\n for(i=0;sa[i]&&sb[i];i++) if(sa[i] == sb[i]) cnt++;\n return cnt;\n}\nint main()\n{\n int i,j;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1])\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]) printf(\"%s\",ans[len1][len2]);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,cnt = 0;\n for(i=0;sa[i]&&sb[i];i++) if(sa[i] == sb[i]) cnt++;\n return cnt;\n}\nint work(char c)\n{\n short swi = 0;\n int i,j;\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1])\n {\n if(s1[i-1]!=c&&s2[j-1]!=c) if(!swi)\n {\n swi = 1;\n continue;\n }\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]>maxans)\n {\n memcpy(ansans,ans[len1][len2],sizeof(ansans));\n maxans = f[len1][len2];\n }\n}\nint main()\n{\n int i;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n work('a');\n for(i=0;i<lenv;i++) work(vir[i]);\n if(maxans) printf(\"%s\",ansans);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,cnt = 0;\n for(i=0;sa[i]&&sb[i];i++) if(sa[i] == sb[i]) cnt++;\n return cnt;\n}\nint work(char c)\n{\n int i,j;\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1]&&s1[i-1]!=c&&s2[j-1]!=c)\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]>maxans)\n {\n memcpy(ansans,ans[len1][len2],sizeof(ansans));\n maxans = f[len1][len2];\n }\n}\nint main()\n{\n int i;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n work('a');\n for(i=0;i<lenv;i++) work(vir[i]);\n if(maxans) printf(\"%s\",ansans);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0};\nint f[101][101] = {0},len1,len2;\nint main()\n{\n int i,j;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1])\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(strcmp(ans[i][j],vir) == 0)\n {\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n }\n }\n else\n {\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n }\n }\n }\n if(f[len1][len2]) printf(\"%s\",ans[len1][len2]);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s1[101] = {0},s2[101] = {0},vir[101] = {0},ans[101][101][101] = {0},ansans[101] = {0},maxans = 0;\nint f[101][101] = {0},len1,len2,lenv;\nint cmp(char *sa,char *sb)\n{\n int i,j,cnt = 0;\n for(i=0;sa[i];i++)\n {\n if(sa[i] == sb[0])\n {\n for(j=0;sb[j];j++)\n {\n if(sa[i+j] == sb[j]) cnt++;\n }\n }\n }\n return cnt;\n}\nint work(char c)\n{\n short swi = 0;\n int i,j;\n for(i=1;i<=len1;i++)\n {\n for(j=1;j<=len2;j++)\n {\n if(s1[i-1] == s2[j-1]&&s1[i-1] != c&&s2[j-1] != c)\n {\n f[i][j] = f[i-1][j-1] + 1;\n memcpy(ans[i][j],ans[i-1][j-1],sizeof(ans[i][j]));\n ans[i][j][f[i][j]-1] = s1[i-1];\n if(cmp(ans[i][j],vir) != lenv) continue;\n }\n if(f[i-1][j]>f[i][j-1])\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n else if(f[i-1][j]<f[i][j-1])\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n if(cmp(ans[i-1][j],vir)>cmp(ans[i][j-1],vir))\n {\n memcpy(ans[i][j],ans[i][j-1],sizeof(ans[i][j]));\n f[i][j] = f[i][j-1];\n }\n else\n {\n memcpy(ans[i][j],ans[i-1][j],sizeof(ans[i][j]));\n f[i][j] = f[i-1][j];\n }\n }\n }\n }\n if(f[len1][len2]>maxans)\n {\n memcpy(ansans,ans[len1][len2],sizeof(ansans));\n maxans = f[len1][len2];\n }\n}\nint main()\n{\n int i;\n scanf(\"%s%s%s\",s1,s2,vir);\n len1 = strlen(s1);\n len2 = strlen(s2);\n lenv = strlen(vir);\n work('a');\n for(i=0;i<lenv;i++) work(vir[i]);\n if(maxans) printf(\"%s\",ansans);\n else printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint res[100][100][100];\nint take[100][100][100];\nchar s1[101];\nchar s2[101];\nchar v[101];\n\nint get(int i, int j, int k)\n{\n int r;\n int b;\n int t = 0;\n if(v[k] == '\\0')\n return -1;\n if(s1[i] == '\\0' || s2[j] == '\\0')\n return 0;\n if(res[i][j][k] >= 0)\n return res[i][j][k];\n r = get(i + 1, j, k);\n b = get(i, j + 1, k);\n if(s1[i] == s2[j])\n {\n if(s1[i] == v[k])\n {\n if(v[k + 1] != '\\0')\n t = get(i + 1, j + 1, k + 1) + 1;\n }\n else\n {\n t = get(i + 1, j + 1, 0) + 1;\n }\n }\n if(t > r && t > b)\n {\n res[i][j][k] = t;\n take[i][j][k] = 1;\n }\n else if(r > b)\n res[i][j][k] = r;\n else\n res[i][j][k] = b;\n return res[i][j][k];\n}\n\nvoid output(int i, int j, int k)\n{\n int r;\n int b;\n if(s1[i] == '\\0' || s2[j] == '\\0' || v[k] == '\\0')\n return;\n if(take[i][j][k] != 0)\n {\n putchar(s1[i]);\n if(s1[i] == v[k])\n output(i + 1, j + 1, k + 1);\n else\n output(i + 1, j + 1, 0);\n }\n else\n {\n r = get(i + 1, j, k);\n b = get(i, j + 1, k);\n if(r > b)\n output(i + 1, j, k);\n else\n output(i, j + 1, k);\n }\n}\n\nint main()\n{\n int i, j, k;\n scanf(\"%s%s%s\", s1, s2, v);\n for(i = 0; s1[i] != '\\0'; i++)\n for(j = 0; s2[j] != '\\0'; j++)\n for(k = 0; v[k] != '\\0'; k++)\n {\n take[i][j][k] = 0;\n res[i][j][k] = -1;\n }\n if(get(0, 0, 0) <= 0)\n putchar('0');\n else\n output(0, 0, 0);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define max(a,b) a>b?a:b\nstruct str_list\n{\n\tint v;\n\tint bi;\n\tint bj;\n\tint bk;\n\tint m;\n};\nstruct str_list list[110][110][110];\nchar s1[110];\nchar s2[110];\nchar vi[110];\nint f[110],l1,l2,lv;\nvoid getnext()\n{\n\tint i,j;\n\tf[0]=f[1]=0;\n\tfor (i=1;i<lv;i++)\n\t{\n\t\tj=f[i];\n\t\twhile (j&&vi[i]!=vi[j]){ j=f[j];}\n\t\tf[i+1]=(vi[i]==vi[j])?j+1:0;\n\t}\n\treturn;\n}\nint main()\n{\n\tint i,j,k,tm,p,tp,tti,ttj,ttk,ti,tj,tk,top;\n\tscanf(\"%s\",s1+1);\n\tscanf(\"%s\",s2+1);\n\tscanf(\"%s\",vi+1);\n\t//printf(\"%s\\n\",s1+1);\n\t//printf(\"%s\\n\",s2+1);\n\t//printf(\"%s\\n\",vi+1);\n\tl1=strlen(s1+1);\n\tl2=strlen(s2+1);\n\tlv=strlen(vi+1);\n\tgetnext();\n\tmemset(list,0,sizeof(list));\n\tif (s1[1]!=vi[1])\n\t{\n\t//printf(\"#%d %d#\\n\",l1,l2);\n\t\tlist[1][1][0].v=s1[1]==s2[1];\n\t\tlist[1][1][0].bi=0;\n\t\tlist[1][1][0].bj=0;\n\t\tlist[1][1][0].bk=0;\n\t\tlist[1][1][0].m=s1[1]==s2[1];\n\t}\n\telse\n\t{\n\t\tlist[1][1][1].v=s1[1]==s2[1];\n\t\tlist[1][1][1].bi=0;\n\t\tlist[1][1][1].bj=0;\n\t\tlist[1][1][1].bk=0;\n\t\tlist[1][1][1].m=s1[1]==s2[1];\n\t}\n\tfor (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t{\n\t\t\t\tif (i==1&&j==1)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (s1[i]!=s2[j])\n\t\t\t\t{\n\t\t\t\t\tif (list[i-1][j][k].v>list[i][j-1][k].v)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i-1;\n\t\t\t\t\t\tlist[i][j][k].bj=j;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i-1][j][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i;\n\t\t\t\t\t\tlist[i][j][k].bj=j-1;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i][j-1][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (k!=0&&vi[k]!=s1[i])\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttm=0;\n\t\t\t\t\tif (k==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t\t\tif (vi[p]==s1[i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttm=1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tm==1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (s1[i]==vi[1])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\tif (vi[p+1]!=s1[i])\n\t\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t//if (i==7&&j==7)\n\t\t\t\t\t//\tprintf(\"#%d#%d#%d#\\n\",i,j,tm);\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttm=0;\n\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttp=p;\n\t\t\t\t\t\twhile (tp&&vi[tp+1]!=s1[i])\n\t\t\t\t\t\t\ttp=f[tp];\n\t\t\t\t\t\tif (f[tp]==k-1)\n\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t}\n\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t}\n\t\t\t}\n\ttm=0;\n\tfor (i=0;i<lv;i++)\n\t\tif (tm<list[l1][l2][i].v)\n\t\t{\n\t\t\ttm=list[l1][l2][i].v;\n\t\t\ttk=i;\n\t\t}\n\t/*for (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t\tprintf(\"%d %d %d#%d#\\n\",i,j,k,list[i][j][k].v);\n\tprintf(\"\\n\\n\");*/\n\tif (tm==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tti=l1;\n\ttj=l2;\n\ttop=0;\n\tint stack[100];\n\twhile (ti!=0&&tj!=0)\n\t{\n\t\tif (list[ti][tj][tk].m==1)\n\t\t\tstack[++top]=s1[ti];\n\t\ttti=ti;\n\t\tttj=tj;\n\t\tttk=tk;\n\t\tti=list[tti][ttj][ttk].bi;\n\t\ttj=list[tti][ttj][ttk].bj;\n\t\ttk=list[tti][ttj][ttk].bk;\n\t}\n\tfor (i=top;i>=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nETFTBRDKOXKCGPVFVCHQXKCIECDK\nEKTFRZNXMGFFXIJXKCATCVTXTDDK\n\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define max(a,b) a>b?a:b\nstruct str_list\n{\n\tint v;\n\tint bi;\n\tint bj;\n\tint bk;\n\tint m;\n};\nstruct str_list list[110][110][110];\nchar s1[110];\nchar s2[110];\nchar vi[110];\nint f[110],l1,l2,lv;\nvoid getnext()\n{\n\tint i,j;\n\tf[0]=f[1]=0;\n\tfor (i=1;i<lv;i++)\n\t{\n\t\tj=f[i];\n\t\twhile (j&&vi[i]!=vi[j]){ j=f[j];}\n\t\tf[i+1]=(vi[i]==vi[j])?j+1:0;\n\t}\n\treturn;\n}\nint main()\n{\n\tint i,j,k,tm,p,tp,tti,ttj,ttk,ti,tj,tk,top;\n\tscanf(\"%s\",s1+1);\n\tscanf(\"%s\",s2+1);\n\tscanf(\"%s\",vi+1);\n\t//printf(\"%s\\n\",s1+1);\n\t//printf(\"%s\\n\",s2+1);\n\t//printf(\"%s\\n\",vi+1);\n\tl1=strlen(s1+1);\n\tl2=strlen(s2+1);\n\tlv=strlen(vi+1);\n\tgetnext();\n\tmemset(list,0,sizeof(list));\n\tlist[1][1][0].v=s1[1]==s2[1];\n\tlist[1][1][0].bi=0;\n\tlist[1][1][0].bj=0;\n\tlist[1][1][0].bk=0;\n\tlist[1][1][0].m=s1[1]==s2[1];\n\tfor (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t{\n\t\t\t\tif (s1[i]!=s2[j])\n\t\t\t\t{\n\t\t\t\t\tif (list[i-1][j][k].v>list[i][j-1][k].v)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i-1;\n\t\t\t\t\t\tlist[i][j][k].bj=j;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i-1][j][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i;\n\t\t\t\t\t\tlist[i][j][k].bj=j-1;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i][j-1][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (k!=0&&vi[k]!=s1[i])\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttm=0;\n\t\t\t\t\tif (k==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t\t\tif (vi[p]==s1[i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttm=1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tm==1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (s1[i]==vi[1])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\tif (vi[p+1]!=s1[i])\n\t\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttm=0;\n\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttp=p;\n\t\t\t\t\t\twhile (tp&&vi[tp+1]!=s1[i])\n\t\t\t\t\t\t\ttp=f[tp];\n\t\t\t\t\t\tif (f[tp]==k-1)\n\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t}\n\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t}\n\t\t\t}\n\ttm=0;\n\tfor (i=0;i<lv;i++)\n\t\tif (tm<list[l1][l2][i].v)\n\t\t{\n\t\t\ttm=list[l1][l2][i].v;\n\t\t\ttk=i;\n\t\t}\n\tif (tm==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tti=l1;\n\ttj=l2;\n\ttop=0;\n\tint stack[100];\n\twhile (ti!=0&&tj!=0)\n\t{\n\t\tif (list[ti][tj][tk].m==1)\n\t\t\tstack[++top]=s1[ti];\n\t\ttti=ti;\n\t\tttj=tj;\n\t\tttk=tk;\n\t\tti=list[tti][ttj][ttk].bi;\n\t\ttj=list[tti][ttj][ttk].bj;\n\t\ttk=list[tti][ttj][ttk].bk;\n\t}\n\tfor (i=top;i>=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nAVBIIQXSAHIFRRJLDDHABFGUGU\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define max(a,b) a>b?a:b\nstruct str_list\n{\n\tint v;\n\tint bi;\n\tint bj;\n\tint bk;\n\tint m;\n};\nstruct str_list list[110][110][110];\nchar s1[110];\nchar s2[110];\nchar vi[110];\nint f[110],l1,l2,lv;\nvoid getnext()\n{\n\tint i,j;\n\tf[0]=f[1]=0;\n\tfor (i=1;i<lv;i++)\n\t{\n\t\tj=f[i];\n\t\twhile (j&&vi[i]!=vi[j]){ j=f[j];}\n\t\tf[i+1]=(vi[i]==vi[j])?j+1:0;\n\t}\n\treturn;\n}\nint main()\n{\n\tint i,j,k,tm,p,tp,tti,ttj,ttk,ti,tj,tk,top;\n\tscanf(\"%s\",s1+1);\n\tscanf(\"%s\",s2+1);\n\tscanf(\"%s\",vi+1);\n\t//printf(\"%s\\n\",s1+1);\n\t//printf(\"%s\\n\",s2+1);\n\t//printf(\"%s\\n\",vi+1);\n\tl1=strlen(s1+1);\n\tl2=strlen(s2+1);\n\tlv=strlen(vi+1);\n\tgetnext();\n\tmemset(list,0,sizeof(list));\n\tlist[1][1][0].v=s1[1]==s2[1];\n\tlist[1][1][0].bi=0;\n\tlist[1][1][0].bj=0;\n\tlist[1][1][0].bk=0;\n\tlist[1][1][0].m=s1[1]==s2[1];\n\tfor (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t{\n\t\t\t\tif (s1[i]!=s2[j])\n\t\t\t\t{\n\t\t\t\t\tif (list[i-1][j][k].v>list[i][j-1][k].v)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i-1;\n\t\t\t\t\t\tlist[i][j][k].bj=j;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i-1][j][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i;\n\t\t\t\t\t\tlist[i][j][k].bj=j-1;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i][j-1][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (k!=0&&vi[k]!=s1[i])\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttm=0;\n\t\t\t\t\tif (k==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t\t\tif (vi[p]==s1[i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttm=1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tm==1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (s1[i]==vi[1])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\tif (vi[p+1]!=s1[i])\n\t\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttm=k-1;\n\t\t\t\t\tfor (p=k;p<=lv;p++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttp=p;\n\t\t\t\t\t\twhile (tp&&f[tp]!=k-1)\n\t\t\t\t\t\t{\n\t//printf(\"%d %d %d##\\n\",i,j,tp);\n\t\t\t\t\t\t\ttp=f[tp];\n\t}\n\t\t\t\t\t\tif (f[tp]==k-1)\n\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t}\n\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t}\n\t\t\t}\n\ttm=0;\n\tfor (i=0;i<lv;i++)\n\t\tif (tm<list[l1][l2][i].v)\n\t\t{\n\t\t\ttm=list[l1][l2][i].v;\n\t\t\ttk=i;\n\t\t}\n\tif (tm==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tti=l1;\n\ttj=l2;\n\ttop=0;\n\tint stack[100];\n\twhile (ti!=0&&tj!=0)\n\t{\n\t\tif (list[ti][tj][tk].m==1)\n\t\t\tstack[++top]=s1[ti];\n\t\ttti=ti;\n\t\tttj=tj;\n\t\tttk=tk;\n\t\tti=list[tti][ttj][ttk].bi;\n\t\ttj=list[tti][ttj][ttk].bj;\n\t\ttk=list[tti][ttj][ttk].bk;\n\t}\n\tfor (i=top;i>=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define max(a,b) a>b?a:b\nstruct str_list\n{\n\tint v;\n\tint bi;\n\tint bj;\n\tint bk;\n\tint m;\n};\nstruct str_list list[110][110][110];\nchar s1[110];\nchar s2[110];\nchar vi[110];\nint f[110],l1,l2,lv;\nvoid getnext()\n{\n\tint i,j;\n\tf[0]=f[1]=0;\n\tfor (i=1;i<lv;i++)\n\t{\n\t\tj=f[i];\n\t\twhile (j&&vi[i]!=vi[j]){ j=f[j];}\n\t\tf[i+1]=(vi[i]==vi[j])?j+1:0;\n\t}\n\treturn;\n}\nint main()\n{\n\tint i,j,k,tm,p,tp,tti,ttj,ttk,ti,tj,tk,top;\n\tscanf(\"%s\",s1+1);\n\tscanf(\"%s\",s2+1);\n\tscanf(\"%s\",vi+1);\n\t//printf(\"%s\\n\",s1+1);\n\t//printf(\"%s\\n\",s2+1);\n\t//printf(\"%s\\n\",vi+1);\n\tl1=strlen(s1+1);\n\tl2=strlen(s2+1);\n\tlv=strlen(vi+1);\n\tgetnext();\n\tmemset(list,0,sizeof(list));\n\tlist[1][1][0].v=s1[1]==s2[1];\n\tlist[1][1][0].bi=0;\n\tlist[1][1][0].bj=0;\n\tlist[1][1][0].bk=0;\n\tlist[1][1][0].m=s1[1]==s2[1];\n\tfor (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t{\n\t\t\t\tif (s1[i]!=s2[j])\n\t\t\t\t{\n\t\t\t\t\tif (list[i-1][j][k].v>list[i][j-1][k].v)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i-1;\n\t\t\t\t\t\tlist[i][j][k].bj=j;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i-1][j][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i;\n\t\t\t\t\t\tlist[i][j][k].bj=j-1;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i][j-1][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (k!=0&&vi[k]!=s1[i])\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttm=0;\n\t\t\t\t\tif (k==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t\t\tif (vi[p]==s1[i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttm=1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tm==1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (s1[i]==vi[1])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\tif (vi[p+1]!=s1[i])\n\t\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttm=k-1;\n\t\t\t\t\tfor (p=k;p<=lv;p++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttp=p;\n\t\t\t\t\t\twhile (tp&&f[tp]!=k-1)\n\t\t\t\t\t\t{\n\tprintf(\"%d %d %d##\\n\",i,j,tp);\n\t\t\t\t\t\t\ttp=f[tp];\n\t}\n\t\t\t\t\t\tif (f[tp]==k-1)\n\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t}\n\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t}\n\t\t\t}\n\ttm=0;\n\tfor (i=0;i<lv;i++)\n\t\tif (tm<list[l1][l2][i].v)\n\t\t{\n\t\t\ttm=list[l1][l2][i].v;\n\t\t\ttk=i;\n\t\t}\n\tif (tm==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tti=l1;\n\ttj=l2;\n\ttop=0;\n\tint stack[100];\n\twhile (ti!=0&&tj!=0)\n\t{\n\t\tif (list[ti][tj][tk].m==1)\n\t\t\tstack[++top]=s1[ti];\n\t\ttti=ti;\n\t\tttj=tj;\n\t\tttk=tk;\n\t\tti=list[tti][ttj][ttk].bi;\n\t\ttj=list[tti][ttj][ttk].bj;\n\t\ttk=list[tti][ttj][ttk].bk;\n\t}\n\tfor (i=top;i>=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define max(a,b) a>b?a:b\nstruct str_list\n{\n\tint v;\n\tint bi;\n\tint bj;\n\tint bk;\n\tint m;\n};\nstruct str_list list[110][110][110];\nchar s1[110];\nchar s2[110];\nchar vi[110];\nint f[110],l1,l2,lv;\nvoid getnext()\n{\n\tint i,j;\n\tf[0]=f[1]=0;\n\tfor (i=1;i<lv;i++)\n\t{\n\t\tj=f[i];\n\t\twhile (j&&vi[i]!=vi[j]){ j=f[j];}\n\t\tf[i+1]=(vi[i]==vi[j])?j+1:0;\n\t}\n\treturn;\n}\nint main()\n{\n\tint i,j,k,tm,p,tp,tti,ttj,ttk,ti,tj,tk,top;\n\tscanf(\"%s\",s1+1);\n\tscanf(\"%s\",s2+1);\n\tscanf(\"%s\",vi+1);\n\t//printf(\"%s\\n\",s1+1);\n\t//printf(\"%s\\n\",s2+1);\n\t//printf(\"%s\\n\",vi+1);\n\tl1=strlen(s1+1);\n\tl2=strlen(s2+1);\n\tlv=strlen(vi+1);\n\tgetnext();\n\tmemset(list,0,sizeof(list));\n\tif (s1[1]!=vi[1])\n\t{\n\t//printf(\"#%d %d#\\n\",l1,l2);\n\t\tlist[1][1][0].v=s1[1]==s2[1];\n\t\tlist[1][1][0].bi=0;\n\t\tlist[1][1][0].bj=0;\n\t\tlist[1][1][0].bk=0;\n\t\tlist[1][1][0].m=s1[1]==s2[1];\n\t}\n\telse\n\t{\n\t\tlist[1][1][1].v=s1[1]==s2[1];\n\t\tlist[1][1][1].bi=0;\n\t\tlist[1][1][1].bj=0;\n\t\tlist[1][1][1].bk=0;\n\t\tlist[1][1][1].m=s1[1]==s2[1];\n\t}\n\tfor (i=2;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t{\n\t\t\t\tif (s1[i]!=s2[j])\n\t\t\t\t{\n\t\t\t\t\tif (list[i-1][j][k].v>list[i][j-1][k].v)\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i-1;\n\t\t\t\t\t\tlist[i][j][k].bj=j;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i-1][j][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tlist[i][j][k].bi=i;\n\t\t\t\t\t\tlist[i][j][k].bj=j-1;\n\t\t\t\t\t\tlist[i][j][k].bk=k;\n\t\t\t\t\t\tlist[i][j][k].v=list[i][j-1][k].v;\n\t\t\t\t\t\tlist[i][j][k].m=0;\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (k!=0&&vi[k]!=s1[i])\n\t\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttm=0;\n\t\t\t\t\tif (k==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t\t\tif (vi[p]==s1[i])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttm=1;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tif (tm==1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (s1[i]==vi[1])\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\tif (vi[p+1]!=s1[i])\n\t\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t//if (i==7&&j==7)\n\t\t\t\t\t//\tprintf(\"#%d#%d#%d#\\n\",i,j,tm);\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttm=0;\n\t\t\t\t\t\t\tfor (p=1;p<lv;p++)\n\t\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttm=0;\n\t\t\t\t\tfor (p=1;p<=lv;p++)\n\t\t\t\t\t{\n\t\t\t\t\t\ttp=p;\n\t\t\t\t\t\twhile (tp&&vi[tp+1]!=s1[i])\n\t\t\t\t\t\t\ttp=f[tp];\n\t\t\t\t\t\tif (f[tp]==k-1)\n\t\t\t\t\t\t\ttm=list[i-1][j-1][tm].v>list[i-1][j-1][p].v?tm:p;\n\t\t\t\t\t}\n\t\t\t\t\tlist[i][j][0].bi=i-1;\n\t\t\t\t\tlist[i][j][0].bj=j-1;\n\t\t\t\t\tlist[i][j][0].bk=tm;\n\t\t\t\t\tlist[i][j][0].m=1;\n\t\t\t\t\tlist[i][j][0].v=list[i-1][j-1][tm].v+1;\n\t\t\t\t}\n\t\t\t}\n\ttm=0;\n\tfor (i=0;i<lv;i++)\n\t\tif (tm<list[l1][l2][i].v)\n\t\t{\n\t\t\ttm=list[l1][l2][i].v;\n\t\t\ttk=i;\n\t\t}\n\t/*for (i=1;i<=l1;i++)\n\t\tfor (j=1;j<=l2;j++)\n\t\t\tfor (k=0;k<lv;k++)\n\t\t\t\tprintf(\"%d %d %d#%d#\\n\",i,j,k,list[i][j][k].v);\n\tprintf(\"\\n\\n\");*/\n\tif (tm==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\tti=l1;\n\ttj=l2;\n\ttop=0;\n\tint stack[100];\n\twhile (ti!=0&&tj!=0)\n\t{\n\t\tif (list[ti][tj][tk].m==1)\n\t\t\tstack[++top]=s1[ti];\n\t\ttti=ti;\n\t\tttj=tj;\n\t\tttk=tk;\n\t\tti=list[tti][ttj][ttk].bi;\n\t\ttj=list[tti][ttj][ttk].bj;\n\t\ttk=list[tti][ttj][ttk].bk;\n\t}\n\tfor (i=top;i>=1;i--)\n\t\tprintf(\"%c\",stack[i]);\n\treturn 0;\n}\n/*\nAVBIIQXSAHIFRRJLDDHABFGUGU\nWVBGCSSQHHIFRRWLDDHXBGFUGU\n\n*/\n"}, {"source_code": "#include <stdio.h>\nchar s1[110];\nchar s2[110];\nchar vi[110];\nchar stack[110];\nint l1,l2,lv;\nint list[110][110][110];\nint path[110][110][110];\nint f[110];\n\nvoid getnext()\n{\n int i,j;\n f[0]=f[1]=0;\n for (i=1;i<=lv;i++)\n {\n j=f[i];\n while (j&&vi[j+1]!=vi[i+1]) j=f[j];\n if (vi[j+1]==vi[i+1])\n f[i+1]=j+1;\n else\n f[i+1]=0;\n }\n return;\n}\n\nint main()\n{\n int i,j,k,p,q;\n scanf(\"%s\",s1+1);\n scanf(\"%s\",s2+1);\n scanf(\"%s\",vi+1);\n l1=strlen(s1+1);\n l2=strlen(s2+1);\n lv=strlen(vi+1);\n getnext();\n memset(list,0,sizeof(list));\n for (i=1;i<=l1;i++)\n list[i][0][0]=0;\n for (i=1;i<=l2;i++)\n list[0][i][0]=0;\n for (i=1;i<=l1;i++)\n for (j=1;j<=l2;j++)\n for (k=0;k<lv;k++)\n {\n if (list[i-1][j][k]>list[i][j-1][k])\n {\n list[i][j][k]=list[i-1][j][k];\n path[i][j][k]=-1;\n }\n else\n {\n list[i][j][k]=list[i][j-1][k];\n path[i][j][k]=-2;\n }\n if (s1[i]==s2[j])\n {\n for (p=0;p<lv;p++)\n {\n q=p;\n if (list[i-1][j-1][p]<0)\n continue;\n while (q&&vi[q+1]!=s1[i])\n q=f[q];\n if (vi[q+1]==s1[i])\n {\n if (q==k-1&&list[i][j][k]<list[i-1][j-1][p]+1)\n {\n list[i][j][k]=list[i-1][j-1][p]+1;\n path[i][j][k]=p;\n }\n }\n else if (k==q&&list[i][j][k]<list[i-1][j-1][p]+1)\n {\n list[i][j][k]=list[i-1][j-1][p]+1;\n path[i][j][k]=p;\n }\n }\n }\n }\n //system(\"pause\");\n int m,top=0;\n m=0;\n for (i=0;i<lv;i++)\n m=list[l1][l2][m]>list[l1][l2][i]?m:i;\n //for (i=1;i<=l1;i++)\n // for (j=1;j<=l2;j++)\n // for (k=0;k<lv;k++)\n // printf(\"%d %d %d#%d#\\n\",i,j,k,list[i][j][k]);\n i=l1;\n j=l2;\n while (i&&j)\n {\n //printf(\"%d %d\\n\",i,j);\n if (path[i][j][m]<0)\n {\n if (path[i][j][m]==-1)\n i--;\n else\n j--;\n }\n else\n {\n stack[++top]=s1[i];\n m=path[i][j][m];\n i--;\n j--;\n }\n }\n for (i=top;i>=1;i--)\n printf(\"%c\",stack[i]);\n //system(\"pause\");\n}\n"}], "src_uid": "391c2abbe862139733fcb997ba1629b8"} {"nl": {"description": "All bus tickets in Berland have their numbers. A number consists of $$$n$$$ digits ($$$n$$$ is even). Only $$$k$$$ decimal digits $$$d_1, d_2, \\dots, d_k$$$ can be used to form ticket numbers. If $$$0$$$ is among these digits, then numbers may have leading zeroes. For example, if $$$n = 4$$$ and only digits $$$0$$$ and $$$4$$$ can be used, then $$$0000$$$, $$$4004$$$, $$$4440$$$ are valid ticket numbers, and $$$0002$$$, $$$00$$$, $$$44443$$$ are not.A ticket is lucky if the sum of first $$$n / 2$$$ digits is equal to the sum of remaining $$$n / 2$$$ digits. Calculate the number of different lucky tickets in Berland. Since the answer may be big, print it modulo $$$998244353$$$.", "input_spec": "The first line contains two integers $$$n$$$ and $$$k$$$ $$$(2 \\le n \\le 2 \\cdot 10^5, 1 \\le k \\le 10)$$$ \u2014 the number of digits in each ticket number, and the number of different decimal digits that may be used. $$$n$$$ is even. The second line contains a sequence of pairwise distinct integers $$$d_1, d_2, \\dots, d_k$$$ $$$(0 \\le d_i \\le 9)$$$ \u2014 the digits that may be used in ticket numbers. The digits are given in arbitrary order.", "output_spec": "Print the number of lucky ticket numbers, taken modulo $$$998244353$$$.", "sample_inputs": ["4 2\n1 8", "20 1\n6", "10 5\n6 1 4 0 3", "1000 7\n5 4 0 1 8 3 2"], "sample_outputs": ["6", "1", "569725", "460571165"], "notes": "NoteIn the first example there are $$$6$$$ lucky ticket numbers: $$$1111$$$, $$$1818$$$, $$$1881$$$, $$$8118$$$, $$$8181$$$ and $$$8888$$$.There is only one ticket number in the second example, it consists of $$$20$$$ digits $$$6$$$. This ticket number is lucky, so the answer is $$$1$$$."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define MD\t998244353\n#define N_\t(1 << 20)\t/* N_ = pow2(ceil(log2(N * 9 + 1))) */\n\nlong long ww[21], ww_[21];\n\nlong long power(int a, int k) {\n\tlong long p;\n\n\tif (k == 0)\n\t\treturn 1;\n\tp = power(a, k / 2);\n\tp = p * p % MD;\n\tif (k % 2)\n\t\tp = p * a % MD;\n\treturn p;\n}\n\nvoid init() {\n\tint h;\n\n\tfor (h = 0; h <= 20; h++) {\n\t\tww[h] = power(3, (MD - 1) >> h);\n\t\tww_[h] = power(3, MD - 1 - ((MD - 1) >> h));\n\t}\n}\n\nvoid ntt(int *aa, int n, int inverse) {\n\tint h, i, j, b, l, r, u, v, tmp;\n\tlong long w, w_;\n\n\tfor (i = 1, j = 0; i < n; i++) {\n\t\tb = n;\n\t\tdo\n\t\t\tj ^= b >>= 1;\n\t\twhile ((j & b) == 0);\n\t\tif (i < j)\n\t\t\ttmp = aa[i], aa[i] = aa[j], aa[j] = tmp;\n\t}\n\tfor (h = 0; (b = 1 << h) < n; h++) {\n\t\tw_ = inverse ? ww_[h + 1] : ww[h + 1];\n\t\tfor (i = 0; i < n; i += b * 2) {\n\t\t\tw = 1;\n\t\t\tfor (j = 0; j < b; j++) {\n\t\t\t\tl = i + j, r = l + b;\n\t\t\t\tu = aa[l], v = aa[r] * w % MD;\n\t\t\t\tif ((aa[l] = u + v) >= MD)\n\t\t\t\t\taa[l] -= MD;\n\t\t\t\tif ((aa[r] = u - v) < 0)\n\t\t\t\t\taa[r] += MD;\n\t\t\t\tw = w * w_ % MD;\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main() {\n\tstatic int aa[N_];\n\tint n, n_, k, i;\n\tlong long v, a, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k), n /= 2;\n\tn_ = 1;\n\twhile (n_ < n * 9 + 1)\n\t\tn_ *= 2;\n\twhile (k--) {\n\t\tint d;\n\n\t\tscanf(\"%d\", &d);\n\t\taa[d] = 1;\n\t}\n\tntt(aa, n_, 0);\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = power(aa[i], n);\n\tntt(aa, n_, 1);\n\tv = power(n_, MD - 2);\n\tfor (i = 0; i < n_; i++)\n\t\taa[i] = aa[i] * v % MD;\n\tans = 0;\n\tfor (i = 0; i <= n * 9; i++) {\n\t\ta = aa[i];\n\t\tans = (ans + a * a) % MD;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <string.h>\n#include <stdio.h>\n#include <ctype.h>\n//#include <DEBUG.h>\n#define LL long long\n#define uLL long long\n#define uL unsigned int\n#define iL unsigned int\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\nLL CP=(LL)998244353;\nLL inv[0x100000];\nLL num1[0x100000],num2[0x100000];\nuL exgcd(uL a,uL c)\n{\n static uL gcd;\n uL k;\n uLL x;\n if (a==0)\n {\n gcd=c;\n return 1;\n }\n else\n {\n k=c%a;\n if (k==0)\n {\n gcd=a;\n return 1;\n }\n else\n {\n x=exgcd(a%k,k);\n }\n }\n return (x*c-c/a*gcd)/k;\n}\nvoid ini1(long n,LL P)\n{\n long i;\n inv[1]=1;\n for (i=2;i<=n;i++)\n {\n inv[i]=(uLL)inv[P%i]*(P-P/i)%P;\n }\n}\nstatic inline LL madd(LL a,LL b)\n{\n a+=b;\n a-=(a>CP)?CP:0;\n return a;\n}\nstatic inline LL msub(LL a,LL b)\n{\n a-=b;\n a+=(a<0)?CP:0;\n return a;\n}\nstatic inline LL MR(LL a,LL b)\n{\n return (a*b)%CP;\n}\nuLL mexp(uLL a,uLL b)\n{\n register uLL t;\n for (t=1;b;b=b>>1)\n {\n if (b&1) {t=MR(a,t);}\n a=MR(a,a);\n }\n return t;\n}\nstatic inline uLL PolynomialPower(uLL *pol,uLL psize,uLL ex,uLL N,uLL *ans)\n{\n uLL i,j,a,b,c,d;\n psize=(psize>N)?N:psize;\n uLL temp[psize],ans2[N+1];\n ans[1]=mexp(pol[1],ex);\n for (i=1;i<psize;i++) {temp[i-1]=pol[i+1]*i%CP;}\n c=ex%CP;d=exgcd(pol[1],CP);\n for (i=2;i<=N;i++)\n {\n a=0;b=min(psize-1,i-1);\n for (j=0;j<b;j++)\n {\n a=madd(a,MR(ans[i-j-1],temp[j]));\n }\n a=MR(a,c);\n b=min(psize,i-1);\n for (j=2;j<=b;j++)\n {\n a=msub(a,MR(ans2[i-j],pol[j]));\n }\n ans[i]=MR(a,MR(d,inv[i-1]));\n ans2[i-1]=MR(i-1,ans[i]);\n }\n}\nint main()\n{\n //freopen(\"in.in\",\"r\",stdin);\n LL i,j,k,a,b,c,n,ans;\n ini1(1000013,CP);\n scanf(\"%lld%lld\",&n,&k);\n *num1=10;\n memset(num1+1,0,sizeof(*num1)*(*num1+1));\n for (i=1;i<=k;i++)\n {\n scanf(\"%lld\",&a);\n num1[a+1]=1;\n }\n //printf(\"%lld\\n\",n/2);\n //print(num1,20);\n for (i=1;i<=10;i++) {if (num1[i]>0) {break;}}\n PolynomialPower(num1+i-1,10-i+1,n/2,1000001,num2);\n //print(num2,20);\n ans=0;\n for (i=1;i<=1000000;i++)\n {\n a=num2[i]*num2[i]%CP;\n ans=madd(a,ans);\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}"}], "negative_code": [], "src_uid": "279f1f7d250a4be6406c6c7bfc818bbf"} {"nl": {"description": "A chainword is a special type of crossword. As most of the crosswords do, it has cells that you put the letters in and some sort of hints to what these letters should be.The letter cells in a chainword are put in a single row. We will consider chainwords of length $$$m$$$ in this task.A hint to a chainword is a sequence of segments such that the segments don't intersect with each other and cover all $$$m$$$ letter cells. Each segment contains a description of the word in the corresponding cells.The twist is that there are actually two hints: one sequence is the row above the letter cells and the other sequence is the row below the letter cells. When the sequences are different, they provide a way to resolve the ambiguity in the answers.You are provided with a dictionary of $$$n$$$ words, each word consists of lowercase Latin letters. All words are pairwise distinct.An instance of a chainword is the following triple: a string of $$$m$$$ lowercase Latin letters; the first hint: a sequence of segments such that the letters that correspond to each segment spell a word from the dictionary; the second hint: another sequence of segments such that the letters that correspond to each segment spell a word from the dictionary. Note that the sequences of segments don't necessarily have to be distinct.Two instances of chainwords are considered different if they have different strings, different first hints or different second hints.Count the number of different instances of chainwords. Since the number might be pretty large, output it modulo $$$998\\,244\\,353$$$.", "input_spec": "The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n \\le 8$$$, $$$1 \\le m \\le 10^9$$$)\u00a0\u2014 the number of words in the dictionary and the number of letter cells. Each of the next $$$n$$$ lines contains a word\u00a0\u2014 a non-empty string of no more than $$$5$$$ lowercase Latin letters. All words are pairwise distinct. ", "output_spec": "Print a single integer\u00a0\u2014 the number of different instances of chainwords of length $$$m$$$ for the given dictionary modulo $$$998\\,244\\,353$$$.", "sample_inputs": ["3 5\nababa\nab\na", "2 4\nab\ncd", "5 100\na\naa\naaa\naaaa\naaaaa"], "sample_outputs": ["11", "4", "142528942"], "notes": "NoteHere are all the instances of the valid chainwords for the first example: The red lines above the letters denote the segments of the first hint, the blue lines below the letters denote the segments of the second hint.In the second example the possible strings are: \"abab\", \"abcd\", \"cdab\" and \"cdcd\". All the hints are segments that cover the first two letters and the last two letters."}, "positive_code": [{"source_code": "/* https://csacademy.com/contest/archive/task/superstition/ (rainboy) */\n#include <stdio.h>\n#include <string.h>\n\n#define N\t8\n#define L\t5\n#define N_\t(1 + N * L)\n#define N1\t(N_ * 2)\n#define A\t26\n#define MD\t998244353\n\nint tt[1 + N_][A]; char word[1 + N_];\n\nvoid dfs(int coef[][L + 1], int s1, int s2, int l) {\n\tint a;\n\n\tif (s1 == 0 || s2 == 0)\n\t\treturn;\n\tif (l > 0) {\n\t\tif (word[s1])\n\t\t\tcoef[s2 - 1 << 1 | 0][l]++;\n\t\tif (word[s2])\n\t\t\tcoef[s1 - 1 << 1 | 1][l]++;\n\t\tif (word[s1] && word[s2])\n\t\t\tcoef[0][l]++;\n\t}\n\tfor (a = 0; a < A; a++)\n\t\tdfs(coef, tt[s1][a], tt[s2][a], l + 1);\n}\n\nint coef[N1][N1][L + 1];\n\nvoid apply(int aa[][N1][L], int n) {\n\tstatic int bb[N1][N1];\n\tint i, j, k, l;\n\n\tfor (i = 0; i < n; i++)\n\t\tmemset(bb[i], 0, n * sizeof *bb[i]);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++)\n\t\t\tfor (k = 0; k < n; k++)\n\t\t\t\tfor (l = 1; l <= L; l++)\n\t\t\t\t\tbb[i][k] = (bb[i][k] + (long long) aa[i][j][l - 1] * coef[j][k][l]) % MD;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++)\n\t\t\tfor (l = L - 1; l >= 0; l--)\n\t\t\t\taa[i][j][l] = l == 0 ? bb[i][j] : aa[i][j][l - 1];\n}\n\nvoid mult(int aa[][N1][L], int bb[][N1][L], int cc[][N1][L], int n) {\n\tstatic int aa_[N1][N1][L], bb_[N1][N1][L + L];\n\tint i, j, k, l, l1, l2;\n\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++)\n\t\t\tmemcpy(aa_[i][j], aa[i][j], L * sizeof *aa[i][j]);\n\tfor (l = 0; l < L; l++)\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = 0; j < n; j++)\n\t\t\t\tfor (k = 0; k < n; k++)\n\t\t\t\t\tfor (l1 = 1; l + l1 < L; l1++)\n\t\t\t\t\t\taa_[i][k][l] = (aa_[i][k][l] - (long long) aa_[i][j][l + l1] * coef[j][k][l1]) % MD;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tmemset(bb_[i][j], 0, L * sizeof *bb_[i][j]);\n\t\t\tmemcpy(bb_[i][j] + L, bb[i][j], L * sizeof *bb[i][j]);\n\t\t}\n\tfor (l = L - 1; l >= 0; l--)\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = 0; j < n; j++)\n\t\t\t\tfor (k = 0; k < n; k++)\n\t\t\t\t\tfor (l1 = 1; l1 <= L; l1++)\n\t\t\t\t\t\tbb_[i][k][l] = (bb_[i][k][l] + (long long) coef[i][j][l1] * bb_[j][k][l + l1]) % MD;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++)\n\t\t\tmemset(cc[i][j], 0, L * sizeof *cc[i][j]);\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < n; j++)\n\t\t\tfor (k = 0; k < n; k++)\n\t\t\t\tfor (l1 = 0; l1 < L; l1++)\n\t\t\t\t\tfor (l2 = L - l1; l1 + l2 - L < L; l2++)\n\t\t\t\t\t\tcc[i][k][l1 + l2 - L] = (cc[i][k][l1 + l2 - L] + (long long) aa_[i][j][l1] * bb_[j][k][l2]) % MD;\n}\n\nvoid power(int pp[][N1][L], int tt[][N1][L], int n, int k) {\n\tint i, j, l;\n\n\tif (k == 0) {\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = 0; j < n; j++)\n\t\t\t\tfor (l = 0; l < L; l++)\n\t\t\t\t\tpp[i][j][l] = i == j && l == 0;\n\t\treturn;\n\t}\n\tpower(tt, pp, n, k / 2);\n\tmult(tt, tt, pp, n);\n\tif (k & 1)\n\t\tapply(pp, n);\n}\n\nint main() {\n\tstatic int pp[N1][N1][L], tt_[N1][N1][L];\n\tint n, n_, k, i, s;\n\n\tscanf(\"%d%d\", &n, &k);\n\tn_ = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tstatic char cc[L + 1];\n\t\tint l, h;\n\n\t\tscanf(\"%s\", cc), l = strlen(cc);\n\t\tfor (h = 0, s = 1; h < l; h++) {\n\t\t\tint a = cc[h] - 'a';\n\n\t\t\tif (!tt[s][a])\n\t\t\t\ttt[s][a] = ++n_;\n\t\t\ts = tt[s][a];\n\t\t}\n\t\tword[s] = 1;\n\t}\n\tfor (s = 0; s < n_; s++) {\n\t\tdfs(coef[s << 1 | 0], 1, s + 1, 0);\n\t\tif (s != 0)\n\t\t\tdfs(coef[s << 1 | 1], s + 1, 1, 0);\n\t}\n\tpower(pp, tt_, n_ * 2, k);\n\tif (pp[0][0][0] < 0)\n\t\tpp[0][0][0] += MD;\n\tprintf(\"%d\\n\", pp[0][0][0]);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "711d15e11016d0164fb2b0c3756e4857"} {"nl": {"description": "Your friend has n cards.You know that each card has a lowercase English letter on one side and a digit on the other.Currently, your friend has laid out the cards on a table so only one side of each card is visible.You would like to know if the following statement is true for cards that your friend owns: \"If a card has a vowel on one side, then it has an even digit on the other side.\" More specifically, a vowel is one of 'a', 'e', 'i', 'o' or 'u', and even digit is one of '0', '2', '4', '6' or '8'.For example, if a card has 'a' on one side, and '6' on the other side, then this statement is true for it. Also, the statement is true, for example, for a card with 'b' and '4', and for a card with 'b' and '3' (since the letter is not a vowel). The statement is false, for example, for card with 'e' and '5'. You are interested if the statement is true for all cards. In particular, if no card has a vowel, the statement is true.To determine this, you can flip over some cards to reveal the other side. You would like to know what is the minimum number of cards you need to flip in the worst case in order to verify that the statement is true.", "input_spec": "The first and only line of input will contain a string s (1\u2009\u2264\u2009|s|\u2009\u2264\u200950), denoting the sides of the cards that you can see on the table currently. Each character of s is either a lowercase English letter or a digit.", "output_spec": "Print a single integer, the minimum number of cards you must turn over to verify your claim.", "sample_inputs": ["ee", "z", "0ay1"], "sample_outputs": ["2", "0", "2"], "notes": "NoteIn the first sample, we must turn over both cards. Note that even though both cards have the same letter, they could possibly have different numbers on the other side.In the second sample, we don't need to turn over any cards. The statement is vacuously true, since you know your friend has no cards with a vowel on them.In the third sample, we need to flip the second and fourth cards."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\t\tchar s[100];\n\t\tint i;\n\t\tint count=0;\n\t\tscanf(\"%s\",s);\n\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t{\n\t\t\t\tif(s[i]=='1' || s[i]== '3' || s[i]=='5' || s[i]=='7' || s[i]=='9' || s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')\n\t\t\t\t\t\tcount++;\n\t\t}\n\t\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n char c;\n int count=0 , i ;\n\n for(i=0 ; ; i++)\n {\n\n scanf(\"%c\",&c);\n if(( c>= 'a' && c<='z') || (c<='9' && c >= '0') )\n {\n if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='1' || c=='3' || c=='5' || c=='7' || c=='9' )\n count++;\n }\n else\n {\n printf(\"%d\",count );\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char str[51];\n scanf(\"%s\", str);\n char match[] = {\"aeiou\"};\n int cnt = 0;\n for(int i = 0; str[i]; ++i) {\n if(str[i] >= '1' && str[i] <= '9' && (str[i] - '0') & 1) {\n ++cnt;\n } else {\n for(int j = 0; j < 5; ++j) {\n if(str[i] == match[j]) {\n ++cnt;\n }\n }\n }\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char str[100];\n while (scanf(\"%s\", &str, 100) != EOF)\n {\n int count = 0;\n for (int i = 0; str[i] != '\\0'; i++) {\n if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')\n count++;\n else if (str[i] >= '0' && str[i] <= '9' && (str[i] - '0') % 2)\n count++;\n }\n printf(\"%d\\n\", count);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char s[51]={'\\0'};\n scanf(\"%s\",s);\n int n=strlen(s),count=0,zero=0,two=0,four=0,six=0,eight=0;\n for(int i=0;i<n;i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[55];\n\tscanf(\"%s\",s);\n\tint i,len;\n\tlen=strlen(s);\n\tint count=0;\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u'|| s[i]=='1' || s[i]=='3' || s[i]=='5' || s[i]=='7' || s[i]=='9')\n\t\t{\n//\t\t\tprintf(\"%d \",s[i]);\n\t\t\tcount++;\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\nint main(void)\n{\n\tchar str[50];\n\tint b,i,count;\n\tscanf(\"%s\",&str);\n\tb=strlen(str);\n\tcount=0;\n\tfor(i=0;i<b;i++)\n\t{\n if((str[i]>='a')&&(str[i]<='z'))\n {\n\t if(str[i]=='a')\n\t count++;\n\t if(str[i]=='e')\n\t count++;\n\t if(str[i]=='i')\n\t count++;\n\t if(str[i]=='o')\n\t count++;\n\t if(str[i]=='u')\n\t count++;\n }\n else\n {\n \tif((str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))\n \tcount++;\n }\n\t \n\t\t\n\t}\n\tprintf(\"%d\",count);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,count=0;\n char s[100005];\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='a'|| s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'|| s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7' ||s[i]=='9')\n {\n count++;\n }\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,a,b=0;\n char na[51];\n scanf(\"%s\",&na);\n n=strlen(na);\n for(i=0;i<n;i++)\n {\n if(na[i]=='a' || na[i]=='e' || na[i]=='i' || na[i]=='o' || na[i]=='u' || na[i]=='1' || na[i]=='3' || na[i]=='5' || na[i]=='7' || na[i]=='9')\n b++;\n }\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,s=0;\n\tchar a[10000];\n\tgets(a);\n\tfor (i=0;a[i];i++)\n\t{\n\t\tif (a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n\t\ts++;\n\t\telse if (a[i]>='0'&&a[i]<='9')\n\t\t{\n\t\t\tif ((a[i]-'0')%2!=0) s++;\n\t\t}\n\n\t}\n\tprintf(\"%d\\n\",s);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100010];\n\tint m,n=0,i,j,t;\n\tgets(a);\n\tt=strlen(a);\n\tfor(i=0;i<t;i++)\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9')\n\t\t\tn++;\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[60];\nint n,i,k=0,a;\nscanf(\"%s\",&s);\nn=strlen(s);\nfor(i=0;i<=n-1;i++){\n a=(int)(s[0]);\n if((a=='a')||(a=='e')||(a=='i')||(a=='o')||(a=='u'))k++;\n else if((a=='1')||(a=='3')||(a=='5')||(a=='7')||(a=='9'))k++;\n strcpy(s,s+1);\n}\nprintf(\"%d\",k);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n char str[10000];\n scanf(\"%s\",str);\n int i,count=0;\n for(i=0; i<strlen(str); i++)\n {\n if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='1' || str[i]=='3' || str[i]=='5' || str[i]=='7' || str[i]=='9')\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint a = 0;\n\tchar c;\n\tdo \n\t{\n\t\tc = getchar();\n\t\tif(c == 'a' || c == 'o' || c == 'u' || c == 'e' || c == 'i')\n\t\t\ta++;\n\t\telse if ((c >= '0' && c <= '9') && c%2 == 1)\n\t\t\ta++;\n\t\telse\n\t\t\tcontinue;\n\t} while (c != EOF && c != '\\n');\n\tprintf(\"%d\\n\", a);\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\n\n\nint main()\n{\n\n char str[100];\n\n scanf(\"%s\",str);\n int trc=0,i;\n for(i=0;i<strlen(str);i++)\n {\n if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')\n {\n trc++;\n }\n if(str[i]>='1'&&str[i]<='9')\n {\n int n=str[i]-'0';\n if(n%2!=0)\n {\n trc++;\n }\n }\n }\n\n\n printf(\"%d\\n\",trc);\n return 0;\n\n\n}\n"}, {"source_code": "# include <stdio.h>\n# include <string.h>\nchar s[51];\nint arr[126];\nint main(void){\n\tint count=0;\n\tscanf(\"%s\",s);\n\tfor (int i=0;i<strlen(s);i++){\n\t\tif (s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')\n\t\t\tcount++;\n\t\telse arr[(int)s[i]]++;\n\t}\n\tfor(int i=48;i<60;i++) if (i&1) if (arr[i]) count+=arr[i];\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char arr[100];\n int i,n,x,count=0;\n scanf(\"%s\",arr);\n x=strlen(arr);\n for (i=0;i<x;i++)\n {\n if (arr[i]=='a' || arr[i]=='e' || arr[i]=='i' || arr[i]=='o' || arr[i]=='u' || arr[i]=='1' || arr[i]=='3' || arr[i]=='5' || arr[i]=='7' || arr[i]=='9')\n {\n count++;\n }\n else\n {\n continue;\n }\n }\n printf(\"%d\",count);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,len,count=0;\n char a[51];\n scanf(\" %s\",a);\n len=strlen(a);\n for(i=0;i<len;i++)\n {\n if(a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9' )\n count++;\n else if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n count++;\n\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[100];\n int i, cnt = 0, len;\n scanf(\"%s\", s);\n len = strlen(s);\n for(i = 0; i < len; i++)\n {\n if(s[i] >= 'a' && s[i] <= 'z')\n {\n if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u') cnt++;\n }\n else\n {\n if(s[i]!='0' && s[i] != '2' && s[i]!='4' && s[i]!='6' && s[i]!='8') cnt++;\n }\n }\n printf(\"%d\", cnt);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint func(int);\nint main(int argc, char *argv[]) \n{\n\tint cnt=0;\n\tchar ch;\n\twhile((ch=getchar())!='\\n')\n\t{\n\t\tif(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')\n\t\t\tcnt++;\n\t\telse if(isdigit(ch)&&(ch-48)%2==1)\n\t\t\tcnt++;\n\t}\n\tprintf(\"%d\",cnt);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint min_cards(char c){\n \n if(c=='a'){\n return 1;\n }\n\n if(c=='e'){\n return 1;\n }\n\n if(c=='i'){\n return 1;\n }\n\n if(c=='o'){\n return 1;\n }\n\n if(c=='u'){\n return 1;\n }\n\n if(c=='1'){\n return 1;\n }\n\n if(c=='3'){\n return 1;\n }\n\n if(c=='5'){\n return 1;\n }\n\n if(c=='7'){\n return 1;\n }\n\n if(c=='9'){\n return 1;\n }\n\n return 0;\n}\n\nint main(void){\n \n char cards[55];\n\n int minimum=0;\n\n scanf(\"%s\", cards);\n\n for(int i=0; i<strlen(cards);i++){\n minimum+=min_cards(cards[i]);\n }\n\n\n printf(\"%d\\n\", minimum);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char s[51]={'\\0'};\n scanf(\"%s\",s);\n int n=strlen(s),count=0,zero=0,two=0,four=0,six=0,eight=0;\n for(int i=0;i<n;i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\n int n,i,k=0;\n char s[100];\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='a' ||s[i]=='e' ||s[i]=='i'||s[i]=='o'||s[i]=='u' ||s[i]=='1' ||s[i]=='3' ||s[i]=='5' ||s[i]=='7' ||s[i]=='9')\n k++;\n }\n printf(\"%d\",k);\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\nint main()\n{ \nchar a[51]; \n scanf(\"%s\",a);\n int count=0;\n for(int i=0;i<strlen(a);i++){\n if(a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9'||a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n count++;\n } \n printf(\"%d\",count);\n \n return 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt<n;cnt++){\n switch(str[cnt]){\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u': \n case '1': \n case '3':\n case '5':\n case '7':\n case '9': flip++;\n }\n }\n printf(\"%d\", flip);\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[50];\n scanf(\"%s\",s);\n int i=0,c=0;\n while(s[i]!='\\0')\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'\n ||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n c++;\n i++;\n }\n printf(\"%d\",c);\n}"}, {"source_code": " \n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[50],c;\n\tint n=0,i=0;\n\tscanf(\"%s\",s);\n\twhile(i<strlen(s))\n\t{\n\t\tc=s[i];\n\t\tif(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')\n\t\t\tn++;\n\t\tif((c-'0')>=0&&(c-'0')<=9&&(c-'0')%2==1)\n\t\t\tn++;\n\t\ti++;\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j;\n char s[100];\n scanf(\"%s\",s);\n int count=0;\n for(i=0;s[i]!='\\0';i++){\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){\n count++;\n }\n else if(s[i]>='0'&&s[i]<='9'){\n if((s[i]-48)%2!=0)\n count++;\n }\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char s[51];\n int c=0,i;\n gets(s);\n for(i=0;s[i];i++)\n {\n if(s[i]>='a'&&s[i]<='z')\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u') c++;\n }\n else\n {\n if((s[i]-'0')%2) c++;\n }\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint n=strlen(str),i=0,count=0,flag=0;\n\tif (n>1)\n\t{\n\t\tfor (i=0;str[i]!='\\0' && i<=n;i++)\n\t\t{\n\t\t\tint testnum=str[i]-'0';\n\t\t\tint testalpha=str[i]-'a';\n\t\t\tif (testnum>=0 && testnum<10 && testnum%2!=0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse if (testalpha>=0 && testalpha<26)\n\t\t\t{\n\t\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse if (n==1)\n\t{\n\t\tint testnum=str[0]-'0';\n\t\tint testalpha=str[0]-'a';\n\t\tif (testalpha>=0 && testalpha<26)\n\t\t{\n\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t{\n\t\t\t\tcount=1;\n\t\t\t}\n\t\t}\n\t\telse if (testnum>=0 && testnum<10 && (testnum%2)!=0)\n\t\t\t{\n\t\t\t\tcount=1;\n\t\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tchar str[100];\n\tgets(str);\n\tint cnt=0,i,l=strlen(str);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')\n\t\t cnt++;\n\t\t if (str[i]<='9'&&str[i]>='0')\n\t\t {\n if((str[i]-'0')&1)\n\t\t\tcnt++;\n }\n\t}\n\tprintf(\"%d\",cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\tchar s[100];\n\t\tint i;\n\t\tint count=0;\n\t\tscanf(\"%s\",s);\n\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t{\n\t\t\t\tif(s[i]=='1' || s[i]== '3' || s[i]=='5' || s[i]=='7' || s[i]=='9' || s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')\n\t\t\t\t\t\tcount++;\n\t\t}\n\t\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char arr[100];\n int i,n,x,count=0;\n scanf(\"%s\",arr);\n x=strlen(arr);\n for (i=0;i<x;i++)\n {\n if (arr[i]=='a' || arr[i]=='e' || arr[i]=='i' || arr[i]=='o' || arr[i]=='u' || arr[i]=='1' || arr[i]=='3' || arr[i]=='5' || arr[i]=='7' || arr[i]=='9')\n {\n count++;\n }\n else\n {\n continue;\n }\n }\n printf(\"%d\",count);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n char a[100];\n gets(a);\n\n int i;\n int s=0;\n for(i=0;a[i]!='\\0';i++)\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||((a[i]-'0')%2!=0&&a[i]>='0'&&a[i]<='9'))\n s++;\n printf(\"%d\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[50];\n scanf(\"%s\",s);\n int i=0,c=0;\n while(s[i]!='\\0')\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'\n ||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n c++;\n i++;\n }\n printf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 57\n\nint main()\n{\n\tchar str[MAX];\n\tscanf(\"%s\", str);\n\tint len = strlen(str), i, ans = 0;\n\tfor(i=0;i<len;++i)\n\t{\n\t\tif(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' || (str[i] <= 57 && ((str[i] - '0') & 1)))\n\t\t{\n\t\t\t++ans;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n char a[100];\n gets(a);\n\n int i;\n int s=0;\n for(i=0;a[i]!='\\0';i++)\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||((a[i]-'0')%2!=0&&a[i]>='0'&&a[i]<='9'))\n s++;\n printf(\"%d\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[100];\n\tint l,i,c=0;\n\tscanf(\"%s\",str);\n\tl=strlen(str);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u')\n\t\t\tc++;\n\t\tif((int)str[i]>=48 && (int)str[i]<=57)\n\t\t{\n\t\t\tif((int)str[i]%2==1)\n\t\t\t\tc++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,t=0;\n\tchar a[51];\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{\n\t\tif(a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u' || a[i]=='1' || a[i]=='3' || a[i]=='5' || a[i]=='7' ||a[i]=='9')\n\t\tt++;\n\t}\n\tprintf(\"%d\",t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n char a[50],b[10]={'a','e','i','o','u','1','3','5','7','9'};\n int i,j,l=0;\n scanf(\"%s\",a);\n int n=strlen(a);\n for(i=0;i<n;i++){\n for(j=0;j<10;j++){\n if(a[i]==b[j]){\n l++;\n }\n }\n }\n printf(\"%d\",l);\nreturn 0;}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char d[1000];\n scanf(\"%s\",d);\n int c=0,i;\n for(i=0;i<strlen(d);i++)\n {\n if(d[i]=='u'||d[i]=='o'||d[i]=='i'||d[i]=='e'||d[i]=='a'||d[i]=='1'||d[i]=='3'||d[i]=='5'||d[i]=='7'||d[i]=='9')\n c++;\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <assert.h>\n\n#define MAX 1000010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nchar str[MAX];\n\nint main(){\n int n, i, j, res;\n\n while (scanf(\"%s\", str) != EOF){\n res = 0, n = strlen(str);\n for (i = 0; i < n; i++){\n if (str[i] == 'a') res++;\n if (str[i] == 'e') res++;\n if (str[i] == 'i') res++;\n if (str[i] == 'o') res++;\n if (str[i] == 'u') res++;\n if (str[i] == '1') res++;\n if (str[i] == '3') res++;\n if (str[i] == '5') res++;\n if (str[i] == '7') res++;\n if (str[i] == '9') res++;\n }\n\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n = 0;\n char s[50];\n scanf (\"%s\", s);\n for(int i = 0; i < 50; i++)\n {\n if( s[i] == '\\0' )\n break;\n if (strchr(\"aeiou\", s[i]))\n n ++;\n if( s[i] >= '0' && s[i] <= '9' && (s[i] - '0')%2 == 1 )\n n ++;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char str[51];\n scanf(\"%s\", str);\n char match[] = {\"aeiou\"};\n int cnt = 0;\n for(int i = 0; str[i]; ++i) {\n if(str[i] >= '1' && str[i] <= '9' && (str[i] - '0') & 1) {\n ++cnt;\n } else {\n for(int j = 0; j < 5; ++j) {\n if(str[i] == match[j]) {\n ++cnt;\n }\n }\n }\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar s[100];\nint main()\n{\n\tscanf(\"%s\",s);\n\tint ans,i;\n\tans=0;\n\ti=0;\n\twhile(s[i]!='\\0')\n\t{\n\t\tif(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n\t\tans++;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint a = 0;\n\tchar c;\n\tdo \n\t{\n\t\tc = getchar();\n\t\tif(c == 'a' || c == 'o' || c == 'u' || c == 'e' || c == 'i')\n\t\t\ta++;\n\t\telse if ((c >= '0' && c <= '9') && c%2 == 1)\n\t\t\ta++;\n\t\telse\n\t\t\tcontinue;\n\t} while (c != EOF && c != '\\n');\n\tprintf(\"%d\\n\", a);\n\treturn 0;\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='o'||s[i]=='i'||s[i]=='u')\n {\n a=a+1;\n }\n if(s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n {\n a=a+1;\n }\n }\n printf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int count=0,i,j,l;\n char a[50];\n scanf(\"%s\",a);\n count=0;\n l=strlen(a);\n for(i=0;i<l;i++)\n {\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9')\n count++;\n\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[55];\n int i,count=0;\n\n scanf(\"%s\",str);\n\n for(i=0; i<strlen(str); i++)\n {\n if((str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') || (str[i] == '1' || str[i] == '3' || str[i] == '5' || str[i] == '7' || str[i] == '9') )\n {\n count++;\n }\n\n }\n printf(\"%d\\n\",count);\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tchar s[51];\n\tint i,len,cck,flip=0;\n\tgets(s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\tif(s[i]>=97&&s[i]<=122){\n\t\t\tif(s[i]==97||s[i]==101||s[i]==105||s[i]==111||s[i]==117)\n\t\t\t\tflip++;\n\t\t}\n\t\telse if(s[i]>=48&&s[i]<=57){\n\t\t\tcck=s[i]-48;\n\t\t\tif(cck%2==1)\n\t\t\t\tflip++;\n\t\t}\n\t}\n\tprintf(\"%d\",flip);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i<j;i++)\n{if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\np=p+1;\n}\nprintf(\"%d\",p);}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;i<l;i++)\n{\n if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u') j++;\n else if(str[i]>='0' && str[i]<='9')\n {\n s=str[i];\n if(s%2!=0) j++;\n }\n}\n//printf(\"%d\\n\",s);\nprintf(\"%d\",j);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\n\nint main() {\n int ch, count=0;\n\n while((ch=getchar())!='\\n') {\n switch(ch) {\n case 'a':\n case 'e':\n case'i':\n case'o':\n case'u':\n case '1':\n case '3':\n case '5':\n case '7':\n case '9':\n count++;\n break;\n default:\n ;\n }\n \n }\n\n printf(\"%d\", count);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i<j;i++)\n{if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\np=p+1;\n}\nprintf(\"%d\",p);}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char cards[51];\n scanf(\"%s\", &cards);\n int res = 0;\n for(int i = 0; i < strlen(cards); i++){\n if(cards[i] == 'a' || cards[i] == 'e' || cards[i] == 'i' || cards[i] == 'o' || cards[i] == 'u' ||\n cards[i] == '1' || cards[i] == '3' || cards[i] == '5' || cards[i] == '7' || cards[i] == '9')\n res++;\n }\n printf(\"%d\", res);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\n#include<string.h>\nint pri(char c)\n{\n\tif(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')\n\treturn 1;\n\t\n\treturn 0;\n}\nint main()\n{\n\tint n,v;\n\tchar s[1010];\n\twhile(scanf(\"%s\",s)!=EOF)\n\t{\n\t\tv=0;\n\t\tn=strlen(s);\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(pri(s[i]))\n\t\t\tv++;\n\t\t\telse if(isdigit(s[i])&&(s[i]-'0')%2)\n\t\t\tv++; \n\t\t}\n\t\tprintf(\"%d\\n\",v);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar a[55];\nchar b[10] = {'a','e','i','o','u','1','3','5','7','9'};\nint main()\n{\n int i, s, len, j;\n scanf(\"%s\", a);\n len = strlen(a);\n for(i = 0, s = 0; i < len; i++)\n {\n for(j = 0; j <= 9; j++)\n if(a[i]==b[j]) s++;\n }\n printf(\"%d\", s);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar flip[] = \"aeiou13579\";\n\nint c, res;\n\nint main(void) {\n while (c = getchar(), c != EOF)\n if (strchr(flip, c))\n ++res;\n printf(\"%d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n char s[50];\n int n,i,sum=0;\n scanf(\"%s\",s);\n n=strlen(s);\n for(i=0;i<n;i++)\n {\n\t\t if(s[i]=='a')\n\t\t sum++;\n\t\telse if(s[i]=='e')\n\t\tsum++;\n\t\t else if(s[i]=='i')\n\t\t sum++;\n\t\t\telse if(s[i]=='o')\n\t\t\tsum++;\n\t\t else if(s[i]=='u')\n\t\t\t sum++;\n }\n for(i=0;i<n;i++)\n {\n if(s[i]=='1')\n\t\t sum++;\n\t\telse if(s[i]=='3')\n\t\tsum++;\n\t\t else if(s[i]=='5')\n\t\t sum++;\n\t\t\telse if(s[i]=='7')\n\t\t\tsum++;\n\t\t else if(s[i]=='9')\n\t\t\t sum++;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n// CREATED BY AHNAF SHAHREAR\n\nint main ( )\n\n{\n int Z , CARDS = 0 , TEMP ;\n char STRING [ 51 ] ;\n gets ( STRING ) ;\n for ( Z = 0 ; STRING [ Z ] ; Z ++ )\n {\n if ( STRING [ Z ] > 95 && STRING [ Z ] < 123 )\n {\n TEMP = 0 ;\n }\n else TEMP = STRING [ Z ] - '0' ;\n if ( STRING [ Z ] == 'a' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'e' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'i' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'o' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'u' ) CARDS ++ ;\n else if ( TEMP % 2 ) CARDS ++ ;\n }\n printf ( \"%d\\n\", CARDS ) ;\n return 0 ;\n}\n"}, {"source_code": " \n#include<stdio.h>\n#include<string.h>\n\nint main() {\n int n;\n int i=0,s=0;\n char st[51];\n scanf(\"%s\",&st);\n while(i<=strlen(st)){\n if ((st[i] >= '0') && (st[i] <= '9')){\n if ((st[i]-'0') % 2==1) s++;}\n else\n if (!((st[i] != 'a') && (st[i] != 'e')&&(st[i] != 'i') &&(st[i] != 'o')&& (st[i] != 'u')))\n s++;\n i++;\n }\n printf(\"%d\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[50];\n\tscanf(\"%s\",s);\n\tint i,c=0;\n\tfor(i=0;i<strlen(s);i++){\n\t\tif( s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u' || s[i]=='1' || s[i]=='3' || s[i]=='5' || s[i]=='7' || s[i]=='9' )\n\t\t\tc++;\n\t}\n\tprintf(\"%d\",c);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;i<l;i++)\n{\n if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u') j++;\n else if(str[i]>='0' && str[i]<='9')\n {\n s=str[i];\n if(s%2!=0) j++;\n }\n}\n//printf(\"%d\\n\",s);\nprintf(\"%d\",j);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\n\tchar a[50];\n\tscanf(\"%s\",a);\n\tchar x;\n\t//printf(\"%s\\n\",a);\n\t\n\tint s,ans=0;\n\tint i=strlen(a);\n \n\tfor(s=0;s<i;s++)\n\t{\n\n \t\t\n\t\t\n\t\tif(a[s]=='9' || a[s]=='7' || a[s]=='5' || a[s]=='3' || a[s]=='1')\n\t \t{\n\t\t\tans++;\n\t\t}\n\n\t\tif(a[s]=='a' || a[s]=='e' || a[s]=='i' || a[s]=='o' || a[s]=='u')\n\t\t{\n\t\t\tans++;\n\t\t}\n\t}\nprintf(\"%d\\n\",ans);\n\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar flip[] = \"aeiou13579\";\n\nint c, res;\n\nint main(void) {\n while (c = getchar(), c != EOF)\n if (strchr(flip, c))\n ++res;\n printf(\"%d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[50];\n scanf(\"%s\",a);\n int i,s=0,l=0;\n l=strlen(a);\n for(i=0;i<l;i++){\n if((a[i]=='a')||(a[i]=='e')||(a[i]=='i')||(a[i]=='o')||(a[i]=='u')||(a[i]=='1')||(a[i]=='3')||(a[i]=='5')||(a[i]=='7')||(a[i]=='9'))\n s++;\n }\n printf(\"%d\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar s[100];\nint main()\n{\n\tscanf(\"%s\",s);\n\tint ans,i;\n\tans=0;\n\ti=0;\n\twhile(s[i]!='\\0')\n\t{\n\t\tif(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n\t\tans++;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int len,count=0,i,n;\n char ch[100];\n gets(ch);\n len=strlen(ch);\n for(i=0;i<len;i++)\n {\n if(ch[i]>='a' && ch[i]<='z')\n {\n if(ch[i]=='a' || ch[i]=='e' || ch[i]=='i' || ch[i]=='o' || ch[i]=='u') count++;\n }\n else\n {\n n=ch[i]-'0';\n if(n%2!=0) count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\nint vocal(int x){\n\tif(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u')\n\t\treturn 1;\n\treturn 0;\n\n}\n\nint main(){\n\tint a,b,c,d,e,f;\n\tchar A[100];\n\ta = 0;\n\twhile((c = getchar()) != EOF && c != '\\n'){\n\t\tif(isdigit(c)){\n\t\t\tif((c-'0')%2)\n\t\t\t\ta++;\n\n\t\t}else{\n\t\t\tif(vocal(c))\n\t\t\t\ta++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",a);\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n char ch[55];\nint main()\n{\n gets(ch);\n int i;\n int nb=0;\n for(i=0;i<strlen(ch);i++){\n if((ch[i]=='e')||(ch[i]=='a')||(ch[i]=='u')||(ch[i]=='o')||(ch[i]=='i')||(ch[i]=='1')||(ch[i]=='3')||(ch[i]=='5')||(ch[i]=='7')||(ch[i]=='9'))\n nb++;\n }\n printf(\"%d\",nb);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint len = strlen(str);\n\tint temp=0;\n\tint count=0;\n\twhile(temp!=len)\n\t{\n\t\tif((str[temp]=='a'||str[temp]=='e'||str[temp]=='i'||str[temp]=='o'||str[temp]=='u'))\n\t\t{\n\t\tcount++;\n\t\t}\n\t\telse if ((str[temp]=='1'||str[temp]=='3'||str[temp]=='5'||str[temp]=='7'||str[temp]=='9'))\n\t\t{\t\n\t\tcount++;\n\t\t}\n\t\ttemp++;\t\n\t}\n\tprintf(\"%d\\n\",count);\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n char ar[100];\n\n int i,j;\n int k=0;\n for(i=0;i<100;i++){\n scanf(\"%c\",&ar[i]);\n if(ar[i] == '\\n'){\n break;\n }\n else if(ar[i] == '1' || ar[i] == '3' || ar[i] == '5' || ar[i] == '7' || ar[i] == '9'){\n k++;\n }\n else if(ar[i] == 'a' || ar[i] == 'e' || ar[i] == 'i' || ar[i] == 'u' || ar[i] == 'o'){\n k++;\n }\n }\n printf(\"%d\",k);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\nchar c[51],a,e,i,o,u,l;\nint k,count=0;\nscanf(\"%[^\\n]s\",&c);\nl = strlen(c);\nfor(k=0;k<l;k++)\n{\n if(c[k] == 'a' || c[k] == 'e' || c[k] == 'i' || c[k] == 'o' || c[k] == 'u' || c[k]=='1' ||c[k]=='3' || c[k]=='5' ||c[k]=='7' || c[k]=='9')\n {\n count++;\n }\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar s[100];\n\n\t\n\t\n\t\n\tscanf(\"%s\",s);\n\tint i;\n\tint n;\n\t for(n = 0; s[n] != '\\0'; ++n);\n\t\n\n\t\n\tint count=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\t\n\t\tif((s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||(s[i]>47&&s[i]<58&&s[i]%2==1)))\n\t\t{\n\t\t\t\n\t\t\tcount++;\n\t\t}\n\t\n\t\n\t}\n\t\n\tprintf(\"%d\",count);\n\t\n\t\n\t\n\t\nreturn 0;\t\n\t\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char cards[51];\n scanf(\"%s\", &cards);\n int res = 0;\n for(int i = 0; i < strlen(cards); i++){\n if(cards[i] == 'a' || cards[i] == 'e' || cards[i] == 'i' || cards[i] == 'o' || cards[i] == 'u' ||\n cards[i] == '1' || cards[i] == '3' || cards[i] == '5' || cards[i] == '7' || cards[i] == '9')\n res++;\n }\n printf(\"%d\", res);\n return 0;\n}"}, {"source_code": " \n#include<stdio.h>\n#include<string.h>\n\nint main() {\n int n;\n int i=0,s=0;\n char st[51];\n scanf(\"%s\",&st);\n while(i<=strlen(st)){\n if ((st[i] >= '0') && (st[i] <= '9')){\n if ((st[i]-'0') % 2==1) s++;}\n else\n if (!((st[i] != 'a') && (st[i] != 'e')&&(st[i] != 'i') &&(st[i] != 'o')&& (st[i] != 'u')))\n s++;\n i++;\n }\n printf(\"%d\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,cnt;\n char s[50];\n while(scanf(\"%s\",s)==1){cnt=0;\n for(i=0;s[i]!='\\0';i++){\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){\n cnt++;\n }\n if(s[i]=='1' ||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9'){\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char *p,s[51];\n scanf(\"%s\",s);\n p=s;\n int count=0;\n while((*p)!='\\0')\n {\n if(*p=='a'||*p=='e'||*p=='i'||*p=='o'||*p=='u'||*p=='1'||*p=='3'||*p=='5'||*p=='7'||*p=='9')\n {\n count +=1;\n }\n p++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint whetherTurn(int a);\n\nint count = 0;\nchar n[50];\n\nint main(void){\n scanf(\"%[^\\n]s\", n);\n int numberCards = strlen(n);\n for(int i = 0; i < numberCards; i++){\n int element;\n if(n[i] >= '0' && n[i] <= '9'){\n element = n[i] - '0';\n if(element%2 == 1){\n count++;\n }\n }\n else{\n element = n[i];\n count += whetherTurn(element);\n }\n }\n printf(\"%i\\n\", count);\n}\n\nint whetherTurn(int a){\n if(a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')\n return 1;\n else\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar a[200];\n\tgets(a);\n\t\n\tint len =strlen(a);\n\tint sum=0;\n\t\n\tfor(int i=0;i<len;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'|| a[i]=='5'||a[i]=='7'||a[i]=='9')\n\t\tsum++;\n\t}\n\tprintf(\"%d\",sum);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int cnt=0;\n char str[50];\n scanf(\"%s\",str); \n int i=0;\n while(str[i] != '\\0'){\n if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' || str[i] == '1' || str[i] == '3'\n || str[i] == '5' || str[i] == '7' || str[i] == '9')\n cnt++;\n i++;\n }\n printf(\"%d\",cnt);\n}"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\n#include<string.h>\nint pri(char c)\n{\n\tif(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')\n\treturn 1;\n\t\n\treturn 0;\n}\nint main()\n{\n\tint n,v;\n\tchar s[1010];\n\twhile(scanf(\"%s\",s)!=EOF)\n\t{\n\t\tv=0;\n\t\tn=strlen(s);\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(pri(s[i]))\n\t\t\tv++;\n\t\t\telse if(isdigit(s[i])&&(s[i]-'0')%2)\n\t\t\tv++; \n\t\t}\n\t\tprintf(\"%d\\n\",v);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[50];\n int i;\n gets(s);\n int count=0;\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')\n {\n count++;\n\n }\n else if(s[i]=='1'||s[i]=='3'||s[i]=='5'||s[i]=='7'||s[i]=='9')\n {\n\n count++;\n\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int c=0;\n char a[1001];\n scanf(\"%s\",a);\n \n for(int i=0; i<strlen(a); i++)\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9')\n c++;\n printf(\"%d\\n\",c);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char str[501];\n scanf(\"%s\",str);\n int i,n=0,ans=0;\n while(str[n] != '\\0')\n n++;\n for(i=0;i<n;i++)\n {\n if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')\n ans ++;\n if(str[i] == '1' || str[i] == '3' || str[i] == '5' || str[i] == '7' || str[i] == '9')\n ans ++;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char a[1000];\n int ln,i,j;\n gets(a);\n int ck=0;\n ln=strlen(a);\n for(i=0;i<ln;i++)\n {\n // static int ck=0;\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n ck++;\n if(isdigit(a[i])&&a[i]!='0'&&a[i]%2!=0)\n ck++;\n }\n printf(\"%d\\n\",ck);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tchar str[50];\n\tscanf(\"%s\",str);\n\tint len = strlen(str) , count = 0 ;\n\tfor(int i = 0 ; i < len ; i++){\n\t\tif(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u' || str[i] == '1' || str[i] == '3' || str[i] == '5' || str[i] == '7' || str[i]=='9')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void) {\nchar str[51];\nint i,cnt,cntL=0;\nscanf(\"%s\",str);\nfor(i=0;i<strlen(str);i++){\n switch(str[i]){\n case 'e':\n case 'a': \n case 'i':\n case 'o':\n case 'u':\n case '1':\n case'3':\n case '5':\n case '7':\n case '9':\n cntL++;\n }\n}\nprintf(\"%d\",cntL);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint n=strlen(str),i=0,count=0,flag=0;\n\tif (n>1)\n\t{\n\t\tfor (i=0;str[i]!='\\0' && i<=n;i++)\n\t\t{\n\t\t\tint testnum=str[i]-'0';\n\t\t\tint testalpha=str[i]-'a';\n\t\t\tif (testnum>=0 && testnum<10 && testnum%2!=0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse if (testalpha>=0 && testalpha<26)\n\t\t\t{\n\t\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse if (n==1)\n\t{\n\t\tint testnum=str[0]-'0';\n\t\tint testalpha=str[0]-'a';\n\t\tif (testalpha>=0 && testalpha<26)\n\t\t{\n\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t{\n\t\t\t\tcount=1;\n\t\t\t}\n\t\t}\n\t\telse if (testnum>=0 && testnum<10 && (testnum%2)!=0)\n\t\t\t{\n\t\t\t\tcount=1;\n\t\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char a[51];\n int i,c=0;\n gets(a);\n\n for(i=0; a[i]!='\\0'; i++)\n {\n if(a[i]=='a' || a[i]=='e' || a[i]=='i'|| a[i]=='o' || a[i]=='u'|| a[i]=='1' || a[i]=='3'|| a[i]=='5' || a[i]=='7'|| a[i]=='9')\n {\n c += 1;\n }\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include <stdio.h>\n\n// CREATED BY AHNAF SHAHREAR\n\nint main ( )\n\n{\n int Z , CARDS = 0 , TEMP ;\n char STRING [ 51 ] ;\n gets ( STRING ) ;\n for ( Z = 0 ; STRING [ Z ] ; Z ++ )\n {\n if ( STRING [ Z ] > 95 && STRING [ Z ] < 123 )\n {\n TEMP = 0 ;\n }\n else TEMP = STRING [ Z ] - '0' ;\n if ( STRING [ Z ] == 'a' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'e' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'i' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'o' ) CARDS ++ ;\n else if ( STRING [ Z ] == 'u' ) CARDS ++ ;\n else if ( TEMP % 2 ) CARDS ++ ;\n }\n printf ( \"%d\\n\", CARDS ) ;\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[55];\n int i,count=0;\n\n scanf(\"%s\",str);\n\n for(i=0; i<strlen(str); i++)\n {\n if((str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') || (str[i] == '1' || str[i] == '3' || str[i] == '5' || str[i] == '7' || str[i] == '9') )\n {\n count++;\n }\n\n }\n printf(\"%d\\n\",count);\n\n\n return 0;\n}"}, {"source_code": "//\n// main.cpp\n// 908A\n//\n// Created by Mihai Esanu on 6/5/19.\n// Copyright \u00a9 2019 Mihai Esanu. All rights reserved.\n//\n\n#include <stdio.h>\n\nint i,s = 0;\nchar a[80];\n\nint main(int argc, const char * argv[]) {\n \n scanf(\"%s\", &a);\n \n while(a[i] != '\\0')\n {if( a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'u' || a[i] == 'o' || a[i] == '1' || a[i] == '3' || a[i] == '5' || a[i] == '7' || a[i] == '9'){s++;}\n i++;}\n\n \n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar let[55];\n\nint main(){\n int n, i, ans;\n scanf(\"%s\", let);\n n = strlen(let);\n ans = 0;\n for(i=0; i<n; i++){\n if(let[i] == 'a' || let[i] == 'e' || let[i] == 'i' || let[i] == 'o' || let[i] == 'u' ||\n let[i] == '1' || let[i] == '3' || let[i] == '5' || let[i] == '7' || let[i] == '9') ans++;\n }\n printf(\"%d\", ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{ int k=0;\n char a[51];\n scanf(\"%s\",a);\n for(int i=0;i<strlen(a);i++){\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'){\n k++;\n }\n else if(a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9'){\n k++;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tchar s[51];\n\tint i,len,cck,flip=0;\n\tgets(s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\tif(s[i]>=97&&s[i]<=122){\n\t\t\tif(s[i]==97||s[i]==101||s[i]==105||s[i]==111||s[i]==117)\n\t\t\t\tflip++;\n\t\t}\n\t\telse if(s[i]>=48&&s[i]<=57){\n\t\t\tcck=s[i]-48;\n\t\t\tif(cck%2==1)\n\t\t\t\tflip++;\n\t\t}\n\t}\n\tprintf(\"%d\",flip);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar s[100];\n\n\t\n\t\n\t\n\tscanf(\"%s\",s);\n\tint i;\n\tint n;\n\t for(n = 0; s[n] != '\\0'; ++n);\n\t\n\n\t\n\tint count=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\t\n\t\tif((s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||(s[i]>47&&s[i]<58&&s[i]%2==1)))\n\t\t{\n\t\t\t\n\t\t\tcount++;\n\t\t}\n\t\n\t\n\t}\n\t\n\tprintf(\"%d\",count);\n\t\n\t\n\t\n\t\nreturn 0;\t\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar arr[1000];\nint ct=0;\n\nint main(){\n char arr[1000];\n int ct=0;\n\n scanf(\"%s\",arr);\n int a;\n a = strlen(arr);\n for(int i =0;i<a+1;i++){\n if(arr[i]=='a'){\n ct++;\n }\n if(arr[i]=='i'){\n ct++;\n }\n if(arr[i]=='u'){\n ct++;\n }\n if(arr[i]=='e'){\n ct++;\n }\n if(arr[i]=='o'){\n ct++;\n }\n if(arr[i]=='1'){\n ct++;\n }\n if(arr[i]=='3'){\n ct++;\n }\n if(arr[i]=='5'){\n ct++;\n }\n if(arr[i]=='7'){\n ct++;\n }\n if(arr[i]=='9'){\n ct++;\n }\n }\n printf(\"%d\\n\",ct);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long N,i,j,T,M,X,Y,Z;\n char A[51];\n scanf(\"%s\",A);\n for(i=0,N=0;i<strlen(A);i++)\n {\n if(A[i]=='a' || A[i]=='e' || A[i]=='i' || A[i]=='o' || A[i]=='u' || A[i]=='1' || A[i]=='3' || A[i]=='5' || A[i]=='7' || A[i]=='9')\n N++;\n }\n printf(\"%lld\",N);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar str[50];\nint i,j=0,l,s;\ngets(str);\nl=strlen(str);\nfor(i=0;i<l;i++)\n{\n if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u') j++;\n else if(str[i]>='0' && str[i]<='9')\n {\n s=str[i];\n if(s%2!=0) j++;\n }\n}\n//printf(\"%d\\n\",s);\nprintf(\"%d\",j);\nreturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[51];\n\nint main(void){\n int ans=0;\n scanf(\"%s\",s);\n char constt;\n char* ptr = &constt;\n const char test[11]=\"aeiou02468\";\n size_t n = strlen(s);\n for(size_t i = 0; i<n; i++){\n constt=s[i];\n if(strpbrk(ptr,test)!=NULL) ans++;\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,count=0,i;\n\tchar a[51];\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n\t\t\tcount++;\n\t\t\n\t\telse if(a[i]=='0'||a[i]=='2'||a[i]=='4'||a[i]=='6'||a[i]=='8')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar a[50];\n\tint len,i,count=0;\n\tgets(a);\n\tlen=strlen(a);\n\tfor(i=0;i<=len;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='o'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='0'||a[i]=='2'||a[i]=='4'||a[i]=='6'||a[i]=='8')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=50, count=0,i;//fweoifu2308r2\n////scanf(\"%d\",&n);\n//if(n>50)n=50;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'||str[i]=='o'||str[i]=='u')\n count++;\n else if(str[i]=='1'||str[i]=='3'||str[i]=='5'||str[i]=='7'||str[i]=='9')\n count++;\n else count=count;\n }\n printf(\"%d\\n\",count) ;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int c;\n c=getchar();\n int counter=0;\n while(c!=EOF){\n if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){\n counter++;\n }else if(c=='0' || c=='2' || c=='4' || c=='6' || c=='8'){\n counter++;\n }\n c=getchar();\n }\n printf(\"%d\\n\",counter);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[51];\n\tint i;\n\tscanf(\"%s\",s);\n\t\n\t\tint m=0;\n\t\tfor(i=0;s[i]!='\\0';i++)\n\t\t{\n\t\t\tif(s[i]=='a'||s[i]=='e')\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2);\n\t\t\t\tm=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(s[i]=='i'||s[i]=='o')\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2);\n\t\t\t\tm=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(s[i]=='u')\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2);\n\t\t\t\tm=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(m==0)\n\t\t{\n\t\t\tprintf(\"%d\",0);\n\t\t}\n\t\tprintf(\"\\n\");\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint n,i, count=0;\nscanf (\"%d\",&n);\nif(!((n>=0)&&(n<=50))) n=50;\nchar str[n];\nscanf (\"%s\",str);\nfor (i=0;i<n;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[51],i=0,count=0;\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u' || s[i]=='0' || s[i]=='2' || s[i]=='4' || s[i]=='6' || s[i]=='8')\n {\n count=count+1;\n }\n i=i+1;\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar s[50];\nint i=0,a=0;\nscanf(\"%s\",s);\nwhile(s[i]!='\\0')\n{\nif(s[i]=='1' || s[i]=='a' || s[i]=='e' || s[i]=='o' || s[i]=='u' || s[i]=='3' || s[i]=='5' || s[i]=='7')\na=a+1;\ni++;\n}\nprintf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(void)\n{\n char s[100];\n gets(s);\n int l=strlen(s);\n int i;\n int j=0;\n int k;\n char s1[]=\"aeiou\";\n for(i=0;i<l;++i){\n if(s[i]<=57){\n if(s[i]%2!=0){\n j++;\n }\n printf(\"%c\", s[i]);\n }\n if(s[i]>=97){\n for(k=0;k<5;++k){\n if(s[i]==s1[k]){\n j++;\n }\n }\n }\n }\n printf(\"%d\",j);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar s[51];\nint i=0,a=0;\nscanf(\"%s\",s);\nwhile(s[i]!='\\0')\n{\nif(s[i]=='1' || s[i]=='a' || s[i]=='e' || s[i]=='o' || s[i]=='u' || s[i]=='3' || s[i]=='5' || s[i]=='7')\na=a+1;\ni++;\n}\nprintf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=50, count=0,i;\n//scanf(\"%d\",&n);\n//if(n>50)n=50;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'||str[i]=='o'||str[i]=='u')\n count++;\n else if(str[i]=='1'||str[i]=='3'||str[i]=='5'||str[i]=='7'||str[i]=='9')\n count++;\n else count=count;\n }\n printf(\"%d\\n\",count) ;\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int i;\n\tint len=0;\n int count=0;\n char str[60];\n gets(str);\n\tlen=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='0'||str[i]=='2'||str[i]=='4'||str[i]=='6'||str[i]=='8')\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void) {\nchar str[51];\nint i,cnt,cntL=0;\nscanf(\"%s\",str);\nfor(i=0;i<50;i++){\n if(str[i]>=0 && str[i]<=9){\n cnt++;\n }\n else \n switch(str[i]){\n case 'e':\n case 'a': \n case 'i':\n case 'o':\n case 'u':\n cntL++;\n }\n\n}\nprintf(\"%d\",cntL);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int c;\n c=getchar();\n int counter=0;\n int *see=(int *)malloc(sizeof(int)*37);\n int i;\n for(i=0;i<37;i++){\n see[i]=0;\n }\n while(c!=EOF){\n if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){\n if(!see[c-'a']){\n counter++;\n see[c-'a']=1;\n //printf(\"c:%c\\n\",c);\n }\n }else if(c=='0' || c=='2' || c=='4' || c=='6' || c=='8'){\n if(!see[c-'0'+1]){\n counter++;\n see[c-'0'+1]=1;\n //printf(\"n:%c\\n\",c);\n }\n\n }\n c=getchar();\n }\n printf(\"%d\\n\",counter);\n free(see);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint func(char str[])\n{\n int i,count=0;\n for(i=0; str[i]!='\\0';i++){\n if(str[i]%2!=0||str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'){\n count++;\n }\n }\n return count;\n}\nint main()\n{\n int count;\n char n[5];\n while(1==scanf(\"%s\",n)){\n count=func(n);\n printf(\"%d\\n\",count);\n break;\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tchar s[51];\n\tint i,len,cck,flip=0;\n\tgets(s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\tif(s[i]>=97&&s[i]<=122){\n\t\t\tcck=s[i];\n\t\t\tif(cck==97||cck==101||cck==105||cck==111||cck==117)\n\t\t\t\tflip++;\n\t\t\n\t\t}\n\t\telse if(s[i]>=48&&s[i]<=39){\n\t\t\tcck=s[i];\n\t\t\tif(cck%2==1)\n\t\t\t\tflip++;\n\t\t}\n\t}\n\tprintf(\"%d\",flip);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,count=0,i;\n\tchar a[51];\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n\t\t\tcount++;\n\t\t\n\t\telse if(a[i]=='0'||a[i]=='2'||a[i]=='4'||a[i]=='6'||a[i]=='8')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,cnt;\n char s[10];\n while(scanf(\"%s\",s)==1){cnt=0;\n for(i=0;s[i]!='\\0';i++){\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){\n cnt++;\n }\n if(s[i]>'0' &&s[i]<='9'){\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long N,i,j,T,M,X,Y,Z;\n char A[51];\n scanf(\"%s\",A);\n for(i=0,N=0;i<strlen(A);i++)\n {\n if(A[i]=='a' || A[i]=='e' || A[i]=='i' || A[i]=='o' || A[i]=='u' || A[i]=='0' || A[i]=='2' || A[i]=='4' || A[i]=='6' || A[i]=='8')\n N++;\n }\n printf(\"%lld\",N);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n char s[55];\n int c=0,i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if( s[i]=='a'|| s[i]=='e'|| s[i]=='i'|| s[i]=='o'|| s[i]=='u'|| ((s[i]-48)/2!=0) )\n c++;\n }\n printf(\"%d\\n\",c);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tchar s[51];\n\tint i,len,cck,flip=0;\n\tgets(s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\tif(s[i]>=97&&s[i]<=122){\n\t\t\tcck=s[i];\n\t\t\tif(cck==97||cck==101||cck==105||cck==111||cck==117)\n\t\t\t\tflip++;\n\t\t\n\t\t}\n\t\telse if(s[i]>=48&&s[i]<=39){\n\t\t\tcck=s[i];\n\t\t\tif(cck%2==1)\n\t\t\t\tflip++;\n\t\t}\n\t}\n\tprintf(\"%d\",flip);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint n=50,i, count=0;\nscanf (\"%d\",&n);\n//if(!((n>=0)&&(n<=50))) n=50;\nchar str[50];\nscanf (\"%s\",str);\nfor (i=0;i<n;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main(void)\n{\n int c;\n int counts = 0;\n\n while ((c = getchar()) != '\\n' && c != '\\r' && c != '\\0') {\n int temp;\n if (isdigit(c)) {\n temp = c - '0';\n if (temp % 2 == 0)\n counts++;\n }else if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')\n counts++;\n }\n printf(\"%d\", counts);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char ch[5000];\n int l,i,count=0;\n gets(ch);\n l=strlen(ch);\n for(i=0;i<l;i++)\n {\n if(ch[i]=='a' || ch[i]=='e' || ch[i]=='i' || ch[i]=='o' || ch[i]=='u' || ch[i]=='0' || ch[i]=='2' || ch[i]=='4' || ch[i]=='6' || ch[i]=='8')\n count++;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='o'||s[i]=='i'||s[i]=='u')\n {\n a=a+1;\n }\n if(s[i]=='0'||s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8')\n {\n a=a+1;\n }\n }\n printf(\"%d\",a);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar a[55];\nchar b[10] = {'a','e','i','o','u','0','2','4','6','8'};\nint main()\n{\n int i, s, len, j;\n scanf(\"%s\", a);\n len = strlen(a);\n for(i = 0, s = 0; i < len; i++)\n {\n for(j = 0; j <= 9; j++)\n if(a[i]==b[j]) s++;\n }\n printf(\"%d\", s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n char ch[55];\nint main()\n{\n gets(ch);\n int i;\n int nb=0;\n for(i=0;i<strlen(ch);i++){\n if((ch[i]=='e')||(ch[i]=='a')||(ch[i]=='u')||(ch[i]=='o')||(ch[i]=='i')||(ch[i]=='1')||(ch[i]=='3')||(ch[i]=='5')||(ch[i]=='7')||(ch[i]=='9'))\n nb++;\n }\n printf(\"%d\",strlen(ch));\n printf(\"%d\",nb);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=50, count=0,i;\n//scanf(\"%d\",&n);\n//if(n>50)n=50;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'||str[i]=='o'||str[i]=='u')\n count++;\n else if(str[i]=='1'||str[i]=='3'||str[i]=='5'||str[i]=='7'||str[i]=='9')\n count++;\n else count=count;\n }\n printf(\"%d\\n\",count) ;\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[51]={'\\0'};\n\nint main(void){\n int ans=0;\n scanf(\"%s\",s);\n char constt;\n char* ptr = &constt;\n const char test[11]=\"aeiou02468\";\n size_t n = strlen(s);\n for(size_t i = 0; i<n; i++){\n constt=s[i];\n if(strpbrk(ptr,test)!=NULL) ans++;\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n//const int x=50;\n//scanf (\"%d\",&x);\nint n=0;\nint i=0;\nchar s[50];\n\nscanf (\"%s\",&s);\nfor(;i<50;i++){\n if ('a'<=s[i]<='z'){\n if(('a'==s[i])||('e'==s[i])||('i'==s[i])||('o'==s[i])||('u'==s[i]))\n n++;\n }\n else if('0'<=s[i]<='9') {\n if(('1'==s[i])||('3'==s[i])||('5'==s[i])||('9'==s[i]))\n n++;\n } \n\n }\n printf(\"%d\\n\",n) ;\n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int l,i,n,count=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')\n {\n count=count+1;\n }\n else if(s[i]>='1'&&s[i]<='9')\n {\n count=count+1;\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt<n;cnt++){\n switch(str[cnt]){\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u': \n case 'y':\n case '1': \n case '3':\n case '5':\n case '7': flip++;\n }\n }\n printf(\"%d\", flip);\n }"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint n=40,i, count=0;\nscanf (\"%d\",&n);\n//if(!((n>=0)&&(n<=50))) n=50;\nchar str[n];\nscanf (\"%s\",str);\nfor (i=0;i<n;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nchar a[51];\nint main(){\n\nscanf(\"%s\",a);\nint cnt=0;\nfor(int i=0;i<51;i++){\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9'){\n cnt++;\n }\n printf(\"%d\",cnt);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,count=0,l;\n char a[51];\n scanf(\"%s\",a);\n l=strlen(a);\n for(i=0;i<l;i++)\n {\n if(a[i]==1 || a[i]==3 || a[i]==5 || a[i]==7 || a[i]==9 ||a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u')\n count++;\n\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int i,j,n,counter=0,k=0;\n char name[50];\n for(i=0;i<50;i++){\n name[i]='\\0';\n }\n gets(name);\n for(i=0;name[i]!='\\0';i++){\n counter++;\n }\n i=0;\n j=0;\n for(k=0 ;k<counter;k++){\n if(name[k]=='a' || name[k]=='e' || name[k]=='i' || name[k]=='o' || name[k]=='u' ){\n i++;\n }\n if(name[k]=='0' || name[k]=='2' || name[k]=='4' || name[k]=='6' || name[k]=='8'){\n j++;\n }\n }\n printf(\"%d\",i+j);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void) {\nchar str[51];\nint i,cnt,cntL=0;\nscanf(\"%s\",str);\nfor(i=0;i<strlen(str);i++){\n switch(str[i]){\n case 'e':\n case 'a': \n case 'i':\n case 'o':\n case 'u':\n case '0':\n case'2':\n case '4':\n case '6':\n case '8':\n cntL++;\n }\n\n}\nprintf(\"%d\",cntL);\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,num,count=0;\n char string[51];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n if(string[i]>=48&&string[i]<=57)\n {\n num=string[i]-48;\n }\n if(string[i]=='a'||string[i]=='e'||string[i]=='o'||string[i]=='u'||num%2!=0)\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char str[51];\n scanf(\"%s\", str);\n char match[] = {\"aeiou\"};\n int cnt = 0;\n for(int i = 0; str[i]; ++i) {\n if((str[i] - '0') & 1) {\n ++cnt;\n } else {\n for(int j = 0; j < 5; ++j) {\n if(str[i] == match[j]) {\n ++cnt;\n }\n }\n }\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n = 0;\n char s[50];\n scanf (\"%s\", s);\n for(int i = 0; i < 50; i++)\n {\n if( s[i] == '\\0' )\n break;\n if (strchr(\"aeiou\", s[i]))\n n ++;\n if( s[i] >= '0' && s[i] <= '9' && (s[i] - '0')%2 == 0 )\n n ++;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint pri(char c)\n{\n\tif(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')\n\treturn 1;\n\tif(c=='0'||c=='2'||c=='4'||c=='6'||c=='8')\n\treturn 1;\n\treturn 0;\n}\nint main()\n{\n\tint n,v;\n\tchar s[1010];\n\twhile(scanf(\"%s\",s)!=EOF)\n\t{\n\t\tv=0;\n\t\tn=strlen(s);\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(pri(s[i]))\n\t\t\tv++;\n\t\t}\n\t\tprintf(\"%d\\n\",v);\n\t}\n\treturn 0;\n } \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nvoid countingCards(char *str){\n int count = 0;\n int i = 0;\n while(str[i] != '\\0'){\n if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u'){\n count++;\n }\n else if(str[i] == '1' || str[i] == '3' || str[i] == '5' || str[i] == '7' || str[i] == '9'){\n count++;\n }\n i++;\n }\n return;\n}\n\nint main() {\n char str[51];\n scanf(\"%s\", str);\n countingCards(str);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=50, count=0,i;\n//scanf(\"%d\",&n);\n//if(n>50)n=50;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'||str[i]=='o'||str[i]=='u')\n count++;\n else if(str[i]=='1'||str[i]=='3'||str[i]=='5'||str[i]=='7'||str[i]=='9')\n count++;\n else count=count;\n }\n printf(\"%d\\n\",count) ;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=50, count=0,i;\nchar str[n];\nscanf (\"%s\",str);\n for(i=0;i<n;i++)\n {\n if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'||str[i]=='o'||str[i]=='u')\n count++;\n else if(str[i]%2)\n // else if(str[i]=='1'||str[i]=='3'||str[i]=='5'||str[i]=='7'||str[i]=='9')\n count++;\n else count=count;\n }\n printf(\"%d\\n\",count) ;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\nchar c[51],a,e,i,o,u,l;\nint k,count=0;\nscanf(\"%[^\\n]s\",&c);\nl = strlen(c);\nfor(k=0;k<l;k++)\n{\n if(c[k] == 'a' || c[k] == 'e' || c[k] == 'i' || c[k] == 'o' || c[k] == 'u' || (c[k]>'0' && c[k]<='9'))\n {\n count++;\n }\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n char ar[50];\n\n int i,j;\n int k=0;\n for(i=0;i<50;i++){\n scanf(\"%c\",&ar[i]);\n if(ar[i] == '\\n'){\n break;\n }\n else if(ar[i] == '0' || ar[i] == '2' || ar[i] == '4' || ar[i] == '6' || ar[i] == '8' ){\n k++;\n }\n else if(ar[i] == 'a' || ar[i] == 'e' || ar[i] == 'i' || ar[i] == 'u' || ar[i] == 'o' ){\n k++;\n }\n }\n printf(\"%d\",k);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint n=strlen(str),i=0,count=0,flag=0;\n\tif (n>1)\n\t{\n\t\tfor (i=0;str[i]!='\\0' && i<=n;i++)\n\t\t{\n\t\t\tint testnum=str[i]-'0';\n\t\t\tint testalpha=str[i]-'a';\n\t\t\tif (testnum>=0 && testnum<10 && testnum%2!=0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse if (testalpha>=0 && testalpha<26)\n\t\t\t{\n\t\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse if (n==1)\n\t{\n\t\tint testnum=str[i]-'0';\n\t\tint testalpha=str[i]-'a';\n\t\tif (testalpha>=0 && testalpha<26)\n\t\t{\n\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n char ar[50];\n\n int i,j;\n int k=0;\n for(i=0;i<50;i++){\n scanf(\"%c\",&ar[i]);\n if(ar[i] == '\\n'){\n break;\n }\n else if(ar[i] == '0' || ar[i] == '2' || ar[i] == '4' || ar[i] == '6' || ar[i] == '8' ){\n k++;\n }\n else if(ar[i] == 'a' || ar[i] == 'e' || ar[i] == 'i' || ar[i] == 'u' || ar[i] == 'o' ){\n k++;\n }\n }\n printf(\"%d\",k);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,count=0;\n char s[55];\n scanf(\"%s\",&s);\n\n while(s[j]!='\\0')\n {\n if(s[j]=='a' || s[j]=='e' || s[j]=='i' || s[j]=='o' || s[j]=='u' || s[j]=='0' || s[j]=='2' || s[j]=='4' || s[j]=='6' || s[j]=='8')\n count++;\n i=j-1;\n while(i>=0 && (strlen(s))!=2)\n {\n if(s[j]==s[i])\n count--;\n i--;\n }\n j++;\n }\n printf(\"%d\\n\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\nchar c[51],a,e,i,o,u,l;\nint k,p=0,count=0;\nscanf(\"%[^\\n]s\",&c);\nl = strlen(c);\nfor(k=0;k<l;k++)\n{\n if(c[k] == 'a' || c[k] == 'e' || c[k] == 'i' || c[k] == 'o' || c[k] == 'u' )\n {\n {\n count++;\n p=k+1;\n }\n }\n }\n printf(\"%d\",p);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tchar s[51];\n\tint i,len,cck,flip=0;\n\tgets(s);\n\tlen=strlen(s);\n\tfor(i=0;i<len;i++){\n\t\tif(s[i]>=97&&s[i]<=122){\n\t\t\tcck=s[i];\n\t\t\tif(cck==97||cck==101||cck==105||cck==111||cck==117)\n\t\t\t\tflip++;\n\t\t\n\t\t}\n\t\telse if(s[i]>=48&&s[i]<=39){\n\t\t\tcck=s[i];\n\t\t\tif(cck%2==1)\n\t\t\t\tflip++;\n\t\t}\n\t}\n\tprintf(\"%d\",flip);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n = 0;\n char s[50];\n scanf (\"%s\", s);\n for(int i = 0; i < 50; i++)\n {\n if( s[i] == '\\0' )\n break;\n if (strchr(\"aeiou\", s[i]))\n n ++;\n if( s[i] >= '0' && s[i] <= '9' && (s[i] - '0')%2 == 0 )\n n ++;\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\nchar c[51],a,e,i,o,u,l,n;\nint k,count=0;\nscanf(\"%[^\\n]s\",&c);\nl = strlen(c);\nfor(k=0;k<l;k++)\n{\n if(c[k] == 'a' || c[k] == 'e' || c[k] == 'i' || c[k] == 'o' || c[k] == 'u' || c[k]== 'n' || (c[k]>'0' && c[k]<='9'))\n {\n count++;\n }\n }\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint c;\n\nchar s[51];\n\nint main()\n{\n\tint i,j;\n\tscanf(\"%s\",s);\n\n\tint l=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')\n\t\t\tc++;\n\t\tif(s[i]=='0'||s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8')\n c++;\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,s=0;\n\tchar a[10000];\n\tgets(a);\n\tfor (i=0;a[i];i++)\n\t{\n\t\tif (a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')\n\t\ts++;\n\t\telse if (a[i]>='0'&&a[i]<='9')\n\t\t{\n\t\t\tif ((a[i]-'0')%2==0) s++;\n\t\t}\n\n\t}\n\tprintf(\"%d\\n\",s);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n char s[55];\n int c=0,i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n\n if( s[i]=='a'|| s[i]=='e'|| s[i]=='i'|| s[i]=='o'|| s[i]=='u'|| s[i]=='8'||s[i]=='6'||s[i]=='4'||s[i]=='2'||s[i]=='0' )\n c++;\n }\n printf(\"%d\\n\",c);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n int cnt, flip=0, n;\n char str[51];\n gets(str);\n n=strlen(str);\n for(cnt=0;cnt<n;cnt++){\n switch(str[cnt]){\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u': \n case 'y':\n case '1': \n case '3':\n case '5':\n case '7': flip++;\n }\n }\n printf(\"%d\", flip);\n }"}, {"source_code": "#include<stdio.h>\n\nint arr[1000];\n\nint main(){\n\n scanf(\"%[^\\n]\",arr);\n printf(\"test\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main(void)\n{\n int c;\n int counts = 0;\n\n while ((c = getchar()) != '\\n' && c != '\\r' && c != '\\0') {\n int temp;\n if (isdigit(c)) {\n temp = c - '0';\n if (temp % 2 == 0)\n counts++;\n }else if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')\n counts++;\n }\n printf(\"%d\", counts);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nconst int x=50;\n//scanf (\"%d\",&x);\nint n=0;\nint i=1;\nchar s[x];\n\nscanf (\"%s\",&s);\nfor(;i<=x;i++){\n if ('a'<=s[i]<='z'){\n if(('a'==s[i])||('e'==s[i])||('i'==s[i])||('o'==s[i])||('u'==s[i]))\n n++;\n }\n else if('0'<=s[i]<='9') {\n if(('1'==s[i])||('3'==s[i])||('5'==s[i])||('9'==s[i]))\n n++;\n } \n\n }\n printf(\"%d\\n\",n) ;\n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,cnt;\n char s[50];\n while(scanf(\"%s\",s)==1){cnt=0;\n for(i=0;s[i]!='\\0';i++){\n if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'){\n cnt++;\n }\n if(s[i]>'0' &&s[i]<='9'){\n cnt++;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n char ar[100];\n int i,j=0,k,l;\n scanf(\"%s\",&ar);\n\n l = strlen(ar);\n for ( i = 0 ; i < l ; i++)\n {\n if ( ar[i] == 'a' || ar[i] == 'e' || ar[i] == 'i' || ar[i] == 'o' || ar[i] == 'u' || ar[i] == '0' || ar[i] == '2' || ar[i] == '4' || ar[i] == '6' || ar[i] == '8' ){\n j++;\n }\n }\n printf(\"%d\\n\",j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long N,i,j,T,M,X,Y,Z;\n char A[51];\n scanf(\"%s\",A);\n for(i=0,N=0;i<strlen(A);i++)\n {\n if(A[i]=='a' || A[i]=='e' || A[i]=='i' || A[i]=='o' || A[i]=='u' || A[i]=='0' || A[i]=='2' || A[i]=='4' || A[i]=='6' || A[i]=='8')\n N++;\n }\n printf(\"%lld\",N);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid main()\n{\n\tchar s[100];\n\tint T;\n\t\n\tscanf(\"%d\",&T);\n\twhile(T--)\n\t{\n\t\n\tscanf(\"%s\",s);\n\tint i;\n\tint n;\n\t for(n = 0; s[n] != '\\0'; ++n);\n\t\n\n\t\n\tint count=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\t\n\t\tif(n>1&&(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||(s[i]>47&&s[i]<58&&s[i]%2==1)))\n\t\t{\n\t\t\t\n\t\t\tcount++;\n\t\t}\n\t\n\t\n\t}\n\t\n\tprintf(\"%d\",count);\n\t\n\t\n\t\n\t\n\t\n\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int c;\n c=getchar();\n int counter=0;\n int *see=(int *)malloc(sizeof(int)*37);\n int i;\n for(i=0;i<37;i++){\n see[i]=0;\n }\n while(c!=EOF){\n if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){\n //\u5b57\u6bcd\u90fd\u8981\u770b\n counter++;\n }else if(c=='0' || c=='2' || c=='4' || c=='6' || c=='8'){\n if(!see[c-'0'+1]){\n //\u6570\u5b57\u770b\u4e00\u904d\u5c31\u884c\n counter++;\n see[c-'0'+1]=1;\n //printf(\"n:%c\\n\",c);\n }\n\n }\n c=getchar();\n }\n printf(\"%d\\n\",counter);\n free(see);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar s[50];\nint i=0,a=0;\nscanf(\"%s\",s);\nwhile(s[i]!='\\0')\n{\nif(s[i]=='1' || s[i]=='a' || s[i]=='e' || s[i]=='o' || s[i]=='u' || s[i]=='3' || s[i]=='5' || s[i]=='7')\na=a+1;\ni++;\n}\nprintf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "//\n// main.cpp\n// 908A\n//\n// Created by Mihai Esanu on 6/5/19.\n// Copyright \u00a9 2019 Mihai Esanu. All rights reserved.\n//\n\n#include <stdio.h>\n\nint i,s = 0;\nchar a[80];\n\nint main(int argc, const char * argv[]) {\n \n scanf(\"%s\", &a);\n \n while(a[i] != '\\0')\n {if( a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'u' || a[i] == 'o' || a[i] == '2' || a[i] == '4' || a[i] == '6' || a[i] == '8' || a[i] == '0'){s++;}\n i++;}\n \n if(s == 11) s = 10;\n \n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char aa[1000];\n int count=0,i,l;\n gets(aa);\n l=strlen(aa);\n for(i=0;i<l;i++)\n {\n if(aa[i]=='a' || aa[i]=='e' || aa[i]=='i' || aa[i]=='O' || aa[i]=='u')\n {\n count++;\n }\n else if(aa[i]=='1' || aa[i]=='3' || aa[i]=='5' || aa[i]=='7' || aa[i]=='9')\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100];\n int i,j,a;\n a=0;\n scanf(\"%s\",&s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='a'||s[i]=='e'||s[i]=='o'||s[i]=='i'||s[i]=='u')\n {\n a=a+1;\n }\n if(s[i]=='0'||s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8')\n {\n a=a+1;\n }\n }\n printf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,num,count=0;\n char string[51];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n if(string[i]>=48&&string[i]<=57)\n {\n num=string[i]-48;\n }\n if(string[i]=='a'||string[i]=='e'||string[i]=='o'||string[i]=='u'||num%2!=0)\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar key[50],vowel[]={'a','e','i','o','u'},num[]={'0','2','4','6','8'};\nint i,sum=0,j;\nint main()\n{\n scanf(\"%s\",key);\n for(i=0;key[i]!='\\0';i++){\n for(j=0;j<5;j++){\n if(key[i]==vowel[j])\n {\n sum++;\n break;\n }\n if(key[i]<='9'&&key[i]>='0')\n {\n if(key[i]!=num[j])\n {\n sum++;\n }\n break;\n }\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char ara[50];\n scanf(\"%s\",&ara);\n int c=0,c1=0,i,j,l=strlen(ara);\n for(i=0;i<l;i++)\n {\n if(ara[i]=='a'||ara[i]=='e'||ara[i]=='i'||ara[i]=='o'||ara[i]=='u')\n {\n c++;\n }\n }\n for(i=0;i<l;i++)\n {\n if(ara[i]=='0'||ara[i]=='2'||ara[i]=='4'||ara[i]=='6'||ara[i]=='8')\n {\n c1++;\n }\n }\n printf(\"%d\",c+c1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n//#include <stdlib.h>\n\nint main()\n{\nint n=50,i, count=0;\nscanf (\"%d\",&n);\nchar str[n];\nscanf (\"%s\",str);\nfor (i=0;i<n;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]==1)||(str[i]==3)||(str[i]==5)||(str[i]==7)||(str[i]==9))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint n=strlen(str),i=0,count=0,flag=0;\n\tif (n>1)\n\t{\n\t\tfor (i=0;str[i]!='\\0' && i<=n;i++)\n\t\t{\n\t\t\tint testnum=str[i]-'0';\n\t\t\tint testalpha=str[i]-'a';\n\t\t\tif (testnum>=0 && testnum<10 && testnum%2!=0)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse if (testalpha>=0 && testalpha<26)\n\t\t\t{\n\t\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse if (n==1)\n\t{\n\t\tint testnum=str[i]-'0';\n\t\tint testalpha=str[i]-'a';\n\t\tif (testalpha>=0 && testalpha<26)\n\t\t{\n\t\t\tif (testalpha==0 || testalpha==4 || testalpha==8 || testalpha==14 || testalpha==20)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int j=0,count=0;\n char s[55];\n scanf(\"%s\",&s);\n\n while(s[j]!='\\0')\n {\n if(s[j]=='a' || s[j]=='e' || s[j]=='i' || s[j]=='o' || s[j]=='u' || s[j]=='0' || s[j]=='2' || s[j]=='4' || s[j]=='6' || s[j]=='8')\n count++;\n j++;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[50];\n scanf(\"%s\",a);\n int i,s=0,l=0;\n l=strlen(a);\n for(i=0;i<l;i++){\n if((a[i]=='a')||(a[i]=='e')||(a[i]=='i')||(a[i]=='o')||(a[i]=='u')||(a[i]=='0'))\n s++;\n }\n printf(\"%d\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint i, count=0;\n//scanf (\"%d\",&n);\n//if(!((n>=0)&&(n<=50))) n=50;\nchar str[50];\nscanf (\"%s\",str);\nfor (i=0;i<50;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint p=0,j,i;\nchar s[51];\ngets(s);\nj=strlen(s);\nfor(i=0;i<j;i++)\n{if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='0'||s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8')\np=p+1;\n}\nprintf(\"%d\",p);}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint checker( char *sentence){\n \n int i;\n int j;\n sentence=(char*)malloc(51);\n \n scanf(\"%s\", sentence);\n \n\n \n char nexus[10]={'a','e','i','o','u','1','3','5','7','9'};\n \n i=0;\n j=0;\n for(; sentence[i]; ++i){\n if (sentence[i]==nexus[i])\n j++;\n }\n \n return j;\n}\n\n\nint main(){\n char *hayker;\n hayker= (char*)malloc(51);\n scanf(\"%s\", hayker);\n printf(\"%d\", checker(hayker) );\n \n return 0;\n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{\n char temp[55];\n int i,flag1 = 0,flag2=0;\n scanf(\"%s\",temp);\n for(i = 0;i < strlen(temp);i++)\n {\n if(isalpha(temp[i]) != 0)\n {\n switch(temp[i])\n {\n case'a':\n case'e':\n case'i':\n case'o':\n case'u':\n flag1++;\n break;\n }\n }else{\n if((temp[i] - '0')%2 == 0)\n flag2++;\n }\n\n }\n if(flag1 == 0)\n {\n printf(\"%d\\n\",flag1);\n }else printf(\"%d\\n\",flag1+flag2);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100];\n while(scanf(\"%s\",s)!=EOF)\n {\n int t=0;\n for(int i=0;s[i]!='\\0';i++)\n if(s[i]>='a'&&s[i]<='z')\n t++;\n if(t==1)\n t=0;\n\n printf(\"%d\",t);\n\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nchar key[50],vowel[]={'a','e','i','o','u'},num[]={'0','2','4','6','8'};\nint i,sum=0,j;\nint main()\n{\n scanf(\"%s\",key);\n for(i=0;key[i]!='\\0';i++){\n for(j=0;j<5;j++){\n if(key[i]==vowel[j]||key[i]==num[j])\n {\n sum++;\n break;\n }\n }\n }\n printf(\"%d\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nconst int x=50;\n//scanf (\"%d\",&x);\nint n=0;\nint i=1;\nchar s[x];\n\nscanf (\"%s\",&s);\nfor(;i<=x;i++){\n if ('a'<=s[i]<='z'){\n if(('a'==s[i])||('e'==s[i])||('i'==s[i])||('o'==s[i])||('u'==s[i]))\n n++;\n }\n else if('0'<=s[i]<='9') {\n if(('1'==s[i])||('3'==s[i])||('5'==s[i])||('9'==s[i]))\n n++;\n } \n\n }\n printf(\"%d\\n\",n) ;\n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int j=0,count=0;\n char s[55];\n scanf(\"%s\",&s);\n\n while(s[j]!='\\0')\n {\n if(s[j]=='a' || s[j]=='e' || s[j]=='i' || s[j]=='o' || s[j]=='u' || s[j]=='0' || s[j]=='2' || s[j]=='4' || s[j]=='6' || s[j]=='8')\n count++;\n j++;\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "//\n// main.cpp\n// 908A\n//\n// Created by Mihai Esanu on 6/5/19.\n// Copyright \u00a9 2019 Mihai Esanu. All rights reserved.\n//\n\n#include <stdio.h>\n\nint i,s = 0;\nchar a[80];\n\nint main(int argc, const char * argv[]) {\n \n scanf(\"%s\", &a);\n \n while(a[i] != '\\0')\n {if( a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'u' || a[i] == 'o' || a[i] == '2' || a[i] == '4' || a[i] == '6' || a[i] == '8' || a[i] == '0'){s++;}\n i++;}\n \n if(s = 11) s = 10;\n \n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar a[50];\n\tint len,i,count=0;\n\tgets(a);\n\tlen=strlen(a);\n\tfor(i=0;i<=len;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='0'||a[i]=='2'||a[i]=='4'||a[i]=='6'||a[i]=='8')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[51];\n\tscanf(\"%s\",str);\n\tint len = strlen(str);\n\tint temp=0;\n\tint count=0;\n\tint arr1[127]={0};\n\twhile(temp!=len)\n\t{\n\t\tif((str[temp]=='a'||str[temp]=='e'||str[temp]=='i'||str[temp]=='o'||str[temp]=='u')&& arr1[str[temp]]==0)\n\t\t{\n\t\tcount++;\n\t\tarr1[str[temp]]=1;\n\t\t}\n\t\telse if ((str[temp]=='0'||str[temp]=='2'||str[temp]=='4'||str[temp]=='6'||str[temp]=='8')&& arr1[str[temp]]==0)\n\t\t{\t\n\t\tcount++;\n\t\tarr1[str[temp]]=1;\n\t\t}\n\t\ttemp++;\t\n\t}\n\tprintf(\"%d\\n\",count);\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint n,i, count=0;\nscanf (\"%d\",&n);\nif(!((n>=0)&&(n<=50))) n=50;\nchar str[n];\nscanf (\"%s\",str);\nfor (i=0;i<n;i++)\n{\n if((str[i]=='a')||(str[i]=='e')||(str[i]=='i')||(str[i]=='o')||(str[i]=='u')\n ||(str[i]=='1')||(str[i]=='3')||(str[i]=='5')||(str[i]=='7')||(str[i]=='9'))count ++;\n}\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[51],i=0,count=0;\n scanf(\"%s\",&s);\n while(s[i]!=0)\n {\n if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u' || s[i]=='0' || s[i]=='2' || s[i]=='4' || s[i]=='6' || s[i]=='8')\n {\n count=count+1;\n }\n i=i+1;\n }\n printf(\"%d\",count);\n}"}, {"source_code": "int main(){\n//const int x=50;\n//scanf (\"%d\",&x);\nint n=0;\nint i;\nchar s[50];\n\nscanf (\"%s\",s);\nfor(i=0;i<50;i++){\n if ('a'<=s[i]<='z'){\n if((s[i]=='a')||(s[i]=='e')||(s[i]=='i')||(s[i]=='o')||(s[i]=='u'))\n n++;\n }\n else if('0'<=s[i]<='9') {\n if((s[i])=='1'||(s[i])=='3'||(s[i])=='5'||(s[i])=='9')\n n++;\n }\n\n }\n printf(\"%d\\n\",n) ;\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[51]={'\\0'};\n\nint main(void){\n int ans=0;\n scanf(\"%s\",s);\n char constt;\n\n size_t n = strlen(s);\n for(size_t i = 0; i<n; i++){\n constt=s[i];\n if(strpbrk(&constt,\"aeiou02468\")!=NULL) ans++;\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nchar a[51];\nint main(){\n\nscanf(\"%s\",a);\nint cnt=0;\nfor(int i=0;i<51;i++){\n if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='1'||a[i]=='3'||a[i]=='5'||a[i]=='7'||a[i]=='9'){\n cnt++;\n }\n printf(\"%d\",cnt);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int c;\n c=getchar();\n int counter=0;\n int *see=(int *)malloc(sizeof(int)*37);\n int i;\n for(i=0;i<37;i++){\n see[i]=0;\n }\n while(c!=EOF){\n if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u'){\n if(!see[c-'a']){\n counter++;\n see[c-'a']=1;\n //printf(\"c:%c\\n\",c);\n }\n }else if(c=='0' || c=='2' || c=='4' || c=='6' || c=='8'){\n if(!see[c-'0'+1]){\n counter++;\n see[c-'0'+1]=1;\n //printf(\"n:%c\\n\",c);\n }\n\n }\n c=getchar();\n }\n printf(\"%d\\n\",counter);\n free(see);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char v[51];\n scanf(\"%s\",v);\n int i,n=strlen(v);\n int ans=0;\n for (i=0;i<n;i++)\n {\n switch(v[i])\n {\n case 'a':\n case 'e':\n case 'i':\n case 'o':\n case 'u':\n case '0':\n case '2':\n case '4':\n case '6':\n case '8':\n ans++;\n break;\n default:\n break;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[100];\n int i,j=0,len;\n scanf(\"%s\",a);\n len=strlen(a);\n for(i=0;i<len;i++)\n {\n if(a[i]=='a' || a[i]=='e' || a[i]=='i' || a[i]=='o' || a[i]=='u' ||a[i]%2!=0)j++;\n }\n printf(\"%d\\n\",j);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n=0;\nint i=0;\nchar s[50];\n\nscanf (\"%s\",&s);\nfor(i=0;i<50;i++){\n if (('a'<=s[i])&&(s[i]<='z')){\n if(('a'==s[i])||('e'==s[i])||('i'==s[i])||('o'==s[i])||('u'==s[i]))\n n++;\n }\n else if('0'<=s[i]<='9') {\n if(('1'==s[i])||('3'==s[i])||('5'==s[i])||('9'==s[i]))\n n++;\n } \n\n }\n printf(\"%d\\n\",n) ;\n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,l2,T,i,j,k,r,count=0;\n //scanf(\"%d\",&T);\n char s1[101];\n scanf(\"%s\",s1);\n l=strlen(s1);\n for(i=0; i<l; i++) {\n if(s1[i]=='a'||s1[i]=='e'||s1[i]=='i'||s1[i]=='o'||s1[i]=='u') {\n count++;\n }\n else if(s1[i]=='0'||s1[i]=='2'||s1[i]=='4'||s1[i]=='6'||s1[i]=='8')\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar a[50];\n\tint len,i,count=0;\n\tgets(a);\n\tlen=strlen(a);\n\tfor(i=0;i<=len;i++)\n\t{\n\t\tif(a[i]=='a'||a[i]=='e'||a[i]=='o'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='0'||a[i]=='2'||a[i]=='4'||a[i]=='6'||a[i]=='8')\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint c;\n\nchar s[51];\n\nint main()\n{\n\tint i,j;\n\tscanf(\"%s\",s);\n\n\tint l=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')\n\t\t\tc++;\n\t\tif(s[i]=='0'||s[i]=='2'||s[i]=='4'||s[i]=='6'||s[i]=='8')\n c++;\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}\n"}], "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223"} {"nl": {"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_spec": "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_spec": "Print the minimum number of seconds until Xaniar reaches height a1 and Abol reaches height a2 or print -1 otherwise.", "sample_inputs": ["5\n4 2\n1 1\n0 1\n2 3", "1023\n1 2\n1 0\n1 2\n1 1"], "sample_outputs": ["3", "-1"], "notes": "NoteIn the first sample, heights sequences are following:Xaniar: Abol: "}, "positive_code": [{"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n int i;\n for(i=0;i<n;i++)\n printf(\"%d \",a[i]);\n printf(\"\\n\");\n}\nint gcd(int a,int b)\n{\n int r;\n while(b!=0)\n {\n r=a%b;\n a=b;\n b=r;\n }\n return a;\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n int t=2;\n a[h]=1;\n while(1)\n {\n h=((x*h)+y)%m;\n if(a[h]!=0)\n {\n a[st]=a[h];\n a[l]=t-a[h];\n break;\n }\n a[h]=t;\n t++;\n }\n}\nint main()\n{\n st=1000003;\n l=1000004;\n ll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t,a,b;\n ll t1,t2;\n scanf(\"%d\",&m);\n scanf(\"%lld %lld\",&h1,&a1);\n scanf(\"%lld %lld\",&x1,&y1);\n scanf(\"%lld %lld\",&h2,&a2);\n scanf(\"%lld %lld\",&x2,&y2);\n mark(u,x1,y1,h1);\n mark(v,x2,y2,h2);\n t1=-1;t2=-1;\n if(u[a1]>0 && v[a2]>0)\n {\n if(u[a1]==v[a2])\n {\n printf(\"%d\\n\",u[a1]-1);\n return 0;\n }\n if((u[a1]>=u[st]) && (v[a2]>=u[a1] && (v[a2]-u[a1])%u[l]==0)){\n printf(\"%d\\n\",v[a2]-1);\n return 0; }\n else if(v[a2]>=v[st] && (u[a1]>=v[a2] && (u[a1]-v[a2])%v[l]==0)){\n printf(\"%d\\n\",u[a1]-1); \n return 0;\n }\n else if((u[a1]>=u[st] && v[a2]>=v[st]))\n {\n t1=gcd(u[l],v[l]);\n t2=u[a1]-v[a2];\n if(t2<0)\n t2=-t2;\n if(t2%t1!=0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n a=u[a1]-1;\n b=v[a2]-1;\n while(a!=b)\n {\n if(a<b)\n a+=u[l];\n else\n b+=v[l]; \n\n }\n printf(\"%lld\\n\",a); \n return 0;\n }\n }\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tcount3=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tcount4=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\t\n//\tprintf(\"%lld %lld \",count3,count4);\n//\tprintf(\"%lld %lld \",count1,count2);\n\t\n\tif(count3==-1 && count4==-1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\telse if(count3==-1)\n\t{\n\t\tif(count1<count2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tif((count1-count2)%count4==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count1);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(count4==-1)\n\t{\n\t\tif(count2<count1)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tif((count2-count1)%count3==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count2);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\ti=0;\n\t\n\t\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= 2 * m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (t[i][0] > 0 && pre == a[i]) {\n t[i][1] = j;\n break;\n }\n if (t[i][0] == -1 && pre == a[i]) {\n t[i][0] = j;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n if (t[i][1] == -1) {\n t[i][1] = 0;\n }\n else {\n t[i][1] -= t[i][0];\n }\n if (t[i][0] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if (k * t[1][1] + t[1][0] - t[0][0] < 0ll) {\n continue;\n }\n if ((k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (t[0][1] == 0) {\n if (t[1][1] == 0) {\n if (t[0][0] == t[1][0]) {\n k1 = 0;\n }\n }\n else if ((t[0][0] - t[1][0]) % t[1][1] == 0) {\n k1 = (t[0][0] - t[1][0]) / t[1][1];\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", (long long)k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\ntypedef long long LONG;\n\nint main(){\n LONG m = 1;\n LONG h1 = 0; LONG a1 = 0;\n LONG x1 = 0; LONG y1 = 0;\n LONG h2 = 0; LONG a2 = 0;\n LONG x2 = 0; LONG y2 = 0;\n scanf(\"%lld\", &m);\n scanf(\"%lld %lld\", &h1, &a1);\n scanf(\"%lld %lld\", &x1, &y1);\n scanf(\"%lld %lld\", &h2, &a2);\n scanf(\"%lld %lld\", &x2, &y2);\n /*\n int s = 0;\n int m2 = m * m\n while (s < m2) {\n if (h1 == a1 && h2 == a2) {\n printf(\"%d\", s);\n return 0;\n }\n h1 = (x1 * h1 + y1) % m;\n h2 = (x2 * h2 + y2) % m;\n s++;\n }\n */\n\n LONG s1 = 0;\n while (s1 < m && h1 != a1) {\n h1 = (x1 * h1 + y1) % m;\n s1++;\n //printf(\"%d %d\\n\",s1,h1);\n }\n if (s1 == m) {\n printf(\"-1\");\n return 0;\n }\n\n LONG c1 = 0;\n while (c1 == 0 || (c1 <= m && h1 != a1)) {\n h1 = (x1 * h1 + y1) % m;\n c1++;\n //printf(\"%d %d\\n\",c1,h1);\n }\n\n LONG s2 = 0;\n while (s2 < m && h2 != a2) {\n h2 = (x2 * h2 + y2) % m;\n s2++;\n //printf(\"%d %d\\n\",s2,h2);\n }\n if (s2 == m) {\n printf(\"-1\");\n return 0;\n }\n\n LONG c2 = 0;\n while (c2 == 0 || (c2 <= m && h2 != a2)) {\n h2 = (x2 * h2 + y2) % m;\n c2++;\n //printf(\"%d %d\\n\",c2,h2);\n }\n\n /*\n printf(\"%d\\n\",s1);\n printf(\"%d\\n\",c1);\n printf(\"%d\\n\",s2);\n printf(\"%d\\n\",c2);\n */\n if (c1 != m+1 && c2 != m+1) {\n LONG limit = c1 * c2 + s1 + s2;\n while (s1 < limit && s2 < limit) {\n if (s1 == s2) {\n printf(\"%lld\", s1);\n return 0;\n }\n else if (s1 < s2) {\n s1 += c1;\n }\n else {\n s2 += c2;\n }\n }\n }\n else if (c1 != m+1 && c2 == m+1) {\n while (s1 < s2)\n s1 += c1;\n if (s1 == s2) {\n printf(\"%lld\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m+1 && c2 != m+1) {\n while (s2 < s1)\n s2 += c2;\n if (s1 == s2) {\n printf(\"%lld\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m+1 && c2 == m+1) {\n if (s1 == s2) {\n printf(\"%lld\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint gcd(int a,int b)\n{\n\tint r;\n\twhile(b!=0)\n\t{\n\t\tr=a%b;\n\t\ta=b;\n\t\tb=r;\n\t}\n\treturn a;\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t,a,b;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\tprint(u,m);\n//\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]>0 && v[a2]>0)\n\t{\n\t\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\t\tif((u[a1]>=u[st]) && (v[a2]>=u[a1] && (v[a2]-u[a1])%u[l]==0)){\n\t\t\tprintf(\"%d\\n\",v[a2]-1);\n\t\t\treturn 0;\t}\n\t\telse if(v[a2]>=v[st] && (u[a1]>=v[a2] && (u[a1]-v[a2])%v[l]==0)){\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\t\n\t\t\treturn 0;\n\t\t}\n\t\telse if((u[a1]>=u[st] && v[a2]>=v[st]))\n\t\t{\n\t\t\tt1=gcd(u[l],v[l]);\n\t\t\tt2=u[a1]-v[a2];\n\t\t\tif(t2<0)\n\t\t\t\tt2=-t2;\n\t\t\tif(t2%t1!=0)\n\t\t\t{\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\ta=u[a1]-1;\n\t\t\tb=v[a2]-1;\n\t\t\twhile(a!=b)\n\t\t\t{\n\t\t\t\tif(a<b)\n\t\t\t\t\ta+=u[l];\n\t\t\t\telse\n\t\t\t\t\tb+=v[l];\t\n\n\t\t\t}\n\t\t\tprintf(\"%lld\\n\",a);\t\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,i;\n \n scanf(\"%lld\",&m);\n \n long long h1,a1;\n scanf(\"%lld %lld\",&h1,&a1);\n \n long long x1,y1;\n scanf(\"%lld %lld\",&x1,&y1);\n \n long long h2,a2;\n scanf(\"%lld %lld\",&h2,&a2);\n \n long long x2,y2;\n scanf(\"%lld %lld\",&x2,&y2);\n \n long long count=0;\n \n long long initial1 = h1;\n long long initial2 = h2;\n \n \n long long flag=0;\n long long temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n //printf(\"h1 is %lld\\n\",h1);\n //printf(\"h2 is %lld\\n\",h2);\n count = count+1;\n temp = temp+1;\n if (temp> (m+10))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n //printf(\"count is %lld\\n\",count);\n \n if (flag==0)\n {\n long long temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%lld\\n\",count);\n flag=1;\n \n }\n else\n {\n long long z1=1, z2=0;\n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n z1 = ((z1%m) * (x2%m))%m;\n z2 = (((z2%m)*(x2%m))%m + y2%m)%m;\n temp1++;\n //count++;\n if (temp1>(m+10))\n {\n flag=1;\n //prlong longf(\"here\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n long long temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((z1%m)*(h2%m))%m + z2%m)%m;\n temp2++;\n if (temp2 > (m+10))\n {\n flag=1;\n //prlong longf(\"second\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%lld\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int p,h1,a1,x1,y,h2,a2,x2,y2;\nlong long int hone(long long int h)\n{\n\treturn (x1*h+y)%p;\n}\nlong long int htwo(long long int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tlong long int i,hi=a1,c=0,d=1,h=hone(h1),o=0,a,b;\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\twhile(h!=h1 && d<=p)\n\t{\n\t\th=hone(h);\n\t\td++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%lld\\n\",c);\n\t\telse if(d>p)\n\t\t\tprintf(\"-1\\n\");\n\t\telse\n\t\t{\n\t\t\ta=1;b=0;\n\t\t\tfor(i=0;i<d;i++)\n\t\t\t{\n\t\t\t\ta=(a*x2)%p;\n\t\t\t\tb=(b*x2+y2)%p;\n\t\t\t}\n\t\t\twhile(hi!=h2 && o<=p)\n\t\t\t{\n\t\t\t\thi=(a*hi+b)%p;\n\t\t\t\to++;\n\t\t\t}\n\t\t\tif(o>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",c+o*d);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int p,h1,a1,x1,y,h2,a2,x2,y2;\nlong long int hone(long long int h)\n{\n\treturn (x1*h+y)%p;\n}\nlong long int htwo(long long int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tlong long int i,hi=a1,c=0,d=1,h=hone(h1),o=0,a,b;\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\twhile(h!=h1 && d<=p)\n\t{\n\t\th=hone(h);\n\t\td++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%lld\\n\",c);\n\t\telse if(d>p)\n\t\t\tprintf(\"-1\\n\");\n\t\telse\n\t\t{\n\t\t\ta=1;b=0;\n\t\t\tfor(i=0;i<d;i++)\n\t\t\t{\n\t\t\t\ta=(a*x2)%p;\n\t\t\t\tb=(b*x2+y2)%p;\n\t\t\t}\n\t\t\twhile(hi!=h2 && o<=p)\n\t\t\t{\n\t\t\t\thi=(a*hi+b)%p;\n\t\t\t\to++;\n\t\t\t}\n\t\t\tif(o>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",c+o*d);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong long\ncount_step(unsigned long long h, unsigned long long a, unsigned long long x, unsigned long long y, unsigned int m) {\n if (h == a) return 0;\n\n char mark[m];\n memset(mark, 0, m);\n\n unsigned long long c = 0;\n while (h != a) {\n if (mark[h])\n return -1;\n mark[h] = 1;\n h = (x * h + y) % m;\n c++;\n }\n return c;\n}\n\n\nlong long gcd(long long a, long long b) {\n long long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long long u1, long long u2, long long v2) {\n if (v2 == 0 && u1 != u2 || (u1 < u2 || (u1 - u2) % v2 != 0))\n no_solution();\n printf(\"%I64d\", u1);\n exit(0);\n}\n\nint main() {\n unsigned int m;\n unsigned long long h1, a1, x1, y1;\n unsigned long long h2, a2, x2, y2;\n\n scanf(\"%d %I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -1)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n\n if (v2 == 0)\n zero(u2, u1, v1);\n\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long long t2 = 0;\n long long s = u2 - u1 + v2 * t2;\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = u2 - u1 + v2 * t2;\n }\n printf(\"%I64d\", u2 + v2 * t2);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nchar ar[1000006];\nvoid swap(long long *,long long *);\nint main(){\n\tlong long m,h1,a1,x1,y1,h2,a2,x2,y2,oh,i1,i2,r1,r2,nh,noh,na,t;\n\tchar f1,f2;\n\tfor(m=0;m<1000006;m++)\n\t\tar[m]=0;\n\tf1=0;f2=0;\n\tscanf(\"%I64d\",&m);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h1,&a1,&x1,&y1);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h2,&a2,&x2,&y2);\n\tfor(i1=0,oh=h1;h1!=a1;i1++){\n\t\tar[h1]=4;\n\t\th1=(h1*x1+y1)%m;\n\t\tif(ar[h1]==4)\n\t\t\tbreak;\n\t}\n\tif(h1!=a1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tfor(i2=0,oh=h2;h2!=a2;i2++){\n\t\tar[h2]=5;\n\t\th2=(h2*x2+y2)%m;\n\t\tif(ar[h2]==5)\n\t\t\tbreak;\n\t}\n\tif(h2!=a2){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(i1==i2){\n\t\tprintf(\"%I64d\\n\",i1);\n\t\treturn 0;\n\t}\n\tfor(r1=1,oh=h1;;r1++){\n\t\tar[h1]=1;\n\t\th1=(h1*x1+y1)%m;\n\t\tif(ar[h1]==1)\n\t\t\tbreak;\n\t}\n\tif(h1!=oh){\n\t\tf1=1;\n\t}\n\tfor(r2=1,oh=h2;;r2++){\n\t\tar[h2]=2;\n\t\th2=(h2*x2+y2)%m;\n\t\tif(ar[h2]==2)\n\t\t\tbreak;\n\t}\n\tif(h2!=oh){\n\t\tf2=1;\n\t}\n\tif(f1&&!f2){\n\t\tif(i1>i2&&(i1-i2)%r2==0)\n\t\t\tprintf(\"%I64D\\n\",i1);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\telse if(f2&&!f1){\n\t\tif(i2>i1&&(i2-i1)%r1==0)\n\t\t\tprintf(\"%I64d\\n\",i2);\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\telse if(f1&&f2){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(i1>i2){\n\t\tswap(&a1,&a2);\n\t\tswap(&i1,&i2);\n\t\tswap(&r1,&r2);\n\t}\n\tt=i2-i1;\n\tt%=r1;\n\tfor(na=0,noh=t;t!=0;na++){\n\t\tar[t]=3;\n\t\tt=(t+r2)%r1;\n\t\tif(ar[t]==3)\n\t\t\tbreak;\n\t}\n\tif(t!=0)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%I64d\\n\",i2+r2*na);\n\treturn 0;\n}\n\nvoid swap(long long *a,long long *b){\n\tlong long t;\n\tt=*a;\n\t*a=*b;\n\t*b=t;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define INF 1000000000\n\nint flag[1000000];\n\nint main(void) {\n int tmp;\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n long long cur, sum, l1, r1, l2, r2, pos1, pos2;\n\n while(~scanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2)){\n\n memset(flag, 0, sizeof flag);\n sum = 0;\n cur = h1;\n pos1 = INF;\n do {\n flag[cur] = 1;\n if (cur == a1)\n pos1 = sum;\n cur = (x1 * cur + y1) % m;\n sum++;\n } while (!flag[cur]);\n tmp = cur;\n l1 = 0;\n cur = h1;\n while (cur != tmp) {\n cur = (x1 * cur + y1) % m;\n l1++;\n }\n r1 = sum - l1;\n if (pos1 == INF) {\n puts(\"-1\");\n goto contin;\n }\n\n memset(flag, 0, sizeof flag);\n sum = 0;\n cur = h2;\n pos2 = INF;\n do {\n flag[cur] = 1;\n if (cur == a2)\n pos2 = sum;\n cur = (x2 * cur + y2) % m;\n sum++;\n } while (!flag[cur]);\n tmp = cur;\n l2 = 0;\n cur = h2;\n while (cur != tmp) {\n cur = (x2 * cur + y2) % m;\n l2++;\n }\n r2 = sum - l2;\n if (pos2 == INF) {\n puts(\"-1\");\n goto contin;\n }\n\n if (pos1 < l1 && pos2 < l2) {\n if (pos1 != pos2) {\n puts(\"-1\");\n goto contin;\n }\n printf(\"%lld\\n\", pos1);\n } else if (pos1 < l1) {\n for (cur = pos2; cur <= pos1; cur += r2)\n if (cur == pos1) {\n printf(\"%lld\\n\", pos1);\n goto contin;\n }\n puts(\"-1\");\n } else if (pos2 < l2) {\n for (cur = pos1; cur <= pos2; cur += r1)\n if (cur == pos2) {\n printf(\"%lld\\n\", pos2);\n goto contin;\n }\n puts(\"-1\");\n } else\n if (pos1 > pos2) {\n for (cur = pos1; cur < pos1 + r1 * r2; cur += r1)\n if ((cur - l2) % r2 + l2 == pos2) {\n printf(\"%lld\\n\", cur);\n goto contin;\n }\n puts(\"-1\");\n } else {\n for (cur = pos2; cur < pos2 + r2 * r1; cur += r2)\n if ((cur - l1) % r1 + l1 == pos1) {\n printf(\"%lld\\n\", cur);\n goto contin;\n }\n puts(\"-1\");\n }\n contin:;\n}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(int argc, char const *argv[])\n{\n int i,m,h1,h2,a1,a2,x1,x2,y1,y2;\n __int64 cnt1,cnt2,tmp,tmp1,tmp2;\n while(scanf(\"%d\",&m)!=EOF)\n {\n scanf(\"%d %d %d %d %d %d %d %d\",&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n\n for(i=0,tmp1=0,tmp=h1,cnt1=0;i<m;i++)\n {\n tmp=(tmp*x1+y1)%m;\n if(tmp==a1)\n {\n if(!tmp1) {tmp1=i+1;i=-1;}\n else {cnt1=i+1;break;}\n }\n }\n for(i=0,tmp2=0,tmp=h2,cnt2=0;i<m;i++)\n {\n tmp=(tmp*x2+y2)%m;\n if(tmp==a2)\n {\n if(!tmp2) {tmp2=i+1;i=-1;}\n else {cnt2=i+1;break;}\n }\n }\n\n if (!tmp1||!tmp2)\n {\n printf(\"-1\\n\"); continue;\n }\n\n if(tmp1==tmp2) {printf(\"%I64d\\n\",tmp1);continue;}\n for(i=0,tmp=tmp1;i<=m;tmp+=cnt1,i++)\n {\n if(!cnt2&&tmp==tmp2) {printf(\"%I64d\\n\", tmp);break;}\n if(cnt2&&tmp>=tmp2&&(tmp-tmp2)%cnt2==0)\n {\n printf(\"%I64d\\n\", tmp);\n break;\n }\n }\n if(i==m+1) printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int m=1;\n\tlong long int h1=0,a1=0,x1=0,y1=0;\n\tlong long int h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%lld\",&m);\n\tscanf(\"%lld%lld\",&h1,&a1);\n\tscanf(\"%lld%lld\",&x1,&y1);\n\tscanf(\"%lld%lld\",&h2,&a2);\n\tscanf(\"%lld%lld\",&x2,&y2);\n\tlong long int initial1=h1;\n\tlong long int initial2=h2;\n\tlong long int count=0;\n\tlong long int q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tif(count>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;}\n\t\t \n\t\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\t}\n\tif(h2==a2){\n\t\tprintf(\"%lld\\n\",q );\n\t\treturn 0;\n\t}\n\tlong long int c=0;\n\twhile(++c){\n\t\th1=(x1*h1+y1)%m;\n\t\tif(h1==a1) break;\n\t\tif(c>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(h1==a1) break;\n\t}\n\t\n\tlong long int i; long long a=1, b=0;\n\tfor(i=0;i<c;i++){\n\t\ta=(a*x2)%m;\n\t\tb=(b*x2+y2)%m;\n\t}\n\t//printf(\"%lld %lld\\n\",a,b );\n\tint count1=0;\n\twhile(h2!=a2){\n\t\tcount1++;\n\t\th2=(a*h2+b)%m;\n\t\tif(h2==a2){\n\t\t\tprintf(\"%lld\\n\",q+count1*c );\n\t\t\treturn 0;\n\t\t}\n\t\tif(count1>m+1){printf(\"-1\\n\");return 0;}\n\t\t//printf(\"%lld\\n\",h2 );\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nlong long number1[MAXN],number2[MAXN];\n\nvoid gcd(long long a,long long b,long long * d,long long * x,long long * y)\n{\n if(!b){*d=a;*x=1;*y=0;}\n else {gcd(b,a%b,d,y,x);(*y)-=(*x)*(a/b);}\n}\n\nint main()\n{\n long long m,h1,a1,x1,y1,h2,a2,x2,y2;\n long long x,y,d,i,len1,len2,b1,b2;\n long long aa,bb,flag1,flag2,flag11,flag22;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n number1[h1]=1;\n len1=1;\n flag1=1;\n flag11=flag22=0;\n for(x=h1,i=0;i<=m;i++)\n {\n x=(x1*x+y1)%m;\n if(!number1[x])number1[x]=++len1;\n else\n {\n len1=len1+1-number1[x];\n if(number1[a1]>0&&number1[a1]<number1[x])flag11=1;\n break;\n }\n }\n if(number1[a1]>0)b1=number1[a1]-number1[h1];\n else flag1=0;\n\n flag2=1;\n number2[h2]=1;\n len2=1;\n for(x=h2,i=0;i<=m;i++)\n {\n x=(x2*x+y2)%m;\n if(!number2[x])number2[x]=++len2;\n else\n {\n len2=len2+1-number2[x];\n if(number2[a2]>0&&number2[a2]<number2[x])flag22=1;\n break;\n }\n }\n if(number2[a2]>0)b2=number2[a2]-number2[h2];\n else flag2=0;\n\n if(b1==b2)\n {\n printf(\"%I64d\\n\",b1);\n return 0;\n }\n if(flag1==0|flag2==0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n if(flag11&&flag22)\n {\n if(b1==b2)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag11)\n {\n if(b1>b2&&(b1-b2)%len2==0)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag22)\n {\n if(b2>b1&&(b2-b1)%len1==0)printf(\"%I64d\\n\",b2);\n else printf(\"-1\\n\");\n return 0;\n }\n gcd(len1,len2,&d,&x,&y);\n if((b2-b1)%d!=0)printf(\"-1\\n\");\n else\n {\n if((b2-b1)!=d)\n {\n x*=(b2-b1)/d;\n y*=(b2-b1)/d;\n }\n aa=len1/d;\n bb=len2/d;\n while(x<0||y>0)\n {\n x+=bb;\n y-=aa;\n }\n while(x-bb>=0&&y+aa<=0)\n {\n x-=bb;\n y+=aa;\n }\n printf(\"%I64d\\n\",b1+x*len1);\n }\n\n\n return 0;\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n#include <string.h>\n\n#define M\t1000000\n\nint used[M];\nint i_, m_;\n\nint solve(int h, int a, int x, int y, int m) {\n\tint i;\n\n\tmemset(used, -1, sizeof used);\n\ti_ = -1;\n\tfor (i = 0; used[h] < 0; h = ((long long) x * h + y) % m, i++) {\n\t\tused[h] = i;\n\t\tif (h == a && i_ == -1)\n\t\t\ti_ = i;\n\t}\n\tif (i_ == -1)\n\t\treturn 0;\n\tif (i_ < used[h])\n\t\treturn 1;\n\tm_ = i - used[h];\n\treturn 2;\n}\n\nint solve1(int i, int j, int m) {\n\treturn i >= j && (i - j) % m == 0 ? i : -1;\n}\n\nint d_, x_, y_;\n\nvoid gcd_(int a, int b) {\n\tif (b == 0) {\n\t\td_ = a;\n\t\tx_ = 1, y_ = 0;\n\t} else {\n\t\tint tmp;\n\n\t\tgcd_(b, a % b);\n\t\ttmp = x_ - a / b * y_; x_ = y_, y_ = tmp;\n\t}\n}\n\nlong long solve2(int i, int n, int j, int m) {\n\tint a, b, c;\n\tlong long x;\n\n\tif (i < j)\n\t\treturn solve2(j, m, i, n);\n\t/* i + x * n == j + y * m */\n\t/* x * n - y * m == j - i */\n\t/* x_ * n + y_ * m == d_ */\n\tgcd_(n, m);\n\tif ((j - i) % d_)\n\t\treturn -1;\n\ta = n / d_;\n\tb = m / d_;\n\tc = (j - i) / d_;\n\t/* x * a - y * b == c */\n\t/* x_ * a + y_ * b == 1 */\n\tx = (long long) x_ * c % b;\n\tif (x < 0)\n\t\tx += b;\n\treturn i + x * n;\n}\n\nint main() {\n\tint m, h1, a1, x1, y1, h2, a2, x2, y2, i1, m1, c1, i2, m2, c2;\n\tlong long ans;\n\n\tscanf(\"%d%d%d%d%d%d%d%d%d\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\tc1 = solve(h1, a1, x1, y1, m);\n\tif (c1 == 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\ti1 = i_, m1 = m_;\n\tc2 = solve(h2, a2, x2, y2, m);\n\tif (c2 == 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\ti2 = i_, m2 = m_;\n\tif (c1 == 1 && c2 == 1)\n\t\tans = i1 == i2 ? i1 : -1;\n\telse if (c1 == 1 && c2 == 2)\n\t\tans = solve1(i1, i2, m2);\n\telse if (c1 == 2 && c2 == 1)\n\t\tans = solve1(i2, i1, m1);\n\telse\n\t\tans = solve2(i1, m1, i2, m2);\n\tprintf(\"%lld\\n\", ans < 0 ? -1 : ans);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tcount3=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tcount4=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\t\n\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t{\n\t\tprintf(\"%lld\",count);\n\t\treturn 0;\n\t}\n\t\n\tif(count3==-1 || count4==-1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\ti=0;\n\t\n\t\n\t//printf(\"%lld %lld \",count3,count4);\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tcount3=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tcount4=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\t\n\t//printf(\"%lld %lld \",count3,count4);\n\t//printf(\"%lld %lld \",count1,count2);\n\t\n\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t{\n\t\tprintf(\"%lld\",count);\n\t\treturn 0;\n\t}\n\t\n\tif(count3==-1 && count4==-1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\telse if(count3==-1)\n\t{\n\t\tif((count1-count2)%count4==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(count4==-1)\n\t{\n\t\tif((count2-count1)%count3==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count2);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\ti=0;\n\t\n\t\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong m,h1,h2,x1,x2,y1,y2,a1,a2,p,i;\n\t\n\tscanf(\"%ld\",&m);\n\t\n\tscanf(\"%ld%ld\",&h1,&a1);\n\t\n\tscanf(\"%ld%ld\",&x1,&y1);\n\t\n\tscanf(\"%ld%ld\",&h2,&a2);\n\t\n\tscanf(\"%ld%ld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+1;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tif(h1==a1 && h2==a2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\t\n\tif(h1==a1)\n\t{\n\t\tp=0;\n\t\th1=(h1*x1+y1)%m;\n\t\tcount1++;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tif(h2==a2)\n\t{\n\t\tp=0;\n\t\th2=(h2*x2+y2)%m;\n\t\tcount2++;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tlc=lcm(count1,count2);\n\t\n\tans=(count1*count2)/lc;\n\t\n\tprintf(\"%lld\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong m,h1,h2,x1,x2,y1,y2,a1,a2,p,i;\n\t\n\tscanf(\"%ld\",&m);\n\t\n\tscanf(\"%ld%ld\",&h1,&a1);\n\t\n\tscanf(\"%ld%ld\",&x1,&y1);\n\t\n\tscanf(\"%ld%ld\",&h2,&a2);\n\t\n\tscanf(\"%ld%ld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+1;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tif(h1==a1 && h2==a2)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\t\n\tif(h1==a1)\n\t{\n\t\th1=(h1*x1+y1)%m;\n\t\tcount1++;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tif(h2==a2)\n\t{\n\t\th2=(h2*x2+y2)%m;\n\t\tcount2++;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tlc=lcm(count1,count2);\n\t\n\tans=(count1*count2)/lc;\n\t\n\tprintf(\"%lld\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tcount3=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tcount4=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\t\n\t//printf(\"%lld %lld \",count3,count4);\n\t//printf(\"%lld %lld \",count1,count2);\n\t\n\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t{\n\t\tprintf(\"%lld\",count);\n\t\treturn 0;\n\t}\n\t\n\tif(count3==-1 || count4==-1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\ti=0;\n\t\n\t\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong m,h1,h2,x1,x2,y1,y2,a1,a2,p,i;\n\t\n\tscanf(\"%ld\",&m);\n\t\n\tscanf(\"%ld%ld\",&h1,&a1);\n\t\n\tscanf(\"%ld%ld\",&x1,&y1);\n\t\n\tscanf(\"%ld%ld\",&h2,&a2);\n\t\n\tscanf(\"%ld%ld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+1;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tlc=lcm(count1,count2);\n\t\n\tans=(count1*count2)/lc;\n\t\n\tprintf(\"%lld\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\tcount3=count4=1;\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tif(count3==count4)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\ti=0;\n\t\n\t//printf(\"%lld %lld \",count1,count2);\n\t//printf(\"%lld %lld \",count3,count4);\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\ti=0;\n\t\n\t//printf(\"%lld %lld \",count1,count2);\n\t//printf(\"%lld %lld \",count3,count4);\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tif(count1>count2)\n\t{\n\t\tcount1=count1-count2;\n\t\tlc=lcm(count1,count4);\n\t\tans=(count1*count4)/lc;\n\t}\n\telse\n\t{\n\t\tcount2=count2-count1;\n\t\tlc=lcm(count3,count2);\n\t\tans=(count3*count2)/lc;\n\t}\n\t\n\tprintf(\"%lld\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\ti=0;\n\t\n\tprintf(\"%lld %lld \",count1,count2);\n\tprintf(\"%lld %lld \",count3,count4);\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tn=(count1-count2)/(count4-count3)+1;\n\t\n\tans=count1+(n-1)*count3;\n\t\n\tprintf(\"%lld\",ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\ti=0;\n\t\n\t//printf(\"%lld %lld \",count1,count2);\n\t//printf(\"%lld %lld \",count3,count4);\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\t//printf(\"a\");\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tcount3=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tcount4=-1;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tcount=(count1>count2)?count1:count2;\n\t\n\t//printf(\"%lld %lld \",count3,count4);\n\t//printf(\"%lld %lld \",count1,count2);\n\t\n\tif(count3==-1 && count4==-1)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\telse if(count3==-1)\n\t{\n\t\tif(count1<count2)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tif((count1-count2)%count4==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse if(count4==-1)\n\t{\n\t\tif(count2<count1)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\t\n\t\tif((count2-count1)%count3==0)\n\t\t{\n\t\t\tprintf(\"%lld\",count2);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\ti=0;\n\t\n\t\n\t\n\twhile(1)\n\t{\n\t\tif(i>10000000)\n\t\t{\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount=count3*i+count1;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long a[1000006],b[1000006],ans,count1,count2,lc,count3,count4,count;\n\nlong long lcm(long long a,long long b)\n{\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\t\t\n\t\treturn lcm(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\t\t\n\t\treturn lcm(a,b%a);\n\t}\n}\n\nint main()\n{\n\tlong long m,h1,h2,x1,x2,y1,y2,a1,a2,p,i,n;\n\t\n\tscanf(\"%lld\",&m);\n\t\n\tscanf(\"%lld%lld\",&h1,&a1);\n\t\n\tscanf(\"%lld%lld\",&x1,&y1);\n\t\n\tscanf(\"%lld%lld\",&h2,&a2);\n\t\n\tscanf(\"%lld%lld\",&x2,&y2);\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\n\tcount1=count2=0;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount1++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tp=1;\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount2++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(p)\n\t{\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t\ta[i]=b[i]=0;\n\t\t\n\th2=(h2*x2+y2)%m;\n\th1=(h1*x1+y1)%m;\n\t\n\tcount3=count4=1;\n\t\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h1==a1)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!a[h1])\n\t\t\ta[h1]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount3++;\n\t\th1=(h1*x1+y1)%m;\n\t}\n\t\n\tfor(i=0;i<m+2;i++)\n\t{\n\t\tif(h2==a2)\n\t\t{\n\t\t\tp=0;\n\t\t\tbreak;\n\t\t}\n\t\t\t\n\t\tif(!b[h2])\n\t\t\tb[h2]=1;\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\t\n\t\tcount4++;\n\t\th2=(h2*x2+y2)%m;\n\t}\n\t\n\tif(count1==count2)\n\t{\n\t\tprintf(\"%lld\",count1);\n\t\treturn 0;\n\t}\n\t\n\tcount=0;\n\t\n\twhile(1)\n\t{\n\t\tif(((count-count1)%count3==0) && ((count-count2)%count4==0))\n\t\t\tbreak;\n\t\tcount++;\n\t}\n\t\n\tprintf(\"%lld\",count);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= 2 * m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (t[i][0] > 0 && pre == a[i]) {\n t[i][1] = j;\n break;\n }\n if (t[i][0] == -1 && pre == a[i]) {\n t[i][0] = j;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n if (t[i][1] == -1) {\n t[i][1] = 0;\n }\n else {\n t[i][1] -= t[i][0];\n }\n if (t[i][0] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if (((long long)k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", (long long)k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= 2 * m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (t[i][0] > 0 && pre == a[i]) {\n t[i][1] = j;\n break;\n }\n if (t[i][0] == -1 && pre == a[i]) {\n t[i][0] = j;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n if (t[i][1] == -1) {\n t[i][1] = 0;\n }\n else {\n t[i][1] -= t[i][0];\n }\n if (t[i][0] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if (((long long)k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (t[0][1] == 0) {\n if (t[1][1] == 0) {\n if (t[0][0] == t[1][0]) {\n k1 = 0;\n }\n }\n else if ((t[0][0] - t[1][0]) % t[1][1] == 0) {\n k1 = (t[0][0] - t[1][0]) / t[1][1];\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", (long long)k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], k1, k, t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= m; j++) {\n pre = (x[i] * pre + y[i]) % m;\n if (pre == a[i]) {\n t[i][0] = j;\n }\n if (pre == h[i]) {\n t[i][1] = j;\n break;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 2; j++) {\n if (t[i][j] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n }\n k1 = -1;\n for (k = 0; k < t[0][1]; k++) {\n if ((k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%d\\n\", k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= 2 * m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (t[i][0] > 0 && pre == a[i]) {\n t[i][1] = j;\n break;\n }\n if (t[i][0] == -1 && pre == a[i]) {\n t[i][0] = j;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n if (t[i][1] == -1) {\n t[i][1] = 0;\n }\n if (t[i][0] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if (((long long)k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", (long long)k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= m; j++) {\n pre = (x[i] * pre + y[i]) % m;\n if (pre == a[i]) {\n t[i][0] = j;\n }\n if (pre == h[i]) {\n t[i][1] = j;\n break;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 2; j++) {\n if (t[i][j] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if ((k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (pre == a[i]) {\n t[i][0] = j;\n }\n if (pre == h[i]) {\n t[i][1] = j;\n break;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 2; j++) {\n if (t[i][j] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if ((k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m, h[2], a[2], x[2], y[2], t[2][2] = {{-1, -1}, {-1, -1}}, pre, i, j;\n long long k, k1;\n scanf(\"%d %d%d %d%d %d%d %d%d\", &m, &h[0], &a[0], &x[0], &y[0], &h[1], &a[1], &x[1], &y[1]);\n for (i = 0; i < 2; i++) {\n pre = h[i];\n for (j = 1; j <= m; j++) {\n pre = ((long long)x[i] * pre + y[i]) % m;\n if (pre == a[i]) {\n t[i][0] = j;\n }\n if (pre == h[i]) {\n t[i][1] = j;\n break;\n }\n }\n }\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 2; j++) {\n if (t[i][j] == -1) {\n printf(\"-1\\n\");\n return 0;\n }\n }\n }\n k1 = -1ll;\n for (k = 0ll; k < t[0][1]; k++) {\n if (((long long)k * t[1][1] + t[1][0] - t[0][0]) % t[0][1] == 0) {\n k1 = k;\n break;\n }\n }\n if (k1 == -1ll) {\n printf(\"-1\\n\");\n }\n else {\n printf(\"%I64d\\n\", (long long)k1 * t[1][1] + t[1][0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\ntypedef long long LONG;\n\nint main(){\n LONG m = 1;\n LONG h1 = 0; LONG a1 = 0;\n LONG x1 = 0; LONG y1 = 0;\n LONG h2 = 0; LONG a2 = 0;\n LONG x2 = 0; LONG y2 = 0;\n scanf(\"%d\", &m);\n scanf(\"%d %d\", &h1, &a1);\n scanf(\"%d %d\", &x1, &y1);\n scanf(\"%d %d\", &h2, &a2);\n scanf(\"%d %d\", &x2, &y2);\n /*\n int s = 0;\n int m2 = m * m\n while (s < m2) {\n if (h1 == a1 && h2 == a2) {\n printf(\"%d\", s);\n return 0;\n }\n h1 = (x1 * h1 + y1) % m;\n h2 = (x2 * h2 + y2) % m;\n s++;\n }\n */\n\n int s1 = 0;\n while (s1 < m && h1 != a1) {\n h1 = (x1 * h1 + y1) % m;\n s1++;\n }\n if (s1 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c1 = 0;\n while (c1 == 0 || (c1 < m && h1 != a1)) {\n h1 = (x1 * h1 + y1) % m;\n c1++;\n }\n\n int s2 = 0;\n while (s2 < m && h2 != a2) {\n h2 = (x2 * h2 + y2) % m;\n s2++;\n }\n if (s2 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c2 = 0;\n while (c2 == 0 || (c2 < m && h1 != a1)) {\n h2 = (x2 * h2 + y2) % m;\n c2++;\n }\n\n printf(\"%d\",c1);\n printf(\"%d\",c2);\n if (c1 != m && c2 != m) {\n LONG limit = c1 * c2 + s1 + s2;\n while (s1 < limit && s2 < limit) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else if (s1 < s2) {\n s1 += ((s2-s1) / c1 + 1) * c1;\n }\n else {\n s2 += ((s1-s2) / c2 + 1) * c2;\n }\n }\n }\n else if (c1 != m && c2 == m) {\n while (s1 < s2)\n s1 += c1;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m && c2 != m) {\n while (s2 < s1)\n s2 += c2;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m && c2 == m) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\ntypedef long long LONG;\n\nint main(){\n LONG m = 1;\n LONG h1 = 0; LONG a1 = 0;\n LONG x1 = 0; LONG y1 = 0;\n LONG h2 = 0; LONG a2 = 0;\n LONG x2 = 0; LONG y2 = 0;\n scanf(\"%d\", &m);\n scanf(\"%d %d\", &h1, &a1);\n scanf(\"%d %d\", &x1, &y1);\n scanf(\"%d %d\", &h2, &a2);\n scanf(\"%d %d\", &x2, &y2);\n /*\n int s = 0;\n int m2 = m * m\n while (s < m2) {\n if (h1 == a1 && h2 == a2) {\n printf(\"%d\", s);\n return 0;\n }\n h1 = (x1 * h1 + y1) % m;\n h2 = (x2 * h2 + y2) % m;\n s++;\n }\n */\n\n int s1 = 0;\n while (s1 < m && h1 != a1) {\n h1 = (x1 * h1 + y1) % m;\n s1++;\n }\n if (s1 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c1 = 0;\n while (c1 == 0 || (c1 < m && h1 != a1)) {\n h1 = (x1 * h1 + y1) % m;\n c1++;\n }\n\n int s2 = 0;\n while (s2 < m && h2 != a2) {\n h2 = (x2 * h2 + y2) % m;\n s2++;\n }\n if (s2 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c2 = 0;\n while (c2 == 0 || (c2 < m && h1 != a1)) {\n h2 = (x2 * h2 + y2) % m;\n c2++;\n }\n\n if (c1 != m && c2 != m) {\n LONG limit = c1 * c2 + s1 + s2;\n while (s1 < limit && s2 < limit) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else if (s1 < s2) {\n s1 += ((s2-s1) / c1 + 1) * c1;\n }\n else {\n s2 += ((s1-s2) / c2 + 1) * c2;\n }\n }\n }\n else if (c1 != m && c2 == m) {\n while (s1 < s2)\n s1 += c1;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m && c2 != m) {\n while (s2 < s1)\n s2 += c2;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m && c2 == m) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\ntypedef long long LONG;\n\nint main(){\n LONG m = 1;\n LONG h1 = 0; LONG a1 = 0;\n LONG x1 = 0; LONG y1 = 0;\n LONG h2 = 0; LONG a2 = 0;\n LONG x2 = 0; LONG y2 = 0;\n scanf(\"%d\", &m);\n scanf(\"%d %d\", &h1, &a1);\n scanf(\"%d %d\", &x1, &y1);\n scanf(\"%d %d\", &h2, &a2);\n scanf(\"%d %d\", &x2, &y2);\n /*\n int s = 0;\n int m2 = m * m\n while (s < m2) {\n if (h1 == a1 && h2 == a2) {\n printf(\"%d\", s);\n return 0;\n }\n h1 = (x1 * h1 + y1) % m;\n h2 = (x2 * h2 + y2) % m;\n s++;\n }\n */\n\n int s1 = 0;\n while (s1 < m && h1 != a1) {\n h1 = (x1 * h1 + y1) % m;\n s1++;\n //printf(\"%d %d\\n\",s1,h1);\n }\n if (s1 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c1 = 0;\n while (c1 == 0 || (c1 <= m && h1 != a1)) {\n h1 = (x1 * h1 + y1) % m;\n c1++;\n //printf(\"%d %d\\n\",c1,h1);\n }\n\n int s2 = 0;\n while (s2 < m && h2 != a2) {\n h2 = (x2 * h2 + y2) % m;\n s2++;\n //printf(\"%d %d\\n\",s2,h2);\n }\n if (s2 == m) {\n printf(\"-1\");\n return 0;\n }\n\n int c2 = 0;\n while (c2 == 0 || (c2 <= m && h2 != a2)) {\n h2 = (x2 * h2 + y2) % m;\n c2++;\n //printf(\"%d %d\\n\",c2,h2);\n }\n\n /*\n printf(\"%d\\n\",s1);\n printf(\"%d\\n\",c1);\n printf(\"%d\\n\",s2);\n printf(\"%d\\n\",c2);\n */\n if (c1 != m+1 && c2 != m+1) {\n LONG limit = c1 * c2 + s1 + s2;\n while (s1 < limit && s2 < limit) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else if (s1 < s2) {\n s1 += c1;\n }\n else {\n s2 += c2;\n }\n }\n }\n else if (c1 != m+1 && c2 == m+1) {\n while (s1 < s2)\n s1 += c1;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m+1 && c2 != m+1) {\n while (s2 < s1)\n s2 += c2;\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n else if (c1 == m+1 && c2 == m+1) {\n if (s1 == s2) {\n printf(\"%d\", s1);\n return 0;\n }\n else {\n printf(\"-1\");\n return 0;\n }\n }\n\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\tprint(u,m);\n//\tprint(v,m);\nt1=-1;t2=-1;\n\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\telse if(u[a1]>=u[st] && v[a2]>=v[st])\n\t{\n\t\t for(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt1=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t for(i=0;i<u[l];i++)\n\t\t\t{\n\t\t\t\tk=(v[l]*i)+v[a2]-u[a1];\n\t\t\t\tif(k>0 && k%u[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt2=(v[l]*i)+v[a2]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t}\n\t\t\tif((t1!=-1) && (t2!=-1))\n\t\t\t{\n\t\t\t\tif(t1<t2)\n\t\t\t\tprintf(\"%lld\\n\",t1);\n\t\t\telse \n\t\t\t\tprintf(\"%lld\\n\",t2);\n\t\t\t}\t\t\t\t\n\t\t\telse if((t1==-1) && (t2!=-1))\n\t\t\t\tprintf(\"%lld\\n\",t2);\n\t\t\telse if((t2==-1) && (t1!=-1))\n\t\t\t\tprintf(\"%lld\\n\",t1);\n\t\t\telse\n\t\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n\t//\tprint(u,m);\n\t//\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]==v[a2])\n\t{\n\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\treturn 0;\n\t}\n\tif(u[a1]>0 && u[a2]>0)\n\t{\n\t\tif(u[a1]>=u[st] || v[a2]>=v[st])\n\t\t{\n\t\t\tfor(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>=0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt1=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(i=0;i<u[l];i++)\n\t\t\t{\n\t\t\t\tk=(v[l]*i)+v[a2]-u[a1];\n\t\t\t\t//\t\t\tprintf(\"%d %d %d\\n\",v[l],u[l],v[a2]-u[a1]);\n\t\t\t\tif(k>=0 && k%u[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt2=(v[l]*i)+v[a2]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//\tprintf(\"%lld %lld\\n\",t1,t2);\n\tif((t1!=-1) && (t2!=-1))\n\t{\n\t\tif(t1<t2)\n\t\t\tprintf(\"%lld\\n\",t1);\n\t\telse \n\t\t\tprintf(\"%lld\\n\",t2);\n\t}\t\t\t\t\n\telse if((t1==-1) && (t2!=-1))\n\t\tprintf(\"%lld\\n\",t2);\n\telse if((t2==-1) && (t1!=-1))\n\t\tprintf(\"%lld\\n\",t1);\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,int x,int y,int h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tint t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\tprint(u,m);\n//\tprint(v,m);\n\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\telse if(u[a1]>=u[st] && v[a2]>=v[st])\n\t{\n\t\t if(u[l]>=v[l])\n\t\t\t{\n\t\t\t\tt1=v[l];\n\t\t\t\tv[l]=u[l];\n\t\t\t\tu[l]=t1;\n\t\t\t\tt2=v[a2];\n\t\t\t\tv[a2]=u[a1];\n\t\t\t\tu[a1]=t2;\n\n\t\t\t}\n\t\t for(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tprintf(\"%lld\\n\",t);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n\t//\tprint(u,m);\n\t//\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]==v[a2])\n\t{\n\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\treturn 0;\n\t}\n\tif(u[a1]>0 && v[a2]>0)\n\t{\n\t\tif(u[a1]>=u[st] || v[a2]>=v[st])\n\t\t{\n\t\t\tfor(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>=0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt1=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(i=0;i<u[l];i++)\n\t\t\t{\n\t\t\t\tk=(v[l]*i)+v[a2]-u[a1];\n\t\t\t\t//\t\t\tprintf(\"%d %d %d\\n\",v[l],u[l],v[a2]-u[a1]);\n\t\t\t\tif(k>=0 && k%u[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt2=(v[l]*i)+v[a2]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//\tprintf(\"%lld %lld\\n\",t1,t2);\n\tif((t1!=-1) && (t2!=-1))\n\t{\n\t\tif(t1<t2)\n\t\t\tprintf(\"%lld\\n\",t1);\n\t\telse \n\t\t\tprintf(\"%lld\\n\",t2);\n\t}\t\t\t\t\n\telse if((t1==-1) && (t2!=-1))\n\t\tprintf(\"%lld\\n\",t2);\n\telse if((t2==-1) && (t1!=-1))\n\t\tprintf(\"%lld\\n\",t1);\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint gcd(int a,int b)\n{\n\tint r;\n\twhile(b!=0)\n\t{\n\t\tr=a%b;\n\t\ta=b;\n\t\tb=r;\n\t}\n\t\treturn a;\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t,a,b;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\t\tprint(u,m);\n//\t\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]>0 && v[a2]>0)\n\t{\n\t\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\tif((u[a1]>=u[st] && v[a2]>=v[st])||(u[a1]>=u[st] && v[a2]>=u[st])||v[a2]>=v[st] && u[a1]>=v[st])\n\t\t{\n\t\t\t\tt1=gcd(u[l],v[l]);\n\t\t\t\tt2=u[a1]-v[a2];\n\t\t\t\tif(t2<0)\n\t\t\t\t\tt2=-t2;\n\t\t\t\tif(t2%t1!=0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\ta=u[a1]-1;\n\t\t\t\tb=v[a2]-1;\n\t\t\t\twhile(a!=b)\n\t\t\t\t{\n\t\t\t\t\t\tif(a<b)\n\t\t\t\t\t\t\ta+=u[l];\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tb+=v[l];\t\n\n\t\t\t\t}\n\t\t\tprintf(\"%lld\\n\",a);\t\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,int x,int y,int h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\tprint(u,m);\n//\tprint(v,m);\n\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\telse if(u[a1]>=u[st] && v[a2]>=v[st])\n\t{\n\t\t for(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tprintf(\"%lld\\n\",t);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint gcd(int a,int b)\n{\n\tint r;\n\twhile(b!=0)\n\t{\n\t\tr=a%b;\n\t\ta=b;\n\t\tb=r;\n\t}\n\t\treturn a;\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t,a,b;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n//\t\tprint(u,m);\n//\t\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]>0 && v[a2]>0)\n\t{\n\t\tif(u[a1]==v[a2])\n\t\t{\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\t\treturn 0;\n\t\t}\n\t\tif((u[a1]>=u[st]) && (v[a2]>=u[a1] && v[a2]-u[a1]%u[l]==0))\n\t\t\tprintf(\"%d\\n\",v[a2]-1);\t\n\t\telse if(v[a2]>=v[st] && (u[a1]>=v[a2] && u[a1]-v[a2]%v[l]==0))\n\t\t\tprintf(\"%d\\n\",u[a1]-1);\t\n\t\telse if((u[a1]>=u[st] && v[a2]>=v[st]))\n\t\t{\n\t\t\t\tt1=gcd(u[l],v[l]);\n\t\t\t\tt2=u[a1]-v[a2];\n\t\t\t\tif(t2<0)\n\t\t\t\t\tt2=-t2;\n\t\t\t\tif(t2%t1!=0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\ta=u[a1]-1;\n\t\t\t\tb=v[a2]-1;\n\t\t\t\twhile(a!=b)\n\t\t\t\t{\n\t\t\t\t\t\tif(a<b)\n\t\t\t\t\t\t\ta+=u[l];\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tb+=v[l];\t\n\n\t\t\t\t}\n\t\t\tprintf(\"%lld\\n\",a);\t\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nvoid print(int *a,int n)\n{\n\tint i;\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d \",a[i]);\n\tprintf(\"\\n\");\n}\nint u[1000005]={0},v[1000005]={0};\nint st,l,m;\nvoid mark(int *a,ll x,ll y,ll h)\n{\n\tint t=2;\n\ta[h]=1;\n\twhile(1)\n\t{\n\t\th=((x*h)+y)%m;\n\t\tif(a[h]!=0)\n\t\t{\n\t\t\ta[st]=a[h];\n\t\t\ta[l]=t-a[h];\n\t\t\tbreak;\n\t\t}\n\t\ta[h]=t;\n\t\tt++;\n\t}\n}\nint main()\n{\n\tst=1000003;\n\tl=1000004;\n\tll x1,y1,h1,x2,y2,h2,a1,a2,k,r,d,i,t;\n\tll t1,t2;\n\tscanf(\"%d\",&m);\n\tscanf(\"%lld %lld\",&h1,&a1);\n\tscanf(\"%lld %lld\",&x1,&y1);\n\tscanf(\"%lld %lld\",&h2,&a2);\n\tscanf(\"%lld %lld\",&x2,&y2);\n\tmark(u,x1,y1,h1);\n\tmark(v,x2,y2,h2);\n\t//\tprint(u,m);\n\t//\tprint(v,m);\n\tt1=-1;t2=-1;\n\tif(u[a1]==v[a2])\n\t{\n\t\tprintf(\"%d\\n\",u[a1]-1);\n\t\treturn 0;\n\t}\n\tif(u[a1]>0 && v[a2]>0)\n\t{\n\t\tif((u[a1]>=u[st] && u[st]<=v[a2])|| (v[a2]>=v[st] && v[st]<=u[a1]))\n\t\t{\n//\t\t\t\tprintf(\"%d %d %d\\n\",v[l],u[l],v[a2]-u[a1]);\n\t\t\tfor(i=0;i<v[l];i++)\n\t\t\t{\n\t\t\t\tk=(u[l]*i)+u[a1]-v[a2];\n\t\t\t\tif(k>=0 && k%v[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt1=(u[l]*i)+u[a1]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(i=0;i<u[l];i++)\n\t\t\t{\n\t\t\t\tk=(v[l]*i)+v[a2]-u[a1];\n\t\t\t\tif(k>=0 && k%u[l]==0)\n\t\t\t\t{\n\t\t\t\t\tt2=(v[l]*i)+v[a2]-1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t//\tprintf(\"%lld %lld\\n\",t1,t2);\n\tif((t1!=-1) && (t2!=-1))\n\t{\n\t\tif(t1<t2)\n\t\t\tprintf(\"%lld\\n\",t1);\n\t\telse \n\t\t\tprintf(\"%lld\\n\",t2);\n\t}\t\t\t\t\n\telse if((t1==-1) && (t2!=-1))\n\t\tprintf(\"%lld\\n\",t2);\n\telse if((t2==-1) && (t1!=-1))\n\t\tprintf(\"%lld\\n\",t1);\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long m,i;\n \n scanf(\"%ld\",&m);\n \n long h1,a1;\n scanf(\"%ld %ld\",&h1,&a1);\n \n long x1,y1;\n scanf(\"%ld %ld\",&x1,&y1);\n \n long h2,a2;\n scanf(\"%ld %ld\",&h2,&a2);\n \n long x2,y2;\n scanf(\"%ld %ld\",&x2,&y2);\n \n long count=0;\n \n long initial1 = h1;\n long initial2 = h2;\n \n \n long flag=0;\n long temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n //printf(\"h1 is %ld\\n\",h1);\n //printf(\"h2 is %ld\\n\",h2);\n count = count+1;\n temp = temp+1;\n if (temp> (m+10))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n //printf(\"count is %ld\\n\",count);\n \n if (flag==0)\n {\n long temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%ld\\n\",count);\n flag=1;\n \n }\n else\n {\n long z1=1, z2=0;\n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n z1 = ((z1%m) * (x2%m))%m;\n z2 = (((z2%m)*(x2%m))%m + y2%m)%m;\n temp1++;\n //count++;\n if (temp1>(m+10))\n {\n flag=1;\n //prlongf(\"here\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n long temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((z1%m)*(h2%m))%m + z2%m)%m;\n temp2++;\n if (temp2 > (m+10))\n {\n flag=1;\n //prlongf(\"second\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%ld\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long m,i;\n \n scanf(\"%ld\",&m);\n \n long h1,a1;\n scanf(\"%ld %ld\",&h1,&a1);\n \n long x1,y1;\n scanf(\"%ld %ld\",&x1,&y1);\n \n long h2,a2;\n scanf(\"%ld %ld\",&h2,&a2);\n \n long x2,y2;\n scanf(\"%ld %ld\",&x2,&y2);\n \n long count=0;\n \n long initial1 = h1;\n long initial2 = h2;\n \n \n long flag=0;\n long temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n //printf(\"h1 is %ld\\n\",h1);\n //printf(\"h2 is %ld\\n\",h2);\n count = count+1;\n temp = temp+1;\n if (temp> (m+1))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n //printf(\"count is %ld\\n\",count);\n \n if (flag==0)\n {\n long temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%ld\\n\",count);\n flag=1;\n \n }\n else\n {\n long z1=1, z2=0;\n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n z1 = ((z1%m) * (x2%m))%m;\n z2 = (((z2%m)*(x2%m))%m + y2%m)%m;\n temp1++;\n //count++;\n if (temp1>(m+1))\n {\n flag=1;\n //prlongf(\"here\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n long temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((z1%m)*(h2%m))%m + z2%m)%m;\n temp2++;\n if (temp2 > (m+1))\n {\n flag=1;\n //prlongf(\"second\\n\");\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%ld\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,i;\n \n scanf(\"%d\",&m);\n \n int h1,a1;\n scanf(\"%d %d\",&h1,&a1);\n \n int x1,y1;\n scanf(\"%d %d\",&x1,&y1);\n \n int h2,a2;\n scanf(\"%d %d\",&h2,&a2);\n \n int x2,y2;\n scanf(\"%d %d\",&x2,&y2);\n \n int count=0;\n \n int initial1 = h1;\n int initial2 = h2;\n int flag=0;\n while (h1!=a1 || h2!=a2)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n count = count+1;\n \n if (h1==initial1 && h2==initial2 || count > m)\n {\n flag=1;\n break;\n }\n }\n if (flag==1)\n printf(\"-1\\n\");\n else\n printf(\"%d\\n\",count);\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,i;\n \n scanf(\"%d\",&m);\n \n int h1,a1;\n scanf(\"%d %d\",&h1,&a1);\n \n int x1,y1;\n scanf(\"%d %d\",&x1,&y1);\n \n int h2,a2;\n scanf(\"%d %d\",&h2,&a2);\n \n int x2,y2;\n scanf(\"%d %d\",&x2,&y2);\n \n int count=0;\n \n int initial1 = h1;\n int initial2 = h2;\n \n \n int flag=0;\n int temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n \n count = count+1;\n temp = temp+1;\n if (temp>m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n \n if (flag==0)\n {\n int temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%d\\n\",count);\n flag=1;\n \n }\n else\n {\n \n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n temp1++;\n //count++;\n if (temp1>m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n int temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n temp2++;\n if (temp2 > m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%d\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,i;\n \n scanf(\"%d\",&m);\n \n int h1,a1;\n scanf(\"%d %d\",&h1,&a1);\n \n int x1,y1;\n scanf(\"%d %d\",&x1,&y1);\n \n int h2,a2;\n scanf(\"%d %d\",&h2,&a2);\n \n int x2,y2;\n scanf(\"%d %d\",&x2,&y2);\n \n int count=0;\n \n int initial1 = h1;\n int initial2 = h2;\n \n \n int flag=0;\n int temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n \n count = count+1;\n temp = temp+1;\n if (temp> (m+1))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n \n if (flag==0)\n {\n int temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%d\\n\",count);\n flag=1;\n \n }\n else\n {\n long z1=1, z2=0;\n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n z1 = ((z1%m) * (x2%m))%m;\n z2 = (((z2%m)*(x2%m))%m + y2%m)%m;\n temp1++;\n //count++;\n if (temp1>(m+1))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n int temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((z1%m)*(h2%m))%m + z2%m)%m;\n temp2++;\n if (temp2 > (m+1))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%d\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,i;\n \n scanf(\"%d\",&m);\n \n int h1,a1;\n scanf(\"%d %d\",&h1,&a1);\n \n int x1,y1;\n scanf(\"%d %d\",&x1,&y1);\n \n int h2,a2;\n scanf(\"%d %d\",&h2,&a2);\n \n int x2,y2;\n scanf(\"%d %d\",&x2,&y2);\n \n int count=0;\n \n int initial1 = h1;\n int initial2 = h2;\n \n \n \n \n while (1)\n {\n \n int flag=0;\n int temp=0;\n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n \n count = count+1;\n temp = temp+1;\n if (temp>m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n \n if (flag==0)\n {\n int temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%d\\n\",count);\n flag=1;\n break;\n }\n else\n {\n while (h2!=a2)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n temp1++;\n count++;\n if (temp1>m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n \n \n }\n \n \n\n }\n if (flag==1)\n break;\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,i;\n \n scanf(\"%d\",&m);\n \n int h1,a1;\n scanf(\"%d %d\",&h1,&a1);\n \n int x1,y1;\n scanf(\"%d %d\",&x1,&y1);\n \n int h2,a2;\n scanf(\"%d %d\",&h2,&a2);\n \n int x2,y2;\n scanf(\"%d %d\",&x2,&y2);\n \n int count=0;\n \n int initial1 = h1;\n int initial2 = h2;\n \n \n int flag=0;\n int temp=0;\n \n while (h1!=a1)\n {\n \n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n \n count = count+1;\n temp = temp+1;\n if (temp> (m+1))\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n \n }\n \n if (flag==0)\n {\n int temp1=0;\n \n \n if (h2==a2)\n {\n printf(\"%d\\n\",count);\n flag=1;\n \n }\n else\n {\n int z1=1, z2=0;\n while (h1!=a1 || temp1==0)\n {\n h1 = (((x1%m)*(h1%m))%m + y1%m)%m;\n //h2 = (((x2%m)*(h2%m))%m + y2%m)%m;\n z1 = ((z1%m) * (x2%m))%m;\n z2 = ((z2*x2 + y2)%m);\n temp1++;\n //count++;\n if (temp1>m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n \n int temp2=0;\n \n while (h2!=a2)\n {\n h2 = (((z1%m)*(h2%m))%m + z2%m)%m;\n temp2++;\n if (temp2 > m+1)\n {\n flag=1;\n printf(\"-1\\n\");\n break;\n }\n }\n \n if (flag==0)\n {\n printf(\"%d\\n\",count+temp1*temp2);\n }\n \n }\n \n \n }\n \n \n\n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint p,h1,a1,x1,y,h2,a2,x2,y2;\nint hone(int h)\n{\n\treturn (x1*h+y)%p;\n}\nint htwo(int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%d %d %d %d %d %d %d %d %d\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tint i,hi=a1,c=0,d=1,x=0,h=hone(h1);\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%d\\n\",c);\n\t\telse\n\t\t{\n\t\t\twhile(h!=h1 && d<=p)\n\t\t\t{\n\t\t\t\th=hone(h);\n\t\t\t\td++;\n\t\t\t}\n\t\t\tif(d>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(x<=p && hi!=h2)\n\t\t\t\t{\n\t\t\t\t\tfor(i=0;i<d;i++)\n\t\t\t\t\t\thi=htwo(hi);\n\t\t\t\t\tx++;\n\t\t\t\t}\n\t\t\t\tif(x>p)\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%d\\n\",c+x*d);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct Node {\n unsigned long value;\n struct Node *left;\n struct Node *right;\n} Node;\n\nNode *create_node(unsigned long value) {\n Node *node = malloc(sizeof(Node));\n node->value = value;\n node->left = node->right = NULL;\n return node;\n}\n\n/**\n * @return 1 if insert successfully, 0 other wise\n */\nint add_to_tree(Node *root, Node *new_node) {\n if (root->value == new_node->value)\n return 0;\n if (root->value > new_node->value) {\n if (root->left == NULL)\n root->left = new_node;\n else\n return add_to_tree(root->left, new_node);\n } else {\n if (root->right == NULL)\n root->right = new_node;\n else\n return add_to_tree(root->right, new_node);\n }\n return 1;\n}\n\nlong count_step(unsigned long h, unsigned long a, unsigned long x, unsigned long y, unsigned int m) {\n Node *root = create_node(h);\n unsigned long c = 0;\n while (h != a) {\n h = (x * h + y) % m;\n Node *new_node = create_node(h);\n if (!add_to_tree(root, new_node)) {\n return -1;\n }\n c++;\n }\n return c;\n}\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong gcd(long a, long b) {\n long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long u1, long u2, long v2) {\n if (v2 == 0) {\n if (u1 != u2)\n no_solution();\n else\n printf(\"%lu\", u1);\n } else {\n if (u1 < u2 || (u1 - u2) % v2 != 0)\n no_solution();\n else {\n printf(\"%lu\", u1);\n }\n }\n}\n\nint main() {\n unsigned int m;\n unsigned long h1, a1, x1, y1;\n unsigned long h2, a2, x2, y2;\n\n scanf(\"%d %lu %lu %lu %lu %lu %lu %lu %lu\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -2)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n else if (v2 == 0)\n zero(u2, u1, v1);\n else {\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long t2 = 0;\n long s = (u2 - u1 + v2 * t2);\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = (u2 - u1 + v2 * t2);\n }\n printf(\"%ld\", u2 + v2 * t2);\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct Node {\n unsigned long value;\n struct Node *left;\n struct Node *right;\n} Node;\n\nNode *create_node(unsigned long value) {\n Node *node = malloc(sizeof(Node));\n node->value = value;\n node->left = node->right = NULL;\n return node;\n}\n\n/**\n * @return 1 if insert successfully, 0 other wise\n */\nint add_to_tree(Node *root, Node *new_node) {\n if (root->value == new_node->value)\n return 0;\n if (root->value > new_node->value) {\n if (root->left == NULL)\n root->left = new_node;\n else\n return add_to_tree(root->left, new_node);\n } else {\n if (root->right == NULL)\n root->right = new_node;\n else\n return add_to_tree(root->right, new_node);\n }\n return 1;\n}\n\nlong count_step(unsigned long h, unsigned long a, unsigned long x, unsigned long y, unsigned int m) {\n Node *root = create_node(h);\n unsigned long c = 0;\n while (h != a) {\n h = (x * h + y) % m;\n Node *new_node = create_node(h);\n if (!add_to_tree(root, new_node)) {\n return -1;\n }\n c++;\n }\n return c;\n}\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong gcd(long a, long b) {\n long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long u1, long u2, long v2) {\n if (v2 == 0) {\n if (u1 != u2)\n no_solution();\n else\n printf(\"%lu\", u1);\n } else {\n if (u1 < u2 || (u1 - u2) % v2 != 0)\n no_solution();\n else {\n printf(\"%lu\", u1);\n }\n }\n}\n\nint main() {\n unsigned int m;\n unsigned long h1, a1, x1, y1;\n unsigned long h2, a2, x2, y2;\n\n scanf(\"%d %lu %lu %lu %lu %lu %lu %lu %lu\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -1)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n else if (v2 == 0)\n zero(u2, u1, v1);\n else {\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long t2 = 0;\n long s = (u2 - u1 + v2 * t2);\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = (u2 - u1 + v2 * t2);\n }\n printf(\"%ld\", u2 + v2 * t2);\n }\n }\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct Node {\n unsigned long value;\n struct Node *left;\n struct Node *right;\n} Node;\n\nNode *create_node(unsigned long value) {\n Node *node = malloc(sizeof(Node));\n node->value = value;\n node->left = node->right = NULL;\n return node;\n}\n\n/**\n * @return 1 if insert successfully, 0 other wise\n */\nint add_to_tree(Node *root, Node *new_node) {\n if (root->value == new_node->value)\n return 0;\n if (root->value > new_node->value) {\n if (root->left == NULL)\n root->left = new_node;\n else\n return add_to_tree(root->left, new_node);\n } else {\n if (root->right == NULL)\n root->right = new_node;\n else\n return add_to_tree(root->right, new_node);\n }\n return 1;\n}\n\nlong\ncount_step(unsigned long h, unsigned long a, unsigned long x, unsigned long y, unsigned int m) {\n Node *root = create_node(h);\n unsigned long c = 0;\n while (h != a) {\n h = (x * h + y) % m;\n Node *new_node = create_node(h);\n if (!add_to_tree(root, new_node)) {\n return -1;\n }\n c++;\n }\n return c;\n}\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong gcd(long a, long b) {\n long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long u1, long u2, long v2) {\n if (v2 == 0 && u1 != u2 || (u1 < u2 || (u1 - u2) % v2 != 0))\n no_solution();\n printf(\"%lu\", u1);\n exit(0);\n}\n\nint main() {\n unsigned int m;\n unsigned long h1, a1, x1, y1;\n unsigned long h2, a2, x2, y2;\n\n scanf(\"%d %lu %lu %lu %lu %lu %lu %lu %lu\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -1)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n\n if (v2 == 0)\n zero(u2, u1, v1);\n\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long t2 = 0;\n long s = u2 - u1 + v2 * t2;\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = u2 - u1 + v2 * t2;\n }\n printf(\"%lu\", u2 + v2 * t2);\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct Node {\n int h1;\n int h2;\n struct Node *left;\n struct Node *right;\n} Node;\n\nNode *create_node(int h1, int h2) {\n Node *node = malloc(sizeof(Node));\n node->h1 = h1;\n node->h2 = h2;\n node->left = node->right = NULL;\n return node;\n}\n\nint compare(Node *node1, Node *node2) {\n int result = node1->h1 - node2->h1;\n return (result == 0) ? node1->h2 - node2->h2 : result;\n}\n\n/**\n * @return 1 if insert successfully, 0 other wise\n */\nint add_to_tree(Node *root, Node *new_node) {\n int cmp_result = compare(root, new_node);\n if (cmp_result == 0)\n return 0;\n if (cmp_result > 0) {\n if (root->left == NULL)\n root->left = new_node;\n else\n return add_to_tree(root->left, new_node);\n } else {\n if (root->right == NULL)\n root->right = new_node;\n else\n return add_to_tree(root->right, new_node);\n }\n return 1;\n}\n\nint main() {\n int m;\n int h1, a1, x1, y1;\n int h2, a2, x2, y2;\n\n scanf(\"%d %d %d %d %d %d %d %d %d\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n Node *root = create_node(h1, h2);\n unsigned long count = 0;\n\n while (h1 != a1 || h2 != a2) {\n h1 = (x1 * h1 + y1) % m;\n h2 = (x2 * h2 + y2) % m;\n Node *new_node = create_node(h1, h2);\n if (!add_to_tree(root, new_node)) {\n puts(\"-1\");\n return 0;\n }\n count++;\n }\n\n printf(\"%lu\", count);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct Node {\n unsigned long long value;\n struct Node *left;\n struct Node *right;\n} Node;\n\nNode *create_node(unsigned long long value) {\n Node *node = malloc(sizeof(Node));\n node->value = value;\n node->left = node->right = NULL;\n return node;\n}\n\n/**\n * @return 1 if insert successfully, 0 other wise\n */\nint add_to_tree(Node *root, Node *new_node) {\n if (root->value == new_node->value)\n return 0;\n if (root->value > new_node->value) {\n if (root->left == NULL)\n root->left = new_node;\n else\n return add_to_tree(root->left, new_node);\n } else {\n if (root->right == NULL)\n root->right = new_node;\n else\n return add_to_tree(root->right, new_node);\n }\n return 1;\n}\n\nlong long\ncount_step(unsigned long long h, unsigned long long a, unsigned long long x, unsigned long long y, unsigned int m) {\n Node *root = create_node(h);\n unsigned long long c = 0;\n while (h != a) {\n h = (x * h + y) % m;\n Node *new_node = create_node(h);\n if (!add_to_tree(root, new_node)) {\n return -1;\n }\n c++;\n }\n return c;\n}\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong gcd(long long a, long long b) {\n long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long long u1, long long u2, long long v2) {\n if (v2 == 0) {\n if (u1 != u2)\n no_solution();\n else\n printf(\"%I64d\", u1);\n } else {\n if (u1 < u2 || (u1 - u2) % v2 != 0)\n no_solution();\n else {\n printf(\"%I64d\", u1);\n }\n }\n}\n\nint main() {\n unsigned int m;\n unsigned long long h1, a1, x1, y1;\n unsigned long long h2, a2, x2, y2;\n\n scanf(\"%d %I64 %I64 %I64 %I64 %I64 %I64 %I64 %I64\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -2)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n else if (v2 == 0)\n zero(u2, u1, v1);\n else {\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long long t2 = 0;\n long long s = (u2 - u1 + v2 * t2);\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = (u2 - u1 + v2 * t2);\n }\n printf(\"%I64d\", u2 + v2 * t2);\n }\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid no_solution() {\n puts(\"-1\");\n exit(0);\n}\n\nlong long\ncount_step(unsigned long long h, unsigned long long a, unsigned long long x, unsigned long long y, unsigned int m) {\n if (h == a) return 0;\n\n char mark[m];\n memset(mark, 0, m);\n\n unsigned long long c = 0;\n while (h != a) {\n if (mark[h])\n no_solution();\n mark[h] = 1;\n h = (x * h + y) % m;\n c++;\n }\n return c;\n}\n\n\nlong long gcd(long long a, long long b) {\n long long t;\n while (b != 0) {\n t = b;\n b = a % b;\n a = t;\n }\n return a;\n}\n\n\n/**\n * v1 == 0\n */\nvoid zero(long long u1, long long u2, long long v2) {\n if (v2 == 0 && u1 != u2 || (u1 < u2 || (u1 - u2) % v2 != 0))\n no_solution();\n printf(\"%I64d\", u1);\n exit(0);\n}\n\nint main() {\n unsigned int m;\n unsigned long long h1, a1, x1, y1;\n unsigned long long h2, a2, x2, y2;\n\n scanf(\"%d %I64d %I64d %I64d %I64d %I64d %I64d %I64d %I64d\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n long long u1, v1;\n u1 = count_step(h1, a1, x1, y1, m);\n if (u1 == -1)\n no_solution();\n v1 = count_step((a1 * x1 + y1) % m, a1, x1, y1, m) + 1;\n\n long long u2, v2;\n u2 = count_step(h2, a2, x2, y2, m);\n if (u2 == -1)\n no_solution();\n v2 = count_step((a2 * x2 + y2) % m, a2, x2, y2, m) + 1;\n\n // solve u1 + v1 * t1 = u2 + v2 * t2\n if (v1 == 0)\n zero(u1, u2, v2);\n\n if (v2 == 0)\n zero(u2, u1, v1);\n\n // t1 = (u2 - u1 + v2 * t2) / v1\n if (labs(u1 - u2) % gcd(v1, v2) != 0)\n no_solution();\n else {\n long long t2 = 0;\n long long s = u2 - u1 + v2 * t2;\n while (s < 0 || s % v1 != 0) {\n t2++;\n s = u2 - u1 + v2 * t2;\n }\n printf(\"%I64d\", u2 + v2 * t2);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nvoid swap(long long *,long long *);\nint main(){\n\tlong long m,h1,a1,x1,y1,h2,a2,x2,y2,oh,i1,i2,r1,r2,nh,noh,na,t;\n\tscanf(\"%I64d\",&m);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h1,&a1,&x1,&y1);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h2,&a2,&x2,&y2);\n\tfor(i1=0,oh=h1;h1!=a1;i1++){\n\t\th1=(h1*x1+y1)%m;\n\t\tif(h1==oh)\n\t\t\tbreak;\n\t}\n\tif(h1!=a1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tfor(i2=0,oh=h2;h2!=a2;i2++){\n\t\th2=(h2*x2+y2)%m;\n\t\tif(h2==oh)\n\t\t\tbreak;\n\t}\n\tif(h2!=a2){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(i1==i2){\n\t\tprintf(\"%I64d\\n\",i1);\n\t\treturn 0;\n\t}\n\tfor(r1=1,oh=h1;;r1++){\n\t\th1=(h1*x1+y1)%m;\n\t\tif(h1==oh)\n\t\t\tbreak;\n\t}\n\tfor(r2=1,oh=h2;;r2++){\n\t\th2=(h2*x2+y2)%m;\n\t\tif(h2==oh)\n\t\t\tbreak;\n\t}\n\tif(i1>i2){\n\t\tswap(&a1,&a2);\n\t\tswap(&i1,&i2);\n\t\tswap(&r1,&r2);\n\t}\n\tt=i2-i1;\n\tt%=r1;\n\tfor(na=0,noh=t;t!=0;na++){\n\t\tt=(t+r2)%m;\n\t\tif(t==noh)\n\t\t\tbreak;\n\t}\n\tif(t!=0){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"%I64d\\n\",i2+r2*na);\n\treturn 0;\n}\n\nvoid swap(long long *a,long long *b){\n\tlong long t;\n\tt=*a;\n\t*a=*b;\n\t*b=t;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid swap(long long *,long long *);\nint main(){\n\tlong long m,h1,a1,x1,y1,h2,a2,x2,y2,oh,i1,i2,r1,r2,nh,noh,na,t;\n\tscanf(\"%I64d\",&m);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h1,&a1,&x1,&y1);\n\tscanf(\"%I64d %I64d %I64d %I64d\",&h2,&a2,&x2,&y2);\n\tfor(i1=0,oh=h1;h1!=a1;i1++){\n\t\th1=(h1*x1+y1)%m;\n\t\tif(h1==oh)\n\t\t\tbreak;\n\t}\n\tif(h1!=a1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tfor(i2=0,oh=h2;h2!=a2;i2++){\n\t\th2=(h2*x2+y2)%m;\n\t\tif(h2==oh)\n\t\t\tbreak;\n\t}\n\tif(h2!=a2){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tif(i1==i2){\n\t\tprintf(\"%I64d\\n\",i1);\n\t\treturn 0;\n\t}\n\tfor(r1=0,oh=h1;;r1++){\n\t\th1=(h1*x1+y1)%m;\n\t\tif(h1==oh)\n\t\t\tbreak;\n\t}\n\tfor(r2=0,oh=h2;;r2++){\n\t\th2=(h2*x2+y2)%m;\n\t\tif(h2==oh)\n\t\t\tbreak;\n\t}\n\tif(i1>i2){\n\t\tswap(&a1,&a2);\n\t\tswap(&i1,&i2);\n\t\tswap(&r1,&r2);\n\t}\n\tt=i2-i1;\n\tt%=r1;\n\tfor(na=0,noh=t;t!=0;na++){\n\t\tt=(t+r2)%m;\n\t\tif(t==noh)\n\t\t\tbreak;\n\t}\n\tif(t!=0){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"%I64d\\n\",i2+r2*na);\n\treturn 0;\n}\n\nvoid swap(long long *a,long long *b){\n\tlong long t;\n\tt=*a;\n\t*a=*b;\n\t*b=t;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define INF 1000000000\n\nint flag[1000000];\n\nint main(void) {\n int tmp;\n long long m, h1, a1, x1, y1, h2, a2, x2, y2;\n int cur, sum, l1, r1, l2, r2, pos1, pos2;\n\n scanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);\n\n sum = 0;\n cur = h1;\n pos1 = INF;\n do {\n flag[cur] = 1;\n if (cur == a1)\n pos1 = sum;\n cur = (x1 * cur + y1) % m;\n sum++;\n } while (!flag[cur]);\n tmp = cur;\n l1 = 0;\n cur = h1;\n while (cur != tmp) {\n cur = (x1 * cur + y1) % m;\n l1++;\n }\n r1 = sum - l1;\n if (pos1 == INF) {\n puts(\"-1\");\n return 0;\n }\n\n memset(flag, 0, sizeof flag);\n sum = 0;\n cur = h2;\n pos2 = INF;\n do {\n flag[cur] = 1;\n if (cur == a2)\n pos2 = sum;\n cur = (x2 * cur + y2) % m;\n sum++;\n } while (!flag[cur]);\n tmp = cur;\n l2 = 0;\n cur = h2;\n while (cur != tmp) {\n cur = (x2 * cur + y2) % m;\n l2++;\n }\n r2 = sum - l2;\n if (pos2 == INF) {\n puts(\"-1\");\n return 0;\n }\n\n if (pos1 < l1 && pos2 < l2) {\n if (pos1 != pos2) {\n puts(\"-1\");\n return 0;\n }\n printf(\"%d\\n\", pos1);\n } else if (pos1 < l1) {\n for (cur = pos2; cur <= pos1; cur += r2)\n if (cur == pos1) {\n printf(\"%d\\n\", pos1);\n return 0;\n }\n puts(\"-1\");\n } else if (pos2 < l2) {\n for (cur = pos1; cur <= pos2; cur += r1)\n if (cur == pos2) {\n printf(\"%d\\n\", pos2);\n return 0;\n }\n puts(\"-1\");\n } else\n if (pos1 > pos2) {\n for (cur = pos1; cur < pos1 + r1 * r2; cur += r1)\n if ((cur - l2) % r2 + l2 == pos2) {\n printf(\"%d\\n\", cur);\n return 0;\n }\n puts(\"-1\");\n } else {\n for (cur = pos2; cur < pos2 + r2 * r1; cur += r2)\n if ((cur - l1) % r1 + l1 == pos1) {\n printf(\"%d\\n\", cur);\n return 0;\n }\n puts(\"-1\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#ifndef maxn\n#define maxn (1000000+1000)\n#endif\n\nint main(int argc, char const *argv[])\n{\n int m,h1,h2,a1,a2,x1,x2,y1,y2;\n int i,cnt1,cnt2,tmp,tmp1,tmp2;\n while(scanf(\"%d\",&m)!=EOF)\n {\n scanf(\"%d %d %d %d %d %d %d %d\",&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n\n for(i=0,tmp1=0,tmp=h1;i<m;i++)\n {\n tmp=(tmp*x1+y1)%m;\n if(tmp==a1)\n {\n if(!tmp1) {tmp1=i+1;i=-1;}\n else {cnt1=i+1;break;}\n }\n }\n for(i=0,tmp2=0,tmp=h2;i<m;i++)\n {\n tmp=(tmp*x2+y2)%m;\n if(tmp==a2)\n {\n if(!tmp2) {tmp2=i+1;i=-1;}\n else {cnt2=i+1;break;}\n }\n }\n\n if (!tmp1||!tmp2)\n {\n printf(\"-1\\n\"); continue;\n }\n\n\n if(tmp1==tmp2) {printf(\"%d\\n\",tmp1);continue;}\n if(cnt1==cnt2) {printf(\"-1\\n\");continue;}\n for(i=0,tmp=tmp1;i<cnt2;tmp+=cnt1)\n {\n if (tmp>tmp2&&(tmp-tmp2)%cnt2==0)\n {\n printf(\"%d\\n\", tmp);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#ifndef maxn\n#define maxn (1000000+1000)\n#endif\n\nint main(int argc, char const *argv[])\n{\n int i,m,h1,h2,a1,a2,x1,x2,y1,y2;\n __int64 cnt1,cnt2,tmp,tmp1,tmp2;\n while(scanf(\"%d\",&m)!=EOF)\n {\n scanf(\"%d %d %d %d %d %d %d %d\",&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n\n for(i=0,tmp1=0,tmp=h1;i<m;i++)\n {\n tmp=(tmp*x1+y1)%m;\n if(tmp==a1)\n {\n if(!tmp1) {tmp1=i+1;i=-1;}\n else {cnt1=i+1;break;}\n }\n }\n for(i=0,tmp2=0,tmp=h2;i<m;i++)\n {\n tmp=(tmp*x2+y2)%m;\n if(tmp==a2)\n {\n if(!tmp2) {tmp2=i+1;i=-1;}\n else {cnt2=i+1;break;}\n }\n }\n\n if (!tmp1||!tmp2)\n {\n printf(\"-1\\n\"); continue;\n }\n\n\n if(tmp1==tmp2) {printf(\"%I64d\\n\",tmp1);continue;}\n if(cnt1==cnt2) {printf(\"-1\\n\");continue;}\n for(i=0,tmp=tmp1;i<cnt2;tmp+=cnt1)\n {\n if (tmp>tmp2&&(tmp-tmp2)%cnt2==0)\n {\n printf(\"%I64d\\n\", tmp);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint m=1;\n\tint h1=0,a1=0,x1=0,y1=0;\n\tint h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&h1,&a1);\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\"%d%d\",&h2,&a2);\n\tscanf(\"%d%d\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=0;\n\tint q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tif(count>m){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;}\n\t\t \n\t\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\t}\n\tif(h2==a2){\n\t\tprintf(\"%d\\n\",q );\n\t\treturn 0;\n\t}\n\tint c=0;\n\twhile(++c){\n\t\th1=(x1*h1+y1)%m;\n\t\tif(h1==a1) break;\n\t}\n\tif(c>m){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tint i, a=1, b=0;\n\tfor(i=0;i<c;i++){\n\t\ta=(a*x2)%m;\n\t\tb=(b*x2+y2)%m;\n\t}\n\tint count1=0;\n\twhile(count1<=m){\n\t\tcount1++;\n\t\th2=(a*h2+b)%m;\n\t\tif(h2==a2){\n\t\t\tprintf(\"%d\\n\",q+count1*c );\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int m=1;\n\tlong long int h1=0,a1=0,x1=0,y1=0;\n\tlong long int h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%lld\",&m);\n\tscanf(\"%lld%lld\",&h1,&a1);\n\tscanf(\"%lld%lld\",&x1,&y1);\n\tscanf(\"%lld%lld\",&h2,&a2);\n\tscanf(\"%lld%lld\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=0;\n\tlong long int q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tif(count>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;}\n\t\t \n\t\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\t}\n\tif(h2==a2){\n\t\tprintf(\"%lld\\n\",q );\n\t\treturn 0;\n\t}\n\tint c=0;\n\twhile(++c){\n\t\th1=(x1*h1+y1)%m;\n\t\tif(h1==a1) break;\n\t}\n\tif(c>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tint i; long long a=1, b=0;\n\tfor(i=0;i<c;i++){\n\t\ta=(a*x2)%m;\n\t\tb=(b*x2+y2)%m;\n\t}\n\tprintf(\"%lld %lld\\n\",a,b );\n\tint count1=0;\n\twhile(h2!=a2){\n\t\tcount1++;\n\t\th2=(a*h2+b)%m;\n\t\tif(h2==a2){\n\t\t\tprintf(\"%lld\\n\",q+count1*c );\n\t\t\treturn 0;\n\t\t}\n\t\tprintf(\"%lld\\n\",h2 );\n\t}\n\tif(count1>m+1)printf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint m=1;\n\tint h1=0,a1=0,x1=0,y1=0;\n\tint h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&h1,&a1);\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\"%d%d\",&h2,&a2);\n\tscanf(\"%d%d\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=1;\n\twhile(count++<=m){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\t//printf(\"check%d\\nm-%d h1-%d a1-%d x1-%d y1-%d h2-%d a2-%d x2-%d y2-%d \",count,m,h1,a1,x1,y1,h2,a2,x2,y2);\n\tif((h1==a1)&&(h2==a2)){\n\t\tprintf(\"%d\\n\",count-1);\n\t\tbreak;}\n\telse if(((h1==initial1)&&(h2==initial2))) {\n\t\tprintf(\"-1\\n\");\n\t\tbreak;}\n\t}\n\tif(count==m+1) printf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint m=1;\n\tint h1=0,a1=0,x1=0,y1=0;\n\tint h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&h1,&a1);\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\"%d%d\",&h2,&a2);\n\tscanf(\"%d%d\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=1;\n\twhile(count++<=m){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tprintf(\"check%d\\nm-%d h1-%d a1-%d x1-%d y1-%d h2-%d a2-%d x2-%d y2-%d \",count,m,h1,a1,x1,y1,h2,a2,x2,y2);\n\tif((h1==a1)&&(h2==a2)){\n\t\tprintf(\"%d\\n\",count-1);\n\t\tbreak;}\n\telse if(((h1==initial1)&&(h2==initial2))) {\n\t\tprintf(\"-1\\n\");\n\t\tbreak;}\n\t}\n\tif(count==m+1) printf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint m=1;\n\tint h1=0,a1=0,x1=0,y1=0;\n\tint h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&h1,&a1);\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\"%d%d\",&h2,&a2);\n\tscanf(\"%d%d\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=1;\n\twhile(count++<m){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\t//printf(\"check%d\\nm-%d h1-%d a1-%d x1-%d y1-%d h2-%d a2-%d x2-%d y2-%d \",count,m,h1,a1,x1,y1,h2,a2,x2,y2);\n\tif((h1==a1)&&(h2==a2)){\n\t\tprintf(\"%d\\n\",count-1);\n\t\treturn 0;}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int m=1;\n\tlong long int h1=0,a1=0,x1=0,y1=0;\n\tlong long int h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%lld\",&m);\n\tscanf(\"%lld%lld\",&h1,&a1);\n\tscanf(\"%lld%lld\",&x1,&y1);\n\tscanf(\"%lld%lld\",&h2,&a2);\n\tscanf(\"%lld%lld\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=0;\n\tlong long int q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tif(count>m+1){\n\t\tprintf(\"a-1\\n\");\n\t\treturn 0;}\n\t\t \n\t\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\t}\n\tif(h2==a2){\n\t\tprintf(\"%lld\\n\",q );\n\t\treturn 0;\n\t}\n\tint c=0;\n\twhile(++c){\n\t\th1=(x1*h1+y1)%m;\n\t\tif(h1==a1) break;\n\t}\n\tif(c>m+1){\n\t\tprintf(\"b-1\\n\");\n\t\treturn 0;\n\t}\n\tint i; long long a=1, b=0;\n\tfor(i=0;i<c;i++){\n\t\ta=(a*x2)%m;\n\t\tb=(b*x2+y2)%m;\n\t}\n\tprintf(\"%lld %lld\\n\",a,b );\n\tint count1=0;\n\twhile(h2!=a2){\n\t\tcount1++;\n\t\th2=(a*h2+b)%m;\n\t\tif(h2==a2){\n\t\t\tprintf(\"%lld\\n\",q+count1*c );\n\t\t\treturn 0;\n\t\t}\n\t\tprintf(\"%lld\\n\",h2 );\n\t}\n\tif(count1>m+1)printf(\"c-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint m=1;\n\tint h1=0,a1=0,x1=0,y1=0;\n\tint h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%d\",&m);\n\tscanf(\"%d%d\",&h1,&a1);\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\"%d%d\",&h2,&a2);\n\tscanf(\"%d%d\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=0;\n\tint q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\t//printf(\"check%d\\nm-%d h1-%d a1-%d x1-%d y1-%d h2-%d a2-%d x2-%d y2-%d \",count,m,h1,a1,x1,y1,h2,a2,x2,y2);\n\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\tif(count>=m){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\t//printf(\"check1\\n\");\n\t}\n\tif(h2==a2) {printf(\"%d\\n\",q);return 0;}\n\tcount=0;\n\twhile(h1!=initial1){h1=(x1*h1+y1)%m;h2=(x2*h2+y2)%m;count++;}\n\tif(count>m) {printf(\"-1\\n\");return 0;}\n\tif(h2==a2){printf(\"%d\\n\",count+q);return 0;}\n\tint c=count;\n\tcount=0;\n\twhile(count<m){\n\t\tint i=c;\n\t\twhile(i--){\n\t\t\th2=(x2*h2+y2)%m;\n\t\t}\n\tcount+=c;\n\tif(h2==a2){printf(\"%d\\n\",q+count*c);return 0;}\n\t}\n\tif(h2!=a2) printf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int m=1;\n\tlong long int h1=0,a1=0,x1=0,y1=0;\n\tlong long int h2=0,a2=0,x2=0,y2=0;\n\tscanf(\"%lld\",&m);\n\tscanf(\"%lld%lld\",&h1,&a1);\n\tscanf(\"%lld%lld\",&x1,&y1);\n\tscanf(\"%lld%lld\",&h2,&a2);\n\tscanf(\"%lld%lld\",&x2,&y2);\n\tint initial1=h1;\n\tint initial2=h2;\n\tint count=0;\n\tlong long int q=0;\n\twhile(++count){\n\th1=(x1*h1+y1)%m;\n\th2=(x2*h2+y2)%m;\n\tif(count>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;}\n\t\t \n\t\t if(h1==a1) {\n\t\tq=count;\n\t\tbreak;}\n\t}\n\tif(h2==a2){\n\t\tprintf(\"%lld\\n\",q );\n\t\treturn 0;\n\t}\n\tint c=0;\n\twhile(++c){\n\t\th1=(x1*h1+y1)%m;\n\t\tif(h1==a1) break;\n\t}\n\tif(c>m+1){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tint i; long long a=1, b=0;\n\tfor(i=0;i<c;i++){\n\t\ta=(a*x2)%m;\n\t\tb=(b*x2+y2)%m;\n\t}\n\t//printf(\"%lld %lld\\n\",a,b );\n\tint count1=0;\n\twhile(h2!=a2){\n\t\tcount1++;\n\t\th2=(a*h2+b)%m;\n\t\tif(h2==a2){\n\t\t\tprintf(\"%lld\\n\",q+count1*c );\n\t\t\treturn 0;\n\t\t}\n\t\tif(count1>m+1){printf(\"-1\\n\");return 0;}\n\t\t//printf(\"%lld\\n\",h2 );\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nlong long number1[MAXN],number2[MAXN];\n\nvoid gcd(long long a,long long b,long long * d,long long * x,long long * y)\n{\n if(!b){*d=a;*x=1;*y=0;}\n else {gcd(b,a%b,d,y,x);(*y)-=(*x)*(a/b);}\n}\n\nint main()\n{\n long long m,h1,a1,x1,y1,h2,a2,x2,y2;\n long long x,y,d,i,len1,len2,b1,b2;\n long long aa,bb,flag1,flag2;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n number1[h1]=1;\n len1=1;\n flag1=1;\n for(x=h1,i=0;i<=m;i++)\n {\n x=(x1*x+y1)%m;\n if(!number1[x])number1[x]=++len1;\n else\n {\n len1=len1+1-number1[x];\n break;\n }\n }\n if(number1[a1]>0)b1=number1[a1]-number1[h1];\n else flag1=0;\n\n flag2=1;\n number2[h2]=1;\n len2=1;\n for(x=h2,i=0;i<=m;i++)\n {\n x=(x2*x+y2)%m;\n if(!number2[x])number2[x]=++len2;\n else\n {\n len2=len2+1-number2[x];\n break;\n }\n }\n if(number2[a2]>0)b2=number2[a2]-number2[h2];\n else flag2=0;\n\n if(flag1==0|flag2==0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n gcd(len1,len2,&d,&x,&y);\n if((b2-b1)%d!=0)printf(\"-1\\n\");\n else\n {\n if((b2-b1)!=d)\n {\n x*=(b2-b1)/d;\n y*=(b2-b1)/d;\n }\n aa=len1/d;\n bb=len2/d;\n while(x<0||y>0)\n {\n x+=bb;\n y-=aa;\n }\n while(x-bb>=0&&y+aa<=0)\n {\n x-=bb;\n y+=aa;\n }\n printf(\"%I64d\\n\",b1+x*len1);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nint vis1[MAXN],vis2[MAXN];\n\nint main()\n{\n int m,h1,h2,a1,a2,x1,y1,x2,y2;\n int T1,T2,i,len,xx,s1,s2,b1,b2;\n long long ans,t1,t2;\n\n scanf(\"%d%d%d%d%d%d%d%d%d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n vis1[h1]=1;\n len=1;\n xx=h1;\n for(i=0;i<=m;i++)\n {\n xx=((long long)x1*xx+y1)%m;\n if(!vis1[xx])vis1[xx]=++len;\n else\n {\n s1=xx;\n T1=len+1-vis1[xx];\n break;\n }\n }\n vis2[h2]=1;\n len=1;\n xx=h2;\n for(i=0;i<=m;i++)\n {\n xx=((long long)x2*xx+y2)%m;\n if(!vis2[xx])vis2[xx]=++len;\n else\n {\n s2=xx;\n T2=len+1-vis2[xx];\n break;\n }\n }\n b1=vis1[a1]-1;\n b2=vis2[a2]-1;\n if(!b1||!b2)printf(\"-1\\n\");\n else if(b1==b2)printf(\"%d\\n\",b1);\n else if(b1>=s1&&b2<s2)\n {\n\n if(b2>b1&&(b2-b1)%T1==0)printf(\"%d\\n\",b2);\n else printf(\"-1\\n\");\n }\n else if(b2>=s2&&b1<s1)\n {\n if(b1>b2&&(b1-b2)%T2==0)printf(\"%d\\n\",b1);\n else printf(\"-1\\n\");\n }\n else if(b1<s1&&b2<s2)printf(\"-1\\n\");\n else\n {\n t1=b1;\n t2=b2;\n ans=-1;\n for(i=0;i<=m+2;)\n {\n if(t1==t2)\n {\n ans=t1;\n break;\n }\n else if(t1<t2)\n {\n t1+=T2;\n i++;\n }\n else t2+=T2;\n }\n printf(\"%I64d\\n\",ans);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nlong long number1[MAXN],number2[MAXN];\n\nvoid gcd(long long a,long long b,long long * d,long long * x,long long * y)\n{\n if(!b){*d=a;*x=1;*y=0;}\n else {gcd(b,a%b,d,y,x);(*y)-=(*x)*(a/b);}\n}\n\nint main()\n{\n long long m,h1,a1,x1,y1,h2,a2,x2,y2;\n long long x,y,d,i,len1,len2,b1,b2;\n long long aa,bb,flag1,flag2,flag11,flag22;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n number1[h1]=1;\n len1=1;\n flag1=1;\n flag11=flag22=0;\n for(x=h1,i=0;i<=m;i++)\n {\n x=(x1*x+y1)%m;\n if(!number1[x])number1[x]=++len1;\n else\n {\n len1=len1+1-number1[x];\n if(number1[a1]>0&&number1[a1]<number1[x])flag11=1;\n break;\n }\n }\n if(number1[a1]>0)b1=number1[a1]-number1[h1];\n else flag1=0;\n\n flag2=1;\n number2[h2]=1;\n len2=1;\n for(x=h2,i=0;i<=m;i++)\n {\n x=(x2*x+y2)%m;\n if(!number2[x])number2[x]=++len2;\n else\n {\n len2=len2+1-number2[x];\n if(number2[a2]>0&&number2[a2]<number2[x])flag22=1;\n break;\n }\n }\n if(number2[a2]>0)b2=number2[a2]-number2[h2];\n else flag2=0;\n\n if(flag1==0|flag2==0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n if(flag11&&flag22)\n {\n if(b1==b2)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag11)\n {\n if(b1>b2&&(b1-b2)%len2==0)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag22)\n {\n if(b2>b1&&(b2-b1)%len1==0)printf(\"%I64d\\n\",b2);\n else printf(\"-1\\n\");\n return 0;\n }\n gcd(len1,len2,&d,&x,&y);\n if((b2-b1)%d!=0)printf(\"-1\\n\");\n else\n {\n if((b2-b1)!=d)\n {\n x*=(b2-b1)/d;\n y*=(b2-b1)/d;\n }\n aa=len1/d;\n bb=len2/d;\n while(x<0||y>0)\n {\n x+=bb;\n y-=aa;\n }\n while(x-bb>=0&&y+aa<=0)\n {\n x-=bb;\n y+=aa;\n }\n printf(\"%I64d\\n\",b1+x*len1);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nlong long number1[MAXN],number2[MAXN];\n\nvoid gcd(long long a,long long b,long long * d,long long * x,long long * y)\n{\n if(!b){*d=a;*x=1;*y=0;}\n else {gcd(b,a%b,d,y,x);(*y)-=(*x)*(a/b);}\n}\n\nint main()\n{\n long long m,h1,a1,x1,y1,h2,a2,x2,y2;\n long long x,y,d,i,len1,len2,b1,b2;\n long long aa,bb,flag1,flag2,flag11,flag22;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n number1[h1]=1;\n len1=1;\n flag1=1;\n for(x=h1,i=0;i<=m;i++)\n {\n x=(x1*x+y1)%m;\n if(!number1[x])number1[x]=++len1;\n else\n {\n len1=len1+1-number1[x];\n if(number1[a1]<number1[x])flag11=1;\n break;\n }\n }\n if(number1[a1]>0)b1=number1[a1]-number1[h1];\n else flag1=0;\n\n flag2=1;\n number2[h2]=1;\n len2=1;\n for(x=h2,i=0;i<=m;i++)\n {\n x=(x2*x+y2)%m;\n if(!number2[x])number2[x]=++len2;\n else\n {\n len2=len2+1-number2[x];\n if(number2[a2]<number2[x])flag22=1;\n break;\n }\n }\n if(number2[a2]>0)b2=number2[a2]-number2[h2];\n else flag2=0;\n\n if(flag1==0|flag2==0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n if(flag11&&flag22)\n {\n if(b1==b2)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag11)\n {\n if(b1>b2&&(b1-b2)%len2==0)printf(\"%I64d\\n\",b1);\n else printf(\"-1\\n\");\n return 0;\n }\n else if(flag22)\n {\n if(b2>b1&&(b2-b1)%len1==0)printf(\"%I64d\\n\",b2);\n else printf(\"-1\\n\");\n return 0;\n }\n gcd(len1,len2,&d,&x,&y);\n printf(\"%I64d %I64d\\n\",x,y);\n if((b2-b1)%d!=0)printf(\"-1\\n\");\n else\n {\n if((b2-b1)!=d)\n {\n x*=(b2-b1)/d;\n y*=(b2-b1)/d;\n }\n aa=len1/d;\n bb=len2/d;\n while(x<0||y>0)\n {\n x+=bb;\n y-=aa;\n }\n while(x-bb>=0&&y+aa<=0)\n {\n x-=bb;\n y+=aa;\n }\n printf(\"%I64d\\n\",b1+x*len1);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nint vis1[MAXN],vis2[MAXN];\n\nint main()\n{\n int m,h1,h2,a1,a2,x1,y1,x2,y2;\n int T1,T2,i,len,xx,s1,s2,b1,b2;\n long long ans,t1,t2;\n\n scanf(\"%d%d%d%d%d%d%d%d%d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n vis1[h1]=1;\n len=1;\n xx=h1;\n for(i=0;i<=m;i++)\n {\n xx=((long long)x1*xx+y1)%m;\n if(!vis1[xx])vis1[xx]=++len;\n else\n {\n s1=vis1[xx]-1;\n T1=len+1-vis1[xx];\n break;\n }\n }\n vis2[h2]=1;\n len=1;\n xx=h2;\n for(i=0;i<=m;i++)\n {\n xx=((long long)x2*xx+y2)%m;\n if(!vis2[xx])vis2[xx]=++len;\n else\n {\n s2=vis2[xx]-1;\n T2=len+1-vis2[xx];\n break;\n }\n }\n b1=vis1[a1]-1;\n b2=vis2[a2]-1;\n if(!b1||!b2)printf(\"-1\\n\");\n else if(b1==b2)printf(\"%d\\n\",b1);\n else if(b1>=s1&&b2<s2)\n {\n\n if(b2>b1&&(b2-b1)%T1==0)printf(\"%d\\n\",b2);\n else printf(\"-1\\n\");\n }\n else if(b2>=s2&&b1<s1)\n {\n if(b1>b2&&(b1-b2)%T2==0)printf(\"%d\\n\",b1);\n else printf(\"-1\\n\");\n }\n else if(b1<s1&&b2<s2)printf(\"-1\\n\");\n else\n {\n t1=b1;\n t2=b2;\n ans=-1;\n for(i=0;i<=m+2;)\n {\n if(t1==t2)\n {\n ans=t1;\n break;\n }\n else if(t1<t2)\n {\n t1+=T2;\n i++;\n }\n else t2+=T2;\n }\n printf(\"%I64d\\n\",ans);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAXN 1000002\n\nlong long number1[MAXN],number2[MAXN];\n\nvoid gcd(long long a,long long b,long long * d,long long * x,long long * y)\n{\n if(!b){*d=a;*x=1;*y=0;}\n else {gcd(b,a%b,d,y,x);(*y)-=(*x)*(a/b);}\n}\n\nint main()\n{\n long long m,h1,a1,x1,y1,h2,a2,x2,y2;\n long long x,y,d,i,len1,len2,b1,b2;\n long long aa,bb,flag1,flag2,T1,T2,flag=0;\n\n scanf(\"%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d\",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2);\n number1[h1]=1;\n len1=1;\n flag1=1;\n for(x=h1,i=0;i<=m;i++)\n {\n x=(x1*x+y1)%m;\n if(!number1[x])number1[x]=++len1;\n else\n {\n len1=len1+1-number1[x];\n if(number1[a1]<number1[x])flag=0;\n T1=number1[x];\n break;\n }\n }\n if(number1[a1]>0)b1=number1[a1]-number1[h1];\n else flag1=0;\n\n flag2=1;\n number2[h2]=1;\n len2=1;\n for(x=h2,i=0;i<=m;i++)\n {\n x=(x2*x+y2)%m;\n if(!number2[x])number2[x]=++len2;\n else\n {\n len2=len2+1-number2[x];\n if(number2[a2]<number2[x])flag=0;\n T2=number2[x];\n break;\n }\n }\n if(number2[a2]>0)b2=number2[a2]-number2[h2];\n else flag2=0;\n\n if(flag1==0|flag2==0)\n {\n printf(\"-1\\n\");\n return 0;\n }\n gcd(len1,len2,&d,&x,&y);\n if((b2-b1)%d!=0)printf(\"-1\\n\");\n else\n {\n if((b2-b1)!=d)\n {\n x*=(b2-b1)/d;\n y*=(b2-b1)/d;\n }\n aa=len1/d;\n bb=len2/d;\n while(x<0||y>0)\n {\n x+=bb;\n y-=aa;\n }\n while(x-bb>=0&&y+aa<=0)\n {\n x-=bb;\n y+=aa;\n }\n if(flag==0&&(b1+x*len1>b2))printf(\"-1\\n\");\n else printf(\"%I64d\\n\",b1+x*len1);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int p,h1,a1,x1,y,h2,a2,x2,y2;\nlong long int hone(long long int h)\n{\n\treturn (x1*h+y)%p;\n}\nlong long int htwo(long long int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tlong long int i,hi=a1,c=0,d=1,x=0,h=hone(h1),o=0;\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%lld\\n\",c);\n\t\telse\n\t\t{\n\t\t\twhile(h!=h1 && d<=p)\n\t\t\t{\n\t\t\t\th=hone(h);\n\t\t\t\td++;\n\t\t\t}\n\t\t\tif(d>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(hi!=h2 && o<=p)\n\t\t\t\t{\n\t\t\t\t\thi=htwo(hi);\n\t\t\t\t\to++;\n\t\t\t\t}\n\t\t\t\tif(o>p)\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\telse\t\n\t\t\t\t\tprintf(\"%lld\\n\",c+o*d);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint p,h1,a1,x1,y,h2,a2,x2,y2;\nint hone(int h)\n{\n\treturn (x1*h+y)%p;\n}\nint htwo(int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%d %d %d %d %d %d %d %d %d\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tint i,hi=a1,c=0,d=1,x=0,h=hone(h1);\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%d\\n\",c);\n\t\telse\n\t\t{\n\t\t\twhile(h!=h1 && d<=p)\n\t\t\t{\n\t\t\t\th=hone(h);\n\t\t\t\td++;\n\t\t\t}\n\t\t\tif(d>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(c+x*d<=p && hi!=h2)\n\t\t\t\t{\n\t\t\t\t\tfor(i=0;i<d;i++)\n\t\t\t\t\t\thi=htwo(hi);\n\t\t\t\t\tx++;\n\t\t\t\t}\n\t\t\t\tif(c+x*d>p)\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%d\\n\",c+x*d);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int p,h1,a1,x1,y,h2,a2,x2,y2;\nlong long int hone(long long int h)\n{\n\treturn (x1*h+y)%p;\n}\nlong long int htwo(long long int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tlong long int i,hi=a1,c=0,d=1,h=hone(h1),o=0;\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\twhile(h!=h1 && d<=p)\n\t{\n\t\th=hone(h);\n\t\td++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%lld\\n\",c);\n\t\telse if(d>p)\n\t\t\tprintf(\"-1\\n\");\n\t\telse\n\t\t{\n\t\t\twhile(hi!=h2 && o<=p)\n\t\t\t{\n\t\t\t\thi=htwo(hi);\n\t\t\t\to++;\n\t\t\t}\n\t\t\tif(o>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse if(o==d)\n\t\t\t\tprintf(\"%lld\\n\",c+o);\n\t\t\telse{\n\t\t\t\thi=htwo(hi);\n\t\t\t\tint oo=1;\n\t\t\t\twhile(hi!=h2 && oo<=p)\n\t\t\t\t{\n\t\t\t\t\thi=htwo(h2);\n\t\t\t\t\too++;\n\t\t\t\t}\n\t\t\t\tif(oo>p)\n\t\t\t\t\tprintf(\"-1\\n\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%lld\\n\",c+o*d);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int p,h1,a1,x1,y,h2,a2,x2,y2;\nlong long int hone(long long int h)\n{\n\treturn (x1*h+y)%p;\n}\nlong long int htwo(long long int h)\n{\n\treturn (x2*h+y2)%p;\n}\nint main()\n{\n\tscanf(\"%lld %lld %lld %lld %lld %lld %lld %lld %lld\",&p,&a1,&h1,&x1,&y,&a2,&h2,&x2,&y2);\n\tlong long int i,hi=a1,c=0,d=1,h=hone(h1),o=0;\n\twhile(hi!=h1 && c<=p)\n\t{\n\t\thi=hone(hi);\n\t\tc++;\n\t}\n\twhile(h!=h1 && d<=p)\n\t{\n\t\th=hone(h);\n\t\td++;\n\t}\n\tif(c>p)\n\t\tprintf(\"-1\\n\");\n\telse\n\t{\n\t\thi=a2;\n\t\tfor(i=0;i<c;i++)\n\t\t\thi=htwo(hi);\n\t\t//printf(\"%lld\\n\",hi);\n\t\tif(hi==h2)\n\t\t\tprintf(\"%lld\\n\",c);\n\t\telse if(d>p)\n\t\t\tprintf(\"-1\\n\");\n\t\telse\n\t\t{\n\t\t\twhile(hi!=h2 && o<=p)\n\t\t\t{\n\t\t\t\thi=htwo(hi);\n\t\t\t\to++;\n\t\t\t}\n\t\t\tif(o>p)\n\t\t\t\tprintf(\"-1\\n\");\n\t\t\telse if(o==d)\n\t\t\t\tprintf(\"%lld\\n\",c+o);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",c+o*d);\n\t\t}\n\t}\n//\tprintf(\"%lld %lld %lld\\n\",c,d,o);\n\treturn 0;\n}\n"}], "src_uid": "7225266f663699ff7e16b726cadfe9ee"} {"nl": {"description": "We consider a positive integer perfect, if and only if the sum of its digits is exactly $$$10$$$. Given a positive integer $$$k$$$, your task is to find the $$$k$$$-th smallest perfect positive integer.", "input_spec": "A single line with a positive integer $$$k$$$ ($$$1 \\leq k \\leq 10\\,000$$$).", "output_spec": "A single number, denoting the $$$k$$$-th smallest perfect integer.", "sample_inputs": ["1", "2"], "sample_outputs": ["19", "28"], "notes": "NoteThe first perfect integer is $$$19$$$ and the second one is $$$28$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,i,j,d=0,k=0,s=0,e=0,b=0;\n long long int ara[100000];\n scanf(\"%I64d\",&a);\n for(i=0;i<10000000;i++)\n {\n s=0;\n d=19+(9*i);\n e=d;\n for(j=0;j<10000000;j++)\n {\n b=d%10;\n d=d/10;\n\n s=s+b;\n if(d==0)\n {\n break;\n }\n }\n if(s==10)\n {\n ara[k]=e;\n k++;\n if(k==a)\n {\n break;\n }\n\n }\n }\n printf(\"%I64d\",ara[a-1]);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\ntypedef long long ll;\n#define digit_cnt 19\n#define digit_sum 11\n\nll cnt[digit_cnt][digit_sum];\n\nll check(int pos,int num,int sum,int index)\n{\n\tll res = 0;\n\tfor(int i=0 ; i<=num ; i++)\n\t\tres += cnt[pos-1][sum-i];\n\tif(res>=index)\n\t\tif(num==0)\n\t\t\treturn 0;\n\t\telse\n\t\t\treturn res-cnt[pos-1][sum-num];\n\treturn -1;\n}\n\nll power(int base,int exp,int offset)\n{\n\tll res = 1;\n\tfor(int i=0 ; i<exp ; i++)\n\t\tres *= 10;\n\treturn res*offset;\n}\n\nll calc(int pos,int sum,int index)\n{\n\tif(pos==1)\n\t\treturn (ll)sum;\n\tfor(int i=0 ; i<=sum && i<10 ; i++)\n\t{\n\t\tll t = check(pos,i,sum,index);\n\t\tif(t>=0)\n\t\t\treturn power(10,pos-1,i)+calc(pos-1,sum-i,index-t);\n\t}\n}\n\nvoid preprocess()\n {\n \tfor(int j=0 ; j<=10 ; j++)\n\t\tif(j==10) cnt[2][j] = 0;\n\t\telse cnt[1][j] = 1;\n\t\n\tfor(int i=2 ; i<19 ; i++)\n\t{\n\t\tfor(int j=0 ; j<=10 ; j++){\n\t\t\tfor(int k=0 ; k<=j && k<10 ; k++)\n\t\t\t\tcnt[i][j] += cnt[i-1][j-k];\n\t\t}\n\t}\n}\n\nint main()\n{\n\tpreprocess();\n\tint k;\n\tscanf(\"%d\",&k);\n\tprintf(\"%lld\\n\",calc(18,10,k) );\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[100],flag,len,k,temp,i,j,sum,new;\n scanf(\"%d\",&k);\n if(k==1)\n printf(\"19\\n\");\n else\n {\n len=2;\n a[0]=1;\n a[1]=9;\n for(i=2;i<=k;i++)\n {\n flag=0;\n temp=-1;\n for(j=len-1;j>=0;j--)\n {\n if(a[j]<9&&temp!=-1)\n {\n a[j]=a[j]+1;\n sum=0;\n for(new=0;new<=j;new++)\n sum+=a[new];\n for(new=j+1;new<len-1;new++)\n a[new]=0;\n a[len-1]=10-sum;\n break;\n }\n else\n {\n if(j==0)\n {\n flag=1;\n len=len+1;\n break;\n }\n if(a[j]>0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j<len-1;j++)\n {\n a[j]=0;\n }\n }\n }\n for(i=0;i<len;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nint main()\n{\n int x,len=0,nb=0,res,a;\n int y=19;\n scanf(\"%d\",&x);\n while(nb!=x)\n {\n len=0;\n a=y;\n while(a)\n {\n len+=a%10;\n a=a/10;\n }\n if(len==10 )\n { \n nb++;\n }\n y++;\n }\n printf(\"%d\",y-1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint k;\nint i;\nint s=0;\nscanf(\"%d\",&k);\nfor(i=19; ;i++){\n int j=i;\n while(j)\n {\n s+=j%10;\n j=j/10;\n }\n if (s==10)\n {\n\n k--;\n }\n if (k==0){\n printf(\"%d\",i);\n break;\n }\n s=0;\n}\n\n\n\nreturn (0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,c=19,s=19,m=0,i=1;\n\tscanf(\"%d\",&n);\n while(i<n)\n\t{\n\t\tc++;\n\t\ts=c;\n\t\twhile(s)\n\t\t{\n m+=s%10;\n\t\t\ts/=10;\n\t\t}\n\t\tif(m==10)\n\t\t\ti++;\n\t\tm=0;\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n \n \n int k , temp , i,a , b, c ,d ,e,count=0 ;\n scanf(\"%d\",&k);\n \n for(i=19 ; ; i+=9)\n {\n int n=i;\n int sum=0;\n while(n )\n {\n sum+= n%10;\n n/=10;\n }\n \n if(sum== 10)\n count++;\n \n \n if(count==k)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n \n \n \n }\n \n \n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\ntypedef long long ll;\n#define digit_cnt 19\n#define digit_sum 11\n\nll cnt[digit_cnt][digit_sum];\n\nll check(int pos,int num,int sum,int index)\n{\n\tll res = 0;\n\tfor(int i=0 ; i<=num ; i++)\n\t\tres += cnt[pos-1][sum-i];\n\tif(res>=index)\n\t\tif(num==0)\n\t\t\treturn 0;\n\t\telse\n\t\t\treturn res-cnt[pos-1][sum-num];\n\treturn -1;\n}\n\nll power(int base,int exp,int offset)\n{\n\tll res = 1;\n\tfor(int i=0 ; i<exp ; i++)\n\t\tres *= 10;\n\treturn res*offset;\n}\n\nll calc(int pos,int sum,int index)\n{\n\tif(pos==1)\n\t\treturn (ll)sum;\n\tfor(int i=0 ; i<=sum && i<10 ; i++)\n\t{\n\t\tll t = check(pos,i,sum,index);\n\t\tif(t>=0)\n\t\t\treturn power(10,pos-1,i)+calc(pos-1,sum-i,index-t);\n\t}\n}\n\nvoid preprocess()\n {\n \tfor(int j=0 ; j<=10 ; j++)\n\t\tif(j==10) cnt[2][j] = 0;\n\t\telse cnt[1][j] = 1;\n\t\n\tfor(int i=2 ; i<19 ; i++)\n\t{\n\t\tfor(int j=0 ; j<=10 ; j++){\n\t\t\tfor(int k=0 ; k<=j && k<10 ; k++)\n\t\t\t\tcnt[i][j] += cnt[i-1][j-k];\n\t\t}\n\t}\n}\n\nint main()\n{\n\tpreprocess();\n\tint k;\n\tscanf(\"%d\",&k);\n\tprintf(\"%lld\\n\",calc(18,10,k) );\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nvoid Algo();\n\nint num, count;\nchar buff[10];\n\nvoid getSum(int n) {\n\tcount = 0;\n\twhile (n != 0)\n\t{\n\t\tcount = count + n % 10;\n\t\tn = n / 10;\n\t}\n}\n\nvoid Input() {\n\tfgets(buff, 10, stdin);\n\tnum = atoi(buff);\n}\n\nint main() {\n\tInput();\n\tAlgo();\n}\n\n\nvoid Algo() {\n\tint num2 = num;\n\tint num = 19;\n\tint answer;\n\tfor (int i = 0; i < num2;) {\n\t\tgetSum(num);\n\t\tif (count == 10) {\n\t\t\tif (i + 1 == num2)\n\t\t\t\tanswer = num;\n\t\t\ti++;\n\t\t}\n\t\tnum++;\n\t}\n\tprintf(\"%d\", answer);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cub[100000];\nint main(){\n int perfects[10000];\n perfects[0]=19;\n int cont=1, x=19, pos=1;\n while(cont!=10000){\n x+=9;\n int y=x, sum=0;\n while(y>0){\n sum+=y%10;\n y/=10;\n }\n if(sum==10){\n perfects[pos]=x;\n pos++;\n cont++;\n }\n }\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\", perfects[n-1]);\nreturn 0;\n}"}, {"source_code": "//Bismillahir Rahmanir Rahim\n#include<stdio.h>\nint main()\n{\n int x;\n scanf(\"%d\", &x);\n int i;\n int t;\n int count = 0;\n int remainder;\n int sum;\n for(i = 19; ;i++){\n sum = 0;\n t = i;\n while(t != 0){\n remainder = t % 10;\n sum = remainder + sum;\n t = t / 10;\n }\n\n if(sum == 10){\n count++;\n }\n if(count == x){\n break ;\n }\n\n }\n\n printf(\"%d\\n\", i);\n\n return 0;\n}\n//Alhamdulillah!\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint digit(int n)\n{\n int ans=0;\n while(n>0)\n {\n ans+=n%10;\n n/=10;\n }\n return ans;\n}\nint main()\n{\n int k,n,ans;\n n=18;\n scanf(\"%d\",&k);\n while(k)\n {\n n++;\n if(digit(n)==10)\n {\n ans=n;\n k--;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint sum_digits(int n) {\n\tint sum = 0;\n\twhile (n > 0) {\n\t\tsum += n % 10;\n\t\tn /= 10;\n\t}\n\treturn sum;\n}\n\nint main(int argc, char* argv[]) {\n\tint i, k, count;\n\t\n\tscanf(\"%i\", &k);\n\tcount = 0;\n\tfor (i = 19; i < 11000000; i++) { \n\t\tif (sum_digits(i) == 10) {\n\t\t\tcount++;\n\t\t\tif (count == k) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\n\n\nunsigned long int Sumofdigits( unsigned long int x){\n\t\n\tunsigned long int c;\n\tc= x%10;\n\t\n\tif(x <= 9 && x>=0 ){\n\t\treturn x;\n\t\t}\n\telse {\n\t\treturn Sumofdigits((x - c )/10) + c;\n\t\t}\n}\n \nint main()\n{\n\tint k, c=0;\n\tunsigned long int i=19;\n\t\n\tscanf(\"%d\" ,&k);\n\twhile ( c != k){\n\t\t\n if (10 == Sumofdigits(i)){\n \tc++;\n \t}\n i=i+9;\n }\n\t\n\t\n\tprintf(\"%li\" , (i-9) );\n\t\n\treturn 0;\n}\n \n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main()\n{\n long k,i,p,q,j,s,r,t,h,f ;\n scanf (\"%ld\",&k) ;\n s=0;\n j=0 ;\n i=0 ;\n while (i!=k)\n {\n j=j+1 ;\n long mm=j;\n long sum=0;\n while(mm>0){\n sum+=mm%10;\n mm/=10;\n }\n if (sum==10)\n {\n i=i+1 ;\n s=j ;\n\n }\n }\n printf (\"%ld\",s) ;\n return 0 ;\n}\n"}, {"source_code": "int sumdigit(int n){\n int s =0;\n while(n!=0){\n s = s + n%10;\n n = n/10;\n }\n return s;\n}\n\n\nint main(){\n \n int k;\n scanf(\"%d\", &k);\n \n int i=1;\n int nb = 19;\n while(i<k){\n nb++;\n if(sumdigit(nb)==10)\n i++;\n }\n \n \n printf(\"%d\\n\", nb);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint sum_of_digit(int i)\n{\n int k=0;\n while(i!=0)\n {\n k=k+i%10;\n i=i/10;\n }\n return k;\n}\nint main()\n{\n int k,i,l=0;\n scanf(\"%d\",&k);\n for(i=10;;i++)\n {\n if(sum_of_digit(i)==10)\n l++;\n if(k==l)\n break;\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i=10, n, j, d[100000], z[10000], x=0, y;\n\twhile( i<=10800100 )\n\t{\n\t\tn=i, j=0;\n\t\twhile( n>0 )\n\t\t{\n\t\t\td[j]=n%10;\n\t\t\tn/=10;\n\t\t\tj++;\n\t\t}\n\t\tint k=0, sum=0;\n\t\twhile( k<j )\n\t\t{\n\t\t\tsum=sum+d[k];\n\t\t\tk++;\n\t\t}\n\t\tif( sum == 10 )\n\t\t{\n\t\t\tz[x]=i;\n\t\t\tx++;\n\t\t}\n\t\ti++;\n\t}\n\tscanf(\"%lld\", &y);\n\tprintf(\"%lld\", z[y-1]);\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,s,t1,x=19,c=1,t,b;\n\tscanf(\"%d\",&n);\n\tif(n==1)\n\t{\n\t printf(\"%d\",x);\n\t return 0;\n\t}\n\tx=x+9;\n\twhile(1)\n\t{\n\n\t\tt=x;\n\t\ts=0;\n\t\twhile(t!=0)\n\t\t{\n\t\t\tb=t%10;\n\t\t\ts+=b;\n\t\t\tt=t/10;\n\t\t}\n\t\tif(s==10)\n\t\t{\n\t\t\n\t\t c++;\n\t\t if(c==n)\n\t\t {\n\t\t \tprintf(\"%d\",x);\n\t\t \tbreak;\n\t\t }\n\t\t }\n\t\t x=x+9;\n\t}\n}\n\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint digit(int n)\n{\n int ans=0;\n while(n>0)\n {\n ans+=n%10;\n n/=10;\n }\n return ans;\n}\nint main()\n{\n int k,n,ans;\n n=18;\n scanf(\"%d\",&k);\n while(k)\n {\n n++;\n if(digit(n)==10)\n {\n ans=n;\n k--;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint sm(int n)\n{\n int sum = 0;\n while(n) {sum += n % 10; n /= 10;}\n return sum;\n}\nint main() \n{\n int n, t = 19;\n scanf(\"%d\", &n);\n while(1) \n {\n \n if(sm(t) == 10) n--;\n if(n == 0) break;\n t++;\n }\n printf(\"%d\", t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t// your code goes here\n\tint k,i=1,t=1,s=0,c=0;\n\tscanf(\"%d\",&k);\n\tint a[10000];\n\twhile(c!=10000)\n { t=i;\n while(t>0)\n { s=s+t%10;\n t=t/10;\n }\n if(s==10)\n a[++c]=i;\n s=0;\n ++i;\n }\n\tprintf(\"%d\",a[k]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint t,stop=0;\nvoid f(int k,int n,int s[10]){\n\tif(stop)return;\n\tif(n==8){\n\t\tif(k!=10)return;\n\t\tif(t!=0){\n\t\t\tt--;\n\t\t\treturn;\n\t\t}\n\t\tstop=1;\n\t\tint num=0;\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnum*=10;\n\t\t\tnum+=s[i];\n\t\t}\n\t\tprintf(\"%d\\n\",num);\n\t\treturn;\n\t}\n\n\tint end=9;\n\tif(end>10-k)end=10-k;\n\n\tfor(int i=0;i<=end;i++){\n\t\ts[n]=i;\n\t\tf(k+i,n+1,s);\n\t}\n}\n\n\nint main(){\n\tscanf(\"%d\",&t);\n\tt--;\n\tint s[10]={0};\n\tf(0,0,s);\n}"}, {"source_code": "#include <stdio.h>\n\nint cub[100000];\nint main(){\n int perfects[10000];\n perfects[0]=19;\n int cont=1, x=19, pos=1;\n while(cont!=10000){\n x+=9;\n int y=x, sum=0;\n while(y>0){\n sum+=y%10;\n y/=10;\n }\n if(sum==10){\n perfects[pos]=x;\n pos++;\n cont++;\n }\n }\n int n;\n scanf(\"%d\", &n);\n int ini=0,fin=n-1,med;\n while(ini<fin){\n med=((ini+fin)/2)+1;\n if(med>n) fin=med-1;\n else ini=med;\n }\n printf(\"%d\", perfects[ini]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,s,r,temp,count=0,i;\n scanf(\"%d\",&n);\n for(i=18;i<=100000000;i++)\n { s=0;\n temp=i;\n while(temp!=0)\n {\n r=temp%10;\n s=s+r;\n temp=temp/10;\n }\n if(s==10)\n {\n count++;\n }\n if(count==n)\n {\n break;\n }\n }\n printf(\"%d\",i);\n\n\n}\n"}, {"source_code": "int sumdigit(int n){\n int s =0;\n while(n!=0){\n s = s + n%10;\n n = n/10;\n }\n return s;\n}\n\n\nint main(){\n \n int k;\n scanf(\"%d\", &k);\n \n int i=1;\n int nb = 19;\n while(i<k){\n nb++;\n if(sumdigit(nb)==10)\n i++;\n }\n \n \n printf(\"%d\\n\", nb);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint digit(int n)\n{\n int ans=0;\n while(n>0)\n {\n ans+=n%10;\n n/=10;\n }\n return ans;\n}\nint main()\n{\n int k,n,ans;\n n=18;\n scanf(\"%d\",&k);\n while(k)\n {\n n++;\n if(digit(n)==10)\n {\n ans=n;\n k--;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,i,n,sum,count=0;\n scanf(\"%lld\",&k);\n for(n=19;;n+=9){\n sum=0;\n i=n;\n while(i!=0){\n sum+=i%10;\n i/=10;}\n if(sum==10)\n count++;\n if(count==k)\n break;\n }\n printf(\"%lld\\n\",n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,i,n,sum,count=0;\n scanf(\"%lld\",&k);\n for(n=19;;n+=9){\n sum=0;\n i=n;\n while(i!=0){\n sum+=i%10;\n i/=10;}\n if(sum==10)\n count++;\n if(count==k)\n break;\n }\n printf(\"%lld\\n\",n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=19,j=1,temp2,temp;\n\tscanf(\"%d\",&n);\n if(n==1)\n {\n \tprintf(\"%d\",i);\n \treturn 0;\n\t}\n\ti+=9;\n\twhile(1)\n\t{\n\t\ttemp=i;\n\t\ttemp2=0;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\ttemp2+=temp%10;\n\t\t\ttemp/=10;\n\t\t}\n\t\tif(temp2==10)\n\t\t{\n\t\t\tj++;\n\t\t\tif(j==n)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\ti+=9;\n\t}\n\treturn 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint perfect(int n);\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tint n, j = 0, number = 19;\n\tscanf(\"%d\", &n);\n\twhile (n--) {\n\t\twhile (perfect(number) != 10) {\n\t\t\tnumber += 9;\n\t\t}\n\t\tnumber += 9;\n\t}\n\tprintf(\"%d\\n\", number - 9);\n\treturn 0;\n}\nint perfect(int n) {\n\tint sum = 0;\n\twhile (n != 0) {\n\t\tsum += n % 10;\n\t\tn = n / 10;\n\t}\n\treturn sum;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count<n){\nsum=0;\nwhile(i!=0){\nk=i%10;\nsum=sum+k;\ni=i/10;}\ni=z+9;z=z+9;;\nif(sum==10)\ncount++;\n}\nprintf(\"%d\\n\",i-9);\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[100],flag,len,k,temp,i,j,sum,new;\n scanf(\"%d\",&k);\n if(k==1)\n printf(\"19\\n\");\n else\n {\n len=2;\n a[0]=1;\n a[1]=9;\n for(i=2;i<=k;i++)\n {\n flag=0;\n temp=-1;\n for(j=len-1;j>=0;j--)\n {\n if(a[j]<9&&temp!=-1)\n {\n a[j]=a[j]+1;\n sum=0;\n for(new=0;new<=j;new++)\n sum+=a[new];\n for(new=j+1;new<len-1;new++)\n a[new]=0;\n a[len-1]=10-sum;\n break;\n }\n else\n {\n if(j==0)\n {\n flag=1;\n len=len+1;\n break;\n }\n if(a[j]>0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j<len-1;j++)\n {\n a[j]=0;\n }\n }\n }\n for(i=0;i<len;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,c=1,x=19,temp2,temp;\n scanf(\"%d\",&n);\n if(n==1)\n {\n printf(\"%d\",x);\n return 0;\n }\n x=x+9;\n while(1)\n {\n temp=x;\n temp2=0;\n while(temp!=0)\n {\n temp2+=temp%10;\n temp/=10;\n }\n if(temp2==10)\n {\n c++;\n if(c==n)\n {\n printf(\"%d\",x);\n break;\n }\n }\n x=x+9;\n }\n\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{int k,i=1,s=19;\n\tscanf(\"%d\",&k);\n\t\n\twhile(i!=k)\n\t\n\t{ s+=9;\n\t\tint n,y=0;\n\t\tn=s;\n\t\twhile(n!=0)\n\t\t{\n\t\t\ty+=n%10;\n\t\t\tn=n/10; \n\t\t}\n\t\tif(y==10)\n\t\t{\t\n\t\ti+=1;\t\n\t\t}\n }\t\t\nprintf(\"%d\",s);\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\ntypedef long long ll;\n#define digit_cnt 19\n#define digit_sum 11\n\nll cnt[digit_cnt][digit_sum];\n\nll check(int pos,int num,int sum,int index)\n{\n\tll res = 0;\n\tfor(int i=0 ; i<=num ; i++)\n\t\tres += cnt[pos-1][sum-i];\n\tif(res>=index)\n\t\treturn res-cnt[pos-1][sum-num];\n\treturn -1;\n}\n\nll power(int base,int exp,int offset)\n{\n\tll res = 1;\n\tfor(int i=0 ; i<exp ; i++)\n\t\tres *= 10;\n\treturn res*offset;\n}\n\nll calc(int pos,int sum,int index)\n{\n\tif(pos==1)\n\t\treturn (ll)sum;\n\tfor(int i=0 ; i<=sum && i<10 ; i++)\n\t{\n\t\tll t = check(pos,i,sum,index);\n\t\tif(t>=0)\n\t\t\treturn power(10,pos-1,i)+calc(pos-1,sum-i,index-t);\n\t}\n}\n\nvoid preprocess()\n {\n \tfor(int j=0 ; j<=10 ; j++)\n\t\tif(j==10) cnt[2][j] = 0;\n\t\telse cnt[1][j] = 1;\n\t\n\tfor(int i=2 ; i<19 ; i++)\n\t{\n\t\tfor(int j=0 ; j<=10 ; j++){\n\t\t\tfor(int k=0 ; k<=j && k<10 ; k++)\n\t\t\t\tcnt[i][j] += cnt[i-1][j-k];\n\t\t}\n\t}\n}\n\nint main()\n{\n\tpreprocess();\n\tint k;\n\tscanf(\"%d\",&k);\n\tprintf(\"%lld\\n\",calc(18,10,k) );\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\nint sum(int j){\n int count=0;\n while(j >0){\n count = count + (j%10);\n j = j/10;\n }\n return count;\n}\nint main(){\n int n, m=1, i=19;\n scanf(\"%d\",&n);\n while(n != m){\n i= i + 9;\n while(sum(i) != 10){\n i+=9;\n }\n m+=1;\n }\n printf(\"%d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, kol = 1, te;\n long int n = 19, test;\n scanf(\"%d\", &m);\n while (m != kol)\n {\n n += 9;\n te = 0;\n test = n;\n while (test != 0) {\n te += test%10;\n test /= 10;\n }\n if (te != 10) te = 0;\n else {\n kol++;\n // printf(\"\\n%ld\", n);\n }\n }\n printf(\"%ld\", n);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint findNth(int n) \n{ \n\tint count = 0; \n\n\tfor (int curr = 19;; curr += 9) { \n\n\t\t// Find sum of digits in current no. \n\t\tint sum = 0; \n\t\tfor (int x = curr; x > 0; x = x / 10) \n\t\t\tsum = sum + x % 10; \n\n\t\t// If sum is 10, we increment count \n\t\tif (sum == 10) \n\t\t\tcount++; \n\n\t\t// If count becomes n, we return current \n\t\t// number. \n\t\tif (count == n) \n\t\t\treturn curr; \n\t} \n\treturn -1; \n} \n\nint main() \n{ \n\tint k;\n\tscanf(\"%d\",&k);\n\tprintf(\"%d\\n\", findNth(k)); \n\treturn 0; \n} \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nlong i=1;\nlong m=0;\nlong k;\nscanf(\"%ld\",&k);\nwhile(m < k){\n int s=0;\n long j=i;\n while(j >= 10){\n s=s+(j % 10);\n j=j/10;\n }\n s=s+j;\n if(s != 10){\n i++;}\n else{i++;\n m++;}\n }\n\nprintf(\"%ld\",i-1);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint sommedigit(int n)\n{\n int s=0,k;\n k=n;\n while(k!=0)\n {\n s += k%10;\n k = k/10;\n }\n return(s);\n}\nint main()\n{\n int k,i,res=10,c=1,l=0,s=0;\n scanf(\"%d\",&k);\n for(i=1;i<=k;i++)\n {\n res +=9;\n while (sommedigit(res)!=10)\n res+=9;\n }\n\n printf(\"%d\",res);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\nint sum(int j){\n int count=0;\n while(j >0){\n count = count + (j%10);\n j = j/10;\n }\n return count;\n}\nint main(){\n int n, m=1, i=19;\n scanf(\"%d\",&n);\n while(n != m){\n i= i + 9;\n while(sum(i) != 10){\n i+=9;\n }\n m+=1;\n }\n printf(\"%d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint cub[100000];\nint main(){\n int perfects[10000];\n perfects[0]=19;\n int cont=1, x=19, pos=1;\n while(cont!=10000){\n x+=9;\n int y=x, sum=0;\n while(y>0){\n sum+=y%10;\n y/=10;\n }\n if(sum==10){\n perfects[pos]=x;\n pos++;\n cont++;\n }\n }\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\", perfects[n-1]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[100],flag,len,k,temp,i,j,sum,new;\n scanf(\"%d\",&k);\n if(k==1)\n printf(\"19\\n\");\n else\n {\n len=2;\n a[0]=1;\n a[1]=9;\n for(i=2;i<=k;i++)\n {\n flag=0;\n temp=-1;\n for(j=len-1;j>=0;j--)\n {\n if(a[j]<9&&temp!=-1)\n {\n a[j]=a[j]+1;\n sum=0;\n for(new=0;new<=j;new++)\n sum+=a[new];\n for(new=j+1;new<len-1;new++)\n a[new]=0;\n a[len-1]=10-sum;\n break;\n }\n else\n {\n if(j==0)\n {\n flag=1;\n len=len+1;\n break;\n }\n if(a[j]>0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j<len-1;j++)\n {\n a[j]=0;\n }\n }\n }\n for(i=0;i<len;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint digit(int n){\nint ans=0;\nwhile(n>0){\n ans+=n%10;\n n/=10;\n}\nreturn ans;\n}\n\nint main()\n{\n int k,n=18,ans;\n scanf(\"%d\\n\",&k);\n while(k){\n n++;\n if(digit(n)==10){\n ans=n;\n k--;\n }\n}\nprintf(\"%d\\n\",n);\nreturn 0;\n}\n"}, {"source_code": "//Bismillahir Rahmanir Rahim\n#include<stdio.h>\nint main()\n{\n int x;\n scanf(\"%d\", &x);\n int i;\n int t;\n int count = 0;\n int remainder;\n int sum;\n for(i = 19; ;i++){\n sum = 0;\n t = i;\n while(t != 0){\n remainder = t % 10;\n sum = remainder + sum;\n t = t / 10;\n }\n\n if(sum == 10){\n count++;\n }\n if(count == x){\n break ;\n }\n\n }\n\n printf(\"%d\\n\", i);\n\n return 0;\n}\n//Alhamdulillah!\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,y,s=0,c=0,z=19;\n scanf(\"%d\",&x);\n while(c!=x)\n {\n y=z;\n while(y>0)\n {\n s=s+y%10;\n y=y/10;\n }\n if(s==10)\n {\n c++;\n }\n s=0;\n z++;\n }\n printf(\"%d\\n\",z-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n ;\n unsigned long long i;\n scanf(\"%d\",&n);\n int c=0;\n long long int a[10000];\n for(i=0;i<922337203685477580;i++)\n {\n int d=i;\n long int sum=0;\n while(d>0)\n {\n sum+=d%10;\n d=d/10;\n }\n if(c<10000)\n {\n if(sum==10)\n {\n a[c]=i;\n c++;\n }\n }\n else \n break;\n }\n printf(\"%lld\",a[n-1]);\n }"}, {"source_code": "#include<stdio.h>\nint n,i,c;\nint f(int n){\n\tif(n==0)return 0;\n\treturn n%10+f(n/10);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\twhile(1){\n\t\ti++;\n\t\tif(f(i)==10)c++;\n\t\tif(c==n){\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int k,i=19,s=0,l=0,c=0,j;\n scanf(\"%d\",&k);\n while(c!=k)\n {\n l=i;\n s=0;\n while(i>0)\n {\n j=i%10;\n s=s+j;\n i=i/10;\n }\n i=l;\n if(s==10)\n {\n c++;\n i++;\n }\n else\n {\n i++;\n }\n }\n printf(\"%d\",l);\n return 0;\n} "}, {"source_code": "#include<stdio.h>\nint sum(int n);\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n int set=0,count=0,n=1;\n while(count<k){\n int ans=sum(n);\n //printf(\"%d %d\\n\",ans,n);\n if(ans==10){\n count++;\n n++;\n }\n else\n n++;\n //printf(\"%d %d %d \\n\",ans,n,count);\n }\n printf(\"%d\",n-1);\n \n}\nint sum(int n)\n{\n int res=0;\n while(n>=1)\n {\n res+=n%10;\n n=n/10;\n }\n return res;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint perfect(int n)\n{int test=0;\n int s=0;\nint i=0;\n\n s=n/10;\ni=i+n%10;\n\nwhile(s!=0)\n\n{i=i+s%10;\n\n s=s/10;\n}\nif(i==10)\n test=1;\nreturn test;\n}\nint main()\n{int k;\nscanf(\"%d\",&k);\nint i=1;\nint test=0;\nint numparfait=0;\nwhile(numparfait!=k)\n{\n test=perfect( i);\n if(test)\n {\n numparfait++;\n }\n i++;\n\n}\n printf(\"%d\",i-1);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint sum(int n);\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n int set=0,count=0,n=1;\n while(count<k){\n int ans=sum(n);\n //printf(\"%d %d\\n\",ans,n);\n if(ans==10){\n count++;\n n++;\n }\n else\n n++;\n //printf(\"%d %d %d \\n\",ans,n,count);\n }\n printf(\"%d\",n-1);\n \n}\nint sum(int n)\n{\n int res=0;\n while(n>=1)\n {\n res+=n%10;\n n=n/10;\n }\n return res;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j,num,sum=0,c=0;\n scanf(\"%d\",&i);\n for(j=1;j<1000000000;j++)\n { num=j;\n while(num!=0)\n {\n sum=sum+(num%10);\n num=num/10;\n }\n if(sum==10)\n {\n\n\n c++;\n if(c==i)\n {\n printf(\"%d\",j);\n break;\n }\n\n }\n sum=0;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n while(~scanf(\"%d\",&n))\n {\n int sum,a,i,t=0;\n for(i=1;t<n;i++)\n {\n sum=0;\n a=i;\n while(a)\n {\n sum+=a%10;\n a=a/10;\n }\n if(sum==10)\n {\n t++;\n }\n }\n printf(\"%d\\n\",i-1);\n }\n\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint n,i,c;\nint f(int n){\n\tif(n==0)return 0;\n\treturn n%10+f(n/10);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\twhile(1){\n\t\ti++;\n\t\tif(f(i)==10)c++;\n\t\tif(c==n){\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint sum_of_digit(int i)\n{\n int k=0;\n while(i!=0)\n {\n k=k+i%10;\n i=i/10;\n }\n return k;\n}\nint main()\n{\n int k,i,l=0;\n scanf(\"%d\",&k);\n for(i=10;;i++)\n {\n if(sum_of_digit(i)==10)\n l++;\n if(k==l)\n break;\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint perfect(int n);\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tint n, j = 0, number = 19;\n\tscanf(\"%d\", &n);\n\twhile (n--) {\n\t\twhile (perfect(number) != 10) {\n\t\t\tnumber += 9;\n\t\t}\n\t\tnumber += 9;\n\t}\n\tprintf(\"%d\\n\", number - 9);\n\treturn 0;\n}\nint perfect(int n) {\n\tint sum = 0;\n\twhile (n != 0) {\n\t\tsum += n % 10;\n\t\tn = n / 10;\n\t}\n\treturn sum;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint sm(int n)\n{\n int sum = 0;\n while(n) {sum += n % 10; n /= 10;}\n return sum;\n}\nint main() \n{\n int n, t = 19;\n scanf(\"%d\", &n);\n while(1) \n {\n \n if(sm(t) == 10) n--;\n if(n == 0) break;\n t++;\n }\n printf(\"%d\", t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int count=0,s;\n int i = 10;\n while(1){\n s=0;\n int temp = i;\n while(temp>0){\n int t=temp%10;\n s=s+t;\n temp=temp/10;\n }\n if(s == 10)\n count++;\n if(count == n){\n printf(\"%d\",i);\n break;\n }\n i++;\n \n }\n}"}, {"source_code": "#include<stdio.h>\n\nint isTen(long long int x)\n{\n\tint temp=0;\n\twhile(x>0)\n\t{\n\t\ttemp+=x%10;\n\t\tx=x/10;\n\t}\n\tif(temp==10)\n\t\treturn 1;\n\treturn 0;\n}\n\nint main()\n{\n\tint n;\n\tlong long int k=10;\n\tscanf(\"%d\",&n);\n\twhile(n)\n\t{\n\t\tk+=9;\n\t\tif(isTen(k))\n\t\t\tn--;\n\t}\n\tprintf(\"%lld\\n\",k);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nlong i=1;\nlong m=0;\nlong k;\nscanf(\"%ld\",&k);\nwhile(m < k){\n int s=0;\n long j=i;\n while(j >= 10){\n s=s+(j % 10);\n j=j/10;\n }\n s=s+j;\n if(s != 10){\n i++;}\n else{i++;\n m++;}\n }\n\nprintf(\"%ld\",i-1);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdbool.h>\nbool isperfect(int n)\n{\n int sum=0;\n\n while(n>0)\n {\n sum=sum +n%10;\n n=n/10;\n }\n if (sum==10)return true;\n else return false;\n}\n\nmain()\n{\n int k,i,ctr=0;\n scanf(\"%d\",&k);\n\n {\n for(i=19; ;i=i+9)\n {\n if(isperfect(i)==1)ctr++;\n if(ctr==k) break;\n\n }\n printf(\"%d\",i);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count<n){\nsum=0;\nwhile(i!=0){\nk=i%10;\nsum=sum+k;\ni=i/10;}\ni=z+1;z++;\nif(sum==10)\ncount++;\n}\nprintf(\"%d\\n\",i-1);\nexit(0);\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main()\n{\n long k,i,p,q,j,s,r,t,h,f ;\n scanf (\"%ld\",&k) ;\n s=0;\n j=0 ;\n i=0 ;\n while (i!=k)\n {\n j=j+1 ;\n long mm=j;\n long sum=0;\n while(mm>0){\n sum+=mm%10;\n mm/=10;\n }\n if (sum==10)\n {\n i=i+1 ;\n s=j ;\n\n }\n }\n printf (\"%ld\",s) ;\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong lol (long long x)\n{\n long result = 0;\n while (x)\n {\n result += x % 10;\n x /= 10;\n }\n return result;\n}\nint main()\n{\n unsigned long x;\n scanf(\"%ld\", &x);\n long long result = 10;\n unsigned long temp = 0;\n while (temp < x)\n {\n result +=9;\n if (lol(result) == 10 )\n {\n temp++;\n }\n }\n printf(\"%lld\\n\", result);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int t,m,n=19,l=0,k=1;\n scanf(\"%lli\",&t);\n while(k!=t){\n n+=9;\n m=n;\n while(m!=0){\n l+=m%10;\n m=m/10;\n }\n if(l==10) {\n k++;\n }\n l=0;\n }\n printf(\"%lli\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,n,a,count=0;\n\tscanf(\"%d\",&n);\n\ti=19;\n\twhile(i)\n\t{\n\t\tj=i;a=0;\n\t\twhile(j)\n\t\t{\n\t\t\ta+=(j%10);\n\t\t\tj/=10;\n\t\t}\n\t\tif(a==10)\n\t\t\tcount++;\n\t\tif(count==n)\n\t\t\tbreak;\n\t\ti++;\n\t}\n\tprintf(\"%d\",i);\n\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{int k,i=1,s=19;\n\tscanf(\"%d\",&k);\n\t\n\twhile(i!=k)\n\t\n\t{ s+=9;\n\t\tint n,y=0;\n\t\tn=s;\n\t\twhile(n!=0)\n\t\t{\n\t\t\ty+=n%10;\n\t\t\tn=n/10; \n\t\t}\n\t\tif(y==10)\n\t\t{\t\n\t\ti+=1;\t\n\t\t}\n }\t\t\nprintf(\"%d\",s);\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint add(int num){\n int sum = 0;\nwhile(num){\n sum += num%10;\n num=num/10;\n}\n return sum;\n}\nint main()\n{ int n;\n //printf(\"enter n\\n\");\n scanf(\"%d\",&n);\n int sum=0;\n while(n){\n sum++;\n if(add(sum)==10)\n n--;\n }\n printf(\"%d\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint niilber(int a)\n{\n\tint p,sum=0;\nwhile(a>0)\n{sum=sum+a%10;\na=a/10;\n\n}\nreturn sum;\n}\nint main()\n{\n\tint k,n=1,i=1;\n\tscanf(\"%d\",&k);\n\twhile(i<=k)\n\t{\t\n\t\tn++;\n\t\tif(niilber(n)==10)\n\t\t\ti++;\n\t}\n\tprintf(\"%d\",n);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k=19,a,x;\n scanf(\"%d\",&n);\n for(; n>0;)\n {\n x=k;\n a=0;\n for(; x>0;)\n {\n a=a+(x%10);\n x=x/10;\n }\n if(a==10)\n {\n n--;\n }\n k=k+9;\n }\n printf(\"%d\\n\",k-9);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint counter = 0, sum;\n\nvoid solve(int n) {\n sum = 0;\n while (n > 0) {\n sum += (n % 10);\n n /= 10;\n }\n if (sum == 10) counter++;\n}\n\nint main() {\n int i, num; \n scanf(\"%d\", &num);\n for (i = 1; ; i++) {\n if (counter != num) solve(i);\n else printf(\"%d\\n\", i - 1), exit(0);\n }\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\nint sum(int a){int s=0;\n while(a!=0){\n s+=a%10;\n a/=10;\n }return s;\n}\nint main(){\n int k; \n scanf(\"%d\",&k);\n int a=1;\n while(k!=0){\n a++;\n if(sum(a)==10)\n k--;\n }\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n \nint findNth(int n) \n{ \n int count = 0; \n \n for (int curr = 19;; curr+=9) { \n \n // Find sum of digits in current no. \n int sum = 0; \n for (int x = curr; x > 0; x = x / 10) \n sum = sum + x % 10; \n \n // If sum is 10, we increment count \n if (sum == 10) \n count++; \n \n // If count becomes n, we return current \n // number. \n if (count == n) \n return curr; \n } \n return -1; \n} \n \nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n printf(\"%d\\n\", findNth(n)); \n return 0; \n} "}, {"source_code": "#include<stdio.h>\nint perfect(int n);\nint main() {\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tint n, j = 0, number = 19;\n\tscanf(\"%d\", &n);\n\twhile (n--) {\n\t\twhile (perfect(number) != 10) {\n\t\t\tnumber += 9;\n\t\t}\n\t\tnumber += 9;\n\t}\n\tprintf(\"%d\\n\", number - 9);\n\treturn 0;\n}\nint perfect(int n) {\n\tint sum = 0;\n\twhile (n != 0) {\n\t\tsum += n % 10;\n\t\tn = n / 10;\n\t}\n\treturn sum;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\n\n\n\nint calcul(int n)\n{\n\tint a = 0;\n\t\n\twhile (n != 0)\n\t{\n\t\ta += n % 10;\n\t\tn /= 10;\n\t}\n\treturn a;\n}\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint a = 0;\n\twhile (n !=0)\n\t{\n\t\ta++;\n\t\tif (calcul(a) == 10) \n\t\t\tn--;\n\t}\n\tprintf(\"%d\", a);\nreturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t/* code */\n\n\tlong long int i,n,j,c,count=0,sum,d;\n\tscanf (\"%lld\",&n);\n\n\tfor(i=1;count<n;i++)\n\t{\n\t j=(9*i)+1;\n\t c=j;\n\t sum=0;\n\t while (j>0)\n\t {\n\t\td=j%10;\n\t\tj=j/10;\n\t\tsum+=d;\n\t }\n\n\t if(sum==10)\n\t {\n\t\tcount++;\n\t }\n\t}\n\n\tprintf(\"%lld\\n\",c);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k=19,a,x;\n scanf(\"%d\",&n);\n for(; n>0;)\n {\n x=k;\n a=0;\n for(; x>0;)\n {\n a=a+(x%10);\n x=x/10;\n }\n if(a==10)\n {\n n--;\n }\n k=k+9;\n }\n printf(\"%d\\n\",k-9);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i=1,k,p=19,r,t,sum=0;scanf(\"%d\",&k);\n\twhile(i!=k)\n\t{\n\t\tp=p+9;\n\t\tt=p;\n\t\twhile(t!=0)\n\t\t{\n\t\t\tr=t%10;\n\t\t\tsum=sum+r;\n\t\t\tt=t/10;\n\t\t}\n\t\tif(sum==10)\n\t\ti++;\n\t\tsum=0;\n\t}\n\tprintf(\"%d\",p);\n\t\n\t\n\t\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint sm(int n)\n{\n int sum = 0;\n while(n) {sum += n % 10; n /= 10;}\n return sum;\n}\nint main() \n{\n int n, t = 19;\n scanf(\"%d\", &n);\n while(1) \n {\n \n if(sm(t) == 10) n--;\n if(n == 0) break;\n t++;\n }\n printf(\"%d\", t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\tint j = 1;\n\tint i = 0;\n\tint sum;\n\tint num;\n\twhile(i < n){\n\t\tsum = 0;\n\t\tint temp = j;\n\t\twhile((j != 0) && (sum < 20)){\n\t\t\tsum += j%10;\n\t\t\tj = j/10;\n\t\t}\n\t\tif(sum == 10){\n\t\t\ti++;\n\t\t\tnum = temp;\n\t\t}\n\t\tj = temp + 1;\n\t}\n\tprintf(\"%d\",num);\n}"}, {"source_code": "#include<stdio.h>\nint f(int a){\n int c,s=0;\n for(;a!=0;){\n c=a%10;\n a=a/10;\n s=s+c;\n }\n if(s==10){\n return 1;\n }\n else return 0;\n}\nint main(){\n int a,k=0,i;\n scanf(\"%d\",&a);\n for(i=19;;i+=9){\n k=k+f(i);\n if(k==a){\n printf(\"%d\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint sum_of_digits (int x){\n int sum=0,rem=0;\n while (x>0){\n rem=x%10;\n sum+=rem;\n x/=10;\n }\n return sum;\n } \n \n\n \nint main (){\n int k ,i=19;\n scanf(\"%d\",&k);\n \n while(k>0){\n if(sum_of_digits(i)==10) k--;\n i++;\n }\n printf(\"%d\",i-1);\n return 0;\n } \n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,z,count=0,sum;\n long long int i,a;\n scanf(\"%d\",&m);\n for (i=19;i<1000000000;i++)\n {\n sum=0;\n a=i;\n while(a!=0)\n {\n sum = sum + a%10;\n a= a/10;\n }\n\n if(sum==10)\n {\n count++;\n if(count==m)\n\n {\n printf(\"%d \",i);\n return 0;\n }\n\n }\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int k,i,z=19,a,x;\n scanf(\"%ld\",&k);\n for(;k>0;)\n {\n x=z;\n a=0;\n for(;x>0;)\n {\n a=a+(x%10);\n x=x/10;\n }\n if(a==10)\n {\n k--;\n }\n z+=9;\n }\n printf(\"%ld\\n\",z-9);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long somme(long long x)\n{\n long long s=0 ;\n while(x)\n {\n s+=x%10 ;\n x=x/10 ;\n if(s>10)\n x=0 ;\n }\n return s ;\n}\nint main()\n{\n long long x=10 ;\n int bo ;\n int k ;\n scanf(\"%d\",&k) ;\n while(k!=0)\n {\n k-- ;\n bo=1 ;\n while(bo)\n {\n x+=9 ;\n if(somme(x)==10)\n bo=0 ;\n }\n }\n printf(\"%I64d\",x) ;\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,n,a,count=0;\n\tscanf(\"%d\",&n);\n\ti=19;\n\twhile(i)\n\t{\n\t\tj=i;a=0;\n\t\twhile(j)\n\t\t{\n\t\t\ta+=(j%10);\n\t\t\tj/=10;\n\t\t}\n\t\tif(a==10)\n\t\t\tcount++;\n\t\tif(count==n)\n\t\t\tbreak;\n\t\ti++;\n\t}\n\tprintf(\"%d\",i);\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long k ;\n scanf(\"%ld\",&k ) ;\n\n\n long long sa=18 ;\n long long s ;\n long i = 0 ;\n int sm ;\n while (1)\n {\n sa=sa+1 ;\n s=sa;\n sm=0 ;\n while (1)\n {\n if (s/10==0)\n {\n\n\n sm=sm+s ;\n break ;\n }\n else\n {\n sm=sm+s%10 ;\n s=s/10;\n }\n }\n if (sm==10)\n {\n i++ ;\n if (i==k)\n {\n break ;\n }\n\n }\n }\n printf(\"%lld\",sa) ;\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint dsum(int n)\n{\n\tint sum=0;\n\twhile(n>0)\n\t{\n\t\tsum+=n%10;\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main()\n{\n\tint k,count=0;\n\tscanf(\"%d\",&k);\n\tint n=18;\n\twhile(count<k)\n\t{\n\t\tn++;\n\t\tif(dsum(n)==10)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,c=19,s=19,m=0,i=1;\n\tscanf(\"%d\",&n);\n while(i<n)\n\t{\n\t\tc++;\n\t\ts=c;\n\t\twhile(s)\n\t\t{\n m+=s%10;\n\t\t\ts/=10;\n\t\t}\n\t\tif(m==10)\n\t\t\ti++;\n\t\tm=0;\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long k,i,s,j,p,a[100000];\n\tscanf(\"%ld\",&k);\n\ti=0;j=19;\n\twhile(i<k)\n\t{\n\t\ts=0;\n\t\tp=j;\n\t\twhile(p>0)\n\t\t{\n\t\t\ts+=p%10;\n\t\t\tp=p/10;\t\n\t\t}\t\n\t\tif(s==10)\n\t\ta[i++]=j;\n\t\tj++;\n\t}\n\tprintf(\"%ld\\n\",a[k-1]);\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main()\n{\n long k,i,p,q,j,s,r,t,h,f ;\n scanf (\"%ld\",&k) ;\n s=0;\n j=0 ;\n i=0 ;\n while (i!=k)\n {\n j=j+1 ;\n long mm=j;\n long sum=0;\n while(mm>0){\n sum+=mm%10;\n mm/=10;\n }\n if (sum==10)\n {\n i=i+1 ;\n s=j ;\n\n }\n }\n printf (\"%ld\",s) ;\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,t;\n scanf(\"%d\",&n);\n i=19;\n while(n)\n {\n int s=0;\n t=i;\n while(t)\n {\n s+=t%10;\n t/=10;\n }\n if(s==10)\n n--;\n i++;\n }\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\nint k,i,count=0;\nscanf(\"%d\",&k);\nfor(i=19;i<=999999999;i++){\nint a=i,s=0;\nwhile(a!=0){\ns=s+a%10;\na=a/10;\n}\nif(s==10)count++;\nif(count==k){printf(\"%d\",i);break;}\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void){\nint k,i,count=0;\nscanf(\"%d\",&k);\nfor(i=19;i<=999999999;i++){\nint a=i,s=0;\nwhile(a!=0){\ns=s+a%10;\na=a/10;\n}\nif(s==10)count++;\nif(count==k){printf(\"%d\",i);break;}\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[10000];\n\n\nint check(int x){\n\tint q=x,s=0;\n\twhile(q!=0){\n\t\tq=q/10;\n\t\ts+=(x%10);\n\t\tx=q;\n\t}\n\tif(s==10)\n\t\treturn s;\n\telse\n\t\treturn 0;\n}\n\nvoid make(){\n\tint c = 0,i;\n\t\n\tfor(i=1;c<=10000;i=i+1){\n\n\t\tif(check(i)){\n\t\t\tc++;\n\t\t\ta[c] = i;\n\t\t}\n\t}\n\n}\n\nint main(){\n\t\n\tint n;\n\n\tscanf(\"%d\",&n);\n\n\tmake();\n\tprintf(\"%d\\n\",a[n]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[10000];\n\n\nint check(int x){\n\tint q=x,s=0;\n\twhile(q!=0){\n\t\tq=q/10;\n\t\ts+=(x%10);\n\t\tx=q;\n\t}\n\tif(s==10)\n\t\treturn s;\n\telse\n\t\treturn 0;\n}\n\nvoid make(){\n\tint c = 0,i;\n\t\n\tfor(i=1;c<=10000;i=i+1){\n\n\t\tif(check(i)){\n\t\t\tc++;\n\t\t\ta[c] = i;\n\t\t}\n\t}\n\n}\n\nint main(){\n\t\n\tint n;\n\n\tscanf(\"%d\",&n);\n\n\tmake();\n\tprintf(\"%d\\n\",a[n]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, kol = 1, te;\n long int n = 19, test;\n scanf(\"%d\", &m);\n while (m != kol)\n {\n n += 9;\n te = 0;\n test = n;\n while (test != 0) {\n te += test%10;\n test /= 10;\n }\n if (te != 10) te = 0;\n else {\n kol++;\n // printf(\"\\n%ld\", n);\n }\n }\n printf(\"%ld\", n);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,p,j;\n scanf(\"%d\",&n);\n j=10;\n while(n)\n {\n j=j+9;\n p=sum(j);\n if(p==10)\n n--;\n }\n printf(\"%d\",j);\n return 0;\n}\n\nint sum(int n)\n{\nint s=0;\nwhile(n)\n{\ns=s+(n%10);\nn=n/10;\n}\nreturn(s);\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n short int n;\n scanf(\"%i\",&n);\n unsigned int sum=0;\n if(n)\n {\n sum=sum+(n*9)+10;\n printf(\"%u\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n int i,k,s=19;\n scanf(\"%d\",&k);\n if (k==1) printf(\"%d\",s);\n else{\n for (i=1;i<k;i++)\n s+=9;\n printf(\"%d\",s);\n }\n\n return(0);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\nint main(void){\n // Your code here!\n int test,n,c,o,d,e,r,i,fflag=0,bflag=0,index,sum,m,z,a[1000];\n \n \n scanf(\"%d\",&n);\n sum=19;\n i=1;\n while(i<=n){\n // printf(\"%d %d\\n\",i,sum);\n sum+=9;\n i++;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,x;\n scanf(\"%d\",&a);\n if(a<10)\n {\n b=10-a;\n c=a*10+b;\n printf(\"%d\",c);\n }\n else\n {\n b=a/10;\n x=10-b;\n c=a*10+x;\n printf(\"%d\",c);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long int a,i,j=0,k,b=0,c=0,d=1,p=0;\n\n scanf(\"%lld\",&a);\n if(a==101) printf(\"1432\\n\");\n return 0;\n a*=10;\n while(1)\n {\n b=0,c=0,p=1;\n k=a;\n while(k!=0)\n {\n b=k%10;\n if(b==0) p=0;\n c+=b;\n k=k/10;\n }\n if(p==1){\n if(c==10)\n {\n printf(\"%lld\\n\",a);\n return 0;\n }}\n a++;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint counter = 0, sum;\n\nvoid solve(int n) {\n sum = 0;\n while (n > 0) {\n sum += (n % 10);\n n /= 10;\n }\n if (sum == 10) counter++;\n}\n\nint main() {\n int i, num; \n scanf(\"%d\", &num);\n for (i = 1; i <= 10000; i++) {\n if (counter != num) solve(i);\n else printf(\"%d\\n\", i - 1), exit(0);\n }\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n int n,k=1,i,a[10001];\n for(i=1;;i++)\n {\n if(i%10+i/10%10+i/100%10+i/1000%10+i/10000%10==10)\n a[k++]=i;\n if(k==10000)\n break;\n }\n scanf(\"%d\",&n);\n printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[10001];\n\nvoid make(){\n\tint c = 0,i;\n\t\n\tfor(i=19;c<=10000;i=i+9){\n\t\tc++;\n\t\ta[c] = i;\n\t}\n\n}\n\nint main(){\n\t\n\tint n;\n\n\tscanf(\"%d\",&n);\n\n\tmake();\n\tprintf(\"%d\\n\",a[n]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long k;\nscanf(\"%I64d\",&k);\nlong long a;\nint s=0;\nint r;\nlong long nb;\na=k;\nif(k<10)\n {nb=k*10+(10-k);\n printf(\"%I64d\",nb);}\nelse\n {while((a/10)!=0)\n {r=a%10;\n a=a/10;\n s+=r;}\n if(s<10)\n nb=k*10;\n nb+=10-s;\n printf(\"%I64d\",nb);}\nreturn(0);\n}"}, {"source_code": "#include <stdio.h>\n\n#define BASE \"%ld\"\ntypedef long int Base;\n\n#define PERFECT_DIGIT_SUM 10\n\nBase GetDigitSum(Base Number)\n{\n Base Sum = Number % 10;\n \n while (Number /= 10)\n {\n Sum += Number % 10;\n }\n \n return Sum;\n}\n\nint main()\n{\n Base Number = 0;\n Base DigitSum = 0;\n \n scanf(BASE, &Number);\n DigitSum = GetDigitSum(Number);\n \n if (DigitSum != PERFECT_DIGIT_SUM)\n {\n Number *= 10;\n Number += PERFECT_DIGIT_SUM - GetDigitSum(Number);\n }\n \n printf(BASE\"\\n\", Number);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,sum=0;\n scanf(\"%d\",&n);\n int c=n;\n while(c>0)\n {\n sum +=c%10;\n c=c/10;\n }\n if(sum<10)\n {\n printf(\"%d\",(n*10)+(10-sum));\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint shuzu[10000];\nint main(){\n int i,p,sum,a;\n int j=0;\n for(i=10;i<10000;i++){\n p=i;\n sum=0;\n while(p){\n sum+=p%10;\n p/=10;\n }\n if(sum==10){\n shuzu[j]=i;\n j++;\n }\n }\n scanf(\"%d\",&a);\n printf(\"%d\",shuzu[a-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint add(int num){\n int sum = 0;\nwhile(num){\n sum += num%10;\n num=num/10;\n}\n return sum;\n}\nint main()\n{ int n;\n //printf(\"enter n\\n\");\n scanf(\"%d\",&n);\n int sum=0;\n while(n){\n sum++;\n if(add(sum)==10)\n n--;\n }\n printf(\"perfect no.=%d\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint arr[10001];\n\nvoid gene()\n{\n int ind = 1, i;\n for(i = 19; i <= 10000; i+=9)\n {\n arr[ind++] = i;\n }\n}\n\nint main()\n{\n memset(arr, 0, sizeof(arr));\n gene();\n int k;\n scanf(\"%d\", &k);\n printf(\"%d\\n\", arr[k]);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint getSum(int n)\n{\n int sum = 0;\n while (n != 0)\n {\n sum = sum + n % 10;\n n = n/10;\n }\n return sum;\n}\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n\n c=getSum(n);\n if(c<10)\n printf(\"%d%d\",n,10-c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid saisie (int*k){\n\tdo{\n\t\tscanf (\"%d\",k);\n\t}while (*k<1 || *k>10000);\n}\n\nint somme_kieme (long i){\n\tint s = 0;\n\tdo{\n\t\ts+= i % 10;\n\t\ti = i/10;\n\t}while (i!=0);\n\treturn s;\n}\n\nint main()\n{\n\tint k ;\n\tsaisie (&k);\n\tlong i = 18;\n\tint c = 0;\n\tdo{\n\t\ti++;\n\t\tif (somme_kieme (i) == 10)\n\t\t\tc++;\n\t}while (c!=k);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned short int n;\n scanf(\"%hu\",&n);\n if(n>=1 && n<=10000)\n printf(\"%hu\\n\",(n*9)+10);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n int n,k=1,i,a[10001];\n for(i=1;i<=10000;i++)\n {\n if(i%10+i/10%10+i/100%10+i/1000%10+i/10000%10==10)\n a[k++]=i;\n }\n scanf(\"%d\",&n);\n printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint arr[10001];\n\nint main()\n{\n memset(arr, 0, sizeof(arr));\n int k;\n int i, ind = 1;\n for(i = 19; i <= 1000; i+=9)\n {\n arr[ind++] = i;\n }\n scanf(\"%d\", &k);\n int p = arr[k], ans;\n //printf(\"%d\\n\", p);\n while(1)\n {\n int sum = 0, mod;\n\n while(p != 0)\n {\n mod = p % 10;\n sum+=mod;\n p/=10;\n }\n if(sum == 10)\n {\n ans = arr[k];\n break;\n }\n else\n p = arr[k+1];\n }\n printf(\"%d\\n\",ans);\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint sum_digs(int k)\n{\n\tint s = 0;\n\t\n\twhile (k != 0)\n\t{\n\t\ts = s + k % 10;\n\t\tk /= 10;\n\t}\n\t\n\treturn s;\n}\n\nint perfect_num(int k)\n{\n\tint i = 19;\n\tint n = 1;\n\t\n\twhile ((n < k) || (sum_digs(i) != 10))\n\t{\n\t\ti += 9;\n\t\tn++;\n\t}\n\t\n\treturn i;\n}\n\nint main()\n{\n\tint k;\n\t\n\tscanf(\"%d\", &k);\n\tprintf(\"%d\", perfect_num(k));\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nmain()\n{\n int n;\n int sum=0;\n long int num=0;\n long int temp;\n int count=0;\n scanf(\"%d\",&n);\n while(num<10000000)\n { temp=num;\n while(num>0)\n {\n sum=sum+num%10;\n num=num/10;\n }\n if(sum==10)\n count++;\n if(count==n)\n break;\n num=temp+1;\n sum=0;\n }\n printf(\"%d\",temp);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long int a,i,j=0,k,b=0,c=0,d=1;\n\n scanf(\"%lld\",&a);\n k=a;\n while(k!=0)\n {\n b=k%10;\n c+=b;\n k=k/10;\n }\n if(c==10)\n {\n printf(\"%lld\\n\",a);\n return 0;\n }\n \n a*=10;\n while(1)\n {\n b=0,c=0;\n k=a;\n while(k!=0)\n {\n b=k%10;\n c+=b;\n k=k/10;\n }\n if(c==10)\n {\n printf(\"%lld\\n\",a);\n return 0;\n }\n a++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[10];\nint main()\n{\n int n,i,j,sum=0,m;\n scanf(\"%d\",&n);\n for(i=1; i<2000000; i++)\n {\n m=i;\n while(m>0)\n {\n sum=sum+(m%10);\n m=m/10;\n }\n // printf(\"%d\\n\",i);\n if(sum==10)\n {\n n--;\n if(n==0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n else\n sum=0;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n int n=19;\n int i=1;\n while(i!=k)\n {\n n+=9;\n i++;\n if(n%10==1)\n n+=9;\n\n }\n printf(\"%d\",n);\n return (0);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,l,a,p,c=0,n;\n printf(\"enter the position:\");\n scanf(\"%d\",&n);\n c=0;\n for(i=1;c<=n;i++)\n {\n p=i;\n a=0;\n\n while(p)\n {\n l=p%10;\n a+=l;\n p=p/10;\n\n }\n if(a==9) c++;\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n\tint k,i;\n\tscanf(\"%d\",&k);\n\tint s=10;\n\tfor(i=0;i<k;i++)\n\t{\n\t\ts=s+9;\n\t}\n\tprintf(\"%d\",s);\n\n\n\treturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n int k, i, j, sum = 0;\n int result = 19, temp;\n char digit[100] = {0};\n scanf(\"Please enter a value: %d \\n\", &k);\n \n\t\n\t\n while (k)\n {\n\t\ttemp = result;\n int y=0;\n do\n {\n digit[y] = temp%10;\n temp /= 10;\n y++;\n }while(temp);\n \n for (j=0; j<y; j++)\n {\n sum += digit[y];\n };\n \n \n \n if (sum == 10)\n {\n k--;\n }\n\t\t\n\t\tsum = 0;\n\t\t\n\t\tif (k==0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n result++;\n }\n \n printf(\"%d\", result);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k;\n\tscanf(\"%d\", &k);\n\tint m;\n\tm = k / 10;\n\tint x=0,n;\n\tn = m;\n\tif (m == 0)\n\t\tx = 1;\n\twhile (n > 0)\n\t{\n\t\tx++;\n\t\tn = n / 10;\n\t}\n\tprintf(\"%d\", (9 * (k + m + x)) + 1);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint niilber(int a)\n{\n\tint p,sum=0;\nwhile(a>0)\n{sum=sum+a%10;\na=a/10;\n\n}\nreturn sum;\n}\n\n\n\nint main()\n{\n\tint k,n=1,i;\n\tscanf(\"%d\",&k);\n\twhile(i<=k)\n\t{n++;\n\tif(niilber(n)==10)\n\ti++;\n\t}\n\tprintf(\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, kol = 1;\n long int n = 19;\n scanf(\"%d\", &m);\n while (m != kol)\n {\n n += 9;\n kol++;\n if (kol % 10 == 0) n +=9;\n }\n printf(\"%ld\", n);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,k;\n scanf(\"%d\",&k);\n r=10-k;\n printf(\"%d%d\",k,r);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\nint sum(int j){\n int k,sum=0;\n while(j >0){\n k=j%10;\n j=j/10;\n sum+=k;\n }\n return sum;\n}\nint main(){\n int n,m=1,i=19;\n scanf(\"%d\",&n);\n while(n!=m){\n i+=9;\n if(sum(i)!=10){\n i+=9;\n }m+=1;\n \n }\n printf(\"%d\",i); \n }\n\n"}, {"source_code": "#include <stdio.h>\n\nint d_sum(long long int n)\n{\n int sum=0;\n while(n){sum+=n%10; n/=10;}\n return sum;\n}\nint main()\n{\n long long int i=19, n=10000, k=0;\n while(1)\n {\n if(d_sum(i)==10){k++;}\n if(k==n){printf(\"%lld\\n\",i);break;}\n i++;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j,num,sum=0,c=0;\n scanf(\"%d\",&i);\n for(j=1;j<10000;j++)\n { num=j;\n while(num!=0)\n {\n sum=sum+(num%10);\n num=num/10;\n }\n if(sum==10)\n {\n\n\n c++;\n if(c==i)\n {\n printf(\"%d\",j);\n break;\n }\n\n }\n sum=0;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int k,temp,num,sum=0;\n scanf(\"%d\",&k);\n temp=k;\n do{\n sum+=(k%10);\n k/=10;\n }while(k!=0);\n \n sum=10-sum;\n k=temp;\n\n num=sum+10*k;\n printf(\"%d\",num);\n\n return 0;\n}\n\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n int i,j,l,m,n,digit,c=0,sum=0;\n scanf(\"%d\",&n);\n for(i=2; i<=10000; i++)\n {\n sum=0;\n m=i;\n while (m > 0) {\n digit = m % 10;\n sum = sum + digit;\n m /= 10;\n }\n if(sum==10)\n {\n c++;\n if(c==n){\n printf(\"%d\\n\",i);\n return 0;\n }}\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main (void)\n{\n\tlong long int k , m=0;\n\tscanf(\"%lld\",&k);\n\tif(k>10)\n\t{\n\t\twhile(k>=10)\n\t {\n\t \tk/=10;\n\t\t\t\n\t }\n }\n\tm=k;\n for(int i=1 ; i<=9 ; i++){\n \tif(i+m==10)\n \t{\n \t switch(m)\n \t {\n \t \tcase 1:\n\t\t\t {\n\t\t\t \tprintf(\"19\");\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\tcase 2:\n\t\t\t \t{\n\t\t\t \t\tprintf(\"28\");\n\t\t\t \t\tbreak;\n\t\t\t\t}\n\t\t \tcase 3:\n\t\t\t {\n\t\t\t \tprintf(\"37\");\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\tcase 4:\n\t\t\t{\n\t\t\t\tprintf(\"46\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t case 5:\n\t\t\t{\n\t\t\t\tprintf(\"55\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 6:\n\t\t\t{\n\t\t\t\tprintf(\"64\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 7:\n\t\t\t{\n\t\t\t\tprintf(\"73\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 8:\n\t\t\t{\n\t\t\t\tprintf(\"82\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase 9:\n\t\t\t{\n\t\t\t\tprintf(\"91\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t }\n\t\t}\n\t}\n}"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n int k, i, sum = 0;\n int result = 19;\n char digit[100] = {0};\n scanf(\"Please enter a value: %d /n\", &k);\n \n while (k)\n {\n int y=0;\n do\n {\n digit[y] = result%10;\n result /= 10;\n y++;\n }while(result != 0);\n \n for (; y>0; y--)\n {\n sum += digit[y];\n };\n \n \n \n if (sum = 10)\n {\n k--;\n }\n else\n {\n \n }\n result++;\n }\n \n printf(\"%d\", result);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,i,z,count=0,a,sum;\n scanf(\"%d\",&m);\n for (i=19;i<100;i++)\n {\n sum=0;\n a=i;\n while(a!=0)\n {\n sum = sum + a%10;\n a= a/10;\n }\n\n if(sum==10)\n {\n count++;\n if(count==m)\n\n {\n printf(\"%d\",i);\n return 0;\n }\n\n }\n }\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k;\n for(int j = 1; j < 35; ++j) {\n //scanf(\"%d\", &k);\n int cur = 9, cnt = 1;\n k = j;\n while(1) {\n if(k > cur) {\n k -= cur;\n } else {\n int prefix = (k + cnt - 1) / cnt;\n int mod = (k - 1) % cnt;\n printf(\"%d\", prefix);\n for(int i = 0; i < (cnt - 1) - mod; ++i) {\n printf(\"0\");\n }\n printf(\"%d\", 10 - prefix);\n for(int i = 0; i < mod; ++i) {\n printf(\"0\");\n }\n printf(\"\\n\");\n break;\n }\n cur += 9;\n ++cnt;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned int n;\n scanf(\"%u\",&n);\n if(n==0)\n printf(\"0\");\n else\n printf(\"%u\\n\",(n*9)+10);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n int i,j,l,m,n,digit,c=0,sum=0;\n scanf(\"%d\",&n);\n for(i=2; i<=10000; i++)\n {\n sum=0;\n m=i;\n while (m > 0) {\n digit = m % 10;\n sum = sum + digit;\n m /= 10;\n }\n if(sum==10)\n {\n c++;\n if(c==n){\n printf(\"%d\\n\",i);\n return 0;\n }}\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nvoid main(){\nint n,i,z,count=0,sum,k;\nscanf(\"%d\",&n);\ni=z=19;\nwhile(count<n){\nsum=0;\nwhile(i!=0){\nk=i%10;\nsum=sum+k;\ni=i/10;}\ni=z+9;z=z+9;;\nif(sum==10)\ncount++;\n}\nprintf(\"%d\\n\",i-1);\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k;\n scanf(\"%d\",&k);\n int n=19;\n int i;\n for (i=1;i<k;i++)\n n+=9;\n printf(\"%d\",n);\n\nreturn (0);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif(n<10)\n\t{\n\t\tprintf(\"%d\\n\", 9*n + 10);\n\t}\n\telse if(n==10)\n\t{\n\t\tprintf(\"91\\n\");\n\t}\n\telse\n\t{\n\t\tn=100 + 9*(n-9);\n\t\tprintf(\"%d\\n\", n);\n\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",(19*n));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\nint k,i=0,t=6,p;\nscanf(\"%d\",&k);\nwhile(i<2*k)\n{\nt=t+i;\ni=i+2;\n}\np=(k+4)*(k+4)-t;\nprintf(\"%dth perfect number is = %d\",k,p);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint a,b,c,d,e,n,w[10009],t=0;\n\tscanf(\"%d\",&n);\n\tfor(a=0;a<=9;a++)\n\tfor(b=0;b<=9;b++)\n\tfor(c=0;c<=9;c++)\n\tfor(d=0;d<=9;d++)\n\tfor(e=0;e<=9;e++)\n\t{\n\t\tif(a+b+c+d+e==10){\n\t\t\tt++;\n\t\t\tw[t]=e+d*10+c*100+b*1000+a*10000;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",w[n]);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int n;\n int a,sum=0,b,c,num1,num2,temp,i=0,x;\n scanf (\"%d\",&n);\n\n temp=n;\n while (n!=0)\n {\n a=n%10;\n n=n/10;\n sum+=a;\n i++;\n }\n b=sum%10;\n c=10-b;\n\n num1=temp*10+c;\n x=pow(10,i);\n num2=c*x+temp;\n\n if (num1<num2)\n printf (\"%d\\n\",num1);\n else\n printf (\"%d\\n\",num2);\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int t,n,y,h,u,j,i,l;\n scanf(\"%d\",&t);\n u=0;\n for(i=19;i<1000000;i+=9)\n {\n l=i;\n j=0;\n while(l!=0)\n {\n j+=(l%10);\n l=l/10;\n }\n if(j==10)\n u++;\n if(u==t)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint per(int n)\n{\n int i=19,s=0;\n s=i+9*(n-1);\n printf(\"%d\",s);\n}\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n per(n);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint niilber(int a)\n{\n\tint p,sum=0;\nwhile(a>0)\n{sum=sum+a%10;\na=a/10;\n\n}\nreturn sum;\n}\nint main()\n{\n\tint k,n=1,i;\n\tscanf(\"%d\",&k);\n\twhile(i<=k)\n\t{\t\n\t\tn++;\n\t\tif(niilber(n)==10)\n\t\t\ti++;\n\t}\n\tprintf(\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\nint sm(int n)\n{\n int sum = 0;\n while(n) {sum += n % 10; n /= 10;}\n return sum;\n}\nint main() \n{\n int n;\n scanf(\"%d\", &n);\n while(sm(n) != 10) n++;\n printf(\"%d\", n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint sum_digit(int n)\n{\n int sum=0,rem;\n while(n>0)\n {\n rem=n%10;\n sum+=rem;\n n/=10;\n }\n return sum;\n}\nint main()\n{\n int i,a,ar[10000],j=0,k;\n for(i=1;i<=1000000;i++)\n {\n a=sum_digit(i);\n if(a==10)\n ar[j++]=i;\n }\n scanf(\"%d\",&k);\n printf(\"%d\\n\",ar[k-1]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n int x;\n int sum=0;\n int num;\n int rem;\n scanf(\"%d\",&n);\n num=n;\n\n while(n!=0)\n {\n x=n%10;\n sum+=x;\n n=n/10;\n }\n if(sum==10)\n {\n printf(\"%d\",num);\n }\n else\n {\n rem = 10-sum;\n num = (num*10)+rem;\n printf(\"%d\",num);\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,p,q,s=11;;\n scanf(\"%d\",&n);\n while(s>10)\n {\n p=n;\n s=0;\n while(p!=0)\n {\n q=p%10;\n s=s+q;\n p=p/10;\n }\n if(s<=10)\n break;\n else\n n=n+1;\n }\n printf(\"%d%d\",n,10-s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,sum=0,r,t,pr,p;scanf(\"%d\",&k);\n\tp=k;\n\twhile(p!=0)\n\t{\n\t\t r=p%10;\n\t\tsum=sum+r;\n\t\tp=p/10;\n\t\tprintf(\"%d\",sum);\n\t}\n\tif(sum<10)\n\t{\n\t\tt=10-sum;\n\t\t pr=k*10+t;\n\t}\n\t\n\t\n\tprintf(\"%d\",pr);\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\nint main(void){\n // Your code here!\n int test,n,c,o,d,e,r,i,fflag=0,bflag=0,index,sum,m,z,a[1000];\n \n \n scanf(\"%d\",&n);\n sum=10;\n i=0;\n while(i<n){\n // printf(\"%d %d\\n\",i,sum);\n sum+=9;\n i++;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid sumnumber(unsigned int b, unsigned int * sum){\n*sum=b%10;\nb=(unsigned int)(b/10);\nwhile(b)\n{\n*sum+=b%10;\nb=(unsigned int)(b/10);\n}\n\n\n}\nvoid surpassten(unsigned int b,unsigned int * ten){\nunsigned int a,i=1;\n*ten=0;\nfor(i;i<=b;i++){\nsumnumber(i,&a);\nif(a>10)\n*ten=*ten+1;\n} \n\n}\n\nint main(){\nunsigned int a,n,t,h,k;\n\nscanf(\"%d\",&a);\n\nsurpassten(a,&t);\n//printf(\"%d\\r\\n\",t);\nh=a;\nh+=t;\n\nsumnumber(h,&n);\nwhile(n>10){\nsurpassten(h,&t);\n//printf(\"%d\\r\\n\",t);\nh=a+t;\nsurpassten(h,&k);\nif(k>t)\nh=a+k;\nsumnumber(h,&n);\n\n}\nprintf(\"%d\",h*10+10-n);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint arr[10001];\n\nvoid gene()\n{\n int ind = 1, i;\n for(i = 19; i <= 10000; i+=9)\n {\n arr[ind++] = i;\n }\n}\n\nint main()\n{\n memset(arr, 0, sizeof(arr));\n gene();\n int k;\n scanf(\"%d\", &k);\n printf(\"%d\\n\", arr[k]);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a=1,b=9;\n \n printf(\"%d%d\",a,b);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long k ;\n scanf(\"%ld\",&k ) ;\n\n\n long long sa=18 ;\n long long s ;\n long i = 0 ;\n int sm ;\n while (1)\n {\n sa=sa+1 ;\n s=sa;\n sm=0 ;\n while (1)\n {\n if (s%10==0)\n break ;\n else\n {\n sm=sm+s%10 ;\n s=s/10;\n }\n }\n if (sm==10)\n {\n i++ ;\n if (i==k)\n break ;\n\n }\n }\n printf(\"%lld\",sa) ;\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,i,j,d=0,k=0,s=0,e=0,b=0;\n long long int ara[100000];\n scanf(\"%I64d\",&a);\n for(i=0;i<100000;i++)\n {\n s=0;\n d=19+(9*i);\n e=d;\n for(j=0;j<100000 ;j++)\n {\n b=d%10;\n d=d/10;\n\n s=s+b;\n if(d==0)\n {\n break;\n }\n }\n if(s==10)\n {\n ara[k]=e;\n k++;\n if(k==a)\n {\n break;\n }\n\n }\n }\n printf(\"%I64d\",ara[a-1]);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned int n;\n scanf(\"%u\",&n);\n if(n==0)\n printf(\"0\");\n else\n printf(\"%u\\n\",(n*9)+10);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint niilber(int a)\n{\n\tint p,sum=0;\nwhile(a>0)\n{sum=sum+a%10;\na=a/10;\n\n}\nreturn sum;\n}\nint main()\n{\n\tint k,n=1,i;\n\tscanf(\"%d\",&k);\n\twhile(i<=k)\n\t{\t\n\t\tn++;\n\t\tif(niilber(n)==10)\n\t\t\ti++;\n\t}\n\tprintf(\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a[100]; \n\nint main()\n{\n\tlong long i;\n\tint n, t=1;\n\tscanf(\"%d\", &n);\n\tfor(i=19;i<1000000000;i+=9)\n\t{\n\t\tn--;\n\t\tif(n==0)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i);\n\t\t}\n\t\tif(t==9)\n\t\t{\n\t\t\ti+=9;\n\t\t\tt=0;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tt++;\n\t} \n\t\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nvoid Algo();\n\nint sum = 0, num;\nchar buff[8];\n\nchar * toArray(int number) {\n\tint n = log10(number) + 1; int i;\n\tchar *numberArray = calloc(n, sizeof(char));\n\tfor (i = 0; i < n; ++i, number /= 10) {\n\t\tnumberArray[i] = '0' + number % 10;\n\t}\n\treturn numberArray;\n}\n\nint cCount() {\n\tchar* str = toArray(sum); int r = 0;\n\tfor (int i = 0; str[i] != '\\0'; i++) {\n\t\tr += str[i] - '0';\n\t}\n\treturn r;\n}\n\nvoid Input() {\n\tfgets(buff, 6, stdin);\n\tnum = atoi(buff);\n\tchar c;\n\tint i = 0;\n\tfor (; buff[i] != '\\0' && buff[i] != '\\n'; i++) {\n\t\tc = buff[i];\n\t\tsum += c-'0';\n\t}\n}\n\nint main() {\n\tInput();\n\tAlgo();\n}\n\n\nvoid Algo() {\n\tint k = num, count;\n\tint answer;\n\tfor (int i = 0; i < k;) {\n\t\tcount = cCount();\n\t\tif (count == 10) {\n\t\t\tanswer = sum;\n\t\t\ti++;\n\t\t}\n\t\tsum++;\n\t}\n\tprintf(\"%d\", answer);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#define maxn 2100\nint max(int a,int b){\n return a>b?a:b;\n}\n\nchar a[maxn][maxn];\nint m,n,k;\nint main()\n{\n int i,j;\n int ans = 0;\n char buf;\n int cnt = 1;\n scanf(\"%d%d%d\",&n,&m,&k);\n getchar();\n for(i = 0;i < n;i++){\n for(j = 0;j <m;j++){\n scanf(\"%c\",&a[i][j]);\n if(buf == '*')\n cnt = 0;\n if(a[i][j] == buf)\n cnt++;\n else{\n ans += max(0,cnt+1-k);\n cnt = 1;\n }\n buf = a[i][j];\n }\n getchar();\n }\n ans += max(0,cnt+1-k);\n for(i = 0;i < n;i++)\n for(j = 0;j <m;j++){\n if(buf == '*')\n cnt = 0;\n if(a[j][i] == buf)\n cnt++;\n else\n cnt = 1,ans += max(0,1+cnt-k);;\n buf = a[j][i];\n }\n ans += max(0,cnt-k+1);\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,c=0,j;\n long long s,b;\n scanf(\"%d\",&k);\n for(j=0;j<9999999;j++){\n s=0;\n b=j;\n while(b!=0){\n s=s+b%10;\n b=b/10;\n }\n if(s==10){\n c++;\n if(c==k){printf(\"%d\",j);break;}}\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n\tint k,i;\n\tscanf(\"%d\",&k);\n\tint s=10,j,count=0,x,p;\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif(i==10)\n\t\t{\n\t\t\ts=s+18;\n\t\t\tcontinue;\n\t\t}\n\t\tif(i%10==0)\n\t\t{\n\t\t\tp=i/10;\n\t\t\tx=0;\n\t\t\tfor(j=0;j<1000;j++)\n\t\t\t{\n\t\t\t\tif(p%10==1)\n\t\t\t\t{\n\t\t\t\t\tp=p/10;\n\t\t\t\t\tif(p==1)\n\t\t\t\t\t{\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tif(count==9||count==19||count==29)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ts=s+18;\n\t\t\t\t\t\tx=1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(x==1)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\ts=s+9;\n\t}\n\tprintf(\"%d\",s);\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main()\n{\n int k,i,p,q,s,r,t,h ;\n scanf (\"%d\",&k) ;\n i=k*10 ;\n s=0 ;\n for (int j=i;j<(i+10);j++)\n {\n p=(j%10000)/1000 ;\n q=j/10000 ;\n r=(j%1000)/100 ;\n h=j%10 ;\n t=(j%100)/10 ;\n if ((p+q+h+r+t)==10)\n {\n s=j ;\n }\n }\n printf (\"%d\",s) ;\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,sum,p;scanf(\"%d\",&k);\n\tp=10-k;\n\tsum=k*10+p;\n\tprintf(\"%d\",sum);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,x;\n scanf(\"%d\",&a);\n if(a<10)\n {\n b=10-a;\n c=a*10+b;\n printf(\"%d\",c);\n }\n else\n {\n b=a/10;\n x=10-b;\n c=a*10+x;\n printf(\"%d\",c);\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t/* code */\n\n\tlong long int i,n,j,c,count=0,sum,d;\n\tscanf (\"%lld\",&n);\n\n\tfor(i=1;count<n;i++)\n\t{\n\t j=(9*i)+1;\n\t c=j;\n\t sum=0;\n\t while (j>0)\n\t {\n\t\td=j%10;\n\t\tj=j/10;\n\t\tsum+=d;\n\t }\n\n\t if(sum!=1)\n\t {\n\t\tcount++;\n\t }\n\t}\n\n\tprintf(\"%lld\\n\",c);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <tgmath.h>\n\ntypedef unsigned int uint;\n\nuint lg10(const uint v) {\n\treturn (v >= 1000000000u) ? 9 : (v >= 100000000u) ? 8 :\n\t(v >= 10000000u) ? 7 : (v >= 1000000u) ? 6 :\n\t(v >= 100000u) ? 5 : (v >= 10000u) ? 4 :\n\t(v >= 1000u) ? 3 : (v >= 100u) ? 2 : (v >= 10u) ? 1u : 0u;\n}\n\nuint normalize(const uint v){\n\treturn v + (lg10(v) - 1) * 9;\n}\n\nuint perfect(const uint n){\n\treturn 10 + 9*(n);\n}\n\nuint p(const uint x){\n\treturn normalize(perfect(x));\n}\n\nint main(){\n\tuint k; scanf(\"%u\",&k);\n\tprintf(\"%u\",p(k));\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\n\n\n\n\n\n\n\nint main()\n{\n\nint k;\nscanf(\"%d\",&k);\n\nint r = 19;\nint i;\n\n\nfor(i = 1;i<=k;i++)\n{ if(i==10)\n\tr =109;\n\telse\n\tr +=9;\n}\n\nprintf(\"%d\",r);\n\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tn=19<<n;\n\tprintf(\"%d\",n);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[100009];\nint sumofdigit(int n)\n{\n int sum=0,mod;\n while(n)\n {\n mod=n%10;\n n/=10;\n sum=sum+ mod;\n }\n return sum;\n}\nint main()\n{\n int k,i,sum,count=1;\n scanf(\"%d\",&k);\n for(i=1; i<=100000; i++)\n {\n sum = sumofdigit(i);\n if(sum==10)\n {\n a[count]=i;\n count++;\n }\n }\n printf(\"%d\",a[k]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint counter = 0, sum;\n\nvoid solve(int n) {\n sum = 0;\n while (n > 0) {\n sum += (n % 10);\n n /= 10;\n }\n if (sum == 10) counter++;\n}\n\nint main() {\n int i, num; \n scanf(\"%d\", &num);\n for (i = 1; i <= 10000; i++) {\n if (counter != num) solve(i);\n else printf(\"%d\\n\", i - 1), exit(0);\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t int n,l;\n\t scanf(\"%d\",&n);\n l=n/10;\n\t // printf(\"%d\",l);\n\t int a=19;\n for(int i=1;i<n+l;i++)\n {\n \t a=a+9;\n\t}\n\tprintf(\"%d\",a);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid main() {\n int k,i,c=0,v,s,r;\n scanf(\"%d\",&k);\n for(i=0;i<100000;i++)\n { v=i;s=0;\n while(v!=0)\n { r=v%10;\n s=s+r;\n v=v/10;\n }\n if(s==10) c++;\n if(c==k) {\n printf(\"%d\",i);\n exit(0);\n }\n \n \n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,c=0;\n long long s,j,b;\n scanf(\"%d\",&k);\n for(j=0;j<9000000;j++){\n s=0;\n b=j;\n while(b!=0){\n s=s+b%10;\n b=b/10;\n }\n if(s==10){\n c++;\n if(c==k){printf(\"%d\",j);break;}}\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint d_sum(long long int n)\n{\n int sum=0;\n while(n){sum+=n%10; n/=10;}\n return sum;\n}\nint main()\n{\n long long int i=19, n=10000, k=0;\n while(1)\n {\n if(d_sum(i)==10){k++;}\n if(k==n){printf(\"%lld\\n\",i);break;}\n i++;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,i,k,s=0;\n\tint arr[9],j=9;\n\tfor(i=1;i<=9;i++)\n\t{\n\tarr[i]=j;\n\tj--;\t\n\t}\n\tscanf(\"%d\",&n);\n\ta=n;\n\twhile(n>0)\n\t{\n\t\ts+=n%10;\n\t\tn/=10;\n\t}\n\tprintf(\"%d%d\",a,arr[s]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[100],flag,len,k,temp,i,j;\n scanf(\"%d\",&k);\n if(k==1)\n printf(\"19\\n\");\n else\n {\n len=2;\n a[0]=1;\n a[1]=9;\n for(i=2;i<=k;i++)\n {\n flag=0;\n temp=-1;\n for(j=len-1;j>=0;j--)\n {\n if(a[j]<9&&temp!=-1)\n {\n a[j]=a[j]+1;\n a[temp]=a[temp]-1;\n break;\n }\n else\n {\n if(j==0)\n {\n flag=1;\n len=len+1;\n break;\n }\n if(a[j]>0)\n temp=j;\n }\n }\n if(flag==1)\n {\n a[0]=1;\n a[len-1]=9;\n for(j=1;j<len-1;j++)\n {\n a[j]=0;\n }\n }\n }\n for(i=0;i<len;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n short int n;\n scanf(\"%i\",&n);\n if(n)\n printf(\"%i\\n\",(n*9)+10);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,c=0;\n long long s,j,b;\n scanf(\"%d\",&k);\n for(j=0;j<9000000;j++){\n s=0;\n b=j;\n while(b!=0){\n s=s+b%10;\n b=b/10;\n }\n if(s==10){\n c++;\n if(c==k){printf(\"%d\",j);break;}}\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint findPerfectInteger(int degree)\n{\n int flag = 0;\n\tif(degree >= 10) {\n\t \n\t\n\t \n\t \n flag += degree/10; ;\n\n\t}\n\tdegree += flag;\n\n\treturn (degree-1)*9 + 19 ;\n}\n\nint main(void) {\n\tint k = 0;\n\nscanf(\"%d\",&k);\n\n\tprintf(\"%d\", findPerfectInteger(k));\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int k,temp,num;\n\n scanf(\"%d\",&k);\n temp=10-k;\n num=temp+10*k;\n printf(\"%d\",num);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,sum=0;\n scanf(\"%d\",&n);\n k=n;\n while(k)\n {\n sum+=k%10;\n k/=10;\n }\n printf(\"%d%d\",n,10-sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint somme_kieme (long i){\n\tint s = 0;\n\tdo{\n\t\ts+= i % 10;\n\t\ti = i/10;\n\t}while (i!=0);\n\treturn s;\n}\n\nint main()\n{\n\tint k ;\n\tscanf (\"%d\",&k);\n\tlong i = 18;\n\tint c = 0;\n\tdo{\n\t\ti++;\n\t\tif (somme_kieme (i) == 10)\n\t\t\tc++;\n\t}while (c!=k);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint n,i,c;\nint f(int n){\n\tif(n==0)return 0;\n\treturn n%10+f(n/10);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=10000;i++){\n\t\tif(f(i)==10)c++;\n\t\tif(c==n){\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n>=1 && n<=10000)\n printf(\"%d\\n\",(n*9)+10);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[10];\nint main()\n{\n int n,i,j,sum=0,m;\n scanf(\"%d\",&n);\n for(i=1; i<2000000; i++)\n {\n m=i;\n while(m>0)\n {\n sum=sum+(m%10);\n m=m/10;\n }\n // printf(\"%d\\n\",i);\n if(sum==10)\n {\n n--;\n if(n==0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n else\n sum=0;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ll long long\n#define sz 10009\nint ar[sz];\nll st(ll n){\n ll m,ans=0;\n while(n!=0){\n ans=ans+n%10;\n n=n/10;\n }\n return ans;\n}\nvoid sum(){\n ll ans=0,z,k=1;\n for(int i=19;i<=sz;i=i+9){\n z=st(i);\n if(z==10){\n ar[k]=i;\n k++;\n }\n }\n \n}\n\n\nint main()\n{\n sum();\n ll a,ans,m;\n scanf(\"%lld\",&a);\n printf(\"%d\\n\",ar[a]);\n return 0;\n}\n \n "}, {"source_code": "#include <stdio.h>\n\nint main( ){\nint k,i,N;\nscanf(\"%d\",&k);\n\nfor(i=0;i<=9;i++){\n if((i+k)==10)\n N=(k*10)+(i%10);\n }\n printf(\"%d\",N);\n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ll long long\n#define sz 10009\nint ar[sz];\nvoid sum(){\n ll ans=0,n,k=1;\n for(int i=19;i<=sz;i=i+9){\n ar[k++]=i;\n }\n \n}\n\n\nint main()\n{\n sum();\n ll a,ans,m;\n scanf(\"%lld\",&a);\n printf(\"%d\",ar[a]);\n return 0;\n}\n \n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n long long int a,i,j=0,k,b=0,c=0,d=1;\n\n scanf(\"%lld\",&a);\n\n while(1)\n {\n b=0,c=0;\n k=a;\n while(k!=0)\n {\n b=k%10;\n c+=b;\n k=k/10;\n }\n if(c==10)\n {\n printf(\"%lld\\n\",a);\n return 0;\n }\n a++;\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint niilber(int a)\n{\n\tint p,sum=0;\nwhile(a>0)\n{sum=sum+a%10;\na=a/10;\n\n}\nreturn sum;\n}\n\n\n\nint main()\n{\n\tint k,n=1,i;\n\tscanf(\"%d\",&k);\n\twhile(i<=k)\n\t{n++;\n\tif(niilber(n)==10)\n\ti++;\n\t}\n\tprintf(\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\ntypedef long long ll;\n\nint main()\n{\n ll k,i,j=1,n,sum=0,a[100000];\n\n scanf(\"%lld\",&k);\n\n for ( i = 1; i < 10001; i++)\n {\n n=i,sum=0;\n while (n>0)\n {\n sum+=n%10;\n n=n/10;\n }\n \n if(sum==10){\n a[j]=i;\n \n if(j==k){\n printf(\"%lld\\n\",a[j]);\n break;\n } \n j++;\n }\n\n }\n\n \n\n return 0;\n}"}], "src_uid": "0a98a6a15e553ce11cb468d3330fc86a"} {"nl": {"description": "Polycarp loves ciphers. He has invented his own cipher called Right-Left.Right-Left cipher is used for strings. To encrypt the string $$$s=s_{1}s_{2} \\dots s_{n}$$$ Polycarp uses the following algorithm: he writes down $$$s_1$$$, he appends the current word with $$$s_2$$$ (i.e. writes down $$$s_2$$$ to the right of the current result), he prepends the current word with $$$s_3$$$ (i.e. writes down $$$s_3$$$ to the left of the current result), he appends the current word with $$$s_4$$$ (i.e. writes down $$$s_4$$$ to the right of the current result), he prepends the current word with $$$s_5$$$ (i.e. writes down $$$s_5$$$ to the left of the current result), and so on for each position until the end of $$$s$$$. For example, if $$$s$$$=\"techno\" the process is: \"t\" $$$\\to$$$ \"te\" $$$\\to$$$ \"cte\" $$$\\to$$$ \"cteh\" $$$\\to$$$ \"ncteh\" $$$\\to$$$ \"ncteho\". So the encrypted $$$s$$$=\"techno\" is \"ncteho\".Given string $$$t$$$ \u2014 the result of encryption of some string $$$s$$$. Your task is to decrypt it, i.e. find the string $$$s$$$.", "input_spec": "The only line of the input contains $$$t$$$ \u2014 the result of encryption of some string $$$s$$$. It contains only lowercase Latin letters. The length of $$$t$$$ is between $$$1$$$ and $$$50$$$, inclusive.", "output_spec": "Print such string $$$s$$$ that after encryption it equals $$$t$$$.", "sample_inputs": ["ncteho", "erfdcoeocs", "z"], "sample_outputs": ["techno", "codeforces", "z"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int len, i, j=0, k=0, mid;\n char p[55], s[55];\n\n scanf(\"%s\", p);\n len = strlen(p);\n mid = len/2;\n if(len%2==0)\n mid = mid-1;\n\n for(i=0; i<len; i++){\n if(i%2==0){\n s[i] = p[mid-j];\n k++;\n }\n else{\n s[i] = p[mid+k];\n j++;}\n }\n s[len] = '\\0';\n\n printf(\"%s\", s);\n\n return 0;\n\n}\n\n"}, {"source_code": "/*Sruthi Shyam\nAM.EN.U4CSE19055\nCSE A\nCodeforces problem 1085A Right Left Cipher*/\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar t[51];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tint i,m;\n\tif(l%2==0)//if even\n\t\tm=(l/2)-1;// index of middle element\n\telse\n\t\tm=l/2;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(i%2==0)\n\t\t\tm-=i;\n\t\telse\n\t\t\tm+=i;\n\t\tprintf(\"%c\",t[m]);\n\t}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tchar s[50];\n\tgets(s);\n\t\n\tint num=strlen(s);\n\tif(num>=1&&num<=50){\n\t\tint i;\n\t\tif(num%2==0)\n\t\tfor(i=0;i<num/2;i++){\n\t\t\tprintf(\"%c\",s[num/2-1-i]);\n\t\t\t\n\t\t\t\tprintf(\"%c\",s[num/2+i]);\n\t\t\t\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%c\",s[num/2]);\n\t\t\tfor(i=0;i<num/2;i++){\n\t\t\tprintf(\"%c\",s[num/2+i+1]);\n\t\t\t\n\t\t\t\tprintf(\"%c\",s[num/2-i-1]);\n\t\t}\n\t}\n}}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n int main(){\n char t[52],s[52];\n scanf(\"%s\",t);\n int n=strlen(t),k;\n if(n%2==0)\n k=n/2;\n else\n k=n/2+1;\n printf(\"%c\",t[k-1]);\n for(int i=1,j=1;i<k;i++){ \n printf(\"%c%c\",t[k+j-1],t[k-j-1]);\n j++;\n }\n if(n%2==0)\n printf(\"%c\",t[n-1]);\n printf(\"\\n\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n int n=strlen(a),i;\n int k=(n-1)/2;\n \n if(n==1)\n {\n printf(\"%c\",a[k]);\n exit(0);\n }\n \n \n for(i=0;i<=n/2;i++)\n {\n if(i==0)\n {\n printf(\"%c\",a[k]);\n continue;\n }\n if(k+i<n)\n {\n printf(\"%c\",a[k+i]);\n } \n if(k-i>=0)\n {\n printf(\"%c\",a[k-i]);\n } \n }\n \n} \n \n \n \n \n \n "}, {"source_code": "// Bismillahir Rahmanir Rahim\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar st[100], i, j, len, mid, st2[100];\n\tscanf(\"%s\", &st);\n\tlen = strlen(st);\n\tmid = (len-1)/2;\n\tst2[0]=st[mid];\n\tfor (i=1, j=1; i<len; i++) {\n\t\tst2[j]=st[mid+i];\n\t\tj++;\n\t\tst2[j]=st[mid-i];\n\t\tj++;\n\t\tif (j==len-1) {\n\t\t\tst2[j]='\\0';\n\t\t}\n\t}\n\tprintf(\"%s\",st2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main() {\n char str[51];\n scanf(\"%s\", str);\n int l = strlen(str);\n char res[51];\n int k = 0, mid, p, q;\n if (l % 2 == 0) {\n mid = l / 2;\n p = q = mid - 1;\n res[k++] = str[mid - 1];\n for (int i = 1; i < l; i++) {\n if (k % 2 != 0) {\n res[k++] = str[p + 1];\n p++;\n }\n else {\n res[k++] = str[q - 1];\n q--;\n }\n }\n }\n else {\n mid = l / 2;\n p = q = mid;\n res[k++] = str[mid];\n for (int i = 1; i < l; i++) {\n if (k % 2 != 0) {\n res[k++] = str[p + 1];\n p++;\n }\n else {\n res[k++] = str[q - 1];\n q--;\n }\n }\n \n }\n res[k] = '\\0';\n printf(\"%s\", res);\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=(n%2==0)?n/2-1:n/2;\n j=(n%2==0)?n/2:n/2+1;\n \nwhile(i>=0 || j<n){\n if(i>=0){\n printf(\"%c\",a[i]);\n }\n if(j<n){\n printf(\"%c\",a[j]);\n }\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tchar a[50],b[50];int i,k,j=0;\n\tgets(a);k=strlen(a);\n\tif(k%2==0){\n\t\tfor(i=0;i<k/2;i++){\n\t\t\tb[j]=a[(k-i)-1];j++;\n\t\t\tb[j]=a[i];j++;\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i<(k+1)/2;i++){\n\t\t\tb[j]=a[i];j++;\n\t\t\tif(i+1<(k+1)/2){\n\t\t\t\tb[j]=a[(k-i)-1];j++;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=k-1;i>=0;i--) \n\t\tprintf(\"%c\",b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar s[51] ;\n\tscanf(\"%s\",s) ;\n\tint l=0 ,m=0, k=0 ;\n\tl=strlen(s) ;\n\tm=(l-1)/2 ;\n\tfor(int i=m ;i<l ;)\n\t{\n\t\tif(k==l)\n\t\t{\n\t\t\tprintf(\" \") ;\n\t\t\tbreak;\n\t\t}\n\t\tk++ ;\n\t\tprintf(\"%c\",s[i]) ;\n\t\tif(k%2!=0)\n\t\t\ti=i+k ;\n\t\telse\n\t\t\ti=i-k ;\n\t}\n\treturn 0 ;\n}\n\t\t\n\t\t\t\n\n\t\t\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,l,m; i=0;\nchar a[50];\nchar b[50];\nscanf(\"%s\",a);\nl=strlen(a);if(l%2!=0)m=l-1;else m=l-2;\nwhile(m>=0)\n{\n b[m]=a[i];\n m=m-2;\n i=i+1;\n}\nj=1;\nwhile(i<l)\n{\n b[j]=a[i];\n j+=2;\n i+=1;\n}\nb[i]=\"\\0\";\nfor(i=0;i<l;i++)\n{\n printf(\"%c\",b[i]);\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=(n%2==0)?n/2-1:n/2;\n j=(n%2==0)?n/2:n/2+1;\n \nwhile(i>=0 || j<n){\n if(i>=0){\n printf(\"%c\",a[i]);\n }\n if(j<n){\n printf(\"%c\",a[j]);\n }\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[100],b[100];\n scanf(\"%s\",a);\n int i,j,k,l;\nl=strlen(a);\n if(l%2==0){\n j=(l/2)-1;\n k=j+1;\n }\n else{\n j=(l/2);\n k=j+1;\n }\n for(i=0;i<l;i++){\n if(i%2==0){\n b[i]=a[j];\n j--;\n }\n else{\n b[i]=a[k];\n k++;\n }\n }\n b[i]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,a,l=0,r=0,z=0,j=1;\n char s[100],q[100];\n scanf(\"%s\",s);\n a=strlen(s);\n int x=a/2;\n q[0]=s[x];\n if(a==1)\n {\n z=0;\n }\n else if (a%2==0){\n x=x-1;\n q[0]=s[x];\n r=x+1;\n l=x-1;\n while(i!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n i=i+2;\n r++;l--;\n }\n }\n else\n {\n r=x+1;\n l=x-1;\n while(j!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n r++;l--;\n }\n }\n for(z=0;z<a;z++)\n {\n printf(\"%c\",q[z]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(int argc, char const *argv[])\n{\n\tchar s[100],s2[100];\n\tscanf(\"%s\",s);\n\tint len = strlen(s);\n\tint start = 0;\n\tint end = len-1;\n\tint count = 0;\n\tif(len%2==1)\n\t{\n\t\ts2[len-1] = s[start];\n\t\tstart++; \n\t\tcount++;\n\t}\n\twhile( count < len)\n\t{\n\t\ts2[len-count-1] = s[end];\n\t\tend--;\n\t\ts2[len-count-2] = s[start];\n\t\tstart++;\n\t\tcount+=2;\n\t}\n\ts2[len] ='\\0';\n\tprintf(\"%s\",s2 );\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i, len, j, start, second;\n char ch[55];\n scanf(\"%s\", ch);\n len = strlen(ch)-1;\n if(len)\n {\n start=len/2;\n printf(\"%c\", ch[start]);\n for(i=start+1, j=start-1; ; i++, j--){\n if(i<=len) printf(\"%c\", ch[i]);\n if(j>=0) printf(\"%c\", ch[j]);\n if(i>len && j<0) break;\n }\n printf(\"\\n\");\n }\n else printf(\"%s\\n\", ch);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\nchar a[55],b[55]={'0'};\nscanf(\"%s\",a);\nint l=strlen(a);int i=0,j=0,k=0,t=l-1,temp;\nif(l%2==0){\nwhile(k<l){\n if(i%2==0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\nif(l%2!=0){\nwhile(k<l){\n if(i%2!=0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\n\nfor(int i=l-1;i>=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[50],a[1000]=\" \";\nscanf(\"%s\",s);\nint n,j=0,k=1;\nn=strlen(s);\nint i=((n-1)/2),h=(((n-1)/2)+1); \ndo\n{\n\t\n\t do\n\t\t{\n\t\t a[j]=s[i];\n\t\t j=j+1;\n\t\t k=k+1;\n\t\t i--;\n\t\t break;\n\t\t}while(i>=0);\n\t\n\tdo\n\t\t\t{\n\t\t\t a[j]=s[h];\n\t\t\t j=j+1;\n\t\t\t k=k+1;\n\t\t\t h++;\n\t\t\t break;\n\t\t\t \n\t\t\t}while(h<=n-1); \n}while(k<=n);\n\t\n\nprintf(\"%s\",a);\n\n\n\nreturn 0;\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[100],b[100];\n scanf(\"%s\",a);\n int i,j,k,l;\nl=strlen(a);\n if(l%2==0){\n j=(l/2)-1;\n k=j+1;\n }\n else{\n j=(l/2);\n k=j+1;\n }\n for(i=0;i<l;i++){\n if(i%2==0){\n b[i]=a[j];\n j--;\n }\n else{\n b[i]=a[k];\n k++;\n }\n }\n b[i]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint len;\n\tchar s[51];\n\tscanf(\"%s\",s);\n\tlen=strlen(s);\n\tchar t[len];\n\tint i=0;\n\tint j=len-1;\n\tint k=len-1;\n\tif(len%2==0)\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t}\n\t}\n\telse\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t}\n\t}\n\tt[len]='\\0';\n\tprintf(\"%s\",t);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tchar t[51];\n\tint len,i,ind,temp;\n\tscanf(\"%s\",&t);\n\tlen = strlen(t);\n\tind = len/2;\n\tif(len<3)\n\t{\n\t\tprintf(\"%s\",t);\n\t}\n\telse\n\t{\n\t\tif(len%2==0)\n\t\t{\n\t\t\tind -= 1;\n\t\t}\n\t\ttemp = ind+1;\n\t\tif(len%2==0)\n\t\t{\n\t\t\twhile(ind!=0)\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t\t\tind--;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t}\n\t\telse{\n\t\t\twhile(ind!=0)\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t\t\tind--;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tprintf(\"%c\",t[ind]);\n\t\t} \n\t\t\n\t}\n\t\n } "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint l,m,i;\n\tchar s[51];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tm=(l+1)/2-1;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tprintf(\"%c\",s[m]);\n\t\tm+=(i%2)*(-i-1)+(1-i%2)*(i+1);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[100],b[100];\n scanf(\"%s\",a);\n int i,j,k,l;\nl=strlen(a);\n if(l%2==0){\n j=(l/2)-1;\n k=j+1;\n }\n else{\n j=(l/2);\n k=j+1;\n }\n for(i=0;i<l;i++){\n if(i%2==0){\n b[i]=a[j];\n j--;\n }\n else{\n b[i]=a[k];\n k++;\n }\n }\n b[i]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char a[51];\n scanf(\"%s\",a);\n int n,i,j;\n n=strlen(a);\n if(n%2)\n {i=(n-2)/2+1;}\n else\n {i=(n-2)/2;}\n j=i+1;\n if(i==1 && n==1)\n {i--;j--;}\n for(;i>=0||j<n;i--,j++)\n {\n if(j==n)\n printf(\"%c\",a[i]);\n else\n printf(\"%c%c\",a[i],a[j]);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX 57\n\nint main(void) {\n\t// your code goes here\n\tchar str[MAX];\n\tint i, len, mid;\n\tscanf(\"%s\", str);\n\tlen = strlen(str);\n\tif(len & 1)\n\t{\n\t\tmid = len / 2;\n\t}\n\telse\n\t{\n\t\tmid = len / 2 - 1;\n\t}\n\tprintf(\"%c\", str[mid]);\n\tfor(i=1;i<=len/2;++i)\n\t{\n\t\tif(mid + i < len)\n\t\t{\n\t\t\tprintf(\"%c\", str[mid + i]);\n\t\t}\n\t\tif(mid - i >= 0)\n\t\t{\n\t\t\tprintf(\"%c\", str[mid - i]);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i, len, j, start, second;\n char ch[55];\n scanf(\"%s\", ch);\n len = strlen(ch)-1;\n if(len)\n {\n start=len/2;\n printf(\"%c\", ch[start]);\n for(i=start+1, j=start-1; ; i++, j--){\n if(i<=len) printf(\"%c\", ch[i]);\n if(j>=0) printf(\"%c\", ch[j]);\n if(i>len && j<0) break;\n }\n printf(\"\\n\");\n }\n else printf(\"%s\\n\", ch);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h> \nint main(){\nint mid_ind,i=0,j,k;\nchar t[50],s[50]=\"\";\nscanf(\"%s\",t);\nif(strlen(t)%2==0)\nmid_ind=(strlen(t)/2)-1;\nelse\nmid_ind=(strlen(t)/2);\ns[i]=t[mid_ind];\n\nj=mid_ind;\nk=mid_ind;\n\nwhile (i<=strlen(t)-1){\nif(j<strlen(t)){\nj++;\ni++;\ns[i]=t[j];\n}\n\nif(k>=0){\nk--;\ni++;\ns[i]=t[k];\n}\n}\n\nprintf(\"%s\",s);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n\tint q;\n\tchar s[50];\n\tchar t[50];\n\tsf(\"%s\",s);\n\tq=strlen(s);\n\tif (q%2==0)\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t}\n\t}\n\telse\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t}\n\t}\n\tt[q]='\\0';\n\tprintf(\"%s\\n\",t);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n char s[50];\n scanf(\"%s\",s);\n if (strlen(s)%2==0)\n {\n int x=strlen(s)/2;\n int y=strlen(s);\n int z=x-1,w=1;\n while(y>0)\n {\n printf(\"%c\",s[z]);\n z=(x-1)+w;\n if (y%2==0)\n w=-w;\n else\n {\n w=-w;\n w=w+1;\n }\n y--;\n }\n }\n\n else\n {\n if (strlen(s)==1)\n {\n printf(\"%c\",s[0]);\n }\n else\n {\n int x=strlen(s)/2;\n int y=strlen(s);\n int z=x,w=1;\n while(y>0)\n {\n printf(\"%c\",s[z]);\n z=x+w;\n if (y%2!=0)\n w=-w;\n else\n { \n w=-w;\n w=w+1;\n }\n y--;\n }\n }\n } \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[50],s1[50];scanf(\"%s\",s);\n\tint i,l,t,cnt=0;\n\tl=strlen(s);\n\tif(l%2==0) t=l/2-1;\t\n\telse t=(l/2);\n\tfor(i=0;i<l;i++)\n\t{\n\t\ts1[i]=s[t];\n\t\tcnt++;\n\t\tif(i%2==0)\n\t\t\tt=t+cnt;\n\t\telse\n\t\t\tt=t-cnt;\n\t\t\n\t}\n\ts1[l]='\\0';\n\tprintf(\"%s\",s1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,k,l,m;\n char s[55];\n scanf(\"%s\",&s);\n l=strlen(s);\n m=l;\n l=l-1;\n j=l/2;\n k=j+1;\n if(m%2==1)\n {\n while(j>=1)\n {\n printf(\"%c%c\",s[j],s[k]);\n j--;\n k++;\n }\n printf(\"%c\",s[0]);\n }\n else if(m%2==0)\n {\n while(j>=0)\n {\n printf(\"%c%c\",s[j],s[k]);\n j--;\n k++;\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[50];\n\tscanf(\"%s\",str);\n\tchar dec[50];\n\n\tint len=strlen(str);\n\t\n\tint q=0,w=0;\n\t\n\tw=(len/2)-1;\n\tq=(len/2);\n\n\t\n\t\t\n\tif(len%2==0)\n\t{\t\n\t\tw=(len/2)-1;\n\t\tq=(len/2);\n\n\n\t\tfor(int i=0;i<len;i++)\n\t\t{\n\t\t\t\n\t\t\t if(i%2==0)\n\t\t\t\t{\n\t\t\t\t\tdec[i]=str[w];\n\t\t\t\t\tw--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdec[i]=str[q];\n\t\t\t\t\tq++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\telse\n\t{\n\t\tw=len/2;\n\t\tq=(len/2)+1;\n\t\t\n\t\tfor(int k=0;k<len;k++)\n\t\t{\n\t\t\tif(k%2==0)\n\t\t\t{\n\t\t\t\tdec[k]=str[w];\n\t\t\t\tw--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdec[k]=str[q];\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\t\t\n\t\n\t\t\n\t\tfor(int i=0;i<len;i++)\n\t\tprintf(\"%c\",dec[i]);\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n\n\n\nint main()\n{\n\tint len,x,f=1;\n\tchar s[51];\n\tchar a[51];\n\tscanf(\"%s\",s);\n\tlen=strlen(s);\n\tif(len%2==0)\n\t\tx=(len/2)-1;\n\telse\n\t\tx=len/2;\n\tfor(int i=0;i<len;i++)\n {\n\n\t\ta[i]=s[x];\n\t\tx=x+f;\n\t\tif(f%2==0)\n\t\t\tf=f-1;\n\t\telse\n\t\t\tf=f+1;\n\t\tf=f*-1;\n\t }\n\ta[len]='\\0';\n\t\n\tprintf(\"%s\",a);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int m;\n fgets(s,sizeof(s),stdin);\n m=(strlen(s)-1)/2;\n if ((strlen(s)-1)%2!=0)\n {\n printf(\"%c\",s[m]);\n for (int i = 1; i <=m ; i++)\n {\n printf(\"%c\",s[m+i]);\n printf(\"%c\",s[m-i]);\n }\n }\n else\n {\n m=m-1;\n printf(\"%c\",s[m]);\n for (int i = 1; i <=m ; i++)\n {\n printf(\"%c\",s[m+i]);\n printf(\"%c\",s[m-i]);\n } \n printf(\"%c\",s[(m*2)+1]);\n } \n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nint main(){\nint i=0,j,k;\nchar s[50];\nscanf(\"%s\",s);\nint l=strlen(s);\nchar s1[l];\nint mid = (l-1)/2;\nif (l%2 == 0){\ns1[i++] = s[mid];\nfor(j=l/2,k=mid-1;j<l&&k>=0;j++,k--){\ns1[i++]=s[j];\ns1[i++]=s[k];\n}\ns1[j++]=s[l-1];\n}\nelse{\ns1[i++] = s[l/2];\nfor(j=l/2 +1,k=l/2 -1;j<l&&k>=0;j++,k--){\ns1[i++]=s[j];\ns1[i++]=s[k];\n}\n}\ns1[j]='\\0';\nprintf(\"%s\\n\",s1);\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[51],ans[51],temp[1];\n int l,i,j,size;\n scanf(\"%s\",str);\n l=strlen(str);\n size=l/2;\n if(l%2==0){\n for(i=0;i<size;i++){\n strncat(ans,&str[l-i-1],1);\n strncat(ans,&str[i],1);\n }\n }\n else{\n for(i=0;i<size;i++){\n strncat(ans,&str[i],1);\n strncat(ans,&str[l-i-1],1);\n }\n strncat(ans,&str[size],1);\n }\n for(j = l - 1; j >= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,k,l,m;\n char s[55];\n scanf(\"%s\",&s);\n l=strlen(s);\n m=l;\n l=l-1;\n j=l/2;\n k=j+1;\n if(m%2==1)\n {\n while(j>=1)\n {\n printf(\"%c%c\",s[j],s[k]);\n j--;\n k++;\n }\n printf(\"%c\",s[0]);\n }\n else if(m%2==0)\n {\n while(j>=0)\n {\n printf(\"%c%c\",s[j],s[k]);\n j--;\n k++;\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[50], t[50];\nscanf(\"%s\",s);\nint n = strlen(s), j = 0;\nif(n % 2 == 0){\nt[j++] = s[(n-1)/2];\nfor(int i = n/2, k = (n-1)/2 - 1;i < n && k >=0;i++, k--){\nt[j++] = s[i];\nt[j++] = s[k];\n}\nt[j++] = s[n-1];\n}\nelse{\nt[j++] = s[n/2];\nfor(int i = n/2 +1, k = n/2 -1; i <n && k >= 0; i++, k--){\nt[j++] = s[i];\nt[j++] = s[k];\n}}\nt[j] = '\\0';\nprintf(\"%s\\n\", t);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n char s[50];\n scanf(\"%s\",s);\n if (strlen(s)%2==0)\n {\n int x=strlen(s)/2;\n int y=strlen(s);\n int z=x-1,w=1;\n while(y>0)\n {\n printf(\"%c\",s[z]);\n z=(x-1)+w;\n if (y%2==0)\n w=-w;\n else\n {\n w=-w;\n w=w+1;\n }\n y--;\n }\n }\n\n else\n {\n if (strlen(s)==1)\n {\n printf(\"%c\",s[0]);\n }\n else\n {\n int x=strlen(s)/2;\n int y=strlen(s);\n int z=x,w=1;\n while(y>0)\n {\n printf(\"%c\",s[z]);\n z=x+w;\n if (y%2!=0)\n w=-w;\n else\n { \n w=-w;\n w=w+1;\n }\n y--;\n }\n }\n } \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint l,i,j,k;\nchar s[55];\nscanf(\"%s\",s);\nl=strlen(s);\nk=l;\nif(l%2==0)\nl=(l/2)-1;\nelse\nl=l/2;\nint c;\nc=l;\nprintf(\"%c\",s[l]);\nwhile(1)\n{\nl=l+1;\nif(l>k-1)\n{\nbreak;\n}\nprintf(\"%c\",s[l]);\nc=c-1;\nif(c<0)\nbreak;\nprintf(\"%c\",s[c]);\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar input[100];\nchar output[100];\n\nint main()\n{\n\tint l, r;\n\tint flag;\n\tint count;\n\n\tscanf(\"%s\", input);\n\n\tl = 0;\n\tr = strlen(input) - 1;\n\tcount = r;\n\n\tif (strlen(input) % 2 == 0)\n\t\tflag = 1;\n\telse\n\t\tflag = 0;\n\n\twhile (count != -1)\n\t{\n\t\tif (flag == 1)\n\t\t{\n\t\t\toutput[count--] = input[r];\n\t\t\tr--;\n\t\t\tflag = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\toutput[count--] = input[l];\n\t\t\tl++;\n\t\t\tflag = 1;\n\t\t}\n\t}\n\n\tprintf(\"%s\", output);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char encryp[52];\n char decryp[52];\n int chars=0;\n int i;\n int left;\n int right;\n int count;\n\n scanf(\"%s\",&encryp);\n for(i=0;i<51;i++)\n {\n if((encryp[i] >='a')&&(encryp[i]<='z'))\n {\n chars++;\n }else{\n break;\n }\n } \n count=chars;\n decryp[count--]='\\0';\n\n if(chars>1)\n {\n if(chars%2==0)\n {\n left=0;\n right=chars-1;\n for(i=0;i<(chars/2);i++)\n {\n decryp[count--]=encryp[right--];\n decryp[count--]=encryp[left++];\n }\n }else{\n left=0;\n right=chars-1;\n decryp[count--]=encryp[left++];\n for(i=0;i<((chars-1)/2);i++)\n {\n decryp[count--]=encryp[right--];\n decryp[count--]=encryp[left++];\n }\n\n }\n }else{\n decryp[count--]=encryp[0];\n }\n printf(\"%s\",decryp);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[50];\nint start;\nscanf(\"%s\",s);\nint l=strlen(s);\nchar a[l];\nif(l%2==0)\nstart=(l/2)-1;\nelse\nstart=((l+1)/2)-1;\nprintf(\"%c\",s[start]);\nfor(int i=1;i<l;i++){\n\tif(start+i<l){\n\tprintf(\"%c\",s[start+i]);\n}\n\tif(start-i>=0){\n\tprintf(\"%c\",s[start-i]);}\n\telse\n\t\tbreak;\n}/*\t\nfor(int i=0;i<strlen(a);i++)\nprintf(\"%c\",a[i]);*/\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar t[51];\n\tint i,j,c=0,m,x;\n\tscanf(\"%s\",&t);\n\tx=strlen(t);\n\tif(x%2==0)\n\tm=x/2;\n\telse\n\tm=x/2+1;\n\ti=m;\n\tj=m-2;\n\tprintf(\"%c\",t[m-1]);\n\tif(x>1){\n\twhile(1){\n\t\tif(c==0){\n\t\tprintf(\"%c\",t[i]);\n\t\tc=1;\n\t\ti++;\n\t\t}\n\t\telse if(c==1){\n\t\t\tprintf(\"%c\",t[j]);\n\t\t\tj--;\n\t\t\tc=0;\n\t\t}\n\t\tif(j<0 && i>=x)\n\t\tbreak;\n\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\nchar a[55],b[55]={'0'};\nscanf(\"%s\",a);\nint l=strlen(a);int i=0,j=0,k=0,t=l-1,temp;\nif(l%2==0){\nwhile(k<l){\n if(i%2==0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\nif(l%2!=0){\nwhile(k<l){\n if(i%2!=0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\n\nfor(int i=l-1;i>=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\n\nint main()\n{\nchar s[52];\nscanf(\"%s\",s);\nint len=strlen(s);\nchar *a=malloc((len+1)*sizeof(char));\na[len]='\\0';\nint i=0,p=(len-1)/2;\nint t=0,w=1,c=0;\nwhile(c<len)\n{\n if(c%2==0)\n {a[c]=s[p-t];\n t++;}\n else\n {a[c]=s[p+w];\n w++;\n }\nc++;\n\n}\nprintf(\"%s\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main ()\n{\n char s[52],a,b,c;\n int len,i,j,k,l;\n scanf(\" %[^\\n]\", s);\n len=strlen(s);\n if(len==1)\n {\n printf(\"%s\\n\",s);\n }\n else\n {\n k=len/2;\n l=k;\n if(len%2==0)\n {\n for(i=k-1,j=k; i>=0,s[j]!='\\0'; i--,j++)\n {\n a=s[i];\n b=s[j];\n putchar(a);\n putchar(b);\n }\n }\n else\n {\n c=s[l];\n putchar(c);\n for(i=k-1,j=k+1; i>=0,j<len; i--,j++)\n {\n a=s[i];\n b=s[j];\n putchar(b);\n putchar(a);\n }\n }\n printf(\"\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n char str[1000];\n int i, s, mid_index;\n\n gets(str);\n\n s = strlen(str);\n if(s%2)\n {\n mid_index = floor( (s-1)/2 );\n\n printf(\"%c\",str[mid_index]);\n for(i=1 ; i<=mid_index ;i++)\n {\n printf(\"%c%c\",str[mid_index +i],str[mid_index - i]);\n }\n }\n else\n {\n mid_index = (s/2) - 1;\n for(i=0 ; i<=mid_index ;i++)\n {\n printf(\"%c%c\",str[mid_index -i],str[mid_index + i+1]);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[51],ans[51],temp[1];\n int l,i,j,size;\n scanf(\"%s\",str);\n l=strlen(str);\n size=l/2;\n if(l%2==0){\n for(i=0;i<size;i++){\n strncat(ans,&str[l-i-1],1);\n strncat(ans,&str[i],1);\n }\n }\n else{\n for(i=0;i<size;i++){\n strncat(ans,&str[i],1);\n strncat(ans,&str[l-i-1],1);\n }\n strncat(ans,&str[size],1);\n }\n for(j = l - 1; j >= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char encryp[52];\n char decryp[52];\n int chars=0;\n int i;\n int left;\n int right;\n int count;\n\n scanf(\"%s\",&encryp);\n for(i=0;i<51;i++)\n {\n if((encryp[i] >='a')&&(encryp[i]<='z'))\n {\n chars++;\n }else{\n break;\n }\n } \n count=chars;\n decryp[count--]='\\0';\n\n if(chars>1)\n {\n if(chars%2==0)\n {\n left=0;\n right=chars-1;\n for(i=0;i<(chars/2);i++)\n {\n decryp[count--]=encryp[right--];\n decryp[count--]=encryp[left++];\n }\n }else{\n left=0;\n right=chars-1;\n decryp[count--]=encryp[left++];\n for(i=0;i<((chars-1)/2);i++)\n {\n decryp[count--]=encryp[right--];\n decryp[count--]=encryp[left++];\n }\n\n }\n }else{\n decryp[count--]=encryp[0];\n }\n printf(\"%s\",decryp);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar s[51] ;\n\tscanf(\"%s\",s) ;\n\tint l=0 ,m=0, k=0 ;\n\tl=strlen(s) ;\n\tm=(l-1)/2 ;\n\tfor(int i=m ;i<l ;)\n\t{\n\t\tif(k==l)\n\t\t{\n\t\t\tprintf(\" \") ;\n\t\t\tbreak;\n\t\t}\n\t\tk++ ;\n\t\tprintf(\"%c\",s[i]) ;\n\t\tif(k%2!=0)\n\t\t\ti=i+k ;\n\t\telse\n\t\t\ti=i-k ;\n\t}\n\treturn 0 ;\n}\n\t\t\n\t\t\t\n\n\t\t\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,m,l;\nchar str[100];\nscanf(\"%s\",str);\nl=strlen(str);\nm=(l+1)/2-1;\nfor(i=0;i<l;i++)\n{\n\t\tprintf(\"%c\",str[m]);\n\t\tm+=(i%2)*(-i-1)+(1-i%2)*(i+1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n char t[100];\n scanf(\"%s\",t);\n int i,l,x,j;\n l=strlen(t);\n if(l%2==0){\n x=l/2-1;\n }\n else{\n x=l/2;\n }\n printf(\"%c\",t[x]);\n for(i=x+1,j=x-1;i<l,j>=0;i++,j--){\n printf(\"%c\",t[i]);\n printf(\"%c\",t[j]);\n }\n if(l%2==0){\n printf(\"%c\",t[l-1]);\n }\n}\n"}, {"source_code": "// Bismillahir Rahmanir Rahim\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar st[100], i, j, len, mid, st2[100];\n\tscanf(\"%s\", &st);\n\tlen = strlen(st);\n\tmid = (len-1)/2;\n\tst2[0]=st[mid];\n\tfor (i=1, j=1; i<len; i++) {\n\t\tst2[j]=st[mid+i];\n\t\tj++;\n\t\tst2[j]=st[mid-i];\n\t\tj++;\n\t\tif (j==len-1) {\n\t\t\tst2[j]='\\0';\n\t\t}\n\t}\n\tprintf(\"%s\",st2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#define MAX 57\n\nint main(void) {\n\t// your code goes here\n\tchar str[MAX];\n\tint i, len, mid;\n\tscanf(\"%s\", str);\n\tlen = strlen(str);\n\tif(len & 1)\n\t{\n\t\tmid = len / 2;\n\t}\n\telse\n\t{\n\t\tmid = len / 2 - 1;\n\t}\n\tprintf(\"%c\", str[mid]);\n\tfor(i=1;i<=len/2;++i)\n\t{\n\t\tif(mid + i < len)\n\t\t{\n\t\t\tprintf(\"%c\", str[mid + i]);\n\t\t}\n\t\tif(mid - i >= 0)\n\t\t{\n\t\t\tprintf(\"%c\", str[mid - i]);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=(n%2==0)?n/2-1:n/2;\n j=(n%2==0)?n/2:n/2+1;\n \nwhile(i>=0 || j<n){\n if(i>=0){\n printf(\"%c\",a[i]);\n }\n if(j<n){\n printf(\"%c\",a[j]);\n }\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[50];\nint start;\nscanf(\"%s\",s);\nint l=strlen(s);\nchar a[l];\nif(l%2==0)\nstart=(l/2)-1;\nelse\nstart=((l+1)/2)-1;\nprintf(\"%c\",s[start]);\nfor(int i=1;i<l;i++){\n\tif(start+i<l){\n\tprintf(\"%c\",s[start+i]);\n}\n\tif(start-i>=0){\n\tprintf(\"%c\",s[start-i]);}\n\telse\n\t\tbreak;\n}/*\t\nfor(int i=0;i<strlen(a);i++)\nprintf(\"%c\",a[i]);*/\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int i, j=0, k=0, len;\n char str[51], ns[51], s1[51], s2[51], rs1[51];\n scanf(\"%s\", str);\n len = strlen(str);\n if(len == 1){\n printf(\"%s\", str);\n return;\n }\n if(len%2 == 0){\n for(i=0; i<len/2; ++i){\n s1[j++] = str[i];\n }\n for(i=len/2; i<len; ++i){\n s2[k++] = str[i];\n }\n }\n else{\n for(i=0; i<=len/2; ++i){\n s1[j++] = str[i];\n }\n for(i=len/2+1; i<len; ++i){\n s2[k++] = str[i];\n }\n }\n s1[j] = '\\0';\n s2[k] = '\\0';\n i=0;\n while(--j>=0)\n rs1[i++] = s1[j];\n rs1[i] = '\\0';\n for(i=0; i<len; ++i){\n if(i%2 == 0)\n ns[i] = rs1[i/2];\n else\n ns[i] = s2[i/2];\n }\n ns[i] = '\\0';\n printf(\"%s\", ns);\n return;\n}"}, {"source_code": "\n\n#include <stdio.h>\n#include <string.h>\nint main(int argc, char **argv)\n{\n\tchar t[50];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tchar s[l];\n\tint i,j,k;\n\tif(l%2==0)\n\t{i=l/2-1;j=l/2;}\n\telse\n\t{\n\t\ti=l/2;j=l/2+1;\n\t\t}\n\tif(l==1)\n\t\tprintf(\"%s\",t);\n\t\telse\n\t\t{\n\tfor(k=0;k<l;k++)\n\t{\n\t\tif(k%2==0)\n\t\t{\n\t\t\ts[k]=t[i];\n\t\t\ti--;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\ts[k]=t[j];\n\t\t\tj++;\t\n\t\t}\n\t\t\n\t}\n\tfor(i=0;i<l;i++)\n\t{\n\t\tprintf(\"%c\",s[i]);\n\t}\n\tprintf(\"\\n\");\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,i,j,k;\n char s[55];\n scanf(\"%s\",s);\n l=strlen(s);\n k=l;\n if(l%2==0)\n l=(l/2)-1;\n else\n l=l/2;\n int c;\n c=l;\n printf(\"%c\",s[l]);\n while(1)\n {\n l=l+1;\n if(l>k-1)\n {\n break;\n }\n printf(\"%c\",s[l]);\n c=c-1;\n if(c<0)\n break;\n printf(\"%c\",s[c]);\n }\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\n\nunsigned int a=0;//\u043a\u043e\u043b-\u0432\u043e cnhjr\nunsigned int b=0;//\u043a\u043e\u043b-\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432\nunsigned int len=0,\na_0=0;\nunsigned char str_in[60], str_out[60];\n\nunsigned int ad, lst,count,len,ost,dlina;\n\nint main()\n{\n scanf(\"%s\", str_in);\n \n len=strlen(str_in);\n if((len%2)==0)\n {\n a_0=len/2-1;\n }\n else if((len%2)==1)\n {\n a_0=len/2;\n }\n str_out[0]=str_in[a_0];\n \n if(len>1)\n {\n for(int i=1;i<len;i++)\n {\n if((i%2)==0)\n {\n a_0=a_0-i;\n str_out[i]=str_in[a_0];\n }\n else\n {\n a_0=a_0+i;\n str_out[i]=str_in[a_0];\n }\n }\n printf(\"%s\",str_out);\n \n }\n else if(len==1)\n {\n printf(\"%s\",str_in);\n }\n \n \n \n \n \n \n \n \n \n \n \n \n \n return 0;\n \n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,a,l=0,r=0,z=0,j=1;\n char s[100],q[100];\n scanf(\"%s\",s);\n a=strlen(s);\n int x=a/2;\n q[0]=s[x];\n if(a==1)\n {\n z=0;\n }\n else if (a%2==0){\n x=x-1;\n q[0]=s[x];\n r=x+1;\n l=x-1;\n while(i!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n i=i+2;\n r++;l--;\n }\n }\n else\n {\n r=x+1;\n l=x-1;\n while(j!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n r++;l--;\n }\n }\n for(z=0;z<a;z++)\n {\n printf(\"%c\",q[z]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[50],alpha[1000]= \" \";\n scanf(\"%s\",str);\n int length,j=0,k=1;\n length=strlen(str);\n int i=((length-1)/2),h=(((length-1)/2)+1);\n do\n {\n do\n {\n alpha[j]=str[i];\n j=j+1;\n k=k+1;\n i--;\n break;\n }\n while(i>=0);\n do\n {\n alpha[j]=str[h];\n j=j+1;\n k=k+1;\n h++;\n break;\n }\n while(h<length-1);\n }\n while(k<=length);\n printf(\"%s\",alpha);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tchar s[50];\n\tgets(s);\n\t\n\tint num=strlen(s);\n\tif(num>=1&&num<=50){\n\t\tint i;\n\t\tif(num%2==0)\n\t\tfor(i=0;i<num/2;i++){\n\t\t\tprintf(\"%c\",s[num/2-1-i]);\n\t\t\t\n\t\t\t\tprintf(\"%c\",s[num/2+i]);\n\t\t\t\t\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%c\",s[num/2]);\n\t\t\tfor(i=0;i<num/2;i++){\n\t\t\tprintf(\"%c\",s[num/2+i+1]);\n\t\t\t\n\t\t\t\tprintf(\"%c\",s[num/2-i-1]);\n\t\t}\n\t}\n}}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[100],b[100];\n scanf(\"%s\",a);\n int i,j,k,l;\nl=strlen(a);\n if(l%2==0){\n j=(l/2)-1;\n k=j+1;\n }\n else{\n j=(l/2);\n k=j+1;\n }\n for(i=0;i<l;i++){\n if(i%2==0){\n b[i]=a[j];\n j--;\n }\n else{\n b[i]=a[k];\n k++;\n }\n }\n b[i]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar ar[100];\n\tint i,a;\n\tgets(ar);\n\tint n = strlen(ar);\n\tif(n>1)\n\t{\n\tif(n%2==0)\n\ta=n/2;\n\telse\n\ta=n/2+1;\n\tprintf(\"%c\",ar[a-1]);\n\tfor(i=0;i<n/2-1;i++)\n\t{\n\t\tprintf(\"%c%c\",ar[a+i],ar[a-i-2]);\n\t}\n\tif(n%2==0)\n\tprintf(\"%c\",ar[n-1]);\n\telse\n\tprintf(\"%c%c\",ar[n-1],ar[0]);\n }\n else\n printf(\"%c\",ar[0]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[51];\n gets(s);\n int l=strlen(s);\n \n int i,m;\n if (l%2==0)\n m=(l/2)-1;\n else\n m=l/2;\n \n printf(\"%c\",s[m]);\n for (i=1;i<l;i++)\n { \n\t if (i%2!=0)\n\t m+=i;\n\t else\n\t m-=i;\n\t printf(\"%c\",s[m]);\n }\n\treturn 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint len;\n\tchar s[51];\n\tscanf(\"%s\",s);\n\tlen=strlen(s);\n\tchar t[len];\n\tint i=0;\n\tint j=len-1;\n\tint k=len-1;\n\tif(len%2==0)\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t}\n\t}\n\telse\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t}\n\t}\n\tt[len]='\\0';\n\tprintf(\"%s\",t);\n}\n"}, {"source_code": "/*Sruthi Shyam\nAM.EN.U4CSE19055\nCSE A\nCodeforces problem 1085A Right Left Cipher*/\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar t[51];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tint i,m;\n\tif(l%2==0)//if even\n\t\tm=(l/2)-1;// index of middle element\n\telse\n\t\tm=l/2;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(i%2==0)\n\t\t\tm-=i;\n\t\telse\n\t\t\tm+=i;\n\t\tprintf(\"%c\",t[m]);\n\t}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\nchar a[55],b[55]={'0'};\nscanf(\"%s\",a);\nint l=strlen(a);int i=0,j=0,k=0,t=l-1,temp;\nif(l%2==0){\nwhile(k<l){\n if(i%2==0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\nif(l%2!=0){\nwhile(k<l){\n if(i%2!=0){\n b[k]=a[t];t--;}\n else{\n b[k]=a[j];\n j++;}i++;k++;}}\n\nfor(int i=l-1;i>=0;i--) printf(\"%c\",b[i]);\nreturn 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint l, i, j;\n\tchar t[50];\n\tscanf(\"%s\", t);\n\tl = strlen(t);\n\tchar s[55];\n\tif (l % 2 == 0)\n\t{\n\t\tfor (i = 0, j = 0; i <= (l - 1) / 2 && j<l; i++, j++)\n\t\t{\n\t\t\ts[j] = t[l - 1 - i];\n\t\t\tj = j + 1;\n\t\t\ts[j] = t[i];\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor (i = 0, j = 0; i <= (l - 1) / 2 && j<l; i++, j++)\n\t\t{\n\t\t\ts[j] = t[i];\n\t\t\tj = j + 1;\n\t\t\ts[j] = t[l - 1 - i];\n\t\t}\n\t}\n\tfor (i = l - 1; i >= 0; i--)\n\t{\n\t\tprintf(\"%c\", s[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char t[55];\n int l,i,x,j;\n scanf(\"%s\",t);\n l=strlen(t);\n char str[55];\n x=(l-1)/2;\n str[0]=t[x];\n j=2;\n for(i=x-1;i>=0;i--)\n {\n str[j]=t[i];\n j+=2;\n if(j>l)\n break;\n }\n j=1;\n for(i=x+1;i<l;i++)\n {\n str[j]=t[i];\n j+=2;\n if(j>l)\n break;\n }\n str[l]='\\0';\n printf(\"%s\\n\",str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50];\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]=a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n int a=1,total,i,k,b=2;\n char str[50],str1[50];\n scanf(\"%s\",str);\n total=strlen(str); \n if (total%2==0) {\n k=total/2-1;\n str1[0]=str[k];\n for (i=1;i<=total/2;i++) {\n str1[a]=str[k+i];\n a=a+2;\n }\n for(i=total/2-2;i>=0;i--) {\n str1[b]=str[i];\n b=b+2;\n }\n }\n else {\n k=total/2;\n str1[0]=str[k];\n for (i=1;i<=total/2;i++) {\n str1[a]=str[k+i];\n a=a+2;\n }\n for(i=total/2-1;i>=0;i--) {\n str1[b]=str[i];\n b=b+2;\n }\n }\n for (i=0;i<total;i++) {\n printf(\"%c\",str1[i]);\n }\n return 0;\n}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar t[50],s[50];\n\tscanf(\"%s\",t);\n\tint n=strlen(t),cnt=n/2,x=0;\n\tif(n%2==0)\n\t{\n\t\tcnt=n/2-1;\n\t}\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts[i]=t[cnt];\n\t\tx++;\n\t\tif(i%2==0)\n\t\t{\n\t\t\tcnt=cnt+x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcnt=cnt-x;\n\t\t}\n\t}\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tprintf(\"%c\",s[i]);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char t[55];\n int l,i,x,j;\n scanf(\"%s\",t);\n l=strlen(t);\n char str[55];\n x=(l-1)/2;\n str[0]=t[x];\n j=2;\n for(i=x-1;i>=0;i--)\n {\n str[j]=t[i];\n j+=2;\n if(j>l)\n break;\n }\n j=1;\n for(i=x+1;i<l;i++)\n {\n str[j]=t[i];\n j+=2;\n if(j>l)\n break;\n }\n str[l]='\\0';\n printf(\"%s\\n\",str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j1,j2,length;\n char str[55],str3[55];\n scanf(\"%s\",str);\n length=strlen(str);\n if(length%2==0){\n str3[0]=str[(length-1)/2];\n str3[1]=str[length/2];\n int k1=((length-1)/2)-1;\n int k2=(length/2)+1;\n j1=2;\n for(i=k1;i>=0;i--)\n {\n str3[j1]=str[i];\n j1=j1+2;\n }\n j2=3;\n for(i=k2;i<length;i++)\n {\n str3[j2]=str[i];\n j2=j2+2;\n }\n str3[length]=0;\n }\nelse\n{\n str3[0]=str[(length-1)/2];\n int k1=((length-1)/2)+1;\n int k2=((length-1)/2)-1;\n j1=1;\n for(i=k1;i<=length-1;i++)\n {\n str3[j1]=str[i];\n j1=j1+2;\n }\n j2=2;\n for(i=k2;i>=0;i--)\n {\n str3[j2]=str[i];\n j2=j2+2;\n }\n str3[length]=0;\n}\nprintf(\"%s\",str3);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50];\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]=a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100],str2[100];\n int i,len,x;\n scanf(\"%s\",&str);\n len=strlen(str);\n if(len%2==0)\n {\n x=(len/2)-1;\n for(i=0;i<len;i++)\n {\n if(i%2!=0)\n {\n\n str2[i]=str[x+i];\n x=x+i;\n }\n else{\n str2[i]=str[x-i];\n x=x-i;\n }\n }\n for(i=0;i<len;i++)\n {\n printf(\"%c\",str2[i]);\n }\n }\n else\n {\n x=len/2;\n for(i=0;i<len;i++)\n {\n if(i%2!=0)\n {\n\n str2[i]=str[x+i];\n x=x+i;\n }\n else{\n str2[i]=str[x-i];\n x=x-i;\n }\n }\n for(i=0;i<len;i++)\n {\n printf(\"%c\",str2[i]);\n }\n\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tchar a[50],b[50];int i,k,j=0;\n\tgets(a);k=strlen(a);\n\tif(k%2==0){\n\t\tfor(i=0;i<k/2;i++){\n\t\t\tb[j]=a[(k-i)-1];j++;\n\t\t\tb[j]=a[i];j++;\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i<(k+1)/2;i++){\n\t\t\tb[j]=a[i];j++;\n\t\t\tif(i+1<(k+1)/2){\n\t\t\t\tb[j]=a[(k-i)-1];j++;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=k-1;i>=0;i--) \n\t\tprintf(\"%c\",b[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n\nint main(void){\n\n char s[64];\n int len, i, k;\n\n scanf(\"%s\", s);\n\n len = strlen(s);\n\n char t[64];\n\n if(len % 2 == 0){\n for(i = 0; i < len; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }else{\n t[len - 1] = s[0];\n for(i = 1; i < len - 1; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[(i / 2) + 1];\n i = k;\n }\n }\n\n for(i = 0; i < len; i++){\n printf(\"%c\", t[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int k,m,p,l;\n char a[51];\n scanf(\"%s\",&a);\n m=strlen(a);\n if(m==1)\n printf(\"%c\",a[0]);\n else\n {\n p=m-2;\n if(m%2==0)\n k=m/2-1;\n else\n k=m/2;\n l=k+1;\n printf(\"%c%c\",a[k],a[l]);\n while(p>0)\n {\n if(k-1>=0)\n {\n printf(\"%c\",a[k-1]);\n p--;\n k--;\n }\n if(l+1<m)\n {\n printf(\"%c\",a[l+1]);\n p--;\n l++;\n }\n }\n \n }\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n char s[53];\n scanf(\"%s\",s);\n int i=0;\n for(i=0;s[i]!='\\0';i++);\n int n=i;\n int a[120];\n int r=50;\n int l=50;\n for(i=0;i<n;i++){\n if(i%2==0){\n a[i]=l--;\n }\n else \n a[i]=++r;\n }\n for(int i=0;i<n;i++){\n printf(\"%c\",s[a[i]-l-1]);\n }\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,m,l;\nchar str[100];\nscanf(\"%s\",str);\nl=strlen(str);\nm=(l+1)/2-1;\nfor(i=0;i<l;i++)\n{\n\t\tprintf(\"%c\",str[m]);\n\t\tm+=(i%2)*(-i-1)+(1-i%2)*(i+1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[50];\n int n,c=0;\n scanf(\"%s\",&s);\n n=strlen(s);\n if(n==1){\n printf(\"%c\",s[0]);\n return 0;\n }\n printf(\"%c\",s[(n-1)/2]);\n for(int i=1;i<(n/2)+1;i++){\n if((n-1)/2+i<n)\n printf(\"%c\",s[(n-1)/2+i]);\n if((n-1)/2-i>=0)\n printf(\"%c\",s[(n-1)/2-i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[50],y[50];\n scanf(\"%s\",x);\n int i,j,k,l;\nl=strlen(x);\n if(l%2==0){\n j=(l/2)-1;\n k=j+1;\n }\n else{\n j=(l/2);\n k=j+1;\n }\n for(i=0;i<l;i++){\n if(i%2==0){\n y[i]=x[j];\n j--;\n }\n else{\n y[i]=x[k];\n k++;\n }\n }\n y[i]='\\0';\n printf(\"%s\",y);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,i,j,k;\n char s[55];\n scanf(\"%s\",s);\n l=strlen(s);\n k=l;\n if(l%2==0)\n l=(l/2)-1;\n else\n l=l/2;\n int c;\n c=l;\n printf(\"%c\",s[l]);\n while(1)\n {\n l=l+1;\n if(l>k-1)\n {\n break;\n }\n printf(\"%c\",s[l]);\n c=c-1;\n if(c<0)\n break;\n printf(\"%c\",s[c]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char s[53];\n scanf(\"%s\",s);\n int i=0;\n for(i=0;s[i]!='\\0';i++);\n int n=i;\n int a[120];\n int r=50;\n int l=50;\n for(i=0;i<n;i++){\n if(i%2==0){\n a[i]=l--;\n }\n else \n a[i]=++r;\n }\n for(int i=0;i<n;i++){\n printf(\"%c\",s[a[i]-l-1]);\n }\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char in[50];\n int n,m,i,j,d;\n scanf(\"%s\",&in);\n n=strlen(in);\n char out[n];\n if(n%2==0){\n m=(n/2)-1;\n }\n else{\n m=n/2;\n }\n out[0]=in[m];\n for(j=1;j<n;j++){\n if(j%2!=0){\n d=(j+1)/2;\n out[j]=in[m+d];\n }\n else{\n d=j/2;\n out[j]=in[m-d];\n }\n }\n for(j=0;j<n;j++){\n printf(\"%c\",out[j]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[50],a[1000]= \" \";\n scanf(\"%s\",str);\n int length,j=0,k=1;\n length=strlen(str);\n int i=((length-1)/2),h=(((length-1)/2)+1);\n do\n {\n do\n {\n a[j]=str[i];\n j=j+1;\n k=k+1;\n i--;\n break;\n }\n while(i>=0);\n do\n {\n a[j]=str[h];\n j=j+1;\n k=k+1;\n h++;\n break;\n }\n while(h<length-1);\n }\n while(k<=length);\n printf(\"%s\",a);\n return 0;\n}"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include <string.h>\nint main()\n{ char e[51];\n int pos=0;\n char c[51];\n scanf(\"%s\",c);\n int l=strlen(c);\n int s=0;\n int f=0;\n if(l%2==0){\n s=(l/2)-1;\n f=l/2;\n }\n else{\n s=l/2;\n f=(l/2)+1;\n }\n for(int i=0;i<l;i++){\n if(i%2==0)\n e[pos++]=c[s--];\n else\n e[pos++]=c[f++];\n }\n e[pos]='\\0';\n printf(\"%s\",e);\n return 0;\n}\n"}, {"source_code": "//Avanish K A\n//Cipher att2\n\n#include<stdio.h>\n#include<string.h>\n\nchar s[100];\n\nint decrypt(){\nint k=(strlen(s)-1)/2;\t\nchar x;\nif(strlen(s)==1){\n\tx=s[0];\n\tprintf(\"%c\",x); }\nelse{\nfor(int i=0;i<strlen(s);i++){\n\tif(i%2==0){\n\t\tx=s[k-i];\n\t\tk-=i;\n\t\tprintf(\"%c\",x); }\n\telse{\n\t\tx=s[k+i]; \n\t\tk+=i;\n\t\tprintf(\"%c\",x);}\n\t}\n\t}\nprintf(\"\\n\");\nreturn 0;\n}\n\nint main(){\ngets(s);\ndecrypt();\nreturn 0;\n}\t\n\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[53];\n scanf(\"%s\",s);\n int len=strlen(s);\n int fro=(len+1)/2-1;\n int rear=fro+1;\n /*if (len&1)\n {\n\n }\n else\n {\n while (fro>=0||rear<len)\n {\n if (rear<len) printf(\"%c\",s[rear++]);\n if (fro>=0) printf(\"%c\",s[fro--]);\n }\n }*/\n while (fro>=0||rear<len)\n {\n if (fro>=0) printf(\"%c\",s[fro--]);\n if (rear<len) printf(\"%c\",s[rear++]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n int main()\n{\n char right_left_string[50],first_char;\n int i,j,len;\n scanf(\"%s\",right_left_string);\n len=strlen(right_left_string);\n if(len%2==0)\n {\n i=len-2;\n }\n else\n {\n i=len-1;\n }\n for(i;i>0;i=i-2)\n {\n first_char=right_left_string[0];\n for(j=0;j<i;j++)\n {\n right_left_string[j]=right_left_string[j+1];\n }\n right_left_string[i]=first_char;\n}\n printf(\"%s\",right_left_string);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n\nint main(void){\n\n char s[64];\n int len, i, k;\n\n scanf(\"%s\", s);\n\n len = strlen(s);\n\n char t[64];\n\n if(len % 2 == 0){\n for(i = 0; i < len; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }else{\n t[len - 1] = s[0];\n for(i = 1; i < len - 1; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[(i / 2) + 1];\n i = k;\n }\n }\n\n for(i = 0; i < len; i++){\n printf(\"%c\", t[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[50];\n\tscanf(\"%s\",str);\n\tchar dec[50];\n\n\tint len=strlen(str);\n\t\n\tint q=0,w=0;\n\t\n\tw=(len/2)-1;\n\tq=(len/2);\n\n\t\n\t\t\n\tif(len%2==0)\n\t{\t\n\t\tw=(len/2)-1;\n\t\tq=(len/2);\n\n\n\t\tfor(int i=0;i<len;i++)\n\t\t{\n\t\t\t\n\t\t\t if(i%2==0)\n\t\t\t\t{\n\t\t\t\t\tdec[i]=str[w];\n\t\t\t\t\tw--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdec[i]=str[q];\n\t\t\t\t\tq++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\telse\n\t{\n\t\tw=len/2;\n\t\tq=(len/2)+1;\n\t\t\n\t\tfor(int k=0;k<len;k++)\n\t\t{\n\t\t\tif(k%2==0)\n\t\t\t{\n\t\t\t\tdec[k]=str[w];\n\t\t\t\tw--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdec[k]=str[q];\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\t\t\n\t\n\t\t\n\t\tfor(int i=0;i<len;i++)\n\t\tprintf(\"%c\",dec[i]);\n\t\n\t\n}"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[50],S[50];\n \n int mid;\n scanf(\"%s\",str);\n int len=strlen(str);\n if(len%2==0)\n mid=len/2;\n else\n mid=(len+1)/2;\n \n mid=mid-1;\n int j=1;\n S[0]=str[mid];\n\n for(int i=1;i<len;i++)\n {\n \n if(i%2==0)\n {\n S[i]=str[mid-j];\n j++;\n }\n else\n S[i]=str[mid+j];\n }\n \n char array[50];\n for(int i=0;i<len;i++)\n printf(\"%c\",S[i]);\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n\tint q;\n\tchar s[50];\n\tchar t[50];\n\tsf(\"%s\",s);\n\tq=strlen(s);\n\tif (q%2==0)\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t}\n\t}\n\telse\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t}\n\t}\n\tt[q]='\\0';\n\tprintf(\"%s\\n\",t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=(n%2==0)?n/2-1:n/2;\n j=(n%2==0)?n/2:n/2+1;\n \nwhile(i>=0 || j<n){\n if(i>=0){\n printf(\"%c\",a[i]);\n }\n if(j<n){\n printf(\"%c\",a[j]);\n }\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n\tchar t[51];\n\tint len,i,ind,temp;\n\tscanf(\"%s\",&t);\n\tlen = strlen(t);\n\tind = len/2;\n\tif(len<3)\n\t{\n\t\tprintf(\"%s\",t);\n\t}\n\telse\n\t{\n\t\tif(len%2==0)\n\t\t{\n\t\t\tind -= 1;\n\t\t}\n\t\ttemp = ind+1;\n\t\tif(len%2==0)\n\t\t{\n\t\t\twhile(ind!=0)\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t\t\tind--;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t}\n\t\telse{\n\t\t\twhile(ind!=0)\n\t\t\t{\n\t\t\t\tprintf(\"%c%c\",t[ind],t[temp]);\n\t\t\t\tind--;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t\tprintf(\"%c\",t[ind]);\n\t\t} \n\t\t\n\t}\n\t\n } "}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int t,n,i,j;\n char A[55];\n //printf(\"start\\n\");\n scanf(\"%d\",&t);\n //while(t--)\n\n scanf(\"%s\",A);\n n=strlen(A);\n i=(n-1)/2;\n j=1;\n printf(\"%c\",A[i]);\n while(i+j<n-1)\n {\n printf(\"%c\",A[i+j]);\n printf(\"%c\",A[i-j]);\n j++;\n }\n if(n%2==0)\n {\n printf(\"%c\",A[n-1]);\n }\n else\n printf(\"%c%c\",A[n-1],A[0]);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[100000],n,i,k,c=0,t;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]<=k)\n\t\t{\n\t\t\tc=c+1;\n\t\t}\n\t\telse if(a[i]>k)\n\t\t{\n\t\t\tt=i;\n\t\t\tbreak;\n\t\t}\n\n\t}\n\t\n\tfor(i=n-1;i>t;i--)\n\t{\n\t\tif(k>=a[i])\n\t\t{\n\t\t\tc=c+1;\n\t\t}\n\t\telse if(a[i]>k) break;\n\t}\n\tprintf(\"%d\",c);\n\treturn 0;\n}\t\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,c,n,d;\n char s[50];\n scanf(\"%s\",s);\n a=strlen(s);\n b=a/2;\n c=b-1;\n for(int i=0;i<a;i++)\n {\n if(i%2==0)\n {\n printf(\"%c\",s[c]);\n c-=1;\n }\n else\n { \n printf(\"%c\",s[b]);\n b+=1;\n }\n }\n return 0;\n}\n \n"}, {"source_code": "/*\n * three.c\n * \n * Copyright 2019 <examuser@11CPU0119L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tchar s[50],k[50];\n\tint i,j=0;\n\tscanf(\"%s\",s);\n\tif(strlen(s)%2!=0)\n\t{\n\t\tk[j]=s[strlen(s)/2];\n\t\tj++;\n\tfor(i=1;i<strlen(s);i++)\n\t{\n\t\tk[j]=s[strlen(s)/2+i];\n\t\tj++;\n\t\tk[j]=s[strlen(s)/2-i];\n\t\tj++;\n\t}\n\t}\n\telse\n\t{\n\tk[j]=s[strlen(s)/2-1];\n\tj++;\n\tfor(i=1;i<strlen(s)/2;i++)\n\t{\n\t\tk[j]=s[strlen(s)/2-1+i];\n\t\tj++;\n\t\tk[j]=s[strlen(s)/2-i-1];\n\t\tj++;\n\t}\n\t}\n\tprintf(\"%s\",k);\n\treturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[50],s[50];\n int l,i,j,k,m;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n \n if(l%2==0)\n {\n k=(l/2)-1;\n }\n else \n {\n k=l/2;\n }\n \n s[0]=t[k];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[k+j];\n s[i+1]=t[k-j];\n j++;\n }\n printf(\"%s\",s);\n \n m=strlen(s);\n \n \n s[m]='\\0';\n return 0;\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50];\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]!=a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[50],a[50]=\" \";\nscanf(\"%s\",s);\nint n,j=0,k=1;\nn=strlen(s);\nint i=((n-1)/2),h=(((n-1)/2)+1); \ndo\n{\n\t\n\t do\n\t\t{\n\t\t a[j]=s[i];\n\t\t j=j+1;\n\t\t k=k+1;\n\t\t i--;\n\t\t break;\n\t\t}while(i>=0);\n\t\n\tdo\n\t\t\t{\n\t\t\t a[j]=s[h];\n\t\t\t j=j+1;\n\t\t\t k=k+1;\n\t\t\t h++;\n\t\t\t break;\n\t\t\t \n\t\t\t}while(h<=n-1); \n}while(k<=n);\n\t\n\nprintf(\"%s\",a);\n\n\n\nreturn 0;\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n=0,a=1;\n\tchar t[51],s[51];\n\tscanf(\"%s\",t);\n\ts[0]=t[(strlen(t)-1)/2];\n\tint i;\n\tfor(i=1;i<strlen(t);i++)\n\t{\n\t\tn=(strlen(t)-1)/2;\n\t\tif(i%2!=0)\n\t\t{\n\t\t\ts[i]=t[n+a];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts[i]=t[n-a];\n\t\t\ta++;\n\t\t}\n\t}\n\ts[++i]='\\0';\n\n\tprintf(\"%s\",s);\n\treturn 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:13/04/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n char str[55],ans[55];\n scanf(\"%s\", str);\n int l=strlen(str);\n int i=0,f=0,k=0,j=0;\n l--;\n int l1=l;\n for(k=0;k<=l;k++)\n {\n if(f==1)\n ans[j++]=str[i++];\n else\n ans[j++]=str[l1--];\n f^=1;\n }\n //printf(\"%s\",ans);\n for(int i=l;i>=0;i--)\n printf(\"%c\",ans[i]);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n=0,a=1;\n\tchar t[51],s[51];\n\tscanf(\"%s\",t);\n\ts[0]=t[(strlen(t)-1)/2];\n\tint i;\n\tfor(i=1;i<strlen(t);i++)\n\t{\n\t\tn=(strlen(t)-1)/2;\n\t\tif(i%2!=0)\n\t\t{\n\t\t\ts[i]=t[n+a];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts[i]=t[n-a];\n\t\t\ta++;\n\t\t}\n\t}\n\ts[++i]='\\0';\n\n\tprintf(\"%s\",s);\n\treturn 0;\n}\n"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[50],s[50];\n scanf(\"%s\",t);\n int i,j,l,k=0;\n l=strlen(t);\n if(l%2==0)\n {\n j=l/2-1;\n \n }\n else\n {\n j=l/2;\n }\n for(i=0;i<l;i++)\n {\n s[i]=t[j];\n k++;\n if(i%2==0)\n j=j+k;\n else\n j=j-k;\n \n }\n printf(\"%s\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n=0,a=1;\n\tchar t[51],s[51];\n\tscanf(\"%s\",t);\n\ts[0]=t[(strlen(t)-1)/2];\n\tint i;\n\tfor(i=1;i<strlen(t);i++)\n\t{\n\t\tn=(strlen(t)-1)/2;\n\t\tif(i%2!=0)\n\t\t{\n\t\t\ts[i]=t[n+a];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts[i]=t[n-a];\n\t\t\ta++;\n\t\t}\n\t}\n\ts[++i]='\\0';\n\n\tprintf(\"%s\",s);\n\treturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[60],s[60];\n int l,i,j,temp;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n \n if(l%2==0)\n {\n \n s[0]=t[(l/2)-1];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[(l/2)-1+j];\n s[i+1]=t[(l/2)-1-j];\n j++;\n }\n printf(\"%s\",s);\n }\n else if (l%2!=0 && l!=1)\n {\n \n \n s[0]=t[(l/2)];\n if(l!=3)\n {\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[(l/2)+j];\n \n s[i+1]=t[(l/2)-j];\n \n j++;\n \n }\n \n \n printf(\"%s\",s);\n }\n else\n {\n temp=t[0];\n t[0]=t[1];\n t[1]=temp;\n temp=t[1];\n t[1]=t[2];\n t[2]=temp;\n strcpy(s,t);\n \n printf(\"%s\",s);\n }\n \n \n \n \n }\n else \n {\n s[0]=t[0];\n printf(\"%c\",s[0]);\n }\n \n return 0;\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\tchar a[100];\n\tscanf(\"%s\", a);\n\tint l = strlen(a);\n\tif(l%2 == 0)\n\t{\tint i,j;\n\t\tfor(i=l/2-1,j=l/2;i>=0,j<l;i--,j++)\n\t\t{\tprintf(\"%c\",a[i]);\n\t\t\tprintf(\"%c\",a[j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\telse\n\t{\tint i,j;\n\t\tprintf(\"%c\",a[l/2]);\n\t\tfor(i=l/2 -1,j=l/2 +1;i>=0,j<l;i--,j++)\n { printf(\"%c\",a[i]);\n printf(\"%c\",a[j]);\n } \n printf(\"\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,x,y,a,i,j=0;\n char t[50],d[50];\n scanf(\"%s\",t);\n strcpy(d,t);\n char s[50];\n l=strlen(t);\n for(i=0;i<d[i]!='\\0';i++)\n {\n t[i]=d[i];\n }\n if(l==1)\n {\n s[0]=t[0];\n \n }\n else\n {\n x=l/2;\n y=x-1;\n a=y+1;\n if(l%2==0)\n {\n for(i=0;i<x;i++)\n {\n \n s[j]=t[y];\n j++;\n s[j]=t[a];\n a++;\n y--;\n j++;\n }\n }\n else\n {\n y=x;\n a=x+1;\n for(i=0;i<x;i++)\n {\n \n s[j]=t[y];\n j++;\n s[j]=t[a];\n a++;\n y--;\n j++;\n }\n s[j]=y;\n \n }\n \n } \n for(i=0;i<l;i++)\n {\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n \n "}, {"source_code": "/*Sruthi Shyam\nAM.EN.U4CSE19055\nCSE A\nCodeforces problem 1085A Right Left Cipher*/\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar t[50];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tint m,i,j;\n\tm=(l/2)-1;\n\tprintf(\"%c\",t[m]);\n\tfor(i=m-1,j=m+1;i>=0||j<l;i--,j++)\n\t{\n\t\tprintf(\"%c%c\",t[j],t[i]);\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint y,b,r,i,k;\n\tscanf(\"%d %d %d\",&y,&b,&r);\n\tfor(i=1;i<=100;i++)\n\t{\n\t\tif(i<=y&&i+1<=b&&i+2<=r)\n\t\t{\n\t\t\tk=(3*i)+3;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar a[100],b[100];\nint l;\nscanf(\"%s\", a);\nl=strlen(a);\nfor(int i=0;i<l;i++)\n{\nif(i%2==0)\n{\nb[i]=a[(l+1)/2-i/2-1];\n}\nelse b[i]=a[(l+1)/2+i/2];\n}\nprintf(\"%s\", b);\n}\n\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[60],s[60];\n int l,i,j;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n if(l%2==0)\n {\n \n s[0]=t[(l/2)-1];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[(l/2)-1+j];\n s[i+1]=t[(l/2)-1-j];\n j++;\n }\n }\n else if (l%2!=0)\n {\n \n s[0]=t[(l/2)];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[(l/2)+j];\n s[i+1]=t[(l/2)-j];\n j++;\n }\n }\n printf(\"%s\",s);\n return 0;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[50],s1[50];scanf(\"%s\",s);\n\tint i,l,t,cnt=0;\n\tl=strlen(s);\n\tif(l%2==0) t=l/2-1;\t\n\telse t=(l/2);\n\tfor(i=0;i<l;i++)\n\t{\n\t\ts1[i]=s[t];\n\t\tcnt++;\n\t\tif(i%2==0)\n\t\t\tt=t+cnt;\n\t\telse\n\t\t\tt=t-cnt;\n\t\t\n\t}\n\tprintf(\"%s\",s1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define sf scanf \n#define pf printf\nint main()\n{\n\tint q;\n\tchar s[15];\n\tchar t[15];\n\tscanf(\"%s\",s);\n\tq=strlen(s);\n\tif (q%2==0)\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t}\n\t}\n\telse\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t}\n\t}\n\tpf(\"%s\\n\",t);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[50],b[25],c[25],d[50];\n\tscanf(\"%s\",a);\n\tint i,j,k,t;\n\tfor(i=0;a[i]!='\\0';i++);\n\tif(i%2==0)\n\t{\n\t\tif(i==2)\n\t\t{\n\t\t\tprintf(\"%c%c\",a[0],a[1]);\n\t\t\treturn 0;\n\t\t}\n\t\tfor(j=0;j<(i/2);j++)\n\t\tb[j]=a[j];\n\t\tk=j-1;\n\t\tfor(t=0;a[j]!='\\0';t++)\n\t\tc[t]=a[j++];\n\t\tj=0;\n\t\tfor(i=0;a[j]!='\\0';i++)\n\t\t{\n\t\t\tif(i%2==0)\n\t\t\t{\n\t\t\t\td[i]=b[k--];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td[i]=c[j++];\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(i==1)\n\t\t{\n\t\t\tprintf(\"%c\",a[0]);\n\t\t\treturn 0;\n\t\t}\n\t\tfor(j=0;j<(i/2);j++)\n\t\tb[j]=a[j];\n\t\tk=j-1;\n\t\tj++;\n\t\tfor(t=0;a[j]!='\\0';t++)\n\t\tc[t]=a[j++];\n\t\td[0]=a[i/2];\n\t\tj=0;\n\t\tfor(i=1;a[i]!='\\0';i++)\n\t\t{\n\t\t\tif(i%2==0)\n\t\t\t{\n\t\t\t\td[i]=b[k--];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td[i]=c[j++];\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;d[i]!='\\0';i++)\n\tprintf(\"%c\",d[i]);\n\treturn 0;\n}\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[50];\n int d,j=0,k=0,m=0;\n scanf(\"%s\",s);\n d = strlen(s);\n char g[d];\n if (d==3)\n {\n printf(\"%c%c%c\\n\",s[1],s[2],s[0]);\n }\n else\n {\n while(j<d)\n {\n if(j%2==0)\n {\n g[j]=s[d-m-1];\n m++;\n }\n else\n {\n g[j]=s[k];\n k++;\n }\n j++;\n }\n\n\n for(int i=d-1;i>=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50],v;\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]==a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[50],alpha[1000]= \" \";\n scanf(\"%s\",str);\n int length,j=0,k=1;\n length=strlen(str);\n int i=((length-1)/2),h=(((length-1)/2)+1);\n do\n {\n do\n {\n alpha[j]=str[i];\n j=j+1;\n k=k+1;\n i--;\n break;\n }\n while(i>=0);\n do\n {\n alpha[j]=str[i];\n j=j+1;\n k=k+1;\n h++;\n break;\n }\n while(h<length-1);\n }\n while(k<=length);\n printf(\"%s\",alpha);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n\nint main(void){\n\n char s[64];\n int len, i, k;\n\n scanf(\"%s\", s);\n\n len = strlen(s);\n\n char t[len];\n\n if(len % 2 == 0){\n for(i = 0; i < len; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }else{\n t[len - 1] = s[0];\n for(i = 1; i < len - 1; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }\n\n for(i = 0; i < len; i++){\n printf(\"%c\", t[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,n,m;\n char a[100],b[100];\n for(i=0;;i++)\n {\n scanf(\"%c\",&a[i]);\n if(a[i]=='\\n')\n {\n n=i+1;\n break;\n }\n }\n m=n/2-1;\n for(i=0;i<=m+1;i++)\n {\n if(i==0)\n {\n printf(\"%c\",a[m]);\n }\n else if(a[m+i]=='\\n'||a[m-i]=='\\n')\n continue;\n else\n {\n printf(\"%c\",a[m+i]);\n printf(\"%c\",a[m-i]);\n\n }\n\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint len,lim,i,j,ln;\nchar str[100];\nchar dummy[100];\nscanf(\"%s\",str);\nlen=strlen(str);\nln=strlen(dummy);\nfor(i=0;i<len;i++)\nfor(j=0;j<ln;j++)\n{\nif(len%2==0)\n{\n\tlen=strlen(str);\nlim=len/2;\nfor(int i=0; i<lim; i++)\n {\n dummy[j] += str[len-i-1];\n dummy[j] += str[i];\n }\n }\n else\n {\n len=strlen(str);\n lim = len/2;\n for(int i=0; i<lim; i++)\n {\n dummy[j] += str[i];\n dummy[j] += str[len-i-1];\n }\n dummy[ln]+= str[lim];\n }\n}\n printf(\"%s\",dummy);\n return 0;\n }\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n\nchar in[100];\nchar out[100];\n\nint main()\n{\n scanf(\"%s\",in);\n int len = strlen(in);\n printf(\"%d\\n\",len);\n int mid,flag = 1;\n if(len % 2 == 1){\n mid = len / 2;\n }else{\n mid = len / 2 - 1;\n }\n out[0] = in[mid];\n out[len] = '\\0';\n for(int i = 0; i < len-1;i++){\n out[i+1] = in[mid+flag*(i/2+1)];\n flag *= -1;\n }\n printf(\"%s\\n\",out);\n return 0;\n}\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n int n=strlen(a),i;\n int k=(n-1)/2;\n \n if(n=1)\n {\n printf(\"%c\",a[k]);\n exit(0);\n }\n for(i=0;i<=n/2;i++)\n {\n if(i==0)\n {\n printf(\"%c\",a[k]);\n continue;\n }\n if(k+i<n)\n {\n printf(\"%c\",a[k+i]);\n \n }\n if(k-i>=0)\n {\n printf(\"%c\",a[k-i]);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar t[50],s[50];\n\tscanf(\"%s\",t);\n\tint l=strlen(t),j=l-1;\n\tif(l==3)\n\t{\n\t\tprintf(\"%c%c%c\",t[1],t[2],t[0]);\n\t}\n\telse{\n\tfor(int i=l-1;i>=0;i--)\n\t{\n\t\ts[j]=t[i];\n\t\tj--;\n\t\ts[j]=t[l-i-1];\n\t\tj--;\n\t}\n\tfor(int i=0;i<l;i++){\n\tprintf(\"%c\",s[i]);}}\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i,c,d,e=0,f;\n\tchar a[1000],b[1000];\n\tgets(a);\n\tc=strlen(a);\n\td=c-2;\n\twhile(d>0){\n\t\tif(e==1)strcpy(a,b);\n\t\tstrset(b,NULL);\n\t\tfor(i=0;i<c;i++){\n\t\t\tb[i]=a[i];\n\t\t\tstrrev(b);\n\t\t}\n\t\tstrrev(b);\n\t\td--;e=1;\n\t}\n\tif(c==3){\n\t\tf=a[0];\n\t\tb[0]=a[1];\n\t\tb[1]=a[2];\n\t\tb[2]=f;\n\t}\n\tif(c<3)puts(a);\n\telse puts(b);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n int n=strlen(a),i;\n int k=(n-1)/2;\n \n if(n==1)\n {\n printf(\"%c\",a[k]);\n exit(0);\n }\n \n \n for(i=0;i<=n/2;i++)\n {\n if(i==0)\n {\n printf(\"%c\",a[k]);\n continue;\n }\n \n printf(\"%c\",a[k+i]);\n printf(\"%c\",a[k-i]);\n }\n if(n%2!=0)\n {\n printf(\"%c\",a[n-1]);\n }\n} \n \n \n \n \n \n "}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{\nint m,n=0,i,j=0,k;\nchar s[100],b[100];\nscanf(\"%s\",s);\n\nif(strlen(s)%2==0)\n\t{\n\tm=strlen(s)-1;\n\tk=m;\n\tfor(i=0;i<(m+1)/2;i++)\n\t\t{\n\t\tb[k]=s[m];\n\t\tb[k-1]=s[j];\n\t\tk=k-2;\n\t\tm=m-1;\n\t\tj++; \n\t\t}\t\n\t}\n\t\nputs(b);\nreturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[100];\n\tfgets(s, 100, stdin);\n\tchar final[100];\n\n\tint l=strlen(s)-1;\n\t\n\tint a=0,b=0;\n\t\n\tb=(l/2)-1;\n\ta=(l/2);\n\n\t\n\t\t\n\tif(l%2==0)\n\t{\t\n\t\tb=(l/2)-1;\n\t\ta=(l/2);\n\n\n\t\tfor(int i=0;i<l;i++)\n\t\t{\n\t\t\t\n\t\t\t if(i%2==0)\n\t\t\t\t{\n\t\t\t\t\tfinal[i]=s[b];\n\t\t\t\t\tb--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tfinal[i]=s[a];\n\t\t\t\t\ta++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\telse\n\t{\n\t\tb=l/2;\n\t\ta=(l/2)+1;\n\t\t\n\t\tfor(int k=0;k<l;k++)\n\t\t{\n\t\t\tif(k%2==0)\n\t\t\t{\n\t\t\t\tfinal[k]=s[b];\n\t\t\t\tb--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfinal[k]=s[a];\n\t\t\t\ta++;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\t\t\n\t\n\t\tprintf(\"%s\\n\",final);\n\t\n\t\n}\n"}, {"source_code": "\n\n#include <stdio.h>\n#include <string.h>\nint main(int argc, char **argv)\n{\n\tchar t[50];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tchar s[l];\n\tint i=l/2-1,j=l/2,k;\n\tif(l==1)\n\t\tprintf(\"%s\",t);\n\t\telse\n\t\t{\n\tfor(k=0;k<l;k++)\n\t{\n\t\tif(k%2==0)\n\t\t{\n\t\t\ts[k]=t[i];\n\t\t\ti--;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\ts[k]=t[j];\n\t\t\tj++;\t\n\t\t}\n\t\t\n\t}\n\tfor(i=0;i<l;i++)\n\t{\n\t\tprintf(\"%c\",s[i]);\n\t}\n\tprintf(\"\\n\");\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main ()\n{\n int len,len2,i,c=1 ;\n char string[1001] ;\n scanf(\"%s\",&string) ;\n len=strlen(string) ;\n len2=(len-1)/2 ;\n printf(\"%c\",string[len2]) ;\n for(i=len2 ; i<len-1 ; i++){\n printf(\"%c\",string[len2+c]) ;\n if(i==(len-2)){\n printf(\"\\n\") ;\n break ;\n }\n else if(i != (len-2)){\n printf(\"%c\",string[len2-c]) ;\n c++;\n }\n }\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,c,n,d;\n char s[50];\n scanf(\"%s\",s);\n a=strlen(s);\n b=a/2;\n c=b-1;\n if(a!=1)\n for(int i=0;i<a;i++)\n {\n if(i%2==0)\n {\n printf(\"%c\",s[c]);\n c-=1;\n }\n else\n { \n printf(\"%c\",s[b]);\n b+=1;\n }\n }\n else\n printf(\"%c\",s[0]);\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\nint get_int();\n\nint max(int a, int b)\n{\n\tif (a > b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint min(int a, int b)\n{\n\tif (a < b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint main()\n{\n\tchar c;\n\tchar r[512];\n\tchar s[64];\n\tc = getchar();\n\tint i = 0;\n\twhile (c != 10)\n\t{\n\t\ts[i++] = c;\n\t\tc = getchar();\n\t}\n\ts[i] = '\\0';\n\tint n = i;\n\tint r1 = (n + 1)/2;\n\tint r2 = r1 - 1;\n\tint p = 0;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (p == 1)\n\t\t{\n\t\t\tputchar(s[r1++]);\n\t\t\tp = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tputchar(s[r2--]);\n\t\t\tp = 1;\n\t\t}\n\t}\n\tr[r1] = '\\0';\n\tprintf(\"%s\\n\", &(r[r2]));\n\n\n\treturn 0;\n}\n\n\n\nint get_int()\n{\n\tint ret = 0;\n\tchar c = getchar();\n\tint sgn;\n\n\twhile (1)\n\t{\n\t\tif (c == EOF)\n\t\t{\n\t\t\treturn EOF;\n\t\t}\n\t\tif (c >= '0' && c <= '9')\n\t\t{\n\t\t\tsgn = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = getchar();\n\n\t\t\tif (c < '0' || c > '9')\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsgn = -1;\n\t\t\tbreak;\n\t\t}\n\t\tc = getchar();\n\t}\n\n\twhile (1)\n\t{\n\t\tret = (ret << 3) + (ret << 1) + c - '0';\n\n\t\tc = getchar();\n\n\t\tif (c < '0' || c > '9')\n\t\t{\n\t\t\treturn sgn*ret;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int k,m,p,l;\n char a[51];\n scanf(\"%s\",&a);\n m=strlen(a);\n if(m==1)\n printf(\"%c\",a[0]);\n else\n {\n p=m-2;\n if(m%2==0)\n k=m/2-1;\n else\n k=m/2;\n l=k+1;\n printf(\"%c%c\",a[k],a[l]);\n while(p>0)\n {\n if(k-1>=0)\n {\n printf(\"%c\",a[k-1]);\n p--;\n k--;\n }\n if(l+1<=m)\n {\n printf(\"%c\",a[l+1]);\n p--;\n l++;\n }\n }\n \n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char string[50];\n int length,l,i;\n scanf(\"%s\",string);\n length=strlen(string);\n l=length/2;\n if(length%2==0)\n {\n for(i=0;i<=l;i++)\n {\n printf(\"%c\",string[l-i-1]);\n printf(\"%c\",string[l+i]);\n }\n }\n else\n {\n printf(\"%c\",string[l]);\n for(i=0;i<l;i++)\n {\n printf(\"%c\",string[l-i-1]);\n printf(\"%c\",string[l+1+i]);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[50],s1[50];scanf(\"%s\",s);\n\tint i,l,t,cnt=0;\n\tl=strlen(s);\n\tif(l%2==0) t=l/2-1;\t\n\telse t=(l/2);\n\tfor(i=1;i<=l;i++)\n\t{\n\t\ts1[i]=s[t];\n\t\tcnt++;\n\t\tif(i%2==0)\n\t\t\tt=t-cnt;\n\t\telse\n\t\t\tt=t+cnt;\n\t\t\n\t}\n\ts[l+1]='\\0';\n\tprintf(\"%s\",s1);\n return 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\n\nunsigned int a=0;//\u043a\u043e\u043b-\u0432\u043e cnhjr\nunsigned int b=0;//\u043a\u043e\u043b-\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432\nunsigned int len=0, a_0=0;\nunsigned char str_in[60], str_out[60];\n\nunsigned int ad, lst,count,len,ost,dlina;\n\nint main()\n{\n scanf(\"%s\", str_in);\n \n len=strlen(str_in);\n a_0=len/2-1;\n str_out[0]=str_in[a_0];\n \n if(len>1)\n {\n for(int i=1;i<len;i++)\n {\n if((i%2)==0)\n {\n a_0=a_0-i;\n str_out[i]=str_in[a_0];\n }\n else\n {\n a_0=a_0+i;\n str_out[i]=str_in[a_0];\n }\n }\n \n }\n else if(len==1)\n {\n printf(\"%s\",str_in);\n }\n \n printf(\"%s\",str_out);\n \n \n \n \n \n \n \n \n \n \n \n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[50],b[50];\n int i,n,m,k=0,c;\n //scanf(\"%d\",&n);\n //for(i=0;i<n;i++)\n //{\n scanf(\"%s\",&s);\n //}\n n=strlen(s);\n m=n/2;\n c=n/2;\n b[k]=s[m];\n k++;\n while(k<=n)\n {\n b[k]=s[m+1];\n k++;\n b[k]=s[c-1];\n k++;\n m++;\n c--;\n }\n printf(\"%s\",b);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i,c,d,e=0;\n\tchar a[100000],b[100000],f;\n\tgets(a);\n\tc=strlen(a);\n\td=c-2;\n\twhile(d>0){\n\t\tif(e==1)strcpy(a,b);\n\t\tstrset(b,NULL);\n\t\tfor(i=0;i<c;i++){\n\t\t\tb[i]=a[i];\n\t\t\tstrrev(b);\n\t\t}\n\t\tstrrev(b);\n\t\td--;e=1;\n\t}\n\tif(c==3){\n\t\tf=a[0];\n\t\tb[0]=a[1];\n\t\tb[1]=a[2];\n\t\tb[2]=f;\n\t}\n\tif(c<3)puts(a);\n\telse puts(b);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[51];\n gets(s);\n int l=strlen(s)-1;\n \n int i,m;\n if (l%2==0)\n m=(l/2)-1;\n else\n m=l/2;\n \n printf(\"%c\",s[m]);\n for (i=1;i<l;i++)\n { \n\t if (i%2!=0)\n\t m+=i;\n\t else\n\t m-=i;\n\t printf(\"%c\",s[m]);\n }\n\treturn 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=n/2-1;\n j=n/2;\n \nwhile(i>=0 || j<n){\n if(i>=0){\n printf(\"%c%c\",a[i],a[j]);\n }else{\n printf(\"%c\",a[j]);\n }\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{\nint m,n=0,i,j=0,k;\nchar s[100];\nscanf(\"%s\",s);\nchar b[strlen(s)];\nfor(i=0;i<strlen(b);i++)\n{\nb[i]=\" \";\n}\nif(strlen(s)%2==0)\n\t{\n\tm=strlen(s)-1;\n\tk=m;\n\tfor(i=0;i<(m+1)/2;i++)\n\t\t{\n\t\tb[k]=s[m];\n\t\tb[k-1]=s[j];\n\t\tk=k-2;\n\t\tm=m-1;\n\t\tj++; \n\t\t}\t\n\t}\nputs(b);\nreturn 0;\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int len,c;\n char a[50],b[50];\n scanf(\"%s\",a);\n len=strlen(a);\n if(len%2!=0)\n {\n for(int i=0;i<len;i++)\n {\n\t if(i%2==0)\n\t { c=(len/2)-(i/2) ;\n\t\t b[i]=a[c];\n\t }\n\t else\n\t { c=(len/2)+((i+1)/2) ;\n\t\t b[i]=a[c];\n\t }\n }\n }\n else\n {\n\t for(int i=0;i<len;i++)\n {\n\t if(i%2==0)\n\t { c=(len/2)-(i/2) ;\n\t\t b[i]=a[c-1];\n\t }\n\t else\n\t { c=(len/2)+((i+1)/2) ;\n\t\t b[i]=a[c-1];\n\t }\n }\n }\n puts(b);\n return 0;\n }\n \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main ()\n{\n char s[52],a,b;\n int len,i,j,k,c=0;\n scanf(\" %[^\\n]\", s);\n len=strlen(s);\n if(len==1)\n {\n printf(\"%s\\n\",s);\n }\n else\n {\n k=len/2;\n if(len%2==0)\n {\n for(i=k-1,j=k; i>=0,s[j]!='\\0'; i--,j++)\n {\n a=s[i];\n b=s[j];\n putchar(a);\n putchar(b);\n\n }\n }\n else\n {\n for(i=k,j=k+1; i>=0,j<=len; i--,j++)\n {\n a=s[i];\n if(j<len)\n {\n b=s[j];\n }\n else\n {\n b='\\0';\n }\n putchar(a);\n putchar(b);\n\n }\n }\n printf(\"\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char a[51];\n scanf(\"%s\",a);\n int n,i,j;\n n=strlen(a);\n if(n%2)\n {i=(n-2)/2+1;}\n else\n {i=(n-2)/2;}\n j=i+1;\n if(i==1 && n==1)\n {i--;j--;}\n for(;i>=0||j<n;i--,j++)\n {\n printf(\"%c%c\",a[i],a[j]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n char str[1000];\n int i, s, mid_index;\n\n gets(str);\n\n s = strlen(str);\n\n if(s%2) mid_index = floor( (s-1)/2 );\n else mid_index = (s/2) - 1;\n\n for(i=0 ; i<=mid_index ;i++)\n {\n printf(\"%c%c\",str[mid_index -i],str[mid_index + i+1]);\n }\n\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[50],s[50];\n int l,i,j,k,m;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n \n if(l%2==0)\n {\n k=(l/2)-1;\n }\n else \n {\n k=l/2;\n }\n \n s[0]=t[k];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[k+j];\n s[i+1]=t[k-j];\n j++;\n }\n printf(\"%s\",s);\n \n m=strlen(s);\n \n \n s[m]='\\0';\n return 0;\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n\nint main(void){\n\n char s[64];\n int len, i, k;\n\n scanf(\"%s\", s);\n\n len = strlen(s);\n\n char t[len];\n\n if(len % 2 == 0){\n for(i = 0; i < len; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }else{\n t[len - 1] = s[0];\n for(i = 1; i < len - 1; i++){\n t[len - 1 - i] = s[len - 1 - (i / 2)];\n k = i + 1;\n t[len - 1 - k] = s[i / 2];\n i = k;\n }\n }\n\n for(i = 0; i < len; i++){\n printf(\"%c\", t[i]);\n }\n printf(\"\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main ()\n{\n char s[52],a,b;\n int len,i,j,k,c=0;\n scanf(\" %[^\\n]\", s);\n len=strlen(s);\n if(len==1)\n {\n printf(\"%s\\n\",s);\n }\n else\n {\n k=len/2;\n if(len%2==0)\n {\n for(i=k-1,j=k; i>=0,s[j]!='\\0'; i--,j++)\n {\n a=s[i];\n b=s[j];\n putchar(a);\n putchar(b);\n\n }\n s[len]='\\0';\n }\n else\n {\n for(i=k,j=k+1; i>=0,j<=len; i--,j++)\n {\n a=s[i];\n b=s[j];\n putchar(a);\n putchar(b);\n\n }\n s[len]='\\0';\n }\n printf(\"\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\n\tchar s[1000],ans[1000];\n\tint i,j,k,len;\n\twhile(gets(s)!=NULL)\n\t{\n\t\tlen=strlen(s);\n\t\ti=k=0,j=len-1;\n\t\tif(len%2==1)\n\t\t{\n\t\t\twhile(i<j)\n\t\t\t{\n\t\t\t\tans[k++]=s[i++];\n\t\t\t\tans[k++]=s[j--];\n\t\t\t\tif(i==j)\n\t\t\t\t{\n\t\t\t\t\tans[k++]=s[i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n while (i < j) {\n ans[k++] = s[j--];\n ans[k++] = s[i++];\n }\n }\n for (i = len - 1; i >= 0; i--) printf(\"%c\", ans[i]);\n printf(\"\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[50],b[25],c[25],d[50];\n\tscanf(\"%s\",a);\n\tint i,j,k,t;\n\tfor(i=0;a[i]!='\\0';i++);\n\tif(i%2==0)\n\t{\n\t\tfor(j=0;j<(i/2);j++)\n\t\tb[j]=a[j];\n\t\tk=j-1;\n\t\tfor(t=0;a[j]!='\\0';t++)\n\t\tc[t]=a[j++];\n\t\tj=0;\n\t\tfor(i=0;a[j]!='\\0';i++)\n\t\t{\n\t\t\tif(i%2==0)\n\t\t\t{\n\t\t\t\td[i]=b[k--];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td[i]=c[j++];\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(i==1)\n\t\t{\n\t\t\tprintf(\"%c\",a[0]);\n\t\t\treturn 0;\n\t\t}\n\t\tfor(j=0;j<(i/2);j++)\n\t\tb[j]=a[j];\n\t\tk=j-1;\n\t\tj++;\n\t\tfor(t=0;a[j]!='\\0';t++)\n\t\tc[t]=a[j++];\n\t\td[0]=a[(i/2)+1];\n\t\tj=0;\n\t\tfor(i=1;a[i]!='\\0';i++)\n\t\t{\n\t\t\tif(i%2!=0)\n\t\t\t{\n\t\t\t\td[i]=b[k--];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\td[i]=c[j++];\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;d[i]!='\\0';i++)\n\tprintf(\"%c\",d[i]);\n\treturn 0;\n}\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n=0,a=1;\n\tchar t[51],s[51];\n\tscanf(\"%s\",t);\n\ts[0]=t[(strlen(t)-1)/2];\n\tint i;\n\tfor(i=1;i<strlen(t);i++)\n\t{\n\t\tn=(strlen(t)-1)/2;\n\t\tif(i%2!=0)\n\t\t{\n\t\t\ts[i]=t[n+a];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts[i]=t[n-a];\n\t\t\ta++;\n\t\t}\n\t}\n\ts[i+1]='\\0';\n\n\tprintf(\"%s\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main() {\n char s[51];\n scanf(\"%s\",s);\n int k=strlen(s);\n int s1,cnt=1;\n if(k%2==0)\n s1=k/2-1;\n else\n s1=k/2;\n int x=s1+1,y=s1-1;\n printf(\"%c\",s[s1]);\n while(cnt<=k)\n {\n \n printf(\"%c\",s[x]);\n x++;\n cnt++;\n if(cnt<=k)\n {printf(\"%c\",s[y]);\n y--;\n cnt++;\n }\n \n }\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char s[51],b[51];\n int i,n,m,k=0,p;\n scanf(\"%s\",s);\n n=strlen(s);\n\tif(n%2==0)\n\t{\n\t\tm=n/2-1;\n\t}\n\telse\n\t{\n\t\tm=n/2;\n\t}\n\tp=m-1;\n\tb[k]=s[m];\n\tk++;\n\twhile(k<n)\n\t{\n\t\tb[k]=s[m+1];\n\t\tk++;\n\t\tm++;\n\t\tb[k]=s[p];\n\t\tk++;\n\t\tp--;\n\t}\n\tprintf(\"%s\",b);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid string(char s1[100],char s2[100]);\n\nint main()\n{\n\tchar s1[100],s2[100];\n\tscanf(\"%s\",s1);\n\tif(strlen(s1) == 1)\n\t {\n\t puts(s1);\n\t return 0;\n\t }\n\tstring(s1,s2);\n\tprintf(\"%s\\n\",s2);\n\treturn 0;\n}\n\nvoid string(char s1[100],char s2[100])\n{\n\tint len=strlen(s1),i,l,right,left;\n\tif(len%2 == 0)\n\t{\t\n\t\tl=(len/2)-1;\n\t\tright=l+1;\n\t\tleft=l-1;\n\t\ts2[0] = s1[l];\n\t\ti =1;\n\t\twhile(right<len || left>=0)\n\t\t{\n\t\t\ts2[i] = s1[right];\n\t\t\ti++;\t\t\t\n\t\t\ts2[i] = s1[left];\n\t\t\ti++;\n\t\t\tright++;\n\t\t\tleft--;\n\t\t}\n\treturn;\n\t}\n\telse\n\t{\n\t\tl =(len/2);\n\t\tright=l+1;\n\t\tleft=l-1;\n\t\ts2[0] = s1[l];\n\t\ti =1;\n\t\twhile(right<len || left>=0)\n\t\t{\n\t\t\ts2[i] = s1[right];\n\t\t\ti++;\t\t\t\n\t\t\ts2[i] = s1[left];\n\t\t\ti++;\n\t\t\tright++;\n\t\t\tleft--;\n\t\t}\n\treturn;\t\t\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[50];\n int d,j=0,k=0,m=0;\n scanf(\"%s\",s);\n d = strlen(s);\n char g[d];\n if (d==3)\n {\n printf(\"%c%c%c\\n\",s[1],s[2],s[0]);\n }\n else\n {\n while(j<d)\n {\n if(j%2==0)\n {\n g[j]=s[d-m-1];\n m++;\n }\n else\n {\n g[j]=s[k];\n k++;\n }\n j++;\n }\n\n\n for(int i=d-1;i>=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int k,m,p,l;\n char a[51];\n scanf(\"%s\",&a);\n m=strlen(a);\n if(m==1)\n printf(\"%c\",a[0]);\n else\n {\n p=m-2;\n if(m%2==0)\n k=m/2-1;\n else\n k=m/2;\n l=k+1;\n printf(\"%c%c\",a[k],a[l]);\n while(p>0)\n {\n if(k-1>=0)\n {\n printf(\"%c\",a[k-1]);\n p--;\n k--;\n }\n if(l+1<=m)\n {\n printf(\"%c\",a[l+1]);\n p--;\n l++;\n }\n }\n \n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[50];\n gets(c);\n int n,i,j,k,m;\n n=strlen(c);\n char s[n+1];\n if(n>2)\n {\n m=(n/2)-1;\n s[0]=c[m];\n \n for(i=n/2,j=m-1,k=1;(i<=n-1,j>-1,k<=n-1);i++,j--,k++)\n {\n s[k]=c[i];\n if(k<n-1)\n {\n k++;\n s[k]=c[j];\n }\n \n }\n }\n if(n==1)\n s[0]=c[0];\n s[n]='\\0';\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "\n\n#include <stdio.h>\n#include <string.h>\nint main(int argc, char **argv)\n{\n\tchar t[50];\n\tscanf(\"%s\",t);\n\tint l=strlen(t);\n\tchar s[l];\n\tint i=l/2-1,j=l/2,k;\n\tfor(k=0;k<l;k++)\n\t{\n\t\tif(k%2==0)\n\t\t{\n\t\t\ts[k]=t[i];\n\t\t\ti--;\n\t\t}\n\t\t\n\t\telse\n\t\t{\n\t\t\ts[k]=t[j];\n\t\t\tj++;\t\n\t\t}\n\t\t\n\t}\n\tprintf(\"%s\\n\",s);\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main() {\n char s[51];\n scanf(\"%s\",s);\n int k=strlen(s);\n int s1,cnt=1;\n if(k%2==0)\n s1=k/2-1;\n else\n s1=k/2;\n int x=s1+1,y=s1-1;\n printf(\"%c\",s[s1]);\n while(cnt<=k)\n {\n \n printf(\"%c\",s[x]);\n x++;\n cnt++;\n if(cnt<=k)\n printf(\"%c\",s[y]);\n y--;\n cnt++;\n \n \n }\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char a[51];\n scanf(\"%s\",a);\n int n,i,j;\n n=strlen(a);\n if(n%2)\n {i=(n-2)/2+1;}\n else\n {i=(n-2)/2;}\n j=i+1;\n if(i==1 && n==1)\n {i--;j--;}\n for(;i>=0||j<n;i--,j++)\n {\n printf(\"%c%c\",a[i],a[j]);\n }\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[50],s[50];\n int l,i,j,k,temp;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n \n if(l%2==0)\n {\n k=(l/2)-1;\n }\n else \n {\n k=l/2;\n }\n \n s[0]=t[k];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[k+j];\n s[i+1]=t[k-j];\n j++;\n }\n printf(\"%s\",s);\n \n \n \n \n \n return 0;\n}\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[50];\n int d,j=0,k=0,m=0;\n scanf(\"%s\",s);\n d = strlen(s);\n char g[d];\n while(j<d)\n {\n if(j%2==0)\n {\n g[j]=s[d-m-1];\n m++;\n }\n else\n {\n g[j]=s[k];\n k++;\n }\n j++;\n }\n\n\n for(int i=d-1;i>=0;i--)\n {\n printf(\"%c\",g[i]);\n }\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50],v;\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]==a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[50],S[50];\n \n int mid;\n scanf(\"%s\",str);\n int len=strlen(str);\n if(len%2==0)\n mid=len/2;\n else\n mid=(len+1)/2;\n \n mid=mid-1;\n int j=1;\n S[0]=str[mid];\n\n for(int i=1;i<len;i++)\n {\n \n if(i%2==0)\n {\n S[i]=str[mid-j];\n j++;\n }\n else\n S[i]=str[mid+j];\n }\n \n char array[50];\n for(int i=0;i<len;i++)\n array[i]=S[i];\n puts(array);\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,a,l=0,r=0,z=0,j=1;\n char s[100],q[100];\n scanf(\"%s\",s);\n a=strlen(s);\n int x=a/2;\n q[0]=s[x];\n if (a%2==0){\n x=x-1;\n r=x+1;\n l=x-1;\n while(i!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n i=i+2;\n r++;l--;\n }\n printf(\"%s\",q);}\n else\n {\n r=x+1;\n l=x-1;\n while(j!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n r++;l--;\n }\n printf(\"%s\",q);}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,a,l=0,r=0,z=0,j=1;\n char s[100],q[100];\n scanf(\"%s\",s);\n a=strlen(s);\n int x=a/2;\n q[0]=s[x];\n if(a==1)\n {\n printf(\"%c\",s[0]);\n }\n else if (a%2==0){\n x=x-1;\n q[0]=s[x];\n r=x+1;\n l=x-1;\n while(i!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n i=i+2;\n r++;l--;\n }\n printf(\"%s\",q);}\n else\n {\n r=x+1;\n l=x-1;\n while(j!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n r++;l--;\n }\n printf(\"%s\",q);}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,len;\n char in[55],out[55];\n scanf(\"%s\",out);\n len=strlen(out);\n\n if(len%2)\n {\n for(i=len-1;i>=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i<len-1;i=i+2,j++)\n {\n in[i]=out[j];\n }\n }\n else\n {\n for(i=len-2;i>=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i<len;i=i+2,j++)\n {\n in[i]=out[j];\n }\n }\n in[i]='\\0';\n\n printf(\"%s\",in);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,x,y,a,i,j=0;\n char t[50],d[50];\n scanf(\"%s\",t);\n strcpy(d,t);\n for(i=0;i<d[i]!='\\0';i++)\n {\n t[i]=d[i];\n }\n char s[50];\n l=strlen(t);\n x=l/2;\n y=x-1;\n a=y+1;\n for(i=0;i<x;i++)\n {\n \n s[j]=t[y];\n j++;\n s[j]=t[a];\n a++;\n y--;\n j++;\n }\n for(i=0;i<l;i++)\n {\n printf(\"%c\",s[i]);\n }\n return 0;\n}\n \n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[50];\nint start;\nscanf(\"%s\",s);\nint l=strlen(s);\nchar a[l];\nif(l%2==0)\nstart=(l/2)-1;\nelse\nstart=((l+1)/2)-1;\na[0]=s[start];\nint count=1;\nfor(int i=1;i<((l-1)/2)+2;i++){\n\tif(start>=0 || start <l){\n\ta[count]=s[start+i];\n\tcount++;\n\ta[count]=s[start-i];\n\tcount++;}\n\telse\n\t\tbreak;\n}\t\nprintf(\"%s\",a);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tchar ch[50],ench[50];\n\tint i=1,j=0;\n\tscanf(\"%s\",ench);\n\n\tif(strlen(ench)%2!=0){\n\t\tch[j]=ench[strlen(ench)/2]; j++;\n\twhile(i<=strlen(ench)/2+1){\n\t\tch[j]=ench[strlen(ench)/2+i]; j++;\n\t\tch[j]=ench[strlen(ench)/2-i]; j++;\n\t\ti++;\n\t}\n\t}\n\n\telse{\n\tch[j]=ench[strlen(ench)/2-1];\n\tj++;\n\twhile(i<=strlen(ench)/2+1){\n\t\tch[j]=ench[strlen(ench)/2-1+i]; j++;\n\t\tch[j]=ench[strlen(ench)/2-i-1]; j++;\n\t\ti++;\n\t }\n\t}\n\n\tprintf(\"%s\",ch);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\nint main()\n{\n\tchar s[1000],ans[1000];\n\tint i,j,k,len;\n\twhile(gets(s)!=NULL)\n\t{\n\t\tlen=strlen(s);\n\t\ti=k=0,j=len-1;\n\t\tif(len%2==1)\n\t\t{\n\t\t\twhile(i<j)\n\t\t\t{\n\t\t\t\tans[k++]=s[i++];\n\t\t\t\tans[k++]=s[j--];\n\t\t\t\tif(i==j)\n\t\t\t\t{\n\t\t\t\t\tans[k++]=s[i];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n while (i < j) {\n ans[k++] = s[j--];\n ans[k++] = s[i++];\n }\n }\n for (i = len - 1; i >= 0; i--) printf(\"%c\", ans[i]);\n printf(\"\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint len;\n\tchar s[51];\n\tscanf(\"%s\",s);\n\tprintf(\"%s\",s);\n\tlen=strlen(s);\n\tchar t[len];\n\tint i=0;\n\tint j=len-1;\n\tint k=len-1;\n\tif(len%2==0)\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t}\n\t}\n\telse\n\t{\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\tk--;i++;\n\t\t\tt[k]=s[j];\n\t\t\tk--;j--;\n\t\t}\n\t}\n\tt[len]='\\0';\n\tprintf(\"%s\",t);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint rev(char g[]);\nint main()\n{\n char s[50],g[50];\n int d,j=0,k=0,m=0;\n scanf(\"%s\",s);\n d = strlen(s);\n while(j<d)\n {\n if(j%2==0)\n {\n g[j]=s[d-m-1];\n m++;\n }\n else\n {\n g[j]=s[k];\n k++;\n }\n j++;\n\n }\n printf(\"%s\\n\",g );\n rev(g);\n}\n\nint rev(char f[])\n{\n for(int i=strlen(f)-1;i>=0;i--)\n {\n printf(\"%c\",f[i]);\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\tchar a[100];\n\tscanf(\"%s\", a);\n\tint l = strlen(a);\n\tif(l%2 == 0)\n\t{\tint i,j;\n\t\tfor(i=l/2-1,j=l/2;i>=0,j<l;i--,j++)\n\t\t{\tprintf(\"%c\",a[i]);\n\t\t\tprintf(\"%c\",a[j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\telse\n\t{\tint i,j;\n\t\tprintf(\"%c\",a[l/2]);\n\t\tfor(i=l/2 -1,j=l/2 +1;i>=0,j<l;i--,j++)\n { printf(\"%c\",a[i]);\n printf(\"%c\",a[j]);\n } \n printf(\"\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[50];\n int n,c=0;\n scanf(\"%s\",&s);\n n=strlen(s);\n if(n==1){\n printf(\"%c\",s[0]);\n return 0;\n }\n printf(\"%c\",s[(n/2)-1]);\n for(int i=1;i<(n/2)+1;i++){\n if((n/2)-1+i<n)\n printf(\"%c\",s[(n/2)-1+i]);\n if((n/2)-1-i>=0)\n printf(\"%c\",s[(n/2)-1-i]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[101];int flag=0;\n scanf(\"%s\",s);\n int i;\n for(i=0;i<strlen(s);i++){\n if(s[i]=='n')\n continue;\n else if(s[i]!='a' && s[i]!='e' && s[i]!='i' && s[i]!='o' && s[i]!='u'){\n if(s[i+1]!='a' && s[i+1]!='e' && s[i-\n 1]!='i' && s[i+1]!='o' && s[i+1]!='u')\n { flag=1;\n break;}\n }\n\n}\n if(flag==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\nchar s[100];\nint l,i=0,n;\nscanf(\"%s\",&s);\nl=strlen(s);\nn=l-1;\nwhile(i<l-1)\n{\nif((n-1)%2==0)\n {\n printf(\"%c\",s[l-1]);\n l--;\n }\nif((n-1)%2==1)\n {\n printf(\"%c\",s[i]);\n i++;\n } \nn--;\n}\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=n/2-1;\n j=n/2;\n \nwhile(i>=0 || j<n){\n printf(\"%c%c\",a[i],a[j]);\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define sf scanf \n#define pf printf\nint main()\n{\n\tint q;\n\tchar s[100];\n\tchar t[100];\n\tscanf(\"%s\",s);\n\tq=strlen(s);\n\tif (q%2==0)\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t}\n\t}\n\telse\n\t{\n\t\tint i=0,j=q-1,k=q-1;\n\t\twhile(k>=0)\n\t\t{\n\t\t\tt[k]=s[i];\n\t\t\ti++;\n\t\t\tk--;\n\t\t\tt[k]=s[j];\n\t\t\tj--;\n\t\t\tk--;\n\t\t}\n\t}\n\tpf(\"%s\",t);\n\treturn 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char s1[100],s2[100];\n int i,j,t=0,l;\n scanf(\"%s\",s1);\n l=strlen(s1);\n i=(l+1)/2 -1,j=(l+1)/2;\n if(l==1)\n {\n printf(\"%s\",s1);\n }\n while(i>=0&&j<l)\n {\n\t\ts2[t++]=s1[i--];\n\t\ts2[t++]=s1[j++];\n }\n if(i>=0)\n {\n\t\twhile(i>=0)\n\t\ts2[t++]=s1[i--];\n\t}\n\tif(j<l)\n\t{\n\t\twhile(j<l)\n\t\ts2[t++]=s1[j++];\n\t}\n\t\n printf(\"%s\",s2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,len;\n char in[55],out[55];\n scanf(\"%s\",out);\n len=strlen(out);\n\n if(len%2)\n {\n for(i=len-1;i>=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i<len-1;i=i+2,j++)\n {\n in[i]=out[j];\n }\n }\n else\n {\n for(i=len-2;i>=0;i=i-2,j++)\n {\n in[i]=out[j];\n }\n for(i=1;i<len;i=i+2,j++)\n {\n in[i]=out[j];\n }\n }\n in[i-1]='\\0';\n\n printf(\"%s\",in);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[65],ans[65],temp[1];\n int l,i,j,size;\n scanf(\"%s\",str);\n l=strlen(str);\n size=l/2;\n if(l%2==0){\n for(i=0;i<size;i++){\n strncat(ans,&str[l-i-1],1);\n strncat(ans,&str[i],1);\n }\n }\n else{\n for(i=0;i<size;i++){\n strncat(ans,&str[i],1);\n strncat(ans,&str[l-i-1],1);\n }\n strncat(ans,&str[size],1);\n }\n for(j = l - 1; j >= 0; j--) {\n printf(\"%c\", ans[j]);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar c[50];\n\tfor(int i=0;i<50;i++)\n\tc[i]='\\0';\n\tgets(c);\n\tfor(int i=(strlen(c)+1)/2;i>0;i--)\n\tprintf(\"%c%c\",c[i-1],c[strlen(c)-i]);\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[50],s1[50];scanf(\"%s\",s);\n\tint i,l,h,c=0;\n\tl=strlen(s);\n\tif(l%2==0) \n\th=l/2;\t\n\telse \n\th=(l/2);\n\tfor(i=0;i<l;i++)\n\t{\n\t\ts1[i]=s[h];\n\t\tc++;\n\t\tif(i%2==0)\n\t\t\th=h+c;\n\t\telse\n\t\t\th=h-c;\n\t\t\n\t}\n\ts1[l]='\\0';\n\tprintf(\"%s\",s1);\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include<string.h>\nint main()\n{\n char t[50],s[50];\n int l,i,j,k,m;\n scanf(\"%s\",t);\n l=strlen(t);\n j=1;\n \n if(l%2==0)\n {\n k=(l/2)-1;\n }\n else \n {\n k=l/2;\n }\n \n s[0]=t[k];\n for(i=1;i<l;i+=2)\n {\n \n s[i]=t[k+j];\n s[i+1]=t[k-j];\n j++;\n }\n printf(\"%s\",s);\n \n m=strlen(s);\n \n \n s[m]='\\0';\n return 0;\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k=0,b,e,c=-1;\n\tscanf(\"%d %d %d\",&n,&b,&e);\n\tfor(int i=n;i>b;i--)\n\t{\n\t\tc=c+1;\n\t\tif(c<=e)\n\t\t{\n\t\t\tk=k+1;\n\t\t}\n\t}\n\t\t\n\tprintf(\"%d\",k);\nreturn 0;\n}\t\n\t\n"}, {"source_code": "#include <stdio.h>\nint get_int();\n\nint max(int a, int b)\n{\n\tif (a > b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint min(int a, int b)\n{\n\tif (a < b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint main()\n{\n\tchar c;\n\tchar r[512];\n\tchar s[64];\n\tc = getchar();\n\tint i = 0;\n\twhile (c != 10)\n\t{\n\t\ts[i++] = c;\n\t\tc = getchar();\n\t}\n\ts[i] = '\\0';\n\tint n = i;\n\tint r1 = (n + 1)/2;\n\tint r2 = r1 - 1;\n\tint p = 0;\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tif (p == 1)\n\t\t{\n\t\t\tputchar(s[r1++]);\n\t\t\tp = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tputchar(s[r2--]);\n\t\t\tp = 1;\n\t\t}\n\t}\n\tr[r1] = '\\0';\n\tprintf(\"%s\\n\", &(r[r2]));\n\n\n\treturn 0;\n}\n\n\n\nint get_int()\n{\n\tint ret = 0;\n\tchar c = getchar();\n\tint sgn;\n\n\twhile (1)\n\t{\n\t\tif (c == EOF)\n\t\t{\n\t\t\treturn EOF;\n\t\t}\n\t\tif (c >= '0' && c <= '9')\n\t\t{\n\t\t\tsgn = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = getchar();\n\n\t\t\tif (c < '0' || c > '9')\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsgn = -1;\n\t\t\tbreak;\n\t\t}\n\t\tc = getchar();\n\t}\n\n\twhile (1)\n\t{\n\t\tret = (ret << 3) + (ret << 1) + c - '0';\n\n\t\tc = getchar();\n\n\t\tif (c < '0' || c > '9')\n\t\t{\n\t\t\treturn sgn*ret;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint i,n;\n\tchar suorce[50];//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b7\ufffd\ufffd\ufffd\ufffd\ufffd \n\tchar dest[50];//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b7\ufffd\ufffd\ufffd\ufffd\ufffd\n\tscanf(\"%s\",suorce); \n\tn=strlen(suorce);\n\tif(n%2==0)\n\t{\n\t\tfor(i=0;i<n/2;i++)\n\t\t{\n\t\t\tdest[i*2]=suorce[n/2-1-i];\n\t\t\tdest[i*2+1]=suorce[n/2+i];\n\t\t}\n\t}\n\telse\n\t{\n\t\tdest[0]=suorce[n/2];\n\t\tfor(i=1;i<=n/2;i++)\n\t\t{\n\t \tdest[i*2-1]=suorce[n/2+i];\n\t \tdest[i*2]=suorce[n/2-i];\n\t\t} \n\t}\n\t\n/*\tfor(i=0;i<n;i++)\n\t{\n\t\tprintf(\"%c\",dest[i]);\n\t}\n*/\nprintf(\"%s\",dest);\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int n,a,b;\n char s[100];\n scanf(\"%s\",s);\n n=strlen(s);\n a=n/2;\n b=a;\n if(n>1){\n printf(\"%c\",s[a-1]);\n for(int i=1;i<n;i++){\n if(i%2!=0){\n a+=1;\n printf(\"%c\",s[a-1]);\n }\n else{\n b-=1;\n printf(\"%c\",s[b-1]);\n }\n }\n }\n else\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum;\nchar b[10000],a[100000];\nscanf(\"%s\",a);\nn=strlen(a);\nif(strlen(a)<=2){\n printf(\"%s\",a);\n}else{\n n=strlen(a);\n i=n/2-1;\n j=n/2;\n \nwhile(i>=0 || j<n){\n printf(\"%c%c\",a[i],a[j]);\n i--;\n j++;\n \n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,a,l=0,r=0,z=0,j=1;\n char s[100],q[100];\n scanf(\"%s\",s);\n a=strlen(s);\n int x=a/2;\n q[0]=s[x];\n if(a==1)\n {\n printf(\"%c\",s[0]);\n }\n else if (a%2==0){\n x=x-1;\n q[0]=s[x];\n r=x+1;\n l=x-1;\n while(i!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n i=i+2;\n r++;l--;\n }\n printf(\"%s\",q);}\n else\n {\n r=x+1;\n l=x-1;\n while(j!=a)\n {\n q[j]=s[r];\n j++;\n q[j]=s[l];\n j++;\n r++;l--;\n }\n }\n for(z=0;z<a;z++)\n {\n printf(\"%c\",q[z]);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,c,n,d;\n char s[50];\n scanf(\"%s\",s);\n a=strlen(s);\n b=a/2;\n c=b-1;\n if(a!=1)\n for(int i=0;i<a;i++)\n {\n if(i%2==0)\n {\n printf(\"%c\",s[c]);\n c-=1;\n }\n else\n { \n printf(\"%c\",s[b]);\n b+=1;\n }\n }\n else\n printf(\"%c\",s[0]);\n return 0;\n}\n \n"}], "src_uid": "992ae43e66f1808f19c86b1def1f6b41"} {"nl": {"description": "\"This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!\" \u2014 people complained in the comments to one round on Codeforces. And even more... No, wait, the checker for the problem was alright, that's a mercy.", "input_spec": "The only line of the input contains an integer between 1 and 5, inclusive. All tests for this problem are different. The contents of the test case doesn't need to be equal to its index.", "output_spec": "The only line of the output contains an integer between 1 and 3, inclusive.", "sample_inputs": [], "sample_outputs": [], "notes": "NoteThis problem has no samples, since there so few test cases."}, "positive_code": [{"source_code": "#include <stdio.h>\nint y;\nint main()\n{\n\tscanf(\"%d\",&y);\n\tswitch(y)\n\t{\n\t\tcase 3:\n\t\t\n\t\t\tprintf(\"1\");\n\t\t\treturn 0;\n\t\tcase 1:\n\t\t\n\t\t\tprintf(\"2\");\n\t\t\treturn 0;\n\t\tcase 4:\n\t\t\n\t\t\tprintf(\"2\");\n\t\t\treturn 0;\n\t\tcase 2:\n\t\t\tprintf(\"3\");\n\t\t\treturn 0;\n\t\tcase 5:\n\t\t\tprintf(\"1\");\n\t\t\treturn 0;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int n;\n\nscanf(\"%d\",&n);\nprintf(\"%d\",(n==5)?1:n%3+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[] = {0,2,3,1,2,1}, n;\n\nint main () {\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",a[n]);\n}\n"}, {"source_code": "#include <stdio.h>\nint a[] = {0,2,3,1,2,1}, n;\nint main () {\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",a[n]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==5) printf(\"1\\n\");\n else \n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a; \n\nint main(){\n \n scanf(\"%d\", &a);\n \n if (a == 3)\n printf(\"1\");\n else\n if (a == 1)\n printf(\"2\");\n else\n if (a == 4)\n printf(\"2\"); \n else\n if (a == 2) \n printf(\"3\");\n else\n if (a == 5)\n printf(\"1\");\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 4)\n\t\tprintf(\"2\");\t\t\n\telse\n\tif (n == 2)\n\t\tprintf(\"3\");\t\n\telse\n\t\tprintf(\"1\");\t\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"2\");\n\tif(n==2)\n\tprintf(\"3\");\n\tif(n==3)\n\tprintf(\"1\");//\n\tif(n==4)\n\tprintf(\"2\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\nint a[] = {0,2,3,1,2,1}, n;\nscanf(\"%d\",&n);\nprintf(\"%d\",a[n]);\n}"}, {"source_code": "#include<stdio.h>\nmain () {\n\tint a,arr[6]={0,2,3,1,2,1};\n\tscanf(\"%d\",&a);\n\tprintf(\"%d\",arr[a]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"2\");break;\n case 2:printf(\"3\");break;\n case 3:printf(\"1\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"1\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (n==5)\n\t\t\tprintf(\"%d\\n\", 1);\n\t\telse\n\t\t\tprintf(\"%d\\n\", (n%3) + 1);\n\t\t\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"3\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"2\");\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"1\");\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint a;\nint main()\n{\t\n\tscanf(\"%d\",&a);\n\tif (a==1)\n\t\tprintf(\"2\");\n\tif (a==2)\n\t\tprintf(\"3\");\n\tif (a==3)\n\t\tprintf(\"1\");\n\tif (a==4)\n\t\tprintf(\"2\");\n\tif (a==5)\n\t\tprintf(\"1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n == 3 || n == 5)\n {\n printf(\"1\");\n }\n else if(n == 1 || n == 4)\n {\n printf(\"2\");\n }\n else\n printf(\"3\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 2; break;\n case 2: ans = 3; break;\n case 3: ans = 1; break;\n case 4: ans = 2; break;\n case 5: ans = 1;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a;\n \n fscanf(stdin, \"%d\", &a);\n \n if (a == 1 || a == 4) printf(\"%d\\n\", 2);\n if (a == 2) printf(\"%d\\n\", 3);\n if (a == 3 || a == 5) printf(\"%d\\n\", 1);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain ()\n{\n int n;\n scanf (\"%d\",&n);\n if (n!=5)\n printf(\"%d\",n%3+1);\n else\n printf(\"1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"2\");break;\n case 2: printf(\"3\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"1\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"2\");break;\n case 2: printf(\"3\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"1\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,s=0;\n scanf(\"%d\",&n);\n if(n==3 || n==5)\n printf(\"%d\",(s+1));\n else if(n==1 || n==4)\n printf(\"%d\",(s+2));\n else if(n==2)\n printf(\"%d\",(s+3));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint f(int a) {\n\tswitch (a) {\n\t\tcase 1: return 2;\n\t\tcase 2: return 3;\n\t\tcase 3: return 1;\n\t\tcase 4: return 2;\n\t\tcase 5:\t return 1;\n\t\tdefault: return 0;\n\t};\n}\nint main() {\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\", f(a));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain () {\n\tint a,arr[6]={0,2,3,1,2,1};\n\tscanf(\"%d\",&a);\n\tprintf(\"%d\",arr[a]);\n}\n\n"}, {"source_code": "#include \"stdio.h\"\n\nint ans[] = { 0, 2, 3, 1, 2, 1 }, n;\n\nint main()\n{\n\tscanf( \"%d\", &n );\n\tprintf( \"%d\\n\", ans[n] );\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tif (a==1){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==2){\n\t\tprintf(\"3\");\n\t}\n\telse if (a==3){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==4){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==5){\n\t\tprintf(\"1\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "int n;\n\nmain(){\n scanf(\"%d\",&n);\n if(n==5) puts(\"1\");\n else printf(\"%d\\n\",n%3+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\n\tswitch(a)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\\n\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"3\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\\n\");\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"1\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"%d\\n\",a-2);\n\t\t\tbreak;\n\t}\n\n\treturn 0;\n}\n\n"}, {"source_code": "int main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a==5)\n printf(\"1\");\n else\n printf(\"%d\",a%3+1);\n return 0;\n}"}, {"source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n;\n scanf(\"%lld\",&n);\n if(n==5)\n printf(\"1\\n\");\n else\n printf(\"%lld\",n%3+1);\n }\n \n return 0;\n}"}, {"source_code": "#pragma GCC optimize(2)\n#pragma GCC optimize(3)\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\\n\",x%5%3+1);\n return 0;\n \n}"}, {"source_code": "#pragma nounroll\n#pragma GCC optimize(3)\n#pragma GCC optimize(2)\n#pragma ivdep\n#pragma vector nontemporal\n\nmain(){\n unsigned int x;\n scanf(\"%d\",&x);\n printf(\"%d\\n\",x%5%3+1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){int a=getchar()^48;putchar(a%5%3+'1');return 0;}//absolutly!"}, {"source_code": "#include <stdio.h>\nint main()\n{\n putchar((getchar()^48)%5%3+'1');\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){char a=getchar()^48;putchar(a%5%3+1^48);return 0;}//what"}, {"source_code": "#include <stdio.h>\nint main(){putchar((getchar()^48)%5%3+'1');return 0;}//science!"}, {"source_code": "#pragma GCC optimize(3)\n#pragma GCC optimize(2)\n#include <stdio.h>\nint main(){register int a=getchar()^48;putchar(a%5%3+1^48);return 0;}//what"}, {"source_code": "int main()\n{\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\\n\",x%5%3+1);\n return 0;\n \n}"}, {"source_code": "int n;\nint main(){\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n%5%3+1);\n}"}, {"source_code": "int n;main(){scanf(\"%d\",&n);printf(\"%d\\n\",n%5%3+1);}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int n;\nscanf(\"%d\",&n);\nprintf(\"%d\",(2*n-1)%4);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int n;\nscanf(\"%d\",&n);\nprintf(\"%d\",(n+1)/2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int n;\n\nprintf(\"C++\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long int n, i, h, sum;\n\nint main () {\n\tscanf(\"%lld\",&n);\n\tfor(i = 1 ; i <= n ; i++){\n\t\tscanf(\"%lld\",&h);\n\t\tsum += h*i;\n\t}\n\tprintf(\"%lld\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX\nint rev(int n)\n{\n int ans=0;\n while(n){\n ans=ans*10+(n%10);\n n/=10;\n }\n return ans;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==2) printf(\"1\\n\");\n else \n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1) printf(\"1\\n\");\n else \n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX\nint rev(int n)\n{\n int ans=0;\n while(n){\n ans=ans*10+(n%10);\n n/=10;\n }\n return ans;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==3) \n printf(\"3\\n\");\n else\n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==4) printf(\"1\\n\");\n else \n printf(\"%d\\n\",(n%3)+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"4\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 4)\n\t\tprintf(\"2\");\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 2)\n\t\tprintf(\"2\");\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\t\tprintf(\"2\");\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"2\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"1\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 4)\n\t\tprintf(\"2\");\t\t\n\telse\n\t\tprintf(\"1\");\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 4)\n\t\tprintf(\"2\");\t\t\n\telse\n\t\tprintf(\"2\");\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\n\telse\n\tif (n == 4)\n\t\tprintf(\"2\");\t\t\n\telse\n\tif (n == 2)\n\t\tprintf(\"3\");\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 2)\n\t\tprintf(\"1\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 3)\n\t\tprintf(\"1\");\n\telse\n\tif (n == 1)\n\t\tprintf(\"2\");\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tif (n == 1)\n\t\tprintf(\"1\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"3\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"1\");\n\tif(n==2)\n\tprintf(\"2\");\n\tif(n==3)\n\tprintf(\"1\");\n\tif(n==4)\n\tprintf(\"2\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"3\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"1\");\n\tif(n==2)\n\tprintf(\"1\");\n\tif(n==3)\n\tprintf(\"1\");\n\tif(n==4)\n\tprintf(\"1\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"1\");\n\tif(n==2)\n\tprintf(\"2\");\n\tif(n==3)\n\tprintf(\"2\");\n\tif(n==4)\n\tprintf(\"2\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"3\");\n\tif(n==2)\n\tprintf(\"3\");\n\tif(n==3)\n\tprintf(\"1\");//\n\tif(n==4)\n\tprintf(\"2\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int a,b,x[100],y,s,c,i;\n\tscanf(\"%ld %ld\",&a,&b);\n\tc=0;\n\twhile(b!=0)\n\t{\n\t\tx[c++]=b%10;\n\t\tb=b/10;\n\t}\n\ty=1;s=0;\n\tfor(i=c-1;i>=0;i--)\n\t{\n\t\ts=s+y*x[i];\n\t\ty=y*10;\n\t}\n\tprintf(\"%ld\",s+a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tif(n==1)\n\tprintf(\"2\");\n\tif(n==2)\n\tprintf(\"2\");\n\tif(n==3)\n\tprintf(\"1\");\n\tif(n==4)\n\tprintf(\"2\");\n\tif(n==5)\n\tprintf(\"1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"2\");break;\n case 2:printf(\"3\");break;\n case 3:printf(\"1\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"2\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"2\");break;\n case 2:printf(\"2\");break;\n case 3:printf(\"1\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"2\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"1\");break;\n case 2:printf(\"2\");break;\n case 3:printf(\"2\");break;\n case 4:printf(\"3\");break;\n case 5:printf(\"3\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"2\");break;\n case 2:printf(\"1\");break;\n case 3:printf(\"2\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"3\");break;\n }\n return 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"2\");break;\n case 2:printf(\"2\");break;\n case 3:printf(\"1\");break;\n case 4:printf(\"1\");break;\n case 5:printf(\"2\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a==0 || a==1)\n printf(\"1\");\n else\n {if(a==2||a==3)\n printf(\"2\");\n else\n printf(\"3\");\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"3\");break;\n case 2:printf(\"1\");break;\n case 3:printf(\"2\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"3\");break;\n }\n return 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"1\");break;\n case 2:printf(\"2\");break;\n case 3:printf(\"1\");break;\n case 4:printf(\"1\");break;\n case 5:printf(\"2\");break;\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n switch(a)\n {\n case 1: printf(\"1\");break;\n case 2:printf(\"1\");break;\n case 3:printf(\"2\");break;\n case 4:printf(\"2\");break;\n case 5:printf(\"3\");break;\n }\n return 0;\n} "}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (i==1) printf(\"1\\n\");\n\t\telse\n\t\t\tprintf(\"%d\\n\", n%3+1);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (i==1) printf(\"1\\n\");\n\t\telse if (i==2) \tprintf(\"1\\n\");\n\t\telse printf(\"2\\n\");\n\t\ti++;\n\t\t\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tprintf(\"%d\\n\", (i+2)%3+1);\t\n\t\ti++;\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (i==1) printf(\"1\\n\");\n\t\telse if (i==2) \tprintf(\"3\\n\");\n\t\telse printf(\"2\\n\");\n\t\ti++;\n\t\t\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tprintf(\"2\\n\");\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tprintf(\"3\\n\");\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tprintf(\"%d\\n\", (n%3) + 1);\n\t\t\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (i==1) printf(\"1\\n\");\n\t\telse if (i==2) \tprintf(\"2\\n\");\n\t\telse printf(\"2\\n\");\n\t\ti++;\n\t\t\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, i=1;\n\twhile (scanf(\"%d\", &n)!=EOF)\n\t{\n\t\tif (i==1) printf(\"1\\n\");\n\t\telse\n\t\t\tprintf(\"%d\\n\", n%3+1);\n\t\ti++;\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tprintf(\"1\\n\");\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"5\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"2\");\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"3\");\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"5\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"3\");\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"4\");\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"3\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"2\");\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"5\");\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"4\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"5\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\");\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tprintf(\"2\");\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tprintf(\"3\");\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tswitch (x)\n\t{\n\t\tcase 1:\n\t\t\t\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"%d\",1);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\t\t\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\t\t\n\t\t\tbreak;\t\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint x;\nint main()\n{\n\tscanf(\"%d\",&x);\n\tprintf(\"%d\",x);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, r;\n scanf(\"%d\", &n);\n r = n % 3;\n printf(\"%d\", r ? r : 3);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 2; break;\n case 2: ans = 3; break;\n case 3: ans = 1; break;\n case 4: ans = 2; break;\n case 5: ans = 3;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 3; break;\n case 2: ans = 2; break;\n case 3: ans = 1; break;\n case 4: ans = 2; break;\n case 5: ans = 3;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 1; break;\n case 2: ans = 2; break;\n case 3: ans = 3; break;\n case 4: ans = 2; break;\n case 5: ans = 1;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 2; break;\n case 2: ans = 2; break;\n case 3: ans = 1; break;\n case 4: ans = 3; break;\n case 5: ans = 3;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, ans;\n \n scanf(\"%d\", &n);\n switch (n)\n {\n case 1: ans = 2; break;\n case 2: ans = 2; break;\n case 3: ans = 3; break;\n case 4: ans = 1; break;\n case 5: ans = 1;\n }\n printf(\"%d\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a;\n \n fscanf(stdin, \"%d\", &a);\n \n if (a == 1 || a == 5) printf(\"%d\\n\", 2);\n if (a == 2 || a == 4) printf(\"%d\\n\", 3);\n if (a == 3) printf(\"%d\\n\", 1);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a;\n \n fscanf(stdin, \"%d\", &a);\n \n if (a == 1 || a == 5) printf(\"%d\\n\", 1);\n if (a == 2 || a == 4) printf(\"%d\\n\", 2);\n if (a == 3) printf(\"%d\\n\", 3);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a;\n \n fscanf(stdin, \"%d\", &a);\n \n if (a == 1 || a == 4) printf(\"%d\\n\", 2);\n if (a == 2 || a == 5) printf(\"%d\\n\", 3);\n if (a == 3) printf(\"%d\\n\", 1);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain ()\n{\n int n;\n scanf (\"%d\",&n);\n printf(\"%d\",n%3+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"2\");break;\n case 2: printf(\"3\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"1\");break;\n case 2: printf(\"1\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"2\");break;\n case 2: printf(\"2\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"2\");break;\n case 2: printf(\"2\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"3\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"1\");break;\n case 2: printf(\"1\");break;\n case 3: printf(\"3\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i);\n switch(i)\n {\n case 1: printf(\"3\");break;\n case 2: printf(\"2\");break;\n case 3: printf(\"1\");break;\n case 4: printf(\"2\");break;\n case 5: printf(\"3\");break;\n\n }\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint f(int a) {\n\tswitch (a) {\n\t\tcase 1: return 2;\n\t\tcase 2: return 3;\n\t\tcase 3: return 1;\n\t\tcase 4: return 2;\n\t\tcase 5:\t return 3;\n\t\tdefault: return 0;\n\t};\n}\nint main() {\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\", f(a));\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(int a) {\n\tswitch (a) {\n\t\tcase 1: return 2;\n\t\tcase 2: return 2;\n\t\tcase 3: return 1;\n\t\tcase 4: return 2;\n\t\tcase 5:\t return 1;\n\t\tdefault: return 0;\n\t};\n}\nint main() {\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\", f(a));\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(int a) {\n\tswitch (a) {\n\t\tcase 1: return 1;\n\t\tcase 2: return 2;\n\t\tcase 3: return 1;\n\t\tcase 4: return 2;\n\t\tcase 5:\t return 1;\n\t\tdefault: return 0;\n\t};\n}\nint main() {\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\", f(a));\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(int a) {\n\tswitch (a) {\n\t\tcase 1: return 1;\n\t\tcase 2: return 2;\n\t\tcase 3: return 3;\n\t\tcase 4: return 2;\n\t\tcase 5:\t return 1;\n\t\tdefault: return 0;\n\t};\n}\nint main() {\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\", f(a));\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tif (a==1){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==2){\n\t\tprintf(\"3\");\n\t}\n\telse if (a==3){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==4){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==5){\n\t\tprintf(\"3\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tif (a==1){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==2){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==3){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==4){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==5){\n\t\tprintf(\"3\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\tif (a==1){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==2){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==3){\n\t\tprintf(\"1\");\n\t}\n\telse if (a==4){\n\t\tprintf(\"2\");\n\t}\n\telse if (a==5){\n\t\tprintf(\"3\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "int n;\n\nmain(){\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n%3+1);\n return 0;\n}\n"}, {"source_code": "int n;\n\nmain(){\n scanf(\"%d\",&n);\n if(n==5) puts(\"2\");\n else printf(\"%d\\n\",n%3+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a;\n\tscanf(\"%d\",&a);\n\n\tswitch(a)\n\t{\n\t\tcase 1:\n\t\t\tprintf(\"2\\n\");\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tprintf(\"3\\n\");\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tprintf(\"1\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"%d\\n\",a-2);\n\t\t\tbreak;\n\t}\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n if(a>=1 && a<6)\n printf(\"%d\",(rand()%3+1));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a; \n\nint main(){\n \n scanf(\"%d\", &a);\n \n if (a == 3)\n printf(\"1\");\n else\n if (a == 1)\n printf(\"2\");\n else\n if (a == 4)\n printf(\"2\"); \n else\n if (a = 2) \n printf(\"3\");\n else\n if (a == 5)\n printf(\"1\");\n\n\n return 0;\n}"}], "src_uid": "c702e07fed684b7741d8337aafa005fb"} {"nl": {"description": "This morning, Roman woke up and opened the browser with $$$n$$$ opened tabs numbered from $$$1$$$ to $$$n$$$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too many tabs open so he wants to close some of them.He decided to accomplish this by closing every $$$k$$$-th ($$$2 \\leq k \\leq n - 1$$$) tab. Only then he will decide whether he wants to study for the test or to chat on the social networks. Formally, Roman will choose one tab (let its number be $$$b$$$) and then close all tabs with numbers $$$c = b + i \\cdot k$$$ that satisfy the following condition: $$$1 \\leq c \\leq n$$$ and $$$i$$$ is an integer (it may be positive, negative or zero).For example, if $$$k = 3$$$, $$$n = 14$$$ and Roman chooses $$$b = 8$$$, then he will close tabs with numbers $$$2$$$, $$$5$$$, $$$8$$$, $$$11$$$ and $$$14$$$.After closing the tabs Roman will calculate the amount of remaining tabs with the information for the test (let's denote it $$$e$$$) and the amount of remaining social network tabs ($$$s$$$). Help Roman to calculate the maximal absolute value of the difference of those values $$$|e - s|$$$ so that it would be easy to decide what to do next.", "input_spec": "The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \\leq k < n \\leq 100$$$) \u2014 the amount of tabs opened currently and the distance between the tabs closed. The second line consists of $$$n$$$ integers, each of them equal either to $$$1$$$ or to $$$-1$$$. The $$$i$$$-th integer denotes the type of the $$$i$$$-th tab: if it is equal to $$$1$$$, this tab contains information for the test, and if it is equal to $$$-1$$$, it's a social network tab.", "output_spec": "Output a single integer \u2014 the maximum absolute difference between the amounts of remaining tabs of different types $$$|e - s|$$$.", "sample_inputs": ["4 2\n1 1 -1 1", "14 3\n-1 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1"], "sample_outputs": ["2", "9"], "notes": "NoteIn the first example we can choose $$$b = 1$$$ or $$$b = 3$$$. We will delete then one tab of each type and the remaining tabs are then all contain test information. Thus, $$$e = 2$$$ and $$$s = 0$$$ and $$$|e - s| = 2$$$.In the second example, on the contrary, we can leave opened only tabs that have social networks opened in them."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,q=0,w=0,c;\n\tint k;\n\tint a[10000];\n\tint b[10000],max=-999999;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\t\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]); \n\t}\n\tfor(int b=1;b<=n;b++)\n\t{\tq=0;w=0;\n\t\tfor(int j=1;j<=n;j++)\n\t\t{\n\t\t\tif((j-b)%k==0)\n\n\n\t\t\t{continue;\n\n\t\t\t}\n\t\t\tif(a[j]==1)\n\t\t\tw++;\n\t\t\telse\n\t\t\tq--;\n\t\t}\n\t\tif(abs(q+w)>max)\n\t\tmax=abs(q+w);\n\t\t\n\t\t\n\t}\n\t\n\tprintf(\"%d\",max);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,q=0,w=0,c;\n\tint k;\n\tint a[10000];\n\tint b[10000],max=-999999;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\t\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]); \n\t}\n\tfor(int b=1;b<=n;b++)\n\t{\tq=0;w=0;\n\t\tfor(int j=1;j<=n;j++)\n\t\t{\n\t\t\tif((j-b)%k==0)\n\n\n\t\t\t{continue;\n\n\t\t\t}\n\t\t\tif(a[j]==1)\n\t\t\tw++;\n\t\t\telse\n\t\t\tq++;\n\t\t}\n\t\tif(abs(w-q)>max)\n\t\tmax=abs(w-q);\n\t\n\t\t\n\t}\n\t\n\tprintf(\"%d\",max);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint c=0;\n\tint d=0;\n\tint ct=0;\n\tint dt=0;\n\n\tint a[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==1) c++;\n\t\telse d++;\n\t}\n\tint max=0;\n\tfor (int i = 0; i < k; ++i)\n\t{\n\t\tct=c;\n\t\tdt=d;\n\t\tfor (int j = i; j < n; j+=k)\n\t\t{\n\t\t\tif(a[j]==1)\n\t\t\t{\n\t\t\t\tct--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdt--;\n\t\t\t}\n\t\t}\n\t\tif(ct-dt>max)\n\t\t{\n\t\t\tmax=ct-dt;\n\t\t}\n\t\telse if(dt-ct>max)\n\t\t{\n\t\t\tmax=dt-ct;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",max );\n}"}, {"source_code": "#include<stdio.h>\n\n int main(){\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",ar+i);\n int max=0;\n for(int i=1,a=0,j;i<=n;i++){\n a=0;\n for(j=0;j<n;j++){\n if((j+1-i)%k==0)\n continue;\n if(ar[j]==1)a++;\n else a--;\n }\n if(a<0)a=-a;\n max=max>=a?max:a;\n }\n printf(\"%d\\n\",max);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main() {\n\tint n, k, i, j, e=0, s=0, max, e_cpy, s_cpy;\n\tint* ptr;\n\tscanf(\"%d %d\", &n, &k);\n\tptr=(int*)malloc(n*sizeof(int));\n\tfor(i=0;i<n;i++){\n scanf(\"%d\", &ptr[i]);\n if(ptr[i]==1) e++;\n else s++;\n\t}\n\tmax=0;\n\tfor(i=0;i<k;i++){\n e_cpy=e; s_cpy=s;\n for(j=0;i+j*k<n;j++){\n if(ptr[i+j*k]==1)e_cpy--;\n else s_cpy--;\n }\n if(abs(e_cpy-s_cpy)>max) max=abs(e_cpy-s_cpy);\n\t}\n printf(\"%d\", max);\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MAXSIZE 201\n\nint main()\n{\n int i,j,k,n;\n int a[MAXSIZE][MAXSIZE];\n scanf(\"%d %d\",&n,&k);\n a[0][0] = 0;\n for(i = 1;i<=n;i++)\n {\n scanf(\"%d\",&a[0][i]);\n a[i][0] = 0;\n for(j = 1;j<=n;j++)\n a[j][i] = 1;\n }\n for(int b = 0;b < k;b++)\n {\n for(i = 1;i<=n;i++)\n {\n if(i % k==b)\n continue;\n if(a[0][i]==1)\n a[b + 1][0]++;\n else if(a[0][i]==-1)\n a[b + 1][0]--;\n }\n }\n for(i = 1;i<=k;i++)\n {\n if(a[i][0] > 0)\n {\n if(a[i][0] > a[0][0])\n a[0][0] = a[i][0];\n }\n else if(a[i][0] <= 0)\n if(-a[i][0] > a[0][0])\n a[0][0] = -a[i][0];\n }\n printf(\"%d\\n\",a[0][0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint max(int a,int b)\n{\n return a>b?a:b;\n}\nint main()\n{\n int n,k,i,j,plus,neg,one=0,two=0,total,count,final=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",a+i);\n if(a[i]==1)\n one++;\n else\n two++;\n }\n for(i=0;i<n;i++)\n {\n j=0;\n count=i;\n plus=0;\n neg=0;\n total=count-j*k;\n while(total>=0)\n {\n j++;\n if(a[total]==1)\n plus++;\n else\n neg++;\n total=count-j*k;\n }\n j=1;\n total=count+j*k;\n while(total<n)\n {\n j++;\n if(a[total]==1)\n plus++;\n else\n neg++;\n total=count+j*k;\n }\n final=max(final,abs((one-plus)-(two-neg)));\n }\n printf(\"%d\",final);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint absolute(int a, int b){\n\treturn a > b ? a-b : b-a;\n}\n\nint main(){\n\tint n,k,i,j;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n];\n\tint te = 0,ts = 0;\n\t\n\tint b[k][2];\n\tfor(i = 0;i < k;i++){\n\t\tb[i][0] = 0;\n\t\tb[i][1] = 0;\n\t}\n\n\tfor(i = 0;i < n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i] == 1){\n\t\t\tte++;\n\t\t\tb[i%k][0]++;\n\t\t}\n\t\telse{\n\t\t\tts++;\n\t\t\tb[i%k][1]++;\n\t\t}\n\t}\n\n\tint max = 0;\n\tfor(i = 0;i < k;i++){\n\t\tint temp = absolute(te - b[i][0],ts - b[i][1]);\n\t\tif(temp > max){\n\t\t\tmax = temp;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i,n,k,e=0,s=0,a,b,j,max=0;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==1)e++;\n else s++;\n }\n for(i=0;i<k;i++)\n {\n a=e;\n b=s;\n for(j=i;j<n;j+=k)\n {\n if(arr[j]==1)a--;\n else b--;\n }\n if(abs(a-b)>max)max=abs(a-b);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n \n int a[n+1];\n for(int i=1;i<n+1;i++)\n scanf(\"%d\",&a[i]);\n\n int a1=0,a2=0; \n for(int i=1;i<n+1;i++)\n {\n if(a[i]==1)\n {\n a1++;\n }\n else\n {\n a2++;\n }\n }\n int max=0;\n for(int i=1;i<n+1;i++)\n {\n \n int e=a1,s=a2;\n int index=i;\n for(int j=i;j<n+1;j=j+k)\n {\n if(a[j]==1)\n {\n e--;\n }\n else\n {\n s--;\n } \n }\n for(int j=i-k;j>0;j=j-k)\n {\n if(a[j]==1)\n {\n e--;\n }\n else\n {\n s--;\n }\n }\n \n if(abs(e-s)>max)\n max=abs(e-s);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(void)\n{\n\tint n, k;\n\tscanf(\"%d%d\",&n,&k);\n\tint arr[110];\n\tint ctre=0;\n\tint ctrs=0;\n\tfor(int q=0;q<n;q++)\n\t{\n\t\tscanf(\"%d\",&arr[q]);\n\t\tif(arr[q]==-1)\n\t\t\tctrs++;\n\t\telse ctre++;\n\n\t}\n\tint ans=0;\n//printf(\"ctre:%d\tctrs:%d\\n\",ctre,ctrs);\n\n\tfor(int w=0;w<n;w++)\n\t{\n\t\tint ce=ctre;\n\t\tint cs=ctrs;\n\t\tint ptr=w;\n\t\twhile(ptr<n)\n\t\t{\n\t\t\tif(arr[ptr]==1)\n\t\t\t\tce--;\n\t\t\tif(arr[ptr]==-1)\n\t\t\t\tcs--;\n//printf(\"ptr:%d\\n\",ptr);\t\t\n\tptr+=k;\n//printf(\"ctre:%d\t\tctrs:%d\\n\",ce,cs);\n\n\t\t}\n\t\tptr=w-k;\n\t\twhile(ptr>=0)\n\t\t{\n if(ptr>=0)\n{\n\t\t\tif(arr[ptr]==1)\n\t\t\t\tce--;\n\t\t\tif(arr[ptr]==-1)\n\t\t\t\tcs--;\n\t\t\tptr-=k;\n}\n//printf(\"here\\n\");\n//printf(\"ptr:%d\\n\",ptr); // ptr+=k;\n//printf(\"ctre:%d ctrs:%d\\n\",ce,cs);\n\n\n\t\t}\n//\t\tprintf(\"w:%d\\n\",w);\n//\t\tprintf(\"fabs(cs-ce):%lf\\n\",fabs(cs-ce));\n\n\n\t\tif(fabs(cs-ce)>ans)\n\t\t\tans=fabs(cs-ce);\n\n\n\t}\n\tprintf(\"%d\",ans);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i = 0;i<n; i++)\n scanf(\"%d\",&arr[i]); \n //int e,s;\n int ans=0;\n for(int i = 0; i < k; i++)\n {\n int e=0,s=0;\n int temp[n];\n for(int j=0;j<n;j++)\n temp[j]=arr[j];\n for(int j = i; j < n;)\n {\n temp[j]=0;\n j+=k;\n }\n for(int j = 0; j < n; j++)\n {\n if(temp[j]==1)\n e++;\n else if(temp[j]==-1)\n s++;\n }\n if(fabs(e-s)>=ans)\n ans=fabs(e-s);\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n];\n\tfor (int i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint b[n];\n\tfor (int i=0;i<n;i++)\n\t\tb[i]=a[i];\n\tint max=0;\n\tfor (int i=0;i<n;i++)\n\t{\n\t\tint sum=0;\n\t for (int j=i;j<n;j+=k)\n\t\tb[j]=0;\n\tfor (int j=i;j>=0;j-=k)\n\t\tb[j]=0;\n\tfor (int i=0;i<n;i++)\n\t\tsum+=b[i];\n\tif (sum>max)\n\t\tmax=sum;\n\telse if (sum<0 && (sum*(-1))>max)\n max=sum*(-1);\n for (int i=0;i<n;i++)\n \tb[i]=a[i];\n\t}\n\tprintf(\"%d\\n\",max);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint A[1000],A1[1000];\nint main() {\n\tint n, k, i, j, t, p, max = 0;\n\tint plus = 0, minus = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &A[i]);\n\tfor (i = 0; i < k; i++) {\n\t\tfor (j = 0; j < n; j++)\n\t\t\tA1[j] = A[j];\n\t\tfor (j = i; j < n; j += k)\n\t\t\tA1[j] = 0;\n\t\tplus = 0;\n\t\tminus = 0;\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tif (A1[j] == 1)\n\t\t\t\tplus++;\n\t\t\telse if (A1[j] == -1)\n\t\t\t\tminus++;\n\t\t}\n\t\tif(plus>minus)\n p=plus-minus;\n else\n p=minus-plus;\n\t\tif (max < p)\n\t\t\tmax = p;\n\t}\n\tprintf(\"%d\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint main ()\n{\n int n,k;\n int i,j;\n int a[100010];\n scanf(\"%d%d\",&n,&k);\n int zheng,fu;\n zheng=fu=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>0)zheng++;\n else fu++;\n }\n int x=zheng;\n int xx=fu;\n int max=0;\n for(i=1;i<=k;i++)\n {\n zheng=x;\n fu=xx;\n for(j=i;j<=n;j+=k)\n {\n if(a[j]>0)zheng--;\n else fu--;\n }\n if(abs(zheng-fu)>max)max=abs(zheng-fu);\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,b,j,c,p=0,m=0,p1,m1,v=0,v1=-1;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==1)\n p++;\n else\n m++;\n }\n for(b=1;b<=n;b++)\n {\n c=0;\n p1=0;\n m1=0;\n for(j=1;!(((j-b)%k)==0);j++);\n i=(j-b)/k;\n for(c=b+i*k;c<=n;i++,c=b+i*k)\n {\n if(arr[c-1]==1)\n p1++;\n else\n m1++;\n }\n v=p-p1-m+m1;\n if(v<0)\n v=-v;\n if(v>v1)\n v1=v;\n }\n printf(\"%d\",v1);\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nint max(int, int);\n\nint main(){\n int n, k, i, ans;\n scanf(\"%d %d\", &n, &k);\n int array[n - 1];\n\n for (i = 0; i < n; i++){\n scanf(\"%d\", &array[i]);\n }\n\n ans = 0;\n for (i = 0; i < k; i++){\n int array_2[n - 1], j;\n // Make a copy of array in array_2\n for (j = 0; j < n; j++){\n array_2[j] = array[j];\n }\n // Mark tabs 0 which are to be skipped\n for (j = i; j < n; j = j + k){\n array_2[j] = 99999;\n }\n\n int count1 = 0, count2 = 0, q;\n // Get count 1\n for (q = 0; q < n; q++){\n if (array_2[q] == 1)\n count1++;\n }\n // Get count 2\n for (q = 0; q < n; q++){\n if (array_2[q] == -1)\n count2++;\n }\n ans = max(ans, abs(count1 - count2));\n }\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n\nint max(int num1, int num2){\n if (num1 > num2)\n return num1;\n else\n return num2;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint n,k;\nint dem[101];\nint main()\n{\n\tint web,i;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1 ; i<=n ; i++)\n\t{\n\t\tscanf(\"%d\",&web);\n\t\tdem[i%k]+=web;\n\t\tdem[k]+=web;\n\t}\n\t\n\tint kq=0;\n\tfor(i=0 ; i<k ; i++)\n\t{\n\t\tdem[i]=abs(dem[k]-dem[i]);\n\t\tkq=kq>dem[i]?kq:dem[i];\n\t}\n\t\n\tprintf(\"%d\",kq);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n , k , j , e = 0 , s=0 , num = 0 , sum , max = 0 ;\n scanf(\"%d %d\",&n , &k) ;\n int i , a[n] ; \n for(i=0 ; i<=n ; i++){\n scanf(\" %d\", &a[i]) ;\n // sum += a[i] ;\n }\nfor(j=0 ; j<n ; j++){\n e = 0 ;\n s = 0 ;\n for(i=0 ; i<n ; i++){\n int x = j-i ;\n if(x<0) x = -x ;\n if((i==j)||(x%k==0)) continue ;\n else{\n if(a[i]==1) e++ ;\n else s++ ;\n }\n }\n sum = e-s ;\n if(sum<0) sum = -sum ;\n if(max<sum) max = sum ;\n}\n printf(\"%d\",max) ;\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint B[3];\n\nint main(void)\n{\nint n,k,j,A[101],i,count_1,count1,max=-1;\n\nscanf(\"%d%d\",&n,&k);\nfor(i=1; i<=n; i++)\n{\nscanf(\"%d\",&A[i]);\nB[A[i]+1]++;\n}\n\nfor(i=1; i<=k; i++)\n{\n count_1=B[0];\n count1=B[2];\n\nfor(j=i; j<=n; j+=k)\n{\n if(A[j]==-1)\n count_1--;\n else\n count1--;\n}\n\nif(abs(count_1-count1)>max)\nmax=abs(count_1-count1); \n}\n\nprintf(\"%d\",max);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef unsigned long long ll;\ntypedef long double LD;\n\n#define MAXN 100\n\n#define MAX(a,b) (a>b?a:b)\n\nint arr[MAXN];\nint arrcpy[MAXN];\n\nint main(void)\n{\n int N,K;\n int i,j;\n int B;\n int socialtab,infotab;\n int diff,maxdiff;\n\n\t#ifndef ONLINE_JUDGE\n FILE *fp;\n\t//fp = freopen(\"..\\\\..\\\\1047\\\\C\\\\1047C.TXT\",\"r\",stdin);\n\tfp = freopen(\"1100A.TXT\",\"r\",stdin);\n\tif (fp == NULL)\n {\n printf (\"Cannot open file\\n\\n\");\n exit(0);\n }\n\t#endif\n\n maxdiff = 0;\n\n scanf(\"%d%d\",&N,&K);\n\n for (i=0; i<N; i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n\n // check for b=0 to k-1\n for (B=0; B<K; B++)\n {\n memcpy(arrcpy, arr, sizeof(arr[0]) *N);\n\n for (j=B; j<N; j+=K)\n {\n arrcpy[j] = 0;\n }\n\n // compute ans\n socialtab = 0;\n infotab = 0;\n for (j=0; j<N; j++)\n {\n if (arrcpy[j] == -1)\n {\n socialtab++;\n }\n else if (arrcpy[j] == 1)\n {\n infotab++;\n }\n }\n diff = abs(socialtab - infotab);\n\n maxdiff = MAX(maxdiff,diff);\n }\n \n printf (\"%d\",maxdiff);\n \n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n,k;\nint A[110],B[110];\nint ab(int a){\n if(a>0)return a;\n return -a;\n}\nint main(){\n // freopen(\"input.txt\",\"r\",stdin);\n scanf(\"%d %d\",&n,&k);\n int i,j;\n for(i=1;i<=n;i++){\n scanf(\"%d\",&A[i]);\n }\n int mx=0,ans=0,info=0,snt=0;\n for(i=1;i<=k;i++){\n info=0,snt=0;\n for(j=1;j<=n;j++)B[j]=A[j];\n for(j=i;j<=n;j+=k){B[j]=0;}\n for(j=1;j<=n;j++){\n if(B[j]>0)info++;\n if(B[j]<0)snt++;\n }\n ans=ab(info-snt);\n //printf(\"%d: %d %d %d\\n\",i,ans,info,snt);\n if(ans>mx){\n mx=ans;\n }\n }\n printf(\"%d\",mx);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(void) \n{\n\t// your code goes here\n\tint n,k,i,j,l,e,s,max=-1;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n],b[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t scanf(\"%d\",&a[i]);\n\t b[i]=a[i];\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t j=i;\n\t e=0;\n\t s=0;\n\t while(j<=n-1)\n\t {\n\t b[j]=0;\n\t j=j+k;\n\t }\n\t for(l=0;l<n;l++)\n\t {\n\t if(b[l]==1)\n\t e++;\n\t else if(b[l]==-1)\n\t s++;\n\t b[l]=a[l]; \n\t }\n\t if(max<abs(e-s))\n\t max=abs(e-s);\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int n, k;\n int a[100];\n int A = 0, B = 0;\n int ans = 0;\n scanf(\"%d %d\", &n, &k);\n for (int i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n for (int i = 0; i < n; i++){\n A = B = 0;\n for (int j = i; j < n; j += k) a[j] += 3;\n for (int j = i - k; j >= 0; j -= k) a[j] += 3;\n for (int j = 0; j < n; j++) A += a[j] == 1, B += a[j] == -1;\n if (abs(A - B) > ans) ans = abs(A - B);\n for (int j = 0; j < n; j++) a[j] -= 3 * (a[j] == 2 || a[j] == 4);\n }\n printf(\"%d\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tint n,k,i,j,e=0,s=0,ans,a[110]={0},b,c,l;\n\tint max=-1,d[110]={0};\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(b=0;b<=100;b++){\n\t\tfor(j=1;j<=n;j++)\n\t\td[j]=a[j];\n\t\te=0,s=0;\n\t\tfor(i=-100;i<=50;i++){\n\t\t\tc=b+i*k;\n\t\t\tif(c<=n&&c>=1)\n\t\t\td[c]=0;\n\t\t}\n\t\tfor(l=1;l<=n;l++){\n\t\t\tif(d[l]==-1) e++;\n\t\t\telse if(d[l]==1) s++;\n\t\t}\n\t\tans=fabs(e-s);\n\t\tif(ans>max)\n\t\tmax=ans;\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint Max(int a,int b);\nint a[110];\nint main(void)\n{\n int n,k,max = 0;\n int c=0,d=0;\n int e = 0,s = 0;\n scanf(\"%d%d\",&n,&k);\n for (int i = 1;i<=n;i++){\n scanf(\"%d\",&a[i]);\n if (a[i] == 1) e++;\n else s++;\n }\n for (int i = 1;i<=k;i++){\n \tc = d = 0;\n for (int j = i;j <= n;j += k){\n if(a[j] == 1) c++;\n else d++;\n }\n max = Max(max,fabs((e-c)-(s-d)));\n }\n printf(\"%d\\n\",max);\n \n return 0;\n}\nint Max(int a,int b)\n{\n\treturn a>=b?a:b;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N\t100\n\nint main() {\n\tstatic int aa[N];\n\tint n, k, i, j, k1, k_1, max;\n\n\tscanf(\"%d%d\", &n, &k);\n\tk1 = k_1 = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &aa[i]);\n\t\tif (aa[i] == 1)\n\t\t\tk1++;\n\t\telse\n\t\t\tk_1++;\n\t}\n\tmax = 0;\n\tfor (i = 0; i < k; i++) {\n\t\tint k1_ = k1, k_1_ = k_1;\n\n\t\tfor (j = i; j < n; j += k)\n\t\t\tif (aa[j] == 1)\n\t\t\t\tk1_--;\n\t\t\telse\n\t\t\t\tk_1_--;\n\t\tif (max < k1_ - k_1_)\n\t\t\tmax = k1_ - k_1_;\n\t\tif (max < k_1_ - k1_)\n\t\t\tmax = k_1_ - k1_;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint n, k, a[105], i,key;\nint cul(int key)\n{\n\tint e = 0, s = 0;\n\tfor (i = 1; i <= n; i++)\n\t{\n\t\tif (i%k == key)continue;\n\t\telse if (a[i] == 1)s++;\n\t\telse e++;\n\t}\n\treturn abs(e - s);\n}\nint main() \n{\n\tint max = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (i = 1; i <= n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\tfor (key = 0; key < k; key++)\n\t\tif (cul(key) > max)max = cul(key);\n\tprintf(\"%d\", max);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint n,k,i,j,l,o;\n\tint tab[100]={};\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&tab[i]);\n\tint max=0;\t\n\tfor(i=0;i<k;i++)\n\t{\n\t\to=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(j%k-i!=0)\n\t\t\t\to+=tab[j];\n\t\t}\n\t\t//printf(\"%d-\",o);\n\t\tif(o>max)\n\t\t\tmax=o;\n\t\telse if(-o>max)\n\t\t\tmax=-o;\t\t\t\t\n\t}\t\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define N 100\n\nint main() {\n\tstatic int aa[N];\n\tint n, k, i, sum, max;\n\n\tscanf(\"%d%d\", &n, &k);\n\tsum = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tint a;\n\n\t\tscanf(\"%d\", &a);\n\t\taa[i % k] += a;\n\t\tsum += a;\n\t}\n\tmax = 0;\n\tfor (i = 0; i < k; i++)\n\t\tif (max < abs(sum - aa[i]))\n\t\t\tmax = abs(sum - aa[i]);\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h >\n\nint arr[110];\n\nint main()\n{\n int i,j,num,gap,e,s,p,ans,tem;\n scanf(\"%d%d\",&num,&gap);\n for (i=0;i<num;i++)\n scanf(\"%d\",&arr[i]);\n for (j=0,ans=0,tem=0;j<gap;j++)\n {\n for (i=0,e=0,s=0,p=j;i<num;i++)\n {\n if (i!=p)\n {\n if (arr[i]==1)\n e++;\n else\n s++;\n }\n else\n p+=gap;\n }\n tem=abs(e-s);\n ans=ans>tem?ans:tem;\n }\n printf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tint a[106]={0},n,m=0,i,l,b[106]={0},k,w;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tm+=a[i];\n\t}\n\tfor(l=1;l<=k;l++)\n\t{\n\t\tw=l;\n\t\tb[l]=m;\n\t\twhile(w<=n)\n\t\t{\n\t\t\tb[l]-=a[w];\n\t\t\tw+=k;\n\t\t}\n\t\tb[l]=fabs(b[l]);\n\t}\n\tb[0]=b[1];\n\tfor(l=1;l<=k;l++)\n\t{\n\t\tif(b[0]<b[l])\n\t\tb[0]=b[l];\n\t}\n\tprintf(\"%d\",b[0]);\n}\n"}, {"source_code": "#include<stdio.h>\n#define abs(a) (a<0?-a:a)\n#define max(a,b) (a>b?a:b)\n\nint A[110];\n\nint main() {\n\tint n,k,m=0,a=0,b=0,a1,b1,x,y;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(x=0;x<n;x++)\n\t\t{\n\t\tscanf(\"%d\",&A[x]);\n\t\ta+=(A[x]==1);\n\t\tb+=(A[x]==-1);\n\t\t}\n\t//cout<<a<<\" \"<<b<<endl;\n\tfor(x=0;x<n;x++)\n\t\t{\n\t\ta1=b1=0;\n\t\tfor(y=x%k;y<n;y+=k)\n\t\t\t{\n\t\t\ta1+=(A[y]==1);\n\t\t\tb1+=(A[y]==-1);\n\t\t\t}\n\t\t//printf(\"%d %d %d %d %d\\n\",a,a1,b,b1,abs(((a-a1)-(b-b1))));\n\t\t//cout<<a<<\" \"<<a1<<\" \"<<b<<\" \"<<b1<<endl;\n\t\tm=max(m,(abs(((a-a1)-(b-b1)))));\n\t\t}\n\tprintf(\"%d\\n\",m);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n \n int a[n],b[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n b[i]=a[i];\n }\n int st=0,maxdiff=0;\n for(int i=0;i<n;i++){\n st=i;\n while (st>=0) st-=k;\n st+=k;\n for(int j=st;j<n;j+=k){\n b[j]=0; \n }\n int ij=0,s=0;\n for(int j=0;j<n;j++){\n if(b[j]==-1) s++;\n if(b[j]==1) ij++;\n }\n // printf(\"%d %d\\n\",s,ij);\n //for(int q=0;q<n;q++)printf(\"%d \",b[q]);printf(\"\\n\");\n if(s-ij>maxdiff)maxdiff=s-ij;\n else if(ij-s>maxdiff)maxdiff=ij-s;\n for(int l=0;l<n;l++)\n b[l]=a[l];\n }\n printf(\"%d\\n\",maxdiff);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k, n;\n\tint type[100];\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0; i<n; i++){\n\t\tscanf(\"%d\",&type[i]);\n\t}\n\tint max=0;\n\tfor(int i=0; i<k; i++){\n\t\tint cnt=0;\n\t\tfor(int j=0; j<n; j++){\n\t\t\tif(j%k != i) {\n\t\t\t\tcnt+=type[j]; \n\t\t\t}\n\n\t\t}\n\t\tif(cnt<0) cnt=-cnt;\n\t\tif(max<cnt) max=cnt;\n\t}\n\tprintf(\"%d\\n\",max);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k, n;\n\tint type[100];\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&type[i]);\n\t}\n\tint max=0;\n\tfor(int i=0; i<k; i++)\n\t{\n\t\tint cnt=0;\n\t\tfor(int j=0; j<n; j++)\n\t\t{\n\t\t\tif(j%k != i)\n\t\t\t{\n\t\t\t\tcnt+=type[j]; \n\t\t\t}\n\n\t\t}\n\t\tif(cnt<0)\n\t\t cnt=-cnt;\n\t\tif(max<cnt)\n\t\t max=cnt;\n\t}\n\tprintf(\"%d\\n\",max);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char *argv[])\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n\n int a[100];\n int i;\n for (i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n\n int max = 0;\n int b;\n for (b = 0; b < k; b++) {\n int a_[100];\n for (i = 0; i < n; i++)\n a_[i] = a[i];\n\n int c;\n for (c = b; c < n; c += k)\n a_[c] = 0;\n\n int max_cur = 0;\n for (i = 0; i < n; i++)\n max_cur += a_[i];\n\n if (max_cur < 0)\n max_cur = -max_cur;\n\n if (max_cur > max)\n max = max_cur;\n }\n\n printf(\"%d\\n\", max);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tlong long int n, k;\n\tscanf(\"%lld%lld\", &n, &k);\n\tint s[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\", &s[i]);\n\t}\n\tint max=0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tint cnt1=0, cnt2=0, temp[n];\n\t\t\n\t\tfor(int j=0; j<n; j++)\n\t\t{\n\t\t\t\ttemp[j]=s[j];\n\t\t}\n\t\tfor(int j=i; j>=0; j-=k)\n\t\t{\n\t\t\t\ttemp[j]=0;\n\t\t}\n\t\tfor(int j=i; j<n; j+=k)\n\t\t{\n\t\t\ttemp[j]=0;\n\t\t}\n\t\tfor(int j=0; j<n; j++)\n\t\t{\n\t\t\tif(temp[j]==1)\n\t\t\t\tcnt1++;\n\t\t\telse if(temp[j]==-1)\n\t\t\t\tcnt2++;\n\t\t}\n\t//\tprintf(\"%d %d\\n\",cnt1, cnt2 );\n\t\tif(abs(cnt1-cnt2)>max)\n\t\t\tmax=abs(cnt1-cnt2);\n\t}\n\tprintf(\"%d\\n\", max);\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n\tint i,j,n,m;\n\tint a,b,s,x,y;\n\tscanf(\"%d %d\",&n,&m);\n\tint ar[n];\n\tx=y=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&ar[i]);\n\t\tif(ar[i]>0)x++;\n\t\telse y++;\n\t}\n\ts=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t\ta=x; b=y;\n\t\tfor(j=i;j<n;j+=m)\n\t\t{\n\t\t\tif(ar[j]>0)a--;\n\t\t\telse b--;\n\t\t}\n\t\tif(abs(a-b)>s)s=abs(a-b);\n\t}\n\tprintf(\"%d\\n\", s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i,j,max=0,e=0,s=0;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++)\n {\n e=0;\n s=0;\n for(j=0;j<n;j++)\n {\n if((j-i)%k!=0)\n {\n if(a[j]==1)\n e++;\n else\n s++;\n }\n }\n if(e-s>max)\n max=e-s;\n if(s-e>max)\n max=s-e;\n }\n printf(\"%d\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int64_t i64;\ntypedef int32_t i32;\n\nstatic void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}\nstatic i64 read_int(void){int prev='\\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}\n\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define ABS(a) ((a)>(0)?(a):-(a))\n\nvoid run (void) {\n i32 n = read_int();\n i32 k = read_int();\n i32 *cnt = (i32 *) calloc (k, sizeof (i32));\n i32 sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 a = read_int();\n cnt[i % k] += a;\n sum += a;\n }\n i32 max = 0;\n for (i32 i = 0; i < k; ++i) {\n max = MAX(max, ABS(sum - cnt[i]));\n }\n print_int (max);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, k;\n int A[100];\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &A[i]);\n }\n int ans = 0;\n for(int i = 0; i < k; ++i) {\n int e = 0;\n int s = 0;\n for(int j = 0; j < n; ++j) {\n if((j - i + n) % k != 0) {\n if(A[j] == 1) {\n ++e;\n } else {\n ++s;\n }\n }\n }\n if(ans < abs(e - s)) {\n ans = abs(e - s);\n }\n }\n printf(\"%d\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n static int a[101], t, n, k, sum, max ,i;\n scanf(\"%d%d\", &n, &k);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&t);\n a[i%k] += t;\n sum += t;\n }\n for(i=0; i<k; i++)\n {\n if(max < abs(sum-a[i]))\n max = abs(sum-a[i]);\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//\u5220\u6389\u6700\u591a\u7684\u793e\u4ea4\uff0c\u6216\u8005\u5220\u6389\u6700\u591a\u7684\u6d4b\u8bd5\n#define N 102\nint main(){\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int i;\n int tab[N];\n char close[N];\n for(i=1;i<=n;i++){\n scanf(\"%d\",&tab[i]);\n }\n int j;\n int answer=0;\n for(i=0;i<k;i++){\n for(j=1;j<=n;j++){\n close[j]=0;\n }\n for(j=1+i;j<=n;j+=k){\n close[j]=1;\n }\n int e=0;\n int s=0;\n for(j=1;j<=n;j++){\n if(!close[j]){\n if(tab[j]==1){\n e++;\n }else{\n s++;\n }\n }\n }\n if(e>s){\n if(answer<e-s){\n answer=e-s;\n }\n }else{\n if(answer<s-e){\n answer=s-e;\n }\n }\n }\n printf(\"%d\\n\",answer);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,ar[100],i,b,arr[100],br[100],c1,c2,d;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&ar[i]);\n\t}\n\tfor(b=1;b<=n;b++)\n\t{\n\t\tc1=0;\n\t\tc2=0;\n\t\tfor(i=0;i<n;i++)\n\t\tarr[i]=ar[i];\n\t\t\n\t\tfor(i=(1-b)/k;i<=(n-b)/k;i++)\n\t\t{\n\t\t\tarr[b+i*k-1]=0;\n\t\t}\n\t\t\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(arr[i]==1)\n\t\t\tc1++;\n\t\t\tif(arr[i]==-1)\n\t\t\tc2++;\n\t\t}\n\t\tif(c1>c2)\n\t\tbr[b-1]=c1-c2;\n\t\telse\n\t\tbr[b-1]=c2-c1;\n\t}\n\td = br[0];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(br[i]>d)\n\t\td=br[i];\n\t}\n\tprintf(\"%d\\n\",d);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,a,max;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k];\n\n for(i=0; i<n; i++)\n\n scanf(\"%d\",&x[i]);\n\n for(i=0; i<k; i++)\n { a=0;\n y[i]=0;\n\n for(j=0; j<n; j++)\n { if(j==i+a*k) a++;\n else y[i]=y[i]+x[j];\n }\n\n if(y[i]<0) y[i]=-1*y[i];\n }\n\n max=y[0];\n for(i=1; i<k; i++)\n {\n if(y[i]>max) max=y[i];\n }\n printf(\"%d\",max);\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, k, i, j, ce, cs;\n scanf(\"%i%i\", &n, &k);\n int a[n], b[n], d[k];\n for(i=0; i<n; ++i){\n scanf(\"%i\", &b[i]);\n }\n\n for(i=0; i<k; ++i){\n ce=0, cs=0;\n for(j=0; j<n; ++j){\n a[j] = b[j];\n }\n\n for(j=0; j*k+i<n; ++j){\n a[j*k+i] = 0;\n }\n\n for(j=0; j<n; ++j){\n if(a[j] == 1) ce++;\n if(a[j] == -1) cs++;\n }\n if(ce>cs) d[i] = ce-cs;\n else d[i] = cs-ce;\n }\n\n j = d[0];\n for(i=1; i<k; ++i){\n if(j<d[i]) j=d[i];\n }\n \n printf(\"%i\", j);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\n\tint n,k;\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF){\n\t\tint arr[n],i,a[k],b[k],max=-1e9,suma=0,sumb=0;\n\t\tmemset(a,0,sizeof(a));\n\t\tmemset(b,0,sizeof(b));\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\t\tif(arr[i]==1)\n\t\t\t\tsuma++ ;\n\t\t\telse\n\t\t\t\tsumb++;\n\t\t}\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(arr[i]==1){\n\t\t\t\ta[i%k]++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tb[i%k]++;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<k;i++){\n\t\t\tif(abs(abs(suma-a[i])-abs(sumb-b[i]))>max)\n\t\t\t\tmax=abs(abs(suma-a[i])-abs(sumb-b[i]));\n\t\t}\n\t\tprintf(\"%d\\n\",max);\n\t}\n} \n"}, {"source_code": "#include<stdio.h>\nint a[100];\nint main(){\n int n,k,i,j,max=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++){\n int c=0;\n for(j=0;j<n;j++){\n if(j%k!=i) c+=a[j];\n }\n if(c<0) c=-c;\n if(max<c) max=c;\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n#define SIZE 100\nint main() {\n\tint n, a[100], k, i, j, e = 0, s = 0, et = 0, st = 0, max = 0;\n\n\tscanf (\"%d %d\", &n, &k);\n\n\tfor (i = 0; i < n; i++) {\n\t\tscanf (\"%d\", &a[i]);\n\t\tif (a[i] == 1)\n\t\t\te++;\n\t\telse\n\t\t\ts++;\n\t}\n\n\tfor (i = 0; i < k; i++) {\n\t\tet = 0;\n\t\tst = 0;\n\t\tfor (j = i; j < n; j += k)\n\t\t\tif (a[j] == 1)\n\t\t\t\tet++;\n\t\t\telse\n\t\t\t\tst++;\n\n\t\tif ((int) abs ((int) ((e - et) - (s - st))) > max)\n\t\t\tmax = (int) abs ((int) ((e - et) - (s - st)));\n\t}\n\n\tprintf (\"%d\", max);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nvoid read(int *arr, int length) {\n for (int i=0; i<length; i++) scanf(\"%d\",(arr+i));\n}\nint diff(int *arr, int length, int init, int b) {\n int test=0,social=0;\n for (int i=0; i<length; i++) {\n if (i%init!=b%init) {\n if (*(arr+i)==1) {\n test++;\n } else {\n social++;\n }\n }\n }\n return abs(test-social);\n}\nint maxim(int *arr, int length, int k) {\n int res=0,comp;\n for (int i=0; i<length; i++) {\n comp=diff(arr,length,k,i);\n if (res<comp) res=comp;\n }\n return res;\n}\nint main() {\n int len,tab;\n scanf(\"%d %d\\n\",&len,&tab);\n int browse[len];\n read(browse,len);\n printf(\"%d\",maxim(browse,len,tab));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define N 200\n\nint a[N], t[N];\n\nint abs(int n) {\n return n < 0 ? -n : n;\n}\n\nint max(int x, int y) {\n return x > y ? x : y;\n}\n\nint func(int b, int k, int n) {\n int i, cnt = 0;\n for (i = 1; i <= n; i++)\n t[i] = a[i];\n for (i = b; i <= n; i += k)\n t[i] = 0;\n for (i = b; i >= 1; i -= k)\n t[i] = 0;\n for (i = 1; i <= n; i++)\n cnt += t[i];\n return abs(cnt);\n}\n\nint main(int argc, char* argv[]) {\n int i, n, k, ans = 0, cnt;\n \n scanf(\"%d%d\", &n, &k);\n for (i = 1; i <= n; i++)\n scanf(\"%d\", &a[i]);\n \n for (i = 1; i <= n; i++) {\n cnt = func(i, k, n);\n ans = max(ans, cnt);\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n int k,n;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n int cnta=0,cntb=0;\n for(int i=0;i<n;i++)\n {\n if(arr[i]==1)\n cnta++;\n if(arr[i]==-1)\n cntb++;\n }\n // printf(\"%d %d\\n\",cnta,cntb);\n int max=0;\n int cntd=cnta,cnte=cntb;\n for(int i=0;i<n;i++)\n {\n cnta=cntd;\n cntb=cnte;\n for(int j=i;j>=0;j=j-k)\n {\n if(arr[j]==1)\n cnta--;\n if(arr[j]==-1)\n cntb--;\n }\n for(int j=i+k;j<n;j=j+k)\n {\n if(arr[j]==1)\n cnta--;\n if(arr[j]==-1)\n cntb--;\n //printf(\"inside: j:%d\\n\",j);\n }\n // printf(\"cnta:%d cntb:%d\\n\",cnta,cntb);\n if(abs(cnta-cntb)>max)\n {\n //printf(\"inside: %d\\n\",abs(cnta-cntb));\n max=abs(cnta-cntb);\n }\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[10000], ans[10000];\nint main()\n{\n int n=0,k=0;\n scanf(\"%d %d\",&n,&k);\n for(int i=0;i<n;++i)\n scanf(\"%d\",&a[i]);\n int j=0;\nwhile(j<k)\n{\n for(int i=0;i<n;i++)\n { \n if(i%k!=j)\n {\n if(a[i]==1) ans[j]++;\n else ans[j]--;\n }\n }\n j++;\n}\nfor(int i=0;i<k;++i)\nif(ans[i]<0)ans[i]=-ans[i];\nint max=-1;\nfor(int i=0;i<k;++i)\n{\n if(ans[i]>max) max=ans[i];\n}\n\nprintf(\"%d\\n\",max);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint max,k,n,i,p[105]={0},q[105]={0},j,b,t=0,c[105]={0},e,s;\n\t\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{ \n\t\tscanf(\"%d\",&p[i]);\n\t\tq[i]=p[i];\n\t}\n\n\tfor(b=1;b<=k;b++)\n\t{\n\t\tfor(i=b;i<=n;i+=k)\n\t\t{ \n\t\t\tq[i]=0;\n\t\t}\n\t\te=0;\n\t\ts=0;\n\t\tfor(j=1;j<=n;j++)\n\t\t{ \n\t//\t\te=0;\n\n\t\t\tif(q[j]==1)\n\t\t\t\te++;\n\t\t\telse if(q[j]==-1)\n\t\t\t\ts++;\n\t\t} \n\t\tc[t]=fabs(e-s);\n// printf(\"%d\\n\",c[t]);\n\t\tt++;\n\n\t\tfor(i=1;i<=n;i++)\n\t\t{ \n\t\t\tq[i]=p[i];\n\t\t}\n \n }\n\tmax=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(max<c[i])\n\t\tmax=c[i];\n\t}\n\tprintf(\"%d\\n\",max);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint tab[110];\nint abs(int a){\n\tint b;\n\tif(a>0){\n\t\treturn a;\n\t}\n\telse return (-1)*a;\n}\nint main(){\n\tint n,k,presum=0,sum=0,des,max=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;i<n;i++){\n\t\tscanf(\"%d\",tab+i);\t\t\n\t}\n\tfor(int i=0;i<n;i++){\n\t\tpresum+=tab[i];\n\t}\n\tfor(int i=0;i<k;i++){\n\t\tfor(int j=0;i+j*k<n;j++){\n\t\t\tsum+=tab[i+j*k];\n\t\t}\n\t\tdes=presum-sum;\n\t\tif(max<abs(des))\tmax=abs(des);\n\t\tsum=0;\n\t}\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n\nint max(int a, int b){\n if(a > b)\n return a;\n return b;\n}\n\nint abs(int a){\n if(a < 0)\n return -a;\n return a;\n}\n\nint main(){\n int n, k;\n scanf(\"%d %d\", &n, &k);\n int sum = 0, arr[k];\n for(int i = 0; i < k; i++){\n arr[i] = 0;\n }\n for(int i = 0; i < n; i++){\n int t;\n scanf(\"%d\", &t);\n sum+=t;\n arr[i%k]+=t;\n }\n int mx = -(1<<30);\n int min = -mx;\n for(int i = 0; i < k; i++){\n if(arr[i] < min){\n min = arr[i];\n }\n if(arr[i] > mx){\n mx = arr[i];\n }\n }\n int ans = max(abs(sum-mx), abs(sum-min));\n printf(\"%d\\n\", ans);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n int n, k, sum1 = 0, sum2 = 0, res = 0;\n scanf(\"%d %d\", &n, &k);\n int *a = (int *)calloc(k, sizeof(int));\n int *b = (int *)calloc(k, sizeof(int));\n for(int i = 0; i < n; ++i){\n int tmp;\n scanf(\"%d\", &tmp);\n if(tmp == -1)\n ++a[i % k], ++sum1;\n else\n ++b[i % k], ++sum2;\n }\n for(int i = 0; i < k; ++i){\n int tmp = abs(sum1 - sum2 - a[i] + b[i]);\n res = tmp > res ? tmp : res;\n }\n printf(\"%d\\n\", res);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,k,j,b=0,c=0,d=0,m=0;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==1)\n b++;\n else\n c++;\n\n }\n for(i=0;i<k;i++)\n {\n int s=b,f=c;\n for(j=i;j<n;j=j+k)\n {\n if(a[j]==1)\n s--;\n else\n f--;\n }\n d=abs(s-f);\n \n if(m<d)\n m=d;\n }\n printf(\"%d\",m);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint arr[n+1];\n\tarr[0]=0;\n\t//int sum=0;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t\t//sum=sum+arr[i];\n\t}\n\tint sand=0;\n\tint l=0;\n\tint max[k];\n\tfor(int i=1;i<=k;i++)\n\t{\n\t\tsand=0;\n\t\tint ans[n+1];\n\t\tfor(int j=0;j<=n;j++)\n\t\t{\n\t\t\tans[j]=arr[j];\n\t\t}\n\t\tfor(int j=i;j<=n;j+=k)\n\t\t{\n\t\t\tans[j]=0;\n\t\t}\n\t\tfor(int j=0;j<=n;j++)\n\t\t{\n\t\t\tsand=sand+ans[j];\n\t\t}\n\t\tif(sand<0)\n\t\t{\n\t\t\tmax[l]=(-1)*sand;\n\t\t\tl++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmax[l]=sand;\n\t\t\tl++;\n\t\t}\n\t}\n\tint mad=0;\n\tfor(int i=0;i<k;i++)\n\t{\n\t\t//printf(\"%d \",max[i]);\n\t\tif(max[i]>mad)\n\t\t\tmad=max[i];\n\t}\n\tprintf(\"%d\\n\",mad);\n}\n\n\t\t\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k,num=0,sum=0,pum=0,cum,j,p,q;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i=i+1)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==1)\n {\n num=num+1;\n }\n else\n {\n sum=sum+1;\n }\n }\n for(i=0;i<n;i=i+1)\n {\n p=i;\n q=i;\n int b=0,c=0;\n if(a[i]==1)\n {\n b=b+1;\n }\n else\n {\n c=c+1;\n }\n for(j=1;j!=0;j=j+1)\n {\n p=p-k;\n if(p>=0)\n {\n if(a[p]==1)\n {\n b=b+1;\n }\n else\n {\n c=c+1;\n }\n }\n q=q+k;\n if(q<n)\n {\n if(a[q]==1)\n {\n b=b+1;\n }\n else\n {\n c=c+1;\n }\n }\n if(p<0 && q>=n)\n {\n break;\n }\n }\n cum=abs((sum-c)-(num-b));\n if(cum>=pum)\n {\n pum=cum;\n }\n }\n printf(\"%d\\n\",pum);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tint n,k,i,j;\n\tint a[100];\n\tint e=0,s=0,de,ds;\n\tint max=0,diff;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)scanf(\"%d\",&a[i]);\n\tfor(i=0;i<n;i++)if(a[i]==1)e++;else s++;\n\tfor(i=0;i<k;i++){\n\t\tde=0;\n\t\tds=0;\n\t\tfor(j=i;j<n;j+=k)if(a[j]==1)de++;else ds++;\n\t\tdiff=abs(e-de-s+ds);\n\t\tif(diff>max)max=diff;\n\t}\n\tprintf(\"%d\",max);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int n, k, i, j, c, es = 0, ss = 0, e = 0, s = 0, max = -1, a[105];\n scanf(\"%d %d\", &n, &k);\n for(i = 1; i <= n; i++)\n {\n scanf(\"%d\", &a[i]);\n if(a[i] == 1)\n es++;\n else\n ss++;\n }\n for(i = 1; i <= k; i++)\n {\n e = es;\n s = ss;\n for(j = 0; (i + j) <= n; j += k)\n {\n c = i + j;\n if(a[c] == 1)\n e--;\n else\n s--;\n }\n if(abs(e - s) > max)\n max = abs(e - s);\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include <Stdio.h>\n#include <String.h>\n#include <math.h>\n\n\nint main() {\n\tint n, k;\n\twhile (scanf(\"%d%d\", &n, &k) != EOF) {\n\t\tint arr[n];\n\t\tint cnt_fu = 0;\n\t\tint cnt_zheng = 0;\n\t\tint result = -1;\n\t\tmemset(arr, 100, sizeof(arr));\n\n\t\tfor (int i = 0 ; i < n; i++) {\n\t\t\tscanf(\"%d\", &arr[i]);\n\t\t\tif (arr[i] == -1) {\n\t\t\t\tcnt_fu++;\n\t\t\t}\n\t\t\tif (arr[i] == 1) {\n\t\t\t\tcnt_zheng++;\n\t\t\t}\n\t\t}\n\t\tint b = 0;\n\t\tint i = 0;\n\t\tint c = 0;\n\t\tfor (b = 0; b < n; b++) { // b <= n\n\t\t\tint tmp[n];\n\t\t\tmemcpy(tmp, arr, sizeof(arr));\n\t\t\tint cnt_fu_jian = 0;\n\t\t\tint cnt_zheng_jian = 0;\n\t\t\tfor (i = -1 * n ; i <= n; i++) {\n\t\t\t\tc = b + i * k;\n\t\t\t\tif (c < 0 || c > n) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse if (arr[c] == -1) {\n\t\t\t\t\tcnt_fu_jian++;\n\t\t\t\t\ttmp[c] = 0;\n\t\t\t\t}\n\t\t\t\telse if (arr[c] == 1) {\n\t\t\t\t\tcnt_zheng_jian++;\n\t\t\t\t\ttmp[c] = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint cnt_fu_sum = cnt_fu - cnt_fu_jian;\n\t\t\tint cnt_zheng_sum = cnt_zheng - cnt_zheng_jian;\n\t\t\tint new = (int)abs(cnt_fu_sum - cnt_zheng_sum);\n\t\t\t// printf(\"new:%d\\tb:%d\\ti:%d\\tc:%d\\n\", new, b, i, c);\n\t\t\tif (new > result) {\n\t\t\t\tresult = new;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", result);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,a[100],i,j,c=0,d=0,mx=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(j=0;j<k;j++)\n {\n for(i=0;i<n;i++)\n {\n if((i+1)%k==j)\n continue;\n if(a[i]==1)\n c++;\n else\n d++;\n }\n if(abs(c-d)>mx)\n mx=abs(c-d);\n c=0;\n d=0;\n }\n printf(\"%d\\n\",mx);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main(){\n\tint n,k,a[101],i,b,j,c[101];\n\tint sum[101]={};\n\tscanf(\"%d%d\",&n,&k);\n\t\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<n;i++){\n\t\tc[i]=a[i];\n\t}\n\n\tfor(b=1;b<=n;b++){\n\t\tfor(i=0;i<n;i++){\n\t\t\ta[i]=c[i];\n\t\t}\n\t\tfor(i=0;b+i*k<=n;i++){\n\t\t\ta[b+i*k-1]=0; \n\t\t}\n\t\tfor(i=0;b+i*k>=1;i--){\n\t\t\ta[b+i*k-1]=0; \n\t\t}\n\t\tfor(j=0;j<n;j++){\n\t\t\tsum[b]+=a[j];\n\t\t}\n\t\tsum[b]=fabs(sum[b]);\n\t}\n\tint temp=0;\n\tfor(i=0;i<n;i++){\n\t\tif(sum[i]>temp)\n\t\t\ttemp=sum[i];\n\t}\n\tprintf(\"%d\",temp);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,k;\nint dem[101];\nint main()\n{\n\tint web,i;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1 ; i<=n ; i++)\n\t{\n\t\tscanf(\"%d\",&web);\n\t\tdem[i%k]+=web;\n\t\tdem[k]+=web;\n\t}\n\n\tint kq=0;\n\tfor(i=0 ; i<k ; i++)\n\t{\n\t\tdem[i]=abs(dem[k]-dem[i]);\n\t\tkq=kq>dem[i]?kq:dem[i];\n\t}\n\n\tprintf(\"%d\",kq);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,k,b,c,e,s,j,val,max,i;\n scanf(\"%d%d\",&n,&k);\n int *a=(int*)calloc(n,sizeof(int));\n for(i=0;i<n;i++)\n scanf(\"%d\",a+i);\n \n max=0;\n for(b=0;b<k;b++)\n {\n e=0,s=0;\n\n for(j=0;j<n;j++)\n {\n if((j-b)%k!=0)\n {\n if(a[j]==1) e++;\n else s++;\n }\n }\n val=abs(e-s);\n //printf(\"val=%d\\n\",val);\n if(val>max)\n max=val;\n }\n printf(\"%d\",max);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n,k,i,b,s;\n scanf(\"%d%d\",&n,&k);\n int tab[n],store[n],sum[k];\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&tab[i]);\n store[i]=tab[i];\n }\n for (b=0;b<k;b++)\n {\n for (i=b;i<n;i+=k)\n {\n tab[i]=0;\n }\n for (i=0;i<n;i++)\n {\n if (tab[i]==1) s++;\n else if (tab[i]==-1) s--;\n }\n sum[b]=abs(s);\n s=0;\n for (i=b;i<n;i+=k)\n {\n tab[i]=store[i];\n }\n }\n for (i=1;i<k;i++)\n {\n if (sum[0]<sum[i])\n sum[0]=sum[i];\n }\n printf(\"%d\",sum[0]);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,k,a1=0,a2=0,a3,a4,m=-1;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[10001];\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==1)\n\t\t{\n\t\t\ta1++;\n\t\t}\n\t\telse if(a[i]==-1)\n\t\t{\n\t\t\ta2++;\n\t\t}\n\t}\n\tfor(int i=1;i<=k;i++)\n\t{\n\t\ta3=a1;\n\t\ta4=a2;\n\t\tfor(int j=i;j<=n;j=j+k)\n\t\t{\n\t\t\tif(a[j]==1)\n\t\t\t{\n\t\t\t\ta3--;\n\t\t\t}\n\t\t\telse if(a[j]==-1)\n\t\t\t{\n\t\t\t\ta4--;\n\t\t\t}\n\t\t}\n\t\tif(abs(a3-a4)>m)\n\t\t{\n\t\t\tm=abs(a3-a4);\n\t\t}\n\t}\n\tprintf(\"%d\\n\",m);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n while(scanf(\"%d %d\",&n,&k)!=EOF)\n {\n getchar();\n int a[2000]={0},x=0,y=0;\n for(int i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==1) x++;\n else y++;\n }\n getchar();\n int max=0;\n for(int i=1;i<=k;i++)\n {\n int x1=x,y1=y;\n for(int j=i;j<=n;j+=k)\n {\n if(a[j]==1) x1--;\n else y1--;\n }\n int m;m=x1-y1;\n if(m<0) m=-m;\n if(m>max) max=m;\n }\n printf(\"%d\\n\",max);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint mod(int a){\n if(a > 0) return a;\n else return -a;\n return -1000;\n}\n\nint main(){\n int n, k, b, i, j, eg=0, sg=0;\n scanf(\"%d %d\", &n, &k);\n int arr[n];\n\n for(i = 0; i < n; i++){\n scanf(\"%d\", &arr[i]);\n if(arr[i] == 1) eg++;\n if(arr[i] == -1)sg++;\n }\n int e=0, s=0, max = 0;\n for(b = 0; b < k; b++){\n e=0;\n s=0;\n for(i = 0; b+i*k < n; i++){\n if(arr[b+i*k] == 1) e++;\n if(arr[b+i*k] == -1)s++;\n }\n if(mod(eg-e-sg+s) > max) max = mod(eg-e-sg+s);\n //printf(\"%d %d\\n\", mod(eg-e-sg+s), b);\n }\n printf(\"%d\", max);\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int n,k,i,j,e,f,max=0;\n scanf(\"%d %d\",&n,&k);\n int a[n+1];\n a[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=n;i++)\n {\n e=0;\n f=0;\n for(j=1;j<=n;j++)\n {\n if((j-i)%k!=0)\n {\n if(a[j]==-1)\n e++;\n else\n f++;\n //printf(\"%d \",a[j]);\n }\n }\n if(max<abs(e-f))\n max=abs(e-f);\n }\n printf(\"%d\\n\",max);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,t,k;\n\tint b,e,s;\n\tscanf(\"%d %d\",&n,&k);\n\tint x[n],arr[n],brr[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&x[i]);\n\tfor(b=0;b<n;b++)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\tarr[i]=1;\n\t\ti=0;\n\t\twhile(1)\n\t\t{\n\t\t\tt=b+k*i;\n\t\t\tif(t>n-1)\n\t\t\tbreak;\n\t\t\tarr[t]=0;\n\t\t\ti++;\n\t\t}\n\t\ti=0;\n\t\twhile(1)\n\t\t{\n\t\t\tt=b-k*i;\n\t\t\tif(t<0)\n\t\t\tbreak;\n\t\t\tarr[t]=0;\n\t\t\ti++;\n\t\t}\n\t\te=0;\n\t\ts=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(arr[i]==0)\n\t\t\tcontinue;\n\t\t\tif(x[i]==1)\n\t\t\te++;\n\t\t\telse if(x[i]==-1)\n\t\t\ts++;\n\t\t}\n\t\tif(e>s)\n\t\tbrr[b]=e-s;\n\t\telse \n\t\tbrr[b]=s-e;\t\t\n\t}\n\tt=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(t<brr[i])\n\t\tt=brr[i];\n\t}\n\tprintf(\"%d\\n\",t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int n,m,k;\n\n int araay[111],array1[111];\n int max=0;\n scanf(\"%d%d\",&n,&k);\n\n for(int i=0;i<n;i++)\n scanf(\"%d\",&araay[i]);\n\n for(int i=0;i<k;i++)\n {\n int countinfo=0,countsocial=0;\n for(int j=0;j<n;j++)\n {\n array1[j]=araay[j];\n }\n for(int j=i;j<n;j+=k)\n {\n array1[j]=0;\n }\n for(int j=0;j<n;j++)\n {\n if(array1[j]==1)\n countinfo++;\n else if(array1[j]==-1)\n countsocial++;\n }\n int result=abs(countinfo-countsocial);\n if(result>max)\n max=result;\n }\n printf(\"%d\",max);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int n,k,e=0,s=0,max=0,temp=0;\n scanf(\"%d %d\",&n,&k);\n int str[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&str[i]);\n }\n for(int b=0;b<k;b++){\n int j=0;\n s=0;\n e=0;\n for(int i=0;i<n;i++){\n if(i==b+j*k) j++;\n else{\n if(str[i]==1) e++;\n if(str[i]==-1) s++;\n }\n }\n temp=abs(e-s);\n if(temp>max) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define MAXLEN 100\n\nint main()\n{\n\tint n,k, tabs[MAXLEN+1];\n\tint l,b,sum,tmp[MAXLEN+1];\n\tint ans;\n\n\twhile(scanf(\"%d%d\",&n,&k)==2)\n\t{\n\t\tans=0;\n\t\tfor(l=1;l<=n;l++) scanf(\"%d\",&tabs[l]);\n\t\t\n\t\tfor(b=1;b<=n;b++)\n\t\t{\n\t\t\tmemcpy((void *)tmp,(void *)tabs,sizeof(int)*(n+1));\n\t\t\t\n\t\t\tfor(l=b;l<=n;l+=k) tmp[l]=0;\n\t\t\tfor(l=b-k;l>0;l-=k) tmp[l]=0;\n\t\t\t\n\t\t\tfor(l=1,sum=0;l<=n;l++) sum+=tmp[l];\n\t\t\tsum=(sum<0)?-sum:sum;\n\t\t \t\n\t\t\tif(sum>ans) ans=sum;\n\t\t}\n\n\t\t\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,max=0,dif=0;\n scanf(\"%d%d\",&n,&k);\n int ar[n],br[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&br[i]);\n for(int b=0;b<n;b++)\n {\n for(int x=0;x<n;x++)\n ar[x]=br[x];\n int i=0,t=0,s=0;\n while(b-(i*k)>=0||b+(i*k)<n)\n {\n if(b-(i*k)>=0)\n ar[b-(i*k)]=0;\n if(b+(i*k)<n)\n ar[b+(i*k)]=0;\n i++;\n }\n for(int j=0;j<n;j++)\n {\n //printf(\"%d \",ar[j]);\n if(ar[j]==-1)\n s++;\n else if(ar[j]==1)\n t++;\n }\n if(t>s)\n dif=t-s;\n else\n dif=s-t;\n if(dif>max)\n max=dif;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define Max 100000\nint main(){\n\tint n,k;\n\tint c,b,i;\n\tint num[Max];\n\tint num1[Max];\n\tint sum1=0,sum2=0,r[Max];\n\tint j,e,f,a=0;\n\tint temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(j=0;j<n;j++){\n\t\tscanf(\"%d\",&num[j]);\n\t}\n\tint q=k;\n\t\n\tfor(b=q-1;b>=0;b--){\n\t\t\n\t\ti=0;\n\t\tsum1=0;\n\t\tsum2=0;\n\t\tc=0;\n\t\tfor(j=0;j<n;j++){\n\t\t\tnum1[j]=num[j];\n\t\t}\n\t\twhile(c<=n){\n\t\t\tc=b+i*k;\n\t\t\tnum1[c-1]=0;\n\t\t\ti++;\t\t\t\n\t\t}\n//\t\tfor(j=0;j<n;j++){\n//\t\t\tprintf(\"%d\",num1[j]);\n//\t\t\t}\n\t\tfor(j=0;j<n;j++){\n\t\t\tif(num1[j]==1){\n\t\t\t\tsum1++;\n\t\t\t}\n\t\t\tif(num1[j]==-1){\n\t\t\t\tsum2++;\n\t\t\t}\n//\t\t\tprintf(\" %d%d\\n\",sum1,sum2);\n\t\t}\n\t\tint l;\n\t\tl=sum1-sum2;\n\t\tr[a]=abs(l);\n//\t\tprintf(\" %d \\n\",r[a]);\n\t\ta++;\n\t}\n\tfor(e=0;e<a-1;e++) \n\t\tfor(f=e+1;f<a;f++)\n\t\t\tif(r[e]<r[f])\n\t\t\t{ \n\t\t\t\ttemp=r[e]; \n\t\t\t\tr[e]=r[f]; \n\t\t\t\tr[f]=temp; \n\t\t\t} \n\tprintf(\"%d\",r[0]);\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint i,e1,s1;\nint n,k,e,s,j,l,x,ans;\nint a[1010];\nint main()\n{\n\tscanf(\"%d%d\",&n,&k);\n\te1=0;s1=0;\n for(i=0;i<n;i++)\n {\n \tscanf(\"%d\",&a[i]);\n \tif(a[i]==1)s1++;else e1++;\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\te=0;\n\t\ts=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tl=j*k+i;\n\t\t\tif(l>=n)break;\n\t\t\tif(a[l]==1)s++;else e++;\n\t\t}\n\t\tx=(e1-e)-(s1-s);\n\t\tif(x<0)x=-x;\n\t\tif(x>ans)ans=x;\n\t}\n\tprintf(\"%d\",ans);\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,e,s,v,st=0,tt=0,f=0,k,j,g;\n scanf(\"%d %d\",&n,&k);\n int A[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&A[i]);\n if(A[i]==1)\n {\n tt++;\n }\n else\n {\n st++;\n }\n }\n for(j=0; j<k; j++)\n {\n e=tt;\n s=st;\n for(v=0; (j+v*k)<n; v++)\n {\n if(A[j+v*k]==1)\n {\n e--;\n }\n else\n {\n s--;\n }\n }\n g=e-s;\n if(g<0)\n {\n g=-g;\n }\n if(g>f)\n {\n f=g;\n }\n }\n printf(\"%d\\n\",f);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k;\n int arr[105];\n\n scanf(\"%d %d\", &n, &k);\n int cons = 0;\n for(int i =0; i< n; i++) {\n scanf(\"%d\", &arr[i]);\n cons += arr[i];\n }\n\n int result = 0;\n\n for(int b= 0; b < n; b++) {\n int temp= cons;\n for(int i = 0; i*k < n; i++) {\n if(b - i*k >= 0) temp -= arr[b - i * k];\n if(b + i*k < n && i != 0) temp -= arr[b + i * k];\n }\n if( temp < 0 ) temp = -1 * temp;\n if( temp > result) result = temp;\n }\n\n printf(\"%d\", result);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,pcount=0,ncount=0,mag,max=0;\n scanf(\"%d%d\",&n,&k);\n int array[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&array[i]);\n if(array[i]>0)\n pcount++;\n }\n ncount=n-pcount;\n for(int i=0;i<k;i++)\n {\n int move=i,count=0,t=(n-i-1)/k;\n for(int j=0;j<=t;j++)\n {\n if(array[move]==1)\n count++;\n else\n count--;\n move+=k;\n }\n mag=pcount-ncount-count;\n if(mag<0)\n mag=-mag;\n\n if(max<mag)\n max=mag;\n\n }\n printf(\"%d\",max);\n\n\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,q=0,w=0,c;\n\tint k;\n\tint a[10000];\n\tint b[10000],max=-999999;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\t\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]); \n\t}\n\tfor(int b=1;b<=n;b++)\n\t{\tq=0;w=0;\n\t\tfor(int j=1;j<=n;j++)\n\t\t{\n\t\t\tif((j-b)%k==0)\n\n\n\t\t\t{continue;\n\n\t\t\t}\n\t\t\tif(a[j]==1)\n\t\t\tw++;\n\t\t\telse\n\t\t\tq++;\n\t\t}\n\t\tif(abs(q-w)>max)\n\t\tmax=abs(q-w);\n\t\tprintf(\"%d %d\\n\",q,w);\n\t\t\n\t}\n\t\n\tprintf(\"%d\",max);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,q=0,w=0,c;\n\tint k;\n\tint a[10000];\n\tint b[10000],max=-999999;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\t\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]); \n\t}\n\tfor(int b=1;b<=n/2;b++)\n\t{\tq=0;w=0;\n\t\tfor(int j=1;j<=n;j++)\n\t\t{\n\t\t\tif((j-b)%k==0)\n\n\n\t\t\t{continue;\n\n\t\t\t}\n\t\t\tif(a[j]==1)\n\t\t\tw++;\n\t\t\telse\n\t\t\tq--;\n\t\t}\n\t\tif(q-w>max)\n\t\tmax=abs(q-w);\n\t\t\n\t\t\n\t}\n\t\n\tprintf(\"%d\",max);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n \n int a[n+1];\n for(int i=1;i<n+1;i++)\n scanf(\"%d\",&a[i]);\n\n int max=0;\n for(int i=1;i<n+1;i++)\n {\n int c;\n if(i/k==0)\n {\n c=i;\n }\n else\n {\n if(i%k==0)\n c=1;\n else if((i+1)%k==0)\n c=2;\n else\n c=3;\n }\n int j=0,e=0,s=0;\n for(int d=1;d<n+1;d++)\n {\n if(d==(c+j*k))\n {\n j++;\n }\n else\n {\n if(a[d]==1)\n e++;\n else\n s++;\n }\n }\n \n if(abs(e-s)>max)\n max=abs(e-s);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n \n int a[n+1];\n for(int i=1;i<n+1;i++)\n scanf(\"%d\",&a[i]);\n\n int max=0;\n for(int i=1;i<n+1;i++)\n {\n int j=-(i/k),e=0,s=0;\n for(int d=1;d<n+1;d++)\n {\n if(d==(i+j*k))\n {\n j++;\n }\n else\n {\n if(a[d]==1)\n e++;\n else\n s++;\n }\n }\n \n if(abs(e-s)>max)\n max=abs(e-s);\n }\n printf(\"%d\",max);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n for(int i = 0;i<n; i++)\n scanf(\"%d\",&arr[i]); \n //int e,s;\n int ans=0;\n for(int i = 0; i < n/2; i++)\n {\n int e=0,s=0;\n int temp[n];\n for(int j=0;j<n;j++)\n temp[j]=arr[j];\n for(int j = i; j < n;)\n {\n temp[j]=0;\n j+=k;\n }\n for(int j = 0; j < n; j++)\n {\n if(temp[j]==1)\n e++;\n else if(temp[j]==-1)\n s++;\n }\n if(fabs(e-s)>=ans)\n ans=fabs(e-s);\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n , k , j , e = 0 , s=0 , num = 0 , min = 0 , max = 0 ;\n scanf(\"%d %d\",&n , &k) ;\n int i , a[n] , sum = 0 ; \n for(i=0 ; i<n ; i++){\n scanf(\"%d\", &a[i]) ;\n sum += a[i] ;\n }\nif(sum>=0){\n //int num = 0 , int min = 0 ; \nfor(j=0 ; j<n ; j++){}\n for(i=j ; i<n ; i = i+k ){\n num += a[i] ;\n }\nif(min>num){\n min = num ;\n int index = j ;\n }\n \nfor(i=0 ; i<n ; i++ ){\n if((i==j)||((i-j)%k==0)) continue ;\n else{\n if(a[i]==1) e++ ;\n else s++ ;\n }\n }\n printf(\"%d\",e-s) ;\n}else{\n //int num = 0 , int max = 0 ; \nfor(j=0 ; j<n ; j++){}\n for(i=j ; i<n ; i = i+k ){\n num += a[i] ;\n }\nif(max<num){\n max = num ;\n int index = j ;\n }\nfor(i=0 ; i<n ; i++ ){\n if((i==j)||((i-j)%k==0)) continue ;\n else{\n if(a[i]==1) e++ ;\n else s++ ;\n }\n }\n printf(\"%d\", e-s) ;\n}\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int64_t i64;\ntypedef int32_t i32;\n\nstatic void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}\nstatic i64 read_int(void){int prev='\\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}\n\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define ABS(a) ((a)>(0)?(a):-(a))\n\nvoid run (void) {\n i32 n = read_int();\n i32 k = read_int();\n i32 *cnt = (i32 *) calloc (k, sizeof (i32));\n i32 sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 a = read_int();\n cnt[a % k]++;\n sum += a;\n }\n i32 max = 0;\n for (i32 i = 0; i < k; ++i) {\n max = MAX(max, ABS(sum - cnt[i]));\n }\n print_int (max);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdint.h>\n#include<inttypes.h>\n\ntypedef int64_t i64;\ntypedef int32_t i32;\n\nstatic void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}\nstatic i64 read_int(void){int prev='\\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}\n\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define ABS(a) ((a)>(0)?(a):-(a))\n\nvoid run (void) {\n i32 n = read_int();\n i32 k = read_int();\n i32 *cnt = (i32 *) calloc (k, sizeof (i32));\n i32 sum = 0;\n for (i32 i = 0; i < n; ++i) {\n i32 a = read_int();\n cnt[i % k]++;\n sum += a;\n }\n i32 max = 0;\n for (i32 i = 0; i < k; ++i) {\n max = MAX(max, ABS(sum - cnt[i]));\n }\n print_int (max);\n puts(\"\");\n}\n\nint main (void) {\n run ();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n static int a[101], t, n, k, sum, max ,i;\n scanf(\"%d%d\", &n, &k);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&t);\n a[t%k] += t;\n sum += t;\n }\n for(i=0; i<k; i++)\n {\n if(max < abs(sum-a[i]))\n max = abs(sum-a[i]);\n }\n printf(\"%d\\n\", max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,t=0,s=0,max,a=0;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k],z[k];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n\n if(x[i]==1) t++;\n else s++;\n }\n\n\n if(t>=s) {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n z[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==-1) y[i]++;\n else z[i]++;\n }\n }\n\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]-z[i]>y[max]-z[max]) max=i;\n }\n\n\n\n\n for(j=max;j<n;j=j+k)\n {\n x[j]=0;\n }\n\n for(j=0;j<n;j++)\n {\n a=a+x[j];\n }\n\n printf(\"%d\",a);\n\n }\n\n\n\n\n\n else {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n z[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==1) y[i]++;\n else z[i]++;\n\n }\n }\n\n\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]-z[i]>y[max]-z[max]) max=i;\n }\n\n\n\n for(j=max;j<n;j=j+k)\n {\n x[j]=0;\n }\n\n for(j=0;j<n;j++)\n {\n a=a+x[j];\n }\n\n printf(\"%d\",-1*a);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,t=0,s=0,max,a=0;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k],z[k];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n a=a+x[i];\n\n if(x[i]==1) t++;\n else s++;\n }\n\n\n if(t>=s) {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n z[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==-1) y[i]++;\n else z[i]++;\n }\n }\n\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]-z[i]>y[max]-z[max]) max=i;\n }\n\n\n\n\n\n\n printf(\"%d\",a+y[max]-z[max]);\n\n }\n\n\n\n\n\n else {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n z[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==1) y[i]++;\n else z[i]++;\n\n }\n }\n\n\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]-z[i]>y[max]-z[max]) max=i;\n }\n\n\n\n\n\n printf(\"%d\",-1*a+y[max]-z[max]);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,t=0,s=0,max,a=0;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n\n if(x[i]==1) t++;\n else s++;\n }\n\n\n\n if(t>=s) {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==-1) y[i]++;\n }\n }\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]>y[max]) max=i;\n }\n\n\n\n\n for(j=max;j<n;j=j+k)\n {\n x[j]=0;\n }\n\n for(j=0;j<n;j++)\n {\n a=a+x[j];\n }\n\n printf(\"%d\",a);\n\n }\n\n\n\n\n\n else {\n\n for(i=0;i<k;i++)\n {y[i]=0;\n for(j=i;j<n;j=j+k)\n {\n if(x[j]==1) y[i]++;\n }\n }\n\n\n\n max=0;\n for(i=1;i<k;i++)\n {\n if(y[i]>y[max]) max=i;\n }\n\n\n\n for(j=max;j<n;j=j+k)\n {\n x[j]=0;\n }\n\n for(j=0;j<n;j++)\n {\n a=a+x[j];\n }\n\n printf(\"%d\",-1*a);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,t=0,s=0,max,a=0;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k],z[k];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&x[i]);\n a=a+x[i];\n\n if(x[i]==1) t++;\n else s++;\n }\n\n\n\n for(i=0; i<k; i++)\n {\n y[i]=0;\n z[i]=0;\n for(j=i; j<n; j=j+k)\n {\n y[i]=y[i]+x[j];\n }\n\n if(t>=s) y[i]=-1*y[i];\n }\n\n max=0;\n for(i=1; i<k; i++)\n {\n if(y[i]>y[max]) max=i;\n }\n\n if(a<0) a=-1*a;\n\n printf(\"%d\",a+y[max]-z[max]);\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,i,j,t=0,s=0,max,a=0;\n\n scanf(\"%d %d\",&n,&k);\n\n int x[n],y[k],z[k];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&x[i]);\n a=a+x[i];\n\n if(x[i]==1) t++;\n else s++;\n }\n\n\n if(t>=s)\n {\n\n for(i=0; i<k; i++)\n {\n y[i]=0;\n z[i]=0;\n for(j=i; j<n; j=j+k)\n {\n if(x[j]==-1) y[i]++;\n else z[i]++;\n }\n }\n\n }\n\n else\n {\n\n for(i=0; i<k; i++)\n {\n y[i]=0;\n z[i]=0;\n for(j=i; j<n; j=j+k)\n {\n if(x[j]==1) y[i]++;\n else z[i]++;\n\n }\n }\n }\n max=0;\n for(i=1; i<k; i++)\n {\n if(y[i]-z[i]>y[max]-z[max]) max=i;\n }\n\n if(a<0) a=-1*a;\n\n printf(\"%d\",a+y[max]-z[max]);\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\n\tint n,k;\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF){\n\t\tint arr[n],i,a[k],b[k],max=-1e9,suma=0,sumb=0;\n\t\tmemset(a,0,sizeof(a));\n\t\tmemset(b,0,sizeof(b));\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\t\tif(arr[i]==1)\n\t\t\t\tsuma++ ;\n\t\t\telse\n\t\t\t\tsumb++;\n\t\t}\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(arr[i]==1){\n\t\t\t\ta[i%k]++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tb[i%k]++;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<k;i++){\n\t\t\tif(abs(a[i]-b[i])>max)\n\t\t\t\tmax=abs(abs(suma-a[i])-abs(sumb-b[i]));\n\t\t}\n\t\tprintf(\"%d\\n\",max);\n\t}\n} \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,a[100],i,j,c=0,d=0,mx=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(j=1;j<=k;j++)\n {\n for(i=0;i<n;i++)\n {\n if((i+1)%k==j)\n continue;\n if(a[i]==1)\n c++;\n else\n d++;\n }\n if(abs(c-d)>mx)\n mx=abs(c-d);\n c=0;\n d=0;\n }\n printf(\"%d\\n\",mx);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n,k,i,b=0;\n scanf(\"%d%d\",&n,&k);\n int tab[n],store[n],sum[k];\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&tab[i]);\n store[i]=tab[i];\n if (i<k)\n sum[i]=0;\n }\n\n for (b=0;b<k;b++)\n {\n for (i=0;i<n;i++)\n tab[i]=store[i];\n for (i=b;i<n;i+=k)\n {\n tab[b]=0;\n }\n for (i=0;i<n;i++)\n {\n if (tab[i]==1) sum[b]++;\n else if (tab[i]==-1) sum[b]--;\n }\n sum[b]=abs(sum[b]);\n }\n for (i=0;i<k;i++) printf(\"%d\\t\",sum[i]);\n for (i=1;i<k;i++)\n {\n if (sum[0]<sum[i])\n sum[0]=sum[i];\n }\n printf(\"%d\",sum[0]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n,k,i,b,s;\n scanf(\"%d%d\",&n,&k);\n int tab[n],store[n],sum[k];\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&tab[i]);\n store[i]=tab[i];\n }\n for (b=0;b<k;b++)\n {\n for (i=b;i<n;i+=k)\n {\n tab[i]=0;\n }\n for (i=0;i<n;i++)\n {\n if (tab[i]==1) s++;\n else if (tab[i]==-1) s--;\n }\n sum[b]=abs(s);\n s=0;\n for (i=b;i<n;i+=k)\n {\n tab[b]=store[b];\n }\n }\n for (i=1;i<k;i++)\n {\n if (sum[0]<sum[i])\n sum[0]=sum[i];\n }\n printf(\"%d\",sum[0]);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n,k,i,b=0;\n scanf(\"%d%d\",&n,&k);\n int tab[n],store[n],sum[k];\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&tab[i]);\n store[i]=tab[i];\n if (i<k)\n sum[i]=0;\n }\n\n for (b=0;b<k;b++)\n {\n for (i=0;i<n;i++)\n tab[i]=store[i];\n for (i=b;i<n;i+=k)\n {\n tab[b]=0;\n }\n for (i=0;i<n;i++)\n {\n if (tab[i]==1) sum[b]++;\n else if (tab[i]==-1) sum[b]--;\n }\n sum[b]=abs(sum[b]);\n }\n for (i=1;i<k;i++)\n {\n if (sum[0]<sum[i])\n sum[0]=sum[i];\n }\n printf(\"%d\",sum[0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int n,k,e=0,s=0,max=0,temp=0;\n scanf(\"%d %d\",&n,&k);\n int str[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&str[i]);\n }\n for(int b=0;b<k-1;b++){\n int j=0;\n for(int i=0;i<n;i++){\n if(i==b+j*k) j++;\n else{\n if(str[i]==1) e++;\n if(str[i]==-1) s++;\n }\n }\n temp=abs(e-s);\n if(temp>max) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int n,k,e=0,s=0,max=0,temp=0;\n scanf(\"%d %d\",&n,&k);\n int str[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&str[i]);\n }\n for(int b=0;b<k-1;b++){\n int j=0;\n s=0;\n e=0;\n for(int i=0;i<n;i++){\n if(i==b+j*k) j++;\n else{\n if(str[i]==1) e++;\n if(str[i]==-1) s++;\n }\n }\n temp=abs(e-s);\n if(temp>max) max=temp;\n }\n printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define Max 100000\nint main(){\n\tint n,k;\n\tint c,b,i;\n\tint num[Max];\n\tint num1[Max];\n\tint sum1=0,sum2=0,r[Max];\n\tint j,e,f,a=0;\n\tint temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(j=0;j<n;j++){\n\t\tscanf(\"%d\",&num[j]);\n\t}\n\tint q=k;\n\twhile(b=--q){\n\t\ti=0;\n\t\tsum1=0;\n\t\tsum2=0;\n\t\tc=0;\n\t\tfor(j=0;j<n;j++){\n\t\t\tnum1[j]=num[j];\n\t\t}\n\t\twhile(c<=n){\n\t\t\tc=b+i*k;\n\t\t\tnum1[c-1]=0;\n\t\t\ti++;\t\t\t\n\t\t}\n//\t\tfor(j=0;j<n;j++){\n//\t\t\tprintf(\"%d\",num1[j]);\n//\t\t\t}\n\t\tfor(j=0;j<n;j++){\n\t\t\tif(num1[j]==1){\n\t\t\t\tsum1++;\n\t\t\t}\n\t\t\tif(num1[j]==-1){\n\t\t\t\tsum2++;\n\t\t\t}\n//\t\t\tprintf(\" %d%d \",sum1,sum2);\n\t\t}\n\t\tint l;\n\t\tl=sum1-sum2;\n\t\tr[a]=abs(l);\n//\t\tprintf(\" %d \",r[a]);\n\t\ta++;\n\t}\n\tfor(e=0;e<a-1;e++) \n\t\tfor(f=e+1;f<a;f++)\n\t\t\tif(r[e]<r[f])\n\t\t\t{ \n\t\t\t\ttemp=r[e]; \n\t\t\t\tr[e]=r[f]; \n\t\t\t\tr[f]=temp; \n\t\t\t} \n\tprintf(\"%d\",r[0]);\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define Max 100\nint main(){\n\tint n,k;\n\tint c,b,i;\n\tint num[Max];\n\tint num1[Max];\n\tint sum1=0,sum2=0,r[Max];\n\tint j,e,f,a=0;\n\tint temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(j=0;j<n;j++){\n\t\tscanf(\"%d\",&num[j]);\n\t}\n\tint q=k;\n\twhile(b=--q){\n\t\ti=0;\n\t\tsum1=0;\n\t\tsum2=0;\n\t\tc=0;\n\t\tfor(j=0;j<n;j++){\n\t\t\tnum1[j]=num[j];\n\t\t}\n\t\twhile(c<=n){\n\t\t\tc=b+i*k;\n\t\t\tnum1[c-1]=0;\n\t\t\ti++;\t\t\t\n\t\t}\n//\t\tfor(j=0;j<n;j++){\n//\t\t\tprintf(\"%d\",num1[j]);\n//\t\t\t}\n\t\tfor(j=0;j<n;j++){\n\t\t\tif(num1[j]==1){\n\t\t\t\tsum1+=num1[j];\n\t\t\t}\n\t\t\tif(num1[j]==-1){\n\t\t\t\tsum2+=num1[j];\n\t\t\t}\n//\t\t\tprintf(\" %d%d \",sum1,sum2);\n\t\t}\n\t\tint l;\n\t\tl=sum1-sum2;\n\t\tr[a]=abs(l);\n//\t\tprintf(\" %d \",r[a]);\n\t\ta++;\n\t}\n\tfor(e=0;e<a-1;e++) \n\t\tfor(f=e+1;f<a;f++)\n\t\t\tif(r[e]<r[f])\n\t\t\t{ \n\t\t\t\ttemp=r[e]; \n\t\t\t\tr[e]=r[f]; \n\t\t\t\tr[f]=temp; \n\t\t\t} \n\tprintf(\"%d\",r[0]);\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define Max 100000\nint main(){\n\tint n,k;\n\tint c,b,i;\n\tint num[Max];\n\tint num1[Max];\n\tint sum1=0,sum2=0,r[Max];\n\tint j,e,f,a=0;\n\tint temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(j=0;j<n;j++){\n\t\tscanf(\"%d\",&num[j]);\n\t}\n\tint q=k;\n\twhile(b=--q){\n\t\ti=0;\n\t\tsum1=0;\n\t\tsum2=0;\n\t\tc=0;\n\t\tfor(j=0;j<n;j++){\n\t\t\tnum1[j]=num[j];\n\t\t}\n\t\twhile(c<=n){\n\t\t\tc=b+i*k;\n\t\t\tnum1[c-1]=0;\n\t\t\ti++;\t\t\t\n\t\t}\n//\t\tfor(j=0;j<n;j++){\n//\t\t\tprintf(\"%d\",num1[j]);\n//\t\t\t}\n\t\tfor(j=0;j<n;j++){\n\t\t\tif(num1[j]==1){\n\t\t\t\tsum1+=num1[j];\n\t\t\t}\n\t\t\tif(num1[j]==-1){\n\t\t\t\tsum2+=num1[j];\n\t\t\t}\n//\t\t\tprintf(\" %d%d \",sum1,sum2);\n\t\t}\n\t\tint l;\n\t\tl=sum1-sum2;\n\t\tr[a]=abs(l);\n//\t\tprintf(\" %d \",r[a]);\n\t\ta++;\n\t}\n\tfor(e=0;e<a-1;e++) \n\t\tfor(f=e+1;f<a;f++)\n\t\t\tif(r[e]<r[f])\n\t\t\t{ \n\t\t\t\ttemp=r[e]; \n\t\t\t\tr[e]=r[f]; \n\t\t\t\tr[f]=temp; \n\t\t\t} \n\tprintf(\"%d\",r[0]);\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k;\n int arr[105];\n\n scanf(\"%d %d\", &n, &k);\n int cons = 0;\n for(int i =0; i< n; i++) {\n scanf(\"%d\", &arr[i]);\n cons += arr[i];\n }\n\n int result = 0;\n\n for(int b= 0; b < n; b++) {\n int temp= cons;\n for(int i = 0; i*k < n; i++) {\n if(b - i*k > 0) temp -= arr[b - i * k];\n if(b + i*k < n && i != 0) temp -= arr[b + i * k];\n }\n if( temp < 0 ) temp = -1 * temp;\n if( temp > result) result = temp;\n }\n\n printf(\"%d\", result);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,q=0,w=0,c;\n\tint k;\n\tint a[10000];\n\tint b[10000],max=-999999;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n==1)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\t\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]); \n\t}\n\tfor(int b=1;b<=n;b++)\n\t{\tq=0;w=0;\n\t\tfor(int j=1;j<=n;j++)\n\t\t{\n\t\t\tif((j-b)%k==0)\n\n\n\t\t\t{continue;\n\n\t\t\t}\n\t\t\tif(a[j]==1)\n\t\t\tw++;\n\t\t\telse\n\t\t\tq--;\n\t\t}\n\t\tif(q-w>max)\n\t\tmax=abs(q-w);\n\t\t\n\t\t\n\t}\n\t\n\tprintf(\"%d\",max);\n\t\n\t\n\treturn 0;\n}"}], "src_uid": "6119258322e06fa6146e592c63313df3"} {"nl": {"description": "Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too many natural numbers, so Volodya decided to start with the first n. He writes down the following sequence of numbers: firstly all odd integers from 1 to n (in ascending order), then all even integers from 1 to n (also in ascending order). Help our hero to find out which number will stand at the position number k.", "input_spec": "The only line of input contains integers n and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u20091012). Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.", "output_spec": "Print the number that will stand at the position number k after Volodya's manipulations.", "sample_inputs": ["10 3", "7 7"], "sample_outputs": ["5", "6"], "notes": "NoteIn the first sample Volodya's sequence will look like this: {1, 3, 5, 7, 9, 2, 4, 6, 8, 10}. The third place in the sequence is therefore occupied by the number 5."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n=0,k=0,y=0,x=0;\n\n scanf(\"%I64d%I64d\",&n,&k);\n\n if(n%2==0)\n {\n y=n/2;\n if(k<=y)\n {\n\n x=2*k-1;\n }\n else if (k>y)\n {\n x=2*(k-y);\n }\n }\n if(n%2!=0)\n {\n y=(n/2)+1;\n if(k<=y)\n {\n x=2*k-1;\n }\n else if(k>y)\n {\n x=2*(k-y);\n }\n }\n\nprintf(\"%I64d\",x);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int i,x,n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(n%2==0)\n x=n/2;\n else\n x=(n/2)+1;\n if(x>=k)\n {\n printf(\"%lld\",2*k-1);\n }\n else\n {\n printf(\"%lld\",2*(k-x));\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long long n, k, i, x;\n scanf(\"%I64d %I64d\",&n,&k);\n if (n%2==0){\n if (k>n/2){\n x=(k-n/2)*2;\n printf(\"%I64d\",x);\n }\n else{\n x=2*k-1;\n printf(\"%I64d\",x);\n }\n }\n else{\n if (k>n/2+1){\n x=(k-(n/2+1))*2;\n printf(\"%I64d\",x);\n }\n else{\n x=2*k-1;\n printf(\"%I64d\",x);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\n long long int n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n if(n%2==0){\n if(k <= n/ 2)\n printf(\"%I64d\",2*k-1);\n else\n printf(\"%I64d\",2*k-n);\n }\n else{\n if(k<=n/2+1)\n printf(\"%I64d\",2*k-1);\n else\n printf(\"%I64d\",2*k-n-1);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\nlong long int n,k;\n\nscanf(\"%lld %lld\",&n,&k);\n\nif((n%2)==0)\n{\n\tif(k>(n/2))\n\t\tprintf(\"%lld\\n\",2*(k-(n/2)));\n\telse\n\t\tprintf(\"%lld\\n\",2*k-1);\n\n\n}\n\nelse{\n\n\tif(k<=((n+1)/2))\n\t\tprintf(\"%lld\\n\",2*k-1);\n\telse\n\t\tprintf(\"%lld\\n\",2*(k-(n+1)/2));\n\n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\n\nint main(){\n\n\tlong long int i = 0, m =0, n = 0, odd[sizeof(long long int)], even[sizeof(long long int)];\n\tlong long int x = 0, y = 0, count = 0, half = 0, total = 0 ;\n\t\n\t\n\n/*____________Scaning The Data___________*/\n\t\n\t\tscanf(\"%I64d %I64d\", &x, &y);\n\n\t\tif (x % 2 == 0)\n\t\t{\n\t\t\thalf = x / 2; //printf(\"%I64d\\n\", half);\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\thalf = (x + 1) / 2; //printf(\"%I64d\\n\", half);\n\t\t}\n\n\n\n\n\t\tif (y <= half)\n\t\t{\n\t\t\ttotal = (2 * y) - 1;\n\t\t\tprintf(\"%I64d\\n\", total);\n\t\t}\n\n\t\tif (y > half)\n\t\t{\n\t\t\ttotal = (y - half) * 2;\n\t\t\tprintf(\"%I64d\\n\", total);\n\t\t}\n\n\n\n\n\treturn 0;\n}// main"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n if (n%2==0)\n {\n if (k<=(n/2))\n {\n printf(\"%I64d\\n\",2*k-1);\n }\n else\n {\n printf(\"%I64d\\n\",2*(k-(n/2)));\n }\n }\n else\n {\n if (k<=(n/2)+1)\n {\n printf(\"%I64d\\n\",2*k-1);\n }\n else\n {\n printf(\"%I64d\\n\",2*(k-((n/2)+1)));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,even,odd;\n scanf(\"%lld %lld\",&n,&k);\n if(n%2==0)\n {\n even=n/2;\n odd=n/2;\n }\n else\n {\n odd=(n/2)+1;\n even=(n/2);\n }\n if(k<=odd)\n printf(\"%lld\",2*(k-1)+1);\n else\n printf(\"%lld\",2*(k-odd));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n double n, k;\n scanf(\"%lf %lf\" , &n, &k);\n if (n==999999999999 && k==999999999999)\n printf(\"999999999998\");\n else if(k<=ceil(n/2))\n printf(\"%.0f\",2*k-1);\n else\n { if ((int)n%2==0)\n k=k-n/2;\n else \n k=k-(int)n/2-1;\n printf(\"%.0f\",2*k);\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ long long int m,n,i,j;\nscanf(\"%I64d%I64d\",&n,&m);\nif(n%2!=0)\n{if(m<=(n+1)/2)\ni=2*m-1;\nelse\ni=2*(m-(n+1)/2);\n}\nelse \n{\nif(m<=n/2)\ni=2*m-1;\nelse\ni=2*(m-n/2);\n}\nprintf(\"%I64d\\n\",i);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,e;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n // for(i=1;i<=n;i+=2)\n //scanf(\"%d\",&i);\n //for(j=2;j<=n;j+=2)\n //scanf(\"%d\",&j);\n if(k<=(n+1)/2)\n e=(2*k)-1;\n else\n {\n if(n%2==0)\n e=(2*k)-n;\n else\n e=(2*k)-n-1;\n }\n printf(\"%I64d\",e);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint\nmain ()\n{\n long long n, k, c,i=0;\n scanf (\"%I64d %I64d\", &n, &k);\n if(n%2==0)\n {\n if(k<=(n/2))\n {\n c=(2*k)-1;\n }\n else if(k>(n/2))\n {\n k=k-(n/2);\n c=2*k;\n }\n }\n\n if(n%2!=0)\n {\n if(k<=(n/2)+1)\n {\n c=2*k-1;\n }\n else if(k>(n/2)+1)\n {\n k=k-(n/2)-1;\n c=2*k;\n }\n \n }\n printf(\"%I64d\",c);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k;\nscanf(\"%lld %lld\",&n,&k);\nif(n%2==0){\n if(k<=(n/2)){\n printf(\"%lld\\n\",(k*2)-1);\n }\n else if(k==n){\n printf(\"%lld\\n\",k);\n }\n else{\n printf(\"%lld\\n\",(k-(n/2))*2);\n\n }\n}\n else{\n if(k<=(n/2)+1){\n printf(\"%lld\\n\",(k*2)-1);\n }\n else if(k==n){\n printf(\"%lld\\n\",k-1);\n }\n else{\n printf(\"%lld\\n\",(k-(n/2+1))*2);\n\n }\n\n}\n\n\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%lld%lld\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n printf(\"%lld\",(k*2)-1);\n else\n printf(\"%lld\",(k-(n/2))*2);\n }\n else\n {\n if(k<=(n/2)+1)\n printf(\"%lld\",(k*2)-1);\n else\n printf(\"%lld\",(k-((n/2)+1))*2);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,e,n;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n //for(i=1;i<=n;i+=2)\n // scanf(\"%d\",&i);\n //for(j=2;j<=n;j+=2)\n // scanf(\"%d\",&j);\n if(k<=(n+1)/2)\n e=(2*k)-1;\n else\n {\n if(n%2==0)\n e=(2*k)-n;\n else\n e=(2*k)-n-1;\n }\n printf(\"%I64d\",e);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long p,k,n,i;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n\n long long s;\n \n if(n%2!=0)\n p=n+2;\n else\n p=n;\n \n if (k<=(p)/2)\n s=2*k-1;\n else\n {\n if(n%2==0)\n s=2*k-n;\n else\n s=2*k-n-1;\n\n }\n\n\n\n printf(\"%I64d\",s);\n\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long n,k;\n scanf(\"%llu%llu\",&n,&k);\n\n if(n%2==0)\n {\n if(k<=n/2) printf(\"%llu\",2*k-1);\n else printf(\"%llu\", 2*(k-n/2));\n }\n else\n {\n if(k<=(n+1)/2) printf(\"%llu\",2*k-1);\n else printf(\"%llu\", 2*(k-(n+1)/2));\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,e;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n // for(i=1;i<=n;i+=2)\n //scanf(\"%d\",&i);\n //for(j=2;j<=n;j+=2)\n //scanf(\"%d\",&j);\n if(k<=(n+1)/2)\n e=(2*k)-1;\n else\n {\n if(n%2==0)\n e=(2*k)-n;\n else\n e=(2*k)-n-1;\n }\n printf(\"%I64d\",e);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n\nint main(void)\n{\n int64_t n,k,z;\n scanf(\"%I64d\", &n);\n scanf(\"%I64d\", &k);\n if (n%2 != 0)\n n = n+1;\n if(n/2 >= k)\n {\n z = 1 + (k-1) * 2;\n }\n else\n {\n k = k - n/2;\n z = 2 + (k-1) * 2;\n\n }\n printf(\"%I64d\", z);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tlong long n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long mid=(n+1)/2;\n\n\tif(k<=mid)\n\t\tprintf(\"%lld\\n\",2*k-1);\n\telse\n\t\tprintf(\"%lld\\n\",(k-mid)*2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n long long n,k,i,o,j=-1;\n scanf(\"%I64d %I64d\",&n,&k);\n //long long arr[n/2+2];\n o = n/2;\n if(n%2!=0)\n o++;\n\n if(k<=o)\n {\n printf(\"%I64d\",1+(k-1)*2);\n }else {\n printf(\"%I64d\",2+((k-o)-1)*2);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdint.h>\nint main(){\t\n\tunsigned long long n=0,k=0,output=0;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tif(n%2==0){\n\t\tif(k<=(n/2ll)){ \t\t\t\n\t\tprintf(\"%I64d\",(k*2ll)-1ll);\n\t\t\t\t\t\n\t\t}\n\t\telse{\n\t\tprintf(\"%I64d\",(k-(n/2ll))*2ll);\n\t\t}\n\t}\n\telse{\n\t\tif(k<=((n/2)+1)){\n\t\tprintf(\"%I64d\",(k*2ll)-1ll);\n\t\t}\n\t\telse{\n\t\tprintf(\"%I64d\",(k-((n/2ll)+1))*2ll);\n\t\t}\n\t}\n\t//printf(\"%I64d \",output);\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int i,j,k,m,n,a,b;\nint main()\n{\n scanf(\"%lld %lld\",&a,&b);\n if(a%2==0)\n {\n if(2*b-1<a)\n {\n printf(\"%lld\",2*b-1); \n } \n else\n {\n printf(\"%lld\",(b-a/2)*2); \n \n }\n }\n else\n {\n if(2*b-1<=a)\n {\n printf(\"%lld\",2*b-1);\n } \n else\n {\n printf(\"%lld\",((b-a/2)-1)*2); \n }\n \n \n }\n \n \n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long n,k,res;\n\n scanf(\"%I64d %I64d\",&n,&k);\n if (k==1)\n printf(\"%I64d\",k);\n else\n {\n if(n%2==0)\n {if(k<=n/2){\n res=k+(k-1);\n printf(\"%I64d\",res);}\n else {printf(\"%I64d\",2*(k-(n/2)));\n }}\n else\n {\n if(k<=n/2+1){\n printf(\"%I64d\",k+(k-1));}\n else{\n printf(\"%I64d\",2*(k-((n+1)/2)));}\n }\n }\nreturn(0);\n}\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long n,k,i,sum;\n\tscanf(\"%lli %lli\",&n,&k);\n\tif (n%2==0 && n/2>=k)\n\t{ sum=1;\n for (i=1; i<k; i=i+1)\n sum=sum+2;\n\t\t}\n else if (n%2==0 && n/2<=k)\n {sum=0;\n for (i=1; i<=k-(n/2); i=i+1)\n sum=sum+2;}\n else if ((n+1)/2>=k)\n\t{\tsum=1;\n for (i=1; i<k; i=i+1)\n\t\t\t\tsum=sum+2;}\n else { sum=0;\n for (i=1; i<=k-((n+1)/2); i=i+1)\n sum=sum+2; }\n\tprintf(\"%lli\", sum);\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n unsigned long long int n,k;\n scanf(\"%llu\",&n);\n scanf(\"%llu\",&k);\n if (k <= (n + 1) / 2)\n {\n printf(\"%llu\",k*2-1);\n }\n else\n {\n printf(\"%llu\",(k-(n+1)/2)*2);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,k,i,j,n1,n2;\n\n scanf(\"%I64d%I64d\",&n,&k);\n\n i=n/2;\n if(n%2==0&&k<=i)n1=k*2-1;\n if(n%2==0&&k>i)n1=(k-i)*2;\n\n\n if(n%2==1&k<=i+1)n1=(k*2-1);\n if(n%2==1&&k>i+1)n1=(k-i-1)*2;\n printf(\"%I64d\",n1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long n,k,i,sum;\n\tscanf(\"%lli %lli\",&n,&k);\n\tif (n%2==0 && n/2>=k)\n\t{ sum=1;\n for (i=1; i<k; i=i+1)\n sum=sum+2;\n\t\t}\n else if (n%2==0 && n/2<=k)\n {sum=0;\n for (i=1; i<=k-(n/2); i=i+1)\n sum=sum+2;}\n else if ((n+1)/2>=k)\n\t{\tsum=1;\n for (i=1; i<k; i=i+1)\n\t\t\t\tsum=sum+2;}\n else { sum=0;\n for (i=1; i<=k-((n+1)/2); i=i+1)\n sum=sum+2; }\n\tprintf(\"%lli\", sum);\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,k;\n\nscanf(\"%lld %lld\",&n,&k);\n\nif(n%2==0){\n if(k<=n/2){printf(\"%lld\\n\",(2*k)-1);}\n else{\n k=k-(n/2);\n printf(\"%lld\\n\",2*k);\n }\n}\nelse{\n if(k<=(n/2)+1){printf(\"%lld\\n\",(2*k)-1);}\n else{\n k=k-(n/2)-1;\n printf(\"%lld\\n\",2*k);\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n#include <inttypes.h>\n\nint main () {\n \n int64_t n,k,a;\n \n scanf(\"%\" PRId64,&n);\n scanf(\"%\" PRId64,&k);\n \n if (n%2==0){\n if(k>(n/2)){\n a=2*(k-(n/2));\n }else{\n a=2*k-1;\n }\n }else{\n if(k>(n/2+1)){\n a=2*(k-(n/2+1));\n }else{\n a=2*k-1;\n }\n }\n \n printf(\"%\" PRId64 \"\\n\", a); \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \nlong long int n,p;\nscanf(\"%lld %lld\",&n,&p);\n \n if(n%2==0)\n {\n if(p<=n/2)\n {\n printf(\"%lld\",2*p-1);\n }\n else{\n p=p-n/2;\n printf(\"%lld\",2*p);\n }\n }\n else{\n if(p<=(n/2)+1)\n {\n printf(\"%lld\",2*p-1);\n }\n else{\n p=p-(n/2)-1;\n printf(\"%lld\",2*p);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n __int64 n,k;\n while(scanf(\"%I64d%I64d\",&n,&k)!=EOF)\n {\n if(k<=(n+1)/2)\n printf(\"%I64d\\n\",2*k-1);\n else\n {\n k=k-(n+1)/2;\n printf(\"%I64d\\n\",2*k);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int k,n,ans,zip;\nint main()\n{\n\tscanf(\"%lld %lld\",&n,&k);\n\t\n\tif(k==1)\n\t{\n\t\tprintf(\"1\");\n\t\treturn 0;\n\t}\n\t\n\tif(n%2==0)\n\t{\n\t\tif(k==n)\n\t\t{\n\t\t\tprintf(\"%lld\",n);\n\t\t\treturn 0;\n\t\t}\n\t\t\tzip=n/2;\n\t\n\t}\n\telse\n\t{\t\n\t\tif(k==n)\n\t\t{\n\t\t\tprintf(\"%lld\",n-1);\n\t\t\treturn 0;\n\t\t}\n\t\tzip=(n/2)+1;\n\t}\t\n\tif(k<=zip)\n\t{\n\t\tans=k*2-1;\n\t\tif(ans<0)\n\t\t\tans=ans*-1;\n\t}\t\n\telse if(k>zip && n%2==0)\n\t{\n\t\tans=n-(2*k);\n\t\t\n\t\tif(ans<0)\n\t\t\tans=ans*-1;\n\t}\n\telse\n\t{\n\t\tans=2*k-n-1;\n\t}\n\tprintf(\"%lld\",ans);\n\t\n\t\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,a,b,c,d,e,f,g,h;\n scanf(\"%I64d %I64d\",&n,&k);\n if(n%2==0)\n {\n a=n/2;\n }\n else\n {\n a=(n/2)+1;\n }\n if(k<=a)\n {\n b=k*2-1;\n printf(\"%I64d\",b);\n }\n else\n {\n c=k-a;\n if(c<0)\n {\n c=c*(-1);\n }\n b=c*2;\n printf(\"%I64d\",b);\n }\n\n}\n"}, {"source_code": "//emre\n#include <stdio.h>\nint main()\n{\n long long int n,k,a,b,c=0,tek=0;\n scanf(\"%I64d %I64d\",&n,&k);\n //tek say\u0131 say\u0131s\u0131n\u0131 bulal\u0131m\n for(a=1;a<=n;a+=2)\n {\n tek++;\n }\n //Bulduk\n if(tek >= k)\n {\n printf(\"%I64d\",1+2*(k-1));\n }\n else\n {\n //tekler fazla degil ise\n printf(\"%I64d\",2+(k-tek-1)*2);\n }\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n long long m;\n long long value;\n if(n%2==0)\n m=n/2;\n else\n m=(n/2)+1;\n if(k<=m)\n value=(k*2)-1;\n else\n {\n k-=m; //to make the even half as start from as 1, 2, 3 ... positions. \n value=k*2;\n }\n\n printf(\"%I64d\\n\",value);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(k<=((n+1)/2)){\n printf(\"%lld\",2*k-1);\n }\n else{\n k=k-((n+1)/2);\n printf(\"%lld\",2*k);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ long long int m,n,i,j;\nscanf(\"%I64d%I64d\",&n,&m);\nif(n%2!=0)\n{if(m<=(n+1)/2)\ni=2*m-1;\nelse\ni=2*(m-(n+1)/2);\n}\nelse \n{\nif(m<=n/2)\ni=2*m-1;\nelse\ni=2*(m-n/2);\n}\nprintf(\"%I64d\\n\",i);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long int n,k,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tif(k<=(n+1)/2)\n\tprintf(\"%lld\",2*k-1);\n\telse printf(\"%lld\",2*(k-(n+1)/2));\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k,value,numOdd;\n scanf(\"%I64d %I64d\",&n,&k);\n// if(n%2!=0) numOdd=(n/2)+1;\n// else numOdd=n/2;\n if(k<=(n+1)/2){ \n value= k*2-1;\n }\n else{\n value=(k-(n+1)/2)*2;\n }\n printf(\"%I64d\",value);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long num, k;\n\tscanf(\"%I64d%I64d\",&num,&k);\n\tif(num&1){\n\t\tnum=num/2+1;\n\t\tif(k<=num)\n\t\tprintf(\"%I64d\",2*k-1);\n\t\telse printf(\"%I64d\",2*(k-num));\n\t\treturn 0;\n\t}\n\tif(!(num&1))\n\t{\n\t\tnum=num/2;\n\t\tif(k<=num) \n\t\tprintf(\"%I64d\",2*k-1);\n\t\telse printf(\"%I64d\",2*(k-num));\n\t}\n\treturn 0;\n} "}, {"source_code": "# include <stdio.h>\n\nint main(void)\n{\n long long n, m;\n while(~scanf(\"%lld%lld\", &n, &m))\n {\n if(n % 2 == 0)\n {\n if(m > n/2)\n printf(\"%lld\\n\", (m-(n/2))*2);\n else\n printf(\"%lld\\n\", 2*m-1);\n }\n else\n {\n if(m > n/2+1)\n printf(\"%lld\\n\", (m-(n/2+1))*2);\n else\n printf(\"%lld\\n\", 2*m-1);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,d;\n scanf(\"%lld %lld\",&n,&k);\n d=(n%2)+(n/2);\n if(d<k)\n printf(\"%lld\",(k-d)*2);\n else\n printf(\"%lld\",(k*2)-1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n long long int n ;\n scanf(\"%lld\",&n);\n long long int m;\n scanf(\"%lld\",&m);\n long long int i,j=0;\n long long int num;\n if(n%2==0)\n {\n n=n/2;\n }\n else if(n%2==1)\n {\n n=n/2+1;\n }\n if(m>n)\n {\n m=m-n;\n num=2*m;\n }\n else\n {\n i=1;\n j=0;\n for(i=1;j<m;i+=2)\n {\n num=i;\n j++;\n }\n }\n printf(\"%lld\",num);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n long long n,k;\n scanf(\"%lld%lld\",&n,&k);\n long long divide=n%2==0? n/2 : ((n+1)/2);\n if(k>divide )\n {\n printf(\"%lld\",2+(2*(k-divide-1)));\n }\n if(k<=divide )\n {\n printf(\"%lld\",1+2*(k-1));\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n,k;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%I64d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%I64d\",(2*k));}\n }\n return 0;\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n,k;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%I64d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%I64d\",(2*k));}\n }\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,k,i,u=1,f=2;\n scanf(\"%I64d%I64d\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",1+2*(k-1));\n else\n printf(\"%I64d\",2+2*(k-1-n/2));\n }\n else\n {\n if(k<=(n+1)/2)\n printf(\"%I64d\",1+2*(k-1));\n else\n printf(\"%I64d\",2+2*(k-1-(n+1)/2));\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\n long long int n,k;\n scanf(\"%I64d %I64d\",&n,&k);\n if(n%2==0){\n if(k <= n/ 2)\n printf(\"%I64d\",2*k-1);\n else\n printf(\"%I64d\",2*k-n);\n }\n else{\n if(k<=n/2+1)\n printf(\"%I64d\",2*k-1);\n else\n printf(\"%I64d\",2*k-n-1);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j;\n long long k,n,h,f,sum1;\n while(scanf(\"%I64d\",&n)!=EOF)\n {\n scanf(\"%I64d\",&k);\n if(k<=n/2)\n {\n sum1=1+(k-1)*2;\n }\n if(k>n/2)\n {\n sum1=2+(k-n/2-1)*2;\n }\n if(k<=n/2+1&&n%2!=0)\n {\n sum1=1+(k-1)*2;\n }\n if(k>n/2+1&&n%2!=0)\n {\n sum1=2+(k-n/2-2)*2;\n }\n printf(\"%I64d\\n\",sum1);\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n long long int ne=floor(n/2);\n long long int no=n-ne;\n if(k>no) printf(\"%lld\",2*(k-no));\n else printf(\"%lld\",(2*k)-1);\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long n,k,i,sum;\n\tscanf(\"%lli %lli\",&n,&k);\n\tif (n%2==0 && n/2>=k)\n\t{ sum=1;\n for (i=1; i<k; i=i+1)\n sum=sum+2;\n\t\t}\n else if (n%2==0 && n/2<=k)\n {sum=0;\n for (i=1; i<=k-(n/2); i=i+1)\n sum=sum+2;}\n else if ((n+1)/2>=k)\n\t{\tsum=1;\n for (i=1; i<k; i=i+1)\n\t\t\t\tsum=sum+2;}\n else { sum=0;\n for (i=1; i<=k-((n+1)/2); i=i+1)\n sum=sum+2; }\n\tprintf(\"%lli\", sum);\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,s,r;\n\n scanf(\"%lld %lld\",&n,&k);\n if(n%2==0)\n s=n/2;\n else\n s=(n/2)+1;\n if(k<=s)\n printf(\"%lld\",((2*k)-1));\n else\n printf(\"%lld\",((k-s)*2));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long x,k,a;\n\tscanf(\"%lld%lld\",&x,&k);\n\ta=(x+1)/2;\n\tif(k<=a)\n\tprintf(\"%lld\",2*k-1);\n\telse\n\tprintf(\"%lld\",(k-a)*2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long n,k,c=0,i=1,j=2,d;\nscanf(\"%I64d %I64d\",&n,&k);\nif(n%2==0)\nd=n/2;\nelse\nd=n/2+1;\nif(k>d)\n{\nk=k-d;\nprintf(\"%I64d\",k*2);\n}\nelse\nprintf(\"%I64d\",k*2-1);\nreturn 0;\n}"}, {"source_code": "\n#include<stdio.h>\n\nint main()\n{\n long long int n=0,k=0,num=0;\n scanf(\"%I64d %I64d\",&n,&k);\n\n if(n%2==0)\n {\n if(k<=n/2)//if k is even\n num=1+(k-1)*2;\n else\n num=2+(k-n/2-1)*2; //if k is odd\n }\n else\n {\n if(k<=(n+2)/2)\n num=1+(k-1)*2;\n else\n num=2+(k-((n+3)/2))*2;\n\n }\n\n\n printf(\"%I64d\",num);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,k,x,p;\n scanf(\"%lld %lld\",&n,&k);\n if(n%2==0)\n { \n p=n/2;\n }\n else{\n p=(n/2)+1;\n }\n \n if(k<=p)\n {\n x=(2*k)-1;\n }\n else\n {\n x=(k-p)*2;\n }\n printf(\"%lld\",x);\n \n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int n,k;\nint main()\n{\nscanf(\"%lld%lld\",&n,&k);\nif(k*2-1<=n)\n printf(\"%lld\",k*2-1);\nelse\n printf(\"%lld\",(k-(n+1)/2)*2);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main()\n{\n\tlong long n, k;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tlong long even;\n\tif(n%2==0)\n\t\teven=n/2;\n\telse\n\t\teven=(n/2)+1;\n\tif(k<=even)\n\t\tprintf(\"%I64d\\n\", 2*k-1);\n\telse\n\t\tprintf(\"%I64d\\n\", 2*(k-even));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n {\n printf(\"%I64d\\n\",2*k-1);\n }\n else\n {\n k=k-n/2;\n printf(\"%I64d\\n\",2*k);\n\n }\n }\n else\n {\n if(k<=(n/2)+1)\n {\n printf(\"%I64d\\n\",2*k-1);\n }\n else\n {\n k=k-(n/2)-1;\n printf(\"%I64d\\n\",2*k);\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,h;\n scanf(\"%lld%lld\",&n,&k);\n if (n%2==0) h=n/2;\n else h=(n/2)+1;\n if (k<=h)\n printf(\"%lld\",(2*k)-1); \n else\n printf(\"%lld\",(k-h)*2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,o,a;\n while(scanf(\"%I64d%I64d\",&n,&k)!=EOF)\n {\n if(n%2==0)\n o=n/2;\n else\n o=(n+1)/2;\n if(k<=o)\n {\n a=2*k-1;\n printf(\"%I64d\\n\",a);\n }\n else\n {\n a=2*(k-o);\n printf(\"%I64d\\n\",a);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \nlong long int n,p;\nscanf(\"%lld %lld\",&n,&p);\n \n if(n%2==0)\n {\n if(p<=n/2)\n {\n printf(\"%lld\",2*p-1);\n }\n else{\n p=p-n/2;\n printf(\"%lld\",2*p);\n }\n }\n else{\n if(p<=(n/2)+1)\n {\n printf(\"%lld\",2*p-1);\n }\n else{\n p=p-(n/2)-1;\n printf(\"%lld\",2*p);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long n,k,i,sum;\n\tscanf(\"%lli %lli\",&n,&k);\n\tif (n%2==0 && n/2>=k)\n\t{ sum=1;\n for (i=1; i<k; i=i+1)\n sum=sum+2;\n\t\t}\n else if (n%2==0 && n/2<=k)\n {sum=0;\n for (i=1; i<=k-(n/2); i=i+1)\n sum=sum+2;}\n else if ((n+1)/2>=k)\n\t{\tsum=1;\n for (i=1; i<k; i=i+1)\n\t\t\t\tsum=sum+2;}\n else { sum=0;\n for (i=1; i<=k-((n+1)/2); i=i+1)\n sum=sum+2; }\n\tprintf(\"%lli\", sum);\n\treturn 0;\n\t}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,k,a,b,c;\n scanf(\"%I64d %I64d\",&n, &k);\n if(n%2!=0)\n {\n a=n/2+1;\n }\n else\n {\n a=n/2;\n }\n if(k<=a)\n {\n b=2*k-1;\n }\n else if(k>a)\n {\n b=2*(k-a);\n }\n printf(\"%I64d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//unsigned long long k[100000000];\nint main()\n{\n /*unsigned long long x,y,i,j=1;\n scanf(\"%I64d%I64d\",&x,&y);\n for(i=1;i<=x;i+=2)\n {\n k[j]=i;\n j+=1;\n }\n for(i=2;i<=x;i+=2)\n {\n k[j]=i;\n j+=1;\n }\n printf(\"%I64d\\n\",k[y]);*/\n\n long long int s,w;\n\tscanf(\"%I64d%I64d\",&s,&w);\n\tif(w<=(s-s/2))\n\tprintf(\"%I64d\",2*w-1);\n\telse\n\tprintf(\"%I64d\",2*(w-(s-s/2)));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,k,a,b,c;\n scanf(\"%I64d %I64d\",&n, &k);\n if(n%2!=0)\n {\n a=n/2+1;\n }\n else\n {\n a=n/2;\n }\n if(k<=a)\n {\n b=2*k-1;\n }\n else if(k>a)\n {\n b=2*(k-a);\n }\n printf(\"%I64d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,m;\n\n scanf(\"%lld %lld\",&n,&k);\n\n if(n%2==0)\n {\n m=n/2;\n }\n else if(n%2!=0)\n {\n m=(n+1)/2;\n }\n\n if(k<=m)\n {\n printf(\"%lld\",(k*2)-1);\n }\n else\n {\n printf(\"%lld\",(k-m)*2);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,h;\n scanf(\"%lld%lld\",&n,&k);\n if (n%2==0) h=n/2;\n else h=(n/2)+1;\n if (k<=h)\n printf(\"%lld\",(2*k)-1); \n else\n printf(\"%lld\",(k-h)*2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n long long int ara[100];\n long long int a,b,i=0,x;\n scanf(\"%I64d%I64d\",&a,&b);\n if(a%2==0)\n x=a/2;\n else\n x=(a/2)+1;\n if(b==x){\n i=(b*2)-1;\n }\n else if(b>x){\n i=(b-x)*2;\n }\n else\n {\n i=(b*2)-1;\n }\n printf(\"%I64d\\n\",i);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define getchar getchar//_unlocked\n#define M 1000000007\n\nint getint ()\n{\n int n=0;\n char ch=getchar();\n\n while(ch<'0' || ch>'9')\n ch=getchar();\n\n while(ch>='0' && ch<='9')\n {\n n=n*10+ch-'0';\n ch=getchar();\n }\n\n return n;\n\n}\n\nint binarysearch(int start ,int end ,int key ,int k)\n{\n\n int middle,val;\n\n while(start<=end)\n {\n middle=(start+end)/2;\n\n val=compute(middle,k);\n\n if(val==key)\n return middle;\n\n if(val<key)\n start=middle+1;\n\n if(val>key)\n end=middle-1;\n\n\n }\n\n return start;\n\n\n\n}\n\nunsigned long long gcd(unsigned long long a, unsigned long long b)\n{\n\n\n unsigned long long div=a,did=b,rem;\n\n while((rem=did%div)!=0)\n {\n did=div;\n div=rem;\n\n }\n\n return div;\n\n\n}\n\nlong long getlonglong ()\n{\n long long n=0;\n char ch=getchar();\n\n while(ch<'0' || ch>'9')\n ch=getchar();\n\n while(ch>='0' && ch<='9')\n {\n n=n*10+ch-'0';\n ch=getchar();\n }\n\n return n;\n\n}\n\n\nvoid sort(int a[] ,int start1 ,int end1 ,int start2 ,int end2)\n{\n\n int temp[end1-start1 +1 + end2-start2+1 ];\n int i=start1,j=start2,count=0;\n\n while(i<=end1 && j<=end2)\n {\n if(a[i]>=a[j])\n temp[count++]=a[i++];\n else\n temp[count++]=a[j++];\n\n\n }\n\n for(;i<=end1;++i)\n temp[count++]=a[i];\n\n for(;j<=end2;++j)\n temp[count++]=a[j];\n\n for(i=0;i<count;++i)\n a[i+start1]=temp[i];\n\n\n}\n\nvoid mergesort(int a[] ,int start,int end)\n{\n if(start==end)\n return;\n\n int middle =(start+end)/2;\n\n mergesort(a,start,middle);\n mergesort(a,middle+1,end);\n sort(a,start,middle,middle+1,end);\n\n}\n\n\nlong long Ceil(long long a , long long n)\n{\n if(a<0)\n return 0;\n\n if(a%n==0)\n return a/n;\n else\n return a/n +1 ;\n\n\n}\n\nint compute(int a ,int k)\n{\n int s= 0;\n\n while(a)\n {\n s=s+a;\n a=a/k;\n\n }\n\n return s;\n\n\n}\n\n\nint main()\n{\n long long n,k;\n\n n=getlonglong();\n k=getlonglong();\n\n if( k <= (n+1)/2)\n printf(\"%I64d\", 2*k-1);\n else\n {\n k= k - (n+1)/2;\n printf(\"%I64d\",2*k);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int i,n,k,a,b,c,d;\n scanf(\"%lld %lld\",&n,&k);\n\n if(n%2==0)\n {\n if(k<=n/2) printf(\"%lld\",k*2-1);\n else printf(\"%lld\",(k-n/2)*2);\n }\n else if(n%2!=0)\n {\n if(k<=n/2+1) printf(\"%lld\",k*2-1);\n else printf(\"%lld\",(k-n/2-1)*2);}\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long x,k,a;\n\tscanf(\"%lld%lld\",&x,&k);\n\ta=(x+1)/2;\n\tif(k<=a)\n\tprintf(\"%lld\",2*k-1);\n\telse\n\tprintf(\"%lld\",(k-a)*2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int ip1,ip2;\n scanf(\"%lld %lld\",&ip1,&ip2);\n long long int r;\n if(ip1%2==0)\n {\n if(ip2<=ip1/2)\n {\n printf(\"%lld\",2*ip2-1);\n }\n else\n {\n ip2=ip2-ip1/2;\n printf(\"%lld\",2*ip2);\n }\n }\n else\n {\n if(ip2<=(ip1/2+1))\n {\n printf(\"%lld\",2*ip2-1);\n }\n else\n {\n ip2=ip2-(ip1/2)-1;\n printf(\"%lld\",2*ip2);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nlong long n,k;\nint main(){\n scanf(\"%lld%lld\",&n,&k);\n if(k>(n+1)/2) printf(\"%lld\",(k-(n+1)/2)*2);\n else printf(\"%lld\",k*2-1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nlong long int a,b;\n\nint main(){\n scanf(\"%lld %lld\",&a,&b); \n if (a%2==0)\n {\n if (2*b-1<a)\n {\n printf(\"%lld\",2*b-1);\n }\n else\n {\n printf(\"%lld\",(b-a/2)*2);\n } \n }\n else\n {\n if (2*b-1<=a)\n {\n printf(\"%lld\",2*b-1);\n }\n else\n {\n printf(\"%lld\",((b-a/2)-1)*2);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\nlong long int n,k;\n\nscanf(\"%lld %lld\",&n,&k);\n\nif((n%2)==0)\n{\n\tif(k>(n/2))\n\t\tprintf(\"%lld\\n\",2*(k-(n/2)));\n\telse\n\t\tprintf(\"%lld\\n\",2*k-1);\n\n\n}\n\nelse{\n\n\tif(k<=((n+1)/2))\n\t\tprintf(\"%lld\\n\",2*k-1);\n\telse\n\t\tprintf(\"%lld\\n\",2*(k-(n+1)/2));\n\n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\nlong long int count, n, q;\nscanf(\"%I64d %I64d %I64d\", &n, &q);\nif (n%2==0)\n{\nif(q<=n/2)\n{\nprintf(\"%I64d\", 2*q-1);\n\n}\nelse\n{printf(\"%I64d\", 2*q-n);\n}\n}\nelse\n{\nif (q<=(n+1)/2)\n{\n\tprintf(\"%I64d\", 2*q-1);}\n\n\n\nelse{\n\nprintf(\"%I64d\", 2*q-n-1);\n}\n\n}}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, m;\n scanf(\"%I64d %I64d\", &n, &m);\n if(m <= n / 2 + (n % 2 == 1))\n printf(\"%I64d\", 2 * m - 1);\n else\n printf(\"%I64d\", 2 * (m - n / 2 - (n % 2 == 1)));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n,k;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%I64d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%I64d\",(2*k));}\n }\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n long long int n =0, k=0;\n scanf(\"%lld %lld\",&n, &k);\n if (n%2 == 0)\n {\n if (k <= n/2)\n {\n printf(\"%lld\", k*2-1);\n }\n else if (k > n/2)\n {\n k= k-(n/2);\n printf(\"%lld\", k*2);\n }\n }\n else\n {\n if (k <= n/2+1)\n {\n printf(\"%lld\", k*2-1);\n }\n else if (k > n/2 +1)\n {\n k= k- n/2 -1;\n printf(\"%lld\", k*2);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long x = 0, y = 0;\n\tscanf(\"%I64d %I64d\", &x, &y);\n\tif (y <= ((x / 2) + (x % 2)))\n\t\tprintf(\"%I64d\\n\", (2 * y) - 1);\n\telse\n\t\tprintf(\"%I64d\\n\", (y - ((x / 2) + (x % 2))) * 2);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,s,r;\n\n scanf(\"%lld %lld\",&n,&k);\n if(n%2==0)\n s=n/2;\n else\n s=(n/2)+1;\n if(k<=s)\n printf(\"%lld\",((2*k)-1));\n else\n printf(\"%lld\",((k-s)*2));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint\nmain ()\n{\n long long n, k, c,i=0;\n scanf (\"%I64d %I64d\", &n, &k);\n if(n%2==0)\n {\n if(k<=(n/2))\n {\n c=(2*k)-1;\n }\n else if(k>(n/2))\n {\n k=k-(n/2);\n c=2*k;\n }\n }\n\n if(n%2!=0)\n {\n if(k<=(n/2)+1)\n {\n c=2*k-1;\n }\n else if(k>(n/2)+1)\n {\n k=k-(n/2)-1;\n c=2*k;\n }\n \n }\n printf(\"%I64d\",c);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long x,k,a;\n\tscanf(\"%lld%lld\",&x,&k);\n\ta=(x+1)/2;\n\tif(k<=a)\n\tprintf(\"%lld\",2*k-1);\n\telse\n\tprintf(\"%lld\",(k-a)*2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(k<=((n+1)/2)){\n printf(\"%lld\",2*k-1);\n }\n else{\n k=k-((n+1)/2);\n printf(\"%lld\",2*k);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//unsigned long long k[100000000];\nint main()\n{\n /*unsigned long long x,y,i,j=1;\n scanf(\"%I64d%I64d\",&x,&y);\n for(i=1;i<=x;i+=2)\n {\n k[j]=i;\n j+=1;\n }\n for(i=2;i<=x;i+=2)\n {\n k[j]=i;\n j+=1;\n }\n printf(\"%I64d\\n\",k[y]);*/\n\n long long int s,w;\n\tscanf(\"%I64d%I64d\",&s,&w);\n\tif(w<=(s-s/2))\n\tprintf(\"%I64d\",2*w-1);\n\telse\n\tprintf(\"%I64d\",2*(w-(s-s/2)));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d%I64d\", &n,&k);\n\n if(n%2==0){\n if(k<=n/2){\n printf(\"%I64d\",2*k-1);\n }else if(k==n){\n printf(\"%I64d\", k);\n }else{\n printf(\"%I64d\",2*(k-(n/2)));\n }\n\n }else{\n if(k<=1+n/2){\n printf(\"%I64d\",2*k-1);\n }else if(k==n){\n printf(\"%I64d\", k-1);\n }else{\n printf(\"%I64d\",2*(k-(n/2)-1));\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdint.h>\nint main(){\t\n\tunsigned long long n=0,k=0,output=0;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tif(n%2==0){\n\t\tif(k<=(n/2ll)){ \t\t\t\n\t\tprintf(\"%I64d\",(k*2ll)-1ll);\n\t\t\t\t\t\n\t\t}\n\t\telse{\n\t\tprintf(\"%I64d\",(k-(n/2ll))*2ll);\n\t\t}\n\t}\n\telse{\n\t\tif(k<=((n/2)+1)){\n\t\tprintf(\"%I64d\",(k*2ll)-1ll);\n\t\t}\n\t\telse{\n\t\tprintf(\"%I64d\",(k-((n/2ll)+1))*2ll);\n\t\t}\n\t}\n\t//printf(\"%I64d \",output);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, m;\n scanf(\"%I64d %I64d\", &n, &m);\n if(m <= n / 2 + (n % 2 == 1))\n printf(\"%I64d\", 2 * m - 1);\n else\n printf(\"%I64d\", 2 * (m - n / 2 - (n % 2 == 1)));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long k ;\nlong long n ;\nlong long x ;\nlong long y ;\nint main()\n{\n scanf(\"%I64d\",&n) ;\n scanf(\"%I64d\",&k) ;\n x=(n+1)/2 ;\n if (k<=x)\n printf(\"%I64d\",((2*k)-1)) ;\n else\n {\n y=(k-x)*2 ;\n if ((n%2!=0) && (k==n))\n y=y ;\n printf(\"%I64d\",y) ;\n }\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{ long long int i,c=0,a,b;\nscanf(\"%lld%lld\",&a,&b);\n if(a%2== 0)\n c=a/2;\n else\n c=a/2+1;\n if(b<=c){\nlong long int p=a-c;\nprintf(\"%lld\",2*b-1);\n}\nelse{\n if(a%2==0)\n c=a/2;\n else\n c=a/2+1;\nlong long int p=b-c;\nprintf(\"%lld\",2*p);\n}\n}\n\n \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdint.h>\n#include<Math.h>\nint main()\n{\nint64_t n,*A,i,j=0,p,t=1,x;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&p);\nx=((n-1)/2)+1;\nif(n%2!=0)\nx=(n-x)+1;\nelse\nx=(n-x);\nif(p<=x)\n printf(\"%I64d\",((p-1)*2)+1);\n else\n {\n p=p-x;\n printf(\"%I64d\",((p)*2));\n }\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d;\n\n scanf(\"%lld%lld\",&a,&b);\n\n\n\n if (a%2==0)\n {\n c=a/2;\n\n }\n\n else\n {\n c=(a/2)+1;\n }\n\n if (b<=c)\n {\n d=(2*b)-1;\n }\n\n else\n {\n d=(b-c)*2;\n }\n\n printf(\"%lld\",d);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long n,k,res;\n\n scanf(\"%I64d %I64d\",&n,&k);\n if (k==1)\n printf(\"%I64d\",k);\n else\n {\n if(n%2==0)\n {if(k<=n/2){\n res=k+(k-1);\n printf(\"%I64d\",res);}\n else {printf(\"%I64d\",2*(k-(n/2)));\n }}\n else\n {\n if(k<=n/2+1){\n printf(\"%I64d\",k+(k-1));}\n else{\n printf(\"%I64d\",2*(k-((n+1)/2)));}\n }\n }\nreturn(0);\n}\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdint.h>\nint main(){\n\nint64_t i,n,k,num;\n\nscanf(\"%I64d%I64d\",&n,&k);\n if(n%2==0 && k<=n/2)\n {\n num=1+(k-1)*2;\n printf(\"%I64d\",num);\n }\n else if(n%2==0 && k>n/2)\n {\n k=k-(n/2);\n num=2*k;\n printf(\"%I64d\",num);\n }\n else if(n%2!=0 && k<=(n/2+1))\n {\n num=1+(k-1)*2;\n printf(\"%I64d\",num);\n }\n else if(n%2!=0 && k>(n/2+1))\n {\n k=k-(n/2+1);\n num=2*k;\n printf(\"%I64d\",num);\n\n }\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long k ;\nlong long n ;\nlong long x ;\nlong long y ;\nint main()\n{\n scanf(\"%I64d\",&n) ;\n scanf(\"%I64d\",&k) ;\n x=(n+1)/2 ;\n if (k<=x)\n printf(\"%I64d\",((2*k)-1)) ;\n else\n {\n y=(k-x)*2 ;\n if ((n%2!=0) && (k==n))\n y=y ;\n printf(\"%I64d\",y) ;\n }\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,k;\n \n scanf (\"%lld%lld\",&n,&k);\n \n if(n%2==0){\n if(k<=n/2){\n printf (\"%lld\\n\",2*k-1);\n }\n else\n {\n k=k-n/2;\n printf (\"%lld\\n\",2*k);\n }\n }\n else{\n if(k<=(n/2)+1){\n printf (\"%lld\\n\",2*k-1);\n }\n else\n {\n k=k-(n/2)-1;\n printf (\"%lld\\n\",2*k);\n }\n }\n return 0;\n}\n \n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(n%2==0){\n if(k<=n/2){\n printf(\"%lld\\n\",2*k-1);\n }\n else{\n k=k-n/2;\n printf(\"%lld\\n\",2*k);\n\n }\n }\n else{\n if(k<=(n/2)+1){\n printf(\"%lld\\n\",2*k-1);\n }\n else{\n k=k-(n/2)-1;\n printf(\"%lld\\n\",2*k);\n\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,x;\n scanf(\"%lld%lld\",&n,&k);\n if(n%2==0)\n {\n x=n/2;\n if(k<=x)\n printf(\"%lld\\n\",(k*2) -1);\n else\n printf(\"%lld\\n\",(k-x)*2);\n }\n if(n%2==1)\n {\n x=(n/2) +1;\n if(k<=x)\n printf(\"%lld\\n\",k*2 -1);\n else\n printf(\"%lld\\n\",(k-x)*2);\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,k,mid;\n scanf(\"%d%d\",&n,&k);\n if(n%2==0)\n {\n mid=n/2;\n if(k<=mid)\n a=2*k-1;\n else if(k>mid){\n a=2*k-n;}\n \n \n }\n if(n%2!=0)\n {\n mid=n/2+1;\n if(k<=mid)\n a=2*k-1;\n else if(k>mid){\n a=2*k-n-1;}\n }\n printf(\"%d\",a);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j=-11,i,k,n;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n if((k<=n/2+1)&&(n%2!=0))\n {\n j=-1;\n for(i=1;i<=k;i++)\n j+=2;\n }\n else if((k>n/2+1)&&(n%2!=0))\n {\n j=2;\n for(i=n/2+2;i<=k;i++)\n j+=2;\n }\n else if((k<=n/2)&&(n%2==0))\n {\n j=-1;\n for(i=1;i<=k;i++)\n j+=2;\n }\n else if((k>n/2)&&(n%2==0))\n {\n j=2;\n for(i=(n/2)+1;i<=k;i++)\n j+=2;\n }\n printf(\"%d\",j);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,k,i,j=0,c,g;\n scanf(\"%ld %ld\",&n,&k);\n c=n/2;\n if(n-c>=k)\n {\n g=0;\n for(i=1; i<=n; i=i+2)\n {\n g++;\n if(g==k)\n {\n printf(\"%ld\",i);\n break;\n }\n }\n }\n else\n {\n g=n-c;\n for(i=2; i<=n; i=i+2)\n {\n g++;\n if(g==k)\n {\n printf(\"%ld\",i);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int k,n;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n if(n%2 != 0)\n {\n if(k>=(n/2) + 1)\n printf(\"%I64d\", 2*((k-1) - (n/2)) );\n else\n printf(\"%I64d\",(2*k) - 1);\n }\n else\n {\n if(k>=(n/2) + 1)\n printf(\"%I64d\", 2*(k-(n/2)) );\n else\n printf(\"%I64d\",(2*k) - 1);\n }\n return 0;\n}\n"}, {"source_code": "int main(){\n long long n,k ;\n scanf(\"%l64d \",&n);\n scanf(\"%l64d\",&k);\n\n if(k==1){\n printf(\"%l64d\",k);\n }\n else{\n if (n%2==0){\n if(k<(n/2))\n printf(\"%l64d\",(2*(k-1))+1);\n else\n printf(\"%l64d\",2*(k-(n/2)));\n }\n else\n {\n if(k<(n/2)+1)\n printf(\"%l64d\",(2*(k-1))+1);\n else\n printf(\"%l64d\",2*(k-(n/2)+1));\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{long long n,k;int i;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%%I64d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%I64d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%I64d\",(2*k));}\n }\n return 0;\n\n }"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int n,i,k,j,a[1000],m=1,h;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if(i%2!=0)\n {\n a[m]=i;\n m++;\n if(m<=n/2)\n break;\n }\n \n }\n h=m;\n for(i=1;i<=n;i++)\n {\n if(i%2==0)\n {\n a[h]=i;\n h++;\n if(h<=n/2)\n break;\n } \n }\n printf(\"%d\",a[k]);\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,k;\nscanf(\"%d %d\",&n,&k);\nif(n%2==0){\n if(k<(n/2)){\n printf(\"%d\",(k*2)-1);\n }\n else if(n==k){\n printf(\"%d\",k);\n }\n else{\n printf(\"%d\",(k%(n/2))*2);\n\n }\n}\n else{\n if(k<(n/2)+1){\n printf(\"%d\",(k*2)-1);\n }\n else if(n==k){\n printf(\"%d\",k-1);\n }\n else{\n printf(\"%d\",(k%(n/2)+1)*2);\n\n }\n\n}\n\n\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k ;\n scanf(\"%lld \",&n);\n scanf(\"%lld\",&k);\n\n if(k==1){\n printf(\"%lld\",k);\n }\n else{\n if (n%2==0){\n if(k<=(n/2))\n printf(\"%lld\",(2*(k-1))+1);\n else\n printf(\"%lld\",2*(k-(n/2)));\n }\n else\n {\n if(k<=(n/2)+1)\n printf(\"%lld\",(2*(k-1))+1);\n else\n printf(\"%lld\",2*(k-((n/2)+2)));\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j,m,n,n1=0,n2=0,r1,r2;\n\n scanf(\"%d\",&n);\n\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\",&m);\n if(m%2==0)\n {\n n1++;\n r1=i;\n }\n if(m%2==1)\n {\n n2++;\n r2=i;\n }\n }\n if(n1==1)printf(\"%d\",r1);\n if(n2==1)printf(\"%d\",r2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n double n,k,by,a;\n long int b;\n int y,x,z;\n scanf(\"%lf\",&n);\n scanf(\"%lf\",&k);\n by=n/2.0;\n x=(long long int)n%10;\n if(x==0 || x%2==0)\n y=1;\n else\n y=0;\n if(y==1 && k<=by)\n z=0;\n else if(y==1 && k>by)\n z=1;\n else if(y==0 && k<=(by+1))\n z=2;\n else\n z=3;\n if(y==1 && z==0)\n {\n printf(\"%0.0lf\",((2*k)-1));\n }\n else if(y==1 && z==1)\n {\n a=k-by;\n printf(\"%0.0lf\",(2*a));\n }\n if(y==0 && z==2)\n {\n printf(\"%0.0lf\",((2*k)-1));\n }\n else if(y==0 && z==3)\n {\n a=2*(k-by-1);\n printf(\"%0.0lf\",a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,x,n,k;\nint ara[100];\nscanf(\"%d %d\",&n,&k);\n\nif(k<=n/2){\n printf(\"%d\\n\",(n+1)/2);\n}\n\nelse{\n for(i=1,x=1;i<=(n/2),x<=n;i++,x=x+2){\n ara[i]=x;\n }\nfor(x=2;x<=n;i++,x=x+2){\n ara[i]=x;\n}\nprintf(\"%d\\n\",ara[k]);\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n \n\nint main () {\n\n\tint n, k = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tint temp = 1;\n\tint index = 0;\n\twhile (temp <= n) {\n\t\tif (index == k) {\n\t\t\tprintf(\"%d\\n\", temp);\n\t\t\treturn 0;\n\t\t}\n\t\tindex++;\n\t\ttemp = temp + 2;\n\t\t\n\t}\n\ttemp = 2;\n\tindex++;\n\twhile (temp <= n) {\n\t\tif (index == k) {\n\t\t\tprintf(\"%d\\n\", temp);\n\t\t\treturn 0;\n\t\t}\n\t\tindex++;\n\t\ttemp = temp + 2;\n\t\t\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n long n,k;\n scanf(\"%ld%ld\",&n,&k);\n long divide=n%2==0? n/2 : ((n+1)/2);\n if(k>divide )\n {\n printf(\"%d\",2+(2*(k-divide-1)));\n }\n if(k<=divide )\n {\n printf(\"%d\",1+2*(k-1));\n }\n\n}"}, {"source_code": "# include<stdio.h>\n# include<stdlib.h>\n\nint main()\n{\n\tlong long int n,k,l=0;\n\tscanf(\"%I64d%I64d\",&n,&k);\n if (n%2==0 && n/2>k)\n {\n \tl=2*k-1;\n }\n if (n%2!=0 && n/2>k)\n {\n \tl = 2*k-1;\n }\n if (n%2==0 && n/2<k)\n {\n \tl = 2*k-(n/2);\n }\n if (n%2!=0 && n/2<k)\n {\n \tl = 2*k-1-(n);\n \tif (l%2==0)\n \t{\n \t\tl =(2*k-1-(n/2))/2 + 1;\n \t}\n \telse\n \t{\n \t\tl =(2*k-1-(n/2))/2;\n \t}\n }\n printf(\"%I64d\\n\",l);\n \n}"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n\n long long int n,k,i,j=0,n1=1,n2=1;\n\n scanf(\"%I64d%I64d\",&n,&k);\n\n for(i=1; i<=n; i=i+2)\n {\n\n\n if(k==n2)j=i;\n n2++;\n n1++;\n }\n for(n1; n1<=n; n1++)\n {\n for(i=2; i<=n; i=i+2)\n {\n if(n1==k)j=i;\n break;\n }\n }\n printf(\"%I64d\",j);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n=0,k=0,y=0,x=0;\n\n scanf(\"%I64d%I64d\",&n,&k);\n\n if(n%2==0)\n {\n y=n/2;\n if(k<=y)\n {\n\n x=2*k-1;\n }\n else if (k>y)\n {\n x=2*(k-y);\n }\n }\n if(n%2!=0)\n {\n y=(n/2);\n if(k<=y)\n {\n x=2*k-1;\n }\n else if(k>y)\n {\n x=2*(k-y-1);\n }\n }\n\nprintf(\"%d\",x);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tif(k<(n/2))\n\t\tprintf(\"%lld\\n\",(2*k)-1);\n\telse if(n%2==1)\n\t\tprintf(\"%lld\\n\",2*(k/2));\n\telse\n\t\tprintf(\"%lld\\n\",2*((k/2)-1));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int n,k,a[1000],i,j=1,m;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if(i%2!=0)\n {\n a[j]=i;\n j++;\n }\n else\n {\n m=(n/2)+1;\n a[m]=i;\n m++;\n }\n }\n printf(\"%d\",a[k]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long n=0,k=0,output=0;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n%2==0){\n\t\tif(k<=(n/2)){ \n\t\t\toutput=(k*2)-1;\n\t\t}\n\t\telse{\n\t\t\toutput=(k-(n/2))*2;\n\t\t}\n\t}\n\telse{\n\t\tif(k<=((n/2)+1)){\n\t\t\toutput=(k*2)-1;\n\t\t}\n\t\telse{\n\t\t\toutput=(k-((n/2)+1))*2;\n\t\t}\n\t}\n\tprintf(\"%d\",output);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long long n,k,c;\n scanf(\"%I64d %I64d\",&n,&k);\n if(n%2==0){\n if(k<=n/2){\n c=2*k-1;\n printf(\"%I64d\",c);}\n else{\n c=2*k;\n printf(\"%I64d\",c);\n }\n }\n if(n%2==1){\n if(k<=(n-1)/2){\n c=2*k-1;\n printf(\"%I64d\",c);}\n else{\n c=2*k;\n printf(\"%I64d\",c);}\n\n }\n }\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n long long int n,k;\n \n scanf(\"%lld %lld\",&n,&k);\n\n if(k<=(n/2)) \n printf(\"%lld\",(2*k-1));\n\n else\n { if(n%2)\n\t printf(\"%lld\",2*(k-n/2-1));\n\n\t else\n\t printf(\"%lld\",2*(k-n/2));\t \n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int k,n;\n scanf(\"%l64d%l64d\",&n,&k);\n if(k<=(n+1)/2){\n \n printf(\"%u\",((2*k)-1));\n\n }\n else{\n k=k-((n+1)/2);\n printf(\"%u\",2*k);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,n,i;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n\n long long s;\n if (k<=(n/2)+1)\n s=2*k-1;\n else\n {\n if(n%2==0)\n s=2*k-n;\n else\n s=2*k-n-1;\n\n }\n\n\n\n printf(\"%I64d\",s);\n\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n;\n long long k,e;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&k);\n for(i=1;i<=n;i+=2)\n scanf(\"%d\",&i);\n for(j=2;j<=n;j+=2)\n scanf(\"%d\",&j);\n if(k<=(n+1)/2)\n e=(2*k)-1;\n else\n {\n if(n%2==0)\n e=(2*k)-n;\n else\n e=(2*k)-n-1;\n }\n printf(\"%d\",e);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned long int a,n,k,i,j;\n scanf(\"%lu %lu\", &n,&k);\n \n for(i=1,a=1;(i<=n);i+=2) {\n \n j=i;\n \n \n if(!(a<k)) {\n printf(\"%d\",j);\n return 0;\n \n }\n \n a++;\n \n }\n \n \n \n for(i=2;(i<=n);i+=2) {\n j=i;\n if(!(a<k)) {\n printf(\"%d\", j);\n return 0;\n }\n \n a++;\n \n \n \n }\n \n \n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n long long int n,k,a,b,c;\n scanf(\"%I64d %I64d\",&n,&k);\n if(n%2==0)\n {\n if(k<n/2)\n {\n printf(\"%I64d\\n\",2*k-1);\n }\n else\n {\n if(k==n) printf(\"%I64d\\n\",n);\n else printf(\"%I64d\\n\",(2*k)%n);\n }\n }\n else\n {\n if(k<(n/2)+1)\n printf(\"%I64d\\n\",2*k-1);\n else\n {\n if(k==n) printf(\"%I64d\\n\",n-1);\n else printf(\"%I64d\\n\",((2*k-1)%n));\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain(){\nlong n,k;\nscanf(\"%ld %ld\",&n,&k);\nif((n||k)==0)\nexit(0);\nif(n%2==0){\nif(n>=(2*k)){\nprintf(\"%ld\",2*k-1);}\nelse\nprintf(\"%ld\",2*(k-(n/2)));}\nif(n%2==1)\n{\nif(n>=(2*k-1))\nprintf(\"%ld\",2*k-1);\nelse\nprintf(\"%ld\",2*(k-(n/2+1)));\n}}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,t,p;\n scanf(\"%I64d%I64d\",&n,&t);\n\n if(n%2==0){\n if(t<=n/2)\n printf(\"%d\",(t*2)-1);\n else\n printf(\"%d\",(t*2)-n);\n }\n else{\n p=n/2;\n if(t<=p+1)\n printf(\"%d\",(t*2)-1);\n else\n printf(\"%d\",(t*2)-(n+1));\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,k,i,u=1,f=2;\n scanf(\"%I64d%I64d\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n printf(\"%I64d\",1+2*(k-1));\n else\n printf(\"%I64d\",2+2*(k-1-n/2));\n }\n else\n {\n if(k<=(n+1)/2)\n printf(\"%I64d\",1+2*(k-1));\n else\n printf(\"%I64d\",2+2*(k-1-n/2));\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\nlong long int n,k,div,ans;\nscanf(\"%l64d %l64d\",&n ,&k);\nif(n%2!=0) div=n/2+1;\nelse div=n/2;\nif(k<=div) ans=(2*k)-1;\nelse ans=(k-div)*2;\nprintf(\"%l64d\",ans);\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long int n,k;\n scanf(\"%ld %ld\",&n,&k);\n if(k>n/2){\n long int c=k-n/2,d=0 ; \n long int b=c;\n while(c>1){\n d=d+2;\n c--;\n } \n if(b==1){\n printf(\"2\");\n } \n else{\n printf(\"%ld\",d);\n }\n } \n if(k<=n/2){\n long int c=k,d=1;\n while(c>1){\n d=d+2; \n c--;\n } \n if(k==1){\n printf(\"1\");\n } \n else{\n printf(\"%ld\",d);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,k,y,m,x;\n float p;\n scanf(\"%lld%lld\",&n,&k);\n p=n/2.0;\n x=ceil(p);\n // printf(\"x= %d\\n\",x);\n if(k<x)\n {\n y=1+(k-1)*2;\n }\n else if(k>x)\n {\n m=n-x;\n y=2+(m-1)*2;\n }\n printf(\"%lld\",y);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint a[1000001];\nint b[1000001];\nint main()\n{\nlong int n,k,i,x=1,y=1;\nscanf(\"%ld %ld\",&n,&k);\nfor(i=1;i<=n;i++)\n{\nif(i%2!=0)\na[x++]=i;\nif(i%2==0)\nb[y++]=i;\n}\n if(k<=ceil((double)n/2))\n {\n printf(\"%d\",a[k]);\n return 0;\n }\n else\n {\n k=k-ceil((double)n/2);\n printf(\"%d\",b[k]);\n return 0;\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i ;\n scanf(\"%d \",&n);\n scanf(\"%d \",&k);\n if (k==1)\n printf(\"%d\",1);\n else\n {\n if (n%2==0)\n {\n if (k<n/2)\n {\n i=1;\n while (i<k)\n i+=2;\n printf(\"%d\", i+2);\n }\n else\n {\n i=2;\n while (i<k)\n i+=2;\n printf(\"%d\", i+2);\n\n }\n }\n\n else\n {\n if (k<(n/2)+2)\n {\n i=1;\n while (i<k)\n i+=2;\n printf(\"%d\", i+2);\n }\n else\n {\n i=0;\n while (i<k)\n i+=2;\n printf(\"%d\", i-4);\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "//emre\n#include <stdio.h>\nint main()\n{\n int n,k,a,b,c=0,tek=0;\n scanf(\"%d %d\",&n,&k);\n //tek say\u0131 say\u0131s\u0131n\u0131 bulal\u0131m\n for(a=1;a<=n;a+=2)\n {\n tek++;\n }\n //Bulduk\n if(tek >= k)\n {\n printf(\"%d\",1+2*(k-1));\n }\n else\n {\n //tekler fazla degil ise\n printf(\"%d\",2+(k-tek-1)*2);\n }\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint n,m,i,j,t=0,x,y,c=0;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&m);\n\tif(x%2==0)\n\t{\n\t\tif(m>x/2)\n\t\t{\n\t\t\tfor(i=2;i<=m;i+=2)\n\t\t\t{\t\n\t\t\t}\n\t\t\tprintf(\"%d\",i);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=1;i<=m;i+=2)\n\t\t\t{\t\n\t\t\t}\n\t\t\tprintf(\"%d\",i);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(m>x/2)\n\t\t{\n\t\t\tfor(i=2;i<=m;i+=2)\n\t\t\t{\t\n\t\t\t}\n\t\t\tprintf(\"%d\",i);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=1;i<=m;i+=2)\n\t\t\t{\t\n\t\t\t}\n\t\t\tprintf(\"%d\",i);\n\t\t}\n\t}\n\t/*for(i=1;i<=x;i++)\n\t{\n\t\tif(i%2!=0)\n\t\t{\n\t\t\ts[c]=i;\n\t\t\tc++;\t\n\t\t}\n\t}\n\tfor(i=1;i<=x;i++)\n\t{\n\t\tif(i%2==0)\n\t\t{\n\t\t\ts[c]=i;\n\t\t\tc++;\t\n\t\t}\n\t}\n\tprintf(\"%d\",s[m-1]);*/\n}"}, {"source_code": "int main(){\n \n int n,k;\n scanf(\"%d %d\\n\",&n, &k);\n int nb = n/2;\n int rest = n%2;\n int result = 1;\n if(rest==0){\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb && k!=1)\n result = k + 2;\n \n else\n result = (k - nb)* 2;\n \n }\n }\n else{\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb+1 && k!=1)\n result = k + 2;\n else\n result = (k - (nb+1))*2;\n }\n \n }\n \n printf(\"%d\",result);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,o=-1,e=0;\n scanf(\"%d\", &n);\n scanf(\"%d\", &k);\n if(n%2==0){\n if(k<=n/2) printf(\"%d\", 2*k-1);\n else printf(\"%d\", (k-(n/2))*2);\n }\n else{\n if(k<=n/2+1) printf(\"%d\", 2*k-1);\n else printf(\"%d\", (k-(n/2+1))*2);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,m;\n\n scanf(\"%lld %lld\",&n,&k);\n\n if(n%2==0)\n {\n m=n/2;\n }\n else if(n%2!=0)\n {\n m=(n+1)/2;\n }\n\n if(k<=m)\n {\n printf(\"%d\",(3*3)-1);\n }\n else\n {\n printf(\"%d\",(k-m)*2);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%ld%lld\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n printf(\"%lld\",2*k-1);\n else\n printf(\"%lld\",2*k-n);\n }\n else\n{if(k<=(n+1)/2)\n printf(\"%lld\",(2*k-1));\n else\n printf(\"%lld\",(2*k-n-1));}\n}"}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n\nint main(void){\n \n long long int n;\n scanf(\"%I64d\", &n);\n long long int output;\n scanf(\"%I64d\", &output);\n long long int ctr = 0;\n \n if(output % 2 == 1){\n for(long long int i = 1; i <= n; i+=2){\n ctr++;\n if(ctr == output){ \n printf(\"%I64d\", i); \n return 0;\n }\n }\n }else{\n if(n % 2 == 0) ctr = n/2;\n else ctr = n/2 + 1;\n for(long long int i = 2; i <= n; i+=2){\n ctr++; \n if(ctr == output){ \n printf(\"%I64d\", i); \n return 0;\n }\n }\n }\n \n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n printf(\"%d\",(2*k)-1);\n else\n printf(\"%d\",(2*k)-n);\n }\n else\n {\n if(k<=(n+1)/2)\n printf(\"%d\",(2*k)-1);\n else\n printf(\"%d\",(2*k)-(n+1));\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ long long int n,k;\nint i;\nscanf(\"%I64d %I64d\",&n,&k);\nif(n%2==0)\n{\n if(k<=(n/2))\n {\n i=(2*k-1);\n printf(\"%d\",i);\n }\n else\n { i=2*k-(n);\n printf(\"%d\",i);\n } }\n else\n {\n if(k<=(n+1)/2)\n {\n printf(\"%d\",2*k-1);\n }\n else{\n\n printf(\"%d\",2*k-(n+1));\n }\n }\n\n}\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n if(n%2==0)\n n=n/2;\n else\n n=(n/2)+1;\n if(k<=n)\n printf(\"%d\",2*k-1);\n else\n printf(\"%d\",2*(k-n));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a,c,d,e;\n scanf(\"%d%d\",&n,&k );\n c=(n+1)/2;\n d=2*k-1;\n a=(n+1)/2;\n e=2*k-2*a;\n if(k<=c) printf(\"%d\",d);\n else printf(\"%d\",e);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long n,k,output,i;\n\tscanf(\"%d %d\",&n,&k);\n\tif(n%2==0){\n\t\tif(k<=(n/2)){ \n\t\t\toutput=(k*2)-1;\n\t\t}\n\t\telse{\n\t\t\toutput=(k-(n/2))*2;\n\t\t}\n\t}\n\telse{\n\t\tif(k<=((n/2)+1)){\n\t\t\toutput=(k*2)-1;\n\t\t}\n\t\telse{\n\t\t\toutput=(k-((n/2)+1))*2;\n\t\t}\n\t}\n\tprintf(\"%d\",output);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int n,k;\n scanf(\"%l64d\",&n);\n scanf(\"%l64d\",&k);\n if (k <= (n + 1) / 2)\n {\n printf(\"%ld\",k*2-1);\n }\n else\n {\n printf(\"%ld\",(k-(n+1)/2)*2);\n }\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <stdbool.h>\n\nint main()\n{\n\tlong long n, k;\n\tscanf(\"%I64d %I64d\", &n, &k);\n\tbool isOdd = n % 2;\n\tlong long mid = isOdd ? n / 2 + 1 : n / 2;\n\tlong long result = 0;\n\n\tif (k > mid)\n\t{\n\t\tlong long counter = k - mid;\n\t\tif (counter == 0)\n\t\t\tresult += 2;\n\t\tif (!isOdd)\n\t\t{\n\t\t\tif (k == n)\n\t\t\t\tresult = n;\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (counter > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += 2;\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (k == n)\n\t\t\t{\n\t\t\t\tresult = n - 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile (counter > 0)\n\t\t\t\t{\n\t\t\t\t\tresult += 2;\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tresult = 1;\n\t\tlong long counter = mid-k;\n\t\tif (counter == 0 && isOdd)\n\t\t\tresult = n;\n\t\telse if(counter == 0 && !isOdd)\n\t\t\tresult = n - 1;\n\t\telse\n\t\t{\n\t\t\tif (counter < mid / 2)\n\t\t\t{\n\t\t\t\tif (isOdd)\n\t\t\t\t{\n\t\t\t\t\tresult = n - 1;\n\t\t\t\t\twhile (counter)\n\t\t\t\t\t{\n\t\t\t\t\t\tresult -= 2;\n\t\t\t\t\t\tcounter--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse result = n;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tint start = 1;\n\t\t\t\twhile (start < k && counter != 0)\n\t\t\t\t{\n\t\t\t\t\tresult += 2;\n\t\t\t\t\tstart++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", result);\n}"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n long int n,k,i=1,j=0,l;\n scanf(\"%ld %ld\",&n,&k);\n int ara[n];\n l=n/2;\n\n\n if(n%2==0) {\n if(k<=l) printf(\"%ld\",(2*k)-1);\n else printf(\"%ld\",2*(k-(l)));\n }\n else {\n if(k<=l+1) printf(\"%ld\",(2*k)-1);\n else printf(\"%ld\",2*(k-(l+1)));\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n,k;\nscanf(\"%l64d\",&n);\nscanf(\"%l64d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%d\",(2*k));}\n }\n return 0;\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int k;\n int res;\n scanf(\"%d %d\",&n,&k);\n if(k!=1)\n {\n\n if(n%2==0)\n {if(k<=n/2)\n res=k+(k-1);\n else res=2*(k-n/2);}\n else\n {\n if(k<=n/2+1)\n res=k+(k-1);\n else\n res=2*(k-n/2);\n }\n\n }\n else\n res=1;\nprintf(\"%d\",res);\nreturn(0);\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int i,j,n,k,s=0;\n scanf(\"%I64d%I64d\",&n,&k);\n int m=n/2;\n if(k<=m){\n for(i=1,j=1;i<=n;i=i+2,j++){\n if(j==k){\n printf(\"%I64d\\n\",i);\n }\n s=j+1;\n }\n }\n else{\n for(i=2,j=s;i<=n;i=i+2,j++){\n if(j==k){\n printf(\"%I64d\\n\",i);\n }\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int n,i,k,j,a[1000],m=1,h;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if(i%2!=0)\n {\n a[m]=i;\n m++;\n if(m<=n/2)\n break;\n }\n \n }\n h=m;\n for(i=1;i<=n;i++)\n {\n if(i%2==0)\n {\n a[h]=i;\n h++;\n if(h<=n/2)\n break;\n } \n }\n printf(\"%d\",a[k]);\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n,k,b=1,i,j=2;\n long long a[1];\n scanf(\"%I64d%I64d\",&n,&k);\n if(n%2!=0)\n {\n for(i=0;i<=n/2;i++)\n {\n a[i]=b;\n b=b+2;\n }\n for(i=(n/2)+1;i<n;i++)\n {\n a[i]=j;\n j=j+2;\n }\n }\n else if(n%2==0)\n {\n for(i=0;i<n/2;i++)\n {\n a[i]=b;\n b=b+2;\n }\n for(i=n/2;i<n;i++)\n {\n a[i]=j;\n j=j+2;\n }\n }\n printf(\"%I64d\",a[k-1]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n if(k < n/2)\n printf(\"%d\", 1+(k-1)*2);\n else printf(\"%d\", (n+(k-1))/2);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n// 318A\n//printf(\"A\\n\");\n\n\n\nint main(int argc, char** argv) {\n int max,idx,n,cur_num,prev_num;\n long int num;\n\n scanf(\"%d%d\", &max, &idx);\n\n if(max%2) { // max is odd\n if (idx<=max/2+1) { // num should be odd\n num = idx*2 - 1;\n }\n else { // num should be even\n num = 2*idx - max-1;\n }\n }\n else { // max is even\n if (idx<=max/2) { // num should be odd\n num = idx*2 - 1;\n }\n else { // num should be even\n num = idx*2 - max;\n }\n }\n\n printf(\"%d\", num);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\n long long int n, k, a;\n double b;\n scanf(\"%I64d %I64d\", &n, &k);\n b = n*1.0/k;\n if(n==999999999997 && k==499999999999){\n printf(\"%I64d\", n);\n }\n else if(n==k && n%2==0){\n printf(\"%I64d\", n);\n }\n else if(n%2==0){\n if(k<=(n/2)){\n printf(\"%I64d\", (k*2)-1);\n }\n else{\n a = n - ((n%k)*2);\n printf(\"%I64d\", a);\n }\n }\n else{\n if(k<=(n/2)){\n printf(\"%I64d\", (k*2)-1);\n }\n else{\n a = n- (((n%k)*2)+1);\n printf(\"%I64d\", a);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long unsigned n,k,i;\n scanf(\"%llu %llu\",&n,&k);\n k=k-1;\n for(i=1;i<n;i=i+2)\n {\n k--;\n if(k==0)\n {\n printf(\"%llu\",i);\n break;\n }\n }\n for(i=0;i<n;i=i+2)\n {\n k--;\n if(k==0)\n {\n if(i==0)\n i=2;\n printf(\"%llu\",i);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,k,i,j=0,c,g;\n scanf(\"%ld %ld\",&n,&k);\n c=n/2;\n if(n-c>=k)\n {\n g=0;\n for(i=1; i<=n; i=i+2)\n {\n g++;\n if(g==k)\n {\n printf(\"%ld\",i);\n break;\n }\n }\n }\n else\n {\n g=n-c;\n for(i=2; i<=n; i=i+2)\n {\n g++;\n if(g==k)\n {\n printf(\"%ld\",i);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n if(k<n/2)\n printf(\"%lld\",2*k-1);\n else if(k>n/2)\n {\n k-=n/2;\n printf(\"%lld\",2*k);\n }\n else if(k=n/2)printf(\"%lld\",n-1);\n return 0;\n}\n"}, {"source_code": "int main(){\n \n int n,k;\n scanf(\"%d %d\\n\",&n, &k);\n int nb = n/2;\n int rest = n%2;\n int result = 1;\n if(rest==0){\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb && k!=1)\n result = k + 2;\n \n else\n result = (k - nb)* 2;\n \n }\n }\n else{\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb+1 && k!=1)\n result = k + 2;\n else\n result = (k - (nb+1))*2;\n }\n \n }\n \n printf(\"%d\",result);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int i,j,n,k,s=0;\n scanf(\"%I64d%I64d\",&n,&k);\n int m=n/2;\n if(k<=m){\n for(i=1,j=1;i<=n;i=i+2,j++){\n if(j==k){\n printf(\"%I64d\\n\",i);\n }\n s=j+1;\n }\n }\n else{\n for(i=2,j=s;i<=n;i=i+2,j++){\n if(j==k){\n printf(\"%I64d\\n\",i);\n }\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\n\nint main()\n{\n long int n=0,k=0,num=0;\n scanf(\"%lli %lli\",&n,&k);\n\n if(n%2==0) //if n is even\n {\n if(k>n/2)//if k is even\n {\n num=2+(k-(n/2)-1)*2;\n }\n else\n //if k is odd\n num=1+(k-1)*2;\n }\n\n else // odd numbers\n {\n if(k<=n/2)//kth term is odd\n {\n num=1+(k-1)*2;\n }\n else\n num=2+(k-((n+1)/2)-1)*2;\n }\n printf(\"%d\",num);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long int bok;\n\nint main () {\n\t\n\tbok n,k;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\t\n\tbok a ;\n\tif ( n % 2 == 0)\n\t\ta = n / 2LL ;\n\telse \n\t\ta = n / 2LL + 1LL;\n\t\n\tbok res;\n\tif ( k < a )\t\t\n\t\tres = 2LL*k - 1LL;\n\telse\n\t\tres = 2LL*k;\n\t\n\tprintf(\"%I64d\",res);\n\t\t\n\t\t\n\t\n\t\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": " #include<stdio.h>\n#define ll long long int\n\nvoid num(ll n,ll p){\n\tif(p<=(n/2+(n%2?1:0)))\n\t printf(\"%d\",2*(p-1)+1);\n\t else {\n\t p=p-(n/2+(n%2?1:0));\n\t printf(\"%d\",2*p);\n\t}\n}\n\n\nint main(){ \n ll n;\n ll p;\n \n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&p);\n num(n,p);\n \n return(0);\n \n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n if(k==n/2+1&&n%2!=0){printf(\"%lld\",n);return 0;}\n if(k<n/2){printf(\"%lld\",1+(k-1)*2);}\n if(k>n/2&&n%2==0){printf(\"%lld\",2+(k-n/2-1)*2);}\n if(k>n/2&&n%2!=0){printf(\"%lld\",2+(k-n/2-2)*2);}\n if(n%2==0&&k==n/2)printf(\"%lld\",n-1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,k,j=0,m=0,b;\n scanf(\"%d%d\",&n,&k);\n b=n;\n if(n%2==0)\n n=n/2;\n else\n n=(n%2)+1;\n for(i=1;i<=b;i++)\n {\n if(k<=n)\n {\n if(i%2!=0)\n {\n m++;\n if(m==k)\n printf(\"%d\",i);\n }\n }\n else\n {\n if(i%2==0)\n {\n j++;\n if(j==(n/2-k))\n printf(\"%d\",i);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,sum;\n long long k,n,h,f;\n long long a[100000];\n while(scanf(\"%I64d\",&n)!=EOF)\n {\n scanf(\"%I64d\",&k);\n if(k<n)\n {\n sum=1+(k-1)*2;\n }\n else\n {\n sum=2+(k/2-1)*2;\n }\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}\n\n"}, {"source_code": "/******************************************************************************\n\n Online C Compiler.\n Code, Compile, Run and Debug C program online.\nWrite your code in this editor and press \"Run\" button to compile and execute it.\n\n*******************************************************************************/\n\n#include <stdio.h>\n#include<string.h>\n\nint main()\n{\n long n,k,num=0;\n scanf(\"%ld %ld\",&n,&k);\n if(n%2==0)\n {\n if(k<=n/2)\n {\n num = (2*k)-1;\n }\n else\n {\n num = (2*(k-(n/2)));\n }\n }\n else\n {\n if(k<=(n/2)+1)\n {\n num = (2*k)-1;\n }\n else\n {\n num = (2*(k-((n/2)+1)));\n }\n }\n printf(\"%d\",num);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,s;\n scanf(\"%lld %lld\",&n,&k);\n if(k<=n/2){\n s=(2*k)-1;\n }\n else\n {\n if(n%2==0)\n k=k-n/2;\n else\n k=k-n/2-1;\n s=k*2;\n }\n printf(\"%lld\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\nunsigned long long int n,k,x;\nscanf(\"%I64d %I64d\",&n,&k);\nif(k<=n/2)\nx=1+(k-1)*2;\nelse\nx=(k-ceil((double)n/2))*2;\nprintf(\"%I64d\",x);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int a,b;\n\nint main(){\n scanf(\"%lld %lld\",&a,&b); \n if (a%2==0)\n {\n if(2*b-1<a)\n {\n printf(\"%lld\",2*b-1); \n }\n else\n printf(\"%lld\",b-(a/2)*2);\n}\n if(a%2==1)\n {\n if(2*b-1<=a)\n {\n printf(\"%lld\",2*b-1); \n } \n else\n printf(\"%lld\",((b-a/2)-1)*2); \n \n } \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int m,n,i,j;\nscanf(\"%I64d %I64d\",&n,&m);\nif(m<=n/2)\ni=2*m-1;\nelse \ni=2*(m-n/2); \nprintf(\"%I64d\\n\",i);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void){\n\n long long a;\n long long b;\n int c=1;\n int d=0;\n \n scanf(\"%d %d\",&a,&b);\n int e=a/2 +1;\n int f=a/2;\n if(a%2==1){\n if(b<=(a/2 +1)){\n for(int i=0;i<(b+1);i++){\n c=c+2;\n }\n printf(\"%d\",c+9);\n }\n if(b>(a/2)){\n for(int i=0;i<b-e;i++){\n d=d+2;\n }\n printf(\"%d\",d);\n }\n\n \n\n }\n\n else{ \n \n if(b<=(a/2)){\n for(int i=0;i<b;i++){\n c=c+2;\n }\n printf(\"%d\",c-2);\n }\n if(b>(a/2)){\n for(int i=0;i<b-f;i++){\n d=d+2;\n }\n printf(\"%d\",d);\n }\n\n }\n \n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n __int64 n,k,i,count;\n int flag,a,b;\n while(scanf(\"%I64d%I64d\",&n,&k)!=EOF)\n {\n count=0;\n flag=0;\n if(k>=(n+1)/2)\n flag=1;\n for(i=1,a=1;a<=(n+1)/2;i+=2,a++)\n {\n count++;\n if(flag) b=k-(n+1)/2;\n else b=k;\n if(b==0&&n%2)\n {\n printf(\"%I64d\\n\",n*2-1);\n break;\n }\n if(b==0&&n%2==0)\n {\n printf(\"%I64d\\n\",n-1);\n break;\n }\n if(count==b)\n {\n if(flag)\n {\n printf(\"%I64d\\n\",i+1);\n break;\n }\n else\n {\n printf(\"%I64d\\n\",i);\n break;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\n\tint a,b,n,z=0,i,j;\n\n\n\tscanf(\"%I64d %I64d\",&n,&a);\n\n\t\n\tif(a <= n/2)\n\t\tprintf(\"%I64d\",(2*a)-1);\n\telse if ( a > n/2)\n\t{\n\t\ta-=n/2;\n\t\tprintf(\"%I64d\",(a)*2);\n\t\n\t\n\t}\n\n\treturn 0;\n}\n\t\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <stdbool.h>\n\nint main()\n{\n\tlong long n, k;\n\tscanf(\"%I64d %I64d\", &n, &k);\n\tbool isOdd = n % 2;\n\tlong long mid = isOdd ? n / 2 + 1 : n / 2;\n\tlong long result = 0;\n\n\tif (k > mid)\n\t{\n\t\tlong long counter = k - mid;\n\t\tif (k == n)\n\t\t\tresult = n;\n\t\telse\n\t\t{\n\t\t\tif (counter == 0)\n\t\t\t\tresult += 2;\n\t\t\twhile (counter > 0)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t\tcounter--;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tresult = 1;\n\t\tlong long counter = mid-k;\n\t\tif (counter == 0 && isOdd)\n\t\t\tresult = n;\n\t\telse if(counter == 0 && !isOdd)\n\t\t\tresult = n - 1;\n\t\tif (counter < mid / 2)\n\t\t{\n\t\t\tif (isOdd)\n\t\t\t{\n\t\t\t\tresult = n - 1;\n\t\t\t\twhile (counter)\n\t\t\t\t{\n\t\t\t\t\tresult -= 2;\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tint start = 1;\n\t\t\twhile (start < k && counter != 0)\n\t\t\t{\n\t\t\t\tresult += 2;\n\t\t\t\tstart++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", result);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n double n,k,by;\n long int a,b;\n int y,x,z;\n scanf(\"%lf\",&n);\n scanf(\"%lf\",&k);\n if(n==k)\n {\n printf(\"%0.0lf\",(n-1));\n return 0;\n }\n by=n/2.0;\n b=by;\n x=(long long int)n%10;\n if(x==0 || x%2==0)\n y=1;\n else\n y=0;\n if(y==1 && k<=by)\n z=0;\n else if(y==1 && k>by)\n z=1;\n else if(y==0 && k<=(by+1))\n z=2;\n else\n z=3;\n if(y==1 && z==0)\n {\n printf(\"%0.0lf\",((2*k)-1));\n }\n else if(y==1 && z==1)\n {\n a=k-by;\n printf(\"%ld\",(2*a));\n }\n if(y==0 && z==2)\n {\n printf(\"%0.0lf\",((2*k)-1));\n }\n else if(y==0 && z==3)\n {\n a=2*(k-b-1);\n printf(\"%ld\",a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\n\nint main()\n{\n\n unsigned long long int n , m, num;\n\n\n scanf(\"%lld %lld\", &n, &m);\n\n if(n==999999999997)\n if(m== 499999999999){\n printf(\"999999999997\");\n\n return 0;\n }\n\n if(n%2==0)\n {\n if(m<=n/2)\n {\n printf(\"%lld\", 2*m-1 );\n }\n else\n {\n m=m-n/2;\n printf(\"%lld\", 2*m);\n }\n }\n\n else\n\n {\n if(m<=(long double)n/2)\n {\n printf(\"%lld\", 2*m-1 );\n }\n else {\n m=m-(long long int)((long double)n/2)-1;\n\n printf(\"%lld\", 2*m );}\n\n }\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int n,k,m;\n scanf(\"%I64d %I64d\", &n, &k);\n if (n%2==0){\n if (k<=n/2) m=1+(k-1)*2;\n else{\n if (k%2==0) m=(k/2-1)*2;\n else m=(k-n/2-1)*2+2;\n }\n }\n else{\n if (k<=n/2+1) m=1+(k-1)*2;\n else{\n if (k%2==0) m=(k-n/2-1)*2;\n else m=(k-n/2-1)*2;\n }\n }\n printf(\"%I64d\", m);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,k; scanf(\"%lld%lld\",&n,&k); //printf(\"%d\",n);\n if(n%2==1){\n if(k>=n/2+1) printf(\"%lld\",2*(k-n/2-1));\n else printf(\"%lld\",2*k-1);}\n else {\n if(k>=n/2+1) printf(\"%lld\",2*(k-n/2));\n else printf(\"%lld\",2*k-1);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,k,y,m,x;\n double p;\n scanf(\"%lld%lld\",&n,&k);\n x=(n+1)/2;\n printf(\"x= %d\\n\",x);\n if(k<=x)\n {\n y=1+(k-1)*2;\n }\n else if(k>x)\n {\n m=k-x;\n y=2+(m-1)*2;\n }\n printf(\"%lld\",y);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int i,x,n,k;\nint ara[1000];\nscanf(\"%lld %lld\",&n,&k);\n\nif(k<=n/2){\n printf(\"%d\\n\",(n+1)/2);\n}\n\nelse{\n for(i=1,x=1;i<=(n/2),x<=n;i++,x=x+2){\n ara[i]=x;\n }\nfor(x=2;x<=n;i++,x=x+2){\n ara[i]=x;\n}\nprintf(\"%d\\n\",ara[k]);\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long n,x,i;\n\tscanf(\"%lld%lld\",&n,&x);\n\tint a[2*n+1];\n\tfor(i=1;i<=n;i++){\n\t\ta[i]=2*i-1;\n\t}\n\tfor(i=n+1;i<=2*n;i++){\n\t\ta[i]=(i-n)*2;\n\t}\n\t/*for(i=1;i<=2*n;i++){\n\t\tprintf(\"%d \" ,a[i]);\n\t}*/\n\tprintf(\"%lld\",a[x]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\n\tint a,b,n,z=0,i,j;\n\n\n\tscanf(\"%d %d\",&n,&a);\n\n\t\n\tif(a <= n/2)\n\t\tprintf(\"%d\",(2*a)-1);\n\telse if ( a > n/2)\n\t{\n\t\ta-=n/2;\n\t\tprintf(\"%d\",(a)*2);\n\t\n\t\n\t}\n\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tlong int a, x, j=1, d=2;\n\tint i=0;\n\tscanf(\"%ld %ld\", &a, &x);\n\tx-=1;\n\twhile(j<=a){\n\t\tif(x==0){\n\t\t\tprintf(\"%ld\",j);\n\t\t\ti=-1;\n\t\t\tbreak;\n\t\t}\n\t\tj+=2;\n\t\tif(j>a)\n\t\t\tbreak;\n\t\tx-=1;\n\t}\n\tx-=1;\n\twhile(d<=a&&i!=-1){\n\t\tif(x==0){\n\t\t\tprintf(\"%ld\",d);\n\t\t\tbreak;\n\t\t}\n\t\td+=2;\n\t\tx-=1;\n\t}\n\treturn 0;\n} "}, {"source_code": "# include<stdio.h>\n# include<stdlib.h>\n\nint main()\n{\n\tlong long int n,k,l=0;\n\tscanf(\"%I64d%I64d\",&n,&k);\n if (n%2==0 && n/2>k)\n {\n \tl=2*k-1;\n }\n if (n%2!=0 && n/2>k)\n {\n \tl = 2*k-1;\n }\n if (n%2==0 && n/2<k)\n {\n \tl = 2*k-(n);\n }\n if (n%2==0 && n/2 ==k)\n {\n \tl = 2*k-1;\n }\n if (n%2!=0 && n/2<k)\n {\n \tl = 2*k-1-(n/2);\n \tif (l%2==0)\n \t{\n \t\tl =(2*k-1-(n/2))/2 + 1;\n \t}\n \telse\n \t{\n \t\tl =(2*k-1-(n/2))/2;\n \t}\n }\n printf(\"%I64d\\n\",l);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d%I64d\", &n,&k);\n\n if(n%2==0){\n if(k<=n/2){\n printf(\"%I64d\",2*k-1);\n }else if(k==n){\n printf(\"%I64d\", k);\n }else{\n printf(\"%I64d\",2*(k-(n/2)));\n }\n\n }else{\n if(k<=1+n/2){\n printf(\"%I64d\",2*k-1);\n }else if(k==n){\n printf(\"%I64d\", k-1);\n }else{\n printf(\"%I64d\",2*(k-(n/2)+1));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tif(k<=n/2)\n\t\tprintf(\"%d\\n\",(2*k-1));\n\telse\n\t{\n\t\tif(n%2==0)\n\t\t\tprintf(\"%d\\n\",(2*k-n));\n\t\telse\n\t\t\tprintf(\"%d\\n\",(2*k-1-n));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n,k;int i;\nscanf(\"%d\",&n);\nscanf(\"%d\",&k);\nif(n%2==0)\n {\n if(k<=n/2)\n printf(\"%d\",((2*k)-1));\n else\n {k=k-n/2;\n printf(\"%d\",(2*k));}\n }\nelse\n { if(k<=(n+1)/2)\n printf(\"%d\",((2*k)-1));\n else\n {k=k-(n+1)/2;\n printf(\"%d\",(2*k));}\n }\n return 0;\n\n }\n"}, {"source_code": "int main(){\n \n int n,k;\n scanf(\"%d %d\\n\",&n, &k);\n int nb = n/2;\n int rest = n%2;\n int result = 1;\n if(rest==0){\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb && k!=1)\n result = k + 2;\n \n else\n result = (k - nb)* 2;\n \n }\n }\n else{\n if (k == 1){\n result = 1;\n // printf(\"test1\");\n }\n else{\n if(k<=nb+1 && k!=1)\n result = k + 2;\n else\n result = (k - (nb+1))*2;\n }\n \n }\n \n printf(\"%d\",result);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,k,x;\n scanf(\"%lld %lld\",&n,&k);\n if(n%2==0)\n { int p=n/2;\n if(k<=p)\n {\n x=(2*k)-1;\n }\n else\n {\n x=2*(k-(n/2));\n }\n }\n else{\n int p=(n/2)+1;\n if(k<=p)\n {\n x=(2*k)-1;\n }\n else{\n\n x=(k-p)*2;\n }\n\n\n }\n printf(\"%lld\",x);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d%I64d\", &n,&k);\n\n if(n%2==0){\n if(k<=n/2){\n printf(\"%I64d\",2*k-1);\n }else{\n printf(\"%I64d\",k-(n/2)+1);\n }\n }else{\n if(k<=1+n/2){\n printf(\"%I64d\",2*k-1);\n }else{\n printf(\"%I64d\",k-(n/2)+2);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int m,n,i,j;\nscanf(\"%d%d\",&n,&m);\nif(n%2!=0)\n{if(m<=(n+1)/2)\ni=2*m-1;\nelse\ni=2*(m-(n+1)/2);\n}\nelse \n{\nif(m<=n/2)\ni=2*m-1;\nelse\ni=2*(m-n/2);\n}\nprintf(\"%d\\n\",i);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n long long int m=0;\n m=n/2;\n if(k<=m)\n printf(\"%ld\",2*(k-1)+1);\n else\n printf(\"%ld\",2*(k-m));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i,j=0,k,m=0,l,p;\n\n int str[1000],str1[1000],str3[1000];\n\n scanf(\"%s%s\",str,str1);\n\n l=atoi(str);\n p=atoi(str3)-1;\n\n for(i=0;i<l/2;i++)\n\n {\n str1[i]=1+j;\n j=j+2;\n }\n\n if(l%2==0)\n {\n for(k=l/2;k<l;k++)\n {\n str1[k]=2+m;\n m=m+2;\n }\n }\n else\n {\n for(k=(l/2)+1;k<l;k++)\n {\n str1[k]=2+m;\n m=m+2;\n }\n }\n str1[l]='\\0';\n\n printf(\"%d\",str1[p]);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{long n,k;\nlong s=0,i;\nscanf(\"%d %d\",&n,&k);\nfor( i=1;i<=n;i=i+2)\n{\n\ts++;\n\tif(k==s)\n\tbreak;\n}\nfor( i=2;i<=n;i=i+2)\n{\ns++;\n\tif(k==s)\n\tbreak;\t\n}\nprintf(\"%ld\",i);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d%I64d\", &n,&k);\n\n if(n%2==0){\n if(k<=n/2){\n printf(\"%I64d\",2*k-1);\n }else{\n printf(\"%I64d\",k-(n/2)+1);\n }\n }else{\n if(k<=1+n/2){\n printf(\"%I64d\",2*k-1);\n }else{\n printf(\"%I64d\",k-(n/2)+2);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n long long n,k,i,sum;\n scanf(\"%lli %lli\", &n, &k);\n\n if (n%2==0 && n/2>=k){ sum=1;\n for(i=1;i<=n/2;i=i+1)\n sum=sum+2;\n }\n else if (n%2==0 && n/2<=k) {sum=0;\n for(i=1;i<=k/2;i=i+1)\n sum=sum+2;\n }\n else if (n%2!=0 && n+1/2>=k)\n {\n sum=1;\n for(i=1; i<=k; i=i+1)\n sum=sum+2; }\n else {\n sum=0;\n for(i=1;i<=k/2; i=i+1)\n sum=sum+2;\n }\n printf(\"%lli\", sum);\n return 0;\n\n }\n\n\n\n"}], "src_uid": "1f8056884db00ad8294a7cc0be75fe97"} {"nl": {"description": "IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.", "input_spec": "The only line of the input contains one integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091018) \u2014 the prediction on the number of people who will buy the game.", "output_spec": "Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.", "sample_inputs": ["3000"], "sample_outputs": ["1"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long long n,x;\n scanf(\"%lld\",&n);\n x = n/2520;\n printf(\"%lld\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n unsigned long long n;\n\n scanf(\"%llu\", &n);\n if(n < 2520)\n {\n printf(\"0\\n\");\n }\n\n else\n {\n printf(\"%llu\\n\", n / 2520);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d\",&n);\n k=n/2520;\n printf(\"%I64d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nunsigned long long int a,b,c,s,i,l,j,k,n;\nscanf(\"%llu\",&n);\nprintf(\"%llu\\n\",n/2520);\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n long long int n ;\n scanf(\"%lli\",&n);\n n=n/2520;\n printf(\"%lli\",n);\n}\n"}, {"source_code": "#include<stdio.h>\n\n/*int f(long long int i)\n{\n if((i%5==0)&&(i%7==0)&&(i%9==0)&&(i%8==0))\n return 1;\n else return 0;\n}*/\nint main()\n{\n long long int n,s;\n //n=pow(10,18);\n // printf(\"%llu\",n);\n scanf(\"%lld\",&n);\n //printf(\"%lld\",n);\n //for(i=2520; i<=n; i=i+2520)\n s=n/2520;\n printf(\"%lld\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,ans;\n scanf(\"%I64d\", &n);\n ans=n/2520;\n printf(\"%I64d\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,i,count=0;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, s;\n scanf(\"%I64d\", &n);\n s=(n/2520);\n printf(\"%I64d\\n\", s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\n\nint main(void)\n{\n\tlong long int n, i, div = 2520;\n\t\n\tscanf(\"%lld\", &n);\n\tprintf(\"%lld\", n/div);\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdio.h>\n\nint main() {\n unsigned long long a;\n scanf(\"%lld\", &a);\n printf(\"%lld\", a/2520);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,x;\n scanf(\"%I64d\",&n);\n x=n/2520;\n printf(\"%I64d\\n\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\nlong long int i,j;\nscanf(\"%I64d\",&i);\n\nj=8*9*5*7;\ni=i/j;\nprintf(\"%I64d\",i);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n\tlong long int n,ans;\n\tscanf(\"%lld\",&n);\n\tans=n/2520;\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c ;\n int i,j,count=0,count2=0;\n scanf(\"%lld\",&n);\n c=n/2520;\n \n printf(\"%lld\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n;\n while(scanf(\"%llu\", &n)==1)\n {\n printf(\"%llu\\n\", n/2520);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n;\nint main()\n{\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n\n long long int answer=n/2520;\n printf(\"%lld\",answer);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n\n scanf(\"%I64d\", &n);\n\n printf(\"%I64d\", n/2520);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int i,j,k,l,m,n;\n\tscanf(\"%I64d\",&n);\n\tj=2520;\n\tprintf(\"%I64d\",n/j);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long n;\n scanf(\"%lld\",&n);\n long long simple=2*2*2*3*3*5*7;\n printf(\"%lld\",n/simple);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long long int n;\n scanf(\"%llu\",&n);\n printf(\"%llu\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\\n\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<inttypes.h>\nint main(){\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\tlong long count=0,i=1;\n\t/*for(i=2520;i<=n;i++) \n\t\tif(i%5==0 && i%7==0 && i%9==0 && i%8==0)\n\t\t\tcount++;*/\n\tcount=n/2520;\n\t\n\tprintf(\"%lld\\n\",count);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int i, n, count;\n scanf(\"%lli\", &n);\n count=n/2520;\n printf(\"%lli\", count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,s;\n scanf(\"%I64d\",&n);\n s=(n/2520);\n printf(\"%I64d\",s);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,c;\n scanf(\"%I64d\",&n);\n c=n/2520;\n printf(\"%I64d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned long long n;\n scanf(\"%lli\",&n);\n printf(\"%lli\",n/(5*9*8*7));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include <stdio.h>\nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n scanf(\"%lld\", &n);\n printf(\"%lld\\n\", n/2520);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,cnt=0;\n scanf(\"%I64d\",&n);\n cnt=n/2520;\n printf(\"%I64d\",cnt);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n;\n int x;\n scanf(\"%lld\",&n);\n x=5*7*8*9;\n printf(\"%lld\",n/x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n unsigned long long max;\n n = 10*9*4*7;\n scanf(\"%llu\",&max);\n max = max/n;\n printf(\"%llu\\n\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "/**Bismillahir Rahmanir Rahim.**/\n\n#include <stdio.h>\n\nint main()\n{\n long long int c=0,i,j,k,n,rc=-1;\n scanf(\"%I64d\",&n);\n c=n/2520;\n printf(\"%I64d\\n\",c);\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nlong long int n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d\",&n);\n k=n/2520;\n printf(\"%I64d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,i,count=0;\n\tscanf(\"%lld\",&n);\n\tcount=n/2520;\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n;\n int x;\n scanf(\"%lld\",&n);\n x=5*7*8*9;\n printf(\"%lld\",n/x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int res,n;\n scanf(\"%lld\",&n);\n res=n/(8*9*7*5);\n printf(\"%lld\",res);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t__int64 i;\n\tscanf(\"%I64d\",&i);\n\tprintf(\"%I64d\",i/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,i;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\\n\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n;\nint main()\n{\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(void)\n{\n\tdouble n;\n\tscanf(\"%lf\",&n);\n\tn=n/2520;\n\tn=floor(n);\n printf(\"%.0lf\",n);\n\t\n\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\",(n/2520));\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long n,s;\n scanf(\"%I64d\",&n);\n s=n/2520;\n printf(\"%I64d\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nlong long int n, k=0;\nscanf(\"%lld\",&n);\nk=n/2520;\nprintf(\"%lld\",k);\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include <stdio.h>\nlong long x;\nint main()\n{\n\tscanf(\"%lld\",&x);\n\tprintf(\"%lld\\n\",x/2520);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n;\n while(scanf(\"%llu\", &n)==1)\n {\n printf(\"%llu\\n\", n/2520);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\\n\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long n;\n scanf(\"%lld\",&n);\n long long simple=2*2*2*3*3*5*7;\n printf(\"%lld\",n/simple);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c ;\n int i,j,count=0,count2=0;\n scanf(\"%lld\",&n);\n c=n/2520;\n \n printf(\"%lld\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,i,count=0;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,i,b,cnt;\n scanf(\"%I64d\", &a);\n cnt=a/2520;\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned long long n;\n scanf(\"%lli\",&n);\n printf(\"%lli\",n/(5*9*8*7));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int res,n;\n scanf(\"%lld\",&n);\n res=n/(8*9*7*5);\n printf(\"%lld\",res);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int n;\nscanf(\"%I64d\",&n);\nprintf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\n\n/*int f(long long int i)\n{\n if((i%5==0)&&(i%7==0)&&(i%9==0)&&(i%8==0))\n return 1;\n else return 0;\n}*/\nint main()\n{\n long long int n,s;\n //n=pow(10,18);\n // printf(\"%llu\",n);\n scanf(\"%lld\",&n);\n //printf(\"%lld\",n);\n //for(i=2520; i<=n; i=i+2520)\n s=n/2520;\n printf(\"%lld\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%lld\\n\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",n/2520);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tlong long int b;\n\tscanf(\"%lld\",&b);\n\t\tprintf(\"%lld\",b/2520);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n\n long long int answer=n/2520;\n printf(\"%lld\",answer);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\nlong long int m,n;\nscanf(\"%I64d\",&m);\nn=(m)/2520;\nprintf(\"%I64d\\n\",n);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b) {\n return (b == 0 ? a : gcd(b, a % b));\n}\n\nint lcm(int a, int b) {\n return (a * b / gcd(a, b));\n}\n\nint main() {\n int g = 2;\n for (int i = 2; i <= 10; i++) g = lcm(g, i);\n long long n;\n scanf(\"%lld\", &n);\n printf(\"%lld\\n\", n / (1ll * g));\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%lld\",a/2520);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long i, n,m;\n scanf(\"%lld\", &n);\n m=n/2520;\n printf(\"%lld\", m);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n printf(\"%I64d\",n/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n scanf(\"%lld\", &n);\n printf(\"%lld\\n\", n/2520);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,c ;\n int i,j,count=0,count2=0;\n scanf(\"%lld\",&n);\n c=n/2520;\n \n printf(\"%lld\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int b,i,ans=0;\n\tscanf(\"%lld\", &b);\n//\tfor(i=2520;i<=b;i+=2520) ans++;\n\tans=b/2520;\n\tprintf(\"%lld\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,r;\n scanf(\"%lld\",&n);\n r=n/2520;\n printf(\"%lld\",r);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;\n\n\tscanf(\"%lld\", &n);\n\tprintf(\"%lld\\n\", n / 2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a;\n scanf(\"%lli\", &a);\n \n printf(\"%lli\\n\", a/2520);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n\n printf(\"%lld\\n\",n/2520);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n unsigned long long int n,i;\n scanf(\"%lld\",&n );\n i=n/2520;\n printf(\"%lld\",i);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,i,b,cnt;\n scanf(\"%I64d\", &a);\n cnt=a/2520;\n printf(\"%I64d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int x,n;\n scanf(\"%I64d\",& n);\n x=n/2520;\n printf(\"%I64d\", x);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;\n\n\tscanf(\"%lld\", &n);\n\tprintf(\"%lld\\n\", n / 2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,x;\n scanf(\"%lld\",&n);\n\n x=n/2520;\n printf(\"%lld\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main (){\n long long int i;\n scanf(\"%lld\",&i);\n printf(\"%lld\",i/2520);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n,r;\n scanf(\"%I64d\",&n);\n r=n/2520;\n printf(\"%I64d\",r);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int n;\n while(scanf(\"%llu\",&n)!=EOF)\n {\n printf(\"%llu\\n\",n/2520);\n }\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long a;\n scanf(\"%llu\",&a);\n if(a<2520)\n {\n printf(\"0\\n\");\n }\n else\n {\n printf(\"%d\",(a/2520));\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long int n,f;\n\tscanf(\"%lld\",&n);\n\tf=n/2520;\n\tprintf(\"%d\",f);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n;\n long long int count=0;\n scanf(\"%d\",& n);\n for(i=2520;i<=n;i=i+2520)\n {\n if(i%2520==0)\n count++;\n }\n printf(\"%I64d\", count++);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m;\n scanf(\"%I64d\",&n);\n m=n/2520;\n printf(\"%d\",m);\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k, count1=0, count2=0;\n scanf(\"%d\",& n);\n for(i=1;i<=n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n count1++;\n }\n if(count1==8)\n count2++;\n }\n printf(\"%d\", count2);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j;\n scanf(\"%d\",&i);\n printf(\"%d\\n\",i/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n int x;\n scanf(\"%I64d\",&n);\n x=n/2520;\n printf(\"%d\\n\",x);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int c;\n unsigned long long int n;\n scanf(\"%lld\",&n );\n c=n/2520;\n printf(\"%d\",c );\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long x=0;\n scanf(\"%I64d\",&x);\n int z= x/2520;\n printf(\"%d\",z);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i,j,n,l,a,k;\n\tscanf(\"%lld\",&n);\n\tk=1;\n\tfor(i=2;i<=10;i++)\n\tk=k*i;\n\ta=n/k;\n\tprintf(\"%lld\\n\",a+1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n double i,n,j;\n while(scanf(\"%lf\",&n) != EOF )\n { double count=0;\n count=n/2520;\n printf(\"%0.0lf\\n\",count);\n\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tint b;\n\tscanf(\"%d\",&b);\n\t\tprintf(\"%d\",b/2520);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,res;\n scanf(\"%d\",&n);\n res=n/2520;\n printf(\"%d\",res);\n //printf(\"Hello world!\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n long long n,i=0,j=1;\n scanf(\"%lld\",&n);\n a=2520;\n while(a<=n)\n {\n i++;\n j++;\n a=a*j;\n }\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0,f;\n scanf(\"%d\",&n);\n for(i=1;i<n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n {\n f=1;\n }\n else\n {\n f=0;\n break;\n }\n }\n if(f==1)\n {\n c++;\n }\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdint.h>\n#define __STDC_FORMAT_MACROS\n#include <inttypes.h>\n\n\nint main()\n{\n // int i;\n // int n;\n // scanf(\"%d\",&n);\n\n uint64_t i;\n uint64_t n;\n scanf(\"%\" SCNu64 \"\",&n);\n\n int cont=0;\n for (i=20;i<=n;i=i+20){\n if (i%9==0){\n if (i%8==0){\n if(i%7==0){\n if(i%6==0){\n cont++;\n printf(\"% \" PRIu64 \" \\n\",i);\n }\n }\n }\n }\n }\n printf(\"%d\\n\",cont);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nlong long int n;\nlong int i,sum=0;\nscanf(\"%I64d\",&n);\n\nsum=n/2520;\nprintf(\"%ld\",sum);}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i<a;i++)\n {\n if(i%6==0 && i%10==0 && i%8==0 && i%9==0)\n {\n cnt++;\n }\n }\n printf(\"%d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,r,i;\nscanf(\"%I64d\",&n);\nint k=10*9*8*7;\nr=n%k;\nn=n-r;\nfor(i=1;n>0;i++){\n n=n-k;}\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n long long n,i=0,j=1;\n scanf(\"%lld\",&n);\n a=2520;\n while(a<=n)\n {\n i++;\n j++;\n a=a*j;\n }\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\nlong long int i,j,k;\nscanf(\"%I64d\",&i);\n\nj=8*9*5*7;\nk=i/j;\n\n\nprintf(\"%64Id\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n double i,n,j;\n while(scanf(\"%lf\",&n) != EOF )\n { double count=0;\n if(n>2519){\n count=(n/2520);\n printf(\"%0.0lf\\n\",count);}\n else\n printf(\"%d\\n\",0);\n\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n long long int n,i,count=0;\n scanf(\"%I64d\",&n);\n for(i=0;i<n;i++)\n {\n if(i%5==0&&i%8==0&&i%9==0)\n count++;\n }\n printf(\"%I64d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,count=0;\n scanf(\"%d\",&n);\n for(m=420;m<=n;m=m+10)\n {\n if(m%6==0&&m%7==0&&m%8==0&&m%9==0&&m%10==0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i<a;i++)\n {\n if(i%6==0 && i%10==0 && i%8==0 && i%9==0)\n {\n cnt++;\n }\n }\n printf(\"%d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{long n,t,h;\nint i;\n\n scanf(\"%ld\",&n);\n t=n/2520;\n h=0;\n for(i=1;i<t+1;i++)\n {h=h+i;}\n printf(\"%ld\",h);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nlong long int n;\nunsigned long int i,sum=0;\nscanf(\"%I64d\",&n);\n\nsum=n/2520;\nprintf(\"%lu\",sum);}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j;\n scanf(\"%d\",&i);\n printf(\"%d\\n\",i/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k, count1=0, count2=0;\n scanf(\"%d\",& n);\n for(i=1;i<=n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n count1++;\n }\n if(count1==9)\n count2++;\n }\n printf(\"%d\", count2);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0,i=1;\n\tfor(i=2520;i<n;i++) \n\t\tif(i%5==0 && i%7==0 && i%9==0 && i%8==0)\n\t\t\tcount++;\n\n\t\n\tprintf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nprintf(\"%d\",n/2520);\n}"}, {"source_code": "//1920\n#include<stdio.h>\nint main()\n{\n\tlong long int n;\n\tscanf(\"%lld\",&n);\n\tprintf(\"%d\",n/1920);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long int i,n,count=0;\n scanf(\"%I64d\",&n);\n for(i=1;i<=n;i++){\n if(i%2==0&&i%3==0&&i%4==0&&i%5==0&&i%6==0&&i%7==0&&i%8==0&&i%9==0&&i%10==0)\n count++;\n }\n printf(\"%I64d\",count);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long a[50];\nint main()\n{\n long long i,j,m,n,temp;\n a[0]=2520;\n for(i=1;;i++)\n {\n m=a[i-1]*2;\n if(m>1000000000000000000)\n break;\n a[i]=m;\n m=a[i-1]*3;\n if(m>1000000000000000000)\n break;\n a[i+1]=m;\n m=a[i-1]*5;\n if(m>1000000000000000000)\n break;\n a[i+2]=m;\n m=a[i-1]*7;\n if(m>1000000000000000000)\n break;\n a[i+3]=m;\n\n }\n for(i=0;i<49;i++)\n {\n for(j=i+1;j<50;j++)\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n scanf(\"%lld\",&n);\n for(i=0;i<50;i++)\n if(a[i]>n)\n break;\n printf(\"%lld\\n\",i);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a;\n int b;\n scanf(\"%lli\", &a);\n b=a/2520;\n \n printf(\"%d\\n\", b);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,i;\n scanf(\"%llu\",&n);\n i=n/2510;\n printf(\"%llu\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,c;\n scanf(\"%I64d\",&n);\n c=n/2520;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main(){\n\n\tlong int n, count = 0;\n\tscanf(\"%ld\",&n);\n\tfor (int i = 1; i*2520 <= n; ++i)\n\t{\n\t\tcount++;\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,cnt=0;\n scanf(\"%d\",&n);\n for(i=2520;i<=n;i+=2520)\n {\n cnt++;\n }\n printf(\"%d\",cnt);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,ans;\n scanf(\"%d\", &n);\n ans=n/2520;\n printf(\"%d\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n x=5*7*8*9;\n printf(\"%d\",n/x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n long long int i,n;\n int count,lcm=2520;\n scanf(\"%I64d\",&n);\n count=n/lcm;\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int a;\n int c;\n scanf(\"%I64d\",&a);\n c=a/2520;\n printf(\"%d\",c);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0,i=1;\n\tfor(i=2520;i<n;i++) \n\t\tif(i%5==0 && i%7==0 && i%9==0 && i%8==0)\n\t\t\tcount++;\n\n\t\n\tprintf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k, count1=0, count2=0;\n scanf(\"%d\",& n);\n for(i=1;i<=n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n count1++;\n }\n if(count1==8)\n count2++;\n }\n printf(\"%d\", count2);\n}\n"}, {"source_code": "#include \"stdio.h\"\n\nint main(){\n\n\tlong int n, count = 0;\n\tscanf(\"%ld\",&n);\n\tfor (int i = 1; i*2520 <= n; ++i)\n\t{\n\t\tcount++;\n\t}\n\tprintf(\"%ld\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, divisible = 0;\n scanf(\"%d\", &n);\n\n for(i=1; i<=n; i++){\n if(i % 2 == 0 && i % 3 == 0 && i % 4 == 0 && i % 5 == 0 &&\n i % 6 == 0 && i % 7 == 0 && i % 8 == 0 && i % 9 == 0 && i % 10 == 0){\n divisible = i;\n }\n }\n if(divisible == 0)\n printf(\"0\");\n else\n printf(\"%d\", n / divisible);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,count=0;\n scanf(\"%d\",&n);\n for(m=420;m<=n;m=m+420)\n {\n if(m%6==0&&m%7==0&&m%8==0&&m%9==0&&m%10==0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n//718281828459045235\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,ct = 0;\n scanf(\"%d\",&n);\n while ( n )\n {\n n -= 2520;\n if ( n > -1)\n ct++;\n else\n break;\n }\n printf(\"%d\\n\",ct);\n}\n/*2016-02-21 21:50:10.928*/"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nprintf(\"%d\",n/2520);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a;\n scanf(\"%lli\", &a);\n \n printf(\"%d\\n\", a/2520);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint n;\nscanf(\"%lld\",&n);\nprintf(\"%lld\",n/2520);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,cnt=0;\n scanf(\"%d\",&n);\n i=n/2520;\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i,j,n,l,a,k;\n\tscanf(\"%lld\",&n);\n\tk=1;\n\tfor(i=2;i<=10;i++)\n\tk=k*i;\n\ta=n/k;\n\tprintf(\"%lld\\n\",a+1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long int n;\n int i,j,count=0;\n scanf(\"%ld\",&n);\n for(i=70;i<=n;i+=70)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j!=0)\n break;\n }\n if(j==11)\n count++;\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\nlong long int a,b,c;\nscanf(\"%lld\",&a);\nprintf(\"%d\",a/2520);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n,i,count=0;\n\tscanf(\"%lld\",&n);\n\tfor(i=2519;i<=n;i++)\n\t{\n\t\tif(i%2==0 && i%4==0 && i%9==0 && i%5==0 && i%7==0)\n\t\t{\n\t\t\tcount++;\n\t\t\ti+=2520;\n\t\t\t//printf(\"cou=%lld i=%lld\\n\",count,i);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n long long n,i=0,j=1;\n scanf(\"%lld\",&n);\n a=2520;\n while(a<=n)\n {\n i++;\n j++;\n a=a*j;\n }\n printf(\"%lld\",i);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,j;\n scanf(\"%d\",&n);\n j= n/2520;\n printf(\"%d\\n\",j);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n int i,j,count=0;\n scanf(\"%d\",&n);\n for(i=2520;i<=n;i+=2520)\n {\n count++;\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\nint n,d;\nscanf(\"%d\",&n);\nd=n/2520;\n\nprintf(\"%d\\n\",d);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,i,count=0;\n while(scanf(\"%llu\", &n)==1)\n {\n for(i=10; i<=n; i=i+720)\n {\n if(i%7==0)\n {\n count++;\n }\n }\n printf(\"%llu\\n\", count);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a;\n scanf(\"%lli\", &a);\n \n printf(\"%d\\n\", a/2520);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n double a,b;\n scanf(\"%lf\", &a);\n b=a/2520;\n printf(\"%0.0lf\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,b,cnt;\n scanf(\"%d\", &a);\n cnt=a/2520;\n printf(\"%d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\nint n,d;\nscanf(\"%d\",&n);\nd=n/2520;\n\nprintf(\"%d\\n\",d);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{unsigned long long h,n,t;\nint i;\n\n scanf(\"%lld\",&n);\n t=n/2520;\n h=0;\n for(i=1;i<t+1;i++)\n {h=h+i;}\n printf(\"%lld\",h);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j;\n scanf(\"%d\",&i);\n printf(\"%d\\n\",i/2520);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,r,i;\nscanf(\"%I64d\",&n);\nint k=10*9*8*7;\nr=n%k;\nn=n-r;\nfor(i=1;n>1;i++){\n n=n/k;}\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i,j,n,l,a,k;\n\tscanf(\"%lld\",&n);\n\tk=1;\n\tfor(i=2;i<=10;i++)\n\tk=k*i;\n\ta=n/k;\n\tprintf(\"%lld\\n\",a+1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x;\n scanf(\"%d\",&n);\n x=5*7*8*9;\n printf(\"%d\",n/x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,c=0,f;\n scanf(\"%lld\",&n);\n for(i=1;i<n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n {\n f=1;\n }\n else\n {\n f=0;\n break;\n }\n }\n if(f==1)\n {\n c++;\n }\n }\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,r,i;\nscanf(\"%I64d\",&n);\nint k=10*9*8*7;\nr=n%k;\nn=n-r;\nfor(i=1;n>0;i++){\n n=n-k;}\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,b,cnt=0;\n scanf(\"%d\", &a);\n for(i=1;i<a;i++)\n {\n if(i%6==0 && i%7==0 && i%10==0 && i%8==0 && i%9==0)\n {\n cnt++;\n }\n }\n printf(\"%d\", cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nlong long int n;\nlong int i,sum=0;\nscanf(\"%I64d\",&n);\n\nsum=n/2520;\nprintf(\"%ld\",sum);}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,c=0,f;\n scanf(\"%lld\",&n);\n for(i=1;i<n;i++)\n {\n for(j=2;j<=10;j++)\n {\n if(i%j==0)\n {\n f=1;\n }\n else\n {\n f=0;\n break;\n }\n }\n if(f==1)\n {\n c++;\n }\n }\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x;\n scanf(\"%d\",& n);\n x=n/2520;\n printf(\"%d\", x);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,r,i;\nscanf(\"%I64d\",&n);\nint k=10*9*8*7;\nr=n%k;\nn=n-r;\nfor(i=1;n>1;i++){\n n=n/k;}\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,s;\n scanf(\"%d\",&n);\n s=n/2520;\n printf(\"%d\",s);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\nlong long int i,j,k;\nscanf(\"%I64d\",&i);\n\nj=8*9*5*7;\nk=i/j;\n\n\nprintf(\"%64Id\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n scanf(\"%ld\",&n);\n printf(\"%ld\",n/2520);\n return 0;\n}"}, {"source_code": "/* Hare Krishna */\n\n#include<stdio.h>\n\nint main()\n{\n long long int i,j,k,n,counter = 0,x = 0;\n\n scanf(\"%lld\",&n);\n\n for(i = 1; i <= n; i++)\n {\n for(j = 2; j <= 10; j++)\n {\n //counter = 0;\n if(i % j == 0)\n {\n counter++;\n }\n }\n\n if(counter == 9)\n {\n x++;\n }\n\n }\n\n printf(\"%lld\\n\",x);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a;\n scanf(\"%lli\", &a);\n \n printf(\"%d\\n\", a/2520);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long int n;\n scanf(\"%ld\",&n);\n n = n/2520;\n printf(\"%ld\",n);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,count=0;\n scanf(\"%d\",&n);\n for(m=420;m<=n;m=m+10)\n {\n if(m%6==0&&m%7==0&&m%8==0&&m%9==0&&m%10==0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{ unsigned long long n,r;\nint i;\nscanf(\"%lld\",&n);\nprintf(\"1\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/2520);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0,i=1;\n\t/*for(i=2520;i<=n;i++) \n\t\tif(i%5==0 && i%7==0 && i%9==0 && i%8==0)\n\t\t\tcount++;*/\n\tcount=n/2520;\n\t\n\tprintf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long int n,f;\n\tscanf(\"%lld\",&n);\n\tf=n/2520;\n\tprintf(\"%d\",f);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,count=0;\n scanf(\"%d\",&n);\n for(m=420;m<=n;m=m+420)\n {\n if(m%6==0&&m%7==0&&m%8==0&&m%9==0&&m%10==0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n//718281828459045235\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int c;\n unsigned long long int n;\n scanf(\"%lld\",&n );\n c=n/2520;\n printf(\"%d\",c );\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,r,i;\nscanf(\"%I64d\",&n);\nint k=10*9*8*7;\nr=n%k;\nn=n-r;\nfor(i=1;n>0;i++){\n n=n-k;}\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\nlong long int i,j,k;\nscanf(\"%I64d\",&i);\n\nj=8*9*5*7;\nk=i/j;\n\n\nprintf(\"%d\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n int s;\n scanf(\"%d\",&n);\n s=n/2520;\n printf(\"%d\",s);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,i,j,k=0;\n scanf(\"%I64d\",&n);\n\n printf(\"%I64d\\n\",n/2510);\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n,c;\nvoid dot(long long int i, int l);\nint main (){\n scanf(\"%I64d\",&n);\n dot(2520,1);\n printf(\"%I64d\",c);\n return 0;\n}\nvoid dot(long long int i,int l){\n i*=l;\n if(i<=n){\n c++;\n if(l<=2){\n dot(i,2);\n }\n if(l<=3){\n dot(i,3);\n }\n if(l<=5){\n dot(i,5);\n }\n dot(i,7);\n }\n}"}], "src_uid": "8551308e5ff435e0fc507b89a912408a"} {"nl": {"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_spec": "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_spec": "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.", "sample_inputs": ["HoUse", "ViP", "maTRIx"], "sample_outputs": ["house", "VIP", "matrix"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n\nvoid toup(char x[],int n){int i;for(i=0;i<n;i++) x[i]=toupper(x[i]);}\n\nvoid tolow(char x[],int n){int i;for(i=0;i<n;i++) x[i]=tolower(x[i]);}\n\nint main()\n{\n char x[101];\n\n gets(x); int a=0,b=0,i,n=strlen(x);\n\n for(i=0;i<n;i++) {if(x[i]<97) b++; else a++;}\n\n if(b>a) toup(x,n);\n\n else tolow(x,n);\n\n puts(x);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int i,j=0,k=0;\n gets(a);\n for(i=0;i<=strlen(a);i++)\n {\n if(a[i]>=65&&a[i]<=91)\n j++;\n else if(a[i]>=97&&a[i]<=122)\n k++;\n }\n if(j>k)\n {\n for(i=0;i<=strlen(a);i++)\n {\n if(a[i]>=97&&a[i]<=122)\n a[i]=a[i]-32;\n }\n }\n else if(j<k||j==k)\n {\n for(i=0;i<=strlen(a);i++)\n {\n if(a[i]>=65&&a[i]<=91)\n a[i]=a[i]+32;\n }\n }\n puts(a);\n}\n"}, {"source_code": "int main() {\n \n char input[101];\n\n scanf(\"%s\", input);\n\n int small = 0, big = 0;\n\n char *tempPointer = input;\n\n while (*tempPointer != '\\0') {\n if (*tempPointer >= 'a' && *tempPointer <= 'z')\n small++;\n else\n big++;\n tempPointer++;\n }\n\n int diff = small >= big ? 32 : -32;\n\n tempPointer = input;\n while (*tempPointer != '\\0') {\n\n if (diff == 32 && *tempPointer >= 'A' && *tempPointer <= 'Z')\n *tempPointer = (char ) ( (int) *tempPointer + diff );\n else if (diff == -32 && *tempPointer >= 'a' && *tempPointer <= 'z') {\n *tempPointer = (char ) ( (int) *tempPointer + diff );\n }\n tempPointer++;\n }\n\n printf(\"%s\\n\", input);\n\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\n\n int main(int argc, const char * argv[]) {\n \n char string[100];\n int upper=0,lower=0;\n scanf(\"%s\",string);\n int len = strlen(string);\n for (int i =0;i<len;i++){\n if (string[i]>='a'&&string[i]<='z') lower++;\n else upper++;\n }\n \n if (upper>lower){\n \n for (int i =0;i<len;i++){\n printf(\"%c\",toupper(string[i]));\n \n }\n \n \n \n \n \n }\n else {\n \n \n for (int i =0;i<len;i++){\n printf(\"%c\",tolower(string[i]));\n\n \n }\n\n \n }\n \n \n \n printf(\"\\n\");\n\n \n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,x=0,y=0;\n char a[100],b[100],c[100];\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=65 && a[i]<=90)\n {\n x=x+1;\n a[i]=a[i]+32;\n }\n else\n y=y+1;\n }\n\n\n if(x<=y)\n {\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=65 && a[i]<=90)\n {\n a[i]=a[i]+32;\n }\n }\n printf(\"%s\",a);\n return 0;\n\n }\n if(x>y)\n {\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=97 && a[i]<=122)\n {\n a[i]=a[i]-32;\n }\n }\n printf(\"%s\",a);\n return 0;\n }\n}\n"}, {"source_code": "main(){\n\tchar s[105];\n\tint l,i,b=0,k=0;\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t\tif(s[i]<'a')\n\t\t\tb++;\n\t\telse\n\t\t\tk++;\t\t\n\tprintf(\"%s\",(b>k)?strupr(s) : strlwr(s));\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n int c=0,c1=0,i;\n scanf(\"%s\",str);\n for(i=0;i<strlen(str);i++)\n {\n if(str[i]>=65&&str[i]<=90)\n c++;\n else\n c1++;\n }\n if(c>c1)\n {\n for(i=0;i<=strlen(str);i++){\n if(str[i]>=97&&str[i]<=122)\n str[i]=str[i]-32;\n }\n printf(\"%s\",str);\n }\n else\n {\n for(i=0;i<=strlen(str);i++){\n if(str[i]>=65&&str[i]<=90)\n str[i]=str[i]+32;\n }\n printf(\"%s\",str);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[1000];\n int i,j=0,k=0;\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]<97)\n j++;\n else\n k++;\n }\n for(i=0;a[i]!='\\0';i++){\n if(j>k){\n if(a[i]>=97)\n a[i]=a[i]-32;\n }\n //a[i]=a[i]-32;\n else if(j<=k)\n {if(a[i]<97)\n a[i]=a[i]+32;}\n printf(\"%c\",a[i]);\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint countup(char *str)\n{ int count=0;\n for(int i=0;i<strlen(str);i++)\n {\n if(str[i]>=97)\n count++;\n }\n return count;\n}\nint main()\n{ char str[1000];\n gets(str);\n int low=0;\n low=countup(str);\n int up=0;\n up=strlen(str)-low;\n \n if(up>low)\n {\n strupr(str);\n\n }\n else\n {\n strlwr(str);\n }\n\n puts(str);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nvoid print_upper(char str[]);\nvoid print_lower(char str[]);\n\nint main(void)\n{\n char str[100];\n\n int upper = 0;\n int lower = 0;\n int i = 0;\n\n scanf(\"%s\", str);\n\n while (str[i] != '\\0') \n {\n if (str[i] >= 'A' && str[i] <= 'Z')\n upper++;\n if (str[i] >= 'a' && str[i] <= 'z')\n lower++;\n i++;\n }\n\n if(upper > lower)\n print_upper(str);\n else\n print_lower(str);\n\n return 0;\n}\n\nvoid print_upper(char str[])\n{\n int i = 0;\n \n while(str[i]) {\n putchar (toupper(str[i]));\n i++;\n }\n\n}\n\nvoid print_lower(char str[])\n{\n int i = 0;\n \n while(str[i]) {\n putchar (tolower(str[i]));\n i++;\n }\n}\n\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n\n/*pbkeybord*/\nint main ()\n{\nchar word[100];\nint i;\nint countlower=0,countupper=0;\nscanf(\"%s\",word);\n\nfor(i=0;i<strlen(word);i++)\n{\n if(islower(word[i])){\n countlower++;\n }\n else {\n countupper++;\n }\n}\nif(countlower>=countupper)\n{\n for(i=0;i<strlen(word);i++)\n {\n word[i]=tolower(word[i]);\n }\n }else \n {\n\t for(i=0;i<strlen(word);i++)\n {\n word[i]=toupper(word[i]);\n } \n}\n\nprintf(\"%s\",word);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char string[100];\n int ucount=0,lcount=0;\n \n scanf(\"%s\",string);\n for(int i=0;i<strlen(string);i++)\n {\n int n=string[i];\n if((n>=65)&&(n<=90))\n ucount++;\n else\n lcount++;\n }\n \n if(ucount>lcount)\n { \n for(int i=0;i<strlen(string);i++)\n {\n int l=string[i];\n if((l>=97)&&(l<=122))\n string[i]=string[i]-32;\n }\n }\n else\n {\n for(int i=0;i<strlen(string);i++)\n {\n int p=string[i];\n if((p>=65)&&(p<=90))\n string[i]=string[i]+32;\n }\n }\n \n printf(\"%s\",string);\n return 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100],c=0,d=0,i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n c++;\n else\n d++;\n }\n if(c==d)\n {\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n if(c>d)\n {\n for(i=0;s[i]!='\\0';i++)\n if(s[i]>='a'&&s[i]<='z')\n s[i]=s[i]-32;\n }\n else\n {\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n puts(s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint i,c=0,s=0,len;\n\n\tchar ch[101];\n\tscanf(\"%s\",ch);\n\tlen=strlen(ch);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(ch[i]>='A' && ch[i]<='Z')\n\t\tc++;\n\t\telse if(ch[i]>='a' && ch[i]<='z')\n\t\ts++;\n\t}\n\tif(s>=c)\n\t{\n\t\tfor(i=0;i<len;i++)\n\t\t{\n\t\t\tif(ch[i]>='A' && ch[i]<='Z')\n\t\t\tch[i]='a'+(ch[i]-'A');\n\t\t}\n\t\tprintf(\"%s\",ch);\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<len;i++){\n\t\t\tif(ch[i]>='a' && ch[i]<='z')\n\t\tch[i]='A'+(ch[i]-'a');}\n\t\tprintf(\"%s\",ch);\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1000];\n int l,i,j,upper=0,lower=0;\n scanf(\"%s\",s);\n l=strlen(s);\n //printf(\"%d\\n\",l);\n for(i=0;i<l;i++){\n if(s[i]>='A' && s[i]<='Z'){\n upper++;\n }\n else {\n lower++;\n }\n }\n\n if(lower>=upper){\n for(i=0;i<l;i++){\n if(s[i]>='A' && s[i]<='Z'){\n s[i]='a' + (s[i] -'A');\n }\n }\n }\n else{\n for(i=0;i<l;i++){\n if(s[i]>='a' && s[i]<='z'){\n s[i]='A' + (s[i] -'a');\n }\n\n }\n }\n\n printf(\"%s\\n\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n\nchar toup(char x[],int n)\n{\n int i;\n for(i=0;i<n;i++) x[i]=toupper(x[i]);\n return x[n];\n}\n\nchar tolow(char x[],int n)\n{\n int i;\n for(i=0;i<n;i++) x[i]=tolower(x[i]);\n return x[n];\n}\n\nint main()\n{\n char x[101];\n\n gets(x); int a=0,b=0,i,n=strlen(x);\n\n for(i=0;i<n;i++)\n { if(x[i]<97) b++; else a++; }\n\n if(b>a) x[n]=toup(x,n);\n\n else x[n]=tolow(x,n);\n\n puts(x);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char string[100];\n int ucount=0,lcount=0;\n \n scanf(\"%s\",string);\n for(int i=0;i<strlen(string);i++)\n {\n int n=string[i];\n if((n>=65)&&(n<=90))\n ucount++;\n else\n lcount++;\n }\n \n if(ucount>lcount)\n { \n for(int i=0;i<strlen(string);i++)\n {\n int l=string[i];\n if((l>=97)&&(l<=122))\n string[i]=string[i]-32;\n }\n }\n else\n {\n for(int i=0;i<strlen(string);i++)\n {\n int p=string[i];\n if((p>=65)&&(p<=90))\n string[i]=string[i]+32;\n }\n }\n \n printf(\"%s\",string);\n return 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i, c=0, d=0;\n char s1[100];\n scanf(\"%s\", s1);\n int l = strlen(s1);\n for(i=0;i<l;i++)\n {\n if(s1[i]>='A' && s1[i]<='Z')\n {\n c++;\n }\n else if(s1[i]>='a' && s1[i]<='z')\n {\n d++;\n }\n } \n if(c>d)//upper>lower=upper\n {\n for(i=0;i<l;i++)\n {\n if(s1[i]>='a' && s1[i]<='z')\n {\n s1[i]=s1[i]-32;\n }\n }\n printf(\"%s\", s1);\n }\n else if(c<=d)//lower>upper=lower\n {\n for(i=0;i<l;i++)\n {\n if(s1[i]>='A' && s1[i]<='Z')\n {\n s1[i]=s1[i]+32;\n }\n }\n printf(\"%s\", s1);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nvoid word_to_case (int mode, char *str);\n\nint main(int argc, char *argv[]) {\n\tint lows = 0, uprs = 0;\n\tchar str[256];\n\tint i;\n\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; i < strlen(str); i++) {\n\t\tlows += islower(str[i]) ? 1 : 0;\n\t\tuprs += isupper(str[i]) ? 1 : 0;\n\t}\n\t\n\tword_to_case(((lows - uprs + 1) > 0) ? 1 : 0, str);\n\tprintf(\"%s\", str);\n\t\n\treturn 0;\n}\n\nvoid word_to_case (int mode, char *str) {\n\tint i;\n\tint len;\n\tlen = strlen(str);\n\tif (mode) {\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tstr[i] = tolower(str[i]);\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tstr[i] = toupper(str[i]);\n\t\t}\n\t}\n\treturn;\n}\n"}, {"source_code": "// https://codeforces.com/contest/59/problem/A\n\n#include <stdint.h>\n#include <stdio.h>\n\n\n#define IN_RANGE(v, s, e) ( (s) <= (v) && (v) <= (e) )\n\n#define IS_LOWER(c) IN_RANGE(c, 'a', 'z')\n#define IS_UPPER(c) IN_RANGE(c, 'A', 'Z')\n\n#define IS_ALPHA(c) ( IS_UPPER(c) || IS_LOWER(c) )\n#define IS_DIGIT(c) IN_RANGE(c, '0', '9')\n#define IS_ALNUM(c) ( IS_ALPHA(c) || IS_DIGIT(c) )\n\n#define TO_LOWER(c) ((c) += 32)\n// #define TO_LOWER(c) (IS_UPPER(c)) ? c += 32 : c ;\n#define TO_UPPER(c) ((c) -= 32)\n// #define TO_UPPER(c) (IS_LOWER(c)) ? c -= 32 : c ;\n\n#define MAX_LINE 100u\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToLowerCase(uint8_t * str, uint8_t str_len);\n\n\nint main(void)\n{\n uint8_t word[MAX_LINE] = {0};\n uint8_t str_len = 0u;\n uint8_t upper_case_count = 0u;\n \n scanf(\"%s\", word);\n \n while(word[str_len]) str_len++;\n \n upper_case_count = CountUpperCase(word, str_len);\n \n if(upper_case_count > (str_len/2))\n {\n ToUpperCase(word, str_len);\n }\n else\n {\n ToLowerCase(word, str_len);\n } /* end if */\n \n\tprintf(\"%s\\n\", word);\n \n\treturn 0;\n}\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len)\n{\n uint8_t upper_count = 0u;\n \n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n upper_count++;\n } /* end if */\n \n } /* end for */\n \n return upper_count;\n}\n\nvoid ToUpperCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_LOWER(str[i]))\n {\n str[i] = TO_UPPER(str[i]);\n } /* end if */\n } /* end for */\n}\n\nvoid ToLowerCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n str[i] = TO_LOWER(str[i]);\n } /* end if */\n } /* end for */\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nint main ()\n{\n int i,j,n,up=0,lo=0,t3=0;\n char a[100000];\n gets(a);\n n=strlen(a);\n\n for (i=0;i<n;i++){\n if (a[i]<97) up++;\n else lo++;\n }\n if (up>lo) {\n for (i=0;i<n;i++){\n if (a[i]>96) a[i]=a[i]-32;\n }\n }\n else if (up<lo ||up==lo) {\n for (i=0;i<n;i++){\n if (a[i]<96) a[i]=a[i]+32;\n }\n }\n printf(\"%s\\n\",a);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main(){\n\tchar s[100];\n\n\tscanf(\"%s\", s);\n\n\tint i;\n\tint lw = 0, up = 0;\n\tfor(i = 0; i < strlen(s); i++){\n\t\tif(s[i] >= 'a' && s[i] <= 'z'){\n\t\t\tlw++;\n\t\t} else {\n\t\t\tup++;\n\t\t}\n\t}\n\n\tif(up > lw){\n\t\tfor(i = 0; i < strlen(s); i++){\n\t\t\ts[i] = toupper(s[i]);\n\t\t}\n\t} else {\n\t\tfor(i = 0; i < strlen(s); i++){\n\t\t\ts[i] = tolower(s[i]);\n\t\t}\n\t}\n\n\tprintf(\"%s\", s);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char ch[300],capital[300],small[300];\n int i,len,countlow=0,countup=0;\n\n gets(ch);\n\n len = strlen(ch);\n\n for(i = 0;ch[i] != '\\0';i++){\n\n if(ch[i]>=97 && ch[i]<=122){\n capital[i]='A' + ch[i] - 'a';\n countup++;\n }\n\n else{\n capital[i]=ch[i];\n }\n //printf(\"%d\\n\", countup);\n if(ch[i]>=65 && ch[i]<=90){\n small[i]='a' + ch[i] - 'A';\n countlow++;\n\n }\n else{\n small[i]=ch[i];\n }\n //printf(\"%d\\n\",countlow);\n }\n capital[i]='\\0';\n small[i]='\\0';\n //printf(\"%s\\n\", small);\n //printf(\"%d %d\\n\", countlow,countup);\n\n if(countlow==len || countup<countlow){\n printf(\"%s\\n\", capital);\n }\n else{\n printf(\"%s\\n\", small);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\n\n int main(int argc, const char * argv[]) {\n \n char string[100];\n int upper=0,lower=0;\n scanf(\"%s\",string);\n int len = strlen(string);\n for (int i =0;i<len;i++){\n if (string[i]>='a'&&string[i]<='z') lower++;\n else upper++;\n }\n \n if (upper>lower){\n \n for (int i =0;i<len;i++){\n printf(\"%c\",toupper(string[i]));\n \n }\n \n \n \n \n \n }\n else {\n \n \n for (int i =0;i<len;i++){\n printf(\"%c\",tolower(string[i]));\n\n \n }\n\n \n }\n \n \n \n printf(\"\\n\");\n\n \n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar s[100];\nint n,c=0,r=0,j=0;\ngets(s);\nn=strlen(s);\nfor(int i=0;i<n;i++)\n{\nif(s[i]>='a'&&s[i]<='z')\n{\nc++;\n}\nelse\n{\nr++;\n}\n}\nj=(n+1)/2;\nif(c<j)\n{\nputs(strupr(s));\n}\nelse\n{\nputs(strlwr(s));\n}\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\nchar a[100];\nint i;\nfloat mid,sum=0;\nscanf(\"%s\",a);\nfor(i=0;i<strlen(a);i++)\n{\n if(a[i]>='a'&&a[i]<='z')\n sum++;\n}\nmid=(float)strlen(a)/2;\n if(sum>=mid)\n {\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]>='A'&&a[i]<='Z')\n {\n a[i]=a[i]+32;\n }\n }\n\n }\n else\n {\n for(i=0;i<strlen(a);i++)\n {\n if(a[i]>='a'&&a[i]<='z')\n {\n a[i]=a[i]-32;\n }\n }\n }\n printf(\"%s\",a);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[101];\n int x=0,y=0,l,i,j; \n scanf(\"%s\",s);\n l=strlen(s);\n s[l];\n for(i=0;i<l;i++)\n {if(s[i] >= 'A' && s[i] <= 'Z')\n x++;\n if(s[i] >= 'a' && s[i] <= 'z')\n y++; \n }\n \n if(x>y)\n puts(strupr(s));\n else\n puts(strlwr(s));\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n char ch;\n char str[10000];\n int lower=0,count = 0,upper,index=0;\n while((ch = getchar())!='\\n'){\n if(ch>=97)\n lower++;\n str[count++] = ch;\n }\n upper = count-lower;\n if(upper>lower){\n for(int itr=0;str[itr];itr++){\n if(str[itr]>=97){\n str[itr] = str[itr]-32;\n }\n }\n }else{\n for(int itr=0;str[itr];itr++){\n if(str[itr]<97){\n str[itr] = str[itr]+32;\n }\n }\n }\n printf(\"%s\",str);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main(){\n char mot[100];\n scanf(\"%s\",mot);\n int low =0;\n int up =0;\n for (int i=0;i<strlen(mot);i++){\n if (isupper(mot[i])){\n up=up+1;\n }\n else{\n low=low+1;\n }\n }\n if (low>=up){\n for (int i =0;i<strlen(mot);i++){\n mot[i]=tolower (mot[i]);\n }\n }\n else{\n for (int i =0;i<strlen(mot);i++){\n mot[i]=toupper (mot[i]);\n }\n \n }\n printf(\"%s\",mot);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar s[101];\nscanf(\"%s\",s);\nint len=strlen(s),freq_l=0,freq_u=0;\nfor(int i=0;i<len;i++)\n{\nif(s[i]>=65&&s[i]<=90)\nfreq_u++;\nelse\nfreq_l++;\n}\nif(freq_u>freq_l)\n\t{\n\tfor(int i=0;i<len;i++)\n\t{\n\tif(s[i]>=97&&s[i]<=122)\n\ts[i]-=32;\n\t}\n\t}\nif(freq_u<=freq_l)\n\t{\n\tfor(int i=0;i<len;i++)\n\t{\n\tif(s[i]>=65&&s[i]<=90)\n\ts[i]+=32;\n\t}\n\t}\nprintf(\"%s\",s);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,cnt=0;\n char s[101];\n\n scanf(\"%s\",s);\n while(s[i]!='\\0'){\n if(s[i]<='Z')\n cnt--;\n else\n cnt++;\n i++;\n }\n i=0;\n if(cnt<0){\n while(s[i]!='\\0'){\n if(s[i]>'Z')\n s[i]=s[i]-32;\n i++;\n }\n }\n else{\n while(s[i]!='\\0'){\n if(s[i]<='[')\n s[i]=s[i]+32;\n i++;\n }\n }\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint countChar(char word[]){\n\tint lower=0, upper=0;\n\tfor (int i = 0; word[i] != '\\0' ; ++i){\n\t\tif (word[i] > 64 && word[i] < 91){\n\t\t\tupper ++;\n\t\t}else lower ++;\n\t}\n\tif (upper > lower)\n\t\treturn 1;\n\telse \n\t\treturn 2;\n}\n\nvoid printWord(int option, char word[]){\n\tswitch(option){\n\t\tcase 1: \n\t\tfor (int i = 0; word[i] != '\\0'; ++i){\n\t\t\tif (word[i] > 96 && word[i] < 123){\n\t\t\t\tword[i] -= 32;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%s\\n\", word);\n\t\tbreak;\n\n\t\tcase 2:\n\t\tfor (int i = 0; word[i] != '\\0'; ++i){\n\t\t\tif (word[i] > 64 && word[i] < 91){\n\t\t\t\tword[i] += 32;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%s\\n\", word);\n\t\tbreak;\n\t}\n}\n\nint main(){\n\tchar word[100];\n\tint option = 0;\n\tscanf(\"%s\", word);\n\toption = countChar(word);\n\tprintWord(option, word);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[101]={'\\0'};\n scanf(\"%s\",str);\n int a=strlen(str);\n int c1=0,c2=0;\n for(int i=0;i<a;i++)\n {\n if(str[i]>='a'&& str[i]<='z')\n c1+=1;\n else if(str[i]>='A' && str[i]<='Z')\n c2+=1;\n }\n if(c1==c2)\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='A' && str[i]<='Z')\n str[i]+=32;\n }\n }\n else if(c2>c1)\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='a' && str[i]<='z')\n str[i]-=32;\n }\n }\n else\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='A' && str[i]<='Z')\n str[i]+=32;\n }\n }\n printf(\"%s\",str);\n}\n "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char ch[300],capital[300],small[300];\n int i,len,countlow=0,countup=0;\n\n gets(ch);\n\n len = strlen(ch);\n\n for(i = 0;ch[i] != '\\0';i++){\n\n if(ch[i]>=97 && ch[i]<=122){\n capital[i]='A' + ch[i] - 'a';\n countup++;\n }\n\n else{\n capital[i]=ch[i];\n }\n //printf(\"%d\\n\", countup);\n if(ch[i]>=65 && ch[i]<=90){\n small[i]='a' + ch[i] - 'A';\n countlow++;\n\n }\n else{\n small[i]=ch[i];\n }\n //printf(\"%d\\n\",countlow);\n }\n capital[i]='\\0';\n small[i]='\\0';\n //printf(\"%s\\n\", small);\n //printf(\"%d %d\\n\", countlow,countup);\n\n if(countlow==len || countup<countlow){\n printf(\"%s\\n\", capital);\n }\n else{\n printf(\"%s\\n\", small);\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n char arr[100];\n int i=0,upper=0,lower=0,n=0;\n for(i=0;i<100;i++){\n n+=1;\n scanf(\"%c\",&arr[i]);\n if(arr[i]==10)\n break;\n else if(arr[i]>64&&arr[i]<91)\n upper+=1;\n else if(arr[i]>96&&arr[i]<123)\n lower+=1;\n }\n if(lower>=upper){\n for(i=0;i<n;i++){\n if(arr[i]>64&&arr[i]<91)\n arr[i]+=32;\n printf(\"%c\",arr[i]);\n }\n }\n else{\n for(i=0;i<n;i++){\n if(arr[i]>96&&arr[i]<123)\n arr[i]-=32;\n printf(\"%c\",arr[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n char ch;\n char str[10000];\n int lower=0,count = 0,upper,index=0;\n while((ch = getchar())!='\\n'){\n if(ch>=97)\n lower++;\n str[count++] = ch;\n }\n upper = count-lower;\n if(upper>lower){\n for(int itr=0;str[itr];itr++){\n if(str[itr]>=97){\n str[itr] = str[itr]-32;\n }\n }\n }else{\n for(int itr=0;str[itr];itr++){\n if(str[itr]<97){\n str[itr] = str[itr]+32;\n }\n }\n }\n printf(\"%s\",str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100],a,c=0,d=0,i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n c++;\n else\n d++;\n }\n if(c==d)\n {\n for(i=0;s[i]!='\\0';i++)\n {\n a=s[i];\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n if(c>d)\n {\n for(i=0;s[i]!='\\0';i++)\n if(s[i]>='a'&&s[i]<='z')\n s[i]=s[i]-32;\n }\n else\n {\n for(i=0;s[i]!='\\0';i++)\n {\n a=s[i];\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n puts(s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j=0,k=0,l=0;\n char s[100];\n scanf(\"%s\",&s);\n while(s[i]!='\\0')\n {\n l++;\n i++;\n }\n for(i=0;i<l;i++)\n {\n if(s[i]>=97&&s[i]<=122)\n j++;\n else\n k++;\n }\n if(j>=k)\n {\n for(i=0;i<l;i++)\n {\n if(s[i]<=95)\n s[i]+=32;\n }\n }\n else\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=97)\n {\n s[i]-=32;\n }\n }\n }\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "char s[147];\nint i,c;\nmain(){\n *s||scanf(\"%s\",s);\ns[i]?c+=s[i++]/32*2-5,main():0; \nc<0==(s[--i]>>5&1)?s[i]^=32:0;\ni||printf(\"%s\",s);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,u=0,l=0;\n\tchar st[100];\n\tscanf(\"%s\",st);\n\tfor(i=0;st[i]!='\\0';i++)\n\t{\n\t\tif(st[i]>=65&&st[i]<=90)\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif(st[i]>=97&&st[i]<=122)\n\t\t{\n\t\t\tl++;\n\t\t}\n\t}\n\tif(l>=u)\n\t{\n\t\tstrlwr(st);\n }\n if(l<u)\n {\n \tstrupr(st);\n\t}\n\t\n\t\n\tprintf(\"%s\",st);\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char word[100] ;\n int i , len , up = 0 , low = 0 ;\n gets(word) ;\n len = strlen(word) ;\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'a' && word[i] <= 'z'){\n low++ ;\n }\n else if(word[i] >= 'A' && word[i] <= 'Z'){\n up++ ;\n }\n }\n if(up > low){\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'a' && word[i] <= 'z'){\n word[i] = (word[i] - 'a') + 'A' ;\n }\n }\n }\n else{\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'A' && word[i] <= 'Z'){\n word[i] = (word[i] - 'A') + 'a' ;\n }\n }\n }\n printf(\"%s\", word);\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int t,upper=0,lower=0,len,i;\n len = strlen(str);\n for(i=0;i<len;i++)\n {\n t = str[i];\n if((t>=65)&&(t<=90))\n upper++;\n else if((t>=97)&&(t<=122))\n lower++;\n }\n if(lower>=upper)\n {\n for(i=0;i<len;i++)\n {\n t = str[i];\n if((t>=65)&&(t<=90))\n {\n t += 32;\n str[i] = t;\n }\n }\n }\n else\n {\n for(i=0;i<len;i++)\n {\n t = str[i];\n if((t>=97)&&(t<=122))\n {\n t -= 32;\n str[i] = t;\n }\n }\n }\n printf(\"%s\",str);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char word[100] ;\n int i , len , up = 0 , low = 0 ;\n gets(word) ;\n len = strlen(word) ;\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'a' && word[i] <= 'z'){\n low++ ;\n }\n else if(word[i] >= 'A' && word[i] <= 'Z'){\n up++ ;\n }\n }\n if(up > low){\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'a' && word[i] <= 'z'){\n word[i] = (word[i] - 'a') + 'A' ;\n }\n }\n }\n else{\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'A' && word[i] <= 'Z'){\n word[i] = (word[i] - 'A') + 'a' ;\n }\n }\n }\n printf(\"%s\", word);\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{ \n int p=0,q=0,i=0;\n char s[102];\n gets(s);\n //printf(\"%s\",s);\n while(s[i]!='\\0')\n {\n int z =s[i];\n if(z>=97&&z<=122)\n {\n p++;\n }\n if(z>=65&&z<=90)\n {\n q++;\n }\n \n i++; \n }\n// printf(\"\\n%d\",p);\n // printf(\"\\n%d\",q);\n i=0;\n \n if(p>=q)\n {\n while(s[i]!='\\0')\n {\n int t;\n t=s[i];\n if(t>=65&&t<=90)\n {\n s[i]=t+32;\n }\n i++;\n }\n }\n else\n {\n while(s[i]!='\\0')\n {\n int t;\n t=s[i];\n if(t>=97&&t<=122)\n {\n s[i]=t-32;\n }\n \n i++;\n }\n }\n \n \n printf(\"%s\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(void)\n{\n char str1[100];\n scanf(\"%s\", str1);\n int cap=0;\n int smol;\n for(int i=0; i<strlen(str1); i++){\n if(str1[i]<=90)\n cap++;\n }\n smol=strlen(str1)-cap;\n if(cap>smol){\n for(int i=0; i<strlen(str1); i++){\n if(str1[i]>90)\n str1[i] += -32; \n }\n }\n else{\n for(int i=0; i<strlen(str1); i++){\n if(str1[i]<=90)\n str1[i] += 32; \n }\n }\n printf(\"%s\", str1);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,cnta=0,cntA=0,cnt=-1;\n char arr[100];\n for(i=0;i<100;i++)\n {\n scanf(\"%c\",&arr[i]);\n if(arr[i]=='\\n')\n {\n break;\n }\n cnt++;\n if(arr[i]>=97&&arr[i]<=123)\n {\n cnta++;\n }\n if(arr[i]>=65&&arr[i]<=91)\n {\n cntA++;\n }\n }\n if(cnta>=cntA)\n {\n for(i=0;i<=cnt;i++)\n {\n if(arr[i]>=65&&arr[i]<=91)\n {\n arr[i]=arr[i]+32;\n }\n }\n }\n\n if(cnta<cntA)\n {\n for(i=0;i<=cnt;i++)\n {\n if(arr[i]>=97&&arr[i]<=123)\n {\n arr[i]=arr[i]-32;\n }\n }\n }\n for(i=0;i<=cnt;i++)\n {\n printf(\"%c\",arr[i]);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n\tchar word[102];\n\tint i, small=0, capital=0;\n\tscanf(\"%s\", &word);\n\t//printf(\"%s\", word);\n\tfor(i=0; word[i] !='\\0'; i++)\n\t{\n\t\tif(word[i] <97 && word[i] >=65)\n\t\tcapital++;\n\t\t//printf(\"%d %d\", capital, small);\n\t\telse if(word[i] >=97 && word[i] <=122)\n\t\tsmall++;\n\n\t\t//printf(\"%d %d\", capital, small);\n\t}\n\t//printf(\"%d %d\", capital, small);\n\tif(small < capital )\n\t{\n\t\t printf(\"%s\",strupr(word));\n\n\t}\n\telse if( (small == capital) ||(small > capital))\n\t{\n\t printf(\"%s\",strlwr (word));\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i;\n\tint c,m;\n char s[101];\n scanf(\"%s\",s);\n int n=strlen(s);\n c=0,m=0;\n for(i=0;i<n;i++){\n if(s[i]>=97&&s[i]<=122){\n \tc++;\n }\n else if(s[i]>=65&&s[i]<=90){\n \tm++;\n }\n } \nfor(i=0;i<n;i++){\n if(c>=m){\n \tif(s[i]>=65&&s[i]<=90){\n\t \ts[i]='a'+(s[i]-'A');\n\t\t }\n\t\t }\n\t\t else {\n\t if(s[i]>=97&&s[i]<=122){\n\t \ts[i]='A'+(s[i]-'a');\n\t\t }\n\t\t }\n\t\t }\n\t printf(\"%s\",s);\n\t return 0;\n\t }"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int len=strlen(str);\n int small=0,cap=0;\n for(int i=0;i<len;++i)\n if(str[i]>='a' && str[i]<='z')\n ++small;\n else\n ++cap;\n if(cap>small)\n for(int i=0;i<len;++i)\n putchar(toupper(str[i]));\n else\n for(int i=0;i<len;++i)\n putchar(tolower(str[i]));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,c=0,c2=0;\n\n char s[100];\n scanf(\"%s\",&s);\n for(i=0; i<strlen(s); i++){\n\n if(s[i]>= 'a' && s[i]<='z'){\n c++;\n }\n else {\n c2++;\n }\n\n }\n if(c2>c){\n for(i=0; i<strlen(s); i++){\n if(s[i]>= 'a' && s[i]<='z'){\n s[i]=s[i]-32;\n }\n }\n }\n else{\n for(i=0; i<strlen(s); i++){\n if(s[i]>= 'A' && s[i]<='Z'){\n s[i]=s[i]+32;\n }\n }\n }\n\n\n\n printf(\"%s\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n\tchar word[100];\n\tgets(word);\n\t\n\tint upper=0, lower=0;\n\tint n;\n\tn = strlen(word);\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif (isupper(word[i]))\n\t\t{\n\t\t\tupper++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlower++;\n\t\t}\n\t}\n\n\tif (upper>lower)\n\t{\n\t\tfor (int i = 0; i < n; ++i)\n\t\t{\n\t\t\tprintf(\"%c\", toupper(word[i]));\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor (int i = 0; i < n; ++i)\n\t\t{\n\t\t\tprintf(\"%c\", tolower(word[i]));\n\t\t}\t\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main ()\n{\n char str[100];\n int value=0;\n int num;\n scanf(\"%s\",str);\n num=strlen(str);\n for(int i=0;i<num;i++)\n {\n if(str[i]>=97)\n {\n value++;\n }\n }\n if(value>=num-value)\n {\n printf(\"%s\",strlwr(str));\n }\n else\n {\n printf(\"%s\",strupr(str));\n }\n \n}"}, {"source_code": "#include <stdio.h>//C\n#include <string.h>\nint main()\n{\n int i,un=0,ln=0;\n char s[100];\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(isupper(s[i]))\n {un++;}\n else\n {ln++;}\n }\n for(i=0;i<strlen(s);i++)\n {\n if(un>ln)\n s[i]=toupper(s[i]);\n else if(ln>un)\n s[i]=tolower(s[i]);\n else\n s[i]=tolower(s[i]);\n }\n printf(\"%s\",s);\n return 0;\n}\n\n"}, {"source_code": "// https://codeforces.com/contest/59/problem/A\n\n#include <stdint.h>\n#include <stdio.h>\n\n\n#define IN_RANGE(v, s, e) ( (s) <= (v) && (v) <= (e) )\n\n#define IS_LOWER(c) IN_RANGE(c, 'a', 'z')\n#define IS_UPPER(c) IN_RANGE(c, 'A', 'Z')\n\n#define IS_ALPHA(c) ( IS_UPPER(c) || IS_LOWER(c) )\n#define IS_DIGIT(c) IN_RANGE(c, '0', '9')\n#define IS_ALNUM(c) ( IS_ALPHA(c) || IS_DIGIT(c) )\n\n#define TO_LOWER(c) (IS_UPPER(c)) ? c += 32 : c ;\n#define TO_UPPER(c) (IS_LOWER(c)) ? c -= 32 : c ;\n\n#define MAX_LINE 100u\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToLowerCase(uint8_t * str, uint8_t str_len);\n\n\nint main(void)\n{\n uint8_t word[MAX_LINE] = {0};\n uint8_t str_len = 0u;\n uint8_t upper_case_count = 0u;\n \n scanf(\"%s\", word);\n \n while(word[str_len]) str_len++;\n \n upper_case_count = CountUpperCase(word, str_len);\n \n if(upper_case_count > (str_len/2))\n {\n ToUpperCase(word, str_len);\n }\n else\n {\n ToLowerCase(word, str_len);\n } /* end if */\n \n\tprintf(\"%s\\n\", word);\n \n\treturn 0;\n}\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len)\n{\n uint8_t upper_count = 0u;\n \n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n upper_count++;\n } /* end if */\n \n } /* end for */\n \n return upper_count;\n}\n\nvoid ToUpperCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_LOWER(str[i]))\n {\n str[i] = TO_UPPER(str[i]);\n } /* end if */\n } /* end for */\n}\n\nvoid ToLowerCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n str[i] = TO_LOWER(str[i]);\n } /* end if */\n } /* end for */\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\tint n,i,l=0,u=0,m;\n\tchar s[100];\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tchar p[n];\n\tfor(i=0;i<=n-1;i++)\n {\n\tp[i]=s[i];\n if(p[i]>95)\n l++;\n else\n u++;\n }\n for(i=0;i<=n-1;i++)\n {\n if((u>l)&&(p[i]>95))\n p[i]=p[i]-32;\n else if((u==l)&&(p[i]<95))\n p[i]=p[i]+32;\n else if ((u<l)&&(p[i]<95))\n p[i]=p[i]+32;\n else ;\n s[i]=p[i];\n }\n for(i=0;i<n;i++)\n {\n printf(\"%c\", p[i]);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n\tchar word[102];\n\tint i, small=0, capital=0;\n\tscanf(\"%s\", &word);\n\t//printf(\"%s\", word);\n\tfor(i=0; word[i] !='\\0'; i++)\n\t{\n\t\tif(word[i] <97 && word[i] >=65)\n\t\tcapital++;\n\t\t//printf(\"%d %d\", capital, small);\n\t\telse if(word[i] >=97 && word[i] <=122)\n\t\tsmall++;\n\n\t\t//printf(\"%d %d\", capital, small);\n\t}\n\t//printf(\"%d %d\", capital, small);\n\tif(small < capital )\n\t{\n\t\t printf(\"%s\",strupr(word));\n\n\t}\n\telse if( (small == capital) ||(small > capital))\n\t{\n\t printf(\"%s\",strlwr (word));\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,k=0,n;\n char ch[101];\n scanf(\"%s\",ch);\n n=strlen(ch);\n for(i=0;i<n;i++)\n {\n if((ch[i]>='A'&&ch[i]<='Z'))\n {\n k++;\n }\n else\n {\n j++;\n }\n }\n\n if(k>j)\n {\n strupr(ch);\n printf(\"%s\",ch);\n }\n else\n {\n strlwr(ch);\n printf(\"%s\",ch);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int len=strlen(str),i,a=0,b=0;\n for(i=0;i<len;i++)\n {\n if(str[i]>=65 && str[i]<=90)\n {\n a++;\n }\n else if(str[i]>=97 && str[i]<=122)\n {\n b++;\n }\n }\n if(a>b)\n {\n for(i=0;i<len;i++)\n {\n if(str[i]>=97 && str[i]<=122)\n str[i]=65+str[i]-97;\n }\n }\n else \n {\n for(i=0;i<len;i++)\n {\n if(str[i]>=65 && str[i]<=90)\n str[i]=97+str[i]-65;\n }\n }\n printf(\"%s\\n\",str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n char a[1000],b[1000],c[1000],r=0,p=0;\n gets(a);\n int i,len;\n len=strlen(a);\n for(i=0;i<len;i++)\n {\n if(a[i]<97)\n {\n r++;\n b[i]=a[i];\n c[i]=a[i]+32;\n }\n else\n {\n p++;\n b[i]=a[i]-32;\n c[i]=a[i];\n }\n }\n c[i]='\\0';\n b[i]='\\0';\n if(r>p)\n {\n puts(b);\n\n }\n else\n {\n puts(c);\n\n }\n\n return 0;\n }\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char s[105];\n while(gets(s))\n {\n int i,j,count=0,cal=0,len,k;\n //gets(s);\n len=strlen(s);\n for(i=0; i<len; i++)\n {\n if(s[i]<='Z')\n count++;\n else\n cal++;\n }\n if(count<=cal)\n {\n for(j=0; j<len; j++)\n {\n if(s[j]<='Z')\n s[j]=s[j]+32;\n }\n }\n else\n {\n for(k=0; k<len; k++)\n {\n if(s[k]>'Z')\n s[k]=s[k]-32;\n }\n }\n printf(\"%s\\n\",s);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\nint main()\n{\n int i,maior,menor;\n maior=0;\n menor=0;\n char a[200];\n gets(a);\n for(i=0;a[i]!='\\0';i++){\n if(a[i]>=65 && a[i]<=90)\n maior++;\n else\n menor++;\n }\n if(maior>menor)\n for(i=0;a[i]!='\\0';i++)\n a[i]=toupper(a[i]);\n else if(maior<menor)\n for(i=0;a[i]!='\\0';i++)\n a[i]=tolower(a[i]);\n else\n for(i=0;a[i]!='\\0';i++)\n a[i]=tolower(a[i]);\n puts(a);\n return 0;\n}\n\n/* 1513300292268 */\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n\nint main()\n{\n char s[101];\n gets(s);\n int len=strlen(s);\n char x[len+1];\n int cap=0, sma=0;\n for(int i=0; i<len; i++)\n {\n if(s[i]>='A' && s[i]<='Z')\n cap++;\n\n if(s[i]>='a' && s[i]<='z')\n sma++;\n }\n if(cap>sma)\n {\n for(int i=0; i<len; i++)\n {\n x[i]=toupper(s[i]);\n }\n for(int i=0; i<len; i++){\n printf(\"%c\", x[i]);}\n }\n else\n {\n for(int i=0; i<len; i++)\n {\n x[i]=tolower(s[i]);\n }\n for(int i=0; i<len; i++){\n printf(\"%c\", x[i]);}\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n int i,j,c=0,d=0;\n char s[200];\n scanf(\"%s\",s);\n for(i=0;s[i];i++){\n if(s[i]>='A'&& s[i]<'Z'){\n c++;\n }\n else if(s[i]>='a' && s[i]<='z'){\n d++;\n }\n }\n // printf(\"%d %d\",c,e);exit(0);\n if(c>d || (c==49 && s[0]=='r')|| (c==49 && s[0]=='R')||(c==48 && s[0]=='C')){\n for(i=0;s[i];i++){\n if(s[i]>='a' && s[i]<='z'){\n s[i]=toupper(s[i]);\n }\n printf(\"%c\",s[i]);\n }\n exit(0);\n }\n if(c<=d){\n for(i=0;s[i];i++){\n if(s[i]>='A' && s[i]<='Z'){\n s[i]=tolower(s[i]);\n }\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main ()\n{\n char str[100];\n int value=0;\n int num;\n scanf(\"%s\",str);\n num=strlen(str);\n for(int i=0;i<num;i++)\n {\n if(str[i]>=97)\n {\n value++;\n }\n }\n if(value>=num-value)\n {\n printf(\"%s\",strlwr(str));\n }\n else\n {\n printf(\"%s\",strupr(str));\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l=0, u=0, i=0;\n\tchar a[100];\n\tscanf(\"%s\",a);\n\twhile(a[i]!='\\0')\n\t{\n\t\tif(65<=(int)a[i]&(int)a[i]<=90)\n\t\t\tu++;\n\t\telse\n\t\t\tl++;\n\t\ti++;\n\t}\n\ti=0;\n\t//printf(\"%d%d\",u,l);\n\tif(u>0&&l>0)\n\t{\n\t\tif(u>l)\n\t\t{\n\t\t\twhile(a[i]!='\\0')\n\t\t\t{\n\t\t\t\tif((int)a[i]>96)\n\t\t\t\t\ta[i]=(char)((int)a[i]-32);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twhile(a[i]!='\\0')\n\t\t\t{\n\t\t\t\tif((int)a[i]<91)\n\t\t\t\t\ta[i]=(char)((int)a[i]+32);\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\",a);\n}"}, {"source_code": "#include <stdio.h>\n\n#include <string.h>\n\n#include <ctype.h>\n\nint main()\n{\n int i,l,upper=0,lower=0;\n char ch[110];\n gets(ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]>=97 && ch[i]<=122)\n {\n lower++;\n }\n else if (ch[i]>=65 && ch[i]<=90)\n {\n upper++;\n }\n }\n\n if (lower > upper)\n {\n for (i=0;i<l;i++)\n {\n //ch[i]=ch[i]+32;\n ch[i]=tolower(ch[i]);\n //printf(\"%c\",ch[i]);\n }\n printf(\"%s\",ch);\n }\n\n else if (lower < upper)\n {\n for (i=0;i<l;i++)\n {\n //ch[i]=ch[i]-32;\n ch[i]=toupper(ch[i]);\n //printf(\"%c\",ch[i]);\n }\n printf(\"%s\",ch);\n }\n\n else if (lower == upper)\n {\n for (i=0;i<l;i++)\n {\n //ch[i]=ch[i]+32;\n ch[i]=tolower(ch[i]);\n //printf(\"%c\",ch[i]);\n }\n printf(\"%s\",ch);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<ctype.h>\n\nint main()\n{\n int i,b,sum=0,up=0,low=0;\n char s[100];\n scanf(\"%s\",&s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]<97)\n up++;\n else\n low++;\n }\n if(up>low)\n {\n for(i=0;s[i]!='\\0';i++)\n printf(\"%c\",toupper(s[i]));\n }\n else{\n for(i=0;s[i]!='\\0';i++)\n printf(\"%c\",tolower(s[i]));\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\n\nint main()\n{\n char ch[105];\n while(gets(ch)){\n int i,len = strlen(ch);\n int count = 0, bount = 0;\n for(i = 0; i < len; i++){\n if(ch[i] >= 65 && ch[i] <=90){\n count++;\n }\n else if(ch[i] >= 97 && ch[i] <= 122){\n bount++;\n }\n }\n if(count > bount){\n for(i = 0; i< len; i++){\n printf(\"%c\", toupper(ch[i]));\n }\n }\n else{\n for(i = 0; i< len; i++){\n printf(\"%c\", tolower(ch[i]));\n }\n }\n printf(\"\\n\");\n }\n }\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[101];\n\tint i,u=0,v=0;\n\tscanf(\"%s\",s);\n\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]>='a' && s[i]<='z'){\n\t\t\tu++;}\n\t\t\telse{\n\t\t\t\tv++;}\n\t}\n\t\n\tif(u>=v){\n\t\tfor(i=0;i<strlen(s);i++){\n\t\t if(s[i]>='A' && s[i]<='Z'){\n\t\t \ts[i]=(s[i]-'A')+'a';}\n\t}\n\t}\n\telse{\n\t\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]>='a' && s[i]<='z'){\n\t\ts[i]=(s[i]-'a')+'A';}\n\t}\n\t}\n\tprintf(\"%s\",s);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1000];\n int i,a=0,b=0;\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]>='A' && s[i]<='Z')\n a++;\n else\n b++;\n }\n if(a>b)\n printf(\"%s\",strupr(s));\n else\n printf(\"%s\",strlwr(s));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n\tchar str[100];\n\tscanf(\"%s\",str);\n\tint t,upper=0,lower=0,len,i;\n\tlen = strlen(str);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tt = str[i];\n\t\tif((t>=65)&&(t<=90))\n\t\t\tupper++;\n\t\telse if((t>=97)&&(t<=122))\n\t\t\tlower++;\n\t}\n\tif(lower>=upper)\n\t{\n\t\tfor(i=0;i<len;i++)\n\t\t{\n\t\t\tt = str[i];\n\t\t\tif((t>=65)&&(t<=90))\n\t\t\t{\n\t\t\t\tt += 32;\n\t\t\t\tstr[i] = t;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<len;i++)\n\t\t{\n\t\t\tt = str[i];\n\t\t\tif((t>=97)&&(t<=122))\n\t\t\t{\n\t\t\t\tt -= 32;\n\t\t\t\tstr[i] = t;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\\n\",str);\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n char s[101];\n gets(s);\n int capital=0,small=0,i,ans;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]>=65 && s[i]<=90)\n {\n capital++;\n }\n else if(s[i]>=97 && s[i]<=122)\n {\n small++;\n }\n }\n if(capital>small)\n {\n ans= strupr(s);\n }\n else\n {\n ans= strlwr(s);\n }\n printf(\"%s\\n\",ans);\n \n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int n,c=0,d=0;\n n=strlen(str);\n for(int i=0;i<n;i++){\n if(str[i]>='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i<n;i++){\n if(c>=d){\n if(str[i]<='Z'&&str[i]>='A'){\n str[i]=str[i]+32;\n }\n }else{\n if(str[i]<='z'&&str[i]>='a'){\n str[i]=str[i]-32;\n }\n }\n }\n printf(\"%s\",str);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main()\n{\n int lowercase , uppercase ;\n lowercase = uppercase = 0;\n char string[1000];\n int i = 0 ;\n\n do{\n scanf(\"%c\" , &string[i]);\n if ( string[i] >= 'a' && string[i] <= 'z')\n lowercase++;\n else\n uppercase++;\n }while( string[i++] != '\\n');\n i = 0;\n if(lowercase >= --uppercase)\n while (string[i] != '\\n')\n printf(\"%c\" , tolower(string[i++]) );\n else\n while (string[i] != '\\n')\n printf(\"%c\" , toupper(string[i++]) );\n return 0;\n}\n"}, {"source_code": "int main(int argc, char *argv[]) {\n\tchar s[200];\n\tint t,a,b;\n\tscanf(\"%s\",&s);\n int i;\n a=0;b=0;\n for(i=0;i<strlen(s);i++){\n \tif(s[i]<='z'&&'a'<=s[i]) a++;\n \telse b++;\n\t}\n \n if(a>=b){\n \tfor(i=0;i<strlen(s);i++){\n \t\ts[i]=tolower(s[i]);\n \t}\n }\n else{\n \tfor(i=0;i<strlen(s);i++){\n \t\ts[i]=toupper(s[i]);\n \t}\n\t}\n printf(\"%s\",s);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main()\n{\n char a[101];\n int counter_uppercase=0,counter_lowercase=0;\n int i;\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(islower(a[i])) counter_lowercase++;\n else if(isupper(a[i])) counter_uppercase++;\n }\n if(counter_uppercase<=counter_lowercase)\n {\n for(i=0;a[i]!='\\0';i++)\n a[i]=tolower(a[i]);\n }\n else\n {\n for(i=0;a[i]!='\\0';i++)\n a[i]=toupper(a[i]);\n }\n puts(a); \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\n char A[10000];\n int tam,i,min,may;\n may=0;\n gets(A);\n tam=strlen(A);\n for(i=0;i<tam;i++){\n if(A[i]<'a')\n may++; \n }\n min=tam-may;\n if(may>min){\n for(i=0;i<tam;i++){\n if(A[i]>'Z')\n A[i]=A[i]-' ';\n } \n }\n else{\n for(i=0;i<tam;i++){\n if(A[i]<'a')\n A[i]=A[i]+' '; \n } \n }\n for(i=0;i<tam;i++){\n printf(\"%c\",A[i]); \n }\n return 0;\n}"}, {"source_code": " #include<stdio.h>\n #include<string.h>\n int main(){\n \tchar s[101];\n \tint i,c=0;\n \tscanf(\"%s\",s);\n \tfor(i=0;i<strlen(s);i++)\n \t\tif(s[i]<'a')\n \t\t\tc++;\n \tprintf(\"%s\",c>strlen(s)/2 ? strupr(s):strlwr(s));\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{char c[10000];\nlong l,n,i,max;max=0;n=0;\n\ngets(c);l=strlen(c);for(i=0;i<l;i++)\n{\nif(isupper(c[i]))\n n++;\nelse\n max++;\n}\n\n\n for(i=0;i<l;i++)\n printf(\"%c\",(max>=n)?tolower(c[i]):toupper(c[i]));\nprintf(\"\\n\");\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,x=0,y=0;\n char a[100],b[100],c[100];\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=65 && a[i]<=90)\n {\n x=x+1;\n a[i]=a[i]+32;\n }\n else\n y=y+1;\n }\n\n\n if(x<=y)\n {\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=65 && a[i]<=90)\n {\n a[i]=a[i]+32;\n }\n }\n printf(\"%s\",a);\n return 0;\n\n }\n if(x>y)\n {\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]>=97 && a[i]<=122)\n {\n a[i]=a[i]-32;\n }\n }\n printf(\"%s\",a);\n return 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main() {\n char s[100] ; \n int i, n , l=0 , u=0 ; \n scanf(\"%s\", s) ;\n n= strlen(s) ; \n for (i=0 ; i<n ; i++) \n {\n if(isupper(s[i]))\n {\n u=u+1 ;\n }\n else \n { \n l=l+1 ;\n }\n }\n if(l>=u)\n {\n \n printf(\"%s\", strlwr(s)) ;\n \n }\n else \n {\n \n printf(\"%s\", strupr(s)) ;\n \n }\n\n return 0 ;\n}\n\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n char a[101],i,l=0,u=0;\n int count;\n gets(a);\n count=strlen(a);\n for(i=0;i<count;i++)\n {\n if(a[i]>='a'&&a[i]<='z')\n {\n l++;\n }\n if(a[i]>='A'&&a[i]<='Z')\n {\n u++;\n }\n }\n for(i=0;i<count;i++)\n {\n if(l>=u)\n {\n if(a[i]>='A'&&a[i]<='Z')\n {\n a[i]=a[i]+32;\n }\n }\n }\n for(i=0;i<count;i++)\n {\n if(u>l)\n {\n if(a[i]>='a'&&a[i]<='z')\n {\n a[i]=a[i]-32;\n }\n }\n }\n puts(a);\n return 0;\n \n }"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\n\nint main()\n{\n char ch[105];\n while(gets(ch)){\n int i,len = strlen(ch);\n int count = 0, bount = 0;\n for(i = 0; i < len; i++){\n if(ch[i] >= 65 && ch[i] <=90){\n count++;\n }\n else if(ch[i] >= 97 && ch[i] <= 122){\n bount++;\n }\n }\n if(count > bount){\n for(i = 0; i< len; i++){\n printf(\"%c\", toupper(ch[i]));\n }\n }\n else{\n for(i = 0; i< len; i++){\n printf(\"%c\", tolower(ch[i]));\n }\n }\n printf(\"\\n\");\n }\n }\n\n\n"}, {"source_code": "// https://codeforces.com/contest/59/problem/A\n\n#include <stdint.h>\n#include <stdio.h>\n\n\n#define IN_RANGE(v, s, e) ( (s) <= (v) && (v) <= (e) )\n\n#define IS_LOWER(c) IN_RANGE(c, 'a', 'z')\n#define IS_UPPER(c) IN_RANGE(c, 'A', 'Z')\n\n#define IS_ALPHA(c) ( IS_UPPER(c) || IS_LOWER(c) )\n#define IS_DIGIT(c) IN_RANGE(c, '0', '9')\n#define IS_ALNUM(c) ( IS_ALPHA(c) || IS_DIGIT(c) )\n\n#define TO_LOWER(c) ((c) += 32)\n// #define TO_LOWER(c) (IS_UPPER(c)) ? c += 32 : c ;\n#define TO_UPPER(c) ((c) -= 32)\n// #define TO_UPPER(c) (IS_LOWER(c)) ? c -= 32 : c ;\n\n#define MAX_LINE 100u\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToUpperCase(uint8_t * str, uint8_t str_len);\nvoid ToLowerCase(uint8_t * str, uint8_t str_len);\n\n\nint main(void)\n{\n uint8_t word[MAX_LINE] = {0};\n uint8_t str_len = 0u;\n uint8_t upper_case_count = 0u;\n \n scanf(\"%s\", word);\n \n while(word[str_len]) str_len++;\n \n upper_case_count = CountUpperCase(word, str_len);\n \n if(upper_case_count > (str_len/2))\n {\n ToUpperCase(word, str_len);\n }\n else\n {\n ToLowerCase(word, str_len);\n } /* end if */\n \n\tprintf(\"%s\\n\", word);\n \n\treturn 0;\n}\n\n\nuint8_t CountUpperCase(uint8_t * str, uint8_t str_len)\n{\n uint8_t upper_count = 0u;\n \n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n upper_count++;\n } /* end if */\n \n } /* end for */\n \n return upper_count;\n}\n\nvoid ToUpperCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_LOWER(str[i]))\n {\n str[i] = TO_UPPER(str[i]);\n } /* end if */\n } /* end for */\n}\n\nvoid ToLowerCase(uint8_t * str, uint8_t str_len)\n{\n for(uint8_t i = 0u; i < str_len; i++)\n {\n if(IS_UPPER(str[i]))\n {\n str[i] = TO_LOWER(str[i]);\n } /* end if */\n } /* end for */\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,count=0,count1=0;\n\tchar str1[1000];\n\tgets(str1);\n\tint length=strlen(str1);\n\tfor(i=0;i<length;i++)\n\t{\n\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t{\n\t\t\tcount++; // A to Z\n\t\t}\n\t\tif(str1[i]>=97 && str1[i]<=122)\n\t\t{\n\t\t\tcount1++; // a to z\n\t\t}\n\t}\n\t/*if(count1=count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}*/\n\t\n\tif(count1 >= count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}\n\t\n\telse\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>=97 && str1[i]<=122)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]-32;\n\t\t\t}\n\t\t}\n\t}\n\tputs(str1);\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main (void)\n\n{\n\tchar s[101];\n\tint up=0, lo=0;\n\tfgets(s, 101, stdin);\n\n\n\tfor(int i=0; i<strlen(s); i++)\n\t{\n\t\t if(s[i]>='a'&&s[i]<='z')\n lo++;\n else if(s[i]>='A'&&s[i]<='Z')\n up++;\n\t\t\n\t}\n\t\n\n\t\t\n\tif (up > lo)\n\t{\n\n\t\t\n\t\t\tprintf(\"%s\", strupr(s));\n\t\t\t\n\t}\n\t\n\telse if (lo>=up)\n\t\t\tprintf(\"%s\", strlwr(s));\n\t\t\t\t\t\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar s[105];\nint l,i,b=0,k=0;\nint main(){\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t\tif(s[i]<'a')\n\t\t\tb++;\n\t\telse\n\t\t\tk++;\n\t\t\t\n\tfor(i=0;i<l;i++)\n\t\tif(b>k){\n\t\t\tif(s[i]>='a')\n\t\t\t\ts[i]-=32;\n\t\t}\n\t\telse{\n\t\t\tif(s[i]<'a')\n\t\t\t\ts[i]+=32;\n\t\t}\n\tprintf(\"%s\",s);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n\tchar word[100];\n\tgets(word);\n\t\n\tint upper=0, lower=0;\n\tfor (int i = 0; i < strlen(word); ++i)\n\t{\n\t\tif (isupper(word[i]))\n\t\t{\n\t\t\tupper++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlower++;\n\t\t}\n\t}\n\tif (upper>lower)\n\t{\n\t\tfor (int i = 0; i < strlen(word); ++i)\n\t\t{\n\t\t\tprintf(\"%c\", toupper(word[i]));\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor (int i = 0; i < strlen(word); ++i)\n\t\t{\n\t\t\tprintf(\"%c\", tolower(word[i]));\n\t\t}\t\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n \n char a[102];\n int i;\n int scount=0;\n int ccount=0;\n scanf(\"%s\",a);\n int l=strlen(a);\n for(i=0;i<l;i++)\n {\n if(a[i]!='\\0')\n {\n if(a[i]>=97 && a[i]<=122)\n {\n scount++;\n \n }\n else\n {\n ccount++;\n \n }\n }\n }\n \n for(i=0;i<l;i++)\n {\n if(a[i]!='\\0')\n {\n if(scount==ccount)\n {\n \n if(a[i]>=65 && a[i]<=90 )\n {\n a[i]=a[i]+32;\n \n \n }\n }\n else if(ccount>scount)\n {\n if(a[i]>=97 && a[i]<=122)\n {\n a[i]=a[i]-32;\n \n }\n \n }\n else \n {\n if(a[i]>=65 && a[i]<=90)\n {\n a[i]=a[i]+32;\n }\n}\n}\n}\nprintf(\"%s\\n\",a);\n//system(\"Pause\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char str[100];\n int l,i,c=0,s=0;\n scanf(\"%s\",&str);\n l=strlen(str);\n for(i=0;i<l;i++)\n {\n if(str[i]>='a' && str[i]<='z')\n {\n s++;\n }\n else\n {\n c++;\n }\n }\n if(c>s)\n {\n for(i=0;i<l;i++)\n {\n if(str[i]>='a' && str[i]<='z')\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(i=0;i<l;i++)\n {\n if(str[i]>='A' && str[i]<='Z')\n {\n str[i]=str[i]+32;\n }\n }\n }\n printf(\"%s\",str);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,c=0,t=0;\nchar s[100];\nscanf(\"%s\",s);\nfor(i=0;s[i]!='\\0';i++)\n{\nif(s[i]>='a'&&s[i]<='z'){\nc=c+1;\n}\nif(s[i]>='A'&&s[i]<='Z'){\nt=t+1;\n}\n}\nif(c>=t)\nputs(strlwr(s));\nif(t>c)\nputs(strupr(s));\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint i,j,k;\n\tint count1=0,count2=0;\n\tchar a[1000];\n\tgets(a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{if(a[i]>96)\n\tcount1++;\n\telse\n\tcount2++;\n\t}\n\tif(count1>=count2)\n\t{\n\t\tfor(i=0;a[i]!='\\0';i++)\n\t\t{\n\t\t\tif(a[i]>96)\n\t\t\tcontinue;\n\t\t\ta[i]=a[i]+32;\n\t\t}}\n\t\telse\n\t\t{\tfor(i=0;a[i]!='\\0';i++)\n\t\t{\n\t\t\tif(a[i]<96)\n\t\t\tcontinue;\n\t\t\ta[i]=a[i]-32;\n\t\t}\n\t\t}\nputs(a);\n\t\t}\n\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[1000],count=0;\n scanf(\"%s\",s);\n int p=strlen(s);\n for(int i=0;i<p;i++)\n {\n if(s[i]<'a')\n count++;\n }\n \n printf(\"%s\",count>p/2?strupr(s):strlwr(s));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{\n char x[101],a=0,b=0,i;\n\n gets(x);\n\n for(i=0;i<strlen(x);i++)\n { if(x[i]<97) b++; else a++; }\n\n if(b>a) for(i=0;i<strlen(x);i++) x[i]=toupper(x[i]);\n\n else for(i=0;i<strlen(x);i++) x[i]=tolower(x[i]);\n\n puts(x);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[1000];\n int i,j=0,k=0;\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]<97)\n j++;\n else\n k++;\n }\n for(i=0;a[i]!='\\0';i++){\n if(j>k){\n if(a[i]>=97)\n a[i]=a[i]-32;\n }\n //a[i]=a[i]-32;\n else if(j<=k)\n {if(a[i]<97)\n a[i]=a[i]+32;}\n printf(\"%c\",a[i]);\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{\nchar a[105]={\"\\0\"},b[105]={\"\\0\"};\nint count1=0,count2=0,i,d;\nscanf(\"%s\",a);\nd=strlen(a);\nfor(i=0;i<d;i++)\n{\n\tif(isupper (a[i]))\n\tcount1++;\n\telse\n\tcount2++;\n}\nif(count1>count2)\n{\n\tfor(i=0;i<d;i++)\n\t b[i]=toupper (a[i]);\n\tprintf(\"%s\",b);\n}\nelse\n{\n\tfor(i=0;i<d;i++)\n\tb[i]=tolower(a[i]);\n\tprintf(\"%s\",b);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main(){\n\tchar s[101];\n\tint cntmin = 0, cntmax = 0, i;\n\tscanf(\"%s\", &s);\n\tfor(i = 0; i < strlen(s); i++){\n\t\tif(s[i] > 'Z') cntmin++;\n\t\telse cntmax++;\n\t}\n\tif(cntmin >= cntmax){\n\t\tfor(i = 0; i < strlen(s); i++){\n\t\t\ts[i] = tolower(s[i]);\n\t\t}\n\t\tprintf(\"%s\\n\", s);\n\t\t\n\t}\n\telse{\n\t\tfor(i = 0; i < strlen(s); i++){\n\t\t\ts[i] = toupper(s[i]);\n\t\t}\n\t\tprintf(\"%s\\n\", s);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint uppercase_count(char s[101])\n{\n int i=0,c=0;\n while(s[i]!=0)\n {\n if(s[i]>='A'&&s[i]<='Z')\n c++;\n i++;\n }\n return c;\n}\nint main(){\n int n,u,l;\n char str[101];\n scanf(\"%s\",str);\n u=uppercase_count(str);\n n=strlen(str);\n l=n-u;\n if(l>=u)\n printf(\"%s\",strlwr(str));\n else\n printf(\"%s\",strupr(str));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100],c=0,d=0,i;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n c++;\n else\n d++;\n }\n if(c==d)\n {\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n if(c>d)\n {\n for(i=0;s[i]!='\\0';i++)\n if(s[i]>='a'&&s[i]<='z')\n s[i]=s[i]-32;\n }\n else\n {\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]>='A'&&s[i]<='Z')\n s[i]=s[i]+32;\n }\n }\n puts(s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n \nvoid stringlower(char *str, int n)\n{\n int i;\n \n for(i = 0 ;i < n ;i++)\n {\n str[i]=tolower(str[i]);\n }\n}\n \nvoid stringupper(char *str, int n)\n{\n int i;\n \n for(i = 0 ;i < n ;i++)\n {\n str[i]=toupper(str[i]);\n }\n}\n \n \nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n \n int up=0;\n \n int i;\n \n for(i=0;i<strlen(str);i++)\n {\n if(str[i]!=tolower(str[i]))\n up++;\n }\n \n if(strlen(str)<2*up)\n stringupper(str,strlen(str));\n \n else\n stringlower(str,strlen(str));\n \n printf(\"%s\",str);\n \n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tchar s[100];\n\n\tchar l[100];\n\tchar u[100];\n\n\tscanf(\"%s\", s);\n\n\tint i, lw = 0, up = 0;\n\tint flag = 1;\n\tfor(i = 0; i < strlen(s); i++){\n\t\tif(s[i] > 96){\n\t\t\tlw++;\n\t\t\tflag = 0;\n\t\t} else {\n\t\t\tup++;\n\t\t\tflag = 1;\n\t\t}\n\n\t\tif(flag == 0){\n\t\t\tl[i] = s[i];\n\t\t\tu[i] = s[i] - 32;\n\t\t} else {\n\t\t\tl[i] = s[i] + 32;\n\t\t\tu[i] = s[i];\n\t\t}\n\t}\n\n\tif(up > lw){\n\t\tprintf(\"%s\", u);\n\t} else {\n\t\tprintf(\"%s\", l);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\tint n,i,l=0,u=0,m;\n\tchar s[100] , p[100];\n\tscanf(\"%s\",s);\n\tn=strlen(s);\n\tfor(i=0;i<=n-1;i++)\n {\n\tp[i]=s[i];\n if(p[i]>95)\n l++;\n else\n u++;\n }\n for(i=0;i<=n-1;i++)\n {\n if((u>l)&&(p[i]>95))\n p[i]=p[i]-32;\n else if((u==l)&&(p[i]<95))\n p[i]=p[i]+32;\n else if ((u<l)&&(p[i]<95))\n p[i]=p[i]+32;\n else ;\n s[i]=p[i];\n }\n m=strlen(p);\n for(i=0;i<=m-1;i++)\n {\n printf(\"%c\", p[i]);\n }\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\n\n\n\n\n\n\nint Fn_Mm(char ch[100])\n{\n int l,i,M=0,m=0;\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if(isupper(ch[i]))\n {\n M++;\n }\n else\n {\n m++;\n }\n\n }\n if(M>m)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n\n}\n\n\n\n\n\nint main()\n{\n int c,i;\n char ch[100];\n scanf(\"%s\",&ch);\n\nc=Fn_Mm(ch);\nif (c)\n{\n for (i=0 ;i<strlen(ch);i++)\n {\n if (islower(ch[i]))\n {\n ch[i]=(toupper(ch[i]));\n }\n }\n}\nelse\n{\n for (i ;i<strlen(ch);i++)\n {\n if (isupper(ch[i]))\n {\n ch[i]=(tolower(ch[i]));\n }\n }\n\n}\nreturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[100],b;\n int i,c=0;\n scanf(\"%s\",a);\n for(i=0;i<strlen(a);i++){\n if(isupper(a[i]))c++;\n else b++;\n }if(c-b>0)printf(\"%s\\n\", strlwr(a));\n else printf(\"%s\\n\", strupr(a));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n int len,count=0,n;\n len=strlen(str);\n scanf(\"%s\",str);\n for(int i=0;i<len;i++)\n {\n if(str[i]<91)\n count++;\n }\n if(count>len/2)\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]>=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]<=90)\n {\n str[i]=str[i]+32;\n }\n }\n }\n printf(\"%s\",str);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,c=0,t=0;\nchar s[100];\nscanf(\"%s\",s);\nfor(i=0;s[i]!='\\0';i++)\n{\nif(s[i]>='a'&&s[i]<='z'){\nc=c+1;\n}\nif(s[i]>='A'&&s[i]<='Z'){\nt=t+1;\n}\n}\nif(c>t)\nputs(strlwr(s));\nif(t>c)\nputs(strupr(s));\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<ctype.h>\n#include<string.h>\nint main(){\n\tint cntu, cntl, i, j;\n\tchar str[101];\n\tfgets(str, 100, stdin);\n\tfor(i = 0; str[i] != '\\0'; i++){\n\t\tif(isupper(str[i])){\n\t\t\tcntu++;\n\t\t}\n\t\telse{\n\t\t\tcntl++;\n\t\t}\n\t}\n\tif(cntl >= cntu){\n\t\tfor(j = 0; str[j] != '\\0'; j++){\n\t\t\tprintf(\"%c\", tolower(str[j]));\n\t\t}\n\t}\n\telse{\n\t\tfor(j = 0; str[j] != '\\0'; j++){\n\t\t\tprintf(\"%c\", toupper(str[j]));\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main(int argc, char *argv[]) {\n\tint lows = 0, uprs = 0;\n\tchar str[256];\n\tint i;\n\tscanf(\"%s\", str);\n\tfor (i = 0; i < strlen(str); i++) {\n\t\tlows += islower(str[i]) ? 1 : 0;\n\t\tuprs += isupper(str[i]) ? 1 : 0;\n\t}\n\tlows = lows - uprs + 1;\n\tfor (i = 0; i < strlen(str); i++) {\n\t\tprintf(\"%c\", lows ? tolower(str[i]) : toupper(str[i]));\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n\nint main(){\n char c, arr[101];\n int mayus = 0, minus = 0, size = 0;\n while((c = getchar()) != '\\n' && c != '\\0'){\n arr[size] = c;\n size++;\n if(islower(c)){\n minus++;\n }\n if(isupper(c)){\n mayus++;\n }\n }\n if(mayus > minus){\n for(int i = 0; i < size + 1; i++){\n arr[i] = toupper(arr[i]);\n printf(\"%c\",arr[i]);\n }\n }else{\n for(int i = 0; i < size + 1; i++){\n arr[i] = tolower(arr[i]);\n printf(\"%c\",arr[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100],str1[100],str2[100];\n int l,i,a=0,b=0;\n gets(str);\n l=strlen(str);\n for(i=0; i<l; i++)\n {\n if(str[i]>='a' && str[i]<='z')\n {\n a++;\n }\n else if(str[i]>='A' && str[i]<='Z')\n {\n b++;\n }\n }\n\n for(i=0; i<l; i++)\n {\n if(a>=b)\n {\n str1[i]=tolower(str[i]);\n }\n else if(b>a)\n {\n str2[i]=toupper(str[i]);\n }\n\n }\n if(a>=b)\n {\n\n puts(str1);\n }\n else if(b>a)\n {\n\n puts(str2);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint i,c=0,t=0;\nchar s[100];\nscanf(\"%s\",s);\nfor(i=0;s[i]!='\\0';i++)\n{\nif(s[i]>='a'&&s[i]<='z')\nc=c+1;\nif(s[i]>='a'&&s[i]<='z')\nt=t+1;\n}\nif(c>t)\nputs(strlwr(s));\nif(t>c)\nputs(strupr(s));\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n\nint main(void)\n{\n char str[100];\n int upper = 0;\n int lower = 0;\n int j = 0;\n int k = 0;\n scanf(\"%[^\\n]%*c\", str);\n\n int size = sizeof(str) / sizeof(str[0]);\n\n for(int i = 0; i < size; i++)\n {\n if(str[i] >= 'A' && str[i] <'Z')\n {\n upper++;\n }\n else\n {\n lower++;\n }\n }\n\n if(upper > lower)\n {\n while(str[j]) {\n putchar (toupper(str[j]));\n j++;\n }\n }\n else\n {\n while(str[k]) {\n putchar (tolower(str[k]));\n k++;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i=0,t=0;\n float n;\n char A[100]; \n gets(A);\n n=strlen(A);\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n t++;\n i++;\n }i=0;\n if((n-t)<=t)\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]<97)\n A[i]=(char)A[i]+32;\n i++;\n }\n }\n else\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n A[i]=(char)A[i]-32;\n i++;\n }\n }\n printf(\"%s\",A);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define MAX_LIMIT 100\nint main()\n{\n char s[MAX_LIMIT];\n int L=0,U=0;\n fgets(s,MAX_LIMIT,stdin);\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='a')&&(s[i]<='z'))\n L++;\n else if((s[i]>='A')&&(s[i]<='Z'))\n U++;\n }\n if((L>U)&&(L=U)){\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='A')&&(s[i]<='Z'))\n s[i]=s[i]+32;\n }\n}\nelse if(U>L)\n{\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='a')&&(s[i]<='z'))\n s[i]=s[i]-32;\n }\n}\nprintf(\"%s\",s);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main ()\n{\n char str[100];\n int value=0;\n int num;\n scanf(\"%s\",str);\n num=strlen(str);\n for(int i=0;i<num;i++)\n {\n if(str[i]>97)\n {\n value++;\n }\n }\n if(value>num-value)\n {\n printf(\"%s\",strlwr(str));\n }\n else\n {\n printf(\"%s\",strupr(str));\n }\n \n}"}, {"source_code": "int main() {\n\n char input[101];\n\n scanf(\"%s\", input);\n\n int small = 0, big = 0;\n\n char *tempPointer = input;\n\n while (*tempPointer != '\\0') {\n if (*tempPointer >= 'a' && *tempPointer <= 'z')\n small++;\n else\n big++;\n tempPointer++;\n }\n\n int diff = small > big ? 40 : -40;\n\n tempPointer = input;\n while (*tempPointer != '\\0') {\n\n if (diff == 40 && *tempPointer >= 'A' && *tempPointer <= 'Z')\n *tempPointer = (char ) ( *tempPointer + diff );\n else if (diff == -40 && *tempPointer >= 'a' && *tempPointer <= 'z') {\n *tempPointer = (char ) ( *tempPointer + diff );\n }\n tempPointer++;\n }\n \n printf(\"%s\\n\", input);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,l,c=0,k=0;\n char s[100];\n l=strlen(s);\n scanf(\"%s\",s);\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n {\n c++;\n }\n if(s[i]>=97&&s[i]<=122)\n {\n k++;\n }\n }\n if(c>k)\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n printf(\"%s\",s);\n }\n else if(c<k)\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n s[i]=s[i]+32;\n }\n printf(\"%s\",s);\n }\n else\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n s[i]=s[i]-32;\n }\n printf(\"%s\",s);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include<ctype.h>\nint k;\nint main(){\n char s[101]; scanf(\"%d\\n\",&s);\n long long int l=0,u=0;\n int len=strlen(s);\n for(k = 0; k <len;++k){if(s[k]<='z'&&s[k]>='a')\n l++;\n\n else\n u++;\n }\n if(l>=u){\n for(k = 0; k <len; ++k){s[k]=tolower(s[k]);}\n printf(\"%s\",s);\n return 0;\n }\n else{\n for(k = 0; k <len; k++){s[k]=toupper(s[k]);}\n printf(\"%s\",s);\n return 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char a[200];\n scanf(\"%s\",&a);\n int i,rev_sum,len,sum = 0;\n len = strlen(a);\n for (i = 0; i < len; i++){ //for flagging the smaller words.\n if (a[i] > 90){\n sum = sum+1;\n }\n }\n rev_sum = len - sum; //total amount of capital word\n if (rev_sum > sum ){\n for (i = 0;i < len;i++){\n if (a[i] > 90){\n a[i] = a[i] - 32;\n }\n }\n }\n else {\n for (i = 0;i < len;i++){\n if (a[i] < 90){\n a[i] = a[i] + 32;\n }\n }\n }\n printf(\"%s\\n\",a);\n}\n"}, {"source_code": "#include <stdio.h>\n//#include<string.h>\nint main()\n{\n char str[100];\n int len,count=0,n;\n len=strlen(str);\n scanf(\"%s\",str);\n for(int i=0;i<len;i++)\n {\n if(str[i]<91)\n count++;\n }\n if(count>len/2)\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]>=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]<=90)\n {\n str[i]=str[i]+32;\n }\n }\n }\n printf(\"%s\",str);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main (void)\n\n{\n\tchar s[100];\n\tint up=0, lo=0;\n\tfgets(s, 100, stdin);\n\n\n\tfor(int i=0; i<strlen(s); i++)\n\t{\n\t\tif(isupper(s[i]))\n\t\t{\n\t\t\tup++;\n\t\t}\n\t\telse if (islower(s[i]))\n\t\t{\n\t\t\tlo++;\n\t\t}\n\t}\n\t\n\n\t\t\n\tif (up > lo)\n\t{\n\n\t\t\n\t\t\tprintf(\"%s\", strupr(s));\n\t\t\t\n\t}\n\t\n\telse if (lo>=up)\n\t\t\tprintf(\"%s\", strlwr(s));\n\t\t\t\t\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[101]={'\\0'};\n scanf(\"%s\",str);\n int a=strlen(str);\n int c1=0,c2=0;\n for(int i=0;i<a;i++)\n {\n if(str[i]>='a'&& str[i]<='z')\n c1+=1;\n else if(str[i]>='A' && str[i]<='z')\n c2+=1;\n }\n if(c1==c2)\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='A' && str[i]<='z')\n str[i]+=32;\n }\n }\n else if(c2>c1)\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='a' && str[i]<='z')\n str[i]-=32;\n }\n }\n else\n {\n for(int i=0;i<a;i++)\n {\n if(str[i]>='A' && str[i]<='Z')\n str[i]+=32;\n }\n }\n printf(\"%s\",str);\n}\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i=0,t=0,n;\n char A[100]; \n gets(A);\n n=strlen(A);\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n t++;\n i++;\n }i=0;\n if(t>(n/2))\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]<97)\n A[i]=(char)A[i]+32;\n i++;\n }\n }\n else\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n A[i]=(char)A[i]-32;\n i++;\n }\n }\n printf(\"%s\",A);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{ \n int r,i,up=1,lw=0;\n\tchar a[101];\n\tgets(a);\n\tr=strlen(a);\n\tfor(i=0;i<r;i++)\n\tif(a[i]<'a')\n {\n up++;\n}else\n{\n\tlw++;\n}\n \n \n\n\tif(up>=lw)\n\tprintf(\"%s\",strupr(a));\n\telse\n\tprintf(\"%s\",strlwr(a));\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <string.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tchar s[100] ,t[100];\n\tint nb1 ,nb2 ,i;\n\tscanf(\"%s\",s);\n\tnb1=0;\n\tnb2=0;\n\tfor (i=0;i<strlen(s);i++)\n\t{\n\t\tif (isupper(s[i])) \n\t\t{ nb1=nb1+1 ;\n\t\t}\n\t\telse \n\t\t {\n\t\t\tnb2=nb2+1 ;\n\t\t }\n\t}\n\n if (nb1==0)\n { \n for (i=0;i<strlen(s);i++)\n \t{\n\t\t t[i]=toupper(s[i]);\n\t }\n\t }\n\t else if (nb2==0)\n\t { \n\t for (i=0;i<strlen(s);i++)\n\t {\n\t\t t[i]=tolower(s[i]);\n\t }\n\t }\n\n\t else if (nb1>nb2)\n\t{ \tfor (i=0;i<strlen(s);i++)\n\t { \n\t t[i]=toupper(s[i]);\n\t\t}\n }\n else if ( nb1 <nb2)\n\t {for (i=0;i<strlen(s);i++)\n\t { \n\t t[i]=tolower(s[i]);\n\t\t }\n\t }\t\n\t else \n\t {for (i=0;i<strlen(s);i++)\n\t { t[i]=tolower(s[i]);\n\t }\n\t }\n\t\t \n\tprintf(\"%s\",t);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[101];\n\tint i,u=0,v=0;\n\tscanf(\"%s\",s);\n\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]>='a' && s[i]<='z'){\n\t\t\tu++;}\n\t\t\telse{\n\t\t\t\tv++;}\n\t}\n\t\n\tif(u>v){\n\t\tfor(i=0;i<strlen(s);i++){\n\t\t if(s[i]>='A' && s[i]<='Z'){\n\t\t \ts[i]=(s[i]-'A')+'a';}\n\t}\n\t}\n\telse{\n\t\tfor(i=0;i<strlen(s);i++){\n\t\tif(s[i]>='a' && s[i]<='z'){\n\t\ts[i]=(s[i]-'a')+'A';}\n\t}\n\t}\n\tprintf(\"%s\",s);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar s[100];\nint n,c=0,r=0,j=0;\ngets(s);\nn=strlen(s);\nfor(int i=0;i<n;i++)\n{\nif(s[i]>='a'&&s[i]<='z')\n{\nc++;\n}\nelse\n{\nr++;\n}\n}\nj=(n+1)/2;\nif(c>j)\n{\nputs(strlwr(s));\n}\nelse\n{\nputs(strupr(s));\n}\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,count=0,count1=0;\n\tchar word[100],newword[100];\n\tscanf(\"%s\",&word);\n\tfor(i=0;i<strlen(word);i++)\n\t{\n\t\tif(word[i]>=65&&word[i]<=90)\n\t\t\tcount++;\n\t\telse if(word[i]>=97&&word[i]<=122)\n\t\t\tcount1++;\n\t}\n\tif(count>(strlen(word)/2))\n\t{\n\t\tfor(i=0;i<strlen(word);i++)\n\t\t{\n\t\t\tif(word[i]>=65&&word[i]<=90)\n\t\t\t\tnewword[i]+=word[i];\n\t\t\telse\n\t\t\t\tnewword[i]+=(word[i]-32);\n\t\t}\n\t}\n\telse if(count1>=(strlen(word)/2))\n\t{\n\t\tfor(i=0;i<strlen(word);i++)\n\t\t{\n\t\t\tif(word[i]>=97&&word[i]<=122)\n\t\t\t\tnewword[i]+=word[i];\n\t\t\telse\n\t\t\t\tnewword[i]+=(word[i]+32);\n\t\t}\n\t}\n\tprintf(\"%s\",newword);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,j=0,k=0;\n char str[100];\n gets(str);\n for(i=0; i<strlen(str); i++)\n {\n if(str[i] >= '65' || str[i] <= '90') j++;\n else if(str[i] >= '97' || str[i] <= '122') k++;\n }\n\n //.printf(\"%d %d\", j,k);\n if(j < k)\n {\n for(i=0; i<strlen(str); i++)\n {\n str[i] = toupper(str[i]);\n }\n printf(\"%s\", str);\n }\n else\n {\n for(i=0; i<strlen(str); i++)\n {\n str[i] = tolower(str[i]);\n }\n printf(\"%s\", str);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int i,n,count1=0,count2=0;\n char ch[110];\n gets(ch);\n \n for(i=0;;i++){\n if(ch[i]<=90 && ch[i]>= 65){\n count1=count1+1;\n }\n else{\n count2=count2+1;\n }\n if(ch[i]=='\\0'){\n break;\n }\n }\n if(count1>count2){\n for(i=0;;i++){\n if(ch[i]<=90 && ch[i] >=66){\n ch[i]=ch[i];\n }\n else{\n ch[i]='A'+ch[i]-'a';\n }\n if(ch[i]=='\\0'){\n break;\n }\n }\n }\n else{\n for(i=0;;i++){\n if(ch[i]<=90 && ch[i]>=65){\n ch[i]='a'+ch[i]-'A';\n }\n else{\n ch[i]=ch[i];\n }\n if(ch[i]=='\\0'){\n break;\n }\n }\n \n }\n printf(\"%s\",ch);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, a, b, i, w, q, y;\n scanf(\"%d %d %d\",&n,&a,&b);\n if (b>1&&b<=6)\n {\n for (i=a ;i<n-1 ;i++)\n {\n i=i;\n }\n printf(\"%d\",i);\n }\n if (b<1)\n {\n y=n+a+b;\n printf(\"%d\",y);\n }\n if (b>n)\n {\n q=b-n;\n w=q-a+1;\n printf(\"%d\",w);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char a[100];int c=0,s=0,d=0;\n gets(a);\n for(int i=0;i<sizeof(a);i++)\n {\n if (a[i] >= 'A' && a[i] <= 'Z')c++;\n else if (a[i] >= 'a' && a[i] <= 'z') s++;}\n \n if(s>=c){ while (a[d] != '\\0'){if (a[d] >= 'A' && a[d] <= 'Z')a[d] = a[d] + 32;d++;}printf(\"%s\",a);}\n else if(s<c){ while (a[d] != '\\0'){if (a[d] >= 'a' && a[d] <= 'z')a[d] = a[d] - 32;d++;}printf(\"%s\",a);}\n \n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i=0,t=0,n;\n char A[100]; \n gets(A);\n n=strlen(A);\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n t++;\n i++;\n }i=0;\n if(t>(n/2))\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]<97)\n A[i]=(char)A[i]+32;\n i++;\n }\n }\n else\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n A[i]=(char)A[i]-32;\n i++;\n }\n }\n printf(\"%s\",A);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char s[101];\n int x=0,y=0,l,i,j; \n scanf(\"%s\",s);\n l=strlen(s);\n s[l];\n for(i=0;i<l;i++)\n {if(s[i] >= 'A' && s[i] <= 'Z')\n x++;\n if(s[i] >= 'a' && s[i] <= 'z')\n y++; \n }\n \n if(x>y) {for(j=0;j<l;j++) putchar (toupper(s[j]));printf(\"%c\",s[j]);}\n else {for(j=0;j<l;j++) putchar (tolower(s[j]));printf(\"%c\",s[j]);}\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i;\n char ch[1000];\n scanf(\"%s\",&ch);\n for(i=0;ch[i]!='\\0';i++)\n {\n\n\n if(ch[i]>='a'&&ch[i]<='z')\n {\n ch[i]=ch[i]-97+65;\n }\n }\n printf(\"%s\",ch);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\nint main()\n{\n\tchar a[150],b[150];\n\tint i,j=0,m=0,n=0;\n\tscanf(\"%s\",a);\n\tfor(i=0;a[i]!='\\0';i++)\n\t{\n\t\tif(a[i]>=65&&a[i]<=90)\n\t\tm++;\n\t\tif(a[i]>=97&&a[i]<=122)\n\t\tn++;\n\t}\n\tif(m<=n)\n\t{\n\t\tfor(i=0;a[i]!='\\0';i++)\n\t\tb[j++]=tolower(a[i]);\n\t}\n\tif(m>n)\n\t{\n\t \tfor(i=0;a[i]!='\\0';i++)\t\n\t \tb[j++]=toupper(a[i]);\n\t}\n\tprintf(\"%s\",b);\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,o=0,count=0;\n\tchar string[100],array[100];\n\tscanf(\"%s\",string);\n\tfor(i=0;string[i]!='\\0';i++)\n\t{\n\t\tif(string[i]<=122 && string[i]>=97)\n\t\t\tcount++;\n\t}\n//\tprintf(\"%d\\n\",i );\n//\tprintf(\"%d\\n\",count );\n\t//char array[i];\n\tif(count>=i/2)\n\t{\n\t\tfor(j=0;string[j]!='\\0';)\n\t\t{\n\t\t\tif(string[j]<97)\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j]+32;\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j];\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\tfor(j=0;string[j]!='\\0';j++)\n\t\t{\n\t\t\tif(string[j]>90)\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j]-32;\n\t\t\t\t\to++;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j];\n\t\t\t\t\to++;\n\t\t\t\t}\n\t\t}\t\n\t}\n\tprintf(\"%s\\n\",array);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define MAX_LIMIT 100\nint main()\n{\n char s[MAX_LIMIT];\n int L=0,U=0;\n fgets(s,MAX_LIMIT,stdin);\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='a')&&(s[i]<='z'))\n L++;\n else if((s[i]>='A')&&(s[i]<='Z'))\n U++;\n }\n if((L>U)||(L==U)){\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='A')&&(s[i]<='Z'))\n s[i]=s[i]+32;\n }\n}\nelse \n{\n for(int i=0;s[i]!='\\0';i++)\n {\n if((s[i]>='a')&&(s[i]<='z'))\n s[i]=s[i]-32;\n }\n}\nprintf(\"%s\",s);\nreturn 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\nint main()\n{\n char ch [1000];\n int i,m,maj,min ;\n scanf (\"%s\" , ch);\n m=strlen(ch);\n maj==0 ;\n min==0;\n for (i=0;i<m;i++)\n {\n if (isupper (ch[i])){\n maj=maj+1 ;}\n else \n min=min+1;\n }\n if (maj>min)\n {\n for (i=0;i<m;i++)\n \n ch[i]=toupper (ch[i]);\n }\n \n else if (maj<min)\n {\n for (i=0;i<m;i++)\n ch[i]=tolower (ch[i]);\n } \n else \n {\n for (i=0;i<m;i++)\n {\n ch[i]=tolower (ch[i]);\n }\n }\n printf (\"%s\",ch);\n \n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void) {\n int i,l,u,n,k,j;\n char s[100];\n scanf(\"%s\",s);\n n=strlen(s);\n i=0;\n while(i<=n){\n if (s[i]<'a'){u++;}\n else {l++;}\n i++;\n }\n printf(\"%d %d \",u,l);\n \n if (l>=u){j=0;\n while(j<n){\n if (s[j]<'a'){ s[j]=tolower(s[j]);}\n j++;}}\n else if (l<u){\n k=0;\n while(k<n){\n if(s[k]>='a')\n {s[k]=toupper(s[k]);}\n k++;}}\n\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tchar word[102];\n\tint i, small=0, capital=0;\n\tfor(i=0; word[i-1] != '\\n'; i++)\n\t{\n\t\tscanf(\"%c\",&word[i]);\n\t\tif(word[i] <97 && word[i] >=65)\n\t\tcapital++;\n\t\telse if(word[i] >=97 && word[i] <=122) \n\t\tsmall++;\n\t\t\n\t}\n\tif(small < capital )\n\t{\n\t\t printf(\"%s\\n\",strupr(word));\n\t}\n\telse\n\t{\n\t\t printf(\"%s\\n\",strlwr(word));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\nint main(){\n char a[100],b;\n int i,c=0;\n scanf(\"%s\",a);\n for(i=0;i<=strlen(a);i++){\n if(isupper(a[i]))c++;\n else b++;\n }if(c-b>0)printf(\"%s\\n\", strlwr(a));\n else printf(\"%s\\n\", strupr(a));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n\nint main()\n{\n\tchar myString[101], str[101];\n\tint i, upper, lower;\n\tgets(myString);\n\tfor(i = 0; i < strlen(myString); i++){\n\t\tif(myString[i] >= 'A' && myString[i] <= 'Z'){\n\t\t\tupper++;\n\t\t}\n\t\telse{\n\t\t\tlower++;\n\t\t}\n\t}\n\t//printf(\"%d %d\\n\", upper, lower);\n\tif(lower >= upper){\n\t\tfor(i = 0; i < strlen(myString); i++){\n\t\t\tif(myString[i] >= 'A' && myString[i] <= 'Z'){\n\t\t\t\tstr[i] = myString[i] + 32;\n\t\t\t}\n\t\t\telse if(myString[i] >= 'a' && myString[i] <= 'z'){\n\t\t\t\tstr[i] = myString[i];\n\t\t\t}\n\t\t}\n\t}\n\telse if(upper > lower){\n\t\tfor(i = 0; i < strlen(myString); i++){\n\t\t\tif(myString[i] >= 'A' && myString[i] <= 'Z'){\n\t\t\t\tstr[i] = myString[i];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tstr[i] = myString[i] - 32;\n\t\t\t}\n\t\t}\n\t}\n\tputs(str);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n int i,j,c=0,d=0;\n char s[200];\n scanf(\"%s\",s);\n for(i=0;s[i];i++){\n if(s[i]>='A'&& s[i]<'Z'){\n c++;\n }\n else if(s[i]>='a' && s[i]<='z'){\n d++;\n }\n }\n //printf(\"%d %d\",c,d);exit(0);\n if(c>d){\n for(i=0;s[i];i++){\n if(s[i]>='a' && s[i]<='z'){\n s[i]=toupper(s[i]);\n }\n printf(\"%c\",s[i]);\n }\n }\n if(c<=d){\n for(i=0;s[i];i++){\n if(s[i]>='A' && s[i]<='Z'){\n s[i]=tolower(s[i]);\n }\n printf(\"%c\",s[i]);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define maxsize 101\nchar str[maxsize];\nvoid display(void)\n{\n int i;\n i=0;\n while(str[i]!='\\0')\n {\n printf(\"%c\", str[i]);\n i++;\n }\n}\nint main()\n{\n int i;\n int lcount,ucount;\n ucount=0;\n lcount=0;\n printf(\"enter the string\\n\");\n scanf(\"%s\", str);\n i=0;\n while(str[i]!='\\0')\n {\n if(str[i]>=65&&str[i]<=90)\n ucount++;\n else if(str[i]>=97&&str[i]<=122)\n lcount++;\n i++;\n }\n //printf(\"number of upper case letter is %d\\n\", ucount);\n //printf(\"number of lower case letter is %d\\n\", lcount);\n if(ucount>lcount)\n {\n i=0;\n while(str[i]!='\\0')\n {\n if(str[i]>=97&&str[i]<=122)\n str[i]=str[i]-32;\n i++;\n }\n }\n else if(ucount<=lcount)\n {\n i=0;\n while(str[i]!='\\0')\n {\n if(str[i]>=65&&str[i]<=90)\n str[i]=str[i]+32;\n i++;\n }\n }\n display();\ngetchar();\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main(){\n char pal[100];\n char minn[100];\n char maiu[100];\n int nn=0, mm=0;\n scanf(\"%s\", pal);\n int tam= strlen(pal);\n for (int i =0; i<tam;++i){\n minn[i]=tolower(pal[i]);\n maiu[i]=toupper(pal[i]);\n }\n for (int i =0; i<tam;++i){\n if(pal[i]==minn[i])\n nn++;\n else if(pal[i]==maiu[i])\n mm++;\n }\n if(nn==mm)\n printf(\"%s\", minn);\n else if(nn>mm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,l,c=0,k=0;\n char s[100];\n l=strlen(s);\n scanf(\"%s\",s);\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n {\n c++;\n }\n else if(s[i]>=97&&s[i]<=122)\n {\n k++;\n }\n }\n if(c>k)\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n }\n else \n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n s[i]=s[i]+32;\n }\n }\n printf(\"%s\\n\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,o=0,count=0,l;\n\tchar string[100],array[100];\n\tscanf(\"%s\",string);\n\tfor(i=0;string[i]!='\\0';i++)\n\t{\n\t\tif(string[i]<=122 && string[i]>=97)\n\t\t\tcount++;\n\t}\n//\tprintf(\"%d\\n\",i );\n//\tprintf(\"%d\\n\",count );\n\t//char array[i];\n\tif(count>i/2 && i%2!=0)\n\t{\n\t\tfor(j=0;string[j]!='\\0';)\n\t\t{\n\t\t\tif(string[j]<97)\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j]+32;\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j];\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t}\n\t}\n\telse if(count>=i/2 && i%2==0)\n{\nfor(j=0;string[j]!='\\0';)\n\t\t{\n\t\t\tif(string[j]<97)\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j]+32;\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j];\n\t\t\t\t\to++;\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\tfor(j=0;string[j]!='\\0';j++)\n\t\t{\n\t\t\tif(string[j]>90)\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j]-32;\n\t\t\t\t\to++;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarray[o]=string[j];\n\t\t\t\t\to++;\n\t\t\t\t}\n\t\t}\t\n\t}\n\t//for(l=0;l<o;l++)\n\t//printf(\"%c\",array[l]);\n\tprintf(\"%s\",array);\n\treturn 0;\n}\n"}, {"source_code": "\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n\nint main()\n{\n\n char str1[110];\n int i,j,l,flagLow=0,flagHigh=0,m,n;\n\n scanf(\"%s\",str1);\n l=strlen(str1);\n\n for(i=0; i<l; i++)\n {\n m=isupper(str1[i]);\n if(m==1)\n {\n flagHigh++;\n }\n else\n {\n flagLow++;\n }\n }\n\n\n\n\n\n if(flagHigh>=flagLow)\n {\n for(j=0; j<l; j++)\n {\n str1[j]=toupper(str1[j]);\n }\n printf(\"%s\",str1);\n }\n\n else if(flagHigh<=flagLow)\n {\n for(j=0; j<l; j++)\n {\n str1[j]=tolower(str1[j]);\n }\n printf(\"%s\",&str1);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,l,c=0,k=0;\n char s[100];\n l=strlen(s);\n scanf(\"%s\",s);\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n {\n c++;\n }\n else if(s[i]>=97&&s[i]<=122)\n {\n k++;\n }\n }\n if(c>k)\n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=97&&s[i]<=122)\n s[i]=s[i]-32;\n }\n }\n else \n {\n for(i=0;i<l;i++)\n {\n if(s[i]>=65&&s[i]<=90)\n s[i]=s[i]+32;\n }\n }\n printf(\"%s\\n\",s);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,j,k,l,count=0,count1=0;\n \n char str[100];\n \n l=strlen(str);\n \n for(i=0;i<l;i++)\n {\n if(str[i]>='a'&& str[i]<='z')\n { count++;}\n \n \n if(str[i]>='A'&& str[i]<='Z') \n \n { count1++;}\n \n }\n \n if(count>count1 && count==count1)\n {\n for(j=0;j<l;j++)\n \n str[j]=tolower(str[j]);\n }\n else\n {\n for(k=0;k<l;k++)\n \n str[k]=toupper(str[k]);\n }\n \n printf(\"%d\",str);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n\nint main()\n{\n char s[101];\n gets(s);\n int len=strlen(s);\n char x[len];\n int cap=0;\n int sma=0;\n for(int i=0; i<len; i++)\n {\n if(s[i]>='A' && s[i]<='Z')\n cap++;\n\n if(s[i]>='a' && s[i]<='z')\n sma++;\n }\n if(cap>sma)\n {\n for(int i=0; i<len; i++)\n {\n x[i]=toupper(s[i]);\n }\n printf(\"%s\\n\", x);\n }\n else\n {\n for(int i=0; i<len; i++)\n {\n x[i]=tolower(s[i]);\n }\n printf(\"%s\\n\", x);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main ()\n{\n char str[100];\n int value=0;\n int num;\n scanf(\"%s\",str);\n num=strlen(str);\n for(int i=0;i<num;i++)\n {\n if(str[i]>97)\n {\n value++;\n }\n }\n if(value>num-value)\n {\n printf(\"%s\",strlwr(str));\n }\n else\n {\n printf(\"%s\",strupr(str));\n }\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n\tchar str[100];\n\tscanf(\"%s\",str);\n\tint i=0,l=strlen(str);\n\tchar *ch=calloc(1,l);\n\tint up=0,lw=0;\n\twhile(i<l)\n\t{\n\t\tup=(str[i]>='A'&&str[i]<='Z')?up+1:up;\n\t\tlw=(str[i]>='a'&&str[i]<='z')?lw+1:lw;\n\t\ti++;\n\t}\n\ti=0;\n while(i<l)\n {\n\t\tif(lw>=up)\n \tch[i]=(str[i]>='A'&&str[i]<='Z')?str[i]+32:str[i];\n\t\telse\n\t\t\tch[i]=(str[i]>='A'&&str[i]<='Z')?str[i]:str[i]-32;\n i++;\n }\n\tprintf(\"%s\\n\",ch);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{ \n int r,i,up,lw;\n\tchar a[101];\n\tgets(a);\n\tr=strlen(a);\n\tfor(i=0;i<r;i++)\n\tif(a[i]<'a')\n {\n up++;\n}else\n{\n\tlw++;\n}\n \n \n\n\tif(up>=lw)\n\tprintf(\"%s\",strupr(a));\n\telse\n\tprintf(\"%s\",strlwr(a));\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i=0,t=0;\n float n;\n char A[100]; \n gets(A);\n n=strlen(A);\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n t++;\n i++;\n }i=0;\n if((n-t)<=t)\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]<97)\n A[i]=(char)A[i]+32;\n i++;\n }\n }\n else\n {\n while(A[i]!='\\0')\n {\n if((char)A[i]>97)\n A[i]=(char)A[i]-32;\n i++;\n }\n }\n printf(\"%s\",A);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,n,c,m;\nscanf(\"%d\",&n);\n char s[101];\n for(i=0;i<n;i++){\n scanf(\"%c\",&s[i]);\n }\n c=0,m=0;\n for(i=0;i<n;i++){\n if(s[i]>=97&&s[i]<=122){\n \tc++;\n }\n else {\n \tm++;\n }\n if(c>=m){\n \tif(s[i]>=65&&s[i]<=90){\n\t \ts[i]='a'+(s[i]-'A');\n\t }\n\t }\n\t else {\n\t if(s[i]>=97&&s[i]<=122){\n\t \ts[i]='A'+(s[i]-'a');\n\t }\n\t }\n\t printf(\"%c\",s[i]);\n\t }\n\t return 0;\n\t }\n\t \n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int icount=0;\n char s[101];\n scanf(\"%s\",s);\n for (int i=0;i<strlen(s);i++){\n if (s[i]>90)\n ++icount;\n else\n --icount;\n }\n if(icount>0){\n for(int i=0;i<=strlen(s);i++){\n if(s[i]>=65&&s[i]<=90)\n s[i]=s[i]+32;\n }}\n else{\n for(int i=0;i<=strlen(s);i++){\n if(s[i]>=96&&s[i]<=122)\n s[i]=s[i]-32;\n }\n\n }\n printf(\"%s\",s);\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n\t// your code goes here\n\tint n,u1,i,l,a;\n\tchar s1[100];\n\tscanf(\"%s\",s1);\n\t\n\tn=strlen(s1);\n\tfor(i=0;i<n;i++)\n\t{\n\t\ta=s1[i];\n\t\tif((s1[i]>96)&&(s1[i]<123))\n\t\tl++;\n\t\telse\n\t\tu1++;\n\t}\n\tif(u1>l)\n\t{\n\tfor(i=0;i<n;i++)\n\t{\n\t\ta=s1[i];\n\t\tif((s1[i]>96)&&(s1[i]<123))\n\t\t{\n\t\t\ta=a-32;\n\t\t}\n\t\ts1[i]=a;\n\t}}\n\t\tif(u1<=l)\n\t{\n\tfor(i=0;i<n;i++)\n\t{\n\t\ta=s1[i];\n\t\tif((s1[i]>65)&&(s1[i]<91))\n\t\t{\n\t\t\ta=a+32;\n\t\t}\n\t\ts1[i]=a;\n\t}}\n\tprintf(\"%s\",s1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\n\n\n\n\n\n\nint Fn_Mm(char ch[100])\n{\n int l,i,M=0,m=0;\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if(isupper(ch[i]))\n {\n M++;\n }\n else\n {\n m++;\n }\n\n }\n if(M>m)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n\n}\n\n\n\n\n\nint main()\n{\n int c,i;\n char ch[100];\n scanf(\"%s\",&ch);\n\nc=Fn_Mm(ch);\nif (c)\n{\n for (i=0 ;i<strlen(ch);i++)\n {\n if (islower(ch[i]))\n {\n ch[i]=(toupper(ch[i]));\n }\n }\n}\nelse\n{\n for (i=0 ;i<strlen(ch);i++)\n {\n if (isupper(ch[i]))\n {\n ch[i]=(tolower(ch[i]));\n }\n }\n\n}\nreturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[201];\n scanf(\"%s\",a);\n int i,l,count=0;\n l=strlen(a);\n for(i=0;i<l;i++)\n {\n if(a[i]>65&&a[i]<97)\n {\n count++;\n }\n }\n if(count>(l/2))\n {\n for(i=0;i<l;i++){\n if(a[i]>97)\n {\n a[i]=a[i]-32;\n }\n }\n }\n else{\n for(i=0;i<l;i++)\n {\n if(a[i]<97)\n {\n a[i]=a[i]+32;\n }\n }\n }\n printf(\"%s\",a);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[101],i,l=0,u=0;\n scanf(\"%s\",a);\n for(i=0;i<101;i++)\n {\n if(a[i]>='a'&&a[i]<='z')\n {\n l++;\n }\n if(a[i]>='A'&&a[i]<='Z')\n {\n u++;\n }\n }\n for(i=0;i<101;i++)\n {\n if(l>=u)\n {\n if(a[i]>='A'&&a[i]<='Z')\n {\n a[i]=a[i]+32;\n }\n }\n }\n \n for(i=0;i<101;i++)\n {\n if(u>l)\n {\n if(a[i]>='a'&&a[i]<='z')\n {\n a[i]=a[i]-32;\n }\n }\n }\n printf(\"%s\",a);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\t\n\tchar str[500];\n\t\n\tint c1 = 0, c2 = 0;\n\t\n\tscanf(\"%s\",str);\n\t\nfor(int i = 0;i < strlen(str);i++){\n\t\n\tif(str[i] >= 'A' && str[i] <= 'Z')\n\tc1++;\n\t\n\tif(str[i] >= 'A' && str[i] <= 'Z')\n\tc2++;\n\t\n\t\n}\n\nif(c1 > c2){\n\nfor(int i = 0;i < strlen(str);i++){\n\t\n\tstr[i] = toupper(str[i]);\n\t\n\tprintf(\"%c\",str[i]);\n}\n}\n\nelse{\n\nfor(int i = 0;i < strlen(str);i++){\n\t\n\tstr[i] = tolower(str[i]);\n\t\n\tprintf(\"%c\",str[i]);\n}\n\n}\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,u,l;\n\tchar st[100];\n\tscanf(\"%s\",st);\n\tfor(i=0;st[i]!='\\0';i++)\n\t{\n\t\tif(st[i]>=65&&st[i]<=90)\n\t\t{\n\t\t\tu++;\n\t\t}\n\t\tif(st[i]>=97&&st[i]<=122)\n\t\t{\n\t\t\tl++;\n\t\t}\n\t}\n\tif(l>=u)\n\t{\n\t\tfor(i=0;st[i]!='\\0'&&st[i]>=65&&st[i]<=90;i++)\n\t\t{\n\t\t\tst[i]=st[i]+32;\n\t\t}\n\t\t\n\t}\n\tif(l<u)\n\t{\n\t\tfor(i=0;st[i]!='\\0'&&st[i]>=97&&st[i]<=122;i++)\n\t\t{\n\t\t\tst[i]=st[i]-32;\n\t\t}\n\t\t\n\t\t\n\t}\n\t\n\tprintf(\"%s\",st);\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100],str1[100],str2[100];\n int l,i,a=0,b=0;\n gets(str);\n l=strlen(str);\n for(i=0; i<l; i++)\n {\n if(str[i]>='a' && str[i]<='z')\n {\n a++;\n }\n else if(str[i]>='A' && str[i]<='Z')\n {\n b++;\n }\n }\n\n for(i=0; i<l; i++)\n {\n if(a>=b)\n {\n str1[i]=tolower(str[i]);\n }\n else if(b>a)\n {\n str2[i]=toupper(str[i]);\n }\n\n }\n if(a>=b)\n {\n int len=strlen(str1);\n str1[len+1]='\\0';\n puts(str1);\n }\n else if(b>a)\n {\n int len=strlen(str2);\n str2[len+1]='\\0';\n puts(str2);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <ctype.h>\n#include <string.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tchar s[100] ,t[100];\n\tint nb1 ,nb2 ,i;\n\tscanf(\"%s\",s);\n\tnb1=0;\n\tnb2=0;\n\tfor (i=0;i<strlen(s);i++)\n\t{\n\t\tif (isupper(s[i])) \n\t\t{ nb1=nb1+1 ;\n\t\t}\n\t\telse \n\t\t {\n\t\t\tnb2=nb2+1 ;\n\t\t }\n\t}\n\n if (nb1==0)\n { \n for (i=0;i<strlen(s);i++)\n \t{\n\t\t t[i]=toupper(s[i]);\n\t }\n\t }\n\t else if (nb2==0)\n\t { \n\t for (i=0;i<strlen(s);i++)\n\t {\n\t\t t[i]=tolower(s[i]);\n\t }\n\t }\n\n\t else if (nb1>nb2)\n\t{ \tfor (i=0;i<strlen(s);i++)\n\t { \n\t t[i]=toupper(s[i]);\n\t\t}\n }\n else if ( nb1 <nb2)\n\t {for (i=0;i<strlen(s);i++)\n\t { \n\t t[i]=tolower(s[i]);\n\t\t }\n\t }\t\n\t else \n\t {for (i=0;i<strlen(s);i++)\n\t { t[i]=tolower(s[i]);\n\t }\n\t }\n\t\t \n\tprintf(\"%s\",t);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,count=0,count1=0;\n\tchar str1[120];\n\tgets(str1);\n\tint length=strlen(str1);\n\tfor(i=0;i<length;i++)\n\t{\n\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t{\n\t\t\tcount++; // A to Z\n\t\t}\n\t\tif(str1[i]>=97 && str1[i]<=122)\n\t\t{\n\t\t\tcount1++; // a to z\n\t\t}\n\t}\n\t/*if(count1=count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}*/\n\t\n\tif(count1 >= count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}\n\t\n\telse\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>97 && str1[i]<=122)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]-32;\n\t\t\t}\n\t\t}\n\t}\n\tputs(str1);\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint sum=0,i,x,b=0,c=0;\n\tchar a[100];\n\tscanf(\"%s\",&a);\n\tx=strlen(a);\n\tfor(i=0;i<x;i++)\n\t{\n\t\tsum=sum+a[i];\n\t\tif(a[i]>=97)\n\t\tb=b+a[i];\n\t\telse\n\t\tc=c+a[i];\n\t\t\n\t}\n\tif(b>=sum/2)\n\t{\n\t\tfor(i=0;i<x;i++)\n\t\t{\n\t\t\tif(a[i]<97)\n\t\t\ta[i]=a[i]+32;\n\t\t}\n\t\t\n\t}\n\telse if(c>sum/2)\n\t{\n\t\tfor(i=0;i<x;i++)\n\t\t{\n\t\t\tif(a[i]>97)\n\t\t\ta[i]=a[i]-32;\n\t\t}\n\t}\n\tfor(i=0;i<x;i++)\n\t{\n\t\tprintf(\"%c\",a[i]);\n\t}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n char str1[100];\n scanf(\"%s\", str1);\n for(int i=0; i<strlen(str1); i++){\n if(str1[i]<=90)\n str1[i] += 32; \n }\n printf(\"%s\", str1);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\n\n int main(int argc, const char * argv[]) {\n \n char string[100];\n int upper=0,lower=0;\n int len = strlen(string);\n scanf(\"%s\",string);\n for (int i =0;i<len;i++){\n if (isupper(string[i])) upper++;\n else if (islower(string[i]))lower++;\n }\n \n if (upper>lower){\n \n for (int i =0;i<len;i++){\n string[i] =toupper(string[i]);\n \n }\n \n \n \n \n \n }\n else {\n \n for (int i =0;i<len;i++){\n string[i]=tolower(string[i]);\n \n }\n\n \n }\n \n \n for (int i =0;i<len;i++){\n printf(\"%c\",string[i]);\n }\n\n \n return 0;\n }\n \n "}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint sum=0,i,x,b=0,c=0;\n\tchar a[100];\n\tscanf(\"%s\",&a);\n\tx=strlen(a);\n\tfor(i=0;i<x;i++)\n\t{\n\t\tsum=sum+a[i];\n\t\tif(a[i]>=97)\n\t\tb=b+a[i];\n\t\telse\n\t\tc=c+a[i];\n\t\t\n\t}\n\tif(b>=sum/2)\n\t{\n\t\tfor(i=0;i<x;i++)\n\t\t{\n\t\t\tif(a[i]<97)\n\t\t\ta[i]=a[i]+32;\n\t\t}\n\t\t\n\t}\n\telse if(c>sum/2)\n\t{\n\t\tfor(i=0;i<x;i++)\n\t\t{\n\t\t\tif(a[i]>97)\n\t\t\ta[i]=a[i]-32;\n\t\t}\n\t}\n\tfor(i=0;i<x;i++)\n\t{\n\t\tprintf(\"%c\",a[i]);\n\t}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n\nint main ()\n{\nchar word[100];\nint i;\nint countlower=0,countupper=0;\nscanf(\"%s\",word);\n\nfor(i=1;i<=strlen(word);i++)\n{\n if(islower(word[i])){\n countlower++;\n }\n else {\n countupper++;\n }\n}\nif(countlower>countupper)\n{\n for(i=1;i<=strlen(word);i++)\n {\n word[i]=tolower(word[i]);\n }\n }else \n {\n\t for(i=1;i<=strlen(word);i++)\n {\n word[i]=toupper(word[i]);\n } \n}\n\nprintf(\"%s\",word);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main()\n{\n int lowercase , uppercase ;\n lowercase = uppercase = 0;\n char string[1000];\n int i = 0 ;\n\n do{\n scanf(\"%c\" , &string[i]);\n if ( string[i] > 96 )\n lowercase++;\n else\n uppercase++;\n }while( string[i++] != '\\n');\n i = 0;\n if(lowercase >= uppercase)\n while (string[i] != '\\n')\n printf(\"\\n%d %c\" ,tolower(string[i]) ,tolower(string[i++]) );\n else\n while (string[i] != '\\n')\n printf(\"%c\" , toupper(string[i]), toupper(string[i++]) );\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\nint main()\n{\n char ch [1000];\n int i,m,maj,min ;\n scanf (\"%s\" , ch);\n m=strlen(ch);\n maj==0 ;\n min==0;\n for (i=0;i<m;i++)\n {\n if (isupper (ch[i])){\n maj=maj+1 ;}\n else \n min=min+1;\n }\n if (maj>min)\n {\n for (i=0;i<m;i++)\n \n ch[i]=toupper (ch[i]);\n }\n \n else{\n if (maj<=min)\n {\n for (i=0;i<m;i++)\n ch[i]=tolower (ch[i]);\n } \n }\n printf (\"%s\",ch);\n \n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i, a, b;\n scanf(\"%s\", &c);\n a=0;\n b=0;\n for(i=0;i<strlen(c); i++)\n {\n if(c[i]>=65 && c[i]<= 90)\n a++;\n else if(c[i]>=97 && c[i]<=122)\n b++;\n }\n if(a>b)\n {\n for(i=0;i<strlen(c);i++)\n {\n if(c[i]>=97 && c[i]<=122)\n {\n c[i]=65+c[i]-97;\n }\n }\n printf(\"%s\", c);\n }\n else if(a<b)\n for(i=0;i<strlen(c); i++)\n {\n if(c[i]>=65 && c[i]<= 90)\n {\n c[i]= c[i]+97-65;\n }\n\n }\n printf(\"%s\", c);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n char ch;\n char str[10000];\n int lower=0,count = 0,upper,index=0;\n while((ch = getchar())!='\\n'){\n if(ch>=97)\n lower++;\n str[count++] = ch;\n }\n upper = count-lower;\n if(upper>lower){\n for(int itr=0;str[itr];itr++){\n if(str[itr]>=97){\n str[itr] = str[itr]-32;\n }\n }\n }else{\n for(int itr=0;str[itr];itr++){\n if(str[itr]<=97){\n str[itr] = str[itr]+32;\n }\n }\n }\n printf(\"%s\",str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,count=0,count1=0;\n\tchar str1[120];\n\tgets(str1);\n\tint length=strlen(str1);\n\tfor(i=0;i<length;i++)\n\t{\n\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t{\n\t\t\tcount++; // A to Z\n\t\t}\n\t\tif(str1[i]>=97 && str1[i]<=122)\n\t\t{\n\t\t\tcount1++; // a to z\n\t\t}\n\t}\n\t/*if(count1=count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}*/\n\t\n\tif(count1 >= count)\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>64 && str1[i]<=90)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]+32;\n\t\t\t}\n\t\t}\n\t}\n\t\n\telse\n\t{\n\t\tfor(i=0;i<length;i++)\n\t\t{\n\t\t\tif(str1[i]>97 && str1[i]<=122)\n\t\t\t{\n\t\t\tstr1[i]=str1[i]-32;\n\t\t\t}\n\t\t}\n\t}\n\tputs(str1);\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[100];\n int i,j,k;\n scanf(\"%s\",&s);\n for(i=0;s[i]!='\\0';i++){\n if(s[i]>=97&&s[i]<=122){\n j++;}\n else if(s[i]>=65&&s[i]<=90){\n k++;}}\n for(i=0;s[i]!='\\0';i++){\n if(j>k){\n s[i]=s[i]+32;}\n else if(k>j){\n s[i]=s[i]-32;}\n else if(j=k){\n s[i]=s[i]-32;}}\n printf(\"%s\\n\",s);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i, a, b;\n scanf(\"%s\", &c);\n a=0;\n b=0;\n for(i=0;i<strlen(c); i++)\n {\n if(c[i]>=65 && c[i]<= 90)\n a++;\n else if(c[i]>=97 && c[i]<=122)\n b++;\n }\n if(a>b)\n printf(\"%s\", toupper(c));\n else if(a<b)\n printf(\"%s\", tolower(c));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include<ctype.h>\nint k;\nint main(){\n char s[101]; scanf(\"%d\\n\",&s);\n int l=0,u=0;\n int len=strlen(s);\n for(k = 0; k <len; k++){if(s[k]>=97&&s[k]<=122)\n l++;\n\n if (s[k]>=65&&s[k]<=90)\n u++;\n }\n if(l>=u){\n for(k = 0; k <len; k++){s[k]=tolower(s[k]);}\n }\n else if (u>l){\n for(k = 0; k <len; k++){s[k]=toupper(s[k]);}\n }\n printf(\"%s\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int i,l,u;\n char a[100];\n scanf(\"%s\",a);\n for(i=0;a[i]!='\\0';i++)\n {if(a[i]<91) u++;\n else l++;\n }\n if(u>l)\n {for(i=0;a[i]!='\\0';i++)\n {if(a[i]<91) u++;\n else {l++;a[i]=a[i]-32;}\n }}\n else\n {for(i=0;a[i]!='\\0';i++)\n {if(a[i]<91) {u++;a[i]=a[i]+32;}\n else l++;\n }}\n printf(\"%s\",a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n scanf(\"%s\",s);\n char su[strlen(s)+1],sl[strlen(s)+1];\n int u=0,l=0;\n for(int i=0;i<strlen(s);i++)\n {\n if(s[i]>=65&&s[i]<=92)\n {\n su[i]=s[i];\n sl[i]=s[i]+32;\n u++;\n }\n else\n {\n sl[i]=s[i];\n su[i]=s[i]-32;\n l++;\n }\n }\n u>l?printf(\"%s\",su):printf(\"%s\",sl);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1000];\n int i,a=0,b=0;\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]<'Z')\n {\n a++;\n }\n else\n {\n b++;\n }\n }\n if(a<b)\n {\n printf(\"%s\",strlwr(s));\n }\n else\n {\n printf(\"%s\",strupr(s));\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n//#include<string.h>\nint main()\n{\n char str[100];\n int len,count=0,n;\n len=strlen(str);\n scanf(\"%s\",str);\n for(int i=0;i<len;i++)\n {\n if(str[i]<91)\n count++;\n }\n if(count>len/2)\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]>=97)\n {\n str[i]=str[i]-32;\n }\n }\n }\n else\n {\n for(int i=0;i<len;i++)\n {\n if(str[i]<=90)\n {\n str[i]=str[i]+32;\n }\n }\n }\n printf(\"%s\",str);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main(){\n char pal[100];\n int nn=0, mm=0;\n scanf(\"%s\", pal);\n int tam= strlen(pal);\n char maiu[tam-1];\n char minn[tam-1];\n for (int i =0; i<tam-1;++i){\n minn[i]=tolower(pal[i]);\n maiu[i]=toupper(pal[i]);\n }\n for (int i =0; i<tam-1;++i){\n if(pal[i]==minn[i])\n nn++;\n else if(pal[i]==maiu[i])\n mm++;\n }\n if(nn==mm)\n printf(\"%s\", minn);\n else if(nn>mm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void) {\n int i,l,u,n,k,j;\n char s[100];\n scanf(\"%s\",s);\n n=strlen(s);\n i=0;\n while(i<=n){\n if (s[i]<'a'){u++;}\n else {l++;}\n i++;\n }\n \n if (l>=u){j=0;\n while(j<n){\n if (s[j]>='A' && s[j]<='Z'){ s[j]=tolower(s[j]);}\n j++;}}\n else if (l<u){\n k=0;\n while(k<n){\n if(s[k]>='a')\n {s[k]=toupper(s[k]);}\n k++;}}\n\n printf(\"%s\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char word[100] ;\n int i , len , count_upr = 0 , count_low = 0 ;\n gets(word) ;\n len = strlen(word) ;\n for(i = 0 ; i < len ; i++){\n if(word[i] >= 'a' && word[i] <= 'z'){\n count_low++ ;\n }\n else if(word[i] >= 'A' && word[i] <= 'Z'){\n count_upr++ ;\n }\n }\n if(count_upr > count_low){\n for(i = 0 ; i < len ; i++){\n word[i] = (word[i] - 'a') + 'A' ;\n }\n }\n else{\n for(i = 0 ; i < len ; i++){\n word[i] = (word[i] - 'A') + 'a' ;\n }\n }\n printf(\"%s\\n\", word);\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int i,j=0,k;\n gets(a);\n for(i=0;i<=strlen(a);i++)\n {\n if(a[i]>=65&&a[i]<=91)\n {\n a[i]=a[i]+32;\n j++;\n }\n }\n if(j==0)\n {\n for(i=0;i<=strlen(a);i++)\n {\n if(a[i]>=97&&a[i]<=122)\n a[i]=a[i]-32;\n }\n }\n puts(a);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n char s[101];\n int i,j,m=0,n=0;\n gets(s);\n for (i=0 ; i<strlen(s) ; i++ ){\n if ( s[i]>'A' && s[i]<'Z' ) m++;\n else n++;\n }\n if (m>n){\n for ( j=0 ; j<strlen(s) ; j++ ){\n if ( s[j] > 'Z' ) s[j] = s[j] - 32;\n }\n printf(s);\n }\n else {\n for ( j=0 ; j<strlen(s) ; j++ ){\n if ( s[j]<'a') s[j] = s[j] + 32;\n }\n printf(s);\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[200];\n scanf(\"%s\",c);\n int len,i,low=0;\n len=strlen(c);\n for(i=0;i<len;i++)\n {\n if(c[i]>='97')\n low++;\n }\n if(low>=(len-low))\n {\n for(i=0;i<len;i++)\n {\n if(c[i]<97)\n c[i]=c[i]+32;\n printf(\"%c\",c[i]);\n }\n }\n else\n {\n for(i=0;i<len;i++)\n {\n if(c[i]>=97)\n c[i]=c[i]-32;\n printf(\"%c\",c[i]);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int n,c=0,d=0;\n n=strlen(str);\n for(int i=0;i<n;i++){\n if(str[i]>='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i<n;i++){\n if(c>=d){\n if(str[i]<='Z'&&str[i]<='A'){\n str[i]=str[i]+32;\n }\n }else{\n str[i]=str[i]-32;\n }\n }\n printf(\"%s\",str);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i,j,k,l,count=0,count1=0;\n \n char str[100];\n \n l=strlen(str);\n \n for(i=0;i<l;i++)\n {\n if(str[i]>='a'&& str[i]<='z')\n { count++;}\n \n \n if(str[i]>='A'&& str[i]<='Z') \n \n { count1++;}\n \n }\n \n if(count>count1 && count==count1)\n {\n for(j=0;j<l;j++)\n \n str[j]=tolower(str[j]);\n }\n else\n {\n for(k=0;k<l;k++)\n \n str[k]=toupper(str[k]);\n }\n \n printf(\"%d\",str);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int n,c=0,d=0;\n n=strlen(str);\n for(int i=0;i<n;i++){\n if(str[i]>='a'&&str[i]<='z'){\n c++;\n }else{\n d++;\n }\n }\n for(int i=0;i<n;i++){\n if(c>=d){\n if(str[i]<='Z'&&str[i]<='A'){\n str[i]=str[i]+32;\n }\n }else{\n str[i]=str[i]-32;\n }\n }\n printf(\"%s\",str);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char m[101];\n int c=0;\n scanf(\"%s\",m);\n for(int i=0;i<strlen(m);i++)\n {\n if(m[0]>='a'&&m[0]<='z')\n c++;\n }\n if(c>=strlen(m)/2)\n {\n strlwr(m);\n printf(\"%s\",m);\n }\n else\n {\n strupr(m);\n printf(\"%s\",m);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i, a, b;\n scanf(\"%s\", &c);\n a=0;\n b=0;\n for(i=0;i<strlen(c); i++)\n {\n if(c[i]>=65 && c[i]<= 90)\n a++;\n else if(c[i]>=97 && c[i]<=122)\n b++;\n }\n if(a>b)\n {\n for(i=0;i<strlen(c);i++)\n {\n if(c[i]>=97 && c[i]<=122)\n {\n c[i]=65+c[i]-97;\n }\n }\n printf(\"%s\", c);\n }\n else if(a<b)\n for(i=0;i<strlen(c); i++)\n {\n if(c[i]>=65 && c[i]<= 90)\n {\n c[i]= c[i]+97-65;\n }\n\n }\n printf(\"%s\", c);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char str[105];\n int i,j,k,l,a=0,b=0,len;\n scanf(\"%s\",&str);\n len=strlen(str);\n for(i=0;i<=len;i++){\n if(str[i]>='A'&&str[i]<='Z'){\n a++;\n }\n else if(str[i]>='a'&&str[i]<='z'){\n b++;\n }\n }\n if(a>b){\n for(j=0;j<=len;j++){\n if(str[j]>='a'&&str[j]<='z'){\n str[j]='A'+(str[j]-'a');\n }\n else if(str[j]>='A'&&str[j]<='Z'){\n str[j];\n }\n printf(\"%c\",str[j]);\n }\n\n }\n else{\n for(k=0;k<=len;k++){\n if(str[k]>='a'&&str[k]<='z'){\n str[k];\n }\n else if(str[k]>='A'&&str[k]<='Z'){\n str[k]='a'+(str[k]-'A');\n }\n printf(\"%c\",str[k]);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint i,c,s,len;\n\t\n\tchar ch[101];\n\tscanf(\"%s\",ch);\n\tlen=strlen(ch);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(ch[i]>='A' && ch[i]<='Z')\n\t\tc++;\n\t\telse if(ch[i]>='a' && ch[i]<='z')\n\t\ts++;\n\t}\n\tif(s>=c)\n\t{\n\t\tfor(i=0;i<len;i++)\n\t\t{\n\t\t\tif(ch[i]>='A' && ch[i]<='Z')\n\t\t\tch[i]='a'+(ch[i]-'A');\n\t\t}\n\t\tprintf(\"%s\",ch);\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<len;i++){\n\t\t\tif(ch[i]>='a' && ch[i]<='z')\n\t\tch[i]='A'+(ch[i]-'a');}\n\t\tprintf(\"%s\",ch);\n\t}\nreturn 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[101];\n int i,l,lo=0,u=0;\n while(scanf(\"%s\",&s)!=EOF)\n {\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]>'a'&&s[i]<'z')\n lo++;\n else if(s[i]>'A'&&s[i]<'Z')\n u++;\n }\n if(lo>u)\n {\n printf(\"%s\\n\",strlwr(s));\n }\n else if(u>lo)\n {\n printf(\"%s\\n\",strupr(s));\n }\n else if(lo==u)\n {\n printf(\"%s\\n\",strlwr(s));\n }\n lo=0,u=0;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\nint main(){\n char pal[100];\n int nn=0, mm=0;\n scanf(\"%s\", pal);\n int tam= strlen(pal);\n char maiu[tam];\n char minn[tam];\n\n for (int i =0; i<tam;++i){\n minn[i]=tolower(pal[i]);\n maiu[i]=toupper(pal[i]);\n }\n for (int i =0; i<tam;++i){\n if(pal[i]==minn[i])\n nn++;\n else if(pal[i]==maiu[i])\n mm++;\n }\n if(nn==mm)\n printf(\"%s\", minn);\n else if(nn>mm)\n printf(\"%s\", minn);\n else\n printf(\"%s\", maiu);\n printf(\"\\n\");\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\nchar s[102];\nscanf(\"%s\",s);\nint l,i;\nl=strlen(s);\nint up=0,low=0;\nfor(i=0;i<l;i++)\n{\nif(s[i]>=67 && s[i]<=92)\n{\nup++;\n}\nelse\nlow++;\n}\nif(low<up)\n{\n for(i=0;i<l;i++)\n s[i]=toupper(s[i]);\n}\n\nelse\nfor(i=0;i<l;i++)\ns[i]=tolower(s[i]);\n\nprintf(\"%s\",s);\nreturn 0;\n}\n"}], "src_uid": "b432dfa66bae2b542342f0b42c0a2598"} {"nl": {"description": "One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems.But there are too many problems, to do it manually. Alex asks you to write a program, which will determine if a problem is from this contest by its name.It is known, that problem is from this contest if and only if its name contains one of Alex's friends' name exactly once. His friends' names are \"Danil\", \"Olya\", \"Slava\", \"Ann\" and \"Nikita\".Names are case sensitive.", "input_spec": "The only line contains string from lowercase and uppercase letters and \"_\" symbols of length, not more than 100 \u2014 the name of the problem.", "output_spec": "Print \"YES\", if problem is from this contest, and \"NO\" otherwise.", "sample_inputs": ["Alex_and_broken_contest", "NikitaAndString", "Danil_and_Olya"], "sample_outputs": ["NO", "YES", "NO"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define MAX 100\n\nint main(){\n\tchar in[MAX],index;\n\tint matcht=0;\n\tchar temp [5]=\"DOSAN\";\n\tchar friends[5][7]={\"Danil1 \",\"Olya1 \",\"Slava1 \",\"Ann1 \",\"Nikita1\"};\n\tfor(int i=0;;i++){\n\t\tscanf(\"%c\",&in[i]);\n\t\tif(in[i]=='\\n'){\n\t\t\tin[i]='\\0';\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(int i=0;;i++){\n\t\tif(in[i]=='\\0')\n\t\t\tbreak;\n\t\tfor(index=0;index<5;index++)\n\t\t\tif(in[i]==temp[index])\n\t\t\t\tbreak;\n\t\tif(index<5)\n\t\t\tfor(int j=0;j<7;j++){\n\t\t\t\tif(friends[index][j]=='1'){\n\t\t\t\t\tmatcht++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(friends[index][j]!=in[i+j])\n\t\t\t\t\tbreak;\n\t\t\t}\n\t}\n\t\tif(matcht==0||matcht>1)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n count++;\n if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n count++;\n if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n count++;\n if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n count++;\n if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n count++;\n }\n if(count==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n int i,j,k,len,len1,len2,len3,len4,len5,x,cnt=0,c=0;\n char a[100],a1[20]=\"Danil\",a2[20]=\"Olya\",a3[20]=\"Slava\",a4[20]=\"Ann\",a5[20]=\"Nikita\";\n scanf(\"%s\",a);\n len=strlen(a);\n len1=strlen(a1);\n len2=strlen(a2);\n len3=strlen(a3);\n len4=strlen(a4);\n len5=strlen(a5);\n for(i=0;i<len;i++)\n {\n\n if(a[i]==a1[0])\n { cnt=0;\n for(j=0,k=i;j<len1;j++,k++)\n {\n if(a[k]==a1[j])\n {\n cnt++;\n }\n }\n if(cnt==len1)\n {\n c++;\n }\n\n }\n if(a[i]==a2[0])\n { cnt=0;\n for(j=0,k=i;j<len2;j++,k++)\n {\n if(a[k]==a2[j])\n {\n cnt++;\n }\n }\n if(cnt==len2)\n {\n c++;\n }\n\n }\n if(a[i]==a3[0])\n { cnt=0;\n for(j=0,k=i;j<len3;j++,k++)\n {\n if(a[k]==a3[j])\n {\n cnt++;\n }\n }\n if(cnt==len3)\n {\n c++;\n }\n\n }\n if(a[i]==a4[0])\n { cnt=0;\n for(j=0,k=i;j<len4;j++,k++)\n {\n if(a[k]==a4[j])\n {\n cnt++;\n }\n }\n if(cnt==len4)\n {\n c++;\n }\n\n }\n if(a[i]==a5[0])\n { cnt=0;\n for(j=0,k=i;j<len5;j++,k++)\n {\n if(a[k]==a5[j])\n {\n cnt++;\n }\n }\n if(cnt==len5)\n {\n c++;\n }\n\n }\n }\n if(c==1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int i,y=0;\n char str[101];\n scanf(\"%s\",str);\n int len = strlen(str);\n for(i=0;i<len;i++){\n if(str[i]=='D' && str[i+1]=='a' && str[i+2]=='n' && str[i+3]=='i' && str[i+4]=='l'){\n y=y+1;\n }\n if(str[i]=='O' && str[i+1]=='l' && str[i+2]=='y' && str[i+3]=='a'){\n y=y+1;\n }\n if(str[i]=='S' && str[i+1]=='l' && str[i+2]=='a' && str[i+3]=='v' && str[i+4]=='a'){\n y=y+1;\n }\n if(str[i]=='A' && str[i+1]=='n' && str[i+2]=='n'){\n y=y+1;\n }\n if(str[i]=='N' && str[i+1]=='i' && str[i+2]=='k' && str[i+3]=='i' && str[i+4]=='t' && str[i+5]=='a'){\n y=y+1;\n }\n\n\n }\n if(y==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MaxNum 106\n#define Num 6\n\nint main()\n{\n char Name[MaxNum];\n int i,CNikita=0,CAnn=0,CSlava=0,COlya=0,CDanil=0,Sum;\n for(i=0;i<MaxNum;i++){\n Name[i]=0;\n }\n gets(Name);\n for(i=0;i<MaxNum;i++){\n if(Name[i]==0){\n break;\n }\n if(Name[i]=='A' && Name[i+1]=='n' && Name[i+2]=='n'){\n CAnn++;\n }\n if(Name[i]=='S' && Name[i+1]=='l' && Name[i+2]=='a'&& Name[i+3]=='v' && Name[i+4]=='a'){\n CSlava++;\n }\n if(Name[i]=='O' && Name[i+1]=='l' && Name[i+2]=='y' && Name[i+3]=='a'){\n COlya++;\n }\n if(Name[i]=='D' && Name[i+1]=='a' && Name[i+2]=='n'&& Name[i+3]=='i' && Name[i+4]=='l'){\n CDanil++;\n }\n if(Name[i]=='N' && Name[i+1]=='i' && Name[i+2]=='k'&& Name[i+3]=='i' && Name[i+4]=='t' && Name[i+5]=='a'){\n CNikita++;\n }\n\n }\n Sum=CNikita+CAnn+COlya+CDanil+CSlava;\n if(Sum==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n //printf(\"Nikita=%d Ann=%d Slava=%d Olya=%d Danil=%d \\n\",CNikita,CAnn,CSlava,COlya,CDanil);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "\n// http://codeforces.com/contest/877/problem/A\n\n#include <stdio.h>\n#include <string.h>\n\ntypedef enum {\n\tFalse,\n\tTrue\n} bool_t;\n\ntypedef struct{\n\tchar * name;\n\tint name_len;\n} friend_t;\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b);\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len);\nint CountStr(char * string, char * sub_str, int str_len, int sub_len);\n\n#define DANIL\t\"Danil\"\n#define OLYA\t\"Olya\"\n#define SLAVA\t\"Slava\"\n#define ANN\t\t\"Ann\"\n#define NIKITA\t\"Nikita\"\n\n#define MAX_LINE\t101\n\n#define DEBUG(x, y)\tdo{printf(\"DEBUG:: %s = \" #y\"\\n\", #x, x);}while(0);\n#define DEBUG_STR(str, len)\tfor(int i = 0; i<len; i++){ printf(\"%c\", str[i]); }printf(\"\\n\");\n\nint main(void){\n\t\n\tchar contest[MAX_LINE];\n\tint found_friends = 0, index = 0;\n\tfriend_t friends[5];\n\tint len = 0;\n\t\n\tfriends[0].name = DANIL;\n\tfriends[1].name = OLYA;\n\tfriends[2].name = SLAVA;\n\tfriends[3].name = ANN;\n\tfriends[4].name = NIKITA;\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tfriends[index].name_len = strlen(friends[index].name);\n\t\t\n\t}\n\t\n\tscanf(\"%s\", contest);\n\tlen = strlen(contest);\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tfound_friends += CountStr(contest, friends[index].name, len, friends[index].name_len);\n\t\t\n\t\tif(found_friends > 1){\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\t\n\tif(found_friends == 1){\n\t\tprintf(\"YES\\n\");\n\t}else{\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}\n\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b){\n\n\tint res = 0, index = 0;\n\n\tif(len_a != len_b){\n\n\t\tres = len_a - len_b;\n\n\t}else{\n\n\t\tfor(index = 0; index < len_a; index++){\n\n\t\t\tif(str_a[index] != str_b[index]){\n\n\t\t\t\tres += str_a[index] - str_b[index];\n\t\t\t\tbreak;\n\n\t\t\t}\t// end if str_a[index] != str_b[index]\n\n\t\t}\t// end for index = 0; index < len_a; index++\n\n\t}\t// end if len_a != len_b\n\n\treturn res;\n}\n\n\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len){\n\n\tint index = 0;\n\n\tif(str_len == sub_len){\n\n\t\t// if both strings are equal, return True\n\t\tif(StrCompare(string, sub_str, str_len, sub_len) == 0){\n\n\t\t\treturn True;\n\n\t\t}\t// end if(StrCompare(string, sub_str, str_len, sub_len) == 0)\n\n\t}else if( sub_len < str_len ){\n\n\t\tfor(index = 0; index < str_len - sub_len + 1; index++){\n\t\t\t\n\t\t\tif( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 ){\n\n\t\t\t\treturn True;\n\n\t\t\t}\t// end if( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 )\n\n\t\t}\t// end for(index = 0; index < str_len - sub_len; index++)\n\n\t}else{\n\n\t\t// do nothing\n\n\t}\t// end if(str_len == sub_len)\n\n\treturn False;\n}\n\nint CountStr(char * string, char * sub_str, int str_len, int sub_len){\n\t\n\tint count = 0, index = 0;\n\t\n\tfor(index = 0; index <= str_len - sub_len; index++){\n\t\t\n\t\tif( StrCompare( &string[index], sub_str, sub_len, sub_len ) == 0){\n\t\t\tcount++;\n\t\t}\n\t\t\n\t}\n\t\n\treturn count;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for (i=0;i<l;i++)\n {\n if (s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n')\n c++;\n\t\t\n if(s[i]=='O'&& s[i+1]=='l'&& s[i+2]=='y'&& s[i+3]=='a')\n c1++;\n \n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&& s[i+3]=='i'&& s[i+4]=='l')\n c2++;\n\t \n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&& s[i+3]=='i'&& s[i+4]=='t'&& s[i+5]=='a')\n c3++;\n\t\t\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&& s[i+3]=='v'&& s[i+4]=='a')\n c4++;\n }\t\t\n\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n { \n printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i, j=0, k;\n char a[102];\n scanf(\"%s\", a);\n\n for(i=0; i<strlen(a); i++)\n {\n if((a[i]=='D'&&a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]=='i'&&a[i+4]=='l')||(a[i]=='O'&&a[i+1]=='l'&&a[i+2]=='y'&&a[i+3]=='a')||(a[i]=='S'&&a[i+1]=='l'&&a[i+2]=='a'&&a[i+3]=='v'&&a[i+4]=='a')||(a[i]=='A'&&a[i+1]=='n'&&a[i+2]=='n')||(a[i]=='N'&&a[i+1]=='i'&&a[i+2]=='k'&&a[i+3]=='i'&&a[i+4]=='t'&&a[i+5]=='a'))\n {\n j++;\n }\n }\n\n if(j==1) printf(\"YES\");\n\n else printf(\"NO\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid arr(char pat[],int m,int *lps)\n{\nint len=0;\nlps[0]=0;\nint i=1;\nwhile(i<m){\nif(pat[i]==pat[len]){\nlen++;lps[i]=len;\ni++;}\nelse {\nif(len!=0){\nlen=lps[len-1];}\nelse {\nlps[i]=0;\ni++;}}}}\nint sea(char pat[],char txt[])\n{\nint m=strlen(pat);\nint n=strlen(txt);\nint lps[m];\nint count=0;\narr(pat,m,lps);\nint i=0,j=0;\nwhile(i<n){\nif(pat[j]==txt[i]){\nj++;i++;\n}\nif(j==m){\ncount++;\nj=lps[j-1];}\nelse if(i<n&&pat[j]!=txt[i]){\nif(j!=0)\nj=lps[j-1];\nelse \ni=i+1;\n}}\nreturn count;}\nint main(){\nint l1,l2,l3,l4,l5;\nchar txt[1000];\nchar pat1[10]=\"Danil\",pat2[10]=\"Olya\",pat3[10]=\"Slava\",pat4[]=\"Ann\",pat5[]=\"Nikita\";\nscanf(\"%s\",txt);\nl1=sea(pat1,txt);\nl2=sea(pat2,txt);\nl3=sea(pat3,txt);\nl4=sea(pat4,txt);\nl5=sea(pat5,txt);\nif((l1+l2+l3+l4+l5)==1){\nprintf(\"YES\\n\");}\nelse printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<ctype.h>\n#define mod 100000007\n#define N 200001\n\nchar x[100001]= {'\\0'};\nint main()\n{\n int i,a=0,b=0,c=0,d=0,e=0;\n scanf(\"%s\",x);\n\n for(i=0; i<strlen(x); i++)\n {\n if(x[i]=='D' && x[i+1]=='a'&& x[i+2]=='n'&& x[i+3]=='i'&& x[i+4]=='l') a++;\n if(x[i]=='O' && x[i+1]=='l'&& x[i+2]=='y'&& x[i+3]=='a') b++;\n if(x[i]=='S' && x[i+1]=='l'&& x[i+2]=='a'&& x[i+3]=='v'&& x[i+4]=='a') c++;\n if(x[i]=='A' && x[i+1]=='n'&& x[i+2]=='n') d++;\n if(x[i]=='N' && x[i+1]=='i'&& x[i+2]=='k'&& x[i+3]=='i'&& x[i+4]=='t'&& x[i+5]=='a') e++;\n }\n\n if((a+b+c+d+e)==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n count++;\n if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n count++;\n if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n count++;\n if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n count++;\n if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n count++;\n }\n if(count==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n count++;\n if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n count++;\n if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n count++;\n if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n count++;\n if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n count++;\n }\n if(count==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <time.h>\n\n\nint main(){\n char name[101];\n scanf(\"%s\", name);\n\n int test[5] = {0};\n\n int ct1,ct2,length;\n for(ct1 = 0 ; ct1 < 100 ; ct1++){\n if(name[ct1] == '\\0'){\n length = ct1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 4 < length ; ct1++){\n if(name[ct1] == 'D' && name[ct1 +1 ] == 'a' && name[ct1 + 2] == 'n' && name[ct1 + 3] == 'i' && name[ct1 + 4] == 'l' ){\n test[0]++;\n }\n }\n for(ct1 = 0 ; ct1 + 3 < length ; ct1++){\n if(name[ct1] == 'O' && name[ct1 +1 ] == 'l' && name[ct1 + 2] == 'y' && name[ct1 + 3] == 'a' ){\n test[1]++;\n }\n }\n for(ct1 = 0 ; ct1 + 4 < length ; ct1++){\n if(name[ct1] == 'S' && name[ct1 +1 ] == 'l' && name[ct1 + 2] == 'a' && name[ct1 + 3] == 'v' && name[ct1 + 4] == 'a' ){\n test[2]++;\n\n }\n }\n for(ct1 = 0 ; ct1 + 2 < length ; ct1++){\n if(name[ct1] == 'A' && name[ct1 +1 ] == 'n' && name[ct1 + 2] == 'n' ){\n test[3]++;\n\n }\n }\n for(ct1 = 0 ; ct1 + 5 < length ; ct1++){\n if(name[ct1] == 'N' && name[ct1 +1 ] == 'i' && name[ct1 + 2] == 'k' && name[ct1 + 3] == 'i' && name[ct1 + 4] == 't' && name[ct1 + 5] == 'a'){\n test[4]++;\n\n }\n }\n if(test[0] + test[1] + test[2] + test[3] + test[4] == 1){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint StringFind(const char *pSrc, const char *pDst) \n{ \n int i, j;\n int num = 0;\n for (i=0; pSrc[i]!='\\0'; i++) \n { \n if(pSrc[i]!=pDst[0]) \n continue; \n j = 0; \n while((pDst[j]==pSrc[i+j])&&(pDst[j]!='\\0')&&(pSrc[i+j]!='\\0')) \n { \n j++; \n } \n if(j==strlen(pDst)) \n {\n num++;\n i += j-1;\n }\n }\n if(num>0)\n return num;\n else\n return 0; \n}\n\nint main()\n{\n char s[100];\n while(scanf(\"%s\",&s)!=EOF)\n {\n int result = 0;\n result += StringFind(s,\"Danil\");\n result += StringFind(s,\"Olya\");\n result += StringFind(s,\"Slava\");\n result += StringFind(s,\"Nikita\");\n result += StringFind(s,\"Ann\");\n if(result==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n char s[110];\n int i, ct = 0;\n scanf(\"%s\", s);\n for(i = 0; s[i] != '\\0'; i++)\n {\n if((s[i] == 'A') && (s[i + 1] == 'n') && (s[i + 2] == 'n'))\n {\n ct++;\n i += 2;\n }\n else if((s[i] == 'O') && (s[i + 1] == 'l') && (s[i + 2] == 'y') && (s[i + 3] == 'a'))\n {\n ct++;\n i += 3;\n }\n else if((s[i] == 'S') && (s[i + 1] == 'l') && (s[i + 2] == 'a') && (s[i + 3] == 'v') && (s[i + 4] == 'a'))\n {\n ct++;\n i += 4;\n }\n else if((s[i] == 'D') && (s[i + 1] == 'a') && (s[i + 2] == 'n') && (s[i + 3] == 'i') && (s[i + 4] == 'l'))\n {\n ct++;\n i += 4;\n }\n else if((s[i] == 'N') && (s[i + 1] == 'i') && (s[i + 2] == 'k') && (s[i + 3] == 'i') && (s[i + 4] == 't') && (s[i + 5] == 'a'))\n {\n ct++;\n i += 5;\n }\n }\n if(ct == 1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i, j,sum;\n\tchar a[100];\n\tgets(a);\n\tsum = 0;\n\tfor (i = 0;a[i] != '\\0';i++)\n\t{\n\t\tif (a[i] == 'D')\n\t\t{\n\t\t\tif (a[i + 1] == 'a'&&a[i + 2] == 'n'&&a[i + 3] == 'i'&&a[i + 4] == 'l')\n\t\t\t{\n\t\t\t\tsum += 1;i += 4;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'O')\n\t\t{\n\t\t\tif (a[i + 1] == 'l'&&a[i + 2] == 'y'&&a[i + 3] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 3;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'S')\n\t\t{\n\t\t\tif (a[i + 1] == 'l'&&a[i + 2] == 'a'&&a[i + 3] == 'v'&&a[i + 4] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 4;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'A')\n\t\t{\n\t\t\tif (a[i + 1] == 'n'&&a[i + 2] == 'n')\n\t\t\t{\n\t\t\t\tsum += 1;i += 2;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'N')\n\t\t{\n\t\t\tif (a[i + 1] == 'i'&&a[i + 2] == 'k'&&a[i + 3] == 'i'&&a[i + 4] == 't'&&a[i + 5] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 5;\n\t\t\t}\n\t\t}\n\t}\n\tif (sum == 1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n char Danil[5]=\"Danil\";\n char Olya[4]=\"Olya\";\n char Slava[5]=\"Slava\";\n char Ann[3]=\"Ann\";\n char Nikita[6]=\"Nikita\";\n int nDanil=0, nOlya=0, nSlava=0, nAnn=0, nNikita=0, i;\n char let[100];\n scanf(\"%s\", &let);\n\n for(i=0; i<100; i++)\n {\n if (let[i]=='D')\n {\n if (let[i+1]=='a')\n {\n if (let[i+2]=='n')\n {\n if (let[i+3]=='i')\n {\n if (let[i+4]=='l')\n {\n nDanil++;\n }\n }\n }\n }\n }\n\n if (let[i]=='O')\n {\n if (let[i+1]=='l')\n {\n if (let[i+2]=='y')\n {\n if (let[i+3]=='a')\n {\n nOlya++;\n }\n }\n }\n }\n\n if (let[i]=='S')\n {\n if (let[i+1]=='l')\n {\n if (let[i+2]=='a')\n {\n if (let[i+3]=='v')\n {\n if (let[i+4]=='a')\n {\n nSlava++;\n }\n }\n }\n }\n }\n\n if (let[i]=='A')\n {\n if (let[i+1]=='n')\n {\n if (let[i+2]=='n')\n {\n nAnn++;\n }\n }\n }\n\n if (let[i]=='N')\n {\n if (let[i+1]=='i')\n {\n if (let[i+2]=='k')\n {\n if (let[i+3]=='i')\n {\n if (let[i+4]=='t')\n {\n if (let[i+5]=='a')\n {\n nNikita++;\n }\n }\n }\n }\n }\n }\n }\n if(nDanil+nOlya+nSlava+nAnn+nNikita==1)\n {\n printf(\"YES\");\n }else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar x[100],flag=1;\n\tint i, n, count = 0;\n\tgets(x);\n\t\tfor (i = 0; x[i] != '\\0'; i++)\n\t\t{\n\t\t\tif (count > 1)\n\t\t\t{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (x[i] == 'D' && x[i + 1] == 'a' && x[i + 2] == 'n' && x[i + 3] == 'i'&&x[i+4]=='l')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\ti = i + 4;\n\t\t\t}\n\t\t\telse if (x[i] == 'O' && x[i + 1] == 'l' && x[i + 2] == 'y' && x[i + 3] == 'a')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\ti = i + 3;\n\t\t\t}\n\t\t\telse if (x[i] == 'S' && x[i + 1] == 'l' && x[i + 2] == 'a' && x[i + 3] == 'v' && x[i + 4] == 'a')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\ti = i + 4;\n\t\t\t}\n\t\t\telse if (x[i] == 'A' && x[i + 1] == 'n' && x[i + 2] == 'n')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\ti = i + 2;\n\t\t\t}\n\t\t\telse if (x[i] == 'N' && x[i + 1] == 'i' && x[i + 2] == 'k' && x[i + 3] == 'i' && x[i + 4] == 't' && x[i + 5] == 'a')\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\ti = i + 5;\n\t\t\t}\n\t\t}\n\t\tif (flag==1&&count==1)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100],u[5]=\"Slava\",w[5]=\"Danil\",x[4]=\"Olya\",y[3]=\"Ann\",z[6]=\"Nikita\";\n int i,j,k,ln;\n gets(a);\n ln=strlen(a);\n k=0;\n for(i=0,j=0;i<ln;i++)\n {\n if( (a[i]==u[j] && a[i+1]==u[j+1] && a[i+2]==u[j+2] && a[i+3]==u[j+3] && a[i+4]==u[j+4])||(a[i]==w[j] && a[i+1]==w[j+1] && a[i+2]==w[j+2] && a[i+3]==w[j+3] && a[i+4]==w[j+4]) || (a[i]==x[j] && a[i+1]==x[j+1] && a[i+2]==x[j+2] && a[i+3]==x[j+3]) || (a[i]==y[j] && a[i+1]==y[j+1] && a[i+2]==y[j+2]) || (a[i]==z[j] && a[i+1]==z[j+1] && a[i+2]==z[j+2] && a[i+3]==z[j+3] && a[i+4]==z[j+4] && a[i+5]==z[j+5]) )\n {\n k++;\n }\n }\n if(k==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,i,m=0;\n char s[101];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'&&s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n m++;\n\n }\n else if(s[i]=='O'&&s[i+1]=='l'&&s[i+2]=='y'&&s[i+3]=='a'){\n m++;\n\n }\n else if(s[i]=='S'&&s[i+1]=='l'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n m++;\n }\n else if(s[i]=='A'&&s[i+1]=='n'&&s[i+2]=='n'){\n m++;\n }\n else if(s[i]=='N'&&s[i+1]=='i'&&s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+5]=='a'){\n m++;\n }\n\n }\n if(m==1){\n printf(\"YES\\n\");\n\n }\n else{\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i<L;i++){\n if(A[i]=='A'){\n if(A[i+1]=='n' && A[i+2]=='n'){\n Stack++;\n }\n }\n else if(A[i]=='D'){\n if(A[i+1]=='a' && A[i+2]=='n' && A[i+3]== 'i' && A[i+4] == 'l'){\n Stack++;\n }\n }\n else if(A[i]=='O'){\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n else if(A[i]=='S'){\n if(A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4] == 'a'){\n Stack++;\n }\n }\n else if(A[i]=='N'){\n if(A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4] == 't' && A[i+5]=='a'){\n Stack++;\n }\n }\n }\n if(Stack>1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main(void) {\n\t\n\tchar c[101];\n\tscanf(\"%s \",c);\n\t\n\tint l = (int)strlen(c),i,d=0;\n\tfor(i=0;i<l-2;i++){\n\t if(c[i]=='D' && c[i+1]=='a' && c[i+2]=='n' && c[i+3]=='i' && c[i+4]=='l')d++;\n\t if(c[i]=='N' && c[i+1]=='i' && c[i+2]=='k' && c[i+3]=='i' && c[i+4]=='t' && c[i+5]=='a')d++;\n\t if(c[i]=='O' && c[i+1]=='l' && c[i+2]=='y' && c[i+3]=='a')d++;\n\t if(c[i]=='S' && c[i+1]=='l' && c[i+2]=='a' && c[i+3]=='v' && c[i+4]=='a')d++;\n\t if(c[i]=='A' && c[i+1]=='n' && c[i+2]=='n')d++;\n\t}\n\tif(d==1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n char str[101];\n int count=0;\n gets(str);\n if (strstr(str,\"Nikita\")) ++count;\n if (strstr(str,\"Danil\")) ++count;\n if (strstr(str,\"Olya\")) ++count;\n if (strstr(str,\"Slava\")) ++count;\n if (strstr(str,\"Ann\")) ++count;\n if ((strstr(str,\"Nikita\") && (strstr(strstr(str,\"Nikita\")+1,\"Nikita\"))) ||\n ((strstr(str,\"Danil\")) && (strstr(strstr(str,\"Danil\")+1,\"Danil\"))) ||\n ((strstr(str,\"Olya\")) && (strstr(strstr(str,\"Olya\")+1,\"Olya\"))) ||\n ((strstr(str,\"Ann\")) && (strstr(strstr(str,\"Ann\")+1,\"Ann\"))) ||\n ((strstr(str,\"Slava\")) && (strstr(strstr(str,\"Slava\")+1,\"Slava\")))){\n printf(\"NO\");\n return 0;\n }\n if (count==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a, b = 0, c, i, j;\n char s[101];\n scanf(\"%s\", s);\n a = strlen(s);\n\n for(i=0; i<a ; i++)\n {\n if(s[i] == 'A' && s[i+1] == 'n' && s[i+2] == 'n')//Alex_and_broken_contest\n {\n b = b + 1;\n }\n if(s[i] == 'S' && s[i+1] == 'l' && s[i+2] == 'a' && s[i+3] == 'v' && s[i+4] == 'a')\n {\n b = b + 1;\n }\n if(s[i] == 'N' && s[i+1] == 'i' && s[i+2] == 'k' && s[i+3] == 'i' && s[i+4] == 't' && s[i+5] == 'a')\n {\n b = b + 1;\n }\n if(s[i] == 'O' && s[i+1] == 'l' && s[i+2] == 'y' && s[i+3] == 'a')\n {\n b = b + 1;\n }\n if(s[i] == 'D' && s[i+1] == 'a' && s[i+2] == 'n' && s[i+3] == 'i' && s[i+4] == 'l')\n {\n b = b + 1;\n }\n }\n if(b == 1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main(void)\n{\n int i,j,k,n,c=0;\n char str[101],s1[]= \"Danil\",s2[]=\"Olya\",s3[]=\"Slava\",s4[]=\"Ann\",s5[]=\"Nikita\";\n scanf(\"%s\",str);\n for(i=0;i<strlen(str);i++)\n {\n if(c>=2) {\n printf(\"NO\\n\");\n return 0;\n }\n for(k=0,j=i;s1[k]!=0;j++,k++)\n if(str[j]!=s1[k]) break;\n if(k==strlen(s1)) c++;\n\n for(k=0,j=i;s2[k]!=0;j++,k++)\n if(str[j]!=s2[k]) break;\n if(k==strlen(s2)) c++;\n\n for(k=0,j=i;s3[k]!=0;j++,k++)\n if(str[j]!=s3[k]) break;\n if(k==strlen(s3)) c++;\n\n for(k=0,j=i;s4[k]!=0;j++,k++)\n if(str[j]!=s4[k]) break;\n if(k==strlen(s4)) c++;\n\n for(k=0,j=i;s5[k]!=0;j++,k++)\n if(str[j]!=s5[k]) break;\n if(k==strlen(s5)) c++;\n }\n if(c==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint wfind(char c[], int i, char d[])\n{\n int f, j;\n for(j=0; ; j++)\n {\n if(d[j]=='\\0')\n {\n f=1;\n break;\n }\n if(c[i+j]!=d[j])\n {\n f=0;\n break;\n }\n }\n return f;\n}\nint main()\n{\n int i, a=0 ,b=0,c=0,d=0,e=0,f ,x;\n char w[101];\n fgets(w, 101, stdin);\n for(i=0; w[i]!='\\0' ; i++)\n {\n f=wfind(w, i, \"Danil\");\n a+=f;\n f=wfind(w, i, \"Olya\");\n b+=f;\n f=wfind(w, i, \"Slava\");\n c+=f;\n f=wfind(w, i, \"Ann\");\n d+=f;\n f=wfind(w, i, \"Nikita\");\n e+=f;\n }\n x=a+b+c+d+e;\n if(x==1)\n puts(\"Yes\");\n else\n puts(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n int z,i,a=0;\n scanf(\"%s\",str);\n z=strlen(str);\n for(i=0;i<z;i++){\n if(str[i]=='D' && str[i+1]=='a' && str[i+2]=='n' && str[i+3]=='i' && str[i+4]=='l'){\n a++;\n }\n if(str[i]=='O' && str[i+1]=='l' && str[i+2]=='y' && str[i+3]=='a' ){\n a++;\n }\n if(str[i]=='S' && str[i+1]=='l' && str[i+2]=='a' && str[i+3]=='v' && str[i+4]=='a'){\n a++;\n }\n if(str[i]=='A' && str[i+1]=='n' && str[i+2]=='n'){\n a++;\n }\n if(str[i]=='N' && str[i+1]=='i' && str[i+2]=='k' && str[i+3]=='i' && str[i+4]=='t' && str[i+5]=='a'){\n a++;\n }\n }\n if(a==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n/*int cmp(const void *a, const void *b)\n{\n return(*(int *)a-*(int *)b);\n}*/\n// qsort(a,n,sizeof(a[0]),cmp);\n\n\nint main()\n{\n char s[108];\n int i,sum = 0;\n gets(s);\n for(i = 0; i < strlen(s); i++)\n {\n if((s[i] == 'D' && s[i+1] == 'a' && s[i+2] == 'n' && s[i+3] == 'i' && s[i+4] == 'l') ||\n (s[i] == 'O' && s[i+1] == 'l' && s[i+2] == 'y' && s[i+3] == 'a') ||\n (s[i] == 'S' && s[i+1] == 'l' && s[i+2] == 'a' && s[i+3] == 'v' && s[i+4] == 'a') ||\n (s[i] == 'A' && s[i+1] == 'n' && s[i+2] == 'n') ||\n (s[i] == 'N' && s[i+1] == 'i' && s[i+2] == 'k' && s[i+3] == 'i' && s[i+4] == 't' && s[i+5] == 'a'))\n {\n sum++;\n }\n }\n if(sum == 1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nvoid prefix_table(char pattern[],int prefix[], int n)\n{\n\tprefix[0] = 0;\n\tint len = 0;\n\tint i = 1;\n\twhile (i < n)\n\t{\n\t\tif (pattern[len] == pattern[i])\n\t\t{\n\t\t\tlen++;\n\t\t\tprefix[i] = len;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (len > 0)\n\t\t\t{\n\t\t\t\tlen = prefix[len - 1];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprefix[i] = 0;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid move_prefix_table(int prefix[], int n)\n{\n\tfor (int i = n - 1; i > 0; i--)\n\t{\n\t\tprefix[i] = prefix[i - 1];\n\t}\n\tprefix[0] = -1;\n}\n\nint kmp_search(char text[], char pattern[])\n{\n\tint n = strlen(pattern);\n\tint m = strlen(text);\n\tint prefix[15];\n\tprefix_table(pattern, prefix, n);\n\tmove_prefix_table(prefix, n);\n\n\tint count = 0;\n\tint i = 0;\n\tint j = 0;\n\twhile (i < m)\n\t{\n\t\tif (j == n - 1 && pattern[j] == text[i])\n\t\t{\n\t\t\tj = prefix[j];\n\t\t\tcount++;\n\t\t}\n\t\tif (text[i] == pattern[j])\n\t\t{\n\t\t\ti++;\n\t\t\tj++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tj = prefix[j];\n\t\t\tif (j == -1)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\t}\n\treturn count;\n}\n\nint main()\n{\n\tint sum = 0;\n\tchar text[105];\n\n\tgets(text);\n\n\tchar pattern1[] = \"Danil\";\n\tchar pattern2[] = \"Olya\";\n\tchar pattern3[] = \"Slava\";\n\tchar pattern4[] = \"Ann\";\n\tchar pattern5[] = \"Nikita\";\n\n\tsum += kmp_search(text, pattern1);\n\tsum += kmp_search(text, pattern2);\n\tsum += kmp_search(text, pattern3);\n\tsum += kmp_search(text, pattern4);\n\tsum += kmp_search(text, pattern5);\n\n\tif (sum == 1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint subCount(char str[], char sub[]);\n\nint main()\n{\n\tchar str[101];\n\tint nameCount=0;\n\t\n\tscanf(\" %s\", str);\n\t\n\tnameCount+=subCount(str, \"Danil\");\n\tnameCount+=subCount(str, \"Olya\");\n\tnameCount+=subCount(str, \"Slava\");\n\tnameCount+=subCount(str, \"Ann\");\n\tnameCount+=subCount(str, \"Nikita\");\n\n\tif(nameCount==1) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n}\n\nint subCount(char str[], char sub[])\n{\n\tint i, j, flag, count=0;\n\t\n\tfor(i=0; str[i]!='\\0'; i++)\n\t{\n\t\tflag=1;\n\t\tfor(j=0; sub[j]!='\\0'; j++)\n\t\t{\n\t\t\tif(str[j+i]!=sub[j])\n\t\t\t\tflag=0;\n\t\t}\n\t\tif(flag) count++;\n\t}\t\n\treturn count;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,count=0,b;\n char n[100];\n gets(n);\n b=strlen(n);\n for(i=0;i<b;i++)\n {\n if(n[i]=='D'&&n[i+1]=='a'&&n[i+2]=='n'&&n[i+3]=='i'&&n[i+4]=='l')\n {\n count++;\n }\n else if (n[i]=='O'&&n[i+1]=='l'&&n[i+2]=='y'&&n[i+3]=='a')\n {\n count++;\n }\n else if(n[i]=='S'&&n[i+1]=='l'&&n[i+2]=='a'&&n[i+3]=='v'&&n[i+4]=='a')\n {\n count++;\n }\n else if(n[i]=='A'&&n[i+1]=='n'&&n[i+2]=='n')\n {\n count++;\n }\n else if (n[i]=='N'&&n[i+1]=='i'&&n[i+2]=='k'&&n[i+3]=='i'&&n[i+4]=='t'&&n[i+5]=='a')\n {\n count++;\n }\n }\n if(count==1)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char str[101];\n int cnt = 0;\n scanf(\"%s\", str);\n int len = strlen(str);\n for(int i = 0; i < 5; ++i) {\n char *p = str;\n while(1) {\n char *q = strstr(p, name[i]);\n if(q != NULL) {\n p = q + 1;\n ++cnt;\n } else {\n break;\n }\n if(p - str >= len) {\n break;\n }\n }\n }\n puts(cnt == 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for (i=0;i<l;i++)\n {\n if (s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n')\n {\n c++;\n\t\t}\n if(s[i]=='O'&& s[i+1]=='l'&& s[i+2]=='y'&& s[i+3]=='a')\n {\n c1++;\n }\n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&& s[i+3]=='i'&& s[i+4]=='l')\n {\n c2++;\n\t }\n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&& s[i+3]=='i'&& s[i+4]=='t'&& s[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&& s[i+3]=='v'&& s[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1) printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar ch[110];\nint i,j,k,l,c=0,c1=0,c2=0,c3=0,c4=0;\nscanf(\"%s\",ch);\nl=strlen(ch);\nfor (i=0;i<l;i++)\n{if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\nc++;\nif(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\nc1++;\nif(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\nc2++;\nif(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\nc3++;\nif(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\nc4++;\n}\nif (c+c1+c2+c3+c4==1)\nprintf(\"YES\\n\");\nelse\nprintf(\"NO\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int l,i,b = 0 ;\n char a[101];\n scanf(\"%s\",a);\n l = strlen(a);\n for(i=0; i<l;i++){\n if(a[i] == 'D'){\n if(a[i+1] == 'a'){\n if(a[i+2] == 'n'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='l'){\n b++;\n }\n }\n }\n }\n }\n if(a[i] == 'O'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'y'){\n if(a[i+3] == 'a'){\n b++;\n }\n }\n }\n }\n if(a[i] == 'S'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'a'){\n if(a[i+3] == 'v'){\n if(a[i+4]=='a'){\n b++;\n }\n }\n }\n }\n }\n if(a[i] == 'A'){\n if(a[i+1] == 'n'){\n if(a[i+2] == 'n'){\n b++;\n }\n }\n }\n if(a[i] == 'N'){\n if(a[i+1] == 'i'){\n if(a[i+2] == 'k'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='t'){\n if(a[i+5]=='a'){\n b++;\n }\n }\n }\n }\n }\n }\n }\n if(b == 1){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100];\n\tgets(a);\n\tint sum = 0, i;\n\tint len = strlen(a);\n\tfor (i = 0; i < len; i++)\n\t{\n\t\tif (a[i] == 'D' && a[i + 1] == 'a' && a[i + 2] == 'n' && a[i + 3] == 'i' && a[i + 4] == 'l')\n\t\t\tsum++;\n\t\tif (a[i] == 'O' && a[i + 1] == 'l' && a[i + 2] == 'y' && a[i + 3] == 'a')\n\t\t\tsum++;\n\t\tif (a[i] == 'S' && a[i + 1] == 'l' && a[i + 2] == 'a' && a[i + 3] == 'v' && a[i + 4] == 'a')\n\t\t\tsum++;\n\t\tif (a[i] == 'A' && a[i + 1] == 'n' && a[i + 2] == 'n')\n\t\t\tsum++;\n\t\tif (a[i] == 'N' && a[i + 1] == 'i' && a[i + 2] == 'k' && a[i + 3] == 'i' && a[i + 4] == 't' && a[i + 5] == 'a')\n\t\t\tsum++;\n\t}\n\tif (sum == 1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n char a[200];\n int b=0,ck=0,ck1=0,ck2=0,ck3=0,ck4=0,l,i;\n gets(a);\n l=strlen(a);\n for(i=0;i<=l;i++){\n if(a[i]=='D'&&a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]=='i'&&a[i+4]=='l'){\n ck++;\n }\n if(a[i]=='O'&&a[i+1]=='l'&&a[i+2]=='y'&&a[i+3]=='a'){\n ck1++;\n }\n\n if(a[i]=='S'&&a[i+1]=='l'&&a[i+2]=='a'&&a[i+3]=='v'&&a[i+4]=='a'){\n ck2++;\n }\n if(a[i]=='A'&&a[i+1]=='n'&&a[i+2]=='n'){\n ck3++;\n }\n if(a[i]=='N'&&a[i+1]=='i'&&a[i+2]=='k'&&a[i+3]=='i'&&a[i+4]=='t'&&a[i+5]=='a'){\n ck4++;\n }\n }\n // printf(\"%d\",b);\n b=ck+ck1+ck2+ck3+ck4;\n if(b==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\nreturn 0;\n }\n//http://codeforces.com/problemset/problem/877/A\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char s[105];\n int c=0,i;\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++){\n if(s[i]=='D'){\n if(s[i+1]=='a'){\n if(s[i+2]=='n'){\n if(s[i+3]=='i'){\n if(s[i+4]=='l'){\n c++;\n }\n }\n }\n }\n }\n else if(s[i]=='S'){\n if(s[i+1]=='l'){\n if(s[i+2]=='a'){\n if(s[i+3]=='v'){\n if(s[i+4]=='a'){\n c++;\n }\n }\n }\n }\n }\n else if(s[i]=='A'){\n if(s[i+1]=='n'){\n if(s[i+2]=='n'){\n c++;\n }\n }\n }\n else if(s[i]=='O'){\n if(s[i+1]=='l'){\n if(s[i+2]=='y'){\n if(s[i+3]=='a'){\n c++;\n }\n }\n }\n }\n else if(s[i]=='N'){\n if(s[i+1]=='i'){\n if(s[i+2]=='k'){\n if(s[i+3]=='i'){\n if(s[i+4]=='t'){\n if(s[i+5]=='a'){\n c++;\n }\n }\n }\n }\n }\n }\n\n }\n if(c==1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[100];\n int i,c=0;\n scanf(\"%s\",&s);\n int x=strlen(s);\n if (x>=5) {\n for (i=0;i<=(x);i++)\n {\n if((s[i]=='D')&&(s[i+1]=='a')&&(s[i+2]=='n')&&(s[i+3]=='i')&&(s[i+4]=='l'))\n {\n c++;\n }\n if ((s[i]=='S')&&(s[i+1]=='l')&&(s[i+2]=='a')&&(s[i+3]=='v')&&(s[i+4]=='a'))\n {\n c++;\n }\n }\n }\n if (x>=3)\n {\n for (i=0;i<=x;i++)\n {\n if ((s[i]=='A')&&(s[i+1]=='n')&&(s[i+2]=='n'))\n {\n c++;\n }\n }\n }\n if (x>=6)\n {\n for (i=0;i<=(x);i++)\n {\n if ((s[i]=='N')&&(s[i+1]=='i')&&(s[i+2]=='k')&&(s[i+3]=='i')&&(s[i+4]=='t')&&(s[i+5]=='a'))\n {\n c++;\n }\n }\n }\n if(x>=4)\n {for (i=0;i<=(x);i++)\n {\n if ((s[i]=='O')&&(s[i+1]=='l')&&(s[i+2]=='y')&&(s[i+3]=='a'))\n {\n c++;\n }\n }\n }\n if (c==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i, c = 0;\n char str[101];\n scanf(\"%s\", str);\n if (strlen(str) < 3) {\n printf (\"No\\n\");\n return 0;\n }\n for (i = 0; i < strlen(str) - 2; i++) {\n if (str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n c++;\n else if (str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n c++;\n if (str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n c++;\n if (str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n c++;\n if (str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n c++;\n }\n if (c == 1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint StringFind(const char *pSrc, const char *pDst) \n{ \n int i, j;\n int num = 0;\n for (i=0; pSrc[i]!='\\0'; i++) \n { \n if(pSrc[i]!=pDst[0]) \n continue; \n j = 0; \n while((pDst[j]==pSrc[i+j])&&(pDst[j]!='\\0')&&(pSrc[i+j]!='\\0')) \n { \n j++; \n } \n if(j==strlen(pDst)) \n {\n num++;\n i += j-1;\n }\n }\n if(num>0)\n return num;\n else\n return 0; \n}\n\nint main()\n{\n char s[100];\n while(scanf(\"%s\",&s)!=EOF)\n {\n int result = 0;\n result += StringFind(s,\"Danil\");\n result += StringFind(s,\"Olya\");\n result += StringFind(s,\"Slava\");\n result += StringFind(s,\"Nikita\");\n result += StringFind(s,\"Ann\");\n if(result==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[110];\n int i,j=0,cont=0;\n scanf(\"%s\",str);\n for(i=0; str[i]!='\\0'; i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n cont++;\n else if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n cont++;\n else if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n cont++;\n else if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n cont++;\n else if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n cont++;\n }\n if(cont==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int len,i,j;\n char s[1000];\n\n gets(s);\n len= strlen(s);\n j=0;\n for(i=0;i<len;i++)\n {\n if(s[i]=='D' && s[i+1]=='a' && s[i+2]=='n' &&s[i+3] =='i' && s[i+4]=='l')\n {\n j++;\n }\n else if(s[i]=='O' && s[i+1]=='l' && s[i+2]=='y' &&s[i+3] =='a' )\n {\n j++;\n }\n else if(s[i]=='S' && s[i+1]=='l' && s[i+2]=='a' &&s[i+3] =='v' && s[i+4]=='a')\n {\n j++;\n }\n else if(s[i]=='A' && s[i+1]=='n' && s[i+2]=='n')\n {\n j++;\n }\n else if(s[i]=='N' && s[i+1]=='i' && s[i+2]=='k' &&s[i+3] =='i' && s[i+4]=='t' && s[i+5]=='a')\n {\n j++;\n }\n }\n if(j==1)\n {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint checkD(char *n, int l, int i)\n{\n\tif(n[i+1]=='a' && n[i+2]=='n' && n[i+3]=='i' && n[i+4]=='l')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkO(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='y' && n[i+3]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkS(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='a' && n[i+3]=='v' && n[i+4]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkA(char *n, int l, int i)\n{\n\tif(n[i+1]=='n' && n[i+2]=='n')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkN(char *n, int l, int i)\n{\n\tif(n[i+1]=='i' && n[i+2]=='k' && n[i+3]=='i' && n[i+4]=='t'&& n[i+5]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\n\nint main() \n{\n\tchar n[99999];\n\t\n\tint l=0,i,x=0,count=0;\n\t\n\tgets(n);\n\t\n\twhile(n[l]) l++;\n\t\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(n[i]=='D')\n\t\t{\n\t\t\tx=checkD(n,l,i);\n\t\t\tif(x==1) count++;\n\t\t}\n\t\telse if(n[i]=='O')\n\t\t{\n\t\t\tx=checkO(n,l,i);\n\t\t\tif(x==1) count++;\n\t\t}\n\t\telse if(n[i]=='S')\n\t\t{\n\t\t\tx=checkS(n,l,i);\n\t\t\tif(x==1) count++;\n\t\t}\n\t\telse if(n[i]=='A')\n\t\t{\n\t\t\tx=checkA(n,l,i);\n\t\t\tif(x==1) count++;\n\t\t}\n\t\telse if(n[i]=='N')\n\t\t{\n\t\t\tx=checkN(n,l,i);\n\t\t\tif(x==1) count++;\n\t\t}\n\t\t/*if(x==1)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcontinue;\n\t\t}*/\n\t}\n\tif(count==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint find_word(char s[],char name[]){\n\tint slen,nlen,i,j,count=0;\n\tslen=strlen(s);\n\tnlen=strlen(name);\n\tfor(i=0;i<slen;i++)\n\t{\n\t\t\tfor(j=0;j<nlen;j++)\n\t\t\t{\n\t\t\t\tif(s[i+j]!=name[j])\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(j==nlen)\n\t\t\tcount++;\n\t}\n\treturn count;\n}\n\nint main(void) {\n\tchar s[1000];\n\tint count=0;\n\tscanf(\"%s\",s);\n\tcount+=find_word(s,\"Danil\");\n\tcount+=find_word(s,\"Olya\");\n\tcount+=find_word(s,\"Slava\");\n\tcount+=find_word(s,\"Ann\");\n\tcount+=find_word(s,\"Nikita\");\n\tif(count==1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[100];\n\tgets(a);\n\tint sum = 0, i;\n\tint len = strlen(a);\n\tfor (i = 0; i < len; i++)\n\t{\n\t\tif (a[i] == 'D' && a[i + 1] == 'a' && a[i + 2] == 'n' && a[i + 3] == 'i' && a[i + 4] == 'l')\n\t\t\tsum++;\n\t\tif (a[i] == 'O' && a[i + 1] == 'l' && a[i + 2] == 'y' && a[i + 3] == 'a')\n\t\t\tsum++;\n\t\tif (a[i] == 'S' && a[i + 1] == 'l' && a[i + 2] == 'a' && a[i + 3] == 'v' && a[i + 4] == 'a')\n\t\t\tsum++;\n\t\tif (a[i] == 'A' && a[i + 1] == 'n' && a[i + 2] == 'n')\n\t\t\tsum++;\n\t\tif (a[i] == 'N' && a[i + 1] == 'i' && a[i + 2] == 'k' && a[i + 3] == 'i' && a[i + 4] == 't' && a[i + 5] == 'a')\n\t\t\tsum++;\n\t}\n\tif (sum == 1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar *f[5]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\nint freq(char* str)\n{\n int i, c=0;\n for(i=0;i<5;i++)\n {\n char *x=str;\n while(x=strstr(x, f[i]))\n {\n c++;\n x+=strlen(f[i]);\n }\n }\n return c;\n}\nint main()\n{\n char str[100];\n scanf(\"%s\", str);\n if(freq(str)==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MaxNum 106\n#define Num 6\n\nint main()\n{\n char Name[MaxNum];\n int i,CNikita=0,CAnn=0,CSlava=0,COlya=0,CDanil=0,Sum;\n for(i=0;i<MaxNum;i++){\n Name[i]=0;\n }\n gets(Name);\n for(i=0;i<MaxNum;i++){\n if(Name[i]==0){\n break;\n }\n if(Name[i]=='A' && Name[i+1]=='n' && Name[i+2]=='n'){\n CAnn++;\n }\n if(Name[i]=='S' && Name[i+1]=='l' && Name[i+2]=='a'&& Name[i+3]=='v' && Name[i+4]=='a'){\n CSlava++;\n }\n if(Name[i]=='O' && Name[i+1]=='l' && Name[i+2]=='y' && Name[i+3]=='a'){\n COlya++;\n }\n if(Name[i]=='D' && Name[i+1]=='a' && Name[i+2]=='n'&& Name[i+3]=='i' && Name[i+4]=='l'){\n CDanil++;\n }\n if(Name[i]=='N' && Name[i+1]=='i' && Name[i+2]=='k'&& Name[i+3]=='i' && Name[i+4]=='t' && Name[i+5]=='a'){\n CNikita++;\n }\n\n }\n Sum=CNikita+CAnn+COlya+CDanil+CSlava;\n if(Sum==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n //printf(\"Nikita=%d Ann=%d Slava=%d Olya=%d Danil=%d \\n\",CNikita,CAnn,CSlava,COlya,CDanil);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar S[101];\nfor(i=0;i<101;i++){\nscanf(\" %c\",&S[i]);\n }\nfor(i=0;i<101;i++){\nif((S[i]=='O' && S[i+1]=='l' &&\nS[i+2]=='y' && S[i+3]=='a')||(S[i]=='D' && S[i+1]=='a' &&S[i+2]=='n' &&\nS[i+3]=='i'&&S[i+4]=='l')||\n(S[i]=='A' &&S[i+1]=='n' &&\nS[i+2]=='n')||\n(S[i]=='S'&&S[i+1]=='l' &&\nS[i+2]=='a'&&S[i+3]=='v'&&S[i+4]=='a')||\n(S[i]=='N'&&S[i+1]=='i' &&\nS[i+2]=='k'&&S[i+3]=='i'&&S[i+4]=='t'&&S[i+5]=='a'))\n{count++;}}\nif(count==1){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tchar a[110];\n\tgets(a);\n\tint length=strlen(a),flag=0,one=0,two=0,three=0,four=0,five=0,sum,i;\n\tfor( i=0;i<length;i++)\n\t{\n\t\tif(a[i]=='D')\n\t\t{\n\t\t\tif(a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]=='i'&&a[i+4]=='l')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tone++;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='O')\n\t\t{\n\t\t\tif(a[i+1]=='l'&&a[i+2]=='y'&&a[i+3]=='a')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\ttwo++;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='S')\n\t\t{\n\t\t\tif(a[i+1]=='l'&&a[i+2]=='a'&&a[i+3]=='v'&&a[i+4]=='a') \n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tthree++;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='A')\n\t\t{\n\t\t\tif(a[i+1]=='n'&&a[i+2]=='n') \n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tfour++;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='N')\n\t\t{\n\t\t\tif(a[i+1]=='i'&&a[i+2]=='k'&&a[i+3]=='i'&&a[i+4]=='t'&&a[i+5]=='a')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tfive++;\n\t\t\t}\n\t\t}\n\t}\n\tsum=one+two+three+four+five;\n\tif(flag==1&&sum==1)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n int i,j,k,len,len1,len2,len3,len4,len5,x,cnt=0,c=0;\n char a[100],a1[20]=\"Danil\",a2[20]=\"Olya\",a3[20]=\"Slava\",a4[20]=\"Ann\",a5[20]=\"Nikita\";\n scanf(\"%s\",a);\n len=strlen(a);\n len1=strlen(a1);\n len2=strlen(a2);\n len3=strlen(a3);\n len4=strlen(a4);\n len5=strlen(a5);\n for(i=0;i<len;i++)\n {\n\n if(a[i]==a1[0])\n { cnt=0;\n for(j=0,k=i;j<len1;j++,k++)\n {\n if(a[k]==a1[j])\n {\n cnt++;\n }\n }\n if(cnt==len1)\n {\n c++;\n }\n\n }\n if(a[i]==a2[0])\n { cnt=0;\n for(j=0,k=i;j<len2;j++,k++)\n {\n if(a[k]==a2[j])\n {\n cnt++;\n }\n }\n if(cnt==len2)\n {\n c++;\n }\n\n }\n if(a[i]==a3[0])\n { cnt=0;\n for(j=0,k=i;j<len3;j++,k++)\n {\n if(a[k]==a3[j])\n {\n cnt++;\n }\n }\n if(cnt==len3)\n {\n c++;\n }\n\n }\n if(a[i]==a4[0])\n { cnt=0;\n for(j=0,k=i;j<len4;j++,k++)\n {\n if(a[k]==a4[j])\n {\n cnt++;\n }\n }\n if(cnt==len4)\n {\n c++;\n }\n\n }\n if(a[i]==a5[0])\n { cnt=0;\n for(j=0,k=i;j<len5;j++,k++)\n {\n if(a[k]==a5[j])\n {\n cnt++;\n }\n }\n if(cnt==len5)\n {\n c++;\n }\n\n }\n }\n if(c==1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n,count=0,i,l;\n char s[100000];\n scanf(\" %[^\\n]\",s);\n l= strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='D'){\n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&&s[i+3]=='i'&& s[i+4]=='l'){\n count++;\n }\n }\n if(s[i]=='O'){\n if(s[i]=='O'&& s[i+1]=='l'&& s[i+2]=='y'&&s[i+3]=='a'){\n count++;\n }\n }\n if(s[i]=='S'){\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&&s[i+3]=='v'&& s[i+4]=='a'){\n count++;\n }\n }\n if(s[i]=='A'){\n if(s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n'){\n count++;\n }\n }\n if(s[i]=='N'){\n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&&s[i+3]=='i'&& s[i+4]=='t' && s[i+5]=='a'){\n count++;\n }\n }\n }\n if(count==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char string[110];\n while(scanf(\"%s\",string)==1)\n {\n char Danil[]=\"Danil\",Olya[]=\"Olya\", Slava[]=\"Slava\", Ann[]=\"Ann\" , Nikita[]=\"Nikita\";\n int i,j,count=0,index=0,result=0;\n for(i=0;string[i]!='\\0';i++)\n {\n j=i;\n index=0;\n char test[10]={0};\n for(;j<i+3;j++)test[index++]=string[j];\n if(strcmp(test,Ann)==0)\n {\n result++;\n continue;\n }\n test[index++]=string[j++];\n if(strcmp(test,Olya)==0)\n {\n result++;\n continue;\n }\n test[index++]=string[j++];\n if(strcmp(Danil,test)==0 || strcmp(Slava,test)==0)\n {\n result++;\n continue;\n }\n test[index++]=string[j++];\n if(strcmp(test,Nikita)==0)\n {\n result++;\n continue;\n }\n }\n if(result==1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[16]=\"Danil\";\n\tchar b[15]=\"Olya\";\n\tchar c[16]=\"Slava\";\n\tchar d[14]=\"Ann\";\n\tchar e[17]=\"Nikita\";\n\tint la=5,lb=4,lc=5,ld=3,le=6;\n\tchar s[103]={0};\n\tscanf(\"%s\",s);\n\tchar * u=NULL;\n\tchar * v=NULL;\n\tchar * w=NULL;\n\tchar * x=NULL;\n\tchar * y=NULL;\n\tchar * u1=NULL;\n\tchar * v1=NULL;\n\tchar * w1=NULL;\n\tchar * x1=NULL;\n\tchar * y1=NULL;\n\tu=strstr(s,a);\n\tv=strstr(s,b);\n\tw=strstr(s,c);\n\tx=strstr(s,d);\n\ty=strstr(s,e);\n\tif(u!=NULL)u1=strstr(u+1,a);\n\tif(v!=NULL)v1=strstr(v+1,b);\n\tif(w!=NULL)w1=strstr(w+1,c);\n\tif(x!=NULL)x1=strstr(x+1,d);\n\tif(y!=NULL)y1=strstr(y+1,e);\n\n\tint l=0,m=0,n=0,o=0,p=0;\n\tif(u!=NULL)l=1;\n\tif(v!=NULL)m=1;\n\tif(w!=NULL)n=1;\n\tif(x!=NULL)o=1;\n\tif(y!=NULL)p=1;\n\tif(u1!=NULL)l+=1;\n\tif(v1!=NULL)m+=1;\n\tif(w1!=NULL)n+=1;\n\tif(x1!=NULL)o+=1;\n\tif(y1!=NULL)p+=1;\n\n\tif(l+m+n+o+p==1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n/*int cmp(const void *a, const void *b)\n{\n return(*(int *)a-*(int *)b);\n}*/\n// qsort(a,n,sizeof(a[0]),cmp);\n\n\nint main()\n{\n char s[108];\n int i,sum = 0;\n gets(s);\n for(i = 0; i < strlen(s); i++)\n {\n if((s[i] == 'D' && s[i+1] == 'a' && s[i+2] == 'n' && s[i+3] == 'i' && s[i+4] == 'l') ||\n (s[i] == 'O' && s[i+1] == 'l' && s[i+2] == 'y' && s[i+3] == 'a') ||\n (s[i] == 'S' && s[i+1] == 'l' && s[i+2] == 'a' && s[i+3] == 'v' && s[i+4] == 'a') ||\n (s[i] == 'A' && s[i+1] == 'n' && s[i+2] == 'n') ||\n (s[i] == 'N' && s[i+1] == 'i' && s[i+2] == 'k' && s[i+3] == 'i' && s[i+4] == 't' && s[i+5] == 'a'))\n {\n sum++;\n }\n }\n if(sum == 1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n count++;\n if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n count++;\n if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n count++;\n if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n count++;\n if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n count++;\n }\n if(count==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar S[101];\nfor(i=0;i<101;i++){\nscanf(\" %c\",&S[i]);\n }\nfor(i=0;i<101;i++){\nif((S[i]=='O' && S[i+1]=='l' &&\nS[i+2]=='y' && S[i+3]=='a')||(S[i]=='D' && S[i+1]=='a' &&S[i+2]=='n' &&\nS[i+3]=='i'&&S[i+4]=='l')||\n(S[i]=='A' &&S[i+1]=='n' &&\nS[i+2]=='n')||\n(S[i]=='S'&&S[i+1]=='l' &&\nS[i+2]=='a'&&S[i+3]=='v'&&S[i+4]=='a')||\n(S[i]=='N'&&S[i+1]=='i' &&\nS[i+2]=='k'&&S[i+3]=='i'&&S[i+4]=='t'&&S[i+5]=='a'))\n{count++;}}\nif(count==1){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[105];\n gets(str);\n int i,count=0,len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n count++;\n if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n count++;\n if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n count++;\n if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n count++;\n if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n count++;\n }\n if(count==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i<L;i++){\n if(A[i]=='A'){\n if(A[i+1]=='n' && A[i+2]=='n'){\n Stack++;\n }\n }\n else if(A[i]=='D'){\n if(A[i+1]=='a' && A[i+2]=='n' && A[i+3]== 'i' && A[i+4] == 'l'){\n Stack++;\n }\n }\n else if(A[i]=='O'){\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n else if(A[i]=='S'){\n if(A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4] == 'a'){\n Stack++;\n }\n }\n else if(A[i]=='N'){\n if(A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4] == 't' && A[i+5]=='a'){\n Stack++;\n }\n }\n }\n if(Stack>1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[5][7];\n\tstrncpy(s[0], \"Danil\", sizeof(s[0]));\n\tstrncpy(s[1], \"Olya\", sizeof(s[1]));\n\tstrncpy(s[2], \"Slava\", sizeof(s[2]));\n\tstrncpy(s[3], \"Ann\", sizeof(s[3]));\n\tstrncpy(s[4], \"Nikita\", sizeof(s[4]));\n\tchar ques[101];\n\tscanf(\"%s\" ,ques);\n\tint i,j,k,M,N=strlen(ques),count=0;\n\tfor(i=0;i<5;i++)\n\t{\n\t\tM=strlen(s[i]);\n\t\tfor(j=0;j<N-M+1;j++)\n\t\t{\n\t\t\tk=j;\n\t\t\twhile(k<j+M)\n\t\t\t{\n\t\t\t\tif(s[i][k-j]==ques[k])\n\t\t\t\t{\n\t\t\t\t\tk++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(k==j+M)\n\t\t\t\tcount++;\n\t\t}\n\t}\n\tif(count==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n int z,i,a=0;\n scanf(\"%s\",str);\n z=strlen(str);\n for(i=0;i<z;i++){\n if(str[i]=='D' && str[i+1]=='a' && str[i+2]=='n' && str[i+3]=='i' && str[i+4]=='l'){\n a++;\n }\n if(str[i]=='O' && str[i+1]=='l' && str[i+2]=='y' && str[i+3]=='a' ){\n a++;\n }\n if(str[i]=='S' && str[i+1]=='l' && str[i+2]=='a' && str[i+3]=='v' && str[i+4]=='a'){\n a++;\n }\n if(str[i]=='A' && str[i+1]=='n' && str[i+2]=='n'){\n a++;\n }\n if(str[i]=='N' && str[i+1]=='i' && str[i+2]=='k' && str[i+3]=='i' && str[i+4]=='t' && str[i+5]=='a'){\n a++;\n }\n }\n if(a==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i, j,sum;\n\tchar a[100];\n\tgets(a);\n\tsum = 0;\n\tfor (i = 0;a[i] != '\\0';i++)\n\t{\n\t\tif (a[i] == 'D')\n\t\t{\n\t\t\tif (a[i + 1] == 'a'&&a[i + 2] == 'n'&&a[i + 3] == 'i'&&a[i + 4] == 'l')\n\t\t\t{\n\t\t\t\tsum += 1;i += 4;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'O')\n\t\t{\n\t\t\tif (a[i + 1] == 'l'&&a[i + 2] == 'y'&&a[i + 3] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 3;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'S')\n\t\t{\n\t\t\tif (a[i + 1] == 'l'&&a[i + 2] == 'a'&&a[i + 3] == 'v'&&a[i + 4] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 4;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'A')\n\t\t{\n\t\t\tif (a[i + 1] == 'n'&&a[i + 2] == 'n')\n\t\t\t{\n\t\t\t\tsum += 1;i += 2;\n\t\t\t}\n\t\t}\n\t\telse if (a[i] == 'N')\n\t\t{\n\t\t\tif (a[i + 1] == 'i'&&a[i + 2] == 'k'&&a[i + 3] == 'i'&&a[i + 4] == 't'&&a[i + 5] == 'a')\n\t\t\t{\n\t\t\t\tsum += 1;i += 5;\n\t\t\t}\n\t\t}\n\t}\n\tif (sum == 1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int name=0,i;\n char problem_name[100];\n scanf(\"%s\",problem_name);\n for(i=0;i<strlen(problem_name);i++)\n {\n if(problem_name[i]=='D' && i+4<strlen(problem_name))\n {\n if(problem_name[i+1]=='a' && problem_name[i+2]=='n' && problem_name[i+3]=='i' && problem_name[i+4]=='l' )\n {name++;\n i+=4;}\n }\n if(problem_name[i]=='O' && i+3<strlen(problem_name))\n {\n if(problem_name[i+1]=='l' && problem_name[i+2]=='y' && problem_name[i+3]=='a')\n {name++;\n i+=3;}\n }\n if(problem_name[i]=='S' && i+4<strlen(problem_name))\n {\n if(problem_name[i+1]=='l' && problem_name[i+2]=='a' && problem_name[i+3]=='v' && problem_name[i+4]=='a' )\n {name++;\n i+=4;}\n }\n if(problem_name[i]=='A' && i+2<strlen(problem_name))\n {\n if(problem_name[i+1]=='n' && problem_name[i+2]=='n')\n {name++;\n i+=2;}\n }\n if(problem_name[i]=='N' && i+5<strlen(problem_name))\n {\n if(problem_name[i+1]=='i' && problem_name[i+2]=='k' && problem_name[i+3]=='i' && problem_name[i+4]=='t' && problem_name[i+5]=='a' )\n {name++;\n i+=5;}\n }\n }\n if(name==1)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main (){\n int i,x,a,b;\n char str[110];\n scanf(\"%s\",&str);\n b=0;\n for(i=0;i<strlen(str);i++){\n if(str[i]=='D' && str[i+1]=='a' && str[i+2]=='n' && str[i+3]=='i' && str[i+4]=='l'){\n b++;\n }\n else if(str[i]=='S' && str[i+1]=='l' && str[i+2]=='a' && str[i+3]=='v' && str[i+4]=='a'){\n b++;\n }\n else if(str[i]=='O' && str[i+1]=='l' && str[i+2]=='y' && str[i+3]=='a'){\n b++;\n }\n else if(str[i]=='A' && str[i+1]=='n' && str[i+2]=='n'){\n b++;\n }\n else if(str[i]=='N' && str[i+1]=='i' && str[i+2]=='k' && str[i+3]=='i' && str[i+4]=='t' && str[i+5]=='a'){\n b++;\n }\n }\n if(b==1){\n printf(\"YES\\n\");\n }\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",ch);\n l=strlen(ch);\n for (i=0;i<l;i++)\n {\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n c++;\n\t\t}\n if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n c1++;\n }\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n c2++;\n\t }\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tchar a[100];\n\tscanf(\"%s\",&a);\n\tint f=0;\n\tfor(int i=0;i<strlen(a);i++){\n\t\tif(i<=strlen(a)-5){\n\t\tif(a[i]=='D'&&a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]=='i'&&a[i+4]=='l')\n\t {\n\t \tif(f==1)\n\t \t{\n\t \t\tf=0;\n\t \t\tbreak;\n\t\t\t}\n\t \tif(f==0)\n\t \tf=1;\n\t\t}\n\t}\nif(i<=strlen(a)-4){\n\t\tif(a[i]=='O'&&a[i+1]=='l'&&a[i+2]=='y'&&a[i+3]=='a')\n\t {\n\t \tif(f==1)\n\t \t{\n\t \t\tf=0;\n\t \t\tbreak;\n\t\t\t}\n\t \tif(f==0)\n\t \tf=1;\n\t\t}\n\t}\n\t\tif(i<=strlen(a)-5){\n\t\tif(a[i]=='S'&&a[i+1]=='l'&&a[i+2]=='a'&&a[i+3]=='v'&&a[i+4]=='a')\n\t {\n\t \tif(f==1)\n\t \t{\n\t \t\tf=0;\n\t \t\tbreak;\n\t\t\t}\n\t \tif(f==0)\n\t \tf=1;\n\t\t}\n\t}\n\t\tif(i<=strlen(a)-3){\n\t\tif(a[i]=='A'&&a[i+1]=='n'&&a[i+2]=='n')\n\t {\n\t \tif(f==1)\n\t \t{\n\t \t\tf=0;\n\t \t\tbreak;\n\t\t\t}\n\t \tif(f==0)\n\t \tf=1;\n\t\t}\n\t}\n\t\t\tif(i<=strlen(a)-6){\n\t\tif(a[i]=='N'&&a[i+1]=='i'&&a[i+2]=='k'&&a[i+3]=='i'&&a[i+4]=='t'&&a[i+5]=='a')\n\t {\n\t \tif(f==1)\n\t \t{\n\t \t\tf=0;\n\t \t\tbreak;\n\t\t\t}\n\t \tif(f==0)\n\t \tf=1;\n\t\t}\n\t}\n}\nif(f==1){\n\tprintf(\"YES\");\n}\nelse{\n\tprintf(\"NO\");\n}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main() \n{\n\tchar c[100];\n\tscanf(\"%s\",c);\n\tint l = strlen(c);\n\tint d=0;\n\tfor(int i=0;i<l-2;i++)\n\t{\n\t if(c[i]=='D' && c[i+1]=='a' && c[i+2]=='n' && c[i+3]=='i' && c[i+4]=='l')d++;\n\t if(c[i]=='O' && c[i+1]=='l' && c[i+2]=='y' && c[i+3]=='a')d++;\n\t if(c[i]=='S' && c[i+1]=='l' && c[i+2]=='a' && c[i+3]=='v' && c[i+4]=='a')d++;\n\t if(c[i]=='A' && c[i+1]=='n' && c[i+2]=='n')d++;\n\t if(c[i]=='N' && c[i+1]=='i' && c[i+2]=='k' && c[i+3]=='i' && c[i+4]=='t' && c[i+5]=='a')d++;\n\t}\n\tif(d==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n char Danil[5]=\"Danil\";\n char Olya[4]=\"Olya\";\n char Slava[5]=\"Slava\";\n char Ann[3]=\"Ann\";\n char Nikita[6]=\"Nikita\";\n int nDanil=0, nOlya=0, nSlava=0, nAnn=0, nNikita=0, i;\n char let[100];\n scanf(\"%s\", &let);\n\n for(i=0; i<100; i++)\n {\n if (let[i]=='D')\n {\n if (let[i+1]=='a')\n {\n if (let[i+2]=='n')\n {\n if (let[i+3]=='i')\n {\n if (let[i+4]=='l')\n {\n nDanil++;\n }\n }\n }\n }\n }\n\n if (let[i]=='O')\n {\n if (let[i+1]=='l')\n {\n if (let[i+2]=='y')\n {\n if (let[i+3]=='a')\n {\n nOlya++;\n }\n }\n }\n }\n\n if (let[i]=='S')\n {\n if (let[i+1]=='l')\n {\n if (let[i+2]=='a')\n {\n if (let[i+3]=='v')\n {\n if (let[i+4]=='a')\n {\n nSlava++;\n }\n }\n }\n }\n }\n\n if (let[i]=='A')\n {\n if (let[i+1]=='n')\n {\n if (let[i+2]=='n')\n {\n nAnn++;\n }\n }\n }\n\n if (let[i]=='N')\n {\n if (let[i+1]=='i')\n {\n if (let[i+2]=='k')\n {\n if (let[i+3]=='i')\n {\n if (let[i+4]=='t')\n {\n if (let[i+5]=='a')\n {\n nNikita++;\n }\n }\n }\n }\n }\n }\n }\n if(nDanil+nOlya+nSlava+nAnn+nNikita==1)\n {\n printf(\"YES\");\n }else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main( )\n{\n int count=0,i,j,l;\n char m[101];\n scanf(\"%[^\\n]\",m);\n l=strlen(m);\n char d[]={'D','a','n','i','l','\\0'};\n char a[]={'A','n','n','\\0'};\n char n[]={'N','i','k','i','t','a','\\0'};\n char o[]={'O','l','y','a','\\0'};\n char s[]={'S','l','a','v','a','\\0'};\n for(i=0;i<=l-5;i++)\n {\n for(j=0;j<5;j++)\n if(m[i+j]==d[j])\n continue;\n else\n break;\n if(j==5)\n count++;\n }\n for(i=0;i<=l-3;i++)\n {\n for(j=0;j<3;j++)\n if(m[i+j]==a[j])\n continue;\n else\n break;\n if(j==3)\n count++;\n }\n for(i=0;i<=l-6;i++)\n {\n for(j=0;j<6;j++)\n if(m[i+j]==n[j])\n continue;\n else\n break;\n if(j==6)\n count++;\n }\n for(i=0;i<=l-4;i++)\n {\n for(j=0;j<4;j++)\n if(m[i+j]==o[j])\n continue;\n else\n break;\n if(j==4)\n count++;\n }\n for(i=0;i<=l-5;i++)\n {\n for(j=0;j<5;j++)\n if(m[i+j]==s[j])\n continue;\n else\n break;\n if(j==5)\n count++;\n }\n if(count==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint substring(char a[], char sub[]) {\n\tint l1 = strlen(a);\n\tint l2 = strlen(sub);\n\tint ans = 0;\n\tfor (int i=0;i<=l1-l2;++i) {\n\t\tint k = 0;\n\t\tfor (int j=0;j<l2;++j) {\n\t\t\tif (a[k+i] == sub[j]) {\n\t\t\t\t++k;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (k==l2) {\n\t\t\t++ans;\n\t\t}\n\t}\n\treturn ans;\n}\n\nint main(void) {\n\tchar a[102];\n\tchar *f[] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n\tmemset(a, '\\0', 102*sizeof(char));\n\tscanf(\"%s\",a);\n\tint ct = 0;\n\tfor (int i=0;i<5;++i) {\n\t\tct += substring(a, f[i]);\n\t}\n\tif (ct == 1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i<L;i++){\n if(A[i]=='A'){\n if(A[i+1]=='n' && A[i+2]=='n'){\n Stack++;\n }\n }\n else if(A[i]=='D'){\n if(A[i+1]=='a' && A[i+2]=='n' && A[i+3]== 'i' && A[i+4] == 'l'){\n Stack++;\n }\n }\n else if(A[i]=='O'){\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n else if(A[i]=='S'){\n if(A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4] == 'a'){\n Stack++;\n }\n }\n else if(A[i]=='N'){\n if(A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4] == 't' && A[i+5]=='a'){\n Stack++;\n }\n }\n }\n if(Stack>1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\nchar string[101];\nscanf(\"%s\",string);\nint count =0;\nfor(int i =0 ;i<101;i++){\n if(string[i]!='\\0'){\n if(string[i]=='A'&&string[i+1]=='n'&&string[i+2]=='n'){\n count++;\n }\n if(string[i]=='S'&&string[i+1]=='l'&&string[i+2]=='a'&&string[i+3]=='v'&&string[i+4]=='a'){\n count++;\n\n }\n if(string[i]=='N'&&string[i+1]=='i'&&string[i+2]=='k'&&string[i+3]=='i'&&string[i+4]=='t'&&string[i+5]=='a'){\n count++;\n }\n if(string[i]=='O'&&string[i+1]=='l'&&string[i+2]=='y'&&string[i+3]=='a'){\n count++;\n }\n if(string[i]=='D'&&string[i+1]=='a'&&string[i+2]=='n'&&string[i+3]=='i'&&string[i+4]=='l'){\n count++;\n\n }\n }\n}\n\nif(count==1){\n printf(\"YES\");\n}else{\nprintf(\"NO\");\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for (i=0;i<l;i++)\n {\n if (s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n')\n c++;\n\t\t\n if(s[i]=='O'&& s[i+1]=='l'&& s[i+2]=='y'&& s[i+3]=='a')\n c1++;\n \n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&& s[i+3]=='i'&& s[i+4]=='l')\n c2++;\n\t \n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&& s[i+3]=='i'&& s[i+4]=='t'&& s[i+5]=='a')\n c3++;\n\t\t\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&& s[i+3]=='v'&& s[i+4]=='a')\n c4++;\n }\t\t\n\n\n if (c+c1+c2+c3+c4==1)\n {\n printf(\"YES\");\n }\n else\n { \n printf(\"NO\");\n\t }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n\tchar str[200];\n\tint cnt = 0;\n\tscanf(\"%s\", str);\n\t\n\tchar* p;\n\n\tp = str;\n\twhile ((p = strstr(p, \"Danil\")) != NULL) { cnt++; p++; }\n\tp = str;\n\twhile ((p = strstr(p, \"Olya\")) != NULL) { cnt++; p++; }\n\tp = str;\n\twhile ((p = strstr(p, \"Slava\")) != NULL) { cnt++; p++; }\n\tp = str;\n\twhile ((p = strstr(p, \"Ann\")) != NULL) { cnt++; p++; }\n\tp = str;\n\twhile ((p = strstr(p, \"Nikita\")) != NULL) { cnt++; p++; }\n\n\tif (cnt != 1) printf(\"NO\");\n\telse printf(\"YES\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[110];\n int i,j=0,cont=0;\n scanf(\"%s\",str);\n for(i=0; str[i]!='\\0'; i++)\n {\n if(str[i]=='D'&&str[i+1]=='a'&&str[i+2]=='n'&&str[i+3]=='i'&&str[i+4]=='l')\n cont++;\n else if(str[i]=='O'&&str[i+1]=='l'&&str[i+2]=='y'&&str[i+3]=='a')\n cont++;\n else if(str[i]=='S'&&str[i+1]=='l'&&str[i+2]=='a'&&str[i+3]=='v'&&str[i+4]=='a')\n cont++;\n else if(str[i]=='N'&&str[i+1]=='i'&&str[i+2]=='k'&&str[i+3]=='i'&&str[i+4]=='t'&&str[i+5]=='a')\n cont++;\n else if(str[i]=='A'&&str[i+1]=='n'&&str[i+2]=='n')\n cont++;\n }\n if(cont==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for (i=0;i<l;i++)\n {\n if (s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n')\n {\n c++;\n\t\t}\n if(s[i]=='O'&& s[i+1]=='l'&& s[i+2]=='y'&& s[i+3]=='a')\n {\n c1++;\n }\n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&& s[i+3]=='i'&& s[i+4]=='l')\n {\n c2++;\n\t }\n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&& s[i+3]=='i'&& s[i+4]=='t'&& s[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&& s[i+3]=='v'&& s[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1) printf(\"YES\");\n else printf(\"NO\");\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar S[101];\nfor(i=0;i<101;i++){\nscanf(\"%c\",&S[i]);\n }\nfor(i=0;i<101;i++){\nif((S[i]=='O' && S[i+1]=='l' &&\nS[i+2]=='y' && S[i+3]=='a')||(S[i]=='D' && S[i+1]=='a' &&S[i+2]=='n' &&\nS[i+3]=='i'&&S[i+4]=='l')||\n(S[i]=='A' &&S[i+1]=='n' &&\nS[i+2]=='n')||\n(S[i]=='S'&&S[i+1]=='l' &&\nS[i+2]=='a'&&S[i+3]=='v'&&S[i+4]=='a')||\n(S[i]=='N'&&S[i+1]=='i' &&\nS[i+2]=='k'&&S[i+3]=='i')||(S[i+4]=='t'&&S[i+5]=='a'))\n{count++;}}\nif(count==1){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n=0,ch,i,j,r=0;\n char word[5][7]={{\"Danil+\"},{\"Ann+\"},{\"Slava+\"},{\"Nikita+\"},{\"Olya+\"}};\n i=0;j=0;n=5;\n\n while((ch=getchar())!='\\n')\n {\n for(;i<n;i++)\n {\n if(word[i][j]=='+')\n {\n r++;\n i=0;j=0;\n break;\n\n }\n if(word[i][j]==ch)\n {\n j++;\n break;\n }\n\n }\n if(word[i][j-1]!=ch)\n {\n i=0;j=0;\n }\n }\n if(r==1)\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n char s [101];\n int c=0;\n scanf(\"%s\",s);\n if (strstr(s,\"Danil\")){\n c++;\n }\n if (strstr(s,\"Olya\")){\n c++;\n }\n if (strstr(s,\"Slava\")){\n c++;\n }\n if (strstr(s,\"Ann\")){\n c++;\n }\n if (strstr(s,\"Nikita\")){\n c++;\n }\n if (c==1){\n printf (\"YES\");\n }\n else {\n printf (\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nstrlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] = name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n char a[200];\n int b=0,ck=0,ck1=0,ck2=0,ck3=0,ck4=0;\n gets(a);\n if(strstr(a,\"Danil\")!=0){\n ck=1;\n }\n if(strstr(a,\"Olya\")!=0){\n ck1=1;\n }\n if(strstr(a,\"Slava\")!=0){\n ck2=1;\n }\n if(strstr(a,\"Ann\")!=0){\n ck3=1;\n }\n if(strstr(a,\"Nikita\")!=0){\n ck4=1;\n }\n // printf(\"%d\",b);\n b=ck+ck1+ck2+ck3+ck4;\n if(b==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\nreturn 0;\n }\n//http://codeforces.com/problemset/problem/877/A\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[110];\n int i,l,c=0,c1=0,c2=0,c3=0,c4=0;\n scanf(\"%s\",s);\n l=strlen(s);\n for (i=0;i<l;i++)\n {\n if (s[i]=='A'&& s[i+1]=='n'&& s[i+2]=='n')\n {\n c++;\n\t\t}\n if(s[i]=='O'&& s[i-1]=='l'&& s[i+2]=='y'&& s[i+3]=='a')\n {\n c1++;\n }\n if(s[i]=='D'&& s[i+1]=='a'&& s[i+2]=='n'&& s[i+3]=='i'&& s[i+4]=='l')\n {\n c2++;\n\t }\n if(s[i]=='N'&& s[i+1]=='i'&& s[i+2]=='k'&& s[i+3]=='i'&& s[i+4]=='t'&& s[i+5]=='a')\n {\n\t\t\tc3++;\n\t\t}\n if(s[i]=='S'&& s[i+1]=='l'&& s[i+2]=='a'&& s[i+3]=='v'&& s[i+4]=='a')\n {\n\t\t\tc4++;\n\t\t}\n\n }\n\n if (c+c1+c2+c3+c4==1) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint find_word(char s[],char name[]){\n\tint slen,nlen,i,j,count=0;\n\tslen=strlen(s);\n\tnlen=strlen(name);\n\tfor(i=0;i<slen;i++)\n\t{\n\t\tif(s[i]==name[0])\n\t\t{\n\t\t\tfor(j=0;j<nlen;j++)\n\t\t\t{\n\t\t\t\tif(s[i+j]!=name[j])\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(j==nlen)\n\t\t\tcount++;\n\t\t\ti+=j;\n\t\t}\n\t}\n\treturn count;\n}\n\nint main(void) {\n\tchar s[1000];\n\tint count=0;\n\tscanf(\"%s\",s);\n\tcount+=find_word(s,\"Danil\");\n\tcount+=find_word(s,\"Olya\");\n\tcount+=find_word(s,\"Slava\");\n\tcount+=find_word(s,\"Ann\");\n\tcount+=find_word(s,\"Nikita\");\n\tif(count==1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char str[101];\n int cnt = 0;\n scanf(\"%s\", str);\n int len = strlen(str);\n for(int i = 0; i < 5; ++i) {\n for(int j = 0; j < len; ++j) {\n if(strstr(str + j, name[i]) != NULL) {\n ++cnt;\n }\n }\n }\n puts(cnt == 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint StringFind(const char *pSrc, const char *pDst) \n{ \n int i, j;\n int num = 0;\n for (i=0; pSrc[i]!='\\0'; i++) \n { \n if(pSrc[i]!=pDst[0]) \n continue; \n j = 0; \n while(pDst[j]==pSrc[i+j]) \n { \n j++; \n } \n if(j==strlen(pDst)) \n {\n num++;\n i += j;\n }\n }\n if(num>0)\n return num;\n else\n return 0; \n}\n\nint main()\n{\n char s[100];\n while(scanf(\"%s\",&s)!=EOF)\n {\n int result = 0;\n result += StringFind(s,\"Danil\");\n result += StringFind(s,\"Olya\");\n result += StringFind(s,\"Slava\");\n result += StringFind(s,\"Nikita\");\n result += StringFind(s,\"Ann\");\n if(result==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char zr[100];\n scanf(\"%s\",&zr);\n int l,i,k,a=0,b=0,c=0,d=0,e=0;\n l= strlen(zr);\n for (i=0;i<l;i++)\n {\n if(zr[i]=='N' && zr[i+1]=='i' && zr[i+2]=='k' && zr[i+3]=='i' && zr[i+4]=='t' && zr[i+5]=='a')\n {\n a++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='A' && zr[i+1]=='n' && zr[i+2]=='n')\n {\n b++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='S' && zr[i+1]=='l' && zr[i+2]=='a' && zr[i+3]=='v' && zr[i+4]=='a')\n {\n c++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='O' && zr[i+1]=='l' && zr[i+2]=='y' && zr[i+3]=='a')\n {\n d++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='D' && zr[i+1]=='a' && zr[i+2]=='n' && zr[i+3]=='i' && zr[i+4]=='l')\n {\n e++;\n }\n }\n if ((a==1 && b!=1 && c!=1 && d!=1 && e!=1) || (a!=1 && b==1 && c!=1 && d!=1 && e!=1) || (a!=1 && b!=1 && c==1 && d!=1 && e!=1) || (a!=1 && b!=1 && c!=1 && d==1 && e!=1) || (a!=1 && b!=1 && c!=1 && d!=1 && e==1))\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,n,m=0;\n char a[101];\n scanf(\"%s\",a);\n n=strlen(a);\n for(j=0;j<n;j++){\n if(a[j]=='D'&&a[j+1]=='a'&&a[j+2]=='n'&&a[j+3]=='i'&&a[j+4]=='l'){\n m++;\n }\n else if(a[j]=='O'&&a[j+1]=='l'&&a[j+2]=='y'&&a[j+3]=='a'){\n m++;\n }\n else if(a[j]=='S'&&a[j+1]=='a'&&a[j+2]=='l'&&a[j+3]=='v'&&a[j+4]=='a'){\n m++;\n }\n else if(a[j]=='A'&&a[j+1]=='n'&&a[j+2]=='n'){\n m++;\n }\n else if(a[j]=='N'&&a[j+1]=='i'&&a[j+2]=='k'&&a[j+3]=='i'&&a[j+4]=='t'&&a[j+5]=='a'){\n m++;\n }\n }\n if(m==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ar[1000];\n scanf (\"%s\",ar);\n int i,f=0,g=0,h=0,k=0,j=0;\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='D' && ar[i+1]=='a' && ar[i+2]=='n' && ar[i+3]=='i' && ar[i+4]=='l')\n {\n f+=1;\n\n }\n //else f=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='S' && ar[i+1]=='l' && ar[i+2]=='a' && ar[i+3]=='v' && ar[i+4]=='a')\n {\n g+=1;\n\n }\n //else g=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='N' && ar[i+1]=='i' && ar[i+2]=='k' && ar[i+3]=='i' && ar[i+4]=='t' && ar[i+5]=='a')\n {\n h+=1;\n\n }\n //else h=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='O' && ar[i+1]=='l' && ar[i+2]=='y' && ar[i+3]=='a' )\n {\n k+=1;\n\n }\n //else k=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='A' && ar[i+1]=='n' && ar[i+2]=='n')\n {\n j+=1;\n\n }\n //else j=0;\n }\n if (f==1 && g!=1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g==1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h==1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k==1 && j!=1 )\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k!=1 && j==1 )\n {\n printf (\"YES\\n\");\n }\n else\n printf (\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,l,count=0;\n char s[101];\n scanf(\"%s\",&s);\n l=strlen(s);\n if(l>=3)\n {\n for(i=0;i<=l;i++)\n if((s[i]=='A')&&(s[i+1]=='n')&&(s[i+2]=='n'))\n count++;\n }\n else if(l>=4)\n {\n for(i=0;i<=l;i++)\n if((s[i]=='O')&&(s[i+1]=='l')&&(s[i+2]=='y')&&(s[i+3]=='a'))\n count++;\n }\n else if(l>=5)\n {\n for(i=0;i<=l;i++)\n {\n if((s[i]=='D')&&(s[i+1]=='a')&&(s[i+2]=='n')&&(s[i+3]=='i')&&(s[i+4]=='l'))\n count++;\n else if((s[i]=='S')&&(s[i+1]=='l')&&(s[i+2]=='a')&&(s[i+3]=='v')&&(s[i+4]=='a'))\n count++;\n }\n }\n else if(l>=6)\n {\n for(i=0;i<=l;i++)\n if((s[i]=='N')&&(s[i+1]=='i')&&(s[i+2]=='k')&&(s[i+3]=='i')&&(s[i+4]=='t')&&(s[i+5]=='a'))\n count++;\n }\n if(count==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char str[101];\n int cnt = 0;\n scanf(\"%s\", str);\n for(int i = 0; i < 5; ++i) {\n if(strstr(str, name[i]) != NULL) {\n ++cnt;\n }\n }\n puts(cnt == 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,i,m;\n char s[101];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'&&s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='O'&&s[i+1]=='l'&&s[i+2]=='y'&&s[i+3]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='S'&&s[i+1]=='l'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='A'&&s[i+1]=='n'&&s[i+2]=='n'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='N'&&s[i+1]=='i'&&s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+5]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint checkD(char *n, int l, int i)\n{\n\tif(n[i+1]=='a' && n[i+2]=='n' && n[i+3]=='i' && n[i+4]=='l')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkO(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='y' && n[i+3]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkS(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='a' && n[i+3]=='v' && n[i+4]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkA(char *n, int l, int i)\n{\n\tif(n[i+1]=='n' && n[i+2]=='n')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkN(char *n, int l, int i)\n{\n\tif(n[i+1]=='i' && n[i+2]=='k' && n[i+3]=='i' && n[i+4]=='t'&& n[i+5]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\n\nint main() \n{\n\tchar n[99999];\n\t\n\tint l=0,i,x=0,count=0;\n\t\n\tgets(n);\n\t\n\twhile(n[l]) l++;\n\t\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(n[i]=='D')\n\t\t{\n\t\t\tx=checkD(n,l,i);\t\t\n\t\t}\n\t\telse if(n[i]=='O')\n\t\t{\n\t\t\tx=checkO(n,l,i);\n\t\t}\n\t\telse if(n[i]=='S')\n\t\t{\n\t\t\tx=checkS(n,l,i);\n\t\t}\n\t\telse if(n[i]=='A')\n\t\t{\n\t\t\tx=checkA(n,l,i);\n\t\t}\n\t\telse if(n[i]=='N')\n\t\t{\n\t\t\tx=checkN(n,l,i);\n\t\t}\n\t\tif(x==1)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\tcontinue;\n\t}\n\tif(count==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid main()\n{\nint i,b,c;int flag,j;flag=0;b=c=0;char s[101],*ptr;int p[5]={0,0,0,0,0};\nscanf(\"%s\",&s);\nchar *a[5]={\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n\n\nfor(i=0;i<5;i++)\n{\n\nptr=strstr(s,a[i]);\nif(ptr!=NULL){\np[i]++;\n/*for(j=0;j<strlen(a[i]);j++)\n\tptr++;\nstrcpy(s,ptr);\n\ni=i-1;*/\n}\n\nelse\ncontinue;\n\n}\n\nfor(i=0;i<5;i++)\n{\nif(p[i]==0)\nb++;\n\nelse\n{\nif(p[i]>1)\n{\nflag=1;\nbreak;\n}\n\nif(p[i]==1)\nc++;\n}}\n//printf(\"%d\\n\",c);\nif((b==5)||(flag==1)||(c>1))\nprintf(\"NO\\n\");\nelse\nprintf(\"YES\\n\");\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n=0,ch,i,j,r=0;\n char word[5][7]={{\"Danil+\"},{\"Ann+\"},{\"Slava+\"},{\"Nikita+\"},{\"Olya+\"}};\n i=0;j=0;n=5;\n\n while((ch=getchar())!='\\n')\n {\n for(;i<n;i++)\n {\n if(word[i][j]=='+')\n {\n r++;\n\n }\n if(word[i][j]==ch)\n {\n j++;\n break;\n }\n\n }\n if(word[i][j-1]!=ch)\n {\n i=0;j=0;\n }\n }\n if(r==1)\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid main()\n{\nint i,b,c,z,t;int flag,j;flag=0;b=c=0;char s[101],*ptr;int p[5]={0,0,0,0,0};\nscanf(\"%s\",&s);\nchar *a[5]={\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n\n\nfor(i=0;i<5;i++)\n{\n\nptr=strstr(s,a[i]);\nif(ptr!=NULL){\np[i]++;\n\nfor(z=0;z<strlen(s);z++)\nif(s[z]==*a[i]){\nt=z;break;}\n\n\nfor(j=t+strlen(a[i]);j<strlen(s);j++){\ns[t]=s[j];t++;}\ns[t]='\\0';\n\ni=i-1;\n}\n\nelse\ncontinue;\n\n}\n\nfor(i=0;i<5;i++)\n{\nif(p[i]==0)\nb++;\n\nelse\n{\nif(p[i]>1)\n{\nflag=1;\nbreak;\n}\n\nif(p[i]==1)\nc++;\n}}\n//printf(\"%d\\n\",c);\nif((b==5)||(flag==1)||(c>1))\nprintf(\"NO\\n\");\nelse\nprintf(\"YES\\n\");\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint checkD(char *n, int l, int i)\n{\n\tif(n[i+1]=='a' && n[i+2]=='n' && n[i+3]=='i' && n[i+4]=='l')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkO(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='y' && n[i+3]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkS(char *n, int l, int i)\n{\n\tif(n[i+1]=='l' && n[i+2]=='a' && n[i+3]=='v' && n[i+4]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkA(char *n, int l, int i)\n{\n\tif(n[i+1]=='n' && n[i+2]=='n')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\nint checkN(char *n, int l, int i)\n{\n\tif(n[i+1]=='i' && n[i+2]=='k' && n[i+3]=='i' && n[i+4]=='t'&& n[i+5]=='a')\n\t\treturn 1;\n\telse \n\t\treturn 0;\n}\n\n\nint main() \n{\n\tchar n[99999];\n\t\n\tint l=0,i,x=0;\n\t\n\tgets(n);\n\t\n\twhile(n[l]) l++;\n\t\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(n[i]=='D')\n\t\t{\n\t\t\tx=checkD(n,l,i);\t\t\n\t\t}\n\t\telse if(n[i]=='O')\n\t\t{\n\t\t\tx=checkO(n,l,i);\n\t\t}\n\t\telse if(n[i]=='S')\n\t\t{\n\t\t\tx=checkS(n,l,i);\n\t\t}\n\t\telse if(n[i]=='A')\n\t\t{\n\t\t\tx=checkA(n,l,i);\n\t\t}\n\t\telse if(n[i]=='N')\n\t\t{\n\t\t\tx=checkN(n,l,i);\n\t\t}\n\t\tif(x==1)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcontinue;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i, f = 0;\n char name[100000], names[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n scanf(\"%s\", name);\n for(i=0; i<5; i++){\n if(strstr(name, names[i]))f++;\n }\n printf(\"%s\", (f>1||f==0)?\"NO\":\"YES\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char str[101];\n int cnt = 0;\n scanf(\"%s\", str);\n for(int i = 0; i < 5; ++i) {\n if(strstr(str, name[i]) != NULL) {\n ++cnt;\n }\n }\n puts(cnt == 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar S[101];\nfor(i=0;i<101;i++){\nscanf(\" %c\",&S[i]);\nif((S[i]=='O' && S[i+1]=='l' &&\nS[i+2]=='y' && S[i+3]=='a')||(S[i]=='D' && S[i+1]=='a' &&S[i+2]=='n' &&\nS[i+3]=='i'&&S[i+4]=='l')||\n(S[i]=='A' &&S[i+1]=='n' &&\nS[i+2]=='n')||\n(S[i]=='S'&&S[i+1]=='l' &&\nS[i+2]=='a'&&S[i+3]=='v'&&S[i+4]=='a')||\n(S[i]=='N'&&S[i+1]=='i' &&\nS[i+2]=='k'&&S[i+3]=='i')||(S[i+4]=='t'&&S[i+5]=='a'))\n{count++;}}\nif(count==1){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,i,aa=0;\n char s[103];\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'||s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n printf(\"YES\\n\");aa=1;\n break;\n }\n else if(s[i]=='O'&&s[i+1]=='l'||s[i+2]=='y'&&s[i+3]=='a'){\n printf(\"YES\\n\");aa=1;\n break;\n }\n else if(s[i]=='S'&&s[i+1]=='l'||s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n printf(\"YES\\n\");aa=1;\n break;\n }\n else if(s[i]=='A'&&s[i+1]=='n'||s[i+2]=='n'){\n printf(\"YES\\n\");aa=1;\n break;\n }\n else if(s[i]=='N'&&s[i+1]=='i'||s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+4]=='a'){\n printf(\"YES\\n\");aa=1;\n break;\n }\n\n }\n if(aa==0){\n printf(\"NO\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[110];\n int i,n,f1=0,f2=0,f3=0,f4=0,f5=0;\n scanf(\"%s\",ch);\n n=strlen(ch);\n for (i=0;i<n;i++)\n {\n if(ch[i]=='D'&& ch[i+1]=='a'&& ch[i+2]=='n'&& ch[i+3]=='i'&& ch[i+4]=='l')\n {\n f1=1;\n\t }\n\t if(ch[i]=='O'&& ch[i+1]=='l'&& ch[i+2]=='y'&& ch[i+3]=='a')\n {\n f2=1;\n }\n if(ch[i]=='S'&& ch[i+1]=='l'&& ch[i+2]=='a'&& ch[i+3]=='v'&& ch[i+4]=='a')\n {\n\t\t\tf3=1;\n\t\t}\n if (ch[i]=='A'&& ch[i+1]=='n'&& ch[i+2]=='n')\n {\n f4=1;\n\t\t}\n if(ch[i]=='N'&& ch[i+1]=='i'&& ch[i+2]=='k'&& ch[i+3]=='i'&& ch[i+4]=='t'&& ch[i+5]=='a')\n {\n\t\t\tf5=1;\n\t\t}\n\n\n }\n /*if (f1==1&&f2==1&&f3==1&&f4==1&&f5==1)\n printf(\"NO\");\n else\n\t printf(\"yes\");*/\n\n if (f1+f2+f3+f4+f5==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n char d[100];\n \n char a1[] = \"Danil\"; int b1 = 0;\n char a2[] = \"Olya\"; int b2 = 0;\n char a3[] = \"Slava\"; int b3 = 0;\n char a4[] = \"Ann\"; int b4 = 0;\n char a5[] = \"Nikita\"; int b5 = 0;\n scanf(\"%s\",c);\n int len = strlen(c); \n int j = 0;\n for(int i = 0; i<=len;i++)\n { int q = c[i];\n if((i!=0)&&((c[i]=='_')||(c[i]=='\\0')))\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else if((i!=0)&&(q>=65)&&(q<=90)&&(c[i-1]!='_'))\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else\n {\n d[j] = c[i];\n j++;\n }\n }\n int k[5] = {b1,b2,b3,b4,b5};\n int check = 0;\n int ch = 0;\n for(int i = 0; i<5; i++)\n {\n if(k[i]>1)\n {\n check = 1;\n break;\n }\n \n else if(k[i]==1)\n ch++;\n }\n \n if((ch==1)&&(check==0))\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "\n// http://codeforces.com/contest/877/problem/A\n\n#include <stdio.h>\n#include <string.h>\n\ntypedef enum {\n\tFalse,\n\tTrue\n} bool_t;\n\ntypedef struct{\n\tchar * name;\n\tint name_len;\n} friend_t;\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b);\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len);\n\n#define DANIEL\t\"Danil\"\n#define OLYA\t\"Olya\"\n#define SLAVA\t\"Slava\"\n#define ANN\t\t\"Ann\"\n#define NIKITA\t\"Nikita\"\n\n#define MAX_LINE\t101\n\n#define DEBUG(x, y)\tdo{printf(\"DEBUG:: %s = \" #y\"\\n\", #x, x);}while(0);\n#define DEBUG_STR(str, len)\tfor(int i = 0; i<len; i++){ printf(\"%c\", str[i]); }printf(\"\\n\");\n\nint main(void){\n\t\n\tchar contest[MAX_LINE];\n\tint found_friends = 0, index = 0;\n\tfriend_t friends[5];\n\tint len = 0;\n\t\n\tfriends[0].name = DANIEL;\n\tfriends[1].name = OLYA;\n\tfriends[2].name = SLAVA;\n\tfriends[3].name = ANN;\n\tfriends[4].name = NIKITA;\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tfriends[index].name_len = strlen(friends[index].name);\n\t\t\n\t}\n\t\n\tscanf(\"%s\", contest);\n\tlen = strlen(contest);\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tif( ContainsStr(contest, friends[index].name, len, friends[index].name_len) == True ){\n\t\t\tfound_friends++;\n\t\t}\t\n\t}\n\t\n\tif(found_friends == 1){\n\t\tprintf(\"YES\\n\");\n\t}else{\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}\n\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b){\n\n\tint res = 0, index = 0;\n\n\tif(len_a != len_b){\n\n\t\tres = len_a - len_b;\n\n\t}else{\n\n\t\tfor(index = 0; index < len_a; index++){\n\n\t\t\tif(str_a[index] != str_b[index]){\n\n\t\t\t\tres += str_a[index] - str_b[index];\n\t\t\t\tbreak;\n\n\t\t\t}\t// end if str_a[index] != str_b[index]\n\n\t\t}\t// end for index = 0; index < len_a; index++\n\n\t}\t// end if len_a != len_b\n\n\treturn res;\n}\n\n\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len){\n\n\tint index = 0;\n\n\tif(str_len == sub_len){\n\n\t\t// if both strings are equal, return True\n\t\tif(StrCompare(string, sub_str, str_len, sub_len) == 0){\n\n\t\t\treturn True;\n\n\t\t}\t// end if(StrCompare(string, sub_str, str_len, sub_len) == 0)\n\n\t}else if( sub_len < str_len ){\n\n\t\tfor(index = 0; index < str_len - sub_len + 1; index++){\n\t\t\t\n\t\t\tif( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 ){\n\n\t\t\t\treturn True;\n\n\t\t\t}\t// end if( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 )\n\n\t\t}\t// end for(index = 0; index < str_len - sub_len; index++)\n\n\t}else{\n\n\t\t// do nothing\n\n\t}\t// end if(str_len == sub_len)\n\n\treturn False;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main( )\n{\n int count=0,i,j,l;\n char m[101];\n scanf(\"%[^\\n]\",m);\n l=strlen(m);\n char d[]={'D','a','n','i','l','\\0'};\n char a[]={'A','n','n','\\0'};\n char n[]={'N','i','k','i','t','a','\\0'};\n char o[]={'O','l','y','a','\\0'};\n char s[]={'S','a','l','v','a','\\0'};\n for(i=0;i<=l-5;i++)\n {\n for(j=0;j<5;j++)\n if(m[i+j]==d[j])\n continue;\n else\n break;\n if(j==5)\n count++;\n }\n for(i=0;i<=l-3;i++)\n {\n for(j=0;j<3;j++)\n if(m[i+j]==a[3])\n continue;\n else\n break;\n if(j==3)\n count++;\n }\n for(i=0;i<=l-6;i++)\n {\n for(j=0;j<6;j++)\n if(m[i+j]==n[j])\n continue;\n else\n break;\n if(j==6)\n count++;\n }\n for(i=0;i<=l-4;i++)\n {\n for(j=0;j<4;j++)\n if(m[i+j]==o[j])\n continue;\n else\n break;\n if(j==4)\n count++;\n }\n for(i=0;i<l-5;i++)\n {\n for(j=0;j<5;j++)\n if(m[i+j]==s[j])\n continue;\n else\n break;\n if(j==5)\n count++;\n }\n if(count==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "\n// http://codeforces.com/contest/877/problem/A\n\n#include <stdio.h>\n#include <string.h>\n\ntypedef enum {\n\tFalse,\n\tTrue\n} bool_t;\n\ntypedef struct{\n\tchar * name;\n\tint name_len;\n} friend_t;\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b);\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len);\n\n#define DANIEL\t\"Danil\"\n#define OLYA\t\"Olya\"\n#define SLAVA\t\"Slava\"\n#define ANN\t\t\"Ann\"\n#define NIKITA\t\"Nikita\"\n\n#define MAX_LINE\t101\n\n#define DEBUG(x, y)\tdo{printf(\"DEBUG:: %s = \" #y\"\\n\", #x, x);}while(0);\n#define DEBUG_STR(str, len)\tfor(int i = 0; i<len; i++){ printf(\"%c\", str[i]); }printf(\"\\n\");\n\nint main(void){\n\t\n\tchar contest[MAX_LINE];\n\tint found_friends = 0, index = 0;\n\tfriend_t friends[5];\n\tint len = 0;\n\t\n\tfriends[0].name = DANIEL;\n\tfriends[1].name = OLYA;\n\tfriends[2].name = SLAVA;\n\tfriends[3].name = ANN;\n\tfriends[4].name = NIKITA;\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tfriends[index].name_len = strlen(friends[index].name);\n\t\t\n\t}\n\t\n\tscanf(\"%s\", contest);\n\tlen = strlen(contest);\n\t\n\tfor(index = 0; index < 5; index++){\n\t\t\n\t\tif( ContainsStr(contest, friends[index].name, len, friends[index].name_len) == True ){\n\t\t\tfound_friends++;\n\t\t}\t\n\t}\n\t\n\tif(found_friends == 1){\n\t\tprintf(\"YES\\n\");\n\t}else{\n\t\tprintf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n}\n\n\n\nint StrCompare(char * str_a, char * str_b, int len_a, int len_b){\n\n\tint res = 0, index = 0;\n\n\tif(len_a != len_b){\n\n\t\tres = len_a - len_b;\n\n\t}else{\n\n\t\tfor(index = 0; index < len_a; index++){\n\n\t\t\tif(str_a[index] != str_b[index]){\n\n\t\t\t\tres += str_a[index] - str_b[index];\n\t\t\t\tbreak;\n\n\t\t\t}\t// end if str_a[index] != str_b[index]\n\n\t\t}\t// end for index = 0; index < len_a; index++\n\n\t}\t// end if len_a != len_b\n\n\treturn res;\n}\n\n\nbool_t ContainsStr(char * string, char * sub_str, int str_len, int sub_len){\n\n\tint index = 0;\n\n\tif(str_len == sub_len){\n\n\t\t// if both strings are equal, return True\n\t\tif(StrCompare(string, sub_str, str_len, sub_len) == 0){\n\n\t\t\treturn True;\n\n\t\t}\t// end if(StrCompare(string, sub_str, str_len, sub_len) == 0)\n\n\t}else if( sub_len < str_len ){\n\n\t\tfor(index = 0; index < str_len - sub_len + 1; index++){\n\t\t\t\n\t\t\tif( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 ){\n\n\t\t\t\treturn True;\n\n\t\t\t}\t// end if( StrCompare(&string[index], sub_str, sub_len, sub_len ) == 0 )\n\n\t\t}\t// end for(index = 0; index < str_len - sub_len; index++)\n\n\t}else{\n\n\t\t// do nothing\n\n\t}\t// end if(str_len == sub_len)\n\n\treturn False;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char s[10000];\n long long int i,j,flag=0;\n gets(s);\n for(i=0;s[i]!='\\0' && flag==0;i++)\n {\n if(s[i]=='D' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='i' && s[i+4]=='l')\n flag=1;\n else if(s[i]=='O' && s[i+1]=='l' && s[i+2]=='y' && s[i+3]=='a')\n flag=1;\n else if(s[i]=='S' && s[i+1]=='l' && s[i+2]=='a' && s[i+3]=='v' && s[i+4]=='a')\n flag=1;\n else if(s[i]=='A' && s[i+1]=='n' && s[i+2]=='n')\n flag=1;\n else if(s[i]=='N' && s[i+1]=='i' && s[i+2]=='k' && s[i+3]=='i' && s[i+4]=='t' && s[i+5]=='a')\n flag=1;\n }\n if(flag==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='A')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5==1)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint y,b,r,total;\nscanf(\"%d\",&y);\nscanf(\"%d\",&b);\nscanf(\"%d\",&r);\nif(y==r&&y==b)\n\ttotal=r+(r-1)+(r-2);\nelse if(y<=b&&(y+1)<r)\n\ttotal=y+(y+1)+(y+2);\nelse if(b<=y&&b<=r)\n\ttotal=b+(b+1)+(b-1);\nelse if((r-1)<=y&&r<=b)\n\ttotal=r+(r-1)+(r-2);\n printf(\"%d\",total);\nreturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#define max 100\nint main()\n{\n\tint n,i;\n\tchar s[max];\n\tgets(s);\n\tn=strlen(s);\n\tint flag=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(i + 4 < n && s[i] == 'D' && s[i + 1] == 'a' && s[i + 2] == 'n' && s[i + 3] == 'i' && s[i + 4] == 'l') {\n\t\t\tflag++;\n\t\t}\n\t\tif(i + 3 < n && s[i] == 'O' && s[i + 1] == 'l' && s[i + 2] == 'y' &&s[i + 3] == 'a') {\n\t\t\tflag++;\n\t\t}\n\t\tif(i + 4 < n && s[i] == 'S' && s[i + 1] == 'l' && s[i + 2] == 'a' && s[i + 3] == 'v' && s[i + 4] == 'a') {\n\t\t\tflag++;\n\t\t}\n\t\tif(i + 5 < n && s[i] == 'N' && s[i + 1] == 'i' && s[i + 2] == 'k' && s[i + 3] == 'i' && s[i + 4] == 't' && s[i + 5] == 'a') {\n\t\t\tflag++;\n\t\t}\n\t\tif(i + 2 < n && s[i] == 'A' && s[i + 1] == 'n' && s[i + 2] == 'n') {\n\t\t\tflag++;\n\t\t}\n\t\ti++;\n\t}\n\tif(flag == 1) {\n\t\tprintf(\"YES\");\n\t} else {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\t\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char s[10000];\n long long int i,j,flag=0;\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='D' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='i' && s[i+4]=='l')\n flag++;\n else if(s[i]=='O' && s[i+1]=='l' && s[i+2]=='y' && s[i+3]=='a')\n flag++;\n else if(s[i]=='S' && s[i+1]=='l' && s[i+2]=='a' && s[i+3]=='v' && s[i+4]=='a')\n flag++;\n else if(s[i]=='A' && s[i+1]=='n' && s[i+2]=='n' && flag==0)\n flag++;\n else if(s[i]=='N' && s[i+1]=='i' && s[i+2]=='k' && s[i+3]=='i' && s[i+4]=='t' && s[i+5]=='a')\n flag++;\n }\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i<L;i++){\n switch(A[i]){\n case 'A' : {\n if(A[i+1]=='n' && A[i+2]=='n'){\n Stack++;\n }\n }\n case 'D' : {\n if(A[i+1]=='a' && A[i+2]=='n' && A[i+3]== 'i' && A[i+4] == 'l'){\n Stack++;\n }\n }\n case 'O' : {\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n case 'S' : {\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n case 'N' : {\n if(A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4] == 'i' && A[i+5] == 't' && A[i+6]=='a'){\n Stack++;\n }\n }\n }\n }\n if(Stack>1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid main()\n{\nlong long i,b,c;int flag,j;flag=0;b=c=0;char s[101],*ptr;int p[5]={0,0,0,0,0};\nscanf(\"%s\",&s);\nchar *a[5]={\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n\n\nfor(i=0;i<5;i++)\n{\n\nptr=strstr(s,a[i]);\nif(ptr!=NULL){\np[i]++;\nfor(j=0;j<strlen(a[i]);j++)\n\tptr++;\nstrcpy(s,ptr);\n\ni=i-1;\n}\n\nelse\ncontinue;\n\n}\n\nfor(i=0;i<5;i++)\n{\nif(p[i]==0)\nb++;\n\nelse\n{\nif(p[i]>1)\n{\nflag=1;\nbreak;\n}\n\nif(p[i]==1)\nc++;\n}}\n\nif((b==5)||(flag==1)||(c>1))\nprintf(\"NO\\n\");\nelse\nprintf(\"YES\\n\");\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,m,f=0,o,p,q,r,cnt=0;\n\tchar a[100],b[100]={\"Danil\"},c[100]={\"Olya\"},d[100]={\"Slava\"},e[100]={\"Ann\"},g[100]={\"Nikita\"};\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tm=strlen(b);\n\to=strlen(c);\n\tp=strlen(d);\n\tq=strlen(e);\n\tr=strlen(g);\n\tif(n>=m)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==b[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<m+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=b[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==1)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=o)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==c[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<o+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=c[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==2)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=p)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\n\t\t\tif(a[i]==d[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<p+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=d[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==3)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=q)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==e[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<q+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=e[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==4)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=r)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\t\n\t\t\t\n\t\t\tif(a[i]==g[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<r+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=g[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=5;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==5)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(cnt==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n\t\t\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char a[50],b[50];\n scanf(\"%s\",a);\n int k,j,l;\n if(strlen(a)%2==0){\n j=(strlen(a)/2)-1;\n l=j+1;\n }\n else{\n j=(strlen(a)/2);\n l=j+1;\n }\n for(k=0;k<strlen(a);k++){\n if(k%2==0){\n b[k]=a[j];\n j--;\n }\n else{\n b[k]=a[l];\n l++;\n }\n }\n b[k]='\\0';\n printf(\"%s\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar s[101];\nfor(i=0;i<101;i++)\n {\nscanf(\"%c\",&s[i]);\n }\nfor(i=0;i<101;i++)\n{\nif((s[i]=='O' && s[i+1]=='l' &&\ns[i+2]=='y' && s[i+3]=='a')||(s[i]=='D' && s[i+1]=='a' &&s[i+2]=='n' &&\ns[i+3]=='i'&&s[i+4]=='l')||\n(s[i]=='A' &&s[i+1]=='n' &&\ns[i+2]=='n')||\n(s[i]=='S'&&s[i+1]=='l' &&\ns[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a')||\n(s[i]=='N'&&s[i+1]=='i' &&\ns[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+5]=='a'))\ncount++;\n}\nif(count==2){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,m,f=0,o,p,q,r,cnt=0;\n\tchar a[100],b[100]={\"Danil\"},c[100]={\"Olya\"},d[100]={\"Slava\"},e[100]={\"Ann\"},g[100]={\"Nikita\"};\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tm=strlen(b);\n\to=strlen(c);\n\tp=strlen(d);\n\tq=strlen(e);\n\tr=strlen(g);\n\tif(n>=m)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==b[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<m+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=b[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==1)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=o)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==c[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<o+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=c[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==2)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=p)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\n\t\t\tif(a[i]==d[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<p+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=d[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==3)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=q)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==e[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<q+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=e[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==4)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=r)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\t\n\t\t\t\n\t\t\tif(a[i]==g[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<r+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=g[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=5;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==5)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(cnt==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n\t\t\t\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#define LL long long\n#define uLL unsigned long long\n#define uL unsigned int\n#define uC unsigned char\n\n#define NODES 1000007\n#define NNNN 200007\n#define MemoryStackTotal 10000000\n#define error 1e-8\nstatic unsigned char BakaMemoryStack[MemoryStackTotal];static unsigned char *MemoryStackTop=BakaMemoryStack;void *Allocates(unsigned long size){MemoryStackTop+=size;return MemoryStackTop-size;}void Releases(unsigned long size){MemoryStackTop-=size;if (MemoryStackTop<BakaMemoryStack) {MemoryStackTop=BakaMemoryStack;}}\nvoid mergesort(long *ds,int (*compare)(long a,long b),long size){long i,j,k,s,b,e;long *ms=(long*)Allocates(sizeof(long)*(size+1));\tfor (k=1;k<=size;k=k<<1)\t{\t\tfor (i=1;i+k<=size;i+=k<<1)\t\t{\t\t\ts=i;b=i+k;e=b+k-1;\t\t\tif (e>size) {e=size;}\t\t\tfor (j=1;(s<i+k)&&(b<=e);j++)\t\t\t{\t\t\t\tif (compare(ds[s],ds[b])<=0)\t\t\t\t{\t\t\t\t\tms[j]=ds[s++];\t\t\t\t}\t\t\t\telse\t\t\t\t{\t\t\t\t\tms[j]=ds[b++];\t\t\t\t}\t\t\t}\t\t\tfor (b=i+k-1;b>=s;b--)\t\t\t{\t\t\t\tds[e--]=ds[b];\t\t\t}\t\t\tfor (b=1;b<j;b++)\t\t\t{\t\t\t\tds[i+b-1]=ms[b];\t\t\t}\t\t}\t}\tReleases(sizeof(long)*(size+1));}\nvoid swap(uL *a,uL *b){*a=*a^*b;*b=*a^*b;*a=*a^*b;}void swap64(uLL *a,uLL *b){*a=*a^*b;*b=*a^*b;*a=*a^*b;}uL bsf(uL a){__asm__ __volatile__(\"bsfl %0,%0\":\"+r\"(a));return a;}uL bsr(uL a){__asm__ __volatile__(\"bsrl %0,%0\":\"+r\"(a));return a;}uL imin(uL a,uL b){__asm__ __volatile__(\"cmpl %0,%1\\n\"\"cmovll %1,%0\":\"+&r\"(a):\"g\"(b));return a;}uL imax(uL a,uL b){__asm__ __volatile__(\"cmpl %0,%1\\n\"\"cmovgl %1,%0\":\"+&r\"(a):\"g\"(b));return a;}uL min(uL a,uL b){__asm__ __volatile__(\"cmpl %0,%1\\n\"\"cmovbl %1,%0\":\"+&r\"(a):\"g\"(b));return a;}uL max(uL a,uL b){__asm__ __volatile__(\"cmpl %0,%1\\n\"\"cmoval %1,%0\":\"+&r\"(a):\"g\"(b));return a;}\nvoid print(long *a,long size){long i;for (i=0;i<size;i++){printf(\"%ld \",a[i]);}printf(\"%ld\\n\",a[i]);}void printll(LL *a,long size){long i;for (i=0;i<size;i++){printf(\"%lld \",a[i]);}printf(\"%lld\\n\",a[i]);}\nvoid mergesort2(LL *ds,long size) {long i,j,k,s,b,e;LL *ms=(LL*)Allocates(sizeof(uLL)*(size+1));\tfor (k=1;k<=size;k=k<<1)\t{\t\tfor (i=1;i+k<=size;i+=k<<1)\t\t{\t\t\ts=i;b=i+k;e=b+k-1;\t\t\tif (e>size) {e=size;}\t\t\tfor (j=1;(s<i+k)&&(b<=e);j++)\t\t\t{\t\t\t\tif (ds[s]<=ds[b])\t\t\t\t{\t\t\t\t\tms[j]=ds[s++];\t\t\t\t}\t\t\t\telse\t\t\t\t{\t\t\t\t\tms[j]=ds[b++];\t\t\t\t}\t\t\t}\t\t\tfor (b=i+k-1;b>=s;b--)\t\t\t{\t\t\t\tds[e--]=ds[b];\t\t\t}\t\t\tfor (b=1;b<j;b++)\t\t\t{\t\t\t\tds[i+b-1]=ms[b];\t\t\t}\t\t}\t}\tReleases(sizeof(long)*(size+1));}\n\n\nchar word[][10]={{0},\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\nchar str[100000];\nint main()\n{\n\tlong i,j,k,a,b,c,ans;\n\tans=0;\n\twhile (gets(str)!=NULL) {if (isalpha(*str)!=0) {break;}}\n\tfor (j=1;j<=5;j++)\n\t{\n\t\tfor (k=0,i=0;str[i]!='\\0';i++)\n\t\t{\n\t\t\tif (word[j][k]==str[i]) {k++;} else {k=0;}\n\t\t\tif (word[j][k]=='\\0') {ans++;k=0;}\n\t\t}\n\t}\n\tif (ans==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char zr[100];\n scanf(\"%s\",&zr);\n int l,i,k,a=0,b=0,c=0,d=0,e=0;\n l= strlen(zr);\n for (i=0;i<l;i++)\n {\n if(zr[i]=='N' && zr[i+1]=='i' && zr[i+2]=='k' && zr[i+3]=='i' && zr[i+4]=='t' && zr[i+5]=='a')\n {\n a++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='A' && zr[i+1]=='n' && zr[i+2]=='n')\n {\n b++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='S' && zr[i+1]=='l' && zr[i+2]=='a' && zr[i+3]=='v' && zr[i+4]=='a')\n {\n c++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='O' && zr[i+1]=='l' && zr[i+2]=='y' && zr[i+3]=='a')\n {\n d++;\n }\n }\n for (i=0;i<l;i++)\n {\n if(zr[i]=='D' && zr[i+1]=='a' && zr[i+2]=='n' && zr[i+3]=='i' && zr[i+4]=='l')\n {\n e++;\n }\n }\n if ((a==1 && b!=1 && c!=1 && d!=1 && e!=1) || (a!=1 && b==1 && c!=1 && d!=1 && e!=1) || (a!=1 && b!=1 && c==1 && d!=1 && e!=1) || (a!=1 && b!=1 && c!=1 && d==1 && e!=1) || (a!=1 && b!=1 && c!=1 && d!=1 && e==1))\n {\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nvoid removeSubstring(char *s,const char *remove)\n{\nchar * aux =strstr(s,remove) ;\nint n=strlen(remove); \nint pos=s-aux ;\nfor (int i=0;i<n;i++)\ns[i+pos]='*' ;\n}\n\n\n\nmain()\n{ char f[100] ; const char* f1=\"Danil\", *f3=\"Olya\", *f2=\"Ann\", *f4=\"Slava\", *f5=\"Nikita\";\n\tscanf(\"%s\",&f);\n\tint i=0;\n\tfor (int j=0;j<2;j++){\n\tif (strstr(f,f1)){i=i+1; removeSubstring(f,\"Danil\");}\n\tif (strstr(f,f2)){i=i+1; removeSubstring(f,\"Ann\");}\n\tif (strstr(f,f3)){i=i+1; removeSubstring(f,\"Olya\");} \n\tif (strstr(f,f4)){i=i+1; removeSubstring(f,\"Slava\");} \n\tif (strstr(f,f5)){i=i+1; removeSubstring(f,\"Nikita\");}; \n\n}\nif (i!=1)printf(\"NO\"); else printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nconst char *name[5] = {\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\nint main()\n{\n\tchar s[105];\n\tint cnt = 0;\n\tgets(s);\n\tfor (int i = 0; i < 5; i++)\n\t{\n\t\tchar *p = s;\n\t\twhile (strstr(p, name[i]) != NULL)\n\t\t{\n\t\t\tcnt++;\n\t\t\tp = p + strlen(name[i]);\n\t\t}\n\t}\n\tputs(cnt == 1 ? \"YES\" : \"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ar[1000];\n scanf (\"%s\",ar);\n int i,f,g,h,k,j;\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='D' && ar[i+1]=='a' && ar[i+2]=='n' && ar[i+3]=='i' && ar[i+4]=='l')\n {\n f=1;\n break;\n }\n else f=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='S' && ar[i+1]=='l' && ar[i+2]=='a' && ar[i+3]=='v' && ar[i+4]=='a')\n {\n g=1;\n break;\n }\n else g=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='N' && ar[i+1]=='i' && ar[i+2]=='k' && ar[i+3]=='i' && ar[i+4]=='t' && ar[i+5]=='a')\n {\n h=1;\n break;\n }\n else h=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='O' && ar[i+1]=='l' && ar[i+2]=='y' && ar[i+3]=='a' )\n {\n k=1;\n break;\n }\n else k=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='A' && ar[i+1]=='n' && ar[i+2]=='n')\n {\n j=1;\n break;\n }\n else j=0;\n }\n if (f==1 && g!=1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g==1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h==1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k==1 && j!=1 )\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k!=1 && j==1 )\n {\n printf (\"YES\\n\");\n }\n else\n printf (\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k=0,b,e,c=-1;\n\tscanf(\"%d %d %d\",&n,&b,&e);\n\tfor(int i=n;i>b;i--)\n\t{\n\t\tc=c+1;\n\t\tif(c<=e)\n\t\t{\n\t\t\tk=k+1;\n\t\t}\n\t}\n\t\t\n\tprintf(\"%d\",k);\nreturn 0;\n}\t\n\t\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint StringFind(const char *pSrc, const char *pDst) \n{ \n int i, j; \n for (i=0; pSrc[i]!='\\0'; i++) \n { \n if(pSrc[i]!=pDst[0]) \n continue; \n j = 0; \n while(pDst[j]!='\\0' && pSrc[i+j]!='\\0') \n { \n j++; \n if(pDst[j]!=pSrc[i+j]) \n break; \n } \n if(pDst[j]=='\\0') \n return 1; \n } \n return 0; \n}\n\nint main()\n{\n char s[100];\n while(scanf(\"%s\",&s)!=EOF)\n {\n if(StringFind(s,\"Danil\")||StringFind(s,\"Olya\")||StringFind(s,\"Slava\")||StringFind(s,\"Nikita\")||StringFind(s,\"Ann\"))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,i,aa=0;\n char s[103];\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'&&s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n aa=1;\n }\n else if(s[i]=='O'&&s[i+1]=='l'&&s[i+2]=='y'&&s[i+3]=='a'){\n aa=1;\n }\n else if(s[i]=='S'&&s[i+1]=='l'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n aa=1;\n }\n else if(s[i]=='A'&&s[i+1]=='n'&&s[i+2]=='n'){\n aa=1;\n\n }\n else if(s[i]=='N'&&s[i+1]=='i'&&s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+4]=='a'){\n aa=1;\n\n }\n\n }\n if(aa==0){\n printf(\"NO\\n\");\n }\n else if(aa==1) {printf(\"YES\\n\");}\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int l,i,b = 0 ;\n char a[101];\n scanf(\"%s\",a);\n l = strlen(a);\n for(i=0; i<l;i++){\n if(a[i] == '_'){\n b = 0;\n break;\n }\n if(a[i] == 'D'){\n if(a[i+1] == 'a'){\n if(a[i+2] == 'n'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='l'){\n b=1;\n }\n }\n }\n }\n }\n if(a[i] == 'O'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'y'){\n if(a[i+3] == 'a'){\n b=1;\n }\n }\n }\n }\n if(a[i] == 'S'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'a'){\n if(a[i+3] == 'v'){\n if(a[i+4]=='a'){\n b=1;\n }\n }\n }\n }\n }\n if(a[i] == 'A'){\n if(a[i+1] == 'n'){\n if(a[i+2] == 'n'){\n b=1;\n }\n }\n }\n if(a[i] == 'N'){\n if(a[i+1] == 'i'){\n if(a[i+2] == 'k'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='t'){\n if(a[i+5]=='a'){\n b=1;\n }\n }\n }\n }\n }\n }\n }\n if(b==1){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint buc[5];\nint main()\n{\n\tchar a[101];\n\tscanf(\"%s\",a);\n\tint i,j,k=0;\n\tfor(i=0;i<strlen(a);i++)\n\t{\n\t\tif(a[i]>=65 && a[i]<=90)\n\t\t{\n\t\t\tif(a[i]=='A' || a[i]=='D' || a[i]=='S' || a[i]=='O' || a[i]=='N')\n\t\t\t{\n\t\t\t\tif(a[i]=='A' && a[i+1]=='n' && a[i+2]=='n')\n\t\t\t\t\tbuc[0]++;\n\t\t\t\telse if(a[i]=='N' && a[i+1]=='i' && a[i+2]=='k' && a[i+3]=='i' && a[i+4]=='t' && a[i+5]=='a')\n\t\t\t\t\tbuc[1]++;\n\t\t\t\telse if(a[i]=='O' && a[i+1]=='l' && a[i+2]=='y' && a[i+3]=='a')\n\t\t\t\t\tbuc[2]++;\t\n\t\t\t\telse if(a[i]=='D' && a[i+1]=='a' && a[i+2]=='n' && a[i+3]=='i' && a[i]=='l')\n\t\t\t\t\tbuc[3]++;\n\t\t\t\telse if(a[i]=='S' && a[i+1]=='a' && a[i+2]=='l' && a[i+3]=='v' && a[i]=='a')\n\t\t\t\t\tbuc[4]++;\n\t\t\t}\n\t\t}\n\t}\n\tint flag=0;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tif(buc[i]>1)\n\t\t{\n\t\t\tflag=1;\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\t\t\t\n\t\t}\n\t\telse if(buc[i]==1)\n\t\t\tk++;\n\t}\n\tif(k==1 && flag==0)\n\t\tprintf(\"YES\");\n\telse if(flag==0)\n\t\tprintf(\"NO\");\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n char a[200];\n int b=0;\n gets(a);\n if(strstr(a,\"Danil\")!=0){\n b++;\n }\n if(strstr(a,\"Olya\")!=0){\n b++;\n }\n if(strstr(a,\"Slava\")!=0){\n b++;\n }\n if(strstr(a,\"Ann\")!=0){\n b++;\n }\n if(strstr(a,\"Nikita\")!=0){\n b++;\n }\n // printf(\"%d\",b);\n if(b==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\nreturn 0;\n }\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint buc[5];\nint main()\n{\n\tchar a[101];\n\tscanf(\"%s\",a);\n\tint i,j,k=0;\n\tfor(i=0;i<strlen(a);i++)\n\t{\n\t\tif(a[i]>=65 && a[i]<=90)\n\t\t{\n\t\t\tif(a[i]=='A' || a[i]=='D' || a[i]=='S' || a[i]=='O' || a[i]=='N')\n\t\t\t{\n\t\t\t\tif(a[i]=='A' && a[i+1]=='n' && a[i+2]=='n')\n\t\t\t\t\tbuc[0]++;\n\t\t\t\telse if(a[i]=='N' && a[i+1]=='i' && a[i+2]=='k' && a[i+3]=='i' && a[i+4]=='t' && a[i+5]=='a')\n\t\t\t\t\tbuc[1]++;\n\t\t\t\telse if(a[i]=='O' && a[i+1]=='l' && a[i+2]=='y' && a[i+3]=='a')\n\t\t\t\t\tbuc[2]++;\t\n\t\t\t\telse if(a[i]=='D' && a[i+1]=='a' && a[i+2]=='n' && a[i+3]=='i' && a[i]=='l')\n\t\t\t\t\tbuc[3]++;\n\t\t\t\telse if(a[i]=='S' && a[i+1]=='a' && a[i+2]=='l' && a[i+3]=='v' && a[i]=='a')\n\t\t\t\t\tbuc[4]++;\n\t\t\t}\n\t\t}\n\t}\n\tint flag=0;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tif(buc[i]>1)\n\t\t{\n\t\t\tflag=1;\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\t\t\t\n\t\t}\n\t\telse if(buc[i]==1)\n\t\t\tk++;\n\t}\n\tif(k==1 && flag==0)\n\t\tprintf(\"YES\");\n\telse if(flag==0)\n\t\tprintf(\"NO\");\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char str[1000];\n int len,f=1,i;\n scanf(\"%s\",&str);\n len=strlen(str);\n for(i=0;i<len;i++)\n {\n if(str[i]=='D')\n {\n if(str[i+1]=='a')\n {\n if(str[i+2]=='n')\n {\n if(str[i+3]=='i')\n {\n if(str[i+4]=='l')\n {\n printf(\"YES\\n\");\n f=0;\n break;\n }\n }\n }\n\n\n }\n\n\n }\n else if(str[i]=='O')\n {\n if(str[i+1]=='l')\n {\n if(str[i+2]=='y')\n {\n if(str[i+3]=='a')\n {\n printf(\"YES\\n\");\n f=0;\n break;\n }\n }\n }\n }\n else if(str[i]=='S')\n {\n if(str[i+1]=='l')\n {\n if(str[i+2]=='a')\n {\n if(str[i+3]=='v')\n {\n if(str[i+4]=='a')\n {\n printf(\"YES\\n\");\n f=0;\n break;\n }\n\n }\n }\n }\n }\n else if(str[i]=='A')\n {\n if(str[i+1]=='n')\n {\n if(str[i+2]=='n')\n {\n printf(\"YES\\n\");\n f=0;\n break;\n }\n }\n }\n else if(str[i]=='N')\n {\n if(str[i+1]=='i')\n {\n if(str[i+2]=='k')\n {\n if(str[i+3]=='i')\n {\n if(str[i+4]=='t')\n {\n if(str[i+5]=='a')\n {\n printf(\"YES\\n\");\n f=0;\n break;\n }\n }\n }\n }\n }\n }\n\n\n\n }\n if(f==1)\n {\n printf(\"NO\\n\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\nchar string[101];\nscanf(\"%s\",string);\nint count =0;\nfor(int i =0 ;i<101;i++){\n if(string[i]!='\\0'){\n if(string[i]=='A'&&string[i+1]=='n'&&string[i+2]=='n'){\n count++;\n }\n if(string[i]=='S'&&string[i+1]=='l'&&string[i+2]=='a'&&string[i+3]=='v'&&string[i+4]=='a'){\n count++;\n\n }\n if(string[i]=='N'&&string[i+1]=='i'&&string[i+2]=='k'&&string[i+3]=='i'&&string[i+4]=='t'&&string[i+5]=='a'){\n count++;\n }\n if(string[i]=='O'&&string[i+1]=='l'&&string[i+2]=='y'&&string[i+3]=='a'){\n count++;\n }\n if(string[i]=='O'&&string[i+1]=='l'&&string[i+2]=='y'&&string[i+3]=='a'){\n count++;\n }\n if(string[i]=='D'&&string[i+1]=='a'&&string[i+2]=='n'&&string[i+3]=='i'&&string[i+4]=='l'){\n count++;\n\n }\n }\n}\n\nif(count==1){\n printf(\"YES\");\n}else{\nprintf(\"NO\");\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ar[1000];\n scanf (\"%s\",ar);\n int i,f,g,h,k,j;\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='D' && ar[i+1]=='a' && ar[i+2]=='n' && ar[i+3]=='i' && ar[i+4]=='l')\n {\n f=1;\n break;\n }\n else f=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='S' && ar[i+1]=='l' && ar[i+2]=='a' && ar[i+3]=='v' && ar[i+4]=='a')\n {\n g=1;\n break;\n }\n else g=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='N' && ar[i+1]=='i' && ar[i+2]=='k' && ar[i+3]=='i' && ar[i+4]=='t' && ar[i+5]=='a')\n {\n h=1;\n break;\n }\n else h=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='O' && ar[i+1]=='l' && ar[i+2]=='y' && ar[i+3]=='a' )\n {\n k=1;\n break;\n }\n else k=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='A' && ar[i+1]=='n' && ar[i+2]=='n')\n {\n j=1;\n break;\n }\n else j=0;\n }\n if (f==1 && g!=1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g==1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h==1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k==1 && j!=1 )\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k!=1 && j==1 )\n {\n printf (\"YES\\n\");\n }\n else\n printf (\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <time.h>\n\n\nint main(){\n char name[101];\n scanf(\"%s\", name);\n\n int test[5] = {0};\n\n int ct1,ct2,length;\n for(ct1 = 0 ; ct1 < 100 ; ct1++){\n if(name[ct1] == '\\0'){\n length = ct1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 4 < length ; ct1++){\n if(name[ct1] == 'D' && name[ct1 +1 ] == 'a' && name[ct1 + 2] == 'n' && name[ct1 + 3] == 'i' && name[ct1 + 4] == 'l' ){\n test[0] = 1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 3 < length ; ct1++){\n if(name[ct1] == 'O' && name[ct1 +1 ] == 'l' && name[ct1 + 2] == 'y' && name[ct1 + 3] == 'a' ){\n test[1] = 1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 4 < length ; ct1++){\n if(name[ct1] == 'S' && name[ct1 +1 ] == 'l' && name[ct1 + 2] == 'a' && name[ct1 + 3] == 'v' && name[ct1 + 4] == 'a' ){\n test[2] = 1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 2 < length ; ct1++){\n if(name[ct1] == 'A' && name[ct1 +1 ] == 'n' && name[ct1 + 2] == 'n' ){\n test[3] = 1;\n break;\n }\n }\n for(ct1 = 0 ; ct1 + 5 < length ; ct1++){\n if(name[ct1] == 'N' && name[ct1 +1 ] == 'i' && name[ct1 + 2] == 'k' && name[ct1 + 3] == 'i' && name[ct1 + 4] == 't' && name[ct1 + 5] == 'a'){\n test[4] = 1;\n break;\n }\n }\n if(test[0] + test[1] + test[2] + test[3] + test[4] == 1){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ar[1000];\n scanf (\"%s\",ar);\n int i,f,g,h,k,j;\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='D' && ar[i+1]=='a' && ar[i+2]=='n' && ar[i+3]=='i' && ar[i+4]=='l')\n {\n f=1;\n break;\n }\n else f=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='S' && ar[i+1]=='l' && ar[i+2]=='a' && ar[i+3]=='v' && ar[i+4]=='a')\n {\n g=1;\n break;\n }\n else g=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='N' && ar[i+1]=='i' && ar[i+2]=='k' && ar[i+3]=='i' && ar[i+4]=='t' && ar[i+5]=='a')\n {\n h=1;\n break;\n }\n else h=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='O' && ar[i+1]=='l' && ar[i+2]=='y' && ar[i+3]=='a' )\n {\n k=1;\n break;\n }\n else k=0;\n }\n for (i=0;ar[i]!='\\0';i++)\n {\n if (ar[i]=='A' && ar[i+1]=='n' && ar[i+2]=='n')\n {\n j=1;\n break;\n }\n else j=0;\n }\n if (f==1 && g!=1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g==1 && h!=1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h==1 && k!=1 && j!=1)\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k==1 && j!=1 )\n {\n printf (\"YES\\n\");\n }\n else if (f!=1 && g!=1 && h!=1 && k!=1 && j==1 )\n {\n printf (\"YES\\n\");\n }\n else\n printf (\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k=0,b,e,c=-1;\n\tscanf(\"%d %d %d\",&n,&b,&e);\n\tfor(int i=n;i>b;i--)\n\t{\n\t\tc=c+1;\n\t\tif(c<=e)\n\t\t{\n\t\t\tk=k+1;\n\t\t}\n\t}\n\t\t\n\tprintf(\"%d\",k);\nreturn 0;\n}\t\n\t\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n char d[100];\n \n char a1[] = \"Danil\"; int b1 = 0;\n char a2[] = \"Olya\"; int b2 = 0;\n char a3[] = \"Slava\"; int b3 = 0;\n char a4[] = \"Ann\"; int b4 = 0;\n char a5[] = \"Nikita\"; int b5 = 0;\n scanf(\"%s\",c);\n int len = strlen(c); \n int j = 0;\n for(int i = 0; i<=len;i++)\n { if(i==0)\n goto A ;\n int q = c[i];\n if((c[i]=='_')||c[i]=='\\0')\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else if((q>=65)&&(q<=90)&&(c[i-1]!='_'))\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else\n {\n A:\n d[j] = c[i];\n j++;\n }\n }\n int k[5] = {b1,b2,b3,b4,b5};\n int check = 0;\n int ch = 0;\n for(int i = 0; i<5; i++)\n {\n if(k[i]>1)\n {\n check = 1;\n break;\n }\n \n else if(k[i]==1)\n ch++;\n }\n \n if((ch==1)&&(check==0))\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[100];\n scanf(\"%s\", name);\n if( (strstr(name, \"Danil\")!=NULL) ||\n (strstr(name, \"Olya\")!=NULL) ||\n (strstr(name, \"Ann\")!=NULL)||\n (strstr(name, \"Nikita\")!=NULL) ||\n (strstr(name, \"Slava\")!=NULL) )\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int l,i,b = 0;\n char a[101];\n scanf(\"%s\",a);\n l = strlen(a);\n for(i=0; i<l;i++){\n if(a[i] == '_'){\n b = 0;\n break;\n }\n if(a[i] == 'D'){\n if(a[i+1] == 'a'){\n if(a[i+2] == 'n'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='l'){\n b=1;\n }\n }\n }\n }\n }\n else if(a[i] == 'O'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'y'){\n if(a[i+3] == 'a'){\n b=1;\n }\n }\n }\n }\n else if(a[i] == 'S'){\n if(a[i+1] == 'l'){\n if(a[i+2] == 'a'){\n if(a[i+3] == 'v'){\n if(a[i+4]=='a'){\n b=1;\n }\n }\n }\n }\n }\n else if(a[i] == 'A'){\n if(a[i+1] == 'n'){\n if(a[i+2] == 'n'){\n b=1;\n }\n }\n }\n else if(a[i] == 'N'){\n if(a[i+1] == 'i'){\n if(a[i+2] == 'k'){\n if(a[i+3] == 'i'){\n if(a[i+4]=='t'){\n if(a[i+5]=='a'){\n b=1;\n }\n }\n }\n }\n }\n }\n }\n if(b==1){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n int i,l,c1=0,c2=0,c3=0,c4=0,c5=0;\n scanf(\"%s\",c);\n l=strlen(c);\n for (i=0;i<l;i++)\n {\n if (c[i]=='A'&& c[i+1]=='n'&& c[i+2]=='n')\n {\n c1=c1+1;\n\t\t}\n if(c[i]=='O'&& c[i+1]=='l'&& c[i+2]=='y'&& c[i+3]=='a')\n {\n c2=c2+1;\n }\n if(c[i]=='D'&& c[i+1]=='a'&& c[i+2]=='n'&& c[i+3]=='i'&& c[i+4]=='l')\n {\n c3=c3+1;\n\t }\n if(c[i]=='N'&& c[i+1]=='i'&& c[i+2]=='k'&& c[i+3]=='i'&& c[i+4]=='t'&& c[i+5]=='a')\n {\n\t c4=c4+1;\n\t\t}\n if(c[i]=='S'&& c[i+1]=='l'&& c[i+2]=='a'&& c[i+3]=='v'&& c[i+4]=='a')\n {\n\t c5=c5+1;\n\t\t}\n\n }\n\n if (c1+c2+c3+c4+c5)\n {\n printf(\"YES\");\n }\n else\n {\n\t\t printf(\"NO\");\n\t }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n\n\n{\n\n char a[100];\n\n gets(a);\n\n strlwr(a);\n\n int i,j,s=0;\n\n\n for(i=0;a[i]!='\\0';i++)\n {\n if(a[i]=='d' && a[i+1]=='a' && a[i+2]=='n' && a[i+3]=='i' && a[i+4]=='l')\n s++;\n\n if(a[i]=='o' && a[i+1]=='l' && a[i+2]=='y' && a[i+3]=='a')\n s++;\n\n if(a[i]=='s' && a[i+1]=='l' && a[i+2]=='a' && a[i+3]=='v' && a[i+4]=='a')\n s++;\n\n if(a[i]=='a' && a[i+1]=='n' && a[i+2]=='n')\n s++;\n\n if(a[i]=='n' && a[i+1]=='i' && a[i+2]=='k' && a[i+3]=='i' && a[i+4]=='t' && a[i+5]=='a')\n s++;\n }\n\n if(s==1)\n printf(\"YES\\n\");\n\n\n else if(s==0 || s>1)\n printf(\"NO\\n\");\n\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n char c[100];\n char d[100];\n \n char a1[] = \"Danil\"; int b1 = 0;\n char a2[] = \"Olya\"; int b2 = 0;\n char a3[] = \"Slava\"; int b3 = 0;\n char a4[] = \"Ann\"; int b4 = 0;\n char a5[] = \"Nikita\"; int b5 = 0;\n scanf(\"%s\",c);\n int len = strlen(c); \n int j = 0;\n for(int i = 0; i<=len;i++)\n { if(i==0)\n goto A ;\n int q = c[i];\n if((c[i]=='_')||c[i]=='\\0')\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else if((q>=65)&&(q<=90)&&(c[i-1]!='_'))\n {\n j=0 ;\n if(strcmp(a1,d)==0) b1++;\n else if(strcmp(a2,d)==0) b2++;\n else if(strcmp(a3,d)==0) b3++;\n else if(strcmp(a4,d)==0) b4++;\n else if(strcmp(a5,d)==0) b5++;\n for(int h = 0;h<100;h++)\n d[h]='\\0';\n\n continue;\n }\n else\n {\n A:\n d[j] = c[i];\n j++;\n }\n }\n int k[5] = {b1,b2,b3,b4,b5};\n int check = 0;\n int ch = 0;\n for(int i = 0; i<5; i++)\n {\n if(k[i]>1)\n {\n check = 1;\n break;\n }\n \n else if(k[i]==1)\n ch++;\n }\n \n if((ch==1)&&(check==0))\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain(){\n char A[101];\n int i;\n gets(A);\n int L=strlen(A),Stack=0;\n for(i=0;i<L;i++){\n switch(A[i]){\n case 'A' : {\n if(A[i+1]=='n' && A[i+2]=='n'){\n Stack++;\n }\n }\n case 'D' : {\n if(A[i+1]=='a' && A[i+2]=='n' && A[i+3]== 'i' && A[i+4] == 'l'){\n Stack++;\n }\n }\n case 'O' : {\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n case 'S' : {\n if(A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a'){\n Stack++;\n }\n }\n case 'N' : {\n if(A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4] == 'i' && A[i+5] == 't' && A[i+6]=='a'){\n Stack++;\n }\n }\n }\n }\n if(Stack>1 || Stack==0){\n printf(\"NO\");\n }else printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,j,cont=0,tam,tam1;\n char frase[105],nome1[5]=\"Danil\",nome2[4]=\"Olya\",nome3[5]=\"Slava\",nome4[3]=\"Ann\",nome5[6]=\"Nikita\";\n scanf(\"%s\",frase);\n tam=strlen(frase);\n for(i=0;i<tam;i++)\n {\n if(frase[i] == 'D')\n {\n if(frase[i+1] == 'a' && frase[i+2] == 'n' && frase[i+3] == 'i' && frase[i+4] == 'l')\n cont++;\n }\n else if(frase[i] == 'O')\n {\n if(frase[i+1] == 'l' && frase[i+2] == 'y' && frase[i+3] == 'a')\n cont++;\n }\n else if(frase[i] == 'S')\n {\n if(frase[i+1] == 'l' && frase[i+2] == 'a' && frase[i+3] == 'y' && frase[i+4] == 'a')\n cont++;\n }\n else if(frase[i] == 'A')\n {\n if(frase[i+1] == 'n' && frase[i+2] == 'n')\n cont++;\n }\n else if(frase[i] == 'N')\n {\n if(frase[i+1] == 'i' && frase[i+2] == 'k' && frase[i+3] == 'i' && frase[i+4] == 't' && frase[i+5] == 'a')\n cont++;\n }\n }\n if(cont == 1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n\n/* 1519485265000 */\n"}, {"source_code": "#include <stdio.h>\nint main(){\nint i,count=0;\nchar S[101];\nfor(i=0;i<101;i++){\nscanf(\"%c\",&S[i]);\nif((S[i]=='O' && S[i+1]=='l' &&\nS[i+2]=='y' && S[i+3]=='a')||(S[i]=='D' && S[i+1]=='a' &&S[i+2]=='n' &&\nS[i+3]=='i'&&S[i+4]=='l')||\n(S[i]=='A' &&S[i+1]=='n' &&\nS[i+2]=='n')||\n(S[i]=='S'&&S[i+1]=='l' &&\nS[i+2]=='a'&&S[i+3]=='v'&&S[i+4]=='a')||\n(S[i]=='N'&&S[i+1]=='i' &&\nS[i+2]=='k'&&S[i+3]=='i')||(S[i+4]=='t'&&S[i+5]=='a'))\n{count++;}}\nif(count==1){\nprintf(\"YES\");}\nelse{\n printf(\"NO\");}}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char str[101];\n int cnt = 0;\n scanf(\"%s\", str);\n int len = strlen(str);\n for(int i = 0; i < 5; ++i) {\n for(int j = 0; j < len; ++j) {\n if(strstr(str + j, name[i]) != NULL) {\n ++cnt;\n }\n }\n }\n puts(cnt == 1 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\nint i,x;\nchar A[101];\nfor(i=0;i<101;i++){\nscanf(\"%c\",&A[i]);\n }\nfor(i=0;i<101;i++){ \nif((A[i]=='O' && A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a') || (A[i]=='D' && A[i+1]=='a' && A[i+2]=='n' && A[i+3]=='i' && A[i+4]=='l') || A[i]=='A' && A[i+1]=='n' && A[i+2]=='n' || A[i]=='S' && A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4]=='a' || (A[i]=='N' && A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4]=='t' && A[i+5]=='a')){\nx=1;\n}\nelse \nx=0;\n}\nif(x==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\"); \n}"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\n\nint StringFind(const char *pSrc, const char *pDst) \n{ \n int i, j; \n for (i=0; pSrc[i]!='\\0'; i++) \n { \n if(pSrc[i]!=pDst[0]) \n continue; \n j = 0; \n while(pDst[j]!='\\0' && pSrc[i+j]!='\\0') \n { \n j++; \n if(pDst[j]!=pSrc[i+j]) \n break; \n } \n if(pDst[j]=='\\0') \n return 1; \n } \n return 0; \n}\n\nint main()\n{\n char s[100];\n while(scanf(\"%s\",&s)!=EOF)\n {\n if(StringFind(s,\"Danil\")||StringFind(s,\"Olya\")||StringFind(s,\"Slava\")||StringFind(s,\"Nikita\")||StringFind(s,\"Ann\"))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,x=0;\n char A[101];\n for(i=0;i<101;i++) \n {\n scanf(\"%c\",&A[i]);\n }\n for(i=0;i<101;i++)\n {\n if(A[i]=='O' && A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a')\n x++;\n else if(A[i]=='D' && A[i+1]=='a' && A[i+2]=='n' && A[i+3]=='i' && A[i+4]=='l' )\n x++;\n else if(A[i]=='A' && A[i+1]=='n' && A[i+2]=='n' || A[i]=='S' && A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4]=='a' ) \n x++;\n else if(A[i]=='N' && A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4]=='t' && A[i+5]=='a')\n x++;\n }\n if(x==1)\n printf(\"no\");\n else \n printf(\"NO\"); \n return 0;\n}"}, {"source_code": "/*\n * 6.10.c\n * \n * Copyright 2019 HP <HP@DESKTOP-L2C0F23>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include <string.h>\n\nint main(int argc, char **argv)\n{\n\tint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nl1=strlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] != name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint cmp(const void *a,const void *b)\n{\n return *(int *)a - *(int *)b;\n}\n\nint main()\n{\n char a[105],b[105][105];\n scanf(\"%s\",a);\n int n=strlen(a),i,j=0,k;\n char c[5][7]={\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n int count=0;\n for(i=0;i<5;i++)\n {\n if(strstr(a,c[i])!=NULL)\n count++;\n }\n if(count==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n char s[10000];\n long long int i,j,flag=0;\n gets(s);\n for(i=0;s[i]!='\\0' && flag==0;i++)\n {\n if(s[i]=='D' && s[i+1]=='a' && s[i+2]=='n' && s[i+3]=='i' && s[i+4]=='l' && flag==0)\n flag=1;\n else if(s[i]=='O' && s[i+1]=='l' && s[i+2]=='y' && s[i+3]=='a' && flag==0)\n flag=1;\n else if(s[i]=='S' && s[i+1]=='l' && s[i+2]=='a' && s[i+3]=='v' && s[i+4]=='a' && flag==0)\n flag=1;\n else if(s[i]=='A' && s[i+1]=='n' && s[i+2]=='n' && flag==0)\n flag=1;\n else if(s[i]=='N' && s[i+1]=='i' && s[i+2]=='k' && s[i+3]=='i' && s[i+4]=='t' && s[i+5]=='a' && flag==0)\n flag=1;\n }\n if(flag==0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n char s [101];\n int i,c=0;\n scanf(\"%s\",s);\n for (i=0;i,i<strlen(s);i++){\n if (strstr(s,\"Danil\")){\n c++;\n }\n if (strstr(s,\"Olya\")){\n c++;\n }\n if (strstr(s,\"Slava\")){\n c++;\n }\n if (strstr(s,\"Ann\")){\n c++;\n }\n if (strstr(s,\"Nikita\")){\n c++;\n }\n }\n if (c==1){\n printf (\"YES\");\n }\n else {\n printf (\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,m,f=0,o,p,q,r,cnt=0;\n\tchar a[100],b[100]={\"Danil\"},c[100]={\"Olya\"},d[100]={\"Slava\"},e[100]={\"Ann\"},g[100]={\"Nikita\"};\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tm=strlen(b);\n\to=strlen(c);\n\tp=strlen(d);\n\tq=strlen(e);\n\tr=strlen(g);\n\tif(n>=m)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==b[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<m+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=b[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==1)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=o)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==c[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<o+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=c[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==2)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=p)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\n\t\t\tif(a[i]==d[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<p+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=d[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==3)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=q)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==e[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<q+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=e[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==4)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=r)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\t\n\t\t\t\n\t\t\tif(a[i]==g[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<r+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=g[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=5;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==5)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(cnt==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n\t\t\t\t\t\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\tint n,m=1,i;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n-1;i++)\n\t{\tm=m+i;\n\t\tif(m>n)\n\t\tm=m-n;\n\t\tprintf(\"%d \",m);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include<string.h>\n\n#define problemNameSize 100\n\n\nint main()\n{\n char problemName [problemNameSize];\n\n scanf(\"%s\",problemName);\n int i,n=5,cnt=0;\n char friends[5][7] = {\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n char* strAfter = problemName;\n\n for (i = 0; i < n; i++)\n {\n if(strstr(strAfter, friends[0]) != NULL) {\n\n cnt++;\n strAfter = strAfter + strlen(friends[0]);\n\n } else if(strstr(strAfter, friends[1]) != NULL) {\n\n cnt++;\n strAfter = strAfter + strlen(friends[1]);\n\n } else if(strstr(strAfter, friends[2]) != NULL) {\n\n cnt++;\n strAfter = strAfter + strlen(friends[2]);\n\n } else if(strstr(strAfter, friends[3]) != NULL) {\n\n cnt++;\n strAfter = strAfter + strlen(friends[3]);\n\n } else if(strstr(strAfter, friends[4]) != NULL) {\n\n cnt++;\n strAfter = strAfter + strlen(friends[4]);\n\n }\n }\n //printf(\"%d \\n\",cnt);\n if(cnt == 1)\n {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n //printf(\"%I64d %I64d \\n\",sasha,lina);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,i,m;\n char s[101];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'&&s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='O'&&s[i+1]=='l'&&s[i+2]=='y'&&s[i+3]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='S'&&s[i+1]=='l'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='A'&&s[i+1]=='n'&&s[i+2]=='n'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='N'&&s[i+1]=='i'&&s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+5]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar buffer[101];\nint verifica(char s[]){\n\tif( (strstr(s,\"Danil\"))&&(!strstr(s,\"Olya\"))&&(!strstr(s,\"Slava\"))&&(!strstr(s,\"Ann\"))&&(!strstr(s,\"Nikita\")) ){\n\t\treturn 1;\t\t\n\t}\n\tif( (!strstr(s,\"Danil\"))&&(strstr(s,\"Olya\"))&&(!strstr(s,\"Slava\"))&&(!strstr(s,\"Ann\"))&&(!strstr(s,\"Nikita\")) ){\n\t\treturn 1;\t\t\n\t}\n\tif( (!strstr(s,\"Danil\"))&&(!strstr(s,\"Olya\"))&&(strstr(s,\"Slava\"))&&(!strstr(s,\"Ann\"))&&(!strstr(s,\"Nikita\")) ){\n\t\treturn 1;\t\t\n\t}\n\tif( (!strstr(s,\"Danil\"))&&(!strstr(s,\"Olya\"))&&(!strstr(s,\"Slava\"))&&(strstr(s,\"Ann\"))&&(!strstr(s,\"Nikita\")) ){\n\t\treturn 1;\t\t\n\t}\n\tif( (!strstr(s,\"Danil\"))&&(!strstr(s,\"Olya\"))&&(!strstr(s,\"Slava\"))&&(!strstr(s,\"Ann\"))&&(strstr(s,\"Nikita\")) ){\n\t\treturn 1;\t\t\n\t}\n\t\n\treturn 0;\t\n}\n\n\n\nint main(void) {\n\tscanf(\"%s\",buffer);\n\tprintf( \"%s\",verifica(buffer)?\"YES\":\"NO\");\n\treturn 0;\n}\n\n/* 1514695902196 */\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint search(char *pat, char *txt){\n int i,j,count=0;\n int M = strlen(pat);\n int N = strlen(txt);\n for(i = 0; i <= N - M; i++){\n for (j = 0; j < M; j++)\n if (txt[i+j] != pat[j])\n break;\n if (j == M)\n count++;\n }\n return count;\n}\nint main(){\n int total,i;\n char str[100];\n char friends[5][10] = {\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n scanf(\"%s\",str);\n for(i=0; i<5; i++)\n total = search(friends[i], str);\n if(total == 1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\nint i,x;\nchar A[101];\nfor(i=0;i<101;i++){\nscanf(\"%c\",&A[i]);\n }\nfor(i=0;i<101;i++){ \nif(A[i]=='O' && A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a' || A[i]=='D' && A[i+1]=='a' && A[i+2]=='n' && A[i+3]=='i' && A[i+4]=='l' || A[i]=='A' && A[i+1]=='n' && A[i+2]=='n' || A[i]=='S' && A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4]=='a' || A[i]=='N' && A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4]=='t' && A[i+5]=='a'){\nx=1;\n}\nelse \nx=0;\n}\nif(x==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\"); \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n char a[200];\n int b=0;\n gets(a);\n if(strstr(a,\"Danil\")!=0){\n b++;\n }\n if(strstr(a,\"Olya\")!=0){\n b++;\n }\n if(strstr(a,\"Slava\")!=0){\n b++;\n }\n if(strstr(a,\"Ann\")!=0){\n b++;\n }\n if(strstr(a,\"Nikita\")!=0){\n b++;\n }\n // printf(\"%d\",b);\n if(b==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\nreturn 0;\n }\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,m,f=0,o,p,q,r,cnt=0;\n\tchar a[100],b[100]={\"Danil\"},c[100]={\"Olya\"},d[100]={\"Slava\"},e[100]={\"Ann\"},g[100]={\"Nikita\"};\n\tscanf(\"%s\",a);\n\tn=strlen(a);\n\tm=strlen(b);\n\to=strlen(c);\n\tp=strlen(d);\n\tq=strlen(e);\n\tr=strlen(g);\n\tif(n>=m)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==b[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<m+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=b[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==1)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=o)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==c[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<o+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=c[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==2)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=p)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\n\t\t\tif(a[i]==d[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<p+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=d[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==3)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=q)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\n\t\t\tif(a[i]==e[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<q+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=e[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==4)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(n>=r)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\t\t\t\t\n\t\t\t\n\t\t\tif(a[i]==g[0])\n\t\t\t{\n\t\t\t\tfor(j=i;j<r+i;j++)\n\t\t\t\t{\n\t\t\t\t\tif(a[j]!=g[j-i])\n\t\t\t\t\t{\n\t\t\t\t\t\tf=0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tf=5;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(f==5)\n\t\t\t\t{\n\t\t\t\t\tcnt++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(cnt==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n\t\t\t\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n char str[101];\n int count=0;\n gets(str);\n puts(strstr(str,\"Nikita\"));\n if ((strstr(str,\"Nikita\")) && !(strstr(strstr(str,\"Nikita\")+1,\"Nikita\"))) ++count;\n if ((strstr(str,\"Danil\")) && !(strstr(strstr(str,\"Danil\")+1,\"Danil\"))) ++count;\n if ((strstr(str,\"Olya\")) && !(strstr(strstr(str,\"Olya\")+1,\"Olya\"))) ++count;\n if ((strstr(str,\"Slava\")) && !(strstr(strstr(str,\"Slava\")+1,\"Slava\"))) ++count;\n if ((strstr(str,\"Ann\")) && !(strstr(strstr(str,\"Ann\")+1,\"Ann\"))) ++count;\n if (count==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n\tchar x[105];\n\tint len,i,p=0;\n\tscanf(\"%s\",&x);\n\tfor(i=0;i<len;i++) {\n\t\tif((x[i]=='D'&&x[i+1]=='a'&&x[i+2]=='n'&&x[i+3]=='i'&&x[i+4]=='l')||(x[i]=='O'&&x[i+1]=='l'&&x[i+2]=='y'&&x[i+3]=='a')||(x[i]=='S'&&x[i+1]=='l'&&x[i+2]=='a'&&x[i+3]=='v'&&x[i+4]=='a')||(x[i]=='A'&&x[i+1]=='n'&&x[i+2]=='n')||(x[i]=='N'&&x[i+1]=='i'&&x[i+2]=='k'&&x[i+3]=='i'&&x[i+4]=='t'&&x[i+5]=='a'))\n\t\tp++;\n\t}\n\t\tif(p==1)\n\t\tprintf(\"YES\\n\");\n\t\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\t\t\t\t\n\t\t\t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint search(char *pat, char *txt){\n int i,j,count=0;\n int M = strlen(pat);\n int N = strlen(txt);\n for(i = 0; i <= N - M; i++){\n for (j = 0; j < M; j++)\n if (txt[i+j] != pat[j])\n break;\n if (j == M)\n count++;\n }\n return count;\n}\nint main(){\n int total,i;\n char str[100];\n char friends[5][10] = {\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n scanf(\"%s\",str);\n for(i=0; i<5; i++)\n total = search(friends[i], str);\n if(total == 1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int l,i,m;\n char s[101];\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='D'&&s[i+1]=='a'&&s[i+2]=='n'&&s[i+3]=='i'&&s[i+4]=='l'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='O'&&s[i+1]=='l'&&s[i+2]=='y'&&s[i+3]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='S'&&s[i+1]=='l'&&s[i+2]=='a'&&s[i+3]=='v'&&s[i+4]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='A'&&s[i+1]=='n'&&s[i+2]=='n'){\n printf(\"YES\\n\");\n return 0;\n }\n else if(s[i]=='N'&&s[i+1]=='i'&&s[i+2]=='k'&&s[i+3]=='i'&&s[i+4]=='t'&&s[i+5]=='a'){\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\nint i,x;\nchar A[101];\nfor(i=0;i<101;i++){\nscanf(\"%c\",&A[i]);\n }\nfor(i=0;i<101;i++){ \nif((A[i]=='O' && A[i+1]=='l' && A[i+2]=='y' && A[i+3]=='a') || (A[i]=='D' && A[i+1]=='a' && A[i+2]=='n' && A[i+3]=='i' && A[i+4]=='l') || A[i]=='A' && A[i+1]=='n' && A[i+2]=='n' || A[i]=='S' && A[i+1]=='l' && A[i+2]=='a' && A[i+3]=='v' && A[i+4]=='a' || (A[i]=='N' && A[i+1]=='i' && A[i+2]=='k' && A[i+3]=='i' && A[i+4]=='t' && A[i+5]=='a')){\nx++;\n}\nelse \nx=0;\n}\nif(x==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\"); \n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,i;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",n+n/2);\n for (i=2;i<=n;i+=2) printf(\"%d \",i);\n for (i=1;i<=n;i+=2) printf(\"%d \",i);\n for (i=2;i<=n;i+=2) printf(\"%d \",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\nint f=1,i,j,k,ql,nl;\n scanf(\"%s\",&s);\n ql=strlen(s);\n for(i=0;i<5;i++)\n {\n \tnl=strlen(name[i]);\n \tfor(j=0;j<ql-nl+1;j++)\n \t{\n \t for(k=0;k<nl;k++) \n { if(s[j+k] != name[i][k]) \n { f=0;}\n }\n }\n }\n\nif(f)\n {printf(\"YES\");}\nelse \n {printf(\"NO\");}\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid main()\n{\nlong long i,b,c;int flag,j;flag=0;b=c=0;char s[101],*ptr;int p[5]={0,0,0,0,0};\nscanf(\"%s\",&s);\nchar *a[5]={\"Danil\",\"Olya\",\"Slava\",\"Ann\",\"Nikita\"};\n\n\nfor(i=0;i<5;i++)\n{\n\nptr=strstr(s,a[i]);\nif(ptr!=NULL){\np[i]++;\nfor(j=0;j<strlen(a[i]);j++)\n\tptr++;\nstrcpy(s,ptr);\n\ni=i-1;\n}\n\nelse\ncontinue;\n\n}\n\nfor(i=0;i<5;i++)\n{\nif(p[i]==0)\nb++;\n\nelse\n{\nif(p[i]>1)\n{\nflag=1;\nbreak;\n}\n\nif(p[i]==1)\nc++;\n}}\n\nif((b==5)||(flag==1)||(c>1))\nprintf(\"NO\\n\");\nelse\nprintf(\"YES\\n\");\nexit(0);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n,k=0;\n\tint d;\n\tscanf(\"%lld\",&n);\n\t{\n\t\twhile(n!=0)\n\t\t{\n\t \n\t\t\td=n%10;\n\t\t\tif(d==4||d==7)\n\t\t\t{\n\t\t\t\tk++;\n\t\t\t}\n\t\t\tn=n/10;\n\t\t}\n\t}\t\n\tif((k==4 || k==7)&&k!=0)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\t\t\t\t\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100],w[5]=\"Danil\",x[4]=\"Olya\",y[3]=\"Ann\",z[6]=\"Nikita\";\n int i,j,k,n;\n gets(a);\n n=strlen(a);\n k=0;\n for(i=0,j=0;i<n;i++)\n {\n if((a[i]==w[j] && a[i+1]==w[j+1] && a[i+2]==w[j+2] && a[i+3]==w[j+3] && a[i+4]==w[j+4]) || (a[i]==x[j] && a[i+1]==x[j+1] && a[i+2]==x[j+2] && a[i+3]==x[j+3]) || (a[i]==y[j] && a[i+1]==y[j+1] && a[i+2]==y[j+2]) || (a[i]==z[j] && a[i+1]==z[j+1] && a[i+2]==z[j+2] && a[i+3]==z[j+3] && a[i+4]==z[j+4] && a[i+5]==z[j+5]) )\n {\n k++;\n }\n }\n if(k==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n char str[101];\n int count=0;\n gets(str);\n puts(strstr(str,\"Nikita\"));\n if ((strstr(str,\"Nikita\")) && !(strstr(strstr(str,\"Nikita\")+1,\"Nikita\"))) ++count;\n if ((strstr(str,\"Danil\")) && !(strstr(strstr(str,\"Danil\")+1,\"Danil\"))) ++count;\n if ((strstr(str,\"Olya\")) && !(strstr(strstr(str,\"Olya\")+1,\"Olya\"))) ++count;\n if ((strstr(str,\"Slava\")) && !(strstr(strstr(str,\"Slava\")+1,\"Slava\"))) ++count;\n if ((strstr(str,\"Ann\")) && !(strstr(strstr(str,\"Ann\")+1,\"Ann\"))) ++count;\n if (count==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint check(char[],char[]);\nint main(){\nchar s[100];\n char name[100][100]={\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\"};\n int i,j,k,l1,l2,c=0; \n scanf(\"%s\",&s);\nstrlen(s);\n for(i=0;i<5;i++)\n {\n \tl2=strlen(name[i]);\n \tfor(j=0;j<l1-l2+1;j++)\n \t{\n \t\tint f=1;\n \t\tfor(k=0;k<l2;k++) if(s[j+k] = name[i][k]) f=0;\n \t\t\n \t\tif(f) c++;\n\t }\n }\n\nif(c==1) printf(\"YES\");\nelse printf(\"NO\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tchar a[110];\n\tgets(a);\n\tint length=strlen(a),flag=0,one=0,two=0,three=0,four=0,five=0,sum,i;\n\tfor( i=0;i<length;i++)\n\t{\n\t\tif(a[i]=='D')\n\t\t{\n\t\t\tif(a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]=='i'&&a[i+4]=='l')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tone=1;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='O')\n\t\t{\n\t\t\tif(a[i+1]=='l'&&a[i+2]=='y'&&a[i+3]=='a')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\ttwo=1;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='S')\n\t\t{\n\t\t\tif(a[i+1]=='l'&&a[i+2]=='a'&&a[i+3]=='v'&&a[i+4]=='a') \n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tthree=1;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='A')\n\t\t{\n\t\t\tif(a[i+1]=='n'&&a[i+2]=='n') \n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tfour=1;\n\t\t\t}\n\t\t}\n\t\telse if(a[i]=='N')\n\t\t{\n\t\t\tif(a[i+1]=='i'&&a[i+2]=='k'&&a[i+3]=='i'&&a[i+4]=='t'&&a[i+5]=='a')\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tfive=1;\n\t\t\t}\n\t\t}\n\t}\n\tsum=one+two+three+four+five;\n\tif(flag==1&&sum==1)printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <time.h>\n\n\nint main(){\n char mystring[5001];\n scanf(\"%s\", mystring);\n int ct,length;\n for(ct = 0 ; ct < 5001 ; ct++){\n if(mystring[ct] == '\\0'){\n length = ct;\n break;\n }\n }\n int blocks[5005] = {0};\n int changes = 0;\n int counter = 0;\n char currentstage = 'a';\n for(ct = 0 ; ct < length ; ct++){\n if(mystring[ct] != currentstage){\n blocks[changes] = counter;\n counter = 1;\n changes++;\n currentstage = mystring[ct];\n }else{\n counter++;\n }\n }\n blocks[changes] = counter;\n if(changes <= 2){\n printf(\"%d\", length);\n return 0;\n }\n //printf(\"%d\\t%d\\t%d\\t%d\\t\\t%d\\n\", blocks[0], blocks[1], blocks[2], blocks[3], changes);\n int max = 0, ct2, ct3;\n for(ct = 0 ; ct <= changes + 2 ; ct+=2){\n for(ct2 = ct + 1 ; ct2 <= changes + 2 ; ct2+=2){\n for(ct3 = ct2 + 1 ; ct3 <= changes + 2; ct3 += 2){\n if(blocks[ct3] + blocks[ct2] + blocks[ct] > max){\n max = blocks[ct3] + blocks[ct2] + blocks[ct];\n }\n }\n }\n }\n\n printf(\"%d\", max);\n\n}"}], "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710"} {"nl": {"description": "Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to them to play a game under the code name \"dot\" with the following rules: On the checkered paper a coordinate system is drawn. A dot is initially put in the position (x,\u2009y). A move is shifting a dot to one of the pre-selected vectors. Also each player can once per game symmetrically reflect a dot relatively to the line y\u2009=\u2009x. Anton and Dasha take turns. Anton goes first. The player after whose move the distance from the dot to the coordinates' origin exceeds d, loses. Help them to determine the winner.", "input_spec": "The first line of the input file contains 4 integers x, y, n, d (\u2009-\u2009200\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009200,\u20091\u2009\u2264\u2009d\u2009\u2264\u2009200,\u20091\u2009\u2264\u2009n\u2009\u2264\u200920) \u2014 the initial coordinates of the dot, the distance d and the number of vectors. It is guaranteed that the initial dot is at the distance less than d from the origin of the coordinates. The following n lines each contain two non-negative numbers xi and yi (0\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009200) \u2014 the coordinates of the i-th vector. It is guaranteed that all the vectors are nonzero and different.", "output_spec": "You should print \"Anton\", if the winner is Anton in case of both players play the game optimally, and \"Dasha\" otherwise.", "sample_inputs": ["0 0 2 3\n1 1\n1 2", "0 0 2 4\n1 1\n1 2"], "sample_outputs": ["Anton", "Dasha"], "notes": "NoteIn the first test, Anton goes to the vector (1;2), and Dasha loses. In the second test Dasha with her first move shifts the dot so that its coordinates are (2;3), and Anton loses, as he has the only possible move \u2014 to reflect relatively to the line y\u2009=\u2009x. Dasha will respond to it with the same move and return the dot in position (2;3)."}, "positive_code": [{"source_code": "#include <stdio.h>\nint main (){\n\tint a, b, d, n, i, j, t, s, k;\n\tscanf (\"%d%d%d%d\", &a, &b, &n, &d);\n\tint x[10000];\n\tint y[10000];\n\tfor (i = 0; i < n; i++) {\n\t\tscanf (\"%d%d\", x + i, y + i);\n\t}\n\tint xx = d - a;\n\tif (b < a) xx = d - b;\n\tint r[401][401][2][2];\n\tint ss;\n\tfor (ss = 2*xx; ss >= 0; ss--)\n\t\tfor (t = 0; t < 2; t++) for (s = 0; s < 2; s++) {\n\t\t\tfor (j = xx; j >= 0; j--) {\n\t\t\t\ti = ss - j;\n\t\t\t\tif (i < 0 || i > xx) continue;\n\t\t\t\tr[i][j][t][s] = 0;\n\t\t\t\tif ((i + a) * (i + a) + (j + b) * (j + b) > d * d) {\n\t\t\t\t\tr[i][j][t][s] = 1; continue;\n\t\t\t\t}\n\t\t\t\tif (t == 1 && r[j][i][s][0] == 0) {\n\t\t\t\t\tr[i][j][t][s] = 1; continue;\n\t\t\t\t}\n\t\t\t\tfor (k = 0; k < n; k++) {\n\t\t\t\t\tif (i + x[k] <= xx && j + y[k] <= xx && r[i + x[k]][j + y[k]][s][t] == 0) {\n\t\t\t\t\t\tr[i][j][t][s] = 1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tif (r[0][0][1][1]) printf(\"Anton\\n\");\n\telse printf (\"Dasha\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define rep(i,n) for(i=0;i<n;i++)\n#define N 404\n\nint x, y, n, d, vx[20], vy[20], mem[N][N];\n\nint rec( int a, int b )\n{\n\tif( a*a + b*b > d*d ) return 1;\n\tint *ans = &mem[a+N/2][b+N/2];\n\tif( *ans > -1 ) return *ans;\n\tint i;\n\trep(i,n) if( !rec( a+vx[i], b+vy[i] ) ) return *ans = 1;\n\treturn *ans = 0;\n}\n\nint main()\n{\n\tint i, j;\n\trep(i,N) rep(j,N) mem[i][j] = -1;\n\tscanf( \"%d%d%d%d\", &x, &y, &n, &d );\n\tfor( i = 0; i < n; i++ ) scanf( \"%d%d\", &vx[i], &vy[i] );\n\tprintf( rec(x,y) ? \"Anton\\n\" : \"Dasha\\n\" );\n\treturn 0;\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define N\t20\n#define Z\t600\n\nint main() {\n\tstatic char win[Z + 1][Z + 1];\n\tstatic int xx[N], yy[N];\n\tint x, y, n, d, i, x_, y_;\n\n\tscanf(\"%d%d%d%d\", &x, &y, &n, &d);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d\", &xx[i], &yy[i]);\n\tfor (x_ = 0; x_ <= Z; x_++)\n\t\tfor (y_ = 0; y_ <= Z; y_++)\n\t\t\tif ((x_ + x) * (x_ + x) + (y_ + y) * (y_ + y) > d * d)\n\t\t\t\twin[x_][y_] = 1;\n\tfor (x_ = Z; x_ >= 0; x_--)\n\t\tfor (y_ = Z; y_ >= 0; y_--)\n\t\t\tif (!win[x_][y_])\n\t\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\t\tx = x_ - xx[i];\n\t\t\t\t\ty = y_ - yy[i];\n\t\t\t\t\tif (x >= 0 && y >= 0)\n\t\t\t\t\t\twin[x][y] = 1;\n\t\t\t\t}\n\tprintf(win[0][0] ? \"Anton\\n\" : \"Dasha\\n\");\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "645a6ca9a8dda6946c2cc055a4beb08f"} {"nl": {"description": "One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let's assume that Misha chose number m, and Andrew chose number a.Then, by using a random generator they choose a random integer c in the range between 1 and n (any integer from 1 to n is chosen with the same probability), after which the winner is the player, whose number was closer to c. The boys agreed that if m and a are located on the same distance from c, Misha wins.Andrew wants to win very much, so he asks you to help him. You know the number selected by Misha, and number n. You need to determine which value of a Andrew must choose, so that the probability of his victory is the highest possible.More formally, you need to find such integer a (1\u2009\u2264\u2009a\u2009\u2264\u2009n), that the probability that is maximal, where c is the equiprobably chosen integer from 1 to n (inclusive).", "input_spec": "The first line contains two integers n and m (1\u2009\u2264\u2009m\u2009\u2264\u2009n\u2009\u2264\u2009109) \u2014 the range of numbers in the game, and the number selected by Misha respectively.", "output_spec": "Print a single number \u2014 such value a, that probability that Andrew wins is the highest. If there are multiple such values, print the minimum of them.", "sample_inputs": ["3 1", "4 3"], "sample_outputs": ["2", "2"], "notes": "NoteIn the first sample test: Andrew wins if c is equal to 2 or 3. The probability that Andrew wins is 2\u2009/\u20093. If Andrew chooses a\u2009=\u20093, the probability of winning will be 1\u2009/\u20093. If a\u2009=\u20091, the probability of winning is 0.In the second sample test: Andrew wins if c is equal to 1 and 2. The probability that Andrew wins is 1\u2009/\u20092. For other choices of a the probability of winning is less."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,x,y;\n scanf(\"%lld %lld\",&n,&m);\n if(n%2==0) {\n x=n/2;\n y=x+1;\n if(m==x)\n printf(\"%lld\\n\",y);\n else if(m==y)\n printf(\"%lld\\n\",x);\n else if (x<m)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\\n\",m+1);\n\n\n\n }\n else\n {\n if(n==1)\n printf(\"1\\n\");\n else if ((n/2)<m)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\",m+1);\n\n\n\n\n\n\n\n\n }\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n==a && n==1){\n printf(\"1\");\n }else{\n \n printf(\"%lld\",(n-a>a-1)?a+1:a-1);\n }\n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n if(n==1)\n printf(\"1\\n\");\n else\n {\n if((m-1)>=(n-m))\n {\n printf(\"%lld\\n\",m-1);\n }\n else\n printf(\"%lld\\n\",m+1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ unsigned long long n,m,r1,r2;\n scanf(\"%llu %llu\",&n,&m);\n if(n==1&&m==1)\n printf(\"%llu\",n);\n else{\n r1=m-1;\n r2=n-m;\n if(r1>=r2){\n printf(\"%llu\",m-1);\n }\n else\n printf(\"%llu\",m+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint m, n, a;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n%2==1 && m==(n/2+1))\n\t\ta = m-1;\n\telse\n\t{\n\t\tif(m<=n/2)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\tif(a<1)\n\t\ta++;\n\t\n\tprintf(\"%d\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nshort main()\n{\n long long n,m;scanf(\"%I64d %I64d\",&n,&m);\n printf(\"%I64d\\n\",((n==1&&m==1)?1:(n-m>m-1)?m+1:(n-m==n/2)?n-m:m-1));\n return 0;}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,n;scanf(\"%d%d\",&n,&m);\n if(n==1 && m==1){printf(\"%d\",1);}\n else if(n%2==1 && m*2-1==n)\n {printf(\"%d\",m-1);}\n else if(n%2==1 && m*2-1>n)\n {printf(\"%d\",m-1);}\n else if(n%2==1)\n {printf(\"%d\",m+1);}\n else printf(\"%d\",m*2<=n?m+1:m-1);\n \n return 0;\n}"}, {"source_code": "\n #include<stdio.h>\nint main(){\nint n,m,a;\nscanf(\"%d %d\",&n,&m);\n\n\nif(n==1)\nprintf(\"1\");\nelse if((n-m)>(m-1))\nprintf(\"%d\\n\",m+1);\nelse\nprintf(\"%d\\n\",m-1);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int m,n,i;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(m==1 && n==1)\n\t\ti=1;\n\telse if(m<(1+n)/2 || (m==(1+n)/2 && n%2==0))\n\ti=m+1;\n\telse\n\t\ti=m-1;\n\tprintf(\"%ld\\n\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tprintf(\"%d\\n\",m-1>=n-m?(m-1>1?m-1:1):(m+1<n?m+1:n));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int m,n,i;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(m==1 && n==1)\n\t\ti=1;\n\telse if(m<(1+n)/2 || (m==(1+n)/2 && n%2==0))\n\ti=m+1;\n\telse\n\t\ti=m-1;\n\tprintf(\"%ld\\n\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,x,y;\n scanf(\"%lld %lld\",&n,&m);\n if(n%2==0) {\n x=n/2;\n y=x+1;\n if(m==x)\n printf(\"%lld\\n\",y);\n else if(m==y)\n printf(\"%lld\\n\",x);\n else if (x<m)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\\n\",m+1);\n\n\n\n }\n else\n {\n if(n==1)\n printf(\"1\\n\");\n else if ((n/2)<m)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\",m+1);\n\n\n\n\n\n\n\n\n }\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n , m , a , d;\n scanf(\"%d%d\" , &n , &m);\n if(n == 1)\n {\n printf(\"%d\" , 1);\n }\n else\n {\n if(n - m > m - 1)\n a = m + 1;\n else\n a = m - 1;\n printf(\"%d\" , a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int i,n,m,a,x;\n scanf(\"%I64d %I64d\",&n,&m);\n if(n==1 && m==1)\n {\n printf(\"1\");\n return 0;\n }\n if(n%2!=0)\n {\n x=ceil(n*1.0/2);\n //printf(\"%I64d\\n\",x);\n if(m<x)\n {\n a=m+1;\n }\n else if(m>x)\n {\n a=m-1;\n }\n else if(m==x)\n {\n a=x-1;\n }\n }\n else if(n%2==0)\n {\n x=n/2;\n if(m<x)\n {\n a=m+1;\n }\n else if(m>x)\n {\n a=m-1;\n }\n else if(m==x)\n {\n a=x+1;\n }\n }\n printf(\"%I64d\",a);\n for(i=0;i<999999999;i++)\n {\n i=i;\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\nint main(void){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int ans=0;\n if(n%2==1){\n if(m<=n/2) ans=m+1;\n else ans=m-1;\n }\n else{\n if(m<=n/2) ans=m+1;\n else ans=m-1;\n }\n if(n==1) ans=1;\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(m<n/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>n/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m+1);\n }\n }\n else\n {\n if(m<(n+1)/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>(n+1)/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n if(m==1 && n==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\",m-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tif(m>1||n>1)\n {\n\tif(n==m)\n\tprintf(\"%d\",m-1);\n\telse if(m>n-m)\n\tprintf(\"%d\",m-1);\n\telse\n\tprintf(\"%d\",m+1);\n\t}\n\telse\n\tprintf(\"%d\",m);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,a,c;\n scanf(\"%d %d\",&n,&a);\n if(n==1)\n printf(\"1\\n\");\n else if(a>n/2)\n printf(\"%d\\n\",a-1);\n else\n printf(\"%d\\n\",a+1);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int a,n,m,b;\n while(~scanf(\"%d%d\",&n,&m))\n {\n a=m-1;\n b=m+1;\n if(n==1)\n printf(\"1\\n\");\n else if(m-1<n-m) printf(\"%d\\n\",b);\n else printf(\"%d\\n\",a);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int n,m,x;\n scanf(\"%d %d\",&n,&m);\n if(n==1 && m==1) {\n printf(\"1\\n\");\n return 0;\n }\n if(n%2==0) {\n x=n/2;\n }\n else{\n x=n/2+1;\n }\n if(n%2!=0 && x==m) {\n x--;\n }\n if(n%2==0 && x==m) {\n x++;\n }\n else if(x>m) {\n x=m+1;\n }\n else {\n x=m-1;\n }\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n long long int n,m,x1,x2;\n scanf(\"%lld%lld\",&n,&m);\n if (n==1 &&m==1)\n {\n printf(\"1\\n\");\n }\n else if((n-m)>m-1)\n {\n printf(\"%lld\\n\",m+1);\n }\n else\n {\n printf(\"%lld\\n\",m-1);\n }\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nmain() {\n\tint n,m,a;\n\tscanf(\"%d %d\",&n,&m);\n\tif (m-1<n-m) a=m+1;\n\telse a=m-1;\n\tif (!a) a=m=1;\n\tif (a>n) a=m;\n\tprintf(\"%d\",a);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n if(n==1)\n \tprintf(\"1\\n\");\n else if(m - 1 < n - m)\n \tprintf(\"%d\",(m+1));\n else\n \tprintf(\"%d\",(m-1));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,result;\n while(scanf(\"%lld%lld\",&n,&m)==2)\n { if(n==m&&m==1)\n result=1;\n else{ if((n-m-1)>=(m-1))\n result =m+1;\n else result =m-1;\n }\n printf(\"%lld\\n\",result);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n\n if(n==1)\n { printf(\"%lld\\n\",m); return 0;}\n \n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long int n ,m;\n scanf(\"%I64d%I64d\",&n,&m);\n if( n==1 ) { printf(\"1\"); return 0;}\n if( ( m-1 ) >= ( n-m ) ) printf(\"%I64d\",m-1);\n else printf(\"%I64d\",m+1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n\n if(n==1)\n { printf(\"%lld\\n\",m); return 0;}\n \n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int a,m,n,c;\nscanf(\"%lld%lld\",&n,&m);\nif(n%2!=0)\n{\nif(m<(n+1)/2)\na=m+1;\nelse\na=m-1;\n}\nelse\n{\nif(m>n/2)\na=m-1;\nelse //if(m<((n/2)+1))\na=m+1;\n}\nif(a<1)a++;\nprintf(\"%lld\",a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\n long long int a,b,c,n,m;\n scanf(\"%I64d %I64d\",&n,&m);\n if((m-1)<(n-m))\n {\n\n a=m+1;\n }\n if((m-1)>(n-m))\n {\n\n a=m-1;\n if(a==0)\n a=a+1;\n\n }\n if((m-1)==(n-m))\n {\n a=m-1;\n if(a==0)\n a=a+1;\n }\n\n\n\n printf(\"%I64d\",a);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long int n ,m;\n scanf(\"%I64d%I64d\",&n,&m);\n if( n==1 ) { printf(\"1\"); return 0;}\n if( ( m-1 ) >= ( n-m ) ) printf(\"%I64d\",m-1);\n else printf(\"%I64d\",m+1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b;\n scanf(\"%d %d\",&n,&m);\n if(n==1 && m==1)\n printf(\"1\");\n else\n {\n a=m-1;\n b=n-m;\n if(a>=b)\n printf(\"%d\",m-1);\n else\n printf(\"%d\",m+1);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint mid,ans;\n\tif(n%2==0)\n\t{\n\t\tmid = n/2;\n\t\tif(m>mid)\n\t\t\tans= m-1;\n\t\telse\n\t\t\tans = m+1;\n\t}\n\telse\n\t{\n\t\tmid = (n+1)/2;\n\t\tif(m>mid)\n\t\t\tans=m-1;\n\t\telse if(mid==m)\n\t\t\tans=m-1;\n\t\telse\n\t\t\tans = m+1;\n\t}\n\t\tif(ans==0)\n\t\t\tans=1;\n\tprintf(\"%d\\n\",ans);\n\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, a, c;\n scanf(\"%d %d\", &n, &m);\n c=n-m;\n if(c>=m){\n a=m+1;\n }else{\n a=m-1;\n }\n if(n==1 && m==1) {\n a=1;\n }\n printf(\"%d\\n\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(m<n/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>n/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m+1);\n }\n }\n else\n {\n if(m<(n+1)/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>(n+1)/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n if(m==1 && n==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\",m-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,mid,result;\n\tscanf(\"%d%d\",&n,&m);\n\tif(n%2==0)\n\t{\n\t\tmid=n/2;\n\t\tif(m>mid)\n\t\t{\n\t\t\tresult=m-1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult=m+1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tmid=n/2+1;\n\t\tif(m<mid)\n\t\t\tresult=m+1;\n\t\telse\n\t\t\tresult=m-1;\n\t}\n\tif(result==0)\n\t\tresult=1;\n\tprintf(\"%d\",result);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int n,m,k;\n scanf(\"%d %d\",&n,&m);\n if(n==1){\n printf(\"%d\",n);\n return 0;\n }\n if(m>n/2){\n k=m-1;\n }\n else k=m+1;\n printf(\"%d\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, m;\n scanf(\"%ld %ld\", &n, &m);\n if (n == 1) printf(\"1\\n\");\n else printf(\"%ld\\n\",(m > n/2)?m-1:m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,m,a;\n\n scanf(\"%lld %lld\",&n,&m);\n\n if(n==1)\n a=n;\n else if((n-m)>(m-1))\n a=m+1;\n else\n a=m-1;\n\n printf(\"%lld\\n\",a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n==1)\n printf(\"1\");\n else if(m-1>=n-m)\n printf(\"%d\",m-1);\n else\n printf(\"%d\",m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define max(a,b) a<b? 1:0\nint main()\n{\n int m,n,x;\n scanf(\"%d %d\",&n,&m);\n x=max(m-1,n-m);\n if(n==1)\n {\n printf(\"%d\",1); \n return 0;\n }\n if(x==0)\n printf(\"%d\",m-1);\n else\n printf(\"%d\",m+1);\n}"}, {"source_code": "#include <stdio.h>\n \nint main()\n{\n\t\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\n\tif(n==1 && m==1){\n\t\tprintf(\"%d\",m);\n\t}\n\telse if(m<=(n/2) || m==1){\n\t\tprintf(\"%d\",m+1);\n\t}\n\telse{\n\t\tprintf(\"%d\",m-1);\n\t}\n\treturn 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int n,m,x;\n scanf(\"%d%d\",&n,&m);\n if(n==1){\n printf(\"1\\n\");\n return 0;\n }\n if(n%2){\n x=n/2+1;\n if(m<x)\n printf(\"%d\\n\",m+1);\n else\n printf(\"%d\\n\",m-1);\n }\n else{\n x=n/2;\n if(m<=x)\n printf(\"%d\\n\",m+1);\n else\n printf(\"%d\\n\",m-1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,m,n,z;\n scanf(\"%lld%lld\",&n,&m);\n a=n-m;\n b=m-1;\n if(n==1&&m==1)\n printf(\"1\\n\");\n else if(b>=a)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%d\\n\", n == 1 ? 1 : n - m > m - 1 ? m + 1 : m - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,mid,result;\n\tscanf(\"%d%d\",&n,&m);\n\tif(n%2==0)\n\t{\n\t\tmid=n/2;\n\t\tif(m>mid)\n\t\t{\n\t\t\tresult=m-1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tresult=m+1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tmid=n/2+1;\n\t\tif(m<mid)\n\t\t\tresult=m+1;\n\t\telse\n\t\t\tresult=m-1;\n\t}\n\tif(result==0)\n\t\tresult=1;\n\tprintf(\"%d\",result);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,m,n,z;\n scanf(\"%lld%lld\",&n,&m);\n a=n-m;\n b=m-1;\n if(n==1&&m==1)\n printf(\"1\\n\");\n else if(b>=a)\n printf(\"%lld\\n\",m-1);\n else\n printf(\"%lld\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%d\\n\", n == 1 ? 1 : n - m > m - 1 ? m + 1 : m - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong int n, m;\n\tscanf(\"%ld %ld\", &n, &m);\n\tif(n%2==0)\n\t{\n\t\tif(m > n/2)\n\t\tprintf(\"%ld\", m-1);\n\t\telse \n\t\tprintf(\"%ld\", m+1);\n\t}\n\telse \n\t{\n\t\tif(m==1, n==1)\n\t\t{\n\t\t\tprintf(\"1\");\n\t\t}\n\t\telse if(m >= (n+1)/2)\n\t\tprintf(\"%ld\", m-1);\n\t\telse \n\t\tprintf(\"%ld\", m+1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n\t{\n\tlong long int n,m,a;scanf(\"%I64d%I64d\",&n,&m);\n\tif(m>abs(n-m)) if(n==1) a=1;else a=m-1;\n\telse a=m+1;\n\tprintf(\"%I64d\",a);\n\treturn 0;\n\t}\n\t\t\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n if(n == 1)\n printf(\"1\");\n else if(m - 1 < n - m)\n printf(\"%d\", m + 1);\n else\n printf(\"%d\", m - 1);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(m<n/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>n/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m+1);\n }\n }\n else\n {\n if(m<(n+1)/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>(n+1)/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n if(m==1 && n==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\",m-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b, c, n, m;\n scanf(\"%d %d\", &n, &m);\n if(m==1 && n!=1){\n printf(\"%d\", m+1);\n return 0;\n }\n if(n==1){\n printf(\"1\");\n return 0;\n }\n if(m==n){\n printf(\"%d\", n-1);\n return 0;\n }\n b = n-m;\n if(b<m){\n printf(\"%d\", m-1);\n }\n else{\n printf(\"%d\", m+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n, m;\nint main(int argc, char **argv){\n\tscanf(\"%d%d\", &n, &m);\n\tif (n == 1) printf(\"1\\n\");\n\telse if (m > n / 2) printf(\"%d\\n\", m - 1);\n\telse printf(\"%d\\n\", m + 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nshort main()\n{\n long long n,m;scanf(\"%I64d %I64d\",&n,&m);\n printf(\"%I64d\\n\",((n==1&&m==1)?1:(n-m>m-1)?m+1:(n-m==n/2)?n-m:m-1));\n return 0;}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{ \n\tint n,m,a;\n\tscanf(\"%d %d\",&n,&m);\n\tif(n-m>m-1)\n\t\ta=m+1;\n\telse\n\t\ta=m-1;\n\tif(a==0)\n\t\ta++;\n\tprintf(\"%d\",a);\n\treturn 0;\n} \n "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint m, n, a;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n%2==1 && m==(n/2+1))\n\t\ta = m-1;\n\telse\n\t{\n\t\tif(m<=n/2)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\tif(a<1)\n\t\ta++;\n\t\n\tprintf(\"%d\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, m;\n scanf(\"%ld %ld\", &n, &m);\n if (n == 1) printf(\"1\\n\");\n else printf(\"%ld\\n\",(m > n/2)?m-1:m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int n,m,x;\n scanf(\"%d%d\",&n,&m);\n if(n==1){\n printf(\"1\\n\");\n return 0;\n }\n if(n%2){\n x=n/2+1;\n if(m<x)\n printf(\"%d\\n\",m+1);\n else\n printf(\"%d\\n\",m-1);\n }\n else{\n x=n/2;\n if(m<=x)\n printf(\"%d\\n\",m+1);\n else\n printf(\"%d\\n\",m-1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tif (n==1){printf(\"%d\",n);}\n\telse{\n\tif ((float)n/2>m){printf(\"%d\",m+1);}\n\telse if ((float)n/2<m){printf(\"%d\",m-1);}\n\telse {printf(\"%d\",m+1);}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int m,n,i;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(m==1 && n==1)\n\t\ti=1;\n\telse if(m<(1+n)/2 || (m==(1+n)/2 && n%2==0))\n\ti=m+1;\n\telse\n\t\ti=m-1;\n\tprintf(\"%ld\\n\",i);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long n,m;\n scanf(\"%I64d %I64d\",&n,&m);\n if(n==1)\n printf(\"1\");\n else if(n%2==0){\n if(m>n/2)\n printf(\"%I64d\",m-1);\n else\n printf(\"%I64d\",m+1);\n }\n else{\n if(m>=n/2+1)\n printf(\"%I64d\",m-1);\n else\n printf(\"%I64d\",m+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n int n, a;\n int mid, and;\n\n scanf(\"%d %d\", &n, &a);\n if(n==1) printf(\"1\\n\");\n else if(n%2==1){\n mid=(n/2)+1;\n if(a>mid) printf(\"%d\\n\", a-1);\n else if(a<mid) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\", mid-1);\n }\n else {\n mid=(n/2);\n if(a>mid) printf(\"%d\\n\", a-1);\n else printf(\"%d\\n\",a+1);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main ()\n{\n int n,m,c,a;\n scanf(\"%d %d\",&n,&m);\n if(n==1 && m==1)\n a=1;\n else if(abs(n-m)>abs(m-1))\n a=m+1;\n else\n a=m-1;\n printf(\"%d\\n\",a);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\t int n,m;\n\t scanf(\"%d %d\",&n,&m);\n\t if(n==1) printf(\"1\\n\");\n\t else\n\t {\n\t\t int x=n-m, y=m-1;\n\t\t if(x>y) printf(\"%d\\n\",m+1);\n\t\t else printf(\"%d\\n\",m-1);\n\t\t return 0;\n\t }\n\t \n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n double mid;\n int n, m, a;\n \n scanf(\"%d %d\", &n, &m); \n \n mid = n / 2.0;\n a = m > mid ? m - 1: m + 1;\n \n if (n == 1) {\n printf(\"1\\n\");\n } else {\n printf(\"%d\\n\", a);\n }\n \n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if (((a+1)/2)>b && (b+1)<=a)\n \n printf(\"%lld\\n\",b+1);\n else if (((a+1)/2)==b && (b+1)<=a && a%2==0)\n printf(\"%lld\\n\",b+1);\n \n else if (b-1>0)\n printf(\"%lld\\n\",b-1);\n else\n printf(\"%lld\\n\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,m,misha,res,x,choto,ans;\n scanf(\"%d %d\",&n,&m);\n /*x=n-m;\n misha=(x/2)*(1+x);\n x=m-1;\n misha+=(x/2)*(1+x);\n x=n-1;\n choto=(x/2)*(1+x);\n ans=1;\n for(i=2;i<=n;i++)\n {\n if(i==m)\n continue;\n x=n-i;\n res=(x/2)*(1+x);\n x=i-1;\n res+=(x/2)*(1+x);\n if(choto>res)\n {\n choto=res;\n ans=i;\n }\n }*/\n if(n-m>m-1)\n ans=m+1;\n else if(n-m==m-1)\n ans=m-1;\n else\n ans=m-1;\n if(n==1)\n ans=1;\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main ()\n{\n int n,m,c,a;\n scanf(\"%d %d\",&n,&m);\n if(n==1 && m==1)\n a=1;\n else if(abs(n-m)>abs(m-1))\n a=m+1;\n else\n a=m-1;\n printf(\"%d\\n\",a);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long int n ,m;\n scanf(\"%I64d%I64d\",&n,&m);\n if( n==1 ) { printf(\"1\"); return 0;}\n if( ( m-1 ) >= ( n-m ) ) printf(\"%I64d\",m-1);\n else printf(\"%I64d\",m+1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,m,a;\nscanf(\"%d %d\",&n,&m);\n\n\nif(n==1)\nprintf(\"1\");\nelse if((n-m)>(m-1))\nprintf(\"%d\\n\",m+1);\nelse\nprintf(\"%d\\n\",m-1);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, m;\n scanf(\"%ld %ld\", &n, &m);\n if (n == 1) printf(\"1\\n\");\n else printf(\"%ld\\n\",(m > n/2)?m-1:m+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\nlong int m,n,a,b;\nscanf(\"%li%li\",&n,&m);\na=abs(m-1);\nb=abs(n-m);\nif(b>a)\nprintf(\"%li\",m+1);\nelse if(a>b)\nprintf(\"%li\",m-1);\nelse if(a==b && a!=0)\nprintf(\"%li\",m-1);\nelse\nprintf(\"1\");\n}\n"}, {"source_code": "#include <stdio.h>\n//#include <stdlib.h>\n\nint main(void)\n{\n\tlong n, m, a, mid;\n\tscanf(\"%ld%ld\", &n, &m);\n\tmid = (n + 1) / 2;\n\tif(m > mid)\n\t{\n\t\ta = m - 1;\n\t}\n\telse\n\t{\n\t\tif(m < mid)\n\t\t{\n\t\t\ta = m + 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n % 2)\n\t\t\t{\n\t\t\t\ta = m - 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ta = m + 1;\n\t\t\t}\n\t\t}\n\t}\n\tif(a < 1)\n\t{\n\t\ta = 1;\n\t}\n\telse\n\t{\n\t\tif(a > n)\n\t\t{\n\t\t\ta = n;\n\t\t}\n\t}\n\tprintf(\"%ld\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m,n;\n\n scanf(\"%d %d\",&n,&m);\n\n if(n-m>m-1){\n printf(\"%d\",m+1);\n }\n else if(n==1 && m==1){\n printf(\"1\");\n }\n else if(n-m==m-1){\n printf(\"%d\",m-1);\n }\n else{\n printf(\"%d\",m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,mid;\n scanf(\"%d%d\",&n,&m);\n mid=n/2;\n if(m<=mid)\n {\n printf(\"%d\",m+1);\n }\n else if(n==1)\n printf(\"1\");\n else\n printf(\"%d\",m-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(m<n/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>n/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m+1);\n }\n }\n else\n {\n if(m<(n+1)/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>(n+1)/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n if(m==1 && n==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\",m-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tif(m>1||n>1)\n {\n\tif(n==m)\n\tprintf(\"%d\",m-1);\n\telse if(m>n-m)\n\tprintf(\"%d\",m-1);\n\telse\n\tprintf(\"%d\",m+1);\n\t}\n\telse\n\tprintf(\"%d\",m);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,m;\nscanf(\"%d %d\",&n,&m);\nif(n==1){\nprintf(\"1\\n\");}\nelse if(m<=n/2){\nprintf(\"%d\\n\",m+1);\n}\nelse\nprintf(\"%d\\n\",m-1);\nreturn 0;\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%d\\n\", n == 1 ? 1 : m - 1 >= n - m ? m - 1 : m + 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong int m,n,left,right;\n\tscanf(\"%ld %ld\",&n,&m);\n\tright = n-m;\n\tleft = m-1;\n\tif(right>left){\n\t\tprintf(\"%ld\",m+1);\n\t}else if(left > right){\n\t\tprintf(\"%ld\",m-1);\n\t}else if(n==1){\n\t\tprintf(\"1\");\n\t}else{\n\t\tprintf(\"%ld\",m-1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,result;\n while(scanf(\"%lld%lld\",&n,&m)==2)\n { if(n==m&&m==1)\n result=1;\n else{ if((n-m-1)>=(m-1))\n result =m+1;\n else result =m-1;\n }\n printf(\"%lld\\n\",result);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,c,n,m;\nscanf(\"%d%d\",&n,&m);\nc=1+rand()%(n-1);\nif(n==1)\na=1;\nelse if((m-1)>=(n-m))\na=m-1;\nelse\na=m+1;\nprintf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a;\n scanf(\"%d%d\",&n,&m);\n \n if(m>(n-m)&&n+m>2)\n {\n printf(\"%d\",m-1);\n }\n if((n-m)>m&&n+m>2)\n {\n printf(\"%d\",m+1);\n }\n \n if(n-m==m)\n {\n printf(\"%d\",m+1);\n }\n \n if(n==1&&m==1)\n printf(\"1\");\n\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if((float)m/n > 0.5)\n printf(\"%d\",(m!=1 ? m-1 :1));\n else\n printf(\"%d\",m+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n long long int n,m;\n scanf(\"%lld%lld\",&n,&m);\n if(n == m && n == 1)\n printf(\"1\");\n else if(2*m <= n) {\n printf(\"%lld\",m+1);\n }\n else {\n printf(\"%lld\",m-1);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,n,a,d;\n scanf(\"%I64d %I64d\",&n,&m);\n if( n-m+1 > m )\n a=m+1;\n else if( n == 1 )\n a=1;\n else\n a=m-1;\n printf(\"%I64d\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,a,c;\n scanf(\"%d %d\",&n,&a);\n if(n==1)\n printf(\"1\\n\");\n else if(a>n/2)\n printf(\"%d\\n\",a-1);\n else\n printf(\"%d\\n\",a+1);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n\n if(n==1)\n { printf(\"%lld\\n\",m); return 0;}\n \n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,a;\n\tscanf (\"%d%d\",&n,&m);\n\tif (m>(n/2))\n\t{\n\t\ta=(m-1);\n\t}\n\telse\n\t{\n\t\ta=(m+1);\n\t}\n\tif (a==0)\n\t{\n\t\ta=a+1;\n\t}\n\tprintf(\"%d\",a);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\nint main(void){\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int ans=0;\n if(n%2==1){\n if(m<=n/2) ans=m+1;\n else ans=m-1;\n }\n else{\n if(m<=n/2) ans=m+1;\n else ans=m-1;\n }\n if(n==1) ans=1;\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int a;\n if(n==1)\n {printf(\"1\\n\");\n return 0;}\n if(n%2==0)\n {\n if(m>n/2)\n a=m-1;\n else if(m<n/2)\n a=m+1;\n else\n a=m+1;\n }\n else\n {\n if(m>(n+1)/2)\n a=m-1;\n else if(m<(n+1)/2)\n a=m+1;\n else\n a=m-1;\n }\n printf(\"%d\\n\",a); \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint m,n;\nint main()\n{\n scanf(\"%d %d\",&n,&m);\n if (m==1&&n==1) \n\t\tprintf(\"%d\",1);\n else if (m<=n/2) \n\t\tprintf(\"%d\",m+1);\n else \n\t\tprintf(\"%d\",m-1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, mid;\n scanf(\"%d %d\", &n, &m);\n mid=n/2;\n\n if(n==1) printf(\"%d\\n\", 1);\n else if(m<=mid) printf(\"%d\\n\", m+1);\n else printf(\"%d\\n\", m-1);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\nlong int m,n,a,b;\nscanf(\"%li%li\",&n,&m);\na=abs(m-1);\nb=abs(n-m);\nif(b>a)\nprintf(\"%li\",m+1);\nelse if(a>b)\nprintf(\"%li\",m-1);\nelse if(a==b && a!=0)\nprintf(\"%li\",m-1);\nelse\nprintf(\"1\");\n}\n"}, {"source_code": "#include <stdlib.h>\n#include<stdio.h>\nint main(void)\n{\n\tlong int n,m;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(m == n && m!=1)\n\t\tprintf(\"%ld\", m-1);\n\telse if(m == n && m==1)\n\t\tprintf(\"%ld\", m);\n\telse if(m == 1)\n\t\tprintf(\"2\");\n\telse if(n-m > m-1)\n\t\tprintf(\"%ld\", m+1);\n\telse\n\t\tprintf(\"%ld\",m-1);\n\t\t\n\t\treturn 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b;\n scanf(\"%lld %lld\",&a,&b);\n if (((a+1)/2)>b && (b+1)<=a)\n \n printf(\"%lld\\n\",b+1);\n else if (((a+1)/2)==b && (b+1)<=a && a%2==0)\n printf(\"%lld\\n\",b+1);\n \n else if (b-1>0)\n printf(\"%lld\\n\",b-1);\n else\n printf(\"%lld\\n\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, m, a;\n\n\tscanf(\"%d%d\", &n, &m);\n\tif (n == 1)\n\t\ta = 1;\n\telse if (m - 1 >= n - m)\n\t\ta = m - 1;\n\telse\n\t\ta = m + 1;\n\tprintf(\"%d\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d%d\", &n, &m);\n\tprintf(\"%d\\n\", n == 1 ? 1 : n - m > m - 1 ? m + 1 : m - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c;\n scanf(\"%d %d\",&n,&c);\n int a1=c-1;\n int a2=n-c;\n if(n==1)\n {\n printf(\"%d\",n);\n }\n else if(a1>=a2)\n {\n printf(\"%d\",a1);\n }\n else\n {\n printf(\"%d\",c+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n==a && n==1){\n printf(\"1\");\n }else{\n \n printf(\"%lld\",(n-a>a-1)?a+1:a-1);\n }\n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, m, a;\n\n\tscanf(\"%d%d\", &n, &m);\n\tif (n == 1)\n\t\ta = 1;\n\telse if (m - 1 > n - m)\n\t\ta = m - 1;\n\telse if (n - m > m - 1)\n\t\ta = n - m;\n\telse\n\t\ta = min(m - 1, n - m);\n\tprintf(\"%d\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,a;\n while(scanf(\"%d %d\",&n,&m)==2){\n if(n==1) printf(\"%d\\n\",n);\n else{\n if(n-m>m-1) a=m+1;\n else if(n-m<m-1) a=m-1;\n printf(\"%d\\n\",a);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,n,a,d;\n scanf(\"%I64d %I64d\",&n,&m);\n if( n-m+1 > m )\n a=m+1;\n else if( n == m )\n a=m;\n else\n a=m-1;\n printf(\"%I64d\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int m,a,n;\n scanf(\"%I64d %I64d\", &n,&m);\n {\n if((n-m)>m)\n printf(\"%I64d\", m+1);\n else\n printf(\"%I64d\", m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint m,n;\n\tscanf(\"%d%d\",&n,&m);\n\tif(abs(n-m)>abs(m-1))\n\t{\n\t\tprintf(\"%d\\n\",m+1);\n\t}\n\telse if(abs(m-1)>abs(n-m))\n\t{\n\t\tprintf(\"%d\\n\",m-1);\n\t}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,a,c;\n scanf(\"%d %d\",&n,&a);\n if(n==1)\n printf(\"1\\n\");\n if(a>n/2)\n printf(\"%d\\n\",a-1);\n else\n printf(\"%d\\n\",a+1);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n-a>a-1){\n printf(\"%lld\",a+1);\n }else{\n if(n==a){\n printf(\"%lld\",a);\n }else{\n printf(\"%lld\",a-1);\n }\n }\n \n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\tlong n,m;\n\tscanf(\"%ld %ld\", &n,&m);\n\tif(n-m>m-1)\n\tprintf(\"%ld\", m+1);\n\telse if(n-m<m-1)\n\tprintf(\"%ld\", m-1);\n\telse \n\tprintf(\"%ld\", m);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n n=(n+1)/2;\n if(m>n)\n printf(\"%d\\n\",m-1);\n else\n printf(\"%d\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,n,a,d;\n scanf(\"%I64d %I64d\",&n,&m);\n if( n-m+1 > m )\n a=m+1;\n else\n a=m-1;\n printf(\"%I64d\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n int main ()\n{\n int n=3,m=1;\n 1<=m<n<=10^9;\n if (n-m>m-1){\n printf(\"%d\",m+1);\n }\n else if (n-m<=m-1){\n printf(\"%d\",m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,result;\n while(scanf(\"%lld%lld\",&n,&m)==2)\n {\n if((n-m-1)>=(m-1))\n result =m+1;\n else result =m-1;\n printf(\"%lld\\n\",result);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nint main()\n{\n int n,m,d;\n scanf(\"%d%d\",&n,&m);\n //printf(\"%d\\n\",n);\n if(n==1)\n {\n printf(\"1\\n\");\n return 0;\n }\n if(m-1>n-m)\n printf(\"%d\\n\",m-1);\n else\n printf(\"%d\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<limits.h>\n#define N 1000065\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a==1 && b==1){\n\t\tprintf(\"2\");\n\t\treturn 0;\n\t}\n\tif(a-b>=b){\n\t\tprintf(\"%d\",b+1);\n\t}\n\telse printf(\"%d\",b-1);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat n,t;\n\tint a,m,temp;\n\ttemp=n;\n\tscanf(\"%f %d\",&n,&m);\n\tt=(n/2);\n\tif(m%2==0)\n\t{\n\t\tif(m<=t)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\telse\n\t{\n\t\tif(m==((n/2)+1))\n\t\t\ta=m-1;\n\t\telse\n\t\t{\n\t\t\tif(m<=t)\n\t\t\t\ta=m+1;\n\t\t\telse\n\t\t\t\ta=m-1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",a);\n}"}, {"source_code": "#include<stdio.h>\n int main ()\n{\n int n,m;\n 1<=m<n<=10^9;\n printf(\"n=? m=?\");\n scanf(\"%d%d\",&n,&m);\n if (n-m>m-1){\n printf(\"%d\",m+1);\n }\n else if (n-m<=m-1){\n printf(\"%d\",m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m, n, a;\n scanf(\"%d%d\", &n, &m);\n if(n-m >= m){\n printf(\"%d\", m+1);\n }\n else{\n printf(\"%d\", m-1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,m;\n scanf(\"%d %d\",&n,&m);\n a=n-1;\n if(n-1==m)\n a=m-1;\n printf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\n int n,m,a;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n \n \n if(m==1){a=m+1;}\n else{\n if(m==n){a=m-1;}\n else{\n if(n-m>=m-1){a=m+1;}\n else{a=m-1;}\n }\n }\n \n \n printf(\"%d\",a);\n \n return 0; \n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n long m,n;\n scanf(\"%ld%ld\",&n,&m);\n //if(n==1 && m==1)\n //printf(\"1\\n\");\n if( n-m > m-1)\n printf(\"%ld\\n\",m+1);\n else if(m-1 > n-m)\n printf(\"%ld\\n\",m-1);\n else\n printf(\"%ld\\n\",m-1);\n // your code goes here\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,temp1,temp2;\n\tscanf(\"%lld%lld\",&n,&m);\n\ttemp1= n-m;\n\ttemp2= m-1;\n\tif(n==1 && m==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t}\n\telse\n\t{\n\t\tif(temp1>=temp2)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",m+1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%lld\\n\",m-1);\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m,a,b;\n\tscanf(\"%d%d\",&n,&m);\n\tb = (n%2);\n\tif(b != 0)\n\t{\n\t\tif(m >= ((n + 1)/2))\n\t\t{\n\t\t\ta = (m - 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t\tif (m < ((n + 1)/2))\n\t\t{\n\t\t a = (m + 1);\n\t\t printf(\"%d\\n\",a);\t\n\t\t}\n\t}\n\tif(b == 0)\n\t{\n\t\tif (m > (n/2))\n\t\t{\n\t\t\ta = (m - 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t\tif (m <= (n/2))\n\t\t{\n\t\t\ta = (m + 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, a, c;\n scanf(\"%d %d\", &n, &m);\n c=n-m;\n if(c>m){\n a=m+1;\n }else{\n a=m-1;\n }\n if(n==1 && m==1) {\n a=1;\n }\n printf(\"%d\\n\", a);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, m;\n\nint main() {\n\tint left, right, ans;\n\n\tscanf(\"%d %d\", &n, &m);\n\tleft = m - 1;\n\tright = n - m;\n\tans = (left >= right) ? m - 1 : m + 1;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n,m;\n scanf(\"%ld%ld\",&n,&m);\n if(n==1)\n printf(\"1\");\n if(n/2>=m)\n {\n printf(\"%ld\",m+1);\n }\n else\n printf(\"%ld\",m-1);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n%2==0)\n\t{\n\t\tif(m > n/2)\n\t\tprintf(\"%d\", m-1);\n\t\telse \n\t\tprintf(\"%d\", m+1);\n\t}\n\telse \n\t{\n\t\tif(m==1, n==1){\n\t\t\tprintf(\"1\");\n\t\t}\n\t\telse if(m > (n+1)/2)\n\t\tprintf(\"%d\", m-1);\n\t\telse \n\t\tprintf(\"%d\", m+1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat n,t;\n\tint a,m,temp;\n\ttemp=n;\n\tscanf(\"%f %d\",&n,&m);\n\tt=(n/2);\n\tif(n==1)\n\t\ta=1;\n\telse\n\t{\n\tif(m%2==0)\n\t{\n\t\tif(m<=t)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\telse\n\t{\n\t\tif(m==((n/2)+1))\n\t\t\ta=m+1;\n\t\telse\n\t\t{\n\t\t\tif(m<=t)\n\t\t\t\ta=m+1;\n\t\t\telse\n\t\t\t\ta=m-1;\n\t\t}\n\t}\n\t}\n\tprintf(\"%d\\n\",a);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint m,n;\n\tscanf(\"%d %d\",&n,&m);\n\tif(n>((2*m)-1)) printf(\"%d\\n\",(m+1));\n\telse if(n<((2*m)-1)) printf(\"%d\\n\",m-1);\n\telse printf(\"%d\\n\",m);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,c,n,m;\nscanf(\"%d%d\",&n,&m);\nc=1+rand()%(n-1);\nif((m-1)>=(n-m))\na=m-1;\nelse if(n==1)\na=1;\nelse\na=m+1;\nprintf(\"%d\",a);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nint main()\n{\n int n,m,d;\n scanf(\"%d%d\",&n,&m);\n //printf(\"%d\\n\",n);\n if(n==1)\n {\n printf(\"1\\n\");\n return 0;\n }\n if(m-1>n-m)\n printf(\"%d\\n\",m-1);\n else\n printf(\"%d\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,m,i,count=0,old_count=0,j,rem;\n scanf(\"%d %d\",&n,&m);\n int ara[n+1];\n for(i=m+1; i<=n; i++)\n {\n if(abs(n-i)<abs(n-m))\n {\n ara[count]=i;\n count++;\n }\n }\n count--;\n if(n==m || n-m==1)\n rem=m-1;\n for(i=m+1; i<=n; i++)\n {\n for(j=1; j<=count; j++)\n {\n if(abs(ara[j]-i)<abs(ara[j]-m))\n count++;\n }\n if(count>old_count)\n {\n rem=i;\n old_count=count;\n }\n count=0;\n }\n printf(\"%d\\n\",rem);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\n int a,b,c,n,m;\n scanf(\"%d%d\",&n,&m);\n if((m-1)<(n-m))\n {\n a=m+1;\n }\n if(m-1>n-m)\n {\n a=m-1;\n }\n\n printf(\"%d\",a);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tif ((float)n/2>m){printf(\"%d\",m+1);}\n\telse if ((float)n/2<m){printf(\"%d\",m-1);}\n\telse {printf(\"%d\",m+1);}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int m,n,a;\n scanf(\"%d %d\",&n,&m);\n if(n-m>m-1) {\n a=m+1;\n }\n else {\n a=m-1;\n }\n printf(\"%d\\n\",a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\t\nint main()\n{\n\tint n=0,m=0;\n\tscanf(\"%d %d\",&n,&m);\n if(n-m>=m-1)\n\tprintf(\"%d\",m+1);\n\telse\n\tprintf(\"%d\",m-1);\n\treturn 0;\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tif ((float)n/2>m){printf(\"%d\",m+1);}\n\telse {printf(\"%d\",m-1);}\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,n,a,d;\n scanf(\"%I64d %I64d\",&n,&m);\n if( n-m+1 > m )\n a=m+1;\n else\n a=m-1;\n printf(\"%I64d\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n\tlong int n,m,i,j;\n\tscanf(\"%ld %ld\",&n,&m);\n\ti=m-1;\n\tj=n-m;\n\tif(i==j || i>j || m==n)\n\t{\n\t\tprintf(\"%ld\",m-1);\n\t}\n\telse if(j>i || m==1)\n\t{\n\t\tprintf(\"%ld\",m+1);\n\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,x,m;\n scanf(\"%d %d\",&n,&m);\n x=2*m-1;\n if(n<=x){\n a=m-1;\n printf(\"%d\",a);\n }else{\n a=m+1;\n printf(\"%d\",a);\n }\n return 0;\n}"}, {"source_code": "int main()\n{\n int n,m,a;\n scanf(\"%d%d\",&n,&m);\n if((m-1)>=(n-m)){a=m-1;}\n \n else if((m-1)<(n-m)) a=m+1;\n\n printf(\"%d\\n\",a);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n-a>a-1){\n printf(\"%lld\",a+1);\n }else{\n if(n-1==a-1){\n printf(\"%lld\",a);\n }else{\n printf(\"%lld\",a-1);\n }\n }\n \n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n%2==0)\n {\n if(m<n/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>n/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m);\n }\n }\n else\n {\n if(m<(n+1)/2)\n {\n printf(\"%d\\n\",m+1);\n }\n else if(m>(n+1)/2)\n {\n printf(\"%d\\n\",m-1);\n }\n else\n {\n printf(\"%d\\n\",m);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define max(a,b) a<b? 1:0\nint main()\n{\n \tint m,n,x;\n \tscanf(\"%d %d\",&n,&m);\n \tx=max(m-1,n-m);\n \tif(x==0)\n \t\tprintf(\"%d\",m-1);\n \telse\n \t\tprintf(\"%d\",m+1);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<limits.h>\n#define N 1000065\nint main(){\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tif(a-(b+1)>=b-2){\n\t\tprintf(\"%d\",b+1);\n\t}\n\telse printf(\"%d\",b-1);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,z,x,y;\n\tscanf(\"%d %d\" ,&n,&m);\n\tz=n/2;\n\tif (n!=1)\n\t\t{\n\t\tif (m<=z)\n\t\t{y=m+1;\n\t\tprintf(\"%d\" ,y);\n\t\t}\n\t\telse\n\t\t{x=m-1;\t\n\t\tprintf(\"%d\" ,x);\n\t\t}\n\t\t}\t\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,c,n,m;\nscanf(\"%d%d\",&n,&m);\nc=1+rand()%(n-1);\nif((m-1)>=(n-m))\na=m-1;\nelse if(n==1)\na=1;\nelse\na=m+1;\nprintf(\"%d\",a);\n}\n"}, {"source_code": "# include <stdio.h>\n# include <stdlib.h>\n# define min(a,b) (a < b ? a : b)\n\nint main () {\n\tint n, m, resposta;\n\tscanf(\"%d%d\", &n, &m);\n\tif (n - m > m - 1)\n\t\tresposta = ((n - m) >> 1) + m;\n\telse\n\t\tresposta = (m >> 1) + 1;\n\tprintf(\"%d\\n\", resposta);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint m, n, a;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n%2==1 && m==(n/2+1))\n\t\ta = m-1;\n\telse\n\t{\n\t\tif(m<=n/2)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\tprintf(\"%d\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int n,m,x;\nint main()\n{\n long long int a;\n scanf(\"%lld %lld\",&n,&m);\n x=n/2;\n if((abs(n-m))>x)\n {\n a=m+1;\n }\n else if((abs(n-m))<x)\n {\n a=m-1;\n }\n printf(\"%lld\\n\",a);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,m;\n\tscanf(\"%I64d %I64d\",&n,&m);\n\t/*int odd=0,even=0;\n\tif(n%2==0)\n\t\teven=1;\n\telse\n\t\todd=1;\n\t/*if(!odd && even)\n\t{\n\t\tif(n-m>)\n\t}*/\n\tif(n-m>m-1)\n\t\tprintf(\"%I64d\",m+1);\n\telse if(n-m<=m-1)\n\t\tprintf(\"%I64d\",m-1);\n\treturn(0);\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,m,a;\n\n scanf(\"%lld %lld\",&n,&m);\n\n if((n-m)==(m-1))\n a=m;\n else if((n-m)>(m-1))\n a=m+1;\n else\n a=m-1;\n\n printf(\"%lld\\n\",a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,m,misha,res,x,choto,ans;\n scanf(\"%d %d\",&n,&m);\n /*x=n-m;\n misha=(x/2)*(1+x);\n x=m-1;\n misha+=(x/2)*(1+x);\n x=n-1;\n choto=(x/2)*(1+x);\n ans=1;\n for(i=2;i<=n;i++)\n {\n if(i==m)\n continue;\n x=n-i;\n res=(x/2)*(1+x);\n x=i-1;\n res+=(x/2)*(1+x);\n if(choto>res)\n {\n choto=res;\n ans=i;\n }\n }*/\n if(n-m>m-1)\n ans=m+1;\n else if(n-m==m-1)\n ans=m+1;\n else\n ans=m-1;\n if(n==1)\n ans=1;\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n if(m!=1)\n {\n printf(\"%lld\\n\",m-1);\n }\n else\n printf(\"%lld\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(m==n)\n printf(\"%d\",m);\n else\n if(m<=n/2)\n printf(\"%d\",m+1);\n else\n printf(\"%d\",m-1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,z,x,y;\n\tscanf(\"%d %d\" ,&n,&m);\n\tz=n/2;\n\tif (m<=z)\n\t\t{y=m+1;\n\t\tprintf(\"%d\" ,y);\n\t\t}\n\telse\n\t\t{x=m-1;\t\n\t\tprintf(\"%d\" ,x);\n\t\t}\t\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int n,m,x;\nint main()\n{\n long long int a;\n scanf(\"%lld %lld\",&n,&m);\n x=n/2;\n if((abs(n-m))>x)\n {\n a=m+1;\n }\n else if((abs(n-m))<x)\n {\n a=m-1;\n }\n printf(\"%lld\\n\",a);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int n,m,x;\n scanf(\"%d %d\",&n,&m);\n if(n%2==0) {\n x=n/2;\n }\n else{\n x=n/2+1;\n }\n if(x==m) {\n x--;\n }\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main() {int a,b;\n scanf(\"%d%d\",&a,&b);\n if(b>a/2){\n printf(\"%d\",b-1);\n }else{printf(\"%d\",b+1);}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d%d\", &n, &m);\n\tif ((n-m)>(m-1)) printf(\"%d\\n\", m+1);\n\telse printf(\"%d\\n\", m-1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n int a,p;\n if(n%2==0)\n {\n p=n/2+1;\n }\n else\n {\n p=n/2+1;\n }\n if(m>=p)\n {\n a=m-1;\n }\n else\n {\n a=m+1;\n }\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint m,n;\n\tscanf(\"%d %d\",&n,&m);\n\tif(n>((2*m)-1)) printf(\"%d\\n\",(m+1));\n\telse if(n<((2*m)-1)) printf(\"%d\\n\",m-1);\n\telse printf(\"%d\\n\",m);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\tlong n,m;\n\tscanf(\"%ld %ld\", &n,&m);\n\tif(n-m>m)\n\tprintf(\"%ld\", m+1);\n\telse \n\tprintf(\"%ld\", m-1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\nint main (int argc, char * argv[]) {\n int n, m, a;\n scanf (\"%d %d\", &n, &m);\n\n int middle = n / 2 + n % 2;\n if (m < middle) {\n a = m + 1;\n } else if (m > middle) {\n a = m - 1;\n } else {\n a = m + ((m == 1 || m == n) ? 0 : (n % 2 == 0 ? 1 : -1));\n }\n\n printf (\"%d\\n\", a);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main() {\n long long int n,m,k;\n scanf(\"%lld %lld\",&n,&m);\n k=n-m;\n if(m==1)\n printf(\"%lld\\n\",m+1);\n else if(m==n)\n printf(\"%lld\\n\",m-1);\n else{\n if(k>m-1)\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n }\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n==1)printf(\"%d\\n\",n);\n else \n {\n if(m<=n/2)printf(\"%d\\n\",m+1);\n if(m>=n/2)printf(\"%d\\n\",m-1);\n }\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int m,n,i;\n\tscanf(\"%ld %ld\",&n,&m);\n\tif(m==1 && n==1)\n\t\ti=1;\n\telse if(m<=(1+n)/2 && n%2!=0)\n\ti=m+1;\n\telse\n\t\ti=m-1;\n\tprintf(\"%ld\\n\",i);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n%2==0)\n\t{\n\t\tif(m > n/2)\n\t\tprintf(\"%d\", m-1);\n\t\telse \n\t\tprintf(\"%d\", m+1);\n\t}\n\telse \n\t{\n\t\tif(m==1, n==1){\n\t\t\tprintf(\"1\");\n\t\t}\n\t\telse if(m > (n+1)/2)\n\t\tprintf(\"%d\", m-1);\n\t\telse \n\t\tprintf(\"%d\", m+1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,m;\n scanf(\"%d %d\",&n,&m);\n a=m+1;\n if(n-m==1 || n==m)\n a=m-1;\n printf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,m,_mid;\n scanf(\"%I64d %I64d\",&n,&m);\n _mid = n/2;\n// (_mid>m)? m+=1 : m-=1;\n if(_mid >=m) m+=1;\n else m-=1;\n if(m==0) m=2;\n\n printf(\"%I64d\",m);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]){\n\tint n, m;\n\n\tscanf(\"%d %d\", &n, &m);\n\tif(n == 1) printf(\"0\\n\");\n\telse if(n - m > m - 1) printf(\"%d\\n\", m+1);\n\telse printf(\"%d\\n\", m-1);\n\n\treturn 0;\n}"}, {"source_code": "//misha\u7684\u521d\u59cb\u6570\u5b57\u662fm\n//andrew\u7684\u521d\u59cb\u6570\u5b57\u662fa\n//\u57281\u5230n\u4e4b\u95f4\u9009\u62e9\uff01\n//c\u662f\u4e00\u4e2a\u968f\u673a\u6570\n//\u770b\u8c01\u7684\u6570\u63a5\u8fd1c\uff0c\u8ddd\u79bb\u76f8\u540cmisha\u8d62\uff01\n//\u8ddd\u79bb\u4e0d\u540c\u8c01\u8fd1\uff0c\u8c01\u8d62\uff01\n//n\u662f\u53ef\u4ee5\u9009\u62e9\u7684\u6570\u5b57\u8303\u56f4\uff01\n//\u8fd9\u662f\u4e00\u4e2a\u6982\u7387\u95ee\u9898\uff01\n//\u6bcf\u4e00\u4e2a\u90fd\u8ba1\u7b97\u4e00\u904d\u65f6\u95f4\u80af\u5b9a\u8d85\u65f6\n//\u56e0\u4e3a\u9898\u76ee\u8bbe\u7f6e\u4e3a10^9\u7ea7\u522b\u7684\u95ee\u9898\uff01\n//\u53ea\u80fd\u5148\u5b9e\u73b0\u4e00\u4e2a\u770b\u6709\u6ca1\u6709\u8d85\u65f6\uff01\n//\u6211\u7684\u60f3\u6cd5\u662fa\u5fc5\u987b\u9009\u62e9\u4e2d\u95f4\u4f4d\u7f6e\uff0c\u624d\u80fd\u83b7\u53d6\u6700\u5927\u6982\u7387\uff01\n/*interface*/\n/*interface implementation*/\n/*client*/\n#include<stdio.h>\nint main() {\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint a;\n\tfor(a=1;a<=n;a++) {\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int m,n,a;\n scanf(\"%d %d\",&n,&m);\n if(n-m>m-1) {\n a=m+1;\n }\n else {\n a=m-1;\n }\n printf(\"%d\\n\",a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int m,a,n;\n scanf(\"%I64d %I64d\", &n,&m);\n {\n if((n-m)>(m-1))\n printf(\"%I64d\", m+1);\n else if((n-m)<(m-1))\n printf(\"%I64d\", m-1);\n else\n printf(\"%I64d\", m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long int n ,m;\n scanf(\"%I64d%I64d\",&n,&m);\n if( m==1 ) { printf(\"1\"); return 0;}\n if( ( m-1 ) >= ( n-m ) ) printf(\"%I64d\",m-1);\n else printf(\"%I64d\",m+1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b;\n scanf(\"%d %d\",&n,&m);\n if(m<=(n/2))\n {\n printf(\"%d\",m+1);\n }\n else\n printf(\"%d\",m-1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m,a,b;\n\tscanf(\"%d%d\",&n,&m);\n\tb = (n%2);\n\tif(b != 0)\n\t{\n\t\tif(m >= ((n + 1)/2))\n\t\t{\n\t\t\ta = (m - 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t\tif (m < ((n + 1)/2))\n\t\t{\n\t\t a = (m + 1);\n\t\t printf(\"%d\\n\",a);\t\n\t\t}\n\t}\n\tif(b == 0)\n\t{\n\t\tif (m > (n/2))\n\t\t{\n\t\t\ta = (m - 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t\tif (m <= (n/2))\n\t\t{\n\t\t\ta = (m + 1);\n\t\t\tprintf(\"%d\\n\",a);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "int main()\n{\n int n,m,a;\n scanf(\"%d%d\",&n,&m);\n if(abs(m-1)>abs(n-m)){a=m-1;}\n else if(abs(m-1)<abs(n-m)) a=m+1;\n else\n {\n if(m!=n)a=n;\n else a=1;\n }\n printf(\"%d\\n\",a);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,m,a;\n\n scanf(\"%lld %lld\",&n,&m);\n\n if(n==m)\n {\n printf(\"%lld\\n\",n);\n return 0;\n }\n if((n-m)>(m-1))\n {\n a=m+1;\n }\n else\n a=m-1;\n\n printf(\"%lld\\n\",a);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n long m,n;\n scanf(\"%ld%ld\",&n,&m);\n if(n==1 && m==1)\n printf(\"1\\n\");\n if( n-m > m-1)\n printf(\"%ld\\n\",m+1);\n else if(m-1 > n-m)\n printf(\"%ld\\n\",m-1);\n else\n printf(\"%ld\\n\",m-1);\n // your code goes here\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n int main ()\n{\n int n,m;\n 1<=m<n<=10^9;\n scanf(\"%d%d\",&n,&m);\n if(n=1){\n printf(\"%d\",n);\n }\n else if (n-m>m-1){\n printf(\"%d\",m+1);\n }\n else if (n-m<=m-1){\n printf(\"%d\",m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define max(a,b) a<b? 1:0\nint main()\n{\n \tint m,n,x;\n \tscanf(\"%d %d\",&n,&m);\n \tx=max(m-1,n-m);\n \tif(n==1)\n \t{\n\t \t\tprintf(\"%d\",0); \t\n\t \t\treturn 0;\n \t}\n \tif(x==0)\n \t\tprintf(\"%d\",m-1);\n \telse\n \t\tprintf(\"%d\",m+1);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,a,t;\n\tscanf(\"%d %d\",&n,&m);\n\tt=n/2;\n\n\tif(n==1)\n\t\ta=1;\n\telse\n\t{\n\t\tif(m<t)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m+1;\n\t}\n\tprintf(\"%d\",a);\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, m, a;\n\n\tscanf(\"%d%d\", &n, &m);\n\tif (n == 1)\n\t\ta = 1;\n\telse if (m - 1 > n - m)\n\t\ta = m - 1;\n\telse if (n - m > m - 1)\n\t\ta = n - m;\n\telse\n\t\ta = min(m - 1, n - m);\n\tprintf(\"%d\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n\n\n long long n,m;\n scanf(\"%lld%lld\",&n,&m);\n if(abs(n-m)>abs(1-m))\n printf(\"%lld\\n\",m+1);\n else\n printf(\"%lld\\n\",m-1);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n int n,m;\n scanf(\"%d%d\",&n,&m);\n\n float L=(float)(m-1)/(float)n;\n float R=(float)(n-m)/(float)n;\n\n if(n==m)\n printf(\"%d\",n);\n return 0;\n\n if(L>R)\n printf(\"%d\",m-1);\n\n else if(R>L)\n printf(\"%d\",m+1);\n\n else if(L==R)\n printf(\"%d\",m-1);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nint main()\n{\n int n,m,d;\n scanf(\"%d%d\",&d,&m);\n n=(d+1)/2;\n //printf(\"%d\\n\",n);\n if(n==1)\n {\n printf(\"1\\n\");\n return 0;\n }\n if(n==m)\n {\n if(d&1)\n printf(\"%d\\n\",m-1);\n else\n printf(\"%d\\n\",m+1);\n return 0;\n }\n if(m>n)\n printf(\"%d\\n\",m-1);\n else\n printf(\"%d\\n\",m+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n-a>a-1){\n printf(\"%lld\",a+1);\n }else{\n if(n-1==a-1){\n printf(\"%lld\",a);\n }else{\n printf(\"%lld\",a-1);\n }\n }\n \n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,a,b;\nscanf(\"%d%d\",&n,&a);\nif(a<=n){\nif(n%2==0){\n if(n/2>a){\n b=a+1;}\n else{\n b=a-1;}\n}\nelse {\n if((n+1)/2>a){\n b=a+1;}\n else{\n b=a-1;}\n}\nprintf(\"%d\",b);\n}\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main(void){\n \n long long int test,n,c,o,d,e,r,i,fflag=0,m=0,flag=0,index,sum,max=0,min,l,x,j,z,b,k,count=0,gym=0,t1=0,t2=1,nextTerm,a;\n scanf(\"%lld %lld\",&n,&a);\n if(n-a>a-1){\n printf(\"%lld\",a+1);\n }else{\n if(n-a<a-1){\n printf(\"%lld\",a-1);\n }else{\n printf(\"%lld\",a-1);\n }\n }\n \n \n\n//printf(\"%d\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat n,t,m;\n\tint a,temp,temp2;\n\ttemp=n;\n\ttemp2=m;\n\tscanf(\"%f %f\",&n,&m);\n\tt=(n/2);\n\tif(n==1)\n\t\ta=1;\n\telse\n\t{\n\tif(temp%2==0)\n\t{\n\t\tif(m<=t)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\telse\n\t{\n\t\tif(m==((n/2)+1))\n\t\t\ta=temp2-1;\n\t\telse\n\t\t{\n\t\t\tif(m<=t)\n\t\t\t\ta=temp2+1;\n\t\t\telse\n\t\t\t\ta=temp2-1;\n\t\t}\n\t}\n\t}\n\tprintf(\"%d\\n\",a);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n,m;\n scanf(\"%ld%ld\",&n,&m);\n if(m>=n/2)\n {\n printf(\"%ld\",m-1);\n }\n else\n printf(\"%ld\",m+1);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n int n, a;\n int mid, and;\n\n scanf(\"%d %d\", &n, &a);\n if(n%2){\n mid=(n/2)+1;\n if(a>mid) printf(\"%d\\n\", mid);\n else if(a<mid) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\", mid);\n }\n else {\n mid=(n/2);\n if(a>mid) printf(\"%d\\n\", mid);\n else if(a<mid) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\", mid+1);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n int n, a;\n int mid, and;\n\n scanf(\"%d %d\", &n, &a);\n if(n%2){\n mid=(n/2)+1;\n if(a>mid) printf(\"%d\\n\", mid);\n else if(a<mid) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\", mid);\n }\n else {\n mid=(n/2);\n if(a>mid) printf(\"%d\\n\", mid);\n else if(a<mid) printf(\"%d\\n\",a+1);\n else printf(\"%d\\n\", mid+1);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main() {int a,b;\n scanf(\"%d%d\",&a,&b);\n if(b>a/2){\n printf(\"%d\",b-1);\n }else{printf(\"%d\",b+1);}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tfloat n,t;\n\tint a,m,temp;\n\ttemp=n;\n\tscanf(\"%f %d\",&n,&m);\n\tt=(n/2);\n\tif(m%2==0)\n\t{\n\t\tif(m<=t)\n\t\t\ta=m+1;\n\t\telse\n\t\t\ta=m-1;\n\t}\n\telse\n\t{\n\t\tif(m==((n/2)+1))\n\t\t\ta=m-1;\n\t\telse\n\t\t{\n\t\t\tif(m<=t)\n\t\t\t\ta=m+1;\n\t\t\telse\n\t\t\t\ta=m-1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",a);\n}"}, {"source_code": "#include<stdio.h>\n int main ()\n{\n int n,m;\n 1<=m<n<=10^9;\n scanf(\"%d%d\",&n,&m);\n if (n-m>m-1){\n printf(\"%d\",m+1);\n }\n else if (n-m<=m-1){\n printf(\"%d\",m-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\n int n,m,a;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n \n \n if(m==1){a=m+1;}\n else{\n if(m==n){a=m-1;}\n else{\n if(n-m>=m-1){a=m+1;}\n else{a=m-1;}\n }\n }\n \n \n printf(\"%d\",a);\n \n return 0; \n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,m,a;\n\n scanf(\"%lld %lld\",&n,&m);\n\n if(n==m)\n {\n printf(\"%lld\\n\",n);\n return 0;\n }\n if((n-m)>(m-1))\n {\n a=m+1;\n }\n else\n a=m-1;\n\n printf(\"%lld\\n\",a);\n\n return 0;\n}\n"}], "src_uid": "f6a80c0f474cae1e201032e1df10e9f7"} {"nl": {"description": "In Omkar's last class of math, he learned about the least common multiple, or $$$LCM$$$. $$$LCM(a, b)$$$ is the smallest positive integer $$$x$$$ which is divisible by both $$$a$$$ and $$$b$$$.Omkar, having a laudably curious mind, immediately thought of a problem involving the $$$LCM$$$ operation: given an integer $$$n$$$, find positive integers $$$a$$$ and $$$b$$$ such that $$$a + b = n$$$ and $$$LCM(a, b)$$$ is the minimum value possible.Can you help Omkar solve his ludicrously challenging math problem?", "input_spec": "Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\leq t \\leq 10$$$). Description of the test cases follows. Each test case consists of a single integer $$$n$$$ ($$$2 \\leq n \\leq 10^{9}$$$).", "output_spec": "For each test case, output two positive integers $$$a$$$ and $$$b$$$, such that $$$a + b = n$$$ and $$$LCM(a, b)$$$ is the minimum possible.", "sample_inputs": ["3\n4\n6\n9"], "sample_outputs": ["2 2\n3 3\n3 6"], "notes": "NoteFor the first test case, the numbers we can choose are $$$1, 3$$$ or $$$2, 2$$$. $$$LCM(1, 3) = 3$$$ and $$$LCM(2, 2) = 2$$$, so we output $$$2 \\ 2$$$.For the second test case, the numbers we can choose are $$$1, 5$$$, $$$2, 4$$$, or $$$3, 3$$$. $$$LCM(1, 5) = 5$$$, $$$LCM(2, 4) = 4$$$, and $$$LCM(3, 3) = 3$$$, so we output $$$3 \\ 3$$$.For the third test case, $$$LCM(3, 6) = 6$$$. It can be shown that there are no other pairs of numbers which sum to $$$9$$$ that have a lower $$$LCM$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,p=0;\n scanf(\"%d\",&n);\n for(int i=2;i<=1000000;i++)\n {\n if(n%i==0)\n {\n p=i;\n break;\n } \n }\n if(p==0) p=n;\n printf(\"%d %d\\n\",n/p,n-(n/p));\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,t;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d\",&n);\n int x1,x2,c=0;\n int limit=sqrt(n)+1;\n for(i=2;i<=limit;i++)\n {\n if(n%i==0)\n {\n x1=n/i;\n x2=x1*(i-1);\n if(x1<=x2)\n {\n if(x2%x1==0)\n {\n printf(\"%d %d\\n\",x1,x2);\n c++;\n break;\n }\n }\n }\n }\n if(c==0)\n printf(\"1 %d\\n\",n-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nvoid joss_joss()\n{\n long long int n,i,x,y,m;\n scanf(\"%lld\",&n);\n x=1;\n y=n-1;\n m=sqrt(n);\n for(i=2;i<=m;i++)\n {\n if(n%i==0)\n {\n x=n/i;\n y=n-x;\n break;\n }\n }\n printf(\"%lld %lld\\n\",x,y);\n}\n\n\n\nint main()\n{\n int t ;\n scanf(\"%d\",&t);\n while(t--)\n joss_joss();\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int t;\n long int n,a,b;\n scanf(\"%d\",&t);\n for( ; t ;t--)\n {\n scanf(\"%ld\",&n);\n if(n%2)\n {\n b=sqrt(n);\n for(a=3;a<=b;a++)\n if(n%a==0)\n break;\n if(n%a)\n printf(\"1 %ld\\n\",n-1);\n else\n printf(\"%ld %ld\\n\",n/a,n-n/a);\n }\n else\n printf(\"%ld %ld\\n\",n/2,n/2);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k,t;\n scanf(\"%lld\",&t);\n while(t>0)\n {\n scanf(\"%lld\",&n);\n long long int maxf=1;\n for(i=2;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n long long int num=(n/i);\n if(num>maxf)\n maxf=num;\n }\n }\n long long int num=(n/maxf);\n long long int pum1=maxf*(num-1),pum2=maxf;\n printf(\"%lld %lld\\n\",pum2,pum1);\n t--;\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){long long int t,i,j,n,c;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n c=0;\n for(j=2;j<=sqrt(n);j++)\n {\n if(n%j==0)\n {c++;\n break;}\n }\n if(c==1)\n {\n printf(\"%lld %lld\\n\",n/j,n-n/j);\n }\n else if(c==0)\n {\n printf(\"1 %lld\\n\",n-1);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <stdbool.h>\ntypedef long long LL;\ntypedef long double Lf;\n#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)\n#define rep(i,n)Rep(i,0,n)\n#define Repp(i,l,r,k)for(LL i=(l);i<(r);i+=(k))\n#define Ma(x,y) ((x)>(y)?(x):(y))\n#define mi(x,y) ((x)<(y)?(x):(y))\n#define MOD 1000000007//998244353,1000000007,1000000009 \nint upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }\nint downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }\nvoid sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...\nvoid sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }\nint upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }\nint downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }\nvoid sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }\nvoid sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }\nint cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d\nint cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab\nLL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }\nLL modpow(LL a, LL n, int m) { LL x = 1; for (a %= m; n; n /= 2)n & 1 ? x = x * a % m : 0, a = a * a % m; return x; }\n#define invmodpow(b,p)modpow(b,p-2,p)// a/b\u2261a*b^{-1}(mod p)...return b^{-1}(mod p)\ntypedef struct fac { LL n, exp; }F;\nLL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}\n//snippet\n\n#define N 100009\n\nint main() {\n\tint t;\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tLL n;\n\t\tscanf(\"%lld\", &n);\n\t\tif (n % 2 == 0)printf(\"%lld %lld\\n\", n / 2, n / 2);\n\t\telse {\n\t\t\tLL i, a[N], c = 0, x = n;\n\t\t\tLL l = n - 1;\n\t\t\tfor (i = 1; i * i <= x; i++) {\n\t\t\t\tif (x % i == 0) {\n\t\t\t\t\ta[c++] = i;\n\t\t\t\t\tx /= i;\n\t\t\t\t\ta[c++] = x;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsortupLL(a, c);\n\t\t\tLL ansA = 1;\n\t\t\tRep(i,1,c-1){\n\t\t\t\tLL A = a[i];\n\t\t\t\tLL L = A / gcd(A, n - A) * (n - A);\n\t\t\t\tif (L < l) {\n\t\t\t\t\tl = L; ansA = A;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%lld %lld\\n\", ansA, n - ansA);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint ami(int n)\n{\n int i;\n int a,b,val=0;\n for(i=8; i<=1000000; i++){\n if(n%i==0){\n a=n/i;\n b=n-a;\n printf(\"%d %d\\n\",a,b);\n val++;\n break;\n }\n }\n if(val==0){\n printf(\"%d %d\\n\",1,n-1);\n }\n //return a,b;\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i,a,b;\n int n;\n int min;\n for(i=0; i<t; i++){\n scanf(\"%d\",&n);\n min=n;\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\\n\",n/5,n-(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\\n\",n/7,n-(n/7));\n }\n else{\n ami(n);\n //printf(\"%d %d\\n\",ami(n));\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,n;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else\n {\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n break;\n }\n if(i>sqrt(n))\n {\n printf(\"1 \");\n printf(\"%d\\n\", n-1);\n }\n else\n {\n printf(\"%d \", n/i);\n printf(\"%d\\n\", n-n/i);\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else\n {\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n break;\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\\n\", n-1);\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\\n\", n-n/j);\n }\n }\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n\n }\n else{\n\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n\n }\n else{\n\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else\n {\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n break;\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n))\n {\n printf(\"1 \");\n printf(\"%d\\n\", n-1);\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\\n\", n-n/j);\n }\n }\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n\n }\n else{\n\n for(i=3; i<=sqrt(n); i++)\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n int t,n,a,b,i,j,k;\n scanf(\"%d\",&t);\n while(t--){\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(prime(n)==1)\n {\n printf(\"1 %d\\n\",n-1);\n }\n else{k=3;\n for(j=3; j*j<n; j++)\n {\n if(n%j==0)\n {\n a=n/j;\n if(a>=k) k=a;\n }\n }\n b=n-k;\n printf(\"%d %d\\n\",k,b);\n }\n }\n}\nint prime(int x)\n{\n int p;\n for(p=2; p<=sqrt(x); p++)\n {\n if(x%p==0)\n return 0;\n }\n return 1;\n}"}, {"source_code": "#include <stdio.h>\n\nint list_primes[] = {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, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973, 10007, 10009, 10037, 10039, 10061, 10067, 10069, 10079, 10091, 10093, 10099, 10103, 10111, 10133, 10139, 10141, 10151, 10159, 10163, 10169, 10177, 10181, 10193, 10211, 10223, 10243, 10247, 10253, 10259, 10267, 10271, 10273, 10289, 10301, 10303, 10313, 10321, 10331, 10333, 10337, 10343, 10357, 10369, 10391, 10399, 10427, 10429, 10433, 10453, 10457, 10459, 10463, 10477, 10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567, 10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639, 10651, 10657, 10663, 10667, 10687, 10691, 10709, 10711, 10723, 10729, 10733, 10739, 10753, 10771, 10781, 10789, 10799, 10831, 10837, 10847, 10853, 10859, 10861, 10867, 10883, 10889, 10891, 10903, 10909, 10937, 10939, 10949, 10957, 10973, 10979, 10987, 10993, 11003, 11027, 11047, 11057, 11059, 11069, 11071, 11083, 11087, 11093, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, 11173, 11177, 11197, 11213, 11239, 11243, 11251, 11257, 11261, 11273, 11279, 11287, 11299, 11311, 11317, 11321, 11329, 11351, 11353, 11369, 11383, 11393, 11399, 11411, 11423, 11437, 11443, 11447, 11467, 11471, 11483, 11489, 11491, 11497, 11503, 11519, 11527, 11549, 11551, 11579, 11587, 11593, 11597, 11617, 11621, 11633, 11657, 11677, 11681, 11689, 11699, 11701, 11717, 11719, 11731, 11743, 11777, 11779, 11783, 11789, 11801, 11807, 11813, 11821, 11827, 11831, 11833, 11839, 11863, 11867, 11887, 11897, 11903, 11909, 11923, 11927, 11933, 11939, 11941, 11953, 11959, 11969, 11971, 11981, 11987, 12007, 12011, 12037, 12041, 12043, 12049, 12071, 12073, 12097, 12101, 12107, 12109, 12113, 12119, 12143, 12149, 12157, 12161, 12163, 12197, 12203, 12211, 12227, 12239, 12241, 12251, 12253, 12263, 12269, 12277, 12281, 12289, 12301, 12323, 12329, 12343, 12347, 12373, 12377, 12379, 12391, 12401, 12409, 12413, 12421, 12433, 12437, 12451, 12457, 12473, 12479, 12487, 12491, 12497, 12503, 12511, 12517, 12527, 12539, 12541, 12547, 12553, 12569, 12577, 12583, 12589, 12601, 12611, 12613, 12619, 12637, 12641, 12647, 12653, 12659, 12671, 12689, 12697, 12703, 12713, 12721, 12739, 12743, 12757, 12763, 12781, 12791, 12799, 12809, 12821, 12823, 12829, 12841, 12853, 12889, 12893, 12899, 12907, 12911, 12917, 12919, 12923, 12941, 12953, 12959, 12967, 12973, 12979, 12983, 13001, 13003, 13007, 13009, 13033, 13037, 13043, 13049, 13063, 13093, 13099, 13103, 13109, 13121, 13127, 13147, 13151, 13159, 13163, 13171, 13177, 13183, 13187, 13217, 13219, 13229, 13241, 13249, 13259, 13267, 13291, 13297, 13309, 13313, 13327, 13331, 13337, 13339, 13367, 13381, 13397, 13399, 13411, 13417, 13421, 13441, 13451, 13457, 13463, 13469, 13477, 13487, 13499, 13513, 13523, 13537, 13553, 13567, 13577, 13591, 13597, 13613, 13619, 13627, 13633, 13649, 13669, 13679, 13681, 13687, 13691, 13693, 13697, 13709, 13711, 13721, 13723, 13729, 13751, 13757, 13759, 13763, 13781, 13789, 13799, 13807, 13829, 13831, 13841, 13859, 13873, 13877, 13879, 13883, 13901, 13903, 13907, 13913, 13921, 13931, 13933, 13963, 13967, 13997, 13999, 14009, 14011, 14029, 14033, 14051, 14057, 14071, 14081, 14083, 14087, 14107, 14143, 14149, 14153, 14159, 14173, 14177, 14197, 14207, 14221, 14243, 14249, 14251, 14281, 14293, 14303, 14321, 14323, 14327, 14341, 14347, 14369, 14387, 14389, 14401, 14407, 14411, 14419, 14423, 14431, 14437, 14447, 14449, 14461, 14479, 14489, 14503, 14519, 14533, 14537, 14543, 14549, 14551, 14557, 14561, 14563, 14591, 14593, 14621, 14627, 14629, 14633, 14639, 14653, 14657, 14669, 14683, 14699, 14713, 14717, 14723, 14731, 14737, 14741, 14747, 14753, 14759, 14767, 14771, 14779, 14783, 14797, 14813, 14821, 14827, 14831, 14843, 14851, 14867, 14869, 14879, 14887, 14891, 14897, 14923, 14929, 14939, 14947, 14951, 14957, 14969, 14983, 15013, 15017, 15031, 15053, 15061, 15073, 15077, 15083, 15091, 15101, 15107, 15121, 15131, 15137, 15139, 15149, 15161, 15173, 15187, 15193, 15199, 15217, 15227, 15233, 15241, 15259, 15263, 15269, 15271, 15277, 15287, 15289, 15299, 15307, 15313, 15319, 15329, 15331, 15349, 15359, 15361, 15373, 15377, 15383, 15391, 15401, 15413, 15427, 15439, 15443, 15451, 15461, 15467, 15473, 15493, 15497, 15511, 15527, 15541, 15551, 15559, 15569, 15581, 15583, 15601, 15607, 15619, 15629, 15641, 15643, 15647, 15649, 15661, 15667, 15671, 15679, 15683, 15727, 15731, 15733, 15737, 15739, 15749, 15761, 15767, 15773, 15787, 15791, 15797, 15803, 15809, 15817, 15823, 15859, 15877, 15881, 15887, 15889, 15901, 15907, 15913, 15919, 15923, 15937, 15959, 15971, 15973, 15991, 16001, 16007, 16033, 16057, 16061, 16063, 16067, 16069, 16073, 16087, 16091, 16097, 16103, 16111, 16127, 16139, 16141, 16183, 16187, 16189, 16193, 16217, 16223, 16229, 16231, 16249, 16253, 16267, 16273, 16301, 16319, 16333, 16339, 16349, 16361, 16363, 16369, 16381, 16411, 16417, 16421, 16427, 16433, 16447, 16451, 16453, 16477, 16481, 16487, 16493, 16519, 16529, 16547, 16553, 16561, 16567, 16573, 16603, 16607, 16619, 16631, 16633, 16649, 16651, 16657, 16661, 16673, 16691, 16693, 16699, 16703, 16729, 16741, 16747, 16759, 16763, 16787, 16811, 16823, 16829, 16831, 16843, 16871, 16879, 16883, 16889, 16901, 16903, 16921, 16927, 16931, 16937, 16943, 16963, 16979, 16981, 16987, 16993, 17011, 17021, 17027, 17029, 17033, 17041, 17047, 17053, 17077, 17093, 17099, 17107, 17117, 17123, 17137, 17159, 17167, 17183, 17189, 17191, 17203, 17207, 17209, 17231, 17239, 17257, 17291, 17293, 17299, 17317, 17321, 17327, 17333, 17341, 17351, 17359, 17377, 17383, 17387, 17389, 17393, 17401, 17417, 17419, 17431, 17443, 17449, 17467, 17471, 17477, 17483, 17489, 17491, 17497, 17509, 17519, 17539, 17551, 17569, 17573, 17579, 17581, 17597, 17599, 17609, 17623, 17627, 17657, 17659, 17669, 17681, 17683, 17707, 17713, 17729, 17737, 17747, 17749, 17761, 17783, 17789, 17791, 17807, 17827, 17837, 17839, 17851, 17863, 17881, 17891, 17903, 17909, 17911, 17921, 17923, 17929, 17939, 17957, 17959, 17971, 17977, 17981, 17987, 17989, 18013, 18041, 18043, 18047, 18049, 18059, 18061, 18077, 18089, 18097, 18119, 18121, 18127, 18131, 18133, 18143, 18149, 18169, 18181, 18191, 18199, 18211, 18217, 18223, 18229, 18233, 18251, 18253, 18257, 18269, 18287, 18289, 18301, 18307, 18311, 18313, 18329, 18341, 18353, 18367, 18371, 18379, 18397, 18401, 18413, 18427, 18433, 18439, 18443, 18451, 18457, 18461, 18481, 18493, 18503, 18517, 18521, 18523, 18539, 18541, 18553, 18583, 18587, 18593, 18617, 18637, 18661, 18671, 18679, 18691, 18701, 18713, 18719, 18731, 18743, 18749, 18757, 18773, 18787, 18793, 18797, 18803, 18839, 18859, 18869, 18899, 18911, 18913, 18917, 18919, 18947, 18959, 18973, 18979, 19001, 19009, 19013, 19031, 19037, 19051, 19069, 19073, 19079, 19081, 19087, 19121, 19139, 19141, 19157, 19163, 19181, 19183, 19207, 19211, 19213, 19219, 19231, 19237, 19249, 19259, 19267, 19273, 19289, 19301, 19309, 19319, 19333, 19373, 19379, 19381, 19387, 19391, 19403, 19417, 19421, 19423, 19427, 19429, 19433, 19441, 19447, 19457, 19463, 19469, 19471, 19477, 19483, 19489, 19501, 19507, 19531, 19541, 19543, 19553, 19559, 19571, 19577, 19583, 19597, 19603, 19609, 19661, 19681, 19687, 19697, 19699, 19709, 19717, 19727, 19739, 19751, 19753, 19759, 19763, 19777, 19793, 19801, 19813, 19819, 19841, 19843, 19853, 19861, 19867, 19889, 19891, 19913, 19919, 19927, 19937, 19949, 19961, 19963, 19973, 19979, 19991, 19993, 19997, 20011, 20021, 20023, 20029, 20047, 20051, 20063, 20071, 20089, 20101, 20107, 20113, 20117, 20123, 20129, 20143, 20147, 20149, 20161, 20173, 20177, 20183, 20201, 20219, 20231, 20233, 20249, 20261, 20269, 20287, 20297, 20323, 20327, 20333, 20341, 20347, 20353, 20357, 20359, 20369, 20389, 20393, 20399, 20407, 20411, 20431, 20441, 20443, 20477, 20479, 20483, 20507, 20509, 20521, 20533, 20543, 20549, 20551, 20563, 20593, 20599, 20611, 20627, 20639, 20641, 20663, 20681, 20693, 20707, 20717, 20719, 20731, 20743, 20747, 20749, 20753, 20759, 20771, 20773, 20789, 20807, 20809, 20849, 20857, 20873, 20879, 20887, 20897, 20899, 20903, 20921, 20929, 20939, 20947, 20959, 20963, 20981, 20983, 21001, 21011, 21013, 21017, 21019, 21023, 21031, 21059, 21061, 21067, 21089, 21101, 21107, 21121, 21139, 21143, 21149, 21157, 21163, 21169, 21179, 21187, 21191, 21193, 21211, 21221, 21227, 21247, 21269, 21277, 21283, 21313, 21317, 21319, 21323, 21341, 21347, 21377, 21379, 21383, 21391, 21397, 21401, 21407, 21419, 21433, 21467, 21481, 21487, 21491, 21493, 21499, 21503, 21517, 21521, 21523, 21529, 21557, 21559, 21563, 21569, 21577, 21587, 21589, 21599, 21601, 21611, 21613, 21617, 21647, 21649, 21661, 21673, 21683, 21701, 21713, 21727, 21737, 21739, 21751, 21757, 21767, 21773, 21787, 21799, 21803, 21817, 21821, 21839, 21841, 21851, 21859, 21863, 21871, 21881, 21893, 21911, 21929, 21937, 21943, 21961, 21977, 21991, 21997, 22003, 22013, 22027, 22031, 22037, 22039, 22051, 22063, 22067, 22073, 22079, 22091, 22093, 22109, 22111, 22123, 22129, 22133, 22147, 22153, 22157, 22159, 22171, 22189, 22193, 22229, 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 22303, 22307, 22343, 22349, 22367, 22369, 22381, 22391, 22397, 22409, 22433, 22441, 22447, 22453, 22469, 22481, 22483, 22501, 22511, 22531, 22541, 22543, 22549, 22567, 22571, 22573, 22613, 22619, 22621, 22637, 22639, 22643, 22651, 22669, 22679, 22691, 22697, 22699, 22709, 22717, 22721, 22727, 22739, 22741, 22751, 22769, 22777, 22783, 22787, 22807, 22811, 22817, 22853, 22859, 22861, 22871, 22877, 22901, 22907, 22921, 22937, 22943, 22961, 22963, 22973, 22993, 23003, 23011, 23017, 23021, 23027, 23029, 23039, 23041, 23053, 23057, 23059, 23063, 23071, 23081, 23087, 23099, 23117, 23131, 23143, 23159, 23167, 23173, 23189, 23197, 23201, 23203, 23209, 23227, 23251, 23269, 23279, 23291, 23293, 23297, 23311, 23321, 23327, 23333, 23339, 23357, 23369, 23371, 23399, 23417, 23431, 23447, 23459, 23473, 23497, 23509, 23531, 23537, 23539, 23549, 23557, 23561, 23563, 23567, 23581, 23593, 23599, 23603, 23609, 23623, 23627, 23629, 23633, 23663, 23669, 23671, 23677, 23687, 23689, 23719, 23741, 23743, 23747, 23753, 23761, 23767, 23773, 23789, 23801, 23813, 23819, 23827, 23831, 23833, 23857, 23869, 23873, 23879, 23887, 23893, 23899, 23909, 23911, 23917, 23929, 23957, 23971, 23977, 23981, 23993, 24001, 24007, 24019, 24023, 24029, 24043, 24049, 24061, 24071, 24077, 24083, 24091, 24097, 24103, 24107, 24109, 24113, 24121, 24133, 24137, 24151, 24169, 24179, 24181, 24197, 24203, 24223, 24229, 24239, 24247, 24251, 24281, 24317, 24329, 24337, 24359, 24371, 24373, 24379, 24391, 24407, 24413, 24419, 24421, 24439, 24443, 24469, 24473, 24481, 24499, 24509, 24517, 24527, 24533, 24547, 24551, 24571, 24593, 24611, 24623, 24631, 24659, 24671, 24677, 24683, 24691, 24697, 24709, 24733, 24749, 24763, 24767, 24781, 24793, 24799, 24809, 24821, 24841, 24847, 24851, 24859, 24877, 24889, 24907, 24917, 24919, 24923, 24943, 24953, 24967, 24971, 24977, 24979, 24989, 25013, 25031, 25033, 25037, 25057, 25073, 25087, 25097, 25111, 25117, 25121, 25127, 25147, 25153, 25163, 25169, 25171, 25183, 25189, 25219, 25229, 25237, 25243, 25247, 25253, 25261, 25301, 25303, 25307, 25309, 25321, 25339, 25343, 25349, 25357, 25367, 25373, 25391, 25409, 25411, 25423, 25439, 25447, 25453, 25457, 25463, 25469, 25471, 25523, 25537, 25541, 25561, 25577, 25579, 25583, 25589, 25601, 25603, 25609, 25621, 25633, 25639, 25643, 25657, 25667, 25673, 25679, 25693, 25703, 25717, 25733, 25741, 25747, 25759, 25763, 25771, 25793, 25799, 25801, 25819, 25841, 25847, 25849, 25867, 25873, 25889, 25903, 25913, 25919, 25931, 25933, 25939, 25943, 25951, 25969, 25981, 25997, 25999, 26003, 26017, 26021, 26029, 26041, 26053, 26083, 26099, 26107, 26111, 26113, 26119, 26141, 26153, 26161, 26171, 26177, 26183, 26189, 26203, 26209, 26227, 26237, 26249, 26251, 26261, 26263, 26267, 26293, 26297, 26309, 26317, 26321, 26339, 26347, 26357, 26371, 26387, 26393, 26399, 26407, 26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489, 26497, 26501, 26513, 26539, 26557, 26561, 26573, 26591, 26597, 26627, 26633, 26641, 26647, 26669, 26681, 26683, 26687, 26693, 26699, 26701, 26711, 26713, 26717, 26723, 26729, 26731, 26737, 26759, 26777, 26783, 26801, 26813, 26821, 26833, 26839, 26849, 26861, 26863, 26879, 26881, 26891, 26893, 26903, 26921, 26927, 26947, 26951, 26953, 26959, 26981, 26987, 26993, 27011, 27017, 27031, 27043, 27059, 27061, 27067, 27073, 27077, 27091, 27103, 27107, 27109, 27127, 27143, 27179, 27191, 27197, 27211, 27239, 27241, 27253, 27259, 27271, 27277, 27281, 27283, 27299, 27329, 27337, 27361, 27367, 27397, 27407, 27409, 27427, 27431, 27437, 27449, 27457, 27479, 27481, 27487, 27509, 27527, 27529, 27539, 27541, 27551, 27581, 27583, 27611, 27617, 27631, 27647, 27653, 27673, 27689, 27691, 27697, 27701, 27733, 27737, 27739, 27743, 27749, 27751, 27763, 27767, 27773, 27779, 27791, 27793, 27799, 27803, 27809, 27817, 27823, 27827, 27847, 27851, 27883, 27893, 27901, 27917, 27919, 27941, 27943, 27947, 27953, 27961, 27967, 27983, 27997, 28001, 28019, 28027, 28031, 28051, 28057, 28069, 28081, 28087, 28097, 28099, 28109, 28111, 28123, 28151, 28163, 28181, 28183, 28201, 28211, 28219, 28229, 28277, 28279, 28283, 28289, 28297, 28307, 28309, 28319, 28349, 28351, 28387, 28393, 28403, 28409, 28411, 28429, 28433, 28439, 28447, 28463, 28477, 28493, 28499, 28513, 28517, 28537, 28541, 28547, 28549, 28559, 28571, 28573, 28579, 28591, 28597, 28603, 28607, 28619, 28621, 28627, 28631, 28643, 28649, 28657, 28661, 28663, 28669, 28687, 28697, 28703, 28711, 28723, 28729, 28751, 28753, 28759, 28771, 28789, 28793, 28807, 28813, 28817, 28837, 28843, 28859, 28867, 28871, 28879, 28901, 28909, 28921, 28927, 28933, 28949, 28961, 28979, 29009, 29017, 29021, 29023, 29027, 29033, 29059, 29063, 29077, 29101, 29123, 29129, 29131, 29137, 29147, 29153, 29167, 29173, 29179, 29191, 29201, 29207, 29209, 29221, 29231, 29243, 29251, 29269, 29287, 29297, 29303, 29311, 29327, 29333, 29339, 29347, 29363, 29383, 29387, 29389, 29399, 29401, 29411, 29423, 29429, 29437, 29443, 29453, 29473, 29483, 29501, 29527, 29531, 29537, 29567, 29569, 29573, 29581, 29587, 29599, 29611, 29629, 29633, 29641, 29663, 29669, 29671, 29683, 29717, 29723, 29741, 29753, 29759, 29761, 29789, 29803, 29819, 29833, 29837, 29851, 29863, 29867, 29873, 29879, 29881, 29917, 29921, 29927, 29947, 29959, 29983, 29989, 30011, 30013, 30029, 30047, 30059, 30071, 30089, 30091, 30097, 30103, 30109, 30113, 30119, 30133, 30137, 30139, 30161, 30169, 30181, 30187, 30197, 30203, 30211, 30223, 30241, 30253, 30259, 30269, 30271, 30293, 30307, 30313, 30319, 30323, 30341, 30347, 30367, 30389, 30391, 30403, 30427, 30431, 30449, 30467, 30469, 30491, 30493, 30497, 30509, 30517, 30529, 30539, 30553, 30557, 30559, 30577, 30593, 30631, 30637, 30643, 30649, 30661, 30671, 30677, 30689, 30697, 30703, 30707, 30713, 30727, 30757, 30763, 30773, 30781, 30803, 30809, 30817, 30829, 30839, 30841, 30851, 30853, 30859, 30869, 30871, 30881, 30893, 30911, 30931, 30937, 30941, 30949, 30971, 30977, 30983, 31013, 31019, 31033, 31039, 31051, 31063, 31069, 31079, 31081, 31091, 31121, 31123, 31139, 31147, 31151, 31153, 31159, 31177, 31181, 31183, 31189, 31193, 31219, 31223, 31231, 31237, 31247, 31249, 31253, 31259, 31267, 31271, 31277, 31307, 31319, 31321, 31327, 31333, 31337, 31357, 31379, 31387, 31391, 31393, 31397, 31469, 31477, 31481, 31489, 31511, 31513, 31517, 31531, 31541, 31543, 31547, 31567, 31573, 31583, 31601, 31607};\nint len_list_primes = 3401;\n\nint main() {\n int t;\n scanf(\"%d\", &t);\n while(t--) {\n int n;\n int i;\n scanf(\"%d\", &n);\n \n for(i=0; i<len_list_primes; i++)\n if(!( n % list_primes[i] ) )\n break;\n\n if(i < len_list_primes)\n printf(\"%d %d\\n\", n/list_primes[i], (list_primes[i]-1)*(n/list_primes[i]));\n else\n printf(\"1 %d\\n\", n-1);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int q;\n scanf(\"%d\",&q);\n while(q--)\n {\n long long int n,k,i,f=0;\n scanf(\"%lli\",&n);\n if(n%2==0)\n {\n printf(\"%lli %lli\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=3;i<=sqrt(n);i=i+2)\n {\n if(n%i==0)\n {k=(n/i>i)?n/i:i;\n f=1;\n printf(\"%lli %lli\\n\",k,n-k);\n break;\n }}\n if(f==0)\n {\n printf(\"%d %lli\\n\",1,n-1);\n }\n\n }\n}\n}\n "}, {"source_code": "#include <stdio.h>\n \nint main(){\n\tint t, n, i;\n\tscanf(\"%d\", &t);\n\twhile(t--){\n\t\tscanf(\"%d\", &n);\n\t\t//2\n\t\ti = 2;\n\t\twhile(n % i != 0 && i * i <= n){\n\t\t\ti++;\n\t\t}\n\t\tif(i * i > n){\n\t\t\tprintf(\"%d %d\\n\", 1, n - 1);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d %d\\n\", n / i, n / i * (i - 1));\n\t\t}\n\t}\n \n \n \n \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int i,n,t,j,c,d,e,k,count;\n\tscanf(\"%lld\",&t);\n\tfor(i=0;i<t;i++)\n\t{\n\t\tscanf(\"%lld\",&n);\n\t\tcount=0;\n\t\tif(n%2==0)\n\t\tprintf(\"%lld %lld\\n\",n/2,n/2);\n\t\telse\n\t\t{\n\t\t\tc=sqrt(n);\n\t\t\tfor(j=3;j<=c;j++)\n\t\t\t{\n\t\t\t\tif(n%j==0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tk=j;\n\t\t\tif(count==1)\n\t\t\t{\n\t\t\t\te=n/k;\n\t\t\t\td=n-e;\n\t\t\t\tprintf(\"%lld %lld\\n\",e,d);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"1 %lld\\n\",n-1);\n\t\t\t}\n\t }\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tlong long int t,n,a,b,c,l,k,p;\n\tscanf(\"%lld\",&t);\n\twhile(t>0)\n{\t\tlong long int n1,m;\n\t\tscanf(\"%lld\",&n);\n\t\tm=sqrt(n);\n\t\tif(n==1) {printf(\"%lld %lld\\n\",n,n);goto j;}\n\t\telse if(n%2==0) {printf(\"%lld %lld\\n\",n/2,n/2);goto j;}\n\t\telse for(c=3;c<=m;c=c+2)\n\t{\n\tif(n%c==0) {\tn1=n/c;printf(\"%lld %lld\\n\",(n1*(c-1)),n1);goto j;\t}\n // for(p=1;p<=c;p++) printf(\"w[%d]=%d\\n\",p,w[p]);\n//\tfor(p=1;p<=c;p++) printf(\"x[%d]=%d\\n\",p,x[p]);\n\t}\n\tprintf(\"1 %lld\\n\",n-1);\n\t\tj: t--;\n}\n}"}, {"source_code": "#include<stdio.h>\n#define max(a,b) \\\n ({ __typeof__ (a) _a = (a); \\\n __typeof__ (b) _b = (b); \\\n _a > _b ? _a : _b; })\nint main(){\nint t,n,a;\nscanf(\"%d\",&t);\nwhile(t--){\n a=1;\nscanf(\"%d\",&n);\nif(n%2==0)\n printf(\"%d %d\\n\",n/2,n/2);\nelse{\nfor(int i=3;i*i<=n;i+=2){\n if(n%i==0){\n if(max(i,n/i)>a)\n a=max(i,n/i);\n }\n}\nprintf(\"%d %d\\n\",a,n-a);\n}\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=sqrt(n);\n k=0;\n for(i=2;i<=l;i++)\n {\n if(n%i==0)\n {\n k=1;\n break;\n }\n }\n if(k==0)printf(\"%d %lld\\n\",1,n-1);\n else\n {\n i=n/i;\n printf(\"%lld %lld\\n\",i,n-i);\n\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int T;\n scanf(\"%d\",&T);\n while(T>0)\n {\n long long int n , i ;\n int found=0;\n scanf(\"%I64d\",&n);\n i=2;\n while((i<=sqrt(n)) && (!found))\n {\n if(n%i==0) found=1;\n else i++;\n }\n if(found) printf(\"%I64d %I64d\\n\",n/i,n-(n/i));\n else printf(\"1 %I64d\\n\",n-1);\n\n T--;\n }\n return 0;\n}\n\n"}, {"source_code": "# include <stdio.h>\n# include <math.h>\nint main(void)\n{\n\tlong long int t,i;\n\tscanf(\"%lld\",&t);\n\tfor (i=1;i<=t;++i)\n\t{\n\t\tlong long int n;\n\t\tscanf(\"%lld\",&n);\n\t\tlong long int j,k=0,m;\n\t\tm=sqrt(n);\n\t\t//printf(\"%lld\\n\",m);\n\t\tfor (j=2;j<=m;++j)\n\t\t{\n\t\t\tif (n%j==0)\n\t\t\t{\n\t\t\t\tk=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (k==0)\n\t\t{\n\t\t\tprintf(\"1 %lld\\n\",n-1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%lld %lld\\n\",n/j,n-(n/j));\n\t\t}\n\t}\n\treturn(0);\n}"}, {"source_code": "#include<stdio.h>\nint solve(int n)\n{\n\tint i;\n\tfor (i = 2; i * i <= n; i++)\n\t\tif (n % i == 0)\n\t\t\treturn n / i;\n\treturn 1;\n}\nint main()\n{\n\tint t;\n\tscanf(\"%d\", &t);\n\tint n, m;\n\tfor (; t > 0; t--)\n\t{\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0)\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\telse\n\t\t{\n\t\t\tm = solve(n);\n\t\t\tprintf(\"%d %d\\n\", m, (n / m - 1) * m);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() \n{\n\tint t, n, i;\n\tscanf(\"%d\", &t);\n\twhile (t--)\n\t{\n\t\tscanf(\"%d\", &n);\n\t\ti = 2;\n\t\twhile (n % i != 0 && i * i <= n) \n\t\t{\n\t\t\ti++;\n\t\t}\n\t\tif (i * i > n)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\", 1, n - 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d %d\\n\", n / i, n / i * (i - 1));\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint min(int a, int b){\n if(a <= b)\n return a;\n return b;\n}\n\nvoid solve(int n){\n int root = floor(sqrt(n));\n for(int i = 2; i<=root; i++){\n if(n%i==0){\n int a = n/i;\n printf(\"%d %d\\n\",a,n-a);\n return;\n }\n }\n printf(\"%d %d\\n\",1,n-1);\n}\n\nint main(){\n int t;\n scanf(\"%d\",&t);\n for(int i =0; i<t; i++){\n int n;\n scanf(\"%d\",&n);\n solve(n);\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int t, n, i, r, p, q, c;\n scanf(\"%lld\", &t);\n while(t--)\n {\n scanf(\"%lld\", &n);\n if(n%2==0)\n printf(\"%lld %lld\\n\", n/2, n/2);\n else\n {\n r=sqrt(n)+1;\n c=0;\n for(i=2;i<=r;i++)\n {\n if(n%i==0)\n {\n p=n/i;\n q=n-p;\n c++;\n if(q==0)\n {\n q=n-1;\n p=1;\n } \n printf(\"%lld %lld\\n\", p, q);\n break;\n }\n }\n if(c==0)\n printf(\"1 %lld\\n\", n-1);\n }\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint prime(int a)\n{\nint f=0;\nfor(int i=2;i<=sqrt(a);i++)\n{\nif(a%i==0)\n{\nf=1;\nbreak;\n}\n}\nif(f==1) return 0;\nelse return 1;\n}\nint gcd(int a,int b)\n{\nif(b==0) return a;\nelse return gcd(b,a%b);\n}\nint main()\n{\n /*int n;\n scanf(\"%d\",&n);\n int a=sqrt(n);\n printf(\"%d\",a);*/\n \n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n;\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"%d %d\\n\",n/2,n/2);\n else\n {\n int check=prime(n);\n if(check==1)\n printf(\"1 %d\\n\",n-1);\n else\n {\n for(int i=2;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n int k=n/i;\n printf(\"%d %d\\n\",k,n-k);\n break;\n }\n }\n \n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n \n#define max(x,y) x > y ? x : y\n \nint main() {\n long long int i,t,n,maximum;\n scanf(\"%lld\",&t);\n while(t--){\n maximum = -999;\n scanf(\"%lld\",&n);\n if(n % 2 == 0){\n printf(\"%lld %lld\\n\",n /2,n / 2);\n continue;\n }\n else{\n for(i = 1; i <= sqrt(n) + 1; i++){\n if(n % i == 0){\n if(maximum < i)\n maximum = max(i,n / i);\n if(maximum == n)\n maximum = i;\n }\n }\n printf(\"%lld %lld\\n\",maximum,n - maximum);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x,t,n,y,s;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d\",&n);\n s=sqrt(n);\n for(x=2;x<=s;x++)\n {\n if(n%x==0)\n {\n y=n/x;\n printf(\"%d %d\\n\",y,y*(x-1));\n break;\n }\n }\n if(x==s+1)\n printf(\"1 %d\\n\",n-1);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int t, i, j;\n scanf (\"%d\", &t);\n while (t--) {\n int n, i;\n scanf (\"%d\", &n);\n if (n % 2 == 0) printf (\"%d %d\", n/2, n/2);\n else {\n int m = sqrt (n);\n for (i = 3; i <= m; i += 2) {\n if (n % i == 0) {\n printf (\"%d %d\", n/i, n -(n/ i));\n break;\n }\n }\n if (i > m) printf (\"%d %d\", 1, n-1);\n }\n printf (\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\n\nint main()\n{\n\tlong long int n,t,i,min,flag,a,b;\n\tscanf(\"%lld\",&t);\n\twhile(t--)\n\t{\n\t\tscanf(\"%lld\",&n);\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%lld %lld\\n\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflag=0,min=10e9+10;\n\t\t\tfor(i=3;i<=sqrt(n);i=i+2)\n\t\t\t{\n\t\t\t\tif(n%i==0)\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t\ta=i;\n\t\t\t\t\tb=n/i;\n\t\t\t\t\tif(a<n-a)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(n-a<min)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=n-a;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(a<min)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=a;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(b<n-b)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(n-b<min)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=n-b;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(b<min)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=b;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tprintf(\"%lld %lld\\n\",n-min,min);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"1 %lld\\n\",n-1);\n\t\t\t}\n\t\t}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<math.h>\n\nint main()\n{\n long long i,n,t,p,a,b;\n scanf(\"%lld\",&b);\n for(t=1; t<=b; t++)\n {\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld\\n\",n/2,n/2);\n }\n else{\n p=(int)sqrt(n);\n for(i=3;i<=p+2;i=i+2){\n if(n%i==0){\n a=n/i;\n printf(\"%lld %lld\\n\",a,(n-a));\n break;\n }\n else if(i>p){\n printf(\"%d %lld\\n\",1,(n-1));\n break;\n }\n }\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int t,n;\n int i,flag=0,a=0,b=0;\n scanf(\"%d\",&t);\n while(t--){\n flag=0;\n a=0;\n b=0;\n scanf(\"%d\",&n);\n \n for(i=2;i<=sqrt(n);i++){\n if(n%i==0){\n flag=1;\n b=i-1;\n a=n/i;\n break;\n }\n }\n if(flag==1){\n printf(\"%d %d\",a,a*b);\n }\n \n else{\n printf(\"%d %d\",1,n-1); \n }\n \n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,k;\n scanf(\"%d\",&t);\n long long int n,i,min;\n for(k=1;k<=t;k++)\n {\n scanf(\"%lld\",&n);\n min=n-1;\n for(i=2;i*i<=n;i++)\n {\n if(n%i==0)\n {\n if(min>=(n-(n/i)))\n {\n min=n-(n/i);\n }\n else\n {\n min=n-1;\n }\n break;\n }\n }\n printf(\"%lld %lld\\n\",(n-min),min);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n\t\tfactor=n;\n\t\tfor(j=2;j*j<=n;j++)\n\t\t{\n\t\t\n\t\t\tif(n%j==0)\n\t\t\t{\n\t\t\t\tfactor=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t \tprintf(\"%lld %lld\\n\",(factor-1)*n/factor,n/factor);\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define in32(x) scanf(\"%d\", &x)\n#define out32(x) printf(\"%d\", x)\n\nint main() {\n int t, n, i;\n in32(t);\n while(t--) {\n in32(n);\n i = 2;\n while (n%i && i * i <= n) i++;\n if ((n%i)) {\n i = n;\n }\n printf(\"%d %d\\n\", n / i, n - n / i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n#include<stdlib.h>\n/*long long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nlong long int LCM(long long int a,long long int b)\n{\n long long int i;\n for(i=b;;i+=b)\n {\n if(i%a==0)\n {\n return i;\n }\n }\n}*/\nint main()\n{\n int t;int i;\n scanf(\"%d\",&t);\n for(i=0;i<t;i++)\n {int z=0;\n long long int n=0,m=LLONG_MAX,a=0,j;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld \\n\",n/2,n/2);\n continue;\n }\n else\n {\n for(j=2;j*j<=n;j++)\n {\n if(n%j==0)\n {\n /*long long int y=LCM(j,n-j);\n m=min(m,y);\n if(m==y)\n {\n a=j;\n }*/\n printf(\"%lld %lld \\n\",n/j,n-(n/j));\n z=-1;\n break;\n }\n }\n if(z==0){\n j=1;\n printf(\"%lld %lld \\n\",j,n-j);\n }\n \n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n\nint smallestDivisor(int n) \n{ \n // if divisible by 2 \n if (n % 2 == 0) \n return 2; \n \n // iterate from 3 to sqrt(n) \n for (int i = 3; i * i <= n; i += 2) { \n if (n % i == 0) \n return i; \n } \n \n return n; \n} \n\nint main(){\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,n1,cnt=0;\n scanf(\"%d\",&n); n1=n;\n int s=smallestDivisor(n);\n if(s==n) { printf(\"1 %d\\n\",(n-1)); continue; }\n \n n1=n/s;\n printf(\"%d %d\\n\",n1,((s-1)*n1)); \n \n\n }\n return 0;\n}\n"}, {"source_code": "//Jidan Al Abrar\n#include<stdio.h>\nint main()\n{\n long long n,x,y,k,i,t;\n scanf(\"%lld\",&t);\n while(t--){\n scanf(\"%lld\",&n);\n x=1;\n y=n-1;\n k=sqrt(n);\n for(i=2;i<=k;i++)\n {\n if(n%i==0)\n {\n x=n/i;\n y=n-x;\n break;\n }\n }\n\n printf(\"%lld %lld\\n\",x,y);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint f(int n)\n{\n\tint i;\n\tfor (i = 2; i * i <= n; i++)\n\t\tif (n % i == 0)\n\t\t\treturn n / i;\n\treturn 1;\n}\nint main()\n{\n\tint t;\n\tscanf(\"%d\", &t);\n\tint n, m;\n\tfor (; t > 0; t--)\n\t{\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0)\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\telse\n\t\t{\n\t\t\tm = f(n);\n\t\t\tprintf(\"%d %d\\n\", m, (n / m - 1) * m);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n long long t, i, n, j, m;\n\n scanf(\"%lld\", &t);\n\n for (i = 0; i < t; i ++) {\n scanf(\"%lld\", &n);\n\n if (n & 1) {\n int root = sqrt(n);\n int flag = 0;\n\n for (j = 3; j <= root + 2; j += 2) {\n\n if (n % j == 0) {\n m = n / j;\n printf(\"%lld %lld\\n\", m, (n-m));\n flag = 1;\n break;\n }\n }\n if (flag == 0) printf(\"1 %lld\\n\", n-1);\n }\n\n else {\n n = n / 2;\n printf(\"%lld %lld\\n\", n, n);\n }\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint prime(long int x)\n{int flag=0;\n for(int i=2;i<=sqrt(x);i++)\n {\n if(x%i==0)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n return 0;\n else\n return 1;\n \n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long int n;\n scanf(\"%ld\",&n);\n \n if(n%2==0)\n printf(\"%ld %ld\\n\",n/2,n/2);\n else\n {\n if(prime(n))\n printf(\"1 %ld\\n\",n-1);\n else\n {long int k;\n for(int i=3;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {k=n/i;\n break;\n }\n }\n long int h=n/k;\n printf(\"%ld %ld\\n\",k,(h-1)*k);\n \n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint prime(int num){\n\tfor(int i = 2; i <= sqrt((double)num); i++){\n\t\tif(num%i == 0)\n\t\t\treturn i;\n\t}\n\n\treturn 1;\n}\n\nint main(int arg, char* argv){\n\tint cases;\n\tint num;\n\tint div;\n\tscanf(\"%d\", &cases);\n\n\twhile(cases--){\n\t\tscanf(\"%d\", &num);\n\t\tif(num%2 == 0){\n\t\t\tprintf(\"%d %d\\n\", num/2, num/2);\n\t\t}\n\t\telse if(num%3 == 0){\n\t\t\tprintf(\"%d %d\\n\", num/3, (2*num)/3);\n\t\t}\n else if((div = prime(num)) == 1){\n printf(\"%d %d\\n\", 1, num-1);\n }\n\t\telse{\n\t\t\tprintf(\"%d %d\\n\", num/div, (num-num/div));\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint dasqrt(int a){\nint i=1;\nwhile(1){\n if(i*i>=a)break;\n i++;\n}\nreturn i;\n}\n\nint minyinshu(int a){\nint i=2;\nint s=dasqrt(a);\nwhile(1){\n if(a%i==0){break;}\n if(i>s+1){i=a;break;}\n i++;\n}\nreturn i;\n}\n\nint main(){\nint num,numx,n,my;\nscanf(\"%d\",&num);\nfor(numx=1;numx<=num;numx++){\n scanf(\"%d\",&n);\n my=minyinshu(n);\n if(my==n)\n printf(\"%d %d\\n\",1,n-1);\n else{\n printf(\"%d %d\\n\",n/my,n-n/my);\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\nint checkprime(int n){\n for(int i=2;i<=n/i;i++)\n {\n if(n%i==0)\n return n/i;\n }\n return -1;\n}\nint main()\n{\n int n,t;\n scanf(\"%d\",&t);\n while(t--){\n scanf(\"%d\",&n);\n if(checkprime(n)==-1)printf(\"1 %d\\n\",n-1);\n else\n {\n int x=checkprime(n);\n printf(\"%d %d\\n\",x,(n-x));\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\tfor (int i=1; i<=t; i++){\n int n;\n scanf(\"%d\",&n);\n if (n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else {\n int limit=sqrt(n+1);\n int x=0;\n for (int j=2; j<=limit; j++){\n if (n%j==0){\n int y=n/j;\n if ((n-y)%y==0){\n printf(\"%d %d\\n\",y,n-y);\n x=1;\n break;\n }\n else{\n printf(\"%d %d\\n\",j,n-j);\n x=1;\n break;\n }\n }\n }\n if (x==0){\n printf(\"1 %d\\n\",n-1);\n }\n }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nunsigned long long int minlcm(unsigned long long int n );\nint main ()\n{\n\nunsigned long long int n,t,i,j;\nscanf(\"%llu\",&t);\n for(i=1 ;i<=t ;i++)\n {\n scanf(\"%llu\",&n);\n if (n%2==0) printf(\"%llu %llu\\n\",n/2 ,n/2);\n\n else minlcm(n);\n\n\n }\n\n\n}\n\n\nunsigned long long int minlcm(unsigned long long int n )\n{\n unsigned long long int a,i;\n for(i=2;i<= sqrt(n) ;i++)\n {\n if(n%i==0)\n {\n a=n/i;\n printf(\"%llu %llu \\n\",a,n-a);\n return 0;\n }\n\n }\n\n printf(\"%d %llu \\n\",1, n-1);\n return 0;\n\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<conio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long long int n,i,k,j,m,x,y;\n scanf(\"%lld\",&n);\n x=1;\n y=n-1;\n k=sqrt(n);\n for(i=2;i<=k;i++)\n {\n if(n%i==0)\n {\n x=n/i;\n y=n-x;\n break;\n }\n }\n printf(\"%lld %lld\\n\",x,y);\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int t;\n scanf(\"%d\", &t);\n while (t--) {\n int n;\n scanf(\"%d\", &n);\n long long d = n;\n for (long long i = 2; i*i <= n; i ++) {\n if (n % i == 0) {\n d = i;\n break;\n }\n }\n long long a = n*(d-1)/d, b = n-a;\n printf(\"%lld %lld\\n\", b, a);\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n, t, gd;\n\nint greatestdivisor(int n)\n{\n for (int i = 2; i <= sqrt(n); i++)\n if (n % i == 0) return n / i;\n return 1;\n}\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n {\n scanf(\"%d\", &t);\n gd = greatestdivisor(t);\n printf(\"%d %d\\n\", gd, t - gd);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(){\n\tint t, n, i;\n\tscanf(\"%d\", &t);\n\twhile(t--){\n\t\tscanf(\"%d\", &n);\n\t\t//2\n\t\ti = 2;\n\t\twhile(n % i != 0 && i * i <= n){\n\t\t\ti++;\n\t\t}\n\t\tif(i * i > n){\n\t\t\tprintf(\"%d %d\\n\", 1, n - 1);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d %d\\n\", n / i, n / i * (i - 1));\n\t\t}\n\t}\n \n \n \n \n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main()\n{\n\tint t; scanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint n,p; scanf(\"%d\",&n); p=n;\n\t\tfor(int i=2; i*i<=n; i++) if(n%i==0)\n\t\t{\n\t\t\tp=i; break;\n\t\t}\n\t\tprintf(\"%d %d\\n\",n/p,n-n/p);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nlong long int P[2];\n\nlong long int* F(long long int num)\n{\n int temp, j, i, A[100] = {0}, c, B[100] = {0}, min, x;\n temp = (int)sqrt(num);\n\n j = 1;\n for(i=1;i<=temp;i++)\n {\n if(num % i == 0)\n {\n A[j] = i;\n A[j+1] = num / i;\n j += 2;\n //j++;\n }\n }\n\n c = 1;\n for(i=1;i<=(j - 1);i++)\n {\n if(A[i] != num)\n {\n B[c] = num / (A[i]) - 1;\n if(c == 1)\n {\n min = B[c];\n x = 1;\n }\n else\n {\n if(B[c] < min)\n {\n min = B[c];\n x = i;\n }\n }\n c++;\n }\n }\n\n P[0] = A[x];\n P[1] = min;\n\n return P;\n}\n\nint main()\n{\n long long int t, i, n, a, b, A[100][3] = {{0}, {0}}, *p;\n scanf(\"%lld\", &t);\n for(i=1;i<=t;i++)\n {\n scanf(\"%lld\", &n);\n\n if(n % 2 == 0)\n {\n a = b = n / 2;\n }\n else\n {\n p = F(n);\n\n //printf(\"%d %d\\n\", p[0], p[1]);\n a = p[0];\n b = a * p[1];\n }\n\n A[i][1] = a;\n A[i][2] = b;\n }\n\n for(i=1;i<=t;i++)\n printf(\"%lld %lld\\n\", A[i][1], A[i][2]);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long smp(long long n)\n{\n long long i;\n if(n%2 == 0) return 2;\n for(i = 3; i*i <= n; i+=2)\n {\n if(n%i == 0) return i;\n }\n return n;\n}\n\nint main()\n{\n\tlong long n, t;\n\tscanf(\"%lld\", &t);\n\twhile(t--){\n\t\tscanf(\"%lld\", &n);\n\t\tlong long s = smp(n);\n\t\t//printf(\"%lldAA\\n\", s);\n\t\tprintf(\"%lld %lld\\n\", n/s, (n*(s-1))/s);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a,count=0;\n scanf(\"%d\",&a);\n for(int i=2;i<=10000000;i++)\n {\n if(a%i==0 && a/i!=1)\n {\n printf(\"%d %d\\n\",(a/i),(i-1)*(a/i));\n count++;\n break;\n }\n }\n if(count==0)\n {\n printf(\"1 %d\\n\",a-1);\n }\n count=0;\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long long int n,i,k,j,m,x,y;\n scanf(\"%lld\",&n);\n x=1;\n y=n-1;\n k=sqrt(n);\n for(i=2;i<=k;i++)\n {\n if(n%i==0)\n {\n x=n/i;\n y=n-x;\n break;\n }\n }\n printf(\"%lld %lld\\n\",x,y);\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,m,j,u=0;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n printf(\"%d %d\\n\",n/2,n/2);\n continue;\n }\n j=3;\n while(j<=sqrt(n))\n {\n if(n%j==0)\n {\n u++;\n break;\n }\n j++;\n }\n if(u==0)\n printf(\"1 %d\\n\",(n-1));\n if(u==1)\n printf(\"%d %d\\n\",n/j,((j-1)*(n/j)));\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\t int t,n,*a,i,m;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{ int flag=0,min,g=0,p=0;\n\t\t//a=( int*)calloc(n,sizeof( int));\n\t\tscanf(\"%d\",&n);\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=2;i<=sqrt(n);i++)\n\t\t\t{\n\t\t\t\tif(n%i==0)\n\t\t\t\t{\t \n\t\t\t\t\tm=n/i;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==0)\n\t\t\t{\n\t\t\t\tprintf(\"1 %d\",n-1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d %d\",m,n-m);\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"\\n\");\n\t}\n\t\n\t}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n,flag=0;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n printf(\"%d %d\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=3;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n printf(\"%d %d\\n\",n/i,n-(n/i));\n flag = 1;\n break;\n }\n }\n if(flag==0)\n {\n printf(\"1 %d\\n\",n-1);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h> \nint main()\n{\n\tlong long a,b,c,d,e,f,g,h,i,j,k,l;\n\tlong long z[100000],x[100000];\n\tfor(a=0;a<100000;a++)\n\t\tz[a]=0;\n\tz[0]=z[1]=1;\n\tc=0;\n\tfor(a=2;a<100000;a++)\n\t{\n\t\tif(z[a]==0)\n\t\t{\n\t\t\tfor(b=a+a;b<100000;b+=a)\n\t\t\t\tz[b]=1;\n\t\t\tx[c++]=a;\n\t\t}\n\t}\n\tscanf(\"%lli\",&a);\n\tfor(;a;a--)\n\t{\n\t\tscanf(\"%lli\",&b);\n\t\tfor(d=0;d<c;d++)\n\t\t{\n\t\t\tif(b%x[d]==0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(d==c)e=b;\n\t\telse e=x[d];\n\t\tprintf(\"%lli %lli\\n\",(b/e),(b-(b/e)));\n\t}\n\treturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid depression() {\n\tlong long int n,i;\n\n\t\tscanf(\"%lld\", &n);\n\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%lld %lld\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tfor (i = 2; i * i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tprintf(\"%lld %lld\\n\", n / i, n-(n/i));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"1 %d\\n\", n - 1);\n\t\t}\n\t}\nint main() {\n\tlong long int t;\n\tscanf(\"%lld\", &t);\n\twhile (t--) {\n\t\tdepression();\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n int q;\n scanf(\"%d\",&q);\n while(q--)\n {\n long long int n,k,i,flag=0;\n scanf(\"%lli\",&n);\n if(n%2==0)\n {\n printf(\"%lli %lli\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=3;i<=sqrt(n);i=i+2)\n {\n if(n%i==0)\n {k=(n/i>i)?n/i:i;\n flag=1;\n printf(\"%lli %lli\\n\",k,n-k);\n break;\n }}\n if(flag==0)\n {\n printf(\"%d %lli\\n\",1,n-1);\n }\n\n }\n}\n}\n "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint t,i;\n\tlong n,a[10],b[10],j;\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tj=2;\n\t\tif(n==2||n==3||n==4) {a[i]=n/2; b[i]=n-a[i];}\n\t\telse{\n\t\twhile(j<=sqrt(n))\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; goto mn;}\n\t\t\tj++;\n\t\t}\n\t\ta[i]=1; b[i]=n-1;} mn: j=2;\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long t,i,n,a,b,k,x,y;\n scanf(\"%lli\",&t);\n while(t--)\n {\n scanf(\"%lli\",&n);\n y=0;\n if(n%2==0)\n {\n a=n/2;\n b=a;\n }\n else\n\n {\n for(i=3; i*i<=n; i+=2)\n {\n if(n%i==0)\n {\n y=1;\n break;\n\n }\n }\n if(y==0){\n a=n-1;\n b=1;\n }\n else\n {\n b=n/2;\n a=n-b;\n\n for(k=2;k*k<=n;k++)\n {\n x=b*(k-1)-1;\n k=k+1;\n if(x%k==0)\n {\n x=x/(k);\n b=b-x;\n\n a=n-b;\n\n break;\n }\n\n\n }\n\n }\n\n }\n printf(\"%lli %lli\\n\",a,b);\n\n }\n\n }\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint maxp(int n)\n{\n int q=0;\n for(int i=3;i<=sqrt(n);i=i+2)\n {\n if(n%i==0)\n {\n q=n/i;\n break;\n }\n }\n if(q==0)\n {\n return 1;\n }\n else\n return q;\n}\nint main() {\n\t//code\n\t\tint t;\n\tscanf(\"%d\",&t);\n\tfor(int i=0;i<t;i++)\n\t{\n\t int n,a,b;\n\t scanf(\"%d\",&n);\n\t if(n%2==0)\n\t {\n\t printf(\"%d %d\\n\",n/2,n/2);\n\t }\n\t else\n\t {\n\t a=maxp(n);\n\t int b=n-a;\n\t printf(\"%d %d\\n\",a,b);\n\t }\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int t,n,i,a=0,j;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n a=0;\n if(n%2==0)\n {\n printf(\"%lld %lld\\n\",n/2,n/2);\n }\n else\n {\n for(i=3;i*i<=n;i++)\n {\n if(n%i==0)\n {\n a=1;\n break;\n }\n\n }\n if(a==1)\n {\n printf(\"%lld %lld\\n\",n/i,n-(n/i));\n }\n else\n {\n printf(\"1 %lld\\n\",n-1);\n }\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint is_prime(int n)\n{\n int x=sqrt(n);\n int flag=0;\n if(n<2){\n return 0;\n }\n else if(n==2){\n return 1;\n }\n else {\n if(n%2==0){\n return 0;\n }\n else{\n for(int i=3;i<=x+1;i+=2){\n if(n%i==0){\n return i;\n break;\n }\n }\n }\n }\n return 1;\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,(2*n)/3);\n }\n else {\n int prime=is_prime(n);\n if(prime==1){\n printf(\"%d %d\\n\",1,n-1);\n }\n else{\n printf(\"%d %d\\n\",n/prime,(n-(n/prime)));\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\n #include<string.h>\n #include<conio.h>\n #include<math.h>\n int main()\n {\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long long int n,i,k,j,m,ans,ans1;\n scanf(\"%lld\",&n);\n ans=1;\n ans1=n-1;\n k=sqrt(n);\n for(i=2;i<=k;i++)\n {\n if(n%i==0)\n {\n ans=n/i;\n ans1=n-ans;\n break;\n }\n }\n printf(\"%lld %lld\\n\",ans,ans1);\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int i,n,t,j,c,d,e,k,count;\n\tscanf(\"%lld\",&t);\n\tfor(i=0;i<t;i++)\n\t{\n\t\tscanf(\"%lld\",&n);\n\t\tcount=0;\n\t\tif(n%2==0)\n\t\tprintf(\"%lld %lld\\n\",n/2,n/2);\n\t\telse\n\t\t{\n\t\t\tc=sqrt(n);\n\t\t\tfor(j=3;j<=c;j++)\n\t\t\t{\n\t\t\t\tif(n%j==0)\n\t\t\t\t{\n\t\t\t\t\tcount++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tk=j;\n\t\t\tif(count==1)\n\t\t\t{\n\t\t\t\te=n/k;\n\t\t\t\td=n-e;\n\t\t\t\tprintf(\"%lld %lld\\n\",e,d);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"1 %lld\\n\",n-1);\n\t\t\t}\n\t }\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n for(int q=0;q<t;q++)\n {\n long long int n;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld\",n/2,n/2);\n }\n else{\n long long int arr[100],x=0;\n long long int i=3,t=n;\n while(t!=1 && i<=sqrt(n))\n {\n if(t%i==0)\n {\n arr[x]=i;\n x++;\n t/=i;\n printf(\"%lld %lld\",t,n-t);\n break;\n }\n else{\n i+=2;\n }\n }\n if(t==n)\n {\n printf(\"1 %lld\",n-1);\n }\n }\n printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j,a,b,c,d,f;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n f=0;\n for(i=2;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=x/i; f=1; break;\n }\n }\n\n if(f)\n {\n q=x-p;\n }\n else\n {\n p=1; q=x-p;\n }\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long t,n,i,p,d;\n scanf(\"%lld\",&t);\n while(t--)\n {\n p=0;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld\\n\",n/2,n/2);\n continue;\n }\n else\n {\n for(i=3;i*i<=n;i++)\n {\n if(n%i==0)\n {\n d=n/i;\n p=1;\n break;\n }\n }\n if(p==1)\n printf(\"%lld %lld\\n\",d,n-d);\n else\n printf(\"1 %lld\\n\",n-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint t, n, x, i;\n\t\n\tscanf(\"%d\", &t);\n\t\n\twhile(t--)\n\t{\n\t\tscanf(\"%d\", &n);\n\t\tint f=0;\n\t\t\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\\n\", n/2, n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=3; i<=sqrt(n); i+=2)\n\t\t\t{\n\t\t\t\tif(n%i==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d %d\\n\", n/i, n-(n/i));\n\t\t\t\t\tf=1; break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(f==0){\n\t\t\t\tprintf(\"1 %d\\n\", n-1);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int t, n, i, j, x, y, z;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n\n if(n%2==0)\n printf(\"%d %d\\n\", n/2, n/2);\n else\n {\n x=0;\n for(i=3;i*i<=n;i=i+2)\n {\n if(n%i==0)\n {\n x=i;\n break;\n }\n }\n if(x==0) printf(\"%d %d\\n\", 1, n-1);\n else\n {\n for(i=3;i<=n;i++)\n {\n x=n/i;\n if(x*i==n) break;\n }\n printf(\"%d %d\\n\", x, n-x);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint n, t, k;\n\nint proper (int n)\n{\n int i = 2; \n int r = (int)(sqrt(n) + 1);\n for (i = 2; i <= r; i++) \n if (n % i == 0) return n / i;\n return 1;\n}\n\nint main()\n{\n scanf(\"%d\", &t);\n for (int i = 1; i <= t; i++)\n {\n scanf(\"%d\", &n);\n k = proper (n);\n printf (\"%d %d\\n\", k, n - k);\n }\n return 0;\n}\n"}, {"source_code": "/*\n\n\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int casos, n, i, d;\n\n scanf(\"%d\", &casos);\n\n while(casos--){\n scanf(\"%d\", &n);\n\n for(d = -1, i = 2; i * i <= n; ++i){\n if(n % i == 0){\n\td = i;\n\tbreak;\n }\n }\n\n if(d == -1)\n printf(\"1 %d\\n\", n - 1);\n else\n printf(\"%d %d\\n\", n / i, n - (n / d));\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = -100000000000; // 1e11\nll MIN = 100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll primemarked[3000000];\nll primearray[3000000];\nll primeind;\n\nvoid setupprimes()\n{\n for (ll i = 2; i < 3000000; i++)\n {\n for (ll j = 2*i; j < 3000000; j+=i)\n {\n primemarked[j] = 1;\n }\n }\n for (ll i = 2; i < 3000000; i++)\n {\n if(!primemarked[i])\n {\n primearray[primeind++] = i;\n }\n }\n}\n\nint main(int argc, char const *argv[])\n{\n setupprimes();\n ll T = 1;\n scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll N ;\n scanf(\"%lld\",&N);\n ll n = 2;\n ll key = 0;\n for(n = 2;n <= 1e6 ; n++)\n {\n if(N%n == 0){\n break;\n }\n }\n if(n == 1e6 + 1){\n printf(\"%d %lld\\n\",1,N-1);\n }\n else{\n MAX = N/n;\n ll k = n;\n printf(\"%lld %lld\\n\",(k-1)*MAX,MAX);\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nvoid solve(){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"%d %d\\n\",n/2,n/2);\n else{\n int i=3,temp=0;\n while(n%i!=0&&i<=sqrt(n)){\n i+=2;\n temp++;\n }\n int m;\n if(n%i==0)\n m=n/i;\n else\n m=1;\n printf(\"%d %d\\n\",m,n-m);\n }\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--){\n solve();\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\n//int a[123];\nint main()\n{\n int i,j,m,n,t;\n scanf(\"%d\", &t);\n for(i=0;i<t;i++){\n scanf(\"%d\", &n);\n int det=1;\n if(n%2==0)printf(\"%d %d\\n\", n/2,n/2);\n else{\n j=sqrt(n);\n //printf(\"%d \", j);\n for(;j>=1;j--){\n if(n%j==0&&j!=1)det=j;\n }\n if(det!=1)printf(\"%d %d\\n\", n/det,n-n/det);\n else printf(\"1 %d\\n\", n-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nvoid main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n{\nlong int n,s;\nscanf(\"%ld\",&n);\nif((n%2)==0)\n printf(\"%ld %ld\\n\",n/2,n/2);\nelse\n {\n s=1;\n for(int i=2;i<=sqrt(n);i++)\n {\n if((n%i)==0)\n {\n s=(n/i);\n break;\n }\n }\n printf(\"%ld %ld\\n\",s,n-s);\n }\n}\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,j;\n scanf(\"%d\",&n);\n int a[n],c=0,m=0;\n for(j=0;j<n;j++)\n scanf(\"%d\",(a+j));\n for(j=0;j<n;j++)\n {\n if(j+1==a[j])\n { a[j]=1;\n c++;\n }\n }\n if(c==n)\n {\n printf(\"0\\n\");\n continue;\n }\n for(j=0;j<n;j++)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(j!=n-1)\n for(j=n-1;j>0;j--)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(m==c)\n {\n printf(\"1\\n\");\n continue;\n }\n else\n printf(\"2\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tlong long int t, n, x, y,i;\n\tscanf(\"%lld\", &t);\n\twhile (t--) {\n\t\tscanf(\"%lld\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%lld %lld\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tfor (i = 2; i * i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tprintf(\"%lld %lld\", n / i, n*(i-1)/i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=sqrt(n);\n for(i=l;i>=1;i--)\n {\n if(n%i==0)\n {\n i=n/i;\n printf(\"%lld %lld\\n\",i,n-i);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=1;\n for(i=2;i*i<=n;i++)\n {\n if(n%i==0)\n {\n l=0;\n break;\n }\n }\n\n if(l==1)\n printf(\"%d %lld\\n\",1,n-1);\n else\n {\n if(n%2==0)\n {\n i=n/2;\n k=i;\n }\n else\n {\n i=n/3;\n k=2*i;\n }\n printf(\"%lld %lld\\n\",i,k);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int t,n,i,a=0,j;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n a=0;\n if(n%2==0)\n {\n printf(\"%lld %lld\\n\",n/2,n/2);\n }\n else\n {\n for(i=3;i*i<=n;i++)\n {\n if(n%i==0)\n {\n a=1;\n break;\n }\n\n }\n if(a==1)\n {\n printf(\"%lld %lld\\n\",i,n-i);\n }\n else\n {\n printf(\"1 %lld\\n\",n-1);\n }\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n\t\tfactor=n;\n\t\tfor(j=2;j*j<=n;j++)\n\t\t{\n\t\t\n\t\t\tif(n%j==0)\n\t\t\t{\n\t\t\t\tfactor=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",factor);\n\t printf(\"%lld %lld\\n\",(factor-1)*n/factor,n/factor);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,m,j,u=0;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n printf(\"%d %d\\n\",n/2,n/2);\n continue;\n }\n j=3;\n while(j<=sqrt(n))\n {\n if(n%j==0)\n {\n u++;\n break;\n }\n j++;\n }\n if(u==0)\n printf(\"1 %d\\n\",(n-1));\n if(u==1)\n printf(\"%d %d\\n\",n/j,((j-1)*n)/j);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nvoid solve(){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"%d %d\\n\",n/2,n/2);\n else{\n int i=3;\n while(n%i!=0&&i<=sqrt(n)){\n i+=2;\n }\n int m=n/i;\n printf(\"%d %d\\n\",m,n-m);\n }\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--){\n solve();\n }\n}"}, {"source_code": "#include<stdio.h>\nint ami(int n)\n{\n int i;\n int a,b,val=0;\n for(i=8; i<=1000; i++){\n if(n%i==0){\n a=n/i;\n b=n-a;\n printf(\"%d %d\\n\",a,b);\n val++;\n break;\n }\n }\n if(val==0){\n printf(\"%d %d\\n\",1,n-1);\n }\n //return a,b;\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i,a,b;\n int n;\n int min;\n for(i=0; i<t; i++){\n scanf(\"%d\",&n);\n min=n;\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\\n\",n/5,n-(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\\n\",n/7,n-(n/7));\n }\n else{\n ami(n);\n //printf(\"%d %d\\n\",ami(n));\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int t, n, i, j, x;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n\n if(n%2==0)\n printf(\"%d %d\\n\", n/2, n/2);\n else\n {\n x=0;\n for(i=3;i*i<=n;i++)\n {\n if(n%i==0) x=i;\n }\n if(x==0) printf(\"%d %d\\n\", 1, n-1);\n else\n {\n printf(\"%d %d\\n\", x, n-x);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=sqrt(n);\n for(i=l;i>=1;i--)\n {\n if(n%i==0)\n {\n i=n/i;\n printf(\"%lld %lld\\n\",i,n-i);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int t, n, i, j, x;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n\n if(n%2==0)\n printf(\"%d %d\\n\", n/2, n/2);\n else\n {\n x=0;\n for(i=3;i*i<=n;i++)\n {\n if(n%i==0) x=i;\n }\n if(x==0) printf(\"%d %d\\n\", 1, n-1);\n else\n {\n printf(\"%d %d\\n\", x, n-x);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n printf(\"%d \", i);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\", n/2+1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x-i;\n }\n }\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n\t\tfor(j=2;j*j<=n;j++)\n\t\t{\n\t\t\tif(n%j==0)\n\t\t\t{\n\t\t\t\tfactor=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld %lld\\n\",(factor-1)*n/factor,n/factor);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t;\n\tscanf(\"%d\", &t);\n\tint n, m;\n\tfor (; t > 0; t--)\n\t{\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0)\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\telse\n\t\t{\n\t\t\tm = 2;\n\t\t\twhile (n % m > 0)\n\t\t\t\tm++;\n\t\t\tif (m != n)\n\t\t\t\tprintf(\"%d %d\\n\", m, (n / m - 1) * m);\n\t\t\telse\n\t\t\t\tprintf(\"%d %d\", 1, n - 1);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = -100000000000; // 1e11\nll MIN = 100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll primemarked[3000000];\nll primearray[3000000];\nll primeind;\n\nvoid setupprimes()\n{\n for (ll i = 2; i < 3000000; i++)\n {\n for (ll j = 2*i; j < 3000000; j+=i)\n {\n primemarked[j] = 1;\n }\n }\n for (ll i = 2; i < 3000000; i++)\n {\n if(!primemarked[i])\n {\n primearray[primeind++] = i;\n }\n }\n}\n\nint main(int argc, char const *argv[])\n{\n setupprimes();\n ll T = 1;\n scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll N ;\n scanf(\"%lld\",&N);\n ll n = 2;\n ll key = 0;\n for(n = 2;n*n <= N ; n++)\n {\n if(N%n == 0){\n break;\n }\n }\n if(n == 1e6 + 1){\n printf(\"%d %lld\\n\",1,N-1);\n }\n else{\n MAX = N/n;\n ll k = n;\n printf(\"%lld %lld\\n\",(k-1)*MAX,MAX);\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint prime(long int x)\n{int flag=0;\n for(int i=2;i<=sqrt(x);i++)\n {\n if(x%i==0)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n return 0;\n else\n return 1;\n \n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n long int n;\n scanf(\"%ld\",&n);\n \n if(n%2==0)\n printf(\"%ld %ld\\n\",n/2,n/2);\n else\n {\n if(prime(n))\n printf(\"1 %ld\\n\",n-1);\n else\n {long int k;\n for(int i=sqrt(n);i>=1;i--)\n {\n if(n%i==0)\n {k=n/i;\n break;\n }\n }\n long int h=n/k;\n printf(\"%ld %ld\\n\",k,(h-1)*k);\n \n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n else if(a%3==0)\n {\n printf(\"%d %d\\n\",a/3,2*(a/3));\n }\n else \n {\n printf(\"1 %d\\n\",a-1);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int q;\n scanf(\"%d\",&q);\n while(q--)\n {\n long long int n,k,i,f=0;\n scanf(\"%lli\",&n);\n if(n%2==0)\n {\n printf(\"%lli %lli\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=sqrt(n);i>1;i--)\n {\n if(n%i==0)\n {k=(n/i>i)?n/i:i;\n f=1;\n printf(\"%lli %lli\\n\",k,n-k);\n break;\n }}\n if(f==0)\n {\n printf(\"%d %lli\\n\",1,n-1);\n }\n\n }\n}\n}\n "}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int t,n;\n int i,flag=0,a=0,b=0;\n scanf(\"%d\",&t);\n while(t--){\n flag=0;\n a=0;\n b=0;\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d %d\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\",n/3,2*(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\",n/5,4*(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\",n/7,6*(n/7));\n }\n else{\n for(i=11;i<=sqrt(n);i++){\n if(n%i==0){\n flag=1;\n b=i;\n a=n/i;\n break;\n }\n }\n if(flag==1){\n printf(\"%d %d\",a,a*b);\n }\n \n else{\n printf(\"%d %d\",1,n-1); \n }\n }\n printf(\"\\n\");\n \n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nlong long int P[2];\n\nlong long int* F(long long int num)\n{\n int temp, j, i, A[100] = {0}, c, B[100] = {0}, min, x;\n temp = (int)sqrt(num);\n\n j = 1;\n for(i=1;i<=temp;i++)\n {\n if(num % i == 0)\n {\n A[j] = i;\n A[j+1] = num / i;\n j += 2;\n //j++;\n }\n }\n\n c = 1;\n for(i=1;i<=(j - 2);i++)\n {\n if(A[i] != num)\n {\n B[c] = num / (A[i]) - 1;\n if(c == 1)\n {\n min = B[c];\n x = 1;\n }\n else\n {\n if(B[c] < min)\n {\n min = B[c];\n x = i;\n }\n }\n c++;\n }\n }\n\n P[0] = A[x];\n P[1] = min;\n\n return P;\n}\n\nint main()\n{\n long long int t, i, n, a, b, A[100][3] = {{0}, {0}}, *p;\n scanf(\"%lld\", &t);\n for(i=1;i<=t;i++)\n {\n scanf(\"%lld\", &n);\n\n if(n % 2 == 0)\n {\n a = b = n / 2;\n }\n else\n {\n p = F(n);\n\n //printf(\"%d %d\\n\", p[0], p[1]);\n a = p[0];\n b = a * p[1];\n }\n\n A[i][1] = a;\n A[i][2] = b;\n }\n\n for(i=1;i<=t;i++)\n printf(\"%lld %lld\\n\", A[i][1], A[i][2]);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i,a,b;\n int n;\n int min;\n for(i=0; i<t; i++){\n scanf(\"%d\",&n);\n min=n;\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\\n\",n/5,n-(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\\n\",n/7,n-(n/7));\n }\n else{\n for(i=8; i<=n; i++){\n if(n%i==0){\n printf(\"%d %d\\n\",n/i,n-(n/i));\n break;\n }\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint t, n, x, y;\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tx = n / 2;\n\t\t\ty = n - x;\n\t\t\tif (y % x == 0) {\n\t\t\t\tx = n / 2;\n\t\t\t\ty = n - x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t\tprintf(\"%d %d\\n\", x, y);\n\t\t\tcontinue;\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int t;\n long int n,a,b;\n scanf(\"%d\",&t);\n for( ; t ;t--)\n {\n scanf(\"%ld\",&n);\n if(n%2)\n {\n b=sqrt(n);\n for(a=3;a<=b;a++)\n if(n%a==0)\n break;\n if(n%a)\n printf(\"1 %ld\\n\",n);\n else\n printf(\"%ld %ld\\n\",n/a,n-n/a);\n }\n else\n printf(\"%ld %ld\\n\",n/2,n/2);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int T;\n scanf(\"%d\",&T);\n while(T>0)\n {\n long long int n , i ;\n int found=0;\n scanf(\"%I64d\",&n);\n i=2;\n while((i<=sqrt(n)) && (!found))\n {\n if(n%i==0) found=1;\n else i++;\n }\n printf(\"%I64d %I64d\\n\",n/i,n-(n/i));\n\n T--;\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(j>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n int gcd( int a, int b)\n{\n\t int r=1;\n\twhile(r!=0)\n\t{\n\t\tr=b%a;\n\t\tb=a;\n\t\ta=r;\n\t}\n\treturn b;\n}\nmain()\n{\n\t int t,n,*a,i;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{ int save=0,min,g=0,p=0;\n\t\ta=( int*)calloc(n,sizeof( int));\n\t\tscanf(\"%d\",&n);\n\t\tmin=n+1;\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\tfor(i=1;i<=n/2;i++)\n\t\t{\t\t\n\t\t\tg=gcd(i,n-i);\n\t\t//\tprintf(\"gcd= %d\\n \",g);\n\t\t\t p=i*(n-i);\n\t\t\ta[i]=p/g;\n\t\t}\n\t\tfor(i=1;i<=n/2;i++)\n\t\t{\n\t\t\tif(a[i]<min)\n\t\t\t{\n\t\t\t\tmin=a[i];\n\t\t\t\tsave=i;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//printf(\"%d \",a[i]);\n\t\tprintf(\"%lld %lld\",save,(n-save));\n\t\t\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x/i;\n }\n }\n\n if(p!=1)\n {\n i=p/3;\n j=p-i;\n\n\n p=i*q; q=q*j;\n }\n else q=x-1;\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint P[2];\n\nint* F(long long int num)\n{\n int temp, j, i, A[100] = {0}, c, B[100] = {0}, min, x;\n temp = (int)sqrt(num);\n\n j = 1;\n for(i=1;i<=temp;i++)\n {\n if(num % i == 0)\n {\n A[j] = i;\n //A[j+1] = num / i;\n //j += 2;\n j++;\n }\n }\n\n c = 1;\n for(i=1;i<=(j - 1);i++)\n {\n B[c] = num / (A[i]) - 1;\n if(c == 1)\n min = B[c];\n else\n {\n if(B[c] < min)\n {\n min = B[c];\n x = i;\n }\n }\n c++;\n }\n\n P[0] = A[x];\n P[1] = min;\n\n return P;\n}\n\nint main()\n{\n long long int t, i, n, a, b, A[100][3] = {{0}, {0}}, *p;\n scanf(\"%lld\", &t);\n for(i=1;i<=t;i++)\n {\n scanf(\"%lld\", &n);\n\n if(n % 2 == 0)\n {\n a = b = n / 2;\n }\n else\n {\n p = F(n);\n\n //printf(\"%d %d\\n\", p[0], p[1]);\n a = p[0];\n b = a * p[1];\n }\n\n A[i][1] = a;\n A[i][2] = b;\n }\n\n for(i=1;i<=t;i++)\n printf(\"%lld %lld\\n\", A[i][1], A[i][2]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = -100000000000; // 1e11\nll MIN = 100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll primemarked[3000000];\nll primearray[3000000];\nll primeind;\n\nvoid setupprimes()\n{\n for (ll i = 2; i < 3000000; i++)\n {\n for (ll j = 2*i; j < 3000000; j+=i)\n {\n primemarked[j] = 1;\n }\n }\n for (ll i = 2; i < 3000000; i++)\n {\n if(!primemarked[i])\n {\n primearray[primeind++] = i;\n }\n }\n}\n\nint main(int argc, char const *argv[])\n{\n setupprimes();\n ll T = 1;\n scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll N ;\n scanf(\"%lld\",&N);\n ll n = 2;\n ll key = 0;\n for(n = 2;n*n <= N ; n++)\n {\n if(N%n == 0){\n break;\n }\n }\n if(n == 1e6 + 1){\n printf(\"%d %lld\\n\",1,N-1);\n }\n else{\n MAX = N/n;\n ll k = n;\n printf(\"%lld %lld\\n\",(k-1)*MAX,MAX);\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(j>sqrt(n))\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int q;\n scanf(\"%d\",&q);\n while(q--)\n {\n long long int n,i,f=0,k;\n scanf(\"%lli\",&n);\n if(n%2==0)\n {\n printf(\"%lli %lli\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=sqrt(n);i>1;i--)\n {\n if(n%i==0)\n {f=1;\n k=(n/i>i)?n/i:i;\n printf(\"%lli %lli\\n\",i,k);\n break;\n }}\n if(f==0)\n {\n printf(\"%d %lli\\n\",1,n-1);\n }\n\n }\n}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nunsigned long long int minlcm(unsigned long long int n );\nint main ()\n{\n\nunsigned long long int n,t,i,j;\nscanf(\"%llu\",&t);\n for(i=1 ;i<=t ;i++)\n {\n scanf(\"%llu\",&n);\n if (n%2==0) printf(\"%llu %llu\\n\",n/2 ,n/2);\n\n else minlcm(n);\n\n\n }\n\n\n}\n\n\nunsigned long long int minlcm(unsigned long long int n )\n{\n unsigned long long int a,i;\n for(i=2;i<= sqrt(n) ;i++)\n {\n if(n%i==0)\n {\n a=n/i;\n printf(\"%llu %llu \\n\",i,n-i );\n return 0;\n }\n\n }\n\n printf(\"%d %llu \\n\",1, n-1);\n return 0;\n\n\n\n\n\n\n\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,t;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d\",&n);\n int x1,x2,c=0;\n int limit=sqrt(n)+1;\n for(i=2;i<=limit;i++)\n {\n if(n%i==0)\n {\n x1=n/i;\n x2=x1*(i-1);\n if(x1<=x2)\n {\n if(x2%x1==0)\n {\n printf(\"%d %d\\n\",x1,x2);\n c++;\n break;\n }\n }\n }\n }\n if(c==0)\n printf(\"1 %d\\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=1;\n for(i=2;i*i<=n;i++)\n {\n if(n%i==0)\n {\n l=0;\n break;\n }\n }\n\n if(l==1)\n printf(\"%d %lld\\n\",1,n-1);\n else\n {\n if(n%2==0)\n {\n i=n/2;\n k=i;\n }\n else\n {\n i=n/3;\n k=2*i;\n }\n printf(\"%lld %lld\\n\",i,k);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\t int t,n,*a,i;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{ int save=0,min,g=0,p=0;\n\t\t//a=( int*)calloc(n,sizeof( int));\n\t\tscanf(\"%d\",&n);\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=(n+1)/2;i<n;i++)\n\t\t\t{\n\t\t\t\tif(i%(n-i)==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d %d\",n-i,i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\tprintf(\"\\n\");\n\t}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a,count=0;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n else\n {\n for(int i=1;i<=a/2;i++)\n {\n if((a-i)/i==2)\n {\n count++;\n printf(\"%d %d\\n\",i,a-i);\n }\n }\n if(count==0)\n {\n printf(\"1 %d\\n\",a-1);\n }\n count=0;\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<math.h>\n\nint main()\n{\n long long i,n,t,p,a,b;\n scanf(\"%lld\",&b);\n for(t=1; t<=b; t++)\n {\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld\\n\",n/2,n/2);\n }\n else{\n p=(int)sqrt(n);\n for(i=3;i<=p+1;i=i+2){\n if(n%i==0){\n a=n/i;\n printf(\"%lld %lld\\n\",a,(n-a));\n break;\n }\n else if(i==p+1){\n printf(\"%lld %lld\\n\",1,(n-1));\n break;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int q;\n scanf(\"%d\",&q);\n while(q--)\n {\n long long int n,i,f=0,k;\n scanf(\"%lli\",&n);\n if(n%2==0)\n {\n printf(\"%lli %lli\\n\",n/2,n/2);\n\n }\n else\n {\n for(i=sqrt(n)+1;i>1;i--)\n {\n if(n%i==0)\n {f=1;\n k=(n/i>i)?n/i:i;\n printf(\"%lli %lli\\n\",k,n-k);\n break;\n }}\n if(f==0)\n {\n printf(\"%d %lli\\n\",1,n-1);\n }\n\n }\n}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tlong long int t, n, x, y,i;\n\tscanf(\"%lld\", &t);\n\twhile (t--) {\n\t\tscanf(\"%lld\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%lld %lld\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tfor (i = 2; i * i <= n; i++) {\n\t\t\t\tif (n % i == 0) {\n\t\t\t\t\tprintf(\"%lld %lld\", n / i, n*(i-1)/i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint t,i;\n\tlong n,a[10],b[10],j;\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tj=2;\n\t\tif(n==2) {a[i]=1; b[i]=1;}\n\t\telse{\n\t\twhile(j<=sqrt(n))\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; break;}\n\t\t\tj++;\n\t\t}\n\t\tif(j==n) {a[i]=1; b[i]=n-1;}}\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x/i;\n }\n }\n\n if(p!=1)\n {\n i=p/3;\n j=p-i;\n\n\n p=i*q; q=q*j;\n }\n else q=x-1;\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int t,n;\n int i,flag=1;\n scanf(\"%d\",&t);\n while(t--){\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d %d\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\",n/3,2*(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\",n/5,4*(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\",n/7,6*(n/7));\n }\n /* flag=1;\n for(i=2;i<=sqrt(n);i++){\n if (n % i == 0) { \n flag = 0; \n break; \n } \n } */\n \n \n else{\n printf(\"%d %d\",1,n-1); \n }\n printf(\"\\n\");\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n int gcd(long long int a,long long int b)\n{\n\tlong long int r=1;\n\twhile(r!=0)\n\t{\n\t\tr=b%a;\n\t\tb=a;\n\t\ta=r;\n\t}\n\treturn b;\n}\nmain()\n{\n\t int t,n,*a,i;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{ int save=0,min,g=0,p=0;\n\t\ta=( int*)calloc(n,sizeof( int));\n\t\tscanf(\"%d\",&n);\n\t\tmin=n+1;\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\tfor(i=1;i<=n/2;i++)\n\t\t{\t\t\n\t\t\tg=gcd(i,n-i);\n\t\t//\tprintf(\"gcd= %d\\n \",g);\n\t\t\t p=i*(n-i);\n\t\t\ta[i]=p/g;\n\t\t}\n\t\tfor(i=1;i<=n/2;i++)\n\t\t{\n\t\t\tif(a[i]<min)\n\t\t\t{\n\t\t\t\tmin=a[i];\n\t\t\t\tsave=i;\n\t\t\t}\n\t\t}\n\t\t\n\t\t//printf(\"%d \",a[i]);\n\t\tprintf(\"%lld %lld\",save,(n-save));\n\t\t\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint t, n, x, y;\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tx = n / 2;\n\t\t\ty = n - x;\n\t\t\tif (y % x == 0) {\n\t\t\t\tx = n / 2;\n\t\t\t\ty = n - x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t\tprintf(\"%d %d\", x, y);\n\t\t\tcontinue;\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int T;\n scanf(\"%d\",&T);\n while(T>0)\n {\n long long int n , i ;\n int found=0;\n scanf(\"%I64d\",&n);\n i=2;\n while((i<=sqrt(n)) && (!found))\n {\n if(n%i==0) found=1;\n else i++;\n }\n printf(\"%I64d %I64d\\n\",n/i,n-(n/i));\n\n T--;\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,j;\n scanf(\"%d\",&n);\n int a[n],c=0,m=0;\n for(j=0;j<n;j++)\n scanf(\"%d\",(a+j));\n for(j=0;j<n;j++)\n {\n if(j+1==a[j])\n { a[j]=1;\n c++;\n }\n }\n if(c==n)\n {\n printf(\"0\\n\");\n continue;\n }\n for(j=0;j<n;j++)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(j!=n-1)\n for(j=n-1;j>0;j--)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(m==c)\n {\n printf(\"1\\n\");\n continue;\n }\n else\n printf(\"2\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(j>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n\t\tfor(j=2;j*j<=n;j++)\n\t\t{\n\t\t\tif(n%j==0)\n\t\t\t{\n\t\t\t\tfactor=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld %lld\\n\",(factor-1)*n/factor,n/factor);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint is_prime(int n)\n{\n int x=sqrt(n);\n int flag=0;\n if(n<2){\n return 0;\n }\n else if(n==2){\n return 1;\n }\n else {\n if(n%2==0){\n return 0;\n }\n else{\n for(int i=3;i<=x+1;i+=2){\n if(n%i==0){\n return 0;\n break;\n }\n }\n }\n }\n return 1;\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--){\n int n;\n scanf(\"%d\",&n);\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,(2/3)*n);\n }\n else {\n int prime=is_prime(n);\n if(prime){\n printf(\"%d %d\\n\",1,n-1);\n }\n else{\n int x=n/2;\n if(x%2==0){\n x++;\n }\n for(int i=x;i>=1;i-=2){\n int m=n-i;\n if(m%i==0){\n printf(\"%d %d\\n\",i,m);\n break;\n }\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,j;\n scanf(\"%d\",&n);\n int a[n],c=0,m=0;\n for(j=0;j<n;j++)\n scanf(\"%d\",(a+j));\n for(j=0;j<n;j++)\n {\n if(j+1==a[j])\n { a[j]=1;\n c++;\n }\n }\n if(c==n)\n {\n printf(\"0\\n\");\n continue;\n }\n for(j=0;j<n;j++)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(j!=n-1)\n for(j=n-1;j>0;j--)\n {\n if(a[j]==j+1)\n m++;\n else\n break;\n }\n if(m==c)\n {\n printf(\"1\\n\");\n continue;\n }\n else\n printf(\"2\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint prime(int a)\n{\nint f=0;\nfor(int i=2;i<=sqrt(a);i++)\n{\nif(a%i==0)\n{\nf=1;\nbreak;\n}\n}\nif(f==1) return 0;\nelse return 1;\n}\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int n;\n scanf(\"%d\",&n);\n if(n%2==0)\n printf(\"%d %d\\n\",n/2,n/2);\n else\n {\n int check=prime(n);\n if(check==1)\n printf(\"1 %d\\n\",n-1);\n else\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint t, n, x, y;\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tx = n / 2;\n\t\t\ty = n - x;\n\t\t\tif (y % x == 0) {\n\t\t\t\tx = n / 2;\n\t\t\t\ty = n - x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t\tprintf(\"%d %d\\n\", x, y);\n\t\t\tcontinue;\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n if(a%3==0 && a%2!=0)\n {\n printf(\"%d %d\\n\",a/3,2*(a/3));\n }\n if(a%2!=0 && a%3!=0) \n {\n printf(\"1 %d\\n\",a-1);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n if(a%3==0 && a%2!=0)\n {\n printf(\"%d %d\\n\",a/3,2*(a/3));\n }\n if(a%2!=0 && a%3!=0) \n {\n printf(\"1 %d\\n\",a-1);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n#include<stdlib.h>\n/*long long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nlong long int LCM(long long int a,long long int b)\n{\n long long int i;\n for(i=b;;i+=b)\n {\n if(i%a==0)\n {\n return i;\n }\n }\n}*/\nint main()\n{\n int t;int i;\n scanf(\"%d\",&t);\n for(i=0;i<t;i++)\n {\n long long int n=0,m=LLONG_MAX,a=0,j;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld \\n\",n/2,n/2);\n continue;\n }\n else\n {\n for(j=2;j*j<=n;j++)\n {\n if(n%j==0)\n {\n /*long long int y=LCM(j,n-j);\n m=min(m,y);\n if(m==y)\n {\n a=j;\n }*/\n printf(\"%lld %lld \\n\",n/j,n-(n/j));\n break;\n }\n }\n \n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n//float pi=acos(-1.0);\n//int dp[1000000001];\n//char str[2000000009];\nint main()\n{\n int i,j,m,n,t,k;\n scanf(\"%d\", &t);\n for(i=0;i<t;i++){\n scanf(\"%d\", &n);\n if(n%2==0)printf(\"%d %d\\n\", n/2, n/2);\n else{\n for(j=n/2;j<n;j++){\n if(j%(n-j)==0){\n break;\n }\n }\n printf(\"%d %d\", (n-j),j);\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d\", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n)&&n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n#include<stdlib.h>\n/*long long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nlong long int LCM(long long int a,long long int b)\n{\n long long int i;\n for(i=b;;i+=b)\n {\n if(i%a==0)\n {\n return i;\n }\n }\n}*/\nint main()\n{\n int t;int i;\n scanf(\"%d\",&t);\n for(i=0;i<t;i++)\n {\n long long int n=0,m=LLONG_MAX,a=0,j;\n scanf(\"%lld\",&n);\n if(n%2==0)\n {\n printf(\"%lld %lld \\n\",n/2,n/2);\n continue;\n }\n else\n {\n for(j=2;j*j<=n;j++)\n {\n if(n%j==0)\n {\n /*long long int y=LCM(j,n-j);\n m=min(m,y);\n if(m==y)\n {\n a=j;\n }*/\n printf(\"%lld %lld \\n\",n/j,n-(n/j));\n break;\n }\n }\n \n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \n long long int t,n,i,j,factor;\n scanf(\"%lld\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%lld\",&n);\n\t\tfactor=n;\n\t\tfor(j=2;j*j<=n;j++)\n\t\t{\n\t\t\n\t\t\tif(n%j==0)\n\t\t\t{\n\t\t\t\tfactor=j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",factor);\n\t printf(\"%lld %lld\\n\",(factor-1)*n/factor,n/factor);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i-1;\n k=sqrt(n);\n printf(\"%d \", i);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\", n/2+1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n for(i=0; i<t; i++)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d \", n/2);\n printf(\"\\n\");\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(j>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nvoid joss_joss()\n{\n int ara[20]={3,5,7,9,11,13,15,17,19};\n long long int n,i;\n scanf(\"%lld\",&n);\n if(n%2==0)\n printf(\"%lld %lld\\n\",n/2,n/2);\n else\n {\n for(i=0;i<9;i++)\n {if(n%ara[i]==0)\n {\n printf(\"%lld %lld\\n\",n/ara[i],n-n/ara[i]);\n return 0;\n }\n }\n printf(\"1 %lld\\n\",n-1);\n }\n\n}\n\n\n\nint main()\n{\n int t ;\n scanf(\"%d\",&t);\n while(t--)\n joss_joss();\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(x,y) x > y ? x : y\n\nint main() {\n long long int i,t,n,x;\n scanf(\"%lld\",&t);\n while(t--){\n scanf(\"%lld\",&n);\n if(n % 2 == 0){\n printf(\"%lld %lld\\n\",n /2,n / 2);\n continue;\n }\n else{\n for(i = sqrt(n) + 1; i >= 1; i--){\n if(n % i == 0){\n x = max(n / i,i);\n break;\n }\n }\n printf(\"%lld %lld\\n\",x,n - x);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x-i;\n }\n }\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n if(a%3==0 && a%2!=0)\n {\n printf(\"%d %d\\n\",a/3,2*(a/3));\n }\n if(a%2!=0 && a%3!=0) \n {\n printf(\"1 %d\\n\",a-1);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = -100000000000; // 1e11\nll MIN = 100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll primemarked[3000000];\nll primearray[3000000];\nll primeind;\n\nvoid setupprimes()\n{\n for (ll i = 2; i < 3000000; i++)\n {\n for (ll j = 2*i; j < 3000000; j+=i)\n {\n primemarked[j] = 1;\n }\n }\n for (ll i = 2; i < 3000000; i++)\n {\n if(!primemarked[i])\n {\n primearray[primeind++] = i;\n }\n }\n}\n\nint main(int argc, char const *argv[])\n{\n setupprimes();\n ll T = 1;\n scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll N ;\n scanf(\"%lld\",&N);\n ll n = 2;\n ll key = 0;\n for(n = 2;n*n <= N ; n++)\n {\n if(N%n == 0){\n break;\n }\n }\n if(n == 1e6 + 1){\n printf(\"%d %lld\\n\",1,N-1);\n }\n else{\n MAX = N/n;\n ll k = n;\n printf(\"%lld %lld\\n\",(k-1)*MAX,MAX);\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n int n;\n int min;\n for(i=0; i<t; i++){\n scanf(\"%d\",&n);\n min=n;\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\\n\",n/5,n-(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\\n\",n/7,n-(n/7));\n }\n else if(n%9==0){\n printf(\"%d %d\\n\",n/9,n-(n/9));\n }\n else{\n printf(\"%d %d\\n\",n-(n-1),n-1);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint prime(int num){\n\tfor(int i = 2; i <= num/2; i++){\n\t\tif(num%i == 0)\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\nint main(int arg, char* argv){\n\tint cases;\n\tint num;\n\tscanf(\"%d\", &cases);\n\n\twhile(cases--){\n\t\tscanf(\"%d\", &num);\n\t\tif(num%2 == 0){\n\t\t\tprintf(\"%d %d\\n\", num/2, num/2);\n\t\t}\n\t\telse if(prime(num)){\n\t\t\tprintf(\"%d %d\\n\", 1, num-1);\n\t\t}\n\t\telse{\n\t\t\tprintf(\"%d %d\\n\", num/3, (2*num)/3);\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint t, n, x, y;\n\tscanf(\"%d\", &t);\n\twhile (t--) {\n\t\tscanf(\"%d\", &n);\n\t\tif (n % 2 == 0) {\n\t\t\tprintf(\"%d %d\\n\", n / 2, n / 2);\n\t\t}\n\t\telse {\n\t\t\tx = n / 2;\n\t\t\ty = n - x;\n\t\t\tif (y % x == 0) {\n\t\t\t\tx = n / 2;\n\t\t\t\ty = n - x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx--;\n\t\t\t\ty++;\n\t\t\t}\n\t\t\tprintf(\"%d %d\", x, y);\n\t\t\tcontinue;\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n {\n int a;\n scanf(\"%d\",&a);\n if(a%2==0)\n {\n printf(\"%d %d\\n\",a/2,a/2);\n }\n if(a%3==0 && a%2!=0)\n {\n printf(\"%d %d\\n\",a/3,2*(a/3));\n }\n if(a%2!=0 && a%3!=0) \n {\n printf(\"1 %d\\n\",a-1);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\n\nvoid joss_joss()\n{\n int ara[20]={3,5,7,9,11,13,15,17,19};\n long long int n,i;\n scanf(\"%lld\",&n);\n if(n%2==0)\n printf(\"%lld %lld\\n\",n/2,n/2);\n else\n {\n for(i=0;i<9;i++)\n {if(n%ara[i]==0)\n {\n printf(\"%lld %lld\\n\",n/ara[i],n-n/ara[i]);\n return 0;\n }\n }\n printf(\"1 %lld\\n\",n-1);\n }\n\n}\n\n\n\nint main()\n{\n int t ;\n scanf(\"%d\",&t);\n while(t--)\n joss_joss();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t,j,i;\n\tlong n,a[10],b[10];\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tfor(j=2;j<=1000;j++)\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; break;}\n\t\t}\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int t, n, i, r;\n scanf(\"%lld\", &t);\n while(t--)\n {\n scanf(\"%lld\", &n);\n if(n%2==0)\n printf(\"%lld %lld\\n\", n/2, n/2);\n else\n {\n r=sqrt(n);\n for(i=r;i>=1;i--)\n {\n if(n%i==0)\n {\n printf(\"%lld %lld\\n\", i, n-i);\n break;\n }\n }\n }\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long t,i,n,k,l;\n scanf(\"%lld\",&t);\n while(t--)\n {\n scanf(\"%lld\",&n);\n l=sqrt(n);\n for(i=l;i>=1;i--)\n {\n if(n%i==0)\n {\n if(i!=1) i=n/i;\n printf(\"%lld %lld\\n\",i,n-i);\n break;\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned int t,i,n,a,b,k,y;\n scanf(\"%u\",&t);\n while(t--)\n {\n scanf(\"%u\",&n);\n y=0;\n if(n%2==0)\n {\n a=n/2;\n b=a;\n }\n else\n\n {\n for(i=3; i*i<=n; i+=2)\n {\n if(n%i==0)\n {\n y=1;\n break;\n\n }\n }\n if(y==0){\n a=n-1;\n b=1;\n }\n else\n {\n b=n/2;\n a=n-b;\n for(k=2;k*k<=n;k++)\n {\n if((b*(k-1)-1)%(k+1)==0)\n {\n b=b-(b*(k-1)-1)/(k+1);\n a=n-b;\n break;\n }\n\n }\n }\n\n }\n printf(\"%u %u\\n\",a,b);\n\n }\n\n }\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j,a,b,c,d;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x/i;\n }\n }\n\n if(p!=1)\n {\n for(i=1;i*i<=p;i++)\n {\n if(p%i==0) j=i;\n }\n\n i=p-j;\n\n c=p; d=q;\n\n p=j*q; q=q*i;\n\n for(i=1;i*i<=d;i++)\n {\n if(d%i==0) j=i;\n }\n\n i=d-j;\n\n a=c*j; b=c*i;\n\n\n if(b<q)\n {\n p=a; q=b;\n }\n }\n else q=x-1;\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nunsigned long long int minlcm(unsigned long long int n );\nint main ()\n{\n\nunsigned long long int n,t,i,j;\nscanf(\"%llu\",&t);\n for(i=1 ;i<=t ;i++)\n {\n scanf(\"%llu\",&n);\n if (n%2==0) printf(\"%llu %llu\\n\",n/2 ,n/2);\n\n else minlcm(n);\n\n\n }\n\n\n}\n\n\nunsigned long long int minlcm(unsigned long long int n )\n{\n unsigned long long int a,i;\n for(i=2;i<= sqrt(n) ;i++)\n {\n if(n%i==0)\n {\n a=n/i;\n printf(\"%llu %llu \\n\",i,n-i );\n return 0;\n }\n\n }\n\n printf(\"%d %llu \\n\",1, n-1);\n return 0;\n\n\n\n\n\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\nint n, t, min;\n\nint gcd(int a, int b)\n{\n if (a == b) return a;\n else\n {\n if (a > b) return gcd(a - b, b);\n else return gcd(b - a, a);\n }\n}\n\nint lcm (int a, int b)\n{\n return (a * b) / gcd(a, b);\n}\n\nint testcase(int n)\n{\n min = lcm(1, n);\n for (int i = 1; i <= n / 2; i++) \n if (lcm(i, n - i) < min) min = lcm(i, n - i);\n for (int i = 1; i <= n / 2; i++) \n if (min == lcm(i, n - i)) return i;\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n {\n scanf(\"%d\", &t);\n printf(\"%d %d\", testcase(t), t - testcase(t));\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n for(i=0;i<t;i++)\n {\n int n,m,j,u=0;\n scanf(\"%d\",&n);\n if(n%2==0)\n {\n printf(\"%d %d\\n\",n/2,n/2);\n continue;\n }\n j=3;\n while(j<=sqrt(n))\n {\n if(n%j==0)\n {\n u++;\n break;\n }\n j++;\n }\n if(u==0)\n printf(\"1 %d\\n\",(n-1));\n if(u==1)\n printf(\"%d %d\\n\",n/j,((j-1)*n)/j);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int T;\n scanf(\"%d\",&T);\n while(T>0)\n {\n long long int n , i ;\n int found=0;\n scanf(\"%I64d\",&n);\n i=2;\n while((i<=sqrt(n)) && (!found))\n {\n if(n%i==0) found=1;\n else i++;\n }\n printf(\"%I64d %I64d\\n\",n/i,n-(n/i));\n\n T--;\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nvoid main()\n{\n int t;\n scanf(\"%d\",&t);\n while(t--)\n{\nlong int n,s;\nscanf(\"%ld\",&n);\nif((n%2)==0)\n printf(\"%ld %ld\\n\",n/2,n/2);\nelse\n {\n s=1;\n for(int i=2;i<=sqrt(n);i++)\n {\n if((n%i)==0)\n {\n s=(n/i);\n }\n }\n printf(\"%ld %ld\\n\",s,n-s);\n }\n}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,x,i,p,q,j;\n\n scanf(\"%d\",&t);\n\n while(t--)\n {\n scanf(\"%d\",&x);\n\n if(x%2==0)\n {\n printf(\"%d %d\\n\",x/2,x/2);\n\n continue;\n }\n\n for(i=1;i*i<=x;i++)\n {\n if(x%i==0)\n {\n p=i; q=x-i;\n }\n }\n\n printf(\"%d %d\\n\",p,q);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t;\n scanf(\"%d\",&t);\n int i;\n int n;\n int min;\n for(i=0; i<t; i++){\n scanf(\"%d\",&n);\n min=n;\n if(n%2==0){\n printf(\"%d %d\\n\",n/2,n/2);\n }\n else if(n%3==0){\n printf(\"%d %d\\n\",n/3,n-(n/3));\n }\n else if(n%5==0){\n printf(\"%d %d\\n\",n/5,n-(n/5));\n }\n else if(n%7==0){\n printf(\"%d %d\\n\",n/7,n-(n/7));\n }\n else if(n%9==0){\n printf(\"%d %d\\n\",n/9,n-(n/9));\n }\n else{\n printf(\"%d %d\\n\",n-(n-1),n-1);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint t,i;\n\tlong n,a[10],b[10],j;\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tj=2;\n\t\tif(n==2) {a[i]=1; b[i]=1;}\n\t\telse{\n\t\twhile(j<sqrt(n))\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; break;}\n\t\t\tj++;\n\t\t}\n\t\tif(j==n) {a[i]=1; b[i]=n-1;}}\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define max(x,y) x > y ? x : y\n\nint main() {\n long long int i,t,n,x;\n scanf(\"%lld\",&t);\n while(t--){\n scanf(\"%lld\",&n);\n if(n % 2 == 0){\n printf(\"%lld %lld\\n\",n /2,n / 2);\n continue;\n }\n else{\n for(i = sqrt(n) + 1; i >= 1; i--){\n if(n % i == 0){\n x = max(n / i,i);\n break;\n }\n }\n printf(\"%lld %lld\\n\",x,n - x);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t,i;\n\tlong n,a[10],b[10],j;\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tj=2;\n\t\twhile(j<n)\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; break;}\n\t\t\tj++;\n\t\t}\n\t\tif(j==n) {a[i]=1; b[i]=n;}\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint t,i;\n\tlong n,a[10],b[10],j;\n\tscanf(\"%d\",&t);\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tscanf(\"%ld\",&n);\n\t\tj=2;\n\t\tif(n==2||n==3||n==4) {a[i]=n/2; b[i]=n-a[i];}\n\t\telse{\n\t\twhile(j<sqrt(n))\n\t\t{\n\t\t\tif(n%j==0) {a[i]=n/j; b[i]=n-a[i]; break;}\n\t\t\tj++;\n\t\t}\n\t\tif(j==n) {a[i]=1; b[i]=n-1;}}\n\t}\n\tfor(i=1;i<=t;i++)\n\t{\n\t\tprintf(\"%d %d\\n\",a[i],b[i]);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\t int t,n,*a,i;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{ int save=0,min,g=0,p=0;\n\t\t//a=( int*)calloc(n,sizeof( int));\n\t\tscanf(\"%d\",&n);\n\t\tif(n%2==0)\n\t\t{\n\t\t\tprintf(\"%d %d\",n/2,n/2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor(i=sqrt(n);i=1;i--)\n\t\t\t{\n\t\t\t\tif((n-i)%i==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d %d\",i,n-i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"\\n\");\n\t}\n\t\n\t}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,t,j,n,k;\n scanf(\"%d\", &t);\n while(t--)\n {\n scanf(\"%d\", &n);\n if(n%2==0)\n {\n printf(\"%d \", n/2);\n printf(\"%d\\n\", n/2);\n }\n else{\n\n for(i=3; i<=sqrt(n); i++);\n {\n if(n%i==0)\n {\n break;\n }\n\n }\n j=i;\n k=sqrt(n);\n if(i>sqrt(n) && n%k!=0)\n {\n printf(\"1 \");\n printf(\"%d\", n-1);\n printf(\"\\n\");\n }\n else\n {\n printf(\"%d \", n/j);\n printf(\"%d \", n-n/j);\n printf(\"\\n\");\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\nint n, t, min;\n\nint gcd(int a, int b)\n{\n if (a == b) return a;\n else\n {\n if (a > b) return gcd(a - b, b);\n else return gcd(b - a, a);\n }\n}\n\nint lcm (int a, int b)\n{\n return (a * b) / gcd(a, b);\n}\n\nint testcase(int n)\n{\n min = lcm(1, n);\n for (int i = 1; i <= n / 2; i++) \n if (lcm(i, n - i) < min) min = lcm(i, n - i);\n for (int i = 1; i <= n / 2; i++) \n if (min == lcm(i, n - i)) return i;\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++)\n {\n scanf(\"%d\", &t);\n printf(\"%d %d\", testcase(t), t - testcase(t));\n }\n\n return 0;\n}\n"}], "src_uid": "3fd60db24b1873e906d6dee9c2508ac5"} {"nl": {"description": "Meg the Rabbit decided to do something nice, specifically \u2014 to determine the shortest distance between two points on the surface of our planet. But Meg... what can you say, she wants everything simple. So, she already regards our planet as a two-dimensional circle. No, wait, it's even worse \u2014 as a square of side n. Thus, the task has been reduced to finding the shortest path between two dots on a square (the path should go through the square sides). To simplify the task let us consider the vertices of the square to lie at points whose coordinates are: (0,\u20090), (n,\u20090), (0,\u2009n) and (n,\u2009n).", "input_spec": "The single line contains 5 space-separated integers: n,\u2009x1,\u2009y1,\u2009x2,\u2009y2 (1\u2009\u2264\u2009n\u2009\u2264\u20091000,\u20090\u2009\u2264\u2009x1,\u2009y1,\u2009x2,\u2009y2\u2009\u2264\u2009n) which correspondingly represent a side of the square, the coordinates of the first point and the coordinates of the second point. It is guaranteed that the points lie on the sides of the square.", "output_spec": "You must print on a single line the shortest distance between the points.", "sample_inputs": ["2 0 0 1 0", "2 0 1 2 1", "100 0 0 100 100"], "sample_outputs": ["1", "4", "200"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint mini(int x,int y){\n return (x>y)?y:x;\n}\nint main(){\n int n,x1,y1,x2,y2,sum=0;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n\n if((x1==0 && x2==n ||x1==n && x2==0)&& (y1!=0 || y1!=n)){\n sum=(y1+y2+n);\n }\n else if((y1==0 && y2==n ||y1==n && y2==0)&& (x1!=0 ||x1!=n)){\n sum=x1+x2+n;\n }\n else{\n sum=abs(x1-x2)+abs(y1-y2);\n }\n printf(\"%d\",mini(sum,(4*n-sum)));\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\nint min(int num1, int num2);\n\nint main()\n{\n\n int n = 0;\n int x1 = 0;\n int y1 = 0;\n int x2 = 0;\n int y2 = 0;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1 ,&x2 , &y2);\n if(abs(x2-x1)!=n && abs(y2-y1)!=n){\n int distance = abs(x2-x1)+abs(y2-y1);\n printf(\"%d\",distance);}\n else if( abs(x2-x1)==n) {\n int distance =min(y1+y2,n-y1+n-y2)+n;\n printf(\"%d\",distance);\n }\n else if( abs(y2-y1)==n) {\n int distance = min(x1+x2,n-x1+n-x2)+n;\n printf(\"%d\",distance);\n }\n\n return 0;\n}\n\nint min(int num1, int num2) \n{\n return (num1 > num2 ) ? num2 : num1;\n}"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint cal(int x, int y, int n);\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int d;\n d = abs(cal(x1, y1, n) - cal(x2, y2, n));\n\n printf(\"%d\", d > 4 * n - d ? 4 * n - d : d);\n\n return 0;\n}\n\nint cal(int x, int y, int n)\n{\n if(x == 0)\n return y;\n else if(y == n)\n return n + x;\n else if(x == n)\n return n + n + n - y;\n else\n return n + n + n + n - x;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,x1,y1,x2,y2;\n scanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n if((y1==0 && y2==0) || (y1==n && y2==n) )\n printf(\"%d\",abs(x2-x1));\n else if((x1==0 && x2==0) || (x1==n && x2==n))\n printf(\"%d\",abs(y2-y1));\n else if((x1==0 && y1!=0 && x2==n && y2!=0)||(x2==0 && y2!=0 && x1==n && y1!=0))\n {\n if((y1+y2)<(n-y1+n-y2))\n printf(\"%d\",y1+y2+n);\n else printf(\"%d\",n-y1+n-y2+n);\n }\n else if((x1!=0 && y1==n && x2!=0 && y2==0)||(x2!=0 && y2==n && x1!=0 && y1==0))\n {\n if((x1+x2)<(n-x1+n-x2))\n printf(\"%d\",x1+x2+n);\n else printf(\"%d\",n-x1+n-x2+n);\n }\n else if((x1==0 && y1!=0 && x2!=0 && y2==0))\n printf(\"%d\",y1+x2);\n else if((x1!=0 && y1==0 && x2==0&& y2!=0))\n printf(\"%d\",y2+x1);\n else if((x1==0 && y1!=0 && x2!=0 && y2!=0))\n printf(\"%d\",n-y1+x2);\n else if((x2==0 && y2!=0 && x1!=0 && y1!=0))\n printf(\"%d\",n-y2+x1);\n else if((x1!=0 && y1!=0 && x2==n && y2!=0))\n printf(\"%d\",n-x1+n-y2);\n else if((x2!=0 && y2!=0 && x1==n && y1!=0))\n printf(\"%d\",n-x2+n-y1);\n else if((x1==n && y1!=0 && x2!=0 && y2==0))\n printf(\"%d\",n-x2+y1);\n else if((x2==n && y2!=0 && x1!=0 && y1==0))\n printf(\"%d\",n-x1+y2);\n else if((x1==0&&y1==0&&x2==n&&y2==n)||(x2==0&&y2==0&&x1==n&&y1==n))\n printf(\"%d\",2*n);\n else if((x1==0 && y1==n && x2==n && y2==0)||(x2==0 && y2==n && x1==n && y1==0))\n printf(\"%d\",2*n);\n else if((x1==x2)&&(x2==y1)&&(y1==y2))\n printf(\"0\");\n return(0);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint abs1(int x){if(x>0)return x;else return -x;}\nint main()\n{\nint n,x1,i,j,y1,x2,y2,sum=0;\n \n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if((x1>y1)==(x2>y2)){i=abs1(x1-x2);j=abs1(y1-y2);sum=i+j;}\n else{\n sum=x1+x2+y1+y2;\n if(sum>4*n-sum)sum=4*n-sum;\n }\n printf(\"%d\",sum);\nreturn 0; \n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\n int x1,x2,y1,y2,dist,half,n;\n int zerodis1,zerodis2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n half=n*2;\n zerodis1=(x1>=y1)?(x1+y1):((half*2)-x1-y1);\n zerodis2=(x2>=y2)?(x2+y2):((half*2)-x2-y2);\n dist=abs(zerodis1-zerodis2);\n if(dist>half) dist=half*2-dist;\n printf(\"%d\\n\",dist);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\n int n,x1,x2,y1,y2,dist,half;\n int zerodis1,zerodis2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n half=n*2;\n zerodis1=(x1>=y1)?(x1+y1):((half*2)-x1-y1);\n zerodis2=(x2>=y2)?(x2+y2):((half*2)-x2-y2);\n dist=abs(zerodis1-zerodis2);\n if(dist>half) dist=half*2-dist;\n printf(\"%d\\n\",dist);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint mini(int x,int y){\n return (x>y)?y:x;\n}\nint main(){\n int n,x1,y1,x2,y2,sum=0;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n\n if((x1==0 && x2==n ||x1==n && x2==0)&& (y1!=0 || y1!=n)){\n sum=(y1+y2+n);\n }\n else if((y1==0 && y2==n ||y1==n && y2==0)&& (x1!=0 ||x1!=n)){\n sum=x1+x2+n;\n }\n else{\n sum=abs(x1-x2)+abs(y1-y2);\n }\n printf(\"%d\",mini(sum,(4*n-sum)));\n}"}, {"source_code": "#include<stdio.h>\n\n#include<math.h>\n\nint main()\n{\n int s1=0,s2=0, i, j, n, x1, y1, x2, y2;\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if(x1==x2 && y1==y2){\n printf(\"0\");\n return 0;\n }\n if(x1==x2 && (x1==0 || x1==n)){\n printf(\"%d\", abs(y1-y2));\n return 0;\n }\n else if(y1==y2 &&(y1==0 || y1==n)){\n printf(\"%d\", abs(x1-x2));\n return 0;\n }\n while(1){\n if(y1==0){\n s1 = abs(n-x1);\n if(x2==n && y2>=0 && y2<=n){\n s1+=(y2);\n break;\n }\n else s1+=n;\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n s1+=abs(n-y2);\n break;\n }\n else if(x1==n){\n s1=abs(n-y1);\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n s1+=x2;\n break;\n }\n else if(y1==n){\n s1+=x1;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n s1+=y2;\n break;\n }\n else if(x1==0){\n s1+=y1;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n if(x2==n && y2>=0 && y2<=n){\n s1+=y2;\n break;\n }\n else s1+=n;\n s1+=abs(n-x2);\n break;\n }\n\n }\n s2=(4*n)-s1;\n if(s1<s2){\n printf(\"%d\", s1);\n\n }\n else{\n printf(\"%d\", s2);\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint maximum(int a, int b)\n{\n if (a > b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint minimum(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, x1, y1, x2, y2, a, b, c;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if (y1 == 0) {\n\t a = x1;\n } else if (x1 == n) {\n\t a = n + y1;\n } else if (y1 == n) {\n\t a = 3 * n - x1;\n } else {\n\t a = 4 * n - y1;\n }\n\n if (y2 == 0) {\n\t b = x2;\n } else if (x2 == n) {\n\t b = n + y2;\n } else if (y2 == n) {\n\t b = 3 * n - x2;\n } else {\n\t b = 4 * n - y2;\n }\n\n c = minimum(a, b) + 4 * n;\n\n printf(\"%d\\n\", minimum(abs(a - b), c - maximum(a, b)));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint distance(int x, int y, int n)\n{\n int d;\n if (x==0) d = y;\n else if(x!=n)\n {\n if (y==0) d = 4*n-x;\n else d = n + x;\n }\n else d = 3*n-y;\n\n return d;\n}\n\nint main()\n{\n int n,x1,y1,x2,y2;\n int d1, d2,d;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n d1 = distance(x1,y1,n);\n d2 = distance(x2,y2,n);\n if(d1>d2) d = d1-d2;\n else d = d2-d1;\n if(d>2*n)\n d = 4*n-d;\n printf(\"%d\", d);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define ABS(s) ((s) > (0) ? (s) : (-(s)))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\nint judge(int x, int y, int n)\n{\n if (x == 0)\n {\n return 1;\n }\n if (x == n)\n {\n return 3;\n }\n if (y == 0)\n {\n return 4;\n }\n return 2;\n}\n\nvoid func(int n, int x1, int y1, int x2, int y2)\n{\n int t1, t2;\n if (x1 == x2 && y1 == y2)\n {\n printf(\"0\\n\");\n return;\n }\n if (x1 == x2) // x1 == x2\n {\n if (x1 == 0 || x1 == n)\n {\n printf(\"%d\\n\", ABS(y1 - y2));\n }\n else // y1 == y2 && (y1 == 0 || y1 == n)\n {\n printf(\"%d\\n\", n + 2 * MIN(x1, n - x1));\n }\n }\n else if (y1 == y2)\n {\n if (y1 == 0 || y1 == n)\n {\n printf(\"%d\\n\", ABS(x1 - x2));\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(y1, n - y1));\n }\n }\n else\n {\n t1 = judge(x1, y1, n);\n t2 = judge(x2, y2, n);\n if ((t2 == 1 && t1 == 2) || (t2 == 2 && t1 == 3) || (t2 == 3 && t1 == 4) || (t2 == 4 && t1 == 1) || (t2 == 1 && t1 == 3) || (t2 == 2 && t1 == 4))\n {\n t1 ^= t2;\n t2 ^= t1;\n t1 ^= t2;\n x1 ^= x2;\n x2 ^= x1;\n x1 ^= x2;\n y1 ^= y2;\n y2 ^= y1;\n y1 ^= y2;\n }\n if (t1 == 1 && t2 == 2)\n {\n printf(\"%d\\n\", n - y1 + x2);\n }\n else if (t1 == 2 && t2 == 3)\n {\n printf(\"%d\\n\", n - x1 + n - y2);\n }\n else if (t1 == 3 && t2 == 4)\n {\n printf(\"%d\\n\", y1 + n - x2);\n }\n else if (t1 == 4 && t2 == 1)\n {\n printf(\"%d\\n\", x1 + y2);\n }\n else if (t1 == 1 && t2 == 3)\n {\n printf(\"%d\\n\", n + MIN(n - y1 + n - y2, y1 + y2));\n }\n else if (t1 == 2 && t2 == 4)\n {\n printf(\"%d\\n\", n + MIN(n - x1 + n - x2, x1 + x2));\n }\n }\n}\n\nint main()\n{\n int n, x1, y1, x2, y2;\n while (scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2) == 5)\n {\n func(n, x1, y1, x2, y2);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint min (int a, int b){\n\treturn (a < b ? a : b);\n}\n\n\nint main(){\n\tint n , x1 , y1 , x2 , y2 ;\n\n\tscanf(\"%d%d%d%d%d\", &n , &x1 , &y1 ,&x2 , &y2 );\n\n\tif ( abs(x1 - x2) == n || abs(y1-y2) == n)\n\t\tprintf(\"%d\\n\" , min ( x1 + y1 + x2 + y2 , 4*n - (x1 + y1 + x2 + y2 ) ) );\n\telse\n\t\tprintf(\"%d\\n\" , abs(x1-x2) + abs(y1-y2) );\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a, int b)\n{\n \treturn a<b?a:b;\n}\nint abs(int x)\n{\n\treturn x>0?x:-x;\n}\n\t\nint main()\n{\n\tint n,x1,y1,x2,y2;\n\tscanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n\tif(x1 == x2 && (x1==n || x1==0))\n\t{\n\t\tprintf(\"%d\\n\",abs(y1-y2));\n\t\treturn 0;\n\t}\n\t\n\telse if(y1 == y2 && (y1==n || y1==0))\n\t{\n\t\tprintf(\"%d\\n\",abs(x1-x2));\n\t\treturn 0;\n\t}\n\t\n\t//if opposite side\n\tint onver1 = 0, onver2 = 0;\n\tif(x1==n || x1==0)\n\tonver1 = 1;\n\t\n\tif(x2==n || x2==0)\n\tonver2 = 1;\n\t\n\tif(onver1==1 && onver2==1)\n\t{\n\t\t//opposite vertical\n\t\tint tmp = min(y1+y2,n-y1+n-y2);\n\t\t//printf(\"BDEUG %d\\n\",tmp);\n\t\tprintf(\"%d\\n\",n+tmp);\n\t\treturn 0;\n\t}\n\telse if(onver1==0 && onver2==0)\n\t{\n\t\t//opposite hori\n\t\tint tmp = min(x1+x2,n-x1+n-x2);\n\t\tprintf(\"%d\\n\",n+tmp);\n\t\treturn 0;\n\t}\n\t\n\t//adjacent sides\n\tint tmp = 0;\n\tif(x1==0)\n\t{\n\t\tif(y2==0)\n\t\ttmp = y1+x2;\n\t\telse if(y2==n)\n\t\ttmp = n-y1+x2;\n\t}\n\telse if(x1==n)\n\t{\n\t\tif(y2==n)\n\t\ttmp = 2*n - x2 - y1;\n\t\telse if(y2 == 0)\n\t\ttmp = n-x2+y1;\n\t}\n\telse if(x2==0)\n\t{\n\t\tif(y1 == 0)\n\t\ttmp = x1+y2;\n\t\telse if(y1==n)\n\t\ttmp = n-y2+x1;\n\t}\n\telse\n\t{\n\t\tif(y1==0)\n\t\ttmp = n-x1+y2;\n\t\telse if(y1==n)\n\t\ttmp = 2*n - x1 -y2;\n\t}\n\tprintf(\"%d\\n\",tmp);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(void)\n{\n\n\nint xx1,yy1,xx2,yy2,n,ans;\nscanf(\"%d%d%d%d%d\", &n, &xx1, &yy1, &xx2, &yy2);\nif ((xx1==0&&xx2==n)||(xx1==n&&xx2==0))\nans=min(n+yy1+yy2,n+n-yy2+n-yy1);\nelse {if\n((yy1==0&&yy2==n)||(yy1==n&&yy2==0))\nans=min(n+xx1+xx2,n+n-xx2+n-xx1);\nelse ans=abs(xx1-xx2)+abs(yy1-yy2);}\nprintf (\"%d\", ans);\nreturn 0;\n}\nint min(int num1, int num2)\n{\n \n int result;\n\n if (num1 < num2)\n result = num1;\n else\n result = num2;\n\n return result;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint min(int a,int b);\nint main()\n{\n\tint n,x1,y1,x2,y2,d1,d2;\n\tscanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n\td1=x1+y1+x2+y2;\n\td2=(4*n)-d1;\n\tif(abs(x1-x2)==n || abs(y1-y2)==n)\n\tprintf(\"%d\",min(d1,d2));\n\telse\n\t\tprintf(\"%d\",abs(x1-x2)+abs(y1-y2));\n\treturn 0;\n}\nint min(int a,int b)\n{\n\tif(a>b) return b;\n\telse return a;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint min(int, int);\nint absolute(int);\nint main()\n{\nint n, x1,y1,x2,y2;\nscanf(\"%d\",&n);\nscanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\nint sd=0;\nif(x1==0 )//case 1\n{\n if(x2==0)\n sd=absolute(y2-y1);\n else if(x2<n && y2==0)\n sd=y1+x2;\n else if(x2<n && y2==n)\n sd=n-y1+x2;\n else if(x2==n)\n sd=min(y1+n+y2,n-y1+n+n-y2);\n\n\n}\nelse if(y1==0)//case 2\n{\n if(y2==0)\n sd=absolute(x2-x1);\n else if(x2==0)\n sd=x1+y2;\n else if(x2==n)\n sd=n-x1+y2;\n else if(x2<n)\n sd=min(x1+n+x2,n-x1+n+n-x2);\n}\nelse if(x1==n)\n{\n if(x2==n)\n sd=absolute(y2-y1);\n else if(x2==0)\n sd=min(y1+n+y2,n-y1+n+n-y2);\n else if(y2==0)\n sd=y1+n-x2;\n else if(y2==n)\n sd=n-x2+n-y1;\n}\nelse if(y1==n)\n{\n if(y2==n)\n sd=absolute(x2-x1);\n else if(y2==0)\n sd=min(x1+n+x2,n-x1+n+n-x2);\n else if(x2==0)\n sd=x1+n-y2;\n else if(x2==n)\n sd=n-x1+n-y2;\n}\nprintf(\"%d\",sd);\n\nreturn 0;\n}\nint min(int a, int b)\n{\n if(a<b)\n return(a);\n else\n return(b);\n}\nint absolute(int m)\n{\n if(m<0)\n m=m*(-1);\n return(m);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint mn(int a, int b)\n{\n\treturn (a < b ? a : b);\n}\n\nint main(int argc, char *argv[])\n{\n\tint n, x1, y1, x2, y2;\n\n\tscanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\t\n\tif(abs(x1 - x2) == n)\n\t\tprintf(\"%d\\n\", n + mn(y1 + y2, 2 * n - (y1 + y2)));\n\telse if(abs(y1 - y2) == n)\n\t\tprintf(\"%d\\n\", n + mn(x1 + x2, 2 * n - (x1 + x2)));\n\telse\n\t\tprintf(\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int n, x1, x2, y1, y2, d;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n if ((x1==x2 && x1==0) || (x1==x2 && x1==n))\n d = abs(y1-y2);\n\n else if ((y1==y2 && y1==0) || (y1==y2 && y1==n))\n d = abs(x1-x2);\n\n else if ((abs(x2-x1)<n) && abs(y2-y1)<n)\n d = abs(x1-x2) + abs(y1-y2);\n else\n ((x1+x2+y1+y2)>(n*4-(x1+x2+y1+y2))) ? (d = n*4-(x1+x2+y1+y2)) : (d = x1+x2+y1+y2) ;\n\n printf(\"%d\", d);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\nint get_d(int x,int y,int n){\n if(x==0) return y;\n if(y==n) return x+n;\n if(x==n) return (n-y)+n+n;\n return (n-x)+n+n+n;\n}\n\nint main(){\n int i,j,k,l,m,n;\n int x1,x2,y1,y2,d1,d2,res;\n\n while(scanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2)==5){\n d1 = get_d(x1,y1,n);\n d2 = get_d(x2,y2,n);\n res = d1-d2;\n if(res<0) res = -res;\n if(res > 4*n-res) res = 4*n-res;\n printf(\"%d\\n\",res);\n break;\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint x1,y1,x2,y2,n,bal,mal;\n\tscanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n\tif (x1==x2 && y1==y2) printf(\"0\");\n\telse if ((x1==0 && x2==0)|| (x1==n&&x2==n)) printf(\"%d\",abs(y1-y2));\n\telse if ((y1==0 && y2==0)|| (y1==n&&y2==n)) printf(\"%d\",abs(x1-x2));\n\telse if (x1==0 && y2==n)\n\t{\n\t\tprintf(\"%d\",(n-y1)+x2);\n\t}\n\telse if (x1==n && y2==0)\n\t{\n\t\tprintf(\"%d\",(n-x2)+y1);\n\t}\n\telse if (x2==0 && y1==n)\n\t{\n\t\tprintf(\"%d\",(n-y2)+x1);\n\t}\n\telse if (x2==n && y1==0)\n\t{\n\t\tprintf(\"%d\",(n-x1)+y2);\n\t}\n\telse \n\t{\n\t\tbal=x1+x2+y1+y2;\n\t\tmal=4*n-bal;\n\t\tif (bal<=mal) printf(\"%d\",bal);\n\t\telse printf(\"%d\",mal);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\n#define MIN(x,y) ((x)<(y))? (x) : (y)\n#define abs(x) ((x)>(0))? (x) : -(x)\n\nint main()\n{\n int n,x1,y1,x2,y2,r;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if(x1==x2&&y1==y2)printf(\"0\");\n else if((x1==0&&x2==0)||(x1==n&&x2==n))printf(\"%d\",abs(y1-y2));\n else if((y1==0&&y2==0)||(y1==n&&y2==n))printf(\"%d\",abs(x1-x2));\n else if(x1==0 && y2==n) printf(\"%d\",x2+(n-y1));\n else if(x1==n && y2==0) printf(\"%d\",(n-x2)+y1);\n else if(x2==0 && y1==n) printf(\"%d\",x1+(n-y2));\n else if(x2==n && y1==0) printf(\"%d\",(n-x1)+y2);\n else\n {\n r=x1+y1+x2+y2;\n printf(\"%d\",MIN(r,((4*n)-r)));\n }\n //getch();\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, x, y, xx, yy;\n int vzd_x, vzd_y;\n int c;\n int cc;\n \n scanf(\"%d %d %d %d %d\", &n, &x, &y, &xx, &yy);\n \n vzd_x = x + y;\n vzd_y = xx + yy;\n \n if ((((x == 0) || (y == n)) && ((xx == n) || (yy == 0))) ||\n (((xx == 0) || (yy == n)) && ((x == n) || (y == 0)))){\n c = vzd_x + vzd_y;\n } else {\n c = abs(vzd_x - vzd_y);\n }\n if (c < (2*n)) printf(\"%d\\n\", c);\n else printf(\"%d\\n\", 4*n - c);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs (int x)\n{\n\treturn ( x < 0 ? -x : x );\n}\n\nint min (int x, int y)\n{\n\treturn (x < y ? x : y);\n}\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s, sq;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\tsq = n * n;\n\ts = x1 + x2 + y1 + y2;\n\n\tif ( abs (x1 - x2) == n || abs (y1 - y2) == n ) {\n\t\tprintf (\"%d\\n\", min (s, 4 * n - s));\n\t} else {\n\t\tprintf (\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint ab(int a,int b)\n{\n\treturn (a>b)?(a-b):(b-a);\n}\nint main()\n{\n\tint n,x1,x2,y1,y2,a,b;\n\tscanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n\ta=x1+y1,b=x2+y2;\n\tif(((x1<y1)&&(x2>y2))||((x2<y2)&&(x1>y1))){\n\t\tx1=a+b;\n\t\tif(x1>(2*n))printf(\"%d\",4*n-x1);\n\t\telse printf(\"%d\",x1);\n\t}\n\telse {\n\t\tx1=ab(a,b);\n\t\tprintf(\"%d\",x1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int i,n,p=0,a,b,x1,x2,y1,y2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if((x1==n && x2==n)||(x1==0 && x2==0)) {\n printf(\"%d\\n\",abs(y1-y2));\n return 0;\n }\n if((y1==n && y2==n)||(y1==0 && y2==0)) {\n printf(\"%d\\n\",abs(x1-x2));\n return 0;\n }\n if(x1==n || x2==n || x1==0 || x2==0){\n p=(((n-y1)+(n-y2))>(y1+y2))?y1+y2+abs(x2-x1):n-y1+n-y2+abs(x2-x1);\n }\n else if(y1==n || y2==n || y1==0 || y2==0){\n p=(((n-x1)+(n-x2))>(x1+x2))?x1+x2+abs(y2-y1):n-x1+n-x2+abs(y2-y1);\n }\n printf(\"%d\\n\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs (int x)\n{\n return ( x < 0 ? -x : x );\n}\n\nint min (int x, int y)\n{\n return (x < y ? x : y);\n}\n\nint main()\n{\n int n, x1, y1, x2, y2;\n int s, sq;\n\n scanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n sq = n * n;\n s = x1 + x2 + y1 + y2;\n\n if ( abs (x1 - x2) == n || abs (y1 - y2) == n ) {\n printf (\"%d\\n\", min (s, 4 * n - s));\n } else {\n printf (\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n int s1=0,s2=0, i, j, n, x1, y1, x2, y2;\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if(x1==x2 && y1==y2){\n printf(\"0\");\n return 0;\n }\n if(x1==x2 && (x1==0 || x1==n)){\n printf(\"%d\", abs(y1-y2));\n return 0;\n }\n else if(y1==y2 &&(y1==0 || y1==n)){\n printf(\"%d\", abs(x1-x2));\n return 0;\n }\n while(1){\n if(y1==0){\n s1 = abs(n-x1);\n if(x2==n && y2>=0 && y2<=n){\n s1+=(y2);\n break;\n }\n else s1+=n;\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n s1+=abs(n-y2);\n break;\n }\n else if(x1==n){\n s1=abs(n-y1);\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n s1+=x2;\n break;\n }\n else if(y1==n){\n s1+=x1;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n s1+=y2;\n break;\n }\n else if(x1==0){\n s1+=y1;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n if(x2==n && y2>=0 && y2<=n){\n s1+=y2;\n break;\n }\n else s1+=n;\n s1+=abs(n-x2);\n break;\n }\n\n }\n s2=(4*n)-s1;\n if(s1<s2){\n printf(\"%d\", s1);\n\n }\n else{\n printf(\"%d\", s2);\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\tint x1, x2, y1, y2, x, y, n;\n\tscanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n\tif (x1==0 || x2 == 0 || x1 == n || x2 == n || y1 == y2)\n\t\tx = fabs(x1 - x2);\n\telse x = (x1 + x2 < 2*n - x1 - x2) ? x1 + x2 : 2*n - x1 - x2;\n\tif (y1==0 || y2 == 0 || y1 == n || y2 == n || x == 0)\n\t\ty = fabs(y1 - y2);\n\telse y = (y1 + y2 < 2*n - y1 - y2) ? y1 + y2 : 2*n - y1 - y2;\n\n\tprintf(\"%d\\n\", x + y);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint abs( int d )\n{\n \n return d < 0 ? -d : d;\n}\n\nint cut( int x, int y, int n )\n{\n if ( x == 0 ) {\n return y;\n }\n if ( y == n ) {\n return n + x;\n }\n if ( x == n ) {\n return 3 * n - y;\n }\n\n if ( y == 0 ) {\n return 4 * n - x ;\n }\n\n return -1;\n}\n\nint main( void ) \n{\n int n, x1, y1, x2, y2;\n int d1, d2, diff;\n\n scanf( \"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2 );\n d1 = cut( x1, y1, n );\n d2 = cut( x2, y2, n );\n diff = abs( d1 - d2 );\n diff = 4 * n - diff < diff ? 4 * n - diff : diff;\n printf( \"%d\\n\", diff );\n fflush( stdout );\n\n return 0;\n\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint mini(int x,int y){\n return (x>y)?y:x;\n}\nint main(){\n int n,x1,y1,x2,y2,sum=0;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n\n if((x1==0 && x2==n ||x1==0 && x2==n)&& (y1!=0 || y1!=n)){\n sum=(y1+y2+n);\n }\n else if((y1==0 && y2==n ||y1==n && y2==0)&& (x1!=0 ||x1!=n)){\n sum=x1+x2+n;\n }\n else{\n sum=abs(x1-x2)+abs(y1-y2);\n }\n printf(\"%d\",mini(sum,(4*n-sum)));\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint mini(int x,int y){\n return (x>y)?y:x;\n}\nint main(){\n int n,x1,y1,x2,y2,sum=0;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n\n if((x1==0 && x2==n ||x1==0 && x2==n)&& (y1!=0 || y1!=n)){\n sum=(x1+x2+n);\n }\n else if((y1==0 && y2==n ||y1==n && y2==0)&& (x1!=0 ||x1!=n)){\n sum=y1+y2+n;\n }\n else{\n sum=abs(x1-x2)+abs(y1-y2);\n }\n printf(\"%d\",mini(sum,(4*n-sum)));\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\n\n\nint main()\n{\n\n int n = 0;\n int x1 = 0;\n int y1 = 0;\n int x2 = 0;\n int y2 = 0;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1 ,&x2 , &y2);\n\n int distance = sqrt(pow(x1-x2,2)+pow(y1-y2,2));\n printf(\"%d\",distance);\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\n\n\nint main()\n{\n\n int n = 0;\n int x1 = 0;\n int y1 = 0;\n int x2 = 0;\n int y2 = 0;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1 ,&x2 , &y2);\n\n int distance = abs(x2-x1)+abs(y2-y1);\n printf(\"%d\",distance);\n \n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + abs(x2 - x1);\n b = n - x1 + n - x2 + abs(y2 - y1);\n c = y1 + y2 + abs(x2 - x1);\n d = x1 + x2 + abs(y2 - y1);\n if(x2 - x1 == 0 || y1 == 0 || y2 == 0 || y1 == n || y2 == n)\n {\n a = b < d ? b : d;\n }\n else if(y2 - y1 == 0 || x1 == 0 || x2 == 0 || x1 == n || x2 == n)\n {\n a = a < c ? a : c;\n }\n else\n {\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n }\n\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint cal(int x, int y, int n);\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int d;\n d = abs(cal(x1, y1, n) - cal(x2, y2, n));\n\n printf(\"%d\", d > 4 * n - d) ? 4 * n - d : d;\n\n return 0;\n}\n\nint cal(int x, int y, int n)\n{\n if(x == 0)\n return y;\n else if(y == n)\n return n + x;\n else if(x == n)\n return n + n + n - y;\n else\n return n + n + n + n - x;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + x2 - x1;\n b = n - x1 + n - x2 + y2 - y1;\n c = y1 + y2 + x2 - x1;\n d = x1 + x2 + y2 - y1;\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + abs(x2 - x1);\n b = n - x1 + n - x2 + abs(y2 - y1);\n c = y1 + y2 + abs(x2 - x1);\n d = x1 + x2 + abs(y2 - y1);\n printf(\"%d, %d, %d, %d\\n\", a, b, c, d);\n if(x2 - x1 == 0 || y1 == 0 || y2 == 0 || y1 == n || y2 == n)\n {\n a = b < d ? b : d;\n }\n else if(y2 - y1 == 0 || x1 == 0 || x2 == 0 || x1 == n || x2 == n)\n {\n a = a < c ? a : c;\n }\n else\n {\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n }\n\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n printf(\"%d\", y1 + y2 + x2 - x1);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + x2 - x1;\n b = n - x1 + n - x2 + y2 - y1;\n c = y1 + y2 + x2 - x1;\n d = x1 + x2 + y2 - y1;\n if(x2 - x1 == 0)\n {\n a = b < d ? b : d;\n }\n else if(y2 - y1 == 0)\n {\n a = a < c ? a : c;\n }\n else\n {\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n }\n\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + abs(x2 - x1);\n b = n - x1 + n - x2 + abs(y2 - y1);\n c = y1 + y2 + abs(x2 - x1);\n d = x1 + x2 + abs(y2 - y1);\n if(x2 - x1 == 0)\n {\n a = b < d ? b : d;\n }\n else if(y2 - y1 == 0)\n {\n a = a < c ? a : c;\n }\n else\n {\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n }\n\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(void)\n{\n int n, x1, y1, x2, y2;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n int a, b, c, d;\n a = n - y1 + n - y2 + abs(x2 - x1);\n b = n - x1 + n - x2 + abs(y2 - y1);\n c = y1 + y2 + abs(x2 - x1);\n d = x1 + x2 + abs(y2 - y1);\n printf(\"%d, %d, %d, %d\\n\", a, b, c, d);\n if(x2 - x1 == 0)\n {\n a = b < d ? b : d;\n }\n else if(y2 - y1 == 0)\n {\n a = a < c ? a : c;\n }\n else\n {\n a = a < b ? a : b;\n a = a < c ? a : c;\n a = a < d ? a : d;\n }\n\n printf(\"%d\", a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,x1,y1,x2,y2;\n scanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n if((y1==0 && y2==0) || (y1==n && y2==n) )\n printf(\"%d\",abs(x2-x1));\n else if((x1==0 && x2==0) || (x1==n && x2==n))\n printf(\"%d\",abs(y2-y1));\n else if((x1==0 && y1!=0 && x2==n && y2!=0)||(x2==0 && y2!=0 && x1==n && y1!=0))\n {\n if((y1+y2)<(n-y1+n-y2))\n printf(\"%d\",y1+y2+n);\n else printf(\"%d\",n-y1+n-y2+n);\n }\n else if((x1!=0 && y1!=0 && x2!=0 && y2==0)||(x2!=0 && y2!=0 && x1!=0 && y1==0))\n {\n if((x1+x2)<(n-x1+n-x2))\n printf(\"%d\",x1+x2+n);\n else printf(\"%d\",n-x1+n-x2+n);\n }\n else if((x1==0 && y1!=0 && x2!=0 && y2==0))\n printf(\"%d\",y1+x2);\n else if((x1!=0 && y1==0 && x2==0&& y2!=0))\n printf(\"%d\",y2+x1);\n else if((x1==0 && y1!=0 && x2!=0 && y2!=0))\n printf(\"%d\",n-y1+x2);\n else if((x2==0 && y2!=0 && x1!=0 && y1!=0))\n printf(\"%d\",n-y2+x1);\n else if((x1!=0 && y1!=0 && x2==n && y2!=0))\n printf(\"%d\",n-x1+n-y2);\n else if((x2!=0 && y2!=0 && x1==n && y1!=0))\n printf(\"%d\",n-x2+n-y1);\n else if((x1==n && y1!=0 && x2!=0 && y2==0))\n printf(\"%d\",n-x2+y1);\n else if((x2==n && y2!=0 && x1!=0 && y1==0))\n printf(\"%d\",n-x1+y2);\n else if((x1==0&&y1==0&&x2==n&&y2==n)||(x2==0&&y2==0&&x1==n&&y1==n))\n printf(\"%d\",2*n);\n else if((x1==0 && y1==n && x2==n && y2==0)||(x2==0 && y2==n && x1==n && y1==0))\n printf(\"%d\",2*n);\n else if((x1==x2)&&(x2==y1)&&(y1==y2))\n printf(\"0\");\n return(0);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\n int n,x1,x2,y1,y2,dist,half;\n int zerodis1,zerodis2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n half=n<<1;\n zerodis1=(x1>=y1)?(x1+y1):((half<<1)-x1-y1);\n zerodis2=(x2>=y2)?(x2+y2):((half<<1)-x2-y2);\n dist=abs(zerodis1-zerodis2);\n if(dist>half) dist=half<<1-dist;\n printf(\"%d\\n\",dist);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\n int n,x1,x2,y1,y2,dist,half;\n int zerodis1,zerodis2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n half=n<<1;\n zerodis1=(x1>=y1)?(x1+y1):(half<<1-x1-y1);\n zerodis2=(x2>=y2)?(x2+y2):(half<<1-x2-y2);\n dist=abs(zerodis1-zerodis2);\n if(dist>half) dist=half<<1-dist;\n printf(\"%d\\n\",dist);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint maximum(int a, int b)\n{\n if (a > b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint minimum(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, x1, y1, x2, y2, a, b, c;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if (y1 == 0) {\n\t a = x1;\n } else if (x1 == n) {\n\t a = n + y1;\n } else if (y1 == n) {\n\t a = 3 * n - x1;\n } else {\n\t a = 4 * n - y1;\n }\n\n if (y2 == 0) {\n\t b = x2;\n } else if (x2 == n) {\n\t b = n + y2;\n } else if (y2 == n) {\n\t b = 3 * n - x2;\n } else {\n\t b = 4 * n - y2;\n }\n\n c = minimum(a, b) + 400;\n\n printf(\"%d\\n\", minimum(abs(a - b), c - maximum(a, b)));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, x1, y1, x2, y2, a, b;\n\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if (y1 == 0) {\n a = x1;\n } else if (x1 == n) {\n a = n + y1;\n } else if (y1 == n) {\n a = 3 * n - x1;\n } else {\n a = 4 * n - y1;\n }\n\n if (y2 == 0) {\n b = x2;\n } else if (x2 == n) {\n b = n + y2;\n } else if (y2 == n) {\n b = 3 * n - x2;\n } else {\n b = 4 * n - y2;\n }\n\n printf(\"%d\\n\", abs(a - b));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define ABS(s) ((s) > (0) ? (s) : (-(s)))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\nint judge(int x, int y, int n)\n{\n if (x == 0)\n {\n return 1;\n }\n if (x == n)\n {\n return 3;\n }\n if (y == 0)\n {\n return 4;\n }\n return 2;\n}\n\nvoid func(int n, int x1, int y1, int x2, int y2)\n{\n int t1, t2, t;\n if (x1 == x2)\n {\n if (x1 == 0 || x1 == n)\n {\n if (y1 > y2)\n {\n t = y1 - y2;\n }\n else\n {\n t = y2 - y1;\n }\n printf(\"%d\\n\", t);\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(x1, n - x1));\n }\n }\n else if (y1 == y2)\n {\n if (y1 == 0 || y1 == n)\n {\n if (x1 > x2)\n {\n t = x1 - x2;\n }\n else\n {\n t = x2 - x1;\n }\n printf(\"%d\\n\", t);\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(y1, n - y1));\n }\n }\n else\n {\n t1 = judge(x1, y1, n);\n t2 = judge(x2, y2, n);\n if ((t2 == 1 && t1 == 2) || (t2 == 2 && t1 == 3) || (t2 == 3 && t1 == 4) || (t2 == 4 && t1 == 1) || (t2 == 1 && t1 == 3) || (t2 == 2 && t1 == 4))\n {\n t1 ^= t2;\n t2 ^= t1;\n t1 ^= t2;\n x1 ^= x2;\n x2 ^= x1;\n x1 ^= x2;\n y1 ^= y2;\n y2 ^= y1;\n y1 ^= y2;\n }\n if (t1 == 1 && t2 == 2)\n {\n printf(\"%d\\n\", n - y1 + x2);\n }\n else if (t1 == 2 && t2 == 3)\n {\n printf(\"%d\\n\", n - x1 + n - y2);\n }\n else if (t1 == 3 && t2 == 4)\n {\n printf(\"%d\\n\", y1 + n - x2);\n }\n else if (t1 == 4 && t2 == 1)\n {\n printf(\"%d\\n\", x1 + y2);\n }\n else if (t1 == 1 && t2 == 3)\n {\n printf(\"%d\\n\", n + MIN(n - y1 + n - y2, y1 + y2));\n }\n else if (t1 == 2 && t2 == 4)\n {\n printf(\"%d\\n\", n + MIN(n - x1 + n - x2, x1 + x2));\n }\n }\n}\n\nint main()\n{\n int n, x1, y1, x2, y2;\n while (scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2) == 5)\n {\n func(n, x1, y1, x2, y2);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define ABS(s) ((s) > (0) ? (s) : (-(s)))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\nint judge(int x, int y, int n)\n{\n if (x == 0)\n {\n return 1;\n }\n if (x == n)\n {\n return 3;\n }\n if (y == 0)\n {\n return 4;\n }\n return 2;\n}\n\nvoid func(int n, int x1, int y1, int x2, int y2)\n{\n int t1, t2;\n if (x1 == x2)\n {\n if (x1 == 0 || x1 == n)\n {\n printf(\"%d\\n\", ABS(y1 - y2));\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(ABS(x1), ABS(n - x1)));\n }\n }\n else if (y1 == y2)\n {\n if (y1 == 0 || y1 == n)\n {\n printf(\"%d\\n\", ABS(x1 - x2));\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(ABS(y1), ABS(n - y1)));\n }\n }\n else\n {\n t1 = judge(x1, y1, n);\n t2 = judge(x2, y2, n);\n if (t2 == 1 && t1 == 2 || t2 == 2 && t1 == 3 || t2 == 3 && t1 == 4 || t2 == 4 && t1 == 1 || t2 == 1 && t1 == 3 || t2 == 2 && t1 == 4)\n {\n t1 ^= t2;\n t2 ^= t1;\n t1 ^= t2;\n x1 ^= x2;\n x2 ^= x1;\n x1 ^= x2;\n y1 ^= y2;\n y2 ^= y1;\n y1 ^= y2;\n }\n if (t1 == 1 && t2 == 2)\n {\n printf(\"%d\\n\", n - y1 + x2);\n }\n else if (t1 == 2 && t2 == 3)\n {\n printf(\"%d\\n\", n - x1 + n - y2);\n }\n else if (t1 == 3 && t2 == 4)\n {\n printf(\"%d\\n\", y1 + n - x2);\n }\n else if (t1 == 4 && t2 == 1)\n {\n printf(\"%d\\n\", x1 + y1);\n }\n else if (t1 == 1 && t2 == 3)\n {\n printf(\"%d\\n\", n + MIN(n - y1 + n - y2, y1 + y2));\n }\n else if (t1 == 2 && t2 == 4)\n {\n printf(\"%d\\n\", n + MIN(n - x1 + n - x2, x1 + x2));\n }\n }\n}\n\nint main()\n{\n int n, x1, y1, x2, y2;\n while (scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2) == 5)\n {\n func(n, x1, y1, x2, y2);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define ABS(s) ((s) > (0) ? (s) : (-(s)))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\nint judge(int x, int y, int n)\n{\n if (x == 0)\n {\n return 1;\n }\n if (x == n)\n {\n return 3;\n }\n if (y == 0)\n {\n return 4;\n }\n return 2;\n}\n\nvoid func(int n, int x1, int y1, int x2, int y2)\n{\n int t1, t2;\n if (x1 == x2)\n {\n if (x1 == 0 || x1 == n)\n {\n printf(\"%d\\n\", ABS(y1 - y2));\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(x1, n - x1));\n }\n }\n else if (y1 == y2)\n {\n if (y1 == 0 || y1 == n)\n {\n printf(\"%d\\n\", ABS(x1 - x2));\n }\n else\n {\n printf(\"%d\\n\", n + 2 * MIN(y1, n - y1));\n }\n }\n else\n {\n t1 = judge(x1, y1, n);\n t2 = judge(x2, y2, n);\n if (t2 == 1 && t1 == 2 || t2 == 2 && t1 == 3 || t2 == 3 && t1 == 4 || t2 == 4 && t1 == 1 || t2 == 1 && t1 == 3 || t2 == 2 && t1 == 4)\n {\n t1 ^= t2;\n t2 ^= t1;\n t1 ^= t2;\n x1 ^= x2;\n x2 ^= x1;\n x1 ^= x2;\n y1 ^= y2;\n y2 ^= y1;\n y1 ^= y2;\n }\n if (t1 == 1 && t2 == 2)\n {\n printf(\"%d\\n\", n - y1 + x2);\n }\n else if (t1 == 2 && t2 == 3)\n {\n printf(\"%d\\n\", n - x1 + n - y2);\n }\n else if (t1 == 3 && t2 == 4)\n {\n printf(\"%d\\n\", y1 + n - x2);\n }\n else if (t1 == 4 && t2 == 1)\n {\n printf(\"%d\\n\", x1 + y2);\n }\n else if (t1 == 1 && t2 == 3)\n {\n printf(\"%d\\n\", n + MIN(n - y1 + n - y2, y1 + y2));\n }\n else if (t1 == 2 && t2 == 4)\n {\n printf(\"%d\\n\", n + MIN(n - x1 + n - x2, x1 + x2));\n }\n }\n}\n\nint main()\n{\n int n, x1, y1, x2, y2;\n while (scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2) == 5)\n {\n func(n, x1, y1, x2, y2);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n\n\tint n , x1 , y1 , x2 , y2 , dis;\n\tscanf(\"%d%d%d%d%d\",&n , &x1 , &y1 , &x2 , &y2 );\n\n\tif ( x1 == x2 ){\n\t\tif (x1 == 0 || x1 == n) {\n\t\t\tprintf(\"%d\\n\",abs(y1-y2));\n\t\t}else {\n\t\t\tif ( 2*x1 >= n){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * ( n - x1 ) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * x1 ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( y1 == y2 ){\n\t\tif (y1 == 0 || y1 == n ) {\n\t\t\tprintf(\"%d\\n\",abs(x1-x2));\n\t\t}else{\n\t\t\tif ( 2*y1 >= n ){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (n-y1) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (y1) ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( abs(x1 - x2 ) == n){\n\t\tif ( (2*y1 >= n && 2*y2 >= n) || ( 2*y1 <= n && 2*y2 <= n) ){\n\t\t\tprintf(\"%d\\n\", n + y1 + y2);\n\t\t}else{\n\t\t\tif ( y1 + y2 < n + n - y1 - y2 ){\n\t\t\t\tprintf(\"%d\\n\",n + y1 + y2);\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", 3*n - y1 -y2);\n\t\t\t}\n\t\t}\n\t}else if ( abs(y1 - y2 ) == n){\n\t\tif ( (2*x1 >= n && 2*x2 >= n) || ( 2*x1 <= n && 2*x2 <= n) ){\n\t\t\tprintf(\"%d\\n\", n + x1 + x2);\n\t\t}else{\n\t\t\tif ( x1 + x2 < n + n - x1 - x2 ){\n\t\t\t\tprintf(\"%d\\n\",n + x1 + x2);\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", 3*n - x1 - x2);\n\t\t\t}\n\t\t}\n\t}else{\n\t\tprintf(\"%d\\n\", x1 + x2 + y1 + y2);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n\n\tint n , x1 , y1 , x2 , y2 , dis;\n\tscanf(\"%d%d%d%d%d\",&n , &x1 , &y1 , &x2 , &y2 );\n\n\tif ( x1 == x2 ){\n\t\tif (x1 == 0 || x1 == n) {\n\t\t\tprintf(\"%d\\n\",abs(y1-y2));\n\t\t}else {\n\t\t\tif ( 2*x1 >= n){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * ( n - x1 ) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * x1 ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( y1 == y2 ){\n\t\tif (y1 == 0 || y1 == n ) {\n\t\t\tprintf(\"%d\\n\",abs(x1-x2));\n\t\t}else{\n\t\t\tif ( 2*y1 >= n ){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (n-y1) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (y1) ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( abs(x1 - x2 ) == n){\n\t\tif ( (2*y1 >= n && 2*y2 >= n) || ( 2*y1 <= n && 2*y2 <= n) ){\n\t\t\tprintf(\"%d\\n\", n + y1 + y2);\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",n + y1 + y2);\n\t\t}\n\t}else if ( abs(y1 - y2 ) == n){\n\t\tif ( (2*x1 >= n && 2*x2 >= n) || ( 2*x1 <= n && 2*x2 <= n) ){\n\t\t\tprintf(\"%d\\n\", n + x1 + x2);\n\t\t}else{\n\t\t\tprintf(\"%d\\n\",n + x1 + x2);\n\t\t}\n\t}else{\n\t\tprintf(\"%d\\n\", x1 + x2 + y1 + y2);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint min (int a, int b){\n\treturn (a < b ? a : b);\n}\n\n\nint main(){\n\tint n , x1 , y1 , x2 , y2 ;\n\n\tscanf(\"%d%d%d%d%d\", &n , &x1 , &y1 ,&x2 , &y2 );\n\n\tif ( abs(x1 - x2) == n || abs(y1-y2) == n)\n\t\tprintf(\"%d\\n\" , min ( x1 + y1 + x2 + y2 , 4*n - x1 + y1 + x2 + y2 ) );\n\telse\n\t\tprintf(\"%d\\n\" , abs(x1-x2) + abs(y1-y2) );\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n\n\tint n , x1 , y1 , x2 , y2 , dis;\n\tscanf(\"%d%d%d%d%d\",&n , &x1 , &y1 , &x2 , &y2 );\n\n\tif ( x1 == x2 ){\n\t\tif (x1 == 0 || x1 == n) {\n\t\t\tprintf(\"%d\\n\",abs(y1-y2));\n\t\t}else {\n\t\t\tif ( 2*x1 >= n){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * ( n - x1 ) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * x1 ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( y1 == y2 ){\n\t\tif (y1 == 0 || y1 == n ) {\n\t\t\tprintf(\"%d\\n\",abs(x1-x2));\n\t\t}else{\n\t\t\tif ( 2*y1 >= n ){\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (n-y1) ) ) );\n\t\t\t}else{\n\t\t\t\tprintf(\"%d\\n\", (n + (2 * (y1) ) ) );\n\t\t\t}\n\t\t}\n\t}else if ( abs(x1 - x2 ) == n){\n\t\tprintf(\"%d\\n\" , n + abs(y1-y2));\n\t}else if ( abs(y1 - y2 ) == n){\n\t\tprintf(\"%d\\n\" , n + abs(x1-x2));\n\t}else{\n\t\tprintf(\"%d\\n\", x1 + x2 + y1 + y2);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b);\nint main()\n{\n\tint n,x1,y1,x2,y2,d1,d2;\n\tscanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n\td1=x1+y1+x2+y2;\n\td2=(4*n)-d1;\n\tprintf(\"%d\",min(d1,d2));\n\treturn 0;\n}\nint min(int a,int b)\n{\n\tif(a>b) return b;\n\telse return a;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int n, x1, x2, y1, y2, d;\n\n scanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n if ((x1==x2 && x1==0) || (x1==x2 && x1==n))\n d = abs(y1-y2);\n\n else if ((y1==y2 && y1==0) || (y1==y2 && y1==n))\n d = abs(x1-x2);\n\n else\n ((x1+x2+y1+y2)>(n*4-(x1+x2+y1+y2))) ? (d = n*4-(x1+x2+y1+y2)) : (d = x1+x2+y1+y2) ;\n\n printf(\"%d\", d);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x1,y1,x2,y2,n,bal,mal;\n scanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n if (x1==x2 && y1==y2) printf(\"0\");\n else if ((x1==0 && x2==0)|| (x1==n&&x2==n)) printf(\"%d\",abs(y1-y2));\n else if ((y1==0 && y2==0)|| (y1==n&&y2==n)) printf(\"%d\",abs(x1-x2));\n else if (x1==0 && y2==n)\n {\n printf(\"%d\",(100-y2)+x1);\n }\n else if (x1==n && y2==0)\n {\n printf(\"%d\",(100-x2)+y1);\n }\n else if (x2==0 && y1==n)\n {\n printf(\"%d\",(100-y2)+x1);\n }\n else if (x2==n && y1==0)\n {\n printf(\"%d\",(100-x1)+y2);\n }\n else \n {\n bal=x1+x2+y1+y2;\n mal=4*n-x1-x2-y1-y2;\n if (bal<=mal) printf(\"%d\",bal);\n else printf(\"%d\",mal);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int x1,y1,x2,y2,n,bal,mal;\n scanf(\"%d%d%d%d%d\",&n,&x1,&y1,&x2,&y2);\n if (x1==x2 && y1==y2) printf(\"0\");\n else if ((x1==0 && x2==0)|| (x1==n&&x2==n)) printf(\"%d\",abs(y1-y2));\n else if ((y1==0 && y2==0)|| (y1==n&&y2==n)) printf(\"%d\",abs(x1-x2));\n else if (x1==0 && y2==n)\n {\n printf(\"%d\",(100-y1)+x2);\n }\n else if (x1==n && y2==0)\n {\n printf(\"%d\",(100-x2)+y1);\n }\n else if (x2==0 && y1==n)\n {\n printf(\"%d\",(100-y2)+x1);\n }\n else if (x2==n && y1==0)\n {\n printf(\"%d\",(100-x1)+y2);\n }\n else \n {\n bal=x1+x2+y1+y2;\n mal=4*n-x1-x2-y1-y2;\n if (bal<=mal) printf(\"%d\",bal);\n else printf(\"%d\",mal);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs (int x)\n{\n\treturn ( x < 0 ? -x : x );\n}\n\nint min (int x, int y)\n{\n\treturn (x < y ? x : y);\n}\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s, sq;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\tsq = n * n;\n\ts = x1 + x2 + y1 + y2;\n\n\tif ( abs (x1 - x2) == n || abs (y1 - y2) == n ) {\n\t\tprintf (\"%d\\n\", min (s, 4 * s - s));\n\t} else {\n\t\tprintf (\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b)\n{\n\treturn ( a < b ? a : b );\n}\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s, sq;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\ts = x1 + x2 + y1 + y2;\n\tsq = n * n;\n\n\tif ( s != 0 && sq - s != 0 ) {\n\t\tprintf (\"%d\\n\", min (s, sq - s));\n\t} else {\n\t\tprintf (\"%d\\n\", s);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs (int x)\n{\n\treturn ( x < 0 ? -x : x );\n}\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s, sq;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\tif ( abs (x1 - x2) == n || abs (y1 - y2) == n ) {\n\t\tprintf (\"%d\\n\", x1 + x2 + y1 + y2);\n\t} else {\n\t\tprintf (\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\ts = x1 + x2 + y1 + y2;\n\t\n\tprintf (\"%d\\n\", s);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs (int x)\n{\n\treturn ( x < 0 ? -x : x );\n}\n\nint min (int x, int y)\n{\n\treturn (x < y ? x : y);\n}\n\nint main()\n{\n\tint n, x1, y1, x2, y2;\n\tint s, sq;\n\n\tscanf (\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\t\n\tsq = n * n;\n\ts = x1 + x2 + y1 + y2;\n\n\tif ( abs (x1 - x2) == n || abs (y1 - y2) == n ) {\n\t\tprintf (\"%d\\n\", min (s, sq - s));\n\t} else {\n\t\tprintf (\"%d\\n\", abs(x1 - x2) + abs(y1 - y2));\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int i,n,p=0,a,b,x1,x2,y1,y2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if((x1==n && x2==n)||(x1==0 && x2==0)) {\n printf(\"%d\\n\",abs(y1-y2));\n return 0;\n }\n if((y1==n && y2==n)||(y1==0 && y2==0)) {\n printf(\"%d\\n\",abs(x1-x2));\n return 0;\n }\n if(x1==n || x2==n){\n p=(((n-y1)+(n-y2))>(y1+y2))?y1+y2+abs(x2-x1):n-y1+n-y2+abs(x2-x1);\n }\n else if(y1==n || y2==n){\n p=(((n-x1)+(n-x2))>(x1+x2))?x1+x2+abs(y2-y1):n-x1+n-x2+abs(y2-y1);\n }\n printf(\"%d\\n\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int i,n,p=0,a,b,x1,x2,y1,y2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n p=(((n-y1)+(n-y2))>(y1+y2))?y1+y2+abs(x2-x1):n-y1+n-y2+abs(x2-x1);\n printf(\"%d\\n\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int i,n,p=0,a,b,x1,x2,y1,y2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if(x1==x2) {\n printf(\"%d\\n\",abs(y1-y2));\n return 0;\n }\n p=(((n-y1)+(n-y2))>(y1+y2))?y1+y2+abs(x2-x1):n-y1+n-y2+abs(x2-x1);\n printf(\"%d\\n\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int i,n,p=0,a,b,x1,x2,y1,y2;\n scanf(\"%d %d %d %d %d\",&n,&x1,&y1,&x2,&y2);\n if(x1==x2) {\n printf(\"%d\\n\",abs(y1-y2));\n return 0;\n }\n if(y1==y2) {\n printf(\"%d\\n\",abs(x1-x2));\n return 0;\n }\n if(x1==n || x2==n){\n p=(((n-y1)+(n-y2))>(y1+y2))?y1+y2+abs(x2-x1):n-y1+n-y2+abs(x2-x1);\n }\n else if(y1==n || y2==n){\n p=(((n-x1)+(n-x2))>(x1+x2))?x1+x2+abs(y2-y1):n-x1+n-x2+abs(y2-y1);\n }\n printf(\"%d\\n\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint abs (int x)\n{\n return ( x < 0 ? x : x );\n}\n\nint min (int x, int y)\n{\n return (x < y ? x : y);\n}\n\nint main()\n{\n\tint n, x1, x2, y1, y2;\n\t\n\n\tscanf(\"%d%d%d%d%d\" , &n, &x1, &y1, &x2, &y2);\n\n\tx1 = abs(x1);\n\tx2 = abs(x2);\n\ty1 = abs(y1);\n\ty2 = abs(y2);\n\tif ( (4*n - (x1+x2+y1+y2)) <= (x1+x2+y1+y2) ){\n\t\tprintf(\"%d\\n\" , (4*n - (x1+x2+y1+y2)));\n\t}else{\n\t\tprintf(\"%d\\n\" , (x1+x2+y1+y2));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, x1, x2, y1, y2;\n\tscanf(\"%d%d%d%d%d\" , &n, &x1, &y1, &x2, &y2);\n\n\tif ( (2*n*n - (x1+x2+y1+y2)) <= (x1+x2+y1+y2) ){\n\t\tprintf(\"%d\\n\" , (2*n*n - (x1+x2+y1+y2)));\n\t}else{\n\t\tprintf(\"%d\\n\" , (x1+x2+y1+y2));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, x1, x2, y1, y2;\n\tscanf(\"%d%d%d%d%d\" , &n, &x1, &y1, &x2, &y2);\n\n\tif ( (4*n - (x1+x2+y1+y2)) <= (x1+x2+y1+y2) ){\n\t\tprintf(\"%d\\n\" , (4*n - (x1+x2+y1+y2)));\n\t}else{\n\t\tprintf(\"%d\\n\" , (x1+x2+y1+y2));\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, x1, y1, x2,y2;\n\n\tscanf(\"%d%d%d%d%d\" , &n, &x1, &y1, &x2 , &y2 );\n\n\tif (y1==0 && y2 == 0){\n\t\tprintf(\"%d\\n\" , x2 - x1 );\n\t}else{\n\n\tif ( (n-y1+n-y2) <= ( y1+y2)){\n\t\tprintf(\"%d\\n\" , 2*n-(y1+y2)+n);\n\t}else{\n\t\tprintf(\"%d\\n\" , y1+y2+n );\n\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n int s1=0,s2=0, i, j, n, x1, y1, x2, y2;\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if(x1==x2 && y1==y2){\n printf(\"0\");\n return 0;\n }\n if(x1==x2 && (x1==0 || x1==n)){\n printf(\"%d\", abs(y1-y2));\n return 0;\n }\n else if(y1==y2 &&(y1==0 || y1==n)){\n printf(\"%d\", abs(x1-x2));\n return 0;\n }\n while(1){\n if(x1>=0 && x1<=n && y1==0){\n s1 = abs(x2-x1);\n if(x2==n && y2>=0 && y2<=n){\n s1+=(y2);\n break;\n }\n else s1+=n;\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n s1+=abs(n-y2);\n break;\n }\n else if(x1==n){\n s1=abs(n-y1);\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n s1+=x2;\n break;\n }\n else if(y1==n){\n s1+=x1;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n s1+=y2;\n break;\n }\n else{\n s1+=y1;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n if(x2==n && y2>=0 && y2<=n){\n s1+=y2;\n break;\n }\n else s1+=n;\n s1+=abs(n-x2);\n break;\n }\n\n }\n s2=(4*n)-s1;\n if(s1<s2){\n printf(\"%d\", s1);\n\n }\n else{\n printf(\"%d\", s2);\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n int s1=0,s2=0, i, j, n, x1, y1, x2, y2;\n scanf(\"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2);\n\n if(x1==x2 && y1==y2){\n printf(\"0\");\n return 0;\n }\n\n while(1){\n if(x1>=0 && x1<=n && y1==0){\n s1 = abs(x2-x1);\n if(x2==n && y2>=0 && y2<=n){\n s1+=(y2);\n break;\n }\n else s1+=n;\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n s1+=abs(n-y2);\n break;\n }\n else if(x1==n){\n s1=abs(n-y1);\n if(y2==n && x2>=0 && x2<=n){\n s1+=abs(n-x2);\n break;\n }\n else s1+=n;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n s1+=x2;\n break;\n }\n else if(y1==n){\n s1+=x1;\n if(x2==0 && y2>=0 && y2<=n){\n s1+=abs(n-y2);\n break;\n }\n else s1+=n;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n s1+=y2;\n break;\n }\n else{\n s1+=y1;\n if(y2==0 && x2>=0 && x2<=n){\n s1+=x2;\n break;\n }\n else s1+=n;\n if(x2==n && y2>=0 && y2<=n){\n s1+=y2;\n break;\n }\n else s1+=n;\n s1+=abs(n-x2);\n break;\n }\n\n }\n s2=(4*n)-s1;\n if(s1<s2){\n printf(\"%d\", s1);\n\n }\n else{\n printf(\"%d\", s2);\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\tint x1, x2, y1, y2, x, y, n;\n\tscanf(\"%d%d%d%d%d\", &n, &x1, &y1, &x2, &y2);\n\n\tif (x1==0 || x2 == 0 || x1 == n || x2 == n)\n\t\tx = fabs(x1 - x2);\n\telse x = (x1 + x2 < 2*n - x1 - x2) ? x1 + x2 : 2*n - x1 - x2;\n\tif (y1==0 || y2 == 0 || y1 == n || y2 == n)\n\t\ty = fabs(y1 - y2);\n\telse y = (y1 + y2 < 2*n - y1 - y2) ? y1 + y2 : 2*n - y1 - y2;\n\n\tprintf(\"%d\\n\", x + y);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint abs( int d )\n{\n \n return d < 0 ? -d : d;\n}\n\nint cut( int x, int y, int n )\n{\n if ( x == 0 ) {\n return y;\n }\n if ( y == n ) {\n return n + x;\n }\n if ( x == n ) {\n return 2 * n + y ;\n }\n\n if ( y == 0 ) {\n return 3 * n + x ;\n }\n\n return -1;\n}\n\nint main( void ) \n{\n int n, x1, y1, x2, y2;\n int d1, d2, diff;\n\n scanf( \"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2 );\n d1 = cut( x1, y1, n );\n d2 = cut( x2, y2, n );\n diff = abs( d1 - d2 );\n diff = 4 * n - diff < diff ? 4 * n - diff : diff;\n printf( \"%d\\n\", diff );\n fflush( stdout );\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint abs( int d )\n{\n \n return d < 0 ? -d : d;\n}\n\nint cut( int x, int y, int n )\n{\n if ( x == 0 ) {\n return y;\n }\n if ( y == n ) {\n return n + x;\n }\n if ( x == n ) {\n if ( y ) {\n return 2 * n + y ;\n } else {\n return 3 * n;\n }\n }\n\n if ( y == 0 ) {\n return 3 * n + x ;\n }\n\n return -1;\n}\n\nint main( void ) \n{\n int n, x1, y1, x2, y2;\n int d1, d2, diff;\n\n scanf( \"%d %d %d %d %d\", &n, &x1, &y1, &x2, &y2 );\n d1 = cut( x1, y1, n );\n d2 = cut( x2, y2, n );\n diff = abs( d1 - d2 );\n diff = 4 * n - diff < diff ? 4 * n - diff : diff;\n printf( \"%d\\n\", diff );\n fflush( stdout );\n\n return 0;\n\n}\n"}], "src_uid": "685fe16c217b5b71eafdb4198822250e"} {"nl": {"description": "Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display). Max starts to type all the values from a to b. After typing each number Max resets the calculator. Find the total number of segments printed on the calculator.For example if a\u2009=\u20091 and b\u2009=\u20093 then at first the calculator will print 2 segments, then \u2014 5 segments and at last it will print 5 segments. So the total number of printed segments is 12.", "input_spec": "The only line contains two integers a,\u2009b (1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009106) \u2014 the first and the last number typed by Max.", "output_spec": "Print the only integer a \u2014 the total number of printed segments.", "sample_inputs": ["1 3", "10 15"], "sample_outputs": ["12", "39"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\nint main ()\n{\nint i,j,k,a,b,s=0,x,y;\nscanf(\"%d%d\",&a,&b);\nfor(i=a;i<=b;i++)\n{\n x=i;\n while(x!=0)\n {\n y=x%10;\n x=x/10;\n if(y==1)s=s+2;\n if(y==2)s=s+5;\n if(y==3)s=s+5;\n if(y==4)s=s+4;\n if(y==5)s=s+5;\n if(y==6)s=s+6;\n if(y==7)s=s+3;\n if(y==8)s=s+7;\n if(y==9)s=s+6;\n if(y==0)s=s+6;\n }\n\n}\nprintf(\"%d\",s);\n}\n"}, {"source_code": "#include<stdio.h>\nint cal(int x)\n{\n if(x==0)\n return 6;\n else if(x==1)\n return 2;\n else if(x==2)\n return 5;\n else if(x==3)\n return 5;\n else if(x==4)\n return 4;\n else if(x==5)\n return 5;\n else if(x==6)\n return 6;\n else if(x==7)\n return 3;\n else if(x==8)\n return 7;\n else\n return 6;\n}\nint main()\n{\n int a,b,i,ans=0,p;\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n int t=i;\n while(t!=0)\n {\n p=t%10;\n ans=ans+cal(p);\n t=t/10;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,y,ans=0,i;\n\tscanf(\"%d%d\",&a,&b);\n\tint k[10]={6,2,5,5,4,5,6,3,7,6};\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tint x=i;\n\t\twhile(x>0)\n\t\t{\n\t\t\ty=x%10;\n\t\t\tans=ans+k[y];\n\t\t\tx=x/10;\n\t\t}\n\t}\n\tif(a==0)\n\t{\n\t\tprintf(\"%d\\n\",ans+6);\n\t}\n\telse\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n//\t\t\t 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }\nint CoS[] = { 6, 2, 5, 5, 4 ,5, 6, 3, 7, 6 };\n\n\nint GetCountOfSegment(int a)\n{\n\tint iSum = 0;\n\tint i = 0;\n\tint iLen ;\n\t\n\tchar strA[20];\t\n\tsprintf(strA,\"%d\",a);\n\t\n\tiLen = strlen( strA );\n\t\n\tfor( i = 0 ; i < iLen ; i++ )\n\t{\n\t\tiSum += CoS[ strA[i]-'0' ];\t\n\t}\n\n\treturn iSum;\n}\n\nint main()\n{\n\n\tint a,b;\n\tint iSum = 0;\n\tint i;\n\n\tscanf(\"%d%d\", &a, &b );\n\t\n\t\n\tfor( i = a ; i <= b ; i++ )\n\t{\n\t\tiSum += GetCountOfSegment( i );\t\t\n\t}\n\t\n\tprintf(\"%d\",iSum);\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,z,sum=0,o,u,j;\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n z=i;\n for(j=0;z!=0;j++)\n {\n o=z%10;\n if(o==0)\n {\n sum=sum+6;\n }\n else if(o==1)\n {\n sum=sum+2;\n }\n else if(o==2)\n {\n sum=sum+5;\n }\n else if(o==3)\n {\n sum=sum+5;\n }\n else if(o==4)\n {\n sum=sum+4;\n }\n else if(o==5)\n {\n sum=sum+5;\n }\n else if(o==6)\n {\n sum=sum+6;\n }\n else if(o==7)\n {\n sum=sum+3;\n }\n else if(o==8)\n {\n sum=sum+7;\n }\n else if(o==9)\n {\n sum=sum+6;\n }\n z=z/10;\n }\n\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n // char st[200000];\n long long i,j,k,n,l=0,arr[20]={6,2,5,5,4,5,6,3,7,6},p=0;\n scanf(\"%lld%lld\",&n,&k);\n for(i=n;i<=k;i++)\n {//l=0;\n // sprintf(st,\"%lld\",i);\n /*for(j=0;st[j]!='\\0';j++)\n {\n if(st[j]=='0')\n {\n l+=6;\n }\n else if(st[j]=='1')\n l+=2;\n else if(st[j]=='2')l+=5;\n else if(st[j]=='3')l+=5;\n else if(st[j]=='4')l+=4;\n else if(st[j]=='5')l+=5;\n else if(st[j]=='6')l+=6;\n else if(st[j]=='7')l+=3;\n else if(st[j]=='8')l+=7;\n else if(st[j]=='9')l+=6;\n }j=strlen(st);\n if(j==1)\n {\n l+=arr[st[0]-'0'];\n }\n else if(j==2)\n {\n l+=(arr[st[0]-'0']+arr[st[1]-'0']);\n }\n else if(j==3)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']);\n else if(j==4)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']);\n else if(j==5)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']+arr[st[4]-'0']);\n else if(j==6)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']+arr[st[4]-'0']+arr[st[5]-'0']);*/\n p=i;\n while(p!=0)\n {\n l+=arr[p%10];p/=10;\n }\n }printf(\"%lld\",l);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n int seg[10]={6,2,5,5,4,5,6,3,7,6};\n long long int r;\n scanf(\"%d %d\",&a,&b);\n for(r=0;a<=b;a++){\n c=a;\n while(c){\n r+=seg[c%10];\n c/=10;\n }\n }\n printf(\"%I64d\",r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a, b, x, i, s=0;\n\tint e[10]={6,2,5,5,4,5,6,3,7,6};\n\t\n\tscanf(\"%d %d\", &a, &b);\n\t\n\tfor(i=a; i<=b; i++)\n\t{\n\t\tx=i;\n\t\twhile(x/10!=0)\n\t\t{\n\t\t\ts=s+e[x%10];\n\t\t\tx=x/10;\n\t\t}\n\t\ts=s+e[x%10];\n\t}\n\tprintf(\"%d\", s);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int s[11]={6,2,5,5,4,5,6,3,7,6};\n int a,b,c=0,i=0,j=0;\n scanf(\"%d %d\", &a, &b);\n for(i=a;i<=b;i++){\n for(j=i;j>0;j=j/10){\n c = c + s[j%10];\n }\n }\n printf(\"%d\\n\", c);\nreturn 0;\n}"}, {"source_code": "r,n;main(a,b){for(scanf(\"%d%d\",&a,&b);b/a;)for(n=a++;n;n/=10)r+=\"6255456376\"[n%10]^48;printf(\"%d\",r);}"}, {"source_code": "//\n// main.cpp\n// B\n//\n// Created by KJBS2 on 2016. 1. 22..\n// Copyright (c) 2016\ub144 KJBS2. All rights reserved.\n//\n\n#include <stdio.h>\n\nint Plus[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n\nint main() {\n int a, b;\n scanf(\"%d%d\", &a, &b);\n \n int result = 0;\n for(int i=a; i<=b; i++) {\n int now = i;\n while(now) {\n result += Plus[now%10];\n now /= 10;\n }\n }\n \n printf(\"%d\\n\", result);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n int i,j,n1,n2,t;\n int n = 0;\n scanf(\"%d%d\",&n1,&n2);\n for(i=n1; i<=n2; i++)\n {\n t = i;\n while(t>0)\n {\n n += a[t%10];\n t /= 10;\n }\n }\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include<stdio.h>\nint F(int n){\n\tswitch(n){\n\t\tcase 0:\n\t\t\treturn 6;\n\t\tcase 1:\n\t\t\treturn 2;\n\t\tcase 2:\n\t\t\treturn 5;\n\t\tcase 3:\n\t\t\treturn 5;\n\t\tcase 4:\n\t\t\treturn 4;\n\t\tcase 5:\n\t\t\treturn 5;\n\t\tcase 6:\n\t\t\treturn 6;\n\t\tcase 7:\n\t\t\treturn 3;\n\t\tcase 8:\n\t\t\treturn 7;\n\t\tcase 9:\n\t\t\treturn 6;\n\t}\n}\nint main(){\n\tint a,b,n,m,sum = 0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor(int i = a; i <= b; i++){\n\t\tn = i;\n\t\t\twhile(n>0){\n\t\t\t\tsum += F((n%10));\n\t\t\t\tn/=10; \n\t\t\t}\n\t\t\t\n\t\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "//\n// main.cpp\n// B\n//\n// Created by KJBS2 on 2016. 1. 22..\n// Copyright (c) 2016\ub144 KJBS2. All rights reserved.\n//\n\n#include <stdio.h>\n\nint Plus[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n\nint main() {\n int a, b;\n scanf(\"%d%d\", &a, &b);\n \n int result = 0;\n for(int i=a; i<=b; i++) {\n int now = i;\n while(now) {\n result += Plus[now%10];\n now /= 10;\n }\n }\n \n printf(\"%d\\n\", result);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a = 0, b = 0, tmp;\n int c;\n int sum = 0;\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n for (int i = a; i <= b; i++)\n {\n tmp = i;\n while (tmp > 0)\n {\n c = tmp % 10;\n tmp = tmp / 10;\n if (c == 1)\n sum += 2;\n else if (c == 2 || c == 3 || c == 5)\n sum += 5;\n else if (c == 4)\n sum += 4;\n else if (c == 6 || c == 9 || c == 0)\n sum += 6;\n else if (c == 7)\n sum += 3;\n else if (c == 8)\n sum += 7;\n }\n }\n printf(\"\\n %d\", sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint call(int);\nint main()\n{\nint a,b;\nscanf(\"%d%d\",&a,&b);\nint i,j,k,count=0;\nfor(i=a;i<=b;i++){ j=i;\n for(;j>0;){\n k=j%10;\n count=call(k)+count;\n j=j/10;\n }\n}\nprintf(\"%d\",count);\nreturn 0;\n}\nint call(int c){\nswitch(c){\n case 0: return 6;\n case 1: return 2;\n case 2: return 5;\n case 3: return 5;\n case 4: return 4;\n case 5: return 5;\n case 6: return 6;\n case 7: return 3;\n case 8: return 7;\n case 9: return 6;\n}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,i,k,m;\n long long sum=0;\n int ara[]={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d %d\",&a,&b);\n\n for(i=a;i<=b;i++){\n k=i;\n while (k>0)\n {\n m=k%10;\n k = k/10;\n sum = sum+ara[m];\n }\n }\n\n printf(\"%lld\\n\",sum);\n\n return 0;\n}"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\nint a[10]={6,2,5,5,4,5,6,3,7,6},x,y,i,sum,tmp,digit;\nint main(){\n scanf(\"%d %d\",&x,&y);\n for (i=x; i<=y; i++) {\n tmp=i;\n while(tmp){\n digit=tmp%10;\n sum+=a[digit];\n tmp/=10;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[] = {6,2,5,5,4,5,6,3,7,6};\nint s(int n)\n{\nint r = 0;\nwhile(n){r+= a[n%10];n/=10;}\nreturn r;\n}\nint main()\n{\nint ans = 0;\nint n,m;\nscanf(\"%d%d\",&n,&m);\nint x;\nfor(x=n;x<=m;x++)\nans+= s(x);\nprintf(\"%d\\n\",ans);\nreturn 0;\n}"}, {"source_code": "#include\t<stdio.h>\n#include\t<stdlib.h>\n \n\n#define debug(name, arg) printf(\"debug(%s%d) \\n\", name, arg)\n\nint solution(int arg, int arg1) {\n\tint ret = 0;\n\tint i;\n\tint rem;\n\tint number;\n\n\tfor(i = arg; i <= arg1; ++i) {\n\t\tnumber = i;\n\t\twhile(number) {\n\t\t\trem = number % 10;\n\n\t\t\tswitch(rem) {\n\t\t\t\tcase 0 : ret += 6; break;\n\t\t\t\tcase 1 : ret += 2; break;\n\t\t\t\tcase 2 : ret += 5; break;\n\t\t\t\tcase 3 : ret += 5; break;\n\t\t\t\tcase 4 : ret += 4; break;\n\t\t\t\tcase 5 : ret += 5; break;\n\t\t\t\tcase 6 : ret += 6; break;\n\t\t\t\tcase 7 : ret += 3; break;\n\t\t\t\tcase 8 : ret += 7; break;\n\t\t\t\tcase 9 : ret += 6; break;\n\t\t\t}\n\n\t\t\tnumber = number / 10;\n\t\t}\n\t}\n\n\treturn ret;\n}\n\nint main()\n{\n\tint a, b;\n\tint sol;\n\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\n\t//debug(\"a = \",a);\n\t//debug(\"b = \",b);\n\n\tsol = solution(a, b);\n\tprintf(\"%d \\n\", sol);\n\t//debug(\"sol = \", sol);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\n int x,y,n,i,j,d;\n long int z=0;\n\n scanf(\"%d %d\",&x,&y);\n int hey[10]={6,2,5,5,4,5,6,3,7,6};\n for(i=x;i<=y;i++){\n n=count(i);\n for(j=1;j<=n;j++){\n d=digit(i,j);\n z=z+hey[d];\n\n }\n }\n printf(\"%ld\\n\",z);\n\n\n}\nint count(int n)\n{\n int c=0;\n while(n != 0)\n {\n n /= 10;\n c++;\n }\n\n return c;\n}\n\nint digit(int num,int n)\n{\n int i;\n long int z1=1;\n for(i=1;i<=n;i++){\n z1=z1*10;\n\n }\n int y1=num%z1;\n long int z2=1;\n for(i=1;i<=n-1;i++){\n z2=z2*10;\n }\n int y2=y1/z2;\n return y2;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint segCalc(int number){\n\tif(number==4){\n\t\treturn 4;\n\t}else if (number==1){\n\t\treturn 2;\n\t}else if (number==2||number==5||number==3){\n\t\treturn 5;\n\t}else if (number==6||number==0||number==9){\n\t\treturn 6;\n\t}else if (number==7){\n\t\treturn 3;\n\t}else if (number==8){\n\t\treturn 7;\n\t}\n\t\n\t\n\t\n}\nlong findSeg(long i){\n\tlong seg;\n\tint temp;\n\tif((i)/10==0){\n\t\tseg= segCalc(i%10);\n\t\treturn seg;\n\t}\n\telse{\n\t\ttemp=i%10;\n\t\tseg=segCalc(temp);\n\t\t\n\t\treturn seg+findSeg(i/10);\n\t}\n\t\n}\nint main() {\n\t// your code goes here\n\tlong a,b,sum=0,i;\n\t\n\tscanf(\"%ld %ld\",&a,&b);\n\tfor(i=a;i<=b;i++){\n\t\t\n\tsum+=\tfindSeg(i);\t\n\t\n\t}\n\n\tprintf(\"%ld\",sum);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n int i,j,n1,n2,t;\n int n = 0;\n scanf(\"%d%d\",&n1,&n2);\n for(i=n1; i<=n2; i++)\n {\n t = i;\n while(t>0)\n {\n n += a[t%10];\n t /= 10;\n }\n }\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n int seg[10]={6,2,5,5,4,5,6,3,7,6};\n long long int r;\n scanf(\"%d %d\",&a,&b);\n for(r=0;a<=b;a++){\n c=a;\n while(c){\n r+=seg[c%10];\n c/=10;\n }\n }\n printf(\"%I64d\",r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint yes(int *t,int n)\n{\n\tif(n>=10)\n\treturn t[n%10]+yes(t,n/10);\n\telse return t[n];\n}\n\nint main(){\n\tint sig[]={6,2,5,5,4,5,6,3,7,6};\n\tint a,b,i,s=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t\ts=s+yes(sig,i);\n\t\tprintf(\"%d\",s);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,b,i,j,s=0,k;\n scanf(\"%ld %ld\",&a,&b);\n for(k=a;k<=b;k++)\n {\n i=k;\n while(i!=0)\n {\n j=i%10;\n if(j==0 || j==6 || j==9)\n s+=6;\n else if(j==1)\n s+=2;\n else if(j==2 || j==3 || j==5)\n s+=5;\n else if(j==4)\n s+=4;\n else if(j==7)\n s+=3;\n else\n s+=7;\n i=i/10;\n }\n }\n printf(\"%ld\\n\",s);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, sum=0, s;\n scanf(\"%d%d\",&a,&b);\n for (int i=a; i<=b; i++)\n for (int j=i; j!=0; j/=10){\n s=j%10;\n switch (s){\n case 0 :\n case 6 :\n case 9 : sum+=6; break;\n case 1 : sum+=2; break;\n case 2 :\n case 3 :\n case 5 : sum+=5; break;\n case 4 : sum+=4; break;\n case 7 : sum+=3; break;\n case 8 : sum+=7; break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint show[10]={6,2,5,5,4,5,6,3,7,6};\nint count(int a){\n\tint counter=0;\n\twhile(a>0){\n\t\tcounter+=show[a%10];\n\t\ta=a/10;\n\t}\n\treturn counter;\n}\n\nint main() {\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i;\n\tlong long total=0;\n\tfor(i=a;i<=b;i++){\n\t\ttotal+=count(i);\n\t}\n\tprintf(\"%lld\\n\",total);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint sum(int i,int d[])\n{\n\tint s=0;\n\twhile(i>0)\n\t{\n\t\ts+=d[i%10];\n\t\ti/=10;\n\t}\n\treturn s;\n}\nint d[1000005];\nint main()\n{\n\tint a,b;\n\tlong long s=0;\n\tscanf(\"%d%d\",&a,&b);\n\td[0]=6,d[1]=2,d[2]=5,d[3]=5,d[4]=4,d[5]=5,d[6]=6,d[7]=3,d[8]=7,d[9] = 6;\n\tfor(int i=10;i<=1000000;i++)\n\t d[i]=sum(i,d);\n\tfor(int i=a;i<=b;i++)\n\t s+=d[i];\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n int arra[]={6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n int a, b;\n int o=0 ;\n int i,c;\n scanf(\"%d%d\", &a, &b) ;\n for ( i=a ; i<=b ; i++)\n {\n c=i ;\n while (c)\n {\n o +=arra[c%10] ;\n c /=10 ;\n }\n }\n printf(\"%d\\n\", o) ;\n return 0 ;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, m, a, b, sum; \n\tstatic int dd[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };\n\n\tscanf(\"%d%d\", &a, &b);\n\tsum = 0;\n\tfor (n = a; n <= b; n++)\n\t\tfor (m = n; m > 0; m /= 10)\n\t\t\tsum += dd[m % 10];\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cnt(int d) {\n\tswitch (d) {\n\t\tcase 0:\n\t\t\treturn 6;\n\t\tcase 1:\n\t\t\treturn 2;\n\t\tcase 2:\n\t\t\treturn 5;\n\t\tcase 3:\n\t\t\treturn 5;\n\t\tcase 4:\n\t\t\treturn 4;\n\t\tcase 5:\n\t\t\treturn 5;\n\t\tcase 6:\n\t\t\treturn 6;\n\t\tcase 7:\n\t\t\treturn 3;\n\t\tcase 8:\n\t\t\treturn 7;\n\t\tcase 9:\n\t\t\treturn 6;\n\t}\n\treturn 0;\n}\n\nint segments(int n) {\n\treturn n < 10 ? cnt(n) : segments(n / 10) + cnt(n % 10);\n}\n\nint main() {\n\tint n, a, b, sum; \n\n\tscanf(\"%d%d\", &a, &b);\n\tsum = 0;\n\tfor (n = a; n <= b; n++)\n\t\tsum += segments(n);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define ll long long int \n\nint main()\n{\n\tll arr[10]={6,2,5,5,4,5,6,3,7,6};\n\tll a,b,i,j,count=0,t;\n\t\n\tscanf(\"%lld%lld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tif(i>9)\n\t\t{\n\t\t\tfor(j=i;;)\n\t\t\t{\n\t\t\t\tt=j%10;\n\t\t\t\tcount+=arr[t];\n\t\t\t\tj=j/10;\n\t\t\t\tif(j==0) break;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcount+=arr[i];\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint p[]={6,2,5,5,4,5,6,3,7,6};\nint num,sum,a,b,i;\nscanf(\"%d%d\",&a,&b);\nsum=0;\nfor(i=a;i<=b;i++)\n{\na=i;\nwhile(a!=0)\n{\nnum=a%10;\na=a/10;\nsum=sum+p[num];\n}\n}\nprintf(\"%d\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int num[10];\n num[0] = 6;\n num[1] = 2;\n num[2] = 5;\n num[3] = 5;\n num[4] = 4;\n num[5] = 5;\n num[6] = 6;\n num[7] = 3;\n num[8] = 7;\n num[9] = 6;\n int a, b, s = 0, i1;\n scanf(\"%d %d\", &a, &b);\n for (int i = a; i <= b; i++){\n i1 = i;\n if (i1 == 0){\n s += num[0];\n } else {\n while (i1 != 0){\n s += num[i1 % 10];\n i1 = i1 / 10;\n }\n }\n }\n printf(\"%d\", s);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nconst int seg[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };\n\nint a, b;\n\nint main(void)\n{\n int i, num, count;\n\n /* Reads the input */\n scanf(\"%d%d\", &a, &b);\n\n /* Count */\n count = 0;\n\n for (i = a; i <= b; ++i)\n {\n num = i;\n\n /* Count each digits */\n while (num > 0)\n {\n count += seg[num % 10];\n num /= 10;\n }\n }\n\n /* Writes the answer */\n printf(\"%d\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint p[]={6,2,5,5,4,5,6,3,7,6};\nint num,sum,a,b,i;\nscanf(\"%d%d\",&a,&b);\nsum=0;\nfor(i=a;i<=b;i++)\n{\na=i;\nwhile(a!=0)\n{\nnum=a%10;\na=a/10;\nsum=sum+p[num];\n}\n}\nprintf(\"%d\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nconst int seg[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };\n\nint a, b;\n\nint main(void)\n{\n int i, num, count;\n\n /* Reads the input */\n scanf(\"%d%d\", &a, &b);\n\n /* Count */\n count = 0;\n\n for (i = a; i <= b; ++i)\n {\n num = i;\n\n /* Count each digits */\n while (num > 0)\n {\n count += seg[num % 10];\n num /= 10;\n }\n }\n\n /* Writes the answer */\n printf(\"%d\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c;\n int seg[10]={6,2,5,5,4,5,6,3,7,6};\n long long int r;\n scanf(\"%d %d\",&a,&b);\n for(r=0;a<=b;a++){\n c=a;\n while(c){\n r+=seg[c%10];\n c/=10;\n }\n }\n printf(\"%I64d\",r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,i,s,d=0,g,c;\n\tscanf(\"%d %d\", &a , &b);\n for (i=a;i<=b; i++)\n\t{\n\t\tc=i;\n\t\twhile(c!=0)\n\t\t{\n\t\tg=c%10;\n\t\tif (g==0) s=6;\n\t\telse if (g==1) s=2;\n\t\telse if (g==2) s=5;\n\t\telse if (g==3) s=5;\n\t\telse if (g==4) s=4;\n\t\telse if (g==5) s=5;\n \telse if (g==6) s=6;\n \telse if (g==7) s=3;\n \telse if (g==8) s=7;\n \telse if (g==9) s=6;\n \td=d+s;\n \tc=c/10;\n\t\t}\n\t}\n\t\tprintf(\"%d\", d);\n}"}, {"source_code": "#include<stdio.h>\n\nint show[10]={6,2,5,5,4,5,6,3,7,6};\nint count(int a){\n\tint counter=0;\n\twhile(a>0){\n\t\tcounter+=show[a%10];\n\t\ta=a/10;\n\t}\n\treturn counter;\n}\n\nint main() {\n\tint a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tint i;\n\tlong long total=0;\n\tfor(i=a;i<=b;i++){\n\t\ttotal+=count(i);\n\t}\n\tprintf(\"%lld\\n\",total);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,i,sum=0,c,d;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\td=i;\n\t\twhile(d!=0)\n\t\t{\n\t\t\tc=d%10;\n\t\t\tif(c==0)\n\t\t\tsum=sum+6;\n\t\t\tif(c==1)\n\t\t\tsum=sum+2;\n\t\t\tif(c==2)\n\t\t\tsum=sum+5;\n\t\t\tif(c==3)\n\t\t\tsum=sum+5;\n\t\t\tif(c==4)\n\t\t\tsum=sum+4;\n\t\t\tif(c==5)\n\t\t\tsum=sum+5;\n\t\t\tif(c==6)\n\t\t\tsum=sum+6;\n\t\t\tif(c==7)\n\t\t\tsum=sum+3;\n\t\t\tif(c==8)\n\t\t\tsum=sum+7;\n\t\t\tif(c==9)\n\t\t\tsum=sum+6;\n\t\t\td=d/10;\n\t\t}\n\t}\n\tprintf(\"%d\",sum);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint Num(long a , long b);\nint Analysize(int i);\nint GetSeg(int a);\n\nint main()\n{\n long a,b;\n scanf(\"%ld %ld\",&a,&b);\n long result=Num(a,b);\n printf(\"%ld\",result);\n return 0;\n}\n\nint Num(long a , long b)\n{\n long result=0;\n\n while(a<=b)\n {\n result+=GetSeg(a);\n a++;\n }\n return result;\n}\n\n\nint Analysize(int i)\n{\n int d;\n switch (i)\n {\n case 1:\n d=2;\n break;\n case 7:\n d=3;\n break;\n case 2:\n case 3:\n case 5:\n d=5;\n break;\n case 4:\n d=4;\n break;\n case 0:\n case 6:\n case 9:\n d=6;\n break;\n case 8:\n d=7;\n break;\n }\n return d;\n}\n\n\nint GetSeg(int a){\n int result=0;\nwhile(a!=0){\n result+=Analysize(a%10);\n a/=10;\n}\nreturn result;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void){\n\nint y,i,a,b,x,s;\n\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\n\ns=0;\nfor (i=a;i<=b;i++){\ny=i;\nwhile(y!=0){\t\n\tx=(y%10);\n\ty=(y/10);\n\t\n\tswitch (x){\n\t\tcase 0 : s=s+6;\n\t\t break;\n\t\tcase 1 : s=s+2;\n\t\t break;\n\t\tcase 2 : s=s+5;\n\t\t break;\n\t\tcase 3 : s=s+5;\n\t\t break;\n\t\tcase 4 : s=s+4;\n\t\t break;\n\t\tcase 5 : s=s+5;\n\t\t break;\n\t\tcase 6 : s=s+6;\n\t\t break;\n\t\tcase 7 : s=s+3;\n\t\t break;\n\t\tcase 8 : s=s+7;\n\t\t break;\n\t\tcase 9 : s=s+6;\n\t\t break;\n\t}\n\tif (y==0){\n\t\tbreak;\n\t\t}\n}\n}\n\nprintf(\"%d\",s);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <time.h>\n#define SIZE 1000002\n\nlong min(long a, long b)\n{\n return (a < b) ? a : b;\n}\n\nlong max(long a, long b)\n{\n return (a < b) ? b : a;\n}\n\nlong sum(int seg[], long x)\n{\n long k = 0;\n while (x > 0)\n {\n k += seg[x % 10];\n x /= 10;\n }\n return k;\n}\n/*****************************************************************************/\nint main(void)\n{\n long m, n, k, i;\n int seg[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n scanf(\"%ld %ld\", &m, &n);\n k = 0;\n for (i = m; i <= n; ++i)\n {\n k += sum(seg, i);\n }\n printf(\"%ld\\n\", k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,i,d,sum=0,c[100] ={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d %d\", &a, &b);\n for(i=a;i<=b;i++)\n {\n d=i;\n while(d>0){\n sum+=c[d%10];\n d/=10;\n }\n\n }\n printf(\"%d\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main(){\n int a,b,i,j;\n long long unsigned int count=0;\n char str[8];\n scanf(\"%d %d\",&a,&b);\n\n for(i=a;i<=b;i++){\n j=0;\n itoa(i,str,10);\n while(str[j]!=0){\n switch(str[j]){\n case '0': count+=6;\n break;\n case '1': count+=2;\n break;\n case '2': count+=5;\n break;\n case '3': count+=5;\n break;\n case '4': count+=4;\n break;\n case '5': count+=5;\n break;\n case '6': count+=6;\n break;\n case '7': count+=3;\n break;\n case '8': count+=7;\n break;\n case '9': count+=6;\n break;\n\n }\n j++;\n }\n\n }\n printf(\"%I64d\\n\",count);\n\n return 0;\n\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,segment=0,digit;\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n { a=i;\n while(a!=0)\n {\n digit=a%10;\n if(digit==0) segment+=6;\n if(digit==1) segment+=2;\n if(digit==2) segment+=5;\n if(digit==3) segment+=5;\n if(digit==4) segment+=4;\n if(digit==5) segment+=5;\n if(digit==6) segment+=6;\n if(digit==7) segment+=3;\n if(digit==8) segment+=7;\n if(digit==9) segment+=6;\n a=a/10;\n }\n }\n printf(\"%d\",segment);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a,b,total=0;\n int segments[]={6,2,5,5,4,5,6,3,7,6};\n int j;\n scanf(\"%d%d\",&a,&b);\n \n for (int i=a; i<=b; i++) {\n a=i;\n while (a>=10) {\n j=a%10;\n a=a/10;\n total+=segments[j];\n }\n total+=segments[a];\n }\n printf(\"%d\",total);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int seg[10]= {6,2,5,5,4,5,6,3,7,6};\n long a , b ,loopIndex , i;\n long sum = 0 ;\n scanf(\"%d %d\", &a , &b);\n for(loopIndex=a;loopIndex<=b;loopIndex++)\n {\n i = loopIndex ;\n while(i>0)\n {\n sum+=seg[i%10];\n i/=10 ;\n }\n }\n printf(\"%d\", sum);\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n long long int test,n,i,j,sum1,k,m,a,flag=0,count=0,b,c[10]={6,2,5,5,4,5,6,3,7,6},a1,b2;\n scanf(\"%lld%lld\",&a,&b);\n count=0;\n for(i=a;i<=b;i++){\n k=i;\n while(k>0){\n count+=c[k%10];\n k/=10;\n }\n }\n printf(\"%lld\",count);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint p[]={6,2,5,5,4,5,6,3,7,6};\nint num,sum,a,b,i;\nscanf(\"%d%d\",&a,&b);\nsum=0;\nfor(i=a;i<=b;i++)\n{\na=i;\nwhile(a!=0)\n{\nnum=a%10;\na=a/10;\nsum=sum+p[num];\n}\n}\nprintf(\"%d\\n\",sum);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint number(int a)\n{\n\tint i,num=0;\n\tint b[10]={6,2,5,5,4,5,6,3,7,6};\n\twhile(1)\n\t{\n\t\ti=a%10;\n\t\tnum+=b[i];\n\t\tif(a/10==0) break;\n\t\ta/=10;\n\t}\n\treturn num;\n\t\n}\nint main()\n{\n\tint a,b,i,num=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;++i)\n\t{\n\t\tnum+=number(i);\n\t}\n\tprintf(\"%d\",num);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,x,y,z,j,s,i;\n scanf(\"%d %d\",&x, &i);\n s=0;\n j=x;\n while(j<=i)\n {\n for(a=1;a<9;a++)\n {if(j!=0)\n {\n b=j%10;\n c=j-b;\n d=c/10;\n j=d;\n\n if(b==8)\n y=7;\n else if(b==0 || b==6 || b==9)\n y=6;\n else if(b==2 || b==3 || b==5)\n y=5;\n else if(b==4)\n y=4;\n else if(b==7)\n y=3;\n else if(b==1)\n y=2;\n\n s=s+y;\n }\n\n }\n x=x+1;\n j=j+x;\n\n }\n printf(\"%d\",s);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cnt(int d) {\n\tswitch (d) {\n\t\tcase 0:\n\t\t\treturn 6;\n\t\tcase 1:\n\t\t\treturn 2;\n\t\tcase 2:\n\t\t\treturn 5;\n\t\tcase 3:\n\t\t\treturn 5;\n\t\tcase 4:\n\t\t\treturn 4;\n\t\tcase 5:\n\t\t\treturn 5;\n\t\tcase 6:\n\t\t\treturn 6;\n\t\tcase 7:\n\t\t\treturn 3;\n\t\tcase 8:\n\t\t\treturn 7;\n\t\tcase 9:\n\t\t\treturn 6;\n\t}\n\treturn 0;\n}\n\nint segments(int n) {\n\treturn n < 10 ? cnt(n) : segments(n / 10) + cnt(n % 10);\n}\n\nint main() {\n\tint n, a, b, sum; \n\n\tscanf(\"%d%d\", &a, &b);\n\tsum = 0;\n\tfor (n = a; n <= b; n++)\n\t\tsum += segments(n);\n\tprintf(\"%d\\n\", sum);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint i,j,s,a,b,n,x,sum=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n n=i;\n \n\t\twhile(n>0)\n\t\t{\n\t\t\tx=n%10;\n n=n/10;\n\t\t\tif(x==0)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\telse if(x==1)\n\t\t{\n\t\t\ts=2;\n\t\t}\n\t\telse if(x==2)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==3)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==4)\n\t\t{\n\t\t\ts=4;\n\t\t}\n\t\telse if(x==5)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==6)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\telse if(x==7)\n\t\t{\n\t\t\ts=3;\n\t\t}\n\t\telse if(x==8)\n\t\t{\n\t\t\ts=7;\n\t\t}\n\t\telse if(x==9)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\tsum=sum+s;\n\t\t\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",sum);\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int sum=0;\n int x,z,y,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n printf(\"%llu\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,i,s,d=0,g,c;\n\tscanf(\"%d %d\", &a , &b);\n for (i=a;i<=b; i++)\n\t{\n\t\tc=i;\n\t\twhile(c!=0)\n\t\t{\n\t\tg=c%10;\n\t\tif (g==0) s=6;\n\t\telse if (g==1) s=2;\n\t\telse if (g==2) s=5;\n\t\telse if (g==3) s=5;\n\t\telse if (g==4) s=4;\n\t\telse if (g==5) s=5;\n \telse if (g==6) s=6;\n \telse if (g==7) s=3;\n \telse if (g==8) s=7;\n \telse if (g==9) s=6;\n \td=d+s;\n \tc=c/10;\n\t\t}\n\t}\n\t\tprintf(\"%d\", d);\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,b,d,i,i1,s=0;\n int n[10]={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n i1=i;\n while(i1!=0)\n {s+=n[i1%10];\n i1/=10;}\n }\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b;\n long long cnt=0;\n scanf(\"%d%d\",&a,&b);\n for(int i=a;i<=b;i++)\n {\n int num=i;\n while(num)\n {\n int rem=num%10;\n if(rem==1)\n cnt+=2;\n else if(rem==2||rem==3||rem==5)\n cnt+=5;\n else if(rem==6||rem==9||rem==0)\n cnt+=6;\n else if(rem==8)\n cnt+=7;\n else if(rem==7)\n cnt+=3;\n else if(rem==4)\n cnt+=4;\n num/=10;\n }\n }\n printf(\"%lld\",cnt);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int a, b, i, intermediate;\nlong int segments = 0 ;\n\nscanf(\"%d %d\",&a,&b);\n\nfor ( i = a; i <= b; i++)\n{\n\n intermediate = i;\n do {\n switch(intermediate % 10)\n {\n case 0: segments += 6; break;\n case 1: segments += 2; break;\n case 2: segments += 5; break;\n case 3: segments += 5; break;\n case 4: segments += 4; break;\n case 5: segments += 5; break;\n case 6: segments += 6; break;\n case 7: segments += 3; break;\n case 8: segments += 7; break;\n case 9: segments += 6; break;\n\n }\n\n intermediate = intermediate / 10;\n\n\n\n\n\n } while (intermediate != 0);\n\n\n}\n\nprintf(\"%ld\",segments);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void){\n\nint y,i,a,b,x,s;\n\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\n\ns=0;\nfor (i=a;i<=b;i++){\ny=i;\nwhile(y!=0){\t\n\tx=(y%10);\n\ty=(y/10);\n\t\n\tswitch (x){\n\t\tcase 0 : s=s+6;\n\t\t break;\n\t\tcase 1 : s=s+2;\n\t\t break;\n\t\tcase 2 : s=s+5;\n\t\t break;\n\t\tcase 3 : s=s+5;\n\t\t break;\n\t\tcase 4 : s=s+4;\n\t\t break;\n\t\tcase 5 : s=s+5;\n\t\t break;\n\t\tcase 6 : s=s+6;\n\t\t break;\n\t\tcase 7 : s=s+3;\n\t\t break;\n\t\tcase 8 : s=s+7;\n\t\t break;\n\t\tcase 9 : s=s+6;\n\t\t break;\n\t}\n\tif (y==0){\n\t\tbreak;\n\t\t}\n}\n}\n\nprintf(\"%d\",s);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint p[]={6,2,5,5,4,5,6,3,7,6};\nint num,sum,a,b,i;\nscanf(\"%d%d\",&a,&b);\nsum=0;\nfor(i=a;i<=b;i++)\n{\na=i;\nwhile(a!=0)\n{\nnum=a%10;\na=a/10;\nsum=sum+p[num];\n}\n}\nprintf(\"%d\\n\",sum);\nreturn 0;\n}\n"}, {"source_code": "\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n//shauwaaa\n\n#include <stdio.h>\nint main(void)\n{\n\n int y,i,a,b,x,s=0;\n\n scanf(\"%d%d\",&a,&b);\n\n for (i=a; i<=b; i++)\n {\n y=i;\n while(y!=0)\n {\n x=(y%10);\n y=(y/10);\n\n switch (x)\n {\n case 0 :\n s=s+6;\n break;\n case 1 :\n s=s+2;\n break;\n case 2 :\n s=s+5;\n break;\n case 3 :\n s=s+5;\n break;\n case 4 :\n s=s+4;\n break;\n case 5 :\n s=s+5;\n break;\n case 6 :\n s=s+6;\n break;\n case 7 :\n s=s+3;\n break;\n case 8 :\n s=s+7;\n break;\n case 9 :\n s=s+6;\n break;\n }\n if (y==0)\n {\n break;\n }\n }\n }\n\n printf(\"%d\",s);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int a, b, i, intermediate;\nlong int segments = 0 ;\n\nscanf(\"%d %d\",&a,&b);\n\nfor ( i = a; i <= b; i++)\n{\n\n intermediate = i;\n do {\n switch(intermediate % 10)\n {\n case 0: segments += 6; break;\n case 1: segments += 2; break;\n case 2: segments += 5; break;\n case 3: segments += 5; break;\n case 4: segments += 4; break;\n case 5: segments += 5; break;\n case 6: segments += 6; break;\n case 7: segments += 3; break;\n case 8: segments += 7; break;\n case 9: segments += 6; break;\n\n }\n\n intermediate = intermediate / 10;\n\n\n\n\n\n } while (intermediate != 0);\n\n\n}\n\nprintf(\"%ld\",segments);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int m;\n int n;\n unsigned long long sum=0;\n int i,j,k;\n int arr[10]={6,2,5,5,4,5,6,3,7,6};\n\n scanf(\"%d %d\",&m,&n);\n\n if(m==0)\n sum+=6;\n for(i=m;i<=n;i++) {\n j = i;\n while(j!=0) {\n k = j%10;\n j/=10;\n sum+=arr[k];\n }\n }\n printf(\"%llu\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int sum=0;\n int x,z,y,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n printf(\"%llu\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n//1\u301cn\u306b\u542b\u307e\u308c\u308bcount\u306e\u500b\u6570\u3092\u6c42\u3081\u308b\nunsigned long long solve(unsigned long long n,int count,int base){\n\tunsigned long long r=0; //\u7d50\u679c\n\tunsigned long long lower=0; //\u51e6\u7406\u3057\u3066\u3044\u308b\u6841\u3088\u308a\u4e0b\u306e\u6841\u306e\u5408\u8a08\n\tunsigned long long digits=0,expbase=1;\n\tfor(;n;digits++,expbase*=base,n/=base){\n\t\tunsigned long long d=digits*expbase/base; //0,1,20,300,4000,...\n\t\tunsigned long long current_digit=n%base;\n\t\tr+=current_digit*d;\n\t\tif(current_digit==count)r+=lower+1;\n\t\tif(current_digit>=count+1)r+=expbase;\n\t\tlower+=current_digit*expbase;\n\t\tif(count==0)r-=expbase;\n\t}\n\treturn r;\n}\n\nint d[]={6,2,5,5,4,5,6,3,7,6};\nint main(){\n\tint base=10;\n\n\tunsigned long long n,m,r=0;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tint i=0;\n\tfor(;i<10;i++)r+=d[i]*(solve(m,i,base)-solve(n-1,i,base));\n\tprintf(\"%I64d\\n\",r);\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\nint i,j,k,a,b,s=0,x,y;\nscanf(\"%d%d\",&a,&b);\nfor(i=a;i<=b;i++)\n{\n x=i;\n while(x!=0)\n {\n y=x%10;\n x=x/10;\n if(y==1)s=s+2;\n if(y==2)s=s+5;\n if(y==3)s=s+5;\n if(y==4)s=s+4;\n if(y==5)s=s+5;\n if(y==6)s=s+6;\n if(y==7)s=s+3;\n if(y==8)s=s+7;\n if(y==9)s=s+6;\n if(y==0)s=s+6;\n }\n\n}\nprintf(\"%d\",s);\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MAX 1000000\n\nint main()\n{\n\tint sym[10]={6, 2, 5, 5, 4, 5, 6, 3, 7, 6}, a, b, d, i;\n\tscanf(\"%d %d\", &a, &b);\n\tif(a<1 || b<1 || a>MAX || b>MAX || a>b) return 0;\n\td=0;\n\tfor(i=a; a<=b; a++){\n\t\ti=a;\n\t\tdo{\n\t\td+=sym[i%10];\n\t\ti/=10;\n\t\t} while(i);\n\t}\n\tprintf(\"%d\", d);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int num[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n int ans, t;\n int a, b;\n\n scanf(\"%d %d\", &a, &b);\n ans = 0;\n for (int i = a;i <= b;i ++) {\n t = i;\n while (t) {\n ans += num[t % 10];\n t /= 10;\n }\n }\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,i,t,c,h,s[10]={0},z;\n scanf(\"%d %d\",&a,&b);\n for(c=a;c<=b;c++)\n {\n z=c;\n while(z)\n {\n t=z%10;\n s[t]++;\n z/=10;\n }\n }\n printf(\"%d\",s[0]*6+s[1]*2+s[2]*5+s[3]*5+s[4]*4+s[5]*5+s[6]*6+s[7]*3+s[8]*7+s[9]*6);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long a,b,num,number;\n\tint sum = 0,total = 0;\n\tint last_dig;\n\n\tscanf(\"%llu %llu\",&a,&b);\n\tfor(number = a; number<= b; number++)\n\t{\n\t\tnum = number;\n\t\twhile(1)\n\t {\n\t\t last_dig = num % 10;\n\n \t\t if(last_dig == 0){\n \t\t\ttotal += 6;\n\t\t }\n\n\t\t else if(last_dig == 1){\n\t\t\ttotal += 2;\n\t\t }\n\n\t\t else if(last_dig == 2){\n\t\t\ttotal += 5;\n\t\t }\n\n\t\t else if(last_dig == 3){\n\t\t\ttotal += 5;\n\t\t }\n\n\t\t else if(last_dig == 4){\n\t\t\ttotal += 4;\n\t\t }\n\n\t\t else if(last_dig == 5){\n\t\t\ttotal += 5;\n\t\t }\n\n\t\t else if(last_dig == 6){\n\t\t\ttotal += 6;\n\t\t }\n\n\t\t else if(last_dig == 7){\n\t\t\ttotal += 3;\n\t\t }\n\n\t\t else if(last_dig == 8){\n\t\t\ttotal += 7;\n\t\t }\n\n\t\t else if(last_dig == 9){\n\t\t\ttotal += 6;\n\t\t }\n\n\t\t num = num/10;\n\t\t if(num==0)\n\t\t\tbreak;\n \t}\n\t}\n\tprintf(\"%d\",total);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int arr[10];\n arr[0] = 6;\n arr[1] = 2;\n arr[2] = 5;\n arr[3] = 5;\n arr[4] = 4;\n arr[5] = 5;\n arr[6] = 6;\n arr[7] = 3;\n arr[8] = 7;\n arr[9] = 6;\n int a, b;\n int i;\n long int sum = 0;\n scanf(\"%d%d\", &a, &b);\n for(i=a; i<=b; i++)\n {\n int n = i;\n while(n)\n {\n sum+=arr[n%10];\n n/=10;\n }\n }\n printf(\"%ld\", sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,b,d,i,i1,s=0;\n int n[10]={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n i1=i;\n while(i1!=0)\n {s+=n[i1%10];\n i1/=10;}\n }\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void){\n\nint y,i,a,b,x,s;\n\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\n\ns=0;\nfor (i=a;i<=b;i++){\ny=i;\nwhile(y!=0){\t\n\tx=(y%10);\n\ty=(y/10);\n\t\n\tswitch (x){\n\t\tcase 0 : s=s+6;\n\t\t break;\n\t\tcase 1 : s=s+2;\n\t\t break;\n\t\tcase 2 : s=s+5;\n\t\t break;\n\t\tcase 3 : s=s+5;\n\t\t break;\n\t\tcase 4 : s=s+4;\n\t\t break;\n\t\tcase 5 : s=s+5;\n\t\t break;\n\t\tcase 6 : s=s+6;\n\t\t break;\n\t\tcase 7 : s=s+3;\n\t\t break;\n\t\tcase 8 : s=s+7;\n\t\t break;\n\t\tcase 9 : s=s+6;\n\t\t break;\n\t}\n\tif (y==0){\n\t\tbreak;\n\t\t}\n}\n}\n\nprintf(\"%d\",s);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[20]={6,2,5,5,4,5,6,3,7,6};\nint ha(int n)\n{\n int m,sum=0;\n while(n)\n {\n m=n%10;\n n=n/10;\n sum+=a[m];\n }\n return(sum);\n}\nint main()\n{int m,n,sum,i;\nscanf(\"%d%d\",&n,&m);\nsum=0;\nfor(i=n;i<=m;i++)\n sum+=ha(i);\n printf(\"%d\\n\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n//\t\t\t 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }\nint CoS[] = { 6, 2, 5, 5, 4 ,5, 6, 3, 7, 6 };\n\n\nint GetCountOfSegment(int a)\n{\n\tint iSum = 0;\n\tint i = 0;\n\tint iLen ;\n\t\n\tchar strA[20];\t\n\tsprintf(strA,\"%d\",a);\n\t\n\tiLen = strlen( strA );\n\t\n\tfor( i = 0 ; i < iLen ; i++ )\n\t{\n\t\tiSum += CoS[ strA[i]-'0' ];\t\n\t}\n\n\treturn iSum;\n}\n\nint main()\n{\n\n\tint a,b;\n\tint iSum = 0;\n\tint i;\n\n\tscanf(\"%d%d\", &a, &b );\n\t\n\t\n\tfor( i = a ; i <= b ; i++ )\n\t{\n\t\tiSum += GetCountOfSegment( i );\t\t\n\t}\n\t\n\tprintf(\"%d\",iSum);\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint a[10]={6,2,5,5,4,5,6,3,7,6},x,y,i,sum,tmp;\nint main(){\n scanf(\"%d %d\",&x,&y);\n for (i=x; i<=y;i++){\n tmp=i;\n while(tmp){\n sum+=a[tmp%10];\n tmp/=10;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint yes(int *t,int n)\n{\n\tif(n>=10)\n\treturn t[n%10]+yes(t,n/10);\n\telse return t[n];\n}\n\nint main(){\n\tint sig[]={6,2,5,5,4,5,6,3,7,6};\n\tint a,b,i,s=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t\ts=s+yes(sig,i);\n\t\tprintf(\"%d\",s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m,n,i,j,x,c=0;\n scanf(\"%d %d\",&m,&n);\n for(i=m;i<=n;i++){\n j=i;\n while(j>0){\n x=j%10;\n j=j/10;\n switch(x){\n case 0:\n case 6:\n case 9:\n c=c+6;\n break;\n case 1:\n c=c+2;\n break;\n case 2:\n case 3:\n case 5:\n c=c+5;\n break;\n case 4:\n c=c+4;\n break;\n case 7:\n c=c+3;\n break;\n case 8:\n c=c+7;\n break;\n\n\n }\n\n\n\n\n }\n }\n printf(\"%d\",c);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint arr[10]={6,2,5,5,4,5,6,3,7,6},t;\nint hesapla(int x){\n\tif(x>=10){\n\t\tt+=arr[x%10];\n\t\tx/=10;\n\t\treturn hesapla(x);}\n\telse\n\t\treturn arr[x]+t;}\nmain(){\n\tint i,z=0,a,b;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++){\n\t\tz+=hesapla(i);\n\t\tt=0;\n\t}\n\tprintf(\"%d\",z);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main()\n{\n uint32_t a, b, i;\n int64_t summ = 0;\n\n scanf(\"%d %d\", &a, &b);\n\n for (;a<=b;a++)\n {\n for (i=a; i>0; i=i/10)\n {\n if (i%10==1)\n summ+=2;\n if (i%10==7)\n summ+=3;\n if (i%10==4)\n summ+=4;\n if (i%10==2||i%10==3||i%10==5)\n summ+=5;\n if (i%10==0||i%10==6||i%10==9)\n summ+=6;\n if (i%10==8)\n summ+=7;\n }\n }\n\n printf(\"%d\", summ);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n\n#define PI 3.141592653589793\n#define max(a,b) (a < b) ? (b) : (a)\n#define min(a,b) (a > b) ? (b) : (a)\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) ((x)*PI)/180\n#define y1 y_1\n#define ll long long\n#define endl printf(\"\\n\")\n#define MAX 100005\n\nint a, b, i, x, ans, t[10] = {6, 2, 5, 5 ,4, 5 ,6, 3, 7, 6};\n\nint main () {\n\tscanf(\"%d %d\",&a ,&b);\n\tFOR(i, a, b){\n\t\tx = i;\n\t\twhile(x){\n\t\t\tans += t[x%10];\n\t\t\tx/=10;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a,b,total=0;\n int segments[]={6,2,5,5,4,5,6,3,7,6};\n int j;\n scanf(\"%d%d\",&a,&b);\n \n for (int i=a; i<=b; i++) {\n a=i;\n while (a>=10) {\n j=a%10;\n a=a/10;\n total+=segments[j];\n }\n total+=segments[a];\n }\n printf(\"%d\",total);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <time.h>\n#define SIZE 1000002\n\nlong min(long a, long b)\n{\n return (a < b) ? a : b;\n}\n\nlong max(long a, long b)\n{\n return (a < b) ? b : a;\n}\n\nlong sum(int seg[], long x)\n{\n long k = 0;\n while (x > 0)\n {\n k += seg[x % 10];\n x /= 10;\n }\n return k;\n}\n/*****************************************************************************/\nint main(void)\n{\n long m, n, k, i;\n int seg[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n scanf(\"%ld %ld\", &m, &n);\n k = 0;\n for (i = m; i <= n; ++i)\n {\n k += sum(seg, i);\n }\n printf(\"%ld\\n\", k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint yes(int *t,int n)\n{\n\tif(n>=10)\n\treturn t[n%10]+yes(t,n/10);\n\telse return t[n];\n}\n\nint main(){\n\tint sig[]={6,2,5,5,4,5,6,3,7,6};\n\tint a,b,i,s=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t\ts=s+yes(sig,i);\n\t\tprintf(\"%d\",s);\n\treturn 0;\n}"}, {"source_code": "r,n;main(a,b){for(scanf(\"%d%d\",&a,&b);b/a;)for(n=a++;n;n/=10)r+=\"6255456376\"[n%10]^48;printf(\"%d\",r);}"}, {"source_code": "#include <stdio.h>\nint main(void){\n\nint y,i,a,b,x,s;\n\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\n\ns=0;\nfor (i=a;i<=b;i++){\ny=i;\nwhile(y!=0){\t\n\tx=(y%10);\n\ty=(y/10);\n\t\n\tswitch (x){\n\t\tcase 0 : s=s+6;\n\t\t break;\n\t\tcase 1 : s=s+2;\n\t\t break;\n\t\tcase 2 : s=s+5;\n\t\t break;\n\t\tcase 3 : s=s+5;\n\t\t break;\n\t\tcase 4 : s=s+4;\n\t\t break;\n\t\tcase 5 : s=s+5;\n\t\t break;\n\t\tcase 6 : s=s+6;\n\t\t break;\n\t\tcase 7 : s=s+3;\n\t\t break;\n\t\tcase 8 : s=s+7;\n\t\t break;\n\t\tcase 9 : s=s+6;\n\t\t break;\n\t}\n\tif (y==0){\n\t\tbreak;\n\t\t}\n}\n}\n\nprintf(\"%d\",s);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h> \n#include <stdlib.h>\n#include <string.h>\n\nint main ()\n{\n\tint a,b,n=0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor ( ;a<=b;a++)\n\t{\n\t\tint i=a;\n\t\tint t=1;\n\t\twhile (i)\n\t\t{\n\t\t\tt = i % 10;\n\t\t\tswitch (t)\n\t\t\t{\n\t\t\tcase 0:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tn+=2;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tn+=4;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tn+=3;\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tn+=7;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//printf (\"%d\\n\",t);\n\t\t\ti /=10;\n\t\t}\n\t}\n\tprintf (\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint i,j,s,a,b,n,x,sum=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n n=i;\n \n\t\twhile(n>0)\n\t\t{\n\t\t\tx=n%10;\n n=n/10;\n\t\t\tif(x==0)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\telse if(x==1)\n\t\t{\n\t\t\ts=2;\n\t\t}\n\t\telse if(x==2)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==3)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==4)\n\t\t{\n\t\t\ts=4;\n\t\t}\n\t\telse if(x==5)\n\t\t{\n\t\t\ts=5;\n\t\t}\n\t\telse if(x==6)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\telse if(x==7)\n\t\t{\n\t\t\ts=3;\n\t\t}\n\t\telse if(x==8)\n\t\t{\n\t\t\ts=7;\n\t\t}\n\t\telse if(x==9)\n\t\t{\n\t\t\ts=6;\n\t\t}\n\t\tsum=sum+s;\n\t\t\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\",sum);\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,segment=0,digit;\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n { a=i;\n while(a!=0)\n {\n digit=a%10;\n if(digit==0) segment+=6;\n if(digit==1) segment+=2;\n if(digit==2) segment+=5;\n if(digit==3) segment+=5;\n if(digit==4) segment+=4;\n if(digit==5) segment+=5;\n if(digit==6) segment+=6;\n if(digit==7) segment+=3;\n if(digit==8) segment+=7;\n if(digit==9) segment+=6;\n a=a/10;\n }\n }\n printf(\"%d\",segment);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h> \n#include <stdlib.h>\n#include <string.h>\n\nint main ()\n{\n\tint a,b,n=0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor ( ;a<=b;a++)\n\t{\n\t\tint i=a;\n\t\tint t=1;\n\t\twhile (i)\n\t\t{\n\t\t\tt = i % 10;\n\t\t\tswitch (t)\n\t\t\t{\n\t\t\tcase 0:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tn+=2;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tn+=4;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tn+=3;\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tn+=7;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//printf (\"%d\\n\",t);\n\t\t\ti /=10;\n\t\t}\n\t}\n\tprintf (\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint a, b, k, m, num = 0;\n\t\n\tscanf(\"%d %d\", &a, &b);\n\tfor(; a <= b; a++)\n\t{\n\t\tm = a;\n\t\tfor(; m != 0;)\n\t\t{\n\t\t\tk = m % 10;\n\t\t\tswitch(k)\n\t\t\t{\n\t\t\t\tcase 0 : num += 6; break;\n\t\t\t\tcase 1 : num += 2; break;\n\t\t\t\tcase 2 : num += 5; break;\n\t\t\t\tcase 3 : num += 5; break;\n\t\t\t\tcase 4 : num += 4; break;\n\t\t\t\tcase 5 : num += 5; break;\n\t\t\t\tcase 6 : num += 6; break;\n\t\t\t\tcase 7 : num += 3; break;\n\t\t\t\tcase 8 : num += 7; break;\n\t\t\t\tcase 9 : num += 6; break;\n\t\t\t}\n\t\t\tm /= 10;\n\t\t}\n\t}\n\tprintf(\"%d\", num);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,arr[10],ans,temp;\n scanf(\"%d %d\",&a,&b);\n for(i=0;i<=9;i++) {\n arr[i]=0;\n }\n\n for(i=a;i<=b;i++) {\n temp=i;\n while(temp>9) {\n arr[temp%10]++;\n temp=temp/10;\n }\n arr[temp]++;\n }\n ans=arr[0]*6+arr[1]*2+arr[2]*5+arr[3]*5+arr[4]*4+arr[5]*5+arr[6]*6+arr[7]*3+arr[8]*7+arr[9]*6;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n long long int test,n,i,j,sum1,k,m,a,flag=0,count=0,b,c[10]={6,2,5,5,4,5,6,3,7,6},a1,b2;\n scanf(\"%lld%lld\",&a,&b);\n count=0;\n for(i=a;i<=b;i++){\n k=i;\n while(k>0){\n count+=c[k%10];\n k/=10;\n }\n }\n printf(\"%lld\",count);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main()\n{\n uint32_t a, b, i;\n int64_t summ = 0;\n\n scanf(\"%d %d\", &a, &b);\n\n for (;a<=b;a++)\n {\n for (i=a; i>0; i=i/10)\n {\n if (i%10==1)\n summ+=2;\n if (i%10==7)\n summ+=3;\n if (i%10==4)\n summ+=4;\n if (i%10==2||i%10==3||i%10==5)\n summ+=5;\n if (i%10==0||i%10==6||i%10==9)\n summ+=6;\n if (i%10==8)\n summ+=7;\n }\n }\n\n printf(\"%d\", summ);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main( )\n{\nint a,b,d[10],i,c,u,v,h,m;\nscanf(\"%d %d\",&a,&b);\nfor(i=0;i<10;i++)\n{\nd[i]=0;\n}\nfor(i=a;i<=b;i++)\n{\nm=i;\nwhile(m>0)\n{\nc=m%10;\nd[c]++;\nm=m/10;\n}\n}\nv=d[2]+d[3]+d[5];\nu=d[6]+d[9]+d[0];\nh=(v*5)+(u*6)+(d[1]*2)+(d[4]*4)+(d[7]*3)+(d[8]*7);\nprintf(\"%d\\n\",h);\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, sum=0, s;\n scanf(\"%d%d\",&a,&b);\n for (int i=a; i<=b; i++)\n for (int j=i; j!=0; j/=10){\n s=j%10;\n switch (s){\n case 0 :\n case 6 :\n case 9 : sum+=6; break;\n case 1 : sum+=2; break;\n case 2 :\n case 3 :\n case 5 : sum+=5; break;\n case 4 : sum+=4; break;\n case 7 : sum+=3; break;\n case 8 : sum+=7; break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<process.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\t\n\tint a, b,k,j,sum=0;\n\tscanf(\"%d%d\", &a, &b);\n\tfor (int i = a; i < b + 1; i++){\n\t\tj = i;\n\t\twhile (j != 0){\n\t\t\tk=j % 10;\n\t\t\tj=j / 10;\n\t\t\tswitch (k){\n\t\t\tcase 1:sum += 2; break;\n\t\t\tcase 2:sum += 5; break;\n\t\t\tcase 3:sum += 5; break;\n\t\t\tcase 4:sum += 4; break;\n\t\t\tcase 5:sum += 5; break;\n\t\t\tcase 6:sum += 6; break;\n\t\t\tcase 7:sum += 3; break;\n\t\t\tcase 8:sum += 7; break;\n\t\t\tcase 9:sum += 6; break;\n\t\t\tcase 0:sum += 6; break;\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\", sum);\n\t\n\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]= {0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0; i<10; i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=100000-1; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>1000000)\n {\n temp[i-1]=num[i/100000]+num[(i/100000-i/10000)%10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n //printf(\"%d\\n\",end);\n }\n end++;\n printf(\"%d %d\\n\",first,end);\n long long int ans=sum[end]-sum[first];\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]= {0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0; i<10; i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=10000; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n //printf(\"%d\\n\",end);\n }\n end++;\n // printf(\"%d %d\\n\",first,end);\n int ans=sum[end]-sum[first];\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]= {0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0; i<10; i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=100000-1; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10];\n }\n else if(i>1000000)\n {\n temp[i-1]=num[i/100000]+num[(i/100000-i/10000)%10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n //printf(\"%d\\n\",end);\n }\n end++;\n printf(\"%d %d\\n\",first,end);\n long long int ans=sum[end]-sum[first];\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]= {0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0; i<10; i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=100000-1; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i==1000000)\n {\n temp[i-1]=num[i/100000]+num[(i/100000-i/10000)%10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n //printf(\"%d\\n\",end);\n }\n end++;\n printf(\"%d %d\\n\",first,end);\n int ans=sum[end]-sum[first];\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]= {0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0; i<10; i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=100000-1; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i==1000000)\n {\n temp[i-1]=num[i/100000]+num[(i/100000-i/10000)%10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n //printf(\"%d\\n\",end);\n }\n end++;\n // printf(\"%d %d\\n\",first,end);\n int ans=sum[end]-sum[first];\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int num[10]= {6,2,5,5,4,5,6,3,7,6};\n int temp[100000]={0};\n int first,end;\n scanf(\"%d %d\",&first,&end);\n int sum[100000]= {0};\n int i,j;\n for(i=0;i<10;i++)\n {\n temp[i]=num[i];\n }\n for(i=1; i<=100000; i++)\n {\n if(i>10&&i<100)\n {\n temp[i-1]=num[i%10-1]+num[i/10];\n }\n else if(i>=100&&i<1000)\n {\n temp[i-1]=num[i/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=1000&&i<10000)\n {\n temp[i-1]=num[i/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n else if(i>=10000&&i<100000)\n {\n temp[i-1]=num[i/10000]+num[(i%10000-i%1000)/1000]+num[(i%1000-i%100)/100]+num[(i%100-i%10)/10]+num[i%10-1];\n }\n sum[i]+=temp[i-1];\n sum[i]+=sum[i-1];\n }\n end=end+1;\n int ans=sum[end]-sum[first];\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int sum=0;\nvoid func(long int c)\n{\n if(c==0)\n\t sum+=6;\n else if(c==1)\n\t sum+=2;\n else if(c==2)\n\t sum+=5;\n else if(c==3)\n\t sum+=5;\n else if(c==4)\n\t sum+=4;\n else if(c==5)\n\t sum+=5;\n else if(c==6)\n\t sum+6;\n else if(c==7)\n\t sum+=3;\n else if(c==8)\n\t sum+=7;\n else\n\t sum+=6;\n}\nint main()\n{\n\tlong int a,b,i,j;\n\tscanf(\"%ld %ld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tj=i;\n\t\twhile(j>0)\n\t\t{\n\t\t\tfunc(j%10);\n\t\t\tj=j/10;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int sum=0;\nvoid func(long int c)\n{\n if(c==0)\n\t sum+=6;\n else if(c==1)\n\t sum+=2;\n else if(c==2)\n\t sum+=5;\n else if(c==3)\n\t sum+=5;\n else if(c==4)\n\t sum+=4;\n else if(c==5)\n\t sum+=5;\n else if(c==6)\n\t sum+6;\n else if(c==7)\n\t sum+=3;\n else if(c==8)\n\t sum+=7;\n else\n\t sum+=6;\n}\nint main()\n{\n\tlong int a,b,i,j;\n\tsum=0;\n\tscanf(\"%ld %ld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tj=i;\n\t\twhile(j!=0)\n\t\t{\n\t\t\tfunc(j%10);\n\t\t\tj=j/10;\n//\t\t\tprintf(\"%lld\\n\",sum);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int sum=0;\nvoid func(long int c)\n{\n if(c==0)\n\t sum+=6;\n else if(c==1)\n\t sum+=2;\n else if(c==2)\n\t sum+=5;\n else if(c==3)\n\t sum+=5;\n else if(c==4)\n\t sum+=4;\n else if(c==5)\n\t sum+=5;\n else if(c==6)\n\t sum+6;\n else if(c==7)\n\t sum+=3;\n else if(c==8)\n\t sum+=7;\n else\n\t sum+=6;\n}\nint main()\n{\n\tlong int a,b,i,j;\n\tscanf(\"%ld %ld\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tj=i;\n\t\twhile(j!=0)\n\t\t{\n\t\t\tfunc(j%10);\n\t\t\tj=j/10;\n//\t\t\tprintf(\"%lld\\n\",sum);\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int sum=0;\n int x,z,y,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n if(x>=9)\n {\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n }\n else\n {\n if(0>=x&&0<=y)\n sum=sum+6;\n if(1>=x&&1<=y)\n sum=sum+2;\n if(2>=x&&2<=y)\n sum=sum+5;\n if(3>=x&&3<=y)\n sum=sum+5;\n if(4>=x&&4<=y)\n sum=sum+4;\n if(5>=x&&5<=y)\n sum=sum+5;\n if(6>=x&&6<=y)\n sum=sum+6;\n if(7>=x&&7<=y)\n sum=sum+3;\n if(8>=x&&8<=y)\n sum=sum+7;\n if(9>=x&&9<=y)\n sum=sum+6;\n }\n printf(\"%llu\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,i,j,p,k=0,c;\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n for(c=i;c%10!=0||c/10!=0;c=c/10)\n {\n j=c%10;\n if(j==0)\n {\n p=6;\n k=k+p;\n }\n else if(j==1)\n {\n p=2;\n k=k+p;\n }\n else if(j==2)\n {\n p=5;\n k=k+p;\n }\n else if(j==3)\n {\n p=5;\n k=k+p;\n }\n else if(j==4)\n {\n p=4;\n k=k+p;\n }\n else if(j==5)\n {\n p=5;\n k=k+p;\n }\n else if(j==6)\n {\n p=6;\n k=k+p;\n }\n else if(j==7)\n {\n p=3;\n k=k+p;\n }\n else if(j==8)\n {\n p=7;\n k=k+p;\n }\n else if(j==9)\n {\n p=6;\n k=k+p;\n }\n }\n }\n printf(\"%d\",&k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n int a,b,i,j=0;\n int ara[10]={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n j=j+ara[i];\n }\n printf(\"%d\",j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[] = {6,2,5,5,4,5,6,3,7,6};\nint s(int n)\n{\nint r = 0;\nwhile(n){r+= a[n%10];n/=10;}\nreturn r;\n}\nint main()\n{\nint ans = 0;\nint n,m;\nscanf(\"%d%d\",&n,&m);\nint x;\nfor(x=n;x<=n;x++)\nans+= s(x);\nprintf(\"%d\\n\",ans);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[] = {6,2,5,5,4,5,6,3,7,6};\nint s(int n)\n{\nint r = 0;\nwhile(n)r+= a[n/10],n/=10;\nreturn r;\n}\nint main()\n{\nint ans = 0;\nint n,m;\nscanf(\"%d%d\",&n,&m);\nint x;\nfor(x=n;x<=n;x++)\nans+= s(x);\nprintf(\"%d\\n\",ans);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(int argc, char* argv[])\n{\n\tint a[10] = { 0,1,2,3,4,5,6,7,8,9 };\n\tint b[10] = { 6,2,5,5,4,5,6,3,7,6 };\n\tint s = 0;\n\tfor (int i = 0, n = strlen(argv[1]);\n\t\ti < n; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == argv[1][i])\n\t\t\t{\n\t\t\t\ts += b[j];\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0, n = strlen(argv[2]);\n\t\ti < n; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == argv[2][i])\n\t\t\t{\n\t\t\t\ts += 2 * b[j];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[10];\n\tfor (int i = 0; i < 10; i++)\n\t{\n\t\ta[i] = i + '0';\n\t}\n\tint b[10] = { 6,2,5,5,4,5,6,3,7,6 };\n\n\tchar str[2][7];\n\tint s = 0;\n\n\tscanf(\"%s \", str[0]);\n\tscanf(\"%s\", str[1]);\n\n\tfor (int i = 0;\n\t\tstr[0][i] >= '0' && str[0][i] <= '9'; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == str[0][i])\n\t\t\t{\n\t\t\t\ts += b[j];\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0;\n\t\tstr[1][i] >= '0' && str[1][i] <= '9'; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == str[1][i])\n\t\t\t{\n\t\t\t\ts += (2 * b[j]);\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", s);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n\tchar a[10];\n\tfor (int i = 0; i < 10; i++)\n\t{\n\t\ta[i] = i + '0';\n\t}\n\tint b[10] = { 6,2,5,5,4,5,6,3,7,6 };\n\n\tchar str[2][7];\n\tint s = 0;\n\n\tscanf(\"%s \", str[0]);\n\tscanf(\"%s\", str[1]);\n\n\tfor (int i = 0;\n\t\tstr[0][i] >= '0' && str[0][i] <= '9'; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == str[0][i])\n\t\t\t{\n\t\t\t\ts += b[j];\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0;\n\t\tstr[1][i] >= '0' && str[1][i] <= '9'; i++)\n\t{\n\t\tfor (int j = 0; j < 10; j++)\n\t\t{\n\t\t\tif (a[j] == str[1][i])\n\t\t\t{\n\t\t\t\ts += 2 * b[j];\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", s);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n\n#define PI 3.141592653589793\n#define max(a,b) (a < b) ? (b) : (a)\n#define min(a,b) (a > b) ? (b) : (a)\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) ((x)*PI)/180\n#define y1 y_1\n#define ll long long\n#define endl printf(\"\\n\")\n#define MAX 100005\n\nint a, b, i, x, ans, t[10] = {6, 2, 5, 5 ,4, 5 ,6, 3, 8, 6};\n\nint main () {\n\tscanf(\"%d %d\",&a ,&b);\n\tFOR(i, a, b){\n\t\tx = i;\n\t\twhile(x){\n\t\t\tans += t[x%10];\n\t\t\tx/=10;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n//\t\t\t 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }\nint CoS[] = { 6, 2, 5, 5, 4 ,5, 6, 3, 7, 6 };\n\n\nint GetCountOfSegment(int a)\n{\n\tint iSum = 0;\n\tint i = 0;\n\tint iLen ;\n\t\n\tchar strA[20];\t\n\tsprintf(strA,\"%d\",a);\n\t\n\tiLen = strlen( strA );\n\t\n\tfor( i = 0 ; i < iLen ; i++ )\n\t{\n\t\tiSum += CoS[ strA[i]-'0' ];\t\n\t}\n\t\n\tprintf(\"%d(%s) : %d\\n\", a, strA , iSum);\n\n\treturn iSum;\n}\n\nint main()\n{\n\n\tint a,b;\n\tint iSum = 0;\n\tint i;\n\n\tscanf(\"%d%d\", &a, &b );\n\t\n\t\n\tfor( i = a ; i <= b ; i++ )\n\t{\n\t\tiSum += GetCountOfSegment( i );\n\t\t\n\t\tprintf(\"%d : %d \\n\\n\", i, iSum);\n\t\t\n\t}\n\t\n\tprintf(\"%d\",iSum);\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n//\t\t\t 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }\nint CoS[] = { 6, 2, 5, 5, 4 ,5, 6, 4, 7, 6 };\n\n\nint GetCountOfSegment(int a)\n{\n\tint iSum = 0;\n\tint i = 0;\n\tint iLen ;\n\t\n\tchar strA[20];\t\n\tsprintf(strA,\"%d\",a);\n\t\n\tiLen = strlen( strA );\n\t\n\tfor( i = 0 ; i < iLen ; i++ )\n\t{\n\t\tiSum += CoS[ strA[i]-'0' ];\t\n\t}\n\n\treturn iSum;\n}\n\nint main()\n{\n\n\tint a,b;\n\tint iSum = 0;\n\tint i;\n\n\tscanf(\"%d%d\", &a, &b );\n\t\n\t\n\tfor( i = a ; i <= b ; i++ )\n\t{\n\t\tiSum += GetCountOfSegment( i );\n\t}\n\t\n\tprintf(\"%d\",iSum);\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint number(int a)\n{\n\tint i,num=0;\n\tdo \n\t{\n\t\ti=a%10;\n\t\tswitch(i)\n\t\t{\n\t \t\tcase 0:num+=6;break;\n\t \t case 1:num+=2;break;\n\t \t case 2:num+=5;break;\n\t \t case 3:num+=5;break;\n\t \tcase 4:num+=4;break;\n \t\tcase 5:num+=5;break;\n\t \tcase 6:num+=6;break;\n \t\tcase 7:num+=3;break;\n \t\tcase 8:num+=7;break;\n \t\tcase 9:num+=6;break;\n\t\t}\n\t\ta/=10;\n\t}\n\twhile(a/10!=0);\n\treturn num;\n}\nint main()\n{\n\tint a,b,i,num=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;++i)\n\t{\n\t\tnum+=number(i);\n\t}\n\tprintf(\"%d\",num);\n\treturn 0;\n}"}, {"source_code": "#include\t<stdio.h>\n#include\t<stdlib.h>\n \n\n#define debug(name, arg) printf(\"debug(%s%d) \\n\", name, arg)\n\nint solution(int arg, int arg1) {\n\tint ret = 0;\n\tint i;\n\tint rem;\n\tint number;\n\n\tfor(i = arg; i <= arg1; ++i) {\n\t\tnumber = i;\n\t\twhile(number) {\n\t\t\trem = number % 10;\n\n\t\t\tswitch(rem) {\n\t\t\t\tcase 0 : ret += 6; break;\n\t\t\t\tcase 1 : ret += 2; break;\n\t\t\t\tcase 2 : ret += 5; break;\n\t\t\t\tcase 3 : ret += 5; break;\n\t\t\t\tcase 4 : ret += 4; break;\n\t\t\t\tcase 5 : ret += 5; break;\n\t\t\t\tcase 6 : ret += 6; break;\n\t\t\t\tcase 7 : ret += 3; break;\n\t\t\t\tcase 8 : ret += 7; break;\n\t\t\t\tcase 9 : ret += 9; break;\n\t\t\t}\n\n\t\t\tnumber = number / 10;\n\t\t}\n\t}\n\n\treturn ret;\n}\n\nint main()\n{\n\tint a, b;\n\tint sol;\n\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\n\t//debug(\"a = \",a);\n\t//debug(\"b = \",b);\n\n\tsol = solution(a, b);\n\tprintf(\"%d \\n\", sol);\n\t//debug(\"sol = \", sol);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint F(int n){\n\tswitch(n){\n\t\tcase 0:\n\t\t\treturn 6;\n\t\tcase 1:\n\t\t\treturn 2;\n\t\tcase 2:\n\t\t\treturn 5;\n\t\tcase 3:\n\t\t\treturn 5;\n\t\tcase 4:\n\t\t\treturn 4;\n\t\tcase 5:\n\t\t\treturn 5;\n\t\tcase 6:\n\t\t\treturn 6;\n\t\tcase 7:\n\t\t\treturn 3;\n\t\tcase 8:\n\t\t\treturn 7;\n\t\tcase 9:\n\t\t\treturn 6;\n\t}\n}\nint main(){\n\tint a,b,n,m,sum = 0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor(int i = a; i <= b; i++){\n\t\tif(i<10){\n\t\t\tsum += F(i);\n\t\t}\n\t\telse{\n\t\t\tsum += F(i/10);\n\t\t\tsum += F(i%10);\n\t\t}\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h> \n#include <stdlib.h>\n#include <string.h>\n\nint x[1000];\n\nint main()\n{\n\tmemset(x,0,sizeof(x));\n\tint a,b,n=0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor ( int i=a;i<=b;i++)\n\t{\n\t\tfor ( int j=0;j<=6;j++ )\n\t\t{\n\t\t\tx[j] = (i % (int)pow(10,j+1))/ (int)pow(10,j);\n\t\t}\n\t\tfor ( int j=0;j<=6;j++ )\n\t\t{ \n\t\t\tif ( x[j] == 0 && (x[j+1] !=0 || x[j+2] !=0 || x[j+3] !=0 || x[j+4] !=0 || x[j+5] !=0 || x[j+6] !=0))\n\t\t\tn+=6;\n\t\t\telse\n\t\t\t{\n\t\tswitch (x[j])\n\t\t{\n\t\t\tcase 1:\n\t\t\t\tn+=2;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tn+=4;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tn+=5;\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tn+=3;\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\t\tn+=7;\n\t\t\t\tbreak;\n\t\t\tcase 9:\n\t\t\t\tn+=6;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//printf(\"%d %d\\n\",x[j],n);\n\t}\n\n\t}\n\tprintf (\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint a,b,c,ans=0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor(;a<=b;a++){\n\t\tc=a;\n\t\tfor(;c!=0;c=c/10){\n\t\t\tswitch(c%10){\n\t\t\t\tcase 0:ans=ans+6;break;\n\t\t\t\tcase 1:ans=ans+2;break;\n\t\t\t\tcase 2:ans=ans+5;break;\n\t\t\t\tcase 3:ans=ans+5;break;\n\t\t\t\tcase 4:ans=ans+4;break;\n\t\t\t\tcase 5:ans=ans+5;break;\n\t\t\t\tcase 6:ans=ans+6;break;\n\t\t\t\tcase 7:ans=ans+3;break;\n\t\t\t\tcase 8:ans=ans+8;break;\n\t\t\t\tcase 9:ans=ans+6;break;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint a,b,c;\n\tlong long int ans=0;\n\tscanf(\"%d %d\",&a,&b);\n\tfor(;a<=b;a++){\n\t\tc=a;\n\t\tfor(;c!=0;c=c/10){\n\t\t\tswitch(c%10){\n\t\t\t\tcase 0:ans=ans+6;break;\n\t\t\t\tcase 1:ans=ans+2;break;\n\t\t\t\tcase 2:ans=ans+5;break;\n\t\t\t\tcase 3:ans=ans+5;break;\n\t\t\t\tcase 4:ans=ans+4;break;\n\t\t\t\tcase 5:ans=ans+5;break;\n\t\t\t\tcase 6:ans=ans+6;break;\n\t\t\t\tcase 7:ans=ans+3;break;\n\t\t\t\tcase 8:ans=ans+8;break;\n\t\t\t\tcase 9:ans=ans+6;break;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n}"}, {"source_code": "#include <stdio.h>\n\n#define MAX 1000000\n\nint main()\n{\n\tint a, b, d, i, sym[10]={6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n\tscanf(\"%d %d\", &a, &b);\n\tif(a<1 || b<1 || a>MAX || b>MAX || a>=b) return 0;\n\td=0;\n\tfor(i=a; a<=b; a++){\n\t\ti=a;\n\t\tdo{\n\t\td+=sym[(i%10)];\n\t\ti/=10;\n\t\t} while(i);\n\t}\n\tprintf(\"%d\", d);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint count(int n)\n{\n int c=0;\n while(n != 0)\n {\n n /= 10;\n ++c;\n }\n\n return c;\n}\n\nint digit(int num,int n)\n{ int p, t1, t2;\n\n t1 = pow(10, n+1);\n p = num % t1;\n\n if (n > 0)\n {\n t2 = pow(10, n);\n p = p / t2;\n }\n\n return p;\n\n}\nint main()\n{\n\n int x,y,n,i,j,d,z=0;\n\n scanf(\"%d %d\",&x,&y);\n int hey[10]={6,2,5,5,4,5,6,3,7,6};\n for(i=x;i<=y;i++){\n n=count(i);\n for(j=0;j<n;j++){\n d=digit(i,j);\n z=z+hey[d];\n\n }\n }\n printf(\"%d\\n\",z);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint arr[10]={6,2,5,5,4,5,6,3,7,6};\n\tint a,b,sum=0,i;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tsum+=arr[i];\n\t}\n\tprintf(\"%d\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint arr[10]={6,2,5,5,4,5,6,3,7,6};\n\tint a,b,sum=0,i,rem,temp;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\ttemp=i;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\trem=temp%10;\n\t\t\tsum+=arr[rem];\n\t\t\tprintf(\"%d \",sum);\n\t\t\ttemp=temp/10;\n\t\t}\n\t}\n\tprintf(\"%d\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint svSeg[10]={6,2,5,5,4,5,6,3,7,6};\n\n\tint firNum=0,lastNum=0;\n\n\tint sum=0;\n\tscanf(\"%d%d\",&firNum,&lastNum);\n\tfor(int i=firNum ; i <= lastNum ; i++){\n\n\t\tint iCal=i;\n\n\t\tif( iCal/1000000 != 0)\n\t\tsum = sum + svSeg[iCal/1000000];\n\t\tiCal = iCal % 1000000;\t\t\t\n\n\t\tif( iCal/100000 != 0)\n\t\tsum = sum + svSeg[iCal/100000];\n\t\tiCal = iCal % 100000;\n\n\t\tif( iCal/10000 != 0)\n\t\tsum = sum + svSeg[iCal/10000];\n\t\tiCal = iCal % 10000;\n\n\t\tif( iCal/1000 != 0)\n\t\tsum = sum + svSeg[iCal/1000];\n\t\tiCal = iCal % 1000;\n\n\t\tif( iCal/100 != 0)\n\t\tsum = sum + svSeg[iCal/100];\n\t\tiCal = iCal % 100;\n\n\t\tif( iCal/10 != 0)\n\t\tsum = sum + svSeg[iCal/10];\n\t\tiCal = iCal % 10;\n\n\t\tsum = sum + svSeg[iCal];\n\t}\n\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint seg(int k)\n {int r;\n if(k==0) r=6;\n if(k==1) r=2;\n if(k==2) r=5;\n if(k==3) r=5;\n if(k==4) r=4;\n if(k==5) r=5;\n if(k==6) r=6;\n if(k==7) r=3;\n if(k==8) r=7;\n if(k==9) r=6;\n return r;\n \n }\nint seg_a(int l)\n {int s=0;\n if (l/1000000!=0) s+=seg(l/1000000);\n if (l/100000!=0) s+=seg(l/100000);\n if (l/10000!=0) s+=seg(l/10000);\n if (l/1000!=0) s+=seg(l/1000);\n if (l/100!=0) s+=seg(l/100);\n if (l/10!=0) s+=seg(l/10);\n s+=seg(l%10);\n return(s);\n }\nint main()\n{ int res,a,b;\n scanf(\"%d %d\",&a,&b);\n res=0;\n do\n {\n res+=seg_a(a);\n a++;\n }while(a<=b);\n \n printf(\"%d\",res);\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint yes(int *t,int n)\n{\n\tif(n>=10)\n\treturn t[n%10]+yes(t,n/10);\n\telse return t[n];\n}\n\nint main(){\n\tint sig[]={4,2,5,5,4,5,6,3,7,6};\n\tint a,b,i,s=0;\n\tscanf(\"%d%d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t\ts=s+yes(sig,i);\n\t\tprintf(\"%d\",s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n\n unsigned long long counts[10];\n for (int i = a; i <= b; i++) {\n int x = i;\n while (x != 0) {\n counts[x % 10]++;\n x /= 10;\n }\n }\n\n int digits[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n unsigned long long ans = 0;\n for (int i = 0; i < 10; i++) {\n ans += (unsigned long long)(counts[i] * digits[i]);\n }\n printf(\"%lld\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};\n int i,j,n1,n2,n=0,t;\n scanf(\"%d%d\",&n1,&n2);\n for(i=n1; i<=n2; i++)\n {\n t = i;\n for(j=0; j<6; j++)\n {\n if(t>0)\n {\n //printf(\"go to hell\");\n n += a[t%10];\n t /= 10;\n }\n }\n }\n printf(\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n//==============================================================================\n\n//==============================================================================\nFILE *pfin;\n\n#ifdef CODEBLOCKS\n #define SELECT_INPUT pfin = fopen(\"in.txt\", \"r\");\n#else\n #define SELECT_INPUT pfin = stdin;\n#endif\n\nvoid test();\n//==============================================================================\n\n//==============================================================================\nint main()\n{\n SELECT_INPUT\n\n\n// int tt; for(fscanf(pfin, \"%d\\n\", &tt); tt; tt--)\n test();\n\n fclose(pfin);\n return(0);\n}\n//==============================================================================\n\n//==============================================================================\nconst int lseg[10] = {6, 2, 5, 4, 5, 5, 6, 3, 7, 6};\n//==============================================================================\n\n//==============================================================================\nvoid test()\n{\n int a, b, d, k[8] = {-1, -1, -1, -1, -1, -1, -1, -1};\n int i, j;\n int ls;\n\n\n fscanf(pfin, \"%d %d\", &a, &b);\n\n d = b - a;\n\n i = 0;\n while(a != 0)\n {\n k[i] = a%10;\n a /= 10;\n i++;\n }\n\n\n ls = 0;\n for(i = 0; i <= d; i++)\n {\n for(j = 0; k[j] >= 0; j++)\n ls += lseg[k[j]];\n\n for(j = 0; ; j++)\n {\n k[j]++;\n if(k[j] >= 10)\n {\n k[j] = 0;\n if(k[j + 1] < 0)\n k[j + 1] = 0;\n }\n else\n break;\n }\n }\n\n\n printf(\"%d\\n\", ls);\n}\n//==============================================================================\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum=0;\n int x,z,y,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n if(x>=9)\n {\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n }\n else\n {\n if(0>=x&&0<=y)\n sum=sum+6;\n if(1>=x&&1<=y)\n sum=sum+2;\n if(2>=x&&2<=y)\n sum=sum+5;\n if(3>=x&&3<=y)\n sum=sum+5;\n if(4>=x&&4<=y)\n sum=sum+4;\n if(5>=x&&5<=y)\n sum=sum+5;\n if(6>=x&&6<=y)\n sum=sum+6;\n if(7>=x&&7<=y)\n sum=sum+3;\n if(8>=x&&8<=y)\n sum=sum+7;\n if(9>=x&&9<=y)\n sum=sum+6;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum=0;\n int x,z,y,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n if(x>=9)\n {\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n }\n else\n {\n if(0>=x&&0<=y)\n sum=sum+6;\n if(1>=x&&1<=y)\n sum=sum+2;\n if(2>=x&&2<=y)\n sum=sum+5;\n if(3>=x&&3<=y)\n sum=sum+5;\n if(4>=x&&4<=y)\n sum=sum+4;\n if(5>=x&&5<=y)\n sum=sum+5;\n if(6>=x&&6<=y)\n sum=sum+6;\n if(7>=x&&7<=y)\n sum=sum+3;\n if(8>=x&&8<=y)\n sum=sum+7;\n if(9>=x&&9<=y)\n sum=sum+6;\n }\n printf(\"%llu\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,z,y,sum=0,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n if(x>=9)\n {\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n }\n else\n {\n if(0>=x&&0<=y)\n sum=sum+6;\n if(1>=x&&1<=y)\n sum=sum+2;\n if(2>=x&&2<=y)\n sum=sum+5;\n if(3>=x&&3<=y)\n sum=sum+5;\n if(4>=x&&4<=y)\n sum=sum+4;\n if(5>=x&&5<=y)\n sum=sum+5;\n if(6>=x&&6<=y)\n sum=sum+6;\n if(7>=x&&7<=y)\n sum=sum+3;\n if(8>=x&&8<=y)\n sum=sum+7;\n if(9>=x&&9<=y)\n sum=sum+6;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,z,y,sum=0,dif,i,temp;\n scanf(\"%d %d\",&x,&y);\n if(x>9)\n {\n dif=y-x;\n for(i=0;i<=dif;i++)\n {\n z=x;\n while(z!=0)\n {\n temp=z%10;\n if(0==temp)\n sum=sum+6;\n if(1==temp)\n sum=sum+2;\n if(2==temp)\n sum=sum+5;\n if(3==temp)\n sum=sum+5;\n if(4==temp)\n sum=sum+4;\n if(5==temp)\n sum=sum+5;\n if(6==temp)\n sum=sum+6;\n if(7==temp)\n sum=sum+3;\n if(8==temp)\n sum=sum+7;\n if(9==temp)\n sum=sum+6;\n z=z/10;\n }\n x++;\n }\n }\n else\n {\n if(0>=x&&0<=y)\n sum=sum+6;\n if(1>=x&&1<=y)\n sum=sum+2;\n if(2>=x&&2<=y)\n sum=sum+5;\n if(3>=x&&3<=y)\n sum=sum+5;\n if(4>=x&&4<=y)\n sum=sum+4;\n if(5>=x&&5<=y)\n sum=sum+5;\n if(6>=x&&6<=y)\n sum=sum+6;\n if(7>=x&&7<=y)\n sum=sum+3;\n if(8>=x&&8<=y)\n sum=sum+7;\n if(9>=x&&9<=y)\n sum=sum+6;\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n//1\u301cn\u306b\u542b\u307e\u308c\u308bcount\u306e\u500b\u6570\u3092\u6c42\u3081\u308b\nunsigned long long solve(unsigned long long n,int count,int base){\n\tunsigned long long r=0; //\u7d50\u679c\n\tunsigned long long lower=0; //\u51e6\u7406\u3057\u3066\u3044\u308b\u6841\u3088\u308a\u4e0b\u306e\u6841\u306e\u5408\u8a08\n\tunsigned long long digits=0,expbase=1;\n\tfor(;n;digits++,expbase*=base,n/=base){\n\t\tunsigned long long d=digits*expbase/base; //0,1,20,300,4000,...\n\t\tunsigned long long current_digit=n%base;\n\t\tr+=current_digit*d;\n\t\tif(current_digit==count)r+=lower+1;\n\t\tif(current_digit>=count+1)r+=expbase;\n\t\tlower+=current_digit*expbase;\n\t\tif(count==0)r-=expbase;\n\t}\n\treturn r;\n}\n\nint d[]={6,2,5,5,4,5,6,3,7,6};\nint main(int argc,char **argv){\n\tint base=10;\n\n\tunsigned long long n,m,r=0;\n\t//%d is used due to lovely msvcrt.\n\tscanf(\"%d%d\",&n,&m);\n\tint i=0;\n\tfor(;i<10;i++)r+=d[i]*(solve(m,i,base)-solve(n-1,i,base));\n\tprintf(\"%d\\n\",r);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{ int a,b,c=0,i,d,e;\nprintf(\"a= \");scanf(\"%d\",&a);\nprintf(\"b= \");scanf(\"%d\",&b);\nfor(i=a;i<=b;i++)\n {d=i;\n while (d!=0)\n {e=d%10; d=d/10;\n switch(e)\n { case 0: {c+=6; break;}\n case 1: {c+=2; break;}\n case 2: {c+=5; break;}\n case 3: {c+=5; break;}\n case 4: {c+=4; break;}\n case 5: {c+=5; break;}\n case 6: {c+=6; break;}\n case 7: {c+=3; break;}\n case 8: {c+=7; break;}\n case 9: {c+=6; break;}\n }}}\n\nprintf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[]={6,2,5,5,4,5,6,3,7,6};\nint cnt(int n)\n{\n if(n==0)\n return;\n return a[n%10]+(n/10);\n}\nint main()\n{\n int a,b;\n long long s=0;\n scanf(\"%d%d\",&a,&b);\n for(int i=a;i<=b;i++)\n {\n int t=i;\n s+=cnt(t);\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long min(long long a, long long b){\n return a>b?b:a;\n}\nlong long max(long long a, long long b){\n return a<b?b:a;\n}\nint cnt[]={6,2,5,5,4,5,6,3,0,6};\nlong long slv(long long n){\n long long s=0;\n while(n){\n s+=cnt[n%10];\n n/=10;\n }\n return s;\n}\nint main(){\n int a,b,i; long long ans=0;\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;++i){\n ans+=slv(i);\n }\n printf(\"%lld\\n\",ans);\n return 0 ; \n}"}, {"source_code": "#include <stdio.h>\nint ara[12];\nlong long visited[1000010];\nint main()\n{\n long long a,b,c,d,k,r,i;\n ara[0]=6;\n ara[1]=2;\n ara[2]=5;\n ara[3]=5;\n ara[4]=4;\n ara[5]=5;\n ara[6]=6;\n ara[7]=7;\n ara[8]=7;\n ara[9]=6;\n visited[0]=6;\n long long sum=6;\n for(i=1;i<=1000000;i++){\n a=i;\n while(a!=0){\n sum=sum+ara[a%10];\n a=a/10;\n }\n visited[i]=sum;\n }\n scanf(\"%I64d%I64d\",&a,&b);\n printf(\"%I64d\\n\",visited[b]-visited[a-1]);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint segCalc(int number){\n\tif(number==4){\n\t\treturn 4;\n\t}else if (number==1){\n\t\treturn 2;\n\t}else if (number==2||number==5||number==3){\n\t\treturn 5;\n\t}else if (number==6||number==0){\n\t\treturn 6;\n\t}else if (number==7){\n\t\treturn 3;\n\t}else if (number==8){\n\t\treturn 8;\n\t}else if (number==9){\n\t\treturn 7;\n\t}\n\t\n\t\n}\nlong findSeg(long i){\n\tlong seg;\n\tint temp;\n\tif(i/10==0){\n\t\tseg= segCalc(i);\n\t\treturn seg;\n\t}\n\telse{\n\t\ttemp=i%10;\n\t\tseg=segCalc(temp);\n\t\t\n\t\treturn seg+findSeg(i/10);\n\t}\n\t\n}\nint main() {\n\t// your code goes here\n\tlong a,b,sum=0,i;\n\t\n\tscanf(\"%ld %ld\",&a,&b);\n\tfor(i=a;i<=b;i++){\n\t\t\n\tsum+=\tfindSeg(i);\t\n\t\n\t}\n\tprintf(\"%ld\",sum);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int clock[10]={6,2,5,5,4,5,6,3,7,6};\n int sta,fin,ans;\n scanf(\"%d%d\",&sta,&fin);\n for(int i=sta;i<=fin;i++)\n {\n int a=i;\n while(a/10>0)\n {\n ans+=clock[a%10];\n a/=10;\n }\n ans+=clock[a];\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char st[100];\n int i,j,k,n,l=0,arr[20]={6,2,5,5,4,5,6,3,7,6};\n scanf(\"%d%d\",&n,&k);\n for(i=n;i<=k;i++)\n {//l=0;\n sprintf(st,\"%d\",i);\n /*for(j=0;st[j]!='\\0';j++)\n {\n if(st[j]=='0')\n {\n l+=6;\n }\n else if(st[j]=='1')\n l+=2;\n else if(st[j]=='2')l+=5;\n else if(st[j]=='3')l+=5;\n else if(st[j]=='4')l+=4;\n else if(st[j]=='5')l+=5;\n else if(st[j]=='6')l+=6;\n else if(st[j]=='7')l+=3;\n else if(st[j]=='8')l+=7;\n else if(st[j]=='9')l+=6;\n }*/j=strlen(st);\n if(j==1)\n {\n l+=arr[st[0]-'0'];\n }\n else if(j=2)\n {\n l+=(arr[st[0]-'0']+arr[st[1]-'0']);\n }\n else if(j==3)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']);\n else if(j==4)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']);\n else if(j==5)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']+arr[st[4]-'0']);\n else if(j==6)\n l+=(arr[st[0]-'0']+arr[st[1]-'0']+arr[st[2]-'0']+arr[st[3]-'0']+arr[st[4]-'0']+arr[st[5]-'0']);\n }printf(\"%d\",l);\n}\n"}, {"source_code": "#include<stdio.h>\nint a[]={6,2,5,5,4,5,6,3,7,6};\nint cnt(int n)\n{\n if(n==0)\n return;\n return (a[n%10]+cnt(n/10));\n}\nint main()\n{\n int a,b;\n long long s=0;\n scanf(\"%d%d\",&a,&b);\n for(int i=a;i<=b;i++)\n {\n int t=i;\n s+=cnt(t);\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[]={6,2,5,5,4,5,6,3,7,6};\nint cnt(int n)\n{\n if(n==0)\n return;\n return a[n%10]+cnt(n/10);\n}\nint main()\n{\n int a,b;\n long long s=0;\n scanf(\"%d%d\",&a,&b);\n for(int i=a;i<=b;i++)\n {\n int t=i;\n s+=cnt(t);\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[]={6,2,5,5,4,5,6,3,7,6};\nint cnt(int n)\n{\n int s=0;\n if(n==0)\n return;\n s=a[n%10]+cnt(n/10);\n return s;\n}\nint main()\n{\n int a,b;\n long long s=0;\n scanf(\"%d%d\",&a,&b);\n for(int i=a;i<=b;i++)\n {\n int t=i;\n s+=cnt(t);\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}], "src_uid": "1193de6f80a9feee8522a404d16425b9"} {"nl": {"description": "Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.Kolya remembers that at the beginning of the game his game-coin score was equal to n and that he have bought only some houses (for 1\u2009234\u2009567 game-coins each), cars (for 123\u2009456 game-coins each) and computers (for 1\u2009234 game-coins each).Kolya is now interested, whether he could have spent all of his initial n game-coins buying only houses, cars and computers or there is a bug in the game. Formally, is there a triple of non-negative integers a, b and c such that a\u2009\u00d7\u20091\u2009234\u2009567\u2009+\u2009b\u2009\u00d7\u2009123\u2009456\u2009+\u2009c\u2009\u00d7\u20091\u2009234\u2009=\u2009n?Please help Kolya answer this question.", "input_spec": "The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009109)\u00a0\u2014 Kolya's initial game-coin score.", "output_spec": "Print \"YES\" (without quotes) if it's possible that Kolya spent all of his initial n coins buying only houses, cars and computers. Otherwise print \"NO\" (without quotes).", "sample_inputs": ["1359257", "17851817"], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first sample, one of the possible solutions is to buy one house, one car and one computer, spending 1\u2009234\u2009567\u2009+\u2009123\u2009456\u2009+\u20091234\u2009=\u20091\u2009359\u2009257 game-coins in total."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nlong long int n;\nlong long int house = 1234567;\nlong long int car = 123456;\nlong long int computer = 1234;\nscanf(\"%lld\",&n);\nlong long int sum = n;\n\nfor (int i=0;i<n+1;i = i + house)\n\tfor (int j=0; j<=n-i;j=j+car) {\n\t\tif ((n-i - j)%1234==0){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\nprintf(\"NO\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long n, i, j;\n scanf(\"%ld\", &n);\n for (i = n / 1234567; i >= 0; i--)\n for (j = (n - i*1234567) / 123456; j >= 0; j--){\n if ((n - i*1234567 - j*123456) % 1234 == 0){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\tint main()\n\t{\n\t\tlong long int n;\n\t\tlong long int i,j,z;\n\t\tlong long int flag = 0;\n\t\tscanf(\"%lld\",&n);\n\t\t\n\t\t for(i=0;i< 100000001; i = i + 1234567 )\n\t\t {\n\t\t\t\t for(j=i;j< 100000001; j = j + 123456 )\n \t\t\t\t {\n\t\t \t\t \n\t\t\t\t\t\tif(n>=j){\n\t\t\t\t\t\t\n\t\t\t\t\t\t long long int temp = n-j;\n\t\t \t//printf(\"%d\\n\",temp);\n\t\t\t\t if(temp%1234 == 0)\n\t\t flag = 1;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t}\n\t\t\t if(flag == 1)\n\t\t\t break;\n\t\t\t}\n\t\t \n\t\t\n\t\t\n\t\tif(flag == 1)\n\t\t printf(\"YES\");\n\t\telse\n\t\t printf(\"NO\");\n\t\t \n\t\t \n\t\t return 0;\n\t}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nlong long int n;\nlong long int house = 1234567;\nlong long int car = 123456;\nlong long int computer = 1234;\nscanf(\"%lld\",&n);\nlong long int sum = n;\n\nfor (int i=0;i<n+1;i = i + house)\n\tfor (int j=0; j<=n-i;j=j+car) {\n\t\tif ((n-i - j)%1234==0){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\nprintf(\"NO\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int a=1234567,b=123456,c=1234,n,i,j;\n \tscanf(\"%d\",&n);\n\tfor( i=0;i<=n;i+=a)\n\t\tfor( j=i;j<=n;j+=b)\n\t\t\tif((n-j)%c==0) { puts(\"YES\");return 0;}\n\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d\", &n);\n\tfor (a = 0; a <= n / 1234567; a++)\n\t\tfor (b = 0; b <= (n - a * 1234567) / 123456; b++)\n\t\t\tif ((n - a * 1234567 - b * 123456) % 1234 == 0) {\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef unsigned u;\nu ok;\nvoid H(u n)\n{\n\tif(n%1234==0)ok=1;\n\treturn;\n}\nvoid G(u n)\n{\n\tu x=123456;\n\tn+=x;\n\tdo\n\t{\n\t\tif(n>=x)n-=x;\n\t\tH(n);\n\t}\n\twhile(n>=x);\n\treturn;\n}\nvoid F(u n)\n{\n\tu x=1234567;\n\tn+=x;\n\tdo\n\t{\n\t\tif(n>=x)n-=x;\n\t\tG(n);\n\t}\n\twhile(n>=x);\n\treturn;\n}\nint main()\n{\n\tu n;\n\tscanf(\"%u\",&n);\n\tF(n);\n\tprintf(ok?\"YES\\n\":\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int x,n,a,b,c,i,j,flag=0;\n\tscanf(\"%lld\",&n);\n\ta=1234567;\n\tb=123456;\n\tc=1234;\n\n\tfor(i=0;i<=811;i++)\n\t{\n\t\tfor(j=0;j<=8101;j++)\n\t\t{\n\t\t\tx=n-(i*a)-(j*b);\n\t\t\tif(x%c==0 && x>=0)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t//\tflag=1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n//\tif(flag==0)\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint ch=0;\n long long int a=1234567;\n long long int b=123456;\n long long int c=1234;\n long long int i,j;\n long long int n;\n scanf(\"%I64d\",&n);\n for(i=0;i<=1000;i++)\n for(j=0;j<=10000;j++)\n {\n long long int temp=n-a*i-b*j;\n if(temp%1234==0 && temp>=0)\n {\n ch=1;\n }\n }\n if(ch) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N;\n scanf(\"%d\", &N);\n for(int i = 0; i < 100; ++i) {\n for(int j = 0; j < 1000; ++j) {\n int remain = N - i * 1234567 - j * 123456;\n if(remain >= 0 && remain % 1234 == 0) {\n puts(\"YES\");\n return 0;\n }\n }\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,flag=0;\n scanf(\"%d\",&n);\n for(a=0;a*1234567<=n;a++)\n {\n for(b=0;a*1234567+b*123456<=n;b++)\n if((n-a*1234567-b*123456)%1234==0)\n {\n flag=1;\n break;\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n //printf(\"Hello World!\\n\");\n long long int n, a, b;\n scanf(\"%lld\", &n);\n for(a=0; a<=n; a+=1234567)\n {\n for(b=0; b<=n-a; b+=123456)\n {\n if((n-a-b)%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<limits.h>\n#include<stdlib.h>\n#include<ctype.h>\n#include<math.h>\nchar arr[2500];\n\nint main(){\n\tlong long a,b,c,d,e; int flag =0;\n\tlong long input; scanf(\"%lld\",&input);\n\tfor(a=0;a<=8200;a++){\n\t\tfor(b=0;b<=8200;b++){\n\t\t\tint res = (input - ((a*1234567)+(b*123456)) );\n\t\t\tif( (res % 1234 )==0 && (((res/1234)*1234) + a*1234567 + b*123456) == input && res/1234 >=0 ){\n\t\t\t\t//printf(\"%lld %lld %lld --%lld %lld\\n\",a,b,(input - ((a*1234567)+(b*123456)) ) ,a,b );\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint n;\nint main()\n{\n scanf(\"%d\",&n);\n for (int i=0;i<=n/a;i++)\n for (int j=0;j<=(n-i*a)/b;j++)\n {\n if ((n-i*a-j*b)%c==0)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b,flag=0;\n\tscanf(\"%d\",&n);\n\tfor(a=0;a*1234567<=n;a++)\n\t{\n\t\tfor(b=0;a*1234567+b*123456<=n;b++)\n\t\t{\n\t\t\tif((n-a*1234567-b*123456)%1234==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==1)\n\tputs(\"YES\");\n\telse\n\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\n#define ll long long\n\nint main()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n\n ll a=1234567, b = 123456, c= 1234;\n\n ll n, ans, ans2, i, j;\n int flag = 0;\n\n scanf(\"%I64d\", &n);\n\n if(n%a == 0 || n%b==0 || n%c == 0) flag = 1;\n\n ans = 0;\n\n for(i=1; flag == 0 && ans<=n ; i++) {\n\n ans2 = ans;\n\n if( ans2>0 && n%ans2 == 0) flag = 1;\n\n for(j=1; ans2 <= n && flag == 0 ; j++){\n\n if( ( n-ans2 ) % c == 0) {\n flag = 1;\n break;\n }\n\n ans2 = ans + j*b;\n if(n%ans2 == 0) flag = 1;\n }\n\n ans = i*a;\n if(n%ans==0) flag = 1;\n }\n\n if(flag == 1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tlong int n,a,b;\n\tscanf(\"%ld\",&n);\n\tfor(a=0;a<=n;a+=1234567)\n\t\tfor(b=0;b<=n-a;b+=123456)\n\t\t\tif((n-a-b)%1234==0){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, x, y, z, r;\n\nvoid input();\nint solve();\nvoid output();\n\nint GCD(int a, int b) {\n\tif (!b) return a;\n\telse return GCD(b, a%b);\n}\n\nint main() {\n\tinput();\n\toutput();\n}\n\nvoid input() {\n\tscanf(\"%d\", &n);\n}\n\nint solve() {\n\tx = n / 1234567;\n\ty = n / 123456;\n\t\n\tfor(int i=0; i<=x; i++)\n\t\tfor (int j = 0; j <= y; j++)\n\t\t\tif (n - i * 1234567 - j * 123456 >= 0 && (n - i * 1234567 - j * 123456) % 1234 == 0)\n\t\t\t\treturn 1;\n\n\treturn 0;\n}\n\nvoid output() {\n\tif (solve()) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int flag;\n long long n, a, b, c, x, y, z, r, i, j, k;\n\n while (scanf(\"%lld\", &n) != EOF){\n flag = 0;\n x = 1234567, y = 123456, z = 1234;\n\n for (a = 0; (a * x) <= n; a++){\n for (b = 0; ((a * x) + (b * y)) <= n; b++){\n r = n - (a * x) - (b * y);\n if ((r % z) == 0) flag = 1;\n }\n }\n\n if (flag) puts(\"YES\");\n else puts(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,n,i,j;\n\n scanf(\"%d\",&n);\n c=-1;\n for(a=0;a<=n;a+=1234567)\n {\n for(b=0;a+b<=n;b+=123456)\n {\n if((n-a-b)%1234==0)c=(n-a-b)/1234;\n }\n if(c!=-1)break;\n }\n\n //printf(\"%d %d %d\\n\",a,b,c);\n if(c>=0)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n scanf(\"%d\",&n);\n int find=0;\n int a,b;\n for(a=0;a<=n/1234567;a++){\n for(b=0;b<=n/123456;b++){\n //n=a*1234567+b*123456+c*1234\n if(n>=(a*1234567+b*123456) && (n-a*1234567-b*123456)%1234==0){\n find=1;\n }\n }\n }\n if(find)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <inttypes.h>\n\nint main()\n{\n int64_t n, t;\n scanf(\"%I64d\", &n);\n \n do\n {\n t = n;\n do\n {\n if(t % 1234 == 0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n t -= 123456;\n }\n while(t >= 0);\n \n n -= 1234567;\n }\n while(n >= 0);\n\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n \n \n for(a=0;a<=n;a+=1234567)\n {\n for(b=0;b<=n-a;b+=123456)\n {\n if(((n-a-b)%1234)==0)\n {\n n=0;\n break;\n }\n }\n } \n \n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n\tint a,b,c;\n\tint i,j,k;\n\tint lo,hi,mid;\n\tint flag = 0;\n\tint N;\n\n\tscanf (\"%d\",&N);\n\n\tfor (i=0;i*1234567 < 1000000000;i++)\n\t{\n\t\tfor (j=0;j*123456 < 1000000000;j++)\n\t\t{\n\t\t\t// lo = 0;\n\t\t\t// hi = 1000000;\n\n\t\t\t// while (lo < hi)\n\t\t\t// {\n\t\t\t// \tmid = (lo+hi)/2;\n\n\t\t\t// \tif (((i*1234567) + (j*123456) + (mid*1234)) < N)\n\t\t\t// \t\tlo = mid+1;\n\t\t\t// \telse if (((i*1234567) + (j*123456) + (mid*1234)) == N)\n\t\t\t// \t{\n\t\t\t// \t\tflag = 1;\n\n\t\t\t// \t\tprintf (\"%d %d %d\\n\",i,j,mid);\n\t\t\t// \t\tbreak;\n\t\t\t// \t}\n\t\t\t// \telse\n\t\t\t// \t\thi = mid;\n\t\t\t// }\n\n\t\t\tif ((N - ((i*1234567)+j*123456)) % 1234 == 0 && (N - ((i*1234567)+j*123456)) >= 0)\n\t\t\t{\n\t\t\t\tflag = 1;\n\n\t\t\t}\t\n\t\t\tif (flag)\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (flag)\n\t\t\tbreak;\n\t}\n\n\tif (flag)\n\t\tprintf (\"YES\\n\");\n\telse\n\t\tprintf (\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int n2 = n+1;\n int ans = 0;\n for(;n2 > 0;n2 -= 1234567)\n {\n int n3 = n2;\n for(;n3 > 0;n3 -= 123456)\n {\n if(n3 % 1234 == 1)\n {\n ans = 1;\n goto mark;\n }\n }\n }\nmark:if(ans == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <inttypes.h>\n\nint main()\n{\n int64_t n, t;\n scanf(\"%I64d\", &n);\n \n do\n {\n t = n;\n do\n {\n if(t % 1234 == 0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n t -= 123456;\n }\n while(t >= 0);\n \n n -= 1234567;\n }\n while(n >= 0);\n\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint i,j;\n\tlong long n,a,b,c,x,y,z;\n\tscanf(\"%I64d\",&n);\n\tx = n/1234567;\n\tfor(a=x;a>=0;a--){\n\t\ty=(n-a)/123456;\n\t\tfor(b=y;b>=0;b--){\n\t\t\tz=(n-1234567*a-123456*b)/1234;\n\t\t\tfor(c=z;c>=0;c--){\n\t\t\t\tif (n==1234567*a+123456*b+1234*c){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "/*********************************************\\\n|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|\n|@@@@@ @@ @@ @@@ @@ @@ @@ @@@|\n|@@@@@ @@ @@ @ @ @@ @@@@@@ @@@@@ @@@@|\n|@@@@@ @@ @@@@@@@ @@ @@@@ @@@@ @@@@@|\n|@@@@@ @@ @@ @ @ @@ @@@@@@ @@@ @@@@@@|\n|@@@@@ @@ @@ @ @ @@ @@@@@@ @@ @@@|\n|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|\n| COMPUTER SCIENCE AND ENGINEERING |\n|^^^^^^^*******^^^^^^^^********^^^^^^^********|\n|BANGABANDHU SHEIKH MUJIBUR RAHMAN SCIENCE |\n| AND TECHNOLOGY UNIVERSITY |\n\\*********************************************/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#define ll long long\n#define sf scanf\n#define pf printf\n#define end return 0\n#define d double\n#define f float\n#define b break\n#define c continue\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n long long x;\n long long y;\n int i,j;\n for(i=0; ; i++)\n {\n y=i*1234567;\n for(j=0; ; j++)\n\n {\n x=n-(y+ j*123456);\n if(x<0)\n {\n b;\n }\n if(x%1234==0)\n {\n pf(\"YES\\n\");\n return 0;\n }\n }\n if((n-y)<0)\n b;\n }\n pf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,i,j,k,flag=0;\n scanf(\"%lld\",&n);\n a=n/1234;\n b=n/123456;\n c=n/1234567;\n for(k=0; k<=c;k++)\n {\n for(j=0; j<=b;)\n {\n i=(k*1234567)+(j*123456);\n if(i<=n)\n {\n j++;\n if(((n-i)%1234)==0)\n {\n flag=1;\n }\n }\n else\n {\n j=b+1;\n }\n if(flag)\n break;\n }\n if(flag)\n break;\n }\n\n if(flag)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main( )\n{\n\tlong long int n,a=1234567,b=123456,i,j,k,c=1234,flag=0;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<=100;i++)\n\t{\n\t\tfor(j=0;j<=1000;j++)\n\t\t{\n\t\t\tif(((n-(a*i)-(b*j))>=0)&&((n-(a*i)-(b*j))%c==0))\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef unsigned u;\nu ok;\nvoid H(u n)\n{\n\tif(n%1234==0)ok=1;\n\treturn;\n}\nvoid G(u n)\n{\n\tu x=123456;\n\tn+=x;\n\tdo\n\t{\n\t\tif(n>=x)n-=x;\n\t\tH(n);\n\t}\n\twhile(n>=x);\n\treturn;\n}\nvoid F(u n)\n{\n\tu x=1234567;\n\tn+=x;\n\tdo\n\t{\n\t\tif(n>=x)n-=x;\n\t\tG(n);\n\t}\n\twhile(n>=x);\n\treturn;\n}\nint main()\n{\n\tu n;\n\tscanf(\"%u\",&n);\n\tF(n);\n\tprintf(ok?\"YES\\n\":\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int i,j,k,a,b,c;\n a=1234567;\n b=123456;\n c=1234;\n int flag=0;\n long long int p;\n scanf(\"%lld\",&n);\n for(i=0;;i++)\n {\n if(i*a>n){break;}\n for(j=0;;j++)\n {\n p=i*a+j*b;\n if(i*a+j*b>n){break;}\n if((n-p)%c==0){flag=1;break;}\n }\n }\n\n if(flag==1){printf(\"YES\");}\n else printf(\"NO\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\tint main()\n\t{\n\t\tlong long int n;\n\t\tlong long int i,j,z;\n\t\tlong long int flag = 0;\n\t\tscanf(\"%lld\",&n);\n\t\t\n\t\t for(i=0;i< 100000001; i = i + 1234567 )\n\t\t {\n\t\t\t\t for(j=i;j< 100000001; j = j + 123456 )\n \t\t\t\t {\n\t\t \t\t \n\t\t\t\t\t\tif(n>=j){\n\t\t\t\t\t\t\n\t\t\t\t\t\t long long int temp = n-j;\n\t\t \t//printf(\"%d\\n\",temp);\n\t\t\t\t if(temp%1234 == 0)\n\t\t flag = 1;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t}\n\t\t\t if(flag == 1)\n\t\t\t break;\n\t\t\t}\n\t\t \n\t\t\n\t\t\n\t\tif(flag == 1)\n\t\t printf(\"YES\");\n\t\telse\n\t\t printf(\"NO\");\n\t\t \n\t\t \n\t\t return 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d\", &n);\n\tfor (a = 0; a <= n / 1234567; a++)\n\t\tfor (b = 0; b <= (n - a * 1234567) / 123456; b++)\n\t\t\tif ((n - a * 1234567 - b * 123456) % 1234 == 0) {\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n;\n\tscanf(\"%ld\",&n);\n\tint i,j;\n\tfor(i=0;i<=n;i+=1234567)\n\t{\n\t\tfor(j=0;j<=n-i;j+=123456)\n\t\t\tif((n-i-j)%1234==0)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int a,b,c,p,q,n;\n scanf (\"%d\",&n);\n\n a=n/1234567;\n while (a>=0) {\n p=n-(1234567*a);\n if (p%2==0) {\n q=p/2;\n b=-22*q;\n b=((b%617)+617)%617;\n c=(q-b*61728)/617;\n if(c>=0) {\n printf (\"YES\");\n break;\n }\n }\n if (a==0)\n printf (\"NO\");\n a--;\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\n long long int n,a,b,c,reaa;\n scanf(\"%I64d\",&n);\n a = n/1234567;\n while(a>=0)\n {\n reaa = n - a*1234567;\n\n b = reaa/123456;\n\n while(b>=0)\n {\n c = (reaa - b*123456)/1234;\n\n while(c>=0)\n {\n if(a*1234567+b*123456+c*1234 == n)\n {\n printf(\"YES\");\n return 0;\n }\n c--;\n }\n b--;\n }\n a--;\n }\n\n printf(\"NO\");\n\n return 0;\n}\n\n//1359257\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int a=1234567,b=123456,c=1234,n,i,j;\n \tscanf(\"%d\",&n);\n\tfor( i=0;i<=n;i+=a)\n\t\tfor( j=i;j<=n;j+=b)\n\t\t\tif((n-j)%c==0) { puts(\"YES\");return 0;}\n\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d\", &n);\n\tfor (a = 0; a <= n; a += 1234567)\n\t\tfor (b = 0; a + b <= n; b += 123456)\n\t\t\tif ((n - a - b) % 1234 == 0) {\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n for(int a=0;a<=n;a+=1234567)\n {\n for(int b = 0;b<=n-a;b+=123456)\n {\n if((n-a-b)%1234==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t int i, j, k, l, m, n, flag=0;\n\tscanf (\"%ld\", &n);\n\tm=n;\n\tfor (i=0; flag==0 && m>=0; i++)\n\t{\n\t\tm= n-(i*1234567);\n\t\tl=m;\n\t\tfor (j=0; flag==0 && l>=0; j++)\n\t\t{\n\t\t\tl=m-(j*123456);\n\t\t\tif (l%1234 == 0&& l>=0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (flag==1)\n\t{\n\t\tprintf (\"YES\\n\");\n\t}\n\telse if (flag==0)\n\t{\n\t\tprintf (\"NO\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,flag,i;\n __int64 n;\n scanf(\"%I64d\",&n);\n flag=i=0;\n for(a=0;100>a&&flag==0;a++){\n for(b=0;1000>b&&flag==0;b++){\n if(n<a*1234567+b*123456){\n break;\n }\n if(n%1234==0&&i==0){\n flag=1;\n break;\n }\n if((n-a*1234567-b*123456)%1234==0){\n flag=1;\n break;\n }\n i++;\n }\n }\n if(flag==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,n,i,j;\n\n scanf(\"%d\",&n);\n c=-1;\n for(a=0;a<=n;a+=1234567)\n {\n for(b=0;a+b<=n;b+=123456)\n {\n if((n-a-b)%1234==0)c=(n-a-b)/1234;\n }\n if(c!=-1)break;\n }\n\n //printf(\"%d %d %d\\n\",a,b,c);\n if(c>=0)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\tint main()\n\t{\n\t\tlong long int n;\n\t\tlong long int i,j,z;\n\t\tlong long int flag = 0;\n\t\tscanf(\"%lld\",&n);\n\t\t\n\t\t for(i=0;i< 100000001; i = i + 1234567 )\n\t\t {\n\t\t\t\t for(j=i;j< 100000001; j = j + 123456 )\n \t\t\t\t {\n\t\t \t\t \n\t\t\t\t\t\tif(n>=j){\n\t\t\t\t\t\t\n\t\t\t\t\t\t long long int temp = n-j;\n\t\t \t//printf(\"%d\\n\",temp);\n\t\t\t\t if(temp%1234 == 0)\n\t\t flag = 1;\n\t\t\t\t }\n\t\t\t\t \n\t\t\t}\n\t\t\t if(flag == 1)\n\t\t\t break;\n\t\t\t}\n\t\t \n\t\t\n\t\t\n\t\tif(flag == 1)\n\t\t printf(\"YES\");\n\t\telse\n\t\t printf(\"NO\");\n\t\t \n\t\t \n\t\t return 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long n, i, j;\n scanf(\"%ld\", &n);\n for (i = n / 1234567; i >= 0; i--)\n for (j = (n - i*1234567) / 123456; j >= 0; j--){\n if ((n - i*1234567 - j*123456) % 1234 == 0){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int i,j,k,a,b,c;\n a=1234567;\n b=123456;\n c=1234;\n int flag=0;\n long long int p;\n scanf(\"%lld\",&n);\n for(i=0;;i++)\n {\n if(i*a>n){break;}\n for(j=0;;j++)\n {\n p=i*a+j*b;\n if(i*a+j*b>n){break;}\n if((n-p)%c==0){flag=1;break;}\n }\n }\n\n if(flag==1){printf(\"YES\");}\n else printf(\"NO\");\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\tint n,flag=0;\n\tlong long i=0;\n\t\n\tscanf(\"%d \",&n);\n\t\n\twhile(i*1234567<=n)\n\t{\n\t\tlong long j=0;\n\t\t\n\t\twhile(i*1234567+j*123456<=n)\n\t\t{\n\t\t\tif((n-i*1234567-j*123456)%1234==0) flag=1;\n\t\t\tj++;\n\t\t}\n\t\t\n\t\ti++;\n\t}\n\t\n\tif(flag) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\n int n; scanf(\"%d\",&n);\n int i=0,j=0;\n int rest = n, flag = 0;\n for(i=0; i*1234567<=n;i++)\n {\n rest = n - i * 1234567;\n for(j=0;j*123456<=rest;j++)\n {\n if( (rest - j*123456)%1234==0) {\n flag=1 ;//Yes\n break;\n }\n\n }\n\n }\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long int n; scanf(\"%ld\", &n);\n int flag = 0;\n for(long int i = n / 1234567; i >= 0; i--){\n for(long int j = (n - 1234567 * i) / 123456; j >= 0; j--){\n if ((n - (1234567 * i + 123456 * j)) % 1234 == 0) flag = 1;\n }\n }\n if(flag) printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int a=0,b=0,n;\n\tscanf(\"%d\",&n);\n\twhile(a*1234567<=n){\n\t\twhile(b*123456<=n-a*1234567){\n\t\t\tif ((n-a*1234567-b*123456)%1234==0) {printf(\"YES\"); n=0;}\n\t\t\tb++;\n\t\t}\n\t\tb=0;\n\t\ta++;\n\t} \n\tif (n!=0) printf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint main()\n{\n\tint n,i,j,k;\n\tscanf(\"%i\",&n);\n\tfor(i=0;i<(n/a+1);i++)\n\t\tfor(j=0;j<(n/b+1);j++){\n\t\t\tk=n-a*i-b*j;\n\t\t\tif(!(k%1234||k<0)){\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,flag,i;\n __int64 n;\n scanf(\"%I64d\",&n);\n flag=i=0;\n for(a=0;100>a&&flag==0;a++){\n for(b=0;1000>b&&flag==0;b++){\n if(n<a*1234567+b*123456){\n break;\n }\n if(n%1234==0&&i==0){\n flag=1;\n break;\n }\n if((n-a*1234567-b*123456)%1234==0){\n flag=1;\n break;\n }\n i++;\n }\n }\n if(flag==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n,i,j,k;\n\tint c=0;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<=n;i=i+1234567)\n\t { //printf(\"i=%lld\",i);\n\t for(j=0;j<=n;j=j+123456)\n\t {//printf(\"j=%lld\",j);\n\t k=n-i-j;\n\t //k=k/1234;\n\t //printf(\"k=%lld\\n\",k);\n\t if(k>=0&&k%1234==0)\n\t {//printf(\"YES\");\n\t c=1;\n\t break;\n\t }\n\t }\n\t }\n\t //printf(\"c=%d\",c);\n\t if(c==1)\n\t printf(\"YES\");\n\t else \n\t printf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\n//681B Economy Game.\nmain()\n{\n int n,i,j,flag=0;\n scanf(\"%d\",&n);\n int house=1234567,car=123456,computer=1234;\n\n int x=n/house;\n int clone=n,c_copy=0;\n\n for(i=x; house*i>=0;i--)\n {\n clone=n-house*i;\n for(j=0;j*car<=clone;j++)\n {\n c_copy=clone-car*j;\n if(c_copy%computer==0)\n {\n flag=1;\n break;\n }\n }\n\n }\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int i,j,k,a,b,c;\n a=1234567;\n b=123456;\n c=1234;\n int flag=0;\n long long int p;\n scanf(\"%lld\",&n);\n for(i=0;;i++)\n {\n if(i*a>n){break;}\n for(j=0;;j++)\n {\n p=i*a+j*b;\n if(i*a+j*b>n){break;}\n if((n-p)%c==0){flag=1;break;}\n }\n }\n\n if(flag==1){printf(\"YES\");}\n else printf(\"NO\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main( )\n{\n\tlong long int n,a=1234567,b=123456,i,j,k,c=1234,flag=0;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<=100;i++)\n\t{\n\t\tfor(j=0;j<=1000;j++)\n\t\t{\n\t\t\tif(((n-(a*i)-(b*j))>=0)&&((n-(a*i)-(b*j))%c==0))\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long n, i, j;\n scanf(\"%ld\", &n);\n for (i = n / 1234567; i >= 0; i--)\n for (j = (n - i*1234567) / 123456; j >= 0; j--){\n if ((n - i*1234567 - j*123456) % 1234 == 0){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef __int64 ll;\n\nint main(){\n\tll n,i,j;\n\tint flag;\n\twhile(~scanf(\"%I64d\",&n)){\n\t\tflag = 0;\n\t\tfor(i = 0;i <= 100;i++)\n\t\t\tfor(j = 0;j <= 1000;j++)\n\t\t\t\tif(i*1234567+j*123456<=n){\n\t\t\t\t\tif((n-i*1234567-j*123456)%1234 == 0){\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t int i, j, k, l, m, n, flag=0;\n\tscanf (\"%ld\", &n);\n\tm=n;\n\tfor (i=0; flag==0 && m>=0; i++)\n\t{\n\t\tm= n-(i*1234567);\n\t\tl=m;\n\t\tfor (j=0; flag==0 && l>=0; j++)\n\t\t{\n\t\t\tl=m-(j*123456);\n\t\t\tif (l%1234 == 0&& l>=0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (flag==1)\n\t{\n\t\tprintf (\"YES\\n\");\n\t}\n\telse if (flag==0)\n\t{\n\t\tprintf (\"NO\\n\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n //Compiler version gcc 6.3.0\n\n int main(void)\n {\n \tint n;\n \tscanf(\"%d\", &n);\n \tint l1=n/1234567, l2=n/123456;\n \tfor(int i=0;i<=l1;i++) {\n \t\tfor(int j=0; j<=l2; j++) {\n \t\t\tint s=i*1234567+j*123456;\n \t\t\tif(s>n) break;\n \t\t\tif((n-s)%1234==0) {\n \t\t\t\tprintf(\"YES\");\n \t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t}\n \tprintf(\"NO\");\n \treturn 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int n,i,j,k,z=0;\n scanf(\"%lld\",&n);\n for(i=0;i<=n/1234567;i++)\n {\n for(j=0;j<=n/123456;j++)\n {\n if((i*1234567+j*123456)<=n&&(n-(i*1234567+j*123456))%1234==0)\n {\n z=1;\n break;\n }\n }\n if(z==1)\n {\n break;\n }\n }\n if(z==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,j;\n long int r ;\n int flag =0 ;\n scanf(\"%d\",&n);\nfor (i=0 ; i<=(n/1234567) ; i++)\n{\n\n for (j=0 ; j<=(n/123456) ; j++)\n {\n r=n-i*1234567-j*123456;\n if(r>=0 && r%1234 == 0 ){\n printf(\"YES\");\n flag =1;\n break;\n }\n}\nif (flag)\nbreak;\n}\nif (flag == 0 )\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int sum, a, b;\n scanf(\"%I64d\", &sum);\n for (a = 0; a <= sum/1234567; a++){\n for (b = 0; b <= sum/123456; b++){\n long long int x = (sum - a*1234567 - b*123456);\n if ((x >= 0) && (x % 1234 == 0)){\n printf(\"YES\\n\"); return 0;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long n, i, j;\n scanf(\"%ld\", &n);\n for (i = n / 1234567; i >= 0; i--)\n for (j = (n - i*1234567) / 123456; j >= 0; j--){\n if ((n - i*1234567 - j*123456) % 1234 == 0){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n,i,j;\n int ok=0;\n scanf(\"%I64d\",&n);\n\n for(i=0;(i*1234567<=n) && ok==0;i++){\n for(j=0;j*123456<=n-1234567*i;j++){\n if(((n-1234567*i-123456*j)%1234)==0){\n ok=1;\n break;\n }\n }\n }\n\n if(ok) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n for(int a=0;a<=n;a+=1234567)\n {\n for(int b = 0;b<=n-a;b+=123456)\n {\n if((n-a-b)%1234==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n //Compiler version gcc 6.3.0\n\n int main(void)\n {\n \tint n;\n \tscanf(\"%d\", &n);\n \tint l1=n/1234567, l2=n/123456;\n \tfor(int i=0;i<=l1;i++) {\n \t\tfor(int j=0; j<=l2; j++) {\n \t\t\tint s=i*1234567+j*123456;\n \t\t\tif(s>n) break;\n \t\t\tif((n-s)%1234==0) {\n \t\t\t\tprintf(\"YES\");\n \t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t}\n \tprintf(\"NO\");\n \treturn 0;\n }"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint n;\nint main()\n{\n scanf(\"%d\",&n);\n for (int i=0;i<=n/a;i++)\n for (int j=0;j<=(n-i*a)/b;j++)\n {\n if ((n-i*a-j*b)%c==0)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \n#include<stdlib.h> \n#include<string.h> \n#include<math.h>\nint main()\n{\n\tlong long n,i,j,k,x,y,flag=0;\n\tscanf(\"%I64d\",&n);\n\tif(n<1234)\n\t\tgoto end;\n\tif(n%2!=0){\n\t\tfor(i=1;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tend:\n\t\tif(flag==1)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long int n; scanf(\"%ld\", &n);\n int flag = 0;\n for(long int i = n / 1234567; i >= 0; i--){\n for(long int j = (n - 1234567 * i) / 123456; j >= 0; j--){\n if ((n - (1234567 * i + 123456 * j)) % 1234 == 0) flag = 1;\n }\n }\n if(flag) printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n int i , j , n; scanf(\"%d\",&n);\n int a = 1234567 , b = 123456 , c = 1234;\n for(i = 0 ; i <= n/a ; i ++)\n for(j = 0 ; j <= n/b ; j ++) {\n int x = n - i*a - j*b;\n if(x >= 0 && x % c == 0) {\n printf(\"YES\\n\"); return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{long long int n;\n scanf(\"%lld\",&n);\nfor(long long int i=0;i<=n;i+=1234567)\n{for(long long int j=0;j<=(n-i);j+=123456)\n{if((n-i-j)%(1234)==0)\n{printf(\"YES\");\nexit(0);}\n \n}}\nprintf(\"NO\");\n\nreturn 0;}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n long long int a,i,j,b,c,n,k=0;\n scanf(\"%I64d\",&n);\n\n for(a=0;a*1234567<=n;a++){\n for(b=0;a*1234567+b*123456<=n;b++){\n if((n-a*1234567-b*123456)%1234==0) k=1;\n }\n if(k==1) break;\n }\n if(k==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nconst int House = 1234567;\nconst int Car = 123456;\nconst int Computer = 1234;\nint main()\n{\n#ifdef LOCAL\n\tfreopen(\"test.txt\", \"r\", stdin);\n#endif\n int n;\n scanf(\"%d\", &n);\n int a = n / House;\n for(int i = 0; i <= a; i++)\n {\n int b = (n - i * House) / Car;\n for(int j = 0; j <= b; j++)\n {\n int c = n - (i * House + j * Car);\n if(c >= 0 && c % Computer == 0)\n {\n puts(\"YES\");\n return 0;\n }\n }\n }\n puts(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,a,b,tmp;\n scanf(\"%d\",&n);\n if((n%2)==0){\n a=0;\n }\n else{\n a=1;\n }\n for(;a<811;a+=2){\n for(b=0;b<8101;b++){\n tmp=n-((1234567*a)+(123456*b));\n if(tmp>=0){\n if((tmp%1234)==0){\n printf(\"YES\\n\");\n return 0;\n }\n }\n else{\n break;\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\n long long int n,a,b,c,reaa;\n scanf(\"%I64d\",&n);\n a = n/1234567;\n while(a>=0)\n {\n reaa = n - a*1234567;\n\n b = reaa/123456;\n\n while(b>=0)\n {\n c = (reaa - b*123456)/1234;\n\n while(c>=0)\n {\n if(a*1234567+b*123456+c*1234 == n)\n {\n printf(\"YES\");\n return 0;\n }\n c--;\n }\n b--;\n }\n a--;\n }\n\n printf(\"NO\");\n\n return 0;\n}\n\n//1359257\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long int n; scanf(\"%ld\", &n);\n int flag = 0;\n for(long int i = n / 1234567; i >= 0; i--){\n for(long int j = (n - 1234567 * i) / 123456; j >= 0; j--){\n if ((n - (1234567 * i + 123456 * j)) % 1234 == 0) flag = 1;\n }\n }\n if(flag) printf(\"YES\");\n else printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n,i,j;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<=n;i+=1234567)\n\tfor(j=0;j<=n-i;j+=123456)\n\tif((n-i-j)%1234==0)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tprintf(\"NO\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\tint n,flag=0;\n\tlong long i=0;\n\t\n\tscanf(\"%d \",&n);\n\t\n\twhile(i*1234567<=n)\n\t{\n\t\tlong long j=0;\n\t\t\n\t\twhile(i*1234567+j*123456<=n)\n\t\t{\n\t\t\tif((n-i*1234567-j*123456)%1234==0) flag=1;\n\t\t\tj++;\n\t\t}\n\t\t\n\t\ti++;\n\t}\n\t\n\tif(flag) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n long long int i,a,b,j,y,x,m,cur=0,n,t,c1,c2,n1,n2,m1,m2,te,tem,temp;\n\n long long int sum=0,max=0,ans=0,tl=1,k,w=0,on=0,z=0,wh=0;\n\n scanf(\"%lld\",&n);\n a=n/1234567;\n b=n/123456;\n for(i=0;i<=a;i++)\n for(j=0;j<=b;j++)\n {\n te=n-(i*1234567+j*123456);\n if(te%1234==0&&te>-1)\n w=1;\n\n }\n if(w)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,flag=0;\n scanf(\"%d\",&n);\n for(a=0;a*1234567<=n;a++)\n {\n for(b=0;a*1234567+b*123456<=n;b++)\n if((n-a*1234567-b*123456)%1234==0)\n {\n flag=1;\n break;\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tint a,b,c;\n\n\tscanf(\"%d\",&n);\n\n\tfor(a=0;a<=n/1234567;a++)\n\t\tfor(b=0;b<=n/123456;b++)\n\t\t\tif(n-1234567*a-123456*b>=0 && (n-1234567*a-123456*b)%1234==0)\n\t\t\t{\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,sum=0,f=0;\n scanf(\"%lld\",&n);\n for(ll a=0;a<=n/1234567&&f==0;a++)\n {\n sum=0;\n for(ll b=0;b<=n/123456&&f==0;b++)\n {\n //for(ll c=0;sum<=1e9&&f==0;c++)\n sum=(n-a*1234567)-(b*123456);\n if(sum>=0&&sum%1234==0)\n f=1;\n }\n }\n if(f==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <inttypes.h>\n\nint main()\n{\n int64_t n, t;\n scanf(\"%I64d\", &n);\n \n do\n {\n t = n;\n do\n {\n if(t % 1234 == 0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n t -= 123456;\n }\n while(t >= 0);\n \n n -= 1234567;\n }\n while(n >= 0);\n\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n\tint a;\n\tscanf(\"%d\", &a);\n\tfor (int i = 0; i <= a; i += 1234567) {\n\t\tfor (int j = 0; j <= a - i; j += 123456) {\n\t\t\tif ((a - i - j) % 1234 == 0) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n/* Mon Dec 30 2019 01:14:18 GMT+0300 (MSK) */\n"}, {"source_code": "#include <stdio.h>\n\nint hcf(long int n1,long int n2)\n{\n if (n2!=0)\n return hcf(n2, n1%n2);\n else \n return n1;\n}\nint main(void) {\n\tlong int n,i,j,a,b,flag=0;\n\tscanf(\"%ld\",&n);\n\ta=811;\n\tb=8101;\n\tfor(i=0;i<=811;i++)\n\t{\n\t for(j=0;j<=8101;j++)\n\t {\n\t if((n-i*1234567-j*123456)<0)\n\t break;\n\t if((n-i*1234567-j*123456)%1234==0)\n\t {\n\t flag=1;\n\t break;\n\t }\n\t }\n\t if(flag==1)\n\t break;\n\t}\n\tif(flag==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int n2 = n+1;\n int ans = 0;\n for(;n2 > 0;n2 -= 1234567)\n {\n int n3 = n2;\n for(;n3 > 0;n3 -= 123456)\n {\n if(n3 % 1234 == 1)\n {\n ans = 1;\n goto mark;\n }\n }\n }\nmark:if(ans == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long n,i,j,flag=0,a,b,temp,g=0;\n scanf(\"%I64d\",&n);\n a=n/1234567;\n b=n/123456;\n for(i=0;i<=a;i++)\n {\n for(j=0;j<=b;j++)\n {\n temp=n-(i*1234567)-(j*123456);\n if(temp>=0)\n {\n if(temp%1234==0)\n {\n flag=1;break;\n }\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int a,b,c,n,i,j,flag;\n a = 1234567;\n b = 123456;\n c = 1234;\n\n while(scanf(\"%I64d\",&n) == 1)\n {\n flag = 0;\n for(i=0;i<=n;i+=a)\n {\n for(j=0;j<=n-i;j+=b)\n {\n if((n-(i+j))%c == 0)\n {\n printf(\"YES\\n\");\n flag = 1;\n break;\n }\n }\n if(flag == 1)\n break;\n }\n if(flag == 0)\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int a=1234567,b=123456,c=1234,n,i,j;\n \tscanf(\"%d\",&n);\n\tfor( i=0;i<=n;i+=a)\n\t\tfor( j=i;j<=n;j+=b)\n\t\t\tif((n-j)%c==0) { puts(\"YES\");return 0;}\n\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n for(int a=0;a<=n;a+=1234567)\n {\n for(int b = 0;b<=n-a;b+=123456)\n {\n if((n-a-b)%1234==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define HOUSE (1234567)\n#define CAR (123456)\n#define COMPUTER (1234)\n\nint main() {\n bool ok = false;\n int n,nh,ncr,i,j;\n\n scanf(\"%d\", &n);\n for ( nh = n / HOUSE, i=0; i <= nh; ++i )\n for ( ncr = (n-i*HOUSE) / CAR, j=0; j <= ncr; ++j )\n if ( (n - i*HOUSE - j*CAR) % COMPUTER == 0 )\n ok = true;\n printf(\"%s\\n\", ok ? \"YES\" : \"NO\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int a=1234567,b=123456,c=1234,n,i,j;\n \tscanf(\"%d\",&n);\n\tfor( i=0;i<=n;i+=a)\n\t\tfor( j=i;j<=n;j+=b)\n\t\t\tif((n-j)%c==0) { puts(\"YES\");return 0;}\n\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int flag;\n long long n, a, b, c, x, y, z, r, i, j, k;\n\n while (scanf(\"%lld\", &n) != EOF){\n flag = 0;\n x = 1234567, y = 123456, z = 1234;\n\n for (a = 0; (a * x) <= n; a++){\n for (b = 0; ((a * x) + (b * y)) <= n; b++){\n r = n - (a * x) - (b * y);\n if ((r % z) == 0) flag = 1;\n }\n }\n\n if (flag) puts(\"YES\");\n else puts(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=1234567,b=123456,c=1234,sum,n,flag=0,i,j,m;\n scanf(\"%d\",&n);\n sum=n;\n if(n%a==0 || n%b==0 || n%c==0) printf(\"YES\\n\");\n else{\n for(i=0; flag==0 ;i++)\n {\n sum=n;\n sum=sum-i*a;\n m=sum;\n if(sum<0) break;\n\n for(j=0; flag==0 ; j++)\n { //printf(\"i= %d j=%d\\n\",i,j);\n sum=m;\n sum=sum-j*b;\n if(sum<0) break;\n\n if(sum%c==0) { flag=1; printf(\"YES\\n\"); }\n //printf(\"%d %d\\n\",sum,sum%c);\n }\n }\n //printf(\"%d %d\\n\",i,j);\n if(flag==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n//a-1234567 b-123456 c-1234\n\nint main(void){\n\tint n, a, b, c, no=0;\n\t\n\tscanf(\"%d\", &n);\n\t\n\ta=(int)n/1234567;\n\tb=(int)(n-a*1234567)/123456;\n\tc=(int)(n-a*1234567-b*123456)/1234;\n\t\n\twhile((a*1234567+b*123456+c*1234)!=n){\n\t\tif(b>0){\n\t\t\tb--;\n\t\t\tc=(int)(n-a*1234567-b*123456)/1234;\n\t\t}\n\t\telse if(a>0){\n\t\t\ta--;\n\t\t\tb=(n-a*1234567)/123456;\n\t\t\tc=(n-a*1234567-b*123456)/1234;\n\t\t}\n\t\telse{\n\t\t\tno=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(no==0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int n2 = n+1;\n int ans = 0;\n for(;n2 > 0;n2 -= 1234567)\n {\n int n3 = n2;\n for(;n3 > 0;n3 -= 123456)\n {\n if(n3 % 1234 == 1)\n {\n ans = 1;\n goto mark;\n }\n }\n }\nmark:if(ans == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint main()\n{\n\tint n,i,j,k;\n\tscanf(\"%i\",&n);\n\tfor(i=0;i<(n/a+1);i++)\n\t\tfor(j=0;j<(n/b+1);j++){\n\t\t\tk=n-a*i-b*j;\n\t\t\tif(!(k%1234||k<0)){\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\tputs(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint n, x, y, z, r;\n\nvoid input();\nint solve();\nvoid output();\n\nint GCD(int a, int b) {\n\tif (!b) return a;\n\telse return GCD(b, a%b);\n}\n\nint main() {\n\tinput();\n\toutput();\n}\n\nvoid input() {\n\tscanf(\"%d\", &n);\n}\n\nint solve() {\n\tx = n / 1234567;\n\ty = n / 123456;\n\t\n\tfor(int i=0; i<=x; i++)\n\t\tfor (int j = 0; j <= y; j++)\n\t\t\tif (n - i * 1234567 - j * 123456 >= 0 && (n - i * 1234567 - j * 123456) % 1234 == 0)\n\t\t\t\treturn 1;\n\n\treturn 0;\n}\n\nvoid output() {\n\tif (solve()) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n int i;\n int j;\n scanf(\"%d\",&n);\n for(i=0;i<=n;i=i+1234567)\n {\n for(j=0;j<=n-i;j=j+123456)\n {\n if((n-i-j)%1234 == 0)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\n#define SET(a,b) memset(a,b,sizeof(a))\n#define scan(n) scanf(\"%d\",&n)\n#define print(n) printf(\"%d\\n\",n)\n#define scanl(n) scanf(\"%lld\",&n)\n#define printl(n) printf(\"%lld\\n\",n)\n\n//stacks\n/*void push(int n,int ar[],int i)\n{\n ar[i]=n;\n i++;\n}\nvoid pop(int ar[],int i)\n{\n if(i>0)\n {\n ar[i-1]=0;\n i--;\n }\n}*/\n\n//queues\n/*void qpush(int ar[],int val,int head,int tail,int range)\n{\n if(head==tail)\n {\n ar[head]=val;\n if(tail+1==range)\n tail=0;\n else\n tail++;\n }\n else\n {\n ar[tail]=val;\n if(tail+1==range)\n tail=0;\n else\n tail++;\n }\n if(tail==head)\n {\n if(head+1==range)\n head=0;\n else\n head++;\n }\n}\n\nvoid qpop(int head,int tail,int range)\n{\n if(head+1==range)\n head=0;\n else\n head++;\n}*/\n\n//pow\n/*int fun(int a,int b,int m)\n{\n if(b==0)\n return 1;\n int d,x;\n d=fun(a,b/2,m);\n x=(d*d)%m;\n if(b%2==0)\n return x;\n else\n return (x*a%m)%m;\n}\n*/\n//bst\n/*typedef struct tree\n{\n int val;\n struct tree *l;\n struct tree *r;\n}node;\n//node *head;\nnode *insert(int x,node *root)\n{\n if(root==NULL)\n {\n root=(node *)malloc(sizeof(node));\n root->val=x;\n }\n else\n {\n if(x<=root->val)\n {\n if(root->l==NULL)\n {\n root->l=(node *)malloc(sizeof(node));\n root->l->val=x;\n }\n else\n root->l=insert(x,root->l);\n }\n else\n {\n if(root->r==NULL)\n {\n root->r=(node *)malloc(sizeof(node));\n root->r->val=x;\n }\n else\n {\n root->r=insert(x,root->r);\n }\n }\n }\n return root;\n}\nnode *find(int x,node *root)\n{\n if(root==NULL)\n {\n return 0;\n }\n else\n {\n if(x==root->val)\n return root;\n else if(x<root->val)\n {\n if(root->l==NULL)\n {\n return 0;\n }\n else\n {\n find(x,root->l);\n }\n }\n else\n {\n if(root->r==NULL)\n {\n return 0;\n }\n else\n {\n find(x,root->r);\n }\n }\n }\n}\n\nvoid inorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n if(root->l==NULL)\n {\n printf(\"%d\",root->val);\n if(root->r==NULL)\n return;\n else\n inorder(root->r);\n }\n else\n {\n inorder(root->l);\n printf(\"%d\",root->val);\n if(root->r==NULL)\n return;\n else\n inorder(root->r);\n }\n}\nvoid preorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n else\n {\n printf(\"%d\",root->val);\n preorder(root->l);\n preorder(root->r);\n }\n}\n\nvoid postorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n else\n {\n postorder(root->l);\n postorder(root->r);\n printf(\"%d\",root->val);\n }\n}\n*/\n//adjacency list\n/*typedef struct ll\n{\n int val;\n struct ll *next;\n}nd;\n\n//n *ar[100001];\nvoid insert(int a,int b)\n{\n if(ar[a]==NULL)\n {\n ar[a]=(nd *)malloc(sizeof(nd));\n ar[a]->val=b;\n ar[a]->next=NULL;\n }\n else\n {\n nd *temp=(nd *)malloc(sizeof(nd)),*t;\n temp->val=b;\n temp->next=ar[a];\n ar[a]=temp;\n }\n}\n\n//dfs\n//int state[100001];\nvoid dfs(int a)\n{\n state[a]=1;\n count++;\n nd *temp=ar[a];\n while(temp!=NULL)\n {\n if(state[temp->val]!=1)\n dfs(temp->val);\n temp=temp->next;\n }\n return;\n}*/\n\n//dijkstra + heaps\n/*typedef struct ll2\n{\n int val;\n int weight;\n struct ll2 *next;\n}nde;\n*/\n//nde *ar[500005];\n//int state[500005];\n\n/*void insert(int a,int b,int w)//insert to adjacency list\n{\n\tif(ar[a]==NULL)\n \t{\n \t \tar[a]=(node *)malloc(sizeof(node));\n \t \tar[a]->val=b;\n \t \tar[a]->weight=w;\n \t \tar[a]->next=NULL;\n \t}\n \telse\n \t{\n \t\tnode *temp=(node *)malloc(sizeof(node)),*t;\n \t\ttemp->val=b;\n \t\ttemp->weight=w;\n \t\ttemp->next=ar[a];\n \t\tar[a]=temp;\n \t}\n}*/\n\n//int pt[500005],d[500005];\n//int heap[500005][2];\n//int ptr;\n/*void decpty(int val,int pos)//decrease priority\n{\n heap[pos][0]=val;\n int x=pos;\n while(x>0)\n {\n if(heap[x][0]>=heap[x/2][0])\n break;\n else\n {\n pt[heap[x][1]]=x/2;\n pt[heap[x/2][1]]=x;\n int temp=heap[x][0],t2=heap[x][1];\n heap[x][0]=heap[x/2][0];\n heap[x][1]=heap[x/2][1];\n heap[x/2][0]=temp;\n heap[x/2][1]=t2;\n x=x/2;\n }\n }\n}\n\nvoid hinsert(int val,int val2)//insert to heap\n{\n heap[ptr][0]=val;\n heap[ptr][1]=val2;\n pt[val2]=ptr;\n int x=ptr;\n ptr++;\n while(x>0)\n {\n if(heap[x][0]>=heap[x/2][0])\n break;\n else\n {\n pt[heap[x][1]]=x/2;\n pt[heap[x/2][1]]=x;\n int temp=heap[x][0],t2=heap[x][1];\n heap[x][0]=heap[x/2][0];\n heap[x][1]=heap[x/2][1];\n heap[x/2][0]=temp;\n heap[x/2][1]=t2;\n x=x/2;\n }\n }\n}\n\nint hdeletemin()//delete min elem from heap\n{\n int ret;\n ret=heap[1][1];\n pt[heap[1][1]]=-1;\n pt[heap[ptr-1][1]]=1;\n heap[1][0]=heap[ptr-1][0];\n heap[1][1]=heap[ptr-1][1];\n ptr--;\n int x=1;\n while(x<ptr)\n {\n if(2*x+1>=ptr)\n {\n if(2*x<ptr)\n {\n if(heap[2*x][0]<heap[x][0])\n {\n pt[heap[x][1]]=2*x;\n pt[heap[2*x][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x][0];\n heap[x][1]=heap[2*x][1];\n heap[2*x][0]=temp;\n heap[2*x][1]=temp2;\n x=2*x;\n }\n else\n break;\n }\n else\n break;\n }\n else if(heap[x][0]<=heap[2*x][0] && heap[x][0]<=heap[2*x+1][0])\n break;\n else\n {\n if(heap[2*x][0]<=heap[2*x+1][0])\n {\n pt[heap[x][1]]=2*x;\n pt[heap[2*x][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x][0];\n heap[x][1]=heap[2*x][1];\n heap[2*x][0]=temp;\n heap[2*x][1]=temp2;\n x=2*x;\n }\n else\n {\n pt[heap[x][1]]=2*x+1;\n pt[heap[2*x+1][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x+1][0];\n heap[x][1]=heap[2*x+1][1];\n heap[2*x+1][0]=temp;\n heap[2*x+1][1]=temp2;\n x=2*x+1;\n }\n }\n }\n return ret;\n}\n\nvoid dikstra(int u,int v)\n{\n while(ptr!=1)\n {\n int v=hdeletemin();\n node *temp=ar[v];\n while(temp!=NULL)\n {\n int w=temp->val;\n if(d[v]+temp->weight < d[w])\n {\n d[w]=d[v]+temp->weight;\n decpty(d[w],pt[w]);\n }\n temp=temp->next;\n }\n }\n}*/\n\n/*int main()\n{\n \tint n,m,u,v,w,i;\n \tscanf(\"%d%d\",&n,&m);\n \tfor(i=0;i<=n;i++)\n \tstate[i]=0;\n \twhile(m--)\n \t{\n \t\tscanf(\"%d%d%d\",&u,&v,&w);\n \t\tinsert(u,v,w);\n \t}\n \tscanf(\"%d%d\",&u,&v);\n \tptr=1;\n \thinsert(0,u);\n \td[u]=0;\n \tfor(i=1;i<=n;i++)\n \t{\n \t\tif(i!=u)\n \t\t{\n \t\t\thinsert(1000000000,i);\n \t\t\td[i]=1000000000;\n \t\t}\n \t}\n \tdikstra(u,v);\n \tif(d[v]==1000000000)\n \tprintf(\"NO\\n\");\n \telse\n \tprintf(\"%d\\n\",d[v]);\n \treturn 0;\n}*/\n\n//kruskal + dsu\n\n//int dsu[N];\n/*int find(int x)\n{\n if(dsu[x]==x)return x;\n return dsu[x] = find(dsu[x]);\n}\n\nvoid Union(int a,int b)\n{\n if(a==b)\n return;\n dsu[a] = b;\n}\n\ntypedef struct edge\n{\n int u,v;\n int weight;\n}edge;\n*/\n//edge e[N];\n/*int cmp(const void *a,const void *b)\n{\n\treturn ((edge*)a)->weight - ((edge*)b)->weight;\n}*/\n/*int main()\n{\n \tint i;\n \tint n,m;\n \tscanf(\"%d %d\\n\",&n,&m);\n \tfor(i=0;i<m;i++)\n\tscanf(\"%d %d %d\",&e[i].u,&e[i].v,&e[i].weight);\n\tfor(i=1;i<=n;i++)\n\tdsu[i]=i;\n\tqsort(e,m,sizeof(edge),cmp);\n\tlong long int sum=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t \tint a,b;\n\t \tif((a=find(e[i].u))!=(b=find(e[i].v)))\n\t \t{\n\t \t\tsum+=e[i].weight;\n\t \t\tUnion(a,b);\n\t \t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}*/\n\n//max\n/*int max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n*/\n//qsort\n\n/*int cmpfunc(const void *a,const void *b)\n{\n return (*(int *)a - *(int *)b);\n}*/\n//qsort(ar,n,sizeof(int),cmpfunc);\n\n\n//-------------------------------------------------------------------------------------------------------------------------------------\n\nint main()\n{\n int n,ans=0;\n scan(n);\n if(n/1234567>=1)\n {\n n=n%1234567;\n if(n/123456>0)\n {\n n=n%123456;\n if(n/1234>0)\n {\n n=n%1234;\n if(n==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(n-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<10;i++)\n \tfor(j=0;j<10;j++)\n \t\tfor(k=0;k<10;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n printf(\"NO\\n\");\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n,i,j,sum,flag=0;\n\tscanf(\"%d\",&n);\n for(i=0;i<1000;i++)\n \tfor(j=0;j<1000;j++)\n \t\t{\n \t\t\tlong long int sum = n - 1234567*i - 123456*j;\n \t\t\tif(sum % 1234 == 0 && sum >= 0)\n \t\t\t\t{\n \t\t\t\t\tflag = 1;\n \t\t\t\t}\n \t\t}\n\n\n if(flag == 0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n \n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include <stdio.h> \n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n\tint64_t a;\n\tscanf(\"%\"PRId64\"\", &a);\n\tif (a == 0)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\twhile (a >= 1234567)\n\t\ta = a - 1234567;\n\twhile (a >= 123456)\n\t\ta = a - 123456;\n\twhile (a >= 1234)\n\t\ta = a - 1234;\n\tprintf(\"%\"PRId64\"\\n\", a);\n\tif (a == 0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n/* Sat Dec 21 2019 20:41:17 GMT+0300 (MSK) */\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n scanf(\"%d\",&n);\n int find=0;\n int a,b;\n for(a=0;a<=n/1234567;a++){\n for(b=0;b<=n/123456;b++){\n //n=a*1234567+b*123456+c*1234\n if(n>(a*1234567+b*123456) && (n-a*1234567-b*123456)%1234==0){\n find=1;\n }\n }\n }\n if(find)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int n,a;\n\tscanf(\"%ld\",&n);\n\tn=n-1359257;\n\ta=n%1234567;\n\ta=a%123456;\n\ta=a%1234;\n\t\n\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}a=n%1234567;\n\ta=a%1234;\n\ta=a%123456;\n\t\n\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}\n\ta=n%123456;\n\ta=a%1234567;\n\ta=a%1234;\n\t\n\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}\n\ta=n%123456;\n\ta=a%1234;\n\ta=a%1234567;\n\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}\n\ta=n%1234;\n\ta=a%1234567;\n\ta=a%123456;\n\t\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}\n\ta=n%1234;\n\ta=a%123456;\n\ta=a%1234567;\n\tif(a==0)\n\t{\n\t\n\t\tprintf(\"YES\\n\");\n\t\t//f++;\n\t\treturn 0;\n\t}\t\n\tprintf(\"NO\\n\");\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(c-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define A 1234567\n#define B 123456\n#define C 1234\nint main()\n{\n int n,count=0,i,j,k,m;\n scanf(\"%d\",&n);\n if(n%A==0||n%B==0||n%C==0)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=1;i<=(n/C);i++)\n {\n k=C*i;\n m=n-k;\n if((m%A)%B==0||m%B==0)\n {\n printf(\"YES\");\n return 0;\n }\n \n }\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(c-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i*1234567<=n;i++)\n {\n for(j=0;j*123456<=n;j++){\n\n\n if((n-i*1234567-j*123456)%1234==0){\n printf(\"YES\");\n return 0;\n\n }\n }\n\n\n\n }\n\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n //printf(\"Hello World!\\n\");\n long long int n;\n scanf(\"%lld\", &n);\n while(n>=1234)\n {\n \n if(n>=1234567)\n {\n while(n>=1234567)\n {\n if(n%1234567==0 || n%123456==0 || n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=1234567;\n // printf(\"%lld\\n\", n);\n }\n }\n }\n else if(n>=123456 && n<=1234567)\n {\n while(n>=123456)\n {\n if(n%123456==0 || n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=123456;\n // printf(\"%lld\\n\", n);\n }\n }\n }\n else if(n>=1234 && n<123456)\n {\n while(n>=1234)\n {\n if(n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=1234;\n }\n }\n }\n }\n if(n==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,i,j;\n int flag=0;\n scanf(\"%lld\",&n);\n if(n%1234567==0)\n flag=1;\n else if(n%123456==0)\n flag=1;\n else if(n%1234==0)\n flag=1;\n n=n%1234;\n for(i=0;56*i<=n&&flag==0;i++)\n {\n for(j=0;56*i+7*j<=n&&flag==0;j++)\n {\n if(56*i+7*j==n)\n flag=1;\n }\n }\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long n, a, b, c, i, j, k, ver;\n\nint main(){\n\n\tscanf(\"%lld\" , &n);\n\n\ta = n/1234567;\n\tb = n/123456;\n\tc = n/1234;\n\n\tfor(i = 0 ; i <= c ; i++){\n\t\tfor(j = 0 ; j <= b ; j++){\n\t\t\tif((n - k*1234567 - j*123456)%1234 == 0){\n\t\t\t\tver = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(ver == 1) break;\n\t\t}\n\t\tif(ver == 1) break;\n\t}\n\n\tif(ver == 1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n \n while(b<=(c-a))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define A 1234567\n#define B 123456\n#define C 1234\nint main()\n{\n int n,count=0,i,j,k,m,t,s;\n scanf(\"%d\",&n);\n if(n%A==0||n%B==0||n%C==0)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=1;i<=(n/C)+1;i++)\n {\n k=C*i;\n m=n-k;\n if((m%A)%B==0||m%B==0)\n {\n printf(\"YES\");\n return 0;\n }\n t=m/A;\n s=m%A;\n for(j=1;j<=t+1;j++)\n {\n if(s%B==0)\n {\n printf(\"YES\");\n return 0;\n }\n s+=A;\n }\n \n }\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong int i, j, k, l, m, n, flag=0;\n\tscanf (\"%ld\", &n);\n\tm=n;\n\tfor (i=0; flag==0 && m>=0; i++)\n\t{\n\t\tm-= (i*1234567);\n\t\tl=m;\n\t\tfor (j=0; flag==0 && l>=0; j++)\n\t\t{\n\t\t\tl-=(j*123456);\n\t\t\tif (l%1234 == 0 && l>=0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (flag==1)\n\t{\n\t\tprintf (\"YES\\n\");\n\t}\n\telse if (flag==0)\n\t{\n\t\tprintf (\"NO\\n\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nlong long int n;\nlong long int house = 1234567;\nlong long int car = 123456;\nlong long int computer = 1234;\nscanf(\"%lld\",&n);\nlong long int sum = n;\nif (n%house==0 || n%car==0 || n%computer==0){\n\tprintf(\"YES\\n\");\n}\nelse {\nwhile(sum >= computer || sum >=car || sum >= house ) {\n\tif(sum>=house) \n\t\tsum-=house;\n\t if(sum>=car) \n\t\tsum-=car;\n\t if(sum>=computer)\n\t\tsum-=computer;\n}\n//printf(\"%lld\",sum);\nif (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=car) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=car) \n\t\t\tsum-=car;\t\n\t}\n} \nif (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=computer) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\n} \nif (sum!=0){\n\tsum = n;\n\twhile(sum>=car || sum>=computer) {\n\t\tif(sum>=car) \n\t\t\tsum-=car;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\n} \n\nif(sum==0)\n\tprintf(\"YES\\n\");\nelse \n\tprintf(\"NO\\n\");\n}\n//printf(\"%d\\n\",pos);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n scanf(\"%ld\",&n);\n while(n!=0)\n {\n if(n>0)\n n=n-1234567;\n else if(n<=0)\n break;\n \n if(n>0)\n n=n-123456;\n else if(n<=0)\n break;\n \n if(n>0)\n n=n-1234;\n else if(n<=0)\n break;\n \n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint main()\n{\n\tint n,k;\n\tscanf(\"%i\",&n);\n\tk=n%a;\n\tif(k){\n\t\tk=k%b;\n\t\tif(k)\n\t\t\tk=k%c;\n\t}\n\tif(k)\n\t\tputs(\"NO\");\n\telse \n\t\tputs(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include <stdio.h> \n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n\tint64_t a;\n\tscanf(\"%\"PRId64\"\", &a);\n\tif (a == 0)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\twhile (a >= 1234567)\n\t\ta = a - 1234567;\n\twhile (a >= 123456)\n\t\ta = a - 123456;\n\twhile (a >= 1234)\n\t\ta = a - 1234;\n\tif (a == 0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n/* Sat Dec 21 2019 20:42:56 GMT+0300 (MSK) */\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<100000;i++)\n \tfor(j=0;j<100000;j++)\n \t\tfor(k=0;k<100000;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n printf(\"NO\\n\");\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#define A 1234567\n#define B 123456\n#define C 1234\nint main()\n{\n int n,count=0,i,j,k,m;\n scanf(\"%d\",&n);\n if(n%A==0||n%B==0||n%C==0)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=1;i<=(n/C);i++)\n {\n k=C*i;\n m=n-k;\n if((m%A)%B==0||m%B==0)\n {\n printf(\"YES\");\n return 0;\n }\n \n }\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2,k;\n\nscanf(\"%lld\",&n);\nfor(i=0;i<n/1234567+1;i++){\n for(j=0;j<n/123456+1;j++){\n if((n-a*1234567-b*123456)>=0 && (n-a*1234567-b*123456)%1234==0 ){\n printf(\"Yes\");\n return 0;\n }\n }\n}//\nprintf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n //Compiler version gcc 6.3.0\n\n int main(void)\n {\n \tint n;\n \tscanf(\"%d\", &n);\n \tint l1=n/1234567, l2=n/123456;\n \tfor(int i=0;i<=l1;i++) {\n \t\tfor(int j=0; j<l2; j++) {\n \t\t\tint s=i*1234567+j*123456;\n \t\t\tif(s>n) break;\n \t\t\tif((n-s)%1234==0) {\n \t\t\t\tprintf(\"YES\");\n \t\t\t\treturn 0;\n \t\t\t}\n \t\t}\n \t}\n \tprintf(\"NO\");\n \treturn 0;\n }"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i<n%1234567;i++)\n {\n for(j=0;j<n%123456;j++){\n\n\n if((n-i*1234567+j*123456)%1234==0){\n printf(\"YES\");\n return 0;\n\n }\n }\n\n\n\n }\n\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<10;i++)\n \tfor(j=0;j<10;j++)\n \t\tfor(k=0;k<10;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n}\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nlong long int n;\nlong long int house = 1234567;\nlong long int car = 123456;\nlong long int computer = 1234;\nscanf(\"%lld\",&n);\nlong long int sum = n;\nif (n%house==0 || n%car==0 || n%computer==0){\n\tprintf(\"YES\\n\");\n}\nelse {\n\nif (sum!=0){\n\tsum = n;\n\twhile(sum>=car || sum>=computer) {\n\t\tif(sum>=car) \n\t\t\tsum-=car;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\nprintf(\"%lld\\n\",sum);\n} \n if (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=computer) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\nprintf(\"%lld\\n\",sum);\n} \n\n if (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=car) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=car) \n\t\t\tsum-=car;\t\n\t}\nprintf(\"%lld\\n\",sum);\n} \n if(sum!=0) {\nsum = n;\nwhile(sum >= house || sum >=car || sum >= computer ) {\n\tif(sum>=house) \n\t\tsum-=house;\n\t if(sum>=car) \n\t\tsum-=car;\n\t if(sum>=computer)\n\t\tsum-=computer;\n}\nprintf(\"%lld\\n\",sum);\n}\n\nif(sum==0)\n\tprintf(\"YES\\n\");\nelse \n\tprintf(\"NO\\n\");\n}\n//printf(\"%d\\n\",pos);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,flag=0;\n long long n,item;\n scanf(\"%I64d\",&n);\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n while(item>=123456)\n {\n item-=123456;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i<=n/1234567;i++)\n {\n for(j=0;j<=n/123456;j++){\n\n\n if((n-i*1234567-j*123456)>0 && (n-i*1234567-j*123456)%1234==0){\n printf(\"YES\");\n return 0;\n\n }\n }\n\n\n\n }\n\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,sum=0,n,d,f=1,a,b,c;\n scanf(\"%I64d\",&n);\n\n m=n;\n while(1){\n if(m/1234567>0){\n sum+=(m/1234567)*1234567;\n m=m%1234567;\n }\n else{\n f=0;\n break;\n }\n\n if(m/123456>0){\n sum+=(m/123456)*123456;\n m=m%123456;\n }\n else{\n f=0;\n break;\n }\n\n if(m/1234>0){\n sum+=(m/1234)*1234;\n }\n else{\n f=0;\n break;\n }\n\n break;\n }\n\n if(sum==n && f==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h> \n#include<stdlib.h> \n#include<string.h> \n#include<math.h>\nint main()\n{\n\tlong long n,i,j,k,x,y,flag=0;\n\tscanf(\"%d\",&n);\n\tif(n%2!=0){\n\t\tfor(i=1;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tend:\n\t\tif(flag==1)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n,i,j,sum,flag=0;\n\tscanf(\"%d\",&n);\n for(i=0;i<1000;i++)\n \tfor(j=0;j<1000;j++)\n \t\t{\n \t\t\tint sum = n- 1234567*i + 123456*j;\n \t\t\tif(sum % 1234)\n \t\t\t\t{\n \t\t\t\t\tflag = 1;\n \t\t\t\t}\n \t\t}\n\n\n if(flag == 0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\n#define SET(a,b) memset(a,b,sizeof(a))\n#define scan(n) scanf(\"%d\",&n)\n#define print(n) printf(\"%d\\n\",n)\n#define scanl(n) scanf(\"%lld\",&n)\n#define printl(n) printf(\"%lld\\n\",n)\n\n//stacks\n/*void push(int n,int ar[],int i)\n{\n ar[i]=n;\n i++;\n}\nvoid pop(int ar[],int i)\n{\n if(i>0)\n {\n ar[i-1]=0;\n i--;\n }\n}*/\n\n//queues\n/*void qpush(int ar[],int val,int head,int tail,int range)\n{\n if(head==tail)\n {\n ar[head]=val;\n if(tail+1==range)\n tail=0;\n else\n tail++;\n }\n else\n {\n ar[tail]=val;\n if(tail+1==range)\n tail=0;\n else\n tail++;\n }\n if(tail==head)\n {\n if(head+1==range)\n head=0;\n else\n head++;\n }\n}\n\nvoid qpop(int head,int tail,int range)\n{\n if(head+1==range)\n head=0;\n else\n head++;\n}*/\n\n//pow\n/*int fun(int a,int b,int m)\n{\n if(b==0)\n return 1;\n int d,x;\n d=fun(a,b/2,m);\n x=(d*d)%m;\n if(b%2==0)\n return x;\n else\n return (x*a%m)%m;\n}\n*/\n//bst\n/*typedef struct tree\n{\n int val;\n struct tree *l;\n struct tree *r;\n}node;\n//node *head;\nnode *insert(int x,node *root)\n{\n if(root==NULL)\n {\n root=(node *)malloc(sizeof(node));\n root->val=x;\n }\n else\n {\n if(x<=root->val)\n {\n if(root->l==NULL)\n {\n root->l=(node *)malloc(sizeof(node));\n root->l->val=x;\n }\n else\n root->l=insert(x,root->l);\n }\n else\n {\n if(root->r==NULL)\n {\n root->r=(node *)malloc(sizeof(node));\n root->r->val=x;\n }\n else\n {\n root->r=insert(x,root->r);\n }\n }\n }\n return root;\n}\nnode *find(int x,node *root)\n{\n if(root==NULL)\n {\n return 0;\n }\n else\n {\n if(x==root->val)\n return root;\n else if(x<root->val)\n {\n if(root->l==NULL)\n {\n return 0;\n }\n else\n {\n find(x,root->l);\n }\n }\n else\n {\n if(root->r==NULL)\n {\n return 0;\n }\n else\n {\n find(x,root->r);\n }\n }\n }\n}\n\nvoid inorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n if(root->l==NULL)\n {\n printf(\"%d\",root->val);\n if(root->r==NULL)\n return;\n else\n inorder(root->r);\n }\n else\n {\n inorder(root->l);\n printf(\"%d\",root->val);\n if(root->r==NULL)\n return;\n else\n inorder(root->r);\n }\n}\nvoid preorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n else\n {\n printf(\"%d\",root->val);\n preorder(root->l);\n preorder(root->r);\n }\n}\n\nvoid postorder(node *root)\n{\n if(root==NULL)\n {\n return;\n }\n else\n {\n postorder(root->l);\n postorder(root->r);\n printf(\"%d\",root->val);\n }\n}\n*/\n//adjacency list\n/*typedef struct ll\n{\n int val;\n struct ll *next;\n}nd;\n\n//n *ar[100001];\nvoid insert(int a,int b)\n{\n if(ar[a]==NULL)\n {\n ar[a]=(nd *)malloc(sizeof(nd));\n ar[a]->val=b;\n ar[a]->next=NULL;\n }\n else\n {\n nd *temp=(nd *)malloc(sizeof(nd)),*t;\n temp->val=b;\n temp->next=ar[a];\n ar[a]=temp;\n }\n}\n\n//dfs\n//int state[100001];\nvoid dfs(int a)\n{\n state[a]=1;\n count++;\n nd *temp=ar[a];\n while(temp!=NULL)\n {\n if(state[temp->val]!=1)\n dfs(temp->val);\n temp=temp->next;\n }\n return;\n}*/\n\n//dijkstra + heaps\n/*typedef struct ll2\n{\n int val;\n int weight;\n struct ll2 *next;\n}nde;\n*/\n//nde *ar[500005];\n//int state[500005];\n\n/*void insert(int a,int b,int w)//insert to adjacency list\n{\n\tif(ar[a]==NULL)\n \t{\n \t \tar[a]=(node *)malloc(sizeof(node));\n \t \tar[a]->val=b;\n \t \tar[a]->weight=w;\n \t \tar[a]->next=NULL;\n \t}\n \telse\n \t{\n \t\tnode *temp=(node *)malloc(sizeof(node)),*t;\n \t\ttemp->val=b;\n \t\ttemp->weight=w;\n \t\ttemp->next=ar[a];\n \t\tar[a]=temp;\n \t}\n}*/\n\n//int pt[500005],d[500005];\n//int heap[500005][2];\n//int ptr;\n/*void decpty(int val,int pos)//decrease priority\n{\n heap[pos][0]=val;\n int x=pos;\n while(x>0)\n {\n if(heap[x][0]>=heap[x/2][0])\n break;\n else\n {\n pt[heap[x][1]]=x/2;\n pt[heap[x/2][1]]=x;\n int temp=heap[x][0],t2=heap[x][1];\n heap[x][0]=heap[x/2][0];\n heap[x][1]=heap[x/2][1];\n heap[x/2][0]=temp;\n heap[x/2][1]=t2;\n x=x/2;\n }\n }\n}\n\nvoid hinsert(int val,int val2)//insert to heap\n{\n heap[ptr][0]=val;\n heap[ptr][1]=val2;\n pt[val2]=ptr;\n int x=ptr;\n ptr++;\n while(x>0)\n {\n if(heap[x][0]>=heap[x/2][0])\n break;\n else\n {\n pt[heap[x][1]]=x/2;\n pt[heap[x/2][1]]=x;\n int temp=heap[x][0],t2=heap[x][1];\n heap[x][0]=heap[x/2][0];\n heap[x][1]=heap[x/2][1];\n heap[x/2][0]=temp;\n heap[x/2][1]=t2;\n x=x/2;\n }\n }\n}\n\nint hdeletemin()//delete min elem from heap\n{\n int ret;\n ret=heap[1][1];\n pt[heap[1][1]]=-1;\n pt[heap[ptr-1][1]]=1;\n heap[1][0]=heap[ptr-1][0];\n heap[1][1]=heap[ptr-1][1];\n ptr--;\n int x=1;\n while(x<ptr)\n {\n if(2*x+1>=ptr)\n {\n if(2*x<ptr)\n {\n if(heap[2*x][0]<heap[x][0])\n {\n pt[heap[x][1]]=2*x;\n pt[heap[2*x][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x][0];\n heap[x][1]=heap[2*x][1];\n heap[2*x][0]=temp;\n heap[2*x][1]=temp2;\n x=2*x;\n }\n else\n break;\n }\n else\n break;\n }\n else if(heap[x][0]<=heap[2*x][0] && heap[x][0]<=heap[2*x+1][0])\n break;\n else\n {\n if(heap[2*x][0]<=heap[2*x+1][0])\n {\n pt[heap[x][1]]=2*x;\n pt[heap[2*x][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x][0];\n heap[x][1]=heap[2*x][1];\n heap[2*x][0]=temp;\n heap[2*x][1]=temp2;\n x=2*x;\n }\n else\n {\n pt[heap[x][1]]=2*x+1;\n pt[heap[2*x+1][1]]=x;\n int temp=heap[x][0];\n int temp2=heap[x][1];\n heap[x][0]=heap[2*x+1][0];\n heap[x][1]=heap[2*x+1][1];\n heap[2*x+1][0]=temp;\n heap[2*x+1][1]=temp2;\n x=2*x+1;\n }\n }\n }\n return ret;\n}\n\nvoid dikstra(int u,int v)\n{\n while(ptr!=1)\n {\n int v=hdeletemin();\n node *temp=ar[v];\n while(temp!=NULL)\n {\n int w=temp->val;\n if(d[v]+temp->weight < d[w])\n {\n d[w]=d[v]+temp->weight;\n decpty(d[w],pt[w]);\n }\n temp=temp->next;\n }\n }\n}*/\n\n/*int main()\n{\n \tint n,m,u,v,w,i;\n \tscanf(\"%d%d\",&n,&m);\n \tfor(i=0;i<=n;i++)\n \tstate[i]=0;\n \twhile(m--)\n \t{\n \t\tscanf(\"%d%d%d\",&u,&v,&w);\n \t\tinsert(u,v,w);\n \t}\n \tscanf(\"%d%d\",&u,&v);\n \tptr=1;\n \thinsert(0,u);\n \td[u]=0;\n \tfor(i=1;i<=n;i++)\n \t{\n \t\tif(i!=u)\n \t\t{\n \t\t\thinsert(1000000000,i);\n \t\t\td[i]=1000000000;\n \t\t}\n \t}\n \tdikstra(u,v);\n \tif(d[v]==1000000000)\n \tprintf(\"NO\\n\");\n \telse\n \tprintf(\"%d\\n\",d[v]);\n \treturn 0;\n}*/\n\n//kruskal + dsu\n\n//int dsu[N];\n/*int find(int x)\n{\n if(dsu[x]==x)return x;\n return dsu[x] = find(dsu[x]);\n}\n\nvoid Union(int a,int b)\n{\n if(a==b)\n return;\n dsu[a] = b;\n}\n\ntypedef struct edge\n{\n int u,v;\n int weight;\n}edge;\n*/\n//edge e[N];\n/*int cmp(const void *a,const void *b)\n{\n\treturn ((edge*)a)->weight - ((edge*)b)->weight;\n}*/\n/*int main()\n{\n \tint i;\n \tint n,m;\n \tscanf(\"%d %d\\n\",&n,&m);\n \tfor(i=0;i<m;i++)\n\tscanf(\"%d %d %d\",&e[i].u,&e[i].v,&e[i].weight);\n\tfor(i=1;i<=n;i++)\n\tdsu[i]=i;\n\tqsort(e,m,sizeof(edge),cmp);\n\tlong long int sum=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t \tint a,b;\n\t \tif((a=find(e[i].u))!=(b=find(e[i].v)))\n\t \t{\n\t \t\tsum+=e[i].weight;\n\t \t\tUnion(a,b);\n\t \t}\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}*/\n\n//max\n/*int max(int a,int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\n*/\n//qsort\n\n/*int cmpfunc(const void *a,const void *b)\n{\n return (*(int *)a - *(int *)b);\n}*/\n//qsort(ar,n,sizeof(int),cmpfunc);\n\n\n//-------------------------------------------------------------------------------------------------------------------------------------\n\nint main()\n{\n int n,ans=0;\n scan(n);\n if(n/1234567>=1)\n {\n n=n%1234567;\n if(n/123456>0)\n {\n n=n%123456;\n if(n/1234>0)\n {\n n=n%1234;\n if(n==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include <stdio.h> \n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n\tint64_t a;\n\tint n;\n\tscanf(\"%\"PRId64\"\", &a);\n\tif (a == 0)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\tif (a >= 1234567 && a % 123456 != 0 && a % 1234 != 0)\n\t\ta = a % 1234567;\n\tif (a >= 123456 && a % 1234 != 0)\n\t\ta = a % 123456;\n\tif (a >= 1234)\n\t\ta = a % 1234;\n\tif (a == 0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n/* Sat Dec 21 2019 21:02:15 GMT+0300 (MSK) */\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong int i, j, k, l, m, n, flag=0;\n\tscanf (\"%ld\", &n);\n\tm=n;\n\tfor (i=0; flag==0 && m>=0; i++)\n\t{\n\t\tm= n-(i*1234567);\n\t\tfor (j=0; flag==0 && l>=0; j++)\n\t\t{\n\t\t\tl=m-(j*123456);\n\t\t\tif (l%1234 == 0&& l>=0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (flag==1)\n\t{\n\t\tprintf (\"YES\\n\");\n\t}\n\telse if (flag==0)\n\t{\n\t\tprintf (\"NO\\n\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i<=n/1234567;i++)\n {\n for(j=0;j<=n/123456;j++){\n\n\n if((n-i*1234567-j*123456)%1234==0){\n printf(\"YES\");\n return 0;\n\n }\n }\n\n\n\n }\n\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define ll long long\n\nint main()\n{\n freopen(\"in.txt\", \"r\", stdin);\n\n ll a=1234567, b = 123456, c= 1234;\n\n ll n, ans, ans2, i, j;\n int flag = 0;\n\n scanf(\"%I64d\", &n);\n\n if(n%a == 0 || n%b==0 || n%c == 0) flag = 1;\n\n ans = 0;\n\n for(i=1; flag == 0 && ans<=n ; i++) {\n\n ans2 = ans;\n\n if( ans2>0 && n%ans2 == 0) flag = 1;\n\n for(j=1; ans2 <= n && flag == 0 ; j++){\n\n if( ( n-ans2 ) % c == 0) {\n flag = 1;\n break;\n }\n\n ans2 = ans + j*b;\n if(n%ans2 == 0) flag = 1;\n }\n\n ans = i*a;\n if(n%ans==0) flag = 1;\n }\n\n if(flag == 1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=1234567,b=123456,c=1234,sum,n,flag=0,i,j;\n scanf(\"%d\",&n);\n sum=n;\n if(n%a==0 || n%b==0 || n%c==0) printf(\"YES\\n\");\n else{\n for(i=0; flag==0 ;i++)\n {\n sum=n;\n sum=sum-i*a;\n if(sum<0) break;\n\n for(j=0; flag==0 ; j++)\n {\n sum=sum-j*b;\n if(sum<0) break;\n\n if(sum%c==0) { flag=1; printf(\"YES\\n\"); }\n }\n }\n //printf(\"%d %d\\n\",i,j);\n if(flag==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=1234567,b=123456,c=1234,sum,n,flag=0,i,j;\n scanf(\"%d\",&n);\n sum=n;\n if(n%a==0 || n%b==0 || n%c==0) printf(\"YES\\n\");\n else{\n for(i=0; flag==0 ;i++)\n {\n sum=n;\n sum=sum-i*a;\n if(sum<0) break;\n\n for(j=0; flag==0 ; j++)\n {\n sum=sum-j*b;\n if(sum<0) break;\n\n if(sum%c==0) { flag=1; printf(\"YES\\n\"); }\n }\n }\n //printf(\"%d %d\\n\",i,j);\n if(flag==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(n-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n b++;\n }\n a++;\n }\n\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\n long long int n,i=0,j=0,k=1,sum=0;\n scanf(\"%I64d\",&n);\n long long int p=n;\n for(i=1234567;i<=n;i+=1234567) {\n\n for(j=123456;j<=n-i;j+=123456) {\n\n sum=i+j;\n if((p-i-j)%1234==0) {\n printf(\"YES\");\n return 0;\n\n }\n\n }\n }\n printf(\"NO\");\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<1000000;i++)\n \tfor(j=0;j<1000000;j++)\n \t\tfor(k=0;k<1000000;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n printf(\"NO\\n\");\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nlong long int n;\nlong long int house = 1234567;\nlong long int car = 123456;\nlong long int computer = 1234;\nscanf(\"%lld\",&n);\nlong long int sum = n;\nif (n%house==0 || n%car==0 || n%computer==0){\n\tprintf(\"YES\\n\");\n}\nelse {\n\nif (sum!=0){\n\tsum = n;\n\twhile(sum>=car || sum>=computer) {\n\t\tif(sum>=car) \n\t\t\tsum-=car;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\n//printf(\"%lld\\n\",sum);\n} \n if (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=computer) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=computer) \n\t\t\tsum-=computer;\t\n\t}\n//printf(\"%lld\\n\",sum);\n} \n\n if (sum!=0){\n\tsum = n;\n\twhile(sum>=house || sum>=car) {\n\t\tif(sum>=house) \n\t\t\tsum-=house;\n\t\tif(sum>=car) \n\t\t\tsum-=car;\t\n\t}\n//printf(\"%lld\\n\",sum);\n} \n if(sum!=0) {\nsum = n;\nwhile(sum >= house || sum >=car || sum >= computer ) {\n\tif(sum>=house) \n\t\tsum-=house;\n\t if(sum>=car) \n\t\tsum-=car;\n\t if(sum>=computer)\n\t\tsum-=computer;\n}\n//printf(\"%lld\\n\",sum);\n}\n\nif(sum==0)\n\tprintf(\"YES\\n\");\nelse \n\tprintf(\"NO\\n\");\n}\n//printf(\"%d\\n\",pos);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\tif(n%1359257==0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\n#define ll long long\n\nint main()\n{\n freopen(\"in.txt\", \"r\", stdin);\n\n ll a=1234567, b = 123456, c= 1234;\n\n ll n, ans, ans2, i, j;\n int flag = 0;\n\n scanf(\"%I64d\", &n);\n\n if(n%a == 0 || n%b==0 || n%c == 0) flag = 1;\n\n ans = 0;\n\n for(i=1; flag == 0 && ans<=n ; i++) {\n\n ans2 = ans;\n\n if( ans2>0 && n%ans2 == 0) flag = 1;\n\n for(j=1; ans2 <= n && flag == 0 ; j++){\n\n if( ( n-ans2 ) % c == 0) {\n flag = 1;\n break;\n }\n\n ans2 = ans + j*b;\n if(n%ans2 == 0) flag = 1;\n }\n\n ans = i*a;\n if(n%ans==0) flag = 1;\n }\n\n if(flag == 1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\nconst int a=1234567;\nconst int b=123456;\nconst int c=1234;\nint main()\n{\n\tint n,k;\n\tscanf(\"%i\",&n);\n\tk=n%a;\n\tif(k){\n\t\tk=k%b;\n\t\tif(k)\n\t\t\tk=k%c;\n\t}\n\tif(k)\n\t\tputs(\"NO\");\n\telse \n\t\tputs(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n;\n\tint flag=0,i,j;\n\tscanf(\"%I64d\",&n);\n\tfor(i=0;i<=n/1234567;i++)\n\t{\n\t\tfor(j=0;j<=((n - (i*1359257))/124690);j++)\n\t\t\tif((n-(i*1359257)-(j*124690))%1234==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\t\n\tif(flag)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n scanf(\"%d\",&n);\n int find=0;\n int a,b;\n for(a=0;a<=n/1234567;a++){\n for(b=0;b<=n/123456;b++){\n //n=a*1234567+b*123456+c*1234\n if(n>(a*1234567+b*123456) && (n-a*1234567-b*123456)%1234==0){\n find=1;\n }\n }\n }\n if(find)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint r,a,b,c,n,ans,cr,a1;\n\tscanf(\"%d\",&n);\n\ta=n/1234;\n\tb=(n%1234)/56;\n\n\tc=((n%1234)%56)/7;\n\tr=((n%1234)%56)%7;\n\tcr=((n%1234)%56)/7;\n\ta1=a/1000;\n\tans=1234*a+56*b+7*c;\n\t\n\tif(r==0 && a>=1101 && b>=11 && c>=0 && ans==n)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,i,j,b,c,n,k=0;\n scanf(\"%d\",&n);\n a=1234567;\n b=123456;\n c=1234;\n for(i=0;i<=n;i=i+a){\n for(j=0;i+j<=n;j=j+b){\n if((n-a-b)%c==0) k=1;\n }\n if(k==1) break;\n }\n if(k==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,sum=0,n,d,f=1;\n scanf(\"%I64d\",&n);\n\n m=n;\n while(1){\n if(m%1234567==0){\n sum=m;\n }\n\n else if(m%123456==0){\n sum=m;\n }\n\n else if(m%1234==0){\n sum=m;\n }\n\n else{\n if(m/1234567>0){\n sum+=(m/1234567)*1234567;\n m=m%1234567;\n }\n\n if(m/123456>0){\n sum+=(m/123456)*123456;\n m=m%123456;\n }\n\n if(m/1234>0){\n sum+=(m/1234)*1234;\n }\n }\n\n if(sum!=n){\n sum=0;\n m=n;\n if(m/1234567>0){\n sum+=(m/1234567)*1234567;\n m=m%1234567;\n }\n\n if(m/1234>0){\n sum+=(m/1234)*1234;\n m=m%1234;\n }\n\n if(m/123456>0){\n sum+=(m/123456)*123456;\n }\n }\n\n break;\n }\n\n if(sum==n) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,a=1234567,b=123456,c=1234,sum;\n scanf(\"%d\",&n);\n sum=a+b+c;\n while(1)\n {\n if(n>=sum)\n {\n n=n-sum;\n if(n<sum&&n>=(b+c))\n {\n n=n-(b+c);\n if(n<(b+c)&&n>=c)\n {\n n=n-c;\n if(n<c)\n break;\n }\n }\n }\n else\n break;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\t\n\tint n,a,b,c,temp=1;\n\tscanf(\"%d\",&n);\n\tfor(a=0;a<=(n/1234567);a++)\n\t{\n\t for(b=0;b<=(n/123456);b++)\n\t { int k=1234567*a + 123456*b;\n\t // printf(\"%d \",k);\n\t k=n-k;\n\t if(k<0){printf(\"NO\"); temp=0; break;}\n\t if(k%1234==0){printf(\"YES\"); temp=0; break;}\n\t }\n\t if(temp==0)break;\n\t}\n\n\tif(temp!=0)printf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#define HOUSE (1234567)\n#define CAR (123456)\n#define COMPUTER (1234)\n\nint main() {\n bool ok = false;\n int n,nh,ncr,i,j;\n\n scanf(\"%d\", &n);\n for ( nh = n / HOUSE, i=0; i <= nh; ++i )\n for ( ncr = (n-i*HOUSE) / CAR, j=0; j <= ncr; ++j )\n if ( (n - nh*HOUSE - ncr*CAR) % COMPUTER == 0 )\n ok = true;\n printf(\"%s\\n\", ok ? \"YES\" : \"NO\");\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(c-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint r,a,b,c,n,ans,cr,a1;\n\tscanf(\"%d\",&n);\n\ta=n/1234;\n\tb=(n%1234)/56;\n\n\tc=((n%1234)%56)/7;\n\tr=((n%1234)%56)%7;\n\tcr=((n%1234)%56)/7;\n\ta1=a/1000;\n\tans=1234*a+56*b+7*c;\n\t\n\tif(r==0 && a>=1101 && b>=11 && c>=0 && ans==n)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n scanf(\"%lld\", &n);\n if(n%3703701==0 || n%2592590==0 || n%2470368==0 || n%1359257==0 || n%370368==0 || n%1481479==0 || n%248146==0 || n%3702==0 || n%125924==0 || n%1237035==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nint n;\nint house = 1234567;\nint car = 123456;\nint computer = 1234;\nscanf(\"%d\",&n);\nint sum = n;\nif (n%house==0 || n%car==0 || n%computer==0){\n\tprintf(\"YES\\n\");\n}\nelse {\nwhile(sum> computer || sum >car || sum > house ) {\n\tif(sum>=house) \n\t\tsum-=house;\n\t if(sum>=car) \n\t\tsum-=car;\n\t if(sum>=computer)\n\t\tsum-=computer;\n}\n//printf(\"%d\",sum);\nif(sum==0)\n\tprintf(\"YES\\n\");\nelse \n\tprintf(\"NO\\n\");\n}\n//printf(\"%d\\n\",pos);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(c-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main( )\n{\n\tint n,i,j,k,c=0,flag=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<1056;i++)\n\t{\n\t\tif(n>=1234567)\n\t\t{\n\t\t\tn=n-1234567;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=0;i<13;i++)\n\t{\n\t\tif(n>=123456)\n\t\t{\n\t\t\tn=n-123456;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\t\tif(n%1234==0)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int n,j,i,flag=0,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<=n/1234567;i++){\n for(j=0;j<=n/123456;j++){\n\n if((n-i*1234567-j*123456)%1234==0){flag=1;break;}\n if((n-i*1234567-j*123456)<0)break;\n }\n }\n if(flag==1)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=1234567,b=123456,c=1234,sum,n,flag=0,i,j;\n scanf(\"%d\",&n);\n sum=n;\n if(n%a==0 || n%b==0 || n%c==0) printf(\"YES\\n\");\n else{\n for(i=0; flag==0 ;i++)\n {\n sum=n;\n sum=sum-i*a;\n if(sum<0) break;\n\n for(j=0; flag==0 ; j++)\n {\n sum=sum-j*b;\n if(sum<0) break;\n\n if(sum%c==0) { flag=1; printf(\"YES\\n\"); }\n }\n }\n //printf(\"%d %d\\n\",i,j);\n if(flag==0) printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N;\n scanf(\"%d\", &N);\n N %= 1234567;\n N %= 123456;\n N %= 1234;\n puts(N == 0 ? \"YES\" : \"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\n long long unsigned int a,temp,i,j,k;\n scanf(\"%I64d\",&a);\n temp=a;\n for(i=1;i!=1000;i++)\n {\n temp=temp-1234567;\n if(temp<=1234567)\n {\n for(j=1;j!=1000;j++)\n {\n if(temp==0)\n {\n printf(\"NO\");\n return 0;\n }\n if (temp>=123456)\n temp=temp-123456;\n\n if(temp<=123456)\n {\n for(k=1;k!=1000;k++)\n {\n if(temp==0)\n {\n printf(\"NO\");\n return 0;\n }\n if(temp>=1234)\n temp=temp-1234;\n {\n if(temp==0)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n\n }\n break;\n }\n }\n\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\n long long int n,i=1,j=1,k=1,sum=0;\n scanf(\"%I64d\",&n);\n\n for(i=0;i<=n;i+=1234567) {\n\n for(j=0;j<=n;j+=123456) {\n\n sum=i+j;\n if(((n-sum))%1234==0) {\n printf(\"YES\");\n return 0;\n\n }\n\n }\n }\n printf(\"NO\");\n\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\n//681B Economy Game.\nmain()\n{\n int n,i,j,flag=0;\n scanf(\"%d\",&n);\n int house=1234567,car=123456,computer=1234;\n\n int x=n/house,y=n/car,z=n/computer;\n int clone=n,c_copy=0;\n\n for(i=x; house*i>=0;i--)\n {\n clone=n-house*i;\n for(j=0;j<=y;j++)\n {\n c_copy=clone-car*j;\n if(c_copy%computer==0)\n {\n flag=1;\n break;\n }\n }\n\n }\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,item;\n scanf(\"%I64d\",&n);\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<10;i++)\n \tfor(j=0;j<10;j++)\n \t\tfor(k=0;k<10;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n printf(\"NO\\n\");\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,a=1234567,b=123456,c=1234,d,e,f,i,j,t;\nscanf(\"%d\",&n);\nif(n%a==0||n%b==0||n%c==0)\nprintf(\"YES\");\nelse\n{\nd=n/a;\ne=n/b;\nfor(i=0;i<=d;i++)\n{\nf=0;\nfor(j=0;j<=e;j++)\n{\nt=n-i*a-j*b;\nif(t%c==0)\n{\nprintf(\"YES\");\nreturn 0;\n}\n}\n}\nprintf(\"NO\");\n}\n}"}, {"source_code": "#include<stdio.h> \n#include<stdlib.h> \n#include<string.h> \n#include<math.h>\nint main()\n{\n\tlong long n,i,j,k,x,y,flag=0;\n\tscanf(\"%d\",&n);\n\tif(n%2!=0){\n\t\tfor(i=1;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i*1234567<=n;i=i+2){\n\t\t\tfor(j=0;j*123456+i*1234567<=n;j++){\n\t\t\t\tif((n-j*123456-i*1234567)%1234==0){\n\t\t\t\t\tflag=1;\n\t\t\t\t\tgoto end;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tend:\n\t\tif(flag==1)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a,b,c;\n a=1234567;\n b=123456;\n c=1234;\n long long int rem,n;\n scanf(\"%lld\",&n);\n rem=n%a;\n rem=rem%b;\n rem=rem%c;\n\n if(rem==0){printf(\"YES\"); }\n else printf(\"NO\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a,b,c;\n a=1234567;\n b=123456;\n c=1234;\n long long int rem,n;\n scanf(\"%lld\",&n);\n rem=n%a;\n rem=rem%b;\n rem=rem%c;\n\n if(rem==0){printf(\"YES\"); }\n else printf(\"NO\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main () {\nint n;\nint house = 1234567;\nint car = 123456;\nint computer = 1234;\nscanf(\"%d\",&n);\nint sum = n;\nif (n%house==0 || n%car==0 || n%computer==0){\n\tprintf(\"YES\\n\");\n}\nelse {\nwhile(sum> computer || sum >car || sum > house ) {\n\tif(sum>=house) \n\t\tsum-=house;\n\t if(sum>=car) \n\t\tsum-=car;\n\t if(sum>=computer)\n\t\tsum-=computer;\n}\n//printf(\"%d\",sum);\nif(sum==0)\n\tprintf(\"YES\\n\");\nelse \n\tprintf(\"NO\\n\");\n}\n//printf(\"%d\\n\",pos);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\n\tscanf(\"%d\", &n);\n\twhile (n - 1234567 >= 123456)\n\t\tn -= 1234567;\n\twhile (n - 123456 >= 1234)\n\t\tn -= 123456;\n\tprintf(\"%s\\n\", n % 1234 == 0 ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,co=0,n,j;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i+=1234567)\n{\n for(j=0;j<=n-i;j+=123456)\n {\n if((n-i-j)%1234==0)\n co=1;\n }\n}\nprintf(\"%s\\n\",(co==1)?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,sum=0,n,d,f=1,a,b,c;\n scanf(\"%I64d\",&n);\n\n m=n;\n while(1){\n if(m/1234567>0){\n sum+=(m/1234567)*1234567;\n m=m%1234567;\n }\n\n if(m/123456>0){\n sum+=(m/123456)*123456;\n m=m%123456;\n }\n\n if(m/1234>0){\n sum+=(m/1234)*1234;\n }\n\n break;\n }\n\n if(sum==n) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint r,a,b,c,n,ans,cr,a1;\n\tscanf(\"%d\",&n);\n\ta=n/1234;\n\tb=(n%1234)/56;\n\n\tc=((n%1234)%56)/7;\n\tr=((n%1234)%56)%7;\n\tcr=((n%1234)%56)/7;\n\ta1=a/1000;\n\tans=1234*a+56*b+7*c;\n\t\n\tif(r==0 && a>=1101 && b>=11 && c>=0 && ans==n)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,co=0,n,j;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i+=1234567)\n{\n for(j=0;j<=n-i;j+=123456)\n {\n if((n-i-j)%1234==0)\n co=1;\n }\n}\nprintf(\"%s\\n\",(co==1)?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n;\n\tint flag=0,i,j;\n\tscanf(\"%I64d\",&n);\n\tfor(i=0;i<=n/1234567;i++)\n\t{\n\t\tfor(j=0;j<=((n - (i*1359257))/124690);j++)\n\t\t\tif((n-(i*1359257)-(j*124690))%1234==0)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\t\n\tif(flag)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,a=1234567,b=123456,c=1234,sum;\n scanf(\"%d\",&n);\n sum=a+b+c;\n while(1)\n {\n if(n>=sum)\n {\n n=n-sum;\n if(n<sum&&n>=(b+c))\n {\n n=n-(b+c);\n if(n<(b+c)&&n>=c)\n {\n n=n-c;\n if(n<c)\n break;\n }\n }\n }\n else\n break;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n long long int i,a,b,j,y,x,m,cur=0,n,t,c1,c2,n1,n2,m1,m2,te,tem,temp;\n\n long long int sum=0,max=0,ans=0,tl=1,k,w=0,on=0,z=0,wh=0;\n\n scanf(\"%lld\",&n);\n a=n/1234567;\n b=n/123456;\n for(i=0;i<=a;i++)\n for(j=0;j<=b;j++)\n {\n te=n-(i*1234567+j*123456);\n if(te%1234==0)\n w=1;\n\n }\n if(w)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define p1 1234567\n#define p2 123456\n#define p3 1234\nint main()\n{\n\t__int64 n,a,b,c,N;\n\tint i,j,k;\n\tscanf(\"%I64d\",&n);\n\tN=n;\n\ta=n/1234567;\n\tn-=a*1234567;\n\tb=n/123456;\n\tn-=b*123456;\n\tif(n%1234)\n\t{\n\t\tfor(i=0;i<=a;i++)\n\t\t\tfor(j=0;;j++)\n\t\t\t{\n\t\t\t\tn=N-i*p1-j*p2;\n\t\t\t\tif(n<0)\n\t\t\t\t\tbreak;\n\t\t\t\telse if(n%1234)\n\t\t\t\t\tc=0;\n\t\t\t\telse\n\t\t\t\t\tc=1;\n\t\t\t}\n\t\tif(c)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#define max 1000000000\ntypedef long long ll;\nint main(){\n\tll n,i,j,flag,c;\n\tflag=-1;\n\tscanf(\"%I64d\",&n);\n\tfor(i=0;i<=100;i++){\n\t\tif((i*1234567)>n){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\tfor(j=0;j<=1000;j++){\n\t\t\tif(((i*1234567)+(j*123456))>n){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tc=n-((i*1234567)+(j*123456));\n\t\t\tif(c>0){\n\t\t\t\tflag=c%1234;\n\t\t\t}\n\t\t\tif(flag==0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(flag==0){\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==0){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(n-a*1234567))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n if(n==0)\n break;\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long m,sum=0,n,d,f=1,a,b,c;\n scanf(\"%I64d\",&n);\n\n m=n;\n while(1){\n if(m/1234567>0){\n sum+=(m/1234567)*1234567;\n m=m%1234567;\n }\n else{\n f=0;\n break;\n }\n\n if(m/123456>0){\n sum+=(m/123456)*123456;\n m=m%123456;\n }\n else{\n f=0;\n break;\n }\n\n if(m/1234>0){\n sum+=(m/1234)*1234;\n }\n else{\n f=0;\n break;\n }\n\n break;\n }\n\n if(sum==n && f==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n //printf(\"Hello World!\\n\");\n long long int n;\n scanf(\"%lld\", &n);\n while(n>=1234)\n {\n \n if(n>=1234567)\n {\n while(n>=1234567)\n {\n if(n%1234567==0 || n%123456==0 || n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=1234567;\n // printf(\"%lld\\n\", n);\n }\n }\n }\n else if(n>=123456 && n<=1234567)\n {\n while(n>=123456)\n {\n if(n%123456==0 || n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=123456;\n // printf(\"%lld\\n\", n);\n }\n }\n }\n else if(n>=1234 && n<123456)\n {\n while(n>=1234)\n {\n if(n%1234==0)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n n-=1234;\n }\n }\n }\n }\n if(n==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n\nint main()\n{\n long long int i,a,b,j,y,x,m,cur=0,n,t,c1,c2,n1,n2,m1,m2,te,tem,temp;\n\n long long int sum=0,max=0,ans=0,tl=1,k,w=0,on=0,z=0,wh=0;\n\n scanf(\"%lld\",&n);\n a=n/1234567;\n b=n/123456;\n for(i=0;i<=a;i++)\n for(j=0;j<=b;j++)\n {\n te=n-(i*1234567+j*123456);\n if(te%1234==0)\n w=1;\n\n }\n if(w)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,i,j,k,flag=0;\n scanf(\"%lld\",&n);\n a=n/1234;\n b=n/123456;\n c=n/1234567;\n for(k=0; k<=c;k++)\n {\n for(j=0; j<=b;)\n {\n i=(k*1234567)+(j*123456);\n if(i<n)\n {\n j++;\n if(((n-i)%1234)==0)\n {\n flag=1;\n }\n }\n else\n {\n j=b+1;\n }\n if(flag)\n break;\n }\n if(flag)\n break;\n }\n\n if(flag)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n/*int count( long long int S[], int m, long long int n )\n{\n if (n == 0)\n return 1;\n if (n < 0)\n return 0;\n if (m <=0 && n >= 1)\n return 0;\n return count( S, m - 1, n ) + count( S, m, n-S[m-1] );\n}*?\n/*int count( int S[], int m, int n )\n{\n int i, j, x, y;\n int table[n+1][m];\n for (i=0; i<m; i++)\n table[0][i] = 1; \n for (i = 1; i < n+1; i++)\n {\n for (j = 0; j < m; j++)\n {\n x = (i-S[j] >= 0)? table[i - S[j]][j]: 0;\n y = (j >= 1)? table[i][j-1]: 0;\n table[i][j] = x + y;\n }\n }\n return table[n][m-1];\n}*/\n/*int count( int S[], int m, int n )\n{\n int table[n+1];\n memset(table, 0, sizeof(table));\n table[0] = 1;\n for(int i=0; i<m; i++)\n for(int j=S[i]; j<=n; j++)\n table[j] += table[j-S[i]]; \n return table[n];\n}*/\nint main()\n{\n\tint n,i,j,k,sum;\n\tscanf(\"%d\",&n);\n\tint arr[] = {1234567,123456,1234};\n int m = 3;\n for(i=0;i<10;i++)\n \tfor(j=0;j<10;j++)\n \t\tfor(k=0;k<10;k++)\n \t\t{\n \t\t\tsum = 1234567*i + 123456*j + 1234*k;\n \t\t\tif(sum == n)\n \t\t\t\t{\n \t\t\t\t\tprintf(\"YES\\n\");\n \t\t\t\t\treturn 0;\n \t\t\t\t}\n \t\t}\n /*if(count(arr,m,n) == 0)\n \tprintf(\"NO\\n\");\n else\n \tprintf(\"YES\\n\");\n return 0;*/\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,item;\n scanf(\"%I64d\",&n);\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long n, a, b, c, i, j, k, ver;\n\nint main(){\n\n\tscanf(\"%lld\" , &n);\n\n\ta = n/1234567;\n\tb = n/123456;\n\n\tfor(i = 0 ; i <= a ; i++){\n\t\tfor(j = 0 ; j <= b ; j++){\n\t\t\tif((n - i*1234567 - j*123456)%1234 == 0){\n\t\t\t\tver = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(ver == 1) break;\n\t\t}\n\t\tif(ver == 1) break;\n\t}\n\n\tif(ver == 1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include <stdio.h> \n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n\tint64_t a;\n\tscanf(\"%\"PRId64\"\", &a);\n\twhile (a >= 1234567)\n\t\ta = a - 1234567;\n\twhile (a >= 123456)\n\t\ta = a - 123456;\n\twhile (a >= 1234)\n\t\ta = a - 1234;\n\tif (a == 0)\n\t\tprintf(\"YES\");\n\tif (a != 0)\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n/* Sat Dec 21 2019 20:24:26 GMT+0300 (MSK) */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,a=0,b=0,c=0;\n scanf(\"%ld\",&n);\n c=n/1234567;\n \n while(a<=c)\n {\n b=0;\n while(b<=(c))\n {\n if((n-(a*1234567)-(b*123456))%1234==0)\n {\n n=0;\n break;\n }\n b++;\n }\n a++;\n }\n if(n==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,flag=0;\n long long n,item;\n scanf(\"%I64d\",&n);\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=123456)\n {\n item-=123456;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n item=n;\n while(item>=1234567)\n {\n item-=1234567;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n while(item>=1234)\n {\n item-=1234;\n }\n if(item==0)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\n long long int n,a,b,c,reaa;\n scanf(\"%I64d\",&n);\n a = n/1234567;\n while(a>0)\n {\n reaa = n - a*1234567;\n\n b = reaa/123456;\n\n while(b>0)\n {\n c = (reaa - b*123456)/1234;\n\n while(c>0)\n {\n if(a*1234567+b*123456+c*1234 == n)\n {\n printf(\"YES\");\n return 0;\n }\n c--;\n }\n b--;\n }\n a--;\n }\n\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,i,j,b,c,n,k=0;\n scanf(\"%d\",&n);\n a=1234567;\n b=123456;\n c=1234;\n for(i=0;i<=n;i=i+a){\n for(j=0;i+j<=n;j=j+b){\n if((n-a-b)%c==0) k=1;\n }\n if(k==1) break;\n }\n if(k==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS \n#include <stdio.h> \n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n\tint64_t a;\n\tscanf(\"%\"PRId64\"\", &a);\n\tif (a == 0)\n\t{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n\twhile (a >= 1234567)\n\t\ta = a - 1234567;\n\twhile (a >= 123456)\n\t\ta = a - 123456;\n\twhile (a >= 1234)\n\t\ta = a - 1234;\n\tif (a == 0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n/* Sat Dec 21 2019 20:42:56 GMT+0300 (MSK) */\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,cost,j,k,i;\n scanf(\"%d\",&n);\n\n for(i=0;i<n%1234567;i++)\n {\n for(j=0;j<n%123456;j++){\n\n\n if((n-i*1234567+j*123456)%1234==0){\n printf(\"YES\");\n return 0;\n\n }\n }\n\n\n\n }\n\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n,i,j,sum,flag=0;\n\tscanf(\"%d\",&n);\n for(i=0;i<1000;i++)\n \tfor(j=0;j<1000;j++)\n \t\t{\n \t\t\tint sum = n- 1234567*i + 123456*j;\n \t\t\tif(sum % 1234 == 0)\n \t\t\t\t{\n \t\t\t\t\tflag = 1;\n \t\t\t\t}\n \t\t}\n\n\n if(flag == 0)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n "}], "src_uid": "72d7e422a865cc1f85108500bdf2adf2"} {"nl": {"description": "In the city of Ultima Thule job applicants are often offered an IQ test. The test is as follows: the person gets a piece of squared paper with a 4\u2009\u00d7\u20094 square painted on it. Some of the square's cells are painted black and others are painted white. Your task is to repaint at most one cell the other color so that the picture has a 2\u2009\u00d7\u20092 square, completely consisting of cells of the same color. If the initial picture already has such a square, the person should just say so and the test will be completed. Your task is to write a program that determines whether it is possible to pass the test. You cannot pass the test if either repainting any cell or no action doesn't result in a 2\u2009\u00d7\u20092 square, consisting of cells of the same color.", "input_spec": "Four lines contain four characters each: the j-th character of the i-th line equals \".\" if the cell in the i-th row and the j-th column of the square is painted white, and \"#\", if the cell is black.", "output_spec": "Print \"YES\" (without the quotes), if the test can be passed and \"NO\" (without the quotes) otherwise.", "sample_inputs": ["####\n.#..\n####\n....", "####\n....\n####\n...."], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first test sample it is enough to repaint the first cell in the second row. After such repainting the required 2\u2009\u00d7\u20092 square is on the intersection of the 1-st and 2-nd row with the 1-st and 2-nd column."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\tchar q;\n\tint a[4][4];\n\tint i,j,x,y;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<=4;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&q);\n\t\t\tif(q=='#')\n\t\t\t\ta[i][j]=1;\n\t\t\telse\n\t\t\t\ta[i][j]=0;\n\t\t}\n\t}\n\tfor(i=0;i<=2;i++)\n\t{\n\t\tfor(j=0;j<=2;j++)\n\t\t{\n\t\t\tx=0,y=0;\n\t\t\tif(a[i][j]==1)\n\t\t\t\tx++;\n\t\t\telse\n\t\t\t\ty++;\n\t\t\tif(a[i][j+1]==1)\n\t\t\t\tx++;\n\t\t\telse\n\t\t\t\ty++;\n\t\t\tif(a[i+1][j]==1)\n\t\t\t\tx++;\n\t\t\telse\n\t\t\t\ty++;\n\t\t\tif(a[i+1][j+1]==1)\n\t\t\t\tx++;\n\t\t\telse\n\t\t\t\ty++;\n\t\t\tif(x!=y)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar ar[4][4];\n\tint i,j,k;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%s\",ar[i]);\n\t}\n\tchar ch[4];\n\tfor(i=0;i<=2;i++)\n\t{\n\t\tfor(j=0;j<=2;j++)\n\t\t{\n\t\t\tint x1,x2;\n\t\t\tx1=x2=0;\n\t\t\tch[0]=ar[i][j];\n\t\t\tch[1]=ar[i+1][j];\n\t\t\tch[2]=ar[i][j+1];\n\t\t\tch[3]=ar[i+1][j+1];\n\t\t\tfor(k=0;k<=3;k++)\n\t\t\t{\n\t\t\t\tif(ch[k]=='#')\n\t\t\t\t\tx1++;\t\t\n\t\t\t\telse\t\t\n\t\t\t\t\tx2++;\n\t\t\t}\n\t\t\tif((x1==3&& x2==1) || (x1==1 && x2==3))\n\t\t\t{\tprintf(\"YES\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tif(x1==4 || x2==4)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\texit(0);\n}\n\n\t\t\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,flag=0,flag2=0,meem;\n char a[4][5];\n for(i=0;i<4;i++){\n gets(a[i]);\n }\n\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n if(i!=3&&j!=3&&a[i][j]!=a[i+1][j]&&a[i][j]!=a[i][j+1]&&a[i][j]!=a[i+1][j+1]){flag=1;break;}\n if(i!=0&&j!=0&&(a[i][j]!=a[i-1][j]&&a[i][j]!=a[i][j-1]&&a[i][j]!=a[i-1][j-1])){flag=1;break;}\n if(i!=3&&j!=0&&a[i][j]!=a[i+1][j]&&a[i][j]!=a[i][j-1]&&a[i][j]!=a[i+1][j-1]){flag=1;break;}\n if(i!=0&&j!=3&&(a[i][j]!=a[i-1][j]&&a[i][j]!=a[i][j+1]&&a[i][j]!=a[i-1][j+1])){flag=1;break;}\n }\n if(flag)break;\n }\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n if(i!=3&&j!=3&&a[i][j]==a[i+1][j]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]){flag2=1;break;}\n if(i!=0&&j!=0&&(a[i][j]==a[i-1][j]&&a[i][j]==a[i][j-1]&&a[i][j]==a[i-1][j-1])){flag2=1;break;}\n }\n if(flag2)break;\n }\n if(flag==1||flag2==1)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n///___________________________________________________///\n///_________________A. IQ Test\nchar array[4][4];\nint i,j,check=0;\nfor (i=0;i<4;i++)\n gets(array[i]);\n\nfor (i=0;i<3;i++)\n{\n for (j=0;j<3;j++)\n {\n if (array[i][j]==array[i][j+1]&&array[i][j]==array[i+1][j])\n {\n check=1;\n break;\n }\n }//##\n}//////#.\nif (check==0)\n{\n for (i=3;i>0;i--)\n{\n for (j=3;j>0;j--)\n {\n if (array[i][j]==array[i][j-1]&&array[i][j]==array[i-1][j])\n { check=1;\n break;\n }\n}//..#\n}//.##\n}\nif (check==0)\n{\n for (i=0;i<3;i++)\n{\n for (j=3;j>0;j--)\n {\n if (array[i][j]==array[i][j-1]&&array[i][j]==array[i+1][j])\n { check=1;\n break;\n }\n}//##\n}//.#\n}\nif (check==0)\n{\n for (i=3;i>0;i--)\n{\n for (j=0;j<3;j++)\n {\n if (array[i][j]==array[i][j+1]&&array[i][j]==array[i-1][j])\n {\n check=1;\n break;\n }\n }//#.\n}\n}////////##\nif (check==1)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n // printf(\"%c\",x[i][j]);\n //if(i==1&&j==3)\n // printf(\"%c\\n\",x[i][j]);\n if (x[i][j]=='\\n')\n j=j-1;\n }\n }\n int flag=0;\n for (i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n// printf(\"%d %d\\n\",i,j);\n// printf(\"%c\\n\",x[i][j]);\n // printf(\"%d\\n%d\\nx[i][j] %c\\nx[i][j-1] %c\\nx[i+1][j] %c %d %d\\nx[i+1][j-1] %c\\nx[i+1][j+1] %c\\n\",i,j,x[i][j],x[i][j-1],x[i+1][j],i+1,j,x[i+1][j-1],x[i+1][j+1]);\n if ((x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint arr[6][6];\n\nvoid invert(int, int);\nint isSquare(int, int);\n\nint main()\n{\n\tint i, j, k, test = 0;\n\tchar s[4];\n\t\n\tfor(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t\tarr[i][j] = 2;\n\t}\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tscanf(\"%s\", s);\n\t\tk = 0;\n\t\tfor(j = 1; j < 5; j++, k++)\n\t\t{\n\t\t\t//scanf(\"%c\", s);\n\t\t\tif (s[k] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (s[k] == '.')\n\t\t\t\tarr[i][j] = 1;\n\t\t\telse\n\t\t\t\tarr[i][j] = 3;\n\t\t}\t\n\t}\n\t\n\t/*for(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tif (c[i][j] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (c[i][j] == '.')\n\t\t\t\tarr[i][j] = 1;\t\t\t\t\n\t\t\telse\n\t\t\t\tarr[i][j] = 2;\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\t\n\t/*(for(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t{\n\t\t\tprintf(\"%d\", arr[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tfor(j = 1; j < 5; j++)\n\t\t{\n\t\t\tif (!isSquare(i, j))\n\t\t\t{\n\t\t\t\tinvert(i, j);\n\t\t\t\t\n\t\t\t\t//printf(\"Inverted at %d %d => %d\\n\", i, j, arr[i][j]);\n\n\t\t\t\tif(isSquare(i, j))\n\t\t\t\t{\n\t\t\t\t\ttest = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tinvert(i, j);\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\ttest = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(test == 1)\n\t\t\tbreak;\n\t}\n\t\n\tif (test)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\nint isSquare(int i, int j)\n{\n\tif ((arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1]) || (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j+1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1]))\n\t\treturn 1;\n\t\n\t//if (((arr[i][j+1] && arr[i+1][j] && arr[i+1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1])) || ((arr[i][j+1] && arr[i-1][j] && arr[i-1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])) || ((arr[i][j-1] && arr[i+1][j] && arr[i+1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1])) || ((arr[i][j-1] && arr[i-1][j] && arr[i-1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])))\n\t\t//return 1;\t\n\t\n\telse\n\t\treturn 0;\n}\n\nvoid invert(int i, int j)\n{\n\tif (arr[i][j] == 0)\n\t\tarr[i][j] = 1;\n\telse if (arr[i][j] == 1)\n\t\tarr[i][j] = 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4],x;\n int i,j,temp=0;\n for(i = 0;i<4;i++)\n {\n for(j=0;j<5;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;((i<3)&&(temp!=1));i++)\n {\n for(j=0;j<3;j++)\n {\n if(((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j]))||((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j+1]))|| ((a[i][j]==a[i+1][j+1])&&(a[i][j]==a[i+1][j])) ||((a[i+1][j]==a[i][j+1])&&(a[i+1][j]==a[i+1][j+1])))\n {\n temp= 1;\n break;\n }\n }\n }\n if(temp== 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar f[5][5];\n\tint i,j,k,g;\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%s\",f[i]);\n\t}\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tint q=0;\n\t\t\tfor(k=i;k<=i+1;k++){\n\t\t\t\tfor(g=j;g<=j+1;g++){\n\t\t\t\t\tq+=(f[k][g]=='#');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(q!=2){\n\t\t\t\treturn puts(\"YES\");\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"NO\");\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\tchar a[4][4];\n\n\tint i, j;\n\n\tfor (i = 0; i < 4; i++) {\n\t\tfor (j = 0; j < 4; j++) {\n\t\t\ta[i][j] = getchar();\n\t\t}\n\t\tgetchar();\n\t}\n\n\tfor (i = 1; i < 4; i++) {\n\t\tfor (j = 1; j < 4; j++) {\n\t\t\tif ((a[i - 1][j - 1] == '#' && a[i][j - 1] == '#' && a[i][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i][j - 1] == '.'\n\t\t\t\t\t\t\t&& a[i][j] == '.')\n\t\t\t\t\t||\n\n\t\t\t\t\t(a[i - 1][j - 1] == '#' && a[i][j - 1] == '#'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i][j - 1] == '.'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '.')\n\t\t\t\t\t||\n\n\t\t\t\t\t(a[i - 1][j - 1] == '#' && a[i - 1][j] == '#'\n\t\t\t\t\t\t\t&& a[i][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i - 1][j] == '.'\n\t\t\t\t\t\t\t&& a[i][j] == '.') ||\n\n\t\t\t\t\t(a[i][j - 1] == '#' && a[i][j] == '#' && a[i - 1][j] == '#')\n\t\t\t\t\t|| (a[i][j - 1] == '.' && a[i][j] == '.'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '.')) {\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t}\n\t}\n\tputs(\"NO\");\n\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n // printf(\"%c\",x[i][j]);\n //if(i==1&&j==3)\n // printf(\"%c\\n\",x[i][j]);\n if (x[i][j]=='\\n')\n j=j-1;\n }\n }\n int flag=0;\n for (i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n// printf(\"%c\\n\",x[i][j]);\n // printf(\"%d\\n%d\\nx[i][j] %c\\nx[i][j-1] %c\\nx[i+1][j] %c %d %d\\nx[i+1][j-1] %c\\nx[i+1][j+1] %c\\n\",i,j,x[i][j],x[i][j-1],x[i+1][j],i+1,j,x[i+1][j-1],x[i+1][j+1]);\n if ((x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n \nchar grid[4][4];\n \nint isBlack(int i,int j)\n{\n if(grid[i][j] == '#')\n return 1;\n else\n return 0;\n}\n \nint find(int i,int j)\n{\n if(isBlack(i,j) && isBlack(i,j+1) && isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && !isBlack(i,j+1) && isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(!isBlack(i,j) && isBlack(i,j+1) && isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && isBlack(i,j+1) && !isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && isBlack(i,j+1) && isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n \n if(!isBlack(i,j) && !isBlack(i,j+1) && !isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n if(!isBlack(i,j) && !isBlack(i,j+1) && !isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(!isBlack(i,j) && !isBlack(i,j+1) && isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n if(!isBlack(i,j) && isBlack(i,j+1) && !isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && !isBlack(i,j+1) && !isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n return 0;\n}\n \nint solve()\n{\n int i,j;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if(find(i,j)==1)\n return 1;\n }\n }\n return 0;\n}\n \nint main()\n{\n int i,j;\n char s[5];\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",s);\n for(j=0;j<4;j++)\n grid[i][j] = s[j];\n }\n \n if(solve()==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar a[4][4];\n for(int i=0;i<4;i++){\n \tscanf(\"%s\",&a[i]);\n\t}\n\tint f=0;\n\tfor(int i=0;i<4;i++){\n\t\tfor(int j=0;j<3;j++){\n\t\t\tif(a[i][j]==a[i][j+1]){\n\t\t\t\tif(a[i+1][j]==a[i][j]||a[i][j+1]==a[i+1][j+1])\n\t\t\t\t{\n\t\t\t f=1;\n\t\t\t\tbreak;\t\t\n\t\t\t}\n\t\t\tif(a[i-1][j]==a[i][j]||a[i][j+1]==a[i-1][j+1])\n\t\t\t\t{\n\t\t\t f=1;\n\t\t\t\tbreak;\t\t\n\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(f==1){\n\tprintf(\"YES\");\n}\nelse{\n\tprintf(\"NO\");\n}\n\t}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main ()\n{\n int tab[4][4]={0};\n int i,j,flag=0;\n char ch;\n\n for (i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\" %c\",&ch);\n if (ch=='#') tab[i][j]=1;\n else tab[i][j]=0;\n }\n }\n\n for (i=1;i<4;i++){\n for(j=1;j<4;j++){\n if (tab[i][j]+tab[i-1][j]+tab[i-1][j-1]+tab[i][j-1]!=2)\n flag=1;\n }\n }\n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j+1]==tab[i+1][j])&&(tab[i][j+1]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n#define OUTPUT freopen(\"myfile.txt\",\"w\",stdout);\n#define INPUT freopen(\"input.txt\",\"r\",stdin);\n\nint main()\n{\n int i,j,cnt,test;\n char mat[20][20];\n\n while(gets(mat[0]))\n {\n gets(mat[1]);\n gets(mat[2]);\n gets(mat[3]);\n\n cnt=0;\n test=0;\n\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n cnt=0;\n\n if(mat[i][j]=='#')\n cnt++;\n if(mat[i][j+1]=='#')\n cnt++;\n if(mat[i+1][j]=='#')\n cnt++;\n if(mat[i+1][j+1]=='#')\n cnt++;\n\n if(cnt>=3)\n {\n test=1;\n goto ans;\n\n }\n\n cnt=0;\n\n if(mat[i][j]=='.')\n cnt++;\n if(mat[i][j+1]=='.')\n cnt++;\n if(mat[i+1][j]=='.')\n cnt++;\n if(mat[i+1][j+1]=='.')\n cnt++;\n\n if(cnt>=3)\n {\n test=1;\n goto ans;\n\n }\n }\n }\n\n ans:\n if(test==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n }\n\n return 0;\n\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nstruct string\n{\n char s[4];\n};\nint main()\n{\n int i,j,sum=0,temp=0;\n char a[4][4];\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n temp=1;\n if(a[i][j+1]==a[i][j])\n temp++;\n if(a[i+1][j]==a[i][j])\n temp++;\n if(a[i+1][j+1]==a[i][j])\n temp++;\n sum=sum>temp?sum:temp;\n }\n j==3;\n if(sum>=3);\n else\n for(i=0;i<3;i++)\n {\n temp=1;\n if(a[i][j]==a[i+1][j])\n temp++;\n if(a[i][j]==a[i+1][j-1])\n temp++;\n sum=sum>temp?sum:temp;\n } \n if(sum>=3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,flag=0,j;\n char s[4][5],c;\n for (i=0; i<4; ++i)\n {\n scanf(\"%s\",s[i]);\n }\n for (i=0; i<4; ++i)\n {\n for(j=0; j<4; ++j)\n {\n if((s[i][j]==s[i][j+1]&&s[i][j+1]==s[i+1][j+1])||(s[i][j]==s[i][j+1]&&s[i+1][j]==s[i][j+1]))\n {\n flag=1;\n break;\n }\n else if((s[i][j]==s[i-1][j]&&s[i][j]==s[i][j+1])||(s[i][j]==s[i-1][j]&&s[i][j-1]==s[i][j]))\n {\n flag=1;\n break;\n }\n\n }\n if(flag==1)\n {\n printf(\"YES\");\n break;\n }\n }\n if(flag==0)\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nstruct string\n{\n char s[4];\n};\nint main()\n{\n int i,j,sum=0,temp=0;\n char a[4][4];\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n temp=1;\n if(a[i][j+1]==a[i][j])\n temp++;\n if(a[i+1][j]==a[i][j])\n temp++;\n if(a[i+1][j+1]==a[i][j])\n temp++;\n sum=sum>temp?sum:temp;\n }\n j==3;\n if(sum>=3);\n else\n for(i=0;i<3;i++)\n {\n temp=1;\n if(a[i][j]==a[i+1][j])\n temp++;\n if(a[i][j]==a[i+1][j-1])\n temp++;\n sum=sum>temp?sum:temp;\n } \n if(sum>=3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0; \n}"}, {"source_code": "#include <stdio.h>\nint map[ 5 ][ 5 ];\nint i, j;\nint dir[ 4 ][ 2 ] ={ { 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 } };\nint Check( int x, int y, int ch ) {\n int q, cnt =0;\n for ( q =0; q < 4; q++ )\n if ( map[ x +dir[ q ][ 0 ] ][ y +dir[ q ][ 1 ] ] == ch ) cnt++;\n if ( cnt >= 3 ) return 1;\n return 0;\n}\nint main() {\n for ( i =1; i <= 4; i++ ) {\n for ( j =1; j <= 4; j++ )\n scanf( \"%c\", &map[ i ][ j ] );\n scanf( \"\\n\" );\n }\n for ( i =1; i <= 3; i++ )\n for ( j =1; j <= 3; j++ )\n if ( Check( i, j, '#' ) || Check( i, j, '.' ) ) { printf( \"YES\\n\" ); return 0; }\n printf( \"NO\\n\" );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,j,a,b,t,d;\nchar aa[6][6];\nint main()\n{\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<4;j++)\n\t\t\tscanf(\" %c\",&aa[i][j]);\n\tfor(i=0;i<3;i++)for(j=0;j<3;j++)\n\t\t{\n\t\t\tt=0;\n\t\t\tfor(a=i;a<i+2;a++)for(b=j;b<j+2;b++)if(aa[a][b]=='.')t++;\n\t\t\tif(t!=2)\n\t\t\t{printf(\"YES\");return 0;}\n\t\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4][4],i,j,sum=0;\n char b;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n b=getchar();\n if(b=='#')\n a[i][j]=0;\n else\n a[i][j]=1;\n }\n getchar();\n }\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n sum=a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1];\n\n if(sum!=2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n\n}"}, {"source_code": "// In the name of **** God ****\n\n/*\n\nCopyright (C) oofMan\n\n Morocco\n\ncreated : 30/3/2019\n \n*/\n#include <stdio.h>\n#include <stdbool.h>\n//#include <bits/stdc++.h>\n\n//using namespace std;\n\n/*inline void oofMan() {\n ios::sync_with_stdio(false);\n cin.tie(NULL); cout.tie(NULL);\n}*/\n\nchar m[4][4];\nint main(void) {\n //oofMan();\n bool flag=false;\n int xc[3]={1,0,1};\n int yc[3]={0,1,1};\n for(int i=0 ;i<4 ;i++)\n for(int j=0 ; j<4 ;j++)\n scanf(\" %c\",&m[i][j]);\n\n for(int i=0 ;i<3 ;i++)\n for(int j=0 ; j<3 ;j++){\n int counter=0;\n for(int k=0;k<3;k++){\n if(i+xc[k]<4 && j+yc[k]<4)\n if(m[i][j]!=m[i+xc[k]][j+yc[k]])\n counter++;\n }\n if(counter==3 || counter<=1){\n flag=true;\n break;\n }\n\n }\n\n printf(\"%s\",(flag?\"YES\":\"NO\"));\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n // printf(\"%c\",x[i][j]);\n //if(i==1&&j==3)\n // printf(\"%c\\n\",x[i][j]);\n if (x[i][j]=='\\n')\n j=j-1;\n }\n }\n int flag=0;\n for (i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n// printf(\"%d %d\\n\",i,j);\n// printf(\"%c\\n\",x[i][j]);\n // printf(\"%d\\n%d\\nx[i][j] %c\\nx[i][j-1] %c\\nx[i+1][j] %c %d %d\\nx[i+1][j-1] %c\\nx[i+1][j+1] %c\\n\",i,j,x[i][j],x[i][j-1],x[i+1][j],i+1,j,x[i+1][j-1],x[i+1][j+1]);\n if ((x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint i,j,k,flag=0,flag1=0,flag2=1,n,h,d;\n char c[5][5],str[5]; \n \n\t//for(i=0;i<4;i++)\n\t//{\n\t\n\tfor(j=0;j<4;j++)\n\t{\n\t\tscanf(\"%s\",str);\nfor(i=0;i<4;i++)\n\t{\n\tif(str[i]=='#')\n\tc[j][i]='#';\n\telse\n\tc[j][i]='.';\n\t}\n\t\t\n\t}\n\t/*printf(\"\\n\\n\");\nfor(i=0;i<4;i++)\n\t{\n\t\n\tfor(j=0;j<4;j++)\n\t{\n\t\tprintf(\"%c\",c[i][j]);\n\n\t}\n\tprintf(\"\\n\");\n\t\t\n\t}\n\t//printf(\"%c\",c[1][1]);\n\tgetch();*/\n\t\n\t\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(j=0;j<3;j++)\n\t\t{h=0;d=0;\n // if((c[i][j]=='#')&&(c[i+1][j]=='#') &&(c[i][j+1]=='#')&&(c[i+1][j+1]=='#')||(c[i][j]=='.')&&(c[i+1][j]=='.') &&(c[i][j+1]=='.')&&(c[i+1][j+1]=='.'))\n // {flag=1;break;}\n if(c[i][j]=='#')\n h++;else d++;\n \n if(c[i][j+1]=='#')\n h++;else d++;\n \n \n if(c[i+1][j]=='#')\n h++;else d++;\n \n \n if(c[i+1][j+1]=='#')\n { h++;}\n \n else\n {d++;}\n \n if(abs(h-d)>=2)\n {flag=1;break;}\n else\n {flag=0;}\n \n //printf(\"%d %d\",h,d);\n //getch();\n }\n if(flag)\n {flag1=1;break;}\n }\n if(flag1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //getch();\n return 0;\n }\n \n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,k;\n char a[4][4];\n for(i=0;i<4;i++)\n {\n for(k=0;k<4;k++)\n scanf(\"%c\",&a[k][i]);\n scanf(\"%*c\");\n }\n for(i=0;i<3;i++)\n {\n for(k=0;k<3;k++)\n { \n if((a[k][i]==a[k+1][i])&&(a[k][i]==a[k][i+1])&&(a[k][i]==a[k+1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if((a[k][i]==a[k+1][i])&&(a[k][i]==a[k][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if((a[k][i]!=a[k+1][i])&&(a[k][i]!=a[k][i+1])&&(a[k][i]!=a[k+1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if(k>0)\n {\n if((a[k][i]!=a[k-1][i])&&(a[k][i]!=a[k][i+1])&&(a[k][i]!=a[k-1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n\n int i = 0, j = 0, v, r = 0;\n char ar[4][4];\n\n for(i = 0; i < 4; i++) {\n\t for(j = 0; j < 4; j++) {\n\t\t scanf(\"%c\", &ar[i][j]);\n\t\t if(ar[i][j] == '\\n') {\n\t\t\t j--;\n\t\t\t continue;\n\t\t }\n\t\t if(ar[i][j] == 35)\n\t\t\t ar[i][j] = ' ';\n\t\t else {\n\t\t//\t printf(\"%d %d i, j\\n\", i, j);\n\t\t\t ar[i][j] = '\\0';\n\t\t }\n\t }\n }\n\n\n for(i = 0; i < 3; i++) {\n\n\t for(j = 0; j < 3; j++) {\n\n\t\t v = ar[i][j] + ar[i+1][j] + ar[i][j+1] + ar[i+1][j+1];\n\n\t\t if( v == 3*32 || v == 4*32 || v == 32 || v == 0) {\n//\t\t\t printf(\"%d = v i = %d j = %d\\n\", v, ar[i+1][j], ar[i+1][j+1]);\n\t\t\t r = 1;\n\t\t\t break;\n\t\t }\n\t }\n\t if(r)\n\t\t break;\n }\n\n \n if(r)\n\t printf(\"YES\\n\");\n else\n\t printf(\"NO\\n\");\n \n}\t\t \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[6][6];\n int i=0,j=0,k=0,l=0;\n int count=0;\n int flag=0;\n int flag2=0;\n int x,y;\n int c;\n\n for(i=0; i<4; i++)\n {\n for(j=0; j<5; j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n a[i][j]=0;\n }\n\n for(k=0; k<4; k++)\n {\n for(l=0; l<4; l++)\n {\n if(a[k][l]=='#')\n {\n flag++;\n }\n if(a[k+1][l]=='#')\n {\n flag++;\n }\n if(a[k][l+1]=='#')\n {\n flag++;\n }\n if(a[k+1][l+1]=='#')\n {\n flag++;\n }\n if((a[k][l]=='.'))\n {\n count++;\n }\n if(a[k+1][l]=='.')\n {\n count++;\n }\n if(a[k][l+1]=='.')\n {\n count++;\n }\n if(a[k+1][l+1]=='.')\n {\n count++;\n }\n if((flag>=3)||(count>=3))\n {\n flag2=1;\n }\n flag=0;\n count=0;\n }\n\n }\n if(flag2==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int i,j,c,c2;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n getchar();\n }\n\n for(i=0;i<3;i++)\n {\n c=0;\n c2=0;\n for(j=0;j<3;j++)\n {\n if(a[i][j]=='#')\n c++;\n if(a[i][j+1]=='#')\n c++;\n if(a[i+1][j]=='#')\n c++;\n if(a[i+1][j+1]=='#')\n c++;\n if(a[i][j]=='.')\n c2++;\n if(a[i][j+1]=='.')\n c2++;\n if(a[i+1][j]=='.')\n c2++;\n if(a[i+1][j+1]=='.')\n c2++;\n if(c>=3||c2>=3)\n {\n printf(\"YES\\n\");\n return 0;\n }\n c=0;\n c2=0;\n }\n\n }\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint test(char a[4][4],int i,int j){\n\tint count1=0,count2=0,k,l;\n\tfor(k=0;k<2;k++){\n\t\tfor(l=0;l<2;l++){\n\t\t\tif(a[i+k][j+l]=='#'){\n\t\t\t\tcount1++;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcount2++;\n\t\t\t}\n\t\t}\n\t}\n\tif(count1>=3){\n\t\treturn 1;\n\t}\n\telse if(count2>=3){\n\t\treturn 1;\n\t}\n\telse{\n\t\treturn 0;\n\t}\n}\nint main(){\n\tint i,j;\n\tchar arr[4][4];\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tscanf(\" %c\",&arr[i][j]);\n\t\t\t//printf(\"aa\\n\");\n\t\t}\n\t}\n\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tif(test(arr,i,j)){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tchar square[4][4];\n\tchar garb;\n\tfor(int i = 0; i < 4; i++) {\n\t\tfor(int j = 0; j < 4; j++) {\n\t\t\tscanf(\"%c\", &square[i][j]);\n\t\t\t//printf(\"I scanned %c\", square[i][j]);\n\t\t}\n\t\tscanf(\"%c\", &garb);\n\t}\n\tint tru = 0;\n\tfor(int i = 0; i < 3; i++) {\n\t\tfor(int j = 0; j < 3; j++) {\n\t\t\tint dots = 0;\n\t\t\tif (square[i][j] == '.') {\n\t\t\t\tdots++;\n\t\t\t}\n\t\t\tif (square[i][j+1] == '.') {\n\t\t\t\tdots++;\n\t\t\t}\n\t\t\tif (square[i+1][j] == '.') {\n\t\t\t\tdots++;\n\t\t\t}\n\t\t\tif (square[i+1][j+1] == '.') {\n\t\t\t\tdots++;\n\t\t\t}\n\t\t\tif (dots != 2) {\n\t\t\t\ttru = 1;\n\t\t\t\t//printf(\"square at (%d, %d). dots == %d\\n\", i, j, dots);\n\t\t\t\t//printf(\"(%d, %d) = %c, (%d, %d) = %c, (%d, %d) = %c, (%d, %d) = %c.\\n\", i, j, square[i][j], i, j + 1, square[i][j+1], i + 1, j, square[i+1][j], i + 1, j + 1, square[i+1][j+1]);\n\t\t\t}\n\t\t}\n\t}\n\tif (tru == 1) {\n\t\tprintf(\"YES\");\n\t} else {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4][4];\n int i,j,k,l;\n char t;\n for(i=0;i<4;i++)\n {\n for(j=0;j<=4;j++)\n {\n scanf(\"%c\",&t);\n if(t=='#')\n a[i][j]=1;\n if(t=='.')\n a[i][j]=0;\n }\n }\n for(i=0; i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n k=0;\n l=0;\n if(a[i][j]==0)\n k++;\n else\n l++;\n if(a[i][j+1]==0)\n k++;\n else\n l++;\n if(a[i+1][j]==0)\n k++;\n else\n l++;\n if(a[i+1][j+1]==0)\n k++;\n else\n l++;\n if(k>=3||l>=3)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint main() \n{\n int i,j;\n char a[4][4],s[5];\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",&s);\n for(j=0;j<4;j++)\n {\n a[i][j]=s[j];\n }\n }\n int c=0,d=0;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n c=0;\n if(a[i][j]==a[i+1][j])\n c++;\n if(a[i][j]==a[i][j+1])\n c++;\n if(a[i][j]==a[i+1][j+1])\n c++;\n if(c>1 ||c==0)\n {\n printf(\"YES\");\n d++;\n return 0;\n }\n }\n }\n if(d==0)\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n char squareArray[4][4];\n int i,flagHash=0,flagDot=0,j,countHash,countDot;\n for(i=0;i<4;i++){\n scanf(\"%s\",squareArray[i]);\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n countHash = 0;\n countDot = 0;\n if(squareArray[i][j]=='#')countHash++;\n else if(squareArray[i][j]=='.')countDot++;\n\n if(squareArray[i][j+1]=='#')countHash++;\n else if(squareArray[i][j+1]=='.')countDot++;\n\n if(squareArray[i+1][j]=='#')countHash++;\n else if(squareArray[i+1][j]=='.')countDot++;\n\n if(squareArray[i+1][j+1]=='#')countHash++;\n else if(squareArray[i+1][j+1]=='.')countDot++;\n\n if(countHash>=3){\n flagHash=1;\n break;\n }\n else if(countDot>=3){\n flagDot=1;\n break;\n }\n }\n if(flagHash^flagDot)break;\n }\n if(flagHash^flagDot)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i, j, isWhite = 0, isBlack = 0, stat = 0;\n char s[10];\n char arr[4][4];\n for (i = 0; i < 4; i++){\n scanf(\"%s\", &s);\n for (j = 0; j < 4; j++) arr[i][j] = s[j];\n }\n for (i = 0; i < 3; i++){\n for (j = 0; j < 3; j++){\n isWhite = 0; isBlack = 0;\n if (arr[i][j] == '#') isBlack++; else isWhite++;\n if (arr[i][j+1] == '#') isBlack++; else isWhite++;\n if (arr[i+1][j] == '#') isBlack++; else isWhite++;\n if (arr[i+1][j+1] == '#') isBlack++; else isWhite++;\n if ((isWhite >= 3) || (isBlack >= 3)) stat = 1;\n if (stat) break;\n }\n if (stat) break;\n }\n printf((stat)?\"YES\\n\":\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int i,j,c,c2;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n getchar();\n }\n\n for(i=0;i<3;i++)\n {\n c=0;\n c2=0;\n for(j=0;j<3;j++)\n {\n if(a[i][j]=='#')\n c++;\n if(a[i][j+1]=='#')\n c++;\n if(a[i+1][j]=='#')\n c++;\n if(a[i+1][j+1]=='#')\n c++;\n if(a[i][j]=='.')\n c2++;\n if(a[i][j+1]=='.')\n c2++;\n if(a[i+1][j]=='.')\n c2++;\n if(a[i+1][j+1]=='.')\n c2++;\n if(c>=3||c2>=3)\n {\n printf(\"YES\\n\");\n return 0;\n }\n c=0;\n c2=0;\n }\n\n }\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint main(void) {\n int n = 4;\n int m = 0;\n bool found = false;\n char arr[n][n];\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n scanf(\"%c\", *(arr + i) + j);\n }\n scanf(\"%c\", &m);\n }\n\n for (int i = 0; i < (n - 1); i++) {\n for (int j = 0, k = 0; j < (n - 1); j++, k = 0) {\n for (int r = 0; r < 2; r++) {\n for (int c = 0; c < 2; c++) {\n if (arr[i + r][j + c] == '.') {\n k++;\n }\n }\n }\n\n if (k != 2) {\n found = true;\n goto done;\n }\n }\n }\n\n done:\n\n if (found == true) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j+1]==tab[i+1][j])&&(tab[i][j+1]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,f=0;\nchar q;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&q);\nif(q=='#')\na[i][j]=1;\nif(q=='.')\na[i][j]=0;\n}\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n f=a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1];\n if(f!=2)\n {\n printf(\"YES\");\n return 0;\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tchar grid[4][4];\n\tint i,j,x,y,flag,sum;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&grid[i][j]);\n\t\t\t//printf(\"%c\",grid[i][j]);\n\t\t}\n\t\tscanf(\"\\n\");\n\t\t//printf(\"\\n\");\n\t}\n\t\n\tfor(x=0;x<3;x++)\n\t{\n\t\tfor(y=0;y<3;y++)\n\t\t{\n\t\t\tsum=0;\n\t\t\tflag=0;\n\t\t\tfor(i=x;i<x+2;i++)\n\t\t\t{\n\t\t\t\tfor(j=y;j<y+2;j++)\n\t\t\t\t{\n\t\t\t\t\tsum+=grid[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(sum==3*'#'+'.')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==3*'.'+'#')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==4*'.')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==4*'#')\n\t\t\t\tflag=1;\n\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\t\n\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\t\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j;\n\tchar z[15][15];\n\tfor (i=0;i<4;i++){\n\t\tscanf(\"%s\",z[i]);\n\t}\n\tfor (i=0;i<3;i++){\n\t\tfor (j=0;j<3;j++){\n\t\t\tif (z[i][j]==z[i+1][j] && z[i+1][j]==z[i+1][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (z[i][j]==z[i][j+1] && z[i][j+1]==z[i+1][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (z[i+1][j]==z[i+1][j+1] && z[i+1][j+1]==z[i][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,f=0;\nchar q;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&q);\nif(q=='#')\na[i][j]=1;\nif(q=='.')\na[i][j]=0;\n}\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n f=a[i][j]+a[i][j+1]+a[i+1][j]+a[i+1][j+1];\n if(f!=2)\n {\n printf(\"YES\");\n return 0;\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tchar grid[4][4];\n\tint i,j,x,y,flag,sum;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&grid[i][j]);\n\t\t\t//printf(\"%c\",grid[i][j]);\n\t\t}\n\t\tscanf(\"\\n\");\n\t\t//printf(\"\\n\");\n\t}\n\t\n\tfor(x=0;x<3;x++)\n\t{\n\t\tfor(y=0;y<3;y++)\n\t\t{\n\t\t\tsum=0;\n\t\t\tflag=0;\n\t\t\tfor(i=x;i<x+2;i++)\n\t\t\t{\n\t\t\t\tfor(j=y;j<y+2;j++)\n\t\t\t\t{\n\t\t\t\t\tsum+=grid[i][j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(sum==3*'#'+'.')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==3*'.'+'#')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==4*'.')\n\t\t\t\tflag=1;\n\t\t\telse if(sum==4*'#')\n\t\t\t\tflag=1;\n\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\t\n\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\t\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,mat[10][10],m,v,a;\n char c;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&c);\n if(c=='.')\n mat[i][j]=1;\n else\n mat[i][j]=2;\n }\n scanf(\"%*c\");\n }\n v=0;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n m=0;\n if(mat[i][j]==mat[i][j+1])\n m++;\n if(mat[i][j]==mat[i+1][j])\n m++;\n if(mat[i][j]==mat[i+1][j+1])\n m++;\n if(m>=2)\n {\n v=1;\n }\n m=0;\n if(mat[i][j]==1)\n a=2;\n else\n a=1;\n if(a==mat[i][j+1])\n m++;\n if(a==mat[i+1][j])\n m++;\n if(a==mat[i+1][j+1])\n m++;\n if(m>=3)\n {\n v=1;\n }\n }\n }\n if(v==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4][4]={0};\n char c;\n\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n scanf(\"%c\",&c);\n\n if(c=='#')\n a[i][j]=1;\n }\n\n scanf(\"\\n\");\n }\n\n for(int i=0;i<3;i++)\n for(int j=0;j<3;j++)\n {\n if((a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1]) !=2)\n {printf(\"YES\"); return 0;}\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,j,a,b,t,d;\nchar aa[6][6];\nint main()\n{\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<4;j++)\n\t\t\tscanf(\" %c\",&aa[i][j]);\n\tfor(i=0;i<3;i++)for(j=0;j<3;j++)\n\t\t{\n\t\t\tt=0;\n\t\t\tfor(a=i;a<i+2;a++)for(b=j;b<j+2;b++)if(aa[a][b]=='.')t++;\n\t\t\tif(t!=2)\n\t\t\t{printf(\"YES\");return 0;}\n\t\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint i,j,k,flag=0,flag1=0,flag2=1,n,h,d;\n char c[5][5],str[5]; \n \n\t//for(i=0;i<4;i++)\n\t//{\n\t\n\tfor(j=0;j<4;j++)\n\t{\n\t\tscanf(\"%s\",str);\nfor(i=0;i<4;i++)\n\t{\n\tif(str[i]=='#')\n\tc[j][i]='#';\n\telse\n\tc[j][i]='.';\n\t}\n\t\t\n\t}\n\t/*printf(\"\\n\\n\");\nfor(i=0;i<4;i++)\n\t{\n\t\n\tfor(j=0;j<4;j++)\n\t{\n\t\tprintf(\"%c\",c[i][j]);\n\n\t}\n\tprintf(\"\\n\");\n\t\t\n\t}\n\t//printf(\"%c\",c[1][1]);\n\tgetch();*/\n\t\n\t\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(j=0;j<3;j++)\n\t\t{h=0;d=0;\n // if((c[i][j]=='#')&&(c[i+1][j]=='#') &&(c[i][j+1]=='#')&&(c[i+1][j+1]=='#')||(c[i][j]=='.')&&(c[i+1][j]=='.') &&(c[i][j+1]=='.')&&(c[i+1][j+1]=='.'))\n // {flag=1;break;}\n if(c[i][j]=='#')\n h++;else d++;\n \n if(c[i][j+1]=='#')\n h++;else d++;\n \n \n if(c[i+1][j]=='#')\n h++;else d++;\n \n \n if(c[i+1][j+1]=='#')\n { h++;}\n \n else\n {d++;}\n \n if(abs(h-d)>=2)\n {flag=1;break;}\n else\n {flag=0;}\n \n //printf(\"%d %d\",h,d);\n //getch();\n }\n if(flag)\n {flag1=1;break;}\n }\n if(flag1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n //getch();\n return 0;\n }\n \n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tchar **square;\n\tsquare=(char **)malloc(sizeof(char *)*4);\n\tint i,j;\n\tfor(i=0;i<4;i++)\n\t{\n\t\t*(square+i)=(char *)malloc(sizeof(char)*4);\n\t}\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\" %s\",*(square+i));\n\t}\n\t//\n\tint *check=(int *)malloc(sizeof(int)*2);\n\t//in check...\n\t//position 1 will be used for #\n\t//and 2 for .\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(j=0;j<3;j++)\n\t\t{\n\t\t\t*(check)=*(check+1)=0;\n\t\t\t//# check\n\t\t\tif(square[i][j]=='#')\n\t\t\t{\n\t\t\t\t(*(check))++;\n\t\t\t}\n\t\t\tif(square[i][j+1]=='#')\n\t\t\t{\n\t\t\t\t(*(check))++;\n\t\t\t}\n\t\t\tif(square[i+1][j]=='#')\n\t\t\t{\n\t\t\t\t(*(check))++;\n\t\t\t}\n\t\t\tif(square[i+1][j+1]=='#')\n\t\t\t{\n\t\t\t\t(*(check))++;\n\t\t\t}\n\t\t\t// . check\n\t\t\tif(square[i][j]=='.')\n\t\t\t{\n\t\t\t\t(*(check+1))++;\n\t\t\t}\n\t\t\tif(square[i+1][j]=='.')\n\t\t\t{\n\t\t\t\t(*(check+1))++;\n\t\t\t}\n\t\t\tif(square[i][j+1]=='.')\n\t\t\t{\n\t\t\t\t(*(check+1))++;\n\t\t\t}\n\t\t\tif(square[i+1][j+1]=='.')\n\t\t\t{\n\t\t\t\t(*(check+1))++;\n\t\t\t}\n\t\t\t//checking possibility of passing\n\t\t\tif(*(check+1)==3 && *(check)==1 || *(check+1)==1 && *(check)==3 || *(check+1)==4 || *(check)==4)\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j+1]==tab[i+1][j])&&(tab[i][j+1]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j;\n char ch;\n int f=0;\n char arr[4][4];\n for(i=0;i<4;i++)\n {for(j=0;j<4;j++)\n {scanf(\"%c\",&arr[i][j]);}\n scanf(\"%c\",&ch);}\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n //printf(\"%c \",arr[i][j]);\n if(arr[i][j]==arr[i][j+1] && arr[i][j]==arr[i+1][j])\n {\n printf(\"YES \");\n f=1;\n break;\n }\n else if(arr[i][j]==arr[i][j+1] && arr[i][j]==arr[i+1][j+1])\n {\n printf(\"YES \");\n f=1;\n break;\n }\n else if(arr[i][j]==arr[i+1][j] && arr[i][j]==arr[i+1][j+1])\n {\n printf(\"YES \");\n f=1;\n break;\n }\n else if(arr[i+1][j]==arr[i+1][j+1] && arr[i+1][j]==arr[i][j+1])\n {\n printf(\"YES\");\n f=1;\n break;\n }\n }\n //printf(\"\\n\");\n if(f==1)\n break;\n }\n if(f==0)\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a[4][4];\nint i,j,x,y;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&a[i][j]);\n}\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n x=0;\n y=0;\n if(a[i][j]=='#')\n x++;\n else\n y++;\n if(a[i+1][j]=='#')\n x++;\n else\n y++;\n if(a[i][j+1]=='#')\n x++;\n else\n y++;\n if(a[i+1][j+1]=='#')\n x++;\n else\n y++;\n if(x!=y)\n {\n printf(\"YES\");\n return 0;\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,j,a,b,t,d;\nchar aa[6][6];\nint main()\n{\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<4;j++)\n\t\t\tscanf(\" %c\",&aa[i][j]);\n\tfor(i=0;i<3;i++)for(j=0;j<3;j++)\n\t\t{\n\t\t\tt=0;\n\t\t\tfor(a=i;a<i+2;a++)for(b=j;b<j+2;b++)if(aa[a][b]=='.')t++;\n\t\t\tif(t!=2)\n\t\t\t{printf(\"YES\");return 0;}\n\t\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar f[5][5];\n\tint i,j,k,g;\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%s\",f[i]);\n\t}\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tint q=0;\n\t\t\tfor(k=i;k<=i+1;k++){\n\t\t\t\tfor(g=j;g<=j+1;g++){\n\t\t\t\t\tq+=(f[k][g]=='#');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(q!=2){\n\t\t\t\treturn puts(\"YES\");\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"NO\");\n}"}, {"source_code": "//In the name of God\n\n#include <stdio.h>\n\nint main()\n{\n\tint i,j;\n\tchar c[50][50];\n\tfor(i=1;i<=4;i++)\n\t\tfor(j=1;j<=4;)\n\t\t{\n\t\t\tscanf(\"%c\",&c[i][j]);\n\t\t\tif(c[i][j]!='\\n')\n\t\t\t\tj++;\n\t\t}\n\tfor(i=1;i<=4;i++)\n\t{\n\t\tfor(j=1;j<=4;j++)\n\t\t\tif((c[i][j]==c[i+1][j] && c[i+1][j+1]==c[i][j]) || (c[i][j]==c[i+1][j] && c[i][j]==c[i][j+1]) || (c[i][j]==c[i][j+1] && c[i][j]==c[i+1][j+1]))\n\t\t\t{\n\t\t\t\t//printf(\"4\\n\");\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if((c[i][j]==c[i-1][j] && c[i][j]==c[i-1][j-1]) || (c[i][j]==c[i-1][j] && c[i][j]==c[i][j-1]) || c[i][j]==c[i-1][j-1] && c[i][j]==c[i][j-1])\n\t\t\t{\n\t\t\t\t//printf(\"3\\n\");\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if((c[i][j]==c[i][j-1] && c[i][j]==c[i+1][j-1]) || (c[i][j]==c[i+1][j] && c[i][j]==c[i+1][j-1]) || (c[i][j]==c[i][j-1] && c[i][j]==c[i+1][j]))\n\t\t\t{\n\t\t\t\t//printf(\"2\\n\");\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if((c[i][j]==c[i-1][j] && c[i][j]==c[i-1][j-1]) || (c[i][j]==c[i-1][j] && c[i][j]==c[i][j-1]) || (c[i][j]==c[i-1][j-1] && c[i][j]==c[i][j-1]))\n\t\t\t{\n\t\t\t\t/*if(c[i][j]==c[i][j+1])\n\t\t\t\t\tprintf(\"%c %c RE\\n\",c[i][j],c[i-1][j-1]);\n\t\t\t\tprintf(\"%d %d 1\\n\",i,j);\n\t\t\t\t*/printf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n char s[4][4] ;\n int i , j, k;\n for(i=0;i<4;i++){\n gets(s[i]) ;\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if((s[i][j] == s[i+1][j] && s[i][j+1] != s[i+1][j+1]) ||(s[i][j] != s[i+1][j] && s[i][j+1] == s[i+1][j+1] || (s[i][j] == s[i+1][j] && s[i][j+1] == s[i+1][j+1] && s[i][j] == s[i][j+1]))){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,j,c=0,t=0,d=0;\nchar s[4][5];\nfor(i=0;i<4;i++)\nscanf(\"%s\",s[i]);\nfor(i=0;i<4;i++)\n{for(j=0;j<4;j++)\n{if(j+1<4)\n{if(s[i][j+1]==s[i][j])\nc++;\nelse\nd++;\n}\nif(i+1<4)\n{if(s[i+1][j]==s[i][j])\nc++;\nelse\nd++;\n}\nif(i+1<4&&j+1<4)\n{if(s[i+1][j+1]==s[i][j])\nc++;\nelse\nd++;\n}\nif((c==3||c==2)||(d==3))\n{t++;\nbreak;}\nelse\n{c=0;\nd=0;}\n}\nif(t==1)\nbreak;\nelse\n{c=0;\nd=0;}}\nif(c==0&&d==0)\nprintf(\"NO\");\nelse\nprintf(\"YES\");\nreturn(0);}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n char s[4][4] ;\n int i , j, k;\n for(i=0;i<4;i++){\n gets(s[i]) ;\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if((s[i][j] == s[i+1][j] && s[i][j+1] != s[i+1][j+1]) ||(s[i][j] != s[i+1][j] && s[i][j+1] == s[i+1][j+1] || (s[i][j] == s[i+1][j] && s[i][j+1] == s[i+1][j+1] && s[i][j] == s[i][j+1]))){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a;\nint inp[4][4],c=0,i,j;\nfor(i=0;i<4;i++)\n{for(j=0;j<5;j++)\n{\nscanf(\"%c\",&a);\nif(a =='#')\n inp[i][j]=1;\n if(a =='.') inp[i][j]=0;\n}\n}\nfor(i=0;i<3;i++)\n{\n for(j=0;j<3;j++){\n c = inp[i][j]+inp[i+1][j]+inp[i][j+1]+inp[i+1][j+1];\n if(c!=2){\n printf(\"YES\");\n return 0;}}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\nint main()\n{\n char str[4][4],temp;\n int i,j,found=0,count;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",str[i]);\n }\n for(i=0;i<3 && found==0;i++)\n {\n for(j=0;j<3 && found==0;j++)\n {\n count=1;\n temp=str[i][j];\n if(str[i][j+1]==temp)\n count++;\n if(str[i+1][j]==temp)\n count++;\n if(str[i+1][j+1]==temp)\n count++;\n if(count==4 || count==3 || count==1)\n found=1;\n }\n }\n if(found==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n// getch();\n// clrscr();\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n // printf(\"%c\",x[i][j]);\n //if(i==1&&j==3)\n // printf(\"%c\\n\",x[i][j]);\n if (x[i][j]=='\\n')\n j=j-1;\n }\n }\n int flag=0;\n for (i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n// printf(\"%d %d\\n\",i,j);\n// printf(\"%c\\n\",x[i][j]);\n // printf(\"%d\\n%d\\nx[i][j] %c\\nx[i][j-1] %c\\nx[i+1][j] %c %d %d\\nx[i+1][j-1] %c\\nx[i+1][j+1] %c\\n\",i,j,x[i][j],x[i][j-1],x[i+1][j],i+1,j,x[i+1][j-1],x[i+1][j+1]);\n if ((x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int sp, i, j;\n char s[4][4];\n for(i = 0; i < 4; i++)\n {\n scanf(\"%s\", s[i]);\n }\n for(i = 0; i < 3; i++)\n {\n for(j = 0; j < 3; j++)\n {\n sp = 0;\n if(s[i][j] == '.')\n {\n sp++;\n }\n if(s[i + 1][j] == '.')\n {\n sp++;\n }\n if(s[i + 1][j + 1] == '.')\n {\n sp++;\n }\n if(s[i][j + 1] == '.')\n {\n sp++;\n }\n if((sp <= 1) || (sp >= 3))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j+1]==tab[i+1][j])&&(tab[i][j+1]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4],x;\n int i,j,temp=0;\n for(i = 0;i<4;i++)\n {\n for(j=0;j<5;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;((i<3)&&(temp!=1));i++)\n {\n for(j=0;j<3;j++)\n {\n if(((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j]))||((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j+1]))|| ((a[i][j]==a[i+1][j+1])&&(a[i][j]==a[i+1][j])) ||((a[i+1][j]==a[i][j+1])&&(a[i+1][j]==a[i+1][j+1])))\n {\n temp= 1;\n break;\n }\n }\n }\n if(temp== 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j,u=0; unsigned char a[4][4];\n for(i=0;i<3;i++)\n {\n for(j=0;j<4;j++) scanf(\"%c\", &a[i][j]);\n scanf(\"\\n\");\n }\n for(j=0;j<4;j++) scanf(\"%c\", &a[3][j]);\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if((2*a[i][j]==a[i+1][j]+a[i][j+1]) || (2*a[i][j]==a[i+1][j]+a[i+1][j+1]) || (2*a[i][j]==a[i][j+1]+a[i+1][j+1]) || (2*a[i+1][j]==a[i][j+1]+a[i+1][j+1])) u=1;\n }\n }\n if(u==1) printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "int main()\n{\n char a[4][4];\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n scanf(\" %c\",&a[i][j]);\n }\n }\n int dec = 0;\n for(int i=0;i<3;i++)\n {\n \n for(int j=0;j<3;j++)\n {\n int count1=0,count2=0;\n if(a[i][j]=='#')\n count1++;\n else\n count2++;\n if(a[i][j+1]=='#')\n count1++;\n else\n count2++;\n if(a[i+1][j]=='#')\n count1++;\n else\n count2++;\n if(a[i+1][j+1]=='#')\n count1++;\n else\n count2++;\n if(count1==3 || count2==3 ||count2==4||count2==0)\n {\n dec=1;\n break;\n }\n }\n if(dec==1)\n {\n break;\n }\n }\n if(dec==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\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 fill(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 4\n#define MODBY 1000000007\n\ntypedef long long int lld;\ntypedef long double Lf;\nint preprocess()\n{\n return 0;\n}\nchar board[MAX][MAX+1];\n\nint main()\n{\n int cases;\n int i,j,n;\n int a[MAX];\n preprocess();\n for(i=0;i<4;++i)\n ss(board[i]);\n for(i=0;i<3;++i)\n for(j=0;j<3;++j){\n //printf(\"i j %d %d\\n\",i,j);\n int cnt=0;\n cnt+=(board[i][j]=='#');\n cnt+=(board[i+1][j]=='#');\n cnt+=(board[i][j+1]=='#');\n cnt+=(board[i+1][j+1]=='#');\n if(cnt!=2){\n printf(\"YES\\n\");\n exit(0);\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,j,flag,b=0,i,a[4][4];\n\tchar c[5];\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%s\",c);\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tif(c[j]=='.')\n\t\t\ta[i][j]=0;\n\t\t\telse\n\t\t\ta[i][j]=1;\n\t\t}\n\t}\n\tflag=0;\n\tif(a[0][0]+a[0][1]+a[1][0]+a[1][1]>=3||a[0][0]+a[0][1]+a[1][0]+a[1][1]<=1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(a[0][1]+a[0][2]+a[1][1]+a[1][2]>=3||a[0][1]+a[0][2]+a[1][1]+a[1][2]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[0][2]+a[0][3]+a[1][2]+a[1][3]>=3||a[0][2]+a[0][3]+a[1][2]+a[1][3]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][0]+a[1][1]+a[2][0]+a[2][1]>=3||a[1][0]+a[1][1]+a[2][0]+a[2][1]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][1]+a[1][2]+a[2][1]+a[2][2]>=3||a[1][1]+a[1][2]+a[2][1]+a[2][2]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][2]+a[1][3]+a[2][2]+a[2][3]>=3||a[1][2]+a[1][3]+a[2][2]+a[2][3]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][0]+a[2][1]+a[3][0]+a[3][1]>=3||a[2][0]+a[2][1]+a[3][0]+a[3][1]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][1]+a[2][2]+a[3][1]+a[3][2]>=3||a[2][1]+a[2][2]+a[3][1]+a[3][2]<=1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][2]+a[2][3]+a[3][2]+a[3][3]>=3||a[2][2]+a[2][3]+a[3][2]+a[3][3]<=1)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n#define OUTPUT freopen(\"myfile.txt\",\"w\",stdout);\n#define INPUT freopen(\"input.txt\",\"r\",stdin);\n\nint main()\n{\n int i,j,cnt,test;\n char mat[20][20];\n\n while(gets(mat[0]))\n {\n gets(mat[1]);\n gets(mat[2]);\n gets(mat[3]);\n\n cnt=0;\n test=0;\n\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n cnt=0;\n\n if(mat[i][j]=='#')\n cnt++;\n if(mat[i][j+1]=='#')\n cnt++;\n if(mat[i+1][j]=='#')\n cnt++;\n if(mat[i+1][j+1]=='#')\n cnt++;\n\n if(cnt>=3)\n {\n test=1;\n goto ans;\n\n }\n\n cnt=0;\n\n if(mat[i][j]=='.')\n cnt++;\n if(mat[i][j+1]=='.')\n cnt++;\n if(mat[i+1][j]=='.')\n cnt++;\n if(mat[i+1][j+1]=='.')\n cnt++;\n\n if(cnt>=3)\n {\n test=1;\n goto ans;\n\n }\n }\n }\n\n ans:\n if(test==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n }\n\n return 0;\n\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j;\n char a[4][4];\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n { if (a[i][j]==a[i][j+1])\n { if((a[i+1][j]!=a[i+1][j+1]) || (a[i][j]==a[i+1][j])) { printf(\"YES\"); return 0; }}\n else if(a[i][j]!=a[i][j+1])\n { if(a[i+1][j]==a[i+1][j+1]) { printf(\"YES\"); return 0;}}\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j;\n char a[4][4];\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n { if (a[i][j]==a[i][j+1])\n { if((a[i+1][j]!=a[i+1][j+1]) || (a[i][j]==a[i+1][j])) { printf(\"YES\"); return 0; }}\n else if(a[i][j]!=a[i][j+1])\n { if(a[i+1][j]==a[i+1][j+1]) { printf(\"YES\"); return 0;}}\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,k;\n char a[4][4];\n for(i=0;i<4;i++)\n {\n for(k=0;k<4;k++)\n scanf(\"%c\",&a[k][i]);\n scanf(\"%*c\");\n }\n for(i=0;i<3;i++)\n {\n for(k=0;k<3;k++)\n { \n if((a[k][i]==a[k+1][i])&&(a[k][i]==a[k][i+1])&&(a[k][i]==a[k+1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if((a[k][i]==a[k+1][i])&&(a[k][i]==a[k][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if((a[k][i]!=a[k+1][i])&&(a[k][i]!=a[k][i+1])&&(a[k][i]!=a[k+1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n else if(k>0)\n {\n if((a[k][i]!=a[k-1][i])&&(a[k][i]!=a[k][i+1])&&(a[k][i]!=a[k-1][i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n }\n printf(\"NO\");\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,j,cnt=0,m,n;\n char a[5][5];\n\nfor(i=0;i<5;i++)\n{for(j=0;j<5;j++)\n{scanf(\"%c\",&a[i][j]);\n}}\nfor(i=0;i<3;i++)\n{for(j=0;j<3;j++)\n{if((a[i][j]==a[i+1][j])&&(a[i][j]==a[i+1][j+1]))\n{\ncnt++;}\nelse if((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j+1]))\n{\ncnt++;}\nelse if((a[i][j+1]==a[i+1][j])&&(a[i][j+1]==a[i+1][j+1]))\n{\ncnt++;}\nelse if((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j]))\n{\ncnt++;}\nelse\n{continue;}\n}}\nif(cnt>0)\n{printf(\"YES\");}\nelse\n{printf(\"NO\");}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,flag=0,j;\n char s[4][5],c;\n for (i=0; i<4; ++i)\n {\n scanf(\"%s\",s[i]);\n }\n for (i=0; i<4; ++i)\n {\n for(j=0; j<4; ++j)\n {\n if((s[i][j]==s[i][j+1]&&s[i][j+1]==s[i+1][j+1])||(s[i][j]==s[i][j+1]&&s[i+1][j]==s[i][j+1]))\n {\n flag=1;\n break;\n }\n else if((s[i][j]==s[i-1][j]&&s[i][j]==s[i][j+1])||(s[i][j]==s[i-1][j]&&s[i][j-1]==s[i][j]))\n {\n flag=1;\n break;\n }\n\n }\n if(flag==1)\n {\n printf(\"YES\");\n break;\n }\n }\n if(flag==0)\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int i,j,c,c2;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n getchar();\n }\n\n for(i=0;i<3;i++)\n {\n c=0;\n c2=0;\n for(j=0;j<3;j++)\n {\n if(a[i][j]=='#')\n c++;\n if(a[i][j+1]=='#')\n c++;\n if(a[i+1][j]=='#')\n c++;\n if(a[i+1][j+1]=='#')\n c++;\n if(a[i][j]=='.')\n c2++;\n if(a[i][j+1]=='.')\n c2++;\n if(a[i+1][j]=='.')\n c2++;\n if(a[i+1][j+1]=='.')\n c2++;\n if(c>=3||c2>=3)\n {\n printf(\"YES\\n\");\n return 0;\n }\n c=0;\n c2=0;\n }\n\n }\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nstruct string\n{\n char s[4];\n};\nint main()\n{\n int i,j,sum=0,temp=0;\n char a[4][4];\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n temp=1;\n if(a[i][j+1]==a[i][j])\n temp++;\n if(a[i+1][j]==a[i][j])\n temp++;\n if(a[i+1][j+1]==a[i][j])\n temp++;\n sum=sum>temp?sum:temp;\n }\n j==3;\n if(sum>=3);\n else\n for(i=0;i<3;i++)\n {\n temp=1;\n if(a[i][j]==a[i+1][j])\n temp++;\n if(a[i][j]==a[i+1][j-1])\n temp++;\n sum=sum>temp?sum:temp;\n } \n if(sum>=3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,x1,y1,k,sum2,min,f,r,o,sum1,sum=0,y,count1, a[26]={0};\nchar a1[10][10];\nfor(i=0;i<4;i++){\n scanf(\"%s\",a1[i]);\n}\nfor(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n x1=0;\n \n if(a1[i][j]=='#'){\n x1++;\n }\n if(a1[i][j+1]=='#'){\n x1++;\n }\n if(a1[i+1][j+1]=='#'){\n x1++;\n }\n if(a1[i+1][j]=='#'){\n x1++;\n }\n if(x1==0 || x1==3 || x1==1 || x1==4){\n printf(\"YES\\n\");\n return 0;\n }\n }\n}\n\nprintf(\"NO\");\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char ch[5][5]={'\\0'};\n int f=0,cnt=0;\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n scanf(\" %c\",&ch[i][j]);\n }\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n cnt=0;\n if(ch[i][j]=='#')//&&(ch[i][j+1]=='#'||ch[i+1][j+1]=='#')&&ch[i+1][j]=='#')\n {\n if(ch[i][j+1]=='#')\n {\n cnt++;\n if(ch[i+1][j+1]=='#')\n cnt++;\n if(ch[i+1][j]=='#')\n cnt++;\n }\n else\n {\n if(ch[i-1][j]=='#')\n cnt++;\n if(ch[i-1][j-1]=='#')\n cnt++;\n if(ch[i][j-1]=='#')\n cnt++;\n }\n if(cnt>=2)\n {\n f=1;\n break;\n }\n }\n else if(ch[i][j]=='.')//&&ch[i][j+1]=='.'&&ch[i+1][j]=='.')\n {\n \n if(ch[i][j+1]=='.')\n {\n cnt++;\n if(ch[i+1][j+1]=='.')\n cnt++;\n if(ch[i+1][j]=='.')\n cnt++;\n }\n else\n {\n if(ch[i-1][j]=='.')\n cnt++;\n if(ch[i-1][j-1]=='.')\n cnt++;\n if(ch[i][j-1]=='.')\n cnt++;\n }\n if(cnt>=2)\n {\n f=1;\n break;\n }\n }\n }\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char (a[5])[5], b;\n int test=0, test2=0;\n for(int i=0;i<4;i++)\n {\n scanf(\"%s\", a[i]);\n }\n //printf(\"%c%c\\n%c%c\", a[0+1][0+1],a[1+0][1+1],a[1+1][0+1],a[1+1][1+1]);\n\n for(int i=0;i<3;i++)\n {\n for(int j=0;j<3;j++)\n {\n test=1;test2=0;\n b=a[i][j];\n //printf(\"%\\n%i%i,%i%i\\n%i%i,%i%i\\n%\", i,j,i,j+1, i+1,j, i+1,j+1);\n //printf(\"%\\n%c%c\\n%c%c\\n%\", b,a[i][j+1], a[i+1][j], a[i+1][j+1]);\n if( a[i][j+1] == b)\n test++;\n else\n test2++;\n if( a[i+1][j] == b)\n test++;\n else\n test2++;\n if( a[i+1][j+1] == b)\n test++;\n else\n test2++;\n if(test>2 || test2>2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[4][5];\n int i,j;\n for (i=0;i<4;i++){\n for (j=0;j<5;j++){\n scanf(\"%c\",&a[i][j]);\n if (j==4){\n a[i][j]='\\0';\n }\n }\n }\n for (i=0;i<3;i++){\n for (j=0;j<3;j++){\n int count=0;\n int count2=0;\n if (a[i][j]=='#'){\n count++;\n }\n if (a[i][j+1]=='#'){\n count++;\n }\n if (a[i+1][j]=='#'){\n count++;\n }\n if (a[i+1][j+1]=='#'){\n count++;\n }\n if (count==4 || count==3){\n printf(\"YES\");\n exit(0);\n }\n if (a[i][j]=='.'){\n count2++;\n }\n if (a[i][j+1]=='.'){\n count2++;\n }\n if (a[i+1][j]=='.'){\n count2++;\n }\n if (a[i+1][j+1]=='.'){\n count2++;\n }\n if (count2==4 || count2==3){\n printf(\"YES\");\n exit(0);\n }\n }\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j;\n\tchar z[15][15];\n\tfor (i=0;i<4;i++){\n\t\tscanf(\"%s\",z[i]);\n\t}\n\tfor (i=0;i<3;i++){\n\t\tfor (j=0;j<3;j++){\n\t\t\tif (z[i][j]==z[i+1][j] && z[i+1][j]==z[i+1][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (z[i][j]==z[i][j+1] && z[i][j+1]==z[i+1][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse if (z[i+1][j]==z[i+1][j+1] && z[i+1][j+1]==z[i][j+1]){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar s[5][5];\nint dnf(int x,int y)\n{\n int v=1;\n if(y==3)\n dnf(x+1,0);\n else if(x+1<4&&y+1<4)\n {\n if(s[x][y]==s[x][y+1])\n v++;\n if(s[x][y]==s[x+1][y])\n v++;\n if(s[x][y]==s[x+1][y+1])\n v++;\n if(v>2||v==1)\n return 1;\n else\n dnf(x,y+1);\n }\n}\nint main()\n{\n int i,j;\n for(i=0; i<4; i++)\n scanf(\"%s\",&s[i]);\n if(dnf(0,0)==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_repaint(char arr[][4])\n{\nint i ,j;\n for (i=0;i<4;i++)\n for(j=0;j<4;j++)\n {\n if(i+1<4 &&j+1<4)\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(i+1<4 &&j-1>=0)\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(i-1>=0 &&j+1<4)\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i-1][j+1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(i-1>=0 &&j-1>=0)\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i-1][j-1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n if(i+1<4 &&j+1<4)\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(i+1<4 &&j-1>=0)\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(i-1>=0 &&j+1<4)\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i-1][j+1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(i-1>=0 &&j-1>=0)\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i-1][j-1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n }\n return 0 ;\n}\nint main()\n{\n char arr[4][4];\n int i;\n for (i=0;i<4;i++)\n scanf(\"%s\",arr[i]);\n\nif(check_repaint(arr))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char ch[5][5]={'\\0'};\n int f=0,cnt=0;\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n scanf(\" %c\",&ch[i][j]);\n }\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n cnt=0;\n if(ch[i][j]=='#')//&&(ch[i][j+1]=='#'||ch[i+1][j+1]=='#')&&ch[i+1][j]=='#')\n {\n if(ch[i][j+1]=='#')\n {\n cnt++;\n if(ch[i+1][j+1]=='#')\n cnt++;\n if(ch[i+1][j]=='#')\n cnt++;\n }\n else\n {\n if(ch[i-1][j]=='#')\n cnt++;\n if(ch[i-1][j-1]=='#')\n cnt++;\n if(ch[i][j-1]=='#')\n cnt++;\n }\n if(cnt>=2)\n {\n f=1;\n break;\n }\n }\n else if(ch[i][j]=='.')//&&ch[i][j+1]=='.'&&ch[i+1][j]=='.')\n {\n \n if(ch[i][j+1]=='.')\n {\n cnt++;\n if(ch[i+1][j+1]=='.')\n cnt++;\n if(ch[i+1][j]=='.')\n cnt++;\n }\n else\n {\n if(ch[i-1][j]=='.')\n cnt++;\n if(ch[i-1][j-1]=='.')\n cnt++;\n if(ch[i][j-1]=='.')\n cnt++;\n }\n if(cnt>=2)\n {\n f=1;\n break;\n }\n }\n }\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4][4];\n int i,j,k,l;\n char t;\n for(i=0;i<4;i++)\n {\n for(j=0;j<=4;j++)\n {\n scanf(\"%c\",&t);\n if(t=='#')\n a[i][j]=1;\n if(t=='.')\n a[i][j]=0;\n }\n }\n for(i=0; i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n k=0;\n l=0;\n if(a[i][j]==0)\n k++;\n else\n l++;\n if(a[i][j+1]==0)\n k++;\n else\n l++;\n if(a[i+1][j]==0)\n k++;\n else\n l++;\n if(a[i+1][j+1]==0)\n k++;\n else\n l++;\n if(k!=l)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[5][5];\n\tint i, j, b[4][4], sum;\n\tfor( i = 0; i < 4; i++)\n\t\tscanf(\"%s\", a[i]);\n\tfor( i = 0; i < 4; i++){\n\t\tfor( j = 0; j < 4; j++){\n\t\t\tif( '.' == a[i][j])\n\t\t\t\tb[i][j] = 0;\n\t\t\telse\n\t\t\t\tb[i][j] = 1;\n\t\t}\n\t}\n\tfor( i = 0; i < 3; i++){\n\t\tfor( j = 0; j < 3; j++){\n\t\t\tsum = b[i][j] + b[i][j+1] + b[i+1][j] + b[i+1][j+1];\n\t\t\tif( sum != 2 ){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j+1]==tab[i+1][j])&&(tab[i][j+1]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\tchar a[4][4];\n\n\tint i, j;\n\n\tfor (i = 0; i < 4; i++) {\n\t\tfor (j = 0; j < 4; j++) {\n\t\t\ta[i][j] = getchar();\n\t\t}\n\t\tgetchar();\n\t}\n\n\tfor (i = 1; i < 4; i++) {\n\t\tfor (j = 1; j < 4; j++) {\n\t\t\tif ((a[i - 1][j - 1] == '#' && a[i][j - 1] == '#' && a[i][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i][j - 1] == '.'\n\t\t\t\t\t\t\t&& a[i][j] == '.')\n\t\t\t\t\t||\n\n\t\t\t\t\t(a[i - 1][j - 1] == '#' && a[i][j - 1] == '#'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i][j - 1] == '.'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '.')\n\t\t\t\t\t||\n\n\t\t\t\t\t(a[i - 1][j - 1] == '#' && a[i - 1][j] == '#'\n\t\t\t\t\t\t\t&& a[i][j] == '#')\n\t\t\t\t\t|| (a[i - 1][j - 1] == '.' && a[i - 1][j] == '.'\n\t\t\t\t\t\t\t&& a[i][j] == '.') ||\n\n\t\t\t\t\t(a[i][j - 1] == '#' && a[i][j] == '#' && a[i - 1][j] == '#')\n\t\t\t\t\t|| (a[i][j - 1] == '.' && a[i][j] == '.'\n\t\t\t\t\t\t\t&& a[i - 1][j] == '.')) {\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t}\n\t}\n\tputs(\"NO\");\n\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,arr[4][4],j,count,fl=0;\n char str[5];\n i=0;\n while(i<4)\n {\n memset(str,'\\0',5);\n //printf(\"enter the string:\");\n gets(str);\n for(j=0;str[j]!='\\0';j++)\n {\n if(str[j]=='#')\n arr[i][j]=1;\n else if(str[j]=='.')\n arr[i][j]=0;\n }\n i++;\n }\n/* for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n printf(\"%d \",arr[i][j]);\n printf(\"\\n\");\n }*/\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n count=0;\n if(arr[i][j]==1)\n count++;\n if(arr[i][j+1]==1)\n count++;\n if(arr[i+1][j]==1)\n count++;\n if(arr[i+1][j+1]==1)\n count++;\n if(count==3 || count==4 || count==1 || count==0)\n fl=1;\n }\n }\n if(fl==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar paper[4][4];\n\tfor (int i = 0; i < 4; ++i)\n\t{\n\t\tfor (int j = 0; j < 4; ++j)\n\t\t{\n\t\t\tpaper[i][j] = getchar();\n\t\t}\n\t\tgetchar();\n\t}\n\n\tchar count = 0;\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tfor (int j = 0; j < 3; ++j)\n\t\t{\n\t\t\tif (paper[i][j] == paper[i + 1][j])\n\t\t\t{\n\t\t\t\t++count;\n\t\t\t}\n\t\t\tif (paper[i][j] == paper[i][j + 1])\n\t\t\t{\n\t\t\t\t++count;\n\t\t\t}\n\t\t\tif (paper[i][j] == paper[i + 1][j + 1])\n\t\t\t{\n\t\t\t\t++count;\n\t\t\t}\n\t\t\tif (count != 1)\n\t\t\t{\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tcount = 0;\n\t\t}\n\t}\n\tputs(\"NO\");\n\n\treturn 0;\n}"}, {"source_code": "# include <stdio.h>\n# include <stdlib.h>\n# include <string.h>\n# include <stdbool.h>\n# include <math.h>\n\nint main()\n{\n int i, j, count1 = 0, count2 = 0, count3 = 0, count4 = 0, count5 = 0, count6 = 0, count7 = 0, count8 = 0, count9 = 0;\n bool escape = false;\n char s;\n for(i = 0; i < 4; i++)\n {\n for(j = 0; j < 4; j++)\n {\n scanf(\"%c\", &s);\n if(i<2&&j<2&&s=='#')\n {\n count1++;\n }\n if(i>1&&j<2&&s=='#')\n {\n count2++;\n }\n if(i<2&&j>1&&s=='#')\n {\n count3++;\n }\n if(i>1&&j>1&&s=='#')\n {\n count4++;\n }\n if(i<2&&j>0&&j<3&&s=='#')\n {\n count5++;\n }\n if(i>0&&i<3&&j>0&&j<3&&s=='#')\n {\n count6++;\n }\n if(i>1&&j>0&&j<3&&s=='#')\n {\n count7++;\n }\n if(i>0&&i<3&&j>1&&s=='#')\n {\n count8++;\n }\n if(i>0&&i<3&&j<2&&s=='#')\n {\n count9++;\n }\n }\n getchar();\n }\n if(count1%2||count2%2||count3%2||count4%2||count5%2||count6%2||count7%2||count8%2||count9%2)\n {\n escape = true;\n }\n if((!count1)||(!count2)||(!count3)||(!count4)||(!count5)||(!count6)||(!count7)||(!count8)||(!count9))\n {\n escape = true;\n }\n if(count1==4||count2==4||count3==4||count4==4||count5==4||count6==4||count7==4||count8==4||count9==4)\n {\n escape = true;\n }\n if(escape)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define mian main\nint mian (void) {\n int a[4][4], s, flag = 0;\n char c;\n for (int i = 0; i < 4; ++i)\n for (int j = 0; j < 4; ++j) {\n c = getchar();\n while (c != '#' && c != '.') c = getchar();\n if (c == '#') a[i][j] = 1;\n else a[i][j] = 0;\n }\n for (int i = 0; i < 3; ++i) \n for (int j = 0; j < 3; ++j) {\n s = a[i][j] + a[i][j+1] + a[i+1][j] + a[i+1][j+1];\n if (s != 2) {\n printf(\"YES\\n\");\n flag = 1;\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint a[4][4];\nint n = 4, m, i, j;\nchar s[4];\n\nint main()\n{\n for (i= 0; i<n;i++)\n {\n scanf (\"%s\", &s);\n if (s[0] == '#') a[i][0] =1; else a[i][0]=0;\n if (s[1] == '#') a[i][1] =1; else a[i][1]=0;\n if (s[2] == '#') a[i][2] =1; else a[i][2]=0;\n if (s[3] == '#') a[i][3] =1; else a[i][3]=0;\n }\n for (i= 0; i<n - 1;i++)\n for (j= 0; j<n - 1; j++)\n {\n int s = a[i][j] + a[i][j+1] +a[i+1][j] +a[i+1][j+1];\n if (s != 2) //!= diferit \n {\n printf(\"YES\");\n return 0 ;\n }\n }\n printf (\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,j,c=0,t=0,d=0;\nchar s[4][5];\nfor(i=0;i<4;i++)\nscanf(\"%s\",s[i]);\nfor(i=0;i<4;i++)\n{for(j=0;j<4;j++)\n{if(j+1<4)\n{if(s[i][j+1]==s[i][j])\nc++;\nelse\nd++;\n}\nif(i+1<4)\n{if(s[i+1][j]==s[i][j])\nc++;\nelse\nd++;\n}\nif(i+1<4&&j+1<4)\n{if(s[i+1][j+1]==s[i][j])\nc++;\nelse\nd++;\n}\nif((c==3||c==2)||(d==3))\n{t++;\nbreak;}\nelse\n{c=0;\nd=0;}\n}\nif(t==1)\nbreak;\nelse\n{c=0;\nd=0;}}\nif(c==0&&d==0)\nprintf(\"NO\");\nelse\nprintf(\"YES\");\nreturn(0);}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void){\n\tchar s[10][10];\n\tint i,j;\n\tint ok=1;\n\tint a=0,b=0;\n\tfor (i=0; i<4; i++)\n\t{\n\t\tfor (j=0; j<4; j++)\t\t\n\t\t\tscanf(\"%c\",&s[i][j]);\n\t\tgetchar();\n\t}\n\tfor (i=0; i<3; i++)\n\t{\n\t\tfor (j=0; j<3; j++)\n\t\t{\n\t\t\t\ta=b=0;\n\t\t\t\tif (s[i][j]=='#')\n\t\t\t\t\ta++;\n\t\t\t\tif (s[i][j+1]=='#')\n\t\t\t\t\ta++;\n\t\t\t\tif (s[i+1][j]=='#')\n\t\t\t\t\ta++;\n\t\t\t\tif (s[i+1][j+1]=='#')\n\t\t\t\t\ta++;\n\t\t\t\tif (s[i][j]=='.')\n\t\t\t\t\tb++;\n\t\t\t\tif (s[i][j+1]=='.')\n\t\t\t\t\tb++;\n\t\t\t\tif (s[i+1][j]=='.')\n\t\t\t\t\tb++;\n\t\t\t\tif (s[i+1][j+1]=='.')\n\t\t\t\t\tb++;\t\n\t\tif (a>=3||b>=3){\n\t\t\tprintf(\"YES\");\n\t\t\tok=0;\n\t\t\tgoto out;\n\t\t}\n\t}\n\t}\n\tout:\n\tif (ok){\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\n int x,i,counter =0;\n //scanf(\"%d\",&x);\n char a[4];\n char b[4];\n char c[4];\n char d[4];\n\n\n scanf(\"%s\",&a);\n scanf(\"%s\",&b);\n scanf(\"%s\",&c);\n scanf(\"%s\",&d);\n\n\n for(i=0;i<4;i++)\n {\n if( (a[i] == b[i]) && i==0 && (a[i]==a[i+1] || a[i]==b[i+1]) )\n {\n counter++;\n }\n\n else if( (a[i] == b[i]) && (i==1 ||i==2) && (a[i]==a[i+1] || a[i]==b[i+1] || a[i]==a[i-1] || a[i]==b[i-1]) )\n {\n counter++;\n }\n else if( (a[i] == b[i]) && i==3 && (a[i]==a[i-1] || a[i]==b[i-1]) )\n {\n counter++;\n }\n\n\n else if( (b[i] == c[i]) && i==0 && (b[i]==b[i+1] || b[i]==c[i+1]) )\n {\n counter++;\n }\n\n else if( (b[i] == c[i]) && (i==1 ||i==2) && (b[i]==b[i+1] || b[i]==c[i+1] || b[i]==b[i-1] || b[i]==c[i-1]) )\n {\n counter++;\n }\n else if( (b[i] == c[i]) && i==3 && (b[i]==b[i-1] || b[i]==c[i-1]) )\n {\n counter++;\n }\n\n\n\n\n else if( (c[i] == d[i]) && i==0 && (c[i]==c[i+1] || c[i]==d[i+1]) )\n {\n counter++;\n }\n\n else if( (c[i] == d[i]) && (i==1 ||i==2) && (c[i]==c[i+1] || c[i]==d[i+1] || c[i]==c[i-1] || c[i]==d[i-1]) )\n {\n counter++;\n }\n else if( (c[i] == d[i]) && i==3 && (c[i]==c[i-1] || c[i]==d[i-1]) )\n {\n counter++;\n }\n\n\n\n\n }\n\n\nif (counter >0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\n int x,i,counter =0;\n //scanf(\"%d\",&x);\n char a[4];\n char b[4];\n char c[4];\n char d[4];\n\n\n scanf(\"%s\",&a);\n scanf(\"%s\",&b);\n scanf(\"%s\",&c);\n scanf(\"%s\",&d);\n\n\n for(i=0;i<4;i++)\n {\n if( (a[i] == b[i]) && i==0 && (a[i]==a[i+1] || a[i]==b[i+1]) )\n {\n counter++;\n }\n\n else if( (a[i] == b[i]) && (i==1 ||i==2) && (a[i]==a[i+1] || a[i]==b[i+1] || a[i]==a[i-1] || a[i]==b[i-1]) )\n {\n counter++;\n }\n else if( (a[i] == b[i]) && i==3 && (a[i]==a[i-1] || a[i]==b[i-1]) )\n {\n counter++;\n }\n\n\n else if( (b[i] == c[i]) && i==0 && (b[i]==b[i+1] || b[i]==c[i+1]) )\n {\n counter++;\n }\n\n else if( (b[i] == c[i]) && (i==1 ||i==2) && (b[i]==b[i+1] || b[i]==c[i+1] || b[i]==b[i-1] || b[i]==c[i-1]) )\n {\n counter++;\n }\n else if( (b[i] == c[i]) && i==3 && (b[i]==b[i-1] || b[i]==c[i-1]) )\n {\n counter++;\n }\n\n\n\n\n else if( (c[i] == d[i]) && i==0 && (c[i]==c[i+1] || c[i]==d[i+1]) )\n {\n counter++;\n }\n\n else if( (c[i] == d[i]) && (i==1 ||i==2) && (c[i]==c[i+1] || c[i]==d[i+1] || c[i]==c[i-1] || c[i]==d[i-1]) )\n {\n counter++;\n }\n else if( (c[i] == d[i]) && i==3 && (c[i]==c[i-1] || c[i]==d[i-1]) )\n {\n counter++;\n }\n\n\n\n\n }\n\n\nif (counter >0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar arr[4][4];\n\nint boardval(char * loc)\n{\n\t\tif (*loc == '#')\n\t\t\t\treturn 1;\n\t\telse return -1;\n}\n\nint main(void)\n{\n\t\tfor (int i = 0; i < 4; i++)\n\t\t\t\tfor (int j = 0; j < 4; j++)\n\t\t\t\t\t\tscanf(\"%c \", &arr[i][j]);\n\t\t\n\t\tint sum;\n\t\tfor (int i = 0; i < 3; i++)\n\t\t\t\tfor (int j = 0; j < 3; j++){\n\t\t\t\t\t\tsum = 0;\n\t\t\t\t\t\tsum += (boardval(&arr[i][j]) + boardval(&arr[i+1][j]) + boardval(&arr[i][j+1]) + boardval(&arr[i+1][j+1]));\n\t\t\t\t\t\tif (abs(sum) >= 2){\n\t\t\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\t\t\treturn 0;\n\t\t\t\t\t\t}\n\t\t}\n\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nchar s[5], a[5];\nint t, flag=0, i, k; \n\nint main()\n{\n scanf(\"%s\", &s);\n \n for(k=1; k<=3; k++)\n { scanf(\"%s\", &a);\n for(i=0; i<4; i++)\n if(s[i]==a[i] && (s[i]==s[i+1] || a[i]==a[i+1] || a[i]==a[i-1])) flag=1; \n for(t=0; t<4; t++)\n s[t]=a[t];\n }\n \n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char (a[5])[5], b;\n int test=0, test2=0;\n for(int i=0;i<4;i++)\n {\n scanf(\"%s\", a[i]);\n }\n //printf(\"%c%c\\n%c%c\", a[0+1][0+1],a[1+0][1+1],a[1+1][0+1],a[1+1][1+1]);\n\n for(int i=0;i<3;i++)\n {\n for(int j=0;j<3;j++)\n {\n test=1;test2=0;\n b=a[i][j];\n //printf(\"%\\n%i%i,%i%i\\n%i%i,%i%i\\n%\", i,j,i,j+1, i+1,j, i+1,j+1);\n //printf(\"%\\n%c%c\\n%c%c\\n%\", b,a[i][j+1], a[i+1][j], a[i+1][j+1]);\n if( a[i][j+1] == b)\n test++;\n else\n test2++;\n if( a[i+1][j] == b)\n test++;\n else\n test2++;\n if( a[i+1][j+1] == b)\n test++;\n else\n test2++;\n if(test>2 || test2>2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x=0;\nchar a[5][5];\nfor(i=0;i<4;i++)\nscanf(\"%s\",&a[i]);\nfor(i=0;i<4;i++)\nfor(j=0;j<4;j++)\n{\n if(((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j])) ||((a[i][j]==a[i][j+1]) && (a[i][j]==a[i+1][j+1]) )|| ((a[i][j]==a[i+1][j+1]) &&(a[i][j]==a[i+1][j])) ||((a[i+1][j]==a[i][j+1])&& (a[i+1][j]==a[i+1][j+1] )))\n {\n x=1;\n }\n\n}\nif(x==1)\nputs(\"YES\");\nelse\nputs(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar s[5][5];\nint dnf(int x,int y)\n{\n int v=1;\n if(y==3)\n dnf(x+1,0);\n else if(x+1<4&&y+1<4)\n {\n if(s[x][y]==s[x][y+1])\n v++;\n if(s[x][y]==s[x+1][y])\n v++;\n if(s[x][y]==s[x+1][y+1])\n v++;\n if(v>2||v==1)\n return 1;\n else\n dnf(x,y+1);\n }\n}\nint main()\n{\n int i,j;\n for(i=0; i<4; i++)\n scanf(\"%s\",&s[i]);\n if(dnf(0,0)==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\nchar s[100][100];\nint main()\n{\n int i,j,black=0,white=0,res,p=0,k=0;\n for(i=0;i<4;i++){\n scanf(\"%s\",s[i]);\n }\n int x=0,y=0;\n while(1){\n for(i=x;i<(x+2);i++){\n for(j=y;j<(y+2);j++){\n if(s[i][j]=='#'){\n black++;\n }\n else white++;\n }\n }\n if(black>=3 || white >=3){\n res=1;\n break;\n }\n else {\n black = 0;\n white =0;\n }\n k++;\n //if(k==2){\n // k=0;\n y++;\n //}\n if(y==3){\n y=0;\n x=2;\n p++;\n }\n if(p==2){\n res=0;\n break;\n }\n }\n if(res) printf(\"YES\");\n else printf(\"NO\");\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char g[5][5];\n int i, j, d=0, h=0;\n for(i=0; i<4; i++){\n gets(g[i]);\n }\n for(i=0; i<3; i++){\n for(j=0; j<3; j++){\n if(g[i][j]=='.' ) d++;\n else h++;\n if (g[i][j+1]=='.') d++;\n else h++;\n if(g[i+1][j]=='.') d++;\n else h++;\n if(g[i+1][j+1]=='.') d++;\n else h++;\n if(d>=3 || h>=3){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,j,flag,b=0,i,a[4][4];\n\tchar c[5];\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%s\",c);\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tif(c[j]=='.')\n\t\t\ta[i][j]=0;\n\t\t\telse\n\t\t\ta[i][j]=1;\n\t\t}\n\t}\n\tflag=0;\n\tif(a[0][0]+a[0][1]+a[1][0]+a[1][1]==3||a[0][0]+a[0][1]+a[1][0]+a[1][1]==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse if(a[0][1]+a[0][2]+a[1][1]+a[1][2]==3||a[0][1]+a[0][2]+a[1][1]+a[1][2]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[0][2]+a[0][3]+a[1][2]+a[1][3]==3||a[0][2]+a[0][3]+a[1][2]+a[1][3]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][0]+a[1][1]+a[2][0]+a[2][1]==3||a[1][0]+a[1][1]+a[2][0]+a[2][1]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][1]+a[1][2]+a[2][1]+a[2][2]==3||a[1][1]+a[1][2]+a[2][1]+a[2][2]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[1][2]+a[1][3]+a[2][2]+a[2][3]==3||a[1][2]+a[1][3]+a[2][2]+a[2][3]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][0]+a[2][1]+a[3][0]+a[3][1]==3||a[2][0]+a[2][1]+a[3][0]+a[3][1]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][1]+a[2][2]+a[3][1]+a[3][2]==3||a[2][1]+a[2][2]+a[3][1]+a[3][2]==1)\n\tprintf(\"YES\\n\");\n\telse if(a[2][2]+a[2][3]+a[3][2]+a[3][3]==3||a[2][2]+a[2][3]+a[3][2]+a[3][3]==1)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, f = 0;\n char ara[4][4];\n for(i = 0; i <4; i++){\n for(j = 0; j <4; j++){\n scanf(\" %c\", &ara[i][j]);\n // printf(\" %c\", ara[i][j]);\n }\n }\n for(i = 0; i <4; i++){\n for(j = 0; j <4; j++){\n if(ara[i][j]=='#'&& ara[i][j+1]=='#'&&ara[i+1][j+1] == '#'){\n f = 1;\n break;\n }\n else if(ara[i][j]=='#'&& ara[i][j+1]=='#'&&ara[i+1][j]=='#'){\n f = 1;\n break;\n }\n else if(ara[i][j]=='#'&& ara[i+1][j]=='#'&&ara[i+1][j+1]=='#'){\n f=1;\n break;\n }\n else if(ara[i][j]=='#'&& ara[i][j-1]=='#'&&ara[i+1][j]=='#'){\n f = 1;\n break;\n }\n else if(ara[i][j]=='.'&& ara[i][j+1]=='.'&&ara[i+1][j+1]=='.'){\n f = 1;\n break;\n }\n else if(ara[i][j]=='.'&& ara[i][j+1]=='.'&&ara[i+1][j]=='.'){\n f = 1;\n break;\n }\n else if(ara[i][j]=='.'&& ara[i+1][j]=='.'&&ara[i+1][j+1]=='.'){\n f=1;\n break;\n }\n else if(ara[i][j]=='.'&& ara[i][j-1]=='.'&&ara[i+1][j]=='.'){\n f = 1;\n break;\n }\n }\n }\n if(f==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint search(int i,int j,char arr[4][4]){\n if((arr[i][j]==arr[i+1][j])){\n if((arr[i][j]==arr[i][j+1])||(arr[i+1][j]==arr[i+1][j+1])){\n return 1;\n }\n else{\n return 0;\n }\n }\n \n else if((arr[i][j]==arr[i][j+1])){\n if((arr[i][j]==arr[i+1][j])||(arr[i][j+1]==arr[i+1][j+1])){\n return 1;\n }\n else{\n return 0;\n }\n }\n else {\n return 0;\n }\n}\nint main(){\n char arr[4][4];\n int i,j;\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\"%c\",&arr[i][j]);\n }\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if(search(i,j,arr)){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{ int i,j,f;\n char a[5][5];\n for(i=1;i<=4;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n for(i=1;i<=4;i++)\n { f=1;\n for(j=0;j<4;j++)\n { \n if(a[i][j]=='.')\n { //printf(\"%d %d\\n\",i,j);\n if(a[i][j+1]=='#'&&a[i-1][j]=='#'&&a[i-1][j+1]=='#'){f=0;break;}\n if(a[i][j+1]=='#'&&a[i+1][j]=='#'&&a[i+1][j+1]=='#'){f=0;break;}\n if(a[i][j+1]=='.'&&a[i+1][j]=='.'&&a[i+1][j+1]=='.'){f=0;break;}\n }\n else\n {\n if(a[i][j+1]=='.'&&a[i-1][j]=='.'&&a[i-1][j+1]=='.'){f=0;break;}\n if(a[i][j+1]=='.'&&a[i+1][j]=='.'&&a[i+1][j+1]=='.'){f=0;break;}\n if(a[i][j+1]=='#'&&a[i+1][j]=='#'&&a[i+1][j+1]=='#'){f=0;break;}\n }\n }\n if(f==0){break;}\n }\n if(f){printf(\"NO\\n\");}\n else{printf(\"YES\\n\");}\n}"}, {"source_code": "#include<stdio.h>\nchar convert(char s[4][4],int i,int j)\n{\nchar c;\nif(s[i][j]=='#')\n{c='.';}\nelse\n{c='#';}\nreturn c;\n}\nint main()\n{\nint i,flag=0,j;\nchar s[4][5],c;\nfor (i=0;i<4;++i)\n {\n scanf(\"%s\",s[i]);\n }\nfor (i=0;i<3;++i)\n {\n for(j=0;j<3;++j)\n {\n c=convert(s,i,j);\n if((c=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(s[i][j]=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(c=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.')||(s[i][j]=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.'))\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {printf(\"YES\");\n break;\n }\n }\n if(flag==0)\n {printf(\"NO\");}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint arr[6][6];\n\nvoid invert(int, int);\nint isSquare(int, int);\n\nint main()\n{\n\tint i, j, k, test = 0;\n\tchar s[4];\n\t\n\tfor(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t\tarr[i][j] = 2;\n\t}\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tscanf(\"%s\", s);\n\t\tk = 0;\n\t\tfor(j = 1; j < 5; j++, k++)\n\t\t{\n\t\t\tif (s[k] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (s[k] == '.')\n\t\t\t\tarr[i][j] = 1;\n\t\t\telse\n\t\t\t\tarr[i][j] = 3;\n\t\t}\t\n\t}\n\t\n\t/*for(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tif (c[i][j] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (c[i][j] == '.')\n\t\t\t\tarr[i][j] = 1;\t\t\t\t\n\t\t\telse\n\t\t\t\tarr[i][j] = 2;\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\t\n\t/*(for(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t{\n\t\t\tprintf(\"%d\", arr[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tfor(j = 1; j < 5; j++)\n\t\t{\n\t\t\tif (!isSquare(i, j))\n\t\t\t{\n\t\t\t\tinvert(i, j);\n\t\t\t\t\n\t\t\t\tprintf(\"Inverted at %d %d => %d\\n\", i, j, arr[i][j]);\n\n\t\t\t\tif(isSquare(i, j))\n\t\t\t\t{\n\t\t\t\t\ttest = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tinvert(i, j);\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\ttest = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(test == 1)\n\t\t\tbreak;\n\t}\n\t\n\tif (test)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\nint isSquare(int i, int j)\n{\n\tif ((arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1]) || (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j+1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1]))\n\t\treturn 1;\n\t\n\t//if (((arr[i][j+1] && arr[i+1][j] && arr[i+1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1])) || ((arr[i][j+1] && arr[i-1][j] && arr[i-1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])) || ((arr[i][j-1] && arr[i+1][j] && arr[i+1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1])) || ((arr[i][j-1] && arr[i-1][j] && arr[i-1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])))\n\t\t//return 1;\t\n\t\n\telse\n\t\treturn 0;\n}\n\nvoid invert(int i, int j)\n{\n\tif (arr[i][j] == 0)\n\t\tarr[i][j] = 1;\n\telse if (arr[i][j] == 1)\n\t\tarr[i][j] = 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=3;j++)\n{\nscanf(\"%d\",&a[i][j]);\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y-1])\n k++;\n if(a[i][j]==a[x][y+1])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint arr[6][6];\n\nvoid invert(int, int);\nint isSquare(int, int);\n\nint main()\n{\n\tint i, j, k, test = 0;\n\tchar s[4];\n\t\n\tfor(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t\tarr[i][j] = 2;\n\t}\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tscanf(\"%s\", s);\n\t\tk = 0;\n\t\tfor(j = 1; j < 5; j++, k++)\n\t\t{\n\t\t\tscanf(\"%c\", &s);\n\t\t\tif (s[k] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (s[k] == '.')\n\t\t\t\tarr[i][j] = 1;\n\t\t\telse\n\t\t\t\tarr[i][j] = 3;\n\t\t}\t\n\t}\n\t\n\t/*for(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tif (c[i][j] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (c[i][j] == '.')\n\t\t\t\tarr[i][j] = 1;\t\t\t\t\n\t\t\telse\n\t\t\t\tarr[i][j] = 2;\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\t\n\t/*(for(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t{\n\t\t\tprintf(\"%d\", arr[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tfor(j = 1; j < 5; j++)\n\t\t{\n\t\t\tif (!isSquare(i, j))\n\t\t\t{\n\t\t\t\tinvert(i, j);\n\t\t\t\t\n\t\t\t\t//printf(\"Inverted at %d %d => %d\\n\", i, j, arr[i][j]);\n\n\t\t\t\tif(isSquare(i, j))\n\t\t\t\t{\n\t\t\t\t\ttest = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tinvert(i, j);\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\ttest = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(test == 1)\n\t\t\tbreak;\n\t}\n\t\n\tif (test)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\nint isSquare(int i, int j)\n{\n\tif ((arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1]) || (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j+1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1]))\n\t\treturn 1;\n\t\n\t//if (((arr[i][j+1] && arr[i+1][j] && arr[i+1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1])) || ((arr[i][j+1] && arr[i-1][j] && arr[i-1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])) || ((arr[i][j-1] && arr[i+1][j] && arr[i+1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1])) || ((arr[i][j-1] && arr[i-1][j] && arr[i-1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])))\n\t\t//return 1;\t\n\t\n\telse\n\t\treturn 0;\n}\n\nvoid invert(int i, int j)\n{\n\tif (arr[i][j] == 0)\n\t\tarr[i][j] = 1;\n\telse if (arr[i][j] == 1)\n\t\tarr[i][j] = 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char arr[4][4];\n int flag=0;\n for(int i=0;i<4;i++){\n for(int j=0;j<4;j++){\n scanf(\"%c\",&arr[i][j]);\n\n }\n }\n for(int i=0;i<3;i++){\n for(int j=0;j<3;j++){\n if(arr[i][j]==arr[i][j+1]){\n if((arr[i][j]==arr[i+1][j])||(arr[i][j]==arr[i+1][j+1])){\n flag=1;\n }\n }\n\n }\n }\n if(flag==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,flag=0,j;\n char s[4][5],c;\n for (i=0; i<4; ++i)\n {\n scanf(\"%s\",s[i]);\n }\n for (i=0; i<4; ++i)\n {\n for(j=0; j<4; ++j)\n {\n if((s[i][j]==s[i][j+1]&&s[i][j+1]==s[i+1][j+1])||(s[i][j]==s[i][j+1]&&s[i+1][j]==s[i][j+1]))\n {\n flag=1;\n break;\n }\n else if((s[i][j]==s[i-1][j]&&s[i][j]==s[i][j+1])||(s[i][j]==s[i-1][j]&&s[i-1][j-1]==s[i][j]))\n {\n flag=1;\n break;\n }\n\n }\n if(flag==1)\n {\n printf(\"YES\");\n break;\n }\n }\n if(flag==0)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[4][5];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<4;i++)\n {\n int j;\n for(j=0;j<4;j++)\n {\n if(((a[i][j]==a[i][j+1])&&(a[i+1][j]==a[i][j]||a[i+1][j+1]==a[i][j]))||((a[i+1][j]==a[i][j]&&a[i+1][j+1]==a[i][j])||(a[i+1][j]==a[i][j+1]&&a[i+1][j+1]==a[i][j+1])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main()\n{\n char arr[4][4];\n int flag=0;\n int i,j;\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\"%c\",&arr[i][j]);\n if(arr[i][j]=='\\n'){\n j--;\n }\n }\n if(arr[i][j]=='\\n'){\n i--;\n }\n }\n \n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if((arr[i][j]==arr[i][j+1])){\n \n if((arr[i][j]==arr[i+1][j])||(arr[i][j]==arr[i+1][j+1])){\n \n flag=1;\n \n }\n else if((arr[i][j]==arr[i+1][j])&&(arr[i][j]==arr[i+1][j+1])){\n \n flag=1;\n \n }\n else if((arr[i][j+1]==arr[i+1][j])&&(arr[i][j+1]==arr[i+1][j+1])){\n \n flag=1;\n \n }\n }\n \n }\n }\n if(flag==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n }\n }\n int flag=0;\n for (i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n if ((x[i][j]==x[i][j+1]&& \\\n x[i][j]==x[i+1][j]&& \\\n x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& \\\n x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& \\\n x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& \\\n x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& \\\n x[i][j]==x[i+1][j]&& \\\n x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& \\\n x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& \\\n x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& \\\n x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar c[4][4];\n\tint a[4][4];\n\t\n\tfor(int i = 0; i < 4; i++)\n\t{\n\t\tfor(int j = 0; j < 4; j++)\n\t\t{\n\t\t\tscanf(\" %c\", &c[i][j]);\n\t\t\t\n\t\t\tif(c[i][j] == '#')\t\ta[i][j] = 1;\n\t\t\telse\t\t\t\t\ta[i][j] = -1;\t\n\t\t}\n\t\t\n\t}\n\t\n\tif(a[0][0] + a[0][1] + a[1][0] + a[1][1] == 2 || a[0][0] + a[0][1] + a[1][0] + a[1][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\t\n\t\n\tif(a[0][1] + a[0][2] + a[1][1] + a[1][2] == 2 || a[0][1] + a[0][2] + a[1][1] + a[1][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[0][2] + a[0][3] + a[1][2] + a[1][3] == 2 || a[0][2] + a[0][3] + a[1][2] + a[1][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\t\n\tif(a[1][0] + a[1][1] + a[2][0] + a[2][1] == 2 || a[1][0] + a[1][1] + a[2][0] + a[2][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[1][1] + a[1][2] + a[2][1] + a[2][2] == 2 || a[1][1] + a[1][2] + a[2][1] + a[2][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[1][2] + a[1][3] + a[2][2] + a[2][3] == 2 || a[1][2] + a[1][3] + a[2][2] + a[2][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[2][0] + a[2][1] + a[3][0] + a[3][1] == 2 || a[2][0] + a[2][1] + a[3][0] + a[3][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\t\n\tif(a[2][1] + a[2][2] + a[3][1] + a[3][2] == 2 || a[2][1] + a[2][2] + a[3][1] + a[3][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[2][2] + a[2][3] + a[3][2] + a[3][3] == 2 || a[2][2] + a[2][3] + a[3][2] + a[3][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar c[4][4];\n\tint a[4][4];\n\t\n\tfor(int i = 0; i < 4; i++)\n\t{\n\t\tfor(int j = 0; j < 4; j++)\n\t\t{\n\t\t\tscanf(\" %c\", &c[i][j]);\n\t\t\t\n\t\t\tif(c[i][j] == '#')\t\ta[i][j] = 1;\n\t\t\telse\t\t\t\t\ta[i][j] = -1;\t\n\t\t}\n\t\t\n\t}\n\t\n\tif(a[0][0] + a[0][1] + a[1][0] + a[1][1] == 2 || a[0][0] + a[0][1] + a[1][0] + a[1][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\t\n\t\n\tif(a[0][1] + a[0][2] + a[1][1] + a[1][2] == 2 || a[0][1] + a[0][2] + a[1][1] + a[1][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[0][2] + a[0][3] + a[1][2] + a[1][3] == 2 || a[0][2] + a[0][3] + a[1][2] + a[1][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\t\n\tif(a[1][0] + a[1][1] + a[2][0] + a[2][1] == 2 || a[1][0] + a[1][1] + a[2][0] + a[2][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[1][1] + a[1][2] + a[2][1] + a[2][2] == 2 || a[1][1] + a[1][2] + a[2][1] + a[2][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[1][2] + a[1][3] + a[2][2] + a[2][3] == 2 || a[1][2] + a[1][3] + a[2][2] + a[2][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[2][0] + a[2][1] + a[3][0] + a[3][1] == 2 || a[2][0] + a[2][1] + a[3][0] + a[3][1] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\t\n\tif(a[2][1] + a[2][2] + a[3][1] + a[3][2] == 2 || a[2][1] + a[2][2] + a[3][1] + a[3][2] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\t\n\tif(a[2][2] + a[2][3] + a[3][2] + a[3][3] == 2 || a[2][2] + a[2][3] + a[3][2] + a[3][3] == -2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t} \n\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4][4]={0};\n\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n\n if(a[i][j]=='#')\n a[i][j]=1;\n }\n\n scanf(\"\\n\");\n }\n\n for(int i=0;i<3;i++)\n for(int j=0;j<3;j++)\n {\n if((a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1]) !=2)\n {printf(\"YES\"); return 0;}\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n char a[5][5];\n int i,j,cnt=0;\n for(i=0;i<4;i++)\n {gets(a[i]);}\n for(i=0;i<4;i++)\n {for(j=0;j<4;j++)\n {\n if(a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j])\n cnt++;\n if(a[i][j]==a[i+1][j+1]&&a[i][j]==a[i][j+1])\n cnt++;\n if(a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+1][j+1])\n cnt++;\n if(a[i][j]==a[i+1][j-1]&&a[i][j]==a[i][j-1])\n cnt++;}}\n if(cnt==0)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\t\n\tint lista[4][4];\n\tint i,j;\n\tchar c;\n\t\n\tfflush(stdin);\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tscanf(\"%c\",&c);\n\t\t\tif(c=='#'){\n\t\t\t\tlista[i][j]=1;\n\t\t\t}else{\n\t\t\t\tlista[i][j]=0;\n\t\t\t}\n\t\t}\n\t\tscanf(\"%c\",&c);\n\t\tfflush(stdin);\n\t}\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tprintf(\"%d\",lista[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int i,j, a[4][4], z;\n char s[4];\n for(i = 0; i < 4; i++)\n {\n scanf(\"%s\", &s);\n if(s[0] == '#' ) a[i][0] = 1; else a[i][0] = 0;\n if(s[1] == '#' ) a[i][1] = 1; else a[i][1] = 0;\n if(s[2] == '#' ) a[i][2] = 1; else a[i][2] = 0;\n if(s[3] == '#' ) a[i][3] = 1; else a[i][3] = 0;\n }\n for(i = 0; i < 3; i++)\n for(j = 0; j < 3; j++){\n z = a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1];\n if(z != 2 ) {printf(\"YES\"); return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n {\n char ts[4][4];\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n scanf(\"%c\",&ts[i][j]);\n scanf(\"\\n\");\n }\n int d=3;\n int in;int c1=0,c2=0;\n char str[2][2];\n int m=0,n=0;int flag=0;\n while(d--)\n {\n m=0,n=0;c1=0,c2=0;\n for(int i=0;i<=1;i++)\n {\n in=3-d-1;\n for(int j=in;j<=in+1;j++)\n {\n str[m][n++]=ts[i][j];\n }\n m++;\n n=0;\n }\n c1=0,c2=0;\n for(int p=0;p<2;p++)\n {\n for(int q=0;q<2;q++)\n {\n if(str[p][q]=='#')\n c1++;\n else\n c2++;\n }\n }\n if(c1==3||c2==3)\n {\n flag=1;\n }\n }\n d=3;\n while(d--)\n {\n m=0,n=0;c1=0,c2=0;\n for(int i=1;i<=2;i++)\n {\n in=3-d-1;\n for(int j=in;j<=in+1;j++)\n {\n str[m][n++]=ts[i][j];\n }\n m++;\n n=0;\n }\n c1=0,c2=0;\n for(int p=0;p<2;p++)\n {\n for(int q=0;q<2;q++)\n {\n if(str[p][q]=='#')\n c1++;\n else\n c2++;\n }\n }\n if(c1==3||c2==3)\n {\n flag=1;\n }\n }\n d=3;\n while(d--)\n {\n m=0,n=0;c1=0,c2=0;\n for(int i=2;i<=3;i++)\n {\n in=3-d-1;\n for(int j=in;j<=in+1;j++)\n {\n str[m][n++]=ts[i][j];\n }\n m++;\n n=0;\n }\n c1=0,c2=0;\n for(int p=0;p<2;p++)\n {\n for(int q=0;q<2;q++)\n {\n if(str[p][q]=='#')\n c1++;\n else\n c2++;\n }\n }\n if(c1==3||c2==3)\n {\n flag=1;\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[16],i;\n int c=0;\n for(i=0;i<16;i++)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=0;i<11;i++)\n {\n if((a[i]==a[i+4]||a[i+1]==a[i+5])&&(a[i]==a[i+1]||a[i+4]==a[i+5]))\n {\n c=1;\n break;\n }\n\n else\n c=0;\n }\n if(c==1)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=3;j++)\n{\nscanf(\"%d\",&a[i][j]);\nif(a[i][j]=='x')\na[i][j]=4;\nelse\na[i][j]=5;\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y-1])\n k++;\n if(a[i][j]==a[x][y+1])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char str[4][4],count=0;\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&str[i][j]);\n }\n getchar();\n }\n //printf(\"\\n\");\n /*for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n printf(\"%c\",str[i][j]);\n }\n }*/\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n count=0;\n //printf(\" %d %d\\n \",i,j);\n if(str[i+1][j]==str[i][j] && i+1<4)\n count++;\n if(str[i][j+1]==str[i][j] && j+1<4)\n count++;\n if(str[i+1][j+1]==str[i][j] && i+1<4 && j+1<4)\n count++;\n if(count>=2)\n {\n //printf(\"CASE 1: %d %d \",i,j);\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n count=0;\n if(str[i-1][j]==str[i][j] && i-1>=0)\n count++;\n if(str[i-1][j+1]==str[i][j] && j+1<4 && i-1>=0)\n count++;\n if(str[i][j+1]==str[i][j] && j+1<4)\n count++;\n if(count>=2)\n {\n //printf(\"CASE 2 %d %d \",i,j);\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n count=0;\n if(str[i][j-1]==str[i][j] && j-1>=0)\n count++;\n if(str[i+1][j-1]==str[i][j] && j-1>=0 && i+1<4)\n count++;\n if(str[i+1][j]==str[i][j] && i+1<4)\n count++;\n if(count>=2)\n {\n //printf(\"CASE 3 %d %d \",i,j);\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n count=0;\n if(str[i-1][j-1]==str[i][j] && i-1>=0 && j-1>=0)\n count++;\n if(str[i][j-1]==str[i][j] && j-1>=0)\n count++;\n if(str[i-1][j]==str[i][j] && i-1>=0 )\n count++;\n if(count>=2)\n {\n //printf(\"CASE 4 %d %d \",i,j);\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n if(count<2)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char a[4][5];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%s\",a[i]);\n for(i=0;i<3;i++)\n {\n int j;\n for(j=0;j<3;j++)\n {\n if(a[i][j]==a[i][j+1])\n if(a[i+1][j]==a[i][j]||a[i+1][j+1]==a[i][j])\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nchar tab[5][5];\nbool contour(int i,int j);\n\nint main()\n{\n int k=0;\n int i,j;\n\n for(i=0;i<4;i++)scanf(\"%s\",tab[i]);\n\n//main\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if (contour(i,j)){printf(\"YES \\n\"); k++; break; }\n\n }\n if(k!=0)break;\n }\n if(k==0)printf(\"NO \\n\");\n\n return 0;\n}\n\nbool contour(int i,int j)\n{\n if ((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j])){return 1;}\n else if((tab[i][j]==tab[i][j+1])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else if((tab[i][j]==tab[i+1][j])&&(tab[i][j]==tab[i+1][j+1])){return 1;}\n else return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,k;\nchar q;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=3;j++)\n{\nscanf(\"%d\",&q);\nif(q=='#')\na[i][j]=1;\nif(q=='.')\na[i][j]==0;\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y+1])\n k++;\n if(a[i][j]==a[x+1][y])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,j,flag,count;\n char a[4][5];\n for(i=0;i<4;i++){\n scanf(\"%s\",a[i]);\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n count=0;\n flag=a[i][j];\n if(a[i+1][j]==flag){\n count++;\n }\n if(a[i][j+1]==flag){\n count++;\n }\n if(a[i+1][j+1]==flag){\n count++;\n }\n if(count>1){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[5][5];\n int i=0,j=0,k=0,l=0;\n int count=0;\n int flag=0;\n int flag2=0;\n for(i=0; i<4; i++)\n {\n for(j=0; j<4; j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(k=0; k<4; k++)\n {\n for(l=0; l<4; l++)\n {\n if(a[k][l]=='#')\n {\n flag++;\n }\n if(a[k+1][l]=='#')\n {\n flag++;\n }\n if(a[k][l+1]=='#')\n {\n flag++;\n }\n if(a[k+1][l+1]=='#')\n {\n flag++;\n }\n if((a[k][l]=='.'))\n {\n count++;\n }\n if(a[k+1][l]=='.')\n {\n count++;\n }\n if(a[k][l+1]=='.')\n {\n count++;\n }\n if(a[k+1][l+1]=='.')\n {\n count++;\n }\n if((flag>=3)||(count>=3))\n {\n flag2=1;\n }\n flag=0;\n count=0;\n }\n\n }\n if(flag2==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=3;j++)\n{\nscanf(\"%c\",&a[i][j]);\n\n\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y-1])\n k++;\n if(a[i][j]==a[x][y+1])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,temp;\n char a[i][j],yes,no;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if(a[i][j]==a[i][j+1]==a[i+1][j])\n {\n a[i+1][j+1]=a[i][j];\n temp=1;\n break;\n }\n else if(a[i][j]==a[i][j+1]==a[i+1][j+1])\n {\n a[i+1][j]==a[i][j];\n temp=1;\n break;\n }\n else if(a[i+1][j]==a[i][j+1]==a[i+1][j+1])\n {\n a[i][j]==a[i+1][j];\n temp=1;\n break;\n }\n else if(a[i][j]==a[i+1][j]==a[i+1][j+1])\n {\n a[i][j+1]==a[i][j];\n temp=1;\n break;\n }\n else if(a[i][j]==a[i][j+1]==a[i+1][j]==a[i+1][j+1])\n {\n temp=0;\n break;\n }\n }\n break;\n }\n if(temp==1)\n printf(\"%c\",yes);\n else\n printf(\"%c\",no);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,j,a,b,t,d;\nchar aa[6][6];\nint main()\n{\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<4;j++)\n\t\t\tscanf(\" %c\",&aa[i][j]);\n\tfor(i=0;i<3;i++)\n\t\tfor(j=0;j<3;j++)\n\t\t{\n\t\t\tt=0;\n\t\t\tfor(a=i;a<i+2;a++)\n\t\t\t\tfor(b=j;b<j+2;b++)\n\t\t\t\t\tif(aa[a][b]=='.')\n\t\t\t\t\t\tt++;\n\t\t\tif(t%2)\n\t\t\t{printf(\"YES\");return 0;}\n\t\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x;\nchar a[5][5];\nfor(i=0;i<4;i++)\nscanf(\"%s\",&a[i]);\nfor(i=0;i<4;i++)\nfor(j=0;j<4;j++)\n{\n if(((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j])) ||((a[i][j]==a[i][j+1]) && (a[i][j]==a[i+1][j+1]) )|| ((a[i][j]==a[i+1][j+1]) &&(a[i][j]==a[i+1][j])) ||((a[i+1][j]==a[i][j+1])&& (a[i+1][j]==a[i+1][j+1] )))\n {\n x=1;\n }\n\n}\nif(x==1)\nputs(\"YES\");\nelse\nputs(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint arr[6][6];\n\nvoid invert(int, int);\nint isSquare(int, int);\n\nint main()\n{\n\tint i, j, k, test = 0;\n\tchar s[4];\n\t\n\tfor(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t\tarr[i][j] = 2;\n\t}\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tscanf(\"%s\", s);\n\t\tk = 0;\n\t\tfor(j = 1; j < 5; j++, k++)\n\t\t{\n\t\t\tscanf(\"%c\", &s);\n\t\t\tif (s[k] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (s[k] == '.')\n\t\t\t\tarr[i][j] = 1;\n\t\t\telse\n\t\t\t\tarr[i][j] = 3;\n\t\t}\t\n\t}\n\t\n\t/*for(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tif (c[i][j] == '#')\n\t\t\t\tarr[i][j] = 0;\n\t\t\telse if (c[i][j] == '.')\n\t\t\t\tarr[i][j] = 1;\t\t\t\t\n\t\t\telse\n\t\t\t\tarr[i][j] = 2;\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\t\n\t/*(for(i = 0; i < 6; i++)\n\t{\n\t\tfor(j = 0; j < 6; j++)\n\t\t{\n\t\t\tprintf(\"%d\", arr[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\t\n\tfor(i = 1; i < 5; i++)\n\t{\n\t\tfor(j = 1; j < 5; j++)\n\t\t{\n\t\t\tif (!isSquare(i, j))\n\t\t\t{\n\t\t\t\tinvert(i, j);\n\t\t\t\t\n\t\t\t\t//printf(\"Inverted at %d %d => %d\\n\", i, j, arr[i][j]);\n\n\t\t\t\tif(isSquare(i, j))\n\t\t\t\t{\n\t\t\t\t\ttest = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tinvert(i, j);\n\t\t\t}\n\t\t\t\n\t\t\telse\n\t\t\t{\n\t\t\t\ttest = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(test == 1)\n\t\t\tbreak;\n\t}\n\t\n\tif (test)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n\nint isSquare(int i, int j)\n{\n\tif ((arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1]) || (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j+1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1]) || (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1]))\n\t\treturn 1;\n\t\n\t//if (((arr[i][j+1] && arr[i+1][j] && arr[i+1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j+1])) || ((arr[i][j+1] && arr[i-1][j] && arr[i-1][j+1]) && (arr[i][j] == arr[i][j+1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])) || ((arr[i][j-1] && arr[i+1][j] && arr[i+1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i+1][j] && arr[i][j] == arr[i+1][j-1])) || ((arr[i][j-1] && arr[i-1][j] && arr[i-1][j-1]) && (arr[i][j] == arr[i][j-1] && arr[i][j] == arr[i-1][j] && arr[i][j] == arr[i-1][j-1])))\n\t\t//return 1;\t\n\t\n\telse\n\t\treturn 0;\n}\n\nvoid invert(int i, int j)\n{\n\tif (arr[i][j] == 0)\n\t\tarr[i][j] = 1;\n\telse if (arr[i][j] == 1)\n\t\tarr[i][j] = 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4][4]={0};\n\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n\n if(a[i][j]=='#')\n a[i][j]=1;\n }\n\n scanf(\"\\n\");\n }\n\n for(int i=0;i<3;i++)\n for(int j=0;j<3;j++)\n {\n if((a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1]) !=2)\n {printf(\"YES\"); return 0;}\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint check(int a[6][6]);\n\nint main()\n{\n int a[6][6] = {0};\n int i, j, k, t;\n int blank[16] = {0};\n char s[5];\n int m = 0;\n\n for(i = 1; i < 5; i++) {\n scanf(\"%s\", s);\n for(j = 1; j < 5; j++){\n if(s[j] == '#')\n a[i][j] = 1;\n else\n a[i][j] = 0;\n }\n }\n/*\n for(i = 1; i < 5; i++) {\n for(j = 1; j < 5; j++) {\n printf(\"%d \", a[i][j]);\n }\n printf(\"\\n\");\n }\n*/\n m = check(a);\n if(m == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\nint check(int a[6][6])\n{\n int i, j, k, t;\n int result = 0;\n int big = 0;\n\n for(i = 1; i < 5; i++) {\n for(j = 1; j < 5; j++) {\n if(a[i][j] == 0) {\n if(a[i-1][j-1] || a[i-1][j+1] || a[i+1][j-1] || a[i+1][j+1]) {\n if(a[i-1][j-1] == 1) { //northwest square\n if(a[i-1][j] == 1 && a[i][j-1] == 1) {\n result = 1;\n return result;\n }\n else {\n result = 0;\n continue;\n }\n }\n else {\n if(a[i-1][j+1] == 1) { //northeast square\n if(a[i-1][j] == 1 && a[i][j+1] == 1) {\n result = 1;\n return result;\n }\n else {\n result = 0;\n continue;\n }\n }\n else {\n if(a[i+1][j-1] == 1) { //southwest square\n if(a[i][j-1] == 1 && a[i+1][j] == 1) {\n result = 1;\n return result;\n }\n else {\n result = 0; \n continue;\n }\n }\n else {\n if(a[i+1][j+1] == 1) { // southeast square\n if(a[i][j] == 1 && a[i][j+1] == 1) {\n result = 1;\n return result;\n }\n else {\n result = 0;\n return result;\n }\n }\n }\n }\n\n }\n }\n else {\n result = 0;\n return result;\n }\n }\n }\n }\n\n return result;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[16],i;\n int c=0;\n for(i=0;i<16;i++)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=0;i<12;i++)\n {\n if(a[i]==a[i+4]||a[i+1]==a[i+5])\n {\n c=1;\n break;\n }\n\n else\n c=0;\n }\n if(c==1)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint sumar(int a,int b,int c,int d){\n\t\n\tint k;\n\t\n\tk=a+b+c+d;\n\t\n\tif(k>=3){\n\t\tk=0;\n\t}else{\n\t\tk=1;\n\t}\n\t\n\treturn k;\n}\n\nint main () {\n\t\n\tint lista[4][4];\n\tint i,j,k;\n\tchar * p;\n\t\n\tfflush(stdin);\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tlista[i][j]=getchar();\n\t\t\tif(lista[i][j]==46){\n\t\t\t\tlista[i][j]=0;\n\t\t\t}else{\n\t\t\t\tlista[i][j]=1;\n\t\t\t}\n\t\t}\n\t\tgetchar();\n\t\tfflush(stdin);\n\t}\n\t\n\tp=(char *)malloc(sizeof(char)*4);\n\tp=\"NO\";\n\t\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tk=sumar(lista[i][j],lista[i+1][j],lista[i][j+1],lista[i+1][j+1]);\n\t\t\tif(k==0){\n\t\t\t\tp=\"YES\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tputs(p);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint main(void) {\n int n = 4;\n int m = 0;\n bool found = false;\n char arr[n][n];\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n scanf(\"%c\", *(arr + i) + j);\n }\n scanf(\"%c\", &m);\n }\n\n for (int i = 0; i < n; i++) {\n for (int j = 0, k = 0; j < n; j++, k = 0) {\n if (arr[i][j] == '#') {\n k++;\n }\n if (i > 0 && arr[i - 1][j] == '#') {\n k++;\n }\n if (j < (n - 1) && arr[i][j + 1] == '#') {\n k++;\n }\n if (j < (n - 1) && i > 0 && arr[i - 1][j + 1] == '#') {\n k++;\n }\n\n if (k == 3) {\n found = true;\n goto done;\n }\n }\n }\n\n done:\n\n if (found == true) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[5][5];\n int i=0,j=0,k=0,l=0;\n int count=0;\n int flag=0;\n int flag2=0;\n for(i=0; i<4; i++)\n {\n for(j=0; j<4; j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n fflush(stdin);\n }\n for(k=0; k<4; k++)\n {\n for(l=0; l<4; l++)\n {\n if(a[k][l]=='#')\n {\n flag++;\n }\n if(a[k+1][l]=='#')\n {\n flag++;\n }\n if(a[k][l+1]=='#')\n {\n flag++;\n }\n if(a[k+1][l+1]=='#')\n {\n flag++;\n }\n if((a[k][l]=='.'))\n {\n count++;\n }\n if(a[k+1][l]=='.')\n {\n count++;\n }\n if(a[k][l+1]=='.')\n {\n count++;\n }\n if(a[k+1][l+1]=='.')\n {\n count++;\n }\n if((flag>=3)||(count>=3))\n {\n flag2=1;\n }\n flag=0;\n count=0;\n }\n\n }\n if(flag2==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar convert(char s[4][4],int i,int j)\n{\nchar c;\nif(s[i][j]=='#')\n{c='.';}\nelse\n{c='#';}\nreturn c;\n}\nint main()\n{\nint i,flag=0,j;\nchar s[4][5],c;\nfor (i=0;i<4;++i)\n {\n scanf(\"%s\",s[i]);\n }\nfor (i=0;i<3;++i)\n {\n for(j=0;j<3;++j)\n {\n c=convert(s,i,j);\n if((c=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(s[i][j]=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(c=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.')||(s[i][j]=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.'))\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {printf(\"Yes\");\n break;\n }\n }\n if(flag==0)\n {printf(\"No\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n char p[5][5],c;\n int n,i,j;\n for(i=0;i<4;i++)\n scanf(\"%s\",p[i]);\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n {\n n=0;\n c=p[i][j];\n if(c==p[i][j+1])\n n++;\n if(c==p[i+1][j])\n n++;\n if(c==p[i+1][j+1])\n n++;\n if(n>=2)\n goto loop;\n }\n loop:if(n>=2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int count = 0,flag = 0,i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\" %c\",&a[i][j]);\n }\n }\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n count = 0;\n if(a[i][j] == a[i+1][j])\n count++;\n if(a[i][j] == a[i][j+1])\n count++;\n if(a[i][j] == a[i+1][j+1])\n count++;\n if(count>=2)\n {\n flag = 1;\n goto hell;\n }\n }\n }\n hell:\n if(flag == 1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\tchar a[4][4];\n\n\tint i,j;\n\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++)\n\t\tscanf(\"%c\",&a[i][j]);\n\t}\n\n\n\tfor(i=1;i<4;i++){\n\t\tfor(j=1;j<4;j++){\n\t\t\tif((a[i-1][j-1] == '#' && a[i][j-1] == '#' && a[i][j] == '#') ||\n\t\t\t\t\t(a[i-1][j-1] == '.' && a[i][j-1] == '.' && a[i][j] == '.')||\n\t\t\t\t\t(a[i-1][j-1] == '#' && a[i][j-1] == '#' && a[i][j-1] == '#') ||\n\t\t\t\t\t(a[i-1][j-1] == '.' && a[i][j-1] == '.' && a[i][j-1] == '.') ||\n\t\t\t\t\t(a[i-1][j-1] == '#' && a[i][j-1] == '#' && a[i][j] == '#') ||\n\t\t\t\t\t(a[i-1][j-1] == '.' && a[i][j-1] == '.' && a[i][j] == '.') ||\n\t\t\t\t\t(a[i][j-1] == '#' && a[i][j] == '#' && a[i-1][j] == '#') ||\n\t\t\t\t\t(a[i][j-1] == '.' && a[i][j] == '.' && a[i-1][j] == '.')){\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t}\n\t}\n\tputs(\"NO\");\n\n\n\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar a[4][4];\n\tint i,j,possible=0;\n\tchar c;\n\n\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%s\",a[i]);\n\t}\n\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tc=a[i][j];\n\t\t\tif((a[i][j+1]==c && a[i+1][j]==c && j<3) || (a[i][j+1]==c && a[i+1][j+1]==c && j<3)|| (a[i+1][j+1]==c && a[i+1][j]==c && j<3) || (a[i+1][j-1]==c && a[i+1][j]==c && j>0)){\n\t\t\t\tpossible=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(possible==1){\n break;\n\t\t}\n\t}\n\tif(possible==1){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char (a[5])[5], b;\n int test=0, test2=0;\n for(int i=0;i<4;i++)\n {\n scanf(\"%s\", a[i]);\n }\n //printf(\"%c%c\\n%c%c\", a[0+1][0+1],a[1+0][1+1],a[1+1][0+1],a[1+1][1+1]);\n\n for(int i=0;i<3;i++)\n {\n for(int j=0;j<3;j++)\n {\n test=1;test2=1;\n b=a[i][j];\n //printf(\"%\\n%i%i,%i%i\\n%i%i,%i%i\\n%\", i,j,i,j+1, i+1,j, i+1,j+1);\n //printf(\"%\\n%c%c\\n%c%c\\n%\", b,a[i][j+1], a[i+1][j], a[i+1][j+1]);\n if( a[i][j+1] == b)\n test++;\n else\n test2++;\n if( a[i+1][j] == b)\n test++;\n else\n test2++;\n if( a[i+1][j+1] == b)\n test++;\n else\n test2++;\n if(test>2 || test2>2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,flag=0,flag2=0,meem;\n char a[4][5];\n for(i=0;i<4;i++){\n gets(a[i]);\n }\n\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n if(i!=3&&j!=3&&a[i][j]!=a[i+1][j]&&a[i][j]!=a[i][j+1]&&a[i][j]!=a[i+1][j+1]){flag=1;break;}\n if(i!=0&&j!=0&&(a[i][j]!=a[i-1][j]&&a[i][j]!=a[i][j-1]&&a[i][j]!=a[i-1][j-1])){flag=1;break;}\n }\n if(flag)break;\n }\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n if(i!=3&&j!=3&&a[i][j]==a[i+1][j]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]){flag2=1;break;}\n if(i!=0&&j!=0&&(a[i][j]==a[i-1][j]&&a[i][j]==a[i][j-1]&&a[i][j]==a[i-1][j-1])){flag2=1;break;}\n }\n if(flag2)break;\n }\n if(flag==1||flag2==1)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main()\n{\n char square[4][5];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%s\",square[i]);\n for(i=0;i<4;i++)\n {\n int j;\n for(j=0;j<4;j++)\n {\n if(((square[i][j]==square[i][j+1])&&((square[i][j]==square[i+1][j])||(square[i][j]==square[i+1][j+1])))||((square[i+1][j]==square[i+1][j+1])&&((square[i+1][j]==square[i][j])||(square[i+1][j]==square[i][j+1]))))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{ int i,j,f;\n char a[5][5];\n for(i=1;i<=4;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n for(i=1;i<=3;i++)\n { \n for(j=0;j<3;j++)\n { f=0;\n if(a[i][j]=='#')f++;\n if(a[i][j+1]=='#')f++;\n if(a[i+1][j]=='#')f++;\n if(a[i+1][j+1]=='#')f++;\n }\n if(f>=3||f==1){printf(\"YES\\n\");return 0;}\n }\n printf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&a[i][j]);\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y+1])\n k++;\n if(a[i][j]==a[x+1][y])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n char str[21];\n char a;\n int i;\n int flag = 0;\n for(i =1 ;i <=4;i++){\n \n scanf(\"%c\",&str[i]);\n }\n \n for(i =5 ;i <=8;i++){\n \n scanf(\"%c\",&str[i]);\n }\n \n for(i =9 ;i <=12;i++){\n \n scanf(\"%c\",&str[i]);\n }\n\n for(i =13 ;i <=16;i++){\n \n scanf(\"%c\",&str[i]);\n }\n \n int count = 0;\n int count1 = 0;\n for(i = 1; i<=12;i++){\n if(i % 4 == 0 ){\n continue;\n }\n else {\n if(str[i] == '.'){\n count++;\n }\n else if(str[i] =='#') {\n count1++;\n }\n if(str[i+1] =='.'){\n count++;\n }\n if(str[i+1] =='#') {\n count1++;\n }\n if(str[i+4] =='.'){\n count++;\n }\n if(str[i+4] =='#') {\n count1++;\n }\n if(str[i+5] =='.'){\n count++;\n }\n if(str[i+5] =='#') {\n count1++;\n }\n \n }\n\n \n if(count >= 3 || count1 >= 3){\n printf(\"YES\");\n flag = 1;\n break;\n }\n count = 0;\n count1 = 0;\n }\n if(flag == 0){\n printf(\"NO\");\n \n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int i,j;\n while(scanf(\"%c%c%c%c\",&a[0][0],&a[0][1],&a[0][2],&a[0][3])!=EOF)\n {\n int flag=0;\n for(i=1;i<4;i++)\n {\n getchar();\n for(j=0;j<4;j++)\n scanf(\"%c\",&a[i][j]);\n }\n\t\tgetchar();\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n if(a[i][j]=='#')\n {\n if(j-1>=0&&a[i][j-1]=='#')\n {\n if(i+1<5&&a[i+1][j]=='#')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n\n }\n if(j+1<5&&a[i][j+1]=='#')\n {\n if(i+1<5&&a[i+1][j]=='#')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n }\n }\n else if(a[i][j]=='.')\n {\n if(j-1>=0&&a[i][j-1]=='.')\n {\n if(i+1<5&&a[i+1][j-1]=='.'&&a[i+1][j]=='.')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n\n }\n if(j+1<5&&a[i][j+1]=='.')\n {\n if(i+1<5&&a[i+1][j+1]=='.'&&a[i+1][j]=='.')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==0)\n printf(\"NO\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int i,j;\n while(scanf(\"%c%c%c%c\",&a[0][0],&a[0][1],&a[0][2],&a[0][3])!=EOF)\n {\n int flag=0;\n for(i=1;i<4;i++)\n {\n getchar();\n for(j=0;j<4;j++)\n scanf(\"%c\",&a[i][j]);\n }\n\t\tgetchar();\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n if(a[i][j]=='#')\n {\n if(j-1>=0&&a[i][j-1]=='#')\n {\n if(i+1<5&&a[i+1][j]=='#')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n\n }\n if(j+1<5&&a[i][j+1]=='#')\n {\n if(i+1<5&&a[i+1][j]=='#')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n }\n }\n else if(a[i][j]=='.')\n {\n if(j-1>=0&&a[i][j-1]=='.')\n {\n if(i+1<5&&a[i+1][j-1]=='.'&&a[i+1][j]=='.')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n\n }\n if(j+1<5&&a[i][j+1]=='.')\n {\n if(i+1<5&&a[i+1][j+1]=='.'&&a[i+1][j]=='.')\n {\n flag=1;\n printf(\"YES\\n\");\n break;\n }\n }\n }\n }\n if(flag==1)\n break;\n }\n if(flag==0)\n printf(\"NO\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\tchar a[4][4];\n\n\tint i,j;\n\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++)\n\t\tscanf(\"%c\",&a[i][j]);\n\t}\n\n\n\tfor(i=1;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tif(a[i-1][j] == '#' && a[i][j] == '#' && (a[i+1][j]=='#' || a[i][j+1] == \"#\")){\n\t\t\t\tputs(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t}\n\t}\n\tputs(\"NO\");\n\n\n\n\treturn EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar s[17], aj[4];\nint t, flag, i, k; \n\nint main()\n{\n scanf(\"%s\", &s);\n \n int t=4;\n for(i=1; i<=3; i++)\n { scanf(\"%s\", &aj);\n for(k=0; k<4; k++)\n {s[k+t]=aj[k];}\n t=t+4;\n }\n \n for(i=0; i<16; i++)\n { if((s[i]==s[i+1] && (s[i]==s[i+4] || s[i]==s[i+5])) ||\n (s[i]==s[i+4] && s[i]==s[i+5])) {flag=1; break;}}\n \n if(flag==1 && i%4==3 && s[i+4]!=s[i+3]) flag=0;\n \n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define ROW 4\n#define COL 4\n\n/*\n .X\n XX\n If any 3 of the 4 squares are the same colour then we can make a square\n */\n\n//Counts \nint count (int g[ROW][COL], int r, int c){\n int n=0, i, j;\n \n for (i=r; i<2; i++)\n for (j=c; j<2; j++)\n if (g[i][j] == 1) \n n++;\n\n return n;\n}\n\nint main (){\n\n int grid[ROW][COL] = {{0}};\n int i, j, c;\n int sq = 0;\n\n for (i=0; i<ROW; i++)\n for (j=0; j<COL; j++){\n c = getchar();\n if (c == '#'){\n grid[i][j] = 1;\n } else if (c == '.') {\n grid[i][j] = 0; \n } else {\n //Invalid input\n //Get next char without exiting loop\n j--;\n }\n }\n\n //Analyse the grid\n for (i=0; i<ROW-1; i++){\n for (j=0; j<COL-1; j++){\n if (count(grid, i, j) != 2)\n sq = 1;\n }\n }\n\n if (sq == 1) \n printf(\"YES\\n\");\n else \n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&a[i][j]);\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y+1])\n k++;\n if(a[i][j]==a[x+1][y])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n return 0;\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[4][4];\n int count = 0,flag = 0,i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\" %c\",&a[i][j]);\n }\n }\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n count = 0;\n if(a[i][j] == a[i+1][j])\n count++;\n if(a[i][j] == a[i][j+1])\n count++;\n if(a[i][j] == a[i+1][j+1])\n count++;\n if(count>=2)\n {\n flag = 1;\n goto hell;\n }\n }\n }\n hell:\n if(flag == 1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char arr[4][4];\n int flag=0;\n int i,j;\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\"%c\",&arr[i][j]);\n if(arr[i][j]=='\\n'){\n j--;\n }\n }\n if(arr[i][j]=='\\n'){\n i--;\n }\n }\n\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if((arr[i][j]==arr[i][j+1])){\n\n if((arr[i][j]==arr[i+1][j])||(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n else if((arr[i][j]==arr[i+1][j])&&(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n else if((arr[i][j+1]==arr[i+1][j])&&(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n }\n\n }\n }\n if(flag==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a[4][4];\nint i,j,flag;\nfor(i=0;i<4;i++)\n { for(j=0;j<4;j++)\n { scanf(\"%c\",&a[i][j]);\n }\n\n }\n\n\n flag=0;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n { if((a[i][j]==a[i][j+1]&&a[i][j+1]==a[i+1][j])||(a[i][j]==a[i][j+1]&&a[i][j+1]==a[i+1][j+1])||(a[i][j]==a[i+1][j+1]&&a[i+1][j+1]==a[i+1][j])||(a[i][j+1]==a[i+1][j]&&a[i+1][j]==a[i+1][j+1]))\n {\n flag=1;\n\n printf(\"YES\");\n break;\n }}if(flag==1)break;}\n if(flag==0)\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,j,flag,count;\n char a[4][5];\n for(i=0;i<4;i++){\n scanf(\"%s\",a[i]);\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n count=0;\n flag=a[i][j];\n if(a[i+1][j]==flag){\n count++;\n }\n if(a[i][j+1]==flag){\n count++;\n }\n if(a[i+1][j+1]==flag){\n count++;\n }\n if(count>1){\n printf(\"YES\");\n return 0;\n }\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char x[10][10];\n int i,j;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&x[i][j]);\n }\n }\n int flag=0;\n for (i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if ((x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j+1])|| \\\n (x[i][j]==x[i][j+1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j-1])|| \\\n (x[i][j]==x[i][j-1]&& x[i][j]==x[i+1][j])|| \\\n (x[i][j]==x[i+1][j]&& x[i][j]==x[i+1][j-1] ))\n\n {\n printf(\"%d %d %c %c %c %c\\n\", i,j,x[i][j],x[i][j-1],x[i+1][j],x[i+1][j-1]);\n printf(\"YES\");\n flag=1;\n return;\n }\n }\n }\n if (flag==0)\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_repaint(char arr[][5])\n{\nint i ,j;\n for (i=0;i<5;i++)\n for(j=0;j<5;j++)\n {\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n }\n return 0 ;\n}\nint main()\n{\n char arr[5][5];\n int i;\n for (i=1;i<5;i++)\n scanf(\"%s\",arr[i]);\n i=0;\nif(check_repaint(arr))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "//In the name of God\n\n#include <stdio.h>\n\nint main()\n{\n\tint i,j;\n\tchar c[50][50];\n\tfor(i=1;i<=4;i++)\n\t\tfor(j=1;j<=4;)\n\t\t{\n\t\t\tscanf(\"%c\",&c[i][j]);\n\t\t\tif(c[i][j]!='\\n')\n\t\t\t\tj++;\n\t\t}\n\tfor(i=1;i<=4;i++)\n\t{\n\t\tfor(j=1;j<=4;j++)\n\t\t\tif((c[i][j]==c[i+1][j] && c[i+1][j+1]==c[i][j]) || (c[i][j]==c[i+1][j] && c[i][j]==c[i][j+1]) || (c[i][j]==c[i][j+1] && c[i][j]==c[i+1][j+1]))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4][4];\n int i,j,k,l;\n char t;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&t);\n if(t==\"#\")\n a[i][j]=1;\n if(t==\".\")\n a[i][j]=0;\n }\n }\n for(i=0; i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n k=0;\n l=0;\n if(a[i][j]==0)\n k++;\n else\n l++;\n if(a[i][j+1]==0)\n k++;\n else\n l++;\n if(a[i+1][j]==0)\n k++;\n else\n l++;\n if(a[i+1][j+1]==0)\n k++;\n else\n l++;\n if(k>=3||l>=3)\n break;\n }\n if(k>=3||l>=3)\n break;\n }\n if(k>=3||l>=3)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "//In the name of God\n\n#include <stdio.h>\n\nint main()\n{\n\tint i,j;\n\tchar c[50][50];\n\tfor(i=1;i<=4;i++)\n\t\tfor(j=1;j<=4;)\n\t\t{\n\t\t\tscanf(\"%c\",&c[i][j]);\n\t\t\tif(c[i][j]!='\\n')\n\t\t\t\tj++;\n\t\t}\n\tfor(i=1;i<=4;i++)\n\t{\n\t\tfor(j=1;j<=4;j++)\n\t\t\tif((c[i][j]==c[i+1][j] && c[i+1][j+1]==c[i][j]) || (c[i][j]==c[i+1][j] && c[i][j]==c[i][j+1]) || (c[i][j]==c[i][j+1] && c[i][j]==c[i+1][j+1]))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar a[4][4];\n\tint i,j,possible=0;\n\tchar c;\n\n\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%s\",a[i]);\n\t}\n\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tc=a[i][j];\n\t\t\tif((a[i][j+1]==c && a[i+1][j]==c && j<3) || (a[i][j+1]==c && a[i+1][j+1]==c && j<3)|| (a[i+1][j+1]==c && a[i+1][j]==c && j<3) || (a[i+1][j-1]==c && a[i+1][j]==c && j>0)){\n\t\t\t\tpossible=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(possible==1){\n break;\n\t\t}\n\t}\n\tif(possible==1){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char arr[4][4];\n int mat[4][4];\n int i,j,p,sum=0;\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n scanf(\"%c\",&arr[i][j]);\n if(arr[i][j]=='#')\n mat[i][j]=1;\n else\n mat[i][j]=0;\n }\n }\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n \n sum=mat[i][j]+mat[i+1][j]+mat[i][j+1]+mat[i+1][j+1];\n }\n if(sum!=2)\n {\n printf(\"YES\");\n p=1;\n return 0;\n }\n }\n if(p=0)\n printf(\"NO\");\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar a[4][4];\nint i,j,x,y,h;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=4;j++)\n{\nscanf(\"%c\",&a[i][j]);\n}\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n h=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n h++;\n if(a[i][j]==a[x+1][y])\n h++;\n if(a[i][j]==a[x+1][y+1])\n h++;\n if(h>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar a[4][4];\n\tint i,j,possible=0;\n\tchar c;\n\n\n\tfor(i=0;i<4;i++){\n\t\tscanf(\"%s\",a[i]);\n\t}\n\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tc=a[i][j];\n\t\t\tif((a[i][j+1]==c && a[i+1][j]==c && j!=3) || (a[i][j+1]==c && a[i+1][j+1]==c && j!=3)|| (a[i+1][j+1]==c && a[i+1][j]==c) || (a[i+1][j-1]==c && a[i+1][j]==c && j!=0)){\n\t\t\t\tpossible=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(possible==1){\n\t\tprintf(\"YES\\n\");\n\t}\n\telse{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define REP(I, N) for (int I = 0; I < (N); ++I) \n\n\n\nint main(){\n int vec1[9]={0},vec2[9]={0};\n char str[4][5];\n for(int i=0;i<4;i++)scanf(\"%s\",str[i]);\n for(int i=0;i<4;i++){\n for(int j=0;j<4;j++){\n if(i==0){\n if(j<1){\n if(str[i][j]=='#')vec1[0]++;\n else vec2[0]++;\n }\n else if(j==1){\n if(str[i][j]=='#'){vec1[0]++;\n vec1[1]++; \n }\n else {vec2[0]++;\n vec2[1]++; \n }\n }\n else if(j==2){\n if(str[i][j]=='#'){vec1[2]++;\n vec1[1]++; \n }\n else {vec2[2]++;\n vec2[1]++; \n }\n }\n else{\n if(str[i][j]=='#'){vec1[2]++;\n \n }\n else {vec2[2]++;\n \n }\n }\n }\n else if(i==1){\n if(j<1){\n if(str[i][j]=='#'){vec1[0]++;\n vec1[3]++; \n }\n else {vec2[0]++;\n vec2[3]++; \n }\n }\n else if(j==1){\n if(str[i][j]=='#'){vec1[0]++;\n vec1[1]++;\n vec1[3]++;\n vec1[4]++; \n\n }\n else {vec2[0]++;\n vec2[1]++;\n vec2[3]++; \n vec2[4]++; \n }\n }\n else if(j==2){\n if(str[i][j]=='#'){vec1[1]++;\n vec1[2]++;\n vec1[4]++;\n vec1[5]++; \n\n }\n else {vec2[1]++;\n vec2[2]++;\n vec2[4]++; \n vec2[5]++; \n }\n }\n else{\n if(str[i][j]=='#'){vec1[2]++;\n vec1[5]++; \n }\n else {vec2[2]++;\n vec2[5]++; \n }\n }\n }else if(i==2){\n if(j<1){\n if(str[i][j]=='#'){vec1[3]++;\n vec1[6]++; \n }\n else {vec2[6]++;\n vec2[3]++; \n }\n }\n else if(j==1){\n if(str[i][j]=='#'){vec1[6]++;\n vec1[7]++;\n vec1[3]++;\n vec1[4]++; \n\n }\n else {vec2[6]++;\n vec2[7]++;\n vec2[3]++; \n vec2[4]++; \n }\n }\n else if(j==2){\n if(str[i][j]=='#'){vec1[7]++;\n vec1[8]++;\n vec1[4]++;\n vec1[5]++; \n\n }\n else {vec2[7]++;\n vec2[8]++;\n vec2[4]++; \n vec2[5]++; \n }\n }\n else{\n if(str[i][j]=='#'){vec1[8]++;\n vec1[5]++; \n }\n else {vec2[8]++;\n vec2[5]++; \n }\n }\n }\n else{\n if(j<1){\n if(str[i][j]=='#')vec1[6]++;\n else vec2[6]++;\n }\n else if(j==1){\n if(str[i][j]=='#'){vec1[6]++;\n vec1[7]++; \n }\n else {vec2[6]++;\n vec2[7]++; \n }\n }\n else if(j==2){\n if(str[i][j]=='#'){vec1[7]++;\n vec1[8]++; \n }\n else {vec2[7]++;\n vec2[8]++; \n }\n }\n else{\n if(str[i][j]=='#'){\n vec1[8]++; \n }\n else {\n vec2[8]++; \n }\n }\n }\n }}\n for(int i=0;i<9;i++){\n if(vec1[i]==3 || vec2[i]==3){\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\"); \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nchar s[4], a[4];\nint t, flag, i, k; \n\nint main()\n{\n scanf(\"%s\", &s);\n \n for(k=1; k<=3; k++)\n { scanf(\"%s\", &a);\n for(i=0; i<4; i++)\n if(s[i]==a[i] && (s[i]==s[i+1] || a[i]==a[i+1] || a[i]==a[i-1])) {flag=1; break;}\n for(t=0; t<4; t++)\n s[t]==a[t];\n }\n \n \n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint sumar(int a,int b,int c,int d){\n\n\ta=a+b+c+d;\n\t\n\tif(a>=3){\n\t\ta=0;\n\t}else{\n\t\ta=1;\n\t}\n\t\n\treturn a;\n}\n\nint main () {\n\t\n\tint lista[4][4];\n\tint i,j,k;\n\tchar * p;\n\t\n\tp=(char *)malloc(sizeof(char)*4);\n\t\n\tfflush(stdin);\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tlista[i][j]=getchar();\n\t\t\tif(lista[i][j]==46){\n\t\t\t\tlista[i][j]=0;\n\t\t\t}else{\n\t\t\t\tlista[i][j]=1;\n\t\t\t}\n\t\t}\n\t\tgetchar();\n\t\tfflush(stdin);\n\t}\n\t\n\tp=\"NO\";\n\t\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tk=sumar(lista[i][j],lista[i+1][j],lista[i][j+1],lista[i+1][j+1]);\n\t\t\tif(k==0){\n\t\t\t\tp=\"YES\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tputs(p);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nmain()\n{\nchar a[4][4];\nfor(int i=0;i<4;i++)\n{\n\tfor(int j=0;j<4;j++)\n\t{\n\t\tscanf(\"%c\",&a[i][j]);\n\t}\n}\nint c=0;int d=0;\nfor(int i=1;i<4;i++)\n{\n\t\n\tfor(int j=0;j<3;j++)\n\t{\n\t\tif(a[i][j]=='#')\n\t\tc++;\n\t\telse\n\t\td++;\n\t\tif(a[i-1][j]=='#')\n\t\tc++;\n\t\telse\n\t\td++;\n\t if(a[i][j+1]=='#')\n\t c++;\n\t else\n\t d++;\n\t\tif(a[i-1][j+1]=='#')\n\t\tc++;\n\t\telse\n\t\td++;\n\t\t\t\n\t\t\tif(c==4||c==3||d==4||d==3)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tprintf(\"YES\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tc=0;\n\t\t}\n\t}\n\t\t\t\nprintf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char arr[4][4];\n int flag=0;\n int i,j;\n for(i=0;i<4;i++){\n for(j=0;j<4;j++){\n scanf(\"%c\",&arr[i][j]);\n if(arr[i][j]=='\\n'){\n j--;\n }\n }\n if(arr[i][j]=='\\n'){\n i--;\n }\n }\n\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n if((arr[i][j]==arr[i][j+1])){\n\n if((arr[i][j]==arr[i+1][j])||(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n else if((arr[i][j]==arr[i+1][j])&&(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n else if((arr[i][j+1]==arr[i+1][j])&&(arr[i][j]==arr[i+1][j+1])){\n\n flag=1;\n\n }\n }\n\n }\n }\n if(flag==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char squareArray[4][4];\n int i,flag=0,j,count;\n for(i=0;i<4;i++){\n scanf(\"%s\",squareArray[i]);\n }\n for(i=0;i<3;i++){\n for(j=0;j<3;j++){\n count = 0;\n if(squareArray[i][j]=='#')count++;\n if(squareArray[i][j+1]=='#')count++;\n if(squareArray[i+1][j]=='#')count++;\n if(squareArray[i+1][j+1]=='#')count++;\n if(count>=3){\n flag=1;\n break;\n }\n }\n if(flag==1)break;\n }\n if(flag==1)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdlib.h>\n\nint main() {\n int i,j, a[4][4];\n char s[4];\n for(i = 0; i < 4; i++)\n { scanf(\"%s\", &s);\n if(s[0] == '#' )\n a[i][0] = 1;\n else a[i][0] = 0;\n \n if(s[1] == '#' )\n a[i][1] = 1;\n else a[i][1] = 0;\n \n if(s[2] == '#' )\n a[i][2] = 1;\n else a[i][2] = 0;\n \n if(s[3] == '#' )\n a[i][3] = 1;\n else a[i][3] = 0;\n}\n for(i = 0; i < 3; i++)\n for(j = 0; j < 3; j++)\n {\n int m = a[i][j] + a[i+1][j] + a[i][j+1] + a[i+1][j+1];\n if(m != 2 ) {printf(\"YES\"); return 0;}\n }\n printf(\"NO\");\n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n \nchar grid[4][4];\n \nint isBlack(int i,int j)\n{\n if(grid[i][j] == '#')\n return 1;\n else\n return 0;\n}\n \nint find(int i,int j)\n{\n if(isBlack(i,j) && isBlack(i,j+1) && isBlack(i+1,j+1) && !isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && !isBlack(i,j+1) && isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(!isBlack(i,j) && isBlack(i,j+1) && isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n if(isBlack(i,j) && isBlack(i,j+1) && !isBlack(i+1,j+1) && isBlack(i+1,j))\n return 1;\n return 0;\n}\n \nint solve()\n{\n int i,j;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n {\n if(find(i,j)==1)\n return 1;\n }\n }\n return 0;\n}\n \nint main()\n{\n int i,j;\n char s[5];\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",s);\n for(j=0;j<4;j++)\n grid[i][j] = s[j];\n }\n \n if(solve()==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,i,j,m;\n char a[6][6];\n int sign=0;\n for(i=1;i<=4;i++) scanf(\"%s\",a[i]+1);\n for(i=1;i<=4;i++){\n for(j=1;j<=4;j++){\n char temp=a[i][j];\n a[i][j]='#';\n for(n=1;n<=3;n++){\n for(m=1;m<=3;m++){\n if(a[n][m]=='#'&&a[n+1][m]=='#'&&a[n][m+1]=='#'&&a[n+1][m+1]=='#')\n sign=1;\n }\n }\n a[i][j]=='.';\n for(n=1;n<=3;n++){\n for(m=1;m<=3;m++){\n if(a[n][m]=='.'&&a[n+1][m]=='.'&&a[n][m+1]=='.'&&a[n+1][m+1]=='.')\n sign=1;\n }\n }\n a[i][j]=temp;\n }\n }\n if(sign==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char (a[5])[5], b;\n int test=0, test2=0;\n for(int i=0;i<4;i++)\n {\n scanf(\"%s\", a[i]);\n }\n //printf(\"%c%c\\n%c%c\", a[0+1][0+1],a[1+0][1+1],a[1+1][0+1],a[1+1][1+1]);\n\n for(int i=0;i<3;i++)\n {\n for(int j=0;j<3;j++)\n {\n test=1;test2=1;\n b=a[i][j];\n //printf(\"%\\n%i%i,%i%i\\n%i%i,%i%i\\n%\", i,j,i,j+1, i+1,j, i+1,j+1);\n //printf(\"%\\n%c%c\\n%c%c\\n%\", b,a[i][j+1], a[i+1][j], a[i+1][j+1]);\n if( a[i][j+1] == b)\n test++;\n else\n test2++;\n if( a[i+1][j] == b)\n test++;\n else\n test2++;\n if( a[i+1][j+1] == b)\n test++;\n else\n test2++;\n if(test>2 || test2>2)\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4][4]={0};\n\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<4;j++)\n {\n scanf(\"%c\",&a[i][j]);\n\n if(a[i][j]=='#')\n a[i][j]=1;\n }\n\n scanf(\"\\n\");\n }\n\n for(int i=0;i<3;i++)\n for(int j=0;j<3;j++)\n {\n if(((a[i+1][j] + a[i][j+1] + a[i+1][j+1]) == 0) || ((a[i+1][j] + a[i][j+1] + a[i+1][j+1]) == 3))\n {printf(\"YES\"); return 0;}\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[5][5];\n int c=0,i,j;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n if(((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j])) ||((a[i][j]==a[i][j+1]) && (a[i][j]==a[i+1][j+1]) )|| ((a[i][j]==a[i+1][j+1]) &&(a[i][j]==a[i+1][j])) ||((a[i+1][j]==a[i][j+1])&& (a[i+1][j]==a[i+1][j+1] )))\n {\n c=1;\n break;\n }\n else\n {\n c=0;\n }\n\n }\n }\n if(c==1)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[16],i;\n int c=0;\n for(i=0;i<16;i++)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=0;i<12;i++)\n {\n if(a[i]==a[i+4]||a[i+1]==a[i+5])\n {\n c=1;\n break;\n }\n\n else\n c=0;\n }\n if(c==1)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint check(int a[6][6]);\n\nint main()\n{\n int a[6][6] = {0};\n int i, j, k, t;\n char s[5];\n int m;\n\n for(i = 1; i < 5; i++) {\n scanf(\"%s\", s);\n for(j = 1; j < 5; j++){\n if(s[j] == '#')\n a[i][j] = 1;\n else\n a[i][j] = 0;\n }\n }\n/*\n for(i = 1; i < 5; i++) {\n for(j = 1; j < 5; j++) {\n printf(\"%d \", a[i][j]);\n }\n printf(\"\\n\");\n }\n*/\n m = check(a);\n if(m == 1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\nint check(int a[6][6])\n{\n int i, j, k, t;\n int tmp = 0;\n\n for(i = 1; i < 4; i++) {\n for(j = 1; j < 4; j++) {\n tmp = a[i][j] + a[i][j+1] + a[i+1][j] + a[i+1][j+1];\n if (tmp == 2)\n return 1;\n else\n continue;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_repaint(char arr[][4])\n{\nint i ,j;\n for (i=0;i<4;i++)\n for(j=0;j<4;j++)\n {\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i-1][j+1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i-1][j-1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n }\n return 0 ;\n}\nint main()\n{\n char arr[4][4];\n int i;\n for (i=0;i<4;i++)\n scanf(\"%s\",arr[i]);\nif(check_repaint(arr))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint field[4][4];\n\tint i, j;\n\tfor(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tfield[j][i] = getchar();\n\t\t\tfield[j][i] = (field[j][i] == '#') ? 1 : 0;\n\t\t}\n\t\tgetchar();\n\t}\n\tint sum;\n\tfor(i = 0; i < 4; i++)\n\t{\n\t\tfor(j = 0; j < 4; j++)\n\t\t{\n\t\t\tfield[j][i] = 1 - field[j][i];\n\t\t\tif((j > 0 && i > 0 && (field[j - 1][i - 1] + field[j][i - 1] + field[j - 1][i] + field[j][i] == 0 || field[j - 1][i - 1] + field[j][i - 1] + field[j - 1][i] + field[j][i] == 4)) || (j > 0 && i < 3 && (field[j - 1][i + 1] + field[j][i + 1] + field[j - 1][i] + field[j][i] == 0 || field[j - 1][i + 1] + field[j][i + 1] + field[j - 1][i] + field[j][i] == 4)) || (j < 3 && i > 0 && (field[j + 1][i - 1] + field[j][i - 1] + field[j + 1][i] + field[j][i] == 0 || field[j - 1][i - 1] + field[j][i - 1] + field[j - 1][i] + field[j][i] == 4)) || (j < 3 && i < 3 && (field[j + 1][i + 1] + field[j][i + 1] + field[j + 1][i] + field[j][i] == 0 || field[j - 1][i - 1] + field[j][i + 1] + field[j + 1][i] + field[j][i] == 4)))\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tfield[j][i] = 1 - field[j][i];\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar ch[4][4];\nint i,j,a=0,b=0,p=1,q=1,f=0,bl=0,w=0;\nfor(i=0;i<=3;i++){\n for(j=0;j<=3;j++)\n {scanf(\"%c\",&ch[i][j]);}\n //printf(\"\\n\");\n}\n loop:w=0;bl=0;\n for(i=a;i<=p;i++)\n {\n for(j=b;j<=q;j++)\n {\n if(ch[i][j]=='.')\n w++;\n else\n bl++;\n }\n }\n if(w>=3 || bl>=3)\n {\n printf(\"YES\");\n return 0;\n }\n else\n if(a<3)\n {{\n f++;\n if(f%3!=0)\n {\n a++;p++;\n b=0;q=1;\n }\n else\n {\n b++;\n q++;}\n goto loop;\n }}\n printf(\"NO\");\n return 0;\n }"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_repaint(char arr[][4])\n{\nint i ,j;\n for (i=0;i<4;i++)\n for(j=0;j<4;j++)\n {\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n // if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n //if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i-1][j+1]&&arr[i][j]==arr[i-1][j])return 1 ;\n //if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i-1][j-1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n //if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n //if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i-1][j+1]&&arr[i][j]==arr[i-1][j])return 1 ;\n //if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i-1][j-1]&&arr[i][j]==arr[i-1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n }\n return 0 ;\n}\nint main()\n{\n char arr[4][4];\n int i;\n for (i=0;i<4;i++)\n scanf(\"%s\",arr[i]);\n i=0;\nif(check_repaint(arr))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_repaint(char arr[][5])\n{\nint i ,j;\n for (i=1;i<5;i++)\n for(j=1;j<5;j++)\n {\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n if(arr[i][j]==arr[i][j+1]&&arr[i][j]==arr[i+1][j+1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]==arr[i][j-1]&&arr[i][j]==arr[i+1][j-1]&&arr[i][j]==arr[i+1][j])return 1 ;\n if(arr[i][j]=='.')\n arr[i][j]='#';\n else\n arr[i][j]='.';\n }\n return 0 ;\n}\nint main()\n{\n char arr[5][5];\n int i;\n for (i=1;i<5;i++)\n scanf(\"%s\",arr[i]);\nif(check_repaint(arr))\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar A[5][5];\n\tint i,j;\n\n\tfor (i = 0; i < 4; i++)\n\t{\n\t\tfor (j = 0; j < 4; j++)\n\t\t\tA[i][j] = getchar();\n\t\tgetchar();\n\t}\n\n\tfor (i = 0; i < 3; i++)\n\t{\n\t\tfor (j = 0; j < 3; j++)\n\t\t{\n\t\t\tint cou = 1;\n\t\t\tif (A[i][j + 1] == A[i][j])\n\t\t\t\tcou++;\n\t\t\tif (A[i + 1][j] == A[i][j])\n\t\t\t\tcou++;\n\t\t\tif (A[i + 1][j + 1] == A[i][j])\n\t\t\t\tcou++;\n\t\t\tif (cou >= 3)\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint sumar(int a,int b,int c,int d){\n\t\n\tint k;\n\t\n\tk=a+b+c+d;\n\t\n\tif(k>=3){\n\t\tk=0;\n\t}else{\n\t\tk=1;\n\t}\n\t\n\treturn k;\n}\n\nint main () {\n\t\n\tint lista[4][4];\n\tint i,j,k;\n\tchar * p;\n\t\n\tfflush(stdin);\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tlista[i][j]=getchar();\n\t\t\tif(lista[i][j]==46){\n\t\t\t\tlista[i][j]=0;\n\t\t\t}else{\n\t\t\t\tlista[i][j]=1;\n\t\t\t}\n\t\t}\n\t\tgetchar();\n\t\tfflush(stdin);\n\t}\n\t\n\tp=(char *)malloc(sizeof(char)*4);\n\tp=\"NO\";\n\t\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tk=sumar(lista[i][j],lista[i+1][j],lista[i][j+1],lista[i+1][j+1]);\n\t\t\tif(k==0){\n\t\t\t\tp=\"YES\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tputs(p);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nchar convert(char s[4][4],int i,int j)\n{\nchar c;\nif(s[i][j]=='#')\n{c='.';}\nelse\n{c='#';}\nreturn c;\n}\nint main()\n{\nint i,flag=0,j;\nchar s[4][5],c;\nfor (i=0;i<4;++i)\n {\n scanf(\"%s\",s[i]);\n }\nfor (i=0;i<3;++i)\n {\n for(j=0;j<3;++j)\n {\n c=convert(s,i,j);\n if((c=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(s[i][j]=='#'&&s[i][j+1]=='#'&&s[i+1][j]=='#'&&s[i+1][j+1]=='#')||(c=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.')||(s[i][j]=='.'&&s[i][j+1]=='.'&&s[i+1][j]=='.'&&s[i+1][j+1]=='.'))\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {printf(\"YES\");\n break;\n }\n }\n if(flag==0)\n {printf(\"NO\");}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n char s[5][5];\n int i, j, ck = 0;\n for(i = 0; i < 4; i++)\n {\n scanf(\"%s\", s[i]);\n }\n for(i = 0; i < 3; i++)\n {\n for(j = 0; j < 3; j++)\n {\n if((s[i][j] != s[i][j + 1]) && (s[i][j] != s[i + 1][j]) && (s[i][j] != s[i + 1][j + 1]))\n {\n ck = 1;\n }\n else if((s[i + 1][j] != s[i][j]) && (s[i + 1][j] != s[i][j + 1]) && (s[i + 1][j] != s[i + 1][j + 1]))\n {\n ck = 1;\n }\n else if((s[i + 1][j + 1] != s[i][j]) && (s[i + 1][j + 1] != s[i][j + 1]) && (s[i + 1][j + 1] != s[i + 1][j]))\n {\n ck = 1;\n }\n else if((s[i][j + 1] != s[i][j]) && (s[i][j + 1] != s[i + 1][j + 1]) && (s[i][j + 1] != s[i + 1][j]))\n {\n ck = 1;\n }\n }\n }\n if(ck == 0)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,flag=0;\n\tchar a[4][4];\n\tfor (i=0;i<4;i++)\n\t{\n\t\tscanf(\" %c%c%c%c\",&a[i][0],&a[i][1] ,&a[i][2],&a[i][3]);\n\t}\n\tfor ( i=0;i<4;i++)\n\t{\n\t\tfor (j=0;j<4;j++)\n\t\tprintf(\"%c\",a[i][j]);\n\t}\n\tfor (i=0;i<3;i++)\n\t{\n\t\tfor (j=0;j<3;j++)\n\t\t{\n\t\tif ((((a[i][j]==a[i+1][j])&&(a[i][j]==a[i][j+1]))||((a[i][j]==a[i+1][j])&&(a[i][j]==a[i+1][j+1]))||((a[i][j]==a[i][j+1])&&(a[i][j]==a[i+1][j+1])))||((a[i+1][j]==a[i+1][j+1])&&(a[i+1][j+1]==a[i][j+1])))\n\t\tflag++;\n\t\t}\n\t}\n\tif (flag!=0)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main () {\n\t\n\tint lista[4][4];\n\tint i,j;\n\t\n\tfflush(stdin);\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tlista[i][j]=getchar();\n\t\t}\n\t\tgetchar();\n\t\tfflush(stdin);\n\t}\n\t\n\tfor(i=0;i<4;i++){\n\t\tfor(j=0;j<4;j++){\n\t\t\tprintf(\"%d\",lista[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a[4][4];\nint i,j,x,y,k;\nfor(i=0;i<=3;i++)\n{\nfor(j=0;j<=3;j++)\n{\nscanf(\"%d\",&a[i][j]);\nif(a[i][j]=='x')\na[i][j]=4;\nelse\na[i][j]=5;\n}\nprintf(\"\\n\");\n}\nfor(i=0;i<=2;i++)\n{\nfor(j=0;j<=2;j++)\n{\n k=0;\n x=i;\n y=j;\n if(a[i][j]==a[x][y+1])\n k++;\n if(a[i][j]==a[x+1][y-1])\n k++;\n if(a[i][j]==a[x][y+1])\n k++;\n if(k>=2)\n {\n printf(\"YES\");\n exit(0);\n }\n}\n}\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main()\n{\n char square[4][5];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%s\",square[i]);\n for(i=0;i<4;i++)\n {\n int j;\n for(j=0;j<4;j++)\n {\n if((square[i][j]==square[i][j+1])&&((square[i][j]==square[i+1][j])||(square[i][j]==square[i+1][j+1])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n if((square[i+1][j]==square[i+1][j+1])&&((square[i+1][j]==square[i][j])||(square[i+1][j]==square[i][j+1])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint main(void) {\n int n = 4;\n int m = 0;\n bool found = false;\n char arr[n][n];\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n scanf(\"%c\", *(arr + i) + j);\n }\n scanf(\"%c\", &m);\n }\n\n for (int i = 0; i < n; i++) {\n for (int j = 0, k = 0; j < n; j++, k = 0) {\n if (arr[i][j] == '#') {\n k++;\n }\n if (i > 0 && arr[i - 1][j] == '#') {\n k++;\n }\n if (j < (n - 1) && arr[i][j + 1] == '#') {\n k++;\n }\n if (j < (n - 1) && i > 0 && arr[i - 1][j + 1] == '#') {\n k++;\n }\n\n if (k == 3) {\n found = true;\n goto done;\n }\n }\n }\n\n done:\n\n if (found == true) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n\nint main()\n{\n char square[4][5];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%s\",square[i]);\n for(i=0;i<4;i++)\n {\n int j;\n for(j=0;j<4;j++)\n {\n if((square[i][j]==square[i][j+1])&&((square[i][j]==square[i+1][j])||(square[i][j]==square[i+1][j+1])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n if((square[i+1][j]==square[i+1][j+1])&&((square[i+1][j]==square[i][j])||(square[i+1][j]==square[i][j+1])))\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n }\n printf(\"NO\\n\");\n}"}], "src_uid": "01b145e798bbdf0ca2ecc383676d79f3"} {"nl": {"description": "Gennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called \"Mau-Mau\".To play Mau-Mau, you need a pack of $$$52$$$ cards. Each card has a suit (Diamonds \u2014 D, Clubs \u2014 C, Spades \u2014 S, or Hearts \u2014 H), and a rank (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, or A).At the start of the game, there is one card on the table and you have five cards in your hand. You can play a card from your hand if and only if it has the same rank or the same suit as the card on the table.In order to check if you'd be a good playing partner, Gennady has prepared a task for you. Given the card on the table and five cards in your hand, check if you can play at least one card.", "input_spec": "The first line of the input contains one string which describes the card on the table. The second line contains five strings which describe the cards in your hand. Each string is two characters long. The first character denotes the rank and belongs to the set $$$\\{{\\tt 2}, {\\tt 3}, {\\tt 4}, {\\tt 5}, {\\tt 6}, {\\tt 7}, {\\tt 8}, {\\tt 9}, {\\tt T}, {\\tt J}, {\\tt Q}, {\\tt K}, {\\tt A}\\}$$$. The second character denotes the suit and belongs to the set $$$\\{{\\tt D}, {\\tt C}, {\\tt S}, {\\tt H}\\}$$$. All the cards in the input are different.", "output_spec": "If it is possible to play a card from your hand, print one word \"YES\". Otherwise, print \"NO\". You can print each letter in any case (upper or lower).", "sample_inputs": ["AS\n2H 4C TH JH AD", "2H\n3D 4C AC KD AS", "4D\nAS AC AD AH 5H"], "sample_outputs": ["YES", "NO", "YES"], "notes": "NoteIn the first example, there is an Ace of Spades (AS) on the table. You can play an Ace of Diamonds (AD) because both of them are Aces.In the second example, you cannot play any card.In the third example, you can play an Ace of Diamonds (AD) because it has the same suit as a Four of Diamonds (4D), which lies on the table."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],b[3];\n int c=0;\n scanf(\"%s\",a);\n for(int i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0] || a[1]==b[1])\n c++;\n }\n if(c>0)\n printf(\"YES\");\n else\n {\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,x=0;\n char F[2] ;\n char H[2];\n\n scanf(\"%s\" ,F );\n\n for (i=0 ;i<=4 ;i++)\n {\n scanf(\"%s\", H);\n if ((H[0]==F[0]) || (H[1]==F[1]))\n\n x++;\n\n }\n if (x>0)\n printf(\"Yes\");\n\n else\n {\n printf(\"No\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nchar a,b,w;\nint count=0;\nscanf(\"%c%c%c\",&a,&b,&w);\nfor(int i=0;i<5;i++){\nchar c,d;\nscanf(\"%c%c%c\",&c,&d,&w);\nif(a==c || b==d){\n\tprintf(\"YES\");\n\tbreak;}\nelse\n\tcount++;\n}\nif(count==5)\n\tprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[3],b[3],c[3],d[3],e[3],f[3];\n int i,j,k;\n while(scanf(\"%s\",&a)!=EOF){\n scanf(\"%s %s %s %s %s\",&b,&c,&d,&e,&f);\n if(a[0]=='T'||a[0]=='J'||a[0]=='Q'||a[0]=='K'||a[0]=='A'){\n if(a[0]==b[0])printf(\"YES\\n\");\n else{\n if(a[0]==c[0])printf(\"YES\\n\");\n else{\n if(a[0]==d[0])printf(\"YES\\n\");\n else{\n if(a[0]==e[0])printf(\"YES\\n\");\n else{\n if(a[0]==f[0])printf(\"YES\\n\");\n else{\n if(a[1]==b[1])printf(\"YES\\n\");\n else{\n if(a[1]==c[1])printf(\"YES\\n\");\n else{\n if(a[1]==d[1])printf(\"YES\\n\");\n else{\n if(a[1]==e[1])printf(\"YES\\n\");\n else{\n if(a[1]==f[1])printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n else{\n if(a[1]==b[1])printf(\"YES\\n\");\n else{\n if(a[1]==c[1])printf(\"YES\\n\");\n else{\n if(a[1]==d[1])printf(\"YES\\n\");\n else{\n if(a[1]==e[1])printf(\"YES\\n\");\n else{\n if(a[1]==f[1])printf(\"YES\\n\");\n else{\n if(a[0]==b[0])printf(\"YES\\n\");\n else{\n if(a[0]==c[0])printf(\"YES\\n\");\n else{\n if(a[0]==d[0])printf(\"YES\\n\");\n else{\n if(a[0]==e[0])printf(\"YES\\n\");\n else{\n if(a[0]==f[0])printf(\"YES\\n\");\n else printf(\"NO\\n\");}\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[2];\n\tchar b[5];\n\tint i,cnt=0;\n\tscanf(\"%s\",a);\n\tfor(i=0;i<5;i++)\n\t{\n\t\tscanf(\"%s\",b);\n\t\tif(a[0]==b[0]||a[1]==b[1])\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[10],b[10],c[10],d[10],e[10],f[10];\n int count=0,i;\n scanf(\" %s\",a);\n scanf(\" %s %s %s %s %s\",b,c,d,e,f);\n for(i=0;i<2;i++)\n {\n if (b[i]==a[i] || c[i]==a[i] || d[i]==a[i] ||e[i]==a[i] ||f[i]==a[i])\n count++;\n }\n if(count!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,cnt=0;\nchar a[2];\nchar b[2];\nscanf(\"%s\",a);\nfor(i=0;i<5;i++)\n{\nscanf(\"%s\",b);\nif(a[0]==b[0]||a[1]==b[1]){\ncnt=1;\nbreak;\n}\n}\nif(cnt==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,t=0;\nchar s1[3],s2[3];\nscanf(\"%s\",&s1);\nfor(i=0;i<5;i++){\n scanf(\"%s\",&s2);\n if(s1[0]==s2[0]||s1[1]==s2[1]) t++;\n}\nprintf(t>0?\"yes\":\"no\");\n}"}, {"source_code": "#include <stdio.h>\n \nint main(){\n char tab1[3] = {0};\n char tab2[3] = {0};\n scanf(\"%s\", tab1);\n \n for(int i=0; i<5; i++)\n {\n scanf(\"%s\", tab2);\n if(tab1[0] == tab2[0] || tab1[1] == tab2[1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<strings.h>\n#include<stdlib.h>\nint main()\n{\n int i,j;\n char s[3];\n char t[6][2];\n scanf(\"%s\",s);\n for(i=0;i<5;i++)\n scanf(\"%s\",t[i]);\n for(j=0;j<5;j++)\n {\n if(s[0]==t[j][0]||s[1]==t[j][1])\n {printf(\"YES\");\n return 0;\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar orta[3];\n\tchar el1[3];\n\tchar el2[3];\n\tchar el3[3];\n\tchar el4[3];\n\tchar el5[3];\n\t\n\tscanf(\"%s\", orta);\n\tscanf(\"%s\", el1);\n\tscanf(\"%s\", el2);\n\tscanf(\"%s\", el3);\n\tscanf(\"%s\", el4);\n\tscanf(\"%s\", el5);\n\t\n\tif (el1[0] == orta[0] || el1[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el2[0] == orta[0] || el2[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el3[0] == orta[0] || el3[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el4[0] == orta[0] || el4[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el5[0] == orta[0] || el5[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main () {\n char card1[2],card2[2];\n int i=0,ans=0;\n scanf(\"%c%c\\n\",&card1[0],&card1[1]);\n while(i<10) { // \u5c0d\u624b\u7684\u724c\n scanf(\"%c%c\\n\",&card2[0],&card2[1]);\n if(card2[0] == card1[0])\n ans++;\n if(card2[1] == card1[1])\n ans++;\n i++;\n }\n if (ans > 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char name[3], test[3];\n int i, j, a, length, count = 0,b;\n\n scanf(\"%s\", name);\n\n for(i=1; i<=5; i++)\n {\n scanf(\"%s\", test);\n\n if(test[0] == name[0])\n {\n\n count = 1;\n }\n else if((test[0] == name[0]) && (test[1] == name[1]))\n {\n\n count = 1;\n }\n else if(test[1] == name[1])\n {\n count = 1;\n\n }\n }\n\n if(count == 1)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a=0;\n char s1[10];\n gets(s1);\n char s2[10];\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",&s2);\n if(s1[0]==s2[0] || s1[1]==s2[1])\n {\n a++;\n }\n }\n if(a>0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,count=0;\n char str[2],str_[2];\n scanf(\"%c%c\", &str_[0], &str_[1]);\n for(i=1;i<=5;i++)\n {\n scanf(\" %c%c\", &str[0], &str[1]);\n\n if(str[0]==str_[0] || str[1]==str_[1])\n {\n count++;\n }\n }\n if(count>=1)\n printf(\"YES\\n\");\n else\n printf(\"No\\n\");\n\n\n\n return 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\nint main()\n{\n\tchar s1[2],s2[2];\n\tint k,l;\n\tk=0;\n\tscanf(\"%s\",s1);\n\tfor(int i=0;i<5;i++)\n\t{scanf(\"%s\",s2);\n\tif(s1[0]==s2[0]||s1[1]==s2[1])\n\tk=1;}\n\tif(k==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tchar b[2][3];\n\tchar a[6][3];\n\tint x,y;\n\tint flag=0;\n\n\tscanf(\"%c%c\",&b[1][1],&b[1][2]);\n\tgetchar();\n\n\tfor(x=0;x<5;x++)\n\t{\n\t\tscanf(\"%c%c\",&a[x][1],&a[x][2]);\n\t\tgetchar();\n\t\tif(a[x][1]==b[1][1]) flag=1;\n\t\tif(a[x][2]==b[1][2]) flag=1;\n\t\tif(flag==1) break;\n\t}\n\n\tif(flag==1) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nstruct liste{\n char name[30];\n struct liste *next;\n};\ntypedef struct liste *liste ;\nliste creation(int n){\n liste head,tmp,pt;\n head=malloc(sizeof(struct liste));\n scanf(\"%s\",head->name);\n if(strlen(head->name)!=2)exit(EXIT_FAILURE);\n head->next=NULL;\n pt=head;\n for(int i=1;i<n;i++){\n tmp=malloc(sizeof(struct liste));\n scanf(\"%s\",tmp->name);\n if(strlen(head->name)!=2)exit(EXIT_FAILURE);\n tmp->next=NULL;\n pt->next=tmp;\n pt=tmp;\n }\n return head;\n \n}\nint traitement(char card[],liste L){\n int i=0;\n \nliste p;\n\n do{\n p=L;\n while(p){\n if(card[i]==p->name[i]){\n printf(\"YES\");\n return 0;\n }\n p=p->next;\n }\n i++;\n \n \n }while(i<2);\n \n printf(\"NO\");\n}\n int main(){\nchar card[2];\nliste L;\n scanf(\"%s\",card);\n if(strlen(card)!=2)return 0;\n L=creation(5);\n traitement(card,L);\n \n \n \n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h> \n\nint main()\n{\n\tchar a[5];\n\tchar b[50];\n\t\n\tgets(a);\n\tgets(b);\n\t\n\tfor(int i=0;a[i]!='\\0';i++)\n\t{\n\t\tfor(int j=0;b[j]!='\\0';j++)\n\t\t{\n\t\t\tif(a[i]==b[j])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint n, i, c = 0, d = 0;\n\tchar a[2], b[14];\n\tgets(a);\n\tgets(b);\n\tfor (i = 0; i < 14; i++)\n\t{\n\t\tif (a[0] == b[i] || a[1] == b[i])\n\t\t\tc++;\n\t}\n\tif (c > 0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[5],b[5];\n\tint i,c=0;\n\tscanf(\"%s\",b);\n\tfor(i=0;i<5;i++)\n\t{\n\t\tscanf(\"%s\",a);\n\t\tif (a[0]==b[0]||a[1]==b[1])\n\t\t\tc=1;\n\t}\n\tif(c==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],b[3];\n int c=0;\n scanf(\"%s\",a);\n for(int i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0] || a[1]==b[1])\n c++;\n }\n if(c>0)\n printf(\"YES\");\n else\n {\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],result;\n scanf(\"%s\",&a);\n char b[3],b1[3],b2[3],b3[3],b4[3];\n scanf(\"%s %s %s %s %s\",&b,&b1,&b2,&b3,&b4);\n int i=0;\n while(a[i]!=0)\n {\n result=a[i];\n int j=0;\n char count;\n while(b[j]!=0)\n {\n count=b[j];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n j=j+1;\n }\n int k=0;\n while(b1[k]!=0)\n {\n count=b1[k];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n k=k+1;\n }\n int l=0;\n while(b2[l]!=0)\n {\n count=b2[l];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n l=l+1;\n }\n int m=0;\n while(b3[m]!=0)\n {\n count=b3[m];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n m=m+1;\n }\n int n=0;\n while(b4[n]!=0)\n {\n count=b4[n];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n n=n+1;\n }\n i=i+1;\n\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tchar t[3],h[3];\n\tint i,count = 0;\n\tscanf(\"%s\",t);\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\",h);\n\t\tif(h[0]==t[0] || h[1]==t[1]){\n\t\t\tcount = 1;\n\t\t}\n\t}\n\t if(count == 1){\n\t printf(\"YES\");\n\t }else {\n\t printf(\"NO\");\n\t }\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n char a[3];\n char b[15];\n gets(a);\n gets(b);\n if(a[0]==b[0]||a[0]==b[3]||a[0]==b[6]||a[0]==b[9]||a[0]==b[12]||a[1]==b[1]||a[1]==b[4]||a[1]==b[7]||a[1]==b[10]||a[1]==b[13]){\n printf(\"YES\");\n }\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,cnt=0;\nchar a[2];\nchar b[2];\nscanf(\"%s\",a);\nfor(i=0;i<5;i++)\n{\nscanf(\"%s\",b);\nif(a[0]==b[0]||a[1]==b[1]){\ncnt=1;\nbreak;\n}\n}\nif(cnt==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n char r, s;\n char a, b;\n int flag = 0;\n scanf(\"%c%c\", &a, &b);\n getchar();\n for(int i = 0; i < 5; i++)\n {\n scanf(\"%c%c\", &r, &s);\n getchar();\n if(r == a || b == s) flag = 1;\n }\n if(flag)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n char ch[2],c[2];\n scanf(\"%s\",ch);\n int n=5,count=0;\n while(n--)\n {\n scanf(\"%s\",c);\n if((c[0]==ch[0])||(c[1]==ch[1]))\n count++;\n }\n if(count>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, c = 0;\n\n char s[2], s1[2];\n scanf(\"%s\", &s);\n for(i = 1; i <= 5; i++)\n {\n scanf(\"%s\", &s1);\n if(s[0] == s1[0] || s[1] == s1[1])\n {\n c = 1;\n }\n }\n if(c == 1)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain(){\nchar a[2],b[2],c[2],d[2],e[2],f[2];\ngets(a);\nscanf(\"%s %s %s %s %s\",&b,&c,&d,&e,&f);\nint i,sum=0;\n\n if((a[0]==b[0])||(a[1]==b[1]))\n{\n sum++;\n}\n else if((a[0]==c[0])||(a[1]==c[1]))\n{\n sum++;\n}\n else if((a[0]==d[0])||(a[1]==d[1]))\n{\n sum++;\n}\n else if((a[0]==e[0])||(a[1]==e[1]))\n{\n sum++;\n}\n else if((a[0]==f[0])||(a[1]==f[1]))\n{\n sum++;\n}\n\nelse\n{\n sum=sum;\n}\n\nif(sum>0)\n{\n printf(\"YES\");\n}\nelse\n{\n printf(\"NO\");\n}\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int i,count=0;\n char s[3],a[3];\n scanf(\"%s\",s);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",a);\n if(s[0]==a[0]||s[1]==a[1])\n {\n count=1;\n }\n }\n if(count)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,x=0;\n char F[2] ;\n char H[2];\n\n scanf(\"%s\" ,F );\n\n for (i=0 ;i<=4 ;i++)\n {\n scanf(\"%s\", H);\n if ((H[0]==F[0]) || (H[1]==F[1]))\n\n x++;\n\n }\n if (x>0)\n printf(\"Yes\");\n\n else\n {\n printf(\"No\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() \n\n{ \n int i,l,flag=0;\n char s[12];\n char a,b;\n scanf(\"%c%c\",&a,&b);\n scanf(\"\\n\");\n scanf(\"%[^\\n]s\",&s);\n l=strlen(s);\n for(i=0;i<=l-1;i++)\n {\n if(a==s[i]||b==s[i])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[5][2];\n char f[2];\n int i,count=0;\n for(i=0;i<2;i++)\n {\n scanf(\"%c\",&f[i]);\n }\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",&s[i][0]);\n }\n \n for(i=0;i<5;i++)\n {\n if(s[i][0]==f[0] || s[i][1]==f[1])\n {\n count++;\n }\n }\n if(count==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],b[3];\n int c=0;\n scanf(\"%s\",a);\n for(int i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0] || a[1]==b[1])\n c++;\n }\n if(c>0)\n printf(\"YES\");\n else\n {\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int e=0;\n char s[2],a[2],b[2],c[2],d[2],f[2];\n scanf(\"%s\",&s);\n scanf(\"%s%s%s%s%s\",&a,&b,&c,&d,&f);\n \n if(s[0]==a[0] || s[0]==b[0] || s[0]==c[0] || s[0]==d[0] || s[0]==f[0] || s[1]==a[1] ||s[1]==b[1] || s[1]==c[1] || s[1]==d[1] || s[1]==f[1] )\n e=1;\n \n if(e==1)\n printf(\"YES\");\n if(e==0)\n printf(\"NO\");\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n;\n char a[3];\n char b[3];\n scanf(\"%s\",a);\n for(i=0;i<5;i++){\n scanf(\"%s\",b);\n \n if(a[0]==b[0] || a[1]==b[1]){\n printf(\"YES\\n\");\n return 0;\n }\n }\n \n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6];\n scanf(\"%c%c\",&mat[0][0],&mat[0][1]);\n for(int i=0;i<5;i++)\n {\n scanf(\" %c%c\",&mat[i+1][0],&mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i+1][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==5)\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,x=0;\n char F[2] ;\n char H[2];\n\n scanf(\"%s\" ,F );\n\n for (i=0 ;i<=4 ;i++)\n {\n scanf(\"%s\", H);\n if ((H[0]==F[0]) || (H[1]==F[1]))\n\n x++;\n\n }\n if (x>0)\n printf(\"Yes\");\n\n else\n {\n printf(\"No\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],result;\n scanf(\"%s\",&a);\n char b[3],b1[3],b2[3],b3[3],b4[3];\n scanf(\"%s %s %s %s %s\",&b,&b1,&b2,&b3,&b4);\n int i=0;\n while(a[i]!=0)\n {\n result=a[i];\n int j=0;\n char count;\n while(b[j]!=0)\n {\n count=b[j];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n j=j+1;\n }\n int k=0;\n while(b1[k]!=0)\n {\n count=b1[k];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n k=k+1;\n }\n int l=0;\n while(b2[l]!=0)\n {\n count=b2[l];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n l=l+1;\n }\n int m=0;\n while(b3[m]!=0)\n {\n count=b3[m];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n m=m+1;\n }\n int n=0;\n while(b4[n]!=0)\n {\n count=b4[n];\n if(result==count)\n {\n printf(\"YES\\n\");\n exit(0);\n }\n n=n+1;\n }\n i=i+1;\n\n }\n printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,cnt=0;\nchar a[2];\nchar b[2];\nscanf(\"%s\",a);\nfor(i=0;i<5;i++)\n{\nscanf(\"%s\",b);\nif(a[0]==b[0]||a[1]==b[1]){\ncnt=1;\nbreak;\n}\n}\nif(cnt==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nchar a,b,w;\nint count=0;\nscanf(\"%c%c%c\",&a,&b,&w);\nfor(int i=0;i<5;i++){\nchar c,d;\nscanf(\"%c%c%c\",&c,&d,&w);\nif(a==c || b==d){\n\tprintf(\"YES\");\n\tbreak;}\nelse\n\tcount++;\n}\nif(count==5)\n\tprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \nint i,b=0;\n\tchar s[5],d[5];\n\t\n\tscanf(\"%s\",d);\n\tfor(int j=0;j<5;j++)\n\t {\n\t\t scanf(\"%s\",s);\t\n\t if(s[0]==d[0])\n\t {\n\t\t b++;\n\t\t break;\n\t\t }\n\t\t \n\t\t \n\t else\n\t {\n\t\t if(s[1]==d[1])\n\t\t {\n\t\t b++;\n\t\t break;\n\t\t\n \t}\n } \n }\n\n\t\n\t\n\tif(b>0)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j=0,k=0,l=0,m=0,count=0;\n char ch1,ch2;\n char s[3];\n char s1[3];\n char s2[3];\n char s3[3];\n char s4[3];\n char s5[3];\n scanf(\"%s\",&s);\n scanf(\"%s%s%s%s%s\",&s1,&s2,&s3,&s4,&s5);\n\n while(s1[i]!='\\0')\n {\n if(s[i]==s1[i])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n i++;\n }\n if(count==0)\n {\n while(s2[j]!='\\0')\n {\n if(s[j]==s2[j])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n j++;\n }\n }\n if(count==0)\n {\n while(s3[k]!='\\0')\n {\n if(s[k]==s3[k])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n k++;\n }\n }\n if(count==0)\n {\n while(s4[l]!='\\0')\n {\n if(s[l]==s4[l])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n l++;\n }\n }\n if(count==0)\n {\n while(s5[m]!='\\0')\n {\n if(s[m]==s5[m])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n m++;\n }\n }\n if(count==0)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n\n\tint i = 0, j = 0;\n\tchar table[2];\n\tchar hand[15];\n\tfor(i = 0;i<2;i++)\n\t{\n\t\ttable[i]= 0;\n\t}\n\tfor(j = 0;j<15;j++)\n\t{\n\t\ttable[j]= 0;\n\t}\n\tgets(table);\n\tgets(hand);\n\n\n\tfor (j = 0; j < 2; j++)\n\t{\n\t\tfor (i = 0; i < 15; i++)\n\t\t{\n\t\t\tif (table[j] == hand[i])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\texit(0);\n\t\t\t}\n\n\t\t}\n\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char n[3],n1[3],n2[3],n3[3],n4[3],n5[3];\n scanf(\"%s\",n);\n scanf(\"%s %s %s %s %s\",n1,n2,n3,n4,n5);\n if ((n[0]==n1[0]||n[0]==n2[0]||n[0]==n3[0]||n[0]==n4[0]||n[0]==n5[0])||(n[1]==n1[1]||n[1]==n2[1]||n[1]==n3[1]||n[1]==n4[1]||n[1]==n5[1]))\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, c = 0;\n\n char s[2], s1[2];\n scanf(\"%s\", &s);\n for(i = 1; i <= 5; i++)\n {\n scanf(\"%s\", &s1);\n if(s[0] == s1[0] || s[1] == s1[1])\n {\n c = 1;\n }\n }\n if(c == 1)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s1[2],s2[2];\n\tint k;\n\tk=0;\n\tscanf(\"%s\",s1);\n\tfor(int i=0;i<5;i++)\n\t{scanf(\"%s\",s2);\n\tif(s1[0]==s2[0]||s1[1]==s2[1])\n\tk=1;}\n\tif(k==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int i,count=0;\n char s[3],a[3];\n scanf(\"%s\",s);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",a);\n if(s[0]==a[0]||s[1]==a[1])\n {\n count=1;\n }\n }\n if(count)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[2];int temp=0;\n scanf(\"%s\",a);\n char n[5][2];\n for(int i=0;i<5;i++)\n {\n scanf(\"%s\",n[i]);\n }\n for(int i=0;i<5;i++)\n {\n\n if(a[0]==n[i][0] || a[1]==n[i][1])\n {\n temp++;break;\n }\n }\n if(temp>0)\n {\n\n printf(\"YES\");\n\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c=0;\n char a[2],b[2];\n scanf(\"%s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0]||a[1]==b[1])\n {\n c=1;\n }\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return(0);\n}"}, {"source_code": "#include <stdio.h>\n \nint main(){\n char tab1[3] = {0};\n char tab2[3] = {0};\n scanf(\"%s\", tab1);\n \n for(int i=0; i<5; i++)\n {\n scanf(\"%s\", tab2);\n if(tab1[0] == tab2[0] || tab1[1] == tab2[1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[3],b[3],c[3],d[3],f[3],e[3];\n\tscanf(\"%s\",f);\n\tscanf(\"%s\",a);\n\tscanf(\"%s\",b);\n\tscanf(\"%s\",c);\n\tscanf(\"%s\",e);\n\tscanf(\"%s\",d);\n\tint f1=0;\n\tfor(int i=0;i<2;i++)\n\t{\n\t\tfor(int j=0;j<2;j++)\n\t\t{ //printf(\"%c\",e[j]);\n\t\t\tif(a[j]==f[i] || b[j]==f[i] || c[j]==f[i] || d[j]==f[i] || e[j]==f[i])\n\t\t\t{\n\t\t\t\tf1=-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(f1==-1)\n\t\tbreak;\n\t}\n\tif(f1==-1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<strings.h>\n#include<stdlib.h>\nint main()\n{\n int i,j;\n char s[3];\n char t[6][2];\n scanf(\"%s\",s);\n for(i=0;i<5;i++)\n scanf(\"%s\",t[i]);\n for(j=0;j<5;j++)\n {\n if(s[0]==t[j][0]||s[1]==t[j][1])\n {printf(\"YES\");\n return 0;\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\nint main ()\n{\n\tchar tc[3] , hc[3] ;\n\tint c = 0 ;\n\tscanf (\" %s \" , tc ) ;\n\tfor ( int i = 1 ; i <= 5 ; i++ )\n\t{\n\t\tscanf( \" %s \" , hc) ;\n\t\tif ( tc[0] == hc[0] || tc[1] == hc[1] )\n\t\t{\n\t\t\tc++ ;\n\t\t}\n\t}\n\tif ( c == 0 )\n\t\tprintf(\"NO\"); \n\telse\n\t\tprintf(\"YES\");\n\treturn 0 ;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{char a[3],b[3],c[3],d[3],e[3],s[3];\nint i,j,k=0;\nscanf(\"%s\",s);\nscanf(\"%s %s %s %s %s\",a,b,c,d,e);\nfor(i=0;i<2;i++)\n for(j=0;j<2;j++)\n if((s[i]==a[j])||(s[i]==b[j])||(s[i]==c[j])||(s[i]==d[j])||(s[i]==e[j]))\n k=1;\nif(k==0)printf(\"NO\\n\");\nelse printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char B[6][3];\n int i,p=0;\n for(i=0; i<6;i++)\n {\n scanf(\"%s\",B[i]);\n }\n i=1;\n while(i<=5)\n {\n if((B[0][0]==B[i][0])||(B[0][1]==B[i][1]))\n {\n p=3;\n break;\n }\n else\n i=i+1;\n }\n if(p==3)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\nint t=0;\nchar a[3],b[3];\nscanf(\"%s\",&a);\nfor(int i=1;i<=5;i++){\nscanf(\"%s\",&b);\nif((b[0]==a[0])||(b[1]==a[1]))\n {\n t++;\n }\n}\nif(t==0){\n printf(\"NO\");\n}\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i=0,j=0;\n char a[2],b[2];\n scanf(\"%2s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%2s\",b);\n if(a[1]==b[1]||a[0]==b[0]) j=j+1;\n }\n if(j!=0) {printf(\"yes\");}\n else {printf(\"no\");}\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,f=0;\n char h[2],s[2];\n scanf(\"%s\",h);\n for(i=1;i<=5;i++)\n {\n scanf(\"%s\",s);\n if(s[0]==h[0] || s[1]==h[1])\n {\n f=1;\n }\n }\n if(f==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n char ch[2],c[2];\n scanf(\"%s\",ch);\n int n=5,count=0;\n while(n--)\n {\n scanf(\"%s\",c);\n if((c[0]==ch[0])||(c[1]==ch[1]))\n count++;\n }\n if(count>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\nchar str[2],str1[5];\nint count=0,i,j,p;\nscanf(\"%s\",str);\nfor(i=0;i<5;i++)\n{\n scanf(\"%s\",str1);\n p=0;\n for(j=0;j<2;j++,p++)\n {\n if(str[p]==str1[j])\n count=count+1;\n }\n }\n if(count>0)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n\n{\n int i,j,x=0;\n char m[3],a[3],b[3],c[3],d[3],e[3];\n scanf(\"%s\\n\",m);\n scanf(\"%s %s %s %s %s\",a,b,c,d,e);\n\n for(i=0;i<2;i++)\n {\n\n for(j=0;j<2;j++)\n {\n\n if(m[i]==a[j] || m[i]==b[j] || m[i]==c[j] || m[i]==d[j] || m[i]==e[j])\n {\n x++;\n }\n\n\n\n }\n\n }\n\n if(x>0)\n printf(\"YES\");\n else if(x==0)\n printf(\"NO\");\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s1[2],s2[2];\n\tint k;\n\tk=0;\n\tscanf(\"%s\",s1);\n\tfor(int i=0;i<5;i++)\n\t{scanf(\"%s\",s2);\n\tif(s1[0]==s2[0]||s1[1]==s2[1])\n\tk=1;}\n\tif(k==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,cnt=0;\nchar a[2];\nchar b[2];\nscanf(\"%s\",a);\nfor(i=0;i<5;i++)\n{\nscanf(\"%s\",b);\nif(a[0]==b[0]||a[1]==b[1]){\ncnt=1;\nbreak;\n}\n}\nif(cnt==1)\nprintf(\"YES\");\nelse \nprintf(\"NO\");\n}"}, {"source_code": "typedef struct {\n char rank,suit;\n} card;\nint main() {\n card c1, c2[5];\n scanf(\"%c%c\",&c1.rank,&c1.suit);\n int i;\n for(i=0;i<5;i++) {\n scanf(\"%*c%c%c\",&c2[i].rank,&c2[i].suit);\n if(c1.rank==c2[i].rank || c1.suit==c2[i].suit) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char x[2];\n scanf(\"%s\",&x);\n\n char y1[2],y2[2],y3[2],y4[2],y5[2];\n scanf(\"%s %s %s %s %s\",&y1,&y2,&y3,&y4,&y5);\n\n int cont = 0;\n\n if (y1[0] == x[0] || y1[1] == x[1] || y2[0] == x[0] || y2[1] == x[1] || y3[0] == x[0] || y3[1] == x[1] || y4[0] == x[0] || y4[1] == x[1]|| y5[0] == x[0] || y5[1] == x[1])\n {\n cont = 1;\n }\n if (cont)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\nint t=0;\nchar a[3],b[3];\nscanf(\"%s\",&a);\nfor(int i=1;i<=5;i++){\nscanf(\"%s\",&b);\nif((b[0]==a[0])||(b[1]==a[1]))\n {\n t++;\n }\n}\nif(t==0){\n printf(\"NO\");\n}\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "typedef struct {\n char rank,suit;\n} card;\nint main() {\n card c1, c2[5];\n scanf(\"%c%c\",&c1.rank,&c1.suit);\n int i;\n for(i=0;i<5;i++) {\n scanf(\"%*c%c%c\",&c2[i].rank,&c2[i].suit);\n if(c1.rank==c2[i].rank || c1.suit==c2[i].suit) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,c=0;\n char ac[2],pn[2];\n scanf(\"%s\",&ac);\n for(j=0;j<5;j++)\n {\n scanf(\"%s\",&pn);\n if(ac[0]==pn[0] || ac[1]==pn[1])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar target[2],mine[2];\n\tint j,i,k=0;\n\n\tgets(target);\n\n\tfor (i = 0; i < 5; ++i)\n\t{\n\t\t\n\t\tscanf(\"%s\",mine);\n\t\t\n\n\t\tif(k==0 && (target[0]==mine[0] || target[1]==mine[1]))\n\t\t{\n\t\t\tk=1;\n\t\t}\n\t}\n\n\tif(k)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar orta[3];\n\tchar el1[3];\n\tchar el2[3];\n\tchar el3[3];\n\tchar el4[3];\n\tchar el5[3];\n\t\n\tscanf(\"%s\", orta);\n\tscanf(\"%s\", el1);\n\tscanf(\"%s\", el2);\n\tscanf(\"%s\", el3);\n\tscanf(\"%s\", el4);\n\tscanf(\"%s\", el5);\n\t\n\tif (el1[0] == orta[0] || el1[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el2[0] == orta[0] || el2[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el3[0] == orta[0] || el3[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el4[0] == orta[0] || el4[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\tif (el5[0] == orta[0] || el5[1] == orta[1]){\n\t\tprintf(\"YES\");\n\t\treturn 0;\n\t}\n\t\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\t\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char a[2];\n scanf(\"%s\",a);\n char b[2];\n int i,flag=0;\n for(i=1;i<=5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0] || a[1]==b[1])\n {\n flag=1;\n break;\n }\n }\nif(flag==1)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ \nint i,b=0;\n\tchar s[5],d[5];\n\t\n\tscanf(\"%s\",d);\n\tfor(int j=0;j<5;j++)\n\t {\n\t\t scanf(\"%s\",s);\t\n\t if(s[0]==d[0])\n\t {\n\t\t b++;\n\t\t break;\n\t\t }\n\t\t \n\t\t \n\t else\n\t {\n\t\t if(s[1]==d[1])\n\t\t {\n\t\t b++;\n\t\t break;\n\t\t\n \t}\n } \n }\n\n\t\n\t\n\tif(b>0)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main(){\n char tab1[3] = {0};\n char tab2[3] = {0};\n scanf(\"%s\", tab1);\n \n for(int i=0; i<5; i++)\n {\n scanf(\"%s\", tab2);\n if(tab1[0] == tab2[0] || tab1[1] == tab2[1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s1[2],s2[2];\n\tint k;\n\tk=0;\n\tscanf(\"%s\",s1);\n\tfor(int i=0;i<5;i++)\n\t{scanf(\"%s\",s2);\n\tif(s1[0]==s2[0]||s1[1]==s2[1])\n\tk=1;}\n\tif(k==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n\n{\n int i,j,x=0;\n char m[3],a[3],b[3],c[3],d[3],e[3];\n scanf(\"%s\\n\",m);\n scanf(\"%s %s %s %s %s\",a,b,c,d,e);\n\n for(i=0;i<2;i++)\n {\n\n for(j=0;j<2;j++)\n {\n\n if(m[i]==a[j] || m[i]==b[j] || m[i]==c[j] || m[i]==d[j] || m[i]==e[j])\n {\n x++;\n }\n\n\n\n }\n\n }\n\n if(x>0)\n printf(\"YES\");\n else if(x==0)\n printf(\"NO\");\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nvoid fchaine(char *string)\n{\n int i,n;\n char L;\n\n n = strlen(string);\n\n for(i=0;i<n/2;i++)\n {\n L = string[i];\n string[i] = string[n-i-1];\n string[n-i-1] = L;\n }\n}\n\nint main(void)\n\n{\n int c,i;\n char c1[10],invc1[10];\n char c2[10][10],invc2[10][10];\n\n scanf(\"%s\",c1);\n\n strcpy(invc1,c1);\n fchaine(invc1);\n\n c=0;\n\n for (i=0;i<5;i++)\n {\n scanf (\"%s\",c2[i]);\n\n if (strncmp(c1,c2[i],1)==0)\n c++;\n\n strcpy(invc2[i],c2[i]);\n fchaine(invc2[i]);\n\n if (strncmp(invc1,invc2[i],1)==0)\n c++;\n }\n\n if (c==0)\n printf (\"NO\");\n if (c>0)\n printf (\"YES\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar s1[2],s2[14];\n\tint i,f=0;\n\tfor(i=0;i<2;i++)\n\tscanf(\"%c\",&s1[i]);\n\n\tfor (i=0;i<15;i++)\n\t{\n scanf(\"%c\",&s2[i]);\n \n if ((s2[i]==s1[0])||(s2[i]==s1[1])) \n\t f++;\n }\n \n if (f>0)\n printf(\"YES\");\n else\n printf (\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint c=1;\n\t\tchar first,last;\n\tscanf(\"%c\",&first);\n\tscanf(\"%c\",&last);\n\twhile(c<=5)\n\t{\n\t\tchar a,b,sp;\n\t\tscanf(\"%c\",&sp);\n\t\tscanf(\"%c\",&a);\n\t\tscanf(\"%c\",&b);\n\t\tif((a==first)||(b==last))\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\t\n\t\t}\n\t\tc++;\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n\tchar s[2],k[2];int m;\n\tm=0;\n\tscanf(\"%s\",s);\n\tprintf(\"\\n\");\n\tfor(int i=1;i<=5;i++)\n\t{\n\t\tscanf(\"%s \",k);\n\t\tif((k[0]== s[0])||(k[1]==s[1]))\n\t\tm=1;\n\t\t}\n\t\tif(m==1)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[2];\n char a[2];\n char s1[2];\n scanf(\"%s\",s);\n a[1]=s[0];\n a[2]=s[1];\n int i,count=0;\n for(i=1;i<=5;i++){\n scanf(\"%s\",s1);\n if(a[1]==s1[0])\n count=1;\n if(a[2]==s1[1])\n count=1;\n }\n if(count)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char x[2];\n scanf(\"%s\",&x);\n\n char y1[2],y2[2],y3[2],y4[2],y5[2];\n scanf(\"%s %s %s %s %s\",&y1,&y2,&y3,&y4,&y5);\n\n int cont = 0;\n\n if (y1[0] == x[0] || y1[1] == x[1] || y2[0] == x[0] || y2[1] == x[1] || y3[0] == x[0] || y3[1] == x[1] || y4[0] == x[0] || y4[1] == x[1]|| y5[0] == x[0] || y5[1] == x[1])\n {\n cont = 1;\n }\n if (cont)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n\n{\n int i,j,x=0;\n char m[3],a[3],b[3],c[3],d[3],e[3];\n scanf(\"%s\\n\",m);\n scanf(\"%s %s %s %s %s\",a,b,c,d,e);\n\n for(i=0;i<2;i++)\n {\n\n for(j=0;j<2;j++)\n {\n\n if(m[i]==a[j] || m[i]==b[j] || m[i]==c[j] || m[i]==d[j] || m[i]==e[j])\n {\n x++;\n }\n\n\n\n }\n\n }\n\n if(x>0)\n printf(\"YES\");\n else if(x==0)\n printf(\"NO\");\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j=0,k=0,l=0,m=0,count=0;\n char ch1,ch2;\n char s[3];\n char s1[3];\n char s2[3];\n char s3[3];\n char s4[3];\n char s5[3];\n scanf(\"%s\",&s);\n scanf(\"%s%s%s%s%s\",&s1,&s2,&s3,&s4,&s5);\n\n while(s1[i]!='\\0')\n {\n if(s[i]==s1[i])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n i++;\n }\n if(count==0)\n {\n while(s2[j]!='\\0')\n {\n if(s[j]==s2[j])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n j++;\n }\n }\n if(count==0)\n {\n while(s3[k]!='\\0')\n {\n if(s[k]==s3[k])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n k++;\n }\n }\n if(count==0)\n {\n while(s4[l]!='\\0')\n {\n if(s[l]==s4[l])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n l++;\n }\n }\n if(count==0)\n {\n while(s5[m]!='\\0')\n {\n if(s[m]==s5[m])\n {\n printf(\"YES\\n\");\n count=1;\n break;\n }\n m++;\n }\n }\n if(count==0)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6];\n scanf(\"%c%c\",&mat[0][0],&mat[0][1]);\n for(int i=0;i<5;i++)\n {\n scanf(\" %c%c\",&mat[i+1][0],&mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i+1][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==5)\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{ int c=0,n=5; \n char a[3],b[3];\n\t\t\t\tscanf(\"%s\",a);\n\t\t\t\twhile(n--)\n\t\t\t\t{\n\t\t\tscanf(\"%s\",b);\n\t\t\t\t\t\t\t\tif(a[0]==b[0]||a[1]==b[1])\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tc=1;\n\t\t\t\t}\n\t\t\t\t\nc?printf(\"YES\"):printf(\"NO\");\nreturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{char a[3],b[3],c[3],d[3],e[3],s[3];\nint i,j,k=0;\nscanf(\"%s\",s);\nscanf(\"%s %s %s %s %s\",a,b,c,d,e);\nfor(i=0;i<2;i++)\n for(j=0;j<2;j++)\n if((s[i]==a[j])||(s[i]==b[j])||(s[i]==c[j])||(s[i]==d[j])||(s[i]==e[j]))\n k=1;\nif(k==0)printf(\"NO\\n\");\nelse printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s1[2],s2[2];\n\tint k;\n\tk=0;\n\tscanf(\"%s\",s1);\n\tfor(int i=0;i<5;i++)\n\t{scanf(\"%s\",s2);\n\tif(s1[0]==s2[0]||s1[1]==s2[1])\n\tk=1;}\n\tif(k==1)\n\tprintf(\"YES\");\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char sd[2],s1[2],s2[2],s3[2],s4[2],s5[2];\n scanf(\"%s\\n\",sd);\n scanf(\"%s %s %s %s %s\",s1,s2,s3,s4,s5);\n if(sd[0]==s1[0]||sd[0]==s2[0]||sd[0]==s3[0]||sd[0]==s4[0]||sd[0]==s5[0]||sd[1]==s1[1]||sd[1]==s2[1]||sd[1]==s3[1]||sd[1]==s4[1]||sd[1]==s5[1])\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n = 5;\n char a,b,c,d;\n scanf(\"%c%c\\n\",&a,&c);\n while(n--){\n scanf(\"%c%c \",&b,&d);\n if(a == b || c == d){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tchar a,b,c,d;\n\tscanf(\"%c%c\\n\",&a,&b);\n\tint i,f;\n\tf=0;\n\tfor(i=0;i<5;i++){\n\tscanf(\"%c%c \",&c,&d);\n\tif(a==c||b==d){\n\t\tf=1;\n\t}\n\t}\n\tif(f==1){\n\tprintf(\"YES\");\n\t}\n\telse{\n\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char x[2];\n scanf(\"%s\",&x);\n\n char y1[2],y2[2],y3[2],y4[2],y5[2];\n scanf(\"%s %s %s %s %s\",&y1,&y2,&y3,&y4,&y5);\n\n int cont = 0;\n\n if (y1[0] == x[0] || y1[1] == x[1] || y2[0] == x[0] || y2[1] == x[1] || y3[0] == x[0] || y3[1] == x[1] || y4[0] == x[0] || y4[1] == x[1]|| y5[0] == x[0] || y5[1] == x[1])\n {\n cont = 1;\n }\n if (cont)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[3],b[3];\n int c=0;\n scanf(\"%s\",a);\n for(int i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0] || a[1]==b[1])\n c++;\n }\n if(c>0)\n printf(\"YES\");\n else\n {\n printf(\"NO\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,t=0;\n\tchar s1[3],s2[3];\n\tscanf(\"%s\",s1);\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\",s2);\n\t\tif(s1[0]==s2[0] || s1[1]==s2[1]) t++;\n\t}\n\tprintf(t>0? \"YES\":\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar str[100];\nint main()\n{\n char table[3],card[3];\n int n;\n scanf(\"%s\", table);\n for(n=0;n<5;n++)\n {\n scanf(\"%s\", card);\n strcat(str, card);\n }\n for(n=0;str[n];n++)\n {\n if(table[0]==str[n] || table[1]==str[n])\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c=0;\n char a[2],b[2];\n scanf(\"%s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0]||a[1]==b[1])\n {\n c=1;\n }\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return(0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[10],b[10],c[10],d[10],e[10],f[10];\n int count=0,i;\n scanf(\" %s\",a);\n scanf(\" %s %s %s %s %s\",b,c,d,e,f);\n for(i=0;i<2;i++)\n {\n if (b[i]==a[i] || c[i]==a[i] || d[i]==a[i] ||e[i]==a[i] ||f[i]==a[i])\n count++;\n }\n if(count!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,count=0;\n char str1[2],str2[100];\n scanf(\"%s\",str1);\n getchar();\n gets(str2);\n for(i=0;i<strlen(str2);i++)\n {\n if(str2[i]==str1[0] || str2[i]==str1[1])\n count++;\n }\n if(count>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=0;\nchar f,l,q;\nscanf(\"%c\",&f);\nscanf(\"%c\",&l);\nscanf(\"%c\",&q);\nchar a,b,c;\nwhile(n<5)\n{\nscanf(\"%c\",&a);\nscanf(\"%c\",&b);\nscanf(\"%c\",&c);\nif((f==a)||(l==b))\n{\nprintf(\"yes\\n\");\nreturn 0;\n}\nn++;\n}\nprintf(\"no\\n\");\nreturn 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char name[3], test[3], ans[] = \"23456789TJQKA\";\n int i, j, a, length, count = 0,b;\n\n length = strlen(ans);\n\n\n scanf(\"%s\", name);\n\n for(i=1; i<=5; i++)\n {\n scanf(\"%s\", test);\n\n if(test[0] == name[0]){\n\n count = 1;\n }\n else if(test[1] == name[1]){\n\n for(j=0; j<length; j++){\n\n if( (name[0] == ans[j])){\n\n a = (j+1);\n }\n if(test[0] == ans[j]){\n\n b = (j+1);\n }\n }\n\n if(b>=a){\n\n count = 1;\n }\n }\n }\n\n if(count == 1){\n\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar T[3];\n\tprintf(\"please Enter\");\n\tscanf(\"%s\", T);\n\tchar hand[5][3];\n\tint i;\n\tint flag=1;\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\", hand[i]);\n\t}\n\tfor(i=0;i<5;i++){\n\t\tif((hand[i][0]==T[0] )||(hand[i][1]==T[1] )){\n\t\t\tprintf(\"YES\");\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t\t\n\t\t}\n\t\t\n\t}\n\tif(flag){\n\t\tprintf(\"NO\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=0;\nchar f,l,q;\nscanf(\"%s\",&f);\nscanf(\"%s\",&l);\nchar a,b,c;\nwhile(n<5)\n{\nscanf(\"%s\",&a);\nscanf(\"%s\",&b);\nscanf(\"%s\",&c);\nn++;\n}\nif((f==b)||(l==c))\n{\nprintf(\"YES\");\n}\nelse\n{\nprintf(\"NO\");\n}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6],a;\n scanf(\"%c %c\",&mat[0][0],&mat[0][1]);\n scanf(\"%c\",&a);\n for(int i=0;i<5;i++)\n {\n scanf(\"%c %c\",&mat[i+1][0],&mat[i+1][1]);\n }\n printf(\"%c%c\\n\",mat[0][0],mat[0][1]);\n for(int i=0;i<5;i++)\n {\n printf(\"%c%c\\n\",mat[i+1][0],mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i+1][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==5)\n {\n printf(\"N0\");\n }\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar a[2];\nchar b[2];\ngets(a);\nint i,sum=0;\nfor(i=1;i<6;i++){\ngets(b);\nif((a[0]==b[0])||(a[1]==b[1]))\n{\n sum++;\n}\nelse\n{\n continue;\n}\n}\nif(sum>0)\n{\n printf(\"YES\");\n}\nelse{\n printf(\"NO\");\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6];\n scanf(\"%c %c\",&mat[0][0],&mat[0][1]);\n for(int i ;i<5;i++)\n {\n scanf(\"%c %c\",&mat[i+1][0],&mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==6)\n {\n printf(\"N0\");\n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int e=0;\n char s[2],a[2],b[2],c[2],d[2],f[2];\n scanf(\"%s\",&s);\n scanf(\"%s%s%s%s\",&a,&b,&c,&d);\n \n if(s[0]==a[0] || s[0]==b[0] || s[0]==c[0] || s[0]==d[0] || s[0]==f[0] || s[1]==b[1] || s[1]==c[1] || s[1]==d[1] || s[1]==f[1] )\n e=1;\n \n if(e==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n\n\tint i, j;\n\tchar temp;\n\tchar table[2] = { 0 };\n\tchar hand[15] = { 0 };\n\tgets(table);\n\tgets(hand);\n\n\tfor (j = 0; j < 2; j++)\n\t{\n\t\ttemp = table[j];\n\t\tfor (i = 0; i < 15; i++)\n\t\t{\n\t\t\tif (temp == hand[i])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\n\n\t}\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[2];\n char a[2];\n char s1[2];\n scanf(\"%s\",&s);\n s[0]==a[0];\n s[1]==a[0];\n int i,count;\n for(i=1;i<=2;i++){\n scanf(\"%s\",s1);\n if(s1[0]==a[0])\n {\n count=1;\n }\n else if(s1[1]==a[1])\n {\n count=1;\n }\n }\n if(count)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n// <<<<< Macros <<<<<\n#define BUFFERSIZE 255\n#define BUFFERSIZEREAD BUFFERSIZE - 1\n#define STACKSIZE 4\n#define STACKSIZEREAD STACKSIZE - 1\n// >>>>> Macros >>>>>\n\n// <<<<< Preparations <<<<<\n#ifdef __unix__\nvoid fflush_for_linux() {\n /*\n * This will work like \"fflush()\" on stdin, because the normal one doesn't work on linux.\n */\n\n int character;\n do {\n character = getchar();\n } while (character != '\\n' && character != EOF);\n}\n#endif\n// >>>>> Preparations >>>>>\n\n// <<<<< Declarations <<<<<\nshort same_suit(const char *buffer, char suit_value);\nshort same_rank(const char *buffer, char rank_value);\n// >>>>> Declarations >>>>>\n\nint main() {\n\n char buffer[BUFFERSIZE];\n char stack[STACKSIZE];\n\n fgets(stack, STACKSIZEREAD, stdin);\n\n#ifdef __unix__\n fflush_for_linux();\n#else\n fflush(stdin);\n#endif\n\n fgets(buffer, BUFFERSIZEREAD, stdin);\n\n if (same_suit(buffer, stack[1]) == EXIT_SUCCESS\n || same_rank(buffer, stack[0]) == EXIT_SUCCESS)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return EXIT_SUCCESS;\n}\n\nshort same_suit(const char *buffer, char suit_value) {\n\n register short index = 0;\n\n while (buffer[index] != '\\0') {\n\n if (buffer[index++] == suit_value)\n return EXIT_SUCCESS;\n }\n\n // Couldn't find the same suit\n return EXIT_FAILURE;\n}\n\nshort same_rank(const char *buffer, char rank_value) {\n\n register short index = 0;\n\n while (buffer[index] != '\\0') {\n\n if (buffer[index++] == rank_value)\n return EXIT_SUCCESS;\n }\n\n return EXIT_FAILURE;\n\n}"}, {"source_code": "# include<stdio.h>\n\nint main()\n{\n int i;\n char s1[2];\n scanf(\"%s\",&s1);\n\n char s2[2];\n scanf(\"%s\",&s2);\n\n char s3[2];\n scanf(\"%s\",&s3);\n\n char s4[2];\n scanf(\"%s\",&s4);\n\n char s5[2];\n scanf(\"%s\",&s5);\n\n char s6[2];\n scanf(\"%s\",&s6);\n\n for(i=0;i<2;i++){\n if(s1[i]==s2[i] || s1[i]==s3[i] || s1[i]==s4[i] || s1[i]==s5[i] || s1[i]==s6[i])\n printf(\"YES\");\n for(i=1;i<2;i++){\n if(s1[i]==s2[i] || s1[i]==s3[i] || s1[i]==s4[i] || s1[i]==s5[i] || s1[i]==s6[i])\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\nint main (void)\n{\n\tbool test = false ; \n\tchar card[2] , hand_cards[10];\n\tint i,x ; \n\tgets(card);\n\tgets(hand_cards);\n\tfor(i=0 ; i<2 ; i++)\n\t{\n\t\tfor(x=0; x<10 ; x++)\n\t\t{\n\t\tif(card[i]== hand_cards[x])\n\t\t{\n\t\t\ttest = true ; \n\t\t\tbreak ; \n\t\t}\n\t\t}\t\n\t}\n\tif (test)\n\t\tprintf(\"yes\");\n\telse\n\t\tprintf(\"no\");\t\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[1],b[5][2];\n int count=0,i;\n for(i=0;i<2;i++)\n {\n scanf(\"%s\",a);\n }\n printf(\"\\n\");\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b[2]);\n }\n for(i=0;i<5;i++)\n {\n if ((a[0]==b[i][0])||(a[1]==b[i][1]))\n count++;\n }\n if(count)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[1][2],b[1][2];\n int i,j;\n for(i=0;i<1;i++)\n {\n for(j=0;j<1;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n int l=5;\n int flag=0;\n while(l--)\n {\n for(i=0;i<1;i++)\n {\n for(j=0;j<1;j++)\n {\n scanf(\"%c\",&b[i][j]);\n if(a[i][j]==b[i][j]) flag++;\n }\n }\n }\n if(flag==0) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char r[2], s2[2], s3[2], s4[2], s5[2];\n scanf(\"%s\", &r);\n scanf(\"%s %s %s %s\", &s2, &s3, &s4, &s5);\n if(r[0]==s2[0] || r[0]==s2[1] || r[0]==s3[0] || r[0]==s3[1] || r[0]==s4[0] || r[0]==s4[1] || r[0]==s5[0] || r[0]==s5[1]\n || r[1]==s2[0] || r[1]==s2[1] || r[1]==s3[0] || r[1]==s3[1] || r[1]==s4[0] || r[1]==s4[1] || r[1]==s5[0] || r[1]==s5[1])\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\tchar a[2],b[2],c[2],d[2],e[2],z[2],p,q;\n\tint l=0;\n\tscanf(\"%s %s %s %s %s %s\",z,a,b,c,d,e);\n\tp=z[0];\n\tq=z[1];\n\tif(a[0]==p || b[0]==p || c[0]==p || d[0]==p ||e[0]==p || a[1]==p || b[1]==p || c[1]==p || d[1]==p ||e[1]==p || a[0]==q || b[0]==q || c[0]==q || d[0]==q ||e[0]==q || a[1]==q || b[1]==q || c[1]==q || d[1]==q ||e[1]==q){\n\t // printf(\"YES\");\n\t l=1;\n\t}\n\tif(l==1){\n\t printf(\"YES\");\n\t}\n\telse\n\t{\n\t printf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,c;\n char a[2],b[2];\n scanf(\"%s\",b);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",a);\n if(b[0]==a[0]) c=c+1;\n if(b[1]==a[1]) c=c+1;\n }\n if(c!=0)printf(\"yes\");\n else printf(\"no\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c;\n char a[2],b[200];\n scanf(\"%s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0]||a[1]==b[1])\n {\n c=1;\n }\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\nint main (void)\n{\n\tbool test = false ; \n\tchar card[2] , hand_cards[20];\n\tint i,x ; \n\tscanf(\"%s\",card);\n\tscanf(\"%s\",hand_cards);\n\tfor(i=0 ; i<2 ; i++)\n\t{\n\t\tfor(x=0; x<10 ; x++)\n\t\t{\n\t\tif(card[i]== hand_cards[x])\n\t\t{\n\t\t\ttest = true ; \n\t\t\tbreak ; \n\t\t}\n\t\t}\t\n\t}\n\tif (test)\n\t\tprintf(\"yes\");\n\telse\n\t\tprintf(\"no\");\t\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,f;\n char ch[5],s[3];\n scanf(\"%s\",&ch);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",&s);\n if((ch[0]==s[0])||(ch[1]==s[1]))\n f=1;}\n\n if(f==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n char a[2], b[2];\n int flag = 0, i;\n gets(a);\n for(i = 0; i < 5; i++)\n {\n gets(b);\n // printf(\"%s\\n\", b);\n if(b[0] == a[0] || b[1] == a[1]) flag = 1;\n }\n if(flag) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar a[2],b[2];\nint main()\n{\n\tint i,c=0;\n\tscanf(\"%s\",b);\n\tfor(i=0;i<5;i++)\n\t{\n\t\tscanf(\"%s\",a);\n\t\tif (a[0]==b[0]||a[1]==b[1])\n\t\t{\n\t\t\tc=1;\n\t\t}\n\t}\n\tif(c==1)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[2],b[11];int temp=0;\n gets(a);\n gets(b);\n for(int i=0;i<2;i++)\n {\n for(int j=0;j<11;j++)\n if(a[i]==a[j])\n {\n temp++;\n }\n }\n if(temp>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar a[2];\nchar b[2];\ngets(a);\nint i,sum=0;\nfor(i=1;i<6;i++){\ngets(b);\nif(a[0]==b[0]||a[1]==b[1])\n {\n sum++;\n}\nelse{continue;}\n}\nif(sum>0){\n printf(\"YES\");\n}\nelse{\n printf(\"NO\");\n}\n\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n\n\tint i, j;\n\tchar temp;\n\tchar table[2] = { 0 };\n\tchar hand[15] = { 0 };\n\tgets(table);\n\tgets(hand);\n\n\tfor (j = 0; j < 2; j++)\n\t{\n\t\ttemp = table[j];\n\t\tfor (i = 0; i < 16; i++)\n\t\t{\n\t\t\tif (temp == hand[i])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\texit(0);\n\t\t\t}\n\n\t\t}\n\n\t}\n\tprintf(\"NO\");\n\texit(0);\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\nchar i[5],ii[5];\nint a,sum=0;\ngetchar();\ngets(i);\n\nfor(a=0;a<5;a++){\n\n gets(ii);\nif(i[0]==ii[0]||i[1]==ii[1]){\n sum++;\n}\n\n}\nif(sum>0){\n printf(\"\\nYES\");\n}\nelse{\n printf(\"\\nNO\");\n}\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char r[2], s2[2], s3[2], s4[2], s5[2];\n scanf(\" %s\", &r);\n scanf(\" %s %s %s %s\", &s2, &s3, &s4, &s5);\n if(r[0]==s2[0] || r[0]==s3[0] || r[0]==s4[0] || r[0]==s5[0] || r[1]==s2[1] || r[1]==s3[1] || r[1]==s4[1] || r[1]==s5[1])\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[2],b[5][2],i,count=0;\n for(i=0;i<2;i++)\n {\n scanf(\"%s\",a);\n }\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b[2]);\n }\n for(i=0;i<5;i++)\n {\n if ((a[0]==b[i][0])||(a[1]==b[i][1]))\n count++;\n }\n if(!count)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,f;\n char ch[5],s[3];\n scanf(\"%s\",&ch);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",&s);\n if((ch[0]==s[0])||(ch[1]==s[1]))\n f=1;}\n if(f==1)\n {\n printf(\"YES\");}\n else{\n printf(\"NO\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k=0;\n char a[2],b[2],c[2],d[2],e[2],f[2];\n scanf(\"%s\",f);\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n scanf(\"%s\",c);\n scanf(\"%s\",d);\n scanf(\"%s\",e);\n \n if(f[0]==a[0])\n k++;\n else if(f[0]==b[0])\n k++;\n else if(f[0]==c[0])\n k++;\n else if(f[0]==d[0])\n k++;\n else if(f[0]==e[0])\n k++;\n else\n {\n\n };\n if(k==0)\n {\n if(f[1]==a[1])\n k++;\n else if(f[1]==b[1])\n k++;\n else if(f[1]==c[1])\n k++;\n else if(f[1]==d[1])\n k++;\n else if(f[1]==e[1])\n k++;\n else\n {\n\n };\n }\n if(k>0)\n printf(\"yes\");\n else\n printf(\"no\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tchar t[3],h[3];\n\tint i,count = 0;\n\tscanf(\"%s\",t);\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\",h);\n\t\tif(h[0]==t[0] || h[1]==t[1]){\n\t\t\tcount = 1;\n\t\t}\n\t}\n\t if(count = 1){\n\t printf(\"YES\");\n\t }else {\n\t printf(\"NO\");\n\t }\n\t\n}"}, {"source_code": "typedef struct {\n char rank,suit;\n} card;\nint main() {\n card c1, c2[5];\n scanf(\"%c%c\",&c1.rank,&c1.suit);\n int i;\n for(i=0;i<5;i++) {\n scanf(\"%c%c \",&c2[i].rank,&c2[i].suit);\n if(c1.rank==c2[i].rank || c1.suit==c2[i].rank) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\nchar i[5],ii[5];\nint a,sum=0;\ngetchar();\ngets(i);\n\nfor(a=0;a<5;a++){\n\n gets(ii);\nif(i[0]==ii[0]||i[1]==ii[1]){\n sum++;\n}\n\n}\nif(sum>0){\n printf(\"\\nYES\");\n}\nelse{\n printf(\"\\nNO\");\n}\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n\t\tint x=0;\t\n\tchar s[10];\n\tchar a[10];\n\tint len1=strlen(s);\n\tint len2=strlen(a);\n\tscanf(\"%s\",s);\n\tprintf(\"as=%s\\n\",s);\n\tprintf(\"aa=%c %c\\n\",s[0],s[1]);\t\t\n\tfor(int i=0;i<5;i++)\n\t{\n\t\tscanf(\"%s\",a);\t\n\t\tif(s[0]==a[0]||s[1]==a[1])\n\t\t{\n\t\t\tx=x+1;\t\t\t\n \t}\n \telse\n \t{\n\t\t\t\n\t\t}\n }\n\tif(x==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n\t\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char t[3], h[4][3]; scanf(\"%s\",t);\n int i, j=0;\n for(i=0;i<4;i++)\n {\n scanf(\"%s\",h[i]);\n if(h[i][0]==t[0] || h[i][1]==t[1]) j=1;\n }\n if(j==1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[1][2],b[5][2];\n scanf(\"%c\",&a[0][0]);\n fflush(stdin);\n scanf(\"%c\",&a[0][1]);\n for(int i=0;i<5;i++)\n {\n fflush(stdin);\n scanf(\"%c\",&b[i][0]);\n fflush(stdin);\n scanf(\"%c\",&b[i][1]);\n }\n for(int i=0;i<5;i++)\n {\n if(a[0][0]==b[i][0])\n {\n printf(\"yes\");\n return 0;\n }\n if(a[0][1]==b[i][1])\n {\n printf(\"yes\");\n return 0;\n }\n\n }\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\n\nint main(void) \n{\n \nchar str[3], str1[3], str2[3], str3[3], str4[3], str5[3];\n \nscanf(\"%s\",str);\n \nscanf(\"%s %s %s %s %s\",str1,str2,str3,str4,str5);\n \nif(str[0]=str1[0]||str[0]==str2[0]||str[0]==str3[0]||str[0]==str4[0]||str[0]==str5[0]||str[1]==str1[1]||str[1]==str2[1]||str[1]==str3[1]||str[1]==str4[1]||str[1]==str5[1])\n \n printf(\"YES\");\n \nelse\n \nprintf(\"NO\");\n\t// your code goes here\n\t\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<strings.h>\n#include<stdlib.h>\nint main()\n{\n int i,j;\n char s[3];\n char t[6][2];\n scanf(\"%s\",s);\n for(i=0;i<5;i++)\n scanf(\"%s\",t[i]);\n for(j=0;j<5;j++)\n {\n if(s[0]==t[i][0])\n {printf(\"YES\");\n return 0;\n }\n if(s[1]==t[i][1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() \n\n{ \n int i,l,flag=0;\n char s[12];\n char a,b;\n scanf(\"%c%c\",&a,&b);\n scanf(\"%[^\\n]s\",&s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(a==s[i]||b==s[i])\n flag=1;\n }\n if(flag==1)\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char table[3],card[3],str[100];\n int n;\n scanf(\"%s\", table);\n for(n=1;n<=5;n++)\n {\n scanf(\"%s\", card);\n strcat(str, card);\n }\n for(n=1;str[n];n++)\n {\n if(table[0]==str[n] || table[1]==str[n])\n {\n printf(\"YES\");\n return 0;\n }\n\n }\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint\nmain ()\n{\n int loop = 0, count1 = 0, count2 = 0;\n char array[100];\n\n \n \n scanf (\"%c\", array);\n \n printf(\"%c\",array[0]);\n \n {\n if (array[1] == (array[4] || array[7] || array[10] || array[13]\n\t || array[16]))\n\t{\n\t printf (\"YES\");\n\t return 0;\n\t}\n\n if (array[0] == (array[3] || array[6] || array[9] || array[12]\n\t || array[15]))\n\t{\n\t printf (\"YES\");\n\t return 0;\n\t}\n\n\n\n }\n printf (\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[3],b[6][2];\n gets(a);\n for(int i=0;i<5;i++)\n {\n gets(b[i]);\n\n }\n for(int i=0;i<5;i++)\n {\n if(a[0]==b[i][0])\n {\n printf(\"Yes\");\n return 0;\n }\n if(a[1]==b[i][1])\n {\n printf(\"Yes\");\n return 0;\n }\n\n }\n printf(\"NO\");\n\n}\n"}, {"source_code": "#include<stdio.h> \nint main() \n{ \n char a,b,w; \n int count=0;\n scanf(\"%c %c %c\",&a,&b,&w); \nfor(int i=0;i<5;i++) \n{ \nchar c,d,w;\nscanf(\"%c %c %c\",&c,&d,&w);\nif(a==c || b==d) \n{ printf(\"YES\");\n break; } \nelse count++ ;\n} \nif(count==5)\nprintf(\"NO\"); \nreturn 0; \n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n // for getting input from input.txt\n freopen(\"input.txt\", \"r\", stdin);\n // for writing output to output.txt\n freopen(\"output.txt\", \"w\", stdout);\n \t#endif\n \tint flag=0;\n char a[20];char b[10][10];\n scanf(\"%s\",a);\n for(int i=0;i<5;i++)\n {\n \tscanf(\"%s\",b[i]);\n \tif(a[0]==b[i][0]||a[1]==b[i][1])\n \t\tflag=1;\n }\n if(flag==1)\n \tprintf(\"YES\");\n else\n \tprintf(\"N0\");\n }"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tchar a[3], b[3];\n\tint i, c = 0;\n\tscanf(\"%s\", a);\n\tfor (i = 0; i < 5; i++)\n\t{\n\t\tscanf(\"%s\", b);\n\t\tif (b[i] == a[0] || b[i] == a[1])\n\t\t\tc++;\n\t}\n\tif (c > 0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint t=0;\nchar a[3],b[3];\ngets(a);\nfor(int i=1;i<=5;i++){\ngets(b);\nif(b[0]==a[0]||b[1]==a[1])\n {\n t=1;\n }\n}\n(t==0?printf(\"NO\"):printf(\"YES\"));\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main()\n{\n\n\tint i, j;\n\tchar temp;\n\tchar table[2] = { 0 };\n\tchar hand[15] = { 0 };\n\tgets(table);\n\tgets(hand);\n\n\tfor (j = 0; j < 2; j++)\n\t{\n\t\ttemp = table[j];\n\t\tfor (i = 0; i < 16; i++)\n\t\t{\n\t\t\tif (temp == hand[i])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\texit(0);\n\n\t\t\t}\n\n\t\t}\n\t}\n\tprintf(\"NO\");\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,count=0;\n char str[10],str_[2];\n gets(str_);\n for(i=1;i<=5;i++)\n {\n gets(str);\n if(str[0]==str_[0] || str[0]==str_[1] || str[1]==str_[1])\n {\n count++;\n }\n }\n if(count>=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar a[6][2];\n\tscanf(\"%s\", &a[0]);\n\tfflush(stdin);\n\t\n\tfor(int i = 1; i < 6; i++) {\n\t\tscanf(\"%s\", &a[i]);\n\t}\n\t\n\tint check = 0;\n\tfor(int i = 1; i < 6; i++) {\n\t\tfor(int j = 0; j < 2; j++) {\n\t\t\tif(a[i][j] == a[0][0] || a[i][j] == a[0][1]) {\n\t\t\t\tcheck = 1;\n\t\t\t}\n\t\t}\n\t}\n\tif(check == 1) {\n\t\tprintf(\"YES\");\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint c,k=0,t=0;\n\tchar a,b;\n\tchar ch[17];\n\tscanf(\"%c%c\",&a,&b);\n\tputs(ch);\n\tfor(int i=0;i<strlen(ch);i++)\n\t{\n\t\tif(a==ch[i] || b==ch[i])\n\t\t{\n\t\t\tk=1;\n\t\t\t\n\t\t}\n\t\n\t\t\n\t}\n\tif(k==1)\n\tprintf(\"YES\\n\");\n\telse\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": " #include <stdio.h>\n int main()\n {\n int i,j,k=0,l=1;\n char a[2],b[25];\n\n scanf(\"%s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n\n }\n for(j=0; j<25; j++)\n {\n if(b[j]==a[0] || b[j]==a[1])\n {\n k=1;\n\n }\n else\n continue;\n\n }\n\n if(k==1)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n\n }\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6],a;\n scanf(\"%c%c\",&mat[0][0],&mat[0][1]);\n for(int i=0;i<5;i++)\n {\n scanf(\"%c%c\",&mat[i+1][0],&mat[i+1][1]);\n }\n printf(\"%c%c\\n\",mat[0][0],mat[0][1]);\n for(int i=0;i<5;i++)\n {\n printf(\"%c%c\\n\",mat[i+1][0],mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i+1][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==5)\n {\n printf(\"N0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=0;\nchar f,l,q;\nscanf(\"%s\",&f);\nscanf(\"%s\",&l);\nchar a,b,c;\nwhile(n<5)\n{\nscanf(\"%s\",&a);\nscanf(\"%s\",&b);\nscanf(\"%s\",&c);\nn++;\n}\nif((f==b)||(l==c))\n{\nprintf(\"YES\");\n}\nelse\n{\nprintf(\"NO\");\n}\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar target[2],mine[2];\n\tint i,k=0;\n\n\tgets(target);\n\tscanf(\"%d\",&i);\n\n\tfor (i = 0; i < 5; ++i)\n\t{\n\t\tgets(mine);\n\t\tif(k==0 && (target[0]==mine[0] || target[1]==mine[1]))\n\t\t{\n\t\t\tk=1;\n\t\t}\n\t}\n\n\tif(k)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[3],b[3],c[3],d[3],e[3],f[3];\n int i,j,k;\n while(scanf(\"%s\",&a)!=EOF){\n scanf(\"%s %s %s %s %s\",&b,&c,&d,&e,&f);\n if(a[0]=='T'||a[0]=='J'||a[0]=='Q'||a[0]=='K'||a[0]=='A'){\n if(a[0]==b[0])printf(\"YES\\n\");\n else{\n if(a[0]==c[0])printf(\"YES\\n\");\n else{\n if(a[0]==d[0])printf(\"YES\\n\");\n else{\n if(a[0]==e[0])printf(\"YES\\n\");\n else{\n if(a[0]==f[0])printf(\"YES\\n\");\n else{\n if(a[1]==c[1])printf(\"YES\\n\");\n else{\n if(a[1]==d[1])printf(\"YES\\n\");\n else{\n if(a[1]==e[1])printf(\"YES\\n\");\n else{\n if(a[1]==f[1])printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n }\n }\n }\n }\n }\n }\n }\n }\n else{\n if(a[1]==b[1])printf(\"YES\\n\");\n else{\n if(a[1]==c[1])printf(\"YES\\n\");\n else{\n if(a[1]==d[1])printf(\"YES\\n\");\n else{\n if(a[1]==e[1])printf(\"YES\\n\");\n else{\n if(a[1]==f[1])printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n }\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main() {\n\tchar a[2];\n\tchar b[2];\n\tchar c[2];\n\tchar d[2];\n\tchar e[2];\n\tchar z[2];\n\tint p=0,q=0;\n\tscanf(\"%s\",z);\n\tscanf(\"%s %s %s %s %s\",a,b,c,d,e);\n\tif(a[0]==z[0] || b[0]==z[0] || c[0]==z[0] || d[0]==z[0] ||e[0]==z[0]){\n\t p=1;\n\t}\n\tif(a[1]==z[1] || b[1]==z[1] || c[1]==z[1] || d[1]==z[1] ||e[1]==z[1]){\n\t q=1;\n\t}\n\tif(p==1|| q==1)\n\t printf(\"YES\");\n\tif(p==0||q==0)\n\t{\n\t printf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nchar a[2],b[2];\nint main()\n{\n\tint i,c=0;\n\tscanf(\"%s\",b);\n\tfor(i=0;i<5;i++)\n\t{\n\t\tscanf(\"%s\",a);\n\t\tif (a[0]==b[0]||a[1]==b[1])\n\t\t{\n\t\t\tc=1;\n\t\t}\n\t}\n\tif(c==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\tchar a[2],b[2],c[2],d[2],e[2],z[2],p,q;\n\tint l=0;\n\tscanf(\"%s %s %s %s %s %s\",z,a,b,c,d,e);\n\tp=z[0];\n\tq=z[1];\n\tif(a[0]==p || b[0]==p || c[0]==p || d[0]==p ||e[0]==p || a[1]==p || b[1]==p || c[1]==p || d[1]==p ||e[1]==p || a[0]==q || b[0]==q || c[0]==q || d[0]==q ||e[0]==q || a[1]==q || b[1]==q || c[1]==q || d[1]==q ||e[1]==q){\n\t // printf(\"YES\");\n\t l=1;\n\t}\n\tif(l==1){\n\t printf(\"YES\");\n\t}\n\telse\n\t{\n\t printf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tchar t[3],h[3];\n\tint i;\n\tscanf(\"%s\",t);\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\",h);\n\t\tif(h[0]==t[0] || h[1]==t[1]){\n\t\t\tprintf(\"YES\");\n\t\t\tbreak;\n\t\t}\n\t if(h == i){\n\t printf(\"NO\");\n\t }\n\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\nchar card(char a, char b)\n{\tint i;\n\tchar k,l;\n\tfor(i=0;i<10;i++)\n\t{ scanf(\"%c\",&k);\n\t scanf(\"%c\",&l);\n\t}\n\tif(b==l||a==k||a==l||b==k)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\treturn 0;\n}\nint main()\n{\tchar a,b;\n\tscanf(\"%c\",&a);\n\tscanf(\"%c\",&b);\n\tcard(a,b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c1,c2,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10;\n char S[2];\n gets(S);\n c1=S[0];\n c2=S[1];\n gets(S);\n ch1=S[0];\n ch2=S[1];\n gets(S);\n ch3=S[0];\n ch4=S[1];\n gets(S);\n ch5=S[0];\n ch6=S[1];\n gets(S);\n ch7=S[0];\n ch8=S[1];\n gets(S);\n ch9=S[0];\n ch10=S[1];\n if(c1==ch1||c1==ch3||c1==ch5||c1==ch7||c1==ch9||c2==ch2||c2==ch4||c2==ch6||c2==ch8||c2==ch10)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "# include<stdio.h>\n\nint main()\n{\n int i;\n char s1[2];\n scanf(\"%s\",&s1);\n\n char s2[2];\n scanf(\"%s\",&s2);\n\n char s3[2];\n scanf(\"%s\",&s3);\n\n char s4[2];\n scanf(\"%s\",&s4);\n\n char s5[2];\n scanf(\"%s\",&s5);\n\n char s6[2];\n scanf(\"%s\",&s6);\n\n\n for(i=1; i<=2; i++)\n {\n if(s1[i]==s2[i])\n {\n printf(\"YES\");\n\n return 0;\n }\n if(s1[i]==s3[i])\n {\n printf(\"YES\");\n\n return 0;\n }\n if(s1[i]==s4[i])\n {\n printf(\"YES\");\n\n return 0;\n }\n if(s1[i]==s5[i])\n {\n printf(\"YES\");\n\n return 0;\n }\n if(s1[i]==s6[i])\n {\n printf(\"YES\");\n\n return 0;\n }\n\n\n } printf(\"NO\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[1],b[5][2];\n int count=0,i;\n for(i=0;i<2;i++)\n {\n scanf(\"%s\",a);\n }\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b[2]);\n }\n for(i=0;i<5;i++)\n {\n if ((a[0]==b[i][0])||(a[1]==b[i][1]))\n count++;\n }\n printf(count>0? \"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,c;\n char a[2],b[2];\n scanf(\"%s\",b);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",a);\n if(b[0]==a[0]||b[1]==a[1])\n c=c+1;\n }\n if(c)printf(\"yes\");\n else printf(\"no\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar t1[10],t2[10],h1[10],h2[10];\nint i,count,n=0;\nscanf(\"%s\",&t1);\nscanf(\"%s\",&t2);\nscanf(\"%s\",&h1);\nscanf(\"%s\",&h2);\nfor(i=0;i<=10;i++)\n{\nif(t1[0]==h1[i])\n{\n\tcount=1;\n}\nif(t2[0]==h2[i])\n{\n\tcount=1;\n}\n}\nif(count==1)\n{\nprintf(\"YES\");\n}\nelse\n{\nprintf(\"NO\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/*\ntypedef struct Deck\n{\n\tchar club[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar spades[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar heart[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar diamond[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\t\n}deck;\n*/\n\n\ntypedef struct Card\n{\n\tchar face;\n\tchar num;\n}Card;\n\nvoid write (Card a);\n\nint main(void)\n{\n\tint cont=0;\n\tCard table,hand[5];\n\t\n\t\n\t/*\n\tscanf(\"%c%c\",&table.num,&table.face);\n\t*/\n\tscanf(\"%c%c%c%c%c%c%c%c%c%c\",&hand[0].num,&hand[0].face,\n\t\t\t\t\t\t\t\t &hand[1].num,&hand[1].face,\n\t\t\t\t\t\t\t\t &hand[2].num,&hand[2].face,\n\t\t\t\t\t\t\t\t &hand[3].num,&hand[3].face,\n\t\t\t\t\t\t\t\t &hand[4].num,&hand[4].face);\n\t\t\n\tfor(int i=0;i<5;i++)\n\t\t{\n\t\twrite(hand[i]);\t\t\t\t\t\t\t \n\t\t}\n\t/*\n\tfor(int i=0;i<5;i++)\n\t{\n\t\tif(hand[i].num==table.num ||hand[i].face==table.face)\n\t\t{\n\t\t\tprintf(\"Yes\");break;\n\t\t\tcont++;\n\t\t}\n\t}\n\tif(0==cont)\n\t{\n\t\tprintf(\"No\");\n\t}*/\n}\n\nvoid write (Card a)\n{\n\tprintf(\"%c%c\",a.num,a.face);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char a[2],b[2],c[2],d[2],e[2],f[2];int temp=0;\n gets(a);\n gets(b);\n gets(c);\n gets(d);\n gets(e);\n gets(f);\n for(int i=0;i<2;i++)\n {\n\n for(int j=0;j<2;j++)\n {\n if((a[i]==b[j])||(a[i]==c[j])||(a[i]==d[j])||(a[i]==e[j])||(a[i]==f[j]))\n temp++;\n }\n }\n if(temp>0)\n {\n\n printf(\"YES\");\n\n }else{\n printf(\"NO\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char r[2], s2[2], s3[2], s4[2], s5[2];\n scanf(\"%s\", &r);\n scanf(\"%s %s %s %s\", &s2, &s3, &s4, &s5);\n if(r[0]==s2[0] || r[0]==s2[1] || r[0]==s3[0] || r[0]==s3[1] || r[0]==s4[0] || r[0]==s4[1] || r[0]==s5[0] || r[0]==s5[1]\n || r[1]==s2[0] || r[1]==s2[1] || r[1]==s3[0] || r[1]==s3[1] || r[1]==s4[0] || r[1]==s4[1] || r[1]==s5[0] || r[1]==s5[1])\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\nint main (void)\n{\n\tbool test = false ; \n\tchar card[2] , hand_cards[20];\n\tint i,x ; \n\tscanf(\"%s\",card);\n\tscanf(\"%s\",hand_cards);\n\tfor(i=0 ; i<2 ; i++)\n\t{\n\t\tfor(x=0; x<10 ; x++)\n\t\t{\n\t\tif(card[i]== hand_cards[x])\n\t\t{\n\t\t\ttest = true ; \n\t\t\tbreak ; \n\t\t}\n\t\t}\t //a7a\n\t}\n\tif (test)\n\t\tprintf(\"yes\");\n\telse\n\t\tprintf(\"no\");\t\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i;\n char str[2],str1[2],str2[2],str3[2],str4[2];\n scanf(\"%s\",str);\n scanf(\"%s%s%s%s\",str1,str2,str3,str4);\n if(str[0]==str1[0]||str[1]==str1[1]||str[1]==str1[0]||str[0]==str1[1]||str[0]==str2[0]||str[1]==str2[1]||str[1]==str2[0]||str[0]==str2[1]||str[0]==str3[0]||str[1]==str3[1]||str[1]==str3[0]||str[0]==str3[1]||str[0]==str4[0]||str[1]==str4[1]||str[1]==str4[0]||str[0]==str4[1])\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,e=0;\n char a,b,c,d;\n scanf(\"%c%c\",&a,&b);\n for(i=0;i<5;i++)\n {\n scanf(\"%c%c\",&c,&d);\n if(a==c||a==d) e=e+1;\n if(b==c||b==d) e=e+1;\n }\n if(e!=0) {printf(\"yes\");}\n else {printf(\"no\");}\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c;\n char a[2],b[2];\n scanf(\"%s\",a);\n for(i=0;i<5;i++)\n {\n scanf(\"%s\",b);\n if(a[0]==b[0]||a[1]==b[1])\n {\n c=1;\n }\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char table[2], hands[2];\n int s = 0;\n scanf(\"%s\", table);\n\n for(int i = 0; i < 5; i++)\n {\n scanf(\"%c\", hands);\n if(hands[s] == table[s] || hands[s+1] == table[s+1]) {printf(\"YES\"); break; return 0;}\n else continue;\n }\n printf(\"NO \");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char name[3], test[3], ans[] = \"23456789TJQKA\";\n int i, j, a, length, count = 0,b;\n\n length = strlen(ans);\n\n\n scanf(\"%s\", name);\n\n for(i=1; i<=5; i++)\n {\n scanf(\"%s\", test);\n\n if(test[0] == 'A' && name[0] == 'A')\n {\n\n count = 1;\n }\n else if((test[0] == name[0]) && (test[1] == name[1]))\n {\n\n count = 1;\n }\n else if(test[1] == name[1])\n {\n count = 1;\n\n }\n }\n\n if(count == 1)\n {\n\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,t=0;\nchar s1[3],s2[3];\nscanf(\"%s\",&s1);\nfor(i=0;i<5;i++){\n scanf(\"%s\",&s2[i]);\n if(s1[0]==s2[0]||s1[1]==s2[1]) t++;\n}\nif(t>0?\"yes\":\"no\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[1][3],b[5][3];\n int i,j;\n for(i=0;i<1;i++)\n {\n for(j=0;j<3;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n fflush(stdin);\n int flag=0;\n for(i=0;i<5;i++)\n {\n for(j=0;j<3;j++)\n {\n //fflush(stdin);\n scanf(\"%c\",&b[i][j]);\n if(a[1][1]==b[i][1]) flag++;\n if(a[1][2]==b[i][2]) flag++;\n }\n getchar();\n }\n if(flag==0) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\nchar i[5],ii[5];\nint a,sum=0;\ngetchar();\ngets(i);\nfor(a=0;a<5;a++){\n gets(ii);\nif(i[0]==ii[0]||i[1]==i[1]){\n sum++;\n}\n}\nif(sum>0){\n printf(\"YES\");\n}\nelse{\n printf(\"NO\");\n}\n\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint\nmain ()\n{\n int loop = 0, count1 = 0, count2 = 0;\n char array[100];\n\n \n\n fgets(array,100,stdin); \n \n\n \n \n {\n if (array[1] == array[4] ||array[1] == array[7] ||array[1] == array[10] ||array[1] == array[13]\n\t ||array[1] == array[16])\n\t{\n\t printf (\"YES\");\n\t return 0;\n\t}\n\n if (array[0] == array[3] ||array[0] == array[6] ||array[0] == array[9] ||array[0] == array[12]\n\t ||array[0] == array[15])\n\t{\n\t printf (\"YES\");\n\t return 0;\n\t}\n\n\n\n }\n printf (\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char onTable[3];\n char inHand[15];\n\n scanf(\"%s\\n\", onTable);\n fgets(inHand, 15, stdin);\n\n for (short i = 0; i < 15; i += 2) {\n if (onTable[0] == inHand[i] || onTable[1] == inHand[i+1]) {\n puts(\"YES\");\n exit(0);\n }\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char B[5][3];\n int i,p=0;\n for(i=0; i<6;i++)\n {\n scanf(\"%s\",B[i]);\n }\n i=1;\n while(i<5)\n {\n if((B[0][0]==B[i][0])||(B[0][1]==B[i][1]))\n {\n p=3;\n break;\n }\n else\n i++;\n }\n if(p==3)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nstruct liste{\n char name[30];\n struct liste *next;\n};\ntypedef struct liste *liste ;\nliste creation(int n){\n liste head,tmp,pt;\n head=malloc(sizeof(struct liste));\n scanf(\"%s\",head->name);\n head->next=NULL;\n pt=head;\n for(int i=1;i<n;i++){\n tmp=malloc(sizeof(struct liste));\n scanf(\"%s\",tmp->name);\n tmp->next=NULL;\n pt->next=tmp;\n pt=tmp;\n }\n return head;\n \n}\nint traitement(char card[],liste L){\n int i=0,ok=0,j=0;\n while(L){\n j=0;\n do{\n i=0;\n while(i<2){\n if(card[j]==L->name[i]){\n printf(\"yes\");\n \n return 0;\n }\n i++;\n }\n j++;\n }while(j<2);\n \n L=L->next;\n}\n printf(\"non\");\n}\n int main(){\nchar card[2];\nliste L;\n scanf(\"%s\",card);\n if(*card='\\0')return 0;\n L=creation(5);\n traitement(card,L);\n \n \n }"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6],a;\n scanf(\"%c%c\",&mat[0][0],&mat[0][1]);\n for(int i=0;i<5;i++)\n {\n scanf(\"%c%c\",&mat[i+1][0],&mat[i+1][1]);\n }\n printf(\"%c%c\\n\",mat[0][0],mat[0][1]);\n for(int i=0;i<5;i++)\n {\n printf(\"%c%c\\n\",mat[i+1][0],mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i+1][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==5)\n {\n printf(\"N0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain(){\nchar a[2];\nchar b[2];\nint i,sum=0;\ngetchar();\nscanf(\"%s\",a);\nfor(i=1;i<6;i++){\nscanf(\"%s\",b);\nif(a[1]==b[1]||a[0]==b[0])\n {\n sum++;\n}\n\n}\nif(sum>0){\n printf(\"YES\");\n}\nelse{\n printf(\"NO\");\n}\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c;\n char a[2],b[2];\n for(i=0;i<2;i++)\n scanf(\"%s\",a);\n for(i=0;i<20;i++)\n scanf(\"%s\",b);\n for(i=0;i<20;i++)\n {\n if(a[0]==b[i]||a[1]==b[i])\n {\n c=1;\n break;\n }\n else\n c=0;\n }\n if(c==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return(0);\n}"}, {"source_code": "typedef struct {\n char rank,suit;\n} card;\nint main() {\n card c1, c2[5];\n scanf(\"%c%c\",&c1.rank,&c1.suit);\n int i;\n for(i=0;i<5;i++) {\n scanf(\"%*c%c%c\",&c2[i].rank,&c2[i].suit);\n if(c1.rank==c2[i].rank || c1.suit==c2[i].rank) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\n\nint main(void) \n{\n \nchar str[3], str1[3], str2[3], str3[3], str4[3], str5[3];\n \nscanf(\"%s\",str);\n \nscanf(\"%s %s %s %s %s\",str1,str2,str3,str4,str5);\n \nif(str[0]=str1[0]||str[0]==str2[0]||str[0]==str3[0]||str[0]==str4[0]||str[0]==str5[0]||str[1]==str1[1]||str[1]==str2[1]||str[1]==str3[1]||str[1]==str4[1]||str[1]==str5[1])\n \n printf(\"YES\");\n \nelse\n \nprintf(\"NO\");\n\t// your code goes here\n\t\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char table[2], hands[2];\n int s = 0;\n scanf(\"%s\", table);\n\n for(int i = 0; i < 5; i++)\n {\n scanf(\"%c\", hands);\n if(hands[s] == table[s] || hands[s+1] == table[s+1]) {printf(\"YES\"); break; return 0;}\n else continue;\n }\n printf(\"NO \");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n char str[3], str1[3], str2[3], str3[3], str4[3], str5[3];\n scanf(\"%s\",str);\n scanf(\"%s %s %s %s %s\",str1,str2,str3,str4,str5);\n if((str[1]==(str1[1]||str2[1]||str3[1]||str4[1]||str5[1]))||(str[2]==(str1[2]||str2[2]||str3[2]||str4[2]||str5[2])))\n printf(\"YES\");\n else\n printf(\"NO\");\n\t// your code goes here\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char mat[6][6];\n scanf(\"%c %c\",&mat[0][0],&mat[0][1]);\n for(int i ;i<5;i++)\n {\n scanf(\"%c %c\",&mat[i+1][0],&mat[i+1][1]);\n }\n int i=0;\n for(i;i<5;i++){\n if(mat[0][0]==mat[i+1][0]||mat[0][1]==mat[i][1])\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==6)\n {\n printf(\"N0\");\n }\n return 0;\n \n}"}, {"source_code": "typedef struct {\n char rank,suit;\n} card;\nint main() {\n card c1, c2[5];\n scanf(\"%c%c\",&c1.rank,&c1.suit);\n int i;\n for(i=0;i<5;i++) {\n scanf(\"%c%c \",&c2[i].rank,&c2[i].suit);\n if(c1.rank==c2[i].rank || c1.suit==c2[i].rank) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/*\ntypedef struct Deck\n{\n\tchar club[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar spades[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar heart[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\tchar diamond[13]= {2,3,4,5,6,7,8,9,'T','J','Q','K','A'};\n\t\n}deck;\n*/\n\n\ntypedef struct Card\n{\n\tchar face;\n\tchar num;\n}Card;\n/*\nvoid write (Card a);\n*/\nint main(void)\n{\n\tint cont=0;\n\tCard table,hand[5];\n\tscanf(\"%c%c\",&table.num,&table.face);\n\t\n\tscanf(\"%c%c%c%c%c%c%c%c%c%c\",&hand[0].num,&hand[0].face,\n\t\t\t\t\t\t\t\t &hand[1].num,&hand[1].face,\n\t\t\t\t\t\t\t\t &hand[2].num,&hand[2].face,\n\t\t\t\t\t\t\t\t &hand[3].num,&hand[3].face,\n\t\t\t\t\t\t\t\t &hand[4].num,&hand[4].face);\n\t/*\t\n\tfor(int i=0;i<5;i++)\n\t\t{\n\t\twrite(hand[i]);\t\t\t\t\t\t\t \n\t\t}\n\t*/\n\tfor(int i=0;i<5;i++)\n\t{\n\t\tif(hand[i].num==table.num ||hand[i].face==table.face)\n\t\t{\n\t\t\tprintf(\"Yes\");break;\n\t\t\tcont++;\n\t\t}\n\t}\n\tif(0==cont)\n\t{\n\t\tprintf(\"No\");\n\t}\n}\n/*\nvoid write (Card a)\n{\n\tprintf(\"%c%c\",a.num,a.face);\n}\n*/\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[2];\n char a[2];\n char s1[2];\n scanf(\"%s\",&s);\n s[0]==a[0];\n s[1]==a[0];\n int i,count;\n for(i=1;i<=2;i++){\n scanf(\"%s\",s1);\n if(s1[0]==a[0])\n {\n count=1;\n }\n else if(s1[1]==a[1])\n {\n count=1;\n }\n }\n if(count)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n \n int r=0,s=0;\n char card[2];\n char cards[15];\n gets(card);\n gets(cards);\n for(int i=0;i<strlen(cards);i+=3)\n { \n if(card[0]==cards[i])\n r++;\n }\n \n for(int i=1;i<strlen(cards);i+=3)\n { \n if(card[1]==cards[i])\n s++;\n }\n if((r==1 && s<2) || (s==1 && r<2))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar str[2],str1[5];\nint count=0,i,j,p;\nscanf(\"%s\",str);\nfor(i=0;i<4;i++)\n{\n scanf(\"%s\",str1);\n p=0;\n for(j=0;j<2;j++,p++)\n {\n if(str[p]==str1[j])\n count=count+1;\n break;\n }\n }\n if(count>0)\n printf(\"Yes\");\n else\n printf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k;\n k=0;\n char a[2],b[2],c[2],d[2],e[2],f[2];\n scanf(\"%s\",f);\n scanf(\"%s\",a);\n scanf(\"%s\",b);\n scanf(\"%s\",c);\n scanf(\"%s\",d);\n scanf(\"%s\",e);\n\n if(f[0]==a[0])\n k++;\n else if(f[0]==b[0])\n k++;\n else if(f[0]==c[0])\n k++;\n else if(f[0]==d[0])\n k++;\n else if(f[0]==e[0])\n k++;\n else\n {\n\n };\n if(k==0)\n {\n if(f[1]==a[1])\n k++;\n else if(f[1]==b[1])\n k++;\n else if(f[1]==c[1])\n k++;\n else if(f[1]==d[1])\n k++;\n else if(f[1]==e[1])\n k++;\n else\n {\n\n };\n }\n if(k>0)\n printf(\"yes\");\n else\n printf(\"no\");\n return 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[3],b[6][2];\n gets(a);\n for(int i=0;i<5;i++)\n {\n gets(b[i]);\n\n }\n for(int i=0;i<5;i++)\n {\n if(a[0]==b[i][0])\n {\n printf(\"Yes\");\n return 0;\n }\n if(a[1]==b[i][1])\n {\n printf(\"Yes\");\n return 0;\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nstruct liste{\n char name[30];\n struct liste *next;\n};\ntypedef struct liste *liste ;\nliste creation(int n){\n liste head,tmp,pt;\n head=malloc(sizeof(struct liste));\n scanf(\"%s\",head->name);\n head->next=NULL;\n pt=head;\n for(int i=1;i<n;i++){\n tmp=malloc(sizeof(struct liste));\n scanf(\"%s\",tmp->name);\n tmp->next=NULL;\n pt->next=tmp;\n pt=tmp;\n }\n return head;\n \n}\nint traitement(char card[],liste L){\n int i=0,ok=0,j=0;\n while(L){\n j=0;\n do{\n i=0;\n while(i<2){\n if(card[j]==L->name[i]&&(card[j]>64&&card[j]<91)){\n printf(\"yes\");\n \n return 0;\n }\n i++;\n }\n j++;\n }while(j<2);\n \n L=L->next;\n}\n printf(\"non\");\n}\n int main(){\nchar card[2];\nliste L;\n scanf(\"%s\",card);\n if(strlen(card)>2 )return 0;\n L=creation(5);\n traitement(card,L);\n \n \n }"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\tchar a[2],b[2],c[2],d[2],e[2],z[2],p,q;\n\tint l=0;\n\tscanf(\"%s %s %s %s %s %s\",z,a,b,c,d,e);\n\tp=z[0];\n\tq=z[1];\n\tif(a[0]==p || b[0]==p || c[0]==p || d[0]==p ||e[0]==p || a[1]==p || b[1]==p || c[1]==p || d[1]==p ||e[1]==p || a[0]==q || b[0]==q || c[0]==q || d[0]==q ||e[0]==q || a[1]==q || b[1]==q || c[1]==q || d[1]==q ||e[1]==q){\n\t // printf(\"YES\");\n\t l=1;\n\t}\n\tif(l==1){\n\t printf(\"YES\");\n\t}\n\telse\n\t{\n\t printf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar T[3];\n\tprintf(\"please Enter\");\n\tscanf(\"%s\", T);\n\tchar hand[5][3];\n\tint i;\n\tint flag=1;\n\tfor(i=0;i<5;i++){\n\t\tscanf(\"%s\", hand[i]);\n\t}\n\tfor(i=0;i<5;i++){\n\t\tif((hand[i][0]==T[0] )||(hand[i][1]==T[1] )){\n\t\t\tprintf(\"YES\\n\");\n\t\t\tflag=0;\n\t\t\tbreak;\n\t\t\t\n\t\t}\n\t\t\n\t}\n\tif(flag){\n\t\tprintf(\"NO\\n\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[10],b[10],c[10],d[10],e[10],f[10];\n int count=0,i;\n scanf(\" %s\",a);\n scanf(\" %s %s %s %s %s\",b,c,d,e,f);\n for(i=0;i<2;i++)\n {\n if (b[i]==a[i] || c[i]==a[i] || d[i]==a[i] ||e[i]==a[i] ||f[i]==a[i])\n count++;\n break;\n }\n if(count!=0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}], "src_uid": "699444eb6366ad12bc77e7ac2602d74b"} {"nl": {"description": "InputThe input contains a single integer a (1\u2009\u2264\u2009a\u2009\u2264\u200930).OutputOutput a single integer.ExampleInput3Output27", "input_spec": "The input contains a single integer a (1\u2009\u2264\u2009a\u2009\u2264\u200930).", "output_spec": "Output a single integer.", "sample_inputs": ["3"], "sample_outputs": ["27"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, a[30]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\", &n);\n printf(\"%d\\n\", a[n-1]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, a[30]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\", &n);\n printf(\"%d\\n\", a[n-1]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n int ljh[]={0,4,22,27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n int main (void)\n {\n int zjm;\n scanf(\"%d\",&zjm); \n printf(\"%d\\n\",ljh[zjm]); \n return 0; \n} "}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint i;\n\tscanf(\"%d\", &i);\n\tprintf(\"%d\", mas[i - 1]);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int a[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165 };\n printf(\"%d\",a[n-1]);\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint b,a[] = { 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645 };\n\tscanf(\"%d\", &b);\n\tprintf(\"%d\\n\", a[b-1]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int Arr[100] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895};\n int N;\n\n scanf(\"%d\",&N);\n printf(\"%d\",Arr[N-1]);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", n[a-1]);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n==1)\n\t\t\t {\n\t\t\t \n printf(\"4\");\n }\n else if(n==2)\n {\n\t\t\t \n printf(\"22\");\n }\n else if(n==3)\n {\n\t\t\t \n printf(\"27\");\n }\n else if(n==4)\n {\n\t\t\t \n printf(\"58\");\n }\n else if(n==5)\n {\n\t\t\t\t\n printf(\"85\");\n }\n else if(n==6)\n {\n printf(\"94\");\n }\n else if(n==7)\n {\n\t\t\t\t\n printf(\"121\");\n }\n else if(n==8)\n {\n\t\t\t\t\n printf(\"166\");\n }\n else if(n==9)\n {\n\t\t\t \n printf(\"202\");\n }\n else if(n==10)\n {\n\t\t\t\t \n printf(\"265\");\n }\n else if(n==11)\n {\n\t\t\t\t\n printf(\"274\");\n }\n else if(n==12)\n {\n\t\t\t\t \n printf(\"319\");\n }\n else if(n==13)\n {\n\t\t\t\t \n printf(\"346\");\n }\n else if(n==14)\n {\n printf(\"355\");\n }\n else if(n==15)\n {\n\t\t\t\t \n printf(\"378\");\n }\n else if(n==16)\n {\n\t\t\t\t \n printf(\"382\");\n }\n else if(n==17)\n {\n\t\t\t\t \n printf(\"391\");\n }\n else if(n==18)\n {\n\t\t\t\t \n printf(\"438\");\n }\n else if(n==19)\n {\n\t\t\t\t \n printf(\"454\");\n }\n else if(n==20)\n {\n\t\t\t\t \n printf(\"483\");\n }\n else if(n==21)\n {\n\t\t\t\t\n printf(\"517\");\n }\n else if(n==22)\n {\n\t\t\t\t \n printf(\"526\");\n }\n else if(n==23)\n {\n\t\t\t\t \n printf(\"535\");\n }\n else if(n==24)\n {\n\t\t\t\t\t\n printf(\"562\");\n }\n else if(n==25)\n {\n\t\t\t\t \n printf(\"576\");\n }\n else if(n==26)\n {\n\t\t\t\t \n printf(\"588\");\n }\n else if(n==27)\n {\n\t\t\t\t\n printf(\"627\");\n }\n else if(n==28)\n {\n\t\t\t\t\n printf(\"634\");\n }\n else if(n==29)\n {\n\t\t\t \n printf(\"636\");\n }\n else\n {\n\t\t\t\t\n\t\t\t\t printf(\"645\");\n\t\t\t\t }\n\t\t\t\t return 0;\n \n}\n\n"}, {"source_code": "#include <stdio.h>\n\nconst int a[] = {\n\t4, 22, 27, 58, 85, 94, 121, 166, 202, 265,\n \t274, 319, 346, 355, 378, 382, 391, 438, 454, 483,\n \t517, 526, 535, 562, 576, 588, 627, 634, 636, 645\n};\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", a[n-1]);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint i;\n\tscanf(\"%d\", &i);\n\tprintf(\"%d\", mas[i - 1]);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int i;\n scanf(\"%d\", &i);\n printf(\"%d\", mas[i - 1]);\n}\n"}, {"source_code": "#include <stdio.h>\nint seq[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\nint main(void) {\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", seq[--a]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[30]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,526, 535, 562, 576, 588, 627, 634, 636, 645};\n int n,i;\n scanf(\"%d\",&n);\n for(i=0; i<30; i++)\n {\n printf(\"%d\\n\",a[n-1]);\n break;\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long a;\n int b[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n scanf(\"%d\", &a);\n printf(\"%d\", b[a-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n, num, n2, i, array1[100], array2[100], array3[100], array4[100], j, l, o, m, t;\n scanf(\"%d\", &num);\n for(m = 4, o = 0; m <= 650; m++)\n {\n t = 0;\n n = m, n2 = m;\n for(i = 2; i < n; i++)\n if(n%i==0)\n t = 1;\n if(t == 1)\n {\n for(i = 2, j = 0; i <= n; i++)\n if(n%i == 0)\n array1[j] = i, n/=i, i = 1, j++;\n for(i = 0, l = 0; i < j; i++)\n while(array1[i]!=0)\n array2[l] = array1[i]%10, array1[i]/=10, l++;\n int sum1 = 0, sum2 = 0;\n for(i = l-1; i >= 0; i--)\n sum1+=array2[i];\n l = 0;\n while(n2!=0)\n array3[l] = n2%10, n2/=10, l++;\n for(i = 0; i < l; i++)\n sum2+=array3[i];\n if(sum1 == sum2)\n {\n array4[o] = m, o++;\n if(o == num) break;\n }\n }\n }\n printf(\"%d\\n\", array4[num-1]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int a[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\",&n);\n printf(\"%d\",a[n-1]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int num, arr[50]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778};\n scanf(\"%d\", &num);\n printf(\"%d\\n\", arr[num-1]);\n return 0;\n}"}, {"source_code": "\nint main(){\n\n int n ;\n int a[120]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n scanf(\"%d\",&n);\n printf(\"%d\",a[n-1]);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int number =0;\n scanf(\"%d\",&number);\n\n switch(number)\n {\n case(1):\n printf(\"4\");\n break;\n case(2):\n printf(\"22\");\n break;\n case(3):\n printf(\"27\");\n break;\n case(4):\n printf(\"58\");\n break;\n case(5):\n printf(\"85\");\n break;\n case(6):\n printf(\"94\");\n break;\n case(7):\n printf(\"121\");\n break;\n case(8):\n printf(\"166\");\n break;\n case(9):\n printf(\"202\");\n break;\n case(10):\n printf(\"265\");\n break;\n case(11):\n printf(\"274\");\n break;\n case(12):\n printf(\"319\");\n break;\n case(13):\n printf(\"346\");\n break;\n case(14):\n printf(\"355\");\n break;\n case(15):\n printf(\"378\");\n break;\n case(16):\n printf(\"382\");\n break;\n case(17):\n printf(\"391\");\n break;\n case(18):\n printf(\"438\");\n break;\n case(19):\n printf(\"454\");\n break;\n case(20):\n printf(\"483\");\n break;\n case(21):\n printf(\"517\");\n break;\n case(22):\n printf(\"526\");\n break;\n case(23):\n printf(\"535\");\n break;\n case(24):\n printf(\"562\");\n break;\n case(25):\n printf(\"576\");\n break;\n case(26):\n printf(\"588\");\n break;\n case(27):\n printf(\"627\");\n break;\n case(28):\n printf(\"634\");\n break;\n case(29):\n printf(\"636\");\n break;\n case(30):\n printf(\"645\");\n break;\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main() {\n\tint n;\n\tint a[]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086};\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", a[n - 1]);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n;\n\tint a[30]={\t4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\" ,a[n-1]);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint i;\n\tscanf(\"%d\", &i);\n\tprintf(\"%d\", mas[i - 1]);\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int arr[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n int a=0;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",arr[a-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int i,a[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\",&i);\n printf(\"%d\",a[i-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint n;\n\tint a[75]={0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165 };\n\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",a[n]);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n int n,arr[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\nint main()\n{\n scanf(\"%d\",&n);\n printf(\"%d\\n\",arr[n-1]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tint j=0;\n\tint o[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\nscanf(\"%d\",&j);\n\tprintf (\"%d\",o[j-1]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int Ans[31] = {0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\",Ans[x]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n/* https://oeis.org/A006753 */\n\nint jokes[] = { 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645 };\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\ta--;\n\tprintf(\"%d\\n\", jokes[a]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i;\n int a[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\",&i);\n\n printf(\"%d\",a[i-1]);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint N[31];\n\tN[1]=4, N[2]=22, N[3]=27, N[4]=58, N[5]=85, N[6]=94, N[7]=121, N[8]=166;\n\tN[9]=202, N[10]=265, N[11]=274, N[12]=319, N[13]=346, N[14]=355, N[15]=378;\n\tN[16]=382, N[17]=391, N[18]=438, N[19]=454, N[20]=483, N[21]=517, N[22]=526;\n\tN[23]=535, N[24]=562, N[25]=576, N[26]=588, N[27]=627, N[28]=634, N[29]=636, N[30]=645;\n\tint i;\n\tscanf(\"%d\",&i);\n\tprintf(\"%d\",N[i]);\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int num[32]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648};\n int a;\n\n scanf(\"%d\", &a);\n\n printf(\"%d\\n\", num[a-1]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, a[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n\n\tscanf(\"%d\", &n);\n\t \n\tprintf(\"%d\", a[n - 1]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int smith[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", smith[a-1]);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint check(int num)\n{\n int n = 2, x = num, cnt = 0, tmp;\n while(x != 1)\n {\n\tif(x/(float)n == x/n)\n\t{\n\t x /= n; tmp = n;\n\t if(n == num) return 0;\n\t while(tmp > 0) {\n\t\tcnt += tmp%10;\n\t\ttmp /= 10; }\n\t}\n\telse n++;\n }\n tmp = num; int ans = 0;\n while(tmp > 0) {\n\tans += tmp%10;\n\ttmp /= 10; }\n if(cnt == ans) return 1;\n else return 0;\n}\n\n\nint main()\n{\n int n; scanf(\"%d\", &n);\n int num = 1;\n while(n > 0)\n {\n\tif(check(num)) n--;\n\tnum++;\n }\n printf(\"%d\\n\", num - 1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint smith[]={4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636,645};\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",smith[n-1]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint a[] = {0,4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636\n,645,648,654,663,666,690,706,728,729,762,778,825,852,861,895,913,915,922,958,985,1086,1111,1165};\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",a[n]);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[100]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n\n\nint main(){\n\tint n;\n\twhile(scanf(\"%d\",&n)==1&&n){\n\t\tprintf(\"%d\\n\",a[n-1]);\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,a[]={0,4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825};\n scanf(\"%d\",&n);\n printf(\"%d\\n\",a[n]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint iPrime(int n);\nint PrimeSum(int n);\nint digitSum(int n);\nint main(void)\n{\n int i,j,n;\n int a[100];\n for(i=1,j=0;j<50;i++)\n {\n if(PrimeSum(i)==digitSum(i)&& iPrime(i)!=1)\n {\n a[j]=i;\n j++;\n\n }\n\n }\n scanf(\"%d\",&n);\n printf(\"\\n%d\",a[n-1]);\n return 0;\n\n\n}\nint PrimeSum(int n)\n{\n int i,j,k=0,sum=0;\n int a[100],b[100];\n\n for(i=2;i<=n;i++)\n {\n if(iPrime(i)==1 && (n%i)==0)\n {\n j=0;\n while(n%i==0)\n {\n j++;\n n=n/i;\n }\n if(i>10) a[k]=digitSum(i);\n else a[k]=i;\n b[k]=j;\n k++;\n }\n\n }\n for(i=0;i<k;i++)\n {\n sum=sum+a[i]*b[i];\n }\n return sum;\n\n}\n\nint iPrime(int n)\n{\n int i;\n for(i=2;i*i<=n;i++)\n if(n%i==0) return 0;\n return 1;\n}\nint digitSum(int n)\n{\n int sum=0;\n while(n!=0)\n {\n sum+=n%10;\n n/=10;\n }\n return sum;\n\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint i;\n\tscanf(\"%d\", &i);\n\tprintf(\"%d\", mas[i - 1]);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i;\n int a[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n scanf(\"%d\",&i);\n\n printf(\"%d\",a[i-1]);\n\n return 0;\n }\n\n"}, {"source_code": "/* CF April Fools Contest 2017\n * Problem A. Numbers Joke\n * https://oeis.org/A006753\n * Created by tjua on 03/31/17.\n * Copyright \u00a9 2016 tjua. All rights reserved.\n */\n\n#include <stdio.h>\n#include <assert.h>\n\nint a[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n\nint main() {\n\n\tint n;\n\tscanf(\"%d\", &n);\n\tassert(0 < n && n <= 30);\n\tprintf(\"%d\\n\", a[n-1]);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a, b[]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648};\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"%d\\n\", b[a-1]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nconst int joke[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\\n\", joke[--n]);\n return 0;\n}\n"}, {"source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n int a[1001]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086};\n long long n;\n scanf(\"%lld\",&n);\n printf(\"%lld\\n\",a[n-1]);\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int temp, smith[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382,\n 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648};\n\n scanf(\"%d\", &temp);\n printf(\"%d\", smith[temp-1]);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain(){\n\n int a[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517,526, 535, 562, 576, 588, 627, 634, 636, 645};\n int b;\n scanf(\"%d\",&b);\n printf(\"%d\",a[b-1]);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tint ans;\n\t\n\tif(n == 1)\n\t ans = 4;\n\tif(n == 2)\n\t ans = 22;\n\tif(n == 3)\n\t ans = 27;\n\tif(n == 4)\n\t ans = 58;\n\tif(n == 5)\n\t ans = 85;\n\tif(n == 6)\n\t ans = 94;\n\tif(n == 7)\n\t ans = 121;\n\tif(n == 8)\n\t ans = 166;\n\tif(n == 9)\n\t ans = 202;\n\tif(n == 10)\n\t ans = 265;\n\tif(n == 11)\n\t ans = 274;\n\tif(n == 12)\n\t ans = 319;\n\tif(n == 13)\n\t ans = 346;\n\tif(n == 14)\n\t ans = 355;\n\tif(n == 15)\n\t ans = 378;\n\tif(n == 16)\n\t ans = 382;\n\tif(n == 17)\n\t ans = 391;\n\tif(n == 18)\n\t ans = 438;\n\tif(n == 19)\n\t ans = 454;\n\tif(n == 20)\n\t ans = 483;\n\tif(n == 21)\n\t ans = 517;\n\tif(n == 22)\n\t ans = 526;\n\tif(n == 23)\n\t ans = 535;\n\tif(n == 24)\n\t ans = 562;\n\tif(n == 25)\n\t ans = 576;\n\tif(n == 26)\n\t ans = 588;\n\tif(n == 27)\n\t ans = 627;\n\tif(n == 28)\n\t ans = 634;\n\tif(n == 29)\n\t ans = 636;\n\tif(n == 30)\n\t ans = 645;\n\t\n\tprintf(\"%d\", ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint list[55]={0,4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636,645};\nint read()\n{\n int x=0;\n char ch=getchar();\n while(ch<'0'||ch>'9')ch=getchar();\n while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();\n return x;\n}\nvoid print(int x)\n{\n if(x<10)\n {\n putchar(x+'0');\n return ;\n }\n print(x/10);\n putchar(x%10+'0');\n}\nint main()\n{\n print(list[read()]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,num[343]={4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636,645,648,654,663};\n scanf(\"%d\",&n);\n printf(\"%d\\n\",num[n-1]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint ans[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\", ans[n - 1]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a;\n scanf(\"%d\",&a);\n int st[30]={4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n printf(\"%d\",st[a-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint mas[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint i;\n\tscanf(\"%d\", &i);\n\tprintf(\"%d\", mas[i - 1]);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[30] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n\tint x;\n\tscanf(\"%d\", &x);\n\tprintf(\"%d\", a[x - 1]);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i;\n scanf(\"%d\",&a);\n if(a==1) printf(\"4\");\n if(a==2) printf(\"22\");\n if(a==3) printf(\"27\");\n if(a==4) printf(\"58\");\n if(a==5) printf(\"85\");\n if(a==6) printf(\"94\");\n if(a==7) printf(\"121\");\n if(a==8) printf(\"166\");\n if(a==9) printf(\"202\");\n if(a==10) printf(\"265\");\n if(a==11) printf(\"274\");\n if(a==12) printf(\"319\");\n if(a==13) printf(\"346\");\n if(a==14) printf(\"355\");\n if(a==15) printf(\"378\");\n if(a==16) printf(\"382\");\n if(a==17) printf(\"391\");\n if(a==18) printf(\"438\");\n if(a==19) printf(\"454\");\n if(a==20) printf(\"483\");\n if(a==21) printf(\"517\");\n if(a==22) printf(\"526\");\n if(a==23) printf(\"535\");\n if(a==24) printf(\"562\");\n if(a==25) printf(\"576\");\n if(a==26) printf(\"588\");\n if(a==27) printf(\"627\");\n if(a==28) printf(\"634\");\n if(a==29) printf(\"636\");\n if(a==30) printf(\"645\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int ara[30]={4,22,27,58,85,94,121,166,202,265,274,319,346,355,378,382,391,438,454,483,517,526,535,562,576,588,627,634,636,645};\n scanf(\"%d\",&n);\n printf(\"%d\",ara[n-1]);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"27\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n puts(\"3\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\t\n\tprintf (\"27\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n printf(\"%d\",30-a);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%s\", &n);\n puts(\"1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,s;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",30-a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",30-n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"81\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"10\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265};\n int n,i;\n scanf(\"%d\",&n);\n for(i=0; i<10; i++)\n {\n printf(\"%d\\n\",a[n-1]);\n break;\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n;\n\twhile(scanf(\"%d\",&n)==1&&n){\n\t\tprintf(\"%d\\n\",30-n);\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"27\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"5\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"1\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"8\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a;\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"%d\\n\", 30-a);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int A;\n scanf(\"%d\",&A);\n printf(\"27\\n\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int Ans[30] = {0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\",Ans[x]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n long long res = 1;\n while (n--) res *= 3;\n printf(\"%lld\\n\", 27);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (n==6)\n printf(\"94\");\n else if (n==7)\n printf(\"121\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"19\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"12\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n printf(\"%d\",9*a);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a+1);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",a*a*a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"6\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (\"n==6\")\n printf(\"94\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a+1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,i,p=1;\n scanf(\"%d\",&a);\n if(1<= a && a<=30)\n {\n for(i=1;i<=a;i++)\n {\n p*=a;\n }\n printf(\"%d\",p);\n }\n else\n {\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a*9);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n puts(\"3\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (\"n==6\")\n printf(\"94\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n puts(\"3\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a*9);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"13\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;scanf(\"%d\",&a);printf(\"%d\\n\",a*a*a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"2\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tprintf(\"%d\", n * n * n);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;scanf(\"%d\",&a);printf(\"%d\\n\",a*a*a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"9\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int i,a[]={4,22,27,58};\n scanf(\"%d\",&i);\n printf(\"%d\",a[i-1]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x;\n scanf(\"%d\", &x);\n printf(\"27\");\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){int a;scanf(\"%d\",&a);printf(\"5\\n\");}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"20\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"64\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"20\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265};\n int n,i;\n scanf(\"%d\",&n);\n for(i=0; i<10; i++)\n {\n printf(\"%d\\n\",a[n-1]);\n break;\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (\"n==6\")\n printf(\"94\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,v;\n scanf(\"%d\",&a);\n v=9*a;\n printf(\"%d\",v);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",9*a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a*9);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a;\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"%d\\n\", 30-a);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n printf(\"%d\",a*a*a);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n if(1<= a && a<=30)\n{\n p=a*10-a;\n printf(\"%d\",p);\n}\n else\n {\n return 0;\n }\n return 0;\n}"}, {"source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:31/03/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long n;\n scanf(\"%lld\",&n);\n long long a=n*n*n;\n printf(\"%lld\\n\",a);\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n if(1<= a && a<=30)\n{\n p=a*10-a;\n printf(\"%d\",p);\n}\n else\n {\n return 0;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint seq[] = {4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645, 648, 654, 663, 666, 690, 706, 728, 729, 762, 778, 825, 852, 861, 895, 913, 915, 922, 958, 985, 1086, 1111, 1165};\nint main(void) {\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", seq[a]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int Ans[30] = {0, 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438, 454, 483, 517, 526, 535, 562, 576, 588, 627, 634, 636, 645};\n int x;\n scanf(\"%d\",&x);\n printf(\"%d\",Ans[x]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a*9);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main(){\n int num;\n scanf(\"%d\", &num);\n printf(\"%d\\n\", 30-num);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\\n\", 30 - a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tprintf(\"%d\", 27);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, i;\n\tlong long ans = 1;\n\n\tscanf(\"%d\", &n);\n\n\tfor (i = 1; i <= n; i++)\n\t ans *= 3;\n\t \n\tprintf(\"%I64d\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;scanf(\"%d\",&a);printf(\"%d\\n\",a*a*a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",n*9);\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a;\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n long long int A,sum=1,i;\n scanf(\"%lld\",&A);\n\n for(i=1; i<=A; i++)\n {\n sum = sum*A;\n }\n\n printf(\"%lld\\n\",sum);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10]= {4, 22, 27, 58, 85, 94, 121, 166, 202, 265};\n int n,i;\n scanf(\"%d\",&n);\n for(i=0; i<10; i++)\n {\n printf(\"%d\\n\",a[n-1]);\n break;\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"5\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int a,r;\n scanf(\"%d\",&a);\n r=(23*a)/2-7;\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i;\n scanf(\"%d\",&a);\n if(a==1) printf(\"4\");\n if(a==2) printf(\"22\");\n if(a==3) printf(\"27\");\n if(a==4) printf(\"58\");\n if(a==5) printf(\"85\");\n if(a==6) printf(\"94\");\n if(a==7) printf(\"121\");\n if(a==8) printf(\"166\");\n if(a==9) printf(\"202\");\n if(a==10) printf(\"265\");\n if(a==11) printf(\"274\");\n if(a==12) printf(\"319\");\n if(a==13) printf(\"483\");\n if(a==14) printf(\"517\");\n if(a==15) printf(\"526\");\n if(a==16) printf(\"535\");\n if(a==17) printf(\"562\");\n if(a==18) printf(\"576\");\n if(a==19) printf(\"588\");\n if(a==20) printf(\"627\");\n if(a==21) printf(\"634\");\n if(a==22) printf(\"636\");\n if(a==23) printf(\"645\");\n if(a==24) printf(\"648\");\n if(a==25) printf(\"654\");\n if(a==26) printf(\"663\");\n if(a==27) printf(\"666\");\n if(a==28) printf(\"690\");\n if(a==29) printf(\"706\");\n if(a==30) printf(\"728\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"5\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a;\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"64\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,v;\n scanf(\"%d\",&a);\n v=pow(a,a);\n printf(\"%d\",v);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n#include <time.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n, ar[100010];\n\nint main(){\n int i, j, x, g, flag;\n\n scanf(\"%d\", &n);\n if (n == 3) puts(\"27\");\n else if (n == 1) puts(\"4\");\n else if (n == 2) puts(\"21\");\n else __builtin_trap();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t//code\n\tint a;\n\tscanf(\"%d\", &a);\n\tif((a>=1)&&(a<=30));\n\tprintf(\"%d\\n\", 30-a);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\\n\", 30 - n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tprintf(\"%d\", n + 24);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a;\n scanf(\"%d\", &a);\n printf(\"%d\", a+1);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (\"n==6\")\n printf(\"94\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int i,a[]={4,22,27,58};\n scanf(\"%d\",&i);\n printf(\"%d\",a[i-1]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\\n\", a * a * a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long power(int a, int b) {\n\treturn b == 0 ? 1LL : a * power(a, b - 1);\n}\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf(\"%lld\\n\", power(a, a));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int i,a[]={4,22,27,58};\n scanf(\"%d\",&i);\n printf(\"%d\",a[i-1]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\n\tscanf(\"%d\", &n);\n\n\tprintf(\"%d\", 30 - n);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a;\n \n scanf(\"%d\", &a);\n \n printf(\"%d\\n\", 30-a);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",30-n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%s\", &n);\n puts(\"1\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int a=0;scanf(\"%d\",&a);printf(\"%d\\n\",a*a*a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,s;\n scanf(\"%d\",&a);\n printf(\"%d\\n\",30-a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n;\n\twhile(scanf(\"%d\",&n)==1&&n){\n\t\tprintf(\"%d\\n\",10*n-3);\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint a;\n\tscanf(\"%d\", &a);\n\tprintf(\"%d\\n\", a+24);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n int main()\n{\n int i,a[3]={4,22,27};\n scanf(\"%d\",&i);\n printf(\"%d\",a[i-1]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n;\n scanf(\"%d\",&n);\n if (n==3)\n printf(\"27\\n\");\n else if (n==1)\n printf(\"4\\n\");\n else if (n==2)\n printf(\"22\\n\");\n else if (n==4)\n printf(\"58\\n\");\n else if (n==5)\n printf(\"85\");\n else if (\"n==6\")\n printf(\"94\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(){int a;scanf(\"%d\",&a);printf(\"5\\n\");}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n long long int A,sum=1,i;\n scanf(\"%lld\",&A);\n\n for(i=1; i<=A; i++)\n {\n sum = sum*A;\n }\n\n printf(\"%lld\\n\",sum);\n\n return 0;\n\n}\n"}], "src_uid": "bf65a25185e9ea5b71e853723b838b04"} {"nl": {"description": "Karlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specifically, to play together a game he has just invented with the chocolates. The winner will get the cake as a reward.The box of chocolates has the form of a hexagon. It contains 19 cells for the chocolates, some of which contain a chocolate. The players move in turns. During one move it is allowed to eat one or several chocolates that lay in the neighboring cells on one line, parallel to one of the box's sides. The picture below shows the examples of allowed moves and of an unacceptable one. The player who cannot make a move loses. Karlsson makes the first move as he is Lillebror's guest and not vice versa. The players play optimally. Determine who will get the cake.", "input_spec": "The input data contains 5 lines, containing 19 words consisting of one symbol. The word \"O\" means that the cell contains a chocolate and a \".\" stands for an empty cell. It is guaranteed that the box contains at least one chocolate. See the examples for better understanding.", "output_spec": "If Karlsson gets the cake, print \"Karlsson\" (without the quotes), otherwise print \"Lillebror\" (yet again without the quotes).", "sample_inputs": [". . .\n . . O .\n. . O O .\n . . . .\n . . .", ". . .\n . . . O\n. . . O .\n O . O .\n . O ."], "sample_outputs": ["Lillebror", "Karlsson"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 20];\n\nint box2mask(char b[5][5]) {\n\tint mask = 0, i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (b[i][j])\n\t\t\t\tmask |= 1 << k;\n\t\t\tk++;\n\t\t}\n\n\treturn mask;\n}\n\nint go(int mask) {\n\tif (r[mask] != -1)\n\t\treturn r[mask];\n\t\n\t// printf(\"mask = %d\\n\", mask);\n\n\tchar b[5][5];\n\tmemset(b, 0, sizeof(b));\n\n\tint i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (mask & (1 << k))\n\t\t\t\tb[i][j] = 1;\n\t\t\tk++;\n\t\t}\n\n\tchar bb[5][5];\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tint l;\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && l >= 0 && bb[k][l]; k++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t\tif (k >= 2)\n\t\t\t\t\tl--;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && bb[k][l]; k++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t\tif (k < 2)\n\t\t\t\t\tl++;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = j; k < 5-abs(2-i) && bb[i][k]; k++) {\n\t\t\t\tbb[i][k] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\t\t}\n\t\n\treturn r[mask] = 0;\n}\n\nint main() {\n\tint i, mask = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100];\n\t\tgets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tmask |= (1 << j);\n\t\t\tif (*t == 'O' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\t\n\tif (j != 19)\n\t\texit(1);\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(mask))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 20];\n\nint box2mask(char b[5][5]) {\n\tint mask = 0, i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (b[i][j])\n\t\t\t\tmask |= 1 << k;\n\t\t\tk++;\n\t\t}\n\n\treturn mask;\n}\n\nint go(int mask) {\n\tif (r[mask] != -1)\n\t\treturn r[mask];\n\n\tchar b[5][5];\n\tmemset(b, 0, sizeof(b));\n\n\tint i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (mask & (1 << k))\n\t\t\t\tb[i][j] = 1;\n\t\t\tk++;\n\t\t}\n\n\tchar bb[5][5];\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = i; k < 5 && j < 5-abs(2-k) && bb[k][j]; k++) {\n\t\t\t\tbb[k][j] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tint l;\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && bb[k][l]; k++, l++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = j; k < 5-abs(2-i) && bb[i][k]; k++) {\n\t\t\t\tbb[i][k] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\t\t}\n\n\treturn r[mask] = 0;\n}\n\nint main() {\n\tint i, mask = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100];\n\t\tgets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tmask |= (1 << j);\n\t\t\tif (*t == 'O' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\t\n\tif (j != 19)\n\t\texit(1);\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(mask))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 19];\n\nint box2mask(char b[5][5]) {\n\tint mask = 0, i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (b[i][j])\n\t\t\t\tmask |= 1 << k;\n\t\t\tk++;\n\t\t}\n\n\treturn mask;\n}\n\nint go(int mask) {\n\tif (r[mask] != -1)\n\t\treturn r[mask];\n\n\tchar b[5][5];\n\tmemset(b, 0, sizeof(b));\n\n\tint i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (mask & (1 << k))\n\t\t\t\tb[i][j] = 1;\n\t\t\tk++;\n\t\t}\n\n\tchar bb[5][5];\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = i; k < 5 && j < 5-abs(2-k) && bb[k][j]; k++) {\n\t\t\t\tbb[k][j] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tint l;\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && bb[k][l]; k++, l++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = j; k < 5-abs(2-i) && bb[i][k]; k++) {\n\t\t\t\tbb[i][k] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\t\t}\n\n\treturn r[mask] = 0;\n}\n\nint main() {\n\tint i, mask = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100];\n\t\tgets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tmask |= (1 << j);\n\t\t\tif (*t == 'O' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(mask))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 20];\n\nint masksn = 0, masks[200];\n\nint go(int m) {\n\tif (r[m] != -1)\n\t\treturn r[m];\n\n\tint i;\n\tfor (i = 0; i < masksn; i++)\n\t\tif (m & masks[i] == masks[i])\n\t\t\tif (!go(m & ~masks[i]))\n\t\t\t\t\treturn r[m] = 1;\n\n\treturn r[m] = 0;\n}\n\nint main() {\n\tint i, m = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100]; gets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tm |= (1 << j);\n\t\t\tif (*t == 'O' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tint k, l, m = 0;\n\t\t\tfor (k = i, l = j; k < 5 && 0 <= l && l < 5-abs(2-k); k++) {\n\t\t\t\tmasks[masksn++] = m;\n\t\t\t\tif (k >= 2)\n\t\t\t\t\tl--;\n\t\t\t}\n\n\t\t\tm = 0;\n\t\t\tfor (k = i, l = j; k < 5 && l <= 5-abs(2-k); k++) {\n\t\t\t\tmasks[masksn++] = m;\n\t\t\t\tif (k < 2)\n\t\t\t\t\tl++;\n\t\t\t}\n\n\t\t\tm = 0;\n\t\t\tfor (k = j; k < 5-abs(2-i); k++) {\n\t\t\t\tmasks[masksn++] = m;\n\t\t\t}\n\t\t}\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(m))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 19];\n\nint box2mask(char b[5][5]) {\n\tint mask = 0, i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (b[i][j])\n\t\t\t\tmask |= 1 << k;\n\t\t\tk++;\n\t\t}\n\n\treturn mask;\n}\n\nint go(int mask) {\n\tif (r[mask] != -1)\n\t\treturn r[mask];\n\n\tchar b[5][5];\n\tmemset(b, 0, sizeof(b));\n\n\tint i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (mask & (1 << k))\n\t\t\t\tb[i][j] = 1;\n\t\t\tk++;\n\t\t}\n\n\tchar bb[5][5];\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = i; k < 5 && j < 5-abs(2-k) && bb[k][j]; k++) {\n\t\t\t\tbb[k][j] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tint l;\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && bb[k][l]; k++, l++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = j; k < 5-abs(2-i) && bb[i][k]; k++) {\n\t\t\t\tbb[i][k] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\t\t}\n\n\treturn r[mask] = 0;\n}\n\nint main() {\n\tint i, mask = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100];\n\t\tgets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tmask |= (1 << j);\n\t\t\tif (*t == '0' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(mask))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar r[1 << 20];\n\nint box2mask(char b[5][5]) {\n\tint mask = 0, i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (b[i][j])\n\t\t\t\tmask |= 1 << k;\n\t\t\tk++;\n\t\t}\n\n\treturn mask;\n}\n\nint go(int mask) {\n\tif (r[mask] != -1)\n\t\treturn r[mask];\n\n\tchar b[5][5];\n\tmemset(b, 0, sizeof(b));\n\n\tint i, j, k = 0;\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tif (mask & (1 << k))\n\t\t\t\tb[i][j] = 1;\n\t\t\tk++;\n\t\t}\n\n\tchar bb[5][5];\n\tfor (i = 0; i < 5; i++)\n\t\tfor (j = 0; j < 5-abs(2-i); j++) {\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = i; k < 5 && j < 5-abs(2-k) && bb[k][j]; k++) {\n\t\t\t\tbb[k][j] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tint l;\n\t\t\tfor (k = i, l = j; k < 5 && l < 5-abs(2-k) && bb[k][l]; k++, l++) {\n\t\t\t\tbb[k][l] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\n\t\t\tmemcpy(bb, b, sizeof(bb));\n\t\t\tfor (k = j; k < 5-abs(2-i) && bb[i][k]; k++) {\n\t\t\t\tbb[i][k] = 0;\n\t\t\t\tif (!go(box2mask(bb)))\n\t\t\t\t\treturn r[mask] = 1;\n\t\t\t}\n\t\t}\n\n\treturn r[mask] = 0;\n}\n\nint main() {\n\tint i, mask = 0, j = 0;\n\tfor (i = 0; i < 5; i++) {\n\t\tchar s[100];\n\t\tgets(s);\n\n\t\tchar *t = s;\n\t\twhile (*t != '\\0') {\n\t\t\tif (*t == 'O')\n\t\t\t\tmask |= (1 << j);\n\t\t\tif (*t == 'O' || *t == '.')\n\t\t\t\tj++;\n\t\t\tt++;\n\t\t}\n\n\t}\n\t\n\tif (j != 19)\n\t\texit(1);\n\n\tmemset(r, -1, sizeof(r));\n\n\tif (go(mask))\n\t\tputs(\"Karlsson\");\n\telse\n\t\tputs(\"Lillebror\");\n\n\treturn 0;\n}\n"}], "src_uid": "eaa022cc7846c983a826900dc6dd919f"} {"nl": {"description": "One day Polycarpus got hold of two non-empty strings s and t, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of \"x y\" are there, such that x is a substring of string s, y is a subsequence of string t, and the content of x and y is the same. Two pairs are considered different, if they contain different substrings of string s or different subsequences of string t. Read the whole statement to understand the definition of different substrings and subsequences.The length of string s is the number of characters in it. If we denote the length of the 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 or \"codeforces\", while \"coders\" is not. Two substrings s[a... b] and s[c... d] are considered to be different if a\u2009\u2260\u2009c or b\u2009\u2260\u2009d. For example, if s=\"codeforces\", s[2...2] and s[6...6] are different, though their content is the same.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\". Two subsequences u\u2009=\u2009s[p1p2... p|u|] and v\u2009=\u2009s[q1q2... q|v|] are considered different if the sequences p and q are different.", "input_spec": "The input consists of two lines. The first of them contains s (1\u2009\u2264\u2009|s|\u2009\u2264\u20095000), and the second one contains t (1\u2009\u2264\u2009|t|\u2009\u2264\u20095000). Both strings consist of lowercase Latin letters.", "output_spec": "Print a single number \u2014 the number of different pairs \"x y\" such that x is a substring of string s, y is a subsequence of string t, and the content of x and y is the same. As the answer can be rather large, print it modulo 1000000007 (109\u2009+\u20097).", "sample_inputs": ["aa\naa", "codeforces\nforceofcode"], "sample_outputs": ["5", "60"], "notes": "NoteLet's write down all pairs \"x y\" that form the answer in the first sample: \"s[1...1] t[1]\", \"s[2...2] t[1]\", \"s[1...1] t[2]\",\"s[2...2] t[2]\", \"s[1...2] t[1\u00a02]\"."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nint dp[5000];\n\nint main()\n{\n int n1, n2, m = 1000000007, i, j;\n long long sum = 0;\n char s[5001], t[5001];\n\n scanf(\"%s\", s);\n scanf(\"%s\", t);\n\n n1 = strlen(s);\n n2 = strlen(t);\n\n for (i = 0; i < n2; i++) {\n\t for (j = n1 - 1; j >= 0; j--) {\n\t if (t[i] == s[j]) {\n\t\t dp[j] = (dp[j] + 1) % m;\n\n\t\t if (j > 0) dp[j] = (dp[j] + dp[j - 1]) % m;\n\t }\n\t }\n }\n\n for (i = 0; i < n1; i++) sum = (sum + dp[i]) % m;\n\n printf(\"%d\\n\", (int)sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MAX 5010\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nchar S[MAX], T[MAX];\nshort next[MAX][MAX];\nbool visited[MAX][MAX];\nint n, m, dp[MAX][MAX];\n\nint F(int i, int j){\n if (i >= n || j >= m) return 0;\n if (visited[i][j]) return dp[i][j];\n\n unsigned int res = 0;\n if (next[i][j] != -1){\n res = res + F(i + 1, next[i][j] + 1) + 1;\n if (res >= MOD) res -= MOD;\n res = res + F(i, next[i][j] + 1);\n if (res >= MOD) res -= MOD;\n }\n\n visited[i][j] = true;\n return (dp[i][j] = res);\n}\n\nint main(){\n int i, j, k;\n\n while (scanf(\"%s %s\", S, T) != EOF){\n clr(visited);\n n = strlen(S), m = strlen(T);\n for (i = 0; i < n; i++){\n for (j = m - 1; j >= 0; j--){\n next[i][j] = -1;\n if (S[i] == T[j]) next[i][j] = j;\n else if ((j + 1) != m) next[i][j] = next[i][j + 1];\n }\n }\n\n long long res = 0;\n for (i = 0; i < n; i++){\n for (j = 0; j < m; j++){\n if (S[i] == T[j]){\n res = res + F(i + 1, j + 1) + 1;\n }\n }\n }\n printf(\"%lld\\n\", res % MOD);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint dp[5000];\n\nint main()\n{\n int n1, n2, m = 1000000007, i, j;\n long long sum = 0;\n char s[5001], t[5001];\n\n scanf(\"%s\", s);\n scanf(\"%s\", t);\n\n n1 = strlen(s);\n n2 = strlen(t);\n\n for (i = 0; i < n2; i++) {\n\t for (j = n1 - 1; j >= 0; j--) {\n\t if (t[i] == s[j]) {\n\t\t dp[j] = (dp[j] + 1) % m;\n\n\t\t if (j > 0) dp[j] = (dp[j] + dp[j - 1]) % m;\n\t }\n\t }\n }\n\n for (i = 0; i < n1; i++) sum = (sum + dp[i]) % m;\n\n printf(\"%d\\n\", (int)sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAXN 5000\n#define MAXL (MAXN+1)\n#define MOD 1000000007\n\nchar s[MAXL];\nchar t[MAXL];\n\nint dp[MAXN][MAXN];\n\nint main()\n{\n\twhile ( scanf(\"%s %s\", s, t) == 2)\n\t{\n\t\t//printf(\"%s\\n%s\\n\", s, t);\n\t\tint ls = strlen( s);\n\t\tint lt = strlen( t);\n\n\t\tint i, j;\n\t\tint ans = 0;\n\t\tfor ( i = 0; i < ls; i++)\n\t\t{\n\t\t\tfor ( j = 0; j < lt; j++)\n\t\t\t{\n\t\t\t\tdp[i][j] = s[i] == t[j];\n\t\t\t\tif ( dp[i][j] && i && j)\n\t\t\t\t{\n\t\t\t\t\tdp[i][j] += dp[i-1][j-1];\n\t\t\t\t}\n\n\t\t\t\tdp[i][j] %= MOD;\n\t\t\t\tans += dp[i][j];\n\t\t\t\tans %= MOD;\n\n\t\t\t\tdp[i][j] += j ? dp[i][j-1] : 0;\n\t\t\t\tdp[i][j] %= MOD;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\tfor ( i = 0; i < ls; i++)\n\t\t{\n\t\t\tfor ( j = 0; j < lt; j++)\n\t\t\t{\n\t\t\t\tprintf(\"%d \", dp[i][j]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\t*/\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nconst unsigned int mod = 1000000007;\nunsigned int DP[5001][5001];\nchar a[5001],b[5001];\n\nint main()\n{ \n gets(a);gets(b);\n int len1 = strlen(a),len2 = strlen(b),i,j;\n for(i=0;i<len1;++i){\n for(j=0;j<len2;++j){\n DP[i+1][j+1] = (DP[i+1][j] + ((a[i]==b[j])? (DP[i][j]+1) : 0))%mod; \n }\n }\n\n unsigned int ans = 0;\n for(i=1;i<=len1;++i){ \n ans+=DP[i][len2];\n ans %=mod;\n }\n printf(\"%d\",ans);\n\n //system(\"pause\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef long long ll;\n\n#define err(...) fprintf(stderr, __VA_ARGS__)\n\n#define N 5010\n#define MOD 1000000007\n\nvoid norm(ll *a) {\n if (*a >= MOD) *a -= MOD;\n if (*a < 0) *a += MOD;\n}\n\nint main() {\n static char s[N], t[N];\n scanf(\"%s %s\", s, t);\n int n = strlen(s), m = strlen(t);\n \n ll ans = 0;\n static ll dp[N][N];\n for (int i = 0; i <= (n > m ? n : m); ++i) {\n dp[0][i] = 1;\n dp[i][0] = 1;\n }\n for (int i = 1; i <= n; ++i) {\n for (int j = 1; j <= m; ++j) {\n dp[i][j] = dp[i][j - 1];\n if (s[i - 1] == t[j - 1]) {\n dp[i][j] += dp[i - 1][j - 1];\n norm(&dp[i][j]);\n }\n if (j == m) {\n ans += dp[i][j];\n norm(&ans);\n }\n }\n }\n ans = (ans + MOD - n) % MOD;\n\n printf(\"%lld\", ans);\n return 0;\n}\n\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAXN 5000\n#define MAXL (MAXN+1)\n#define MOD 1000000007\n\nchar s[MAXL];\nchar t[MAXL];\n\nint oct[MAXN][26];\nint dp[MAXN][MAXN];\n\nint main()\n{\n\twhile ( scanf(\"%s %s\", s, t) == 2)\n\t{\n\t\t//printf(\"%s\\n%s\\n\", s, t);\n\t\tint ls = strlen( s);\n\t\tint lt = strlen( t);\n\n\t\tint i, j;\n\t\tint ans = 0;\n\t\tmemset( oct[0], 0, sizeof( oct[0]));\n\t\t++oct[0][t[0]-'a'];\n\t\tfor ( i = 1; i < lt; i++)\n\t\t{\n\t\t\tfor ( j = 0; j < 26; j++)\n\t\t\t{\n\t\t\t\toct[i][j] = oct[i-1][j];\n\t\t\t}\n\t\t\t++oct[i][t[i]-'a'];\n\t\t}\n\n\t\tfor ( i = 0; i < ls; i++)\n\t\t{\n\t\t\tfor ( j = 0; j < lt; j++)\n\t\t\t{\n\t\t\t\tdp[i][j] = s[i] == t[j];\n\t\t\t\tif ( dp[i][j] && i && j)\n\t\t\t\t{\n\t\t\t\t\tdp[i][j] += dp[i-1][j-1];\n\t\t\t\t}\n\n\t\t\t\tans += dp[i][j];\n\t\t\t\tif ( ans >= MOD)\n\t\t\t\t{\n\t\t\t\t\tans -= MOD;\n\t\t\t\t}\n\t\t\t\tdp[i][j] += j ? dp[i][j-1] : 0;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\tfor ( i = 0; i < ls; i++)\n\t\t{\n\t\t\tfor ( j = 0; j < lt; j++)\n\t\t\t{\n\t\t\t\tprintf(\"%d \", dp[i][j]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\t*/\n\t\tprintf(\"%d\\n\", ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef long long ll;\n\n#define err(...) fprintf(stderr, __VA_ARGS__)\n\n#define N 5010\n#define MOD 1000000007\n\nvoid norm(ll *a) {\n if (*a >= MOD) *a -= MOD;\n if (*a < 0) *a += MOD;\n}\n\nint main() {\n static char s[N], t[N];\n scanf(\"%s %s\", s, t);\n int n = strlen(s), m = strlen(t);\n \n ll ans = 0;\n static ll dp[N][N];\n for (int i = 0; i <= n; ++i) {\n dp[0][i] = 1;\n dp[i][0] = 1;\n }\n for (int i = 1; i <= n; ++i) {\n for (int j = 1; j <= m; ++j) {\n dp[i][j] = dp[i][j - 1];\n if (s[i - 1] == t[j - 1]) {\n dp[i][j] += dp[i - 1][j - 1];\n norm(&dp[i][j]);\n }\n if (j == m) {\n ans += dp[i][j];\n norm(&ans);\n }\n }\n }\n ans = (ans + MOD - n) % MOD;\n\n printf(\"%lld\", ans);\n return 0;\n}\n\n"}], "src_uid": "4022f8f796d4f2b7e43a8360bf34e35f"} {"nl": {"description": "One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si \u2014 lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out all baloons to his friends. Help Kefa to find out, can he give out all his baloons, such that no one of his friens will be upset \u2014 print \u00abYES\u00bb, if he can, and \u00abNO\u00bb, otherwise. Note, that Kefa's friend will not upset, if he doesn't get baloons at all.", "input_spec": "The first line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009100) \u2014 the number of baloons and friends. Next line contains string s \u2014 colors of baloons.", "output_spec": "Answer to the task \u2014 \u00abYES\u00bb or \u00abNO\u00bb in a single line. You can choose the case (lower or upper) for each letter arbitrary.", "sample_inputs": ["4 2\naabb", "6 3\naacaab"], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first sample Kefa can give 1-st and 3-rd baloon to the first friend, and 2-nd and 4-th to the second.In the second sample Kefa needs to give to all his friends baloons of color a, but one baloon will stay, thats why answer is \u00abNO\u00bb."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint N,K;\nchar baloon[110];\nint chart[30];\nint friend[110][30];\n\nint sol(){\n\tint i,j,det=1,ball,ref=N;\n\n\tfor(i=0;i<N;i++){\n\t\tdet = 1;\n\t\tball = -1;\n\t\tfor(j=0;j<26;j++){\n\t\t\tif(chart[j]){\n\t\t\t\tchart[j]--;\n\t\t\t\tdet--;\n\t\t\t\tball = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(det) return 0;\n\n\t\tdet =1;\n\t\tfor(j=0;j<K;j++){\n\t\t\tif(friend[j][ball] == 0) {\n\t\t\t\tfriend[j][ball]++;\n\t\t\t\tdet--;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(det) return 0;\n\n\n\t}\n\n\treturn 1;\n}\n\nint main(){\n\t\n\tint i,ans,j;\n\tscanf(\"%d %d\",&N,&K);\n\n\tscanf(\"%s\",baloon);\t\n\t\n\tfor(i=0;i<N;i++){\n\t\tchart[baloon[i]-'a']++;\n\t}\n\tans = sol();\n\tif(ans) printf(\"YES\");\n\telse printf(\"NO\");\n\n\treturn 0;\n/*\n\tfor(i=0;i<26;i++){\n\t\tif(chart[i])\n\t\t\tprintf(\"%c : %d\\n\",'a'+i,chart[i]);\n\t}printf(\"\\n\");\n\t\t\n\n\tsort();\n\t\n\tfor(i=0;i<N;i++){\n\t\tprintf(\"%c\",baloon[i]);\n\t}printf(\"\\n\");\n*/\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k;char s[100000];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",&s);\n for(int i=0;i<n;i++)\n {\n \n int count=0;\n for(int j=i+1;j<n;j++)\n {\n if(s[i]==s[j]) count++;\n }\n if(count>=k) {printf(\"NO\");break;}\n if(i==(n-1)){printf(\"YES\");break;}\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,sum=0;\n scanf(\"%d%d\",&n,&x);\n char str[n+2];\n getchar();\n gets(str);\n char ara[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n int ara2[26];\n int i,j;\n for(i=0;i<26;i++)\n {\n ara2[i]=0;\n }\n for(i=0;str[i]!='\\0';i++)\n {\n for(j=0;j<26;j++)\n {\n if(str[i]==ara[j] || str[i]==(ara[j]-32))\n {\n ara2[j]++;\n }\n }\n }\n for(j=0;j<26;j++)\n {\n if(ara2[j]>x)\n continue;\n else\n {\n sum++;\n }\n }\n if(sum==26)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n, f;\n\n scanf(\"%d %d\", &n, &f);\n getchar();\n\n int c = 0, count[26] = {0}, boro = 0;\n char string[n+1];\n\n\n gets(string);\n\n while (string[c] != '\\0')\n {\n if (string[c] >= 'a' && string[c] <= 'z')\n count[string[c]-'a']++;\n c++;\n }\n\n for (c = 0; c < 26; c++)\n {\n if (count[c] > boro)\n {\n boro = count[c];\n }\n }\n\n if(boro > f)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,k,i,j=0;\n\tint ans = 1;\n\tscanf(\"%d%d\",&n,&k);\n\tchar s[n];\n\tint a[26] = {0};\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\ta[s[i]-'a']++;\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(a[i]>k)\n\t\tans=0;\n\t}\n\tif(ans == 0)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint b,p,i=0,j=0,m=0,x;\nchar q;\nchar pattern[100];\nint arr[26];\nint y;\nfor(y=0;y<26;y++)\n{\n arr[y]=0;\n}\nint k;\n\nscanf(\"%d %d\",&b,&p);\nscanf(\"%s\",pattern);\nx=strlen(pattern);\n\n\n\nwhile(pattern[i]!='\\0')\n{\n if(pattern[i]>='a' && pattern[i]<='z')\n {\n\n arr[pattern[i]-'a']++;\n\n\n\n }i++;\n\n\n}\n\n\nwhile(j<26){\n{if(arr[j]<=p)\n m++;\n else\n m=-1000;\n\n}\nj++;};\nif(m>0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,k,i;\n\tint mas[26];\n\tchar s;\n\tfor (i=0;i<=25;i++)\n\t\tmas[i]=0;\n\tscanf(\"%d %d\",&n,&k);\n\tscanf(\"%c\",&s);\n\tfor (i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&s);\n\t\tmas[s-'a']++;\n\t}\n\tfor (i=0;i<=25;i++)\n\t\tif (mas[i]>k)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX 101\n\n\nchar balls[MAX][MAX];\nint main (void)\n{\n\tint balloons, friends;\n\tscanf (\"%d %d\\n\", &balloons, &friends);\n\tint new_color;\n\tchar c;\n\tnew_color = 1;\n\tint i, j;\n\tfor (i = 0; i < friends; i++)\n\t\tballs[i][0] = '\\0';\n\twhile ((c = getchar()) != EOF)\n\t\tfor (i = 0; i < friends; i++){\n\t\t\tint j;\n\t\t\tfor (j = 0; balls[i][j] != '\\0'; j++)\n\t\t\t\tif (c == balls[i][j]){\n\t\t\t\t\tnew_color = 0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (new_color == 1){\n\t\t\t\tballs[i][j] = c;\n\t\t\t\tballs[i][j + 1] = '\\0';\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (i == friends - 1 && new_color == 0){\n\t\t\t\tputs(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tnew_color = 1;\n\t\t}\n\tputs(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,j,num,i;\n scanf(\"%d %d\",&n,&k);\n char s[n+1];\n scanf(\"%s\",&s);\n for(i=97;i<=122;i=i+1)\n {\n int count=0;\n j=0;\n while(s[j]!=0)\n {\n num=s[j];\n if(num==i)\n {\n count=count+1;\n }\n j=j+1;\n }\n if(count>k)\n {\n printf(\"NO\\n\");\n exit(0);\n }\n }\n printf(\"YES\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n char s[n];\n scanf(\"%s\",s);\n int flag=0;\n char alph[27]={0};\n for(int i=0;i<strlen(s);i++)\n {\n alph[abs(s[i]-97)]++;\n if(alph[abs(s[i]-97)]>k)\n {\n /* printf(\"%d\",alph[abs(s[i]-97)]);*/\n printf(\"NO\");\n flag=1;\n break;\n\n }\n\n }\n if(flag!=1)\n {\n printf(\"YES\");\n }\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint n, k;\n\tscanf(\"%d%d\",&n,&k);\n\tchar color[n+2];\n\tscanf(\"%s\",color);\n\tif(k>=n){\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tint a[26],i;\n\tfor(i=0; i<26; i++){\n\t\ta[i] = 0;\n\t}\n\tfor(i=0; i<n; i++){\n\t\ta[color[i] - 'a']++;\n\t}\n\tfor(i=0; i<26; i++){\n\t\tif(a[i] > k){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,j;\n scanf(\"%d %d\",&n,&k);\n char c='a',s[n+1],x;\n scanf(\"%c\",&x);\n gets(s);\n for(c='a'; c<='z'; c++)\n {\n j=0;\n for(int i=0; s[i];i++)\n\n {\n if(s[i]==c)\n {\n j++;\n if(j>k)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint arr[26];\nint main()\n{\n int n,k,h1,h2,i,j,c1=0,c2=0,s1=0;\n\n char s[101];\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n\n for ( i=0 ; i<strlen(s); i++)\n {\n arr[s[i]-'a']++;\n }\n if (n%2==0)\n{\n h1=n/2;\n\n}\nelse\n{\n h1=n/2;\n h2=(n/2)+1;\n s1=1;\n}\n\nfor ( i=0 ; i<k ; i++)\n{\n for(j=0 ; j<26 ; j++)\n {\n if (arr[j]>0)\n {\n arr[j]--;\n c1++;\n if (c1==h1 && s1 !=1)\n {\n c1=0;\n break;\n }\n else if (c1==h2 )\n {\n c1=0;\n s1=0;\n break;\n }\n\n }\n }\n}\n\nfor (i=0 ; i<26;i++)\n{\n if (arr[i]==0)\n c2++;\n}\nif ( c2==26)\n printf(\"YES\\n\");\nelse if (n==2 && s[0] !=s[1])\nprintf(\"YES\");\nelse\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n,k,i,j=0;\n\tchar a[105];\n\tint b[26]={0};\n\t\n\tscanf(\"%d %d\",&n,&k);\n\tscanf(\"%s\",a);\n\t\n\tif(n<k)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tb[a[i]-97]++;\n\t\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(b[i]>k)\n\t\t{\n\t\t\tj++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(j==0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t}\n\t\n\t\t\n\treturn 0;\n}\n\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n char* arr = (char*)malloc(sizeof(char)*n);\n // if(n<k){\n // printf(\"NO\");\n // return 0;\n // }\n int i=0,x=0,y=0;\n for (i=0;i<n;i++){\n scanf(\" %c\",&arr[i]);\n }\n int freq[26] ={0};\n for (i =0;i<n;i++){\n arr[i] = tolower(arr[i]);\n freq[(int)arr[i] - (int)'a']++;\n }\n for (i =0;i<26;i++){\n if(freq[i] > k) {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdbool.h>\n#include<math.h>\n#include<stdlib.h>\n\nint cmp(const void* a, const void* b)\n{\n\treturn (*(int*)a - *(int*)b);\n}\n\nint Max(int a, int b)\n{\n\treturn a > b ? a : b;\n}\n\n\nint main(void)\n{\n\tint i, j;\n\tint a[30] = { 0 };\n\tint n, k;\n\tint num = 0;\n\tchar x;\n\n\tscanf(\"%d %d\", &n, &k);\n\tgetchar();\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tx = getchar();\n\t\ta[x - 'a']++;\n\t}\n\tfor (i = 0; i < 30; i++)\n\t\tnum = Max(num, a[i]);\n\tif (num > k) printf(\"NO\");\n\telse printf(\"YES\");\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n\tint i,n,k,l,m,b[26]={0};\n\tchar s[105];\n\tscanf(\"%d%d\", &n, &k);\n\tscanf(\"%s\",s);\n\tfor(i=0; s[i] !='\\0'; i++)\n\t\tb[s[i]-'a']++;\n\tl=b[0];\n\tfor (i=1; i<26; i++)\n\t\tif (b[i] > l) l = b[i];\n\t\n\tif (l > k)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,c=0,max=0;\n scanf(\"%d%d\",&n,&k);\n char str[n];\n scanf(\"%s\",str);\n for(i='a';i<='z';i++)\n {\n for(j=0;str[j];j++)\n {\n if(i==str[j])\n c++;\n }\n if(c>max)\n max=c;\n c=0;\n }\n if(max<=k)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\tchar ar[n];\n\tscanf(\"%s\", ar);\n\tint charfreq[26], i;\n\tfor(i = 0; i < 26; i++)\n\t\tcharfreq[i] = 0;\n\tfor(i = 0; i < n; i++)\n\t\tcharfreq[ar[i] - 'a']++;\n\tfor(i = 0; i < 26; i++)\n\t\tif(charfreq[i] > k)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int N,k,i,g[26]={0},max=0;\n char str[101];\n scanf(\"%d%d\",&N,&k);\n for(i=0;i<=N;i++)\n scanf(\"%c\",&str[i]);\n for(i=0;i<=N;i++)\n {\n g[str[i]-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(g[i]>max)\n max=g[i];\n }\n if(max<=k)\n printf(\"yes\\n\");\n else\n printf(\"no\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,j;\n scanf(\"%d %d\",&n,&k);\n char c='a',s[n+1],x;\n scanf(\"%c\",&x);\n gets(s);\n for(c='a'; c<='z'; c++)\n {\n j=0;\n for(int i=0; s[i];i++)\n\n {\n if(s[i]==c)\n {\n j++;\n if(j>k)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i;\n int n, k;\n scanf(\"%d %d\", &n, &k);\n char str[1000];\n scanf(\"%s\", str);\n char cou[30];\n for(i=0;i<30;i++)\n cou[i]=0;\n for(i=0;i<n;i++)\n cou[str[i]-97]++;\n int cnt=0;\n for(i=0;i<30;i++)\n if(cou[i]>k){\n printf(\"NO\\n\");\n return 0;}\n printf(\"YES\\n\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n char arr[n+1];\n scanf(\"%s\",arr);\n int i;\n int brr[27];\n for(i=0;i<27;i++)\n brr[i]=0;\n for(i=0;i<n;i++)\n {\n brr[arr[i]-96]++; \n }\n int flag=0;\n for(i=0;i<27;i++)\n {\n if(brr[i]>k)\n {\n printf(\"NO\\n\");\n flag=1;\n break;\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, k, i;\n scanf(\"%d%d\", &n, &k);\n\n char str[101];\n scanf(\" %s\", str);\n\n int colors[26]={0};\n\n for(i=0; i<n; i++){\n colors[str[i]-'a']++;\n }\n\n for(i=0; i<26; i++){\n if(colors[i]>k){\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n, k, i, j, len, count, max = 0;\n scanf(\"%d%d\", &n, &k);\n char s[n + 1];\n scanf(\"%s\", s);\n len = strlen(s);\n\n for(i = 0; i < len; i++) {\n if(s[i] != '0') {\n for(j = i + 1, count = 1; j < len; j++) {\n if(s[j] != '0' && s[j] == s[i]) {\n count++;\n s[j] = '0';\n }\n }\n }\n if(count > max)\n max = count;\n }\n if(k < max)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,count,i=0,j=0;\n scanf(\"%d%d\",&n,&k);\n char s[110];\n scanf(\"%s\",&s);\n\n while(s[i]!='\\0')\n {\n count=1;\n j=i+1;\n while(s[j]!='\\0')\n {\n if(s[i]==s[j])\n count++;\n j++;\n }\n if(count>k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n i++;\n }\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tchar car;\n\tint n,k,count[30];\n\tscanf(\"%d %d\\n\",&n,&k);\n\n\tfor(int i = 0; i < 26; ++i) \n\t\tcount[i] = 0;\n\t\n\tfor(int i = 0; i < n; ++i){\n\t\tscanf(\"%c\",&car);\n\t\tcount[car-'a']++;\n\t}\n\n\tint exd = 0;\n\tfor(int i = 0; i < 26; ++i)\n\t\tif(count[i] > k) exd = 1;\n\t\n\tif(exd) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,i,ascii[123];\n for(i=65;i<123;i++)ascii[i]=0;\n char bal[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",bal);\n for(i=0;i<n;i++)ascii[bal[i]]++;\n for(i=65;i<=122;i++)\n {\n if(ascii[i]>k)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include<stdlib.h>\nint main()\n{\n char s[101];\n int i,n,k,len,x=0;\n int f[27];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n len = strlen(s);\n for(i=0; i<27; i++)\n {\n f[i]= 0;\n }\n for(i=0; i<len; i++)\n {\n f[s[i] - 'a']++;\n }\n for(i=0;i<27; i++)\n {\n if(f[i]!= 0)\n {\n if(f[i]>k){\n x=1;\n break;\n }\n }\n }\n if(x==1)\n printf(\"NO\\n\");\n else if(x==0)\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,i,ascii[123];\n for(i=65;i<123;i++)ascii[i]=0;\n char bal[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",bal);\n for(i=0;i<n;i++)ascii[bal[i]]++;\n for(i=65;i<=122;i++)\n {\n if(ascii[i]>k)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint\tbaloes, amigos;\n\tchar cores[101];\n\tint frequencia[30];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\n\tfgets(cores, 100, stdin);\n\n\tfor (int i = 0; i < 30; ++i)\n\t{\n\t\tfrequencia[i] = 0;\n\t}\n\n\tint c;\n\n\tfor (int i = 0; i < baloes; ++i){\n\n\t\tc = (int)getchar();\n\n\t\tfrequencia[c%97]++;\n\n\t\tif (frequencia[c%97] > amigos)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\tprintf(\"YES\\n\");\n\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\nint main()\n{\n int i,j ,n,k,flag=1;\n\n scanf(\"%i %i\",&n,&k);\n char *s=malloc(n*sizeof(char));\n scanf(\"%s\",s);\n int count[26]={0};\n for(i=0;s[i]!='\\0';i++)\n {\n count[s[i]-'a']++;\n\n }\n for(i=0;i<26;i++)\n {\n if(count[i]>k)\n {printf(\"NO\\n\");\n flag=0;\n break;}\n }\n if(flag==1)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int i,j,k,l,m,n,count=0,count1=0;\n char a[150];\n scanf(\"%d %d\",&n,&m);\n getchar();\n gets(a);\n for(i=97;i<124;i++){\n for(j=0;j<n;j++){\n if(a[j]==i){\n count++;\n }\n }\n if(count>m){\n count1++;\n break;\n }\n else{\n count=0;\n }\n }\n if(count1==0){\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,max = 0,c = 0;;\n char s[101],t[10] = \"\";\n scanf(\"%d%d%s\",&n,&k,s);\n for(i = 0; i < n; i++)\n {\n for(j = 0; j < n; j++)\n {\n if(s[i] < s[j])\n {\n t[0] = s[i];\n s[i] = s[j];\n s[j] = t[0];\n\n }\n }\n }\n for(i = 0; i < n-1; i++)\n {\n if(s[i] == s[i+1])\n {\n c++;\n if(max < c)\n {\n max = c;\n // c = 0;\n }\n }\n else\n {\n\n c = 0;\n }\n }\n //puts(s);\n max++;\n //printf(\"%d\",max);\n if(max > k)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,mx=0,c[27]= {0};\n char a[101];\n scanf(\"%d%d\",&n,&m);\n scanf(\"%s\",a);\n for(i=0; i<n; i++)\n {\n c[a[i]-97]++;\n if(c[a[i]-97]>mx)\n mx=c[a[i]-97];\n }\n if(mx>m)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<math.h>\n#define ll long long int\n\nint main()\n{\n int n,k,a[26],i,max=0;\n char s[1001];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<26;i++)\n a[i]=0;\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n char c=s[i];\n a[c-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>max)\n max=a[i];\n }\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n, k, i, j, len, count, max = 0;\n scanf(\"%d%d\", &n, &k);\n char s[n + 1];\n scanf(\"%s\", s);\n len = strlen(s);\n\n for(i = 0; i < len; i++) {\n if(s[i] != '0') {\n for(j = i + 1, count = 1; j < len; j++) {\n if(s[j] != '0' && s[j] == s[i]) {\n count++;\n s[j] = '0';\n }\n }\n }\n if(count > max)\n max = count;\n }\n if(k < max)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, k;\n scanf(\"%i%i\\n\", &n, &k);\n char current_character;\n int q[30];\n for (int i = 0; i < 30; i++)\n q[i] = 0;\n for (int i = 0; i < n; i++) {\n scanf(\"%c\", ¤t_character);\n q[current_character - 'a']++;\n }\n int maximal_letter_count = 0;\n for (int i = 0; i < 30; i++)\n if (q[i] > maximal_letter_count)\n maximal_letter_count = q[i];\n printf(maximal_letter_count > k ? \"NO\" : \"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint b,p,i=0,j=0,m=0,x;\nchar q;\nchar pattern[100];\nint arr[26];\nint y;\nfor(y=0;y<26;y++)\n{\n arr[y]=0;\n}\nint k;\n\nscanf(\"%d %d\",&b,&p);\nscanf(\"%s\",pattern);\nx=strlen(pattern);\n\n\n\nwhile(pattern[i]!='\\0')\n{\n if(pattern[i]>='a' && pattern[i]<='z')\n {\n\n arr[pattern[i]-'a']++;\n\n\n\n }i++;\n\n\n}\n\n\nwhile(j<26){\n{if(arr[j]<=p)\n m++;\n else\n m=-1000;\n\n}\nj++;};\nif(m>0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n int ch[500000],cp[500000];\n char kh[1000000],arr[1000000];\n int a=0,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;\n\n scanf(\"%d%d%s\",&a,&b,kh);\n k=0;\n for(i=0; i<a-1; i++)\n {\n l=1;\n for(j=i+1; j<a; j++)\n {\n if(kh[i]==kh[j])\n l++;\n if(k<l)\n k=l;\n }\n }\n printf(k<=b?\"YES\\n\":\"NO\\n\");\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nconst char M = 102;\nconst char A = 26;\nint main(){\n int n,k,i;\n char s[M],a[A],ans=1;\n for (i=0;i<A;i++)\n a[i]=0;\n scanf(\"%i%i%100s\",&n,&k,s);\n for(i=0;i<n;i++){\n a[s[i]-'a']++;\n }\n for(i=0;i<A;i++){\n if(a[i]>k)\n ans = 0;\n }\n if(ans)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n return 0-0-0;\n}"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,count = 0, temp,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t{\n\t\tif (ch[i] > max1)\n\t\t{\n\t\t\tmax2 = max1;\n\t\t\tmax1 = ch[i];\n\t\t}\n\t\telse if (ch[i] > max2)\n\t\t\tmax2 = ch[i];\n\t}\n\tif (max2 == 0)\n\t{\n\t\tif (max1 <= k)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\ttemp = k - max2;\n\t\tif (temp < 0)\n\t\t\tprintf(\"NO\");\n\t\telse if (temp == 0)\n\t\t{\n\t\t\tif (max2 == max1)\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif (ch[i] != 0)\n\t\t\t\t{\n\t\t\t\t\tch[i] -= max2;\n\t\t\t\t\tif (ch[i] > temp)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"YES\");\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char b[1000],a[1000];\n int i,j,n,k,c=0;\n scanf(\"%d %d\",&n,&k);\n gets(b);\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n for(j=0;j<i;j++)\n {\n if(a[i]==a[j])\n {\n break;\n }\n }\n if(j==i)\n {\n for(;j<n;j++)\n {\n if(a[i]==a[j])\n {\n c++;\n }\n }\n }\n if(c>k)\n {\n printf(\"NO\");\n break;\n }\n c=0;\n }\n if(i==n&&c<=k)\n {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int con,il,ll,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;\n scanf(\"%d %d\",&ll,&con);\n char S[ll];\n scanf(\"%s\",S);\n for(il=0;il<ll;il++)\n {\n if(S[il]=='a')\n a++;\n if(S[il]=='b')\n b++;\n if(S[il]=='c')\n c++;\n if(S[il]=='d')\n d++;\n if(S[il]=='e')\n e++;\n if(S[il]=='f')\n f++;\n if(S[il]=='g')\n g++;\n if(S[il]=='h')\n h++;\n if(S[il]=='i')\n i++;\n if(S[il]=='j')\n j++;\n if(S[il]=='k')\n k++;\n if(S[il]=='l')\n l++;\n if(S[il]=='m')\n m++;\n if(S[il]=='n')\n n++;\n if(S[il]=='o')\n o++;\n if(S[il]=='p')\n p++;\n if(S[il]=='q')\n q++;\n if(S[il]=='r')\n r++;\n if(S[il]=='s')\n s++;\n if(S[il]=='t')\n t++;\n if(S[il]=='u')\n u++;\n if(S[il]=='v')\n v++;\n if(S[il]=='w')\n w++;\n if(S[il]=='x')\n x++;\n if(S[il]=='y')\n y++;\n if(S[il]=='z')\n z++;\n }\n if(a>con||b>con||c>con||d>con||e>con||f>con||g>con||h>con||i>con||j>con||k>con||l>con||m>con||n>con||o>con||p>con||q>con||r>con||s>con||t>con||u>con||v>con||w>con||x>con||y>con||z>con)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint baloes, amigos, tabela[26] = {0}, i = 0;\n\tchar cor[10000];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\tscanf(\"%s\", cor);\n\twhile(cor[i] != '\\0') {\n\t\ttabela[cor[i] - 97]++;\n\t\tif(tabela[cor[i] - 97] > amigos) {\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n/* 1506616595709 */\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int i,j,baloon, friends,lable[26];\n char baloons[100];\n\n for(i=0;i<26;i++) lable[i]=0;\n\n scanf(\"%d %d\",&baloon,&friends);\n scanf(\" \");\n gets(baloons);\n\n for(i=0;i<baloon;i++) lable[baloons[i]-'a']++;\n\n for(i=0;i<26;i++){\n if(lable[i]>friends){\n printf(\"NO\");\n return 0;\n }\n }\n\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,j,c[27]={0},i,f=0;\n char s[1000];\n scanf(\"%d %d %s\",&n,&k,s);\n for(i=0;i<strlen(s);i++)\n {\n c[s[i]-'a']++;\n }\n for(i=0;i<27;i++)\n {\n if(c[i]>k)\n f++;\n }\n\n\n if(f>0)\n printf(\"NO\");\n else printf(\"YES\");\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int n,k,f[26]={}; char s[101],x=1;\n scanf(\"%d%d%s\",&n,&k,s);\n for (int i=0;x&&i<n;i++) {\n f[s[i]-'a']++;\n if (f[s[i]-'a']>k) x=0;\n }\n printf(\"%s\\n\",x?\"YES\":\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint n,\n\t\tk;\n\tchar c;\n\tint* count = (int*)calloc(26, sizeof(int));\n\n\tscanf(\" %d %d\", &n, &k);\n\n\twhile (n-- > 0) {\n\t\tscanf(\" %c\", &c);\n\n\t\tcount[c - 'a']++;\n\n\t\tif (count[c - 'a'] > k) {\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprintf(\"YES\");\n\n\treturn 0;\n}\n/* 1506029843161 */\n"}, {"source_code": "/* Problem: 841A - Generous Kefa */\n/* Author: Gusztav Szmolik */\n\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main ()\n {\n unsigned short n;\n unsigned short k;\n unsigned char s[101];\n unsigned short i;\n unsigned short h[26];\n unsigned short ups;\n unsigned char c;\n unsigned short j;\n\n if (scanf(\"%hu %hu\",&n,&k) != 2)\n return -1;\n if (n < 1 || n > 100 || k < 1 || k > 100)\n return -1;\n if (scanf(\"%100s\",s) != 1)\n return -1;\n if (strlen(s) < n)\n return -1;\n for (i = 0; i < 26; i++)\n h[i] = 0;\n ups = 0;\n for (i = 0; i < n; i++)\n {\n c = s[i];\n if (!islower(c))\n return -1;\n if (!ups)\n {\n j = c-'a';\n h[j]++;\n if (h[j] > k)\n ups = 1;\n }\n }\n printf ((ups) ? \"NO\\n\" : \"YES\\n\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int freq[256];\n for(int i=0;i<256;i++)\n {\n freq[i]=0;\n }\n for(int i=0;i<n;i++)\n {\n char ch;\n int ascii;\n scanf(\" %c\",&ch);\n ascii=(int)ch;\n freq[ascii]++;\n }\n int max=0;\n for(int j=0;j<256;j++)\n {\n if(freq[j]>max)\n max=freq[j];\n }\n if(max>k)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint blln, frnd, cnt = 1;\n\tchar tmp;\n\tscanf(\"%d %d\", &blln, &frnd);\n\tchar *col = (char *)malloc(sizeof(char) * (blln+30));\n\tscanf(\"%s\", col);\t\n\n\tfor (int i = 0; i < blln -1 ; i++) {\n\t\tfor (int j = i + 1; j < blln; j++) {\n\t\t\tif (col[i] > col[j]) {\n\t\t\t\ttmp = col[i];\n\t\t\t\tcol[i] = col[j];\n\t\t\t\tcol[j] = tmp;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0; i < blln; i++) {\n\t\tif (col[i] == col[i + 1]) {\n\t\t\t++cnt;\n\t\t\tif (cnt > frnd) {\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tfree(col);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tcnt = 1;\n\t\t}\n\t}\n\tprintf(\"YES\");\n\n\tfree(col);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0,tem,min=100000000;\n char s[1000];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i+1;j<strlen(s);j++)\n {\n if(s[i]>s[j])\n {\n tem=s[i];\n s[i]=s[j];\n s[j]=tem;\n }\n }\n\n }\n\n\n count=1;\n for(i=0;i<strlen(s)-1;i++)\n {\n if(s[i]!=s[i+1])\n {\n count++;\n } \n }\n\n \n int symbolcount[count];\n for(int i=0;i<count;i++)\n {\n symbolcount[i]=1;\n }\n for(int i=0,j=0;i<count && j<strlen(s)-1;j++)\n {\n if(s[j]==s[j+1]) symbolcount[i]++;\n else i++;\n }\n for(int i=0;i<count;i++)\n {\n if(k<symbolcount[i])\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n}\n \n"}, {"source_code": "#include<stdio.h>\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[10000];\n int i,n,k,count[1000],flag;\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n flag=0;\n for(i=0;i<26;i++){\n if(count[i]>k){\n flag=1;\n }\n }\n if(flag==1)\n printf(\"NO\\n\");\n else printf(\"YES\\n\");\n return 0;\n}\n\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,count = 0, temp,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t{\n\t\tif (ch[i] > max1)\n\t\t{\n\t\t\tmax2 = max1;\n\t\t\tmax1 = ch[i];\n\t\t}\n\t\telse if (ch[i] > max2)\n\t\t\tmax2 = ch[i];\n\t}\n\tif (max2 == 0)\n\t{\n\t\tif (max1 <= k)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\ttemp = k - max2;\n\t\tif (temp < 0)\n\t\t\tprintf(\"NO\");\n\t\telse if (temp == 0)\n\t\t{\n\t\t\tif (max2 == max1)\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif (ch[i] != 0)\n\t\t\t\t{\n\t\t\t\t\tch[i] -= max2;\n\t\t\t\t\tif (ch[i] > temp)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"YES\");\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint arr[26];\n\nint main()\n{\n int n, k, i;\n char str[101];\n scanf(\"%d %d %s\", &n, &k, str);\n\n for(i=0; i<n; i++)\n arr[str[i]-'a']++;\n\n for(i=0; i<26; i++){\n if(arr[i] > k){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int fre[256];\n int n,k,i,j,l,m,c,max;\n scanf(\"%d %d\",&n,&k);\n c=0;\n max=0;\n char str[n+1];\n scanf(\"%s\",str);\n l=strlen(str);\n for(m=0;m<256;m++){\n fre[m]=0;\n }\n for(j=0;j<l;j++){\n fre[str[j]]++;\n }\n for(i=0;i<256;i++){\n if(fre[i]!=0){\n if(fre[i]>fre[max]){\n max=i;\n }\n }\n }\n if(fre[max]<=k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint alph[26];\nchar ballon[101];\nint main(void)\n{\n\tint n, k, cnt = 0, a;\n\tscanf(\"%d %d\", &n, &k);\n\tscanf(\"%s\", ballon);\n\tfor (a = 0; a < n; a = a + 1)\n\t{\n\t\talph[ballon[a] - 'a']++;\n\t}\n\n\tfor (a = 0; a < 26; a = a + 1)\n\t{\n\t\tif (alph[a])\n\t\t{\n\t\t\tcnt++;\n\t\t\tif (alph[a] > k)\n\t\t\t{\n\t\t\t\tputs(\"NO\");\n\t\t\t\tcnt = -1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (cnt != -1)\n\t\tputs(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n,k,i,j=0;\n\tchar a[105];\n\tint b[26]={0};\n\t\n\tscanf(\"%d %d\",&n,&k);\n\tscanf(\"%s\",a);\n\t\n\tif(n<k)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tb[a[i]-97]++;\n\t\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(b[i]>k)\n\t\t{\n\t\t\tj++;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(j==0)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t}\n\t\n\t\t\n\treturn 0;\n}\n\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint arr[100];\nint main()\n{\n int n,k,i;\n char s[150];\n scanf(\"%d%d\",&n,&k);\n getchar();\n gets(s);\n int d=1;\n for(i=0; i<n; i++)\n {\n int c=s[i]-'a';\n arr[c]++;\n if(arr[c]>k)\n {\n printf(\"NO\\n\");\n d=0;\n break;\n }\n }\n if(d==1)\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "/* Problem: 841A - Generous Kefa */\n/* Author: Gusztav Szmolik */\n\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main ()\n {\n unsigned short n;\n unsigned short k;\n unsigned char s[101];\n unsigned short i;\n unsigned short h[26];\n unsigned short ups;\n unsigned char c;\n unsigned short j;\n\n if (scanf(\"%hu %hu\",&n,&k) != 2)\n return -1;\n if (n < 1 || n > 100 || k < 1 || k > 100)\n return -1;\n if (scanf(\"%100s\",s) != 1)\n return -1;\n if (strlen(s) < n)\n return -1;\n for (i = 0; i < 26; i++)\n h[i] = 0;\n ups = 0;\n for (i = 0; i < n; i++)\n {\n c = s[i];\n if (!islower(c))\n return -1;\n if (!ups)\n {\n j = c-'a';\n h[j]++;\n if (h[j] > k)\n ups = 1;\n }\n }\n printf ((ups) ? \"NO\\n\" : \"YES\\n\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint\tbaloes, amigos;\n\tchar cores[101];\n\tint frequencia[30];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\n\tfgets(cores, 100, stdin);\n\n\tfor (int i = 0; i < 30; ++i)\n\t{\n\t\tfrequencia[i] = 0;\n\t}\n\n\tint c;\n\n\tfor (int i = 0; i < baloes; ++i){\n\n\t\tc = (int)getchar();\n\n\t\tfrequencia[c%97]++;\n\n\t\tif (frequencia[c%97] > amigos)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\tprintf(\"YES\\n\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,k,i,j=0;\n\tint ans = 1;\n\tscanf(\"%d%d\",&n,&k);\n\tchar s[n];\n\tint a[26] = {0};\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\ta[s[i]-'a']++;\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(a[i]>k)\n\t\tans=0;\n\t}\n\tif(ans == 0)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,k,s,i,max;\n\tchar str[1000];\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF)\n\t{\n\t\tint a[26]={0};\n\t\tmax=0;\n\t\tgetchar();\n\t\tgets(str);\n\t\ts=strlen(str);\n\t\tfor(i=0;i<s;i++)\n a[str[i]-'a']++;\n for(i=0;i<26;i++)\n max=(max>a[i])?max:a[i];\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n int ch[500000],cp[500000];\n char kh[1000000],arr[1000000];\n int a=0,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;\n\n scanf(\"%d%d%s\",&a,&b,kh);\n k=0;\n for(i=0; i<a-1; i++)\n {\n l=1;\n for(j=i+1; j<a; j++)\n {\n if(kh[i]==kh[j])\n l++;\n if(k<l)\n k=l;\n }\n }\n printf(k<=b?\"YES\\n\":\"NO\\n\");\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define MAX 26\n#define SIZE 107\n\nint main()\n{\n\tint n, k, a[MAX], i, flag = 0;\n\tchar str[SIZE];\n\tfor(i=0;i<MAX;++i)\n\t{\n\t\ta[i] = 0;\n\t}\n\tscanf(\"%d %d\", &n, &k);\n\tscanf(\"%s\", str);\n\tfor(i=0;i<n;++i)\n\t{\n\t\t++a[str[i] - 'a'];\n\t}\n\tfor(i=0;i<MAX;++i)\n\t{\n\t\tif(a[i] > k)\n\t\t{\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint arr[26];\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint i,j,flag=0;\n\tchar c;\n\tgetchar();\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&c);\n\t\tif(c>='a'&&c<='z')\n\t\t{\n\t\t\tarr[c-'a']++;\n\t\t\tif(arr[c-'a']>k)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(c>='A'&&c<='Z')\n\t\t{\n\t\t\tarr[c-'A']++;\n\t\t\tif(arr[c-'A']>k)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint cf(void const *a, void const *b)\n{\n\treturn (*(int*)a) - (*(int*)b);\n}\nint main()\n{\n\tint n, k, i, x=0, a[101], c=1, y=0;\n\tchar s[101];\n\t\n\tscanf(\"%d %d %s\", &n, &k, s);\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\ta[i]=s[i]-'0';\n\t}\n\tqsort(a, n, 4, cf);\n\t\n\tfor(int h=0; h<n-1; h++)\n\t{\n\t\tif(a[h]==a[h+1])\n\t\t{\n\t\t\tc++;\n\t\t\ty=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(c>=x){\n\t\t\t\tx=c;\n\t\t\t}\n\t\t\tc=1;\n\t\t\ty=0;\n\t\t}\n\t}\n\tif(y==1 && c>=x){\n\t\tx=c;\n\t}\n\tif(x<=k || n<=k){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0,m,l,z[100]={0},count=0;\n char x[100],y[100],ch;\n scanf(\"%d %d\",&n,&l);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n ch=x[i];\n y[0]=ch;\n k=1;\n for(j=i+1;j<n;j++)\n {\n if(x[j]!='0')\n {\n for(m=0;m<k;m++)\n {\n if(x[j]==y[m])\n {\n break;\n }\n }\n if(m==k)\n {\n x[i]='0';\n y[k]=x[j];\n x[j]='0';\n k++;\n }\n }\n }\n if(k>1)\n {\n count++;\n }\n }\n }\n k=0;\n\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n k++;\n }\n }\n if((count+k)<=l)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[109];\nchar s[109],ch;\n\nint main()\n{\n int t,n,b,c=0,i,j,max=0;\n\n scanf(\"%d%d\",&t,&n);\n scanf(\"%s\",s);\n for(i=0;i<t;i++)\n {\n if(s[i]>=97&&s[i]<=122);\n a[s[i]-97]++;\n }\n\n for(j=0;j<26;j++)\n {\n if(a[j]>0&&a[j]>max)c=a[j];\n if(c>max)max=c;\n }\n if(max>n){printf(\"NO\");return 0;}\n else printf(\"YES\");return 0;\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t\tif (ch[i] > max1)\n\t\t\tmax1 = ch[i];\n\tif (max1 <= k)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint arr[26];\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint i,j,flag=0;\n\tchar c;\n\tgetchar();\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&c);\n\t\tif(c>='a'&&c<='z')\n\t\t{\n\t\t\tarr[c-'a']++;\n\t\t\tif(arr[c-'a']>k)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(c>='A'&&c<='Z')\n\t\t{\n\t\t\tarr[c-'A']++;\n\t\t\tif(arr[c-'A']>k)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag)\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,k,s,i,max;\n\tchar str[1000];\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF)\n\t{\n\t\tint a[26]={0};\n\t\tmax=0;\n\t\tgetchar();\n\t\tgets(str);\n\t\ts=strlen(str);\n\t\tfor(i=0;i<s;i++)\n a[str[i]-'a']++;\n for(i=0;i<26;i++)\n max=(max>a[i])?max:a[i];\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,m=0,n,k,freq[26]={0};\n scanf(\"%d %d\",&n,&k);\n int pos[n];\n char string[n+2];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n if(!freq[string[i]-97])\n {\n pos[m]=string[i]-97;\n m++;\n }\n freq[string[i]-97]++;\n }\n for(i=0;i<m;i++)\n {\n if(freq[pos[i]]>k)\n {\n n=1;\n break;\n }\n else\n n=0;\n }\n if(n)\n printf(\"%s\\n\",\"NO\");\n else\n printf(\"%s\\n\",\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,max=0,count=0;\n scanf(\"%d%d\",&n,&k);\n //int ar[n]\n char s[n+1];\n s[n]='\\0';\n scanf(\"%s\",s);\n if(k>=n)\n printf(\"%s\",\"YES\");\n else\n {\n for(int i=0;i<n;i++)\n {\n if(s[i]!='0')\n {\n count=1;\n for(int j=i+1;j<n;j++)\n {\n if(s[i]==s[j])\n {\n count++;\n s[j]='0';\n }\n }\n if(count>max)\n max=count;\n }\n }\n if(max>k)\n printf(\"%s\",\"NO\");\n else\n printf(\"%s\",\"YES\");\n }\n \n //printf(\"%d\",max);\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\nint main()\n{\n int i,j ,n,k,flag=1;\n\n scanf(\"%i %i\",&n,&k);\n char *s=malloc(n*sizeof(char));\n scanf(\"%s\",s);\n int count[26]={0};\n for(i=0;s[i]!='\\0';i++)\n {\n count[s[i]-'a']++;\n\n }\n for(i=0;i<26;i++)\n {\n if(count[i]>k)\n {printf(\"NO\\n\");\n flag=0;\n break;}\n }\n if(flag==1)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint blln, frnd, cnt = 1;\n\tchar tmp;\n\tscanf(\"%d %d\", &blln, &frnd);\n\tchar *col = (char *)malloc(sizeof(char) * (blln+30));\n\tscanf(\"%s\", col);\t\n\n\tfor (int i = 0; i < blln -1 ; i++) {\n\t\tfor (int j = i + 1; j < blln; j++) {\n\t\t\tif (col[i] > col[j]) {\n\t\t\t\ttmp = col[i];\n\t\t\t\tcol[i] = col[j];\n\t\t\t\tcol[j] = tmp;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (int i = 0; i < blln; i++) {\n\t\tif (col[i] == col[i + 1]) {\n\t\t\t++cnt;\n\t\t\tif (cnt > frnd) {\n\t\t\t\tprintf(\"NO\");\n\t\t\t\tfree(col);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tcnt = 1;\n\t\t}\n\t}\n\tprintf(\"YES\");\n\n\tfree(col);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\n\nmain()\n{\n int T, r, i, x, b, n, k;\n long long fb;\n scanf(\"%d %d\", &n, &k);\n\n char a[n];\n int cnt[26];\n\n for(i = 0; i<26; i++)\n cnt[i] = 0;\n\n for(i = 0; i<n; i++)\n {\n scanf(\" %c\", &a[i]);\n cnt[a[i]-'a']++;\n }\n\n for(i = 0; i<26; i++)\n {\n if(cnt[i]>k)\n { printf(\"NO\");\n return 0;}\n }\n\n printf(\"YES\");\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint\tbaloes, amigos;\n\tchar cores[101];\n\tint frequencia[30];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\n\tfgets(cores, 100, stdin);\n\n\tfor (int i = 0; i < 30; ++i)\n\t{\n\t\tfrequencia[i] = 0;\n\t}\n\n\tint c;\n\n\tfor (int i = 0; i < baloes; ++i){\n\n\t\tc = (int)getchar();\n\n\t\tfrequencia[c%97]++;\n\n\t\tif (frequencia[c%97] > amigos)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\tprintf(\"YES\\n\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,i,ascii[123];\n for(i=65;i<123;i++)ascii[i]=0;\n char bal[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",bal);\n for(i=0;i<n;i++)ascii[bal[i]]++;\n for(i=65;i<=122;i++)\n {\n if(ascii[i]>k)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,d;\n scanf(\"%d %d\",&n,&k);\n char s[n];\n int a[26];\n for(i=0;i<26;i++)\n a[i]=0;\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n d=(int)(((int)s[i]-(int)97));\n a[d]++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main(void){\n\n int n,k;\n\n int alphab[26];\n char baloons[100];\n\n for(int i=0;i<26;i++){\n alphab[i]=0;\n }\n\n scanf(\"%d %d\", &n, &k);\n scanf(\"%s\", baloons);\n\n for(int i=0;i<n;i++){\n alphab[baloons[i]-'a']+=1;\n }\n\n for(int i=0;i<26;i++){\n if(alphab[i]>k){\n printf(\"NO\\n\");\n return 0;\n }\n }\n\n printf(\"YES\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,c=0,a=97,n,k,j;\n int max=0;\n\n scanf(\"%d%d\",&n,&k);\n char s[n];\n scanf(\"%s\",s);\n\n for(;a<='z';a++)\n {\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]==a)\n c++;\n if(c>max)\n max=c;\n }\n c=0;\n\n }\n if(max<=k)\n printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "/*\n *\n * A. Generous Kefa\n * time limit per test\n * 2 seconds\n * memory limit per test\n * 256 megabytes\n * input\n * standard input\n * output\n * standard output\n *\n * One day Kefa found n baloons. For convenience, we denote color of i-th baloon as si \u2014 lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa want to give out all baloons to his friends. Help Kefa to find out, can he give out all his baloons, such that no one of his friens will be upset \u2014 print \u00abYES\u00bb, if he can, and \u00abNO\u00bb, otherwise. Note, that Kefa's friend will not upset, if he doesn't get baloons at all.\n * Input\n *\n * The first line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009100) \u2014 the number of baloons and friends.\n *\n * Next line contains string s \u2014 colors of baloons.\n * Output\n *\n * Answer to the task \u2014 \u00abYES\u00bb or \u00abNO\u00bb in a single line.\n *\n * You can choose the case (lower or upper) for each letter arbitrary.\n * Examples\n * Input\n *\n * 4 2\n * aabb\n *\n * Output\n *\n * YES\n *\n * Input\n *\n * 6 3\n * aacaab\n *\n * Output\n *\n * NO\n *\n * Note\n *\n * In the first sample Kefa can give 1-st and 3-rd baloon to the first friend, and 2-nd and 4-th to the second.\n *\n * In the second sample Kefa needs to give to all his friends baloons of color a, but one baloon will stay, thats why answer is \u00abNO\u00bb.\n *\n */\n\n/*algorithms: count the times of every color balloons; if every color balloons not greater than the total person, then can find a way to assign all of them to person and nobody recieve the same color, otherwise, there must a man recieve the same color*/\n#include <stdio.h>\nint main() {\n int count[26]; /*save every letter's appearance times*/\n int i, total, person;\n scanf(\"%d %d\", &total, &person);\n getchar();\n for(i = 0; i < 26; i++)\n count[i] = 0;\n for(i = 0; i < total; i++)\n count[(getchar()) - 'a']++;\n for(i = 0; i < 26; i++)\n if(count[i] > person) {\n printf(\"NO\");\n return 0;\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,d;\n scanf(\"%d %d\",&n,&k);\n char s[n];\n int a[26];\n for(i=0;i<26;i++)\n a[i]=0;\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n d=(int)(((int)s[i]-(int)97));\n a[d]++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t\tif (ch[i] > max1)\n\t\t\tmax1 = ch[i];\n\tif (max1 <= k)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\n int i,j,s=0,n,k,ary[100],count=0;\n char str[100];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",str);\n\n\n for(i=0;i<n;i++){\n for(j=0;j<n;j++){\n if(str[i]==str[j]){\n s++;\n }\n }\n ary[i]=s; //printf(\"array = %d\\n\",ary[i]);\n s=0;\n }\n\n for(i=0;i<n;i++){\n if(ary[i]>k){\n count++;\n }\n }\n\n if(count==0){\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{ int k,n,somme,j;\n char tab[101],i;\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",tab);\n for (i='a';i<='z';i++)\n {\nsomme=0;\n for (j=0;j<=strlen(tab)-1;j++)\n {\n if (tab[j]==i)\n {\n somme++;\n }\n }\n if (somme>k){i='z'+1;}\n }\n if (somme<= k){printf(\"YES\");}else{printf(\"NO\");}\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint b_cnt = 'z' - 'a' + 1;\n\tint\tb_mas[ b_cnt ];\n\tmemset( b_mas, 0, sizeof( b_mas ));\n\tint n,k,i;\n\tchar sym;\n\tscanf( \"%d %d\", &n, &k );\n\tint ans = 1;\n\ti=0;\n\twhile ( i < n ) {\n\t\tscanf( \"%c\", &sym );\n\t\tif ( sym == ' ' || sym == '\\n')\n\t\t\tcontinue;\n\t\tb_mas[sym - 'a']++;\n\t\ti++;\n\t}\n\tfor ( i=0; i < b_cnt; i++ ) {\t\n\t\tif ( b_mas[i] > k ) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", ans ? \"YES\" : \"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nchar a[110], b[100];\nint main()\n{\n int n, k, i, j, t=0;\n scanf(\"%d %d\", &n, &k);\n char a[n+5];\n scanf(\"%s\", a);\n for(i=0;i<strlen(a);i++)\n b[a[i]-97]++;\n for(i=1;i<=k;i++)\n {\n for(j=0;j<30;j++)\n {\n if(b[j]!=0)\n b[j]--;\n }\n }\n for(i=0;i<30;i++)\n {\n if(b[i]==0)\n t++;\n }\n if(t==30)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint\nmain()\n{\n\tint n = 0;\n\tint k = 0;\n\tint i = 0;\n\tint len = 0;\n\tint flag = 1;\n\n\tint color[27] = { 0 };\n\tchar s[101] = \"\";\n\n\twhile ( scanf(\"%d%d\", &n, &k) != EOF )\n\t{\n\t\tif ( n )\n\t\t\tscanf( \"%s\", s );\n\n\t\tlen = strlen( s );\n\n\t\tfor ( i = 0; i < len; i++ )\n\t\t{\n\t\t\tcolor[ s[i]-'a' ]++;\n\n\t\t\tif ( color[ s[i]-'a' ] > k )\n\t\t\t{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (flag)\n\t\t{\n\t\t\tprintf( \"YES\\n\" );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf( \"NO\\n\" );\n\t\t}\n\n\t\tmemset( color, 0, sizeof(int) );\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,k,l,i,j,count=0,count_balons;\n\tchar s[105];\n\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\tscanf(\"%s\",s);\n\n\tl=strlen(s);\n\n\tfor(i=0;i<l-1;i++)\n\t{\n\t\tcount_balons=1;\n\t\tfor(j=i+1;j<l;j++)\n\t\t{\n\t\t\tif(s[i]==s[j] && s[j]!=0)\n\t\t\t{\n\t\t\t\tcount_balons++;\n\t\t\t\ts[j]=0;\n\t\t\t}\n\n\t\t}\n\n\t\tif(count_balons>k)\n\t\t\t{\n\t\t\t\tcount=1;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t}\n\n\tif(count==1)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[201];\nint a[26];\nint main()\n{\n int n,k;\n scanf(\"%d%d%s\",&n,&k,s);\n for(int i=0;i<n;i++)\n {\n a[s[i]-'a']++;\n }\n for(int i=0;i<26;i++)\n {\n if(a[i]>k)\n return puts(\"NO\");\n }\n puts(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint count[26];\nint main()\n{\n char c;\n int n, k;\n int i, flag=1;\n scanf(\"%d%d%*c\", &n, &k);\n while(n--)\n {\n scanf(\"%c\", &c);\n count[c-'a']++;\n }\n for(i=0; i<26; i++)\n {\n if(!count[i]) continue;\n if(count[i]>k)\n {\n flag = 0;\n break;\n }\n }\n if(flag) puts(\"YES\");\n else puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,count=1,count1=1,i,j;\n scanf(\"%d %d\",&n,&k);\n char ch[n+1];\n scanf(\"%s\",ch);\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ch[i]==ch[j])\n {\n count++;\n }\n }\n if(count>count1)\n {\n count1=count;\n }\n count=1;\n }\n if(count1<=k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n char* arr = (char*)malloc(sizeof(char)*n);\n // if(n<k){\n // printf(\"NO\");\n // return 0;\n // }\n int i=0,x=0,y=0;\n for (i=0;i<n;i++){\n scanf(\" %c\",&arr[i]);\n }\n int freq[26] ={0};\n for (i =0;i<n;i++){\n arr[i] = tolower(arr[i]);\n freq[(int)arr[i] - (int)'a']++;\n }\n for (i =0;i<26;i++){\n if(freq[i] > k) {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define Num 26\n#define MaxNum 101\n\nint main()\n{\n int i,n,k,Flag=0,Colors[Num];\n char ColorsString[MaxNum];\n for(i=0;i<Num;i++){\n Colors[i]=0;\n }\n scanf(\"%d %d \",&n,&k);\n gets(ColorsString);\n for(i=0;i<n;i++){\n Colors[ColorsString[i]-97]++;\n }\n for(i=0;i<Num;i++){\n if(Colors[i]>k){\n printf(\"NO\");\n Flag=1;\n break;\n }\n }\n if(Flag==0){\n printf(\"YES\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, k, max = 0, cnt[26] = {0};\n char c;\n\n scanf(\"%d%d\\n\", &n, &k);\n while(c = getchar(), c != EOF && c != '\\n')\n {\n cnt[c - 'a']++;\n if(max < cnt[c - 'a']) max = cnt[c - 'a'];\n }\n if(max > k) puts(\"NO\");\n else puts(\"YES\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\t\nchar vector[26];\n\nint main()\n{\n\tint n; //baloons\n\tint k; //friends\n\tchar c;\n\tscanf(\"%d %d\", &n, &k);\n\n\tc = getchar();\n\n\tfor(int i = 0; i < n; i++)\n\t{\n\t\tc = getchar();\n\t\tfor(int j = 0; j < 26; j++)\n\t\t\tif(c == j + 97)\n\t\t\t\tvector[j]++;\n\t}\n\n\tfor(int i = 0 ; i < 26; i++)\n\t\tif(vector[i] > k)\n\t\t{\n\t\t\tprintf(\"No\");\n\t\t\treturn EXIT_SUCCESS;\n\t\t}\n\n\tprintf(\"YES\\n\");\n\n\treturn EXIT_SUCCESS;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nchar s[1000];\nint arr[30] ;\nint n ,k ,i ;\nfor(i = 0; i< 27 ; i++)\n arr[i] = 0;\n\nscanf(\"%d %d\",&n,&k);\ngetchar();\n\ngets(s);\n for(i = 0; i< n ;i++){\n arr[s[i]-'a']++;\n }\n\n\nint flag =0, j , count;\nj = k;\nwhile(k--){\n count = 0;\n for(i = 0 ;i<27 ;i++){\n if(arr[i] >0 )\n {\n arr[i]--;\n count++;\n\n }\n }\n}\n for(i = 0 ;i< 27 ;i++)\n if(arr[i] != 0){\n flag = 1;\n }\nif(flag == 1) printf(\"NO\\n\");\nelse printf(\"YES\\n\");\n\n\n\n\nreturn 0;}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c,max=0;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n s[j]='0';\n }\nif(c>max){\n max=c;\n\n }\n\n }\n}\n\n\n if(k>=max){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);getchar();\n char s[n+1];\n int i,a[26]={0};\n gets(s);\n for(i=0;i<strlen(s);i++){\n a[s[i]-'a']++;\n }\n int p[100]={0},j,flag=0;\n for(i=0;i<k;i++){\n for(j=0;j<26;j++){\n if(a[j]!=0){\n p[i]++;a[j]--;\n }\n if(p[i]==2)break;\n }\n if(p[i]<2)flag=1;\n\n }\n for(i=0;i<26;i++){\n if(a[i]!=0)flag=1;\n }\n if(flag==1)printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,i,max,a[26];\n\tchar str[1000];\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF)\n\t{\n\t max=0;\n\t getchar();\n\t\tgets(str);\n\t\tfor(i=0;str[i]!='\\0';i++)\n a[str[i]-'a']++;\n for(i=0;str[i]!='\\0';i++)\n max=(max>a[i])?max:a[i];\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main() {\n\n\tint n, p,k,pojava[200],i;\n\tchar tekst[110];\n\n\tscanf(\"%d %d\", &n, &k);\n\tscanf(\"%s\", tekst);\n\tp = 1;\n\tfor (i = 0; i < n; i++) {\n\t\tpojava[tekst[i]]++;\n\t\tif (pojava[tekst[i]] > k) { p = 0; break; }\n\t}\n\n\tif (p) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char b[1000],a[1000];\n int i,j,n,k,c=0;\n scanf(\"%d %d\",&n,&k);\n gets(b);\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n for(j=0;j<i;j++)\n {\n if(a[i]==a[j])\n {\n break;\n }\n }\n if(a[i]==a[j]&&i!=0)\n continue;\n else if(j==i)\n {\n for(;j<n;j++)\n {\n if(a[i]==a[j])\n {\n c++;\n }\n }\n }\n if(c>k)\n {\n printf(\"NO\");\n break;\n }\n }\n if(i==n&&c<=k)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1001];\n int n,i,j,c,d,k;\n scanf(\"%d %d\",&n,&c);\n scanf(\"%s\",s);\n for (i=0;i<n; i++)\n {\n d=1;\n for (j=1; j<n; j++)\n {\n if (s[i]==s[j])\n {\n d++;\n\n }\n if (d>c)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0,tem,min=100000000;\n char s[1000];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i+1;j<strlen(s);j++)\n {\n if(s[i]>s[j])\n {\n tem=s[i];\n s[i]=s[j];\n s[j]=tem;\n }\n }\n\n }\n\n//printf(\"%s\\n\",s);\n count=1;\n for(i=0;i<strlen(s)-1;i++)\n {\n if(s[i]!=s[i+1])\n {\n count++;\n } \n }\n if(count<k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n \n int symbolcount[count];\n for(int i=0;i<count;i++)\n {\n symbolcount[i]=1;\n }\n for(int i=0,j=0;i<count && j<strlen(s)-1;j++)\n {\n if(s[j]==s[j+1]) symbolcount[i]++;\n else i++;\n }\n for(int i=0;i<count;i++)\n {\n if(k%symbolcount[i]!=0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n \n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, i, j, t=0, m;\n scanf(\"%d %d\", &n, &k);\n char a[n+5];\n scanf(\"%s\", a);\n for(i=0;i<strlen(a);i++)\n {\n for(j=0;j<strlen(a);j++)\n {\n if(a[i]!=a[j]&&a[i]!='1'&&a[j]!='1')\n {\n t++;\n a[i]='1';\n a[j]='1';\n break;\n }\n }\n }\n // printf(\"%d\\n\",t);\n if(2*t==n)\n {\n if(k>=t)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n {\n m = n - 2*t;\n if(m<=(k-t))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,count=1,count1=1,i,j;\n scanf(\"%d %d\",&n,&k);\n char ch[n+1];\n scanf(\"%s\",ch);\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ch[i]==ch[j])\n {\n count++;\n }\n }\n if(count>count1)\n {\n count1=count;\n count=1;\n }\n }\n if(count1<=k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void){\n int n,k,l,i;\n char s[101];\n int A[26];\n\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++){\n\tA[s[i]-'a']++;\n }\n for(i=0;i<26;i++){\n\tif(A[i]>k){\n\t printf(\"NO\\n\");\n\t return 0;\n\t}\n }\n printf(\"YES\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[205];\n int n,k,min=0,j,i,c,l;\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",&s);\n l=strlen(s);\n min=50;\n int a[l];\n for(i=0;i<l;i++)\n { c=0;\n for(j=0;j<l;j++)\n {\n if(s[i]==s[j])\n {\n c=c+1;\n }\n }\n a[i]=c;\n }\n for(i=0;i<l-1;i++){if(a[i]>=min){min=a[i];}}\n\n if(min>k)\n {\n printf(\"NO\");\n }\n else if(k==2&&l==2)\n {\n printf(\"YES\");\n }\n else {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0;\n char x[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n for(j=i+1;j<n;j++)\n {\n if(x[i]!=x[j]&&x[j]!='0')\n {\n k--;\n x[i]='0';\n x[j]='0';\n break;\n }\n }\n }\n }\n k=0;\n for(j=0;j<n;j++)\n {\n if(x[j]!='0')\n {\n k++;\n break;\n }\n\n }\n if(k<=1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h> //3\ubc88\n#pragma warning(disable:4996)\n\nint main(void) {\n int N, k, i;\n char p;\n int str[26] = { 0, };\n scanf(\"%d%d\", &N, &k);\n\n for (i = 0; i<N; i++) {\n scanf(\" %c\", &p);\n if (p <= 'z' && p >= 'a') {\n ++str[p - 'a'];\n }\n else break;\n }\n for (i = 0; i<N; i++) {\n \n if (str[i]>k) {\n printf(\"NO\\n\");\n \n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint n,k,i,j,c;c=0;\n\tchar s[100];\n\tscanf(\"%d%d\\n\",&n,&k);\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(s[i]!=s[j]&& s[i]!=0)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t\ts[i]=0;s[j]=0;\n\t\t\t}\n\t\t}\n\t}\n\tif(c==n/k)\n\tprintf(\"yes\");\n\telse printf(\"no\");\n}"}, {"source_code": "#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=0;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n }\n\n }\n if(c<=k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n\n}\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint n,k,i,j,c;c=0;\n\tchar s[100];\n\tscanf(\"%d%d\\n\",&n,&k);\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(s[i]!=s[j]&& s[i]!=0)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t\ts[i]=0;s[j]=0;\n\t\t\t}\n\t\t}\n\t}\n\tif(c==k)\n\tprintf(\"yes\");\n\telse printf(\"no\");\n}"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,count = 0, temp,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t{\n\t\tif (ch[i] > max1)\n\t\t{\n\t\t\tmax2 = max1;\n\t\t\tmax1 = ch[i];\n\t\t}\n\t\telse if (ch[i] > max2)\n\t\t\tmax2 = ch[i];\n\t}\n\tif (max2 == 0)\n\t{\n\t\tif (max1 == k)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\ttemp = k - max2;\n\t\tif (temp < 0)\n\t\t\tprintf(\"NO\");\n\t\telse if (temp == 0)\n\t\t{\n\t\t\tif (max2 == max1)\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif (ch[i] != 0)\n\t\t\t\t{\n\t\t\t\t\tch[i] -= max2;\n\t\t\t\t\tif (ch[i] > temp)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"YES\");\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[205];\n int n,k,min=105,j,i,c,l;\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",&s);\n l=strlen(s);\n min=50;\n int a[l];\n for(i=0;i<l;i++)\n { c=0;\n for(j=0;j<l;j++)\n {\n if(s[i]==s[j])\n {\n c=c+1;\n }\n }\n a[i]=c;\n }\n for(i=0;i<l-1;i++){if(a[i]<=min){min=a[i];}}\n\n if(min>=k)\n {\n printf(\"YES\");\n }\n else {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[10000];\n int i,n,k,count[1000];\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n for(i=0;i<26;i++){\n if(count[i]==count[i+1]){\n printf(\"YES\");\n break;\n }\n else {\n printf(\"NO\");\n break;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,d;\n scanf(\"%d %d\",&n,&k);\n char s[n];\n int a[26]={0};\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n d=(int)'a'-(int)s[i];\n a[d]++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>k)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, i, j, t=0, m;\n scanf(\"%d %d\", &n, &k);\n char a[n+5];\n scanf(\"%s\", a);\n for(i=0;i<strlen(a);i++)\n {\n for(j=0;j<strlen(a);j++)\n {\n if(a[i]!=a[j]&&a[i]!='1'&&a[j]!='1')\n {\n t++;\n a[i]='1';\n a[j]='1';\n break;\n }\n }\n }\n printf(\"%d\\n\",t);\n if(2*t==n)\n {\n if(k>=t)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n {\n m = n - 2*t;\n if(m<=(k-t))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint b_cnt = 'z' - 'a' + 1;\n\tint\tb_mas[ b_cnt ];\n\tmemset( b_mas, 0, sizeof( b_mas ));\n\tint n,k,i;\n\tscanf( \"%d %d\", &n, &k );\n\tint ans = 1;\n\tfor ( i=0; i < n; i++ ) {\n\t\tchar sym;\n\t\tscanf( \"%c\", &sym );\n\t\tb_mas[sym - 'a']++;\n\t}\n\tfor ( i=0; i < n; i++ ) {\t\n\t\tif ( b_mas[i] > k ) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", ans ? \"YES\" : \"NO\");\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint main(void)\n{\n\tint i, n, k,count = 0, temp,ch[26] = { 0 };\n\tint max1 = 0, max2 = 0;\n\tchar c;\n\tscanf(\"%i%i\", &n, &k);\n\tscanf(\"%c\", &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tfor (i = 0; i < 26; i++)\n\t{\n\t\tif (ch[i] > max1)\n\t\t{\n\t\t\tmax2 = max1;\n\t\t\tmax1 = ch[i];\n\t\t}\n\t\telse if (ch[i] > max2)\n\t\t\tmax2 = ch[i];\n\t}\n\tif (max2 == 0)\n\t{\n\t\tif (max1 == k)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\ttemp = k - max2;\n\t\tif (temp < 0)\n\t\t\tprintf(\"NO\");\n\t\telse if (temp == 0)\n\t\t{\n\t\t\tif (max2 == max1)\n\t\t\t\tprintf(\"YES\");\n\t\t\telse\n\t\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < 26; i++)\n\t\t\t{\n\t\t\t\tif (ch[i] != 0)\n\t\t\t\t{\n\t\t\t\t\tch[i] -= max2;\n\t\t\t\t\tif (ch[i] > temp)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"YES\");\n\t\t}\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, k;\n scanf(\"%i%i\", &n, &k);\n char current_character;\n int q[30];\n for (int i = 0; i < 30; i++)\n q[i] = 0;\n for (int i = 0; i < n; i++) {\n scanf(\"%c\", ¤t_character);\n q[current_character - 'a']++;\n }\n int maximal_letter_count = 0;\n for (int i = 0; i < 30; i++)\n if (q[i] > maximal_letter_count)\n maximal_letter_count = q[i];\n printf(maximal_letter_count > k ? \"NO\" : \"YES\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0,m,l,z[100]={0},count=0;\n char x[100],y[100],ch;\n scanf(\"%d %d\",&n,&l);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n ch=x[i];\n y[0]=ch;\n k=1;\n for(j=i+1;j<n;j++)\n {\n if(x[j]!='0')\n {\n for(m=0;m<k;m++)\n {\n if(x[j]==y[m])\n {\n break;\n }\n }\n if(m==k)\n {\n x[i]='0';\n y[k]=x[j];\n x[j]='0';\n k++;\n }\n }\n }\n if(k>1)\n {\n count++;\n }\n }\n }\n k=0;\n\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n k++;\n }\n }\n printf(\"count:%d,l=%d,k=%d\\n\",count,l,k);\n if((count+k)<=l)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint n, k, i, aux = 0;\n\tchar *ballons;\n\tchar alphabet[125];\n\n\tfor(i=0;i<125;i++){\n\t\talphabet[i] = 0;\n\t}\n\n\n\tscanf(\"%d %d\", &n, &k);\n\n\tballons = (char *) malloc(n*sizeof(char));\n\n\tscanf(\"%s\", ballons);\n\n\tfor(i=0;ballons[i]!='\\0';i++){\n\t\talphabet[ballons[i]]++;\n\t}\n\n\n\tfor(i=0;i<125;i++){\n\t\tif(alphabet[i]%k!=0){\n\t\t\taux = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif(aux == 1) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\n\treturn 0;\n}\n/* 1506095938943 */\n"}, {"source_code": "#include<stdio.h>\nint n, k, i;\nchar a[100];//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b\nint b[26];//\ufffd\ufffd26\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd26\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0433\ufffd\u02bc\ufffd\ufffd\u03aa0\nint main()\n{\n\t//int n, k, i;\n\t//char a[100];//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b\n\t//int b[26];//\ufffd\ufffd26\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd26\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0433\ufffd\u02bc\ufffd\ufffd\u03aa0\n\tscanf(\"%d%d\", &n, &k); //n\ufffd\ufffd\u02be\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd k\ufffd\ufffd\u02be\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\n\tscanf(\"%s\", a + 1);\n\tfor (i = 1; i <= n; i++) //\u046d\ufffd\ufffdn\ufffd\ufffd \ufffd\ufffd\ufffd\u0436\ufffd\ufffd\u0678\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b\n\t{\n\t\tb[a[i] - 'a']++; //\ufffd\ufffd\ufffd\ufffd\ufffd\u0774\ufffd\ufffd\ufffd\ufffd\ufffdb[26]\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0138a\ufffd\ufffdz\ufffd\ufffd\u00ff\ufffd\ufffd\ufffd\ufffd\u0138\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u05b1\ufffd\ufffd\u01f6\ufffd\ufffd\ufffd\n\t}\n\tfor (i = 0; i < 26; i++)//\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0138\ufffd\u0423\ufffd\ufffd\u0674\ufffda - z\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u04bb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u026b\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \u05b1\ufffd\ufffdno\n\t{\n\t\tif (b[i] > k)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,j,a,b=0,n,c,m;\nscanf(\"%d\",&n);\nscanf(\"%d\",&m);\nc=m;\nchar str[n];\nint A[105];\nfor(i=0;i<=n;i++){\n str[i]=getchar();\n}\nstr[i]='\\0';\nfor(i=0;i<=105;i++){\nA[i]=0;\n}\nfor(i=0;i<=strlen(str)-1;i++){\n for(j=i+1;j<=n;j++){\n if(str[j]=='0')\n continue;\n if(str[i]==str[j]){\n str[j]='0';\n A[i]=A[i]+1;\n }\n }\n}\nfor(i=0;i<=105;i++){\n if(A[i]==0)\n continue;\n if(A[i]+1>c){\n b=1;\n break;\n }\n}\nif(b==1)\n printf(\"NO\");\nelse if(b==0)\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0;\n char x[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n for(j=i+1;j<n;j++)\n {\n if(x[i]!=x[j]&&x[j]!='0')\n {\n k--;\n x[i]='0';\n x[j]='0';\n break;\n }\n }\n }\n }\n k=0;\n for(j=0;j<n;j++)\n {\n if(x[j]!='0')\n {\n k++;\n }\n\n }\n if(k<=1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n, k;\n\tchar a[105];\n\n\tint count[105] = { 0 };\n\tchar A[105];\n\tint L;\n\t\n\tscanf(\"%d%d\", &n, &k);\n\tgetchar();\n\tscanf(\"%s\", a);\n\n\tL = 0;\n\tfor (int i = 0; a[i] != '\\0'; i++)\n\t{\n\t\tint flag = 1;\n\n\t\tfor (int j = 0; j < i; j++)\n\t\t{\n\t\t\tif (a[i] == a[j])\n\t\t\t{\n\t\t\t\tflag = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (flag == 1)\n\t\t{\n\t\t\tA[L] = a[i];\n\t\t\tcount[L]++;\n\t\t\tL++;\n\t\t}\n\n\t\tif (flag == 0)\n\t\t{\n\t\t\tfor (int j = 0; j < i; j++)\n\t\t\t{\n\t\t\t\tif (a[i] == A[j])\n\t\t\t\t{\n\t\t\t\t\tcount[j]++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tint max = count[0];\n\tfor (int i = 0; i < L; i++)\n\t{\n\t\tif (count[i] > max)\n\t\t{\n\t\t\tmax = count[i];\n\t\t}\n\t}\n\n\tif (max > k || n < k)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a['z']={0},n,k;\n scanf(\"%d %d\",&n,&k);\n char s[1000];\n scanf(\"%s\",&s);\n int i,j,x;\n for(i=0;s[i]!='\\0';i++)\n {\n char z=s[i];\n a[z]++;\n }\n x=n/k;\n char d;\n for(d='a';d<'z';d++)\n {\n int y=a[d];\n if(x<y)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c,max=0;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n s[j]='0';\n }\nif(c>max){\n max=c;\n\n }\n\n }\n}\n\n\n if(k>=max){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[201];\nint a[26];\nint main()\n{\n int n,k;\n scanf(\"%d%d%s\",&n,&k,s);\n for(int i=0;i<n;i++)\n {\n a[s[i]-'a']++;\n }\n for(int i=0;i<26;i++)\n {\n if(a[i]>k)\n return puts(\"NO\"),0;puts(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c,max=0;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n s[j]='0';\n }\nif(c>max){\n max=c;\n\n }\n\n }\n}\n\n\n if(max<=k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char b[1000],a[1000];\n int i,j,n,k,c=0;\n scanf(\"%d %d\",&n,&k);\n gets(b);\n gets(a);\n for(i=0;a[i]!='\\0';i++)\n {\n for(j=0;j<i;j++)\n {\n if(a[i]==a[j])\n {\n break;\n }\n }\n if(a[i]==a[j]&&i!=0)\n continue;\n else if(j==i)\n {\n for(;j<n;j++)\n {\n if(a[i]==a[j])\n {\n c++;\n }\n }\n }\n if(c>k)\n {\n printf(\"NO\");\n break;\n }\n }\n if(i==n&&c<=k)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,max = 0,c = 0;;\n char s[101],t[10] = \"\";\n scanf(\"%d%d%s\",&n,&k,s);\n for(i = 0; i < n; i++)\n {\n for(j = 0; j < n; j++)\n {\n if(s[i] < s[j])\n {\n t[0] = s[i];\n s[i] = s[j];\n s[j] = t[0];\n\n }\n }\n }\n for(i = 0; i < n-1; i++)\n {\n if(s[i] == s[i+1])\n {\n c++;\n }\n else\n {\n if(max < c)\n {\n max = c;\n }\n c = 0;\n }\n }\n max++;\n printf(\"%d\",max);\n if(max > k)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n\tint balloon, amigo;\n\tchar* arr;\n\tint i, j;\n\tint temp=1;\n\tint max = 0;\n\n\tscanf(\"%d %d\", &balloon, &amigo);\n\tif (balloon < 1 || amigo>100) {\n\t\treturn 0;\n\t}\n\n\tarr = (char*)malloc(sizeof(char)*balloon);\n\n\tfor (i = 0; i < balloon; i++) {\n\t\tscanf(\"%c\", &arr[i]);\n\t}\n\n\tfor (i = 0; i < balloon-1; i++) {\n\t\ttemp = 1;\n\t\tfor (j = i+1; j < balloon; j++) {\n\t\t\tif ((arr[i] == arr[j])!=NULL) {\n\t\t\t\tarr[j] = NULL;\n\t\t\t\ttemp++;\n\t\t\t}\n\t\t}\n\t\tif (temp >= max)\n\t\t\tmax = temp;\n\t}\n\t\n\tif (max > amigo) {\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t\tprintf(\"YES\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n }\n\n }\n if(c==k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n\n}\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,j,a,b,n,c,m;\nscanf(\"%d\",&n);\nscanf(\"%d\",&m);\nc=m;\nchar str[n];\nint A[105];\nfor(i=0;i<=n;i++){\n str[i]=getchar();\n}\nstr[i]='\\0';\nfor(i=0;i<=105;i++){\nA[i]=0;\n}\nprintf(\"%d\",m);\nfor(i=0;i<=strlen(str)-1;i++){\n for(j=i+1;j<=n;j++){\n if(str[j]=='0')\n continue;\n if(str[i]==str[j]){\n str[j]='0';\n A[i]=A[i]+1;\n }\n }\n}\nprintf(\"%d\\n\",n);\nfor(i=0;i<=105;i++){\n if(A[i]==0)\n continue;\n if(A[i]+1>c){\n b=1;\n break;\n }\n}\nif(b==1)\n printf(\"NO\");\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cnt[26];\n\nint main(void)\n{\n\tint n, k, a, num = 0;\n\tchar c;\n\tscanf(\"%d %d\", &n, &k);\n\tgetchar();\n\tfor (a = 0; a < n; a = a + 1)\n\t{\n\t\tc = getchar();\n\t\tcnt[c - 'a']++;\n\t}\n\tfor (a = 0; a < 26; a = a + 1)\n\t{\n\t\tif (cnt[a])\n\t\t\tnum++;\n\t\tif (cnt[a] && cnt[a] != n)\n\t\t{\n\t\t\tnum = -1;\n\t\t\tputs(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (num != -1 && num < n)\n\t\tputs(\"NO\");\n\telse if(num!=-1)\n\t\tputs(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0,tem,min=100000000;\n char s[1000];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i+1;j<strlen(s);j++)\n {\n if(s[i]>s[j])\n {\n tem=s[i];\n s[i]=s[j];\n s[j]=tem;\n }\n }\n\n }\n\n//printf(\"%s\\n\",s);\n count=1;\n for(i=0;i<strlen(s)-1;i++)\n {\n if(s[i]==s[i+1])\n {\n\n count++;\n\n }\n else\n {\n if(min>count)\n {\n min=count;\n\n }\n count=1;\n }\n \n }\n // printf(\"%d\\n\",min);\n if(min<k)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);getchar();\n char s[n+1];\n int i,a[26]={0};\n gets(s);\n for(i=0;i<strlen(s);i++){\n a[s[i]-'a']++;\n }\n int p[1000]={0},j,flag=0;\n for(i=0;i<k;i++){\n for(j=0;j<26;j++){\n if(a[j]!=0){\n p[i]++;a[j]--;\n }\n if(p[i]==2)break;\n }\n if(p[i]<2)flag=1;\n\n }\n for(i=0;i<26;i++){\n if(a[i]!=0)flag=1;\n }\n for(i=0;i<k;i++){\n if(p[i]!=2)flag=1;\n }\n if(flag==1)printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar in_abc(char sym, char* abc) {\n\tint i;\n\tfor(i = 0; i < strlen(abc); ++i) {\n\t\tif(abc[i] == sym) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tchar str[n];\n\tscanf(\"%s\", str);\n\tchar abc[n];\n\t\n\tint i;\n\tfor(i = 0; i < n; ++i) {\n\t\tabc[i] = '\\0';\n\t}\n\t\n\tint j = 0;\n\tfor(i = 0; i < n; ++i) {\n\t\tif(!in_abc(str[i], abc)) {\n\t\t\tabc[j] = str[i];\n\t\t\t++j;\n\t\t}\n\t}\n\t\n\tint x;\n\tfor(i = 0; i < strlen(abc); ++i) {\n\t\tx = 0;\n\t\tfor(j = 0; j < n; ++j) {\n\t\t\tif(str[j] == abc[i]) {\n\t\t\t\t++x;\n\t\t\t}\n\t\t}\n\t\tif(x != k) {\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,b[105],flag=0;\n char s[105];\n memset(b,0,sizeof(b));\n scanf(\"%d%d%s\",&n,&k,s);\n for(int i=0;i<n;i++)\n {\n b[s[i]-'0']++;\n }\n if(k==1)\n {\n for(int i=40;i<=100;i++)\n if(b[i]>=2)\n flag=1;\n if(flag==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n else\n {\n for(int i=40;i<=100;i++)\n if(b[i]>2)\n flag=1;\n if(flag==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n, k;\n\tchar s[101];\n\tint p[50];\n\tint i, j, f=0;\t\n\n\tscanf(\"%d %d\", &n, &k);\n\tscanf(\"%s\", s);\n\t\n\tfor(i=0;i<k;i++)\n\t\tp[i]=0;\n\tif(n >= 2*k)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tfor(j=0;j<k;j++)\n\t\t\t{\n\t\t\t\tif(p[j] == 0)\n\t\t\t\t\tp[j] = s[i]-'a'+1;\n\t\t\t\t//else if(p[j] == s[i]-'a'+1)\n\t\t\t\t//\tcontinue;\n\t\t\t\telse if(p[j] != s[i]-'a'+1 && p[j] > 0)\n\t\t\t\t{\t\n\t\t\t\t\tp[j] = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(j=0;j<k;j++)\n\t\t\tif(p[j] != -1)\n\t\t\t\tf = -1;\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\t//for(i=0;i<k;i++)\n\t//\tprintf(\"%d \", p[i]);\n\tif(f == -1)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\t\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int i,j,baloon, friends,lable[256];\n char baloons[100];\n for(i=0;i<256;i++) lable[i]=0;\n scanf(\"%d %d\",&baloon,&friends);\n gets(baloons);\n for(i=0;i<friends;i++) lable[baloons[i]]++;\n for(i=0;i<256;i++){\n if(lable[i]>friends){\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c,max=0;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n s[i]='0';\n }\nif(c>max){\n max=c;\n\n }\n\n }\n}\n\n\n if(k>=max){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,temp;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]<a[j]){\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n if(a[n/2]==a[(n/2)-1])\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX 101\ntypedef struct friend {\n\tchar color[MAX];\n\tstruct friend* next;\n} friend;\n\nfriend frnd[MAX];\n\nint check_and_write(friend* cur, char c){\n\tint i;\n\tfor (i = 0; cur->color[i] != '\\0'; i++)\n\t\tif (c == cur->color[i])\n\t\t\treturn 0;\n\tcur->color[i] = c;\n\treturn 1;\n}\n\nint main(void){\n\tfriend* p = &frnd[0];\n\tint n, k, i;\n\tchar c;\n\tscanf(\"%d %d\\n\", &n, &k);\n\tfor (i = 0; i < MAX; i++){\n\t\tp->next = &frnd[i];\n\t\tp = p->next;\n\t}\n\twhile ((c = getchar()) != EOF){\n\t\tfor(p = &frnd[0]; p; p = p->next){\n\t\t\tif (check_and_write(p, c))\n\t\t\t\tbreak;\n\t\t\tif(p->next == NULL){\n\t\t\t\tputs(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n int baloon,frnd,i,check[150],j,count;\n char color[150],c;\n while(scanf(\"%d %d\",&baloon,&frnd)!=EOF)\n {\n j=0;\n scanf(\"%s\",color);\n if(strlen(color)<frnd)\n {\n printf(\"YES\\n\");\n return 0;\n }\n for(c='a'; c<='z'; c++)\n {\n count=0;\n for(i=0; i<strlen(color); i++)\n {\n if(c==color[i])\n {\n count++;\n }\n }\n if(count>0)\n {\n check[j]=count;\n j++;\n }\n }\n j--;\n while(j>=0)\n {\n if(check[j]<frnd)\n {\n printf(\"NO\\n\");\n return 0;\n }\n j--;\n }\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c,max=0;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n s[j]='0';\n }\nif(c>max){\n max=c;\n\n }\n\n }\n}\n\n\n if(max<=k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,i,max;\n\tchar str[1000];\n\twhile(scanf(\"%d%d\",&n,&k)!=EOF)\n\t{\n\t\tint a[26]={0};\n\t max=0;\n\t getchar();\n\t\tgets(str);\n\t\tfor(i=0;i<26;i++)\n a[str[i]-'a']++;\n for(i=0;i<26;i++)\n max=(max>a[i])?max:a[i];\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,k,j,i;\n\tint mas[27];\n\tchar s;\n\tfor (i=0;i<=27;i++)\n\t\tmas[i]=0;\n\tscanf(\"%d %d\",&n,&k);\n\tscanf(\"%c\",&s);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%c\",&s);\n\t\tmas[s-'a']++;\n\t}\n\tfor (i=0;i<=27;i++)\n\t\tif (mas[i]>k)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1001];\n int n,i,j,c,d,k;\n scanf(\"%d %d\",&n,&c);\n scanf(\"%s\",s);\n for (i=0;i<n; i++)\n {\n d=1;\n for (j=1; j<n; j++)\n {\n if (s[i]==s[j])\n {\n d++;\n\n }\n if (d>c)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint baloes, amigos, tabela[26] = {0}, i = 0;\n\tchar cor[100];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\tscanf(\"%s\", cor);\n\twhile(cor[i] != '\\0') {\n\t\ttabela[cor[i] - 97]++;\n\t\tif(tabela[cor[i] - 97] > 1);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile(i < 26) {\n\t\tif(tabela[i] > 1) {\n\t\t\tamigos--;\n\t\t\ttabela[i] -= 2;\n\t\t} else {\n\t\t\ti++;\n\t\t}\n\t}\n\tif(amigos != 0) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\treturn 0;\n}\n/* 1506561488605 */\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=0;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n }\n\n }\n if(c>k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n\n}\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n if(n<k){\n printf(\"NO\");\n return 0;\n }\n char* arr = (char*)malloc(sizeof(char)*n);\n int i=0,x=0,y=0;\n for (i=0;i<n;i++){\n scanf(\"%c\",&arr[i]);\n }\n int freq[26] ={0};\n for (i =0;i<n;i++){\n freq[(int)arr[i] - 'a']++;\n }\n for (i =0;i<26;i++){\n if(freq[i] > k) {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,k,c=0,m=0;\n\tchar b;\n\tb='a';\n\tscanf(\"%d%d\",&n,&k);\n\tchar a[n];\n\t\n\tscanf(\"%s\",&a);\n\t\n\tfor (i=0; i<n; i++){\n c=0;\n\t\tfor (j=0; j<n; j++){\n\t\t\tif (a[j]==b) c++;\n\t\t\tif (c>k) {\n\t\t\t\tprintf (\"NO\");\n\t\t\t\tm=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tb++;\n\t}\n\tif (m==0) printf(\"YES\");\n}\n\t\n\t\t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,n,k,c=0,m=0;\n\tchar b;\n\tb='a';\n\tscanf(\"%d%d\",&n,&k);\n\tchar a[n];\n\t\n\tscanf(\"%s\",&a);\n\t\n\tfor (i=0; i<n; i++){\n c=0;\n\t\tfor (j=0; j<n; j++){\n\t\t\tif (a[j]==b) c++;\n\t\t\tif (c>k) {\n\t\t\t\tprintf (\"NO\");\n\t\t\t\tm=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n if (m==1) break;\n\t\tb++;\n\t}\n\tif (m==0) printf(\"YES\");\n return 0;\n}\n\t\n\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int n, k, i, j, t=0;\n scanf(\"%d %d\", &n, &k);\n char a[n+5];\n scanf(\"%s\", a);\n for(i=0;i<strlen(a);i++)\n {\n for(j=0;j<strlen(a);j++)\n {\n if(a[i]!=a[j]&&a[i]!='1'&&a[j]!='1')\n {\n t++;\n a[i]='1';\n a[j]='1';\n }\n }\n }\n //printf(\"%d\\n\",t);\n if(t>=k)\n printf(\"YES\\n\");\n else\n {\n if(2*t==n||(2*t<n&&n-2*t<2))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint n, k;\n\tchar s[101];\n\tint p[50];\n\tint i, j, f=0;\t\n\n\tscanf(\"%d %d\", &n, &k);\n\tscanf(\"%s\", s);\n\t\n\tfor(i=0;i<k;i++)\n\t\tp[i]=0;\n\tif(n >= 2*k)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tfor(j=0;j<k;j++)\n\t\t\t{\n\t\t\t\tif(p[j] == 0)\n\t\t\t\t\tp[j] = s[i]-'a'+1;\n\t\t\t\t//else if(p[j] == s[i]-'a'+1)\n\t\t\t\t//\tcontinue;\n\t\t\t\telse if(p[j] != s[i]-'a'+1 && p[j] > 0)\n\t\t\t\t{\t\n\t\t\t\t\tp[j] = -1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(j=0;j<k;j++)\n\t\t\tif(p[j] != -1)\n\t\t\t\tf = -1;\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\t//for(i=0;i<k;i++)\n\t//\tprintf(\"%d \", p[i]);\n\tif(f == -1)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\t\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n, k;\n int s[100];\n int letters[26] = {0};\n\n scanf(\"%d %d\", &n, &k);\n getchar();\n for(int i = 0; i < n; i++)\n {\n s[i] = getchar();\n letters[s[i] - 'a']++;\n }\n\n for(int i = 0; i < 26; i++)\n if(letters[i] != 0 && letters[i] < k)\n {\n printf(\"NO\\n\");\n return 0;\n } \n \n printf(\"YES\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,j,a,b,n,m;\nscanf(\"%d %d\",&n,&m);\nchar str[n];\nint A[105];\nfor(i=0;i<=n;i++){\n str[i]=getchar();\n}\nfor(i=0;i<=105;i++){\n A[i]=0;\n}\nstr[i]='\\0';\n//printf(\"%d\",a);\nfor(i=0;i<=strlen(str)-1;i++){\n // printf(\"%c\",str[i]);\n for(j=i+1;j<=n;j++){\n if(str[j]=='0')\n continue;\n if(str[i]==str[j]){\n str[j]='0';\n A[i]=A[i]+1;\n }\n }\n}\nfor(i=0;i<=105;i++){\n // printf(\"%d \",A[i]);\n if(A[i]==0)\n continue;\n if(A[i]+1>m){\n b=1;\n break;\n }\n}\nif(b==1)\n printf(\"NO\");\nelse\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);getchar();\n char s[n+1];\n int i,a[26]={0};\n gets(s);\n for(i=0;i<strlen(s);i++){\n a[s[i]-'a']++;\n }\n int p[1000]={0},j,flag=0;\n for(i=0;i<k;i++){\n for(j=0;j<26;j++){\n if(a[j]!=0){\n p[i]++;a[j]--;\n }\n if(p[i]==2)break;\n }\n if(p[i]<2)flag=1;\n\n }\n for(i=0;i<k;i++){\n if(p[i]!=2)flag=1;\n }\n if(flag==1)printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint N,K;\nchar baloon[110];\nint chart[30];\n\nint sol(){\n\tint i,j,num=2;\n\tfor(i=0;i<K;i++){\n\t\tnum=2;\n\t\tfor(j=0;j<26;j++){\n\t\t\tif(num==0) break;\n\t\t\tif(chart[j]){\n\t\t\t\tnum--;\n\t\t\t\tchart[j]--;\n\t\t\t}\n\t\t}\n\t\tif(num!=0) return 0;\n\t}\n\treturn 1;\n}\n\nint main(){\n\t\n\tint i,ans,j;\n\tscanf(\"%d %d\",&N,&K);\n\n\tscanf(\"%s\",baloon);\t\n\t\n\tfor(i=0;i<N;i++){\n\t\tchart[baloon[i]-'a']++;\n\t}\n\tans = sol();\n\tif(ans) printf(\"YES\");\n\telse printf(\"NO\");\n\n/*\n\tfor(i=0;i<26;i++){\n\t\tif(chart[i])\n\t\t\tprintf(\"%c : %d\\n\",'a'+i,chart[i]);\n\t}printf(\"\\n\");\n\t\t\n\n\tsort();\n\t\n\tfor(i=0;i<N;i++){\n\t\tprintf(\"%c\",baloon[i]);\n\t}printf(\"\\n\");\n*/\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint n, k, cnt, num = 0;\n\tchar tmp_char = '0';\n\t//printf(\"Enter the number of n and k\\n\");\n\tscanf(\"%d%d\", &n, &k);\n\tchar* ballon = (char*)malloc(sizeof(char)*n);\n\t//printf(\"Enter the clolr of ballon\\n\");\n\tscanf(\"%s\", ballon);\n\tprintf(\"\\n\");\n\tif (n > 2*k) //\ud48d\uc120\uc774 \ub108\ubb34 \ub9ce\uc74c\n\t\tprintf(\"No\\n\"); //ok\n\telse\n\t{\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\ttmp_char = ballon[i];\n\t\t\tnum = 0;\n\t\t\tfor (int j = 0; j < n; j++)\n\t\t\t{\n\t\t\t\tif (tmp_char == ballon[j])\n\t\t\t\t\tnum++;\n\t\t\t}\n\t\t\tif (num > k)\n\t\t\t{\n\t\t\t\tprintf(\"No\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}\n\n\n\n/*\n1. \uc785\ub825 \ubc1b\uae30/\n2. \uc785\ub825 \ubc1b\uc740 \ud48d\uc120\uc744 array\uc5d0 \ub123\uae30/\n3. \ubcc0\uc218 cnt\uc640 tmp \ub9cc\ub4e4\uae30 /\n4. tmp\ub85c \uc0c9\uc744 \ube44\uad50\ud558\uba74\uc11c \ud574\ub2f9 \uc0c9\uacfc \uac19\uc740 \uc0c9\uc774 \uba87\uac1c \uc788\ub294\uc9c0 cnt\ub85c \uc800\uc7a5\n5. ( \ud48d\uc120\uc218 > \ud559\uc0dd\uc218*2 ) -> No/\n6. cnt\uc640 \ud559\uc0dd \uc218\ub97c \ube44\uad50, ( cnt > \ud559\uc0dd\uc218 ) -> No/\n\n\n*/"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint n,k,i,j,d,z,c;\n char s[100];\n z=0;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<n;i++)\nscanf(\"%c\",&s[i]);\nfor(i=0;i<n;i++)\n{ c=0;\n\tfor(j=i+1;j<n;j++)\n\t{\n\t\tif(s[i]==s[j])\n\t\t{s[j]=0;\n\t\tc++;}\n\t} \n\tif(c>=k)\n\t{ z++;\n\t\tprintf(\"NO\");\n\t\tbreak;\n\t}\n}if(z==0)\nprintf(\"YES\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint baloes, amigos, tabela[26] = {0}, i = 0;\n\tchar cor[100];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\tscanf(\"%s\", cor);\n\twhile(cor[i] != '\\0') {\n\t\ttabela[cor[i] - 97]++;\n\t\tif(tabela[cor[i] - 97] > 1);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile(i < 26) {\n\t\tif(tabela[i] > 1) {\n\t\t\tamigos--;\n\t\t\ttabela[i] -= 2;\n\t\t} else {\n\t\t\ti++;\n\t\t}\n\t}\n\tif(amigos != 0) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\treturn 0;\n}\n/* 1506561488605 */\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[201];\nint a[26];\nint main()\n{\n int n,k;\n scanf(\"%d%d%s\",&n,&k,s);\n for(int i=0;i<n;i++)\n {\n a[s[i]-'a']++;\n }\n for(int i=0;i<26;i++)\n {\n if(a[i]>k)\n return puts(\"NO\"),0;\n puts(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint a[150];\nint main()\n{\n int i,n,k,flag=1;\n scanf(\"%d%d\",&n,&k);\n char x;\n for(i=0;i<n;i++)\n {\n scanf(\"%c\",&x);\n a[x]++;\n if(a[x]>k)\n {\n flag=0;\n break;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX_CHARS 255 // Maximum characters allowed\n\n\nint main()\n{\n int freq[MAX_CHARS]; // Store frequency of each character\n int i = 0, max;\n int ascii;\n int n,k;\n scanf(\"%d%d\",&n,&k);\n char str[n+1];\n gets(str);\n\n /* Initializes frequency of all characters to 0 */\n for(i=0; i<MAX_CHARS; i++)\n {\n freq[i] = 0;\n }\n\n\n /* Finds frequency of each characters */\n i=0;\n while(str[i] != '\\0')\n {\n ascii = (int)str[i];\n freq[ascii] += 1;\n\n i++;\n }\n\n\n /* Finds maximum frequency */\n max = 0;\n for(i=0; i<MAX_CHARS; i++)\n {\n if(freq[i] > freq[max])\n max = i;\n }\n if((freq[max])>k)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,k,i,l,j=0,c;\nscanf(\"%d %d\",&n,&k);\nchar s[100];\nscanf(\"%s\",&s);\nl=strlen(s);\nfor(i=0;i<l;i++){\n c=1;\n for(j=i+1;j<l;j++){\n if(s[i]==s[j]){\n c++;\n }\n\n }\n if(c==k){\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n\n}\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0;\n char s[1000];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i;j<strlen(s)-1;j++)\n {\n if(s[i]==s[j])\n {\n\n count++;\n\n }\n }\n }\n if(count%k==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint b_cnt = 'z' - 'a' + 1;\n\tint\tb_mas[ b_cnt ];\n\tmemset( b_mas, 0, sizeof( b_mas ));\n\tint n,k,i;\n\tchar sym;\n\tscanf( \"%d %d\", &n, &k );\n\tint ans = 1;\n\ti=0;\n\twhile ( i < n ) {\n\t\tscanf( \"%c\", &sym );\n\t\tif ( sym == ' ' || sym == '\\n')\n\t\t\tcontinue;\n\t\tb_mas[sym - 'a']++;\n\t\ti++;\n\t}\n\tfor ( i=0; i < n; i++ ) {\t\n\t\tif ( b_mas[i] > k ) {\n\t\t\tans = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", ans ? \"YES\" : \"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1001];\n int n,i,j,c,d,k;\n scanf(\"%d %d\",&n,&c);\n scanf(\"%s\",s);\n for (i=0;i<n; i++)\n {\n d=1;\n for (j=1; j<n; j++)\n {\n if (s[i]==s[j])\n {\n d++;\n\n }\n if (d>c)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1001];\n int n,i,j,c,d,k;\n scanf(\"%d %d\",&n,&c);\n scanf(\"%s\",s);\n for (i=0;i<n; i++)\n {\n d=1;\n for (j=1; j<n; j++)\n {\n if (s[i]==s[j])\n {\n d++;\n\n }\n if (d>c)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1001];\n int n,i,j,c,d,k;\n scanf(\"%d %d\",&n,&c);\n scanf(\"%s\",s);\n for (i=0;i<n; i++)\n {\n d=1;\n for (j=1; j<n; j++)\n {\n if (s[i]==s[j])\n {\n d++;\n\n }\n if (d>c)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0,max=0;\n char s[1000];\n char tem;\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i+1;j<strlen(s);j++)\n {\n if(s[i]>s[j])\n {\n tem=s[i];\n s[i]=s[j];\n s[j]=tem;\n }\n }\n\n }\n \n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i;j<strlen(s);j++)\n {\n if(s[i]==s[j])\n {\n\n count++;\n\n }\n else\n {\n if(count>=max)\n {\n max=count;\n count=0;\n }\n }\n }\n }\n if(max>k)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,k,j,i;\n\tint mas[27];\n\tchar s;\n\tfor (i=0;i<=27;i++)\n\t\tmas[i]=0;\n\tscanf(\"%d %d\",&n,&k);\n\tscanf(\"%c\",&s);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%c\",&s);\n\t\tmas[s-'a']++;\n\t}\n\tfor (i=0;i<=27;i++)\n\t\tif (mas[i]>k)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n int i,j,n,k,cnt=0,p;\n char a[110];\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",a);\n for(i=0;i<n-1;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]==a[j])\n {\n cnt++;\n }\n }\n }\n p=n-cnt;\n if(p>=k)printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\\n\",&n,&k);\n\tchar str[n+1];\n\tscanf(\"%s\",str);\n\tint i=0,j=0;\n\tint arr[26]={0};\n\tfor(i=0;i<n;i++)\n\t{\n\tfor(j=0;j<26;j++)\n\t{\n\t\tif(str[i]==j+97)\n\t\tarr[j]++;\n\t}\n\t}\n\tint count=0;\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(arr[i]>k)\n\t\tcount++;\n\t}\n\tif(count>=1)\n\tprintf(\"No\");\n\telse\n\tprintf(\"Yes\");\t\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[10000];\n int i,n,k,count[1000];\n scanf(\"%d%d\",&n,&k);\n scanf(\"%s\",s);\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n for(i=0;i<26;i++){\n if(count[i]==count[i+1]){\n printf(\"YES\");\n break;\n }\n else {\n printf(\"NO\");\n break;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0;\n char x[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n for(j=i+1;j<n;j++)\n {\n if(x[i]!=x[j]&&x[j]!='0')\n {\n k--;\n x[i]='0';\n x[j]='0';\n break;\n }\n }\n }\n }\n k=0;\n for(j=0;j<n;j++)\n {\n if(x[j]!='0')\n {\n k=1;\n break;\n }\n\n }\n if(k==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int fre[256];\n int n,k,i,j,l,m,c;\n scanf(\"%d %d\",&n,&k);\n c=0;\n char str[n+1];\n scanf(\"%s\",str);\n l=strlen(str);\n for(m=0;m<256;m++){\n fre[m]=0;\n }\n for(j=0;j<l;j++){\n fre[str[j]]++;\n }\n for(i=0;i<256;i++){\n if(fre[i]!=0){\n if(fre[i]<=k){\n c++;\n }\n }\n }\n if(c==k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX 101\ntypedef struct friend {\n\tchar color[MAX];\n\tstruct friend* next;\n} friend;\n\nfriend frnd[MAX];\n\nint check_and_write(friend* cur, char c){\n\tint i;\n\tfor (i = 0; cur->color[i] != '\\0'; i++)\n\t\tif (c == cur->color[i])\n\t\t\treturn 0;\n\tcur->color[i] = c;\n\treturn 1;\n}\n\nint main(void){\n\tfriend* p = &frnd[0];\n\tint n, k, i;\n\tchar c;\n\tscanf(\"%d %d\\n\", &n, &k);\n\tfor (i = 0; i < MAX; i++){\n\t\tp->next = &frnd[i];\n\t\tp = p->next;\n\t}\n\twhile ((c = getchar()) != EOF){\n\t\tfor(p = &frnd[0]; p; p = p->next){\n\t\t\tif (check_and_write(p, c))\n\t\t\t\tbreak;\n\t\t\tif(p->next == NULL){\n\t\t\t\tputs(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tputs(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,j,a,b=0,n,c,m;\nscanf(\"%d\",&n);\nscanf(\"%d\",&m);\nc=m;\nchar str[n];\nint A[105];\nfor(i=0;i<=n;i++){\n str[i]=getchar();\n}\nstr[i]='\\0';\nfor(i=0;i<=105;i++){\nA[i]=0;\n}\nfor(i=0;i<=strlen(str)-1;i++){\n for(j=i+1;j<=n;j++){\n if(str[j]=='0')\n continue;\n if(str[i]==str[j]){\n str[j]='0';\n A[i]=A[i]+1;\n }\n }\n}\nfor(i=0;i<=105;i++){\n if(A[i]==0)\n continue;\n if(A[i]+1>c){\n b=1;\n break;\n }\n}\nif(b==1)\n printf(\"NO\");\nelse if(b==0)\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint n,k,i,j,c;c=0;\n\tchar s[100];\n\tscanf(\"%d%d\\n\",&n,&k);\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(s[i]!=s[j]&& s[i]!=0)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t\ts[i]=0;s[j]=0;\n\t\t\t}\n\t\t}\n\t}\n\tif(c==k)\n\tprintf(\"yes\");\n\telse printf(\"no\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,b[105],flag=0;\n char s[105];\n memset(b,0,sizeof(b));\n scanf(\"%d%d%s\",&n,&k,s);\n for(int i=0;i<n;i++)\n {\n b[s[i]-'0']++;\n }\n if(k==1)\n {\n for(int i=40;i<=100;i++)\n if(b[i]>=2)\n flag=1;\n if(flag==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n else\n {\n for(int i=40;i<=100;i++)\n if(b[i]>2)\n flag=1;\n if(flag==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,count=1,count1=1,i,j;\n scanf(\"%d %d\",&n,&k);\n char ch[n+1];\n scanf(\"%s\",ch);\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ch[i]==ch[j])\n {\n count++;\n }\n }\n if(count>count1)\n {\n count1=count;\n count=1;\n }\n }\n if(count1<=k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint baloes, amigos, tabela[128] = {0}, i = 0;\n\tchar cor[100];\n\n\tscanf(\"%d %d\", &baloes, &amigos);\n\tscanf(\"%s\", cor);\n\twhile(cor[i] != '\\0') {\n\t\ttabela[cor[i]]++;\n\t\tif(tabela[cor[i] - 97] > 1);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile(i < 128) {\n\t\tif(tabela[i] > 1) {\n\t\t\tamigos--;\n\t\t\ttabela[i] -= 2;\n\t\t} else {\n\t\t\ti++;\n\t\t}\n\t}\n\tif(amigos != 0) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n\treturn 0;\n}\n/* 1506562664281 */\n"}, {"source_code": "#include<stdio.h>\nint main(){\nchar s[1000];\nint arr[30] ;\n\nint n ,k ,i ;\nfor(i = 0; i< 27 ; i++)\n arr[i] = 0;\n\nscanf(\"%d %d\",&n,&k);\ngetchar();\n\ngets(s);\n for(i = 0; i< n ;i++){\n arr[s[i]-'a']++;\n }\n\n\nint flag =0, j , count;\nj = k;\n\nwhile(k--){\n count = 0;\n for(i = 0 ;i<27 ;i++){\n if(arr[i] >0 )\n {\n arr[i]--;\n count++;\n\n }\n }\nif(count!= j ){\n flag =1;\n break;\n}\n}\nif(flag != 1)\n for(i = 0 ;i< 27 ;i++)\n if(arr[i] != 0){\n flag = 1;\n }\n\nif(flag == 1) printf(\"NO\\n\");\nelse printf(\"YES\\n\");\n\n\n\n\nreturn 0;}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,n,k=0;\n char x[100];\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",x);\n for(i=0;i<n;i++)\n {\n if(x[i]!='0')\n {\n for(j=i+1;j<n;j++)\n {\n if(x[i]!=x[j]&&x[j]!='0')\n {\n k--;\n x[i]='0';\n x[j]='0';\n break;\n }\n }\n }\n }\n k=0;\n for(j=0;j<n;j++)\n {\n if(x[j]!='0')\n {\n k++;\n break;\n }\n\n }\n if(k<=1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cnt[26];\n\nint main(void)\n{\n\tint n, k, a, num = 0;\n\tchar c;\n\tscanf(\"%d %d\", &n, &k);\n\tgetchar();\n\tfor (a = 0; a < n; a = a + 1)\n\t{\n\t\tc = getchar();\n\t\tcnt[c - 'a']++;\n\t}\n\tfor (a = 0; a < 26; a = a + 1)\n\t{\n\t\tif (cnt[a])\n\t\t\tnum++;\n\t\tif (cnt[a] && cnt[a] != n)\n\t\t{\n\t\t\tnum = -1;\n\t\t\tputs(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (num != -1 && num < n)\n\t\tputs(\"NO\");\n\telse if(num!=-1)\n\t\tputs(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,max = 0,c = 0;;\n char s[101],t[10] = \"\";\n scanf(\"%d%d%s\",&n,&k,s);\n for(i = 0; i < n; i++)\n {\n for(j = 0; j < n; j++)\n {\n if(s[i] < s[j])\n {\n t[0] = s[i];\n s[i] = s[j];\n s[j] = t[0];\n\n }\n }\n }\n for(i = 0; i < n-1; i++)\n {\n if(s[i] == s[i+1])\n {\n c++;\n }\n else\n {\n if(max < c)\n {\n max = c;\n }\n c = 0;\n }\n }\n max++;\n // printf(\"%d\",max);\n if(max > k)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,count=1,count1=1,i,j;\n scanf(\"%d %d\",&n,&k);\n char ch[n+1];\n scanf(\"%s\",ch);\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ch[i]==ch[j])\n {\n count++;\n }\n }\n if(count>count1)\n {\n count1=count;\n count=1;\n }\n }\n if(count1<=k)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char b[1000],a[1000];\n int i,j,n,k,c=0;\n scanf(\"%d %d\",&n,&k);\n gets(b);\n gets(a);\n if(n%k==0&&n>=k)\n {\n for(i=0;a[i]!='\\0';i++)\n {\n for(j=0;j<i;j++)\n {\n if(a[i]==a[j])\n {\n break;\n }\n }\n if(a[i]==a[j]&&i!=0)\n continue;\n else if(j==i)\n {\n for(;j<n;j++)\n {\n if(a[i]==a[j])\n {\n c++;\n }\n }\n }\n if(c>k)\n {\n printf(\"NO\");\n break;\n }\n }\n if(i==n&&c<=k)\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tint n, k;\n\tchar colors[1000000];\n\tint letras[26];\n\tchar letra;\n\tscanf(\"%d %d\", &n, &k);\n\n\tscanf(\"%s\", colors);\n\tint i_colors=0;\n\tint i_letras=0;\n\tletra = colors[0];\n\twhile(colors[i_colors]!='\\n'){\n\t\tletras[colors[i_colors]-97]++;\n\t\ti_colors++;\n\t}\n\tfor (int i = 0; i < 26; ++i)\n\t{\n\t\tif(letras[i]>k){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,k,i,j,count=0,tem,min=0;\n char s[1000];\n\n scanf(\"%d %d\",&n,&k);\n scanf(\"%s\",s);\n\n for(i=0;i<strlen(s);i++)\n {\n for(j=i+1;j<strlen(s);j++)\n {\n if(s[i]>s[j])\n {\n tem=s[i];\n s[i]=s[j];\n s[j]=tem;\n }\n }\n\n }\n\n\n for(i=0;i<strlen(s);i++)\n {\n count=0;\n for(j=i;j<strlen(s);j++)\n {\n if(s[i]==s[j])\n {\n\n count++;\n\n }\n else\n {\n if(min>count)\n {\n min=count;\n\n }\n }\n }\n }\n if(min>k)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#include<math.h>\n#define ll long long int\n\nint main()\n{\n int n,k,a[26],i,max=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<26;i++)\n a[i]=0;\n for(i=0;i<n;i++)\n {\n char c;\n scanf(\"%c\",&c);\n a[c-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>max)\n max=a[i];\n }\n if(max>k)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint n,k,i,j,d,z,c;\n char s[100];\n z=0;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<n;i++)\nscanf(\"%c\",&s[i]);\nfor(i=0;i<n;i++)\n{ c=0;\n\tfor(j=i+1;j<n;j++)\n\t{\n\t\tif(s[i]==s[j])\n\t\tc++;\n\t}if(c>=k)\n\t{ z++;\n\t\tprintf(\"NO\");\n\t\tbreak;\n\t}\n}if(z==0)\nprintf(\"YES\");}"}], "src_uid": "ceb3807aaffef60bcdbcc9a17a1391be"} {"nl": {"description": "Vasya likes to solve equations. Today he wants to solve $$$(x~\\mathrm{div}~k) \\cdot (x \\bmod k) = n$$$, where $$$\\mathrm{div}$$$ and $$$\\mathrm{mod}$$$ stand for integer division and modulo operations (refer to the Notes below for exact definition). In this equation, $$$k$$$ and $$$n$$$ are positive integer parameters, and $$$x$$$ is a positive integer unknown. If there are several solutions, Vasya wants to find the smallest possible $$$x$$$. Can you help him?", "input_spec": "The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq n \\leq 10^6$$$, $$$2 \\leq k \\leq 1000$$$).", "output_spec": "Print a single integer $$$x$$$\u00a0\u2014 the smallest positive integer solution to $$$(x~\\mathrm{div}~k) \\cdot (x \\bmod k) = n$$$. It is guaranteed that this equation has at least one positive integer solution.", "sample_inputs": ["6 3", "1 2", "4 6"], "sample_outputs": ["11", "3", "10"], "notes": "NoteThe result of integer division $$$a~\\mathrm{div}~b$$$ is equal to the largest integer $$$c$$$ such that $$$b \\cdot c \\leq a$$$. $$$a$$$ modulo $$$b$$$ (shortened $$$a \\bmod b$$$) is the only integer $$$c$$$ such that $$$0 \\leq c < b$$$, and $$$a - c$$$ is divisible by $$$b$$$.In the first sample, $$$11~\\mathrm{div}~3 = 3$$$ and $$$11 \\bmod 3 = 2$$$. Since $$$3 \\cdot 2 = 6$$$, then $$$x = 11$$$ is a solution to $$$(x~\\mathrm{div}~3) \\cdot (x \\bmod 3) = 6$$$. One can see that $$$19$$$ is the only other positive integer solution, hence $$$11$$$ is the smallest one."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int total=n*k+1;\n int result,result2;\n int c;\n for(int i=1;i<=n;i++)\n {\n if(n%i==0)\n {\n c=n/i;\n if(i<k)\n result=k*c+i;\n \n if(c<k)\n result2=k*i+c;\n \n if(i<k){\n if(result<total)\n total=result;}\n \n if(c<k)\n {\n if(result2<total)\n total=result2;\n }\n }\n }\n printf(\"%d\",total);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long int\n int main(){\n ll n,k;\n scanf(\"%lld%lld\",&n,&k);\n ll t,r,x=1000000000000,temp;\n for(ll i=1;i<k;i++){\n if(n%i==0){\n t=n/i;r=i;\n temp=k*t+r;\n if(temp<x)\n x=temp;\n }\n }\n printf(\"%lld\\n\",x);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define MAX 100000\n/*int temp[MAX];\nvoid mergesort(int a[],int b[],int indices[],int first,int last)\n{\n if(first==last) return;\n int middle=(first+last)/2;\n mergesort(a,b,indices,first,middle);\n mergesort(a,b,indices,middle+1,last);\n int i,j,k;\n for(i=first,j=first,k=middle+1;i<=last;i++)\n {\n if(j==middle+1) temp[i]=indices[k++];\n else if(k==last+1) temp[i]=indices[j++];\n else if(a[indices[k]]-b[indices[k]]>a[indices[j]]-b[indices[j]]) temp[i]=indices[k++];\n else temp[i]=indices[j++];\n }\n for(i=first;i<=last;i++)\n {\n indices[i]=temp[i];\n }\n}*/\n\nint main()\n{\n int k,n,i,j;\n scanf(\"%d %d\",&n,&k);\n int x;\n int remainder;\n for(remainder=k-1;remainder>=1&&n%remainder;remainder--);\n x=k*(n/remainder)+remainder;\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, k;\n\tint d;\n\tint ans = 1000000007;\n\tint buf;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\td = 1;\n\n\twhile (d != n + 1)\n\t{\n\t\tif (n % d == 0 && n / d < k)\n\t\t{\n\t\t\tbuf = d * k + n / d;\n\t\t\tans = ans > buf ? buf : ans;\n\t\t}\n\t\td++;\n\t}\n\n\tprintf(\"%d\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n long long x = 0, n, k, i, j, confirm = 0;\n scanf(\"%lld %lld\", &n, &k);\n\n j = 1;\n while (1)\n {\n for (i = 1; i < k && i * j <= n; i++)\n if (n % i == 0)\n {\n x = k * j + i;\n if (i * j == n)\n {\n confirm = 1;\n break;\n }\n }\n if (confirm == 1)\n break;\n j++;\n }\n printf(\"%lld\\n\", x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tint n, k, m, i;\n\tscanf(\"%d %d\", &n, &k);\n\ti = k;\n\t--k;\n\twhile(n % k != 0)\n\t{\n\t\t--k;\n\t}\n\tm = n / k;\n\tprintf(\"%d\\n\", m * i + k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,term;\n long long min=100000000000000000;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i<=n && i<k;i++){\n if(n%i==0){\n term=(n/i)*k +i;\n }\n if(term<min){\n min=term;\n }\n }\n printf(\"%lld\\n\",min);\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{ // (x/k)*(x%k)==n\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\t int min=999999999;\n\tfor(int i=1;i<k;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tint x=(n/i)*k;\n\t\t\tfor(int j=0;j<k;j++)\n\t\t\tif((x+j)%k==i)\n\t\t\t{\n\t\t\t if(x+j<min)\n\t\t\t min=x+j;\n\t\t\t\n\t\t\t}\n\n\t\t}\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,n,i,k;\n scanf(\"%d%d\",&n,&k);\n\n if(n<k)\n {\n printf(\"%d\\n\",n+k);\n return 0;\n }\n for(i=k-1;i>0;i--)\n {\n if(n%i==0)\n {\n printf(\"%d\\n\",((n*k)/i)+i);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint n,k;\n\nint main(){\n\tscanf(\"%d %d\", &n,&k);\n\tfor(int i=k-1;i>0;i--){\n\t\tif(n%i==0){\n\t\t\tprintf(\"%d\", i+(n/i)*k);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\nint n,k,i,val,min;\n\nscanf(\"%d%d\",&n,&k);\n\n\nif(n!=0)\n{\n for(i=1; i<=k-1; i++)\n{\n if(n%i==0)\n{\n val=i+(n/i)*k;\nif(i==1)\nmin=val;\n\nelse if(val<min)\nmin=val;\n}\n}\n}\nelse\nmin=1;\nprintf(\"%d\",min);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint n,k,a,i = 1,e;\n\tscanf(\"%d %d\",&n,&k);\n\t\n\t{ e = k-1;\n\t while(n%e != 0){\n\t \n\t i++;\n\t e =k-i;\n\t }\n\t a =( (n/e)*k + e);\n\t \n\t \n\t}\n\t/*else\n\ta = k + n;*/\n\tprintf(\"%d\",a);\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nint n,k;\nint main(){\n // freopen(\"input.txt\",\"r\",stdin);\n scanf(\"%d %d\",&n,&k);\n int i,x,mn=2147483640;\n for(i=1;i<k;i++){\n if((n/i)*i!=n)continue;\n x=(n/i)*k+i;\n if(mn>x)mn=x;\n }\n printf(\"%d\\n\",mn);\n}\n"}, {"source_code": "#include<stdio.h>\nlong long a[1005];\nint main()\n{\n\tlong long n,k,x;\n\tint i,j=0; \n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(i=1;i<k;i++)\n\t{\n\t\tif(n%i!=0) continue;\n\t\telse a[j++]=k*(n/i)+i;\n\t}\n\tx=a[j-1];\n\tprintf(\"%lld\\n\",x);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,j,n,k,l;\n\tlong long int min,x;\n\tscanf(\"%d %d\",&n,&k);\n\tmin=n*k+1;\n\tfor(i=1;i<k;i++){\n\t\tif(n%i==0){\n\t\t\tj=n/i;\n\t\t\tif(j!=0){\n\t\t\t\tx=k*j+i;\n\t\t\t\tif(x<min)\n\t\t\t\t\tmin=x;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",min);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\ntypedef long long ll;\nll MAX = -100000000000;/*1e11*/\nll MIN = 100000000000;\n\nll gcd(ll a, ll b) \n{ \n if (b == 0) \n return a; \n return gcd(b, a % b); \n \n}\n\nint main(int argc, char const *argv[])\n{\n ll N,k;\n scanf(\"%lld %lld\",&N,&k);\n ll Array[N];\n ll i = k-1;\n \n while(N%i!=0&&i>1)\n {\n i--;\n }\n // printf(\"%lld\\n\",i);\n ll por = i;\n ll o = N/(i);\n ll answer = o*k+i;\n printf(\"%lld\\n\",answer);\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,k,i=1,j,x;\n\tscanf(\"%d%d\",&n,&k);\n\twhile(1){\n\t\tj=n/i;\n\t\tif(j*i==n&&j<k){\n\t\t\tx=i*k+j;\n\t\t\tbreak;\n\t\t}\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",x);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, k, i, j = 0, h, ans;\n static int aofd[1000001] = {0};\n scanf(\"%i %i\", &n, &k);\n for(i=1; i<=n; ++i){\n if(n%i == 0){\n aofd[j++] = i;\n }\n }\n for(i=0; i<j; ++i){\n h = aofd[i]*k+n/aofd[i];\n aofd[i] = (((h/k)*(h%k)) == n) ? h : 0;\n }\n ans = aofd[0];\n for(i=0; i<j; ++i){\n if(ans == 0) ans = aofd[i];\n if(ans > aofd[i] && aofd[i]) ans = aofd[i];\n }\n\n printf(\"%i\", ans);\n return;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{ \n int n,k;\n scanf(\"%d%d\",&n,&k);\n int i;\n int t;\n double p=0;\n for(i=k-1;i>=1;i--){\n p=n/i;\n if(p*i==n)\n break;\n }\n t=i+((n/i)*k);\n printf(\"%d\",t);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,t,ans;\n scanf(\"%lld %lld\",&n,&k);\n t=n*k;\n for (int i=k-1;i>=0;i--)\n {\n if (t%i==0) {\n ans=t/i+i;\n if (ans%k==i) {\n printf(\"%lld\",ans);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tlong long n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tint i;\n\tlong long res=1000000000000000,can;\n\tfor(i=1;i<k;i++)if(n%i==0){\n\t\tcan=k*n/i+i;\n\t\tif(can<res)res=can;\n\t}\n\tprintf(\"%lld\\n\",res);\n\t\n\treturn 0;\n}"}, {"source_code": " #include<stdio.h>\n \n int n,k;\n \n int main(){\n \tscanf(\"%d %d\", &n,&k);\n \tfor(int i=k-1;i>0;i--){\n \t int a;\n \t\tif(n%i==0){\n \t\t\tprintf(\"%d\", i+(n/i)*k);\n \t\t\treturn 0;\n \t\t}\n \t}\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{long int n,k,i;\nscanf(\"%ld %ld\",&n,&k);\nfor(i=k-1;i>0;i--)\n{\n if(n%i==0)\n {\n\n break;\n }\n}\nlong int ans=(n*k)/i+i;\nprintf(\"%ld\",ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=k-1;i>0;i--)\n {\n if(n%i==0)\n {printf(\"%d\",i+(n/i)*k);break;}\n \n }\n \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n long int a,b;\n scanf(\"%ld %ld\",&a,&b);\n if(a==999983 && b==1000)\n printf(\"%d\",999983001);\n else if(a==994009 && b==997)\n {\n printf(\"%d\",991026974);\n }\n else\n {\n long int x=a+b;\n long int y=x/b;\n long int z=x%b;\n while(y*z!=a) \n {\n x=x+1;\n y=x/b;\n z=x%b;\n if (y*z==a)\n break;\n }\n printf(\"%ld\",x);\n }\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tlong int n,k,ans;\n\tscanf(\"%ld%ld\",&n,&k);\n\tfor(long int b=k-1;b>=1;b--){\n\t\tif(n%b == 0){\n\t\t\tlong int a=n/b;\n\t\t\tans = a*k+b;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%ld\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#define MIN(a,b) a<b?a:b\n#define MAX(a,b) a>b?a:b\n#define rep(i,a,b) for(i=a;i<b;i++)\n#define rev(i,a,b) for(i=a;i>b;i--)\n#define sf(a) scanf(\"%d\",&(a))\n#define pf(a) printf(\"%d\",(a))\n#define sfll(a) scanf(\"%lld\",&(a))\n#define pfll(a) printf(\"%lld\",(a))\n#define ssf(a) scanf(\"%s\",(a))\n#define spf(a) printf(\"%s\",(a))\n#define nl printf(\"\\n\")\n#define play int main()\n#define out return\ntypedef int I;\ntypedef long long LL;\ntypedef char S;\ntypedef float F;\ntypedef double D;\n/*int cmp(const void *a,const void *b)\n{\n return (*(int*)a-*(int*)b);\n}*/\nplay\n{\n LL n,k,i;\n sfll(n);\n sfll(k);\n rev(i,k-1,0)\n {\n if(n%i==0)\n {\n pfll(k*(n/i)+i);\n nl;\n out 0;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main() {\n int n,k,div1,mod;\n long int i=0,x=0;\n scanf(\"%d %d\",&n,&k);\n for(i=k-1;i>0;i--)\n {\n if(n%i==0)\n {\n break;\n }\n }\n x=(n*k)/i+i;\n printf(\"%ld\",x);\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,k;\n scanf(\"%d %d\",&n,&k);\n int x=k-1;\n while(1){\n if(n%x==0){\n break;\n }\n x--;\n }\n int m=n/x;\n int a=m*k;\n while(1){\n if((a/k)*(a%k)==n){\n break;\n }\n a++;\n }\n printf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <math.h>\n\nint main(void){\n\n long long n, k, i, x = 0;\n\n scanf(\"%lld %lld\", &n, &k);\n\n for(i = k - 1; i >= 1; i--){\n if(n % i == 0){\n x = k * (n / i) + i;\n break;\n }\n }\n\n printf(\"%lld\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n long long int k;\n long long int ans=0;\n long long int i;\n long long int sol=1000000000000;\n long long int xtemp;\n long long int l;\n long long int r;\n long long int tempsol;\n long long int j;\n\n scanf(\"%lld %lld\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if( (n%i)==0)\n {\n l=(n/i);\n r=(n/l);\n xtemp=l*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == r)&&(tempsol<sol)) sol=tempsol;\n }\n xtemp=r*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == l)&&(tempsol<sol)) sol=tempsol;\n }\n }\n }\n printf(\"%lld\\n\",sol);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint get_int();\n\nint max(int a, int b)\n{\n\tif (a > b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint min(int a, int b)\n{\n\tif (a < b)\n\t{\n\t\treturn a;\n\t}\n\treturn b;\n}\n\nint main()\n{\n\tint i, j;\n\tint n = get_int();\n\tint k = get_int();\n\n\tint x = 1000000000;\n\tfor (i = 1; i < k; i++)\n\t{\n\t\tif (n%i == 0)\n\t\t{\n\t\t\tint t = n/i;\n\t\t\tx = min(x, k*t + i);\n\t\t}\n\t}\n\tprintf(\"%d\\n\", x);\n\n\treturn 0;\n}\n\n\n\nint get_int()\n{\n\tint ret = 0;\n\tchar c = getchar();\n\tint sgn;\n\n\twhile (1)\n\t{\n\t\tif (c == EOF)\n\t\t{\n\t\t\treturn EOF;\n\t\t}\n\t\tif (c >= '0' && c <= '9')\n\t\t{\n\t\t\tsgn = 1;\n\t\t\tbreak;\n\t\t}\n\t\tif (c == '-')\n\t\t{\n\t\t\tc = getchar();\n\n\t\t\tif (c < '0' || c > '9')\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tsgn = -1;\n\t\t\tbreak;\n\t\t}\n\t\tc = getchar();\n\t}\n\n\twhile (1)\n\t{\n\t\tret = (ret << 3) + (ret << 1) + c - '0';\n\n\t\tc = getchar();\n\n\t\tif (c < '0' || c > '9')\n\t\t{\n\t\t\treturn sgn*ret;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint ans = 2147483647;\n\tfor (int i = 1; i*i <= n && i <= k; ++i)\n\t{\n\t\tif( (n%i) == 0 )\n\t\t{\n\t\t\tif(n/i < k)\n\t\t\t{\n\t\t\t\tint tmp = i*k+(n/i);\n\t\t\t\tif(tmp < ans)\n\t\t\t\t\tans = tmp;\n\t\t\t}\n\t\t\tif(i < k)\n\t\t\t{\n\t\t\t\tint tmp2 = (n/i)*k+i;\n\t\t\t\tif(tmp2 < ans)\n\t\t\t\t\tans = tmp2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,k,q,r;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i<k;i++)\n {\n if(n%(k-i)==0)\n {\n q=n/(k-i);\n r=k-i;\n break;\n }\n }\n int x=k*q +r;\n printf(\"%d\",x);\n\t// your code goes here\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include<stdio.h>\n#include<limits.h>\n\nmain()\n{\n\t int n, k, i, temp, temp2, min, small, large, a, b;\n\t \n\t scanf(\"%d%d\",&n,&k);\n\t a = 0;\n\t b = 1;\n\t min = INT_MAX;\n\t for( i=1; i<=n && a <= b ; i++ )\n\t {\n\t \t if( n % i == 0 )\n\t \t {\n\t \t a = i;\n\t\t\tb = n/i;\n\t\t\tif( a > b )\n\t\t\t break;\n\n if( a >= k )\n {\n \ttemp = a * k + b; \n \t\n\t\t\t}\n\t\t\telse if( b >= k )\n\t\t\t temp = b * k + a;\n\t\t\telse\n\t\t\t{\n\t\t\t\t temp = a * k + b;\n\t\t\t\t temp2 = b * k + a;\n\t\t\t\t temp = temp < temp2 ? temp : temp2;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif( min > temp && ((temp/k)*(temp%k) == n))\n\t\t\t min = temp; \t\n\t\t\n\t\t }\n\t }\n\t printf(\"%d\\n\",min);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,x,p,q,i=1,m,min=999999999;\n scanf(\"%d %d\", &a, &b);\n while(1){\n if(a%i==0){\n x=a/i;\n m=(b*x)+i;\n p=m%b;\n q=m/b;\n if((p*q)==a){\n if(min>m){\n min=m;\n }\n }\n }\n if(i==a) break;\n i++;\n }\n printf(\"%d\", min);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int p=k*n+1;\n int q=k+n;\n int ans;\n if(1<k&&n<k){if(p<q)ans=p;else ans=q;}\n else if(n<k)ans=q;\n else if(1<k)ans=p;\n for(int i=2;i<=sqrt(n);i++)\n {\n int a;\n if(n%i==0)\n {\n int x=k*i+(n/i);\n int y=k*(n/i)+i;\n if(i<k&&(n/i)<k){if(x<y)a=x;else a=y;}\n else if((n/i)<k)a=x;\n else if(i<k)a=y;\n else continue;\n if(a<ans)ans=a;\n }\n else continue;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,k,x,i;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n \tfor(i=k-1;i>0;i--){\n\t\tif(n%i==0){\n\t\t\tprintf(\"%d\",i+(n/i)*k);\n\t\tbreak;\n\t\t\n\t\t}\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,x,i,s,a,b;\n scanf(\"%lld %lld\",&n,&k);\n for(i=k-1;i>=1;i--)\n {\n if(n%i==0)\n {\n a=n/i;\n b=i;\n break;\n }\n }\n s=a*k+b;\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t// (x div k) * (x mod k) = n\n\tint n, k, x;\n\tint ans;\n\tint i;\n\n\tscanf(\"%d %d\", &n, &k);\n\t\n\tfor (i = 1; i <= n; i++) {\n\t\tif (i == k)\t\t\t\t\t\t\t\t\t// mod\ud558\ub294 \uc218\ubcf4\ub2e4 \ud06c\uba74 \ub354 \ud560\uc218\uac00 \uc5c6\ub2e4\n\t\t\tbreak;\n\t\tif (i == 1)\t\t\t\t\t\t\t\t\t// \ucc98\uc74c x \uac12 \uc815\ud558\uae30\n\t\t\tx = k * (n / i) + i;\n\t\tif (n%i == 0 && i < k) {\t\t\t\t\t// \ub098\ub204\uc5b4 \ub5a8\uc5b4\uc9c8 \ub54c\n\t\t\tans = k * (n / i) + i;\n\t\t\tif (x >= ans) {\n\t\t\t\tx = ans;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", x);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t// (x div k) * (x mod k) = n\n\tint n, k, x;\n\tint ans;\n\tint *arr;\n\tint i;\n\n\tscanf(\"%d %d\", &n, &k);\n\t\n\tfor (i = 1; i <= n; i++) {\n\t\tif (i == k)\n\t\t\tbreak;\n\t\tif (i == 1)\n\t\t\tx = k * (n / i) + i;\n\t\tif (n%i == 0 && i < k) {\t\t\t\t\t// \ub098\ub204\uc5b4 \ub5a8\uc5b4\uc9c8 \ub54c\n\t\t\tans = k * (n / i) + i;\n\t\t\tif (x >= ans) {\n\t\t\t\tx = ans;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", x);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,a,x,i;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i<k;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\ta=i;\n\t\t\n\t\t}\n\t\t\n\t}\n\tx=n/a*k+a;\n\tprintf(\"%d\",x);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,i,x,k;\nint main()\n{\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<k;++i)\n if(n%i==0)\n x=i;\n printf(\"%d\",((n/x*k)+x));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\nlong long int test;\n\n\nlong long int n,k,i,d,b,x,count,m,y,max=0,j,a[1011000]={0},c,flag,A,W,min;\n\nscanf(\"%lld%lld\",&n,&k);\nfor(i=k-1;i>=0;i--){\n if(n%i==0){\n x=(n*k)/i;\n x+=i;\n printf(\"%lld\\n\",x);\n return 0;\n }\n}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a[1006][1006],b2,k;\n\nscanf(\"%lld%lld\",&n,&k);\nf=0;\nfor(i=k-1;i>0;i--){\n \n if(n%i==0){\n printf(\"%lld\",((n*k)/i)+i);\n return 0;\n } \n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\n for(i=0;i<k;i++)\n {\n for(j=1;j<=n;j++)\n {\n if(i*j==n)\n {x=k*j+i;break;}\n \n }\n }\n printf(\"%d\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\nint x,n,k,i;\nscanf (\"%d %d\",&n,&k);\n//for(){\n//}\nfor(i=0;;i++){\n \nfor(x=0;x<k;x++){\n \n if((i)*(x)==n){\n x=x+i*k;\n printf(\"%d\",x);\n return 0;\n }\n}\n\n}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong int n,k,ans;\n\tscanf(\"%ld%ld\",&n,&k);\n\tfor(long int b = k-1;b >= 1;b--){\n\t\tif(n % b == 0){\n \t\t\tlong int a = n/b;\n\t\t\tans = a*k+b;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%ld\",ans);\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n, k, s;\n\t\n\tscanf(\"%d %d\", &n, &k);\n\ts=k;\n\t\n\tif(n==k)\n\t{\n\t\tprintf(\"%d\", (n*k)+1);\n\t}\n\telse if(k>n)\n\t{\n\t\tprintf(\"%d\", n+k);\n\t}\n\telse\n\t{\n\t\twhile(s--)\n\t\t{\n\t\t\tif(n%s==0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", (k*(n/s))+s);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, k;\n\n scanf(\"%d%d\", &n, &k);\n\n int maxi=1;\n\n for (int i=maxi; i<k; i++){\n if (n%(k-i)==0){\n maxi=i;\n break;\n }\n }\n\n for (int i=k*n/(k-maxi); ; i++){\n if (i/k*(i%k)==n){\n printf(\"%d\\n\", i);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint i,x,p=0,j;\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tif(n==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\texit(1);\n\t\t\n\t}\n\ti=1;\n/*\tx=k+1;\n/*\twhile(1)\n\t{//printf(\"dfj\\n\");\n\t\tif((x/k)*(x%k)==n)\n\t\t{\n\t\t\tprintf(\"%d\\n\",x);\n\t\t\tbreak;\n\t\t}\n\t\tx++;\n\t}\n\t*/\n\tp=0;\n\twhile(1)\n\t{\n\t\t\tx=i*k;\n\tfor(j=1;j<k;j++)\n\t{\n\t\tif(\ti*j==n)\n\t\t{\n\t\t\tprintf(\"%d\",x+j);\n\t\t\tp=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\ti=i+1;\n\tif(p==1)\n\tbreak;\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\nint n,k;\nint main()\n{\n\tscanf(\"%d %d\", &n,&k);\n\tfor(int i=k-1;i>0;i--)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tprintf(\"%d\", i+(n/i)*k);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint a,b;\nint main()\n{\n\tscanf(\"%d %d\", &a,&b);\n\tfor(int i=b-1;i>0;i--)\n\t{\n\t\tif(a%i==0)\n\t\t{\n\t\t\tprintf(\"%d\", i+(a/i)*b);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n\n for(i=0;i<k;i++)\n {\n for(j=1;j<=n;j++)\n {\n if(i*j==n){x=k*j+i;break;}\n }\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, k;\n int ans = 0x7fffffff;\n scanf(\"%d %d\", &n, &k);\n for(int i = 1; i < k; ++i) {\n if(n % i == 0) {\n int cur = n / i * k + i;\n if(ans > cur) {\n ans = cur;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,i,x;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tif(n%i==0 && k>n/i){\n\t\t\tx=i*k+(n/i);\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",x);\n}"}, {"source_code": "#include <stdio.h>\n\nvoid divNum (int n, int a[]);\n\nint main() {\n\tint k, n, div[2000], r = 0, b = 0, b1 = 0, min;\n\tlong x = 1;\n\t\n\tscanf (\"%d %d\", &n, &k);\n\n\tdivNum (n, div);\n\n\twhile (div[r] != -1 ) {//&& (x / k) * (x % k) != n) {\n\t\tif (b1 == 0) {\n\t\t\tx = div[r] % k;\n\t\t\tb1++;\n\t\t}\n\t\tif ((x / k) * (x % k) > n || x % k == 0) {\n\t\t\tr++;\n\t\t\tb1 = 0;\n\t\t}\n\t\telse\n\t\t\tx += k;\n\t\tif ((x / k) * (x % k) == n)\n\t\t\tif (b == 0) {\n\t\t\t\tmin = x;\n\t\t\t\tb++;\n\t\t\t}\n\t\t\telse \n\t\t\t\tif (x < min)\n\t\t\t\t\tmin = x;\n\t}\n\n\tprintf (\"%ld\\n\", min);\n\n\treturn 0;\n}\n\nvoid divNum (int n, int a[]) {\n\tint i, r = 0;\n\n\tfor (i = 1; i * i <= n; i++) \n\t\tif (n % i == 0) {\n\t\t\ta[r++] = n / i;\n\t\t\ta[r++] = i;\n\t\t}\n\ta[r] = -1;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\n\nunsigned long int a=0;//\u043a\u043e\u043b-\u0432\u043e cnhjr\nunsigned long int b=0;//\u043a\u043e\u043b-\u0432\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432\n\n\nunsigned long int n=0,x=0;\nunsigned int k=0,c=0;\n\nint main()\n{\n scanf(\"%ld %d\", &n,&k);\n \n \n \n b=0;\n c=k;\n while(c>1)\n {\n c=c-1;\n if((n%c)==0)\n {\n b=c;\n break;\n }\n \n }\n \n a=n/b;\n \n x=a*k+b;\n \n printf(\"%ld\",x);\n \n \n \n \n \n \n \n \n \n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,q,x;\n scanf(\"%lld %lld\",&n,&k);\n x=k;\n q=n/(k-1);\n if(n%(k-1)!=0)\n {k=k-1;\n while(n%k!=0)\n {k--;}\n }\n else\n {k--;}\n q=n/k;\n printf(\"%lld\",x*q+k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,min;\n scanf(\"%lld %lld\",&n,&k);\n min=n*k+1;\n for(long long i=1,temp;i<k;i++)\n {\n if(!(n%i))\n {\n temp=(n/i)*k+i;\n min=(temp<min)?temp:min;\n }\n }\n printf(\"%lld\",min);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n\nint main(){\n int n,k,x,first,temp,i;\n scanf(\"%d %d\",&n,&k);\n x = INT_MAX;\n for(i=1;i<k;i++){\n if(n%i==0){\n first = n/i;\n temp = first*k + i;\n if(temp<x)\n x = temp;\n }\n }\n printf(\"%d\\n\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n long long int i,j,k,l,m,n,h,c=0;;\n scanf(\"%lld%lld\",&n,&m);\n k=1;\n for(k=1;k<m;k++)\n {\n h=(n*m)%k;\n if(h==0) {\n l=(n*m)/k+k;\n if((l/m)*k==n){\n if(c==0) j=l;\n c++;\n if(c>1) {\n if(j>l) j=l;\n }\n }\n }\n }\n printf(\"%lld\",j);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,n,x;\n int m,d;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\n for(m =0;m<k;m++){\n for(d = 1;d<=n;d++){\n if(d*m==n){\n x=k*d+m;\n break;\n }\n }\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nll minn(ll a,ll b)\n{\nreturn (a<b)?a:b;\n}\nint main()\n{\n ll n,k,nnn=1e18;\n scanf(\"%lld%lld\",&n,&k);\n \n for(ll i=1;i<=sqrt(n);i++)\n {\n if(n%i==0)\n {\n ll a=i,b=n/i,aa=1e18,bb=1e18;\n //printf(\"%d %d\\n\",a,b);\n if(b<k)\n aa=(a*k)+b;\n if(a<k)\n bb=(b*k)+a;\n //printf(\"%lld %lld\\n\",aa,bb);\n /*if(aa%k==0)\n {\n //aa=1e9;\n int min=bb;\n if(min<nnn)\n nnn=min;\n }\n else if(bb%k==0)\n {\n //bb=1e9;\n int min=aa;\n if(min<nnn)\n nnn=min;\n }\n else*/\n //if(aa%k!=0&&bb%k!=0)\n {\n ll min=minn(aa,bb);\n if(min<nnn)\n nnn=min;\n }\n }\n }\n printf(\"%lld\",nnn);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main(){\n\tint i = 0, k, n, x;\n\t\n\tscanf(\"%d %d\", &n, &k);\n\t\n\twhile(1){\n\t\t\tfor(x = 0; x < k; x++){\n\t\t\t\tif(n == x*i) {printf(\"%d\", x + i*k); return 0;}\n\t\t\t\t//printf(\"%d\\n\", div(i,k).quot * div(i,k).rem);\n\t\t\t}\n\t\ti++;\n\t}\n\t\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,x,i,s,a,b;\n scanf(\"%lld %lld\",&n,&k);\n for(i=k-1;i>=1;i--)\n {\n if(n%i==0)\n {\n a=n/i;\n b=i;\n break;\n }\n }\n s=a*k+b;\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int x,t;\n for(int i=k-1;i>0;i--){\n if (n%i==0){\n t=i;\n break;\n }\n }\n x=k*n/t+t;\n printf(\"%d\",x);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int total=n*k+1;\n int result,result2;\n int c;\n for(int i=1;i*i<=n;i++)\n {\n if(n%i==0)\n {\n c=n/i;\n result=k*c+i;\n \n if(c<k)\n result2=k*i+c;\n if(result<total)\n total=result;\n if(c<k)\n {\n if(result2<total)\n total=result2;\n }\n }\n }\n printf(\"%d\",total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int total=n*k+1;\n int result,result2;\n int c;\n for(int i=1;i*i<=n;i++)\n {\n c=n/i;\n result=k*c+i;\n \n if(c<k)\n result2=k*i+c;\n if(result<total)\n total=result;\n if(c<k)\n {\n if(result2<total)\n total=result2;\n }\n }\n printf(\"%d\",total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int total=n;\n int result,result2;\n int c;\n for(int i=1;i*i<=n;i++)\n {\n if(n%i==0)\n {\n c=n/i;\n result=k*c+i;\n \n if(c<k)\n result2=k*i+c;\n if(result<total)\n total=result;\n if(c<k)\n {\n if(result2<total)\n total=result2;\n }\n }\n }\n printf(\"%d\",total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, k;\n\tint d, r;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\td = 1;\n\n\twhile (1)\n\t{\n\t\tif (n % d == 0 && (n / d < d) || (n / d < k))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\td++;\n\t}\n\n\tprintf(\"%d\", d * k + n / d);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, k;\n\tint d, r;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\td = 1;\n\n\twhile (1)\n\t{\n\t\tif (n % d == 0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\td++;\n\t}\n\n\tprintf(\"%d\", d * k + n / d);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, k;\n\tint d;\n\tint ans = 1000000007;\n\tint buf;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\td = 1;\n\n\twhile (d != n + 1)\n\t{\n\t\tif (n % d == 0 && ((n / d < d) || (n / d < k)))\n\t\t{\n\t\t\tbuf = d * k + n / d;\n\t\t\tans = ans > buf ? buf : ans;\n\t\t}\n\t\td++;\n\t}\n\n\tprintf(\"%d\", ans);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,term,min=1000000;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i<k;i++){\n if(n%i==0){\n term=(n/i)*k +i;\n }\n if(term<min){\n min=term;\n }\n }\n printf(\"%d\\n\",min);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,term,min=1000000;\n scanf(\"%d%d\",&n,&k);\n for(int i=1;i<=n && i<k;i++){\n if(n%i==0){\n term=(n/i)*k +i;\n }\n if(term<min){\n min=term;\n }\n }\n printf(\"%d\\n\",min);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=1;i<10000;i++)\n\t{\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main ()\n{ // (x/k)*(x%k)==n\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\t int min=9999999;\n\tfor(int i=1;i<k;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tint x=(n/i)*k;\n\t\t\tfor(int j=0;j<k;j++)\n\t\t\tif((x+j)%k==i)\n\t\t\t{\n\t\t\t if(x+j<min)\n\t\t\t min=x+j;\n\t\t\t\n\t\t\t}\n\n\t\t}\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k); \n\tfor(long long int i=0;i<90000001;i++)\n\t{\n\t\tif(i/k>=n/2)\n\t\tcontinue;\n\t\tif(i%k==0)\n\t\tcontinue;\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main ()\n{ // (x/k)*(x%k)==n\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint min=999999;\n\tfor(int i=1;i<=1000;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tint x=(n/i)*k;\n\t\t\tfor(int j=0;j<k;j++)\n\t\t\tif((x+j)%k==i)\n\t\t\t{\n\t\t\t if(x+j<min)\n\t\t\t min=x+j;\n\t\t\t\n\t\t\t}\n\n\t\t}\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(long long int i=0;i<10000111;i++)\n\t{\n\t\tif(i%k==0)\n\t\tcontinue;\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k); \n\tfor(long long int i=0;i<10000000;i++)\n\t{\n\t\tif(i%k==0)\n\t\tcontinue;\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k); \n\tfor(long long int i=0;i<50000000;i++)\n\t{\n\t\tif(i%k==0)\n\t\tcontinue;\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k); \n\tfor(long long int i=0;i<80000000;i++)\n\t{\n\t\tif(i%k==0)\n\t\tcontinue;\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main ()\n{ // (x/k)*(x%k)==n\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\t int min=9999999;\n\tfor(int i=1;i<=1000;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\tint x=(n/i)*k;\n\t\t\tfor(int j=0;j<k;j++)\n\t\t\tif((x+j)%k==i)\n\t\t\t{\n\t\t\t if(x+j<min)\n\t\t\t min=x+j;\n\t\t\t\n\t\t\t}\n\n\t\t}\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(int i=1;i<1000001;i++)\n\t{\n\t\tif((i/k)*(i%k)==n)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,n,i,k;\n scanf(\"%d%d\",&n,&k);\n\n printf(\"%d\\n\",(n/k)+n+k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n,k,a;\n\tscanf(\"%d %d\",&n,&k);\n\tif(k-1<n)\n\ta = (n/(k-1))*k + k-1;\n\telse\n\ta = k + n;\n\tprintf(\"%d\",a);\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, k, i, j = 0, h, ans;\n static int aofd[1000001] = {0};\n scanf(\"%i %i\", &n, &k);\n for(i=1; i<=n; ++i){\n if(n%i == 0){\n aofd[j++] = i;\n }\n }\n for(i=0; i<j; ++i){\n h = aofd[i]*k+n/aofd[i];\n aofd[i] = h%k ? h : 0;\n }\n ans = aofd[0];\n for(i=0; i<j; ++i){\n if(ans == 0) ans = aofd[i];\n if(ans > aofd[i] && aofd[i]) ans = aofd[i];\n }\n\n printf(\"%i\", ans);\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,k,i;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<10000000;i++)\n {\n if(((i/k) * (i%k))==n)\n {printf(\"%d\",i);break;}\n \n }\n \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n long int a,b;\n scanf(\"%ld %ld\",&a,&b);\n if(a==999983 && b==1000)\n printf(\"%d\",999983001);\n else if(a==994009 && b==997)\n {\n printf(\"%d\",995006);\n }\n else\n {\n long int x=a+b;\n long int y=x/b;\n long int z=x%b;\n while(y*z!=a) \n {\n x=x+1;\n y=x/b;\n z=x%b;\n if (y*z==a)\n break;\n }\n printf(\"%ld\",x);\n }\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int x=a+b;\n if (x%b==0)\n {\n int y=x/3;\n int z=x%3;\n while(y*z!=a) \n {\n x=x+1;\n y=x/3;\n z=x%3;\n }\n printf(\"%d\",x);\n }\n else\n printf(\"%d\",a+b); \n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n long int a,b;\n scanf(\"%ld %ld\",&a,&b);\n long int x=a+b;\n if (x%b==0)\n {\n long int y=x/b;\n long int z=x%b;\n while(y*z!=a) \n {\n x=x+1;\n y=x/b;\n z=x%b;\n }\n printf(\"%ld\",x);\n } \n else\n printf(\"%ld\",a+b); \n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#define MIN(a,b) a<b?a:b\n#define MAX(a,b) a>b?a:b\n#define rep(i,a,b) for(i=a;i<b;i++)\n#define rev(i,a,b) for(i=a;i>b;i--)\n#define sf(a) scanf(\"%d\",&(a))\n#define pf(a) printf(\"%d\",(a))\n#define sfll(a) scanf(\"%lld\",&(a))\n#define pfll(a) printf(\"%lld\",(a))\n#define ssf(a) scanf(\"%s\",(a))\n#define spf(a) printf(\"%s\",(a))\n#define nl printf(\"\\n\")\n#define play int main()\n#define out return\ntypedef int I;\ntypedef long long LL;\ntypedef char S;\ntypedef float F;\ntypedef double D;\n/*int cmp(const void *a,const void *b)\n{\n return (*(int*)a-*(int*)b);\n}*/\nplay\n{\n I n,k,i;\n sf(n);\n sf(k);\n rep(i,1,k)\n {\n if((n*k+i*i)%i==0)\n {\n pf((n*k+i*i)/i);\n nl;\n out 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#define MIN(a,b) a<b?a:b\n#define MAX(a,b) a>b?a:b\n#define rep(i,a,b) for(i=a;i<b;i++)\n#define rev(i,a,b) for(i=a;i>b;i--)\n#define sf(a) scanf(\"%d\",&(a))\n#define pf(a) printf(\"%d\",(a))\n#define sfll(a) scanf(\"%lld\",&(a))\n#define pfll(a) printf(\"%lld\",(a))\n#define ssf(a) scanf(\"%s\",(a))\n#define spf(a) printf(\"%s\",(a))\n#define nl printf(\"\\n\")\n#define play int main()\n#define out return\ntypedef int I;\ntypedef long long LL;\ntypedef char S;\ntypedef float F;\ntypedef double D;\n/*int cmp(const void *a,const void *b)\n{\n return (*(int*)a-*(int*)b);\n}*/\nplay\n{\n I n,k,i;\n sf(n);\n sf(k);\n rev(i,k-1,0)\n {\n if((n*k+i*i)%i==0)\n {\n printf(\"%d\\n\",(n*k+i*i)/i);\n nl;\n out 0;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main() {\n int i,x=0,n,k,div1,mod;\n scanf(\"%d %d\",&n,&k);\n for(i=k;i<100;i++)\n {\n div1=i/k;\n mod=i%k;\n x=div1*mod;\n if(n==x)\n {\n break;\n }\n }\n \n printf(\"%d\",i);\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n long int k;\n long int ans=0;\n long int i;\n long int sol=1000000000000;\n long int xtemp;\n long int l;\n long int r;\n long int tempsol;\n long int j;\n\n scanf(\"%ld %ld\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if( (n%i)==0)\n {\n l=(n/i);\n r=(n/l);\n xtemp=l*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == r)&&(tempsol<sol)) sol=tempsol;\n }\n xtemp=r*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == l)&&(tempsol<sol)) sol=tempsol;\n }\n }\n }\n printf(\"%ld\\n\",sol);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long int n;\n long int k;\n long int factorsn[1005];\n long int c;\n int i;\n int j;\n long int count=0;\n long int sol;\n long int num;\n scanf(\"%ld %ld\",&n,&k);\n sol=n*k*k;\n c=n*k*k;\n for(i=0;i<1005;i++) factorsn[i]=0;\n factorsn[count++]=1;\n \n if((c%2)==0) factorsn[count++]=2;\n c=c/2;\n while((c%2)==0)\n {\n factorsn[count]=2*factorsn[count-1];\n c=c/2;\n count++;\n }\n i=3;\n while(i <=(sqrt(c)+1)){\n if((c%i) == 0) {\n if(factorsn[count-1]!=i) \n {\n factorsn[count]=i;\n count++;\n }else{\n factorsn[count]=i*factorsn[count-1];\n count++;\n }\n c=c/i;\n }else{\n i=i+2;\n }\n }\n if((c>1)&&(factorsn[count]!=c)) factorsn[count++]=c;\n\n for(i=0;i<count;i++)\n {\n for(j=0;j<=k;j++)\n { \n num=factorsn[i]+j;\n if( (((num/k)*(num%k))==n)&&(num<sol) ) sol=num;\n }\n }\n\n printf(\"%ld\\n\",sol);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n long int k;\n long int ans=0;\n long int i;\n long int sol=100000005;\n long int xtemp;\n long int l;\n long int r;\n long int tempsol;\n long int j;\n\n scanf(\"%ld %ld\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if( (n%i)==0)\n {\n l=(n/i);\n r=(n/l);\n xtemp=l*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == r)&&(tempsol<sol)) sol=tempsol;\n }\n xtemp=r*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == l)&&(tempsol<sol)) sol=tempsol;\n }\n }\n }\n printf(\"%ld\\n\",sol);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n;\n long long int k;\n long long int factorsn[1005];\n long long int c;\n int i;\n int j;\n long int count=0;\n long long int sol;\n long long int num;\n scanf(\"%lld %lld\",&n,&k);\n sol=n*k*k;\n c=n*k*k;\n for(i=0;i<1005;i++) factorsn[i]=0;\n factorsn[count++]=1;\n \n if((c%2)==0) factorsn[count++]=2;\n c=c/2;\n while((c%2)==0)\n {\n factorsn[count]=2*factorsn[count-1];\n c=c/2;\n count++;\n }\n i=3;\n while(i <=(sqrt(c)+1)){\n if((c%i) == 0) {\n if(factorsn[count-1]!=i) \n {\n factorsn[count]=i;\n count++;\n }else{\n factorsn[count]=i*factorsn[count-1];\n count++;\n }\n c=c/i;\n }else{\n i=i+2;\n }\n }\n if((c>1)&&(factorsn[count]!=c)) factorsn[count++]=c;\n\n for(i=0;i<count;i++)\n {\n for(j=0;j<=k;j++)\n { \n num=factorsn[i]+j;\n if( (((num/k)*(num%k))==n)&&(num<sol) ) sol=num;\n }\n }\n\n printf(\"%lld\\n\",sol);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n;\n long long int k;\n long long int factorsn[1005];\n long long int c;\n long long int i;\n long long int j;\n long int count=0;\n long long int sol;\n long long int num;\n scanf(\"%lld %lld\",&n,&k);\n sol=n*k*k;\n c=n*k*k;\n for(i=0;i<1005;i++) factorsn[i]=0;\n factorsn[count++]=1;\n \n if((c%2)==0) factorsn[count++]=2;\n c=c/2;\n while((c%2)==0)\n {\n factorsn[count]=2*factorsn[count-1];\n c=c/2;\n count++;\n }\n i=3;\n while(i <=(sqrt(c)+1)){\n if((c%i) == 0) {\n if(factorsn[count-1]!=i) \n {\n factorsn[count]=i;\n count++;\n }else{\n factorsn[count]=i*factorsn[count-1];\n count++;\n }\n c=c/i;\n }else{\n i=i+2;\n }\n }\n if((c>1)&&(factorsn[count]!=c)) factorsn[count++]=c;\n\n for(i=0;i<count;i++)\n {\n for(j=0;j<=k;j++)\n { \n num=factorsn[i]+j;\n if( (((num/k)*(num%k))==n)&&(num<sol) ) sol=num;\n }\n }\n\n printf(\"%lld\\n\",sol);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n long int k;\n long int ans=0;\n long int i;\n\n scanf(\"%ld %ld\",&n,&k);\n for(i=1;i<n*k*k;i++)\n {\n if( (i/k)*(i%k)==n) ans=i;\n if(ans!=0) break;\n }\n printf(\"%ld\\n\",ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int n;\n long int k;\n long int ans=0;\n long int i;\n long int sol=1000005;\n long int xtemp;\n long int l;\n long int r;\n long int tempsol;\n long int j;\n\n scanf(\"%ld %ld\",&n,&k);\n for(i=1;i<=n;i++)\n {\n if( (n%i)==0)\n {\n l=(n/i);\n r=(n/l);\n xtemp=l*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == r)&&(tempsol<sol)) sol=tempsol;\n }\n xtemp=r*k;\n for(j=0;j<k;j++)\n {\n tempsol=xtemp+j;\n if(((tempsol)%k == l)&&(tempsol<sol)) sol=tempsol;\n }\n }\n }\n printf(\"%ld\\n\",sol);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint ans = 2147480000;\n\tfor (int i = 1; i*i <= n && i <= k; ++i)\n\t{\n\t\tif( (n%i) == 0 && (n/i) <= k)\n\t\t{\n\t\t\tif(n/i < k)\n\t\t\t{\n\t\t\t\tint tmp = i*k+(n/i);\n\t\t\t\tif(tmp < ans)\n\t\t\t\t\tans = tmp;\n\t\t\t}\n\t\t\tif(i < k)\n\t\t\t{\n\t\t\t\tint tmp2 = (n/i)*k+i;\n\t\t\t\tif(tmp2 < ans)\n\t\t\t\t\tans = tmp2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tlong long int ans = 10000000000;\n\tfor (int i = 1; i*i <= n && i < k; ++i)\n\t{\n\t\tif( (n%i) == 0 && (n/i) <= k)\n\t\t{\n\t\t\tif(n/i < k)\n\t\t\t{\n\t\t\t\tint tmp = i*k+(n/i);\n\t\t\t\tif(tmp < ans)\n\t\t\t\t\tans = tmp;\n\t\t\t}\n\t\t\tif(i < k)\n\t\t\t{\n\t\t\t\tint tmp2 = (n/i)*k+i;\n\t\t\t\tif(tmp2 < ans)\n\t\t\t\t\tans = tmp2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint ans = 2147480000;\n\tfor (int i = 1; i*i <= n && i < k; ++i)\n\t{\n\t\tif( (n%i) == 0 && (n/i) <= k)\n\t\t{\n\t\t\tif(n/i < k)\n\t\t\t{\n\t\t\t\tint tmp = i*k+(n/i);\n\t\t\t\tif(tmp < ans)\n\t\t\t\t\tans = tmp;\n\t\t\t}\n\t\t\tif(i < k)\n\t\t\t{\n\t\t\t\tint tmp2 = (n/i)*k+i;\n\t\t\t\tif(tmp2 < ans)\n\t\t\t\t\tans = tmp2;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\", ans);\n\treturn 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<limits.h>\n\nmain()\n{\n\t int n, k, i, temp, temp2, min, small, large, a, b;\n\t \n\t scanf(\"%d%d\",&n,&k);\n\t \n\t min = INT_MAX;\n\t for( i=1; i<=n/2 + 1 && a<=b ; i++ )\n\t {\n\t \t\n\t \t if( n % i == 0 )\n\t \t {\n\t \t a = i;\n\t\t\tb = n/i;\n\n if( a >= k )\n {\n \ttemp = a * k + b; \n\t\t\t}\n\t\t\telse if( b >= k )\n\t\t\t temp = b * k + a;\n\t\t\telse\n\t\t\t{\n\t\t\t\t temp = a * k + b;\n\t\t\t\t temp2 = b * k + a;\n\t\t\t\t temp = temp < temp2 ? temp : temp2;\n\t\t\t}\n\t\t\t\n\t\t\tif( min > temp )\n\t\t\t min = temp; \t\n\t\t\t\n\t\t }\n\t }\n\t printf(\"%d\\n\",min);\n}"}, {"source_code": "\n#include<stdio.h>\n#include<limits.h>\n\nmain()\n{\n\t int n, k, i, temp, temp2, min, small, large, a, b;\n\t \n\t scanf(\"%d%d\",&n,&k);\n\t a = 1;\n\t b = 1;\n\t min = INT_MAX;\n\t for( i=1; i<=n && a<=b ; i++ )\n\t {\n\t \t if( n % i == 0 )\n\t \t {\n\t \t a = i;\n\t\t\tb = n/i;\n\n if( a >= k )\n {\n \ttemp = a * k + b; \n\t\t\t}\n\t\t\telse if( b >= k )\n\t\t\t temp = b * k + a;\n\t\t\telse\n\t\t\t{\n\t\t\t\t temp = a * k + b;\n\t\t\t\t temp2 = b * k + a;\n\t\t\t\t temp = temp < temp2 ? temp : temp2;\n\t\t\t}\n\t\t\t\n\t\t\tif( min > temp )\n\t\t\t min = temp; \t\n\t\t\t\n\t\t }\n\t }\n\t printf(\"%d\\n\",min);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,x,p,q,i=1,m,min=100000;\n scanf(\"%d %d\", &a, &b);\n while(1){\n if(a%i==0){\n x=a/i;\n m=(b*x)+i;\n p=m%b;\n q=m/b;\n if((p*q)==a){\n if(min>m){\n min=m;\n }\n }\n }\n if(i==a) break;\n i++;\n }\n printf(\"%d\", min);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,x,p,q,i=1,m,min=10000000;\n scanf(\"%d %d\", &a, &b);\n while(1){\n if(a%i==0){\n x=a/i;\n m=(b*x)+i;\n p=m%b;\n q=m/b;\n if((p*q)==a){\n if(min>m){\n min=m;\n }\n }\n }\n if(i==a) break;\n i++;\n }\n printf(\"%d\", min);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int p=k*n+1;\n int q=k+n;\n int ans;\n if(1<k&&n<k){if(p<q)ans=p;else ans=q;}\n else if(n<k)ans=q;\n else if(1<k)ans=p;\n for(int i=2;i<=sqrt(n);i++)\n {\n int a;\n if(n%i==0)\n {\n int x=k*i+(n/i);\n int y=k*(n/i)+i;\n if(i<k&&(n/i)<k){if(x<y)a=x;else a=y;}\n else if((n/i)<k)a=x;\n else if(i<k)a=y;\n if(a<ans)ans=a;\n }\n else continue;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,k,x,i;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&n);\n \tfor(i=k-1;i>0;i--){\n\t\tif(n%i==0){\n\t\t\tprintf(\"%d\",i+(n/i)*k);break;\n\t\t\n\t\t}\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,k,x,i;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&n);\n \tfor(i=k-1;i>0;i--){\n\t\tif(n%i==0){\n\t\t\tprintf(\"%d\\n\",i+(n/i)*k);break;\n\t\t\n\t\t}\n\t}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t// (x div k) * (x mod k) = n\n\tint n, k, x;\n\tint ans;\n\tint *arr;\n\tint i;\n\n\tscanf(\"%d %d\", &n, &k);\n\t\n\tfor (i = 1; i <= n; i++) {\n\t\tif (i == k)\n\t\t\tbreak;\n\t\tif (i == 1)\n\t\t\tx = k * (n / i) + i;\n\t\tif (n%i == 0 && i < k) {\t\t\t\t\t// \ub098\ub204\uc5b4 \ub5a8\uc5b4\uc9c8 \ub54c\n\t\t\tans = k * (n / i) + i;\n\t\t\tif (x >= ans) {\n\t\t\t\tx = ans;\n\t\t\t\tprintf(\"%d %d\\n\", i, x);\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", x);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,a,x,i;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i<k;i++)\n\t{\n\t\tif(n%i==0)\n\t\t{\n\t\t\ta=i;\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\tx=n/a*k+a;\n\tprintf(\"%d\",x);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a[1006][1006],b2,k;\n\nscanf(\"%lld%lld\",&n,&k);\nf=0;\nfor(i=1;i<=10000000;i++){\n f=(i/k)*(i%k);\n if(f==n){\n printf(\"%lld\",i);\n return 0;\n } \n}\nprintf(\"0\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a[1006][1006],b2,k;\n\nscanf(\"%lld%lld\",&n,&k);\nf=0;\nfor(i=1;i<=10000000;i++){\n f=(i/k)*(i%k);\n if(f==n){\n printf(\"%lld\",i);\n return 0;\n } \n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,b,count1=0,a[1006][1006],b2,k;\n\nscanf(\"%lld%lld\",&n,&k);\nf=0;\nfor(i=1;i<=1000000;i++){\n f=(i/k)*(i%k);\n if(f==n){\n printf(\"%lld\",i);\n return 0;\n } \n}\nprintf(\"0\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong int a,b;\n\tscanf(\"%ld%ld\",&a,&b);\n\t\n\tlong int x=a+b;\n\t\n while(x%b!=0){\n\tif((x/b)*(x%b) == a) break;\n\tx++;\n}\n\t\t\tprintf(\"%ld\\n\",x);\n\n\t\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tint n, k, i, f=0, r, c;\n\t\n\tscanf(\"%d %d\", &n, &k);\n\t\n\tif(n==k)\n\t{\n\t\tprintf(\"%d\", (n*k)+1);\n\t}\n\telse if(k>n)\n\t{\n\t\tprintf(\"%d\", n+k);\n\t}\n\telse\n\t{\n\t\tfor(i=1; i<=sqrt(n); i++)\n\t\t{\n\t\t\tif(n%i==0)\n\t\t\t{\n\t\t\t\tif(((k*i)+(n/i))%k==0)\n\t\t\t\t{\n\t\t\t\t\tr=i;\n\t\t\t\t\tc=n/i;\n\t\t\t\t\tf=1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\", (k*i)+(n/i));\n\t\t\t\t\tf=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(f==1)\n\t\t{\n\t\t\tif(((k*r)+c)%k==0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", (k*c)+r);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\", (k*r)+c);\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n printf(\"%d\",n*k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n for(i=n+k;i<n*k;i++)\n {\n if((i/k)*(i%k)==n){printf(\"%d\",i);}\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n\n for(i=0;i<=k;i++)\n {\n for(j=1;j<=(n/2)+1;j++)\n {\n if(i*j==n){x=k*j+i;break;}\n }\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,j,x;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n\n for(i=0;i<k;i++)\n {\n for(j=1;j<=n/2;j++)\n {\n if(i*j==n){x=k*j+i;break;}\n }\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);scanf(\"%d\",&k);\n printf(\"%d\",n+k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k, n, x = 0;\n\n\tscanf (\"%d %d\", &n, &k);\n\n\twhile ((x / k) * (x % k) < n)\n\t\tx++;\n\n\tprintf (\"%d\", x);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k, n;\n\tlong x = 1;\n\n\tscanf (\"%d %d\", &n, &k);\n\n\twhile ((x / k) * (x % k) < n)\n\t\tx++;\n\n\tprintf (\"%ld\\n\", x);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,q,x;\n scanf(\"%lld %lld\",&n,&k);\n x=k;\n q=n/(k-1);\n if(q==0)\n {k=k-1;\n while(n/k==0)\n {k--;}\n }\n else\n {k--;}\n q=n/k;\n printf(\"%lld\",q*x+k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,k,x,first,sec;\n scanf(\"%d %d\",&n,&k);\n sec = (n < k) ? n : k-1;\n first = n/sec;\n x = first*k + sec;\n printf(\"%d\\n\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,k,x,first,temp,i;\n scanf(\"%d %d\",&n,&k);\n for(i=1;i<k;i++){\n if(n%i==0){\n first = n/i;\n temp = first*k + i;\n if(temp<x)\n x = temp;\n }\n }\n printf(\"%d\\n\",x);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int i,j,k,l,m,n;\n scanf(\"%d%d\",&n,&m);\n k=1;\n l=m;\n while(1)\n {\n j=l%m;\n if(j!=0){\n if((l/m)==(n/j)) break;\n else\n l++;\n }\n else l++;\n }\n printf(\"%d\",l);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n long long int i,j,k,l,m,n,h,c=0;;\n scanf(\"%lld%lld\",&n,&m);\n k=1;\n for(k=1;k<m;k++)\n {\n h=(n*m)%k;\n if(h==0) {\n l=(n*m)/k+k;\n if(c==0) j=l;\n c++;\n if(c>1) {\n if(j>l) j=l;\n }\n }\n }\n printf(\"%lld\",j);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int i,j,k,l,m,n;\n scanf(\"%d%d\",&n,&m);\n k=1;\n l=m;\n if(n!=4&&m!=6){\n while(1)\n {\n j=l%m;\n if(j!=0){\n if((l/m)==(n/j)) break;\n else\n l++;\n }\n else l++;\n }\n }\n else l=10;\n printf(\"%d\",l);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,n;\n int m,d;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\n for(m =0;m<k;m++){\n for(d = 1;d<=n;d++){\n if(d*m==n){\n printf(\"%d\",k*d+m);\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,n;\n int m,d;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n\n for(m =0;m<k;m++){\n for(d = 1;d<=n/2;d++){\n if(d*m==n){\n printf(\"%d\",k*d+m);\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long k,n,x,i;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&k);\n for( i=0;i<n*k;i++){\n if((i%k)*(i/k)==n){\n printf(\"%lld\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main(){\n\tint i = 0, k, n;\n\t\n\tscanf(\"%d %d\", &n, &k);\n\t\n\twhile(i < 1000000){\n\tif(n == div(i,k).quot * div(i,k).rem) break;\n\t//printf(\"%d\\n\", div(i,k).quot * div(i,k).rem);\n\ti++;\n\t}\n\t\n\tprintf(\"%d\", i);\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\n\nint main(){\n\tint i = 1, k, n;\n\t\n\tscanf(\"%d %d\", &n, &k);\n\t\n\twhile(i < 100){\n\tif(n == div(i,k).quot * div(i,k).rem) break;\n\t//printf(\"%d\\n\", div(i,k).quot * div(i,k).rem);\n\ti++;\n\t}\n\t\n\tprintf(\"%d\", i);\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n printf(\"%d\",n+k+n/k);\n return 0;\n}"}], "src_uid": "ed0ebc1e484fcaea875355b5b7944c57"} {"nl": {"description": "Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.Now he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A\u2009-\u20091.Note that all computations should be done in base 10. You should find the result as an irreducible fraction, written in base 10.", "input_spec": "Input contains one integer number A (3\u2009\u2264\u2009A\u2009\u2264\u20091000).", "output_spec": "Output should contain required average value in format \u00abX/Y\u00bb, where X is the numerator and Y is the denominator.", "sample_inputs": ["5", "3"], "sample_outputs": ["7/3", "2/1"], "notes": "NoteIn the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively."}, "positive_code": [{"source_code": "#include<stdio.h>\nint lcm(int a,int b){\n if(b==0) return a;\n else return lcm(b,a%b);\n}\nint main(){\n int n,ans=0,i;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++){\n int temp=n;\n while(temp>0){\n ans+=temp%i;\n temp/=i;\n }\n }\n int l=lcm(ans,n-2);\n printf(\"%d/%d\",ans/l,(n-2)/l);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,r,t,s,x,m,n;\n while(scanf(\"%d\",&a)==1){\n x=a;\n s=0;\n for(i=2;i<=a-1;i++){\n do{\n t=a/i;\n r=a%i;\n s=s+r;\n a=t;\n }\n while(t!=0);\n a=x;\n }\n m=a-2;\n for(i=m;i>=1;i--){\n if(m%i==0 && s%i==0){\n n=i;\n break;\n }\n }\n printf(\"%d/%d\\n\",s/n,(a-2)/n);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i,j,N,s=0;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n N=n;\n while(N)\n {\n s+=N%i;\n N/=i;\n }\n }\n i=2;\n n-=2;\n while(1)\n {\n if(!(n%i)&!(s%i))\n {\n n/=i;\n s/=i;\n }\n else\n i++;\n if(i>n)\n break;\n }\n printf(\"%d/%d\",s,n);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,sum=0,i,mod,a,nu,de;\n\n scanf(\"%d\",&n);\n\n for(i=2;i<=(n-1);i++)\n {\n a=n;\n while(a!=0)\n {\n mod=a%i;\n a=(int)(a/i);\n sum=sum+mod;\n }\n }\n nu=sum;\n de=n-2;\n\n\n for(i=(n-2);i>=2;i--)\n {\n if(nu%i==0 && de%i==0)\n {\n nu=sum/i;\n de=(n-2)/i;\n\n }\n\n }\n\n printf(\"%d/%d\",nu,de);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n long gongyueshu(long x ,long y);\n long n,i,m,r,j,b=1; long sum=0;\n while (scanf(\"%ld\",&n)!=EOF){sum=0;\n for (i=2;i<n;i++)\n {\n m=0;j=n;\n while (j)\n {\n r=j%i;\n j=j/i;\n sum+=r;\n }\n }\n b=gongyueshu(sum,(n-2));\n //printf(\"%ld %ld %ld\\n\",b,sum,(n-2));\n printf(\"%ld/%ld\\n\",sum/b,(n-2)/b);\n }\n}\nlong gongyueshu(long x,long y)\n{\n long temp,r=1;\n if (x<y){temp=x;x=y;y=temp;}\n while (r)\n {\n r=x%y;\n x=y;\n y=r;\n }\n return (x);\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint gcd (int a, int b)\n{\n while (a && b)\n if (a > b)\n a %= b;\n else\n b %= a;\n return a + b;\n}\n\nint main ()\n{\n int A;\n scanf (\"%d\", &A);\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n int a = A;\n while (a != 0)\n {\n sum += a % i;\n a /= i;\n }\n }\n\n int num = sum;\n int den = A - 2;\n int gcdval = gcd(num, den);\n num /= gcdval;\n den /= gcdval;\n printf (\"%d/%d\\n\", num, den);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,r,t,s,x,m,n;\n while(scanf(\"%d\",&a)==1){\n x=a;\n s=0;\n for(i=2;i<=a-1;i++){\n do{\n t=a/i;\n r=a%i;\n s=s+r;\n a=t;\n }\n while(t!=0);\n a=x;\n }\n m=a-2;\n for(i=m;i>=1;i--){\n if(m%i==0 && s%i==0){\n n=i;\n break;\n }\n }\n printf(\"%d/%d\\n\",s/n,(a-2)/n);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint sum(int n, int b) {\n\treturn n < b ? n : sum(n / b, b) + n % b;\n}\n \nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n \nint main() {\n\tint a, x, y, b, g;\n \n\tscanf(\"%d\", &a);\n\tx = 0;\n\ty = a - 2;\n\tfor (b = 2; b < a; b++)\n\t\tx += sum(a, b);\n\tg = gcd(x, y);\n\tx /= g, y /= g;\n\tprintf(\"%d/%d\\n\", x, y);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint pgcd(int x,int y)\n {\n if (x==y) return x;\n if (x==0) return y;\n if (y==0) return x;\n if (x<y) return pgcd(x,y%x);\n return pgcd(x%y,y);\n }\n\nmain()\n {\n int a,i,s,x,y;\n scanf(\"%d\",&a);\n s = 2;\n for (i=2;i<a-1;i++)\n {\n x = 1;\n while (x<=a) x = x * i;\n x = x / i;\n y = a;\n while (y!=0)\n {\n s = s + (y/x);\n y = y % x;\n x = x / i;\n }\n }\n y = pgcd(s,a-2);\n printf(\"%d/%d\",s/y,(a-2)/y);\n }\n"}, {"source_code": "#include <stdio.h>\nint gcd(int a,int b)\n{\n int temp,g;\n if(a==0 || b==0) g=0;\n else {\n while(b>0){\n temp=b;\n b=a%b;\n a=temp;\n }\n g=a;\n }\n return g;\n}\nint main()\n{\n int n,m,i,x=0,ans,y,g;\n scanf(\"%d\",&n);\n y=n-2;\n for(i=2;i<=n-1;i++){\n m=n;\n while(m>0){\n x=x+m%i;\n m=m/i;\n }\n }\n g=gcd(x,y);\n x=x/g;\n y=y/g;\n printf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint hcf(int a,int b)\n { int t=a%b ;\n\n\n while(t>0)\n { a=b;\n b=t;\n t=a%b;\n }\n return b;\n }\n\nint main()\n{\n int a,n,s=0,t,z;\n scanf(\"%d\",&a);\n int i=2;\n while(i<a)\n { t=0;\n n=a;\n while(n>0)\n {\n t=t+n%i;\n n=n/i;\n }\n s=s+t;\n i++;\n\n }\n\n z=hcf(s,a-2);\n printf(\"%d/%d\",s/z,(a-2)/z);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n temp=n;\n while(temp>0)\n {\n x=temp%i;\n num=num+x;\n temp=temp/i;\n }\n // printf(\"%d=%d\\n\",i,num);\n }\n for(j=n-2;j>=1;j--)\n {\n if(num%j==0 && (n-2)%j==0)\n break;\n\n }\n num=num/j;\n den=(n-2)/j;\n printf(\"%d/%d\\n\",num,den);\n // main();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,temp,i,sum=0,x=0,y=0;\n\tscanf(\"%d\",&n);\n\tfor (i=2;i<n;i++)\n\t{\n\t\ttemp=n;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tsum=sum+temp%i;\n\t\t\ttemp/=i;\n\t\t}\n\t}\n\tx=sum;\n\ty=n-2;\n\ti=2;\n\twhile(i<n)\n\t{\n\t\tif (x%i==0 && y%i==0)\n\t\t{\n\t\t\tx=x/i;\n\t\t\ty=y/i;\n\t\t}\n\t\tif(x%i!=0 || y%i!=0)\n\t\t\ti++;\n\t}\n\tprintf(\"%d/%d\\n\",x,y);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n\nint cmmdc(int a,int b)\n{\n if(a == b) return a;\n else\n if(a > b) return cmmdc(a-b,b); else cmmdc(b - a,a); \n}\n\nint n,s = 0,z,b,numitor,numarator,dc;\n\n\nint main()\n{\n scanf(\"%d\",&n);\n numitor = n - 2;\n for (b = 2;b < n;b++)\n {\n z = n;\n while(z > 0)\n {\n s = s + z % b;\n z = z / b;\n \n }\n }\n numarator = s;\n dc = cmmdc(numarator, numitor);\n printf(\"%d/%d\\n\", numarator / dc,numitor / dc);\n \n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,r=0,a=1,f,b,s,m=1,c=0,g,j,h=1,t,d,e;\n scanf(\"%d\", &n);\n b = n;\n for(i=2;i<n;i++)\n {\n while(a != 0)\n {\n a = n / i;\n f = n % i;\n n = a;\n r = r + f;\n }\n n = b;\n a = 1;\n }\n t = r;\n g = n-2;\n if(g<r)\n {\n while(h != 0)\n {\n h = r % g;\n r = g;\n g = h;\n }\n }\n else if(r < g)\n {\n while(h != 0)\n {\n h = g % r;\n g = r;\n g = h;\n }\n }\n if(g<r)\n {\n c = (n-2) / r;\n j = t / r;\n printf(\"%d/%d\",j,c);\n }\n else if(r<g)\n {\n d = (n-2) / g;\n e = t / g;\n printf(\"%d/%d\",d,e);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint \ngcdr ( int a, int b )\n{\n\t if ( a==0 ) return b;\n\t return gcdr ( b%a, a );\n}\n\nint main()\n{\n\tint n,temp,sum,msum,b,tc;\n//\tscanf(\"%d\",&tc);\n//\twhile(tc--)\n//\t{\n\tscanf(\"%d\",&n);int t=n-2;\n\tmsum=0;\n\tfor(b=2;b<=n-1;b++)\n\t{\n\t\t sum=0;\n\t\ttemp=n;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tsum+=temp%b;\n\t\t\ttemp=temp/b;\n\t\t}\n\t\tmsum+=sum;\n\t}\n\tprintf(\"%d/%d\\n\",msum/gcdr(msum,t),t/gcdr(msum,t));\n//\t}\n\treturn 0;\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n temp=n;\n while(temp>0)\n {\n x=temp%i;\n num=num+x;\n temp=temp/i;\n }\n // printf(\"%d=%d\\n\",i,num);\n }\n for(j=n-2;j>=1;j--)\n {\n if(num%j==0 && (n-2)%j==0)\n break;\n\n }\n num=num/j;\n den=(n-2)/j;\n printf(\"%d/%d\\n\",num,den);\n // main();\n}\n"}, {"source_code": "#include<stdio.h>\nint search(int ,int);\nint gcd(int,int);\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n int b=a-2,sum=0,k;\n for(int i=2;i<=a-1;i++)\n {\n k=search(a,i);\n sum=sum+k;\n }\n p=gcd(sum,b);\n printf(\"%d/%d\",(sum/p),(b/p));\n return 0;\n}\nint search(int i,int j)\n{\n int sum=0,t;\n while(i>0)\n {\n t=i%j;\n i=i/j;\n sum=sum+t;\n }\n return sum;\n}\nint gcd(int i,int j)\n{\n int temp;\n while(j!=0)\n {\n temp=j;\n j=i%j;\n i=temp;\n }\n return i;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,i,j,sum=0,k;\n\tscanf(\"%d\",&n);\n\tint a[1001]={0};\n\tif(n==3)\n\t{\n\t\tprintf(\"2/1\");\n\t\treturn 0;\n\t}\n\tfor(i=2;i<n;i++)\n\t{\n\t\tj=n;\n\t\twhile(j!=0)\n\t\t{\n\t\t\ta[i]+=j%i;\n\t\t\tj=j/i;\n\t\t}\n\t}\n\tfor(i=2;i<n;i++)\n\t{\n\t\tsum+=a[i];\n\t}\n\tfor(i=n-2;i>=2;i--)\n\t{\n\t\tif(sum%i==0 && (n-2)%i==0)\n\t\t{\n\t\t\tk=i;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tk=1;\n\t}\n\tprintf(\"%d/%d\",sum/k,(n-2)/k);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n int i,a,s=0,num,j,x;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n num=a;\n while(num>0)\n {\n s=s+num%i;\n num=num/i;\n }\n \n }\n x=a-2;\n for(i=2;i<=x;i++)\n while(s%i==0&&x%i==0)\n {\n s=s/i;\n x=x/i;\n }\n printf(\"%d/%d\",s,x);\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n/*\nint digit(int a)\n{\n int sum=0;\n while(a>0){\n a/=10;\n sum++;\n }\n return sum;\n}\nint digitsum(int a)\n{\n int r,sum=0;\n while(a>0){\n r=a%10;\n a/=10;\n sum+=r;\n }\n return sum;\n}\nint power(int a,int b)\n{\n int i,sum=1;\n for(i=1;i<=b;i++){\n sum*=a;\n }\n return sum;\n}\nint type(int num,int base)\n{\n int r,sum=0,i=0;\n while(num>0){\n r=num%base;\n\n sum+=r*power(10,i);\n num/=base;\n i++;\n }\n return digitsum(sum);\n}\n*/\nint summ(int num,int base)\n{\n int sum=0,r;\n while(num>0){\n r=num%base;\n sum+=r;\n num/=base;\n }\n return sum;\n}\n\n/*\nint convert(int num,int base)\n{\n int num1;\n num1=type(num,base);\n int r,sum=0;\n while(num1>0){\n r=num1%10;\n sum+=r*power(base,digit(num1)-1);\n num/=10;\n }\n return digitsum(sum);\n}\n*/\nint main()\n{\n int A,i,sum=0,x=0,y=0;\n scanf(\"%d\",&A);\n for(i=2;i<=A-1;i++){\n sum+=summ(A,i);\n }\n\n x=sum;\n y=A-2;\n for(i=2;i<=A-2;i++){\n if(sum%i==0 &&(A-2)%i==0){\n x=sum/i;\n y=(A-2)/i;\n }\n }\n printf(\"%d/%d\",x,y);\n\n return 0;\n}\n/*\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[301];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n while(c<n){\n for(i=0;i<n;i++){\n if(a[i]>0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n if(i<n-1){\n printf(\"R\");\n }\n\n }\n if(c<n){\n printf(\"L\");\n for(i=n-2;i>=0;i--){\n\n if(i>0 && i!=n-2){\n printf(\"L\");\n }\n\n if(a[i]>0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n }\n }\n\n }\n int *p,q;\n p=&q;\n q=10;\n\n printf(\"%p\\n\",p);\n printf(\"%d\\n\",*p);\n printf(\"%p\\n\",&q);\n p=p++;\n printf(\"%p\\n\",p);\n p=(p++);\n printf(\"%d\\n\",*p);\n char a[101];\n gets(a);\n printf(\"%s\",a);\n int a[10],*p,i;\n //int i;\n for(i=0;i<5;i++){\n scanf(\"%d\",&a[i]);\n }\n //int *p;\n p= a;\n printf(\"%d %d %d\\n\",*p,*(p+1),*(p+6));\n char str[101],*p;\n gets(str);\n p= str;\n int i;\n for(i=0;p[i];i++){\n printf(\"%c\",p[i]);\n }\n char str[]=\"acdaaaaaaaaaa\";\n // *(str+3)='c';\n printf(\"%c\",*str+6);\n int a=6,i;\n for(i=1;i<3;i++) printf(\"%d\\n\",++a);\n for(i=1;i<3;i++) printf(\"%d\\n\",a++);\n\n char str[101],*p;\n gets(str);\n p= str;\n\n while(*p){\n *p++=*p-32;\n }\n\n printf(\"%s\",str);\n\n char str1[101],str2[101],*p1,*p2;\n gets(str1);\n p1= str1+strlen(str1)-1;\n p2= str2;\n while(p1>=str1){\n *p2++=*p1--;\n }\n *p2='\\0';\n printf(\"%s %s\",str1,str2);\n\n char *p;\n gets(*p);\n printf(\"%c\\n\",p[2]);\n\n printf(\"%c\",*(p+2));\n\n\n\n\n return 0;\n}\n\nint main()\n{\n\n char str[101],*p;\n gets(str);\n p= str;\n while(*p!=' '){\n printf(\"%c\",*p);\n *p++;\n }\n return 0;\n\n}\n*/\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,p=0,j=0,c[20000]={},s,t=0,k,l;\n scanf(\"%d\",&a);\n l=a-2;\n for(i=2;i<a;i++)\n {\n s=a;\n while(s!=0)\n {\n c[p]=s%i;\n p++;\n s=s/i;\n }\n }\n for(t=0;t<p;t++)\n {\n j=j+c[t];\n }\n for(k=l;k>=2;k--)\n {\n if(j%k==0 && l%k==0)\n {\n j=j/k;\n l=l/k;\n }\n }\n printf(\"%d/%d\",j,l);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,temp,i,sum=0,x=0,y=0;\n\tscanf(\"%d\",&n);\n\tfor (i=2;i<n;i++)\n\t{\n\t\ttemp=n;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tsum=sum+temp%i;\n\t\t\ttemp/=i;\n\t\t}\n\t}\n\tx=sum;\n\ty=n-2;\n\ti=2;\n\twhile(i<n)\n\t{\n\t\tif (x%i==0 && y%i==0)\n\t\t{\n\t\t\tx=x/i;\n\t\t\ty=y/i;\n\t\t}\n\t\tif(x%i!=0 || y%i!=0)\n\t\t\ti++;\n\t}\n\tprintf(\"%d/%d\\n\",x,y);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define A 10\n#define B 11\n#define C 12\n#define D 13\n#define E 14\n#define F 15\n//a\nint sum=0;\nint binary (int n,int m)\n{\n int c,count=0,n1,i=0,bit[1100],d;\n n1=n;\n while(n!=0)\n {\n c=n%m;\n n=n/m;\n count++;\n }\n n=n1;\n c=0;\n while(n>0)\n {\n c=n%m;\n if(c==10)\n c=A;\n else if(c==11)\n c=B;\n else if(c==12)\n c=C;\n else if(c==13)\n c=D;\n else if(c==14)\n c=E;\n else if(c==15)\n c=F;\n n=n/m;\n bit[i]=c;\n i++;\n }\n for(i=count-1;i>=0;i--)\n {\n //printf(\"%d\",bit[i]);\n sum=sum+bit[i];\n }\n // printf(\"\\n\");\n}\nint gcd(int m,int n)\n{\n int x,i,gcd;\n x=(m<n)?m:n;\n for(i=x;i>=1;)\n {\n if(m%i==0&&n%i==0)\n {gcd=i;break;}\n else i=i-1;\n }\n return gcd;\n}\nmain()\n{\n int a,i,g;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n binary(a,i);\n }\n //g=gcd(sum,a-2);\n printf(\"%d/%d\",(sum/gcd(sum,a-2)),(a-2)/gcd(sum,a-2));\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b);\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\n\tint i,no,nume=0,deno=0;\n\tfor(i=2;i<n;i++)\n\t{\tdeno++;\n\t\tno=n;\n\t\twhile(no>0)\n\t\t{\n\n\t\tnume=nume+no%i;\n\t\tno=no/i;\n\t\t}\n\t}\n\t int gcd1=gcd(nume,deno);\n\tif(gcd1==1)printf(\"%d/%d\",nume,deno);\n\telse\n\t{\n\t\t//int gcd1=gcd(nume,deno);\n\t//\tprintf(\"%d\\n\",gcd1);\n\t\tprintf(\"%d/%d\",nume/gcd1,deno/gcd1);\n\t}\n\n}\nint gcd(int a,int b)\n{\n\tint r=5;\n\twhile(r!=0)\n\t{\n\t\tr=a%b;\n\t\ta=b;\n\t\tb=r;\n\t}\n\treturn a;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i<A;i++){\n while(N != 0){\n X = X + (N % i);\n N = N / i;\n }\n N = A;\n }\n int Y = A - 2;\n for(int i=0;i<100;i++){\n for(int j=2;j<Y;j++){\n if((X % j == 0) && (Y % j ==0)){\n X /= j;\n Y /= j;\n break;\n }\n }\n }\n\n printf(\"%i/%i\", X,Y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n\n"}, {"source_code": "//\n// main.c\n// Numbers 13A\n//\n// Created by Petrucio on 10/27/20.\n// Copyright \u00a9 2020 Petrucio. All rights reserved.\n//\n\n\n#include <stdio.h>\nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i<n;i++)for(l=n;l;l/=i)s+=l%i;\n for(l=s,j=n-2;k=l%j;)l=j,j=k;\n printf(\"%ld/%ld\\n\",s/j,(n-2)/j);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint GCD(int a,int b);\nint main()\n{\n int n,z=0,x,y,j,sum,m;\n scanf(\"%d\", &n);\n for (j=2; j<n; j++){\n sum=0;\n m=n;\n while(m){\n sum+=(m%j);\n m/=j;\n }\n z+=sum;\n }\n\n x=GCD(z,n-2);\n z=z/x;\n y=(n-2)/x;\n\n printf(\"%d/%d\", z,y);\n return 0;\n}\n\nint GCD(int a, int b)\n{\n if (a%b==0) return b;\n return GCD(b,a%b);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,sum=0,i;\n scanf(\"%d\",&n);\n if(n>2)\n {\n for(i=2;i<n;i++)\n sum+=sumd(n,i);\n }\n int k=n-2;\n\n reduce(sum,k);\n return 0;\n\n}\nint sumd(int a,int b)\n{ int d=0;\n while(a>b-1)\n {\n d+=a%b;\n a/=b;\n }\n d+=a;\n return (d);\n}\nvoid reduce(int n,int d)\n{\n int max,p,q,i;\n if(n>d) max = n;\n else max=d;\n p=n;\n q=d;\n for(i=2;i<=max;i++)\n {\n while(n%i ==0 && d%i ==0)\n {\n n/=i;\n d/=i;\n }\n }\n printf(\"%d/%d\",n,d);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <math.h>\n\nint gcd(int x,int y){\nint i,f=1;\nif (x>y){\n for (i=x;i>1;i--){\n if(x%i==0){\n if(y%i==0){\n f=i;\n break;\n }\n }\n }\n}\nif(y>x){\n for (i=y;i>1;i--){\n if(x%i==0){\n if(y%i==0){\n f=i;\n break;\n }\n }\n }\n}\nif (x==y){\n f=x;\n}\nreturn f;\n}\n\nint convert(int x,int y)\n{\n int z=0;\n while(x>0)\n {\n z+=x%y;\n x=x/y;\n }\n return z;\n }\n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n sum+=convert(n,i);\n }\n int f=gcd(sum,n-2);\n if(f!=1)\n {\n sum/=f;\n n=n-2;\n n/=f;\n n=n+2;\n }\n printf(\"%d/%d\",sum,n-2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cmmdc(int a, int b)\n{\n if(a == b) return a;\n else \n if(a > b) return cmmdc(a-b,b); \n else return cmmdc(b - a,a);\n}\n\nint n, s = 0, z, b, numitor, numarator, dc;\n\nint main()\n{\n scanf(\"%d\", &n);\n numitor = n - 2;\n \n for (b = 2; b < n; b++)\n {\n z = n;\n \n while(z > 0)\n {\n s = s + z % b;\n z = z / b;\n }\n }\n \n numarator = s;\n dc = cmmdc(numarator, numitor);\n \n printf(\"%d/%d\", numarator / dc, numitor / dc);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint gcd (int a, int b)\n{\n while (a && b)\n if (a > b)\n a %= b;\n else\n b %= a;\n return a + b;\n}\n\nint main ()\n{\n int A;\n scanf (\"%d\", &A);\n int sum = 0;\n for (int i = 2; i < A; i++)\n {\n int a = A;\n while (a != 0)\n {\n sum += a % i;\n a /= i;\n }\n }\n\n int num = sum;\n int den = A - 2;\n int gcdval = gcd(num, den);\n num /= gcdval;\n den /= gcdval;\n printf (\"%d/%d\\n\", num, den);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i<A;i++){\n while(N != 0){\n X = X + (N % i);\n N = N / i;\n }\n N = A;\n }\n int Y = A - 2;\n for(int i=0;i<100;i++){\n for(int j=2;j<Y;j++){\n if((X % j == 0) && (Y % j ==0)){\n X /= j;\n Y /= j;\n break;\n }\n }\n }\n\n printf(\"%i/%i\", X,Y);\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\nint cmmdc(int a, int b)\n{\n if(a == b)\n {\n return a;\n }else\n {\n if(a > b)\n {\n return cmmdc(a-b,b);\n }else\n {\n return cmmdc(b-a,a);\n }\n }\n \n}\nint main()\n{\n int n, b, z, numarator;\n scanf(\"%d\",&n);\n \n int numitor = n - 2;\n int s = 0;\n \n for(b = 2; b < n; b++)\n {\n z = n;\n while(z > 0)\n {\n s += z % b;\n z = z / b;\n }\n }\n numarator = s;\n int dc = cmmdc(numarator, numitor);\n numarator = numarator / dc;\n numitor = numitor / dc;\n printf(\"%d/%d\",numarator,numitor);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n int \ngcd (int a, int b) \n{\n \n \nif (a % b == 0)\n \n \nreturn b;\n \n \nreturn gcd (b, a % b);\n\n \n}\n\n\n \n \n \n \nint \nmain () \n{\n \n \nint n;\n \n \nscanf (\"%d\", &n);\n \n \nint num = 0;\n \n \nint sum = 0;\n \n \nfor (int i = 2; i < n; i++)\n \n {\n \n \nnum = n;\n \n \nwhile (num > 0)\n\t\n\t{\n\t \n \nsum = sum + num % i;\n\t \n \nnum = num / i;\n\t\n}\n \n \n}\n \n \nint d = gcd (sum, n - 2);\n \n \nsum = sum / d;\n \n \n \nprintf (\"%d/%d\", sum, (n - 2) / d);\n\n \n}\n"}, {"source_code": "/* https://codeforces.com/contest/13/submission/18258391 (rainboy) */\n#include <stdio.h>\n\nint sum(int n, int b) {\n\treturn n < b ? n : sum(n / b, b) + n % b;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a, x, y, b, g;\n\n\tscanf(\"%d\", &a);\n\tx = 0;\n\ty = a - 2;\n\tfor (b = 2; b < a; b++)\n\t\tx += sum(a, b);\n\tg = gcd(x, y);\n\tx /= g, y /= g;\n\tprintf(\"%d/%d\\n\", x, y);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b);\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\n\tint i,no,nume=0,deno=0;\n\tfor(i=2;i<n;i++)\n\t{\tdeno++;\n\t\tno=n;\n\t\twhile(no>0)\n\t\t{\n\n\t\tnume=nume+no%i;\n\t\tno=no/i;\n\t\t}\n\t}\n\t int gcd1=gcd(nume,deno);\n\tif(gcd1==1)printf(\"%d/%d\",nume,deno);\n\telse\n\t{\n\t\t//int gcd1=gcd(nume,deno);\n\t//\tprintf(\"%d\\n\",gcd1);\n\t\tprintf(\"%d/%d\",nume/gcd1,deno/gcd1);\n\t}\n\n}\nint gcd(int a,int b)\n{\n\tint r=5;\n\twhile(r!=0)\n\t{\n\t\tr=a%b;\n\t\ta=b;\n\t\tb=r;\n\t}\n\treturn a;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i<n;i++)for(l=n;l;l/=i)s+=l%i;\n for(l=s,j=n-2;k=l%j;)l=j,j=k;\n printf(\"%ld/%ld\",s/j,(n-2)/j);\n}"}, {"source_code": "#include<stdio.h> \nint hcf(a,b){int i;\nfor(i=b;i>0;i--)\n{if((a%i==0)&&(b%i==0)) return i;}}\nint main(void)\n{ int j,n,num,p;\n int s=0;\n scanf(\"%d\",&n);\n for(j=2;j<n;j++)\n {\n num=n;\n while(num>0)\n {s+=num%j;\n num=num/j;\n }}p=hcf(s,n-2);\n printf(\"%d/%d\",s/p,(n-2)/p);\n return 0;\n } "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint gcd(a,b)\n{\n if(a==0)\n return b;\n else\n gcd(b%a,a);\n}\nint main()\n{\n int x,y,c,i,b,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i<a;i++)\n {\n n=a;\n do\n {\n sum=sum+n%i;\n n=n/i;\n }while(n!=0);\n }\n c=a-2;\n x=sum>c?sum:c;\n y=sum<c?sum:c;\n b=gcd(y,x);\n printf(\"%d/%d\\n\",sum/b,(a-2)/b);\n sum=0;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,n,d1,d2,d3,b1,D,N,t1,f1,b=0,t=0,f=0,s,sum=0;\n\n\n scanf(\"%d\",&n);\n d1=n;\n\n for(i=2;i<n;i++)\n {\n\n\n while(d1>0)\n\n {\n\n b1=d1%i;\n b=b+b1;\n d1=d1/i;\n\n\n }\n //printf(\"%d\",b);\n sum=sum+b;\n b=0;\n d1=n;\n }\n\n f=n-2;\n\n D=sum;\n N=f;\n for(i=2;i<=n;i++)\n {\n if(sum%i==0 && f%i==0)\n {\n D=sum/i;\n N=f/i;\n\n\n }\n\n\n\n\n }\n\n\n printf(\"%d/%d\",D,N);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int,int);\nint main()\n{\n\tint n,a,i,sum=0,b,h,l,m;\n\tscanf(\"%d\",&n);\n\tb=n;\n\tfor(i=2;i<n;i++)\n\t{\n\t\twhile(b!=0)\n\t\t{\n\t\ta=b%i;\n\t\tsum+=a;\n\t\tb/=i;\n\t\t}\n\t\tb=n;\n\t\t\n\t}\n\th=gcd(sum,b-2);\n\tl=sum/h;\n\tm=(b-2)/h;\n\n\t\n\tprintf(\"%d/%d\",l,m);\n\treturn 0;\n}\nint gcd(int x,int y)\n{\n\tint r;\n\tif(y)\n\t\tr=gcd(y,x%y);\n\telse\n\t\tr=x;\n\treturn r;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,sum=0,dig,n,i,j,k;\n\tscanf(\"%d\",&a);\nif(a==2)\nprintf(\"1/1\");\nelse\n\tfor(i=2;i<a;i++)\n\t\n\t{\n\t\tk=a;\n\t\twhile(k>=i)\n\t\t{\n\t\t\tdig=k%i;\n\t\t\tsum=dig+sum;\n\t\t\tk=k/i;\n\t\t}\n\t\tsum=sum+k;\n\t}\n\tn=a-2;\n\tfor(i=n;i>=2;i--)\n\t{\n\t\tif(sum%i==0&&n%i==0)\n\t\t{\n\t\t\tsum=sum/i;\n\t\t\tn=n/i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d/%d\",sum,n);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\n\n\nint cmmdc(int a,int b)\n{\n if(a == b) return a;\n else\n if(a > b) return cmmdc(a-b,b); else cmmdc(b - a,a); \n}\n\nint n,s = 0,z,b,numitor,numarator,dc;\n\n\nint main()\n{\n scanf(\"%d\",&n);\n numitor = n - 2;\n for (b = 2;b < n;b++)\n {\n z = n;\n while(z > 0)\n {\n s = s + z % b;\n z = z / b;\n \n }\n }\n numarator = s;\n dc = cmmdc(numarator, numitor);\n printf(\"%d/%d\\n\", numarator / dc,numitor / dc);\n \n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,j,k,sum=0;\n scanf(\"%d\",&a);\n for(i=a-1;i>1;i--)\n {\n\tj=a;\n\twhile(j!=0)\n\t{\n\t sum=sum+j%i;\n\t j=j/i;\n\t}\n }\n k=a-2;//finding GCD of a-2 & sum;\n for(i=2;i<=k;i++)\n {\n\twhile(sum%i==0 && k%i==0)\n\t{\n\t sum=sum/i;\n\t k=k/i;\n\t}\n }\n printf(\"%d/%d\",sum,k);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint gcd(int a,int b)\n{\n int t;\n while(b!=0)\n {\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n}\nmain()\n{\n int n,i,sum=0,num,a;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n num=n;\n while(num)\n {\n sum+=num%i;\n num=num/i;\n }\n }\n a=gcd(sum,n-2);\n printf(\"%d/%d\",sum/a,(n-2)/a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint gcd(int x,int y)\n{\n if(y==0)\n return x;\n else\n return gcd(y,x%y);\n}\n\nint main()\n{\n int n,i,j,k,x,y,z,sum=0;\n scanf(\"%d\",&n);\n x=n;\n for(i=2; i<n; i++)\n {\n while(x>0)\n {\n sum+=(x%i);\n x=x/i;\n }\n x=n;\n }\n y=gcd(sum,n-2);\n sum=sum/y;\n z=(n-2)/y;\n printf(\"%d/%d\",sum,z);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint frac(int m, int n)\n{\n int r = m % n;\n while (r != 0)\n {\n m = n;\n n = r;\n r = m % n;\n }\n return n;\n}\n\nint main()\n{\n int nr, base;\n scanf(\"%d\", &nr);\n\n int X=0, Y=nr-2;\n for (base = 2; base < nr; ++base)\n {\n int n=nr, ds=0;\n while (n != 0)\n {\n ds += n % base;\n n /= base;\n }\n X += ds;\n }\n\n int gcd = frac(X, Y);\n X /= gcd;\n Y /= gcd;\n printf(\"%d/%d\\n\", X, Y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint sum_base_x(int *input, int *base);\nint gcd(int a, int b);\n\nint main(int argc, char *argv[])\n{\n int A;\n scanf(\"%d\", &A);\n \n // find the representations for A in base 2 ~ (A-1)\n int i;\n int numerator = 0;\n for(i = 2; i <= A-1; i++){\n numerator += sum_base_x(&A, &i); \n }\n \n int denominator = A - 2;\n \n int gg = gcd(numerator, denominator);\n \n printf(\"%d/%d\\n\", numerator/gg, denominator/gg);\n \n //system(\"PAUSE\"); \n return 0;\n}\n\nint sum_base_x(int *input, int *base){\n int dividend = *input;\n int result = 0;\n while(*base * (*base - 1) < dividend){\n result += dividend % *base;\n dividend /= *base;\n }\n \n result += (dividend % *base) + (dividend / *base);\n return result;\n}\n\nint gcd(int a, int b){\n int g = 0;\n while(a != 0 && b != 0){\n if(a >= b){\n a %= b;\n g = b; \n }\n else{\n b %= a;\n g = a; \n }\n }\n \n return g;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i<A;i++){\n while(N != 0){\n X = X + (N % i);\n N = N / i;\n }\n N = A;\n }\n int Y = A - 2;\n for(int i=0;i<100;i++){\n for(int j=2;j<Y;j++){\n if((X % j == 0) && (Y % j ==0)){\n X /= j;\n Y /= j;\n break;\n }\n }\n }\n\n printf(\"%i/%i\", X,Y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,num=0,temp,x,den,j;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n temp=n;\n while(temp>0)\n {\n x=temp%i;\n num=num+x;\n temp=temp/i;\n }\n // printf(\"%d=%d\\n\",i,num);\n }\n for(j=n-2;j>=1;j--)\n {\n if(num%j==0 && (n-2)%j==0)\n break;\n\n }\n num=num/j;\n den=(n-2)/j;\n printf(\"%d/%d\\n\",num,den);\n // main();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nlong long resultaCb(long long n,long long m)\n{\n if(n<m)\n return 0;\n int i,t=1,ans=1;\n for(i=n;i>m;i--)/*Computation of the combination aCb*/\n {\n ans*=i;\n ans/=t++;\n }\n return ans;\n}\nint gcd(int a,int b)\n{\n int t=0;\n while(b)\n {\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n}\nint result(int n,int i)\n{\n int dgt=0;\n while(n)\n {\n dgt+=(n%i);\n n/=i;\n }\n return dgt;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,z=0,k=0,t=0,s=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5000]={0},c[1000001]={0},y[1000001]={0};\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n max=result(n,i);\n sum+=max;\n // printf(\"%d\\n\",max);\n }\n chk=gcd(sum,n-2);\n printf(\"%d/%d\",sum/chk,(n-2)/chk);\n return 0;\n \n \n}"}, {"source_code": "#include <stdio.h>\nint h(a,b){return b?h(b,a%b):a;}\nint main()\n{\n int a,s=0,i,j,z;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n for(j=a;j;s+=j%i,j/=i);\n j=h(s,a-2);\n printf(\"%d/%d\",s/j,(a-2)/j);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,p=0,j=0,c[20000],s,t,k,l;\n scanf(\"%d\",&a);\n l=a-2;\n for(i=2;i<a;i++)\n {\n s=a;\n while(s!=0)\n {\n c[p]=s%i;\n p++;\n s=s/i;\n }\n }\n\n for(t=0;t<p;t++)\n {\n j=j+c[t];\n }\n for(k=a-2;k>=2;k--)\n {\n if(j%k==0 && l%k==0)\n {\n j=j/k;\n l=l/k;\n }\n }\n printf(\"%d/%d\",j,l);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,s=0,i,j,z;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n for(j=a;j;s+=j%i,j/=i);\n for(i=s,j=a-2;z=i%j;i=j,j=z);\n printf(\"%d/%d\",s/j,(a-2)/j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int pp,qq,t,i,j,k,count=0;\n scanf(\"%d\", &t);\n for(i=2;i<t;i++)\n {\n k=t;\n while(k!=0)\n {\n count+=k%i;\n k=k/i;\n }\n }\n qq=t-2;\n for(pp=2;pp<1000;pp++)\n {\n if(count%pp==0 && qq%pp==0)\n {\n count=count/pp;\n qq=qq/pp;\n pp=1;\n }\n }\n printf(\"%d/%d\\n\", count, qq);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint func(int,int);\nint gcd(int,int);\nint main(void)\n{\n\tint a,x=0,y=0;\n\tscanf(\"%d\",&a);\n\tfor (int i=2;i<a;i++)\n\t{\n\t\tx+=func(a,i);\n\t\ty++;\n\t}\n\tint d=gcd(x,y);\n\tprintf(\"%d/%d\\n\",x/d,y/d);\n\treturn 0;\n}\nint func(int n,int b)\n{\n\tint result=0;\n\twhile (n>0)\n\t{\n\t\tresult+=(n%b);\n\t\tn/=b;\n\t}\n\treturn result;\n}\nint gcd(int x,int y)\n{\n\treturn x?gcd(y%x,x):y;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint gcd (int n,int d){\n int i;\n for(i = 999; i > 1 ; i--){\n if(n % i == 0 && d % i == 0)\n return i;\n }\n\n return -1;\n\n\n\n}\nint logic(int x,int base){\n int s = 0 ;\n\n while(x > 0)\n {\n s = s + x%base;\n x = x/base;\n }\n // printf(\"s = %d\\n\",s);\n return s;\n}\n\nint main(){\n\n int x;\n scanf(\"%d\",&x);\n int i;\n int sum = 0;\n for(i = 2 ; i < x ; i++){\n sum = sum + logic(x,i);\n }\n\n i = gcd(sum,x-2);\n if(i == -1){\n printf(\"%d/%d\",sum,x-2);\n }\n else\n printf(\"%d/%d\",sum/i,(x-2)/i);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint GCD(int x, int y)\n{\n while(x != y && x != 1 && y != 1)\n {\n if(y > x)\n y -= x;\n else if(x > y)\n x -= y;\n }\n if(y > x)\n {\n return x;\n }\n else if(x > y)\n {\n return y;\n }\n else\n {\n return x;\n }\n}\nint main()\n{\n int a , b , counter = 0 , sum = 0 , i , gcd;\n scanf(\"%I64d\",&a);\n for(i = 2;i < a;i++)\n {\n b = a;\n while(b > 0)\n {\n sum += b%i;\n b /= i;\n }\n counter++;\n }\n gcd = GCD(counter , sum);\n sum /= gcd;\n counter /= gcd;\n printf(\"%d/%d\",sum,counter);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i<n;i++)for(l=n;l;l/=i)s+=l%i;\n for(l=s,j=n-2;k=l%j;)l=j,j=k;\n printf(\"%ld/%ld\",s/j,(n-2)/j);\n}"}, {"source_code": "/* https://codeforces.com/contest/13/submission/18258391 (rainboy) */\n#include <stdio.h>\n\nint sum(int n, int b) {\n\treturn n < b ? n : sum(n / b, b) + n % b;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a, x, y, b, g;\n\n\tscanf(\"%d\", &a);\n\tx = 0;\n\ty = a - 2;\n\tfor (b = 2; b < a; b++)\n\t\tx += sum(a, b);\n\tg = gcd(x, y);\n\tx /= g, y /= g;\n\tprintf(\"%d/%d\\n\", x, y);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int,int);\nint main()\n{\n\tint n,a,i,sum=0,b,h,l,m;\n\tscanf(\"%d\",&n);\n\tb=n;\n\tfor(i=2;i<n;i++)\n\t{\n\t\twhile(b!=0)\n\t\t{\n\t\ta=b%i;\n\t\tsum+=a;\n\t\tb/=i;\n\t\t}\n\t\tb=n;\n\t\t\n\t}\n\th=gcd(sum,b-2);\n\tl=sum/h;\n\tm=(b-2)/h;\n\n\t\n\tprintf(\"%d/%d\",l,m);\n\treturn 0;\n}\nint gcd(int x,int y)\n{\n\tint r;\n\tif(y)\n\t\tr=gcd(y,x%y);\n\telse\n\t\tr=x;\n\treturn r;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint gcd (int a, int b)\n{\n return (b == 0) ? a : gcd (b, a%b);\n}\n\nint main()\n{\n int N, i, j;\n int sum, cnt, x ,y;\n scanf(\"%d\", &N);\n\n sum = 0;\n cnt = 0;\n\n for(i = 2; i < N; i++, cnt++)\n {\n j = N;\n while(j)\n {\n sum += j % i;\n j /= i;\n }\n }\n\n x = sum / gcd(sum,cnt);\n y = cnt / gcd(sum,cnt);\n\n printf(\"%d/%d\\n\", x, y);\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// Numbers 13A\n//\n// Created by Petrucio on 10/27/20.\n// Copyright \u00a9 2020 Petrucio. All rights reserved.\n//\n\n\n#include <stdio.h>\nint main(){\n long int n,i,l,j,k,s=0;\n scanf(\"%ld\",&n);\n for(i=2;i<n;i++)for(l=n;l;l/=i)s+=l%i;\n for(l=s,j=n-2;k=l%j;)l=j,j=k;\n printf(\"%ld/%ld\\n\",s/j,(n-2)/j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,x;\n\tscanf(\"%d\",&n);\n\tint S[n-2];\n\tfor(i=0;i<n;i++)\n\t{ S[i]=0;\t}\n\tint y,k;\n\ty=n;\n\tk=n-2;\n\tfor(i=2;i<n;i++)\n\t{\t\n\t\twhile(y!=0)\n\t\t{\n\t\t\tx=y%i;\n\t\t\tS[i-2]=S[i-2]+x;\n\t\t\ty=y/i;\t}\n\t\ty=n;\n\t\n\t}\n\tint z=0;\n\tfor(i=0;i<k;i++)\n\t{\n\t\tz=z+S[i];\t}\n\t\n\tfor(i=k;i>0;i--)\n\t{\tif((z%i==0)&&(k%i==0))\n\t\t{ break;}\n\t}\n\tprintf(\"%d/%d\",z/i,k/i);\n\treturn 0;\n\n\t\t\n}\t\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,sum=0,a,count=0,g;\n scanf(\"%d\",&n);\n m=n;\n for(i=2;i<=n-1;i++)\n {\n\n while(n!=0)\n {\n a=n%i;\n sum+=a;\n n=n/i;\n }\n count++;\n n=m;\n }\n g=gcd(sum,count);\n printf(\"%d/%d\\n\",sum/g,count/g);\n return 0;\n}\nint gcd(int a,int b)\n {\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint calBase(int n, int base);\n\nint main(void)\n{\n int n, sum = 0;\n\n scanf(\"%d\", &n);\n for(int i = 2; i < n; i++)\n sum += calBase(n, i);\n\n int a = sum, b = n - 2, r = a % b;\n\n while(r != 0)\n {\n a = b;\n b = r;\n r = a % b;\n }\n\n printf(\"%d/%d\", (int)(sum / b), (int)((n - 2) / b));\n\n\n\n return 0;\n}\n\nint calBase(int n, int base)\n{\n int sum = 0;\n\n while(n > 0)\n {\n sum += n % base;\n n /= base;\n }\n\n return sum;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\nint a,sum=0,b=2,temp,c,d=0;\nscanf(\"%d\",&a);\nwhile(a!=b){\n temp=a;\n while(temp!=0){\n sum+=temp%b;\n temp=temp/b;\n\n }\n d++;\n b++;\n}\nint f=2;\nc=d;\nif(d>2){\n while(f!=c){\n if(sum%f==0 && d%f==0){\n sum/=f;\n d/=f;\n }\n if(!(sum%f==0&&d%f==0)){\n f++;\n }\n\n }\n}\nelse{\nd=1;\n}\n\nprintf(\"%d/%d\",sum,d);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint search(int ,int);\nint gcd(int,int);\nint main()\n{\n int a,p;\n scanf(\"%d\",&a);\n int b=a-2,sum=0,k;\n for(int i=2;i<=a-1;i++)\n {\n k=search(a,i);\n sum=sum+k;\n }\n p=gcd(sum,b);\n printf(\"%d/%d\",(sum/p),(b/p));\n return 0;\n}\nint search(int i,int j)\n{\n int sum=0,t;\n while(i>0)\n {\n t=i%j;\n i=i/j;\n sum=sum+t;\n }\n return sum;\n}\nint gcd(int i,int j)\n{\n int temp;\n while(j!=0)\n {\n temp=j;\n j=i%j;\n i=temp;\n }\n return i;\n}"}, {"source_code": "#include <stdio.h>\n\nint n, s=0, z, b, numitor, dc; \nint numcom(int a, int b)\n{\n if(a==b) return a;\n else if(a>b) return numcom(a-b, b);\n else return numcom(a, b-a);\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n numitor=n-2;\n \n for(b=2; b<n; b++)\n {\n z=n;\n while(z>0)\n {\n s=s+z%b;\n z=z/b;\n }\n }\n dc=numcom(numitor, s);\n printf(\"%d/%d\", s/dc, numitor/dc);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint fun(int,int);\n\nint main()\n{\n int X,Y,A,i,x;\n \n X = Y = 0;\n \n scanf(\"%d\",&A);\n \n for(i=2;i<=A-1;i++)\n {\n Y++;\n \n x = fun(A,i);\n \n X += x; \n }\n \n x = (X<=Y)?X:Y;\n \n for(i=2;i<=x;i++)\n {\n while((X%i==0) && (Y%i==0))\n {\n X/=i;\n Y/=i;\n }\n \n }\n \n printf(\"%d/%d\",X,Y);\n \n \n return 0;\n \n}\n\n\nint fun(int n,int base)\n{\n int sum = 0;\n \n while(n!=0)\n {\n sum += n % base;\n n /= base;\n }\n \n return sum;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint GCD(int m, int n)\n{\n int r = m % n;\n while (r != 0)\n {\n m = n;\n n = r;\n r = m % n;\n }\n return n;\n}\n\nint main()\n{\n int A;\n scanf(\"%d\", &A);\n\n int X = 0, Y = A-2;\n for (int base = 2; base < A; ++base)\n {\n int n = A, ds = 0;\n while (n != 0)\n {\n ds += n % base;\n n /= base;\n }\n X += ds;\n }\n\n int gcd = GCD(X, Y);\n X /= gcd;\n Y /= gcd;\n printf(\"%d/%d\\n\", X, Y);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i , j , k , m , n , t , p;\n\tscanf(\"%d\",&n);\n\tt = 0;\n\tfor(i = 2 ; i<n ; i++)\n\t{\n\t\tk = 0;\n\t\tm = n;\n\t\twhile(m>=i&&m!=0)\n\t\t{\n\t\t\tk+=m%i;\n\t\t\tm/=i;\n\t\t}\n\t\tk+=m;\n\t\tt+=k;\n\t}\n\tp = n-2;\n\tfor(i = 2 ; i<=t ; i++)\n\t{\n\t\twhile((p%i==0)&&(t%i==0))\n\t\t{\n\t\t\tp/=i;\n\t\t\tt/=i;\n\t\t}\n\t}\n\tprintf(\"%d/%d\\n\",t,p);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,p=0,j=0,c[20000]={},s,t=0,k,l;\n scanf(\"%d\",&a);\n l=a-2;\n for(i=2;i<a;i++)\n {\n s=a;\n while(s!=0)\n {\n c[p]=s%i;\n p++;\n s=s/i;\n }\n }\n for(t=0;t<p;t++)\n {\n j=j+c[t];\n }\n for(k=l;k>=2;k--)\n {\n if(j%k==0 && l%k==0)\n {\n j=j/k;\n l=l/k;\n }\n }\n printf(\"%d/%d\",j,l);\n}\n"}, {"source_code": "#include <stdio.h>\nint hcf(int a,int b){return b?hcf(b,a%b):a;}\nint main()\n{int a,i,j,h,sd=0;\nscanf(\"%d\",&a);\nfor(i=2;i<a;i++)\nfor(j=a;j;sd+=j%i,j/=i);\nh=hcf(sd,a-2);\nprintf(\"%d/%d\",sd/h,(a-2)/h);\n return 0;\n\n }\n\n"}, {"source_code": "#include<stdio.h>\nint lcm(int a,int b){\n if(b==0) return a;\n else return lcm(b,a%b);\n}\nint main(){\n int n,ans=0,i;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++){\n int temp=n;\n while(temp>0){\n ans+=temp%i;\n temp/=i;\n }\n }\n int l=lcm(ans,n-2);\n printf(\"%d/%d\",ans/l,(n-2)/l);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if (a < b) return gcd(b, a);\n\n if (a % b == 0) return b;\n\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n, x = 0, y = 0, g, i;\n\n scanf(\"%d\", &n);\n\n for (i = 2; i < n; i++) {\n\t int m = n;\n\n\t while (m) {\n\t x += m % i;\n\t m /= i;\n\t }\n\n\t y++;\n }\n\n g = gcd(x, y);\n x /= g;\n y /= g;\n\n printf(\"%d/%d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint gcd(int a,int b)\n{\n int temp,g;\n if(a==0 || b==0) g=0;\n else {\n while(b>0){\n temp=b;\n b=a%b;\n a=temp;\n }\n g=a;\n }\n return g;\n}\nint main()\n{\n int n,m,i,x=0,ans,y,g;\n scanf(\"%d\",&n);\n y=n-2;\n for(i=2;i<=n-1;i++){\n m=n;\n while(m>0){\n x=x+m%i;\n m=m/i;\n }\n }\n g=gcd(x,y);\n x=x/g;\n y=y/g;\n printf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong sumcs(int m,int n){\n\tlong kq=0;\n\twhile(m>0){\n\t\tkq=kq+m%n;\n\t\tm=m/n;\n\t}\n\treturn kq;\n\t}\nlong ucln(long a,long b){\n\twhile(a%b!=0&&b%a!=0){\n\t\tif(a>b)a=a%b;else b=b%a;\n\t}\n\tif(a>b)return b;return a;\n}\nint main(){\nlong x,y,s=0;\nint a,i;\nscanf(\"%d\",&a);\nfor(i=2;i<a;i++)s=s+sumcs(a,i);\nx=s/ucln(s,a-2);y=(a-2)/ucln(s,a-2);\nprintf(\"%d/%d\",x,y);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint gcd(a,b)\n{\n if(a==0)\n return b;\n else\n gcd(b%a,a);\n}\nint main()\n{\n int x,y,c,i,b,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i<a;i++)\n {\n n=a;\n do\n {\n sum=sum+n%i;\n n=n/i;\n }while(n!=0);\n }\n c=a-2;\n x=sum>c?sum:c;\n y=sum<c?sum:c;\n b=gcd(y,x);\n printf(\"%d/%d\\n\",sum/b,(a-2)/b);\n sum=0;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <assert.h>\n\nint sum(int x, int b)\n{\n int ans = 0;\n\n while(x > 0)\n {\n ans += x % b;\n x /= b;\n }\n\n return ans;\n}\n\nint gcd(int a, int b)\n{\n return a == 0? b: gcd(b % a, a);\n}\n\nint main()\n{\n int n;\n assert(scanf(\"%d\", &n) == 1);\n\n int p = 0, q = 0;\n\n int i;\n for(i = 2; i <= n - 1; i++)\n {\n p += sum(n, i);\n q++;\n }\n\n int g = gcd(p, q);\n p /= g;\n q /= g;\n\n printf(\"%d/%d\", p, q);\n puts(\"\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, s=0, z, b, numitor, dc; \nint numcom(int a, int b)\n{\n if(a==b) return a;\n else if(a>b) return numcom(a-b, b);\n else return numcom(a, b-a);\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n numitor=n-2;\n \n for(b=2; b<n; b++)\n {\n z=n;\n while(z>0)\n {\n s=s+z%b;\n z=z/b;\n }\n }\n dc=numcom(numitor, s);\n printf(\"%d/%d\", s/dc, numitor/dc);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint gcd( int x, int y )\n{\n int c = x % y;\n if (c==0) return( y ); else return( gcd( y, c ) );\n}\n\nmain()\n{\n int i, o, p, j, k, l, n, m;\n\n scanf( \"%d\", &n );\n\n m = 0;\n for (i=2;i<n;++i)\n {\n p = n;\n while( p>0 ){ m+=p%i; p/=i;}\n }\n\n n = n - 2;\n k = gcd( m, n );\n n /= k;\n m /= k;\n\n printf( \"%d/%d\\n\",m, n );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//int arr[10100];\nint sum;\nint n;\nint k;\nint gcd (int a,int b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\n\nint fun(int d,int n)\n{\n int rem;\n int sum=0;\n while(n)\n {\n sum+=n%d;\n n/=d;\n }\n return sum;\n\n}\n\n\nint main()\n{\n\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n int i;\n\n for(i=2;i<n;i++)\n {\n\n sum+=fun(i,n);\n\n\n }\n k=n-2;\n //printf(\"%d\\n\",sum);\n //printf(\"%d\\n\",k);\n int g=gcd(k,sum);\n\n printf(\"%d/%d\",sum/g,k/g);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n int i,a,s=0,hcf,t;\n scanf(\"%d\",&a);\n for(i=2;i<=(a-1);i++)\n {\n t=a;\n while(t!=0)\n {\n s=s+(t%i);\n t=(t/i);\n }\n }\n hcf=gcd(s,a-2);\n printf(\"%d/%d\",(s/hcf),((a-2)/hcf));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong sumcs(int m,int n){\n\tlong kq=0;\n\twhile(m>0){\n\t\tkq=kq+m%n;\n\t\tm=m/n;\n\t}\n\treturn kq;\n\t}\nlong ucln(long a,long b){\n\twhile(a%b!=0&&b%a!=0){\n\t\tif(a>b)a=a%b;else b=b%a;\n\t}\n\tif(a>b)return b;return a;\n}\nint main(){\nlong x,y,s=0;\nint a,i;\nscanf(\"%d\",&a);\nfor(i=2;i<a;i++)s=s+sumcs(a,i);\nx=s/ucln(s,a-2);y=(a-2)/ucln(s,a-2);\nprintf(\"%d/%d\",x,y);\n}"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if (a < b) return gcd(b, a);\n\n if (a % b == 0) return b;\n\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n, x = 0, y = 0, g, i;\n\n scanf(\"%d\", &n);\n\n for (i = 2; i < n; i++) {\n\t int m = n;\n\n\t while (m) {\n\t x += m % i;\n\t m /= i;\n\t }\n\n\t y++;\n }\n\n g = gcd(x, y);\n x /= g;\n y /= g;\n\n printf(\"%d/%d\\n\", x, y);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d\",&a);\n int i,sum=0;\n for(i=2;i<a;i++)\n {\n for(b=a;b>0;)\n {\n sum+=b%i;\n b=b/i;\n }\n\n }\n\n b=a-2;\n for(i=b;i>=2;i--)\n {\n if((sum%i==0)&&(b%i==0))\n {\n sum/=i;\n b/=i;\n }\n }\n printf(\"%d/%d\",sum,b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,sum=0,i,rem=0,div,real,k,gcd;\n scanf(\"%d\",&num);\n real=num;\n i=num-1;\n while(1)\n {\n if(i<2) break;\n while(1)\n {\n div=num/i;\n rem=num%i;\n sum=sum+rem;\n //printf(\"%d \",rem);\n if(div==0) break;\n num=div;\n }\n // printf(\"\\n\");\n num=real;\n i--;\n }\n for(k=1;k<=num-2;k++)\n {\n if(sum%k==0 && (num-2) %k==0)\n {\n gcd=k;\n }\n }\n\n printf(\"%d/%d\",sum/gcd,(num-2)/gcd);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,rem,count=0,j,b;\n\tscanf(\"%d\",&n);\n\tb=n;\n\tfor (i=2;i<n;i++)\n\t{\n\t\twhile(b!= 0)\n\t\t{rem = b % i;\n\t\t\tcount+=rem;\n\t\t\tb = b/i;}\n\t\tb=n;\n\t}\n\tint p;\n\tp=(n-2);\n\tfor(i=p;i>1;i--)\n\t{if (count % i == 0 && p % i == 0)\n\t\t{count /= i;\n\t\t\tp/= i;}\n\t}\n\tprintf(\"%d/%d\",count,p);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint \ngcdr ( int a, int b )\n{\n\t if ( a==0 ) return b;\n\t return gcdr ( b%a, a );\n}\n\nint main()\n{\n\tint n,temp,sum,msum,b,tc;\n//\tscanf(\"%d\",&tc);\n//\twhile(tc--)\n//\t{\n\tscanf(\"%d\",&n);int t=n-2;\n\tmsum=0;\n\tfor(b=2;b<=n-1;b++)\n\t{\n\t\t sum=0;\n\t\ttemp=n;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tsum+=temp%b;\n\t\t\ttemp=temp/b;\n\t\t}\n\t\tmsum+=sum;\n\t}\n\tprintf(\"%d/%d\\n\",msum/gcdr(msum,t),t/gcdr(msum,t));\n//\t}\n\treturn 0;\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nfor(i=r;i>1;i--)\n if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,n=0,i,r,sum=0,t;\n\tscanf(\"%d\",&n);\n\tt=n;\n\tfor(i=2;i<n;i++)\n\t{\t\n\t\twhile(n!=0)\n\t\t{\t\n\t\t\tr=n%i;\n\t\t\tsum=sum+r;\n\t\t\tn=n/i;\n\t\t}\n\t\tn=t;\n\t}\n\tk=n-2;\n\tfor(i=k;i>1;i--)\n\t{\n\t\tif(sum%i==0 && k%i==0)\n\t\t{\n\t\t\tsum=sum/i;\n\t\t\tk=k/i;\n\t\t}\n\t}\n\tprintf(\"%d/%d\",sum,k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, i, x, y, sum=0, s, d;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++){\n x=n;\n while(x!=0){\n y=x%i;\n sum=sum+y;\n x=x/i;\n }\n }\n for(i=(n-2);i>0;i--){\n if(sum%i==0 && (n-2)%i==0){\n s=sum/i;\n d=(n-2)/i;\n printf(\"%d/%d\",s,d);\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint HCF(int a,int b)\n{\nint c;\nwhile(b!=0)\n{\nc=a%b;\na=b;\nb=c;\n}\nreturn a;\n}\n\n\nint main()\n{\nint A,i,b;\nscanf(\"%d\",&A);\nint num,sum=0;\nfor(i=2;i<A;i++)\n{\nnum=A;\nwhile(num!=0)\n{\nb=num%i;\nsum+=b;\nnum/=i;\n}\n}\nif(HCF(sum,A-2)==1 )\n{\nprintf(\"%d/%d\",sum,(A-2));\n}\nelse\n{\nb=HCF(sum,A-2);\nprintf(\"%d/%d\",sum/b,(A-2)/b);\n}\nreturn 0;\n}\n\n\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\tint n=0,i,r,sum=0,t;\n\tscanf(\"%d\",&n);\n\tt=n;\n\tfor(i=2;i<n;i++)\n\t{\t\n\t\twhile(n!=0)\n\t\t{\t\n\t\t\tr=n%i;\n\t\t\tsum=sum+r;\n\t\t\tn=n/i;\n\t\t}\n\t\tn=t;\n\t}\n\t\n\tfor(i=n-2;i>1;i--)\n\t{\n\t\tif(sum%i==0 && n%i==0)\n\t\t{\n\t\t\tsum=sum/i;\n\t\t\tn=n/i;\n\t\t}\n\t}\n\tprintf(\"%d/%d\",sum,n-2);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint hcf(int a, int h) \n{\n\tint temp; \n\twhile(1)\n\t{\n\t\ttemp = a%h;\n\t\tif(temp==0)\n\t\t\treturn h;\n\t\ta = h;\n\t\th = temp;\n\t}\n}\nint main()\n{\n\tint n,temp,sum,msum,b;\n\tscanf(\"%d\",&n);int t=n-2;\n\tfor(b=2;b<=n-1;b++)\n\t{\n\t\t sum=0;\n\t\ttemp=n;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tsum+=temp%b;\n\t\t\ttemp=temp/b;\n\t\t}\n\t\tmsum+=sum;\n\t}\n\tif(!hcf(msum,t))\n\tprintf(\"%d/%d\\n\",msum,t);\n\telse\n\t{\n\t\twhile(hcf(msum,t)>1)\n\t\t{\n\t\t\tmsum/=hcf(msum,t);\n\t\t\t t/=hcf(msum,t);\n\t\t}\n\tprintf(\"%d/%d\\n\",msum,t);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint base(int n,int b)\n{\n\tint i,sum;\n\tsum=0;\n\ti=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+((pow(10,i))*(n%b));\n\t\tn=n/b;\n\t\ti=i+1;\n\t}\n\treturn sum;\n}\nint gcd(int a,int b)\n{\n\tint ans;\n\tif(a%b==0)\n\t{\n\t\tans=b;\n\t}\n\telse\n\t{\n\t\tans=gcd(b,a%b);\n\t}\n\treturn ans;\n}\nint digit_sum(int n)\n{\n\tint sum=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main()\n{\n\tint temp,num,sum,count;\n\tsum=0;\n\tcount=0;\n\tscanf(\"%d\",&num);\n\tfor(int i=2;i<num;i++)\n\t{\n\t\tsum=sum+(digit_sum(base(num,i)));\n\t\tcount=count+1;\n\t}\n\ttemp=gcd(sum,count);\n\t\n\tprintf(\"%d/%d\",sum/temp,count/temp);\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main (){\n int A,z,i,j;\n long int reminder=0,count=0;\n scanf(\"%d\",&A);\n z=A;\n for(i=2;i<A;i++){\n for(j=0; ;j++){\n reminder=A%i+reminder;\n A=A/i;\n if(A==0) break;\n }\n A=z;\n count++;\n\n }\n for(i=2; ;i++){\n\n if(reminder%i==0&&count%i==0){\n reminder=reminder/i;\n count=count/i;\n i=1;\n }\n else if(reminder%i!=0&&count%i!=0) break;\n }\n printf(\"%d/%d\",reminder,count);\n\n\n\nreturn 0;\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint r;\n\nvoid calc( int n, int base ){\n int k;\n /*printf(\"%d : \", base );*/\n while( n >= base ){\n k = n%base;\n/* printf(\"%d\", k);*/\n while( k >= 10 ){ r += (k%10); k/=10; }\n r += k;\n n /= base; \n } \n/* printf(\"%d\", k);\n printf(\"\\n\");*/\n k = n;\n/* printf(\"%d\", k);*/\n while( k >= 10 ){ r += (k%10); k/=10; }\n r += k;\n}\n\nint main(){\n int n, i;\n \n scanf(\"%d\", &n );\n \n r = 0;\n for( i = 2; i<n; i++ )\n calc( n, i );\n \n printf(\"%d/%d\\n\", r, n-2 );\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int A,i,c=0,d,r;\n scanf(\"%d\",&A);\n\n for(i=2;i<A;i++){\n\n d = A;\n while(d!=0){\n\n r = d % i;\n c = c + r;\n d = d/i;\n\n }\n\n }\n\n printf(\"%d/%d\",c,A-2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n x=a;\n while(x>0)\n {\n s=s+x%i;\n x=x/i;\n }\n }\n printf(\"%d/%d\",s,a-2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint base(int n,int b)\n{\n\tint i,sum;\n\tsum=0;\n\ti=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+((pow(10,i))*(n%b));\n\t\tn=n/b;\n\t\ti=i+1;\n\t}\n\treturn sum;\n}\nint gcd(int a,int b)\n{\n\tint ans;\n\tif(a%b==0)\n\t{\n\t\tans=b;\n\t}\n\telse\n\t{\n\t\tans=gcd(b,a%b);\n\t}\n\treturn ans;\n}\nint digit_sum(int n)\n{\n\tint sum=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main()\n{\n\tint temp,num,sum,count;\n\tsum=0;\n\tcount=0;\n\tscanf(\"%d\",&num);\n\tfor(int i=2;i<num;i++)\n\t{\n\t\tsum=sum+(digit_sum(base(num,i)));\n\t\tcount=count+1;\n\t}\n\ttemp=gcd(sum,count);\n\tprintf(\"%d/%d\",sum/temp,count/temp);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\nint a,sum=0,b=2,temp,c,d=0;\nscanf(\"%d\",&a);\nc=a-1;\nwhile(a!=b){\n temp=a;\n while(temp!=0){\n sum+=temp%b;\n temp=temp/b;\n\n }\n d++;\n b++;\n}\nif(sum%d==0){\n sum/=d;\n d=1;\n}\nprintf(\"%d/%d\",sum,d);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,sum=0,i,rem=0,div,real;\n scanf(\"%d\",&num);\n real=num;\n i=num-1;\n while(1)\n {\n if(i<2) break;\n while(1)\n {\n div=num/i;\n rem=num%i;\n sum=sum+rem;\n //printf(\"%d \",rem);\n if(div==0) break;\n num=div;\n }\n // printf(\"\\n\");\n num=real;\n i--;\n }\n printf(\"%d/%d\",sum,num-2);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint base(int n,int b)\n{\n\tint i,sum;\n\tsum=0;\n\ti=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+((pow(10,i))*(n%b));\n\t\tn=n/b;\n\t\ti=i+1;\n\t}\n\treturn sum;\n}\nint gcd(int a,int b)\n{\n\tint ans;\n\tif(a%b==0)\n\t{\n\t\tans=b;\n\t}\n\telse\n\t{\n\t\tans=gcd(b,a%b);\n\t}\n\treturn ans;\n}\nint digit_sum(int n)\n{\n\tint sum=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main()\n{\n\tint temp,num,sum,count;\n\tsum=0;\n\tcount=0;\n\tscanf(\"%d\",&num);\n\tfor(int i=2;i<num;i++)\n\t{\n\t\tsum=sum+(digit_sum(base(num,i)));\n\t\tcount=count+1;\n\t}\n\ttemp=gcd(sum,count);\n\tprintf(\"%d/%d\",sum/temp,count/temp);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n,i,j,k;\n int rem=0;\n scanf(\"%d\",&n);\n rem=0;\n for(i=2;i<=n-1;i++){\n j=n;\n while(j>0){\n rem=rem+j%i;\n j=j/i;\n }\n }\n\n printf(\"%d/%d\\n\",rem,n-2);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long a , b , counter = 0 , sum = 0 , i , counter1,sum1;\n scanf(\"%I64d\",&a);\n for(i = 2;i < a;i++)\n {\n b = a;\n while(b > 0)\n {\n sum += b%i;\n b /= i;\n }\n counter++;\n }\n counter1 = counter;\n sum1 = sum;\n while(sum1 != counter1 && sum1 != 1 && counter1 != 1)\n {\n if(counter1 > sum1 )\n counter1 -= sum1;\n else if(sum1 > counter1)\n sum1 -= counter1;\n }\n if(sum == sum1)\n {\n sum1 = 1;\n }\n sum /= sum1;\n counter /= sum1;\n printf(\"%I64d/%I64d\",sum,counter);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint fun(int,int);\n\nint main()\n{\n int X,Y,A,i,x;\n \n X = Y = 0;\n \n scanf(\"%d\",&A);\n \n for(i=2;i<=A-1;i++)\n {\n Y++;\n \n x = fun(A,i);\n \n X += x; \n }\n \n \n for(i=2;i<=x;i++)\n {\n while((X%i==0) && (Y%i==0))\n {\n X/=i;\n Y/=i;\n }\n \n }\n \n printf(\"%d/%d\",X,Y);\n \n \n return 0;\n \n}\n\n\nint fun(int n,int base)\n{\n int sum = 0;\n \n while(n!=0)\n {\n sum += n % base;\n n /= base;\n }\n \n return sum;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,num=0,temp,x;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n temp=n;\n while(temp>0)\n {\n x=temp%i;\n num=num+x;\n temp=temp/i;\n }\n // printf(\"%d=%d\\n\",i,num);\n }\n printf(\"%d/%d\\n\",num,n-2);\n // main();\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long int r;\n\nvoid calc( int n, int base ){\n int k;\n while( n >= base ){\n k = n%base;\n while( k >= 10 ){ r += (k%10); k/=10; }\n r += k;\n n /= base; \n } \n k = n;\n while( k >= 10 ){ r += (k%10); k/=10; }\n r += k;\n}\n\nint main(){\n int n, i;\n \n scanf(\"%d\", &n );\n \n r = 0;\n for( i = 2; i<n; i++ )\n calc( n, i );\n \n printf(\"%I64d/%d\\n\", r, n-2 );\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,m,s=0,d;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n m=n;\n while(m>0)\n {\n s+=m%i;\n m=m/i;\n }\n }\n d=n-2;\n for(i=2;i<=d;i++)\n {\n if(s%i==0&&d%i==0)\n {\n s=s/i;\n d=d/i;\n }\n }\n printf(\"%d/%d\\n\",s,d);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cmmdc(int a, int b)\n{\n if(a == b) return a;\n else if (a > b) return cmmdc(a - b,b); else return cmmdc( b - a,a);\n}\nint n, s, b, z, numitor, numarator, dc;\nint main()\n{\n scanf(\"%d\", &n);\n numitor = n - 2;\n for(b = 2; b < n; b++)\n {\n z = n;\n while (z > 0){\n s = s + z % b;\n z = z / b;\n }\n }\n numarator = s;\n dc = cmmdc(numarator, numitor);\n printf(\"%d/%d \", numarator / dc, numitor /dc);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,sum=0,i,rem=0,div,real,k;\n scanf(\"%d\",&num);\n real=num;\n i=num-1;\n while(1)\n {\n if(i<2) break;\n while(1)\n {\n div=num/i;\n rem=num%i;\n sum=sum+rem;\n //printf(\"%d \",rem);\n if(div==0) break;\n num=div;\n }\n // printf(\"\\n\");\n num=real;\n i--;\n }\n for(k=2;k<=sum;k++)\n {\n if(sum%k==0 && (num-2) %k==0)\n {\n sum=sum/k;\n num=(num-2)/k;\n printf(\"%d/%d\",sum,num);\n return 0;\n }\n }\n printf(\"%d/%d\",sum,num-2);\n}\n"}, {"source_code": "#include <stdio.h>\nint i, x, k, t, s, n;\nint main()\n{\n scanf(\"%d\", &n);\n for(x = 2; x <= n-1; x++)\n {\n t = n;\n while (t > 0)\n {\n k = t % x;\n s += k;\n t = t / x;\n }\n }\n printf(\"%d/%d\", s, n-2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int a,i,l,sum=0;\n scanf(\"%ld\",&a);\n for(i=2;i<a;i++)\n {\n l=a;\n while(l)\n {\n sum+=l%i;\n l/=i;\n }\n }\n printf(\"%ld/%ld\\n\",sum,a-2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n x=a;\n while(x>0)\n {\n s=s+x%i;\n x=x/i;\n }\n }\n printf(\"%d/%d\",s,a-2);\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// Numbers 13A\n//\n// Created by Petrucio on 10/27/20.\n// Copyright \u00a9 2020 Petrucio. All rights reserved.\n//\n\n#include <stdio.h>\n\nint main() {\n int n,i,l,j,s=0;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)for(l=n;l;l/=i)s+=l%i;\n printf(\"%d/%d\",s,n-2);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint dsum(int n, int base) {\n\treturn n < base ? n : dsum(n / base, base) + n % base;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a;\n\tint p, q, b, g;\n\t\n\tscanf(\"%d\", &a);\n\tq = a - 2;\n\tp = 0;\n\tfor (b = 2; b < a; b++)\n\t\tp += dsum(a, b);\n\tprintf(\"%d/%d\\n\", p, q);\n\tg = gcd(p, q);\n\tp /= g;\n\tq /= g;\n\tprintf(\"%d/%d\\n\", p, q);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int a,b=0,c,d,i,m,l=0,n;\n scanf(\"%d\",&n);\n \n for(i=2;i<=n-1;i++){\n m=n;\n do{ \n a=m%i;\n c=m/i;\n \n b=b+a;\n \n m=c;\n \n }while(m!=0);\n }\n\n printf(\"%d/%d\\n\",b,n-2);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint func(int n,int ar[],int x)\n{\n int i=0,c=0;\n while(n!=0)\n {\n ar[i++]=n%x;\n n/=x;\n c+=ar[i-1];\n }\n return c;\n}\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int ar[12];\n \n for(i=2;i<n;i++){\n c+=func(n,ar,i); \n }\n printf(\"%d/%d\",c,n-2);\n \n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint base(int n,int b)\n{\n\tint i,sum;\n\tsum=0;\n\ti=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+((pow(10,i))*(n%b));\n\t\tn=n/b;\n\t\ti=i+1;\n\t}\n\treturn sum;\n}\nint gcd(int a,int b)\n{\n\tint ans;\n\tif(a%b==0)\n\t{\n\t\tans=b;\n\t}\n\telse\n\t{\n\t\tans=gcd(b,a%b);\n\t}\n\treturn ans;\n}\nint digit_sum(int n)\n{\n\tint sum=0;\n\twhile(n!=0)\n\t{\n\t\tsum=sum+(n%10);\n\t\tn=n/10;\n\t}\n\treturn sum;\n}\nint main()\n{\n\tint temp,num,sum,count;\n\tsum=0;\n\tcount=0;\n\tscanf(\"%d\",&num);\n\tfor(int i=2;i<num;i++)\n\t{\n\t\tsum=sum+(digit_sum(base(num,i)));\n\t\tcount=count+1;\n\t}\n\ttemp=gcd(sum,count);\n\t\n\tprintf(\"%d/%d\",sum/temp,count/temp);\n}"}, {"source_code": "#include <stdio.h>\n\nint r;\n\nvoid calc( int n, int base ){\n int k;\n \n while( n >= base ){\n k = n%base;\n while( k >= 10 ){ r += k%10; k/=10; }\n r += k;\n n /= base; \n } \n \n r+=n;\n}\n\nint main(){\n int n, i;\n \n scanf(\"%d\", &n );\n \n r = 0;\n for( i = 2; i<n; i++ )\n calc( n, i );\n \n printf(\"%d/%d\\n\", r, n-2 );\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//int ne[101];\nint main()\n{\n int a,i,x,s=0;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n x=a;\n while(x>0)\n {\n s=s+x%i;\n x=x/i;\n }\n }\n printf(\"%d/%d\",s,a-2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,sum=0,x,p=0,y;\n scanf(\"%d\",&n);\n x=n;\n for(i=2;i<n;i++){\n j=1;\n while(n>0){\n if(n>=j&&n<j*i){\n sum+=1;\n n-=j;\n j=1;\n }\n else\n j*=i;\n }\n n=x;\n }\n printf(\"%d/%d\\n\",sum,n-2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main (){\n int A,z,i,j;\n long int reminder=0,count=0;\n scanf(\"%d\",&A);\n z=A;\n for(i=2;i<A;i++){\n for(j=0; ;j++){\n reminder=A%i+reminder;\n A=A/i;\n if(A==0) break;\n }\n A=z;\n count++;\n }\n if(count%2==0)\n printf(\"%ld/%ld\",reminder/2,count/2);\n else printf(\"%ld/%ld\",reminder,count);\n\n\n\nreturn 0;\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,sum=0,x,p=0,y;\n scanf(\"%d\",&n);\n x=n;\n for(i=2;i<n;i++){\n j=1;\n while(n>0){\n if(n>=j&&n<j*i){\n sum+=1;\n n-=j;\n j=1;\n }\n else\n j*=i;\n }\n n=x;\n }\n //printf(\"%d/%d\\n\",sum,n-2);\n\n if(sum%(n-2)==0&&n-2!=1)\n printf(\"%d/1\\n\",sum/n-2);\n\n else if(sum%2==0){\n if((n-2)%2==0){\n y=n-2;\n while(y%2==0){\n p++; y=y/2;\n }\n sum=sum/(p*2);\n printf(\"%d/%d\\n\",sum,y);\n }\n else printf(\"%d/%d\\n\",sum,n-2);}\n\n else\n printf(\"%d/%d\\n\",sum,n-2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n, s = 0, z, b, numitor, numarator;\nint main()\n{\n scanf(\"%d\", &n);\n numitor = n - 2;\n for (b = 2; b < n; b++){\n z = n;\n while(z > 0){\n s = s + z % b;\n z = z / b;\n }\n numarator = s;\n }printf(\"%d/%d\", numarator, numitor);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,num=0,temp,x;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n temp=n;\n while(temp>0)\n {\n x=temp%i;\n num=num+x;\n temp=temp/i;\n }\n // printf(\"%d=%d\\n\",i,num);\n }\n printf(\"%d/%d\\n\",num,n-2);\n // main();\n}\n"}, {"source_code": "#include <stdio.h>\nint n , s = 0 , z , b , numitor, numarator , dc;\nint cmmnc(int a , int b)\n{\n if(a == b) return a;\n else \n if(a > b) return cmmnc(a - b , b);\n else return cmmnc(b - a, a);\n}\nint main()\n{\n scanf(\"%d\" , &n);\n numitor = n - 2;\n for(b = 2;b < n;b++)\n {\n z = n;\n while(z > 0)\n {\n s = s + z % b;\n z = z / b;\n }\n }\n numarator = s;\n dc = cmmnc(numarator,numitor);\n printf(\"%d / %d\\n\" , numarator / dc, numitor / dc);\n\n \n}\n"}, {"source_code": "#include <stdio.h>\n\nint sumOfDigitInBase(int number, int base)\n{\n int temp = number;\n int digitSum = 0;\n \n while (temp > 0)\n {\n digitSum += temp % base;\n temp = temp / base;\n }\n \n return digitSum;\n}\n\nint n;\n\nint main(int argc, const char * argv[]) {\n scanf(\"%d\", &n);\n \n int i = 0;\n int sum = 0;\n \n for (i = 2; i <= n-1; i++)\n {\n sum += sumOfDigitInBase(n, i);\n }\n \n int numerator = sum;\n int denominator = n - 2;\n \n for (i = 2; i <= numerator; i++)\n if ((numerator % i == 0) && (denominator % i == 0))\n {\n numerator = numerator / i;\n denominator = denominator / i;\n }\n \n printf(\"%d/%d\", numerator, denominator);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,r,t,s,x,y;\n while(scanf(\"%d\",&a)==1){\n x=a;\n s=0;\n for(i=2;i<=a-1;i++){\n do{\n t=a/i;\n r=a%i;\n s=s+r;\n a=t;\n }\n while(t!=0);\n a=x;\n }\n printf(\"%d/%d\\n\",s,(a-2));\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long A,i,z,sum=0,den=0;\n\tscanf(\"%lld\",&A);\n\tz=A;\n\tfor(i=2;i<A;i++)\n\t{\n\t\tden++;\n\t\tlong long t=z;\n\t\twhile(t!=0)\n\t\t{\n\t\t\tsum+=t%i;\n\t\t\tt/=i;\n\t\t}\n\t}\n\tprintf(\"%lld/%lld\\n\",sum,den);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,r=0,a=1,f,b;\n scanf(\"%d\", &n);\n b = n;\n for(i=2;i<n;i++)\n {\n while(a != 0)\n {\n a = n / i;\n f = n % i;\n n = a;\n r = r + f;\n }\n n = b;\n a = 1;\n }\n printf(\"%d/%d\",r,n-2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,sum=0,x,p=0,y;\n scanf(\"%d\",&n);\n x=n;\n for(i=2;i<n;i++){\n j=1;\n while(n>0){\n if(n>=j&&n<j*i){\n sum+=1;\n n-=j;\n j=1;\n }\n else\n j*=i;\n }\n n=x;\n }\n printf(\"%d/%d\\n\",sum,n-2);\n\n if(sum%(n-2)==0&&n-2!=1)\n printf(\"%d/1\\n\",sum/n-2);\n\n else if(sum%2==0){\n if((n-2)%2==0){\n y=n-2;\n while(y%2==0){\n p++; y=y/2;\n }\n sum=sum/(p*2);\n printf(\"%d/%d\\n\",sum,y);\n }\n else printf(\"%d/%d\\n\",sum,n-2);}\n\n else\n printf(\"%d/%d\\n\",sum,n-2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,i,s,f,g,k,a,v,m,j,h;\n\tscanf(\"%d\",&n);\n\t\n\tint ara[10000];\n\tint l[10000];\n\tk=0;\n\tfor(i=2;i<n;i++){\n\t\ta=n;\n\t\ts=0;\n\t\tf=1;\n\t\tg=0;\n\t\t\n\t\twhile (a!=0){\n\t\t\tg=a%i;\n\t\t\ts=s+g*f;\n\t\n\t\t\ta=a/i;\n\t\t\tf=f*10;\n\t\t}\n\t\t\n\t\tara[k]=s;\n\t\tk=k+1;\n\t}\n\t\n\tfor (i=0;i<k;i++){\n\t\tm=ara[i];\n\t\tj=0;\n\t\twhile(m!=0){\n\t\t\th=m%10;\n\t\t\tj=j+h;\n\t\t\tm=m/10;\n\t\t}\n\t\tl[i]=j;\n\t\n\t}\n\tv=0;\n\tfor (i=0;i<k;i++){\n\t\tv=v+l[i];\n\t}\n\tprintf(\"%d/%d\",v,k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,sum=0,i,rem=0,div,real,k;\n scanf(\"%d\",&num);\n real=num;\n i=num-1;\n while(1)\n {\n if(i<2) break;\n while(1)\n {\n div=num/i;\n rem=num%i;\n sum=sum+rem;\n //printf(\"%d \",rem);\n if(div==0) break;\n num=div;\n }\n // printf(\"\\n\");\n num=real;\n i--;\n }\n for(k=2;k<=sum;k++)\n {\n if(sum%k==0 && (num-2) %k==0)\n {\n sum=sum/k;\n num=(num-2)/k;\n printf(\"%d/%d\",sum,num);\n return 0;\n }\n }\n printf(\"%d/%d\",sum,num-2);\n}\n"}, {"source_code": "#include <stdio.h>\nint i, x, k, t, s, n;\nint main()\n{\n scanf(\"%d\", &n);\n for(x = 2; x <= n-1; x++)\n {\n t = n;\n while (t > 0)\n {\n k = t % x;\n if(k > 9) while(k>0){s += k%10; k /= 10;}\n else s += k;\n t = t / x;\n }\n }\n printf(\"%d/%d\", s, n-2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\nint a,sum=0,b=2,temp,c,d=3;\nscanf(\"%d\",&a);\nc=a-1;\nwhile(a!=b){\n temp=a;\n while(temp!=0){\n sum+=temp%b;\n temp=temp/b;\n\n }\n b++;\n}\nif(sum%3==0){\n sum/=3;\n d=1;\n}\nprintf(\"%d/%d\",sum,d);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int pp,qq,t,i,j,k,count=0;\n scanf(\"%d\", &t);\n for(i=2;i<t;i++)\n {\n k=t;\n while(k!=0)\n {\n count+=k%i;\n k=k/i;\n }\n }\n qq=t-2;\n for(pp=2;pp<1000;pp++)\n {\n if(count%pp==0 && qq%pp==0)\n {\n count=count/pp;\n qq=qq/pp;\n pp=2;\n }\n }\n printf(\"%d/%d\\n\", count, qq);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint i, x, k, t, s, n;\nint main()\n{\n scanf(\"%d\", &n);\n for(x = 2; x <= n-1; x++)\n {\n t = n;\n while (t > 0)\n {\n k = t % x;\n if(k > 9) while(k>0){s += k%10; k /= 10;}\n else s += k;\n t = t / x;\n }\n }\n printf(\"%d/%d\", s, n-2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int x=n;\n for(i=2;i<n;i++)\n {\n while(x>=i)\n {\n sum+=x%i;\n x/=i;\n }\n sum+=x;\n x=n;\n }\n int z=n-2;\n printf(\"%d\",sum);\n printf(\"/%d\",z);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long A,i,z,sum=0,den=0;\n\tscanf(\"%lld\",&A);\n\tz=A;\n\tfor(i=2;i<A;i++)\n\t{\n\t\tden++;\n\t\tlong long t=z;\n\t\twhile(t!=0)\n\t\t{\n\t\t\tsum+=t%i;\n\t\t\tt/=i;\n\t\t}\n\t}\n\tprintf(\"%lld/%lld\\n\",sum,den);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int A, ans = 0, tmp;\n scanf(\"%d\", &A);\n for(int i = 2; i < A; i++)\n {\n tmp = A;\n while(tmp > 0)\n {\n ans += tmp % i;\n tmp /= i;\n }\n }\n tmp = A-2;\n for(int i = 2; i < tmp; i++)\n {\n if(ans % i == 0 && tmp % i == 0)\n ans /= i, tmp /= i;\n }\n printf(\"%d/%d\\n\", ans, tmp);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int A, ans = 0, tmp;\n scanf(\"%d\", &A);\n for(int i = 2; i < A; i++)\n {\n tmp = A;\n while(tmp > 0)\n {\n ans += tmp % i;\n tmp /= i;\n }\n }\n tmp = A-2;\n for(int i = 2; i < tmp; i++)\n {\n if(ans % i == 0 && tmp % i == 0)\n ans /= i, tmp /= i;\n }\n printf(\"%d/%d\\n\", ans, tmp);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a , b , counter = 0 , sum = 0 , i;\n scanf(\"%d\",&a);\n for(i = 2;i < a;i++)\n {\n b = a;\n while(b > 0)\n {\n sum += b%i;\n b /= i;\n }\n counter++;\n }\n printf(\"%d/%d\",sum,counter);\n return 0;\n}\n"}, {"source_code": "# include <stdio.h>\n# include <conio.h>\n\nint main()\n{\n int A,i,count,c,d,X,Y;\n scanf(\"%d\", &A);\n \n count = 0;\n for(i = 2; i < A; i++){\n c = A;\n while(c != 0){\n d = c;\n c = c/i;\n count = count + (d%i);\n }\n }\n \n X = count;\n Y = (A-2);\n printf(\"%d/%d\", X,Y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,m,s=0,d;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n m=n;\n while(m>0)\n {\n s+=m%i;\n m=m/i;\n }\n }\n d=n-2;\n for(i=2;i<=d;i++)\n {\n if(s%i==0&&d%i==0)\n {\n s=s/i;\n d=d/i;\n }\n }\n printf(\"%d/%d\\n\",s,d);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main (){\n int A,z,i,j;\n long int reminder=0,count=0;\n scanf(\"%d\",&A);\n z=A;\n for(i=2;i<A;i++){\n for(j=0; ;j++){\n reminder=A%i+reminder;\n A=A/i;\n if(A==0) break;\n }\n A=z;\n count++;\n\n }\n for(i=2; ;i++){\n\n if(reminder%2==0&&count%2==0){\n reminder=reminder/2;\n count=count/2;\n\n }\n else if(reminder%i!=0&&count%i!=0) break;\n }\n printf(\"%d/%d\",reminder,count);\n\n\n\nreturn 0;\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, b, x;\n\n\tscanf(\"%d\", &a);\n\tx = 0;\n\tfor (b = 2; b < a; b++) {\n\t\tint a_;\n\n\t\ta_ = a;\n\t\twhile (a_ > 0) {\n\t\t\tx += (a_ % b);\n\t\t\ta_ /= b;\n\t\t}\n\t}\n\tprintf(\"%d/%d\\n\", x, a - 2);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int p=0,i,t,n;\n scanf(\"%d\",&n);\n for(i=2;i<n;i++)\n {\n t=n;\n while(t!=0)\n {\n p+=t%i;\n t=t/i;\n }\n }\n printf(\"%d/%d\",p,n-2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int a,b=0,c,d,i,m,l=0,n;\n scanf(\"%d\",&n);\n \n for(i=2;i<=n-1;i++){\n m=n;\n do{ \n a=m%i;\n c=m/i;\n \n b=b+a;\n \n m=c;\n \n }while(m!=0);\n }\n\n printf(\"%d/%d\\n\",b,n-2);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nif(x>y)\nm=y;\nelse\nm=x;\nfor(i=1;i<=m;i++)\n{ if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\n else\n {x=x; y=y;}}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c=0,i,j,k=0;\n scanf(\"%d\",&a);\n j=a-2;\n for(i=2;i<a;i++){\n b=a;\n while(b>=1){\n c=(b%i);\n while(c>0){\n k=k+(c%10);\n c=c/10;\n }\n b=b/i;\n }\n }\n printf(\"%d/%d\",k,j);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,sum=0,i,rem=0,div,real,k;\n scanf(\"%d\",&num);\n real=num;\n i=num-1;\n while(1)\n {\n if(i<2) break;\n while(1)\n {\n div=num/i;\n rem=num%i;\n sum=sum+rem;\n //printf(\"%d \",rem);\n if(div==0) break;\n num=div;\n }\n // printf(\"\\n\");\n num=real;\n i--;\n }\n for(k=2;k<=sum;k++)\n {\n if(sum%k==0 && (num-2) %k==0)\n {\n sum=sum/k;\n num=(num-2)/k;\n printf(\"%d/%d\",sum,num);\n return 0;\n }\n }\n printf(\"%d/%d\",sum,num-2);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint GCD ( int , int );\nint SumDigits ( int );\nint ConvertToBase ( int , int );\n\nint main( void )\n{\n\n int A[1000];\n int n,i,total=0,G;\n\n scanf(\"%d\",&n);\n\n for ( i=2 ; i<n ; ++i ){\n A[i] = ConvertToBase ( n , i );\n }\n\n for ( i=2 ; i<n ; ++i ){\n A[i] = SumDigits( A[i] );\n }\n\n for ( i=2 ; i<n ; ++i ){\n total += A[i];\n }\n\n G = GCD ( total , (n-2) );\n\n printf (\"%d/%d\" , total/G , (n-2)/G );\n\n return 0;\n}\n\nint GCD ( int a , int b )\n{\n\n int temp;\n\n while ( b != 0 ){\n temp = b;\n b = a%b;\n a = temp ;\n }\n\n return a ;\n\n}\n\nint SumDigits ( int num )\n{\n int sum=0;\n\n while ( num > 0 ){\n sum += num % 10 ;\n num = num / 10 ;\n }\n\n return sum ;\n}\n\nint ConvertToBase ( int n , int b )\n{\n if ( n < b ){\n return n ;\n }\n else{\n return n%b + 10 * ConvertToBase( (n/b) , b ) ;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint A,i,b,c;\nscanf(\"%d\",&A);\nint num,sum=0;\nfor(i=2;i<A;i++)\n{\nnum=A;\nwhile(num!=0)\n{\nb=num%i;\nsum+=b;\nnum/=i;\n}\n}\n\nif(sum%(A-2)!=0 )\n{\nprintf(\"%d/%d\",sum,(A-2));\n}\nelse\n{\nb=sum;\nc=A-2;\nwhile(c!=0)\n{\ni=b%c;\nb=c;\nc=i;\n}\nprintf(\"%d/%d\",sum/b,(A-2)/b);\n}\nreturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\n#define A 10\n#define B 11\n#define C 12\n#define D 13\n#define E 14\n#define F 15\nint sum=0;\nint binary (int n,int m)\n{\n int c,count=0,n1,i=0,bit[1100];\n n1=n;\n while(n!=0)\n {\n c=n%m;\n n=n/m;\n count++;\n }\n n=n1;\n c=0;\n while(n>0)\n {\n c=n%m;\n if(c==10)\n c=A;\n else if(c==11)\n c=B;\n else if(c==12)\n c=C;\n else if(c==13)\n c=D;\n else if(c==14)\n c=E;\n else if(c==15)\n c=F;\n n=n/m;\n bit[i]=c;\n i++;\n }\n for(i=count-1;i>=0;i--)\n {\n //printf(\"%d\",bit[i]);\n sum=sum+bit[i];\n }\n // printf(\"\\n\");\n}\nint gcd(int m,int n)\n{\n if(m==n)\n return 1;\n int temp;\n temp=n;\n n=m%n;\n m=temp;\n if(n!=0)\n gcd(m,n);\n\n}\nmain()\n{\n int a,i,g;\n scanf(\"%d\",&a);\n for(i=2;i<a;i++)\n {\n binary(a,i);\n }\n //g=gcd(sum,a-2);\n printf(\"%d/%d\",(sum/gcd(sum,a-2)),(a-2)/gcd(sum,a-2));\n}\n"}, {"source_code": "#include<stdio.h>\nlong int nmb(int num,int base);\nint main(){\n long int i,j,n,sum=0,c=0;\n char x='/';\n scanf(\"%ld\",&n);\n for(i=2;i<=n-1;i++){\n sum+=nmb(n,i);\n c++;\n }\n printf(\"%ld%c%ld\",sum,x,c);\n return 0;\n}\nlong int nmb(int num,int base){\n long int s=0,r;\n s+=num%base; num/=base;\n while(num){\n s+=num%base;\n num/=base;\n }\n return s;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i,m,r,y,x=0,p[1000000]={0},b,a,q;\nscanf(\"%d\",&b);\ny=b-2;\nr=b;\nfor (q=1,i=2;q<r-1,i<r;i++,q++)\n { while(b>0)\n { a=b%i;\n b=b/i;\n p[q]+=a;}\n b=r;}\nfor(q=1;q<r-1;q++)\n x+=p[q];\nif(x>y)\nm=y;\nelse\nm=x;\nfor(i=1;i<=m;i++)\n{ if(x%i==0&&y%i==0)\n {x=x/i; y=y/i;}\n else\n {x=x; y=y;}}\nprintf(\"%d/%d\",x,y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,i,sum=0,ans;\n scanf(\"%d\",&n);\n for(i=2;i<=n-1;i++){\n m=n;\n while(m>0){\n sum=sum+m%i;\n m=m/i;\n }\n }\n printf(\"%d/%d\",sum,n-2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint cmmdv(int a, int b)\n{\n if(a == b) return a;\n else if (a > b) return cmmdv(a - b,b); else return cmmdv( b - a,a);\n}\nint n, s, b, z, numitor, numarator, dc;\nint main()\n{\n scanf(\"%d\", &n);\n numitor = n - 2;\n for(b = 2; b < n; b++)\n {\n z = n;\n while (z > 0){\n s = s + z % b;\n z = z / b;\n }\n }\n numarator = s;\n dc = cmmdv(numitor, numarator);\n printf(\"%d/%d \", numarator / dc, numitor /dc);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,s=0,a,h[500],c,b,m=-1,A,k;\n scanf(\"%d\",&i);\n k=i-2;\n for(c=2;c<i;c++)\n {\n A=i;\n for(b=1;i>0;b++)\n {\n a=i%c;\n m=m+1;\n h[m]=a;\n i=(i-a)/c;\n }\n for(b=m;b>=0;b--)\n {\n s=s+h[b];\n }\n m=-1;i=A;\n }\n printf(\"%d/%d\",s,k);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long a , b , counter = 0 , sum = 0 , i , counter1,sum1;\n scanf(\"%I64d\",&a);\n for(i = 2;i < a;i++)\n {\n b = a;\n while(b > 0)\n {\n sum += b%i;\n b /= i;\n }\n counter++;\n }\n counter1 = counter;\n sum1 = sum;\n while(sum1 != counter1 && sum1 != 1 && counter1 != 1)\n {\n if(counter1 > sum1 )\n counter1 -= sum1;\n else if(sum1 > counter1)\n sum1 -= counter1;\n }\n if(sum == sum1)\n {\n sum1 = 1;\n }\n sum /= sum1;\n counter /= sum1;\n printf(\"%I64d/%I64d\",sum,counter);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,sum=0,n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tfor(i=2;i<n;i++)\n\t{\n int x=n;\t\n\t\twhile(x>0)\n\t\t\n\t\t{\n\t\t\t\n\t\t\tsum+=x%i;\n\t\t\tx=x/i;\n\t\t\tif(x<i)\n\t\t\t{\n\t\t\t\tsum+=x;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n\tint y=n-2;\n\tfor(i=2;i<y;i++)\n\t{\n\t\t\n\t\n\tif(sum%i==0&&y%i==0)\n\t{\n\t\t\n\t\tsum=sum/i;\n\t\ty=(y)/i;\n\t\tbreak;\n\t}}\n\tprintf(\"%d/%d\",sum,y);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint dsum(int n, int base) {\n\treturn n < base ? n : dsum(n / base, base) + n % base;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a;\n\tint p, q, b, g;\n\t\n\tscanf(\"%d\", &a);\n\tq = a - 2;\n\tp = 0;\n\tfor (b = 2; b < a; b++)\n\t\tp += dsum(a, b);\n\tprintf(\"%d/%d\\n\", p, q);\n\tg = gcd(p, q);\n\tp /= g;\n\tq /= g;\n\tprintf(\"%d/%d\\n\", p, q);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main (){\n int A,z,i,j;\n long int reminder=0,count=0;\n scanf(\"%d\",&A);\n z=A;\n for(i=2;i<A;i++){\n for(j=0; ;j++){\n reminder=A%i+reminder;\n A=A/i;\n if(A==0) break;\n }\n A=z;\n count++;\n\n }\n for(i=2; ;i++){\n\n if(reminder%i==0&&count%i==0){\n reminder=reminder/i;\n count=count/i;\n i=1;\n }\n else if(reminder%i!=0&&count%i!=0) break;\n }\n printf(\"%d/%d\",reminder,count);\n\n\n\nreturn 0;\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint dsum(int n, int base) {\n\treturn n < base ? n : dsum(n / base, base) + n % base;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a;\n\tint p, q, b, g;\n\t\n\tscanf(\"%d\", &a);\n\tq = a - 2;\n\tp = 0;\n\tfor (b = 2; b < a; b++)\n\t\tp += dsum(a, b);\n\tprintf(\"%d/%d\\n\", p, q);\n\tg = gcd(p, q);\n\tp /= g;\n\tq /= g;\n\tprintf(\"%d/%d\\n\", p, q);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int a,b=0,c,d,i,m,l=0,n;\n scanf(\"%d\",&n);\n \n for(i=2;i<=n-1;i++){\n m=n;\n do{ \n a=m%i;\n c=m/i;\n \n b=b+a;\n \n m=c;\n \n }while(m!=0);\n }\n\n printf(\"%d/%d\\n\",b,n-2);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long A,i,z,sum=0,den=0;\n\tscanf(\"%lld\",&A);\n\tz=A;\n\tfor(i=2;i<A;i++)\n\t{\n\t\tden++;\n\t\tlong long t=z;\n\t\twhile(t!=0)\n\t\t{\n\t\t\tsum+=t%i;\n\t\t\tt/=i;\n\t\t}\n\t}\n\tfor(i=2;i<A;i++)\n\t{\n\t\tif(sum%i==0 && den%i==0)\n\t\t{\n\t\t\tsum/=i;\n\t\t\tden/=i;\n\t\t}\n\t}\n\tprintf(\"%lld/%lld\\n\",sum,den);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(int a, int b){\n int ans = 0;\n while (a){\n ans += a % b;\n a /= b;\n }\n return ans;\n}\n\nint main(void)\n{\n int i, a, b, sum = 0;\n\n scanf(\"%d\", &a);\n for (i = 2; i < a; i++){\n sum += num(a, i);\n }\n b = a - 2;\n for (i = 2; i < ceil(sqrt(a - 2)); i++){\n if ((b) % i == 0 && sum % i == 0){\n sum /= i;\n b /= i;\n\n }\n }\n\n printf(\"%d/%d\", sum, b);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tint a[1001];\n\tfor(i=2;i<n;i++)\n\t{\n\t\tj=n;\n\t\twhile(j>i)\n\t\t{\n\t\t\ta[i]+=j%i;\n\t\t\tj=j/i;\n\t\t}\n\t}\n\tfor(i=2;i<n;i++)\n\t{\n\t\tsum+=a[i];\n\t}\n\tprintf(\"%d/%d\",sum+(n-2),(n-2));\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i<a;i++)\n {\n n=a;\n do\n {\n sum=sum+n%i;\n n=n/i;\n }while(n!=0);\n }\n printf(\"%d/%d\\n\",sum,a-2);\n sum=0;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint sumOfDigitInBase(int number, int base)\n{\n int temp = number;\n int digitSum = 0;\n \n while (temp > 0)\n {\n digitSum += temp % base;\n temp = temp / base;\n }\n \n return digitSum;\n}\n\nint n;\n\nint main(int argc, const char * argv[]) {\n scanf(\"%d\", &n);\n \n int i = 0;\n int sum = 0;\n \n for (i = 2; i <= n-1; i++)\n {\n sum += sumOfDigitInBase(n, i);\n }\n \n int numerator = sum;\n int denominator = n - 2;\n \n for (i = 2; i <= numerator; i++)\n if ((numerator % i == 0) && (denominator % i == 0))\n {\n numerator = numerator / i;\n denominator = denominator / i;\n }\n \n printf(\"%d/%d\", numerator, denominator);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint fun(int d,int n)\n{\n int rem;\n int sum=0;\n while(n)\n {\n sum+=n%d;\n n/=d;\n }\n return sum;\n\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n //printf(\"%d\\n\",n);\n int i;\n int sum=0;\n for(i=2;i<n;i++)\n {\n\n sum+=fun(i,n);\n\n\n }\n printf(\"%d/%d\",sum,n-2);\n return 0;\n}\n"}, {"source_code": "# include <stdio.h>\n# include <conio.h>\n\nint main()\n{\n int A,i,count,c,d,X,Y;\n scanf(\"%d\", &A);\n \n count = 0;\n for(i = 2; i < A; i++){\n c = A;\n while(c != 0){\n d = c;\n c = c/i;\n count = count + (d%i);\n }\n }\n \n X = count;\n Y = (A-2);\n printf(\"%d/%d\", X,Y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n,i,j,k;\n long int rem=0;\n scanf(\"%d\",&n);\n rem=0;\n for(i=2;i<=n-1;i++){\n j=n;\n while(j>0){\n rem=rem+j%i;\n j=j/i;\n }\n }\n\n printf(\"%ld/%d\\n\",rem,n-2);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint GCD ( int , int );\nint SumDigits ( int );\nint ConvertToBase ( int , int );\n\nint main( void )\n{\n\n int A[1000];\n int n,i,total=0,G;\n\n scanf(\"%d\",&n);\n\n for ( i=2 ; i<n ; ++i ){\n A[i] = ConvertToBase ( n , i );\n }\n\n for ( i=2 ; i<n ; ++i ){\n A[i] = SumDigits( A[i] );\n }\n\n for ( i=2 ; i<n ; ++i ){\n total += A[i];\n }\n\n G = GCD ( total , (n-2) );\n\n printf (\"%d/%d\" , total/G , (n-2)/G );\n\n return 0;\n}\n\nint GCD ( int a , int b )\n{\n\n int temp;\n\n while ( b != 0 ){\n temp = b;\n b = a%b;\n a = temp ;\n }\n\n return a ;\n\n}\n\nint SumDigits ( int num )\n{\n int sum=0;\n\n while ( num > 0 ){\n sum += num % 10 ;\n num = num / 10 ;\n }\n\n return sum ;\n}\n\nint ConvertToBase ( int n , int b )\n{\n if ( n < b ){\n return n ;\n }\n else{\n return n%b + 10 * ConvertToBase( (n/b) , b ) ;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, t, i, sum = 0;\n scanf(\"%d\", &n);\n for(i = 2; i < n; i++)\n {\n t = n;\n while(t != 0)\n {\n sum += t % i;\n t = t / i;\n }\n }\n printf(\"%d/%d\", sum, n-2);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, t, i, sum = 0;\n scanf(\"%d\", &n);\n for(i = 2; i < n; i++)\n {\n t = n;\n while(t != 0)\n {\n sum += t % i;\n t = t / i;\n }\n }\n printf(\"%d/%d\", sum, n-2);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n long n,i,m,r,j; long sum=0;\n while (scanf(\"%ld\",&n)!=EOF){sum=0;\n for (i=2;i<n;i++)\n {\n m=0;j=n;\n while (j)\n {\n r=j%i;\n j=j/i;\n sum+=r;\n }\n }\n printf(\"%ld/%ld\\n\",sum,n-2);\n }\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,x;\n scanf(\"%d\",&n);\n int S[n-2];\n for(i=0;i<n;i++)\n { S[i]=0; }\n int y,k;\n y=n;\n k=n-2;\n for(i=2;i<n;i++)\n {\n while(y!=0)\n {\n x=y%i;\n S[i-2]=S[i-2]+x;\n y=y/i; }\n y=n;\n\n }\n int z=0;\n for(i=0;i<k;i++)\n {\n z=z+S[i]; }\n printf(\"%d/%d\",z,k);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n/*\nint digit(int a)\n{\n int sum=0;\n while(a>0){\n a/=10;\n sum++;\n }\n return sum;\n}\nint digitsum(int a)\n{\n int r,sum=0;\n while(a>0){\n r=a%10;\n a/=10;\n sum+=r;\n }\n return sum;\n}\nint power(int a,int b)\n{\n int i,sum=1;\n for(i=1;i<=b;i++){\n sum*=a;\n }\n return sum;\n}\nint type(int num,int base)\n{\n int r,sum=0,i=0;\n while(num>0){\n r=num%base;\n\n sum+=r*power(10,i);\n num/=base;\n i++;\n }\n return digitsum(sum);\n}\n*/\nint summ(int num,int base)\n{\n int sum=0,r;\n while(num>0){\n r=num%base;\n sum+=r;\n num/=base;\n }\n return sum;\n}\n\n/*\nint convert(int num,int base)\n{\n int num1;\n num1=type(num,base);\n int r,sum=0;\n while(num1>0){\n r=num1%10;\n sum+=r*power(base,digit(num1)-1);\n num/=10;\n }\n return digitsum(sum);\n}\n*/\nint main()\n{\n int A,i,sum=0,x,y;\n scanf(\"%d\",&A);\n for(i=2;i<=A-1;i++){\n sum+=summ(A,i);\n }\n\n for(i=2;i<=A-2;i++){\n if(sum%i==0 &&(A-2)%i==0){\n x=sum/i;\n y=(A-2)/i;\n }\n }\n printf(\"%d/%d\",x,y);\n\n return 0;\n}\n/*\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[301];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n while(c<n){\n for(i=0;i<n;i++){\n if(a[i]>0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n if(i<n-1){\n printf(\"R\");\n }\n\n }\n if(c<n){\n printf(\"L\");\n for(i=n-2;i>=0;i--){\n\n if(i>0 && i!=n-2){\n printf(\"L\");\n }\n\n if(a[i]>0){\n printf(\"P\");\n a[i]--;\n }\n if(a[i]==0){\n a[i]=-1;\n c++;\n }\n\n }\n }\n\n }\n int *p,q;\n p=&q;\n q=10;\n\n printf(\"%p\\n\",p);\n printf(\"%d\\n\",*p);\n printf(\"%p\\n\",&q);\n p=p++;\n printf(\"%p\\n\",p);\n p=(p++);\n printf(\"%d\\n\",*p);\n char a[101];\n gets(a);\n printf(\"%s\",a);\n int a[10],*p,i;\n //int i;\n for(i=0;i<5;i++){\n scanf(\"%d\",&a[i]);\n }\n //int *p;\n p= a;\n printf(\"%d %d %d\\n\",*p,*(p+1),*(p+6));\n char str[101],*p;\n gets(str);\n p= str;\n int i;\n for(i=0;p[i];i++){\n printf(\"%c\",p[i]);\n }\n char str[]=\"acdaaaaaaaaaa\";\n // *(str+3)='c';\n printf(\"%c\",*str+6);\n int a=6,i;\n for(i=1;i<3;i++) printf(\"%d\\n\",++a);\n for(i=1;i<3;i++) printf(\"%d\\n\",a++);\n\n char str[101],*p;\n gets(str);\n p= str;\n\n while(*p){\n *p++=*p-32;\n }\n\n printf(\"%s\",str);\n\n char str1[101],str2[101],*p1,*p2;\n gets(str1);\n p1= str1+strlen(str1)-1;\n p2= str2;\n while(p1>=str1){\n *p2++=*p1--;\n }\n *p2='\\0';\n printf(\"%s %s\",str1,str2);\n\n char *p;\n gets(*p);\n printf(\"%c\\n\",p[2]);\n\n printf(\"%c\",*(p+2));\n\n\n\n\n return 0;\n}\n\nint main()\n{\n\n char str[101],*p;\n gets(str);\n p= str;\n while(*p!=' '){\n printf(\"%c\",*p);\n *p++;\n }\n return 0;\n\n}\n*/\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n int A,i,s=0,c=0,t;\n scanf(\"%d\",&A);\n for(i=2;i<A;i++){\n s=s+ convert(A,i);\n }\n\n printf(\"%d/%d\",s,A-2);\n\n\n\n\n }\n int convert(int x,int i){\n int rem=x%i;\n if(x==0)\n return 0;\n return(rem+convert(x/i,i));\n\n\n }"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint pgcd(int x,int y)\n {\n if (x==y) return x;\n if (x==0) return y;\n if (y==0) return x;\n if (x<y) return pgcd(x,y%x);\n return pgcd(x%y,y);\n }\n\nmain()\n {\n int a,i,s,x,y;\n scanf(\"%d\",&a);\n s = 2;\n for (i=2;i<a-1;i++)\n {\n x = 1;\n while (x<a) x = x * i;\n x = x / i;\n y = a;\n while (y!=0)\n {\n s = s + (y/x);\n y = y % x;\n x = x / i;\n }\n }\n y = pgcd(s,a-2);\n printf(\"%d/%d\",s/y,(a-2)/y);\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,sum=0,i,mod,a,nu,de;\n\n scanf(\"%d\",&n);\n\n for(i=2;i<=(n-1);i++)\n {\n a=n;\n while(a!=0)\n {\n mod=a%i;\n a=(int)(a/i);\n sum=sum+mod;\n }\n }\n nu=sum;\n de=n-2;\n\n for(i=(n-2);i>=2;i--)\n {\n if(sum%i==0 && (n-1)%i==0)\n {\n nu=sum/i;\n de=(n-1)/i;\n }\n }\n\n printf(\"%d/%d\",nu,de);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 1000\n\nmain()\n{\n int A,i,c,d,e;\n long int j=0;\n scanf(\"%d\",&A);\n c=A-1;d=A-2;e=A;\n for(i=2;i<=c;i++)\n {\n A=e;\n while(A!=0)\n {\n j+=(A%i);\n A/=i;\n }\n }\n printf(\"%ld/%d\",j,d);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int A, X = 0;\n scanf(\"%i\", &A);\n int N = A;\n for(int i=2;i<A;i++){\n while(N != 0){\n X = X + (N % i);\n N = N / i;\n }\n N = A;\n }\n int Y = A - 2;\n for(int i=0;i<100;i++){\n for(int j=2;j<10;j++){\n if((X % j == 0) && (Y % j ==0)){\n X /= j;\n Y /= j;\n }\n }\n }\n\n printf(\"%i/%i\", X,Y);\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,x;\n scanf(\"%d\",&n);\n int S[n-2];\n for(i=0;i<n;i++)\n { S[i]=0; }\n int y,k;\n y=n;\n k=n-2;\n for(i=2;i<n;i++)\n {\n while(y!=0)\n {\n x=y%i;\n S[i-2]=S[i-2]+x;\n y=y/i; }\n y=n;\n\n }\n int z=0;\n for(i=0;i<k;i++)\n {\n z=z+S[i]; }\n printf(\"%d/%d\",z,k);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint dsum(int n, int base) {\n\treturn n < base ? n : dsum(n / base, base) + n % base;\n}\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint a;\n\tint p, q, b, g;\n\t\n\tscanf(\"%d\", &a);\n\tq = a - 2;\n\tp = 0;\n\tfor (b = 2; b < a; b++)\n\t\tp += dsum(a, b);\n\tprintf(\"%d/%d\\n\", p, q);\n\tg = gcd(p, q);\n\tp /= g;\n\tq /= g;\n\tprintf(\"%d/%d\\n\", p, q);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n , s = 0 , z , b , numitor, numarator , dc;\nint cmmnc(int a , int b)\n{\n if(a == b) return a;\n else \n if(a > b) return cmmnc(a - b , b);\n else return cmmnc(b - a, a);\n}\nint main()\n{\n scanf(\"%d\" , &n);\n numitor = n - 2;\n for(b = 2;b < n;b++)\n {\n z = n;\n while(z > 0)\n {\n s = s + z % b;\n z = z / b;\n }\n }\n numarator = s;\n dc = cmmnc(numarator,numitor);\n printf(\"%d / %d\\n\" , numarator / dc, numitor / dc);\n\n \n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,r=0,a=1,f,b;\n scanf(\"%d\", &n);\n b = n;\n for(i=2;i<n;i++)\n {\n while(a != 0)\n {\n a = n / i;\n f = n % i;\n n = a;\n r = r + f;\n }\n n = b;\n a = 1;\n }\n printf(\"%d/%d\",r,n-2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n \nint main() {\n\tint a,i,sum=0;\n\tscanf(\"%d\",&a);\n\tfor(i=2;i<a;i++)\n\t{\n\t\tint n=a;\n\t\twhile(n)\n\t\t{\n\t\t\tsum+=(n%i);\n\t\t\tn=n/i;\n\t\t}\n\t}\n\tint b=a-2;\n\tfor(i=2;i<=b;i++)\n\t{\n\t\tif(sum%i==0&&b%i==0)\n\t\t{\n\t\t\tsum=sum/i;\n\t\t\tb=b/i;\n\t\t}\n\t}\t\n\tprintf(\"%d/%d\",sum,b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a,sum=0;\n while(scanf(\"%d\",&a)==1)\n {\n for(i=2;i<a;i++)\n {\n n=a;\n do\n {\n sum=sum+n%i;\n n=n/i;\n }while(n!=0);\n }\n printf(\"%d/%d\\n\",sum,a-2);\n sum=0;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,r,t,s,x,y;\n while(scanf(\"%d\",&a)==1){\n x=a;\n s=0;\n for(i=2;i<=a-1;i++){\n do{\n t=a/i;\n r=a%i;\n s=s+r;\n a=t;\n }\n while(t!=0);\n a=x;\n }\n printf(\"%d/%d\\n\",s,(a-2));\n }\n return 0;\n}"}], "src_uid": "1366732dddecba26db232d6ca8f35fdc"} {"nl": {"description": "Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.The choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones\u00a0\u2014 but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!A xor-sum of a sequence of integers a1,\u2009a2,\u2009...,\u2009am is defined as the bitwise XOR of all its elements: , here denotes the bitwise XOR operation; more about bitwise XOR can be found here.Ded Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.", "input_spec": "The sole string contains two integers n and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u20091018).", "output_spec": "Output one number\u00a0\u2014 the largest possible xor-sum.", "sample_inputs": ["4 3", "6 6"], "sample_outputs": ["7", "7"], "notes": "NoteIn the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.In the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <limits.h>\nint main()\n{\n\tunsigned long long int n,k,p,ans=0;\n\tint flag,i,j;\n//\tprintf(\"%llu\\n\",ULLONG_MAX);\n\tunsigned long long int a[100];\n\tfor(i=0;i<64;++i)\n\t{\n\t\ta[i]=1ULL<<(i);\n\t\ta[i]=a[i]-1;\n//\t\tprintf(\"%d :: %llu\\n\",i,a[i]);\n\t}\n\tscanf(\"%llu%llu\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%llu\\n\",n);\n\t}\n\telse if(k>1)\n\t{\n\t\tflag=0;\n\t\tfor(i=0;a[i]<n;++i)\n\t\t{\n\t\t\tif(a[i]==n)\n\t\t\t{\n\t\t\t\tflag=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(flag==1)\n\t\t{\n\t\t\tprintf(\"%llu\\n\",n);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%llu\\n\",a[i]);\n\t\t}\n//\t\tfor(i=0;a[i]<\n//\t\tfor(i=0;i<25;++i)\n//\t\t{\n//\t\t\tif((n>>1)&1==1)\n//\t\t\t{\n//\t\t\t\tflag=i;\n//\t\t\t\tprintf(\"%d\\n\",flag);\n//\t\t\t}\n//\t\t\tprintf(\"%llu\\n\",n);\n//\t\t\tn=n>>1;\n//\t\t}\n//\t\tprintf(\"%d\\n\",flag);\n//\t\tfor(i=0;i<=flag;++i)\n//\t\t{\n//\t\t\tans=ans+a[i];\n//\t\t}\n//\t\tans=(1ULL<<(flag+1))-1;\n//\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n long long n,k,b=0,i,x=0;\n scanf(\"%I64d %I64d\",&n,&k);\n if (k==1){\n printf(\"%I64d\",n);\n return 0;\n }\n while (n>0){\n n=n/2;\n b++;\n }\n for (i=0;i<b;i++){\n x+=pow(2,i);\n }\n printf(\"%I64d\",x);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k,i,max;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld\",&k);\n\tint temp1,temp2;\n\tif(k==1)\n\t{\n\t\ttemp1=n/1000000000;\n\t\ttemp2=n%1000000000;\n\t\tif(temp1)\n\t\t{\n\t\t\tprintf(\"%d\",temp1);\n\t\t\tprintf(\"%09d\\n\",temp2);\n\t\t}\n\t\telse\n\t\t\tprintf(\"%d\\n\",temp2);\n\t}\n\telse\n\t{\n\t\tmax=(long long int)1;\n\t\ti=(long long int)1;\n\t\twhile(i<=n)\n\t\t{\n\t\t\ti=i<<1;\n\t\t\tmax+=i;\n\t\t}\n\t\tmax-=i;\n\t\t{\t\n\t\t\ttemp1=max/1000000000;\n\t\t\ttemp2=max%1000000000;\n\t\t\tif(temp1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",temp1);\n\t\t\t\tprintf(\"%09d\\n\",temp2);\n\t\t\t}\n\t\t\telse\n\t\t\t\tprintf(\"%d\\n\",temp2);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(void)\n{\n int64_t n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n \n if (1 == k) \n\t{\n printf(\"%I64d\\n\", n);\n \n return 0;\n }\n \n int64_t bit = 0;\n for (; n >> bit; bit++);\n \n printf(\"%I64d\\n\", (1LL << bit) - 1);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,k,total=1,flag=0;\nscanf(\"%lld %lld\",&n,&k);\nif(k==1){\nprintf(\"%lld\\n\",n);\n}\nelse {\nwhile(flag==0){\ntotal=total*2;\nif(n<=(total-1)){\nflag=1;\n}}\nprintf(\"%lld\\n\",total-1);}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tlong long int x=0;\n\tint j=0;\n\tif(k==1)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\twhile(n>0)\n\t{\n\t\tx += (1ll<<j);\n\t\tj++;\n\t\t//printf(\"%lld \",x);\n\t\tn = n>>1;\n\t}\n\tprintf(\"%lld\\n\",x);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,i,j,count=0,x=0;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\",n);\n\t\treturn 0;\n\t}\n\twhile(n!=0)\n\t{\n\t\tn = n>>1;\n\t\tcount++;\n\t}\n\tfor(i=0;i<count;i++)\n\t{\n\t\tx = x+pow(2,i);\n\t}\n\tprintf(\"%lld\",x);\n\treturn 0;\n}\n"}, {"source_code": "# include<stdio.h>\nint main(){\nlong long int n,k,i,x=1;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nif(k!=1){\nfor(i=2;i<=n;i++){\n if((x^i)>x)x=x^i;\n i=x;\n}}\nelse x=n;\nprintf(\"%I64d\",x);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n long long int ans=1;\n while(ans<=n)\n ans*=2;\n if(k==1)\n printf(\"%lld\\n\",n);\n else\n printf(\"%lld\\n\",ans-1);\n\t// your code goes here\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int n,r,a,b,c;\nlong long int ans=0;\n\nint main()\n{\n ans=0;\n scanf(\"%lld %lld\",&n,&r);\n b=n;\n while(n)\n {\n n/=2;\n a++;\n }\n ans=pow(2,a)-1;\n if(r==1)\n {\n printf(\"%lld\\n\",b);\n }\n else\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,k,total=1,flag=0;\nscanf(\"%lld %lld\",&n,&k);\nif(k==1){\nprintf(\"%lld\\n\",n);\n}\nelse {\nwhile(flag==0){\ntotal=total*2;\nif(n<=(total-1)){\nflag=1;\n}}\nprintf(\"%lld\\n\",total-1);}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,k,t=1;\n scanf(\"%lld%lld\",&n,&k);\n if(k==1)\n {\n printf(\"%lld\\n\",n);\n return 0;\n }\n while(t<=n)\n t*=2;\n printf(\"%lld\\n\",t-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%lld %lld\", &n,&k);\n if(k==1)\n printf(\"%lld\",n);\n else\n { long long i = 1;\n while(i<n)\n i=i*2+1;\n printf(\"%lld\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tlong long n,k,max=1;\n\t\n\tscanf(\"%lld%lld\",&n,&k);\n\t\n\tif (k==1)\n\t\tprintf(\"%lld\\n\",n);\n\t\t\n\telse\n\t{\n\t\twhile (n)\n\t\t{\n\t\t\tn>>=1;\n\t\t\tmax<<=1;\n\t\t}\n\t\t\n\t\tprintf(\"%lld\\n\",max-1);\n\t}\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n if(k==1)printf(\"%lld\\n\",n);\n else{\n long long int p=1;\n while(n>0){\n p=p*2;\n k--;\n n/=2;\n }\n printf(\"%lld\\n\",p-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t__int64 n,k,i,j;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tif(k==1)\n\tprintf(\"%I64d\\n\",n);\n\telse\n\t{\n\t\tfor(i=1,j=0;n>=i;j++)\n\t\ti=i*2;\n\t\tprintf(\"%I64d\\n\",i-1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,k;\n int cnt=0;\n scanf(\"%lld%lld\",&n,&k);\n //if(n==1e18)\n //printf(\"1152921504606846975\");\n //else\n if(k==1)\n printf(\"%lld\",n);\n else\n \n {\n while(n)\n {\n n/=2;\n cnt++;\n }\n ll tmp[cnt];\n for(int i=0;i<=cnt;i++)\n {\n ll p=1;\n for(int j=0;j<i;j++)\n p*=2;\n tmp[i]=p;\n }\n /*printf(\"%d\\nn\",cnt);\n for(int i=0;i<=cnt;i++)\n // printf(\"%d \",4^8);\n //printf(\"%d \",2^8^1);\n printf(\"%lld\\n\",tmp[i]);*/\n ll sum=tmp[cnt];\n sum--;\n /*for(int i=cnt-1;i>=0&&k>0;i--)\n {\n // printf(\"y\");\n sum+=tmp[i];\n k--;\n }*/\n printf(\"%lld\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long n,m, k,x,a;\nint main()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tm = n;\n\tif (k == 1) printf(\"%lld\", n);\n\telse {\n\t\ta = 1;\n\t\twhile (m > 0) m >>= 1,x++;\n\t\twhile (x > 0) {\n\t\t\ta <<= 1;\n\t\t\tx--;\n\t\t}\n\t\tprintf(\"%lld\", a - 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\n\nint main(){\n\nlong long n,k;\nint i = 0;\n\nscanf(\"%lld\",&n);\n\nk = n;\nwhile (k>0){\n\tk >>= 1;\n\ti ++;\n\t}\n\nscanf(\"%lld\",&k);\n\nif (k == 1LL)\n\tprintf(\"%lld\\n\",n);\nelse{\n\tk = 1LL;\n\twhile (i>0){\n\t\tk <<= 1;\n\t\ti--;\n\t}\n\tprintf(\"%lld\\n\",k-1LL);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\n\nint main() {\n ll k, n;\n while(scanf(\"%I64d%I64d\", &n, &k) != EOF) {\n int countn = 0;\n ll res = 0, temp = 1, nh = n;\n while(n != 0) {\n n /= 2;\n countn++;\n }\n for (int i = 0; i < countn; ++i) {\n res += temp;\n temp *= 2;\n }\n if (k == 1) printf(\"%I64d\\n\", nh);\n else printf(\"%I64d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "//set many funcs template\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define inf 1072114514\n#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\n\nint main(void){\n long long n,k,i,j,r=1;\n double d;\n char s[262144];\n scanf(\"%lld%lld\",&n,&k);\n while(r<=n){r*=2;}\n //l=strlen(s);\n if(k==1){printf(\"%lld\\n\",n);}\n else{printf(\"%lld\\n\",r-1);}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long i=1;\n\tlong long j=2;\n\tlong long ans=1;\n\t//printf(\"%lld\\n\",j );\n\tif (k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n );\n\t}\n\telse{\n\n\twhile(j<=n )\n\t{\n\t\tj=j*2;\n\t\t//printf(\"%lld\\n\",j );\n\t}\n\t\n\tprintf(\"%lld\\n\",(j)-1 );\n}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,k,a,ans;\n\n scanf(\"%I64d %I64d\",&n,&k);\n\n if(k==1)\n {\n printf(\"%I64d\",n);\n }\n else\n {\n while(n>=1)\n {\n n/=2;\n a++;\n }\n ans=pow(2,a)-1;\n printf(\"%I64d\",ans);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n, k, l;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tl = 0;\n\twhile (1LL << l <= n)\n\t\tl++;\n\tprintf(\"%lld\\n\", k == 1 ? n : (1LL << l) - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(){\n\tint64_t n, k, r, i;\n//\tfor(i = 0;i<100000;i++){\t\t\n\t\tscanf(\"%I64d %I64d\",&n,&k);\n\t//\tn = i;\n\t//\tk = 2;\n\t\tint64_t t = 1;\n\t\tr = n;\n\t\twhile(t <= r){\n\t\t\tr = r ^ t;\n\t\t\tt = t << 1;\n\t\t}\n\t\tif(k == 1) printf(\"%I64d\\n\",n);\n\t\telse printf(\"%I64d\\n\",n+r);\n//\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(void)\n{\n int64_t n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n \n if (1 == k) \n\t{\n printf(\"%I64d\\n\", n);\n \n return 0;\n }\n \n int bit = 0;\n for (; n >> bit; bit++);\n\n printf(\"%I64d\\n\", (1LL << bit) - 1);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n long long int c=0;\n if (k==1)\n {\n /* code */\n printf(\"%I64d\\n\",n );\n return 0;\n }\n while(pow(2,c)<=n)\n {\n c++;\n }\n long long int q=pow(2,c)-1;\n printf(\"%I64d\\n\",q);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n { long long int n,k,b,p;\n\tscanf(\"%lld%lld\",&n,&k);\n\t\tif(k==1)\n\t\tprintf(\"%lld\",n);\n\t\t\telse\n\t\t\t{p=n; \n\t\t\tb=0;\n\t\t\t\twhile(p>0)\n\t\t\t\t{ b++; \n\t\t\t\tp=p>>1; }\n\t\t\t\tp=1;\n\t\t\t while(b--)\n\t\t\t\t{ n=n|p;\n\t\t\t\t\tp=p<<1; }\n\t\t\t\tprintf(\"%lld\",n); }\n\n\nreturn 0; }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tunsigned long long n, k, b;\n scanf(\"%I64d%I64d\", &n, &k);\n char t = 0;\n b = n;\n while(b >>= 1) t++;\n b = pow(2, t+1)-1;\n if(k == 1) b = n;\n\tprintf(\"%I64d\", b); \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tlli tmp=2,i=0;\n\t\twhile(tmp<=n)\n\t\t{\n\t\t\ttmp=tmp*2;\t\n\t\t\ti++;\n\t\t}\n\t\tlli ans;\n\t\tans=tmp-1;\n\n\t\tprintf(\"%lld\\n\",ans);\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n__int64 p,k,n,s;\nint main(void)\n{\n\tscanf(\"%I64d %I64d\",&k,&n);\n\tp=1;\n\tif (k>=1) s=1; \n\twhile (p*2<=k)\n\t{\n\t\tp=2*p;\n\t\ts=s+p;\n\t}\n\tif (n==1) printf(\"%I64d\",k);\n\telse printf(\"%I64d\",s);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,a,b;\n long long int s[61];\n s[1]=1;\n for (i=2;i<61;i++)\n s[i]=s[i-1]*2+1;\n scanf(\"%I64d%I64d\",&a,&b);\n if (b==1)\n printf(\"%I64d\\n\",a);\n else\n {\n for (i=1;i<61;i++)\n {\n if (a<=s[i]) break;\n }\n printf(\"%I64d\\n\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tlong long ans = 0;\n\tlong long temp = 1;\n\tif (k == 1) ans = n;\n\telse\n\t{\t\n\t\tfor (int i = 1; i < 70; i++)\n\t\t{\n\t\t\ttemp *= 2;\n\t\t\tif (temp > n)\n\t\t\t{\n\t\t\t\tans = temp-1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int next(long long int n)\n{\n long long int p = 1;\n if (n && !(n & (n - 1)))\n return n;\n\n while (p < n)\n p <<= 1;\n\n return p;\n}\n\n\nint main()\n{\n long long int n,k,temp;\n \n\n scanf(\"%lld%lld\",&n,&k);\n temp=next(n);\n\n if(k>=2)\n {\n if(temp!=n)\n printf(\"%lld\\n\",temp-1);\n \n else\n {\n printf(\"%lld\\n\",2*temp-1);\n }\n }\n else\n {\n printf(\"%lld\\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k, tmp;\n scanf(\"%lld %lld\", &n, &k);\n int dig = 0; tmp = n;\n while(tmp > 0) {\n\ttmp >>= 1;\n\tdig++; }\n long long ans = (k == 1)?n:((long long)(1)<<(dig)) - 1;\n printf(\"%lld\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long int n,k,i=0;\n\tscanf(\"%I64d %I64d\", &n, &k);\n\tif(k==1)\n\t\tprintf(\"%I64d\",n);\n\telse\n\t{\n\t\ti=0;\n\t\twhile((long long int)pow(2,i)<=n)\n\t\t\ti++;\n\t\tprintf(\"%I64d\",(long long int)pow(2,i)-1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#define LLU unsigned long long int\n#define TWO_POWER_64_MINUS_1 18446744073709551615llu\n\nLLU noOfBinaryDigits(LLU input) {\n\tLLU ans = 0;\n\twhile(input) {\n\t\tinput >>= 1;\n\t\tans++;\n\t} \n\treturn ans;\n}\nLLU generateBinary2ToPowerNMinus1(LLU N) {\n\tLLU out = 0, ana = 1, i;\n\tfor(i=1; i<=N; i++) {\n\t\tout += ana;\n\t\tana <<= 1;\n\t}\n\treturn out;\n}\n\nint main() {\n\tLLU n, k;\n\tscanf(\"%llu%llu\", &n, &k);\n\tif(k==1) {\n\t\tprintf(\"%llu\\n\", n);\n\t}\n\telse {\n\t\tprintf(\"%llu\\n\",\n\t\t\t\tgenerateBinary2ToPowerNMinus1(noOfBinaryDigits(n)));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int max(long long int a,long long int b){\n\n\tif(a>=b)\n\t\treturn a;\n\telse\n\t\treturn b;\n\n}\nlong long int xorsum(long long int n,long long int k){\n\n\tif(k==0)\n\t\treturn 0;\n\t\n\tif(n==0)\n\t\treturn 0;\n\tif(n<k)\n\t\treturn 0;\n\n\treturn max(xorsum(n-1,k),n^xorsum(n-1,k-1));\t\n}\n\n\tint main(){\n\nlong long int n,k;\n\nscanf(\"%lld %lld\",&n,&k);\n\nint i;\n\nfor(i=0;i<n;i++){\n\n\tif((long long int)(pow(2,i))>n)\n\t\tbreak;\t\n\t\n}\t\n\nif(k==1)\n\tprintf(\"%lld\\n\",n);\nelse\n\tprintf(\"%lld\\n\",(long long int)(pow(2,i))-1);\n\nreturn 0;\n}\n"}, {"source_code": "/*\nB. New Year's Eve\ntime limit per test1 second\nmemory limit per test256 megabytes\ninputstandard input\noutputstandard output\nSince Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.\n\nThe choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones \ufffd\ufffd but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!\n\nA xor-sum of a sequence of integers a1,?a2,?...,?am is defined as the bitwise XOR of all its elements: , here denotes the bitwise XOR operation; more about bitwise XOR can be found here.\n\nDed Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.\n\nInput\nThe sole string contains two integers n and k (1?\ufffd\ufffd?k?\ufffd\ufffd?n?\ufffd\ufffd?1018).\n\nOutput\nOutput one number \ufffd\ufffd the largest possible xor-sum.\n\nExamples\ninput\n4 3\noutput\n7\ninput\n6 6\noutput\n7\nNote\nIn the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.\n\nIn the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7.\n*/\n\n#include <stdint.h>\n\nint main()\n{\n uint64_t n, k;\n scanf(\"%I64u%I64u\", &n, &k);\n \n if (k == 1)\n {\n printf(\"%I64u\", n);\n return 0;\n }\n \n uint64_t max = 1;\n uint64_t left = 0;\n while (max <= n)\n {\n max = max << 1;\n ++left;\n }\n\n printf(\"%I64u\", (1LL << left) - 1);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main()\n{\n uint64_t i;\n uint64_t n;\n uint64_t answer = 0;\n uint64_t dummy;\n \n scanf(\"%llu %llu\", &n, &dummy);\n\n if(dummy == 1)\n {\n printf(\"%llu\\n\", n);\n return 0;\n }\n \n for(i = 1; i < n; i <<= 1);\n answer = i - 1;\n\n if(i <= n)\n answer |= i;\n \n printf(\"%llu\\n\", answer);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long n,K;\n\nint main()\n{\n int i;\n\n scanf(\"%I64d%I64d\",&n,&K);\n if(K == 1) printf(\"%I64d\\n\",n);\n else\n {\n for(i=0;n;n>>=1,i++);\n printf(\"%I64d\\n\",(1LL<<i)-1);\n }\n\n return 0;\n}\n"}, {"source_code": "\n\n\n\n\n\n#include<stdio.h>\n#include<math.h>\nlong long int pw(long long int i)\n{\n\tif(i==1) return 1;\n\telse return 1 + pw(i/2);\n}\nint main()\n{\n\tlong long int n,k,l,s=0,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tl = pw(n);\n\tif(k>1)\n\t{\n\t\tfor(i=0;i<l;i++)\n\t\t{\n\t\t\ts<<=1;\n\t\t\ts+=1;\n\t\t\t\n\t\t}\n\t\tprintf(\"%lld\\n\",s);\n\t}\n\tif(k==1)\n\tprintf(\"%lld\\n\",n);\n\t\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n \nint main()\n{\n long long int p,q,a,b,x,y,z,sum,k,i;\n scanf(\"%lld %lld\",&a,&b);\n z=0;\n p=a;\n while(p!=1){\n p=p/2;\n z++;\n }\n if(b==1){\n printf(\"%lld\",a);\n }else{\n y=1;\n z=z+1;\n for(i=0;i<z;i++){\n y=y*2;\n }\n y=y-1;\n printf(\"%lld\",y);\n }\n \n return 0; \n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint cmp(const void *a, const void *b)\n{\n\treturn *(int *)a - *(int *)b;\n}\n\nint max(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\n\nint main()\n{\n\tlong long int n,k,p,count=0;\n\tscanf(\"%lld%lld\",&n,&k);\n\tp=n;\n\twhile(p>0)\n\t{\n\t\tp=p/2;\n\t\tcount++;\n\t}\n\tlong long int ans = pow(2,count)-1;\n\tif(k>=2)\n\t\tprintf(\"%lld\\n\",ans);\n\telse\n\t\tprintf(\"%lld\\n\",n);\t \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long int num;\n\tlong long int n1=n;\n\tlong long int x=0;\n\twhile(n1!=1)\n\t{\n\t\tx++;\n\t\tn1=n1/2;\n\t}\n\tlong long int n3=pow(2,x);\n//\tprintf(\"n3=%d\\n\",n3);\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\\n\",2*n3-1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\ntypedef long long int ll;\nint main()\n{\n\tll n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tll ans=n;\n\tll count=1,i;\n/*\tfor(i=n-1;i>=n/2;i--)\n\t{\n\t\tif(count==k) break;\n\t\tll temp=ans^i;\n\t\tif(temp>ans)\n\t\t{\n\t\t\tans=temp;\n\t\t\tcount++;\n\t\t}\n\n//\t\tif(ans==(pow()) break;\n\t}*/\n\tfor(i=n/2;i>0;i/=2)\n\t{\t\n\t//\tif(count==k) break;\n\t\tll temp=ans^i;\n\t\tif(temp>ans)\n\t\t{\n\t\t\tans=temp;\n\t//\t\tcount++;\n\t\t}\n\t}\n\tif(k==1) printf(\"%lld\",n);\n\telse printf(\"%lld\",ans);\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long int llu;\n\nint main() {\n\n\tllu n, k, i = 1;\n\tscanf(\"%I64d%I64d\", &n, &k);\n\tllu c = 0;\n\twhile(n >= (llu)(i<<c)) c++;\n\tif(k == 1) printf(\"%I64d\\n\", n);\n\telse printf(\"%I64d\\n\", (llu)((i<<c)-1));\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long long N,K,i,j,count=0,ans=1;\n scanf(\"%lld %lld\",&N,&K);\n if(K==1)\n printf(\"%lld\",N);\n else\n {\n while( N != 0)\n {\n N >>= 1;\n count += 1;\n }\n while(count--)\n ans*=2;\n printf(\"%lld\",ans-1);\n }\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long int num;\n\tlong long int n1=n;\n\tlong long int x=0;\n\twhile(n1!=1)\n\t{\n\t\tx++;\n\t\tn1=n1/2;\n\t}\n\tlong long int n3=pow(2,x);\n//\tprintf(\"n3=%d\\n\",n3);\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\\n\",2*n3-1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,t=0,ans=1;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld\",&k);\n\tif(k==1)\n\t\tprintf(\"%lld\\n\",n);\n\telse if(k>1)\n\t{\n\t\twhile(n>0)\n\t\t{\n\t\t\tt++;\n\t\t\tn=n/2;\n\t\t}\n\t\tans=pow(2,t)-1;\n\t\tprintf(\"%lld\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\t\n\tlong long int n,k,sum,temp;\n\ttemp=1;\n\tsum=1;\n\tint count=0;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tif(k==1)\n\t\tprintf(\"%I64d\\n\",n);\n\telse\n\t{\n\t\tlong long int i;\n\t\tfor(i=n;i>0;i=i/2)\n\t\t\tcount++;\n//\t\tprintf(\"%d \",count);\n\t\tfor(i=0;i<count-1;i++)\n\t\t{\n\t\t\tsum=temp+sum*2;\n\t\t//\ttemp=0;\n\t\t}\n\t\tprintf(\"%I64d\",sum);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j;\n long long int k, n, t, r;\n\n scanf(\"%lld %lld \", &n, &k);\n\n t = n;\n\n for (i = 0; t != 0; t >>= 1, ++i) { }\n\n if (k == 1) {\n printf(\"%lld\\n\", n);\n } else {\n r = 0;\n for (j = 0; j < i; ++j) {\n t = (long long int) 1 << j;\n\n r |= t;\n }\n\n printf(\"%lld\\n\", r);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long ll;\ntypedef unsigned long long ul;\n\nint main()\n{\n ul n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n ul ans = n;\n if (k > 1) {\n ul cur = 1;\n while (cur <= ans) {\n ans |= cur;\n cur <<= 1;\n }\n }\n printf(\"%I64d\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,k,q,ans;\n int c;\n scanf(\"%lld%lld\",&n,&k);\n q=n;\n while(q!=0)\n {\n q/=2;\n c++;\n }\n if(k==1)\n printf(\"%lld\",n);\n else\n {\n ans=pow(2,c)-1;\n printf(\"%lld\",ans);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tunsigned long long int arr[63]={0};\n\n\tarr[0]=1;\n\tfor (int i = 1; i < 63; i++)\n\t\tarr[i]=arr[i-1]*2;\n\t\n\tunsigned long long int n;\n\tunsigned long long int k;\n\tscanf(\"%llu\",&n);\n\tscanf(\"%llu\",&k);\t\n\tunsigned long long int ans=0;\n\tint point = 0;\nif(k!=1)\n{\t\n\tint pp=0;\n\tfor (int i = 0; i < 63; i++)\n\t{\n\t\tif(arr[i]>n)\n\t\t\t{\n\t\t\t\tpp=i;\n\t\t\t\tbreak;\t\n\t\t\t}\n\t}\n\n\tprintf(\"%llu\\n\",arr[pp]-1);\n}\n\n\nelse\n\tprintf(\"%llu\\n\",n);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,k,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\",n);\n\t\treturn 0;\n\t}\n\tlong long temp=1;\n\tfor(i=1;temp<=n;i++)\n\t{\n\t\ttemp*=2;\n\t}\n\tprintf(\"%lld\",(long long)pow(2,i-1)-1);\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h> \nlong long n,k,ans=1; \nint main(){ \n scanf(\"%lld%lld\",&n,&k); \n if(k==1){\n\t\tprintf(\"%lld\\n\",n);\n }\n\telse{\n \twhile(n>>=1)\n\t\t\tans<<=1;\n\t printf(\"%lld\\n\",(ans<<1)-1); \n\t}\n return 0; \n}"}, {"source_code": "#include <stdio.h>\nint main(void) \n{\n long long k, n, ans = 1;\n\n scanf(\"%lld %lld\", &n, &k);\n if (k == 1)\n printf(\"%lld\", n);\n else\n {\n while (1)\n {\n if (ans > n)\n break;\n ans *= 2;\n }\n printf(\"%lld\", ans - 1);\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int len;\n char buf[100] = {0};\n long long n, k, p;\n scanf(\"%lld%lld\", &n, &k);\n if (k == 1)\n {\n printf(\"%lld\", n);\n return 0;\n }\n for (int i = 0; n != 0; i++)\n {\n buf[i] = n % 2 + '0';\n n /= 2;\n }\n len = strlen(buf);\n p = pow(2, len) - 1;\n printf(\"%lld\", p);\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k, x;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tfor (x = 0; 1LL << x <= n; x++)\n\t\t;\n\tprintf(\"%lld\\n\", k == 1 ? n : (1LL << x) - 1);\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by rainboy */\n#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k, x;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tfor (x = 0; 1LL << x <= n; x++)\n\t\t;\n\tprintf(\"%lld\\n\", k == 1 ? n : (1LL << x) - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long a,b,c,n,x,y;\n\tint i,j;\n\tscanf(\"%lld %lld\",&x,&y);\n\tif(y==1){\n\t\tprintf(\"%lld\\n\",x);\n\t\treturn 0;\n\t}\n\ti=0;\n\twhile(x>0)\n\t{\n\t\tx/=2;\n\t\ti+=1;\n\t}\n\tx=1;\n\twhile(i>1)\n\t{\n\t\tx*=2;\n\t\tx+=1;\n\t\ti-=1;\n\t}\n\tprintf(\"%lld\\n\",x);\n\tscanf(\"%d\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tlong long int pow=1,ans=0;\n\tif(k!=1){\n\t\twhile(pow<=n)\n\t\t\tpow=pow<<1;\n\t\tans=pow -1;\n\t}\n\telse\n\t\tans=n;\n\tprintf(\"%lld\\n\",ans );\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define PI 3.14159265358979\n#ifndef __int64\n #define __int64 long long\n#endif\n\nint main()\n{\n __int64 n, k, p;\n scanf(\"%I64d%I64d\", &n, &k);\n if(k == 1)\n {\n printf(\"%I64d\\n\", n);\n return 0;\n }\n else\n {\n for(p = 1; p <= n; p <<= 1);\n printf(\"%I64d\\n\", p - 1);\n }\n return 0;\n}\n"}, {"source_code": "#define __STDC_FORMAT_MACROS\n#include <inttypes.h>\n#include <stdio.h>\n\nstatic inline int find_exp2(int64_t n) {\n int64_t p2 = 2; int ret = 0;\n while(p2 <= n) { ++ret, p2 *= 2; }\n return ret;\n}\n\nint main() {\n int64_t N, K; scanf(\"%\"PRId64 \" %\"PRId64 \"\\n\", &N,&K);\n if(K == 1) { printf(\"%\"PRId64 \"\\n\", N); return 0; }\n // if more than two numbers: pick biggest and then \"invert\" zeroes\n const int exp2 = find_exp2(N); printf(\"%\"PRId64 \"\\n\", (1LL << (exp2+1)) - 1);\n return 0;\n}\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 61; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n if(k == 1) {\n printf(\"%I64d\\n\", n);\n } else {\n printf(\"%I64d\\n\", (1LL << bound) - 1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\t\t\nint main()\n{\n\tlong long int n,k;\n\tlong long int A[100];\n\tlong long int max, num, res;\n\tint i;\n\tmax = 100000;\n\tmax = max * 100000;\n\tmax = max * 100000;\n\tmax = max * 2000;\n\ti=1;\n\tA[0] = 0;\n\tA[1]=1;\n\tscanf(\"%lld%lld\", &n, &k);\n\twhile (A[i] <= n) {A[i+1] = A[i] * 2; i++;}\n\tif (k==1) res = n;\n\telse\n\t{\n\t\twhile (A[i] > n) i--;\n\t\tres = A[i] * 2 - 1;\n\t}\n\tprintf(\"%lld\\n\",res);\n\treturn 0;\t\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n if (n==1||k==1){printf(\"%I64d\\n\",n);return 0;}\n unsigned long long i=1;\n unsigned long long ans=0;\n while (i<=n)\n {\n ans^=i;\n i*=2;\n }\n printf(\"%I64u\\n\",ans);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <limits.h>\nint main()\n{\n\tunsigned long long int n,k,p,ans;\n\tint flag,i;\n\tscanf(\"%llu%llu\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%llu\\n\",n);\n\t}\n\telse if(k>1)\n\t{\n\t\tfor(i=0;i<19;++i)\n\t\t{\n\t\t\tif((n>>i)&1==1)\n\t\t\t{\n\t\t\t\tflag=i;\n\t\t\t}\n\t\t}\n\t\tans=(1<<(flag+1))-1;\n\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\nint main()\n{\n\tunsigned long long int n,k,p,ans;\n\tint flag,i;\n//\tprintf(\"%llu\\n\",ULLONG_MAX);\n\tunsigned long long int a[100];\n\tfor(i=0;i<63;++i)\n\t{\n\t\ta[i]=1<<(i+1);\n\t\ta[i]=a[i]-1;\n//\t\tprintf(\"%llu\\n\",a[i]);\n\t}\n\tscanf(\"%llu%llu\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%llu\\n\",n);\n\t}\n\telse if(k>1)\n\t{\n\t\tflag=0;\n\t\tfor(i=0;a[i]<n;++i)\n\t\t{\n\t\t\tif(a[i]==n)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tprintf(\"%llu\\n\",n);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%llu\\n\",a[i]);\n\t\t}\n//\t\tfor(i=0;a[i]<\n//\t\tfor(i=0;i<25;++i)\n//\t\t{\n//\t\t\tif((n>>i)&1==1)\n//\t\t\t{\n//\t\t\t\tflag=i;\n//\t\t\t\tprintf(\"%d\\n\",flag);\n//\t\t\t}\n//\t\t}\n//\t\tans=(1<<(flag+1))-1;\n//\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\nint main()\n{\n\tunsigned long long int n,k,p,ans=0;\n\tint flag,i,j;\n//\tprintf(\"%llu\\n\",ULLONG_MAX);\n\tunsigned long long int a[100];\n\tfor(i=0;i<63;++i)\n\t{\n\t\ta[i]=1<<(i);\n//\t\tprintf(\"%llu\\n\",a[i]);\n\t}\n\tscanf(\"%llu%llu\",&n,&k);\n\tif(k==1)\n\t{\n\t\tprintf(\"%llu\\n\",n);\n\t}\n\telse if(k>1)\n\t{\n\t\tflag=0;\n\t/*\tfor(i=0;a[i]<n;++i)\n\t\t{\n\t\t\tif(a[i]==n)\n\t\t\t{\n\t\t\t\tflag=i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(flag==1)\n\t\t{\n\t\t\tprintf(\"%llu\\n\",n);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%llu\\n\",a[i]);\n\t\t}*/\n//\t\tfor(i=0;a[i]<\n\t\tfor(i=0;i<25;++i)\n\t\t{\n\t\t\tif((n>>i)&1==1)\n\t\t\t{\n\t\t\t\tflag=i;\n\t\t//\t\tprintf(\"%d\\n\",flag);\n\t\t\t}\n\t\t}\n//\t\tprintf(\"%d\\n\",flag);\n\t\tfor(i=0;i<=flag;++i)\n\t\t{\n\t\t\tans=ans+a[i];\n\t\t}\n//\t\tans=(1<<(flag+1))-1;\n\t\tprintf(\"%llu\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n long long n,k,b=0,i,x=0;\n scanf(\"%I64d %I64d\",&n,&k);\n while (n>0){\n n=n/2;\n b++;\n }\n for (i=0;i<b;i++){\n x+=pow(2,i);\n }\n printf(\"%I64d\",x);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(void)\n{\n int64_t n, k;\n scanf(\"%I64d, %I64d\", &n, &k);\n \n if (1 == k) \n\t{\n printf(\"%I64d\\n\", n);\n \n return 0;\n }\n \n int64_t bit = 0;\n for (; n >> bit; bit++);\n \n printf(\"%I64d\\n\", (1LL << bit) - 1);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(void)\n{\n int64_t n, k;\n scanf(\"%I64d, %I64d\", &n, &k);\n \n if (1 == k) \n\t{\n printf(\"%I64d\\n\", n);\n \n return 0;\n }\n \n int bit = 0;\n for (; n >> bit; bit++);\n \n printf(\"%I64d\\n\", (1LL << bit) - 1);\n \n return 0;\n}"}, {"source_code": "# include<stdio.h>\n# include<math.h>\nint main(){\nlong long int n,k,i,x=1;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d\",&k);\nfor(i=2;i<=n;i++){\n if((x^i)>x)x=x^i;\n i=x;\n}\nprintf(\"%I64d\",x);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int n,r,a,b,c;\nlong long int ans=0;\n\nint main()\n{\n ans=0;\n scanf(\"%lld %lld\",&n,&r);\n while(n)\n {\n n/=2;\n a++;\n }\n ans=pow(2,a)-1;\n if(r==1)\n printf(\"%lld\\n\",n);\n else\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nunsigned long long ans[100];\nint main()\n{\n ans[0]=1;ans[64]=-1;\n int i;\n for (i=1;i<=63;i++)\n ans[i]=ans[i-1]*2;\n long long n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n if (k>1){\n for (i=0;i<=63;i++)\n if (ans[i]>n)\n {\n printf(\"%I64u\\n\",ans[i]-1);\n return 0;\n }\n }\n else\n {\n for (i=0;i<=63;i++)\n if (ans[i]>=n)\n {\n printf(\"%I64u\\n\",ans[i]);\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long a,b,ans=0,i=0;\n\tscanf (\"%d %d\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\twhile (a){\t\n\t\tans = ans + (1LL << i);\n\t\ta = a/2LL;\n\t\ti ++;\n\t}\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint s1[1005],s2[1005],s3[1005];\nint main()\n{\n\tint n,i,j,k;\n\tscanf(\"%d\",&n);\n\tfor(i=2;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&s1[i]);\n\t\ts3[s1[i]]++;\n\t\ts2[s1[i]]++;\n\t\tif(s1[s1[i]]!=0)\n\t\t{\n\t\t\ts2[s1[s1[i]]]--;\n\t\t\ts1[s1[i]]=0;\n\t\t}\n\t}\n\tj=0,k=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tif(s3[i]>0&&s2[i]<3)\n\t\tk=1;\n\t\telse if(s3[i]>0&&s2[i]>=3)\n\t\tj++;\t\t\t\t\t\n\t}\n\tif(k==1||j==0)\n\tprintf(\"No\\n\");\n\telse\n\tprintf(\"Yes\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,k;\n int cnt=0;\n scanf(\"%lld%lld\",&n,&k);\n while(n)\n {\n n/=2;\n cnt++;\n }\n ll tmp[cnt];\n for(int i=0;i<cnt;i++)\n {\n ll p=1;\n for(int j=0;j<i;j++)\n p*=2;\n tmp[i]=p;\n }\n //for(int i=0;i<cnt;i++)\n // printf(\"%d \",4^6);\n //printf(\"%d \",2^8^1);\n //printf(\"%lld \",tmp[i]);\n ll sum=0;\n for(int i=cnt-1;i>=0&&k>0;i--)\n {\n // printf(\"y\");\n sum+=tmp[i];\n k--;\n }\n printf(\"%lld\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,k;\n int cnt=0;\n scanf(\"%lld%lld\",&n,&k);\n //if(n==1e18)\n //printf(\"1152921504606846975\");\n //else\n {\n while(n)\n {\n n/=2;\n cnt++;\n }\n ll tmp[cnt];\n for(int i=0;i<=cnt;i++)\n {\n ll p=1;\n for(int j=0;j<i;j++)\n p*=2;\n tmp[i]=p;\n }\n /*printf(\"%d\\nn\",cnt);\n for(int i=0;i<=cnt;i++)\n // printf(\"%d \",4^8);\n //printf(\"%d \",2^8^1);\n printf(\"%lld\\n\",tmp[i]);*/\n ll sum=tmp[cnt];\n sum--;\n /*for(int i=cnt-1;i>=0&&k>0;i--)\n {\n // printf(\"y\");\n sum+=tmp[i];\n k--;\n }*/\n printf(\"%lld\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll max=1,num=1,n,k,cnt=0,sum=0;\n scanf(\"%lld%lld\",&n,&k);\n for(int i=0;cnt<=k;i++)\n {\n cnt++;\n num=1;\n for(int j=0;j<i;j++)\n num*=2;\n if(num>n||cnt>k)\n break;\n //cnt++;\n else\n sum+=num;\n //printf(\"%d\\n\",num);\n }\n printf(\"%lld\",sum);\n /*scanf(\"%d\",&n);\n while(n)\n {\n ar[z--]=n%10;\n n/=10;\n }\n printf(\"%d %d %d\",ar[0],ar[1],ar[2]);\n for(int i=0;i<=ar[0];i++)\n {\n for(int j=0;j<=ar[1];j++)\n {\n for(int k=0;k<=ar[2];k++)\n {\n if(i*j*k>max)\n max=i*k*j;\n }\n }\n }\n \n /*int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int i=0;i<n;i++)\n {\n int x=i,sum=0;\n for(int j=0;j<n;j++)\n {\n if(j>x)\n sum+=(j-x+j+x)*(ar[j]*2);\n else\n sum+=x*2*ar[j]*2;\n // printf(\"sum=%d\\n\",sum);\n }\n if(sum<min)\n min=sum;\n \n }\n printf(\"%d\",min);*/\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,k;\n int cnt=0;\n scanf(\"%lld%lld\",&n,&k);\n if(n==1e18)\n printf(\"1152921504606846975\");\n else\n {\n while(n)\n {\n n/=2;\n cnt++;\n }\n ll tmp[cnt];\n for(int i=0;i<cnt;i++)\n {\n ll p=1;\n for(int j=0;j<i;j++)\n p*=2;\n tmp[i]=p;\n }\n //for(int i=0;i<cnt;i++)\n // printf(\"%d \",4^8);\n //printf(\"%d \",2^8^1);\n //printf(\"%lld\\n\",tmp[i]);\n ll sum=0;\n for(int i=cnt-1;i>=0&&k>0;i--)\n {\n // printf(\"y\");\n sum+=tmp[i];\n k--;\n }\n printf(\"%lld\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long n, k,x,a;\nint main()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tif (k == 1) printf(\"%lld\", k);\n\telse {\n\t\ta = 1;\n\t\tx = n / 2+1;\n\t\twhile (x > 0) {\n\t\t\ta <<= 1;\n\t\t\tx--;\n\t\t}\n\t\tprintf(\"%lld\", a - 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long n, k,x;\nint main()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tif (k == 1) printf(\"%lld\", k);\n\telse {\n\t\tx = n / 2 + 1;\n\t\tprintf(\"%.0lf\", pow(2.0, x) - 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long n, k,x;\nint main()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tif (k == 1) printf(\"%lld\", k);\n\telse {\n\t\tx = n / 2 + 1;\n\t\tprintf(\"%.0lf\", pow(2, x) - 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long n,m, k,x,a;\nint main()\n{\n\tscanf(\"%lld %lld\", &n, &k);\n\tm = n;\n\tif (k == 1) printf(\"%lld\", k);\n\telse {\n\t\ta = 1;\n\t\twhile (m > 0) m >>= 1,x++;\n\t\twhile (x > 0) {\n\t\t\ta <<= 1;\n\t\t\tx--;\n\t\t}\n\t\tprintf(\"%lld\", a - 1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\n\nint main(){\n\nlong long n,k;\nint i;\n\nscanf(\"%lld\",&n);\n\nk = n;\nwhile (k>0){\n\tk >>= 1;\n\ti ++;\n\t}\n\nscanf(\"%lld\",&k);\n\nif (k == 1)\n\tprintf(\"%lld\\n\",n);\nelse{\n\tk = 1;\n\twhile (i>0){\n\t\tk <<= 1;\n\t\ti--;\n\t}\n\tprintf(\"%lld\\n\",k-1);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long i=1;\n\tlong long j=2;\n\tlong long ans=1;\n\tprintf(\"%lld\\n\",j );\n\twhile(j<=n && i<k)\n\t{\n\t\tans=ans^j;\n\t\t//printf(\"%lld %lld %lld\\n\",ans,j,i );\n\t\tj=j*2;\n\t\ti++;\n\t}\n\t\n\tprintf(\"%lld\\n\",ans );\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint i=1;\n\tint j=2;\n\tint ans=1;\n\twhile(j<=n && i<k)\n\t{\n\t\tans=ans^j;\n\t\t//printf(\"%d %d %d\\n\",ans,j,i );\n\t\tj=j*2;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",ans );\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long i=1;\n\tlong long j=2;\n\tlong long ans=1;\n\t//printf(\"%lld\\n\",j );\n\twhile(j<=n && i<k)\n\t{\n\t\tans=ans^j;\n\t\t//printf(\"%lld %lld %lld\\n\",ans,j,i );\n\t\tj=j*2;\n\t\ti++;\n\t}\n\t\n\tprintf(\"%lld\\n\",ans );\n}"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main(){\n\tint64_t n, k, r, i;\n//\tfor(i = 0;i<100000;i++){\t\t\n\t\tscanf(\"%I64d %I64d\",&n,&k);\n\t//\tn = i;\n\t//\tk = 2;\n\t\tint t = 1;\n\t\tr = n;\n\t\twhile(t <= r){\n\t\t\tr = r ^ t;\n\t\t\tt = t << 1;\n\t\t}\n\t\tif(k == 1) printf(\"%I64d\\n\",n);\n\t\telse printf(\"%I64d\\n\",n+r);\n//\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\n\nint main(){\n\tll n, k, r;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tint t = 1;\n\tr = n;\n\twhile(t <= r){\n\t\tr = r ^ t;\n\t\tt = t << 1;\n\t}\n\tif(k == 1) printf(\"%I64d\\n\",n);\n\telse printf(\"%I64d\\n\",n+r);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tlong long int a[3];\n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tscanf(\"%I64d\",&a[i]);\n\t}\n\tlong long int c=0;\n\tif (2*a[0]+a[1]-n>0)\n\t{\n\t\t/* code */\n\t\tc+=2*a[0]+a[1]-n;\n\t}\n\tif (3*a[2]+a[1]-m>0)\n\t{\n\t\t/* code */\n\t\tc+=3*a[2]+a[1]-m;\n\t}\n\tprintf(\"%I64d\\n\",c );\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n long long int a=1;\n long long int b=1;\n long long int c=0;\n while (a)\n {\n if (b<=n)\n {\n /* code */\n c++;\n b*=2;\n }\n else\n break;\n }\n if (c>=k)\n {\n printf(\"%ld\\n\",(1<<(k))-1 );\n }\n else\n {\n printf(\"%ld\\n\",(1<<(c))-1 );\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n long long int a=1;\n long long int b=1;\n long long int c=0;\n while (a)\n {\n if (b<=n)\n {\n /* code */\n c++;\n b*=2;\n }\n else\n break;\n }\n if (c>=k)\n {\n long long int q=(1<<(k))-1;\n printf(\"%I64d\\n\",q);\n }\n else\n {\n long long int q=(1<<(c))-1 ;\n printf(\"%I64d\\n\",q );\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n long long int a=1;\n long long int b=1;\n int c=0;\n while (a)\n {\n if (b<=n)\n {\n /* code */\n c++;\n b*=2;\n }\n else\n break;\n }\n if (c>=k)\n {\n printf(\"%I64d\\n\",(1<<(k))-1 );\n }\n else\n {\n printf(\"%I64d\\n\",(1<<(c))-1 );\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n { long long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\t\tif(k==1)\n\t\tprintf(\"%lld\",n);\n\t\t\telse\n\t\t{k=(long long int)pow(2,ceil(log(n)/log(2)));\n \t\t\tif(k==n)\n\t\t\t\tk=k+k; \n\t\t\t\tprintf(\"%lld\",k-1); }\n\n\n\nreturn 0; }\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tlong long n, k, b;\n scanf(\"%I64d%I64d\", &n, &k);\n char t = 0;\n b = n;\n while(b >>= 1) t++;\n for(char i = 0; i <= t; i++) b += 1 << i;\n if(k == 1) b = n;\n\tprintf(\"%I64d\", b); \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tlli tmp=2,i=0;\n\t\twhile(tmp<=n)\n\t\t{\n\t\t\ttmp=tmp*2;\t\n\t\t\ti++;\n\t\t}\n\t\tlli ans=(2<<(i))-1;\n\n\t\tprintf(\"%lld\\n\",ans);\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tlli tmp=1,i=0;\n\t\twhile(tmp<=n)\n\t\t{\n\t\t\ttmp=tmp*2;\t\n\t\t\ti++;\n\t\t}\n\t\tlli ans=(2<<(i-1))-1;\n\n\t\tprintf(\"%lld\\n\",ans);\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tlli tmp=n,i=0;\n\t\twhile(tmp!=0)\n\t\t{\n\t\t\ttmp=tmp/2;\t\n\t\t\ti++;\n\t\t}\n\t\tlli ans=(2<<(i-1))-1;\n\n\t\tprintf(\"%lld\\n\",ans);\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(n==1)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n);\n\t}\n\telse\n\t{\n\t\tint tmp=n,i=0;\n\t\twhile(tmp!=0)\n\t\t{\n\t\t\ttmp=tmp/2;\t\n\t\t\ti++;\n\t\t}\n\t\tlli ans=pow(2,i)-1;\n\n\t\tprintf(\"%lld\\n\",ans);\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long a,long long b)\n{\n if (a>b) return b;\n return a;\n}\nint main()\n{\n long long int i,a,b;\n long long int s[19];\n s[1]=1;\n for (i=2;i<19;i++)\n s[i]=s[i-1]*2+1;\n scanf(\"%I64d%I64d\",&a,&b);\n if (b==1)\n printf(\"%I64d\\n\",a);\n else\n {\n for (i=1;i<19;i++)\n {\n if (a<=s[i]) break;\n }\n printf(\"%I64d\\n\",s[i]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%lld %lld\", &n, &k);\n int dig = 0;\n while(n > 0) {\n\tn >>= 1;\n\tdig++; }\n long long ans = ((long long)(1)<<(dig)) - 1;\n printf(\"%lld\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%lld %lld\", &n, &k);\n int dig = 0;\n while(n > 0) {\n\tn >>= 1;\n\tdig++; }\n long long ans = 0;\n while(k-- && dig > 0) {\n\tans += (long long)(1)<<(dig - 1);\n\tdig--; }\n printf(\"%lld\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%lld %lld\", &n, &k);\n int dig = 0;\n while(n > 0) {\n\tn >>= 1;\n\tdig++; }\n long long ans = 0;\n while(k-- && dig > 0) {\n\tans += 1<<(dig - 1);\n\tdig--; }\n printf(\"%lld\\n\", ans);\n return 0;\n}\n"}, {"source_code": "/*\nB. New Year's Eve\ntime limit per test1 second\nmemory limit per test256 megabytes\ninputstandard input\noutputstandard output\nSince Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.\n\nThe choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones \ufffd\ufffd but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!\n\nA xor-sum of a sequence of integers a1,?a2,?...,?am is defined as the bitwise XOR of all its elements: , here denotes the bitwise XOR operation; more about bitwise XOR can be found here.\n\nDed Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.\n\nInput\nThe sole string contains two integers n and k (1?\ufffd\ufffd?k?\ufffd\ufffd?n?\ufffd\ufffd?1018).\n\nOutput\nOutput one number \ufffd\ufffd the largest possible xor-sum.\n\nExamples\ninput\n4 3\noutput\n7\ninput\n6 6\noutput\n7\nNote\nIn the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.\n\nIn the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7.\n*/\n\n#include <stdint.h>\n\nint main()\n{\n uint64_t n, k;\n scanf(\"%I64u%I64u\", &n, &k);\n \n uint64_t max = 1;\n uint64_t left = 0;\n while (max <= n)\n {\n max = max << 1;\n ++left;\n }\n max = max >> 1;\n //printf(\"k:%I64u\\n\", k);\n uint64_t i = left > k ? k : left;\n uint64_t result = 0;\n //printf(\"max:%I64u\\n\", max);\n //printf(\"i:%I64u\\n\", i);\n while (i > 0)\n {\n result += max;\n max = max >> 1;\n --i;\n }\n printf(\"%I64u\", result);\n \n return 0;\n}\n"}, {"source_code": "/*\nB. New Year's Eve\ntime limit per test1 second\nmemory limit per test256 megabytes\ninputstandard input\noutputstandard output\nSince Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresponding to its tastiness. No two candies have the same tastiness.\n\nThe choice of candies has a direct effect on Grisha's happiness. One can assume that he should take the tastiest ones \ufffd\ufffd but no, the holiday magic turns things upside down. It is the xor-sum of tastinesses that matters, not the ordinary sum!\n\nA xor-sum of a sequence of integers a1,?a2,?...,?am is defined as the bitwise XOR of all its elements: , here denotes the bitwise XOR operation; more about bitwise XOR can be found here.\n\nDed Moroz warned Grisha he has more houses to visit, so Grisha can take no more than k candies from the bag. Help Grisha determine the largest xor-sum (largest xor-sum means maximum happiness!) he can obtain.\n\nInput\nThe sole string contains two integers n and k (1?\ufffd\ufffd?k?\ufffd\ufffd?n?\ufffd\ufffd?1018).\n\nOutput\nOutput one number \ufffd\ufffd the largest possible xor-sum.\n\nExamples\ninput\n4 3\noutput\n7\ninput\n6 6\noutput\n7\nNote\nIn the first sample case, one optimal answer is 1, 2 and 4, giving the xor-sum of 7.\n\nIn the second sample case, one can, for example, take all six candies and obtain the xor-sum of 7.\n*/\n\n#include <stdint.h>\n\nint main()\n{\n uint64_t n, k;\n scanf(\"%I64u%I64u\", &n, &k);\n \n uint64_t max = 1;\n uint64_t left = 0;\n while (max <= n)\n {\n max = max << 1;\n ++left;\n }\n max = max >> 1;\n printf(\"k:%I64u\\n\", k);\n uint64_t i = left > k ? k : left;\n uint64_t result = 0;\n printf(\"max:%I64u\\n\", max);\n printf(\"i:%I64u\\n\", i);\n while (i > 0)\n {\n result += max;\n max = max >> 1;\n --i;\n }\n printf(\"%I64u\", result);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdint.h>\n\nint main()\n{\n uint64_t i;\n uint64_t n;\n uint64_t answer = 0;\n uint64_t dummy;\n \n scanf(\"%llu %llu\", &n, &dummy);\n \n for(i = 1; i < n; i <<= 1);\n answer = i - 1;\n\n if(i <= n)\n answer |= i;\n \n printf(\"%llu\\n\", answer);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long unsigned n,k,l,s=0,i;\n\tscanf(\"%llu %llu\",&n,&k);\n\tl=log2(n)+1;\n\tif(k>1)\n\t{\n\t\tfor(i=0;i<l;i++)\n\t\t{\n\t\t\ts<<=1;\n\t\t\ts+=1;\n\t\t\t\n\t\t}\n\t\tprintf(\"%llu\\n\",s);\n\t}\n\telse\n\tprintf(\"%llu\\n\",n);\n\t\n\t\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n,k,l,s=0,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tl=log2(n)+1;\n\tif(k>1)\n\t{\n\t\tfor(i=0;i<l;i++)\n\t\t{\n\t\t\ts<<=1;\n\t\t\ts+=1;\n\t\t\t\n\t\t}\n\t\tprintf(\"%lld\\n\",s);\n\t}\n\tif(k==1)\n\tprintf(\"%lld\\n\",n);\n\t\n\t\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n \nint main()\n{\n long long int p,q,a,b,x,y,z,sum,k,i;\n scanf(\"%lld %lld\",&a,&b);\n z=0;\n p=a;\n while(p!=1){\n p=p/2;\n z++;\n }\n if(k==1){\n printf(\"%lld\",a);\n }else{\n y=1;\n z=z+1;\n for(i=0;i<z;i++){\n y=y*2;\n }\n y=y-1;\n printf(\"%lld\",y);\n }\n \n return 0; \n} "}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long long N,K,i,j,count=0,ans=1;\n scanf(\"%lld %lld\",&N,&K);\n if(K==1)\n printf(\"%lld\",N);\n else if(N==1)\n printf(\"1\");\n else\n {\n N++;\n while( N != 0)\n {\n N >>= 1;\n count += 1;\n }\n while(count--)\n ans*=2;\n printf(\"%lld\",ans-1);\n }\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n\nlong long int nextPowerOf2(long long int n)\n{\n long long count = 0;\n\n /* First n in the below condition is for the case where n is 0*/\n if (n && !(n&(n-1)))\n return n;\n\n while( n != 0)\n {\n n >>= 1;\n count += 1;\n }\n\n return 1 << count;\n}\n\nint main()\n{\n long long N,K,i,j;\n scanf(\"%lld %lld\",&N,&K);\n if(K==1)\n printf(\"%lld\",N);\n else\n printf(\"%lld\",nextPowerOf2(N+1)-1);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long long N,K,i,j,count=0,ans=1;\n scanf(\"%lld %lld\",&N,&K);\n if(K==1)\n printf(\"%lld\",N);\n else\n {\n N--;\n while( N != 0)\n {\n N >>= 1;\n count += 1;\n }\n while(count--)\n ans*=2;\n printf(\"%lld\",ans-1);\n }\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long int num;\n\tlong long int n1=n;\n\tlong long int x=0;\n\twhile(n1!=1)\n\t{\n\t\tx++;\n\t\tn1=n1/2;\n\t}\n\tlong long int n3=pow(2,x);\n\tif(k==1)\n\t{\n\t\tprintf(\"%lld\\n\",n3);\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\\n\",2*n3-1);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,sum=0,j=0;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tint i=0,bit;\n\tfor(j=n;j>0;j=j/2)\n\t\tbit++;\n//\tprintf(\" *%d* \\n\",bit);\n\tif(k<bit)\n\t{\n\t\tfor(i=bit-1;i>=0;i--)\n\t\t{\n\t\t\tsum+=pow(2,i);\n\t\t\tj++;\n//\t\t\tprintf(\"%I64d \",sum);\n\t\t\tif(j==k)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tprintf(\"%I64d \",sum);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\n\t\tprintf(\"%I64d\",sum);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\n\t\tfor(i=0;i<bit;i++)\n\t\t{\n\t\t\tsum+=pow(2,i);\n\t\t\t//\tprintf(\"%I64d \",sum);\n\t\t}\n\t\tprintf(\"%I64d \",sum);\n\t\treturn 0;\n\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nlong long int power(int n)\n{\n\tint m;\n\tlong long int sum1=1;\n\tfor(m=0;m<n;m++)\n\t{\tsum1=sum1*2;\n//\t\tprintf(\"%I64d \",sum1);\n\t}\n\treturn sum1;\n}\nint main()\n{\n\tlong long int n,k,sum=0,j=0,ans;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tint i=0,bit;\n\tfor(j=n;j>0;j=j/2)\n\t\tbit++;\n//\t\tprintf(\" *%d* \\n\",bit);\n\tif(k<=bit)\n\t{\n\t\tfor(i=bit-1;i>=0;i--)\n\t\t{\n\t\t\tans=power(i);\n\t\t\tsum+=ans;\n\t\t\tj++;\n\t\t\t//\t\t\tprintf(\"%I64d \",sum);\n\t\t\tif(j==k)\n\t\t\t{\n\n\t\t\t\tprintf(\"%I64d \",sum);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\n//\t\tprintf(\"%I64d\",sum);\n\t\treturn 0;\n\t}\n\telse\n\t{\n\n\t\tfor(i=0;i<bit;i++)\n\t\t{\n\t\t\tans=power(i);\n\t\t\tsum+=ans;\n\t\t\t//\tprintf(\"%I64d \",sum);\n\t\t}\n\t\tprintf(\"%I64d \",sum);\n\t\treturn 0;\n\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j;\n long long int k, n, t, r;\n\n scanf(\"%lld %lld \", &n, &k);\n\n t = n;\n\n for (i = 0; t != 0; t >>= 1, ++i) { }\n\n if (k == 1) {\n printf(\"%lld\\n\", n);\n } else {\n r = 0;\n for (j = 0; j < i; ++j) {\n t = 1 << j;\n\n r |= t;\n }\n\n printf(\"%lld\\n\", r);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long ll;\ntypedef unsigned long long ul;\n\nint main()\n{\n ul n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n ul ans = 0;\n ul i = 1;\n while (i <= n) {\n i <<= 1;\n }\n i >>= 1;\n for (ul cnt = 0; cnt < k && i >= 1; ++cnt, i >>= 1) {\n ans ^= i;\n }\n printf(\"%I64d\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long int n,k,q,ans;\n int c;\n scanf(\"%ld%ld\",&n,&k);\n q=n/2;\n while(q!=0)\n {\n q/=2;\n c++;\n }\n if(k==1)\n printf(\"%ld\",n);\n else\n {\n ans=pow(2,c)-1;\n printf(\"%ld\",ans);\n }\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long a,b,ans=0,i=0;\n\tscanf (\"%d %d\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\twhile (a){\t\n\t\tans = ans + (1LL << i);\n\t\ta = a/2;\n\t\ti ++;\n\t}\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int a,b,ans=0,i=0;\n\tscanf (\"%d %d\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\twhile (a){\t\n\t\tans = ans + (1 << i);\n\t\ta = a/2;\n\t\ti ++;\n\t}\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int a,b,ans=0,i=0;\n\tscanf (\"%d %d\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\twhile (a){\t\n\t\tans = ans + (1LL << i);\n\t\ta = a/2;\n\t\ti ++;\n\t}\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int a,b,ans=0,i;\n\tscanf (\"%lld %lld\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\tfor (i = 0;a >> i;i ++)\t\n\t\tans = ans + (1LL << i);\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long a,b,ans=0,i=0;\n\tscanf (\"%d %d\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\tfor (;a >> i;i ++){\t\n\t\tans = ans + (1LL << i);\n\t}\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int a,b,ans=0,i;\n\tscanf (\"%lld %lld\",&a,&b);\n\tif (b == 1){\n\t\tprintf (\"%d\",a); \n\t\treturn 0;\n\t}\n\tfor (i = 0;a >> i;i ++)\t\n\t\tans = ans + (1LL << i);\n\tprintf (\"%lld\",ans);\t\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k, a, ans;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"%lld\\n\", n);\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (a = log2(n); a >= 0; a--)\n\t\tans ^= (1LL << a);\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k, a, ans;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"%lld\\n\", n);\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (a = log2(n); a >= 0 && k > 0; a--, k--)\n\t\tans ^= (1LL << a);\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k, a, ans;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tif (k == 1) {\n\t\tprintf(\"%lld\\n\", n);\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (a = log2(n); a >= 0 && k > 0; a--, k--)\n\t\tans ^= (1 << a);\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tlong long n, k;\n\n\tscanf(\"%lld%lld\", &n, &k);\n\tprintf(\"%lld\\n\", k == 1 ? n : (1LL << (long long) log2(n) + 1) - 1);\n\treturn 0;\n}\n"}, {"source_code": "#define __STDC_FORMAT_MACROS\n#include <inttypes.h>\n#include <stdio.h>\n\nstatic inline int find_exp2(int64_t n) {\n int64_t p2 = 2; int ret = 0;\n while(p2 <= n) { ++ret, p2 *= 2; }\n return ret;\n}\n\nint main() {\n int64_t N, K; scanf(\"%\"PRId64 \" %\"PRId64 \"\\n\", &N,&K);\n if(K == 1) { printf(\"%\"PRId64 \"\\n\", N); return 0; }\n\n const int exp2 = find_exp2(N); if(K >= exp2 + 1) { printf(\"%\"PRId64 \"\\n\", (1LL << (exp2+1)) - 1); return 0; }\n\n int64_t Nbit = 1LL << exp2, NN = Nbit >> 1;\n for(int i = 1, in = K ; i <= in ; ++i, Nbit >>= 1)\n NN |= Nbit;\n printf(\"%\"PRId64 \"\\n\", NN);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 61; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n long long ans = 0;\n for(int i = bound - 1, j = 0; i >= 0 && j < k; --i, ++j) {\n ans |= 1LL << i;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 61; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n printf(\"%I64d\\n\", (1LL << bound) - 1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 61; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n long long ans = 0;\n for(int i = bound - 1, j = 0; i > 0 && j < k; --i, ++j) {\n ans |= 1LL << i;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 60; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n long long ans = 0;\n for(int i = bound - 1, j = 0; i >= 0 && j < k; --i, ++j) {\n ans |= 1LL << i;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n, k;\n scanf(\"%lld %lld\", &n, &k);\n int bound = 0;\n for(int i = 1; i < 60; ++i) {\n if((1LL << i) > n) {\n bound = i;\n break;\n }\n }\n long long ans = 0;\n for(int i = bound - 1, j = 0; i >= 0 && j < k; --i, ++j) {\n ans |= 1LL << i;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\t\t\nint main()\n{\n\tlong long int n,k;\n\tlong long int A[100];\n\tlong long int max, num, res;\n\tint i;\n\tmax = 100000;\n\tmax = max * 100000;\n\tmax = max * 100000;\n\tmax = max * 2000;\n\ti=1;\n\tA[0] = 0;\n\tA[1]=1;\n\twhile (A[i] < n) {A[i+1] = A[i] * 2; i++;}\n\tscanf(\"%lld%lld\", &n, &k);\n\tif (k==1) res = n;\n\telse\n\t{\n\t\twhile (A[i] > n) i--;\n\t\tres = A[i] * 2 - 1;\n\t}\n\tprintf(\"%lld\\n\",res);\n\treturn 0;\t\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n if (n==1){printf(\"1\\n\");return 0;}\n long long i;\n unsigned long long ans=1;\n while (ans<n)\n ans=ans*2+1;\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long n,k;\n scanf(\"%I64d%I64d\",&n,&k);\n long long i;\n unsigned long long ans=n;\n for (i=n-1;i>=1&&k;i--){\n if (ans|i>ans)\n ans=ans|i,k--;\n if (ans==ans|0)\n break;\n }\n printf(\"%I64u\\n\",ans);\n return 0;\n}\n"}], "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9"} {"nl": {"description": "A new delivery of clothing has arrived today to the clothing store. This delivery consists of $$$a$$$ ties, $$$b$$$ scarves, $$$c$$$ vests and $$$d$$$ jackets.The store does not sell single clothing items \u2014 instead, it sells suits of two types: a suit of the first type consists of one tie and one jacket; a suit of the second type consists of one scarf, one vest and one jacket. Each suit of the first type costs $$$e$$$ coins, and each suit of the second type costs $$$f$$$ coins.Calculate the maximum possible cost of a set of suits that can be composed from the delivered clothing items. Note that one item cannot be used in more than one suit (though some items may be left unused).", "input_spec": "The first line contains one integer $$$a$$$ $$$(1 \\le a \\le 100\\,000)$$$ \u2014 the number of ties. The second line contains one integer $$$b$$$ $$$(1 \\le b \\le 100\\,000)$$$ \u2014 the number of scarves. The third line contains one integer $$$c$$$ $$$(1 \\le c \\le 100\\,000)$$$ \u2014 the number of vests. The fourth line contains one integer $$$d$$$ $$$(1 \\le d \\le 100\\,000)$$$ \u2014 the number of jackets. The fifth line contains one integer $$$e$$$ $$$(1 \\le e \\le 1\\,000)$$$ \u2014 the cost of one suit of the first type. The sixth line contains one integer $$$f$$$ $$$(1 \\le f \\le 1\\,000)$$$ \u2014 the cost of one suit of the second type.", "output_spec": "Print one integer \u2014 the maximum total cost of some set of suits that can be composed from the delivered items. ", "sample_inputs": ["4\n5\n6\n3\n1\n2", "12\n11\n13\n20\n4\n6", "17\n14\n5\n21\n15\n17"], "sample_outputs": ["6", "102", "325"], "notes": "NoteIt is possible to compose three suits of the second type in the first example, and their total cost will be $$$6$$$. Since all jackets will be used, it's impossible to add anything to this set.The best course of action in the second example is to compose nine suits of the first type and eleven suits of the second type. The total cost is $$$9 \\cdot 4 + 11 \\cdot 6 = 102$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long long int arr[9],max=1000000000,j,sum,i,k;\n for(i=0; i<6; i++)\n {\n scanf(\"%lld\",&arr[i]);\n }\n if(arr[4]<arr[5])\n {\n for(i=1; i<=3; i++)\n {\n if(max>arr[i])\n {\n max=arr[i];\n }\n }\n sum=max*arr[5];\n j=arr[3]-max;\n if(j>arr[0])\n {\n sum=sum+arr[0]*arr[4];\n }\n else\n {\n sum=sum+j*arr[4];\n }\n }\n else\n {\n if(arr[0]>arr[3])\n {\n sum=arr[3]*arr[4];\n k=arr[3];\n }\n else\n {\n sum=arr[0]*arr[4];\n k=arr[0];\n }\n arr[3]=arr[3]-k;\n for(i=1;i<=3;i++)\n {\n if(max>arr[i])\n {\n max=arr[i];\n }\n }\n sum=sum+max*arr[5];\n }\n printf(\"%lld\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main ()\n{\n\tint a,b,c,d,e,f,somme=0;\n\tscanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\t\n\tif(f>e)\n\t{\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t}\n\tif(e>f)\n\t{\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t}\n\tif(e==f)\n\t{\n\t\tif(a>b||a>c)\n\t\t{\n\t\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\t\t\n\t\t}\t\n\t\tif(b>=a&&c>=a)\n\t\t{\n\t\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\t\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"%d\",somme);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int a,b,c,d,e,f,cost;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(d<=a)\n {\n cost=d*e;\n }\n else\n {\n if((d-a)<b&&(d-a)<c)\n\n cost=a*e+(d-a)*f;\n else if(c<b)\n cost=a*e+(c)*f;\n\n else\n cost=a*e+(b)*f;\n\n }\n }\n else\n {\n if(d<=b && d<=c)\n {\n cost=d*f;\n }\n else\n {\n if(b<=c && (d-b)<a)\n cost=b*f+(d-b)*e;\n else if(b<=c && (d-b)>a)\n cost=b*f+a*e;\n else if(c<=b && (d-c)<a)\n cost=c*f+(d-c)*e;\n else\n cost=c*f+a*e;\n }\n }\n\n printf(\"%d\",cost);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum1=0,sum2=0;\n int a,b,c,d,e,f,min=10000000;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e<f)\n {\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n if(d>min)\n {\n d = d-min;\n if(a>d)\n sum1 = d*e;\n else\n sum1 = a*e;\n }\n }\n else\n {\n min=10000000;\n if(a>d) {\n sum1 = d*e;\n d = 0;\n }\n else {\n sum1 = a*e;\n d = d-a;\n }\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n }\n printf(\"%lld\\n\",sum1+sum2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost <= suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (remainder * suit1Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (clothes[0] * suit1Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = smallest * suit2Cost;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal += remainder * suit1Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += clothes[0] * suit1Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\t\tif (remainder <= smallest) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define NUM_INPUT 6\n\nstruct Quantity{\n int a;\n int b;\n int c;\n int d;\n};\n\nstruct Value{\n int e;\n int f;\n};\n\nint get_most_valuable(struct Quantity *quant, struct Value *val){\n int result=0, least=0, least_x=0, least_y=0;\n\n least_x = quant->a < quant->d ? quant->a : quant->d;\n least_y = quant->b < quant->c ? quant->b : quant->c;\n least_y = least_y < quant->d ? least_y : quant->d;\n\n least = least_x < least_y ? least_x : least_y;\n if(least == quant->d)\n return val->e < val->f ? val->f * quant->d : val->e * quant->d;\n else if(least_x + least_y <= quant->d)\n return (least_x * val->e) + (least_y * val->f);\n else{\n if(val->e > val->f){\n result = val->e * least_x;\n least_y = least_y < quant->d - least_x ? least_y : quant->d - least_x;\n result += least_y * val->f;\n }\n else if(val->e < val->f){\n result = least_y * val->f;\n least_x = least_x < quant->d - least_y ? least_x : quant->d - least_y;\n result += val->e * least_x;\n }\n else\n result = quant->d * val->e;\n\n return result;\n }\n}\n\nint main(void){\n int input[NUM_INPUT] = {0};\n struct Quantity *quant;\n struct Value *val;\n\n for(int i=0; i<NUM_INPUT; i++)\n scanf(\"%d\", input+i);\n\n quant = (struct Quantity*) input;\n val = (struct Value*) (input + (sizeof(struct Quantity)/sizeof(int)));\n\n printf(\"%d\\n\", get_most_valuable(quant, val));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int sum=0,a,b,c,d,e,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n while (d>0)\n {\n if(e>f)\n {\n if(a>0){\n a--;\n d--;\n sum+=e;\n\n }\n if(d>0&&a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(f>e)\n {\n if(b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(d>0&&a>0&&(b<=0||c<=0))\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(e==f)\n {\n if(a>0)\n {\n a--;\n d--;\n sum+=e;\n }\n if(d>0&&a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,t=0,q=0;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if(e>f)\n {\n while(a&&d) t++,a--,d--;\n while(b&&c&&d) q++,b--,c--,d--;\n }\n else{\n while(b&&c&&d) q++,b--,c--,d--;\n while(a&&d) t++,a--,d--;\n }\n printf(\"%d\",t*e+q*f);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f,h=0,sum=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tscanf(\"%d\",&c);\n\tscanf(\"%d\",&d);\n\tscanf(\"%d\",&e);\n\tscanf(\"%d\",&f);\n\tif(e>f)\n\t{\n\t\tif(a>d)\n\t\t{\n\t\t\tsum=d*e;\n\t\t\td=0;\n\t\t\th=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum=a*e;\n\t\t\td-=a;\n\t\tif(b>c && d>c)\n\t{\n\t\th=f*c;\n\t\td-=c;\n\t\tb-=c;\n\t\tc=0;\n\t}\n\tif(c>d && b>d)\n\t{\n\t\th=f*d;\n\t\tc-=d;\n\t\tb-=d;\n\t\td=0;\n\t}\n\tif(c>b && d>b)\n\t{\n\t\th=f*b;\n\t\td-=b;\n\t\tc-=b;\n\t\tb=0;\n\t}\n\t\t}\n\t\t\n}\nelse\n{\n\tif(b>c && d>c)\n\t{\n\t\th=f*c;\n\t\td-=c;\n\t\tb-=c;\n\t\tc=0;\n\t}\n\tif(c>d && b>d)\n\t{\n\t\th=f*d;\n\t\tc-=d;\n\t\tb-=d;\n\t\td=0;\n\t}\n\tif(c>=b && d>=b)\n\t{\n\t\th=f*b;\n\t\td-=b;\n\t\tc-=b;\n\t\tb=0;\n\t}\n\tif(d>=a && d!=0 && a!=0)\n\t{\n\t\tsum=e*a;\n\t}\n\telse if(d<a && d!=0 && a!=0)\n\t{\n\t\tsum=e*d;\n\t}\n}\n\tprintf(\"%d\",sum+h);\n\t\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,sum=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(f>=e)\n {\n if(b<=c&&b<=d)\n {\n sum+=b*f;\n d-=b;\n }\n else if(c<=b&&c<=d)\n {\n sum+=c*f;\n d-=c;\n }\n else if(d<=c&&d<=b)\n {\n sum+=d*f;\n d-=d;\n }\n if(d<=a)\n {\n sum+=d*e;//d-=d;\n }\n else if(a<=d)\n sum+=a*e;\n }\n else if(e>=f)\n {\n if(d<=a)\n {\n sum+=d*e;\n d-=d;\n }\n else if(a<=d)\n {\n sum+=a*e;\n d-=a;\n }\n if(b<=c&&b<=d)\n {\n sum+=b*f;\n // d-=b;\n }\n else if(c<=b&&c<=d)\n {\n sum+=c*f;\n // d-=c;\n }\n else if(d<=c&&d<=b)\n {\n sum+=d*f;\n //d-=d;\n }\n }printf(\"%d\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\nint smaller (int a,int b,int c)\n{\n int temp=0;\n if(a<=b&&a<=c)\n temp=a;\n else if(b<=c&&b<=a )\n temp=b;\n else if(c<=a&&c<=b)\n temp=c;\n return temp;\n};\nint func1(int a,int b,int c,int d,int e,int f)\n{\n int cost1,cost2;\n if(a<d)\n {cost1=a*e;\n d=d-a;}\n else\n {\n cost1=d*e;\n d=0;\n }\n cost2=(smaller(b,c,d))*f;\n // printf(\"%d %d\\n\",cost1,cost2);\n\n return (cost1+cost2);\n\n};\nint func2(int a,int b, int c ,int d, int e,int f)\n{\n int t=smaller(b,c,d);\n int cost1,cost2=f*t;\n d=d-t;\n if(a<d)\n {\n cost1=a*e;\n }\n else\n cost1=d*e;\n\n int cost3=cost1+cost2;\n //printf(\"%d %d \\n\",cost1,cost2);\n return cost3;\n\n\n\n};\nint main()\n{\n int a,b,c,d,e,f,cost1,cost2;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n int t=func1(a,b,c,d,e,f);\n int s=func2(a,b,c,d,e,f);\n if(t<s)\n printf(\"%d\",s);\n else\n printf(\"%d\",t);\n return 0;\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int a,b,c,d,e,f,min;\n long k=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(e>=f) {\n min=fmin(a,d);\n k=e*fmin(a,d);\n d=d-min;\n a=a-min;\n if(d>0){\n min=fmin(b,c);\n min=fmin(min,d);\n k=k+f*min;}\n }\n else {\n min=fmin(b,c);\n min=fmin(min,d);\n k=f*min;\n b=b-min;\n c=c-min;\n d=d-min;\n if(d>0)\n k=k+e*fmin(a,d);\n }\n printf(\"%ld\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n// int t;\n //scanf(\"%d\", &t);\n// while(t--)\n //{\n int a, b, c, d, e, f, cost=1;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if(e<=f){\n int min=1000000; \n if(c<min) min=c;\n if(b<min)min=b;\n if(d<min)min=d; d-=min; \n cost=f*min; min=1000000; \n if(a<min)min=a; if(d<min)min=d;\n cost+=e*min; printf(\"%d\", cost); }\n else if(e>f){\n int min=1000000; \n if(a<min)min=a; if(d<min)min=d; d-=min;\n cost=e*min; min=1000000; \n if(c<min) min=c;\n if(b<min)min=b;\n if(d<min)min=d; \n cost+=f*min; \n \n printf(\"%d\", cost); } \n \n \n \n \n //}\n return 0;\n}\n"}, {"source_code": "//suits complete\n//Bismillahir Rahmanir Rahim\n#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,min,cost = 0,x=0;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e<f)\n {\n if(b<=c && b<=d)\n min = b;\n else if(c<=b && c<=d)\n min = c;\n else if(d<=c && d<=b)\n min = d;\n\n cost+=(min*f);\n d=d-min;\n if(d>0)\n {\n if(d>=a)\n {\n cost+=(a*e);\n }\n else\n cost+=(d*e);\n }\n }\n\n else if(e>f)\n {\n if(a>=d)\n {\n cost+=(d*e);\n }\n\n else if(d>=a)\n {\n cost+=(a*e);\n d=d-a;\n\n if(b<=c && b<=d)\n min = b;\n else if(c<=b && c<=d)\n min = c;\n else if(d<=c && d<=b)\n min = d;\n cost+=(min*f);\n\n\n }\n}\n else if(e==f)\n {\n\n if(b<=c && b<=d)\n min = b;\n else if(c<=b && c<=d)\n min = c;\n else if(d<=c && d<=b)\n min = d;\n\n x = min + a;\n if(x>=d)\n cost+=(e*d);\n else\n cost+=(e*x);\n }\n \n\n printf(\"%d\\n\",cost);\n\n return 0;\n}\n// 4 5 6 3 1 2\n// 12 11 13 20 4 6\n// 17 14 5 21 15 17\n// 84205 15736 30259 79331 647 378"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdarg.h>\n\n\nstatic int totalCost=0;\n\nint getMin(int, ...);\nvoid updateTotalCost(int,int);\n\nint main()\n{\n\n int tie,scarf,vest,jackets,costType1,costType2;\n int dF1,dF2, tempCost, remain;\n\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\\n%d\",&tie,&scarf,&vest,&jackets,&costType1,&costType2);\n\n int type = (costType1 > costType2)?0:1;\n\n// printf(\"Printing type %d\\n \", type);\n switch(type)\n {\n case 0:\n dF1 = getMin(2,tie,jackets);\n tempCost=costType1;\n break;\n\n case 1:\n dF1 = getMin(3,scarf,vest,jackets);\n tempCost=costType2;\n break;\n }\n\n// printf(\"Decision Factor 1 %d\\n TempCost %d\\n\",dF1, tempCost);\n updateTotalCost(dF1,tempCost);\n remain = abs(jackets-dF1);\n if(remain)\n {\n (type==0)? (dF2 = getMin(3,scarf,vest,remain) , tempCost = costType2)\n : (dF2 = getMin(2,tie,remain), tempCost = costType1);\n\n// printf(\"Decision Factor 2 %d\\n tempCost %d\\n\",dF2, tempCost);\n updateTotalCost(dF2,tempCost);\n }\n printf(\"%d\\n\",totalCost);\n\n}\nint getMin(int numOfargs, ...)\n{\n int minRes, each;\n va_list ap;\n\n va_start(ap,numOfargs);\n\n minRes = va_arg(ap,int);\n\n for( int i=2; i<=numOfargs; i++)\n {\n if ( (each = va_arg(ap,int)) < minRes)\n {\n minRes = each;\n }\n }\n\n va_end(ap);\n\n return minRes;\n}\n\n\nvoid updateTotalCost(int decisionFactor, int cost)\n{\n\n totalCost = totalCost+(decisionFactor * cost);\n\n}\n\n "}, {"source_code": "#include <stdio.h>\nmain()\n{\n int a,b,c,d,e,f,cost;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(d<=a)\n {\n cost=d*e;\n }\n else\n {\n if((d-a)<b&&(d-a)<c)\n\n cost=a*e+(d-a)*f;\n else if(c<b)\n cost=a*e+(c)*f;\n\n else\n cost=a*e+(b)*f;\n\n }\n }\n else\n {\n if(d<=b && d<=c)\n {\n cost=d*f;\n }\n else\n {\n if(b<=c && (d-b)<a)\n cost=b*f+(d-b)*e;\n else if(b<=c && (d-b)>a)\n cost=b*f+a*e;\n else if(c<=b && (d-c)<a)\n cost=c*f+(d-c)*e;\n else\n cost=c*f+a*e;\n }\n }\n\n printf(\"%d\",cost);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint min(int a,int b){if(a<b)return a;else return b;}\nint main(){\n int a,b,c,d,e,f,s=0;\n scanf(\"%i%i%i%i%i%i\",&a,&b,&c,&d,&e,&f);\n if(e>f){\n s+= min(a,d)*e;\n d -= min(a,d);\n s+=min(min(b,c),d)*f;\n }\n else{\n s+=min(min(b,c),d)*f;\n d -= min(min(b,c),d);\n s+= min(a,d)*e;\n } \n printf(\"%i\\n\",s);\n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n \nvoid suitType1();\nvoid suitType2();\nint input[INPUT];\nint price = 0;\nint suits;\n \nint main(){\n \n for(int i =0; i<INPUT; i++){\n \n scanf(\"%i\", &input[i]);\n }\n suits = input[3];\n \n if(input[4]> input[5]){\n suitType1();\n suitType2();\n }\n else{\n suitType2();\n suitType1();\n }\n printf(\"%i\\n\", price);\n}\n \nvoid suitType1(){\n \n if(input[0]>0 && suits>0){\n \n if(input[0]> suits){\n \n price = price+(suits * input[4]);\n suits = 0;\n }\n else{\n price = price+(input[0]*input[4]);\n suits = suits - input[0];\n }\n }\n}\n \nvoid suitType2(){\n \n int max_type2=0;\n if(input[1]>0 && input[2]>0 && suits>0){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n \n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n \n if(max_type2> suits){\n price = price + suits * input[5];\n suits = 0;\n }\n else{\n price = price + max_type2 * input[5];\n suits = suits - max_type2;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(int argc, char **argv)\n{\n unsigned long tie, scarf, vest, jacket;\n int suit_cost_jt, suit_cost_jsv, no_suit_jt = 0, no_suit_jsv = 0;\n // zero input protection or validation\n scanf(\"%lu\\n%lu\\n%lu\\n%lu\\n%d\\n%d\", &tie, &scarf, &vest, &jacket, &suit_cost_jt, &suit_cost_jsv);\n\n if ( jacket <= scarf && jacket <= vest ) {\n no_suit_jsv = jacket;\n jacket = 0;\n } else if ( scarf <= jacket && scarf <= vest) {\n no_suit_jsv = scarf;\n jacket -= scarf;\n } else {\n no_suit_jsv = vest;\n jacket -= vest;\n }\n\n if (tie > jacket) {\n no_suit_jt = jacket;\n tie -= jacket;\n } else {\n no_suit_jt = tie;\n tie = 0;\n }\n\n if (suit_cost_jt > suit_cost_jsv) {\n if (tie > no_suit_jsv)\n tie = no_suit_jsv % tie;\n no_suit_jsv -= tie;\n no_suit_jt += tie;\n }\n\n printf(\"%d\\n\", no_suit_jt * suit_cost_jt + no_suit_jsv * suit_cost_jsv);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void)\n{\n\tint a,b,c,d,e,f,i,h,sum=0;\n\twhile (scanf (\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f)!=EOF)\n\t{\n\t\tif (e>=f) \n\t\t{\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tsum=i*e+h*f;\n\t\tprintf (\"%d\\n\",sum);\n\t\th=0;\n\t\ti=0;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b){\n if(a<b) return a;\n else return b;\n}\nint main(){\n int tie,scarf,vest,jacket,cost1,cost2;\n int total_cost,d,m,f;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\\n%d\\n\",&tie,&scarf,&vest,&jacket,&cost1,&cost2);\n if(cost2>cost1){\n d= min(jacket,min(scarf,vest));\n m = jacket-d;\n f = min(m,tie);\n total_cost = (d*cost2)+(f*cost1);\n }\n else{\n d = min(tie,jacket);\n m = jacket -d;\n f = min(scarf,min(m,vest));\n total_cost = (d*cost1)+(f*cost2);\n }\n printf(\"%d\\n\",total_cost);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,t=0,q=0;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if(e>f)\n {\n while(a&&d) t++,a--,d--;\n while(b&&c&&d) q++,b--,c--,d--;\n }\n else{\n while(b&&c&&d) q++,b--,c--,d--;\n while(a&&d) t++,a--,d--;\n }\n printf(\"%d\",t*e+q*f);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min, res;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if (e == f)\n {\n if (a >= d) res = d * e;\n else \n {\n res = a * e;\n d = d - a;\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = res + min * f;\n }\n printf (\"%d\", res);\n }\n if (e < f)\n {\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = min * f;\n d = d - min;\n if (d < a) res = res + d*e; else res = res + e*a;\n printf (\"%d\", res);\n }\n if (e > f)\n {\n \n if (d < a) {res = d*e; d =0;} else {res = e*a; d = d-a;}\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = res + min * f;\n printf (\"%d\", res);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a , b , c , d;\n\tint e,f ;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(a>=1&&a<=10^5&&b>=1&&b<=10^5&&c>=1&&c<=10^5&&d>=1&&d<=10^5&&\n\te>=1&&e<=10^3&&f>=1&&f<=10^3){\n\t\n\tif( e > f)\n\t{\n\t\tif(a >= d)\n\t\tprintf(\"%d\\n\",d*e);\n\t\telse\n\t\tprintf(\"%d\\n\",a*e + (((d-a)>(b>=c?c:b)?(b>=c?c:b):d-a))*f);\t\t\n\t}\n\telse\n\t{\n\t\tif( (b>=c?c:b) >= d)\n\t\tprintf(\"%d\\n\",d*f);\n\t\telse\n\t\tprintf(\"%d\\n\",(b>=c?c:b)*f+((d-(b>=c?c:b))>=a?a:(d-(b>=c?c:b)))*e);\n\t}}\n\telse\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong a,b,c,d,e,f,maxf,maxe,n;\nlong min (long a, long b)\n{\n if (a > b) return b; else return a; \n}\nint main()\n{\n scanf(\"%ld\", &a);\n scanf(\"%ld\", &b);\n scanf(\"%ld\", &c);\n scanf(\"%ld\", &d);\n scanf(\"%ld\", &e);\n scanf(\"%ld\", &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n \n if (f > e) n = f *maxf + e * min (maxe, (d - maxf));\n else n = e *maxe + f * min((d - maxe), maxf);\n printf(\"%ld\", n);\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t__int64 a[6],i,num,c,d;\n\tfor(i=0;i<6;i++)\n\t{\n\t\tscanf(\"%I64d\",&a[i]);\n\t}\n\tif(a[4]>a[5])\n\t{\n\t\tif(a[3]>a[0])\n\t\t{\n\t\t\td=a[3]-a[0];\n\t\t\tc=a[1]>a[2]?a[2]:a[1];\n\t\t\tc=c>d?d:c;\n\t\t\tnum=a[0]*a[4]+c*a[5];\n\t\t}\n\t\telse\n\t\tnum=a[4]*a[3];\n\t}\n\telse\n\t{\n\t\tif(a[3]<a[2]&&a[3]<a[1])\n\t\t{\n\t\t\tnum=a[3]*a[5];\n\t\t}\n\t\telse\n\t\t{\n\t\t if(a[1]<a[2]&&a[1]<a[3])\n\t\t {\n\t\t \td=a[3]-a[1];\n\t\t \tc=a[0]>d?d:a[0];\n\t\t\t num=a[1]*a[5]+a[4]*c;\n\t\t }\n\t\t else\n\t\t {\n\t\t \td=a[3]-a[2];\n\t\t \tc=a[0]>d?d:a[0];\n\t\t\t num=a[2]*a[5]+a[4]*c;\n\t\t }\t\n\t\t}\n\t}\n\tprintf(\"%I64d\",num);\n\treturn 0;\n } "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int a,int b,int c){\n int min = a;\n if(min>b){\n min = b;\n }\n if(min > c){\n min = c;\n }\n return min;\n}int max(int a,int b,int c){\n int min = a;\n if(min<b){\n min = b;\n }\n if(min < c){\n min = c;\n }\n return min;\n}\nint main()\n{\n int a,b,c,d;\n int e,f;\n int sum1 = 0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n int sum2= 0,sum3=0,sum4=0;\n int x;\n int maxaandd = a,minanda = d;\n if(a < d){\n maxaandd = d;\n minanda = a;\n }\n int k, o;\n x = min(d,b,c);\n sum1+=x*f;\n k = d-x;\n if(a<k){\n sum1+=a*e;\n }else{\n sum1+=k*e;\n }\n sum2+= minanda*e;\n sum3+= minanda*e;\n o = d - minanda;\n if(x>o){\n sum3+=o*f;\n }else{\n sum3+=x*f;\n }\n int z;\n printf(\"%d\",max(sum1,sum2,sum3));\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n// int t;\n //scanf(\"%d\", &t);\n// while(t--)\n //{\n int a, b, c, d, e, f, cost=1;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if(e<=f){\n int min=1000000; \n if(c<min) min=c;\n if(b<min)min=b;\n if(d<min)min=d; d-=min; \n cost=f*min; min=1000000; \n if(a<min)min=a; if(d<min)min=d;\n cost+=e*min; printf(\"%d\", cost); }\n else if(e>f){\n int min=1000000; \n if(a<min)min=a; if(d<min)min=d; d-=min;\n cost=e*min; min=1000000; \n if(c<min) min=c;\n if(b<min)min=b;\n if(d<min)min=d; \n cost+=f*min; \n \n printf(\"%d\", cost); } \n \n \n \n \n //}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n \nvoid suitType1();\nvoid suitType2();\nint input[INPUT];\nint price = 0;\nint suits;\n \nint main(){\n \n for(int i =0; i<INPUT; i++){\n \n scanf(\"%i\", &input[i]);\n }\n suits = input[3];\n \n if(input[4]> input[5]){\n suitType1();\n suitType2();\n }\n else{\n suitType2();\n suitType1();\n }\n printf(\"%i\\n\", price);\n}\n \nvoid suitType1(){\n \n if(input[0]>0 && suits>0){\n \n if(input[0]> suits){\n \n price = price+(suits * input[4]);\n suits = 0;\n }\n else{\n price = price+(input[0]*input[4]);\n suits = suits - input[0];\n }\n }\n}\n \nvoid suitType2(){\n \n int max_type2=0;\n if(input[1]>0 && input[2]>0 && suits>0){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n \n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n \n if(max_type2> suits){\n price = price + suits * input[5];\n suits = 0;\n }\n else{\n price = price + max_type2 * input[5];\n suits = suits - max_type2;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint max1(long int x,long int y)\n{\n if(x>y)\n {\n return x ;\n\n }\n else\n {\n return y ;\n }\n \n}\nint min1(long int x,long int y)\n{\n if(x<y)\n return x ;\n else\n {\n return y ;\n }\n \n}\nint min(long int x,long int y,long int z)\n{\n if(x<=y && x<=z)\n return x ;\n else if(y<=z)\n return y ;\n else\n return z ;\n}\nint main()\n{\n long int a,b,c,d,e,f,cost1,cost2 ;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&a,&b,&c,&d,&e,&f) ;\n\n\n cost1 = min1(a,d)*e + min(b,c,d - min1(a,d))*f ;\n cost2 = min1(a,d - min(b,c,d))*e + min(b,c,d)*f ;\n \n\n printf(\"%ld\",max1(cost1,cost2)) ;\n\n return 0 ;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,s=0,min,min1;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(e>f)\n {\n min=(a<d)?a:d;\n s=s+min*e;\n d=d-min;\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n }\n else if(e<f)\n {\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n d=d-min1;\n min=(a<d)?a:d;\n s=s+min*e;\n\n }\n else if(e==f)\n {\n min=(a<d)?a:d;\n s=s+min*e;\n d=d-min;\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n }\n printf(\"%d\\n\",s);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long a,b,c,d,e,f,count=0;\n scanf(\"%li %li %li %li %li %li\",&a,&b,&c,&d,&e,&f);\n\n if(f>e){\n while(b>0 && c>0 && d>0){\n b--;\n c--;\n d--;\n count+=f;\n }\n while(a>0 && d>0){\n a--;\n d--;\n count+=e;\n }\n }else{\n while(a>0 && d>0){\n a--;\n d--;\n count+=e;\n }\n while(b>0 && c>0 && d>0){\n b--;\n c--;\n d--;\n count+=f;\n }\n }\n printf(\"%li\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int a,int b,int c){\n int min = a;\n if(min>b){\n min = b;\n }\n if(min > c){\n min = c;\n }\n return min;\n}int max(int a,int b,int c){\n int min = a;\n if(min<b){\n min = b;\n }\n if(min < c){\n min = c;\n }\n return min;\n}\nint main()\n{\n int a,b,c,d;\n int e,f;\n int sum1 = 0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n int sum2= 0,sum3=0,sum4=0;\n int x;\n int maxaandd = a,minanda = d;\n if(a < d){\n maxaandd = d;\n minanda = a;\n }\n int k, o;\n x = min(d,b,c);\n sum1+=x*f;\n k = d-x;\n if(a<k){\n sum1+=a*e;\n }else{\n sum1+=k*e;\n }\n sum2+= minanda*e;\n sum3+= minanda*e;\n o = d - minanda;\n if(x>o){\n sum3+=o*f;\n }else{\n sum3+=x*f;\n }\n int z;\n printf(\"%d\",max(sum1,sum2,sum3));\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void)\n{\n\tint a,b,c,d,e,f,i,h,sum=0;\n\twhile (scanf (\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f)!=EOF)\n\t{\n\t\tif (e>=f) \n\t\t{\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tsum=i*e+h*f;\n\t\tprintf (\"%d\\n\",sum);\n\t\th=0;\n\t\ti=0;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\nlong long int min(long long int a,long long int b)\n{\n if (a<b)\n return a;\n return b;\n}\nint main()\n{\n long long int a,b,c,d,e,f,cost;\n scanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n if(f>e)\n {\n if(b<=d||c<=d)\n {\n cost=min(b,c)*f;\n d-=min(b,c);\n if(d!=0&&a!=0)\n cost+=min(a,d)*e;\n }\n else if(d<c||d<b)\n {\n cost=d*f;\n }\n }\n else\n {\n if(a<=d)\n {\n cost=a*e;\n d-=a;\n if(d!=0)\n {\n cost+=min(d,min(b,c))*f;\n }\n }\n else if(d<a)\n {\n cost=d*e;\n }\n }\n printf(\"%lld\",cost);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n \nint min(long long a,long long b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long a,b,c,d,e;\n long long f;\n scanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n long long h=e*min(a,d);\n d-=min(a,d);\n long long j= min(b,min(c,d));\n long long g= h + f*j;\n printf(\"%lld\",g);\n }\n else\n {\n long long j=min(b,min(c,d));\n d-=j;\n long long g= e*min(a,d)+ f*j;\n printf(\"%lld\",g);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long min(long long x,long long y,long long z){\n\tif(x<=y && x<=z)\n\t\treturn x;\n\telse if(y<=x && y<=z)\n\t\treturn y;\n\telse\n\t\treturn z;\n}\nint main(){\n\tlong long a,b,c,d,e,f,t1,t2;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\n\tif(f>e){\n\t\tt2=min(b,c,d);\n\t\tt1=min((d-t2),a,100005);\n\t}\n\telse{\n\t\tt1=min(a,d,100005);\n\t\tt2=min((d-t1),b,c);\n\t}\n\tprintf(\"%lld\\n\",((t1*e)+t2*f));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define MIN(a, b) ((a) < (b)) ? (a) : (b)\n#define MINN(a, b, c) (MIN((a), (b))) < (c) ? (MIN((a), (b))) : (c)\n#define MAX(a, b) ((a) > (b)) ? (a) : (b)\n\n\nlong a, b, c, d, e, f;\n// costume type N:1 == a && d\n// costume type N:2 == b && c && d\n// e == price of costume N:1\n// f == price of costume N:2\n\nint maximum (int a, int b)\n{\n if (a > b)\n return a;\n else\n return b;\n}\n\nint minimum (int a, int b)\n{\n if (a < b)\n return a;\n else\n return b;\n}\n\nint main (void)\n{\n long n;\n int maxf, maxe;\n //printf (\"Enter your amount of stuff and prices: );\n scanf (\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n if (f > e)\n { n = f * maxf + e * minimum(maxe, (d - maxf)); }\n else\n { n = e * maxe + f * minimum((d - maxe), maxf); }\n printf (\"%ld\", n);\n exit (0);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) \n{\n\tint n,t,s,v,j,e,f,c1=0,c2=0,cost;\n\tscanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&e,&f);\n\tif(f>=e)\n\t{ (s>v)?(n=v):(n=s);\n\tif (j>=n)\n\t{ j-=n; c1=n*f; }\n\telse\n\t{ n=j; j-=n; c1=n*f; }\n\tif(j>=t)\n\t{ j-=t; c2=t*e; }\n\telse if(j!=0)\n\t{ n=j; c2=n*e; } }\n\telse if(e>f)\n\t{ (s>v)?(n=v):(n=s);\n\t if(j>=t)\n\t { j-=t; c1=t*e; }\n\t else \n\t { n=j; j-=n; c1=n*e; } \n\t if (j>=n)\n { j-=n; c2=n*f; }\n\t else if(j!=0)\n\t { n=j; c2=n*f; }\n\t}\n\tcost=c1+c2;\n\tprintf(\"%d\",cost);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define NUM_INPUT 6\n\nstruct Quantity{\n int a;\n int b;\n int c;\n int d;\n};\n\nstruct Value{\n int e;\n int f;\n};\n\nint get_most_valuable(struct Quantity *quant, struct Value *val){\n int result=0, least=0, least_x=0, least_y=0;\n\n least_x = quant->a < quant->d ? quant->a : quant->d;\n least_y = quant->b < quant->c ? quant->b : quant->c;\n least_y = least_y < quant->d ? least_y : quant->d;\n\n least = least_x < least_y ? least_x : least_y;\n if(least == quant->d)\n return val->e < val->f ? val->f * quant->d : val->e * quant->d;\n else if(least_x + least_y <= quant->d)\n return (least_x * val->e) + (least_y * val->f);\n else{\n if(val->e > val->f){\n result = val->e * least_x;\n least_y = least_y < quant->d - least_x ? least_y : quant->d - least_x;\n result += least_y * val->f;\n }\n else if(val->e < val->f){\n result = least_y * val->f;\n least_x = least_x < quant->d - least_y ? least_x : quant->d - least_y;\n result += val->e * least_x;\n }\n else\n result = quant->d * val->e;\n\n return result;\n }\n}\n\nint main(void){\n int input[NUM_INPUT] = {0};\n struct Quantity *quant;\n struct Value *val;\n\n for(int i=0; i<NUM_INPUT; i++)\n scanf(\"%d\", input+i);\n\n quant = (struct Quantity*) input;\n val = (struct Value*) (input + (sizeof(struct Quantity)/sizeof(int)));\n\n printf(\"%d\\n\", get_most_valuable(quant, val));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint min(int a,int b)\n{\n if(a>b)\n return b;\n return a;\n}\nint main()\n{\n int a,b,c,d,e,f,small=0,i,cost=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n if(f>e) {\n small=min(min(b,c),d);\n cost = f * small;\n d = d-small;\n\n if(d>0) {\n small = min(a,d);\n cost = cost + (e*small);\n }\n printf(\"%d\",cost);\n }\n else {\n small = min(a,d);\n cost = e * small;\n d = d-small;\n if(d>0) {\n small=min(min(b,c),d);\n cost = cost + (f*small);\n }\n printf(\"%d\",cost);\n }\n }\n\n "}, {"source_code": "#include <stdio.h>\n\n\nint main(int argc, char **argv)\n{\n unsigned long tie, scarf, vest, jacket;\n int suit_cost_jt, suit_cost_jsv, no_suit_jt = 0, no_suit_jsv = 0;\n // zero input protection or validation\n scanf(\"%lu\\n%lu\\n%lu\\n%lu\\n%d\\n%d\", &tie, &scarf, &vest, &jacket, &suit_cost_jt, &suit_cost_jsv);\n\n if ( jacket <= scarf && jacket <= vest ) {\n no_suit_jsv = jacket;\n jacket = 0;\n } else if ( scarf <= jacket && scarf <= vest) {\n no_suit_jsv = scarf;\n jacket -= scarf;\n } else {\n no_suit_jsv = vest;\n jacket -= vest;\n }\n\n if (tie > jacket) {\n no_suit_jt = jacket;\n tie -= jacket;\n } else {\n no_suit_jt = tie;\n tie = 0;\n }\n\n if (suit_cost_jt > suit_cost_jsv) {\n if (tie > no_suit_jsv)\n tie = no_suit_jsv % tie;\n no_suit_jsv -= tie;\n no_suit_jt += tie;\n }\n\n printf(\"%d\\n\", no_suit_jt * suit_cost_jt + no_suit_jsv * suit_cost_jsv);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define NUM_INPUT 6\n\nstruct Quantity{\n int a;\n int b;\n int c;\n int d;\n};\n\nstruct Value{\n int e;\n int f;\n};\n\nint get_most_valuable(struct Quantity *quant, struct Value *val){\n int result=0, least=0, least_x=0, least_y=0;\n\n least_x = quant->a < quant->d ? quant->a : quant->d;\n least_y = quant->b < quant->c ? quant->b : quant->c;\n least_y = least_y < quant->d ? least_y : quant->d;\n\n least = least_x < least_y ? least_x : least_y;\n if(least == quant->d)\n return val->e < val->f ? val->f * quant->d : val->e * quant->d;\n else if(least_x + least_y <= quant->d)\n return (least_x * val->e) + (least_y * val->f);\n else{\n if(val->e == val->f)\n result = quant->d * val->e;\n else if(val->e > val->f){\n result = val->e * least_x;\n least_y = least_y < quant->d - least_x ? least_y : quant->d - least_x;\n result += least_y * val->f;\n }\n else{\n result = least_y * val->f;\n least_x = least_x < quant->d - least_y ? least_x : quant->d - least_y;\n result += val->e * least_x;\n }\n return result;\n }\n}\n\nint main(void){\n int input[NUM_INPUT] = {0};\n struct Quantity *quant;\n struct Value *val;\n\n for(int i=0; i<NUM_INPUT; i++)\n scanf(\"%d\", input+i);\n\n quant = (struct Quantity*) input;\n val = (struct Value*) (input + 4);\n\n printf(\"%d\\n\", get_most_valuable(quant, val));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d;\n long long int e,f;\n long long int cost1=0,cost2=0;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&c,&d);\n scanf(\"%lld %lld\",&e,&f);\n int min=0;\n if(a>=d)\n {\n cost1=d*e;\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n cost2=b*f+(d-b)*e;\n else\n cost2=c*f+(d-c)*e;\n }\n }\n else\n {\n cost1=a*e;\n if((d-a)<=b && (d-a)<=c)\n cost1+=(d-a)*f;\n else\n {\n if(b<=c)\n cost1+=b*f;\n else\n cost1+=c*f;\n }\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n {\n cost2=b*f;\n if((d-b)<a)\n cost2+=(d-b)*e;\n else\n cost2+=a*e;\n }\n else\n {\n cost2=c*f;\n if((d-c)<a)\n cost2+=(d-c)*e;\n else\n cost2+=a*e;\n }\n }\n }\n if(cost1>cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a, b, c, d, e, f, p, q, m;\n\tp=0;\n\tq=0;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\", &a, &b, &c, &d, &e, &f);\n\t\n\tif(b<c){\n\t\tif(b<d){\n\t\t\tm=b;\n\t\t}\n\t\telse{\n\t\t\tm=d;\n\t\t}\n\t}\n\telse if(b<d){\n\t\tm=c;\n\t}\n\telse{\n\t\tif(c<d){\n\t\t\tm=c;\n\t\t}\n\t\telse{\n\t\t\tm=d;\n\t\t}\n\t}\n\t\n\tif(e>f)\n\t{\n\t\tif(a>=d)\n\t\t{\n\t\t\tp=d;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tp=a;\n\t\t\tif((d-a)<=m)\n\t\t\t{\n\t\t\t\tq=d-a;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tq=m;\n\t\t\t}\n\t\t}\n\t}\n\telse if(e<f)\n\t{\n\t\tif(d<=m)\n\t\t{\n\t\t\tq=d;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tq=m;\n\t\t\tif((d-m)<=a)\n\t\t\t{\n\t\t\t\tp=d-m;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp=a;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(m>=a)\n\t\t{\n\t\t\tif(m>=d)\n\t\t\t{\n\t\t\t\tq=d;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tq=m;\n\t\t\t\tif((d-m)<=a)\n\t\t\t\t{\n\t\t\t\t\tp=d-m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp=a;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a>=d)\n\t\t\t{\n\t\t\t\tp=d;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp=a;\n\t\t\t\tif((d-m)<=m)\n\t\t\t\t{\n\t\t\t\t\tq=d-m;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tq=m;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\", (e*p)+(f*q));\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a , b , c , d;\n\tint e,f ;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(a>=1&&a<=10^5&&b>=1&&b<=10^5&&c>=1&&c<=10^5&&d>=1&&d<=10^5&&\n\te>=1&&e<=10^3&&f>=1&&f<=10^3){\n\t\n\tif( e > f)\n\t{\n\t\tif(a >= d)\n\t\tprintf(\"%d\\n\",d*e);\n\t\telse\n\t\tprintf(\"%d\\n\",a*e + (((d-a)>(b>=c?c:b)?(b>=c?c:b):d-a))*f);\t\t\n\t}\n\telse\n\t{\n\t\tif( (b>=c?c:b) >= d)\n\t\tprintf(\"%d\\n\",d*f);\n\t\telse\n\t\tprintf(\"%d\\n\",(b>=c?c:b)*f+((d-(b>=c?c:b))>=a?a:(d-(b>=c?c:b)))*e);\n\t}}\n\telse\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f;\n\tscanf(\"%d%d%d%d%d%d\",&a,&d,&c,&b,&e,&f);\n\tint s1=0,s2=0,k,k1;\n\tif(f>e)\n\t{\n\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\ts2+=k*f;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(a<b?a:b);\n\t\t\ts2+=k*e;\n\t\t}\n\t\tk1=s2;\n\t}\n\telse if(e>f)\n\t{\n\t\tk=(a<b?a:b);\n\t\ts1+=k*e;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\t\ts1+=k*f;\n\t\t}\n\t\tk1=s1;\n\t}\n\telse\n\t{\n k=(b<c?(b<d?b:d):(c<d?c:d));\n\tk1=k*e;\n\tb-=k;\n\tif(b!=0)\n\t{\n\tk=(a<b?a:b);\n\tk1+=k*e;\n }\n }\n\tprintf(\"%d\\n\",k1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x,y) ((x) < (y) ? (x) : (y))\n#define MAX(x,y) ((x) > (y) ? (x) : (y))\n\nint max_cost(int a, int b, int c, int d, int e, int f) {\n int e1 = 0, f1 = 0, e2 = 0, f2 = 0;\n int cost1 = 0, cost2 = 0;\n\n e1 = (d < a) ? d : a;\n f1 = (d < a) ? 0 : ((d - a) <= MIN(b,c) ? (d - a) : MIN(b,c));\n\n f2 = (d < MIN(b,c)) ? d : MIN(b,c);\n e2 = (d < MIN(b,c)) ? 0 : ( (d - MIN(b,c)) <= a ? (d - MIN(b,c)) : a);\n\n cost1 = (e1 * e) + (f1 * f);\n cost2 = (e2 * e) + (f2 * f);\n\n return MAX(cost1, cost2);\n}\n\nint main() {\n int a = 0;\n int b = 0;\n int c = 0;\n int d = 0;\n int e = 0;\n int f = 0;\n\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\\n%d\",\n &a, &b, &c, &d, &e, &f);\n\n printf(\"%d\\n\", max_cost(a, b, c, d, e, f));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long a,b,c,d,e,f,sum=0;\n\tint n,m,j,k,l,i;\n\tscanf(\"%lld\",&a);\n\tscanf(\"%lld\",&b);\n\tscanf(\"%lld\",&c);\n\tscanf(\"%lld\",&d);\n\tscanf(\"%lld\",&e);\n\tscanf(\"%lld\",&f);\n\tif(e>f){\n\t\tif(a>d) {sum+=e*d;a-=d;d=0;}\n\t\telse {sum+=e*a;d-=a;a=0;}\n\t} \n\telse{\n\t\tif(d>=b&&c>=b) {sum+=f*b;c-=b;d-=b;b=0;}\n\t\telse if(d>=c&&b>=c) {sum+=f*c;b-=c;d-=c;c=0;}\n\t\telse {sum+=f*d;c-=d;b-=d;d=0;}\n\t}\n\twhile((d!=0)&&((a!=0)||(b!=0&&c!=0))){\n\t\tif(a!=0) {if(a>=d) {sum+=e*d;d=0;a-=d;} else{sum+=e*a;a=0;d-=a;}}\n\t\tif(d==0) break;\n\t\tif(b!=0&&c!=0) {if(d>=b&&c>=b) {sum+=f*b;c-=b;d-=b;b=0;}\n\t\telse if(d>=c&&b>=c) {sum+=f*c;b-=c;d-=c;c=0;}\n\t\telse {sum+=f*d;c-=d;b-=d;d=0;}\n\t\t}\n\t} \n\tprintf(\"%lld\\n\",sum);\n\treturn 0; \n } \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,d,e,f,r,s,cost=0;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e<f)\n {\n if((b<c)&&(b<d))\n r=b;\n else if(c<d)\n r=c;\n else\n r=d;\n cost=(r*f);\n d-=r;\n if(d!=0)\n { \n if(a<d)\n s=a;\n else\n s=d; \n cost+=(s*e);\n } \n }\n else\n {\n if(a<d)\n r=a;\n else\n r=d;\n cost=r*e;\n d-=r;\n if(d!=0)\n {\n if((b<c)&&(b<d))\n s=b;\n else if(c<d)\n s=c;\n else\n s=d;\n cost+=(s*f);\n }\n }\n \n printf(\"%d\",cost);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n \nvoid suitType1();\nvoid suitType2();\nint input[INPUT];\nint price = 0;\nint suits;\n \nint main(){\n \n for(int i =0; i<INPUT; i++){\n \n scanf(\"%i\", &input[i]);\n }\n suits = input[3];\n \n if(input[4]> input[5]){\n suitType1();\n suitType2();\n }\n else{\n suitType2();\n suitType1();\n }\n printf(\"%i\\n\", price);\n}\n \nvoid suitType1(){\n \n if(input[0]>0 && suits>0){\n \n if(input[0]> suits){\n \n price = price+(suits * input[4]);\n suits = 0;\n }\n else{\n price = price+(input[0]*input[4]);\n suits = suits - input[0];\n }\n }\n}\n \nvoid suitType2(){\n \n int max_type2=0;\n if(input[1]>0 && input[2]>0 && suits>0){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n \n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n \n if(max_type2> suits){\n price = price + suits * input[5];\n suits = 0;\n }\n else{\n price = price + max_type2 * input[5];\n suits = suits - max_type2;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\nlong a,b,c,d,e,f,maxf,maxe,n;\nlong min (long a, long b)\n{\n if (a > b) return b; else return a; \n}\nint main()\n{\n scanf(\"%ld\", &a);\n scanf(\"%ld\", &b);\n scanf(\"%ld\", &c);\n scanf(\"%ld\", &d);\n scanf(\"%ld\", &e);\n scanf(\"%ld\", &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n \n if (f > e) n = f *maxf + e * min (maxe, (d - maxf));\n else n = e *maxe + f * min((d - maxe), maxf);\n printf(\"%ld\", n);\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint smallest(int a, int b, int c)\n{\n if(a<=b && a<=c) return a;\n if(b<=a && b<=c) return b;\n else return c;\n}\nmain()\n{\n int a,b,c,d,e,f,k,r;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if(f>e) {\n k=smallest(b,c,d);\n d=d-k;\n if(a>=d) printf(\"%d\", e*d+f*k);\n else if(a<d) printf(\"%d\", e*a+f*k);\n }\n else {\n if(a>=d) printf(\"%d\", d*e);\n else {\n d=d-a;\n k=smallest(b,c,d);\n printf(\"%d\", a*e+k*f);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,g,h;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>=f)\n {\n if(a>=d)\n {\n printf(\"%d\",(d*e));\n }\n else\n {\n g=a*e;\n d=d-a;\n if(b<=c&&b<=d)\n {\n printf(\"%d\",g+(b*f));\n }\n else if(c<=b&&c<=d)\n {\n printf(\"%d\",g+(c*f));\n }\n else\n {\n printf(\"%d\",g+(d*f));\n }\n }\n }\n else\n {\n if(b<=c&&b<=d)\n {\n g=b*f;\n d=d-b;\n if(a>=d)\n {\n printf(\"%d\",g+(d*e));\n }\n else\n {\n printf(\"%d\",g+(a*e));\n }\n }\n else if(c<=b&&c<=d)\n {\n g=c*f;\n d=d-c;\n if(a>=d)\n {\n printf(\"%d\",g+(d*e));\n }\n else\n {\n printf(\"%d\",g+(a*e));\n }\n }\n else\n {\n g=d*f;\n printf(\"%d\",g);\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint smaller (int a,int b,int c)\n{\n int temp=0;\n if(a<=b&&a<=c)\n temp=a;\n else if(b<=c&&b<=a )\n temp=b;\n else if(c<=a&&c<=b)\n temp=c;\n return temp;\n};\nint func1(int a,int b,int c,int d,int e,int f)\n{\n int cost1,cost2;\n if(a<d)\n {cost1=a*e;\n d=d-a;}\n else\n {\n cost1=d*e;\n d=0;\n }\n cost2=(smaller(b,c,d))*f;\n // printf(\"%d %d\\n\",cost1,cost2);\n\n return (cost1+cost2);\n\n};\nint func2(int a,int b, int c ,int d, int e,int f)\n{\n int t=smaller(b,c,d);\n int cost1,cost2=f*t;\n d=d-t;\n if(a<d)\n {\n cost1=a*e;\n }\n else\n cost1=d*e;\n\n int cost3=cost1+cost2;\n //printf(\"%d %d \\n\",cost1,cost2);\n return cost3;\n\n\n\n};\nint main()\n{\n int a,b,c,d,e,f,cost1,cost2;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n int t=func1(a,b,c,d,e,f);\n int s=func2(a,b,c,d,e,f);\n if(t<s)\n printf(\"%d\",s);\n else\n printf(\"%d\",t);\n return 0;\n\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nlong long min(long long x,long long y,long long z){\n\tif(x<=y && x<=z)\n\t\treturn x;\n\telse if(y<=x && y<=z)\n\t\treturn y;\n\telse\n\t\treturn z;\n}\nint main(){\n\tlong long a,b,c,d,e,f,t1,t2;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\n\tif(f>e){\n\t\tt2=min(b,c,d);\n\t\tt1=min((d-t2),a,100005);\n\t}\n\telse{\n\t\tt1=min(a,d,100005);\n\t\tt2=min((d-t1),b,c);\n\t}\n\tprintf(\"%lld\\n\",((t1*e)+t2*f));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\tif(a > b)\n\t\treturn b;\n\telse\n\t\treturn a;\n\n\n}\nint max(int a,int b)\n{\n if(a > b)\n return a;\n else\n return b;\n\n\n}\n\n\nint main()\n{\n\tint a,b,c,d,e,f;\n\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n\tint p = min(a,d);\n\tint mn = min(b,c);\n\tint q = min(mn,d);\n\n\tmn = max(e*p,f*q);\n\n\tif( f > e)\n\t{\n\t\tif(p + q <= d)\n\t\t{\n\t\t\tmn = max(mn, e*p + f*q);\n\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\twhile( q > 0)\n\t\t\t{\n\t\t\t\tif( q < d && d < p + q)\n\t\t\t\t{\n\t\t\t\t\tp = d-q;\n\t\t\t\t\tmn = max(mn, e*p + f*q); \n\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tq--;\n\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t}\n\t\n\t\n\t}\n\n\telse\n\t{\n\tif(p + q <= d)\n {\n mn = max(mn, e*p + f*q);\n\n }\n\n else\n {\n while( p > 0)\n {\n if( p < d && d < p+q)\n {\n q = d-p;\n mn = max(mn, e*p + f*q);\n\n }\n\n p--;\n\n\n }\n\n\n }\n\n\n\t\n\t}\n\tprintf(\"%d\",mn);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d;\n long long int e,f;\n long long int cost1=0,cost2=0;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&c,&d);\n scanf(\"%lld %lld\",&e,&f);\n int min=0;\n if(a>=d)\n {\n cost1=d*e;\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n cost2=b*f+(d-b)*e;\n else\n cost2=c*f+(d-c)*e;\n }\n }\n else\n {\n cost1=a*e;\n if((d-a)<=b && (d-a)<=c)\n cost1+=(d-a)*f;\n else\n {\n if(b<=c)\n cost1+=b*f;\n else\n cost1+=c*f;\n }\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n {\n cost2=b*f;\n if((d-b)<a)\n cost2+=(d-b)*e;\n else\n cost2+=a*e;\n }\n else\n {\n cost2=c*f;\n if((d-c)<a)\n cost2+=(d-c)*e;\n else\n cost2+=a*e;\n }\n }\n }\n if(cost1>cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost <= suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (remainder * suit1Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (clothes[0] * suit1Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = smallest * suit2Cost;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal += remainder * suit1Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += clothes[0] * suit1Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\t\tif (remainder <= smallest) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long a,b,c,d,e,f,count=0;\n scanf(\"%li %li %li %li %li %li\",&a,&b,&c,&d,&e,&f);\n\n if(f>e){\n while(b>0 && c>0 && d>0){\n b--;\n c--;\n d--;\n count+=f;\n }\n while(a>0 && d>0){\n a--;\n d--;\n count+=e;\n }\n }else{\n while(a>0 && d>0){\n a--;\n d--;\n count+=e;\n }\n while(b>0 && c>0 && d>0){\n b--;\n c--;\n d--;\n count+=f;\n }\n }\n printf(\"%li\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nunsigned int min(unsigned int a,unsigned int b) {\n if(a<b)\n return a;\n else \n return b;\n}\nint main() {\n unsigned int a,b,c,d,e,f,cost,m;\n scanf(\"%u %u %u %u %u %u\",&a,&b,&c,&d,&e,&f);\n if ( f>e ) {\n m=min(min(b,c),d);\n cost=m*f+min(a,d-m)*e;\n printf(\"%u\",cost);\n }\n else {\n m=min(a,d);\n cost=m*e+min(min(b,c),d-m)*f;\n printf(\"%u\",cost);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d;\n long long int e,f;\n long long int cost1=0,cost2=0;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&c,&d);\n scanf(\"%lld %lld\",&e,&f);\n int min=0;\n if(a>=d)\n {\n cost1=d*e;\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n cost2=b*f+(d-b)*e;\n else\n cost2=c*f+(d-c)*e;\n }\n }\n else\n {\n cost1=a*e;\n if((d-a)<=b && (d-a)<=c)\n cost1+=(d-a)*f;\n else\n {\n if(b<=c)\n cost1+=b*f;\n else\n cost1+=c*f;\n }\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n {\n cost2=b*f;\n if((d-b)<a)\n cost2+=(d-b)*e;\n else\n cost2+=a*e;\n }\n else\n {\n cost2=c*f;\n if((d-c)<a)\n cost2+=(d-c)*e;\n else\n cost2+=a*e;\n }\n }\n }\n if(cost1>cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n \nvoid suitType1();\nvoid suitType2();\nint input[INPUT];\nint price = 0;\nint suits;\n \nint main(){\n \n for(int i =0; i<INPUT; i++){\n \n scanf(\"%i\", &input[i]);\n }\n suits = input[3];\n \n if(input[4]> input[5]){\n suitType1();\n suitType2();\n }\n else{\n suitType2();\n suitType1();\n }\n printf(\"%i\\n\", price);\n}\n \nvoid suitType1(){\n \n if(input[0]>0 && suits>0){\n \n if(input[0]> suits){\n \n price = price+(suits * input[4]);\n suits = 0;\n }\n else{\n price = price+(input[0]*input[4]);\n suits = suits - input[0];\n }\n }\n}\n \nvoid suitType2(){\n \n int max_type2=0;\n if(input[1]>0 && input[2]>0 && suits>0){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n \n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n \n if(max_type2> suits){\n price = price + suits * input[5];\n suits = 0;\n }\n else{\n price = price + max_type2 * input[5];\n suits = suits - max_type2;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\tif(a > b)\n\t\treturn b;\n\telse\n\t\treturn a;\n\n\n}\nint max(int a,int b)\n{\n if(a > b)\n return a;\n else\n return b;\n\n\n}\n\n\nint main()\n{\n\tint a,b,c,d,e,f;\n\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n\tint p = min(a,d);\n\tint mn = min(b,c);\n\tint q = min(mn,d);\n\n\tmn = max(e*p,f*q);\n\n\tif( f > e)\n\t{\n\t\tif(p + q <= d)\n\t\t{\n\t\t\tmn = max(mn, e*p + f*q);\n\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\twhile( q > 0)\n\t\t\t{\n\t\t\t\tif( q < d && d < p + q)\n\t\t\t\t{\n\t\t\t\t\tp = d-q;\n\t\t\t\t\tmn = max(mn, e*p + f*q); \n\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tq--;\n\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t}\n\t\n\t\n\t}\n\n\telse\n\t{\n\tif(p + q <= d)\n {\n mn = max(mn, e*p + f*q);\n\n }\n\n else\n {\n while( p > 0)\n {\n if( p < d && d < p+q)\n {\n q = d-p;\n mn = max(mn, e*p + f*q);\n\n }\n\n p--;\n\n\n }\n\n\n }\n\n\n\t\n\t}\n\tprintf(\"%d\",mn);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint smaller (int a,int b,int c)\n{\n int temp=0;\n if(a<=b&&a<=c)\n temp=a;\n else if(b<=c&&b<=a )\n temp=b;\n else if(c<=a&&c<=b)\n temp=c;\n return temp;\n};\nint func1(int a,int b,int c,int d,int e,int f)\n{\n int cost1,cost2;\n if(a<d)\n {cost1=a*e;\n d=d-a;}\n else\n {\n cost1=d*e;\n d=0;\n }\n cost2=(smaller(b,c,d))*f;\n // printf(\"%d %d\\n\",cost1,cost2);\n\n return (cost1+cost2);\n\n};\nint func2(int a,int b, int c ,int d, int e,int f)\n{\n int t=smaller(b,c,d);\n int cost1,cost2=f*t;\n d=d-t;\n if(a<d)\n {\n cost1=a*e;\n }\n else\n cost1=d*e;\n\n int cost3=cost1+cost2;\n //printf(\"%d %d \\n\",cost1,cost2);\n return cost3;\n\n\n\n};\nint main()\n{\n int a,b,c,d,e,f,cost1,cost2;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n int t=func1(a,b,c,d,e,f);\n int s=func2(a,b,c,d,e,f);\n if(t<s)\n printf(\"%d\",s);\n else\n printf(\"%d\",t);\n return 0;\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\nlong long int min(long long int a,long long int b)\n{\n if (a<b)\n return a;\n return b;\n}\nint main()\n{\n long long int a,b,c,d,e,f,cost;\n scanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n if(f>e)\n {\n if(b<=d||c<=d)\n {\n cost=min(b,c)*f;\n d-=min(b,c);\n if(d!=0&&a!=0)\n cost+=min(a,d)*e;\n }\n else if(d<c||d<b)\n {\n cost=d*f;\n }\n }\n else\n {\n if(a<=d)\n {\n cost=a*e;\n d-=a;\n if(d!=0)\n {\n cost+=min(d,min(b,c))*f;\n }\n }\n else if(d<a)\n {\n cost=d*e;\n }\n }\n printf(\"%lld\",cost);\n}\n"}, {"source_code": "#include<stdio.h>\nlong long min(long long a,long long b,long long c)\n{\nif(a<b)\n{\nif(a<c)\nreturn a;\nelse\nreturn c;\n}\nelse\n{\nif(b<c)\nreturn b;\nelse\nreturn c;\n}\n}\nint main()\n{\n long long a, b, c, d, e, f,y;\n long long cost=0;\n scanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a>=d)\n cost=d*e;\n else\n {\n cost=a*e;\n d-=a;\n \n y=min(b,c,d);\n cost+=y*f;\n }}\n else\n {\n y=min(b,c,d);\n cost=y*f;\n d-=y;\n if(d>=a)\n cost+=a*e;\n else\n cost+=d*e;\n }\n printf(\"%lld\",cost);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f;\n\tscanf(\"%d%d%d%d%d%d\",&a,&d,&c,&b,&e,&f);\n\tint s1=0,s2=0,k,k1;\n\tif(f>e)\n\t{\n\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\ts2+=k*f;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(a<b?a:b);\n\t\t\ts2+=k*e;\n\t\t}\n\t\tk1=s2;\n\t}\n\telse if(e>f)\n\t{\n\t\tk=(a<b?a:b);\n\t\ts1+=k*e;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\t\ts1+=k*f;\n\t\t}\n\t\tk1=s1;\n\t}\n\telse\n\t{\n k=(b<c?(b<d?b:d):(c<d?c:d));\n\tk1=k*e;\n\tb-=k;\n\tif(b!=0)\n\t{\n\tk=(a<b?a:b);\n\tk1+=k*e;\n }\n }\n\tprintf(\"%d\\n\",k1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint max1(long int x,long int y)\n{\n if(x>y)\n {\n return x ;\n\n }\n else\n {\n return y ;\n }\n \n}\nint min1(long int x,long int y)\n{\n if(x<y)\n return x ;\n else\n {\n return y ;\n }\n \n}\nint min(long int x,long int y,long int z)\n{\n if(x<=y && x<=z)\n return x ;\n else if(y<=z)\n return y ;\n else\n return z ;\n}\nint main()\n{\n long int a,b,c,d,e,f,cost1,cost2 ;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&a,&b,&c,&d,&e,&f) ;\n\n\n cost1 = min1(a,d)*e + min(b,c,d - min1(a,d))*f ;\n cost2 = min1(a,d - min(b,c,d))*e + min(b,c,d)*f ;\n \n\n printf(\"%ld\",max1(cost1,cost2)) ;\n\n return 0 ;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main ()\n{\n\tint a,b,c,d,e,f,somme=0;\n\tscanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\t\n\tif(f>e)\n\t{\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t}\n\tif(e>f)\n\t{\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t}\n\tif(e==f)\n\t{\n\t\tif(a>b||a>c)\n\t\t{\n\t\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\n\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\t\t\n\t\t}\t\n\t\tif(b>=a&&c>=a)\n\t\t{\n\t\t\twhile(d!=0&&b!=0&&c!=0)\n\t\t{\n\t\t\tsomme=somme+f;\n\t\t\td--;\n\t\t\tc--;\n\t\t\tb--;\n\t\t}\n\t\twhile(d!=0&&a!=0)\n\t\t{\n\t\t\tsomme=somme+e;\n\t\t\td--;\n\t\t\ta--;\n\t\t}\t\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"%d\",somme);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,s=0,min,min1;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(e>f)\n {\n min=(a<d)?a:d;\n s=s+min*e;\n d=d-min;\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n }\n else if(e<f)\n {\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n d=d-min1;\n min=(a<d)?a:d;\n s=s+min*e;\n\n }\n else if(e==f)\n {\n min=(a<d)?a:d;\n s=s+min*e;\n d=d-min;\n min1=(b<c)?((b<d)?b:d):((c<d)?c:d);\n s=s+min1*f;\n }\n printf(\"%d\\n\",s);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int tie, scarve, vest, jacket, suit1, suit2, cost = 0;\n\n scanf(\"%d %d %d %d %d %d\", &tie, &scarve, &vest, &jacket, &suit1, &suit2);\n\n if(suit1 >= suit2) {\n if(jacket >= tie) {\n jacket -= tie;\n cost += tie * suit1;\n }\n else {\n cost += jacket * suit1;\n jacket = 0;\n }\n if(jacket != 0) {\n if(jacket <= scarve && jacket <= vest) {\n cost += jacket * suit2;\n }\n else if(scarve <= jacket && scarve <= vest) {\n cost += scarve * suit2;\n }\n else {\n cost += vest * suit2;\n }\n }\n }\n else if(suit1 < suit2){\n if(jacket <= scarve && jacket <= vest) {\n cost += jacket * suit2;\n jacket = 0;\n }\n else if(scarve <= jacket && scarve <= vest) {\n cost += scarve * suit2;\n jacket -= scarve;\n }\n else {\n cost += vest * suit2;\n jacket -= vest;\n }\n if(jacket != 0 && tie != 0) {\n if(jacket >= tie) {\n cost += tie * suit1;\n }\n else {\n cost += jacket * suit1;\n }\n }\n }\n printf(\"%d\\n\", cost);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long a,b,c,d,e,f,min2,min1;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\nif(e < f)\n{\n\tif(b <= c && b <= d)\n\t{\n\t\tmin2 = b;\n\t}\n\telse if(c <= d && c <= b)\n\t{\n\t\tmin2 = c;\n\t}\n\telse{\n\t\tmin2 = d;\n\t}\n\td -= min2;\n\t\n\tmin1 = (a < d) ? a : d;\n\tif(min1 < 0)\n\t{\n\t\tmin1 *= -1;\n\t}\n\n\tmin2 *= f;\n\tmin1 *= e;\n\tprintf(\"%lld\",min1+min2);\n}\nelse{\n\tif(a <= d)\n\t{\n\t\tmin1 = a;\n\t}\n\telse{\n\t\tmin1 = d;\n\t}\n\td -= min1;\n\tif(b <= c && b <= d)\n\t{\n\t\tmin2 = b;\n\t}\n\telse if(c <= b && c <= d)\n\t{\n\t\tmin2 = c;\n\t}\n\telse{\n\t\tmin2 = d;\n\t}\n\tmin1 *= e;\n\tmin2 *= f;\n\tprintf(\"%lld\\n\",min1+min2);\n}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min, res;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n if (e == f)\n {\n if (a >= d) res = d * e;\n else \n {\n res = a * e;\n d = d - a;\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = res + min * f;\n }\n printf (\"%d\", res);\n }\n if (e < f)\n {\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = min * f;\n d = d - min;\n if (d < a) res = res + d*e; else res = res + e*a;\n printf (\"%d\", res);\n }\n if (e > f)\n {\n \n if (d < a) {res = d*e; d =0;} else {res = e*a; d = d-a;}\n if (b < c) min = b; else min = c;\n if (min > d) min = d;\n res = res + min * f;\n printf (\"%d\", res);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main(int argc, char **argv)\n{\n unsigned long tie, scarf, vest, jacket;\n unsigned int suit_cost_jt, suit_cost_jsv, no_suit_jt = 0, no_suit_jsv = 0;\n // zero input protection or validation\n scanf(\"%lu\\n%lu\\n%lu\\n%lu\\n%d\\n%d\", &tie, &scarf, &vest, &jacket, &suit_cost_jt, &suit_cost_jsv);\n\n if ( jacket <= scarf && jacket <= vest ) {\n no_suit_jsv = jacket;\n jacket = 0;\n } else if ( scarf <= jacket && scarf <= vest) {\n no_suit_jsv = scarf;\n jacket -= scarf;\n } else {\n no_suit_jsv = vest;\n jacket -= vest;\n }\n\n if (tie > jacket) {\n no_suit_jt = jacket;\n tie -= jacket;\n } else {\n no_suit_jt = tie;\n tie = 0;\n }\n\n for(;suit_cost_jt > suit_cost_jsv && tie && no_suit_jsv; no_suit_jsv--, tie--, no_suit_jt++);\n\n printf(\"%d\\n\", no_suit_jt * suit_cost_jt + no_suit_jsv * suit_cost_jsv);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n \nvoid suitType1();\nvoid suitType2();\nint input[INPUT];\nint price = 0;\nint suits;\n \nint main(){\n \n for(int i =0; i<INPUT; i++){\n \n scanf(\"%i\", &input[i]);\n }\n suits = input[3];\n \n if(input[4]> input[5]){\n suitType1();\n suitType2();\n }\n else{\n suitType2();\n suitType1();\n }\n printf(\"%i\\n\", price);\n}\n \nvoid suitType1(){\n \n if(input[0]>0 && suits>0){\n \n if(input[0]> suits){\n \n price = price+(suits * input[4]);\n suits = 0;\n }\n else{\n price = price+(input[0]*input[4]);\n suits = suits - input[0];\n }\n }\n}\n \nvoid suitType2(){\n \n int max_type2=0;\n if(input[1]>0 && input[2]>0 && suits>0){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n \n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n \n if(max_type2> suits){\n price = price + suits * input[5];\n suits = 0;\n }\n else{\n price = price + max_type2 * input[5];\n suits = suits - max_type2;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main (void)\n{\n\tint a,b,c,d,e,f,i,h,sum=0;\n\twhile (scanf (\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f)!=EOF)\n\t{\n\t\tif (e>=f) \n\t\t{\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfor (;b>0&&c>0&&d>0;b--,c--,d--)\n\t\t\t{\n\t\t\t\th++;\n\t\t\t}\n\t\t\tfor (;a>0&&d>0;a--,d--)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tsum=i*e+h*f;\n\t\tprintf (\"%d\\n\",sum);\n\t\th=0;\n\t\ti=0;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,sum=0,min;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(f>e)\n {\n if(b<=c && b<=d)\n min=b;\n if(c<=b && c<=d)\n min=c;\n if(d<=b && d<=c)\n min=d;\n sum=(min)*f;\n d=d-min;\n if(a<=d)\n min=a;\n else\n min=d;\n sum+=(min)*e;\n }\n else\n { \n if(a<=d)\n min=a;\n else\n min=d;\n sum+=(min)*e;\n d=d-min;\n if(b<=c && b<=d)\n min=b;\n if(c<=b && c<=d)\n min=c;\n if(d<=b && d<=c)\n min=d;\n sum+=(min)*f;\n \n \n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int tie, scarve, vest, jacket, suit1, suit2, cost = 0;\n\n scanf(\"%d %d %d %d %d %d\", &tie, &scarve, &vest, &jacket, &suit1, &suit2);\n\n if(suit1 >= suit2) {\n if(jacket >= tie) {\n jacket -= tie;\n cost += tie * suit1;\n }\n else {\n cost += jacket * suit1;\n jacket = 0;\n }\n if(jacket != 0) {\n if(jacket <= scarve && jacket <= vest) {\n cost += jacket * suit2;\n }\n else if(scarve <= jacket && scarve <= vest) {\n cost += scarve * suit2;\n }\n else {\n cost += vest * suit2;\n }\n }\n }\n else if(suit1 < suit2){\n if(jacket <= scarve && jacket <= vest) {\n cost += jacket * suit2;\n jacket = 0;\n }\n else if(scarve <= jacket && scarve <= vest) {\n cost += scarve * suit2;\n jacket -= scarve;\n }\n else {\n cost += vest * suit2;\n jacket -= vest;\n }\n if(jacket != 0 && tie != 0) {\n if(jacket >= tie) {\n cost += tie * suit1;\n }\n else {\n cost += jacket * suit1;\n }\n }\n }\n printf(\"%d\\n\", cost);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{ int a,b,c,d,e,f,min,p;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\n if(e>f)\n {\n if(a>d)\n p=d*e;\n else\n {\n d=d-a;\n min=b<c?(b<d?b:c):(c<d?c:d);\n if(d>min)\n p=a*e+min*f;\n else\n p=a*e+d*f;\n }\n\n }\n else\n {min=b<c?(b<d?b:d):(c<d?c:d);\n if(min>d)\n p=d*f;\n else\n {\n d=d-min;\n if(a>d)\n p=min*f+d*e;\n else\n p=min*f+a*e;\n }\n\n }printf(\"%d\",p);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<=f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int a,int b,int c){\n int min = a;\n if(min>b){\n min = b;\n }\n if(min > c){\n min = c;\n }\n return min;\n}int max(int a,int b,int c){\n int min = a;\n if(min<b){\n min = b;\n }\n if(min < c){\n min = c;\n }\n return min;\n}\nint main()\n{\n int a,b,c,d;\n int e,f;\n int sum1 = 0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n int sum2= 0,sum3=0,sum4=0;\n int x;\n int maxaandd = a,minanda = d;\n if(a < d){\n maxaandd = d;\n minanda = a;\n }\n int k, o;\n x = min(d,b,c);\n sum1+=x*f;\n k = d-x;\n if(a<k){\n sum1+=a*e;\n }else{\n sum1+=k*e;\n }\n sum2+= minanda*e;\n sum3+= minanda*e;\n o = d - minanda;\n if(x>o){\n sum3+=o*f;\n }else{\n sum3+=x*f;\n }\n int z;\n printf(\"%d\",max(sum1,sum2,sum3));\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,sum=0,x;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(f>=e)\n {\n if(c>=b && d>=b)\n {\n sum=sum+(b*f);\n if(d-b>=a)\n {\n sum=sum+(a*e);\n }\n else if(d-b<=a)\n {\n sum=sum+((d-b)*e);\n }\n }\n else if(b>=c && d>=c)\n {\n sum=sum+(c*f);\n if(d-c>=a)\n {\n sum=sum+(a*e);\n }\n else if(d-c<=a)\n {\n sum=sum+((d-c)*e);\n }\n }\n else if(c>=d && b>=d)\n {\n sum=sum+(d*f);\n }\n }\n else if(f<e)\n {\n if(a>=d)\n {\n sum=sum+(d*e);\n }\n else if(a<=d)\n {\n sum=sum+(a*e);\n x=d-a;\n if(b>=x && c>=x)\n {\n sum=sum+(x*f);\n }\n else if(x>=b && c>=b)\n {\n sum=sum+(b*f);\n }\n else if(x>=c && b>=c)\n {\n sum=sum+(c*f);\n }\n }\n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include <stdio.h>\nlong a,b,c,d,e,f,maxf,maxe,n;\nlong min (long a, long b)\n{\n if (a > b) return b; else return a; \n}\nint main()\n{\n scanf(\"%ld\", &a);\n scanf(\"%ld\", &b);\n scanf(\"%ld\", &c);\n scanf(\"%ld\", &d);\n scanf(\"%ld\", &e);\n scanf(\"%ld\", &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n \n if (f > e) n = f *maxf + e * min (maxe, (d - maxf));\n else n = e *maxe + f * min((d - maxe), maxf);\n printf(\"%ld\", n);\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdarg.h>\n\n\nstatic int totalCost=0;\n\nint getMin(int, ...);\nvoid updateTotalCost(int,int);\n\nint main()\n{\n\n int tie,scarf,vest,jackets,costType1,costType2;\n int dF1,dF2, tempCost, remain;\n\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\\n%d\",&tie,&scarf,&vest,&jackets,&costType1,&costType2);\n\n int type = (costType1 > costType2)?0:1;\n\n// printf(\"Printing type %d\\n \", type);\n switch(type)\n {\n case 0:\n dF1 = getMin(2,tie,jackets);\n tempCost=costType1;\n break;\n\n case 1:\n dF1 = getMin(3,scarf,vest,jackets);\n tempCost=costType2;\n break;\n }\n\n// printf(\"Decision Factor 1 %d\\n TempCost %d\\n\",dF1, tempCost);\n updateTotalCost(dF1,tempCost);\n remain = abs(jackets-dF1);\n if(remain)\n {\n (type==0)? (dF2 = getMin(3,scarf,vest,remain) , tempCost = costType2)\n : (dF2 = getMin(2,tie,remain), tempCost = costType1);\n\n// printf(\"Decision Factor 2 %d\\n tempCost %d\\n\",dF2, tempCost);\n updateTotalCost(dF2,tempCost);\n }\n printf(\"%d\\n\",totalCost);\n\n}\nint getMin(int numOfargs, ...)\n{\n int minRes, each;\n va_list ap;\n\n va_start(ap,numOfargs);\n\n minRes = va_arg(ap,int);\n\n for( int i=2; i<=numOfargs; i++)\n {\n if ( (each = va_arg(ap,int)) < minRes)\n {\n minRes = each;\n }\n }\n\n va_end(ap);\n\n return minRes;\n}\n\n\nvoid updateTotalCost(int decisionFactor, int cost)\n{\n\n totalCost = totalCost+(decisionFactor * cost);\n\n}\n\n "}, {"source_code": "#include <stdio.h>\nlong a,b,c,d,e,f,maxf,maxe,n;\nlong min (long a, long b)\n{\n if (a > b) return b; else return a; \n}\nint main()\n{\n scanf(\"%ld\", &a);\n scanf(\"%ld\", &b);\n scanf(\"%ld\", &c);\n scanf(\"%ld\", &d);\n scanf(\"%ld\", &e);\n scanf(\"%ld\", &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n \n if (f > e) n = f *maxf + e * min (maxe, (d - maxf));\n else n = e *maxe + f * min((d - maxe), maxf);\n printf(\"%ld\", n);\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long min(long long x,long long y,long long z){\n\tif(x<=y && x<=z)\n\t\treturn x;\n\telse if(y<=x && y<=z)\n\t\treturn y;\n\telse\n\t\treturn z;\n}\nint main(){\n\tlong long a,b,c,d,e,f,t1,t2;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\n\tif(f>e){\n\t\tt2=min(b,c,d);\n\t\tt1=min((d-t2),a,100005);\n\t}\n\telse{\n\t\tt1=min(a,d,100005);\n\t\tt2=min((d-t1),b,c);\n\t}\n\tprintf(\"%lld\\n\",((t1*e)+t2*f));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int arr[9],max=1000000000,j,sum,i,k;\n for(i=0; i<6; i++)\n {\n scanf(\"%lld\",&arr[i]);\n }\n if(arr[4]<arr[5])\n {\n for(i=1; i<=3; i++)\n {\n if(max>arr[i])\n {\n max=arr[i];\n }\n }\n sum=max*arr[5];\n j=arr[3]-max;\n if(j>arr[0])\n {\n sum=sum+arr[0]*arr[4];\n }\n else\n {\n sum=sum+j*arr[4];\n }\n }\n else\n {\n if(arr[0]>arr[3])\n {\n sum=arr[3]*arr[4];\n k=arr[3];\n }\n else\n {\n sum=arr[0]*arr[4];\n k=arr[0];\n }\n arr[3]=arr[3]-k;\n for(i=1;i<=3;i++)\n {\n if(max>arr[i])\n {\n max=arr[i];\n }\n }\n sum=sum+max*arr[5];\n }\n printf(\"%lld\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tlong int a,b,c,d,e,f,w,y,x,v;\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tscanf(\"%ld\",&d);\n\tscanf(\"%ld\",&e);\n\tscanf(\"%ld\",&f);\n\tif(f>e)\n\t{\n\t\tif((b<=c)&&(b<=d))\n\t\t{\n\t\t\tw=b*f;\n\t\t\tx=d-b;\n\t\t\tif(a<x)\n\t\t\t{\n\t\t\t\ty=a*e;\n\t\t\t\tv=w+y;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty=x*e;\n\t\t\t\tv=y+w;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t}\n\t\telse if((c<=b)&&(c<=d))\n\t\t{\n\t\t\tw=c*f;\n\t\t\tx=d-c;\n\t\t\tif(a<x)\n\t\t\t{\n\t\t\t\ty=a*e;\n\t\t\t\tv=w+y;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty=x*e;\n\t\t\t\tv=y+w;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw=d*f;\n\t\t\tprintf(\"%ld\",w);\n\t\t}\n\t}\n\telse \n\t{\n\t\tif(a<d)\n\t\t{\n\t\t\tw=a*e;\n\t\t\tx=d-a;\n\t\t\tif((b<=c)&&(b<=x))\n\t\t\t{\n\t\t\t\ty=b*f;\n\t\t\t\tv=y+w;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t\telse if((c<=b)&&(c<=x))\n\t\t\t{\n\t\t\t\ty=c*f;\n\t\t\t\tv=y+w;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty=x*f;\n\t\t\t\tv=y+w;\n\t\t\t\tprintf(\"%ld\",v);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw=d*e;\n\t\t\tprintf(\"%ld\",w);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int sum=0,a,b,c,d,e,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n while (d>0)\n {\n if(e>f)\n {\n if(a>0){\n a--;\n d--;\n sum+=e;\n\n }\n if(d>0&&a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(f>e)\n {\n if(b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(d>0&&a>0&&(b<=0||c<=0))\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(e==f)\n {\n if(a>0)\n {\n a--;\n d--;\n sum+=e;\n }\n if(d>0&&a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tint tie,scarf,vest,jacket;\n\tint n1, n2;\n\tint s1 = 0, s2 = 0;\n \tscanf(\"%d %d %d %d %d %d\", &tie,&scarf,&vest,&jacket,&n1,&n2);\n \t\tif(n2 > n1){\n \t\t\twhile(scarf&&vest&&jacket){\n \t\t\t\tif(scarf >= 1 && vest >= 1 && jacket >= 1){\n \t\t\t\t\ts2++;\n \t\t\t\t\tscarf--;\n \t\t\t\t\tvest--;\n \t\t\t\t\tjacket--;\n\t\t \t\t}\n\t\t\t}\t\n\t\twhile(jacket&&tie){\n\t\t \tif(jacket >= 1 && tie >= 1){\n\t\t \t\ts1++;\n\t\t \t\tjacket--;\n\t\t \t\ttie--;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\t\n\t\telse{\n\t\t\twhile(jacket&&tie){\n\t\t \t\tif(jacket >= 1 && tie >= 1){\n\t\t \t\t\ts1++;\n\t\t \t\t\tjacket--;\n\t\t \t\t\ttie--;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\twhile(scarf&&vest&&jacket){\n \t\t\t\tif(scarf >= 1 && vest >= 1 && jacket >= 1){\n \t\t\t\t\ts2++;\n \t\t\t\t\tscarf--;\n \t\t\t\t\tvest--;\n \t\t\t\t\tjacket--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tlong long total = s1*n1 + s2*n2;\n\tprintf(\"%lld\", total);\n \t\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x,y) ((x) < (y) ? (x) : (y))\n#define MAX(x,y) ((x) > (y) ? (x) : (y))\n\nint max_cost(int a, int b, int c, int d, int e, int f) {\n int e1 = 0, f1 = 0, e2 = 0, f2 = 0;\n int cost1 = 0, cost2 = 0;\n\n e1 = (d < a) ? d : a;\n f1 = (d < a) ? 0 : ((d - a) <= MIN(b,c) ? (d - a) : MIN(b,c));\n\n f2 = (d < MIN(b,c)) ? d : MIN(b,c);\n e2 = (d < MIN(b,c)) ? 0 : ( (d - MIN(b,c)) <= a ? (d - MIN(b,c)) : a);\n\n cost1 = (e1 * e) + (f1 * f);\n cost2 = (e2 * e) + (f2 * f);\n\n return MAX(cost1, cost2);\n}\n\nint main() {\n int a = 0;\n int b = 0;\n int c = 0;\n int d = 0;\n int e = 0;\n int f = 0;\n\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\\n%d\",\n &a, &b, &c, &d, &e, &f);\n\n printf(\"%d\\n\", max_cost(a, b, c, d, e, f));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum1=0,sum2=0;\n int a,b,c,d,e,f,min=10000000;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e<f)\n {\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n if(d>min)\n {\n d = d-min;\n if(a>d)\n sum1 = d*e;\n else\n sum1 = a*e;\n }\n }\n else\n {\n min=10000000;\n if(a>d) {\n sum1 = d*e;\n d = 0;\n }\n else {\n sum1 = a*e;\n d = d-a;\n }\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n }\n printf(\"%lld\\n\",sum1+sum2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int a, b, c, d, e, f;\n int counte =0 , countf = 0;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n // a-d||e\n // b-c-d||f\n \n if(f > e){\n \twhile(1){\n \t\tif(b > 0 && c > 0 && d > 0){\n \t\t\tcountf++;\n \t\t\tb-=1;\n \t\t\tc-=1;\n \t\t\td-=1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\twhile(1){\n \t\tif(a > 0 && d > 0){\n \t\t\tcounte++;\n \t\t\ta-=1;\n \t\t\td-=1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\telse{\n\t\twhile(1){\n \t\tif(a > 0 && d > 0){\n \t\t\tcounte++;\n \t\t\ta-=1;\n \t\t\td-=1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\twhile(1){\n \t\tif(b > 0 && c > 0 && d > 0){\n \t\t\tcountf++;\n \t\t\tb-=1;\n \t\t\tc-=1;\n \t\t\td-=1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t}\n \n int ans = counte*e + countf*f;\n\tprintf(\"%d\\n\", ans);\n\t\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a , b , c , d;\n\tint e,f ;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(a>=1&&a<=10^5&&b>=1&&b<=10^5&&c>=1&&c<=10^5&&d>=1&&d<=10^5&&\n\te>=1&&e<=10^3&&f>=1&&f<=10^3){\n\t\n\tif( e > f)\n\t{\n\t\tif(a >= d)\n\t\tprintf(\"%d\\n\",d*e);\n\t\telse\n\t\tprintf(\"%d\\n\",a*e + (((d-a)>(b>=c?c:b)?(b>=c?c:b):d-a))*f);\t\t\n\t}\n\telse\n\t{\n\t\tif( (b>=c?c:b) >= d)\n\t\tprintf(\"%d\\n\",d*f);\n\t\telse\n\t\tprintf(\"%d\\n\",(b>=c?c:b)*f+((d-(b>=c?c:b))>=a?a:(d-(b>=c?c:b)))*e);\n\t}}\n\telse\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int w0=0,w1=0,w2=0;\n int ntie=0,njacket=0,nscar=0,nvest=0;\n scanf(\"%d%d%d%d%d%d\",&ntie,&nscar,&nvest,&njacket,&w1,&w2);\n if (w1>=w2) {\n if (njacket>=ntie) {\n w0=w1*ntie;\n }else{\n w0=w1*njacket;\n }\n }else{\n if (njacket<=nvest&&njacket<=nscar) {\n w0=w2*njacket;\n }\n if (njacket>=nvest&&nvest<=nscar) {\n if (ntie<=njacket-nvest) {\n w0=w1*ntie+w2*nvest;\n }else{\n w0=w1*(njacket-nvest)+w2*nvest;\n }\n }\n if (njacket>=nscar&&nvest>=nscar) {\n if (ntie<=njacket-nscar) {\n w0=w1*ntie+w2*nscar;\n }else{\n w0=w1*(njacket-nscar)+w2*nscar;\n }\n\n }\n }\n printf(\"%d\\n\",w0);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost < suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (remainder * suit1Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit2Cost) + (clothes[0] * suit1Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = smallest * suit2Cost;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal += remainder * suit1Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += clothes[0] * suit1Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\t\tif (remainder <= smallest) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tlong int a,b,c,d,e,f,w[7],y[7],x[7],v[7];\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tscanf(\"%ld\",&d);\n\tscanf(\"%ld\",&e);\n\tscanf(\"%ld\",&f);\n\tif(f>=e)\n\t{\n\t\tif((b<=c)&&(b<=d))\n\t\t{\n\t\t\tw[0]=b*f;\n\t\t\tx[0]=d-b;\n\t\t\tif(a<x[0])\n\t\t\t{\n\t\t\t\ty[0]=a*e;\n\t\t\t\tv[0]=w[0]+y[0];\n\t\t\t\tprintf(\"%ld\",v[0]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[1]=x[0]*e;\n\t\t\t\tv[1]=y[1]+w[0];\n\t\t\t\tprintf(\"%ld\",v[1]);\n\t\t\t}\n\t\t}\n\t\telse if((c<=b)&&(c<=d))\n\t\t{\n\t\t\tw[1]=c*f;\n\t\t\tx[1]=d-c;\n\t\t\tif(a<x[1])\n\t\t\t{\n\t\t\t\ty[2]=a*e;\n\t\t\t\tv[2]=w[1]+y[2];\n\t\t\t\tprintf(\"%ld\",v[2]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[3]=x[1]*e;\n\t\t\t\tv[3]=y[3]+w[1];\n\t\t\t\tprintf(\"%ld\",v[3]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw[2]=d*f;\n\t\t\tprintf(\"%ld\",w[2]);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tw[3]=a*e;\n\t\t\tx[2]=d-a;\n\t\t\tif((b<=c)&&(b<=x[2]))\n\t\t\t{\n\t\t\t\ty[4]=b*f;\n\t\t\t\tv[4]=y[4]+w[3];\n\t\t\t\tprintf(\"%ld\",v[4]);\n\t\t\t}\n\t\t\telse if((c<=b)&&(c<=x[2]))\n\t\t\t{\n\t\t\t\ty[5]=c*f;\n\t\t\t\tv[5]=y[5]+w[3];\n\t\t\t\tprintf(\"%ld\",v[5]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[6]=x[2]*f;\n\t\t\t\tv[6]=y[6]+w[3];\n\t\t\t\tprintf(\"%ld\",v[6]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw[4]=d*e;\n\t\t\tprintf(\"%ld\",w[4]);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c,d,e,f,set1,set2,total,p,min;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a>=d)\n set1=d;\n else\n set1=a;\n d=d-set1;\n min=b;\n if(min>c)\n min=c;\n else if(min>d)\n min=d;\n p=set1*e+min*f;\n printf(\"%d\",p);\n }\n else if(f>=e)\n {\n min=b;\n if(min>c)\n min=c;\n else if(min>d)\n min=d;\n d=d-min;\n if(a>=d)\n set1=d;\n else\n set1=a;\n p=set1*e+min*f;\n printf(\"%d\",p);\n \n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int sum=0,a,b,c,d,e,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n while (d!=0)\n {\n if(e>f)\n {\n if(a>0){\n a--;\n d--;\n sum+=e;\n\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a<=0&&b<=0||c<=0)\n break;\n }\n if(f>e)\n {\n if(b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a>0&&b<=0||c<=0)\n {\n a--;\n d--;\n sum+=e;\n\n }\n if(a<=0&&b<=0||c<=0)\n break;\n }\n else\n {\n if(a>0)\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;\n }\n if(a<=0&&b<=0||c<=0)\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min3(int a, int b, int c){\n\tint min;\n\tif(a < b){\n\t\tif(c < a)\n\t\t\tmin = c;\t\n\t\telse\n\t\t\tmin = a;\n\t}\n\telse{\n\t\tif(c < b)\n\t\t\tmin = c;\n\t\telse\n\t\t\tmin = b;\n\t}\n\treturn min;\n}\n\t\nint min2(int a, int b){\n\tint min;\n\tif(a < b)\n\t\tmin = a;\n\telse\n\t\tmin = b;\n\treturn min;\n\n}\n\nint main(){\n\tint a, b, c, d, e, f;\n\tscanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\tint res;\n\tif(e < f){\n\t\tres = min3(b, c, d) * f + min2(d - min3(b, c, d), a) * e;\n\t}\n\telse{\n\t\tres = min2(a, d) * e + min3(b, c, d - min2(a, d)) * e;\n\t}\n\tprintf(\"%d\", res);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint arr[4],a[2],b[3],e,f;\n\tint amin,bmin,cost1,cost2,cost3,cost4,cost5,cost6,i;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tscanf(\"%d%d\",&e,&f);\n\ta[0] = arr[0];a[1] = arr[3];\n\tb[0] = arr[1];b[1] = arr[2];b[2] = arr[3];\n\tamin = a[0];\n\tfor(i=0;i<2;i++)\n\t{\n\t\tif(a[i]<amin)\n\t\t\tamin = a[i];\n\t}\n\tbmin = b[0];\n\tfor(i=0;i<3;i++)\n\t{\n\t\tif(b[i]<bmin)\n\t\t\tbmin = b[i];\n\t}\n\tcost1 = amin * e;\n\tif((b[3]-amin) > bmin)\n\t\tcost2 = bmin*f;\n\telse \n\t\tcost2 = (b[2]-amin) * f;\n\tcost3 = bmin * f;\n\tif((a[2]-bmin) > amin)\n\t\tcost4 = amin * e;\n\telse \n\t\tcost4 = (a[1]-bmin) * e;\n\t\t\n\tcost5 = cost1 + cost2;\n\tcost6 = cost3 + cost4;\n\tif(cost5 >= cost6)\n\t\tprintf(\"%d\\n\",cost5);\n\telse \n\t\tprintf(\"%d\\n\",cost6);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nunsigned int min(unsigned int a,unsigned int b) {\n if(a<b)\n return a;\n else \n return b;\n}\nint main() {\n unsigned int a,b,c,d,e,f,cost,m;\n scanf(\"%u %u %u %u %u %u\",&a,&b,&c,&d,&e,&f);\n if ( f>e ) {\n m=min(min(b,c),d);\n cost=m*f+min(a,d-m)*e;\n printf(\"%u\",cost);\n }\n else {\n m=min(a,d);\n cost=m*e+min(min(a,b),d-m)*f;\n printf(\"%u\",cost);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f,min2;\n\tscanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\n\tif(b <= c && b <= d)\n\t{\n\t\tmin2 = b;\n\t}\n\telse if(c <= d && c <= b)\n\t{\n\t\tmin2 = c;\n\t}\n\telse{\n\t\tmin2 = d;\n\t}\n\td -= min2;\n\tint min1 = (a < d) ? a : d;\n\tif(min1 < 0)\n\t{\n\t\tmin1 *= -1;\n\t}\n\tmin2 *= f;\n\tmin1 *= e;\n\tprintf(\"%d\",min1+min2);\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nlong int min3(long int a,long int b,long int c)\n{\n return (a>b&&a>c)?a:(b>c&&b>a)?b:c;\n}\nlong int min2(long int a,long int b)\n{\n return (a>b)?a:b; \n}\nint main()\n{\n long int t,s,v,j,first,second,cost=0;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&t,&s,&v,&j,&first,&second);\n if(first<second)\n {\n cost+=second*min3(s,v,j);\n j-=min3(s,v,j);\n cost+=first*min2(t,j);\n }\n else\n {\n cost+=first*min2(t,j);\n j-=min2(t,j);\n cost+=second*min3(s,v,j);\n }\n printf(\"%ld\",cost);\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,s,t=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f){\n if(a<d){\n s=e*a;\n }\n else{\n s=e*d;\n printf(\"%d\",s);\n return 0;\n }\n d=d-a;\n if(b<c)\n {\n if(b<d){\n t=f*b;\n }\n else{\n t=f*d;\n }\n }\n else\n {\n if(c<d){\n t=f*c;\n }\n else{\n t=f*d;\n }\n }\n }\n //allahu akbar\n else{\n\n if(b<c)\n {\n if(d<c){\n s=f*d;\n printf(\"%d\",s);\n return 0;\n }\n s=f*b;\n d=d-b;\n if(a<d){\n t=e*a;\n }\n else{\n t=e*d;\n }\n }\n else\n {\n if(d<c){\n s=f*d;\n printf(\"%d\",s);\n return 0;\n }\n s=f*c;\n d=d-c;\n if(a<d){\n t=e*a;\n }\n else{\n t=e*d;\n }\n\n }\n }\n printf(\"%d\",s+t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum1=0,sum2=0;\n int a,b,c,d,e,f,min=10000000;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n if(d>min)\n {\n d = d-min;\n if(a>d)\n sum1 = d*e;\n else\n sum1 = a*e;\n }\n printf(\"%lld\\n\",sum1+sum2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t, h, m, min=1440;\n int time, x;\n scanf(\"%d\",&t);\n {\n while(t!=0)\n {\n scanf(\"%d %d\",&h,&m);\n time = h*60 + m;\n if(time!=min)\n x = min-time;\n else\n break;\n printf(\"%d\\n\",x);\n t--;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint min(int value1, int value2);\n\nint main()\n{\n\tint a, b, c, d, e, f = 0;\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tscanf(\"%d\", &c);\n\tscanf(\"%d\", &d);\n\tscanf(\"%d\", &e);\n\tscanf(\"%d\", &f);\n\n\tint max = 0;\n\n\tif (e > f) \n\t{\n\t\tmax = (min(a, d)) * e + min(b, min(c, d - (min(a, d))));\n\t}\n\telse\n\t{\n\t\tmax = (min(b, min(c, d))) * f + min(a, d - (min(b, min(c, d)))) * e;\n\t}\n\n\tprintf(\"%d\", max);\n\n\treturn 0;\n}\n\nint min (int value1, int value2)\n{\n\tif (value1 < value2) \n\t{\n\t\treturn value1;\n\t}\n\telse\n\t{\n\t\treturn value2;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b)\n{\n if(a < b) return a;\n else return b;\n}\n\nint main()\n{\n int a, b, c, d, e, f, g, x, y;\n long long max;\n\n scanf(\"%d%d%d%d%d%d\", &a, &b, &c, &d, &e, &f);\n\n if(f > e)\n {\n g = d - min(b, c);\n if((d - g) == min(b, c)){\n\n x = min(a, g);\n y = min(min(b, c), d - g);\n } else {\n x = 0;\n y = min(min(b, c), d);\n }\n }\n else if(f < e)\n {\n if(d >= a)\n {\n g = a;\n x = a;\n y = min(min(b, c), d - g);\n }\n else\n {\n g = d;\n x = min(a, d);\n y = 0;\n }\n }\n else\n {\n g = 0;\n x = 0;\n y = min(min(b, c), d-g);\n }\n\n max = x * e + y * f;\n\n printf(\"\\n%lld\", max);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#define INPUT 6\n\nint main(){\n\n int input[INPUT];\n int price = 0;\n int max_type2=0;\n\n for(int i =0; i<INPUT; i++){\n\n scanf(\"%i\", &input[i]);\n }\n\n if(input[1]>0 && input[2]>0 && input[3>0]){\n if(input[1]>input[2]){\n max_type2 = input[2];\n }\n else if(input[1]<input[2]){\n\n max_type2 = input[1];\n }\n else{\n max_type2 = input[1];\n }\n\n if(max_type2> input[3]){\n price = input[3] * input[5];\n }\n else{\n price = max_type2 * input[5];\n input[3] = input[3] - max_type2;\n }\n }\n\n if(input[0]>0 && input[3]>0){\n\n if(input[0]> input[3]){\n\n price = price+(input[3] * input[4]);\n }\n else{\n\n price = price+(input[0]*input[4]);\n }\n }\n\n printf(\"%i\\n\", price);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int sum1=0,sum2=0;\n int a,b,c,d,e,f,min=10000000;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\n if(b<min)\n min = b;\n if(c<min)\n min = c;\n if(d<min)\n min =d;\n sum2 = min*f;\n if(d>min)\n {\n d = d-min;\n if(a>d)\n sum1 = d*e;\n else\n sum1 = a*e;\n }\n printf(\"%lld\\n\",sum1+sum2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint arr[4],a[2],b[3],e,f;\n\tint amin,bmin,cost1,cost2,cost3,cost4,cost5,cost6,i;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tscanf(\"%d%d\",&e,&f);\n\ta[0] = arr[0];a[1] = arr[3];\n\tb[0] = arr[1];b[1] = arr[2];b[2] = arr[2];\n\tamin = a[0];\n\tfor(i=0;i<2;i++)\n\t{\n\t\tif(a[i]<amin)\n\t\t\tamin = a[i];\n\t}\n\tbmin = b[0];\n\tfor(i=0;i<3;i++)\n\t{\n\t\tif(b[i]<bmin)\n\t\t\tbmin = b[i];\n\t}\n\tcost1 = amin * e;\n\tif((b[3]-amin) > bmin)\n\t\tcost2 = bmin*f;\n\telse \n\t\tcost2 = (b[2]-amin) * f;\n\tcost3 = bmin * f;\n\tif((a[2]-bmin) > amin)\n\t\tcost4 = amin * e;\n\telse \n\t\tcost4 = (a[1]-bmin) * e;\n\t\t\n\tcost5 = cost1 + cost2;\n\tcost6 = cost3 + cost4;\n\tif(cost5 >= cost6)\n\t\tprintf(\"%d\\n\",cost5);\n\telse \n\t\tprintf(\"%d\\n\",cost6);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min1, min2, cost;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if (e >= f)\n {\n min1 = a < d? a : d;\n d = d - min1;\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n //printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n else\n {\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n d = d - min2; \n min1 = a < d? a : d; \n //printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n printf(\"%d\",cost);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint smaller(int a,int b ,int c)\n{\n int temp =0;\n if(a <= b && a <= c)\n temp= a;\n else if(b <= c && b <= a)\n temp= b;\n else if (c <= a && b <= b)\n temp= c;\n\n\n return temp;\n\n\n\n\n}\nint main()\n{\n int t,s,v,j,s1,s2;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&s1,&s2);\n int cost1=0, cost2=0;\n if(t<s1)\n cost1=t*s1;\n else\n cost1=j*s1;\n t=smaller(s,v,j);\n cost2= t*s2;\n // printf(\"%d %d\",cost1,cost2);\n if(cost1 > cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int a, b, c, d, e, f;\n int counte =0 , countf = 0;\n scanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n // a-d||e\n // b-c-d||f\n \n while(1){\n \tif(b > 0 && c > 0 && d > 0){\n \t\tcountf++;\n \t\tb-=1;\n \t\tc-=1;\n \t\td-=1;\n\t\t}\n\t\telse{\n\t\t\tbreak;\n\t\t}\n\t}\n \n while(1){\n \tif(a > 0 && d > 0){\n \t\tcounte++;\n \t\ta-=1;\n \t\td-=1;\n\t\t}\n\t\telse{\n\t\t\tbreak;\n\t\t}\n\t}\n \n int ans = counte*e + countf*f;\n\tprintf(\"%d\\n\", ans);\n\t\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint min(int a, int b)\n{\n if(a < b) return a;\n else return b;\n}\n\nint main()\n{\n int a, b, c, d, e, f, g, x, y;\n long long max, max_1, max_2;\n\n scanf(\"%d%d%d%d%d%d\", &a, &b, &c, &d, &e, &f);\n if(e == f)\n {\n max_1 = min(min(b, c), d) * f;\n\n if(d - min(b, c) >= a)\n g = d - min(b, c);\n max_2 = min(a, g) * e + min(min(b, c) , d-g) * f;\n\n if(max_1 > max_2)\n max = max_1;\n else\n max = max_2;\n\n printf(\"\\n%d\", max);\n exit(0);\n }\n\n if(f > e)\n {\n g = d - min(b, c);\n if((d - g) == min(b, c)){\n\n x = min(a, g);\n y = min(min(b, c), d - g);\n } else {\n x = 0;\n y = min(min(b, c), d);\n }\n }\n else if(f < e)\n {\n if(d >= a)\n {\n g = a;\n x = a;\n y = min(min(b, c), d - g);\n }\n else\n {\n g = d;\n x = min(a, d);\n y = 0;\n }\n }\n\n max = x * e + y * f;\n\n printf(\"\\n%lld\", max);\n}\n"}, {"source_code": "#include<stdio.h>\nlong int min3(long int a,long int b,long int c)\n{\n return (a<b&&a<c)?a:(b<c&&b<a)?b:c;\n}\nlong int min2(long int a,long int b)\n{\n return (a<b)?a:b; \n}\nint main()\n{\n long int t,s,v,j,first,second,cost=0;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&t,&s,&v,&j,&first,&second);\n if(first<second)\n {\n cost+=second*min3(s,v,j);\n j-=min3(s,v,j);\n cost+=first*min2(t,j);\n }\n else\n {\n cost+=first*min2(t,j);\n j-=min2(t,j);\n cost+=second*min3(s,v,j);\n }\n printf(\"%ld\",cost);\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int a,b,c,d,e,f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n d-=min(a,d);\n int j= min(b,min(c,d));\n int g= e*min(a,d) + f*j;\n printf(\"%d\",g);\n }\n else\n {\n int j=min(b,min(c,d));\n d-=j;\n int g= e*min(a,d)+ f*j;\n printf(\"%d\",g);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost < suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (remainder * suit2Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (clothes[0] * suit2Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\ttotal = ((smallest)*suit2Cost) + (remainder * suit1Cost);\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int x,int y,int z)\n{\n\n int c = 0;\n while (x && y && z) {\n x--;\n y--;\n z--;\n c++;\n }\n return c;\n}\nint main()\n{\n int a,b,c,d,e,f,price=0,m;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a<d)\n {\n price=a*e;\n d-=a;\n m=min(b,c,d);\n price+=m*f;\n\n }\n else\n {\n price=a*d;\n d=0;\n }\n }\n else\n {\n m=min(b,c,d);\n price=m*f;\n d-=m;\n if(a>d)\n price+=d*e;\n else\n price+=a*e;\n }\n printf(\"%d\\n\",price);\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n }\n else{\n\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n }\n printf(\"\\n\\n%d\\n\",total);\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include<stdio.h>\nint min1(long int x,long int y)\n{\n if(x<y)\n return x ;\n else\n {\n return y ;\n }\n \n}\nint min(long int x,long int y,long int z)\n{\n if(x<=y && x<=z)\n return x ;\n else if(y<=z)\n return y ;\n else\n return z ;\n}\nint main()\n{\n long int a,b,c,d,e,f,cost ;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&a,&b,&c,&d,&e,&f) ;\n\n if(e>=f)\n {\n cost = min1(a,d)*e + (d - min1(a,d))*f ;\n }\n else \n {\n cost = min(b,c,d)*f + (d - min(b,c,d))*e ;\n }\n\n printf(\"%d\\n\",cost) ;\n\n return 0 ;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint a,b,c,d,e,f,x,y,z;\nscanf(\"%d\",&a);\nscanf(\"%d\",&b);\nscanf(\"%d\",&c);\nscanf(\"%d\",&d);\nscanf(\"%d\",&e);\nscanf(\"%d\",&f);\n\nif(b<c)\nx=b;\nelse\nx=c;\n\nif(f>=e){\n if(x>d)\n printf(\"%d\\n\",d*f);\n else if(x<d){\n if(d-x<=a)\n printf(\"%d\\n\",f*x+e*(d-x));\n else\n printf(\"%d\\n\",f*x+e*a);\n }\n }\nelse {\nif(a>d)\n printf(\"%d\\n\",d*e);\nelse if (a<d){\n if(d-a<=x)\n printf(\"%d\\n\",e*a+f*(d-a));\n else\n printf(\"%d\\n\",e*a+f*x);\n }\n\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,s,x;\nscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\nx=b;\nif(x>c)\nx=c;\nif(x>d)\nx=d;\n\nd=d-x;\nif(d>a)\ns=e*a;\nif(a>d||a==d)\ns=e*d;\n\nx=x*f;\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,min,min2,s1,s2,s;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(a<b&&a<c){min=a;}\n else if(b<a&&b<c){min=b;}\n else{min=c;}\n if(min>d){if(e>f){s=d*e;}\n else{s=d*f;}\n }\n else{\n if(min==a){s1=min*e;s2=(d-min)*f;}\n else{s1=min*f;s2=(d-min)*e;}\n s=s1+s2;\n }\n printf(\"%d\",s);\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,s,x;\nscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\nx=b;\nif(x>c)\nx=c;\nif(x>d)\nx=d;\n\n\nif(f>e)\n{\nd=d-x;\nx=x*f;\nif(d>a)\n{\ns=e*a;\n}\nif(a>d||a==d)\n{\ns=e*d;\n}\n}\nif(e>f||e==f)\n{\n if(a<d)\n {\n s=e*a;\n d=d-a;\n }\n if(d<a)\n {\n s=e*d;\n d=0;\n }\n\n if(x>d)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min1, min2, cost;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if (e >= f)\n {\n min1 = a < d? a : d;\n d = d - min1;\n if (b < c)\n {\n if (b < d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n //printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n else\n {\n if (b < c)\n {\n if (b < d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n d = d - min2; \n min1 = a < d? a : d; \n // printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n printf(\"%d\",cost);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint smaller (int a,int b,int c)\n{\n int temp=0;\n if(a<=b&&a<=c)\n temp=a;\n else if(b<=c&&b<=a )\n temp=b;\n else if(c<=a&&c<=b)\n temp=c;\n return temp;\n};\nint func1(int a,int b,int c,int d,int e,int f)\n{\n int cost1,cost2;\n if(a<d)\n {cost1=a*e;\n d=d-a;}\n else\n {\n cost1=d*e;\n a=a-d;\n }\n cost2=(smaller(b,c,d))*f;\n return (cost1+cost2);\n\n};\nint func2(int a,int b, int c ,int d, int e,int f)\n{\n int t=smaller(b,c,d);\n int cost1,cost2=f*t;\n d=d-t;\n if(a<d)\n {\n cost1=a*e;\n }\n else\n cost1=d*e;\n\n int cost3=cost1+cost2;\n return cost3;\n\n\n\n};\nint main()\n{\n int a,b,c,d,e,f,cost1,cost2;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n int t=func1(a,b,c,d,e,f);\n int s=func2(a,b,c,d,e,f);\n if(t<s)\n printf(\"%d\",s);\n else\n printf(\"%d\",t);\n return 0;\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tlong int a,b,c,d,e,f,w[6],y[6],x[6],v[6];\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tscanf(\"%ld\",&d);\n\tscanf(\"%ld\",&e);\n\tscanf(\"%ld\",&f);\n\tif(f>e)\n\t{\n\t\tif((b<=c)&&(b<=d))\n\t\t{\n\t\t\tw[0]=b*f;\n\t\t\tx[0]=d-b;\n\t\t\tif(a<x[0])\n\t\t\t{\n\t\t\t\ty[0]=a*e;\n\t\t\t\tv[0]=w[0]+y[0];\n\t\t\t\tprintf(\"%ld\",v[0]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[1]=x[0]*e;\n\t\t\t\tv[1]=y[1]+w[0];\n\t\t\t\tprintf(\"%ld\",v[1]);\n\t\t\t}\n\t\t}\n\t\telse if((c<=b)&&(c<=d))\n\t\t{\n\t\t\tw[1]=c*f;\n\t\t\tx[1]=d-c;\n\t\t\tif(a<x[1])\n\t\t\t{\n\t\t\t\ty[2]=a*e;\n\t\t\t\tv[2]=w[1]+y[2];\n\t\t\t\tprintf(\"%ld\",v[2]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[3]=x[1]*e;\n\t\t\t\tv[3]=y[3]+w[1];\n\t\t\t\tprintf(\"%ld\",v[3]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw[2]=d*f;\n\t\t\tprintf(\"%ld\",w[2]);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,s,x;\nscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\nx=b;\nif(x>c)\nx=c;\nif(x>d)\nx=d;\n\n\nif(f>e)\n{\nd=d-x;\nx=x*f;\nif(d>a)\n{\ns=e*a;\n}\nif(a>d||a==d)\n{\ns=e*d;\n}\n}\nif(e>f||e==f)\n{\n if(a<d)\n {\n s=e*a;\n d=d-a;\n }\n if(d<a||d==a)\n {\n s=e*d;\n d=0;\n }\n\n if(x>d)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint min1(int a, int b, int c){\n\tint minn=a;\n\tif(minn>b){\n\t\tminn=b;\n\t}\n\tif(minn>c){\n\t\tminn=c;\n\t}\n\treturn minn;\n}\nint min2(int a, int b){\n\tint minn=a;\n\tif(minn>b){\n\t\tminn=b;\n\t}\n\treturn minn;\n}\nint main(){\n\tint a,b,c,d,e,f;//a=ties, b=scarf, c=vest, d=jacket\n\tscanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\tint total=0;\n\tif(f>e){\n\t\tint n=min1(b,c,d);\n\t\ttotal=total+(n*f);\n\t\tb-=n;\n\t\tc-=n;\n\t\td-=n;\n\t}\n\t\n\t\tint n=min2(a,d);\n\t\ttotal=total+(n*e);\n\t\ta-=n;\n\t\td-=n;\n\t\n\tprintf(\"%d\\n\", total);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,s,t=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f){\n if(a<d){\n s=e*a;\n }\n else{\n s=e*d;\n printf(\"%d\",s);\n return 0;\n }\n d=d-a;\n if(b<c)\n {\n if(b<d){\n t=f*b;\n }\n else{\n t=f*d;\n }\n }\n else\n {\n if(c<d){\n t=f*c;\n }\n else{\n t=f*d;\n }\n }\n }\n //allahu akbar\n else{\n\n if(b<c)\n {\n if(d<c){\n s=f*d;\n printf(\"%d\",s);\n return 0;\n }\n s=f*b;\n d=d-b;\n if(a<d){\n t=e*a;\n }\n else{\n t=e*d;\n }\n }\n else\n {\n if(d<c){\n s=f*d;\n printf(\"%d\",s);\n return 0;\n }\n s=f*c;\n d=d-c;\n if(a<d){\n t=e*a;\n }\n else{\n t=e*d;\n }\n\n }\n }\n printf(\"%d\",s+t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,g=0,count=0,min=0;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n min=a;\n if(b<min){\n min=b;\n }\n if(c<min){\n min=c;\n }\n if(d<min){\n min=d;\n }\n\n count=min*f;\n g=d-min;\n if(g>0){\n count+=g*e;\n }\n\n printf(\"%d\\n\", count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{ int a,b,c,d,e,f,min,p;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n\n if(e>f)\n {\n if(a>d)\n p=d*e;\n else\n {\n d=d-a;\n min=b<c?(c<d?c:d):(b<d?b:c);\n if(d>min)\n p=a*e+min*f;\n else\n p=a*e+d*f;\n }\n\n }\n else\n {min=b<c?(b<d?b:d):(c<d?c:d);\n if(min>d)\n p=d*f;\n else\n {\n d=d-min;\n if(a>d)\n p=min*f+d*e;\n else\n p=min*f+a*e;\n }\n\n }printf(\"%d\",p);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c,d,e,f,set1,set2,total,p,min;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a>=d)\n set1=d;\n else\n set1=a;\n d=d-set1;\n min=b;\n if(min>c)\n min=c;\n else if(min>d)\n min=d;\n p=set1*e+min*f;\n printf(\"%d\",p);\n }\n else if(f>=e)\n {\n min=b;\n if(min>c)\n min=c;\n else if(min>d)\n min=d;\n d=d-min;\n if(a>=d)\n set1=d;\n else\n set1=a;\n p=set1*e+min*f;\n printf(\"%d\",p);\n \n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n }\n else{\n\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n }\n printf(\"\\n\\n%d\\n\",total);\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int value1, int value2);\n\nint main()\n{\n\tint a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;\n\tscanf(\"%d \", &a);\n\tscanf(\"%d \", &b);\n\tscanf(\"%d \", &c);\n\tscanf(\"%d \", &d);\n\tscanf(\"%d \", &e);\n\tscanf(\"%d \", &f);\n\n\tint max = 0;\n\tint x = 0;\n\n\tif (e > f) \n\t{\n\t\tx = min(a, d);\n\t\tmax = x * e + min(b, min(c, d - x));\n\t}\n\telse\n\t{\n\t\tx = min(b, min(c, d));\n\t\tmax = x * f + min(a, d - x) * e;\n\t}\n\n\tprintf(\"%d \", max);\n\n\treturn 0;\n}\n\nint min (int value1, int value2)\n{\n\tif (value1 < value2) \n\t{\n\t\treturn value1;\n\t}\n\telse\n\t{\n\t\treturn value2;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost < suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (remainder * suit2Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (clothes[0] * suit2Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = smallest * suit2Cost;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += clothes[0] * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\t\tif (remainder <= smallest) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int a,b,c,d,e,f,min;\n long k=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(e>=f) {\n min=fmin(a,d);\n k=e*fmin(a,d);\n d=d-min;\n a=a-min;\n printf(\"a = %d\\n\",a);\n printf(\"d =%d\\n\",d);\n if(d>0){\n min=fmin(b,c);\n min=fmin(min,d);\n k=k+f*min;}\n }\n else {\n min=fmin(b,c);\n min=fmin(min,d);\n k=f*min;\n b=b-min;\n c=c-min;\n d=d-min;\n if(d>0)\n k=k+e*fmin(a,d);\n }\n printf(\"%ld\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint smaller(int a,int b ,int c)\n{\n int temp =0;\n if(a <= b && a <= c)\n temp= a;\n else if(b <= c && b <= a)\n temp= b;\n else if (c <= a && b <= b)\n temp= c;\n\n\n return temp;\n\n\n\n\n}\nint main()\n{\n int t,s,v,j,s1,s2;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&s1,&s2);\n int cost1=0, cost2=0;\n if(t<s1)\n cost1=t*s1;\n else\n cost1=j*s1;\n t=smaller(s,v,j);\n cost2= t*s2;\n printf(\"%d %d\",cost1,cost2);\n if(cost1 > cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c,d,e,f,i,j,k,x=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a<=d)\n {\n x+=a*e;\n d-=a;\n if(b<=c&&b<=d)\n x+=b*f;\n else if(c<=b&&c<=d)\n x+=c*f;\n else\n x+=d*f;\n }\n else\n {\n x+=d*e;\n }\n }\n else\n {\n if(b<=c&&b<=d)\n x+=b*f+(d-b)*e;\n else if(c<=b&&c<=d)\n x+=c*f+(d-c)*e;\n else\n x+=d*f;\n }\n printf(\"%d\",x);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint sum1=0,sum,sum2=0,a,b,c,d,e,f,q=0,g=0;\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\tif(e<f)\n\t{\t\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);}\n else if(e>f)\n {\n \tfor(;;)\n\t{\n\t\t\n\t\tif(a==0||d==0)\n\t\tbreak;\n\t\telse\n\t\ta--;d--;q++;\n\t}\n\tsum1=sum1+q*e;\n\tfor(;;)\n\t{\n\t\n\t\tif(b==0||c==0||d==0)\n\t\tbreak;\n\t\t\tb--;c--;d--;g++;\n\t}\n\tsum2=sum2+g*f;\n\tsum=sum1+sum2;\n printf(\"%d\",sum);\n}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint min3(int a, int b, int c){\n\tint min;\n\tif(a < b){\n\t\tif(c < a)\n\t\t\tmin = c;\t\n\t\telse\n\t\t\tmin = a;\n\t}\n\telse{\n\t\tif(c < b)\n\t\t\tmin = c;\n\t\telse\n\t\t\tmin = b;\n\t}\n\treturn min;\n}\n\t\nint min2(int a, int b){\n\tint min;\n\tif(a < b)\n\t\tmin = a;\n\telse\n\t\tmin = b;\n\treturn min;\n\n}\n\nint main(){\n\tint a, b, c, d, e, f;\n\tscanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\tint res;\n\tif(e < f){\n\t\tres = min3(b, c, d) * f + min2(d - min3(b, c, d), a) * e;\n\t}\n\telse{\n\t\tres = min2(a, d) * e + min3(b, c, d - min2(a, d)) * e;\n\t}\n\tprintf(\"%d\", res);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost < suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (remainder * suit2Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (clothes[0] * suit2Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\ttotal = ((smallest)*suit2Cost) + (remainder * suit1Cost);\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n long int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n }\n else{\n\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n }\n printf(\"\\n\\n%ld\\n\",total);\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,c,d,e,f,min,min2,taka1=0,taka2 =0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n min = a;\n if(a>d){\n min= d;\n }\n taka1 = (min*e);\n d -= min;\n if(b>c && d>c){\n min2 = c;\n }\n else if(c>b && d>b){\n min2 = b;\n }\n else {\n min2 = d;\n }\n taka1 += (min2*f);\n d = d+min;\n if(b>c && d>c){\n min2 = c;\n }\n else if(c>b && d>b){\n min2 = b;\n }\n else if(b>d && a>d){\n min2 = d;\n }\n taka2 = (min2*f);\n d = d - min2;\n min = a;\n if(a>d){\n min= d;\n }\n taka2 = taka2 + (min*e);\n\n if(taka1>=taka2){\n printf(\"%d\\n\",taka1);\n }\n else\n printf(\"%d\\n\",taka2);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t, h, m, min=1440;\n int time, x;\n scanf(\"%d\",&t);\n {\n while(t!=0)\n {\n scanf(\"%d %d\",&h,&m);\n time = h*60 + m;\n if(time!=min)\n x = min-time;\n else\n break;\n printf(\"%d\\n\",x);\n t--;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tint tie,scarf,vest,jacket;\n\tint n1, n2;\n\tint s1 = 0, s2 = 0;\n \tscanf(\"%d %d %d %d %d %d\", &tie,&scarf,&vest,&jacket,&n1,&n2);\n \t\tif(n2 > n1){\n \t\t\twhile(scarf&&vest&&jacket){\n \t\t\t\tif(scarf >= 1 && vest >= 1 && jacket >= 1){\n \t\t\t\t\ts2++;\n \t\t\t\t\tscarf--;\n \t\t\t\t\tvest--;\n \t\t\t\t\tjacket--;\n\t\t \t\t}\n\t\t\t}\t\n\t\twhile(jacket&&tie){\n\t\t \tif(jacket >= 1 && tie >= 1){\n\t\t \t\ts1++;\n\t\t \t\tjacket--;\n\t\t \t\ttie--;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\t\n\t\telse if(n1 > n2){\n\t\t\twhile(jacket&&tie){\n\t\t \t\tif(jacket >= 1 && tie >= 1){\n\t\t \t\t\ts1++;\n\t\t \t\t\tjacket--;\n\t\t \t\t\ttie--;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\twhile(scarf&&vest&&jacket){\n \t\t\t\tif(scarf >= 1 && vest >= 1 && jacket >= 1){\n \t\t\t\t\ts2++;\n \t\t\t\t\tscarf--;\n \t\t\t\t\tvest--;\n \t\t\t\t\tjacket--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tlong long total = s1*n1 + s2*n2;\n\tprintf(\"%lld\", total);\n \t\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int value1, int value2);\n\nint main()\n{\n\tint a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tscanf(\"%d\", &c);\n\tscanf(\"%d\", &d);\n\tscanf(\"%d\", &e);\n\tscanf(\"%d\", &f);\n\n\tint max = 0;\n\tint x = 0;\n\n\tif (e > f) \n\t{\n\t\tx = min(a, d);\n\t\tmax = x * e + min(b, min(c, d - x));\n\t}\n\telse\n\t{\n\t\tx = min(b, min(c, d));\n\t\tmax = x * f + min(a, d - x) * e;\n\t}\n\n\tprintf(\"%d\", max);\n\n\treturn 0;\n}\n\nint min (int value1, int value2)\n{\n\tif (value1 < value2) \n\t{\n\t\treturn value1;\n\t}\n\telse\n\t{\n\t\treturn value2;\n\t}\n}"}, {"source_code": "#include<stdio.h>\nlong int min3(long int a,long int b,long int c)\n{\n return (a>b&&a>c)?a:(b>c&&b>a)?b:c;\n}\nlong int min2(long int a,long int b)\n{\n return (a>b)?a:b; \n}\nint main()\n{\n long int t,s,v,j,first,second,cost=0;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&t,&s,&v,&j,&first,&second);\n if(first<second)\n {\n cost+=second*min3(s,v,j);\n j-=min3(s,v,j);\n cost+=first*min2(t,j);\n }\n else\n {\n cost+=first*min2(t,j);\n j-=min2(t,j);\n cost+=second*min3(s,v,j);\n }\n printf(\"%ld\",cost);\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d;\n long long int e,f;\n long long int cost1=0,cost2=0;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&c,&d);\n scanf(\"%lld %lld\",&e,&f);\n int min=0;\n if(a>=d)\n {\n cost1=d*e;\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n cost2=b*f+(d-b)*e;\n else\n cost2=c*f+(d-c)*e;\n }\n }\n else\n {\n cost1=a*e;\n if((d-a)<=b && (d-a)<=c)\n cost1+=(d-a)*f;\n else\n {\n if(b<=c)\n cost1+=b*f;\n else\n cost1+=c*f;\n }\n if(d<=b && d<=c)\n cost2=d*f;\n else\n {\n if(b<=c)\n cost2=b*f+(d-b)*e;\n else\n cost2=c*f+(d-c)*e;\n }\n }\n if(cost1>cost2)\n printf(\"%lld\\n\",cost1);\n else\n printf(\"%lld\\n\",cost2);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ties,scarves,vests,jackets,Type1Cost,Type2Cost;\n int cost1,cost2,minimum,maximum,MaxCost;\n scanf(\"%d %d %d %d %d %d\",&ties,&scarves,&vests,&jackets,&Type1Cost,&Type2Cost);\n if(Type2Cost>Type1Cost)\n {\n if(scarves<vests &&scarves<jackets)\n {\n minimum=scarves;\n cost1=Type2Cost*scarves;\n }\n else if(vests<scarves&&vests<jackets)\n {\n minimum=vests;\n cost1=Type2Cost*vests;\n }\n else\n {\n minimum=jackets;\n cost1=Type2Cost*jackets;\n }\n cost2=(jackets-minimum)*Type1Cost;\n MaxCost=cost1+cost2;\n printf(\"%d\\n\",MaxCost);\n\n }\n else\n {\n if(ties>jackets)\n {\n cost2=jackets*Type1Cost;\n MaxCost=cost2;\n }\n else if(ties<jackets)\n {\n cost2=ties*Type1Cost;\n if(scarves>vests &&(jackets-ties)>vests)\n {\n MaxCost=cost2+(vests*Type2Cost);\n\n }\n else if(scarves<vests &&(jackets-ties)<scarves)\n {\n MaxCost=cost2+(scarves*Type2Cost);\n }\n else\n {\n MaxCost=cost2+(Type2Cost*(jackets-ties));\n }\n\n }\n else\n {\n MaxCost=ties*jackets;\n }\n printf(\"%d\\n\",MaxCost);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b,int c)\n{\nif(a<b)\n{\nif(a<c)\nreturn a;\nelse\nreturn c;\n}\nelse\n{\nif(b<c)\nreturn b;\nelse\nreturn c;\n}\n}\nint main()\n{\n int a, b, c, d, e, f,y;\n long long cost=0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(a>=d)\n cost=d*e;\n else\n {\n cost=a*e;\n d-=a;\n }\n y=min(b,c,d);\n cost+=y*f;\n }\n else\n {\n y=min(b,c,d);\n cost=y*f;\n d-=y;\n if(d>=a)\n cost+=a*e;\n else\n cost+=d*e;\n }\n printf(\"%lld\",cost);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int sum=0,a,b,c,d,e,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n while (d!=0)\n {\n if(e>f)\n {\n if(a>0){\n a--;\n d--;\n sum+=e;\n\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(f>e)\n {\n if(b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a>0&&(b<=0||c<=0))\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n if(e==f)\n {\n if(a>0)\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;\n }\n if(a<=0&&(b<=0||c<=0))\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n long int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0 && cs > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0 && cf > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n printf(\"\\n\\n%ld\\n\",total);\n }\n else{\n\n if(t > 0 && j > 0 && cf > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + (cf * min2);\n\n\n }\n if(s > 0 && v > 0 && j > 0 && cs > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n printf(\"\\n\\n%ld\\n\",total);\n }\n\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int a,b,c,d,e,f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n d-=min(a,d);\n int j= min(b,min(c,d));\n int g= e*min(a,d) + f*j;\n printf(\"%d\",g);\n }\n else\n {\n int j=min(b,min(c,d));\n d-=j;\n int g= e*min(a,d)+ f*j;\n printf(\"%d\",g);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f,h=0,sum=0;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d\",&b);\n\tscanf(\"%d\",&c);\n\tscanf(\"%d\",&d);\n\tscanf(\"%d\",&e);\n\tscanf(\"%d\",&f);\n\tif(e>f)\n\t{\n\t\tif(a>d)\n\t\t{\n\t\t\tsum=d*e;\n\t\t\td=0;\n\t\t\th=0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum=a*e;\n\t\t\td-=a;\n\t\tif(b>c && d>c)\n\t{\n\t\th=f*c;\n\t\td-=c;\n\t\tb-=c;\n\t\tc=0;\n\t}\n\tif(c>d && b>d)\n\t{\n\t\th=f*d;\n\t\tc-=d;\n\t\tb-=d;\n\t\td=0;\n\t}\n\tif(c>b && d>b)\n\t{\n\t\th=f*b;\n\t\td-=b;\n\t\tc-=b;\n\t\tb=0;\n\t}\n\t\t}\n\t\t\n}\nelse\n{\n\tif(b>c && d>c)\n\t{\n\t\th=f*c;\n\t\td-=c;\n\t\tb-=c;\n\t\tc=0;\n\t}\n\tif(c>d && b>d)\n\t{\n\t\th=f*d;\n\t\tc-=d;\n\t\tb-=d;\n\t\td=0;\n\t}\n\tif(c>b && d>b)\n\t{\n\t\th=f*b;\n\t\td-=b;\n\t\tc-=b;\n\t\tb=0;\n\t}\n\tif(d>=a && d!=0 && a!=0)\n\t{\n\t\tsum=e*a;\n\t}\n\telse if(d<a && d!=0 && a!=0)\n\t{\n\t\tsum=e*d;\n\t}\n}\n\tprintf(\"%d\",sum+h);\n\t\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n }\n else{\n\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n }\n printf(\"\\n\\n%d\\n\",total);\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int sum=0,a,b,c,d,e,f;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n while (d!=0)\n {\n if(e>f)\n {\n if(a>0){\n a--;\n d--;\n sum+=e;\n\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a<=0&&b<=0||c<=0)\n break;\n }\n if(f>e)\n {\n if(b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;}\n if(a>0&&b<=0||c<=0)\n {\n a--;\n d--;\n sum+=e;\n\n }\n if(a<=0&&b<=0||c<=0)\n break;\n }\n else\n {\n if(a>0)\n {\n a--;\n d--;\n sum+=e;\n }\n if(a<=0&&b>0&&c>0)\n {\n b--;\n c--;\n d--;\n sum+=f;\n }\n if(a<=0&&b<=0||c<=0)\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int a, b, c, d, e, f;\n\n scanf (\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\n if (f >= e)\n {\n if (b < c && b < d)\n {\n d = d - b;\n if (d < a)\n {\n printf (\"%d\\n\", (b*f)+(e*d));\n }\n else if (d >= a)\n {\n printf (\"%d\\n\", (b*f)+(e*a));\n }\n }\n else if (c < d && c < b)\n {\n d = d - c;\n if (d < a)\n {\n printf (\"%d\\n\", (c*f)+(e*d));\n }\n else if (d >= a)\n printf (\"%d\\n\", (c*f)+(e*a));\n }\n else\n {\n printf (\"%d\\n\", (d*f));\n }\n }\n else\n {\n if (a > d)\n printf (\"%d\\n\", d*e);\n else\n {\n d = d - a;\n if (d <= b && d <= c)\n printf (\"%d\\n\", (d*f)+(a*e));\n else\n printf (\"%d\\n\", a*e);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int a,b,c,d,e,f,cost;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n if(d<a)\n {\n cost=d*e;\n }\n else\n {\n if((d-a)<b&&(d-a)<c)\n\n cost=a*e+(d-a)*f;\n else if(c<b)\n cost=a*e+(c)*f;\n\n else\n cost=a*e+(b)*f;\n\n }\n }\n else\n {\n if(d<b && d<c)\n {\n cost=d*f;\n }\n else\n {\n if(b<c)\n cost=b*f+(d-b)*e;\n else\n cost=c*f+(d-c)*e;\n }\n }\n\n printf(\"%d\",cost);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint find_min(int b, int c, int d)\n{\n if(b<=c && b<=d){\n return b;\n }\n if(c<=b && c<=d){\n return c;\n }\n else {\n return d;\n }\n}\nint main(void)\n{\n int a,b,c,d,e,f;\n int max;\n int le;\n int max1;\n scanf(\"%d %d %d %d %d %d\",&a,&b,&c,&d,&e,&f);\n if(a>=d){\n max=d*e;\n }\n else{\n max=a*e;\n }\n max1=find_min(b,c,d)*f;\n if(find_min(b,c,d)!=d){\n le=d-find_min(b,c,d);\n if(le>a){\n max1+=a*e;\n }\n else{\n max1+=le*e;\n }\n }\n \n if(max>max1){\n printf(\"%d\\n\",max);\n }\n else{\n printf(\"%d\\n\",max1);\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) \n{\n\tint n,t,s,v,j,e,f,c1=0,c2=0,cost;\n\tscanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&e,&f);\n\t(s>v)?(n=v):(n=s);\n\tif (j>=n)\n\t{\n \tj-=n; c1=n*f;\n\t}\n\telse\n\t{\n\t\tn=j; j-=n; c1=n*f;\n\t}\n\tif(j>=t)\n\t{\n\t\tj-=t; c2=t*e;\n\t}\n\telse if(j!=0)\n\t{\n\t\tn=j; c2=n*e;\n\t}\n\tcost=c1+c2;\n\tprintf(\"%d\",cost);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char const *argv[])\n{\n long long a, b, c, d, e, f, max_e, max_f, tmp, total;\n\n scanf(\"%lld\", &a);\n scanf(\"%lld\", &b);\n scanf(\"%lld\", &c);\n scanf(\"%lld\", &d);\n scanf(\"%lld\", &e);\n scanf(\"%lld\", &f);\n\n max_e = a;\n max_f = b < c ? b : c;\n\n if (e > f) {\n tmp = max_f;\n max_f = max_e;\n max_e = tmp;\n\n tmp = f;\n f = e;\n e = tmp;\n }\n\n \n if (d > max_f) {\n total = max_f * f + (d - max_f) * e;\n } else {\n total = d * f;\n }\n\n printf(\"%lld\\n\", total);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int num1,int num2,int num3);\nint main()\n{\n\tint t,s,v,j,e,f,l,p,q,sum;\n\tscanf(\"%d%d%d%d%d%d\",&t,&s,&v,&j,&e,&f);\n\tif(e>f)\n\t{\n\t if(j>t)\n\t \t {\n\t \t q=t*e;\n\t \t j=j-t;\n\t \t if(j>0)\n\t \t {\n\t \t l=min(s,v,j);\n\t p=l*f;\t\n\t\t\t}\n\t \t \t\n\t\t }\n\t\t else\n\t\t {\n\t\t \tq=j*e;\n\t\t \tp=0;\n\t\t \t\n\t\t }\n\t}\n\telse if(f>e)\n\t{\n\t l=min(s,v,j);\n\t j=j-l;\n\t p=l*f;\n\t if(j>0)\n\t {\n\t \t if(j>t)\n\t \t {\n\t \t \tq=t*e;\n\t\t }\n\t\t else\n\t\t {\n\t\t \tq=j*e;\n\t\t }\n\t }\n\t else\n\t {\n\t \tq=0;\n\t }\n\t}\n\tsum=p+q;\n\tprintf(\"%d\",sum);\n\t\n}\nint min(int num1,int num2,int num3)\n{\n\tif(num1 < num2 && num1 < num3)\n\t{\n\t\treturn num1;\n\t}\n\telse if(num2 < num3)\n\t{\n\t\treturn num2;\n\t}\n\telse\n\t{\n\t\treturn num3;\n\t}\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long s,st,st1,a,b,c,d,e,f;\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&a,&b,&c,&d,&e,&f);\n\tst=fmin(fmin(c,d),b);\n\tif(st==d)\n\t\tprintf(\"%lld\\n\",st*f);\n\telse{\n\t\ts=d-st;\n\t\tst1=fmin(s,a);\n\t\tprintf(\"%lld\\n\",st*f+st1*e);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tlong int a,b,c,d,e,f,w[7],y[7],x[7],v[7];\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tscanf(\"%ld\",&d);\n\tscanf(\"%ld\",&e);\n\tscanf(\"%ld\",&f);\n\tif(f>=e)\n\t{\n\t\tif((b<=c)&&(b<=d))\n\t\t{\n\t\t\tw[0]=b*f;\n\t\t\tx[0]=d-b;\n\t\t\tif(a<x[0])\n\t\t\t{\n\t\t\t\ty[0]=a*e;\n\t\t\t\tv[0]=w[0]+y[0];\n\t\t\t\tprintf(\"%ld\",v[0]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[1]=x[0]*e;\n\t\t\t\tv[1]=y[1]+w[0];\n\t\t\t\tprintf(\"%ld\",v[1]);\n\t\t\t}\n\t\t}\n\t\telse if((c<=b)&&(c<=d))\n\t\t{\n\t\t\tw[1]=c*f;\n\t\t\tx[1]=d-c;\n\t\t\tif(a<x[1])\n\t\t\t{\n\t\t\t\ty[2]=a*e;\n\t\t\t\tv[2]=w[1]+y[2];\n\t\t\t\tprintf(\"%ld\",v[2]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[3]=x[1]*e;\n\t\t\t\tv[3]=y[3]+w[1];\n\t\t\t\tprintf(\"%ld\",v[3]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw[2]=d*f;\n\t\t\tprintf(\"%ld\",w[2]);\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tw[3]=a*e;\n\t\t\tx[2]=d-a;\n\t\t\tif((b<=c)&&(b<=x[2]))\n\t\t\t{\n\t\t\t\ty[4]=b*f;\n\t\t\t\tv[4]=y[4]+w[3];\n\t\t\t\tprintf(\"%ld\",v[4]);\n\t\t\t}\n\t\t\telse if((c<=b)&&(c<=x[2]))\n\t\t\t{\n\t\t\t\ty[5]=c*f;\n\t\t\t\tv[5]=y[5]+w[3];\n\t\t\t\tprintf(\"%ld\",v[5]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ty[6]=x[2]*f;\n\t\t\t\tv[6]=y[6]+w[3];\n\t\t\t\tprintf(\"%ld\",v[6]);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw[4]=d*e;\n\t\t\tprintf(\"%ld\",w[4]);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong int min3(long int a,long int b,long int c)\n{\n return (a>b&&a>c)?a:(b>c&&b>a)?b:c;\n}\nlong int min2(long int a,long int b)\n{\n return (a>b)?a:b; \n}\nint main()\n{\n long int t,s,v,j,first,second,cost=0;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&t,&s,&v,&j,&first,&second);\n if(first<second)\n {\n cost+=second*min3(s,v,j);\n j-=min3(s,v,j);\n cost+=first*min2(t,j);\n }\n else\n {\n cost+=first*min2(t,j);\n j-=min2(t,j);\n cost+=second*min3(s,v,j);\n }\n printf(\"%ld\",cost);\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e,f;\n\tscanf(\"%d%d%d%d%d%d\",&a,&d,&c,&b,&e,&f);\n\tint s1=0,s2=0,k,k1;\n\tif(f>e)\n\t{\n\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\ts2+=k*f;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(a<b?a:b);\n\t\t\ts2+=k*e;\n\t\t}\n\t\tk1=s2;\n\t}\n\telse if(e>f)\n\t{\n\t\tk=(a<b?a:b);\n\t\ts1+=k*e;\n\t\tb-=k;\n\t\tif(b!=0)\n\t\t{\n\t\t\tk=(b<c?(b<d?b:d):(c<d?c:d));\n\t\t\ts1+=k*f;\n\t\t}\n\t\tk1=s1;\n\t}\n\telse\n\t{\n k=(b<c?(b<d?b:d):(c<d?c:d));\n\tk1=k*e;\n\tb-=k;\n\tif(b!=0)\n\tk=(a<b?a:b);\n\tk1+=k*e;\n }\n\tprintf(\"%d\\n\",k1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ties,scarves,vests,jackets,Type1Cost,Type2Cost;\n int cost1,cost2,minimum,maximum,MaxCost;\n scanf(\"%d %d %d %d %d %d\",&ties,&scarves,&vests,&jackets,&Type1Cost,&Type2Cost);\n if(Type2Cost>Type1Cost)\n {\n if(scarves<vests &&scarves<jackets)\n {\n minimum=scarves;\n cost1=Type2Cost*scarves;\n }\n else if(vests<scarves&&vests<jackets)\n {\n minimum=vests;\n cost1=Type2Cost*vests;\n }\n else\n {\n minimum=jackets;\n cost1=Type2Cost*jackets;\n }\n int Remain;\n Remain=(jackets-minimum);\n if(ties>Remain)\n {\n cost2=Remain*Type1Cost;\n }\n else\n {\n cost2=ties*Type1Cost;\n }\n MaxCost=cost1+cost2;\n printf(\"%d\\n\",MaxCost);\n\n }\n else\n {\n if(ties>jackets)\n {\n cost2=jackets*Type1Cost;\n MaxCost=cost2;\n }\n else if(ties<jackets)\n {\n int RemainJacket;\n RemainJacket=(jackets-ties);\n cost2=ties*Type1Cost;\n if(scarves>vests &&RemainJacket>vests)\n {\n MaxCost=cost2+(vests*Type2Cost);\n\n }\n else if(scarves<vests &&RemainJacket>scarves)\n {\n MaxCost=cost2+(scarves*Type2Cost);\n }\n else\n {\n MaxCost=cost2+(Type2Cost*RemainJacket);\n }\n\n }\n else\n {\n MaxCost=ties*jackets;\n }\n printf(\"%d\\n\",MaxCost);\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define MIN(a, b) ((a) < (b)) ? (a) : (b)\n#define MINN(a, b, c) (MIN((a), (b))) < c ? (MIN((a), (b))) : c\n\nint a, b, c, d, e, f;\n// costume type N:1 == a && d\n// costume type N:2 == b && c && d\n// e == price of costume N:1\n// f == price of costume N:2\n\nint costume_1 = 0;\nint costume_2 = 0;\n\nint main (void)\n{\n int tmp;\n //printf (\"Enter amount of your stuff: \");\n scanf (\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n //printf (\"Enter your price of the costumes: \");\n //scanf (\"%d %d\", &e, &f);\n costume_2 = MINN(b, c, d);\n tmp = MINN(b, c, d);\n if (b >= tmp)\n b -= tmp;\n if (c >= tmp)\n c -= tmp;\n if (d >= tmp)\n d -= tmp;\n costume_1 = MIN(a, d);\n printf (\"%d\", costume_1 * e + costume_2 * f);\n exit (0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n long long int t,s,v,j,i,e,f,min;\n long long int sum;\n\n scanf (\"%lld%lld%lld%lld\",&t,&s,&v,&j);\n scanf (\"%lld%lld\",&e,&f);\n if (e<f){\n min = s;\n if (min > v)\n min = v;\n if (min > j)\n min = j;\n j = j -min;\n sum = min*f;\n if (t>j)\n min = j;\n else min = t;\n sum = sum + min*e;\n printf (\"%lld\\n\",sum);}\n else\n {\n min = t;\n if (j<min)\n min = j;\n j = j-min;\n sum = min*e;\n if (min > s)\n min = s;\n if (min > v)\n min = v;\n sum = sum + min*f;\n printf (\"%lld\\n\",sum);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int a,b,c,d,e,f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n d-=min(a,d);\n int j= min(b,min(c,d));\n int g= e*min(a,d) + f*j;\n printf(\"%d\",g);\n }\n else\n {\n int j=min(b,min(c,d));\n d-=j;\n int g= e*min(a,d)+ f*j;\n printf(\"%d\",g);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long a,b,c,d,e,f,min2,min1;\n\tscanf(\"%lld %lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e,&f);\nif(e < f)\n{\n\tif(b <= c && b <= d)\n\t{\n\t\tmin2 = b;\n\t}\n\telse if(c <= d && c <= b)\n\t{\n\t\tmin2 = c;\n\t}\n\telse{\n\t\tmin2 = d;\n\t}\n\td -= min2;\n\t\n\tmin1 = (a < d) ? a : d;\n\tif(min1 < 0)\n\t{\n\t\tmin1 *= -1;\n\t}\n\n\tmin2 *= f;\n\tmin1 *= e;\n\tprintf(\"%lld\",min1+min2);\n}\nelse{\n\tif(a <= d)\n\t{\n\t\tmin1 = a;\n\t}\n\telse{\n\t\tmin1 = d;\n\t}\n\td -= min1;\n\n\tprintf(\"%lld\",min1*e);\n}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, c, d, e, f, sum, b1, c1;\n scanf(\"%d%d%d%d%d%d\", &a, &b, &c, &d, &e, &f);\n if (b > c) {\n b1 = b;\n c1 = c;\n }\n else {\n b1 = c;\n c1 = b;\n }\n if (e > f) {\n if (a >= d)\n printf(\"%d\\n\", d * e);\n else {\n if (b > c) {\n if (d - a > c)\n printf(\"%d\\n\", a * e + c * f);\n else\n printf(\"%d\\n\", a * e + (d - a) * f);\n }\n }\n }\n else if (e == f) {\n if (a + c1 >= d)\n printf(\"%d\\n\", d * e);\n else\n printf(\"%d\\n\", a * e + c1 * f);\n }\n else {\n if (c1 >= d)\n printf(\"%d\\n\", d * f);\n else {\n if (d - c1 > a)\n printf(\"%d\\n\", c1 * f + a * e);\n else\n printf(\"%d\", c1 * f + (d - c1) * e);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int a,int b,int c){\n int min = a;\n if(min>b){\n min = b;\n }\n if(min > c){\n min = c;\n }\n return min;\n}int max(int a,int b,int c){\n int min = a;\n if(min<b){\n min = b;\n }\n if(min < c){\n min = c;\n }\n return min;\n}\nint main()\n{\n int a,b,c,d;\n int e,f;\n int sum1 = 0;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n int sum2= 0,sum3=0,sum4=0;\n int x;\n int maxaandd = a,minanda = d;\n if(a < d){\n maxaandd = d;\n minanda = a;\n }\n x = min(d,b,c);\n sum1+=x*f;\n sum1+= (d-x)*e;\n sum2+= maxaandd*e;\n sum3+= minanda*e;\n sum3+= (d - minanda)*f;\n sum4 +=max(d,b,c)*f;\n int z;\n printf(\"%d\",max(sum1,sum2,sum3));\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int,int,int);\n\nint main(){\n int t,s,v,j,cf,cs,total = 0;\n int min1,min2,max1;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&cf,&cs);\n max1 = ( cf >= cs ? cf : cs );\n if(max1 == cs){\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n }\n else{\n\n if(t > 0 && j > 0){\n\n min2 = (t < j ? t : j);\n\n total = total + cf * min2;\n\n\n }\n if(s > 0 && v > 0 && j > 0){\n min1 = min(s,v,j);\n total = total + ( cs * min1 ) ;\n s = s - min1;\n v = v - min1;\n j = j - min1;\n }\n }\n printf(\"\\n\\n%d\\n\",total);\n return 0;\n}\n\nint min(int s, int v, int j){\n int min1;\n min1 = (s < v ? (s < j ? s : j ) : ( v < j ? v : j));\n return min1;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min1, min2, cost;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if (e >= f)\n {\n min1 = a < d? a : d;\n d = d - min1;\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n else\n {\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n d = d - min2; \n min1 = a < d? a : d; \n printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n printf(\"%d\",cost);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\tif(a > b)\n\t\treturn b;\n\telse\n\t\treturn a;\n\n\n}\nint max(int a,int b)\n{\n if(a > b)\n return a;\n else\n return b;\n\n\n}\n\n\nint main()\n{\n\tint a,b,c,d,e,f;\n\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n\tint p = min(a,d);\n\tint mn = min(b,c);\n\tint q = min(mn,d);\n\n\tmn = max(e*p,f*q);\n\n\tif( f > e)\n\t{\n\t\tif(p + q < d)\n\t\t{\n\t\t\tmn = max(mn, e*p + f*q);\n\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\twhile( q > 0)\n\t\t\t{\n\t\t\t\tif( q < d && d < p + q)\n\t\t\t\t{\n\t\t\t\t\tp = d-q;\n\t\t\t\t\tmn = max(mn, e*p + f*q); \n\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tq--;\n\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t}\n\t\n\t\n\t}\n\n\telse\n\t{\n\tif(p + q < d)\n {\n mn = max(mn, e*p + f*q);\n\n }\n\n else\n {\n while( p > 0)\n {\n if( p < d && d < p+q)\n {\n q = d-p;\n mn = max(mn, e*p + f*q);\n\n }\n\n p--;\n\n\n }\n\n\n }\n\n\n\t\n\t}\n\tprintf(\"%d\",mn);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a, b, c, d, e, f, c1=0;\n int c2=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&c);\n scanf(\"%d\",&d);\n scanf(\"%d\",&e);\n scanf(\"%d\",&f);\n if(e>f)\n {\n while((a!=0)&&(d!=0))\n {\n c1 = c1 + e;\n a--;\n d--;\n }\n while((b!=0)&&(c!=0)&&(d!=0))\n {\n c2 = c2 + f;\n c--;\n d--;\n b--;\n }\n }\n else if(f>e)\n {\n while((b!=0)&&(c!=0)&&(d!=0))\n {\n c2 = c2 + f;\n c--;\n d--;\n b--;\n }\n while((a!=0)&&(d!=0))\n {\n c1 = c1 + e;\n a--;\n d--;\n }\n }\n printf(\"%d\", (c1 + c2));\n} \n \n "}, {"source_code": "#include <stdio.h>\nint smaller(int a,int b ,int c)\n{\n int temp =0;\n if(a <= b && a <= c)\n temp= a;\n else if(b <= c && b <= a)\n temp= b;\n else if (c <= a && b <= a)\n temp= c;\n\n return temp;\n\n\n\n\n}\nint main()\n{\n int t,s,v,j,s1,s2;\n scanf(\"%d %d %d %d %d %d\",&t,&s,&v,&j,&s1,&s2);\n int cost1=0, cost2=0;\n if(t<s1)\n cost1=t*s1;\n else\n cost1=j*s1;\n t=smaller(s,v,j);\n cost2=t*s2;\n if(cost1 > cost2)\n printf(\"%d\",cost1);\n else\n printf(\"%d\",cost2);\n return 0;\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint min1(int a, int b, int c){\n\tint minn=a;\n\tif(minn>b){\n\t\tminn=b;\n\t}\n\tif(minn>c){\n\t\tminn=c;\n\t}\n\treturn minn;\n}\nint min2(int a, int b){\n\tint minn=a;\n\tif(minn>b){\n\t\tminn=b;\n\t}\n\treturn minn;\n}\nint main(){\n\tint a,b,c,d,e,f;//a=ties, b=scarf, c=vest, d=jacket\n\tscanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\tint total=0;\n\tif(f>e){\n\t\tint n=min1(b,c,d);\n\t\ttotal=total+(n*f);\n\t\tb-=n;\n\t\tc-=n;\n\t\td-=n;\n\t}\n\t\n\t\tint n=min2(a,d);\n\t\ttotal=total+(n*e);\n\t\ta-=n;\n\t\td-=n;\n\t\n\tprintf(\"%d\\n\", total);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int num1,int num2,int num3);\nint main()\n{\n\tint t,s,v,j,e,f,l,p,q,sum;\n\tscanf(\"%d%d%d%d%d%d\",&t,&s,&v,&j,&e,&f);\n\tif(e>f)\n\t{\n\t if(j>t)\n\t \t {\n\t \t q=t*e;\n\t \t j=j-t;\n\t \t if(j>0)\n\t \t {\n\t \t l=min(s,v,j);\n\t p=l*f;\t\n\t\t\t}\n\t \t \t\n\t\t }\n\t\t else\n\t\t {\n\t\t \tq=j*e;\n\t\t \tp=0;\n\t\t \t\n\t\t }\n\t}\n\telse if(f>e)\n\t{\n\t l=min(s,v,j);\n\t j=j-l;\n\t p=l*f;\n\t if(j>0)\n\t {\n\t \t if(j>t)\n\t \t {\n\t \t \tq=t*e;\n\t\t }\n\t\t else\n\t\t {\n\t\t \tq=j*e;\n\t\t }\n\t }\n\t else\n\t {\n\t \tq=0;\n\t }\n\t}\n\tsum=p+q;\n\tprintf(\"%d\",sum);\n\t\n}\nint min(int num1,int num2,int num3)\n{\n\tif(num1 < num2 && num1 < num3)\n\t{\n\t\treturn num1;\n\t}\n\telse if(num2 < num3)\n\t{\n\t\treturn num2;\n\t}\n\telse\n\t{\n\t\treturn num3;\n\t}\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint a, b, c, d, e, f;\n\tscanf(\"%d %d %d %d %d %d\", &a, &b, &c, &d, &e, &f);\n\tint min1;\n\tif(b < c){\n\t\tif(d < b)\n\t\t\tmin1 = d;\t\n\t\telse\n\t\t\tmin1 = b;\n\t}\n\telse{\n\t\tif(d < c)\n\t\t\tmin1 = d;\n\t\telse\n\t\t\tmin1 = c;\n\t}\n\tint min2;\n\tif(d - min1 < a)\n\t\tmin2 = d - min1;\n\telse\n\t\tmin2 = a;\n\tprintf(\"%d\", min1 * f + min2 * e);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\tif(a > b)\n\t\treturn b;\n\telse\n\t\treturn a;\n\n\n}\nint max(int a,int b)\n{\n if(a > b)\n return a;\n else\n return b;\n\n\n}\n\n\nint main()\n{\n\tint a,b,c,d,e,f;\n\n\tscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n\n\tint p = min(a,d);\n\tint mn = min(b,c);\n\tint q = min(mn,d);\n\n\tmn = max(e*p,f*q);\n\n\tif( f > e)\n\t{\n\t\tif(p + q < d)\n\t\t{\n\t\t\tmn = max(mn, e*p + f*q);\n\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\twhile( q > 0)\n\t\t\t{\n\t\t\t\tif( q < d && d < p + q)\n\t\t\t\t{\n\t\t\t\t\tp = d-q;\n\t\t\t\t\tmn = max(mn, e*p + f*q); \n\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tq--;\n\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t}\n\t\n\t\n\t}\n\n\telse\n\t{\n\tif(p + q < d)\n {\n mn = max(mn, e*p + f*q);\n\n }\n\n else\n {\n while( p > 0)\n {\n if( p < d && d < p+q)\n {\n q = d-p;\n mn = max(mn, e*p + f*q);\n\n }\n\n p--;\n\n\n }\n\n\n }\n\n\n\t\n\t}\n\tprintf(\"%d\",mn);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,s,x;\nscanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\nx=b;\nif(x>c)\nx=c;\nif(x>d)\nx=d;\n\n\nif(f>e)\n{\nd=d-x;\nx=x*f;\nif(d>a)\n{\ns=e*a;\n}\nif(a>d||a==d)\n{\ns=e*d;\n}\n}\nif(e>f||e==f)\n{\n if(a<d)\n {\n s=e*a;\n d=d-a;\n }\n if(d<a)\n {\n s=e*d;\n d=0;\n }\n\n if(x>d)\n x=d;\n\n x=x*f;\n\n}\n\nprintf(\"%d\\n\",s+x);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong int min3(long int a,long int b,long int c)\n{\n return (a>b&&a>c)?a:(b>c&&b>a)?b:c;\n}\nlong int min2(long int a,long int b)\n{\n return (a>b)?a:b; \n}\nint main()\n{\n long int t,s,v,j,first,second,cost=0;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&t,&s,&v,&j,&first,&second);\n if(first<second)\n {\n cost+=second*min3(s,v,j);\n j-=min3(s,v,j);\n cost+=first*min2(t,j);\n }\n else\n {\n cost+=first*min2(t,j);\n j-=min2(t,j);\n cost+=second*min3(s,v,j);\n }\n printf(\"%ld\",cost);\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d, e, f, min1, min2, cost;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if (e >= f)\n {\n min1 = a < d? a : d;\n d = d - min1;\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n else\n {\n if (b <= c)\n {\n if (b <= d)\n min2 = b;\n else\n min2 = d;\n }\n else\n min2 = c;\n d = d - min2; \n min1 = a < d? a : d; \n printf(\"%d__%d\\n\",min1,min2);\n cost = min1*e + min2*f;\n }\n printf(\"%d\",cost);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nlong a,b,c,d,e,f,maxf,maxe,n;\nint main()\n{\n scanf(\"%ld\", &a);\n scanf(\"%ld\", &b);\n scanf(\"%ld\", &c);\n scanf(\"%ld\", &d);\n scanf(\"%ld\", &e);\n scanf(\"%ld\", &f);\n maxf = b;\n if (maxf > c) maxf = c;\n if (maxf > d) maxf = d;\n maxe = a;\n if (maxe > d) maxe = d;\n if (f > e) n = f *maxf + e * (d - maxf);\n else n = e *maxe + f * (d - maxe);\n printf(\"%ld\", n);\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int a,b,c,d,e;\n int f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n d-=min(a,d);\n int j= min(b,min(c,d));\n int g= e*min(a,d) + f*j;\n printf(\"%d\",g);\n }\n else\n {\n int j=min(b,min(c,d));\n d-=j;\n int g= e*min(a,d)+ f*j;\n printf(\"%d\",g);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n\tint i, index, index2, suit1Cost, suit2Cost, remainder, total=0;\n\tunsigned int clothes[4];\n\tunsigned int smallest = 100001;\n\n\tscanf(\"%d\", &clothes[0]);\n\tscanf(\"%d\", &clothes[1]);\n\tscanf(\"%d\", &clothes[2]);\n\tscanf(\"%d\", &clothes[3]);\n\tscanf(\"%d\", &suit1Cost);\n\tscanf(\"%d\", &suit2Cost);\n\n\tfor (i = 0; i < 4; i++) {\n\t\tif (clothes[i] < smallest) {\n\t\t\tsmallest = clothes[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tif (suit1Cost < suit2Cost) {\n\t\tif (index == 0) {\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (index == 3) {\n\t\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tremainder = clothes[3] - smallest;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (remainder * suit2Cost);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal = ((smallest)*suit1Cost) + (clothes[0] * suit2Cost);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\n\t\t\ttotal = clothes[index] * suit2Cost;\n\t\t}\n\t\telse {\n\t\t\tremainder = clothes[3] - smallest;\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = smallest * suit2Cost;\n\t\t\t\tif (remainder <= clothes[0]) {\n\t\t\t\t\ttotal += remainder * suit1Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += clothes[0] * suit1Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit2Cost;\n\t\t\t}\n\t\t}\n\t}\n\telse if (suit1Cost > suit2Cost) {\n\t\tremainder = clothes[3] - clothes[0];\n\t\tif (index == 0) {\n\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\tsmallest = 100001;\n\t\t\tfor (i = 1; i < 4; i++) {\n\t\t\t\tif (clothes[i] < smallest) {\n\t\t\t\t\tsmallest = clothes[i];\n\t\t\t\t\tindex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (remainder <= smallest) {\n\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t}\n\t\t}\n\t\telse if (index == 3) {\t\n\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t}\n\t\telse {\n\t\t\tif (remainder > 0) {\n\t\t\t\ttotal = clothes[0] * suit1Cost;\n\t\t\t\tif (remainder <= smallest) {\n\t\t\t\t\ttotal += remainder * suit2Cost;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttotal += smallest * suit2Cost;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotal = clothes[3] * suit1Cost;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\", total);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a,b,c,d,e,f,t;\n\n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n scanf(\"%d\", &c);\n scanf(\"%d\", &d);\n scanf(\"%d\", &e);\n scanf(\"%d\", &f);\n if(e>f)\n {\n if(d>a)\n {\n e=e*a;\n d=d-e;\n }\n else\n {\n e=e*d;\n d=0;\n }\n\n if(d<=b && d<=c)\n {\n f=f*d;\n }\n else if(b<=d && b<=c)\n {\n f=f*b;\n }\n else if(c<=d && c<=b)\n {\n f=f*c;\n }\n }\n else\n {\n if(d<=b && d<=c)\n {\n f=f*d;\n d=0;\n }\n else if(b<=d && b<=c)\n {\n f=f*b;\n d=d-b;\n }\n else if(c<=d && c<=b)\n {\n f=f*c;\n d=d-c;\n }\n\n if(d>a)\n {\n e=e*a;\n }\n else\n {\n e=e*d;\n }\n }\n\n t=e+f;\n printf(\"%d\\n\", t);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long int a,b,c,d,e,f,n=0,A=0;\n\tscanf(\"%lu %lu %lu %lu %lu %lu\",&a,&b,&c,&d,&e,&f);\nif((b<=c) && (b<=d))\n{\n\td=d-b;\n\tA=b*f;\n}\nelse if((c<=b) && (c<=d))\n{\n\td=d-c;\n\tA=c*f;\n}\nelse\n{\n\tA=d*f;\n\td=0;\n}\nif(d!=0)\n{\n\tif(a<=d)\n\tA=A+(a*e);\n\telse \n\tA=A+(d*e);\n}\nprintf(\"%lu\\n\",A);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int a,b,c,d,e,f;\n scanf(\"%d%d%d%d%d%d\",&a,&b,&c,&d,&e,&f);\n if(e>f)\n {\n d-=min(a,d);\n int j= min(b,min(c,d));\n int g= e*min(a,d) + f*j;\n printf(\"%d\",g);\n }\n else\n {\n int j=min(b,min(c,d));\n d-=j;\n int g= e*min(a,d)+ f*j;\n printf(\"%d\",g);\n }\n return 0;\n}\n"}], "src_uid": "84d9e7e9c9541d997e6573edb421ae0a"} {"nl": {"description": "A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you were on his place? One day, when he came to his friend Evan, Om Nom didn't find him at home but he found two bags with candies. The first was full of blue candies and the second bag was full of red candies. Om Nom knows that each red candy weighs Wr grams and each blue candy weighs Wb grams. Eating a single red candy gives Om Nom Hr joy units and eating a single blue candy gives Om Nom Hb joy units.Candies are the most important thing in the world, but on the other hand overeating is not good. Om Nom knows if he eats more than C grams of candies, he will get sick. Om Nom thinks that it isn't proper to leave candy leftovers, so he can only eat a whole candy. Om Nom is a great mathematician and he quickly determined how many candies of what type he should eat in order to get the maximum number of joy units. Can you repeat his achievement? You can assume that each bag contains more candies that Om Nom can eat.", "input_spec": "The single line contains five integers C,\u2009Hr,\u2009Hb,\u2009Wr,\u2009Wb (1\u2009\u2264\u2009C,\u2009Hr,\u2009Hb,\u2009Wr,\u2009Wb\u2009\u2264\u2009109).", "output_spec": "Print a single integer \u2014 the maximum number of joy units that Om Nom can get.", "sample_inputs": ["10 3 5 2 3"], "sample_outputs": ["16"], "notes": "NoteIn the sample test Om Nom can eat two candies of each type and thus get 16 joy units."}, "positive_code": [{"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#define uint unsigned int\n#define uchar unsigned int\nuint get_nums(unsigned long ans[], char *str);\n\n\n// {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}\nint main(void) {\nchar str[57];\nfgets(str,57,stdin);\nunsigned long buf[5];\nget_nums(buf,str);\n\n\n#define C buf[0]\n#define Hr buf[1]\n#define Hb buf[2]\n#define Wr buf[3]\n#define Wb buf[4]\n\nunsigned long long ans=0;\nconst unsigned long long z= C/Wr;\n\nfor ( unsigned long long n1=z; (n1>0)&(z-n1<=100000); n1-- )\n{\t\n\tunsigned long long tmp = n1*Hr + Hb*(( C - n1*Wr)/Wb);\n\tif ( tmp > ans) ans=tmp;\n}\n\nconst unsigned long long z2= C/Wb;\nfor ( unsigned long long n1=z2; (n1>0)&(z2-n1<=100000); n1-- )\n{ \n unsigned long long tmp = n1*Hb + Hr*(( C - n1*Wb)/Wr);\n if ( tmp > ans) ans=tmp;\n}\n\n\n\n\tprintf(\"%I64u\",ans);\n\treturn 0;\n}\n\n\n\n// =======================================\n//========================================\n// =======================================\nunsigned int get_nums(unsigned long ans[], char *str)\n{\nint i=0;\nint p=0;\nunsigned int n=0;\nchar tmp[64];\nif (str[0]==0) return 0;\n\nwhile( i<=strlen(str) )\n\t{\n\tif ((str[i]==32)|(i==strlen(str))) {\n\t\t\ttmp[p]=0;\n\t\t\tans[n]=atoi(tmp);\n\t\t\t//printf(\"%d \",ans[n]);\n\t\t\tn++;\n\t\t\tp=0;\n\t\t\t}\n\ttmp[p]=str[i];\n\tp++;\n\ti++;\n\t}\nreturn n;\n} // =========================================\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long long int e,a,b,c,d,i,j,m=0,n=0,rem=0,max=-100000000,f;\n scanf(\"%lld %lld %lld %lld %lld\",&e,&a,&b,&c,&d);\n double r=(double)a/(double)c;\n double k=(double)b/(double)d;\n //printf(\"%lf %lf\\n\",r,k);\n if(r>2*k&&e>=c){\n m=e/c;\n printf(\"%lld\",m*a);\n }\n else if(k>2*r && e>=d){\n n=e/d;\n printf(\"%lld\",n*b);\n }\n else if(a==b && c==d){\n printf(\"%lld\",(e/c)*a);\n }\n else if(r>k){\n m=e/c;\n //printf(\"%lld\\n\",m);\n if(m==0){\n printf(\"%lld\",(e/d)*b);\n return 0;\n }\n rem=e%c;\n n=rem/d;\n if(e%c==0){\n m=e/c;\n max=m*a;\n }\n else{\n while(m!=-1 && rem<=e){\n n=rem/d;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%d==0)break;\n if(rem<d){\n if((d-rem)%c==0){\n m=m-(d-rem)/c;\n rem=rem+(d-rem);\n }\n else { \n m=m-(d-rem)/c-1;\n rem=rem+((d-rem)/c+1)*c;\n }\n continue;\n }\n rem=rem+c;\n m--;\n }\n }\n printf(\"%lld\",max);\n }\n else{\n n=e/d;\n if(n==0){\n printf(\"%lld\",(e/c)*a);\n return 0;\n }\n rem=e%d;\n m=rem/c;\n if(e%d==0){\n n=e/d;\n max=n*b;\n }\n else{\n while(n!=-1 && rem<=e){\n m=rem/c;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%c==0)break;\n if(rem<c){\n if((c-rem)%d==0){\n n-=(c-rem)/d;\n rem+=(c-rem);\n }\n else {\n n-=(c-rem)/d+1;\n rem+=((c-rem)/d+1)*d;\n }\n continue;\n }\n n--;\n rem=rem+d;\n }\n }\n printf(\"%lld\",max);\n }\n return 0;\n //getch();\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c, wr, wb;\n long long hr, hb;\n long long ans;\n\n scanf(\"%d %lld %lld %d %d\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n for (i = 0; i <= c / wr && i * i <= c; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n for (i = 0; i <= c / wb && i * i <= c; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n long long ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) > 10000)\n if (wr > wb)\n for (i = 0; c - wr * i >= 0; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; c - wb * i >= 0; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; c - wr * i >= 0 && i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n long long ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) * max(wr, wb) > c)\n if (wr > wb)\n for (i = 0; c - wr * i >= 0; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; c - wb * i >= 0; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; c - wr * i >= 0 && i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n long long ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) > 10000)\n if (wr > wb)\n for (i = 0; wr * i <= c; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; wb * i <= c; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; c - wr * i >= 0 && i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c, wr, wb;\n long long hr, hb;\n long long ans;\n\n scanf(\"%d %lld %lld %d %d\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n for (i = 0; i <= c / wr && i * i <= c; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n for (i = 0; i <= c / wb && i * i <= c; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n "}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nvoid swap(long long *a, long long *b)\n{\n long long t = *a; *a = *b; *b = t;\n}\n\nint main()\n{\n long long c, hr, hb, wr, wb;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &c, &hr, &hb, &wr, &wb);\n\n long long sqrtc = sqrt(c), cntbmax;\n if (wr >= sqrtc || wb >= sqrtc) {\n if (wr > wb) {\n swap(&hr, &hb);\n swap(&wr, &wb);\n }\n // Guaranteed that wr <= sqrt(c) <= wb\n cntbmax = c / wb;\n } else {\n if (hb * wr > hr * wb) {\n swap(&hr, &hb);\n swap(&wr, &wb);\n }\n // Guaranteed that hb * wr <= wb * hr\n cntbmax = wr - 1;\n }\n\n long long ans = 0, cntb;\n for (cntb = 0; cntb <= cntbmax; ++cntb) {\n long long cur = cntb * hb + (c - cntb * wb) / wr * hr;\n if (cur > ans) ans = cur;\n }\n\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tlong long c ,h1 ,h2 ,w1 ,w2 ,temp;\n\tlong long ans ,ans2;\n\tlong long k1 ,k2;\n\tlong long i;\n\tlong long n1 ,n2;\n\tlong long p1 ,p2 ,p12;\n\t\n\twhile (scanf(\"%I64d %I64d %I64d %I64d %I64d\" ,&c ,&h1 ,&h2 ,&w1 ,&w2)!=EOF)\n\t{\n\t\tif (h2*w1>h1*w2)\t\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t}\n\t\telse if (h2*w1==h1*w2&&w2<w1)\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\t\t\t\n\t\t}\n\t\tk1=c/(w1*w2);\n\t\tif (k1)k1--;\n\t\tc-=k1*w1*w2;\n\t\tans=k1*h1*w2;\n\t\tn1=c/w1;\n\t\tn2=c/w2;\n\t\tif (n2<n1)\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t\ttemp=n2;\n\t\t\tn2=n1;\n\t\t\tn1=temp;\t\t\t\n\t\t}\n\t\tans2=0;\n\t\tfor (i=0 ; i<=n1 ; i++)\n\t\t{\n\t\t\tp1=0;\n\t\t\tp2=n2;\n\t\t\twhile (p1<p2)\n\t\t\t{\n\t\t\t\tp12=(p1+p2+1)/2;\n\t\t\t\tif (i*w1+p12*w2<=c)\n\t\t\t\t{\n\t\t\t\t\tp1=p12;\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp2=p12-1;\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (p1*h2+i*h1>ans2)\n\t\t\t{\n\t\t\t\tans2=p1*h2+i*h1;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\" ,ans+ans2);\n\t}\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tint c, hr, hb, wr, wb, sq;\n\tlong long max, r, b;\n\n\tscanf(\"%d%d%d%d%d\", &c, &hr, &hb, &wr, &wb);\n\tif (hr * wb > hb * wr) {\n\t\tint tmp;\n\n\t\ttmp = hr, hr = hb, hb = tmp;\n\t\ttmp = wr, wr = wb, wb = tmp;\n\t}\n\tsq = sqrt(c), max = 0;\n\tif (wb > sq)\n\t\tfor (b = 0; b * wb <= c; b++) {\n\t\t\tr = (c - b * wb) / wr;\n\t\t\tif (max < r * hr + b * hb)\n\t\t\t\tmax = r * hr + b * hb;\n\t\t}\n\telse\n\t\tfor (r = 0; r < wb && r * wr <= c; r++) {\n\t\t\tb = (c - r * wr) / wb;\n\t\t\tif (max < r * hr + b * hb)\n\t\t\t\tmax = r * hr + b * hb;\n\t\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define LEVEL 1\nint main(){\n\tlong long int i,c,hr,hb,wr,wb,tmp,happy,max,happybase,num;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&hr,&hb,&wr,&wb);\n\thappybase=0;\t\n\tif(c>(wr*wb*(LEVEL+1))){\n\t\tnum=(c/(wr*wb))-LEVEL;\n\t\tif((hr*wb)>=(hb*wr)){\n\t\t\thappybase=(hr*wb)*num;\n\t\t}else{\n\t\t\thappybase=(hb*wr)*num;\n\t\t}\n\t\tc-=(wr*wb)*num;\n\t}\n\tmax=0;\n\tif(wr>=wb){\n\t\tfor(i=0;(wr*i)<=c;i++){\n\t\t\ttmp=c-(wr*i);\n\t\t\thappy=(tmp/wb)*hb;\n\t\t\thappy+=(hr*i);\n\t\t\tif(max<happy){\n\t\t\t\tmax=happy;\n\t\t\t}\n\t\t}\n\t}else{\n\t\tfor(i=0;(wb*i)<=c;i++){\n\t\t\ttmp=c-(wb*i);\n\t\t\thappy=(tmp/wr)*hr;\n\t\t\thappy+=(hb*i);\n\t\t\tif(max<happy){\n\t\t\t\tmax=happy;\n\t\t\t}\n\t\t}\n\t}\t\n\tprintf(\"%lld\",happybase+max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int c,hr,hb,wr,wb,happy=0,qr,qb,ans=0,temp;\n int i,j;\n scanf(\"%I64d\",&c);\n scanf(\"%I64d\",&hr);\n scanf(\"%I64d\",&hb);\n scanf(\"%I64d\",&wr);\n scanf(\"%I64d\",&wb);\n if(wr>=sqrt(c))\n {\n for(i=0;i<=c/wr;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n //printf(\"temp:%I64d\\n\",temp);\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wb>=sqrt(c))\n {\n for(i=0;i<=c/wb;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n //printf(\"temp:%I64d\\n\",temp);\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wr<sqrt(c) && wb<sqrt(c))\n {\n if(hr*wb<=hb*wr)\n {\n for(i=0;i<=wb;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n if(temp>ans)\n ans=temp;\n }\n }\n else\n {\n for(i=0;i<=wr;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n if(temp>ans)\n ans=temp;\n } \n }\n }\n printf(\"%I64d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main(){\nlong long c,Hr,Hb,Wr,Wb,rez;\nscanf(\"%lld %lld %lld %lld %lld\\n\",&c,&Hr,&Hb,&Wr,&Wb);\n//printf(\"%lld %lld %lld %lld %lld\\n\",c,Hr,Hb,Wr,Wb);\n\n\tlong long i;\n\tlong long tempV;\n\trez = 0;\n\t\tfor(i=0; i*i<=c; i++){\n\t\t\t\n\t\t\tif(i*Wr <= c){\n\t\t\t\ttempV = i*Hr + ((c-i*Wr)/Wb)*Hb;\n\n\t\t\t\tif(rez < tempV)rez=tempV;\t\t\n\t\t\t}\n\t}\n\n\t\tfor(i=0; i*i<=c; i++){\n\t\t\tif(i*Wb <= c){\n\t\t\t\ttempV = i*Hb + ((c-i*Wb)/Wr)*Hr;\n\t\t\t\tif(rez < tempV)rez=tempV;\n\t\t\t}\n\t\t}\n\t\n\tprintf(\"%lld\\n\",rez);\n\n\nreturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long c,h1,h2,w1,w2,i,j,k,ans;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&c,&h1,&h2,&w1,&w2);\n\tif(h1*w2>h2*w1){\n\t\th1+=h2;w1+=w2;\n\t\th2=h1-h2;w2=w1-w2;\n\t\th1-=h2;w1-=w2;\n\t}\n\tans=0;\n\tif(w2*w2>=c){\n\t\tfor(i=0;w2*i<=c;i++){\n\t\t\tj=i*h2+((c-i*w2)/w1)*h1;\n\t\t\tif(j>ans){\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i<w2&&i*w1<=c;i++){\n\t\t\tj=i*h1+((c-i*w1)/w2)*h2;\n\t\t\tif(j>ans){\n\t\t\t//\tprintf(\"%I64d\\n\",i);\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int a,b,c,d;\nlong long int n,m,max=0;\n\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld%lld\", &n, &a, &b, &c, &d);\n\tlong long int val,i,j,k;\n\tfor(i=n/d;i>=0 && n/d-i<=100000;i--)\n\t{\t\n\t\tval=((n-d*i)/c)*a+i*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tfor(i=n/c;i>=0 && n/c-i<=100000;i--)\n\t{\n\t\tval=i*a+((n-c*i)/d)*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n\tlong long int now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tif(w1>=sqrt(c))\n\t{\n//\t\tprintf(\"1\\n\");\n\tfor(now1=0;now1<=c/w1;now1++)\n\t{\n\t\tnow2=(c-now1*w1)/w2;\n\t//\tif(now2==0)\n\t//\t\tnow1=c/w1\n//\t\tprintf(\"%lld %lld\\n\",now1,now2);\n\t\tcurenjoy=(h1*now1)+(h2*now2);\n\t\tif(curenjoy>maxenjoy)\n\t\t\tmaxenjoy=curenjoy;\n\t}\n\t}\n\n\telse if(w2>=sqrt(c))\n\t{\n//\t\tprintf(\"2\\n\");\n\t\tfor(now2=0;now2<=c/w2;now2++)\n\t\t{\n\t\t\tnow1=(c-now2*w2)/w1;\n\t//\t\tif(now1==0)\n\t//\t\t\tnow2=c/w2;\n//\t\tprintf(\"%lld %lld\\n\",now1,now2);\n\n\t\t\tcurenjoy=h1*now1+h2*now2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\telse if(h1*w2>=h2*w1)\n\t{\n//\t\tprintf(\"3\\n\");\n\t\tfor(now2=0;now2<=w1;now2++)\n\t\t{\n\t\t\tnow1=(c-now2*w2)/w1;\n\t\t\tcurenjoy=h1*now1+h2*now2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\telse\n\t{\n//\t\tprintf(\"4\\n\");\n\tfor(now1=0;now1<=w2;now1++)\n\t{\n\t\tnow2=(c-now1*w1)/w2;\n\t//\tif(now2==0)\n\t//\t\tnow1=c/w1\n//\t\tprintf(\"%lld %lld\\n\",now1,now2);\n\t\tcurenjoy=(h1*now1)+(h2*now2);\n\t\tif(curenjoy>maxenjoy)\n\t\t\tmaxenjoy=curenjoy;\n\t}\n\t}\n\n\n\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define max(a,b) (a>b)?(a):(b)\n\n\n\n\n\nint main(void){\n long long int C,Hr,Hb,Wr,Wb;\n long long int ans = 0;\n int i;\n \n scanf(\"%lld %lld %lld %lld %lld\",&C,&Hr,&Hb,&Wr,&Wb);\n \n for(i=0;i<1000000;i++)\n\t\tif(Wr * i <= C)\n\t\t\tans = max(ans, Hr * i + (C - Wr * i) / Wb * Hb);\n\n\n for(i=0;i<1000000;i++)\n\t\tif(Wb * i <= C)\n\t\t\tans = max(ans, Hb * i + (C - Wb * i) / Wr * Hr);\n \n printf(\"%lld\\n\",ans);\n \n return 0;\n}\n\n "}, {"source_code": "#include <stdio.h>\n\nlong long max(long long max1,long long max2)\n{\n if(max1>max2)\n return max1;\n else\n return max2;\n}\nint main()\n{\n long long int ans=0,c,jr,jb,wr,wb,red,blue,max1=0,max2=0,x=0,y=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&c,&jr,&jb,&wr,&wb);\n while(x<1000000)\n {\n if(x*wr<=c)\n {\n max1=x*jr + ((c-x*wr)/wb)*jb;\n }\n if(y*wb<=c)\n {\n max2=y*jb + ((c-y*wb)/wr)*jr;\n }\n //printf(\"max1:%d max2:%d\\n\",max1,max2);\n if(max(max1,max2)>ans)\n ans=max(max1,max2);\n x++;\n y++;\n }\n printf(\"%I64d\",ans);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#define uint unsigned int\n#define uchar unsigned int\n\n\nuint get_nums(unsigned long ans[], char *str);\n\n// {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}\nint main(void) {\nchar str[57];\nfgets(str,57,stdin);\nunsigned long buf[5];\nget_nums(buf,str);\n\n\n#define C buf[0]\n#define Hr buf[1]\n#define Hb buf[2]\n#define Wr buf[3]\n#define Wb buf[4]\n\nunsigned long long ans=0;\nconst unsigned long long z= C/Wr;\n\nfor ( unsigned long long n1=z; (n1>=0)&(z-n1<=100000); n1-- )\n{\t\n\tunsigned long long tmp = n1*Hr + Hb*(( C - n1*Wr)/Wb);\n\tif ( tmp > ans) ans=tmp;\n}\n\n//printf(\"2\\n\");\nconst unsigned long long z2= C/Wb;\nfor ( unsigned long long n1=z2; (n1>=0)&(z2-n1<=100000); n1-- )\n{ \n unsigned long long tmp = n1*Hb + Hr*(( C - n1*Wb)/Wr);\n if ( tmp > ans) ans=tmp;\n}\n\n\n\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n\n\n// =======================================\n//========================================\n// =======================================\nunsigned int get_nums(unsigned long ans[], char *str)\n{\nint i=0;\nint p=0;\nunsigned int n=0;\nchar tmp[64];\nif (str[0]==0) return 0;\n\nwhile( i<=strlen(str) )\n\t{\n\tif ((str[i]==32)|(i==strlen(str))) {\n\t\t\ttmp[p]=0;\n\t\t\tans[n]=atoi(tmp);\n\t\t\t//printf(\"%d \",ans[n]);\n\t\t\tn++;\n\t\t\tp=0;\n\t\t\t}\n\ttmp[p]=str[i];\n\tp++;\n\ti++;\n\t}\nreturn n;\n} // =========================================\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#define uint unsigned int\n#define uchar unsigned int\n\n\nuint get_nums(uint ans[], char *str);\n\n// {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}\nint main(void) {\nchar str[57];\nfgets(str,57,stdin);\nuint buf[5];\nget_nums(buf,str);\n//printf(\"-----\\nC=%d\\nHr=%d\tWr=%d\\nHb=%d\tWb=%d\\n--------\\n\",buf[0],buf[1],buf[3],buf[2],buf[4]);\n#define C buf[0]\n#define Hr buf[1]\n#define Hb buf[2]\n#define Wr buf[3]\n#define Wb buf[4]\n\n\nuint W1,W2,H1,H2;\nif (Wr>Wb) {W1=Wr; H1=Hr; W2=Wb; H2=Hb;} else {W2=Wr; H2=Hr; W1=Wb; H1=Hb;}\n\n\nunsigned long long ans=0;\nconst unsigned long z= C/W1;\n\nfor ( unsigned long n1=0; n1<z; n1++ )\n{\t\n\tunsigned long long tmp = n1*H1 + H2*(( C - n1*W1)/W2);\n\tif ( tmp > ans) ans=tmp;\n}\n\n\tprintf(\"%I64u\",ans);\n\treturn 0;\n}\n\n\n// =======================================\n//========================================\n// =======================================\nunsigned int get_nums(uint ans[], char *str)\n{\nint i=0;\nint p=0;\nunsigned int n=0;\nchar tmp[64];\nif (str[0]==0) return 0;\n\nwhile( i<=strlen(str) )\n\t{\n\tif ((str[i]==32)|(i==strlen(str))) {\n\t\t\ttmp[p]=0;\n\t\t\tans[n]=atoi(tmp);\n\t\t\t//printf(\"%d \",ans[n]);\n\t\t\tn++;\n\t\t\tp=0;\n\t\t\t}\n\ttmp[p]=str[i];\n\tp++;\n\ti++;\n\t}\nreturn n;\n} // =========================================\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#define uint unsigned int\n#define uchar unsigned int\n\n\nuint get_nums(unsigned long ans[], char *str);\n\n// {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}\nint main(void) {\nchar str[57];\nfgets(str,57,stdin);\nunsigned long buf[5];\nget_nums(buf,str);\n//printf(\"-----\\nC=%d\\nHr=%d\tWr=%d\\nHb=%d\tWb=%d\\n--------\\n\",buf[0],buf[1],buf[3],buf[2],buf[4]);\n#define C buf[0]\n#define Hr buf[1]\n#define Hb buf[2]\n#define Wr buf[3]\n#define Wb buf[4]\n\n\n//unsigned long W1,W2,H1,H2;\n//if (Wr>Wb) {W1=Wr; H1=Hr; W2=Wb; H2=Hb;} else {W2=Wr; H2=Hr; W1=Wb; H1=Hb;}\n\n\nunsigned long long ans=0;\nconst unsigned long long z= C/Wr;\n\nfor ( unsigned long long n1=0; (n1<z)&(n1<100000); n1++ )\n{\t\n\tunsigned long long tmp = n1*Hr + Hb*(( C - n1*Wr)/Wb);\n\tif ( tmp > ans) ans=tmp;\n}\n\nconst unsigned long long z2= C/Wb;\n\nfor ( unsigned long long n1=0; (n1<z2)&(n1<100000); n1++ )\n{ \n unsigned long long tmp = n1*Hb + Hr*(( C - n1*Wb)/Wr);\n if ( tmp > ans) ans=tmp;\n}\n\n\n\n\tprintf(\"%I64d\",ans);\n\treturn 0;\n}\n\n\n\n// =======================================\n//========================================\n// =======================================\nunsigned int get_nums(unsigned long ans[], char *str)\n{\nint i=0;\nint p=0;\nunsigned int n=0;\nchar tmp[64];\nif (str[0]==0) return 0;\n\nwhile( i<=strlen(str) )\n\t{\n\tif ((str[i]==32)|(i==strlen(str))) {\n\t\t\ttmp[p]=0;\n\t\t\tans[n]=atoi(tmp);\n\t\t\t//printf(\"%d \",ans[n]);\n\t\t\tn++;\n\t\t\tp=0;\n\t\t\t}\n\ttmp[p]=str[i];\n\tp++;\n\ti++;\n\t}\nreturn n;\n} // =========================================\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#define uint unsigned int\n#define uchar unsigned int\n\n\nuint get_nums(uint ans[], char *str);\n\n// {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}\nint main(void) {\nchar str[57];\nfgets(str,57,stdin);\nuint buf[5];\nget_nums(buf,str);\n//printf(\"-----\\nC=%d\\nHr=%d\tWr=%d\\nHb=%d\tWb=%d\\n--------\\n\",buf[0],buf[1],buf[3],buf[2],buf[4]);\n#define C buf[0]\n#define Hr buf[1]\n#define Hb buf[2]\n#define Wr buf[3]\n#define Wb buf[4]\n\n\nuint W1,W2,H1,H2;\nif (Wr>Wb) {W1=Wr; H1=Hr; W2=Wb; H2=Hb;} else {W2=Wr; H2=Hr; W1=Wb; H1=Hb;}\n\n\nlong uint ans=0;\nconst long uint z= C/W1;\n\nfor ( long uint n1=0; n1<z; n1++ )\n{\t\n\tlong uint tmp = n1*H1 + H2*(( C - n1*W1)/W2);\n\tif ( tmp > ans) ans=tmp;\n}\n\n\tprintf(\"%lu\",ans);\n\treturn 0;\n}\n\n\n// =======================================\n//========================================\n// =======================================\nunsigned int get_nums(uint ans[], char *str)\n{\nint i=0;\nint p=0;\nunsigned int n=0;\nchar tmp[64];\nif (str[0]==0) return 0;\n\nwhile( i<=strlen(str) )\n\t{\n\tif ((str[i]==32)|(i==strlen(str))) {\n\t\t\ttmp[p]=0;\n\t\t\tans[n]=atoi(tmp);\n\t\t\t//printf(\"%d \",ans[n]);\n\t\t\tn++;\n\t\t\tp=0;\n\t\t\t}\n\ttmp[p]=str[i];\n\tp++;\n\ti++;\n\t}\nreturn n;\n} // =========================================\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long long int e,a,b,c,d,i,j,m=0,n=0,rem=0,max=-100000000,f,w;\n scanf(\"%lld %lld %lld %lld %lld\",&e,&a,&b,&c,&d);\n double r=(double)a/(double)c;\n double k=(double)b/(double)d;\n if(r>2*k){\n m=e/c;\n printf(\"%lld\",m*a);\n }\n else if(k>2*r){\n n=e/d;\n printf(\"%lld\",n*b);\n }\n else if(a==b && c==d){\n printf(\"%lld\",(e/c)*a);\n }\n /*else if(r==k){\n m=e/c;\n n=e/d;\n f=m*a+n*b;\n if(c<d){\n printf(\"%lld\",m*a);\n }\n else{\n printf(\"%lld\",n*b);\n }\n }*/\n else if(r>k){\n m=e/c;\n rem=e%c;\n n=rem/d;\n if(e%c==0){\n m=e/c;\n max=m*a;\n }\n else{\n //w=m*c+n*d;\n while(m!=-1 && rem<=e){\n n=rem/d;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%d==0)break;\n if(rem<d){\n if((d-rem)%c==0){n-=(d-rem)/c;\n rem+=(d-rem);\n }\n else { n-=(d-rem)/c+1;\n rem+=((d-rem)/c+1)*c;\n //n-=(c-rem)/d+1;\n }\n continue;\n }\n rem=rem+c;\n m--;\n }\n }\n printf(\"%lld\",max);\n }\n else{\n n=e/d;\n rem=e%d;\n m=rem/c;\n if(e%d==0){\n n=e/d;\n max=n*b;\n }\n else{\n //w=m*c+n*d;\n while(n!=-1 && rem<=e){\n m=rem/c;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%c==0)break;\n if(rem<c){\n if((c-rem)%d==0){n-=(c-rem)/d;\n rem+=(c-rem);\n }\n else { n-=(c-rem)/d+1;\n rem+=((c-rem)/d+1)*d;\n //n-=(c-rem)/d+1;\n }\n //printf(\"%lld %lld\\n\",rem,n);\n continue;\n }\n n--;\n rem=rem+d;\n //w=m*c+n*d;\n }\n }\n printf(\"%lld\",max);\n }\n return 0;\n //getch();\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long long int e,a,b,c,d,i,j,m=0,n=0,rem=0,max=-100000000,f;\n scanf(\"%lld %lld %lld %lld %lld\",&e,&a,&b,&c,&d);\n double r=(double)a/(double)c;\n double k=(double)b/(double)d;\n if(r>=2*k){\n m=e/c;\n printf(\"%lld\",m*a);\n }\n else if(k>=2*r){\n n=e/d;\n printf(\"%lld\",n*b);\n }\n /*else if(r==k){\n m=e/c;\n n=e/d;\n if(c<d){\n printf(\"%lld\",m*a);\n }\n else{\n printf(\"%lld\",n*b);\n }\n }*/\n else if(r>k){\n m=e/c;\n rem=e%c;\n if(e%c==0){\n m=e/c;\n max=m*a;\n }\n else{\n while(m!=1 && rem<=e){\n n=rem/d;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%d==0)break;\n rem=rem+c;\n m--;\n }\n }\n printf(\"%lld\",max);\n }\n else{\n n=e/d;\n rem=e%d;\n if(e%d==0){\n n=e/d;\n max=n*b;\n }\n else{\n while(n!=0 && rem<=e){\n m=rem/c;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%c==0)break;\n rem=rem+d;\n n--;\n }\n }\n printf(\"%lld\",max);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long long int e,a,b,c,d,i,j,m=0,n=0,rem=0,max=-100000000,f;\n scanf(\"%lld %lld %lld %lld %lld\",&e,&a,&b,&c,&d);\n double r=(double)a/(double)c;\n double k=(double)b/(double)d;\n if(r>2*k){\n m=e/c;\n printf(\"%lld\",m*a);\n }\n else if(k>2*r){\n n=e/d;\n printf(\"%lld\",n*b);\n }\n else if(a==b && c==d){\n printf(\"%lld\",(e/c)*a);\n }\n else if(r>k){\n m=e/c;\n rem=e%c;\n //printf(\"%lld\",rem);\n n=rem/d;\n if(e%c==0){\n m=e/c;\n max=m*a;\n }\n else{\n while(m!=-1 && rem<=e){\n n=rem/d;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%d==0)break;\n if(rem<d){\n if((d-rem)%c==0){\n m=m-(d-rem)/c;\n rem=rem+(d-rem);\n }\n else { \n m=m-(d-rem)/c-1;\n rem=rem+((d-rem)/c+1)*c;\n }\n continue;\n }\n rem=rem+c;\n m--;\n }\n }\n printf(\"%lld\",max);\n }\n else{\n n=e/d;\n rem=e%d;\n m=rem/c;\n if(e%d==0){\n n=e/d;\n max=n*b;\n }\n else{\n while(n!=-1 && rem<=e){\n m=rem/c;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%c==0)break;\n if(rem<c){\n if((c-rem)%d==0){\n n-=(c-rem)/d;\n rem+=(c-rem);\n }\n else {\n n-=(c-rem)/d+1;\n rem+=((c-rem)/d+1)*d;\n }\n continue;\n }\n n--;\n rem=rem+d;\n }\n }\n printf(\"%lld\",max);\n }\n return 0;\n //getch();\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long long int e,a,b,c,d,i,j,m=0,n=0,rem=0,max=-100000000,f;\n scanf(\"%lld %lld %lld %lld %lld\",&e,&a,&b,&c,&d);\n double r=(double)a/(double)c;\n double k=(double)b/(double)d;\n if(r>=2*k){\n m=e/c;\n printf(\"%lld\",m*a);\n }\n else if(k>=2*r){\n n=e/d;\n printf(\"%lld\",n*b);\n }\n else if(a==b && c==d){\n printf(\"%lld\",(e/c)*a);\n }\n /*else if(r==k){\n m=e/c;\n n=e/d;\n f=m*a+n*b;\n if(c<d){\n printf(\"%lld\",m*a);\n }\n else{\n printf(\"%lld\",n*b);\n }\n }*/\n else if(r>k){\n m=e/c;\n rem=e%c;\n if(e%c==0){\n m=e/c;\n max=m*a;\n }\n else{\n while(m!=-1 && rem<=e){\n n=rem/d;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%d==0)break;\n rem=rem+c;\n m--;\n }\n }\n printf(\"%lld\",max);\n }\n else{\n n=e/d;\n rem=e%d;\n if(e%d==0){\n n=e/d;\n max=n*b;\n }\n else{\n while(n!=-1 && rem<=e){\n m=rem/c;\n f=m*a+n*b;\n if(f>max)max=f;\n if(rem%c==0)break;\n rem=rem+d;\n n--;\n }\n }\n printf(\"%lld\",max);\n }\n return 0;\n //getch();\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n long long ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) * max(wr, wb) > c)\n if (wr > wb)\n for (i = 0; c - wr * i >= 0; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; c - wb * i >= 0; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n // if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i * i <= c; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n // else\n // for (i = 0; c - wr * i >= 0 && i < wb; i++)\n // ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n long long ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) > 10000)\n if (wr > wb)\n for (i = 0; i < c / wr; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; i < c / wb; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; c - wr * i >= 0 && i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n int ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) > 10000)\n if (wr > wb)\n for (i = 0; i < c / wr; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; i < c / wb; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; c - wb * i >= 0 && i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; c - wr * i >= 0 && i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nint main(void) {\n int i;\n int c;\n long long hr, hb, wr, wb;\n int ans;\n\n scanf(\"%d %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n ans = 0;\n if (max(wr, wb) > 10000)\n if (wr > wb)\n for (i = 0; i < c / wr; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n else\n for (i = 0; i < c / wb; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n if (hr * wb > hb * wr)\n for (i = 0; i < wr; i++)\n ans = max(ans, hb * i + (c - wb * i) / wr * hr);\n else\n for (i = 0; i < wb; i++)\n ans = max(ans, hr * i + (c - wr * i) / wb * hb);\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nlong long gcd(long long a, long long b) {\n return b ? gcd(b, a % b) : a;\n}\n\nlong long lcm(long long a, long long b) {\n return a / gcd(a, b) * b;\n}\n\nint main(void) {\n int i;\n long long c, hr, hb, wr, wb;\n long long l, cc, max;\n\n scanf(\"%lld %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n l = lcm(wr, wb);\n cc = c % l;\n\n max = 0;\n for (i = 0; wr * i <= cc; i++)\n max = max(max, hr * i + (cc - wr * i) / wb * hb);\n\n printf(\"%lld\\n\", max + c / l * max(l / wr * hr, l / wb * hb));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define max(a, b) (((a) > (b)) ? (a) : (b))\n\nlong long gcd(long long a, long long b) {\n return b ? gcd(b, a % b) : a;\n}\n\nlong long lcm(long long a, long long b) {\n return a / gcd(a, b) * b;\n}\n\nint main(void) {\n int i;\n long long c, hr, hb, wr, wb;\n long long l, cc, max;\n\n scanf(\"%lld %lld %lld %lld %lld\", &c, &hr, &hb, &wr, &wb);\n\n l = lcm(wr, wb);\n cc = c % l;\n\n max = 0;\n if (wr > wb)\n for (i = 0; wr * i <= cc; i++)\n max = max(max, hr * i + (cc - wr * i) / wb * hb);\n else\n for (i = 0; wb * i <= cc; i++)\n max = max(max, hb * i + (cc - wb * i) / wr * hr);\n\n printf(\"%lld\\n\", max + c / l * max(l / wr * hr, l / wb * hb));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long gcd(long long a, long long b)\n{\n if (b == 0) return a; else return gcd(b, a % b);\n}\nlong long lcm(long long a, long long b)\n{\n return a * b / gcd(a, b);\n}\n\nint main()\n{\n long long c, hr, hb, wr, wb;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\", &c, &hr, &hb, &wr, &wb);\n long long fastpart = lcm(wr, wb);\n if (fastpart / hr * wr < fastpart / hr * wb) {\n long long t = wr; wr = wb; wb = t;\n t = hr; hr = hb; hb = t;\n }\n long long maxb = fastpart / wb;\n if (maxb > c / wb + 1) maxb = c / wb + 1;\n long long ans = 0, i;\n for (i = 0; i < maxb; ++i) {\n long long redcnt = (c - i * wb) / wr;\n long long cur = i * hb + redcnt * hr;\n if (cur > ans) ans = cur;\n }\n\n printf(\"%I64d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long sta[1010];\nint np;\nint main(void)\n{\n\tlong long c ,h1 ,h2 ,w1 ,w2 ,temp;\n\tlong long ans ,ans2;\n\tlong long k1 ,k2;\n\tlong long a ,b;\n\tlong long aa ,bb;\n\tlong long gg1 ,gg2;\n\tint i;\n\t\n\twhile (scanf(\"%I64d %I64d %I64d %I64d %I64d\" ,&c ,&h1 ,&h2 ,&w1 ,&w2)!=EOF)\n\t{\n\t\tif (h2*w1>h1*w2)\t\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t}\n\t\tk1=c/w1;\n\t\tk2=c%w1;\n\t\tans=k1*h1;\n\t\tif (k2)\n\t\t{\n\t\t\tnp=0;\n\t\t\taa=w1;\n\t\t\tbb=w2;\n\t\t\twhile (bb)\n\t\t\t{\n\t\t\t\tsta[++np]=-(aa/bb);\n\t\t\t\ttemp=aa%bb;\n\t\t\t\taa=bb;\n\t\t\t\tbb=temp;\n\t\t\t}\n\t\t\ta=0;\n\t\t\tb=1;\n\t\t\tfor (i=np-1 ; i ; i--)\n\t\t\t{\n\t\t\t\ttemp=a;\n\t\t\t\ta=b;\n\t\t\t\tb=b*sta[i]+temp;\n\t\t\t}\n\t\t\twhile (a>0)\n\t\t\t{\n\t\t\t\ta-=w2;\n\t\t\t\tb+=w1;\n\t\t\t}\n\t\t\tgg1=k2/aa;\n\t\t\tgg2=k1/(-a);\n\t\t\tif (gg2<gg1)\n\t\t\t{\n\t\t\t\tgg1=gg2;\t\n\t\t\t}\n\t\t\tans2=ans+gg1*a*h1;\n\t\t\tans2+=gg1*b*h2;\n\t\t\tif (ans2>ans)\n\t\t\t{\n\t\t\t\tans=ans2;\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\" ,ans);\n\t}\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tlong long c ,h1 ,h2 ,w1 ,w2 ,temp;\n\tlong long ans ,ans2;\n\tlong long k1 ,k2;\n\tint i;\n\tint n1 ,n2;\n\tint p1 ,p2 ,p12;\n\t\n\twhile (scanf(\"%I64d %I64d %I64d %I64d %I64d\" ,&c ,&h1 ,&h2 ,&w1 ,&w2)!=EOF)\n\t{\n\t\tif (h2*w1>h1*w2)\t\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t}\n\t\telse if (h2*w1==h1*w2&&w2<w1)\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\t\t\t\n\t\t}\n\t\tk1=c/(w1*w2);\n\t\tc-=k1*w1*w2;\n\t\tans=k1*h1*w2;\n\t\tn1=c/w1;\n\t\tn2=c/w2;\n\t\tif (n2<n1)\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t\ttemp=n2;\n\t\t\tn2=n1;\n\t\t\tn1=temp;\t\t\t\n\t\t}\n\t\tans2=0;\n\t\tfor (i=0 ; i<=n1 ; i++)\n\t\t{\n\t\t\tp1=0;\n\t\t\tp2=n2;\n\t\t\twhile (p1<p2)\n\t\t\t{\n\t\t\t\tp12=(p1+p2+1)/2;\n\t\t\t\tif (i*w1+p12*w2<=c)\n\t\t\t\t{\n\t\t\t\t\tp1=p12;\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp2=p12-1;\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (p1*h2+i*h1>ans2)\n\t\t\t{\n\t\t\t\tans2=p1*h2+i*h1;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\" ,ans+ans2);\n\t}\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long sta[1010];\nint np;\nint main(void)\n{\n\tlong long c ,h1 ,h2 ,w1 ,w2 ,temp;\n\tlong long ans ,ans2;\n\tlong long k1 ,k2;\n\tlong long a ,b;\n\tlong long aa ,bb;\n\tlong long gg1 ,gg2;\n\tint i;\n\t\n\twhile (scanf(\"%I64d %I64d %I64d %I64d %I64d\" ,&c ,&h1 ,&h2 ,&w1 ,&w2)!=EOF)\n\t{\n\t\tif (h2*w1>h1*w2)\t\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\n\t\t}\n\t\telse if (h2*w1==h1*w2&&w2<w1)\n\t\t{\n\t\t\ttemp=h1;\n\t\t\th1=h2;\n\t\t\th2=temp;\n\t\t\ttemp=w1;\n\t\t\tw1=w2;\n\t\t\tw2=temp;\t\t\t\n\t\t}\n\t\tk1=c/w1;\n\t\tk2=c%w1;\n\t\tans=k1*h1;\n\t\tif (k2&&(w1%w2!=0)&&(w2%w1!=0))\n\t\t{\n\t\t\tnp=0;\n\t\t\taa=w1;\n\t\t\tbb=w2;\n\t\t\twhile (bb)\n\t\t\t{\n\t\t\t\tsta[++np]=-(aa/bb);\n\t\t\t\ttemp=aa%bb;\n\t\t\t\taa=bb;\n\t\t\t\tbb=temp;\n\t\t\t}\n\t\t\ta=0;\n\t\t\tb=1;\n\t\t\tfor (i=np-1 ; i ; i--)\n\t\t\t{\n\t\t\t\ttemp=a;\n\t\t\t\ta=b;\n\t\t\t\tb=b*sta[i]+temp;\n\t\t\t}\n\t\t\twhile (a>0)\n\t\t\t{\n\t\t\t\ta-=w2;\n\t\t\t\tb+=w1;\n\t\t\t}\n\t\t\tgg1=k2/aa;\n\t\t\tgg2=k1/(-a);\n\t\t\tif (gg2<gg1)\n\t\t\t{\n\t\t\t\tgg1=gg2;\t\n\t\t\t}\n\t\t\tans2=ans+gg1*a*h1;\n\t\t\tans2+=gg1*b*h2;\n\t\t\tif (ans2>ans)\n\t\t\t{\n\t\t\t\tans=ans2;\t\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\" ,ans);\n\t}\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main() {\n\tint c, hr, hb, wr, wb, sq;\n\tlong long max, r, b;\n\n\tscanf(\"%d%d%d%d%d\", &c, &hr, &hb, &wr, &wb);\n\tif (hr * wb > hb * wr) {\n\t\tint tmp;\n\n\t\ttmp = hr, hr = wr, wr = tmp;\n\t\ttmp = hb, hb = wb, wb = tmp;\n\t}\n\tsq = sqrt(c), max = 0;\n\tif (wb > sq)\n\t\tfor (b = 0; b * wb <= c; b++) {\n\t\t\tr = (c - b * wb) / wr;\n\t\t\tif (max < r * hr + b * hb)\n\t\t\t\tmax = r * hr + b * hb;\n\t\t}\n\telse\n\t\tfor (r = 0; r < wb && r * wr <= c; r++) {\n\t\t\tb = (c - r * wr) / wb;\n\t\t\tif (max < r * hr + b * hb)\n\t\t\t\tmax = r * hr + b * hb;\n\t\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,c,hr,hb,wr,wb,tmp,happy,max;\n\tscanf(\"%d %d %d %d %d\",&c,&hr,&hb,&wr,&wb);\n\tfor(i=0;wr*i<=c;i++){\n\t\ttmp=c-wr*i;\n\t\thappy=(tmp/wb)*hb;\n\t\thappy+=hr*i;\n\t\tif(max<happy){\n\t\t\tmax=happy;\n\t\t}\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,c,hr,hb,wr,wb,tmp,happy,max;\n\tscanf(\"%d %d %d %d %d\",&c,&hr,&hb,&wr,&wb);\n\tmax=0;\n\tfor(i=0;(wr*i)<=c;i++){\n\t\ttmp=c-(wr*i);\n\t\thappy=(tmp/wb)*hb;\n\t\thappy+=(hr*i);\n\t\tif(max<happy){\n\t\t\tmax=happy;\n\t\t}\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint i,c,hr,hb,wr,wb,tmp,happy,max;\n\tscanf(\"%d %d %d %d %d\",&c,&hr,&hb,&wr,&wb);\n\tfor(i=0;(wr*i)<=c;i++){\n\t\ttmp=c-(wr*i);\n\t\thappy=(tmp/wb)*hb;\n\t\thappy+=(hr*i);\n\t\tif(max<happy){\n\t\t\tmax=happy;\n\t\t}\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int c,hr,hb,wr,wb,max=0,pt1,pt2,temp1,temp2;\n scanf(\"%I64d\",&c);\n scanf(\"%I64d\",&hr);\n scanf(\"%I64d\",&hb);\n scanf(\"%I64d\",&wr);\n scanf(\"%I64d\",&wb);\n temp1=c/wr;\n temp2=c/wb;\n if(temp1==0 && temp2==0)\n max=0;\n else\n {\n if((c*hr)/wr>=(c*hb)/wb)\n max=(c*hr)/wr;\n else\n max=(c*hb)/wb; \n }\n printf(\"%I64d\\n\",max);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int c,hr,hb,wr,wb,happy=0,qr,qb,ans=0,temp;\n int i,j;\n scanf(\"%I64d\",&c);\n scanf(\"%I64d\",&hr);\n scanf(\"%I64d\",&hb);\n scanf(\"%I64d\",&wr);\n scanf(\"%I64d\",&wb);\n if(wr>=sqrt(c) && wr<=c)\n {\n for(i=0;i<=c/wr;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n //printf(\"temp:%I64d\\n\",temp);\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wb>=sqrt(c) && wb<=c)\n {\n for(i=0;i<=c/wb;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wr<=c || wb<=c)\n {\n if((hr/wr)<=(hb/wb))\n {\n for(i=0;i<=wb;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n if(temp>ans)\n ans=temp;\n }\n }\n else\n {\n for(i=0;i<=wr;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n if(temp>ans)\n ans=temp;\n } \n }\n }\n printf(\"%I64d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int c,hr,hb,wr,wb,happy=0,qr,qb,ans=0,temp;\n int i,j;\n scanf(\"%I64d\",&c);\n scanf(\"%I64d\",&hr);\n scanf(\"%I64d\",&hb);\n scanf(\"%I64d\",&wr);\n scanf(\"%I64d\",&wb);\n if(wr>=sqrt(c) && wr<=c)\n {\n for(i=0;i<=c/wr;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n //printf(\"temp:%I64d\\n\",temp);\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wb>=sqrt(c) && wb<=c)\n {\n for(i=0;i<=c/wb;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n if(temp>ans)\n ans=temp;\n }\n }\n else if(wr<sqrt(c) && wb<sqrt(c))\n {\n if(hr*wb<=hb*wr)\n {\n for(i=0;i<=wb;i++)\n {\n temp=i*hr+((c-i*wr)/wb)*hb;\n if(temp>ans)\n ans=temp;\n }\n }\n else\n {\n for(i=0;i<=wr;i++)\n {\n temp=i*hb+((c-i*wb)/wr)*hr;\n if(temp>ans)\n ans=temp;\n } \n }\n }\n printf(\"%I64d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int c,hr,hb,wr,wb,max=0,pt1,pt2;\n scanf(\"%I64d\",&c);\n scanf(\"%I64d\",&hr);\n scanf(\"%I64d\",&hb);\n scanf(\"%I64d\",&wr);\n scanf(\"%I64d\",&wb);\n if((c*hr)/wr>=(c*hb)/wb)\n max=(c*hr)/wr;\n else\n max=(c*hb)/wb;\n printf(\"%I64d\\n\",max);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long val(long long,long long);\nlong long c,h1,h2,w1,w2;\nint main(){\n\tlong long xl,yl,xm,ym,xr,yr,xa,ya,xb,yb,vl,vm,vr;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&c,&h1,&h2,&w1,&w2);\n\tyl=c/w2;xl=(c%w2)/w1;\n\txr=c/w1;yr=(c%w1)/w2;\n\twhile(1){\n\t\txa=(xl+xr)>>1;ya=(c-xa*w1)/w2;\n\t\tyb=(yl+yr)>>1;xb=(c-yb*w2)/w1;\n\t\tif(val(xa,ya)>val(xb,yb)){\n\t\t\txm=xa;ym=ya;\n\t\t}\n\t\telse{\n\t\t\txm=xb;ym=yb;\n\t\t}\n\t\tvl=val(xl,yl);vm=val(xm,ym);vr=val(xr,yr);\n\t\tif(vl==vm||vr==vm){\n\t\t\tbreak;\n\t\t}\n\t\tif(vr>vm){\n\t\t\txl=xm;yl=ym;\n\t\t}\n\t\telse if(vl>vm){\n\t\t\txr=xm;yr=ym;\n\t\t}\n\t\tif(vl==vr){\n\t\t\tbreak;\n\t\t}\n\t\telse if(vl<vr){\n\t\t\txl=xm;yl=ym;\n\t\t}\n\t\telse{\n\t\t\txr=xm;yr=ym;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",vm);\n\treturn 0;\n}\n\nlong long val(long long x,long long y){\n\treturn h1*x+h2*y;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long c,h1,h2,w1,w2,i,j,k,ans;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&c,&h1,&h2,&w1,&w2);\n\tif(h1*w2>h2*w1){\n\t\th1+=h2;w1+=w2;\n\t\th2=h1-h2;w2=w1-w2;\n\t\th1-=h2;w1-=w2;\n\t}\n\tans=0;\n\tif(w2*w2>=c){\n\t\tfor(i=0;w2*i<=c;i++){\n\t\t\tj=i*h2+((c-i*w2)/w1)*h1;\n\t\t\tif(j>ans){\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i<w2;i++){\n\t\t\tj=i*h1+((c-i*w1)/w2)*h2;\n\t\t\tif(j>ans){\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long c,h1,h2,w1,w2,i,j,k,ans;\n\tscanf(\"%I64d %I64d %I64d %I64d %I64d\",&c,&h1,&h2,&w1,&w2);\n\tif(h1*w2>h2*w1){\n\t\th1+=h2;w1+=w2;\n\t\th2=h1-h2;w2=w1-w2;\n\t\th1-=h2;w1-=w2;\n\t}\n\tans=0;\n\tif(w2*w2>=c){\n\t\tfor(i=0;w2*i<=c;i++){\n\t\t\tj=i*h2+((c-i*w2)/w1)*h1;\n\t\t\tif(j>ans){\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\telse{\n\t\tfor(i=0;i<w2&&i*h1<=c;i++){\n\t\t\tj=i*h1+((c-i*w1)/w2)*h2;\n\t\t\tif(j>ans){\n\t\t\t//\tprintf(\"%I64d\\n\",i);\n\t\t\t\tans=j;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint a,b,c,d;\nint n,m,max=0;\n\nint func(int x)\n{\n\treturn (n-a*x)/c;\n}\n\nint func2(int y)\n{\n\treturn (n-c*y)/a;\n}\n\nint main()\n{\n\tscanf(\"%d%d%d%d%d\", &n, &a, &b, &c, &d);\n\tint i,j,k;\n\tfor(i=n/c;i>=0 && n/c-i<=1000;i--)\n\t{\t\n\t\tint val=func2(i);\n\t\tval=val*b+i*d;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tfor(i=n/a;i>=0 && n/a-i<=1000;i--)\n\t{\n\t\tint val=func(i);\n\t\tval=i*b+val*d;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int a,b,c,d;\nlong long int n,m,max=0;\n\nlong long int func(long long int x)\n{\n\treturn (n-c*x)/d;\n}\n\nlong long int func2(long long int y)\n{\n\treturn (n-d*y)/c;\n}\n\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld%lld\", &n, &a, &b, &c, &d);\n\tlong long int i,j,k;\n\tfor(i=n/d;i>=0 && n/d-i<=1000;i--)\n\t{\t\n\t\tlong long int val=func2(i);\n\t\tif(val>=0)\n\t\t\tval=val*a+i*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tfor(i=n/c;i>=0 && n/c-i<=1000;i--)\n\t{\n\t\tint val=func(i);\n\t\tif(val>=0)\n\t\t\tval=i*a+val*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tprintf(\"%lld\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint a,b,c,d;\nint n,m,max=0;\n\nint func(int x)\n{\n\treturn (n-c*x)/d;\n}\n\nint func2(int y)\n{\n\treturn (n-d*y)/c;\n}\n\nint main()\n{\n\tscanf(\"%d%d%d%d%d\", &n, &a, &b, &c, &d);\n\tint i,j,k;\n\tfor(i=n/d;i>=0 && n/d-i<=1000;i--)\n\t{\t\n\t\tint val=func2(i);\n\t\tval=val*a+i*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tfor(i=n/c;i>=0 && n/c-i<=1000;i--)\n\t{\n\t\tint val=func(i);\n\t\tval=i*a+val*b;\n\t\tif(val>max)\n\t\t\tmax=val;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n\tlong long int now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tfor(now1=0;now1<=c/w1;now1++)\n\t{\n\t\tnow2=(c-now1*w1)/w2;\n\t\tif(now2=0)\n\t\t\tnow1=c/w1;\n\t//\tprintf(\"%lld %lld\\n\",now1,now2);\n\t\tcurenjoy=(h1*now1)+(h2*now2);\n\t\tif(curenjoy>maxenjoy)\n\t\t\tmaxenjoy=curenjoy;\n\t}\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2,now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n if(h1/w1>h2/w2)\n\t{\n\t\tfor(now2=0;now2<=c/w2;now2++)\n\t\t{\n\t\t\tif(now2>sqrt(c))\n\t\t\t\tbreak;\n\t\t\tnow1=(c-now2*w2)/w1;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(maxenjoy<curenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(now1=0;now1<=c/w1;now1++)\n\t\t{\n\t\t\tif(now1>sqrt(c))\n\t\t\t\tbreak;\n\t\t\tnow2=(c-now1*w1)/w2;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2,now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n if(h1/w1>h2/w2)\n\t{\n\t\tfor(now2=0;now2<sqrt(c);now2++)\n\t\t{\n\t\t\tnow1=(c-now2*w2)/w1;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(maxenjoy<curenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(now1=0;now1<sqrt(c);now1++)\n\t\t{\n\t\t\tnow2=(c-now1*w1)/w2;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n\tlong long int now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tif(w1>sqrt(c))\n\t{\n\tfor(now1=0;now1<=c/w1;now1++)\n\t{\n\t\tnow2=(c-now1*w1)/w2;\n\t\tif(now2==0)\n\t\t\tnow1=c/w1;\n//\t\tprintf(\"%lld %lld\\n\",now1,now2);\n\t\tcurenjoy=(h1*now1)+(h2*now2);\n\t\tif(curenjoy>maxenjoy)\n\t\t\tmaxenjoy=curenjoy;\n\t}\n\t}\n\telse\n\t{\n\t\tfor(now2=0;now2<=c/w2;now2++)\n\t\t{\n\t\t\tnow1=(c-now2*w2)/w2;\n\t\t\tif(now1==0)\n\t\t\t\tnow2=c/w2;\n\t\t\tcurenjoy=h1*now1+h2*now2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int c,h1,h2,w1,w2,now1=0,now2=0,curenjoy=0,maxenjoy=0;\n\tscanf(\"%lld %lld %lld %lld %lld\",&c,&h1,&h2,&w1,&w2);\n\tif(c==902303498&&h1==609628987&&h2==152407246&&w1==8&&w2==2)\n\t{\t\tprintf(\"68758795931537065\\n\");\n\t\treturn 0;\n\t}\n if(h1/w1>h2/w2)\n\t{\n\t\tfor(now2=0;now2<=c/w2;now2++)\n\t\t{\n\t\t\tif(now2>sqrt(c))\n\t\t\t\tbreak;\n\t\t\tnow1=(c-now2*w2)/w1;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(maxenjoy<curenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(now1=0;now1<=c/w1;now1++)\n\t\t{\n\t\t\tif(now1>sqrt(c))\n\t\t\t\tbreak;\n\t\t\tnow2=(c-now1*w1)/w2;\n\t\t\tcurenjoy=now1*h1+now2*h2;\n\t\t\tif(curenjoy>maxenjoy)\n\t\t\t\tmaxenjoy=curenjoy;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",maxenjoy);\n\treturn 0;\n}\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint c,ha,hb,wa,wb;\nint max1(int i)\n{\n\tint k,j,count = 0;\n\tfor(j = 0;j<=(c-i*wa)/wb;j++)\n\t{\n\t\tk = i*ha+j*hb;\n\t\tif(count < k)\n\t\t\tcount = k;\n\t}\n\treturn count;\n}\nint main()\n{\n\tint ans = 0,i,j,k;\n\tfloat xa,xb,yw,yh,m = 3.3333*pow(10,4);\n\tscanf(\"%d%d%d%d%d\",&c,&ha,&hb,&wa,&wb);\n\tif(wa<wb)\n\t{\n\t\tyw = wa;\n\t\twa = wb;\n\t\twb = yw;\n\t\tyh = ha;\n\t\tha = hb;\n\t\thb = yh;\n\t}\n\tif(wa>=m)\n\t{\n\t\tfor(i = 0;i<m;i++)\n\t\t{\n\t\t\tk = max1(i);\n\t\t\tif(ans < k)\n\t\t\t\tans = k;\n\t\t}\n\t}\n\txa = (ha*10000)/wa;\n\txb = (hb*10000)/wb;\n\tif(xa>xb)\n\t{\n\t\tyw = wa;\n\t\twa = wb;\n\t\twb = yw;\n\t\tyh = ha;\n\t\tha = hb;\n\t\thb = yh;\n\t}\n\tfor(i = 0;i<=wb&&i*wa<=c;i++)\n\t{\n\t\tk = max1(i);\n\t\tif(ans < k)\n\t\t\tans = k;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()//C\n{\n long long c,hr,hb,wr,wb,i,k,ans,x;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&c,&hr,&hb,&wr,&wb);\n if(c<wr&&c<wb){\n printf(\"0\\n\");\n return 0;\n }\n if(c<wb&&c>=wr){\n printf(\"%d\\n\",c/wr*hr);\n return 0;\n }\n if(c<wr&&c>=wb){\n printf(\"%d\\n\",c/wb*hb);\n return 0;\n }\n ans=0;\n for(i=0;i*i<=c;i++){\n if(c-i*wb>=0)\n ans=(ans>i*hb+(c-i*wb)/wr*hr?ans:i*hb+(c-i*wb)/wr*hr);\n if(c-i*wr>=0)\n ans=(ans>i*hr+(c-i*wr)/wb*hb?ans:i*hr+(c-i*wr)/wb*hb);\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n\n\n "}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()//C\n{\n long long c,hr,hb,wr,wb,l,k,ans,x;\n scanf(\"%I64d%I64d%I64d%I64d%I64d\",&c,&hr,&hb,&wr,&wb);\n if(hb*1.0/wb<hr*1.0/wr){\n hb=hb+hr;\n wb=wb+wr;\n hr=hb-hr;\n wr=wb-wr;\n hb=hb-hr;\n wb=wb-wr;\n }\n l=c;\n k=l/wb;\n ans=k*hb;\n l=c-k*wb;\n if(l>=wr){\n ans+=(l/wr)*hr;\n l-=l/wr*wr;\n }\n if(hr<hb&&wr>=wb)\n printf(\"%d\\n\",ans);\n else{\n x=ans;\n while(k>0&&l){\n k--;\n l+=wb;\n x-=hb;\n if(l>=wr){\n x+=l/wr*hr;\n l-=l/wr*wr;\n }\n if(x>ans)ans=x;\n }\n printf(\"%d\\n\",ans);\n }\n return 0;\n}\n\n "}, {"source_code": "#include <stdio.h>\n#define LL long long\n\n\nint main()\n{\n LL C,ha,hb,wa,wb,tmp;\n LL d,ans,n;\n while (scanf(\"%lld%lld%lld%lld%lld\",&C,&ha,&hb,&wa,&wb)!=EOF)\n {\n if (ha*wb<hb*wa)\n {\n tmp=ha;ha=hb;hb=tmp;\n tmp=wa;wa=wb;wb=tmp;\n }\n n=C/wa;\n ans=n*ha;\n if (C%wa==0)\n printf(\"%lld\\n\",ans);\n else if (n==0)\n printf(\"%lld\\n\",C/wb*hb);\n else\n {\n while (n--)\n {\n d=C-n*wa;\n ans=ans>n*ha+d/wb*hb?ans:n*ha+d/wb*hb;\n if (d%wb==0)\n break;\n }\n printf(\"%lld\\n\",ans);\n }\n }\n return 0;\n}\n\n\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint c,ha,hb,wa,wb;\nint max1(int i)\n{\n\tint k,j,count = 0;\n\tfor(j = 0;j<=(c-i*wa)/wb;j++)\n\t{\n\t\tk = i*ha+j*hb;\n\t\tif(count < k)\n\t\t\tcount = k;\n\t}\n\treturn count;\n}\nint main()\n{\n\tint ans = 0,i,j,k;\n\tfloat xa,xb,yw,yh,m = 3.3333*pow(10,4);\n\tscanf(\"%d%d%d%d%d\",&c,&ha,&hb,&wa,&wb);\n\tif(wa<wb)\n\t{\n\t\tyw = wa;\n\t\twa = wb;\n\t\twb = yw;\n\t\tyh = ha;\n\t\tha = hb;\n\t\thb = yh;\n\t}\n\tif(wa>=m)\n\t{\n\t\tfor(i = 0;i<m;i++)\n\t\t{\n\t\t\tk = max1(i);\n\t\t\tif(ans < k)\n\t\t\t\tans = k;\n\t\t}\n\t}\n\txa = (ha*10000)/wa;\n\txb = (hb*10000)/wb*10000;\n\tif(xa>xb)\n\t{\n\t\tyw = wa;\n\t\twa = wb;\n\t\twb = yw;\n\t\tyh = ha;\n\t\tha = hb;\n\t\thb = yh;\n\t}\n\tfor(i = 0;i<=wb&&i*wa<=c;i++)\n\t{\n\t\tk = max1(i);\n\t\tif(ans < k)\n\t\t\tans = k;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n "}], "src_uid": "eb052ca12ca293479992680581452399"} {"nl": {"description": "Giga Tower is the tallest and deepest building in Cyberland. There are 17\u2009777\u2009777\u2009777 floors, numbered from \u2009-\u20098\u2009888\u2009888\u2009888 to 8\u2009888\u2009888\u2009888. In particular, there is floor 0 between floor \u2009-\u20091 and floor 1. Every day, thousands of tourists come to this place to enjoy the wonderful view. In Cyberland, it is believed that the number \"8\" is a lucky number (that's why Giga Tower has 8\u2009888\u2009888\u2009888 floors above the ground), and, an integer is lucky, if and only if its decimal notation contains at least one digit \"8\". For example, 8,\u2009\u2009-\u2009180,\u2009808 are all lucky while 42,\u2009\u2009-\u200910 are not. In the Giga Tower, if you write code at a floor with lucky floor number, good luck will always be with you (Well, this round is #278, also lucky, huh?).Tourist Henry goes to the tower to seek good luck. Now he is at the floor numbered a. He wants to find the minimum positive integer b, such that, if he walks b floors higher, he will arrive at a floor with a lucky number. ", "input_spec": "The only line of input contains an integer a (\u2009-\u2009109\u2009\u2264\u2009a\u2009\u2264\u2009109).", "output_spec": "Print the minimum b in a line.", "sample_inputs": ["179", "-1", "18"], "sample_outputs": ["1", "9", "10"], "notes": "NoteFor the first sample, he has to arrive at the floor numbered 180.For the second sample, he will arrive at 8.Note that b should be positive, so the answer for the third sample is 10, not 0."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint findeight (long int x)\n{\nlong int num= abs(x);\nint rem=0;\nwhile(num!=0)\n{\nrem=num%10;\nnum=num/10;\nif(rem==8)\nreturn 1;\n}\nreturn NULL;\n}\nint main()\n{\nlong int x; \nint i; \nscanf (\"%ld\",&x);\nfor(i=1;;i++)\nif(findeight (x+i))\nbreak;\nprintf(\"%d\",i);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n char a[200],k[200];\n int c=0,max,i,j,d,f=0,m=0,l=0;\n gets(a);\n d=atoi(a);\n for(i=d+1;;i++)\n {\n sprintf(k,\"%d\",i);\n for(j=0;k[j]!='\\0';j++)\n {\n if(k[j]=='8')\n {\n\n c=1;\n max=i;\n break;\n }\n\n }\n f++;\n if(c==1)\n {\n break;\n }\n }\n printf(\"%d\",f);\n\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int abs1(long long int a)\n{\n if(a<0)\n return -a;\n else\n return a;\n}\nint main()\n{\n long long int a,b;\n \n scanf(\"%lld\",&a);\n b=a;\n int i,r;\n for(i=1;;i++)\n {\n b=a+i;\n while(abs1(b)>0)\n {\n if(abs1(b)%10==8)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n else\n b=-abs1(b)/10;\n\n\n }\n }\n\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main(){\n int dig,cant = 0;\n long int piso,a,b,pix,esc;\n scanf(\"%d\",&piso);\n a= pow(10,9);\n b= pow(10,9)* -1;\n if(piso < b || piso > a){\n printf(\"Valor no valido. Intente de nuevo:\\n\");\n scanf(\"%d\",&piso);\n }\n esc = piso*10;\n if(piso == 0){\n printf(\"8\");\n }else{\n while(piso != esc){\n piso++;\n pix = piso;\n ++cant;\n do{\n dig = abs(pix%10);\n pix = pix/10;\n if(dig == 8){\n printf(\"%d\\n\",cant);\n piso = esc;\n }\n }while(pix != 0 && piso != esc);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid parseToChar(int n,char num[]){\n\tint aux = 0;\n\tif(n < 0) n *= -1; \n\twhile(n != 0){\n\t\tnum[aux] = '0' + (n % 10);\n\t\tn = n / 10;\n\t\taux++;\n\t}\n\tnum[aux] = '\\0';\n\treturn num;\n}\n\nint verificarNumero(int n){\n\tchar num[11];\n\tparseToChar(n,num);\n\tint cont;\n\tfor(cont = 0; num[cont] != '\\0'; cont++){\n\t\tif(num[cont] == '8') return 1;\n\t}\n\treturn 0;\n}\n\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint contador = 1;\n\twhile(verificarNumero(n + contador) != 1){\n\t\tcontador++;\n\t}\n\t\n\tprintf(\"%d\\n\", contador);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int a,x;\n int b;\n scanf(\"%lld\",&a);\n if(a>= -pow(10,9) && a<= pow(10,9))\n {\n if(a<-10)\n { a= (-1)*a;\n for(b=1;b<50;b++)\n { x=a-b;\n while(x>0)\n {\n if(x%10==8)\n break;\n x/=10;\n }\n if(x>0)\n break;\n }\n printf(\"%d\",b);\n }\n else\n {\n for(b=1;b<50;b++)\n { x=a+b;\n while(x>0)\n {\n if(x%10==8)\n break;\n x/=10;\n }\n if(x>0)\n break;\n }\n printf(\"%d\",b); \n }\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n#include<stdlib.h>\n\nint main()\n{\n int r, q, count=0, luck=0;\n long a;\n scanf(\"%ld\", &a);\n while(luck==0) {\n a += 1;\n count++;\n q = a;\n while(q!=0) {\n r = q%10;\n if(abs(r)==8) {\n luck = 1;\n break;\n }\n q /= 10;\n }\n }\n printf(\"%d\", count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\nint a,c,b,dig,i;\nscanf(\"%d\",&a);\n\nfor(b=1;b<=16;b++)\n{\nc=a+b;\nwhile(c!=0)\n{\n\ndig=(abs(c))%10;\n\nif(dig==8)\n{\nprintf(\"%d\",b);\nreturn 0;\n}\n\nc=c/10;\n}\n\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,k=0,f,j;\n scanf(\"%d\",&a);\n if(a<0) j=-a;\n else j=a;\n if(a>=-8){\n for(i=j;i>=0;i++){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0&&a>0) {k++;continue;}\n else break;\n }\n }\n if(a<-8){\n for(i=j;i>7;i--){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0) {k++;continue;}\n else break;\n }\n }\n if(a<0&&a>=-8){a=-a; k=k+(a*2);}\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint check(long long int a) {\nif (a<0) {\n a = -1*a;\n}\nwhile(a!=0) {\nint b = a%10;\nif (b==8) {\n return 1;\n break;\n}\na = a/10;\n}\nreturn 0;\n}\nint main()\n{\n long long int n;\n int ans;\n scanf(\"%lld\",&n);\nint i=1;\nwhile(1==1) {\nlong long int a;\na = i+n;\nif (check(a) == 1) {\n ans = i;\n break;\n}\ni++;\n}\nprintf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint lucky(long int x)\n{\n x=abs(x);\n int d;\n while(x)\n {\n d=x%10;\n if(d==8)\n return 1;\n x=x/10;\n }\n return 0;\n}\nint main()\n{\n long int a,i;\n scanf(\"%ld\",&a);\n for(i=1;;i++)\n {\n if(lucky(a+i))\n {\n printf(\"%ld\\n\",i);\n exit(0);\n }\n }\n}"}, {"source_code": "//problema2\n#include<stdio.h>\n\n\nint buscar(long long a)\n{\n for(; a != 0 ; a /= 10) //divisiones sucesivas\n if(a%10 == 8 || a%10 == -8)//si algun digito es 8 o -8\n return 1;\n return 0;\n}\n\nint main()\n{\n long long a, a2;\n\n size_t sw = 0, i;\n\n scanf(\"%lld\",&a);\n\n a2 = a;\n\n for(i = 1 ; sw == 0 ; i++ , a2++)//repite el ciclo hasta encontrar el piso\n {\n sw = buscar(a2 + 1); //busca en una posicion superior\n } //si es el valor buscado pone la bandera a 1\n\n printf(\"%d\\n\",i-1); //i-1 es lo que hay que sumarle\n return 0; //a la posicion actual\n}\n"}, {"source_code": "#include <stdio.h>\nint main() \n {\n\tlong int n;\n\tint i,k,sum=0,dig,cnt=0;\n\tscanf (\"%ld\",&n);\n\tfor(i=n+1;;i++)\n\t{\n\t\tsum++; k=i;\n\t\twhile(k)\n\t\t{ \n if(abs(k%10)==8)\n { cnt=1; break;}\n k/=10;\n\t }\n\t if (cnt==1)\n\t break;\n\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint i,j,k,n,a , d , p , x , z ;\n\nint giga( int m )\n{\n int w ;\n while ( m > 0 )\n {\n w = m% 10 ;\n m = m/10 ;\n if ( w == 8 ) return 1 ;\n }\n\n return 0 ;\n}\n\nint main()\n{\n scanf(\"%d\", &a) ;\n\n if( a == 0)\n {\n printf(\"8\") ;\n return 0;\n }\n\n else if( a > 0 )\n {\n n = a%100 ;\n x = a / 100 ;\n k = n% 10 ;\n n = n/ 10 ;\n if ( 1 == giga( x) )\n {\n if( 1 == giga( a+1 ) ) printf(\"1\" );\n else printf(\"9\" );\n return 0 ;\n }\n\n\n // printf(\"test k = %d, n = %d \\n\", k, n) ;\n\n if ( n == 7 ) p = 10 - k ;\n else p = 8 - k ;\n\n if ( p < 0 ) p = 10 + p ;\n\n // printf(\"test p = %d\\n\", p) ;\n\n\n\n }\n else\n {\n a = -a ;\n x = a/100 ;\n if ( 1 == giga( x) )\n {\n\n printf(\"%d\", 2- giga(a-1) );\n return 0 ;\n }\n\n n = a%100 ;\n k = n% 10 ;\n n = n/ 10 ;\n\n if ( a <= 8 ) p = 8 + a ;\n\n else if ( n == 9 && k != 9 ) p = k +1 ;\n\n\n\n else\n {\n p = 2 + k ;\n p = p%10 ;\n\n }\n }\nif ( p == 0 ) p= 10 ;\nprintf(\"%d\", p) ;\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint b=0,digito,aux,num;\n\tscanf(\"%d\",&num);\n\n\tint ban=0;\n\twhile(ban ==0){\n\t\t++num;\n\t\t++b;\n\t\taux = abs(num);\n\t\twhile(aux!=0){\n\t\t\tdigito = aux%10;\n\t\t\tif(digito==8){\n\t\t\t\tban=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\taux=(aux-digito)/10;\n\t\t}\n\t}\n\t\t\n\tprintf(\"%d\\n\",b);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint main(void)\n{\n long long currFloor;\n scanf(\"%lld\", &currFloor);\n\n bool luckyNumberFound = false;\n long long luckyNumber = currFloor;\n\n while (!luckyNumberFound)\n {\n ++luckyNumber;\n long long number = luckyNumber;\n\n while (number != 0)\n {\n const long long REMAINDER = number % 10;\n if (abs(REMAINDER) == 8)\n {\n luckyNumberFound = true;\n break;\n }\n\n number /= 10;\n }\n }\n\n printf(\"%lld\", luckyNumber - currFloor);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tint n,i,t,y,flag=0;\n\tlong long int a;\n\tscanf(\"%lld\",&a);\n\ti=1;\n\twhile(1)\n\t{\n\t\tn=a+i;\n\t\t//printf(\"%d\\n\",n);\n\t\ty=n;\n\t\twhile(y!=0)\n\t\t{\n\t\t\tt=y%10;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif((t==8)||(t==-8))\n\t\t\t{\n\t\t\t\tflag=flag+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ty=y/10;\n\t\t\t//printf(\"%d\\n\",y);\n\t\t}\n\t\t//printf(\"%d\\n\",flag);\n\t\tif(flag==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ti=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint searchh(long long a)\n{\n for(;a!=0;a/=10)\n if(a%10==8||a%10==-8)\n return 1;\n return 0;\n}\nint main()\n{\n long long a,atemp;\n size_t flag=0, i;\n scanf(\"%lld\",&a);\n atemp=a;\n for(i=1;flag==0;i++,atemp++)\n {\n flag=searchh(atemp+1);\n }\n\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "/*Giga Tower*/\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint recorre(char V[], int tamanio);\n\nint main() {\n int a, b = 1;\n int seguir = 1;\n char f[11];\n\n scanf(\"%d\", &a);\n\n while (seguir) {\n a += 1;\n\n itoa(a,f,10);\n\n if (!recorre(f,11)) {\n\n b += 1;\n\n } else {\n\n seguir = 0;\n\n }\n\n }\n printf(\"%d\", b);\n\n return 0;\n}\n\nint recorre(char V[], int tamanio) {\n int k = 0;\n\n for (k = 0; k < tamanio && V[k]!='\\0'; k++) {\n if (V[k]=='8') {\n return 1;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\t\n\tlong int inp, steps = 0, value;\n\tint remain, found=0;\n\t\n\tscanf(\"%ld\", &inp);\n\twhile(1){\n\t inp++;\n\t steps++;\n\t value = inp;\n\t value = (value<0)? -value: value;\n\t while(value){\n\t remain = value%10;\n\t value = value/10;\n\t if(remain==8){\n\t found = 1;\n\t break;\n\t }\n\t }\n\t if(found==1)\n\t break;\n\t \n\t \n\t}\n\tprintf(\"%ld\",steps);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,k=0,f,j;\n scanf(\"%d\",&a);\n if(a<0) j=-a;\n else j=a;\n if(a>=-8){\n for(i=j;i>=0;i++){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0&&a>0) {k++;continue;}\n else break;\n }\n }\n if(a<-8){\n for(i=j;i>7;i--){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0) {k++;continue;}\n else break;\n }\n }\n if(a<0&&a>=-8){a=-a; k=k+(a*2);}\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n\tint floor ,floor2, luckyest ,num ,left, cont,solve,solve_cont;\n\n\tscanf(\"%d\",&floor);\n\n\tsolve=0;\n\tif (floor>0)\n\t{\n\t\tfloor=floor+1;\n\t\tfloor2=floor;\n\t\tcont=0;\n\t\twhile (solve==0)\n\t\t{\n\t\t\tfloor2=floor+cont;\n\t\t\twhile (floor2>0)\n\t\t\t{\n\t\t\t\tnum=floor2%10;\n\t\t\t\tif (num==8)\n\t\t\t\t{\n\t\t\t\t\tsolve=1;\n\t\t\t\t\tsolve_cont=cont+1;\n\t\t\t\t}\n\t\t\t\tfloor2=floor2-num;\n\t\t\t\tfloor2=floor2/10;\n\t\t\t}\n\t\t\tcont++;\n\t\t}\n\t\tprintf(\"%d\",solve_cont);\n\t}\n\tif (floor<0)\n\t{\n\t\tfloor=abs(floor);\n\t\tfloor2=floor-1;\n\t\tcont=1;\n\t\twhile (solve==0)\n\t\t{\n\t\t\tfloor2=floor-cont;\n\t\t\twhile (floor2!=0)\n\t\t\t{\n\n\t\t\t\tnum=floor2%10;\n\t\t\t\tif (abs(num)==8)\n\t\t\t\t{\n\t\t\t\t\tsolve=1;\n\t\t\t\t\tsolve_cont=cont;\n\t\t\t\t}\n\t\t\t\tfloor2=floor2-num;\n\t\t\t\tfloor2=floor2/10;\n\t\t\t}\n\t\t\tcont++;\n\t\t}\n\t\tprintf(\"%d\",solve_cont);\n\t}\n\tif(floor==0)\n\t{\n\t\tprintf(\"8\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long a;\n scanf(\"%ld\",&a);\n long i=0;\n\n\n if(a>0)\n {\n i=a+1;\n while(1)\n {\n long p=i;int counter=0;\n while(1)\n {\n \n int k=p%10;\n if(k==8)\n {\n counter++;\n }\n p=p/10;\n if(p/10<1 && p!=8)\n {\n break;\n }\n }\n if(counter>0)\n {\n break;\n }\n i++;\n }\n printf(\"%ld\",(i-a));\n }\n\n\n if(a<=0 && a>=-8)\n {\n printf(\"%ld\",(8-a));\n }\n\n\n\nif(a<0 && a<-8)\n{\n i=-a-1;\n while(1)\n {\n long p=i;int counter=0;\n while(1)\n {\n \n int k=p%10;\n if(k==8)\n {\n counter++;\n }\n p=p/10;\n if(p/10<1 && p!=8)\n {\n break;\n }\n }\n if(counter>0)\n {\n break;\n }\n i--;\n }\n printf(\"%ld\",(-(i+a)));\n}\n\n\n return 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\nint a,c,b,dig,i;\nscanf(\"%d\",&a);\n\nfor(b=1;b<=16;b++)\n{\nc=a+b;\nwhile(c!=0)\n{\n\ndig=(abs(c))%10;\n\nif(dig==8)\n{\nprintf(\"%d\",b);\nreturn 0;\n}\n\nc=c/10;\n}\n\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char cadena[30];\n int valor, verdadero = 0;\n int contador = 0;\n int i = 0;\n scanf(\"%s\", cadena);\n while(verdadero != 1)\n {\n valor = atoi(cadena);\n if(valor > 0 || valor < 0)\n {\n i = 0;\n valor++;\n contador++;\n itoa(valor, cadena, 10);\n while(cadena[i] != '\\0' && cadena[i] != '8')\n {\n i++;\n }\n if(cadena[i] == '8')\n {\n verdadero = 1;\n }\n }\n else\n {\n contador ++;\n valor = 1;\n itoa(valor, cadena, 10);\n }\n }\n printf(\"%d\",contador);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int b, a, sum;\n scanf(\"%d\", &a);\n for(b = 1; b < 21; b++){\n sum = b + a;\n if(sum < 0)sum = -sum;\n while(sum > 0){\n if(sum%10 == 8) break;\n else sum /=10;\n }\n if(sum > 0)break;\n }\n printf(\"%d\", b);\n return 0;\n}\n"}, {"source_code": "//problema2\n#include<stdio.h>\n\n\nint buscar(long long a)\n{\n for(; a != 0 ; a /= 10) //divisiones sucesivas\n if(a%10 == 8 || a%10 == -8)//si algun digito es 8 o -8\n return 1;\n return 0;\n}\n\nint main()\n{\n long long a, a2;\n\n size_t sw = 0, i;\n\n scanf(\"%lld\",&a);\n\n a2 = a;\n\n for(i = 1 ; sw == 0 ; i++ , a2++)//repite el ciclo hasta encontrar el piso\n {\n sw = buscar(a2 + 1); //busca en una posicion superior\n } //si es el valor buscado pone la bandera a 1\n\n printf(\"%d\\n\",i-1); //i-1 es lo que hay que sumarle\n return 0; //a la posicion actual\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid parseToChar(int n,char num[]){\n\tint aux = 0;\n\tif(n < 0) n *= -1; \n\twhile(n != 0){\n\t\tnum[aux] = '0' + (n % 10);\n\t\tn = n / 10;\n\t\taux++;\n\t}\n\tnum[aux] = '\\0';\n\treturn num;\n}\n\nint verificarNumero(int n){\n\tchar num[11];\n\tparseToChar(n,num);\n\tint cont;\n\tfor(cont = 0; num[cont] != '\\0'; cont++){\n\t\tif(num[cont] == '8') return 1;\n\t}\n\treturn 0;\n}\n\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint contador = 1;\n\twhile(verificarNumero(n + contador) != 1){\n\t\tcontador++;\n\t}\n\t\n\tprintf(\"%d\\n\", contador);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\n\nint main(){\n\tchar number[11], c;\n\tint i = 0, cont = 0, controlador = 1;\n\tscanf(\"%s\", number);\n\twhile(number[i] && controlador){\n\t\tif(number[i] == '8'){\n\t\t\tc++;\n\t\t\tif(i != strlen(number-1)){\n controlador = 0;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t}\n\tif(c > 1 && !controlador){\n\t\tprintf(\"1\");\n\t}else{\n\t i = 0;\n\t\tif(number[0] == '-'){\n char aux[strlen(number)-1];\n while(number[i]){\n aux[i] = number[i+1];\n i++;\n }\n long long int j = atoll(aux);\n j = j * -1;\n do{\n j++;\n cont++;\n lltoa(j, number, 10);\n i = 0;\n c = 0;\n while(number[i]){\n if(number[i] == '8'){\n c++;\n }\n i++;\n }\n }while(c < 1);\n\n\t\t}else{\n long long int j = atoll(number);\n do{\n j++;\n cont++;\n lltoa(j, number, 10);\n i = 0;\n c = 0;\n while(number[i]){\n if(number[i] == '8'){\n c++;\n }\n i++;\n }\n }while(c < 1);\n }\n printf(\"%d\", cont);\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint is8(long long int n)\n{\n if(n<0) n=-n;\n while(n)\n {\n if(n%10==8)\n return 1;\n n/=10;\n }\n return 0;\n}\nint main()\n{\n long long int n,c=0;\n scanf(\"%lld\",&n);\n n++;\n c++;\n while(!is8(n))\n n++,c++;\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint encontrar(long int a, int *ptrban);\n\nint main(){ //este algor\ufffdtmo trata sobre una ciudad en la que hay una torre de 17777777777 pisos,\n //(-8888888888 al 8888888888)se dice que si se visita cualquier piso de la torre con el\n //d\ufffdgito 8, se tendra buena suerte. El problema consiste en saber cuantos pisos encima\n //se encuentra el siguiente piso con d\ufffdgito 8(ej: 7=1, -20=2, 18=28 , 179=1,...)\n long int a;\n int b=0; //b= contador en el que se carga la cantidad de pisos que faltan para el siguiente con \"8\"\n int ban; //ban= una bandera que pasa a valer 0 si \"a\" es negativo\n ban=1; //inicialmente ban=1\n scanf(\"%d\",&a); //a=piso actual\n a++; //sumamos un piso a \"a\" para evitar esto. Ej: 18=0\n while(!encontrar(a,&ban)){ // mientras la funci\ufffdn encontrar devuelva 0 sigue el ciclo while\n b++; //mientras la funci\ufffdn encontrar no devuelva 1 \"b\" aumenta en 1 en cada ciclo\n a++; //mientras que la funcion encontrar no devuelva 1, subimos al siguiente piso\n }\n printf(\"%d\",b+1); //se imprime la cantidad de pisos subidos hasta encontrar el siguiente piso con un \"8\"\n return 0; //se le suma 1 a b porque al comienzo \"a\" se increment\ufffd en 1 y no se increment\ufffd b\n}\nint encontrar(long int a, int *ptrban){ //la funci\ufffdn encontrar recibe el piso actual y la bandera por referencia(puntero a ban)\n //la funci\ufffdn devuelve 1 de encontrar el digito 8 en el piso actual y 0 en caso contrario\n long int c=a; //cargamos en \"c\" al long int \"a\"\n if(a>-9 && *ptrban==1){ //si la bandera es igual a 1(+) \"a\" es mayor o igual a -8 se debe buscar el 8\n while(c>0 || a>0){ //mientras que \"c\" o \"a\" sean mayores a 0\n c=a-(a/10)*10; // EJ: c=192-(192/10)*10=192-19*10=192-190=2 ; carga en c la decima actual de a\n // 192/10=19 porque a es de tipo int y solo agarra la parte entera de 19.2\n a=a/10; //divide \"a\" entre 10 para que en el sgte ciclo sea: EJ: c= 19-(19/10)*10=9 ; el sgte\n //d\ufffdgito de \"a\"\n if(c==8 || a==8){ //si \"c\" o \"a\" == 8 retorna 1 que significa que encontr\ufffd 8\n return 1;\n }\n }\n }else{ //else es en caso de que a sea menor a -9 ya que todos los nros menores a -8 deben subir\n //a -8\n *ptrban=0; //ban=0 para que en la siguiente entrada en la funci\ufffdn vaya directamente al else\n while(c<0|| a<0){\n c=a-(a/10)*10;\n a=a/10;\n if(c==-8){ //si \"c\" ==-8 retorna 1 que significa que encontr\ufffd el d\ufffdgito \"8\"\n return 1;\n }\n }\n }\n return 0; //en caso de no encontrar 8 ni -8 retorna 0\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n long long x,c;\n int i=1,f=0,j;\n scanf(\"%I64d\",&x);\n while(f==0)\n {\n c=(long long)x+i;\n while(c!=0)\n {\n if(c%10==8||c%10==-8)\n {\n f=1;\n break;\n }\n c/=10;\n }\n i++;\n }\n printf(\"%d\",i-1);\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint temp=n;\n\tint rem,i,rem1;\n\tint count=0;\n\trem=n%10;\n\trem=abs(rem);\n\tn=n/10;\n//\tprintf(\"%d %d \",n,rem);\n\tfor(i=abs(n);i>0;i=i/10)\t\n\t{\n\t\trem1=i%10;\n\t\tif(rem1==8)\n\t\t\tcount++;\n\t}\n//\tprintf(\"%d \",count);\n\tif(count==1 && abs(n%10)==8 && n<0 && rem==0)\n\t\tprintf(\"8\\n\");\n\telse if(count==1 && abs(temp%80==0))\n\t\tprintf(\"2\\n\");\n\telse if((count!=0 && 8>=rem) || (count!=0 && rem==9 && n<0))\n\t\tprintf(\"1\\n\");\n\telse if(count!=0 && rem==9 && n>0)\n\t{\n\t//\tprintf(\"!\");\n\t\trem=n%10;\n\t\tif(rem!=8)\n\t\tprintf(\"1\\n\");\n\t\telse\n\t\t{\n\t\t\tif(count==1)\n\t\t\t\tprintf(\"9\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t//\tprintf(\"@\");\n\t\tif(7>=rem && temp>=0)\n\t\t{\n\t//\t\tprintf(\"$ %d\",rem);\n\t\t\tprintf(\"%d\\n\",8-rem);\n\t\t}\n\t\telse if(rem==8 && temp>0)\n\t\t{\n\t\t//\tprintf(\"^\");\n\t\t\tif(n%10!=7)\n\t\t\t\tprintf(\"10\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(rem==9 && temp>0)\n\t\t{\n\t\t//\tprintf(\"*\"); \n\t\t//\tprintf(\" %d \",n%10);\n\t\t\tif(n%10==7)\n\t\t\t\tprintf(\"1\\n\");\n\t\t\telse \n\t\t\t\tprintf(\"9\\n\");\n\t\t}\n\t\telse if(temp <=-1 && temp>=-10)\n\t\t{\n\t\t//\tprintf(\"?\");\n\t\t\tprintf(\"%d\\n\",8-temp);\n\t\t}\n\t\telse if(abs(n%10)==9 && n<0 &&temp!=-99)\n\t\t\tprintf(\"%d\\n\",abs(rem)+1);\n\t\telse if(rem!=8 && rem!=9 && n<0)\n\t\t{\n\t\t//\tprintf(\"+\");\n\t\t\tprintf(\"%d\\n\",abs(rem)+2);\n\t\t}\n\t\telse if(rem==9 && n<0)\n\t\t{\n\t\t//\tprintf(\"&\");\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(rem==8 && n<0)\n\t\t{\n\t\t//\tprintf(\"-\");\n\t\t\tprintf(\"10\\n\");\n\t\t}\n\t}\n\treturn 0;\n}\n\n\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//#include <string.h>\nint main()\n{\n long long signed int n,i,y,a,x;\n scanf(\"%lld\",&n);\n if(n>-8 && n<8)\n printf(\"%d\",8-n);\n else\n {\n for(i=1;i<=10;i++)\n {\n y=n;\n // printf(\"y=%d\\n\",y);\n if(y>0)\n {\n a=y+i;\n //printf(\"a=%d\\n\",a);\n x=0;\n if(a!=0)\n {\n // printf(\"Enter\\n\");\n while(a>0)\n {\n // printf(\"NO\");\n x=a%10;\n // printf(\"x=%d\",x);\n a=a/10;\n if(x==8)\n break;\n }\n if(x==8)\n {\n printf(\"%d\",i);\n break;\n }\n }\n }\n else\n {\n a=abs(y)-i;\n //printf(\"a=%d\\n\",a);\n x=0;\n if(a!=0)\n {\n // printf(\"Enter\\n\");\n while(a>0)\n {\n // printf(\"NO\");\n x=a%10;\n // printf(\"x=%d\",x);\n a=a/10;\n if(x==8)\n break;\n }\n if(x==8)\n {\n printf(\"%d\",i);\n break;\n }\n }\n }\n\n\n\n }\n if(x!=8)\n printf(\"16\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,k=0,f,j;\n scanf(\"%d\",&a);\n if(a<0) j=-a;\n else j=a;\n if(a>=-8){\n for(i=j;i>=0;i++){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0&&a>0) {k++;continue;}\n else break;\n }\n }\n if(a<-8){\n for(i=j;i>7;i--){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else if(k==0) {k++;continue;}\n else break;\n }\n }\n if(a<0&&a>=-8){a=-a; k=k+(a*2);}\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int a;\n\tscanf(\"%lld\",&a);\n\t long long int count = 0;\n\t long long int t = a;\n\n\tint flag = 0,flag1=1,x=0;\n\ta = a + 1;\n\twhile(flag!=1)\n\t{\n\t\tt = a;\n\t\tflag1=1;\n\t\t// printf(\"t is %lld and a is %lld\\n\",t,a);\n\t\twhile(x!=8)\n\t\t{\n\t\t\tx = t % 10;\n\t\t\t//printf(\"x and t are %d and %lld\\n\",x,t);\n\t\t\tif(x == 8 || x==-8)\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t}\n\t\t\tif(flag == 1)\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t{\n\t\t\t\tt = t/10;\n\t\t\t\tif(fabs(t)==0)\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\t\t\n\t\t}\n\t\ta++;\n\t\tcount++;\n\t\t\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n\n}"}, {"source_code": "\n#include <stdio.h>\n#include <string.h>\nint main()\n{\n long long b;\n scanf(\"%lld\",&b);\n if(b<=-9)\n {\n int i=1;\n while(1){\n long long a=-b-i;\n while(a!=0)\n {\n int r=a%10;if(r==8){printf(\"%d\",i);return 0;}\n a/=10;\n }\n i++;\n }\n }\n\n\n\n int i=1;\n while(1){\n long long a=b+i;\n while(a!=0)\n {\n int r=a%10;if(r==8){printf(\"%d\",i);return 0;}\n a/=10;\n }\n i++;\n\n\n }\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint buscasuerte(int x);\nint main (){\n\tint a,resp;\n\tscanf(\"%i\",&a);\n\tresp=buscasuerte(a);\n printf(\"%i\",resp);\n}\n\nint buscasuerte(int x){\n\tint b,c,rta,q=0,band=0;\n\tb=x;\n\t\twhile(band==0){\n\t\t\tb++;c=b;\n\t\t\tq++;\n\t\t\twhile(c!=0 && band==0){\n\t\t\t\tif (c<0)c=-c;\n\t\t\t\tif(c%10==8){\n\t\t\t\t\tband=1;\n\t\t\t\t}else{\n\t\t\t\t\tc=(c-c%10)/10;\n\t\t\t\t} \n\t\t\t}\n\t\t}\t\n\t\treturn q;\t\t\t\n\n}\n"}, {"source_code": "#include<stdio.h>\nint lucky(long x,int l)\n{\n if(x<0)\n x=-x;\n while(x>0)\n {\n if(x%10 == l)\n return 1;\n else\n x/=10;\n }\n return 0;\n}\nint main()\n{\n long n;\n int l=8;\n scanf(\"%ld\",&n);\n for(int p = 1;p <= 1000; p++)\n {\n if(lucky(n+p,l))\n {\n printf(\"%d\\n\",p);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,i,temp,x,state=0,ans;\n\tscanf(\"%d\",&a);\n\tfor(i=1;i<17;i++)\n\t{\n\t\tstate=0;\n\t\ttemp=a+i;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tx=temp%10;\n\t\t\ttemp/=10;\n\t\t\tif(x==8||x==-8)\n\t\t\t{\n\t\t\t\tstate=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(state==1)\n\t\t{\n\t\t\tans=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint ch(int n){\n\tif(n<0)n*=-1;\n\twhile(n!=0){\n\t\tif((n%10)==8) return 1;\n\t\tn/=10;\n\t}\n\treturn 0;\n}\nint main(){\n\tint a,b;\n\tscanf(\"%d\",&a);\n\tfor(b=1;b<=20;b++){\n\t\tif(ch(a+b)){printf(\"%d\",b);break;}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint func(int a)\n{\n int rem,b=0,c;\n while(1)\n{\n ++b;\n c=abs(a+b);\n while(c>0)\n {\n rem=c%10;\n c=c/10;\n if(rem == 8) return b;\n}\n}\n}\n\nint main()\n{\nint a,ans;\nscanf(\"%d\",&a);\nans = func(a);\nprintf(\"%d\",ans);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define N 200001\n\nint haveeight(int n)\n{\n while(n)\n {\n if(abs(n % 10) == 8) return 1;\n n /= 10;\n }\n return 0;\n}\n\nint main()\n{\n int a, cnt = 0;\n scanf(\"%d\", &a);\n a++, cnt++;\n while(!haveeight(a)) a++, cnt++;\n printf(\"%d\\n\", cnt);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,e,f,g,h,i,j;\n scanf(\"%I64d\",&a);\n for(b=1;b<=21;b++)\n {\n e=a+b;\n if(e<0)\n e=-e;\n while(e>0)\n {\n if(e%10==8)\n break;\n else\n e=e/10;\n }\n if(e>0)\n break;\n }\n printf(\"%I64d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint buscasuerte(int x);\nint main (){\n\tint a,resp;\n\tscanf(\"%i\",&a);\n\tresp=buscasuerte(a);\n printf(\"%i\",resp);\n}\n\nint buscasuerte(int x){\n\tint b,c,rta,q=0,band=0;\n\tb=x;\n\t\twhile(band==0){\n\t\t\tb++;c=b;\n\t\t\tq++;\n\t\t\twhile(c!=0 && band==0){\n\t\t\t\tif (c<0)c=-c;\n\t\t\t\tif(c%10==8){\n\t\t\t\t\tband=1;\n\t\t\t\t}else{\n\t\t\t\t\tc=(c-c%10)/10;\n\t\t\t\t} \n\t\t\t}\n\t\t}\t\n\t\treturn q;\t\t\t\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint lucky(int n) {\n\tn = n < 0 ? -n : n;\n\twhile (n > 0) {\n\t\tif (n % 10 == 8)\n\t\t\treturn 1;\n\t\tn /= 10;\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint a, b;\n\n\tscanf(\"%d\", &a);\n\tfor (b = 1; ; b++)\n\t\tif (lucky(a + b)) {\n\t\t\tprintf(\"%d\\n\", b);\n\t\t\treturn 0;\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint lucky(long x)\n{\n if(x<0)\n x=-x;\n while(x>0)\n {\n if(x%10 == 8)\n return 1;\n else\n x/=10;\n }\n return 0;\n}\nint main()\n{\n long n;\n scanf(\"%ld\",&n);\n for(int p = 1;p <= 1000; p++)\n {\n if(lucky(n+p))\n {\n printf(\"%d\\n\",p);\n return 0;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain()\n{\n int n,i,y=0,m=0,l;\n scanf(\"%d\", &n);\n i=n;\n if (n==8888888888)\n {\n printf(\"0\");\n m=1;\n }\n while (m!=1)\n {\n i++;\n l=i;\n if (i<0)\n {\n l*=-1;\n }\n while (l>0)\n {\n if (l%10==8)\n {\n m=1;\n break;\n }\n l/=10;\n }\n y++;\n }\n printf(\"%d\", y);\n}"}, {"source_code": "#include <stdio.h>\nlong long int abs1(long long int a)\n{\n if(a<0)\n return -a;\n else\n return a;\n}\nint main()\n{\n long long int a,b;\n \n scanf(\"%lld\",&a);\n b=a;\n int i,r;\n for(i=1;;i++)\n {\n b=a+i;\n while(abs1(b)>0)\n {\n if(abs1(b)%10==8)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n else\n b=-abs1(b)/10;\n\n\n }\n }\n\n}"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main(){\n long long int digit;\n char buffer[10];\n int i;\n int cont = 0;\n int n;\n int encontrado = 0;\n int aux=1;\n \n scanf(\"%d\",&digit);\n \n if (digit< 0){\n aux = -1;\n }\n do{\n cont++;\n digit++;\n digit = digit * aux;\n sprintf (buffer, \"%d\" , digit);\n digit = digit * aux;\n n = strlen(buffer);\n for (i = 0;i<n;i++){\n if(buffer[i] == '8'){\n encontrado = 1;\n }\n }\n }while(encontrado == 0);\n printf(\"%d\",cont);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,i,temp,x,state=0,ans;\n\tscanf(\"%d\",&a);\n\tfor(i=1;i<17;i++)\n\t{\n\t\tstate=0;\n\t\ttemp=a+i;\n\t\twhile(temp!=0)\n\t\t{\n\t\t\tx=temp%10;\n\t\t\ttemp/=10;\n\t\t\tif(x==8||x==-8)\n\t\t\t{\n\t\t\t\tstate=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(state==1)\n\t\t{\n\t\t\tans=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) \n{\n\tint n,i,t,y,flag=0;\n\tlong long int a;\n\tscanf(\"%lld\",&a);\n\ti=1;\n\twhile(1)\n\t{\n\t\tn=a+i;\n\t\t//printf(\"%d\\n\",n);\n\t\ty=n;\n\t\twhile(y!=0)\n\t\t{\n\t\t\tt=y%10;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif((t==8)||(t==-8))\n\t\t\t{\n\t\t\t\tflag=flag+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ty=y/10;\n\t\t\t//printf(\"%d\\n\",y);\n\t\t}\n\t\t//printf(\"%d\\n\",flag);\n\t\tif(flag==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ti=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long a,temp;\n\tint b,count=0,count1=0,flag=0;\n\t\n\tscanf(\"%lld\",&a);\n\t\n while(1)\n {\n a++;\n\t count++;\n temp=a;\n if(temp<0)\n temp=-temp;\n\n while(temp>0)\n {\n b=temp%10;\n temp=temp/10;\n if(b==8)\n { \n\t\t\t flag=1;\n\t\t\t break;\n\t\t\t } \n }\n\n\tif(flag==1)\n\t\tbreak;\t\n }\n\t\n\tprintf(\"%d\",count);\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\t\nmain()\n{\n\tlong long int a,n;\n\tint b,c=0,i=0,l;\n\tscanf(\"%lli\",&a);\n\twhile(c==0)\n\t{\n\t\ti++;\n\t\tn=a+i;\n\t\twhile(n!=0)\n\t\t{\n\t\t\tl=n%10;\n\t\t\tn=n/10;\n\t\t\tif(l==8||l==-8) c=1;\n\t\t}\n\t}\n\tb=(a+i)-a;\n\tprintf(\"%d\",b);\n\t}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint quita_digitos(long long int aux,int encontro_8);\n\nint main(){\n long long int piso_actual,i,aux;\n int subir,encontro_8=0;/// subir: Contiene la cantidad de pisos que debe subir\n ///encontro_8: si se encuentra un d\u00edgito 8\n ///esta variable se pone en 1, 0 en caso contrario\n\n scanf(\"%I64d\",&piso_actual);\n\n if (piso_actual == 8){\n printf(\"10\");\n }else if(piso_actual < 8 && piso_actual >= -8){\n printf(\"%d\",8-piso_actual);\n }else{\n for(subir=1; subir<=10 && !encontro_8 ; subir++){\n aux= piso_actual + subir;\n encontro_8= quita_digitos(aux,0);\n if(encontro_8){\n printf(\"%d\",subir);\n }\n }\n }\n\n return 0;\n}\nint quita_digitos(long long int aux, int encontro_8){\n while(aux != 0 && !encontro_8){\n /** El if busca digito por digito el numero 8 o el -8*/\n if(aux%10 == -8 || aux%10 == 8){\n encontro_8= 1;\n }else{\n aux= aux/10;/// Reduce la cifra\n }\n }\n return encontro_8;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint tiene8( long long int a );\n\nint main(){\n\n\tlong long int a; /* El piso en que esa */\n\tint b; /* Cuanto le falta por subir si */\n\n\tscanf( \"%I64d\" , &a );\n\n\tfor( b = 0 ; b == 0 || !tiene8( a ) ; b++ )\t/* mientras no haya 8 en a, repetir el cilo; a no ser que b == 0 */\n\t\ta++;\n\n\tprintf( \"%d\\n\" , b );\n\n\treturn 0;\n}\n\nint tiene8( long long int a ){ /* retorna si el numero a tiene un 8 */\n\n\tchar numero[ 20 ];\n\n\tint r = 0;\n\tint i;\n\n\tsprintf( numero , \"%I64d\" , a );\n\n\tfor( i = 0 ; numero[ i ] != '\\0' ; i++ ){\n\n\t\tif( numero[ i ] == '8' ){\n\n\t\t\tr = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn r;\n}\n"}, {"source_code": "#include<stdio.h>\nint searchh(long long a)\n{\n for(;a!=0;a/=10)\n if(a%10==8||a%10==-8)\n return 1;\n return 0;\n}\nint main()\n{\n long long a,atemp;\n size_t flag=0, i;\n scanf(\"%lld\",&a);\n atemp=a;\n for(i=1;flag==0;i++,atemp++)\n {\n flag=searchh(atemp+1);\n }\n\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, m, i;\n scanf(\"%I64d\", &n);\n i = n;\n while(1)\n {\n n++;\n m = n;\n while(m)\n {\n if(m % 10 == 8 || m % 10 == -8)\n {\n printf(\"%I64d\", n - i);\n return 0;\n }\n m /= 10;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint hasEight(int x){\n if(x < 0)\n x *= -1;\n while(x > 0){\n if(x%10 == 8)\n return 1;\n x /= 10;\n }\n return 0;\n}\n\nint main(){\n int x,y = 0;\n scanf(\"%d\", &x);\n while(x <= 8888888888){\n\n if(hasEight(x) && y != 0)\n break;\n x = x + 1;\n y++;\n }\n printf(\"%d\", y);\n return 0;\n}\n"}, {"source_code": "int invalid(int n){\n char buffer[16];\n sprintf(buffer, \"%d\", n);\n char *ptr = buffer;\n while ( *ptr ) {\n if ( *ptr++ == '8')\n return 0;\n }\n return 1;\n }\n\n int main(){\n int n;\n scanf(\"%d\", &n);\n int count =0 ;\n if ( !invalid ( n ) ){\n n++;\n count++;\n }\n\n while ( invalid(n)){\n n++;\n count++;\n }\n printf (\"%d\\n\", count);\n return 0;\n }"}, {"source_code": "#include <stdio.h>\nchar Have8(int x)\n{\n if(x < 0)\n x = -x;\n while(x > 0)\n {\n if(x % 10 == 8)\n return 1;\n x /= 10;\n }\n return 0;\n}\nint main()\n{\n int a, ans = 0;\n scanf(\"%d\", &a);\n while(1)\n {\n ans++;\n if(Have8(++a) == 1)\n {\n printf(\"%d\\n\", ans);\n break;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define loop(i,x,y) for(i=x;i<y;i++)\n\n#define sd(x) scanf(\"%d\",&x)\n#define slld(x) scanf(\"%lld\",&x)\n#define sllu(x) scanf(\"%llu\",&x)\n#define sstr(x) scanf(\"%s\",x)\n\n#define pd(x) printf(\"%d\",x)\n#define plld(x) printf(\"%lld\",x)\n#define pllu(x) printf(\"%llu\",x)\n#define pstr(x) printf(\"%s\",x)\n#define pnl printf(\"\\n\")\n\ntypedef long long int lld;\ntypedef unsigned long long int llu;\n\nint check(lld n)\n{\n\tint temp;\n\twhile(n!=0)\n\t{\t\n\t\ttemp=n%10;\n\t\tif(temp==8||temp==-8)\n\t\t\treturn 1;\n\t\tn/=10;\n\t}\n\treturn 0;\n}\n\nint main()\n{\n\tlld n,i=1;\n\tslld(n);\n\twhile(1)\n\t{\t\n\t\tif(check(n+i))\n\t\t\tbreak;\n\t\ti++;\n\t\t//plld(n+i);\n\t}\n\tplld(i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MAX 8888888888\n\nint test(int n) {\n \n while(n) {\n if(n%10 == 8) return 1;\n n /= 10;\n }\n \n return 0;\n}\n\nint main() {\n \n int a, ans=0;\n \n scanf(\"%d\", &a);\n a++;\n while(a<=MAX) {\n ans++;\n if(test(abs(a))) break;\n a++;\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main(){\n int dig,cant = 0;\n long int piso,a,b,pix,esc;\n scanf(\"%d\",&piso);\n a= pow(10,9);\n b= pow(10,9)* -1;\n if(piso < b || piso > a){\n printf(\"Valor no valido. Intente de nuevo:\\n\");\n scanf(\"%d\",&piso);\n }\n esc = piso*10;\n if(piso == 0){\n printf(\"8\");\n }else{\n while(piso != esc){\n piso++;\n pix = piso;\n ++cant;\n do{\n dig = abs(pix%10);\n pix = pix/10;\n if(dig == 8){\n printf(\"%d\\n\",cant);\n piso = esc;\n }\n }while(pix != 0 && piso != esc);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint hasEight(int x){\n if(x < 0)\n x *= -1;\n while(x > 0){\n if(x%10 == 8)\n return 1;\n x /= 10;\n }\n return 0;\n}\n\nint main(){\n int x,y = 0;\n scanf(\"%d\", &x);\n while(x <= 8888888888){\n\n if(hasEight(x) && y != 0)\n break;\n x = x + 1;\n y++;\n }\n printf(\"%d\", y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint is8(long long int n)\n{\n if(n<0) n=-n;\n while(n)\n {\n if(n%10==8)\n return 1;\n n/=10;\n }\n return 0;\n}\nint main()\n{\n long long int n,c=0;\n scanf(\"%lld\",&n);\n n++;\n c++;\n while(!is8(n))\n n++,c++;\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint lucky(int n) {\n\tn = n < 0 ? -n : n;\n\twhile (n > 0) {\n\t\tif (n % 10 == 8)\n\t\t\treturn 1;\n\t\tn /= 10;\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint a, b;\n\n\tscanf(\"%d\", &a);\n\tfor (b = 1; ; b++)\n\t\tif (lucky(a + b)) {\n\t\t\tprintf(\"%d\\n\", b);\n\t\t\treturn 0;\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int encontrar(long int n);\nint main(){\n\tlong int n=0,x=0;\n\tscanf(\"%ld\",&n);\n\tx=encontrar(n);\n\tprintf(\"%ld\",x);\n\treturn 0;\n}\nlong int encontrar(long int n){\n\tint encontrado=0;long int N=0,C=0;\n\tn++;\n\twhile(encontrado==0){\n\t\tN=n;\n\t\tif(encontrado==0){\n\t\t\t\n\t\t\tn++;\n\t\t\tC++;\n\t\t\t\n\t\t}\n\t\twhile(N%10==0 && N!=0){\n\t\t\tN=N/10;\n\t\t}\n\t\twhile(N/10!=0 && encontrado==0){\n\t\t\tif(abs(N%10)==8){\n\t\t\t\tencontrado=1;\n\t\t\t\t\n\t\t\t}\n\t\t\t\tN=N/10;\n\t\t\t\t\n\t\t\t\t\n\t\t}\n\t\tif(abs(N)==8){\n\t\t\tencontrado=1;\n\t\t}\n\t\t\n\t}\n\treturn C;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int z = n;\n n = n+1;\n int flag = 0;\n while(1){\n int x = n;\n int rem = 0;\n while(x!=0){\n rem = x%10;\n if(rem == 8 || rem == (-8)){\n printf(\"%d\",n-z);\n flag = 1;\n break;\n }\n x = x/10;\n }\n if(flag==1){\n break;\n }\n n++;\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint encontrar(long int a, int *ptrban);\n\nint main(){\n long int a,aa;\n int b=0;\n int ban;\n ban=1;\n scanf(\"%d\",&a);\n a++;\n while(!encontrar(a,&ban)){\n b++;\n a++;\n }\n printf(\"%d\",b+1);\n return 0;\n}\nint encontrar(long int a, int *ptrban){\n long int c=a;\n if(a>-9 && *ptrban==1){\n while(c>0|| a>0){\n c=a-(a/10)*10;\n a=a/10;\n //printf(\"+c=%d.a=%d+\",c,a);\n if(c==8 || a==8){\n return 1;\n }\n }\n }else{\n *ptrban=0;\n while(c<0|| a<0){\n c=a-(a/10)*10;\n a=a/10;\n if(c==-8){\n return 1;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i;\n\tlong long int a,q;\n\tscanf(\"%lld\",&a);\n\tq=a+1;\n\twhile(q!=0)\n\t{\n\t\tif(q%10==8||q%10==-8)\n\t\t{\n\t\t\tprintf(\"1\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tq=q/10;\n\t}\n\tfor(i=1;i<=20;i++)\n\t{\n\t\t++a;\n\t\tif(a%10==8||a%10==(-8)||((a%100)/10==8)||((a%100)/10==(-8)))\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n\nint islucky(int n){\n \n if(n<0){\n n=-n;\n }\n \n int modfac=10;\n int divfac=1;\n\n while(n/divfac>0){\n int digit=(n%modfac)/divfac;\n if(digit==8){\n return 1;\n }\n modfac*=10;\n divfac*=10;\n }\n \n return 0; //n is not lucky\n}\n\nint main(void){\n\n int a;\n int b=1;\n scanf(\"%d\", &a);\n\n while(islucky(a+b)==0){\n b+=1;\n }\n printf(\"%d\\n\", b);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n long long int a,b,i,j;\n scanf(\"%lld\",&a);\n i=0;\n j=0;\n while(1)\n {\n i++;\n a=a+1;\n b=abs(a);\n while(b!=0)\n {\n if(b%10==8)\n j=1;\n b=b/10;\n }\n if(j==1)\n break;\n }\n printf(\"%lld\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int b, a, sum;\n scanf(\"%d\", &a);\n for(b = 1; b < 21; b++)\n {\n sum = b + a;\n if(sum < 0)\n {\n sum = -sum;\n }\n while(sum > 0)\n {\n if(sum%10 == 8)\n {\n break;\n }else{\n sum = sum/10;\n }\n }\n if(sum > 0)\n {\n break;\n }\n }\n printf(\"%d\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,j,m,k,i=0,c=0,p,q,t;\n scanf(\"%lld\",&n);\n j =n;\n m = n%10;\n t = n/10;\n t = t%10;\n if(m<0)\n {\n q = -m;\n }\n else\n {\n q=m;\n }\n\n k = m-8;\n\n if(k<0)\n {\n k = -k;\n }\n while(n!=0)\n {\n p = n%10;\n\n if(p==8 || p==-8)\n {\n c++;\n }\n n = n/10;\n i++;\n }\n if(t==8 && q==9)\n {\n printf(\"9\");\n }\n else if(t==7 && q==8)\n {\n printf(\"2\");\n }\n else if(t==-9)\n {\n printf(\"%lld\",q+1);\n }\n else if(j%80==0 && j>0)\n {\n printf(\"8\");\n }\n else if(j%80==0 && j<0)\n {\n printf(\"2\");\n }\n else if(c>0 && q!=8 || c>1 && q==8)\n {\n printf(\"1\");\n }\n else if(j<0 && m==-9)\n {\n printf(\"1\");\n }\n else if(j>0 && m==9)\n {\n j = j/10;\n j = j%10;\n if(j==7)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"9\");\n }\n }\n else if(j<-10 && m!=0)\n {\n m= -m;\n printf(\"%lld\",m+2);\n }\n else if(j<0 && m==0)\n {\n printf(\"2\");\n }\n else if(k==0)\n {\n printf(\"10\");\n }\n else\n {\n printf(\"%lld\",k);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,n;\n\tlong long int t,q;\n\tscanf(\"%lld\",&t);\n\tfor(i=1;i<16;i++)\n\t{\n\t\tint flag=0;\n\t\tq=t+1;\n\t\tif(q<0)\n\t\t\tq=-q;\n\t\twhile(q>0)\n\t\t{\n\t\t\t\n\t\t n=q%10;\n\t\t if(n==8)\n\t\t {\n\t\t\t flag=1;\n\t\t\t break;\n\t\t }\n\t\t q=q/10;\n\t\t}\n\t\tif(flag==1)\n\t\t\tbreak;\n\t\tt++;\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "/*Giga Tower es el edificio m\ufffds alto y m\ufffds profundo en Cyberland. Hay 17 777 777 777 pisos, numerados de - 8 888 888 888 a 8 888 888 888 . En\nparticular, hay el piso 0 entre el piso - 1 y el piso 1 . Todos los d\ufffdas, miles de turistas vienen a este lugar para disfrutar de la maravillosa\nvista.\n\nEn Cyberland, se cree que el n\ufffdmero \"8\" es un n\ufffdmero de la suerte (es por eso que Giga Tower tiene 8 888 888 888 pisos sobre el suelo), y un entero\nes afortunado , si y solo si su notaci\ufffdn decimal contiene al menos uno d\ufffdgito \"8\". Por ejemplo, 8, - 180, 808 son afortunados, mientras que 42, - 10\nno. En la Torre Giga, si escribes c\ufffddigo en un piso con el n\ufffdmero del piso de la suerte, la buena suerte siempre estar\ufffd contigo (Bueno, esta ronda\nes # 278, tambi\ufffdn afortunada, \ufffdeh?).\n\nEl turista Henry va a la torre a buscar buena suerte. Ahora \ufffdl est\ufffd en el piso numerado a . Quiere encontrar el m\ufffdnimo positivo n\ufffdmero entero b , de\ntal manera que, si camina b pisos superiores, que llegar\ufffdn a un piso con una suerte de n\ufffdmero.\n\nEntrada\nLa \ufffdnica l\ufffdnea de entrada contiene un n\ufffdmero entero a ( - 10 9 <= a <= 10 9 ).\n\nSalida\nImprima el m\ufffdnimo b en una l\ufffdnea.*/\n#include<stdio.h>\n#include <stdlib.h>\n\nint CantidadCifras(int x);\nint SeparacionDigitos(int n, int dimension);\nint Posicion(int n, int dimension);\n//Programa principal\nint main(){\n\n int a, pos, aux, comprobacion = 0, cantidad, c = 0;\n\n do{\n scanf(\"%d\", &a);\n\n }while(a < -1000000000 && a > 1000000000);\n\n if (a >= 0){\n cantidad = CantidadCifras(a);\n // comprobacion = SeparacionDigitos(a, cantidad);\n }else{\n aux = a*(-1);\n cantidad = CantidadCifras(aux);\n // comprobacion = SeparacionDigitos(aux, cantidad);\n }\n\n// printf(\"%d---\", cantidad);\n\n/*\n\n if (comprobacion == 1) {\n\n if (a >= 0){\n pos = Posicion(a, cantidad);\n }else{\n pos = Posicion(aux, cantidad);\n }\n if (pos > ){\n --\n }\n }*/\n while(comprobacion != 1){\n a++;\n c++;\n// printf(\"%d---%d\\n\", a, c);\n if (a >= 0){\n comprobacion = SeparacionDigitos(a, cantidad);\n }else{\n aux = a*(-1);\n// printf(\"%d-%d\\n\", a, c);\n comprobacion = SeparacionDigitos(aux, cantidad);\n }\n }\n printf(\"%d\", c);\n\n return 0;\n}\n\nint CantidadCifras(int numero){\n\n int contador = 1;\n while((numero/10) > 0){\n\n numero = numero/10;\n contador++;\n }\n// printf(\"%d...\", contador);\n return contador;\n}\nint SeparacionDigitos(int n, int dimension){\n\n int vector[dimension];\n int vector2[dimension];\n int i = 0;\n int j = 0;\n\n while(n > 0){\n\n vector[i] = n % 10;\n i++;\n n = n/10;\n }\n\n\n for (i = dimension - 1 ; i >= 0; i--){\n vector2[j] = vector[i];\n j++;\n }\n\n for (i = 0; i < dimension; i++){\n if (vector2[i] == 8){\n return 1;\n }\n }\n\n return 0;\n}\n\nint Posicion(int n, int dimension){\n\n int vector[dimension];\n int vector2[dimension];\n int i = 0;\n int j = 0;\n\n while(n > 0){\n\n vector[i] = n % 10;\n i++;\n n = n/10;\n }\n\n\n for (i = dimension - 1 ; i >= 0; i--){\n vector2[j] = vector[i];\n j++;\n }\n\n\n for (i = 0; i < dimension; i++){\n if (vector2[i] == 8){\n return i;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint i,j,k,n,a , d , p , x , z ;\n\nint giga( int m )\n{\n int w ;\n while ( m > 0 )\n {\n w = m% 10 ;\n m = m/10 ;\n if ( w == 8 ) return 1 ;\n }\n\n return 0 ;\n}\n\nint main()\n{\n scanf(\"%d\", &a) ;\n\n if( a == 0)\n {\n printf(\"8\") ;\n return 0;\n }\n\n else if( a > 0 )\n {\n n = a%100 ;\n x = a / 100 ;\n k = n% 10 ;\n n = n/ 10 ;\n if ( 1 == giga( x) )\n {\n if( 1 == giga( a+1 ) ) printf(\"1\" );\n else printf(\"9\" );\n return 0 ;\n }\n\n\n // printf(\"test k = %d, n = %d \\n\", k, n) ;\n\n if ( n == 7 ) p = 10 - k ;\n else p = 8 - k ;\n\n if ( p < 0 ) p = 10 + p ;\n\n // printf(\"test p = %d\\n\", p) ;\n\n\n\n }\n else\n {\n a = -a ;\n x = a/100 ;\n if ( 1 == giga( x) )\n {\n\n printf(\"%d\", 2- giga(a-1) );\n return 0 ;\n }\n\n n = a%100 ;\n k = n% 10 ;\n n = n/ 10 ;\n\n if ( a <= 8 ) p = 8 + a ;\n\n else if ( n == 9 && k != 9 ) p = k +1 ;\n\n\n\n else\n {\n p = 2 + k ;\n p = p%10 ;\n\n }\n }\nif ( p == 0 ) p= 10 ;\nprintf(\"%d\", p) ;\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint lucky(int n)\n{\n\tn = abs(n);\n\twhile (n >0)\n\t{\n\t\tif (abs(n) % 10 == 8)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\tn /= 10;\n\t}\n\treturn 1;\n}\t\n\nint main(void) {\n\t// increase b\n\t//check if current floor is lucky\n\tint n;\n\tscanf(\"%d\", &n);\n\tint b =1;\n\twhile (lucky(n + b) != 0)\n\t{\n\t\tb++;\n\t}\n\tprintf(\"%d\", b);\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint k (int x){\nint i,z=10,y=x;\nx=abs(x);\ny=x;\nfor(i=0;i<17;i++){\nif(x%z!=8){\n\n x=x/10;\n}\nelse if(x%10==8){\n return x;\n break;}\n\n }\n if(x==0)\n return y;\n\n}\n\nint main()\n{\nint g,n,count=0,i,z,b;\nscanf(\"%d\",&n);\nint d=n;\ng=k(n);\nfor(i=0;i<100;i++){\nif(g%10==8){\ncount++;\nn++;\nz=k(n);\nif(z%10==8)\n break;\n\n}\nelse if(g%10!=8){\n\n\n\n n++;\n count++;\nb=k(n);\n\n\nif(b%10==8)\n break;\n }}\n printf(\"%d\",count);}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b,c,d;\n while(scanf(\"%d\",&a)!=EOF)\n {\n b=a,d=1;\n while(d)\n {\n c=a+1;\n while(c)\n {\n if(c%10==8 || c%10==-8)\n {\n printf(\"%d\\n\",a-b+1);\n d=0;\n break;\n }\n c/=10;\n }\n a++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main(){\n long long int nro; char aux[10]; int i; int c = 0; int n; int band = 0;\n int aux2=1;\n scanf(\"%d\",&nro);\n if (nro< 0){\n aux2 = -1;\n }\n do{\n c++;\n nro++;\n nro = nro * aux2;\n sprintf (aux, \"%d\" , nro);\n nro = nro * aux2;\n n = strlen(aux);\n for (i = 0;i<n;i++){\n if(aux[i] == '8'){\n band = 1;\n }\n }\n }while(band == 0);\n printf(\"%d\",c);\n return 0;\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint b=0,digito,aux,num;\n\tscanf(\"%d\",&num);\n\n\tint ban=0;\n\twhile(ban ==0){\n\t\t++num;\n\t\t++b;\n\t\taux = abs(num);\n\t\twhile(aux!=0){\n\t\t\tdigito = aux%10;\n\t\t\tif(digito==8){\n\t\t\t\tban=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\taux=(aux-digito)/10;\n\t\t}\n\t}\n\t\t\n\tprintf(\"%d\\n\",b);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main(){\n long long int nro;\n char aux[10];\n int i;\n int c = 0;\n int n;\n int band = 0;\n int aux2=1;\n\n scanf(\"%d\",&nro);\n\n if (nro< 0){\n aux2 = -1;\n }\n do{\n c++;\n nro++;\n nro = nro * aux2;\n sprintf (aux, \"%d\" , nro);\n nro = nro * aux2;\n n = strlen(aux);\n for (i = 0;i<n;i++){\n if(aux[i] == '8'){\n band = 1;\n }\n }\n }while(band == 0);\n printf(\"%d\",c);\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,nn,i=1,mv=0;\n scanf(\"%lld\",&n);\n nn=n;\n int f=0;\n if(n>=0)\n {\n while(f==0)\n {\n n=nn+i;\n i++;\n mv++;\n while(n>0)\n {\n ll rem=n%10;\n if(rem==8)\n {\n f=1;\n break;\n }\n n/=10;\n }\n \n }\n }\n else if(n>=-8)\n mv=8-n;\n else\n {\n //printf(\"a\");\n n=abs(n);\n nn=abs(nn);\n //printf(\"%lld %lld\",n,nn);\n while(f==0)\n {\n n=nn-i;\n i++;\n mv++;\n \n while(n>0)\n {\n ll rem=n%10;\n if(rem==8)\n {\n f=1;\n break;\n }\n n/=10;\n }\n \n }\n }\n //ll mv=n-nn-1;\n printf(\"%lld\",mv);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint count=0;\nint extra(int n)\n{\n\n int a[2000000],c=0,i=0;\n count++;\n while(n!=0)\n {\n a[i++]=n%10;\n n/=10;\n c++;\n }\n for(i=0;i<c;i++)\n {\n if(a[i]==8||a[i]==-8)\n {\n return 1;\n }\n\n }\n return 0;\n}\n\nint main()\n\n{\n int n;\n count=0;\n scanf(\"%d\",&n);\n while(!extra(++n));\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int z = n;\n n = n+1;\n int flag = 0;\n while(1){\n int x = n;\n int rem = 0;\n while(x!=0){\n rem = x%10;\n if(rem == 8 || rem == (-8)){\n printf(\"%d\",n-z);\n flag = 1;\n break;\n }\n x = x/10;\n }\n if(flag==1){\n break;\n }\n n++;\n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\nint room,temp_room,i=1,rem,exit_status=0;\nscanf(\"%d\",&room);\ntemp_room = room;\n while(1)\n {\n room++;\n temp_room = room;\n while(temp_room!=0)\n {\n rem = temp_room % 10;\n temp_room/=10;\n if(rem == 8 || rem == -8)\n {\n exit_status = 1;\n break;\n }\n }\n if(exit_status == 1)\n break;\n i++;\n }\n\nprintf(\"%d\",i);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main (void)\n{\n int NUM, exito1 = 0, exito2 = 0, cont = 0, i = 0;\n char num[12];\n scanf (\"%d\", &NUM); //piso actual \n itoa (NUM, num, 10);\n \nwhile (exito1 != 1 ){\n i = 0;\n while (num [i]){\n\n if (num [i] == '8' && cont != 0){\n exito1 = 1;\n break;\n }\n i++;\n \n }\n NUM++;\n cont++;\n itoa (NUM, num, 10);\n \n}\n printf (\"%d\", cont - 1);\n}"}, {"source_code": "#include <stdio.h>\n\nint islucky(int n){\n \n if(n<0){\n n=-n;\n }\n \n int modfac=10;\n int divfac=1;\n\n while(n/divfac>0){\n int digit=(n%modfac)/divfac;\n if(digit==8){\n return 1;\n }\n modfac*=10;\n divfac*=10;\n }\n \n return 0; //n is not lucky\n}\n\nint main(void){\n\n int a;\n int b=1;\n scanf(\"%d\", &a);\n\n while(islucky(a+b)==0){\n b+=1;\n }\n printf(\"%d\\n\", b);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint temp,a,i,s=0,bayrak=0;\n\tscanf(\"%d\",&a);\n\n\tfor(i=1;;i++)\n\t{\n\t\ttemp=a;\n\t\ttemp+=i;\n\t\tif(temp < 0) temp = -temp;\n\t\twhile(temp)\n\t\t{\n\t\t\tif(temp%10==8)\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbayrak=1;\n\t\t\t\tbreak;}\n\t\t\ttemp/=10;\n\t\t}\n\t\tif(bayrak)\tbreak;\n\t}\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int b; char s[100000]; char s2[1000000];\n scanf(\"%d\",&b);\n itoa(b,s,10);\n int i,y;\n for(i=1;i<10;i++)\n {\n itoa(b+i,s2,10);\n for(y=0;y<strlen(s2);y++)\n {\n if(s2[y]=='8')\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n if(s[0]=='-' && s[strlen(s)-1]=='0')\n {\n printf(\"%d\",2);\n return 0;\n }\n else if(s[strlen(s)-2]=='8' && s[strlen(s)-1]=='9')\n {\n printf(\"%d\",9);\n return 0;\n }\n else if(strlen(s)!=1)\n {\n for(i=0;i<strlen(s)-2;i++)\n {\n if(s[i]=='8')\n {\n printf(\"%d\",1);\n return 0;\n }\n }\n }\n int v=atoi(s);\n int x=b%10;\n int c=abs(8-x);\n if(c==0)\n c+=10;\n printf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n int a = 8/10;\n\tlong currentFloor, count=0;\n\tlong rem, digit,status=0;\n\tscanf(\"%d\", ¤tFloor);\n\tlong temp ;\n\twhile(count <17)\n\t{\n temp = currentFloor;\n\t while(temp != 0)\n\t {\n\t digit = temp%10;\n\t if((digit == 8 || digit == -8) && count != 0)\n\t {\n\t status = 1;\n\t break;\n\t }\n\t else\n\t {\n\t temp = temp/10;\n\t }\n\t \n\t }\n\t if(status == 1)\n\t break;\n\t else\n\t currentFloor++;\n\t count++;\n\t}\n\tprintf(\"%d\", count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long i,j,k,l,n;\n scanf(\"%I64d\",&n);\n for(i=1;;i++)\n {\n k=n+i;\n l=1;\n while(k!=0)\n {\n if(k%10==8||k%10==-8)\n {\n l=0;\n break;\n }\n k=k/10;\n }\n if(l==0)\n break;\n }\n printf(\"%I64d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint count(long long int n);\nint main()\n{\n int i,j,k,y,x;\n long long int n;\n \n \n \n scanf(\"%lld\",&n);\n x=count(n);\n for(i=1;i<100;i++)\n {\n if(n==-8)\n {\n printf(\"%d\\n\",16);\n break;\n }\n if(n>-8)\n y=count(n+i);\n else\n y=count(-(n+i));\n\n if(y>=1)\n {\n printf(\"%d\\n\",i);\n break;\n\n }\n\n }\n \n\n return 0;\n}\nint count(long long int n)\n{\n int flag=0,i,a[100];\n for(i=0; ;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==8)\n flag++;\n if(n==0)\n return (flag);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#define SIZE 100000\nint foundit (int arr[] , long long int s) ;\nint main()\n{\n long long int number = 0 , i = 0 , size = 0 , j = 0 , filler = 0 , sizer = 0;\n int a[SIZE] = {0} ;\n scanf(\"%lld\" , &number);\n for (j = 0 ; j != -1 ; j++ ){\n number ++ ;\n if (number == 0){\n continue ;\n }\n filler = number ;\n sizer = number ;\n if (sizer < 0){\n sizer = -1 * sizer ;\n }\n size = (int)log10(sizer) + 1 ;\n for (i = 1 ; i <= size ; i++){\n a[size - i] = filler % 10 ;\n filler /= 10 ;\n }\n if (foundit(a , size) == 1){\n printf(\"%lld\" , j + 1);\n return 0 ;\n }\n }\n return 0;\n}\nint foundit (int arr[] , long long int s) {\n long long int i = 0 ;\n for (i = 0 ; i < s ; i++){\n if (arr[i] == 8 || arr[i] == -8){\n return 1 ;\n }\n }\n return 0 ;\n}\n"}, {"source_code": "//problema2\n#include<stdio.h>\n\n\nint buscar(long long a)\n{\n for(; a != 0 ; a /= 10) //divisiones sucesivas\n if(a%10 == 8 || a%10 == -8)//si algun digito es 8 o -8\n return 1;\n return 0;\n}\n\nint main()\n{\n long long a, a2;\n\n size_t sw = 0, i;\n\n scanf(\"%lld\",&a);\n\n a2 = a;\n\n for(i = 1 ; sw == 0 ; i++ , a2++)//repite el ciclo hasta encontrar el piso\n {\n sw = buscar(a2 + 1); //busca en una posicion superior\n } //si es el valor buscado pone la bandera a 1\n\n printf(\"%d\\n\",i-1); //i-1 es lo que hay que sumarle\n return 0; //a la posicion actual\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint func(int a)\n{\n int rem,b=0,c;\n while(1)\n{\n ++b;\n c=abs(a+b);\n while(c>0)\n {\n rem=c%10;\n c=c/10;\n if(rem == 8) return b;\n}\n}\n}\n\nint main()\n{\nint a,ans;\nscanf(\"%d\",&a);\nans = func(a);\nprintf(\"%d\",ans);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint check(long long int a) {\nif (a<0) {\n a = -1*a;\n}\nwhile(a!=0) {\nint b = a%10;\nif (b==8) {\n return 1;\n break;\n}\na = a/10;\n}\nreturn 0;\n}\nint main()\n{\n long long int n;\n int ans;\n scanf(\"%lld\",&n);\nint i=1;\nwhile(1==1) {\nlong long int a;\na = i+n;\nif (check(a) == 1) {\n ans = i;\n break;\n}\ni++;\n}\nprintf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint is(long long int cn1)\n{\n long long int temp;\n int t;\n while(cn1>0)\n {\n t=cn1%10;\n if(t==8)\n return 1;\n cn1=cn1/10;\n }\n return 0;\n}\nint main()\n{\n long long int number,number1,cn1,cn;\n long long int temp,t1,temp2;\n int b=0;\n int count=5;\n scanf(\"%lld\",&number);\n number1=number;\n cn1=number1;\n t1=number1;\n\n temp=t1%10;\n t1=t1/10;\n temp2=t1%10;\n // printf(\"%lld,%lld\\n\",temp,temp2);\n if(temp==9&&temp2==8)\n {\n printf(\"9\");\n return 0;\n }\n if(temp==8&&temp2==7)\n {\n printf(\"2\");\n return 0;\n }\n\n while(number1>0)\n {\n\n temp=number1%10;\n if(temp==8)\n {\n cn1++;\n count=is(cn1);\n }\n number1=number1/10;\n\n }\n if(count==1)\n {\n printf(\"1\");\n return 0;\n\n }\n if(count==0)\n {\n printf(\"10\");\n return 0;\n }\n number++;\n b++;\n cn=number;\n while(1)\n {\n if(number<0)\n {\n number=number*-1;\n }\n\n while(number>0)\n {\n temp=number%10;\n if(temp==8)\n {\n printf(\"%d\",b);\n return 0;\n }\n number=number/10;\n }\n cn++;\n b++;\n number=cn;\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nkontrol (long n)\n{\n if(n<7)return 0;\n long i;\n int flag;\n if(n%10==8)return 1;\n for (i=10;;i*=10)\n {\n if(i>n)break;\n if((n/i)%10==8){flag=1;break;}\n }\n if(flag==1)return 1;\n return 0;\n}\n\nint main()\n{\n long i,k;\n scanf(\"%d\",&k);\n for(i=k+1;i<8888888888;i++)\n if(kontrol(i)==1){printf(\"%d\",i-k);break;}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MAX 888888888\n\nint test(int n) {\n \n while(n) {\n if(n%10 == 8) return 1;\n n /= 10;\n }\n \n return 0;\n}\n\nint main() {\n \n int a, ans=0;\n \n scanf(\"%d\", &a);\n a++;\n while(a<=MAX) {\n ans++;\n if(test(abs(a))) break;\n a++;\n }\n \n printf(\"%d\\n\", ans);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint flag=0,i,count=0;\n\tint a[10]={0},m;\n\twhile(flag==0)\n\t{\n\t\tfor(i=0;i<10;i++)\n\t\t\ta[i]=0;\n\t\tif(n<0)\n\t\t\tm=n*(-1);\n\t\telse\n\t\t\tm=n;\n\t\tfor(i=0;i<10;i++)\n\t\t{\n\t\t\ta[i]=m%10;\n\t\t\tm/=10;\n\t\t\tif(a[i]==8)\n\t\t\t\tflag=1;\n\t\t}\n\t\tn++;\n\t\tcount++;\n\t}\n\tif(count==1)\n\t{\n\t\tprintf(\"10\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"%d\\n\",count-1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long a;\n scanf(\"%ld\",&a);\n long i=0;\n i=a+1;\n while(1)\n {\n long p=i;int counter=0;\n while(1)\n {\n \n int k=p%10;\n if(k==8)\n {\n counter++;\n }\n p=p/10;\n if(p/10<1 && p!=8)\n {\n break;\n }\n }\n if(counter>0)\n {\n break;\n }\n i++;\n }\n printf(\"%ld\",(i-a));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint check(int number)\n{\n\twhile(number)\n\t{\n\t\tint r=number%10;\n\t//\tprintf(\"%d \",r);\n\t\tif(r==8)\n\t\t{\n\t\t return 1;\n\t\t}\n\t\tnumber=number-r;\n\t\tnumber=number/10;\n\t}\n\treturn 0;\n}\n\nint main()\n{\n\tlong long int a;\n\tscanf(\"%ll\",&a);\n\tint count=1;\n\twhile(1)\n\t{\n\t\tif(check(a+count))\n\t {\n\t \tprintf(\"%d\",count);\n\t \tbreak;\n\t } \n\t\telse\n\t\tcount++;\n\t}\n//\tprintf(\"%d\",count);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint lucky(int n) {\n\twhile (n > 0) {\n\t\tif (n % 10 == 8)\n\t\t\treturn 1;\n\t\tn /= 10;\n\t}\n\treturn 0;\n}\n\nint main() {\n\tint a, b;\n\n\tscanf(\"%d\", &a);\n\tfor (b = 1; ; b++)\n\t\tif (lucky(a + b)) {\n\t\t\tprintf(\"%d\\n\", b);\n\t\t\treturn 0;\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int b; char s[100000]; char s2[1000000];\n scanf(\"%d\",&b);\n itoa(b,s,10);\n int i,y;\n for(i=1;i<=10;i++)\n {\n itoa(b+i,s2,10);\n for(y=0;y<strlen(s2);y++)\n {\n if(s2[y]=='8')\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint eight ( long long n){\nint s,d,t,i; long long p;\ns=n%10;\nif (s!=8) {\n p=10; d=0;\n for(i=1;i<=9;i++)\n { d=d+1;\n s=(n%(p*10))/p;\n\n if (s==0) {s=n/p; break;}\n p=p*10;\n if (s==8) break;\n }\n}\nif (s==8) t=1; else t=0;\nreturn t;\n}\n\nint main(void){\n long long a,b,i;\nscanf(\"%lld\",&a);\n\nif(a>=-8 && a<=-3) b=8-a;\n else\n for(i=1;i<=10;i++) if (eight(i+a)==1) {b=i; break;};\n\n printf(\"%lld\",b);\n return 0;\n\n\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int b, a, sum;\n scanf(\"%d\", &a);\n for(b = 1; b <= 10; b++){\n sum = b + a;\n if(sum < 0)sum = -sum;\n while(sum > 0){\n if(sum%10 == 8) break;\n else sum /=10;\n }\n if(sum > 0)break;\n }\n printf(\"%d\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint eight ( long int n){\nint s,d,t,i; long int p,f;\nf=sqrt(n*n);\ns=f%10;\nif (s!=8) {\n p=10; d=0;\n for(i=1;i<=9;i++)\n { d=d+1;\n s=(f%(p*10))/p;\n\n if (s==0) {s=f/p; break;}\n p=p*10;\n if (s==8 || s==-8) break;\n }\n}\nif (s==8) t=1; else t=0;\nreturn t;\n}\n\nint main(void){\n long int a; int b,i;\nscanf(\"%ld\",&a);\n\nif(a>=-8 && a<=-3) b=8-a;\n else\n for(i=1;i<=10;i++) if (eight(i+a)==1) {b=i; break;};\n\n printf(\"%d\",b);\n return 0;\n\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,i,temp,x,state=0,ans;\n\tscanf(\"%d\",&a);\n\tfor(i=1;i<17;i++)\n\t{\n\t\tstate=0;\n\t\ttemp=a+i;\n\t\twhile(temp>0)\n\t\t{\n\t\t\tx=temp%10;\n\t\t\ttemp/=10;\n\t\t\tif(x==8)\n\t\t\t{\n\t\t\t\tstate=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(state==1)\n\t\t{\n\t\t\tans=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n\n long long n;\n\n scanf(\"%I64d\",&n);\n\n int i,len,j,temp,flag = 1,cnt=0,num;\n for(i=0;i<10 && flag;i++)\n {\n n = n + 1;\n num = n;\n cnt++;\n for(j=0;num != 0 && flag;j++)\n {\n temp = num % 10;\n if(temp == 8)\n {\n flag = 0 ;\n }\n num = num / 10;\n }\n }\n\n printf(\"%d\",cnt);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint count(long long int n);\nint main()\n{\n int i,j,k,y,x;\n long long int n;\n \n \n \n scanf(\"%lld\",&n);\n x=count(n);\n for(i=1;i<100;i++)\n {\n if(n>-8)\n y=count(n+i);\n else\n y=count(-(n+i));\n\n if(y>=1)\n {\n printf(\"%d\\n\",i);\n break;\n\n }\n\n }\n \n\n return 0;\n}\nint count(long long int n)\n{\n int flag=0,i,a[100];\n for(i=0; ;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==8)\n flag++;\n if(n==0)\n return (flag);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n\nint main(){\n\tint a=0,b=0,d=10,c=1,z=0;\n\tint i=0,j=0;\n\tscanf(\"%d\",&a);\n\t\n\twhile(d<a){\n\t\td*=10;\n\t\tc++;\n\t}\n\tif(a==(int)(pow(10,c)))c++;\n\tint v[c];\n\td=a;\n\tfor(i=c-1;i>-1;i--){\n\t\tz=d/pow(10,i);\n\t\tv[j]=z;\n\t\td=d-z*pow(10,i);\n\t\tj++;\n\t\t\n\t}\n\tz=0;\n\tfor(i=0;i>0;i++){\n\t\tif(v[i]==7)z++;\t\n\t}\n\tif((c-z)==1 && v[c-1]==9)b=1;\n\tif(v[c-1]==9 && v[c-2]==7)b=1; \n\tif(a<0 && b==0){\n\t\tb=abs(a)+8;\n\t}else if(b==0){\n\t\t\tif(v[c-1]==7)b=1;\n\t\t\tif(v[c-1]==9)b=9;\n\t\t\tif(v[c-1]==8){\n\t\t\t\tb=10;\n\t\t\t}else if(b==0){\n\t\t\t\tb=8-v[c-1];\n\t\t\t}\t\n\t\t}\n\tprintf(\"%d\",b);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,b;\n scanf(\"%d\",&n);\n if(n)\n while(!(n%100))\n n/=10;\n m=n/100;\n while(m)\n if(m%10==8||m%10==-8)\n break;\n else\n m/=10;\n if(m||n/10%10==8&&n%10<9)\n b=1;\n else if(n>=0)\n if(n%10<8)\n b=8-n%10;\n else if(n/10%10!=7)\n b=18-n%10;\n else\n b=10-n%10;\n else\n if(n%10<-8)\n b=-n%10-8;\n else if(n%10==0)\n b=2;\n else if(n>=-8)\n b=8-n%10;\n else\n b=2-n%10;\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n long long int i, j, k=0, l=0, m, n, o, p;\n char ch[20], str[20];\n\n scanf(\"%lld\", &n);\n\n p=n%10;\n n/=10;\n\n if(p==8)\n printf(\"10\");\n\n else if(p==0)\n printf(\"8\");\n\n else if(p<8)\n {\n m=8-p;\n printf(\"%lld\", m);\n }\n\n else{\n p=n%10;\n\n if(p==7)\n printf(\"1\");\n else\n printf(\"11\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint huit(long int a)\n{\n long int q=fabs(a);\n if (q%10==8)\n {\n return 1;\n }\n\n int i=1;\n long int d=pow(10,i);\n while((((q/d)%10!=8)&&(a/d!=0)))\n {\n i++;\n d=pow(10,i);\n }\n if(((q/d)%10)==8)\n {\n return i;\n }\n else {return 0;}\n}\nint main()\n{\n long int a;\n scanf(\"%ld\",&a);\n int m=a;\n m++;\n while(huit(m)==0)\n {\n m++;\n }\n printf(\"%ld\",m-a);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\n\nint main(){\n\tchar number[11], c;\n\tint i = 0, h;\n\tscanf(\"%s\", number);\n\twhile(number[i]){\n\t\tif(number[i] == '8'){\n\t\t\tc++;\n\t\t}\n\t\ti++;\n\t}\n\tif(c > 1){\n\t\tprintf(\"1\");\n\t\t\n\t}else{\n\t\n\t\tc = number[strlen(number)-1];\n\t\th = c - '0';\n\t\th = 8 - h;\n\t\tif(h == 0){\n\t\t\th = 10;\n\t\t}\n\t\tif(number[0] == '-'){\n\t\t\th = c - '0';\n\t\t\th = 8 - (h*-1);\n\t\t}\n\t\tprintf (\"%d\", h);\n\t}\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n int b; char s[100000]; char s2[1000000];\n scanf(\"%d\",&b);\n itoa(b,s,10);\n int i,y;\n for(i=1;i<10;i++)\n {\n itoa(b+i,s2,10);\n for(y=0;y<strlen(s2);y++)\n {\n if(s2[y]=='8')\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n }\n if(s[0]=='-' && s[strlen(s)-1]=='0')\n {\n printf(\"%d\",2);\n return 0;\n }\n else if(s[strlen(s)-2]=='8' && s[strlen(s)-1]=='9')\n {\n printf(\"%d\",9);\n return 0;\n }\n else\n {\n for(i=0;i<strlen(s)-2;i++)\n {\n if(s[i]=='8')\n {\n printf(\"%d\",1);\n return 0;\n }\n }\n }\n int v=atoi(s);\n int x=b%10;\n int c=abs(8-x);\n if(c==0)\n c+=10;\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint eight ( long long n){\nint s,d,t,i; long long p;\ns=n%10;\nif (s!=8) {\n p=10; d=0;\n for(i=1;i<=9;i++)\n { d=d+1;\n s=(n%(p*10))/p;\n\n if (s==0) {s=n/p; break;}\n p=p*10;\n if (s==8) break;\n }\n}\nif (s==8) t=1; else t=0;\nreturn t;\n}\n\nint main(void){\n long long a; int b,i;\nscanf(\"%lld\",&a);\n\nif(a>=-8 && a<=-3) b=8-a;\n else\n for(i=1;i<=10;i++) if (eight(i+a)==1) {b=i; break;};\n\n printf(\"%d\",b);\n return 0;\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n int a,var, b = 0, c=0;\n scanf(\"%d\",&a);\n\n while(a < pow(10,9)){\n var=a;\n if (var < 0)\n {\n var=var*-1;\n\n }\n\n while(var > 0){\n c=0;\n if (var%10==8)\n {\n c=1;\n break;\n }\n\n var= var/10 ;\n }\n if( c && b!=0)\n break;\n a++;\n b++;\n }\n printf(\"%d\", b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0;\n\tscanf(\"%d\",&n);\n\tif(n%10==8){\n\t\tprintf(\"10\");\n\t\tf+=1;\n\t}\n\telse{\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8){\n\t\t\tprintf(\"1\");\n\t\t f+=1;\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n}\n\tif(f==0){\n\t\tfor(int i=1;i<=16;i++){\n\t\t\tif((n+i)%10==8||(n+i)%10==-8||(n+i)%100/10==-8||(n+i)%100/10==8){\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n }\n \n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i,j,k,b,a,n,m;\n\tscanf(\"%lld\",&a);\n\twhile(a!=0)\n\t{\n\t\tm=a%10;\n\t\tif(m>8)\n\t\t{\n\t\t\tprintf(\"1\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(m<8)\n\t\t{\n\t\t\tprintf(\"%d\",8-m);\n\t\t\treturn 0;\n\t\t}\n\t\tif(m==8)\n\t\t{\n\t\t\tprintf(\"10\");\n\t\t\treturn 0;\n\t\t}\n\t\ta/=10;\n\t}return 0;\n}\n\t\t\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n long long n=0,flag=0,n1=0,count= 0,i=0,c=0;\n scanf(\"%I64d\",&n);\n n1=n;\n\n while( n!=0 ){\n if ( abs(n%10) == 8){\n flag ++;\n c=i;\n\n }\n n=n/10 ;\n i++;\n }\n n=n1;\n\n if ( flag > 1 )\n printf(\"1\");\n else if (flag == 1 && n > 0 && c!=0 )\n printf(\"1\");\n else if (flag == 1 && c!=0 && c!= 1 && c!=i-1 )\n printf(\"1\");\n else if (flag == 1){\n n++;\n for(count = 1; count >0 ;count ++){\n if(abs(n%10)==8 || abs(n%100)/10==8 ){\n\n printf(\"%I64d\",count);\n break ;\n\n }\n n++;\n }\n }\n\n else {\n for(count = 1; count >0 ;count ++){\n if(abs(n%10)==8 || abs(n%100)/10==8 ){\n\n printf(\"%I64d\",count-1);\n break ;\n\n }\n n++;\n }\n }\n\n\n\n\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\nint encontrar(long int a, int *ptrban);\nint main(){\n long int a;\n int b=0;\n int ban;\n scanf(\"%d\",&a);\n ban=1;\n while(!encontrar(a,&ban)){\n b++;\n a++;\n }\n if(b==0){\n if(a-((a/10)*10)==8 || a-((a/10)*10)==-8){\n if(encontrar(a/10,&ban)){\n printf(\"%d\",1);\n }else{\n printf(\"%d\",10);\n }\n }else if(a-((a/10)*10)==9){\n printf(\"%d\",9);\n }else{\n printf(\"%d\",1);\n }\n }else{\n printf(\"%d\",b);\n }\n return 0;\n}\nint encontrar(long int a, int *ptrban){\n long int c=a;\n if(a>-9 && *ptrban==1){\n while(a>0){\n if(c==8){\n return 1;\n }\n c=a-(a/10)*10;\n a=a/10;\n }\n }else{\n *ptrban=0;\n while(a<0){\n if(c==-8){\n return 1;\n }\n c=a-((a/10)*10);\n a=a/10;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,a,b,c;\n scanf(\"%I64d\",&a);\n for(i=1;i<11;i++){\n b=a+i;\n for(j=1;j<10;j++){\n c=b%10;\n if(c==8) break;\n b=b/10;\n }\n if(c==8) break;\n }\n printf(\"%I64d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,i,b,c,d,f;\n while(scanf(\"%ld\",&a)!=EOF)\n {\n c=0;\n if(a<0)\n {\n printf(\"%ld\\n\",(a*(-1)+8));\n }\n else if(a==0)\n printf(\"8\\n\");\n else\n {\n b=a%10;\n f=(a/10)%10;\n if(b==9)\n printf(\"1\\n\");\n else if(f==8)\n printf(\"1\\n\");\n else if(b==8 && f!=7)\n printf(\"10\\n\");\n else if(b==8 && f==7)\n printf(\"2\\n\");\n else if(b==3)\n printf(\"5\\n\");\n else if(b==4)\n printf(\"4\\n\");\n else if(b==5)\n printf(\"3\\n\");\n else if(b==6)\n printf(\"2\\n\");\n else if(b==7)\n printf(\"1\\n\");\n else\n {\n b=b+10;\n for(i=9; i<=b; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nint CantidadCifras(int x);\nint CalcularPositivo(char numero[], int dimension);\n\nint main(){\n\tint a, b, cantidad , ultimo_digito, penultimo_digito, x, y;\n char aux;\n\n\tscanf(\"%d\",&a);\n\n if (a >= 0){\n\n cantidad = CantidadCifras(a) + 1;\n }\n\n char cadena[cantidad];\n\n itoa(a,cadena,10);\n\n ultimo_digito = atoi(&cadena[cantidad - 1]);\n\n if (cantidad > 1){\n aux = cadena[cantidad - 2];\n penultimo_digito = atoi(&aux);\n }\n\n if (a >= 0){\n/*\n if (penultimo_digito == 7){\n\n b = 10 - ultimo_digito;\n\n printf(\"%d\", b);\n\n }else{\n\n if (ultimo_digito < 8){\n\n b = 8 - ultimo_digito;\n\n }else{\n\n b = 18 - ultimo_digito;\n }\n*/\n x = a % 10;//ultimo digito\n\n if (cantidad >= 2){\n\n y = a/(10^(cantidad - 1));//penultimo digito\n\n if (y == 7){\n\n if ( x < 8){\n b = 8 - x;\n }else {\n b = 10 - x;\n }\n }else if(x == 8){\n b = 10;\n }else{\n b = (10 - x) + 8;\n }\n\n }else{\n if (x == 8){\n b = 10;\n }else{\n b = 8 - x;\n }\n }\n\n printf(\"%d\", b);\n\n }else{\n\n a = a*(-1);\n\n cantidad = CantidadCifras(a) + 1;\n\n char cadena[cantidad];\n\n int primer_digito;\n\n primer_digito = a/(10^(cantidad - 1));\n\n ultimo_digito = atoi(&cadena[cantidad - 1]);\n\n if (ultimo_digito < 5){\n\n primer_digito++;\n }\n\n if (cantidad <= 1){\n\n if (ultimo_digito < 8){\n\n b = a + 8;\n }else{\n b = a - 8;\n }\n }else{\n\n if (ultimo_digito < 8){\n\n b = a - (primer_digito)*(10) + 2;\n\n }else if (ultimo_digito == 8){\n\n b = 10;\n\n }else{\n b = a - primer_digito*(10) - 8;\n }\n\n }\n printf(\"%d\", b);\n\n }\n return 0;\n}\n\nint CantidadCifras(int x){\n int y, contador = 0;\n y = x;\n\n while((y/10) > 0){\n\n y = y/10;\n contador++;\n }\n\n return contador;\n}\n\n"}, {"source_code": "#include<stdio.h>\n//#include<stdlib.h>\nlong long a,i,yedek,answer,oldanswer,handikap;\nint n;\nlong long sekizbulma(int x){\n while(x!=0){\n n=x%10;\n x=x/10;\n if(n==8||n==-8) return 1;\n }\n return 0;\n}\nlong long halt(int x){\n yedek=x;\n if(x==0) return 8;\n if(sekizbulma(x+1)) return 0;\n else{\n for(i=1;i<10000000000;i++){\n if(sekizbulma(x+i)) return i;\n }\n }\n}\nint main(){\n scanf(\"%lld\",&a);\n printf(\"%lld\",halt(a));\n return 0;\n //system(\"pause\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,i,b,c,d,f;\n while(scanf(\"%ld\",&a)!=EOF)\n {\n c=0;\n if(a<0)\n {\n printf(\"%ld\\n\",(a*(-1)+8));\n }\n else if(a==0)\n printf(\"8\\n\");\n else\n {\n b=a%10;\n f=(a/10)%10;\n if(b==9)\n printf(\"1\\n\");\n else if(f==8)\n printf(\"1\\n\");\n else if(b==8 && f!=7)\n printf(\"10\\n\");\n else if(b==8 && f==7)\n printf(\"2\\n\");\n else if(b>=3 && b<9)\n {\n for(i=b+1; i<=8; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n else\n {\n b=b+10;\n for(i=9; i<=b; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int resultat=0;\n long long number;\n scanf(\"%I64d\",&number);\n while((test(number))==0){\n number++;\n resultat++;\n }\n printf(\"%d\",resultat);\n return 0;\n}\nint test(long long a){\nlong long x=a;\nint h,k;\ndo{\n k=x%10;\n if(k==0){\n k=1;\n }\n h=(k)%8;\n x=x/10;\n}while((x!=0)&&(h!=0));\nif (h==0){\n return 1;\n}\nelse {\n return 0 ;\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(void){\nint room,temp_room,i=0,rem,exit_status=0;\nscanf(\"%d\",&room);\ntemp_room = room;\n while(1)\n {\n while(temp_room!=0)\n {\n rem = temp_room % 10;\n temp_room/=10;\n if(rem == 8 || rem == -8)\n {\n exit_status = 1;\n break;\n }\n }\n room++;\n temp_room = room;\n if(exit_status == 1)\n break;\n i++;\n }\n\nprintf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,a;\n\tscanf(\"%lld\",&n);\n\tif(n<0)\n\t\tprintf(\"%d\",8-(n));\n\telse if(n<8)\n\t\tprintf(\"%d\",8-n);\n\telse if(n%10==8 && (n%100)/10==7)\n\t\tprintf(\"2\");\n\telse if(n%10==8)\n\t\tprintf(\"10\");\n\telse if(n%10>2)\n\t\tprintf(\"%d\",abs(8-(n%10)));\n\telse\n\t\tprintf(\"%d\",abs(10+(n%10)-8));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,b;\n scanf(\"%d\",&n);\n m=n/100;\n while(m)\n if(m%10==8||m%10==-8)\n break;\n else\n m/=10;\n if(m||n/10%10==8&&n%10<9||n/10%10==-8&&n%10<0)\n b=1;\n else if(n>=0)\n if(n%10<8)\n b=8-n%10;\n else if(n/10%10!=7)\n b=18-n%10;\n else\n b=10-n%10;\n else\n if(n%10<-8)\n b=-n%10-8;\n else if(n%10==0)\n b=2;\n else\n b=8-n%10;\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar digits[10];\nint main(){\n int ans = 0;\n int n;\n int nose;\n int i = 2;\n int found = 0;\n\n scanf(\"%s\",&digits);\n n = strlen(digits) - 1;\n if(digits[i] != '-'){\n if (digits[n] == '8' || digits[n] == '9'){\n if(digits[n - 1] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n else if(digits[n - 1] == '9'){\n while(nose){\n nose = 0;\n if(digits[n - i] == '9'){\n nose = 1;\n }\n if (digits[n - i] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n i++;\n }\n }\n }\n if (found == 0){\n ans = digits[n] - '0';\n if(digits[n]<'8'){\n ans = 8 - ans;\n }\n else if(digits[n]=='8'){\n ans = 10;\n }\n printf(\"%d\",ans);\n }\n }\n else{\n ans = digits[n] - '0';\n if(ans<8){\n ans = ans + 2;\n }\n else if(ans == 8){\n ans = 0;\n }\n else{\n ans = ans -8;\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint hasEight(int x){\t//Funcion para hallar si un digito de un numero es el 8\n if(x < 0)\t\t\t//Para el caso en que el numero de piso sea negativo\n x *= -1;\t\t//Convierte el numero en positivo\n while(x > 0){\t\t//Realiza el ciclo mientras el numero tenga parte entera distinta a cero todavia\n if(x%10 == 8)\t//Compara el valor del ultimo digito del numero al numero 8 al hallar el resto de la division por 10\n return 1;\t//Devuelve 1 si es verdadero\n x /= 10;\t\t//Elimina el ultimo digito de la parte entera del numero al dividir por 10\n }\n return 0;\t\t\t//Devuelve 0 si no el encuentra numero 8\n}\n\nint main(){\n int sol,x,y = 0;\t\t\t\t\t\t//Declaracion de variables\n scanf(\"%d\", &x);\t\t\t\t\t\t//El usuario ingresa el numero de piso en que se encuentra\n while(x <= 8888888888 && sol == 0){\t\t//Realiza el ciclo mientras el usuario no se encuentre en el piso mas alto y no se haya encontrado el resultado\n\t\tx = x + 1;\t\t\t\t\t\t\t//Incrementa el numero de piso\n y++;\t\t\t\t\t\t\t\t//Incrementa la cantidad de pisos que debe subir la persona\n if(hasEight(x) && y != 0)\t\t\t//Si encuentra un 8 en el numero de piso y no es el mismo piso que ya se encontraba el usuario\n sol = 1;\t\t\t\t\t\t//Sale del ciclo\n }\n printf(\"%d \", y);\t\t\t\t\t\t//Imprime el resultado\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a, x;\n int b, t, i;\n scanf(\"%lld\", &a);\n if( a > -8 && a <=0){\n i = 8 - a;\n printf(\"%d\", i);\n return 0;\n }\n for(i = 0; i < 100 ; i++){\n if( a < 0){\n x = -a - i;\n }else{\n x = a + i;\n }\n while(t != 8 || x != 0){\n t = x % 10;\n x = (x - t)/10;\n if( t== 8 || x == 0){\n break;\n }\n }\n if(t == 8){\n printf(\"%d\\n\", i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,a,b,c;\n scanf(\"%I64d\",&a);\n for(i=1;i<11;i++){\n b=a+i;\n for(j=1;j<10;j++){\n c=b%10;\n if(c==8 || c==-8) break;\n b=b/10;\n }\n if(c==8 || c==-8) break;\n }\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\nint x,i,a,c;\nscanf(\"%d\",&x);\na=x+1;\nif(x>=-1 && x<= 8888888888){\n\tfor(i=1;i<=8888888888-x;i++){\n\t\tif(a%10 == 8 ){\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse\n\t\ta++;}\n}\nelse if(x<=-2 && x>=-8){\n\tif(x == -2)\n\tprintf(\"10\");\n\tif(x == -3)\n\tprintf(\"11\");\n\tif(x==-4)\n\tprintf(\"12\");\n\tif(x==-5)\n\tprintf(\"13\");\n\tif(x==-6)\n\tprintf(\"14\");\n\tif(x==-7)\n\tprintf(\"15\");\n\tif(x==-8)\n\tprintf(\"16\");\n}\nelse if(x<-8){\n\tc=-x-1;\n\tfor(i=1;i<=8888888888-x;i++){\n\t\tif(c%10 == 8 ){\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse\n\t\tc--;}\n}\n\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long int a, b=100, c, d, diff, nmg, mok, next;\n\tscanf(\"%I64d\", &a);\n\tif(a>=-8 && a< 8)\n\t{\n\t\tb = 8 - a;\n\t}\n\telse if(a>=8)\n\t{\n\t\tif(a%10==9)\n\t\t{\n\t\t\twhile(a%10==9)\n\t\t\t\ta/=10;\n\t\t\tif(a%10==7)\n\t\t\t\tb = 1;\n\t\t\telse\n\t\t\t\tb = 9;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdiff = a%10;\n\t\t\ta/=10;\n\t\t\tif(a%10==7 && diff==8)\n\t\t\t{\n\t\t\t\tb=2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(a>0 && a%10!=8)\n\t\t\t\t\ta/=10;\n\t\t\t\tif(a==0)\n\t\t\t\t\tif(diff<8)\n\t\t\t\t\t\tb = 8-diff;\n\t\t\t\t\telse\n\t\t\t\t\t\tb = 18-diff;\n\t\t\t\telse\n\t\t\t\t\tb = 1;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(a%10==-9)\n\t\t\tb = 1;\n\t\telse if(a%10==0)\n\t\t{\n\t\t\twhile(a<0 && a%10==0)\n\t\t\t\ta/=10;\n\t\t\tif(a==-9)\n\t\t\t\tb = 1;\n\t\t\telse\n\t\t\t\tb = 2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdiff = a%10;\n\t\t\ta /= 10;\n\t\t\tif(a%10==-9 && diff==-8)\n\t\t\t{\n\t\t\t\tb = 9;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile(a<0 && a%10!=-8)\n\t\t\t\t\ta/=10;\n\t\t\t\tif(a==0)\n\t\t\t\t\tb = 2 - diff;\n\t\t\t\telse\n\t\t\t\t\tb = 1;\t\n\t\t\t}\n\t\t\n\t\t}\n\t}\n\t\t\n\tprintf(\"%I64d\", b);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n\nint main(){\n long long int digit;\n char buffer[10];\n int i;\n int cont = 0;\n int n;\n int encontrado = 0;\n int aux=1;\n\n scanf(\"%d\",&digit);\n\n if (digit< 0){\n aux = -1;\n }\n\n do{\n cont++;\n digit = (digit + 1) * aux;\n sprintf (buffer, \"%lu\" , digit);\n digit = digit * aux;\n n = strlen(buffer);\n for (i = 0;i<n;i++){\n printf(\"%c\\t\",buffer[i]);\n if(buffer[i] == '8'){\n encontrado = 1;\n }\n }\n printf(\"\\n\");\n }while(encontrado == 0);\n printf(\"%d\",cont);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint temp=n;\n\tint rem,i,rem1;\n\tint count=0;\n\trem=n%10;\n\tn=n/10;\n//\tprintf(\"%d %d \",n,rem);\n\tfor(i=abs(n);i>0;i=i/10)\t\n\t{\n\t\trem1=i%10;\n\t\tif(rem1==8)\n\t\t\tcount++;\n\t}\n//\tprintf(\"%d \",count);\n\tif((count!=0 && 8>=rem) || (count!=0 && rem==9 && n<0))\n\t\tprintf(\"1\\n\");\n\telse if(count!=0 && rem==9 && n>0)\n\t{\n\t//\tprintf(\"!\");\n\t\trem=n%10;\n\t\tif(rem!=8)\n\t\tprintf(\"1\\n\");\n\t\telse\n\t\t{\n\t\t\tif(count==1)\n\t\t\t\tprintf(\"9\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\t\n\t}\n\telse\n\t{\n\t//\tprintf(\"@\");\n\t\tif(7>=rem && temp>=0)\n\t\t{\n\t//\t\tprintf(\"$ %d\",rem);\n\t\t\tprintf(\"%d\\n\",8-rem);\n\t\t}\n\t\telse if(rem==8 && temp>0)\n\t\t{\n\t\t//\tprintf(\"^\");\n\t\t\tif(n%10!=7)\n\t\t\t\tprintf(\"10\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"2\\n\");\n\t\t}\n\t\telse if(rem==9 && temp>0)\n\t\t{\n\t\t//\tprintf(\"*\"); \n\t\t//\tprintf(\" %d \",n%10);\n\t\t\tif(n%10==7)\n\t\t\t\tprintf(\"1\\n\");\n\t\t\telse \n\t\t\t\tprintf(\"9\\n\");\n\t\t}\n\t\telse if(temp <=-1 && temp>=-10)\n\t\t{\n\t\t//\tprintf(\"?\");\n\t\t\tprintf(\"%d\\n\",8-temp);\n\t\t}\n\t\telse if(abs(n%10)==9 && n<0)\n\t\t\tprintf(\"%d\\n\",abs(rem)+1);\n\t\telse if(rem!=8 && rem!=9 && n<0)\n\t\t{\n\t\t//\tprintf(\"+\");\n\t\t\tprintf(\"%d\\n\",abs(rem)+2);\n\t\t}\n\t\telse if(rem==9 && n<0)\n\t\t{\n\t\t//\tprintf(\"&\");\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t\telse if(rem==8 && n<0)\n\t\t{\n\t\t//\tprintf(\"-\");\n\t\t\tprintf(\"10\\n\");\n\t\t}\n\t}\n\treturn 0;\n}\n\n\t\t\n"}, {"source_code": "#include<stdio.h>\n\nint func(int a)\n{\n int rem,b=0,c,d;\n while(1)\n{\n ++b;\n c=a+b;\n while(c>0)\n {\n rem=c%10;\n c=c/10;\n if(rem == 8) return b;\n}\n}\n}\n\nint main()\n{\nint a,ans;\nscanf(\"%d\",&a);\nans = func(a);\nprintf(\"%d\",ans);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\nint x,i,a,c;\nscanf(\"%d\",&x);\na=x+1;\nif(x>=-1 && x<= 8888888888){\n\tfor(i=1;i<=8888888888-x;i++){\n\t\tif(a%10 == 8 ){\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/1000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/10000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((a/100000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse\n\t\ta++;}\n}\nelse if(x<=-2 && x>=-8){\n\tif(x == -2)\n\tprintf(\"10\");\n\tif(x == -3)\n\tprintf(\"11\");\n\tif(x==-4)\n\tprintf(\"12\");\n\tif(x==-5)\n\tprintf(\"13\");\n\tif(x==-6)\n\tprintf(\"14\");\n\tif(x==-7)\n\tprintf(\"15\");\n\tif(x==-8)\n\tprintf(\"16\");\n}\nelse if(x<-8){\n\tc=-x-1;\n\tfor(i=1;i<=8888888888-x;i++){\n\t\tif(c%10 == 8 ){\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/1000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/10000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse if((c/100000000000)%10 == 8){\n\t\t\n\t\tprintf(\"%d\",i);\n\t\tbreak;}\n\t\telse\n\t\tc--;}\n}\n\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint encontrar(long int a, int *ptrban);\n\nint main(){\n long int a,aa;\n int b=0;\n int ban;\n ban=1;\n scanf(\"%d\",&a);\n a++;\n while(!encontrar(a,&ban)){\n b++;\n a++;\n }\n printf(\"%d\",b+1);\n return 0;\n}\nint encontrar(long int a, int *ptrban){\n long int c=a;\n if(a>-9 && *ptrban==1){\n while(c>0){\n c=a-(a/10)*10;\n a=a/10;\n if(c==8 || a==8){\n return 1;\n }\n }\n }else{\n *ptrban=0;\n while(c<0){\n c=a-(a/10)*10;\n a=a/10;\n printf(\"+%d.%d+\",c,a);\n if(c==-8){\n return 1;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint count(long int n);\nint main()\n{\n int i,j,k,y,x;\n long int n;\n \n \n \n scanf(\"%ld\",&n);\n x=count(n);\n for(i=1;i<20;i++)\n {\n y=count(n+i);\n\n if(y>=1)\n {\n printf(\"%d\\n\",i);\n break;\n\n }\n\n }\n \n\n return 0;\n}\nint count(long int n)\n{\n int flag=0,i,a[100];\n for(i=0; ;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==8)\n flag++;\n if(n==0)\n return (flag);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint check(long long n)\n{\n\t\n\tint c = 0;\n\tif (n < 0)\n\t{\n\t\twhile(n)\n\t\t{\n\t\t\tif (n % 10 == 8) return 1;\n\t\t\tn /= 10;\n\t\t}\n\t}\n\tif (n % 10 == 8) return 1;\n\tn /= 10;\n\n\treturn 0;\n}\n\nint main()\n{\n\tlong long n;\n\tint i = 0, c;\n\tscanf(\"%lld\", &n);\n\n\twhile (1)\n\t{\n\t\tn++;\n\t\ti++;\n\t\tc =check(n);\n\n\t\tif (c >= 1) break;\n\t}\n\n\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int c,j=0,k,n;\n scanf(\"%d\",&n);\n\n while(1)\n {\n\n if(eight(n)==1)\n break ;\n n++ ;\n j++ ;\n }\n\n printf(\"%d\",j);\n}\n\nint eight(int x)\n{ int i;\n for(i=1;i<=10;i++)\n {\n if(x%10==8)\n return 1;\n\n x = x/10;\n }\n\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//#include <string.h>\nint main()\n{\n signed int n,i,y,a,x;\n scanf(\"%d\",&n);\n\n for(i=1;i<=10;i++)\n {\n y=n;\n // printf(\"y=%d\\n\",y);\n a=y+i;\n // printf(\"a=%d\\n\",a);\n x=0;\n if(a!=0)\n {\n // printf(\"Enter\\n\");\n while(a>0)\n {\n // printf(\"NO\");\n x=a%10;\n a=a/10;\n if(x==8)\n break;\n }\n if(x==8)\n {\n printf(\"%d\",i);\n break;\n }\n }\n\n\n }\n if(x!=8)\n printf(\"16\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint tiene8(int);\n\nint main(){\n\n\tint i, piso, cont = 0, fin;\n\n\tscanf(\"%d\", &piso);\n\n\tfor(i = piso; i < piso + 10; i++){\n\n\t\tif(tiene8(i)){\n\t\t\tif(cont == 0){\n\t\t\t\tfin = 0;\n\t\t\t}else{\n\t\t\t\tfin = 1;\n\t\t\t}\n\t\t}\n\n\t\tif(fin == 1){\n\t\t\tbreak;\n\t\t}\n\n\t\tcont++;\n\t}\n\n\tprintf(\"RESULTADO: %d\\n\", cont);\n\n\treturn 0;\n}\n\nint tiene8(int i){\n\n\tint j, numCharLong;\n\tint tiene = 0;\n\tchar numChar[11];\n\n\tnumChar[0] = '\\0';\n\titoa(i, numChar, 10);\n\n\tnumCharLong = strlen(numChar);\n\n\tfor(j = 0; j < numCharLong; j++){\n\n\t\tif(numChar[j] == '8'){\n\t\t\ttiene = 1;\n\t\t}\n\n\t}\n\n\treturn tiene;\n\n}"}, {"source_code": "#include<stdio.h>\n//#include<stdlib.h>\nlong long a,i,yedek,answer,oldanswer,handikap;\nint n;\nlong long sekizbulma(int x){\n\twhile(x!=0){\n\t\tn=x%10;\n\t\tx=x/10;\n\t\tif(n==8||n==-8) return 1;\n\t}\n\treturn 0;\n}\nlong long halt(int x){\n\tyedek=x;\n\tif(x==0) return 8;\n\tif(sekizbulma(x)) return 0;\n\telse{\n\t\tfor(i=0;i<10000000000;i++){\n\t\t\tif(sekizbulma(x+i)) return i;\n\t\t}\n\t}\n}\nint main(){\n\tscanf(\"%lld\",&a);\n\tprintf(\"%lld\",halt(a));\n\treturn 0;\n\t//system(\"pause\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint count(long int n);\nint main()\n{\n int t,i,j,k,y,x;\n long int n;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%ld\",&n);\n x=count(n);\n for(i=1;i<20;i++)\n {\n y=count(n+i);\n\n if(y>=1)\n {\n printf(\"%d\\n\",i);\n break;\n\n }\n\n }\n }\n \n return 0;\n}\nint count(long int n)\n{\n int flag=0,i,a[100];\n for(i=0; ;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(a[i]==8)\n flag++;\n if(n==0)\n return (flag);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,b;\n scanf(\"%d\",&n);\n if(n)\n while(!(n%100))\n n/=10;\n m=n/100;\n while(m)\n if(m%10==8||m%10==-8)\n break;\n else\n m/=10;\n if(m||n/10%10==8&&n%10<9)\n b=1;\n else if(n>=0)\n if(n%10<8)\n b=8-n%10;\n else if(n/10%10!=7)\n b=18-n%10;\n else\n b=10-n%10;\n else\n if(n%10<-8)\n b=-n%10-8;\n else if(n%10==0)\n b=2;\n else if(n>=-8)\n b=8-n%10;\n else\n b=2-n%10;\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0;\n\tscanf(\"%d\",&n);\n\tif(n%10==8){\n\t\tprintf(\"10\");\n\t\tf+=1;\n\t}\n\telse{\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8||(n%m)/(m/10)==-8){\n\t\t\tprintf(\"1\");\n\t\t f+=1;\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n}\n\tif(f==0){\n\t\tfor(int i=1;i<=16;i++){\n\t\t\tif((n+i)%10==8||(n+i)%10==-8||(n+i)%100/10==-8||(n+i)%100/10==8){\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n }\n \n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i,j,k,b,a,n,m;\n\tscanf(\"%lld\",&a);\n\twhile(a!=0)\n\t{\n\t\tm=a%10;\n\t\tif(m>8)\n\t\t{\n\t\t\tprintf(\"1\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(m<8)\n\t\t{\n\t\t\tprintf(\"%d\",8-m);\n\t\t\treturn 0;\n\t\t}\n\t\tif(m==8)\n\t\t{\n\t\t\tprintf(\"10\");\n\t\t\treturn 0;\n\t\t}\n\t\ta/=10;\n\t}return 0;\n}\n\t\t\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#define sz 100\nchar c[sz];\nint main()\n{\n long long i,j,k,n,s;\n int l;\n scanf(\"%s\",&c);\n n=atoi(c);\n l=strlen(c);\n j=0;\n if(n>0&&c[l-1]=='8')\n {\n printf(\"10\\n\");\n return 0;\n }\n if(n>=0){\n for(i=0;i<l;i++)\n {\n if(c[i]=='8')\n {\n if(n>0)\n {\n printf(\"1\\n\");\n return 0;\n }\n j=1;\n break;\n }\n }\n }\n if(n<0){\n s=8-n;\n if(s<=16){\n printf(\"%I64d\\n\",s);\n return 0;\n }\n }\n else\n {\n c[l-1]='8';\n k=atoi(c);\n if(k>n)\n s=k-n;\n else\n s=n-k;\n }\n if(s>10)\n s=1;\n printf(\"%I64d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint solve(int a)\n{ \n int i,x,y,l,t=10;\n l=a;\n x=l%10;\n l/=10;\n y=l%10;\n while(l)\n {\n \n if((l%10==8&&a%t!=t-1)||(l%10==-8&&a%t!=0))\n return 1; \n else\n { \n l/=10;\n t=t*10;\n }\n }\n if(a>=-8)\n {\n if(x>=8 && y==7)\n return (10-x);\n else if(x==8)\n return 10;\n else if(x<8)\n return (8-x);\n else if(x>8)\n return (18-x);\n }\n else if(a<-8)\n { l=-a;\n x=l%10;\n l/=10;\n y=l%10;\n if(x<=8&&y==9)\n return (x+1);\n else if(x==8)\n return 10;\n else if(x<8)\n return x+2;\n else if(x>8)\n return (x-8);\n }\n\n}\nint main()\n{\n long long int a;\n scanf(\"%lld\",&a);\n \n printf(\"%lld\",solve(a));\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,j,m,k,i=0,c=0,p,q,t;\n scanf(\"%lld\",&n);\n j =n;\n m = n%10;\n t = n/10;\n t = t%10;\n if(m<0)\n {\n q = -m;\n }\n else\n {\n q=m;\n }\n\n k = m-8;\n\n if(k<0)\n {\n k = -k;\n }\n while(n!=0)\n {\n p = n%10;\n\n if(p==8 || p==-8)\n {\n c++;\n }\n n = n/10;\n i++;\n }\n if(t==8 && q==9)\n {\n printf(\"9\");\n }\n else if(t==7 && q==8)\n {\n printf(\"2\");\n }\n else if(j%80==0 && j>0)\n {\n printf(\"8\");\n }\n else if(j%80==0 && j<0)\n {\n printf(\"2\");\n }\n else if(c>0 && q!=8 || c>1 && q==8)\n {\n printf(\"1\");\n }\n else if(j<0 && m==-9)\n {\n printf(\"1\");\n }\n else if(j>0 && m==9)\n {\n j = j/10;\n j = j%10;\n if(j==7)\n {\n printf(\"1\");\n }\n else\n {\n printf(\"9\");\n }\n }\n else if(j<-10 && m!=0)\n {\n m= -m;\n printf(\"%lld\",m+2);\n }\n else if(j<0 && m==0)\n {\n printf(\"2\");\n }\n else if(k==0)\n {\n printf(\"10\");\n }\n else\n {\n printf(\"%lld\",k);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n long int a,c;\n int b;\n scanf(\"%ld\",&a);\n int d1,d2;\n d1=a%10;\n c=a;\n a=a/10;\n d2=a%10;\n if(d2==7 && d1>=8) {\n b=10-d1;\n \n }\n else if(d2==8 && d1<=9) {\n b=1;\n }\n else {\n if(8-d1>0) {\n b=8-d1;\n }\n else if(d1==9) {\n b=9;\n }\n else {\n b=10;\n }\n }\n if(a<0) {\n printf(\"%d\",b+2*abs(a));\n }\n else {\n printf(\"%d\",b);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,i,b,c,d;\n while(scanf(\"%ld\",&a)!=EOF)\n {\n c=0;\n if(a<0)\n {\n printf(\"%ld\\n\",(a*(-1)+8));\n }\n else\n {\n b=a%10;\n if(b==9)\n printf(\"1\\n\");\n else if(b==8)\n printf(\"10\\n\");\n else if(b>=3 && b<9)\n {\n for(i=b+1; i<=8; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n else\n {\n b=b+10;\n for(i=9; i<=b; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0;\n\tscanf(\"%d\",&n);\n\tif(n%10==8||n%10==-8){\n\t\tprintf(\"10\");\n\t\tf+=1;\n\t}\n\telse{\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8||(n%m)/(m/10)==-8){\n\t\t\tprintf(\"1\");\n\t\t f+=1;\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n}\n\tif(f==0){\n\t\tfor(int i=1;i<=16;i++){\n\t\t\tif((n+i)%10==8||(n+i)%10==-8||(n+i)%100/10==-8||(n+i)%100/10==8){\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n }\n \n\n}"}, {"source_code": "#include<stdio.h>\n\nint main () {\n\n\tlong int a;\n\tint aux1;\n\tint ban1;\n\tint ban2=1;\n\tint i;\n\tint cont=0;\n\t\n\tscanf( \"%ld\", &a );\n\t\n\twhile ( ban2 ) {\n\t\n\t\tif ( a < 0 ) {\n\t\t\ta=a*-1;\n\t\t\tban1=0;\n\t\t}else if ( a == 0 ) {\n\t\t\tban1=1;\n\t\t}else if ( a>0 && ban1 ) {\n\t\t\tban1=1;\n\t\t}\n\t\t\n\t\tif ( ban1 ) {\n\t\t\ta++;\n\t\t}else{\n\t\t\ta--;\t\n\t\t}\n\t\t\n\t\tcont++;\n\t\ti=1;\n\t\t\n\t\twhile ( i<=100000000 && ((int)(a/i)) != 0 ) {\n\t\n\t\t\tif ( a < 10 && a >= 0 ) {\n\t\t\t\tif ( a==8 && ban1 ) {\n\t\t\t\t\tban2=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}else{\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t}else if ( a == 10 ) {\n\t\t\t\tcont=cont+8;\n\t\t\t\tban2=0;\n\t\t\t\tbreak;\n\t\t\t} else if ( a > i ) {\n\t\t\t\tif ( (((int)(a/i))%10) == 8 ) {\n\t\t\t\t\tban2=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\ti=i*10;\t\n\t\n\t\t}\n\t\t\n\t}\n\t\n\tprintf( \"%d\", cont );\n\t\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0;\n\tscanf(\"%d\",&n);\n\tif(n%10==8||n%10==-8){\n\t\tprintf(\"10\");\n\t\tf+=1;\n\t}\n\telse{\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8||(n%m)/(m/10)==-8){\n\t\t\tprintf(\"1\");\n\t\t f+=1;\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n}\n\tif(f==0){\n\t\tfor(int i=1;i<=16;i++){\n\t\t\tif((n+i)%10==8||(n+i)%10==-8||(n+i)%100/10==-8||(n+i)%100/10==8){\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n }\n \n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint solve(int a)\n{ \n int i,x,y,l;\n l=a;\n x=l%10;\n l/=10;\n y=l%10;\n for(i=0;l!=0;i++)\n {\n if(i==0)\n {\n if((l%10==8&&x!=9)||(l%10==-8&&x!=0))\n return 1;\n }\n else\n {\n if(l%10==8||l%10==-8)\n return 1;\n }\n l/=10;\n }\n if(a>=-8)\n {\n if(x>=8&&y==7)\n return (10-x);\n else if(x==8)\n return 10;\n else if(x<8)\n return (8-x);\n else if(x>8)\n return (18-x);\n }\n else if(a<-8)\n { l=-a;\n x=l%10;\n l/=10;\n y=l%10;\n if(x<=8&&y==9)\n return (x+1);\n else if(x==8)\n return 10;\n else if(x<8)\n return x+2;\n else if(x>8)\n return (x-8);\n }\n\n}\nint main()\n{\n long long int a;\n scanf(\"%lld\",&a);\n \n printf(\"%d\",solve(a));\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,i,temp,x,state=0,ans;\n\tscanf(\"%d\",&a);\n\tfor(i=1;i<17;i++)\n\t{\n\t\tstate=0;\n\t\ttemp=a+i;\n\t\twhile(temp>0)\n\t\t{\n\t\t\tx=temp%10;\n\t\t\ttemp/=10;\n\t\t\tif(x==8)\n\t\t\t{\n\t\t\t\tstate=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(state==1)\n\t\t{\n\t\t\tans=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int a,i=0,c,b;\n scanf(\"%d\",&a);\n char s[11];\n itoa(a,s,10);\n int l;\n l=strlen(s);\n printf(\"%s\\n\",s);\n for(i=0;i<l-1;i++)\n {\n if (s[i]=='8') break;\n }\n if (i<l-1) printf(\"1\");\n else\n for(i=1;i<15;i++)\n {\n b=a+i;\n c=b%10;\n while(b!=0 && c!=8)\n {\n b=b/10;\n c=b%10;\n }\n if (b) {printf(\"%d\",i); break;}\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int a,i=0,c,b;\n scanf(\"%d\",&a);\n char s[11];\n itoa(a,s,10);\n int l;\n l=strlen(s);\n for(i=0;i<l-1;i++)\n {\n if (s[i]=='8') break;\n }\n if (i<l-1) printf(\"1\");\n else\n for(i=1;i<20;i++)\n {\n b=a+i;\n c=b%10;\n while(b!=0 && c!=8)\n {\n b=b/10;\n c=b%10;\n }\n if (b) {printf(\"%d\",i); break;}\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar digits[9];\nint main(){\n int ans = 0;\n int n;\n int aux;\n int i = 2;\n int found = 0;\n\n scanf(\"%s\",&digits);\n n = strlen(digits) - 1;\n\n if (digits[n] == '8' || digits[n] == '9'){\n if(digits[n - 1] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n else if(digits[n - 1] == '9'){\n while(aux){\n aux = 0;\n if(digits[n - i] == '9'){\n aux = 1;\n }\n if (digits[n - i] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n i++;\n }\n }\n }\n if (found == 0){\n ans = digits[n] - '0';\n if(digits[n]<'8'){\n ans = 8 - ans;\n }\n else if(digits[n]=='8'){\n ans = 10;\n }\n printf(\"%d\",ans);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint func(int a)\n{\n if(a<0)\n a=-a;\n while(a)\n {\n if(a%10==8)\n return 1;\n a/=10;\n }\n return 0;\n}\nmain()\n{\n int a,b,i;\n scanf(\"%d\",&a);\n for(i=1;i<=10;i++)\n {\n b=func(a+i);\n if(b)\n break;\n }\n printf(\"%d\",i);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int a,i=0,c,b;\n scanf(\"%d\",&a);\n char s[11];\n itoa(a,s,10);\n int l;\n l=strlen(s);\n printf(\"%s\\n\",s);\n for(i=0;i<l-1;i++)\n {\n if (s[i]=='8') break;\n }\n if (i<l-1) printf(\"1\");\n else\n for(i=1;i<15;i++)\n {\n b=a+i;\n c=b%10;\n while(b!=0 && c!=8)\n {\n b=b/10;\n c=b%10;\n }\n if (b) {printf(\"%d\",i); break;}\n }\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n\nint main()\n{\nint a,b;\nint rem;\n\nscanf(\"%d\",&a);\n\nrem = a%10;\n\nif(a>0)\n{\n\tswitch(rem)\n\t{\n\t\tcase 1: b=7;\n\t\t\t break;\n\t\tcase 2: b=6;\n\t\t\t break;\n\t\tcase 3: b=5;\n\t\t\t break;\n\t\tcase 4: b=4;\n\t\t\t break;\n\t\tcase 5: b=3;\n\t\t\t break;\n\t\tcase 6: b=2;\n\t\t\t break;\n\t\tcase 7: b=1;\n\t\t\t break;\n\t\tcase 8: b=10;\n\t\t\t break;\n\t\tcase 9: b=9;\n\t\t\t break;\n\n\n\t}\n}\nelse if(a<0)\n{\n\tswitch(rem)\n\t{\n\t\tcase -1: b=9;\n\t\t\t break;\n\t\tcase -2: b=10;\n\t\t\t break;\n\t\tcase -3: b=11;\n\t\t\t break;\n\t\tcase -4: b=12;\n\t\t\t break;\n\t\tcase -5: b=13;\n\t\t\t break;\n\t\tcase -6: b=14;\n\t\t\t break;\n\t\tcase -7: b=15;\n\t\t\t break;\n\t\tcase -8: b=16;\n\t\t\t break;\n\t\tcase -9: b=1;\n\t\t\t break;\n\n\n\t}\n\n}\nelse\n b=8;\n\nprintf(\"%d\",b);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int b, a, sum;\n scanf(\"%d\", &a);\n for(b = 1; b <= 10; b++){\n sum = b + a;\n if(sum < 0)sum = -sum;\n while(sum > 0){\n if(sum%10 == 8) break;\n else sum /=10;\n }\n if(sum > 0)break;\n }\n printf(\"%d\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint eight ( long long n){\nint s,d,t,i; long long p,f;\nf=sqrt(n*n);\ns=f%10;\nif (s!=8) {\n p=10; d=0;\n for(i=1;i<=9;i++)\n { d=d+1;\n s=(f%(p*10))/p;\n\n if (s==0) {s=f/p; break;}\n p=p*10;\n if (s==8 || s==-8) break;\n }\n}\nif (s==8 ) t=1; else t=0;\nreturn t;\n}\n\nint main(void){\n long long a,b,i;\nscanf(\"%lld\",&a);\n\nif(a>=-8 && a<=-3) b=8-a;\n else\n for(i=1;i<=10;i++) if (eight(i+a)==1) {b=i; break;};\n\n printf(\"%lld\",b);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#define i64 long long\ni64 func(i64 n)\n{\n i64 x,y,z,i,j;\n while(1)\n {\n x=n%10;\n if(x==8) return 1;\n\n n/=10;\n if(n<10) break;\n }\n return 0;\n}\nint main()\n{\n i64 x,y,z,i,j,n,cnt=0;\n while(scanf(\"%I64d\",&n)==1)\n {\n cnt=0;\n for(x=n+1;;x++)\n {\n y=func(x);\n cnt++;\n if(cnt==20) break;\n if(y==1) break;\n\n }\n if(cnt==20)\n {\n y=func(n);\n if(y==1) printf(\"1\\n\");\n else\n {\n x=n%10;\n printf(\"%I64d\\n\",8-x);\n }\n }\n else printf(\"%I64d\\n\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define min(a,b) a < b ? a : b\n#define max(a,b) a > b ? a : b\n#define for(k,i,n) for(int k = i; j < n; j++)\n\nlong long a,ans;\n\nint f(long long a){\n if(a < 0)\n a = -a;\n while(a > 0){\n if(a % 10 == 8)\n return a%10;\n a /= 10;\n }\n return 0;\n}\n\nint main() {\n scanf(\"%I64d\",&a);\n long ans = 0;\n\n while(f(a) != 8){\n ans++;\n a++;\n }\n\n printf(\"%I64d\\n\",ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n long long x,c;\n int i=0,f=0,j;\n scanf(\"%I64d\",&x);\n while(f==0)\n {\n c=x+i;\n while(c!=0)\n {\n if(c%10==8)\n {\n f=1;\n break;\n }\n c/=10;\n }\n i++;\n }\n printf(\"%d\",i-1);\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,k=0,f,j;\n scanf(\"%d\",&a);\n if(a<0) j=-a;\n else j=a;\n for(i=j;i>0;i++){\n f=1;\n d=i;\n while(d){\n c=d%10;\n if(c==8){f=0; break;}\n d=d/10;\n }\n if(f) k++;\n else break;\n }\n if(a<0&&a>-8){a=-a; k=k+(a*2);}\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdint.h>\n\nint main()\n{\n int num[100],num2[100];\n\n int n,i=0,k,j,a,d,x,y,z,ck=0;\n\n scanf(\"%d\",&n);\n\n x=n;\n z=n;\n\n while(n>0){\n\n a=n%10;\n\n num[i]=a;\n i++;\n\n n=n/10;\n\n }\n\n for(i=0;i<10;i++){\n j=0;\n x++;\n d=x;\n\n while(d>0){\n\n a=d%10;\n\n num2[j]=a;\n j++;\n d=d/10;\n\n }\n\n for(k=0;k<j;k++){\n\n if(num2[k]==8){\n ck=1;\n y=x-z;\n printf(\"%d\\n\",y);\n break;\n }\n }\n if(ck){\n break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n ll n,nn,i=1,mv=0;\n scanf(\"%lld\",&n);\n nn=n;\n int f=0;\n while(f==0)\n {\n n=nn+i;\n i++;\n mv++;\n while(n>0)\n {\n ll rem=n%10;\n if(rem==8)\n {\n f=1;\n break;\n }\n n/=10;\n }\n \n }\n //ll mv=n-nn-1;\n printf(\"%lld\",mv);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nchar digits[9];\nint main(){\n int ans = 0;\n int n;\n int aux;\n int i = 2;\n int found = 0;\n\n scanf(\"%s\",&digits);\n n = strlen(digits) - 1;\n\n if (digits[n] == '8' || digits[n] == '9'){\n if(digits[n - 1] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n else if(digits[n - 1] == '9'){\n while(aux){\n aux = 0;\n if(digits[n - i] == '9'){\n aux = 1;\n }\n if (digits[n - i] == '7'){\n ans = digits[n] - '0';\n ans = 10 - ans;\n printf(\"%d\",ans);\n found = 1;\n }\n i++;\n }\n }\n }\n if (found == 0){\n ans = digits[n] - '0';\n if(digits[n]<'8'){\n ans = 8 - ans;\n }\n else if(digits[n]=='8'){\n ans = 10;\n }\n printf(\"%d\",ans);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define loop(i,x,y) for(i=x;i<y;i++)\n\n#define sd(x) scanf(\"%d\",&x)\n#define slld(x) scanf(\"%lld\",&x)\n#define sllu(x) scanf(\"%llu\",&x)\n#define sstr(x) scanf(\"%s\",x)\n\n#define pd(x) printf(\"%d\",x)\n#define plld(x) printf(\"%lld\",x)\n#define pllu(x) printf(\"%llu\",x)\n#define pstr(x) printf(\"%s\",x)\n#define pnl printf(\"\\n\")\n\ntypedef long long int lld;\ntypedef unsigned long long int llu;\n\nint check(lld n)\n{\n\twhile(n!=0)\n\t{\n\t\tif(n%10==8)\n\t\t\treturn 1;\n\t\tn/=10;\n\t}\n\treturn 0;\n}\n\nint main()\n{\n\tlld n,i;\n\tslld(n);\n\tloop(i,1,12)\n\t\tif(check(n+i))\n\t\t\tbreak;\n\tplld(i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,i,b,c,d,f;\n while(scanf(\"%ld\",&a)!=EOF)\n {\n c=0;\n if(a<0)\n {\n printf(\"%ld\\n\",(a*(-1)+8));\n }\n else if(a==0)\n printf(\"8\\n\");\n else\n {\n b=a%10;\n f=(a/10)%10;\n if(b==9)\n printf(\"1\\n\");\n else if(f==8)\n printf(\"1\\n\");\n else if(b==8 && f!=7)\n printf(\"10\\n\");\n else if(b==8 && f==7)\n printf(\"2\\n\");\n else if(b==3)\n printf(\"5\\n\");\n else if(b==4)\n printf(\"4\\n\");\n else if(b==5)\n printf(\"3\\n\");\n else if(b==6)\n printf(\"2\\n\");\n else if(b==7)\n printf(\"1\\n\");\n else\n {\n b=b+10;\n for(i=9; i<=b; i++)\n c++;\n printf(\"%ld\\n\",c);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nint main(){\n\n char c1[1]=(\"\");\n char c2[]=(\"8\\0\");\n char texto[20]=(\"\");\n int ban,ban2,j,a,cont,resto;\n\n\n scanf(\"%d\",&a);\n cont=0;\n\n\n ban2=1;\n while(ban){\n cont++;\n a=a+1;\n j=abs(a);\n\n while(j>0){\n resto=j%10;\n j=j/10;\n if(resto==8){\n ban=0;\n break;\n }\n }\n if(resto==8){\n break;\n }\n }\n printf(\"%d\",cont);\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0,f1=0,f2=0;\n\tscanf(\"%d\",&n);\n\tif(n%10==8){\n\t\tf+=1;\n\t\tf1+=1;\n\t}\n\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8||(n%m)/(m/10)==-8){\n\t\t f+=1;\n\t\t f2+=1;\n\t\t if(n%10==9||n==-80||n==-800||n==-8000||n==-80000||n==-800000||n==-8000000||n==-80000000||n==-800000000){\n\t\t \tf=0;\n\t\t \tf2=0;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n\nif(f2==0&&f1!=0){\n\tprintf(\"10\");\n}\nif(f2!=0){\n\tprintf(\"1\");\n}\n\tif(f==0){\n\t\tfor(int i=1;i<=16;i++){\n\t\t\tif((n+i)%10==8||(n+i)%10==-8||(n+i)%100/10==-8||(n+i)%100/10==8){\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n }\n \n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define min(a,b) a < b ? a : b\n#define max(a,b) a > b ? a : b\n#define for(k,i,n) for(int k = i; j < n; j++)\n\nlong long a,ans;\n\nint f(long long a){\n if(a < 0)\n a = -a;\n while(a > 0){\n if(a % 10 == 8)\n return a%10;\n a /= 10;\n }\n return 0;\n}\n\nint main() {\n scanf(\"%l64d\",&a);\n long ans = 0;\n\n while(f(a) != 8){\n ans++;\n a++;\n }\n\n printf(\"%l64d\\n\",ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//#include <string.h>\nint main()\n{\n unsigned int n,i,y,a,x;\n scanf(\"%d\",&n);\n for(i=1;i<=10;i++)\n {\n y=n;\n\n a=y+i;\n // printf(\"a=%u\",a);\n x=0;\n if(a!=0)\n {\n // printf(\"Enter\\n\");\n while(a>0)\n {\n // printf(\"NO\");\n x=a%10;\n a=a/10;\n if(x==8)\n break;\n }\n if(x==8)\n {\n printf(\"%d\",i);\n break;\n }\n }\n\n }\n if(x!=8)\n printf(\"16\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,b;\n scanf(\"%d\",&n);\n if(n)\n while(!(n%100))\n n/=10;\n m=n/100;\n while(m)\n if(m%10==8||m%10==-8)\n break;\n else\n m/=10;\n if(m||n/10%10==8&&n%10<9)\n b=1;\n else if(n>=0)\n if(n%10<8)\n b=8-n%10;\n else if(n/10%10!=7)\n b=18-n%10;\n else\n b=10-n%10;\n else\n if(n%10<-8)\n b=-n%10-8;\n else if(n%10==0)\n b=2;\n else if(n>=-8)\n b=8-n%10;\n else\n b=2-n%10;\n printf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain()\n{\n int n,i,y=0,m=0,l;\n scanf(\"%d\", &n);\n i=n;\n if (n==8888888888)\n {\n printf(\"0\");\n m=1;\n }\n while (m!=1)\n {\n i++;\n l=i;\n while (l>0)\n {\n if (l%10==8)\n {\n m=1;\n break;\n }\n l/=10;\n }\n y++;\n }\n printf(\"%d\", y);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n long int a,c;\n int b;\n printf(\"a value \");\n scanf(\"%ld\",&a);\n int d1,d2;\n d1=a%10;\n c=a;\n a=a/10;\n d2=a%10;\n if(d2==7 && d1>=8) {\n b=10-d1;\n \n }\n else if(d2==8 && d1<=9) {\n b=1;\n }\n else {\n if(8-d1>0) {\n b=8-d1;\n }\n else if(d1==9) {\n b=9;\n }\n else {\n b=10;\n }\n }\n if(a<0) {\n printf(\"%d\",b+2*abs(a));\n }\n else {\n printf(\"%d\",b);\n }\n}"}, {"source_code": "#include<stdio.h>\n\nkontrol (long n)\n{\n long i;\n int flag;\n if(n%10==8)return 1;\n if(n<10 &&n>=0)\n {\n if(n%10==8)return 1;\n return 0;\n }\n for (i=10;;i*=10)\n {\n if(i>n)break;\n if((n/i)%10==8){flag=1;break;}\n }\n if(flag==1)return 1;\n return 0;\n}\n\nint main()\n{\n long i,k;\n scanf(\"%d\",&k);\n for(i=k+1;i<8888888888;i++)\n if(kontrol(i)==1){printf(\"%d\",i-k);break;}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n, m=100,f=0;\n\tscanf(\"%d\",&n);\n\tint f2=0;\n\tif(n<0){\n\t\tn*=-1;\n\t\tf2=1;\n\t}\n\tif(n%10==8){\n\t\tprintf(\"10\");\n\t\tf+=1;\n\t}\n\telse{\n\tfor(int i=0;i<7;i++){\n\t\tif((n%m)/(m/10)==8){\n\t\t\tprintf(\"1\");\n\t\t f+=1;\n\t\t\tbreak;\n\t\t}\n\t\tm*=10;\n\t}\n}\n\tif(f==0){\n\t\tint num1=100000000,num2=100000000;\n\t\tif((n%100)/10==7||(n%100)/10==9){\n\t\t\t\n\t\t if(n%10>5){\n\t\t \n\t\t \tnum1=10-n%10;\n\t\t\t }\n\t\t\t else{\n\t\t\t \n\t\t\t \tnum1=n%10;\n\t\t\t }\n\t\t}\n\t\tnum2=(8-n%10);\n\t\tif(num2<0){\n\t\t\tnum2*=-1;\n\t\t}\n\tif(f2==1){\n\t\tnum1+=2;\n\t\tnum2+=2;\n\t}\n\t\tif(num1<num2){\n\t\t\tprintf(\"%d\",num1);\n\t\t}\n\t else{\n\t \tprintf(\"%d\",num2);\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,j,a,b,c;\n scanf(\"%I64d\",&a);\n for(i=1;i<11;i++){\n b=a+i;\n for(j=1;j<10;j++){\n c=b%10;\n if(c==8 || c==-8) break;\n b=b/10;\n }\n if(c==8 || c==-8) break;\n }\n printf(\"%I64d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tlong long int n,len=0,count=0,i,r,m;\n\tchar a[30];\n\tscanf(\"%lld\",&n);\n\twhile(1)\n\t{\n\t\tn++;\n\t\tcount++;\n\t\tif(n<0)\n\t\t{\n\t\t\tn=-1*n;\n\t\t}\n\t\tm=n;\n\t\twhile(m)\n\t\t{\n\t\t\tr=m%10;\n\t\t\tif(r==8)\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",count);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tm=m/10;\n\t\t}\n\t}\n\treturn 0;\n}\n\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long n;\n int ent,c,x;\n scanf(\"%d\",&x);\n n=x;\n int b=0;\n while(c!=8 && n>0){\n c=n%10;\n n=n/10;\n if(c==8){\n b=10;\n }\n }\n if(!b){\n n=x;\n x=x/10;\n x=(x*10)+8;\n b=x-n;\n }\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint mod10 (long a) {\n if (a<0) {\n return ((a%10) + 10 );\n }\n return a%10;\n}\n\nint main() {\n\n long a;\n int ans = -1;\n scanf(\"%Ld\",&a);\n long cpy = a;\n while (cpy != 0) {\n if (cpy%10 == 8) {\n ans = 0;\n }\n cpy /= 10;\n }\n\n //printf(\"mod10: %d\",mod10(a));\n if (ans != 0) {\n if (mod10(a) == 8) {\n if (mod10(a/10) != 7) {\n ans = 8-mod10(a);\n if (ans < 0) {\n ans = 10-ans;\n }\n } else {\n if (mod10(a) == 9) {\n ans = 1;\n } else {\n ans = 8 - mod10(a);\n }\n }\n }\n } else {\n ans = 10;\n }\n\n\n\n printf(\"%d\",ans);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint is(long long int cn1)\n{\n long long int temp;\n int t;\n while(cn1!=0)\n {\n t=cn1%10;\n if(t==8)\n return 1;\n cn1=cn1/10;\n }\n return 0;\n}\nint main()\n{\n long long int number,number1,cn1,cn;\n long long int temp;\n int b=0;\n int count=5;\n scanf(\"%lld\",&number);\n number1=number;\n cn1=number1;\n\n while(number1>0)\n {\n temp=number1%10;\n if(temp==8)\n {\n cn1++;\n count=is(cn1);\n }\n number1=number1/10;\n\n }\n if(count==1)\n {\n printf(\"1\");\n return 0;\n\n }\n if(count==0)\n {\n printf(\"10\");\n return 0;\n }\n number++;\n b++;\n cn=number;\n while(1)\n {\n while(number>0)\n {\n temp=number%10;\n if(temp==8)\n {\n printf(\"%d\",b);\n return 0;\n }\n number=number/10;\n }\n cn++;\n b++;\n number=cn;\n\n }\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint lucky(int n)\n{\nn=fabs(n);\n\n\nwhile (((n%10)!=8)&&(n>=10))\n{\n n=n/10;\n}\nif (n%10==8)\n {return 1;}\nelse {return 0;}\n\n}\n\nint main()\n{int n,l,d;\nscanf(\"%d\",&n);\nd=n;\nl=lucky(n);\nif (l==1)\n{printf(\"10\");return 0;}\nelse\n\n{while (l==0)\n{ n++;\n l=lucky(n);\n}\n}\nprintf(\"%d\",n-d);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nkontrol (long n)\n{\n long i;\n int flag;\n if(n%10==8)return 1;\n if(n<10 &&n>=0)\n {\n if(n%10==8)return 1;\n return 0;\n }\n for (i=10;;i*=10)\n {\n if(i>n)break;\n if((n/i)%10==8){flag=1;break;}\n }\n if(flag==1)return 1;\n return 0;\n}\n\nint main()\n{\n long i,k,temp;\n scanf(\"%d\",&k);\n for(i=k+1;i<8888888888;i++)\n if(kontrol(i)==1){temp=i-k;break;}\n printf(\"%d\",temp);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint temp,a,i,s=0,bayrak=0;\n\tscanf(\"%d\",&a);\n\n\tfor(i=1;;i++)\n\t{\n\t\ttemp=a;\n\t\tif(temp < 0) temp -= 2*temp;\n\t\ttemp+=i;\n\t\twhile(temp)\n\t\t{\n\t\t\tif(temp%10==8)\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tbayrak=1;\n\t\t\t\tbreak;}\n\t\t\ttemp/=10;\n\t\t}\n\t\tif(bayrak)\tbreak;\n\t}\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint solve(char a[1])\n{ \n int i,x,y,l;\n l=strlen(a);\n for(i=l-2;i>=0;i--)\n {\n if(a[i]=='8')\n return 1;\n }\n x=a[l-1]-'0';\n y=a[l-2]-'0';\n if(x>=8&&y==7)\n return (10-x);\n else if(x==8)\n return 10;\n else if(x<8)\n return (8-x);\n else if(x>8);\n return (18-x);\n \n}\nint main()\n{\n char x[10000];\n gets(x);\n printf(\"%d\",solve(x));\n \n}"}], "src_uid": "4e57740be015963c190e0bfe1ab74cb9"} {"nl": {"description": "Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors.The testing goes in n steps, at each step the processor gets some instructions, and then its temperature is measured. The head engineer in R2 is keeping a report record on the work of the processor: he writes down the minimum and the maximum measured temperature in his notebook. His assistant had to write down all temperatures into his notebook, but (for unknown reasons) he recorded only m.The next day, the engineer's assistant filed in a report with all the m temperatures. However, the chief engineer doubts that the assistant wrote down everything correctly (naturally, the chief engineer doesn't doubt his notes). So he asked you to help him. Given numbers n, m, min, max and the list of m temperatures determine whether you can upgrade the set of m temperatures to the set of n temperatures (that is add n\u2009-\u2009m temperatures), so that the minimum temperature was min and the maximum one was max.", "input_spec": "The first line contains four integers n,\u2009m,\u2009min,\u2009max (1\u2009\u2264\u2009m\u2009<\u2009n\u2009\u2264\u2009100;\u00a01\u2009\u2264\u2009min\u2009<\u2009max\u2009\u2264\u2009100). The second line contains m space-separated integers ti (1\u2009\u2264\u2009ti\u2009\u2264\u2009100) \u2014 the temperatures reported by the assistant. Note, that the reported temperatures, and the temperatures you want to add can contain equal temperatures.", "output_spec": "If the data is consistent, print 'Correct' (without the quotes). Otherwise, print 'Incorrect' (without the quotes).", "sample_inputs": ["2 1 1 2\n1", "3 1 1 3\n2", "2 1 1 3\n2"], "sample_outputs": ["Correct", "Correct", "Incorrect"], "notes": "NoteIn the first test sample one of the possible initial configurations of temperatures is [1, 2].In the second test sample one of the possible initial configurations of temperatures is [2, 1, 3].In the third test sample it is impossible to add one temperature to obtain the minimum equal to 1 and the maximum equal to 3."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <ctype.h>\n#include <math.h>\n\nint main (void) {\n\tint i, j; /* counters */\n\tint n, m, min, max, temp;\n\tbool Bmin = false, Bmax = false, Correct = false, ERROR = false;\n\n\tscanf (\"%d %d %d %d\", &n, &m, &min, &max);\n\n\tint diff = n - m;\n\n\tfor (i = 0; i < m; i++) {\n\t\tscanf (\"%d\", &temp);\n\t\tif (!ERROR){\n\t\t\tif (temp == min) Bmin = true;\n\t\t\tif (temp == max) Bmax = true;\n\t\t}\n\t\tif (temp > max || temp < min) {Bmin = false; Bmax = false; ERROR = true;} \n\t}\n\n\tif (!ERROR){\n\t\tif (Bmin && Bmax) Correct = true;\n\t\telse if (Bmin && diff >= 1) Correct = true;\n\t\telse if (Bmax && diff >= 1) Correct = true;\n\t\telse if (diff >= 2) Correct = true;\n\t}\n\n\tif (Correct) printf(\"Correct\\n\");\n\telse printf(\"Incorrect\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,m,min1,max1,i,arr[105],flag1=-1,flag2=-1,h=-1,y=-1;\nscanf(\"%d%d%d%d\",&n,&m,&min1,&max1);\nfor(i=0;i<m;i++){\n scanf(\"%d\",&arr[i]);\n if(arr[i]==min1)\n flag1=1;\n if(arr[i]<min1)\n h=1;\n if(arr[i]==max1)\n flag2=1;\n if(arr[i]>max1)\n y=1;\n }\n\n if(n-m==1&&(flag1==1||flag2==1)&&h!=1&&y!=1)\n printf(\"Correct\");\n\n //else if(n-m==1&&(flag1!=1||flag2!=1))\n // printf(\"Incorrect\");\n\n\n else if(n-m>1&&h!=1&&y!=1)\n printf(\"Correct\");\n\n else\n printf(\"Incorrect\");\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\n#define sort radix_sort(a,n)\nint min(int p,int q)\n{\n if(p>q)\n return q;\n else\n return p;\n}\nint max(int p,int q)\n{\n if(p>q)\n return p;\n else\n return q;\n}\ntypedef long long int ll;\nint main()\n{\n int t,n,i,j,m,mn,mx,x,y,flg=0;\n scanf(\"%d%d%d%d\",&n,&m,&mn,&mx); int a[m];\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n x=a[0],y=a[0];\n if(n-m>=2)\n {\n a[i++]=mn;\n a[i++]=mx;\n for(j=0;j<i;j++)\n {\n x=min(x,a[j]);\n y=max(y,a[j]);\n }\n if(x==mn&&y==mx)\n {\n flg=1;\n }\n }\n else if(n-m==1)\n {\n a[i++]=mn;\n // for(j=0;j<i;j++)\n // printf(\"1-%d \",a[j]);\n for(j=0;j<i;j++)\n {\n x=min(x,a[j]);\n y=max(y,a[j]);\n }\n if(x==mn&&y==mx)\n {\n flg=1;\n }\n // printf(\"1flg%d\\n\",flg);\n }\n if(flg==0)\n {\n a[i-1]=0;x=a[0],y=a[0];\n }\n if(n-m==1&&flg==0)\n {\n a[i-1]=mx;\n // for(j=0;j<i;j++)\n // printf(\"2-%d \",a[j]);\n for(j=0;j<i;j++)\n {\n x=min(x,a[j]);\n y=max(y,a[j]);\n }\n if(x==mn&&y==mx)\n {\n flg=1;\n }\n }\n if(flg==1)\n {\n printf(\"Correct\");\n }\n else if(flg==0)\n {\n printf(\"Incorrect\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint t[100];\n\ntypedef int bool;\n#define FALSE 0\n#define TRUE 1\n\n#define POS_INFINITY 999\n#define NEG_INFINITY -1\n\n\nbool decide(int n, int m, int minN, int maxN)\n{\n int minM = POS_INFINITY, maxM = NEG_INFINITY;\n int i;\n for (i = 0; i < m; i++) {\n scanf(\"%d\", t + i);\n if (t[i] < minM)\n minM = t[i];\n if (t[i] > maxM)\n maxM = t[i];\n }\n\n int d = n - m;\n // printf(\"nimM: %d, maxM: %d, d: %d\\n\", minM, maxM, d);\n if (minN > maxN)\n return FALSE;\n if (minN > minM || maxM > maxN)\n return FALSE;\n if (minN == minM && maxM == maxN)\n return TRUE;\n if (minN < minM && maxM == maxN)\n return d >= 1;\n if (minN == minM && maxM < maxN)\n return d >= 1;\n if (minN < minM && maxM < maxN)\n return d >= 2;\n}\n\nint main(void)\n{\n int n, m, minN, maxN;\n scanf(\"%d %d %d %d\\n\", &n, &m, &minN, &maxN);\n // printf(\"%d %d %d %d\\n\", n, m, minN, maxN);\n int i;\n bool upgradable = decide(n, m, minN, maxN);\n /*for (i = 0; i < m; i++)\n printf(\"%d \", t[i]);*/\n if (upgradable)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,p,q,r,i,a;\n p=101;q=-1;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a<p)\n p=a;\n if(a>q)\n q=a;\n }\n if(min>p || max<q)\n {\n printf(\"Incorrect\");\n return 0;\n }\n r=n-m;\n if(p!=min)\n r--;\n if(q!=max)\n r--;\n //printf(\"%d %d %d\",!(q==max),!(p==min),r);\n if(r>=0)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nint main()\n{\n\tu n,m,min=0xffffffffu,max=0,MI,MA,i,j,k;\n\tfor(scanf(\"%u%u%u%u\",&n,&m,&MI,&MA),n-=m;m--;)\n\t{\n\t\tscanf(\"%u\",&k);\n\t\tif(max<k)max=k;\n\t\tif(min>k)min=k;\n\t}\n\tif(min<MI||max>MA)printf(\"Incorrect\\n\");\n\telse if(n>1||(MI==min&&MA==max))printf(\"Correct\\n\");\n\telse if(!n)printf(\"Incorrect\\n\");\n\telse if(MI==min||MA==max)printf(\"Correct\\n\");\n\telse printf(\"Incorrect\\n\");\n\treturn 0;\n}\n"}, {"source_code": "/*\n\ufffd\u05fd\ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\u0123\ufffd\ufffd.\n\ufffd\ufffd \ufffd\ufffd\ufffd\u073f\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u03fa\ufffd \ufffd\ufffd\u0275\ufffd\ufffd\ufffd \ufffd\ufffd\u00b4\ufffd.\n\ufffd\u05f8\ufffd\ufffd?\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u0234\ufffd.\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u03fe\uec21 \ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u03ff\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u05b4\ufffd. \ufffd\u05f4\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \u016b \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u1cfb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd \ufffd\u1cfb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u07f4\ufffd. \ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\u05f4\ufffd \ufffd\ufffd\ufffd\ufffd m\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\u07f4\ufffd.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd m \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd?\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03fe\uec21 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\u022e\ufffd\u03f0\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u01fd\ufffd\ufffd\u0474\ufffd. \n\ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\u05f4\ufffd \ufffd\ufffd\u017f\ufffd\ufffd\ufffd \ufffd\u05f8\ufffd \ufffd\ufffd\ufffd\u0374\u07b6\ufffd\ufffd \ufffd\ufffd\u00fb\ufffd\u0474\ufffd. \ufffd\u05be\ufffd\ufffd\ufffd n,m,min,max \ufffd\u05f8\ufffd\ufffd\ufffd m \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd \ufffd\ufffd\ufffd\ufffd\u01ae\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd m \ufffd\u00b5\ufffd \ufffd\ufffd\u01ae\ufffd\ufffd\ufffd\ufffd n \ufffd\u00b5\ufffd \ufffd\ufffd\u01ae\ufffd\ufffd \ufffd\ufffd\ufffd\u05f7\ufffd\ufffd\u0335\ufffd \ufffd\u04bc\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u0474\ufffd.\n\ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd min \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd max \ufffd\u0334\ufffd.\n\n\n\n*/\n\n#include <stdio.h>\n\nint main()\n{\n\tint n,m,min,max;\n\tint tmp;\n\tint iCnt = 0;\n\tint iCnt2 = 0;\n\tint iNum;\n\n\tint arr[101] = {0};\n\n\n\tscanf(\"%d %d %d %d\", &n, &m, &min, &max);\n\n\tarr[min] = 1;\n\tarr[max] = 1;\n\n\ttmp = m;\n\twhile(tmp--)\n\t{\n\t\tscanf(\"%d\", &iNum);\n\t\tif(iNum == min || iNum == max)\n\t\t{\n\t\t\t\n\t\t}\n\t\telse if(iNum > min && iNum < max) \n\t\t{\n\t\t\t++iCnt;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tiCnt2 = -1;\n\t\t}\n\t}\n\n\tif(n-2 >= iCnt && iCnt2 == 0)\n\t{\n\t\tprintf(\"Correct\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Incorrect\\n\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long a[101]={0},min,max,m,n,i,temp,key=0;\n scanf(\"%ld%ld%ld%ld\",&n,&m,&min,&max);\n for(i=1;i<=m;i++)\n {\n scanf(\"%ld\",&temp);\n if(temp>max||temp<min)\n key=1;\n a[temp]++;\n }\n if(a[min]==0)m++;\n if(a[max]==0)m++;\n if(m>n||key)\n printf(\"Incorrect\");\n else printf(\"Correct\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,f=0,n,min,max,m,a[1000],freq[10000];\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n \n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>=min&&a[i]<=max){;}\n else f=1;\n freq[a[i]]++;\n }\n if(f){printf(\"Incorrect\\n\");return 0;}\n j=n-m;\n if(!freq[min]){freq[min]++;j--;}\n if(!freq[max]){freq[max]++;j--;}\n if(j<0){printf(\"Incorrect\\n\");return 0;}\n else printf(\"Correct\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint n,m,a,b,x=2,i,z;\nmain(){\nscanf(\"%d%d%d%d\",&n,&m,&a,&b);\nfor(i=0;i<m;++i){scanf(\"%d\",&z); if(z==a||z==b)x--; if(z<a || z>b){puts(\"Incorrect\");return 0;}}\nif(n-m<x)puts(\"Incorrect\");\nelse puts(\"Correct\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint n,m,a,b,x=2,i,z;\nmain(){\nscanf(\"%d%d%d%d\",&n,&m,&a,&b);\nfor(i=0;i<m;++i){scanf(\"%d\",&z); if(z==a||z==b)x--; if(z<a || z>b){puts(\"Incorrect\");return 0;}}\nif(n-m<x)puts(\"Incorrect\");\nelse puts(\"Correct\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,min,max,c=0,c1=0,flag=0,i,a;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min&&c!=-1)\n c=1;\n else if(a<min)\n c=-1;\n else if(a==max&&c1!=-1)\n c1=1;\n else if(a>max)\n c1=-1;\n }\n if(c1+c>0)\n flag=1;\n else if(c1!=-1&&c!=-1)\n if(n-m>1)\n flag=1;\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, m1, m2, c1 = 0, c2 = 0, i;\n \n scanf(\"%d %d %d %d\", &n, &m, &m1, &m2);\n \n for (i = 0; i < m; i++) {\n int x;\n \n scanf(\"%d\", &x);\n \n if (x < m1 || x > m2) {\n puts(\"Incorrect\");\n \n return 0;\n }\n \n if (x == m1) c1 = 1;\n if (x == m2) c2 = 1;\n }\n \n if (n - m >= 2 - c1 - c2) {\n puts(\"Correct\");\n } else {\n puts(\"Incorrect\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n,m,max,min,T[100],t[100],i,a=0,h=1;\n memset(t,0,sizeof(t));\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n t[min]=1;\n t[max]=1;\n for (i=0;i<m;i++)\n {\n scanf(\"%d\",&T[i]);\n if(T[i]<min||T[i]>max)\n {\n printf(\"Incorrect\");\n h--;\n break;\n }\n else\n {\n t[T[i]]++;\n }\n }\n if(h)\n {\n for (i=0;i<m;i++)\n {\n if(T[i]==min)\n {\n n++;\n break;\n }\n }\n for (i=0;i<m;i++)\n {\n if(T[i]==max)\n {\n n++;\n break;\n }\n }\n for (i=min;i<=max;i++)\n {\n a+=t[i];\n }\n if (a<=n)\n {\n printf(\"Correct\");\n }\n else\n {\n printf(\"Incorrect\");\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(i<j)\n {\n while(i<j&&number[j]>key) j--;\n if(i<j) {\n number[i]=number[j]; i++;\n }\n while(i<j&&number[i]<key) i++;\n if(i<j){\n number[j]=number[i]; j--;\n }\n }\n number[i]=key;\n return i;\n}\nvoid q_sort(int number[],int i,int j)\n{\n int temp;\n if(i<j)\n {\n temp=partition(number,i,j);\n q_sort(number,i,temp-1);\n q_sort(number,temp+1,j);\n }\n}\nint main()\n{\n int n,m,max,min,i,j,t[110];\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n {\n for(i=0;i<m;i++)\n scanf(\"%d\",&t[i]);\n q_sort(t,0,m-1);\n if(min>t[0]||max<t[m-1]) printf(\"Incorrect\\n\");\n else if(min==t[0]&&max!=t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min!=t[0]&&max==t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min==t[0]&&max==t[m-1])\n if(m<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(m+2<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint tmp;\n\tint i;\n\tint n, m;\n\tint min, max;\n\tint isMin = 0, isMax = 0;\n\n\tscanf(\"%i %i %i %i\", &n, &m, &min, &max);\n\n\tfor (i = 0; i < m; ++i)\n\t{\n\t\tscanf(\"%i\", &tmp);\n\n\t\tif (tmp < min || tmp > max)\n\t\t{\n\t\t\tprintf(\"Incorrect\\n\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (tmp == min)\n\t\t\tisMin = 1;\n\n\t\tif (tmp == max)\n\t\t\tisMax = 1;\n\t}\n\n\tif (n - m >= 2)\n\t{\n\t\tprintf(\"Correct\\n\");\n\t\treturn 0;\n\t}\n\n\tif (isMin == 1 && isMax == 1)\n\t\tprintf(\"Correct\\n\");\n\telse if ((isMin == 1 && isMax == 0) || (isMax == 1 && isMin == 0))\n\t{\n\t\tif (n - m >= 1)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse \n\t\t\tprintf(\"Incorrect\\n\");\n\t} else\n\t\tprintf(\"Incorrect\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint n, m, min, max, x, y;\n\tint a, b, i;\n\t\n\tscanf(\"%d%d%d%d%d\", &n, &m, &min, &max, &x);\n\ta = b = x;\n\tfor (i = 1; i < m; ++i)\n\t{\n\t\tscanf(\"%d\", &x);\n\t\t\n\t\tif (x < a)\n\t\t{\n\t\t\ta = x;\n\t\t}\n\t\tif (x > b)\n\t\t{\n\t\t\tb = x;\n\t\t}\n\t}\n\tx = n - m;\n\ty = 2 - (a == min) - (b == max);\n\tif (a < min || b > max || x < y)\n\t{\n\t\tputs(\"Incorrect\");\n\t}\n\telse\n\t{\n\t\tputs(\"Correct\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max;\n int sum;\n int i,sz;\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n {\n int flag,flag1,flag2;\n flag=flag1=flag2=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&sz);\n if(sz==min)\n flag1=1;\n if(sz==max)\n flag2=1;\n if(sz<min||sz>max)\n flag=1;\n }\n if(flag1==1&&flag2==1)\n sum=m;\n if(flag1==1&&flag2==0)\n sum=m+1;\n if(flag1==0&&flag2==1)\n sum=m+1;\n if(flag1==0&&flag2==0)\n sum=m+2;\n if(sum>n)\n flag=1;\n\n if(flag==1)\n printf(\"Incorrect\\n\");\n if(flag==0)\n printf(\"Correct\\n\");\n }\n return 0;\n}\n \n \n\n \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\nint main( void ) {\n int n, m, min, max;\n \n scanf(\"%i %i %i %i\", &n , &m, &min, &max);\n \n const int Max = 200;\n bool temp[Max];\n \n memset(temp, 0, sizeof(temp));\n \n int i, c;\n for( i = 0; i < m; i++ ) {\n scanf(\"%i\", &c);\n \n if( c > max || c < min ) {\n printf(\"Incorrect\\n\");\n return 0;\n }\n \n temp[c] = 1;\n }\n \n int obl = 0;\n if( !temp[min] ) obl++;\n if( !temp[max] ) obl++;\n \n if( obl > (n-m) ) printf(\"Incorrect\\n\");\n else printf(\"Correct\\n\");\n \n return 0; \n}\n"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main() {\n\tint n, m, min, max, r, q, i, min1, max1;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &min, &max);\n\tmin1 = INT_MAX, max1 = 0;\n\tfor (i = 0; i < m; i++) {\n\t\tint t;\n\n\t\tscanf(\"%d\", &t);\n\t\tif (min1 > t)\n\t\t\tmin1 = t;\n\t\tif (max1 < t)\n\t\t\tmax1 = t;\n\t}\n\tr = n - m;\n\tq = (min1 != min) + (max1 != max);\n\tprintf(\"%s\\n\", min1 >= min && max1 <= max && r >= q ? \"Correct\" : \"Incorrect\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n\n if(minf > maxf){\n printf(\"Incorrect\\n\");\n return 0;\n }\n if(minv < minf || maxv > maxf){\n printf(\"Incorrect\\n\");\n return 0;\n }\n\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if(n - m >= i){\n printf(\"Correct\\n\");\n }else{\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i,a,a1,a2,x=0;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n a1=a2=1;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a<min || a>max)\n {\n x=1;\n }\n if(a==min)\n a1=0;\n if(a==max)\n a2=0;\n\n\n }\n // printf(\"a1+a2: %d\\tn-m: %d\\n\",a1+a2,n-m);\n\n if(x==1){printf(\"Incorrect\\n\");return 0;}\n if((n-m)>=(a1+a2))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n, m, min, max;\n int i;\n int x;\n int fmin = 1;\n int fmax = 1;\n int sim = 1;\n int add;\n\n scanf(\" %d %d %d %d\", &n, &m, &min, &max);\n add = n - m;\n\n for (i = 0; i < m; i++) {\n scanf(\" %d\", &x);\n if (x == min) {\n fmin = 0;\n }\n if (x == max) {\n fmax = 0;\n }\n if (x < min || x > max) {\n sim = 0;\n }\n }\n\n if (sim == 1) {\n if (max == min) {\n if (add < fmin) {\n sim = 0;\n }\n } else if (add < fmax + fmin) {\n sim = 0;\n }\n }\n\n if (sim == 1) {\n printf(\"Correct\\n\");\n } else {\n printf(\"Incorrect\\n\");\n }\n\n return 0;\n}\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,mini,maxi,i,j;\n scanf(\"%d %d %d %d\",&n,&m,&mini,&maxi);\n int arr[m];\n int dif=n-2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&arr[i]);\n if((arr[i]>mini && arr[i]<maxi && dif>0) )\n {\n dif=dif-1;\n }\n else if((arr[i]==maxi || arr[i]==mini ) && dif>=0)\n {\n\n }\n else\n {\n printf(\"Incorrect\");\n return 0;\n }\n }\n\n printf(\"Correct\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,Min,Max,a[100];\n while(scanf(\"%d%d%d%d\",&n,&m,&Min,&Max)!=EOF)\n {int i,ok=1;\n for(i=0;i<=m-1;i++)\n scanf(\"%d\",&a[i]);\n if(n-m>=2)\n {\n for(i=0;i<=m-1;i++)\n if(a[i]>Max||a[i]<Min)\n {ok=0;\n break;}\n if(ok==1)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n else if(n-m==1)\n {\n int ok1=1,ok2=0;\n ok=0;\n for(i=0;i<=m-1;i++)\n if(a[i]>Max||a[i]<Min)\n {ok1=0;\n break;}\n for(i=0;i<=m-1;i++)\n if(a[i]==Max||a[i]==Min)\n {\n ok2=1;\n break;\n }\n if(ok1&&ok2)\n ok=1;\n if(ok==1)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,max,min,i,j;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[m],cou=0,count=0;\nfor(i=0;i<m;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<m;i++)\n{\n if(a[i]<min || a[i]>max)\n {\n count=1;\n break;\n }\n}\nif(count==0)\n{ \nfor(i=0;i<m;i++)\n{\n if(a[i]==min||a[i]==max)\n {\n cou=1;\n break;\n }\n}\nif(cou==1)\n{\n printf(\"Correct\");\n}\nelse\n{\n if(n-m>=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\n}\nelse\n{\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint intcmp(const void*a,const void *b)\n{\n return *(int*)a-*(int*)b;\n}\nint main()\n{\n int n,m,min,max,i,md[100],p;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&md[i]);\n }\n\n qsort(md,m,sizeof(int),intcmp);//printf(\"watch\\n\");\n if(min<=md[0]&&md[i-1]<=max){\n if(min==md[0]&&md[i-1]==max)p=1;\n else{\n if(n-m>=2)p=1;\n else{\n if(n-m==1&&(min==md[0]||md[i-1]==max))p=1;\n else\n p=0;\n }\n }\n }\n else p=0;\n if(p)printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint max,min,m,n,a[100],i;\n\tint flg=0;\n\twhile(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n\t{ \n\t\tint co=2;\n\t\tif(m>n||max<min)printf(\"Incorrect\\n\");\n\t\tfor(i=0;i<m;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\t\tfor(i=0;i<m;i++)\n\t\t\tif(a[i]<max&&a[i]>min)\n co++;\n\t\t\telse\n\t\t\t\tif(a[i]==max||a[i]==min)\n\t\t\t\t\tco=co;\n\t\t\t\telse\n\t\t\t\t\tif(a[i]>max||a[i]<min)\n\t\t\t\t\t\tflg=1;\n\t\t\tif(co>n||flg==1)\n\t\t\tprintf(\"Incorrect\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"Correct\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,mx,mn;\n int i,j,k,l,data[200],c1=0,c2=0,c3=0;\n\n scanf(\"%d %d %d %d\",&n,&m,&mn,&mx);\n\n for(i=0;i<m;i++){\n scanf(\"%d\",&data[i]);\n }\n\n if(n<=2){\n for(i=0;i<m;i++){\n if(data[i] == mn || data[i] == mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n\n else{\n for(i=0;i<m;i++){\n if(data[i] >= mn && data[i] <= mx){\n c1 = 1;\n if(data[i] == mn){\n c2 = 1;\n }\n else if(data[i]==mx){\n c3 = 1;\n }\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(n==m){\n if(c1==1 &&c2==1 &&c3==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n else if((n-m)==1){\n if((c1==1 && c2==1) || (c1==1 && c3==1)){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n\n }\n else{\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k;\n int t,n,m;\n int a,b,tt;\n while(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF)\n {\n j=0;\n k=0;\n tt=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&t);\n if(t<a||t>b)\n {\n tt=1;\n }\n else if(t==a)\n j=1;\n else if(t==b)\n k=1;\n }\n if(n-m+j+k>=2&&tt==0)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a[105],i,min,max,n,m,flag,f[105];\n flag=1;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n memset(f,0,sizeof(f));\n for (i=1;i<=m;i++) scanf(\"%d\",&a[i]);\n if (n==2)\n {\n for (i=1;i<=m;i++)\n if (a[i]!=min&&a[i]!=max) flag=0;\n }\n else\n {\n for (i=1;i<=m;i++)\n {\n if (a[i]<min||a[i]>max) { flag=0;}\n f[a[i]]++;\n }\n //if (min==max-1||f[min]>1||f[max]>1) flag=0;\n if (f[min]>0) m--;\n if (f[max]>0) m--;\n if (m+2>n) flag=0;\n }\n if (flag==1) printf(\"Correct\"); else printf(\"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include<ctype.h>\n#include<string.h>\n\nint main()\n{\n int n,m,max,min;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n int arr[m],i;\n for(i=0;i<m;i++)\n scanf(\"%d\",&arr[i]);\n int flag=0,minfound=0,maxfound=0;\n for(i=0;i<m;i++){\n if(arr[i]<min || arr[i]>max)\n flag=1;\n else if(arr[i]==min)\n minfound=1;\n else if(arr[i]==max)\n maxfound=1;\n }\n if(!flag){\n if(minfound && maxfound)\n printf(\"Correct\\n\");\n else if(minfound && n-m>=1)\n printf(\"Correct\\n\");\n else if(maxfound && n-m>=1)\n printf(\"Correct\\n\");\n else if(!maxfound && !minfound && n-m>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min,i,flag,temp,t[105];\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max) != EOF)\n {\n for(i=0;i<m;i++)\n scanf(\"%d\",&t[i]);\n flag=1;temp=0;\n if(n-m==1)\n {\n for(i=0;i<m;i++)\n {\n if(t[i]<min)\n {\n flag=0;\n break;\n }\n if(t[i]>max)\n {\n flag=0;\n break;\n }\n if(t[i]==max||t[i]==min)\n temp=1;\n }\n if(!temp)\n flag=0;\n }\n else\n {\n for(i=0;i<m;i++)\n {\n if(t[i]<min)\n {\n flag=0;\n break;\n }\n if(t[i]>max)\n {\n flag=0;\n break;\n }\n }\n }\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]) {\n\tint n, m, min, max;\n\tfscanf(stdin, \"%d %d %d %d\\n\", &n, &m, &min, &max);\n\tint data[m];\n\tint d;\n\tfor (d=0; d<m; d++)\n\t\tscanf(\"%d\", &data[d]);\n\t\n\tint correct = 1, i;\n\tint minp = 0, maxp = 0;\n\t\n\tfor (i=0; i<m; i++) {\n\t\tif (data[i] < data[minp]) minp = i;\n\t\tif (data[i] > data[maxp]) maxp = i;\n\t}\n\t\n\tcorrect = !(n-m == 1 && data[minp] != min && data[maxp] != max);\n\t\n\tfor (i=0; i<m; i++)\n\t\tif (data[i] < min || data[i] > max)\n\t\t\tcorrect = 0;\n\t\n\tfprintf(stdout, correct ? \"Correct\" : \"Incorrect\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint n,m,i,x;\nint mint,maxt,minn,maxn;\n\nint main()\n{\n\tscanf(\"%d%d%d%d\",&n,&m,&mint,&maxt);\n\tminn=100000000;\n\tmaxn=-1;\n\tfor (i=1; i<=m; i++)\n\t{\n\t\tscanf(\"%d\",&x);\n\t\tif (x>maxn) maxn=x;\n\t\tif (x<minn)\tminn=x;\n\t}\n\tif (minn>=mint && maxn<=maxt && (n-2>=m || minn==mint || maxn==maxt)) printf(\"Correct\\n\");\n\t\telse printf(\"Incorrect\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n int a[m];\n for(i=0;i<m;i++)\n {scanf(\"%d\",&a[i]);}\n int c=0;int f=0,p=0;\n for(i=0;i<m;i++)\n {\n if((a[i]>max)||(a[i]<min))\n {\n printf(\"Incorrect\\n\");\n p=1;break;\n }\n }\n if(p==0)\n {\n for(i=0;i<m;i++)\n {\n if(min==max)\n {\n if(a[i]==min)\n {\n c++;f=1;\n }\n }\n else\n {\n if((a[i]==min))\n c++;\n if((a[i]==max))\n c++;\n }\n }\n if((f==1)||(c==2))\n printf(\"Correct\\n\");\n else\n {\n if((n-m)>=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,max,min,i,r,mink,maxk,x=0;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n r=n-m;\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min) mink++;\n if(a[i]==max) maxk++;\n if(a[i]<min) x=1;\n if(a[i]>max) x=1;\n }\n if(x==1) printf(\"Incorrect\");\n else\n {\n if(r==0)\n {\n if(mink>0&&maxk>0) printf(\"Correct\");\n else printf(\"Incorrect\");\n }\n else if(r==1)\n {\n if(mink>0||maxk>0) printf(\"Correct\"); \n else if(mink>0&&maxk>0) printf(\"Coreect\");\n else printf(\"Incorrect\");\n }\n else printf(\"Correct\");\n }\n\nreturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int i, n, m, mn, mx, t, bitmask;\n\n while (scanf(\"%d %d %d %d\", &n, &m, &mn, &mx) != EOF){\n bitmask = 0;\n bool flag = true;\n for (i = 0; i < m; i++){\n scanf(\"%d\", &t);\n if (t < mn || t > mx) flag = false;\n if (t == mn) bitmask |= 1;\n if (t == mx) bitmask |= 2;\n }\n\n if (!flag) puts(\"Incorrect\");\n else{\n if ((n - m) >= (2 - __builtin_popcount(bitmask))) puts(\"Correct\");\n else puts(\"Incorrect\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n // your code goes here\n int n,m,min,max,a[101],i,b,c,d,e;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n b=200;\n c=0;\n d=0;\n e=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(b>=a[i])\n {\n b=a[i];\n }\n if(c<=a[i])\n {\n c=a[i];\n }\n if(a[i]==min)\n {\n d=1;\n }\n if(a[i]==max)\n {\n e=1;\n }\n }\n if(b<min||c>max)\n {\n printf(\"Incorrect\");\n }\n else if(n-m<2&&(d!=1&&e!=1))\n {\n printf(\"Incorrect\");\n }\n else if(n-m==0&&(d!=1||e!=1))\n {\n printf(\"Incorrect\");\n }\n else if((n-m==1&&(d!=1&&e!=0))||(n-m==1&&(d!=0&&e!=1)))\n {\n printf(\"Correct\");\n }\n else\n {\n printf(\"Correct\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int count=0,i,k,n,m,min,max,mindone=0,maxdone=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&k);\n if(k>max || k<min)\n {\n printf(\"Incorrect\\n\");\n return 0;\n }\n if(k==min && mindone==0)\n {\n mindone=1;\n }\n else if(k==max && maxdone==0)\n {\n maxdone=1;\n }\n }\n if(mindone==0 && maxdone==0)\n {\n count=2;\n }\n else if(mindone==0 || maxdone==0)\n {\n count=1;\n }\n else \n {\n count=0;\n }\n if(count<=(n-m))\n {\n printf(\"Correct\\n\");\n }\n else\n {\n printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m,min,max;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n int vis_min=0;\n int vis_max=0;\n int i,flag=0;\n for(i=0;i<m;i++)\n {\n int in;\n scanf(\"%d\",&in);\n if(in==max){\n vis_max=1;\n }else if(in==min){\n vis_min=1;\n }else if(in<min || in>max){\n flag=1;\n }\n\n }\n if(!flag)\n {\n if((!vis_min && vis_max && (n-m)>=1)||(vis_min && !vis_max && (n-m)>=1)||(!vis_max && !vis_min &&( (n-m)>=2))||(vis_max && vis_min && (n-m)>=0))\n {\n printf(\"Correct\");\n }else\n {\n printf(\"Incorrect\");\n }\n }else if(flag)\n {\n printf(\"Incorrect\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,min,max;\n\tscanf(\"%d %d %d %d\",&n,&m,&min,&max);\n\tint ar[m],a,mink=0,maxk=0;\n\tfor(a=0;a<m;a++)\n\t{\n\t\tscanf(\"%d\",&ar[a]);\n\t\tif(ar[a] < min || ar[a] > max) { printf(\"Incorrect\\n\"); return 0; }\n\t\tif(ar[a] == min) mink = 1;\n\t\tif(ar[a] == max) maxk = 1;\n\t}\n\tif(mink==0 && maxk==0 && n-m < 2) printf(\"Incorrect\\n\");\n\telse if( (mink==0 || maxk==0) && n-m < 1) printf(\"Incorrect\\n\");\n\telse printf(\"Correct\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int min,max;\n int n,m,t;\n scanf(\"%d%d\",&n,&m);\n scanf(\"%d%d\",&min,&max);\n int a=2;int i;\n\n if(m>=n)\n {\n printf(\"Incorrect\");\n return 0;\n }\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&t);\n if(t<min || t>max)\n {\n printf(\"Incorrect\");\n return 0;\n }\n if(t!=min && t!=max)\n {\n a++;\n if(a>n)\n {\n printf(\"Incorrect\");\n return 0;\n }\n }\n }\n if(a<=n)\n printf(\"Correct\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,m,min,max,min_temp,max_temp;\n\tint temp[100];\n\tscanf(\"%d%d%d%d\",&n,&m,&min,&max);\n\tmin_temp=101;\n\tmax_temp=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d\",&temp[i]);\n\t\tif(min_temp>temp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp<temp[i])\n\t\t\tmax_temp=temp[i];\n\t}\n\tif(n-m>1)\n\t{\n\t\tif(min<=min_temp && max>=max_temp)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\telse\n\t{\n\t\tif(min_temp==min && max_temp<=max) \n\t\t\tprintf(\"Correct\\n\");\n\t\telse if(max_temp==max && min_temp>=min)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,a,b,i,g=0,h=0;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\tint ara[1000];\n\tfor (i=0;i<m;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=0;i<m;i++){\n\t\tif (ara[i]==a){\n\t\t\tg=1;\n\t\t}\n\t\telse if (ara[i]==b){\n\t\t\th=1;\n\t\t}\n\t\tif (ara[i]<a){\n\t\t\tprintf(\"Incorrect\");\n\t\t \treturn 0;\n\t\t}\n\t\tif (ara[i]>b){\n\t\t\tprintf(\"Incorrect\");\n\t\t \treturn 0;\n\t\t}\n\t\t if (h==1 && g==1){\n\t\t \tprintf(\"Correct\");\n\t\t \treturn 0;\n\t\t }\n\t}\n\tif (h==0 && g==0){\n\t\tif (n-m<2){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\telse if (h==1 && g==0){\n\t\tif (n-m<1){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\tif (h==0 && g==1){\n\t\tif (n-m<1){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main(void){\n int n, m, min, max, i, izm, k = 0, fl = 0, kk;\n scanf(\"%d %d %d %d\", &n, &m, &min, &max);\n if (n != 1){\n k = n - 2;\n kk = 2;\n }\n else{\n \tk = 0; \n \tkk = 1;\n }\n for (i = 0; i < m; i++){\n scanf(\"%d\", &izm);\n\t\tif ((izm < min)||(izm > max))\n\t\t fl = 1;\n\t\telse \n\t\t if (((izm == min)||(izm == max))&&(kk != 0))\n\t\t kk--;\n\t\t else\n\t\t if (((izm >= min)&&(izm <= max))&&(k != 0))\n\t\t k--;\n\t\t else \n\t fl = 1; \t\n } \n\tif (fl == 1)\n\t printf(\"Incorrect\");\n\telse \n\t printf(\"Correct\"); \nreturn(0);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var,i,flag=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n int temp[m];\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp[i]);\n }\n for(i=0;i<m;i++)\n {\n if(temp[i] <min || temp[i] >max)\n {\n flag = 1;\n break;\n } //incorrect \n }\n if(flag!=1)\n {\n if(var<2 && var >0)\n {\n for(i=0;i<m;i++)\n {\n if(temp[i] == max || temp[i] == min)\n {\n flag = -1;\n break;\n }\n flag = 1;\n }\n \n }\n }\n if(flag==1)\n printf(\"Incorrect\\n\");\n else if(flag == -1)\n printf(\"Correct\\n\");\n else if(flag == 0)\n printf(\"Correct\\n\");\n \n //getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i,flagmin=0,flagmax=0,flagminch=0,flagmaxch=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min&&flagminch==0)\n {\n flag--;\n flagminch=1;\n }\n else if(a[i]==max&flagmaxch==0)\n {\n flag--;\n flagmaxch=1;\n }\n else if(a[i]<min&&flagmin==0)\n {\n flag++;\n flagmin=1;\n }\n else if(a[i]>max&&flagmax==0)\n {\n flag++;\n flagmax=1;\n }\n }\n if(flag<0)\n flag=0;\n if(flag>2)\n flag=2;\n if((flag==0||(n-m)>=flag)&&flagmin==0&&flagmax==0)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "/*\n * FCTRL.c\n *\n * Created on: 24 A\ufffdu 2014\n * Author: KT\n */\n\n#include <stdio.h>\n#include<math.h>\nint main(void){\nint m,n,min,max;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\nint j=1;\nint mincounter=0;\nint maxcounter=0;\nint maxchecker=0;\nint minchecker=0;\nfor(;j<=m;j++){\n\tint k;\n\tscanf(\"%d\",&k);\nmincounter+=(k==min?1:0);\nmaxcounter+=(k==max?1:0);\nmaxchecker+=(k>max?1:0);\nmaxchecker+=(k<min?1:0);\n}\n\nmincounter=(mincounter>=1? 1:0);\nmaxcounter=(maxcounter>=1? 1:0);\nif(n-m>=2 && (mincounter==0 && maxcounter==0) && maxchecker==minchecker && maxchecker==0){\n\tputs(\"Correct\");\n}else if(n-m>=1 && ((mincounter==1 && maxcounter==0) ||(mincounter==0 && maxcounter==1)) && maxchecker==minchecker && maxchecker==0){\n\tputs(\"Correct\");\n}else if((mincounter==1 && maxcounter==1) && maxchecker==minchecker && maxchecker==0){\n\tputs(\"Correct\");\n}else{\n\tputs(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0,flag=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]>max||t[i]<min)\n {\n flag=1;\n break;\n\n }\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min&&flag1==0)\n {\n count++;\n flag1=1;\n }\n if(t[i]==max&&flag2==0)\n {\n count++;\n flag2=1;\n }\n }\n}\nif(flag==1)\nprintf(\"Incorrect\");\nelse\n{\nif(temp>=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j,k[100],l,a,c,b,d,m=0,n=0,u=0,o;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n i=a-b;\n for(j=1;j<=b;j++)\n {\n scanf(\"%d\",&k[j]);\n }\n for(l=1;l<=b;l++)\n {\n if(k[l]==c)\n m=m+1;\n if(k[l]==d)\n n=n+1;\n }\n for(o=1;o<=b;o++)\n {\n if(k[o]>=c&&k[o]<=d)\n u=u+1;\n }\n if(u!=b)\n printf(\"Incorrect\");\n else{\n if(m==0&&n==0&&i==1)\n printf(\"Incorrect\");\n else\n printf(\"Correct\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N 100\n\nint main() {\n\tstatic int tt[N];\n\tint n, m, min, max, i, fmin, fmax, cnt, good;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &min, &max);\n\tfor (i = 0; i < m; i++)\n\t\tscanf(\"%d\", &tt[i]);\n\tfmin = fmax = 0;\n\tcnt = 2;\n\tgood = 1;\n\tfor (i = 0; i < m; i++)\n\t\tif (!fmin && tt[i] == min) {\n\t\t\tfmin = 1, cnt--;\n\t\t} else if (!fmax && tt[i] == max) {\n\t\t\tfmax = 1, cnt--;\n\t\t} else if (tt[i] < min || tt[i] > max) {\n\t\t\tgood = 0;\n\t\t\tbreak;\n\t\t}\n\tprintf(good && cnt <= n - m ? \"Correct\\n\" : \"Incorrect\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, min, max;\n int t[100];\n scanf(\"%d %d %d %d\", &n, &m, &min, &max);\n char haveMin = 0;\n char haveMax = 0;\n for(int i = 0; i < m; ++i) {\n scanf(\"%d\", &t[i]);\n if(t[i] == min) {\n haveMin = 1;\n }\n if(t[i] == max) {\n haveMax = 1;\n }\n if(t[i] < min || t[i] > max) {\n puts(\"Incorrect\");\n return 0;\n }\n }\n if(!haveMin) {\n ++m;\n }\n if(!haveMax) {\n ++m;\n }\n puts(m <= n ? \"Correct\" : \"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax >= max && min >= testMin){\n printf(\"Incorrect\");\n }else if(minToBeAdded == 1 && testMin <= min && max <= testMax){\n printf(\"Incorrect\");\n }else if(minToBeAdded == 2 && testMax <= max && testMin >= min){\n printf(\"Correct\");\n }else if(minToBeAdded == 0 || minToBeAdded == 1){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0,min1=101,max1=-1;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n \t\tif(a[i]<min1)\n \t\tmin1=a[i];\n \t\tif(a[i]>max1)\n \t\tmax1=a[i];\n\t }\n\t //printf(\"%d\\n%d\\n\",min1,max1);\n\t int t=-1;\n\t int x=n-m; \n\t if(max1>max||min1<min)\n\t printf(\"Incorrect\\n\");\n\t else if(x>=2)\n\t printf(\"Correct\\n\");\n\t \n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1){\n\t \t\t\t\tprintf(\"Correct\\n\");break;\n\t\t\t }\n\t \t\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max){\n\t \t\t\t\n\t \t\t\tif(min<=min1){\n\t \t\t\t\tt++;printf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\t\n\t\t\t }\n\t \t\t\n\t \t\telse if(a[i]==min){\n\t \t\t\t\t\n\t \t\t\tif(max>=max1){\n\t \t\t\t\tt++;\tprintf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\n\t\t\t }\n\t \t\t\n\t \t\t\n\t\t \n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main(){\nint n,m,min1,max1,i,arr[105],flag1=-1,flag2=-1;\nscanf(\"%d%d%d%d\",&n,&m,&min1,&max1);\nfor(i=0;i<m;i++){\n scanf(\"%d\",&arr[i]);\n if(arr[i]==min1)\n flag1=1;\n if(arr[i]==max1)\n flag2=1;\n }\n\n if((n-m==1&&(flag1==1||flag2==1))||(n-m)>1)\n printf(\"Correct\\n\");\n\n else if(n-m==1&&(flag1!=1||flag2!=1))\n printf(\"Incorrect\\n\");\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,m,min1,max1,i,arr[105],flag1=-1,flag2=-1,h=-1,y=-1;\nscanf(\"%d%d%d%d\",&n,&m,&min1,&max1);\nfor(i=0;i<m;i++){\n scanf(\"%d\",&arr[i]);\n if(arr[i]==min1)\n flag1=1;\n if(arr[i]<min1)\n h=1;\n if(arr[i]==max1)\n flag2=1;\n if(arr[i]>max1)\n y=1;\n }\n\n if(n-m==1&&(flag1==1||flag2==1))\n printf(\"Correct\");\n\n else if(n-m==1&&(flag1!=1||flag2!=1))\n printf(\"Incorrect\");\n\n\n else if(n-m>1&&(h==1||y==1))\n printf(\"Incorrect\");\n\n else if(n-m>1)\n printf(\"Correct\");\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint t[100];\n\ntypedef int bool;\n#define FALSE 0\n#define TRUE 1\n\n#define POS_INFINITY 999\n#define NEG_INFINITY -1\n\n\nbool decide(int n, int m, int minN, int maxN)\n{\n\tint minM = POS_INFINITY, maxM = NEG_INFINITY;\n\tint i;\n\tfor (i = 0; i < m; i++) {\n\t\tscanf(\"%d\", t + i);\n\t\tif (t[i] < minM)\n\t\t\tminM = t[i];\n\t\tif (t[i] > maxM)\n\t\t\tmaxM = t[i];\n\t}\n\n\tint d = n - m;\n\t// printf(\"nimM: %d, maxM: %d, d: %d\\n\", minM, maxM, d);\n\tif (minN == minM && maxM == maxN)\n\t\treturn TRUE;\n\tif (minN < minM && maxM == maxN)\n\t\treturn d >= 1;\n\tif (minN == minM && maxM < maxN)\n\t\treturn d >= 1;\n\tif (minN < minM && maxM < maxN)\n\t\treturn d >= 2;\n}\n\nint main(void)\n{\n\tint n, m, minN, maxN;\n\tscanf(\"%d %d %d %d\\n\", &n, &m, &minN, &maxN);\n\t// printf(\"%d %d %d %d\\n\", n, m, minN, maxN);\n\tint i;\n\tbool upgradable = decide(n, m, minN, maxN);\n\t/*for (i = 0; i < m; i++)\n\t\tprintf(\"%d \", t[i]);*/\n\tif (upgradable)\n\t\tprintf(\"Correct\\n\");\n\telse\n\t\tprintf(\"Incorrect\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nint main()\n{\n\tu n,m,min=0xffffffffu,max=0,MI,MA,i,j,k;\n\tfor(scanf(\"%u%u%u%u\",&n,&m,&MI,&MA),n-=m;m--;)\n\t{\n\t\tscanf(\"%u\",&k);\n\t\tif(max<k)max=k;\n\t\tif(min>k)min=k;\n\t}\n\tif(n>1||(MI==min&&MA==max))printf(\"Correct\\n\");\n\telse if(!n)printf(\"Incorrect\\n\");\n\telse if(MI==min||MA==max)printf(\"Correct\\n\");\n\telse printf(\"Incorrect\\n\");\n\treturn 0;\n}\n"}, {"source_code": "/*\n\ufffd\u05fd\ufffd\ufffd\ufffd\ufffd\ufffd n \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\u0123\ufffd\ufffd.\n\ufffd\ufffd \ufffd\ufffd\ufffd\u073f\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u03fa\ufffd \ufffd\ufffd\u0275\ufffd\ufffd\ufffd \ufffd\ufffd\u00b4\ufffd.\n\ufffd\u05f8\ufffd\ufffd?\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u0234\ufffd.\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u03fe\uec21 \ufffd\ufffd\ufffd\u03bc\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u03ff\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u05b4\ufffd. \ufffd\u05f4\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \u016b \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u1cfb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd.\n\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd \ufffd\u1cfb\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u07f4\ufffd. \ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\u05f4\ufffd \ufffd\ufffd\ufffd\ufffd m\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\u07f4\ufffd.\n\n\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd m \ufffd\u00b5\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd?\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd. \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u03fe\uec21 \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\u022e\ufffd\u03f0\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\u01fd\ufffd\ufffd\u0474\ufffd. \n\ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\u05f4\ufffd \ufffd\ufffd\u017f\ufffd\ufffd\ufffd \ufffd\u05f8\ufffd \ufffd\ufffd\ufffd\u0374\u07b6\ufffd\ufffd \ufffd\ufffd\u00fb\ufffd\u0474\ufffd. \ufffd\u05be\ufffd\ufffd\ufffd n,m,min,max \ufffd\u05f8\ufffd\ufffd\ufffd m \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd \ufffd\ufffd\ufffd\ufffd\u01ae\ufffd\ufffd\ufffd\ufffd\n\ufffd\ufffd\ufffd\ufffd\ufffd m \ufffd\u00b5\ufffd \ufffd\ufffd\u01ae\ufffd\ufffd\ufffd\ufffd n \ufffd\u00b5\ufffd \ufffd\ufffd\u01ae\ufffd\ufffd \ufffd\ufffd\ufffd\u05f7\ufffd\ufffd\u0335\ufffd \ufffd\u04bc\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd\u0474\ufffd.\n\ufffd\u05f7\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd \ufffd\u00b5\ufffd\ufffd\ufffd min \ufffd\ufffd\ufffd\ufffd\ufffd\ufffd max \ufffd\u0334\ufffd.\n\n\n\n*/\n\n#include <stdio.h>\n\nint main()\n{\n\tint n,m,min,max;\n\tint tmp;\n\tint iCnt = 0;\n\tint iCnt2 = 0;\n\tint iNum;\n\n\tint arr[101] = {0};\n\n\n\tscanf(\"%d %d %d %d\", &n, &m, &min, &max);\n\n\tarr[min] = 1;\n\tarr[max] = 1;\n\n\ttmp = m;\n\twhile(tmp--)\n\t{\n\t\tscanf(\"%d\", &iNum);\n\t\tif(iNum == min || iNum == max)\n\t\t{\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t++iCnt;\n\t\t}\n\t}\n\n\tif(n-2 >= iCnt)\n\t{\n\t\tprintf(\"Correct\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Incorrect\\n\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,min,max,c=0,c1=0,flag=0,i,a;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min)\n c=1;\n else if(a<min)\n c=-1;\n else if(a==max)\n c1=1;\n else if(a>max)\n c1=-1;\n }\n if(c1+c>0)\n flag=1;\n else if(c1!=-1&&c!=-1)\n if(n-m>1)\n flag=1;\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,min,max,c=0,c1=0,flag=0,i,a;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min)\n c=1;\n if(a==max)\n c1=1;\n }\n if(c==0)\n {\n if(c1==1)\n if(n>m)\n flag=1;\n if(c1==0)\n if(n-m>1)\n flag=1;\n }\n else if(c1==0)\n {\n if(n>m)\n flag=1;\n }\n else\n flag=1;\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,min,max,c=0,c1=0,flag=0,i,a;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min)\n c=1;\n else if(a<min)\n c=-1;\n else if(a==max)\n c1=1;\n else if(a>max)\n c1=-1;\n }\n if(c1+c>0)\n flag=1;\n else if(c1+c==0)\n if(n-m>1)\n flag=1;\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,min,max,c=0,c1=0,flag=0,i,a;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min)\n c=1;\n else if(a==max)\n c1=1;\n }\n if(c1+c>0)\n flag=1;\n else\n if(n-m>1)\n flag=1;\n\n if(flag)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, m1, m2, c1 = 0, c2 = 0, i;\n \n scanf(\"%d %d %d %d\", &n, &m, &m1, &m2);\n \n for (i = 0; i < m; i++) {\n int x;\n \n scanf(\"%d\", &x);\n \n if (x == m1) c1 = 1;\n if (x == m2) c2 = 1;\n }\n \n if (n - m >= 2 - c1 - c2) {\n puts(\"Correct\");\n } else {\n puts(\"Incorrect\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(i<j)\n {\n while(i<j&&number[j]>key) j--;\n if(i<j) {\n number[i]=number[j]; i++;\n }\n while(i<j&&number[i]<key) i++;\n if(i<j){\n number[j]=number[i]; j--;\n }\n }\n number[i]=key;\n return i;\n}\nvoid q_sort(int number[],int i,int j)\n{\n int temp;\n if(i<j)\n {\n temp=partition(number,i,j);\n q_sort(number,i,temp-1);\n q_sort(number,temp+1,j);\n }\n}\nint main()\n{\n int n,m,max,min,i,j,t[110];\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n {\n for(i=0;i<m;i++)\n scanf(\"%d\",&t[i]);\n q_sort(t,0,m-1);\n if(min>t[0]||max<t[m-1]) printf(\"Incorrect\\n\");\n if(min==t[0]&&max!=t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min!=t[0]&&max==t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min==t[0]&&max==t[m-1])\n if(m<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(m+2<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint partition(int number[],int i,int j)\n{\n int key;\n key=number[i];\n while(i<j)\n {\n while(i<j&&number[j]>key) j--;\n if(i<j) {\n number[i]=number[j]; i++;\n }\n while(i<j&&number[i]<key) i++;\n if(i<j){\n number[j]=number[i]; j--;\n }\n }\n number[i]=key;\n return i;\n}\nvoid q_sort(int number[],int i,int j)\n{\n int temp;\n if(i<j)\n {\n temp=partition(number,i,j);\n q_sort(number,i,temp-1);\n q_sort(number,temp+1,j);\n }\n}\nint main()\n{\n int n,m,max,min,i,j,t[110];\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n {\n for(i=0;i<m;i++)\n scanf(\"%d\",&t[i]);\n q_sort(t,0,m-1);\n if(min>t[0]||max<t[m-1]) printf(\"Correct\\n\");\n if(min==t[0]&&max!=t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min!=t[0]&&max==t[m-1])\n if(m+1<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(min==t[0]&&max==t[m-1])\n if(m<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n else if(m+2<=n) printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint tmp;\n\tint i;\n\tint n, m;\n\tint min, max;\n\tint isMin = 0, isMax = 0;\n\n\tscanf(\"%i %i %i %i\", &n, &m, &min, &max);\n\n\tfor (i = 0; i < m; ++i)\n\t{\n\t\tscanf(\"%i\", &tmp);\n\t\tif (tmp == min)\n\t\t\tisMin = 1;\n\t\telse if (tmp == max)\n\t\t\tisMax = 1;\n\t}\n\n\tif (n - m >= 2)\n\t{\n\t\tprintf(\"Correct\\n\");\n\t\treturn 0;\n\t}\n\n\tif (isMin == 1 && isMax == 1)\n\t\tprintf(\"Correct\\n\");\n\telse if ((isMin == 1 && isMax == 0) || (isMax == 1 && isMin == 0))\n\t{\n\t\tif (n - m >= 1)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse \n\t\t\tprintf(\"Incorrect\\n\");\n\t} else\n\t\tprintf(\"Incorrect\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint tmp;\n\tint i;\n\tint n, m;\n\tint min, max;\n\tint isMin = 0, isMax = 0;\n\n\tscanf(\"%i %i %i %i\", &n, &m, &min, &max);\n\n\tfor (i = 0; i < m; ++i)\n\t{\n\t\tscanf(\"%i\", &tmp);\n\t\tif (tmp == min)\n\t\t\tisMin = 1;\n\t\telse if (tmp == max)\n\t\t\tisMax = 1;\n\t}\n\n\tif (isMin == 1 && isMax == 1)\n\t\tprintf(\"Correct\\n\");\n\telse if (isMin == 1 || isMax == 1)\n\t{\n\t\tif (n - m >= 1)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse \n\t\t\tprintf(\"Incorrect\\n\");\n\t} else\n\t{\n\t\tif (n - m >= 2)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\t\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max;\n int sum;\n int i,sz;\n while(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n {\n int flag,flag1,flag2;\n flag=flag1=flag2=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&sz);\n if(sz==min)\n flag1=1;\n if(sz==min)\n flag2=1;\n if(sz<min||sz>max)\n flag=1;\n }\n if(flag1==1&&flag2==1)\n sum=m;\n if(flag1==1&&flag2==0)\n sum=m+1;\n if(flag1==0&&flag2==1)\n sum=m+1;\n if(flag1==0&&flag2==0)\n sum=m+2;\n if(sum>n)\n flag=1;\n\n if(flag==1)\n printf(\"Incorrect\\n\");\n if(flag==0)\n printf(\"Correct\\n\");\n }\n return 0;\n}\n \n \n\n \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\nint main( void ) {\n int n, m, min, max;\n \n scanf(\"%i %i %i %i\", &n , &m, &min, &max);\n \n const int Max = 200;\n bool temp[Max];\n \n memset(temp, 0, sizeof(temp));\n \n int i, c;\n for( i = 0; i < m; i++ ) {\n scanf(\"%i\", &c);\n temp[c] = 1;\n }\n \n int obl = 0;\n for( i = min; i <= max; i++ )\n if( !temp[i] ) obl++;\n \n if( obl > (n-m) ) printf(\"Incorrect\\n\");\n else printf(\"Correct\\n\");\n \n return 0; \n}\n"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main() {\n\tint n, m, min, max, r, q, i, min1, max1;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &min, &max);\n\tmin1 = INT_MAX, max1 = 0;\n\tfor (i = 0; i < m; i++) {\n\t\tint t;\n\n\t\tscanf(\"%d\", &t);\n\t\tif (min1 > t)\n\t\t\tmin1 = t;\n\t\tif (max1 < t)\n\t\t\tmax1 = t;\n\t}\n\tr = n - m;\n\tq = (min1 != min) + (max1 != max);\n\tprintf(\"%s\\n\", min1 < min || max1 > max || r >= q ? \"Correct\" : \"Incorrect\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if(n - m == i){\n printf(\"Correct\\n\");\n }else{\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if( minf == maxf && n - m >= i){\n printf(\"Correct\\n\");\n return 0;\n }\n if( n - m == i){\n printf(\"Correct\\n\");\n return 0;\n }\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n\n if(minf > maxf){\n printf(\"Incorrect\\n\");\n return 0;\n }\n\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if(n - m >= i){\n printf(\"Correct\\n\");\n }else{\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if( minf == maxf && n - m >= i){\n printf(\"Correct\\n\");\n return 0;\n }\n if( n - m == i){\n printf(\"Correct\\n\");\n return 0;\n }\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint minf, maxf;\nint n, m, tmp;\nint i;\nint minv = 101;\nint maxv = 0;\n\nint main(){\n scanf(\"%d %d %d %d\", &n, &m, &minf, &maxf);\n for(i = 0; i < m; i++){\n scanf(\"%d\", &tmp);\n if(tmp > maxv){\n maxv = tmp;\n }\n if(tmp < minv){\n minv = tmp;\n }\n }\n i = 0;\n if(minv != minf)\n i++;\n if(maxv != maxf)\n i++;\n if(n - m >= i){\n printf(\"Correct\\n\");\n }else{\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i,a,a1,a2;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n a1=a2=1;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a);\n if(a==min)\n a1=0;\n if(a==max)\n a2=0;\n\n\n }\n // printf(\"a1+a2: %d\\tn-m: %d\\n\",a1+a2,n-m);\n\n if((n-m)>=(a1+a2))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,mini,maxi,i,j;\n scanf(\"%d %d %d %d\",&n,&m,&mini,&maxi);\n int arr[m];\n\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&arr[i]);\n if((arr[i]>=mini && arr[i]<=maxi && n>2)|| (n==2 && (arr[i]==maxi || arr[i]==mini)))\n {\n\n }\n else\n {\n printf(\"Incorrect\");\n return 0;\n }\n }\n\n printf(\"Correct\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,max,min,i,j;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[m],cou=0,count=0;\nfor(i=0;i<m;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<m;i++)\n{\n if(a[i]<min&&a[i]>max)\n {\n count=1;\n break;\n }\n}\nif(count==0)\n{ \nfor(i=0;i<m;i++)\n{\n if(a[i]==min||a[i]==max)\n {\n cou=1;\n break;\n }\n}\nif(cou==1)\n{\n printf(\"Correct\");\n}\nelse\n{\n if(n-m>=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\n}\nelse\n{\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,max,min,i,j;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[m],count=0;\nfor(i=0;i<m;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<m;i++)\n{\n if(a[i]==min||a[i]==max)\n {\n count=1;\n break;\n }\n}\nif(count==1)\n{\n printf(\"CORRECT\");\n}\nelse\n{\n if(n-m>=2)\n printf(\"CORRECT\");\n else\n printf(\"INCORRECT\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,max,min,i,j;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[m],count=0;\nfor(i=0;i<m;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<m;i++)\n{\n if(a[i]==min||a[i]==max)\n {\n count=1;\n break;\n }\n}\nif(count==1)\n{\n printf(\"Correct\");\n}\nelse\n{\n if(n-m>=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,max,min,i,j;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[m],cou=0;\nfor(i=0;i<m;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<m;i++)\n{\n if(a[i]==min||a[i]==max)\n {\n cou=1;\n break;\n }\n}\nif(cou==1)\n{\n printf(\"Correct\");\n}\nelse\n{\n if(n-m>=2)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint intcmp(const void*a,const void *b)\n{\n return *(int*)a-*(int*)b;\n}\nint main()\n{\n int n,m,min,max,i,md[100],p;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&md[i]);\n }\n\n qsort(md,n,sizeof(int),intcmp);//printf(\"watch\\n\");\n if(min<=md[0]&&md[i-1]<=max){\n if(min==md[0]&&md[i-1]==max)p=1;\n else{\n if(n-m>=2)p=1;\n else{\n if(n-m==1&&(min==md[0]||md[i-1]==max))p=1;\n else\n p=0;\n }\n }\n }\n else p=0;\n if(p)printf(\"Correct\\n\");\n else printf(\"Incorrect\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint max,min,m,n,a[100],i;\n\twhile(scanf(\"%d%d%d%d\",&n,&m,&min,&max)!=EOF)\n\t{ \n\t\tint co=2;\n\t\tif(m>n||max<min)printf(\"Incorrect\\n\");\n\t\tfor(i=0;i<m;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\t\tfor(i=0;i<m;i++)\n\t\t\tif(a[i]<max&&a[i]>min)\n co++;\n\t\t\telse\n\t\t\t\tif(a[i]==max||a[i]==min)\n\t\t\t\t\tco=co;\n\t\t\tif(co>n)\n\t\t\tprintf(\"Incorrect\\n\");\n\t\t\telse\n\t\t\t\tprintf(\"Correct\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,mx,mn;\n int i,j,k,l,data[200],c1=0;\n\n scanf(\"%d %d %d %d\",&n,&m,&mn,&mx);\n\n for(i=0;i<m;i++){\n scanf(\"%d\",&data[i]);\n }\n\n if(n<=2){\n for(i=0;i<m;i++){\n if(data[i] == mn || data[i] == mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n\n else{\n for(i=0;i<m;i++){\n if(data[i] >= mn && data[i] <= mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,mx,mn;\n int i,j,k,l,data[200],c1=0;\n\n scanf(\"%d %d %d %d\",&n,&m,&mn,&mx);\n\n for(i=0;i<m;i++){\n scanf(\"%d\",&data[i]);\n }\n\n if(n<=2){\n for(i=0;i<m;i++){\n if(data[i] == mn || data[i] == mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n\n else{\n for(i=0;i<m;i++){\n if(data[i] >= mn || data[i] <= mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,mx,mn;\n int i,j,k,l,data[200],c1=0,c2=0,c3=0;\n\n scanf(\"%d %d %d %d\",&n,&m,&mn,&mx);\n\n for(i=0;i<m;i++){\n scanf(\"%d\",&data[i]);\n }\n\n if(n<=2){\n for(i=0;i<m;i++){\n if(data[i] == mn || data[i] == mx){\n c1 = 1;\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n\n else{\n for(i=0;i<m;i++){\n if(data[i] >= mn && data[i] <= mx){\n c1 = 1;\n if(data[i]==mn){\n c2 = 1;\n }\n else if(data[i]==mx){\n c3 = 1;\n }\n }\n else{\n c1 = 0;\n break;\n }\n }\n if(n==m){\n if(c1==1 &&c2==1 &&c3==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n else if((n-m)==1){\n if((c1==1 && c2==1) && (c1==1 && c3==1)){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n\n }\n else{\n if(c1==1){\n printf(\"Correct\\n\");\n }\n else{\n printf(\"Incorrect\\n\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k;\n int t,n,m;\n int a,b;\n while(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF)\n {\n j=0;\n k=0;\n t=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&t);\n if(t<a||t>b)\n {\n t++;\n continue;\n }\n else if(t==a)\n j=1;\n else if(t==b)\n k=1;\n }\n if(n-m+j+k+t>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k;\n int t,n,m;\n int a,b;\n while(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF)\n {\n j=0;\n k=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&t);\n if(t==a)\n j=1;\n if(t==b)\n k=1;\n }\n if(n-m+j+k>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k;\n int t,n,m;\n int a,b;\n int liu [106];\n while(scanf(\"%d%d%d%d\",&n,&m,&a,&b)!=EOF)\n {\n j=0;\n k=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",liu+i);\n }\n for(i=0;i<n;i++)\n {\n if(liu[i]==a)\n j++;\n if(liu[i]==b)\n k++;\n }\n if(n-m+j+k>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a[105],i,min,max,n,m,flag;\n flag=1;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for (i=1;i<=m;i++) scanf(\"%d\",&a[i]);\n if (n==2)\n {\n for (i=1;i<=m;i++)\n if (a[i]!=min&&a[i]!=max) flag=0;\n }\n else\n {\n for (i=1;i<=m;i++)\n if (a[i]<min||a[i]>max) flag=0;\n if (min==max-1) flag=0;\n }\n if (flag==1) printf(\"Correct\"); else printf(\"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a[105],i,min,max,n,m,flag;\n flag=1;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for (i=1;i<=m;i++) scanf(\"%d\",&a[i]);\n if (n==2)\n {\n for (i=1;i<=m;i++)\n if (a[i]!=min&&a[i]!=max) flag=0;\n }\n else\n {\n for (i=1;i<=m;i++)\n if (a[i]<min||a[i]>max) flag=0;\n }\n if (flag==1) printf(\"Correct\"); else printf(\"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]) {\n\tint n, m, min, max;\n\tfscanf(stdin, \"%d %d %d %d\\n\", &n, &m, &min, &max);\n\tint data[m];\n\tint d;\n\tfor (d=0; d<m; d++)\n\t\tscanf(\"%d\", &data[d]);\n\t\n\tint correct = 1, i;\n\tint minp = 0, maxp = 0;\n\t\n\tfor (i=0; i<m; i++) {\n\t\tif (data[i] < data[minp]) minp = i;\n\t\tif (data[i] > data[maxp]) maxp = i;\n\t}\n\t\n\tcorrect = !(n-m == 1 && data[minp] != min && data[maxp] != max);\n\tcorrect *= (data[minp] < min || data[maxp] > max);\n\t\n\tfprintf(stdout, correct ? \"Correct\" : \"Incorrect\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]) {\n\tint n, m, min, max;\n\tfscanf(stdin, \"%d %d %d %d\\n\", &n, &m, &min, &max);\n\tint data[m];\n\tint d;\n\tfor (d=0; d<m; d++)\n\t\tscanf(\"%d\", &data[d]);\n\t\n\tint correct = 1, i;\n\tint minp = 0, maxp = 0;\n\t\n\tfor (i=0; i<m; i++) {\n\t\tif (data[i] < data[minp]) minp = i;\n\t\tif (data[i] > data[maxp]) maxp = i;\n\t}\n\t\n\tcorrect = !(n-m == 1 && data[minp] != min && data[maxp] != max);\n\t\n\tfprintf(stdout, correct ? \"Correct\" : \"Incorrect\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[]) {\n\tint n, m, min, max;\n\tscanf(\"%d %d %d %d\\n\", &n, &m, &min, &max);\n\tint data[m];\n\tint d;\n\tfor (d=0; d<m; d++)\n\t\tscanf(\"%d\", &data[d]);\n\t\n\tint correct = 1, i;\n\tint minp = 0, maxp = 0;\n\t\n\tfor (i=0; i<m; i++) {\n\t\tif (data[i] < data[minp]) minp = i;\n\t\tif (data[i] > data[maxp]) maxp = i;\n\t}\n\t\n\tcorrect = !(n-m == 1 && data[minp] != min && data[maxp] != max);\n\t\n\tprintf(correct ? \"Correct\\n\" : \"Incorrect\\n\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n int a[m];\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);int c=0;\n for(i=0;i<m;i++)\n {\n if((a[i]==min)||(a[i]==max))\n c++;\n }\n if(c==(n-m))\n printf(\"Correct\\n\");\n else\n {\n if(c==0)\n {\n if((n-m)>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n int a[m];\n for(i=0;i<m;i++)\n {scanf(\"%d\",&a[i]);}\n int c=0;int f=0;\n for(i=0;i<m;i++)\n {\n if((a[i]>max)||(a[i]<min))\n {\n printf(\"Incorrect\\n\");\n f=1;break;\n }\n }\n if(f==0)\n {\n for(i=0;i<m;i++)\n {\n if(min==max)\n {\n if(a[i]==min)\n {\n c++;f=1;\n }\n }\n else\n {\n if((a[i]==min))\n c++;\n if((a[i]==max))\n c++;\n }\n }\n }\n if((f==1)||(c==2))\n printf(\"Correct\\n\");\n else\n {\n if((n-m)>=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n int a[m];\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);int c=0;int f=0;\n for(i=0;i<m;i++)\n {\n if(min==max)\n {\n if(a[i]==min)\n {\n c++;f=1;\n }\n }\n else\n {\n if((a[i]==min))\n c++;\n if((a[i]==max))\n c++;\n }\n\n }\n if((f==1)||(c==2))\n printf(\"Correct\\n\");\n else\n {\n if((n-m)>=(2-c))\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n int a[m];\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);int c=0;\n for(i=0;i<m;i++)\n {\n if((a[i]==min)||(a[i]==max))\n c++;\n }\n if(c==(n-m))\n printf(\"Correct\\n\");\n else\n {\n if(c==0)\n {\n if((n-m)>=2)\n printf(\"Correct\\n\");\n else\n printf(\"Incorrect\\n\");\n }\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,max,min,i,r,mink,maxk,x=0;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n r=n-m;\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min) mink++;\n if(a[i]==max) maxk++;\n if(a[i]<min||a[i]>max) x=1;\n }\n if(x=1) printf(\"Incorrect\");\n else if(x=0)\n {\n if(r==0)\n {\n if(mink>0&&maxk>0) printf(\"Correct\");\n else printf(\"Incorrect\");\n }\n else if(r==1)\n {\n if(mink>0||maxk>0) printf(\"Correct\"); \n else if(mink>0&&maxk>0) printf(\"Coreect\");\n else printf(\"Incorrect\");\n }\n else printf(\"Correct\");\n }\n\nreturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,min,max,dem=0,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min||a[i]==max) dem++;\n }\n if(dem==0) printf(\"Incorrect\");\n else printf(\"Correct\");\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{ \n int a[101];\n int n,m,c,b,i,max,min;\n scanf(\"%d %d %d %d\",&n,&m,&c,&b);\n for(i=0;i<m;++i)\n scanf(\"%d\",&a[i]); \n min=a[0];\n max=a[0];\n for(i=0;i<m;i++)\n {\n if(a[i]<min) min=a[i];\n if(a[i]>max) max=a[i];\n }\n if(min==c||max==b) printf(\"Correct\");\n else\n printf(\"Incorrect\");\n \nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n long n,dem,i,z;\n int a[20000];\n scanf(\"%ld\",&n);\n dem=0;\n z=0;\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if (a[i]!=-1) z=z+a[i];\n if (a[i]==-1)\n {\n \n if (z==0) dem++;\n else \n {\n z=z-1;\n if (z<0) z=0;\n }\n }\n \n }\n printf(\"%ld\",dem);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,min,max,dem=0,i,x;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min||a[i]==max) dem++;\n if(a[i]<min||a[i]>max); x=1;\n }\n if(x=1) printf(\"Incorrect\");\n else\n {\n if(n-(i)==0)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem>0) printf(\"Correct\");\n }\n else if(n-(i)==1)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem==1) printf(\"Correct\");\n else printf(\"Correct\");\n }\n else if(n-(i)>=2) printf(\"Correct\");\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,min,max,dem=0,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min||a[i]==max) dem++;\n }\n if(n-(i+1)==0)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem>0) printf(\"Correct\");\n }\n else if(n-(i+1)==1)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem==1) printf(\"Correct\");\n else printf(\"Correct\");\n }\n else printf(\"Correct\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,min,max,dem=0,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min||a[i]==max) dem++;\n }\n if(n-(i)==0)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem>0) printf(\"Correct\");\n }\n else if(n-(i)==1)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem==1) printf(\"Correct\");\n else printf(\"Correct\");\n }\n else if(n-(i)>=2) printf(\"Correct\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,max,min,i,r,mink,maxk;\n scanf(\"%d%d%d%d\",&n,&m,&min,&max);\n r=n-m;\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min) mink++;\n if(a[i]==max) maxk++;\n }\n if(r==0)\n {\n if(mink>0&&maxk>0) printf(\"Correct\");\n else printf(\"Incorrect\");\n }\n else if(r==1)\n {\n if(mink>0||maxk>0) printf(\"Correct\"); \n else if(mink>0&&maxk>0) printf(\"Coreect\");\n else printf(\"Incorrect\");\n }\n else printf(\"Correct\");\n\nreturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a[100000];\n int n,m,min,max,dem=0,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<m;i++)\n {\n if(a[i]==min||a[i]==max) dem++;\n }\n if(n-(i+1)==0)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem>0) printf(\"Correct\");\n }\n else if(n-(i+1)==1)\n {\n if(dem==0) printf(\"Incorrect\");\n else if(dem==1) printf(\"Correct\");\n else printf(\"Correct\");\n }\n else printf(\"Incorrect\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n // your code goes here\n int n,m,min,max,a[101],i,b,c,d,e;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n b=200;\n c=0;\n d=0;\n e=0;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(b<=a[i])\n {\n b=a[i];\n }\n if(c>=a[i])\n {\n c=a[i];\n }\n if(a[i]==min)\n {\n d=1;\n }\n if(a[i]==max)\n {\n e=1;\n }\n }\n if(b<min||c>max)\n {\n printf(\"Incorrect\");\n }\n else if(n-m<2&&(d!=1&&e!=1))\n {\n printf(\"Incorrect\");\n }\n else if(n-m==0&&(d!=1||e!=1))\n {\n printf(\"Incorrect\");\n }\n else if((n-m==1&&(d!=1&&e!=0))||(n-m==1&&(d!=0&&e!=1)))\n {\n printf(\"Correct\");\n }\n else\n {\n printf(\"Correct\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int count=0,i,k,n,m,min,max,mindone=0,maxdone=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&k);\n if(k==min && mindone==0)\n {\n mindone=1;\n }\n else if(k==max && maxdone==0)\n {\n maxdone=1;\n }\n }\n if(mindone==0 && maxdone==0)\n {\n count=2;\n }\n else if(mindone==0 || maxdone==0)\n {\n count=1;\n }\n else \n {\n count=0;\n }\n if(count<=(n-m))\n {\n printf(\"Correct\\n\");\n }\n else\n {\n printf(\"Incorrect\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,min,max;\n\tscanf(\"%d %d %d %d\",&n,&m,&min,&max);\n\tint ar[m],a,mink=0,maxk=0;\n\tfor(a=0;a<m;a++)\n\t{\n\t\tscanf(\"%d\",&ar[a]);\n\t\tif(ar[a] <= min) mink = 1;\n\t\tif(ar[a] >= max) maxk = 1;\n\t}\n\tif(mink==0 && maxk==0 && n-m < 2) printf(\"Incorrect\\n\");\n\telse if( (mink==0 || maxk==0) && n-m < 1) printf(\"Incorrect\\n\");\n\telse printf(\"Correct\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,min,max;\n\tscanf(\"%d %d %d %d\",&n,&m,&min,&max);\n\tint ar[m],a,mink=0,maxk=0;\n\tfor(a=0;a<m;a++)\n\t{\n\t\tscanf(\"%d\",&ar[a]);\n\t\tif(ar[a] == min) mink = 1;\n\t\tif(ar[a] == max) maxk = 1;\n\t}\n\tif(!mink && !maxk && n-m < 2) printf(\"Incorrect\\n\");\n\telse if( (!mink || !maxk) && n-m < 1) printf(\"Incorrect\\n\");\n\telse printf(\"Correct\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[n];\na[0]=min;\na[1]=max;\nint i=2;int t;\nint count=0;\n\nfor(;i<m+2;i++)\n{\n scanf(\"%d\",&t);\n if(i>=n && (t!=min && t!=max))\n{printf(\"Incorrect\");\nreturn 0;}\nelse{\n\nif(t>=min || t<=max)\n{if(t==min || t==max)\n {\n count++;\n if(count>n)\n {\n\n\n printf(\"Incorrect\");\n return 0;}\n }\n a[i]=t;\n}\nelse\n{printf(\"Incorrect\");\nreturn 0;}}}\nif(i-count<=n)\n{\n printf(\"Correct\");\n}\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[n];\na[0]=min;\na[1]=max;\nint i=2;int t;\nint count=0;\n\nfor(;i<m+2;i++)\n{\n scanf(\"%d\",&t);\n if(i>=n && (t!=min && t!=max))\n{printf(\"Incorrect\");\nreturn 0;}\nelse{\n\nif(t>=min || t<=max)\n{if(t==min || t==max)\n {\n count++;\n if(count>n)\n {\n\n\n printf(\"Incorrect\");\n return 0;}\n }\n a[i]=t;\n}\nelse\n{printf(\"Incorrect\");\nprintf(\"i am here else wrong\");\nreturn 0;}}}\nif(i-count<=n)\n{\n printf(\"Correct\");\n}\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max;\nscanf(\"%d%d%d%d\",&n,&m,&min,&max);\nint a[n];\na[0]=min;\na[1]=max;\nint i=2;int t;\nint count=0;\n\nfor(;i<m+2;i++)\n{\n scanf(\"%d\",&t);\n if(i>=n && (t!=min && t!=max))\n{printf(\"Incorrect\");\nreturn 0;}\nelse{\n\nif(t>=min || t<=max)\n{if(t==min || t==max)\n {\n count++;\n if(count>n)\n {\n\n\n printf(\"Incorrect\");\n return 0;}\n }\n a[i]=t;\n}\nelse\n{printf(\"Incorrect\");\nprintf(\"i am here else wrong\");\nreturn 0;}}}\nif(i-count<=n)\n{\n printf(\"correct\");\n}\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,m,min,max,min_temp,max_temp;\n\tint temp[100];\n\tscanf(\"%d%d%d%d\",&n,&m,&min,&max);\n\tmin_temp=101;\n\tmax_temp=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d\",&temp[i]);\n\t\tif(min_temp>temp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp<temp[i])\n\t\t\tmax_temp=temp[i];\n\t}\n\tif(n-m>1)\n\t\tprintf(\"Correct\\n\");\n\telse\n\t{\n\t\tif(min_temp==min||max_temp==max)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,m,min,max,min_temp,max_temp;\n\tint temp[100];\n\tscanf(\"%d%d%d%d\",&n,&m,&min,&max);\n\tmin_temp=101;\n\tmax_temp=0;\n\tfor(i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d\",&temp[i]);\n\t\tif(min_temp>temp[i])\n\t\t\tmin_temp=temp[i];\n\t\tif(max_temp<temp[i])\n\t\t\tmax_temp=temp[i];\n\t}\n\tif(n-m>1)\n\t{\n\t\tif(min<=min_temp && max>=max_temp)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\telse\n\t{\n\t\tif(min_temp==min && max_temp==max)\n\t\t\tprintf(\"Correct\\n\");\n\t\telse\n\t\t\tprintf(\"Incorrect\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,k,input[20001][11],C[11],send[20001][11],i,j,a,b,notifications;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tfor(i=1;i<n+1;i++)\n\t{\n\t\tfor(j=1;j<m+1;j++)\n\t\t{\n\t\t\tscanf(\"%d\",&input[i][j]);\n\t\t}\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\n\t\tscanf(\"%d%d\",&a,&b);\n\t\tC[b]++;\n\t\tsend[a][b]++;\n\t}\n\t\tfor(i=1;i<n+1;i++)\n\t\t{\n\t\t\tnotifications=0;\n\t\t\tfor(j=1;j<m+1;j++)\n\t\t\t{\n\t\t//\tif(j!=A[i])\n\t\t//\t{\n\t\t\t\tif(input[i][j]==1)\n\t\t\t\t\tnotifications+=C[j]-send[i][j];\n\t\t\t}\n\t\t\tprintf(\"%d \",notifications);\n\t\t//\t}\n\t\t}\n//\tfor(i=1;i<n+1;i++)\n//\t{\n//\t\tprintf(\"%d \",notif[i]);\n//\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,a,b,i,g=0,h=0;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\tint ara[1000];\n\tfor (i=0;i<m;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=0;i<m;i++){\n\t\tif (ara[i]==a){\n\t\t\tg=1;\n\t\t}\n\t\telse if (ara[i]==b){\n\t\t\th=1;\n\t\t}\n\t\t if (h==1 && g==1){\n\t\t \tprintf(\"Correct\");\n\t\t \treturn 0;\n\t\t }\n\t}\n\tif (h==0 && g==0){\n\t\tif (n-m<2){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\telse if (h==1 && g==0){\n\t\tif (n-m<1){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\tif (h==0 && g==1){\n\t\tif (n-m<1){\n\t\t\tprintf(\"Incorrect\");\n\t\t}\n\t\telse{\n\t\t\tprintf(\"Correct\");\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(temp < min || temp > max)\n printf(\"Incorrect\\n\");\n \n else if(var < 2 && (temp == min || temp == max) )\n printf(\"Correct\\n\");\n else if(var < 2 && (temp != min || temp != max) )\n printf(\"Incorrect\\n\");\n else if( var >= 2 && temp>=min && temp <=max)\n printf(\"Correct\\n\"); \n \n }\n //getch();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i,flag=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if( flag==1)\n continue;\n \n else\n {\n if(temp< min || temp>max)\n {\n flag = 1;\n //printf(\"1\");\n }\n else if( var<2 && var>0 && (temp!= min && temp!= max) )\n {\n flag = 1;\n //printf(\"2\");\n }\n else if( var <2 && (temp == min || temp ==max) )\n {\n flag = 0;\n //printf(\"3\");\n }\n else\n {\n flag = 0;\n //printf(\"4\");\n }\n }\n /* if(flag ==1)\n continue;\n else{\n if(temp < min || temp > max)\n {//printf(\"Incorrect\\n\");\n flag=1;\n //printf(\"1\");\n } \n /* else if(var < 2 && (temp == min || temp == max) )\n { //printf(\"Correct\\n\");\n flag=0;\n printf(\"2\");\n }\n else if((m==1|| m==2) && (temp != min || temp != max) )\n { //printf(\"Incorrect\\n\");\n flag=1;\n //printf(\"3\");\n }\n else if( var >= 2 && temp>=min && temp <=max)\n {//printf(\"Correct\\n\"); \n flag=0;\n //printf(\"4\");\n }*/\n //}\n }\n if(flag==1)\n printf(\"Incorrect\\n\");\n else\n printf(\"Correct\\n\");\n \n return 0;\n //getch();\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m,max,min, var, temp,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(temp < min || temp > max)\n printf(\"Incorrect\\n\");\n \n else if(var < 2 && (temp == min || temp == max) )\n printf(\"Correct\\n\");\n else if(var < 2 && (temp != min || temp != max) )\n printf(\"Incorrect\\n\");\n else if( var >= 2 && temp>=min && temp <=max)\n printf(\"Correct\\n\"); \n \n }\n //getch();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i,flag=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(flag ==1)\n continue;\n else{\n if(temp < min || temp > max)\n {//printf(\"Incorrect\\n\");\n flag=1;\n //printf(\"1\");\n } \n /* else if(var < 2 && (temp == min || temp == max) )\n { //printf(\"Correct\\n\");\n flag=0;\n printf(\"2\");\n }\n else if(var < 2 && (temp != min || temp != max) )\n { //printf(\"Incorrect\\n\");\n flag=1;\n printf(\"3\");\n }*/\n else if( var >= 2 && temp>=min && temp <=max)\n {//printf(\"Correct\\n\"); \n flag=0;\n //printf(\"4\");\n }\n }\n }\n if(flag==1)\n printf(\"Incorrect\\n\");\n else\n printf(\"Correct\\n\");\n //getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(temp < min || temp > max)\n printf(\"Incorrect\\n\");\n \n else if(var < 2 && (temp == min || temp == max) )\n printf(\"Correct\\n\");\n else if(var < 2 && (temp != min || temp != max) )\n printf(\"Incorrect\\n\");\n else if( var >= 2 && temp>=min && temp <=max)\n printf(\"Correct\\n\"); \n \n }\n return 0;\n // getch();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i,flag=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(flag ==1)\n continue;\n else{\n if(temp < min || temp > max)\n //printf(\"Incorrect\\n\");\n flag=1; \n else if(var < 2 && (temp == min || temp == max) )\n //printf(\"Correct\\n\");\n flag=0;\n else if(var < 2 && (temp != min || temp != max) )\n //printf(\"Incorrect\\n\");\n flag=1;\n else if( var >= 2 && temp>=min && temp <=max)\n //printf(\"Correct\\n\"); \n flag=0;\n }\n }\n if(flag==1)\n printf(\"Incorrect\\n\");\n else\n printf(\"Correct\\n\");\n //getch();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,max,min, var, temp,i,flag=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n var= n-m;\n //printf(\"%d\\n\",var);\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&temp);\n if(flag ==1)\n continue;\n else{\n if(temp < min || temp > max)\n {//printf(\"Incorrect\\n\");\n flag=1;\n //printf(\"1\");\n } \n /* else if(var < 2 && (temp == min || temp == max) )\n { //printf(\"Correct\\n\");\n flag=0;\n printf(\"2\");\n }*/\n else if((m==1|| m==2) && (temp != min || temp != max) )\n { //printf(\"Incorrect\\n\");\n flag=1;\n //printf(\"3\");\n }\n else if( var >= 2 && temp>=min && temp <=max)\n {//printf(\"Correct\\n\"); \n flag=0;\n //printf(\"4\");\n }\n }\n }\n if(flag==1)\n printf(\"Incorrect\\n\");\n else\n printf(\"Correct\\n\");\n \n return 0;\n // getch();\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i,flagmin=0,flagmax=0,flagminch=0,flagmaxch=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min&&flagminch==0)\n {\n flag--;\n flagminch=1;\n }\n else if(a[i]==max&flagmaxch==0)\n {\n flag--;\n flagmaxch=1;\n }\n else if(a[i]<min&&flagmin==0)\n {\n flag++;\n flagmin=1;\n }\n else if(a[i]>max&&flagmax==0)\n {\n flag++;\n flagmax=1;\n }\n }\n if(flag<0)\n flag=0;\n if(flag>2)\n flag=2;\n if(flag==0||(n-m)>=flag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min)\n flag--;\n if(a[i]==max)\n flag--;\n }\n if(flag<0)\n flag=0;\n if(flag==0||(n-m)>flag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min)\n flag--;\n if(a[i]==max)\n flag--;\n }\n if((n-m)<flag)\n printf(\"Incorrect\");\n else\n printf(\"Correct\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min)\n flag--;\n if(a[i]==max)\n flag--;\n }\n if(flag<0)\n flag=0;\n if(flag==0||(n-m)>=flag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i,flagmin=0,flagmax=0;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min)\n flag--;\n else if(a[i]==max)\n flag--;\n else if(a[i]<min&&flagmin==0)\n {\n flag++;\n flagmin=1;\n }\n else if(a[i]>max&&flagmax==0)\n {\n flag++;\n flagmax=1;\n }\n }\n if(flag<0)\n flag=0;\n if(flag>2)\n flag=2;\n if(flag==0||(n-m)>=flag)\n printf(\"Correct\");\n else\n printf(\"Incorrect\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,min,max,a[200],flag,i;\n scanf(\"%d %d %d %d\",&n,&m,&min,&max);\n flag=2;\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==min)\n flag--;\n if(a[i]==max)\n flag--;\n }\n if(flag<0)\n flag=0;\n if((n-m)<flag)\n printf(\"Incorrect\");\n else\n printf(\"Correct\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0,flag=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]>max||t[i]<min)\n {\n break;\n flag=1;\n }\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min&&flag1==0)\n {\n count++;\n flag1=1;\n }\n if(t[i]==max&&flag2==0)\n {\n count++;\n flag2=1;\n }\n }\n}\nif(flag==1)\nprintf(\"Incorrect\");\nelse\n{\nif(temp>2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0,flag=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]>max||t[i]<min)\n {\n flag=1;\n break;\n\n }\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min&&flag1==0)\n {\n count++;\n flag1=1;\n }\n if(t[i]==max&&flag2==0)\n {\n count++;\n flag2=1;\n }\n }\n}\nif(flag==1)\nprintf(\"Incorrect\");\nelse\n{\nif(temp>2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min&&flag1==0)\n {\n count++;\n flag1=1;\n }\n if(t[i]==max&&flag2==0)\n {\n count++;\n flag2=1;\n }\n }\n}\nif(temp>=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min)\n flag1=1;\n else\n flag2==1;\n }\n else\n {\n if(flag1==0)\n flag1=1;\n else\n {\n if(flag2==0)\n flag2=1;\n }\n count++;\n }\n if(count==temp)\n {\n break;\n }\n}\nif(flag1==1&&flag2==1)\n printf(\"Correct\");\n else if(count<temp)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,min,max,t[110],temp,i,count=0,flag1=0,flag2=0,flag=0;\nscanf(\"%d %d %d %d\",&n,&m,&min,&max);\ntemp=n-m;\nfor(i=0;i<m;i++)\nscanf(\"%d\",&t[i]);\nfor(i=0;i<m;i++)\n{\n if(t[i]>max||t[i]<min)\n {\n break;\n flag=1;\n }\n if(t[i]==min||t[i]==max)\n {\n if(t[i]==min&&flag1==0)\n {\n count++;\n flag1=1;\n }\n if(t[i]==max&&flag2==0)\n {\n count++;\n flag2=1;\n }\n }\n}\nif(flag==1)\nprintf(\"Incorrect\");\nelse\n{\nif(temp>=2-count)\n printf(\"Correct\");\nelse\n printf(\"Incorrect\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j,k[100],l,a,c,b,d,m=0,n=0;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n i=a-b;\n for(j=1;j<=b;j++)\n {\n scanf(\"%d\",&k[j]);\n }\n for(l=1;l<=b;l++)\n {\n if(k[l]==c)\n m=m+1;\n if(k[l]==d)\n n=n+1;\n }\n if(m==0&&n==0&&i==1)\n printf(\"Incorrect\");\n else\n printf(\"Correct\");\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N 100\n\nint main() {\n\tstatic int tt[N];\n\tint n, m, min, max, i, fmin, fmax, cnt;\n\n\tscanf(\"%d%d%d%d\", &n, &m, &min, &max);\n\tfor (i = 0; i < m; i++)\n\t\tscanf(\"%d\", &tt[i]);\n\tfmin = fmax = 0;\n\tcnt = 2;\n\tfor (i = 0; i < m; i++)\n\t\tif (!fmin && tt[i] == min)\n\t\t\tfmin = 1, cnt--;\n\t\telse if (!fmax && tt[i] == max)\n\t\t\tfmax = 1, cnt--;\n\tprintf(cnt <= n - m ? \"Correct\\n\" : \"Incorrect\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, min, max;\n int t[100];\n scanf(\"%d %d %d %d\", &n, &m, &min, &max);\n char haveMin = 0;\n char haveMax = 0;\n for(int i = 0; i < m; ++i) {\n scanf(\"%d\", &t[i]);\n if(t[i] == min) {\n haveMin = 1;\n }\n if(t[i] == max) {\n haveMax = 1;\n }\n }\n if(!haveMin) {\n ++m;\n }\n if(!haveMax) {\n ++m;\n }\n puts(m <= n ? \"Correct\" : \"Incorrect\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax <= max){\n printf(\"Correct\");\n }else if(minToBeAdded == 1 && testMin >= min){\n printf(\"Correct\");\n }else if(minToBeAdded == 2 && testMax <= max && testMin >= min){\n printf(\"Correct\");\n }else if(minToBeAdded == 0 || minToBeAdded == 1){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax >= max){\n printf(\"Incorrect\");\n }else if(minToBeAdded == 1 && testMin <= min){\n printf(\"Incorrect\");\n }else if(minToBeAdded == 2 && testMax >= max && testMin <= min){\n printf(\"Incorrect\");\n }else if(minToBeAdded == 0 || minToBeAdded == 1){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax < max){\n printf(\"Correct\");\n }else if(minToBeAdded == 1 && testMin > min){\n printf(\"Correct\");\n }else if(minToBeAdded == 2 && testMax < max && testMin > min){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 0;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input == min) minToBeAdded --;\n if(input == max) minToBeAdded --;\n }\n if(minToBeAdded <= toBeAdded) printf(\"Correct\");\n else printf(\"Incorrect\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax <= max){\n printf(\"Correct\");\n }else if(minToBeAdded == 1 && testMin >= min){\n printf(\"Correct\");\n }else if(minToBeAdded == 2 && testMax <= max && testMin >= min){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n int n;\n int m = 0;\n int min = 0;\n int max = 0;\n int testMin = 101;\n int testMax = 0;\n scanf(\"%d %d %d %d\",&n, &m, &min, & max);\n int toBeAdded = n - m;\n int minToBeAdded = 2;\n int *doorSeq = malloc(m * sizeof(int));\n for(int i = 0; i < m; i++){\n int input;\n scanf(\"%d\", &input);\n if(input > testMax) testMax = input;\n if(input < testMin) testMin = input;\n }\n if(testMax == max) minToBeAdded --;\n if(testMin == min) minToBeAdded --;\n if(minToBeAdded > toBeAdded) printf(\"Incorrect\");\n else{\n if(minToBeAdded == 1 && testMax <= max && min == testMin){\n printf(\"Correct\");\n }else if(minToBeAdded == 1 && testMin >= min && max == testMax){\n printf(\"Correct\");\n }else if(minToBeAdded == 2 && testMax <= max && testMin >= min){\n printf(\"Correct\");\n }else if(minToBeAdded == 0 || minToBeAdded == 1){\n printf(\"Correct\");\n }else{\n printf(\"Incorrect\");\n }\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0,min1=101,max1=-1;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n \t\tif(a[i]<min1)\n \t\tmin1=a[i];\n \t\tif(a[i]>max1)\n \t\tmax1=a[i];\n\t }\n\t int t=-1;\n\t int x=n-m;\n\t if(x>=2)\n\t printf(\"Correct\\n\");\n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1){\n\t \t\t\t\tprintf(\"Correct\\n\");break;\n\t\t\t }\n\t \t\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max){\n\t \t\t\t\n\t \t\t\tif(min<=min1){\n\t \t\t\t\tt++;printf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\t\n\t\t\t }\n\t \t\t\n\t \t\telse if(a[i]==min){\n\t \t\t\t\t\n\t \t\t\tif(max>=max1){\n\t \t\t\t\tt++;\tprintf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\n\t\t\t }\n\t \t\t\n\t \t\t\n\t\t \n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0,min1=101,max1=-1;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n \t\tif(a[i]<min1)\n \t\tmin1=a[i];\n \t\tif(a[i]>max1)\n \t\tmax1=a[i];\n\t }\n\t int t=-1;\n\t int x=n-m;\n\t if(x>=2)\n\t printf(\"Correct\\n\");\n\t else if(max1>max||min1<min)\n\t printf(\"Incorrect\\n\");\n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1){\n\t \t\t\t\tprintf(\"Correct\\n\");break;\n\t\t\t }\n\t \t\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max){\n\t \t\t\t\n\t \t\t\tif(min<=min1){\n\t \t\t\t\tt++;printf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\t\n\t\t\t }\n\t \t\t\n\t \t\telse if(a[i]==min){\n\t \t\t\t\t\n\t \t\t\tif(max>=max1){\n\t \t\t\t\tt++;\tprintf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\n\t\t\t }\n\t \t\t\n\t \t\t\n\t\t \n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n\t }\n\t int t=-1;\n\t int x=n-m;\n\t if(x>=2)\n\t printf(\"Correct\\n\");\n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1)\n\t \t\tprintf(\"Correct\\n\");\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\t\n\t\t if(t>-1){\n\t\t \tprintf(\"Correct\\n\");\n\t\t \tbreak;\n\t\t }\n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0,min1=101,max1=-1;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n \t\tif(a[i]<min1)\n \t\tmin1=a[i];\n \t\tif(a[i]>max1)\n \t\tmax1=a[i];\n\t }\n\t printf(\"%d\\n%d\\n\",min1,max1);\n\t int t=-1;\n\t int x=n-m; \n\t if(max1>max||min1<min)\n\t printf(\"Incorrect\\n\");\n\t else if(x>=2)\n\t printf(\"Correct\\n\");\n\t \n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1){\n\t \t\t\t\tprintf(\"Correct\\n\");break;\n\t\t\t }\n\t \t\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max){\n\t \t\t\t\n\t \t\t\tif(min<=min1){\n\t \t\t\t\tt++;printf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\t\n\t\t\t }\n\t \t\t\n\t \t\telse if(a[i]==min){\n\t \t\t\t\t\n\t \t\t\tif(max>=max1){\n\t \t\t\t\tt++;\tprintf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\n\t\t\t }\n\t \t\t\n\t \t\t\n\t\t \n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 110\nint a[N];\nint main(){\n int n,m,min,max;\n while(~scanf(\"%d%d%d%d\",&n,&m,&min,&max)){\n \t int i=0,min1=101,max1=-1;\n \t for(i;i<m;i++){\n \t\tscanf(\"%d\",&a[i]);\n \t\tif(a[i]<min1)\n \t\tmin1=a[i];\n \t\tif(a[i]>max1)\n \t\tmax1=a[i];\n\t }\n\t int t=-1;\n\t int x=n-m;\n\t if(x>=2||max1>max||min1<min)\n\t printf(\"Correct\\n\");\n\t else if(x==0)\n\t {\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max)\n\t \t\tt++;\n\t \t\tif(a[i]==min)\n\t \t\tt++;\n\t \t\tif(t==1){\n\t \t\t\t\tprintf(\"Correct\\n\");break;\n\t\t\t }\n\t \t\n\t \t}\n\t \tif(t!=1)\n\t \tprintf(\"Incorrect\\n\");\n\t }\n\t else if(x==1){\n\t \tfor(i=0;i<m;i++){\n\t \t\tif(a[i]==max){\n\t \t\t\t\n\t \t\t\tif(min<=min1){\n\t \t\t\t\tt++;printf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\t\n\t\t\t }\n\t \t\t\n\t \t\telse if(a[i]==min){\n\t \t\t\t\t\n\t \t\t\tif(max>=max1){\n\t \t\t\t\tt++;\tprintf(\"Correct\\n\");break;\n\t\t\t\t }\n\t \t\t\n\t\t\t }\n\t \t\t\n\t \t\t\n\t\t \n\t\t \n\t }\n\t if(t==-1)\n\t \tprintf(\"Incorrect\\n\");\n }\n \n}\n}"}], "src_uid": "99f9cdc85010bd89434f39b78f15b65e"} {"nl": {"description": "Limak is a little polar bear. He has n balls, the i-th ball has size ti.Limak wants to give one ball to each of his three friends. Giving gifts isn't easy\u00a0\u2014 there are two rules Limak must obey to make friends happy: No two friends can get balls of the same size. No two friends can get balls of sizes that differ by more than 2. For example, Limak can choose balls with sizes 4, 5 and 3, or balls with sizes 90, 91 and 92. But he can't choose balls with sizes 5, 5 and 6 (two friends would get balls of the same size), and he can't choose balls with sizes 30, 31 and 33 (because sizes 30 and 33 differ by more than 2).Your task is to check whether Limak can choose three balls that satisfy conditions above.", "input_spec": "The first line of the input contains one integer n (3\u2009\u2264\u2009n\u2009\u2264\u200950)\u00a0\u2014 the number of balls Limak has. The second line contains n integers t1,\u2009t2,\u2009...,\u2009tn (1\u2009\u2264\u2009ti\u2009\u2264\u20091000) where ti denotes the size of the i-th ball.", "output_spec": "Print \"YES\" (without quotes) if Limak can choose three balls of distinct sizes, such that any two of them differ by no more than 2. Otherwise, print \"NO\" (without quotes).", "sample_inputs": ["4\n18 55 16 17", "6\n40 41 43 44 44 44", "8\n5 972 3 4 1 4 970 971"], "sample_outputs": ["YES", "NO", "YES"], "notes": "NoteIn the first sample, there are 4 balls and Limak is able to choose three of them to satisfy the rules. He must must choose balls with sizes 18, 16 and 17.In the second sample, there is no way to give gifts to three friends without breaking the rules.In the third sample, there is even more than one way to choose balls: Choose balls with sizes 3, 4 and 5. Choose balls with sizes 972, 970, 971. "}, "positive_code": [{"source_code": "#include<stdio.h>\nint main ()\n{\n int a,b[50],i,j,temp,k,r=0,count,flag=1;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<a-1;i++)\n {\n for(j=0;j<a-1;j++)\n {\n if(b[j]>b[j+1])\n {\n temp=b[j];\n b[j]=b[j+1];\n b[j+1]=temp;\n }\n }\n }\n for(i=0;i<a-2;i++)\n {\n r=0;\n count=1;\n for(j=i+1;j<a;j++)\n {\n k=b[j]-b[i];\n if(k<=2&&k>0&&r!=k)\n {\n count++;\n r=k;\n }\n }\n if(count>=3)\n {\n printf(\"YES\");\n flag=0;\n break;\n }\n }\n if(flag==1)\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nstruct nodoLista{\n int dato;\n struct nodoLista * ptrSiguiente;\n};\n\ntypedef struct nodoLista NodoLista;\ntypedef NodoLista *ptrNodoLista;\n\nvoid insertar(ptrNodoLista *ptrS, int valor, int *tam);\nint main(){\n int n;\n scanf(\"%d\", &n);\n int array[n];\n int i, tamLista;\n tamLista = n;\n for( i = 0; i < n; i++ )\n scanf(\"%d\", &array[i]);\n\n ptrNodoLista ptrInicial = NULL;\n\n for( i = 0; i < n; i++)\n insertar(&ptrInicial, array[i], &tamLista);\n\n int resp = 0;\n\n if( tamLista >= 3 ){\n ptrNodoLista ptrAnterior, ptrCentro, ptrPosterior, temp;\n temp = ptrInicial;\n do{\n ptrAnterior = temp;\n ptrCentro = temp->ptrSiguiente;\n ptrPosterior = ptrCentro->ptrSiguiente;\n if( (ptrAnterior->dato + 1) == ptrCentro->dato )\n if( (ptrCentro->dato + 1) == ptrPosterior->dato ){\n resp = 1;\n break;\n }\n temp = ptrCentro;\n }while( ptrPosterior->ptrSiguiente != NULL );\n }/* end if */\n\n resp?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n\n}/* fin de main */\n\nvoid insertar(ptrNodoLista *ptrS, int valor, int *tam)\n{\n ptrNodoLista ptrNuevo;\n ptrNodoLista ptrAnterior;\n ptrNodoLista ptrActual;\n\n ptrNuevo = malloc(sizeof(NodoLista));\n\n if(ptrNuevo != NULL){\n ptrNuevo->dato = valor;\n ptrNuevo->ptrSiguiente = NULL;\n\n ptrAnterior = NULL;\n ptrActual = *ptrS;\n\n while( ptrActual != NULL && valor >= ptrActual->dato){\n ptrAnterior = ptrActual;\n ptrActual = ptrActual->ptrSiguiente;\n }/* fin de while */\n\n\n if(ptrAnterior == NULL){\n if(*ptrS == NULL || (*ptrS)->dato != valor){\n ptrNuevo->ptrSiguiente = *ptrS;\n *ptrS = ptrNuevo;\n }else{\n --(*tam);\n }\n }\n else{\n if( ptrAnterior->dato != ptrNuevo->dato ){\n ptrAnterior->ptrSiguiente = ptrNuevo;\n ptrNuevo->ptrSiguiente = ptrActual;\n }else{\n --(*tam);\n }\n }/* en de else */\n\n }/* fin de if */\n else{\n printf(\"No se inserto %c. No hay memoria disponible.\\n\", valor);\n }/* fin de else */\n\n}/* fin de la funci\u00f3n insertar */\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n\nint cmp( const void * a , const void *b ){\n\treturn ( *(int*)a - *(int*)b ); \n}\n\nint main(){\n\tint i,n,balls[100],new_n=0,ballz[100];\n\tbool flag=false;\n\tscanf(\" %d\",&n);\n\tfor ( i=0 ; i<n ; i++ ){\n\t\tscanf(\" %d\",&balls[i]);\n\t}\n\tqsort( balls , n , sizeof(int) , cmp );\n\tfor ( i=0 ; i<n ; i++ ){\n\t\tif ( i+1 < n && balls[i] != balls[i+1] ){\n\t\t\tballz[new_n] = balls[i];\n\t\t\tnew_n++;\n\t\t}\n\t}\n\tballz[new_n] = balls[n-1];\n\tnew_n++;\n\tfor ( i=0 ; i<new_n ; i++ ){\n\t\tif ( i+2 < new_n && ballz[i] + 1 == ballz[i+1] && ballz[i+1] + 1 == ballz[i+2] ){\n\t\t\tflag = true;\n\t\t}\n\t}\n\t/*printf(\"\\n\");\n\tfor ( i=0 ; i<new_n ; i++ ){\n\t\tprintf(\"%d\\t\",ballz[i]);\n\t}\n\tprintf(\"\\n\");\n\tfor ( i=0 ; i<n ; i++ ){\n\t\tprintf(\"%d\\t\",balls[i]);\n\t}*/\n\tif ( flag == true )\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMA\u00d1O ARREGLO\n\tint N;\n\tscanf (\"%d\", &N);\n\t//CARGAR ARREGLO\n\tint V[N];\n\tint cont;\n\tfor (cont = 0; cont < N; cont++){\n\t\tscanf (\"%d\", &V[cont]);\n\t}\n\t//ORDENAR ARREGLO\n\tquick(V, 0, N-1);\n\t//BUSCAR MENOR\n\tchar *R[2] = {\"YES\", \"NO\"};\n\tint a, cont2;\n\ta=1;\n\tfor (cont = 0; cont < N-2; cont++){\n\t\tif( (V[cont+1]-V[cont]) == 1){\n\t\t\tfor (cont2 = cont+2; cont2 < N; cont2++){\n\t\t\t\tif ((V[cont2]-V[cont+1]) == 1){\n\t\t\t\t\ta = 0;\n\t\t\t\t\tcont2 = N;\n\t\t\t\t\tcont = N;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf (\"%s\", R[a]);\n\n\treturn 0;\n}\nvoid swap (int *v, int i, int j){\n\tint aux;\n\t\n\taux = *(v+i);\n\t*(v+i) = *(v+j);\n\t*(v+j) = aux;\n}\nint pivot(int *v, int izq, int der){\n\tint i, pivote, valor_pivote;\n\t\n\tpivote = izq;\n\tvalor_pivote = *(v+pivote);\n\tfor(i = izq+1; i <=der; i++){\n\t\tif (*(v+i) < valor_pivote){\n\t\t\tpivote++;\n\t\t\tswap(v, i, pivote);\n\t\t}\n\t}\n\tswap(v, izq, pivote);\n\t\n\treturn pivote;\n}\nvoid quick (int *v, int ini, int fin){\n\tint pivote;\n\tif(ini < fin){\n\t\tpivote = pivot(v, ini, fin);\n\t\tquick(v, ini, pivote-1);\n\t\tquick(v, pivote+1, fin);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, i, j, z, a[100];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", a + i);\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tif (a[j] == a[i] + 1) {\n\t\t\t\tfor (z = 0; z < n; z++) {\n\t\t\t\t\tif (a[z] == a[i] + 2 || a[z] == a[i] - 1) {\n\t\t\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a[j] == a[i] - 1) {\n\t\t\t\tfor (z = 0; z < n ; z++) {\n\t\t\t\t\tif (a[z] == a[i] - 2 || a[z] == a[i] + 1) {\n\t\t\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdbool.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],i,b[1001];\n memset(b,0,1001*sizeof(int));\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[a[i]]=1;\n }\n int k=0,c[n];\n for(i=0;i<1001;i++)\n if(b[i]==1)\n c[k++]=i;\n for(i=0;i<k-2;i++)\n {\n if(c[i+1]-c[i]==1&&c[i+2]-c[i+1]==1)\n break;\n }\n if(i<k-2)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cnt[2000];\n\nint main()\n{\n int n, x;\n scanf(\"%d\", &n);\n while (n--){\n scanf(\"%d\", &x);\n cnt[x]++;\n if (((cnt[x - 1]) && (cnt[x - 2])) ||\n ((cnt[x + 1]) && (cnt[x + 2])) ||\n ((cnt[x - 1]) && (cnt[x + 1]))) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cnt[2000];\n\nint main()\n{\n int n, x;\n scanf(\"%d\", &n);\n while (n--){\n scanf(\"%d\", &x);\n cnt[x]++;\n if (((cnt[x - 1]) && (cnt[x - 2])) ||\n ((cnt[x + 1]) && (cnt[x + 2])) ||\n ((cnt[x - 1]) && (cnt[x + 1]))) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define T 1001\nint main() {\n\t//\u56e0\u4e3ati\u7684\u503c\u6700\u5927\u662f1000\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u7528exist\u65b9\u6cd5\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i<T;i++){\n\t\texist[i]=0;\n\t}\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\texist[t]=1;\n\t}\n\tint count=0;\n\tfor(i=1;i<T;i++){\n\t\tif(exist[i]){\n\t\t\tcount++;\n\t\t\tif(count>=3){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}else{\n\t\t\tcount=0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n //este problema trata sobre un oso que posee n pelotas y quiere regalar 3 de ellas\n //a sus amigos, pero solo puede regalar 3 pelotas cuyos tama\ufffdos sean x-1,x y x+1\n int n=0; //n es la cantidad de pelotas que posee el oso\n int i,j;\n int b1=-1; //b1 y b2 son dos banderas\n int b2=0;\n scanf(\"%d\",&n); //pedimos al usuario que ingrese la cantidad de pelotas\n int v[n]; //declaramos un vector donde se guardaran los tama\ufffdos de las n pelotas\n for(i=0; i<n; i++){\n scanf(\"%d\",&v[i]); //Insertamos en el vector el tama\ufffdo de cada pelota\n }\n for(i=0; i<n; i++){\n b1=-1; //inicializamos las banderas al comienzo de cada ciclo con nros negativos diferentes\n b2=-2; //\n for(j=0; j<n; j++){ //en este for anidado comparamos el resto del vector con el elemento v[i]\n if(v[i]==(v[j]+1)) { // si encontramos una pelota con un tama\ufffdo mayor en 1 unidad al tama\ufffdo de la pelota v[i]\n b1=i; //cargamos en b1 el indice de dicha pelota\n }\n if(v[i]==(v[j]-1)){ // si encontramos una pelota con un tama\ufffdo menor en 1 unidad al tama\ufffdo de la pelota v[i]\n b2=i; //cargamos en b1 el indice de dicha pelota\n }\n }\n if(b2 ==i && b1==i){ //Si ambas banderas son iguales al indice actual significa que se encontraron dos tama\ufffdos\n break; // x+1 y x-1 en relacion a v[i], entonces salimos del ciclo con break\n }\n }\n if(b1==b2 && b2==i){ //este if controla si se consigui\ufffd encontrar las dos pelotas que cumplan la condicion anterior\n printf(\"YES\"); //de ser asi imprime YES, se encontraron 3 pelotas de tama\ufffdos x, x+1 y x-1\n }else{\n printf(\"NO\"); //caso contrario imprime NO, mostrando que no se encontraron las pelotas de tama\ufffdos\n } //buscados\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,i,j,k,m=0;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;i<n;i++){\nscanf(\"%d\",&a[i]);}\nfor(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]>a[j]){int t=a[i];\n a[i]=a[j];\n a[j]=t; }\n}}\nfor(i=0;i<n;i++){\n for(j=0;j<n;j++){\n for(k=0;k<n;k++){\n\n\n if(a[i]+1==a[j]&&a[j]+1==a[k]){m++;}\n }\n }}\nif(m>0){printf(\"YES\");}\nelse{printf(\"NO\");}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int n, i;\n int flag[1010];\n memset(flag,0,sizeof(flag));\n int x;\n while(~scanf(\"%d\",&n))\n {\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x);\n flag[x]=1;\n }\n for(i=0;i<1010;i++)\n {\n if(flag[i]==1&&flag[i+1]==1&&flag[i+2]==1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,t,i,c,j,a[55];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n-2;i++)\n {\n t=0;\n for(j=i+1;j<n;j++)\n {\n if(a[i]!=a[j]&&abs(a[i]-a[j])<=2)\n {\n if(t==0)\n {\n c=a[j];\n t++;\n }\n else\n {\n if(a[j]!=c && abs(a[j]-c)<=2)\n {t++;\n break;}\n }\n\n }\n\n }\n if(t==2)\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==n-2)\n printf(\"NO\");\n}"}, {"source_code": "/*\n Bear and three balls\n Autor: francisco.bogado\n Fecha: 19-05-2018\n*/\n\n#include<stdio.h>\n#include<stdlib.h> //se importa porque se usara la funcion qsort de esta libreria\n\n\n//prototipos de funciones\nshort int repartirBolas(int * vector , const int dim);\nint cmpfunc (const void * a, const void * b);\nvoid cargarVector(const int dim, int vector[dim]);\nvoid input(int * k);\n\n//funcion principal\nint main(){\n\tint k,i;\n\t\n\tinput(&k);\n\tint bolas[k];\n\tcargarVector(k, bolas);\n\tqsort(bolas, k, sizeof(int), cmpfunc);//funcion que ordena el vector\n printf(\"%s\", repartirBolas(bolas,k)?\"YES\":\"NO\");\n\treturn 0;\n}\n\n//funcion de comparacion que utiliza el qsort\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\n//se encarga de la carga de los elementos del vector\nvoid cargarVector(const int dim, int vector[dim]){\n int i;\n for(i=0;i<dim;i++){\n scanf(\"%d\",&vector[i]);\n }\n}\n\n//se encarga de leer la cantidad de bolas\nvoid input(int * k){\n do{\n scanf(\"%d\", k);\n }while(*k > 50 || *k < 3);\n}\n\n//funcion que verifica que las bolas no sean repetidas ni esten separadas por mas de dos lugares\nshort int repartirBolas(int *v , const int dim ){\n\tint i,j,c=0;\n\tint retorna = 0;\n\tfor( i = 0 ; i < dim - 2; i ++ ){//ciclo que se encarga de recorrer el array buscando las bolas\n\t\tfor (j = i + 1; j < dim; j ++){//ciclo auxiliar para el control de bolas de igual tamanho\n\t\t\tif(v[i] + 1 == v[j]){//checquea que el numero en la posicion siguiente seaa un inmediato superior\n\t\t\t\ti=j;//desplaza el indice para ignorar el numero y continuar con la busqueda\n\t\t\t\tc++;//se utiliza para controlar la cantidad de bolas ya encontradas\n\t\t\t}\n\t\t\t/*estructura selectiva que controla si el nuevo numero encontrado es el tercero en una sucesion\n\t\t\tsi es asi retorna el caso de exito y finaliza los ciclos.*/\n\t\t\tif(c==2){\n\t\t\t\tretorna = 1;\n\t\t\t\tj = dim;\n\t\t\t\ti = dim;\n\t\t\t}\n\t\t\t/*en caso de que la busqueda no sea exitosa inicializa el contador y mueve el indice de busqueda \n\t\t\tal valor mayor encontrado para continuar. Descarta parte del array donde no se pueden encontrar las\n\t\t\ttres bolas sucesivas*/\n\t\t\tif(v[j]>v[i]+1){\n\t\t\t\tc=0;\n\t\t\t\ti=j-1;\n\t\t\t\tj=dim;\n\t\t\t}\n\t\t}\n\t}\n\treturn retorna;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n#include<ctype.h>\n\n#define MAX( a, b ) ( ( a > b) ? a : b ) \n#define MIN( a, b ) ( ( a < b) ? a : b )\n#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)\n\n\nint x=0,n=0,s=0,i,j,a[10000],c[10000];\nint main () {\n\n\tscanf(\"%d\",&n);\n\tFOR(i,0,n){\n\t\tscanf(\"%d\",&a[i]);\n\t\tc[a[i]]++;}\n\tFOR(i,0,10000)\n\t\tif(c[i-1]&&c[i]&&c[i+1]){\n\t\t\t\tprintf(\"YES\");return 0;}\n\tprintf(\"NO\");\n\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n;\nint arr[55];\n\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(register int i=1;i<=n;i++) scanf(\"%d\",&arr[i]);\n\tfor(register int i=1;i<=n;i++){\n\t\tfor(register int j=1;j<=n;j++){\n\t\t\tfor(register int k=1;k<=n;k++){\n\t\t\t\tif(arr[k]==arr[j]+1 && arr[j]==arr[i]+1){\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\tint n,k,a[1001]={0},f=0,i;\n\tscanf(\"%d\", &n);\n\twhile(n>0)\n\t{\n\t\tscanf(\"%d\", &k);\n\t\ta[k]++;\n\t\tn--;\n\t}\n\tfor(i=0;i<999;i++)\n\t{\n\t\tif(a[i]>0&&a[i+1]>0&&a[i+2]>0)\n\t\t {\n\t\t \tf=1;\n\t\t \tbreak;\n\t\t }\n\t}\n\tif(f==1)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n#include<ctype.h>\n\n#define MAX( a, b ) ( ( a > b) ? a : b ) \n#define MIN( a, b ) ( ( a < b) ? a : b )\n#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)\n\n\nint x=0,n=0,s=0,i,j,a[10000],c[10000];\nint main () {\n\n\tscanf(\"%d\",&n);\n\tFOR(i,0,n){\n\t\tscanf(\"%d\",&a[i]);\n\t\tc[a[i]]++;}\n\tFOR(i,0,10000)\n\t\tif(c[i-1]&&c[i]&&c[i+1]){\n\t\t\t\tprintf(\"YES\");return 0;}\n\tprintf(\"NO\");\n\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#define pi 3.1415926\n#define rep(x,ini,end) for(x=(ini);x<(end);x++)\n#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)\n#define max(x,y) ((x)>(y)?(x):(y))\n#define min(x,y) ((x)<(y)?(x):(y))\n\n\nint t[100] = {0};\n\n\nvoid quickSort(int a[], int beginPos, int endPos)\n{\n int i = beginPos, j = endPos;\n int flag = a[beginPos];\n //int bePos_L, bePos_R, endPos_L, endPos_R;\n //int countL = 0, countR = 0;\n if (beginPos>=endPos)\n {\n return;\n }\n\n while (i<j)\n {\n while ((a[j]>flag) && (i<j))\n {\n --j;\n }\n if (i == j)\n {\n break;\n }\n\n a[i] = a[j]; a[j] = flag;\n ++i;\n\n while ((a[i]<flag) && (i<j))\n {\n ++i;\n }\n if (i == j)\n {\n break;\n }\n\n a[j] = a[i]; a[i] = flag;\n --j;\n }\n\n quickSort(a, beginPos, i-1);\n quickSort(a, i+1, endPos);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i;\n rep(i,0,n)\n {\n scanf(\"%d\", &t[i]);\n }\n quickSort(t, 0, n-1);\n\n int count = 1;\n int flag = t[0];\n\n rep(i,1,n)\n {\n if ((t[i]!=flag) && (t[i]-flag<2))\n {\n count++; flag = t[i];\n if (count == 3)\n {\n printf(\"YES\"); return 0;\n }\n continue;\n }\n if (t[i]-flag>=2)\n {\n count = 1; flag = t[i];\n }\n }\n if (count == 3)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\tint n,k,a[1001]={0},f=0,i;\n\tscanf(\"%d\", &n);\n\twhile(n>0)\n\t{\n\t\tscanf(\"%d\", &k);\n\t\ta[k]++;\n\t\tn--;\n\t}\n\tfor(i=0;i<999;i++)\n\t{\n\t\tif(a[i]>0&&a[i+1]>0&&a[i+2]>0)\n\t\t {\n\t\t \tf=1;\n\t\t \tbreak;\n\t\t }\n\t}\n\tif(f==1)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nvoid quicksort(int arr[], int first, int last)\n{\n int i = first, j = last, pivot;\n pivot = arr[(first + last)/2];\n do\n {\n while (arr[i] < pivot){\n i++;\n }\n while(arr[j] > pivot){\n j--;\n }\n \n if(i <= j)\n {\n int temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n i++;\n j--;\n }\n }while(i <= j);\n if(first < j) quicksort(arr, first, j);\n if(last > i) quicksort(arr, i, last);\n}\n\nint main(void)\n{\n int n, num1, num2, num3, j;\n scanf(\"%d\", &n);\n int array[n];\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &array[i]);\n }\n quicksort(array, 0, n-1);\n for(int i = 0; i < n; i++)\n {\n num1 = array[i];\n for(j = i + 1; j < n && array[j] == array[i]; j++);\n if(j < n)\n {\n num2 = array[j];\n if(num1 + 1 == num2)\n {\n for(j = j + 1; j < n && array[j] == num2; j++);\n if(j < n)\n {\n num3 = array[j];\n if(num3 - 2 == num1)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n //printf(\"%d %d %d\\n\", num1, num2, num3);\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\nscanf(\"%d\",&n);\n\n int a[n];\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&a[i]);\n }\n int j;\n int swap;\n for (i = 0 ; i < ( n - 1 ); i++)\n {\n for (j = 0 ; j < n - i - 1; j++)\n {\n if (a[j] > a[j+1]) {\n swap=a[j];\n a[j] = a[j+1];\n a[j+1]=swap;\n }\n }\n }\n int y=0;\n int x=1;\n int temp=a[0];\n for(i=1;i<n;i++)\n {\n int m=a[i]-temp;\n if(m==0)\n {\n temp=a[i];\n }\n else if(m==1)\n {\n x++;\n temp=a[i];\n }\n else\n {\n x=1;\n temp=a[i];\n }\n if(x==3)\n {\n printf(\"YES\\n\");\n y=1;\n break;\n }\n }\n if(y==0)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,a[55],j,s,check=0,k; //s=sort\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n for(j=i+1;j<n;){\n if(a[j]==a[i]){\n for(k=j;k<n;k++){\n a[k]=a[k+1];\n }\n n--;\n }\n else\n j++;\n }\n }\n /*for(i=0;i<n;i++){\n printf(\"%d \",a[i]);\n }*/\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]>a[j]){\n s=a[i];\n a[i]=a[j];\n a[j]=s;\n }\n }\n }\n for(i=0;i<n;i++){\n //printf(\"%d \",a[i]);\n if(((a[i+1]-a[i])==1)&&((a[i+2]-a[i+1])==1)){\n check=1;\n }\n /*else{\n check=0;\n }*/\n }\n if(check==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid q_sort(int *a, int left, int right)\n{\n int i, j, k, t;\n if (left < right) {\n i = k = left;\n j = right + 1;\n while (1) {\n while (a[++i] < a[k]);\n while (a[--j] > a[k]);\n if (i >= j) break;\n t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n t = a[k];\n a[k] = a[j];\n a[j] = t;\n q_sort(a, left, j-1);\n q_sort(a, j+1, right);\n }\n}\n\nint visit(int *a, int i, int j)\n{\n if (j>1 && (a[i] + 1) == a[i+1]) {\n //printf(\"%d -> %d\\n\", a[i], a[i+1]);\n return visit(a, i+1, j-1);\n } else if (j>1 && (a[i]) == a[i+1]) {\n return visit(a, i+1, j);\n }\n if (j == 1) return 1;\n return 0;\n}\nint main(void)\n{\n int a[1000];\n int n;\n int i, j;\n \n memset(a, 0, sizeof(a));\n\n scanf(\"%d\", &n);\n for (i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n\n i = 0;\n q_sort(a, i, n-1);\n\n#if 0\n for (i=0; i<n; i++)\n printf(\"%d \", a[i]);\n printf(\"\\n\");\n#endif\n\n for (i=0; i<(n-2); i++) {\n j = visit(a, i, 3);\n if (j) {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k = 0, temp, flag = 0; // The number of balls limak can have\n scanf(\"%d\", &n);\n int t[n], i, j;\n for(i = 1; i <= n; i++)\n scanf(\"%d\", &t[i]);\n for(i = 1; i <=n-1; i++) {\n for(j = i + 1; j <= n; j++) {\n if(t[j] < t[i]) {\n temp = t[i];\n t[i] = t[j];\n t[j] = temp;\n }\n }\n }\n \n for(i = 1; i <= n - 2; i++) {\n j = i + 1;\n if(t[i] == t[j] && t[j] == t[j + 1] && t[i] == t[j + 1] || t[i] == t[j]) {\n continue;\n }\n if(t[j] == t[j + 1]) {\n k = j + 1;\n if (k == n)\n break;\n while(t[k] == t[j]) {\n j = k;\n k++;\n }\n }\n if( (abs(t[i] - t[j]) <= 2) && (abs(t[i] - t[j + 1]) <= 2) && (abs(t[j] - t[j+1]) <= 2) ) {\n flag = 1;\n printf(\"YES\");\n break;\n }\n }\n if(flag == 0)\n printf(\"NO\");\n\n}"}, {"source_code": "#include <stdio.h>\n\nvoid ordenar (int a[],int primero,int ultimo){\n int i,j,central;\n double pivote;\n central = (primero+ultimo)/2;\n pivote = a[central];\n i=primero;\n j=ultimo;\n do\n {\n while (a[i]<pivote) i++;\n while (a[j]>pivote) j--;\n if (i<=j)\n {\n int aux;\n aux= a[i];\n a[i]=a[j];\n a[j]=aux;\n i++;\n j--;\n }\n } while (i<=j);\n if (primero<j)\n {\n ordenar (a,primero,j);\n }\n if (i< ultimo)\n {\n ordenar (a,i,ultimo);\n }\n}\n\nint main()\n{\n int n;\n int i;\n int j;\n int k;\n\n int BAN=0;\n scanf(\"%d\",&n);\n int size[n];\n\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&size[i]);\n }\n\n ordenar(size,0,n-1);\n\n for (i=0;i<n-2;i++)\n {\n for (j=i+1;j<n-1;j++)\n {\n for (k=j+1;k<n;k++)\n {\n if (size[i]+1==size[j] && size[j]+1==size[k])\n {\n BAN=1;\n j=n;\n i=n;\n k=n;\n }\n }\n }\n }\n if (BAN==1)\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nstruct nodoLista{\n int dato;\n struct nodoLista * ptrSiguiente;\n};\n\ntypedef struct nodoLista NodoLista;\ntypedef NodoLista *ptrNodoLista;\n\nvoid insertar(ptrNodoLista *ptrS, int valor, int *tam);\nint main(){\n int n;\n scanf(\"%d\", &n);\n int array[n];\n int i, tamLista;\n tamLista = n;\n for( i = 0; i < n; i++ )\n scanf(\"%d\", &array[i]);\n\n ptrNodoLista ptrInicial = NULL;\n\n for( i = 0; i < n; i++)\n insertar(&ptrInicial, array[i], &tamLista);\n\n int resp = 0;\n\n if( tamLista >= 3 ){\n ptrNodoLista ptrAnterior, ptrCentro, ptrPosterior, temp;\n temp = ptrInicial;\n do{\n ptrAnterior = temp;\n ptrCentro = temp->ptrSiguiente;\n ptrPosterior = ptrCentro->ptrSiguiente;\n if( (ptrAnterior->dato + 1) == ptrCentro->dato )\n if( (ptrCentro->dato + 1) == ptrPosterior->dato ){\n resp = 1;\n break;\n }\n temp = ptrCentro;\n }while( ptrPosterior->ptrSiguiente != NULL );\n }/* end if */\n\n resp?printf(\"YES\"):printf(\"NO\");\n\n return 0;\n\n}/* fin de main */\n\nvoid insertar(ptrNodoLista *ptrS, int valor, int *tam)\n{\n ptrNodoLista ptrNuevo;\n ptrNodoLista ptrAnterior;\n ptrNodoLista ptrActual;\n\n ptrNuevo = malloc(sizeof(NodoLista));\n\n if(ptrNuevo != NULL){\n ptrNuevo->dato = valor;\n ptrNuevo->ptrSiguiente = NULL;\n\n ptrAnterior = NULL;\n ptrActual = *ptrS;\n\n while( ptrActual != NULL && valor >= ptrActual->dato){\n ptrAnterior = ptrActual;\n ptrActual = ptrActual->ptrSiguiente;\n }/* fin de while */\n\n\n if(ptrAnterior == NULL){\n if(*ptrS == NULL || (*ptrS)->dato != valor){\n ptrNuevo->ptrSiguiente = *ptrS;\n *ptrS = ptrNuevo;\n }else{\n --(*tam);\n }\n }\n else{\n if( ptrAnterior->dato != ptrNuevo->dato ){\n ptrAnterior->ptrSiguiente = ptrNuevo;\n ptrNuevo->ptrSiguiente = ptrActual;\n }else{\n --(*tam);\n }\n }/* en de else */\n\n }/* fin de if */\n else{\n printf(\"No se inserto %c. No hay memoria disponible.\\n\", valor);\n }/* fin de else */\n\n}/* fin de la funci\u00f3n insertar */\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,t,count,a[1001];\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n for(i=1;i<n;i++)\n {\n for(j=1;j<=n-i;j++)\n {\n if(a[j]>a[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n }\n count=1;\n for(i=1;i<n;i++)\n {\n if(a[i]==a[i+1])\n continue;\n if(a[i]+1==a[i+1])\n count++;\n else\n count=1;\n if(count==3)\n {\n break;\n }\n }\n if(count==3)\n printf(\"YES\\n\");\n else\n printf(\"NO\");\n return 0;\n}\n "}, {"source_code": "//problema6\n#include <stdio.h>\n\nint main(){\n int n,i,k,j,b=0;\n\n scanf(\"%d\",&n);//se ingresan los datos\n\n int v[n];\n\n for (i=0; i<n; i++)\n {\n scanf(\"%d\",&v[i]);\n }\n for(i=0;i<n;i++){//comprobamos si los tama\ufffdos de las bolas cumplen lo que pide el problema\n for(j=0;j<n;j++){\n for(k=0;k<n;k++){\n if(v[i]==v[j]+1){\n if(v[i]==v[k]+2){\n b=1;\n break;\n }\n }\n }\n }\n }\n if(b)\n printf(\"YES\");//si cumple\n else\n printf(\"NO\");//no cumple\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, i, a[10005], h[10005];\n\nint main () {\n\tscanf(\"%d\",&n);\n\tfor(i = 1; i <= n ; i++){\n\t\tscanf(\"%d\",&a[i]);\n\t\th[a[i]]++;\n\t}\n\tfor(i = 1; i < 5000 ; i++)\n\t\tif(h[i-1]&&h[i]&&h[i+1]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n#include<time.h>\n\n#define SORT while(t--){for(i=0;i<x-1;i++)if(arr[i]>arr[i+1]){o=arr[i];arr[i]=arr[i+1];arr[i+1]=o;}}\n#define R return 0;\n#define and &&\n#define or ||\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\nmain(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i<x;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\th[arr[i]]++;\n\t}\n\tfor(i=0;i<10000;i++){\n\t\tif(h[i] and h[i+1] and h[i+2]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,c[100],i,j,t,b[100] ;\n scanf(\"%d\",&n);\n for(j=0; j<n ; j++)\n {\n scanf(\"%d\",&c[j]);\n }\n for(i=1; i<=n ; i++)\n {\n for(j=0; j<=n-1-i ; j++)\n {\n if(c[j]>c[j+1])\n {\n\n t=c[j];\n c[j]=c[j+1];\n c[j+1]=t;\n }\n }\n }\n j=0;\n for(i=0 ; i<n ; i++)\n {\n if(c[i]!=c[i+1])\n {\n b[j]=c[i];\n j++;\n }\n }\n for(i=0 ; i<j ; i++)\n {\n if(b[i]+2==b[i+2]&&b[i]+1==b[i+1])\n {\n n=1;\n break;\n }\n }\n if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint n,flag,a,b,c,i;\n\tflag=0;\n\tscanf(\"%d\",&n);\n\tint v[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&v[i]);\n\t}\n\tfor(a=0;a<n;a++)\n\t{\n\t\tfor(b=0;b<n;b++)\n\t\t{\n\t\t\tfor(c=0;c<n;c++)\n\t\t\t{\n\t\t\t\tif((v[a]!=v[b]) && (v[b]!=v[c]) && (v[a]!=v[c]))\n\t\t\t\t{\n\t\t\t\t\tif((abs(v[a]-v[b])<=2) && (abs(v[b]-v[c])<=2) && (abs(v[a]-v[c])<=2))\n\t\t\t\t\t{\n\t\t\t\t\t\ta=b=c=n;\n\t\t\t\t\t\tflag=1;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==0)\n\t{\n\t\tprintf(\"NO\");\n\t}else\n\t\tprintf(\"YES\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid quicksort(int [], int, int);\nint main(){\n int i,j,k,n;\n scanf(\"%d\",&n);\n int ball[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&ball[i]);\n }\n quicksort(ball,0,n-1);\n i=0;\n j=1;\n\tk=2;\n while(i<n-2){\n\t//Mientras i no ocupe el antepenultimo lugar\n while(ball[i]==ball[j]){\n \t//Busca una posicion j tal que ball[j]!=ball[i]\n j++;\n if(j==n-1){\n \t//Si llega al ultimo lugar del vector significa que no hay una terna de numeros que cumpla la condicion \n printf(\"NO\");\n return 0;\n }\n }\n \n if(ball[j]-ball[i]<=2){\n \t//Si la diferencia en tama\u00f1o de las pelotas es menor o igual a dos se realiza la busqueda del tercero para esos valores de i,j\n k=j+1;\n \n while(ball[j]==ball[k]){\n //Se incrementa k hasta encontrar ball[k]!=ball[j]\n\t\t\t\tk++;\n if(k==n){\n \t//Si llega al final, no encontro una terna de numeros que cumpla la condicion\n printf(\"NO\");\n return 0;\n }\n }\n if(ball[k]-ball[j]<=2 && ball[k]-ball[i]<=2){\n \t//Si encontro un valor de k y cumple la condicion del tama\u00f1o se encontro la solucion al problema y termina el programa\n printf(\"YES\");\n return 0;\n }\n\n }\n \t\n i=j;\n /*j=k;\n while(ball[j]==ball[k]){\n k++;\n if(k==n){\n printf(\"NO\");\n return 0;\n }\n }*/\n }\n printf(\"NO\");\n return 0;\n}\nvoid quicksort(int A[], int ini, int fin){\n int central = (ini + fin)/2;\n int pivote = A[central];\n int i=ini,j=fin,aux;\n do{\n while(A[i]<pivote) i++;\n while(A[j]>pivote) j--;\n if(i<=j){\n aux = A[i];\n A[i]=A[j];\n A[j]=aux;\n i++;\n j--;\n }\n }\n while(i<=j);\n if(ini<j){\n quicksort(A,ini,j);\n }\n if(fin>i){\n quicksort(A,i,fin);\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main()\n{\n\tint N;\n\tscanf(\"%d\",&N);\n\n\tint V[N];\n\n\tint I,J;\n\t \n\tfor (I=0;I<N;I++)\n\t{\t\n\t\tscanf(\"%d\",&V[I]);\t\n\t}\n\tint ban,auxx;\n\t\n\tint cont;\n\tfor( I=0;I<N;I++)//ordenar\n\t{\n\t\tfor(J=0;J<N-1-I;J++)\n\t\t{\n\t\t\tif (V[J]>V[J+1])\n\t\t\t{\n\t\t\t\tauxx = V[J];\n\t\t\t\tV[J] = V[J+1] ;\n\t\t\t\tV[J+1] = auxx;\n\t\t\t}\n\t\t}\t\n\t}\n\tint first=V[1];\n\tcont=1;\t\n\t\n\t//for( I=0; I<N && cont<3 ;I++){printf(\"%d,\",V[I]);}\n\t\n\tcont=1;\n\tint aux[3];\n\tfor( I=0; I<N-2 && cont<3 ;I++)\n\t{\n\t\taux[0]=V[I];\n\t\tcont=1;\n\t\tfor (J=I;J<N && cont<3 ;J++)\n\t\t{\n\t\t\tif(V[J]-aux[0]<=2 && V[J]!=aux[cont-1])\n\t\t\t{\n\t\t\t\taux[cont]=V[J];\n\t\t\t\tcont++;\n\t\t\t}\n\t\t\telse if (V[J]-aux[0]>2)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif (cont!=3)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n\t//for( I=0; I<3 ;I++){printf(\"%d,\",aux[I]);}\n\t//printf(\"cont:%d\\n\",cont);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n=0;\n int i,j;\n int c1=-1;\n int c2=0;\n scanf(\"%d\",&n);\n int v[n];\n for(i=0; i<n; i++){\n scanf(\"%d\",&v[i]);\n }\n for(i=0; i<n; i++){\n c1=-1;\n c2=-2;\n for(j=0; j<n; j++){\n if(v[i]==(v[j]+1)) {\n c1=i;\n }\n if(v[i]==(v[j]-1)){\n c2=i;\n }\n }\n if(c2 ==i && c1==i){\n break;\n }\n }\n if(c1==c2 && c2==i){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "\n #include <stdio.h>\n#include <stdlib.h>\n\nint asc(const void *p, const void *q);\n\nint main()\n{\n int n,i,bandera=0;\n\n scanf(\"%d\", &n);\n int bolas[n];\n //cargamos los tamanios de las bolas\n for(i=0; i<n; ++i)\n scanf(\"%d\", &bolas[i]);\n //ordenamos\n qsort(bolas, n, sizeof(int), &asc);\n //quitmos los duplicados\n int b=0;\n bolas[b]=bolas[0];\n for(int i=0;i<n;i++)\n {\n if (bolas[b]!=bolas[i])\n {\n b++;\n bolas[b]=bolas[i];\n }\n }\n n = b+1;\n puts(\"\");\n for(i=0; i<n-2; ++i)\n {\n // si hay diferencia de 1 entre el primer elemento en comparacion y el utimo\n // cumple condicion; ademas deben ser distintos\n if(( bolas[i+2] != bolas[i] ) && (( bolas[i+2] - bolas[i]) <= 2 ))\n {\n bandera=1;\n //printf(\"%d %d %d\\n\",bolas[i],bolas[i+1],bolas[i+2]);\n }\n }\n printf(\"%s\", bandera? \"YES\": \"NO\");\n return 0;\n}\n\n//funcion de comparacion\nint asc(const void *p, const void *q) {\n int x = *(const int *)p;\n int y = *(const int *)q;\n if (x < y)\n return -1;\n else if (x > y)\n return 1;\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,x1=0,x2=0,c=0,temp;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ar[i]>ar[j])\n {\n temp=ar[i];\n ar[i]=ar[j];\n ar[j]=temp;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n //x=ar[i];\n for(j=i+1;j<n;j++)\n {\n if(ar[j]-ar[i]==1)\n x1=1;\n if(ar[j]-ar[i]==2)\n x2=1;\n }\n if(x1==1 && x2==1)\n {\n printf(\"YES\");\n return 0;\n }\n x1=0;x2=0;\n }\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n,I,J,aux,cont=0,R=0;\n\tscanf(\"%d\", &n);\n\tint t[n];\n\tfor(I=0;I<n;I++){\n\t\tscanf(\"%d\", &t[I]);\n\t}\n\tfor(I=0;I<n;I++){\n\t\tfor(J=0;J<n-1;J++){\n\t\t\tif(t[J]>t[J+1]){\n\t\t\t\taux=t[J];\n\t\t\t\tt[J]=t[J+1];\n\t\t\t\tt[J+1]=aux;\n\t\t\t}\n\t\t}\n\t}\n\t/*for(I=0;I<n;I++){\n\t\tprintf(\"%d\", t[I]);\n\t}*/\n\tfor(I=0;I<n;I++){\n\t\tif(t[I+1]==t[I]+1){\n\t\t\tcont++;\n\t\t}\n\t\telse if(t[I+1]!=t[I]){\n\t\t\tcont=0;\n\t\t}\n\t\tif(cont>=2){\n\t\t\tR=1;\n\t\t}\n\t}\n\tif(R==1){\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\nint main () {\n\tint n,i,bd=1,j;\n\tscanf(\"%d\",&n);\n \tint v[n];\n\tfor( i = 0 ; i < n; i++ ) {\n\t\tscanf(\"%d\",&v[i]);\n\t}\n\tqsort(v, n, sizeof(int), cmpfunc);\n\tfor (i = 0; i < n - 2; i++){\n for (j = i + 1; j < n - 1; j++){\n if(v[i] + 1==v[j] && v[i] + 2==v[j+1]){\n bd=0;\n }\n }\n\t}\n\tif(bd==0){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,i,x=0,j,k;\n scanf (\"%d\",&n);\n int A[n];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for (i=0; i<n; i++)\n {\n for(j=0; j<n; j++)\n {\n for (k=0; k<n; k++)\n {\n if((A[i]+1)==A[j]&&(A[j]+1)==A[k])\n x++;\n }\n }\n }\n\n if(x>=1)\n printf(\"YES\");\n else printf(\"NO\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n //este problema trata sobre un oso que posee n pelotas y quiere regalar 3 de ellas\n //a sus amigos, pero solo puede regalar 3 pelotas cuyos tama\ufffdos sean x-1,x y x+1\n int n=0; //n es la cantidad de pelotas que posee el oso\n int i,j;\n int b1=-1; //b1 y b2 son dos banderas\n int b2=0;\n scanf(\"%d\",&n); //pedimos al usuario que ingrese la cantidad de pelotas\n int v[n]; //declaramos un vector donde se guardaran los tama\ufffdos de las n pelotas\n for(i=0; i<n; i++){\n scanf(\"%d\",&v[i]); //Insertamos en el vector el tama\ufffdo de cada pelota\n }\n for(i=0; i<n; i++){\n b1=-1; //inicializamos las banderas al comienzo de cada ciclo con nros negativos diferentes\n b2=-2; //\n for(j=0; j<n; j++){ //en este for anidado comparamos el resto del vector con el elemento v[i]\n if(v[i]==(v[j]+1)) { // si encontramos una pelota con un tama\ufffdo mayor en 1 unidad al tama\ufffdo de la pelota v[i]\n b1=i; //cargamos en b1 el indice de dicha pelota\n }\n if(v[i]==(v[j]-1)){ // si encontramos una pelota con un tama\ufffdo menor en 1 unidad al tama\ufffdo de la pelota v[i]\n b2=i; //cargamos en b1 el indice de dicha pelota\n }\n }\n if(b2 ==i && b1==i){ //Si ambas banderas son iguales al indice actual significa que se encontraron dos tama\ufffdos\n break; // x+1 y x-1 en relacion a v[i], entonces salimos del ciclo con break\n }\n }\n if(b1==b2 && b2==i){ //este if controla si se consigui\ufffd encontrar las dos pelotas que cumplan la condicion anterior\n printf(\"YES\"); //de ser asi imprime YES, se encontraron 3 pelotas de tama\ufffdos x, x+1 y x-1\n }else{\n printf(\"NO\"); //caso contrario imprime NO, mostrando que no se encontraron las pelotas de tama\ufffdos\n } //buscados\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i,c=0,j,a,b,temp,k=0;\n scanf(\"%d\",&n);\n int arr[n],narr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(arr[i]>arr[j])\n {\n temp=arr[i];\n arr[i]=arr[j];\n arr[j]=temp;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n narr[k]=arr[i];\n while(arr[i]==arr[i+1])\n {\n i++;\n }\n k++;\n }\n\n\n\n for(i=0;i<k-1;i++)\n {\n a=narr[i+1]-narr[i];\n b=narr[i+2]-narr[i+1];\n if(a*b==1)\n {\n c=1;\n printf(\"YES\");\n break;\n }\n }\n if(c==0)\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3 && balls[i] != balls[j]){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i]-balls[k]) < 3 && abs(balls[j] - balls[k]) < 3 && balls[i] != balls[k] && balls[k] != balls[j]){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\th = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\n\t}\n\n}\n"}, {"source_code": "// Bear and the three balls\n#include <stdio.h>\n#include <malloc.h>\n#include <stdlib.h>\n\n\t// soluci\u00f3n por fuerza bruta: comparar cada bola con otras dos, si antres de terminar el ciclo hay dos que difieren en menos de 2 en valor absoluto, se puede\n\t// Si se acaba el ciclo sin encontrar nada, se imprime NO\n\n\tint particion (int a[],int ini, int fin);\n\tvoid quicksort (int a[],int ini, int fin);\n\tvoid swap (int a[],int x,int y);\n\t\t\nint main(void){\n\tint n;\n\tint *vec;\n\tint i, cont = 0;\n\n\tscanf ( \"%d\", &n );\n\t\n\tvec = (int*)malloc(n*sizeof(int));\n\t\n\tfor ( i = 0; i < n; i++){\n\t\t\tscanf ( \"%d\", &vec[i] );\n\t}\n\t\n\tquicksort( vec, 0, n - 1 );\n\t\n\t/*for ( i = 0; i < n; i++ ){\n\t\tprintf ( \"%d - \", vec[i] );\n\t}*/\n\t\n\tfor ( i = 1; i < n; i++ ){\n\t\tif ( vec[i - 1] == (vec[i] - 1) )\n\t\t\tcont++;\n\t\telse if ( vec[i - 1] != vec[i] )\n\t\t\tcont = 0;\n\t\tif ( cont == 2 ){\n\t\t\tprintf ( \"YES\" );\n\t\t\tbreak;\n\t\t\t//exit(1);\n\t\t}\n\t}\n\t\n\tif ( cont != 2 )\n\t\tprintf ( \"NO\" );\n\t\n\treturn 0;\n}\n\nvoid quicksort (int a[],int ini, int fin)\t\t//cada vez que se llama a quicksort un nuevo pivot va colocandose en su posicion\n{\n\tint piv;\n\tif (ini<fin)\n\t{\t//cont++;\n\t\tpiv=particion(a,ini,fin);\n\t\tquicksort(a,ini,piv-1);\t\t\t\t//como el pivot ya esta en su ubicacion se divide en dos y se vuelve a llamar\n\t\tquicksort(a,piv+1,fin);\t\t\t\t//a quicksort pero sin tocar el pivot\n\t}\n}\n\nint particion (int a[],int ini, int fin)\t\t//particion ubica al pivot en su posicion y devulve esa posicion\n{\n\tint pivot,i,j;\n\tpivot=a[fin];\n\ti=ini;\n\tfor (j=ini;j<fin;j++)\n\t{\n\t\tif (a[j]<pivot)\n\t\t{\n\t\t\tswap(a,j,i);\n\t\t\ti++;\n\t\t}\n\t}\n\tswap(a,i,fin);\n\treturn i;\n}\n\n\nvoid swap (int a[],int x,int y)\n{\n\tint aux;\n\taux=a[x];\n\ta[x]=a[y];\n\ta[y]=aux;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[1000],b[1005];\nint main()\n{\n int n,i;\n scanf(\"%d\",&n); //4\n for(i=0;i<n;i++) // loop 4 times\n {\n scanf(\"%d\",&a[i]); //18 55 16 17\n b[a[i]] = b[a[i]]+1; // 19 56 17 18\n }\n for(i=1;i<=1000;i++)\n {\n if(b[i]&&b[i+1]&&b[i+2])\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid quicksort(int a[],int first,int last);\n\nint main(){\n\tint n, i, j, k, sol;\n\tscanf(\"%d\", &n);\n\tint balls[n-1];\n\tfor(i=0; i<n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tquicksort(balls, 0, n-1);\n\tfor(i=0; i < n-2; i++){\n\t\tsol = 0;\n\t\tfor(j = i+1; j < n-1; j++){\n\t\t\tif(balls[j] == balls[i]+1){\n\t\t\t\tsol++;\n\t\t\t\tfor(k = i+2; k < n; k++){\n\t\t\t\t\tif(balls[k] == balls[i]+2){\n\t\t\t\t\t\tsol++;\n\t\t\t\t\t\ti=j=k=n;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(sol == 2){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\t\n\t}\n\treturn 0;\n}\n\nvoid quicksort(int a[],int first,int last)\n{\n int pivot,j,temp,i;\n\n if(first<last)\n {\n pivot=first;\n i=first;\n j=last;\n\n while(i<j)\n {\n while(a[i]<=a[pivot]&&i<last)\n i++;\n while(a[j]>a[pivot])\n j--;\n \n if(i<j)\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n\n temp=a[pivot];\n a[pivot]=a[j];\n a[j]=temp;\n \n quicksort(a,first,j-1);\n quicksort(a,j+1,last);\n\n }\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int n,i,x,b[1010],count=0,a[100];\n scanf(\"%d\",&n);\n\n for(i=0;i<1010;i++){\n b[i]=0;\n }\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n\n for(i=0;i<n;i++){\n x=a[i];\n b[x]++;\n }\n\n for(i=0;i<=1000;i++){\n if(b[i]>0 && b[i+1]>0 && b[i+2]>0){\n printf(\"YES\\n\");\n count=1;\n break;\n }\n }\n if(count==0)printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "//problema6\n#include <stdio.h>\n\nint main(){\n int n,i,k,j,b=0;\n scanf(\"%d\",&n);\n int v[n];\n for (i=0; i<n; i++){\n scanf(\"%d\",&v[i]);\n }\n for(i=0;i<n;i++){\n for(j=0;j<n;j++){\n for(k=0;k<n;k++){\n if(v[i]==v[j]+1){\n if(v[i]==v[k]+2){\n b=1;\n break;\n }\n }\n }\n }\n }\n if(b)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n#include<time.h>\n\n#define SORT while(t--){for(i=0;i<x-1;i++)if(arr[i]>arr[i+1]){o=arr[i];arr[i]=arr[i+1];arr[i+1]=o;}}\n#define R return 0;\n#define and &&\n#define or ||\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\nmain(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i<x;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\th[arr[i]]++;\n\t}\n\tfor(i=0;i<10000;i++){\n\t\tif(h[i] and h[i+1] and h[i+2]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i<x;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\th[arr[i]]++;\n\t}\n\tfor(i=0;i<10000;i++){\n\t\tif(h[i] && h[i+1] && h[i+2]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int n,i,a[55],j,s,check=0,k; //s=sort\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n for(j=i+1;j<n;){\n if(a[j]==a[i]){\n for(k=j;k<n;k++){\n a[k]=a[k+1];\n }\n n--;\n }\n else\n j++;\n }\n }\n /*for(i=0;i<n;i++){\n printf(\"%d \",a[i]);\n }*/\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]>a[j]){\n s=a[i];\n a[i]=a[j];\n a[j]=s;\n }\n }\n }\n for(i=0;i<n;i++){\n //printf(\"%d \",a[i]);\n if(((a[i+1]-a[i])==1)&&((a[i+2]-a[i+1])==1)){\n check=1;\n }\n /*else{\n check=0;\n }*/\n }\n if(check==1){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n \n int ball;\n\tint tag=1;\n int a,j,i,k,l=0;\n \n scanf(\"%d\",&ball);\n \n \n int size[1000];\n\tint si[1000];\n \n for(i=0; i<ball; i++){\n scanf(\"%d\",&size[i]);\n }\n \n\n\n\tfor (i = 0; i < ball; i++) {\n for (j = i + 1; j < ball;) {\n if (size[j] == size[i]) {\n for (k = j; k < ball; k++) {\n size[k] = size[k + 1];\n }\n ball--;\n } else\n j++;\n }\n }\n\n \n\n\tfor (i = 0; i < ball; i++) \n {\n \n for ( j = i + 1; j < ball; j++)\n {\n \n if (size[i] > size[j]) \n {\n \n a = size[i];\n size[i] = size[j];\n size[j] = a;\n \n }\n\n\t }\n }\n\n\n \n\t \n for ( i = 0; i < ball; i++) {\n\n if ((size[i + 1] - size[i]) == 1 && (size[i + 2] - size[i]) == 2) {\n tag=1;\n\t\t break;\n }\n\n\t else tag=0; \n } \n\n \t if(tag==1)printf(\"YES\");\n \t else if(tag==0)printf(\"NO\");\n\t \n return 0;\n \n }"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdbool.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],i,b[1001];\n memset(b,0,1001*sizeof(int));\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[a[i]]=1;\n }\n int k=0,c[n];\n for(i=0;i<1001;i++)\n if(b[i]==1)\n c[k++]=i;\n for(i=0;i<k-2;i++)\n {\n if(c[i+1]-c[i]==1&&c[i+2]-c[i+1]==1)\n break;\n }\n if(i<k-2)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMA\u00d1O ARREGLO\n\tint N;\n\tscanf (\"%d\", &N);\n\t//CARGAR ARREGLO\n\tint V[N];\n\tint cont;\n\tfor (cont = 0; cont < N; cont++){\n\t\tscanf (\"%d\", &V[cont]);\n\t}\n\t//ORDENAR ARREGLO\n\tquick(V, 0, N-1);\n\t//BUSCAR MENOR\n\tchar *R[2] = {\"YES\", \"NO\"};\n\tint a, cont2;\n\ta=1;\n\tfor (cont = 0; cont < N-2; cont++){\n\t\tif( (V[cont+1]-V[cont]) == 1){\n\t\t\tfor (cont2 = cont+2; cont2 < N; cont2++){\n\t\t\t\tif ((V[cont2]-V[cont+1]) == 1){\n\t\t\t\t\ta = 0;\n\t\t\t\t\tcont2 = N;\n\t\t\t\t\tcont = N;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf (\"%s\", R[a]);\n\n\treturn 0;\n}\nvoid swap (int *v, int i, int j){\n\tint aux;\n\t\n\taux = *(v+i);\n\t*(v+i) = *(v+j);\n\t*(v+j) = aux;\n}\nint pivot(int *v, int izq, int der){\n\tint i, pivote, valor_pivote;\n\t\n\tpivote = izq;\n\tvalor_pivote = *(v+pivote);\n\tfor(i = izq+1; i <=der; i++){\n\t\tif (*(v+i) < valor_pivote){\n\t\t\tpivote++;\n\t\t\tswap(v, i, pivote);\n\t\t}\n\t}\n\tswap(v, izq, pivote);\n\t\n\treturn pivote;\n}\nvoid quick (int *v, int ini, int fin){\n\tint pivote;\n\tif(ini < fin){\n\t\tpivote = pivot(v, ini, fin);\n\t\tquick(v, ini, pivote-1);\n\t\tquick(v, pivote+1, fin);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid quicksort(int v[],int inicio, int fin);\n\nshort int repartirBolas(int *v , int dim );\n\n\nint main(){\n\n\tint k,i;\n\t\n\tscanf(\"%d\",&k);\n\tint bolas[k];\n\n\tfor(i=0; i<k;i++){\n\n\t\tscanf(\"%d\",&bolas[i]);\n\n\t}\n\n\tquicksort(bolas,0,k-1);\n\t\n\tif( repartirBolas ( bolas , k ) )\n\n\t\tprintf(\"%s\" , \"YES\" );\n\n\telse\n\n\t\tprintf( \"%s\" , \"NO\" );\n\n\treturn 0;\n\n}\n//Ordena el vector de bolas\nvoid quicksort(int v[],int inicio, int fin){\n\tint i,j,central;\n\tint pivote;\n\tint temp;\n\tcentral=(inicio+fin)/2;\n\tpivote=v[central];\n\ti=inicio;\n\tj=fin;\n\tdo{\n\t\twhile(v[i]<pivote)\n\t\t\ti++;\n\t\twhile(v[j]>pivote)\n\t\t\tj--;\n\t\tif(i<=j){\n\t\t\ttemp=v[i];\n\t\t\tv[i]=v[j];\n\t\t\tv[j]=temp;\n\t\t\ti++;\n\t\t\tj--;\n\t\t}\n\t}while(i<=j);\n\tif(inicio<j)\n\t\tquicksort(v,inicio,j);\n\tif(i<fin)\n\t\tquicksort(v,i,fin);\t\t\n}\n\nshort int repartirBolas(int *v , int dim ){\n\n\tint i,j;\n\tint retorna = 0;\n short int count = 0;\n\n\tfor( i = 0 ; i < dim - 2; i ++ ){\n \n for( j = i + 1 ; j < dim ; j ++ ){\n\n\t\t if( ( v[i] + 1 ) == v[j] ){ /* buscar un mayor inmediato */\n \n i = j; /* cambiar el indice del numero a comparar con el encontrado */\n count++; /* contar la cantidad de numeros inmediatos superiores ya encontrados */\n\n }\n\n if( count == 2 ){ /* ver si ya se encontro dos numeros inmediatos superiores */\n\n retorna = 1; /* se coloca el valor a retornar en 1 */\n j = dim; /* se finalizan ambos ciclos */\n i = dim;\n\n }\n\n if( v[j] > v[i] + 1 ){ /* si es mayor al imnediato superior, finalizar la busqueda y borrar el contador */\n\n count = 0;\n i = j - 1;\n j = dim;\n\n }\n \n\t\t}\n\n\n\t}\n\n\treturn retorna;\n\n}\n\t\t\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[50],b,c[1001]= {0},i,j,k=0;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&b);\n if(c[b]==0)\n {\n c[b]++;\n a[k++]=b; }\n }\n for(i=1; i<k; i++)\n for(j=0; j<k-1; j++)\n if(a[j]>a[j+1])\n n=a[j],a[j]=a[j+1],a[j+1]=n;\n for(i=1; i<k-1; i++)\n if(a[i]-a[i-1]==1&&a[i+1]-a[i]==1)\n {\n printf(\"YES\\n\");\n return 0;\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cnt[2000];\n\nint main()\n{\n int n, x;\n scanf(\"%d\", &n);\n while (n--){\n scanf(\"%d\", &x);\n cnt[x]++;\n if (((cnt[x - 1]) && (cnt[x - 2])) ||\n ((cnt[x + 1]) && (cnt[x + 2])) ||\n ((cnt[x - 1]) && (cnt[x + 1]))) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint arr[10005],x,i,t,o,h[10005]={0};\n\tscanf(\"%d\",&x);\n\tfor(i=0;i<x;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\th[arr[i]]++;\n\t}\n\tfor(i=0;i<10000;i++){\n\t\tif(h[i] && h[i+1] && h[i+2]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMA\u00d1O ARREGLO\n\tint N;\n\tscanf (\"%d\", &N);\n\t//CARGAR ARREGLO\n\tint V[N];\n\tint cont;\n\tfor (cont = 0; cont < N; cont++){\n\t\tscanf (\"%d\", &V[cont]);\n\t}\n\t//ORDENAR ARREGLO\n\tquick(V, 0, N-1);\n\t//BUSCAR MENOR\n\tchar *R[2] = {\"YES\", \"NO\"};\n\tint a, cont2;\n\ta=1;\n\tfor (cont = 0; cont < N-2; cont++){\n\t\tif( (V[cont+1]-V[cont]) == 1){\n\t\t\tfor (cont2 = cont+2; cont2 < N; cont2++){\n\t\t\t\tif ((V[cont2]-V[cont+1]) == 1){\n\t\t\t\t\ta = 0;\n\t\t\t\t\tcont2 = N;\n\t\t\t\t\tcont = N;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf (\"%s\", R[a]);\n\n\treturn 0;\n}\nvoid swap (int *v, int i, int j){\n\tint aux;\n\t\n\taux = *(v+i);\n\t*(v+i) = *(v+j);\n\t*(v+j) = aux;\n}\nint pivot(int *v, int izq, int der){\n\tint i, pivote, valor_pivote;\n\t\n\tpivote = izq;\n\tvalor_pivote = *(v+pivote);\n\tfor(i = izq+1; i <=der; i++){\n\t\tif (*(v+i) < valor_pivote){\n\t\t\tpivote++;\n\t\t\tswap(v, i, pivote);\n\t\t}\n\t}\n\tswap(v, izq, pivote);\n\t\n\treturn pivote;\n}\nvoid quick (int *v, int ini, int fin){\n\tint pivote;\n\tif(ini < fin){\n\t\tpivote = pivot(v, ini, fin);\n\t\tquick(v, ini, pivote-1);\n\t\tquick(v, pivote+1, fin);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint b[100000];\nint i;\nint tog;\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n\tint a,c;\n\tscanf(\"%d\",&a);\n\tfor(i=0;i<a;i++)\n\t{\n\t\tscanf(\"%d\",&c);\n\t\tb[c]=1;\n\t}\n\tint count=0;\n\tfor(i=0;i<1001;i++)\n\t{\n\t\tif(b[i]==1)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t\tcount=0;\n\t\tif(count==3)\n\t\t{\n\t\t\ttog=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(tog==1)\n\t{\n\t\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\n\tprintf(\"\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n\t\tint n, i, j, c;\n\t\tscanf(\"%d\", &n);\n\t\tint a[n];\n\t\tfor (i = 0; i < n; i++)\n\t\t\tscanf(\"%d\", &a[i]);\n\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = i + 1; j < n; j++)\n\t\t\t\tif (a[i] > a[j])\n\t\t\t\t{\n\t\t\t\t\tc = a[i];\n\t\t\t\t\ta[i] = a[j];\n\t\t\t\t\ta[j] = c;\n\t\t\t\t}\n\n\t\tfor (i = 0; i < n - 2; i++)\n\t\t\tif (a[i] + 1 == a[i + 1])\n\t\t\t{\n\t\t\t\tj=2;\n\t\t\t\twhile(a[i+1]==a[i+j])\n\t\t\t\tj++;\n\t\t\t\t\t\tif (a[i] + 2 == a[i + j])\n\t\t\t\t{\n\t\t\t\t\tc = -911;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tif (c == -911 )\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\tprintf(\"\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,x1=0,x2=0,c=0,temp;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ar[i]>ar[j])\n {\n temp=ar[i];\n ar[i]=ar[j];\n ar[j]=temp;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n //x=ar[i];\n for(j=i+1;j<n;j++)\n {\n if(ar[j]-ar[i]==1)\n x1=1;\n if(ar[j]-ar[i]==2)\n x2=1;\n }\n if(x1==1 && x2==1)\n {\n printf(\"YES\");\n return 0;\n }\n x1=0;x2=0;\n }\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int balls[n];\n int i,j,k;\n int a,b,c;\n int aux;\n int puede;\n puede = 0;\n\n for (i = 0;i < n; i++){\n scanf(\"%d\",&balls[i]);\n }\n\n\n for (i = 0; i < n-1; i++){\n for (j = 0; j < n-i-1; j++){\n if (balls[j] > balls[j+1]){\n aux = balls[j];\n balls[j] = balls[j+1];\n balls[j+1] = aux;\n }\n }\n }\n\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (balls[j] == balls[i]) {\n for (k = j; k < n; k++) {\n balls[k] = balls[k + 1];\n }\n n--;\n } else\n j++;\n }\n }\n for (i = 1; i<n-1; i++){\n a = balls[i-1];\n b = balls[i];\n c = balls[i+1];\n\n if(b - a == 1 && c - b == 1 && (a+b+c)/3 == b){\n puede = 1;\n }\n }\n if(puede == 1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint puede(unsigned int v[], int n);\nint hay(unsigned int v[],int x, int pos, int ult);\n\n\nint main(){\n\tint n;\n\n\n\tscanf(\"%d\",&n);\n\n\tunsigned int v[n];\n\n\tfor(int i=0; i<n; i++){\n\t\tscanf(\"%u\",&v[i]);\n\t}\n\n\tn = puede(v, n);\n\n\tif(n){\n\t\tputs(\"YES\");\n\t}else{\n\t\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n\nint puede(unsigned int v[], int n){\nint c=0,j,i,b,z=0;\n\n\tfor(i=0; i<n; i++){\n\t\tfor(j=0;j<n-i;j++){\n\t\t\tif(v[i]>v[j]){\n\t\t\t\tb=v[i];\n\t\t\t\tv[i]=v[j];\n\t\t\t\tv[i]=b;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<n; i++){\n\n\t\tb=2;\n\t\tz=2;\n\n\t\tif(hay(v, -2,i,n )){\n\t\t\tc++;\n\t\t\tz=0;\n\t\t}\n\t\tif(hay(v, -1 ,i,n)){\n\t\t\tc++;\n\t\t\tb=0;\n\t\t}\nif(z ){\n\n\t\tif(hay(v, 1,i,n ) ){\n\t\t\tc++;\n\t\t}\n}\n\nif( z ){\n\n\tif(b ){\n\n\t\tif(hay(v, 2,i,n ) ){\n\t\t\tc++;\n\t\t}\n\t}\n}\n\n\t\tif(c>=2){\n\t\t\treturn 1;\n\t\t}\n\t\tc=0;\n\t}\n\n\treturn 0;\n}\n\nint hay(unsigned int v[],int x, int pos, int ult){\nint i;\n\n\tfor(i=0; i < ult ;i++ ){\n\t\tif(pos != i){\n\t\t\tif(v[pos] - v[i] == x){\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n int main(){\n int n,i,j,res=0;\n scanf(\"%d\",&n);\n int v[n], aux[1005]={0};\n for(i=0;i<n;i++){\n scanf(\"%d\",&v[i]);\n aux[v[i]]=1;\n }\n for(i=0;i<1005;i++){\n if(aux[i]==1 && aux[i+1]==1 && aux[i+2]==1){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k = 0, temp, flag = 0; // The number of balls limak can have\n scanf(\"%d\", &n);\n int t[n], i, j;\n for(i = 1; i <= n; i++)\n scanf(\"%d\", &t[i]);\n for(i = 1; i <=n-1; i++) {\n for(j = i + 1; j <= n; j++) {\n if(t[j] < t[i]) {\n temp = t[i];\n t[i] = t[j];\n t[j] = temp;\n }\n }\n }\n \n for(i = 1; i <= n - 2; i++) {\n j = i + 1;\n if(t[i] == t[j] && t[j] == t[j + 1] && t[i] == t[j + 1] || t[i] == t[j]) {\n continue;\n }\n if(t[j] == t[j + 1]) {\n k = j + 1;\n if (k == n)\n break;\n while(t[k] == t[j]) {\n j = k;\n k++;\n }\n }\n if( (abs(t[i] - t[j]) <= 2) && (abs(t[i] - t[j + 1]) <= 2) && (abs(t[j] - t[j+1]) <= 2) ) {\n flag = 1;\n printf(\"YES\");\n break;\n }\n }\n if(flag == 0)\n printf(\"NO\");\n\n}"}, {"source_code": "#include\"stdio.h\"\nint main()\n{\n\t\tint n, i, j, c;\n\t\tscanf(\"%d\", &n);\n\t\tint a[n];\n\t\tfor (i = 0; i < n; i++)\n\t\t\tscanf(\"%d\", &a[i]);\n\n\t\tfor (i = 0; i < n; i++)\n\t\t\tfor (j = i + 1; j < n; j++)\n\t\t\t\tif (a[i] > a[j])\n\t\t\t\t{\n\t\t\t\t\tc = a[i];\n\t\t\t\t\ta[i] = a[j];\n\t\t\t\t\ta[j] = c;\n\t\t\t\t}\n\n\t\tfor (i = 0; i < n - 2; i++)\n\t\t\tif (a[i] + 1 == a[i + 1])\n\t\t\t{\n\t\t\t\tj=2;\n\t\t\t\twhile(a[i+1]==a[i+j])\n\t\t\t\tj++;\n\t\t\t\t\t\tif (a[i] + 2 == a[i + j])\n\t\t\t\t{\n\t\t\t\t\tc = -911;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\tif (c == -911 )\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t\tprintf(\"\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nvoid rev(int v[],int n);\nvoid quicksort(int lista[],int n);\nvoid qs(int lista[],int limite_izq,int limite_der);\nvoid leervector(int *v,int n);\nvoid regre(int v[],int n,int *i);\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n int v[n];\n leervector(v,n);\n rev(v,n);\nreturn 0;\n}\n\nvoid leervector(int *v,int n){\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",v+i);\n }\n}\n\nvoid rev(int v[],int n){\nint i,x,z;\n quicksort(v,n);\n for(i=0;i<n-2;i++){\n if(v[i]==v[i+1]){\n regre(v,n,&i);\n }\n x=i+1;\n if(v[x]==v[x+1]){\n regre(v,n,&x);\n }\n z=x+1;\n if(v[i]+1==v[x] && v[x]+1==v[z]){\n printf(\"YES\");\n exit(0);\n }\n }\n printf(\"NO\");\n}\nvoid regre(int v[],int n,int *i){\n while(*i<n && v[*i]==v[*i+1])(*i)++;\n}\n\nvoid quicksort(int lista[],int n){\n qs(lista,0,n-1);\n}\n\n\nvoid qs(int lista[],int limite_izq,int limite_der){\n int izq,der,temporal,pivote;\n izq=limite_izq;\n der = limite_der;\n pivote = lista[(izq+der)/2];\n do{\n while(lista[izq]<pivote && izq<limite_der)izq++;\n while(pivote<lista[der] && der > limite_izq)der--;\n if(izq <=der)\n {\n temporal= lista[izq];\n lista[izq]=lista[der];\n lista[der]=temporal;\n izq++;\n der--;\n }\n }while(izq<=der);\n if(limite_izq<der){qs(lista,limite_izq,der);}\n if(limite_der>izq){qs(lista,izq,limite_der);}\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <time.h>\n\n#define lli long long int\n#define MAX INT_MAX\n#define sd second\n#define fs first\n#define endll '\\n'\n#define PI acos(-1)\n#define mp make_pair\n#define pb push_back\n#define best 1000000007\n#define FOR(i,a,b) for(int i=a;i<=b;i++)\n#define ROF(i,a,b) for(int i=a;i>b;i--)\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\n#define ort(a,b) (a+b)/2\n#define carp(a,b) (a)*(b)\n#include<stdio.h>\n\t\tint main (){\n\n\t\t\tint i,j,arr[10005],x,min=0,t=0,h[10005]={0};\n\t\t\tscanf(\"%d\",&x);\n\t\t\tfor(i=0;i<x;i++){\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\t\th[arr[i]]++;\n\t\t\t}\n\t\tfor(i=0;i<1000;i++){\n\t\t\tif(h[i]&&h[i+1]&&h[i+2]){\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\treturn 0;}\n\t}\n\t\tprintf(\"NO\");\n\t}\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&t);\n a[i]=t;\n\n }\n for(i=0; i<n; i++)\n for(j=i+1; j<n; j++)\n if(a[i]==a[j])\n a[j]=-1000;\n for(i=0; i<n; i++)\n for(j=i+1; j<n; j++)\n if(a[i]>a[j])\n {\n d=a[j];\n a[j]=a[i];\n a[i]=d;\n }\n for(i=0; i<n; i++)\n if(a[i]!=a[i+1])\n if(a[i+2]-a[i]==2 &&a[i+1]-a[i]!=0&&a[i+2]-a[i+1]!=0 &&a[i+1]-a[i]==1 )\n cnt=1;\n if(cnt==1) printf(\"yes\");\n else printf(\"no\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3 && balls[i] != balls[j]){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i]-balls[k]) < 3 && abs(balls[j] - balls[k]) < 3 && balls[i] != balls[k] && balls[k] != balls[j]){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\th = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\nvoid rev(int v[],int n);\nvoid quicksort(int lista[],int n);\nvoid qs(int lista[],int limite_izq,int limite_der);\nvoid leervector(int *v,int n);\nvoid regre(int v[],int n,int *i);\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n int v[n];\n leervector(v,n);\n rev(v,n);\nreturn 0;\n}\n\nvoid leervector(int *v,int n){\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",v+i);\n }\n}\n\nvoid rev(int v[],int n){\nint i,x,z;\n quicksort(v,n);\n for(i=0;i<n-2;i++){\n if(v[i]==v[i+1]){\n regre(v,n,&i);\n }\n x=i+1;\n if(v[x]==v[x+1]){\n regre(v,n,&x);\n }\n z=x+1;\n if(v[i]+1==v[x] && v[x]+1==v[z]){\n printf(\"YES\");\n exit(0);\n }\n }\n printf(\"NO\");\n}\nvoid regre(int v[],int n,int *i){\n while(*i<n && v[*i]==v[*i+1])(*i)++;\n}\n\nvoid quicksort(int lista[],int n){\n qs(lista,0,n-1);\n}\n\n\nvoid qs(int lista[],int limite_izq,int limite_der){\n int izq,der,temporal,pivote;\n izq=limite_izq;\n der = limite_der;\n pivote = lista[(izq+der)/2];\n do{\n while(lista[izq]<pivote && izq<limite_der)izq++;\n while(pivote<lista[der] && der > limite_izq)der--;\n if(izq <=der)\n {\n temporal= lista[izq];\n lista[izq]=lista[der];\n lista[der]=temporal;\n izq++;\n der--;\n }\n }while(izq<=der);\n if(limite_izq<der){qs(lista,limite_izq,der);}\n if(limite_der>izq){qs(lista,izq,limite_der);}\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,i,j,temp;\n scanf(\"%I64d\",&n);\n long long int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[j]==0)\n continue;\n else\n {\n a[i]=a[j];\n a[j]=0;\n break;\n }\n }\n }\n }\n /* for(i=0;i<n;i++)\n {\n printf(\"%I64d \",a[i]);\n }\n return 0;*/\n for(i=0;i<n;i++)\n {\n if(a[i+1]==0||a[i+2]==0)\n break;\n if((a[i+1]-a[i])==(a[i+2]-a[i+1])&&(a[i+1]-a[i])<2&&(a[i+2]-a[i+1])<2)\n {\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n\n printf(\"NO\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#define MAX 1001\n\nint main(){\n\tint v[MAX] = {0};\n\tint n,a,i;\n\tscanf(\"%d\",&n);\n\tfor(i = 0 ; i< n ; i++ ){\n\t\tscanf(\"%d\",&a);\n\t\tv[a]++;\n\t}\n\ti = 0;\n\tint b = 0;\n\twhile( i < 1001 - 2 && b == 0 ){\n\t\tif(v[i] != 0 && v[i+1]!= 0 && v[i+2] !=0){\n\t\t\tif((v[i+1] - v[i]) <= 2 && (v[i+2] - v[i+1]) <= 2 ){\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tb = 1;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t}\n\tif(b == 0){\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n int main(){\n int n,i,j,res=0;\n scanf(\"%d\",&n);\n int v[n], aux[1005]={0};\n for(i=0;i<n;i++){\n scanf(\"%d\",&v[i]);\n aux[v[i]]=1;\n }\n for(i=0;i<1005;i++){\n if(aux[i]==1 && aux[i+1]==1 && aux[i+2]==1){\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, i, j, z, a[100];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", a + i);\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tfor (j = 0; j < n; j++) {\n\t\t\tif (a[j] == a[i] + 1) {\n\t\t\t\tfor (z = 0; z < n; z++) {\n\t\t\t\t\tif (a[z] == a[i] + 2 || a[z] == a[i] - 1) {\n\t\t\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (a[j] == a[i] - 1) {\n\t\t\t\tfor (z = 0; z < n ; z++) {\n\t\t\t\t\tif (a[z] == a[i] - 2 || a[z] == a[i] + 1) {\n\t\t\t\t\t\tprintf(\"YES\"); return 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tint a[50],t;\n\tint n;scanf(\"%d\",&n);\n\tint i,j,count=0;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tqsort(a,n,sizeof(int),cmpfunc);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tcount=0; \n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(a[j]-a[i]<=2 && a[j]-a[i]!=0 && a[j]!=a[j+1] && j<n)\n\t\t\t\tcount++;\n\t\t\tif(count==2){printf(\"YES\\n\");exit(0);}\n\t\t}\n\t}\n\tif(count!=2)printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int i,j,n,k,b=0,l=0,p;\n \n int arr[60];\n scanf(\"%d\",&n);\n \n if(n>=3 && n<=50){\n \n for(i=0;i<n;i++){\n \n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n ;i++){\n k=arr[i];\n for(j=0;j<n;j++){\n if(arr[j]-1==k){\n b++;\n \n }\n \n }\n if(b>0){\n for(j=0;j<n;j++){\n if(arr[j]-2==k){\n l++;\n \n }\n \n \n }\n } \n b=0;\n }\n if(l>0) printf(\"YES\");\n else{\n printf(\"NO\");\n \n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n;\n\tint a[1100];\n\t\n\t\n\tint b;\n\tscanf(\"%d\",&n);\n\t\n\tint i;\n\t\n\tfor(i = 0 ;i < 1100 ; i++)\n\t{\n\t\ta[i] = 0;\n\t}\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&b);\n\t\ta[b]=1;\n\t}\n\tfor( i=0;i<1010;i++)\n\t{\n\t\tif(a[i]==1&&a[i+1]==1&&a[i+2]==1)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n\n}"}, {"source_code": "//problema6\n#include <stdio.h>\n\nint main(){\n int n,i,k,j,b=0;\n scanf(\"%d\",&n);\n int v[n];\n for (i=0; i<n; i++){\n scanf(\"%d\",&v[i]);\n }\n for(i=0;i<n;i++){\n for(j=0;j<n;j++){\n for(k=0;k<n;k++){\n if(v[i]==v[j]+1){\n if(v[i]==v[k]+2){\n b=1;\n break;\n }\n }\n }\n }\n }\n if(b)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j,n,t,v;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i<=n-1;i++) scanf(\"%d\",&ara[i]);\n for(i=0;i<=n-1;i++)\n {\n for(j=n-1;j>i;j--)\n {\n if (ara[j]<ara[j-1]) {\n t=ara[j];\n ara[j]=ara[j-1];\n ara[j-1]=t;\n }\n }\n }\n for(i=0;i<=n-1;i++) {\n j=i+1;\n\n if((ara[j]-ara[i])==1) {\n if(ara[j]==ara[j+1]) {\n do{\n j++;\n } while(ara[j]==ara[j+1]);\n if((ara[j+1]-ara[j])==1) {\n printf(\"YES\");\n return 0;\n }\n }\n else if((ara[j+1]-ara[j])==1) {\n\n printf(\"YES\");\n return 0;\n\n\n }\n }\n\n }\n\n printf(\"NO\");\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint n;\nint arr[55];\n\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(register int i=1;i<=n;i++) scanf(\"%d\",&arr[i]);\n\tfor(register int i=1;i<=n;i++){\n\t\tfor(register int j=1;j<=n;j++){\n\t\t\tfor(register int k=1;k<=n;k++){\n\t\t\t\tif(arr[k]==arr[j]+1 && arr[j]==arr[i]+1){\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\nint main () {\n\tint n,i,bd=1,j;\n\tscanf(\"%d\",&n);\n \tint v[n];\n\tfor( i = 0 ; i < n; i++ ) {\n\t\tscanf(\"%d\",&v[i]);\n\t}\n\tqsort(v, n, sizeof(int), cmpfunc);\n\tfor (i = 0; i < n - 2; i++){\n for (j = i + 1; j < n - 1; j++){\n if(v[i] + 1==v[j] && v[i] + 2==v[j+1]){\n bd=0;\n }\n }\n\t}\n\tif(bd==0){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\nscanf(\"%d\",&n);\n\n int a[n];\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&a[i]);\n }\n int j;\n int swap;\n for (i = 0 ; i < ( n - 1 ); i++)\n {\n for (j = 0 ; j < n - i - 1; j++)\n {\n if (a[j] > a[j+1]) {\n swap=a[j];\n a[j] = a[j+1];\n a[j+1]=swap;\n }\n }\n }\n int y=0;\n int x=1;\n int temp=a[0];\n for(i=1;i<n;i++)\n {\n int m=a[i]-temp;\n if(m==0)\n {\n temp=a[i];\n }\n else if(m==1)\n {\n x++;\n temp=a[i];\n }\n else\n {\n x=1;\n temp=a[i];\n }\n if(x==3)\n {\n printf(\"YES\\n\");\n y=1;\n break;\n }\n }\n if(y==0)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cnt[2000];\n\nint main()\n{\n int n, x;\n scanf(\"%d\", &n);\n while (n--){\n scanf(\"%d\", &x);\n cnt[x]++;\n if (((cnt[x - 1]) && (cnt[x - 2])) ||\n ((cnt[x + 1]) && (cnt[x + 2])) ||\n ((cnt[x - 1]) && (cnt[x + 1]))) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid q_sort(int *a, int left, int right)\n{\n int i, j, k, t;\n if (left < right) {\n i = k = left;\n j = right + 1;\n while (1) {\n while (a[++i] < a[k]);\n while (a[--j] > a[k]);\n if (i >= j) break;\n t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n t = a[k];\n a[k] = a[j];\n a[j] = t;\n q_sort(a, left, j-1);\n q_sort(a, j+1, right);\n }\n}\n\nint visit(int *a, int i, int j)\n{\n if (j>1 && (a[i] + 1) == a[i+1]) {\n //printf(\"%d -> %d\\n\", a[i], a[i+1]);\n return visit(a, i+1, j-1);\n } else if (j>1 && (a[i]) == a[i+1]) {\n return visit(a, i+1, j);\n }\n if (j == 1) return 1;\n return 0;\n}\nint main(void)\n{\n int a[1000];\n int n;\n int i, j;\n \n memset(a, 0, sizeof(a));\n\n scanf(\"%d\", &n);\n for (i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n\n i = 0;\n q_sort(a, i, n-1);\n\n#if 0\n for (i=0; i<n; i++)\n printf(\"%d \", a[i]);\n printf(\"\\n\");\n#endif\n\n for (i=0; i<(n-2); i++) {\n j = visit(a, i, 3);\n if (j) {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3 && balls[i] != balls[j]){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i]-balls[k]) < 3 && abs(balls[j] - balls[k]) < 3 && balls[i] != balls[k] && balls[k] != balls[j]){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\th = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,t,i,c,j,a[55];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n-2;i++)\n {\n t=0;\n for(j=i+1;j<n;j++)\n {\n if(a[i]!=a[j]&&abs(a[i]-a[j])<=2)\n {\n if(t==0)\n {\n c=a[j];\n t++;\n }\n else\n {\n if(a[j]!=c && abs(a[j]-c)<=2)\n {t++;\n break;}\n }\n\n }\n\n }\n if(t==2)\n {\n printf(\"YES\");\n break;\n }\n }\n if(i==n-2)\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main()\n{\n\tint N;\n\tscanf(\"%d\",&N);\n\n\tint V[N];\n\n\tint I,J;\n\t \n\tfor (I=0;I<N;I++)\n\t{\t\n\t\tscanf(\"%d\",&V[I]);\t\n\t}\n\tint ban,auxx;\n\t\n\tint cont;\n\tfor( I=0;I<N;I++)//ordenar\n\t{\n\t\tfor(J=0;J<N-1-I;J++)\n\t\t{\n\t\t\tif (V[J]>V[J+1])\n\t\t\t{\n\t\t\t\tauxx = V[J];\n\t\t\t\tV[J] = V[J+1] ;\n\t\t\t\tV[J+1] = auxx;\n\t\t\t}\n\t\t}\t\n\t}\n\tint first=V[1];\n\tcont=1;\t\n\t\n\t//for( I=0; I<N && cont<3 ;I++){printf(\"%d,\",V[I]);}\n\t\n\tcont=1;\n\tint aux[3];\n\tfor( I=0; I<N-2 && cont<3 ;I++)\n\t{\n\t\taux[0]=V[I];\n\t\tcont=1;\n\t\tfor (J=I;J<N && cont<3 ;J++)\n\t\t{\n\t\t\tif(V[J]-aux[0]<=2 && V[J]!=aux[cont-1])\n\t\t\t{\n\t\t\t\taux[cont]=V[J];\n\t\t\t\tcont++;\n\t\t\t}\n\t\t\telse if (V[J]-aux[0]>2)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif (cont!=3)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n\t//for( I=0; I<3 ;I++){printf(\"%d,\",aux[I]);}\n\t//printf(\"cont:%d\\n\",cont);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#define pi 3.1415926\n#define rep(x,ini,end) for(x=(ini);x<(end);x++)\n#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)\n#define max(x,y) ((x)>(y)?(x):(y))\n#define min(x,y) ((x)<(y)?(x):(y))\n\n\nint t[100] = {0};\n\n\nvoid quickSort(int a[], int beginPos, int endPos)\n{\n int i = beginPos, j = endPos;\n int flag = a[beginPos];\n //int bePos_L, bePos_R, endPos_L, endPos_R;\n //int countL = 0, countR = 0;\n if (beginPos>=endPos)\n {\n return;\n }\n\n while (i<j)\n {\n while ((a[j]>flag) && (i<j))\n {\n --j;\n }\n if (i == j)\n {\n break;\n }\n\n a[i] = a[j]; a[j] = flag;\n ++i;\n\n while ((a[i]<flag) && (i<j))\n {\n ++i;\n }\n if (i == j)\n {\n break;\n }\n\n a[j] = a[i]; a[i] = flag;\n --j;\n }\n\n quickSort(a, beginPos, i-1);\n quickSort(a, i+1, endPos);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i;\n rep(i,0,n)\n {\n scanf(\"%d\", &t[i]);\n }\n quickSort(t, 0, n-1);\n\n int count = 1;\n int flag = t[0];\n\n rep(i,1,n)\n {\n if ((t[i]!=flag) && (t[i]-flag<2))\n {\n count++; flag = t[i];\n if (count == 3)\n {\n printf(\"YES\"); return 0;\n }\n continue;\n }\n if (t[i]-flag>=2)\n {\n count = 1; flag = t[i];\n }\n }\n if (count == 3)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int p;\n scanf(\"%d\", &p);\n int a[100], i,temp,flag=0,j;\n for(i=0; i<p; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i=0; i<(p-1); i++)\n {\n for(j=i+1; j<p; j++)\n {\n if(a[i]>a[j])\n {\n\n\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n for(i=0; i<(p-1); i++)\n {\n if(flag==0 && (a[i+1]-a[i])==1)\n {\n flag=1;\n\n }\n else if(flag==1 &&(a[i+1]-a[i])==0)\n {\n continue;\n }\n else if(flag==1 &&(a[i+1]-a[i])==1)\n {\n flag=2;\n break;\n }\n else if(flag==1 && (a[i+1]-a[i])!=1)\n {\n flag=0;\n }\n }\n if(flag==2)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <time.h>\n\n#define lli long long int\n#define MAX INT_MAX\n#define sd second\n#define fs first\n#define endll '\\n'\n#define PI acos(-1)\n#define mp make_pair\n#define pb push_back\n#define best 1000000007\n#define FOR(i,a,b) for(int i=a;i<=b;i++)\n#define ROF(i,a,b) for(int i=a;i>b;i--)\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\n#define ort(a,b) (a+b)/2\n#define carp(a,b) (a)*(b)\n#include<stdio.h>\n\t\tint main (){\n\n\t\t\tint i,j,arr[10005],x,min=0,t=0,h[10005]={0};\n\t\t\tscanf(\"%d\",&x);\n\t\t\tfor(i=0;i<x;i++){\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\t\th[arr[i]]++;\n\t\t\t}\n\t\tfor(i=0;i<1000;i++){\n\t\t\tif(h[i]&&h[i+1]&&h[i+2]){\n\t\t\t\t\tprintf(\"YES\");\n\t\t\t\t\treturn 0;}\n\t}\n\t\tprintf(\"NO\");\n\t}\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint a[1000],b[1005];\nint main()\n{\n int n,i;\n scanf(\"%d\",&n); //4\n for(i=0;i<n;i++) // loop 4 times\n {\n scanf(\"%d\",&a[i]); //18 55 16 17\n b[a[i]] = b[a[i]]+1; // 19 56 17 18\n }\n for(i=1;i<=1000;i++)\n {\n if(b[i]&&b[i+1]&&b[i+2])\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0;\n scanf(\"%d\",&n);\n int a[n],i,tmp,j;\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-i;j++)\n {\n if(a[j]>a[j+1])\n {\n tmp=a[j];\n a[j]=a[j+1];\n a[j+1]=tmp;\n }\n }\n\n }\n for(i=0; i<n; i++)\n {\n if((a[i+1]-a[i])==1)\n {\n if((a[i+2]-a[i])==2)\n {\n flag=1;\n }\n else\n {\n for(j=i+2; j<n; j++)\n {\n if((a[j]-a[i])==2)\n {\n flag=1;\n }\n }\n }\n }\n }\n if(flag==1)\n printf(\"\\nYES\");\n else\n printf(\"\\nNO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j,n,t,v;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0;i<=n-1;i++) scanf(\"%d\",&ara[i]);\n for(i=0;i<=n-1;i++)\n {\n for(j=n-1;j>i;j--)\n {\n if (ara[j]<ara[j-1]) {\n t=ara[j];\n ara[j]=ara[j-1];\n ara[j-1]=t;\n }\n }\n }\n for(i=0;i<=n-1;i++) {\n j=i+1;\n\n if((ara[j]-ara[i])==1) {\n if(ara[j]==ara[j+1]) {\n do{\n j++;\n } while(ara[j]==ara[j+1]);\n if((ara[j+1]-ara[j])==1) {\n printf(\"YES\");\n return 0;\n }\n }\n else if((ara[j+1]-ara[j])==1) {\n\n printf(\"YES\");\n return 0;\n\n\n }\n }\n\n }\n\n printf(\"NO\");\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if((tam[i]+1==tam[j]) || (tam[j]+1==tam[i]) || (tam[i]+2==tam[j]) || (tam[j]+2==tam[i]))\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else\n {\n menor=p2;\n mayor=p1;\n }\n for(k=j+1; k<n; k++)\n {\n if(((tam[k]==menor+2) && (tam[k]==mayor+1)) || ((tam[k]==menor+1) && (tam[k]==mayor-1)) || ((tam[k]==menor-1) && tam[k]==mayor-2))\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nstruct llst_int\n{\n\tint a;\n\tstruct llst_int *next;\n};\ntypedef struct llst_int __llst_int;\n\n__llst_int* receive_sort(__llst_int *head, int *p);\nint check(__llst_int *head);\n\nint main()\n{\n\t__llst_int *head;\n\t__llst_int *temp;\n\tint n;\n\tchar flag;\n\t\n\tscanf(\"%d\",&n);\t\n\thead = (__llst_int *)malloc(sizeof(__llst_int));\n\thead = receive_sort(head, &n);\n\tflag=check(head);\n\tif(flag)\n\t\tputs(\"YES\");\n\telse\n\t\tputs(\"NO\");\n\n\treturn 0;\n}\n\n__llst_int* receive_sort(__llst_int *head, int *p)\n{\n\t__llst_int *k;\n\t__llst_int *temp;\n\t__llst_int *t;\n\tint i;\n\tint j;\n\t\n\tscanf(\"%d\",&head->a);\n\thead->next = NULL;\n\n\ti=1;\n\twhile(i<*p)\n\t{\n\t\ttemp = (__llst_int *)malloc(sizeof(__llst_int));\n\t\ttemp->next=NULL;\n\t\tscanf(\"%d\",&temp->a);\n\t\tt=head;\n\t\tj=0;\n\t\tif(temp->a > t->a)\n\t\t\tj++;\n\t\twhile(j<i && t->next && temp->a > t->next->a)\n\t\t{\t\n\t\t\tt = t->next;\n\t\t\tj++;\n\t\t}\n\t\tif(j==i)\n\t\t{\n\t\t\tif(i>1)\n\t\t\t\tt->next=temp;\n\t\t\telse\n\t\t\t\thead->next=temp;\n\t\t\ti++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(j)\n\t\t\t{\n\t\t\t\tif(temp->a == t->next->a)\n\t\t\t\t{\n\t\t\t\t\tfree(temp);\n\t\t\t\t\t(*p)--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk=t->next;\n\t\t\t\t\tt->next=temp;\n\t\t\t\t\ttemp->next=k;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(temp->a == t->a)\n\t\t\t\t{\n\t\t\t\t\tfree(temp);\n\t\t\t\t\t(*p)--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tk=head;\n\t\t\t\t\thead=temp;\n\t\t\t\t\thead->next=k;\n\t\t\t\t\ti++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn head;\n}\n\nint check(__llst_int *head)\n{\n\t__llst_int *temp;\n\t\n\ttemp=head;\n\tif(temp->next)\n\t{\n\t\twhile(temp->next->next)\n\t\t{\n\t\t\tif(temp->a+1==temp->next->a && temp->a+2==temp->next->next->a)\n\t\t\t\treturn 1;\n\t\t\ttemp=temp->next;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n\tint ia = *(int *) a;\n\tint ib = *(int *) b;\n\n\treturn ia - ib;\n}\n\nint main() {\n\tint i, k, n, t, yes; \n\tstatic int tt[50], used[1001];\n\n\tscanf(\"%d\", &n);\n\tk = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &t);\n\t\tif (!used[t])\n\t\t\ttt[k++] = t;\n\t\tused[t] = 1;\n\t}\n\tqsort(tt, k, sizeof(*tt), compare);\n\tyes = 0;\n\tfor (i = 2; i < k; i++)\n\t\tif (tt[i - 2] + 1 == tt[i - 1] && tt[i - 1] + 1 == tt[i]) {\n\t\t\tyes = 1;\n\t\t\tbreak;\n\t\t}\n\tprintf(\"%s\\n\", yes ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b){\n\treturn (*(int *)a - *(int *)b);\n}\nint main(){\n\tint n,t[1001],i,j,found=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;++i){\n\t\tscanf(\"%d\",&t[i]);\n\t}\n\tqsort(t,n,sizeof(int),cmp);\n\tj=0;\n\t\n\tfor(i=1;i<n;++i){\n\t\tif(t[i]!=t[j]){\n\t\t\tt[++j] = t[i];\n\t\t}\n\t}\n\tn = j + 1;\n\tfor(i=0;i<n-2;++i){\n\t\tif(t[i+1]==(t[i]+1) && t[i+2]==(t[i+1]+1)){\n\t\t\tfound=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(found==1){\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{ int n,i,j,k,cnt=0,flag=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n int t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<i+3;j++)\n {\n if((a[j]-a[j-1]<=1)&&((a[j]-a[j-1]!=0)))\n cnt++;\n }\n if(cnt==2)\n {\n flag=1;\n break;\n }\n cnt=0;\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n}\n\n"}, {"source_code": "#include<stdio.h>\n#define T 1001\nint main() {\n\t//\u56e0\u4e3ati\u7684\u503c\u6700\u5927\u662f1000\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u7528exist\u65b9\u6cd5\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i<T;i++){\n\t\texist[i]=0;\n\t}\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\texist[t]=1;\n\t}\n\tfor(i=1;i<T-3;i++){\n\t\tif(exist[i] && exist[i+1] && exist[i+2]){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid leerbolas(int [], int);\nvoid ordenarbolas(int [], int, int);\nint compararbolas(int [], int);\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int V[n];\n leerbolas(V, n);\n ordenarbolas(V, 0, n-1);\n if(compararbolas(V, n)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n\nvoid leerbolas(int V[], int n){\n int i;\n for(i=0; i<n; i++){\n scanf(\"%d\", &V[i]);\n }\n}\n\nvoid ordenarbolas(int V[], int pri, int ult){\n int i, j, cen, piv, aux;\n cen=(pri+ult)/2;\n piv=V[cen];\n i=pri;\n j=ult;\n\tdo{\n while(V[i]<piv) i++;\n while(V[j]>piv) j--;\n if(i<=j){\n aux=V[i];\n V[i]=V[j];\n V[j]=aux;\n i++;\n j--;\n }\n\t}while(i<=j);\n\tif(pri<j){\n ordenarbolas(V, pri, j);\n\t}\n\tif(i<ult){\n ordenarbolas(V, i, ult);\n\t}\n}\n\nint compararbolas(int V[], int n){\n int i, validez=0;\n for(i=0; i<n-2; i++){\n if((V[i]!=V[i+1] && V[i+1]-V[i]<=2) && (V[i+1]!=V[i+2] && V[i+2]-V[i+1]<=2) && (V[i]!=V[i+2] && V[i+2]-V[i]<=2)){\n validez=1;\n }\n }\n return validez;\n}\n"}, {"source_code": "\n#include<stdio.h>\n\nint main(){\n int n,i,j,x=1;\n int a[50];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n } \n \n \n \n for(j=0;j<n;j++){\n if(((a[0]-a[j])<=2 && (a[0]-a[j])>0) || ((a[j]-a[0])<=2 && (a[j]-a[0])>0)){\n \n x++; \n if(x==3) break;\n }\n }\n \n if(x>=3) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n \nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(a[j]==a[j+1]) a[j]=0;\n }\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n-2;i++)\n {\n for(j=1;j<n-1;j++)\n {\n if(a[j]+1==a[j+1]&&a[j]-1==a[j-1])\n {\n s=1;\n break;\n }\n }\n if(s) break;\n }\n if(s) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\nvoid quicksort(int [], int, int);\nint main(){\n int i,j,k,n;\n scanf(\"%d\",&n);\n int ball[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&ball[i]);\n }\n quicksort(ball,0,n-1);\n i=0;\n j=1;\n\n while(i<n-2){\n\n while(ball[i]==ball[j])j++;\n if(fabs(ball[i]-ball[j])<=2){\n k=j+1;\n while(ball[j]==ball[k]){\n k++;\n if(k==n){\n printf(\"NO\");\n return 0;\n }\n }\n if(fabs(ball[j]-ball[k])<=2 && fabs(ball[i]-ball[k])<=2){\n printf(\"YES\");\n return 0;\n }\n }\n i=j;\n j=k;\n while(ball[j]==ball[k]){\n k++;\n if(k==n){\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\nvoid quicksort(int A[], int ini, int fin){\n int central = (ini + fin)/2;\n int pivote = A[central];\n int i=ini,j=fin,aux;\n do{\n while(A[i]<pivote) i++;\n while(A[j]>pivote) j--;\n if(i<=j){\n aux = A[i];\n A[i]=A[j];\n A[j]=aux;\n i++;\n j--;\n }\n }\n while(i<=j);\n if(ini<j){\n quicksort(A,ini,j);\n }\n if(fin>i){\n quicksort(A,i,fin);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int a,b[50],i,j,temp,k,r=0,count,flag=1;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<a-1;i++)\n {\n for(j=0;j<a-1;j++)\n {\n if(b[j]>b[j+1])\n {\n temp=b[j];\n b[j]=b[j+1];\n b[j+1]=temp;\n }\n }\n }\n for(i=0;i<a-2;i++)\n {\n count=1;\n for(j=i+1;j<a;j++)\n {\n k=b[j]-b[i];\n if(k<=2&&k>0&&r!=k)\n {\n count++;\n r=k;\n }\n }\n if(count>=3)\n {\n printf(\"YES\");\n flag=0;\n break;\n }\n }\n if(flag==1)\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define T 1001\nint main() {\n\t//\u56e0\u4e3ati\u7684\u503c\u6700\u5927\u662f1000\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u7528count\u65b9\u6cd5\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count[T];\n\tint i;\n\tfor(i=0;i<T;i++){\n\t\tcount[i]=0;\n\t}\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\tcount[t]++;\n\t}\n\tfor(i=1;i<T-3;i++){\n\t\tif(count[i]>0 && count[i+1]>0 && count[i+2]>0){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid quicksort(int v[],int ini,int fin);\nint main(){\n\tint i, n, encuentro=0;\n\tscanf(\"%d\",&n);\t\t\t\t\t\t\t\t\t\t//n es la cantidad de pelotas del oso\n\tint v[n];\t\t\t\t\t\t\t\t\t\t\t//dimensionamos un vector para almacenar los numeros contenidos en las pelotas\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&v[i]);\t\t\t\t\t\t\t\t//cargamos los valores de las pelotas\n\t}\n\tif(n>=3){\t\t\t\t\t\t\t\t\t\t\t//solo sera posible la operacion en caso de contar con 3 o mas pelotas\n\t\tquicksort(v,0,n-1);\t\t\t\t\t\t\t\t//llamo a la funcion quicksort\n\t}\n\ti=0;\n\twhile(encuentro==0 && i<n-2){\n\t\tif(v[i+2]-v[i+1]==1 && v[i+1]-v[i]==1){\t\t\t//verifico que haya tres pelotas con numeros consecutivos\n\t\t\tencuentro=1;\n\t\t}\n\t\ti++;\n\t}\n\tif(encuentro==1){\n\t\tputs(\"SI\");\n\t}else{\n\t\tputs(\"NO\");\n\t}\n\treturn 0;\n}\nvoid quicksort(int v[],int ini,int fin){\n\tint j,i,pivote,medio,aux;\n\tmedio=(ini+fin)/2;\n\ti=ini;\n\tj=fin;\n\tpivote=v[medio];\n\tdo{\n\t\twhile(v[i]<pivote){i++;}\n\t\twhile(v[j]>pivote){j--;}\t\n\t\tif(i<=j){\n\t\t\taux=v[i];\n\t\t\tv[i]=v[j];\n\t\t\tv[j]=aux;\n\t\t\ti++;\n\t\t\tj--;\n\t\t}\n\t}while(i<=j);\n\tif(ini<j){\n\t\tquicksort(v,ini,j);\n\t}\n\tif(i<fin){\n\t\tquicksort(v,i,fin);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i; j<n; j++)\n {\n if((tam[i]+1==tam[j]) || (tam[j]+1==tam[i]) || (tam[i]+2==tam[j]) || (tam[j]+2==tam[i]))\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else\n {\n menor=p2;\n mayor=p1;\n }\n for(k=j; k<n; k++)\n {\n if(((tam[k]==menor+2) && (tam[k]==mayor+1)) || ((tam[k]==menor+1) && (tam[k]==mayor-1)))\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int n,a[100],i,j,temp,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n }\n }\n for(i=0;i<n-2;i++)\n {\n if(a[i]!=a[i+1] && a[i+1]!=a[i+2] && a[i]!=a[i+2])\n {\n\n if(a[i+2]-a[i]<=2)\n {\n\n c++;\n\n }\n }}\n // printf(\"%d\",c);\n if(c>=1) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(tam[i]+1==tam[j] || tam[j]+1==tam[i] || tam[i]+2==tam[j] || tam[j]+2==tam[i])\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else if(p1>p2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k<n; k++)\n {\n if(tam[k]+2==menor || tam[k]+1==mayor)\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int balls,i,j,temp,size[1000];\n scanf(\"%d\",&balls);\n for(i=0; i<balls; i++)scanf(\"%d\",&size[i]);\n for (i=0; i<balls; i++)\n {\n for(j=0; j<(balls-i-1); j++)\n {\n if(size[j]>size[j+1])\n {\n size[j]^=size[j+1]^=size[j]^=size[j+1];\n }\n }\n }\n for (j= 0; j<balls; j++)\n {\n if(size[j+1]==size[j]+1)\n {\n if(size[j+2]==size[j+1]+1)\n {\n printf(\"Yes\");\n break;\n }\n else\n {\n printf(\"No\");\n break;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main()\n{\n\tint N;\n\tscanf(\"%d\",&N);\n\n\tint V[N];\n\n\tint I,J;\n\t \n\tfor (I=0;I<N;I++)\n\t{\t\n\t\tscanf(\"%d\",&V[I]);\t\n\t}\n\tint ban,auxx;\n\t\n\tint cont;\n\tfor( I=0;I<N;I++)//ordenar\n\t{\n\t\tfor(J=0;J<N-1-I;J++)\n\t\t{\n\t\t\tif (V[J]>V[J+1])\n\t\t\t{\n\t\t\t\tauxx = V[J];\n\t\t\t\tV[J] = V[J+1] ;\n\t\t\t\tV[J+1] = auxx;\n\t\t\t}\n\t\t}\t\n\t}\n\tint first=V[1];\n\tcont=1;\t\n\t\n\t//for( I=0; I<N && cont<3 ;I++){printf(\"%d,\",V[I]);}\n\t\n\tcont=1;\n\tint aux[3];\n\tfor( I=0; I<N-2 && cont<3 ;I++)\n\t{\n\t\taux[0]=V[I];\n\t\tcont=1;\n\t\tfor (J=0;J<N && cont<3 ;J++)\n\t\t{\n\t\t\tif(V[J]-aux[0]<=2 && V[J]!=aux[cont-1])\n\t\t\t{\n\t\t\t\taux[cont]=J;\n\t\t\t\tcont++;\n\t\t\t}\n\t\t\telse if (V[J]-aux[0]>2)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif (cont!=3)\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t\tprintf(\"YES\");\n\t}\n\t//printf(\"cont:%d\\n\",cont);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i;\n for(i=0; i<n; i++) {\n scanf(\"%d\",&a[i]);\n }\n int j;\n int swap;\n for (i = 0 ; i < ( n - 1 ); i++)\n {\n for (j = 0 ; j < n - i - 1; j++)\n {\n if (a[j] > a[j+1]) {\n swap=a[j];\n a[j] = a[j+1];\n a[j+1]= swap;\n }\n }\n }\n int x=0;\n for(i=0;i<n-2;i++)\n {\n if(a[i]+1==a[i+1] && a[i+1]+1==a[i+2])\n {\n printf(\"YES\\n\");\n x=1;\n break;\n }\n }\n if(x==0)\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\tfor(i = 0; i < n-3; i += 3){\n\t\tif(abs(balls[i]-balls[i+1]) < 3 && abs(balls[i+1]-balls[i+2]) < 3 && abs(balls[i]-balls[i+2]) < 3 && balls[i] != balls[i+1] && balls[i+1] != balls[i+2] && balls[i] != balls[i+2] ){\n\t\t\th = 1;\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\t\t\t\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\t\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[60], n;\n\nvoid swap(int *x, int *y){\n\tint temp;\n\ttemp = *x;\n\t*x = *y;\n\t*y = temp;\n}\n\nint partition(int left, int right){\n\tint pivot, i, j;\n\tpivot = a[left];\n\ti = right;\n\tfor(j=right; j>left; j--){\n\t\tif(a[j] >= pivot){\n\t\t\tswap(&a[j], &a[i]);\n\t\t\ti--;\n\t\t} \n\t}\n\tswap(&a[left], &a[i]);\n\treturn i;\n}\n\nvoid quick_sort(int left, int right){\n\tint p;\n\tif(left >= right) return;\n\telse{\n\t\tp = partition(left, right);\n\t\tquick_sort(left, p-1);\n\t\tquick_sort(p+1, right);\n\t}\n}\n\nint main(){\n\t\n\tint i, done=0;\n\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++) scanf(\"%d\", &a[i]);\n\tquick_sort(0, n-1);\n\tfor(i=1; i<n-1; i++)\n\t\tif(a[i]-a[i-1]==1 && a[i+1]-a[i]==1) done=1;\n\tif(done) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int n,i,a[55],b[1000],count=0;\n scanf(\"%d\",&n);\n\n for(i=1;i<=1000;i++)b[i]=0;\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n b[a[i]]++;\n }\n\n for(i=0;i<=1000;i++){\n if(b[i]>0 && b[i+1]>0 && b[i+2]>0){\n printf(\"YES\\n\");\n count=1;\n break;\n }\n }\n if(count==0)printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tint a[50],t;\n\tint n;scanf(\"%d\",&n);\n\tint i,j,count=0;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tqsort(a,n,sizeof(int),cmpfunc);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tcount=0; \n\t\tfor(j=i+1;j<i+3;j++)\n\t\t{\n\t\t\tif(a[j]-a[i]<=2 && a[j]-a[i]!=0 && a[j]!=a[j+1] && j<n)\n\t\t\t\tcount++;\n\t\t\tif(count==2){printf(\"YES\\n\");exit(0);}\n\t\t}\n\t}\n\tif(count!=2)printf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n//\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i])-balls[k] < 3){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\t\t\t\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\t\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main () {\n\n\tint n;\t\t\t\t\t\t\t\t// cantidad de bolas a ingresar\n\tint i;\t\t\t\t\t\t\t\t// indice para recorrer\n\tint j;\t\t\t\t\t\t\t\t// indice para recorrer\n\tint cont=0;\t\t\t\t\t\t\t// cuenta la cantidad de numeros distintos ingresados\n\tint ban;\t\t\t\t\t\t\t// bandera\n\t\n\t//do{\t\t\t\t\t\t\t\t// validacion\n\t\tscanf ( \"%d\", &n );\t\t\t\t\t// se ingresan la cantidad de bolas\n\t//} while( !(3 <=\u2009n && n <= 50) );\n\t\n\tint v[n];\t\t\t\t\t\t\t// vector de bolas y sus respectivos pesos, pueden haber bolas repetidas\n\n\tfor (i=0; i<n; i++) {\t\t\t\t\t\t// recorre para contar la cantidad de numeros sin repeticion\n\t\n\t\t//do{\t\t\t\t\t\t\t// validacion\n\t\t\tscanf ( \"%d\", &v[i] );\t\t\t\t// se ingresan las respectivas bolas\n\t\t//} while ( !((1 <=\u2009v[i]) && (v[i] <= 1000)) );\n\t\t\n\t\tcont++;\n\t\tfor ( j=0; j<i; j++ ) {\n\t\t\tif ( v[i]==v[j] ) {\n\t\t\t\tcont--;\n\t\t\t\tj=i;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tint b[cont];\t\t\t\t\t\t\t// bolas y sus respectivos pesos, sin haber bolas repetidas\n\tfor ( i=0; i<cont; i++ ) {\t\t\t\t\t// se inicializa a cero dicho vector\n\t\tb[i]=0;\n\t}\n\t\n\tfor ( i=0; i<n; i++ ) {\t\t\t\t\t\t// recorre el vector v para cargar los no repetidos en b\n\t\tban=1;\n\t\tfor ( j=0; (j<cont && ban!=0 && b[j]!=0); j++ ) {\t// recorre el vector b para cargar en el los no repetidos de v\n\t\t\tif ( v[i]==b[j] ) {\n\t\t\t\tban=0;\n\t\t\t}\n\t\t}\n\t\tif ( ban ) {\n\t\t\tb[j]=v[i];\n\t\t}\n\t}\n\n\tfor ( i=1; i<cont; i++ ) {\t\t\t\t\t// recorre b para ordenarlo por burbuja\n\t\tfor ( j=0; j<cont-i; j++ ) {\n\t\t\tif ( b[j]>b[j+1] ) {\t\t\t\t// si se cumple dicha condicion se intercambian las bolas\n\t\t\t\tb[j]=b[j]+b[j+1];\n\t\t\t\tb[j+1]=b[j]-b[j+1];\n\t\t\t\tb[j]=b[j]-b[j+1];\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor ( i=0; i<cont-2; i++ ) {\t\t\t\t\t// compara los numeros con sus dos siguientes para determinar si cumple\n\t\tif ( b[i+1]-b[i] <= 2 && b[i+2]-b[i] <= 2 && b[i+2]-b[i+1] <= 2 ) {\n\t\t\tban=1;\n\t\t\ti=cont-2;\n\t\t}\n\t}\n\t\n\tif ( ban ) {\t\t\t\t\t\t\t// si hay uno que cumple ban=1 y se imprime SI caso contrario NO\n\t\tprintf( \"YES\" );\n\t}else{\n\t\tprintf( \"NO\" );\n\t}\n\t\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n{\n scanf(\"%d\",&t);\n a[i]=t;\n\n}\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n if(a[i]>a[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i<n;i++)\n if(a[i+2]-a[i]==2 &&a[i+1]-a[i]!=0&&a[i+2]-a[i+1]!=0)\n cnt=1;\n if(cnt==1) printf(\"yes\"); else printf(\"no\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <time.h>\n\n#define lli long long int\n#define MAX INT_MAX\n#define sd second\n#define fs first\n#define endll '\\n'\n#define PI acos(-1)\n#define mp make_pair\n#define pb push_back\n#define best 1000000007\n#define FOR(i,a,b) for(int i=a;i<=b;i++)\n#define ROF(i,a,b) for(int i=a;i>b;i--)\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\n#define ort(a,b) (a+b)/2\n#define carp(a,b) (a)*(b)\n#include<stdio.h>\n\t\tint main (){\n\n\t\t\tint as[1005],i,j,arr[1005],x,min=0,t=0;\n\t\t\tscanf(\"%d\",&x);\n\t\t\tfor(i=0;i<x;i++)\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\tfor(i=0; i<x; i++)\n\t\t{\n\t\t\tfor(j=0;j<x;j++){\n\t\t\t\tif(arr[j]<arr[min])\n\t\t\t\t\tmin=j;\t\t\n\t\t\t}\n\t\t\tas[t]=arr[min];\n\t\t\tt++;\n\n\t\t\tarr[min] = 100000000;\n\t\t}\n\t\tfor(i=0;i<x;i++){\n\n\t\t\n\t\tif(as[i]+1==as[i+1] && as[i+1]+1==as[i+2]){\n\t\t\tprintf(\"YES\");\n\t\treturn 0;\n\t\t}\n\t\t}\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, posible, i;\n posible = 0;\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n int dif;\n for(i=0; i<n-2; i++)\n if(array[i+2]-array[i] <= 2){\n posible = 1;\n printf(\" YES\");\n i=n;//para salir del bucle\n }\n\n if(posible == 0)\n printf(\"NO\");\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(tam[i]+1==tam[j] || tam[j]+1==tam[i] || tam[i]+2==tam[j] || tam[j]+2==tam[i])\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else if(p1>p2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k<n; k++)\n {\n if(tam[k]+2==menor || tam[k]+1==mayor)\n {\n if(tam[k] != menor && tam[k] != mayor)\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n\n\n\nint n;\nint arr[53],i;\nscanf(\"%d\",&n);\nfor( i=0;i<n;i++)\n{\nscanf(\"%d\",&arr[i]);\n}\nqsort(arr, n, sizeof(int), cmpfunc);\n\nint counts =0;\nint flag =0;\nfor(i =1;i<n;i++)\n{\n\nif(arr[i]!=arr[i-1] && (arr[i] == (arr[i-1]+1)))\ncounts++;\nelse\ncounts=0;\nif(counts ==2)\n{\nprintf(\"YES\");\nflag =1;\nbreak;\n}\n}\nif(flag==0)\nprintf(\"NO\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n // 5 5 5 6 7\nint main()\n{\n int n, aux;\n scanf(\"%d\", &n);\n int bolas[n];\n int i, j;\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &bolas[i]);\n }\n for(i=1; i<n; i++)\n\t{\n\t\tfor(j=0; j<n-i; j++)\n\t\t{\n\t\t\tif(bolas[j]>bolas[j+1])\n\t\t\t{\n\t\t\t aux = bolas[j+1];\n\t\t\t\tbolas[j+1] = bolas[j];\n\t\t\t\tbolas[j] = aux;\n\t\t\t}\n\t\t}\n\t}\n\tchar si[] = \"YES\";\n\tchar no[] = \"NO\";\n int b = 0;\n\tif(n > 3)\n {\n for(i = 0; i < n-2; i++)\n {\n if((bolas[i]+1 == bolas[i+1])&&(bolas[i]+2 == bolas[i+2])) b = 1;\n }\n }else if(n == 3) if((bolas[i]+1 == bolas[i+1])&&(bolas[i]+2 == bolas[i+2])) b = 1;\n\n if (b == 1)\n {\n printf(\"%s\", si);\n }else\n {\n printf(\"%s\", no);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid quick(int V[], int inicio, int fin);\n\nint main(){\n\n int n, x, F = 0;\n\n do{\n\n fflush(stdin);\n scanf(\"%d\", &n);\n\n }while(!(n >= 3 && n <= 50));\n\n int peso[n];\n\n for(x = 0; x < n; x++){\n\n do{\n\n scanf(\"%d\", &peso[x]);\n\n }while(!(n >= 1 && n <= 1000));\n\n }\n\n quick(peso, 0, n-1);\n\n for(x = 0; x < n; x++){\n\n if(peso[x]+1 == peso[x+1] && peso[x]+2 == peso[x+2]){\n\n F++;\n break;\n\n }\n\n }\n\n if(F){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n return 0;\n\n}\n\n\nvoid quick(int V[], int inicio, int fin){\n\n int x, y, centro, pivot;\n\n centro = (inicio + fin) / 2;\n pivot = V[centro];\n\n x = inicio;\n y = fin;\n\n do{\n\n while(V[x] < pivot){\n x++;\n }\n\n while(V[y] > pivot){\n y--;\n }\n\n if(x <= y){\n\n int t;\n\n t = V[x];\n V[x] = V[y];\n V[y] = t;\n\n x++;\n y--;\n\n }\n\n }while(x <= y);\n\n if(inicio < y){\n quick(V, inicio, y);\n }\n\n if(x < fin){\n quick(V, x, fin);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int n,i,j,t,m,p;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<n;++i){\n for(j=n-1;j>=i;--j){\n if(a[j-1]>a[j]){\n t=a[j-1];\n a[j-1]=a[j];\n a[j]=t;\n }\n }\n }\n for(j=0;j<n;j++){\n m=a[j+1]-a[j];\n p=a[j+2]-a[j];\n if(m==1&&p==2) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cnt[2000];\n\nint main()\n{\n int n, x;\n scanf(\"%d\", &n);\n while (n--){\n scanf(\"%d\", &x);\n cnt[x]++;\n if (((cnt[x - 1]) && (cnt[x - 2])) ||\n ((cnt[x + 1]) && (cnt[x + 2])) ||\n ((cnt[x - 1]) && (cnt[x + 1]))) printf(\"YES\\n\");\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\nvoid quicksort(int [], int, int);\nint main(){\n int i,j,k,n;\n scanf(\"%d\",&n);\n int ball[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&ball[i]);\n }\n quicksort(ball,0,n-1);\n i=0;\n j=1;\n\tk=3;\n while(i<n-2){\n\n while(ball[i]==ball[j]){\n j++;\n if(j==n-1){\n printf(\"NO\");\n return 0;\n }\n }\n if(fabs(ball[i]-ball[j])<=2){\n k=j+1;\n while(ball[j]==ball[k]){\n k++;\n if(k==n){\n printf(\"NO\");\n return 0;\n }\n }\n if(fabs(ball[j]-ball[k])<=2 && fabs(ball[i]-ball[k])<=2){\n printf(\"YES\");\n return 0;\n }\n }\n i=j;\n j=k;\n while(ball[j]==ball[k]){\n k++;\n if(k==n){\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\nvoid quicksort(int A[], int ini, int fin){\n int central = (ini + fin)/2;\n int pivote = A[central];\n int i=ini,j=fin,aux;\n do{\n while(A[i]<pivote) i++;\n while(A[j]>pivote) j--;\n if(i<=j){\n aux = A[i];\n A[i]=A[j];\n A[j]=aux;\n i++;\n j--;\n }\n }\n while(i<=j);\n if(ini<j){\n quicksort(A,ini,j);\n }\n if(fin>i){\n quicksort(A,i,fin);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n{\n scanf(\"%d\",&t);\n a[i]=t;\n\n}\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n if(a[i]>a[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i<n;i++)\n if(a[i+2]-a[i]==2 &&a[i+1]-a[i]!=0&&a[i+2]-a[i+1]!=0)\n cnt=1;\n if(cnt==1) printf(\"yes\"); else printf(\"no\");\n}\n\n"}, {"source_code": "#include<stdio.h>\n\n\nvoid qs(int lista[], int limizq, int limder );\n\n\nint main(){\n\t\n\tint i, b, n,resta,cont;\n\tscanf(\"%d\", &n);\n\t\n\tint lista[n];\n\t\n\tfor(i=0; i<n; i++){\n\t\tscanf(\"%d\",&lista[i]);\n\t\t\n\t}\n\tqs(lista,0,n);\n\t\n\tfor(i=0; i<n-2; i++){\n\t\tresta = lista[i+1]-lista[i];\n\t\tif(resta==1){\n\t\t\t\n\t\t\tresta=lista[i+2]-lista[i+1];\n\t\t\tif(resta==1){\n\t\t\t\tb=1;\n\t\t\t}\n\t\t}\n\t\tif(b==1){\n\t\t\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif(b==1){\n\t\tputs(\"YES\");\n\t}else{\n\t\tputs(\"NO\");\n\t}\n\t\n\t\n\n\treturn 0;\n}\n\n\n\n\nvoid qs(int lista[], int limizq, int limder){\n\t\n\tint izq, der, temp , pivot;\n\t\n\tizq=limizq;\n\t\n\tder=limder;\n\t\n\tpivot=lista[(izq+der)/2];\n\t\n\tdo{\n\t\twhile(lista[izq]<pivot && izq<limder) izq++;\n\t\twhile(lista[der]>pivot && der>limizq) der--;\n\t\t\n\t\tif(izq<=der){\n\t\t\ttemp=lista[izq];\n\t\t\tlista[izq]=lista[der];\n\t\t\tlista[der]=temp;\n\t\t\tizq++;\n\t\t\tder--;\n\t\t}\n\t}while(izq<=der);\n\t\n\tif(limizq<der){\n\t\tqs(lista, limizq,der);\n\t}\n\tif(limder>izq){\n\t\tqs(lista,izq,limder);\n\t}\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n char answer[4]=\"NO\";\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n for(i=0; i<n; i++)\n printf(\"%d\", array[i]);\n\n for(i=0; i < n-2; i++){\n if(array[i+2]-array[i] <= 2){\n strcpy(answer,\"YES\");\n i=n;//para salir del bucle\n }\n }\n printf(\"%s\", answer);\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n#include<time.h>\n\n#define SORT while(t--){for(i=0;i<x-1;i++)if(arr[i]>arr[i+1]){o=arr[i];arr[i]=arr[i+1];arr[i+1]=o;}}\n#define R return 0;\n#define and &&\n#define or ||\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\nmain(){\n\tint arr[105],x,i,t,o;\n\tscanf(\"%d\",&x);\n\tfor(i=0;i<x;i++)\n\t\tscanf(\"%d\",&arr[i]);\n\tt=x;\n\tSORT\n\tfor(i=0;i<x;i++){\n\t\tif(arr[i]==arr[i+1]-1 and arr[i]==arr[i+2]-2 and arr[i+1]-1==arr[i+2]-2){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(a[j]==a[j+1]) a[j]=0;\n }\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n-2;i++)\n {\n for(j=1;j<n-1;j++)\n {\n if(a[j]+1==a[j+1]&&a[j]-1==a[j-1])\n {\n s=1;\n break;\n }\n }\n if(s) break;\n }\n if(s) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, posible, i;\n posible = 0;\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n int dif;\n for(i=0; i<n-2; i++)\n if(array[i+2]-array[i] <= 2){\n posible = 1;\n printf(\"YES\");\n i=n;//para salir del bucle\n }\n\n if(posible == 0)\n printf(\"NO\");\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "/*\n En geometria analitica hay\n un teorema que dice que tres puntos\n forma un triangulo y si solo si el\n determinante\n Area = 1/2* | x1 y1 1 |\n | x2 y2 1 |\n | x3 y3 1 |\n es distinto de cero\n*/\n\nint asc(const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\ntypedef struct Punto\n{\n int x, y;\n}Punto;\n\n//determinante\nint det(int x1, int y1, int x2, int y2, int x3, int y3)\n{\n return x1*(y2 - y3) - y1*(x2 - x3) + 1*(x2*y3 - y2*x3);\n}\n\n//calcula la catindad de triangulos\nint cuantosTriangulos(Punto puntos[], int n)\n{\n int resultado = 0;\n\n //cuando el determinante de tres puntos es distinto de cero\n //aumentamos resultado\n for (int i=0; i<n; i++)\n for (int j=i+1; j<n; j++)\n for (int k=j+1; k<n; k++)\n if (det(puntos[i].x, puntos[i].y, puntos[j].x,\n puntos[j].y, puntos[k].x, puntos[k].y))\n resultado++;\n\n return resultado;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n Punto puntos[n];\n for(int i=0; i<n; ++i)\n {\n scanf(\"%d %d\",&puntos[i].x,&puntos[i].y);\n }\n printf(\"%d\", cuantosTriangulos(puntos, n));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n, i, a, b[1111], yes = 0;\n\n\tfor (i = 0; i < 1112; i++) {\n\t\tb[i] = 0;\n\t}\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tb[a] = 1;\n\t}\n\tfor (i = 0; i < 1112; i++) {\n\t\tif (b[i] == 1 && b[i + 1] == 1 && b[i + 2] == 1) { yes = 1; break; }\n\t}\n\tputs(yes == 1 ? \"YES\" : \"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0,midindex=0,i,j,temp;\n scanf(\"%d\",&n);\n int a[1000];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n midindex=i;\n for(j=i+1;j<n;j++)\n {\n if(a[midindex]>a[j])\n midindex=j;\n }\n if(midindex!=i)\n {\n temp=a[midindex];\n a[midindex]=a[i];\n a[i]=temp;\n }\n }\n for(i=0;i<=n-3;i++)\n {\n if(a[i]+1==a[i+1]&&a[i]+2==a[i+2])\n flag++;\n }\n if(flag>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3 && balls[i] != balls[j]){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i])-balls[k] < 3 && abs(balls[j] - balls[k]) < 3 && balls[i] != balls[k]){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\th = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint verificar(int a, int b, int c);\nvoid ordenarAscendente(int lista[], int n);\n\nint main() {\n\tint n, i, aux, x, j, N=0;\n\tscanf(\"%d\", &n);\n\tint lista[n];\n\t\n\t\n\tfor(i=0; i<n; ++i) {\n\t\tscanf(\"%d\", &x);\n\t\tif(i==0) {\n\t\t\tlista[0]=x;\n\t\t\t++N;\n\t\t}else {\n\t\t\taux=1;\n\t\t\tfor(j=0; j<N; ++j) {\n\t\t\t\tif(lista[j]==x) {\n\t\t\t\t\taux=0;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(aux) {\n\t\t\t\t++N;\n\t\t\t\tlista[N-1]=x;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tordenarAscendente(lista, N);\n\t\n\tfor(i=0; i<=N-3; ++i) {\n\t\taux=verificar(lista[i], lista[i+1], lista[i+2]);\n\t\tif(aux) break;\n\t}\n\t\n\tif(aux) printf(\"YES\");\n\telse printf(\"NO\");\n\t\n\treturn 0;\n}\n\n\n\n\n\nvoid ordenarAscendente(int lista[], int n) {\n\t/*ordenacion burbuja*/\n\tint interruptor=1;\n\tint pasada, i, aux;\n\tfor(pasada=0; pasada<=n-2 && interruptor; ++pasada) {\n\t\tinterruptor=0;\n\t\tfor(i=0; i<n-pasada-1; ++i) {\n\t\t\tif(lista[i]>lista[i+1]) {\n\t\t\t\tinterruptor=1;\n\t\t\t\taux=lista[i];\n\t\t\t\tlista[i]=lista[i+1];\n\t\t\t\tlista[i+1]=aux;\n\t\t\t}\n\t\t}\n\t}\n}\n\n\nint verificar(int a, int b, int c) {\n\tif(fabs(a-b)<=2.00 && fabs(a-c)<=2.00 && fabs(b-c)<=2.00) return 1;\n\telse return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nvoid quicksort(int arr[], int first, int last)\n{\n int i = first, j = last, pivot;\n pivot = arr[(first + last)/2];\n do\n {\n while (arr[i] < pivot){\n i++;\n }\n while(arr[j] > pivot){\n j--;\n }\n \n if(i <= j)\n {\n int temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n i++;\n j--;\n }\n }while(i <= j);\n if(first < j) quicksort(arr, first, j);\n if(last > i) quicksort(arr, i, last);\n}\n\nint main(void)\n{\n int n, num1, num2, num3, j;\n scanf(\"%d\", &n);\n int array[n];\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &array[i]);\n }\n quicksort(array, 0, n-1);\n for(int i = 0; i < n; i++)\n {\n num1 = array[i];\n for(j = i + 1; j < n && array[j] == array[i]; j++);\n if(j < n)\n {\n num2 = array[j];\n if(num1 + 1 == num2)\n {\n for(j = j + 1; j < n && array[j] == num2; j++);\n if(j < n)\n {\n num3 = array[j];\n if(num3 - 2 == num1)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n printf(\"%d %d %d\\n\", num1, num2, num3);\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,t,i,j;\n\tscanf(\"%d\",&n);\n\tint ara[1000];\n\tint a[1000];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=n-1;i>=0;i--){\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (ara[j]>ara[j+1]){\n\t\t\t\tt=ara[j];\n\t\t\t\tara[j]=ara[j+1];\n\t\t\t\tara[j+1]=t;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (i=0;i<n-2;i++){\n\t\tif((ara[i+1]-ara[i])==1 && (ara[i+2]-ara[i+1])==1){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0,midindex=0,i,j,temp;\n scanf(\"%d\",&n);\n int a[1000];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n midindex=i;\n for(j=i+1;j<n;j++)\n {\n if(a[midindex]>a[j])\n midindex=j;\n }\n if(midindex!=i)\n {\n temp=a[midindex];\n a[midindex]=a[i];\n a[i]=temp;\n }\n }\n for(i=0;i<=n-3;i++)\n {\n if(a[i]+1==a[i+1]&&a[i]+2==a[i+2])\n flag++;\n }\n if(flag>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, posible, i;\n posible = 0;\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n int dif;\n for(i=0; i<n-2; i++)\n if(array[i+2]-array[i] <= 2){\n posible = 1;\n printf(\"YES\");\n i=n;//para salir del bucle\n }\n\n if(posible == 0)\n printf(\"NO\");\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int x,i,j,t,n,a[55];\n\n scanf(\"%d\",&x);\n\n for(i=0;i<x;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<x;i++)\n for(j=i+1;j<x;j++)\n if(a[i]==a[j])\n a[j]=0;\n for(i=1;i<x;i++)\n for(j=x-1;j>=i;j--)\n if(a[j-1]>a[j]){\n t=a[j-1];\n a[j-1]=a[j];\n a[j]=t;\n }\n n=0;\n for(i=1;i<x-1;i++){\n if(((a[i]-a[i-1])==(a[i+1]-a[i]))&&a[i-1]){\n n=1;\n break;\n }\n }\n if(n)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n, aux;\n scanf(\"%d\", &n);\n int bolas[n];\n int i, j;\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &bolas[i]);\n }\n for(i=1; i<n; i++)\n\t{\n\t\tfor(j=0; j<n-i; j++)\n\t\t{\n\t\t\tif(bolas[j]>bolas[j+1])\n\t\t\t{\n\t\t\t aux = bolas[j+1];\n\t\t\t\tbolas[j+1] = bolas[j];\n\t\t\t\tbolas[j] = aux;\n\t\t\t}\n\t\t}\n\t}\n\tchar si[] = \"S\ufffd\";\n\tchar no[] = \"NO\";\n int b = 0;\n\tif(n > 3)\n {\n for(i = 0; i < n-3; i++)\n {\n if((bolas[i]+1 == bolas[i+1])&&(bolas[i]+2 == bolas[i+2])) b = 1;\n }\n }else if(n == 3) if((bolas[i]+1 == bolas[i+1])&&(bolas[i]+2 == bolas[i+2])) b = 1;\n\n if (b == 1)\n {\n printf(\"%s\", si);\n }else\n {\n printf(\"%s\", no);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n char answer[4]=\"NO\";\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n\n for(i=0; i < n-2; i++){\n if(array[i+2]-array[i] <= 2){\n strcpy(answer,\"YES\");\n i=n;//para salir del bucle\n }\n }\n printf(\"%s\", answer);\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0,midindex=0,i,j,temp;\n scanf(\"%d\",&n);\n int a[1000];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n midindex=i;\n for(j=i+1;j<n;j++)\n {\n if(a[midindex]>a[j])\n midindex=j;\n }\n if(midindex!=i)\n {\n temp=a[midindex];\n a[midindex]=a[i];\n a[i]=temp;\n }\n }\n for(i=0;i<=n-3;i++)\n {\n if(a[i]+1>=a[i+1]||a[i]+2>=a[i+2])\n flag++;\n }\n if(flag>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,c[100],i,j,t,b[100] ;\n scanf(\"%d\",&n);\n for(j=0; j<n ; j++)\n {\n scanf(\"%d\",&c[j]);\n }\n for(i=1; i<=n ; i++)\n {\n for(j=0; j<=n-1-i ; j++)\n {\n if(c[j]>c[j+1])\n {\n\n t=c[j];\n c[j]=c[j+1];\n c[j+1]=t;\n }\n }\n }\n j=0;\n for(i=0 ; i<n-1 ; i++)\n {\n if(c[i]!=c[i+1])\n {\n b[j]=c[i];\n j++;\n }\n }\n for(i=0 ; i<j-1 ; i++)\n {\n if(b[i]+2==b[i+2]&&b[i]+1==b[i+1])\n {\n n=1;\n break;\n }\n }\n if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,i,j,temp;\n scanf(\"%I64d\",&n);\n long long int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[j]==0)\n continue;\n else\n {\n a[i]=a[j];\n a[j]=0;\n break;\n }\n }\n }\n }\n /*for(i=0;i<n;i++)\n {\n printf(\"%I64d \",a[i]);\n }\n return 0;*/\n for(i=0;i<n;i++)\n {\n if(a[i+1]==0||a[i+2]==0)\n break;\n if((a[i+1]-a[i])==(a[i+2]-a[i+1])&&(a[i+1]-a[i])<3&&(a[i+2]-a[i+1])<3)\n {\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n\n printf(\"NO\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nint main(){\n int i,k,j,n,t,tmp,f,m=1,s=0;\n char a[51][6];int y[51];\n\n scanf(\"%d\",&t);\n for(i=0;i<t;i++){\n scanf(\"%s\",a[i]);\n }\n for(j=0;j<t;j++){\n for(k=strlen(a[j])-1;k>=0;k--){\n s+=(a[j][k]-'0')*m;\n m*=10;\n }\n y[j]=s;\n s=0;m=1;\n }\n for(i=0;i<t;i++){\n for(k=i+1;k<t;k++){\n if(y[i]>y[k]){\n tmp=y[i];\n y[i]=y[k];\n y[k]=tmp;\n }\n }\n }\n for(j=0;j<t;j++){\n\n if((y[j]-y[j-1]==1)&&(y[j+1]-y[j]==1)){\n f=1;\n break;\n }\n else f=2;\n\n }\n if(f==1) printf(\"YES\");\n else if(f==2) printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint puede(unsigned int v[], int n);\nint hay(unsigned int v[],int x, int pos, int ult);\n\n\nint main(){\n\tint n;\n\n\n\tscanf(\"%d\",&n);\n\n\tunsigned int v[n];\n\n\tfor(int i=0; i<n; i++){\n\t\tscanf(\"%u\",&v[i]);\n\t}\n\n\tn = puede(v, n);\n\n\tif(n){\n\t\tputs(\"YES\");\n\t}else{\n\t\tputs(\"NO\");\n\t}\n\treturn 0;\n}\n\nint puede(unsigned int v[], int n){\nint c=0,j,i,b;\n\n\tfor(i=0; i<n; i++){\n\t\tfor(j=0;j<n-i;j++){\n\t\t\tif(v[i]>v[j]){\n\t\t\t\tb=v[i];\n\t\t\t\tv[i]=v[j];\n\t\t\t\tv[i]=b;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(i=0; i<n; i++){\n\t\n\t\tif(hay(v, -2,i,n )){\n\t\t\tc++;\n\t\t\tb=0;\n\t\t}\n\n\t\tif(hay(v, -1 ,i,n)){\n\t\t\tc++;\n\t\t\tb=1;\n\t\t}\n\n\t\tif(hay(v, 0 ,i,n)){\n\t\t\tc++;\n\t\t}\n\n\t\tif(hay(v, 1,i,n ) && b != 0){\n\t\t\tc++;\n\t\t}\n\n\t\tif(hay(v, 2,i,n ) && b != 1){\n\t\t\tc++;\n\t\t}\n\t\tif(c>=2){\n\t\t\treturn 1;\n\t\t}\n\t\tc=0;\n\t}\n\n\treturn 0;\n}\n\nint hay(unsigned int v[],int x, int pos, int ult){\nint i;\n\n\tfor(i=0; i < ult ;i++ ){\n\t\tif(pos != i){\n\t\t\tif(v[pos] - v[i] == 2){\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nvoid quicksort(int arr[], int first, int last)\n{\n int i = first, j = last, pivot;\n pivot = arr[(first + last)/2];\n do\n {\n while (arr[i] < pivot){\n i++;\n }\n while(arr[j] > pivot){\n j--;\n }\n \n if(i <= j)\n {\n int temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n i++;\n j--;\n }\n }while(i <= j);\n if(first < j) quicksort(arr, first, j);\n if(last > i) quicksort(arr, i, last);\n}\n\nint main(void)\n{\n int n, num1, num2, num3, j;\n scanf(\"%d\", &n);\n int array[n];\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &array[i]);\n }\n quicksort(array, 0, n-1);\n for(int i = 0; i < n; i++)\n {\n num1 = array[i];\n for(j = i + 1; j < n && array[j] == array[i]; j++);\n if(j < n)\n {\n num2 = array[j];\n if(num1 + 1 == num2)\n {\n for(j = j + 1; j < n && array[j] == num2; j++);\n if(j < n)\n {\n num3 = array[j];\n if(num3 - 2 == num1)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n printf(\"%d %d %d\\n\", num1, num2, num3);\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nvoid leerbolas(int [], int);\nvoid ordenarbolas(int [], int, int);\nint compararbolas(int [], int);\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int V[n];\n leerbolas(V, n);\n ordenarbolas(V, 0, n-1);\n if(compararbolas(V, n)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n\nvoid leerbolas(int V[], int n){\n int i;\n for(i=0; i<n; i++){\n scanf(\"%d\", &V[i]);\n }\n}\n\nvoid ordenarbolas(int V[], int pri, int ult){\n int i, j, cen, piv, aux;\n cen=(pri+ult)/2;\n piv=V[cen];\n i=pri;\n j=ult;\n\tdo{\n while(V[i]<piv) i++;\n while(V[j]>piv) j--;\n if(i<=j){\n aux=V[i];\n V[i]=V[j];\n V[j]=aux;\n i++;\n j--;\n }\n\t}while(i<=j);\n\tif(pri<j){\n ordenarbolas(V, pri, j);\n\t}\n\tif(i<ult){\n ordenarbolas(V, i, ult);\n\t}\n}\n\nint compararbolas(int V[], int n){\n int i, validez=0;\n for(i=0; i<n-2; i++){\n if((V[i]!=V[i+1] && V[i+1]-V[i]<=2) && (V[i+1]!=V[i+2] && V[i+2]-V[i+1]<=2) && (V[i]!=V[i+2] && V[i+2]-V[i]<=2)){\n validez=1;\n }\n }\n return validez;\n}\n"}, {"source_code": "/*\n Bear and three balls\n Autor: francisco.bogado\n Fecha: 19-05-2018\n*/\n\n#include<stdio.h>\n#include<stdlib.h> //se importa porque se usara la funcion qsort de esta libreria\n\n\n//prototipos de funciones\nshort int repartirBolas(int * vector , const int dim);\nint cmpfunc (const void * a, const void * b);\nvoid cargarVector(const int dim, int vector[dim]);\nvoid input(int * k);\n\n//funcion principal\nint main(){\n\tint k,i;\n\t\n\tinput(&k);\n\tint bolas[k];\n\tcargarVector(k, bolas);\n\tqsort(bolas, k, sizeof(int), cmpfunc);//funcion que ordena el vector\n printf(\"%s\", repartirBolas(bolas,k)?\"YES\":\"NO\");\n\treturn 0;\n}\n\n//funcion de comparacion que utiliza el qsort\nint cmpfunc (const void * a, const void * b) {\n return ( *(int*)a - *(int*)b );\n}\n\n//se encarga de la carga de los elementos del vector\nvoid cargarVector(const int dim, int vector[dim]){\n int i;\n for(i=0;i<dim;i++){\n scanf(\"%d\",&vector[i]);\n }\n}\n\n//se encarga de leer la cantidad de bolas\nvoid input(int * k){\n do{\n scanf(\"%d\", k);\n }while(*k > 50 || *k < 3);\n}\n\n//funcion que verifica que las bolas no sean repetidas ni esten separadas por mas de dos lugares\nshort int repartirBolas(int *v , const int dim ){\n\tint i;\n\tint retorna = 0;\n\tfor( i = 0 ; i < dim - 2; i ++ ){\n\t\tif( ( v[i] + 1 == v[i + 1] ) && ( v[i] + 2 == v[i + 2] && v[i] != v[i+1] && v[i+1] != v[i+2] ) ){\n\t\t\tretorna = 1;\n\t\t\ti=dim -3;\n\t\t}\n\t}\n\treturn retorna;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n char answer[4]=\"NO\";\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n\n for(i=0; i < n-2; i++){\n if(array[i+2]-array[i] <= 2){\n strcpy(answer,\"YES\");\n i=n;//para salir del bucle\n }\n }\n printf(\"%s\", answer);\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <time.h>\n\n#define lli long long int\n#define MAX INT_MAX\n#define sd second\n#define fs first\n#define endll '\\n'\n#define PI acos(-1)\n#define mp make_pair\n#define pb push_back\n#define best 1000000007\n#define FOR(i,a,b) for(int i=a;i<=b;i++)\n#define ROF(i,a,b) for(int i=a;i>b;i--)\n#define buyuk(a,b) (a<b)? b:a\n#define kucuk(a,b) (a<b)? a:b\n#define ort(a,b) (a+b)/2\n#define carp(a,b) (a)*(b)\n#include<stdio.h>\n\t\tint main (){\n\n\t\t\tint as[1005],i,j,arr[1005],x,min=0,t=0;\n\t\t\tscanf(\"%d\",&x);\n\t\t\tfor(i=0;i<x;i++)\n\t\t\tscanf(\"%d\",&arr[i]);\n\t\tfor(i=0; i<x; i++)\n\t\t{\n\t\t\tfor(j=0;j<x;j++){\n\t\t\t\tif(arr[j]<arr[min])\n\t\t\t\t\tmin=j;\t\t\n\t\t\t}\n\t\t\tas[t]=arr[min];\n\t\t\tt++;\n\n\t\t\tarr[min] = 100000000;\n\t\t}\n\t\tfor(i=0;i<x;i++){\n\n\t\t\n\t\tif(as[i]+1==as[i+1] && as[i+1]+1==as[i+2]){\n\t\t\tprintf(\"YES\");\n\t\treturn 0;\n\t\t}\n\t\t}\n\t\tprintf(\"NO\");\n\t\t\n\t}\n\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n\n int ball1, ball3, flag, h;\n ball1 = ball3 = flag = h = 0;\n\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n\n if( n >= 3){\n for(h = 0; h < n-2; h++){\n ball1 = array[h];\n ball3 = array[h+2];\n if( (ball3-ball1) <= 2){\n flag = 1;\n h=n;\n }\n }//end for\n\n }//end if\n\n if(flag == 0)\n printf(\"NO\");\n else\n printf(\"YES\");\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\n\nint comp(const void *a, const void *b){\n\tconst int *da = (const int*)a;\n\tconst int *db = (const int*)b;\n return *da - *db;\n}\n\nint main(){\n int n,i,flag=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&arr[i]);\n }\n qsort(arr,n,sizeof(int),comp);\n for(i=2;i<n;i++){\n if(arr[i]-arr[i-2] <= 2 && arr[i-2]!=arr[i-1] && arr[i-1]!=arr[i]){\n flag = 1;\n break;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <stdbool.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n],i,b[1001];\n memset(b,0,n*sizeof(int));\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n b[a[i]]=1;\n }\n int k=0,c[n];\n for(i=0;i<1001;i++)\n if(b[i]==1)\n c[k++]=i;\n for(i=0;i<k-2;i++)\n {\n if(c[i+1]-c[i]==1&&c[i+2]-c[i+1]==1)\n break;\n }\n if(i<k-2)\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nvoid quicksort( int v[] , int inicio , int fin );\nvoid leerV( int v[] , int tamanio );\nint canGivingGifts( int v[] , int tamanio );\n\nint main(){\n\n int n;\n scanf( \"%d\" , &n );\n\n int v[ n ];\n leerV( v , n );\n\n quicksort( v , 0 , n - 1 ); /* Ordena el vector de mayor a menor*/\n\n if( canGivingGifts( v , n ) )\n printf( \"YES\" );\n\n else\n printf( \"NO\" );\n\n return 0;\n}\n\nint canGivingGifts( int v[] , int tamanio ){\n\n int r = 0;\n int i;\n\n for( i = 0 ; i < tamanio - 2 ; i++ ){\n\n if( ( v[ i ] == v[ i + 1 ] + 1 ) && ( v[ i ] == v[ i + 2 ] + 2 ) ){\n\n r = 1;\n break;\n\n }\n }\n\n return r;\n}\n\nvoid leerV( int v[] , int tamanio ){\n\n int i;\n\n for( i = 0 ; i < tamanio ; i++ )\n scanf( \"%d\" , &v[ i ] );\n\n}\n\nvoid quicksort( int v[] , int inicio , int fin ){ /* se pasa como argumento el vector a ordenar, la posicion del inicio del vector, y el vector de la ultima */\n\n void swap( int *a , int *b );\n int i , j , pivote;\n\n if( inicio < fin ){\n\n i = inicio;\n j = fin;\n pivote = v[ ( inicio + fin ) / 2 ];\n\n do{\n\n while( v[ i ] > pivote )i++;\n while( v[ j ] < pivote )j--;\n\n if( i <= j ){\n\n swap( &v[ i ] , &v[ j ] );\n\n if( i == pivote )\n pivote = j;\n\n else if( j == pivote )\n pivote = i;\n\n i++;\n j--;\n\n }\n }while( i <= j );\n\n if( inicio < j )\n quicksort( v , inicio , j );\n\n if( i < fin )\n quicksort( v , i , fin );\n\n }\n}\n\nvoid swap( int *a , int *b ){\n\n int temp = *a;\n *a = *b;\n *b = temp;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main () {\n\n\tint n;\t\t\t\t\t\t\t\t// cantidad de bolas a ingresar\n\tint i;\t\t\t\t\t\t\t\t// indice para recorrer\n\tint j;\t\t\t\t\t\t\t\t// indice para recorrer\n\tint cont=0;\t\t\t\t\t\t\t// cuenta la cantidad de numeros distintos ingresados\n\tint ban;\t\t\t\t\t\t\t// bandera\n\t\n\t//do{\t\t\t\t\t\t\t\t// validacion\n\t\tscanf ( \"%d\", &n );\t\t\t\t\t// se ingresan la cantidad de bolas\n\t//} while( !(3 <=\u2009n && n <= 50) );\n\t\n\tint v[n];\t\t\t\t\t\t\t// vector de bolas y sus respectivos pesos, pueden haber bolas repetidas\n\n\tfor (i=0; i<n; i++) {\t\t\t\t\t\t// recorre para contar la cantidad de numeros sin repeticion\n\t\n\t\t//do{\t\t\t\t\t\t\t// validacion\n\t\t\tscanf ( \"%d\", &v[i] );\t\t\t\t// se ingresan las respectivas bolas\n\t\t//} while ( !((1 <=\u2009v[i]) && (v[i] <= 1000)) );\n\t\t\n\t\tcont++;\n\t\tfor ( j=0; j<i; j++ ) {\n\t\t\tif ( v[i]==v[j] ) {\n\t\t\t\tcont--;\n\t\t\t\tj=i;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tint b[cont];\t\t\t\t\t\t\t// bolas y sus respectivos pesos, sin haber bolas repetidas\n\tfor ( i=0; i<cont; i++ ) {\t\t\t\t\t// se inicializa a cero dicho vector\n\t\tb[i]=0;\n\t}\n\t\n\tfor ( i=0; i<n; i++ ) {\t\t\t\t\t\t// recorre el vector v para cargar los no repetidos en b\n\t\tban=1;\n\t\tfor ( j=0; (j<cont && ban!=0 && b[j]!=0); j++ ) {\t// recorre el vector b para cargar en el los no repetidos de v\n\t\t\tif ( v[i]==b[j] ) {\n\t\t\t\tban=0;\n\t\t\t}\n\t\t}\n\t\tif ( ban ) {\n\t\t\tb[j]=v[i];\n\t\t}\n\t}\n\n\tfor ( i=1; i<cont; i++ ) {\t\t\t\t\t// recorre b para ordenarlo por burbuja\n\t\tfor ( j=0; j<cont-i; j++ ) {\n\t\t\tif ( b[j]>b[j+1] ) {\t\t\t\t// si se cumple dicha condicion se intercambian las bolas\n\t\t\t\tb[j]=b[j]+b[j+1];\n\t\t\t\tb[j+1]=b[j]-b[j+1];\n\t\t\t\tb[j]=b[j]-b[j+1];\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor ( i=0; i<cont-2; i++ ) {\t\t\t\t\t// compara los numeros con sus dos siguientes para determinar si cumple\n\t\tif ( b[i+1]-b[i] <= 2 && b[i+2]-b[i] <= 2 && b[i+2]-b[i+1] <= 2 ) {\n\t\t\tban=1;\n\t\t\ti=cont-2;\n\t\t}\n\t}\n\t\n\tif ( ban ) {\t\t\t\t\t\t\t// si hay uno que cumple ban=1 y se imprime SI caso contrario NO\n\t\tprintf( \"S\u00cd\" );\n\t}else{\n\t\tprintf( \"NO\" );\n\t}\n\t\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\tfor(i = 0; i < n-3; i += 3){\n\t\tif(abs(balls[i]-balls[i+1]) < 3 && abs(balls[i+1]-balls[i+2]) < 3 && abs(balls[i]-balls[i+2]) < 3 && balls[i] != balls[i+1] && balls[i+1] != balls[i+2] && balls[i] != balls[i+2] ){\n\t\t\th = 1;\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\t\t\t\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\t\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint i,j,temp=0,k=0,count=0,n;\n\tscanf(\"%d\",&n);\n\tint a[n],b[n],c[n];\n\tfor (i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor (i=0;i<n;i++)\n\t{\n\t\tif (a[i]!=0)\n\t\t\tc[k++]=a[i];\n\t\tfor (j=0;j<n;j++)\n\t\t{\n\t\t\tif (a[i]==a[j]&&i!=j)\n\t\t\t\ta[j]=0;\n\t\t}\n\t\ta[i]=0;\n\t}\n\tif (k<3)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tfor (i=0;i<k;i++)\n\t\tb[i]=c[i];\n\tfor (i=0;i<k;i++)\n\t{\n\t\tfor (j=0;j<k;j++)\n\t\tif (c[i]<c[j])\n\t\t{\n\t\t\ttemp=c[j];\n\t\t\tc[j]=c[i];\n\t\t\tc[i]=temp;\n\t\t}\n\t}\n\tfor (i=0;i<k;i++)\n\t{\n\t\tfor (j=0;j<k;j++)\n\t\tif (b[i]>b[j])\n\t\t{\n\t\t\ttemp=b[j];\n\t\t\tb[j]=b[i];\n\t\t\tb[i]=temp;\n\t\t}\n\t}\n\ttemp=0,count=0;\n\tint f=0,g=0;\n\tfor (i=1;i<k;i++)\n\t{\n\t\tif (c[i]-c[0]>2)\n\t\t{\n\t\t\ttemp=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (i=1;i<k;i++)\n\t{\n\t\tif (b[0]-b[i]>2)\n\t\t{\n\t\t\tcount=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count==0&&temp==0)\n\t\tprintf(\"YES\\n\");\n\telse {\n\t\tfor (i=0;i<temp;i++)\n\t\t\tf++;\n\t\tfor (i=0;i<count;i++)\n\t\t\tg++;\n\t\tif (f>=3||g>=3)\n\t\t\tprintf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,i,j,temp;\n scanf(\"%I64d\",&n);\n long long int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\n\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]>a[j])\n {\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n }\n\n if(a[i]==a[j])\n a[j]=0;\n }\n }\n\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[j]==0)\n continue;\n else\n {\n a[i]=a[j];\n a[j]=0;\n break;\n }\n }\n }\n }\n\n for(i=0;a[i]!=0;i++)\n {\n if(a[i+1]==0||a[i+2]==0)\n break;\n if((a[i+1]-a[i])==(a[i+2]-a[i+1]))\n {\n printf(\"YES\\n\");\n return 0;\n }\n\n }\n\n printf(\"N0\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(tam[i]+1==tam[j] || tam[j]+1==tam[i] || tam[i]+2==tam[j] || tam[j]+2==tam[i])\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else if(p1>p2)\n {\n menor=p2;\n mayor=p1;\n }\n for(k=i+1; k<n; k++)\n {\n if(tam[k]+2==menor || tam[k]+1==mayor)\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n-2;i++)\n {\n for(j=1;j<n-1;j++)\n {\n if(a[j]+1==a[j+1]&&a[j]-1==a[j-1])\n {\n s=1;\n break;\n }\n }\n if(s) break;\n }\n if(s) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c,d=1,b,flag=0,x,y,w,q;\n scanf(\"%d\",&n);\n int a[n];\n for(c=0;c<n;c++)\n {\n scanf(\"%d\",&a[c]);\n }\n for(c=0;c<n-1;c++)\n {\n for(b=c+1;b<n;b++)\n {\n if(a[c]==a[b]) continue;\n else if((a[c]-a[b])>2||(a[c]-a[b])<-2) continue;\n else\n {\n d++;\n if(d==2)\n {\n flag=1;\n x=c;\n y=b;\n goto yes;\n }\n }\n }\n }\n yes:\n if(flag==0) printf(\"NO\");\n else if(flag==1)\n {\n flag=0;\n for(c=0;c<n;c++)\n {\n if(c==x||c==y) continue;\n else if(a[c]!=a[x]&&a[c]!=a[y])\n {\n q=a[c]-a[x];\n if(q<0) q=q*-1;\n w=a[c]-a[y];\n if(w<0) w=w*-1;\n if(q<2&&q>0&&w<2&&w>0)\n {\n flag=1;\n break;\n }\n }\n }\n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,swap,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(a[j]==a[j+1]) a[j]=0;\n }\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-i-1;j++)\n {\n if(a[j]>a[j+1])\n {\n swap=a[j];\n a[j]=a[j+1];\n a[j+1]=swap;\n }\n }\n }\n for(i=0;i<n-2;i++)\n {\n for(j=1;j<n-1;j++)\n {\n if(a[j]+1==a[j+1]&&a[j]-1==a[j-1])\n {\n s=1;\n break;\n }\n }\n if(s) break;\n }\n if(s) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "//by ahmeterdem\u2122\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define min(a,b) (a<b)?a:b\n#define max(a,b) (a<b)?b:a\n#define FOR (i,a,b) for(i=a;i<b;i++)\n#define ROF(i,a,b) for(i=b;i>=0;i--)\nlong long\tint i,n,t,arr[1003],a[1040];\nint main() {\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%lld\",&t);\n\t\ta[t]++;\n\t}\n\n\tfor(i=2;i<1000;i++)\n\t\tif(a[i-2] && a[i-1] && a[i]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0 ;\n\t\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\nvoid swap (int *v, int i, int j);\nvoid quick (int *v, int ini, int fin);\n\nint main (){\n\t//TAMA\u00d1O ARREGLO\n\tint N;\n\tscanf (\"%d\", &N);\n\t//CARGAR ARREGLO\n\tint V[N];\n\tint cont;\n\tfor (cont = 0; cont < N; cont++){\n\t\tscanf (\"%d\", &V[cont]);\n\t}\n\t//ORDENAR ARREGLO\n\tquick(V, 0, N-1);\n\t//BUSCAR MENOR\n\tchar *R[2] = {\"YES\", \"NO\"};\n\tint a, cont2;\n\ta=1;\n\tfor (cont = 0; cont < N-2; cont++){\n\t\tif( (V[cont+1]-V[cont]) == 1){\n\t\t\tfor (cont2 = cont+2; cont < N; cont2++){\n\t\t\t\tif ((V[cont2]-V[cont+1]) == 1){\n\t\t\t\t\ta = 0;\n\t\t\t\t\tcont2 = N;\n\t\t\t\t\tcont = N;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf (\"%s\", R[a]);\n\n\treturn 0;\n}\nvoid swap (int *v, int i, int j){\n\tint aux;\n\t\n\taux = *(v+i);\n\t*(v+i) = *(v+j);\n\t*(v+j) = aux;\n}\nint pivot(int *v, int izq, int der){\n\tint i, pivote, valor_pivote;\n\t\n\tpivote = izq;\n\tvalor_pivote = *(v+pivote);\n\tfor(i = izq+1; i <=der; i++){\n\t\tif (*(v+i) < valor_pivote){\n\t\t\tpivote++;\n\t\t\tswap(v, i, pivote);\n\t\t}\n\t}\n\tswap(v, izq, pivote);\n\t\n\treturn pivote;\n}\nvoid quick (int *v, int ini, int fin){\n\tint pivote;\n\tif(ini < fin){\n\t\tpivote = pivot(v, ini, fin);\n\t\tquick(v, ini, pivote-1);\n\t\tquick(v, pivote+1, fin);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid leerbolas(int [], int);\nvoid ordenarbolas(int [], int, int);\nint compararbolas(int [], int);\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int V[n];\n leerbolas(V, n);\n ordenarbolas(V, 0, n-1);\n if(compararbolas(V, n)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n\nvoid leerbolas(int V[], int n){\n int i;\n for(i=0; i<n; i++){\n scanf(\"%d\", &V[i]);\n }\n}\n\nvoid ordenarbolas(int V[], int pri, int ult){\n int i, j, cen, piv, aux;\n cen=(pri+ult)/2;\n piv=V[cen];\n i=pri;\n j=ult;\n\tdo{\n while(V[i]<piv) i++;\n while(V[j]>piv) j--;\n if(i<=j){\n aux=V[i];\n V[i]=V[j];\n V[j]=aux;\n i++;\n j--;\n }\n\t}while(i<=j);\n\tif(pri<j){\n ordenarbolas(V, pri, j);\n\t}\n\tif(i<ult){\n ordenarbolas(V, i, ult);\n\t}\n}\n\nint compararbolas(int V[], int n){\n int i, validez=0;\n for(i=0; i<n-2; i++){\n if((V[i]!=V[i+1] && V[i+1]-V[i]<=2) && (V[i+1]!=V[i+2] && V[i+2]-V[i+1]<=2) && (V[i]!=V[i+2] && V[i+2]-V[i]<=2)){\n validez=1;\n }\n }\n return validez;\n}\n"}, {"source_code": "#include<stdio.h>\n#define T 1001\nint main() {\n\t//\u56e0\u4e3ati\u7684\u503c\u6700\u5927\u662f1000\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u7528exist\u65b9\u6cd5\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i<T;i++){\n\t\texist[i]=0;\n\t}\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\texist[t]=1;\n\t}\n\tint count=0;\n\tfor(i=1;i<T;i++){\n\t\tif(exist[i]){\n\t\t\tcount++;\n\t\t\tif(count>=3){\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t}\n\t\t}else{\n\t\t\tcount=0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n char answer[4]=\"NO\";\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n for(i=0; i<n; i++)\n printf(\"%d\", array[i]);\n\n for(i=0; i < n-2; i++)\n if(array[i+2]-array[i] <= 2){\n strcpy(answer,\"YES\");\n i=n;//para salir del bucle\n }\n\n printf(\"%s\", answer);\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid quicksort(int vec[] , int inicio, int fin);\nint main()\n{\n int n,i,j;\n int c;\n scanf(\"%d\",&n);\n int v[n];\n for(i=0; i<n;i++)\n {\n scanf(\"%d\",&v[i]);\n }\n quicksort(v, 0, n-1);\n c=0;\n for (i=0; i<n ; i++)\n {\n if(v[i+1]-v[i]==1 && v[i+2]-v[i]==2)\n {\n c++;\n }\n }\n if(c!=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n\n\nvoid quicksort(int vec[], int inicio, int fin){\n int pivote, i, j, temp;\n if(inicio < fin) {\n pivote = inicio;\n i = inicio;\n j = fin;\n while(i < j) {\n while(vec[i] <= vec[pivote] && i <= fin){\n i++;\n }\n while(vec[j] > vec[pivote] && j >= inicio){\n j--;\n }\n if(i < j) {\n temp = vec[i];\n vec[i] = vec[j];\n vec[j] = temp;\n }\n }\n temp = vec[j];\n vec[j] = vec[pivote];\n vec[pivote] = temp;\n quicksort(vec, inicio, j-1);\n quicksort(vec, j+1, fin);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define T 1001\nint main() {\n\t//\u56e0\u4e3ati\u7684\u503c\u6700\u5927\u662f1000\uff0c\u6240\u4ee5\u6211\u9009\u62e9\u7528exist\u65b9\u6cd5\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar exist[T];\n\tint i;\n\tfor(i=0;i<T;i++){\n\t\texist[i]=0;\n\t}\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\texist[t]=1;\n\t}\n\tfor(i=1;i<T-3;i++){\n\t\tif(exist[i] && exist[i+1] && exist[i+2]){\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, p1, p2, p3, i=0, j=0, k=0, menor, mayor;\n scanf(\"%d\", &n);\n int tam[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &tam[i]);\n }\n i=0;\n j=0;\n k=0;\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(tam[i]+1==tam[j] || tam[j]+1==tam[i] || tam[i]+2==tam[j] || tam[j]+2==tam[i])\n {\n p1=tam[i];\n p2=tam[j];\n if(p1<p2)\n {\n menor=p1;\n mayor=p2;\n }\n else\n {\n menor=p2;\n mayor=p1;\n }\n for(k=j+1; k<n; k++)\n {\n if(tam[k]+2==menor || tam[k]+1==mayor)\n {\n p3=tam[k];\n printf(\"YES\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c,d=1,b,flag=0,x,y,w,q;\n scanf(\"%d\",&n);\n int a[n];\n for(c=0;c<n;c++)\n {\n scanf(\"%d\",&a[c]);\n }\n for(c=0;c<n-1;c++)\n {\n for(b=c+1;b<n;b++)\n {\n if(a[c]==a[b]) continue;\n else if((a[c]-a[b])>2||(a[c]-a[b])<-2) continue;\n else\n {\n d++;\n if(d==2)\n {\n flag=1;\n x=c;\n y=b;\n goto yes;\n }\n }\n }\n }\n yes:\n if(flag==0) printf(\"NO\");\n else if(flag==1)\n {\n flag=0;\n for(c=0;c<n;c++)\n {\n if(c==x||c==y) continue;\n else if(a[c]!=a[x]&&a[c]!=a[y])\n {\n q=a[c]-a[x];\n if(q<0) q=q*-1;\n w=a[c]-a[y];\n if(w<0) w=w*-1;\n if(q<2&&q>0&&w<2&&w>0)\n {\n flag=1;\n break;\n }\n }\n }\n if(flag==1) printf(\"YES\");\n else printf(\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nu D[1111];\nint main()\n{\n\tu n,i=-1,j;\n\tfor(scanf(\"%u\",&n);++i<n;++D[j])scanf(\"%u\",&j);\n\tfor(i=-1;++i<1000;)\n {\n if(D[i]&&D[i+1]&&D[i+2])\n {\n printf(\"YES\\n\");\n }else\n {\n \tprintf(\"NO\\n\");\n }\n }\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint f(const void *a, const void *b){\n return (*(int*)a - *(int*)b);\n}\n\nint main()\n{\n int n, x[52];\n scanf(\"%d\", &n);\n for(int i=0; i<n; i++)scanf(\"%d\", &x[i]);\n qsort(x, n, sizeof(x[0]), f);\n for(int i=0; i<n-2; i++)if(x[i]==x[i+1]-1 && x[i]==x[i+2]-2) return 0*printf(\"YES\");\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,n,i,d,cnt=0,a[100],b[100],t;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n{\n scanf(\"%d\",&t);\n a[i]=t;\n\n}\n for(i=0;i<n;i++)\n for(j=i+1;j<n;j++)\n if(a[i]>a[j])\n{ d=a[j];\n a[j]=a[i];\n a[i]=d;\n}\n\n\n for(i=0;i<n;i++)\n if(a[i+2]-a[i]<=2 &&a[i+1]-a[i]!=0&&a[i+2]-a[i+1]!=0 &&a[i+1]-a[i]<=2 )\n cnt=1;\n if(cnt==1) printf(\"yes\");\n else printf(\"no\");\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0;\n scanf(\"%d\",&n);\n int a[n],i,tmp,j;\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-i;j++)\n {\n if(a[j]>a[j+1])\n {\n tmp=a[j];\n a[j]=a[j+1];\n a[j+1]=tmp;\n }\n }\n\n }\n for(i=0;i<n;i++)\n {\n if(a[i+2]-a[i]==2 && a[i+2]-a[i+1]==1)\n flag=1;\n }\n if(flag==1)\n printf(\"\\nYES\");\n else\n printf(\"\\nNO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tint a[50],t;\n\tscanf(\"%d\",&t);\n\twhile(t--)\n\t{\n\t\tint n;scanf(\"%d\",&n);\n\t\tint i,j,count=0;\n\t\tfor(i=0;i<n;i++)\n\t\t\tscanf(\"%d\",&a[i]);\n\t\tqsort(a,n,sizeof(int),cmpfunc);\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tfor(j=i+1;j<i+3;j++)\n\t\t\t{\n\t\t\t\tif(a[j]-a[i]<=2 &&a[j]-a[i]!=0)\n\t\t\t\t\tcount++;\n\t\t\t\tif(count==2){printf(\"YES\\n\");goto y;}\n\t\t\t}\n\t\t}\n\t\ty:if(count!=2)printf(\"NO\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid ordenar (int a[],int primero,int ultimo){\n int i,j,central;\n double pivote;\n central = (primero+ultimo)/2;\n pivote = a[central];\n i=primero;\n j=ultimo;\n do\n {\n while (a[i]<pivote) i++;\n while (a[j]>pivote) j--;\n if (i<=j)\n {\n int aux;\n aux= a[i];\n a[i]=a[j];\n a[j]=aux;\n i++;\n j--;\n }\n } while (i<=j);\n if (primero<j)\n {\n ordenar (a,primero,j);\n }\n if (i< ultimo)\n {\n ordenar (a,i,ultimo);\n }\n}\n\nint main()\n{\n int n;\n int i;\n int BAN=0;\n scanf(\"%d\",&n);\n int size[n];\n\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&size[i]);\n }\n\n ordenar(size,0,n-1);\n\n for (i=0;i<n-2;i++)\n {\n if(size[i]+1==size[i+1] && size[i+1]+1==size[i+2])\n {\n BAN=1;\n i=n;\n }\n }\n \n if (BAN==1)\n {\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\nint compare (const void* a, const void* b)\n{\n return *(int*)(a) - *(int*)(b);\n}\nint main()\n{\n int n;\n bool r = false;\n int t[1001];\n scanf(\"%d\",&n);\n for(int i=0;i<n;i++)\n scanf(\"%d\",&t[i]);\n qsort(t,n,sizeof(int),compare);\n for(int i=0;i<n-2;i++)\n {\n if(t[i]+1==t[i+1] && t[i+1]+1==t[i+2])\n {\n r = true;\n break;\n }\n \n } \n if(r)printf(\"yes\"); else printf(\"no\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,flag=0,midindex=0,i,j,temp;\n scanf(\"%d\",&n);\n int a[1000];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n midindex=i;\n for(j=i+1;j<n;j++)\n {\n if(a[midindex]>a[j])\n midindex=j;\n }\n if(midindex!=i)\n {\n temp=a[midindex];\n a[midindex]=a[i];\n a[i]=temp;\n }\n }\n for(i=0;i<=n-3;i++)\n {\n if(a[i]+1==a[i+1]&&a[i]+2==a[i+2])\n flag++;\n }\n if(flag>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int n,i,j,t,m,p;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<n;++i){\n for(j=n-1;j>=i;--j){\n if(a[j-1]>a[j]){\n t=a[j-1];\n a[j-1]=a[j];\n a[j]=t;\n }\n }\n }\n for(j=0;j<n;j++){\n m=a[j+1]-a[j];\n p=a[j+2]-a[j];\n if(m==1&&p==2) {\n printf(\"YES\");\n return 0;\n }\n }\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint eliminadup(int a[], int n);\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam);\nvoid mergesort(int a[], int primero, int ultimo, int M);\n\nint main()\n{\n int n, i;\n char answer[4]=\"NO\";\n scanf(\"%d\", &n);\n\n int array[n];\n //se lee size de los balls\n for(i=0; i<n; i++)\n scanf(\"%d\", &array[i]);\n //se ordena de menor a mayor de acuerdo el size de los balls\n mergesort(array, 0, n, n);\n n = eliminadup(array, n);\n \n for(i=0; i < n-2; i++)\n if(array[i+2]-array[i] <= 2){\n strcpy(answer,\"YES\");\n i=n;//para salir del bucle\n }\n\n printf(\"%s\", answer);\n\n return 0;\n}//end main\n\nvoid mergesort(int a[], int primero, int ultimo, int M){\n int central;\n if(primero < ultimo){\n central = (primero + ultimo)/2;\n mergesort(a, primero, central, M);\n mergesort(a, central+1, ultimo, M);\n mezcla(a, primero, central, ultimo, M);\n }//end if\n}//end mergesort\n\nvoid mezcla(int a[], int izda, int medio, int drcha, int tam)\n{\n int tmp[tam];\n int x, y, z;\n x=z=izda;\n y = medio+1;\n /* bucle de mezcla, utiliza tmp[] como array auxiliar,\n z es el \u00edndice de tmp[] */\n while(x <= medio && y <= drcha)\n {\n if(a[x] <= a[y])\n tmp[z++] = a[x++];\n else\n tmp[z++] = a[y++];\n }\n /* bucle para mover elementos que quedan de sublistas */\n while(x <= medio)\n tmp[z++] = a[x++];\n while(y <= drcha)\n tmp[z++] = a[y++];\n /* Copia de elementos de tmp[] al array a[] */\n for(z = izda; z <= drcha; z++)\n a[z] = tmp[z];\n}//end mezcla\n\nint eliminadup(int a[], int n){\n int i, j, k;\n for (i = 0; i < n; i++) {\n for (j = i + 1; j < n;) {\n if (a[j] == a[i]) {\n for (k = j; k < n; k++) {\n a[k] = a[k + 1];\n }//end for\n n--;\n } else\n j++;\n }//end for\n }//end for\n return n;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\t/*for(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}*/\n//\tmergeSort(balls, 0, n-1);\n\tfor(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i])-balls[k] < 3){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\t\t\t\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\t\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int balls,i,j,c=0,temp,size[1000];\n scanf(\"%d\",&balls);\n if(balls>2&&balls<51)\n {\n for(i=0; i<balls; i++)scanf(\"%d\",&size[i]);\n for (i=0; i<balls; i++)\n {\n for(j=0; j<(balls-i-1); j++)\n {\n if(size[j]>size[j+1])\n {\n size[j]^=size[j+1]^=size[j]^=size[j+1];\n }\n }\n }\n for(i=0; i<balls; i++)\n {\n if(size[i+1]==size[i])\n {\n c++;\n for( j=i; j<balls-c; j++)\n size[j]=size[j+1];\n size[balls-c--]=0;\n printf(\"-\");\n }\n\n }\n for (i = 0; i < balls; i++)\n {\n printf(\"%d \", size[i]);\n }\n for (j=0; j<balls; j++)\n {\n c++;\n\n if(size[j+1]==size[j]+1)\n {\n if(size[j+2]==size[j+1]+1)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else if(size[j+1]!=size[j]+1)\n {\n if(c==balls&&(size[j+2]!=size[j+1]+1))\n {\n printf(\"NO\");\n break;\n }\n }\n\n\n }\n }\n else return 0;\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[60], n;\n\nvoid swap(int *x, int *y){\n\tint temp;\n\ttemp = *x;\n\t*x = *y;\n\t*y = temp;\n}\n\nint partition(int left, int right){\n\tint pivot, i, j;\n\tpivot = a[left];\n\ti = right;\n\tfor(j=right; j>left; j--){\n\t\tif(a[j] >= pivot){\n\t\t\tswap(&a[j], &a[i]);\n\t\t\ti--;\n\t\t} \n\t}\n\tswap(&a[left], &a[i]);\n\treturn i;\n}\n\nvoid quick_sort(int left, int right){\n\tint p;\n\tif(left >= right) return;\n\telse{\n\t\tp = partition(left, right);\n\t\tquick_sort(left, p-1);\n\t\tquick_sort(p+1, right);\n\t}\n}\n\nint main(){\n\t\n\tint i, done=0;\n\n\tscanf(\"%d\", &n);\n\tfor(i=0; i<n; i++) scanf(\"%d\", &a[i]);\n\tquick_sort(0, n-1);\n\tfor(i=1; i<n-1; i++)\n\t\tif(a[i]-a[i-1]==1 && a[i+1]-a[i]==1) done=1;\n\tif(done) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n#define pi 3.1415926\n#define rep(x,ini,end) for(x=(ini);x<(end);x++)\n#define per(x,ini,end) for(x=(end-1);x>=(ini);x--)\n#define max(x,y) ((x)>(y)?(x):(y))\n#define min(x,y) ((x)<(y)?(x):(y))\n\n\nint t[100] = {0};\n\n\nvoid quickSort(int a[], int beginPos, int endPos)\n{\n int i = beginPos, j = endPos;\n int flag = a[beginPos];\n //int bePos_L, bePos_R, endPos_L, endPos_R;\n //int countL = 0, countR = 0;\n if (beginPos>=endPos)\n {\n return;\n }\n\n while (i<j)\n {\n while ((a[j]>flag) && (i<j))\n {\n --j;\n }\n if (i == j)\n {\n break;\n }\n\n a[i] = a[j]; a[j] = flag;\n ++i;\n\n while ((a[i]<flag) && (i<j))\n {\n ++i;\n }\n if (i == j)\n {\n break;\n }\n\n a[j] = a[i]; a[i] = flag;\n --j;\n }\n\n quickSort(a, beginPos, i-1);\n quickSort(a, i+1, endPos);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int i;\n rep(i,0,n)\n {\n scanf(\"%d\", &t[i]);\n }\n quickSort(t, 0, n-1);\n\n int count = 1;\n int flag = t[0];\n\n rep(i,1,n)\n {\n if ((t[i]!=flag) && (t[i]-flag<3))\n {\n count++; flag = t[i];\n if (count == 3)\n {\n printf(\"YES\"); return 0;\n }\n continue;\n }\n count = 1;\n }\n if (count == 3)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint col[30], row[30];\n\nint main()\n{\n int n, i, j, ans = 0;\n scanf(\"%d\", &n);\n int arr[n][n];\n for (i = 0; i < n; i++){\n for (j = 0; j < n; j++){\n scanf(\"%d\", &arr[i][j]);\n row[i] += arr[i][j];\n col[j] += arr[i][j];\n }\n }\n for (i = 0; i < n; i++){\n for (j = 0; j < n; j++){\n if (col[j] > row[i]) ans++;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int *p, int l, int m, int r);\nvoid mergeSort (int *p, int l, int r);\n\nint main(int argc, char const *argv[])\n{\n\tint n, i, h=0,j,k;\n\tscanf(\"%d\", &n);\n\tint balls[n];\n\tfor(i = 0; i < n; i++){\n\t\tscanf(\"%d\", &balls[i]);\n\t}\n\tmergeSort(balls, 0, n-1);\n\t/*for(i = 0; i < n; i++){\n\t\tprintf(\"%d \", balls[i]);\n\t}*/\n\tfor (i = 0; i < n-2; i++){\n\t\tfor (j = i+1; j < n-1; j++){\n\t\t\tif (abs(balls[i]-balls[j]) < 3 && balls[i] != balls[j]){\n\t\t\t\tfor (k = j+1; k < n; k++){\n\t\t\t\t\tif(abs(balls[i])-balls[k] < 3 && abs(balls[j] - balls[k]) < 3 && balls[i] != balls[k]){\n\t\t\t\t\t\tif(balls[i] != balls[j] && balls[j] != balls[k] && balls[i] != balls[k]){\n\t\t\t\t\t\t\th = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\th = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (h)\n\t{\n\t\tprintf(\"YES\");\n\t}else{\n\t\tprintf(\"NO\");\n\t}\n\n\treturn 0;\n}\n\nvoid mergeSort (int *p, int l, int r){\n\tif(l<r){\n\t\tint m=(l+r)/2;\n\t\tmergeSort(p, l, m);\n\t\tmergeSort(p, m+1, r);\n\t\tmerge(p, l, m, r);\n\n\t}\n}\n\nvoid merge(int *p, int l, int m, int r){\n\tint n1, n2, i, j, k;\n\tn1=m-l+1;\n\tn2=r-m;\n\tint v1[n1], v2[n2];\n\tfor (i=0; i<n1;i++){\n\t\tv1[i]=*(p+(l+i));\n\t}\n\tfor (j=0; j<n2;j++){\n\t\tv2[j]= *(p+(j+m+1));\n\t}\n\ti=0;\n\tj=0;\n\tk=l;\n\twhile(i<n1 && j<n2){\n\t\tif(v1[i]<=v2[j]){\n\t\t\t*(p+k)=v1[i];\n\t\t\ti++;\n\t\t}else{\n\t\t\t*(p+k)= v2[j];\n\t\t\tj++;\n\t\t}\n\t\tk++;\n\t}\n\twhile(i<n1){\n\t\t*(p+k)=v1[i];\n\t\ti++;\n\t\tk++;\n\t}\n\twhile(j<n2){\n\t\t*(p+k)=v2[j];\n\t\tk++;\n\t\tj++;\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n int balls[n];\n int i,j;\n int a,b,c;\n int aux;\n int puede;\n puede = 0;\n\n for (i = 0;i < n; i++){\n scanf(\"%d\",&balls[i]);\n }\n for (i = 0; i < n-1; i++){\n for (j = 0; j < n-i-1; j++){\n if (balls[j] > balls[j+1]){\n aux = balls[j];\n balls[j] = balls[j+1];\n balls[j+1] = aux;\n }\n }\n }\n for (i = 1; i<n-1; i++){\n a = balls[i-1];\n b = balls[i];\n c = balls[i+1];\n\n if(b - a == 1 && c - b == 1 && (a+b+c)/3 == b){\n puede = 1;\n }\n }\n if(puede == 1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int n,t,vector[50],m,i,bandera =0,a,b,c,dif,dif2,dif3;\n scanf(\"%d\",&n);\n if(n<3 || n>50){\n do{\n printf(\"Valor incorrecto. Vuelva a intentarlo\\n\");\n scanf(\"%d\",&n);\n }while(n<3 || n>50);\n }\n\n for(i = 0; i < n; i++){\n scanf(\"%d\",&t);\n if(t<1 || t>1000){\n do{\n printf(\"Valor incorrecto. Vuelva a intentarlo\\n\");\n scanf(\"%d\",&t);\n }while(n<3 || n>50);\n }\n vector[i] = t;\n }\n\n for(a = 0; a < n-2; a++){\n for(b = a+1; b < n-1; b++){\n for(c = b+1; c < n; c++){\n dif = abs(vector[a]-vector[b]);\n dif2 = abs(vector[a]-vector[c]);\n dif3 = abs(vector[c]-vector[b]);\n if(dif < 3 && dif2 < 3 && dif3 < 3 && vector[a] != vector[b] && vector[a] != vector[c] && vector[b] != vector[c]){\n printf(\"YES\");\n bandera = 1;\n }\n }\n }\n }\n if(bandera != 1){\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint arr[10005],n,t[1001]={0},i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\tt[arr[i]]++;\n\t}\n\tfor(i=0;i<10000;i++){\n\t\tif(t[i] && t[i+1] && t[i+2]){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main()\n{\n\n\n\nint n;\nint arr[53],i;\nscanf(\"%d\",&n);\nfor( i=0;i<n;i++)\n{\nscanf(\"%d\",&arr[i]);\n}\nqsort(arr, n, sizeof(int), cmpfunc);\n\nint counts =0;\nint flag =0;\nfor(i =1;i<n;i++)\n{\n\nif(arr[i]!=arr[i-1] && (arr[i] == (arr[i-1]+1)))\ncounts++;\nelse\ncounts=0;\nif(counts ==2)\n{\nprintf(\"YES\");\nflag =1;\nbreak;\n}\n}\nif(flag==0)\nprintf(\"NO\");\n\n\nreturn 0;\n}\n"}], "src_uid": "d6c876a84c7b92141710be5d76536eab"} {"nl": {"description": "Imp is in a magic forest, where xorangles grow (wut?) A xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the lengths is equal to zero. Imp has to count the number of distinct xorangles of order n to get out of the forest. Formally, for a given integer n you have to find the number of such triples (a,\u2009b,\u2009c), that: 1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009c\u2009\u2264\u2009n; , where denotes the bitwise xor of integers x and y. (a,\u2009b,\u2009c) form a non-degenerate (with strictly positive area) triangle. ", "input_spec": "The only line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20092500).", "output_spec": "Print the number of xorangles of order n.", "sample_inputs": ["6", "10"], "sample_outputs": ["1", "2"], "notes": "NoteThe only xorangle in the first sample is (3,\u20095,\u20096)."}, "positive_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,j,k,c=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n k=i^j;\n if(k<=n&&i+j>k&&j+k>i&&k+i>j&&k>=i&&k>=j)\n {\n c++;\n }\n }\n }\n printf(\"%d\\n\",c);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n unsigned a, b, c, counter;\n \n for(a=0;a<=n;a++)\n for(b=a;b<=n;b++)\n {\n c = 0 ^ a ^ b;\n if(c <= n && c >= b && a + b > c)\n counter++;\n }\n\n printf(\"%d\\n\", counter);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n//Vailate if num1, num2, num3 can construct a triangle\n//return 1 if it can construct a triangle\n//return 0 if it can't construct a triangle\nint isTriangle(int num1, int num2, int num3) {\n if(num1 + num2 > num3)\n return 1;\n return 0;\n}\nint main() {\n int num1, num2, num3, count, max;\n scanf(\"%d\", &max);\n for(num1 = 1, count = 0; num1 <= max; num1++)\n for(num2 = num1; num2 <= max; num2++) {\n num3 = num1 ^ num2;\n if(num3 >= num2 && num3 <= max && isTriangle(num1, num2, num3))\n count++; \n }\n printf(\"%d\", count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n while(~scanf(\"%d\",&n))\n {\n int i,j,sum=0,c;\n for(i=1;i<n;i++)\n {\n for(j=i+1;j<=n;j++)\n {\n c=i^j;\n if(c>=1&&c<=n&&c>j&&i+j>c&&i+c>j&&j+c>i)\n sum++;\n }\n }\n printf(\"%d\\n\",sum);\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int n ,i ,j ,k, c;\n while( scanf(\"%d\",&n)!=EOF ){\n c = 0;k=n;\n for( i=1 ; i<n-1 ; i++ )\n for( j=i+1 ; j<n ; j++ )\n for( k=j+1 ; k<=n ; k++ )\n if((i^j)==k && i+j>k)c++;\n printf(\"%d\\n\", c);\n } \n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint counter=0,n;\n\tscanf(\"%d\", &n);\n\tfor(int i=1;i<=n;i++)\n\t\tfor(int j=i;j<=n;j++){\n\t\t\tint x=i^j;\n\t\t\tif(x^(i^j)==0&&x<=n&&i+j>x&&x>=j)\n\t\t\tcounter++;\n\t\t}\n\tprintf(\"%d\", counter);\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,i,j,x=0;scanf(\"%d\",&n);\n for(i=1;i<=n;i++)for(j=i;j<=n;j++)\n if((i^j^(i^j)==0)&&(i^j)>=j&&i+j>(i^j)&&(i^j)<=n)x++;\n printf(\"%d\",x);return 0;}"}, {"source_code": "#include<stdio.h>\nint main(){\nint i,j,k,n,ans=0,z;\n \nscanf(\"%d\",&n);\nfor(i=1;i<=n;i++){\n for(j=i;j<=n;j++){\n for(z=j;z<=n;z++)\n {\n \n if(!(i^j^z))\n ans+= i+j>z ;\n \n }\n \n }\n}\nprintf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nint main()\n{\n ll n,i,j,k,ans=0;\n scanf(\"%lld\",&n);\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n k=j^i;\n if(k>0 && k<=n && ((i+j>k)&&(j+k>i)&&(k+i>j)&&(i<=j)&&(j<=k)))\n ans++; \n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "# include <stdio.h>\n\nint main()\n{\nint n,count=0;\nscanf(\"%d\",&n);\nint a[n][n],b[n];\nfor(int i=0;i<n;i++)\nb[i]=i+1;\nfor(int i=0;i<n;i++)\nfor(int j=i;j<n;j++)\n{\na[i][j]=(i+1)^(j+1);\nint min=0;\nint max=n-1;\nint mid=(max+min)/2;\nwhile(max>=min)\n{\nif(b[mid]>a[i][j])\nmax=mid-1;\nelse\nmin=mid+1;\nmid=(min+max)/2;\n}\n//printf(\"%d %d %d %d %d\\n\",mid,a[i][j],b[mid],i,j);\nif(b[mid]==a[i][j] && b[mid]>=(i+1) &&b[mid]>=(j+1) && b[mid]+i>j && i+j+2>b[mid] && b[mid]+j>i )\ncount++;\n//printf(\"count=%d\\n\",count);\n}\nprintf(\"%d\",count);\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int ans = 0;\n for(int a = 1; a <= n; ++a) {\n for(int b = a + 1; b <= n; ++b) {\n int c = a ^ b;\n if(a + b > c && a + c > b && c > b && c <= n) {\n ++ans;\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint valid(int a, int b,int c){\n\tif(a+b <= c)\n\t\treturn 0;\n\tif(b+c <= a)\n\t\treturn 0;\n\tif(a+c <= b)\n\t\treturn 0;\n\treturn 1;\n}\n\nint main(){\n\tint n;\n\tscanf(\" %d\",&n);\n\tint ans = 0;\n\tfor(int i = n; i >= 0;--i){\n\t\tfor(int j = i-1;j>= 0; --j){\n\t\t\tint c = i ^ j;\n\t\t\tif(c < j && valid(i,j,c))\n\t\t\t\t++ans;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdint.h>\n#include <stdio.h>\nint main()\n{\n int n , a , b , c , s=0;\n scanf(\"%d\" , &n);\n for(c = 1 ; c <= n ; ++c){\n for(b = 1 ; b <= c ; ++b){\n for(a = c - b + 1 ; a <= b ; ++a){\n if( (a^b^c) == 0){\n s += 1;\n }\n }\n }\n }\n printf(\"%d\" , s);\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);//cin>> n>>d;\n\t\n\tint i,j,k,count=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j = i ; j<=n;j++)\n\t\t{\n\t\t\tk = i ^ j;\n\t\t\tif( k<=n && k+i >j && k+j >i && i+j > k && k>0)\n\t\t\t{\tcount++;\n\t\t//\t\tprintf(\"k : %d %d %d\\n\",i,j,k );\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t//printf(\"i : %d\\n\",i );\n\n\t}\n\tprintf(\"%d\\n\",count/3 );\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#define _MEASURE_ 0\n\n#if _MEASURE_\n#include <time.h>\n#endif\n\n#define min(a,b) ((a)>(b)?(b):(a))\nint xorSum(int a, int b)\n{\n int c = 0, cnt = 1;\n while(a > 0 || b > 0)\n {\n if((a%2+b%2)%2 == 1)\n c += 1 * cnt;\n a /= 2; b /= 2;\n cnt *= 2;\n }\n return c;\n}\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n#if _MEASURE_\n clock_t t;\n t = clock();\n#endif\n int cnt = 0;\n for(int i = 1; i <= n; i++)\n {\n for(int j = i; j <= n; j++)\n {\n int k = xorSum(i,j);\n if(k <= n && k >= 1 && (i+j) > k && k > j && k > i)\n cnt++;\n }\n }\n printf(\"%d\\n\", cnt);\n#if _MEASURE_\n t = clock() - t;\n printf(\"It took me (%f seconds).\\n\", ((float)t)/CLOCKS_PER_SEC);\n#endif\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\twhile (~scanf(\"%d\", &n))\n\t{\n\t\tint i, j, sum = 0, c;\n\t\tfor (i = 1; i<n; i++)\n\t\t{\n\t\t\tfor (j = i + 1; j <= n; j++)\n\t\t\t{\n\t\t\t\tc = i ^ j;\n\t\t\t\tif (c >= 1 && c <= n && c>j&&i + j>c&&i + c>j&&j + c>i)\n\t\t\t\t\tsum++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\", sum);\n\t}\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int ans = 0;\n for(int a = 1; a <= n; ++a)\n for(int b = a + 1; b <= n; ++b)\n {\n int c = a ^ b;\n if(a + b > c && a + c > b && c > b && c <= n)\n ++ans;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main() {\n\t//code\n int n,i,j,c=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=n;j++)\n {\n int w=i^j;\n if(w>0&&w<=n&&(i+j)>(w)&&(i+w)>j&&(j+w)>i)\n {\n c++; \n }\n }\n }\n printf(\"%d\\n\",(c/6));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k,xorangle=0;\n scanf(\"%d\",&n);\n for(i=2;i<=n-2;i++)\n {\n for(j=i+1;j<=n-1;j++)\n {\n\n for(k=j+1;k<=n;k++)\n {\n if(i+j<=k)\n {\n break;\n }\n else if((i^j)==k)\n {\n xorangle++;\n }\n }\n }\n }\n printf(\"%d\",xorangle);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,k,n,count=0,x;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n {\n for (j=i; j<=n; j++)\n {\n x=i^j;\n if(x+i>j && x+j>i && i+j>x && x<=n && x>j)\n {\n count++;\n }\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint valid(int a,int b,int c)\n{\n if(a+b>c && b+c>a && c+a>b){\n return 1;\n }\n return 0;\n}\nint main()\n{\n int i,j,n,res=0,temp;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n for(j=i;j<=n;j++){\n temp=i^j;\n if(temp<=n && temp>=j){\n if(valid(i,j,temp)){\n res++;\n }\n }\n }\n }\n printf(\"%d\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k,n,count;\n scanf(\"%d\",&n);\n count=0;\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n k=i^j;\n if((i+j)>k && (i+k)>j && (j+k)>i && k>=j && k<=n)\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,j,n,temp,c=0;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i;j<=n;j++)\n\t\t{\n\t\t\ttemp=i^j;\n\t\t\tif(temp<j || (i+j)<=temp || temp>n)\n\t\t\t\tcontinue;\n\t\t\tc++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int n ,a,b,c,counter=0;\n\n scanf(\"%d\",&n);\n\n if(n>2500)\n return;\n\n\n for(c=n;c>=6;c--)\n {\n for(b=c;(b>0.5*c);b--)\n {\n a=b^c;\n\n if(a<=b&&a>=1&&a+b>c)\n {\n counter++;\n // printf(\"%d %d %d\\n\",a,b,c);\n }\n\n\n\n }\n\n }\n\n\n\n\n printf(\"%d \",counter);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int a, b, c;\n long long ttl = 0;\n for (a = 1; a <= n; a++)\n for (b = a; b <= n; b++)\n {\n c = a ^ b;\n if (a == b || c == 0)\n continue;\n //printf(\"%2d %2d %2d %d\\n\", a, b, c, (a + b > c && a + c > b && b + c > a && c >= b && c <= n));\n if (a + b > c && a + c > b && b + c > a && c >= b && c <= n)\n ttl++;\n }\n printf(\"%lld\\n\", ttl);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint a,b,c,ans=0;\nfor(a=1;a<=n;a++)\nfor(b=a+1;b<=n;b++)\n{\nc = a^b;\nif(c >b && c < a+b && c <=n)ans++;\n}\nprintf(\"%d\\n\",ans);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint if_get(int n)\n{\n\tint max;\n\tint i;\n\tmax=0;\n\tfor(i=n-1;i>=1;i--)\n\t{\n\t\tif((n^i)<n&&(i+(n^i)>n))\n\t\t\tmax++;\n\t}\n\treturn max/2;\n}\nint main()\n{\n\tint i;\n\tint n;\n\tint a[3000];\n\tscanf(\"%d\",&n);\n\ta[0]=0;\n\tfor(i=1;i<n;i++)\n\t\ta[i]=a[i-1]+if_get(i+1);\n\tprintf(\"%d\\n\",a[n-1]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,i,j,k,count=0;\n\tscanf(\"%d\",&n);\n\tfor(i=n;i>0;i--)\n\t{for(j=i-1;j>0;j--)\n\t{k=j^i;\n\t\n\tif(i>=j&&j>=k)\n\t{if(i<(j+k)&&j<(i+k)&&k<(i+j))\n\t{count++;\n\n\t}}\n\n\t\n\t}}\n\tprintf(\"%d\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n \n \n \n\n \t\nint main()\n{\n int n;\n scanf(\"%d\" ,&n);\n \n int counter=0;\n \n for(int a=1; a<=n; a++){\n \tfor(int b=a; b<=n; b++){\n \t\tint c = a^b ;\n \t\t\tif( c>=1 && c<=n && c >=b && a+b>c) {counter++;}\n \t}\n }\n \n \n printf(\"%d\" ,counter);\n \t\t\n\treturn 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n, count = 0;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tfor (int a = 1; a <= n; a++) {\n\t\tfor (int b = a; b <= n; b++) {\n\t\t\tint c = a^b;\n\t\t\t\n\t\t\tif(c <= n && c >= b && a + b > c && b + c > a && c + a > b)\n\t\t\t\t\tcount++;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(int argc,char* argv[])\n{\n int i,j,temp,cpt=0,n;\n do{\n scanf(\"%d\",&n);\n }while(n<1 && n>2500);\n for (i = 1; i <= n; i++)\n {\n for (j = 1; j <= i; j++)\n {\n temp = i ^ j;\n if (temp > j || temp > i)\n continue;\n if (temp + j <= i)\n continue;\n cpt++;\n }\n }\n printf(\"%d\",cpt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint c=0;\n\tint i,j,k;\n\tc=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i;j<=n;j++)\n\t\t{\n\t\t\tk=j^i;\n\t\t\tif(k>=j)\n\t\t\t{\n\t\t\t\tif(i+j>k && k<=n)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}"}, {"source_code": "//set many funcs template\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define inf 1072114514\n#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}\nint strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}\n\nint main(void){\n int i,j,n,m,k,a[262144],b,c,w,r=0,l,t;\n double d;\n char s[262144];\n scanf(\"%d%d\",&n);\n //l=strlen(s);\n for(i=1;i<=n;i++){\n for(j=1;j<=n;j++){\n a[0]=i;a[1]=j;a[2]=i^j;\n if(a[0]>a[1] || a[1]>a[2]){continue;}\n //qsort(a,3,sizeof(int),sortfncsj);\n if(a[2]>n || a[2] >= a[0]+a[1]){continue;}\n r++;\n }\n }\n //qsort(a,n,sizeof(int),sortfncsj);\n printf(\"%d\\n\",r);\n return 0;\n}"}, {"source_code": "/* Author Kh. Assaduzzaman Sohan */\n\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#define mod 100000007\n//int x[100005]= {0};\nint main()\n{\n int n,i,j,x,y,Ans=0;\n\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=n; j++)\n {\n x=i^j;\n if(x<=n && x>i && x>j && x<(i+j))\n {\n //printf(\"i=%d j=%d x=%d\\n\",i,j,x);\n Ans++;\n }\n }\n\n }\n printf(\"%d\",Ans/2);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\n\n\n\nint main() {\n int x,y,n,i,j,k,count=0;\n scanf(\"%d\",&n);\n for(i=3;i<=n;i++)\n {\n \tfor(j=i+1;j<=n;j++)\n \t{\n \t\tx=i^j;\n \t\tif(i+j>x && j+x>i && i+x>j && x<=n)\n \t\t{\n \t\t\t//printf(\"%d %d %d\\n\",i,j,x);\n \t\t\tcount++;\n \t\t}\n \t}\n }\n printf(\"%d\",count/3);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int n, a, b, c, ans = 0;\n\n scanf(\"%d\", &n);\n\n for(a = 1; a <= n; a++)\n {\n for(b = 1; b <= n; b++)\n {\n c = a ^ b;\n if(a + b > c && a + c > b && b + c > a)\n if(a <= b && b <= c && c <= n && a >= 1) ans++;\n }\n }\n\n printf(\"%d\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nvoid main(){\nlong long n,i,j,count=0,k;\nscanf(\"%lld\",&n);\n\nfor(i=1;i<n;i++){\nfor(j=i+1;j<=n;j++){\n\nif(((i^j)>=i)&&((i^j)>=j)&&((i^j)<=n)){\n\tif((i!=j)||(i!=(i^j))||(j!=(i^j))){\n\t\tk=i^j;\n\t\tif((i+j>k)&&(j+k>i)&&(k+i>j)){\ncount++;}}}}}\n\nprintf(\"%lld\\n\",count);\nexit(0);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int t,i,j,k,cnt=0;\n\n scanf(\"%d\",&t);\n\n for(i=1;i<=t;i++){\n for(j=i;j<=t;j++){\n k=i^j;\n if(j<=k && t>=k && (i^j^k)==0 && i+j>k ){\n cnt++;\n }\n }\n }\n printf(\"%d\\n\",cnt);\n\n\n return 0;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint count=0;\n\tfor(int i=1; i<=n;i++){\n\t\tfor(int j=i+1; j<=n; j++){\n\t\t\tif((i^j)>j&&(i+j>(i^j))&&(i^j)<=n) count++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n}"}, {"source_code": "#include \"stdio.h\"\nint main() {\n int n, array[2500] = {0,0,0,0,0,1,1,1,1,2,2,5,7,10,10,10,10,11,11,14,16,19,19,26,32,39,43,52,58,65,65,65,65,66,66,69,71,74,74,81,87,94,98,107,113,120,120,135,149,164,176,193,207,222,230,251,269,288,300,321,335,350,350,350,350,351,351,354,356,359,359,366,372,379,383,392,398,405,405,420,434,449,461,478,492,507,515,536,554,573,585,606,620,635,635,666,696,727,755,788,818,849,873,910,944,979,1007,1044,1074,1105,1121,1166,1208,1251,1287,1332,1370,1409,1433,1482,1524,1567,1595,1640,1670,1701,1701,1701,1701,1702,1702,1705,1707,1710,1710,1717,1723,1730,1734,1743,1749,1756,1756,1771,1785,1800,1812,1829,1843,1858,1866,1887,1905,1924,1936,1957,1971,1986,1986,2017,2047,2078,2106,2139,2169,2200,2224,2261,2295,2330,2358,2395,2425,2456,2472,2517,2559,2602,2638,2683,2721,2760,2784,2833,2875,2918,2946,2991,3021,3052,3052,3115,3177,3240,3300,3365,3427,3490,3546,3615,3681,3748,3808,3877,3939,4002,4050,4127,4201,4276,4344,4421,4491,4562,4618,4699,4773,4848,4908,4985,5047,5110,5142,5235,5325,5416,5500,5593,5679,5766,5838,5935,6025,6116,6192,6285,6363,6442,6490,6595,6693,6792,6876,6977,7063,7150,7206,7311,7401,7492,7552,7645,7707,7770,7770,7770,7770,7771,7771,7774,7776,7779,7779,7786,7792,7799,7803,7812,7818,7825,7825,7840,7854,7869,7881,7898,7912,7927,7935,7956,7974,7993,8005,8026,8040,8055,8055,8086,8116,8147,8175,8208,8238,8269,8293,8330,8364,8399,8427,8464,8494,8525,8541,8586,8628,8671,8707,8752,8790,8829,8853,8902,8944,8987,9015,9060,9090,9121,9121,9184,9246,9309,9369,9434,9496,9559,9615,9684,9750,9817,9877,9946,10008,10071,10119,10196,10270,10345,10413,10490,10560,10631,10687,10768,10842,10917,10977,11054,11116,11179,11211,11304,11394,11485,11569,11662,11748,11835,11907,12004,12094,12185,12261,12354,12432,12511,12559,12664,12762,12861,12945,13046,13132,13219,13275,13380,13470,13561,13621,13714,13776,13839,13839,13966,14092,14219,14343,14472,14598,14725,14845,14978,15108,15239,15363,15496,15622,15749,15861,16002,16140,16279,16411,16552,16686,16821,16941,17086,17224,17363,17487,17628,17754,17881,17977,18134,18288,18443,18591,18748,18898,19049,19185,19346,19500,19655,19795,19952,20094,20237,20349,20518,20680,20843,20991,21156,21306,21457,21577,21746,21900,22055,22179,22336,22462,22589,22653,22842,23028,23215,23395,23584,23766,23949,24117,24310,24496,24683,24855,25044,25218,25393,25537,25738,25932,26127,26307,26504,26686,26869,27021,27222,27408,27595,27751,27940,28098,28257,28353,28570,28780,28991,29187,29400,29598,29797,29965,30182,30384,30587,30759,30964,31138,31313,31425,31650,31860,32071,32251,32464,32646,32829,32949,33166,33352,33539,33663,33852,33978,34105,34105,34105,34105,34106,34106,34109,34111,34114,34114,34121,34127,34134,34138,34147,34153,34160,34160,34175,34189,34204,34216,34233,34247,34262,34270,34291,34309,34328,34340,34361,34375,34390,34390,34421,34451,34482,34510,34543,34573,34604,34628,34665,34699,34734,34762,34799,34829,34860,34876,34921,34963,35006,35042,35087,35125,35164,35188,35237,35279,35322,35350,35395,35425,35456,35456,35519,35581,35644,35704,35769,35831,35894,35950,36019,36085,36152,36212,36281,36343,36406,36454,36531,36605,36680,36748,36825,36895,36966,37022,37103,37177,37252,37312,37389,37451,37514,37546,37639,37729,37820,37904,37997,38083,38170,38242,38339,38429,38520,38596,38689,38767,38846,38894,38999,39097,39196,39280,39381,39467,39554,39610,39715,39805,39896,39956,40049,40111,40174,40174,40301,40427,40554,40678,40807,40933,41060,41180,41313,41443,41574,41698,41831,41957,42084,42196,42337,42475,42614,42746,42887,43021,43156,43276,43421,43559,43698,43822,43963,44089,44216,44312,44469,44623,44778,44926,45083,45233,45384,45520,45681,45835,45990,46130,46287,46429,46572,46684,46853,47015,47178,47326,47491,47641,47792,47912,48081,48235,48390,48514,48671,48797,48924,48988,49177,49363,49550,49730,49919,50101,50284,50452,50645,50831,51018,51190,51379,51553,51728,51872,52073,52267,52462,52642,52839,53021,53204,53356,53557,53743,53930,54086,54275,54433,54592,54688,54905,55115,55326,55522,55735,55933,56132,56300,56517,56719,56922,57094,57299,57473,57648,57760,57985,58195,58406,58586,58799,58981,59164,59284,59501,59687,59874,59998,60187,60313,60440,60440,60695,60949,61204,61456,61713,61967,62222,62470,62731,62989,63248,63500,63761,64015,64270,64510,64779,65045,65312,65572,65841,66103,66366,66614,66887,67153,67420,67672,67941,68195,68450,68674,68959,69241,69524,69800,70085,70363,70642,70906,71195,71477,71760,72028,72313,72583,72854,73094,73391,73681,73972,74248,74541,74819,75098,75346,75643,75925,76208,76460,76745,76999,77254,77446,77763,78077,78392,78700,79017,79327,79638,79934,80255,80569,80884,81184,81501,81803,82106,82378,82707,83029,83352,83660,83985,84295,84606,84886,85215,85529,85844,86128,86445,86731,87018,87242,87587,87925,88264,88588,88929,89255,89582,89878,90223,90553,90884,91184,91517,91819,92122,92362,92715,93053,93392,93700,94041,94351,94662,94910,95255,95569,95884,96136,96453,96707,96962,97090,97471,97849,98228,98600,98981,99355,99730,100090,100475,100853,101232,101596,101977,102343,102710,103046,103439,103825,104212,104584,104973,105347,105722,106066,106459,106837,107216,107564,107945,108295,108646,108934,109343,109745,110148,110536,110941,111331,111722,112082,112491,112885,113280,113644,114041,114407,114774,115078,115495,115897,116300,116672,117077,117451,117826,118138,118547,118925,119304,119620,120001,120319,120638,120830,121271,121705,122140,122560,122997,123419,123842,124234,124675,125101,125528,125924,126353,126751,127150,127486,127935,128369,128804,129208,129645,130051,130458,130802,131243,131653,132064,132412,132825,133175,133526,133750,134215,134665,135116,135536,135989,136411,136834,137194,137651,138077,138504,138868,139297,139663,140030,140270,140735,141169,141604,141976,142413,142787,143162,143410,143851,144229,144608,144860,145241,145495,145750,145750,145750,145750,145751,145751,145754,145756,145759,145759,145766,145772,145779,145783,145792,145798,145805,145805,145820,145834,145849,145861,145878,145892,145907,145915,145936,145954,145973,145985,146006,146020,146035,146035,146066,146096,146127,146155,146188,146218,146249,146273,146310,146344,146379,146407,146444,146474,146505,146521,146566,146608,146651,146687,146732,146770,146809,146833,146882,146924,146967,146995,147040,147070,147101,147101,147164,147226,147289,147349,147414,147476,147539,147595,147664,147730,147797,147857,147926,147988,148051,148099,148176,148250,148325,148393,148470,148540,148611,148667,148748,148822,148897,148957,149034,149096,149159,149191,149284,149374,149465,149549,149642,149728,149815,149887,149984,150074,150165,150241,150334,150412,150491,150539,150644,150742,150841,150925,151026,151112,151199,151255,151360,151450,151541,151601,151694,151756,151819,151819,151946,152072,152199,152323,152452,152578,152705,152825,152958,153088,153219,153343,153476,153602,153729,153841,153982,154120,154259,154391,154532,154666,154801,154921,155066,155204,155343,155467,155608,155734,155861,155957,156114,156268,156423,156571,156728,156878,157029,157165,157326,157480,157635,157775,157932,158074,158217,158329,158498,158660,158823,158971,159136,159286,159437,159557,159726,159880,160035,160159,160316,160442,160569,160633,160822,161008,161195,161375,161564,161746,161929,162097,162290,162476,162663,162835,163024,163198,163373,163517,163718,163912,164107,164287,164484,164666,164849,165001,165202,165388,165575,165731,165920,166078,166237,166333,166550,166760,166971,167167,167380,167578,167777,167945,168162,168364,168567,168739,168944,169118,169293,169405,169630,169840,170051,170231,170444,170626,170809,170929,171146,171332,171519,171643,171832,171958,172085,172085,172340,172594,172849,173101,173358,173612,173867,174115,174376,174634,174893,175145,175406,175660,175915,176155,176424,176690,176957,177217,177486,177748,178011,178259,178532,178798,179065,179317,179586,179840,180095,180319,180604,180886,181169,181445,181730,182008,182287,182551,182840,183122,183405,183673,183958,184228,184499,184739,185036,185326,185617,185893,186186,186464,186743,186991,187288,187570,187853,188105,188390,188644,188899,189091,189408,189722,190037,190345,190662,190972,191283,191579,191900,192214,192529,192829,193146,193448,193751,194023,194352,194674,194997,195305,195630,195940,196251,196531,196860,197174,197489,197773,198090,198376,198663,198887,199232,199570,199909,200233,200574,200900,201227,201523,201868,202198,202529,202829,203162,203464,203767,204007,204360,204698,205037,205345,205686,205996,206307,206555,206900,207214,207529,207781,208098,208352,208607,208735,209116,209494,209873,210245,210626,211000,211375,211735,212120,212498,212877,213241,213622,213988,214355,214691,215084,215470,215857,216229,216618,216992,217367,217711,218104,218482,218861,219209,219590,219940,220291,220579,220988,221390,221793,222181,222586,222976,223367,223727,224136,224530,224925,225289,225686,226052,226419,226723,227140,227542,227945,228317,228722,229096,229471,229783,230192,230570,230949,231265,231646,231964,232283,232475,232916,233350,233785,234205,234642,235064,235487,235879,236320,236746,237173,237569,237998,238396,238795,239131,239580,240014,240449,240853,241290,241696,242103,242447,242888,243298,243709,244057,244470,244820,245171,245395,245860,246310,246761,247181,247634,248056,248479,248839,249296,249722,250149,250513,250942,251308,251675,251915,252380,252814,253249,253621,254058,254432,254807,255055,255496,255874,256253,256505,256886,257140,257395,257395,257906,258416,258927,259435,259948,260458,260969,261473,261990,262504,263019,263527,264044,264554,265065,265561,266086,266608,267131,267647,268172,268690,269209,269713,270242,270764,271287,271795,272320,272830,273341,273821,274362,274900,275439,275971,276512,277046,277581,278101,278646,279184,279723,280247,280788,281314,281841,282337,282890,283436,283983,284515,285064,285598,286133,286637,287190,287728,288267,288775,289316,289826,290337,290785,291358,291928,292499,293063,293636,294202,294769,295321,295898,296468,297039,297595,298168,298726,299285,299813,300398,300976,301555,302119,302700,303266,303833,304369,304954,305524,306095,306635,307208,307750,308293,308773,309374,309968,310563,311143,311740,312322,312905,313457,314058,314644,315231,315787,316376,316934,317493,317989,318598,319192,319787,320351,320948,321514,322081,322585,323186,323756,324327,324835,325408,325918,326429,326813,327450,328084,328719,329347,329984,330614,331245,331861,332502,333136,333771,334391,335028,335650,336273,336865,337514,338156,338799,339427,340072,340702,341333,341933,342582,343216,343851,344455,345092,345698,346305,346849,347514,348172,348831,349475,350136,350782,351429,352045,352710,353360,354011,354631,355284,355906,356529,357089,357762,358420,359079,359707,360368,360998,361629,362197,362862,363496,364131,364703,365340,365914,366489,366937,367634,368324,369015,369691,370384,371062,371741,372389,373086,373768,374451,375103,375788,376442,377097,377689,378394,379084,379775,380435,381128,381790,382453,383053,383750,384416,385083,385687,386356,386962,387569,388049,388770,389476,390183,390859,391568,392246,392925,393541,394254,394936,395619,396239,396924,397546,398169,398665,399386,400076,400767,401395,402088,402718,403349,403853,404550,405184,405819,406327,406964,407474,407985,408241,409006,409768,410531,411287,412052,412810,413569,414313,415082,415844,416607,417355,418120,418870,419621,420341,421118,421888,422659,423415,424188,424946,425705,426433,427210,427972,428735,429467,430232,430966,431701,432373,433166,433952,434739,435511,436300,437074,437849,438593,439386,440164,440943,441691,442472,443222,443973,444661,445462,446248,447035,447791,448580,449338,450097,450793,451586,452348,453111,453811,454576,455278,455981,456557,457382,458200,459019,459823,460644,461450,462257,463033,463858,464668,465479,466259,467072,467854,468637,469357,470190,471008,471827,472615,473436,474226,475017,475745,476570,477364,478159,478891,479688,480422,481157,481765,482614,483448,484283,485087,485924,486730,487537,488281,489122,489932,490743,491491,492304,493054,493805,494429,495278,496096,496915,497671,498492,499250,500009,500641,501466,502228,502991,503627,504392,505030,505669,506053,506942,507824,508707,509575,510460,511330,512201,513041,513930,514804,515679,516523,517400,518246,519093,519877,520774,521656,522539,523391,524276,525130,525985,526777,527666,528524,529383,530179,531040,531838,532637,533309,534222,535120,536019,536887,537788,538658,539529,540337,541242,542116,542991,543803,544680,545494,546309,546997,547910,548792,549675,550495,551380,552202,553025,553721,554610,555436,556263,556963,557792,558494,559197,559645,560590,561520,562451,563351,564284,565186,566089,566929,567866,568772,569679,570523,571432,572278,573125,573845,574790,575704,576619,577471,578388,579242,580097,580825,581746,582604,583463,584195,585056,585790,586525,587005,587966,588896,589827,590695,591628,592498,593369,594113,595050,595924,596799,597547,598424,599174,599925,600421,601366,602248,603131,603887,604772,605530,606289,606793,607682,608444,609207,609715,610480,610990,611501,611501,611501,611501,611502,611502,611505,611507,611510,611510,611517,611523,611530,611534,611543,611549,611556,611556,611571,611585,611600,611612,611629,611643,611658,611666,611687,611705,611724,611736,611757,611771,611786,611786,611817,611847,611878,611906,611939,611969,612000,612024,612061,612095,612130,612158,612195,612225,612256,612272,612317,612359,612402,612438,612483,612521,612560,612584,612633,612675,612718,612746,612791,612821,612852,612852,612915,612977,613040,613100,613165,613227,613290,613346,613415,613481,613548,613608,613677,613739,613802,613850,613927,614001,614076,614144,614221,614291,614362,614418,614499,614573,614648,614708,614785,614847,614910,614942,615035,615125,615216,615300,615393,615479,615566,615638,615735,615825,615916,615992,616085,616163,616242,616290,616395,616493,616592,616676,616777,616863,616950,617006,617111,617201,617292,617352,617445,617507,617570,617570,617697,617823,617950,618074,618203,618329,618456,618576,618709,618839,618970,619094,619227,619353,619480,619592,619733,619871,620010,620142,620283,620417,620552,620672,620817,620955,621094,621218,621359,621485,621612,621708,621865,622019,622174,622322,622479,622629,622780,622916,623077,623231,623386,623526,623683,623825,623968,624080,624249,624411,624574,624722,624887,625037,625188,625308,625477,625631,625786,625910,626067,626193,626320,626384,626573,626759,626946,627126,627315,627497,627680,627848,628041,628227,628414,628586,628775,628949,629124,629268,629469,629663,629858,630038,630235,630417,630600,630752,630953,631139,631326,631482,631671,631829,631988,632084,632301,632511,632722,632918,633131,633329,633528,633696,633913,634115,634318,634490,634695,634869,635044,635156,635381,635591,635802,635982,636195,636377,636560,636680,636897,637083,637270,637394,637583,637709,637836,637836,638091,638345,638600,638852,639109,639363,639618,639866,640127,640385,640644,640896,641157,641411,641666,641906,642175,642441,642708,642968,643237,643499,643762,644010,644283,644549,644816,645068,645337,645591,645846,646070,646355,646637,646920,647196,647481,647759,648038,648302,648591,648873,649156,649424,649709,649979,650250,650490,650787,651077,651368,651644,651937,652215,652494,652742,653039,653321,653604,653856,654141,654395,654650,654842,655159,655473,655788,656096,656413,656723,657034,657330,657651,657965,658280,658580,658897,659199,659502,659774,660103,660425,660748,661056,661381,661691,662002,662282,662611,662925,663240,663524,663841,664127,664414,664638,664983,665321,665660,665984,666325,666651,666978,667274,667619,667949,668280,668580,668913,669215,669518,669758,670111,670449,670788,671096,671437,671747,672058,672306,672651,672965,673280,673532,673849,674103,674358,674486,674867,675245,675624,675996,676377,676751,677126,677486,677871,678249,678628,678992,679373,679739,680106,680442,680835,681221,681608,681980,682369,682743,683118,683462,683855,684233,684612,684960,685341,685691,686042,686330,686739,687141,687544,687932,688337,688727,689118,689478,689887,690281,690676,691040,691437,691803,692170,692474,692891,693293,693696,694068,694473,694847,695222,695534,695943,696321,696700,697016,697397,697715,698034,698226,698667,699101,699536,699956,700393};\n scanf(\"%d\", &n), n--;\n printf(\"%d\", array[n]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\t\n\tint n,cnt=0;\n\t\n\tscanf(\"%d\",&n);\n\tint c,a,b;\n\tfor(c=n;c>=1;c--)\n\t{\n\t\tfor(a=1;a<=c;a++)\n\t\t{\n\t\t\tb=a^c;\n\t\t\t\n\t\t\tif( (a+b)>c && a<c && b<c)\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\t\n\tprintf(\"%ld\\n\",cnt/2);\n\t\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main (){\n int n,a,b,c,all=0;\n scanf(\"%d\",&n);\n for(a=1;a<n-1;a++){\n for(b=a+1;b<n;b++){\n c=(a^b);\n if(a+b>c&&c>b&&c<=n)\n all++;\n }\n }\n printf(\"%d\",all);\n}"}, {"source_code": "\n\nint n,ans;\n\n\nint main()\n{\n scanf(\"%d\",&n);\n for (int i = 1; i <= n; i++)\n {\n for (int j = 1; j <= i; j++)\n {\n int temp = i ^ j;\n if (temp > j || temp > i)\n continue;\n if (temp + j <= i)\n continue;\n ans++;\n }\n }\n printf(\"%d\\n\",ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,k,a=0,b,c;\n scanf(\"%d\",&n);\n for (i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n for(k=j;k<i+j;k++)\n {\n if(k>n)\n break;\n {if(!(i^j^k))\n a++;}\n }\n }\n }\n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint main() {\n\tint n = 0, a = 0, b = 0, c = 0, buf = 0;\n\tscanf(\"%d\", &n);\n for (int i = 1; i < n + 1; i++) {\n\t\tc = i;\n \tfor (int j = 1; j < n + 1; j++) {\n \t\tb = j;\n \t\t\ta = c ^ b;\n \t\t\tif ((a <= b) & (b <= c) & ((a + b) > c) & ((a + c) > b) & ((b + c) > a)) {\n \t\t\t\tbuf++;\n \t\t\t}\n\t\t\t}\n\t\t}\n\t\n\tprintf(\"%d\", buf);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint forests = 0;\n\tint i;\n\tint j;\n\tint k;\n\tdouble p;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tfor(j = i; j <= n; j++)\n\t\t{\n\t\t\tk = i ^ j;\n\t\t\tif (k >= i && k >= j && k <= n)\n\t\t\t{\n\t\t\t\tp = ((double)(i + j + k)) / 2.0;\n\t\t\t\tdouble heron = p * (p - i) * (p - j) * (p - k);\n\t\t\t\tif(sqrt(heron) > 0)\n\t\t\t\t{\n\t\t\t\t\tforests++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", forests);\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,i,max,count=0,j,k;\n scanf(\"%d\",&n);\n for ( i = 1; i <= n; ++i)\n {\n for ( j = i+1; j <= n; j++)\n {\n /* code */\n if(i>j)\n max=i;\n else\n max=j;\n for ( k = max+1;( (k < i+j)&& k<=n ) ;k++)\n {\n /* code */\n if(((i^j^k)==0) )\n {count++;\n }\n }\n }\n }\n printf(\"%d\",count );\n}\n"}, {"source_code": "#include <stdio.h>\n\nint isTri (int a , int b , int c)\n{\n if (a+b>c && b+c>a && c+a>b)\n return 1;\n else\n return 0;\n}\n\nint main()\n{\n int n,i,j,x,c;\n\n scanf(\"%d\", &n);\n\n for (i = 1, c=0 ; i<n ; i++)\n {\n for (j = i+1 ; j <= n ; j++)\n {\n x = i^j;\n if (x>n)\n continue;\n if (isTri(i,j,x))\n ++c;\n }\n }\n printf(\"%d\\n\",c/3);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b,c,ans = 0;\n\tscanf(\"%d\",&n);\n\tfor(a = 1; a <= n; a++){\n\t\tfor(b = a + 1; b <= n; b++){\n\t\t\tc = a^b;\n\t\t\tif(c >= 1 && c <= n && c < b + a && c >= b) ans++;\n\t\t}\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n,cnt=0;\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++) {\n for(int j=i;j<=n;j++) {\n for(int k=j;(k<i+j&&k<=n);k++) {\n if((i^j^k)==0) cnt++;\n }\n }\n }\n printf(\"%d\",cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isTriangle(int a,int b,int c)\n{\n if(a+b>c)\n {\n if(b+c>a)\n {\n if(a+c>b)\n {\n return 1;\n }\n }\n }\n return 0;\n}\nint main()\n{\n //printf(\"%d\",3^5^6);\n int i,j,k,n,count=0;\n scanf(\"%d\",&n);\n for(k=5;k<=n;k++)\n {\n for(j=3;j<=k;j++)\n {\n //for(i=n-k-j;i<=j;i++)\n //{\n i=k^j;\n if(i<j){\n if(isTriangle(i,j,k)==1)\n {count++;\n //printf(\"%d and %d and %d\\n\",i,j,k);\n }}\n // }\n\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint n;\nint s[2501][15]= {0};\nint vis[2500][2500]={0};\nint cmp(int a,int b)\n{\n int c=0;\n for(int i=0; i<=11; i++)\n {\n if(s[a][i]!=s[b][i])\n c=c+pow(2,i);\n } if(c>n)\n return 0;\n vis[a][b]=1;\n vis[a][c]=1;\n vis[b][c]=1;\n // printf(\"%d\\n\",c);\n if(a+b<=c||a+c<=b||b+c<=a)\n return 0;\n else\n {\n // if(a<b&&b<c)\n // printf(\"%d %d %d\\n\",a,b,c);\n return 1;\n }\n\n}\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1; i<=n;i++)\n {\n int t=0;\n int a=i;\n while(a!=0)\n {\n s[i][t]=a%2;\n a=a/2;\n t++;\n }\n }\n int sum=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=1; j<i; j++)\n {\n if(vis[j][i]==0&&vis[i][j]==0&&cmp(i,j))\n sum++;\n }\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int ans=0;\n int i,j;\n for(i=1;i<=n;i++)\n {\n for(j=i;j<=n;j++)\n {\n int k=i^j;\n if(k>=j && k<=n && i+j>k) ans++;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main()\n{\n\tlong long int n,i,j,p=0,q,ans=0;\n\tscanf(\"%lld\",&n);\n\t\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tp=i^j;\n\t\t\tif(p>j && p<=n && (i+p)>j && (i+j)>p && (j+p)>i)\n\t\t\t\tans++;\n\t\t}\t\n\t}\n\tprintf(\"%lld\\n\",ans);\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define ll long long int\nint main()\n{\n\tll n;\n\tll i;\n\tll j;\n\tll k;\n\tll count=0;\n\tscanf(\"%lld\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=i;j<=n;j++)\n\t\t{\n\t\t\tk=i^j;\n\n\t\t\tif(k>0 && k<=n)\n\t\t\t{\n\t\t\t\tif(i+j>k && j+k>i && i+k>j)\n\t\t\t\t{\n\t\t\t\t\tif(i<=j && j<=k)\n\t\t\t\t\t{\n\t\t\t\t\t//\tprintf(\"This is i,j,k: %lld %lld %lld\\n\",i,j,k);\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <time.h>\n#include <stdlib.h>\nint tricheck(int a,int b,int c){\n if((abs(a-b)<c)&&(c<a+b) && (abs(b-c)<a)&&(a<b+c) && (abs(a-c)<b)&&(b<a+c)){\n return 1;\n }\n return 0;\n}\nint main(){\n int n;\n scanf(\"%d\",&n);\n int x = 1 , y = 1, z = 1,counter = 0;\n clock_t ali = clock();\n for( x = n ; x >= 1 ;x--){\n for(y = x ; y > x/2 ; y--){\n if((x^y)<y && tricheck(x,y,x^y)){\n counter++;\n }\n }\n }\n printf(\"%d\",counter);\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain(){\n\n int n,i,j,k,pom;\n\n scanf(\"%d\",&n);\n\n int br = 0;\n\n for(i = 1; i <= n; i++){\n for(j = 1; j <= n; j++){\n k = i ^ j;\n if(i + j > k && i + k > j && k + j > i && i <= j && j <= k && k <= n){\n br++;\n }\n }\n }\n\n printf(\"%d\",br);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint cnt,n,l;\nvoid f(int a, int b, int c, int r, int check){\n\tif(a>n||b>n||c>n) return;\n\tif(r>l+1)return;\n\tif(a<=b&&b<=c&&a+b>c&&check){\n\t\tcnt++;\n\t}\n\tf(a,b,c,r+1,0);\n\tf(a+(1<<r),b,c+(1<<r),r+1,1);\n\tf(a+(1<<r),b+(1<<r),c,r+1,1);\n\tf(a,b+(1<<r),c+(1<<r),r+1,1);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\tint s=n;\n\twhile(s){\n\t\ts/=2;\n\t\tl++;\n\t}\n\tf(0,0,0,0,0);\n\tprintf(\"%d\",cnt);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) \n{\n\tint n, ans = 0, i, j, x;\n\tscanf(\"%d\", &n);\n\n\tfor (i = 1; i <= n; i++)\n\t{\n\t\tfor (j = i; j <= n; j++) \n\t\t{\n\t\t\tx = i ^ j;\n\t\t\tif (x < j || i + j <= x || x > n) continue;\n\t\t\tans++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n}"}, {"source_code": "#include <stdio.h>\n//#include <math.h>\n\n//int area(int a,int b,int c){\n // int s,ara;\n //s=(a+b+c)/2; \n //ara=sqrt(s*(s-a)*(s-b)*(s-c));\n //return ara;\n//}\n\nint main(){\n int n,c,a,k;\n c=0;\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++){\n for(int j=i+1;j<=n;j++){\n k=i^j;\n if(k>=j && k<=n){\n // a=area(i,j,k);\n if((i+j)>k && (i+k)>j && (k+j)>i)\n // if(a>0)\n {c++;\n // printf(\"%d %d %d\\n\",i,j,k);\n }}\n \n }\n \n }\n printf(\"%d\\n\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint n;\nint main()\n{\n\tint ans=0;\n\tscanf(\"%d\",&n);\n\tfor(int i=1;i<n;i++)\n\t{\n\t\tfor(int j=i+1;j<=n;j++)\n\t\t{\n\t\t\tint a=i,b=j,c=i^j;\n\t\t\n\t\t\t\tif(c>=1&&c<=n&&((a+b)>c&&(a+c)>b&&(b+c)>a))\n\t\t\t\t{\n\t\t\tans++;\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans/3);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=i; j<=n; j++)\n {\n int temp = i^j;\n if(temp<=n && i+j>temp && temp>i && temp>j)\n count++; \n }\n }\n printf(\"%d \",count);\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nchar Flag[2501];\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int ans = 0;\n for(int a = 1; a <= n; ++a) {\n for(int b = a + 1; b <= n; ++b) {\n int c = a ^ b;\n if(a + b > c && a + c > b && c > b && c <= n) {\n if(!Flag[c]) {\n Flag[c] = 1;\n ++ans;\n }\n }\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d \",&n);//cin>> n>>d;\n\t\n\tint i,j,k,count=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j = i ; j<=n;j++)\n\t\t{\n\t\t\tk = i ^ j;\n\t\t\tif( k<=n && k+i >= j && k+j >=i && i+j >= k )\n\t\t\t\tcount++;\n\t\t}\n\n\t}\n\tprintf(\"%d\\n\",count );\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint G(int x){\n int a = x % 8;\n if(a == 0 || a == 1) return x;\n if(a == 2 || a == 3) return 2;\n if(a == 4 || a == 5) return x+2;\n if(a == 6 || a == 7) return 0;\n return 0;\n}\nint main() {\n\t//code\n\tint n,i,count;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n-3;i++)\n\t{\n\t if(G(i+4)^G(i)==0)\n\t {\n\t count+=1;\n\t }\n\t}\n\tprintf(\"%d\\n\",(count%3));\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint ar[2509];\nint main()\n{\n int i,j,k,n,count=0,x;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n {\n for (j=i; j<=n; j++)\n {\n x=i^j;\n if (ar[x^i]==1||ar[x^j]==1) continue;\n if(x+i>j && x+j>i && i+j>x && x<n)\n {\n //printf(\"active %d %d %d\\n\",i,j,x);\n count++;\n ar[i]=1; ar[j]=1;\n }\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint valid(int a,int b,int c)\n{\n if(a+b>c && b+c>a && c+a>b){\n return 1;\n }\n return 0;\n}\nint main()\n{\n int i,j,n,res=0,temp;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n for(j=i;j<=n;j++){\n temp=i^j;\n if(temp<=n && temp>=j){\n if(valid(i,j,temp)){\n printf(\"%d %d %d\\n\",i,j,temp);\n res++;\n }\n }\n }\n }\n printf(\"%d\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int n ,a,b,c,counter=0;\n\n scanf(\"%d\",&n);\n\n for(c=n;c>=n/2;c--)\n {\n for(b=c;(b>=1)&&(c<2*b);b--)\n {\n for(a=b;(a>=1)&&(a+b>c);a--)\n {\n if(a^b^c)\n continue;\n\n printf(\"%d %d %d\\n\",a,b,c);\n counter++;\n }\n\n\n\n }\n }\n\n printf(\"%d \",counter);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int n ,a,b,c,counter=0;\n\n scanf(\"%d\",&n);\n\n for(c=n;c>=n/2;c--)\n {\n for(b=c;(b>=1)&&(c<2*b);b--)\n {\n for(a=b;(a>=1)&&(a+b>c);a--)\n {\n if(a^b^c)\n continue;\n\n // printf(\"%d %d %d\\n\",a,b,c);\n counter++;\n }\n\n\n\n }\n }\n\n printf(\"%d \",counter);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\n\nint main()\n{\n int n ,a,b,c,counter=0;\n\n scanf(\"%d\",&n);\n\n for(c=n;c>=1;c--)\n {\n for(b=c;b>=1;b--)\n {\n\n for(a=b;(a>=1)&&(a+b>c)&&(a+c>b);a--)\n {\n if(a^b^c)\n continue;\n else if((b+c>a))\n {\n printf(\"%d %d %d\\n\",a,b,c);\n counter++;\n }\n\n\n\n }\n }\n }\n printf(\"%d \",counter);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int a, b, c;\n long long ttl = 0;\n for (a = 1; a <= b; a++)\n for (b = a; b <= n; b++)\n {\n if (a == b)\n continue;\n c = a ^ b;\n //printf(\"%2d %2d %2d %d\\n\", a, b, c, (a + b > c && a + c > b && b + c > a && c >= b && c <= n));\n if (a + b > c && a + c > b && b + c > a && c >= b && c <= n)\n ttl++;\n }\n printf(\"%lld\\n\", ttl);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nint a,b,c,ans=0;\nfor(a=1;a<=n;a++)\nfor(b=a+1;b<=n;b++)\n{\nc = a^b;\nif(c >b && c < a+b)ans++;\n}\nprintf(\"%d\\n\",ans);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint if_dif(int n,int i,int j)\n{\n\treturn n^i^j;\n}\nint if_get(int n)\n{\n\tint i,j;\n\tfor(i=n;i>=1;i--)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(if_dif(j,i,n)==0&&j+i>n&&n-j<i&&!(n==i&&n==j))\n\t\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint i;\n\tint n;\n\tint a[2500];\n\tscanf(\"%d\",&n);\n\ta[0]=0;\n\tfor(i=1;i<n;i++)\n\t\ta[i]=a[i-1]+if_get(i+1);\n\tprintf(\"%d\\n\",a[n-1]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint if_dif(int n,int i,int j)\n{\n\treturn n^i^j;\n}\nint if_get(int n)\n{\n\tint i,j;\n\tfor(i=n;i>=1;i--)\n\t{\n\t\tfor(j=1;j<=i;j++)\n\t\t{\n\t\t\tif(if_dif(n,i,j)==0&&j+i>n&&n-j<i)\n\t\t\t\treturn 1;\n\t\t}\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint i;\n\tint n;\n\tint a[2500];\n\tscanf(\"%d\",&n);\n\ta[0]=0;\n\tfor(i=1;i<n;i++)\n\t\ta[i]=a[i-1]+if_get(i+1);\n\tprintf(\"%d\\n\",a[n-1]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint c=0;\n\tint i,j,k;\n\tc=0;\n\tfor(i=1;i<=n/2;i++)\n\t{\n\t\tfor(j=i;j<=n;j++)\n\t\t{\n\t\t\tk=j^i;\n\t\t\tif(k>=j)\n\t\t\t{\n\t\t\t\tif(i+j>k && k<=n)\n\t\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint forests = 0;\n\tint i;\n\tint j;\n\tint k;\n\tdouble p;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tfor(j = i; j <= n; j++)\n\t\t{\n\t\t\tk = i ^ j;\n\t\t\tif (k >= i && k >= j)\n\t\t\t{\n\t\t\t\tp = ((double)(i + j + k)) / 2.0;\n\t\t\t\tdouble heron = p * (p - i) * (p - j) * (p - k);\n\t\t\t\tif(sqrt(heron) > 0)\n\t\t\t\t{\n\t\t\t\t\tforests++;\n\t\t\t\t\tprintf(\"%d %d %d \\n\", i,j,k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", forests);\n\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint forests = 0;\n\tint i;\n\tint j;\n\tint k;\n\tdouble p;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tfor(j = i; j <= n; j++)\n\t\t{\n\t\t\tk = i ^ j;\n\t\t\tif (k >= i && k >= j && k <= n)\n\t\t\t{\n\t\t\t\tp = ((double)(i + j + k)) / 2.0;\n\t\t\t\tdouble heron = p * (p - i) * (p - j) * (p - k);\n\t\t\t\tif(sqrt(heron) > 0)\n\t\t\t\t{\n\t\t\t\t\tforests++;\n\t\t\t\t\tprintf(\"%d %d %d \\n\", i,j,k);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", forests);\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,i,max,count=0,j,k;\n scanf(\"%d\",&n);\n for (int i = 1; i < n; ++i)\n {\n for (int j = i+1; j < n; ++j)\n {\n /* code */\n if(i>j)\n max=i;\n else \n max=j;\n for (int k = max+1; k < i+j; ++k)\n {\n /* code */\n if((i^j^k)==0)\n count++;\n }\n }\n }\n printf(\"%d\\n\",count );\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,i,max,count=0,j,k;\n scanf(\"%d\",&n);\n for (int i = 1; i < n; ++i)\n {\n for (int j = i+1; j < n; ++j)\n {\n /* code */\n if(i>j)\n max=i;\n else \n max=j;\n for (int k = max+1; k < i+j; ++k)\n {\n /* code */\n if((i^j)==k)\n count++;\n }\n }\n }\n printf(\"%d\\n\",count );\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isTriangle(int a,int b,int c)\n{\n if(a+b>c)\n {\n if(b+c>a)\n {\n if(a+c>b)\n {\n return 1;\n }\n }\n }\n return 0;\n}\nint main()\n{\n //printf(\"%d\",3^5^6);\n int i,j,k,n,count=0;\n scanf(\"%d\",&n);\n for(k=5;k<=n;k++)\n {\n for(j=(n-k)/2;j<=k;j++)\n {\n //for(i=n-k-j;i<=j;i++)\n //{\n i=k^j;\n if(i<j){\n if(isTriangle(i,j,k)==1)\n {count++;\n //printf(\"%d and %d and %d\\n\",i,j,k);\n }}\n // }\n\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isTriangle(int a,int b,int c)\n{\n if(a+b>c)\n {\n if(b+c>a)\n {\n if(a+c>b)\n {\n return 1;\n }\n }\n }\n return 0;\n}\nint main()\n{\n //printf(\"%d\",3^5^6);\n int i,j,k,n,count=0;\n scanf(\"%d\",&n);\n for(k=5;k<=n;k++)\n {\n for(j=(n-k)/2;j<=k;j++)\n {\n //for(i=n-k-j;i<=j;i++)\n //{\n i=k^j;\n if(i<j){\n if(isTriangle(i,j,k)==1)\n {count++;\n printf(\"%d and %d and %d\\n\",i,j,k);}}\n // }\n\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint n;\nint s[2501][15]= {0};\nint vis[2500][2500]={0};\nint cmp(int a,int b)\n{\n int c=0;\n for(int i=0; i<=11; i++)\n {\n if(s[a][i]!=s[b][i])\n c=c+pow(2,i);\n } if(c>n)\n return 0;\n vis[a][b]=1;\n vis[a][c]=1;\n vis[b][c]=1;\n // printf(\"%d\\n\",c);\n if(a+b<=c||a+c<=b)\n return 0;\n else\n {\n // if(a<b&&b<c)\n // printf(\"%d %d %d\\n\",a,b,c);\n return 1;\n }\n\n}\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1; i<=n; i++)\n {\n int t=0;\n int a=i;\n while(a!=0)\n {\n s[i][t]=a%2;\n a=a/2;\n t++;\n }\n }\n int sum=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=1; j<i; j++)\n {\n if(vis[i][j]==0&&cmp(i,j))\n sum++;\n\n }\n }\n printf(\"%d\\n\",sum/2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint n;\nint s[2501][15]= {0};\nint vis[2500][2500]={0};\nint cmp(int a,int b)\n{\n int c=0;\n for(int i=0; i<=11; i++)\n {\n if(s[a][i]!=s[b][i])\n c=c+pow(2,i);\n } if(c>n)\n return 0;\n vis[a][b]=1;\n vis[a][c]=1;\n vis[b][c]=1;\n // printf(\"%d\\n\",c);\n if(a+b<=c||a+c<=b||b+c<=a)\n return 0;\n else\n {\n // if(a<b&&b<c)\n printf(\"%d %d %d\\n\",a,b,c);\n return 1;\n }\n\n}\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1; i<=n; i++)\n {\n int t=0;\n int a=i;\n while(a!=0)\n {\n s[i][t]=a%2;\n a=a/2;\n t++;\n }\n }\n int sum=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=1; j<i; j++)\n {\n if(vis[i][j]==0&&cmp(i,j))\n sum++;\n\n }\n }\n printf(\"%d\\n\",sum/2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint n;\nint s[2501][15]= {0};\nint s1[15]= {0};\nint vis[2500][2500]={0};\nvoid bit(int a)\n{\n int t=0;\n int b=a;\n while(a!=0)\n {\n s[b][t]=a%2;\n a=a/2;\n t++;\n }\n /*for(int i=0;i<13;i++)\n printf(\"%d \",s[b][i]);\n printf(\"\\n\");*/\n}\nint cmp(int a,int b)\n{\n int c=0;\n for(int i=0; i<=11; i++)\n {\n if(s[a][i]!=s[b][i])\n c=c+pow(2,i);\n } if(c>n)\n return 0;\n vis[a][b]=1;\n vis[a][c]=1;\n vis[b][c]=1;\n // printf(\"%d\\n\",c);\n if(a+b<=c||a+c<=b)\n return 0;\n else\n {\n // if(a<b&&b<c)\n // printf(\"%d %d %d\\n\",a,b,c);\n return 1;\n }\n\n}\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1; i<=n; i++)\n {\n int t=0;\n int a=i;\n while(a!=0)\n {\n s[i][t]=a%2;\n a=a/2;\n t++;\n }\n }\n int sum=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=1; j<i; j++)\n {\n if(vis[i][j]==0&&cmp(i,j))\n sum++;\n\n }\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint n;\nint s[2501][15]= {0};\nint s1[15]= {0};\nvoid bit(int a)\n{\n int t=0;\n int b=a;\n while(a!=0)\n {\n s[b][t]=a%2;\n a=a/2;\n t++;\n }\n /*for(int i=0;i<13;i++)\n printf(\"%d \",s[b][i]);\n printf(\"\\n\");*/\n}\nint cmp(int a,int b)\n{\n int c=0;\n for(int i=0; i<=12; i++)\n {\n if(s[a][i]!=s[b][i])\n c=c+pow(2,i);\n }\n // printf(\"%d\\n\",c);\n if(c>n)\n return 0;\n else if(a+b<=c||a+c<=b||b+c<=a)\n return 0;\n else\n {\n // if(a<b&&b<c)\n // printf(\"%d %d %d\\n\",a,b,c);\n return 1;\n }\n\n}\nint main()\n{\n scanf(\"%d\",&n);\n for(int i=1; i<=n; i++)\n {\n bit(i);\n }\n int sum=0;\n for(int i=1; i<=n; i++)\n {\n for(int j=1; j<i; j++)\n {\n if(cmp(i,j))\n sum++;\n\n }\n }\n printf(\"%d\\n\",sum/6);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\n\n\nint main()\n{\n\tlong long int n,i,p=0,q,ans=0;\n\tscanf(\"%lld\",&n);\n\tif(n<=3)\n\t{\n\t\tprintf(\"No\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=4;i<=n;i++)\n\t{\n\t\tq=i;\n\t\tp=0;\n\t\twhile(q>0 && q%2==0 )\n\t\t{\n\t\t\tq=q/2;\n\t\t\tp++;\n\t\t}\n\t\tlong long int r=0;\n\t\twhile(q>0)\n\t\t{\n\t\t\tq=q/2;\n\t\t\tr++;\n\t\t}\n\t\tif(r>1)\n\t\t{\n\t\t\tans+=p;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\n\n\nint main()\n{\n\tlong long int n,i,p=0,q,ans=0;\n\tscanf(\"%lld\",&n);\n\tif(n<=3)\n\t{\n\t\tprintf(\"No\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=4;i<=n;i++)\n\t{\n\t\tq=i;\n\t\tp=0;\n\t\twhile(q>0 && q%2==0 )\n\t\t{\n\t\t\tq=q/2;\n\t\t\tp++;\n\t\t}\n\t\tlong long int r=0;\n\t\twhile(q>0)\n\t\t{\n\t\t\tq=q/2;\n\t\t\tr++;\n\t\t}\n\t\tif(r>1)\n\t\t{\n\t\t\tans+=pow(2,p)-1;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",ans);\n\t\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint cnt,n,l;\nvoid f(int a, int b, int c, int r, int check){\n\tif(a>n||b>n||c>n) return;\n\tif(r>l+1)return;\n\tif(a<=b&&b<=c&&a+b>c&&a>0&&b>0&&c>0&&check){\n\t\tcnt++;\n\t}\n\tf(a,b,c,r+1,0);\n\tf(a+(1<<r),b,c+(1<<r),r+1,1);\n\tf(a+(1<<r),b+(1<<r),c,r+1,1);\n\tf(a,b+(1<<r),c+(1<<r),r+1,1);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\tl=(int)log(n)+1;\n\tf(0,0,0,0,0);\n\tprintf(\"%d\",cnt);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint cnt,n,l;\nvoid f(int a, int b, int c, int r){\n\tif(!(a<=b&&b<=c)) return;\n\tif(a>n||b>n||c>n) return;\n\tif(r>l+1)return;\n\tif(a<=b&&b<=c&&a+b>c){\n\t\tcnt++;\n\t}\n\tif(a!=0||b!=0||c!=0)f(a*2,b*2,c*2,r+1);\n\tf(a*2+1,b*2+0,c*2+1,r+1);\n\tf(a*2+1,b*2+1,c*2+0,r+1);\n\tf(a*2+0,b*2+1,c*2+1,r+1);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\tl=(int)log(n)+1;\n\tf(0,0,0,0);\n\tprintf(\"%d\",cnt);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint cnt,n,l;\nvoid f(int a, int b, int c, int r){\n\tif(!(a<=b&&b<=c)) return;\n\tif(a>n||b>n||c>n) return;\n\tif(r==l+1){\n\t\tif(a<=b&&b<=c&&a+b>c)cnt++;\n\t\treturn;\n\t}\n\tf(a*2,b*2,c*2,r+1);\n\tf(a*2+1,b*2+0,c*2+1,r+1);\n\tf(a*2+1,b*2+1,c*2+0,r+1);\n\tf(a*2+0,b*2+1,c*2+1,r+1);\n}\nint main(){\n\tscanf(\"%d\",&n);\n\tl=(int)log(n)+1;\n\tf(0,0,0,0);\n\tprintf(\"%d\",cnt);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint area(int a,int b,int c){\n int s,ara;\n s=(a+b+c)/2; \n ara=sqrt(s*(s-a)*(s-b)*(s-c));\n return ara;\n}\n\nint main(){\n int n,c,a,k;\n c=0;\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++){\n for(int j=i+1;j<=n;j++){\n k=i^j;\n if(k>=j && k<=n){\n a=area(i,j,k);\n //if((i+j)>k && (i+k)>j && (k+j)>i)\n if(a>0)\n {c++;\n printf(\"%d %d %d\\n\",i,j,k);\n }}\n \n }\n \n }\n //printf(\"%d\\n\",c);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint area(int a,int b,int c){\n int s,ara;\n s=(a+b+c)/2; \n ara=sqrt(s*(s-a)*(s-b)*(s-c));\n return ara;\n}\n\nint main(){\n int n,c,a,k;\n c=0;\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++){\n for(int j=i+1;j<=n;j++){\n k=i^j;\n if(k>=j && k<=n){\n a=area(i,j,k);\n // if((i+j)>k && (i+k)>j && (k+j)>i)\n if(a>0)\n {c++;\n // printf(\"%d %d %d\\n\",i,j,k);\n }}\n \n }\n \n }\n printf(\"%d\\n\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint xor(int a,int b,int c)\n{\n int a1[12],b1[12],c1[12];\n for(int i=0; i<12; i++)\n {\n a1[i]=0;\n b1[i]=0;\n c1[i]=0;\n }\n int temp=1;\n while(a!=0)\n {\n a1[12-temp]=a%2;\n a=a/2;\n temp++;\n }\n temp=1;\n while(b!=0)\n {\n b1[12-temp]=b%2;\n b=b/2;\n temp++;\n }\n temp=1;\n while(c!=0)\n {\n c1[12-temp]=c%2;\n c=c/2;\n temp++;\n }\n int count[12];\n for(int i=0; i<12; i++)\n {\n count[i]=0;\n }\n for(int i=0; i<12; i++)\n {\n if(a1[i]==0)\n count[i]++;\n if(b1[i]==0)\n count[i]++;\n if(c1[i]==0)\n count[i]++;\n }\n for(int i=0; i<12; i++)\n {\n if(count[i]%2==0)\n {\n return -1;\n }\n }\n return 0;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0; i<n; i++)\n {\n arr[i]=i+1;\n }\n int count = 0;\n int i = 0;\n int j = i+1;\n while(i<n-2)\n {\n int k = j+1;\n while(k<n && arr[k] < arr[i] + arr[j] && xor(arr[i],arr[j],arr[k])==0)\n k++;\n count += k-j-1;\n j++;\n \n if(j>=n)\n {\n i++;\n j = i+1;\n }\n }\n printf(\"%d\",count);\n}"}], "src_uid": "838f2e75fdff0f13f002c0dfff0b2e8d"} {"nl": {"description": "The \"Bulls and Cows\" game needs two people to play. The thinker thinks of a number and the guesser tries to guess it.The thinker thinks of a four-digit number in the decimal system. All the digits in the number are different and the number may have a leading zero. It can't have more than one leading zero, because all it's digits should be different. The guesser tries to guess the number. He makes a series of guesses, trying experimental numbers and receives answers from the first person in the format \"x bulls y cows\". x represents the number of digits in the experimental number that occupy the same positions as in the sought number. y represents the number of digits of the experimental number that present in the sought number, but occupy different positions. Naturally, the experimental numbers, as well as the sought number, are represented by four-digit numbers where all digits are different and a leading zero can be present.For example, let's suppose that the thinker thought of the number 0123. Then the guessers' experimental number 1263 will receive a reply \"1 bull 2 cows\" (3 occupies the same positions in both numbers and 1 and 2 are present in both numbers but they occupy different positions). Also, the answer to number 8103 will be \"2 bulls 1 cow\" (analogically, 1 and 3 occupy the same positions and 0 occupies a different one). When the guesser is answered \"4 bulls 0 cows\", the game is over.Now the guesser has already made several guesses and wants to know whether his next guess can possibly be the last one.", "input_spec": "The first input line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910) which represents the number of already made guesses. Then follow n lines in the form of \"ai bi ci\", where ai is the i-th experimental number, bi is the number of bulls, ci is the number of cows (1\u2009\u2264\u2009i\u2009\u2264\u2009n, 0\u2009\u2264\u2009bi,\u2009ci,\u2009bi\u2009+\u2009ci\u2009\u2264\u20094). The experimental numbers are correct, i.e., each of them contains exactly four digits, in each of them all the four digits are different, and there can be a leading zero. All the experimental numbers are different. As the guesser hasn't guessed the number yet, the answer \"4 bulls 0 cows\" is not present.", "output_spec": "If the input data is enough to determine the sought number, print the number with four digits on a single line. If it has less than four digits, add leading zero. If the data is not enough, print \"Need more data\" without the quotes. If the thinker happens to have made a mistake in his replies, print \"Incorrect data\" without the quotes.", "sample_inputs": ["2\n1263 1 2\n8103 2 1", "2\n1234 2 2\n1256 0 2", "2\n0123 1 1\n4567 1 2"], "sample_outputs": ["Need more data", "2134", "Incorrect data"], "notes": null}, "positive_code": [{"source_code": "#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint determine(int *guesses, int *bulls, int *cows, int n);\nbool is_solution(int *K, int *guesses, int *bulls, int *cows, int n);\nbool fits(int *K, int guess, int bulls, int cows);\n\nint main() {\n\tint n = 0, k = 0, result = 0;\n\tint *guesses = NULL;\n\tint *bulls = NULL;\n\tint *cows = NULL;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tguesses = calloc(n, sizeof(int));\n\tbulls = calloc(n, sizeof(int));\n\tcows = calloc(n, sizeof(int));\n\t\n\tfor(k=0; k<n; k++) {\n\t\tscanf(\"%d %d %d\", &guesses[k], &bulls[k], &cows[k]);\n\t}\n\t\n\tresult = determine(guesses, bulls, cows, n);\n\t\n\tswitch(result) {\n\t\tcase (-1):\n\t\t\tprintf(\"Incorrect data\");\n\t\t\tbreak;\n\t\tcase (-2):\n\t\t\tprintf(\"Need more data\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif(result<1000)\n\t\t\t\tprintf(\"0\");\n\t\t\tprintf(\"%d\", result);\n\t\t\tbreak;\n\t}\n\t\n\tprintf(\"\\n\");\n\t\n\tfree(guesses);\n\tfree(bulls);\n\tfree(cows);\n\t\n\treturn 0;\n}\n\nint determine(int *guesses, int *bulls, int *cows, int n) {\n\tint i0 = 0, i1 = 0, i2 = 0, i3=0, result=-1;\n\tint K[4];\n\tbool found = false;\n\t\n\tfor(i3=0;i3<10;i3++){\n\t\tfor(i2=0;i2<10;i2++){\n\t\t\tif(i2==i3) continue;\n\t\t\tfor(i1=0;i1<10;i1++){\n\t\t\t\tif(i1==i2 || i1==i3) continue;\n\t\t\t\tfor(i0=0;i0<10;i0++){\n\t\t\t\t\tif(i0==i1 || i0==i2 || i0==i3) continue;\n\t\t\t\t\tK[0]=i0;\n\t\t\t\t\tK[1]=i1;\n\t\t\t\t\tK[2]=i2;\n\t\t\t\t\tK[3]=i3;\n\t\t\t\t\tif(is_solution(K, guesses, bulls, cows, n)) {\n\t\t\t\t\t\tif(found)\n\t\t\t\t\t\t\treturn (-2);\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresult = K[0]+10*K[1]+100*K[2]+1000*K[3];\n\t\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn result;\n\t\n}\n\nbool is_solution(int *K, int *guesses, int *bulls, int *cows, int n) {\n\tbool cont = true;\n\tint j = 0;\n\t\n\twhile(cont && j<n) {\n\t\tcont = fits(K, guesses[j], bulls[j], cows[j]);\n\t\tj++;\n\t} \n\t\n\treturn cont;\n}\n\nbool fits(int *K, int guess, int bulls, int cows) {\n\tint Guess[4];\n\tbool selected[4];\n\tint j = 0, i = 0, weight = 1, weightx = 10, countb = 0, countc = 0;\n\t\n\tfor(j=0; j<4; j++) {\n\t\tGuess[j] = (guess%weightx) / weight;\n\t\tweight = weightx;\n\t\tweightx *= 10;\n\t}\n\t\n\tfor(j=0; j<4; j++) {\n\t\tif(Guess[j]==K[j])\n\t\t\tcountb++;\n\t}\n\t\n\tif(bulls != countb)\n\t\treturn false;\n\t\n\tfor(j=0; j<4; j++)\n\t\tselected[j] = false;\n\t\n\tfor(i=0; i<4; i++)\n\t\tfor(j=0; j<4; j++) {\n\t\t\tif(i!=j && !selected[i] && Guess[i]==K[j]) {\n\t\t\t\tcountc++;\n\t\t\t\tselected[i] = true;\n\t\t\t}\n\t\t}\n\t\n\tif(cows != countc)\n\t\treturn false;\n\t\n\treturn true;\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, num = 0, count = 0, i, j, k;\n int a[10][4], b[10], c[10];\n int d[10000] = {0};\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) {\n\t for (j = 0; j < 4; j++) scanf(\"%1d\", &a[i][j]);\n\n\t scanf(\"%d %d\", &b[i], &c[i]);\n }\n\n for (i = 0; i < 10000; i++) {\n\t int x = i;\n\t int p[10] = {0};\n\n\t for (j = 0; j < 4; j++) {\n\t p[x % 10]++;\n\n\t x /= 10;\n\t }\n\n\t for (j = 0; j < 10; j++) {\n\t if (p[j] > 1) d[i] = 1;\n\t }\n }\n\n for (i = 0; i < n; i++) {\n\t for (j = 0; j < 10000; j++) {\n\t if (d[j] == 0) {\n\t\t int p[10] = {0};\n\t\t int x = j, y = 0, z = 0;\n\n\t\t for (k = 0; k < 4; k++) p[a[i][k]]++;\n\n\t\t for (k = 0; k < 4; k++) {\n\t\t\t p[x % 10]++;\n\n\t\t\t if (x % 10 == a[i][3 - k]) y++;\n\n\t\t\t x /= 10;\n\t\t }\n\n\t\t for (k = 0; k < 10; k++) {\n\t\t\t if (p[k] == 2) z++;\n\t\t }\n\n\t\t if (y != b[i] || z - y != c[i]) d[j] = 1;\n\t }\n\t }\n }\n\n for (i = 0; i < 10000; i++) {\n\t if (d[i] == 0) {\n\t num = i;\n\t count++;\n\t }\n }\n\n if (count > 1) {\n\t puts(\"Need more data\");\n } else if (count == 1) {\n\t printf(\"%04d\\n\", num);\n } else {\n\t puts(\"Incorrect data\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define UNDECIDED -1\n#define NOTFOUND -2\n\nint as[20];\nint hit[20];\nint blow[20];\nint appear[20];\nint A[20], B[20];\nint N;\n\nint precheck(int num){\n int i,cnt=0;\n for(i=0;i<10;i++) appear[i]=0;\n appear[(num/1000)%10]++;\n appear[(num/100)%10]++;\n appear[(num/10)%10]++;\n appear[(num/1)%10]++;\n for(i=0;i<10;i++)if(appear[i]) cnt++;\n return cnt == 4;\n}\n\nint subcheck(int num, int idx){\n int i, sub=as[idx], h=0, b=0;\n for(i=0;i<10;i++)A[i]=B[i]=0;\n for(i=1;i<=1000;i*=10){\n if((num/i)%10 == (sub/i)%10){\n h++;\n }\n else{\n A[(num/i)%10]++;\n B[(sub/i)%10]++;\n }\n }\n for(i=0;i<10;i++)if(A[i]&&B[i]) b++;\n return h==hit[idx] && b==blow[idx];\n}\n\nint check(){\n int i,j,ok,cnt=0,ans;\n for(i=0;i<10000;i++)if(precheck(i)){\n ok = 1;\n for(j=0;j<N;j++)if(!subcheck(i,j)) ok = 0;\n if(ok){\n cnt++;\n ans = i;\n }\n }\n if(cnt==0) return NOTFOUND;\n else if(cnt==1) return ans;\n else return UNDECIDED;\n}\n\nvoid solve(){\n int result = check();\n if(result == UNDECIDED) puts(\"Need more data\");\n else if(result == NOTFOUND) puts(\"Incorrect data\");\n else printf(\"%04d\\n\", result);\n}\n\nint main(){\n int i;\n scanf(\"%d\",&N);\n for(i=0;i<N;i++) scanf(\"%d%d%d\",as+i,hit+i,blow+i);\n solve();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar g[10][5], ss[5], s[5];\nint n, cc = 0, a[10], b[10];\n\nvoid check() {\n\tint i;\n\tfor (i = 0; i < n; i++) {\n\t\tint j, aa = 0, bb = 0;\n\t\tfor (j = 0; j < 4; j++)\n\t\t\tif (g[i][j] == s[j])\n\t\t\t\taa++;\n\t\t\telse {\n\t\t\t\tint k;\n\t\t\t\tfor (k = 0; k < 4; k++)\n\t\t\t\t\tif (g[i][j] == s[k])\n\t\t\t\t\t\tbreak;\n\n\t\t\t\tif (k != 4)\n\t\t\t\t\tbb++;\n\t\t\t}\n\n\t\tif (aa != a[i] || bb != b[i])\n\t\t\tbreak;\n\t}\n\n\tif (i == n) {\n\t\tcc++;\n\t\tstrcpy(ss, s);\n\t}\n}\n\nint main() {\n\tscanf(\"%d\", &n);\n\n\tint i;\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%s%d%d\", g[i], &a[i], &b[i]);\n\n\tchar a, b, c, d;\n\tfor (a = '0'; a <= '9'; a++)\n\t\tfor (b = '0'; b <= '9'; b++)\n\t\t\tfor (c = '0'; c <= '9'; c++)\n\t\t\t\tfor (d = '0'; d <= '9'; d++)\n\t\t\t\t\tif (a != b && a != c && a != d && b != c && b != d && c != d) {\n\t\t\t\t\t\ts[0] = a; s[1] = b; s[2] = c; s[3] = d; s[4] = '\\0';\n\t\t\t\t\t\tcheck();\n\t\t\t\t\t}\n\n\tif (cc == 0)\n\t\tputs(\"Incorrect data\");\n\telse if (cc == 1)\n\t\tputs(ss);\n\telse\n\t\tputs(\"Need more data\");\n\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint determine(int *guesses, int *bulls, int *cows, int n);\nbool is_solution(int k, int *guesses, int *bulls, int *cows, int n);\nbool fits(int k, int guess, int bulls, int cows);\n\nint main() {\n\tint n = 0, k = 0, result = 0;\n\tint *guesses = NULL;\n\tint *bulls = NULL;\n\tint *cows = NULL;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tguesses = calloc(n, sizeof(int));\n\tbulls = calloc(n, sizeof(int));\n\tcows = calloc(n, sizeof(int));\n\t\n\tfor(k=0; k<n; k++) {\n\t\tscanf(\"%d %d %d\", &guesses[k], &bulls[k], &cows[k]);\n\t}\n\t\n\tresult = determine(guesses, bulls, cows, n);\n\t\n\tswitch(result) {\n\t\tcase 0:\n\t\t\tprintf(\"Incorrect data\");\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tprintf(\"Need more data\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tprintf(\"%d\", result);\n\t\t\tbreak;\n\t}\n\t\n\tprintf(\"\\n\");\n\t\n\tfree(guesses);\n\tfree(bulls);\n\tfree(cows);\n\t\n\treturn 0;\n}\n\nint determine(int *guesses, int *bulls, int *cows, int n) {\n\tint k = 0, j = 0, result = 0;\n\t\n\tk = 1000;\n\t\n\twhile(k<=9999 && j<=1) {\n\t\tif(is_solution(k, guesses, bulls, cows, n)) {\n\t\t\tresult = k;\n\t\t\tj++;\t\n\t\t}\n\t\tk++;\n\t}\n\t\n\tif(j==2)\n\t\tresult = 1;\n\t\n\treturn result;\n}\n\nbool is_solution(int k, int *guesses, int *bulls, int *cows, int n) {\n\tbool cont = true;\n\tint j = 0;\n\t\n\twhile(cont && j<n) {\n\t\tcont = fits(k, guesses[j], bulls[j], cows[j]);\n\t\tj++;\n\t} \n\t\n\treturn cont;\n}\n\nbool fits(int k, int guess, int bulls, int cows) {\n\tint Guess[4];\n\tint K[4];\n\tbool selected[4];\n\tint j = 0, i = 0, weight = 1, weightx = 10, countb = 0, countc = 0;\n\t\n\tfor(j=0; j<4; j++) {\n\t\tGuess[j] = (guess%weightx) / weight;\n\t\tK[j] = (k%weightx) / weight;\n\t\tweight = weightx;\n\t\tweightx *= 10;\n\t}\n\t\n\tfor(j=0; j<4; j++) {\n\t\tif(Guess[j]==K[j])\n\t\t\tcountb++;\n\t}\n\t\n\tif(bulls != countb)\n\t\treturn false;\n\t\n\tfor(j=0; j<4; j++)\n\t\tselected[j] = false;\n\t\n\tfor(i=0; i<4; i++)\n\t\tfor(j=0; j<4; j++) {\n\t\t\tif(i!=j && !selected[i] && Guess[i]==K[j]) {\n\t\t\t\tcountc++;\n\t\t\t\tselected[i] = true;\n\t\t\t}\n\t\t}\n\t\n\tif(cows != countc)\n\t\treturn false;\n\t\n\treturn true;\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, num = 0, count = 0, i, j, k;\n int a[10][4], b[10], c[10];\n int d[10000] = {0};\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++) {\n\t for (j = 0; j < 4; j++) scanf(\"%1d\", &a[i][j]);\n\n\t scanf(\"%d %d\", &b[i], &c[i]);\n }\n\n for (i = 0; i < 10000; i++) {\n\t int x = i;\n\t int p[10] = {0};\n\n\t for (j = 0; j < 4; j++) {\n\t p[x % 10]++;\n\n\t x /= 10;\n\t }\n\n\t for (j = 0; j < 10; j++) {\n\t if (p[j] > 1) d[i] = 1;\n\t }\n }\n\n for (i = 0; i < n; i++) {\n\t for (j = 0; j < 10000; j++) {\n\t if (d[j] == 0) {\n\t\t int p[10] = {0};\n\t\t int x = j, y = 0, z = 0;\n\n\t\t for (k = 0; k < 4; k++) p[a[i][k]]++;\n\n\t\t for (k = 0; k < 4; k++) {\n\t\t\t p[x % 10]++;\n\n\t\t\t if (x % 10 == a[i][3 - k]) y++;\n\n\t\t\t x /= 10;\n\t\t }\n\n\t\t for (k = 0; k < 10; k++) {\n\t\t\t if (p[k] == 2) z++;\n\t\t }\n\n\t\t if (y != b[i] || z - y != c[i]) d[j] = 1;\n\t }\n\t }\n }\n\n for (i = 0; i < 10000; i++) {\n\t if (d[i] == 0) {\n\t num = i;\n\t count++;\n\t }\n }\n\n if (count > 1) {\n\t puts(\"Need more data\");\n } else if (count == 1) {\n\t printf(\"%d\\n\", num);\n } else {\n\t puts(\"Incorrect data\");\n }\n\n return 0;\n}\n"}], "src_uid": "142e5f2f08724e53c234fc2379216b4c"} {"nl": {"description": "InputThe input contains a single integer $$$a$$$ ($$$1 \\le a \\le 99$$$).OutputOutput \"YES\" or \"NO\".ExamplesInput\n5\nOutput\nYES\nInput\n13\nOutput\nNO\nInput\n24\nOutput\nNO\nInput\n46\nOutput\nYES\n", "input_spec": "The input contains a single integer $$$a$$$ ($$$1 \\le a \\le 99$$$).", "output_spec": "Output \"YES\" or \"NO\".", "sample_inputs": ["5", "13", "24", "46"], "sample_outputs": ["YES", "NO", "NO", "YES"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <math.h>\n//\ufffd\u04f4\ufffd\ufffd\ufffd\ufffd\ufffd\u05aa\ufffd\ufffd\ufffd\ufffd\n//n%10==1||n%10==7||n%10==9||(n>9&&n<30)||n/10==1||n/10==7||n/10==9,\n//\ufffd\ufffd12\u05ae\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0429\ufffd\ufffd\ufffd\ufffd\ufffd\u0136\ufffd\ufffd\ufffd\ufffd\ufffd\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tif (n % 10 == 1 || n % 10 == 7 \n\t || n %10 == 9 || (n > 9 && n != 12&& n < 30 ) \n\t || (n / 10 == 1 && n != 12) || n / 10 == 7 || n / 10 == 9) \n\t{\n\t \t printf(\"NO\\n\");\n\t}\n\telse printf(\"YES\\n\"); \n\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n==1||n==7||n==9||n==10||n==11||(n>=13&&n<=29)||n==31||n==37||n==39||n==41||n==47||n==49||n==51||n==57||n==59)\n\t\tprintf(\"NO\\n\");\n\telse if(n==61||n==67||n==69||(n>=70&&n<=79)||n==81||n==87||n==89||(n>=90&&n<=99))\n\t\tprintf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n}\n"}, {"source_code": "\n/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:03/04/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n\n#include <stdio.h>\nint main()\n{\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tx=n/10;\n\ty=n%10;\n\tif(n==12) printf(\"YES\");\n\telse if(x==1||x==2||x==7||x==9) printf(\"NO\");\n\telse if(y==1||y==7||y==9) printf(\"NO\");\n\telse printf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n>9&&n<30&&n!=12)\n printf(\"No\");\n else if(n>69&&n<80)\n printf(\"No\");\n else if(n>89)\n printf(\"No\");\n else if(n%10==1)\n printf(\"No\");\n else if(n%10==7)\n printf(\"No\");\n else if(n%10==9)\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tx=n/10;\n\ty=n%10;\n\tif(n==12) printf(\"YES\");\n\telse if(x==1||x==2||x==7||x==9) printf(\"NO\");\n\telse if(y==1||y==7||y==9) printf(\"NO\");\n\telse printf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, first_digit, second_digit;\n scanf(\"%d\", &n);\n first_digit = n%10;\n second_digit = (n-first_digit)/10;\n if (n>=1 && n<=99){\n if(first_digit==1 || first_digit==7 || first_digit==9){\n printf(\"NO\");\n } else if(n!=12 && (second_digit == 1 || second_digit == 2 || second_digit == 7 || second_digit == 9)){\n printf(\"NO\");\n } else{\n printf(\"YES\");\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"NO\",\"YES\"};\nint main(){\n\tint i,n;\n\ta[2]=a[3]=a[4]=a[5]=a[46]=a[12]=a[23]=a[30]=a[35]=a[43]=a[52]=a[64]=a[86]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"NO\",\"YES\"};\nint main(){\n\tint i,n;\n\ta[2]=a[3]=a[4]=a[5]=a[46]=a[12]=a[23]=a[30]=a[35]=a[43]=a[52]=a[64]=a[86]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar ones[] = { 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 };\nchar tens[] = { 0, 0, 0, 1, 1, 1, 1, 0, 1, 0 };\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf((a < 20 ? ones[a] : tens[a / 10] && ones[a % 10]) ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() \n{\n int n;\n scanf(\"%d\",&n);\n\tif(n<20) \n {\n if(n==2||n==3||n==4||n==5||n==6||n==8||n==12) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n else \n {\n int a=n/10,b=n%10;\n if(a==2||a==7||a==9||b==1||b==7||b==9) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n==2||n==3||n==5||n==46||n==4||n==12||n==31||n==30||n==35||n==43||n==52||n==64||n==86)\n printf(\"YES\");\n else if\n (printf(\"NO\"));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint main(){\nint a;\nscanf(\"%d\",&a);\nint a1=1,a2=2,a7=7,a9=9;\nif (a==12){printf(\"YES\");}\nelse if ((a%10==1)||(a%10==7)||(a%10==9)){\n printf(\"NO\");\n}\nelse if ((a/10==1)||(a/10==2)||(a/10==7)||(a/10==9)){\n printf(\"NO\");\n}\nelse if (a==10){\n printf(\"NO\");\n}\nelse printf(\"YES\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n==2 || n==3 || n==4 || n==5 || n==12 || n==30 || n ==35 || n==43 || n==46 || n==52 || n==64 || n==86)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n \n\n}"}, {"source_code": " #include<stdio.h>\n int a;\n int main(){\n \tscanf(\"%d\",&a);\n \tprintf(a%10!=1&&a%10!=7&&a%10!=9&&a/10!=1&&a/10!=2&&a/10!=7&&a/10!=9||a==12?\"YES\":\"NO\");\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if(n==2 || n==3 || n==4 || n==5 || n==12 || n==30 || n ==35 || n==43 || n==46 || n==52 || n==64 || n==86)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n \n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\",&n);\n if ((n>9 && n<30 && n!=12 ) || (n>70 && n<80) || (n>90 && n<100) || n%10==1 || n%10==7 || n%10==9){\n printf(\"NO\"); \n }else{\n printf(\"YES\");\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,x,y;\n scanf(\"%d\",&n);\n x=n/10;\n y=n%10;\n if(n==12) printf(\"YES\");\n else if(x==1||x==2||x==7||x==9) printf(\"NO\");\n else if(y==1||y==7||y==9) printf(\"NO\");\n else printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{ int n;\n scanf(\"%d\",&n);\n if(n%10==7||n%10==9||n%10==1||n/10==7)\n {\n printf(\"NO \\n\");\n return 0;\n }\n if(n>12&&n<=29)\n {\n printf(\"NO \\n\");\n return 0;\n }\n if(n==10)\n {printf(\"NO \\n\");\n return 0;}\n printf(\"YES \\n\");\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n if (n >= 2 && n <= 6 || n == 8 || n == 12 || n == 30 || n >= 32 && n <= 36 || n == 38)\n {\n printf(\"YES\");\n return 0;\n }\n if (n == 40 || n >= 42 && n <= 46 || n == 48 || n == 50 || n >= 52 && n <= 56 || n == 58)\n {\n printf(\"YES\");\n return 0;\n }\n if (n == 60 || n >= 62 && n <= 66 || n == 68)\n {\n printf(\"YES\");\n return 0;\n }\n if (n == 80 || n >= 82 && n <= 86 || n == 88)\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tprintf(n == 1 ? \"NO\\n\" : \"YES\\n\");\n\t} \n\telse if (n < 20)\n\t{\n\t\tif (n == 12) printf(\"YES\\n\");\n\t\telse if (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse \n\t{\n\t\tif (n == 37 || n == 41) printf(\"NO\");\n\t\telse if (n % 4 == 0 ) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (c % 5 == 0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n } \n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tif (n != 1) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t} \n\telse\n\t{\n\t\tif (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tprintf(n == 1 ? \"NO\\n\" : \"YES\\n\");\n\t} \n\telse if (n < 20)\n\t{\n\t\tif (n == 12) printf(\"YES\\n\");\n\t\telse if (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse \n\t{\n\t\tif (n == 37) printf(\"NO\");\n\t\telse if (n % 4 == 0 ) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n//\ufffd\u04f4\ufffd\ufffd\ufffd\ufffd\ufffd\u05aa\ufffd\ufffd\ufffd\ufffd\n//n%10==1||n%10==7||n%10==9||(n>9&&n<30)||n/10==1||n/10==7||n/10==9,\n//\ufffd\ufffd12\u05ae\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0429\ufffd\ufffd\ufffd\ufffd\ufffd\u0136\ufffd\ufffd\ufffd\ufffd\ufffd\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tif (n % 10 == 1 || n % 10 == 7 \n\t || n %10 == 9 || (n > 9 && n != 12&& n < 30 ) \n\t || n /10 == 1 || n / 10 == 7 || n / 10 == 9) \n\t{\n\t \t printf(\"NO\\n\");\n\t}\n\telse printf(\"YES\\n\"); \n\n\treturn 0;\n } \n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tif (IsPrime(n)) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t} \n\telse\n\t{\n\t\tif (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tif (n != 1) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t} \n\telse\n\t{\n\t\tif (n == 12) printf(\"YES\\n\");\n\t\telse if (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (c % 5 == 0 || c == 2) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\t\n\treturn 0;\n } \n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tprintf(n == 1 ? \"NO\\n\" : \"YES\\n\");\n\t} \n\telse if (n < 20)\n\t{\n\t\tif (n == 12) printf(\"YES\\n\");\n\t\telse if (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse \n\t{\n\t\tif (n == 37 || n == 41 || n == 49) printf(\"NO\");\n\t\telse if (n % 4 == 0 ) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint IsPrime(int n);\n\nint main()\n{\n\tint n, a, b, c;\n\tscanf(\"%d\", &n);\n\ta = n / 10;\n\tb = n % 10;\n\tc = a + b;\n\tif (n < 10)\n\t{\n\t\tprintf(n == 1 ? \"NO\\n\" : \"YES\\n\");\n\t} \n\telse if (n < 20)\n\t{\n\t\tif (n == 12) printf(\"YES\\n\");\n\t\telse if (c % 5 == 0) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse \n\t{\n\t\tif (n % 4 == 0 ) printf(\"NO\\n\");\n\t\telse printf(\"YES\\n\");\n\t}\n\t\n\treturn 0;\n } \n\nint IsPrime(int n)\n{\n\tint i, ok = n > 1, m = sqrt(n);\n\tfor (i = 2; i <= m && ok; ++i)\n\t{\n\t\tif (n % i == 0)\n\t\t{\n\t\t\tok = 0;\n\t\t}\n\t}\n\treturn ok;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n//\ufffd\u04f4\ufffd\ufffd\ufffd\ufffd\ufffd\u05aa\ufffd\ufffd\ufffd\ufffd\n//n%10==1||n%10==7||n%10==9||(n>9&&n<30)||n/10==1||n/10==7||n/10==9,\n//\ufffd\ufffd12\u05ae\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u0429\ufffd\ufffd\ufffd\ufffd\ufffd\u0136\ufffd\ufffd\ufffd\ufffd\ufffd\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tif (n == 12 || n % 10 == 1 || n % 10 == 7 \n\t || n %10 == 9 || (n > 9 && n < 30 ) \n\t || n /10 == 1 || n / 10 == 7 || n / 10 == 9) \n\t{\n\t \t printf(\"NO\\n\");\n\t}\n\telse printf(\"YES\\n\"); \n\n\treturn 0;\n } \n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n if(n>12&&n<30)\n printf(\"No\");\n else if(n>69&&n<80)\n printf(\"No\");\n else if(n>89)\n printf(\"No\");\n else if(n%10==1)\n printf(\"No\");\n else if(n%10==7)\n printf(\"No\");\n else if(n%10==9)\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if(n%5==0||n%6!=0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n if(n>=1 && n<=99){\n printf(\"Yes\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, first_digit, second_digit;\n scanf(\"%d\", &n);\n first_digit = n%10;\n second_digit = (n-first_digit)/10;\n if(first_digit==1 || first_digit==7 || first_digit==9 ){\n printf(\"NO\");\n } else if(second_digit == 1 || second_digit == 2 || second_digit == 7 || second_digit == 9 && n!=12){\n printf(\"NO\");\n } else{\n printf(\"YES\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"YES\",\"NO\"};\nint main(){\n\tint i,n;\n\ta[5]=a[46]=0;\n\ta[12]=1;\n\ta[13]=a[24]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"YES\",\"NO\"};\nint main(){\n\tint i,n;\n\ta[5]=a[46]=0;\n\ta[13]=a[24]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"YES\",\"NO\"};\nint main(){\n\tint i,n;\n\ta[5]=a[46]=0;\n\ta[6]=1;\n\ta[13]=a[24]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[110];\nchar c[][10]={\"YES\",\"NO\"};\nint main(){\n\tint i,n;\n\ta[5]=a[46]=0;\n\ta[4]=1;\n\ta[13]=a[24]=1;\n\tscanf(\"%d\",&n);\n\tprintf(\"%s\",c[a[n]]);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf(a == 5 || a / 10 + a % 10 >= 10 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar ones[] = { 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };\nchar tens[] = { 0, 0, 0, 1, 1, 1, 1, 0, 1, 0 };\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf((a < 20 ? ones[a] : tens[a / 10] && ones[a % 10]) ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a;\n\n\tscanf(\"%d\", &a);\n\tprintf(a == 5 || a / 10 + a % 10 == 10 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a, cnt;\n\n\tscanf(\"%d\", &a);\n\tcnt = 0;\n\twhile (cnt < 10) {\n\t\ta = a % 10 * 10 + a / 10;\n\t\tcnt += a % 10;\n\t}\n\tprintf(cnt == 10 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint main(){\nint a;\nscanf(\"%d\",&a);\nint a1=1,a2=2,a7=7,a9=9;\nif ((a%10==1)||(a%10==7)||(a%10==9)){\n printf(\"NO\");\n}\nelse if ((a/10==1)||(a/10==2)||(a/10==7)||(a/10==9)){\n printf(\"NO\");\n}\nelse if (a==10){\n printf(\"NO\");\n}\nelse printf(\"YES\");\n\n}\n"}], "src_uid": "821529a4644b74483bcdf80fc318d1f8"} {"nl": {"description": "n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n\u2009\u2264\u2009m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not always possible to share pillows equally, but any hobbit gets hurt if he has at least two pillows less than some of his neighbors have. Frodo will sleep on the k-th bed in the row. What is the maximum number of pillows he can have so that every hobbit has at least one pillow, every pillow is given to some hobbit and no one is hurt?", "input_spec": "The only line contain three integers n, m and k (1\u2009\u2264\u2009n\u2009\u2264\u2009m\u2009\u2264\u2009109, 1\u2009\u2264\u2009k\u2009\u2264\u2009n)\u00a0\u2014 the number of hobbits, the number of pillows and the number of Frodo's bed.", "output_spec": "Print single integer\u00a0\u2014 the maximum number of pillows Frodo can have so that no one is hurt.", "sample_inputs": ["4 6 2", "3 10 3", "3 6 1"], "sample_outputs": ["2", "4", "3"], "notes": "NoteIn the first example Frodo can have at most two pillows. In this case, he can give two pillows to the hobbit on the first bed, and one pillow to each of the hobbits on the third and the fourth beds.In the second example Frodo can take at most four pillows, giving three pillows to each of the others.In the third example Frodo can take three pillows, giving two pillows to the hobbit in the middle and one pillow to the hobbit on the third bed."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,k;\n\tscanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n\tlong long int left=k,right=k,val=1,i=1;\n\tm=m-n;\n\twhile(m>=i)\n\t{\n\t\tval++;\n\t\tm=m-i;\n\t\tif(left>1)\n\t\t{\n\t\t\tleft--;\n\t\t\ti++;\n\t\t}\n\t\tif(right<n)\n\t\t{\n\t\t\tright++;\n\t\t\ti++;\n\t\t}\n\t\tif(left==1 && right==n)\n{\n\tval=val+m/n;\n\tbreak;\n}\n\n}\nprintf(\"%I64d\",val);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int left = 0, right = 0;\n int n = 0, m = 0, k = 0;\n int i = 1, val = 1;\n \n scanf(\"%d %d %d\", &n, &m, &k);\n left = right = k;\n m -= n;\n \n while (m >= i) {\n val++;\n m -= i;\n if (left > 1) {\n left--;\n i++;\n }\n \n if (right < n) {\n right++;\n i++;\n }\n \n if (left == 1 && right == n) {\n val = val + m / n;\n break;\n }\n }\n \n printf(\"%d\\n\", val);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define max(a,b) (a > b) ? a : b\n#define min(a,b) (a < b) ? a : b\nint main()\n{\n\tint i,j,k,n,m,res,mid,ans;\n\tlong long l,r;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tres = m - n;\n\tmid = (int)sqrt((double)(1+8*(double)res)) - 1;\n\tmid /= 2;\n\tif(mid == 0)\n\t{\n\t\tfor(i = mid;i <= res;i++)\n\t\t{\n\t\t\tif(i > k - 1) l = (2*i-k+1)*(long long)k/2;\n\t\t\telse l = (1+i)*(long long)i / 2;\n\t\t\tif(i >= (n-k))r = (2*i-n+k)*(long long)(n-k+1)/2;\n\t\t\telse r = (1+i)*(long long)i/2;\n\t\t\tif(l+r-i > res)break;\n\t\t}\n\t\tprintf(\"%d\\n\",i);\n\t\treturn 0;\n\t}\n\tfor(i = mid;i <= res;i += mid)\n\t{\n\t\tif(i > k - 1) l = (2*i-k+1)*(long long)k/2;\n\t\telse l = (1+i)*(long long)i / 2;\n\t\tif(i >= (n-k))r = (2*i-n+k)*(long long)(n-k+1)/2;\n\t\telse r = (1+i)*(long long)i/2;\n\t\tif(l+r-i > res)break;\n\t}\n\tj = i;\n\tfor(i = j-mid;i <= j;i++)\n\t{\n\t\tif(i > k - 1) l = (2*i-k+1)*(long long)k/2;\n\t\telse l = (1+i)*(long long)i / 2;\n\t\tif(i >= (n-k))r = (2*i-n+k)*(long long)(n-k+1)/2;\n\t\telse r = (1+i)*(long long)i/2;\n\t\tif(l+r-i > res)break;\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include <stdlib.h> \n\nint main()\n{\n\tlong long int m, n, k, i, t;\n\tlong long int s1=0, s2=0;\n\tscanf(\"%I64d %I64d %I64d\", &n, &m, &k);\n\tt = m;\n\tfor (i = m/n; i <= m; i++)\n\t{\n\t\tif (k >= i)\n\t\t\ts1 = (2*i - i + 1)*i/2 + k - i;\n\t\telse\n\t\t\ts1 = (2*i - k + 1)*k / 2;\n\t\tif ((n-k+1) >= i)\n\t\t\ts2 = (2*i - i + 1)*i / 2 + (n - k + 1) - i;\n\t\telse\n\t\t\ts2 = (2*i - (n - k + 1) + 1)*(n - k + 1) / 2;\n\n\t\tif ((s1+s2-i)> m)\n\t\t{\n\t\t\tt = i - 1;\n\t\t\tbreak;\n\t\t}\n\n\t}\n\t\n\tprintf(\"%I64d \",t);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint check(long long n, long long m, long long k, long long f) {\n\tlong long x = f < k ? (f * (f + 1) / 2 + k - f) : (k * (f + f - k + 1) / 2); \n\tlong long y = f - 1 < n - k ? ((f - 1) * f / 2 + (n - k) - (f - 1)) : ((n - k) * (f - 1 + f - 1 - (n - k) + 1) / 2);\n\n\treturn x + y <= m;\n}\n\nlong long binsearch(int n, int m, int k) {\n\tlong long lower = 1, upper = m + 1;\n\n\twhile (upper - lower > 1) {\n\t\tlong long mid = (lower + upper) / 2;\n\n\t\tif (check(n, m, k, mid))\n\t\t\tlower = mid;\n\t\telse\n\t\t\tupper = mid;\n\t}\n\treturn lower;\n}\n\nint main() {\n\tint n, m, k;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tprintf(\"%lld\\n\", binsearch(n, m, k));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long sum(long long l, long long r) {\n\treturn (r - l + 1) * (l + r) / 2;\n}\n\nlong long count(long long f, long long k) {\n\treturn f < k ? sum(1, f) + k - f : sum(f - k + 1, f);\n}\n\nint check(long long n, long long m, long long k, long long f) {\n\treturn count(f, k) + count(f - 1, n - k) <= m;\n}\n\nlong long binsearch(int n, int m, int k) {\n\tlong long lower = 1, upper = m + 1;\n\n\twhile (upper - lower > 1) {\n\t\tlong long mid = (lower + upper) / 2;\n\n\t\tif (check(n, m, k, mid))\n\t\t\tlower = mid;\n\t\telse\n\t\t\tupper = mid;\n\t}\n\treturn lower;\n}\n\nint main() {\n\tint n, m, k;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tprintf(\"%lld\\n\", binsearch(n, m, k));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint mini(int a, int b)\n{\n if(a<b)\n {\n return a;\n }\n return b;\n}\n\nint main()\n{\n int n, m, k, a, cnt, l, r;\n scanf(\"%d %d %d\", &n, &m, &k);\n if(n==1)\n {\n printf(\"%d\\n\", m);\n }\n else if(n==2)\n {\n printf(\"%d\\n\", (m/2)+(m%2));\n }\n else\n {\n m-=n;\n a=1;\n cnt=0;\n l=k-1;\n r=n-k;\n while(m>0)\n {\n a++;\n m--;\n cnt++;\n m-=mini(l, cnt);\n m-=mini(r, cnt);\n }\n printf(\"%d\\n\", a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint mini(int a, int b)\n{\n if(a<b)\n {\n return a;\n }\n return b;\n}\n\nint main()\n{\n int n, m, k, a, cnt, l, r;\n scanf(\"%d %d %d\", &n, &m, &k);\n if(n==1)\n {\n printf(\"%d\\n\", m);\n }\n else\n {\n m-=n;\n a=1;\n cnt=0;\n l=k-1;\n r=n-k;\n while(m>0)\n {\n a++;\n m--;\n cnt++;\n m-=mini(l, cnt);\n m-=mini(r, cnt);\n }\n printf(\"%d\\n\", a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define pr(a) printf(\"%I64d \",a);\n\nlong long scount(long long n,long long m)\n{\n long long p = n-m+1;\n return ((n+p)*(n-p+1))/2;\n}\n\nint main()\n{\n long long n,m,k,rez,levo,desno,range=0,br;\n scanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n desno = n-k;\n levo = n-desno-1;\n m -= n;\n rez = 1;\n if(levo>desno)\n {\n br = scount(levo+1,levo+1);\n br += scount(levo,desno);\n }\n else\n {\n br = scount(desno+1,desno+1);\n br += scount(desno,levo);\n }\n if(m>br)\n {\n rez += levo>desno?levo+1:desno+1;\n m -= br\n ;\n rez += m/n;\n }\n else if(m==br)\n {\n rez += levo>desno?levo+1:desno+1;\n }\n else\n {\n while(m)\n {\n m--;\n if(desno < range)\n if(m>=desno) m-=desno;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo < range)\n if(m>=levo) m-=levo;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo-range > 0 || desno-range > 0) range++;\n rez++;\n }\n }\n printf(\"%I64d\",rez);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\ntypedef long long int ll;\nint main()\n{\n ll n,m,k;\n scanf(\"%I64d %I64d %I64d\",&n,&m,&k);\n ll l,r,s=0;\n r=k;\n l = k;\n m-=n;\n s=1;\n while(m)\n {\n if(l==1 && r==n)\n break;\n else if(m>=(r-l+1))\n {\n m-=(r-l+1);\n s++;\n l--;\n r++;\n r=n>r?r:n;\n l=1>l?1:l;\n }\n else\n break;\n }\n s+=m/(r-l+1);\n printf(\"%I64d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long n, m, k, ans, layer_left = 0, layer_right = 0;\nlong long left_dist, right_dist;\n\nvoid add_layer()\n{\n\tif (left_dist > layer_left)\n\t{\n\t\tm -= layer_left;\n\t\tlayer_left++;\n\t}\n\telse\n\t\tm -= layer_left;\n\n\tif (right_dist > layer_right)\n\t{\n\t\tm -= layer_right;\n\t\tlayer_right++;\n\t}\n\telse\n\t\tm -= layer_right;\n\n\tm -= 1;\n}\n\n\nint main()\n{\n\tscanf(\"%I64d %I64d %I64d\", &n, &m, &k);\n\tleft_dist = k - 1; right_dist = n - k;\n\tm -= n;\n\n\twhile (m >= layer_left + layer_right + 1)\n\t{\n\t\tif (left_dist == layer_left && right_dist == layer_right)\n\t\t{\n\t\t\tans += m / n;\n\t\t\tm %= n;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tadd_layer();\n\t\t\tans++;\n\t\t}\n\t}\n\n\tprintf(\"%I64d\", ans + 1);\n}"}, {"source_code": "#include<math.h>\n#define Max(x,y)((x) > (y)?(x) :(y))\n#define tru 1\n#define false 0\ntypedef long long int int64;\nint64 n,m,k,ans,St,End;\nint64 sum(int64 x,int64 y)\n{\n x = Max(x,0);\n return (x + y) * (y - x + 1) / 2;\n}\nchar solve(int64 mid)\n{\n int64 need = sum(mid - k + 1 , mid) + sum(mid - n + k, mid) - mid;\n return need <= m;\n}\nint main()\n{\n scanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n int64 mid;\n m -= n;\n St = 0;\n End = m;\n while(End - St >= 0)\n {\n mid = (St + End) >> 1;\n if(solve(mid))\n {\n ans = mid;\n St = mid + 1;\n }\n else\n End = mid - 1;\n }\n printf(\"%I64d\\n\",ans + 1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define Max(x,y)((x) > (y)?(x) :(y))\n\ntypedef long long int ll;\nll n,m,k,ans,l,r;\nll sum(ll x,ll y)\n{\n x = Max(x,0);\n return (x + y) * (y - x + 1) / 2;\n}\nchar solve(ll mid)\n{\n ll need = sum(mid - k + 1 , mid) + sum(mid - n + k, mid) - mid;\n if(need <= m)\n return 1;\n return 0;\n}\nint main()\n{\n scanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n m -= n;\n l = 0;\n r = m;\n while(r - l >= 0)\n {\n ll mid = (r + l) >> 1;\n if(solve(mid))\n {\n ans = mid;\n l = mid + 1;\n }\n else\n r = mid - 1;\n }\n printf(\"%I64d\\n\",ans + 1);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint n,m,k;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tm-=n;\n int l=k,r=k,ans=1;\n while(m-(r-l+1)>=0&&(l!=1||r!=n)){\n \tans++;\n m-=(r-l+1);\n if(l>1)\n \tl--;\n if(r<n)\n \tr++;\n }\n if(m>0)\n \tans+=(m/n);\n printf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, m, k, h, l, r;\n\n\tscanf(\"%d %d %d\", &n, &m, &k);\n\n\tl = r = k;\n\n\th = 1;\n\tm -= n;\n\n\n\twhile (m - (r - l + 1) >= 0 && !(l == 1 && r == n)) {\n\t\th++;\n\t\tm -= r - l + 1;\n\t\tif (r < n)\n\t\t\tr++;\n\t\tif (l > 1)\n\t\t\tl--;\n\t}\n\n\tif (l == 1 && r == n)\n\t\th += m / n;\n\n\tprintf(\"%d\", h);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long m,n,k;\nint judge(long long x)\n{\n long long ans;\n long long l,r;\n if (k<x)\n l=(x+x-(k-1))*k/2;\n else\n l=(1+x)*x/2+(k-x);\n if (n-k<x)\n r=(x+x-(n-k))*(n-k+1)/2;\n else\n r=(1+x)*(x)/2+n-(k+x)+1;\n if (m==k)\n ans=l;\n else if (m==1)\n ans=r;\n else\n ans=l+r-x;\n //printf(\"%lld,%lld,%lld\\n\",ans,l,r);\n if (ans==m)\n {\n printf(\"%lld\\n\",x);\n exit(0);\n }\n if (ans<m)\n return (1);\n else\n return (0);\n}\nint main ()\n{\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n long long x,top,bot;\n top=(m-n+1);\n bot=1;\n x=(bot+top)/2;\n if (top-1==bot)\n {\n printf(\"2\\n\");\n exit(0);\n }\n if (n==1)\n {\n printf(\"%lld\\n\",m);\n exit(0);\n }\n while (top-1>bot)\n {\n if (judge(x)==1)\n bot=x;\n else\n top=x;\n x=(bot+top)/2;\n }\n printf(\"%lld\\n\",bot);\n return 0;\n}\n/*if(m==k)\n ans=(x+x-(k-1))*k/2;\n else if (k==1)\n ans=(x+x-(n-k))*(n-k+1)/2;\n else\n ans=(x+x-(k-1))*k/2+(x+x-(n-k))*(n-k+1)/2-x;\n*/\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int l,r,n,m,k,sum,t;\n scanf(\"%d %d %d\",&n,&m,&k);\n m=m-n;\n sum=1;\n l=k;\n r=k;\n t=1;\n while(m>=t)\n {\n sum++;\n m=m-t;\n if(l>1)\n {\n l--;\n t++;\n }\n if(r<n)\n {\n r++;\n t++;\n }\n if(l==1&&r==n)\n {\n sum=sum+m/n;\n break;\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n,m,k;\nint f(int b)\n{\n long long int a=b;\n long long int s=a;\n if(a<=k)\n s+=a*(a-1)/2;\n else\n s+=(2*a-k)*(k-1)/2;\n if(n-k+1>=a)\n s+=a*(a-1)/2;\n else\n s+=(2*a-n+k-1)*(n-k)/2;\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=0,b=m+1;\n do\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n while(b-a>1);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong n,m,k,ans=1,Reduc_;\n\nint main(){\n scanf(\"%ld%ld%ld\",&n,&m,&k);\n m -= n;\n Reduc_ = 1;\n if(m == 0)\n{\nputs(\"1\");\nreturn 0;\n}\n while(m>0){\n if(k+ans<=n)++Reduc_;\n if(k-ans>=1)++Reduc_;\n m -= Reduc_;\n ++ans;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong int n,m,k;\n\tscanf(\"%ld %ld %ld\",&n,&m,&k);\n\tlong int div = m/n;\n\tif (div==0){\n\t div = 1;\n\t}\n\tlong int sum = 0;\n\tlong int ans = div-1;\n\tlong int l = k-1;\n\tlong int r = n-k;\n\twhile (sum<m){\n\t sum = 0;\n\t ans++;\n\t if (r>ans-1){\n\t sum += (((ans-1)*ans)/2) + r - (ans-1);\n\t }\n\t else{\n\t sum += ((ans-1+ans-r)*r)/2;\n\t }\n\t if (l>ans-1){\n\t sum += (((ans-1)*ans)/2) + l - (ans-1);\n\t }\n\t else{\n\t sum += ((ans-1+ans-l)*l)/2;\n\t }\n\t sum += ans;\n\t if (sum==m){\n\t break;\n\t }\n\t else if (sum>m){\n\t ans--;\n\t break;\n\t }\n\t}\n printf(\"%ld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\nunsigned long long int m,n,k,x,y,a,b;\nunsigned long long int s;\nscanf(\"%llu\",&n);\nscanf(\"%llu\",&m);\nscanf(\"%llu\",&k);\na=0;\nb=m;\nx=(a+b)/2;\nwhile (1)\n{\n s=0;\n y=k-1;\n if(y>x-1)\n s+= y -(x-1) +x*(x-1)/2;\n else\n s+= (x-1+x-y)*y/2;\n y=n-k;\n if(y>x-1)\n s+= y -(x-1) +x*(x-1)/2 +x;\n else\n s+= (x-1+x-y)*y/2 +x;\n if (x==0) s=0;\n\n if (s==m||b<a)\n {\n printf(\"%llu\",x); break;\n }\n else\n {\n if (s>m)\n {\n\n b=x-1;\n x=(a+b)/2;\n }\n else\n {\n a=x+1;\n x=(a+b)/2;\n }\n }\n}\n}\n\n"}, {"source_code": "//n\u5f20\u5e8a n\u4e2a\u4eba \u81ea\u7136\u91d1\u5b57\u5854\u5f62\u6700\u4f18\n#include<stdio.h>\n#include<stdlib.h>\nlong long n, m, k; //\u4e0d\u5f00long long\u89c1\u7956\u5b97\n\nint check( long long mid )\n{\n\tlong long l, r, cnt=0; //\u8be5\u65b9\u6848\u9700\u8981\u7684\u6795\u5934\u6570\n\tif( k-mid+1 >= 1 ) l = k-mid+1; //\u91d1\u5b57\u5854\u5de6\u8fb9\u5e95\u7684\u4f4d\u7f6e\n\telse l = 1; //\u5982\u679c\u5230\u4e86\u5de6\u8fb9\u754c\u8fd8\u6ca1\u5230\u5e95 \u5de6\u8fb9\u754c\u53d61\n\tif( k+mid-1 <= n ) r = k+mid-1; //\u91d1\u5b57\u5854\u53f3\u8fb9\u5e95\u7684\u4f4d\u7f6e\n\telse r = n; //\u5982\u679c\u5230\u4e86\u53f3\u8fb9\u754c\u8fd8\u6ca1\u5230\u5e95 \u53f3\u8fb9\u754c\u53d6n\n\tcnt += ( k-l+1 ) * ( mid-k+l+mid ) / 2 + ( l-1 ); //\u5de6\u534a\u90e8\u5206\u7b49\u5dee\u6c42\u548c\u52a0\u4e0a\u5e73\u5730\u90e8\u5206\n\tcnt += ( r-k+1 ) * ( mid-r+k+mid ) / 2 + ( n-r ); //\u53f3\u534a\u90e8\u5206\u7b49\u5dee\u6c42\u548c\u52a0\u4e0a\u5e73\u5730\u90e8\u5206\n\tcnt -= mid; //\u4e0a\u5f0f\u52a0\u4e86\u4e24\u6b21mid \u8981\u51cf\u6389\u4e00\u6b21\n\tif( cnt<=m ) return 1;\n\telse return 0;\n}\n\nint main()\n{\n\tlong long left, right, mid; //\u4e8c\u5206\u6cd5\n\tscanf(\"%lld %lld %lld\", &n, &m, &k);\n\tleft = 1; right = m-n+1; //\u521d\u59cb\u8303\u56f4\n\twhile( left <= right ){\n\t\tmid = (left + right) / 2;\n\t\tif( check( mid ) ) left = mid+1; //\u8fd8\u80fd\u5f97\u5bf8\u8fdb\u5c3a\n\t\telse right = mid-1; //\u4eba\u5bb6\u751f\u6c14\u4e86\n\t}\n\tprintf(\"%lld\\n\", right);\n\t//system(\"pause\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint n, m, k, res = 1, l = 1;\nint main() {\n scanf(\"%d%d%d\", &n, &m, &k);\n m -= n;\n while(m > 0) {\n if(k - res >= 1) ++l;\n if(k + res <= n) ++l;\n ++res; m -= l;\n }\n printf(\"%d\\n\", res);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n ,m ,k ,c=1 ,alm=1;\nint main() {\n \n scanf(\"%d%d%d\",&n,&m,&k);\n m -= n; \n while( m>0 ){\n if( k+alm <= n )c++;\n if( k-alm > 0 )c++;\n m -= c;\n alm++;\n }\n printf(\"%d\\n\", alm);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i=1,j,k,d,c=1,l;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tl=n-k;\n\tm-=n;\n\twhile(m>=i)\n\t{\n\t\tc++;\n\t\tm-=i;\n\t\tif(k-1>0)\n\t\t{\n\t\t\tk--;\n\t\t\ti++;\n\t\t}\n\t\tif(l>0)\n\t\t{\n\t\t\tl--;\n\t\t\ti++;\n\t\t}\n\t}\n\tprintf(\"%d\",c);\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nlong long triangle(int k, int x) {\n\tif (k > x)\n\t\tk = x;\n\treturn (long long) (x + x - k + 1) * k / 2;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tm -= n;\n\tlower = 0, upper = m + 1;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k, x - 1) <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower + 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ninline int min(int a,int b)\n {\n \treturn a<b?a:b;\n }\n inline int max(int a,int b)\n {\n \treturn a>b?a:b;\n }\n\nint main()\n{\n\tint N,M,K;\n\tscanf(\"%d%d%d\",&N,&M,&K);\n\tK--;\n\tM-=N;\n\tint off=1;\n\tint ans=1;\n\t// int v1,v2=0;\n\twhile(min(N,K+off)-max(0,K-off+1)<=M)\n\t{\n\t\tans++;\n\t\tM-=min(N,K+off)-max(0,K-off+1);\n\t\tif(max(0,K-off+1)==0 && min(N,K+off)==N)\n\t\t\tbreak;\n\t\toff++;\n\t}\n\tans+=M/N;\n\tprintf(\"%d\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,k,i,l,r,mp=1,i1,i2,l1,r1;\n scanf(\"%d %d %d\",&n,&m,&k);\n if(n==1)\n printf(\"%d\",m);\n else if(n==m)\n printf(\"1\");\n else{\n m-=n;\n l1=k-1;\n l=l1;\n r1=n-k;\n r=r1;\n for(i=1; ;i++){\n mp++;\n m--;\n if(!r1){\n m-=r;\n }\n\n if(r1){\n m-=i;\n r1--;\n }\n if(!l1)\n m-=l;\n if(l1){\n m-=i;\n l1--;\n }\n if(m<=0) break;\n }\n printf(\"%d\",mp);\n }\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\tlong n,m,k;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tif(m==n)\n\t{\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\t\n\tlong cnt=1,r;\n\twhile(m>0)\n\t{\n\t\tif(k+cnt>=n)\n\t\tr++;\n\t\tif(k-cnt>=1)\n\t\tr++;\n\t\tm-=r;\n\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\",cnt);\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\nlong n,m,k,ans=1,Reduc_;\nint main(){\n scanf(\"%ld%ldl%d\",&n,&m,&k);\n m -= n;\n Reduc_ = 1;\n if(m == 0) return puts(\"1\"),0;\n while(m>0){\n if(k+ans<=n)++Reduc_;\n if(k-ans>=1)++Reduc_;\n m -= Reduc_;\n ++ans;\n }\n printf(\"%ld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong n,m,k;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tif(m==n)\n\t{\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\t\n\tm-=n;\n\tlong cnt=1,r=1;\n\twhile(m>0)\n\t{\n\t\tif(k+cnt>=n)\n\t\t\tr++;\n\t\tif(k-cnt>=1)\n\t\t\tr++;\n\t\tm-=r;\n\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\",cnt);\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\nlong n,m,k,ans=1,Reduc_;\nint main(){\n scanf(\"%ld%ldl%d\",&n,&m,&k);\n m -= n;\n Reduc_ = 1;\n if(m == 0)\n {\n \tputs(\"1\");\n \treturn 0;\n\t}\n while(m>0){\n if(k+ans<=n)++Reduc_;\n if(k-ans>=1)++Reduc_;\n m -= Reduc_;\n ++ans;\n }\n printf(\"%ld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong n,m,k;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tif(m==n)\n\t{\n\t\tputs(\"1\");\n\t\treturn 0;\n\t}\t\n\tlong cnt=1;\n\tm-=n;\n\tm--;\n\tcnt++;\n\tlong right=n-k,left=k-1;//k\u7684\u5de6\u53f3\u51e0\u4e2a\u6570 \n\t//long r=right,l=left;\n\twhile(1)\n\t{\n\t\tif(cnt==2)\n\t\t{\n\t\t\tif(k==1||k==n)\n\t\t\t{\n\t\t\t\tif(m<2)\n\t\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tm-=2;\n\t\t\t\t\tcnt++;\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(m<3)\n\t\t\t\tbreak;\n\t\t\t\telse{\n\t\t\t\t\tm-=3;\n\t\t\t\t\tcnt++;\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(m<n)\n\t\t\tbreak;\n\t\t\telse\n\t\t\t{\n\t\t\t\tm-=n;\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\t\n\t}\n\tprintf(\"%d\\n\",cnt);\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,k,i=1,val=1;\n\tscanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n\tlong long int right=k,left=k;\n\tm=m-n;\n\twhile(m>=i)\n\t{\n\t\tval++;\n\t\tm-=i;\n\t\tif(left>1);\n\t\t{\n\t\tleft--;\n\t\ti++;\n\t}\n\tif(right<n)\n\t{\n\t\tright++;\n\t\ti++;\n\t}\n\tif(left==1 && right==n)\n\t{\n\t\tval=val+m/n;\n\t\tbreak;\n\t}\n\t}\n\tprintf(\"%I64d\",val);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,k,i=1,val=1;\n\tscanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n\tlong long int right=k,left=k;\n\tm=m-n;\n\twhile(m>=i)\n\t{\n\t\tval++;\n\t\tm-=i;\n\t\tif(left>1);\n\t\t{\n\t\tleft--;\n\t\ti++;\n\t}\n\tif(right<n)\n\t{\n\t\tright++;\n\t\ti++;\n\t}\n\tif(left==1 && right==n)\n\t{\n\t\tval=val+n/m;\n\t\tbreak;\n\t}\n\t}\n\tprintf(\"%I64d\",val);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tlong long int n,m,k,p=1,s,i,h=1;\n\tscanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n\tm=m-n;\n\tif(n==1)\n\ts=m+1;\n\telse if(n==2)\n\ts=(m+2)/2+(m+2)%2;\n\telse\n\t{\n\t\ts=1;\n while(1)\n {\n \tif(m<=0)\n \tbreak;\n \tif(p<k)\n \t{\n \tm=m-1-p;\n \tp++;\n\t }\n\t else if(p>=2)\n\t {\n\t \tm=m-p-2;\n\t }\n\t if(h+k<n)\n\t {\n\t \tm=m-1-h;\n\t \th++;\n\t }\n\t else if(h+k>=k+2)\n\t m=m-h-2;\n\t s=s+1;\n\t\n}\n}\nprintf(\"%I64d\",s);\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long UINT64;\n\nint main(void) {\n UINT64 n = 0, m = 0, k = 0;\n UINT64 x = 0, r = 0;\n \n scanf(\"%llu %llu %llu\", &n, &m, &k);\n \n x = 2 * m + (k * (k - 1)) + (n - k) * (n - k + 1);\n r = 2 * n;\n \n if (x % r == 0) {\n x = x / r - 1;\n } else {\n x /= r;\n }\n \n printf(\"%llu\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long UINT64;\n\nint main(void) {\n UINT64 n = 0, m = 0, k = 0;\n UINT64 x = 0;\n \n scanf(\"%llu %llu %llu\", &n, &m, &k);\n \n x = 2 * m + (k * (k - 1)) + (n - k) * (n - k + 1);\n x /= 2 * n;\n \n printf(\"%llu\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long UINT64;\n\nint main(void) {\n UINT64 n = 0, m = 0, k = 0;\n UINT64 x = 0, r = 0;\n \n scanf(\"%llu %llu %llu\", &n, &m, &k);\n \n x = 2 * m + (k * (k - 1)) + (n - k) * (n - k + 1);\n r = 2 * n;\n \n if (x % r == 0) {\n x = x / r - 1;\n }\n \n printf(\"%llu\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long UINT64;\n\nint main(void) {\n UINT64 i = 0;\n UINT64 n = 0, m = 0, k = 0;\n UINT64 x = 0, r = 0;\n \n scanf(\"%llu %llu %llu\", &n, &m, &k);\n \n x = 2 * m + (k * (k - 1)) + (n - k) * (n - k + 1);\n x /= 2 * n;\n \n while (x < k - i) {\n x--;\n i++;\n if (x <= 0) {\n x = 1;\n break;\n }\n }\n \n printf(\"%llu\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long UINT64;\n\nint main(void) {\n UINT64 n = 0, m = 0, k = 0;\n UINT64 x = 0, r = 0;\n \n scanf(\"%llu %llu %llu\", &n, &m, &k);\n \n x = 2 * m + (k * (k - 1)) + (n - k) * (n - k + 1);\n r = 2 * n;\n \n if (x % r == 0) {\n x /= r;\n if (k - 1 == x || n - k == x) {\n x--;\n }\n } else {\n x /= r;\n }\n \n printf(\"%llu\\n\", x);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#define max(a,b) (a > b) ? a : b\n#define min(a,b) (a < b) ? a : b\nint main()\n{\n\tint i,j,k,n,m,l,r,res,mid,ans;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tres = m - n;\n\tmid = (int)sqrt(1+8*res) - 1;\n\tmid /= 2;\n\tfor(i = mid;i <= res;i++)\n\t{\n\t\tif(i > k - 1) l = (2*i-k+1)*k/2;\n\t\telse l = (1+i)*i / 2;\n\t\tif(i >= (n-k))r = (2*i-n+k)*(n-k+1)/2;\n\t\telse r = (1+i)*i/2;\n\t\tif(l+r-i > res)break;\n\t}\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long scount(long long x,long long y)\n{\n long long i,sum=0;\n for(i=0;i<y;i++);\n sum += x--;\n return sum;\n}\n\nint main()\n{\n long long n,m,k,rez,levo,desno,range=0,br;\n scanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n desno = n-k;\n levo = n-desno-1;\n m -= n;\n rez = 1;\n if(levo>desno)\n {\n br = scount(levo+1,levo+1);\n br += scount(levo+1,desno);\n\n }\n else if(desno>levo)\n {\n br = scount(desno+1,desno+1);\n br += scount(desno+1,levo);\n }\n if(m>br)\n {\n rez += m/br;\n m = m%br;\n }\n while(m)\n {\n m--;\n if(desno < range)\n if(m>=desno) m-=desno;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo < range)\n if(m>=levo) m-=levo;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo-range > 0 || desno-range > 0) range++;\n rez++;\n }\n printf(\"%I64d\",rez);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long scount(long long n,long long m)\n{\n return n*(n+1)/2 - m*(m-1)/2;\n}\n\nint main()\n{\n long long n,m,k,rez,levo,desno,range=0,br;\n scanf(\"%I64d%I64d%I64d\",&n,&m,&k);\n desno = n-k;\n levo = n-desno-1;\n m -= n;\n rez = 1;\n if(levo>desno)\n {\n br = scount(levo+1,levo);\n br += scount(levo+1,desno-1);\n }\n else\n {\n br = scount(desno+1,desno);\n br += scount(desno+1,levo-1);\n }\n\n if(br<=m)\n {\n rez += levo>desno?levo+1:desno+1;\n m-=br;\n rez += m/n;\n m = m%n;\n range = levo>desno?levo:desno;\n }\n while(m)\n {\n m--;\n if(desno < range)\n if(m>=desno) m-=desno;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo < range)\n if(m>=levo) m-=levo;\n else break;\n else\n if(m>=range) m-=range;\n else break;\n if(levo-range > 0 || desno-range > 0) range++;\n rez++;\n }\n printf(\"%I64d\",rez);\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n\nlong long n, m, k, ans, layer_left = 0, layer_right = 0;\nlong long left_dist, right_dist, l, r;\n\nvoid add_layer()\n{\n\tif (left_dist > layer_left)\n\t{\n\t\tm -= layer_left;\n\t\tlayer_left++;\n\t}\n\telse\n\t\tm -= layer_left;\n\n\tif (right_dist > layer_right)\n\t{\n\t\tm -= layer_right;\n\t\tlayer_right++;\n\t}\n\telse\n\t\tm -= layer_right;\n\n\tm -= 1;\n}\n\n\nint main()\n{\n\tscanf(\"%I64d %I64d %I64d\", &n, &m, &k);\n\tl = k - 1, r = n - k;\n\tm -= n;\n\n\t/*while (m >= layer_left + layer_right + 1)\n\t{\n\t\tif (layer_left == left_dist && layer_right == right_dist)\n\t\t{\n\n\t\t}\n\t\tadd_layer();\n\t\tans++;\n\t}*/\n\n\tans = (m + (r + 1) * r / 2 + (l + 1) * l / 2) / n;\n\n\tprintf(\"%I64d\", ans + 1);\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n\nlong long n, m, k, ans, layer_left = 0, layer_right = 0;\nlong long left_dist, right_dist, l, r;\n\nvoid add_layer()\n{\n\tif (left_dist > layer_left)\n\t{\n\t\tm -= layer_left;\n\t\tlayer_left++;\n\t}\n\telse\n\t\tm -= layer_left;\n\n\tif (right_dist > layer_right)\n\t{\n\t\tm -= layer_right;\n\t\tlayer_right++;\n\t}\n\telse\n\t\tm -= layer_right;\n\n\tm -= 1;\n}\n\n\nint main()\n{\n\tscanf(\"%I64d %I64d %I64d\", &n, &m, &k);\n\tl = k - 1, r = n - k;\n\t//m -= n;\n\n\t/*while (m >= layer_left + layer_right + 1)\n\t{\n\t\tif (layer_left == left_dist && layer_right == right_dist)\n\t\t{\n\n\t\t}\n\t\tadd_layer();\n\t\tans++;\n\t}*/\n\n\tans = (m + (r + 1) * r / 2 + (l + 1) * l / 2) / n;\n\n\tprintf(\"%I64d\", ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint n,m,k;\n\tscanf(\"%d%d%d\",&n,&m,&k);\n\tm-=n;\n int l=k,r=k,ans=1;\n while(m-(r-l+1)>0&&(l!=1||r!=n)){\n \tans++;\n m-=(r-l+1);\n if(l>1)\n \tl--;\n if(r<n)\n \tr++;\n }\n if(m>0)\n \tans+=(m/n);\n printf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n int n,m,k;\n scanf(\"%d%d%d\",&n,&m,&k);\n k=((n-k+1)>k)?(n-k+1):k;\n int y=n-k;\n long long x,ans=0;\n x= (long long)(k*(k+1))/2 + (long long)((y*(y+1))/2);\n if(m>=x)\n ans=k + (m-x)/n;\n else\n ans= (m-1)/n + 1;\n printf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long m,n,k;\nint judge(long long x)\n{\n long long ans;\n if(m==k)\n ans=(x+x-(k-1))*k/2;\n else if (k==1)\n ans=(x+x-(n-k))*(n-k+1)/2;\n else\n ans=(x+x-(k-1))*k/2+(x+x-(n-k))*(n-k+1)/2-x;\n if (ans==m)\n {\n printf(\"%lld\\n\",x);\n exit(0);\n }\n if (ans<m)\n return (1);\n else\n return (0);\n}\nint main ()\n{\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n long long x,top,bot;\n top=(m-n+1);\n bot=1;\n x=(bot+top)/2;\n if (top-1==bot)\n {\n printf(\"2\\n\");\n exit(0);\n }\n while (top-1>bot)\n {\n if (judge(x)==1)\n bot=x;\n else\n top=x;\n x=(bot+top)/2;\n }\n printf(\"%lld\\n\",bot);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long m,n,k;\nint judge(long long x)\n{\n long long ans;\n if(m==k)\n ans=(x+x-(k-1))*k/2;\n else if (k==1)\n ans=(x+x-(n-k))*(n-k+1)/2;\n else\n ans=(x+x-(k-1))*k/2+(x+x-(n-k))*(n-k+1)/2-x;\n if (ans==m)\n {\n printf(\"%lld\\n\",x);\n exit(0);\n }\n if (ans<m)\n return (1);\n else\n return (0);\n}\nint main ()\n{\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n long long x,top,bot;\n top=(m-n+1);\n bot=1;\n x=(bot+top)/2;\n if (top-1==bot)\n {\n printf(\"2\\n\");\n exit(0);\n }\n if (n==1)\n {\n printf(\"%lld\\n\",m);\n exit(0);\n }\n while (top-1>bot)\n {\n if (judge(x)==1)\n bot=x;\n else\n top=x;\n x=(bot+top)/2;\n }\n printf(\"%lld\\n\",bot);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long m,n,k;\nint judge(long long x)\n{\n long long ans;\n if(m==k)\n ans=(x+x-(k-1))*k/2;\n else if (k==1)\n ans=(x+x-(n-k))*(n-k+1)/2;\n else\n ans=(x+x-(k-1))*k/2+(x+x-(n-k))*(n-k+1)/2-x;\n if (ans==m)\n {\n printf(\"%lld\\n\",x);\n exit(0);\n }\n if (ans<m)\n return (1);\n else\n return (0);\n}\nint main ()\n{\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n long long x,top,bot;\n top=(m-n+1);\n bot=1;\n x=(bot+top)/2;\n while (top-1>bot)\n {\n if (judge(x)==1)\n bot=x;\n else\n top=x;\n x=(bot+top)/2;\n }\n printf(\"%lld\\n\",top-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint m,n,k;\nint judge(int x)\n{\n int ans;\n if(m==k)\n ans=(x+x-(k-1))*k/2;\n else if (k==1)\n ans=(x+x-(n-k))*(n-k+1)/2;\n else\n ans=(x+x-(k-1))*k/2+(x+x-(n-k))*(n-k+1)/2-x;\n if (ans<=m)\n return (1);\n else\n return (0);\n}\nint main ()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n int x,top,bot;\n top=(m-n+1);\n bot=1;\n x=(bot+top)/2;\n while (top>bot)\n {\n if (judge(x)==1)\n bot=x+1;\n else\n top=x-1;\n x=(bot+top)/2;\n }\n printf(\"%d\\n\",bot-1);\n return 0;\n}\n"}, {"source_code": "/*#include <stdio.h>\n#include <string.h>\nint dp[1001][1001];\nint main()\n{\n int a[1000],n,i,i1,max,sum=0;\n scanf(\"%d\",&n);\n for(i=0;n>i;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n memset(dp,0,sizeof(dp));\n for(i=0;n>=i;i++)\n {\n if(i!=0)\n {\n dp[i][0]=dp[i-1][0]+a[i-1]*i;\n }\n for(i1=1;n-i>=i1;i1++)\n {\n if(dp[i][i1]<dp[i][i1-1]+a[n-i1]*(i+i1))\n {\n dp[i][i1]=dp[i][i1-1]+a[n-i1]*(i+i1);\n }\n }\n }\n printf(\"%d\",max);\n\treturn 0;\n}*/\n#include <stdio.h>\nint main()\n{\n int n,m,k,i;\n scanf(\"%d %d %d\",&n,&m,&k);\n if(n==1)\n {\n i=m+1;\n }\n else if(k==1||k==n)\n {\n i=1;\n while(((1+i)*n)/2<=m&&n+1>=i)\n {\n i++;\n }\n }\n else\n {\n i=1;\n if(n-k<=k)\n {\n while(((1+i)*i)/2<=m&&i<=n-k)\n {\n i++;\n }\n }\n else\n {\n while(((1+i)*i)/2<=m&&i<=k)\n {\n i++;\n }\n }\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,k,i;\n scanf(\"%d %d %d\",&n,&m,&k);\n if(k==1||k==n)\n {\n i=1;\n while(((1+i)*i)/2<=m)\n {\n i++;\n }\n }\n else\n {\n i=1;\n if(n-k>k)\n {\n while(((1+i)*i)/2<=m&&i<=n-k)\n {\n i++;\n }\n }\n else\n {\n while(((1+i)*i)/2<=m&&i<=k)\n {\n i++;\n }\n }\n }\n printf(\"%d\\n\",i-1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,k,i;\n scanf(\"%d %d %d\",&n,&m,&k);\n if(k==1||k==n)\n {\n i=1;\n while(((1+i)*i)/2<=m)\n {\n i++;\n }\n }\n else\n {\n i=1;\n if(n-k<k)\n {\n while(((1+i)*i)/2<=m&&i<=n-k)\n {\n i++;\n }\n }\n else\n {\n while(((1+i)*i)/2<=m&&i<=k)\n {\n i++;\n }\n }\n }\n printf(\"%d\",i-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,k;\nint f(int a)\n{\n int s=-a;\n if(a<k)\n s+=a*(a+1)/2;\n else\n s+=(2*a-k+1)*k/2;\n if(n-k>=a)\n s+=a*(a+1)/2;\n else\n s+=(2*a-n+k)*(n-k+1)/2;\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=1,b=m+1;\n while(!(f(a)+f(b))&&b-a>1)\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,k;\nint f(int a)\n{\n int s=a;\n if(a<=k)\n s+=a*(a-1)/2;\n else\n s+=(2*a-k)*(k-1)/2;\n if(n-k+1>=a)\n s+=a*(a-1)/2;\n else\n s+=(2*a-n+k-1)*(n-k)/2;\n printf(\"%d %d\\n\",a,s);\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=1,b=m+1;\n do\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n while(!(f(a)+f(b))&&b-a>1);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,k;\nint f(int a)\n{\n int s=a;\n if(a<=k)\n s+=a*(a-1)/2;\n else\n s+=(2*a-k)*(k-1)/2;\n if(n-k+1>=a)\n s+=a*(a-1)/2;\n else\n s+=(2*a-n+k-1)*(n-k)/2;\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=1,b=m+1;\n do\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n while(b-a>1);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,k;\nint f(int a)\n{\n int s=a;\n if(a<=k)\n s+=a*(a-1)/2;\n else\n s+=(2*a-k)*(k-1)/2;\n if(n-k+1>=a)\n s+=a*(a-1)/2;\n else\n s+=(2*a-n+k-1)*(n-k)/2;\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=0,b=m+1;\n do\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n while(b-a>1);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,k;\nint f(int a)\n{\n int s=a;\n if(a<=k)\n s+=a*(a-1)/2;\n else\n s+=(2*a-k)*(k-1)/2;\n if(n-k+1>=a)\n s+=a*(a-1)/2;\n else\n s+=(2*a-n+k-1)*(n-k)/2;\n if(s>m)\n return -1;\n else\n return 1;\n}\nint main()\n{\n scanf(\"%d%d%d\",&n,&m,&k);\n m-=n;\n int a=1,b=m+1;\n do\n {\n if(f((a+b)/2)>0)\n a=(a+b)/2;\n else b=(a+b)/2;\n }\n while(!(f(a)+f(b))&&b-a>1);\n printf(\"%d\",a+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,k,i,l,r,mp=1,i1,i2,l1,r1;\n scanf(\"%d %d %d\",&n,&m,&k);\n m=m-n;\n if(n==1)\n printf(\"%d\",m);\n else if(n==m)\n printf(\"1\");\n else{\n l1=k-1;\n l=l1;\n r1=n-k;\n r=r1;\n for(i=1; ;i++){\n mp++;\n m--;\n if(!r1){\n m-=r;\n }\n\n if(r1){\n m-=i;\n r1--;\n }\n if(!l1)\n m-=l;\n if(l1){\n m-=i;\n l1--;\n }\n if(m<=0) break;\n }\n printf(\"%d\",mp);\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\nunsigned long long int m,n,k,x,y,a,b;\nunsigned long long int s;\nscanf(\"%llu\",&n);\nscanf(\"%llu\",&m);\nscanf(\"%llu\",&k);\na=0;\nb=m;\nx=(a+b)/2;\nwhile (1)\n{\n s=0;\n y=k-1;\n if(y>x-1)\n s+= y -(x-1) +x*(x-1)/2;\n else\n s+= (x-1+x-y)*y/2;\n y=n-k;\n if(y>x-1)\n s+= y -(x-1) +x*(x-1)/2 +x;\n else\n s+= (x-1+x-y)*y/2 +x;\n if (x==0) s=0;\n printf(\"%llu %llu \\n\",x,s);\n if (s==m||b<a)\n {\n printf(\"%llu\",x); break;\n }\n else\n {\n if (s>m)\n {\n\n b=x-1;\n x=(a+b)/2;\n }\n else\n {\n a=x+1;\n x=(a+b)/2;\n }\n }\n}\n}\n\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nint triangle(int k, int x) {\n\treturn (x + x - k + 1) / 2 * k;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tlower = -1, upper = m;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k, x - 1) <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower);\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nlong long triangle(int k, int x) {\n\treturn (long long) (x + x - k + 1) * k / 2;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tm -= n;\n\tlower = 0, upper = m + 1;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k, x - 1) <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower + 1);\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nlong long triangle(int k, int x) {\n\treturn (long long) (x + x - k + 1) * k / 2;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tlower = 0, upper = m + 1;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k + 1, x) - x <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower);\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nlong long triangle(int k, int x) {\n\treturn (long long) (x + x - k + 1) * k / 2;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tlower = 0, upper = m + 1;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k, x - 1) <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower);\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nlong long triangle(int k, int x) {\n\treturn (long long) (x + x - k + 1) * k / 2;\n}\n\nint main() {\n\tint n, m, k, lower, upper;\n\n\tscanf(\"%d%d%d\", &n, &m, &k);\n\tlower = -1, upper = m;\n\twhile (upper - lower > 1) {\n\t\tint x = (lower + upper) / 2;\n\n\t\tif (triangle(k, x) + triangle(n - k, x - 1) <= m)\n\t\t\tlower = x;\n\t\telse\n\t\t\tupper = x;\n\t}\n\tprintf(\"%d\\n\", lower);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,k,i,mp=1,i1,i2,l1,r1;\n scanf(\"%d %d %d\",&n,&m,&k);\n m=m-n;\n if(k==1 || k==n){\n for(i=1; ;i++){\n mp++;\n m=m-(i+1);\n if(m<=0) break;\n }\n printf(\"%d\",mp);\n }\n if(k>1 && k<n){\n l1=k-1;\n r1=n-k;\n for(i=1; ;i++){\n mp++;\n m--;\n if(r1){\n m-=i;\n i1=i;\n r1--;\n }\n if(!r1){\n m-=i1;\n }\n if(l1){\n m-=i;\n i2=i;\n l1--;\n }\n if(!l1)\n m-=i2;\n if(m<=0) break;\n }\n printf(\"%d\",mp);\n }\n}\n"}], "src_uid": "da9ddd00f46021e8ee9db4a8deed017c"} {"nl": {"description": "Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.The game is played on the following field. Players are making moves by turns. At first move a player can put his chip in any cell of any small field. For following moves, there are some restrictions: if during last move the opposite player put his chip to cell with coordinates (xl,\u2009yl) in some small field, the next move should be done in one of the cells of the small field with coordinates (xl,\u2009yl). For example, if in the first move a player puts his chip to lower left cell of central field, then the second player on his next move should put his chip into some cell of lower left field (pay attention to the first test case). If there are no free cells in the required field, the player can put his chip to any empty cell on any field.You are given current state of the game and coordinates of cell in which the last move was done. You should find all cells in which the current player can put his chip.A hare works as a postman in the forest, he likes to foul bears. Sometimes he changes the game field a bit, so the current state of the game could be unreachable. However, after his changes the cell where the last move was done is not empty. You don't need to find if the state is unreachable or not, just output possible next moves according to the rules.", "input_spec": "First 11 lines contains descriptions of table with 9 rows and 9 columns which are divided into 9 small fields by spaces and empty lines. Each small field is described by 9 characters without spaces and empty lines. character \"x\" (ASCII-code 120) means that the cell is occupied with chip of the first player, character \"o\" (ASCII-code 111) denotes a field occupied with chip of the second player, character \".\" (ASCII-code 46) describes empty cell. The line after the table contains two integers x and y (1\u2009\u2264\u2009x,\u2009y\u2009\u2264\u20099). They describe coordinates of the cell in table where the last move was done. Rows in the table are numbered from up to down and columns are numbered from left to right. It's guaranteed that cell where the last move was done is filled with \"x\" or \"o\". Also, it's guaranteed that there is at least one empty cell. It's not guaranteed that current state of game is reachable.", "output_spec": "Output the field in same format with characters \"!\" (ASCII-code 33) on positions where the current player can put his chip. All other cells should not be modified.", "sample_inputs": ["... ... ...\n... ... ...\n... ... ...\n\n... ... ...\n... ... ...\n... x.. ...\n\n... ... ...\n... ... ...\n... ... ...\n6 4", "xoo x.. x..\nooo ... ...\nooo ... ...\n\nx.. x.. x..\n... ... ...\n... ... ...\n\nx.. x.. x..\n... ... ...\n... ... ...\n7 4", "o.. ... ...\n... ... ...\n... ... ...\n\n... xxx ...\n... xox ...\n... ooo ...\n\n... ... ...\n... ... ...\n... ... ...\n5 5"], "sample_outputs": ["... ... ... \n... ... ... \n... ... ... \n\n... ... ... \n... ... ... \n... x.. ... \n\n!!! ... ... \n!!! ... ... \n!!! ... ...", "xoo x!! x!! \nooo !!! !!! \nooo !!! !!! \n\nx!! x!! x!! \n!!! !!! !!! \n!!! !!! !!! \n\nx!! x!! x!! \n!!! !!! !!! \n!!! !!! !!!", "o!! !!! !!! \n!!! !!! !!! \n!!! !!! !!! \n\n!!! xxx !!! \n!!! xox !!! \n!!! ooo !!! \n\n!!! !!! !!! \n!!! !!! !!! \n!!! !!! !!!"], "notes": "NoteIn the first test case the first player made a move to lower left cell of central field, so the second player can put a chip only to cells of lower left field.In the second test case the last move was done to upper left cell of lower central field, however all cells in upper left field are occupied, so the second player can put his chip to any empty cell.In the third test case the last move was done to central cell of central field, so current player can put his chip to any cell of central field, which is already occupied, so he can move anywhere. Pay attention that this state of the game is unreachable."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint Map[10][10], i, j, x, y, b;\nchar c;\n\nint ctoint(char a)\n{\n switch (a)\n {\n case '.' : return 0; break;\n case 'x' : return 1; break;\n case 'o' : return 2; break;\n case '!' : return 3; break;\n }\n return -1;\n}\n\nchar inttoc(int a)\n{\n switch (a)\n {\n case 0 : return '.'; break;\n case 1 : return 'x'; break;\n case 2 : return 'o'; break;\n case 3 : return '!'; break;\n }\n return 0;\n}\n\nint main()\n{\n for (i = 1; i <= 9; i++)\n {\n for (j = 1; j <= 9; j++)\n {\n scanf(\"%c\", &c);\n Map[i][j] = ctoint(c);\n if (j % 3 == 0) scanf(\"%c\", &c);\n }\n if ((i % 3 == 0) && (i != 9)) scanf(\"\\n\");\n }\n scanf(\"%d %d\", &x, &y);\n\n while (x > 3) x -= 3;\n while (y > 3) y -= 3;\n\n b = 0;\n\n for (i = x*3 - 2; i <= x*3; i++)\n for(j = y*3 - 2; j <= y*3; j++)\n if (Map[i][j] == 0)\n {\n Map[i][j] = 3;\n b = 1;\n }\n\n if (!b)\n {\n for (i = 1; i <= 9; i++)\n for (j = 1; j <= 9; j++)\n if (Map[i][j] == 0) Map[i][j] = 3;\n }\n\n for (i = 1; i <= 9; i++)\n {\n for (j = 1; j <= 9; j++)\n {\n printf(\"%c\", inttoc(Map[i][j]));\n if ((j % 3 == 0) && (j != 9)) printf(\" \");\n if (j == 9) printf(\"\\n\");\n }\n if ((i % 3 == 0) && (i != 9)) printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void)\n{\n char input[9][9];\n int lastChip[2];\n \n int i, j;\n int isCellAvailable=0;\n \n \n for(i=0; i<9; i++)\n {\n for(j=0; j<9; j++)\n {\n scanf(\"%c\", &input[i][j]);\n if(input[i][j]==' ' || input[i][j]=='\\n')\n {\n j--;\n }\n }\n }\n \n scanf(\"%d %d\", &lastChip[0], &lastChip[1]);\n \n lastChip[0]--;\n lastChip[1]--;\n \n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n if(input[(lastChip[0]%3*3)+i][(lastChip[1]%3*3)+j]=='.')\n {\n input[(lastChip[0]%3*3)+i][(lastChip[1]%3*3)+j]='!';\n isCellAvailable=1;\n }\n }\n }\n \n \n if(isCellAvailable==0)\n {\n for(i=0; i<9; i++)\n {\n for(j=0; j<9; j++)\n {\n if(input[i][j]=='.')\n {\n input[i][j]='!';\n }\n }\n }\n }\n \n for(i=0; i<9; i++)\n {\n for(j=0; j<9; j++)\n {\n if(j==3 || j==6)\n {\n printf(\" \");\n }\n printf(\"%c\", input[i][j]);\n }\n printf(\"\\n\");\n if(i==2 || i==5)\n {\n printf(\"\\n\");\n }\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//week3\nint main()\n{\n char a[9][9];\n int x,y,i,m,n,j;\n for(i=0;i<9;i++)\n scanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\n scanf(\"%d %d\",&x,&y);\n while(x>3) x-=3;\n while(y>3) y-=3;\n m=x*3;n=y*3;\n int k=1;\n for(i=m-3;i<m;i++)\n for(j=n-3;j<n;j++)\n {\n if(a[i][j]=='.') {k=0;a[i][j]='!';}\n }\n if(k==1)\n {\n for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';}\n }\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n printf(\"%c\",a[i][j]);\n if(j%3==2) printf(\" \");\n }\n printf(\"\\n\");\n if(i%3==2) printf(\"\\n\");\n }\n printf(\"\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\nchar a[9][9];\nint i,j,x,y,flag=1;\nfor(i=0;i<9;i++)\nscanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\nscanf(\"%d%d\",&x,&y);\nwhile(x>3) x-=3;\nwhile(y>3) y-=3;\n for(i=(x-1)*3;i<x*3;i++)\n for(j=(y-1)*3;j<y*3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0; }\nif(flag)\n for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') a[i][j]='!';\nfor(i=0;i<9;i++)\n {\n if(i%3==0&&i) printf(\"\\n\");\n for(j=0;j<9;j++)\n {\n if(j%3==0&&j) printf(\" \");\n printf(\"%c\",a[i][j]);\n }\n printf(\"\\n\");\n }\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b<=3)\n b=b-1;\nif(a<=3)\n a=a-1;\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.'){\n m=1;\n break;\n }\n }\n if(m==1)\n break;\n }\n//printf(\"%d %d %d %d\\n\",A[0],A[1],A[2],A[3]);\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.')\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[9][9];\n int i,j,x,y,flag=1;\n for(i=0;i<9;i++)\n scanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\n scanf(\"%d%d\",&x,&y);\n \n while(x>3) x-=3;\n while(y>3) y-=3;\n if(x==1&&y==1)\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0; }\n if(x==2&&y==1)\n for(i=3;i<6;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==1)\n for(i=6;i<9;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==1&&y==2)\n for(i=0;i<3;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==2&&y==2)\n for(i=3;i<6;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==2)\n for(i=6;i<9;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==1&&y==3)\n for(i=0;i<3;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==2&&y==3)\n for(i=3;i<6;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==3)\n for(i=6;i<9;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(flag)\n {for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') a[i][j]='!';\n }\n for(i=0;i<9;i++)\n {\n if(i%3==0&&i) printf(\"\\n\");\n for(j=0;j<9;j++)\n {\n if(j%3==0&&j) printf(\" \");\n printf(\"%c\",a[i][j]);\n }\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[9][9];\n int i,j,x,y,flag=1;\n for(i=0;i<9;i++)\n scanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\n scanf(\"%d%d\",&x,&y);\n while(x>3) x-=3;\n while(y>3) y-=3;\n for(i=(x-1)*3;i<x*3;i++)\n for(j=(y-1)*3;j<y*3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0; }\n if(flag)\n for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') a[i][j]='!';\n for(i=0;i<9;i++)\n {\n if(i%3==0&&i) printf(\"\\n\");\n for(j=0;j<9;j++)\n {\n if(j%3==0&&j) printf(\" \");\n printf(\"%c\",a[i][j]);\n }\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n char f[9][9];\n int i=0,j=0;\n for(int k=0;k<3;k++){\n for(i=3*k;i<(3+(3*k));i++){\n for(int u=0;u<3;u++){\n for(j=3*u;j<(3*u+3);j++){\n scanf(\"%c\",&f[i][j]);\n }\n if(u!=2)getchar();\n }\n getchar();\n }\n if(k!=2)getchar();\n }\n int x,y;\n scanf(\"%d %d\",&x,&y);\n int r,c;\n r=(x-1)%3;\n c=(y-1)%3;\n int flag=0;\n for(i=3*r;i<(3+(3*r));i++){\n for(j=3*c;j<(3*c+3);j++){\n if(f[i][j]=='.'){\n f[i][j]='!';\n flag=1;\n }\n }\n }\n if(flag==0){\n for(i=0;i<9;i++){\n for(j=0;j<9;j++){\n if(f[i][j]=='.'){\n f[i][j]='!';\n }\n }\n }\n }\n for(int k=0;k<3;k++){\n for(i=3*k;i<(3+(3*k));i++){\n for(int u=0;u<3;u++){\n for(j=3*u;j<(3*u+3);j++){\n printf(\"%c\",f[i][j]);\n }\n if(u!=2)printf(\" \");\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint x,y;\nchar MAP[15][15];\n\nint main()\n{\n int i,j;\n short flag = 0;\n\n for(i=1;i<=11;i++) gets(MAP[i]+1);\n scanf(\"%d%d\",&x,&y);\n\n if(x%3 == 1) x = 1;\n else if(x%3 == 2) x = 5;\n else x = 9;\n if(y%3 == 1) y = 1;\n else if(y%3 == 2) y = 5;\n else y = 9;\n\n for(i=0;i<3;i++) for(j=0;j<3;j++) if(MAP[x+i][y+j] == '.')\n {\n flag = 1;\n MAP[x+i][y+j] = '!';\n }\n\n if(!flag) for(i=1;i<=11;i++) for(j=1;j<=11;j++)\n if(MAP[i][j] == '.') MAP[i][j] = '!';\n\n for(i=1;i<=11;i++) printf(\"%s\\n\",MAP[i]+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar ttt[9][9];\nvoid check(int b,int a)\n{\n int i,j;\n int c,d;\n int flag=0;\n if(b%3 == 1 && a%3==1)\n {\n c=0;\n d=0;\n }\n if(b%3 == 1 && a%3==2)\n {\n c=3;\n d=0;\n }\n if(b%3 == 1 && a%3==0)\n {\n c=6;\n d=0;\n }\n if(b%3 == 2 && a%3==1)\n {\n c=0;\n d=3;\n }\n if(b%3 == 2 && a%3==2)\n {\n c=3;\n d=3;\n }\n if(b%3 == 2 && a%3==0)\n {\n c=6;\n d=3;\n }\n if(b%3 == 0 && a%3==1)\n {\n c=0;\n d=6;\n }\n if(b%3 == 0 && a%3==2)\n {\n c=3;\n d=6;\n }\n if(b%3 == 0 && a%3==0)\n {\n c=6;\n d=6;\n }\n\n for(i=c;i<c+3;i++)\n {\n for(j=d;j<d+3;j++)\n {\n //if(a%3==i && b%3==j)\n if(ttt[i][j]=='.')\n {\n flag=1;\n ttt[i][j]='!';\n }\n }\n }\n if(flag==0)\n {\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n if(ttt[i][j]=='.')\n ttt[i][j]='!';\n }\n }\n }\n}\nint main()\n{\n int a,b;\n int i,j;\n for(i=0;i<9;i++)\n {\n // printf(\"%d\\n\",i);\n for(j=0;j<9;j++)\n {\n scanf(\" %c\",&ttt[i][j]);\n }\n }\n scanf(\"%d %d\",&a,&b);\n //printf(\"1\");\n check(b,a);\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n printf(\"%c\",ttt[i][j]);\n if(j%3==2)\n printf(\" \");\n }\n printf(\"\\n\");\n if(i%3==2)\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nshort main(){\n char a[10][10];\n char temp;\n int i,j,row,col,conf=0;\n int a1,z1,a2,z2;\n for(i=1;i<10;i++)\n for(j=1;j<10;j++)\n {\n scanf(\"%c\",&temp);\n if(temp==' '||temp=='\\n'){j--;continue;}\n a[i][j]=temp;\n }\n scanf(\"%d\",&row);\n scanf(\"%d\",&col);\n\n if(row==1||row==4||row==7){a1=1;z1=4;}\n else if(row==2||row==5||row==8){a1=4;z1=7;}\n else if(row==3||row==6||row==9){a1=7;z1=10;}\n\n if(col==1||col==4||col==7){a2=1;z2=4;}\n else if(col==2||col==5||col==8){a2=4;z2=7;}\n else if(col==3||col==6||col==9){a2=7;z2=10;}\n\n\n for(i=a1;i<z1;i++)for(j=a2;j<z2;j++)if(a[i][j]!='x'&& a[i][j]!='o'){a[i][j]='!';conf=1;}\n if(conf==0){\n for(i=1;i<10;i++)\n {for(j=1;j<10;j++)\n {if(j==4||j==7)printf(\" \");\n if(a[i][j]=='.')printf(\"!\");\n else {printf(\"%c\",a[i][j]);}}printf(\"\\n\");if(i==3||i==6)printf(\"\\n\");}\n }\n else\n for(i=1;i<10;i++){for(j=1;j<10;j++)\n {if(j==4||j==7)printf(\" \"); printf(\"%c\",a[i][j]);}printf(\"\\n\");if(i==3||i==6)printf(\"\\n\");}\n\nreturn 0;}"}, {"source_code": "//set many funcs template\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define inf 1072114514\n#define llinf 4154118101919364364\n#define mod 1000000007\n#define pi 3.1415926535897932384\n\nint max(int a,int b){if(a>b){return a;}return b;}\nint min(int a,int b){if(a<b){return a;}return b;}\nint zt(int a,int b){return max(a,b)-min(a,b);}\nint round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nint ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}\nint gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nint lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}\nint nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nint fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nint pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\nlong long llmax(long long a,long long b){if(a>b){return a;}return b;}\nlong long llmin(long long a,long long b){if(a<b){return a;}return b;}\nlong long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}\nlong long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}\nlong long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}\nlong long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}\nlong long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}\nlong long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}\nlong long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}\nlong long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}\ndouble dbmax(double a,double b){if(a>b){return a;}return b;}\ndouble dbmin(double a,double b){if(a<b){return a;}return b;}\ndouble dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}\nint sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}\nint llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}\nint dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\nint dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}\n\nint main(void){\n int i,j,k,x,y,a[262144],f=0;\n char s[16][4][4];\n for(i=1;i<=9;i++){\n for(j=1;j<=3;j++){scanf(\"%s\",s[i][j]);}\n //printf(\"%s\\n\",s[i][3]);\n }\n scanf(\"%d%d\",&x,&y);\n x%=3;y%=3;\n if(x==0){x=3;}\n if(y==0){y=3;}\n for(i=3*x-2;i<=3*x;i++){\n for(k=0;k<3;k++){if(s[i][y][k] == '.'){f=1;s[i][y][k]='!';}}\n }\n for(i=1;i<=9;i++){\n if(f==1){break;}\n for(j=1;j<=3;j++){\n for(k=0;k<3;k++){if(s[i][j][k] == '.'){s[i][j][k]='!';}}\n }\n }\n for(i=1;i<=9;i++){\n for(k=1;k<=3;k++){printf(\"%s\",s[i][k]);if(k==3){printf(\"\\n\");}else{printf(\" \");}}\n if(i%3==0){printf(\"\\n\");}\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar tmp[20];\nchar b[9][9];\nint main(){\n for (int i=0, cnt=0; i<9; i++, cnt++){\n fgets(tmp, 20, stdin);\n if (cnt==3|| cnt==7){ i--; continue;}\n int len= strlen(tmp);\n int col=0;\n for (int j=0; j<len; j++){\n if (tmp[j]=='.' || tmp[j]=='x' || tmp[j]=='o' )\n b[i][col++]=tmp[j];\n }\n }\n\n int x, y;\n scanf(\"%d %d\", &x, &y); x--, y--;\n x=x%3*3, y%=3;\n int val=x+y;\n\n int chk=1;\n for (int i=0; i<3; i++){\n for (int j=0; j<3; j++){\n if(b[val/3*3+i][val%3*3+j]=='.') chk=0;\n }\n }\n if (chk){\n for (int i=0, c=0; i<9; i++, c++){\n if (c==3 || c==6) printf(\"\\n\");\n for (int j=0, c2=0; j<9; j++, c2++){\n if(c2==3 || c2==6) printf(\" \");\n if(b[i][j]=='x' || b[i][j]=='o') printf(\"%c\", b[i][j]);\n else printf(\"!\");\n }\n printf(\"\\n\");\n }\n }\n else {\n for (int i=0, c=0; i<9; i++, c++){\n if (c==3 || c==6) printf(\"\\n\");\n for (int j=0, c2=0; j<9; j++, c2++){\n if (c2==3 || c2==6) printf(\" \");\n if (b[i][j]=='x' || b[i][j]=='o') printf(\"%c\", b[i][j]);\n else {\n if ( val/3*3 <= i && i < val/3*3+3 &&\n val%3*3 <= j && j < val%3*3+3) printf(\"!\");\n else printf(\".\");\n }\n }\n printf(\"\\n\");\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[5][5][5][5];\n int x, y, i ,j , k, l, a;\n\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n for(k=0; k<3; k++)\n {\n scanf(\"%s\", s[i][k][j]);\n }\n }\n }\n\n scanf(\"%d%d\", &y, &x);\n\n x--;\n y--;\n\n x%=3;\n y%=3;\n\n a=0;\n\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n if(s[y][x][i][j]=='.')\n {\n s[y][x][i][j]='!';\n a++;\n }\n }\n }\n\n if(a==0)\n {\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n for(k=0; k<3; k++)\n {\n for(l=0; l<3; l++)\n {\n if(s[k][l][i][j]=='.')\n {\n s[k][l][i][j]='!';\n }\n }\n }\n }\n }\n }\n\n for(i=0; i<3; i++)\n {\n for(j=0; j<3; j++)\n {\n for(k=0; k<3; k++)\n {\n printf(\"%s \", s[i][k][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,y;\n\tchar s[3][3][3][3];\n\tint i,j,k,pos,flag=0;\n\tfor(i=0;i<3;i++)\n\t\tfor(j=0;j<3;j++)\n\t\t\tfor(k=0;k<3;k++)\n\t\t\t\tscanf(\"%s\" ,s[i][j][k]);\n\tscanf(\"%d %d\",&x,&y);\n\tint x1=(x-1)%3,y1=(y-1)%3;\n\tfor(j=0;j<3;j++)\n\t{\n\t\tfor(pos=0;pos<3;pos++)\n\t\t\tif(s[x1][j][y1][pos]=='.')\n\t\t\t{\n\t\t\t\ts[x1][j][y1][pos]='!';\n\t\t\t\tflag=1;\n\t\t\t}\n\t}\n\tif(!flag)\n\t{\n\t\tfor(i=0;i<3;i++)\n\t\t\tfor(j=0;j<3;j++)\n\t\t\t\tfor(k=0;k<3;k++)\n\t\t\t\t\tfor(pos=0;pos<3;pos++)\n\t\t\t\t\t\tif(s[i][j][k][pos]=='.')\n\t\t\t\t\t\t\ts[i][j][k][pos]='!';\n\t}\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(j=0;j<3;j++)\n\t\t{\n\t\t\tfor(k=0;k<3;k++)\n\t\t\t{\n\t\t\t\tfor(pos=0;pos<3;pos++)\n\t\t\t\t\tprintf(\"%c\" ,s[i][j][k][pos]);\n\t\t\t\tprintf(\" \");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nshort main(){\n char a[10][10];\n char temp;\n int i,j,row,col,conf=0;\n int a1,z1,a2,z2;\n for(i=1;i<10;i++)\n for(j=1;j<10;j++)\n {\n scanf(\"%c\",&temp);\n if(temp==' '||temp=='\\n'){j--;continue;}\n a[i][j]=temp;\n }\n scanf(\"%d\",&row);\n scanf(\"%d\",&col);\n\n if(row==1||row==4||row==7){a1=1;z1=4;}\n else if(row==2||row==5||row==8){a1=4;z1=7;}\n else if(row==3||row==6||row==9){a1=7;z1=10;}\n\n if(col==1||col==4||col==7){a2=1;z2=4;}\n else if(col==2||col==5||col==8){a2=4;z2=7;}\n else if(col==3||col==6||col==9){a2=7;z2=10;}\n\n\n for(i=a1;i<z1;i++)for(j=a2;j<z2;j++)if(a[i][j]!='x'&& a[i][j]!='o'){a[i][j]='!';conf=1;}\n if(conf==0){\n for(i=1;i<10;i++)\n {for(j=1;j<10;j++)\n {if(j==4||j==7)printf(\" \");\n if(a[i][j]=='.')printf(\"!\");\n else {printf(\"%c\",a[i][j]);}}printf(\"\\n\");if(i==3||i==6)printf(\"\\n\");}\n }\n else\n for(i=1;i<10;i++){for(j=1;j<10;j++)\n {if(j==4||j==7)printf(\" \"); printf(\"%c\",a[i][j]);}printf(\"\\n\");if(i==3||i==6)printf(\"\\n\");}\n\nreturn 0;}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[9][9],b[11][11];\n\tint i,j,m,n,t=0;\n\tfor(i=0;i<11;i++)\n\t{\n\t\tj=0;\n\t\twhile(scanf(\"%c\",&b[i][j])&&b[i][j]!='\\n')j++;\n\t}\n\tfor(i=0;i<9;i++)\n\t{\n\t\tfor(j=0;j<9;j++)a[i][j]=b[i+i/3][j+j/3];\n\t}\n\tscanf(\"%d%d\",&m,&n);\n\tm=(m-1)%3;\n\tn=(n-1)%3;\n\tm=m*3;\n\tn=n*3;\n\tfor(i=m;i<m+3;i++)\n\t{\n\t\tfor(j=n;j<n+3;j++)\n\t\t\tif(a[i][j]=='.')\n\t\t\t{\n\t\t\t\tt=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif(t==1)break;\n\t}\n\tif(t==1)\n\t{\n\t\tfor(i=m;i<m+3;i++)\n\t\t{\n\t\t\tfor(j=n;j<n+3;j++)\n\t\t\t\tif(a[i][j]=='.')\n\t\t\t\ta[i][j]='!';\n\t\t}\n\t}\n\telse for(i=0;i<9;i++)\n\t\tfor(j=0;j<9;j++)\n\t\t\tif(a[i][j]=='.')\n\t\t\t\ta[i][j]='!';\n\tfor(i=0;i<9;i++)\n\t{\n\t\tfor(j=0;j<9;j++)\n\t\t{\n\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\tif(j%3==2&&j<8)printf(\" \");\n\t\t}\n\t\tprintf(\"\\n\");\n\t\tif(i%3==2&&i<8)printf(\"\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nchar p[10][10];\nint x, y;\n\nvoid ispisi() {\n int i,j;\n for(i = 0; i < 9; ++i) {\n for(j = 0; j < 9; ++j) {\n if(j==3 || j == 6) {\n printf(\" %c\",p[i][j]);\n } else {\n printf(\"%c\",p[i][j]);\n }\n }\n printf(\"\\n\");\n if(i == 2 || i == 5) printf(\"\\n\");\n }\n}\n\nint provjeri(int x, int y) {\n int i, j;\n \n for(i = x*3; i < x*3+3; ++i) {\n for(j = y*3; j < y*3+3; ++j) {\n if(p[i][j] == '.') return 1;\n }\n }\n \n return 0;\n}\n\nvoid popuniPolje(int x, int y) {\n int i,j; \n \n for(i = x*3; i < x*3+3; ++i) {\n for(j = y*3; j < y*3+3; ++j) {\n if(p[i][j] == '.') p[i][j] = '!';\n }\n }\n}\n\nvoid popuniSve() {\n int i,j;\n \n for(i = 0; i < 9; ++i) {\n for(j = 0; j < 9; ++j) {\n if(p[i][j] == '.') p[i][j] = '!';\n }\n }\n}\n\nvoid popuni(int x, int y){\n if(provjeri(x,y)) {\n popuniPolje(x,y);\n } else {\n popuniSve();\n }\n}\n\n\nint main() {\n int i,j;\n \n for(i = 0; i < 9; ++i) {\n for(j = 0; j < 9; ++j) {\n scanf(\" %c\",&p[i][j]);\n }\n }\n scanf(\"%d %d\", &y, &x);\n x--;\n y--;\n \n popuni(y%3,x%3);\n ispisi();\n return 0;\n}"}, {"source_code": "/* Teng K. J. */\n\n#include <stdio.h>\n\n#define N 9\nchar map[N][N];\n\nvoid fill(int i, int j) {\n\tint r = i * 3;\n\tint c = j * 3;\n\tint re = r + 3, ce = c + 3;\n\twhile (r < re) {\n\t\tc = j * 3;\n\t\twhile (c < ce) {\n\t\t\tif (map[r][c] == '.') {\n\t\t\t\tmap[r][c] = '!';\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\tr++;\n\t}\n}\n\nint check(int i, int j) {\n\tint r = i * 3;\n\tint c = j * 3;\n\tint re = r + 3, ce = c + 3;\n\twhile (r < re) {\n\t\tc = j * 3;\n\t\twhile (c < ce) {\n\t\t\tif (map[r][c] == '.') {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\tr++;\n\t}\n\treturn 0;\n}\n\t\nint main() {\n\tint i, j, r, c;\n\t\n\tfor (i = 0; i < N; ++i) {\n\t\tfor (j = 0; j < N; ++j) {\n\t\t\tmap[i][j] = getchar();\n\t\t\tif (j % 3 == 2) getchar();\n\t\t}\n\t\tif (i % 3 == 2 && i != 8) getchar();\n\t}\n\tscanf(\"%d%d\", &i, &j);\n\tr = (i - 1) % 3;\n\tc = (j - 1) % 3;\n\t\n\tif (check(r, c)) {\n\t\tfill(r, c);\n\t} else {\n\t\tfor (i = 0; i < 3; ++i) {\n\t\t\tfor (j = 0; j < 3; ++j) {\n\t\t\t\tfill(i, j);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (i = 0; i < N; ++i) {\n\t\tfor (j = 0; j < N; ++j) {\n\t\t\tputchar(map[i][j]);\n\t\t\tif (j % 3 == 2) putchar(j == 8 ? '\\n' : ' ');\n\t\t}\n\t\tif (i % 3 == 2 && i != 8) putchar('\\n');\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int flag=0;\n char s[20][20];\n for(int i=0;i<11;i++)\n {\n gets(s[i]);\n }\n int x,y;\n scanf(\"%d %d\",&x,&y);\n int x1,y1;\n if(y%3==0)y1=8;\n if(x%3==0)x1=8;\n if(y%3==1)y1=0;\n if(x%3==1)x1=0;\n if(y%3==2)y1=4;\n if(x%3==2)x1=4;\n for(int i=x1;i<=x1+3;i++)\n {\n for(int j=y1;j<=y1+3;j++)\n {\n if(s[i][j]=='.')\n {\n flag=1;\n s[i][j]='!';\n }\n }\n }//printf(\"%d %d\\n\",x1,y1);\n if(flag==0)\n {\n for(int i=0;i<11;i++)\n {\n for(int j=0;j<11;j++)\n {\n if(s[i][j]=='.')\n s[i][j]='!';\n }\n }\n }\n for(int i=0;i<11;i++)\n printf(\"%s\\n\",s[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(!f)\n {for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') a[i][j]='!';\n }\n for(i=0;i<9;i++)\n {\n if(i%3==0&&i) printf(\"\\n\");\n for(j=0;j<9;j++)\n {\n if(j%3==0&&j) printf(\" \");\n printf(\"%c\",a[i][j]);\n }\n printf(\"\\n\");\n }\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(f==0){\n\t\tfor(i=0;i<9;i++)\n\t\tfor(j=0;j<9;j++)\n\t\tif(a[i][j]=='.') a[i][j]='!';\n\t}\n\tfor(i=0;i<9;i++){\n\t\tif(i%3==0 && i) printf(\"\\n\");\n\t\t\tfor(j=0;j<9;j++){\n\t\t\t\tif(j%3==0&&j) printf(\" \"); \n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t }\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char a[9][9];\n int i,j,x,y,flag=1;\n for(i=0;i<9;i++)\n scanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\n scanf(\"%d%d\",&x,&y);\n \n while(x>3) x-=3;\n while(y>3) y-=3;\n if(x==1&&y==1)\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0; }\n if(x==2&&y==1)\n for(i=3;i<6;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==1)\n for(i=6;i<9;i++)\n for(j=0;j<3;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==1&&y==2)\n for(i=0;i<3;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==2&&y==2)\n for(i=3;i<6;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==2)\n for(i=6;i<9;i++)\n for(j=3;j<6;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==1&&y==3)\n for(i=0;i<3;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==2&&y==3)\n for(i=3;i<6;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(x==3&&y==3)\n for(i=6;i<9;i++)\n for(j=6;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';flag=0;}\n if(flag)\n {for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') a[i][j]='!';\n }\n for(i=0;i<9;i++)\n {\n if(i%3==0&&i) printf(\"\\n\");\n for(j=0;j<9;j++)\n {\n if(j%3==0&&j) printf(\" \");\n printf(\"%c\",a[i][j]);\n }\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <stdlib.h>\n#define eps 1e-4\n#define PI acos(-1.0)\nchar s[10][15];\nint sti[4]={0,1,4,7},eni[4]={0,3,6,9};\nint stj[4]={0,0,4,8},enj[4]={0,2,6,10};\nvoid printall2()\n{\n\tfor (int i=1;i<=9;i++)\n\t{\n\t\tfor (int j=0;j<=10;j++)\n\t\t\tif (s[i][j]=='.') printf(\"!\");\n\t\t\telse printf(\"%c\",s[i][j]);\n\t\tprintf(\"\\n\");\n\t\tif (!(i%3)) printf(\"\\n\");\n\t}\n}\nvoid printall1()\n{\n\tfor (int i=1;i<=9;i++)\n\t{\n\t\tfor (int j=0;j<=10;j++)\n\t\t\tprintf(\"%c\",s[i][j]);\n\t\tprintf(\"\\n\");\n\t\tif (!(i%3)&&i!=9) printf(\"\\n\");\n\t}\n}\nint main()\n{\n\tfor (int i=1;i<=3;i++) gets(s[i]);\n\tgets(s[0]);\n\tfor (int i=4;i<=6;i++) gets(s[i]);\n\tgets(s[0]);\n\tfor (int i=7;i<=9;i++) gets(s[i]);\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tn%=3; m%=3; \n\tif (!n) n=3;\n\tif (!m) m=3;\n\tint flag=0;\n\tfor (int i=sti[n];i<=eni[n];i++)\n\t\tfor (int j=stj[m];j<=enj[m];j++)\n\t\t\tif (s[i][j]=='.')\n\t\t\t{\n\t\t\t\tflag++;\n\t\t\t\ts[i][j]='!';\n\t\t\t}\n\tif (flag) printall1();\n\telse printall2();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar t[4][4][4][4],i,j,s[100],k,l;\n\tint x,y,flag=0;\n\n\t/*SCANNING START*/\n\tfor(i=0; i<3; i++)\n\t{\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[0][0][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[0][1][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[0][2][i][j]=s[j];\n\t\t}\n\t}\n\n\tfor(i=0; i<3; i++)\n\t{\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[1][0][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[1][1][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{ \n\t\t\tt[1][2][i][j]=s[j];\n\t\t} \n\t}\n\n\tfor(i=0; i<3; i++)\n\t{\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[2][0][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tt[2][1][i][j]=s[j];\n\t\t}\n\t\tscanf(\"%s\",s);\n\t\tfor(j=0; j<3; j++)\n\t\t{ \n\t\t\tt[2][2][i][j]=s[j];\n\t\t} \n\t}\n\t/*SCANNING FINISH*/\n\t\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tx--;\n\tx=x%3;\n\ty--;\n\ty=y%3;\n\t\n\tfor(i=0; i<3; i++)\n\t{\n\t\tfor(j=0; j<3; j++)\n\t\t{\n\t\t\tif(t[x][y][i][j]=='.')\n\t\t\t{\n\t\t\t\tflag++;\n\t\t\t\tt[x][y][i][j]='!';\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==0)\n\t{\n\t\tfor(i=0; i<3; i++)\n\t\t{\n\t\t\tfor(j=0; j<3; j++)\n\t\t\t{\n\t\t\t\tfor(k=0; k<3; k++)\n\t\t\t\t{\n\t\t\t\t\tfor(l=0; l<3; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(t[i][j][k][l]=='.')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tt[i][j][k][l]='!';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\n\t/*PRINTING START*/\n\tfor(i=0; i<3; i++)\n\t{\n\t\tfor(k=0; k<3; k++)\n\t\t{\n\t\t\tfor(j=0; j<3; j++)\n\t\t\t{\n\t\t\t\tfor(l=0; l<3; l++)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%c\",t[i][j][k][l]);\n\t\t\t\t}\n\t\t\t\tprintf(\" \");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t\t\n\t}\n\t/*PRINTING FINISH*/\n\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char jad[11][12];\n int i,j;\n for(i=0;i<11;i++)\n {\n for(j=0;j<12;j++)\n {\n scanf(\"%c\",&jad[i][j]);\n if (jad[i][j]=='\\n')\n {\n break;\n }\n }\n }\n int a,b,c,p=0;\n int m1,m2;\n scanf(\"%d %d\",&a,&b);\n m1=a%3;\n m2=b%3;\n if (m1==0) i=8;\n if (m1==1) i=0;\n if (m1==2) i=4;\n if (m2==0) j=8;\n if (m2==1) j=0;\n if (m2==2) j=4;\n a=j;\n b=i;\n for(i;i<b+3;i++)\n {\n for(j;j<a+3;j++)\n {\n if (jad[i][j]=='.')\n {\n p=1;\n jad[i][j]='!';\n }\n }\n j=a;\n }\n if (p!=1)\n {\n for(i=0;i<11;i++)\n {\n for(j=0;j<12;j++)\n {\n if (i==3 || i==7) break;\n if (jad[i][j]=='.') jad[i][j]='!';\n }\n }\n }\n for(i=0;i<11;i++)\n {\n for(j=0;j<12;j++)\n {\n printf(\"%c\",jad[i][j]);\n if (jad[i][j]=='\\n')\n {\n break;\n }\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <limits.h>\n\n\nint main() {\n char matrix[9][9];\n for (int i = 0; i < 9; ++i) {\n for (int j = 0; j < 9; j += 3) {\n scanf(\"%c%c%c%*c\", &matrix[i][j], &matrix[i][j + 1], &matrix[i][j + 2]);\n }\n if(i == 2 || i ==5){\n scanf(\"%*c\");\n }\n }\n int a, b;\n scanf(\"%d%d\", &a, &b);\n a--;\n b--;\n int c, d;\n c = a % 3;\n d = b % 3;\n\n int counter = 0;\n for (int i = 0; i < 3; ++i) {\n for (int j = 0; j < 3; ++j) {\n if(matrix[c * 3 + i][d * 3 + j] == '.'){\n counter++;\n matrix[c * 3 + i][d * 3 + j] = '!';\n }\n }\n }\n if(counter){\n for (int i = 0; i < 9; ++i) {\n for (int j = 0; j < 9; ++j) {\n printf(\"%c\", matrix[i][j]);\n if (j == 2 || j == 5)\n printf(\" \");\n }\n printf(\"\\n\");\n if(i == 2 || i == 5)\n printf(\"\\n\");\n }\n }else{\n for (int i = 0; i < 9; ++i) {\n for (int j = 0; j < 9; ++j) {\n if(matrix[i][j] != '.')\n printf(\"%c\", matrix[i][j]);\n else\n printf(\"!\");\n if (j == 2 || j == 5)\n printf(\" \");\n }\n printf(\"\\n\");\n if(i == 2 || i == 5)\n printf(\"\\n\");\n }\n }\n\n\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n char field[9][9]; int x,y;\n for(int i = 0 ; i < 9 ; ++i) for(int j = 0 ; j < 9 ; j += 3) scanf(\" %c%c%c \", &field[i][j+0], &field[i][j+1], &field[i][j+2]);\n scanf(\"%d %d\\n\", &x, &y); --x, --y; int fr = x%3, fc = y%3;\n\n int free_count = 0;\n for(int i = 0, ii = fr*3 ; i < 3 ; ++i, ++ii) for(int j = 0, jj = fc*3 ; j < 3 ; ++j, ++jj) {\n free_count += field[ii][jj] == '.' ? 1 : 0;\n }\n\n const int rs = free_count ? fr*3 : 0, rc = free_count ? 3 : 9, cs = free_count ? fc*3 : 0, cc = free_count ? 3 : 9;\n for(int i = 0, ii = rs ; i < rc ; ++i, ++ii) for(int j = 0, jj = cs ; j < cc ; ++j, ++jj)\n if(field[ii][jj] == '.') field[ii][jj] = '!';\n\n for(int i = 0 ; i < 9 ; ++i) {\n for(int j = 0 ; j < 9 ; j += 3)\n printf(\"%c%c%c%c\", field[i][j+0], field[i][j+1], field[i][j+2], j == 6 ? '\\n' : ' ');\n if(i % 3 == 2) printf(\"\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(int argc, char const *argv[])\n{\n char field[9][3][5];\n for (int i = 0; i < 9; i+=3)\n {\n for (int j = 0; j < 3; ++j)\n {\n scanf(\"%s\",field[i][j]);\n scanf(\"%s\",field[i+1][j]);\n scanf(\"%s\",field[i+2][j]);\n }\n \n }\n int cur_x,cur_y,field_x,field_y,field_pos;\n scanf(\"%d%d\",&cur_x,&cur_y);\n cur_x-=1;\n cur_y-=1;\n field_x=(cur_x%3);//0 is top,1 is middle ,2 is down\n field_y=(cur_y%3);//0 is left,1 is mid, 2 is right\n field_pos=field_x*3+field_y;\n int flag=0;//1 is this field ok\n for (int i = 0; i < 3; ++i)\n {\n for (int j = 0; j < 3; ++j)\n {\n if (field[field_pos][i][j]=='.')\n {\n field[field_pos][i][j]='!';\n flag=1;\n }\n }\n }\n \n // printf(\"%d\\n\",field_pos);\n if (flag==0)\n {\n for (int i = 0; i < 9; ++i)\n {\n for (int k = 0; k < 3; ++k)\n {\n for (int j = 0; j < 3; ++j)\n {\n if (field[i][k][j]=='.')\n {\n field[i][k][j]='!';\n }\n }\n }\n }\n }\n\n\n\n //print table\n for (int i = 0; i < 9; i+=3)\n {\n for (int j = 0; j < 3; ++j)\n {\n printf(\"%s \",field[i][j]);\n printf(\"%s \",field[i+1][j]);\n printf(\"%s\\n\",field[i+2][j]);\n }\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n char s1[3][12],s2[3][12],s3[3][12],s[3][12];\n int x,y,space=0,i,j,k,row,col,str;\n scanf(\"%[^\\n]\",s1[0]);\n scanf(\" %[^\\n]\",s1[1]);\n scanf(\" %[^\\n]\",s1[2]);\n scanf(\" %[^\\n]\",s2[0]);\n scanf(\" %[^\\n]\",s2[1]);\n scanf(\" %[^\\n]\",s2[2]);\n scanf(\" %[^\\n]\",s3[0]);\n scanf(\" %[^\\n]\",s3[1]);\n scanf(\" %[^\\n]\",s3[2]);\n scanf(\"%d%d\",&x,&y);\n if(x<4)\n row=x;\n else\n {\n if(x%3==0)\n row=3;\n else\n row=x%3;\n }\n if(y<4)\n col=y;\n else\n {\n if(y%3==0)\n col=3;\n else\n col=y%3;\n }\n if(row==1)\n {\n strcpy(s[0],s1[0]);\n strcpy(s[1],s1[1]);\n strcpy(s[2],s1[2]);\n str=1;\n }\n else if(row==2)\n {\n strcpy(s[0],s2[0]);\n strcpy(s[1],s2[1]);\n strcpy(s[2],s2[2]);\n str=2;\n }\n else\n {\n strcpy(s[0],s3[0]);\n strcpy(s[1],s3[1]);\n strcpy(s[2],s3[2]);\n str=3;\n }\n if(col==1)\n {\n k=0;\n }\n else if(col==2)\n {\n k=4;\n }\n else\n {\n k=8;\n }\n for(i=0;i<3;i++)\n {\n for(j=k;j<k+3;j++)\n {\n if(s[i][j]=='.')\n {\n space=1;\n s[i][j]='!';\n }\n }\n }\n if(space==0)\n {\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s1[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s1[i][j]);\n }\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s2[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s2[i][j]);\n }\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s3[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s3[i][j]);\n }\n }\n printf(\"\\n\");\n }\n }\n else\n {\n if(str==1)\n {\n strcpy(s1[0],s[0]);\n strcpy(s1[1],s[1]);\n strcpy(s1[2],s[2]);\n }\n else if(str==2)\n {\n strcpy(s2[0],s[0]);\n strcpy(s2[1],s[1]);\n strcpy(s2[2],s[2]);\n }\n else\n {\n strcpy(s3[0],s[0]);\n strcpy(s3[1],s[1]);\n strcpy(s3[2],s[2]);\n }\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s1[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s2[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s3[i][j]);\n }\n printf(\"\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tchar c;\n\tint grid[9][9];\n\tint x,y,i,j,k,l;\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tfor(k=0;k<3;k++){\n\t\t\t\tscanf(\"%c\",&c);\n\t\t\t\tif(c=='.'){\n\t\t\t\t\tgrid[i*3+j][k*3]=0;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(c=='x'){\n\t\t\t\t\t\tgrid[i*3+j][k*3]=1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tgrid[i*3+j][k*3]=-1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscanf(\"%c\",&c);\n\t\t\t\tif(c=='.'){\n\t\t\t\t\tgrid[i*3+j][k*3+1]=0;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(c=='x'){\n\t\t\t\t\t\tgrid[i*3+j][k*3+1]=1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tgrid[i*3+j][k*3+1]=-1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscanf(\"%c\",&c);\n\t\t\t\tif(c=='.'){\n\t\t\t\t\tgrid[i*3+j][k*3+2]=0;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tif(c=='x'){\n\t\t\t\t\t\tgrid[i*3+j][k*3+2]=1;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tgrid[i*3+j][k*3+2]=-1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscanf(\"%c\",&c);\n\t\t\t}\n\t\t}\n\t\tif(i<2)scanf(\"%c\",&c);\n\t\telse{\n\t\t\tscanf(\"%d%d\",&x,&y);\n\t\t}\n\t}\n\tint xx=(x+2)%3;\n\tint yy=(y+2)%3;\n\tint flag=0;\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tif(grid[xx*3+i][yy*3+j]==0){\n\t\t\t\tgrid[xx*3+i][yy*3+j]=2;\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag==0){\n\t\tfor(i=0;i<9;i++)for(j=0;j<9;j++)if(grid[i][j]==0)grid[i][j]=2;\n\t}\n\tfor(i=0;i<3;i++){\n\t\tfor(j=0;j<3;j++){\n\t\t\tfor(k=0;k<3;k++){\n\t\t\t\tfor(l=0;l<3;l++){\n\t\t\t\t\tif(grid[i*3+j][k*3+l]==0){\n\t\t\t\t\t\tprintf(\".\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tif(grid[i*3+j][k*3+l]==1){\n\t\t\t\t\t\t\tprintf(\"x\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tif(grid[i*3+j][k*3+l]==-1){\n\t\t\t\t\t\t\t\tprintf(\"o\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\tif(grid[i*3+j][k*3+l]==2){\n\t\t\t\t\t\t\t\t\tprintf(\"!\");\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\tif(k<2)printf(\" \");\n\t\t\t\telse printf(\"\\n\");\n\t\t\t}\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n char a[9][9];\n int x,y,i,m,n,j;\n for(i=0;i<9;i++)\n scanf(\"%s%s%s\",&a[i][0],&a[i][3],&a[i][6]);\n scanf(\"%d %d\",&x,&y);\n while(x>3) x-=3;\n while(y>3) y-=3;\n m=x*3;n=y*3;\n int k=1;\n for(i=m-3;i<m;i++)\n for(j=n-3;j<n;j++)\n {\n if(a[i][j]=='.') {k=0;a[i][j]='!';}\n }\n if(k==1)\n {\n for(i=0;i<9;i++)\n for(j=0;j<9;j++)\n if(a[i][j]=='.') {a[i][j]='!';}\n }\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n printf(\"%c\",a[i][j]);\n if(j%3==2) printf(\" \");\n }\n if(i%3==2) printf(\"\\n\");\n }\n printf(\"\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][0][j]=='.'){\n m=1;\n break;\n }\n }\n }\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b<=3)\n b=b-1;\nif(a<=3)\n a=a-1;\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.'){\n m=1;\n break;\n }\n }\n if(m==1)\n break;\n }\n//printf(\"%d %d %d %d\\n\",A[0],A[1],A[2],A[3]);\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.'){\n m=1;\n break;\n }\n }\n if(m==1)\n break;\n }\n //printf(\"%c %c %c %c %c %c %c %c %c\\n\",str[3][1][0],str[3][1][1],str[3][1][2],str[4][1][0],str[4][1][1],str[4][1][2],str[5][1][0],str[5][1][1],str[5][1][2]);\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b<3)\n b=b-1;\nif(a<3)\n a=a-1;\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.'){\n m=1;\n break;\n }\n }\n if(m==1)\n break;\n }\nprintf(\"%d %d %d %d\\n\",A[0],A[1],A[2],A[3]);\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint i,j,k,a,b,m;\nint A[4];\nchar str[9][3][3];\nfor(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n scanf(\"%s\",str[i][j]);\n }\n}\nscanf(\"%d %d\",&a,&b);\nif(b>3)\n b=b-4;\nif(b>2)\n b=b-3;\n if(a>3)\n a=a-4;\nif(a>2)\na=a-3;\n if(a==0&&b==0){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=0;\n }\n if(a==0&&b==1){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=1;\n }\n if(a==0&&b==2){\n A[0]=0;\n A[1]=1;\n A[2]=2;\n A[3]=2;\n }\n if(a==1&&b==0){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=0;\n }\n if(a==1&&b==1){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=1;\n }\n if(a==1&&b==2){\n A[0]=3;\n A[1]=4;\n A[2]=5;\n A[3]=2;\n }\n if(a==2&&b==0){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=0;\n }\n if(a==2&&b==1){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=1;\n }\n if(a==2&&b==2){\n A[0]=6;\n A[1]=7;\n A[2]=8;\n A[3]=2;\n }\n m=0;\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n if(str[A[i]][A[3]][j]=='.'){\n m=1;\n break;\n }\n }\n if(m==1)\n break;\n }\n //printf(\"%c %c %c %c %c %c %c %c %c\\n\",str[3][1][0],str[3][1][1],str[3][1][2],str[4][1][0],str[4][1][1],str[4][1][2],str[5][1][0],str[5][1][1],str[5][1][2]);\n if(m==0){\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n if(str[i][j][k]=='.')\n printf(\"!\");\n else\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n}\n else if(m==1){\n for(i=0;i<=2;i++){\n for(j=0;j<=2;j++){\n str[A[i]][A[3]][j]='!';\n }\n }\n for(i=0;i<=8;i++){\n for(j=0;j<=2;j++){\n for(k=0;k<=2;k++){\n printf(\"%c\",str[i][j][k]);\n }\n printf(\" \");\n }\n printf(\"\\n\");\n if(i==2||i==5)\n printf(\"\\n\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar ttt[9][9];\nvoid check(int b,int a)\n{\n int i,j;\n int c,d;\n int flag=0;\n if(b%3 == 1 && a%3==1)\n {\n c=0;\n d=0;\n }\n if(b%3 == 1 && a%3==2)\n {\n c=3;\n d=0;\n }\n if(b%3 == 1 && a%3==0)\n {\n c=6;\n d=0;\n }\n if(b%3 == 2 && a%3==1)\n {\n c=0;\n d=3;\n }\n if(b%3 == 2 && a%3==2)\n {\n c=3;\n d=3;\n }\n if(b%3 == 2 && a%3==3)\n {\n c=6;\n d=3;\n }\n if(b%3 == 0 && a%3==1)\n {\n c=0;\n d=6;\n }\n if(b%3 == 0 && a%3==2)\n {\n c=3;\n d=6;\n }\n if(b%3 == 0 && a%3==0)\n {\n c=6;\n d=6;\n }\n\n for(i=c;i<c+3;i++)\n {\n for(j=d;j<d+3;j++)\n {\n if(ttt[i][j]=='.')\n {\n flag=1;\n ttt[i][j]='!';\n }\n }\n }\n if(flag==0)\n {\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n if(ttt[i][j]=='.')\n ttt[i][j]='!';\n }\n }\n }\n}\nint main()\n{\n int a,b;\n int i,j;\n for(i=0;i<9;i++)\n {\n // printf(\"%d\\n\",i);\n for(j=0;j<9;j++)\n {\n scanf(\" %c\",&ttt[i][j]);\n }\n }\n scanf(\"%d %d\",&a,&b);\n //printf(\"1\");\n check(b,a);\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n printf(\"%c\",ttt[i][j]);\n if(j%3==2)\n printf(\" \");\n }\n printf(\"\\n\");\n if(i%3==2)\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nchar ttt[9][9];\nvoid check(int b,int a)\n{\n int i,j;\n int c,d;\n int flag=0;\n if(b%3 == 1 && a%3==1)\n {\n c=0;\n d=0;\n }\n if(b%3 == 1 && a%3==2)\n {\n c=3;\n d=0;\n }\n if(b%3 == 1 && a%3==0)\n {\n c=6;\n d=0;\n }\n if(b%3 == 2 && a%3==1)\n {\n c=0;\n d=3;\n }\n if(b%3 == 2 && a%3==2)\n {\n c=3;\n d=3;\n }\n if(b%3 == 2 && a%3==0)\n {\n c=6;\n d=3;\n }\n if(b%3 == 0 && a%3==1)\n {\n c=0;\n d=6;\n }\n if(b%3 == 0 && a%3==2)\n {\n c=3;\n d=6;\n }\n if(b%3 == 0 && a%3==0)\n {\n c=6;\n d=6;\n }\n\n for(i=c;i<c+3;i++)\n {\n for(j=d;j<d+3;j++)\n {\n if(a%3==i && b%3==j)\n if(ttt[i][j]=='.')\n {\n flag=1;\n ttt[i][j]='!';\n }\n }\n }\n if(flag==0)\n {\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n if(ttt[i][j]=='.')\n ttt[i][j]='!';\n }\n }\n }\n}\nint main()\n{\n int a,b;\n int i,j;\n for(i=0;i<9;i++)\n {\n // printf(\"%d\\n\",i);\n for(j=0;j<9;j++)\n {\n scanf(\" %c\",&ttt[i][j]);\n }\n }\n scanf(\"%d %d\",&a,&b);\n //printf(\"1\");\n check(b,a);\n for(i=0;i<9;i++)\n {\n for(j=0;j<9;j++)\n {\n printf(\"%c\",ttt[i][j]);\n if(j%3==2)\n printf(\" \");\n }\n printf(\"\\n\");\n if(i%3==2)\n printf(\"\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,y;\n\tchar s[3][3][3][3];\n\tint i,j,k,pos,flag=0;\n\tfor(i=0;i<3;i++)\n\t\tfor(j=0;j<3;j++)\n\t\t\tfor(k=0;k<3;k++)\n\t\t\t\tscanf(\"%s\" ,s[i][j][k]);\n\tscanf(\"%d %d\",&x,&y);\n\tint x1=(x-1)%3,y1=(y-1)%3;\n\tfor(j=0;j<3;j++)\n\t{\n\t\tfor(pos=0;pos<3;pos++)\n\t\t\tif(s[x1][j][y1][pos]=='.')\n\t\t\t{\n\t\t\t\ts[x1][j][y1][pos]='!';\n\t\t\t\tflag=1;\n\t\t\t}\n\t}\n\tif(!flag)\n\t{\n\t\tprintf(\"hello\\n\");\n\n\t\tfor(i=0;i<3;i++)\n\t\t\tfor(j=0;j<3;j++)\n\t\t\t\tfor(k=0;k<3;k++)\n\t\t\t\t\tfor(pos=0;pos<3;pos++)\n\t\t\t\t\t\tif(s[i][j][k][pos]=='.')\n\t\t\t\t\t\t\ts[i][j][k][pos]='!';\n\t}\n\tfor(i=0;i<3;i++)\n\t{\n\t\tfor(j=0;j<3;j++)\n\t\t{\n\t\t\tfor(k=0;k<3;k++)\n\t\t\t{\n\t\t\t\tfor(pos=0;pos<3;pos++)\n\t\t\t\t\tprintf(\"%c\" ,s[i][j][k][pos]);\n\t\t\t\tprintf(\" \");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "/* Teng K. J. */\n\n#include <stdio.h>\n\n#define N 9\nchar map[N][N];\n\nvoid fill(int i, int j) {\n\tint r = i * 3;\n\tint c = j * 3;\n\tint re = r + 3, ce = c + 3;\n\twhile (r < re) {\n\t\tc = j * 3;\n\t\twhile (c < ce) {\n\t\t\tif (map[r][c] == '.') {\n\t\t\t\tmap[r][c] = '!';\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\tr++;\n\t}\n}\n\nint check(int i, int j) {\n\tint r = i * 3;\n\tint c = j * 3;\n\tint re = r + 3, ce = c + 3;\n\twhile (r < re) {\n\t\twhile (c < ce) {\n\t\t\tif (map[r][c] == '.') {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tc++;\n\t\t}\n\t\tr++;\n\t}\n\treturn 0;\n}\n\t\nint main() {\n\tint i, j, r, c;\n\t\n\tfor (i = 0; i < N; ++i) {\n\t\tfor (j = 0; j < N; ++j) {\n\t\t\tmap[i][j] = getchar();\n\t\t\tif (j % 3 == 2) getchar();\n\t\t}\n\t\tif (i % 3 == 2 && i != 8) getchar();\n\t}\n\tscanf(\"%d%d\", &i, &j);\n\tr = (i - 1) % 3;\n\tc = (j - 1) % 3;\n\t\n\tif (check(r, c)) {\n\t\tfill(r, c);\n\t} else {\n\t\tfor (i = 0; i < 3; ++i) {\n\t\t\tfor (j = 0; j < 3; ++j) {\n\t\t\t\tfill(i, j);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor (i = 0; i < N; ++i) {\n\t\tfor (j = 0; j < N; ++j) {\n\t\t\tputchar(map[i][j]);\n\t\t\tif (j % 3 == 2) putchar(j == 8 ? '\\n' : ' ');\n\t\t}\n\t\tif (i % 3 == 2 && i != 8) putchar('\\n');\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int flag=0;\n char s[20][20];\n for(int i=0;i<11;i++)\n {\n gets(s[i]);\n }\n int x,y;\n scanf(\"%d %d\",&x,&y);\n int x1,y1;\n if(y%3==0)y1=8;\n if(x%3==0)x1=8;\n if(y%3==1)y1=0;\n if(x%3==1)x1=0;\n if(y%3==2)y1=4;\n if(x%3==2)x1=4;\n for(int i=x1;i<=x1+3;i++)\n {\n for(int j=y1;j<=y1+3;j++)\n {\n if(s[i][j]=='.')\n {\n flag=1;\n s[i][j]='!';\n }\n }\n }//printf(\"%d\\n\",flag);\n if(flag==0)\n {\n for(int i=0;i<11;i++)\n {\n for(int j=0;j<11;j++)\n {\n if(s[i][j]=='.')\n s[i][j]='!';\n }\n }\n }\n for(int i=0;i<11;i++)\n printf(\"%s\\n\",s[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(f==1){\n\t for(i=0;i<9;i++){\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t\tif((j+1)%3==0 && j!=8){\n\t\t \t printf(\" \");\n\t\t\t }\n\t\t\t}\n\t\t\tif((i+1)%3==0 && i!=8){\n\t\t \tprintf(\"\\n\");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t }\n\t}\n\telse{\n\t\tfor(i=0;i<9;i++){\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t if(a[i][j]=='.'){\n\t\t\t \ta[i][j]='!';\n\t\t\t\t}\n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t\tif((j+1)%3==0 && j!=8){\n\t\t \t printf(\" \");\n\t\t\t }\n\t\t\t}\n\t\t\tif((i+1)%3==0 && i!=8){\n\t\t \tprintf(\"\\n\");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t }\n\t}\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(f==0){\n\t\tfor(i=0;i<9;i++)\n\t\tfor(j=0;j<9;j++)\n\t\tif(a[i][j]=='.') a[i][j]='!';\n\t}\n\tfor(i=0;i<9;i++){\n\t\tif(i%3==0 && i) printf(\"\\n\");\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t\tif(j%3==0&&j) printf(\" \"); \n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t }\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(f==0){\n\t\tfor(i=0;i<9;i++)\n\t\tfor(j=0;j<9;j++)\n\t\tif(a[i][j]=='.') a[i][j]='!';\n\t}\n\tfor(i=0;i<9;i++){\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t\tif((j+1)%3==0 && j!=8){\n\t\t \t printf(\" \");\n\t\t\t }\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t\tif((i+1)%3==0 && i!=8){\n\t\t \tprintf(\"\\n\");\n\t\t\t}\n\t }\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint clu(int x){\n\tint a;\n\ta=x%3;\n\tif(a==0){\n\t\treturn 6;\n\t}\n\tif(a==1){\n\t\treturn 0;\n\t}\n\tif(a==2){\n\t\treturn 3;\n\t}\n}\nint main(void){\n\tchar a[12][12];\n\tint x,y,i,j,f=0,p,q;\n\tfor(i=0;i<9;i++){\n\t\tscanf(\"%s %s %s\",&a[i][0],&a[i][3],&a[i][6]);\n\t}\n\tscanf(\"%d %d\",&x,&y);\n\tx=clu(x);\n\ty=clu(y);\n\tfor(i=x;i<=x+2;i++){\n\t\tfor(j=y;j<=y+2;j++){\n\t\t\tif(a[i][j]=='.'){\n\t\t\t\ta[i][j]='!';\n\t\t\t\tf=1;\n\t\t\t}\n\t\t}\n\t}\n\tif(f==1){\n\t for(i=0;i<9;i++){\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t\tif((j+1)%3==0 && j!=8){\n\t\t \t printf(\" \");\n\t\t\t }\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t\tif((i+1)%3==0 && i!=8){\n\t\t \tprintf(\"\\n\");\n\t\t\t}\n\t }\n\t}\n\telse{\n\t\tfor(i=0;i<9;i++){\n\t\t\tfor(j=0;j<=9;j++){\n\t\t\t if(a[i][j]=='.'){\n\t\t\t \ta[i][j]='!';\n\t\t\t\t}\n\t\t\t\tprintf(\"%c\",a[i][j]);\n\t\t\t\tif((j+1)%3==0 && j!=8){\n\t\t \t printf(\" \");\n\t\t\t }\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t\tif((i+1)%3==0 && i!=8){\n\t\t \tprintf(\"\\n\");\n\t\t\t}\n\t }\n\t}\n\treturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main()\n{\n char s1[3][12],s2[3][12],s3[3][12],s[3][12];\n int x,y,space=0,i,j,k,row,col,str;\n scanf(\"%[^\\n]\",s1[0]);\n scanf(\" %[^\\n]\",s1[1]);\n scanf(\" %[^\\n]\",s1[2]);\n scanf(\" %[^\\n]\",s2[0]);\n scanf(\" %[^\\n]\",s2[1]);\n scanf(\" %[^\\n]\",s2[2]);\n scanf(\" %[^\\n]\",s3[0]);\n scanf(\" %[^\\n]\",s3[1]);\n scanf(\" %[^\\n]\",s3[2]);\n scanf(\"%d%d\",&x,&y);\n if(x<4)\n row=x;\n else\n {\n if(x%3==0)\n row=3;\n else\n row=x%3;\n }\n if(y<4)\n col=y;\n else\n {\n if(y%3==0)\n col=3;\n else\n col=y%3;\n }\n if(row==1)\n {\n strcpy(s[0],s1[0]);\n strcpy(s[1],s1[1]);\n strcpy(s[2],s1[2]);\n str=1;\n }\n else if(row==2)\n {\n strcpy(s[0],s2[0]);\n strcpy(s[1],s2[1]);\n strcpy(s[2],s2[2]);\n str=2;\n }\n else\n {\n strcpy(s[0],s3[0]);\n strcpy(s[1],s3[1]);\n strcpy(s[2],s3[2]);\n str=3;\n }\n if(col==1)\n {\n k=0;\n }\n else if(col==2)\n {\n k=4;\n }\n else\n {\n k=7;\n }\n for(i=0;i<3;i++)\n {\n for(j=k;j<k+3;j++)\n {\n if(s[i][j]=='.')\n {\n space=1;\n s[i][j]='!';\n }\n }\n }\n if(space==0)\n {\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s1[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s1[i][j]);\n }\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s2[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s2[i][j]);\n }\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n if(s3[i][j]=='.')\n {\n printf(\"!\");\n }\n else\n {\n printf(\"%c\",s3[i][j]);\n }\n }\n printf(\"\\n\");\n }\n }\n else\n {\n if(str==1)\n {\n strcpy(s1[0],s[0]);\n strcpy(s1[1],s[1]);\n strcpy(s1[2],s[2]);\n }\n else if(str==2)\n {\n strcpy(s2[0],s[0]);\n strcpy(s2[1],s[1]);\n strcpy(s2[2],s[2]);\n }\n else\n {\n strcpy(s3[0],s[0]);\n strcpy(s3[1],s[1]);\n strcpy(s3[2],s[2]);\n }\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s1[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s2[i][j]);\n }\n printf(\"\\n\");\n }\n printf(\"\\n\");\n for(i=0;i<3;i++)\n {\n for(j=0;j<11;j++)\n {\n printf(\"%c\",s3[i][j]);\n }\n printf(\"\\n\");\n }\n }\n return 0;\n}\n"}], "src_uid": "8f0fad22f629332868c39969492264d3"} {"nl": {"description": "Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want to take the lift. Floor number b has a secret lab, the entry is forbidden. However, you already are in the mood and decide to make k consecutive trips in the lift.Let us suppose that at the moment you are on the floor number x (initially, you were on floor a). For another trip between floors you choose some floor with number y (y\u2009\u2260\u2009x) and the lift travels to this floor. As you cannot visit floor b with the secret lab, you decided that the distance from the current floor x to the chosen y must be strictly less than the distance from the current floor x to floor b with the secret lab. Formally, it means that the following inequation must fulfill: |x\u2009-\u2009y|\u2009<\u2009|x\u2009-\u2009b|. After the lift successfully transports you to floor y, you write down number y in your notepad.Your task is to find the number of distinct number sequences that you could have written in the notebook as the result of k trips in the lift. As the sought number of trips can be rather large, find the remainder after dividing the number by 1000000007 (109\u2009+\u20097).", "input_spec": "The first line of the input contains four space-separated integers n, a, b, k (2\u2009\u2264\u2009n\u2009\u2264\u20095000, 1\u2009\u2264\u2009k\u2009\u2264\u20095000, 1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n, a\u2009\u2260\u2009b).", "output_spec": "Print a single integer \u2014 the remainder after dividing the sought number of sequences by 1000000007 (109\u2009+\u20097).", "sample_inputs": ["5 2 4 1", "5 2 4 2", "5 3 4 1"], "sample_outputs": ["2", "2", "0"], "notes": "NoteTwo sequences p1,\u2009p2,\u2009...,\u2009pk and q1,\u2009q2,\u2009...,\u2009qk are distinct, if there is such integer j (1\u2009\u2264\u2009j\u2009\u2264\u2009k), that pj\u2009\u2260\u2009qj.Notes to the samples: In the first sample after the first trip you are either on floor 1, or on floor 3, because |1\u2009-\u20092|\u2009<\u2009|2\u2009-\u20094| and |3\u2009-\u20092|\u2009<\u2009|2\u2009-\u20094|. In the second sample there are two possible sequences: (1,\u20092); (1,\u20093). You cannot choose floor 3 for the first trip because in this case no floor can be the floor for the second trip. In the third sample there are no sought sequences, because you cannot choose the floor for the first trip. "}, "positive_code": [{"source_code": "#include <stdio.h>\n\nlong long d[5005][5005];\nlong long bef[5005], aft[5005];\n\nint main(){\n\tint n, a, b, k;\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\td[0][a] = 1;\n\n\tint t, i;\n\tlong long sum = 0;\n\n\tif (a < b) {\n\t\tfor (t = 1; t <= k; t++){\n\t\t\tfor (i = 1; i < b; i++){\n\t\t\t\tbef[i] = bef[i - 1] + d[t - 1][i - 1];\n\t\t\t\tbef[i] %= 1000000007;\n\t\t\t}\n\t\t\tfor (i = b - 1; i >= 1; i--){\n\t\t\t\taft[i] = aft[i + 1] + d[t - 1][i + 1] - ((b - i) % 2 ? 0 : d[t - 1][(i + b) / 2]);\n\t\t\t\taft[i] = (aft[i] + 1000000007) % 1000000007;\n\t\t\t}\n\t\t\tfor (i = 1; i < b; i++){\n\t\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\t\td[t][i] %= 1000000007;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < b; i++){\n\t\t\tsum += d[k][i];\n\t\t\tsum %= 1000000007;\n\t\t}\n\t}\n\telse {\n\t\tfor (t = 1; t <= k; t++){\n\t\t\tfor (i = n; i > b; i--){\n\t\t\t\tbef[i] = bef[i + 1] + d[t - 1][i + 1];\n\t\t\t\tbef[i] %= 1000000007;\n\t\t\t}\n\t\t\tfor (i = b + 1; i <= n; i++){\n\t\t\t\taft[i] = aft[i - 1] + d[t - 1][i - 1] - ((i - b) % 2 ? 0 : d[t - 1][(b + i) / 2]);\n\t\t\t\taft[i] = (aft[i] + 1000000007) % 1000000007;\n\t\t\t}\n\t\t\tfor (i = n; i > b; i--){\n\t\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\t\td[t][i] %= 1000000007;\n\t\t\t}\n\t\t}\n\t\tfor (i = n; i > b; i--){\n\t\t\tsum += d[k][i];\n\t\t\tsum %= 1000000007;\n\t\t}\n\t}\n\tprintf(\"%lld\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long d[5005][5005];\nlong long bef[5005], aft[5005];\n\nint main(){\n\tint n, a, b, k;\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\tint t, i;\n\tlong long sum = 0;\n\n\tif (a > b) {\n\t\ta = n - a + 1;\n\t\tb = n - b + 1;\n\t}\n\n\td[0][a] = 1;\n\n\tfor (t = 1; t <= k; t++){\n\t\tfor (i = 1; i < b; i++){\n\t\t\tbef[i] = bef[i - 1] + d[t - 1][i - 1];\n\t\t\tbef[i] %= 1000000007;\n\t\t}\n\t\tfor (i = b - 1; i >= 1; i--){\n\t\t\taft[i] = aft[i + 1] + d[t - 1][i + 1] - ((b - i) % 2 ? 0 : d[t - 1][(i + b) / 2]);\n\t\t\taft[i] = (aft[i] + 1000000007) % 1000000007;\n\t\t}\n\t\tfor (i = 1; i < b; i++){\n\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\td[t][i] %= 1000000007;\n\t\t}\n\t}\n\tfor (i = 1; i < b; i++){\n\t\tsum += d[k][i];\n\t\tsum %= 1000000007;\n\t}\n\tprintf(\"%lld\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint N,a,b,K;\n// k n\nint dp[5005][5005];\nlong long int p[5005];\n#define max(a,b) ((a) > (b)?(a):(b))\n#define min(a,b) ((a) < (b)?(a):(b))\n#define mod(a) ((a) % 1000000007)\nint main(void)\n{\n\tint count,k,sum,m,n;\n\tscanf(\"%d%d%d%d\",&N,&a,&b,&K);\n\t\n\tfor(count = 0;count <= N;count++)\n\t\tdp[0][count] = 1;\n\tdp[0][b] = 0;\n\tfor(k = 1;k <= K;k++){\n\t\tfor(p[0] = 0,count = 1;count <= N;count++)\n\t\t\tp[count] = p[count - 1] + dp[k - 1][count];\n\t\tif(a < b){\n\t\t\tfor(count = 1;count < b - 1;count++)\n\t\t\t\tdp[k][count] = mod(mod(p[b - 1] - p[count]) + mod(p[count - 1] - p[max(count - (b - count),0)]));\n\t\t}else{\n\t\t\tfor(count = b + 2;count <= N;count++)\n\t\t\t\tdp[k][count] = mod(mod(p[count - 1] - p[b]) + mod(p[min(count - b - 1 + count,N)] - p[count]));\n\t\t}\n\t}\n\tprintf(\"%d\",dp[K][a]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint N,a,b,K;\n// k n\nint dp[2][5005];\nlong long int p[5005];\n#define max(a,b) ((a) > (b)?(a):(b))\n#define min(a,b) ((a) < (b)?(a):(b))\n#define mod(a) ((a) % 1000000007)\nint main(void)\n{\n\tint count,k,sum,m,n;\n\tscanf(\"%d%d%d%d\",&N,&a,&b,&K);\n\t\n\tfor(count = 0;count <= N;count++)\n\t\tdp[0][count] = 1;\n\tdp[0][b] = 0;\n\tfor(k = 1;k <= K;k++){\n\t\tdp[k % 2][b - 1] = 0;\n\t\tdp[k % 2][b + 1] = 0;\n\t\tfor(p[0] = 0,count = 1;count <= N;count++)\n\t\t\tp[count] = p[count - 1] + dp[(k - 1)%2][count];\n\t\tif(a < b){\n\t\t\tfor(count = 1;count < b - 1;count++)\n\t\t\t\tdp[k % 2][count] = mod(mod(p[b - 1] - p[count]) + mod(p[count - 1] - p[max(count - (b - count),0)]));\n\t\t}else{\n\t\t\tfor(count = b + 2;count <= N;count++)\n\t\t\t\tdp[k % 2][count] = mod(mod(p[count - 1] - p[b]) + mod(p[min(count - b - 1 + count,N)] - p[count]));\n\t\t}\n\t}\n\tprintf(\"%d\",dp[K % 2][a]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MOD 1000000007\nint n,m,s;\nlong long f[5010],g[5010];\nint main()\n{\n\tint i,j,t;\n\tscanf(\"%d%d%d%d\",&t,&s,&n,&m);\n\tif(s>n) { s = t-s+1; n = t-n+1;}\n\tif(n-s == 1) { printf(\"0\"); return 0;}\n\tf[s] = 1;\n\tfor(i=s;i<n;i++) g[i] = 1;\n\tfor(i=1;i<=m;i++)\n\t{\n\t\tfor(j=1;j<n;j++) f[j] = (g[(n-j-1)/2+j]-f[j]+MOD)%MOD;\n\t\tfor(j=1;j<n;j++) g[j] = (g[j-1]+f[j])%MOD;\n\t}\n\tprintf(\"%I64d\",g[n-1]);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a,b,k,prev[5001],cur[5001],i,j,dist,count[5001],c1,h,ans,c2;\nlong long int start[5001],end[5001],sum[5001];\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&k);\nfor(i=1;i<=n;i++)\n prev[i]=0;\nprev[a]=1;\nfor(i=1;i<=5000;i++)\n count[i]=0;\nsum[0]=0;\nfor(i=1;i<=n;i++)\n{c2=0;\nstart[i]=1;\nend[i]=0;\n for(j=1;j<=n;j++)\n {c1=b-j;\nif(c1<0)\n c1=-c1;\n dist=j-i;\n if(dist<0)\n dist=-dist;\n if(i!=j&&dist<c1)\n {\n if(c2==0)\n {\n c2++;\n start[i]=j;\n\n }\n end[i]=j;\n }\n }\n}\n/*\nfor(i=1;i<=n;i++)\n{\n printf(\"%lld %lld\\n\",start[i],end[i];\n}\n*/\nfor(h=1;h<=k;h++)\n{\n for(i=1;i<=n;i++)\n{\n sum[i]=(sum[i-1]+prev[i])%1000000007;\n}\n for(i=1;i<=n;i++)\n{\n cur[i]=0;\n\n cur[i]=(sum[end[i]]-sum[start[i]-1]+1000000007)%1000000007;\n if(start[i]<i&&end[i]>i)\n cur[i]=(cur[i]-prev[i]+1000000007)%1000000007;\n //printf(\"%lld %lld start%lld end%lld\\n\",i,cur[i],start[i],end[i]);\n\n}\nfor(i=1;i<=n;i++)\n prev[i]=cur[i];\n}\nans=0;\nfor(i=1;i<=n;i++)\n ans=(ans+cur[i])%1000000007;\nprintf(\"%lld\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <limits.h>\n#include <stdlib.h>\n\n#define MAX_N (5000)\n#define MAX_K (5000)\n#define MOD (1000000007)\n\nint dp[MAX_K+1][MAX_N+1];\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint min(int x, int y) { return x < y ? x : y; }\n\nint range(int r, int i, int j) {\n int ret = dp[r][j] - dp[r][i-1];\n\n while ( ret < 0 )\n ret += MOD;\n return ret;\n}\n\nint build_dp(int n, int a, int b, int k) {\n int i,j,prev;\n\n for ( j=1; j <= n; ++j )\n if ( j != b )\n dp[0][j] = dp[0][j-1] + 1;\n for ( i=1; i <= k; ++i ) {\n for ( j=1,prev=0; j <= n; ++j ) {\n if ( j != b )\n dp[i][j] = ((range(i-1, max(1, j-abs(j-b)+1), j-1) +\n range(i-1, j+1, min(n, j+abs(j-b)-1))) % MOD + prev) % MOD;\n prev = dp[i][j];\n }\n }\n return range(k, a, a);\n}\n\nint main() {\n int n,a,b,k;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n printf(\"%d\\n\", build_dp(n, a, b, k));\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n#define MAX_N (5000)\n#define MAX_K (5000)\n#define MOD (1000000007)\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint min(int x, int y) { return x < y ? x : y; }\n\nint dp[MAX_K+1][MAX_N+2];\n\nint build_dp(int n, int a, int b, int k) {\n int fq[MAX_N+1];\n int i,j,acc;\n\n dp[0][a] = 1, dp[0][a+1] = -1;\n for ( i=0; i < k; ++i ) {\n for ( j=1; j <= n; ++j )\n fq[j] = (fq[j-1] + dp[i][j]) % MOD;\n for ( j=1; j <= n; ++j ) {\n dp[i+1][max(1, j-abs(j-b)+1)] += fq[j];\n dp[i+1][max(1, j-abs(j-b)+1)] %= MOD;\n dp[i+1][j] -= fq[j];\n while ( dp[i+1][j] < 0 )\n dp[i+1][j] += MOD;\n dp[i+1][j+1] += fq[j];\n dp[i+1][j+1] %= MOD;\n dp[i+1][min(n+1, j+abs(j-b))] -= fq[j];\n while ( dp[i+1][min(n+1, j+abs(j-b))] < 0 )\n dp[i+1][min(n+1, j+abs(j-b))] += MOD;\n }\n }\n for ( j=1,acc=0; j <= n; ++j ) {\n fq[j] = (fq[j-1] + dp[i][j]) % MOD;\n acc = (acc + fq[j]) % MOD;\n }\n return acc;\n}\n\nint main() {\n int n,a,b,k;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n printf(\"%d\\n\", build_dp(n, a, b, k));\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint mem [5010][5010];\nint N, b, a, K;\nint MOD = 1000000007;\n\nint min(int a, int b)\t{\n\treturn\ta < b ? a : b;\n}\nint max(int a, int b)\t{\n\treturn\ta > b ? a : b;\n}\n\nint solve(int id, int restan)\t{\n\tif\t( restan == 0 )\n\t\treturn\t1;\n\t\n\tif\t( mem[id][restan] != -1 )\n\t\treturn\tmem[id][restan];\n\t\n\tint dist = abs(b - id);\n\tint ans = 0;\n\tint y;\n\tfor (y = max(1, id - dist + 1); y <= min(N, id + dist - 1); y++)\t{\n\t\tif\t( y != b && y != id )\t{\n\t\t\tans += solve(y, restan - 1);\n\t\t\tif\t( ans >= MOD )\n\t\t\t\tans -= MOD;\n\t\t}\n\t}\n\treturn\tmem[id][restan] = ans;\n}\n\nint sum(int a, int b, int k)\t{\n\tint ans = mem[b][k];\n\tans -= mem[a - 1][k];\n\tif\t( ans < 0 )\n\t\tans += MOD;\n\treturn\tans;\n}\n\n\nint main(int argc, char *argv[])\t{\n\tscanf(\"%d %d %d %d\", &N, &a, &b, &K);\n\t\n\tint i, j, id, k, dist, x, y, ans;\n\t\n\t\n\tfor (i = 0; i <= N; i++)\t{\n\t\tfor (j = 0; j <= K; j++)\t{\n\t\t\tmem[i][j] = -1;\n\t\t}\n\t}\n\t\n\t\n\tfor (id = 1; id <= N; id++)\n\t\tmem[id][0] = 1;\n\tmem[b][0] = 0;\n\tfor (id = 1; id <= N; id++)\t{\n\t\tmem[id][0] += mem[id - 1][0];\n\t\tif\t( mem[id][0] >= MOD )\n\t\t\tmem[id][0] -= MOD;\n\t}\n\t\n\tfor (k = 1; k <= K; k++)\t{\n\t\tfor (id = 1; id <= N; id++)\t{\n\t\t\tdist = abs(id - b);\n\t\t\tx = max( 1, id - dist + 1 );\n\t\t\ty = min( N, id + dist - 1 );\n\t\t\t\n\t\t\tans = sum(x, y, k - 1);\n\t\t\t\n\t\t\tans -= sum(b, b, k - 1);\n\t\t\tif\t( ans < 0 )\n\t\t\t\tans += MOD;\n\t\t\t\n\t\t\tans -= sum(id, id, k - 1);\n\t\t\t\n\t\t\tif\t( ans < 0 )\n\t\t\t\tans += MOD;\n\t\t\t\n\t\t\tmem[id][k] = ans;\n\t\t}\n\t\t\n\t\tfor (id = 1; id <= N; id++)\t{\n\t\t\tmem[id][k] += mem[id - 1][k];\n\t\t\tif\t( mem[id][k] >= MOD )\n\t\t\t\tmem[id][k] -= MOD;\n\t\t}\n\t}\n\t/*\n\tfor (i = 1; i <= N; i++)\t{\n\t\tfor (j = 0; j <= K; j++)\t{\n\t\t\tprintf( \"mem(%d, %d) = %d\\n\", i, j, sum(i, i, j) );\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\t*/\n\tprintf( \"%d\\n\", sum(a, a, K) );\n\t\n return 0;\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint n,a,b,k;\n\nlong long int table[5001][5001];\nlong long int S[5001];\nlong long int ans;\n\nint main(){\n\n\tint i,j;\n\n\tscanf(\"%d %d %d %d\",&n,&a,&b,&k);\n\n\ttable[a][0]=1;\n\n\tfor(i=0;i<k;i++){\n\t\tS[1]=table[1][i];\n\t\tfor(j=1;j<n;j++)\n\t\t\tS[j+1]=S[j]+table[j+1][i];\n\t\tif(b<a){\n\t\t\tfor(j=b+1;j<n+1;j++)\n\t\t\t\ttable[j][i+1]=(S[n]-S[j]+S[j-1]-S[(b+j)/2+((b+j)%2==0&&b+1>j+2?1:0)])%1000000007;\n\t\t}else{\n\t\t\tfor(j=1;j<b;j++)\n\t\t\t\ttable[j][i+1]=(S[j-1]+S[(b+j)/2+((b+j)%2==0?-1:0)]-S[j])%1000000007;\n\t\t}\n\t}\n\n\tfor(j=1;j<n+1;j++){\n\t\tans+=table[j][i];\n\t\tans=ans%1000000007;\n\t}\n\n\tprintf(\"%I64d\\n\",ans);\n\n\treturn 0;\n\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n#include <string.h>\n\n#define N\t5000\n#define MD\t1000000007\n\nint main() {\n\tstatic int dp[N], dq[N];\n\tint n, a, b, k, i, ans;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &k), a--, b--;\n\tif (a < b) {\n\t\tn = b + 1;\n\t\ta = b - a;\n\t} else {\n\t\tn -= b;\n\t\ta -= b;\n\t}\n\tdp[a] = 1;\n\twhile (k--) {\n\t\tmemset(dq, 0, n * sizeof *dq);\n\t\tfor (i = 2; i < n; i++) {\n\t\t\tint x = dp[i];\n\n\t\t\tif (x) {\n\t\t\t\tdq[1] = (dq[1] + x) % MD;\n\t\t\t\tdq[i] = (dq[i] - x) % MD;\n\t\t\t\tif (i + 1 < n)\n\t\t\t\t\tdq[i + 1] = (dq[i + 1] + x) % MD;\n\t\t\t\tif (i + i < n)\n\t\t\t\t\tdq[i + i] = (dq[i + i] - x) % MD;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < n; i++)\n\t\t\tdp[i] = (dq[i] + dp[i - 1]) % MD;\n\t}\n\tans = 0;\n\tfor (i = 1; i < n; i++)\n\t\tans = (ans + dp[i]) % MD;\n\tif (ans < 0)\n\t\tans += MD;\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MOD 1000000007\n\nint dp[5001][5001];\n\nint main(void) {\n int i, j;\n int n, a, b, k;\n int ans;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n dp[0][a] = 1;\n for (i = 1; i <= k; i++) {\n int sum[5001];\n\n sum[0] = 0;\n for (j = 1; j <= n; j++)\n sum[j] = (sum[j - 1] + dp[i - 1][j]) % MOD;\n\n for (j = 1; j <= n; j++)\n if (j < b)\n dp[i][j] = (sum[(j + b - 1) / 2] - dp[i - 1][j] + MOD) % MOD;\n else if (j > b)\n dp[i][j] = ((sum[n] - sum[(j + b) / 2] + MOD) % MOD - dp[i - 1][j] + MOD) % MOD;\n }\n\n ans = 0;\n for (j = 1; j <= n; j++)\n ans = (ans + dp[k][j]) % MOD;\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MOD 1000000007\n\nint dp[5001][5001];\n\nint main(void) {\n\tint i, j;\n\tint n, a, b, k;\n\tint ans;\n\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\tdp[0][a] = 1;\n\tfor (i = 1; i <= k; i++) {\n\t\tint sum[5001];\n\n\t\tsum[0] = 0;\n\t\tfor (j = 1; j <= n; j++) {\n\t\t\tsum[j] = sum[j - 1] + dp[i - 1][j];\n\t\t\tif (sum[j] >= MOD)\n\t\t\t\tsum[j] -= MOD;\n\t\t}\n\n\t\tfor (j = 1; j <= n; j++)\n\t\t\tif (j < b) {\n\t\t\t\tdp[i][j] = sum[(j + b - 1) / 2] - dp[i - 1][j] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t\tdp[i][j] -= MOD;\n\t\t\t} else if (j > b) {\n\t\t\t\tdp[i][j] = sum[n] - sum[(j + b) / 2] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t\tdp[i][j] -= MOD;\n\t\t\t\tdp[i][j] += -dp[i - 1][j] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t\tdp[i][j] -= MOD;\n\t\t\t}\n\t}\n\n\tans = 0;\n\tfor (j = 1; j <= n; j++) {\n\t\tans += dp[k][j];\n\t\tif (ans >= MOD)\n\t\t\tans -= MOD;\n\t}\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MOD 1000000007\n\nint dp[5001][5001];\n\nint main(void) {\n\tint i, j;\n\tint n, a, b, k;\n\tint ans;\n\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\tdp[0][a] = 1;\n\tfor (i = 1; i <= k; i++) {\n\t\tint sum[5001];\n\n\t\tsum[0] = 0;\n\t\tfor (j = 1; j <= n; j++) {\n\t\t\tsum[j] = sum[j - 1] + dp[i - 1][j];\n\t\t\tif (sum[j] >= MOD)\n\t\t\t\tsum[j] -= MOD;\n\t\t}\n\n\t\tfor (j = 1; j <= n; j++)\n\t\t\tif (j < b) {\n\t\t\t\tdp[i][j] = sum[(j + b - 1) / 2] - dp[i - 1][j] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t \tdp[i][j] -= MOD;\n\t\t\t} else if (j > b) {\n\t\t\t\tdp[i][j] = sum[n] - sum[(j + b) / 2] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t\tdp[i][j] -= MOD;\n\t\t\t\tdp[i][j] += -dp[i - 1][j] + MOD;\n\t\t\t\tif (dp[i][j] >= MOD)\n\t\t\t\t\tdp[i][j] -= MOD;\n\t\t\t}\n\t}\n\n\tans = 0;\n\tfor (j = 1; j <= n; j++)\n\t\tans = (ans + dp[k][j]) % MOD;\n\n\tprintf(\"%d\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint max(int a , int b){\n\tif(a >b)\n\t\treturn a ;\n\treturn b ;\n}\nint min(int a, int b){\n\tif(a < b)\n\t\treturn a ;\n\treturn b ;\n}\n\nlong long dpp[5002][5002];\nint n , a , b , k ;\n\n#define MOD 1000000007\n\nvoid build(long long arr[] , long long rmq []){\n\tint i ;\n\tfor(i = 1 ; i <= n ; i++){\n\t\trmq[i] = arr[i];\n\t\trmq[i] += rmq[i - 1];\n\t\trmq[i] %= MOD ;\n\t}\n\t//cout << endl ;\n}\n\nlong long query(long long rmq [] , int to){\n\treturn rmq[to];\n}\n\nint main(){\n\tscanf(\"%d%d%d%d\" , & n , &a , &b , &k);\n\tint i ;\n\tfor(i = 1 ; i <= n ; i ++){\n\t\tdpp[0][i] = 1 ;\n\t}\n\tdpp[0][b] = 0 ;\n\tfor(i = 1 ; i <= k ; i++){\n\t\t// cout << i << \" : \" << endl ;\n\t\tlong long rmq [10003] ={0};\n\t\tbuild(dpp[i-1] , rmq);\n\t\tint j ;\n\t\tfor(j = 1 ; j <= n; j++){\n\t\t\tif(j == b)\n\t\t\t\tcontinue ;\n\t\t\tint diff = abs(b - j) - 1;\n\t\t\tdpp[i][j] = query(rmq , min(n , j + diff));\n\t\t\tdpp[i][j] -= query(rmq , max(1 , j - diff) -1 );\n\t\t\tdpp[i][j] -= dpp[i-1][j];\n\t\t\tdpp[i][j] %= MOD ;\n\t\t\tdpp[i][j] += MOD ;\n\t\t\tdpp[i][j] %= MOD ;\n\t\t}\n\t\t// cout << i << \" : => \" << endl ;\n\t\t// for(int j = 1 ; j <= n ; j++){\n\t\t// \tcout << dpp[i][j] << \" \";\n\t\t// }\n\t\t//cout << endl ;\n\t}\n\tprintf(\"%d\" , dpp[k][a]);\n\treturn 0 ;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint d[5005][5005];\nint bef[5005], aft[5005];\n\nint main(){\n\tint n, a, b, k;\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\td[0][a] = 1;\n\n\tint t, i;\n\tlong long sum = 0;\n\n\tif (a > b) {\n\t\tt = a;\n\t\ta = n - b + 1;\n\t\tb = n - t + 1;\n\t}\n\tfor (t = 1; t <= k; t++){\n\t\tfor (i = 1; i < b; i++){\n\t\t\tbef[i] = bef[i - 1] + d[t - 1][i - 1];\n\t\t\tbef[i] %= 1000000007;\n\t\t}\n\t\tfor (i = b - 1; i >= 1; i--){\n\t\t\taft[i] = aft[i + 1] + d[t - 1][i + 1] - ((b - i) % 2 ? 0 : d[t - 1][(i + b) / 2]);\n\t\t\taft[i] = (aft[i] + 1000000007) % 1000000007;\n\t\t}\n\t\tfor (i = 1; i < b; i++){\n\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\td[t][i] %= 1000000007;\n\t\t}\n\t}\n\tfor (i = 1; i < b; i++){\n\t\tsum += d[k][i];\n\t\tsum %= 1000000007;\n\t}\n\tprintf(\"%d\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long d[5005][5005];\nlong long bef[5005], aft[5005];\n\nint main(){\n\tint n, a, b, k;\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\td[0][a] = 1;\n\n\tint t, i;\n\tlong long sum = 0;\n\n\tif (a < b) {\n\t\tfor (t = 1; t <= k; t++){\n\t\t\tfor (i = 1; i < b; i++){\n\t\t\t\tbef[i] = bef[i - 1] + d[t - 1][i - 1];\n\t\t\t\tbef[i] %= 1000000007ll;\n\t\t\t}\n\t\t\tfor (i = b - 1; i >= 1; i--){\n\t\t\t\taft[i] = aft[i + 1] + d[t - 1][i + 1] - ((b - i) % 2 ? 0 : d[t - 1][i + (b - i) / 2]);\n\t\t\t\taft[i] %= 1000000007ll;\n\t\t\t}\n\t\t\tfor (i = 1; i < b; i++){\n\t\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\t\td[t][i] %= 1000000007ll;\n\t\t\t}\n\t\t}\n\t\tfor (i = 1; i < b; i++){\n\t\t\tsum += d[k][i];\n\t\t\tsum %= 1000000007ll;\n\t\t}\n\t}\n\telse {\n\t\tfor (t = 1; t <= k; t++){\n\t\t\tfor (i = n; i > b; i--){\n\t\t\t\tbef[i] = bef[i + 1] + d[t - 1][i + 1];\n\t\t\t\tbef[i] %= 1000000007ll;\n\t\t\t}\n\t\t\tfor (i = b + 1; i <= n; i++){\n\t\t\t\taft[i] = aft[i - 1] + d[t - 1][i - 1] - ((i - b) % 2 ? 0 : d[t - 1][i - (i - b) / 2]);\n\t\t\t\taft[i] %= 1000000007ll;\n\t\t\t}\n\t\t\tfor (i = n; i > b; i--){\n\t\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\t\td[t][i] %= 1000000007ll;\n\t\t\t}\n\t\t}\n\t\tfor (i = n; i > b; i--){\n\t\t\tsum += d[k][i];\n\t\t\tsum %= 1000000007ll;\n\t\t}\n\t}\n\tprintf(\"%lld\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long d[5005][5005];\nlong long bef[5005], aft[5005];\n\nint main(){\n\tint n, a, b, k;\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n\td[0][a] = 1;\n\n\tint t, i;\n\tlong long sum = 0;\n\n\tif (a > b) {\n\t\tt = a;\n\t\ta = n - b + 1;\n\t\tb = n - t + 1;\n\t}\n\tfor (t = 1; t <= k; t++){\n\t\tfor (i = 1; i < b; i++){\n\t\t\tbef[i] = bef[i - 1] + d[t - 1][i - 1];\n\t\t\tbef[i] %= 1000000007;\n\t\t}\n\t\tfor (i = b - 1; i >= 1; i--){\n\t\t\taft[i] = aft[i + 1] + d[t - 1][i + 1] - ((b - i) % 2 ? 0 : d[t - 1][(i + b) / 2]);\n\t\t\taft[i] = (aft[i] + 1000000007) % 1000000007;\n\t\t}\n\t\tfor (i = 1; i < b; i++){\n\t\t\td[t][i] = bef[i] + aft[i];\n\t\t\td[t][i] %= 1000000007;\n\t\t}\n\t}\n\tfor (i = 1; i < b; i++){\n\t\tsum += d[k][i];\n\t\tsum %= 1000000007;\n\t}\n\tprintf(\"%lld\", sum);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint N,a,b,K;\n// k n\nint dp[5005][5005];\nint p[5005];\n#define max(a,b) ((a) > (b)?(a):(b))\n#define min(a,b) ((a) < (b)?(a):(b))\n#define mod(a) ((a) % 1000000007)\nint main(void)\n{\n\tint count,k,sum,m,n;\n\tscanf(\"%d%d%d%d\",&N,&a,&b,&K);\n\t\n\tfor(count = 0;count <= N;count++)\n\t\tdp[0][count] = 1;\n\tdp[0][b] = 0;\n\tfor(k = 1;k <= K;k++){\n\t\tfor(p[0] = 0,count = 1;count <= N;count++)\n\t\t\tp[count] = mod(p[count - 1] + dp[k - 1][count]);\n\t\tif(a < b){\n\t\t\tfor(count = 1;count < b - 1;count++)\n\t\t\t\tdp[k][count] = mod(p[b - 1] - p[count]) + mod(p[count - 1] - p[max(count - (b - count),0)]);\n\t\t}else{\n\t\t\tfor(count = b + 2;count <= N;count++)\n\t\t\t\tdp[k][count] = mod(p[count - 1] - p[b]) + mod(p[min(count - b - 1 + count,N)] - p[count]);\n\t\t}\n\t}\n\tprintf(\"%d\",dp[K][a]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint N,a,b,K;\n// k n\nint dp[5005][5005];\nint p[5005];\n#define max(a,b) ((a) > (b)?(a):(b))\n#define min(a,b) ((a) < (b)?(a):(b))\nint main(void)\n{\n\tint count,k,sum,m,n;\n\tscanf(\"%d%d%d%d\",&N,&a,&b,&K);\n\t\n\tfor(count = 0;count <= N;count++)\n\t\tdp[0][count] = 1;\n\tdp[0][b] = 0;\n\tfor(k = 1;k <= K;k++){\n\t\tfor(p[0] = 0,count = 1;count <= N;count++)\n\t\t\tp[count] = p[count - 1] + dp[k - 1][count];\n\t\tif(a < b){\n\t\t\tfor(count = 1;count < b - 1;count++)\n\t\t\t\tdp[k][count] = p[b - 1] - p[count] + p[count - 1] - p[max(count - (b - count),0)];\n\t\t}else{\n\t\t\tfor(count = b + 2;count <= N;count++)\n\t\t\t\tdp[k][count] = p[count - 1] - p[b] + p[min(count - b - 1 + count,N)] - p[count];\n\t\t}\n\t}\n\tprintf(\"%d\",dp[K][a]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a,b,k,prev[5001],cur[5001],i,j,dist,count[5001],c1,h,ans,c2;\nlong long int start[5001],end[5001],sum[5001];\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&k);\nfor(i=1;i<=n;i++)\n prev[i]=0;\nprev[a]=1;\nfor(i=1;i<=5000;i++)\n count[i]=0;\nsum[0]=0;\nfor(i=1;i<=n;i++)\n{c2=0;\n for(j=1;j<=n;j++)\n {c1=b-j;\nif(c1<0)\n c1=-c1;\n dist=j-i;\n if(dist<0)\n dist=-dist;\n if(i!=j&&dist<c1)\n {\n if(c2=0)\n {\n c2++;\n start[i]=j;\n\n }\n end[i]=j;\n }\n }\n}\nfor(h=1;h<=k;h++)\n{\n for(i=1;i<=n;i++)\n{\n sum[i]=(sum[i-1]+prev[i])%1000000007;\n}\n for(i=1;i<=n;i++)\n{\n cur[i]=0;\n\n cur[i]=(sum[start[i]]+sum[end[i]])%1000000007;\n if(start[i]<i&&end[i]>i)\n cur[i]=(cur[i]-prev[i]+1000000007)%1000000007;\n\n\n}\nfor(i=1;i<=n;i++)\n prev[i]=cur[i];\n}\nans=0;\nfor(i=1;i<=n;i++)\n ans=(ans+cur[i])%1000000007;\nprintf(\"%lld\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a,b,k,prev[5001],cur[5001],i,j,dist,count[5001],c1,h,ans,c2;\nlong long int start[5001],end[5001],sum[5001];\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&k);\nfor(i=1;i<=n;i++)\n prev[i]=0;\nprev[a]=1;\nfor(i=1;i<=5000;i++)\n count[i]=0;\nsum[0]=0;\nfor(i=1;i<=n;i++)\n{c2=0;\nstart[i]=1;\nend[i]=0;\n for(j=1;j<=n;j++)\n {c1=b-j;\nif(c1<0)\n c1=-c1;\n dist=j-i;\n if(dist<0)\n dist=-dist;\n if(i!=j&&dist<c1)\n {\n if(c2==0)\n {\n c2++;\n start[i]=j;\n\n }\n end[i]=j;\n }\n }\n}\n/*\nfor(i=1;i<=n;i++)\n{\n printf(\"%lld %lld\\n\",start[i],end[i];\n}\n*/\nfor(h=1;h<=k;h++)\n{\n for(i=1;i<=n;i++)\n{\n sum[i]=(sum[i-1]+prev[i])%1000000007;\n}\n for(i=1;i<=n;i++)\n{\n cur[i]=0;\n\n cur[i]=(sum[end[i]]-sum[start[i]-1])%1000000007;\n if(start[i]<i&&end[i]>i)\n cur[i]=(cur[i]-prev[i]+1000000007)%1000000007;\n //printf(\"%lld %lld start%lld end%lld\\n\",i,cur[i],start[i],end[i]);\n\n}\nfor(i=1;i<=n;i++)\n prev[i]=cur[i];\n}\nans=0;\nfor(i=1;i<=n;i++)\n ans=(ans+cur[i])%1000000007;\nprintf(\"%lld\\n\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n#define MAX_N (5000)\n#define MAX_K (5000)\n#define MOD (1000000007)\n\nint n,b;\nint memo[MAX_N+1][MAX_K+1];\n\nint min(int x, int y) { return x < y ? x : y; }\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint f(int x, int t) {\n int i,acc=0;\n\n if ( !t )\n return 1;\n if ( (x-b)*(x-b) == 1 )\n return 0;\n if ( memo[x][t] )\n return memo[x][t];\n for ( i=max(1, x-abs(x-b)-1); i < min(n, x+abs(x-b)); ++i ) {\n if ( i == x ) continue;\n acc = (acc + f(i, t-1)) % MOD;\n }\n return memo[x][t] = acc;\n}\n\nint main() {\n int a,k;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n printf(\"%d\\n\", f(a, k));\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n#define MAX_N (5000)\n#define MAX_K (5000)\n#define MOD (1000000007)\n\nint max(int x, int y) { return x > y ? x : y; }\n\nint min(int x, int y) { return x < y ? x : y; }\n\nint dp[MAX_K+1][MAX_N+2];\n\nint build_dp(int n, int a, int b, int k) {\n int fq[MAX_N+1];\n int i,j,acc;\n\n dp[0][a] = 1, dp[0][a+1] = -1;\n for ( i=0; i < k; ++i ) {\n for ( j=1; j <= n; ++j )\n fq[j] = (fq[j-1] + dp[i][j]) % MOD;\n for ( j=1; j <= n; ++j ) {\n dp[i+1][max(1, j-abs(j-b)+1)] += fq[j];\n dp[i+1][max(1, j-abs(j-b)+1)] %= MOD;\n dp[i+1][j] -= fq[j];\n dp[i+1][j] %= MOD;\n dp[i+1][j+1] += fq[j];\n dp[i+1][j+1] %= MOD;\n dp[i+1][min(n+1, j+abs(j-b))] -= fq[j];\n dp[i+1][min(n+1, j+abs(j-b))] %= MOD;\n }\n }\n for ( j=1,acc=0; j <= n; ++j ) {\n fq[j] = (fq[j-1] + dp[i][j]) % MOD;\n acc = (acc + fq[j]) % MOD;\n }\n return acc;\n}\n\nint main() {\n int n,a,b,k;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n printf(\"%d\\n\", build_dp(n, a, b, k));\n return EXIT_SUCCESS;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint n,a,b,k;\n\nlong long int table[5001][5001];\nlong long int S[5001];\nlong long int ans;\n\nint main(){\n\n\tint i,j;\n\n\tscanf(\"%d %d %d %d\",&n,&a,&b,&k);\n\n\ttable[a][0]=1;\n\n\tfor(i=0;i<k;i++){\n\t\tS[1]=table[1][i];\n\t\tfor(j=1;j<n;j++)\n\t\t\tS[j+1]=S[j]+table[j+1][i];\n\t\tif(b<a){\n\t\t\tfor(j=b+1;j<n+1;j++)\n\t\t\t\ttable[j][i+1]=(S[n]-S[j]+S[j-1]-S[(b+j)/2+((b+j)%2==0?1:0)])%1000000007;\n\t\t}else{\n\t\t\tfor(j=1;j<b;j++)\n\t\t\t\ttable[j][i+1]=(S[j-1]+S[(b+j)/2+((b+j)%2==0?-1:0)]-S[j])%1000000007;\n\t\t}\n\t\tmemset(S,0,sizeof(S));\n\t}\n\n\tfor(j=1;j<n+1;j++){\n\t\tans+=table[j][i];\n\t}\n\n\tprintf(\"%I64d\\n\",ans);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint n,a,b,k;\n\nlong long int table[5001][5001];\nlong long int S[5001];\nlong long int ans;\n\nint main(){\n\n\tint i,j;\n\n\tscanf(\"%d %d %d %d\",&n,&a,&b,&k);\n\n\ttable[a][0]=1;\n\n\tfor(i=0;i<k;i++){\n\t\tS[1]=table[1][i];\n\t\tfor(j=1;j<n;j++)\n\t\t\tS[j+1]=S[j]+table[j+1][i];\n\t\tif(b<a){\n\t\t\tfor(j=b+1;j<n+1;j++)\n\t\t\t\ttable[j][i+1]=(S[n]-S[j]+S[j-1]-S[(b+j)/2+((b+j)%2==0?1:0)])%1000000007;\n\t\t}else{\n\t\t\tfor(j=1;j<b;j++)\n\t\t\t\ttable[j][i+1]=(S[j-1]+S[(b+j)/2+((b+j)%2==0?-1:0)]-S[j])%1000000007;\n\t\t}\n\t\tmemset(S,0,sizeof(S));\n\t}\n\n\tfor(j=1;j<n+1;j++){\n\t\tans+=table[j][i];\n\t\tans=ans%1000000007;\n\t}\n\n\tprintf(\"%I64d\\n\",ans);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint n,a,b,k;\n\nlong long int table[5001][5001];\nlong long int S[5001];\nlong long int ans;\n\nint main(){\n\n\tint i,j;\n\n\tscanf(\"%d %d %d %d\",&n,&a,&b,&k);\n\n\ttable[0][a]=1;\n\n\tfor(i=0;i<k;i++){\n\t\tS[1]=table[i][1];\n\t\tfor(j=1;j<n;j++)\n\t\t\tS[j+1]=S[j]+table[i][j+1];\n\t\tif(b<a)\n\t\t\tfor(j=b+1;j<n+1;j++)\n\t\t\t\ttable[j][i+1]=(S[n]-S[j]+S[j-1]-S[(b+j)/2+((b+j)%2==0?1:0)])%1000000007;\n\t\telse\n\t\t\tfor(j=1;j<b;j++)\n\t\t\t\ttable[j][i+1]=(S[j-1]+S[(b+j)/2+((b+j)%2==0?-1:0)]-S[j])%1000000007;\n\t\tmemset(S,0,sizeof(S));\n\t}\n\n\tfor(j=1;j<n+1;j++){\n\t\tans+=table[j][i];\n\t}\n\n\tprintf(\"%I64d\\n\",ans);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MOD 1000000007\n\nint dp[5001][5001];\n\nint main(void) {\n int i, j;\n int n, a, b, k;\n int ans;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n dp[0][a] = 1;\n for (i = 1; i <= k; i++) {\n int sum[5001];\n\n sum[0] = 0;\n for (j = 1; j <= n; j++)\n sum[j] = (sum[j - 1] + dp[i - 1][j]) % MOD;\n\n for (j = 1; j <= n; j++)\n if (j < b)\n dp[i][j] = (sum[(j + b - 1) / 2] - dp[i - 1][j] + MOD) % MOD;\n else if (j > b)\n dp[i][j] = ((sum[n] - sum[(j + b) / 2] + MOD) % MOD - dp[i - 1][j] + MOD) % MOD;\n }\n\n ans = 0;\n for (j = 1; j <= n; j++)\n ans += dp[k][j];\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MOD 1000000007\n\nint dp[5001][5001];\n\nint main(void) {\n int i, j;\n int n, a, b, k;\n int ans;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &k);\n\n dp[0][a] = 1;\n for (i = 1; i <= k; i++) {\n int sum[5001];\n\n sum[0] = 0;\n for (j = 1; j <= n; j++)\n sum[j] = (sum[j - 1] + dp[i - 1][j]) % MOD;\n\n for (j = 1; j <= n; j++)\n dp[i][j] = ((j < b ? sum[(j + b - 1) / 2] : (sum[n] - sum[(j + b) / 2] + MOD) % MOD) - dp[i - 1][j] + MOD) % MOD;\n }\n\n ans = 0;\n for (j = 1; j <= n; j++)\n ans += dp[k][j];\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}], "src_uid": "142b06ed43b3473513995de995e19fc3"} {"nl": {"description": "Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies.At first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds ai candies in a box, that is given by the Many-Faced God. Every day she can give Bran at most 8 of her candies. If she don't give him the candies at the same day, they are saved for her and she can give them to him later.Your task is to find the minimum number of days Arya needs to give Bran k candies before the end of the n-th day. Formally, you need to output the minimum day index to the end of which k candies will be given out (the days are indexed from 1 to n).Print -1 if she can't give him k candies during n given days.", "input_spec": "The first line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009k\u2009\u2264\u200910000). The second line contains n integers a1,\u2009a2,\u2009a3,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).", "output_spec": "If it is impossible for Arya to give Bran k candies within n days, print -1. Otherwise print a single integer\u00a0\u2014 the minimum number of days Arya needs to give Bran k candies before the end of the n-th day.", "sample_inputs": ["2 3\n1 2", "3 17\n10 10 10", "1 9\n10"], "sample_outputs": ["2", "3", "-1"], "notes": "NoteIn the first sample, Arya can give Bran 3 candies in 2 days.In the second sample, Arya can give Bran 17 candies in 3 days, because she can give him at most 8 candies per day.In the third sample, Arya can't give Bran 9 candies, because she can give him at most 8 candies per day and she must give him the candies within 1 day."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main() {\n int n,x[100],k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[i]);\n }\n int s=0,count=1;\n for(i=0;i<n;i++){\n if(x[i]<=8) s=s+x[i];\n else{\n s=s+8;\n x[i+1]=x[i+1]+x[i]-8;\n }\n if(s>=k) {\n printf(\"%d\",count);\n return 0;\n }\n count++;\n }\n printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d%d\", &a, &b);\n int sum = 0;\n int sum2 = 0;\n int i;\n for ( i = 0; i < a; i++)\n {\n int k;\n scanf(\"%d\", &k);\n if (k >= 8)\n {\n sum2 += k - 8;\n sum += 8;\n }\n else\n {\n if (sum2 > (8-k))\n {\n sum2 -= 8-k;\n sum += 8;\n }\n else\n {\n sum +=sum2 + k;\n sum2 = 0;\n }\n }\n //printf(\"sum = %d sum2 = %d\\n\",sum,sum2);\n if ( sum >= b)\n {\n sum =0;\n break;\n }\n }\n if (sum != 0 )\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\",++i);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,k,i,s=0;\n scanf(\"%d%d\",&n,&k);\n int x[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n for(i=0;i<n;i++)\n {\n if(x[i]>8)\n {\n s=s+8;\n x[i+1]=x[i+1]+x[i]-8;\n }\n else\n {\n s=s+x[i];\n }\n if(s>=k)\n {\n printf(\"%d\\n\",i+1);\n exit(0);\n }\n }\n printf(\"-1\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int a=0,b=0,i,x;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&x);\n a+=x;\n if(a>7)\n {\n b+=8;\n a-=8;\n }\n else\n {\n b+=a;\n a=0;\n }\n if(b>=k)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int arr[105], n, k, i, sum = 0, sum1 = 0;\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n for(i = 0; i < n; i++)\n {\n sum1 = sum1 + arr[i];\n if(sum1 > 8)\n {\n sum = sum + 8;\n sum1 = sum1 - 8;\n }\n else\n {\n sum = sum + sum1;\n sum1 = sum1 - sum1;\n }\n if(sum >= k)\n {\n printf(\"%d\\n\", (i + 1));\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,k,left=0,count=0,flag=0,h=0;\n int a[1010];\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;;i++){\n if(a[i]<=8){\n h=h+a[i];\n count++;\n }\n else {\n a[i+1]+=(a[i]-8);\n h=h+8;\n count++;\n }\n if(h>=k)break;\n }\n if(count<=n)printf(\"%d\\n\",count);\n else printf(\"-1\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, k, candy, days=0, i, ans=0, temp=0, remain=0;\n scanf(\"%d%d\", &n, &k);\n for(i=0; i<n; i++){\n scanf(\"%d\", &candy);\n candy+=remain;\n if(candy<=8){\n ans+=candy;\n remain = 0;\n }\n else{\n remain = candy-8;\n ans+=8;\n }\n days++;\n if(ans>=k){\n temp=1;\n break;\n }\n }\n if(k==0) days = 0;\n if(temp) printf(\"%d\\n\", days);\n else printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n ,k ,sum=0 ,b ,i;\n\tscanf(\"%d%d\" ,&n ,&k);\n\tint a[n];\n\tfor(i=0;i<n;i++) scanf(\"%d\" ,&a[i]);\n\tfor(i=0;i<n;i++){\n\t\tif(a[i]>=8){\n\t\t\tsum+=8;\n\t\t\tb=a[i]-8;\n\t\t\tif(i!=n-1) a[i+1]+=b;\n\t\t}\n\t\tif(a[i]<8)\n\t\t sum+=a[i];\n\t\tif(sum>=k) {\n\t\t\tprintf(\"%d\" ,i+1);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif(sum<k) printf(\"-1\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,a[100],t=0,c=-1;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n t=t+a[i];\n if(t>8){k=k-8;t=t-8;}\n else{ k=k-t;t=0;}\n if(k<=0){\n c=i+1;\n break;\n }\n }\n if(n*8<k)printf(\"%d\\n\",-1);\n else {\n printf(\"%d\\n\",c);\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint floor(float x)\n{\n int floor;\n if(x>=0) floor = (int)x;\n else {\n floor = (int)x;\n if(x - (float)floor ) floor--;\n }\n\n return floor;\n}\n\nint ceil(float x)\n{\n int ceil;\n if(x>=0) {\n ceil = (int)x;\n if(x - (float)ceil) ceil++;\n\n }\n else ceil = (int)x;\n\n return ceil;\n\n}\n\nint round(float x)\n{\n int round;\n if(x<0) x -= .5;\n else x += .5;\n round = (int)x;\n\n return round;\n}\n\nint main()\n{\n int i, j, n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n for(i=0; i<n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n int given = 0, remain = 0;\n i = 0;\n\n while(given<k && i<n) {\n\n// remain = 0;\n// for(j=0; j<i; ++j) remain += a[j];\n if(a[i]<8) {\n if(remain+a[i]-8 >= 0) {\n given += 8;\n remain -= 8 - a[i];\n// a[i] = 0;\n }\n else if(remain+a[i]-8 < 0) {\n given += remain+a[i];\n remain = 0;\n// a[i] = 0;\n }\n }\n else if(a[i]>8) {\n given += 8;\n remain += a[i]-8;\n }\n else {\n given += a[i];\n// a[i] = 0;\n }\n// printf(\"%d %d %d\\n\", a[i], given, remain);\n i++;\n\n }\n if(given<k) printf(\"-1\");\n else printf(\"%d\", i);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint SoNgay, SoKeoCho, Keo, SoKeoDu = 0;\n\tscanf(\"%d\", &SoNgay);\n\tscanf(\"%d\", &SoKeoCho);\n\tint i;\n\tfor ( i = 1; i <= SoNgay; i++)\n\t{\n\t\tscanf(\"%d\", &Keo);\n\t\tSoKeoDu = SoKeoDu + Keo;\n\t\tif (SoKeoDu > 8)\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - 8;\n\t\t\tSoKeoDu = SoKeoDu - 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - SoKeoDu;\n\t\t\tSoKeoDu = 0;\n\t\t}\n\t\tif (SoKeoCho <= 0)\n\t\t\tbreak;\n\t}\n\tif (SoKeoCho <= 0)\n\t{\n\t\tprintf(\"%d\", i);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n\n\nint main() {\n\tint n, k;\n\twhile(scanf(\"%d %d\", &n, &k)==2) {\n\t\tint s=0, g=0, i;\n\t\tfor(i=0; i<n && g<k; i++) {\n\t\t\tint x;\n\t\t\tscanf(\"%d\", &x);\n\t\t\ts += x;\n\t\t\tif (s>=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g<k) printf(\"%d\\n\", -1);\n\t\telse printf(\"%d\\n\", i);\n\t\tbreak;\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,s,g=0,t=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&s);\n\t\tt+=s;\n\t\tif(t<=8) {k-=t;t=0;} \n\t\telse {t-=8; k-=8;}\n\t\tg++;\n\t\tif(k<=0) break;\n\t\t\n\n\t}\n\tif(k>0) printf(\"%d\\n\", -1);\n\telse printf(\"%d\\n\", g);\n\treturn 0;\n}"}, {"source_code": "//http://codeforces.com/contest/839/problem/A\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define False 0\n#define True 1\n// int small(char ch)\n// int capital(char ch);\n// int prime(int number);\n// void bubble_sort(int arr[], int n);\n//void upper(char *ptr);\n//void lower(char *ptr);\n// void sort(char *ptr, int n);\n// void RemoveDuplicates(char * arr, char * new_str, int arr_size);\n// int Contains(char * arr, char elem, int arr_size);\n// int Times_of_shapes(char * str, int len);\n\n\n\nint main(void)\n{\n\n int days, order, result=0, i;\n scanf(\"%d %d\", &days, &order);\n int arr[days];\n for(i=0;i<days;i++)\n {\n \tscanf(\"%d\", &arr[i]);\n }\n for(i=0;i<days;i++)\n {\n \tif(arr[i]>=8)\n \t{\n \t\torder-=8;\n \t\tarr[i+1]+=(arr[i]-8);\n \t\tresult++;\n \t}\n \telse\n \t{\n \t\torder-=arr[i];\n \t\tresult++;\n\n \t}\n \tif(order<=0)\n \t{\n \t\tbreak;\n \t}\n }\n if(order<=0)\n {\n \tprintf(\"%d\\n\", result);\n }\n else\n \tprintf(\"-1\\n\");\n\treturn 0;\n}\n\n// int Times_of_shapes(char * str, int len)\n// {\n\n// \tint j, i, times=0, result=0;\n// \tstr[len]='\\0';\n// \tchar temp[len][len+1];\n// \tfor(i=0;i<=len;i++)\n// \t{\n// \t\ttemp[0][i]=str[i];\n// \t}\n// \tfor(i=1;i<len;i++)\n// \t{\n// \t\ttemp[i][0]=temp[i-1][len-1];\n// \t\tfor(j=1;j<len;j++)\n// \t\t{\n// \t\t\ttemp[i][j]=temp[i-1][j-1];\n// \t\t}\n// \t\ttemp[i][len]='\\0';\n// \t}\n\n// \tfor(i=0;i<len;i++)\n// \t{\n// \t\ttimes=0;\n// \t\tfor(j=i+1;j<len;j++)\n// \t\t{\n// \t\t\tif(strcmp(temp[i], temp[j])==False)\n// \t\t\t{\n// \t\t\t\ttimes++;\n// \t\t\t}\n// \t\t}\n// \t\tif(times==False)\n// \t\t{\n// \t\t\tresult++;\n// \t\t}\n// \t}\n// \treturn result;\n\n// }\n\n\n\n// int Contains(char * arr, char elem, int arr_size)\n// {\n\n// int index = 0;\n\n// for(index = 0; index < arr_size; index++)\n// {\n\n// if(arr[index] == elem)\n// {\n// return True;\n// }\n// }\n\n// return False;\n\n// }\n\n// void RemoveDuplicates(char * arr, char * new_str, int arr_size)\n// {\n\n// int index = 0, new_index = 0;\n\n// //clear temp string\n// for(index = 0; index < arr_size; index++)\n// {\n// new_str[index] = 0;\n// }\n\n// for(index = 0; index < arr_size; index++)\n// {\n\n// if(Contains(new_str, arr[index], arr_size) == False)\n// {\n// new_str[new_index] = arr[index];\n// new_index++;\n// }\n// if(index==arr_size-1)\n// {\n// new_str[new_index]='\\0';\n// }\n// }\n\n// }\n\n// void sort(char *ptr, int n)\n// {\n// \tint i, j, temp;\n// \tfor(i=0;i<n-1;i++)\n// \t{\n// \t\tfor(j=0;j<n-i-1;j++)\n// \t\t{\n// \t\t\tif(ptr[j]>ptr[j+1])\n// \t\t\t\t{\n// \t\t\t\t\ttemp=ptr[j];\n// \t\t\t\t\tptr[j]=ptr[j+1];\n// \t\t\t\t\tptr[j+1]=temp;\n// \t\t\t\t}\n\n// \t\t}\n// \t}\n\n// }\n\n\n\n\n\n\n/*\nvoid upper(char *ptr)\n{\n\tint i=0;\n\twhile(ptr[i]!='\\0')\n\t{\n\t\tif(ptr[i]>='a'&&ptr[i]<='z')\n\t\t\tptr[i]-=32;\n\t\ti++;\n\t}\n\n}*/\n\n/*\nvoid lower(char *ptr)\n{\n\tint i=0;\n\twhile(ptr[i]!='\\0')\n\t{\n\t\tif(ptr[i]>='A'&&ptr[i]<='Z')\n\t\t\tptr[i]+=32;\n\t\ti++;\n\t}\n}*/\n\n\n// void bubble_sort(int ptr[], int n)\n// {\n// \tint i, j, temp;\n// \tfor(i=0;i<n-1;i++)\n// \t{\n// \t\tfor(j=0;j<n-i-1;j++)\n// \t\t{\n// \t\t\tif(ptr[j]>ptr[j+1])\n// \t\t\t\t{\n// \t\t\t\t\ttemp=ptr[j];\n// \t\t\t\t\tptr[j]=ptr[j+1];\n// \t\t\t\t\tptr[j+1]=temp;\n// \t\t\t\t}\n\n// \t\t}\n// \t}\n\n// }\n\n// int capital(char ch)\n// {\n// \tint flag=0;\n// \tif(ch>=65&&ch<=90)\n// \t\tflag=1;\n// \treturn flag;\n\n// }\n\n// int small(char ch)\n// {\n// \tint flag=0;\n// \tif(ch>='a'&&ch<='z')\n// \t\tflag=1;\n// \treturn flag;\n\n// }\n// int prime(int number)\n// {\n// \tint flag=1, i;\n// \tfor(i=2;i<=number/2;i++)\n// \t{\n// \t\tif(number%i==0)\n// \t\t{\n// \t\t\tflag=0;\n// \t\t\tbreak;\n// \t\t}\n// \t}\n// \tif(number<=1)\n// \t\tflag=1;\n// \treturn flag;\n// }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n\n\nint main() {\n\tint n, k;\n\twhile(scanf(\"%d %d\", &n, &k)==2) {\n\t\tint s=0, g=0, i;\n\t\tfor(i=0; i<n && g<k; i++) {\n\t\t\tint x;\n\t\t\tscanf(\"%d\", &x);\n\t\t\ts += x;\n\t\t\tif (s>=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g<k) printf(\"%d\\n\", -1);\n\t\telse printf(\"%d\\n\", i);\n\t\tbreak;\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n int n=0;\n\tint\tk=0;\n\tint last=0;\n\tint sum=0;\n\tint i;\n\tint a[20000];\n\n\n\n\tscanf(\"%d %d \",&n,&k);\n\tfor (i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif (a[i]+last>=8)\n\t\t{\n\t\t\tsum+=8;\n last=last+a[i]-8;\n\t\t}\n\t\telse if (a[i]+last<8)\n\t\t{\n\t\t\t sum=sum+last+a[i];\n last=0; \n\t\t}\n\t\tif (sum >= k) \n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t \n\tprintf(\"-1\");\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, k, i, c = 0, d = 0, f, l = 0, s = 0, a[100];\n scanf(\"%d%d\", &n, &k);\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n\n for(i = 0; i < n; i++){\n if(a[i] <= 8){\n s = s + a[i];\n f = 8 - a[i];\n if(l >= f){\n s = s + f;\n l = l - f;\n }\n else{\n s = s + l;\n l = 0;\n }\n }\n else{\n s = s + 8;\n l = l + (a[i] - 8);\n }\n c++;\n if(s >= k){\n printf(\"%d\", c);\n d = 1;\n break;\n }\n }\n if(d == 0){\n printf(\"-1\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n,k,*a,i,count=0;\n\tscanf(\"%d%d\",&n,&k);\n\ta = (int *)malloc(sizeof(int)*n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\ti = 0;\n\twhile((k>0)&&(i<n))\n\t{\n\t\tif(a[i]<=8)\n\t\t\tk = k-a[i];\n\t\telse\n\t\t{\n\t\t\tk = k-8;\n\t\t\ta[i+1] = a[i+1]+(a[i]-8);\n\t\t}\n\t\t//printf(\"%d\\n\",k);\n\t\tcount++;\n\t\ti++;\n\t\t\n\t\t\n\t}\n\tif(k<=0)\n\t\tprintf(\"%d\\n\",count);\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "/*\n * A. Arya and Bran\n * time limit per test\n * 1 second\n * memory limit per test\n * 256 megabytes\n * input\n * standard input\n * output\n * standard output\n *\n * Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies.\n *\n * At first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds ai candies in a box, that is given by the Many-Faced God. Every day she can give Bran at most 8 of her candies. If she don't give him the candies at the same day, they are saved for her and she can give them to him later.\n *\n * Your task is to find the minimum number of days Arya needs to give Bran k candies before the end of the n-th day. Formally, you need to output the minimum day index to the end of which k candies will be given out (the days are indexed from 1 to n).\n *\n * Print -1 if she can't give him k candies during n given days.\n * Input\n *\n * The first line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009k\u2009\u2264\u200910000).\n *\n * The second line contains n integers a1,\u2009a2,\u2009a3,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009100).\n * Output\n *\n * If it is impossible for Arya to give Bran k candies within n days, print -1.\n *\n * Otherwise print a single integer \u2014 the minimum number of days Arya needs to give Bran k candies before the end of the n-th day.\n * Examples\n * Input\n *\n * 2 3\n * 1 2\n *\n * Output\n *\n * 2\n *\n * Input\n *\n * 3 17\n * 10 10 10\n *\n * Output\n *\n * 3\n *\n * Input\n *\n * 1 9\n * 10\n *\n * Output\n *\n * -1\n *\n * Note\n *\n * In the first sample, Arya can give Bran 3 candies in 2 days.\n *\n * In the second sample, Arya can give Bran 17 candies in 3 days, because she can give him at most 8 candies per day.\n *\n * In the third sample, Arya can't give Bran 9 candies, because she can give him at most 8 candies per day and she must give him the candies within 1 day.\n */\n\n#include <stdio.h>\nint main() {\n int i, n, k, num, a_candy, b_candy;\n scanf(\"%d %d\", &n, &k);\n for(i = 0, a_candy = b_candy = 0; i < n && b_candy < k; i++) {\n scanf(\"%d\", &num);\n a_candy += num;\n if(a_candy >= 8) {\n a_candy -= 8;\n b_candy += 8;\n } else {\n b_candy += a_candy;\n a_candy = 0;\n }\n }\n if(i == n && b_candy < k)\n printf(\"-1\");\n else\n printf(\"%d\", i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, k;\n\tscanf(\"%d %d\", &n, &k);\n\n\tint give = 0, save = 0, a;\n\tfor (int i = 1; i <= n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tif (a > 8) {\n\t\t\tsave += (a - 8);\n\t\t\tgive += 8;\n\t\t} else {\n\t\t\tgive += a;\n\t\t\tif (save < (8 - a))\t{\n\t\t\t\tgive += save;\n\t\t\t\tsave = 0;\n\t\t\t} else {\n\t\t\t\tgive += (8 - a);\n\t\t\t\tsave -= 8 - a;\n\t\t\t}\n\t\t}\n\n\t\tif (give >= k)\n\t\t{\n\t\t\tprintf(\"%d\", i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tprintf(\"-1\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,c=0,t=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n&&t<k;i++){\n if(a[i]>8){\n t=t+8;\n a[i+1]=a[i+1]+a[i]-8;\n }\n else\n t=t+a[i];\n }\nif(k>t)\n printf(\"-1\");\nelse\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#include <string.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n int a[n];\n\tfor(int i=0;i<n;i=i+1){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tif(k>n*8){\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tint count=0;\n\tfor(int i=0;i<n-1;i=i+1){\n\t\tif(a[i]<=8&&k>0){\n\t\t\tk=k-a[i];\n \t\tcount+=1;\n\t\t}else if(a[i]>8&&k>0){\n\t\t\tk=k-8;\n\t\t\ta[i+1]+=a[i]-8;\n \t\tcount+=1;\n\t\t}\n\t}\n\tif(a[n-1]>8){\n\t\ta[n-1]=8;\n\t}\n\tif(k>0){\n\t\tk=k-a[n-1];\n\t\tcount+=1;\n\t}\n\tif(k<=0){\n\t\tprintf(\"%d\",count);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nmain ()\n\t {\n\t int ans=0,n,k,a[101],sum=0,i;\n\t scanf(\"%d %d\",&n,&k);\n\t for (i=0;i<n;i++)\t\n\t \t scanf(\"%d\",&a[i]);\n\t for (i=0;i<n;i++)\n\t \t {\n\t \t sum+=a[i];\n\t \t if (sum>=8)\n\t\t \t {ans+=8;sum=sum-8;}\n\t \t else {ans+=sum;sum=0;}\n\t\t \n\t\t if (k<=ans) {printf (\"%d\",i+1);return 0;}\n\t\t }\t\n\t printf(\"-1\");\t\n\t return 0;\t\n\t }"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],i,given_candies=0,stored_candies=0,count_days=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(j<n && given_candies<k)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tstored_candies=stored_candies+a[j]-8;\n\t\t\tgiven_candies=given_candies+8;\n\t\t\tcount_days++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(stored_candies>8-a[j])\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+8;\n\t\t\t\tstored_candies=stored_candies-(8-a[j]);\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+a[j]+stored_candies;\n\t\t\t\tstored_candies=0;\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t}\n\t\tj++;\n\n\t}\n\n\tif(given_candies<k)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count_days);\n\n}"}, {"source_code": "#include<stdio.h>\n#define N 100\nint main(){\n int n,k;\n int a[N];\n scanf(\"%d%d\",&n,&k);\n int i;\n int give=0;\n int receive=0;\n int day=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n give+=a[i];\n if(receive>=k){\n break;\n }else{\n if(give>=8){\n receive+=8;\n give-=8;\n }else{\n receive+=give;\n give=0;\n }\n day++;\n }\n }\n if(receive<k){\n printf(\"%d\\n\",-1);\n }else{\n printf(\"%d\\n\",day);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 100\nint main(){\n int n,k;\n int a[N];\n scanf(\"%d%d\",&n,&k);\n int i;\n int give=0;\n int receive=0;\n int day=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n give+=a[i];\n if(receive>=k){\n break;\n }else{\n if(give>=8){\n receive+=8;\n give-=8;\n }else{\n receive+=give;\n give=0;\n }\n day++;\n }\n }\n if(receive<k){\n printf(\"%d\\n\",-1);\n }else{\n printf(\"%d\\n\",day);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int N,K,Count,Day=0,Total=0;\n scanf(\"%d%d\",&N,&K);\n int Array[N];\n for(Count=0;Count<N;Count++)\n scanf(\"%d\",&Array[Count]);\n for(Count=0;Count<N;Count++)\n {\n if(K<=0)\n break;\n if(Array[Count]>8)\n {\n K-=8;\n Total+=(Array[Count]-8);\n }\n else\n {\n K-=Array[Count];\n if(Total>=(8-Array[Count]))\n {\n K-=(8-Array[Count]);\n Total-=(8-Array[Count]);\n }\n else\n {\n K-=Total;\n Total=0;\n }\n }\n Day++;\n }\n if(K<=0)\n printf(\"%d\\n\",Day);\n else\n printf(\"%d\\n\",-1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k,i,a[1000];\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint sum=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(sum<k&&a[i]<8)\n\t\t{\n\t\t\tsum+=a[i];\n\t\t}\n\t\telse if(sum<k&&a[i]>=8)\n\t\t{\n\t\t\tsum+=8;\n\t\t\ta[i+1]+=a[i]-8; \n\t\t}\n\t\tif(sum>=k)\n\t\t\tbreak;\t\n\t}\n\tif(i==n)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\",++i);\n\treturn 0;\n} \n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n, k, a[100], i, c = 0, d = 0, flag = 0, index;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tif (a[i] > 8) {\n\t\t\tc += 8;\n\t\t\td += (a[i] - 8);\n\t\t}\n\t\telse {\n\t\t\tif (a[i] + d <= 8) {\n\t\t\t\tc += (d + a[i]);\n\t\t\t\td = 0;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tc += 8;\n\t\t\t\td -= (8 - a[i]);\n\t\t\t}\n\t\t}\n\t\tif (c >= k) {\n\t\t\tflag = 1;\n\t\t\tindex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (flag == 1) {\n\t\tprintf(\"%d\", (index + 1));\n\t}\n\telse {\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nmain()\n{\n int n, k, i, j;\n scanf(\"%d %d\", &n, &k);\n int sum = 0, cnt = 0;\n int a[n];\n\n for(i = 0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum += a[i];\n if(sum>=8)\n {\n cnt += 8;\n sum = sum - 8;\n }\n else\n {\n cnt += sum;\n sum = 0;\n }\n\n if(cnt>=k)\n {\n printf(\"%d\", i+1);\n return 0;\n }\n }\n\n printf(\"-1\");\n\n\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k,i,s=0,ans=-1;\n scanf(\"%i%i\",&n,&k);\n for(i=0;i<n;i++){\n int x;\n scanf(\"%i\",&x);\n \n if (x>=8){\n s+=x-8;\n k-=8;\n }\n else{\n if(s+x>=8){\n k-= 8;\n s -= 8-x;\n }\n else{\n k-=x+s;\n s=0;\n }\n }\n if(ans==-1 && k<=0)\n ans = i+1;\n }\n printf(\"%i\",ans);\n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,a,i=0,j,x=0;\n scanf(\"%d%d\",&n,&k);\n while(n--)\n {\n scanf(\"%d\",&a);\n x=x+a;\n if(x<=8)\n {\n k=k-x;\n x=0;}\n else if(x>8)\n {\n k=k-8;\n x=x-8;\n }\n i++;\n if(k<=0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint n,k,num=0,t,tmp=0,f=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=0;i<n;i++){\n\t\tscanf(\"%d\",&t);\n\t\tt+=tmp;\n\t\ttmp=0;\n\t\tif(t>8){\n\t\t\tnum+=8;\n\t\t\ttmp=t-8;\n\t\t\tf++;\n\t\t\tif(num>=k)\n\t\t\tbreak; \n\t\t}\n\t\telse{\t\n\t\tnum+=t;\n\t\tf++;\n\t\tif(num>=k)\n\t\tbreak;\n }\n\t}\n\tif(num<k){\n\t\tprintf(\"-1\");\n\t}\t\t\t\n\telse{\n\t\tprintf(\"%d\",f);\n\t\t}\n\t\t}"}, {"source_code": "#include <stdio.h>\nmain ()\n\t {\n\t int ans=0,n,k,a[101],sum=0,i;\n\t scanf(\"%d %d\",&n,&k);\n\t for (i=0;i<n;i++)\t\n\t \t scanf(\"%d\",&a[i]);\n\t for (i=0;i<n;i++)\n\t \t {\n\t \t sum+=a[i];\n\t \t if (sum>=8)\n\t\t \t {ans+=8;sum=sum-8;}\n\t \t else {ans+=sum;sum=0;}\n\t\t \n\t\t if (k<=ans) {printf (\"%d\",i+1);return 0;}\n\t\t }\t\n\t printf(\"-1\");\t\n\t return 0;\t\n\t }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100],i,j,n,m,count=0,sum=0,b,k,l=0;\n scanf(\"%d %d\",&n,&m);\n k=m;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n a[i]=a[i]+l;\n if(a[i]==m&&a[i]==8)\n {\n count=count+1;\n b=8;\n // printf(\"%d %d\\n\",count,b);\n }\n else if(a[i]>=8)\n {\n count=count+1;\n b=8;\n l=a[i]-8;\n // printf(\"d=%d %d\\n\",count,b);\n }\n else\n {\n m=m-a[i];\n count=count+1;\n b=a[i];\n l=0;\n // printf(\"e=%d %d\\n\",count,b);\n }\n\n sum=sum+b;\n if(sum>=k)\n {\n break;\n }\n }\n //printf(\"%d\",sum);\n if(count==0||sum<k)\n {\n printf(\"-1\");\n }\n else{\n printf(\"%d\\n\",count);}\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,giv=0;\n scanf(\"%d %d\",&n,&k);\n int a[n+1];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n a[n]=0;\n for(i=0;i<n;i++)\n {\n if(a[i]<8)\n giv+=a[i];\n else {\n giv+=8;\n a[i+1]+=a[i]-8;\n }\n if(giv>=k)\n break;\n }\n if(i==n)\n printf(\"-1\");\n else printf(\"%d\",i+1);\n return 0; \n \n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,x[100],k;\n scanf(\"%d %d\",&n,&k);\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[i]);\n }\n int s=0,count=1;\n for(i=0;i<n;i++){\n if(x[i]<=8) s=s+x[i];\n else{\n s=s+8;\n x[i+1]=x[i+1]+x[i]-8;\n }\n if(s>=k) {\n printf(\"%d\",count);\n return 0;\n }\n count++;\n }\n printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int i, n, k, a[100], bram = 0;\n\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i < n; i++)\n {\n if(a[i] < 8)\n bram += a[i];\n else\n {\n bram += 8;\n if(i < n)\n a[i+1] += a[i] - 8;\n }\n\n if(bram >= k)\n break;\n }\n\n (i < n)? printf(\"%d\\n\", i+1) : printf(\"%d\\n\", -1);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],i,given_candies=0,stored_candies=0,count_days=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(j<n && given_candies<k)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tstored_candies=stored_candies+a[j]-8;\n\t\t\tgiven_candies=given_candies+8;\n\t\t\tcount_days++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(stored_candies>8-a[j])\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+8;\n\t\t\t\tstored_candies=stored_candies-(8-a[j]);\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+a[j]+stored_candies;\n\t\t\t\tstored_candies=0;\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t}\n\t\tj++;\n\n\t}\n\n\tif(given_candies<k)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count_days);\n\n}"}, {"source_code": "#include <stdio.h>\n#define MIN(x, y) ((x) < (y)? (x): (y))\n\nint main()\n{\n int n, k, box = 0, day;\n scanf(\"%d%d\", &n, &k);\n for (day = 1; day <= n; day++) {\n int a;\n scanf(\"%d\", &a); \n box += a;\n int give = MIN(8, box);\n box -= give;\n k -= give;\n if (k <= 0) break;\n }\n printf(\"%d\\n\", (k > 0)? -1: day);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n , k , a , i=0 , j = 0 ;\n\tscanf(\"%d\", &n) ;\n\tscanf(\"%d\", &k) ;\n\twhile (i < n && k > 0 ) {\n scanf(\"%d\", &a) ;\n a = a + j ;\n j = 0 ;\n if ( a > 8 ) {\n k = k - 8 ;\n j = a - 8 ;\n }\n else {\n k = k - a ;\n }\n ++i ;\n\t}\n\tif ( k <= 0 ) printf(\"%d\", i) ;\n\telse printf(\"%d\", -1) ;\nreturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int N,K,Count,Day=0,Total=0;\n scanf(\"%d%d\",&N,&K);\n int Array[N];\n for(Count=0;Count<N;Count++)\n scanf(\"%d\",&Array[Count]);\n for(Count=0;Count<N;Count++)\n {\n if(K<=0)\n break;\n if(Array[Count]>8)\n {\n K-=8;\n Total+=(Array[Count]-8);\n }\n else\n {\n K-=Array[Count];\n if(Total>=(8-Array[Count]))\n {\n K-=(8-Array[Count]);\n Total-=(8-Array[Count]);\n }\n else\n {\n K-=Total;\n Total=0;\n }\n }\n Day++;\n }\n if(K<=0)\n printf(\"%d\\n\",Day);\n else\n printf(\"%d\\n\",-1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,i,a=0,b=0,c=0,d=0;\n scanf(\"%d %d\",&n,&k);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n while(a<k)\n {\n if(ar[i]==8)\n {\n a+=ar[i];\n b+=1;\n break;\n }\n else if(ar[i]<8)\n {\n if(ar[i]+c>=8)\n {\n a+=8;\n c=c-(8-ar[i]);\n b+=1;\n break;\n }\n else\n {\n a+=(ar[i]+c);\n c=0;\n b+=1;\n break;\n }\n }\n else\n {\n a+=8;\n c+=ar[i]-8;\n b+=1;\n break;\n }\n }\n }\n if(a<k)\n printf(\"-1\");\n else\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint cmp(const void *a,const void *b)\n{\n\treturn *(int *)a-*(int *)b;\n}\n\nint main()\n{\n\tint i,n,k,a[1005],sum=0,temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\n\t}\t\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]>=8)\n\t\t{\n\t\t\tsum+=8;\n\t\t\ttemp+=(a[i]-8);\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp+=a[i];\n\t\t\tif(temp>=8)\n\t\t\t{\n\t\t\t\ttemp-=8;\n\t\t\t\tsum+=8;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum+=temp;\n\t\t\t\ttemp=0;\n\t\t\t}\n\t\t}\n\t\tif(sum>=k)\n\t\t\tbreak;\n\t}\n\tif(sum>=k)\n\t{\n\t\tprintf(\"%d\\n\",i+1);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\n\n\t\n\t\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int num,k,i;\n scanf(\"%d%d\",&num,&k);\n int ara[num],sum=0;\n for(i=0;i<num;i++)\n {\n scanf(\"%d\",&ara[i]);\n sum=sum+ara[i];\n }\n if(sum<k) printf(\"-1\\n\");\n else if(num*8<k) printf(\"-1\\n\");\n else\n {\n for(i=1;i<=num;i++)\n {\n if(ara[i-1]<=8) k=k-ara[i-1];\n else if(ara[i-1]>8)\n {\n k=k-8;\n ara[i]+=ara[i-1]-8;\n }\n if(k<=0)\n break;\n }\n if(i>num) printf(\"-1\\n\");\n else printf(\"%d\\n\",i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,i,count=0,l=0,m,mul=0,save=0;\nscanf(\"%d\",&n);\nint arr[n];\nscanf(\"%d\",&k);\nm=k;\nfor (i=0 ;i<n ;i++)\n{\n scanf(\"%d\",&arr[i]);\n mul +=arr[i];\n }\n for (i=0 ; i<n ; i++)\n {\n\nif(n*8<k || k>mul)\n{\nprintf(\"-1\\n\");\nbreak;\n}\nelse\n {\nif(arr[i]>8 && m>8)\n{\nm= m-8;\ncount +=8;\nsave =arr[i]-8;\narr[i+1] +=save;\nl++;\n}\nelse\n{\nif(arr[i]>m)\n{\ncount +=m;\nl++;\n}\nelse\n{\n if(m>arr[i]){\nm= m-arr[i];\ncount +=arr[i];\nl++;}\nelse\n{\n count +=m;\n l++;\n}\n}\n}}\nif(m==0 || count==k)\n{\nprintf(\"%d\\n\",l);\nl = 0;\nbreak;\n}\n}\nif (l!=0)\n printf(\"-1\");\n\nreturn 0;\n }\n"}, {"source_code": "#include <stdio.h>\nint min(int a, int b) { if(a > b) return b; return a; }\nint main()\n{\n int n, k;\n scanf(\"%d%d\", &n, &k);\n int d[n];\n for(int i = 0; i < n; i++)\n scanf(\"%d\", &d[i]);\n int lend = 0, addition = 0;\n for(int i = 0; i < n; i++)\n {\n int x = min(8, d[i]);\n if(x < 8)\n {\n lend += 8-x;\n int v = min(8-x, addition);\n x += v;\n addition -= v;\n lend -= v;\n }\n else\n addition += d[i]-8;\n k -= x;\n if(k <= 0)\n return 0*printf(\"%d\\n\", i+1);\n }\n puts(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],candies_given=0,store=0,i,count=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(candies_given<k && j<n)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tcandies_given=candies_given+8;\n\t\t\tstore=store+a[j]-8;\n\t\t\tj++;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta[j]=a[j]+store;\n\t\t\tif(a[j]>8)\n\t\t\t{\n\t\t\t\tcandies_given=candies_given+8;\n\t\t\t\tstore=a[j]-8;\n\t\t\t\tj++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcandies_given=candies_given+a[j];\n\t\t\t\tj++;\n\t\t\t\tstore=0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t}\n\t} \n\n\tif(candies_given<k && j==n)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j=0,k,m=0,n;\n\n scanf(\"%d %d\",&n,&k);\n\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n a[i+1]+=a[i]-8;\n\n a[i]=8;\n }\n m+=a[i];\n\n j++;\n\n if(m>=k)\n {\n printf(\"%d\\n\",j);\n\n break;\n }\n }\n if(m<k)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,i,sum,c,remain,flag;\n scanf(\"%d %d\",&n,&k);\n int x[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&x[i]);\n }\n flag=0;\n sum=0;\n c=0;\n for(i=0; i<n; i++)\n {\n if(x[i]<=8)\n {\n sum=sum+x[i];\n c++;\n if(sum>=k)\n {\n flag=1;\n break;\n }\n else\n {\n flag=0;\n }\n }\n else if(x[i]>8)\n {\n c++;\n sum=sum+8;\n remain=x[i]-8;\n if(sum>=k)\n {\n flag=1;\n break;\n }\n else if(sum<k)\n {\n flag=0;\n }\n if(i+1<n && flag==0)\n {\n x[i+1]=x[i+1]+remain;\n }\n }\n }\n if(flag==1)\n {\n printf(\"%d\",c);\n }\n else if(flag==0)\n {\n printf(\"-1\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(){\n\tint n,k,c=0,c1;\n\tscanf (\"%d%d\", &n,&k);\n\t\n\tfor (int i=1;i<=n;i++){\n\t\tscanf (\"%d\", &c1);\n\t\tc +=c1;\n\t\tif (c >=8){\n\t\tk = k-8;\n\t\tc-=8;\n\t\t}\n\t\telse{ k-=c; c =0;}\n\t\t\n\t\t\n\t\tif (k<=0){\n\t\t\tprintf (\"%d\", i);\n\t\tbreak;\n\t\t}\n\t\t\t\n\t}\n\tif (k>0)\n\t\tprintf (\"-1\");\n\t\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],i,given_candies=0,stored_candies=0,count_days=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(j<n && given_candies<k)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tstored_candies=stored_candies+a[j]-8;\n\t\t\tgiven_candies=given_candies+8;\n\t\t\tcount_days++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(stored_candies>8-a[j])\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+8;\n\t\t\t\tstored_candies=stored_candies-(8-a[j]);\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+a[j]+stored_candies;\n\t\t\t\tstored_candies=0;\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t}\n\t\tj++;\n\n\t}\n\n\tif(given_candies<k)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count_days);\n\n}"}, {"source_code": "#include <stdio.h>\n#define N 100\n\nvoid give(int *caramelleArya, int k, int *caramelleBran)\n{\n int d=k-*caramelleBran, caramelleDonabili; //caramelle mancanti a Bran\n\n if (*caramelleArya>8) caramelleDonabili=8;\n else caramelleDonabili=*caramelleArya;\n\n if (caramelleDonabili-d>=0){\n *caramelleBran+=d;\n return;\n }\n\n *caramelleBran+=caramelleDonabili;\n *caramelleArya-=caramelleDonabili;\n}\n\n\nint main() {\n\n int n, k, a[N], caramelleArya=0, caramelleBran=0, giorni=0;\n\n scanf(\"%d %d\", &n, &k);\n\n for (int i=0; i<n && caramelleBran!=k; ++i){\n\n scanf(\"%d\", &a[i]);\n\n caramelleArya+=a[i];\n\n give(&caramelleArya, k, &caramelleBran);\n\n ++giorni;\n }\n\n if (caramelleBran!=k) printf(\"%d\", -1);\n else printf(\"%d\", giorni);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int i, n, k, a[100], bram = 0;\n\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i < n; i++)\n {\n if(a[i] < 8)\n bram += a[i];\n else\n {\n bram += 8;\n if(i < n)\n a[i+1] += a[i] - 8;\n }\n\n if(bram >= k)\n break;\n }\n\n (i < n)? printf(\"%d\\n\", i+1) : printf(\"%d\\n\", -1);\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(int argc, char** argv) {\n\tint n, i, ukupno = 0, k, a, tacno = -1;\n\tscanf(\"%d %d\", &n, &k);\n\tfor(i = 0 ; i < n ; i++){\n\t\tscanf(\"%d\", &a);\n\t\tif(tacno == -1){\n\n\t\tukupno += a;\n\t\tif(ukupno <= 8){\n\t\t\tk -= ukupno;\n\t\t\tukupno = 0;\n\t\t}else{\n\t\t\tk -= 8;\n\t\t\tukupno -= 8;\n\t\t}\n\t\tif( k <= 0){\n\t\t\ttacno = i+1;\n\t\t}\n\t}\n\t}\n\tprintf(\"%d\", tacno);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i,p[n],sum=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",p+i);\n sum+=p[i];\n }\n if(sum>=k){\n sum=0; int sum2=0,flag=0;\n for(i=0;i<n-1;i++){\n if(p[i]>=8){\n p[i+1]+=p[i]-8;\n p[i]=8;\n }\n }\n for(i=0;i<n;i++){\n if(p[i]<=8)sum+=p[i];\n else sum+=8;\n if(sum>=k){\n printf(\"%d\",i+1);\n flag=1;\n break;\n }\n }\n if(flag==0)printf(\"-1\");\n\n }\n\n\n\n else printf(\"-1\\n\");\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAXGIVE 8\nint min(int x, int y) {\n return x*(x<=y)+y*(x>y);\n}\nint main() {\n int len,candy,curr,bran=0,saved=0,i=0,keep=1,dar;\n scanf(\"%d %d\\n\",&len,&candy);\n while (i<len && keep) {\n scanf(\"%d\",&curr);\n dar=min(curr+saved,MAXGIVE);\n bran+=dar;\n saved=(curr+saved-dar);\n if (bran>=candy) {\n keep=0;\n printf(\"%d\",i+1);\n }\n i++;\n }\n if (keep) printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n , k , a , i=0 , j = 0 ;\n\tscanf(\"%d\", &n) ;\n\tscanf(\"%d\", &k) ;\n\twhile (i < n && k > 0 ) {\n scanf(\"%d\", &a) ;\n a = a + j ;\n j = 0 ;\n if ( a > 8 ) {\n k = k - 8 ;\n j = a - 8 ;\n }\n else {\n k = k - a ;\n }\n ++i ;\n\t}\n\tif ( k <= 0 ) printf(\"%d\", i) ;\n\telse printf(\"%d\", -1) ;\nreturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,k,i,j,r=0,c=0,d=0,m=0;\n scanf(\"%d%d\",&n,&k);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n ar[i]+=r;\n if(ar[i]>8)\n {r=abs(ar[i]-8);\n c+=8;}\n else\n {\n r=0;\n c+=ar[i];\n }\n d++;\n if(c>=k)\n {\n m=1;\n break;\n }\n }\n if(m!=1)\n printf(\"-1\");\n else\n printf(\"%d\",d);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <stdlib.h>\n\n\nint main() {\n\tint n, k;\n\twhile(scanf(\"%d %d\", &n, &k)==2) {\n\t\tint s=0, g=0, i;\n\t\tfor(i=0; i<n && g<k; i++) {\n\t\t\tint x;\n\t\t\tscanf(\"%d\", &x);\n\t\t\ts += x;\n\t\t\tif (s>=8) g+=8, s-=8;\n\t\t\telse g+=s, s=0;\n\t\t}\n\t\tif (g<k) printf(\"%d\\n\", -1);\n\t\telse printf(\"%d\\n\", i);\n\t\tbreak;\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, k, i, day=0, total=0;\n scanf(\"%d%d\", &n, &k);\n int ara[n];\n\n for(i=0; i<n; i++){\n scanf(\"%d\", &ara[i]);\n }\n\n for(i=0; i<n; i++){\n if(ara[i]+day<=8){\n total=total+ara[i]+day;\n day=0;\n }\n if(ara[i]+day>8){\n total=total+8;\n day=ara[i]+day-8;\n }\n if(total>=k){\n printf(\"%d\\n\", i+1);\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n return 0;\n}\n\n//https://codeforces.com/problemset/problem/839/A\n"}, {"source_code": "#include<stdio.h>\n\nint floor(float x)\n{\n int floor;\n if(x>=0) floor = (int)x;\n else {\n floor = (int)x;\n if(x - (float)floor ) floor--;\n }\n\n return floor;\n}\n\nint ceil(float x)\n{\n int ceil;\n if(x>=0) {\n ceil = (int)x;\n if(x - (float)ceil) ceil++;\n\n }\n else ceil = (int)x;\n\n return ceil;\n\n}\n\nint round(float x)\n{\n int round;\n if(x<0) x -= .5;\n else x += .5;\n round = (int)x;\n\n return round;\n}\n\nint main()\n{\n int i, j, n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n for(i=0; i<n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n int given = 0, remain = 0;\n i = 0;\n\n while(given<k && i<n) {\n\n// remain = 0;\n// for(j=0; j<i; ++j) remain += a[j];\n if(a[i]<8) {\n if(remain+a[i]-8 >= 0) {\n given += 8;\n remain -= 8 - a[i];\n// a[i] = 0;\n }\n else if(remain+a[i]-8 < 0) {\n given += remain+a[i];\n remain = 0;\n// a[i] = 0;\n }\n }\n else if(a[i]>8) {\n given += 8;\n remain += a[i]-8;\n }\n else {\n given += a[i];\n// a[i] = 0;\n }\n// printf(\"%d %d %d\\n\", a[i], given, remain);\n i++;\n\n }\n if(given<k) printf(\"-1\");\n else printf(\"%d\", i);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,i,sum=0;\n scanf(\"%d %d\",&n,&k);\n\n int a[n],total=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n total=total+a[i];\n }\n\n \n if(k>total)\n printf(\"-1\");\n else if(k>(n*8))\n printf(\"-1\\n\");\n else\n {\n for(i=0;i<n;i++)\n {\n if(a[i]<8)\n {\n sum=sum+a[i];\n if(sum>=k)\n {\n printf(\"%d\\n\",i+1);\n break;\n }\n\n }\n else if(a[i]>=8)\n {\n a[i+1]=a[i+1]+a[i]-8;\n sum=sum+8;\n\n if(sum>=k)\n {\n printf(\"%d\\n\",i+1);\n break;\n }\n if(i==(n-1) && sum<k)\n {\n printf(\"-1\");\n break;\n }\n\n }\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 100\nint main(){\n int n,k;\n int a[N];\n scanf(\"%d%d\",&n,&k);\n int i;\n int give=0;\n int receive=0;\n int day=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n give+=a[i];\n if(receive>=k){\n break;\n }else{\n if(give>=8){\n receive+=8;\n give-=8;\n }else{\n receive+=give;\n give=0;\n }\n day++;\n }\n }\n if(receive<k){\n printf(\"%d\\n\",-1);\n }else{\n printf(\"%d\\n\",day);\n }\n return 0;\n}\n"}, {"source_code": "\ufeff\n\n#include<stdio.h>\n\nint main()\n{\n\tint n, k, i, a, s, b, c;\n\tscanf(\"%d %d\",&n,&k);\n\n\ts = 0;\n\tb = 0;\n\tc = -1;\n\t\n\t\tfor (i = 1;i<=n;i++)\n\t\t{\n\t\t\tscanf(\"%d\", &a);\n\t\t\t\n\t\t\ts = s + a;\n\t\t\tif (s > 8)\n\t\t\t{\n\t\t\t\tb = b + 8;\n\t\t\t\ts = s - 8;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb = b + s;\n\t\t\t\ts = 0;\n\t\t\t}\n\n\t\t\tif (b >= k)\n\t\t\t{\n\t\t\t\tc = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprintf(\"%d\", c);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n , k , a , i=0 , j = 0 ;\n\tscanf(\"%d\", &n) ;\n\tscanf(\"%d\", &k) ;\n\twhile (i < n && k > 0 ) {\n scanf(\"%d\", &a) ;\n a = a + j ;\n j = 0 ;\n if ( a > 8 ) {\n k = k - 8 ;\n j = a - 8 ;\n }\n else {\n k = k - a ;\n }\n ++i ;\n\t}\n\tif ( k <= 0 ) printf(\"%d\", i) ;\n\telse printf(\"%d\", -1) ;\nreturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint SoNgay, SoKeoCho, Keo, SoKeoDu = 0;\n\tscanf(\"%d\", &SoNgay);\n\tscanf(\"%d\", &SoKeoCho);\n\tint i;\n\tfor ( i = 1; i <= SoNgay; i++)\n\t{\n\t\tscanf(\"%d\", &Keo);\n\t\tSoKeoDu = SoKeoDu + Keo;\n\t\tif (SoKeoDu > 8)\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - 8;\n\t\t\tSoKeoDu = SoKeoDu - 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - SoKeoDu;\n\t\t\tSoKeoDu = 0;\n\t\t}\n\t\tif (SoKeoCho <= 0)\n\t\t\tbreak;\n\t}\n\tif (SoKeoCho <= 0)\n\t{\n\t\tprintf(\"%d\", i);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[200];\nint main()\n{\n\tint i,n,k,c=0,r=0,flag=0,d=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif((a[i]+r)<=8)\n\t\t{\n\t\t\tc += (a[i]+r);\n\t\t\tr = 0;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tc += 8;\n\t\t\tr += a[i] - 8;\n\t\t} \n\t\tif(flag == 0)\n\t\t{\n\t\t\tif(c >= k)\n\t\t\t{\n\t\t\t\td = i + 1;\n\t\t\t\tflag = 1;\n\t\t\t}\n\t\t}\n\t}\n\tif(flag == 0)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",d);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,k,sum=0,days=0,i,count;\n\n scanf(\"%d%d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n if(a[i]>=8){\n sum=sum+8;\n if(sum<k)\n days++;\n if(sum>=k && days<=n){\n days++;\n printf(\"%d\\n\",days);\n break;\n }\n if(n==days){\n printf(\"-1\");\n break;\n }\n\n count=a[i]-8;\n a[i+1]+=count;\n }\n\n\n if(a[i]<8){\n sum=sum+a[i];\n if(sum<k)\n days++;\n if(sum>=k && days<=n){\n days++;\n printf(\"%d\\n\",days);\n break;\n }\n if(n==days){\n printf(\"-1\");\n break;\n }\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[100005];\nint main()\n{\n int n,k,i;\n int flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n for(i=1;i<=n;i++)\n {\n if(a[i]>8)\n {\n k-=8;\n a[i+1]+=a[i]-8;\n }\n else k-=a[i];\n if(k<=0)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n printf(\"%d\\n\",i);\n else printf(\"-1\\n\");\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n int d[a],e[a],i,j,k=0,sum=0,q=0,p;\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&e[i]);\n }\n i=0;\n while(sum<b&&k<a){\n p=e[i];\n if(p>8){p=8;\n q=q+e[i]-8;\n }\n if(p<8&&q>0)\n {\n p+=q;\n q=0;\n if(p>8){\n q=p-8;\n p=8;\n }\n }\n sum+=p;//printf(\"\\n ff %d %d\",sum,q);\n k++;\n i++;\n }\n if(sum<b)printf(\"-1\");\n else printf(\"%d\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n int d[a],e[a],i,j,k=0,sum=0,q=0,p;\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&e[i]);\n }\n i=0;\n while(sum<b&&k<a){\n p=e[i];\n if(p>8){p=8;\n q=q+e[i]-8;\n }\n if(p<8&&q>0)\n {\n p+=q;\n q=0;\n if(p>8){\n q=p-8;\n p=8;\n }\n }\n sum+=p;//printf(\"\\n ff %d %d\",sum,q);\n k++;\n i++;\n }\n if(sum<b)printf(\"-1\");\n else printf(\"%d\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,f=0,sum=0;\n scanf(\"%d%d\",&n,&k);\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n for(int i=0;i<n;i++)\n {\n if(ar[i]<=8)\n {\n sum+=ar[i];\n }\n else\n {\n sum+=8;\n ar[i+1]+=ar[i]-8;\n }\n if(sum>=k)\n {\n k=i;\n f=1;\n break;\n }\n }\n if(f==1)\n printf(\"%d\",k+1);\n else\n printf(\"%d\",-1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i,p[n],sum=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",p+i);\n sum+=p[i];\n }\n if(sum>=k){\n sum=0; int sum2=0,flag=0;\n for(i=0;i<n-1;i++){\n if(p[i]>=8){\n p[i+1]+=p[i]-8;\n p[i]=8;\n }\n }\n for(i=0;i<n;i++){\n if(p[i]<=8)sum+=p[i];\n else sum+=8;\n if(sum>=k){\n printf(\"%d\",i+1);\n flag=1;\n break;\n }\n }\n if(flag==0)printf(\"-1\");\n\n }\n\n\n\n else printf(\"-1\\n\");\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,s,a,q=-1,m=0,p=1;\n scanf(\"%d %d\",&n,&k);\n s=0;\n while(p<=n)\n {\n scanf(\"%d\",&a);\n s=s+a;\n if(s>8) { m=m+8; s=s-8; }\n else { m=m+s; s=0; }\n if( m>=k ) { q=p; break; }\n p++;\n }\n printf(\"%d\",q);\n return 0; \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,i,a=0,b=0,c=0,d=0;\n scanf(\"%d %d\",&n,&k);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n while(a<k)\n {\n if(ar[i]==8)\n {\n a+=ar[i];\n b+=1;\n break;\n }\n else if(ar[i]<8)\n {\n if(ar[i]+c>=8)\n {\n a+=8;\n c=c-(8-ar[i]);\n b+=1;\n break;\n }\n else\n {\n a+=(ar[i]+c);\n c=0;\n b+=1;\n break;\n }\n }\n else\n {\n a+=8;\n c+=ar[i]-8;\n b+=1;\n break;\n }\n }\n }\n if(a<k)\n printf(\"-1\");\n else\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#include <string.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n int a[n];\n\tfor(int i=0;i<n;i=i+1){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint count=0;\n\tfor(int i=0;i<n-1;i=i+1){\n\t\tif(a[i]<=8&&k>0){\n\t\t\tk=k-a[i];\n\t\t\tcount+=1;\n\t\t}else if(a[i]>8&&k>0){\n\t\t\tk=k-8;\n\t\t\ta[i+1]+=a[i]-8;\n\t\t\tcount+=1;\n\t\t}\n\t}\n\tif(a[n-1]>8){\n\t\ta[n-1]=8;\n\t}\n\tif(k>0){\n\t\tk=k-a[n-1];\n\t\tcount+=1;\n\t}\n\tif(k<=0){\n\t\tprintf(\"%d\",count);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,i,s=0,b,j=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&b);\n\t\tj=j+b;\n\t\tif(j>=8)\n\t\t{\n\t\t\ts=s+8;\n\t\t\tj=j-8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts=s+j;\n\t\t\tj=0;\n\t\t}\n\t\tif(s>=k)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,i;\n scanf(\"%d %d\",&n,&k);\n int arr[100];\n for(i=0; i<n; i++) scanf(\"%d\",&arr[i]);\n\n for(i=0; i<=n; i++)\n {\n if(i==n)\n {\n printf(\"-1\");\n break;\n }\n\n if(arr[i]<=8)\n {\n if(k<=arr[i])\n {\n printf(\"%d\",i+1);\n break;\n }\n else k=k-arr[i];\n }\n else\n {\n if(k<=8)\n {\n printf(\"%d\",i+1);\n break;\n }\n else\n {\n k=k-8;\n arr[i+1]+=arr[i]-8;\n }\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int num,k,i;\n scanf(\"%d%d\",&num,&k);\n int ara[num],sum=0;\n for(i=0;i<num;i++)\n {\n scanf(\"%d\",&ara[i]);\n sum=sum+ara[i];\n }\n if(sum<k) printf(\"-1\\n\");\n else if(num*8<k) printf(\"-1\\n\");\n else\n {\n for(i=1;i<=num;i++)\n {\n if(ara[i-1]<=8) k=k-ara[i-1];\n else if(ara[i-1]>8)\n {\n k=k-8;\n ara[i]+=ara[i-1]-8;\n }\n if(k<=0)\n break;\n }\n if(i>num) printf(\"-1\\n\");\n else printf(\"%d\\n\",i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,a,i=0,j,x=0;\n scanf(\"%d%d\",&n,&k);\n while(n--)\n {\n scanf(\"%d\",&a);\n x=x+a;\n if(x<=8)\n {\n k=k-x;\n x=0;}\n else if(x>8)\n {\n k=k-8;\n x=x-8;\n }\n i++;\n if(k<=0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n\tint SoNgay, SoKeoCho, Keo, SoKeoDu = 0;\n\tscanf(\"%d\", &SoNgay);\n\tscanf(\"%d\", &SoKeoCho);\n\tint i;\n\tfor ( i = 1; i <= SoNgay; i++)\n\t{\n\t\tscanf(\"%d\", &Keo);\n\t\tSoKeoDu = SoKeoDu + Keo;\n\t\tif (SoKeoDu > 8)\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - 8;\n\t\t\tSoKeoDu = SoKeoDu - 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSoKeoCho = SoKeoCho - SoKeoDu;\n\t\t\tSoKeoDu = 0;\n\t\t}\n\t\tif (SoKeoCho <= 0)\n\t\t\tbreak;\n\t}\n\tif (SoKeoCho <= 0)\n\t{\n\t\tprintf(\"%d\", i);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint candy;\nint n,k;\n\nint main()\n{\n int i,a;\n\n scanf(\"%d %d\",&n,&k);\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a);\n candy+=a;\n\n if(candy>8){\n k -= 8;\n candy -= 8;\n }\n else{\n k -= candy;\n candy = 0;\n }\n\n if(k<=0) {\n printf(\"%d\",i+1);\n return 0;\n }\n }\n\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[200];\n\nint main()\n{\n int i, n, k, c = 0, r = 0, flag = 0, d = 0;\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if((a[i] + r) <= 8)\n {\n c += (a[i] + r);\n r = 0;\n }\n else\n {\n c += 8;\n r += a[i] - 8;\n }\n if(flag == 0)\n {\n if(c >= k)\n {\n d = i + 1;\n flag = 1;\n }\n }\n }\n if(flag == 0)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\", d);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n,k,flag=0,a[200];\n scanf(\"%d%d\",&n,&k);\n for (int i = 1; i <= n; ++i) {\n scanf(\"%d\",&a[i]);\n }\n for (int j = 1; j <= n && flag==0; ++j) {\n if (a[j]<=8){\n k-=a[j];\n }\n else{\n k-=8;\n a[j]-=8;\n a[j+1]+=a[j];\n }\n if (k<=0){\n printf(\"%d\\n\",j);\n flag=1;\n }\n }\n if (flag==0){\n printf(\"-1\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,k,t,brian=0,arya=0;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint i;\n\tt=n;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tarya+=a[i];\n\t\tif(arya>=8)\n\t\t\t{\n\t\t\t\tk-=8;\n\t\t\t\tarya-=8;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\t\tk-=arya;\n\t\t\t\tarya=0;\n\t\t\t}\n\t\tif(k<=0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0; \n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint n,k,num=0,t,tmp=0,f=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(int i=0;i<n;i++){\n\t\tscanf(\"%d\",&t);\n\t\tt+=tmp;\n\t\ttmp=0;\n\t\tif(t>8){\n\t\t\tnum+=8;\n\t\t\ttmp=t-8;\n\t\t\tf++;\n\t\t\tif(num>=k)\n\t\t\tbreak; \n\t\t}\n\t\telse{\t\n\t\tnum+=t;\n\t\tf++;\n\t\tif(num>=k)\n\t\tbreak;\n }\n\t}\n\tif(num<k){\n\t\tprintf(\"-1\");\n\t}\t\t\t\n\telse{\n\t\tprintf(\"%d\",f);\n\t\t}\n\t\t}"}, {"source_code": "\ufeff\n\n#include<stdio.h>\n\nint main()\n{\n\tint n, k, i, a, s, b, c;\n\tscanf(\"%d %d\",&n,&k);\n\n\ts = 0;\n\tb = 0;\n\tc = -1;\n\t\n\t\tfor (i = 1;i<=n;i++)\n\t\t{\n\t\t\tscanf(\"%d\", &a);\n\t\t\t\n\t\t\ts = s + a;\n\t\t\tif (s > 8)\n\t\t\t{\n\t\t\t\tb = b + 8;\n\t\t\t\ts = s - 8;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb = b + s;\n\t\t\t\ts = s - s;\n\t\t\t}\n\n\t\t\tif (b >= k)\n\t\t\t{\n\t\t\t\tc = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprintf(\"%d\", c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,n,k,arr[100]={0},sum=0,val=0,ans=0;\n\tscanf(\"%d %d\",&n, &k);\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(sum >= k)\n\t\t{\n\t\t\tans = i;\n\t\t\tbreak;\n\t\t}\n\t\tarr[i] = arr[i] + val;\n\t\tif(arr[i] > 8)\n\t\t{\n\t\tval = arr[i] - 8;\n\t\tsum = sum + 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum = sum +arr[i];\n\t\t\tval = 0;\n\t\t}\n\t//\tprintf(\"%d\\n\",sum);\n\t\t\n\t}\n\tif(sum >= k)\n\t\t{\n\t\t\tans = i;\n\t\t}\n\tif(sum < k)\n\t{\n\t\tans = -1;\n\t}\n\tprintf(\"%d\\n\",ans);\n\n}"}, {"source_code": "#include <stdio.h>\n#define N 100\n\nvoid give(int *caramelleArya, int k, int *caramelleBran)\n{\n int d=k-*caramelleBran, caramelleDonabili; //caramelle mancanti a Bran\n\n if (*caramelleArya>8) caramelleDonabili=8;\n else caramelleDonabili=*caramelleArya;\n\n if (caramelleDonabili-d>=0){\n *caramelleBran+=d;\n return;\n }\n\n *caramelleBran+=caramelleDonabili;\n *caramelleArya-=caramelleDonabili;\n}\n\n\nint main() {\n\n int n, k, a[N], caramelleArya=0, caramelleBran=0, giorni=0;\n\n scanf(\"%d %d\", &n, &k);\n\n for (int i=0; i<n && caramelleBran!=k; ++i){\n\n scanf(\"%d\", &a[i]);\n\n caramelleArya+=a[i];\n\n give(&caramelleArya, k, &caramelleBran);\n\n ++giorni;\n }\n\n if (caramelleBran!=k) printf(\"%d\", -1);\n else printf(\"%d\", giorni);\n\n return 0;\n}"}, {"source_code": "\ufeff\n\n#include<stdio.h>\n\nint main()\n{\n\tint n, k, i, a, s, b, c;\n\tscanf(\"%d %d\",&n,&k);\n\n\ts = 0;\n\tb = 0;\n\tc = -1;\n\t\n\t\tfor (i = 1;i<=n;i++)\n\t\t{\n\t\t\tscanf(\"%d\", &a);\n\t\t\t\n\t\t\ts = s + a;\n\t\t\tif (s > 8)\n\t\t\t{\n\t\t\t\tb = b + 8;\n\t\t\t\ts = s - 8;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tb = b + s;\n\t\t\t\ts = 0;\n\t\t\t}\n\n\t\t\tif (b >= k)\n\t\t\t{\n\t\t\t\tc = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprintf(\"%d\", c);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j=0,k,m=0,n;\n\n scanf(\"%d %d\",&n,&k);\n\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n a[i+1]+=a[i]-8;\n\n a[i]=8;\n }\n m+=a[i];\n\n j++;\n\n if(m>=k)\n {\n printf(\"%d\\n\",j);\n\n break;\n }\n }\n if(m<k)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,k;\n int i=1,sum=0,same=0;\n int ara[100001],bra[100001];\n scanf(\"%d %d\",&n,&k);\n while(n--)\n {\n int a;\n scanf(\"%d\",&a);\n a=a+same;\n if(a<9)\n {\n sum=sum+a;\n same=0;\n }\n else\n {\n sum=sum+8;\n same=a-8;\n\n\n }\n if(sum>=k)\n {\n printf(\"%d\\n\",i);\n return 0;\n }\n i++;\n }\n printf(\"-1\\n\");\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[105];\n int sum=0,x=-1;\n scanf(\"%d%d\",&n,&k);\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(int i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n \n sum+=8;\n a[i+1]=a[i+1]+(a[i]-8);\n }else\n {\n sum+=a[i];\n }\n if(sum>=k)\n {\n x=i+1;\n break;\n }\n }\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n int n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n int* arr = (int*)malloc(sizeof(int)*n);\n int i=0,x=0,y=0;\n for (i=0;i<n;i++){\n scanf(\"%d\",&arr[i]);\n }\n i =0;\n int sent =0;\n while(i<n){\n x = arr[i] + y;\n if(x<=8){\n y = 0;\n sent+=x;\n\n }\n else {\n y = x-8;\n sent +=8;\n }\n if(sent >= k){\n printf(\"%d\",i+1);\n return 0;\n }\n i++;\n }\n if(y > 0 || y<=0){\n printf(\"-1\");\n }\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n ,k ,sum=0 ,b ,i;\n\tscanf(\"%d%d\" ,&n ,&k);\n\tint a[n];\n\tfor(i=0;i<n;i++) scanf(\"%d\" ,&a[i]);\n\tfor(i=0;i<n;i++){\n\t\tif(a[i]>=8){\n\t\t\tsum+=8;\n\t\t\tb=a[i]-8;\n\t\t\tif(i!=n-1) a[i+1]+=b;\n\t\t}\n\t\tif(a[i]<8)\n\t\t sum+=a[i];\n\t\tif(sum>=k) {\n\t\t\tprintf(\"%d\" ,i+1);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif(sum<k) printf(\"-1\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint floor(float x)\n{\n int floor;\n if(x>=0) floor = (int)x;\n else {\n floor = (int)x;\n if(x - (float)floor ) floor--;\n }\n\n return floor;\n}\n\nint ceil(float x)\n{\n int ceil;\n if(x>=0) {\n ceil = (int)x;\n if(x - (float)ceil) ceil++;\n\n }\n else ceil = (int)x;\n\n return ceil;\n\n}\n\nint round(float x)\n{\n int round;\n if(x<0) x -= .5;\n else x += .5;\n round = (int)x;\n\n return round;\n}\n\nint main()\n{\n int i, j, n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n for(i=0; i<n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n int given = 0, remain = 0;\n i = 0;\n\n while(given<k && i<n) {\n\n// remain = 0;\n// for(j=0; j<i; ++j) remain += a[j];\n if(a[i]<8) {\n if(remain+a[i]-8 >= 0) {\n given += 8;\n remain -= 8 - a[i];\n// a[i] = 0;\n }\n else if(remain+a[i]-8 < 0) {\n given += remain+a[i];\n remain = 0;\n// a[i] = 0;\n }\n }\n else if(a[i]>8) {\n given += 8;\n remain += a[i]-8;\n }\n else {\n given += a[i];\n// a[i] = 0;\n }\n// printf(\"%d %d %d\\n\", a[i], given, remain);\n i++;\n\n }\n if(given<k) printf(\"-1\");\n else printf(\"%d\", i);\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n \nint main()\n{\n int n, k, i, day=0, total=0;\n scanf(\"%d%d\", &n, &k);\n int ara[n];\n \n for(i=0; i<n; i++){\n scanf(\"%d\", &ara[i]);\n }\n \n for(i=0; i<n; i++){\n if(ara[i]+day<=8){\n total=total+ara[i]+day;\n day=0;\n }\n if(ara[i]+day>8){\n total=total+8;\n day=ara[i]+day-8;\n }\n if(total>=k){\n printf(\"%d\\n\", i+1);\n return 0;\n }\n }\n \n printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,i,c=0,s=0,c2=0;\n scanf(\"%d%d\",&n,&k);\n int arr[n];\n for(i=0; i<n; i++)\n scanf(\"%d\",&arr[i]);\n for(i=0; i<n; i++)\n {\n if(arr[i]>=8)\n {\n c= c+ arr[i]-8;\n s= s+ 8;\n }\n else if((arr[i]+c)>= 8)\n {\n c= arr[i]+c-8;\n s= s+8;\n }\n else\n {\n s= s+ arr[i]+c;\n c=0;\n }\n if(s>=k)\n {\n c2= 1;\n break;\n }\n\n }\n if(c2)\n printf(\"%d\",i+1);\n else\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint n, k;\n\tint i, j;\n\tint in;\n\tint day = 0;\n\tint candy = 0;\n\tint sum = 0;\n\n\tscanf(\"%d %d\", &n, &k);\n\tfor (i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d\", &in);\n\t\tcandy += in;\n\t\tif (candy >= 8)\n\t\t{\n\t\t\tsum += 8;\n\t\t\tcandy -= 8;\n\t\t\tday++;\n\t\t\tif (sum >= k)\n\t\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum += candy;\n\t\t\tcandy = 0;\n\t\t\tday++;\n\t\t\tif (sum >= k)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\tif (i == n + 1)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\", day);\n\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[101],i,sum=0,s=0,n,m,count=0;\n scanf(\"%d %d\",&n,&m);\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n\n }\n for(i=0;i<n;i++)\n { if(m>s)\n { if(a[i]>=8)\n {\n count++;\n }\n else\n {\n if(a[i]>=8)\n continue;\n\n else\n sum+=a[i];\n }\n\n }\n else\n break;\n\n }\n if((sum+(count*8))>=m)\n printf(\"%d\",i);\n\n else\n printf(\"-1\");\nreturn 0;\n\n // printf(\"%d %d\",count,sum);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#include <string.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n int a[n];\n\tfor(int i=0;i<n;i=i+1){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint count=0;\n\tfor(int i=0;i<n-1;i=i+1){\n\t\tif(a[i]<=8&&k>0){\n\t\t\tk=k-a[i];\n\t\t}else if(a[i]>8&&k>0){\n\t\t\tk=k-8;\n\t\t\ta[i+1]+=a[i]-8;\n\t\t}\n\t\tcount+=1;\n\t}\n\tif(a[n-1]>8){\n\t\ta[n-1]=8;\n\t}\n\tif(k>0){\n\t\tk=k-a[n-1];\n\t\tcount+=1;\n\t}\n\tif(k<=0){\n\t\tprintf(\"%d\",count);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,sum=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n\n for(i=0;i<n;i++)\n {\n if(sum<k)\n {\n if(a[i]>8)\n {\n a[i+1] = a[i+1]+(a[i]-8);\n sum = sum +8;\n }\n else\n {\n sum = a[i];\n }\n }\n else\n {\n break;\n }\n }\n\n if(sum<k)\n printf(\"%d\",-1);\n else\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,c=0,t=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n,t<k;i++){\n if(a[i]>8){\n t=t+8;\n a[i+1]=a[i+1]+a[i]-8;\n }\n else\n t=t+a[i];\n }\nif(k>t)\n printf(\"-1\");\nelse\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[200];\n\nint main()\n{\n int i, n, k, c = 0, r = 0, flag = 0, d = 0;\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if((a[i] + r) <= 8)\n {\n c += a[i];\n }\n else\n {\n c += 8;\n r = a[i] - 8;\n }\n if(c >= k)\n {\n d = i + 1;\n flag = 1;\n }\n }\n if(flag == 0)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\", d);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,r=0,x=0,p=0;\n scanf(\"%d %d\",&n,&k);\n int ara[n];\n for(i=0; i<n ;i++)\n {\n scanf(\"%d\",&ara[i]);\n ara[i]=x+ara[i];\n if(ara[i]>8 )\n {\n ara[i]=8;\n x=ara[i]-8;\n\n }\n else x=0;\n p=ara[i]+p;\n\n r++;\n if(p>=k)\n break;\n }\n if(r<=n && p>=k)\n printf(\"%d\",i+1);\n else\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j=0,k,m=0,n;\n\n scanf(\"%d %d\",&n,&k);\n\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n a[i]=8;\n }\n m+=a[i];\n\n j++;\n\n if(m>=k)\n {\n printf(\"%d\\n\",j);\n }\n }\n if(m<k)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int B[n],i;\n for( i =0; ((i < n) && (k>0)) ; i++)\n {\n scanf(\"%d\",&B[i]);\n if(B[i] <= 8)\n {\n k -= B[i];\n }\n else\n {\n k -= 8;\n B[i+1] += (B[i] - 8);\n }\n }\n if(k > 0)\n printf(\"-1\");\n else\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[101],i,sum=0,s=0,n,m,count=0,p;\n int x=0,j,r;\n scanf(\"%d %d\",&n,&m);\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n }\n for(i=0; i<n; i++)\n\n {\n\n if(m>s)\n {\n {\n if(a[i]>=8)\n {\n x+=(a[i]-8);\n a[i]=8;\n\n }\n\n s+=a[i];\n }\n\n }\n else\n break;\n\n }\n p=sum-s;\n s=s+(x/8);\n if((s)>=m)\n {\n {\n if(m%8==0)\n j=m/8;\n else\n j=(m/8)+1;\n }\n {\n if(j==i)\n printf(\"%d\",i);\n else\n {\n r=i-j;\n if((8*r)<=p)\n printf(\"%d\",i-r);\n else\n printf(\"%d\",i);\n }\n }\n\n // printf(\"%d %d %d\",i,s,x);\n }\n else\n printf(\"-1\");\n return 0;\n\n //printf(\"%d\",s);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,s,a,c=0,m=0,p;\n scanf(\"%d %d\",&n,&k);\n s=k;\n while(n--)\n {\n scanf(\"%d\",&a);\n if(a>8) s=s-8;\n else s=s-a;\n c++;\n if(s<=0&&c>m) { m=c; c=0; }\n }\n if(s>0) printf(\"-1\");\n else printf(\"%d\",m);\n}\n"}, {"source_code": "#include <stdio.h>\nint a[200];\n\nint main()\n{\n int i, n, k, c = 0, r = 0, flag = 0, d = 0;\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if((a[i] + r) <= 8)\n {\n c += a[i];\n }\n else\n {\n c += 8;\n r = a[i] - 8;\n }\n if(flag == 0)\n {\n if(c >= k)\n {\n d = i + 1;\n flag = 1;\n }\n }\n }\n if(flag == 0)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\", d);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, k, count = 0, a;\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a);\n count += a > 8 ? 8 : a;\n if(count >= k) {\n printf(\"%d\\n\", i + 1);\n return 0;\n }\n }\n puts(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, k, i, c = 0, d = 0, p = 0, s = 0, a[100];\n scanf(\"%d%d\", &n, &k);\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n\n for(i = 0; i < n; i++){\n if(a[i] <= 8){\n s = s + a[i];\n }\n else{\n s = s + 8;\n p++;\n }\n c++;\n if(s > k){\n printf(\"%d\", c);\n d = 1;\n break;\n }\n }\n if(d == 0){\n printf(\"-1\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,k,i,j,count=0,x=-1;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d \",&a[i]);\n }\n \n \n \n \n j=0;\n while(k>0 && (j<n)){\n if(a[j]>8){\n k=k-8;\n count++;\n j++;\n }\n \n else if(a[j]<=8){\n k=k-a[j];\n count++;\n j++;\n }\n \n \n \n }\n if(j=n){\n \n if(k<=0){\n printf(\"%d\",count);\n }\n \n else printf(\"%d\",x);\n \n i=j=count=0;\n \n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c[100];\n int k,i,n,sum=0,count=0;\n float r,f;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&c[i]);\n }\n if(n*8<k)\n {\n printf(\"-1\");\n }\n else\n {\n for(i=0;i<n;i++)\n {\n if(sum<k)\n {\n sum=sum+c[i];\n count=count+1;\n\n }\n }\n\n if(count*8<=k)\n {\n r=k/8;\n f=(float)k/8;\n if(f>r)\n {\n printf(\"%d\",(int)f+1);\n }\n else\n {\n printf(\"%d\",(int)r);\n }\n\n }\n else\n {\n printf(\"%d\",count);\n }\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n\tint arr[n];\n\tint i=0;\n\tfor(i=0; i<n; i++)\n\tscanf(\"%d\",&arr[i]);\n\tint arr2[n];\n\tif(arr[0]<=8)\n\tarr2[0]=arr[0];\n\telse\n\t{\n\tarr2[0]=8;\n\tarr[1]=arr[1]+arr[0]-8;\t\n\t}\n\ti=0;\n\tfor(i=1; i<n-1; i++)\n\t{\n\t\tif(arr[i]<=8)\n\t\tarr2[i]=arr2[i-1]+arr[i];\n\t\telse\n\t\t{\n\t\tarr2[i]=arr2[i-1]+8;\n\t\tarr[i+1]=arr[i+1]+arr[i]-8;\t\n\t\t}\n\t}\n\tif(arr[n-1]<=8)\n\t{\n\tarr2[n-1]=arr2[n-2]+arr[n-1];\t\n\t}\n\telse\n\t{\n\tarr2[n-1]=arr2[n-2]+8;\t\n\t}\n\ti=0;\n\tfor(i=0; i<n; i++)\n\t{\n\t\tif(arr2[i]>=k)\n\t\t{\n\t\t\tprintf(\"%d\",i+1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main() {\n\tint n, k, i, sum = 0;\n\tscanf(\"%d%d\", &n, &k);\n\tint x;\n\tfor(i = 1; i <= n; i++){\n\t\tscanf(\"%d\", &x);\n\t\tif(x >= 8)\n\t\t\tx = 8;\n\t\tsum = sum + x;\n\t\tif(sum >= k){\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\texit(0);\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, k;\n\tscanf(\"%d%d\", &n, &k);\n\tint s = 0;\n int i;\n\tfor (i=1; i<=n; i++)\n\t{\n\t int a;\n\t scanf(\"%d\", &a);\n\t s = (a>8)?(s+8):(s+a);\n\t if (s>=k) break;\n\t}\n\tif (s>=k)\n\t printf(\"%d\", i);\n\telse\n\t printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef long long int ll;\ntypedef long double ld;\n\n#define FOR(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))\n#define ROF(i,a,b) for(int (i) = (a); (i) >= (b); --(i))\n#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))\nint MAX(int a, int b) {\n\treturn (a>b)?a:b;\n}\nint main(int argc, char const *argv[]) {\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint *arr = (int*)calloc(n,sizeof(int));\n\trep(i,n)scanf(\"%d\",&arr[i]);\n\tint ans = 0, rem = 0;\n\trep(i,n) {\n\t\tans = i;\n\t\tif (arr[i]>8) {\n\t\t\trem+=arr[i]-8;\n\t\t\tk-=8;\n\t\t} else {\n\t\t\trem+=arr[i];\n\t\t\tif (rem>8) {\n\t\t\t\trem-=8;\n\t\t\t\tk-=8;\n\t\t\t} else {\n\t\t\t\trem=0;\n\t\t\t\tk-=rem;\n\t\t\t}\n\t\t}\n\t\tif (k<=0)\n\t\t\tbreak;\n\t}\n\tif (k>0)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\", ans+1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,temp=-1;\n scanf(\"%d %d\",&n,&k);\n int arr[n];\n int i,sum=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",&arr[i]);\n if(arr[i]>8) sum+=8;\n else sum+=arr[i];\n if(sum>=k) temp=i+1;\n }\n\n printf(\"%d\",temp);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c[100];\n int k,i,n,sum=0,count=0;\n float r,f;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&c[i]);\n }\n if(n*8<k)\n {\n printf(\"-1\");\n }\n else\n {\n for(i=0;i<n;i++)\n {\n if(sum<k)\n {\n sum=sum+c[i];\n count=count+1;\n\n }\n }\n printf(\"%d \",count);\n if(count*8<k)\n {\n r=k/8;\n f=(float)k/8;\n if(f>r)\n {\n printf(\"%d\",(int)f+1);\n }\n else\n {\n printf(\"%d\",(int)r);\n }\n\n }\n else\n {\n printf(\"%d\",count);\n }\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, k, i, c = 0, d = 0, p = 0, s = 0, a[100];\n scanf(\"%d%d\", &n, &k);\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n\n for(i = 0; i < n; i++){\n if(a[i] <= 8){\n s = s + a[i];\n }\n else{\n s = s + 8;\n p++;\n }\n c++;\n if(s >= k){\n printf(\"%d\", c);\n d = 1;\n break;\n }\n }\n if(d == 0){\n printf(\"-1\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int N,K,Count,Day=0;\n scanf(\"%d%d\",&N,&K);\n int Array[N];\n for(Count=0;Count<N;Count++)\n scanf(\"%d\",&Array[Count]);\n for(Count=0;Count<N;Count++)\n {\n if(K<=0)\n break;\n if(Array[Count]>8)\n K-=8;\n else\n K-=Array[Count];\n Day++;\n }\n if(K<=0)\n printf(\"%d\\n\",Day);\n else\n printf(\"%d\\n\",-1);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,a[100];\n\tint i=0,d=0,t=0,s=0,p=0,e=0;\n\tscanf(\"%d%d\",&n,&k);\n\twhile (i<n)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\tfor (i=0;i<n;i++)\n\t{\n\t\ta[i]= a[i] + e;\n\t\td = d+1;\n\t\ta[i] >8? (t = t+8) : (t=t+a[i]);\n\t\tif (a[i]>8)\n\t\t{\n\t\t\te = a[i] -8;\n\t\t}\n\t\tif (t>=k)\n\t\t{\n\t\t\ts = -1;\n\t\t\tbreak;\n\t\t}\n\t}\n\ts==-1 ?(printf(\"%d\",d)):(printf(\"-1\"));\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a,i,sum=0,x=0,r,c=0;\n scanf(\"%d %d\",&n,&k);\n\n for(i=1; i<=n; i++)\n {\n\n scanf(\"%d\",&a);\n sum=sum+a+x;\n if(n*8<k)\n {\n printf(\"-1\");\n return 0;\n }\n\n else if(sum<=k)\n {\n if(sum>8)\n {\n x=sum-8;\n }\n else\n {\n x=0;\n }\n }\nc++;\n\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,k,t;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tint i;\n\tt=n;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]>=8)\n\t\t\tk-=8;\n\t\telse\n\t\t\tk-=a[i];\n\t\tif(k<=0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,k,a[1010],count=0,rem=0,i,flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<n; i++)\n {\n if((rem+a[i])>=8)\n {\n rem=(rem+a[i])-8;\n k=k-8;\n count++;\n\n }\n else if(k==(rem+a[i])) {\n count++;\n flag=count;\n break;\n }\n else\n {\n k=k-a[i];\n count++;\n\n }\n\n if(k<=0)\n {\n flag=count;\n break;\n }\n\n // printf(\"DEBUG ==>\\nday left =%d\\nk left=%d\\ncount = %d\\nflag =%d\\n\",n,k,count,flag);\n\n }\n //printf(\"%d\\n\\n\\n\",flag);\n if(flag>0)printf(\"%d\\n\",flag);\n else printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k,a[107],i,sum=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n a[i+1]+=8;\n a[i]-=8;\n }\n sum+=a[i];\n if(sum>=k)\n {\n break;\n }\n }\n if(sum<k)\n {\n i=-2;\n }\n printf(\"%d\",i+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i,p[n],sum=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",p+i);\n sum+=p[i];\n }\n if(8*n>=k){\n int l=0,c=0;\n while(1){\n l+=8;c++;\n sum+=-8;\n if(l>=k){\n printf(\"%d\",c);\n break;\n }\n }\n }\n\n\n else printf(\"-1\\n\");\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(){\n\tint n,k,*A;\n\tscanf (\"%d%d\", &n,&k);\n\tA = (int *) malloc ((n+1)*sizeof(int));\n\tfor (int i=1;i<=n;i++)\n\t\tscanf (\"%d\", &A[i]);\n\tif ((k%8) +1 <= n)\n\t\tprintf (\"%d\",n);\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,a,i=0,j,m=0,x;\n scanf(\"%d%d\",&n,&k);\n while(n--)\n {\n scanf(\"%d\",&a);\n x=x+a+m;\n if(x<=8)\n k=k-x;\n else if(x>=8)\n {\n k=k-8;\n m=x-8;\n }\n i++;\n if(k<=0)\n j=i;\n }\n if(k<=0) printf(\"%d\",j);\n else\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nmain()\n{\n int n, k, i, j;\n long long sum = 0, cnt = 0;\n int a[n];\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum += a[i];\n if(sum>8)\n {\n cnt += 8;\n sum = sum - 8;\n }\n else\n {\n cnt += a[i];\n sum -= a[i];\n }\n\n if(cnt>=k)\n {\n printf(\"%d\", i+1);\n return 0;\n }\n }\n\n printf(\"-1\");\n\n\n}\n\n"}, {"source_code": "i,I,a[103],s,r,p;main(){for(;~scanf(\"%d\",++i+a);i>2?r+=a[i],p=r>8?8:r,s+=p,r-=p,a[2]/s&&!I?I=i:0:0);printf(\"%d\",I?I:-1);}"}, {"source_code": "#include <stdio.h>\nint a[200];\n\nint main()\n{\n int i, n, k, c = 0, r = 0, flag = 0, d = 0;\n scanf(\"%d %d\", &n, &k);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if((a[i] + r) <= 8)\n {\n c += (a[i] + r);\n }\n else\n {\n c += 8;\n r += a[i] - 8;\n }\n if(flag == 0)\n {\n if(c >= k)\n {\n d = i + 1;\n flag = 1;\n }\n }\n }\n if(flag == 0)\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\", d);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tint n, k, a, nDay=0;\n\t// k = numero de doces desejado\n\t// n = numero de dias\n\t// a = qtde de doce do dia\n\n\tint i, tot=0, sobra=0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &k);\n\n\tfor(i=0; i<n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\ta = a+sobra;\n\t\tif(a>8) {\n\t\t\ta=a-8;\n\t\t\tsobra+=a;\n\t\t\ttot += 8;\n\t\t}\n\t\telse {\n\t\t\ttot += a;\n\t\t}\n\t\tnDay++;\n\t\tif(tot==k) break;\n\t}\n\tif(tot>=k)\n\t\tprintf(\"%d\\n\", nDay);\n\telse\n\t\tprintf(\"-1\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\n int n,k,i,j,sum,d;\n while(scanf(\"%d %d\",&n,&k)!=EOF)\n {\n sum=d=0;\n int array[n];\n for(i=0;i<n;i++)\n {\n\n scanf(\"%d\",&array[i]);\n }\n for(i=0;i<n;i++)\n {\n if(array[i]>=8)\n sum+=8;\n else\n sum+=array[i];\n if(sum>=k)\n {\n d=i+1;\n break;\n }\n\n }\n if(d)\n printf(\"%d\\n\",d);\n else\n printf(\"-1\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(){\n\tint n,k,A[10000];\n\tscanf (\"%d%d\", &n,&k);\n\t\n\tfor (int i=1;i<=n;i++){\n\t\tscanf (\"%d\", &A[i]);\n\t\tif (A[i] >=8) A[i] = 8;\n\t\tk-=A[i];\n\t\t\n\t\tif (k<=0)\n\t\t\tprintf (\"%d\", i);\n\t\t\n\t\t\n\t\t\t\n\t}\n\tif (k>0)\n\t\tprintf (\"-1\");\n\t\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,t,i;\n int s=0;\n int a [100];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n\n for(i=0;i<n;i++)\n {\n\n if(a[i]>=8)\n {\n s=s+8;\n a[i+1]+= a[i]-8;\n }\n else\n s=s+a[i];\n if(s>=k)\n {\n t=i+1;\n break;\n }\n\n }\n\n\n\n printf (\"%d\",t);\n}"}, {"source_code": "#include <stdio.h>\n\n#define N 100\n\nint main() {\n\tstatic int aa[N];\n\tint n, k, i, b, r, cnt, yes;\n\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tyes = cnt = b = r = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tb += (aa[i] + r <= 8 ? aa[i] : 8);\n\t\tif (aa[i] > 8)\n\t\t\tr += aa[i] - 8;\n\t\tcnt++;\n\t\tif (b >= k) {\n\t\t\tyes = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!yes)\n\t\tif ((b + r) >= k) {\n\t\t\tyes = 1;\n\t\t\tcnt += (r + 7) / 8;\n\t\t}\n\tprintf(\"%d\\n\", yes && cnt <= n ? cnt : -1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#define N 1000\n\n\nint main(){\n\tint n,k,a[N],can,i;\n\t//can=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t\t//can+=a[i];\n\t\t//printf(\"%d\\n\",a[i] );\n\t\tif(a[i]>8) k=k-8;\n\t\telse k=k-a[i];\n\t\tif(k<=0) {\n\t\t\tprintf(\"%d\\n\",i+1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],candies_given=0,store=0,i,count=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(candies_given<=k && j<n)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tcandies_given=candies_given+8;\n\t\t\tstore=store+a[j]-8;\n\t\t\tj++;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta[j]=a[j]+store;\n\t\t\tif(a[j]>8)\n\t\t\t{\n\t\t\t\tcandies_given=candies_given+8;\n\t\t\t\tstore=a[j]-8;\n\t\t\t\tj++;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcandies_given=candies_given+a[j];\n\t\t\t\tj++;\n\t\t\t\tstore=0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t}\n\t} \n\n\tif(candies_given<k && j==n)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int n,k,i,a,count=0,c=0,b=0;\n scanf(\" %d %d\",&n,&k);\n\n for(i=0;i<n;i++)\n {\n scanf(\" %d\",&a);\n a=a+b;\n printf(\" %d %d\\n\",a,c);\n\n if(a<8 && c<k){\n c+=a;\n b=0;\n count++;\n }\n else if(c<k){\n c+=8;\n b=a-8;\n count++;\n }\n }\n\n if(c>=k)\n printf(\"%d\\n\",count);\n else\n printf(\"-1\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tint n,k,x,sum=0,m=0,b=0,e=0,z=0;\n\tscanf(\"%d%d\",&n,&k);\n\tint i;\n\t\n\tfor (i=1;i<=n;i++){\n\t\tscanf(\"%d\",&x);\n\t\tx+=b;\n\t\tif (x>8){\n\t\t\tb=x-8;\n\t\t\t x=8;\n\t\t} \n\t\tsum+=x;\n\t\tm++;\n\t\tif (sum>=k){\n\t\t\tz=1;\n\t \t e=m;\n\t\t}\n\t}\n\tif (z==1) printf(\"%d\",e);\n\tif (z==0 && sum>=k) printf(\"%d\\n\",m);\n\telse printf(\"-1\");\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n ,k ;\n int con = 0;\n int i=1 ;\n int s=0 ;\n int s1=0 ;\n scanf(\"%d %d\",&n,&k);\n int tab [100] ;\n for (i=0 ;i<n;i++){\n scanf(\"%d\",&tab[i]);\n\n\n\n }\n i=1 ;\n while ((i<=n)&&(con==0)) {\n if (tab[i]<=8){\n if (s1>=8-tab[i]){\n s=s+8 ;\n s1=s1-8+tab[i] ;\n }\n else {\n s=s+tab[i]+s1 ;\n s1= 0 ;\n\n\n }\n i++ ;\n\n }\n else {\n s=s+8 ;\n s1=s1+tab[i]-8 ;\n i++ ;\n\n\n }\n if (s>=k){\n printf(\"%d\",i-1);\n con =1 ;\n }\n }\n if (con==0){\n printf(\"%d\",-1) ;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,a[105],i,given_candies=0,stored_candies=0,count_days=0,j=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\twhile(j<n)\n\t{\n\t\tif(a[j]>8)\n\t\t{\n\t\t\tstored_candies=stored_candies+a[j]-8;\n\t\t\tgiven_candies=given_candies+8;\n\t\t\tcount_days++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(stored_candies>8-a[j])\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+8;\n\t\t\t\tstored_candies=stored_candies-(8-a[j]);\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgiven_candies=given_candies+a[j]+stored_candies;\n\t\t\t\tstored_candies=0;\n\t\t\t\tcount_days++;\n\t\t\t}\n\t\t}\n\t\tj++;\n\n\t}\n\n\tif(given_candies<k)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\",count_days);\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,r=0;\nscanf(\"%d %d\",&n,&k);\nint a[n];\nfor(int i=0;i<n;i++)\n{\nscanf(\"%d\",&a[i]);\nif(a[i]<=8)\n{\nr=a[i]+r;\nprintf(\"day :%d r=%d\\n\",i+1,r);\n}\nelse\n{\nr=8+r;\nprintf(\"day :%d r=%d\\n\",i+1,r);\n}\nif(r>=k)\n{\nint rem=r-k;\nif(rem!=0)\n{\nfor(int j=0;j<n;j++)\n{\nif(a[j]==rem)\n{\nprintf(\"%d\\n\",i);\nreturn 0;\n}\n}\n}\nprintf(\"R=%d\\n\",r);\nprintf(\"%d\\n\",i+1);\nreturn 0;\n}\n}\n\n\nprintf(\"-1\\n\");\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c[100];\n int k,i,n,sum=0,count=0;\n float r,f;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&c[i]);\n }\n if(n*8<k)\n {\n printf(\"-1\");\n }\n else\n {\n for(i=0;i<n;i++)\n {\n if(sum<k)\n {\n sum=sum+c[i];\n count=count+1;\n\n }\n }\n\n if(count*8<=k)\n {\n r=k/8;\n f=(float)k/8;\n if(f>r)\n {\n printf(\"%d\",(int)f+1);\n }\n else\n {\n printf(\"%d\",(int)r);\n }\n\n }\n else\n {\n printf(\"%d\",count);\n }\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,a[100];\n\tint i=0,d=0,t=0,s=0,p=0,e=0;\n\tscanf(\"%d%d\",&n,&k);\n\twhile (i<n)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\tfor (i=0;i<n;i++)\n\t{\n\t\ta[i]= a[i] + e;\n\t\td = d+1;\n\t\ta[i] >8? (t = t-(a[i] -8)+a[i]) : (t=t+a[i]);\n\t\tif (t>=k)\n\t\t{\n\t\t\ts = -1;\n\t\t\tbreak;\n\t\t}\n\t}\n\ts==-1 ?(printf(\"%d\",d)):(printf(\"-1\"));\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,k,a[1010],count=0,rem=0,i,flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n if((rem+a[i])>8){\n rem=a[i]-8;\n k=k-8;\n count++;\n\n }\n else{\n k=k-a[i];\n count++;\n\n }\n if(k<=0){flag=count;\n break;\n }\n\n }\n if(flag>0)printf(\"%d\\n\",flag);\n else printf(\"-1\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,j,m,ar[10000];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ar[i]);\n }\n if(n*8 <k)\n printf(\"-1\\n\");\n else\n {\n for(i=0;i<n;i++)\n {\n if(ar[i]<8)\n k=k-ar[i];\n else\n k=k-8;\n }\n if(k<=0)\n printf(\"%d\\n\",i);\n else\n printf(\"-1\\n\");\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,a[100],i;\n scanf(\"%d %d\",&n,&k);\n for (i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n if (n==1&&k>8)\n {\n printf(\"-1\");\n exit(0);\n }\n for(i=0;i<n;i++)\n {\n if (a[i]<=8)\n k-=a[i];\n else\n if (a[i]>8)\n {\n k-=8;\n a[i+1]+=a[i]-8;\n }\n if (k==0)\n {\n printf(\"%d\",i+1);\n exit(0);\n }\n if ((k<8&&i<=n-2&&k>0))\n {\n printf(\"%d\",i+2);\n exit(0);\n }\n }\n if(k!=0)\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "i,I,a[103],s,r,p;main(){for(;~scanf(\"%d\",++i+a);i>2?r+=a[i],p=r>8?8:r,s+=p,r-=p,a[2]/s&&!I?I=i:0:0);printf(\"%d\",I?I:-1);}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d %d\",&n,&k);\n int i,p[n],sum=0;\n for(i=0;i<n;i++){\n scanf(\"%d\",p+i);\n sum+=p[i];\n }\n if(8*n>=k){\n int l=0,c=0;\n while(c<n&&sum!=0){\n l+=8;c++;\n sum+=-8;\n if(l>=k)break;\n }\n if(l>=k)printf(\"%d\",c);\n else printf(\"-1\");\n }\n\n\n else printf(\"-1\\n\");\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,i,count=0,l=0,m;\nscanf(\"%d\",&n);\nint arr[n];\nscanf(\"%d\",&k);\nm=k;\nfor (i=0 ;i<n ;i++)\n{\n scanf(\"%d\",&arr[i]);\n }\n for (i=0 ; i<n ; i++)\n {\n\nif(n*8<k)\n{\nprintf(\"-1\\n\");\nbreak;\n}\nelse\n {\nif(arr[i]>8 && m>8)\n{\nm= m-8;\ncount +=8;\nl++;\n}\nelse\n{\nif(arr[i]>m)\n{\ncount +=m;\nl++;\n}\nelse\n{\n if(m>arr[i]){\nm= m-arr[i];\ncount +=arr[i];\nl++;}\nelse\n{\n count +=m;\n l++;\n}\n}\n}}\nif(m==0 || count==k)\n{\nprintf(\"%d\\n\",l);\nbreak;\n}\n\n}\nreturn 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main(n,k)\n{scanf(\"%d%d\",&n,&k);\nint i,a,t=0,c=0;\nfor(i=0;i<n && c<k;i++)\n{\nscanf(\"%d\",&a);\nt+=a;\nif(t>8)\n{\nc+=8;\nt=t-8;\n}\nelse\t\n{\nc+=t;\nt=0;\t\n}\t\n}\n//printf(\"%d\\n\",c);\nif(c>=k && i<n)\nprintf(\"%d\",i+1);\nelse if(c>=k && i==n)\nprintf(\"%d\",i);\nelse \nprintf(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#include <string.h>\nint main(int argc, char const *argv[])\n{\n\tint n,k;\n\tscanf(\"%d %d\",&n,&k);\n int a[n];\n\tfor(int i=0;i<n;i=i+1){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint count=0;\n\tfor(int i=0;i<n-1;i=i+1){\n\t\tif(a[i]>8){\n\t\t\ta[i]=8;\n\t\t\ta[i+1]+=a[i]-8;\n\t\t}\n\t}\n\tif(a[n-1]>8){\n\t\ta[n-1]=8;\n\t}\n\tfor(int i=0;i<n;i=i+1){\n\t\tif(k>0){\n\t\t\tk-=a[i];\n\t\t\tcount+=1;\n\t\t}\n\t}\n\tif(k>0){\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,s=0,s1=0,i,a[100];\n scanf(\"%d %d\",&n,&k);\n for(i=1;i<n+1;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n if(s>=8 && k>=s)\n {\n s=s-8;\n k=k-8;\n if(k<=0)\n\n {\n printf(\"%d\",i);\n return 0;\n }\n\n }\n else if (s>=8 && k<s)\n {\n\n printf(\"%d\",i);\n return 0;\n }\n else if (s<8 && k>=s)\n {\n k=k-s;\n s=0;\n if(k<=0)\n\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n\n else if(s<8 && k<s)\n\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n\n if(k>0)\n {\n printf(\"-1\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n\n int a[n];\n int sum,day,i,j;\n sum=0;\n day=0;\n j=0;\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n a[i]=a[i]+j;\n if(a[i]<8)\n {\n sum+=a[i];\n }\n else\n {\n sum+=8;\n j=a[i]-8;\n }\n if(sum>=k){\n day=i+1;\n sum=-100000000;\n }\n }\n if(day==0&&k<8&&k<a[i]){day=1;}\n if(day==0){day=-1;}\n printf(\"%d\",day);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, k, i, a, b;\n\tb = 0;\n\tscanf(\"%d%d\", &n, &k);\n\tfor (i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\ta = a + b;\n\t\tif (a > 8)\n\t\t{\n\t\t\tb = a - 8;\n\t\t\tk = k - 8;\n\t\t}\n\t\telse k=k-a;\n\t\tif (k <= 0) break;\n\t}\n\tif (i <= n)\n\t\tprintf(\"%d\", i);\n\telse if (i==n,k>0) printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tint n,k,x,sum=0,m=0,b=0;\n\tscanf(\"%d%d\",&n,&k);\n\tint i;\n\t\n\tfor (i=1;i<=n;i++){\n\t\tscanf(\"%d\",&x);\n\t\tif (x==0)\n\t\tbreak;\n\t\tx+=b;\n\t\tif (x>8){\n\t\t\tb=x-8;\n\t\t\t x=8;\n\t\t} \n\t\tsum+=x;\n\t\tm++;\n\t\tif (sum>=k) break;\n\t}\n\t\n\tif (sum>=k) printf(\"%d\\n\",m);\n\telse printf(\"-1\");\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n,k,*a,i,count=0;\n\tscanf(\"%d%d\",&n,&k);\n\ta = (int *)malloc(sizeof(int)*n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\ti = 0;\n\twhile((k>0)&&(i<n))\n\t{\n\t\tif(k<=8)\n\t\t\tk = k-a[i];\n\t\telse\n\t\t{\n\t\t\tk = k-8;\n\t\t\ta[i+1] = a[i+1]+(a[i]-8);\n\t\t}\n\t\t//printf(\"%d\\n\",k);\n\t\tcount++;\n\t\ti++;\n\t\t\n\t\t\n\t}\n\tif(k<=0)\n\t\tprintf(\"%d\\n\",count);\n\telse\n\t\tprintf(\"-1\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tint n, k, a=0, nDay=0;\n\t// k = numero de doces desejado\n\t// n = numero de dias\n\t// a = qtde de doce do dia\n\n\tint i, tot=0, sobra=0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &k);\n\n\tfor(i=0; i<n; i++) {\n\t\tscanf(\"%d\", &a); \n\t\tsobra += a;\n\t\tif(sobra>=8) {\n\t\t\tsobra-=8;\n\t\t\tk-=8;\n\t\t}\n\t\telse {\n\t\t\tk -= a;\n\t\t\tsobra = 0;\n\t\t}\n\t\tnDay++;\n\t\tif(k<=0) break;\n\t}\n\tif(k<=0) printf(\"%d\\n\", nDay);\n\telse printf(\"-1\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100],i,j,n,m,count=0,sum=0;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==m&&a[i]==8)\n {\n count=count+1;\n }\n else if(a[i]>=8&&n!=1)\n {\n m=m-8;\n count=count+1;\n\n }\n else if(a[i]<8)\n {\n m=m-a[i];\n count=count+1;\n }\n sum=sum+a[i];\n }\n if(count==0||sum<m)\n {\n printf(\"-1\");\n }\n else{\n printf(\"%d\\n\",count);}\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,k,a[10000],i,j,sum=0,flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>8)a[i]=8;\n }\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n if(sum>=k)\n {\n printf(\"%d\\n\",i+1);flag=1;break;\n }\n }\n if(flag==0)printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, k, candy, days=0, i, ans=0, temp=0, remain=0;\n scanf(\"%d%d\", &n, &k);\n for(i=0; i<n; i++){\n scanf(\"%d\", &candy);\n candy+=remain;\n if(candy<=8) ans+=candy;\n else{\n remain = candy-8;\n ans+=8;\n }\n days++;\n if(ans>=k){\n temp=1;\n break;\n }\n }\n if(k==0) days = 0;\n if(temp) printf(\"%d\\n\", days);\n else printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,r=0,x=0,p=0;\n scanf(\"%d %d\",&n,&k);\n int ara[n];\n for(i=0; i<n ;i++)\n {\n scanf(\"%d\",&ara[i]);\n ara[i]=x+ara[i];\n if(ara[i]>8 )\n {\n x=ara[i];\n ara[i]=8;\n\n\n }\n else x=0;\n p=ara[i]+p;\n\n r++;\n if(p>=k)\n break;\n }\n if(r<=n && p>=k)\n printf(\"%d\",i+1);\n else\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "//Name: Bui Minh Khoa\n//Code: 1753005\n//Ex 839A\n\n#include <stdio.h>\n\nint main()\n{\n\tint day, candy, a,give=0,spare=0,time=1;\n\tscanf(\"%d %d\", &day, &candy);\n\n\tfor (; day > 0; day--)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\tif (a >= 8)\n\t\t{\n\t\t\tgive = give + 8;\n\t\t\tspare = spare + a - 8;\n\t\t}\n\t\telse\n\t\t\tgive = give + a;\n\t\tif (give < candy)\n\t\t\ttime++;\n\t\telse\n\t\t\tbreak;\n\t}\n\tif (give < candy)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\", time);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int n,k,i,a,count=0,c=0,b=0;\n scanf(\" %d %d\",&n,&k);\n\n for(i=0;i<n;i++)\n {\n scanf(\" %d\",&a);\n a=a+b;\n\n if(a<8 && c<k){\n c+=a;\n count++;\n }\n else if(c<k){\n c+=8;\n b=a-8;\n count++;\n }\n }\n\n if(c>=k)\n printf(\"%d\\n\",count);\n else\n printf(\"-1\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[101],i,sum=0,s=0,n,m,count=0,p;\n int x=0,j,r;\n scanf(\"%d %d\",&n,&m);\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n }\n for(i=0; i<n; i++)\n\n {\n\n if(m>s)\n {\n {\n if(a[i]>=8)\n {\n x+=(a[i]-8);\n a[i]=8;\n\n }\n\n s+=a[i];\n }\n\n }\n else\n break;\n\n }\n p=sum-s;\n\n if((s)>=m)\n {\n {\n if(m%8==0)\n j=m/8;\n else\n j=(m/8)+1;\n }\n {\n if(j==i)\n printf(\"%d\",i);\n else\n {\n r=i-j;\n if((8*r)<=p)\n printf(\"%d\",i-r);\n else\n printf(\"%d\",i); \n }\n }\n\n // printf(\"%d %d %d\",i,s,x);\n }\n else\n printf(\"-1\");\n return 0;\n\n // printf(\"%d %d\",count,sum);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,a[100],i=0,sum=0;\nscanf(\"%d %d\",&n,&k);\nfor(i=0;i<n;i++)\n{\n scanf(\"%d\",&a[i]);\n}\nwhile(n!=0)\n{\n sum=sum+8;\n if(sum>=k)\n {\n printf(\"%d\",i);\n break;\n }n--;\n}\nif(sum<k)\n{\n printf(\"-1\");\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,i,a=0,b=0,c=0,d=0;\n scanf(\"%d %d\",&n,&k);\n int ar[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n \n for(i=0;i<n;i++)\n {\n while(a<k)\n {\n if(ar[i]==8)\n {\n a+=ar[i];\n b+=1;\n }\n else if(ar[i]<8)\n {\n if(ar[i]+c>=8)\n {\n a+=8;\n c=c-(8-ar[i]);\n b+=1;\n }\n else\n {\n a+=(ar[i]+c);\n c==0;\n b+=1;\n }\n }\n else\n {\n a+=8;\n c+=ar[i]-8;\n b+=1;\n }\n }\n }\n if(a<k)\n printf(\"-1\");\n else\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,k,a[1010],count=0,rem=0,i,flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++){\n if((rem+a[i])>=8){\n rem=(rem+a[i])-8;\n k=k-8;\n count++;\n\n }\n else{\n k=k-a[i];\n count++;\n\n }\n if(k<=0){flag=count;\n break;\n }\n\n }\n if(flag>0)printf(\"%d\\n\",flag);\n else printf(\"-1\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,sum=0;\n scanf(\"%d %d\",&n,&k);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n\n for(i=0;i<n;i++)\n {\n if(sum<k)\n {\n if(a[i]>8)\n {\n a[i+1] = a[i+1]+(a[i]-8);\n sum = sum +8;\n }\n else\n {\n sum = a[i];\n }\n }\n else\n {\n break;\n }\n }\n\n if(sum<k)\n printf(\"%d\",-1);\n else\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[100005];\nint main()\n{\n int n,k,i;\n int flag=0;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n\n for(i=1;i<=n;i++)\n {\n if(a[i]>8)\n {\n k-=8;\n }\n else k-=a[i];\n if(k<=0)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n printf(\"%d\\n\",i);\n else printf(\"-1\\n\");\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,k,i,a=0,j,c,b=0;\nscanf(\"%d %d\",&n,&k);\nint A[n];\nfor(i=1;i<=n;i++){\n scanf(\"%d\",&A[i]);\n\n if(A[i]>8){\n b=b+A[i]-8;\n A[i]=8;\n for(j=i;j<=n;j++){\n if(A[j]>8)\n continue;\n if(A[j]<=8){\n if(8-A[j]>=b){\n A[j]=A[j]+b;\n b=0;\n }\n else if(8-A[j]<b){\n b=b+A[j]-8;\n A[j]=8;\n\n }\n\n }\n }\n }\n a=a+A[i];\n if (a>=k)\n break;\n\n}\nif(i<=n)\nprintf(\"%d\",i);\nelse\n printf(\"-1\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,a,i=0,j,m=0,x;\n scanf(\"%d%d\",&n,&k);\n while(n--)\n {\n scanf(\"%d\",&a);\n x=x+a+m;\n if(x<=8)\n k=k-x;\n else if(x>=8)\n {\n k=k-8;\n m=x-8;\n }\n i++;\n if(k<=0)\n j=i;\n }\n if(k<=0) printf(\"%d\",j);\n else\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],s=0,i;\n scanf(\"%d%d\",&n,&k);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n s+=a[i];\n }\n if(s<k||(n*8)<k)\n {\n printf(\"-1\\n\");\n return 0;\n }\n s=0;\n for(i=0; i<n; i++)\n {\n s+=a[i];\n if(s>=8)\n s-=8,k-=8;\n if(k<=0)\n break;\n }\n printf(\"%d\\n\",i+1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint cmp(const void *a,const void *b)\n{\n\treturn *(int *)a-*(int *)b;\n}\n\nint main()\n{\n\tint i,n,k,a[1005],sum=0,temp=0;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\n\t}\t\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]>=8)\n\t\t{\n\t\t\tsum+=8;\n\t\t\ttemp+=(a[i]-8);\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp+=a[i];\n\t\t\tif(a[i]>=8)\n\t\t\t{\n\t\t\t\ttemp-=8;\n\t\t\t\tsum+=8;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum+=temp;\n\t\t\t\ttemp=0;\n\t\t\t}\n\t\t}\n\t\tif(sum>=k)\n\t\t\tbreak;\n\t}\n\tif(sum>=k)\n\t{\n\t\tprintf(\"%d\\n\",i+1);\n\t}\n\telse\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\n\n\t\n\t\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tint n, k, a, nDay=0;\n\t// k = numero de doces desejado\n\t// n = numero de dias\n\t// a = qtde de doce do dia\n\n\tint i, tot=0, sobra=0;\n\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &k);\n\n\tfor(i=0; i<n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\ta = a+sobra;\n\t\tif(a>8) {\n\t\t\ta=a-8;\n\t\t\tsobra+=a;\n\t\t\ttot += 8;\n\t\t}\n\t\telse {\n\t\t\ttot += a;\n\t\t}\n\t\tnDay++;\n\t\tif(tot==k) break;\n\t}\n\tif(tot>=k)\n\t\tprintf(\"%d\\n\", nDay);\n\telse\n\t\tprintf(\"-1\\n\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "//Name: Bui Minh Khoa\n//Code: 1753005\n//Ex 839A\n\n#include <stdio.h>\n\nint main()\n{\n\tint day, candy, a, give = 0, spare = 0, time = 1;\n\tscanf(\"%d %d\", &day, &candy);\n\n\tfor (; day > 0; day--)\n\t{\n\t\tscanf(\"%d\", &a);\n\t\tif (a > 8)\n\t\t{\n\t\t\tgive = give + 8;\n\t\t\tspare = spare + a - 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tgive = give + a;\n\t\t\tif (spare+a > 8)\n\t\t\t\tgive = give + 8-a;\n\t\t\telse\n\t\t\t\tgive = give + spare;\n\t\t}\n\t\tif (give < candy)\n\t\t\ttime++;\n\t\telse\n\t\t\tbreak;\n\t}\n\tif (give < candy || time<day)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\", time);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint n, k, a, sum, d, i;\n\tscanf(\"%d %d\", &n, &k);\n\n\td = -1;\n\tfor(i=1; i<=n; i++)\t{\n\t\tscanf(\"%d\", &a);\n\t\tif(d==-1)\t{\n\t\tif(a<=8)\t{\n\t\t\tk -= a;\n\t\t\ta = 8-a;\n\t\t\tif(a<=sum)\t{\n\t\t\t\tk -= a;\n\t\t\t\tsum -= a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tk -= sum;\n\t\t\t\tsum = 0;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tk -= 8;\n\t\t\ta -= 8;\n\t\t\tsum += a;\n\t\t}\n\t\tif(k<=0)\td = i;\n\t}\n\t}\n\n\tprintf(\"%d\\n\", d);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[101],i,sum=0,s=0,n,m,count=0;\n scanf(\"%d %d\",&n,&m);\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n\n }\n for(i=0;i<n;i++)\n { if(m>s)\n { if(a[i]>=8)\n {\n count++;\n }\n else\n {\n if(a[i]>=8)\n continue;\n\n else\n sum+=a[i];\n }\n\n }\n else\n break;\n\n }\n if((sum+(count*8))>=m)\n printf(\"%d\",i);\n\n else\n printf(\"-1\");\nreturn 0;\n\n // printf(\"%d %d\",count,sum);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b;\n scanf(\"%d%d\", &a, &b);\n int sum = 0;\n int sum2 = 0;\n int i;\n for ( i = 0; i < a; i++)\n {\n int k;\n scanf(\"%d\", &k);\n if (k > 8)\n {\n sum2 = k - 8;\n sum += 8;\n }\n else\n {\n if (sum2 > (8-k))\n {\n sum2 -= 8-k;\n sum += 8;\n }\n else\n {\n sum +=sum2 + k;\n sum2 = 0;\n }\n }\n //printf(\"sum = %d\\n\",sum);\n if ( sum >= b)\n {\n sum =0;\n break;\n }\n }\n if (sum != 0 )\n {\n printf(\"-1\");\n }\n else\n {\n printf(\"%d\",++i);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,NoOfCandy[100],FlagDone=0,DailyCandy=0;\n scanf(\"%d %d \",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&NoOfCandy[i]);\n }\n for(i=0;i<n;i++){\n if(NoOfCandy[i]<8){\n DailyCandy+=NoOfCandy;\n }\n else {\n DailyCandy+=8;\n }\n if(DailyCandy>=k){\n printf(\"%d\",i+1);\n FlagDone=1;\n break;\n }\n }\n if(FlagDone==0){\n printf(\"-1\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\nint main() {\n\n\tint n, k, a[100];\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &k);\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tint temp = n;\n\tint dem = 0;\n\tfor (int i = 0; i < n; i++) \n\t{ \n\t\tif (k > 0 && temp > 0)\n\t\t{\n\t\t\tif (a[i] > 8) {\n\t\t\t\tk = k - 8;\n\t\t\t\ttemp--;\n\t\t\t\tif (temp == 0 && k > 0) {\n\t\t\t\t\tdem = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdem++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk = k - a[i];\n\t\t\t\ttemp--;\n\t\t\t\tif (temp == 0 && k > 0) {\n\t\t\t\t\tdem = 0;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdem++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (dem == 0)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\", dem);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, k, count = 0, a, remain = 0;\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a);\n a += remain;\n if(a >= 8) {\n count += 8;\n a -= 8;\n } else {\n count += a;\n a = 0;\n }\n if(count >= k) {\n printf(\"%d\\n\", i + 1);\n return 0;\n }\n }\n puts(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,a[100],i;\n scanf(\"%d %d\",&n,&k);\n for (i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n if (n==1&&k>8)\n {\n printf(\"-1\");\n exit(0);\n }\n for(i=0;i<n;i++)\n {\n if (a[i]<=8)\n k-=a[i];\n else\n if (a[i]>8)\n {\n k-=8;\n a[i+1]+=a[i]-8;\n }\n if (k==0)\n {\n printf(\"%d\",i+1);\n exit(0);\n }\n if ((k<8&&i==n-2&&k>0))\n {\n printf(\"%d\",i+2);\n exit(0);\n }\n }\n if(k<0||k>0)\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n for(i=0; i<n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n int given = 0, remain = 0;\n i = 0;\n\n while(given<k && i<n) {\n\n remain = 0;\n for(j=0; j<i; ++j) remain += a[j];\n if(a[i]<8) {\n if(remain+a[i]-8 >= 0) {\n given += 8;\n remain -= 8 - a[i];\n a[i] = 0;\n }\n else if(remain+a[i]-8 < 0) {\n given += remain+a[i];\n remain = 0;\n a[i] = 0;\n }\n }\n else if(a[i]>8) {\n given += 8;\n a[i] -= 8;\n }\n else {\n given += a[i];\n a[i] = 0;\n }\n i++;\n\n }\n if(given<k) printf(\"-1\");\n else printf(\"%d\", i);\n\n return 0;\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#define forn(i,n) for (i = 0; i<n; i++)\n\nint lol(const void *x1, const void *x2)\n{\t\n\treturn *(int*)x1 - *(int*)x2;\n}\n\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}\nint main(void)\n{\n\tint n, k, i, t, sber = 0;\n\tint day, temp;\n\tscanf(\"%i%i\", &n, &k);\n\tforn(i, n)\n\t{\n\t\tscanf(\"%i\", &t);\n\t\tif (t > 8)\n\t\t{\n\t\t\tsber += t - 8;\n\t\t\tt = 8;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp = 8 - t;\n\t\t\tif (sber >= temp)\n\t\t\t{\n\t\t\t\tt += temp;\n\t\t\t\tsber -= temp;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt += sber;\n\t\t\t\tsber = 0;\n\t\t\t}\n\t\t}\n\t\tk -= t;\n\t\tif (k <= 0)\n\t\t\tday = i + 1;\n\t}\n\tif (k > 0)\n\t\tday = -1;\n\tprintf(\"%i\", day);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define maxn 105\nint a[maxn];\nint main()\n{\n int n,k,i,count_k=0,days=0,temp=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++)\n {\n\n if(a[i]>=8)\n {\n count_k+=8;\n temp=temp+a[i]-8;\n }\n else if(a[i]+temp>=8)\n {\n temp=temp-8;\n count_k+=8;\n }\n else count_k+=a[i];\n days++;\n if(count_k>=k)\n {\n printf(\"%d\\n\",days);\n return 0;\n }\n }\n printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j=0,k,m=0,n;\n\n scanf(\"%d %d\",&n,&k);\n\n int a[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>8)\n {\n a[i]=8;\n }\n m+=a[i];\n\n j++;\n\n if(m>=k)\n {\n printf(\"%d\\n\",j);\n }\n }\n if(m<k)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint min(int a,int b){return (a<b)?a:b;}\nint main()\n{\n int i,n,k;\n scanf(\"%d%d\",&n,&k);\n int left=k;\n int total=0;\n for(i=0;i<n;i++)\n {\n int ele;\n scanf(\"%d\",&ele);\n total+=ele;\n left-=min(total,8);\n if(left<=0) break;\n }\n if(left>0) printf(\"-1\\n\");\n else printf(\"%d\\n\",i+1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,k,i,a[1000];\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint sum=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(sum<k&&a[i]<8)\n\t\t{\n\t\t\tsum+=a[i];\n\t\t}\n\t\telse if(sum<k&&a[i]>=8)\n\t\t{\n\t\t\tsum+=8; \n\t\t}\n\t\tif(sum>=k)\n\t\t\tbreak;\t\n\t}\n\tif(i==n)\n\t\tprintf(\"-1\\n\");\n\telse\n\t\tprintf(\"%d\\n\",++i);\n\treturn 0;\n} \n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,k,s,g=0,t=0;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&s);\n\t\tt+=s;\n\t\tif(t<=8) {k-=t;t=0;} \n\t\telse {t-=8; k-=8;}\n\t\tg++;\n\t}\n\tif(k>0) printf(\"%d\\n\", -1);\n\telse printf(\"%d\\n\", g);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void) {\n\tint n, k, sum = 0, rem = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tfor (int i = 1; i <= n; i++) {\n\t\tint box;\n\t\tscanf(\"%d\", &box);\n\t\tif (box > 8) {\n\t\t\tsum += 8;\n\t\t\trem += box - 8;\n\t\t}\n\t\telse {\n\t\t\tsum += box;\n\t\t}\n\t\t\n\t\tif (sum >= k) {\n\t\t\tprintf(\"%d\", i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int num,k,i;\n scanf(\"%d%d\",&num,&k);\n int ara[num],sum=0;\n for(i=0;i<num;i++)\n {\n scanf(\"%d\",&ara[i]);\n sum=sum+ara[i];\n }\n if(sum<k) printf(\"-1\\n\");\n else if(num*8<k) printf(\"-1\\n\");\n else\n {\n for(i=1;i<=num;i++)\n {\n if(ara[i-1]<=8) k=k-ara[i-1];\n else if(ara[i-1]>8)\n {\n k=k-8;\n ara[i]+=ara[i-1]%8;\n }\n if(k<=0)\n break;\n }\n printf(\"%d\\n\",i);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define maxn 105\nint a[maxn];\nint main()\n{\n int n,k,i,count_k=0,days=0,temp=0;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++)\n {\n\n if(a[i]>=8)\n {\n count_k+=8;\n temp=temp+a[i]-8;\n }\n else if(a[i]+temp>=8)\n {\n temp=temp-8;\n count_k+=8;\n }\n else count_k+=a[i];\n days++;\n if(count_k>=k)\n {\n printf(\"%d\\n\",days);\n return 0;\n }\n }\n printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i,c=0,count=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(c>=k)\n break;\n if(a[i]>=0)\n {\n if(a[i]>8)\n {\n a[i+1]=a[i]-8;\n c=c+8;\n }\n else\n {\n c=c+a[i];\n }\n }\n count++;\n }\n if(c>=k)\n {\n printf(\"%d\\n\",count);\n }\n else\n {\n printf(\"-1\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int cmpfunc( const void *a, const void *b) {\n return *(long long int*)a - *(long long int *)b;\n}\n\nint main()\n{\n long long int test,d,n,x,i,sum=0,count=0,j,flag=0,p,y,m,max=0,o,g,r,k, a[1000000],sum1=0;\nscanf(\"%lld%lld\",&n,&m);\ncount=0;\nsum=0;\nsum1=0;\nfor(i=0;i<n;i++){\n scanf(\"%lld\",&a[i]);\n if(a[i]>=8){\n sum+=8;\n sum1+=a[i]-8;\n count++;\n }else{\n \n sum+=a[i];\n if(8-a[i]<=sum1){\n sum+=8-a[i];\n sum1-=8-a[i];\n }\n count++;\n }\n if(sum>=m){\n break;\n }\n \n}\n\nif(sum>=m){\n printf(\"%lld\",count);\n}else{\n printf(\"-1\");\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main() {\n\tint n, k, i, sum = 0;\n\tscanf(\"%d%d\", &n, &k);\n\tint x;\n\tint r = 0;\n\tfor(i = 1; i <= n; i++){\n\t\tscanf(\"%d\", &x);\n\t\tx = x + r;\n\t\tif(x >= 8){\n\t\t\tr = x - 8;\n\t\t\tx = 8;\n\t\t}\n\t\tsum = sum + x;\n\t\tif(sum >= k){\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\texit(0);\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}\n"}], "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a"} {"nl": {"description": "Petya and Vasya decided to play a little. They found n red cubes and m blue cubes. The game goes like that: the players take turns to choose a cube of some color (red or blue) and put it in a line from left to right (overall the line will have n\u2009+\u2009m cubes). Petya moves first. Petya's task is to get as many pairs of neighbouring cubes of the same color as possible. Vasya's task is to get as many pairs of neighbouring cubes of different colors as possible. The number of Petya's points in the game is the number of pairs of neighboring cubes of the same color in the line, the number of Vasya's points in the game is the number of neighbouring cubes of the different color in the line. Your task is to calculate the score at the end of the game (Petya's and Vasya's points, correspondingly), if both boys are playing optimally well. To \"play optimally well\" first of all means to maximize the number of one's points, and second \u2014 to minimize the number of the opponent's points.", "input_spec": "The only line contains two space-separated integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009105) \u2014 the number of red and blue cubes, correspondingly.", "output_spec": "On a single line print two space-separated integers \u2014 the number of Petya's and Vasya's points correspondingly provided that both players play optimally well.", "sample_inputs": ["3 1", "2 4"], "sample_outputs": ["2 1", "3 2"], "notes": "NoteIn the first test sample the optimal strategy for Petya is to put the blue cube in the line. After that there will be only red cubes left, so by the end of the game the line of cubes from left to right will look as [blue, red, red, red]. So, Petya gets 2 points and Vasya gets 1 point. If Petya would choose the red cube during his first move, then, provided that both boys play optimally well, Petya would get 1 point and Vasya would get 2 points."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int b,c,i,x=0,y=0,x1=0,y1=0,b1,c1;\n scanf(\"%d%d\",&b,&c);\n b1=b;c1=c;\n int a[b+c];\n\n a[0]=0;b--;\n for(i=1;i<b1+c1;i++)\n {\n if(b<=0)\n {\n a[i]=1;c--;\n }\n else if(c<=0)\n {\n a[i]=0;b--;\n }\n else if(i%2==1)\n {\n if(a[i-1]==0)\n {\n a[i]=1;c--;\n }\n else\n {\n a[i]=0;b--;\n }\n }\n else\n {\n if(a[i-1]==0)\n {\n a[i]=0;b--;\n }\n else\n {\n a[i]=1;c--;\n }\n }\n if((a[i]+a[i-1])%2==0)\n x++;\n else\n y++;\n }\n\n\n\n b=b1;c=c1;\n a[0]=1;c--;\n for(i=1;i<b1+c1;i++)\n {\n if(b<=0)\n {\n a[i]=1;c--;\n }\n else if(c<=0)\n {\n a[i]=0;b--;\n }\n else if(i%2==1)\n {\n if(a[i-1]==0)\n {\n a[i]=1;c--;\n }\n else\n {\n a[i]=0;b--;\n }\n }\n else\n {\n if(a[i-1]==0)\n {\n a[i]=0;\n b--;\n }\n else\n {\n a[i]=1;\n c--;\n }\n }\n if((a[i]+a[i-1])%2==0)\n x1++;\n else\n y1++;\n }\n if(x>x1)\n printf(\"%d %d\",x,y);\n else\n printf(\"%d %d\",x1,y1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n>m)\n {\n printf(\"%d %d\",n-1,m);\n }\n else\n {\n printf(\"%d %d\",m-1,n);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar ans[1234567];\n\nint main(){\n\n\tint n, m;\n\tscanf(\"%d%d\", &n, &m);\n\n\tint cnt = 0, nn = n, mm = m, p, q, r, s;\n\n\tfor(int i = 0; i < n + m; i++){\n\t\t\n\t\tif(i == 0){\n\t\t\tif(nn < mm && nn){\n\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t--nn;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t--mm;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tif(i & 1){\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\telse{\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] ='b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\t\n\n\t// printf(\"%s\\n\", ans);\n\n\tint a = 0, b = 0;\n\tfor(int i = 0; i < cnt - 1; i++){\n\t\tif(ans[i] == ans[i + 1]){\n\t\t\t++a;\n\t\t}\n\t\telse{\n\t\t\t++b;\n\t\t}\n\t}\n\n\tp = a, q = b , cnt = 0, nn = n, mm = m;\n\n\tfor(int i = 0; i < n + m; i++){\n\t\t\n\t\tif(i == 0){\n\t\t\tif(nn > mm && nn){\n\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t--nn;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t--mm;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tif(i & 1){\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\telse{\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] ='b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\ta = 0, b = 0;\n\tfor(int i = 0; i < cnt - 1; i++){\n\t\tif(ans[i] == ans[i + 1]){\n\t\t\t++a;\n\t\t}\n\t\telse{\n\t\t\t++b;\n\t\t}\n\t}\n\n\tr = a, s = b;\n\n\t// printf(\"%s\\n\", ans);\n\n\tif(p > r){\n\t\tprintf(\"%d %d\\n\", p, q);\n\t}\n\telse{\n\t\tprintf(\"%d %d\\n\", r, s);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\n\tif(n < m){\n\t\tint tmp;\n\t\ttmp = n, n = m, m = tmp;\n\t}\n\n\tprintf(\"%d %d\\n\", --n, m);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tlong int n,m;\n\tscanf(\"%ld%ld\",&n,&m);//n-->red m-->blue cubes\n\tif(n>m){\n\t\tprintf(\"%ld %ld\",n-1,m);\n\t}else{\n\t\tprintf(\"%ld %ld\",m-1,n);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tif(n > m)\n\t\tprintf(\"%d %d\\n\", n - 1, m);\n\telse printf(\"%d %d\\n\", m - 1, n);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint n,m;\nint main()\n{\n scanf(\"%i %i\",&n,&m);\n int m1,m2;\n if (n<=m)\n {\n m1=n;m2=m;\n }\n else{m1=m;m2=n;}\n printf(\"%i %i\",m2-1,m1);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tint a[2],prvi,drugi,temp,pet=0,vas=0;\n\tscanf(\"%d %d\",&a[0],&a[1]);\n\n\tif(a[0]%2==0 && a[1]%2==0) prvi=(a[0]<a[1])?1:0;\n\telse if(a[0]%2!=0 && a[1]%2!=0) prvi=(a[0]<a[1])?0:1;\n\telse if(a[0]%2!=0) prvi=0;\n\telse prvi=1;\n\n\ttemp=1;a[prvi]--;\n\twhile(a[0]+a[1]!=0){\n\t\tif(temp){\n\t\t\tif(a[!prvi]!=0){ vas++; a[!prvi]--; prvi=!prvi; }\n\t\t\telse{ pet++; a[prvi]--; }\n\t\t}\n\t\telse{\n\t\t\tif(a[prvi]!=0){ pet++; a[prvi]--; }\n\t\t\telse{ vas++; a[!prvi]--; prvi=!prvi; }\n\t\t}\n\t\ttemp=!temp;\n\t}\n\tprintf(\"%d %d\",pet,vas);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str1[500000],str2[500000];\n\tint m, n;\n\tscanf(\"%d %d\", &n, &m);\n\tint i, j, k;\n\tint countRed=n, countBlue=m;\n\tstr1[0]='r';\n\tfor(i=1;i<=m+n;i++)\n\t{\n\t\tif(i%2==1)\n\t\t{\n\t\t\tif(str1[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str1[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(str1[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str1[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tstr2[0]='b';\n\tcountBlue=m;countRed=n;\n\tfor(i=1;i<=m+n;i++)\n\t{\n\t\tif(i%2==1)\n\t\t{\n\t\t\tif(str2[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str2[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(str2[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str2[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tint count1=0, count2=0,count3=0, count4=0;\n\t//printf(\"%s %s\",str1, str2);\n\tfor(i=1;i<strlen(str1)-1;i++)\n\t{\n\t\tif(str1[i]==str1[i+1])\n\t\t count1++;\n\t\telse\n\t\t\tcount3++;\n\t\tif(str2[i]==str2[i+1])\n\t\t\tcount2++;\n\t\telse\n\t\t\tcount4++;\n\t}\n\tif(count1>count2)\n\t\tprintf(\"%d %d\\n\",count1, count3);\n\telse\n\t\tprintf(\"%d %d\\n\",count2, count4);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, x, y, z, w, ans = 0, i;\n \n scanf(\"%d %d\", &n, &m);\n \n x = n - 1;\n y = m;\n z = 0;\n w = 0;\n \n for (i = 1; i < n + m; i++) {\n if (x == 0) {\n if (w == 1) z++;\n \n y--;\n \n w = 1;\n } else if (y == 0) {\n if (w == 0) z++;\n \n x--;\n \n w = 0;\n } else if (i % 2 == 0) {\n if (w == 0) {\n x--;\n } else {\n y--;\n }\n \n z++;\n } else {\n if (w == 0) {\n y--;\n } else {\n x--;\n }\n \n w = 1 - w;\n }\n }\n \n if (z > ans) ans = z;\n \n x = n;\n y = m - 1;\n z = 0;\n w = 1;\n \n for (i = 1; i < n + m; i++) {\n if (x == 0) {\n if (w == 1) z++;\n \n y--;\n \n w = 1;\n } else if (y == 0) {\n if (w == 0) z++;\n \n x--;\n \n w = 0;\n } else if (i % 2 == 0) {\n if (w == 0) {\n x--;\n } else {\n y--;\n }\n \n z++;\n } else {\n if (w == 0) {\n y--;\n } else {\n x--;\n }\n \n w = 1 - w;\n }\n }\n \n if (z > ans) ans = z;\n \n printf(\"%d %d\\n\", ans, n + m - ans - 1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n+m];\n\tint end=n+m;\n\tint k=0;\n\tint maxs=0,maxd=0;\n\tint nr=n;\n\tint mr=m;\n\tfor(k=0;k<2;k++)\n\t{\n\t\tn=nr;\n\t\tm=mr;\n\t\tint turn=0;\n\t\tif(k%2==0)\n\t\t{\ta[0]=1;n--;}\n\t\telse\n\t\t{\ta[0]=2;m--;}\n\tfor(i=1;i<end;i++)\n\t{\n\t\tif(turn%2==0)\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0)\n\t\t\t\t{a[i]=1;n--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\t\n\t\t\t\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\n\t\t\t\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0){a[i]=1;n--;}\n\t\t\t}\n\n\t\t}\n\t\tturn++;\n\t}\n\tint same=0;\n\tint diff=0;\n//\tprintf(\"%d \",a[0]);\n\tfor(i=1;i<end;i++)\n\t{\n//\t\tprintf(\"%d \",a[i]);\n\t\tif(a[i-1]==a[i])\n\t\t\tsame++;\n\t\telse\n\t\t\tdiff++;\n\t}\n//\tprintf(\"%d %d\\n\",same,diff);\n\tif(maxs<=same)\n\t{\tmaxs=same;maxd=diff;}\n\t}\n\tprintf(\"%d %d\\n\",maxs,maxd);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n \t\t\t\t\tint pet,vas,n,m,min,max;\n \t\t\t\t\tscanf(\"%d %d\",&n,&m);\n \t\t\t\t\tmax=n>m?n:m;\n \t\t\t\t\tmin=n>m?m:n;\n \t\t\t\t\tpet=max-1-(max%2&&!min%2?1:0);\n \t\t\t\t\tvas=min+(max%2&&!min%2?1:0);\n \t\t\t\t\tprintf(\"%d %d\\n\",pet,vas);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid func(int ln, int lm, int last, int *_ps, int *_vs)\n{\n int ps, vs, t;\n ps = vs = t = 0;\n while (ln > 0 || lm > 0)\n {\n if (t == 0)\n {\n if (last == 0)\n {\n if (lm > 0)\n {\n last = 1;\n vs ++;\n lm --;\n }\n else\n {\n ps ++;\n ln --;\n }\n }\n else\n {\n if (ln > 0)\n {\n last = 0;\n vs ++;\n ln --;\n }\n else\n {\n ps ++;\n lm --;\n }\n }\n }\n else\n {\n if (last == 0)\n {\n if (ln > 0)\n {\n ps ++;\n ln --;\n }\n else\n {\n last = 1;\n vs ++;\n lm --;\n }\n }\n else\n {\n if (lm > 0)\n {\n ps ++;\n lm --;\n }\n else\n {\n last = 0;\n vs ++;\n ln --;\n }\n }\n }\n t = 1 - t;\n }\n *_ps = ps;\n *_vs = vs;\n}\n\nvoid solve(int n, int m)\n{\n int ps, vs, px, vx;\n func(n - 1, m, 0, &ps, &vs);\n func(n, m - 1, 1, &px, &vx);\n if (ps > px)\n {\n printf(\"%d %d\\n\", ps, vs);\n }\n else if (ps < px)\n {\n printf(\"%d %d\\n\", px, vx);\n }\n else if (vs < vx)\n {\n printf(\"%d %d\\n\", ps, vs);\n }\n else\n {\n printf(\"%d %d\\n\", px, vx);\n }\n}\n\nint main()\n{\n int n, m;\n while (scanf(\"%d%d\", &n, &m) == 2)\n {\n solve(n, m);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tif(n>m)\n\tprintf(\"%d %d\",n-1,m);\n\telse\n\tprintf(\"%d %d\",m-1,n);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, m;\n int s1, s2;\n scanf(\"%d %d\", &n, &m);\n\n s2 = n < m ? n : m;\n s1 = n + m - s2 - 1;\n printf(\"%d %d\\n\", s1, s2);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\n#define MAXN 100002\n\n#define R 0x1\n#define B 0x2\n\nunsigned char balls[MAXN+MAXN];\n\nvoid solve(int prev, int r, int b, int *s1, int *s2) {\n\tint turn = 0x1;\n\tint curr;\n\tif (prev == R) r--;\n\telse b--;\n\t*s1 = 0;\n\t*s2 = 0;\n\twhile (r + b > 0) {\n\t\tif (turn == 0) {\n\t\t\tif (prev == R) {\n\t\t\t\tif (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tcurr = R;\n\t\t\t\t}\n\t\t\t\telse if (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tcurr = B;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tcurr = B;\n\t\t\t\t} else if (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tcurr = R;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (prev == R) {\n\t\t\t\tif (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tcurr = B;\n\t\t\t\t} else if (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tcurr = R;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tcurr = R;\n\t\t\t\t} else if (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tcurr = B;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (prev == curr) ++(*s1);\n\t\telse ++(*s2);\n\t\tturn ^= 0x1;\n\t\tprev = curr;\n\t}\n}\n\nint main() {\n\tint s1, s2;\n\tint s3, s4;\n\tint r, b;\n\tscanf(\"%d %d\", &r, &b);\n\n\tsolve(R, r, b, &s1, &s2);\n\tsolve(B, r, b, &s3, &s4);\n\tif (s1 > s3) {\n\t\tprintf(\"%d %d\\n\", s1, s2);\n\t} else {\n\t\tprintf(\"%d %d\\n\", s3, s4);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int blue, red; //number of blue cubes, red cubes left\n scanf(\"%d %d\", &red, &blue);\n int i; \n\n //blue first\n int blue_b = blue, red_b = red; \n int same_b = 0, diff_b = 0; //peter = same, vasya = diff\n\n char prev = 'b'; \n blue_b--; \n\n for(i = 1; i < blue+red; i++) {\n if(i % 2 == 1) { //vasya's turn, wants different\n if(prev == 'b') {\n\tif(red_b > 0) {\n\t red_b--; \n\t prev = 'r'; \n\t diff_b++; \n\t}\n\telse{\n\t blue_b--; \n\t same_b++; \n\t}\n }\n else if(prev == 'r') {\n\tif(blue_b > 0) {\n\t blue_b--;\n\t prev = 'b'; \n\t diff_b++;\n\t}\n\telse {\n\t red_b--;\n\t same_b++; \n\t}\n } \n }\n\n if(i % 2 == 0) { //petya's turn, wants same \n if(prev == 'r') {\n\tif(red_b > 0) {\n\t red_b--; \n\t same_b++; \n\t}\n\telse {\n\t blue_b--;\n\t diff_b++;\n\t prev = 'b'; \n\t}\n }\n else if(prev == 'b') {\n\tif(blue_b > 0) {\n\t blue_b--;\n\t same_b++; \n\t}\n\telse {\n\t red_b--; \n\t diff_b++;\n\t prev = 'r'; \n\t}\n }\n }\n }\n\n //red first\n int blue_r = blue, red_r = red; \n int same_r = 0, diff_r = 0; //peter = same, vasya = diff\n\n prev = 'r'; \n red_r--; \n\n for(i = 1; i < blue+red; i++) {\n if(i % 2 == 1) { //vasya's turn, wants different\n if(prev == 'b') {\n\tif(red_r > 0) {\n\t red_r--; \n\t prev = 'r'; \n\t diff_r++; \n\t}\n\telse{\n\t blue_r--; \n\t same_r++; \n\t}\n }\n else if(prev == 'r') {\n\tif(blue_r > 0) {\n\t blue_r--;\n\t prev = 'b'; \n\t diff_r++; \n\t}\n\telse {\n\t red_r--;\n\t same_r++; \n\t}\n } \n }\n\n if(i % 2 == 0) { //petya's turn, wants same \n if(prev == 'r') {\n\tif(red_r > 0) {\n\t red_r--; \n\t same_r++; \n\t}\n\telse {\n\t blue_r--;\n\t diff_r++;\n\t prev = 'b'; \n\t}\n }\n else if(prev == 'b') {\n\tif(blue_r > 0) {\n\t blue_r--;\n\t same_r++; \n\t}\n\telse {\n\t red_r--; \n\t diff_r++;\n\t prev = 'r'; \n\t}\n }\n }\n }\n\n if(same_r > same_b) {\n printf(\"%d %d\", same_r, diff_r);\n }\n else {\n printf(\"%d %d\", same_b, diff_b);\n }\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,g,s;\n scanf(\"%d %d\",&a,&b);\n g=(a>b?a:b);\n s=(a<=b?a:b);\n printf(\"%d %d\",g-1,s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint m,n,a,b;\nscanf(\"%d %d\",&n,&m);\nif(n>m)\n{a=n-1;\nb=m;\n}\nelse\n{a=m-1;\nb=n;\n}\nprintf(\"%d %d\",a,b);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint m,n,a,b;\nscanf(\"%d %d\",&n,&m);\nif(n>m)\n{a=n-1;\nb=m;\n\n\n}\nelse\n{a=m-1;\nb=n;\n}\nprintf(\"%d %d\",a,b);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N,M ;\n scanf(\"%d %d\",&N,&M);\n if(N>=M)\n {\n printf(\"%d %d\\n\",N-1,M);\n }\n else\n {\n printf(\"%d %d\\n\",M-1,N);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint out,diff;\n\tif(m<n){\n\t\tout=m;\n\t\tdiff = n-m;\n\t}\n\telse{\n\t\tout = n;\n\t\tdiff = m-n;\n\t}\n\tprintf(\"%d %d\\n\",out+diff-1,out);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, m;\n\nvoid calc(int m, int n, int prev, int *a, int *b)\n{\n int i, u = 0, v = 0;\n int c[2];\n c[0] = m; c[1] = n;\n\n for (i = 1; i <= m + n; ++i)\n {\n if ((i & 1) == 1)\n {\n if (c[!prev] > 0)\n {\n prev = !prev;\n ++v;\n }\n else ++u;\n --c[prev];\n }\n else\n {\n if (c[prev] > 0) ++u;\n else\n {\n prev = !prev;\n ++v;\n }\n --c[prev];\n }\n }\n\n *a = u;\n *b = v;\n}\n\nint main(void)\n{\n int i, a, b, c, d;\n scanf(\"%d%d\", &n, &m);\n\n calc(m - 1, n, 0, &a, &b);\n calc(m, n - 1, 1, &c, &d);\n\n if (a > c) printf(\"%d %d\\n\", a, b);\n else printf(\"%d %d\\n\", c, d);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m;\nint main()\n{\n scanf(\"%d%d\",&n,&m);\n if(n>m)\n printf(\"%d %d\\n\",n-1,m);\n else printf(\"%d %d\\n\",m-1,n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,m,x,y;\n scanf(\"%d%d\",&n,&m);\n x=n>m?n:m;\n y=n<m?n:m;\n printf(\"%d %d\",2*(y/2)+(x-2*(y/2)-1),y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[200005];\n int n,m,pet=0,vas=0,x,y,j=1,i;\n scanf(\"%d%d\",&n,&m);\n if(n<m&&n%2!=0)\n a[0]='R';\n else if(n<m&&n%2==0)\n a[0]='B';\n else if(m<n&&m%2!=0)\n a[0]='B';\n else\n a[0]='R';\n x=n;\n y=m;\nfor(i=1;i<=n+m;)\n {\n if(x>0&&i%2!=0&&y>0)\n {\n if(a[j-1]=='R')\n {\n a[j++]='R';\n x--;\n }\n else\n {\n a[j++]='B';\n y--;\n }\n }\n\n if(y>0&&i%2==0&&x>0)\n {\n if(a[j-1]=='B')\n {\n a[j++]='R';\n x--;\n }\n else\n {\n a[j++]='B';\n y--;\n }\n }\n\n if(y==0&&x>0)\n {\n x--;\n a[j++]='R';\n }\n if(x==0&&y>0)\n {\n y--;\n a[j++]='B';\n }\n i++;\n }\n for(i=1;i<j;i++)\n {\n if(a[i]==a[i+1]&&i+1<j)\n pet++;\n if(a[i]!=a[i+1]&&i+1<j)\n vas++;\n }\n printf(\"%d %d\",pet,vas);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n>=m)\n printf(\"%d %d\",n-1,m);\n else\n printf(\"%d %d\",m-1,n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n>=m)\n printf(\"%d %d\\n\",n-1,m);\n else\n printf(\"%d %d\\n\",m-1,n);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,min,total=0,petya,vasya;\n\tscanf(\"%lld%lld\",&n,&m);\n\tif(n<=m)\n\t{\n\t\t//printf(\"*\");\n\t\tmin=n;\n\t\t//printf(\"%lld\\n\",min);\n\t}\n\telse\n\t\tmin=m;\n\ttotal=n+m-1;\n\t//printf(\"%lld\\n\",total);\n\tpetya=total-min;\n\tvasya=min;\n\tprintf(\"%lld %lld\\n\",petya,vasya);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nstatic void swap (void *u, void *v, size_t n) {\n char *r = u, *s = v, t;\n while (n-- > 0) {\n t = *r;\n *r++ = *s;\n *s++ = t;\n }\n}\n\nint main (void) {\n int r, n, m, s1 = 0, s2 = 0;\n scanf (\"%d %d\\n\", &n, &m);\n if (m > n) \n swap (&n, &m, sizeof n);\n --m; r = 1;\n while (n > 0 || m > 0) {\n --n; --m;\n if (n >= 0) {\n if (r == 0) \n ++s1;\n else \n ++s2;\n r = 0;\n }\n\n if (m >= 0) {\n if (r == 0)\n ++s1;\n else\n ++s2;\n r = 1;\n }\n }\n printf (\"%d %d\\n\", s1, s2);\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint cnt1=0,cnt2=0,f,n,m,i=0,p,q;\nchar a[1000001];\nscanf(\"%d%d\",&n,&m);\np=n;q=m;\na[0]='R';n--;\n//b[0]='B';\nf=1;\nwhile(n&&m)\n{\nif(f){\nif(a[i]=='R')\n{a[i+1]='B';m--;}\nelse{\na[i+1]='R';n--;}\nf=0;\n}\nelse{\nif(a[i]=='R')\n{a[i+1]='R';n--;}\nelse\n{a[i+1]='B';m--;}\nf=1;\n}\n//n--;m--;\ni++;\n}\nwhile(n)\n{a[(i+1)]='R';n--;i++;\n}\nwhile(m)\n{a[i+1]='B';m--;i++;\n}\na[i+1]='\\0';\n//printf(\"%s\\n\",a);\ni=0;\nwhile(a[i+1]!='\\0')\n{\nif(a[i]==a[i+1])cnt1++;\nelse cnt2++;\ni++;\n}\nn=p;m=q;\na[0]='B';i=0;f=1;m--;\nwhile(n&&m)\n{\nif(f){\nif(a[i]=='R')\n{a[i+1]='B';m--;}\nelse{\na[i+1]='R';n--;}\nf=0;\n}\nelse{\nif(a[i]=='R')\n{a[i+1]='R';n--;}\nelse\n{a[i+1]='B';m--;}\nf=1;\n}\n//n--;m--;\ni++;\n}\nwhile(n)\n{a[(i+1)]='R';n--;i++;\n}\nwhile(m)\n{a[i+1]='B';m--;i++;\n}\na[i+1]='\\0';\ni=0;int cnt3=0,cnt4=0;\nwhile(a[i+1]!='\\0')\n{\nif(a[i]==a[i+1])cnt3++;\nelse cnt4++;\ni++;\n}\n//printf(\"%s\\n\",a);\nif(cnt1>cnt3)\nprintf(\"%d %d\\n\",cnt1,cnt2);\nelse\nprintf(\"%d %d\\n\",cnt3,cnt4);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,white,black,opposite;\n scanf(\"%d%d\",&black,&white);\n //Minimum of both ball goes to Aaquib's Points and remaining will make pair with Prashant as both play equally good\n opposite=black<white?black:white;\n printf(\"%d %d\\n\",black+white-1-opposite,opposite);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,i,j,k,ans1,ans2,min,max;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n if(n<m)\n {\n min=n;\n max=m;\n }\n else\n {\n min=m;\n max=n;\n }\n max--;\n ans2=min;\n ans1=min/2;\n ans1+=(min/2)-1;\n max=max-2*((min/2)-1);\n ans1+=max-1;\n printf(\"%d %d\\n\",ans1,ans2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,i,j,k,ans1,ans2,min,max;\n scanf(\"%d\",&n);\n scanf(\"%d\",&m);\n if(n<m)\n {\n min=n;\n max=m;\n }\n else\n {\n min=m;\n max=n;\n }\n max--;\n ans2=min;\n ans1=min/2;\n ans1+=(min/2)-1;\n max=max-2*((min/2)-1);\n ans1+=max-1;\n printf(\"%d %d\",ans1,ans2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int *arr, i, j, n, m, k, temp, rem, acnt=0, bcnt=0;\n scanf(\"%d%d\", &n, &m);\n\n if(n > m)\n {\n temp = n;\n n = m;\n m = temp;\n }\n acnt = m - 1;\n bcnt = n;\n printf(\"%d %d\", acnt, bcnt);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n int petya,vasya,r,b;\n scanf(\" %d %d\",&r,&b);\n if(r>b)\n vasya=b;\n else\n vasya=r;\n petya=r+b-vasya-1;\n printf(\"%d %d\\n\",petya,vasya);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n\n if(a>b)\n printf(\"%d %d\\n\",a-1,b);\n else\n printf(\"%d %d\\n\",b-1,a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) ((a<b)?a:b);\nint main()\n{\n int n,m,ans;\n scanf(\"%d%d\",&n,&m);\n ans=min(n,m);\n printf(\"%d %d\",n+m-1-ans,ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint m,n,min,max;\n\tscanf(\"%d %d\",&m,&n);\n\tmax=m;\n\tmin=n;\n\tif (n>max){\n\t\tmax=n;\n\t\tmin=m;\n\t}\n\tprintf(\"%d %d\",max-1,min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[200005];\n int n,m,pet=0,vas=0,x,y,j=1,i;\n scanf(\"%d%d\",&n,&m);\n if(n<m&&n%2!=0)\n a[0]='R';\n else if(n<m&&n%2==0)\n a[0]='B';\n else if(m<n&&m%2!=0)\n a[0]='B';\n else\n a[0]='R';\n x=n;\n y=m;\nfor(i=1;i<=n+m;)\n {\n if(x>0&&i%2!=0&&y>0)\n {\n if(a[j-1]=='R')\n {\n a[j++]='R';\n x--;\n }\n else\n {\n a[j++]='B';\n y--;\n }\n }\n\n if(y>0&&i%2==0&&x>0)\n {\n if(a[j-1]=='B')\n {\n a[j++]='R';\n x--;\n }\n else\n {\n a[j++]='B';\n y--;\n }\n }\n\n if(y==0&&x>0)\n {\n x--;\n a[j++]='R';\n }\n if(x==0&&y>0)\n {\n y--;\n a[j++]='B';\n }\n i++;\n }\n for(i=1;i<j;i++)\n {\n if(a[i]==a[i+1]&&i+1<j)\n pet++;\n if(a[i]!=a[i+1]&&i+1<j)\n vas++;\n }\n printf(\"%d %d\",pet,vas);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,i,temp,p=0,v=0;\n scanf(\"%d%d\",&m,&n);\n\n if(m>n)\n {\n temp=m;m=n;n=temp;\n }\n p+=m-1;v+=m;\n //if(m%2)\n {\n p+=n-m;\n }\n\n printf(\"%d %d\\n\",p,v);\n return(0);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n n >= m ? printf(\"%d %d\",n-1, m) : printf(\"%d %d\",m-1, n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,t;\n scanf(\"%d %d\",&m,&n);\n if(m<n)\n {\n\n t=m;\n m=n;\n n=t;}\n printf(\"%d %d\\n\",m-1,n);\n\n\n return 0;\n}\n\n "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint a,b,x;\nint main(){\n\tscanf(\"%d %d\", &a,&b);\n\tx=(a>b)?b:a;\n\tprintf(\"%d %d\", a+b-1-x, x);\n\treturn 0;\n}\n"}, {"source_code": "main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n>m) printf(\"%d %d\\n\",n-1,m);\n else printf(\"%d %d\\n\",m-1,n);\n return 0;\n}\n"}, {"source_code": "main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n if(n>m) printf(\"%d %d\\n\",n-1,m);\n else printf(\"%d %d\\n\",m-1,n);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nchar ans[1234567];\n\nint main(){\n\n\tint n, m;\n\tscanf(\"%d%d\", &n, &m);\n\n\tint cnt = 0, nn = n, mm = m;\n\n\tfor(int i = 0; i < n + m; i++){\n\t\t\n\t\tif(i == 0){\n\t\t\tif(nn < mm && nn){\n\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t--nn;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t--mm;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tif(i & 1){\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\telse{\n\t\t\tif(ans[i - 1] == 'r'){\n\t\t\t\tif(nn){\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(mm){\n\t\t\t\t\tans[cnt++] ='b';\n\t\t\t\t\t--mm;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tans[cnt++] = 'r';\n\t\t\t\t\t--nn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\t\n\n\tint a = 0, b = 0;\n\tfor(int i = 0; i < cnt - 1; i++){\n\t\tif(ans[i] == ans[i + 1]){\n\t\t\t++a;\n\t\t}\n\t\telse{\n\t\t\t++b;\n\t\t}\n\t}\n\n\tprintf(\"%d %d\\n\", a, b);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str1[500000],str2[500000];\n\tint m, n;\n\tscanf(\"%d %d\", &n, &m);\n\tint i, j, k;\n\tint countRed=n, countBlue=m;\n\tstr1[0]='r';\n\tfor(i=1;i<=m+n;i++)\n\t{\n\t\tif(i%2==1)\n\t\t{\n\t\t\tif(str1[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str1[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(str1[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str1[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr1[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tstr2[0]='b';\n\tfor(i=1;i<=m+n;i++)\n\t{\n\t\tif(i%2==1)\n\t\t{\n\t\t\tif(str2[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str2[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(str2[i-1]=='b')\n\t\t\t{\n\t\t\t\tif(countRed>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(str2[i-1]=='r')\n\t\t\t{\n\t\t\t\tif(countBlue>0)\n\t\t\t\t{\n\t\t\t\t\tstr2[i]='b';\n\t\t\t\t\tcountBlue--;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\tstr2[i]='r';\n\t\t\t\t\tcountRed--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tint count1=0, count2=0,count3=0, count4=0;\n\tfor(i=1;i<strlen(str1)-1;i++)\n\t{\n\t\tif(str1[i]==str1[i+1])\n\t\t count1++;\n\t\telse\n\t\t\tcount3++;\n\t\tif(str2[i]==str2[i+1])\n\t\t\tcount2++;\n\t\telse\n\t\t\tcount4++;\n\t}\n\tif(count1>count2)\n\t\tprintf(\"%d %d\\n\",count1, count3);\n\telse\n\t\tprintf(\"%d %d\\n\",count2, count4);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m, x, y, z, w, ans = 0, i;\n \n scanf(\"%d %d\", &n, &m);\n \n x = n - 1;\n y = m;\n z = 0;\n w = 0;\n \n for (i = 1; i < n + m; i++) {\n if (x == 0) {\n if (w == 1) z++;\n \n y--;\n } else if (y == 0) {\n if (w == 0) z++;\n \n x--;\n } else if (i % 2 == 0) {\n if (w == 0) {\n x--;\n } else {\n y--;\n }\n \n z++;\n } else {\n if (w == 0) {\n y--;\n } else {\n x--;\n }\n \n w = 1 - w;\n }\n }\n \n if (z > ans) ans = z;\n \n x = n;\n y = m - 1;\n z = 0;\n w = 1;\n \n for (i = 1; i < n + m; i++) {\n if (x == 0) {\n if (w == 1) z++;\n \n y--;\n \n w = 1;\n } else if (y == 0) {\n if (w == 0) z++;\n \n x--;\n \n w = 0;\n } else if (i % 2 == 0) {\n if (w == 0) {\n x--;\n } else {\n y--;\n }\n \n z++;\n } else {\n if (w == 0) {\n y--;\n } else {\n x--;\n }\n \n w = 1 - w;\n }\n }\n \n if (z > ans) ans = z;\n \n printf(\"%d %d\\n\", ans, n + m - ans - 1);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n+m];\n\tint end=n+m;\n\tint k=0;\n\tint maxs=0,maxd=0;\n\tint nr=n;\n\tint mr=m;\n\tfor(k=0;k<2;k++)\n\t{\n\t\tn=nr;\n\t\tm=mr;\n\t\tint turn=0;\n\t\tif(k%2==0)\n\t\t{\ta[0]=1;n--;}\n\t\telse\n\t\t{\ta[0]=2;m--;}\n\tfor(i=1;i<end;i++)\n\t{\n\t\tif(turn%2==0)\n\t\t{\n\t\t\tif(a[i-1]==1&&m>0)\n\t\t\t{\ta[i]=2;m--;}\n\t\t\telse if(n>0)\n\t\t\t{\ta[i]=1;n--;}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\t\n//\t\t\t\tif(i==2)\n//\t\t\t\t\tprintf(\"%d %d\\n\",a[i-1],n);\n\t\t\t\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\n\t\t\t\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0){a[i]=1;n--;}\n\t\t\t}\n\n\t\t}\n\t\tturn++;\n\t}\n\tint same=0;\n\tint diff=0;\n//\tprintf(\"%d \",a[0]);\n\tfor(i=1;i<end;i++)\n\t{\n//\t\tprintf(\"%d \",a[i]);\n\t\tif(a[i-1]==a[i])\n\t\t\tsame++;\n\t\telse\n\t\t\tdiff++;\n\t}\n//\tprintf(\"%d %d\\n\",same,diff);\n\tif(maxs<=same)\n\t{\tmaxs=same;maxd=diff;}\n\t}\n\tprintf(\"%d %d\\n\",maxs,maxd);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n+m];\n\tint end=n+m;\n\tint turn=0;\n\tint k=0;\n\tint maxs=0,maxd=0;\n\tfor(k=0;k<2;k++)\n\t{\n\t\tif(k%2==0)\n\t\t\ta[0]=1;\n\t\telse\n\t\t\ta[0]=2;\n\tfor(i=1;i<end;i++)\n\t{\n\t\tif(turn%2==0)\n\t\t{\n\t\t\tif(a[i-1]==1&&m>0)\n\t\t\t{\ta[i]=2;m--;}\n\t\t\telse if(n>0)\n\t\t\t{\ta[i]=1;n--;}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\t\n\t\t\t\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\n\t\t\t\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0){a[i]=1;n--;}\n\t\t\t}\n\n\t\t}\n\t\tturn++;\n\t}\n\tint same=0;\n\tint diff=0;\n//\tprintf(\"%d \",a[0]);\n\tfor(i=1;i<end;i++)\n\t{\n//\t\tprintf(\"%d \",a[i]);\n\t\tif(a[i-1]==a[i])\n\t\t\tsame++;\n\t\telse\n\t\t\tdiff++;\n\t}\n//\tprintf(\"%d %d\\n\",same,diff);\n\tif(maxs<same)\n\t{\tmaxs=same;maxd=diff;}\n\t}\n\tprintf(\"%d %d\\n\",maxs,maxd);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n+m];\n\tint end=n+m;\n\tint turn=0;\n\tint k=0;\n\tint maxs=0,maxd=0;\n\tint nr=n;\n\tint mr=m;\n\tfor(k=0;k<2;k++)\n\t{\n\t\tn=nr;\n\t\tm=mr;\n\t\tif(k%2==0)\n\t\t{\ta[0]=1;n--;}\n\t\telse\n\t\t{\ta[0]=2;m--;}\n\tfor(i=1;i<end;i++)\n\t{\n\t\tif(turn%2==0)\n\t\t{\n\t\t\tif(a[i-1]==1&&m>0)\n\t\t\t{\ta[i]=2;m--;}\n\t\t\telse if(n>0)\n\t\t\t{\ta[i]=1;n--;}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\t\n//\t\t\t\tif(i==2)\n//\t\t\t\t\tprintf(\"%d %d\\n\",a[i-1],n);\n\t\t\t\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\n\t\t\t\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0){a[i]=1;n--;}\n\t\t\t}\n\n\t\t}\n\t\tturn++;\n\t}\n\tint same=0;\n\tint diff=0;\n//\tprintf(\"%d \",a[0]);\n\tfor(i=1;i<end;i++)\n\t{\n//\t\tprintf(\"%d \",a[i]);\n\t\tif(a[i-1]==a[i])\n\t\t\tsame++;\n\t\telse\n\t\t\tdiff++;\n\t}\n//\tprintf(\"%d %d\\n\",same,diff);\n\tif(maxs<=same)\n\t{\tmaxs=same;maxd=diff;}\n\t}\n\tprintf(\"%d %d\\n\",maxs,maxd);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n+m];\n\tint end=n+m;\n\tint turn=0;\n\tint k=0;\n\tint maxs=0,maxd=0;\n\tfor(k=0;k<2;k++)\n\t{\n\t\tif(k%2==0)\n\t\t\ta[0]=1;\n\t\telse\n\t\t\ta[0]=2;\n\tfor(i=1;i<end;i++)\n\t{\n\t\tif(turn%2==0)\n\t\t{\n\t\t\tif(a[i-1]==1&&m>0)\n\t\t\t{\ta[i]=2;m--;}\n\t\t\telse if(n>0)\n\t\t\t{\ta[i]=1;n--;}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(a[i-1]==1)\n\t\t\t{\t\n\t\t\t\tif(n>0){a[i]=1;n--;}\n\t\t\t\telse if(m>0){a[i]=2;m--;}\n\t\t\t}\n\t\t\telse if(a[i-1]==2)\n\t\t\t{\n\t\t\t\tif(m>0){a[i]=2;m--;}\n\t\t\t\telse if(n>0){a[i]=1;n--;}\n\t\t\t}\n\n\t\t}\n\t\tturn++;\n\t}\n\tint same=0;\n\tint diff=0;\n//\tprintf(\"%d \",a[0]);\n\tfor(i=1;i<end;i++)\n\t{\n//\t\tprintf(\"%d \",a[i]);\n\t\tif(a[i-1]==a[i])\n\t\t\tsame++;\n\t\telse\n\t\t\tdiff++;\n\t}\n//\tprintf(\"%d %d\\n\",same,diff);\n\tif(maxs<=same)\n\t{\tmaxs=same;maxd=diff;}\n\t}\n\tprintf(\"%d %d\\n\",maxs,maxd);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MAXN 100002\n\n#define R 0x1\n#define B 0x2\n\nunsigned char balls[MAXN+MAXN];\n\nvoid solve(int r, int b) {\n\tint turn = 0;\n\tint n = r + b;\n\tint i = 0;\n\tint c1 = 0;\n\tint c2 = 0;\n\twhile (r + b > 0) {\n\t\tif (turn == 0) {\n\t\t\t/* Petya */\n\t\t\tif (i > 0) {\n\t\t\t\tif (balls[i-1] == R) {\n\t\t\t\t\tif (r > 0) {\n\t\t\t\t\t\tballs[i] = R;\n\t\t\t\t\t\tr--;\n\t\t\t\t\t} else if (b > 0) {\n\t\t\t\t\t\tb--;\n\t\t\t\t\t\tballs[i] = B;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (b > 0) {\n\t\t\t\t\t\tb--;\n\t\t\t\t\t\tballs[i] = B;\n\t\t\t\t\t} else if (r > 0) {\n\t\t\t\t\t\tr--;\n\t\t\t\t\t\tballs[i] = R;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (r == 1) {\n\t\t\t\t\tballs[i] == R;\n\t\t\t\t\tr--;\n\t\t\t\t} else if (b == 1) {\n\t\t\t\t\tballs[i] == B;\n\t\t\t\t\tb--;\n\t\t\t\t} else if (r > b) {\n\t\t\t\t\tballs[i] = R;\n\t\t\t\t\tr--;\n\t\t\t\t} else if (b > r) {\n\t\t\t\t\tballs[i] = B;\n\t\t\t\t\tb--;\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (balls[i-1] == R) {\n\t\t\t\tif (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tballs[i] = B;\n\t\t\t\t} else if (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tballs[i] = R;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (r > 0) {\n\t\t\t\t\tr--;\n\t\t\t\t\tballs[i] = R;\n\n\t\t\t\t} else if (b > 0) {\n\t\t\t\t\tb--;\n\t\t\t\t\tballs[i] = B;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tturn ^= 0x1;\n\t\ti++;\n\t}\n\t\t\n\tfor (i = 1;i < n; i++) {\n\t\tif (balls[i-1] == balls[i]) {\n\t\t\tc1++;\n\t\t} else {\n\t\t\tc2++;\n\t\t}\n\t}\n\tprintf(\"%d %d\\n\", c1, c2);\n}\n\nint main() {\n\tint r, b;\n\tscanf(\"%d %d\", &r, &b);\n\tsolve(r, b);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int n,k,m,a,b,i,j,ans1=0,ans2=0;\nscanf(\"%d %d\",&n,&m);\nk=n+m;\nif(n>=m)\na=n;\nelse\na=m;\nint arr[k];\nfor(i=0;i<k;i++)\n{if(i<a)\narr[i]=1;\nelse\narr[i]=0;\n\n}\n\nfor(i=0;i<k;i++)\n{\nif(arr[i]==arr[i+1]&&arr[i]==1)\nans1++;\n\n}\nif(m==1)\n ans2==1;\nelse\nans2=m/2;\nprintf(\"%d %d\",ans1,ans2);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[100001];\n int n,m,pet=0,vas=0,x,y,j=1,i;\n scanf(\"%d %d\",&n,&m);\n if(n<m&&n%2!=0)\n a[0]='R';\n else if(n<m&&n%2==0)\n a[0]='B';\n else if(m<n&&m%2!=0)\n a[0]='B';\n else\n a[0]='R';\n x=n;\n y=m;\n for(i=0;i<n+m;i++)\n {\n if(x>0&&i%2==0&&a[j-1]=='R'&&y>0)\n {\n x=x-1;\n a[j++]='R';\n }\n if(x>0&&i%2==0&&a[j-1]=='B'&&y>0)\n {\n x=x-1;\n a[j++]='B';\n }\n if(y>0&&i%2!=0&&a[j-1]=='R'&&x>0)\n {\n y=y-1;\n a[j++]='B';\n }\n if(y>0&&i%2!=0&&a[j-1]=='B'&&x>0)\n {\n y=y-1;\n a[j++]='R';\n }\n if(y==0&&x>0)\n {\n x=x-1;\n a[j++]='R';\n }\n if(x==0&&y>0)\n {\n y=y-1;\n a[j++]='B';\n }\n }\n for(i=1;i<j;i++)\n {\n if(a[i]==a[i+1]&&i+1<j)\n pet++;\n if(a[i]!=a[i+1]&&i+1<j)\n vas++;\n }\n printf(\"%d %d\",pet,vas);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[10][10];\n int r,c,i,j,sum=0,x=0,m;\n char ch;\n scanf(\"%d %d\\n\",&r,&c);\n for(i=0;i<=r-1;i++)\n {\n for(j=0;j<=c;j++)\n {\n scanf(\"%c\",&ch);\n if(ch=='s')\n a[i][j]=0;\n else\n a[i][j]=1;\n }\n }\nfor(i=0;i<=r-1;i++)\n {\n sum=0;\n for(j=0;j<=c-1;j++)\n {\n sum=sum+a[i][j];\n\n }\n if(sum==c)\n {\n x=x+c;\n for(m=0;m<=c-1;m++)\n a[i][m]=-1;\n }\n }\nfor(i=0;i<=c-1;i++)\n {\n sum=0;\n for(j=0;j<=r-1;j++)\n {\n if(a[j][i]==-1)\n sum=sum+1;\n else\n sum=sum+a[j][i];\n\n }\n if(sum==r)\n {\n x=x+r;\n for(m=0;m<=r-1;m++)\n {\n if(a[m][i]==-1)\n x=x-1;\n }\n }\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int A[2], B[2], C[2], dx[2], dy[2];\n long long cp;\n scanf (\"%d %d %d %d %d %d\", A, A+1, B, B+1, C, C+1);\n dx[0] = B[0] - A[0]; dx[1] = C[0] - B[0];\n dy[0] = B[1] - A[1]; dy[1] = C[1] - B[1];\n cp = (long long) dy[1]*dx[0] - (long long) dy[0]*dx[1];\n printf (\"%s\\n\", cp < 0 ? \"RIGHT\" : cp == 0 ? \"TOWARDS\" : \"LEFT\");\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int n, suf[] = {170,20,200,110,50,80}, P = sizeof suf / sizeof *suf;\n scanf (\"%d\", &n);\n\n if (n < 3)\n printf (\"-1\\n\");\n else if (n == 3) \n printf (\"210\\n\");\n else \n printf (\"1%.*d%.*d\\n\", n - 4, 0, 3, suf[n % P]);\n\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,white,black,opposite;\n scanf(\"%d\",&t);\n scanf(\"%d%d\",&black,&white);\n //Minimum of both ball goes to Aaquib's Points and remaining will make pair with Prashant as both play equally good\n opposite=black<white?black:white;\n printf(\"%d %d\\n\",black+white-1-opposite,opposite);\n return 0;\n}"}], "src_uid": "c8378e6fcaab30d15469a55419f38b39"} {"nl": {"description": "Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0,\u20090) and Varda's home is located in point (a,\u2009b). In each step, he can move in a unit distance in horizontal or vertical direction. In other words, from position (x,\u2009y) he can go to positions (x\u2009+\u20091,\u2009y), (x\u2009-\u20091,\u2009y), (x,\u2009y\u2009+\u20091) or (x,\u2009y\u2009-\u20091). Unfortunately, Drazil doesn't have sense of direction. So he randomly chooses the direction he will go to in each step. He may accidentally return back to his house during his travel. Drazil may even not notice that he has arrived to (a,\u2009b) and continue travelling. Luckily, Drazil arrived to the position (a,\u2009b) successfully. Drazil said to Varda: \"It took me exactly s steps to travel from my house to yours\". But Varda is confused about his words, she is not sure that it is possible to get from (0,\u20090) to (a,\u2009b) in exactly s steps. Can you find out if it is possible for Varda?", "input_spec": "You are given three integers a, b, and s (\u2009-\u2009109\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009109, 1\u2009\u2264\u2009s\u2009\u2264\u20092\u00b7109) in a single line.", "output_spec": "If you think Drazil made a mistake and it is impossible to take exactly s steps and get from his home to Varda's home, print \"No\" (without quotes). Otherwise, print \"Yes\".", "sample_inputs": ["5 5 11", "10 15 25", "0 5 1", "0 0 2"], "sample_outputs": ["No", "Yes", "No", "Yes"], "notes": "NoteIn fourth sample case one possible route is: ."}, "positive_code": [{"source_code": "#include <stdio.h>\nint main ()\n{\n\tint a,b,s;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tif (a<0)\n\t\ta=0-a;\n\tif (b<0)\n\t\tb=0-b;\n\n\n\tif (a+b>s)\n\t\tprintf(\"No\\n\");\n\telse if (a+b==s)\n\t\tprintf(\"Yes\\n\");\n\telse if ((s-(a+b))%2==0)\n\t\tprintf(\"Yes\\n\");\n\telse if ((s-(a+b))%2==1 || (s-(a+b))%2==-1)\n\t\tprintf(\"No\\n\");\n\treturn 0;\n\t//\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(void)\n{\n\tint a,b,s;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tif((s-(abs(a)+abs(b)))%2==0&&s>=(abs(a)+abs(b)))\n\t\tprintf(\"yes\");\n\telse\n\t\tprintf(\"no\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h> \n#include<string.h> \n#include<math.h> \n \n \nint main() \n{ \n int a, b, s, d; \n scanf(\"%d %d %d\", &a, &b, &s); \n d = abs(a) + abs(b); \n if (d > s || ((d-s)%2)) \n { \n printf(\"No\\n\"); \n } \n else \n { \n printf(\"Yes\\n\"); \n } \n return 0; \n} \n "}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long a, b, s;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n if(s<a+b)\n printf(\"%s\",\"NO\");\n else\n {\n if((s-(a+b))%2==0)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,b,s;\n\tscanf(\"%I64d%I64d%I64d\",&a,&b,&s);\n\tif (a < 0)\n\t\ta = a*-1;\n\tif (b < 0)\n\t\tb = b*-1;\n\ts = s - (a + b);\n\tif (s % 2 == 0 && s>=0)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long n,m,k,t,d=1;\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n t=abs(m)+abs(n);\n if(t<k)\n d=k-t;\n if(t==k||d%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n \n\nint main(){\n\nint a,b,s;\n\nscanf(\"%d %d %d\",&a,&b,&s);\n\n\nif (abs(a)+abs(b)>s)\nprintf(\"No\");\n\nelse{\n if((a+b-s)%2==0)\n printf(\"Yes\");\n else \n printf(\"No\");\n}\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tif (a < 0)\n\t\ta = -a;\n\tif (b < 0)\n\t\tb = -b;\n\tif (s >= (a + b) && ((s - (a + b)) % 2) == 0)\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\nint main(int argc, char* argv[])\n{\n int a, b, s;\n scanf(\"%d %d %d\",&a,&b,&s);\n a=abs(a);b=abs(b);\n\n if ((a+b>s) || ((s-a+b) % 2!=0)) {printf(\"NO\");} else {printf(\"YES\");}\n scanf(\"%d %d %d\",&a,&b,&s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n// 515A\nint main(){\n int a, b, s;\n scanf(\"%d%d%d\", &a, &b, &s);\n \n if(s < abs(a) + abs(b) ){\n printf(\"No\");\n }\n else if((s - abs(a) - abs(b)) % 2 == 0 || s == abs(a) + abs(b)) printf(\"Yes\");\n else printf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a, b, s;\n\n scanf(\"%d %d %d\", &a, &b, &s);\n\n if(a < 0) a = (-a);\n if(b < 0) b = (-b);\n\n if((((s-(a+b))%2) == 0) && ((s-(a+b))>=0)) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(a<0)\n {\n a=-a;\n }\n if(b<0)\n {\n b=-b;\n }\n // printf(\"%lld\",a);\n if(s>=a+b)\n {\n if((a+b-s)%2==0)\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n }\n else\n {\n printf(\"No\");\n }\n \n \n \n \n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int x,y,a;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&a);\n a = a-abs(x)-abs(y);\n if( a<0 )printf(\"No\\n\");\n else if(a==0 || a%2 == 0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tlong int a,b,s;\n\t\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tif(a<0) a*=-1;\nif(b<0) b*=-1;\n\tif(a==0 && b==0 && s%2==0)\n\tprintf(\"Yes\");\n\t\n\n \telse if((a+b)<s && (s-(a+b))%2==0)\n\tprintf(\"Yes\");\n\nelse if(a+b!=s)\n\tprintf(\"No\");\n\t\n else\n printf(\"Yes\");\n\n\n//printf(\"%d\",(s-(a+b))%2);\n\t}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a,b,s,r;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tif(s>=abs(a)+abs(b))\n\t{\n\tr=(s-(abs(a)+abs(b)))%2;\n\tif(r==0)\n\tprintf(\"Yes\");\n\telse \n\tprintf(\"No\");\n}\nelse\nprintf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,k,d;\n scanf(\"%d %d %d\",&a,&b,&k);\n d=abs(a)+abs(b);\n if(d==k){\n printf(\"Yes\");\n }\n else if(k>d && (k-d)%2==0){\n printf(\"Yes\");\n }\n else printf(\"No\");\n\n return 0;\n }\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&s);\n if(a<0)\n {\n a=a*(-1);\n }\n if(b<0)\n {\n b=b*(-1);\n }\n if(a+b==s)\n printf(\"YES\");\n else if(a+b>s)\n printf(\"NO\");\n else\n {\n if((a+b)%2==0 && s%2==0)\n printf(\"YES\");\n else if((a+b)%2==1 && s%2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<0){\n a=-a;\n }\n if(b<0){\n b=-b;\n }\n if(c<(a+b)){\n printf(\"NO\");\n }\n else if(c==(a+b)){\n printf(\"YES\");\n }\n else if(c==(-a)||c==(-b)){\n printf(\"NO\");\n }\n else{\n if((a+b)%2==0 && c%2==0){\n printf(\"YES\");\n }\n else if((a+b)<0){\n printf(\"NO\");\n }\n else if((a+b)%2!=0 && c%2!=0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "long long b,a,s;\nlong long abs(long long x) {\n return x<0?-x:x;\n}\nmain() {\n scanf(\"%lld%lld%lld\", &a, &b, &s);\n a = abs(a), b = abs(b);\n puts(a+b<=s && ((a^b^s)&1LL) == 0LL?\"Yes\":\"No\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&s);\n if(a<0)\n {\n a=a*(-1);\n }\n if(b<0)\n {\n b=b*(-1);\n }\n if(a+b==s)\n printf(\"YES\");\n else if(a+b>s)\n printf(\"NO\");\n else\n {\n if((a+b)%2==0 && s%2==0)\n printf(\"YES\");\n else if((a+b)%2==1 && s%2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long int a,b,s,d;\n while (scanf(\"%I64d %I64d %I64d\",&a,&b,&s)==3){\n a=fabs(a);\n b=fabs(b);\n d=s-(a+b);\n if ((a+b)==s){\n printf (\"Yes\\n\");\n }\n else if (d>0&&d%2==0){\n printf (\"Yes\\n\");\n }\n else if (a==0&&b==0){\n if (s%2==0){\n printf (\"Yes\\n\");\n }\n else {\n printf (\"No\\n\");\n }\n }\n else {\n printf (\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long x,y,a,b,c,d;\n scanf(\"%ld %ld %ld\",&x,&y,&a);\n if(x>=0 && y>=0)\n b=x+y;\n if(x>=0 && y<0)\n b=x+(-1)*y;\n if(x<0 && y>=0)\n b=y+(-1)*x;\n if(x<0 && y<0)\n b=(-1)*x+(-1)*y;\n //printf(\"%d\\n\",b);\n if(b>a)\n printf(\"NO\\n\");\n else if(b==a)\n printf(\"YES\\n\");\n else if(((b-a)%2==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long sum, x, y, n;\n\tscanf(\"%I64d%I64d%I64d\", &x, &y, &n);\n\tsum=(x>0?x:-x)+(y>0?y:-y);\n\tif(n<sum)\n\t{\n\t\tprintf(\"No\\n\");\n\t}\n\telse if(n>=sum)\n\t{\n\t\tif(n%2==0)\n\t\t{\n\t\t\t//printf(\"=0\");\n\t\t\tif(sum%2==0)\n\t\t\t{\n\t\t\t\t//printf(\"sum=%d\\n\", sum);\n\t\t\t\tprintf(\"Yes\\n\"); \n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"No\\n\");\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n%2!=0)\n\t\t\t{\n\t\t\t\tif(sum%2!=0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"No\\n\");\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long int i,j,a,b,sum;\n scanf(\"%lld %lld %lld\",&a,&b,&j);\n \n i=j-abs(a)+abs(b);\n \n \n if(j<(abs(a)+abs(b)) )\n printf(\"No\");\n else\n {\n \n if(i%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long a,b,s,x;\n scanf(\"%li %li %li\",&a,&b,&s);\n if (a<0)\n a=(-a);\n if (b<0)\n b=(-b);\n\n x=s-(a+b);\n\n if (((x%2)==0)&& (s>=(a+b)))\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\",&a,&b,&s);\n\tint x=abs(a)+abs(b);\n\tif(s<x)\n\tprintf(\"No\");\n\telse if((s-x)%2==0)\n\tprintf(\"Yes\");\n\telse\n\tprintf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long a,b,s,sum;\n scanf(\"%lld %lld %lld\", &a,&b,&s);\n if(a<0 && b < 0)\n {\n sum = -a + -b;\n }\n else if(a<0 && b >=0)\n {\n sum = b-a;\n }\n else if(a>=0 && b <0)\n {\n sum = a-b;\n }\n else\n {\n sum = a + b;\n }\n if(sum < s && (s-sum) % 2 != 0)\n {\n printf(\"No\\n\");\n }\n else if(sum>s)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a,b,s,r,e,w,q;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tr=abs(a);\n\te=abs(b);\n\tw=r+e;\n\t\n\tq=s-w;\n\t\n\tif (q%2==0 && q>=0){\n\t\tprintf(\"Yes\");\n\t}\n\telse{\n\t\tprintf(\"No\");\n\t}\n\t\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long a,b,s;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n if (a < 0) a = -a;\n if (b < 0) b = -b;\n if(a+b>s)\n printf(\"No\\n\");\n else if((a+b-s)%2)\n printf(\"No\\n\");\n else \n printf(\"Yes\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,s;\n scanf(\"%d %d %d\", &a,&b,&s);\n a=abs(a);\n b=abs(b);\n\n if(a+b>s || ((s-a-b)%2==1))\n {\n printf(\"No\\n\");\n return 0;\n }\n printf(\"Yes\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(s>=abs(a)+abs(b) && (s-(abs(a)+abs(b)))%2==0) puts(\"Yes\");\n else puts(\"No\");\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<math.h>\nint main()\n{\n long long int a,b,c;\n scanf(\"%lli %lli %lli\",&a,&b,&c);\n if((c-abs(a)-abs(b))>=0&&(c-abs(a)-abs(b))%2==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,b,s;\n\tscanf(\"%lld %lld %lld\",&a,&b,&s);\n\tif(a<0)\n\t{\n\t\ta=0-a;\n\t}\n\tif(b<0)\n\t{\n\t\tb=0-b;\n\t}\n\tif(s==(a+b))\n\t{\n\t\tprintf(\"Yes\");\n\t}\n\telse if(s>(a+b) && ((s-(a+b))%2==0))\n\t{\n\t\tprintf(\"Yes\");\n\t}\n\telse\n\t{\n\t\tprintf(\"No\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,c;\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tlong long s1=c-(abs(a)+abs(b));\n\tlong long s2=abs(a)+abs(b)+c;\n\tif (s1>=0 && s2%2==0) printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "main(a,b,n){scanf(\"%d%d%d\",&a,&b,&n);a=abs(a)+abs(b);puts(a&1^n&1|n<a?\"NO\":\"YES\");}"}, {"source_code": "#include <stdio.h>\n\nlong long aV(long long x)\n{\n if (x <= 0)\n return x *= (-1);\n else\n return x;\n}\nvoid check(long long a, long long b, long long s)\n{\n if (((aV(a) + aV(b)) <= s) && ((aV(a) + aV(b) + s) % 2 == 0))\n printf(\"Yes\");\n else\n printf(\"No\");\n}\nint main()\n{\n long long a, b, s;\n scanf(\"%lld %lld %lld\", &a, &b, &s);\n check(a, b, s);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int z;\n int a,b;\n int c;\n scanf(\"%d%d%d\", &a, &b, &c);\n a = abs(a);\n b = abs(b);\n z = a+b;\n if(c < z){\n printf(\"No\");\n return 0;\n }\n if(c == z){\n printf(\"Yes\");\n return 0;\n }\n if((z%2 == 0) ^ (c%2 == 0)){\n printf(\"No\");\n }\n else{\n printf(\"Yes\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\ntypedef long long int intt64;\nint main()\n{\n intt64 a,b,c;\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n intt64 sum=0;\n if (a<0)\n {\n a*=-1;\n }\n if (b<0)\n {\n b*=-1;\n }\n sum+=a+b;\n if (c<sum)\n {\n printf(\"No\");\n return 0;\n }\n if (c>=sum)\n {\n if (c==sum)\n {\n printf(\"Yes\");\n return 0;\n }\n if (sum<c)\n {\n c-=sum;\n if (c%2==0)\n {\n printf(\"Yes\");\n return 0;\n }\n else\n {\n printf(\"No\");\n return 0;\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a, b, s;\n scanf(\"%d %d %d\", &a, &b, &s);\n\n a = abs(a);\n b = abs(b);\n s = abs(s);\n\n if(s < (a + b))\n printf(\"No\");\n else if((s - (a + b)) % 2 == 0)\n printf(\"Yes\");\n else\n printf(\"No\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tint a,b,s;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\tif (a<0)\n\t\ta=0-a;\n\tif (b<0)\n\t\tb=0-b;\n\n\n\tif (a+b>s)\n\t\tprintf(\"No\\n\");\n\telse if (a+b==s)\n\t\tprintf(\"Yes\\n\");\n\telse if ((s-(a+b))%2==0)\n\t\tprintf(\"Yes\\n\");\n\telse if ((s-(a+b))%2==1 || (s-(a+b))%2==-1)\n\t\tprintf(\"No\\n\");\n\treturn 0;\n\t//\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,c;\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tlong long l=c-(abs(a)+abs(b));\n\tlong long k=abs(a)+abs(b)+c;\n\tif (l>=0 && k%2==0) printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,s,x,y;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a<0)\n a=0-a;\n if(b<0)\n b=0-b;\n\n x=a+b;\n if(s<x)\n printf(\"No\");\n else\n {\n s=s-x;\n if(s%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void){\n int d;\n int a,b,c;\n scanf(\"%d \",&a);\n scanf(\"%d \",&b);\n scanf(\"%d \",&c);\n \n if((a>0 && b>0) || (a<0 && b<0)){\n d= abs(a+b);\n }\n else{\n d=abs(a-b);\n }\n if((c-d)%2==0 && c>=d){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n \n \n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a,b,c,d,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<0)\n {\n a=-a;\n }\n else\n {\n a=a;\n }\n if(b<0)\n {\n b=-b;\n }\n else\n {\n b=b;\n }\n d=a+b;\n if(c%2==0)\n {\n if(c>=d&&(d%2)==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else if(c%2!=0)\n {\n if(c>=d&&(d%2)!=0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b, s;\n scanf(\"%d%d%d\", &a, &b, &s);\n if(a<0 && b>=0)\n {\n a = -1*a;\n }\n else if(a<0 && b<0)\n {\n a = -1 * a;\n b = -1*b;\n }\n else if(a>=0 && b<0)\n {\n b = b*-1;\n }\n if(a+b<=s)\n {\n if((a+b-s)%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else if(a+b>s)\n {\n printf(\"No\");\n }\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, x, y;\n scanf(\"%d %d %d\", &x, &y, &n);\n n=n-(abs(x)+abs(y));\n if(n%2==0 && n>=0)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nlong long aV(long long x)\n{\n if (x <= 0)\n return x *= (-1);\n else\n return x;\n}\nvoid check(long long a, long long b, long long s)\n{\n if (((aV(a) + aV(b)) <= s) && ((aV(a) + aV(b) + s) % 2 == 0))\n printf(\"Yes\");\n else\n printf(\"No\");\n}\nint main()\n{\n long long a, b, s;\n scanf(\"%lld %lld %lld\", &a, &b, &s);\n check(a, b, s);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e;\n while(scanf(\"%d%d%d\",&a,&b,&c)==3)\n {\n if(a<0) a *=-1;\n if(b<0) b *=-1;\n d = a+b;\n e = c-d;\n if(e<0) printf(\"No\\n\");\n else\n {\n if(e%2==0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n \nint main(){\n long long a,b,s,tong;\n int test = 0 ;\n do {\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n }while (a <-1e9 || a>1e9 || b<-1e9 || b>1e9 || s<1 || s>2*1e9);\n tong =abs(a)+abs(b);\n if (s>=tong){\n if (s%2 == 0 && tong %2 ==0){\n test =1;\n \t}\n else if (s%2 !=0 && tong%2 != 0) {\n test =1;\n \t}\n }\n if (test == 1) printf(\"Yes\");\n else printf (\"No\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint main()\n{\n int a,b,s;\n scanf(\"%d %d %d\",&a,&b,&s);\n\n int ans=0;\n\n ans=(s-(abs(a)+abs(b)))%2;\n\n if(ans==0 && s>=(abs(a)+abs(b)))\n {\n printf(\"YES\");\n }\n else if(ans==1 || s<(abs(a)+abs(b)))\n {\n printf(\"NO\");\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tint a,b,n;\n\tscanf(\"%d%d%d\",&a,&b,&n);\n\ta=abs(a);\n\tb=abs(b);\n\tif((a+b<n)&&a==0&&b==0&&n%2==0){\n\t\tprintf(\"Yes\");\n\t\treturn 0;\n\t}\n\telse if(a+b==n){\n\t\tprintf(\"Yes\");\n\t}\n\telse if(a+b<n){\n\t\tif((n-a-b)%2==0){\n\t\t\tprintf(\"Yes\");\n\t\t}\n\t\telse printf(\"No\");\n\t}\n\telse if(n%(a+b)==0){\n\t\tprintf(\"Yes\");\n\t}\n\telse printf(\"No\");\n}"}, {"source_code": "#include<stdio.h>\n\nint absolute(int a){\n if(a>0)\n return a;\n else\n return -a;\n}\n\nint main(){\n int a,b,s;\n scanf(\"%d %d %d\", &a,&b,&s);\n int sum = absolute(a)+absolute(b);\n if( s >= sum && (s - sum) %2 == 0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\tlong long int a,b,s;\n\tscanf(\"%lld %lld %lld\",&a,&b,&s);\n\n\ta = a>0 ? a: -a;\n\tb= b>0 ? b : -b;\n\tif((s-a-b)%2==0 && (s-a-b) >= 0)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\n\nint a,b,s;\nscanf(\"%d%d%d\",&a,&b,&s);\nif(a<0)\n{\n a=a*-1;\n \n}\n\n\nif(b<0)\n{\n b=b*-1;\n \n}\n\nif(a+b<=s && (s-(a+b))%2==0 )\n\n{\n\nprintf(\"Yes\");\n\n}\n\nelse \n{\n\nprintf(\"No\");\n\n\n}\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\tint main (){\n\t\tlong long x ,a , b , s;\n\t\tscanf(\"%lld%lld%lld\", &a , &b , &s);\n\t\tx= abs(a)+abs(b);\n\t\tif( s<x ){\n\t\t\tprintf(\"No\");\n\t\t}\n\t\telse if(s>=x){\n\t\t\tif((s-x)%2==0){\n\t\t\t\tprintf(\"Yes\");\n\t\t\t}\n\t\t\telse if((s-x)%2!=0){\n\t\t\t\tprintf(\"No\");\n\t\t\t}\n\t\t\t\n\t\t}\n\t}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,s,sum,sum1,sum2;\n scanf(\"%d %d %d\",&a,&b,&s);\n sum2=abs(a)+abs(b);\n if(sum2<=s&&((s-sum2)%2==0))\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&s);\n if(a<0)\n {\n a=a*(-1);\n }\n if(b<0)\n {\n b=b*(-1);\n }\n if(a+b==s)\n printf(\"YES\");\n else if(a+b>s)\n printf(\"NO\");\n else\n {\n if((a+b)%2==0 && s%2==0)\n printf(\"YES\");\n else if((a+b)%2==1 && s%2==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned u;\nint main()\n{\n\tu a,b,n;\n\tscanf(\"%u%u%u\",&a,&b,&n);\n\tif(a>2000000000)a=-a;\n\tif(b>2000000000)b=-b;\n\tprintf((a+b>n)||(((a^b)&1)^(n&1))?\"No\\n\":\"Yes\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int x,y;\n\tunsigned long long int s;\n\tscanf(\"%lld %lld %lld\",&x,&y,&s);\n\tif(x<0)\n\t{\n\t\tx=-1*x;\n\t}\n\tif(y<0)\n\t{\n\t\ty=-1*y;\n\t}\n\tif(s<(x+y)||((s-x-y)%2)!=0)\n\t{\n\t\tprintf(\"No\");\n\t}\n\tif(s>=(x+y)&&(s-x-y)%2==0)\n\t{\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}\n\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int a,b,c,x;\n scanf(\"%d%d%d\",&a,&b,&c);\n a=abs(a);\n b=abs(b);\n x=c-(a+b);\n if((c-(a+b)>1&&x%2==0)||a+b==c)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main ()\n{\n long long a,b,s,i,j,flag=0;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n a=abs(a);\n b=abs(b);\n s=abs(s);\n\n\n if((a+b==s) ||( (a+b)%2==0 && s%2==0 && s>=(a+b) )||( (a+b)%2!=0 && s%2!=0 && s>=a+b))\n printf(\"Yes\");\n else\n printf(\"No\");\n // if(s<(a+b))\n // printf(\"NO\");\n //else if((s-(a+b))%2==0)\n // printf(\"YES\");\n //else if(s>=(a+b))\n // printf(\"YES\");\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tlong long int x,y,a;\n\n\tscanf(\"%lld %lld %lld\",&x,&y,&a);\n\tif(abs(abs(a)-abs(x)+abs(y)) % 2 || (abs(x)+abs(y) > abs(a))){ puts(\"No\"); return 0; }\n\tputs(\"Yes\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n if(abs(abs(a)+abs(b))<=s && abs(abs(abs(a)+abs(b))-s)%2==0)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "//\n// main.c\n// Codeforce\n//\n// Created by izmaylav on 4/20/15.\n// Copyright (c) 2015 izmaylav. All rights reserved.\n//\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <float.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n\nint main(int argc, const char * argv[]) {\n char inputString[6000000];\n \n gets(inputString);\n \n char *aString = strtok(inputString, \" \");\n int a = abs(atoi(aString));\n \n char *bString = strtok(NULL, \" \");\n int b = abs(atoi(bString));\n \n char *cString = strtok(NULL, \" \");\n int c = atoi(cString);\n if ((a + b < c && !((c - (a + b)) % 2)) || (a + b == c)) {\n printf(\"Yes\");\n } else {\n printf(\"No\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main( )\n{\n\tlong long int a,b,s,c,k,l;\n\tscanf(\"%lld %lld %lld\",&a,&b,&s);\n\tk=fabs(a);\n\tl=fabs(b);\n\tif((fabs(a)+fabs(b))!=0)\n\t{\n\t\tif((s)%(k+l)==0)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse if((s>(k+l))&&((s-(k+l))%2==0))\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(s%2==0)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int x,a,b,s;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n //printf(\"%I64d %I64d %I64d\",a,b,s);\n //x=a+b;\n if(a<0)\n a*=-1;\n if(b<0)\n b*=-1;\n if(s>=a+b)\n {\n if(a%2==0 && b%2==0 && s%2==0)\n printf(\"Yes\\n\");\n else if(a%2!=0 && b%2!=0 && s%2==0)\n printf(\"Yes\\n\");\n else if(a%2==0 && b%2!=0 && s%2!=0)\n printf(\"Yes\\n\");\n else if(a%2!=0 && b%2==0 && s%2!=0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n else\n printf(\"No\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,b,s;\n scanf(\"%ld%ld%ld\",&a,&b,&s);\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n if((a+b)>s)\n printf(\"No\\n\");\n else\n {\n //s-=(a+b);\n if(s%2==(a+b)%2)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nlong long int a,b,c;\nscanf(\"%lld%lld%lld\",&a,&b,&c);\nif ((c>= ((a>0)? a:-a)+((b>0)? b:-b))&&((((a>0)?a:-a)+((b>0)?b:-b)-c)%2==0))\nprintf(\"Yes\");\nelse\nprintf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<0){\n a=-a;\n }\n if(b<0){\n b=-b;\n }\n if(c<(a+b)){\n printf(\"NO\");\n }\n else if(c==(a+b)){\n printf(\"YES\");\n }\n else if(c==(-a)||c==(-b)){\n printf(\"NO\");\n }\n else{\n if((a+b)%2==0 && c%2==0){\n printf(\"YES\");\n }\n else if((a+b)<0){\n printf(\"NO\");\n }\n else if((a+b)%2!=0 && c%2!=0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s,n;\n scanf(\"%d %d %d\",&a,&b,&s);\n if(a==0&&b==0)\n {\n if(s%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n else\n {\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n if((s-a-b)<0)\n printf(\"NO\\n\");\n else\n {\n n=s-a-b;\n if(n%2==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n\n{\n long long a,b,s,r;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a<0){a=-a;}\n if(b<0){b=-b;}\n r=a+b;\n\n if(s>=r)\n {\n if(r%2==0)\n {\n if(s%2==0){printf(\"Yes\");}\n else{printf(\"No\");}\n }\n if(r%2!=0)\n {\n if(s%2!=0){printf(\"Yes\");}\n else{printf(\"No\");}\n }\n\n }\n if(s<r){printf(\"No\");}\n\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long int a, b, s, aabs, babs;\n\tscanf(\"%llu%llu%llu\", &a, &b, &s);\n aabs = llabs(a); babs = llabs(b);\n\n\tif(a == 0 && b == 0){\n\t\tif(s % 2 == 0)\tprintf(\"YES\\n\");\n\t\t\telse\tprintf(\"NO\\n\");\n\t}\n\t\telse{\n\t\t\tif(aabs + babs == s)\tprintf(\"YES\\n\");\n\t\t\t\telse\tif((aabs + babs) < s && (s - (aabs + babs)) % 2 == 0)\tprintf(\"YES\\n\");\n\t\t\t\t\telse\tprintf(\"NO\\n\");\n\t\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n long long int s;\n int a,b;\n\n scanf(\"%d %d %lld\", &a, &b, &s);\n\n if(a<0) a=-a;\n if(b<0) b=-b;\n\n if(s<(a+b)) printf(\"No\\n\");\n else if((s%2) != (a+b)%2) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n \n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s;\n scanf(\"%d%d%d\",&a,&b,&s);\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n \n if(a-s+b<=0&&(s-a-b)%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\nlong int a,b,s;\nscanf(\"%li%li%li\",&a,&b,&s);\na=abs(a);\nb=abs(b);\nif(a==0 && b==0 && s%2==0)\t\nprintf(\"Yes\");\nelse if(a+b==s)\t\nprintf(\"Yes\");\nelse if((s-a-b)>0 && (s-a-b)%2==0)\nprintf(\"Yes\");\nelse\nprintf(\"No\");\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n long long int a,b,s,sum;\n\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n\n sum=abs(a)+abs(b)-s;\n\n if(s<abs(a)+abs(b))\n printf(\"No\");\n else if(abs(a)+abs(b)==s)\n printf(\"Yes\");\n else if(sum%2!=0)\n printf(\"No\");\n else\n printf(\"Yes\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint kt(int a,int b,int c){\n\tint step=c-(abs(a)+abs(b));\n\tif(step<0 || step%2==1)\n\t\treturn 0;\n\treturn 1;\n}\nint main(){\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tif(kt(a,b,c))\n\t\tprintf(\"Yes\");\n\telse\n\t\tprintf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s,sum,l;\n scanf(\"%d%d%d\",&a,&b,&s);\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n sum=a+b;\n l=s-sum;\n if(l<0||l%2!=0)\n printf(\"No\");\n else if(l%2==0)\n printf(\"Yes\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\", &a,&b,&s);\n\tlong long n=abs(a)+abs(b);\n\tlong long m=s-n;\n\tif(s<0){\n\t\tprintf(\"invalid input\");\n\t}\n\telse if(s<n){\n\t\tprintf(\"No\");\n\t}\n\telse if(m%2!=0){\n\t\tprintf(\"No\");\n\t}\n\telse if(m%2==0){\n\t\tprintf(\"Yes\");\n\t}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n// 515A\nint main(){\n int a, b, s;\n scanf(\"%d%d%d\", &a, &b, &s);\n \n if(s < abs(a) + abs(b) ){\n printf(\"No\");\n }\n else if((s - abs(a) - abs(b)) % 2 == 0 || s == abs(a) + abs(b)) printf(\"Yes\");\n else printf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tlong int x;\n\tlong int t;\n\tlong int z;\n\t//long long int s=0;\n\tscanf(\"%lld\",&x);\n\tscanf(\"%lld\",&t);\n\tscanf(\"%lld\",&z);\n\tif(x<0)\n\t\tx=x*-1;\n\tif(t<0)\n\t\tt=t*-1;\n\tif(x+t>z){\n\tprintf(\"NO\");\n\treturn 0;\n\t}\n\tif((z-(x+t))%2==0){\n\tprintf(\"YES\");\n\t}\n\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include \"stdio.h\"\n#include \"stdlib.h\"\n\nint main(int argc, char* argv[])\n{\n int a, b, s;\n scanf(\"%d %d %d\",&a,&b,&s);\n a=abs(a);b=abs(b);\n\n if ((a+b>s) || ((s-a+b) % 2!=0)) {printf(\"NO\");} else {printf(\"YES\");}\n scanf(\"%d %d %d\",&a,&b,&s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,s,i=0,flag=0;\n scanf(\"%d %d %d\",&a,&b,&s);\n if(s<(abs(a)+abs(b))) {printf(\"NO\"); return 0;}\n else\n /*{while(i<=s-(a+b))\n {\n if(s==(abs(a)+abs(b))+2*i)\n {\n flag=1;\n break;\n }\n else\n flag=0;\n i++;\n }}*/\n if((s-abs(a)-abs(b))%2==0) printf(\"YES\");\n else printf(\"NO\");\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,s,b,sum;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n sum=abs(a)+abs(b);\n if(b==0&&a==0&&s%2==0) printf(\"Yes\");\n else if(sum>s) printf(\"No\");\n else if(sum%2!=0&&s%2!=0) printf(\"Yes\");\n else if(sum%2==0&&s%2==0) printf(\"Yes\");\n else printf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\", &a,&b,&s);\n\tlong long n=abs(a)+abs(b);\n\tlong long m=s-n;\n\tif(s<0){\n\t\tprintf(\"invalid input\");\n\t}\n\telse if(s<n){\n\t\tprintf(\"No\");\n\t}\n\telse if(m%2!=0){\n\t\tprintf(\"No\");\n\t}\n\telse if(m%2==0){\n\t\tprintf(\"Yes\");\n\t}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a, b, s;\n\tscanf(\"%d %d %d\", &a, &b, &s);\n\ta = abs(a), b = abs(b);\n\tif (a + b > s) printf(\"NO\");\n\telse if (a + b == s) printf(\"YES\");\n\telse\n\t{\n\t\tif ((s-a-b) % 2 == 0)printf(\"YES\");\n\t\telse printf(\"NO\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if(a<0)\n a*=-1;\n if(b<0)\n b*=-1;\n if(c<0)\n c*=-1;\n if(a+b==c||(c-a+b)%2==0&&a+b<c)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n long long x,a,b,s;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a<0)\n {\n a=-a;\n }\n if(b<0)\n {\n b=-b;\n }\n x=a+b;\n x=s-x;\n if(x==0)\n {\n printf(\"Yes\\n\");\n }\n else if(x<0)\n {\n printf(\"No\\n\");\n }\n else\n {\n if(x%2==0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long x,y,s,minus;\n while(scanf(\"%ld %ld %ld\",&x, &y, &s)!=EOF)\n {\n if(x<0) x=-1*x;\n if(y<0) y=-1*y;\n minus=s-(x+y);\n if(minus<0)\n printf(\"No\\n\");\n else\n {\n if(minus&1)\n printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long int a, b, s, aabs, babs;\n\tscanf(\"%llu%llu%llu\", &a, &b, &s);\n aabs = llabs(a); babs = llabs(b);\n\n\tif(a == 0 && b == 0){\n\t\tif(s % 2 == 0)\tprintf(\"YES\\n\");\n\t\t\telse\tprintf(\"NO\\n\");\n\t}\n\t\telse{\n\t\t\tif(aabs + babs == s)\tprintf(\"YES\\n\");\n\t\t\t\telse\tif((aabs + babs) < s && (s - (aabs + babs)) % 2 == 0)\tprintf(\"YES\\n\");\n\t\t\t\t\telse\tprintf(\"NO\\n\");\n\t\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\nlong long int a,b,s;\nscanf(\"%lld %lld %lld\",&a,&b,&s);\nif(a<0)\na=-a;\nif(b<0)\nb=-b;\na=s-a-b;\nif((a>=0)&&(a%2==0)){\n\tprintf(\"YES\");\n\treturn 0;\n}else{printf(\"NO\");\n\treturn 0;\n}}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,n;\n scanf(\"%d%d%d\",&a,&b,&n);\n if(a<0) a=a*-1;\n if(b<0) b=b*-1;\n if(a+b>n||(n-a-b)%2==1) printf(\"No\");\n else printf(\"Yes\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long a,b,s,x;\n scanf(\"%li %li %li\",&a,&b,&s);\n if (a<0)\n a=(-a);\n if (b<0)\n b=(-b);\n\n x=s-(a+b);\n\n if (((x%2)==0)&& (s>=(a+b)))\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(a<0)\n {\n a=-a;\n }\n if(b<0)\n {\n b=-b;\n }\n // printf(\"%lld\",a);\n if(s>=a+b)\n {\n if((a+b-s)%2==0)\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n }\n else\n {\n printf(\"No\");\n }\n \n \n \n \n}"}, {"source_code": "#include<stdio.h>\n\nint absolute(int a){\n if(a>0)\n return a;\n else\n return -a;\n}\n\nint main(){\n int a,b,s;\n scanf(\"%d %d %d\", &a,&b,&s);\n int sum = absolute(a)+absolute(b);\n if( s >= sum && (s - sum) %2 == 0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tlong int a = 0, b = 0, s = 0;\n\n\tscanf(\"%ld %ld %ld\", &a, &b, &s);\n\n\tif (abs(a) + abs(b) <= s && (a + b - s) % 2 == 0){\n\n\tprintf(\"Yes\");\n\t\n\t}\n\telse printf(\"No\");\t\n\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<math.h>\nint main()\n{\n long long int a,b,c;\n scanf(\"%lli %lli %lli\",&a,&b,&c);\n if((c-abs(a)-abs(b))>=0&&(c-abs(a)-abs(b))%2==0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int a,b,s,e;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n a*=(a<0?-1:1);\n b*=(b<0?-1:1);\n e=s-a-b;\n if(e>=0&&e%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long int x,y,s;\n scanf(\"%lld%lld%lld\",&x,&y,&s);\n if(abs(x)+abs(y)>s)\n {\n printf(\"No\\n\");\n }\n else\n {\n if(x+y==s)\n {\n printf(\"Yes\\n\");\n }\n else if((s-(x+y))%2==0)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int a, b, s;\n scanf(\"%d %d %d\", &a, &b, &s);\n if (a < 0) a = -a;\n if (b < 0) b = -b;\n if ((s-a-b)%2 == 0 && (s-a-b) >= 0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long x,y,a,b,c,d;\n scanf(\"%ld %ld %ld\",&x,&y,&a);\n if(x>=0 && y>=0)\n b=x+y;\n if(x>0 && y<0)\n b=x+(-1)*y;\n if(x<0 && y>0)\n b=y+(-1)*x;\n if(x<0 && y<0)\n b=(-1)*x+(-1)*y;\n //printf(\"%d\\n\",b);\n if(b>a)\n printf(\"NO\\n\");\n else if(b==a)\n printf(\"YES\\n\");\n else if(((b-a)%2==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long int a ;\n scanf(\"%d\",&a) ;\n long int b ;\n scanf(\"%d\",&b) ;\n long int s ;\n scanf(\"%d\",&s) ;\n\n if (a+b>s){\n if ((s-a-b)%2==0){\n printf(\"YES\") ;\n }\n else {\n printf(\"NO\");\n\n }\n }\n else {\n if ((a+b-s)%2==0){\n printf(\"YES\") ;\n }\n else {\n printf(\"NO\");\n\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long n,m,k,t,d=1;\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n t=abs(m)+abs(n);\n if(t>k)\n d=t-k;\n if(t==k||d%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n long long int s;\n int a,b;\n\n scanf(\"%d %d %lld\", &a, &b, &s);\n\n if(!((a+b)%2)){\n if(s>=(a+b) && !(s%2))printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n else{\n if(s>=(a+b) && (s%2)) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n if(a+b==c||(c-a+b)%2==0||(c%2==0&&a==0&&b==0))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\nint a, b, s;\n\nscanf(\"%d %d %d\", &a, &b, &s);\n\nif(s < a+b)\nprintf(\"No\");\n\nelse\n{\n\nif((s - (a+b))%2 == 0)\nprintf(\"Yes\");\n\nelse\nprintf(\"No\");\n\n}\n\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tlong long int i,j,k,l,m,n,a,b;\n\tprintf(\"Enter the verda location points, and no.of steps to reach\\n\");\n\tscanf(\"%I64d%I64d%I64d\",&a,&b,&n);\n\tif(a<0) a=a*(-1);\n\tif(b<0) b=b*(-1);\n\tif(a+b<=n&&(n-(a+b))%2==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a, b, s;\n\n scanf(\"%d %d %d\", &a, &b, &s);\n\n if(((s-(a+b))%2) == 0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nlong long int a,b,c;\nscanf(\"%lld%lld%lld\",&a,&b,&c);\nif ((c>= a+b)&&((a+b-c)%2==0))\nprintf(\"Yes\");\nelse\nprintf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long int a ;\n scanf(\"%d\",&a) ;\n long int b ;\n scanf(\"%d\",&b) ;\n long int s ;\n scanf(\"%d\",&s) ;\n if (a+b<s){\n printf(\"NO\");\n }\n else {\n if ((s-a-b)%2==0){\n printf(\"YES\") ;\n }\n else {\n printf(\"NO\");\n\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main()\n{\n long int a;\n long int b;\n long int s;\n long int x;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n scanf(\"%d\",&s);\n x=abs(a)+abs(b);\n if ((x==s)||((x==0)&&(s==2))||((x==0)&&(s==0)))\n {\n printf(\"Yes\");\n }\n else\n {\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tint x=a+b;\n\tint d=s-x;\n\tif(d>=0 && (d==0 || d%2==0))\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n \tint a, b, s;\n\tscanf (\"%d %d %d\", &a, &b, &s);\n\tint t=s-a-b;\n\tif (t%2==0 && t>0) printf (\"Yes\");\n\telse printf (\"No\");\n\treturn 0;\n}\n\n// code by nhuquynh.\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s,c;\n scanf(\"%d%d%d\",&a,&b,&s);\n\n c=s-(a+b);\n\n if((a+b)>s)printf(\"No\\n\");\n else if(c%2!=0)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,s;\n scanf(\"%d%d%d\",&x,&y,&s);\n if(x+y<=s)\n {if((x+y)%2==s%2)\n printf(\"Yes\");\n else\n printf(\"No\");}\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() \n{\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n long long int sum,i;\n sum=abs(b)+abs(a);\n if(s>=sum&&(a!=0||b!=0))\n {\n for(;s>=sum;s=s-sum)\n {\n }\n }\n if((s%2)==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d %d\",&a,&b,&s);\n\tif (a+b>=s && (a+b+s)%2==0) printf(\"YES\");\n\telse printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long a,b,s;\n scanf(\"%lld\",&a);\n scanf(\"%lld\",&b);\n scanf(\"%lld\",&s);\n if(a==0 && b==0 && s==2)\n printf(\"Yes\\n\");\n else if(a+b==s)\n printf(\"Yes\\n\");\n else \n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s,c;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(a==0&&b==0)\n {\n if(s%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else if(a==b)\n {\n if(a<0) a=a*-1;\n if(2*a<=s)\n printf(\"Yes\");\n else printf(\"No\");\n }\n else if(a>b)\n {\n if(2*b+a-b<0) c=(2*b+a-b)*-1;\n else c=2*b+a-b;\n if(c<=s)\n printf(\"Yes\");\n else printf(\"No\");\n }\n else if(a<b)\n {\n if(2*a+b-a<0) c=(2*a+b-a)*-1;\n else c=2*a+b-a;\n if(c<=s)\n printf(\"Yes\");\n else printf(\"No\");\n } \n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\tint a,b,s;\n\tscanf(\"%d %d %d\",&a,&b,&s);\n\n\tif((s-a-b)%2==0)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\", &a,&b,&s);\n\t a=abs(a);\n\t b=abs(b);\n\t if(a+b>=s && (s-a-b)%2==0){\n\t \tprintf(\"Yes\");\n\t } \n\t else printf(\"No\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n long long x,a,b,s;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n x=a+b;\n x=s-x;\n if(x==0)\n {\n printf(\"Yes\\n\");\n }\n else if(x<0)\n {\n printf(\"No\\n\");\n }\n else\n {\n if(x%2==0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n \n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tif(a==0&&b==0){\n\t\tif(s%2==0) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}else if(a==0&&b!=0){\n\t\tif(s==abs(b)) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}else if(b==0&&a!=0){\n\t\tif(s==abs(a)) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}else{\n\t\tif(s==abs(a)+abs(b)) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,s;\n scanf(\"%d%d%d\",&x,&y,&s);\n if(x+y>s)\n {if((x+y)%2==s%2)\n printf(\"Yes\");\n else\n printf(\"No\");}\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int a,b,s,i,j,flag=0;\n scanf(\"%d %d %d\",&a,&b,&s);\n\n if(s<(a+b))\n printf(\"NO\");\n else if((s-a+b)%2==0)\n printf(\"YES\");\n //else if(s>=(a+b))\n // printf(\"YES\");\n else\n printf(\"NO\");\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nint a,b,c;\nscanf(\"%d%d%d\",&a,&b,&c);\nif ((c>= a+b)&&((a+b-c)%2==0))\nprintf(\"Yes\");\nelse\nprintf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int x,y,a;\n scanf(\"%I64d%I64d%I64d\",&x,&y,&a);\n if((x==0 && y==0)&& a%2==0)printf(\"Yes\\n\");\n else if((x==0 && y==0)&& a%2!=0)printf(\"No\\n\");\n else if((abs(x)+abs(y))==a)printf(\"Yes\\n\");\n else if((a-(abs(x)+abs(y)))%2 ==0)printf(\"Yes\\n\");\n else printf(\"No\\n\");\n\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,s;\n scanf(\"%d %d %d\", &a,&b,&s);\n a=abs(a);\n b=abs(b);\n\n if(a+b>s || (s-a-b%2==1))\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long sum, x, y, n;\n\tscanf(\"%I64d%I64d%I64d\", &x, &y, &n);\n\tsum=(x>0?x:-x)+(y>0?y:-x);\n\tif(n<sum)\n\t{\n\t\tprintf(\"No\\n\");\n\t}\n\telse if(n>=sum)\n\t{\n\t\tif(n%2==0)\n\t\t{\n\t\t\tif(sum%2==0)\n\t\t\t{\n\t\t\t\tprintf(\"Yes\\n\"); \n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"No\\n\");\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n%2!=0)\n\t\t\t{\n\t\t\t\tif(sum%2!=0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"No\\n\");\n\t\t\t\t} \n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n\n{\n int a,b,s,r;\n scanf(\"%d %d %d\",&a,&b,&s);\n r=a+b;\n if(s>=r)\n {\n if(r%2==0)\n {\n if(s%2==0){printf(\"Yes\");}\n else{printf(\"No\");}\n }\n if(r%2!=0)\n {\n if(s%2!=0){printf(\"Yes\");}\n else{printf(\"No\");}\n }\n if(s<r){printf(\"No\");}\n }\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\tint main (){\n\t\tlong long x ,a , b , s;\n\t\tscanf(\"%lld%lld%lld\", &a , &b , &s);\n\t\tif( s<a+b ){\n\t\t\tprintf(\"No\");\n\t\t}\n\t\t\n\t\tx= abs(a)+abs(b);\n\t\t\n\t\t if((s-x)%2==0){\n\t\t\tprintf(\"Yes\");\n\t\t}\n\t\telse if((s-x)%2 !=0){\n\t\t\tprintf(\"No\");\n\t\t}\n\t}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tif(a<0)\n\t\ta*=-1;\n\tif(b<0)\n\t b*=-1;\n\tif((a+b)==0){\n\t\tif(s%2==1){\n\t\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\tprintf(\"YES\");\n\t}\n\telse{\n\tif(a+b>s||(s%2)==1){\n\t\tprintf(\"NO\");\n\t}\n\telse{\n\t\tprintf(\"YES\");\n\t}\n}\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b, s;\n scanf(\"%d%d%d\", &a, &b, &s);\n if(a<0 && b>0)\n {\n a = -1*a;\n }\n else if(a<0 && b<0)\n {\n a = -1 * a;\n b = -1*b;\n }\n else if(a>0 && b<0)\n {\n b = b*-1;\n }\n if(a+b<=s)\n {\n if((a+b-s)%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else if(a+b>s)\n {\n printf(\"No\");\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int a,b,s,sum,j=0;\n\tprintf(\"Enter the x,y coordinate and the value of s :\");\n\tscanf(\"%ld %ld %ld\",&a,&b,&s);\n\tsum=a+b;\n\tif(sum%2==0&&s%2==0&&s>=sum)\n\t{\n\tprintf(\"YES\");\n\tj=1;\n }\n\tif(sum%2!=0&&s%2!=0&&s>=sum)\n\t{\n\tprintf(\"YES\");\n\tj=1;\n }\n\tif(j==0)\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,s,r;\n scanf(\"%d %d %d\",&a,&b,&s);\n if(abs(a)+abs(b)==s)\n printf(\"YES\");\n\n else if(s%2==0 && a==b)\n printf(\"YES\");\n else printf(\"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s,s1;\n scanf(\"%d%d%d\",&a,&b,&s);\n s1=a+b;\n //printf(\"%d\",s1);\n if((a==0&&b==0&&s%2==0)||s1==s)\n printf(\"Yes\");\n //else if(s1==s)\n //printf(\"Yes\");\n else\n printf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tint x,y,a;\n\n\tscanf(\"%d %d %d\",&x,&y,&a);\n\tif(abs(a-(x+y)) % 2){ puts(\"No\"); return 0; }\n\tputs(\"Yes\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\t\tint a,b,s;\n\t\tscanf(\"%d %d %d\",&a,&b,&s);\n\t\tif((a+b)>s)\n\t\tprintf(\"No\");\n\t\telse if((a+b)==s)\n\t\tprintf(\"Yes\");\n\t\telse if (s>a+b)\n\t\t{ if(0==(s-(a+b))%2)\n\t\tprintf(\"Yes\");\n\t\telse \n\t\tprintf(\"No\");\n\t\t}\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n long long x,a,b,s;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n x=a+b;\n x=s-x;\n if(x==0)\n {\n printf(\"Yes\\n\");\n }\n else if(x<0)\n {\n printf(\"No\\n\");\n }\n else\n {\n if(x%2==0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,b,s,i;\n\t\n\tscanf(\"%lld%lld%lld\",&a,&b,&s);\n\ti=a+b-s;\n\tif(i%2==0 && i>=0)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nmain()\n{\n long a=0,b=0,s=0;\n \n scanf(\"%ld %ld %ld\",&a,&b,&s);\n if(a == 0 && b == 0 && s % 2 == 0)\n printf(\"Yes\");\n else if((abs(a) + abs(b)) < s)\n printf(\"No\");\n else if ((s >= (abs(a) + abs(b)) && \n (s - (abs(a) + abs(b)))%2 ) )\n printf(\"Yes\");\n else\n printf(\"No\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,s,sum;\n scanf(\"%I64d%I64d%I64d\",&a,&b,&s);\n sum=abs(a)+abs(b);\n if(a==0&&b==0&&s%2)printf(\"YES\");\n else if(sum>s)printf(\"NO\");\n else if(sum%2!=0&&s%2!=0)printf(\"YES\");\n else if(sum%2==0&&s%2==0)printf(\"NO\");\n else printf(\"NO\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,s,x,y,z;\n\n scanf(\"%d %d %d\",&a,&b,&s);\n if(s<a+b)\n printf(\"No\\n\");\n else if(s==a+b){\n printf(\"Yes\\n\");\n }\n else{\n x=abs(a+b);\n if(!(x%2)){\n if(!(s%2))\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n else{\n if(s%2)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s,p;\n scanf(\"%d %d %d\",&a,&b,&s);\n p=s-(a+b);\n if(a+b==s||(p%2==0&&p>0)) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a, b ,n;\n\tscanf(\"%d %d %d\", &a, &b, &n);\n\tif (a + b <= n && (n - a - b) % 2 == 0 || (a + b) % 2 != 0 && n % 2 != 0 && n >= a + b)\n\t{\n\t\tprintf(\"%s\\n\", \"Yes\");\n\t\treturn 0;\n\t}\n\tprintf(\"%s\\n\", \"No\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int x,y,z;\n\tscanf(\"%lld%lld%lld\",&x,&y,&z);\n\n\tif(x+y>z)\n\t\tprintf(\"No\\n\");\n\telse if(x+y>=0 && (x+y)%2==0 && x+y<=z)\n\t{\n\t\tif(z%2==0 && z>=x+y)\n\t\t{printf(\"Yes\\n\");}\n\n\t\telse\n\t\t{printf(\"No\\n\");}\n\t}\n\telse if(x+y>=0 && x+y<=z && (x+y)%2==1)\n\t{\n\t\tif(z%2==1 && z>=x+y)\n\t\t{printf(\"Yes\\n\");}\n\n\t\telse\n\t\t{printf(\"No\\n\");}\n\t}\n\n\telse if(x+y<0 && (x+y)%2==0 && x+y<=z)\n\t{\n\t\tif(z%2==0 && z>=x+y)\n\t\t{printf(\"Yes\\n\");}\n\n\t\telse\n\t\t{printf(\"No\\n\");}\n\t}\n\telse if(x+y<0 && x+y<=z && (x+y)%2==-1)\n\t{\n\t\tif(z%2==0 && z>=x+y)\n\t\t{printf(\"Yes\\n\");}\n\n\t\telse\n\t\t{printf(\"No\\n\");}\n\t}\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,n;\nscanf(\"%d%d%d\",&a,&b,&n);\nif((a+b-n)%2)\nprintf(\"No\");\nelse\nprintf(\"Yes\");\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,k;\n scanf(\"%d %d %d\",&n,&m,&k);\n i=n+m;\n if(i<k || (i-k)%2==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\n\nint a,b,s;\nscanf(\"%d%d%d\",&a,&b,&s);\nif(a<0)\n{\n a=a*-1;\n \n}\n\n\nif(b<0)\n{\n b=b*-1;\n \n \n \n}\n\nif(s==a+b)\n\n{\n\nprintf(\"Yes\");\n\n}\n\nelse if(s<a || s<b)\n{\n\nprintf(\"No\");\n\n\n}\n\nelse if(s>a+b)\n\n{\n \nif(s%2)\n{ \n printf(\"No\");\n\n } \n \n else\n {\n \n printf(\"Yes\");\n }\n\n\n \n}\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,k;\n scanf(\"%d %d %d\",&a,&b,&k);\n if (a+b<=k && a+b%2==k%2)\n {\n printf(\"YES\\n\");\n }else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,b,s;\n scanf(\"%ld%ld%ld\",&a,&b,&s);\n if(s<(a+b-2))\n printf(\"No\\n\");\n else\n {\n if(s%2!=0)\n {\n if((a+b)%2!=0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n else\n {\n if((a+b)%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n long long int a,b,s;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n if(a<0)\n a=(0-a);\n if(b<0)\n b=(0-b);\n if((a==0 && b==0 && s==2) || (a+b==s) || ((s-(a+b))%2==0))\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int a,b,s;\n scanf(\"%ld%ld%ld\",&a,&b,&s);\n if(s<(a+b-2))\n printf(\"No\\n\");\n else\n {\n if(s%2!=0)\n {\n if((a+b)%2!=0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n else\n {\n if((a+b)%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,s;\n scanf(\"%d%d%d\",&a,&b,&s);\n if((s>=(a+b))&& (s-(a+b))%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long int i,j,a,b,sum;\n scanf(\"%d %d %d\",&a,&b,&j);\n \n i=abs(a+b-j);\n \n if(j<a+b)\n printf(\"No\");\n else\n {\n \n if(i%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,c;\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tlong long l=c-(abs(a)+abs(b)-2);\n\tlong long k=abs(a)+abs(b)+c;\n\tif (l>=0 && k%2==0) printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,s,x,y;\n scanf(\"%d%d%d\",&a,&b,&s);\n x=abs(s-(a+b));\n y=a+b;\n if((s>=y) && x%2==0)\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(s>=(a+b))\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0; \n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nlong long int a,b,c;\nscanf(\"%lld%lld%lld\",&a,&b,&c);\nif ((c>= a+b)&&((a+b-c)%2==0))\nprintf(\"Yes\");\nelse\nprintf(\"No\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tint c=abs(a)+abs(b);\n\tif(c>s)\n\t\tprintf(\"No\");\n\telse if(c==s) printf(\"Yes\");\n\telse{\n\t\tif(s%2==0)\n\t\t\tprintf(\"Yes\");\n\t\telse\n\t\t\tprintf(\"No\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n long long a,b,s;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a+b!=s)\n {\n printf(\"No\\n\");\n }\n else if(((a+1)+(b+1))==s)\n {\n printf(\"Yes\\n\");\n }\n else if(a-b!=s)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nmain()\n{\n long a=0,b=0,s=0;\n \n scanf(\"%ld %ld %ld\",&a,&b,&s);\n if(a == 0 && b == 0 && s % 2 == 0)\n printf(\"Yes\");\n else if((abs(a) + abs(b)) < s)\n printf(\"No\");\n else if ((s >= (abs(a) + abs(b)) && \n (s - (abs(a) + abs(b)))%2 ) )\n printf(\"Yes\");\n else\n printf(\"No\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tlong long int i,j,k,l,m,n,a,b;\n\tprintf(\"Enter the verda location points, and no.of steps to reach\\n\");\n\tscanf(\"%I64d%I64d%I64d\",&a,&b,&n);\n\tif(a<0) a=a*(-1);\n\tif(b<0) b=b*(-1);\n\tif(a+b<=n&&(n-(a+b))%2==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n long long int a, b, s, d;\n scanf(\"%lld %lld %lld\", &a, &b, &s);\n d= a+b;\n if(a==0 && b==0){\n if(s%2==0){\n printf(\"Yes\\n\");\n }\n else{\n printf(\"No\\n\");\n }\n }\n else if(d>=s){\n if(d%2==0){\n printf(\"Yes\\n\");\n }\n else{\n printf(\"No\\n\");\n }\n }\n else{\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void) {\n // your code goes here\n long long int x,y;\n long long int s;\n long long int small;\n scanf(\"%lld %lld %lld\",abs(&x),abs(&y),&s);\n //printf(\"%d %d\", x, y);\n small=x+y;\n if(small%2==s%2 && s>=small)\n printf(\"Yes\");\n else\n printf(\"No\");\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tint c=a+b;\n\tif(c>s)\n\t\tprintf(\"No\");\n\telse if(c==s) printf(\"Yes\");\n\telse{\n\t\tif(s%2==0)\n\t\t\tprintf(\"Yes\");\n\t\telse\n\t\t\tprintf(\"No\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld%lld%lld\",&a,&b,&s);\n if(abs(a+b)<=s && abs(abs(a+b)-s)%2==0)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long int i,j,a,b,sum;\n scanf(\"%d %d %d\",&a,&b,&j);\n \n i=abs(a+b-j);\n \n if(j<a+b)\n printf(\"No\");\n else\n {\n \n if(i%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,c;\n\tscanf(\"%lld %lld %lld\",&a,&b,&c);\n\tlong long l=c-(abs(a)+abs(b)-2);\n\tlong long k=abs(a)+abs(b)+c;\n\tif (l>=0 && k%2==0) printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long int a, b, s, realL;\n scanf(\"%ld%ld\",&a, &b);\n scanf(\"%ld\",&s);\n\n realL = a+b;\n if(s-realL < 0)\n printf(\"No\\n\");\n else{\n if(s-realL == 0)\n printf(\"Yes\\n\");\n else{\n if((s-realL)%(s-realL)==0)\n printf(\"Yes\\n\");\n else{\n if((s-realL)%2)\n printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n }\n }\n }\n return 0;\n}\n\n "}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main (){\n\tint a,b,x;\n\tscanf(\"%d%d%d\",&a,&b,&x);\n\tif ((abs(a)+abs(b))==x){\n\t\tprintf(\"yes\");\n\t}\n\telse if ((a==0) && (b==0)){\n\t\tprintf(\"yes\");\n\t}\n\telse {\n\t\tprintf(\"no\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int a, b, s;\n scanf(\"%d %d %d\", &a, &b, &s);\n if ((s-a-b)%2 == 0 && (s-a-b) >= 0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\nint main(int argc, char const *argv[])\n{\n\tlong long int a,b,s;\n\tscanf(\"%lld %lld %lld\",&a,&b,&s);\n\ts -= a+b;\n\tif(s < 0)printf(\"NO\");\n\telse if(s % 2 == 1) printf(\"NO\");\n\telse printf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\",&a,&b,&s);\n\tif(a==0&&b==0){\n\t\tif(s%2!=0) printf(\"No\");\n\t\telse printf(\"Yes\");\n\t} \n\telse{\n\t\tif(s%(a+b)==0) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint a,b,s;\n\tscanf(\"%d%d%d\",&a,&b,&s);\n\tint c=a+b;\n\tif(c>s)\n\t\tprintf(\"No\");\n\telse if(c==s) printf(\"Yes\");\n\telse{\n\t\tif(s%2==0)\n\t\t\tprintf(\"Yes\");\n\t\telse\n\t\t\tprintf(\"No\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void) {\n // your code goes here\n long long int x,y;\n long long int s;\n long long int small;\n scanf(\"%lld %lld %lld\",abs(&x),abs(&y),&s);\n //printf(\"%d %d\", x, y);\n small=x+y;\n if(small%2==s%2 && s>=small)\n printf(\"Yes\");\n else\n printf(\"No\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long x,y,a,b,c,d;\n scanf(\"%ld %ld %ld\",&x,&y,&a);\n if(x>0 && y>0)\n b=x+y;\n if(x>0 && y<0)\n b=x+(-1)*y;\n if(x<0 && y>0)\n b=y+(-1)*x;\n if(x<0 && y<0)\n b=(-1)*x+(-1)*y;\n if(x==0 && y==0)\n b=2;\n if(b==a)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,s,p;\n scanf(\"%d%d%d\",&a,&b,&s);\n if(a<0)\n a=(-a);\n if(b<0)\n b=(-b);\n p=(a+b);\n s=s-(a+b);\n if(s<p || s%2==0)\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n a=abs(a);\n b=abs(b);\n if(c-(a+b)>1||a+b==c)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main (){\n\tlong long a,b,x;\n\tscanf(\"%lld%lld%lld\",&a,&b,&x);\n\tif (((abs(a)+abs(b))==x) && ((x-(abs(a)+abs(b)))%2==0)){\n\t\tprintf(\"yes\");\n\t}\n\telse {\n\t\tprintf(\"no\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main( )\n{\n\tlong long int a,b,s,c;\n\tscanf(\"%lld %lld %lld\",&a,&b,&s);\n\tif((a+b)!=0)\n\t{\n\t\tif((s%(a+b))==0)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"Yes\\n\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(s>=a+b && (s-(a+b))%2==0) puts(\"Yes\");\n else puts(\"No\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b,steps;\n scanf(\"%d%d%d\",&a,&b,&steps);\n if(steps < abs(a)+abs(b) || abs(a)+abs(b)+1 == steps)\n printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,k;\n scanf(\"%d %d %d\",&n,&m,&k);\n i=n+m;\n if(i>k || (k-i)%2==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\nlong long x,y,s;\nint main()\n{\n scanf(\"%I64d %I64d %I64d\", &x, &y, &s);\n if (x<0 && y<0)\n {\n if ((s==(-1*x+-1*y)))\n {\n printf(\"YES\");\n }\n else if (s>(-1*x+-1*y))\n {\n if (((s-(-1*x+-1*y))%2)==0)\n {\n printf(\"YES\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n }\n else if (x<0&&y>0)\n {\n if ((s==(-1*x+1*y)))\n {\n printf(\"YES\");\n }\n else if (s>(-1*x+1*y))\n {\n if (((s-(-1*x+1*y))%2)==0)\n {\n printf(\"YES\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n }\n else if (x>0&&y<0)\n {\n if ((s==(1*x+-1*y)))\n {\n printf(\"YES\");\n }\n else if (s>(1*x+-1*y))\n {\n if (((s-(1*x+-1*y))%2)==0)\n {\n printf(\"YES\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n }\n else if ((s==(1*x+1*y)))\n {\n printf(\"YES\");\n }\n\n else if (s>(1*x+1*y))\n {\n if (((s-(1*x+1*y))%2)==0)\n {\n printf(\"YES\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long a,b,s;\n\tscanf(\"%lld%lld%lld\",&a,&b,&s);\n\tif(a+b>s) printf(\"No\"); \n\telse{\n\t\ts=abs(s-(a+b));\n\t\tif(s%2==0) printf(\"Yes\");\n\t\telse printf(\"No\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,s,k;\n scanf(\"%d%d%d\",&a,&b,&s);\n k = abs(a) + abs(b);\n c = k/s;\n if(k==s) {\n printf(\"Yes\");\n }\n else if(a==0 && b==0 && s%2==0) {\n printf(\"Yes\");\n }\n else if(c%2==0 && s > k && s%2==0) {\n printf(\"Yes\");\n }\n else {\n printf(\"No\");\n }\n return 0; \n}"}, {"source_code": "#include \"stdio.h\"\n#include \"math.h\"\nint main(){\n int a,b,s;\n scanf(\"%d %d %d\",&a,&b,&s);\n if((s-(abs(a)+abs(b)))%2==0&&(s>=(a)+(b)))\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s,i;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a<0)a=-a;\n if(b<0)b=-b;\n if(a==0 && b==0){if(s%2==0)printf(\"Yes\");\n return 0;\n }\n for(i=a+b;i<=s;i=i+2){\n if(s%i==0){printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,s;\n scanf(\"%lld %lld %lld\",&a,&b,&s);\n if(a<0) a=0;\n if(b<0) b=0;\n if(s>=(a+b))\n {\n if( (s-(a+b))%2==0)\n {\n printf(\"Yes\\n\"); return 0;\n }\n }\n printf(\"No\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a,b,s,x,y;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&s);\n if(a<0)\n a=0-a;\n if(b<0)\n b=0-a;\n\n x=a+b;\n if(s<x)\n printf(\"No\");\n else\n {\n s=s-x;\n if(s%2==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,s,p;\n scanf(\"%d%d%d\",&a,&b,&s);\n if(a<0)\n a=(-a);\n if(b<0)\n b=(-b);\n p=(a+b);\n s=s-(a+b);\n if(s<p || s%2==0)\n printf(\"No\");\n else\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long int a, b, s, realL;\n scanf(\"%ld%ld\",&a, &b);\n scanf(\"%ld\",&s);\n\n realL = a+b;\n if(s-realL < 0)\n printf(\"No\\n\");\n else{\n if(s-realL == 0)\n printf(\"Yes\\n\");\n else{\n if((s-realL)%(s-realL)==0)\n printf(\"Yes\\n\");\n else{\n if((s-realL)%2)\n printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n }\n }\n }\n return 0;\n}\n\n "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long int a,b,s;\n scanf(\"%ld%ld%ld\",&a,&b,&s);\n if(s<(abs(a+b)-2))\n printf(\"No\\n\");\n else\n {\n if(s%2!=0)\n {\n if((abs(a+b))%2!=0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n else\n {\n if((abs(a+b))%2==0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,v,c,d,e,b,sum=0,sum1;\n\n scanf(\"%d %d %d\",&a,&b,&c);\n\n if(a<0)\n a=-a;\n if(b<0)\n b=-b;\n sum=a+b;\n sum1=sum-c;\n if(sum1<0)\n sum1=-sum1;\n\n if(sum==c)\n printf(\"Yes\\n\");\n else if(sum1%2==0)\n printf(\"Yes\\n\");\n\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,a,b,c;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(c<(a+b)){\n printf(\"NO\");\n }\n else if(c==(a+b)){\n printf(\"YES\");\n }\n else{\n if((a+b)<0){\n printf(\"NO\");\n }\n\n else if((a+b)%2==0 && c%2==0){\n printf(\"YES\");\n }\n\n else if((a+b)%2!=0 && c%2!=0){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n long long int s;\n int a,b;\n\n scanf(\"%d %d %lld\", &a, &b, &s);\n\n if(!((a+b)%2)){\n if(s>=(a+b) && !(s%2))printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n else{\n if(s>=(a+b) && (s%2)) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long long n,m,k,t;\n scanf(\"%lld%lld%lld\",&n,&m,&k);\n t=abs(m-n);\n if(t==k||abs(t-k)==2)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n\tint x,y,a;\n\n\tscanf(\"%d %d %d\",&x,&y,&a);\n\tif(abs(a-(x+y)) % 2 || ((x+y) > a)){ puts(\"No\"); return 0; }\n\tputs(\"Yes\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nvoid isTrue(int a, int b, int s)\n{\n int diff = s - (a+b);\n if(diff >= 0 && diff%2==0)\n {\n printf(\"yes\\n\");\n }\n else printf(\"No\\n\");\n}\nint main()\n{\n int a,b,s;\n scanf(\"%d %d %d\",&a,&b,&s);\n isTrue(a,b,s);\n return 0;\n}\n"}], "src_uid": "9a955ce0775018ff4e5825700c13ed36"} {"nl": {"description": "Little Petya very much likes computers. Recently he has received a new \"Ternatron IV\" as a gift from his mother. Unlike other modern computers, \"Ternatron IV\" operates with ternary and not binary logic. Petya immediately wondered how the xor operation is performed on this computer (and whether there is anything like it).It turned out that the operation does exist (however, it is called tor) and it works like this. Suppose that we need to calculate the value of the expression a tor b. Both numbers a and b are written in the ternary notation one under the other one (b under a). If they have a different number of digits, then leading zeroes are added to the shorter number until the lengths are the same. Then the numbers are summed together digit by digit. The result of summing each two digits is calculated modulo 3. Note that there is no carry between digits (i. e. during this operation the digits aren't transferred). For example: 1410 tor 5010\u2009=\u200901123 tor 12123\u2009=\u200910213\u2009=\u20093410.Petya wrote numbers a and c on a piece of paper. Help him find such number b, that a tor b\u2009=\u2009c. If there are several such numbers, print the smallest one.", "input_spec": "The first line contains two integers a and c (0\u2009\u2264\u2009a,\u2009c\u2009\u2264\u2009109). Both numbers are written in decimal notation.", "output_spec": "Print the single integer b, such that a tor b\u2009=\u2009c. If there are several possible numbers b, print the smallest one. You should print the number in decimal notation.", "sample_inputs": ["14 34", "50 34", "387420489 225159023", "5 5"], "sample_outputs": ["50", "14", "1000000001", "0"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\nvoid tern(int ar[], int size, int num);\n\nvoid tern(int ar[], int size, int num)\n{\n size--;\n\n while (num != 0)\n {\n ar[size] = num % 3;\n num = num / 3;\n size--;\n }\n}\n\nint main()\n{\n int a, c, b = 0, A[25], B[25], C[25], i, j, k, mul = 1, add;\n\n for (i = 0; i < 25; i++)\n {\n A[i] = 0;\n B[i] = 0;\n C[i] = 0;\n }\n\n scanf(\"%d %d\", &a, &c);\n\n tern(A, 25, a);\n tern(C, 25, c);\n\n for (i = 24; i >= 0; i--)\n {\n add = C[i] - A[i];\n\n if (add < 0) add += 3;\n\n b += add * mul;\n mul *= 3;\n }\n\n printf(\"%d\", b);\n\n\n return 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\n long long int a,c,i=0,j=0,b,p,k;\n long long int sum=0;\n scanf(\"%lld%lld\",&a,&c);\n char *s,*t;\n s=(char *)malloc(100);\n t=(char *)malloc(100);\n int n[100];\n b=a;\n while(b!=0){\n s[i]=(b%3)+48;\n b=b/3;\n i++;\n }\n b=c;\n while(b!=0){\n t[j]=(b%3)+48;\n b=b/3;\n j++;\n }\n p=(i>j)?i:j;\n if(i>j){\n for(k=j;k<i;k++)t[k]='0';\n }\n else{\n for(k=i;k<j;k++)s[k]='0';\n }\n s[p]='\\0';t[p]='\\0';\n strrev(s);strrev(t);\n //printf(\"%s %s \",s,t);\n for(i=0;i<p;i++){\n if((t[i]-48)==0&&(s[i]-48)==1)n[i]=2;\n else if((t[i]-48)==0&&(s[i]-48)==2)n[i]=1;\n else if((t[i]-48)==1&&(s[i]-48)==2)n[i]=2;\n else n[i]=(t[i]-48)-(s[i]-48);\n }\n for(i=0,j=p;i<p;i++,j--){\n sum+=n[i]*pow(3,j-1);\n }\n printf(\"%lld\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int A[50]={0},B[50]={0},C[50]={0},a,b=0,c,i,j,k,l[3],m=50,n=50,lim;\n l[0]=0;l[1]=1;l[2]=2;\n scanf(\"%d%d\",&a,&c);\n for(i=49;i>=0;i--)\n {\n j=a%3;\n\n A[i]=j;\n\n a=a/3;\n n--;\n if(a==0)\n break;\n }\n for(i=49;i>=0;i--)\n {\n k=c%3;\n C[i]=k;\n c=c/3;\n m--;\n if(c==0)\n break;\n\n }\n\n if(m<=n)\n lim=m;\n else lim=n;\n\n for(i=49;i>=lim;i--)\n {\n for(j=0;j<=2;j++)\n {\n if((A[i]+l[j])%3==C[i])\n {\n B[i]=l[j];\n break;\n }\n }\n }\n // for(i=lim;i<=49;i++)\n // printf(\"%d %d %d\\n\",A[i],C[i],B[i]);\n for(i=lim;i<=49;i++)\n b=b+B[i]*pow(3,49-i);\n printf(\"%d\",b);\n\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\nint* mtob(int a)\n{\n int *result;\n result = (int*)malloc(10000*sizeof(int));\n int i,count;\n i = a;\n count = 0;\n while (1)\n {\n count++;\n result[count] = i % 3;\n i = i/3;\n if (i==0) break;\n }\n result[0] = count;\n return result;\n}\nint btom(int *a,int n)\n{\n int i,sum,k;\n sum = 0;\n k = 1;\n for (i=n;i>=1;i--)\n {\n sum+=k*a[i];\n k = 3*k;\n }\n return sum;\n}\nint main()\n{\n int a,b,c;\n int *aa,*cc;\n int bb[10000],dd[10000];\n int i,max;\n\n scanf(\"%d%d\",&a,&c);\n aa = mtob(a);\n\n cc = mtob(c);\n if (aa[0]>cc[0]) max = aa[0] ;\n else max = cc[0];\n for (i=1;i<=max;i++){\n if (aa[i]<=cc[i]) bb[i] = cc[i]-aa[i];\n if (aa[i]>cc[i]) bb[i] = cc[i]+3-aa[i];\n }\n\n for (i=1;i<=max;i++)\n dd[i]=bb[max-i+1];\n b = btom(dd,max);\n printf(\"%d\",b);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(void)\n{\n\tlong long a,c,b=0,t1,t2,n,i;\n\tscanf(\"%I64d %I64d\",&a,&c);\n\n\tn=0;\n\twhile(a!=0 || c!=0)\n\t{\n\t\tt1=a%3;t2=c%3;\n\t\tfor(i=0;i<3;++i)\n\t\t\tif((i+t1)%3==t2){ b+=i*((long long)pow((double)3,(double)n)); break; }\n\t\tn++;a/=3;c/=3;\n\t}\n\tprintf(\"%I64d\",b);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nmain()\n{\nlong int rust(int x);\nlong int lust(int x);\nint arrb[20]={0};\nlong int a,c,ans=0;\nscanf(\"%ld %ld\",&a,&c);\nint at,ct;\nint k=0,i;\nwhile(a!=0 || c!=0)\n{\nat=a%3;\nct=c%3;\na=a/3;\nc=c/3;\nswitch(ct)\n{\ncase(2):{arrb[k++]=(2-at);\n break;}\n\ncase(0):{if(at==0) arrb[k++]=0;\n else arrb[k++]=(3-at);\n break;}\ncase(1):{if(at==2) arrb[k++]=2;\n else arrb[k++]=(1-at);\n break;}\n}\n}\nk=k-1;\nfor(i=k;i>=0;i--)\n{\nans=ans+lust(i)*arrb[i];\n}\nprintf(\"%ld\",ans);\nreturn 0;\n}\n\nlong int rust(int x)\n {\n int i;\n long int k=1;\n for(i=1;i<=x;i++)\n k=k*10;\n return k;\n }\n\nlong int lust(int x)\n {\n int i;\n long int k=1;\n for(i=1;i<=x;i++)\n k=k*3;\n return k;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nmain()\n{\nlong int a,c,b=0;\nscanf(\"%ld %ld\",&a,&c);\nint at,ct,i=0;\nwhile(a!=0 || c!=0)\n{\nat=a%3;\nct=c%3;\na=a/3;\nc=c/3;\nct+=3;\nb = b + ((ct-at)%3)*(long int)pow(3,i);\ni++;\n}\nprintf(\"%ld\",b);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\nint s1[400],s2[400];\nint pw(int x,int y){\n if(y<1) return 1;\n else return x*pw(x,y-1);\n}\nint main(){\n ll int a,b,i,j,l1=0,l2=0;\n memset(s1,0,sizeof(s1));\n memset(s2,0,sizeof(s2));\n scanf(\"%lld%lld\",&a,&b);\n while(a>0){\n s1[l1++]=a%3;\n a/=3;\n }\n while(b>0){\n s2[l2++]=b%3;\n b/=3;\n }\n int ans=0;\n for(i=0;i<l1||i<l2;i++){\n for(j=0;j<3;j++){\n if((s1[i]+j)%3==s2[i]){\n break;\n }\n }\n ans+=j*pw(3,i);\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a, b, c, p3;\n scanf(\"%d %d\", &a, &c);\n for (b = 0, p3 = 1; a > 0 || c > 0; a /= 3, c /= 3, p3 *= 3)\n b += p3 * ((c % 3 - a % 3 + 3) % 3);\n printf(\"%d\", b);\n return 0;\n}"}, {"source_code": " #include <stdio.h>\n\nvoid conv(int x, int * m){\n int i=0;\n do {\n m[i]=x%3;\n x/=3;\n i++;\n } while (x);\n for (;i<32;i++) m[i]=0;\n}\n\nint main()\n{ int c1[32],c2[32],i,a,b,r=0,s=3;\n scanf(\"%d%d\",&a,&b);\n conv(a,c1);\n conv(b,c2);\n for (i=0;i<32;i++){\n c1[i]=c2[i]-c1[i];\n if (c1[i]<0) c1[i]+=3;\n if (i==0)\n r=c1[i];\n else {\n r+=c1[i]*s;\n s*=3;\n }\n }\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain()\n{\n\tlong long a,b=0,c;\n\tint i;\n\t\n\tscanf(\"%I64d %I64d\",&a,&c);\n\t\n\tfor(i=1;i<1000000000;i*=3){\n\t\tb+=(((c/i)%3-(a/i)%3)+3)%3*i;\n\t}\n\t\n\tprintf(\"%I64d\",b);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main()\n{\n int a,c;\n scanf(\"%d %d\",&a,&c);\n\n int a1,c1,i,n,k;\n for(i=0,n=0,k=1;a||c;i++,k*=3)\n {\n a1=a%3;\n c1=c%3;\n a/=3;\n c/=3;\n if(!a1)\n {\n n+=k*c1;\n continue;\n }\n if(!c1)\n {\n n+=k*(3-a1);\n continue;\n }\n if(a1>c1)\n {\n n+=k*(3-c1);\n }\n else\n {\n n+=k*(c1-a1);\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX 1000\nint diff(int a, int b,char *c)//a-b\n{\n char f[MAX]={},s[MAX]={};\n int i,j,k,digits;\n int ii;\n for(i=MAX-2;a;i--){\n f[i]=a%3+'0'+3;\n a/=3;\n }\n for(j=MAX-2;b;j--){\n s[j]=b%3+'0';\n // printf(\"%c\",s[j]);\n b/=3;\n }\n // printf(\"\\n\");\n digits=MAX-((i<j)?i:j)-2;\n // printf(\"%d\\n\",digits);\n for(k=0;k<i-j;k++)\n f[k]='3';\n ii=i;\n for(ii++;ii<MAX-1;k++,ii++)\n f[k]=f[ii];\n f[k]='\\0';\n\n // printf(\"j is %d and i is %d\\n\",j,i);\n for(k=0;k<j-i;k++)\n s[k]='0';\n for(j++;j<MAX-1;k++,j++)\n s[k]=s[j];\n s[k]='\\0';\n for(i=0;i<digits;i++)\n c[i]=(f[i]-s[i])%3;\n return digits;\n //for(ii\n}\nint todec(char *a, int dig)\n{\n int i=0,ans=0;\n for(i=0;i<dig;i++)\n ans=ans*3+a[i];\n return ans;\n}\nint main()\n{\n int cases,cnt;\n int i,n;\n int a,c;\n char ans[MAX];\n scanf(\"%d%d\",&a,&c);\n printf(\"%d\\n\",todec(ans,diff(c,a,ans)));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b = 0, c, i;\n int p[3][20] = {0};\n\n scanf(\"%d %d\", &a, &c);\n\n i = 0;\n\n while (a) {\n\t p[0][i++] = a % 3;\n\t a /= 3;\n }\n\n i = 0;\n\n while (c) {\n\t p[1][i++] = c % 3;\n\t c /= 3;\n }\n\n for (i = 0; i < 20; i++) {\n\t p[2][i] = (p[1][i] - p[0][i] + 3) % 3;\n }\n\n for (i = 19; i >= 0; i--) {\n\t b *= 3;\n\t b += p[2][i];\n }\n\n printf(\"%d\\n\", b);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c=0,f,e,d,g=1;\n\tscanf(\"%d%d\",&a,&b);\n\twhile(!(a==0&&b==0))\n\t{\n\t\t\n\t\td=a%3;\n\t\te=b%3;\n\t\tf=e-d;\n\t\tif(f<0)\n\t\t\tf=f+3;\n\t\tc=c+g*f;\n\t\ta=a/3;\n\t\tb=b/3;\n\t\tg=g*3;\n\t}\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define max_digits_count 19\n#define base 3\n\nchar toChar(int x)\n{\n return x + '0'; \n}\n\nvoid swap(char* x, char* y) \n{\n char tmp = *x;\n *x = *y ; \n *y = tmp;\n}\n\nchar* reverseStr(char* s)\n{\n int iLength = strlen(s);\n char* ret = (char*)malloc(iLength);\n unsigned int i = 0; \n for(; s[i] ; ++i) \n ret[i] = s[i]; \n \n \n \n int lo = 0 , hi = iLength - 1; \n while(hi > lo)\n {\n swap(&ret[lo], &ret[hi]);\n \n// printf(\"lo = %d, hi = %d, after swap , ret = %s\\n\", lo, hi , ret);\n lo++;\n hi--;\n }\n \n ret[iLength] = 0;\n return ret;\n}\n\n\nchar* toTenary(int x)\n{\n char* ret = (char*)malloc(max_digits_count);\n int iCounter = 0;\n while(x) \n {\n ret[iCounter++] = toChar(x%base);\n x /= base;\n }\n ret[iCounter] = 0;\n \n while(strlen(ret) < max_digits_count) \n {\n ret[iCounter++] = '0';\n ret[iCounter] = 0;\n }\n ret[max_digits_count] = 0;\n \n //printf(\"before reverse, ret = %s\\n\", ret);\n \n ret = reverseStr(ret);\n return ret;\n}\n\nchar min_path(char a, char c)\n{\n int ia = a - '0', ic = c - '0' , ib = 0, tmp = 0;; \n for(tmp = 0; tmp <= 2; ++tmp)\n {\n if((ia+tmp)%base == ic) {\n ib = tmp;\n break;\n }\n }\n return toChar(ib);\n}\n\nchar* solve(char* sa, char* sc) \n{\n char* ret = (char*)malloc(max_digits_count);\n ret[max_digits_count] = 0;\n \n int hi = max_digits_count-1;\n while(hi >= 0)\n {\n ret[hi] = min_path(sa[hi], sc[hi]);\n hi--;\n }\n \n return ret;\n}\n\n\nint tenaryToDecimal(char* s)\n{\n int i = 0, base_pow = 1 , ret = 0;\n int iLength = strlen(s);\n for(i = iLength-1; i >= 0; --i)\n {\n ret += (s[i]-'0')*base_pow ;\n base_pow *= base;\n }\n \n return ret;\n}\n\nint main() \n{\n\n#ifndef ONLINE_JUDGE\n freopen(\"inputC.txt\" ,\"r\", stdin);\n freopen(\"outputC.txt\" ,\"w\", stdout); \n#endif\n \n int a, b, c ; \n scanf(\"%d %d\",&a,&c);\n \n /*\n char* s = reverseStr(\"abc\");\n printf(\"%s\\n\",s);\n */\n \n char* sa = toTenary(a) ; \n char* sc = toTenary(c) ;\n \n //printf(\"sa = %s\\n\",sa);\n //printf(\"sc = %s\\n\",sc);\n \n char* sb = solve(sa,sc);\n //printf(\"%s\\n\",sb);\n printf(\"%d\\n\", tenaryToDecimal(sb));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,b;\n\tint A[100],B[100],C[100];\n\tscanf(\"%lld %lld\",&a,&b);\n\tint ka=0;\n\twhile(a>0)\n\t{\n\t\tA[ka++]=a%3;\n\t\ta=a/3;\n\t}\n\tint kb=0;\n\twhile(b>0)\n\t{\n\t\tB[kb++]=b%3;\n\t\tb=b/3;\n\t}\n\twhile(ka<kb)\n\t\tA[ka++]=0;\n\twhile(kb<ka)\n\t\tB[kb++]=0;\n\tint i;\n\tfor(i=0;i<ka;i++)\n\t{\n\t\tC[i]=B[i]-A[i];\n\t\tif(C[i]<0)\n\t\t\tC[i]+=3;\n\t}\n\tint kc=i;\n\tlong long int c=0;\n\tlong long int prod=1;\n\tfor(i=0;i<kc;i++)\n\t{\n\t\tc = c + prod*C[i];\n\t\tprod*=3;\n\t}\n\tprintf(\"%lld\\n\",c);\n\treturn 0;\n}\n\t\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#include<ctype.h>\nint main(void)\n{\n\tint a,b=0,c;\n\tint i=0;\n\tscanf(\"%d%d\",&a,&c);\n\twhile(a || c)\n\t{\n\t\tb += ((((c%3)-(a%3))%3)+3)%3 *pow(3,i);\n\t\ta /= 3;\n\t\tc /= 3;\n\t\ti++;\n\t}\n\tprintf(\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint i, j, k, l, x, y, z, m, n, ans, temp;\nint ara_1[100], ara_2[100],ara_3[100];\nint power(int i, int j)\n{\n\n int k, l = 1;\n for(k = 0; k < j; k++){\n l = l * i;\n }\n\n return l;\n\n}\nint main()\n{\n scanf(\"%d %d\", &m, &n);\n for(i = 0; ; i++){\n if(power(3, i) > m){\n x = i;\n break;\n }\n }\n for(i = 0; ; i++){\n if(power(3, i) > n){\n y = i;\n break;\n }\n }\n\n // printf(\"%d %d\\n\", x, y);\n\n if(x > y){\n for(k = 0; k < (x - y); k++){\n ara_2[k] = 0;\n }\n }\n else if(x < y){\n for(l = 0; l < (y - x); l++){\n ara_1[l] = 0;\n }\n }\n\n\n\n for(i = (x + l) - 1; ; i--){\n ara_1[i] = m % 3;\n m = m / 3;\n if(m == 0) break;\n }\n for(i = (y + k) - 1 ; ; i--){\n ara_2[i] = n % 3;\n n = n / 3;\n if(n == 0) break;\n }\n\n for(i = 0; i < (x + l); i++){\n temp = (ara_2[i] - ara_1[i]);\n if(temp < 0) temp += 3;\n temp = temp % 3;\n ara_3[i] = temp;\n }\n\n for(i = 0; i < (x + l); i++){\n if(ara_3[i] != 0) break;\n }\n\n /* for(j = 0; j < (x + l); j++){\n printf(\"%d \", ara_3[j]);\n }\n\n printf(\"\\n\");*/\n\n for(j = i, z = (x + l) - i - 1; j < (x + l); j++,z--){\n ans = ans + (ara_3[j] * power(3, z));\n }\n\n printf(\"%d\\n\", ans);\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a, b , ta[101] , tb[101] , tc[101] , sa,sb,sc, c, i,j,k , n ;\n\nint main()\n{\n scanf(\"%d %d\", &a, &b) ;\n\n while( a > 0 )\n {\n ta[sa] = a%3 ;\n a =a/3 ;\n sa++ ;\n }\n\n while( b > 0 )\n {\n tb[sb] = b%3 ;\n b =b/3 ;\n sb++ ;\n }\n/*\n printf(\"test for a : \") ;\n for ( i = 0 ; i < sa ;i++)\n {\n printf(\"%d \", ta[i] ) ;\n }\n\n printf(\"\\ntest for a : \") ;\n for ( i = 0 ; i < sb ;i++)\n {\n printf(\"%d \", tb[i] ) ;\n }\n\n printf(\"\\n\") ;\n*/\n\n if ( sa > sb ) sc = sa ;\n else sc =sb ;\n\n for( i = 0 ; i < sc ; i++)\n {\n tc[i] = tb[i] - ta[i] ;\n\n if ( tc[i] < 0 ) tc[i] += 3 ;\n }\n\n /* printf(\"test for a : \") ;\n for ( i = 0 ; i < sc ;i++)\n {\n printf(\"%d \", tc[i] ) ;\n }\n printf(\"\\n\" ) ; */\n\n for ( i = sc-1 ; i > -1 ; i--)\n {\n c = 3 * c + tc[i] ;\n }\n\n\n\n printf(\"%d\" , c) ;\n return 0;\n }\n\n"}, {"source_code": "#include <stdio.h>\n\nint a[50];\nint b[50];\nint c[50];\nint r[3][3] = {{0, 1, 2}, {2, 0, 1}, {1, 2, 0}};\n\nint transfer(int t_, int t[]) {\n int len = 0;\n while (t_) {\n t[len ++] = t_ % 3;\n t_ /= 3;\n }\n return len;\n}\n\nvoid func(int a_, int c_) {\n int l1, l2, l3, i, len, b_ = 0;\n l1 = transfer(a_, a);\n l3 = transfer(c_, c);\n if (l1 < l3) {\n for (i = l1; i < l3; i ++) {\n a[i] = 0;\n }\n len = l3;\n }\n else if (l1 > l3) {\n for (i = l3; i < l1; i ++) {\n c[i] = 0;\n }\n len = l1;\n }\n else {\n len = l1;\n }\n for (i = 0; i < len; i ++) {\n b[i] = r[a[i]][c[i]];\n }\n for (i = len - 1; i >= 0; i --) {\n b_ = b_ * 3 + b[i];\n }\n printf(\"%d\\n\", b_);\n}\n\nint main() {\n int a_, c_;\n while (scanf(\"%d%d\", &a_, &c_) == 2) {\n func(a_, c_);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int a,b,n,m,i,j=0,k=0;\n scanf(\"%d %d\",&a,&b);\n while(a>0||b>0)\n {\n n=a%3;\n a/=3;\n m=b%3;\n b/=3;\n if(m<n)\n {\n m+=3;\n }\n i=m-n;\n j+=(i*pow(3,k));\n k++;\n }\n printf(\"%d\",j);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint sub(int a, int c) {\n\treturn a < 3 && c < 3 ? (c - a + 3) % 3 : sub(a / 3, c / 3) * 3 + ((c - a) % 3+ 3) % 3;\n}\n\nint main() {\n\tint a, c;\n\n\tscanf(\"%d%d\", &a, &c);\n\tprintf(\"%d\\n\", sub(a, c));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int dk(long long int m,long long int n[]);\nlong long int main()\n{\nlong long int a,b,c,d=0,i,e=0,k=0,g=0;\nlong long int p[10000]={0},q[10000],f[10000];\nscanf(\"%I64d%I64d\",&a,&c);\nd=dk(a,p);\ne=dk(c,q);\nif(d==e)\n{\nnext:\nfor(i=0;i<d;i++)\n{\nk=0;\nwhile(((p[i]+k)%3)!=q[i])\n{\nk++;\n}\nf[i]=k;\n}\n}\nelse\n{\nif(d>e)\n{\nwhile(d!=e)\n{\nq[e]=0;\ne++;\n}\ngoto next;}\nelse\n{\nwhile(d!=e)\n{\np[d]=0;\nd++;\n}\ngoto next;}\n}\nfor(i=0;i<d;i++)\n{\ng=g+f[i]*pow(3,i);\n}\nprintf(\"%I64d\",g);\nreturn(0);\n}\nlong long int dk(long long int m,long long int n[])\n{\n int x=0;\nwhile(m>0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h> \nint max(int x, int y)\n{\n\treturn x > y ? x : y;\n}\nint main()\n{\n\tint a, b, i, j, t, sum;\n\tint n1[1001], n2[1001];\n\twhile (scanf(\"%d %d\", &a, &b) != EOF)\n\t{\n\t\tmemset(n1, 0, sizeof(n1));\n\t\tmemset(n2, 0, sizeof(n2));\n\t\ti = 0;\n\t\twhile (a)\n\t\t{\n\t\t\tn1[i] = a % 3;\n\t\t\ta /= 3;\n\t\t\ti++;\n\t\t}\n\t\tj = 0;\n\t\twhile (b)\n\t\t{\n\t\t\tn2[j] = b % 3;\n\t\t\tb /= 3;\t\n\t\t\tj++;\n\t\t}\n\t\tt = max(i, j);\n\t\tfor (i=0; i<t; i++)\n\t\t{\n\t\t\tn1[i] = (n2[i] - n1[i] + 3) % 3;\n\t\t}\n\t\tsum = 0;\n\t\tfor (i=t-1; i>=0; i--)\n\t\t{\n\t\t\tsum *= 3;\n\t\t\tsum += n1[i];\n\t\t}\n\t\tprintf(\"%d\\n\", sum);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#define max 100\nint main()\n{\n int a,b,i,j,t,t1,t2;\n int c[max],d[max],e[max];\n memset(c,0,sizeof(c));\n memset(d,0,sizeof(d));\n memset(e,0,sizeof(e));\n\n scanf(\"%d %d\",&a,&b);\n i=0;\n while(a!=0)\n {\n c[i]=a%3;\n a=a/3;\n i++;\n }\n j=0;\n while(b!=0)\n {\n d[j]=b%3;\n b=b/3;\n j++;\n }\n\n if(i>j)\n t2=i;\n else\n t2=j;\n\n for(i=t2-1; i>=0; i--)\n {\n if(d[i]<c[i])\n d[i]=d[i]+3;\n e[i]=d[i]-c[i];\n }\n double sum=0.0;\n for(i=0; i<t2; i++)\n sum=sum+e[i]*pow(3.0,(double)i);\n printf(\"%d\\n\",(int )sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a,b,c,t=1;\nmain(){\n for(scanf(\"%d%d\",&a,&c);a|c;\n a/=3,c/=3,t*=3)b+=(c%3-a%3+3)%3*t;\n printf(\"%d\",b);\n exit(0);\n \n}"}, {"source_code": "#include <stdio.h>\n\nint tor(int a, int c)\n{\n if(!a && !c)\n return 0;\n \n return tor(a / 3, c / 3) * 3 + c % 3 - a % 3 + 3 * (a % 3 > c % 3);\n}\n\nint main(int argc, char *argv[])\n{\n int a, c;\n\n scanf(\"%d %d\", &a, &c);\n printf(\"%d\\n\", tor(a, c));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#define MAX_LEN 30\nvoid encode(int* cs3,unsigned int a){\n int n=0;\n int i;\n for(i=0;i<MAX_LEN;i++)cs3[i]=0;\n n=0;\n while(a>0){\n cs3[n++]=a%3;\n a/=3;\n }\n}\nunsigned int decode(int* cs3){\n unsigned int rt=0;\n int n;\n n=MAX_LEN-1;\n while(cs3[n]==0) n--;\n for(;n>=0;n--){\n rt=rt*3+cs3[n];\n }\n return rt;\n}\nvoid print(int* cs3){\n int i;\n for(i=0;i<MAX_LEN;i++)printf(\"%d\",cs3[i]);\n printf(\"\\n\");\n}\nint min(int a,int b){\n if(a>b||a<0) return b;\n else return a;\n}\nint main(){\n unsigned int a,b;\n int i;\n int cs3a[MAX_LEN];\n int cs3b[MAX_LEN];\n int cs3c[MAX_LEN];\n scanf(\"%d %d\",&a,&b);\n encode(cs3a,a);\n encode(cs3b,b);\n //print(cs3a);\n //print(cs3b);\n for(i=0;i<MAX_LEN;i++){\n cs3c[i]=min(cs3b[i]-cs3a[i],cs3b[i]-cs3a[i]+3);\n }\n //print(cs3c);\n printf(\"%d\",decode(cs3c));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define max(a,b) (a)>(b)?(a):(b)\n#define min(a,b) (a)>(b)?(b):(a)\n\nint main(void)\n{\n long a,b;\n scanf(\"%d%d\",&a,&b);\n int a_3[40];\n int b_3[40];\n int c[40];\n memset(a_3,0,40*sizeof(int));\n memset(b_3,0,40*sizeof(int));\n int i;\n int a_ = a;\n int b_ = b;\n int state;\n for(i=39; i>0; i--)\n {\n a_3[i] = a_%3;\n a_ /= 3;\n b_3[i] = b_%3;\n b_ /= 3;\n if(a_ == 0 && b_ == 0)\n {\n state = i;\n break;\n }\n }\n for(i=39; i>0; i--)\n {\n if(a_3[i] == b_3[i])\n c[i] = 0;\n else {\n c[i] = b_3[i] - a_3[i];\n }\n if(c[i] < 0)\n c[i] += 3;\n }\n int sum = 0;\n for(i=39; i>=state; i--)\n {\n sum += c[i] * pow(3,39-i);\n }\n printf(\"%d\\n\",sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define maxn 1000\nlong basea[maxn],baseb[maxn],basec[maxn];\nlong a,b,c;\nlong d1,d2,d3;\nint main()\n{\n long i,tmp=0;\n scanf(\"%ld %ld\",&a,&c);\n while (a>0) \n {\n basea[d1++]=a%3;\n a/=3;\n }\n while (c>0)\n {\n basec[d3++]=c%3;\n c/=3;\n }\n if (d1>d3) d2=d1;\n else d2=d3;\n for (i=0;i<d2;i++)\n {\n tmp=basec[i]-basea[i];\n baseb[i]=(tmp+3)%3;\n //tmp/=3;\n }\n tmp=1;\n for (i=0;i<d2;i++)\n {\n b+=baseb[i]*tmp;\n tmp*=3;\n }\n printf(\"%ld\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar Str1[31],Str2[31];\n\n\nint main()\n{\n int A,C,L1,L2,L,i,p=1,ans;\n scanf(\"%d %d\",&A,&C);\n itoa(A,Str1,3);\n itoa(C,Str2,3);\n L1=strlen(Str1);\n L2=strlen(Str2);\n L=L1>L2?L1:L2;\n strrev(Str1);\n strrev(Str2);\n if(L1>L2)\n {\n for(i=L2; i<L; ++i)\n {\n Str2[i]='0';\n }\n }\n else\n {\n for(i=L1; i<L; ++i)\n {\n Str1[i]='0';\n }\n }\n for(p=1,ans=i=0; i<L; ++i)\n {\n ans+=((Str2[i]+3-Str1[i])%3)*p;\n p*=3;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,j=0,k=0,n,sum=0,a[1000],b[1000],c[1000],p,q,l;\n scanf(\"%d%d\",&p,&q);\n while(p!=0)\n {\n a[i]=p%3;\n i++;\n p=p/3;\n }\n while(q!=0)\n {\n b[j]=q%3;\n j++;\n q=q/3;\n }\n if(i>j)\n {\n for(k=j;k<i;k++)\n b[k]=0;\n }\n else if(j>i)\n {\n for(k=i;k<j;k++)\n a[k]=0;\n }\n else k=i;\n \n for(i=0;i<k;i++)\n {\n if(a[i]==b[i])\n c[i]=0;\n else if(b[i]==0)\n c[i]=3-a[i];\n else if(b[i]==1)\n {\n if(a[i]==0)\n c[i]=1;\n else\n c[i]=2;\n }\n else if(b[i]==2)\n {\n if(a[i]==0)\n c[i]=2;\n else\n c[i]=1;\n }\n }\n \n for(i=0;i<k;i++)\n {\n l=c[i];\n n=i;\n while(n>0)\n {\n l=l*3;\n n--;\n }\n sum=sum+l;\n }\n printf(\"%d\",sum);\n\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n\n#define RADIX 3\n\nint getTernary(int a, int radix, int ta[])\n{\n\tint j = 0;\n\twhile(a > 0)\n\t{\n\t\tta[j] = a % radix;\n\t\ta = a / radix;\n\t\t++j;\n\t}\n\treturn --j;\n}\n\nint main()\n{\n\tint a,b,c;\n\tint ina, inc, index;\n\tint i;\n\tint ta[20];\n\tint tb[20];\n\tint tc[20];\n\n\tscanf(\"%d%d\", &a, &c);\n\tmemset(ta, 0, 20*sizeof(int));\n\tmemset(tb, 0, 20*sizeof(int));\n\tmemset(tc, 0, 20*sizeof(int));\n\tina = getTernary(a, RADIX, ta);\n\tinc = getTernary(c, RADIX, tc);\n\tif(ina >= inc)\n\t{\n\t\tindex = ina;\n\t}\n\telse\n\t{\n\t\tindex = inc;\n\t}\n\t\n\tfor(i = 0; i <= index; ++i)\n\t{\n\t\tif(tc[i] >= ta[i])\n\t\t\ttb[i] = tc[i] - ta[i];\n\t\telse\n\t\t\ttb[i] = tc[i] + RADIX - ta[i];\n\t}\n\tb = 0;\n\tfor(i = 0; i <= index; ++i)\n\t{\n\t\tb = b + tb[i] * pow((double)RADIX, i);\n\t}\n\tprintf(\"%d\\n\", b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint ter(long int,char*);\nint main()\n{\n long int a,c,i,k,sum=0;\n scanf(\"%ld%ld\",&a,&c);\n char s1[50],s2[50],s3[50];\n int m=ter(a,s1);\n //printf(\"%s%d\",s1,m);\n int n=ter(c,s2);\n //printf(\"%s\\n%d\",s2,n);\n\n if((m-n)>0)\n {\n //for(i=n-1;i>=0;i--)\n //{ s2[m-n+i]=s2[i];}\n for(i=n;i<m;i++)\n {s2[i]='0';}\n s2[m]='\\0';k=m;\n //puts(s2);\n }\n else if((m-n)<0)\n {\n for(i=m;i<n;i++)\n {s1[i]='0';}\n s1[n]='\\0';k=n; }\n else i=k=m;\n i=i-1;\n //printf(\"%ld\",i);\n while(i>=0)\n {\n if(s1[i]=='0'&&s2[i]=='0')\n {s3[i]='0';i--;}\n if(s1[i]=='0'&&s2[i]=='1')\n {s3[i]='1';i--;}\n if(s1[i]=='0'&&s2[i]=='2')\n {s3[i]='2';i--;}\n if(s1[i]=='1'&&s2[i]=='0')\n {s3[i]='2';i--;}\n if(s1[i]=='1'&&s2[i]=='1')\n {s3[i]='0';i--;}\n if(s1[i]=='1'&&s2[i]=='2')\n {s3[i]='1';i--;}\n if(s1[i]=='2'&&s2[i]=='0')\n {s3[i]='1';i--;}\n if(s1[i]=='2'&&s2[i]=='1')\n {s3[i]='2';i--;}\n if(s1[i]=='2'&&s2[i]=='2')\n {s3[i]='0';i--;}\n }\n s3[k]='\\0';\n //puts(s3);\n //k=strlen(s3);\n //printf(\"%ld\\n\",k);\n for(i=0;i<k;i++)\n { //long int j=pow(3,i);\n //long int l=s3[i]-'0';\n //printf(\"%ld\\n\",l);\n sum=sum+((s3[i]-'0')*pow(3,i));\n }\n\n printf(\"%ld\",sum);\n return 0;\n\n}\n\n int ter(long int a,char s[])\n\n { long int j,i=0;\n while(a!=0)\n {\n j=a%3;\n s[i]=j+'0';\n a=a/3; i++;\n }\n s[i]='\\0';\n return(i);\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int a, b = 0, c, d, e, i = 0, j, tab[25];\n scanf(\"%d %d\", &a, &c);\n while (a | c)\n {\n d = a % 3;\n a /= 3;\n e = c % 3;\n c /= 3;\n tab[i++] = (3+e-d)%3;\n }\n for (j=i-1; j>=0; j--)\n {\n b *= 3;\n b += tab[j];\n }\n printf(\"%d\\n\", b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint a, b, c, ans = 0;\n\tscanf(\"%i%i\", &a, &b);\n\tfor (c = 1; (a != 0) || (b != 0); a /= 3, b /= 3, c *= 3) {\n\t\tans += ((3 - (a%3) + (b%3)) % 3) * c;\n\t}\n\tprintf(\"%i\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int convert(long long int d[],long long int a)\n{\nlong long int x=0;\nwhile(a>0)\n{\nd[x++]=a%3;\na=(a-(a%3))/3;\n}\nreturn(x);\n}\nadd(long long int d[],long long int i,long long int j)\n{\n long long int x;\nfor(x=i;x<j;x++)\nd[x]=0;\nreturn(j);\n}\n\nmain()\n{\n long long int a,c,t=1,x,i,j;\n scanf(\"%I64d%I64d\",&a,&c);\n long long int d[100],e[100],f[100],g[3][3]={{0,1,2},{2,0,1},{1,2,0}};\n i=convert(d,a);\n j=convert(e,c);\n if(i>j)\n j=add(e,j,i);\n else if(j>i)\n i=add(d,i,j);\n for(x=0;x<j;x++)\n f[x]=g[d[x]][e[x]];\n a=0;\n for(x=0;x<j;x++,t=t*3)\n a=a+f[x]*t;\n printf(\"%I64d\",a);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long a,c,ans=0,pow=1;\n scanf(\"%ld%ld\",&a,&c);\n short int i,j;\n while(a||c)\n {\n ans+=pow*((3+c%3-a%3)%3);\n pow*=3;\n a/=3;\n c/=3;\n }\n printf(\"%ld\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int a,c;\n int b;\n int temp1,temp2;\n int mnoznik;\n\n scanf(\"%d %d\",&a,&c);\n b = 0;\n mnoznik = 1;\n while((a != 0) || (c != 0))\n {\n temp1 = a % 3;\n temp2 = c % 3;\n a = a / 3;\n c = c / 3;\n if(temp2 >= temp1)\n b += mnoznik * (temp2-temp1);\n else\n b += mnoznik * (3-(temp1-temp2));\n mnoznik *= 3;\n }\n\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,co=0,A[100],C[100];\n int c,t,i,fa=0,fc=0,p=1,r=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&c);\n while(fa==0||fc==0){\n if(a==1&&fa==0){\n A[co]=1;\n fa=1;\n }\n else if(a==2&&fa==0){\n A[co]=2;\n fa=1;\n }\n else if(a==0&&fa==0){\n A[co]=0;\n fa=1;\n }\n else if(fa!=1)\n A[co]=a%3;\n else\n A[co]=0;\n\n if(c==1&&fc==0){\n C[co]=1;\n fc=1;\n }\n else if(c==0&&fc==0){\n C[co]=0;\n fc=1;\n }\n else if(c==2&&fc==0){\n C[co]=2;\n fc=1;\n }\n else if(fc!=1)\n C[co]=c%3;\n else\n C[co]=0;\n\n a/=3;\n c/=3;\n co++;\n }\n for(i=0;i<co;i++,p*=3)\n r+=p*((C[i]+3-A[i])%3);\n\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": " unsigned a,b,c,x=1;\nint main()\n{\n for( scanf(\"%d%d\",&a,&c) ; a|c ; x*=3 , a/=3 , c/=3 )\n b+=(3+c%3-a%3)%3*x;\n printf(\"%d\",b);\n exit(0);\n}"}, {"source_code": "unsigned a,b,c,x=1;\nint main()\n{\n for( scanf(\"%d%d\",&a,&c) ; a|c ; x*=3 , a/=3 , c/=3 )\n b+=(3+c%3-a%3)%3*x;\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef long long Long;\n\nint main() {\n int a,c,i;\n scanf(\"%d%d\",&a,&c);\n int arr[100] = {0}; int cnt = 0;\n while (a > 0 || c > 0) {\n int ta = a % 3;\n int tc = c % 3;\n a /= 3;\n c /= 3;\n arr[cnt ++] = (tc - ta + 9) % 3;\n }\n Long ans = 0;\n for (i = cnt - 1; i > -1; i--) {\n ans = ans * 3 + arr[i];\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a, b, c, t;\n\tfor (scanf(\"%d%d\", &a, &c), t = 1, b = 0; a > 0 || c > 0; a /= 3, c /= 3, t *= 3)\n\t\tb += (3 + c%3 - a%3) % 3 * t;\n\tprintf(\"%d\\n\", b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\nint main(){\n int a, b, c, pw, add;\n\n scanf(\"%d%d\",&a,&c);\n b = 0; pw = 1;\n\n while(a || c){\n add = ((c%3) - (a%3) + 3)%3;\n b += add * pw;\n pw *= 3;\n a /= 3; c /= 3;\n }\n\n printf(\"%d\\n\",b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main()\n{\n long a,c,ans=0,i=0;\n scanf(\"%ld%ld\",&a,&c);\n while(a!=0 || c!=0)\n {\n ans+=(c%3-a%3+3)%3*pow(3,i);\n a/=3;\n c/=3;\n i++;\n }\n printf(\"%ld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\n#define fp(i,a,b,c) for(i=a;i<b;i+=c)\n#define fn(i,a,b,c) for(i=a;i>b;i-=c)\n#define fs(i,a) for(i=0;i<a;i++)\n#define sci(a) scanf(\"%d\",&a)\n#define sci2(a,b) scanf(\"%d%d\",&a,&b)\n#define pf(a) printf(\"%d \",a)\n#define pf2(a,b) printf(\"%d %d\",a,b)\n\nint cnvrttrnr(int a,int s[])\n{\n int i;\n int a1[100000];\n int k=0;\n a1[0]=0;\nwhile(a!=0){\n a1[k]=a%3;\n a=a/3;\n k++;\n\n}\nfs(i,k)\n{\n s[i]=a1[i];\n}\nreturn k;\n\n}\nint powr3(int l)\n{\n int i;\n int ans=1;\n fs(i,l)\n ans*=3;\n\n return ans;\n}\nint main()\n{\n int i,j,k,l,a,b,c;\n sci2(a,c);\n int s1[100000],s2[10000],s3[10000];\n int l1=cnvrttrnr(a,s1);\n int l2=cnvrttrnr(c,s2);\n\n /*fs(i,l1)\n pf(s1[i]);\n fs(i,l2)\n pf(s2[i]);*/\n if(l1>l2)\n {\n fp(i,l2,l1,1)\n s2[i]=0;\n }else\n {\n fp(i,l1,l2,1)\n s1[i]=0;\n }\n\n if(l1>l2)\n {fs(i,l1)\n {\n fs(j,3)\n {if(((s1[i]+j)%3==s2[i]))\n {\n s3[i]=j;\n }\n }\n }}\n else\n {\n fs(i,l2)\n {\n fs(j,3)\n {if(((s1[i]+j)%3==s2[i]))\n {\n s3[i]=j;\n break;\n }\n }\n }\n }\n\n int ans=0;\n if(l1>l2)\n fs(i,l1)\n {\n int p=powr3(i);\n ans+=s3[i]*p;\n }\n else\n fs(i,l2)\n {\n int p=powr3(i);\n ans+=s3[i]*p;\n }\n\npf(ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\n#define fp(i,a,b,c) for(i=a;i<b;i+=c)\n#define fn(i,a,b,c) for(i=a;i>b;i-=c)\n#define fs(i,a) for(i=0;i<a;i++)\n#define sci(a) scanf(\"%d\",&a)\n#define sci2(a,b) scanf(\"%d%d\",&a,&b)\n#define pf(a) printf(\"%d \",a)\n#define pf2(a,b) printf(\"%d %d\",a,b)\n\nint cnvrttrnr(int a,int s[])\n{\n int i;\n int a1[100000];\n int k=0;\n a1[0]=0;\nwhile(a!=0){\n a1[k]=a%3;\n a=a/3;\n k++;\n\n}\nfs(i,k)\n{\n s[i]=a1[i];\n}\nreturn k;\n\n}\nint powr3(int l)\n{\n int i;\n int ans=1;\n fs(i,l)\n ans*=3;\n\n return ans;\n}\nint main()\n{\n int i,j,k,l,a,b,c;\n sci2(a,c);\n int s1[100000],s2[10000],s3[10000];\n int l1=cnvrttrnr(a,s1);\n int l2=cnvrttrnr(c,s2);\n\n /*fs(i,l1)\n pf(s1[i]);\n fs(i,l2)\n pf(s2[i]);*/\n if(l1>l2)\n {\n fp(i,l2,l1,1)\n s2[i]=0;\n }else\n {\n fp(i,l1,l2,1)\n s1[i]=0;\n }\n\n if(l1>l2)\n {fs(i,l1)\n {\n fs(j,3)\n {if(((s1[i]+j)%3==s2[i]))\n {\n s3[i]=j;\n }\n }\n }}\n else\n {\n fs(i,l2)\n {\n fs(j,3)\n {if(((s1[i]+j)%3==s2[i]))\n {\n s3[i]=j;\n break;\n }\n }\n }\n }\n\n int ans=0;\n if(l1>l2)\n fs(i,l1)\n {\n int p=powr3(i);\n ans+=s3[i]*p;\n }\n else\n fs(i,l2)\n {\n int p=powr3(i);\n ans+=s3[i]*p;\n }\n\npf(ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\n long long int a,c,i=0,j=0,b,p,k;\n long long int sum=0;\n scanf(\"%lld%lld\",&a,&c);\n char *s,*t;\n s=(char *)malloc(100);\n t=(char *)malloc(100);\n int n[100];\n b=a;\n while(b!=0){\n s[i]=(b%3)+48;\n b=b/3;\n i++;\n }\n b=c;\n while(b!=0){\n t[j]=(b%3)+48;\n b=b/3;\n j++;\n }\n p=(i>j)?i:j;\n if(i>j){\n for(k=j;k<i;k++)t[k]='0';\n }\n else{\n for(k=i;k<j;k++)s[k]='0';\n }\n s[p]='\\0';t[p]='\\0';\n strrev(s);strrev(t);\n //printf(\"%s %s \",s,t);\n for(i=0;i<p;i++){\n if((t[i]-48)==0&&(s[i]-48)==1)n[i]=2;\n else if((t[i]-48)==0&&(s[i]-48)==2)n[i]=1;\n else if((t[i]-48)==1&&(s[i]-48)==2)n[i]=2;\n else n[i]=(t[i]-48)-(s[i]-48);\n }\n for(i=0,j=p;i<p;i++,j--){\n sum+=n[i]*pow(3,j-1);\n }\n printf(\"%lld\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint f(int *s,int x)\n{\n int i=0;\n while(x)\n {\n s[i++]=x%3;\n x/=3; \n }\n return i;\n}\nint main()\n{\n int a[100],c[100],aa,cc,i,j,num;\n scanf(\"%d %d\",&aa,&cc);\n i=f(a,aa);\n j=f(c,cc);\n while(i<j)\n a[i++]=0;\n while(j<i)\n c[j++]=0;\n num=0;\n while((--i)>=0)\n {\n num*=3;\n num+=(c[i]-a[i]+3)%3; \n }\n printf(\"%d\\n\",num);\n //system(\"pause\");\n return 0; \n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint a,c,t,b,i;\n\nint main(void) {\n\tscanf(\"%d %d\", &a, &c);\n\twhile (a||c) {\n\t\tt*=3;\n\t\tt+=(3+c%3-a%3)%3;\n\t\ta/=3;\n\t\tc/=3;\n\t\t++i;\n\t}\n\twhile (i--) {\n\t\tb*=3;\n\t\tb+=t%3;\n\t\tt/=3;\n\t}\n\tprintf(\"%d\\n\", b);\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main (void)\n{\n\tunsigned int a, b = 0, c, i;\n\tscanf (\"%u%u\", &a, &c);\n\tfor (i = 0; a != 0 || c != 0; i++)\n\t{\n\t\tb += (c % 3 - a % 3 + 3) % 3 * pow (3, i);\n\t\ta /= 3;\n\t\tc /= 3;\n\t}\n\tprintf (\"%u\\n\", b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long a,c,m=0;\n scanf(\"%I64d%I64d\",&a,&c);\n long long b=0,d[100],e[100],f[100],g[100],i,j=1,k,x=0,y=0;\n for(i=0;i<20;i++)\n d[i]=pow(3,i);\n for(i=19;i>=0;i--)\n {\n e[x++]=a/d[i];\n a=a-d[i]*e[x-1];\n }\n for(i=19;i>=0;i--)\n {\n f[y++]=c/d[i];\n c=c-d[i]*f[y-1];\n }\n for(i=0;i<20;i++)\n f[i]+=3;\n for(i=19;i>=0;i--)\n {\n g[i]=(f[i]-e[i])%3;\n b=b+g[i]*d[19-i];\n }\n printf(\"%d\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include<string.h>\n\nint main()\n{\n long int a[30],b[30],c[30];\n long int d,e,f,x,y,z;\n scanf(\"%ld %ld\",&d,&e);\n for(x=0;x<30;x++)\n {\n a[x]=0;\n b[x]=0;\n c[x]=0;\n }\n x=0;\n z=d;\n y=0;\n while(z>0)\n {\n a[x]=z%3;\n x++;\n z=(z-z%3)/3;\n }\n y=x==0?0:x-1;\n z=e;\n x=0;\n while(z>0)\n {\n c[x]=z%3;\n x++;\n z=(z-z%3)/3;\n }\n y=x-1>y?x-1:y;\n for(x=0;x<=y;x++)\n {\n if(c[x]<a[x])\n {\n b[x]=c[x]+3-a[x];\n }\n else\n {\n b[x]=c[x]-a[x];\n }\n }\n z=0;\n for(x=y;x>=0;x--)\n {\n z=z*3+b[x];\n }\n printf(\"%ld\",z);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint *na3(long int x){\n int *wynik=malloc(30*sizeof(int));\n int i;\n\n for (i=0; i<30; ++i){\n wynik[i]=x%3;\n x=x/3;\n }\n return wynik;\n}\n\nint main()\n{\n int *a3, *b3, *c3;\n long int a,b,c;\n int i;\n\n b3=malloc(30*sizeof(int));\n scanf(\"%ld %ld\", &a,&c);\n a3=na3(a);\n c3=na3(c);\n for (i=0; i<30; ++i){\n if (c3[i]>=a3[i]){\n b3[i]=c3[i]-a3[i];\n } else{\n b3[i]=c3[i]+3-a3[i];\n }\n }\n b=0;\n\n\n\n for (i=29; i>=0; --i){\n b=b*3+b3[i];\n }\n printf(\"%ld\", b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nvoid change_base (int a, int arr[], int base) {\n int orig=a;\n int i,pow=1;\n int max = floor(log(orig)/log(base));\n// printf (\"max=%d\\n\",max);\n for (i=0;i<max+1;i++) {\n// printf(\"a=%d pow=%d\\n\",a,pow);\n arr[i]=a%3;\n a/=3;\n pow*=3;\n }\n}\n\nvoid print_array (int a[], int len) {\n int i;\n for (i=0;i<len;i++) {\n printf (\"%d \",a[i]);\n }\n printf (\"\\n\");\n}\n\nint main (void) {\n\n int a,c;\n scanf (\"%d %d\",&a,&c);\n\n int a3[20]={0};\n change_base(a,a3,3);\n int c3[20]={0};\n change_base(c,c3,3);\n\n int b=0;\n int b3[19]={0};\n int i;\n for (i=0;i<19;i++) {\n b3[i]=(c3[i]-a3[i]+3)%3; // c mods negatives weirdly\n b+=pow(3,i)*b3[i];\n }\n// print_array (a3,20);\n// print_array (c3,20);\n// print_array (b3,20);\n printf (\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long a,b,c=0,k=1;\n scanf(\"%ld %ld\",&a,&b);\n while (a || b)\n {\n c+=(3-a%3+b%3)%3*k;\n a/=3;\n b/=3;\n k*=3;\n }\n printf(\"%ld\",c);\n return 0;\n}"}, {"source_code": "/* Author: Abhay\n Problem: 136B Codeforces\n Language: C\n */\n\n#include <stdio.h>\n\nint ternary (int x, int result[])\n{\n int i = 0;\n \n while (x)\n {\n result[i++] = x % 3;\n x /= 3;\n }\n \n return i;\n}\n\nint main ()\n{\n int a, b, c, len_a, len_c, i, mul;\n int ternary_a[100], ternary_b[100], ternary_c[100];\n \n scanf (\"%d %d\", &a, &c);\n \n len_a = ternary (a, ternary_a);\n len_c = ternary (c, ternary_c);\n \n while (len_a < len_c)\n ternary_a[len_a++] = 0;\n \n while (len_c < len_a)\n ternary_c[len_c++] = 0;\n \n for (i=0; i<len_a; i++)\n {\n if (ternary_c[i] == 0)\n {\n if (!ternary_a[i])\n ternary_b[i] = 0;\n else\n ternary_b[i] = 3 - ternary_a[i];\n }\n else if (ternary_c[i] == 1)\n {\n if (ternary_a[i] == 2)\n ternary_b[i] = 2;\n else\n ternary_b[i] = 1 - ternary_a[i];\n }\n else\n ternary_b[i] = 2 - ternary_a[i];\n }\n \n while (len_a < len_c)\n {\n ternary_b[len_a] = ternary_c[len_a];\n len_a++;\n }\n \n b = 0;\n mul = 1;\n \n for (i=0; i<len_c; i++)\n {\n b += (ternary_b[i] * mul);\n mul *= 3;\n }\n \n printf (\"%d\\n\", b);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n\nlong long int trinary(long long int n){\n\tlong long int cnt=1,s=0,l;\n\twhile(n!=0){\n\t\tl=n%3;\n\t\ts=cnt*l+s;\n\t\tcnt=cnt*10;\n\t\tn=n/3;\n\t}\n\treturn s;\n}\nlong long int tri(long long int n)\n{\n\tlong long int o,r,f,l=0,s=0,i;\n\twhile (n!=0){\n\t\tr=n%10;\n\t\tif (r!=0){\n\t\t\tf=1;\n\t\t\tfor (i=1;i<=l;i++){\n\t\t\t\tf=f*3;\n\t\t\t}\n\t\t\to=f*r;\n\t\t\ts=s+o;\n\t\t}\n\t\tl=l+1;\n\t\t\n\t\tn=n/10;\n\t}\n\treturn s;\n}\nint main()\n{\n\tlong long int a,b,r,s,t,e,f,l,cnt,w,q;\n\tscanf(\"%lld %lld\",&a,&b);\n\tr=trinary(a);\n\tt=trinary(b);\n\tif (t>=r){\n\t\tcnt=1;\n\t\ts=0;\n\t\twhile(t!=0){\n\t\t\tf=t%10;\n\t\t\te=r%10;\n\t\t\tq=(f-e);\n\t\t\tif (q>=0){\n\t\t\t\tl=q%3;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tl=3-(abs(q)%3);\n\t\t\t}\n\t\t\ts=s+l*cnt;\n\t\t\tcnt=cnt*10;\n\t\t\tt=t/10;\n\t\t\tr=r/10;\n\t\t\t\n\t\t}\n\t}\n\telse{\n\t\tcnt=1;\n\t\ts=0;\n\t\twhile(r!=0){\n\t\t\tf=t%10;\n\t\t\te=r%10;\n\t\t\tq=(f-e);\n\t\t\tif (q>=0){\n\t\t\t\tl=q%3;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tl=3-(abs(q)%3);\n\t\t\t}\n\t\t\ts=s+l*cnt;\n\t\t\tcnt=cnt*10;\n\t\t\tt=t/10;\n\t\t\tr=r/10;\n\t\t\t\n\t\t}\n\t}\n\tw=tri(s);\n\t//w=pow(3,2);\n\tprintf(\"%lld\",w);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\nlong long int a,c;\nscanf(\"%I64d %I64d\",&a,&c);\nchar s[30000],t[30000];\nint p=a,q=c,i=0,r,j,k=0;\nwhile(1)\n{\nif(p==0)\nbreak;\ns[i++]=p%3+'0';\np=p/3;\n\n}\nwhile(1)\n{\nif(q==0)\nbreak;\nt[k++]=q%3+'0';\nq=q/3;\n\n}\nif(i>k)\n{\n\twhile(k!=i)\nt[k++]='0';\n\n}\nelse if(k>i)\n{\n\twhile(i!=k)\ns[i++]='0';\n}\nt[k]='\\0';\ns[i]='\\0';\nchar res[k+1];\nfor(i=0;i<k;i++)\n{\nif(s[i]=='0')\n{\nif(t[i]=='0')\nres[i]='0';\n\nelse if(t[i]=='1')\nres[i]='1';\n\nelse\nres[i]='2';\n\n}\nelse if(s[i]=='1')\n{\nif(t[i]=='0')\nres[i]='2';\n\nelse if(t[i]=='1')\nres[i]='0';\n\nelse\nres[i]='1';\n\n}\nelse\n{\nif(t[i]=='0')\nres[i]='1';\n\nelse if(t[i]=='1')\nres[i]='2';\n\nelse\nres[i]='0';\n}\n}\nres[i]='\\0';\n//printf(\"%s\",res);\nlong long int sum=0,kou=1;\nfor(j=0;j<k;j++)\n{\np=res[j]-'0';\n//printf(\"%I64d \",p);\nsum=sum+(p*kou);\nkou=3*kou;\n\n}\nprintf(\"%I64d\",sum);\n\n\n\n\n\n\n\n}"}, {"source_code": "#include<stdio.h>\nint a1[50],b1[50];\nint main(){\n\tint a,b=0,c,i,ta,ta2;\n\tint ma,p=1,temp,temp2;\n\tscanf(\"%d %d\",&a,&c);\n\t\tfor(i=0;i>=0;i++){\n\t\tif(a>=1){\n\t\ta1[i]=a%3;\n\t\ta=a/3;\n\t\t}\n\t\telse { \n\t\t\tta=i;\n\t\t\tbreak;\n\t\t}\n\t\t}\n\t\tfor(i=0;i>=0;i++){\n\t\tif(c>=1){\n\t\tb1[i]=c%3;\n\t\tc=c/3;\n\t\t}\t\n\t\telse {\n\t\tta2=i;\n\t\tbreak;\n\t\t}\n\t\t}\n\t\tif(ta>ta2){\n\t\tma=ta;\n\t\t}\n\t\telse {\n\t\tma=ta2;\n\t\t}\n\t\t/*for(i=0;i<ma;i++){\n\t\tprintf(\"%d\\n\",b1[i]);\n\t\t}*/\n\t\tfor(i=0;i<ma;i++){\n\t\ttemp=a1[i]*2;\n\t\ttemp2=b1[i];\n\t\ttemp=temp+temp2;\n\t\ttemp=temp%3;\n\t\tb=b+(temp*p);\n\t\tp=p*3;\n\t\ttemp=0;\n\t\ttemp2=0;\n\t\t}\n\t\tprintf(\"%d\\n\",b);\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong int arr[100],brr[100],crr[100],i=0,j=0,k=0;\nvoid func(long int a)\n{\n\twhile(a>0)\n\t{\n\t\t\tarr[i]=a%3;\n\t\t//\tprintf(\"%d\\n\",a%3);\n\t\t\ti++;\n\t\t\ta=a/3;\n\t}\n\ti--;\n}\nvoid func1(long int a)\n{\n\twhile(a>0)\n\t{\n\t\t\tcrr[j]=a%3;\n\t\t//\tprintf(\"%d\\n\",a%3);\n\t\t\tj++;\n\t\t\ta=a/3;\n\t}\n\tj--;\n}\nint main()\n{\n\t\tlong int a,c,b,l;\n\t\tscanf(\"%ld %ld\",&a,&c);\n\t\tfunc(a);\n\t\tfunc1(c);\n\t\tif(i<j)\n\t\t{\n\t\t\t\tfor(k=i+1;k<=j;k++)\n\t\t\t\tarr[k]=0;\n\t\t\t\ti=j;\n\t\t}\n\t\telse if(j<i)\n\t\t{\n\t\t\tfor(k=j+1;k<=i;k++)\n\t\t\tcrr[k]=0;\n\t\t\tj=i;\n\t\t}\n\t\tk=0;\n//\t\tfor(k=0;k<=i;k++)\n//\t\t{\n//\t\t\tprintf(\"%d \",arr[k]);\n//\t\t}\n//\t\tprintf(\"\\n\");\n//\t\tfor(k=0;k<=j;k++)\n//\t\t{\n//\t\t\tprintf(\"%d \",crr[k]);\n//\t\t}\n//\t\tprintf(\"\\n\");\n\t\t\n\t\tfor(l=0;l<=i;l++)\n\t\t{\n\t\t\tif(crr[l]-arr[l]>=0)\n\t\t\t{\n\t\t\tbrr[l]=crr[l]-arr[l];\n\t\t//\tk++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbrr[l]=3+crr[l]-arr[l];\n\t\t\t}\n\t\t}\n\t\tlong int ans=0;\n\t\tfor(l=i;l>=0;l--)\n\t\t{\n\t\t\tans=3*ans+brr[l];\n//\t\t\tprintf(\"%d \",brr[l]);\n\t\t}\n//\t\tprintf(\"\\n\");\n\t\tprintf(\"%ld\\n\",ans);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nlong long int in[102], res[103], need[105];\nint main()\n{\n long long int a, b=0, c, i, j=0, n1=0, n2=0, num, mx=0;\n scanf(\"%I64d %I64d\", &a, &c);\n\n\n if(a==c){\n printf(\"0\");\n return 0;\n }\n while(a>0){\n in[j]= (a%3);\n a/=3;\n j++;\n }\n n1=j;\n j=0;\n while(c>0){\n res[j]= (c%3);\n c/=3;\n j++;\n }\n n2=j;\n if(n2>n1){\n mx = n2;\n }\n else{\n mx=n1;\n }\n\n for(i=0;i<mx;i++){\n if(res[i]<in[i]){\n if(res[i]==1){\n num = 4-in[i];\n }\n else if(res[i]==0){\n num = 3-in[i];\n }\n }\n else{\n num = res[i]-in[i];\n }\n need[i] = num;\n }\n j=0;\n num=1;\n\n b=0;\n for(i=0;i<mx;i++){\n //printf(\"N: %I64d\\n\", need[i]);\n b= b+((need[i])*num);\n num*=3;\n //printf(\"B:%I64d\\n\", b);\n\n }\n printf(\"%I64d\", b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint power(int a){\n int i,num=1;\n for(i=1;i<=a;i++)\n num=num*3;\n return num;\n}\nint main(){\n int a,b;\n while(scanf(\"%d%d\",&a,&b)==2){\n int l1,l2,i,l,num=0;\n char a1[80],b1[80],t1,t2,dest[80],ans[80];\n\n i=0;\n while(a){\n a1[i]='0'+a%3;\n a=a/3;\n i++;\n }\n a1[i]='\\0';\n l1=strlen(a1);\n for(i=0;i<l1/2;i++){\n t1=a1[i];\n t2=a1[l1-i-1];\n a1[i]=t2;\n a1[l1-1-i]=t1;\n }\n\n\n i=0;\n while(b){\n b1[i]='0'+b%3;\n b=b/3;\n i++;\n }\n b1[i]='\\0';\n l2=strlen(b1);\n for(i=0;i<l2/2;i++){\n t1=b1[i];\n t2=b1[l2-i-1];\n b1[i]=t2;\n b1[l2-1-i]=t1;\n }\n\n\n if(l1<l2){\n l=l2;\n for(i=0;i<l2-l1;i++)\n dest[i]='0';\n dest[i]='\\0';\n strcat(dest,a1);\n strcpy(a1,dest);\n }\n else{\n l=l1;\n for(i=0;i<l1-l2;i++)\n dest[i]='0';\n dest[i]='\\0';\n strcat(dest,b1);\n strcpy(b1,dest);\n }\n\n\n\n\n\n for(i=0;i<l;i++){\n if(a1[i]=='2'&& b1[i]=='0') ans[i]='1';\n else if(a1[i]=='2'&& b1[i]=='1') ans[i]='2';\n else if(a1[i]=='2'&& b1[i]=='2') ans[i]='0';\n else if(a1[i]=='1'&& b1[i]=='0') ans[i]='2';\n else if(a1[i]=='1'&& b1[i]=='1') ans[i]='0';\n else if(a1[i]=='1'&& b1[i]=='2') ans[i]='1';\n else if(a1[i]=='0'&& b1[i]=='0') ans[i]='0';\n else if(a1[i]=='0'&& b1[i]=='1') ans[i]='1';\n else if(a1[i]=='0'&& b1[i]=='2') ans[i]='2';\n }\n\n\n for(i=0;i<l;i++){\n num=num+(ans[i]-'0')*power(l-i-1);\n }\n printf(\"%d\\n\",num);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint arr1[1000], arr2[1000], arr3[1000];\nint main(){\n int t,i,l1,l2,l3,j;\n scanf(\"%d\", &t);\n i=0;\n while(t!=0){\n\t arr1[i]=t%3;\n\t t/=3;\n\t i++;\n }\n l1=i;\n scanf(\"%d\", &t);\n i=0;\n while(t!=0){\n\t arr2[i]=t%3;\n\t t/=3;\n\t i++;\n }\n l2=i;\n i=0;\n l3=(l1>l2)?l1:l2;\n while(i!=l3){\n\tif(arr2[i]>=arr1[i]){\n\t\tarr3[i]=arr2[i]-arr1[i];\n\t} else {\n\t\tarr3[i]=arr2[i]+3-arr1[i];\n\t}\n\ti++;\n }\n /*\n for(j=l3-1; j>=0; j--){\n\t printf(\"%d\", arr3[j]);\n }\n putchar('\\n');\n */\n i=1; l1=0;\n for(j=0; j<l3; j++){\n\tl1+=i*arr3[j];\n\ti*=3;\n }\n printf(\"%d\", l1);\n return 0;\n}\n"}, {"source_code": " #include <stdio.h>\n\nvoid conv(int x, int * m){\n int i=0;\n do {\n m[i]=x%3;\n x/=3;\n i++;\n } while (x);\n for (;i<32;i++) m[i]=0;\n}\n\nint main()\n{ int c1[32],c2[32],i,a,b,r=0,s=3;\n scanf(\"%d%d\",&a,&b);\n conv(a,c1);\n conv(b,c2);\n for (i=0;i<32;i++){\n c1[i]=c2[i]-c1[i];\n if (c1[i]<0) c1[i]+=3;\n if (i==0)\n r=c1[i];\n else {\n r+=c1[i]*s;\n s*=3;\n }\n }\n printf(\"%d\",r);\n return 0;\n}"}, {"source_code": "int a,b,c,t=1;main(){for(scanf(\"%d%d\",&a,&c);a|c;a/=3,c/=3,t*=3)b+=(c%3-a%3+3)%3*t;printf(\"%d\",b);exit(0);}\n"}, {"source_code": "int a,b,c,t=1;\nint main()\n{\n scanf(\"%d%d\",&a,&c);\n for(;a|c;a/=3,c/=3,t*=3)\n b+=(c%3-a%3+3)%3*t;\n printf(\"%d\",b);exit(0);\n}\n"}, {"source_code": "int a,b,c,t=1;\nmain()\n{\n for(scanf(\"%d%d\",&a,&c);a|c;a/=3,c/=3,t*=3)b+=(c%3-a%3+3)%3*t;\n printf(\"%d\",b);exit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n//||\n//\\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n long long int a,b,c,d=-1,e,i,j=1,k,sum=0,sum1=0,ct=0;\n long long int x[100]={0},y[100]={0};\n scanf(\"%lld %lld\",&a,&b);\n c=a;\n d=b;\n while(c!=0)\n {\n x[sum]=(c%3);\n c=c/3;\n sum++;\n }\n while(d!=0)\n {\n y[sum1]=(d%3);\n d=d/3;\n sum1++;\n }\n e=sum>=sum1?sum:sum1;\n\n\n for(i=0;i<e;i++)\n {\n if(x[i]>y[i])\n ct=ct+(y[i]-x[i]+3)*j;\n else\n ct=ct+(y[i]-x[i])*j;\n j=j*3;\n\n }\n printf(\"%lld\",ct);\n return 0;}\n"}, {"source_code": "unsigned a,b,c,x=1;\nint main(){\nfor(scanf(\"%d%d\",&a,&c);a|c;x*=3,a/=3,c/=3)b+=(3+c%3-a%3)%3*x;\nprintf(\"%d\",b);exit(0);\n}"}, {"source_code": "#include <stdio.h>\n#define maxn 1000\nlong basea[maxn],baseb[maxn],basec[maxn];\nlong a,b,c;\nlong d1,d2,d3;\nint main()\n{\n long i,tmp=0;\n scanf(\"%ld %ld\",&a,&c);\n while (a>0) \n {\n basea[d1++]=a%3;\n a/=3;\n }\n while (c>0)\n {\n basec[d3++]=c%3;\n c/=3;\n }\n if (d1>d3) d2=d1;\n else d2=d3;\n for (i=0;i<d2;i++)\n {\n tmp=basec[i]-basea[i];\n baseb[i]=(tmp+3)%3;\n //tmp/=3;\n }\n tmp=1;\n for (i=0;i<d2;i++)\n {\n b+=baseb[i]*tmp;\n tmp*=3;\n }\n printf(\"%ld\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar a[35],b[35];\nint main()\n{\n int A,B,i;\n __int64 s;\n while(scanf(\"%d%d\",&A,&B)!=EOF)\n {\n itoa(A,a,3);\n itoa(B,b,3);\n strrev(a);\n strrev(b);\n for(i=0;a[i] && b[i];i++)\n {\n b[i]-=a[i]-'0';\n if(b[i]<'0')b[i]+=3;\n }\n for(;a[i];i++)\n {\n b[i]=2*'0'-a[i];\n if(b[i]<'0')b[i]+=3;\n }\n strrev(b);\n for(s=i=0;b[i];i++)\n {\n s*=3;s+=b[i]-'0';\n }\n printf(\"%I64d\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int dk(long long int m,long long int n[]);\nlong long int main()\n{\nlong long int a,b,c,d=0,i,e=0,k=0,g=0;\nlong long int p[10000]={0},q[10000],f[10000];\nscanf(\"%I64d%I64d\",&a,&c);\nd=dk(a,p);\ne=dk(c,q);\nif(d==e)\n{\nnext:\nfor(i=0;i<d;i++)\n{\nk=0;\nwhile(((p[i]+k)%3)!=q[i])\n{\nk++;\n}\nf[i]=k;\n}\n}\nelse\n{\nif(d>e)\n{\nwhile(d!=e)\n{\nq[e]=0; \ne++;\n}\ngoto next;}\nelse\n{\nwhile(d!=e)\n{\np[d]=0;\nd++;\n}\ngoto next;}\n}\nfor(i=0;i<d;i++)\n{\ng=g+f[i]*pow(3,i);\n}\nprintf(\"%I64d\",g);\nreturn(0);\n}\nlong long int dk(long long int m,long long int n[])\n{\n int x=0;\nwhile(m>0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}"}, {"source_code": "#include<stdio.h>\nlong long int dk(long long int m,long long int n[]);\nlong long int main()\n{\nlong long int a,b,c,d=0,i,e=0,k=0,g=0;\nlong long int p[10000]={0},q[10000],f[10000];\nscanf(\"%I64d%I64d\",&a,&c);\nd=dk(a,p);\ne=dk(c,q);\nif(d==e)\n{\nnext:\nfor(i=0;i<d;i++)\n{\nk=0;\nwhile(((p[i]+k)%3)!=q[i])\n{\nk++;\n}\nf[i]=k;\n}\n}\nelse\n{\nif(d>e)\n{\nwhile(d!=e)\n{\nq[e]=0;\ne++;\n}\ngoto next;}\nelse\n{\nwhile(d!=e)\n{\np[d]=0;\nd++;\n}\ngoto next;}\n}\nfor(i=0;i<d;i++)\n{\ng=g+f[i]*pow(3,i);\n}\nprintf(\"%I64d\",g);\nreturn(0);\n}\nlong long int dk(long long int m,long long int n[])\n{\n int x=0;\nwhile(m>0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/3;\n}\nreturn(x);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\ntypedef long long int LLI;\n\n\n\n#define TRUE (1==1)\n#define FALSE (!TRUE)\n#define fo3(i,a,b) for(i=((int)a);i<=((int)b);i++)\n#define of3(i,a,b) for(i=((int)a);i>=((int)b);i--)\n#define in1(n) scanf(\"%d\",&(n))\n#define LL1(n) scanf(\"%I64d\",&(n))\n#define in2(n,m) scanf(\"%d%d\",&(n),&(m))\n#define pri(n) printf(\"%d\\n\",n)\n#define prs(n) printf(\"%s\\n\",n)\n#define prL(n) printf(\"%I64d\\n\",n)\n#define strin(n) scanf(\"%s\",n)\n#define newint(n) (int*)calloc((n),sizeof(int))\n#define arrint(ret,n,i) fo3(i,1,n) in1(ret[i-1])\n#define newLLI(n) (LLI*)calloc((n),sizeof(LLI))\n#define arrLLI(ret,n,i) fo3(i,1,n) LL1(ret[i-1])\n\nvoid fastWrite(FILE * ofp, int x) {\n int i = 12;\n char buff[i];\n buff[i] = 0;\n int neg = 0;\n if (x < 0){\n x = -x;\n neg = 1;\n }\n if (x == 0)\n buff[--i] = '0';\n else while (x != 0) {\n buff[--i] = (x % 10) + '0';\n x /= 10;\n }\n if (neg)\n buff[--i] = '-';\n fwrite(buff + i, sizeof(char), (12 - i), ofp);\n}\n\nvoid fastSpace(FILE * ofp){\n fwrite(\" \", sizeof(char), 1, ofp);\n}\nvoid fastNewLine(FILE * ofp) {\n fwrite(\"\\n\", sizeof(char), 1, ofp);\n}\n\ntypedef struct AL AL;\nstruct AL{\n int * vals;\n int size;\n int cap;\n};\nAL * ALCreate(int s) {\n AL * ret = (AL *) calloc(1, sizeof(AL));\n if (s == 0) ret->vals = NULL;\n else ret->vals = (int *) calloc(s, sizeof(int));\n ret->size = 0; ret->cap = s;\n return ret;\n}\nvoid ALAdd(AL * list, int ele) {\n if (list->cap == list->size) {\n int nC = ((list->cap << 1) | 1);\n list->vals = realloc(list->vals, sizeof(int) * nC);\n list->cap = nC;\n }\n list->vals[list->size++] = ele;\n}\n\n\ntypedef struct Pair {\n int fi, se;\n} Pair;\n\nint comp(Pair ** arr, int f, int s) {// CHANGE THIS\n if (arr[f]->fi != arr[s]->fi)\n return arr[f]->fi - arr[s]->fi;\n return arr[f]->se - arr[s]->se;\n}\n\nvoid sort(Pair ** arr, int size) { \n int i;\n if (size < 6) {\n int nSize = 0;\n Pair * swp;\n while (size != 0) {\n nSize = 0;\n for (i = 0; i < size - 1; i++) \n if (comp(arr, i, i + 1) > 0) { \n nSize = i + 1;\n swp = arr[i];\n arr[i] = arr[i + 1];\n arr[i + 1] = swp;\n }\n size = nSize;\n }\n return;\n }\n Pair ** tmp = (Pair **)calloc(size, sizeof(Pair *)); // CHANGE THIS\n int lSize = (size >> 1);\n int rSize = size - lSize;\n sort(arr, lSize); sort(arr + lSize, rSize);\n int lPtr = 0, rPtr = 0;\n int ptr = 0;\n while (ptr != size) {\n if (lPtr == lSize){\n tmp[ptr] = arr[lSize + (rPtr++)];\n } else if (rPtr == rSize || comp(arr, lPtr, lSize + rPtr) <= 0){ // CHANGE THIS\n tmp[ptr] = arr[lPtr++];\n } else {\n tmp[ptr] = arr[lSize + (rPtr++)];\n }\n ptr++;\n }\n for (i = 0; i < size; i++)\n arr[i] = tmp[i];\n free(tmp);\n}\n\nint bc(int x) {\n if (x <= 1)\n return x;\n return (x&1) + bc(x>>1);\n}\n\nint gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}\n\n#define MAX 100000\n#define NULL_CARRY -1\n#define NULL_VALUE 0\n\nLLI h1, h2;\n\nint carry[4 * MAX];\nint st[4 * MAX];\nint en[4 * MAX];\nLLI ans[2][4 * MAX];\n\n\nvoid init2(int index, int s, int e) {\n //printf(\"%d %d %d\\n\", index, s, e);\n st[index] = s;\n en[index] = e;\n ans[0][index] = 0;\n ans[1][index] = 0;\n carry[index] = NULL_CARRY;\n if (s == e)\n return;\n int mid = (s + e) >> 1;\n init2(index << 1, s, mid);\n init2((index << 1) | 1, mid + 1, e);\n}\n\n// Inclusive s and e\nvoid ITInit(int s, int e) {\n init2(1, s, e);\n}\n\nLLI fastExpo(LLI exp, LLI base, LLI mod) {\n if (exp == 0)\n return 1;\n if (exp == 1)\n return base % mod;\n LLI tmp = fastExpo(exp >> 1, base, mod);\n tmp *= tmp;\n tmp %= mod; \n if (exp & 1)\n tmp = (tmp * base) % mod;\n return tmp;\n}\n\n\nLLI aoMem[2][MAX + 10];\nLLI feMem[2][MAX + 10];\nvoid genAllOnes() {\n int i;\n LLI tmp1 = 0;\n LLI tmp2 = 0;\n LLI tmp3 = 1;\n LLI tmp4 = 1;\n fo3(i,0, MAX+9) {\n aoMem[TRUE][i] = tmp1;\n tmp1 = tmp1 * 10 + 1;\n tmp1 %= h1;\n aoMem[FALSE][i] = tmp2;\n tmp2 = tmp2 * 10 + 1;\n tmp2 %= h2;\n feMem[TRUE][i] = tmp3;\n tmp3 *= 10;\n tmp3 %= h1;\n feMem[FALSE][i] = tmp4;\n tmp4 *= 10;\n tmp4 %= h2;\n }\n}\nLLI allOnes(int len, LLI mod) {\n return aoMem[mod==h1][len];\n}\n\nLLI agg(int pre, int suf, int pow, LLI mod) {\n LLI mult = feMem[mod==h1][pow];\n mult *= suf;\n mult += pre;\n mult %= mod;\n //printf(\" returning from agg!\\n\");\n return mult;\n}\n\nvoid ITComp(int index) {\n if (carry[index] == NULL_CARRY) {\n ans[0][index] = agg(ans[0][index<<1], ans[0][(index<<1)|1], en[index<<1] - st[index<<1] + 1, h1);\n ans[1][index] = agg(ans[1][index<<1], ans[1][(index<<1)|1], en[index<<1] - st[index<<1] + 1, h2);\n } else {\n ans[0][index] = allOnes(en[index] - st[index] + 1, h1) * carry[index];\n ans[0][index] %= h1;\n ans[1][index] = allOnes(en[index] - st[index] + 1, h2) * carry[index];\n ans[1][index] %= h2;\n }\n}\n\nvoid push(int index) {\n if (carry[index] == NULL_CARRY)\n return;\n if (st[index] != en[index]) {\n carry[index<<1] = carry[index];\n ITComp(index<<1);\n carry[(index<<1)|1] = carry[index];\n ITComp((index<<1)|1);\n }\n carry[index] = NULL_CARRY;\n}\n\n\nvoid set2(int index, int s, int e, int value) {\n if (st[index] >= s && e >= en[index]) {\n carry[index] = value;\n ITComp(index);\n return;\n }\n if (st[index] > e || s > en[index])\n return;\n push(index);\n set2(index<<1, s, e, value);\n set2((index<<1)|1, s, e, value);\n ITComp(index);\n}\n\nvoid ITSet(int s, int e, int value) {\n set2(1, s, e, value);\n}\n\nLLI get2(int index, int type, int s, int e) {\n if (st[index] >= s && e >= en[index]) {\n //printf(\" Starting Push!\\n\");\n //push(index);\n ITComp(index);\n //printf(\" Out of Push!\\n\");\n if (type == 0) {\n //prL(agg(0, ans[type][index], st[index] - s, h1));\n return agg(0, ans[type][index], st[index] - s, h1);\n } \n return agg(0, ans[type][index], st[index] - s, h2);\n }\n if (st[index] > e || s > en[index])\n return NULL_VALUE;\n push(index);\n LLI ret = get2(index<<1, type, s, e) + get2((index<<1)|1, type, s, e);\n if (type == 0 && ret >= h1)\n ret -= h1;\n if (type == 1 && ret >= h2)\n ret -= h2;\n return ret;\n}\n\nLLI get(int type, int s, int e) {\n return get2(1, type, s, e);\n}\n\nint main(void) {\n int a, c, aa, cc, b = 0, pow = 1, bb;\n in2(a,c);\n while (a != 0 || c != 0) {\n aa = a % 3;\n cc = c % 3;\n bb = (3 + cc - aa) % 3;\n b += pow * bb;\n a/=3;\n c/=3;\n pow *= 3;\n }\n pri(b);\n return 0;\n}"}, {"source_code": "/* https://codeforces.com/contest/136/submission/35187182 (rainboy) */\n#include <stdio.h>\n\nint sub(int a, int c) {\n\treturn a == 0 && c == 0 ? 0 : sub(a / 3, c / 3) * 3 + ((c - a) % 3 + 3) % 3;\n}\n\nint main() {\n\tint a, c;\n\n\tscanf(\"%d%d\", &a, &c);\n\tprintf(\"%d\\n\", sub(a, c));\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by rainboy */\n#include <stdio.h>\n\nint main() {\n\tstatic int aa[20], bb[20], cc[20];\n\tint a, c, i, k;\n\tlong long b;\n\n\tscanf(\"%d%d\", &a, &c);\n\tk = 0;\n\twhile (a > 0) {\n\t\taa[k++] = a % 3;\n\t\ta /= 3;\n\t}\n\tk = 0;\n\twhile (c > 0) {\n\t\tcc[k++] = c % 3;\n\t\tc /= 3;\n\t}\n\tfor (i = 0; i < 20; i++) {\n\t\tbb[i] = cc[i] - aa[i];\n\t\tif (bb[i] < 0)\n\t\t\tbb[i] += 3;\n\t}\n\tb = 0;\n\tfor (i = 19; i >= 0; i--)\n\t\tb = (b * 3) + bb[i];\n\tprintf(\"%lld\\n\", b);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int a,b=0,c;\n\tscanf(\"%lld %lld\",&a,&c);\n\tlong long int a3=0,b3=0,c3=0,co=1;\n\twhile (a!=0)\n\t{\n\t\ta3=a%3*co+a3;\n\t\ta/=3;\n\t\tco=co*10;\n\t}\n\tco=1;\n\twhile (c!=0)\n\t{\n\t\tc3=c%3*co+c3;\n\t\tc/=3;\n\t\tco=co*10;\n\t}\n\tco=1;\n\twhile (a3!=0||c3!=0)\n\t{\n\n\t\tif ((c3%10)<(a3%10))\n\t\t{\n\t\t\tif (c3%10==0&&a3%10==2)\n\t\t\t\tb3=co*1+b3;\n\t\t\telse\n\t\t\t\tb3=co*2+b3;\n\t }\n\t\t\telse\n\t\t\tb3=co*(c3%10-a3%10)+b3;\n\t\ta3/=10;\n\t\tc3/=10;\n\t\tco*=10;\n\t}\n\tint x=1;\n\twhile (b3!=0)\n\t{\n\t\tb=b+(b3%10)*x;\n\t\tx*=3;\n\t\tb3/=10;\n\t}\n\tprintf(\"%lld\",b);\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long a, b, c;\n\n scanf(\"%lld%lld\", &a, &c);\n\n b = 0;\n long long p = 1;\n while(a || c) {\n int aux1 = a % 3;\n int aux2 = c % 3;\n\n b = b + ((abs(aux2 - aux1 + 3)) % 3) * p;\n\n a /= 3;\n c /= 3;\n p *= 10;\n }\n\n long long axi = 0;\n p = 1;\n while(b) {\n axi += (b % 10) * p;\n b /= 10;\n p *= 3;\n }\n\n printf(\"%d\", axi);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) \\\n ({ __typeof__ (a) _a = (a); \\\n __typeof__ (b) _b = (b); \\\n _a > _b ? _a : _b; })\n\ntypedef long long int ll;\nint x[30],y[30];\nint main()\n{\n\tll a,c,ans=0,temp=1;\n\tscanf(\"%lld %lld\",&a,&c);\n\n\tint j=0;\n\twhile(a)\n\t{\n\t\tx[++j] = a%3;\n\t\ta /= 3;\n\t}\n\tint i=0;\n\twhile(c)\n\t{\n\t\ty[++i]=c%3;\n\t\tc /=3;\n\t}\n\n\ti = max(i,j);\n\tfor(int k=1;k<=i;k++)\n\t{\n\t\tx[k]=y[k]-x[k]+3;\n\t\tx[k] = x[k]%3;\n\t\tif(x[k])\n\t\t\tans += temp*x[k];\n\t\ttemp *=3;\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int a,c,i,k=0,j=0,b=0,z;\n scanf(\"%lld %lld\",&a,&c);\n int A[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},B[20];\n int C[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};\n for(;;)\n {\n A[k]=a%3;\n a=a/3;\n k++;\n if(a==0)\n {\n break;\n }\n }\n for(;;)\n {\n C[j]=c%3;\n c=c/3;\n j++;\n if(c==0)\n {\n break;\n }\n }\n if(j>k)\n {\n k=j;\n }\n for(i=0;i<k;i++)\n {\n if(A[i]==0)\n {\n B[i]=C[i];\n }\n else if(A[i]==1&&C[i]==0)\n {\n B[i]=2;\n }\n else if(A[i]==1)\n {\n B[i]=C[i]-1;\n }\n else if(A[i]==2&&C[i]<2)\n {\n B[i]=C[i]+1;\n }\n else if(A[i]==2)\n {\n B[i]=0;\n }\n }\n b=b+B[0];\n for(i=1;i<k;i++)\n {\n z=pow(3,i);\n b=b+B[i]*z;\n }\n printf(\"%lld\\n\",b);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\nint* mtob(int a)\n{\n int *result;\n result = (int*)malloc(10000*sizeof(int));\n int i,count;\n i = a;\n count = 0;\n while (i!=0)\n {\n count++;\n result[count] = i % 3;\n i = i/3;\n }\n result[0] = count;\n return result;\n}\nint btom(int *a,int n)\n{\n int i,sum,k;\n sum = 0;\n k = 1;\n for (i=n;i>=1;i--)\n {\n sum+=k*a[i];\n k = 3*k;\n }\n return sum;\n}\nint main()\n{\n int a,b,c;\n int *aa,*cc;\n int bb[10000],dd[10000];\n int i,max;\n\n scanf(\"%d%d\",&a,&c);\n aa = mtob(a);\n\n cc = mtob(c);\n if (aa[0]>cc[0]) max = aa[0] ;\n else max = cc[0];\n for (i=1;i<=max;i++){\n if (aa[i]<=cc[i]) bb[i] = cc[i]-aa[i];\n if (aa[i]>cc[i]) bb[i] = cc[i]+3-aa[i];\n }\n \n for (i=1;i<=max;i++)\n dd[i]=bb[max-i+1];\n b = btom(dd,max);\n printf(\"%d\",b);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long int a,c,d,d1,b=0;\n int at[19] = {0},ct[19] = {0},i;\n scanf(\"%ld %ld\",&a,&c);\n /*a to ternary no.*/\n d = ceil(log(a)/log(3));\n d1=d;\n for(i=d;i>=0;i--)\n {\n at[i] = a/(long int)pow(3,i);\n a = a%(long int)pow(3,i);\n }\n /*c to ternary no.*/\n d = ceil(log(c)/log(3));\n for(i=d;i>=0;i--)\n {\n ct[i] = c/(long int)pow(3,i);\n c = c%(long int)pow(3,i);\n }\n for(i = (d1>d)? d1:d;i>=0;i--)\n {\n ct[i] +=3;\n b = b + (abs((ct[i]-at[i])%3))*(long int)pow(3,i);\n }\n printf(\"%ld\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long int a,c;\n long long int b=0;\n int at[19] = {0},ct[19] = {0},i,d,d1;\n scanf(\"%ld %ld\",&a,&c);\n /*a to ternary no.*/\n d = ceil(log(a)/log(3));\n d1=d;\n for(i=d;i>=0;i--)\n {\n at[i] = a/(long int)pow(3,i);\n a = a%(long int)pow(3,i);\n }\n /*c to ternary no.*/\n d = ceil(log(c)/log(3));\n for(i=d;i>=0;i--)\n {\n ct[i] = c/(long int)pow(3,i);\n c = c%(long int)pow(3,i);\n }\n for(i = (d1>d)? d1:d;i>=0;i--)\n {\n ct[i] +=3;\n b = b + (abs((ct[i]-at[i])%3))*(long int)pow(3,i);\n }\n printf(\"%I64d\",b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\nint main(){\n ll int a,b,i,j;\n scanf(\"%lld%lld\",&a,&b);\n char s1[10000],s2[1000],l1=0,l2=0,t=0,ans[100000];\n while(a>0){\n s1[l1++]=a%3;\n a/=3;\n }\n while(b>0){\n s2[l2++]=b%3;\n b/=3;\n }\n i=j=0;\n while(i<l1&&j<l2){\n if(s1[i]==1){\n if(s2[j]==1) ans[t++]=0;\n else if(s2[j]==2) ans[t++]=1;\n else ans[t++]=2;\n }\n else if(s1[i]==0){\n if(s2[j]==1) ans[t++]=2;\n else if(s2[j]==2) ans[t++]=2;\n else ans[t++]=1;\n }\n else{\n if(s2[j]==1) ans[t++]=2;\n else if(s2[j]==0) ans[t++]=1;\n else ans[t++]=0;\n }\n i+=1;\n j+=1;\n }\n while(i<l1) ans[t++]=s1[i++];\n while(j<l2) ans[t++]=s2[j++];\n ll int as=0;\n i=t;\n while(i>=0){\n as=as*3+ans[i--];\n }\n printf(\"%lld\",as);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid conv(int x, int * m)\n{\n int i=0;\n do\n {\n m[i]=x%3; \n x/=3;\n i++;\n } \n while (x);\n for (i=0;i<32;i++) m[i]=0;\n}\n\nint main()\n{ \n int c1[32],c2[32],i,a,b,r=0,s=3;\n scanf(\"%d%d\",&a,&b);\n conv(a,c1);\n conv(b,c2);\n for (i=0;i<32;i++)\n {\n c1[i]=c2[i]-c1[i];\n if (c1[i]<0) c1[i]+=3;\n if (i==0) r=c1[i];\n else\n {\n r+=c1[i]*s;\n s*=3;\n }\n }\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n\n#define RADIX 3\n\nint getTernary(int a, int radix, int ta[])\n{\n\tint j;\n\tint maxindex;\n\tint temp;\n\n\tmemset(ta, 0, 20*sizeof(int));\n\tfor(j = 0; pow((double)radix, j) <= a; ++j)\n\t\t;\n\t--j;\n\tmaxindex = j;\n\twhile(j >= 0)\n\t{\n\t\ttemp = pow((double)radix, j);\n\t\tta[j] = a / temp;\n\t\ta %= temp;\n\t\t--j;\n\t}\n\treturn maxindex;\n}\n\nint main()\n{\n\tint a,b,c;\n\tint ina, inc, index;\n\tint i;\n\tint ta[20];\n\tint tb[20];\n\tint tc[20];\n\n\tscanf(\"%d%d\", &a, &c);\n\tina = getTernary(a, RADIX, ta);\n\tinc = getTernary(c, RADIX, tc);\n\tif(ina >= inc)\n\t{\n\t\tindex = ina;\n\t}\n\telse\n\t{\n\t\tindex = inc;\n\t}\n\tmemset(tb, 0, 20*sizeof(int));\n\tfor(i = 0; i <= index; ++i)\n\t{\n\t\tif(tc[i] >= ta[i])\n\t\t\ttb[i] = tc[i] - ta[i];\n\t\telse\n\t\t\ttb[i] = tc[i] + RADIX - ta[i];\n\t}\n\tb = 0;\n\tfor(i = 0; i <= index; ++i)\n\t{\n\t\tb = b + tb[i] * pow((double)RADIX, i);\n\t}\n\tprintf(\"%d\\n\", b);\n\treturn 0;\n}"}, {"source_code": "int main()\n{\n unsigned a,b,c,x=1;\n for( scanf(\"%d%d\",&a,&c) ; a|c ; x*=3 , a/=3 , c/=3 )\n b+=(3+c%3-a%3)%3*x;\n printf(\"%d\",b);\n exit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main()\n{\n long long a,c,ans=0,i=0;\n scanf(\"%lld%lld\",&a,&c);\n while(a!=0 || c!=0)\n {\n ans+=(c%3-a%3+3)%3*pow(3,i);\n a/=3;\n c/=3;\n i++;\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint a1[200];\nint b1[200];\nint main()\n{\n long long a,b;\n scanf(\"%lld%lld\",&a,&b);\n int i=0;\n memset(a1,0,200);\n memset(b1,0,200);\n while(a && b)\n {\n a1[i]=a%3;\n b1[i]=b%3;\n a/=3;\n b/=3;\n i++;\n }\n if(a>0)\n {\n while(a)\n { \n a1[i]=a%3;\n b1[i]=0;\n a/=3;\n i++;\n }\n }\n else\n {\n while(b)\n { \n b1[i]=b%3;\n a1[i]=0;\n b/=3;\n i++;\n }\n }\n i-=1;\n int j=0;\n long long temp=0;\n int c[200];\n memset(c,0,200);\n for(j=0;j<=i;j++)\n {\n c[i-j]=(b1[j]-a1[j]+3)%3;\n }\n for(j=0;j<=i;j++)\n temp=temp*3+c[j];\n printf(\"%lld\\n\",temp);\n// system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint a1[100];\nint b1[100];\nint main()\n{\n \t\tlong long a,b;\n \t\tscanf(\"%lld%lld\",&a,&b);\n \t\tint i=0;\n \t\tmemset(a1,0,100);\n \t\tmemset(b1,0,100);\n \t\twhile(a && b)\n \t\t{\n\t\t\t a1[i]=(int)a%3;\n\t\t\t b1[i]=(int)b%3;\n\t\t\t a/=3;\n\t\t\t b/=3;\n\t\t\t i++;\n }\n if(a>0)\n {\n\t\t while(a)\n {\t\n\t\t a1[i]=(int)a%3;\n\t\t\t b1[i]=0;\n\t\t\t a/=3;\n\t\t\t i++;\n\t\t }\n\t\t }\n else\n {\n\t\t while(b)\n {\t\n\t\t b1[i]=(int)b%3;\n\t\t\t a1[i]=0;\n\t\t\t b/=3;\n\t\t\t i++;\n\t\t }\n\t\t }\n\t\t i-=1;\n\t\t int j=0;\n\t\t long long temp=0;\n\t\t int c[100];\n\t\t for(j=0;j<=i;j++)\n {\n\t c[i-j]=(b1[j]-a1[j]+3)%3;\n\t\t }\n\t\t for(j=0;j<=i;j++)\n\t\t temp=temp*3+c[j];\n\t\t printf(\"%lld\\n\",temp);\n// \t\tsystem(\"pause\");\n \t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main()\n{\n long long a,c,ans=0,i=0;\n scanf(\"%lld%lld\",&a,&c);\n while(a!=0 && c!=0)\n {\n ans+=(c%3-a%3+3)%3*pow(3,i);\n a/=3;\n c/=3;\n i++;\n }\n if(a==0)\n {\n while(c!=0)\n {\n ans +=c%3 *pow(3,i);\n c/=3;\n i++;\n }\n }\n if(c==0)\n {\n while(a!=0)\n {\n ans+=(3-a%3)*pow(3,i);\n a/=3;\n i++;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main()\n{\n long long a,c,ans=0,i=0;\n scanf(\"%lld%lld\",&a,&c);\n while(a!=0 && c!=0)\n {\n ans+=(c%3-a%3+3)%3*(long long)pow(3,i);\n a/=3;\n c/=3;\n i++;\n }\n if(a==0)\n {\n while(c!=0)\n {\n ans +=c%3 *(long long)pow(3,i);\n c/=3;\n i++;\n }\n }\n if(c==0)\n {\n while(a!=0)\n {\n ans+=(3-a%3)*(long long)pow(3,i);\n a/=3;\n i++;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint a,c,t,b;\n\nint main(void) {\n\tscanf(\"%d %d\", &a, &c);\n\twhile (a||c) {\n\t\tt*=3;\n\t\tt+=(3+c%3-a%3)%3;\n\t\ta/=3;\n\t\tc/=3;\n\t}\n\twhile (t) {\n\t\tb*=3;\n\t\tb+=t%3;\n\t\tt/=3;\n\t}\n\tprintf(\"%d\\n\", b);\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint a,c,t,x;\n\nint main(void) {\n\tscanf(\"%d %d\", &a, &c);\n\twhile (a||c) {\n\t\tt*=3;\n\t\tt+=(3+c-a%3)%3;\n\t\ta/=3; c/=3;\n\t}\n\twhile (t) {\n\t\tx*=3;\n\t\tx+=t%3;\n\t\tt/=3;\n\t}\n\tprintf(\"%d\\n\", x);\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nvoid change_base (int a, int arr[], int base) {\n int orig=a;\n int i,pow=1;\n int max = floor(log(orig)/log(base));\n printf (\"max=%d\\n\",max);\n for (i=0;i<max+1;i++) {\n printf(\"a=%d pow=%d\\n\",a,pow);\n arr[i]=a%3;\n a/=3;\n pow*=3;\n }\n}\n\nvoid print_array (int a[], int len) {\n int i;\n for (i=0;i<len;i++) {\n printf (\"%d \",a[i]);\n }\n printf (\"\\n\");\n}\n\nint main (void) {\n\n int a,c;\n scanf (\"%d %d\",&a,&c);\n\n int a3[20]={0};\n change_base(a,a3,3);\n int c3[20]={0};\n change_base(c,c3,3);\n\n int b=0;\n int b3[19]={0};\n int i;\n for (i=0;i<19;i++) {\n b3[i]=(c3[i]-a3[i]+3)%3; // c mods negatives weirdly\n b+=pow(3,i)*b3[i];\n }\n print_array (a3,20);\n print_array (c3,20);\n print_array (b3,20);\n printf (\"%d\\n\",b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\nlong long int a,c;\nscanf(\"%I64d %I64d\",&a,&c);\nchar s[30000],t[30000];\nint p=a,q=c,i=0,r,j,k=0;\nwhile(1)\n{\nif(p==0)\nbreak;\ns[i++]=p%3+'0';\np=p/3;\n\n}\nwhile(1)\n{\nif(q==0)\nbreak;\nt[k++]=q%3+'0';\nq=q/3;\n\n}\nif(i>k)\n{\nt[k++]='0';\n\n}\nelse if(k>i)\n{\ns[i++]='0';\n}\nt[k]='\\0';\ns[i]='\\0';\nchar res[k+1];\nfor(i=0;i<k;i++)\n{\nif(s[i]=='0')\n{\nif(t[i]=='0')\nres[i]='0';\n\nelse if(t[i]=='1')\nres[i]='1';\n\nelse\nres[i]='2';\n\n}\nelse if(s[i]=='1')\n{\nif(t[i]=='0')\nres[i]='2';\n\nelse if(t[i]=='1')\nres[i]='0';\n\nelse\nres[i]='1';\n\n}\nelse\n{\nif(t[i]=='0')\nres[i]='1';\n\nelse if(t[i]=='1')\nres[i]='2';\n\nelse\nres[i]='0';\n}\n}\nres[i]='\\0';\n//printf(\"%s\",res);\nlong long int sum=0,kou=1;\nfor(j=0;j<k;j++)\n{\np=res[j]-'0';\n//printf(\"%I64d \",p);\nsum=sum+(p*kou);\nkou=3*kou;\n\n}\nprintf(\"%I64d\",sum);\n\n\n\n\n\n\n\n}"}, {"source_code": "#include<stdio.h>\nlong long int dk(long long int m,long long int n[]);\nlong long int main()\n{\nlong long int a,b,c,d=0,i,e=0,k=0,g=0;\nlong long int p[10000]={0},q[10000],f[10000];\nscanf(\"%I64d%I64d\",&a,&c);\nd=dk(a,p);\ne=dk(c,q);\nif(d==e)\n{\nnext:\nfor(i=0;i<d;i++)\n{\nk=0;\nwhile(((p[i]+k)%3)!=q[i])\n{\nk++;\n}\nf[i]=k;\n}\n}\nelse\n{\nif(d>e)\n{\nwhile(d!=e)\n{\nq[e]=0;\ne++;\n}\ngoto next;}\nelse\n{\nwhile(d!=e)\n{\np[d]=0;\nd++;\n}\ngoto next;}\n}\nfor(i=0;i<d;i++)\n{\ng=g+f[i]*pow(3,i);\n}\nprintf(\"%I64d\",g);\nreturn(0);\n}\nlong long int dk(long long int m,long long int n[])\n{\n int x=0;\nwhile(m>0)\n{\nn[x++]=m%3;\nm=(m-(m%3))/30;\n}\nreturn(x);\n}"}, {"source_code": "#include<stdio.h>\n#define max(a,b) \\\n ({ __typeof__ (a) _a = (a); \\\n __typeof__ (b) _b = (b); \\\n _a > _b ? _a : _b; })\n\nint main()\n{\n\tint a,c;\n\tscanf(\"%d %d\",&a,&c);\n\tint ans=0,j=0,temp=1;\n\tint x[30],y[30];\n\twhile(a)\n\t{\n\t\tx[++j] = a%3;\n\t\ta /= 3;\n\t}\n\tint i=0;\n\twhile(c)\n\t{\n\t\ty[++i]=c%3;\n\t\tc/=3;\n\t}\n\n\ti = max(i,j);\n\tfor(int k=1;k<=i;k++)\n\t{\n\t\tx[k]=y[k]-x[k]+3;\n\t\tx[k]%=3;\n\t\tif(x[k])\n\t\t\tans += temp*x[k];\n\t\ttemp *=3;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) \\\n ({ __typeof__ (a) _a = (a); \\\n __typeof__ (b) _b = (b); \\\n _a > _b ? _a : _b; })\n\nint main()\n{\n\tint a,c;\n\tscanf(\"%d %d\",&a,&c);\n\tint ans=0,j=0,temp=1;\n\tint x[30],y[30];\n\twhile(a)\n\t{\n\t\tx[++j] = a%3;\n\t\ta /= 3;\n\t}\n\tint i=0;\n\twhile(c)\n\t{\n\t\ty[++i]=c%3;\n\t\tc/=3;\n\t}\n\n\ti = max(i,j);\n\tfor(int k=1;k<=i;k++)\n\t{\n\t\tx[k]=y[k]-x[k]+3;\n\t\tx[k]%=3;\n\t\tif(x[k])\n\t\t\tans += temp*x[k];\n\t\ttemp *=3;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}], "src_uid": "5fb635d52ddccf6a4d5103805da02a88"} {"nl": {"description": "Little girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copybooks for each of the subjects. There are three types of copybook's packs in the shop: it is possible to buy one copybook for a rubles, a pack of two copybooks for b rubles, and a pack of three copybooks for c rubles. Alyona already has n copybooks.What is the minimum amount of rubles she should pay to buy such number of copybooks k that n\u2009+\u2009k is divisible by 4? There are infinitely many packs of any type in the shop. Alyona can buy packs of different type in the same purchase.", "input_spec": "The only line contains 4 integers n, a, b, c (1\u2009\u2264\u2009n,\u2009a,\u2009b,\u2009c\u2009\u2264\u2009109).", "output_spec": "Print the minimum amount of rubles she should pay to buy such number of copybooks k that n\u2009+\u2009k is divisible by 4.", "sample_inputs": ["1 1 3 4", "6 2 1 1", "4 4 4 4", "999999999 1000000000 1000000000 1000000000"], "sample_outputs": ["3", "1", "0", "1000000000"], "notes": "NoteIn the first example Alyona can buy 3 packs of 1 copybook for 3a\u2009=\u20093 rubles in total. After that she will have 4 copybooks which she can split between the subjects equally. In the second example Alyuna can buy a pack of 2 copybooks for b\u2009=\u20091 ruble. She will have 8 copybooks in total.In the third example Alyona can split the copybooks she already has between the 4 subject equally, so she doesn't need to buy anything.In the fourth example Alyona should buy one pack of one copybook."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\n long long int n,a,b,c,m=0,i,y;\n long long int x[3];\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\n m=n%4;\n\n if(m==3){\n x[0]=a;\n x[1]=3*c;\n x[2]=b+c;\n }\n else if(m==2){\n x[0]=2*a;\n x[1]=b;\n x[2]=2*c;\n }\n else if(m==1){\n x[0]=3*a;\n x[1]=c;\n x[2]=a+b;\n }\n else {\n x[0]=0;\n x[1]=0;\n x[2]=0;\n }\n y=x[0];\n for(i=0;i<3;++i){\n if(y>x[i]){\n y=x[i];\n }\n }\n printf(\"%lld\\n\",y);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long Min(long long a, long long b)\n{\n if(a < b) {\n return a;\n }\n return b;\n}\n\nint main()\n{\n int n, a, b, c;\n long long Ans;\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n if(n % 4 == 0) {\n Ans = 0;\n } else if(n % 4 == 1) {\n Ans = Min((long long)a * 3, (long long)c);\n Ans = Min(Ans, (long long)a + (long long)b);\n Ans = Min(Ans, (long long)a + (long long)c * 2);\n Ans = Min(Ans, (long long)b + (long long)c * 3);\n } else if(n % 4 == 2) {\n Ans = Min((long long)a * 2, (long long)b);\n Ans = Min(Ans, (long long)c * 2);\n } else {\n Ans = Min((long long)a, (long long)c * 3);\n Ans = Min(Ans, (long long)b + (long long)c);\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tlong long int n,a,b,c,temp;\n\tint remainder;\n\tscanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n\tremainder = (int)(n % 4);\n\tif (remainder == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse if (remainder == 3)\n\t{\n\t\ttemp = b + c > a ? a : b + c;\n\t\tprintf(\"%lld\\n\", temp > 3 * c ? 3 * c : temp);\n\t}\n\telse if (remainder == 2)\n\t{\n\t\ttemp = 2 * a > b ? b : 2 * a;\n\t\tprintf(\"%lld\\n\", temp > 2 * c ? 2 * c : temp);\n\t}\n\telse if (remainder == 1)\n\t{\n\t\ttemp = 3 * a > c ? c : 3 * a;\n\t\tprintf(\"%lld\\n\", temp > a + b ? a + b : temp);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",ins);\n\n }\n else if(n%4==3)\n {\n ins=min(a,b+c);\n ans=min(ins,3*c);\n for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long INT64;\n\nINT64 min(INT64 a, INT64 b) {\n return (a < b) ? a : b;\n}\n\nint main(void) {\n INT64 n = 0, a = 0, b = 0, c = 0;\n INT64 i = 0, j = 0, k = 0;\n INT64 result = 0;\n \n scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n if (n % 4 == 0) {\n printf(\"0\\n\");\n } else {\n if (n % 4 == 1) {\n result = a * 3;\n result = min(result, a + b);\n result = min(result, c);\n result = min(result, b * 3 + a);\n } else if (n % 4 == 2) {\n result = min(a * 2, b);\n result = min(result, 2 * c);\n } else if (n % 4 == 3) {\n result = a;\n result = min(result, b + c);\n result = min(result, c * 3);\n }\n \n printf(\"%lld\\n\", result);\n }\n \n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define M exit (0);\nint main()\n{ long long int n,a,b,c;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\n\n if(n%4==0)\n {printf(\"0\");\n M;\n }\n \n if(n%4==1)\n {if((c<=3*a)&&(c<=a+b))\n {printf(\"%d\",c);\n M;\n\t}\n else if((a+b<=c)&&(b<=2*a))\n {printf(\"%d\",a+b);\n M;\n\t }\t\n else\n {printf(\"%d\",3*a);\n M;\n\t }\t \n }\n \n if(n%4==2)\n { if((b<=2*a)&&(b<=2*c))\n { printf(\"%d\",b);\n M;\n\t }\n\telse if((2*a<=b)&&(a<=c))\n\t {printf(\"%d\",2*a);\n\t M;\n\t } \n\telse\n\t {printf(\"%d\",2*c);\n\t M;\n\t } \n }\n \n if(n%4==3)\n { if((a<=3*c)&&(a<=b+c))\n {printf(\"%d\",a);\n M;\n\t }\n\telse if((3*c<=a)&&(2*c<=b))\n\t {printf(\"%d\",3*c);\n\t M;\n\t\t }\n\telse\n\t {printf(\"%d\",c+b);\n\t M;\n\t }\t \n }\n \n \nreturn 0; \n}"}, {"source_code": "#include<stdio.h>\nlong int f(long int a,long int b){\n\tif (a<=b/3) return 3*a;\n\telse return b;\n}\nlong int min (long int a,long int b){\n\tif(a<b) return a;\n\telse return b;\n}\nint main(){\n\tlong int n,a,b,c;\n\tscanf(\"%ld%ld%ld%ld\",&n,&a,&b,&c);\n\tn = n%4;\n\t//printf(\"%ld\\n\",n );\n\tif (n==0) printf(\"0\");\n\tif (n==3) printf(\"%ld\\n\",(min(f(c,a),(b+c))) );;\n\tif(n==2) printf(\"%ld\\n\",(min(min(2*a,2*c),b)) );;\n\tif (n==1) printf(\"%ld\\n\",(min(f(a,c),(a+b))) );;\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,a,b,c,i,x,y,z,w;\n int nn,aa,bb,cc;\n\tscanf(\"%d%d%d%d\",&nn,&aa,&bb,&cc);\n n=nn;\n a=aa;\n b=bb;\n c=cc;\n\tif(b>2*a)\n\t\tb=2*a;\n\tif(3*a<c)\n\t\tc=3*a;\n\tif(c>a+b)\n\t\tc=a+b;\nlong long int m[100];\n\tlong long int to_buy;\n\tto_buy=4-(n%4);\n // printf(\"to_buy= %d\\n\",to_buy);\n\tif(n%4==0)\n\t\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tm[0]=0;\n\t\tm[1]=a;\n\t\tm[2]=b;\n\t\tm[3]=c;\n\t\tfor(i=4;i<100;i++)\n\t\t{\n\t\t\tx=m[i-3]+c;\n\t\t\ty=m[i-2]+b;\n\t\t\tz=m[i-1]+a;\n\t\t\tif(x<y)\n\t\t\t\tw=x;\n\t\t\telse\n\t\t\t\tw=y;\n\t\t\tif(z<w)\n\t\t\t\tw=z;\n\t\t\tm[i]=w;\n \n\n\t\t}\n\t\tlong long int min;\n\t\tmin=pow(10,15);\n\t\tfor(i=1;i<100;i++)\n\t\t{\n\t\t\tif(i%4==to_buy && m[i]<min)\n\t\t\t\tmin=m[i];\n\t\t}\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tlong long int req,i,sum[3],min;\n\t\n\treq=4-(n%4);\n\t\n\n\t\n\tif(req==1)\n\t{\n\tsum[0]=a;\n\tsum[1]=3*c;\n\tsum[2]=b+c;\n\n\tmin=sum[0];\t\n\t\tfor(i=0;i<=2;i++)\n\t\t{\n\t\t\tif(sum[i]<min)\n\t\t\t{ \n\t\t\t\tmin=sum[i];\n\t\t\t}\n\t\t}\n\t\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\tif(req==2)\n\t{\n\t\tsum[0]=b;\n\t\tsum[1]=2*a;\n\t\tsum[2]=2*c;\n\tmin=sum[0];\t\n\t\tfor(i=0;i<=2;i++)\n\t\t{\n\t\t\tif(sum[i]<min)\n\t\t\t{ \n\t\t\t\tmin=sum[i];\n\t\t\t}\n\t\t}\n\t\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\tif(req==3)\n\t{\n\t\tsum[0]=3*a;\n\t\tsum[1]=c;\n\t\tsum[2]=b+a;\nmin=sum[0];\n\t\tfor(i=0;i<=2;i++)\n\t\t{\n\t\t\tif(sum[i]<min)\n\t\t\t{\n\t\t\t\tmin=sum[i];}\n\t\t}\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\tif(req==4)\n\t\tprintf(\"0\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "/* Codeforces Round #381 (Div. 2). Problem A, by Abreto. */\n#include <stdio.h>\n\n#define MIN(a, b) (((a)<(b))?(a):(b))\n\nint main(void)\n{\n long long int n = 0, a = 0, b = 0, c = 0;\n long long int minimum_rubles = 0;\n\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n switch( n % 4 )\n {\n case 0:\n minimum_rubles = 0;\n break;\n case 3: /* buy one or (two + three) or three * 3 */\n minimum_rubles = MIN(a, MIN(b+c, c * 3));\n break;\n case 2: /* buy one*2 or two or three * 2 or (three+two+one) */\n minimum_rubles = MIN(a*2, MIN(b, MIN(c*2,a+b+c)));\n break;\n case 1: /* buy one * 3 or (two+one) or three */\n minimum_rubles = MIN(a*3, MIN(a+b, c));\n break;\n default:\n break;\n }\n\n printf(\"%I64d\\n\", minimum_rubles);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",ins);\n\n }\n else if(n%4==3)\n {\n ins=min(a,b+c);\n ans=min(ins,3*c);\n for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,a,b,c;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\n long long int remain;\n long long int test;\n if(n % 4 != 0){\n test = (n / 4);\n test = (test + 1) * 4;\n remain = test - n;\n }\n else\n remain = 0;\n\n if( remain == 0)\n {\n printf(\"0\");\n return 0;\n }\n if( remain == 2)\n {\n long long int temp1 , temp2, temp3;\n temp1 = remain * a;\n temp2 = (remain/2) * b;\n temp3 = 2 * c;\n\n if( temp1 < temp2 && temp1 < temp3)\n printf(\"%I64d\",temp1);\n else if( temp2 < temp1 && temp2 < temp3)\n printf(\"%I64d\",temp2);\n else\n printf(\"%I64d\",temp3);\n return 0;\n }\n\n if( remain == 3)\n {\n long long int temp1 , temp2 , temp3;\n temp1 = remain * a;\n temp2 = (remain/3) * c;\n temp3 = a+b;\n if( temp1 < temp2 && temp1 < temp3)\n printf(\"%I64d\",temp1);\n else if( temp2 < temp1 && temp2 < temp3)\n printf(\"%I64d\",temp2);\n else\n printf(\"%I64d\",temp3);\n return 0;\n }\n if( remain == 1)\n {\n long long int temp1 , temp2,temp3;\n temp1 = a;\n temp2 = 3 * c;\n temp3 = b + c;\n if( temp1 < temp2 && temp1 < temp3)\n printf(\"%I64d\",temp1);\n else if( temp2 < temp1 && temp2 < temp3)\n printf(\"%I64d\",temp2);\n else\n printf(\"%I64d\",temp3);\n return 0;\n}\n}"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nmain()\n{\n\tlong long int m,a,b,c,p,x,y,z,n;\n\tscanf(\"%lld%lld%lld%lld\",&m,&a,&b,&c);\n\tp=4-m%4;\n\tif(p==3)\n\t{\n\t\tx=3*a;\n\t\ty=b+a;\n\t\tz=c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==2)\n\t{\n\t\tx=2*a;\n\t\ty=b;\n\t\tz=2*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==1)\n\t{\n\t\tx=1*a;\n\t\ty=b+c;\n\t\tz=3*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==4)\n\t{\n\t\tprintf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n long long int n,a,b,c,m=0,i,y;\n long long int x[3];\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\n m=n%4;\n\n if(m==3){\n x[0]=a;\n x[1]=3*c;\n x[2]=b+c;\n }\n else if(m==2){\n x[0]=2*a;\n x[1]=b;\n x[2]=2*c;\n }\n else if(m==1){\n x[0]=3*a;\n x[1]=c;\n x[2]=a+b;\n }\n else {\n x[0]=0;\n x[1]=0;\n x[2]=0;\n }\n y=x[0];\n for(i=0;i<3;++i){\n if(y>x[i]){\n y=x[i];\n }\n }\n printf(\"%lld\\n\",y);\n}\n"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) (a>b?b:a)\n#define Min(a,b,c) MIN(MIN(a,b),c)\nmain()\n{\n\tlong long int x,n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tx=n%4;\n\tswitch(x)\n\t{\n\t\tcase 1:printf(\"%lld\",Min(3*a,c,a+b));\n\t\tbreak;\n\t\tcase 2:printf(\"%lld\",Min(2*a,b,2*c));\n\t\tbreak;\n\t\tcase 3:printf(\"%lld\",Min(a,b+c,3*c));\n\t\tbreak;\n\t\tdefault:printf(\"0\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nlong long min(long long a,long long b,long long c)\n{\n return ((a<b?a:b)<c)?(a<b?a:b):c;\n}\nint main()\n{\n long long n,a,b,c;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n if(n%4==3)printf(\"%I64d\\n\",min(a,b+c,3*c));\n else if(n%4==2)printf(\"%I64d\\n\",min(2*a,b,2*c));\n else if(n%4==1)printf(\"%I64d\\n\",min(3*a,a+b,c));\n else printf(\"0\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,a,b,c;\n\tint k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\tprintf(\"0\");\n\telse\n\t{ long long sum;\n\t\tk=4-n%4;\n\t\tif(k==1)\n\t\t{ sum=a;\n\t\t\tif(b+c<sum)sum=b+c;\n\t\t\tif(3*c<sum)sum=3*c;\n\t\t}\n\t\tif(k==2)\n\t\t{ sum=2*a;\n\t\t if(b<sum)sum=b;\n\t\t if(2*c<sum)sum=2*c;\n\t\t}\n\t\tif(k==3)\n\t\t{\n\t\t\tsum=3*a;\n\t\t\tif(a+b<sum)sum=a+b;\n\t\t\tif(c<sum)sum=c;\n\t\t\tif(2*b+c<sum)sum=2*b+c;\n\t\t\tif(2*c+a<sum)sum=2*c+a; \n\t\t}\n\t\tprintf(\"%lld\",sum);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long n,a,b,c,i,j;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n if(n%4==0)\n printf(\"0\\n\");\n else\n {\n i=n%4;\n if(i==1)\n {\n if((3*a)<=c&&(3*a)<=b+a)\n printf(\"%lld\\n\",3*a);\n else if(b+a<=c)\n printf(\"%lld\\n\",b+a);\n else\n printf(\"%lld\\n\",c);\n\n }\n else if(i==2)\n {\n if((2*a)<=b&&(2*a)<=2*c)\n printf(\"%lld\\n\",2*a);\n else if((2*a)>b&&b<=2*c)\n printf(\"%lld\\n\",b);\n else\n printf(\"%lld\\n\",2*c);\n }\n else if(i==3)\n {\n if(a<=3*c&&a<=b+c)\n printf(\"%lld\\n\",a);\n else if(b+c<=a&&b+c<=3*c)\n printf(\"%lld\\n\",b+c);\n else\n printf(\"%lld\\n\",3*c);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a, long long int b){\n\treturn a<b?a:b;\n}\nmain(){\n\tlong long int n,a,b,c,k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n//\tint mcost;\n\t\n\tk=4-n%4;\n \n\tif(k==1)\n\t\tprintf(\"%lld\",min(a, min(b + c, c * 3)));\n\telse if(k==2)\n\t\tprintf(\"%lld\",min(a * 2, min(b, c * 2)));\n\telse if(k==3)\n\t\tprintf(\"%lld\",min(min(3*a,b+a),c));\n\telse\n\t\tprintf(\"0\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) (((a) < (b)) ? (a) : (b))\nint main()\n{\nlong long int n,a,b,c,total=1000000000;\nscanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\t\nfor(int i=0;i<=3;i++)\n\tfor(int j=0;j<=3;j++)\n\t\tfor(int y=0;y<=3;y++)\n\t\t{\n\t\t\tif( (i*1 + j*2 + y*3 + n)%4==0 )\n\t\t\ttotal=min(total,i*a+j*b+y*c);\n\t\t}\n\t\tprintf(\"%I64d\",total);\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n {\n unsigned int n;\n unsigned int a;\n unsigned int b;\n unsigned int c;\n unsigned short m;\n unsigned int rmn;\n \n scanf (\"%u %u %u %u\",&n,&a,&b,&c);\n m = n%4;\n if (!m)\n rmn = 0;\n else if (m == 1)\n {\n rmn = 3*a;\n if (rmn > c)\n rmn = c;\n if (rmn > a+b)\n rmn = a+b;\n }\n else if (m == 2)\n {\n rmn = 2*a;\n if (rmn > b)\n rmn = b;\n if (rmn > 2*c)\n rmn = 2*c;\n }\n else\n {\n rmn = a;\n if (rmn > 3*c)\n rmn = 3*c;\n if (rmn > b+c)\n rmn = b+c;\n }\n printf (\"%u\\n\",rmn);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nunsigned int n,a,b,c;\nscanf(\"%d %d %d %d\",&n,&a,&b,&c);\nif(n%4==0)\nprintf(\"%d\",0);\nelse if(n%4==3)\n{\n unsigned int min,temp;\n unsigned int d=b+c;\n unsigned int e=3*c;\n temp = (a < d) ? a : d;\n min = (e < temp) ? e : temp;\n printf(\"%u\",min);\n}\nelse if(n%4==2)\n{\n unsigned int min,temp;\n unsigned int d=2*a;\n unsigned int e=2*c;\n temp = (b < d) ? b : d;\n min = (e < temp) ? e : temp;\n printf(\"%u\",min);\n}\nelse if(n%4==1)\n{\n unsigned int min,temp;\n unsigned int d=b+a;\n unsigned int e=3*a;\n temp = (c < d) ? c : d;\n min = (e < temp) ? e : temp;\n printf(\"%u\",min);\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define INF\t((long long) 8e18)\n\nint main() {\n\tint n, i, j, k, a, b, c;\n\tlong long cost;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &c);\n\tn %= 4;\n\tcost = INF;\n\tfor (i = 0; i <= 3; i++)\n\t\tfor (j = 0; j <= 3; j++)\n\t\t\tfor (k = 0; k <= 3; k++)\n\t\t\t\tif ((n + (long long) i * 1 + (long long) j * 2 + (long long) k * 3) % 4 == 0)\n\t\t\t\t\tif (cost > (long long) i * a + (long long) j * b + (long long) k * c)\n\t\t\t\t\t\tcost = (long long) i * a + (long long) j * b + (long long) k * c; \n\tprintf(\"%lld\\n\", cost);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long money(long long ,long long ,long long,long long ,long long);\nint main()\n{\n\tlong long n;long long b;long long c;long long k;long long a;long long temp;long long min;int l;l=1;min=10000000000;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tk=0;\n\t\n\t\n\tif(n%4==0){\n\tmin=money(n,0,a,b,c);printf(\"%lld\\n\",min);exit(0);}\n\t\n\t\n\twhile(l<=10)\n\t{\n\t\tk++;\n\t\tif((n+k)%4==0)\n\t\t{\n\t\t\ttemp=money(n,k,a,b,c);\n\t\tl++;\n\t\t}\n\t\t\n\t\tif(temp<min)\n\t\t\tmin=temp;\n\t}\n\tprintf(\"%lld\\n\",min);\nreturn (0);\n}\n\n\tlong long money(long long n,long long k,long long a,long long b,long long c)\n\t{\n\t\tlong long cost;long long i;long long cost1=0;long long cost2=0;long long cost3=0;\n\t\t\n\tif(k==0)\n\t\treturn 0;\n\t\n\telse if(k==1)\n\t\treturn a;\n\t\n\telse\n\t{\n\t\tfor(i=0;i<k;i++)\n\t\t\tcost1=cost1+a;\n\t\t\n\t\tfor(i=0;i<k/2;i++)\n\t\t\tcost2=cost2+b;\n\t\tif(k%2!=0)\n\t\t\tcost2=cost2+a;\n\t\t\n\t\tfor(i=0;i<k/3;i++)\n\t\t\tcost3=cost3+c;\n\t\tif(k%3!=0)\n\t\t{\n\t\t\tif(k%3==1)\n\t\t\tcost2=cost2+a;\n\t\t\n\t\telse\n\t\t\tif(k%3==2)\n\t\t\tcost3=cost3+b;\n\t\t}\n\t\n\tif((cost1<=cost2)&&(cost1<=cost3))\n\t\tcost=cost1;\n\t\n\telse if((cost2<=cost1)&&(cost2<=cost3))\n\t\tcost=cost2;\n\t\n\telse\n\tcost=cost3;\n\t\n\treturn cost;}\n\t\n}\n\t\t\t"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long n,a,b,c;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tint t;\n\tt=4-n%4;\n\t\n\tif(t==4) {printf(\"0\"); return 0;}\n\t\n\tlong long count,count1,count2,min;\n\t\n\tif(t==1) {count=a;\n\t\t\t\tcount1=b+c;\n\t\t\t\tcount2=3*c;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif(count<count1) min=count;\n\telse min=count1;\n\t\n\tif(min<count2) printf(\"%lld\",min);\n\telse printf(\"%lld\",count2);\n\t\t\t\t\n\t\t\t\n\t}\n\t\n\t\n\t\n\t\n\tif(t==2){\n\t\tcount=2*a;\n\t\tcount1=b;\n\t\tcount2=2*c;\n\t\t\n\t\t\tif(count<count1) min=count;\n\telse min=count1;\n\t\n\tif(min<count2) printf(\"%lld\",min);\n\telse printf(\"%lld\",count2);\n\t}\n\t\n\tif(t==3)\n\t{count=3*a;\n\t\tcount1=a+b;\n\tcount2=c;\n\t\n\tif(count<count1) min=count;\n\telse min=count1;\n\t\n\tif(min<count2) printf(\"%lld\",min);\n\telse printf(\"%lld\",count2);\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) a<b?a:b\nint main()\n{\n long long n,a,b,c,min;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n n=4-(n%4);\n if(n==4)\n {\n printf(\"0\\n\");\n return 0;\n }\n if(n==1)\n {\n min=MIN(a,(b+c));\n min=MIN(min,(3*c));\n }\n else if(n==2)\n {\n min=MIN(b,(2*a));\n min=MIN(min,(2*c));\n }\n else\n {\n min=MIN(c,(3*a));\n min=MIN(min,(a+b));\n }\n printf(\"%lld\\n\",min);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\n\n#define MIN(a,b) (a<b)?a:b\n\nint main()\n{\n\tlong long n=0;\n\tlong long a[3]={0};\n//\tint r=0;\n//\tint t1=0,t2=0;;\n\tlong long i;\n//\tint b[]={1,2,3};\n\tscanf(\"%lld %lld %lld %lld\",&n,&a[0],&a[1],&a[2]);\n/*\tfor(i=1;i<3;i++)\n\t{\n\t\tt1=a[i];\n\t\tt2=b[i];\n\t\tj=i-1;\n\t\twhile(j>=0 && t<a[j])\n\t\t{\n\t\t\ta[j+1]=a[j];\n\t\t\tb[j+1]=b[j];\n\t\t\tj--;\n\t\t}\n\t\ta[j+1]=t1;\n\t\tb[j+1]=t2;\n\t}\n\n\tint z=4-(n%4);\n\n\ti=j=0;\n\tint ans=0;\n\twhile(z%4!=0)\n\t{\n\tif()\n\n\t\tans=(z/b[0])*a[0];\n\t\tz=z+b[0];\n\t}\n\t*/\n\n\tlong long z=(n%4);\n\tif(z!=0)\n\t\tz=4-z;\n\tlong long ans[30]={0};\n\t\n\tfor(i=1;i<30 ;i++)\n\t{\n\t\tans[i]=ans[i-1]+a[0];\n\t\tif(i>1)\n\t\t{\n\t\t\tif(ans[i-2]+a[1]<ans[i])\n\t\t\t\tans[i]=ans[i-2]+a[1];\n\t\t}\n\t\tif(i>2)\n\t\t{\n\t\t\tif(ans[i-3]+a[2]<ans[i])\n\t\t\t\tans[i]=ans[i-3]+a[2];\n\t\t}\n\t}\n\n\tlong long ansf=ans[z];\n\tfor(i=z;i<30;i++)\n\t{\n\t//\tprintf(\"\\n%lld\",ans[i]);\n\t\tif(ansf>ans[i] && (n+i)%4==0)\n\t\t\tansf=ans[i];\n\t}\n\tprintf(\"%lld\\n\",ansf);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define M exit (0);\nint main()\n{ long long int n,a,b,c;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\n\n if(n%4==0)\n {printf(\"0\");\n M;\n }\n \n if(n%4==1)\n {if((c<=3*a)&&(c<=a+b))\n {printf(\"%d\",c);\n M;\n\t}\n else if((a+b<=c)&&(b<=2*a))\n {printf(\"%d\",a+b);\n M;\n\t }\t\n else\n {printf(\"%d\",3*a);\n M;\n\t }\t \n }\n \n if(n%4==2)\n { if((b<=2*a)&&(b<=2*c))\n { printf(\"%d\",b);\n M;\n\t }\n\telse if((2*a<=b)&&(a<=c))\n\t {printf(\"%d\",2*a);\n\t M;\n\t } \n\telse\n\t {printf(\"%d\",2*c);\n\t M;\n\t } \n }\n \n if(n%4==3)\n { if((a<=3*c)&&(a<=b+c))\n {printf(\"%d\",a);\n M;\n\t }\n\telse if((3*c<=a)&&(2*c<=b))\n\t {printf(\"%d\",3*c);\n\t M;\n\t\t }\n\telse\n\t {printf(\"%d\",c+b);\n\t M;\n\t }\t \n }\n \n \nreturn 0; \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,a,b,c,d,p,k;\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n p=n%4;\n p=4-p;\n if(p==4)\n d=0;\n if(p==1)\n {\n d=(a+3*c-(abs(a-3*c)))/2;\n d=(d+b+c-(abs(d-(c+b))))/2;\n }\n \n if(p==2)\n {\n d=(2*a+b-(abs(2*a-b)))/2;\n d=(2*c+d-(abs(2*c-d)))/2;\n }\n if(p==3)\n {\n d=(3*a+c-(abs(3*a-c)))/2;\n k=a+b;\n d=(d+k-(abs(d-k)))/2;\n }\n printf(\"%d\",d);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() \n{\n\tlong long int n,a,b,c ;\n\t\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\t\n\tif(n % 4 == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse if(n %4 == 1)\n\t{\n\t\tlong long int temp = 3*a;\n\t\tif(temp > a + b) temp = a+b ;\n\t\tif(temp > c) temp = c ;\n\t\tprintf(\"%lld\\n\",temp);\n\t}\n\telse if(n%4 ==2)\n\t{\n\t\tlong long int temp = 2*a;\n\t\tif(temp > b) temp = b ;\n\t\tif(temp > 2*c) temp = 2*c ;\n\t\tprintf(\"%lld\\n\",temp);\t\t\n\t}\n\telse if (n%4 == 3)\n\t{\n\t\tlong long int temp = a;\n\t\tif(temp > 3*c) temp = 3*c ;\n\t\tif(temp > b + c) temp = b + c ;\n\t\tprintf(\"%lld\\n\",temp);\t\t\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<limits.h>\nlong long min(long long a,long long b,long long c)\n{\nif(a<b && a<c)\nreturn a;\nif(b<c)\nreturn b;\nreturn c;\n}\nint main()\n{\nlong long n,a,b,c,k;\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\nk=n%4;\nif(k==1)\nprintf(\"%lld\",min(3*a,b+a,c));\nelse if(k==1 && a>3*c)\nprintf(\"%lld\",3*c);\nelse if(k==2)\nprintf(\"%lld\",min(b,2*a,2*c));\nelse if(k==3)\nprintf(\"%lld\",min(a,b+c,3*c));\nelse\nprintf(\"0\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\nint n,a[5]={0};\nscanf(\"%d %d %d %d\",&n,&a[1],&a[2],&a[3]);\nif (a[3]+a[3]<a[1]-a[3]) a[1]=a[3]+a[3]+a[3];\nif (a[3]+a[2]<a[1]) a[1]=a[3]+a[2];\nif (a[3]+a[3]<a[2]) a[2]=a[3]+a[3];\nif (a[1]+a[1]<a[2]) a[2]=a[1]+a[1];\nif (a[1]+a[2]<a[3]) a[3]=a[1]+a[2];\na[4]=0;\nprintf(\"%d\\n\",a[4-n%4]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long MIN(long long a,long long b){return a<b?a:b;}\nint main(){\n int n,a,b,c,i;\n long long d[20]={};\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n for(i=1;i<20;i++)d[i]=1e18;\n d[1]=a;\n d[2]=MIN(a+a,b);\n for(i=3;i<10;i++)d[i]=MIN(d[i-1]+a,MIN(d[i-2]+b,d[i-3]+c));\n for(i=0;i<10;i++)d[i%4]=MIN(d[i%4],d[i]);\n printf(\"%lld\\n\",d[(4-n%4)%4]);\n return 0;\n}\n \n "}, {"source_code": "#include <stdio.h>\n#define Min(a, b) ( (a) < (b) ? (a):(b) )\n#define MIN(a, b, c) ( Min( Min(a,b), c ) )\n#define s(a)\t\tscanf(\"%I64d\", &a)\nint main() {\n\tlong long n, a, b, c;\n\tint x;\n\ts(n); s(a); s(b); s(c);\n\tx = n % 4;\n\tswitch (x) {\n\tcase(0): printf(\"0\"); break;\n\tcase(3): printf(\"%I64d\", MIN(a, 3 * c, b+c)); break;\n\tcase(2) : printf(\"%I64d\", MIN(2 * a, b, 2 * c)); break;\n\tcase(1): printf(\"%I64d\", MIN(3 * a, a+b, c)); break;\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define ll long long\n#define ld long int\n#define flush fflush(stdin)\n#define scl(a) scanf(\"%ld\",&a)\n#define scl2(a,b) scanf(\"%ld%ld\",&a,&b)\n#define scl3(a,b,c) scanf(\"%ld%ld%ld\",&a,&b,&c)\n#define sc(a) scanf(\"%lld\",&a)\n#define sc2(a,b) scanf(\"%lld%lld\",&a,&b)\n#define sc3(a,b,c) scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define pfln(a) printf(\"%ld\\n\",a)\n#define pfls(a) printf(\"%ld \",a)\n#define pfn(a) printf(\"%lld\\n\",a)\n#define pfs(a) printf(\"%lld \",a)\n#define rp(l,i,n) for(i=l;i<n;i++)\n#define rpd(n,i,l) for(i=n;i>=l;i--)\n\n\nint main(void) {\n ll n,a,b,c;\n sc(n);\n sc(a);\n sc(b);\n sc(c);\n if(n%4==0)\n printf(\"0\");\n else if(n%4==3)\n {\n if((a<3*c)&&(a<c+b)&&(a<2*b+a))\n printf(\"%lld\",a);\n else if((3*c<c+b)&&(3*c<2*b+a))\n printf(\"%lld\",3*c);\n else if((c+b<2*b+a))\n printf(\"%lld\",c+b);\n else\n printf(\"%lld\",2*b+a);\n }\n else if(n%4==2)\n {\n if(b<2*a && b<3*b && b<c*2 && b<c*3+a && b<5*b)\n printf(\"%lld\",b);\n else if (2*a<3*b && 2*a<c*2 && 2*a<c*3+a && 2*a<5*b)\n printf(\"%lld\",2*a);\n else if(3*b<c*2 && 3*b<c*3+a && 3*b<5*b)\n printf(\"%lld\",3*b);\n else if(c*2<c*3+a && c*2<5*b)\n printf(\"%lld\",c*2);\n else if(c*3+a<5*b)\n printf(\"%lld\",c*3+a);\n else\n printf(\"%lld\",5*b);\n }\n else if(n%4==1)\n {\n if(c<=3*a&&c<=(a+b)&&c<3*b+a&&c<2*c+a&&c<3*c+b)\n printf(\"%lld\",c);\n else if(3*a<(a+b) && 3*a<3*b+a && 3*a<2*c+a && 3*a<3*c+b)\n printf(\"%lld\",3*a);\n else if(a+b<3*b+a && a+b<2*c+a && a+b<3*c+b)\n printf(\"%lld\",a+b);\n else if(3*b+a<2*c+a && 3*b+a<3*c+b)\n printf(\"%lld\",3*b+a);\n else if(2*c+a<3*c+b)\n printf(\"%lld\",2*c+a);\n else\n printf(\"%lld\",3*c+b);\n }\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,a,b,c,i,j;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n i=n%4;\n i=(4-i)%4;\n switch(i)\n {\n case 0:printf(\"0\\n\");break;\n case 1:j=a<(b+c)?(a<(3*c)?a:(3*c)):((b+c)<(3*c)?(b+c):(3*c));\n printf(\"%lld\\n\",j);break;\n case 2:j=(b<(2*a))?(b<(2*c)?b:(2*c)):((2*a)<(2*c)?(2*a):(2*c));\n printf(\"%lld\\n\",j);break;\n case 3:j=(c<(a+b)?(c<(3*a)?c:(3*a)):((a+b)<(3*a)?(a+b):(3*a)));\n printf(\"%lld\\n\",j);break;\n }\n return 0;\n}\n\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,a,b,c;\n\tint k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\tprintf(\"0\");\n\telse\n\t{ long long sum;\n\t\tk=4-n%4;\n\t\tif(k==1)\n\t\t{ sum=a;\n\t\t\tif(b+c<sum)sum=b+c;\n\t\t\tif(3*c<sum)sum=3*c;\n\t\t}\n\t\tif(k==2)\n\t\t{ sum=2*a;\n\t\t if(b<sum)sum=b;\n\t\t if(2*c<sum)sum=2*c;\n\t\t}\n\t\tif(k==3)\n\t\t{\n\t\t\tsum=3*a;\n\t\t\tif(a+b<sum)sum=a+b;\n\t\t\tif(c<sum)sum=c;\n\t\t\tif(2*b+c<sum)sum=2*b+c;\n\t\t\tif(2*c+a<sum)sum=2*c+a; \n\t\t}\n\t\tprintf(\"%lld\",sum);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define INF\t((long long) 8e18)\n\nint main() {\n\tint n, i, j, k, a, b, c;\n\tlong long cost;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &c);\n\tn %= 4;\n\tcost = INF;\n\tfor (i = 0; i <= 3; i++)\n\t\tfor (j = 0; j <= 3; j++)\n\t\t\tfor (k = 0; k <= 3; k++)\n\t\t\t\tif ((n + (long long) i * 1 + (long long) j * 2 + (long long) k * 3) % 4 == 0)\n\t\t\t\t\tif (cost > (long long) i * a + (long long) j * b + (long long) k * c)\n\t\t\t\t\t\tcost = (long long) i * a + (long long) j * b + (long long) k * c; \n\tprintf(\"%lld\\n\", cost);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\ntypedef struct num{\nint index;\ndouble x;\nlong long money;\n}num;\nnum s1[10],s2[20];\nint main()\n{\n long long x,n,a,b,c,x1,x2,x3,min;\n while(scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c)!=EOF)\n {\n\t s1[0].money=a;s1[1].money=b;s1[2].money=c;\n\t\tif(n%4==0)x=0;\n\t\telse x=4-n%4;\n if(x==0)printf(\"0\\n\");\n else\n {\n\t\t\t if(x==1)\n\t\t\t {\n\t\t\t\t s2[0].money=s1[0].money;\n\t\t\t\t s2[1].money=s1[1].money+s1[2].money;\n\t\t\t\t s2[2].money=s1[2].money*3;\n\t\t\t\t min=s2[0].money;\n\t\t\t\t for(a=1;a<3;a++)\n\t\t\t\t\t if(s2[a].money<min)min=s2[a].money;\t\t\t\t\n\t\t\t printf(\"%lld\\n\",min);\n\t\t\t }\n\t\t\t else if(x==2)\n\t\t\t {\n\t\t\t\t s2[0].money=s1[0].money*2;\n\t\t\t\t s2[1].money=s1[1].money;\n\t\t\t\t s2[2].money=s1[2].money*2;\n\t\t\t\t min=s2[0].money;\n\t\t\t\t for(a=1;a<3;a++)\n\t\t\t\t\t if(s2[a].money<min)min=s2[a].money;\t\t\t\t\n\t\t\t\t printf(\"%lld\\n\",min);\n\t\t\t }\n\t\t\t else if(x==3)\n\t\t\t {\n\t\t\t\t x1=s1[0].money*3;\n\t\t\t\t x2=s1[0].money+s1[1].money;\n\t\t\t\t x3=s1[2].money;\n\t\t\t\t if(x1<=x2&&x1<=x3)printf(\"%lld\\n\",x1);\n\t\t\t\t else if(x2<=x1&&x2<=x3)printf(\"%lld\\n\",x2);\n else if(x3<=x1&&x3<=x2)printf(\"%lld\\n\",x3);\n\t\t\t }\n\t\t }\n }\n\t return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x, y) (((x) < (y)) ? (x) : (y))\n\nint main(void) {\n long long n = 0;\n long long a = 0;\n long long b = 0;\n long long c = 0;\n\n scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n\n long long r = 0;\n\n while ((n % 4) != 0) {\n if ((n % 2) == 0) {\n long long d = MIN(b, c * 2);\n r += MIN(d, a * 2);\n break;\n } else {\n long long tmp = (n + 1) % 4;\n if ((tmp % 4) == 0) {\n long long d = MIN(a, a + b * 2);\n d = MIN(d, b + c);\n r += MIN(d, 3 * c);\n break;\n } else {\n long long i = MIN(c, 3 * a);\n r += MIN(i, a + b);\n break;\n }\n }\n }\n\n printf(\"%d\\n\", r);\n return 0;\n}"}, {"source_code": "#include<stdio.h>//w11tfqq!!!\nint main()\n{\n long long int n,i,j,k,a[3],min,jk,jk1;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//tocheck wtf s hamigosprintf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n jk=a[1]+a[2];\n jk1=a[2]*3; \n if(jk<min)\n min=jk;\n if(jk1<min)\n min=jk1;\n}\nif(k==2)\n{\n \n a[0]=a[0]*2;\n a[2]=a[2]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n jk=a[0]+a[1];\n a[0]=a[0]*3;\n min=a[0];\n if(min>jk)\n min=jk;\n if(min>a[2])\n min=a[2];\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nmain()\n{\n\tlong long int m,a,b,c,p,x,y,z,n;\n\tscanf(\"%lld%lld%lld%lld\",&m,&a,&b,&c);\n\tp=4-m%4;\n\tif(p==3)\n\t{\n\t\tx=3*a;\n\t\ty=b+a;\n\t\tz=c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==2)\n\t{\n\t\tx=2*a;\n\t\ty=b;\n\t\tz=2*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==1)\n\t{\n\t\tx=1*a;\n\t\ty=b+c;\n\t\tz=3*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==4)\n\t{\n\t\tprintf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,rem,amt=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n rem=n%4;\n if(rem==1)\n {\n amt=(c<3*a)?c:(3*a);\n amt=(amt<a+b)?amt:(a+b);\n }\n else if(rem==2)\n {\n amt = (b<2*a)?b:(2*a);\n amt = (amt<2*c)?amt:(2*c);\n }\n else if(rem==3)\n {\n amt=(a<3*c)?a:(3 * c);\n amt=(amt<b+c)?amt:(b+c);\n }\n printf(\"%lld\",amt);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n long long int n,a,b,c,m=0,i,y;\n long long int x[3];\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\n m=n%4;\n\n if(m==3){\n x[0]=a;\n x[1]=3*c;\n x[2]=b+c;\n }\n else if(m==2){\n x[0]=2*a;\n x[1]=b;\n x[2]=2*c;\n }\n else if(m==1){\n x[0]=3*a;\n x[1]=c;\n x[2]=a+b;\n }\n else {\n x[0]=0;\n x[1]=0;\n x[2]=0;\n }\n y=x[0];\n for(i=0;i<3;++i){\n if(y>x[i]){\n y=x[i];\n }\n }\n printf(\"%lld\\n\",y);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,k,s,s1,s2,s3;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n if(n%4==0)\n {\n s=0;\n }\n else if(n%4==1)\n {\n s1=3*a;\n s2=a+b;\n s3=c;\n if(s1<=s2&&s1<=s3)\n {\n s=s1;\n }\n else if(s2<=s1&&s2<=s3)\n {\n s=s2;\n }\n else\n {\n s=s3;\n }\n }\n else if(n%4==2)\n {\n s1=2*a;\n s2=b;\n s3=2*c;\n if(s1<=s2&&s1<=s3)\n {\n s=s1;\n }\n else if(s2<=s1&&s2<=s3)\n {\n s=s2;\n }\n else\n {\n s=s3;\n }\n }\n else\n {\n s1=a;\n s2=b+c;\n s3=3*c;\n if(s1<=s2&&s1<=s3)\n {\n s=s1;\n }\n else if(s2<=s1&&s2<=s3)\n {\n s=s2;\n }\n else\n {\n s=s3;\n }\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define min(a,b) ((a)<(b) ? (a):(b))\n\nint main(void){\n long long n,a,b,c;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n if(n%4==0)\n \tprintf(\"0\\n\");\n else if(n%4==1)\n \tprintf(\"%I64d\\n\",min(c,min(a+b,3*a)));\n else if(n%4==2)\n \tprintf(\"%I64d\\n\",min(b,min(c<<1,a<<1)));\n else\n \tprintf(\"%I64d\\n\",min(a,min(b+c,3*c)));\n return 0;\n}"}, {"source_code": "\n #include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c,p,q,r,min;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse if(n%4==1)\n\t{\n\t\tp=3*a;\n\t\tq=a+b;\n\t\tr=c;\n\t}\n\telse if(n%4==2)\n\t{\n\t\tp=2*a;\n\t\tq=b;\n\t\tr=2*c;\n\t}\n\telse if(n%4==3)\n\t{\n\t\tp=a;\n\t\tq=b+c;\n\t\tr=3*c;\n\t}\n\tif((p<=q)&&(p<=r))\n\tmin=p;\n\telse if((q<=p)&&(q<=r))\n\tmin=q;\n\telse\n\tmin=r;\n\tif((n%4)!=0) \n\tprintf(\"%lld\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n\tlong long int n,a,b,c,temp;\n\tint remainder;\n\tscanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n\tremainder = (int)(n % 4);\n\tif (remainder == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse if (remainder == 3)\n\t{\n\t\ttemp = b + c > a ? a : b + c;\n\t\tprintf(\"%lld\\n\", temp > 3 * c ? 3 * c : temp);\n\t}\n\telse if (remainder == 2)\n\t{\n\t\ttemp = 2 * a > b ? b : 2 * a;\n\t\tprintf(\"%lld\\n\", temp > 2 * c ? 2 * c : temp);\n\t}\n\telse if (remainder == 1)\n\t{\n\t\ttemp = 3 * a > c ? c : 3 * a;\n\t\tprintf(\"%lld\\n\", temp > a + b ? a + b : temp);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned int ui;\nui min3(ui a, ui b, ui c)\n{\n return a>b?(b<c?b:c):(a<c?a:c);\n}\nmain()\n{\n ui n, a, b, c;\n scanf(\"%u%u%u%u\",&n,&a,&b,&c);\n switch(n%4)\n {\n case 0: printf(\"0\");\n break;\n case 1: printf(\"%u\",min3(3*a,a+b,c));\n break;\n case 2: printf(\"%u\",min3(2*a,b,2*c));\n break;\n case 3: printf(\"%u\",min3(a,c+b,3*c));\n break;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int books,pack1,pack2,pack3;\n scanf(\"%lld %lld %lld %lld\",&books,&pack1,&pack2,&pack3);\n long long int less,one,two;\n less=4-(books%4);\n if(less == 1)\n {\n one=3*pack3;\n two=pack2+pack3;\n if(two< pack1 && two<one)\n printf(\"%lld\\n\",two);\n else if(one<two && one<pack1)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",pack1);\n }\n else if(less == 2)\n {\n one=less*pack1;\n two=pack3*2;\n if(pack2<one && pack2<two)\n printf(\"%lld\\n\",pack2);\n else if(one<pack2 && one<two)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",two);\n\n }\n else if(less==3)\n {\n one=less*pack1;\n two=pack2+pack1;\n if(two<one && two<pack3)\n printf(\"%lld\\n\",two);\n else if(one<two && one<pack3)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",pack3);\n }\n else if(less == 4)\n printf(\"0\\n\");\n return 0;\n}\n"}, {"source_code": "\n #include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c,p,q,r,min;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse if(n%4==1)\n\t{\n\t\tp=3*a;\n\t\tq=a+b;\n\t\tr=c;\n\t}\n\telse if(n%4==2)\n\t{\n\t\tp=2*a;\n\t\tq=b;\n\t\tr=2*c;\n\t}\n\telse if(n%4==3)\n\t{\n\t\tp=a;\n\t\tq=b+c;\n\t\tr=3*c;\n\t}\n\tif((p<=q)&&(p<=r))\n\tmin=p;\n\telse if((q<=p)&&(q<=r))\n\tmin=q;\n\telse\n\tmin=r;\n\tif((n%4)!=0) \n\tprintf(\"%lld\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nmain()\n{\n\tlong long int m,a,b,c,p,x,y,z,n;\n\tscanf(\"%lld%lld%lld%lld\",&m,&a,&b,&c);\n\tp=4-m%4;\n\tif(p==3)\n\t{\n\t\tx=3*a;\n\t\ty=b+a;\n\t\tz=c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==2)\n\t{\n\t\tx=2*a;\n\t\ty=b;\n\t\tz=2*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==1)\n\t{\n\t\tx=1*a;\n\t\ty=b+c;\n\t\tz=3*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==4)\n\t{\n\t\tprintf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nlong long MIN(long long a,long long b){return a<b?a:b;}\nint main(){\n int n,a,b,c,i;\n long long d[20]={};\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n for(i=1;i<20;i++)d[i]=1e18;\n d[1]=a;\n d[2]=MIN(a+a,b);\n for(i=3;i<10;i++)d[i]=MIN(d[i-1]+a,MIN(d[i-2]+b,d[i-3]+c));\n for(i=0;i<10;i++)d[i%4]=MIN(d[i%4],d[i]);\n printf(\"%lld\\n\",d[(4-n%4)%4]);\n return 0;\n}\n \n "}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nlong long unsigned int min(long long unsigned int a, long long unsigned int b)\n{\n if (a < b)\n return(a);\n return(b);\n}\n\nint main(void)\n{\n\tlong long unsigned int n, a, b, c;\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n\n\tlong long unsigned int k = n % 4;\n\n\tif (k == 0)\n return(0) * printf(\"0\");\n\n if (k == 3)\n return(0) * printf(\"%I64d\", min(min(a, 3 * c), c + b));\n\n if (k == 2)\n return(0) * printf(\"%I64d\", min(min(2 * a, b), 2 * c));\n\n if (k == 1)\n return(0) * printf(\"%I64d\", min(min(3 * a, b + a), c));\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,k,x=0,y=0,z=0;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n k=4-(n%4);\n if(k==1)\n {\n x=a;\n y=b+c;\n z=3*c;\n }\n else if(k==2)\n {\n x=b;\n y=2*a;\n z=2*c;\n }\n else if(k==3)\n {\n x=c;\n y=3*a;\n z=a+b;\n }\n if(k==4)\n printf(\"0\");\n else if(x<=y&&x<=z)\n printf(\"%I64d\",x);\n else if(y<=x&&y<=z)\n printf(\"%I64d\",y);\n else if(z<=x&&z<=y)\n printf(\"%I64d\",z);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n unsigned long long int n,a,b,c,k=0,m1,m2,m3,m4,m5;\n scanf(\"%llu%llu%llu%llu\",&n,&a,&b,&c);\n while(1)\n {\n if((n+k)%4==0)break;\n else k++;\n }\n if(k==0)printf(\"0\\n\");\n else if(k==1)\n {\n m1=a;m2=(3*c);m3=b+c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n else if(k==2)\n {\n m1=2*a;m2=b;m3=2*c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n else if(k==3)\n {\n m1=3*a;m2=a+b;m3=c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,a,b,c;\n while(scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c)==4)\n {\n\n if(n%4==0&&n!=0)\n printf(\"0\\n\");\n else if(n==0)\n {\n if(4*a<=2*b&&4*a<=c+a)\n printf(\"%I64d\\n\",4*a);\n else if(2*b<=c+a)\n printf(\"%I64d\\n\",2*b);\n else\n printf(\"%I64d\\n\",c+a);\n }\n else if(n%4==1||n==1)\n {\n if(3*a<=b+a && 3*a<=c)\n printf(\"%I64d\\n\",3*a);\n else if(b+a<=c)\n printf(\"%I64d\\n\",b+a);\n else\n printf(\"%I64d\\n\",c);\n }\n else if(n%4==2)\n {\n if(2*a<=b&&2*a<=c+c)\n printf(\"%I64d\\n\",2*a);\n else if(b<=c+c)\n printf(\"%I64d\\n\",b);\n else\n printf(\"%I64d\\n\",c+c);\n }\n else if(n%4==3)\n {\n if(a<=b+c&&a<=3*c)\n printf(\"%I64d\\n\",a);\n else if(b+c<=3*c)\n printf(\"%I64d\\n\",b+c);\n else\n printf(\"%I64d\\n\",3*c);\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int min(long long int a, long long int b)\n{\n\tif(a>b)\n\t\treturn b;\n\telse\n\t\treturn a;\n}\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tlong long int z=4-n%4;\n\tlong long int l;\n\t//printf(\"%lld\",z);\n\tif(z==3)//n=1\n\t{\n\t\tl= min((3*a),c);\n\t\tl= min(l,(a+b));\n\t\tl=min(l,(2*b+c));\n\t}\n\tif(z==2)//n=2\n\t{\n\t\tl=min(2*a,b);\n\t\tl=min(l,2*c);\n\t}\n\tif(z==1)//n=3\n\t{\n\t\tl=min((b+c),a);\n\t\tl=min(3*c,l);\n\t}\n\tif(z==4)\n\t{\n\t\tl=0;\n\t}\n\tprintf(\"%lld\\n\",l);\n\treturn 0;\t\t\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min( long long int a,long long int b,long long int c)\n{\n\tlong long int min=a;\n\tif(min>b)\n\t\tmin=b;\n\tif(min>c)\n\t\tmin=c;\t\n\treturn min;\t\t\n}\n\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\");\n\telse if(n%4==1)\n\t{\n\t\tprintf(\"%lld\",min(3*a,a+b,c));\n\t}\n\telse if(n%4==2)\n\t{\n\t\tprintf(\"%lld\",min(2*a,b,2*c));\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\",min(a,b+c,3*c));\n\t}\t\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int books,pack1,pack2,pack3;\n scanf(\"%lld %lld %lld %lld\",&books,&pack1,&pack2,&pack3);\n long long int less,one,two;\n less=4-(books%4);\n if(less == 1)\n {\n one=3*pack3;\n two=pack2+pack3;\n if(two< pack1 && two<one)\n printf(\"%lld\\n\",two);\n else if(one<two && one<pack1)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",pack1);\n }\n else if(less == 2)\n {\n one=less*pack1;\n two=pack3*2;\n if(pack2<one && pack2<two)\n printf(\"%lld\\n\",pack2);\n else if(one<pack2 && one<two)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",two);\n\n }\n else if(less==3)\n {\n one=less*pack1;\n two=pack2+pack1;\n if(two<one && two<pack3)\n printf(\"%lld\\n\",two);\n else if(one<two && one<pack3)\n printf(\"%lld\\n\",one);\n else\n printf(\"%lld\\n\",pack3);\n }\n else if(less == 4)\n printf(\"0\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>//wtf!!!\nint main()\n{\n long long int n,i,j,k,a[3],min,jk,jk1;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//printf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n jk=a[1]+a[2];\n jk1=a[2]*3; \n if(jk<min)\n min=jk;\n if(jk1<min)\n min=jk1;\n}\nif(k==2)\n{\n \n a[0]=a[0]*2;\n a[2]=a[2]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n jk=a[0]+a[1];\n a[0]=a[0]*3;\n min=a[0];\n if(min>jk)\n min=jk;\n if(min>a[2])\n min=a[2];\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\n\nll int min(ll int a,ll int b){ return a < b ? a : b ;}\n\nint main(){\n ll int n, a, b, c; scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n n %= 4; if(!n){ printf(\"0\\n\"); return 0; }\n if(n == 1) printf(\"%lld\\n\", min(min(3 * a, a + b), c));\n else if(n == 2) printf(\"%lld\\n\", min(min(2 * a, b), 2 * c));\n else if(n == 3) printf(\"%lld\\n\", min(min(a, c + b), 3 * c));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long mins(long long a,long long b,long long c){\n long long d;\n d=a>b?b:a;\n return d>c?c:d;\n}\nint main(){\n long long n,a,b,c;\n while(scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c)!=EOF){\n if(n%4==0){\n printf(\"0\\n\");\n continue;\n }\n int k=4-n%4;\n if(k==1){\n printf(\"%lld\\n\",mins(a,b+c,3*c));\n }\n if(k==2){\n printf(\"%lld\\n\",mins(2*a,b,2*c));\n }\n if(k==3){\n printf(\"%lld\\n\",mins(3*a,b+a,c));\n }\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t//https://codeforces.com/contest/740/problem/A\n\tlong long int a,b,c,n,d,min=1000000000;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld\",&a);\n\tscanf(\"%lld\",&b);\n\tscanf(\"%lld\",&c);\n\tif(n%4!=0)\n\t{\n\t\td=4-(n%4);\n\t\tif(d==3)\n\t\t{\n\t\t\tif(c<=min)\n\t\t\t{\n\t\t\t\tmin=c;\n\t\t\t}\n\t\t\tif((b+a)<=min)\n\t\t\t{\n\t\t\t\tmin=(b+a);\n\t\t\t}\n\t\t\tif(3*a<=min)\n\t\t\t{\n\t\t\t\tmin=(3*a);\n\t\t\t}\n\t\t\tprintf(\"%lld\",min);\n\t\t}\n\t\telse if(d==2)\n\t\t{\n\t\t\tif(b<=min)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tmin=(b);\n\t\t\t}\n\t\t\tif(2*a<=min)\n\t\t\t{\n\t\t\t\tmin=(2*a);\n\t\t\t}\n\t\t\tif(2*c<=min)\n\t\t\t{\n\t\t\t\tmin=2*c;\n\t\t\t}\n\t\t\tprintf(\"%lld\",min);\t\n\t\t}\n\t\telse if(d==1)\n\t\t{\n\t\t\tif(a<=min)\n\t\t\t{\n\t\t\t\tmin=a;\n\t\t\t}\n\t\t\tif(b+c<=min)\n\t\t\t{\n\t\t\t\tmin=b+c;\n\t\t\t}\n\t\t\tif(3*c<=min)\n\t\t\t{\n\t\t\t\tmin=3*c;\n\t\t\t}\n\t\t\tprintf(\"%lld\",min);\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"0\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long int min ( long long int a, long long int b)\n{\n\treturn (a<b)?a:b;\n}\n\nint main()\n{\n\tlong long int n, a, b, c, ans = 0;\n\n\tscanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n\t\n\tn %= 4;\n\n\t//printf(\"n = %lld\\n\", n);\n\tn = 4 - n;\n\n\t//printf(\"n = %lld\\n\", n);\n\tif ( n == 1 )\n\t{\n\t\tans = min ( a , 3 * c);\n\t\tans = min ( ans, b + c );\n\t}\n\n\telse if ( n == 2)\n\t{\n\t\tans = min ( 2*a, b);\n\t\tans = min ( ans, 2*c );\n\t}\n\n\telse if ( n == 3)\n\t{\n\t\tans = min ( a + b, 3 * a );\n\t\tans = min ( ans, c );\n\t}\n\n\tprintf(\"%lld\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nunsigned int min(unsigned int a, unsigned int b)\n{\n\treturn a <= b ? a : b;\n}\n\nint main()\n{\n\tunsigned int n, a, b, c, ans;\n\tscanf(\"%u %u %u %u\", &n, &a, &b, &c);\n\tif(n % 4 == 0)\n\t{\n\t\tans = 0;\n\t}\n\telse if(n % 4 == 1)\n\t{\n\t\tans = min(3 * a, a + b);\n\t\tans = min(ans, c);\n\t}\n\telse if(n % 4 == 2)\n\t{\n\t\tans = min(2 * a, b);\n\t\tans = min(ans, 2 * c);\n\t}\n\telse\n\t{\n\t\tans = min(a, 3 * c);\n\t\tans = min(ans, b + c);\n\t}\n\tprintf(\"%u\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,a,b,c;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n if(n%4==0){\n printf(\"0\");\n \n }\n else if(n%4==3){\n if(a<=b+c&&a<=3*c){\n printf(\"%lld\",a);\n }\n else if(b+c<3*c){\n printf(\"%lld\",b+c);\n }\n else{\n printf(\"%lld\",3*c);\n }\n }\n else if(n%4==2){\n if(b<=2*a&&b<=2*c){\n printf(\"%lld\",b);\n }\n else if(a<c){\n printf(\"%lld\",2*a);\n }\n else{\n printf(\"%lld\",2*c);\n }\n }\n else{\n if(c<=3*a&&c<=a+b){\n printf(\"%lld\",c);\n }\n else if(3*a<=a+b){\n printf(\"%lld\",3*a);\n }\n else{\n printf(\"%lld\",a+b);\n }\n } \n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define ll long long\n#define ld long int\n#define flush fflush(stdin)\n#define scl(a) scanf(\"%ld\",&a)\n#define scl2(a,b) scanf(\"%ld%ld\",&a,&b)\n#define scl3(a,b,c) scanf(\"%ld%ld%ld\",&a,&b,&c)\n#define sc(a) scanf(\"%lld\",&a)\n#define sc2(a,b) scanf(\"%lld%lld\",&a,&b)\n#define sc3(a,b,c) scanf(\"%lld%lld%lld\",&a,&b,&c)\n#define pfln(a) printf(\"%ld\\n\",a)\n#define pfls(a) printf(\"%ld \",a)\n#define pfn(a) printf(\"%lld\\n\",a)\n#define pfs(a) printf(\"%lld \",a)\n#define rp(l,i,n) for(i=l;i<n;i++)\n#define rpd(n,i,l) for(i=n;i>=l;i--)\n\n\nint main(void) {\n ll n,a,b,c;\n sc(n);\n sc(a);\n sc(b);\n sc(c);\n if(n%4==0)\n printf(\"0\");\n else if(n%4==3)\n {\n if((a<3*c)&&(a<c+b)&&(a<2*b+a))\n printf(\"%lld\",a);\n else if((3*c<c+b)&&(3*c<2*b+a))\n printf(\"%lld\",3*c);\n else if((c+b<2*b+a))\n printf(\"%lld\",c+b);\n else\n printf(\"%lld\",2*b+a);\n }\n else if(n%4==2)\n {\n if(b<2*a && b<3*b && b<c*2 && b<c*3+a && b<5*b)\n printf(\"%lld\",b);\n else if (2*a<3*b && 2*a<c*2 && 2*a<c*3+a && 2*a<5*b)\n printf(\"%lld\",2*a);\n else if(3*b<c*2 && 3*b<c*3+a && 3*b<5*b)\n printf(\"%lld\",3*b);\n else if(c*2<c*3+a && c*2<5*b)\n printf(\"%lld\",c*2);\n else if(c*3+a<5*b)\n printf(\"%lld\",c*3+a);\n else\n printf(\"%lld\",5*b);\n }\n else if(n%4==1)\n {\n if(c<=3*a&&c<=(a+b)&&c<3*b+a&&c<2*c+a&&c<3*c+b)\n printf(\"%lld\",c);\n else if(3*a<(a+b) && 3*a<3*b+a && 3*a<2*c+a && 3*a<3*c+b)\n printf(\"%lld\",3*a);\n else if(a+b<3*b+a && a+b<2*c+a && a+b<3*c+b)\n printf(\"%lld\",a+b);\n else if(3*b+a<2*c+a && 3*b+a<3*c+b)\n printf(\"%lld\",3*b+a);\n else if(2*c+a<3*c+b)\n printf(\"%lld\",2*c+a);\n else\n printf(\"%lld\",3*c+b);\n }\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x, y) (((x) < (y)) ? (x) : (y))\n\nint main(void) {\n long long n = 0;\n long long a = 0;\n long long b = 0;\n long long c = 0;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\n long long m = 0;\n long long r = 0;\n\n if ((n % 4) == 0) {\n printf(\"%d\\n\", r);\n return 0;\n }\n\n if ((n % 2) == 0) {\n m = MIN(b, c * 2);\n r += MIN(m, a * 2);\n } else {\n if (((n + 1) % 4) == 0) {\n m = MIN(a, b + c);\n m = MIN(m, a + b * 2);\n r += MIN(m, 3 * c);\n } else {\n m = MIN(c, 3 * a);\n r += MIN(m, a + b);\n }\n }\n\n printf(\"%d\\n\", r);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nlong long int min3(long long int a, long long int b, long long int c){\n if (a <= b && a <= c)\n return a;\n else if (b <= a && b <= c)\n return b;\n else\n return c;\n}\n\nint main(void) {\n long long int n, a, b, c;\n scanf(\"%I64d%I64d%I64d%I64d\", &n, &a, &b, &c);\n if (n % 4 == 0)\n printf(\"0\");\n else if (n % 4 == 1)\n printf(\"%I64d\", min3(3 * a, c, a + b));\n else if (n % 4 == 2)\n printf(\"%I64d\", min3(2 * a, b, 2 * c));\n else if (n % 4 == 3)\n printf(\"%I64d\", min3(a, 3 * c, b + c));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a,long long int b,long long int c);\nint main()\n{\nlong long int n,a,b,c;\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\nif(n%2==0)\n{\nif(n%4==0)\n{\nprintf(\"0\");\n}\nelse\n{\nprintf(\"%lld\",min(2*a,b,2*c));\n}\n}\nelse\n{\nif((n+1)%4==0)\n{\nprintf(\"%lld\",min(a,b+c,3*c));\n}\nelse\n{\nprintf(\"%lld\",min(3*a,a+b,c));\n}\n}\nreturn 0;\n}\n\nlong long int min(long long int x,long long int y,long long int z)\n{\nif(x<=y&& x<=z)\nreturn x;\nelse if(y<=x&& y<=z)\nreturn y;\nelse if(z<=y&& z<=x)\nreturn z;\n}"}, {"source_code": "#include<stdio.h>\nlong long MIN(long long a,long long b){return a<b?a:b;}\nint main(){\n int n,a,b,c,i;\n long long d[20]={};\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n for(i=1;i<20;i++)d[i]=1e18;\n d[1]=a;\n d[2]=MIN(a+a,b);\n for(i=3;i<10;i++)d[i]=MIN(d[i-1]+a,MIN(d[i-2]+b,d[i-3]+c));\n for(i=0;i<10;i++)d[i%4]=MIN(d[i%4],d[i]);\n printf(\"%lld\\n\",d[(4-n%4)%4]);\n return 0;\n}\n \n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c,ans,min;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tans= 4-(n%4);\n\tif(ans==4)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\tif(ans==1)\n\t{\n\t\tlong long int p[3];\n\t\tp[0]=a;\n\t\tp[1]= b+c;\n\t\tp[2]=(3*c);\n\t\tif(p[0]<=p[1])\n\t\t{\n\t\t\tif(p[0]<=p[2])\n\t\t\t{\n\t\t\t\tmin=p[0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(p[1]<=p[2])\n\t\t\t{\n\t\t\t\tmin=p[1];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\tif(ans==2)\n\t{\n\t\tlong long int p[3];\n\t\tp[0]=(2*a);\n\t\tp[1]= b;\n\t\tp[2]= (2*c);\n\t\tif(p[0]<=p[1])\n\t\t{\n\t\t\tif(p[0]<=p[2])\n\t\t\t{\n\t\t\t\tmin= p[0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(p[1]<=p[2])\n\t\t\t{\n\t\t\t\tmin= p[1];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\tif(ans==3)\n\t{\n\t\tlong long int p[3];\n\t\tp[0]= (3*a);\n\t\tp[1]= (a+b);\n\t\tp[2]= c;\n\t\tif(p[0]<=p[1])\n\t\t{\n\t\t\tif(p[0]<=p[2])\n\t\t\t{\n\t\t\t\tmin=p[0];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(p[1]<=p[2])\n\t\t\t{\n\t\t\t\tmin=p[1];\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmin=p[2];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\\n\",min);\n\t}\n\treturn 0;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",ins);\n\n }\n else if(n%4==3)\n {\n ins=min(a,b+c);\n ans=min(ins,3*c);\n for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a[4];\n\tint i,j,k;\n\tlong long int p[20],t;\n\tscanf(\"%d%d%d%d\",&n,&a[1],&a[2],&a[3]);\n\tp[0]=0;\n\tfor(i=1;i<=11;i++)\n\t{\n\t\tp[i]=-1;\n\t\tfor(k=1;k<=3&&i-k>=0;k++)\n\t\t{\n\t\t\tif(p[i]==-1)\n\t\t\t\tp[i]=p[i-k]+a[k];\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(p[i]>p[i-k]+a[k])\n\t\t\t\t\tp[i]=p[i-k]+a[k];\n\t\t\t}\n\t\t}\n\t}\n\tk=n%4;\n\tk=4-k;\n\tk%=4;\n\tif(k)\n\t{\n\t\tif(p[k]<p[k+4])\n\t\t\tt=p[k];\n\t\telse\n\t\t\tt=p[k+4];\n\t\tif(t<p[k+8])\n\t\t\tprintf(\"%I64d\",t);\n\t\telse\n\t\t\tprintf(\"%I64d\",p[k+8]);\n\t}\n\telse\n\t\tprintf(\"0\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a, long long int b){\n\treturn a<b?a:b;\n}\nmain(){\n\tlong long int n,a,b,c,k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n//\tint mcost;\n\t\n\tk=4-n%4;\n \n\tif(k==1)\n\t\tprintf(\"%lld\",min(a, min(b + c, c * 3)));\n\telse if(k==2)\n\t\tprintf(\"%lld\",min(a * 2, min(b, c * 2)));\n\telse if(k==3)\n\t\tprintf(\"%lld\",min(min(3*a,b+a),c));\n\telse\n\t\tprintf(\"0\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n unsigned long long int n,a,b,c,k=0,m1,m2,m3,m4,m5;\n scanf(\"%llu%llu%llu%llu\",&n,&a,&b,&c);\n while(1)\n {\n if((n+k)%4==0)break;\n else k++;\n }\n if(k==0)printf(\"0\\n\");\n else if(k==1)\n {\n m1=a;m2=(3*c);m3=b+c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n else if(k==2)\n {\n m1=2*a;m2=b;m3=2*c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n else if(k==3)\n {\n m1=3*a;m2=a+b;m3=c;\n if(m1<=m2 && m1<=m3)printf(\"%llu\\n\",m1);\n else if(m2<=m1 && m2<=m3)printf(\"%llu\\n\",m2);\n else if(m3<=m2 && m3<=m1)printf(\"%llu\\n\",m3);\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x, y) (((x) < (y)) ? (x) : (y))\n\nint main(void) {\n long long n = 0;\n long long a = 0;\n long long b = 0;\n long long c = 0;\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\n long long m = 0;\n long long r = 0;\n\n if ((n % 4) == 0) {\n printf(\"%d\\n\", r);\n return 0;\n }\n\n if ((n % 2) == 0) {\n m = MIN(b, c * 2);\n r += MIN(m, a * 2);\n } else {\n if (((n + 1) % 4) == 0) {\n m = MIN(a, b + c);\n m = MIN(m, a + b * 2);\n r += MIN(m, 3 * c);\n } else {\n m = MIN(c, 3 * a);\n r += MIN(m, a + b);\n }\n }\n\n printf(\"%d\\n\", r);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a,long long int b)\n{\n\tlong long int mini;\n\tif(a<b)\n\t\tmini=a;\n\telse\n\t\tmini=b;\n\treturn mini;\n}\nint main()\n{\n\tlong long int n,a,b,c,o;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tswitch(4-n%4)\n\t{\n\t\tcase 4:o=0;\n\t\t break;\n\t\tcase 1:o=min(a,3*c);\n\t\t o=min(o,2*b+a);\n\t\t o=min(o,b+c);\n\t\t break;\n\t\tcase 2:o=min(b,2*a);\n\t\t o=min(o,2*c);\n\t\t break;\n\t\tcase 3:o=min(c,3*a);\n\t\t o=min(o,a+b);\n\t\t break;\n\t}\n\tprintf(\"%lld\\n\",o);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int n, a, b, c;\n\tscanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n\t\n\tif ( n % 4 == 0 )\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse\n\t{\n\t\tlong long int x = n, count = 0;\n\t\t\n\t\tfor(; x > 0; x = x - 4)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\t\n\t\tint k = (4*count) - n;\n\t\t\n\t\tif ( k == 1 )\n\t\t{\n\t\t\tlong long int ans = ( a < b+c? a:b+c);\n\t\t\tans = (ans < 3*c? ans:3*c);\n\t\t\t\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t\t\t\n\t\t}\n\t\telse if(k == 2 )\n\t\t{\n\t\t\tlong long int q = 2*a;\n\t\t\tlong long int ans = (q < b ? q : b);\n\t\t\tans = (ans<2*c ? ans:2*c);\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\t}\n\t\t\n\t\telse if(k == 3)\n\t\t{\n\t\t\tlong long int q = 3*a;\n\t\t\tlong long int w = b + a;\n\t\t\tlong long int ans = ( q< w ? q : w);\n\t\t\t\n\t\t\tans = (ans< c? ans : c);\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t\n\t\t}\t\n\t}\n\t\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tlong long int n , a , b ,c;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\n\tint j;\n\tj=n%4;\n\n\tlong long int x ,y,z;\n\n\tswitch(j)\n\t{\n\t\tcase 0:\n\t\t{\n\t\t\tprintf(\"%d\",0);\n\t\t\tbreak;\n\n\t\t}\n\n\t\tcase 1:\n\t\t{\n\t\t\tx=3*a<(a+b)?3*a:(b+a);\n\t\t\ty=x<c?x:c;\n\t\t\tz=y<(b+a)?y:(b+a);\n\n\t\t\tprintf(\"%lld\",z);\n\t\t\tbreak;\n\t\t}\n\t\tcase 2:\n\t\t{\n\t\t\tx=2*a<b?2*a:b;\n\t\t\ty=x<2*c?x:2*c;\n\n\t\t\tprintf(\"%lld\",y);\n\t\t\tbreak;\n\t\t}\n\t\tcase 3:\n\t\t{\n\t\t\tx=a<(b+c)?a:(b+c);\n\t\t\ty=x<3*c?x:3*c;\n\t\t\tprintf(\"%lld\",y);\n\t\t\tbreak;\n\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,a,b,c,t;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n t=4-(n%4);\n if(t==4){\n printf(\"0\");\n }\n else if(t==3){\n if(c<(3*a)){\n if(c<(b+a)){\n printf(\"%I64d\",c);\n }\n else{\n printf(\"%I64d\",(b+a));\n }\n }\n else{\n if((3*a)<(b+a)){\n printf(\"%I64d\",(3*a));\n }\n else{\n printf(\"%I64d\",(b+a));\n }\n }\n }\n else if(t==2){\n if(b<(2*a)){\n if(b<(2*c)){\n printf(\"%I64d\",b);\n }\n else{\n printf(\"%I64d\",(2*c));\n }\n }\n else{\n if((2*a)<(2*c)){\n printf(\"%I64d\",(2*a));\n }\n else{\n printf(\"%I64d\",(2*c));\n }\n }\n }\n else if(t==1){\n if(a<(3*c)){\n if(a<(b+c)){\n printf(\"%I64d\",a);\n }\n else{\n printf(\"%I64d\",(b+c));\n }\n }\n else{\n if((3*c)<(b+c)){\n printf(\"%I64d\",(3*c));\n }\n else{\n printf(\"%I64d\",(b+c));\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a, long long int b){\n\treturn a<b?a:b;\n}\nmain(){\n\tlong long int n,a,b,c,k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n//\tint mcost;\n\t\n\tk=4-n%4;\n \n\tif(k==1)\n\t\tprintf(\"%lld\",min(a, min(b + c, c * 3)));\n\telse if(k==2)\n\t\tprintf(\"%lld\",min(a * 2, min(b, c * 2)));\n\telse if(k==3)\n\t\tprintf(\"%lld\",min(min(3*a,b+a),c));\n\telse\n\t\tprintf(\"0\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\ntypedef long long int llint;\nllint min(llint a,llint b)\n{\n\tif(a==0||b==0)\n\t\treturn 0;\n\tif(a/b)\n\t\treturn b;\n\telse\n\t\treturn a;\n\n\n}\nint main()\n{\n\tllint n,a,b,c,d;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n//\tprintf(\"%lld\\n\",n%4);\t\n\tif(n%4==0)\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse if(n%4==3)\n{\t\n\n\td=min(a,3*c);\n\td=min(d,c+b);\n\tprintf(\"%d\",d);\n\nreturn 0;\n\n}\n\telse if(n%4==2)\n\t{\n\t\td=min(2*a,b);\n\t\td=min(d,2*c);\n\t\tprintf(\"%d\",d);\n//\t\tif(a*2>b)\n//\t\t\tprintf(\"%d\",b);\n//\t\telse\n//\t\t\tprintf(\"%d\",2*a);\n\t\treturn 0;\n\t}\n\telse \n\t{\n\t\td=min(3*a,a+b);\n\t\td=min(d,c);\n\t\t\n\t\tprintf(\"%d\",d);\n\t\treturn 0;\t\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tlong long int rem = n % 4;\n\tlong long int req = 4- rem;\n\tif (rem==0)\n\t\tprintf(\"0\\n\");\n\telse if (req==1)\n\t{\n\t\tif (a<3*c)\n\t\t{\t\n\t\t\tif (a<b+c)\n\t\t\t\tprintf(\"%lld\\n\",a);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",b+c);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (3*c<b+c)\n\t\t\t\tprintf(\"%lld\\n\",3*c);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",b+c);\n\t\t}\n\t}\n\telse if (req==2)\n\t{\n\t\tif (2*a<b)\n\t\t{\t\n\t\t\tif (2*a<2*c)\n\t\t\t\tprintf(\"%lld\\n\",2*a);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",2*c);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (b<2*c)\n\t\t\t\tprintf(\"%lld\\n\",b);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",2*c);\n\t\t}\n\t}\n\telse if (req==3)\n\t{\n\t\tif ((b+a)<c)\n\t\t{\n\t\t\tif (b+a<3*a)\n\t\t\t\tprintf(\"%lld\\n\",b+a);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",3*a);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (c<3*a)\n\t\t\t\tprintf(\"%lld\\n\",c);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\\n\",3*a);\n\t\t}\n\t}\n\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\ntypedef unsigned int ui;\nui min3(ui a, ui b, ui c)\n{\n return a>b?(b<c?b:c):(a<c?a:c);\n}\nmain()\n{\n ui n, a, b, c;\n scanf(\"%u%u%u%u\",&n,&a,&b,&c);\n switch(n%4)\n {\n case 0: printf(\"0\");\n break;\n case 1: printf(\"%u\",min3(3*a,a+b,c));\n break;\n case 2: printf(\"%u\",min3(2*a,b,2*c));\n break;\n case 3: printf(\"%u\",min3(a,c+b,3*c));\n break;\n }\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nlong long int n,a,b,c,d;\nscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\nif(n==7&&a==9&&b==2)\n\n{printf(\"9\");\nreturn 0;}\nd=(4-(n%4))%4;\nswitch(d)\n{\n case 1:\n if(a<b+c&&a<3*c)\n printf(\"%lld\",a);\n \n\n if(b+c<a&&b+c<3*c)\n printf(\"%lld\",b+c);\n \n\n if(3*c<b+c&&3*c<a)\n printf(\"%lld\",3*c);\n \nbreak;\n\t\tcase 2:\n\t\tif(b<2*a&&b<2*c)\n printf(\"%lld\",b);\n \n if(2*a<b&&2*a<2*c)\n printf(\"%lld\",2*a);\n \n if(2*c<b&&2*c<2*a)\n printf(\"%lld\",2*c);\n break;\n\t\tcase 3:\n\t\tif(c<3*a&&c<a+b)\n printf(\"%lld\",c);\n \n if(3*a<c&&3*a<a+b)\n printf(\"%lld\",3*a);\n \n if(a+b<c&&a+b<3*a)\n printf(\"%lld\",a+b);\n break;\n\t\tdefault:\n\t\t\tprintf(\"0\");\n\t\t\tbreak;\n\t}\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int a,long long int b,long long int c)\n{\n\tif(a<=b && a<=c)\n\t\treturn a;\n\telse if(b<=a && b<=c)\n\t\treturn b;\n\telse\n\t\treturn c;\n}\n\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\\n\");\n\telse if(n%4==3)\n\t\tprintf(\"%lld\\n\",min(a,b+c,3*c));\n\telse if(n%4==2)\n\t\tprintf(\"%lld\\n\",min(2*a,b,2*c));\n\telse\n\t\tprintf(\"%lld\\n\",min(3*a,a+b,c));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>//wtfqq!!!\nint main()\n{\n long long int n,i,j,k,a[3],min,jk,jk1;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//printf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n jk=a[1]+a[2];\n jk1=a[2]*3; \n if(jk<min)\n min=jk;\n if(jk1<min)\n min=jk1;\n}\nif(k==2)\n{\n \n a[0]=a[0]*2;\n a[2]=a[2]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n jk=a[0]+a[1];\n a[0]=a[0]*3;\n min=a[0];\n if(min>jk)\n min=jk;\n if(min>a[2])\n min=a[2];\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a,long long int b,long long int c);\nint main()\n{\nlong long int n,a,b,c;\nscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\nif(n%2==0)\n{\nif(n%4==0)\n{\nprintf(\"0\");\n}\nelse\n{\nprintf(\"%lld\",min(2*a,b,2*c));\n}\n}\nelse\n{\nif((n+1)%4==0)\n{\nprintf(\"%lld\",min(a,b+c,3*c));\n}\nelse\n{\nprintf(\"%lld\",min(3*a,a+b,c));\n}\n}\nreturn 0;\n}\n\nlong long int min(long long int x,long long int y,long long int z)\n{\nif(x<=y&& x<=z)\nreturn x;\nelse if(y<=x&& y<=z)\nreturn y;\nelse if(z<=y&& z<=x)\nreturn z;\n}"}, {"source_code": "#include<stdio.h>//wtfqq!!!\nint main()\n{\n long long int n,i,j,k,a[3],min,jk,jk1;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//printf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n jk=a[1]+a[2];\n jk1=a[2]*3; \n if(jk<min)\n min=jk;\n if(jk1<min)\n min=jk1;\n}\nif(k==2)\n{\n \n a[0]=a[0]*2;\n a[2]=a[2]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n jk=a[0]+a[1];\n a[0]=a[0]*3;\n min=a[0];\n if(min>jk)\n min=jk;\n if(min>a[2])\n min=a[2];\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,a,b,c,p,q,r,min;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\");\n\tif(n%4==1)\n\t{\n\t\tp=3*a;q=a+b;r=c;\n\t}\n\tif(n%4==2)\n\t{\n\t\tp=2*a;q=b;r=2*c;\n\t}\n\tif(n%4==3)\n\t{\n\t\tp=a;q=b+c;r=3*c;\n\t}\n\tif((p<=q)&&(p<=r)) min=p;\n\tif((q<=p)&&(q<=r)) min=q;\n\tif((r<=q)&&(r<=p)) min=r;\n\tif((n%4)!=0) printf(\"%lld\",min);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nlong long int min(long long int a,long long int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\nint main()\n{\n long long int a,b,i,j,c,n,a1,a2,a3,a4,a5,a6,a7,a8,a9;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n j=n%4;\n if(n%4==0)\n printf(\"0\");\n else if((n+1)%4==0)\n {\n a1=3*c;\n a2=b+c;\n j=min(a1,a2);\n j=min(j,a);\n printf(\"%lld\",j);\n }\n else if((n+2)%4==0)\n {\n a1=2*a;\n a2=2*c;\n j=min(a1,a2);\n j=min(j,b);\n printf(\"%lld\",j);\n }\n else\n {\n a1=a+b;\n a2=3*a;\n a3=2*b+c;\n j=min(a1,a2);\n i=min(c,a3);\n j=min(i,j);\n printf(\"%lld\",j);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define min(a,b) ((a)<(b) ? (a):(b))\n\nint main(void){\n long long n,a,b,c;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n if(n%4==0)\n \tprintf(\"0\\n\");\n else if(n%4==3)\n \tprintf(\"%I64d\\n\",min(a,min(b+c,3*c)));\n else if(n%4==2)\n \tprintf(\"%I64d\\n\",min(b,min(a<<1,min(c<<1,min(c+3*a,(a<<1)*3)))));\n else\n \tprintf(\"%I64d\\n\",min(c,min(a+b,min(3*a,min(7*a,min(5*a+b,min(3*a+(b<<1),a+3*b)))))));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nlong FindSmallest(unsigned long* ptr, int options);\n\nint main()\n{\n unsigned long *ptr;\n unsigned long n, a, b, c, rubles, k;\n\n\n scanf(\"%lu\t%lu\t%lu\t%lu\", &n, &a, &b, &c);\n\n if(n%4 == 0)\n {\n\trubles = 0;\n }\n else if(n%4 == 1)\n\t{\n\t ptr = (unsigned long*) malloc(sizeof(unsigned long)*3);\n\t ptr[0] = c;\n\t ptr[1] = a + b;\n\t ptr[2] = 3*a;\n\n\t rubles = FindSmallest(ptr, 3);\n\n\t free(ptr);\n\t}\n\telse if(n%4 == 2)\n\t\t{\n\t\t\tptr = (unsigned long*) malloc(sizeof(unsigned long)*3);\n\t\t\tptr[0] = b;\n\t\t\tptr[1] = c+c;\n\t\t\t//ptr[2] = c + (3*a);\n\t\t\tptr[2] = 2*a;\n\n\t\t\trubles = FindSmallest(ptr, 3);\n\n\t\t\tfree(ptr);\n\t\t}\n\t\telse if(n%4 == 3)\n\t\t\t{\n\t\t\t\tptr = (unsigned long*) malloc(sizeof(unsigned long)*2);\n\t\t\t\tptr[0] = a;\n\t\t\t\tptr[1] = b + c;\n\t\t\t\tptr[2] = 3*c;\n\n\t\t\t\trubles = FindSmallest(ptr, 3);\n\n\t\t\t\tfree(ptr);\n\n\t\t\t}\n\n\n\n\n printf(\"%lu\", rubles);\n\n\n\n\n return 0;\n}\n\n\nlong FindSmallest(unsigned long* ptr, int options)\n{\n unsigned long smallest;\n int i;\n\n if(ptr)\n {\n smallest = ptr[0];\n\n for(i = 0; i < options; i++)\n {\n if(ptr[i] < smallest)\n {\n\t\tsmallest = ptr[i];\n }\n\n }\n\n }\n\n return smallest;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,p,i,ar[4],small;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n if(n%4==0)\n printf(\"0\\n\");\n else\n {p=4-(n%4);\n // printf(\"%lld\\n\",p);\n if(p==1)\n {ar[0]=a;\n ar[1]=3*c;\n ar[2]=b+c;\n small=ar[0];\n for(i=1;i<3;i++)\n {if(small>ar[i])\n small=ar[i];\n }\n printf(\"%lld\\n\",small);\n \n \n }\n else if(p==2)\n {ar[0]=2*a;\n ar[1]=b;\n ar[2]=2*c;\n small=ar[0];\n for(i=1;i<3;i++)\n {if(small>ar[i])\n small=ar[i];\n }\n printf(\"%lld\\n\",small);\n }\n else if(p==3)\n {\n ar[0]=3*a;\n ar[1]=c;\n ar[2]=b+a;\n small=ar[0];\n for(i=1;i<3;i++)\n {if(ar[i]<small)\n small=ar[i];\n }\n printf(\"%lld\\n\",small);\n }\n }\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nunsigned long int min(unsigned long int, unsigned long int, unsigned long int);\n\nint main () {\n unsigned long int n, a, b, c;\n unsigned long int k;\n scanf (\"%lu %lu %lu %lu\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 1) {\n printf (\"%lu\\n\", min (a, b + c, 3 * c));\n }\n else if (k == 2) {\n printf (\"%lu\\n\", min (2 * a, b, 2 * c));\n }\n else if (k == 3) {\n printf (\"%lu\\n\", min (3 * a, a + b, c));\n }\n else {\n printf (\"0\\n\");\n }\n return 0;\n}\n\nunsigned long int min (unsigned long int a, unsigned long int b, unsigned long int c) {\n if ((a <= b) && (a <= c)) {\n return a;\n }\n if ((b <= a) && (b <= c)) {\n return b;\n }\n if ((c <= a) && (c <= b)) {\n return c;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,a,b,c,d,p,k;\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n p=n%4;\n p=4-p;\n if(p==4)\n d=0;\n if(p==1)\n {\n d=(a+3*c-(abs(a-3*c)))/2;\n d=(d+b+c-(abs(d-(c+b))))/2;\n }\n \n if(p==2)\n {\n d=(2*a+b-(abs(2*a-b)))/2;\n d=(2*c+d-(abs(2*c-d)))/2;\n }\n if(p==3)\n {\n d=(3*a+c-(abs(3*a-c)))/2;\n k=a+b;\n d=(d+k-(abs(d-k)))/2;\n }\n printf(\"%d\",d);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",ins);\n\n }\n else if(n%4==3)\n {\n ins=min(a,b+c);\n ans=min(ins,3*c);\n for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long INT64;\n\nINT64 min(INT64 a, INT64 b) {\n return (a < b) ? a : b;\n}\n\nint main(void) {\n INT64 n = 0, a = 0, b = 0, c = 0;\n INT64 i = 0, j = 0, k = 0;\n INT64 result = 0;\n \n scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n if (n % 4 == 0) {\n printf(\"0\\n\");\n } else {\n if (n % 4 == 1) {\n result = a * 3;\n result = min(result, a + b);\n result = min(result, c);\n result = min(result, b * 3 + a);\n } else if (n % 4 == 2) {\n result = min(a * 2, b);\n result = min(result, 2 * c);\n } else if (n % 4 == 3) {\n result = a;\n result = min(result, b + c);\n result = min(result, c * 3);\n }\n \n printf(\"%lld\\n\", result);\n }\n \n\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nmain()\n{\n long int n,a,b,c,k=0;\n scanf(\"%ld%ld%ld%ld\",&n,&a,&b,&c);\n while(1)\n {\n if((n+k)%4==0)break;\n else k++;\n }\n if(k==0)printf(\"0\\n\");\n else if(k==1)printf(\"%ld\\n\",a);\n else if(k==2)\n {\n if(2*a>b)printf(\"%ld\\n\",b);\n else printf(\"%ld\\n\",2*a);\n }\n else if(k==3)\n {\n if(c<=3*a && c<=(b+a))printf(\"%ld\\n\",c);\n else if(3*a<=c && 3*a<=(b+a))printf(\"%ld\\n\",3*a);\n else if((b+a)<=3*a && (b+a)<=c)printf(\"%ld\\n\",(b+2*a));\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n /*for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }*/\n //if(ans!=0)\n //printf(\"%lld\\n\",ans);\n\n //else\n printf(\"%lld\\n\",ans);\n\n }\n else if(n%4==3)\n {\n ins=min(a,b+c);\n ans=min(ins,3*c);\n /*for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);*/\n\n //else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, a, b, c, min, need, rubles, copybook;\n\t\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\tneed = n % 4;\n\tif(need == 0)\n\tprintf(\"0\\n\");\n\telse{\n\tcopybook = 4 - need;\n\t\n\t// selection part of min rubles\n\tmin = a;\n\tif(min>b)\n\tmin = b;\n\tif(min>c)\n\tmin = c;\n\t\n\t/// total burles she need\n\t rubles= copybook * min;\n\t printf(\"%d\\n\",rubles);\n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t//https://codeforces.com/contest/740/problem/A\n\tlong long int a,b,c,n,d,min=1000000000;\n\tscanf(\"%ld\",&n);\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tif(n%4!=0)\n\t{\n\t\td=4-(n%4);\n\t\tif(d==3)\n\t\t{\n\t\t\tif(c<=min)\n\t\t\t{\n\t\t\t\tmin=c;\n\t\t\t}\n\t\t\tif((b+a)<=min)\n\t\t\t{\n\t\t\t\tmin=(b+a);\n\t\t\t}\n\t\t\tif(3*a<=min)\n\t\t\t{\n\t\t\t\tmin=(3*a);\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\n\t\t}\n\t\telse if(d==2)\n\t\t{\n\t\t\tif(b<=min)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tmin=(b);\n\t\t\t}\n\t\t\tif(2*a<=min)\n\t\t\t{\n\t\t\t\tmin=(2*a);\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\t\n\t\t}\n\t\telse if(d==1)\n\t\t{\n\t\t\tif(a<=min)\n\t\t\t{\n\t\t\t\tmin=a;\n\t\t\t}\n\t\t\tif(b+c<=min)\n\t\t\t{\n\t\t\t\tmin=b+c;\n\t\t\t}\n\t\t\tif(3*c<=min)\n\t\t\t{\n\t\t\t\tmin=3*c;\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"0\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n\nint min(int a,int b){\n\treturn (a>b)?b:a;\n}\n\nint n;\n\nint solve(int k,int a,int b,int c,int mon){\n\tif((k)%4==0){\n\t\treturn mon; \n\t}\n\tif(k>4*n){\n\t\treturn INT_MAX;\n\t}\n\treturn min(solve(k+1,a,b,c,mon+a),min(solve(k+2,a,b,c,mon+b),solve(k+3,a,b,c,mon+c)));\n}\n\nint main(void){\n\tint a,b,c;\n\tscanf(\"%d%d%d%d\",&n,&a,&b,&c);\n\tint ans=solve(n,a,b,c,0);\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int min;\n long long int n,a,b,c;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n if(n%4==1)\n {\n min=a*3;\n if(a+b<min)\n {\n min=a+b;\n }\n if(c<min)\n {\n min=c;\n }\n printf(\"%d\\n\",min);\n }\n else if(n%4==2)\n {\n min=b;\n if(a*2<min)\n {\n min=a*2;\n }\n if(c*2<min)\n {\n min=c*2;\n }\n printf(\"%d\\n\",min);\n }\n else if(n%4==3)\n {\n min=a;\n if(c*3<min)\n {\n min=3*c;\n }\n if(b+c<min)\n {\n min=b+c;\n }\n printf(\"%d\\n\",min);\n }\n else\n {\n printf(\"0\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\ntypedef struct num{\nint index;\ndouble x;\nint money;\n}num;\nnum s1[10],s2[20];\nint main()\n{\n int x,n,a,b,c,x1,x2,x3;\n double q,w,e,min;\n while(scanf(\"%d%d%d%d\",&n,&a,&b,&c)!=EOF)\n {\n\t s1[0].money=a;s1[1].money=b;s1[2].money=c;\n\t\tif(n%4==0)x=0;\n\t\telse x=4-n%4;\n if(x==0)printf(\"0\\n\");\n else\n {\n\t\t\t if(x==1)\n\t\t\t {\n\t\t\t\t s2[0].money=s1[0].money;\n\t\t\t\t s2[1].money=s1[1].money+s1[2].money;\n\t\t\t\t if(s2[0].money>s2[1].money)printf(\"%.0f\\n\",s2[1].money);\n\t\t\t\t else printf(\"%.0f\\n\",s2[0].money);\n\t\t\t }\n\t\t\t else if(x==2)\n\t\t\t {\n\t\t\t\t s2[0].money=s1[0].money*2;\n\t\t\t\t s2[1].money=s1[1].money;\n\t\t\t\t s2[2].money=s1[2].money*2;\n\t\t\t\t min=s2[0].money;\n\t\t\t\t for(a=1;a<3;a++)\n\t\t\t\t\t if(s2[a].money<min)min=s2[a].money;\t\t\t\t\n\t\t\t\t printf(\"%.0f\\n\",min);\n\t\t\t }\n\t\t\t else if(x==3)\n\t\t\t {\n\t\t\t\t x1=s1[0].money*3;\n\t\t\t\t x2=s1[0].money+s1[1].money;\n\t\t\t\t x3=s1[2].money;\n\t\t\t\t if(x1<=x2&&x1<=x3)printf(\"%d\\n\",x1);\n\t\t\t\t else if(x2<=x1&&x2<=x3)printf(\"%d\\n\",x2);\n else if(x3<=x1&&x3<=x2)printf(\"%d\\n\",x3);\n\t\t\t }\n\t\t }\n }\n\t return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tlong long n, a, b, c, ans;\n\n\tscanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c), n = (4 - (n % 4)) % 4;\n\tif (n == 0)\n\t\tans = 0;\n\telse if (n == 1)\n\t\tans = min(a, c * 3);\n\telse if (n == 2)\n\t\tans = min(a * 2, min(b, c * 2));\n\telse\n\t\tans = min(a * 3, min(a + b, c));\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,k,r=0;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n k=4-(n%4);\n if(k==1)\n {\n if(a<(b+c)){\n r=a;\n }\n else r=b+c;\n }\n else if(k==2)\n {\n if((2*a)<((3*a)+c)&&(2*a)<b)\n {\n r=2*a;\n }\n else if(((3*a)+c)<b)\n {\n r=3*a+c;\n }\n else\n r=b;\n }\n else if(k==3)\n {\n if((3*a)<(b+a)&&(3*a)<c)\n {\n r=3*a;\n }\n else if((b+a)<c)\n {\n r=b+a;\n }\n else\n r=c;\n }\n printf(\"%I64d\",r);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int n, a, b, c;\n int k;\n scanf (\"%d %d %d %d\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 4) {\n printf (\"0\\n\");\n }\n else if (k == 1) {\n if (b + c <= a) {\n printf(\"%d\\n\", b + c);\n }\n else {\n printf (\"%d\\n\", a);\n }\n\n }\n else if (k == 2) {\n if ((2 * a <= b) && (2 * a <= 2 * c)) {\n printf (\"%d\\n\", 2 * a);\n }\n else if ((2 * c <= b) && (2 * c <= 2 * a)) {\n printf (\"%d\\n\", 2 * c);\n }\n else {\n printf (\"%d\\n\", b);\n }\n }\n else {\n if ((3 * a <= c) && (3 * a <= a + b)) {\n printf (\"%d\\n\", 3 * a);\n }\n else if ((a + b <= c) && (a + b <= 3 * a)) {\n printf (\"%d\\n\", a + b);\n }\n else {\n printf(\"%d\\n\", c);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n,a,b,c,temp,min=0,i=2;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\t temp=4-(n%4);\n\t if(temp==1){\n\t min=a;\n\t }\n\t else if(temp==2)\n\t {\n\t min=b;\n\t if(min>(a+a))\n\t min=2*a;\n\t while(1){\n\t if(min>(i*c)){\n\t min=i*c;}\n\t else{\n\t break;}\n\t i++;\n\t }\n\t }\n\t else if(temp==3)\n\t {\n\t min=c;\n\t if(min>3*a)\n\t min=3*a;\n\t if(min>a+b)\n\t min=a+b;\n\t }\n\t else\n\t {\n\t min=0;\n\t }\n\t printf(\"%lld\",min);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n int n,a,b,c,ans;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n if(n%4!=0)\n {\n if(n%4==1)\n {\n //min of 3*a,b+a,c\n ans=3*a<c?3*a<(b+a)?3*a:(b+a):c<(b+a)?c:(b+a);\n\n }\n else if(n%4==2)\n {\n //min of b,2*a\n ans=b<2*a?b:2*a;\n }\n else if(n%4==3)\n ans=a;\n }\n else ans=0;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n long long int n,a,b,c,d,e,f,g,min=0;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\n if(n%4==0)\n {\n printf(\"0\");\n }\n else\n {\n d=4-(n%4);\n if(d==1)\n {\n if(a<=b && a<=c)\n {\n printf(\"%d\",a);\n }\n else if(b<=a && b<=c)\n {\n printf(\"%d\",b);\n }\n else\n {\n printf(\"%d\",c);\n }\n }\n else if(d==2)\n {\n e=d*a;\n if(e<=b && e<=c)\n {\n printf(\"%d\",e);\n }\n else if(b<=e && b<=c)\n {\n printf(\"%d\",b);\n }\n else \n {\n printf(\"%d\",c);\n }\n }\n else \n {\n e=d*a;\n f=b*2;\n g=b+a;\n if(e<=f && e<=g)\n {\n min=e;\n }\n else if(f<=e && f<=g)\n {\n min=f;\n }\n else\n {\n min=g;\n }\n if(min<=c)\n {\n printf(\"%d\",min);\n }\n else\n {\n printf(\"%d\",c);\n }\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\n\nint main()\n{\n ll f1,f2,f3;\n ll s;\n int flag[10];\n scanf(\"%I64d %I64d %I64d %I64d\",&s,&f1,&f2,&f3);\n if(f1*2 < f2){\n flag[2] = 1;\n f2 = f1*2;\n if(f1*3 < f3){\n flag[3] = 1;\n f3 = f1*3;\n }\n }\n else {\n if(f2*3 > f3*2){\n flag[6] = 1;\n }\n }\n\n ll ans = s,cha = 0;\n for(; ans%4!=0; ans++);\n cha = ans - s;\n ll sum = 0;\n if(s%4 == 0){\n printf(\"0\");\n }\n else{\n if(flag[3] == 1)\n printf(\"%I64d\",cha*f1);\n else {\n if(flag[6] == 1){\n sum += (cha/3)*f3;\n cha %= 3;\n }\n if(flag[2] == 1){\n sum += cha*f1;\n }\n else{\n sum += (cha/2) * f2;\n cha %= 2;\n sum += cha*f1;\n }\n printf(\"%I64d\",sum);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, a, b, c, min, need, rubles, copybook;\n\t\n\tscanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\tneed = n % 4;\n\tif(need == 0)\n\tprintf(\"0\\n\");\n\telse{\n\tcopybook = 4 - need;\n\t\n\t// selection part of min rubles\n\tmin = a;\n\tif(min>b)\n\tmin = b;\n\tif(min>c)\n\tmin = c;\n\t\n\t/// total burles she need\n\t rubles= copybook * min;\n\t printf(\"%d\\n\",rubles);\n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t//https://codeforces.com/contest/740/problem/A\n\tlong long int a,b,c,n,d,min=1000000000;\n\tscanf(\"%ld\",&n);\n\tscanf(\"%ld\",&a);\n\tscanf(\"%ld\",&b);\n\tscanf(\"%ld\",&c);\n\tif(n%4!=0)\n\t{\n\t\td=4-(n%4);\n\t\tif(d==3)\n\t\t{\n\t\t\tif(c<=min)\n\t\t\t{\n\t\t\t\tmin=c;\n\t\t\t}\n\t\t\tif((b+a)<=min)\n\t\t\t{\n\t\t\t\tmin=(b+a);\n\t\t\t}\n\t\t\tif(3*a<=min)\n\t\t\t{\n\t\t\t\tmin=(3*a);\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\n\t\t}\n\t\telse if(d==2)\n\t\t{\n\t\t\tif(b<=min)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tmin=(b);\n\t\t\t}\n\t\t\tif(2*a<=min)\n\t\t\t{\n\t\t\t\tmin=(2*a);\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\t\n\t\t}\n\t\telse if(d==1)\n\t\t{\n\t\t\tif(a<=min)\n\t\t\t{\n\t\t\t\tmin=a;\n\t\t\t}\n\t\t\tif(b+c<=min)\n\t\t\t{\n\t\t\t\tmin=b+c;\n\t\t\t}\n\t\t\tif(3*c<=min)\n\t\t\t{\n\t\t\t\tmin=3*c;\n\t\t\t}\n\t\t\tprintf(\"%ld\",min);\n\t\t}\n\t}\n\telse\n\t{\n\t\tprintf(\"0\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\ntypedef struct num{\nint index;\ndouble x;\nint money;\n}num;\nnum s1[10];\nint main()\n{\n int x,n,a,b,c,x1,x2,x3,min;\n double q,w,e;\n while(scanf(\"%d%d%d%d\",&n,&a,&b,&c)!=EOF)\n {\n\t s1[0].money=a;s1[1].money=b;s1[2].money=c;\n\t\tif(n%4==0)x=0;\n\t\telse x=4-n%4;\n if(x==0)printf(\"0\\n\");\n else\n {\n\t\t\t if(x==1)\n\t\t\t {\n\t\t\t\t printf(\"%d\\n\",s1[0].money);\n\t\t\t }\n\t\t\t else if(x==2)\n\t\t\t {\n\t\t\t\t x1=s1[0].money*2;\n\t\t\t\t x2=s1[1].money;\n\t\t\t\t if(x1>x2)printf(\"%d\\n\",x2);\n\t\t\t\t else printf(\"%d\\n\",x1);\n\t\t\t }\n\t\t\t else if(x==3)\n\t\t\t {\n\t\t\t\t x1=s1[0].money*3;\n\t\t\t\t x2=s1[0].money+s1[1].money;\n\t\t\t\t x3=s1[2].money;\n\t\t\t\t if(x1<=x2&&x1<=x3)printf(\"%d\\n\",x1);\n\t\t\t\t else if(x2<=x1&&x2<=x3)printf(\"%d\\n\",x2);\n else if(x3<=x1&&x3<=x2)printf(\"%d\\n\",x3);\n\t\t\t }\n\t\t }\n }\n\t return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nunsigned int min(unsigned int a, unsigned int b)\n{\n\treturn a <= b ? a : b;\n}\n\nint main()\n{\n\tunsigned int n, a, b, c, ans;\n\tscanf(\"%u %u %u %u\", &n, &a, &b, &c);\n\tif(n % 4 == 0)\n\t{\n\t\tans = 0;\n\t}\n\telse if(n % 4 == 1)\n\t{\n\t\tans = min(3 * a, a + b);\n\t\tans = min(ans, c);\n\t}\n\telse if(n % 4 == 2)\n\t{\n\t\tans = min(2 * a, b);\n\t\tans = min(ans, 2 * c);\n\t}\n\telse\n\t{\n\t\tans = a;\n\t}\n\tprintf(\"%u\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, a, b, c;\n\tlong long cost1, cost2, cost11, cost3, cost12, cost111, cost;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &c);\n\tcost1 = a;\n\tcost2 = b;\n\tcost11 = 2LL * a;\n\tcost3 = c;\n\tcost12 = a + b;\n\tcost111 = 3LL * a;\n\tswitch ((4 - n % 4) % 4) {\n\t\tcase 0:\n\t\t\tcost = 0;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tcost = cost1;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcost = cost2 < cost11 ? cost2 : cost11;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcost = min(cost3, min(cost12, cost111));\n\t\t\tbreak;\n\t}\n\tprintf(\"%lld\\n\", cost);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nmain()\n{\n\tlong long int m,a,b,c,p,x,y,z,n;\n\tscanf(\"%lld%lld%lld%lld\",&m,&a,&b,&c);\n\tp=4-m%4;\n\tif(p==3)\n\t{\n\t\tx=3*a;\n\t\ty=b+a;\n\t\tz=c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==2)\n\t{\n\t\tx=2*a;\n\t\ty=b;\n\t\tz=2*c;\n\t\tn=min(x,y);\n\t\tprintf(\"%lld\",min(n,z));\n\t}\n\tif(p==1)\n\t{\n\t\tx=1*a;\n\t\ty=b+c;\n\t\tprintf(\"%lld\",min(x,y));\n\t}\n\tif(p==4)\n\t{\n\t\tprintf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int a,long long int b,long long int c)\n{\n\tif(a<=b && a<=c)\n\t\treturn a;\n\telse if(b<=a && b<=c)\n\t\treturn b;\n\telse\n\t\treturn c;\n}\n\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\\n\");\n\telse if(n%4==3)\n\t\tprintf(\"%lld\\n\",min(a,b,c));\n\telse if(n%4==2)\n\t\tprintf(\"%lld\\n\",min(2*a,b,c));\n\telse\n\t\tprintf(\"%lld\\n\",min(3*a,2*b,c));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tlong long n, a, b, c, ans;\n\n\tscanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c), n = (4 - (n % 4)) % 4;\n\tif (n == 0)\n\t\tans = 0;\n\telse if (n == 1)\n\t\tans = min(a, c * 3);\n\telse if (n == 2)\n\t\tans = min(a * 2, min(b, c * 2));\n\telse\n\t\tans = min(a * 3, min(a + b, c));\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min(int a,int b,int c)\n{\n return ((a<b?a:b)<c)?(a<b?a:b):c;\n}\nint main()\n{\n int n,a,b,c;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n if(n%4==0)printf(\"0\\n\");\n else if(n%4==3)printf(\"%d\\n\",min(a,b+c,3*c));\n else if(n%4==2)printf(\"%d\\n\",min(2*a,b,2*c));\n else printf(\"%d\\n\",min(3*a,a+b,c));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,k,r=0;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n k=4-(n%4);\n if(k==1)\n {\n if(a<(b+c)){\n r=a;\n }\n else r=b+c;\n }\n else if(k==2)\n {\n if((2*a)<((3*a)+c)&&(2*a)<b)\n {\n r=2*a;\n }\n else if(((3*a)+c)<b)\n {\n r=3*a+c;\n }\n else\n r=b;\n }\n else if(k==3)\n {\n if((3*a)<(b+a)&&(3*a)<c)\n {\n r=3*a;\n }\n else if((b+a)<c)\n {\n r=b+a;\n }\n else\n r=c;\n }\n printf(\"%I64d\",r);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n int n,a,b,c,ans;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n if(n%4!=0)\n {\n if(n%4==1)\n {\n //min of 3*a,b+a,c\n ans=3*a<c?3*a<(b+a)?3*a:(b+a):c<(b+a)?c:(b+a);\n\n }\n else if(n%4==2)\n {\n //min of b,2*a\n ans=b<2*a?b:2*a;\n }\n else if(n%4==3)\n ans=a;\n }\n else ans=0;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "/*input\n1 1 4 8\n*/\n#include<stdio.h>\nlong long int min(long long int a,long long int b)\n{\n\tif(a<b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tlong long int n,a,b,c,i,j,t,k;\n\tscanf(\"%64lld%64lld%64lld%64lld\",&n,&a,&b,&c);\n k=4-n%4;\n\tif(k==4)\n\t\tt=0;\n\telse if(k==1)\n\t\tt=a;\n\telse if(k==2)\n\t{\n\t\tif(2*a<b)\n\t\t\tt=2*a;\n\t\telse\n\t\t\tt=b;\n\t}\n\telse if(k==3)\n\t{\n j=min(3*a,c);\n t=min(j,2*a+b);\n\t}\n\tprintf(\"%lld\",t);\n\treturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main()\n{\n long long int n,a,b,c, ans;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%d\\n\",n%4);\n //printf(\"a=%d\\tb=%d\\tc=%d\\t3*a=%lld\\tb+a=%lld\",a,b,c,3*a,b+a);\n if(n%4!=0)\n {\n if(n%4==1)\n {\n //min of 3*a,b+a,c\n ans=3*a<c?(3*a)<(b+a)?(3*a):(b+a):c<(b+a)?c:(b+a);\n // ans=3*a;\n // printf(\"%lld\\n\",ans);\n // if(c<ans)\n // ans=c;\n // if((b+a)<ans)\n // ans=b+a;\n\n }\n else if(n%4==2)\n {\n //min of b,2*a\n ans=b<(2*a)?b:(2*a);\n }\n else if(n%4==3)\n ans=a;\n }\n else ans=0;\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long n,a,b,c,res;\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n\n n = (4- (n % 4)) % 4;\n\n if (n == 0) res = 0;\n\n if (n == 1)\n {\n res = a;\n if (res > b + c) res = b + c;\n if (res > 3*c) res = 3*c;\n }\n\n if (n == 2)\n {\n res = b;\n if (res > 2*a) res = 2*a;\n if (res > 2*c) res = 2*c;\n }\n\n if (n == 3)\n {\n res = c;\n if (res > 3*a) res = 3*a;\n if (res > 3*b + a) res = 3*b + a;\n }\n\n printf(\"%I64d\", res);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int min;\n int n,a,b,c;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n if(n%4==1)\n {\n min=a*3;\n if(a+b<min)\n {\n min=a+b;\n }\n if(c<min)\n {\n min=c;\n }\n printf(\"%d\\n\",min);\n }\n else if(n%4==2)\n {\n min=b;\n if(a*2<min)\n {\n min=a*2;\n }\n if(c*2<min)\n {\n min=c*2;\n }\n printf(\"%d\\n\",min);\n }\n else if(n%4==3)\n {\n min=a;\n if(c*3<min)\n {\n min=3*c;\n }\n if(b+c<min)\n {\n min=b+c;\n }\n printf(\"%d\\n\",min);\n }\n else\n {\n printf(\"0\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n long long int n,a,b,c,d,e,f,g;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&a,&b,&c);\n if(n%4==0)\n {\n printf(\"0\");\n }\n else\n {\n d=4-(n%4);\n e=d*a;\n f=((b/2)+(b%2))*b;\n g=((c/3)+(c%3))*c;\n if(e<=f && e<=g)\n {\n printf(\"%I64d\",e);\n }\n else if(f<=e && f<=g)\n {\n printf(\"%I64d\",f);\n }\n else\n {\n printf(\"%I64d\",g);\n }\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int n, a, b, c;\n int k;\n scanf (\"%d %d %d %d\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 4) {\n printf (\"0\\n\");\n }\n else if (k == 1) {\n if (b + c <= a) {\n printf(\"%d\\n\", b + c);\n }\n else {\n printf (\"%d\\n\", a);\n }\n\n }\n else if (k == 2) {\n if ((2 * a <= b) && (2 * a <= 2 * c)) {\n printf (\"%d\\n\", 2 * a);\n }\n else if ((2 * c <= b) && (2 * c <= 2 * a)) {\n printf (\"%d\\n\", 2 * c);\n }\n else {\n printf (\"%d\\n\", b);\n }\n }\n else {\n if ((3 * a <= c) && (3 * a <= a + b)) {\n printf (\"%d\\n\", 3 * a);\n }\n else if ((a + b <= c) && (a + b <= 3 * a)) {\n printf (\"%d\\n\", a + b);\n }\n else {\n printf(\"%d\\n\", c);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\ntypedef long long ll;\n\nint main()\n{\n ll f1,f2,f3;\n ll s;\n //freopen(\"in.txt\",\"r\",stdin);\n while(~scanf(\"%I64d %I64d %I64d %I64d\",&s,&f1,&f2,&f3))\n {\n if(f3 > f1*3)\n f3 = f1*3;\n if(f2 > f1*2)\n f2 = f1*2;\n\n ll cha = 4-s%4;\n\n if(cha == 4) printf(\"0\\n\");\n if(cha == 3){\n if(f3 > f1+f2) printf(\"%I64d\\n\",f1+f2);\n else printf(\"%I64d\\n\",f3);\n }\n if(cha == 2){\n if(f2 > f3*2) printf(\"%I64d\\n\",f3*2);\n else printf(\"%I64d\\n\",f2);\n }\n if(cha == 1){\n if(f1 > f3+f2) printf(\"%I64d\\n\",f3+f2);\n else printf(\"%I64d\\n\",f1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n, a, b, c;\nlong long aa, bb, cc;\nint min(long long a, long long b)\n{\n if(a<b)\n\treturn (int) a;\n else\n\treturn (int) b;\n}\nint main()\n{\n scanf(\"%i%i%i%i\",&n,&a,&b,&c);\n aa = a;\n bb = b;\n cc = c;\n if(n%4==0)\n\tprintf(\"0\\n\");\n else if(n%4==1)\n\tprintf(\"%i\\n\",min(min(cc,3*aa),aa+2*bb));\n else if(n%4==2)\n\tprintf(\"%i\\n\",min(min(bb,2*aa),2*cc));\n else if(n%4==3)\n\tprintf(\"%i\\n\",min(min(aa,bb+cc),3*cc));\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,a,b,c,x,y,z,ans;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n \n if(n%4==0) ans=0;\n \n //one more cb is needed\n else if((n+1)%4==0) \n {\n if(a>b+c) ans=b+c;\n else ans=a;\n }\n \n //three more cb are needed\n else if((n-1)%4==0) \n {\n if(a*3<c)\n {\n if(a*3>b+a) ans=b+a;\n else ans=a*3;\n }\n else ans=c;\n }\n \n \n //two more cb are needed\n else\n {\n if(a*2<b)\n {\n if(a*2>c*2)\n ans=c*2;\n else ans=a*2;\n }\n else ans=b;\n }\n printf(\"%lld\",ans);\n \n return 0;\n \n}\n\n\n"}, {"source_code": "\n#include<stdio.h>\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else return b;\n}\nint main()\n{\n int n,a,b,c;\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n if(n%4==0 )\n printf(\"0\");\n else\n {\n switch(n%4)\n {\n case 3:printf(\"%d\",a);break;\n case 2:printf(\"%d\",min(2*a,b));break;\n case 1:printf(\"%d\",min(a+b,min(3*a,c)));break;\n \n }\n }\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n unsigned long long int n, a, b, c, k, s1, s2,s3;\n \n scanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n if(n%4==0)\n {\n k=0;\n printf(\"%lld\\n\",k);\n }\n else\n {\n k=n%4;\n k=4-k;\n if(k==1)\n printf(\"%lld\\n\",a);\n else if(k==2)\n {\n if(2*a>b)\n printf(\"%lld\\n\",b);\n else\n printf(\"%lld\\n\",2*a);\n }\n else if(k==3)\n {\n s1=3*a;\n s2=c;\n s3=2*b+a;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2>s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int n, a, b, c;\n\tscanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n\t\n\tif ( n % 4 == 0 )\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse\n\t{\n\t\tlong long int x = n, count = 0;\n\t\t\n\t\tfor(; x > 0; x = x - 4)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\t\n\t\tint k = (4*count) - n;\n\t\t\n\t\tif ( k == 1 )\n\t\t\tprintf(\"%lld\\n\",a);\n\t\t\n\t\telse if(k == 2 )\n\t\t{\n\t\t\tlong long int q = 2*a;\n\t\t\tlong long int ans = (q < b ? q : b);\n\t\t\tans = (ans<2*c ? ans:2*c);\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\t}\n\t\t\n\t\telse if(k == 3)\n\t\t{\n\t\t\tlong long int q = 3*a;\n\t\t\tlong long int w = b + a;\n\t\t\tlong long int ans = ( q< w ? q : w);\n\t\t\t\n\t\t\tans = (ans< c? ans : c);\n\t\t\tprintf(\"%lld\\n\",ans);\n\t\t\t\n\t\t}\t\n\t}\n\t\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k,a[3],min;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//printf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==2)\n{\n a[0]=a[0]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n a[0]=a[0]*3;\n a[1]=a[1]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define ll long long\n\nint main(void)\n{\n ll n, a, b, c, temp;// 1 - a, 2 - b, 3 - c;\n int remainder;\n\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n\n remainder = (int)(n % 4);\n\n \n /*\n 1 - 1\n 2 - (1,1), (2)\n 3 - (1,1,1), (1,1,2), (3)\n */\n \n \n if (remainder == 0)\n {\n printf(\"0\\n\");\n }\n else if (remainder == 3)//3, 2, 1\n {\n printf(\"%I64d\\n\", a > 3 * c ? 3 * c : a);\n }\n else if (remainder == 2)//(2, 0, 0), (0, 1, 0), (0, 0, 2)\n {\n temp = 2 * a > b ? b : 2 * a;\n printf(\"%I64d\\n\", temp > 2 * c ? 2 * c : temp);\n }\n else if (remainder == 1)//(3, 0, 0), (1, 1, 0), (0, 0, 1)\n {\n temp = 3 * a > c ? c : 3 * a;\n printf(\"%I64d\\n\", temp > a + b ? a + b : temp);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) a<b?a:b\nint main()\n{\n long long n,a,b,c,min;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n n=4-(n%4);\n if(n==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n if(n==1)\n {\n min=MIN(a,(b+c));\n min=MIN(min,(3*c));\n }\n else if(n==2)\n {\n min=MIN(b,(2*a));\n min=MIN(min,(2*c));\n }\n else\n {\n min=MIN(c,(3*a));\n min=MIN(min,(a+b));\n }\n printf(\"%lld\\n\",min);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tlong long n, m, a, b, c;\n\t\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n\tn = 4 - (n % 4);\n\tif(n == 4)\n\t{\n\t\tm = 0;\n\t}\n\telse if(n == 1)\n\t{\n\t\tm = a;\n\t\tif(3 * c < a || b + c < a)\n\t\t{\n\t\t\tif(3 * c < b + c)\n\t\t\t{\n\t\t\t\tm = 3 * c;\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tm = a + b;\n\t\t\t}\n\t\t}\n\t}\n\telse if(n == 2)\n\t{\n\t\tm = b;\n\t\tif(a * 2 < b || 2 * c < b)\n\t\t{\n\t\t\tif(a * 2 < 2 * c)\n\t\t\t{\n\t\t\t\tm = 2 * a;\t\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tm = 2 * c;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tm = c;\n\t\tif(3 * a < c || a + b < c)\n\t\t{\n\t\t\tif(3 * a < a + b)\n\t\t\t{\n\t\t\t\tm = 3 * a;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tm = a + b;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\", m);\n\t\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nll minn(ll a,ll b)\n{\nreturn (a>b)?b:a;\n}\nint main()\n{\n ll n,a,b,c;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n if(n%4==0)\n printf(\"%d\",0);\n else if(n%4==2)\n {\n ll r=minn(2*a,b);\n printf(\"%lld\",r);\n }\n else if(n%4==1)\n {\n //printf(\"y\");\n ll r=minn(3*a,c);\n printf(\"%lld\",r);\n }\n else\n {\n if(a<=c)\n printf(\"%lld\",a);\n else\n {\n ll ar[(a/12)+3],z=0,f=0,g=0,num;\n for(ll i=0;i<(a/12)+3;i++)\n ar[i]=-1;\n for(ll p=3;f==0;p+=12)\n {\n if(p>a)\n {\n f=1;\n break;\n }\n ar[z++]=p;\n }\n for(ll i=0;i<z;i++)\n {\n if(ar[i]!=-1)\n {\n if(ar[i]%c==0)\n {\n num=ar[i];\n g=1;\n break;\n }\n }\n }\n if(g==0)\n printf(\"%lld\",a);\n else\n {\n ll r=minn((num/3)*c,a);\n printf(\"%lld\",r);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define MIN(x, y) (((x) < (y)) ? (x) : (y))\n\nint main(void) {\n long long n = 0;\n long long a = 0;\n long long b = 0;\n long long c = 0;\n\n scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n\n long long r = 0;\n\n while ((n % 4) != 0) {\n if ((n % 2) == 0) {\n long long d = MIN(b, c * 2);\n r += MIN(d, a * 2);\n break;\n } else {\n long long tmp = (n + 1) % 4;\n if ((tmp % 4) == 0) {\n r += a;\n break;\n } else {\n long long i = MIN(c, 3 * a);\n r += MIN(i, a + b);\n break;\n }\n }\n }\n\n printf(\"%d\\n\", r);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n,a,b,c,s,min=1000000000,i,k,c1=0;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tint arr[3]={a,b,c};\n\tfor(i=0;i<3;i++)\n\t{\n\t c1=0;\n\t s=n;\n\t while(s%4!=0)\n\t {\n\t s+=(i+1);\n c1+=arr[i];\n if(c1>min)\n {\n break;\n }\n\t }\n\t if(min>c1)\n\t {\n\t min=c1;\n\t }\n\t}\n\tprintf(\"%lld\",min);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,rem,amt=0;\n scanf(\"%lld%lld%d%lld\",&n,&a,&b,&c);\n rem=n%4;\n if(rem==1)\n {\n amt=(c<3*a)?c:(3*a);\n amt=((a+b)<amt?(a+b):amt);\n }\n else if(rem==2)\n {\n amt = (b<2*a)?b:(2*a);\n amt = ((2*c)<amt)?(2*c):amt;\n }\n else if(rem==3)\n {\n amt=(a<3*c)?a:(3*c);\n amt=amt<(b+c)?amt:(b+c);\n }\n printf(\"%lld\",amt);\n return 0;\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main() {\n #ifndef ONLINE_JUDGE\n freopen( \"input.txt\", \"r\", stdin );\n #endif\n\n int n, a1, b2, c3;\n scanf( \"%d %d %d %d\", &n, &a1, &b2, &c3 );\n\n if (2*a1 < b2) { b2 = 2*a1; }\n if (3*a1 < c3) { c3 = 3*a1; }\n\n int need = (n % 100) % 4;\n int cost;\n\n switch (need) {\n case 3: cost = a1; break;\n case 2: cost = b2; break;\n case 1: cost = c3; break;\n case 0: cost = 0; break;\n }\n\n printf( \"%d\", cost );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,c,k,r=0;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n k=4-(n%4);\n if(k==1)\n {\n r=a;\n }\n else if(k==2)\n {\n if((2*a)<b)\n {\n r=2*a;\n }\n else\n r=b;\n }\n else if(k==3)\n {\n if((3*a)<c)\n {\n r=3*a;\n }\n else if((b+a)<c)\n {\n r=b+a;\n }\n else\n r=c;\n }\n printf(\"%I64d\",r);\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int a,long long int b,long long int c)\n{\n\tif(a<=b && a<=c)\n\t\treturn a;\n\telse if(b<=a && b<=c)\n\t\treturn b;\n\telse\n\t\treturn c;\n}\n\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\\n\");\n\telse if(n%4==3)\n\t\tprintf(\"%lld\\n\",min(a,b,c));\n\telse if(n%4==2)\n\t\tprintf(\"%lld\\n\",min(2*a,b,c));\n\telse\n\t\tprintf(\"%lld\\n\",min(3*a,2*b,c));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define min(a,b) a > b ? b : a ;\nint main()\n{\n long long int n,a,b,c,aux,h=0,x=4;\n int rest;\n scanf(\"%I64d %I64d %I64d %I64d\", &n,&a,&b,&c);\n if(n%x == h)\n {\n printf(\"0\");\n return 0;\n }\n else\n {\n rest=4 - (n%4);\n if(rest==1)\n {\n if (a > b+c )\n printf(\"%ld\",b+c);\n else\n printf(\"%ld\",a);\n return 0;\n }\n else if (rest == 2)\n {\n //aux = 2*a > b ? b : 2*a ;\n //aux = 2*c > aux ? aux : 2*c;\n aux = min (2*a,b);\n aux = min (2*c,aux);\n printf(\"%ld\",aux);\n return 0;\n }\n else\n {\n aux=min(3*a,c);\n aux=min(a+b,aux);\n printf(\"%ld\",aux);\n return 0;\n }\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) (a>b?b:a)\n#define Min(a,b,c) MIN(MIN(a,b),c)\n#define min(a,b,c,d) MIN(MIN(a,b),MIN(c,d))\nmain()\n{\n\tlong long int x,n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tx=n%4;\n\tswitch(x)\n\t{\n\t\tcase 1:printf(\"%lld\",min(3*a,c,a+b,3*b));\n\t\tbreak;\n\t\tcase 2:printf(\"%lld\",Min(2*a,b,2*c));\n\t\tbreak;\n\t\tcase 3:printf(\"%lld\",Min(a,b+c,3*c));\n\t\tbreak;\n\t\tdefault:printf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long n,a,b,c,i,j;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n if(n%4==0)\n printf(\"0\\n\");\n else\n {\n i=4-n%4;\n if(i==1)\n printf(\"%lld\\n\",a);\n else if(i==2)\n {\n if(i*a>b)\n printf(\"%lld\\n\",b);\n else\n printf(\"%lld\\n\",i*a);\n }\n else if(i==3)\n {\n if(i*a<=c&&i*a<=b+a)\n printf(\"%lld\\n\",i*a);\n else if(b+a<=c&&b+a<=i*a)\n printf(\"%lld\\n\",b+a);\n else\n printf(\"%lld\\n\",c);\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b,c,d,e,min,f,g;\n\tscanf(\"%d%d%d%d\",&n,&a,&b,&c);\n\tint to_buy;\n\tto_buy=n%4;\n\tif(to_buy==0)\n\t\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tto_buy=4-to_buy;\n\t\tif(to_buy==1)\n\t\t{\n\t\t\tif(a<b+c) //1 or 5\n\t\t\t\tmin=a;\n\t\t\telse\n\t\t\t\tmin=b+c;\n\t\t\tif(min>3*c) // 9\n\t\t\t\tmin=3*c;\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t\telse if(to_buy==2)\n\t\t{\n\t\t\td=2*a; // 2\n\t\t\tif(d<b) //2\n\t\t\t\tmin=d;\n\t\t\telse\n\t\t\t\tmin=b;\n\t\t\tif(2*c<min) //6\n\t\t\t\tmin=2*c;\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t\telse\n\t\t{\n\t\t\td=3*a; // 3\n\t\t\te=a+b;//1+2\n\t\t\tf=2*c+a; //7\n g=3*c+b;//11\n\t\t\tif(d<e)\n\t\t\t\tmin=d;\n\t\t\telse\n\t\t\t\tmin=e;\n\t\t\tif(c<min)\n\t\t\t\tmin=c;\n\t\t\tif(f<min)\n\t\t\t\tmin=f;\n if(g<min)\n min=g;\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n return (a < b) ? a : b;\n}\n\nint main(void) {\n int n = 0, a = 0, b = 0, c = 0;\n int i = 0, j = 0, k = 0;\n int result = 0;\n \n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n if (n % 4 == 0) {\n printf(\"0\\n\");\n } else {\n if (n % 4 == 1) {\n result = a * 3;\n result = min(result, a + b);\n result = min(result, c);\n } else if (n % 4 == 2) {\n result = min(a * 2, b);\n } else if (n % 4 == 3) {\n result = a;\n }\n \n printf(\"%d\\n\", result);\n }\n \n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint min(int a,int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%d\\n\",ans);\n }\n else if(n%4==2)\n printf(\"%d\\n\",min(2*a,b));\n else if(n%4==3)\n printf(\"%d\\n\",a);\n}\n"}, {"source_code": "/*\n * 1.\u8fd9\u4e2a\u7a0b\u5e8f\u505a\u5230\u7684\u4e8b\u60c5\n * ruble\u662f\u4fc4\u56fd\u7684\u8d27\u5e01\n * \u56db\u95e8\u8bfe\n * 2.\u8fd9\u4e2a\u7a0b\u5e8f\u9047\u5230\u7684\u56f0\u96be\n * 3.\u63a5\u4e0b\u6765\u8981\u505a\u7684\u4e8b\u60c5\n */\n#include<stdio.h>\n#define N 100\nint min2(int a,int b){\n if(a>b)return b;\n else return a;\n}\nint min3(int a,int b,int c){\n return min2(a,min2(b,c));\n}\nint main() {\n int n,a,b,c;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n int min=0;\n int money[N];\n money[0]=0;\n money[1]=a;\n money[2]=min2(a*2,b);\n money[3]=min3(a*3,b+a,c);\n /*\n money[4]=min(money[1]+money[3],money[2]+money[2]);\n money[5]=min(money[1]+money[4],money[2]+money[3]);\n */\n int i,j;\n for(i=4;i<N;i++){\n money[i]=money[1]+money[i-1];\n for(j=2;j<=i/2;j++){\n money[i]=min2(money[i],money[j]+money[i-j]);\n }\n }\n int k=0;\n while(1){\n //\u53ea\u80fd\u8d2d\u4e70\u6070\u597dk\u672c\u4e66\uff0c\u4e0d\u80fd\u591a\u4e70\uff1f\n if(k>=N){\n printf(\"\u4e0d\u591f\\n\");\n break;\n }\n if((n+k)%4==0){\n min=money[k];\n break;\n }\n k++;\n }\n printf(\"%d\\n\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int n, a, b, c;\n int k;\n scanf (\"%d %d %d %d\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 4) {\n printf (\"0\\n\");\n }\n else if (k == 1) {\n if (b + c <= a) {\n printf(\"%d\\n\", b + c);\n }\n else {\n printf (\"%d\\n\", a);\n }\n\n }\n else if (k == 2) {\n if ((2 * a <= b) && (2 * a <= 2 * c)) {\n printf (\"%d\\n\", 2 * a);\n }\n else if ((2 * c <= b) && (2 * c <= 2 * a)) {\n printf (\"%d\\n\", 2 * c);\n }\n else {\n printf (\"%d\\n\", b);\n }\n }\n else {\n if ((3 * a <= c) && (3 * a <= a + b)) {\n printf (\"%d\\n\", 3 * a);\n }\n else if ((a + b <= c) && (a + b <= 3 * a)) {\n printf (\"%d\\n\", a + b);\n }\n else {\n printf(\"%d\\n\", c);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long mini(long long a, long long b, long long c)\n{\n\n return a<=b?a<=c?a:c : b<=c?b:c;\n\n}\n\nint main(void)\n{\n\n\nlong long min,n,a,b,c;\n\nscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\nif(n%4==0)\n{\nprintf(\"0\");\nreturn 0;\n}\n\nelse if(n%4==3)\n{\n\nmin = mini(a,b+c,3*a+b);\n\n}\n\nelse if(n%4==2)\n{\n\n min = mini(2*a, b, 2*c);\n\n}\n\nelse if(n%4==1)\n{\n\nmin = mini(3*a, c, a+b);\n\n}\n\nprintf(\"%lld\",min);\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\ntypedef long long int lli;\n\nint main()\n{\n\tlli n,a,b,c;\n\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\n\tlli k=n%4;\n\n\tif(k==0)\n\t\tprintf(\"0\");\n\telse if(k==1)\n\t{if(3*a<=c)\n\t\tprintf(\"%lld\",3*a);\n\t\telse\n\t\t\tprintf(\"%lld\",c);\n\t}\n\telse if(k==2)\n\t{if(2*a<=b)\n\t\t{if(2*a<=2*c)\n\t\t\tprintf(\"%lld\",2*a);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%lld\",2*c);}\n\t\telse if(b<=2*a)\n\t\t{if(b<=2*c)\n\t\t\tprintf(\"%lld\",b);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%lld\",2*c);}\n\t}\n\telse\n\t{if(3*c<=a)\n\t\tprintf(\"%lld\",3*c);\n\t\telse\n\t\t\tprintf(\"%lld\",a);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main (){long long int alyona,a,b,c,i,j,k,count,remainder;scanf(\"%lld %lld %lld %lld\",&alyona,&a,&b,&c);if(alyona%4==0)printf(\"0\\n\");else{remainder=4-(alyona%4);switch(remainder){case 1:{if((b+c)>a)printf(\"%lld\\n\",a);else printf(\"%lld\\n\",(b+c));break;}case 2:{if((a*2)<b && (a*2)<(c*2))printf(\"%lld\\n\",(a*2));if(b<(a*2) && b<(c*2))printf(\"%lld\\n\",b);if((c*2)<b && (c*2)<(a*2))printf(\"%lld\\n\",(c*2));break;}case 3:{if((a*3)<c && (a*3)<(a+b))printf(\"%lld\\n\",(a*3));if(c<(a*3) && c<(a+b))printf(\"%lld\\n\",c);if((a+b)<(a*3) && (a+b)<c)printf(\"%lld\\n\",(a+b));break;}}}return 0;}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nll minn(ll a,ll b)\n{\nreturn (a>b)?b:a;\n}\nint main()\n{\n ll n,a,b,c;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n if(n%4==0)\n printf(\"%d\",0);\n else if(n%4==2)\n {\n ll r=minn(2*a,b);\n printf(\"%lld\",r);\n }\n else if(n%4==1)\n {\n //printf(\"y\");\n ll r=minn(3*a,c);\n printf(\"%lld\",r);\n }\n else\n {\n if(a<=c)\n printf(\"%lld\",a);\n else\n {\n ll ar[(a/12)+3],z=0,f=0,g=0,num;\n for(ll i=0;i<(a/12)+3;i++)\n ar[i]=-1;\n for(ll p=3;f==0;p+=12)\n {\n if(p>a)\n {\n f=1;\n break;\n }\n ar[z++]=p;\n }\n for(ll i=0;i<z;i++)\n {\n if(ar[i]!=-1)\n {\n if(ar[i]%c==0)\n {\n num=ar[i];\n g=1;\n break;\n }\n }\n }\n if(g==0)\n printf(\"%lld\",a);\n else\n {\n ll r=minn((num/3)*c,a);\n printf(\"%lld\",r);\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int a,long long int b)\n{\n\tlong long int y=((a<b)?a:b);\n\treturn y;\n}\nint main()\n{\n\tlong long int y,n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\n\ty=4-n%4;\n\n\tif(y==1)\n\t\tprintf(\"%lld\",min(min(a,b),c));\n\telse if(y==2)\n\t\tprintf(\"%lld\",min(min(2*a,b),2*c));\n\telse if(y==3)\n\t\tprintf(\"%lld\",min(min(3*a,b+a),c));\n\telse\n\t\tprintf(\"0\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int n, a, b, c, k, s1, s2,s3;\n scanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n if(n%4==0)\n {\n k=0;\n printf(\"%lld\\n\",k);\n }\n else\n {\n k=n%4;\n k=4-k;\n if(k==1)\n printf(\"%lld\\n\",a);\n else if(k==2)\n {\n if(2*a>b)\n printf(\"%lld\\n\",b);\n else\n printf(\"%lld\\n\",2*a);\n }\n else if(k==3)\n {\n s1=3*a;\n s2=c;\n s3=2*b+a;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s1>s2 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long Min(long long a, long long b)\n{\n if(a < b) {\n return a;\n }\n return b;\n}\n\nint main()\n{\n int n, a, b, c;\n long long Ans;\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n if(n % 4 == 0) {\n Ans = 0;\n } else if(n % 4 == 1) {\n Ans = Min((long long)a * 3, (long long)c);\n Ans = Min(Ans, (long long)a + (long long)b);\n Ans = Min(Ans, (long long)a + (long long)c * 2);\n Ans = Min(Ans, (long long)b + (long long)c * 7);\n } else if(n % 4 == 2) {\n Ans = Min((long long)a * 2, (long long)b);\n Ans = Min(Ans, (long long)c * 2);\n } else {\n Ans = Min((long long)a, (long long)c * 7);\n }\n printf(\"%I64d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, a, b, c, k, s1, s2,s3;\n\n scanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n if(n%4==0)\n {\n k=0;\n printf(\"%lld\\n\",k);\n }\n else\n {\n k=n%4;\n k=4-k;\n if(k==1)\n {\n s1=a;\n s2=5*c;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n }\n else if(k==2)\n {\n s1=2*a;\n s2=2*c;\n s3=b;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n else if(k==3)\n {\n s1=3*a;\n s2=c;\n s3=b+a;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long int min2(long long int a, long long int b){\n if (a < b)\n return a;\n else\n return b;\n}\n\nlong long int min3(long long int a, long long int b, long long int c){\n if (a <= b && a <= c)\n return a;\n else if (b <= a && b <= c)\n return b;\n else\n return c;\n}\n\nint main(void) {\n long long int n, a, b, c;\n scanf(\"%I64d%I64d%I64d%I64d\", &n, &a, &b, &c);\n if (n % 4 == 0)\n printf(\"0\");\n else if (n % 4 == 1)\n printf(\"%I64d\", min2(3 * a, c));\n else if (n % 4 == 2)\n printf(\"%I64d\", min3(2 * a, b, 2 * c));\n else if (n % 4 == 3)\n printf(\"%I64d\", min2(a, 3 * b));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b,c,d,e,min,f,g;\n\tscanf(\"%d%d%d%d\",&n,&a,&b,&c);\n\tint to_buy;\n\tto_buy=n%4;\n\tif(to_buy==0)\n\t\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tto_buy=4-to_buy;\n\t\tif(to_buy==1)\n\t\t{\n\t\t\tif(a<b+c) //1 or 5\n\t\t\t\tmin=a;\n\t\t\telse\n\t\t\t\tmin=b+c;\n\t\t\tif(min>3*c) // 9\n\t\t\t\tmin=3*c;\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t\telse if(to_buy==2)\n\t\t{\n\t\t\td=2*a; // 2\n\t\t\tif(d<b) //2\n\t\t\t\tmin=d;\n\t\t\telse\n\t\t\t\tmin=b;\n\t\t\tif(2*c<min) //6\n\t\t\t\tmin=2*c;\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t\telse\n\t\t{\n\t\t\td=3*a; // 3\n\t\t\te=a+b;//3\n\t\t\tif(d<e)\n\t\t\t\tmin=d;\n\t\t\telse\n\t\t\t\tmin=e;\n\t\t\tif(c<min)\n\t\t\t\tmin=c;\n\t\t\n\t\t\tprintf(\"%d\\n\",min);\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n break;\n\n else\n ans=min(ins,i*c);\n\n }\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==3)\n {\n for(int i=3;i<100000;i=i+4)\n {\n ans=min(a,i*c);\n if(a>ins)\n break;\n }\n printf(\"%lld\\n\",a);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long n,a,b,c;\n\tscanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n\tint t;\n\tt=4-n%4;\n\tif(t==4) {printf(\"0\"); return 0;}\n\tlong long count,count1,count2;\n\t\n\tif(t==1) printf(\"%lld\",a);\n\t\n\tcount=a*t;\n\tif(t==2){\n\t\tcount1=b; \n\t\tif(count<count1) printf(\"%lld\",count);\n\telse printf(\"%lld\",count1);\n\t}\n\tlong long min;\n\tif(t==3)\n\t{count1=a+b;\n\tcount2=c;\n\t\n\tif(count<count1) min=count;\n\telse min=count1;\n\t\n\tif(min<count2) printf(\"%lld\",min);\n\telse printf(\"%lld\",count2);\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main (){long long int alyona,a,b,c,i,j,k,count,remainder;scanf(\"%lld %lld %lld %lld\",&alyona,&a,&b,&c);if(alyona%4==0)printf(\"0\\n\");else{remainder=4-(alyona%4);switch(remainder){case 1:{if((b+c)>=a)printf(\"%lld\\n\",a);else printf(\"%lld\\n\",(b+c));break;}case 2:{if((a*2)<=b && (a*2)<=(c*2))printf(\"%lld\\n\",(a*2));else if(b<=(a*2) && b<=(c*2))printf(\"%lld\\n\",b);else if((c*2)<=b && (c*2)<=(a*2))printf(\"%lld\\n\",(c*2));break;}case 3:{if((a*3)<=c && (a*3)<=(a+b))printf(\"%lld\\n\",(a*3));else if(c<=(a*3) && c<=(a+b))printf(\"%lld\\n\",c);else if((a+b)<=(a*3) && (a+b)<=c)printf(\"%lld\\n\",(a+b));break;}}}return 0;}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,a,b,k,c;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n k=4-n%4;\n if (k==4){\n printf (\"0\");\n }\n else if (k==3){\n if (3*a <b+c&&a <3*c){\n printf (\"%lld\",3*a);\n }\n else if (b+c <3*c&&b+c <a){\n printf (\"%lld\",b+c);\n }\n else {\n printf (\"%lld\",3*c);\n }\n \n }\n else if(k==2){\n if (b <2*a&&b <2*c){\n printf (\"%lld\",b);\n }\n else if (2*a <2*c){\n printf (\"%lld\",2*a);\n }\n else{\n printf (\"%lld\",2*c);\n }\n \n }\n else {\n if (c <3*a&&c<3*b+a){\n printf (\"%lld\",c);\n }\n else if (3*a <3*b+a){\n printf (\"%lld\",3*a);\n }\n else {\n printf (\"%lld\",3*b+a);\n }\n \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int x, long long int y, long long int z)\n{\n\tif(x<y && x<z)\n\t\treturn x;\n\telse if(y<x && y<z)\n\t\treturn y;\n\telse\n\t\treturn z;\n}\n\nint main()\n{\n\tlong long int n,a,b,c,i;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\\n\");\n\telse if(n%4==1)\n\t\tprintf(\"%lld\\n\",min(3*a,b+a,c));\n\telse if(n%4==2)\n\t\tprintf(\"%lld\\n\",min(2*a,b,1000*a+1000*b));\n\telse if(n%4==3)\n\t\tprintf(\"%lld\\n\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\nint n,a[5]={0};\nscanf(\"%d %d %d\",&n,&a[1],&a[2],&a[3]);\nif (a[1]+a[1]<a[2]) a[2]=a[1]+a[1];\nif (a[1]+a[2]<a[3]) a[3]=a[1]+a[2];\na[4]=0;\nprintf(\"%d\\n\",a[4-n%4]);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nvoid swap(long long int *xp, long long int *yp)\n{\n\tlong long int temp = *xp;\n\t*xp = *yp;\n\t*yp = temp;\n}\n\nvoid bubbleSort(long long int arr[], long long int n)\n{\n\tlong long int i, j;\n\tfor (i = 0; i < n-1; i++) \n\t\tfor (j = 0; j < n-i-1; j++) \n\t\t\tif (arr[j] > arr[j+1])\n\t\t\t\tswap(&arr[j], &arr[j+1]);\n}\n\nint main()\n{\n\tlong long int n,a,b,c,i,j,k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif (n%4==0)\n\t\tprintf(\"0\");\n\telse\n\t{\n\n\t\tlong long int equal,rem;\n\t\tequal = n/4;\n\t\trem = n%4;\n\t\tlong long int arr[4];\n\t\tfor (i=0; i<4; i++)\n\t\t{\n\t\t\tif (rem>0)\n\t\t\t{\n\t\t\t\tarr[i]=equal+1;\n\t\t\t\trem--;\n\t\t\t}\n\t\t\telse\n\t\t\t\tarr[i]=equal;\n\t\t}\n\t\tint count1=0,count2=0;\n\t\tfor (i=0; i<4; i++)\n\t\t{\n\t\t\tif (arr[i]==arr[i+1])\n\t\t\t\tcount1++;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t}\n\t\tcount2=4-count1;\n\t\tif (count2==1)\n\t\t{\n\t\t\tprintf(\"%lld\",a);\n\t\t}\n\t\telse if (count2==2)\n\t\t{\n\t\t\tlong long int ans1,ans2;\n\t\t\tans1=2*a;\n\t\t\tans2=b;\n\t\t\tif (ans1<ans2)\n\t\t\t\tprintf(\"%lld\",ans1);\n\t\t\telse\n\t\t\t\tprintf(\"%lld\",ans2);\n\t\t}\n\t\telse if (count2==3)\n\t\t{\n\t\t\tlong long int Ans[3];\n\t\t\tAns[0]=3*a;\n\t\t\tAns[1]=b+a;\n\t\t\tAns[2]=c;\n\t\t\tbubbleSort(Ans,3);\n\t\t\tprintf(\"%lld\",Ans[0]);\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n\t\t\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint min(int a,int b,int c)\n\n{\n\tif(a<=b && a<=c)\n\t\treturn a;\n\telse if(b<=a && b <=c)\n\t\treturn b;\n\telse if(c<=a && c<=b)\n\t\treturn c;\n}\n\nint main()\n{\n\tint n,a,b,c;\n\tscanf(\"%d%d%d%d\",&n,&a,&b,&c);\n\tint g=n%4;\n\tif(g==0)\n\t printf(\"0\");\n\n\telse \n\t{\n\t\tint p,q,r;\n\t\tif(g==1)\n\t\t{\n\t\t \tp=3*a;\n\t\t\tq=a+b;\n\t\t \tr=c;\n\t\t \tint ans = min(p,q,r);\n\t\t\tfprintf(stdout,\"%d\",ans);\n\t\t}\n\t\telse if(g==2)\n\t\t{\n\n\t\t\t p=2*a;\n\t\t\t q=b;\n\t\t\t r=2*c;\n\t\t\t int ans = min(p,q,r);\n\t\t\tprintf(\"%d\",ans);\n\t\t}\n\n\t\telse if(g==3)\n\t\t{\n\t\t\tp=a;\n\t\t\tq=2*b + a;\n\t\t\tr=c+b;\n\t\t\tint ans = min(p,q,r);\n\t\t\tprintf(\"%d\",ans);\n\n\t\t}\n\t}\n\n}"}, {"source_code": "#include <stdio.h>\nlong long int min(int a, int b)\n{\n\tif(a>b)\n\t\treturn b;\n\telse\n\t\treturn a;\n}\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tlong long int z=4-n%4;\n\tlong long int l;\n\tif(z==3)\n\t{\n\t\tl= min((3*a),c);\n\t\tl= min(l,(a+b));\n\t\tl=min(l,(2*b+c));\n\t}\n\tif(z==2)\n\t{\n\t\t l=min(2*a,b);\n\t\tl=min(l,2*c);\n\t}\n\tif(z==1)\n\t{\n\t\tl=min((b+c),a);\n\t}\n\tif(z==0)\n\t{\n\t\tl=0;\n\t}\n\tprintf(\"%lld\",l);\n\treturn 0;\t\t\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int, int, int);\n\nint main () {\n int n, a, b, c;\n int k;\n scanf (\"%d %d %d %d\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 1) {\n printf (\"%d\\n\", min (a, b + c, 3 * c));\n }\n else if (k == 2) {\n printf (\"%d\\n\", min (2 * a, b, 2 * c));\n }\n else if (k == 3) {\n printf (\"%d\\n\", min (3 * a, a + b, c));\n }\n else {\n printf (\"0\\n\");\n }\n return 0;\n}\n\nint min (int a, int b, int c) {\n if ((a <= b) && (a <= c)) {\n return a;\n }\n if ((b <= a) && (b <= c)) {\n return b;\n }\n if ((c <= a) && (c <= b)) {\n return c;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,a,b,c,t;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a,&b,&c);\n t=4-(n%4);\n if(t==4){\n printf(\"0\");\n }\n else if(t==3){\n if(c<(3*a)){\n if(c<(2*b+a)){\n printf(\"%I64d\",c);\n }\n else{\n printf(\"%I64d\",(2*b+a));\n }\n }\n else{\n if((3*a)<(2*b+a)){\n printf(\"%I64d\",(3*a));\n }\n else{\n printf(\"%I64d\",(2*b+a));\n }\n }\n }\n else if(t==2){\n if(b<(2*a)){\n if(b<(2*c)){\n printf(\"%I64d\",b);\n }\n else{\n printf(\"%I64d\",(2*c));\n }\n }\n else{\n if((2*a)<(2*c)){\n printf(\"%I64d\",(2*a));\n }\n else{\n printf(\"%I64d\",(2*c));\n }\n }\n }\n else if(t==1){\n if(a<(3*c)){\n if(a<(b+c)){\n printf(\"%I64d\",a);\n }\n else{\n printf(\"%I64d\",(b+c));\n }\n }\n else{\n if((3*c)<(b+c)){\n printf(\"%I64d\",(3*c));\n }\n else{\n printf(\"%I64d\",(b+c));\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min( long long int a,long long int b,long long int c)\n{\n\tlong long int min=a;\n\tif(min>b)\n\t\tmin=b;\n\tif(min>c)\n\t\tmin=c;\t\n\treturn min;\t\t\n}\n\nint main()\n{\n\tlong long int n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\t\tprintf(\"0\");\n\telse if(n%4==1)\n\t{\n\t\tprintf(\"%lld\",min(3*a,a+b,c));\n\t}\n\telse if(n%4==2)\n\t{\n\t\tprintf(\"%lld\",min(2*a,b,2*c));\n\t}\n\telse\n\t{\n\t\tprintf(\"%lld\",a);\n\t}\t\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,a,b,c,x,y,z,ans;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n \n if(n%4==0) ans=0;\n \n //one more cb is needed\n else if((n+1)%4==0) \n {\n if(a>b+c) ans=b+c;\n else ans=a;\n }\n \n //three more cb are needed\n else if((n-1)%4==0) \n {\n if(a*3<c)\n {\n if(a*3>b+a) ans=b+a;\n else ans=a*3;\n }\n else ans=c;\n }\n \n \n //two more cb are needed\n else\n {\n if(b<a*2) ans=b;\n else ans=a*2;\n }\n \n printf(\"%lld\",ans);\n \n return 0;\n \n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main () {\n int n, a, b, c;\n int k;\n scanf (\"%d %d %d %d\", &n, &a, &b, &c);\n k = 4 - (n % 4);\n if (k == 4) {\n printf (\"0\\n\");\n }\n else if (k == 1) {\n if (b + c <= a) {\n printf(\"%d\\n\", b + c);\n }\n else {\n printf (\"%d\\n\", a);\n }\n\n }\n else if (k == 2) {\n if ((2 * a <= b) && (2 * a <= 2 * c)) {\n printf (\"%d\\n\", 2 * a);\n }\n else if ((2 * c <= b) && (2 * c <= 2 * a)) {\n printf (\"%d\\n\", 2 * c);\n }\n else {\n printf (\"%d\\n\", b);\n }\n }\n else {\n if ((3 * a <= c) && (3 * a <= a + b)) {\n printf (\"%d\\n\", 3 * a);\n }\n else if ((a + b <= c) && (a + b <= 3 * a)) {\n printf (\"%d\\n\", a + b);\n }\n else {\n printf(\"%d\\n\", c);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k,a[3],min,jk;\n scanf(\"%lld%lld%lld%lld\",&n,&a[0],&a[1],&a[2]);\n if(n%4==0)\n{\n printf(\"0\");\n}\nelse{\n k=4-n%4;\n//printf(\"%lld\\n\",k);\n if(k==1)\n{\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==2)\n{\n a[0]=a[0]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n}\nif(k==3)\n{\n jk=a[0]+a[1];\n a[0]=a[0]*3;\n a[1]=a[1]*2;\n min=a[0];\n for(i=1;i<3;i++)\n{\n if(min>a[i])\n min=a[i];\n}\n if(min>k)\n min=jk;\n}\nprintf(\"%lld\",min);\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) ((a) < (b) ? a : b)\n\nint main()\n{\n\tlong int n, a, b, c;\n\tscanf(\"%ld%ld%ld%ld\", &n, &a, &b, &c);\n\t\n\tif ( n % 4 == 0 )\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse\n\t{\n\t\tlong int x = n, count = 0;\n\t\t\n\t\tfor(; x > 0; x = x - 4)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\t\n\t\t\n\t\tint k = (4*count) - n;\n\t\t\n\t\t\n\t\tif ( k == 1 )\n\t\t\tprintf(\"%ld\\n\",a);\n\t\t\n\t\telse if(k == 2 )\n\t\t{\n\t\t\tlong int q = 2*a;\n\t\t\tlong int ans = MIN(q,b);\n\t\t\tprintf(\"%ld\\n\",ans);\n\t\t}\n\t\t\n\t\telse if(k == 3)\n\t\t{\n\t\t\tlong int q = 3*a;\n\t\t\tlong int w = 2*b + a;\n\t\t\tlong int ans = MIN(q,w);\n\t\t\t\n\t\t\tans = MIN(ans,c);\n\t\t\tprintf(\"%ld\\n\",ans);\n\t\t\t\n\t\t}\t\n\t}\n\t\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,a,b,c;\n\tint k;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\tif(n%4==0)\n\tprintf(\"0\");\n\telse\n\t{ long long sum;\n\t\tk=4-n%4;\n\t\tif(k==1) sum=a;\n\t\tif(k==2)\n\t\t{\n\t\t\tif(b>=2*a)sum=2*a;\n\t\t\telse sum=b;\n\t\t}\n\t\tif(k==3)\n\t\t{\n\t\t\tif(c>=3*a)\n\t\t\t{\n\t\t\t\tif(3*a>=(b+a)) sum=b+a;\n\t\t\t\telse sum=3*a;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(c>=(b+a)) sum=b+a;\n\t\t\t\telse sum=c;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%lld\",sum);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int min(long long int a,long long int b)\n{\n if(a>b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n=0,a=0,b=0,c=0,ins=0,ans=0;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n // printf(\"%lld\\n\",n%4);\n\n if(n%4==0)\n printf(\"0\\n\");\n else if(n%4==1)\n {\n ins=min(3*a,c);\n ans=min(ins,a+b);\n printf(\"%lld\\n\",ans);\n }\n else if(n%4==2)\n {\n ins=min(2*a,b);\n ans=min(ins,2*c);\n for(int i=2;i<100000;i=i*2)\n {\n\n if(i*c>ins)\n {\n break;\n }\n else\n ans=min(ans,i*c);\n\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",ins);\n\n }\n else if(n%4==3)\n {\n ans=min(a,3*c);\n for(int i=3;i<100000;i=i+4)\n {\n if(i*c>a)\n break;\n\n else\n ans=min(ans,i*c);\n }\n if(ans!=0)\n printf(\"%lld\\n\",ans);\n\n else\n printf(\"%lld\\n\",a);\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int min(long long int x,long long int y, long long int z)\n{\n if(x<y&&x<z) return x;\n else if(y<x&&y<z) return y;\n else if(z<x&&z<y) return z;\n}\n\nint main()\n{\n long long int n,a,b,c,ans;\n scanf(\"%lld %lld %lld %lld\",&n,&a,&b,&c);\n \n if(n%4==0) ans=0;\n \n //one more cb is needed\n else if((n+1)%4==0)\n ans=min(a,b+c,10000000001);\n \n //three more cb are needed\n else if((n-1)%4==0) \n ans=min(a*3,a+b,c);\n \n \n //two more cb are needed\n else\n ans=min(b,a*2,c*2);\n \n \n printf(\"%lld\",ans);\n \n return 0;\n \n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n long long int w,x,y;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a%4==0)\n {\n printf(\"0\");\n return 0;\n }\n else\n a=4-a%4;\n //printf(\"%d\",a);\n w=a*b;\n if(a==1)\n {\n printf(\"%I64d\",w);\n return 0;\n }\n x=(a/2)*c+(a%2)*b;\n if(a==2)\n {\n if(w<x)\n printf(\"%I64d\",w);\n else\n printf(\"%I64d\",x);\n return 0;\n }\n y=(a/3)*d;\n if(w<=x&&w<=y)\n printf(\"%I64d\",w);\n else if(x<=y&&x<=w)\n printf(\"%I64d\",x);\n else\n printf(\"%I64d\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min2(int a, int b){\n if (a < b)\n return a;\n else\n return b;\n}\n\nint min3(int a, int b, int c){\n if (a <= b && a <= c)\n return a;\n else if (b <= a && b <= c)\n return b;\n else\n return c;\n}\n\nint main(void) {\n int n, a, b, c;\n scanf(\"%d%d%d%d\", &n, &a, &b, &c);\n if (n % 4 == 0)\n printf(\"0\");\n else if (n % 4 == 1)\n printf(\"%d\", min2(3 * a, c));\n else if (n % 4 == 2)\n printf(\"%d\", min3(2 * a, b, 2 * c));\n else if (n % 4 == 3)\n printf(\"%d\", min2(a, 3 * b));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,c,n,a1,a2,a3,a4,a5,a6,a7,a8,a9;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n j=n%4;\n if(n%4==0)\n printf(\"0\");\n else if((n+1)%4==0)\n {\n if(3*c>a)\n printf(\"%d\",a);\n else\n printf(\"%d\",3*c);\n }\n else if((n+2)%4==0)\n {\n if(b<=2*a)\n printf(\"%d\",b);\n else\n printf(\"%d\",2*a);\n }\n else\n {\n if(3*a<c)\n printf(\"%d\",3*a);\n else\n printf(\"%d\",c);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int min(long long int a,long long int b)\n{\n\tlong long int y=((a<b)?a:b);\n\treturn y;\n}\nint main()\n{\n\tlong long int y,n,a,b,c;\n\tscanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n\n\ty=4-n%4;\n\n\tif(y==1)\n\t\tprintf(\"%lld\",min(min(a,b),c));\n\telse if(y==2)\n\t\tprintf(\"%lld\",min(min(2*a,b),2*c));\n\telse if(y==3)\n\t\tprintf(\"%lld\",min(min(3*a,b+a),c));\n\telse\n\t\tprintf(\"0\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nlong long min2(long long x,long long y){\n\n if(x > y)\n return y;\n return x;\n}\n\nlong long min3(long long x,long long y,long long z){\n\n if(x <= y && x <= z)\n return x;\n if(y <= x && y <= z)\n return y;\n if(z <= x && z <= y)\n return z;\n}\n\nint main(){\n\n int n, a, b, c, d;\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n d = n;\n while(n % 4 != 0)\n ++n;\n n = n - d;\n\n if(n == 0)\n printf(\"0\");\n\n if(n == 1)\n printf(\"%I64d\",(long long)a);\n\n if(n == 2)\n printf(\"%I64d\",min2((long long)(2 * a),(long long)b));\n\n if(n == 3)\n printf(\"%I64d\",min3((long long)(3 * a),(long long)(a + b),(long long)c));\n\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main() {\n #ifndef ONLINE_JUDGE\n freopen( \"input.txt\", \"r\", stdin );\n #endif\n\n int n, a1, b2, c3;\n scanf( \"%d %d %d %d\", &n, &a1, &b2, &c3 );\n\n if (2*a1 < b2) { b2 = 2*a1; }\n if (3*a1 < c3) { c3 = 3*a1; }\n\n int cost;\n\n if (n > 0) {\n switch ( (n % 100) % 4 ) {\n case 3: cost = a1; break;\n case 2: cost = b2; break;\n case 1: cost = c3; break;\n case 0: cost = 0; break;\n }\n } else {\n cost = b2+b2;\n }\n\n printf( \"%d\", cost );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main (){long long int alyona,a,b,c,i,j,k,count,remainder;scanf(\"%lld %lld %lld %lld\",&alyona,&a,&b,&c);if(alyona%4==0)printf(\"0\\n\");else{remainder=4-(alyona%4);switch(remainder){case 1:{printf(\"%lld\\n\",a);break;}case 2:{if((a*2)<b)printf(\"%lld\\n\",(a*2));else{if((c*2)<b)printf(\"%lld\\n\",(c*2));else printf(\"%lld\\n\",b);}break;}case 3:{if((a*3)<c)printf(\"%lld\\n\",(a*3));else printf(\"%lld\\n\",c);break;}}}return 0;}\n"}, {"source_code": "#include<stdio.h>\nint main (){long long int alyona,a,b,c,i,j,k,count,remainder;scanf(\"%lld %lld %lld %lld\",&alyona,&a,&b,&c);if(alyona%4==0)printf(\"0\\n\");else{remainder=4-(alyona%4);switch(remainder){case 1:{if((b+c)>=a)printf(\"%lld\\n\",a);else printf(\"%lld\\n\",(b+c));break;}case 2:{if((a*2)<=b && (a*2)<=(c*2))printf(\"%lld\\n\",(a*2));else if(b<=(a*2) && b<=(c*2))printf(\"%lld\\n\",b);else if((c*2)<=b && (c*2)<=(a*2))printf(\"%lld\\n\",(c*2));break;}case 3:{if((a*3)<=c && (a*3)<=(a+b))printf(\"%lld\\n\",(a*3));else if(c<=(a*3) && c<=(a+b))printf(\"%lld\\n\",c);else if((a+b)<=(a*3) && (a+b)<=c)printf(\"%lld\\n\",(a+b));break;}}}return 0;}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint n, a, b, c;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &c), n = (4 - (n % 4)) % 4;\n\tprintf(\"%d\\n\", n == 0 ? 0 : n == 1 ? a : n == 2 ? min(a * 2, b) : min(a * 3, min(a + b, c)));\n\treturn 0;\n}\n"}, {"source_code": "/*input\n1 1 4 8\n*/\n#include<stdio.h>\nlong long int min(long long int a,long long int b)\n{\n\tif(a<b)\n\t\treturn a;\n\telse\n\t\treturn b;\n}\nint main()\n{\n\tlong long int n,a,b,c,i,j,t,k;\n\tscanf(\"%64lld%64lld%64lld%64lld\",&n,&a,&b,&c);\n k=4-n%4;\n\tif(k==4)\n\t\tt=0;\n\telse if(k==1)\n\t\tt=a;\n\telse if(k==2)\n\t{\n\t\tif(2*a<b)\n\t\t\tt=2*a;\n\t\telse\n\t\t\tt=b;\n\t}\n\telse if(k==3)\n\t{\n j=min(3*a,c);\n t=min(j,2*a+b);\n\t}\n\tprintf(\"%lld\",t);\n\treturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(){\n long long int n, a, b, c, x;\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &a, &b, &c);\n n %= 4;\n switch(n){\n case 0: printf(\"0\\n\"); break;\n case 1: x = a;\n if (x > (c + c + c)) x = c + c + c;\n if (x > (c + b)) x = c + b;\n printf(\"%I64d\\n\", x); break;\n case 2: x = c + c + c;\n if (x > (a + a)) x = a + a;\n if (x > b) x = b;\n printf(\"%I64d\\n\", x); break;\n case 3: x = c;\n if (x > (a + a + a)) x = (a + a + a);\n if (x > (b + a)) x = (b + a);\n printf(\"%I64d\\n\", x); break; \n }\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint min(int a,int b)\n{\n if(a<b)\n return a;\n else return b;\n}\nint main()\n{\n int n,a,b,c;\n scanf(\"%d %d %d %d\",&n,&a,&b,&c);\n if(n%4==0 )\n printf(\"0\");\n else\n {\n switch(n%4)\n {\n case 3:printf(\"%d\",a);break;\n case 2:printf(\"%d\",min(2*a,b));break;\n case 1:printf(\"%d\",min(3*a,c));break;\n \n }\n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#define ll long long\n\nll int min(ll int a,ll int b){ return a < b ? a : b ;}\n\nint main(){\n ll int n, a, b, c; scanf(\"%lld %lld %lld %lld\", &n, &a, &b, &c);\n n %= 4; if(!n){ printf(\"0\\n\"); return 0; }\n if(n == 1) printf(\"%lld\\n\", min(min(3 * a, a + b), c));\n else if(n == 2) printf(\"%lld\\n\", min(min(2 * a, b), 2 * c));\n else if(n == 3) printf(\"%lld\\n\", min(min(a, 6 * b), 5 * c));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, a, b, c, k, s1, s2,s3;\n\n scanf(\"%lld%lld%lld%lld\", &n, &a, &b, &c);\n if(n%4==0)\n {\n k=0;\n printf(\"%lld\\n\",k);\n }\n else\n {\n k=n%4;\n k=4-k;\n if(k==1)\n {\n s1=a;\n s2=5*c;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n }\n else if(k==2)\n {\n s1=2*a;\n s2=2*c;\n s3=b;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n else if(k==3)\n {\n s1=3*a;\n s2=c;\n s3=b+a;\n\n if(s1<s2 && s1<s3)\n printf(\"%lld\\n\",s1);\n else if(s2<s1 && s2<s3)\n printf(\"%lld\\n\",s2);\n else\n printf(\"%lld\\n\",s3);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,a,b,c,min,k;\n scanf(\"%lld%lld%lld%lld\",&n,&a,&b,&c);\n if(n%4==0)\n min=0;\n else\n { k=4-n%4;\n min=k*a;\n if((b*2)%k==0 && (b*k)/2<min && (b*k)/2>=b )\n min=(b*k)/2;\n else if((c*3)%k==0 && (c*k)/3<min && (c*k)/3>=c)\n min=(c*k)/3;}\n printf(\"%lld\",min);\n\n return 0;\n}\n"}], "src_uid": "c74537b7e2032c1d928717dfe15ccfb8"} {"nl": {"description": "There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordinates $$$(0, 0)$$$, and coordinate axes are left and bottom sides of the table, then the bottom left corner of the white sheet has coordinates $$$(x_1, y_1)$$$, and the top right \u2014 $$$(x_2, y_2)$$$.After that two black sheets of paper are placed on the table. Sides of both black sheets are also parallel to the sides of the table. Coordinates of the bottom left corner of the first black sheet are $$$(x_3, y_3)$$$, and the top right \u2014 $$$(x_4, y_4)$$$. Coordinates of the bottom left corner of the second black sheet are $$$(x_5, y_5)$$$, and the top right \u2014 $$$(x_6, y_6)$$$. Example of three rectangles. Determine if some part of the white sheet can be seen from the above after the two black sheets are placed. The part of the white sheet can be seen if there is at least one point lying not strictly inside the white sheet and strictly outside of both black sheets.", "input_spec": "The first line of the input contains four integers $$$x_1, y_1, x_2, y_2$$$ $$$(0 \\le x_1 < x_2 \\le 10^{6}, 0 \\le y_1 < y_2 \\le 10^{6})$$$ \u2014 coordinates of the bottom left and the top right corners of the white sheet. The second line of the input contains four integers $$$x_3, y_3, x_4, y_4$$$ $$$(0 \\le x_3 < x_4 \\le 10^{6}, 0 \\le y_3 < y_4 \\le 10^{6})$$$ \u2014 coordinates of the bottom left and the top right corners of the first black sheet. The third line of the input contains four integers $$$x_5, y_5, x_6, y_6$$$ $$$(0 \\le x_5 < x_6 \\le 10^{6}, 0 \\le y_5 < y_6 \\le 10^{6})$$$ \u2014 coordinates of the bottom left and the top right corners of the second black sheet. The sides of each sheet of paper are parallel (perpendicular) to the coordinate axes.", "output_spec": "If some part of the white sheet can be seen from the above after the two black sheets are placed, print \"YES\" (without quotes). Otherwise print \"NO\".", "sample_inputs": ["2 2 4 4\n1 1 3 5\n3 1 5 5", "3 3 7 5\n0 0 4 6\n0 0 7 4", "5 2 10 5\n3 1 7 6\n8 1 11 7", "0 0 1000000 1000000\n0 0 499999 1000000\n500000 0 1000000 1000000"], "sample_outputs": ["NO", "YES", "YES", "YES"], "notes": "NoteIn the first example the white sheet is fully covered by black sheets.In the second example the part of the white sheet can be seen after two black sheets are placed. For example, the point $$$(6.5, 4.5)$$$ lies not strictly inside the white sheet and lies strictly outside of both black sheets."}, "positive_code": [{"source_code": "#include<stdio.h>\nint max(int a,int b)\n{\n\tif(a>b)return a;\n\telse return b;\n}\nint min(int a,int b)\n{\n\tif(a>b)return b;\n\telse return a;\n}\nint main()\n{\n\tint flag=0;\n\tint x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n\tscanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x5,&y5,&x6,&y6);\n\tfor(int i=x1+1;i<=x2;i++)\n\t{\n\t\tflag=0;\n\t\tif(x4>=i&&x3<i&&x6>=i&&x5<i)\n\t\t{\n\t\t\tif(max(y4,y6)>=y2&&min(y5,y3)<=y1)\n\t\t\t{\n\t\t\t\tif(max(y4,y6)==y4)\n\t\t\t\t{\n\t\t\t\t\tif(y6>=y3)flag=1;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(y3<=y1)flag=1;\n\t\t\t\t\t\telse if(y6>=y2)flag=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(max(y4,y6)==y6)\n\t\t\t\t{\n\t\t\t\t\tif(y4>=y5)flag=1;\n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tif(y5<=y1)flag=1;\n\t\t\t\t\t\telse if(y4>=y2)flag=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(x4>=i&&x3<i)\n\t\t{\n\t\t\tif(y4>=y2&&y3<=y1)flag=1;\n\t\t}\n\t\telse if(x6>=i&&x5<i)\n\t\t{\n\t\t\tif(y6>=y2&&y5<=y1)flag=1;\n\t\t}\n\t\tif(flag!=1)\n\t\t{\n\t\t\tflag=-1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==-1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\nint main(){\n\tscanf(\"%d%d%d%d\",&x1,&y1,&x2,&y2);\n\tscanf(\"%d%d%d%d\",&x3,&y3,&x4,&y4);\n\tscanf(\"%d%d%d%d\",&x5,&y5,&x6,&y6);\n\tif (y4>=y2&&x4>=x2&&y3<=y1&&x3<=x1) printf(\"NO\"); \n\telse if (y6>=y2&&x6>=x2&&y5<=y1&&x5<=x1) printf(\"NO\"); \n\telse if (((y3<=y1&&y4>=y2)||(x3<=x1&&x4>=x2))&&((y5<=y1&&y6>=y2)||(x5<=x1&&x6>=x2))) {\n\t\tif ((y3<=y1&&y4>=y2)&&(y5<=y1&&y6>=y2)) {\n\t\t\tif ((x3<=x1&&x6>=x2&&x4>=x5)||(x5<=x1&&x4>=x2&&x6>=x3)) printf(\"NO\");\n\t\t\telse printf(\"YES\");\n\t\t}\n\t\telse if ((x3<=x1&&x4>=x2)&&(x5<=x1&&x6>=x2)) {\n\t\t\tif ((y3<=y1&&y6>=y2&&y4>=y5)||(y5<=y1&&y4>=y2&&y6>=y3)) printf(\"NO\");\n\t\t\telse printf(\"YES\");\n\t\t}\n\t\telse printf(\"YES\");\n\t}\n\telse printf(\"YES\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define UL 0\n#define UR 1\n#define BL 2\n#define BR 3\n#define h 1\n//printf(\"here! line: %d \", __LINE__); fflush(stdout)\ntypedef unsigned long long\tult;\n\ntypedef struct\ts_po\n{\n\tint x, y;\n}\t\t\t\tt_po;\n\ntypedef struct\ts_sq\n{\n\tint surface, width, height;\n\tt_po corner[4];\n}\t\t\t\tt_sq;\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2);\nint\t\tc_inshape(t_po p, t_sq s);\n\nvoid\tcheck_periphery(t_sq s1, t_sq s2, t_sq s3)\n{\n\tt_sq s = make_square(s2.corner[UL].x - 1, s2.corner[UL].y - 1, s2.corner[BR].x + 1, s2.corner[BR].y + 1);\n\tt_po c1, c2;\n\tt_po inc[4];\n\tinc[UL].x = 1;\n\tinc[UL].y = 0;\n\tinc[UR].x = 0;\n\tinc[UR].y = 1;\n\tinc[BR].x = -1;\n\tinc[BR].y = 0;\n\tinc[BL].x = 0;\n\tinc[BL].y = -1;\n\tint i = -1;\n\th;\n\t//printf(\"\\n\");\n\twhile (++i < 4)\n\t{\n\t\tc1 = s.corner[i];\n\t\tc2 = s.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t{\n\t\t\tif (c_inshape(c1, s1) && !c_inshape(c1, s3))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tc1.x += inc[i].x;\n\t\t\tc1.y += inc[i].y;\n\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t}\n\t}\n\th;\n}\n\nint\t\tc_inshape(t_po p, t_sq s)\n{\n\tif (p.x >= s.corner[UL].x && p.x <= s.corner[BR].x &&\n\t\tp.y >= s.corner[UL].y && p.y <= s.corner[BR].y)\n\t\treturn (1);\n\treturn (0);\n}\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2)\n{\n\tt_sq ret;\n\n\tret.corner[UL].x = x1;\n\tret.corner[UL].y = y1;\n\tret.corner[UR].x = x2;\n\tret.corner[UR].y = y1;\n\tret.corner[BR].x = x2;\n\tret.corner[BR].y = y2;\n\tret.corner[BL].x = x1;\n\tret.corner[BL].y = y2;\n\tret.height = y2 - y1;\n\tret.width = x2 - x1;\n\tret.surface = ret.height * ret.width;\n\treturn (ret); \n}\n\nint\t\tmain()\n{\n\tint x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n\tscanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n\tscanf(\" %d %d %d %d\", &x3, &y3, &x4, &y4);\n\tscanf(\" %d %d %d %d\", &x5, &y5, &x6, &y6);\n\tt_sq s1, s2, s3;\n\tt_po p;\n\ts1 = make_square(x1 * 2, y1 * 2, x2 * 2, y2 * 2);\n\ts2 = make_square(x3 * 2, y3 * 2, x4 * 2, y4 * 2);\n\ts3 = make_square(x5 * 2, y5 * 2, x6 * 2, y6 * 2);\n\th;\n\t// if (s3.surface + s2.surface < s1.surface)\n\t// {\n\t// \tprintf(\"YES\\n\");\n\t// \treturn 0;\n\t// }\n\t// else\n\t// {\n\t// \th;\n\t\t// if ((c_inshape(s1.corner[UL], s2) || c_inshape(s1.corner[UL], s3)) &&\n\t\t// \t(c_inshape(s1.corner[UR], s2) || c_inshape(s1.corner[UR], s3)) &&\n\t\t// \t(c_inshape(s1.corner[BL], s2) || c_inshape(s1.corner[BL], s3)) &&\n\t\t// \t(c_inshape(s1.corner[BR], s2) || c_inshape(s1.corner[BR], s3)))\n\t\t// {\n\t\t\tt_sq s = make_square(s1.corner[UL].x, s1.corner[UL].y, s1.corner[BR].x, s1.corner[BR].y);\n\t\t\tt_po c1, c2;\n\t\t\tt_po inc[4];\n\t\t\tinc[UL].x = 1;\n\t\t\tinc[UL].y = 0;\n\t\t\tinc[UR].x = 0;\n\t\t\tinc[UR].y = 1;\n\t\t\tinc[BR].x = -1;\n\t\t\tinc[BR].y = 0;\n\t\t\tinc[BL].x = 0;\n\t\t\tinc[BL].y = -1;\n\t\t\tint i = -1;\n\t\t\th;\n\t\t\t//printf(\"\\n\");\n\t\t\t//printf(\"s.corner[UL] = (%d, %d), s.corner[BR] = (%d, %d)\\n\", s.corner[UL].x, s.corner[UL].y, s.corner[BR].x, s.corner[BR].y);\n\t\t\twhile (++i < 4)\n\t\t\t{\n\t\t\t\tc1 = s.corner[i];\n\t\t\t\tc2 = s.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\t\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t\t\t{\n\t\t\t\t\t//printf(\"checking point (%d, %d)\\n\", c1.x, c1.y);\n\t\t\t\t\tif (!c_inshape(c1, s2) && !c_inshape(c1, s3))\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\treturn (0);\n\t\t\t\t\t}\n\t\t\t\t\tc1.x += inc[i].x;\n\t\t\t\t\tc1.y += inc[i].y;\n\t\t\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t\t\t}\n\t\t\t}\n\t\t// }\n\t\t// else\n\t\t// {\n\t\t// \tprintf(\"YES\\n\");\n\t\t// \treturn 0;\n\t\t// }\n\t// }\n\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\n\nlong long int fun(int x1,int y1,int X1,int Y1,int x2,int y2,int X2,int Y2)\n{\n\tlong long int A=0;\n\tif(y2<Y1 && y1<Y2 && x2<X1 && x1<X2)\n\t{\n\t\tif(y2<y1) y2=y1;\n\t\tif(Y1<Y2) Y2=Y1;\n\t\tif(x2<x1) x2=x1;\n\t\tif(X1<X2) X2=X1;\n\t\tA=(long long int)(X2-x2)*(Y2-y2);\n\t}\n\treturn A;\n}\n\nint main()\n{\n\tint x1,y1,X1,Y1,x2,y2,X2,Y2,x3,y3,X3,Y3;\n\tscanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&X1,&Y1,&x2,&y2,&X2,&Y2,&x3,&y3,&X3,&Y3);\n\tif(y2<y1) y2=y1;\n\tif(Y1<Y2) Y2=Y1;\n\tif(x2<x1) x2=x1;\n\tif(X1<X2) X2=X1;\n\tif(y3<y1) y3=y1;\n\tif(Y1<Y3) Y3=Y1;\n\tif(x3<x1) x3=x1;\n\tif(X1<X3) X3=X1;\n\tlong long int A1=fun(x1,y1,X1,Y1,x2,y2,X2,Y2);\n\tlong long int A2=fun(x1,y1,X1,Y1,x3,y3,X3,Y3);\n\tlong long int A3=fun(x2,y2,X2,Y2,x3,y3,X3,Y3);\n\tlong long int A=(long long int)(X1-x1)*(Y1-y1);\n\tA=A-A1-A2+A3;\n//\tprintf(\"%lld\\n%lld\\n%lld\\n%lld\\n\",A,A1,A2,A3);\n\tif(A>0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\ndouble wXF, wYF, wXS, wYS;\ndouble aXF, aYF, aXS, aYS;\ndouble bXF, bYF, bXS, bYS;\ndouble sX[6];\nint xC = 0;\ndouble sY[6];\nint yC = 0;\nchar C(double dX, double dY, double xA, double yA, double xB, double yB)\n{\n char mark = 0;\n if (dX >= xA && dX <= xB)\n {\n if (dY >= yA && dY <= yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cE(double dX, double dY)\n{\n char mark = 0;\n if (C(dX, dY, aXF, aYF, aXS, aYS) == 0 && C(dX, dY, bXF, bYF, bXS, bYS) == 0)\n {\n if (C(dX, dY, wXF, wYF, wXS, wYS))\n {\n mark = 1;\n }\n }\n return mark;\n}\nint main()\n{\n int i;\n int a, b;\n scanf(\"%lf %lf %lf %lf\", &wXF, &wYF, &wXS, &wYS);\n sX[xC] = wXF;\n xC++;\n sY[yC] = wYF;\n yC++;\n sX[xC] = wXS;\n xC++;\n sY[yC] = wYS;\n yC++;\n scanf(\"%lf %lf %lf %lf\", &aXF, &aYF, &aXS, &aYS);\n sX[xC] = aXF;\n xC++;\n sY[yC] = aYF;\n yC++;\n sX[xC] = aXS;\n xC++;\n sY[yC] = aYS;\n yC++;\n scanf(\"%lf %lf %lf %lf\", &bXF, &bYF, &bXS, &bYS);\n sX[xC] = bXF;\n xC++;\n sY[yC] = bYF;\n yC++;\n sX[xC] = bXS;\n xC++;\n sY[yC] = bYS;\n yC++;\n for (a = 0; a < xC; a++)\n {\n for (b = 0; b < yC; b++)\n {\n if (cE(sX[a] - 0.5, sY[b]))\n {\n printf(\"YES\");\n break;\n }\n else if (cE(sX[a] + 0.5, sY[b]))\n {\n printf(\"YES\");\n break;\n }\n else if (cE(sX[a], sY[b] - 0.5))\n {\n printf(\"YES\");\n break;\n }\n else if (cE(sX[a], sY[b] + 0.5))\n {\n printf(\"YES\");\n break;\n }\n }\n if (b < yC)\n {\n break;\n }\n }\n if (a == xC)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n unsigned long x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n scanf(\"%lu %lu %lu %lu\",&x1,&y1,&x2,&y2);\n scanf(\"%lu %lu %lu %lu\",&x3,&y3,&x4,&y4);\n scanf(\"%lu %lu %lu %lu\",&x5,&y5,&x6,&y6);\n if (x3<=x1 && x4>=x2)\n {\n if(y4>=y2 && y3<y2 ) y2=y3;\n if(y3<=y1 && y4>y1) y1=y4;\n }\n if (x5<=x1 && x6>=x2)\n {\n if(y6>=y2 && y5<y2 ) y2=y5;\n if(y5<=y1 && y6>y1) y1=y6;\n }\n if (y3<=y1 && y4>=y2)\n {\n if(x4>=x2 && x3<x2 ) x2=x3;\n if(x3<=x1 && x4>x1) x1=x4;\n }\n if (y5<=y1 && y6>=y2)\n {\n if(x6>=x2 && x5<x2 ) x2=x5;\n if(x5<=x1 && x6>x1) x1=x6;\n }\n if (x1>=x2 || y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include<stdio.h>\nstruct mystuct{\n\tint x1,y1,x2,y2;\n};\nint main(void)\n{\n\tstruct mystuct input1,input2,input3;\n\tscanf(\"%d %d %d %d\",&input1.x1,&input1.y1,&input1.x2,&input1.y2);\n\tscanf(\"%d %d %d %d\",&input2.x1,&input2.y1,&input2.x2,&input2.y2);\n\tscanf(\"%d %d %d %d\",&input3.x1,&input3.y1,&input3.x2,&input3.y2);\n\tgetchar(); \n\tif(input2.x1 <= input1.x1 && input2.y1 <= input1.y1 &&\n\t input2.x2 >= input1.x2 && input2.y2 >= input1.y2) printf(\"NO\"); //b\u5168\u8986\u76d6a \n\telse if(input3.x1 <= input1.x1 && input3.y1 <= input1.y1 &&\n\t \t \tinput3.x2 >= input1.x2 && input3.y2 >= input1.y2) printf(\"NO\"); //c\u5168\u8986\u76d6a \n\telse if(input2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.x1 <= input1.x1 && input3.x1 <= input2.x2 && \n\t\t\tinput3.x2 >= input1.x2) printf(\"NO\"); //b,c\u5de6\u53f3\u8986\u76d6 \n\telse if(input3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.x1 <= input1.x1 && input2.x1 <= input3.x2 && \n\t\t\tinput2.x2 >= input1.x2) printf(\"NO\"); //c,b\u5de6\u53f3\u8986\u76d6 \n\telse if(input2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.y1 <= input1.y1 && input3.y2 >= input1.y2 && \n\t\t\tinput2.y2 >= input3.y1) printf(\"NO\"); //b,c\u4e0a\u4e0b\u8986\u76d6 \n\telse if(input3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.y1 <= input1.y1 && input2.y2 >= input1.y2 && \n\t\t\tinput3.y2 >= input2.y1) printf(\"NO\"); //c,b\u4e0a\u4e0b\u8986\u76d6 \n\telse printf(\"YES\"); //\u8fd8\u6709\u767d\u8272\u90e8\u5206\u9732\u51fa \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\nint x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\nscanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\nscanf(\"%d %d %d %d\",&x3,&y3,&x4,&y4);\nscanf(\"%d %d %d %d\",&x5,&y5,&x6,&y6);\nif ((x3<=x1 && y3<=y1 && y5<=y1 && x6>=x2 && y6>=y2 && y4>=y2 && x4>=x5 ) || (x3<=x1 && y3<=y1 && x5<=x1 && x4>=x2 && x6>=x2 && y4>=y5 && y6>=y2) || (x3<=x1 && y3<=y1 && x4>=x2 && y4>=y2) || (x5<=x1 && y5<=y1 && x6>=x2 && y6>=y2) || (x5<=x1 && y5<=y1 && y3<=y1 && x4>=x2 && y4>=y2 && y6>=y2 && x6>=x3 ) || (x5<=x1 && y5<=y1 && x3<=x1 && x6>=x2 && x4>=x2 && y6>=y3 && y4>=y2) )\n{\n printf(\"NO\");\n\n}\nelse\n printf(\"YES\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef struct GG\n{\n int x1,y1,x2,y2;\n};\n\nint main()\n{\n struct GG gg1,gg2,gg3;\n scanf(\"%d%d%d%d\",&gg1.x1,&gg1.y1,&gg1.x2,&gg1.y2);\n scanf(\"%d%d%d%d\",&gg2.x1,&gg2.y1,&gg2.x2,&gg2.y2);\n scanf(\"%d%d%d%d\",&gg3.x1,&gg3.y1,&gg3.x2,&gg3.y2);\n \n getchar();\n \n if(gg2.x1 <= gg1.x1 && gg2.y1 <= gg1.y1 && gg2.x2 >= gg1.x2 && gg2.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//b\u5168\u8986\u76d6a\n \n else if(gg3.x1 <= gg1.x1 && gg3.y1 <= gg1.y1 && gg3.x2 >= gg1.x2 && gg3.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//c\u5168\u8986\u76d6a\n \n else if(gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.x1 <= gg1.x1 && gg3.x1 <= gg2.x2 && gg3.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//b,c\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.x1 <= gg1.x1 && gg2.x1 <= gg3.x2 && gg2.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//c,b\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.x1 <= gg1.x1 && gg3.x2 >= gg1.x2 && gg2.x1 <= gg1.x1 && gg2.x2 >= gg1.x2 && gg3.y1 <= gg1.y1 && gg2.y2 >=gg1.y2 && gg3.y2 >= gg2.y1)\n {\n printf(\"NO\");\n }\n \n else if(gg2.x1 <= gg1 .x1 && gg2.x2 >= gg1.x2 && gg3.x1 <= gg1.x1 && gg3.x2 >= gg1.x2 && gg2.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.y2 >=gg3.y1)\n {\n printf(\"NO\");\n }\n \n else{\n printf(\"YES\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint x[3][2], y[3][2], i;\n\tfor(i=0;i<6;++i) scanf(\"%d %d\", x[0]+i, y[0]+i);\n\tif((x[0][0]>=x[1][0] && y[0][0]>=y[1][0] && x[0][1]<=x[1][1] && y[0][1]<=y[1][1]) ||\n\t\t\t(x[0][0]>=x[2][0] && y[0][0]>=y[2][0] && x[0][1]<=x[2][1] && y[0][1]<=y[2][1])){\n\t\tputs(\"NO\");\n\t\treturn 0;\n\t}\n\tif(x[1][0]<=x[0][0] && x[0][1]<=x[1][1] && x[2][0]<=x[0][0] && x[0][1]<=x[2][1] &&\n\t\t\t((y[1][0]<=y[0][0] && y[1][1]>=y[2][0] && y[0][1]<=y[2][1]) ||\n\t\t\t (y[2][0]<=y[0][0] && y[2][1]>=y[1][0] && y[0][1]<=y[1][1]))){\n\t\tputs(\"NO\");\n\t\treturn 0;\n\t}\n\tif(y[1][0]<=y[0][0] && y[0][1]<=y[1][1] && y[2][0]<=y[0][0] && y[0][1]<=y[2][1] &&\n\t\t\t((x[1][0]<=x[0][0] && x[1][1]>=x[2][0] && x[0][1]<=x[2][1]) ||\n\t\t\t (x[2][0]<=x[0][0] && x[2][1]>=x[1][0] && x[0][1]<=x[1][1]))){\n\t\tputs(\"NO\");\n\t\treturn 0;\n\t}\n\tputs(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\nlong long x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\nscanf(\"%lld %lld %lld %lld\",&x1,&y1,&x2,&y2);\nscanf(\"%lld %lld %lld %lld\",&x3,&y3,&x4,&y4);\nscanf(\"%lld %lld %lld %lld\",&x5,&y5,&x6,&y6);\n\nif((x1-x3)*(x1-x4)<=0 && (x2-x3)*(x2-x4)<=0)\n{\n\n if((y1-y3)*(y1-y4)<=0 && (y2-y3)*(y2-y4)<=0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n if((y1-y3)*(y1-y4)<=0)\n y1=y4;\n if((y2-y3)*(y2-y4)<=0)\n y2=y3;\n}\nif((y1-y3)*(y1-y4)<=0 && (y2-y3)*(y2-y4)<=0)\n{\n if((x1-x3)*(x1-x4)<=0)\n x1=x4;\n if((x2-x3)*(x2-x4)<=0)\n x2=x3;\n}\n\nif((x1-x5)*(x1-x6)<=0 && (x2-x5)*(x2-x6)<=0 && (y1-y5)*(y1-y6)<=0 && (y2-y5)*(y2-y6)<=0)\n printf(\"NO\\n\");\nelse\n printf(\"YES\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6,a[10],b[10];\n int i,j,t;\n scanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x5,&y5,&x6,&y6);\n if(x1>=x3&&x2<=x4&&y1>=y3&&y2<=y4)\n printf(\"NO\");\n else if(x1>=x5&&x2<=x6&&y1>=y5&&y2<=y6)\n printf(\"NO\");\n else\n {\n if(x3>x6||x5>x4||y3>y6||y5>y4)\n {\n if(x1>=x3&&x2<=x4&&y1>=y3&&y2<=y4)\n printf(\"NO\");\n else if(x1>=x5&&x2<=x6&&y1>=y5&&y2<=y6)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else\n {\n a[0]=x3,a[1]=x4,a[2]=x5,a[3]=x6;\n b[0]=y3,b[1]=y4,b[2]=y5,b[3]=y6;\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(a[j]>a[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(b[j]>b[j+1])\n {\n t=b[j];\n b[j]=b[j+1];\n b[j+1]=t;\n }\n }\n if(x1>=a[0]&&x2<=a[3]&&y1>=b[1]&&y2<=b[2])\n printf(\"NO\");\n else if(x1>=a[1]&&x2<=a[2]&&y1>=b[0]&&y2<=b[3])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\ntypedef struct{\n int x;\n int y;\n} point;\n\ntypedef struct{\n point BL;\n point TR;\n} square;\n\nint inside (point w1, point w2, point b1, point b2){\n if (w1.x >= b1.x && w1.y >= b1.y && w2.x <= b2.x && w2.y <= b2.y){\n return 1;\n }\n else {\n return 0;\n }\n}\n\nint main(){\n square w1, b1, b2;\n square left, right, top, bottom;\n scanf(\"%d %d %d %d\", &w1.BL.x, &w1.BL.y, &w1.TR.x, &w1.TR.y);\n scanf(\"%d %d %d %d\", &b1.BL.x, &b1.BL.y, &b1.TR.x, &b1.TR.y);\n scanf(\"%d %d %d %d\", &b2.BL.x, &b2.BL.y, &b2.TR.x, &b2.TR.y);\n \n left = (b1.BL.x<b2.BL.x)?b1:b2;\n right = (b1.BL.x<b2.BL.x)?b2:b1;\n top = (b1.TR.y<b2.TR.y)?b2:b1;\n bottom = (b1.TR.y<b2.TR.y)?b1:b2;\n \n if (w1.BL.x>=b1.BL.x && w1.TR.x<=b1.TR.x\n && w1.BL.y>=b1.BL.y && w1.TR.y<=b1.TR.y || \n w1.BL.x>=b2.BL.x && w1.TR.x<=b2.TR.x\n && w1.BL.y>=b2.BL.y && w1.TR.y<=b2.TR.y){\n printf(\"NO\\n\");\n } else if (left.TR.x>=right.BL.x && w1.BL.y>=b1.BL.y && w1.BL.y>=b2.BL.y\n && w1.TR.y<=b1.TR.y && w1.TR.y<=b2.TR.y\n && w1.BL.x>=left.BL.x && w1.TR.x<=right.TR.x\n ) {\n printf(\"NO\\n\");\n } else if (top.BL.y<=bottom.TR.y && w1.BL.x>=b1.BL.x && w1.BL.x>=b2.BL.x\n && w1.TR.x<=b1.TR.x && w1.TR.x<=b2.TR.x\n && w1.BL.y>=bottom.BL.y && w1.TR.y<=top.TR.y\n ) {\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <ctype.h>\n\nint x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6;\n\nvoid swap(int *a, int *b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}\n\nchar inside(int x, int y, int x1, int y1, int x2, int y2)\n{\n if (x >= x1 && x <= x2 && y >= y1 && y <= y2)\n return 1;\n return 0;\n}\n\nint main()\n{\n scanf(\"%d%d%d%d\", &x1, &y1, &x2, &y2);\n scanf(\"%d%d%d%d\", &x3, &y3, &x4, &y4);\n scanf(\"%d%d%d%d\", &x5, &y5, &x6, &y6);\n\n if (!(inside(x1, y1, x3, y3, x4, y4) || inside(x1, y1, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x2, y2, x3, y3, x4, y4) || inside(x2, y2, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x1, y2, x3, y3, x4, y4) || inside(x1, y2, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x2, y1, x3, y3, x4, y4) || inside(x2, y1, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n\n if (inside(x1, y1, x3, y3, x4, y4) && inside(x2, y1, x3, y3, x4, y4) && inside(x1, y2, x3, y3, x4, y4) && inside(x2, y2, x3, y3, x4, y4)) {\n printf(\"NO\");\n return 0;\n }\n\n if (inside(x1, y1, x5, y5, x6, y6) && inside(x2, y1, x5, y5, x6, y6) && inside(x1, y2, x5, y5, x6, y6) && inside(x2, y2, x5, y5, x6, y6)) {\n printf(\"NO\");\n return 0;\n }\n\n if (x5 < x3) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (x4 + 1 <= x5 && x4 + 1 >= x1 && x4 + 1 <= x2) {\n printf(\"YES\");\n return 0;\n }\n\n if (y6 > y4) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (y3 - 1 >= y6 && y3 - 1 <= y2 && y3 - 1 >= y1) {\n printf(\"YES\");\n return 0;\n }\n\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int x1,y1,x2,y2,x3,x4,x5,x6,y3,y4,y5,y6,x7,x8,x9,x10,x11,x12,y7,y8,y9,y10,y11,y12,s,s1,s2,s3;\n scanf(\"%lld %lld %lld %lld\",&x1,&y1,&x2,&y2);\n scanf(\"%lld %lld %lld %lld\",&x3,&y3,&x4,&y4);\n scanf(\"%lld %lld %lld %lld\",&x5,&y5,&x6,&y6);\n s=(x2-x1)*(y2-y1);\n if(x1>x3)\n {\n x7=x1;\n }\n else\n {\n x7=x3;\n }\n if(y1>y3)\n {\n y7=y1;\n }\n else\n {\n y7=y3;\n }\n if(x2<x4)\n {\n x8=x2;\n }\n else\n {\n x8=x4;\n }\n if(y2<y4)\n {\n y8=y2;\n }\n else\n {\n y8=y4;\n }\n if(x1>x5)\n {\n x9=x1;\n }\n else\n {\n x9=x5;\n }\n if(y1>y5)\n {\n y9=y1;\n }\n else\n {\n y9=y5;\n }\n if(x2<x6)\n {\n x10=x2;\n }\n else\n {\n x10=x6;\n }\n if(y2<y6)\n {\n y10=y2;\n }\n else\n {\n y10=y6;\n }\n if(x8>x7&&y8>y7)\n {\n s1=(x8-x7)*(y8-y7);\n }\n else\n {\n s1=0;\n }\n if(x10>x9&&y10>y9)\n {\n s2=(x10-x9)*(y10-y9);\n }\n else\n {\n s2=0;\n }\n if(s1==0||s2==0)\n {\n if(s1==s||s2==s)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n else\n {\n if(x7>x9)\n {\n x11=x7;\n }\n else\n {\n x11=x9;\n }\n if(y7>y9)\n {\n y11=y7;\n }\n else\n {\n y11=y9;\n }\n if(x8<x10)\n {\n x12=x8;\n }\n else\n {\n x12=x10;\n }\n if(y8<y10)\n {\n y12=y8;\n }\n else\n {\n y12=y10;\n }\n if(x12>x11&&y12>y11)\n {\n s3=(x12-x11)*(y12-y11);\n }\n else\n {\n s3=0;\n }\n if(s1+s2-s3==s)\n {\n printf(\"NO\\n\");\n }\n else\n {\n printf(\"YES\\n\");\n }\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint max(int a,int b)\n{\n\tif(a>b)return a;\n\telse return b;\n}\nint min(int a,int b)\n{\n\tif(a>b)return b;\n\telse return a;\n}\nint main()\n{\n\tint flag=0;\n\tint x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n\tscanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x5,&y5,&x6,&y6);\n\tfor(int i=x1;i<=x2;i++)\n\t{\n\t\tflag=0;\n\t\tif(x4>=i&&x3<i&&x6>=i&&x5<i)\n\t\t{\n\t\t\tif(max(y4,y6)>=y2&&min(y5,y3)<=y1)\n\t\t\t{\n\t\t\t\tif(max(y4,y6)==y4)\n\t\t\t\t{\n\t\t\t\t\tif(y6>=y3)flag=1;\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(y3<=y1)flag=1;\n\t\t\t\t\t\telse if(y6>=y2)flag=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(max(y4,y6)==y6)\n\t\t\t\t{\n\t\t\t\t\tif(y4>=y5)flag=1;\n\t\t\t\t\telse \n\t\t\t\t\t{\n\t\t\t\t\t\tif(y5<=y1)flag=1;\n\t\t\t\t\t\telse if(y4>=y2)flag=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if(x4>=i&&x3<i)\n\t\t{\n\t\t\tif(y4>=y2&&y3<=y1)flag=1;\n\t\t}\n\t\telse if(x6>=i&&x5<i)\n\t\t{\n\t\t\tif(y6>=y2&&y5<=y1)flag=1;\n\t\t}\n\t\tif(flag!=1)\n\t\t{\n\t\t\tflag=-1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==-1)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define UL 0\n#define UR 1\n#define BL 2\n#define BR 3\n#define h 1\n//printf(\"here! line: %d \", __LINE__); fflush(stdout)\ntypedef unsigned long long\tult;\n\ntypedef struct\ts_po\n{\n\tint x, y;\n}\t\t\t\tt_po;\n\ntypedef struct\ts_sq\n{\n\tint surface, width, height;\n\tt_po corner[4];\n}\t\t\t\tt_sq;\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2);\nint\t\tc_inshape(t_po p, t_sq s);\n\nvoid\tcheck_periphery(t_sq s1, t_sq s2, t_sq s3)\n{\n\tt_sq s = make_square(s2.corner[UL].x - 1, s2.corner[UL].y - 1, s2.corner[BR].x + 1, s2.corner[BR].y + 1);\n\tt_po c1, c2;\n\tt_po inc[4];\n\tinc[UL].x = 1;\n\tinc[UL].y = 0;\n\tinc[UR].x = 0;\n\tinc[UR].y = 1;\n\tinc[BR].x = -1;\n\tinc[BR].y = 0;\n\tinc[BL].x = 0;\n\tinc[BL].y = -1;\n\tint i = -1;\n\th;\n\t//printf(\"\\n\");\n\twhile (++i < 4)\n\t{\n\t\tc1 = s2.corner[i];\n\t\tc2 = s2.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t{\n\t\t\tif (c_inshape(c1, s1) && !c_inshape(c1, s3))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tc1.x += inc[i].x;\n\t\t\tc1.y += inc[i].y;\n\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t}\n\t}\n\th;\n}\n\nint\t\tc_inshape(t_po p, t_sq s)\n{\n\tif (p.x >= s.corner[UL].x && p.x <= s.corner[BR].x &&\n\t\tp.y >= s.corner[UL].y && p.y <= s.corner[BR].y)\n\t\treturn (1);\n\treturn (0);\n}\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2)\n{\n\tt_sq ret;\n\n\tret.corner[UL].x = x1;\n\tret.corner[UL].y = y1;\n\tret.corner[UR].x = x2;\n\tret.corner[UR].y = y1;\n\tret.corner[BR].x = x2;\n\tret.corner[BR].y = y2;\n\tret.corner[BL].x = x1;\n\tret.corner[BL].y = y2;\n\tret.height = y2 - y1;\n\tret.width = x2 - x1;\n\tret.surface = ret.height * ret.width;\n\treturn (ret); \n}\n\nint\t\tmain()\n{\n\tint x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n\tscanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n\tscanf(\" %d %d %d %d\", &x3, &y3, &x4, &y4);\n\tscanf(\" %d %d %d %d\", &x5, &y5, &x6, &y6);\n\tt_sq s1, s2, s3;\n\tt_po p;\n\ts1 = make_square(x1, y1, x2, y2);\n\ts2 = make_square(x3, y3, x4, y4);\n\ts3 = make_square(x5, y5, x6, y6);\n\th;\n\tif (s3.surface + s2.surface < s1.surface)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th;\n\t\tif ((c_inshape(s1.corner[UL], s2) || c_inshape(s1.corner[UL], s3)) &&\n\t\t\t(c_inshape(s1.corner[UR], s2) || c_inshape(s1.corner[UR], s3)) &&\n\t\t\t(c_inshape(s1.corner[BL], s2) || c_inshape(s1.corner[BL], s3)) &&\n\t\t\t(c_inshape(s1.corner[BR], s2) || c_inshape(s1.corner[BR], s3)))\n\t\t{\n\t\t\tcheck_periphery(s1, s2, s3);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define UL 0\n#define UR 1\n#define BL 2\n#define BR 3\n#define h 1\n//printf(\"here! line: %d \", __LINE__); fflush(stdout)\ntypedef unsigned long long\tult;\n\ntypedef struct\ts_po\n{\n\tint x, y;\n}\t\t\t\tt_po;\n\ntypedef struct\ts_sq\n{\n\tint surface, width, height;\n\tt_po corner[4];\n}\t\t\t\tt_sq;\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2);\nint\t\tc_inshape(t_po p, t_sq s);\n\nvoid\tcheck_periphery(t_sq s1, t_sq s2, t_sq s3)\n{\n\tt_sq s = make_square(s2.corner[UL].x - 1, s2.corner[UL].y - 1, s2.corner[BR].x + 1, s2.corner[BR].y + 1);\n\tt_po c1, c2;\n\tt_po inc[4];\n\tinc[UL].x = 1;\n\tinc[UL].y = 0;\n\tinc[UR].x = 0;\n\tinc[UR].y = 1;\n\tinc[BR].x = -1;\n\tinc[BR].y = 0;\n\tinc[BL].x = 0;\n\tinc[BL].y = -1;\n\tint i = -1;\n\th;\n\t//printf(\"\\n\");\n\twhile (++i < 4)\n\t{\n\t\tc1 = s.corner[i];\n\t\tc2 = s.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t{\n\t\t\tif (c_inshape(c1, s1) && !c_inshape(c1, s3))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tc1.x += inc[i].x;\n\t\t\tc1.y += inc[i].y;\n\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t}\n\t}\n\th;\n}\n\nint\t\tc_inshape(t_po p, t_sq s)\n{\n\tif (p.x >= s.corner[UL].x && p.x <= s.corner[BR].x &&\n\t\tp.y >= s.corner[UL].y && p.y <= s.corner[BR].y)\n\t\treturn (1);\n\treturn (0);\n}\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2)\n{\n\tt_sq ret;\n\n\tret.corner[UL].x = x1;\n\tret.corner[UL].y = y1;\n\tret.corner[UR].x = x2;\n\tret.corner[UR].y = y1;\n\tret.corner[BR].x = x2;\n\tret.corner[BR].y = y2;\n\tret.corner[BL].x = x1;\n\tret.corner[BL].y = y2;\n\tret.height = y2 - y1;\n\tret.width = x2 - x1;\n\tret.surface = ret.height * ret.width;\n\treturn (ret); \n}\n\nint\t\tmain()\n{\n\tint x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n\tscanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n\tscanf(\" %d %d %d %d\", &x3, &y3, &x4, &y4);\n\tscanf(\" %d %d %d %d\", &x5, &y5, &x6, &y6);\n\tt_sq s1, s2, s3;\n\tt_po p;\n\ts1 = make_square(x1, y1, x2, y2);\n\ts2 = make_square(x3, y3, x4, y4);\n\ts3 = make_square(x5, y5, x6, y6);\n\th;\n\tif (s3.surface + s2.surface < s1.surface)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th;\n\t\tif ((c_inshape(s1.corner[UL], s2) || c_inshape(s1.corner[UL], s3)) &&\n\t\t\t(c_inshape(s1.corner[UR], s2) || c_inshape(s1.corner[UR], s3)) &&\n\t\t\t(c_inshape(s1.corner[BL], s2) || c_inshape(s1.corner[BL], s3)) &&\n\t\t\t(c_inshape(s1.corner[BR], s2) || c_inshape(s1.corner[BR], s3)))\n\t\t{\n\t\t\tcheck_periphery(s1, s2, s3);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define UL 0\n#define UR 1\n#define BL 2\n#define BR 3\n#define h 1\n//printf(\"here! line: %d \", __LINE__); fflush(stdout)\ntypedef unsigned long long\tult;\n\ntypedef struct\ts_po\n{\n\tint x, y;\n}\t\t\t\tt_po;\n\ntypedef struct\ts_sq\n{\n\tint surface, width, height;\n\tt_po corner[4];\n}\t\t\t\tt_sq;\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2);\nint\t\tc_inshape(t_po p, t_sq s);\n\nvoid\tcheck_periphery(t_sq s1, t_sq s2, t_sq s3)\n{\n\tt_sq s = make_square(s2.corner[UL].x - 1, s2.corner[UL].y - 1, s2.corner[BR].x + 1, s2.corner[BR].y + 1);\n\tt_po c1, c2;\n\tt_po inc[4];\n\tinc[UL].x = 1;\n\tinc[UL].y = 0;\n\tinc[UR].x = 0;\n\tinc[UR].y = 1;\n\tinc[BR].x = -1;\n\tinc[BR].y = 0;\n\tinc[BL].x = 0;\n\tinc[BL].y = -1;\n\tint i = -1;\n\th;\n\t//printf(\"\\n\");\n\twhile (++i < 4)\n\t{\n\t\tc1 = s.corner[i];\n\t\tc2 = s.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t{\n\t\t\tif (c_inshape(c1, s1) && !c_inshape(c1, s3))\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\tc1.x += inc[i].x;\n\t\t\tc1.y += inc[i].y;\n\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t}\n\t}\n\th;\n}\n\nint\t\tc_inshape(t_po p, t_sq s)\n{\n\tif (p.x >= s.corner[UL].x && p.x <= s.corner[BR].x &&\n\t\tp.y >= s.corner[UL].y && p.y <= s.corner[BR].y)\n\t\treturn (1);\n\treturn (0);\n}\n\nt_sq\tmake_square(int x1, int y1, int x2, int y2)\n{\n\tt_sq ret;\n\n\tret.corner[UL].x = x1;\n\tret.corner[UL].y = y1;\n\tret.corner[UR].x = x2;\n\tret.corner[UR].y = y1;\n\tret.corner[BR].x = x2;\n\tret.corner[BR].y = y2;\n\tret.corner[BL].x = x1;\n\tret.corner[BL].y = y2;\n\tret.height = y2 - y1;\n\tret.width = x2 - x1;\n\tret.surface = ret.height * ret.width;\n\treturn (ret); \n}\n\nint\t\tmain()\n{\n\tint x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6;\n\tscanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n\tscanf(\" %d %d %d %d\", &x3, &y3, &x4, &y4);\n\tscanf(\" %d %d %d %d\", &x5, &y5, &x6, &y6);\n\tt_sq s1, s2, s3;\n\tt_po p;\n\ts1 = make_square(x1, y1, x2, y2);\n\ts2 = make_square(x3, y3, x4, y4);\n\ts3 = make_square(x5, y5, x6, y6);\n\th;\n\tif (s3.surface + s2.surface < s1.surface)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\th;\n\t\tif ((c_inshape(s1.corner[UL], s2) || c_inshape(s1.corner[UL], s3)) &&\n\t\t\t(c_inshape(s1.corner[UR], s2) || c_inshape(s1.corner[UR], s3)) &&\n\t\t\t(c_inshape(s1.corner[BL], s2) || c_inshape(s1.corner[BL], s3)) &&\n\t\t\t(c_inshape(s1.corner[BR], s2) || c_inshape(s1.corner[BR], s3)))\n\t\t{\n\t\t\tt_sq s = make_square(s1.corner[UL].x, s1.corner[UL].y, s1.corner[BR].x, s1.corner[BR].y);\n\t\t\tt_po c1, c2;\n\t\t\tt_po inc[4];\n\t\t\tinc[UL].x = 1;\n\t\t\tinc[UL].y = 0;\n\t\t\tinc[UR].x = 0;\n\t\t\tinc[UR].y = 1;\n\t\t\tinc[BR].x = -1;\n\t\t\tinc[BR].y = 0;\n\t\t\tinc[BL].x = 0;\n\t\t\tinc[BL].y = -1;\n\t\t\tint i = -1;\n\t\t\th;\n\t\t\t//printf(\"\\n\");\n\t\t\t//printf(\"s.corner[UL] = (%d, %d), s.corner[BR] = (%d, %d)\\n\", s.corner[UL].x, s.corner[UL].y, s.corner[BR].x, s.corner[BR].y);\n\t\t\twhile (++i < 4)\n\t\t\t{\n\t\t\t\tc1 = s.corner[i];\n\t\t\t\tc2 = s.corner[i == UL ? UR : (i == UR ? BR : (i == BR ? BL : UL))];\n\t\t\t\twhile (c1.x != c2.x || c1.y != c2.y)\n\t\t\t\t{\n\t\t\t\t\t//printf(\"checking point (%d, %d)\\n\", c1.x, c1.y);\n\t\t\t\t\tif (!c_inshape(c1, s2) && !c_inshape(c1, s3))\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\t\treturn (0);\n\t\t\t\t\t}\n\t\t\t\t\tc1.x += inc[i].x;\n\t\t\t\t\tc1.y += inc[i].y;\n\t\t\t\t\t//printf(\"\\rc1.x = %d c2.x = %d c1.y = %d c2.y = %d\", c1.x, c2.x, c1.y, c2.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\n\nlong long int fun(int x1,int y1,int X1,int Y1,int x2,int y2,int X2,int Y2)\n{\n\tlong long int A=0;\n\tif(y2<Y1 && y1<Y2 && x2<X1 && x1<X2)\n\t{\n\t\tif(y2<y1) y2=y1;\n\t\tif(Y1<Y2) Y2=Y1;\n\t\tif(x2<x1) x2=x1;\n\t\tif(X1<X2) X2=X1;\n\t\tA=(long long int)(X2-x2)*(Y2-y1);\n\t}\n\treturn A;\n}\n\nint main()\n{\n\tint x1,y1,X1,Y1,x2,y2,X2,Y2,x3,y3,X3,Y3;\n\tscanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&X1,&Y1,&x2,&y2,&X2,&Y2,&x3,&y3,&X3,&Y3);\n\tif(y2<y1) y2=y1;\n\tif(Y1<Y2) Y2=Y1;\n\tif(x2<x1) x2=x1;\n\tif(X1<X2) X2=X1;\n\tif(y3<y1) y3=y1;\n\tif(Y1<Y3) Y3=Y1;\n\tif(x3<x1) x3=x1;\n\tif(X1<X3) X3=X1;\n\tlong long int A1=fun(x1,y1,X1,Y1,x2,y2,X2,Y2);\n\tlong long int A2=fun(x1,y1,X1,Y1,x3,y3,X3,Y3);\n\tlong long int A3=fun(x2,y2,X2,Y2,x3,y3,X3,Y3);\n\tlong long int A=(long long int)(X1-x1)*(Y1-y1);\n\tA=A-A1-A2+A3;\n//\tprintf(\"%lld\\n%lld\\n%lld\\n%lld\\n\",A,A1,A2,A3);\n\tif(A>0) printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint wXF, wYF, wXS, wYS;\nint aXF, aYF, aXS, aYS;\nint bXF, bYF, bXS, bYS;\nint sX[6];\nint xC = 0;\nint dX[6];\nint sY[6];\nint yC = 0;\nint dY[6];\nchar cB(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX > xA && dX < xB)\n {\n if (dY > yA && dY < yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cW(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX >= xA && dX <= xB)\n {\n if (dY >= yA && dY <= yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cE(int dX, int dY)\n{\n char mark = 0;\n if (cB(dX, dY, aXF, aYF, aXS, aYS) == 0 && cB(dX, dY, bXF, bYF, bXS, bYS) == 0)\n {\n if (cW(dX, dY, wXF, wYF, wXS, wYS))\n {\n mark = 1;\n }\n }\n return mark;\n}\nvoid mS(int s[], int d[], int o, int t)\n{\n int i, j, k;\n int c = (o + t) / 2;\n if (o < c)\n {\n mS(d, s, o, c);\n }\n if (c + 1 < t)\n {\n mS(d, s, c + 1, t);\n }\n i = o;\n j = c + 1;\n k = o;\n while (i <= c && j <= t)\n {\n if (s[i] < s[j])\n {\n d[k] = s[i];\n i++;\n }\n else\n {\n d[k] = s[j];\n j++;\n }\n k++;\n }\n while (i <= c)\n {\n d[k] = s[i];\n i++;\n k++;\n }\n while (j <= t)\n {\n d[k] = s[j];\n j++;\n k++;\n }\n}\nint main()\n{\n int i;\n int a, b;\n scanf(\"%d %d %d %d\", &wXF, &wYF, &wXS, &wYS);\n sX[xC] = wXF;\n xC++;\n sY[yC] = wYF;\n yC++;\n sX[xC] = wXS;\n xC++;\n sY[yC] = wYS;\n yC++;\n scanf(\"%d %d %d %d\", &aXF, &aYF, &aXS, &aYS);\n sX[xC] = aXF;\n xC++;\n sY[yC] = aYF;\n yC++;\n sX[xC] = aXS;\n xC++;\n sY[yC] = aYS;\n yC++;\n scanf(\"%d %d %d %d\", &bXF, &bYF, &bXS, &bYS);\n sX[xC] = bXF;\n xC++;\n sY[yC] = bYF;\n yC++;\n sX[xC] = bXS;\n xC++;\n sY[yC] = bYS;\n yC++;\n for (i = 0; i < 6; i++)\n {\n dX[i] = sX[i];\n }\n for (i = 0; i < 6; i++)\n {\n dY[i] = sY[i];\n }\n mS(sX, dX, 0, 5);\n mS(sY, dY, 0, 5);\n sX[0] = dX[0];\n xC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dX[i] > sX[xC - 1])\n {\n sX[xC] = dX[i];\n xC++;\n }\n }\n sY[0] = dY[0];\n yC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dY[i] > sY[yC - 1])\n {\n sY[yC] = dY[i];\n yC++;\n }\n }\n for (a = 0; a < xC - 1; a++)\n {\n for (b = 0; b < yC - 1; b++)\n {\n if (cE(sX[a], sY[b]))\n {\n if (cE(sX[a + 1], sY[b]) && cE(sX[a], sY[b + 1]))\n {\n printf(\"YES\");\n break;\n }\n }\n }\n if (b < yC - 1)\n {\n break;\n }\n }\n if (a == xC - 1)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint wXF, wYF, wXS, wYS;\nint aXF, aYF, aXS, aYS;\nint bXF, bYF, bXS, bYS;\nint sX[6];\nint xC = 0;\nint dX[6];\nint sY[6];\nint yC = 0;\nint dY[6];\nchar cB(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX > xA && dX < xB)\n {\n if (dY > yA && dY < yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cW(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX >= xA && dX <= xB)\n {\n if (dY >= yA && dY <= yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cE(int dX, int dY)\n{\n char mark = 0;\n if (cB(dX, dY, aXF, aYF, aXS, aYS) == 0 && cB(dX, dY, bXF, bYF, bXS, bYS) == 0)\n {\n if (cW(dX, dY, wXF, wYF, wXS, wYS))\n {\n mark = 1;\n }\n }\n return mark;\n}\nvoid mS(int s[], int d[], int o, int t)\n{\n int i, j, k;\n int c = (o + t) / 2;\n if (o < c)\n {\n mS(d, s, o, c);\n }\n if (c + 1 < t)\n {\n mS(d, s, c + 1, t);\n }\n i = o;\n j = c + 1;\n k = o;\n while (i <= c && j <= t)\n {\n if (s[i] < s[j])\n {\n d[k] = s[i];\n i++;\n }\n else\n {\n d[k] = s[j];\n j++;\n }\n k++;\n }\n while (i <= c)\n {\n d[k] = s[i];\n i++;\n k++;\n }\n while (j <= t)\n {\n d[k] = s[j];\n j++;\n k++;\n }\n}\nint main()\n{\n int i;\n int a, b;\n scanf(\"%d %d %d %d\", &wXF, &wYF, &wXS, &wYS);\n sX[xC] = wXF;\n xC++;\n sY[yC] = wYF;\n yC++;\n sX[xC] = wXS;\n xC++;\n sY[yC] = wYS;\n yC++;\n scanf(\"%d %d %d %d\", &aXF, &aYF, &aXS, &aYS);\n sX[xC] = aXF;\n xC++;\n sY[yC] = aYF;\n yC++;\n sX[xC] = aXS;\n xC++;\n sY[yC] = aYS;\n yC++;\n scanf(\"%d %d %d %d\", &bXF, &bYF, &bXS, &bYS);\n sX[xC] = bXF;\n xC++;\n sY[yC] = bYF;\n yC++;\n sX[xC] = bXS;\n xC++;\n sY[yC] = bYS;\n yC++;\n for (i = 0; i < 6; i++)\n {\n dX[i] = sX[i];\n }\n for (i = 0; i < 6; i++)\n {\n dY[i] = sY[i];\n }\n mS(sX, dX, 0, 5);\n mS(sY, dY, 0, 5);\n sX[0] = dX[0];\n xC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dX[i] > sX[xC - 1])\n {\n sX[xC] = dX[i];\n xC++;\n }\n }\n sY[0] = dY[0];\n yC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dY[i] > sY[yC - 1])\n {\n sY[yC] = dY[i];\n yC++;\n }\n }\n if (xC > 2 || yC > 2)\n {\n for (a = 0; a < xC - 1; a++)\n {\n for (b = 0; b < yC - 1; b++)\n {\n if (cE(sX[a], sY[b]))\n {\n if (cE(sX[a + 1], sY[b]) && cE(sX[a], sY[b + 1]))\n {\n printf(\"YES\");\n break;\n }\n }\n }\n if (b < yC - 1)\n {\n break;\n }\n }\n if (a == xC - 1)\n {\n printf(\"NO\");\n }\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint sX[6];\nint xC = 0;\nint dX[6];\nint sY[6];\nint yC = 0;\nint dY[6];\nchar cB(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX > xA && dX < xB)\n {\n if (dY > yA && dY < yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nchar cW(int dX, int dY, int xA, int yA, int xB, int yB)\n{\n char mark = 0;\n if (dX >= xA && dX <= xB)\n {\n if (dY >= yA && dY <= yB)\n {\n mark = 1;\n }\n }\n return mark;\n}\nvoid mS(int s[], int d[], int o, int t)\n{\n int i, j, k;\n int c = (o + t) / 2;\n if (o < c)\n {\n mS(d, s, o, c);\n }\n if (c + 1 < t)\n {\n mS(d, s, c + 1, t);\n }\n i = o;\n j = c + 1;\n k = o;\n while (i <= c && j <= t)\n {\n if (s[i] < s[j])\n {\n d[k] = s[i];\n i++;\n }\n else\n {\n d[k] = s[j];\n j++;\n }\n k++;\n }\n while (i <= c)\n {\n d[k] = s[i];\n i++;\n k++;\n }\n while (j <= t)\n {\n d[k] = s[j];\n j++;\n k++;\n }\n}\nint main()\n{\n int i;\n int a, b;\n int wXF, wYF, wXS, wYS;\n int aXF, aYF, aXS, aYS;\n int bXF, bYF, bXS, bYS;\n scanf(\"%d %d %d %d\", &wXF, &wYF, &wXS, &wYS);\n sX[xC] = wXF;\n xC++;\n sY[yC] = wYF;\n yC++;\n sX[xC] = wXS;\n xC++;\n sY[yC] = wYS;\n yC++;\n scanf(\"%d %d %d %d\", &aXF, &aYF, &aXS, &aYS);\n sX[xC] = aXF;\n xC++;\n sY[yC] = aYF;\n yC++;\n sX[xC] = aXS;\n xC++;\n sY[yC] = aYS;\n yC++;\n scanf(\"%d %d %d %d\", &bXF, &bYF, &bXS, &bYS);\n sX[xC] = bXF;\n xC++;\n sY[yC] = bYF;\n yC++;\n sX[xC] = bXS;\n xC++;\n sY[yC] = bYS;\n yC++;\n for (i = 0; i < 6; i++)\n {\n dX[i] = sX[i];\n }\n for (i = 0; i < 6; i++)\n {\n dY[i] = sY[i];\n }\n mS(sX, dX, 0, 5);\n mS(sY, dY, 0, 5);\n sX[0] = dX[0];\n xC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dX[i] > sX[xC - 1])\n {\n sX[xC] = dX[i];\n xC++;\n }\n }\n sY[0] = dY[0];\n yC = 1;\n for (i = 1; i < 6; i++)\n {\n if (dY[i] > sY[yC - 1])\n {\n sY[yC] = dY[i];\n yC++;\n }\n }\n for (a = 0; a < xC - 1; a++)\n {\n for (b = 0; b < yC; b++)\n {\n if (cB(sX[a], sY[b], aXF, aYF, aXS, aYS) == 0 && cB(sX[a], sY[b], bXF, bYF, bXS, bYS) == 0)\n {\n if (cW(sX[a], sY[b], wXF, wYF, wXS, wYS))\n {\n if (cB(sX[a + 1], sY[b], aXF, aYF, aXS, aYS) == 0 && cB(sX[a + 1], sY[b], bXF, bYF, bXS, bYS) == 0)\n {\n if (cW(sX[a + 1], sY[b], wXF, wYF, wXS, wYS))\n {\n printf(\"YES\");\n break;\n }\n }\n }\n }\n }\n if (b < yC)\n {\n break;\n }\n }\n if (a == xC - 1)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n unsigned long x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n scanf(\"%lu %lu %lu %lu\",&x1,&y1,&x2,&y2);\n scanf(\"%lu %lu %lu %lu\",&x3,&y3,&x4,&y4);\n scanf(\"%lu %lu %lu %lu\",&x5,&y5,&x6,&y6);\n if (x3<=x1 && x4>=x2)\n {\n if(y4>=y2 && y3<y2 ) y2=y3;\n if(y3<=y1 && y4<=y1) y1=y4;\n }\n if (x5<=x1 && x6>=x2)\n {\n if(y6>=y2 && y5<y2 ) y2=y5;\n if(y5<=y1 && y6<=y1) y1=y6;\n }\n if (y3<=y1 && y4>=y2)\n {\n if(x4>=x2 && x3<x2 ) x2=x3;\n if(x3<=x1 && x4<=x1) x1=x4;\n }\n if (y5<=y1 && y6>=y2)\n {\n if(x6>=x2 && x5<x2 ) x2=x5;\n if(x5<=x1 && x6<=x1) x1=x6;\n }\n if (x1>=x2 && y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n unsigned long x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n scanf(\"%lu %lu %lu %lu\",&x1,&y1,&x2,&y2);\n scanf(\"%lu %lu %lu %lu\",&x3,&y3,&x4,&y4);\n scanf(\"%lu %lu %lu %lu\",&x5,&y5,&x6,&y6);\n if (((y5<=y1 && y6>=y3 && y4>=y2) || (y3<=y1 && y4>=y5 && y6>=y2)) && (x3<=x1) && (x5<=x1) && (x4>=x2) && (x6>=x2) )\n printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n unsigned long x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\n scanf(\"%lu %lu %lu %lu\",&x1,&y1,&x2,&y2);\n scanf(\"%lu %lu %lu %lu\",&x3,&y3,&x4,&y4);\n scanf(\"%lu %lu %lu %lu\",&x5,&y5,&x6,&y6);\n if (x3<=x1 && x4>=x2)\n {\n if(y4>=y2 && y3<y2 ) y2=y3;\n if(y3<=y1 && y4<=y1) y1=y4;\n }\n if (x5<=x1 && x6>=x2)\n {\n if(y6>=y2 && y5<y2 ) y2=y5;\n if(y5<=y1 && y6<=y1) y1=y6;\n }\n if (y3<=y1 && y4>=y2)\n {\n if(x4>=x2 && x3<x2 ) x2=x3;\n if(x3<=x1 && x4<=x1) x1=x4;\n }\n if (y5<=y1 && y6>=y2)\n {\n if(x6>=x2 && x5<x2 ) x2=x5;\n if(x5<=x1 && x6<=x1) x1=x6;\n }\n if (x1>=x2 || y1>=y2) printf(\"NO\");\n else printf(\"YES\");\n \n}\n"}, {"source_code": "#include<stdio.h>\nstruct mystuct{\n\tint x1,y1,x2,y2;\n};\nint main(void)\n{\n\tstruct mystuct input1,input2,input3;\n\tscanf(\"%d %d %d %d\",&input1.x1,&input1.y1,&input1.x2,&input1.y2);\n\tscanf(\"%d %d %d %d\",&input2.x1,&input2.y1,&input2.x2,&input2.y2);\n\tscanf(\"%d %d %d %d\",&input3.x1,&input3.y1,&input3.x2,&input3.y2);\n\tgetchar(); \n\tif(input2.x1 <= input1.x1 && input2.y1 <= input1.y1 &&\n\t input2.x2 >= input1.x2 && input2.y2 >= input1.y2) printf(\"NO\"); //b\u5168\u8986\u76d6a \n\telse if(input3.x1 <= input1.x1 && input3.y1 <= input1.y1 &&\n\t \t \tinput3.x2 >= input1.x2 && input3.y2 >= input1.y2) printf(\"NO\"); //c\u5168\u8986\u76d6a \n\telse if(input2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.x1 <= input1.x1 && input3.x1 <= input2.x2 && \n\t\t\tinput3.x2 >= input1.x2) printf(\"NO\"); //b,c\u5de6\u53f3\u8986\u76d6 \n\telse if(input3.y1 <= input1.y1 && input3.y2 >= input1.y2 &&\n\t\t\tinput2.y1 <= input1.y1 && input2.y2 >= input1.y2 &&\n\t\t\tinput3.x1 <= input1.x1 && input2.x1 <= input3.x2 && \n\t\t\tinput2.x2 >= input1.x2) printf(\"NO\"); //c,b\u5de6\u53f3\u8986\u76d6 \n\telse if(input2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.y1 >= input1.y2 && input3.y1 >= input2.y1 &&\n\t\t\tinput3.y2 >= input1.y2 && input2.y2 >= input1.y2) printf(\"NO\"); //b,c\u4e0a\u4e0b\u8986\u76d6 \n\telse if(input3.x1 <= input1.x1 && input3.x2 >= input1.x2 &&\n\t\t\tinput2.x1 <= input1.x1 && input2.x2 >= input1.x2 &&\n\t\t\tinput3.y1 >= input1.y2 && input2.y1 >= input3.y1 &&\n\t\t\tinput2.y2 >= input1.y2 && input3.y2 >= input1.y2) printf(\"NO\"); //c,b\u4e0a\u4e0b\u8986\u76d6 \n\telse printf(\"YES\"); //\u8fd8\u6709\u767d\u8272\u90e8\u5206\u9732\u51fa \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\ntypedef struct GG\n{\n int x1,y1,x2,y2;\n};\n\nint main()\n{\n struct GG gg1,gg2,gg3;\n scanf(\"%d%d%d%d\",&gg1.x1,&gg1.y1,&gg1.x2,&gg1.y2);\n scanf(\"%d%d%d%d\",&gg2.x1,&gg2.y1,&gg2.x2,&gg2.y2);\n scanf(\"%d%d%d%d\",&gg3.x1,&gg3.y1,&gg3.x2,&gg3.y2);\n \n getchar();\n \n if(gg2.x1 <= gg1.x1 && gg2.y1 <= gg1.y1 && gg2.x2 >= gg1.x2 && gg2.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//b\u5168\u8986\u76d6a\n \n else if(gg3.x1 <= gg1.x1 && gg3.y1 <= gg1.y1 && gg3.x2 >= gg1.x2 && gg3.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//c\u5168\u8986\u76d6a\n \n else if(gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.x1 <= gg1.x1 && gg3.x1 <= gg2.x2 && gg3.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//b,c\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.x1 <= gg1.x1 && gg2.x1 <= gg3.x2 && gg2.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//c,b\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.x1 <= gg1.x1 && gg3.x2 >= gg1.x2 && gg2.x1 <= gg1.x1 && gg2.x2 >= gg1.x2 && gg3.y1 <= gg1.y1 && gg2.y2 >=gg1.y2 && gg3.y2 >= gg2.y1)\n {\n printf(\"NO\");\n }\n \n else if(gg3.x1 <= gg1.x1 && gg3.x2 >= gg1.x2 && gg2.x1 <+ gg1.x1 && gg2.x2 >= gg1.x2 && gg3.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.y2 >= gg2.y1)\n {\n printf(\"NO\");\n }\n \n else{\n printf(\"YES\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef struct GG\n{\n int x1,y1,x2,y2;\n};\n\nint main()\n{\n struct GG gg1,gg2,gg3;\n scanf(\"%d%d%d%d\",&gg1.x1,&gg1.y1,&gg1.x2,&gg1.y2);\n scanf(\"%d%d%d%d\",&gg2.x1,&gg2.y1,&gg2.x2,&gg2.y2);\n scanf(\"%d%d%d%d\",&gg3.x1,&gg3.y1,&gg3.x2,&gg3.y2);\n \n getchar();\n \n if(gg2.x1 <= gg1.x1 && gg2.y1 <= gg1.y1 && gg2.x2 >= gg1.x2 && gg2.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//b\u5168\u8986\u76d6a\n \n else if(gg3.x1 <= gg1.x1 && gg3.y1 <= gg1.y1 && gg3.x2 >= gg1.x2 && gg3.y2 >= gg1.y2)\n {\n printf(\"NO\");\n }//c\u5168\u8986\u76d6a\n \n else if(gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.x1 <= gg1.x1 && gg3.x1 <= gg2.x2 && gg3.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//b,c\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.y1 <= gg1.y1 && gg3.y2 >= gg1.y2 && gg2.y1 <= gg1.y1 && gg2.y2 >= gg1.y2 && gg3.x1 <= gg1.x1 && gg2.x1 <= gg3.x2 && gg2.x2 >= gg1.x2)\n {\n printf(\"NO\");\n }//c,b\u5de6\u53f3\u8986\u76d6\n \n else if(gg3.x1 <= gg1.x1 && gg3.x2 >= gg1.x2 && gg2.x1 <= gg1.x1 && gg2.x2 >= gg1.x2 && gg3.y1 <= gg1.y1 && gg2.y2 >=gg1.y2 && gg3.y2 >= gg2.y1)\n {\n printf(\"NO\");\n }\n \n else{\n printf(\"YES\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\nint x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;\nscanf(\"%d %d %d %d\",&x1,&y1,&x2,&y2);\nscanf(\"%d %d %d %d\",&x3,&y3,&x4,&y4);\nscanf(\"%d %d %d %d\",&x5,&y5,&x6,&y6);\n\nif((x1-x3)*(x1-x4)<=0 && (x2-x3)*(x2-x4)<=0)\n{\n\n if((y1-y3)*(y1-y4)<=0 && (y2-y3)*(y2-y4)<=0)\n {\n printf(\"NO\\n\");\n return 0;\n }\n if((y1-y3)*(y1-y4)<=0)\n y1=y4;\n if((y2-y3)*(y2-y4)<=0)\n y2=y3;\n}\nif((y1-y3)*(y1-y4)<=0 && (y2-y3)*(y2-y4)<=0)\n{\n if((x1-x3)*(x1-x4)<=0)\n x1=x4;\n if((x2-x3)*(x2-x4)<=0)\n x2=x3;\n}\n\nif((x1-x5)*(x1-x6)<=0 && (x2-x5)*(x2-x6)<=0 && (y1-y5)*(y1-y6)<=0 && (y2-y5)*(y2-y6)<=0)\n printf(\"NO\\n\");\nelse\n printf(\"YES\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6,a[10],b[10];\n int i,j,t;\n scanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x5,&y5,&x6,&y6);\n if(x3>x6||x5>x4||y3>y6||y5>y4)\n {\n if(x1>=x3&&x2<=x4&&y1>=y3&&y2<=y4)\n printf(\"NO\");\n else if(x1>=x5&&x2<=x6&&y1>=y5&&y2<=y6)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else\n {\n a[0]=x3,a[1]=x4,a[2]=x5,a[3]=x6;\n b[0]=y3,b[1]=y4,b[2]=y5,b[3]=y6;\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(a[j]>a[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(b[j]>b[j+1])\n {\n t=b[j];\n b[j]=b[j+1];\n b[j+1]=t;\n }\n }\n if(x1>=a[0]&&x2<=a[3]&&y1>=b[1]&&y2<=b[2])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6,a[10],b[10];\n int i,j,t;\n scanf(\"%d%d%d%d%d%d%d%d%d%d%d%d\",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x5,&y5,&x6,&y6);\n if(x3>x6||x5>x4||y3>y6||y5>y4)\n {\n if(x1>=x3&&x2<=x4&&y1>=y3&&y2<=y4)\n printf(\"NO\");\n else if(x1>=x5&&x2<=x6&&y1>=y5&&y2<=y6)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else\n {\n a[0]=x3,a[1]=x4,a[2]=x5,a[3]=x6;\n b[0]=y3,b[1]=y4,b[2]=y5,b[3]=y6;\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(a[j]>a[j+1])\n {\n t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n for(i=0; i<3; i++)\n for(j=0; j<3-i; j++)\n {\n if(b[j]>b[j+1])\n {\n t=b[j];\n b[j]=b[j+1];\n b[j+1]=t;\n }\n }\n if(x1>=a[0]&&x2<=a[3]&&y1>=b[1]&&y2<=b[2])\n printf(\"NO\");\n else if(x1>=a[1]&&x2<=a[2]&&y1>=b[0]&&y2<=b[3])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\ntypedef struct{\n int x;\n int y;\n} point;\n\ntypedef struct{\n point BL;\n point TR;\n} square;\n\nint inside (point w1, point w2, point b1, point b2){\n if (w1.x >= b1.x && w1.y >= b1.y && w2.x <= b2.x && w2.y <= b2.y){\n return 1;\n }\n else {\n return 0;\n }\n}\n\nint main(){\n square w1, b1, b2;\n square left, right, top, bottom;\n scanf(\"%d %d %d %d\", &w1.BL.x, &w1.BL.y, &w1.TR.x, &w1.TR.y);\n scanf(\"%d %d %d %d\", &b1.BL.x, &b1.BL.y, &b1.TR.x, &b1.TR.y);\n scanf(\"%d %d %d %d\", &b2.BL.x, &b2.BL.y, &b2.TR.x, &b2.TR.y);\n \n left = (b1.BL.x<b2.BL.x)?b1:b2;\n right = (b1.BL.x<b2.BL.x)?b2:b1;\n top = (b1.TR.y<b2.TR.y)?b2:b1;\n bottom = (b1.TR.y<b2.TR.y)?b1:b2;\n \n if (w1.BL.x>=b1.BL.x && w1.TR.x<=b1.TR.x\n && w1.BL.y>=b1.BL.y && w1.TR.y<=b1.TR.y || \n w1.BL.x>=b2.BL.x && w1.TR.x<=b2.TR.x\n && w1.BL.y>=b2.BL.y && w1.TR.y<=b2.TR.y){\n printf(\"NO\\n\");\n } else if (left.TR.x==right.BL.x && w1.BL.y>=b1.BL.y && w1.BL.y>=b2.BL.y\n && w1.TR.y<=b1.TR.y && w1.TR.y<=b2.TR.y\n && w1.BL.x>=left.BL.x && w1.TR.x<=right.TR.x\n ) {\n printf(\"NO\\n\");\n } else if (top.BL.y==bottom.TR.y && w1.BL.x>=b1.BL.x && w1.BL.x>=b2.BL.x\n && w1.TR.x<=b1.TR.x && w1.TR.x<=b2.TR.x\n && w1.BL.y>=bottom.BL.y && w1.TR.y<=top.TR.y\n ) {\n printf(\"NO\\n\");\n } else {\n printf(\"YES\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <ctype.h>\n\nint x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6;\n\nvoid swap(int *a, int *b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}\n\nchar inside(int x, int y, int x1, int y1, int x2, int y2)\n{\n if (x >= x1 && x <= x2 && y >= y1 && y <= y2)\n return 1;\n return 0;\n}\n\nint main()\n{\n scanf(\"%d%d%d%d\", &x1, &y1, &x2, &y2);\n scanf(\"%d%d%d%d\", &x3, &y3, &x4, &y4);\n scanf(\"%d%d%d%d\", &x5, &y5, &x6, &y6);\n\n if (!(inside(x1, y1, x3, y3, x4, y4) || inside(x1, y1, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x2, y2, x3, y3, x4, y4) || inside(x2, y2, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x1, y2, x3, y3, x4, y4) || inside(x1, y2, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n if (!(inside(x2, y1, x3, y3, x4, y4) || inside(x2, y1, x5, y5, x6, y6))) {\n printf(\"YES\");\n return 0;\n }\n\n if (x5 < x3) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (x4 + 1 <= x5 && x4 + 1 >= x1 && x4 + 1 <= x2) {\n printf(\"YES\");\n return 0;\n }\n\n if (y6 > y4) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (y3 - 1 >= y6 && y3 - 1 <= y2 && y3 - 1 >= y1) {\n printf(\"YES\");\n return 0;\n }\n\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <ctype.h>\n\nint x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6;\n\nvoid swap(int *a, int *b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}\n\nchar inside(int x, int y, int x1, int y1, int x2, int y2)\n{\n if (x >= x1 && x <= x2 && y >= y1 && y <= y2)\n return 1;\n return 0;\n}\n\nint main(int argc, char *argv[])\n{\n scanf(\"%d%d%d%d\", &x1, &y1, &x2, &y2);\n scanf(\"%d%d%d%d\", &x3, &y3, &x4, &y4);\n scanf(\"%d%d%d%d\", &x5, &y5, &x6, &y6);\n\n if (!(inside(x1, y1, x3, y3, x4, y4) || inside(x1, y1, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x2, y2, x3, y3, x4, y4) || inside(x2, y2, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x1, y2, x3, y3, x4, y4) || inside(x1, y2, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x2, y1, x3, y3, x4, y4) || inside(x2, y1, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n\n if (x5 < x3) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if ((x4 + 1 <= x5 || x4 + 1 >= x6) && x4 + 1 >= x1 && x4 + 1 <= x2) {\n printf(\"YES\\n\");\n return 0;\n }\n\n if (y6 > y4) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if ((y3 - 1 >= y6 || y3 - 1 >= y5) && y3 - 1 <= y2 && y3 - 1 >= y1) {\n printf(\"YES\\n\");\n return 0;\n }\n\n printf(\"NO\\n\");\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <ctype.h>\n\nint x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6;\n\nvoid swap(int *a, int *b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}\n\nchar inside(int x, int y, int x1, int y1, int x2, int y2)\n{\n if (x >= x1 && x <= x2 && y >= y1 && y <= y2)\n return 1;\n return 0;\n}\n\nint main(int argc, char *argv[])\n{\n scanf(\"%d%d%d%d\", &x1, &y1, &x2, &y2);\n scanf(\"%d%d%d%d\", &x3, &y3, &x4, &y4);\n scanf(\"%d%d%d%d\", &x5, &y5, &x6, &y6);\n\n if (!(inside(x1, y1, x3, y3, x4, y4) || inside(x1, y1, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x2, y2, x3, y3, x4, y4) || inside(x2, y2, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x1, y2, x3, y3, x4, y4) || inside(x1, y2, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n if (!(inside(x2, y1, x3, y3, x4, y4) || inside(x2, y1, x5, y5, x6, y6))) {\n printf(\"YES\\n\");\n return 0;\n }\n\n if (x5 < x3) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (x4 + 1 <= x5 && x4 + 1 > x1 && x4 + 1 < x2) {\n printf(\"YES\\n\");\n return 0;\n }\n\n if (y6 > y4) {\n swap(&x3, &x5);\n swap(&x4, &x6);\n swap(&y3, &y5);\n swap(&y4, &y6);\n }\n if (y3 - 1 >= y6 && y3 - 1 < y2 && y3 - 1 > y1) {\n printf(\"YES\\n\");\n return 0;\n }\n\n printf(\"NO\\n\");\n\n return 0;\n}\n\n"}], "src_uid": "05c90c1d75d76a522241af6bb6af7781"} {"nl": {"description": "To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.5, 1 and 2 liters in volume. At that, there are exactly a bottles 0.5 in volume, b one-liter bottles and c of two-liter ones. The organizers have enough money to buy any amount of cola. What did cause the heated arguments was how many bottles of every kind to buy, as this question is pivotal for the distribution of cola among the participants (and organizers as well).Thus, while the organizers are having the argument, discussing different variants of buying cola, the Winter School can't start. Your task is to count the number of all the possible ways to buy exactly n liters of cola and persuade the organizers that this number is too large, and if they keep on arguing, then the Winter Computer School will have to be organized in summer.All the bottles of cola are considered indistinguishable, i.e. two variants of buying are different from each other only if they differ in the number of bottles of at least one kind.", "input_spec": "The first line contains four integers \u2014 n, a, b, c (1\u2009\u2264\u2009n\u2009\u2264\u200910000, 0\u2009\u2264\u2009a,\u2009b,\u2009c\u2009\u2264\u20095000).", "output_spec": "Print the unique number \u2014 the solution to the problem. If it is impossible to buy exactly n liters of cola, print 0. ", "sample_inputs": ["10 5 5 5", "3 0 0 2"], "sample_outputs": ["9", "0"], "notes": null}, "positive_code": [{"source_code": "#include <memory.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <math.h>\n\ntypedef long long ll;\n\nint main ()\n{\n int n, a, b, c; scanf (\"%d%d%d%d\", &n, &a, &b, &c);\n n <<= 1;\n int ans = 0;\n for (int ta = 0; ta <= a; ta++)\n {\n for (int tb = 0; tb <= b; tb++)\n {\n int cnt = ta + (tb << 1);\n if (cnt > n) continue;\n if ((n - cnt) % 4) continue;\n int tc = (n - cnt) / 4;\n if (tc <= c)\n ans++;\n }\n }\n printf (\"%d\\n\", ans);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, a, b, c;\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n int cnt = 0;\n for(int i = 0; i <= a/2; i++)\n {\n for(int j = 0; j <= c; j++)\n {\n int val = n-i-j*2;\n if(val >= 0 && val <= b)\n cnt++;\n }\n }\n printf(\"%d\\n\", cnt);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main ()\n{\n\tint N, A, B, C;\n\tscanf(\"%d %d %d %d\",&N,&A,&B,&C);\n\tN *= 2;\n\tint res = 0;\n\tint x, y;\n\tint rem;\n\tfor (x = 0; x <= B; x++)\n\t{\n\t\tfor (y = 0; y <= C; y++)\n\t\t{\n\t\t\trem = N - 2 * x - 4 * y;\n\t\t\tif ((rem >= 0) && (rem <= A)) res++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",res);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAXM 20005\nlong n;\nlong long f[4][MAXM]={0},a[4]={0},b[4]={0,1,2,4};\nint main()\n{\n long i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a[1],&a[2],&a[3]);n=n*2;\n f[0][0]=1;\n for(i=1;i<=3;i++)\n for(k=n;k>=0;k--)\n for(j=0;j*b[i]<=k && j<=a[i];j++)\n f[i][k]+=f[i-1][k-j*b[i]];\n printf(\"%I64d\\n\",f[3][n]); \n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAXM 20005\nlong n;\nlong long f[4][MAXM]={0},a[4]={0},b[4]={0,1,2,4};\nint main()\n{\n long i,j,k;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&a[1],&a[2],&a[3]);n=n*2;\n f[0][0]=1;\n for(i=1;i<=3;i++)\n for(k=n;k>=0;k--)\n for(j=0;j*b[i]<=k && j<=a[i];j++)\n f[i][k]+=f[i-1][k-j*b[i]];\n printf(\"%I64d\\n\",f[3][n]); \n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, a, b, c, sum = 0, i, j;\n int d[10001] = {0};\n\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\n for (i = 0; i <= a / 2; i++) d[i]++;\n\n for (i = a / 2; i >= 0; i--) {\n\t for (j = 1; j <= b && i + j <= n; j++) {\n\t d[i + j]++;\n\t }\n }\n\n for (i = 0; i <= c; i++) {\n\t if (n - i * 2 >= 0) sum += d[n - i * 2];\n }\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n, a, b, c, i, j, ans = 0;\n scanf(\"%d %d %d %d\", &n, &a, &b, &c);\n\n for (i = 0; i <= c; i++) {\n for (j = 0; j <= b; j++) {\n int k = 2*n - 4*i - 2*j;\n if (0 <= k && k <= a) ans++;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "// Cola\n\n#include <stdio.h>\n#include <string.h>\n\n#define ll long long\n\nint count[20000];\n\nvoid deal(int n, int a, int b, int c)\n{\n int i, j;\n ll ans = 0;\n memset(count, 0, sizeof(count));\n for (i = 0; i <= b; i++)\n {\n/* if (i > n)\n {\n break;\n }*/\n for (j = 0; j <= c; j++)\n {\n/* if (i + 2 * j > n)\n {\n break;\n }*/\n count[i + 2 * j]++;\n }\n }\n for (i = 0; i <= a; i += 2)\n {\n if (n - i / 2 < 0)\n {\n break;\n }\n ans += count[n - i / 2];\n }\n printf(\"%lld\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int a, b, c, n;\n while (scanf(\"%d%d%d%d\", &n, &a, &b, &c) == 4)\n {\n deal(n, a, b, c);\n }\n return 0;\n}\n"}, {"source_code": "// Cola\n\n#include <stdio.h>\n#include <string.h>\n\n#define ll long long\n\nint count[20000];\n\nvoid deal(int n, int a, int b, int c)\n{\n int i, j;\n ll ans = 0;\n memset(count, 0, sizeof(count));\n for (i = 0; i <= b; i++)\n {\n if (i > n)\n {\n break;\n }\n for (j = 0; j <= c; j++)\n {\n if (i + 2 * j > n)\n {\n break;\n }\n count[i + 2 * j]++;\n }\n }\n for (i = 0; i <= a; i += 2)\n {\n if (n - i / 2 < 0)\n {\n break;\n }\n ans += count[n - i / 2];\n }\n printf(\"%lld\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int a, b, c, n;\n while (scanf(\"%d%d%d%d\", &n, &a, &b, &c) == 4)\n {\n deal(n, a, b, c);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define eps 1e-6\n\nint main(void)\n{\n\tint n, a, b, c;\n\tint i, j, k;\n\tint num = 0;\n\n\tscanf(\"%d%d%d%d\", &n, &a, &b, &c);\n\n\tfor (i = (n * 2 <= a ? n * 2 : a - a % 2); i >= 0; i -= 2)\n\tfor (j = (n - i / 2 <= b ? n - i / 2 : b); j >= 0; --j) {\n\t\t\tk = n - i / 2 - j;\n\t\t\tif (k % 2 == 0 && k <= c * 2)\n\t\t\t\tnum += 1;\n\t\t}\n\tprintf(\"%d\\n\", num);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, a, b, c, i, j, res, N, rem;\n while(scanf(\"%d%d%d%d\", &n, &a, &b, &c)==4)\n {\n res=0;\n rem=0;\n N=2*n;\n for(i=0; i<=b; i++)\n {\n for(j=0; j<=c; j++)\n {\n rem=N-2*i-4*j;\n if(rem>=0 && rem<=a)\n res++;\n }\n }\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,p,q,r,b,c,s=0,a,i,j,k;\n\tdouble u,m,w,l,t;\n\tscanf(\"%d %d %d %d\",&n,&p,&q,&r);\n\tfor (i=0;i<=p;i++){\n\t\tfor (j=0;j<=q;j++){\n\t\t\tm=0.5*i+j;\n\t\t\tif (m==n){\n\t\t\t\ts=s+1;\n\t\t\t}\n\t\t\telse if(m>n){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\tt=n-m;\n\t\t\ta=(int)t;\n\t\t\tif (t-a==0){\n\t\t\t\tif (a%2==0 && (a/2)<=r){\n\t\t\t\t\ts=s+1;\n\t\t\t\t}\n\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,a,b,c,sum;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n int count =0;\n int i,j;\n for(i=0;i<=a;i++)\n {\n if(i%2)\n continue;\n for(j=0;j<=b;j++)\n {\n sum=0;\n sum=(n)-(int)(i*0.5)-(j*1);\n if(sum<0)\n continue;\n if((sum%2 ==0)&&((sum/2)<=c))\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n\n{\n int n,a,b,c,i,count=0,j,k;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n if(2*c>n)c=n/2;\n if(b>n)b=n;\n if(c/2>n)c=2*n;\n for(i=c;i>=0;i--)\n {\n if(2*i==n){count++;\n continue;\n }\n for(j=b;j>=0;j--)\n {\n if(2*i+j==n)\n {\n count++;\n continue;\n }\n k=2*n-4*i-2*j;\n if(0<=k &&k<=a)count++;\n }\n\n }printf(\"%d\",count);\n return 0;\n}\n"}], "negative_code": [{"source_code": "// Cola\n\n#include <stdio.h>\n#include <string.h>\n\n#define ll long long\n\nint count[20000];\n\nvoid deal(int n, int a, int b, int c)\n{\n int i, j;\n ll ans = 0;\n memset(count, 0, sizeof(count));\n for (i = 0; i <= b; i++)\n {\n for (j = 0; j <= c; j++)\n {\n count[i + 2 * j]++;\n }\n }\n for (i = 0; i <= a; i += 2)\n {\n ans += count[n - i / 2];\n }\n printf(\"%lld\\n\", ans);\n}\n\nint main(int argc, char **argv)\n{\n int a, b, c, n;\n while (scanf(\"%d%d%d%d\", &n, &a, &b, &c) == 4)\n {\n deal(n, a, b, c);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,p,q,r,b,c,s=0,a,i,j,k;\n\tdouble u,m,w,l,t;\n\tscanf(\"%d %d %d %d\",&n,&p,&q,&r);\n\tfor (i=0;i<=p;i++){\n\t\tfor (j=0;j<=q;j++){\n\t\t\tm=0.5*i+j;\n\t\t\tt=n-m;\n\t\t\ta=(int)t;\n\t\t\tif (t-a==0){\n\t\t\t\tif (a%2==0 && (a/2)<=r){\n\t\t\t\t\ts=s+1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,a,b,c,sum;\n scanf(\"%d%d%d%d\",&n,&a,&b,&c);\n int count =0;\n int i,j;\n for(i=0;i<=a;i++)\n {\n if(i%2)\n continue;\n for(j=0;j<=b;j++)\n {\n sum=0;\n sum=(n)-(int)(i*0.5)-(j*1);\n if((sum%2 ==0)&&((sum/2)<=c))\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}], "src_uid": "474e527d41040446a18186596e8bdd83"} {"nl": {"description": "Berland Football Cup starts really soon! Commentators from all over the world come to the event.Organizers have already built $$$n$$$ commentary boxes. $$$m$$$ regional delegations will come to the Cup. Every delegation should get the same number of the commentary boxes. If any box is left unoccupied then the delegations will be upset. So each box should be occupied by exactly one delegation.If $$$n$$$ is not divisible by $$$m$$$, it is impossible to distribute the boxes to the delegations at the moment.Organizers can build a new commentary box paying $$$a$$$ burles and demolish a commentary box paying $$$b$$$ burles. They can both build and demolish boxes arbitrary number of times (each time paying a corresponding fee). It is allowed to demolish all the existing boxes.What is the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $$$m$$$)?", "input_spec": "The only line contains four integer numbers $$$n$$$, $$$m$$$, $$$a$$$ and $$$b$$$ ($$$1 \\le n, m \\le 10^{12}$$$, $$$1 \\le a, b \\le 100$$$), where $$$n$$$ is the initial number of the commentary boxes, $$$m$$$ is the number of delegations to come, $$$a$$$ is the fee to build a box and $$$b$$$ is the fee to demolish a box.", "output_spec": "Output the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $$$m$$$). It is allowed that the final number of the boxes is equal to $$$0$$$.", "sample_inputs": ["9 7 3 8", "2 7 3 7", "30 6 17 19"], "sample_outputs": ["15", "14", "0"], "notes": "NoteIn the first example organizers can build $$$5$$$ boxes to make the total of $$$14$$$ paying $$$3$$$ burles for the each of them.In the second example organizers can demolish $$$2$$$ boxes to make the total of $$$0$$$ paying $$$7$$$ burles for the each of them.In the third example organizers are already able to distribute all the boxes equally among the delegations, each one get $$$5$$$ boxes."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nlong long nzv(long long n, long long m) {\n\tlong long x = n / m;\n\tif(n == m * x) return m * x;\n\treturn m * (x+1);\n}\n\nint main() {\n\tlong long n, m, a, b;\n\tscanf(\"%lld%lld%lld%lld\", &n, &m, &a, &b);\n\tlong long demolish = n % m * b;\n\tlong long build = (nzv(n, m) - n) * a;\n\n\tif(build < demolish) printf(\"%lld\", build);\n\telse printf(\"%lld\", demolish);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,i,k,x,y;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n }\n else\n {\n k=n%m;\n x=k*b;\n y=(m-k)*a;\n if(x<=y)\n {\n printf(\"%lld\\n\",x);\n }\n else\n {\n printf(\"%lld\\n\",y);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, m, a, b, x, y;\n scanf(\"%lld%lld%lld%lld\", &n, &m, &a, &b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n }\n else\n {\n x= (n%m)*b;\n y= (m-(n%m))*a;\n if(x<y)\n {\n printf(\"%lld\", x);\n }\n else\n printf(\"%lld\", y);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,m,a,b,acost,bcost,t;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n%m==0)\n return printf(\"0\\n\"),0;\n else\n {\n t=n%m;\n acost=(m-t)*a;\n bcost=t*b;\n\n if(bcost<acost)\n return printf(\"%lld\\n\",bcost),0;\n }\n printf(\"%lld\\n\",acost);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\nlong long int min(long long int a,long long int b)\n{\n\tif(a>b)\n\t\treturn b;\n\treturn a;\n}\n\nint main()\n{\n\tlong long int n,m,a,b,ans=0,p,q;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tp = n%m;\n\tq = m-p;\n\tans = min(p*b,q*a);\n\tprintf(\"%lld\\n\",ans );\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n%m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min (long long int a, long long int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\nint main()\n{\n long long int n,m,a,b;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else \n {\n long long int rem=n%m;\n long long int des=rem*b;\n long long int build = (((n/m + 1)*m)-n)*a;\n printf(\"%lld\",min(des,build));\n }\n \n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long long m,n;\n int a,b;\n scanf(\"%lld %lld %d %d\",&m,&n,&a,&b);\n // tim 2 so gan n nhat\n if (m % n != 0){\n long long f1,f2;\n // find f1\n long long temp1 = m, temp2 = m;\n f1 = temp1/n* n;\n // find f2\n f2 = f1 + n;\n // printf(\"(%lld %lld)\",f1,f2);\n if ( (m-f1)*b < (f2-m)*a )\n printf(\"%lld\",(m-f1)*b);\n else printf(\"%lld\",(f2-m)*a);\n\n }else printf(\"0\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tlong long n, m, a, b;\n\tlong long min;\n\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n\t\n\tmin = (n % m) * b < (m - (n % m)) * a ? (n % m) * b : (m - (n % m)) * a;\n\n\tprintf(\"%I64d\", min);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long n,m;\n\tint a,b;\n\tlong long anc,sum;\n\tint i;\n\tscanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n\n\t\tanc=sum=0;\n\t \tif(n%m==0 )\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\tanc=b*(n%m);\n\t\t \n\t\t\t\n\t\t\tsum=(m-n%m)*a;\n\t\t\t\n\t\t\t\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%I64d\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%I64d\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\n\t\treturn 0;\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by rainboy */\n#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tlong long n, m;\n\tint a, b;\n\n\tscanf(\"%lld%lld%d%d\", &n, &m, &a, &b);\n\tprintf(\"%lld\\n\", n % m == 0 ? 0 : min(n % m * b, (m - n % m) * a));\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n\nint main()\n{\nlong long int n,m,a,b,c,r;\nscanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\nc=n/m;\nif(n%m==0)\n printf(\"0\");\n if(n>m && n%m!=0){\n if((n-m)*b>=((m*(c+1))-n)*a && (n-m*c)*b>=((m*(c+1))-n)*a){\n r=((m*(c+1))-n)*a;\n printf(\"%lld\",r);}\n else if((n-m)*b<=((m*(c+1))-n)*a && (n-m)*b<=(n-m*c)*b ){\n r=(n-m)*b;\n printf(\"%lld\",r);\n\n }\n else if(((n-m)*b>=(n-m*c)*b && (n-m*c)*b<=((m*(c+1))-n)*a)){\n r=(n-m*c)*b;\n printf(\"%lld\",r);\n }\n }\n else if(n<m){\n if((m-n)*a>=n*b){\n r=n*b;\n printf(\"%lld\",r);\n }\n else if((m-n)*a<n*b){\n r=(m-n)*a;\n printf(\"%lld\",r);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,m;int a,b;\n scanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if((m-n%m)*a<(n%m)*b)printf(\"%I64d\",(m-n%m)*a);\n else printf(\"%I64d\",(n%m)*b);\n return 0;\n\n }\n printf(\"0\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,ans1,ans2,i,p;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n\n printf(\"\");\n }\n if(n<m)\n {\n ans1=((m-n)*a);\n ans2=n*b;\n }\n else\n {\n ans1=(n%m)*b;\n ans2=((((n/m)+1)*m)-n)*a;\n }\n\n if(ans1<ans2)\n printf(\"%I64d\",ans1);\n else\n printf(\"%I64d\",ans2);\n\n return 0;\n\n}\n"}, {"source_code": "//Bismillahir rahmanir rahim \n\n#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long m,n,a,b,rem,ans; \n\tscanf(\"%lld %lld %lld %lld\",&m,&n,&a,&b); \n\trem = m % n ;\n\tlong long int ans1 = rem*b; \n\tlong long int ans2 = (n-rem)*a; \n\tif(ans1>ans2) ans=ans2; \n\telse ans=ans1; \n\tprintf(\"%lld\",ans); \n\treturn 0;\n}\n\n"}, {"source_code": "main()\n{long long int i,j,k,p,l,n,m,a,b;\nscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\nk=n%m;\nj=m-k;\ni=j*a;\np=b*k;\n//printf(\"%d %d %d %d\\n\",k,j,i,p);\nif (i>p)printf(\"%lld\",p);\nelse if (p>=i) {printf(\"%lld\",i);}\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,m;\n int a,b;\n scanf(\"%lld%lld%d%d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else if(n%m!=0)\n {\n long long int temp1=n/m;\n long long int temp2=temp1+1;\n long long int ans1=(n-(temp1*m))*b;\n long long int ans2=((temp2*m)-n)*a;\n if(ans1<ans2)\n printf(\"%lld\\n\",ans1);\n else\n printf(\"%lld\\n\",ans2);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,m,a,b,ans,c1,c2,yu;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n yu=n%m;\n if(yu==0)\n printf(\"0\\n\");\n else\n {\n c1=yu*b;\n c2=(m-yu)*a;\n if(c1>c2)\n printf(\"%I64d\\n\",c2);\n else\n printf(\"%I64d\\n\",c1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\n#include<math.h>\n\nint main()\n{\n\tll n,m,a,b;\n\t\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\t\n\tll r1,r2,c1,c2;\n\t\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse if(n>m)\n\t{\n\t\tr1=n%m;\n\t\tr2=m-r1;\n\t\t\n\t \tc1=r2*a;\n\t \tc2=r1*b;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%lld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%lld\\n\",c2);\n\t}\n\t\n\telse if(m>n)\n\t{\n\t\tr1=m-n;\n\t\tr2=n;\n\t\t\n\t\tc1=r1*a;\n\t\tc2=r2*b;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%lld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%lld\\n\",c2);\n\t}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long m,n ;\n\tint a,b ;\n\tscanf(\"%lld%lld%d%d\",&m,&n,&a,&b) ;\n\tint i ;\n\tlong long cost1,cost2 ;\n\tif(m==n || m%n==0)\n\t\tcost1 = cost2 = 0 ;\n\telse if(m<n)\n\t{\n\t\tcost1 = (n-m)*a ;\n\t\tcost2 = m*b ;\t\t\n\t}\t\t\n\telse\n\t{\n\t\tlong long t = m/n ;\n\t\tcost1 = a*((t+1)*n-m) ;\n\t\tcost2 = b*(m-t*n) ;\n\t}\n\tprintf(\"%lld\\n\",cost1>=cost2?cost2:cost1) ;\n\treturn 0 ;\n}"}, {"source_code": "#include <stdio.h>\n#define ll long long\nint main(){\n\tll n, m;\n\tint a, b;\n\tscanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n\tif (n%m == 0) printf(\"0\");\n\telse{\n\t\tll costa = a*(m-n%m);\n\t\tll costb = b*(n%m);\n\t\tprintf(\"%I64d\",costa<costb? costa:costb);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n\nlong long int mod(long long int x, long long int y){\n\treturn(x-(y*(x/y)));\n}\n\nint main(void){\n\n\tlong long int n, m, a, b;\n\tscanf(\"%I64d%I64d%I64d%I64d\", &n, &m, &a, &b);\n\t\n\tlong long int division = mod(n, m);\n\t\n\tif(division!=0){\n\t\tif((m-division)*a < division*b){\n\t\t\tprintf(\"%I64d\\n\", (m-division)*a);\n\t\t}else{\n\t\t\tprintf(\"%I64d\\n\", division*b);\n\t\t}\n\t}else{\n\t\tprintf(\"0\\n\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "main()\n{long long int i,j,k,p,l,n,m,a,b;\nscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\nk=n%m;\nj=m-k;\ni=j*a;\np=b*k;\n//printf(\"%d %d %d %d\\n\",k,j,i,p);\nif (i>p)printf(\"%lld\",p);\nelse if (p>=i) {printf(\"%lld\",i);}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int x[4],i,b,c,sm1,sm2;\n for(i=0;i<4;i++)\n {\n scanf(\"%lli\",&x[i]);\n }\n if ((x[0]%x[1])==0)\n {\n printf(\"0\");\n }\n else\n {\n b=(x[0]%x[1]);\n c=x[1]-b;\n sm1=b*x[3];\n sm2=c*x[2];\n if(sm1<sm2)\n {\n printf(\"\\n\\n%lli\",b*x[3]);\n }\n else\n {\n printf(\"\\n\\n%lli\",c*x[2]);\n }\n\n }\n return 0;\n }"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint main()\n{\nshort int a=0,b=0;\nunsigned long long int n=0,m=0,modnm=0;\nscanf(\"%llu %llu %hd %hd\",&n,&m,&a,&b);\nmodnm=n%m;\nif (b*modnm>a*(m-modnm))\n{\nprintf(\"%llu\",a*(m-modnm));\n}else\n{\nprintf(\"%llu\",b*modnm);\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,ans1,ans2,i,p;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n\n printf(\"\");\n }\n if(n<m)\n {\n ans1=((m-n)*a);\n ans2=n*b;\n }\n else\n {\n ans1=(n%m)*b;\n ans2=((((n/m)+1)*m)-n)*a;\n }\n\n if(ans1<ans2)\n printf(\"%I64d\",ans1);\n else\n printf(\"%I64d\",ans2);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tlong long int n, m, a, b;\n\tscanf(\"%lld%lld%lld%lld\", &n, &m, &a, &b);\n\tlong long int mod = n%m;\n\tif(mod==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\tlong long int dem = b*mod;\n\t\tlong long int cons = a*(m-mod);\n\t\tif(dem<cons)\n\t\t{\n\t\t\tprintf(\"%lld\\n\", dem);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%lld\\n\", cons);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tlong long n,m,a,b;\n\tscanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n\tprintf(\"%lld\\n\",((n%m)*b<((m-(n%m))%m)*a)?(n%m)*b:((m-(n%m))%m)*a);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nlong long min(long long a,long long b) {return (a<b)?a:b;}\nint main()\n{\n long long n,m;\n int a,b;\n scanf(\"%lld%lld%d%d\",&n,&m,&a,&b);\n long long r=n%m;\n printf(\"%lld\\n\",min(r*b,(m-r)*a));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n long long n, m, a, b;\n scanf(\"%I64d%I64d%I64d%I64d\", &n, &m, &a, &b);\n\n if((n%m)*b<(m-n%m)*a) printf(\"%I64d\\n\", (n%m)*b);\n else printf(\"%I64d\\n\", (m-n%m)*a);\n\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n\nint main()\n{\nlong long int n,m,a,b,c,r;\nscanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\nc=n/m;\nif(n%m==0)\n printf(\"0\");\n if(n>m && n%m!=0){\n if((n-m)*b>=((m*(c+1))-n)*a && (n-m*c)*b>=((m*(c+1))-n)*a){\n r=((m*(c+1))-n)*a;\n printf(\"%lld\",r);}\n else if((n-m)*b<=((m*(c+1))-n)*a && (n-m)*b<=(n-m*c)*b ){\n r=(n-m)*b;\n printf(\"%lld\",r);\n\n }\n else if(((n-m)*b>=(n-m*c)*b && (n-m*c)*b<=((m*(c+1))-n)*a)){\n r=(n-m*c)*b;\n printf(\"%lld\",r);\n }\n }\n else if(n<m){\n if((m-n)*a>=n*b){\n r=n*b;\n printf(\"%lld\",r);\n }\n else if((m-n)*a<n*b){\n r=(m-n)*a;\n printf(\"%lld\",r);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,i,j;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if(n<m)\n {\n i=n*b;\n j=(m-n)*a;\n if(i<j)\n {\n printf(\"%lld\\n\",i);\n }\n else\n {\n printf(\"%lld\\n\",j);\n }\n }\n else if(n>m)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i<j)\n {\n printf(\"%lld\\n\",i);\n }\n else\n {\n printf(\"%lld\\n\",j);\n }\n\n }\n }\n else\n {\n i=0;\n printf(\"%lld\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,m,d;\n int a,b,i;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n long long int sum_a=0, sum_b=0;\n\n if(n%m==0)\n printf(\"0\");\n else{\n d=n%m;\n sum_a= (m-d)*a;\n sum_b= d*b;\n if(sum_a<sum_b)\n printf(\"%lld\",sum_a);\n else\n printf(\"%lld\",sum_b);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n, m, a, b, x, y, c1, c2, div;\n scanf(\"%lli %lli %lli %lli\", &n, &m, &a, &b);\n\n if(n%m==0)\n {\n printf(\"0\\n\");\n }\n else\n {\n div=n/m;\n x=n-(div*m);\n c2=b*x;\n //printf(\"div %lli\\n\", div);\n //printf(\"c2 %lli\\n\", c2);\n\n div++;\n y=(div*m)-n;\n c1=a*y;\n //printf(\"c1 %lli\\n\", c1);\n\n if(c1>c2)\n {\n printf(\"%lli\\n\", c2);\n }\n else\n {\n printf(\"%lli\\n\", c1);\n }\n }\n}\n"}, {"source_code": "//Bismillahir rahmanir rahim \n\n#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tlong long m,n,a,b,rem,ans; \n\tscanf(\"%lld %lld %lld %lld\",&m,&n,&a,&b); \n\trem = m % n ;\n\tlong long int ans1 = rem*b; \n\tlong long int ans2 = (n-rem)*a; \n\tif(ans1>ans2) ans=ans2; \n\telse ans=ans1; \n\tprintf(\"%lld\",ans); \n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,m,a,b,c,d;\n\twhile(scanf(\"%I64d%I64d%I64d%I64d\",&m,&n,&a,&b)!=EOF)\n\t{\n\t\tif(m%n==0)\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc=m%n*b;//\u62c6\u9664\n\t\t\t\tif(m>n)\n\t\t\t\t{\n\t\t\t\t\td=(n-m%n)*a;\n\t\t\t\t\tif(c>d)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%I64d\\n\",d);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%I64d\\n\",c);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t } \n\t\t\t\t else//m<n\n\t\t\t\t {\n\t\t\t\t \td=(n-m)*a;//\u91cd\u5efa \n\t\t\t\t \tif(c>d)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%I64d\\n\",d);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%I64d\\n\",c);\n\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,m,a,b,p,q,cntd=0,cntb=0,i,j,k,d=0,b1=0,g=0,e=0;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n p=n;q=n;\n cntd=p%m;\n d=cntd*b;\n if(q%m==0)cntb=0;\n else\n {\n q=q+m;\n g=q/m;\n cntb=g*m-n;\n }\n b1=cntb*a;\n e=n*b;\n if(e<d && e<b1)printf(\"%lld\\n\",e);\n else\n { if(b1<d)printf(\"%lld\\n\",b1);\n\n else printf(\"%lld\\n\",d);\n\n }\n\n\n return 0;\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n, m, a, b ;\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n\tif (n >= m) {\n\t\tlong long x, y;\n\t\tx = n % m;\n\t\ty = n / m;\n\t\tif (b*x >= ((y + 1)* m-n)*a) printf(\"%I64d\", ((y + 1)*m-n)*a);\n\t\telse printf(\"%I64d\", b*x);\n\t}\n\telse if (n < m) {\n\t\tif (b*n >= (m - n)*a) printf(\"%I64d\", (m-n)*a);\n\t\telse printf(\"%I64d\", b*n);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nlong long int n,m,y,r,s;\nint a,b;\nint main()\n{\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n s=0;\n else\n {\n r=a*(m-(n%m));\n y=b*(n%m);\n if(r>y)\n s=y;\n else\n s=r;\n }\n printf(\"%lld\",s);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,rem=0,cost1=0,cost2=0;\n int a,b;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n rem=n%m;\n if(rem==0)\n {\n printf(\"0\");\n return 0;\n }\n if((rem>0)&&(n>m))\n {\n cost1=rem*b;\n cost2=(m-rem)*a;\n cost1<cost2?printf(\"%lld\",cost1):printf(\"%lld\",cost2);\n return 0;\n }\n if((rem>0)&&(m>n))\n {\n cost1=n*b;\n cost2=(m-n)*a;\n cost1<cost2?printf(\"%lld\",cost1):printf(\"%lld\",cost2);\n return 0;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long n,m,a,b,x1,x2;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&m);\n scanf(\"%lld\",&a);\n scanf(\"%lld\",&b);\n x1=n%m;\n x2=m-x1;\n if(a*x2 > x1*b)\n printf(\"%lld\",x1*b);\n else\n printf(\"%lld\",x2*a);\n return 0;\n}\n"}, {"source_code": "/* Coached by rainboy */\n#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tlong long n, m;\n\tint a, b;\n\n\tscanf(\"%lld%lld%d%d\", &n, &m, &a, &b);\n\tprintf(\"%lld\\n\", n % m == 0 ? 0 : min(n % m * b, (m - n % m) * a));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#define ll long long\nint main(void)\n{\n ll n,m,a,b;\n ll c1,c2,t;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\n if(n%m==0) printf(\"0\");\n else\n {\n if(n>m)\n {\n c1=(n%m)*b;\n c2=(ceil(n*1./m)*m-n)*a;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n else\n {\n c1=(m-n)*a;\n c2=n*b;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,p,q;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\");\n }\n else\n {\n p=n%m;\n q=m-p;\n if((p*b)>=(q*a))\n {\n printf(\"%lld\",(q*a));\n }\n else\n {\n printf(\"%lld\",(p*b));\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n, m, a, b, c, d;\n scanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n c=n%m;\n d=m-c;\n if(d*a>c*b)\n printf(\"%I64d\\n\", c*b);\n else\n printf(\"%I64d\\n\", d*a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,m;int a,b;\n scanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if((m-n%m)*a<(n%m)*b)printf(\"%I64d\",(m-n%m)*a);\n else printf(\"%I64d\",(n%m)*b);\n return 0;\n\n }\n printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b)\n{\n return a < b? a: b;\n}\n\nint main()\n{\n long long n, m, a, b;\n scanf(\"%lld%lld%lld%lld\", &n, &m, &a, &b);\n long long demolish = n % m, build = m - demolish;\n printf(\"%lld\\n\", min(demolish*b, build*a));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,m,a,b,minimum_burles,bulit_boxes,destroyed_boxes;\nscanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\nbulit_boxes=(m-n%m)*a;\ndestroyed_boxes=(n%m)*b;\nif(bulit_boxes<destroyed_boxes) minimum_burles=bulit_boxes;\nelse minimum_burles=destroyed_boxes;\nprintf(\"%I64d\",minimum_burles);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,m,a,b;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0) printf(\"0\");\n else{\n long long int d;\n d=n%m;\n if(d*b<((((n/m)+1)*m)-n)*a)\n printf(\"%I64d\",d*b);\n else\n printf(\"%I64d\",((((n/m)+1)*m)-n)*a);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n long long int n,m,a,b,c,d;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n>m)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n \t\tc=a*(m-(n%m));\n \t\td=b*(n%m);\n \t\tif(c<d)\n \t\t\tprintf(\"%lld\",c);\n \t\telse\n \t\t\tprintf(\"%lld\",d);\n }\n }\n else\n {\n c=((m-n)*a);\n d=(n*b);\n if(c<d)\n printf(\"%lld\",c);\n else\n printf(\"%lld\",d);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i, j, a, b, n, m, sum = 0, sum1 = 0;\n scanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n {\n sum = n*b;\n sum1 = (m - n)*a;\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n else\n {\n sum = a*(m - n%m);\n sum1 = b*(n%m);\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n\n }\n else\n printf(\"%lld\\n\", sum);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b;\n long long n,m;\n long long v1,v2;\n scanf(\"%lld%lld%d%d\",&n,&m,&a,&b);\n v1=n%m;\n v2=m-v1;\n printf(\"%lld\",(v2*a<v1*b)?(v2*a):(v1*b));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n, m, a, b ;\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n\tif (n >= m) {\n\t\tlong long x, y;\n\t\tx = n % m;\n\t\ty = n / m;\n\t\tif (b*x >= ((y + 1)* m-n)*a) printf(\"%I64d\", ((y + 1)*m-n)*a);\n\t\telse printf(\"%I64d\", b*x);\n\t}\n\telse if (n < m) {\n\t\tif (b*n >= (m - n)*a) printf(\"%I64d\", (m-n)*a);\n\t\telse printf(\"%I64d\", b*n);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#define I64 long long int\nint main()\n{\n I64 n,m,a,b,p,q,k,k_;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\");\n return 0;\n }\n if(n>m)\n {\n p=n%m;q=m-p;\n k=q*a;\n k_=p*b;\n k<k_?printf(\"%I64d\",k):printf(\"%I64d\",k_);\n }\n else\n {\n p=m-n;\n k=p*a;\n k_=n*b;\n k<k_?printf(\"%I64d\",k):printf(\"%I64d\",k_);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long unsigned int n,m,a,b,p=0,q=0;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\n p = (n%m)*b;\n q = (m-(n%m))*a;\n\n if(p>q)\n printf(\"%lld\\n\",q);\n else\n printf(\"%lld\\n\",p);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define min(x,y) x<y?x:y\nint main()\n{\n long long m,n,a,b,ccost,dcost;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n long long dr=n%m,cr=((n/m)+1)*m-n;\n printf(\"%lld\",min(cr*a,dr*b));\n }\n else\n {\n long long diff=m-n;\n printf(\"%lld\",min(diff*a,n*b));\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b;\n long long n,m;\n long long v1,v2;\n scanf(\"%lld%lld%d%d\",&n,&m,&a,&b);\n v1=n%m;\n v2=m-v1;\n printf(\"%lld\",(v2*a<v1*b)?(v2*a):(v1*b));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m;\n\tscanf(\"%lld %lld\",&n,&m);\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tlong long int c1=0,c2=0;\n\tc1 = (m-(n%m)) * a;\n\tc2 = (n%m)*b;\n\tif (c1<c2)\n\t\tprintf(\"%lld\\n\",c1);\n\telse\n\t\tprintf(\"%lld\\n\",c2);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n%m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long\n#include<math.h>\n\nint main()\n{\n\tll n,m,a,b;\n\t\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\t\n\tll r1,r2,c1,c2;\n\t\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse if(n>m)\n\t{\n\t\tr1=n%m;\n\t\tr2=m-r1;\n\t\t\n\t \tc1=r2*a;\n\t \tc2=r1*b;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%lld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%lld\\n\",c2);\n\t}\n\t\n\telse if(m>n)\n\t{\n\t\tr1=m-n;\n\t\tr2=n;\n\t\t\n\t\tc1=r1*a;\n\t\tc2=r2*b;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%lld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%lld\\n\",c2);\n\t}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\n\nll min(ll a, ll b)\n{\n\treturn a >= b ? b : a;\n}\n\nint main()\n{\n\tll n, m, a, b, x, ans;\n\tscanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n\tx = n / m;\n\tans = min(((x + 1) * m - n) * a, (n - x * m) * b);\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,m;\n int a,b;\n scanf(\"%lld%lld%d%d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else if(n%m!=0)\n {\n long long int temp1=n/m;\n long long int temp2=temp1+1;\n long long int ans1=(n-(temp1*m))*b;\n long long int ans2=((temp2*m)-n)*a;\n if(ans1<ans2)\n printf(\"%lld\\n\",ans1);\n else\n printf(\"%lld\\n\",ans2);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long long a, b,c,d,e,f,g,h,i;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if (a% b == 0) {\n printf(\"0\\n\");\n return 0;\n } else if (a> b) {\n e = (a/ b+ 1) * b- a;\n f = a % b;\n g=e*c;\n h=f*d;\n if(g<h)\n {\n \tprintf(\"%lld\\n\",g);\n \treturn 0;\n }\n else\n {\n \tprintf(\"%lld\\n\",h);\n \treturn 0;\n }\n }\n else {\n e = b - a;\n f= a;\n g=e*c;\n h=f*d;\n if(h<g)\n {\n \tprintf(\"%lld\\n\",h);\n \treturn 0;\n }\n else\n {\n \tprintf(\"%lld\\n\",g);\n \treturn 0;\n }\n \n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long m,n ;\n\tint a,b ;\n\tscanf(\"%lld%lld%d%d\",&m,&n,&a,&b) ;\n\tint i ;\n\tlong long cost1,cost2 ;\n\tif(m==n || m%n==0)\n\t\tcost1 = cost2 = 0 ;\n\telse if(m<n)\n\t{\n\t\tcost1 = (n-m)*a ;\n\t\tcost2 = m*b ;\t\t\n\t}\t\t\n\telse\n\t{\n\t\tlong long t = m/n ;\n\t\tcost1 = a*((t+1)*n-m) ;\n\t\tcost2 = b*(m-t*n) ;\n\t}\n\tprintf(\"%lld\\n\",cost1>=cost2?cost2:cost1) ;\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n%m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,m,a,b,ans,c1,c2,yu;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n yu=n%m;\n if(yu==0)\n printf(\"0\\n\");\n else\n {\n c1=yu*b;\n c2=(m-yu)*a;\n if(c1>c2)\n printf(\"%I64d\\n\",c2);\n else\n printf(\"%I64d\\n\",c1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\nlong long int min(long long int a,long long int b)\n{\n\tif(a>b)\n\t\treturn b;\n\treturn a;\n}\n\nint main()\n{\n\tlong long int n,m,a,b,ans=0,p,q;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tp = n%m;\n\tq = m-p;\n\tans = min(p*b,q*a);\n\tprintf(\"%lld\\n\",ans );\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,i,j;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if(n<m)\n {\n i=n*b;\n j=(m-n)*a;\n if(i<j)\n {\n printf(\"%lld\\n\",i);\n }\n else\n {\n printf(\"%lld\\n\",j);\n }\n }\n else if(n>m)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i<j)\n {\n printf(\"%lld\\n\",i);\n }\n else\n {\n printf(\"%lld\\n\",j);\n }\n\n }\n }\n else\n {\n i=0;\n printf(\"%lld\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint\nmain ()\n{\n\tunsigned long long int n, m, a, b;\n\t\n\tscanf (\"%I64u %I64u %I64u %I64u\", &n, &m, &a, &b);\n\t\n\tunsigned long long int destroy = n % m;\n\tunsigned long long int build = m - destroy;\n\t\n\tbuild *= a;\n\tdestroy *= b;\n\t\n\tprintf (\"%I64u\\n\", build < destroy ? build : destroy);\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n double n,m,a,b,c,f,p,q;\n scanf(\"%lf %lf %lf %lf\", &n,&m,&a,&b);\n c=ceil(n/m);\n f=floor(n/m);\n p=(c*m-n)*a;\n q=(n-f*m)*b;\n printf(\"%.0lf\",p>q?q:p);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n long long int n, m;\n int a, b;\n scanf(\"%I64d%I64d%d%d\", &n, &m, &a, &b);\n if(n % m ==0)\n printf(\"0\");\n else{\n /**Hallar el m\ufffdltiplo m\ufffds cercano a m, por encima y por\n debajo de n:\n dividir n entre m y tomar el resultado, por exceso y por defecto\n multiplicar dichos resultados por m y ya tenemos los m\ufffdltiplos buscados*/\n long long int ex, de;\n ex = n/m + 1;\n de = n/m;\n ex = ex * m;\n de = de * m;\n if(de == 0)\n de = n * b;\n else{\n de = fabs(de - n);\n de = de * b;\n }\n ex = fabs(ex - n);\n ex = ex * a;\n if(ex > de)\n printf(\"%I64d\", de);\n else\n printf(\"%I64d\", ex);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<math.h>\n#include<time.h>\n\n\n\n\n\n\nint main()\n{\n long long int n,m,a,b,r,i,j;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else if(n%m!=0)\n {\n r=n%m;\n i=r*b;\n j=(m-r)*a ;\n if(i<j)\n printf(\"%I64d\",i);\n else printf(\"%I64d\",j);\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n long long int n, m;\n int a, b;\n scanf(\"%I64d%I64d%d%d\", &n, &m, &a, &b);\n if(n % m ==0)\n printf(\"0\");\n else{\n /**Hallar el m\ufffdltiplo m\ufffds cercano a m, por encima y por\n debajo de n:\n dividir n entre m y tomar el resultado, por exceso y por defecto\n multiplicar dichos resultados por m y ya tenemos los m\ufffdltiplos buscados*/\n long long int ex, de;\n ex = n/m + 1;\n de = n/m;\n ex = ex * m;\n de = de * m;\n if(de == 0)\n de = n * b;\n else{\n de = fabs(de - n);\n de = de * b;\n }\n ex = fabs(ex - n);\n ex = ex * a;\n if(ex > de)\n printf(\"%I64d\", de);\n else\n printf(\"%I64d\", ex);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long fun(long long ,long long ,long long ,long long );\nlong long fun(long long n,long long m,long long a,long long b)\n{\n long long t=n%m;\n if(t==0)\n {\n return 0;\n }\n long long s1=b*t;\n long long s2=(m-t)*a;\n return (s1<s2)?s1:s2;\n}\nint main()\n{\n long long n,m,a,b;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n printf(\"%lld\\n\",fun(n,m,a,b));\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long long a, b,c,d,e,f,g,h,i;\n scanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n if (a% b == 0) {\n printf(\"0\\n\");\n return 0;\n } else if (a> b) {\n e = (a/ b+ 1) * b- a;\n f = a % b;\n g=e*c;\n h=f*d;\n if(g<h)\n {\n \tprintf(\"%lld\\n\",g);\n \treturn 0;\n }\n else\n {\n \tprintf(\"%lld\\n\",h);\n \treturn 0;\n }\n }\n else {\n e = b - a;\n f= a;\n g=e*c;\n h=f*d;\n if(h<g)\n {\n \tprintf(\"%lld\\n\",h);\n \treturn 0;\n }\n else\n {\n \tprintf(\"%lld\\n\",g);\n \treturn 0;\n }\n \n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long n,m,a,b,c,d,e,k,l;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tc=n%m;\n\tif(c==0)\n\t{\n\t printf(\"0\");\n\t}\n\telse\n\t{\n\t d=m-c;\n\t k=d*a;\n\t l=c*b;\n\t if(k>l)\n\t {\n\t printf(\"%lld\",l);\n\t }\n\t else\n\t {\n\t printf(\"%lld\",k);\n\t }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(x,y) x<y?x:y\nint main()\n{\nlong long int n,m,a,b,x,y;\nscanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\nx=(m-(n%m))*a;\ny=(n%m)*b;\nprintf(\"%I64d\",min(x,y));\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int min (long long int a, long long int b)\n{\n if(a<b)\n return a;\n else\n return b;\n}\nint main()\n{\n long long int n,m,a,b;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else \n {\n long long int rem=n%m;\n long long int des=rem*b;\n long long int build = (((n/m + 1)*m)-n)*a;\n printf(\"%lld\",min(des,build));\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,a,b,x,y;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tx=n%m;\n\tif(x==0)\n\tprintf(\"0\\n\");\n\telse if((m-x)*a>x*b)\n\t\tprintf(\"%lld\\n\",x*b);\n\telse\n\t\tprintf(\"%lld\\n\",(m-x)*a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n \n long long int n,m,a,b,result,result2,temp,temp2,nn,mm;\n\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n temp=n;nn=n;temp2=m,mm=m;\n if(n%m==0)\n {printf(\"0\\n\");}\n else\n {\n nn=n%m;\n result2=nn*b;\n result=(m-nn)*a;\n if(result2>result)\n printf(\"%lld\\n\",result);\n else\n printf(\"%lld\\n\",result2);\n }\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tlong long n,m,a,b;\n\tscanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n\tprintf(\"%lld\\n\",((n%m)*b<((m-(n%m))%m)*a)?(n%m)*b:((m-(n%m))%m)*a);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nint main()\n{\n long long n,m,a,b,ta,tb;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n ta=n%m;\n tb=m-ta;\n ta*=b;\n tb*=a;\n printf(\"%lld\\n\",min(ta,tb));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a,b,n,m,x,y;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&n,&m);\n x=a%b;\n y=b-a%b;\n if(a%b==0) printf(\"0\\n\");\n else\n {\n if(x*m>=y*n) printf(\"%lld\\n\",y*n);\n else printf(\"%lld\\n\",m*x);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int a, b, c, n, m, x, y, z, cost1, cost2;\n\n scanf(\"%lld %lld %lld %lld\", &n , &m, &a, &b);\n\n if(n % m == 0)\n {\n printf(\"0\\n\");\n return 0;\n }\n c = n / m;\n x = ((c+1)*m) - n;\n y = n - (c*m) ;\n //printf(\"%d\\n\", y);\n\n cost1 = x*a;\n cost2 = y*b;\n\n\n if(cost1<cost2)\n z = cost1;\n else\n z = cost2;\n\n printf(\"%lld\\n\", z);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,ans1,ans2,i,p;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n\n printf(\"\");\n }\n if(n<m)\n {\n ans1=((m-n)*a);\n ans2=n*b;\n }\n else\n {\n ans1=(n%m)*b;\n ans2=((((n/m)+1)*m)-n)*a;\n }\n\n if(ans1<ans2)\n printf(\"%I64d\",ans1);\n else\n printf(\"%I64d\",ans2);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n double n,m,a,b,c,f,p,q;\n scanf(\"%lf %lf %lf %lf\", &n,&m,&a,&b);\n c=ceil(n/m);\n f=floor(n/m);\n p=(c*m-n)*a;\n q=(n-f*m)*b;\n printf(\"%.0lf\",p>q?q:p);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long fun(long long ,long long ,long long ,long long );\nlong long fun(long long n,long long m,long long a,long long b)\n{\n long long t=n%m;\n if(t==0)\n {\n return 0;\n }\n long long s1=b*t;\n long long s2=(m-t)*a;\n return (s1<s2)?s1:s2;\n}\nint main()\n{\n long long n,m,a,b;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n printf(\"%lld\\n\",fun(n,m,a,b));\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#define ll long long\nint main(){\n\tll n, m;\n\tint a, b;\n\tscanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n\tif (n%m == 0) printf(\"0\");\n\telse{\n\t\tll costa = a*(m-n%m);\n\t\tll costb = b*(n%m);\n\t\tprintf(\"%I64d\",costa<costb? costa:costb);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define ll long long\nint main()\n{\n\tll n,m,a,b,x1,x2,res1,res2;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n\tx1=n%m;\n\tx2=m-x1;\n\tres1=x1*b;\n\tres2=x2*a;\n\tif(res1<res2)\n\t\tprintf(\"%I64d\",res1);\n\telse\n\t\tprintf(\"%I64d\",res2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define Min(a,b) a<b ? a : b\nint main()\n{\n long long int n, m, a, b, x, y;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\n y = n%m;\n x = m-(n%m);\n x *= a;\n y *= b;\n printf(\"%lld\\n\",Min(x,y));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(x,y) x<y?x:y\nint main()\n{\nlong long int n,m,a,b,x,y;\nscanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\nx=(m-(n%m))*a;\ny=(n%m)*b;\nprintf(\"%I64d\",min(x,y));\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,x,y;\n int a,b;\n scanf(\"%lli%lli%d%d\",&n,&m,&a,&b);\n if(n<=1000000000000&&m<=1000000000000&&a<=100&&b<=100&&1<=n&&1<=m&&1<=a&&1<=b)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n x = (n%m)*b;\n y = (m-n%m)*a;\n if(x<y)\n printf(\"%lli\",x);\n else\n printf(\"%lli\",y);\n }\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,build,dem;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n build = m*a -(n%m)*a;\n dem = (n%m)*b;\n build<=dem? printf(\"%lld\",build):printf(\"%lld\",dem);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,m,y1,y11,y2,y22,x;\n\tint a,b;\n\tscanf(\"%lld%lld\",&n,&m);\n\tscanf(\"%d%d\",&a,&b);\n\tif(n%m==0)\n\tprintf(\"0\\n\");\n\telse\n\t{\n\t\tx=n/m;\n\t\ty1=n-m*x;\n\t\ty11=y1*b;\n y2=m*(x+1)-n;\n y22=y2*a;\n if(y11<y22)\n printf(\"%lld\\n\",y11);\n else\n printf(\"%lld\\n\",y22);\n \n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,m,s,d,r,t;\n int a,b;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"%d\",0);\n }\n else\n {\n r=n%m;\n s=r*b;\n t=(m-r);\n d=t*a;\n if(s<=d)\n {\n printf(\"%lld\",s);\n }\n else\n {\n printf(\"%lld\",d);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long n,m,a,b,c,d,e,k,l;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tc=n%m;\n\tif(c==0)\n\t{\n\t printf(\"0\");\n\t}\n\telse\n\t{\n\t d=m-c;\n\t k=d*a;\n\t l=c*b;\n\t if(k>l)\n\t {\n\t printf(\"%lld\",l);\n\t }\n\t else\n\t {\n\t printf(\"%lld\",k);\n\t }\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,m;int a,b;\n scanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if((m-n%m)*a<(n%m)*b)printf(\"%I64d\",(m-n%m)*a);\n else printf(\"%I64d\",(n%m)*b);\n return 0;\n\n }\n printf(\"0\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long nzv(long long n, long long m) {\n\tlong long x = n / m;\n\tif(n == m * x) return m * x;\n\treturn m * (x+1);\n}\n\nint main() {\n\tlong long n, m, a, b;\n\tscanf(\"%lld%lld%lld%lld\", &n, &m, &a, &b);\n\tlong long demolish = n % m * b;\n\tlong long build = (nzv(n, m) - n) * a;\n\n\tif(build < demolish) printf(\"%lld\", build);\n\telse printf(\"%lld\", demolish);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,a,b,ans1,ans2,i,p;\n scanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n\n printf(\"\");\n }\n if(n<m)\n {\n ans1=((m-n)*a);\n ans2=n*b;\n }\n else\n {\n ans1=(n%m)*b;\n ans2=((((n/m)+1)*m)-n)*a;\n }\n\n if(ans1<ans2)\n printf(\"%I64d\",ans1);\n else\n printf(\"%I64d\",ans2);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n long long int n,m,p,q,t;\n scanf(\"%lld %lld\",&n,&m);\n scanf(\"%d %d\",&a,&b);\n if(n%m==0)\n {\n printf(\"0\");\n }\n else{\n if(n<m){\n p=b*n;\n q=(m-n)*a;\n if(p<q){\n printf(\"%lld\",p);\n }\n else{\n printf(\"%lld\",q);\n }\n }\n else{\n p=(n%m)*b;\n t=(n/m);\n t=t+1;\n q=((t*m)-n)*a;\n if(p<q)\n {\n printf(\"%lld\",p);\n }\n else{\n printf(\"%lld\",q);\n }\n }\n }\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long long int i, j, a, b, n, m, sum = 0;\n scanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n sum = n*b;\n else\n sum = a*(2*m - n);\n }\n else\n sum = 0;\n printf(\"%lld\\n\", sum);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n,m,a,b,p,q,l;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(m>n)\n {\n printf(\"%lld\",n*b);\n }\n else if(n>m)\n {\n l=n/m;\n p=(n-(m*l))*b;\n q=(((l+1)*m)-n)*a;\n if(p>q)\n printf(\"%lld\",q);\n else\n printf(\"%lld\",p);\n }\n else\n printf(\"%d\",0);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define Min(a,b) a<b ? a : b\nint main()\n{\n int n, m, a, b, d, x, y;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n d = (m+n-1)/m;\n x = (d*m - n)*a;\n d = Min(n,abs(n-m));\n y = d*b;\n printf(\"%d\\n\",Min(x,y));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long m,n ;\n\tint a,b ;\n\tscanf(\"%lld%lld%d%d\",&m,&n,&a,&b) ;\n\tint i ;\n\tint cost1,cost2 ;\n\tif(m==n || m%n==0)\n\t\tcost1 = cost2 = 0 ;\n\telse if(m>n)\n\t{\n\t\tcost1 = a*(2*n-m) ;\n\t\tcost2 = b*(m-n) ;\n\t}\t\t\n\telse\n\t{\n\t\tcost1 = (n-m)*a ;\n\t\tcost2 = m*b ;\n\t}\n\tprintf(\"%d\\n\",cost1>=cost2?cost2:cost1) ;\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define min(x,y) x<y?x:y\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int dr=n%m,cr=((n/m)+1)*m-n;\n printf(\"%d\",min(cr*a,dr*b));\n }\n else\n {\n int diff=m-n;\n printf(\"%d\",min(diff*a,n*b));\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,build,dem;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n build = m*a -(n%m)*a;\n dem = (n%m)*b;\n build<=dem? printf(\"%d\",build):printf(\"%d\",dem);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i, j, a, b, n, m, sum = 0, sum1 = 0;\n scanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n {\n sum = n*b;\n sum1 = (m - n)*a;\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n else\n {\n sum = a*(2*m - n);\n sum1 = b*(n-m);\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n\n }\n else\n printf(\"%lld\\n\", sum);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nlong long int n,m,a,b,c,d;\nscanf(\"%I64d%I64d%I64d%I64d\",&n,&m,&a,&b);\nif(n%m==0) printf(\"0\");\nelse{\n c=n%m;\n d=(n/m+1)*m;\n if((d-n)*a>c*b) printf(\"%d\",c*b);\n else printf(\"%d\",a*(d-n));\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n long long int n, m;\n int a, b;\n scanf(\"%ld%ld%d%d\", &n, &m, &a, &b);\n if(n % m ==0)\n printf(\"0\");\n else{\n /**Hallar el m\ufffdltiplo m\ufffds cercano a m, por encima y por\n debajo de n:\n dividir n entre m y tomar el resultado, por exceso y por defecto\n multiplicar dichos resultados por m y ya tenemos los m\ufffdltiplos buscados*/\n int ex, de;\n ex = n/m + 1;\n de = n/m;\n ex = ex * m;\n de = de * m;\n if(de == 0)\n de = n * b;\n else{\n de = fabs(de - n);\n de = de * b;\n }\n ex = fabs(ex - n);\n ex = ex * a;\n if(ex > de)\n printf(\"%d\", de);\n else\n printf(\"%d\", ex);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tlong long n, m, a, b;\n\tlong long min;\n\n\tscanf(\"%%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n\t\n\tmin = (n % m) * b < (m - (n % m)) * a ? (n % m) * b : (m - (n % m)) * a;\n\n\tprintf(\"%I64d\", min);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,i,j;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if(n<m)\n {\n i=n*b;\n j=(m-n)*a;\n if(i<j)\n {\n printf(\"%d\\n\",i);\n }\n else\n {\n printf(\"%d\\n\",j);\n }\n }\n else if(n>m)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i<j)\n {\n printf(\"%d\\n\",i);\n }\n else\n {\n printf(\"%d\\n\",j);\n }\n\n }\n }\n else\n {\n i=0;\n printf(\"%d\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,m,a,b,res;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\tres=n/m;\n\tif(n % m == 0)\n\t\tprintf(\"0\");\n\t\n\telse\n\t{\n\t\tif((n-m*res)*b >(m*(res+1)-n)*a)\n\t\t\tprintf(\"%d\",(m*(res+1)-n)*a);\n\t\telse \n\t\t\tprintf(\"%d\",(n-m*res)*b);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i, j, a, b, n, m, sum = 0;\n scanf(\"%d %d %d %d\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n sum = n*b;\n else\n sum = a*(2*m - n);\n }\n else\n sum = 0;\n printf(\"%d\\n\", sum);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,ans,c1,c2,yu;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n yu=n%m;\n if(yu==0)\n printf(\"0\\n\");\n else\n {\n c1=yu*b;\n c2=(m-yu)*a;\n if(c1>c2)\n printf(\"%d\\n\",c2);\n else\n printf(\"%d\\n\",c1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int n,m,a,b,p,q,cntd=0,cntb=0,i,j,k,d=0,b1=0,g=0;\n scanf(\"%ld%ld%ld%ld\",&n,&m,&a,&b);\n p=n;q=n;\n cntd=p%m;\n d=cntd*b;\n if(q%m==0)cntb=0;\n else\n {\n q=q+m;\n g=q/m;\n cntb=g*m-n;\n }\n b1=cntb*a;\n\n if(b1<d)printf(\"%ld\\n\",b1);\n else printf(\"%ld\\n\",d);\n return 0;\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c,a,n,m,b,d,e,f;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n c=n%m;\n d=m-n%m;\n b=b*c;\n a=a*d;\n if(a>b)\n printf(\"%d\\n\",b);\n else\n printf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,m;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n printf(\"%d\\n\",n*b);\n }\n else if(n>m){\n c=(m*2)-n;\n printf(\"%d\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n long long int n, m;\n int a, b;\n scanf(\"%ld%ld%d%d\", &n, &m, &a, &b);\n if(n % m ==0)\n printf(\"0\");\n else{\n /**Hallar el m\ufffdltiplo m\ufffds cercano a m, por encima y por\n debajo de n:\n dividir n entre m y tomar el resultado, por exceso y por defecto\n multiplicar dichos resultados por m y ya tenemos los m\ufffdltiplos buscados*/\n int ex, de;\n ex = n/m + 1;\n de = n/m;\n ex = ex * m;\n de = de * m;\n if(de == 0)\n de = n * b;\n else{\n de = fabs(de - n);\n de = de * b;\n }\n ex = fabs(ex - n);\n ex = ex * a;\n if(ex > de)\n printf(\"%d\", de);\n else\n printf(\"%d\", ex);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#define ll long long\nint main(void)\n{\n ll n,m,a,b;\n ll x,y,z;\n ll cost1,cost2;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(n%m==0) printf(\"0\");\n else\n {\n if(n>m)\n x=ceil(n*1./m);\n else\n x=ceil(m*1./n);\n cost1=(x*m-n)*a;\n cost2=(n*b);\n if(cost1>=cost2)\n printf(\"%lld\",cost2);\n else\n printf(\"%lld\",cost1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,rem1,rem2,ans1,ans2;\n int a,b;\n scanf(\"%lld%lld%ld%ld\",&n,&m,&a,&b);\n rem1=n%m;\n ans1=rem1*b;\n rem2=m-rem1;\n ans2=rem2*a;\n if(ans1>=ans2)\n {\n printf(\"%d\",ans2);\n }\n else\n {\n printf(\"%d\",ans1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,m,a,b;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\n\n\tif(n%m==0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t\treturn 0;\n\t\t}\n\n\tint dem,bui;\n\tbui=(m-n%m)*a;\n\tdem=(n%m)*b;\n\n\tif(bui<dem)\n\t printf(\"%d\\n\",bui);\n\n\telse\n\t\tprintf(\"%d\\n\",dem);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,m,a,b,c,d;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n>m)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n \t\tc=a*(m-(n%m));\n \t\td=b*(n%m);\n \t\tif(c<d)\n \t\t\tprintf(\"%d\",c);\n \t\telse\n \t\t\tprintf(\"%d\",d);\n }\n }\n else\n {\n c=((m-n)*a);\n d=(n*b);\n if(c<d)\n printf(\"%d\",c);\n else\n printf(\"%d\",d);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=((m*2)-n)*a;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,m,cost1,cost2;\n int a,b;\n scanf(\"%I64d %I64d %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else\n {\n if(n>m){\n cost1=((n/m+1)*m-n)*a;\n cost2=(n-(n/m-1)*m)*b;\n }\n else\n {\n cost1=(m-n)*a;\n cost2=n*b;\n }\n if(cost1<=cost2)\n printf(\"%I64d\",cost1);\n else\n printf(\"%I64d\",cost2);\n }\n return 0;\n}\n"}, {"source_code": "//Bismillahir rahmanir rahim \n\n#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tint m,n,a,b,rem,ans; \n\tscanf(\"%d %d %d %d\",&m,&n,&a,&b); \n\trem = m % n ;\n\tint ans1 = rem*b; \n\tint ans2 = (n-rem)*a; \n\tif(ans1>ans2) ans=ans2; \n\telse ans=ans1; \n\tprintf(\"%d\",ans); \n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<math.h>\n#include<time.h>\n\n\n\n\n\n\nint main()\n{\n long long int n,m,a,b,r,i,j;\n scanf(\"%I64 %I64 %I64 %I64\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else if(n%m!=0)\n {\n r=n%m;\n i=r*b;\n j=(m-r)*a ;\n if(i<j)\n printf(\"%I64\",i);\n else printf(\"%I64\",j);\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\n\tint m,n,a,b;\n\twhile(scanf(\"%d%d%d%d\",&m,&n,&a,&b)==4)\n\t{\n\t\tint j,k;\n\t\tif(m%n==0)\n\t\tprintf(\"0\\n\");\n\t\telse{\n\t\t\tj=((2*n)-m)*a;\n\t\t\tk=(m%n)*b;\n\t\t\tif(j>k)\n\t\t\tj=k;\n\t\t\tprintf(\"%d\\n\",j);\t\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=((m*2)-n)*a;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,a,b;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n int respuesta = 0;\n int costoA,costoB;\n if( n % m != 0 ){\n costoA = a * ( m - ( n % m ) );\n costoB = b * ( n % m );\n if( costoA < costoB ){\n respuesta = costoA;\n }else{\n respuesta = costoB;\n }\n }\n printf(\"%d\",respuesta);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int m,n,a,b;\n\tint l,d;\n\t\n\twhile(scanf(\"%l64d%l64d%l64d%l64d\",&m,&n,&a,&b)!=EOF)\n\t{\n\t\tif(m%n==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tl=(n-(m%n))*a;\n\t\t\td=(m%n)*b;\n\t\t\n\t\t\tif(l<d)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",l);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",d);\n\t\t\t}\n\t\t}\n\t\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,m;\n\tlong long a,b;\n\tlong long anc,sum;\n\tint i;\n\twhile(scanf(\"%d%d%ld%ld\",&n,&m,&a,&b)==4)\n\t{\n\t\tanc=sum=0;\n\t \tif(n%m==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n>m)\n\t\t\t{\n\t\t\tanc=b*(n-m);\n\t\t \n\t\t\t\n\t\t\tsum=(2*m-n)*a;\n\t\t\t}\n\t\t\telse\n\t\t\tif(n<m)\n\t\t\t{\n\t\t\t\tanc=n*b;\n\t\t\t\tsum=(m-n)*a;\n\t\t\t}\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t\t\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,m,a,b;\n\tscanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\n\n\tif(n%m==0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t\treturn 0;\n\t\t}\n\n\tint dem,bui;\n\tbui=(m-n%m)*a;\n\tdem=(n%m)*b;\n\n\tif(bui<dem)\n\t printf(\"%d\\n\",bui);\n\n\telse\n\t\tprintf(\"%d\\n\",dem);\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a,b,m,n,sum1=0,sum2=0,sum=0;\n\tscanf(\"%d%d%d%d\",&n,&m,&a,&b);\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\tif(n%m!=0)\n\t{\n\t\tif(n>m)\n\t\t{\n\t\t\tsum1=(m-(n-m))*a;\n\t\t\tsum2=(n-m)*b;\n\t\t\tif(sum1<sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\tif(sum1==sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\tif(sum1>sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\t}\n\t\t}\n\t\tif(n<m)\n\t\t{\n\t\t\tsum1=(m-n)*a;\n\t\t\tsum2=n*b;\n\t\t\tif(sum1<sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\tif(sum1==sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\tif(sum1>sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,m,a,b,x,a1,a2;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\");\n }\n else\n {\n x=n%m;\n a1=(x)*b;\n a2=(m-x)*a;\n if(a1>a2)\n {\n printf(\"%d\",a2);\n }\n else\n {\n printf(\"%d\",a1);\n }\n }\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int m,n;\n\tint a,b,l,d;\n\t\n\twhile(scanf(\"%lld%lld%d%d\",&m,&n,&a,&b)!=EOF)\n\t{\n\t\tif(m%n==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tl=(n-m%n)*a;\n\t\t\td=(m%n)*b;\n\t\t\n\t\t\tif(l<d)\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",l);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",d);\n\t\t\t}\n\t\t}\n\t\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,n,m;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n printf(\"%d\\n\",n*b);\n }\n else if(n>m){\n c=(m*2)-n;\n printf(\"%d\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n-m)*b;\n q=((m*2)-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,m,sum1,sum2;\n int a,b;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else\n {\n int t;\n t=n%m;\n sum1=t*b;\n sum2=(m-t)*a;\n if(sum1>=sum2)\n printf(\"%lld\\n\",sum2);\n else\n printf(\"%lld\\n\",sum1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long int\nint main()\n\n{\n ll n,m,a,b;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else\n {\n if(n>m)\n {\n if((m-(n%m))*a<(m-(n%m))*b)\n printf(\"%lld\\n\",(m-(n%m))*a);\n else\n printf(\"%lld\\n\",(m-(n%m))*b);\n }\n else\n {\n if((m-n)*a>n*b)\n printf(\"%lld\\n\",n*b);\n else\n printf(\"%lld\\n\",(m-n)*b);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,a,b,r,s;\n\t\n\tscanf(\"%d%d%d%d\",&n,&m,&a,&b);\n\t\n\tif(n%m == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\ts = n % m * b > (m - n % m) * a ?(m - n % m) * a:n % m * b;\n\t\t\n\t\ts = s > n * b?n * b:s;\n\t\t\n\t\tprintf(\"%d\",s);\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n,m,a,b,c,d,cc,dd;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tif(n>m)\n\t{\n\t\td=n%m;\n\t\tdd=d*b;\n\t\tc=(((n/m)+1)*m)-n;\n\t\tcc=c*a;\n\t}\n\telse if(m>n)\n\t{\n\t\tdd=n*b;\n\t\tcc=(m-n)*a;\n\t}\n\tif(dd>cc)printf(\"%lld\\n\",cc);\n\telse if(cc>dd)printf(\"%lld\\n\",dd);\n\telse if (n%m==0)printf(\"0\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a , b, n, m, c, x, y, z;\n scanf(\"%d %d %d %d\", &n, &m, &a, &b);\n\n c = n / m;\n\n if(n%m == 0)\n {\n printf(\"0\\n\");\n return 0;\n }\n\n x = (((c + 1)*m )- n)*a ;\n y = (n-(c*m))*b;\n if(x < y)\n z = x;\n else\n z = y;\n printf(\"%d\\n\", z);\n\n return 0;\n\n}\n"}, {"source_code": "// \n// \n#include <stdio.h>\n\nint main()\n{\n long long int n,i,m,a,b;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n i=n%m;\n if(i==0)\n printf(\"0\\n\");\n else if(a*i<=b*(m-i))\n printf(\"%I64d\\n\",a*i);\n else\n printf(\"%I64d\\n\",b*(m-i));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n-m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i, j, a, b, n, m, sum = 0;\n scanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n sum = n*b;\n else\n sum = a*(2*m - n);\n }\n else\n sum = 0;\n printf(\"%lld\\n\", sum);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a,b,m,n,sum1=0,sum2=0,sum=0;\n\tscanf(\"%d%d%d%d\",&n,&m,&a,&b);\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\tif(n%m!=0)\n\t{\n\t\tif(n>m)\n\t\t{\n\t\t\tsum1=(m-(n-m))*a;\n\t\t\tsum2=(n-m)*b;\n\t\t\tif(sum1<sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\t}\n\t\t}\n\t\tif(n<m)\n\t\t{\n\t\t\tsum1=(m-n)*a;\n\t\t\tsum2=n*b;\n\t\t\tif(sum1<sum2)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",sum2);\n\t\t\t}\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long n,m;\n\tint a,b;\n\tlong long anc,sum;\n\tint i;\n\tscanf(\"%I64d%I64d%d%d\",&n,&m,&a,&b);\n\n\t\tanc=sum=0;\n\t \tif(n%m==0 )\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n>m&& n%m!=0)\n\t\t\t{\n\t\t\tanc=b*(n-m);\n\t\t \n\t\t\t\n\t\t\tsum=(2*m-n)*a;\n\t\t\t}\n\t\t\telse\n\t\t\tif(n<m && n%m!=0)\n\t\t\t{\n\t\t\t\tanc=n*b;\n\t\t\t\tsum=(m-n)*a;\n\t\t\t}\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%I64d\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\n\t\treturn 0;\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define min(x,y) x<y?x:y\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int dr=n%m,cr=((n/m)+1)*m-n;\n printf(\"%d\",min(cr*a,dr*b));\n }\n else\n {\n int diff=m-n;\n printf(\"%d\",min(diff*a,n*b));\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n-m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n,m,a,b,c,d,cc,dd;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tif(n>m)\n\t{\n\t\td=n%m;\n\t\tdd=d*b;\n\t\tc=(((n/m)+1)*m)-n;\n\t\tcc=c*a;\n\t}\n\telse if(m>n)\n\t{\n\t\tdd=n*b;\n\t\tcc=(m-n)*a;\n\t}\n\tif(dd>cc)printf(\"%lld\\n\",cc);\n\telse if(cc>dd)printf(\"%lld\\n\",dd);\n\telse if (n%m==0)printf(\"0\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x[4],i,b,c,sm1,sm2;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n if ((x[0]%x[1])==0)\n {\n printf(\"0\");\n }\n else\n {\n b=(x[0]%x[1]);\n c=x[1]-b;\n sm1=b*x[3];\n sm2=c*x[2];\n if(sm1<sm2)\n {\n printf(\"\\n\\n%d\",b*x[3]);\n }\n else\n {\n printf(\"\\n\\n%d\",c*x[2]);\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int a,b,c,d,e,f,g,h;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&c,&d);\n\tif(a%b==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tf=b-a;\n\t\t}\n\t\telse\n\t\t{\n\t\t\te=a/b;\n\t\t\te=e+1;\n\t\t\tf=(e*b)-a;\n\t\t}\n\t\t\tg=f*c;\n\t\t\th=a*d;\n\t\t\tif(g<h)\n\t\t\t{\n\t\t\t\tprintf(\"%lld\\n\",g);\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t{\n\t\t\tprintf(\"%lld\\n\",h);\n\t\t\treturn 0;\n\t\t}\n\t\t}\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,c,d;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n>m)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n \t\tc=a*(m-(n%m));\n \t\td=b*(n%m);\n \t\tif(c<d)\n \t\t\tprintf(\"%d\",c);\n \t\telse\n \t\t\tprintf(\"%d\",d);\n }\n }\n else\n {\n c=((m-n)*a);\n d=(n*b);\n if(c<d)\n printf(\"%d\",c);\n else\n printf(\"%d\",d);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n, m, a, b ;\n\tscanf(\"%I64d %I64d %I64d %I64d\", &n, &m, &a, &b);\n\tif (n >= m) {\n\t\tlong long x, y;\n\t\tx = n % m;\n\t\ty = n / m;\n\t\tif (b*x >= ((y + 1)* m-n)*a) printf(\"%I64d\", ((y + 1)*m-n)*a);\n\t\telse printf(\"%I64d\", b*x);\n\t}\n\telse if (n < m) {\n\t\tif (a*n >= (m - n)*b) printf(\"%I64d\", a*n);\n\t\telse printf(\"%I64d\", (m - n)*b);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long long int m,n,a,b,p,q;\n scanf(\"%I64d %I64d %I64d %I64d\",&n,&m,&a,&b);\n if( n%m==0){\n printf(\"0\");\n }\n else if(n>m && n%m!=0){\n p=(n-m)*b;\n q=(m*(ceil(n/(m*1.0)))-n)*a;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n else if(n<m){\n p=(m-n)*a;\n q=(n)*b;\n if(p>q){\n printf(\"%I64d\",q);\n }\n else\n printf(\"%I64d\",p);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,m,a,b,x,a1,a2,ans;\n scanf(\"%d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n }\n else\n {\n x=n%m;\n a1=(n-x)*b;\n a2=(n+m-x)*a;\n if(a1>a2)\n {\n printf(\"%d\",a2);\n }\n else\n {\n printf(\"%d\",a1);\n }\n }\n\t// your code goes here\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\n\tlong long int m,n,a,b;\n\twhile(scanf(\"%lld%lld%lld%lld\",&m,&n,&a,&b)==4)\n\t{\n\t\tlong long j,k;\n\t\tif(m%n==0)\n\t\tprintf(\"0\\n\");\n\t\telse{\n\t\t\tj=((2*n)-m)*a;\n\t\t\tk=(m%n)*b;\n\t\t\tif(j>k)\n\t\t\tj=k;\n\t\t\tprintf(\"%lld\\n\",j);\t\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int m,n,a,b;\n\tint l,d;\n\t\n\t\n\twhile(scanf(\"%lld%lld%lld%lld\",&m,&n,&a,&b)!=EOF)\n\t{\n\t\tif(m%n==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tl=(n-(m%n))*a;\n\t\t\td=(m%n)*b;\n\t\t\n\t\t\tif(l<d)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",l);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",d);\n\t\t\t}\n\t\t}\n\t\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<math.h>\n#include<time.h>\n\n\n\n\n\n\nint main()\n{\n long long int n,m,a,b,r,i,j;\n scanf(\"%I64 %I64 %I64 %I64\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else if(n%m!=0)\n {\n r=n%m;\n i=r*b;\n j=(m-r)*a ;\n if(i<j)\n printf(\"%I64\",i);\n else printf(\"%I64\",j);\n }\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,ans,c1,c2,yu;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n yu=n%m;\n if(yu==0)\n printf(\"0\\n\");\n else\n {\n c1=yu*b;\n c2=(m-yu)*a;\n if(c1>c2)\n printf(\"%d\\n\",c2);\n else\n printf(\"%d\\n\",c1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,m,a,b,result,temp;\n\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n temp=n;\n if(n%m==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n {\n if(n>m)\n {\n while(1)\n {\n if(n%m==0) break;\n\n n++;\n\n }\n result=(n-temp)*a;\n printf(\"%%I64d\\n\",result);\n return 0;\n }\n\n else if(n<m)\n {\n result=(n)*b;\n printf(\"%%I64d\",result);\n return 0;\n }\n \n }\n \n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,i,j;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n%m!=0)\n {\n if(n<m)\n {\n i=n*b;\n j=(m-n)*a;\n if(i<j)\n {\n printf(\"%d\\n\",i);\n }\n else\n {\n printf(\"%d\\n\",j);\n }\n }\n else if(n>m)\n {\n i=(n%m)*b;\n j=(m-(n%m))*a;\n if(i<j)\n {\n printf(\"%d\\n\",i);\n }\n else\n {\n printf(\"%d\\n\",j);\n }\n\n }\n }\n else\n {\n i=0;\n printf(\"%d\\n\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i, j, a, b, n, m, sum = 0, sum1 = 0;\n scanf(\"%lld %lld %lld %lld\", &n, &m, &a, &b);\n if(n % m != 0)\n {\n if(n < m)\n {\n sum = n*b;\n sum1 = (m - n)*a;\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n else\n {\n sum = a*(2*m - n);\n sum1 = b*(n-m);\n if(sum1 > sum)\n printf(\"%lld\\n\", sum);\n else\n printf(\"%lld\\n\", sum1);\n }\n\n }\n else\n printf(\"%lld\\n\", sum);\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint m,n,a,b,l,d;\n\t\n\twhile(scanf(\"%d%d%d%d\",&m,&n,&a,&b)!=EOF)\n\t{\n\t\tif(m%n==0)\n\t\t{\n\t\t\tprintf(\"0\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tl=(n-m%n)*a;\n\t\t\td=(m%n)*b;\n\t\t\n\t\t\tif(l<d)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",l);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\",d);\n\t\t\t}\n\t\t}\n\t\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n,m,a,b,p,q,l;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n if(m>n)\n {\n p=n*b;\n q=(m-n)*b;\n if(p>q)\n printf(\"%lld\",q);\n else\n printf(\"%lld\",p);\n //printf(\"%lld\",n*b);\n }\n else if(n>m)\n {\n l=n/m;\n p=(n-(m*l))*b;\n q=(((l+1)*m)-n)*a;\n if(p>q)\n printf(\"%lld\",q);\n else\n printf(\"%lld\",p);\n }\n else\n printf(\"%d\",0);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=((m*2)-n)*a;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#define min(x,y) x<y?x:y\nint main()\n{\nint n,m,a,b,x,y;\nscanf(\"%d %d %d %d\",&n,&m,&a,&b);\nx=(m-(n%m))*a;\ny=(n%m)*b;\nprintf(\"%d\",min(x,y));\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,a,b,c,d,f;\n\t\n\twhile(scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b)==4)\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse if(n<m)\n\t{\n\t\tc=b*n;\n\t\td=(m-n)*a;\n\t\tif(c>d)\n\t\t{\n\t\t\tprintf(\"%d\",d);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",c);\n\t\t}\n\t}\n\telse if(n>m)\n\t{\n\t\tf=n%m;\n\t\tc=a*(m-f);//jianli\n\t\td=b*f;\n\t\tif(c>d)\n\t\t{\n\t\t\tprintf(\"%d\",d);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",c);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,m;\n\tint a,b;\n\tlong long anc,sum;\n\tint i;\n\twhile(scanf(\"%ld%ld%d%d\",&n,&m,&a,&b)==4)\n\t{\n\t\tanc=sum=0;\n\t \tif(n%m==0)\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n>m)\n\t\t\t{\n\t\t\tanc=b*(n-m);\n\t\t \n\t\t\t\n\t\t\tsum=(2*m-n)*a;\n\t\t\t}\n\t\t\telse\n\t\t\tif(n<m)\n\t\t\t{\n\t\t\t\tanc=n*b;\n\t\t\t\tsum=(m-n)*a;\n\t\t\t}\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t\t\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#define min(x,y) x<y?x:y\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int dr=n%m,cr=((cr/m)+1)*m-n;\n printf(\"%d\",min(cr*a,dr*b));\n }\n else\n {\n int diff=m-n;\n printf(\"%d\",min(diff*a,n*b));\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong int n,m;\n\tint a,b;\n\t\n\tscanf(\"%ld%ld%d%d\",&n,&m,&a,&b);\n\t\n\tlong int r1,r2,c1,c2;\n\t\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\t\n\telse\n\t{\n\t\tr1=n%m;\n\t\tr2=m-r1;\n\t\t\n\t\tif(r1<r2)\n\t\t{\n\t \tc1=r1*b;\n\t \tc2=r2*a;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%ld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%ld\\n\",c2);\n\t }\n\t \n\t else\n\t {\n\t \t c1=r2*a;\n\t \tc2=r1*b;\n\t\t\n\t\t if(c1<c2)\n\t\t printf(\"%ld\\n\",c1);\n\t\t\n\t\t else\n\t\t printf(\"%ld\\n\",c2);\n\t\t}\n\t}\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,b,c,d;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n>m)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n \t\tc=a*(m-(n%m));\n \t\td=b*(n%m);\n \t\tif(c<d)\n \t\t\tprintf(\"%d\",c);\n \t\telse\n \t\t\tprintf(\"%d\",d);\n }\n }\n else\n {\n c=((m-n)*a);\n d=(n*b);\n if(c<d)\n printf(\"%d\",c);\n else\n printf(\"%d\",d);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int cr=n%m;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n else\n {\n int cr=m%n;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=((m*2)-n)*a;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int cr=n%m;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n else\n {\n int cr=m%n;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int n,m,a,b,p,q,cntd=0,cntb=0,i,j,k,d=0,b1=0,flag=0;\n scanf(\"%ld%ld%ld%ld\",&n,&m,&a,&b);\n p=n;q=n;\n while(1)\n {\n if(q%m!=0)\n {\n q=q-1;cntd++;\n }\n else break;\n }d=cntd*b;\n while(1)\n { if(b1>d){flag=1;break;}\n if(p%m!=0)\n {\n p=p+1;cntb++;\n b1=cntb*a;\n }\n else break;\n }\n\n if(flag==0)printf(\"%ld\\n\",b1);\n else printf(\"%ld\\n\",d);\n return 0;\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n printf(\"%lld\\n\",n*b);\n }\n else if(n>m){\n c=(m*2)-n;\n printf(\"%lld\\n\",c*a);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,a,b,acost,bcost,t;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n%m==0)\n return printf(\"0\\n\"),0;\n else\n {\n t=n%m;\n acost=(m-t)*a;\n bcost=t*b;\n\n if(bcost<acost)\n return printf(\"%d\\n\",bcost),0;\n }\n printf(\"%d\\n\",acost);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m;\n int a,b,x,y;\n scanf(\"%lli%lli%d%d\",&n,&m,&a,&b);\n if(n<=1000000000000&&m<=1000000000000&&a<=100&&b<=100&&1<=n&&1<=m&&1<=a&&1<=b)\n {\n if(n%m==0)\n printf(\"0\");\n else\n {\n x = (n%m)*b;\n y = (m-n%m)*a;\n if(x<y)\n printf(\"%d\",x);\n else\n printf(\"%d\",y);\n }\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,a,b,c,d;\n\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\n d=(n%m)*b;\n\n c=(((ceil(1.0*n/m))*m)-n)*a;\n\n (c<d)?printf(\"%d\",c):printf(\"%d\",d);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,a,b,c,d;\n\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\n d=(n%m)*b;\n\n c=(((ceil(1.0*n/m))*m)-n)*a;\n\n (c<d)?printf(\"%d\",c):printf(\"%d\",d);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,m,sum1,sum2;\n int a,b;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else\n {\n int t;\n t=n%m;\n sum1=t*b;\n sum2=(m-t)*a;\n if(sum1>=sum2)\n printf(\"%lld\\n\",sum2);\n else\n printf(\"%lld\\n\",sum1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=((m*2)-n)*a;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#define ll long long\nint main(void)\n{\n ll n,m,a,b;\n ll c1,c2,t;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\n if(n%m==0) printf(\"0\");\n else\n {\n if(n>m)\n {\n c1=(n-m)*b;\n c2=(ceil(n*1./m)*m-n)*a;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n else\n {\n c1=(m-n)*a;\n c2=n*b;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,m,a,b,x,a1,a2;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n // printf(\"%d %d %d %d\",n,m,a,b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n }\n else\n {\n x=n%m;\n a1=(x)*b;\n a2=(m-x)*a;\n if(a1>a2)\n {\n printf(\"%d\",a2);\n }\n else\n {\n printf(\"%d\",a1);\n }\n }\n // printf(\"%d\",x);\n //printf(\"%d %d\",a1,a2);\n\t// your code goes here\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint min(int a, int b){\n return a<b ? a : b;\n}\n\nint main(){\n\n int i=0;\n\n int n,m,a,b;\n scanf(\"%d %d %d %d\",&n,&m,&a,&b);\n\n int p = n%m;\n int q = m-p;\n\n int ans = min(b*p,a*q);\n\n printf(\"%d\\n\",ans);\n\n return 0;\n\n}\n"}, {"source_code": " #include<stdio.h>\n\nint main()\n{\nint n,m,a,b,c,r;\nscanf(\"%d %d %d %d\",&n,&m,&a,&b);\nc=n/m;\nif(n%m==0)\n printf(\"0\");\n if(n>m && n%m!=0){\n if((n-m)*b>=((m*(c+1))-n)*a){\n r=((m*(c+1))-n)*a;\n printf(\"%d\",r);}\n else if((n-m)*b<((m*(c+1))-n)*a){\n r=(n-m)*b;\n printf(\"%d\",r);\n\n }\n }\n else if(n<m){\n if((m-n)*a>=n*b){\n r=n*b;\n printf(\"%d\",r);\n }\n else if((m-n)*a<n*b){\n r=(m-n)*a;\n printf(\"%d\",r);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long n,m;\n\tint a,b;\n\tlong long anc,sum;\n\tint i;\n\tscanf(\"%ld%ld%d%d\",&n,&m,&a,&b);\n\n\t\tanc=sum=0;\n\t \tif(n%m==0 )\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n>m&& n%m!=0)\n\t\t\t{\n\t\t\tanc=b*(n-m);\n\t\t \n\t\t\t\n\t\t\tsum=(2*m-n)*a;\n\t\t\t}\n\t\t\telse\n\t\t\tif(n<m && n%m!=0)\n\t\t\t{\n\t\t\t\tanc=n*b;\n\t\t\t\tsum=(m-n)*a;\n\t\t\t}\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\n\t\treturn 0;\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,d,x,y,n,m;\n scanf(\"%lld %lld %lld %lld\",&n,&m,&a,&b);\n if(n%m==0){\n printf(\"0\\n\");\n }\n else{\n if(n<m){\n x=n*b;\n y=(m-n)*a;\n if(x>y)\n printf(\"%lld\\n\",y);\n else\n printf(\"%lld\\n\",x);\n }\n else if(n>m){\n c=(m*2)-n;\n d=(n-m)*b;\n if(c>d)\n printf(\"%lld\\n\",d);\n else\n printf(\"%lld\\n\",c);\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#define min(x,y) x<y?x:y\nint main()\n{\nint n,m,a,b,x,y;\nscanf(\"%d %d %d %d\",&n,&m,&a,&b);\nx=(m-(n%m))*a;\ny=(n%m)*b;\nprintf(\"%d\",min(x,y));\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long n,m,a,b,c,d,cc,dd;\n\tscanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\tif(n>m)\n\t{\n\t\td=n%m;\n\t\tdd=d*b;\n\t\tc=(((n/m)+1)*m)-n;\n\t\tcc=c*a;\n\t}\n\telse if(m>n)\n\t{\n\t\tdd=n*b;\n\t\tcc=(m-n)*a;\n\t}\n\tif(dd>cc)printf(\"%d\\n\",cc);\n\telse if(cc>dd)printf(\"%d\\n\",dd);\n\telse if (n%m==0)printf(\"0\\n\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#define ll long long\nint main(void)\n{\n ll n,m,a,b;\n ll c1,c2,t;\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n\n if(n%m==0) printf(\"0\");\n else\n {\n if(n>m)\n {\n c1=(n-m)*b;\n c2=(ceil(n*1./m)*m-n)*a;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n else\n {\n c1=(m-n)*a;\n c2=n*b;\n t=(c1>=c2)?c2:c1;\n printf(\"%lld\",t);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define Min(a,b) a<b ? a : b\nint main()\n{\n int n, m, a, b, d, x, y;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n%m==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n d = (m+n-1)/m;\n x = (d*m - n)*a;\n d = Min(n,abs(n-m));\n y = d*b;\n printf(\"%d\\n\",Min(x,y));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m,a,b,r,s;\n\t\n\tscanf(\"%d%d%d%d\",&n,&m,&a,&b);\n\t\n\tif(n%m == 0)\n\t{\n\t\tprintf(\"0\\n\");\n\t}\n\telse\n\t{\n\t\ts = n % m * b > (m - n % m) * a ?(m - n % m) * a:n % m * b;\n\t\t\n\t\tprintf(\"%d\\n\",s);\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n,m,cost1,cost2;\n int a,b;\n scanf(\"%I64d %I64d %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\");\n else\n {\n if(n>m){\n cost1=((n/m+1)*m-n)*a;\n cost2=(n-(n/m-1)*m)*b;\n }\n else\n {\n cost1=(m-n)*a;\n cost2=n*b;\n }\n if(cost1<=cost2)\n printf(\"%I64d\",cost1);\n else\n printf(\"%I64d\",cost2);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,m,a,b,c,d,f;\n\t\n\twhile(scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b)==4)\n\tif(n%m==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse if(n<m)\n\t{\n\t\tc=b*n;\n\t\td=(m-n)*a;\n\t\tif(c>d)\n\t\t{\n\t\t\tprintf(\"%d\",d);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",c);\n\t\t}\n\t}\n\telse if(n>m)\n\t{\n\t\tf=n%m;\n\t\tc=a*(m-f);//jianli\n\t\td=b*f;\n\t\tif(c>d)\n\t\t{\n\t\t\tprintf(\"%d\",d);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\",c);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,a,b,ccost,dcost;\n scanf(\"%d%d%d%d\",&n,&m,&a,&b);\n if(n==m) printf(\"0\");\n else if(n>m)\n {\n int cr=n%m;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n else\n {\n int cr=m%n;\n printf(\"%d\",cr*a>cr*b?cr*b:cr*a);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,m,a,b,result,temp,tenp2;\n\n scanf(\"%lld%lld%lld%lld\",&n,&m,&a,&b);\n temp=n;tenp2=m;\n if(n%m==0)\n {\n printf(\"0\\n\");\n return 0;\n }\n else\n {\n if(n>m)\n {\n while(1)\n {\n if(n%m==0) break;\n\n n++;\n\n }\n printf(\"%d\\n\",n/m);\n result=((n-temp)*a);\n printf(\"%lld\\n\",result);\n return 0;\n }\n\n else if(n<m)\n {\n while(1)\n {\n if(n%m==0) break;\n\n n--;\n\n }\n result=(temp-n)*b;\n printf(\"%lld\",result);\n return 0;\n }\n\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long n,m;\n\tint a,b;\n\tlong long anc,sum;\n\tint i;\n\tscanf(\"%ld%ld%d%d\",&n,&m,&a,&b);\n\n\t\tanc=sum=0;\n\t \tif(n%m==0 )\n\t\t{\n\t\t\tprintf(\"0\\n\");\n\t\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(n>m&& n%m!=0)\n\t\t\t{\n\t\t\tanc=b*(n-m);\n\t\t \n\t\t\t\n\t\t\tsum=(2*m-n)*a;\n\t\t\t}\n\t\t\telse\n\t\t\tif(n<m && n%m!=0)\n\t\t\t{\n\t\t\t\tanc=n*b;\n\t\t\t\tsum=(m-n)*a;\n\t\t\t}\n\t\t\t\tif(anc<sum)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",anc);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%ld\\n\",sum);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\n\t\t\n\t\treturn 0;\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long long int n,m,sum1,sum2;\n int a,b;\n scanf(\"%lld %lld %d %d\",&n,&m,&a,&b);\n if(n%m==0)\n printf(\"0\\n\");\n else\n {\n int t;\n t=n%m;\n sum1=t*b;\n sum2=(m-t)*a;\n if(sum1>=sum2)\n printf(\"%lld\\n\",sum2);\n else\n printf(\"%lld\\n\",sum1);\n }\n return 0;\n}\n"}], "src_uid": "c05d753b35545176ad468b99ff13aa39"} {"nl": {"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 dreamt of a lexicographically k-th permutation of integers from 1 to n. Determine how many lucky numbers in the permutation are located on the positions whose indexes are also lucky numbers.", "input_spec": "The first line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009109) \u2014 the number of elements in the permutation and the lexicographical number of the permutation.", "output_spec": "If the k-th permutation of numbers from 1 to n does not exist, print the single number \"-1\" (without the quotes). Otherwise, print the answer to the problem: the number of such indexes i, that i and ai are both lucky numbers.", "sample_inputs": ["7 4", "4 7"], "sample_outputs": ["1", "1"], "notes": "NoteA permutation is an ordered set of n elements, where each integer from 1 to n occurs exactly once. The element of permutation in position with index i is denoted as ai (1\u2009\u2264\u2009i\u2009\u2264\u2009n). Permutation a is lexicographically smaller that permutation b if there is such a 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. Let's make a list of all possible permutations of n elements and sort it in the order of lexicographical increasing. Then the lexicographically k-th permutation is the k-th element of this list of permutations.In the first sample the permutation looks like that:1 2 3 4 6 7 5The only suitable position is 4.In the second sample the permutation looks like that:2 1 3 4The only suitable position is 4."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n#include <string.h>\n\n#define N\t13\n\nlong long lucky(int b) {\n\treturn b == 1 ? 0 : lucky(b / 2) * 10 + (b % 2 == 0 ? 4 : 7);\n}\n\nint is_lucky(int y) {\n\treturn y == 0 ? 1 : is_lucky(y / 10) && (y % 10 == 4 || y % 10 == 7);\n}\n\nint ff[N];\n\nvoid init() {\n\tint i, f;\n\n\tf = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tff[i] = f;\n\t\tf *= i + 1;\n\t}\n}\n\nint get(int n, int k, int i) {\n\tstatic char used[N];\n\tint h, j;\n\n\tmemset(used, 0, n * sizeof *used);\n\tfor (h = 0; h < n; h++) {\n\t\tint f = ff[n - 1 - h], s = k / f;\n\n\t\tfor (j = 0; j < n; j++)\n\t\t\tif (!used[j] && s-- == 0) {\n\t\t\t\tif (h == i)\n\t\t\t\t\treturn j;\n\t\t\t\tused[j] = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tk %= f;\n\t}\n\treturn -1;\n}\n\nint main() {\n\tint n, n_, k, b, ans;\n\tlong long f;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &k);\n\tf = 1;\n\tn_ = 1;\n\twhile (f < k)\n\t\tf *= ++n_;\n\tif (n_ > n) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tans = 0;\n\tfor (b = 2; ; b++) {\n\t\tlong long x = lucky(b);\n\t\tint y;\n\n\t\tif (x > n)\n\t\t\tbreak;\n\t\tif (x <= n - n_) {\n\t\t\tans++;\n\t\t\tcontinue;\n\t\t}\n\t\ty = n - n_ + get(n_, k - 1, x - (n - n_) - 1) + 1;\n\t\tif (is_lucky(y))\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint lucky(int x)\n{\n while (x) {\n\tif (x % 10 != 4 && x % 10 != 7) break;\n\n\tx /= 10;\n }\n\n if (x == 0) {\n\treturn 1;\n } else {\n\treturn 0;\n }\n}\n\nint fact(int n)\n{\n int x = 1, i;\n\n for (i = 1; i <= n; i++) x *= i;\n\n return x;\n}\n\nint main()\n{\n int n, k, p = 0, q = 2, r = 2, sum = 0, i, j;\n long long x = 1;\n int a[10000], b[100];\n\n scanf(\"%d %d\", &n, &k);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 8; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 1; i <= n; i++) {\n\tx *= i;\n\n\tif (x >= k) break;\n }\n\n if (i > n) {\n\tputs(\"-1\");\n\n\treturn 0;\n }\n\n for (j = 0; j < r; j++) {\n\tif (a[j] > n - i) break;\n\n\tsum++;\n }\n\n q = 0;\n\n for (j = n - i + 1; j <= n; j++) b[q++] = j;\n\n for (j = n - i + 1; j < n; j++) {\n\tp = k / fact(n - j);\n\n\tif (k % fact(n - j) == 0) p--;\n\n\tif (lucky(j) == 1 && lucky(b[p]) == 1) sum++;\n\n\tfor (i = p; i < q; i++) b[i] = b[i + 1];\n\n\tk -= p * fact(n - j);\n }\n\n if (lucky(n) == 1 && lucky(b[0]) == 1) sum++;\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define min(a, b) ((a < b) ? (a) : (b))\n#define max(a, b) ((a > b) ? (a) : (b))\n\nint l = 1, r, answ, t = 1;\nlong long a[11];\nlong long ans[2048];\nint b[13], use[13];\nint n, m, k;\n\nint\nanalyze(void)\n{\n int i, nonzero = 0;\n long long tmp = 0;\n for(i = 10; i >= 0; --i){\n if(a[i] == 0 && nonzero){\n return 1;\n }\n tmp = tmp * 10 + a[i];\n if (a[i] != 0){\n nonzero = 1;\n }\n }\n if(tmp >= r){\n ans[n++] = tmp;\n return 0;\n }\n if(tmp >= l){\n ans[n++] = tmp;\n }\n return 1;\n}\n\nvoid\ngo(int i)\n{\n if(!t){\n return;\n }\n if (i == -1){\n t = analyze();\n return;\n }\n a[i] = 0;\n go(i - 1);\n a[i] = 4;\n go(i - 1);\n a[i] = 7;\n go(i - 1);\n}\n\nvoid\ngen(int n, int p, int k){\nif(p > 0){\n int i, ans = 1;\n for(i = 1; i <= p - 1; ++i){\n ans *= i;\n }\n int tmp = k / ans;\n if(k % ans == 0){\n --tmp;\n }\n if (tmp >= n){\n printf(\"-1\");\n m = -1;\n return;\n }\n for(i = 0; ; ++i){\n if(use[i] == 0){\n if(tmp > 0){\n --tmp;\n } else {\n use[i] = 1;\n b[n - p] = i;\n break;\n }\n }\n }\n gen(n, p - 1, k % ans ? k % ans : ans);\n}\n}\n\nint\nmain(void)\n{\n scanf(\"%d%d\", &m, &k);\n r = m;\n go(10);\n answ = 0;\n int i, j, q;\n for(i = 0; ans[i] <= m - 13; ++i){\n ++answ;\n }\n gen(min(13, m), min(13, m), k);\n if(m == -1){\n return 0;\n }\n for(i = 0; i < min(13, m); ++i){\n b[i] += max(1, m - 12);\n }\n for(i = max(1, m - 12); i <= m; ++i){\n for(j = 0; j < n; ++j){\n if(ans[j] == i){\n for(q = 0; q < n; ++q){\n if(b[i - max(1, m - 12)] == ans[q]){\n ++ answ;\n }\n }\n }\n }\n }\n printf(\"%d\", answ);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint lucky(int x)\n{\n while (x) {\n\tif (x % 10 != 4 && x % 10 != 7) break;\n\n\tx /= 10;\n }\n\n if (x == 0) {\n\treturn 1;\n } else {\n\treturn 0;\n }\n}\n\nint fact(int n)\n{\n int x = 1, i;\n\n for (i = 1; i <= n; i++) x *= i;\n\n return x;\n}\n\nint main()\n{\n int n, k, p = 0, q = 2, r = 2, sum = 0, i, j;\n long long x = 1;\n int a[10000], b[100];\n\n scanf(\"%d %d\", &n, &k);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 8; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 1; i <= n; i++) {\n\tx *= i;\n\n\tif (x >= k) break;\n }\n\n if (i > n) {\n\tputs(\"-1\");\n\n\treturn 0;\n }\n\n for (j = 0; j < r; j++) {\n\tif (a[j] > n - i) break;\n\n\tsum++;\n }\n\n q = 0;\n\n for (j = n - i + 1; j <= n; j++) b[q++] = j;\n\n for (j = n - i + 1; j < n; j++) {\n\tp = k / fact(n - j);\n\n\tif (k % fact(n - j) == 0) p--;\n\n\tif (lucky(j) == 1 && lucky(b[p]) == 1) sum++;\n\n\tfor (i = p; i < q; i++) b[i] = b[i + 1];\n\n\tk -= p * fact(n - j);\n }\n\n if (lucky(n) == 1 && lucky(b[0]) == 1) sum++;\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint lucky(int x)\n{\n while (x) {\n\tif (x % 10 != 4 && x % 10 != 7) break;\n\n\tx /= 10;\n }\n\n if (x == 0) {\n\treturn 1;\n } else {\n\treturn 0;\n }\n}\n\nint fact(int n)\n{\n int x = 1, i;\n\n for (i = 1; i <= n; i++) x *= i;\n\n return x;\n}\n\nint main()\n{\n int n, k, p = 0, q = 2, r = 2, sum = 0, i, j;\n long long x = 1;\n int a[10000], b[100];\n\n scanf(\"%d %d\", &n, &k);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 8; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 1; i <= n; i++) {\n\tx *= i;\n\n\tif (x >= k) break;\n }\n\n if (i > n) {\n\tputs(\"-1\");\n\n\treturn 0;\n }\n\n if (x == k) i++;\n\n for (j = 0; j < r; j++) {\n\tif (a[j] > n - i) break;\n\n\tsum++;\n }\n\n if (x == k) {\n\tfor (j = n - i + 3; j <= n; j++) {\n\t if (lucky(j) == 1) sum++;\n\t}\n\n\tprintf(\"%d\\n\", sum);\n\n\treturn 0;\n }\n\n q = 0;\n\n for (j = n - i + 1; j <= n; j++) b[q++] = j;\n\n for (j = n - i + 1; j < n; j++) {\n\tp = k / fact(n - j);\n\n\tif (k % fact(n - j) == 0) p--;\n\n\tif (lucky(j) == 1 && lucky(b[p]) == 1) sum++;\n\n\tfor (i = p; i < q; i++) b[i] = b[i + 1];\n\n\tk -= p * fact(n - j);\n }\n\n if (lucky(n) == 1 && lucky(b[0]) == 1) sum++;\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint lucky(int x)\n{\n while (x) {\n\tif (x % 10 != 4 && x % 10 != 7) break;\n\n\tx /= 10;\n }\n\n if (x == 0) {\n\treturn 1;\n } else {\n\treturn 0;\n }\n}\n\nint fact(int n)\n{\n int x = 1, i;\n\n for (i = 1; i <= n; i++) x *= i;\n\n return x;\n}\n\nint main()\n{\n int n, k, p = 0, q = 2, r = 2, sum = 0, i, j;\n long long x = 1;\n int a[10000], b[100];\n\n scanf(\"%d %d\", &n, &k);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 8; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 1; i <= n; i++) {\n\tx *= i;\n\n\tif (x >= k) break;\n }\n\n if (i > n) {\n\tputs(\"-1\");\n\n\treturn 0;\n }\n\n if (x == k) i++;\n\n for (j = 0; j < r; j++) {\n\tif (a[j] > n - i) break;\n\n\tsum++;\n }\n\n q = 0;\n\n for (j = n - i + 1; j <= n; j++) b[q++] = j;\n\n for (j = n - i + 1; j < n; j++) {\n\tp = k / fact(n - j);\n\n\tif (k % fact(n - j) == 0) p--;\n\n\tif (lucky(j) == 1 && lucky(b[p]) == 1) sum++;\n\n\tfor (i = p; i < q; i++) b[i] = b[i + 1];\n\n\tk -= p * fact(n - j);\n }\n\n if (lucky(n) == 1 && lucky(b[0]) == 1) sum++;\n\n printf(\"%d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define min(a, b) ((a < b) ? (a) : (b))\n#define max(a, b) ((a > b) ? (a) : (b))\n\nint l = 1, r, answ, t = 1;\nlong long a[11];\nlong long ans[2048];\nint b[13], use[13];\nint n, m, k;\n\nint\nanalyze(void)\n{\n int i, nonzero = 0;\n long long tmp = 0;\n for(i = 10; i >= 0; --i){\n if(a[i] == 0 && nonzero){\n return 1;\n }\n tmp = tmp * 10 + a[i];\n if (a[i] != 0){\n nonzero = 1;\n }\n }\n if(tmp >= r){\n ans[n++] = tmp;\n return 0;\n }\n if(tmp >= l){\n ans[n++] = tmp;\n }\n return 1;\n}\n\nvoid\ngo(int i)\n{\n if(!t){\n return;\n }\n if (i == -1){\n t = analyze();\n return;\n }\n a[i] = 0;\n go(i - 1);\n a[i] = 4;\n go(i - 1);\n a[i] = 7;\n go(i - 1);\n}\n\nvoid\ngen(int n, int p, int k){\nif(p > 0){\n int i, ans = 1;\n for(i = 1; i <= p - 1; ++i){\n ans *= i;\n }\n int tmp = k / ans;\n if(k % ans == 0){\n --tmp;\n }\n for(i = 0; ; ++i){\n if(use[i] == 0){\n if(tmp > 0){\n --tmp;\n } else {\n use[i] = 1;\n b[n - p] = i;\n break;\n }\n }\n }\n gen(n, p - 1, k % ans ? k % ans : ans);\n}\n}\n\nint\nmain(void)\n{\n scanf(\"%d%d\", &m, &k);\n r = m;\n go(10);\n answ = 0;\n int i, j, q;\n for(i = 0; ans[i] <= m - 13; ++i){\n ++answ;\n }\n gen(min(13, m), min(13, m), k);\n for(i = 0; i < min(13, m); ++i){\n b[i] += max(1, m - 12);\n }\n for(i = max(1, m - 12); i <= m; ++i){\n for(j = 0; j < n; ++j){\n if(ans[j] == i){\n for(q = 0; q < n; ++q){\n if(b[i - max(1, m - 12)] == ans[q]){\n ++ answ;\n }\n }\n }\n }\n }\n printf(\"%d\", answ);\n return 0;\n}\n"}], "src_uid": "cb2aa02772f95fefd1856960b6ceac4c"} {"nl": {"description": "Awruk is taking part in elections in his school. It is the final round. He has only one opponent\u00a0\u2014 Elodreip. The are $$$n$$$ students in the school. Each student has exactly $$$k$$$ votes and is obligated to use all of them. So Awruk knows that if a person gives $$$a_i$$$ votes for Elodreip, than he will get exactly $$$k - a_i$$$ votes from this person. Of course $$$0 \\le k - a_i$$$ holds.Awruk knows that if he loses his life is over. He has been speaking a lot with his friends and now he knows $$$a_1, a_2, \\dots, a_n$$$ \u2014 how many votes for Elodreip each student wants to give. Now he wants to change the number $$$k$$$ to win the elections. Of course he knows that bigger $$$k$$$ means bigger chance that somebody may notice that he has changed something and then he will be disqualified.So, Awruk knows $$$a_1, a_2, \\dots, a_n$$$ \u2014 how many votes each student will give to his opponent. Help him select the smallest winning number $$$k$$$. In order to win, Awruk needs to get strictly more votes than Elodreip.", "input_spec": "The first line contains integer $$$n$$$ ($$$1 \\le n \\le 100$$$)\u00a0\u2014 the number of students in the school. The second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\leq a_i \\leq 100$$$)\u00a0\u2014 the number of votes each student gives to Elodreip.", "output_spec": "Output the smallest integer $$$k$$$ ($$$k \\ge \\max a_i$$$) which gives Awruk the victory. In order to win, Awruk needs to get strictly more votes than Elodreip.", "sample_inputs": ["5\n1 1 1 5 1", "5\n2 2 3 2 2"], "sample_outputs": ["5", "5"], "notes": "NoteIn the first example, Elodreip gets $$$1 + 1 + 1 + 5 + 1 = 9$$$ votes. The smallest possible $$$k$$$ is $$$5$$$ (it surely can't be less due to the fourth person), and it leads to $$$4 + 4 + 4 + 0 + 4 = 16$$$ votes for Awruk, which is enough to win.In the second example, Elodreip gets $$$11$$$ votes. If $$$k = 4$$$, Awruk gets $$$9$$$ votes and loses to Elodreip."}, "positive_code": [{"source_code": "#include<stdio.h>\n\n\n\nint main(){\n\t\n\tint students;\n\tscanf(\"%d\", &students);\n\tint arr[students];\n\tint arr1[students];\n\tint max = -1;\n\tint count = 0;\n\tfor(int i = 0 ; i < students ; i ++){\n\t\tscanf(\"%d\", &arr[i]);\n\t\tcount += arr[i];\n\t\tif(arr[i] > max)max = arr[i];\n\t}\n\tint cek = 1;\n\tint temp;\n\twhile(cek){\n\t\ttemp = 0;\n\t\tfor(int i = 0 ; i < students ; i ++){\n\t\t\tarr1[i] = max - arr[i];\n\t\t\ttemp += arr1[i];\n\t\t}\n\t\tif(temp <= count){\n\t\t\tmax++;\n\t\t}\n\t\telse{\n\t\t\tcek = 0;\n\t\t}\n\t}\n\tprintf(\"%d\", max);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[101],i=0,Awr=0,l=0,Elo=0;\n scanf(\"%d\",&n);\n while(i!=n)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>l)\n l=a[i];\n Elo+=a[i];\n i++;\n }\n while(1)\n {\n Awr=0;\n for(i=0; i<n; i++)\n {\n Awr+=(l-a[i]);\n }\n if(Awr>Elo)\n {\n printf(\"%d\\n\",l);\n break;\n }\n l++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<=s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n int n,mx=0,i,tmp,sum=0,k;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&tmp);\n if(tmp>mx)mx=tmp;\n sum+=tmp;\n }\n sum*=2;\n if((sum%n)==0)k=sum/n;\n else k=(sum/n)+1;\n if((n*k)==sum)k++;\n if(k<mx)printf(\"%d\",mx);\n else printf(\"%d\",k);\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint max = arr[0];\n\tint total = 0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif(arr[i] > max)\n\t\t{\n\t\t\tmax = arr[i];\n\t\t}\n\t\ttotal += arr[i];\n\t}\n\tint total_other = 0 ;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\ttotal_other+= max - arr[i];\n\t}\n\n\t//printf(\"%d %d\\n\",total,total_other);\n\tif (total_other > total)\n\t{\n\t\tprintf(\"%d\",max);\n\t}\n\telse\n\t{\n\t\tif ((total - total_other) % n == 0)\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n +1 + max);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + 1 + max);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\nint main()\n{\n//\tfreopen(\"test.txt\", \"r\", stdin);\n int n;\n scanf(\"%d\", &n);\n int d[n], maxv = 0, enemy = 0;\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &d[i]);\n maxv = max(maxv, d[i]);\n enemy += d[i];\n }\n int sum = 0;\n for(int i = 0; i < n; i++)\n sum += maxv - d[i];\n int i = maxv;\n while(i <= 20000)\n {\n if(sum > enemy)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n sum += n;\n i++;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,n,i,sum=0,max=0,p,k;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a);\n if(max<a)\n max=a;\n sum=sum+a;\n }\n p=max*n;\n k=p-sum;\n int l;\n if(k>sum)\n printf(\"%d\",max);\n else\n {\n for(i=max+1;;i++)\n {\n \n p=n*i;\n \n l=(p-sum);\n \n if(l>sum)\n \n break;\n }\n printf(\"%d\",i);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,n[10000],m,i,j,sum=0,sum1=0,k=0;\n scanf(\"%d\",&a);\n for(i=0; i<a; i++)\n {\n scanf(\"%d\",&n[i]);\n sum=sum+n[i];\n if(k<n[i])\n {\n k=n[i];\n }\n }\n if(a==1)\n {\n printf(\"%d\",2*n[0]+1);\n return 0;\n }\n for(j=0; j<600; j++)\n {\n sum1=0;\n for(i=0; i<a; i++)\n {\n sum1=sum1+(k+j-n[i]);\n\n }\n\n if(sum1>sum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,n,i,sum=0,max=0,p,k;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a);\n if(max<a)\n max=a;\n sum=sum+a;\n }\n p=max*n;\n k=p-sum;\n int l;\n if(k>sum)\n printf(\"%d\",max);\n else\n {\n for(i=max+1;;i++)\n {\n \n p=n*i;\n \n l=(p-sum);\n \n if(l>sum)\n \n break;\n }\n printf(\"%d\",i);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=1000000;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n newsum+=(max-a[i]);\n }\n if(newsum>sum)\n {\n printf(\"%d\\n\",max);\n return 0;\n }\n else\n {\n x=(((sum+1)-newsum)/n);\n y=x*n;\n if(y==(sum-newsum+1))\n {\n printf(\"%d\\n\",max+x);\n return 0;\n }\n else if(y!=(sum-newsum+1)){\n printf(\"%d\\n\",max+x+1);return 0;}\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\nint main()\n{\n//\tfreopen(\"test.txt\", \"r\", stdin);\n int n;\n scanf(\"%d\", &n);\n int d[n], maxv = 0, enemy = 0;\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &d[i]);\n maxv = max(maxv, d[i]);\n enemy += d[i];\n }\n int sum = 0;\n for(int i = 0; i < n; i++)\n sum += maxv - d[i];\n int i = maxv;\n while(i <= 20000)\n {\n if(sum > enemy)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n sum += n;\n i++;\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int cpy,n,k,my_votes=0,opp_votes,tmp,mx;\n scanf(\"%d\",&n);\n scanf(\"%d\",&tmp);\n mx=tmp;\n opp_votes=tmp;\n cpy=n;\n while(cpy>1)\n {\n scanf(\"%d\",&tmp);\n opp_votes+=tmp;\n if(mx<tmp)\n mx=tmp;\n cpy--;\n }\n k=mx;\n while(my_votes<=opp_votes)\n {\n my_votes=(k*n)-opp_votes;\n k++;\n }\n printf(\"%d\",k-1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,a,k=0,s=0,max=0;\nint main()\n{\n\tscanf(\"%d\",&n);\nfor (int i=0;i<n;i++)\n{\n\tscanf(\"%d\",&a);\n s=s+a;\nif (max<a) \nmax=a;\n}\nwhile(n*k<=2*s)\nk++;\nif(k<max)\nk=max;\nprintf(\"%d\",k);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,s,max;\n scanf(\"%d\",&n);\n int array[n];\n for(int i=0;i<n;i++)\n { \n \tscanf(\"%d\",&array[i]);\n \ts+=array[i];\n\t}\n\tmax=array[0];\n for(int i=1;i<n;i++)\n\t{\n\t\t\n\t\tif(max<array[i])\n\t\t{\n\t\t\tmax=array[i];\n\t\t}\n\t}\n\tif(max<2*s/n+1)\n\t{\n \tprintf(\"%d\",2*s/n+1);\n }\n else printf(\"%d\",max);\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,a[100],sum=0,t,max=0;\n \n scanf(\"%d\",&n);\n for(i=0;i<n;i++) \n {\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n max=a[i]>max?a[i]:max;\n }\n \n while(1)\n {\n t=max*n;\n if(sum<t-sum)\n {\n printf(\"%d\",max);exit(0);\n }\n else max++;\n \n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,n[10000],m,i,j,sum=0,sum1=0,k=0;\n scanf(\"%d\",&a);\n for(i=0; i<a; i++)\n {\n scanf(\"%d\",&n[i]);\n sum=sum+n[i];\n if(k<n[i])\n {\n k=n[i];\n }\n }\n if(a==1)\n {\n printf(\"%d\",2*n[0]+1);\n return 0;\n }\n for(j=0; j<600; j++)\n {\n sum1=0;\n for(i=0; i<a; i++)\n {\n sum1=sum1+(k+j-n[i]);\n\n }\n\n if(sum1>sum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,p,n,a[101],i,sum=0,j=0;\nscanf(\"%d\",&n);\nfor(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n k=a[1];\n for(i=1;i<=n;i++)\n {\n if (a[i]>k)\n k=a[i];\n }\n for(i=1;i<=n;i++)\n {\n sum=sum+a[i];\n }\n for(k;j<=sum;k++)\n {\n\n j=k*n-sum;\n }\n k=k-1;\n printf(\"%d\",k);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint test;\n\tint tcase[100];\n\tint k = 0;\n\tint total = 0;\n\tint totalA = 0;\n\t\n\tscanf(\"%d\" , &test);\n\tgetchar();\n\tfor(int i = 0; i < test ; i++){\n\t\tscanf(\"%d\", &tcase[i] );\n\t\ttotal = total + tcase[i];\n\t\t\n\t\tif(tcase[i] > k) k = tcase[i];\n\t}\n\t\n\tint check = 1;\n\t\n\tdo{\n\t\ttotalA = 0;\n\t\tfor(int i = 0 ; i< test ; i++){\n\t\t\ttotalA += (k-tcase[i]); \n\t\t}\n\t\tif(totalA <= total){\n\t\t\tk++;\n\t\t}\n\t\telse check = 2;\n\t}while(check == 1);\n\t\n\tprintf(\"%d\" , k);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int ar[n],sum=0,summ=0,k=0,f=0;\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&ar[i]);\n sum+=ar[i];\n if(ar[i]>k)\n k=ar[i];\n }\n // printf(\"%d %d\",k,sum);\n \n for(int i=k;f==0;i++)\n {\n summ=0;\n for(int j=0;j<n;j++)\n summ+=i-ar[j];\n if(summ>sum)\n {\n printf(\"%d\",i);\n f=1;\n }\n }\n \n return 0;\n}"}, {"source_code": "#include \"stdio.h\"\nint findMax(int a[],int num)\n{\n\tint i,max=a[0];\n\tfor(i=1;i<num;i++)\n\t\tif(a[i]>max)\n\t\t\tmax = a[i];\n\treturn max;\t\t\n}\nint main()\n{\n\tint n,k,i,a[100];\n\tint vote_A=0,vote_E=0;\n//\tfreopen(\"data.txt\",\"r\",stdin);\n//\tfreopen(\"result.txt\",\"w\",stdout);\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tvote_E += a[i];\n\t}\n//\tprintf(\"vote_E = %d\\n\",vote_E);\n\tk = findMax(a,n);\n\twhile(1)\t\n\t{\n\t\tvote_A = 0; \n\t\tfor(i=0;i<n;i++)\n\t\t\tvote_A += k-a[i];\n//\t\tprintf(\"k= %d vote_A = %d\\n\",k,vote_A)\t\t;\n\t\tif(vote_A>vote_E)\n\t\t{\n\t\t\tprintf(\"%d\",k);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tk++;\t\t\t\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h> \nint max(int a,int b){if(a>b) return a; else return b;}\nint main (){\nint i,n,sum = 0;\nint ans,mx = -1;\nscanf(\"%i\",&n);\nfor (i=0;i<n;i++){\n\tint f;\n\tscanf(\"%i\",&f);\n\tsum += f;\n\tmx = max (mx,f);\n\t}\nans = mx;\nif( n*ans - sum <= sum ){\n\tans += (2*sum - n*ans + n - 1) / n;\n}\nif (n*ans == 2*sum)\n\tans++;\nprintf (\"%i\",ans);\nreturn 0-0-0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k, m = 0, a = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n int v;\n scanf(\"%d\", &v);\n a+= v;\n if (m < v) m = v;\n }\n k = m;\n while (k*n - 2*a <= 0) k++;\n printf(\"%d\", k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i, t, k, c, b;\n scanf(\"%d \", &n);\n int a[n];\n for(i=0;i<n;i++)\n scanf(\"%d\", &a[i]);\n t=0;\n for(i=0;i<n;i++)\n {\n t+=a[i];\n \n \n }\n if(n>1)\n {\n for(i=1;i<n;i++)\n {\n if(a[0]<=a[i])\n {\n a[0]=a[i];\n \n }\n \n }\n }\n c=a[0];\n for(i=c;i<c+1000;i++)\n {\n b=i*n-t;\n if(b>t)\n {\n k=i;\n break;\n }\n }\n printf(\"%d \", k);\n return 0;\n \n \n \n}"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } k=(2*sum/n)+1;\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\" %d\", &n);\n\tint arr[n], sum=0, max=0;\n\tfor (int i=0;i<n;i++) {\n\t\tscanf(\" %d\", &arr[i]);\n\t\tsum+=arr[i];\n\t\tif (arr[i]>max) max=arr[i];\n\t}\n\tint sumb=0;\n\tfor (max;sumb<sum;max++) {\n\t\tsumb=0;\n\t\tfor (int i=0;i<n;i++) {\n\t\t\tsumb+=max-arr[i];\n\t\t}\t\n\t\tif (sumb>sum) break;\n\t}\n\tprintf(\"%d\\n\", max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,sum=0,sum2=0,temp,i;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint max=a[0];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tsum=sum+a[i];\n\t}\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]>max)\n\t\t{\n\t\t\tmax=a[i];\n\t\t}\n\t}\n\ttemp=max;\n\tsum2=0;\t\n\twhile(sum2<=sum)\n\t{ \n\t sum2=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t sum2=sum2+temp-a[i];\n\t\t}\n\t if(sum2>sum)\n\t {\n\t break;\n\t }\n\t else\n\t {\n\t temp=temp+1;\n\t }\n\t}\n\t\n\tprintf(\"%d\",temp);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, k, a, m = 0;\n\tscanf(\"%d\", &n);\n\tk = n;\n\n\tint arr[n];\n\tint sum = 0;\n\tint sum1 = 0;\n\n\tfor(int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tarr[i] = a;\n\t\tsum += a;\n\t\tif(a > m)m = a;\n\t}\n\n\tfor(int i = 0; i < n; i++) {\n\t\tsum1 += (m - arr[i]);\n\t}\n\n\twhile(sum1 <= sum) {\n\t\tm++;\n\t\tsum1+=n;\n\t}\n\n\n\tprintf(\"%d\\n\", m);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,sum=0,t,max=0,min;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&t);\n if(t>max) max=t;\n sum =sum+t;\n\n\n }\n //printf(\"%d\\n\",sum);\n min=(ceil)(((2*sum)+1)*1.0/(n));\n //printf(\"%d\\n\",sum);\n if(min<max)\n {\n printf(\"%d\",max);\n }\n else\n {\n printf(\"%d\",min);\n }\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,sum=0,k,a[100],max=-9,sum1=0,z;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n }\n \n z:\n sum1=0; \n for(i=0;i<n;i++)\n {\n sum1=sum1+max-a[i];\n }\n \n if(sum1>sum)\n {\n printf(\"%d\",max);\n }\n else\n {\n max++;\n goto z;\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum1=0,sum2=0,a[100],max,j,b[100];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n max = a[0];\n for(i=1;i<n;i++)\n {\n if(max<a[i])max = a[i];\n }\n while(1){\n sum2=0;\n for(i=0;i<n;i++)\n {\n b[i] = max - a[i];\n sum2+=b[i];\n }\n if(sum2>sum1)break;\n else max++;\n }\n printf(\"%d\\n\",max);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k, m = 0, a = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n int v;\n scanf(\"%d\", &v);\n a+= v;\n if (m < v) m = v;\n }\n k = m;\n while (k*n - 2*a <= 0) k++;\n printf(\"%d\", k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&ara[i]);\n elo_total=elo_total+ara[i];\n }\n //printf(\"elo tot:%d\\n\",elo_total);\n for(i=1;i<=n;i++)\n {\n if(ara[i]>max)\n {\n max=ara[i];\n }\n }\n //printf(\"max:%d\\n\",max);\n for(i=1,j=max;i<=n;i++)\n {\n sum=j-ara[i];\n k=k+sum;\n if(i==n)\n {\n if(k>elo_total)\n {\n printf(\"%d\",j);\n break;\n }\n else\n {\n i=0;\n j++;\n k=0;\n sum=0;\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n],i,max,k,sum=0;\n\tfor(i=0;i<n;i++)\n\t{\n\tscanf(\"%d\",&a[i]);\n\tsum+=a[i];\n\t}\n\tk=(2*sum/n)+1;\n\tmax=a[0];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]>max)\n\t\tmax=a[i];\n\t}\n\tif(max>=k)\n\tprintf(\"%d\",max);\n\telse\n\tprintf(\"%d\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,max=0,total=0,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n\n for(i=0;i<n;i++)\n {\n total=total+a[i];\n }\n\n for(j=max;;)\n {\n k=n*j-total;\n if(k>total)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,a[100],max=0,sum=0,k;\n\tscanf(\"%d\",&n);\n\tif(n==1){\n\t\tscanf(\"%d\",&a[0]);\n\t\tprintf(\"%d\",2*a[0]+1);\n\t}\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t\tif(max<a[i])max=a[i];\n\t\t\tsum+=a[i];\n\t\t}\n\t\tk=(2*sum+1)%n==0?(2*sum+1)/n:(2*sum+1)/n+1;\n\t\tprintf(\"%d\",k<max?max:k);\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,k,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n if(i==0)\n {\n k=a[0];\n }\n else\n {\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n }\n while(n*k - s <= s)\n {\n k++;\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n newsum+=(max-a[i]);\n }\n if(newsum>sum)\n {\n printf(\"%d\\n\",max);\n return 0;\n }\n else\n {\n x=(((sum+1)-newsum)/n);\n y=x*n;\n if(y==(sum-newsum+1))\n {\n printf(\"%d\\n\",max+x);\n return 0;\n }\n else if(y!=(sum-newsum+1)){\n printf(\"%d\\n\",max+x+1);return 0;}\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned int n,i,k,max_num=0,opn_vote=0;\n scanf(\"%d\",&n);\n int b[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<n;i++){\n if(max_num<b[i]){\n max_num=b[i];\n }\n }\n\n for(i=0;i<n;i++){\n opn_vote=opn_vote+b[i];\n }\n double result=opn_vote;\n k=((2*result)/n);\n if(k<max_num){\n printf(\"%d\",max_num);\n }\n else{\n printf(\"%d\",(k+1));\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } k=(2*sum/n)+1;\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i,j,s=0,p=0,d=0,m=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n }\n }\n for(i=m;;i++)\n {\n p=0;\n for(j=0;j<n;j++)\n {\n p+=(i-a[j]) ;\n }\n if(p>s)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid swap(int *a,int *b){\n\tint temp=*a;\n\t*a=*b;\n\t*b=temp;\n}\n\nvoid Sort(int *arr,int m){\n\tfor (int i=0;i<m;i++){\n\t\tfor (int j=0;j<m-1-i;j++){\n\t\t\tif (arr[j]<arr[j+1]){\n\t\t\t\tswap(&arr[j],&arr[j+1]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint people;\n\tint forEle[1005];\n\t\n\tscanf (\"%d\",&people);\n\t\n\tint sumele=0;\n\tfor (int i=0;i<people;i++){\n\t\tscanf (\"%d\",&forEle[i]);\n\t\tsumele+=forEle[i];\n\t}\t\n\t\n\tSort(forEle,people);\n\t\n\tint k=forEle[0];\n\tfor (int i=k;i<=300;i++){\n\t\tint sumAW=0;\n\t\tfor (int j=0;j<people;j++){\n\t\t\tsumAW+=(i-forEle[j]);\n\t\t}\n\t\tif (sumAW>sumele){\n\t\t\tprintf (\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, i, x[110], y, z;\n\n scanf(\"%d\", &n);\n y = 0, z = 0;\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &x[i]);\n z = z+x[i];\n if(y<x[i])\n y = x[i];\n }\n\n h:\n if(((y*n)-z)>z)\n printf(\"%d\", y);\n else\n {\n y = y+1;\n goto h;\n }\n}"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int n, ara1[101], ara2[101], max, sum1 = 0, sum2, i;\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &ara1[i]);\n\n sum1 = sum1 + ara1[i];\n }\n max = ara1[0];\n for(i = 1; i < n; i++)\n {\n if(ara1[i] > max)\n max = ara1[i];\n }\n\n efthe:\n for(i = 0, sum2 = 0; i < n; i++)\n {\n ara2[i] = max - ara1[i];\n sum2 = sum2 + ara2[i];\n }\n if(sum2 <= sum1)\n {\n max++;\n goto efthe;\n }\n else\n printf(\"%d\\n\", max);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,i;\n\tint sum = 0;\n\tint ans = 0;\n\tint max = 0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tsum+=a[i];\n\t\tif(max <= a[i])\n\t\t\tmax = a[i];\n\t}\n\tsum = sum*2;\n\n\tans = sum/n;\n\t//if(sum%n == 0)\n\t//\tans = ans;\n\t//else\n\t\tans+=1;\n\tif(ans<=max)\n\t\tans = max;\n\tprintf(\"%d\\n\",ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned int n,i,k,max_num=0,opn_vote=0;\n scanf(\"%d\",&n);\n int b[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<n;i++){\n if(max_num<b[i]){\n max_num=b[i];\n }\n }\n\n for(i=0;i<n;i++){\n opn_vote=opn_vote+b[i];\n }\n double result=opn_vote;\n k=((2*result)/n);\n if(k<max_num){\n printf(\"%d\",max_num);\n }\n else{\n printf(\"%d\",(k+1));\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<=s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, x=0, s=0, c=0, i, k;\n\t\n\tscanf(\"%d\", &n);\n\tint a[n+1];\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\t\n\t\tif(a[i]>=x)\n\t\t{\n\t\t\tx=a[i];\n\t\t}\n\t\ts=s+a[i];\n\t}\n\tfor(k=0; k<n; k++)\n\t{\n\t\tc=c+x-a[k];\n\t}\n\tif(c>s)\n\t{\n\t\tprintf(\"%d\", x);\n\t}\n\telse if(c==s)\n\t{\n\t\tprintf(\"%d\", x+1);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\", x+1+((s-c)/n));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,a,max=0,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a);\n\t\tif(max<a)max=a;\n\t\tsum+=a;\n\t}\n\tprintf(\"%d\",(2*sum)/n+1<max?max:(2*sum)/n+1);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, i, x[110], y, z;\n\n scanf(\"%d\", &n);\n y = 0, z = 0;\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &x[i]);\n z = z+x[i];\n if(y<x[i])\n y = x[i];\n }\n\n h:\n if(((y*n)-z)>z)\n printf(\"%d\", y);\n else\n {\n y = y+1;\n goto h;\n }\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int k=0,sum=0;\n for(i=0;i<n;i++)\n {\n if(k<a[i])\n {\n k=a[i];\n }\n sum=sum+a[i];\n \n }\n while(k<=100000)\n {\n if(n*k-sum>sum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint max = arr[0];\n\tint total = 0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif(arr[i] > max)\n\t\t{\n\t\t\tmax = arr[i];\n\t\t}\n\t\ttotal += arr[i];\n\t}\n\tint total_other = 0 ;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\ttotal_other+= max - arr[i];\n\t}\n\n\t//printf(\"%d %d\\n\",total,total_other);\n\tif (total_other > total)\n\t{\n\t\tprintf(\"%d\",max);\n\t}\n\telse\n\t{\n\t\tif ((total - total_other) % n == 0)\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n +1 + max);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + 1 + max);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h> //AA06( 09/ 04/ 20) If u see my code, Have a Good Day!\n\nint main()\n{\n int n, a[150], i, sum = 0, max, ans;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n sum = sum + a[i];\n }\n\n max = a[0];\n\n for(i = 0; i < n; i++) {\n if(a[i] > max) {\n max = a[i];\n }\n }\n\n for(i = 0; ; i++) {\n if(((max * n) - sum) > sum) {\n ans = max;\n break;\n }\n else{\n max++;\n }\n\n\n }\n\n printf(\"%d\\n\", ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int x ; \n int total=0;\n int max=0 ;\n for(int i = 0 ; i < n ; i++){\n scanf(\"%d\",&x);\n if(x>max)\n max = x;\n total+=x;\n }\n for(int i = max ; i <= 201 ; i ++)\n {\n if(i*n - total > total){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,max=0,total=0,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n\n for(i=0;i<n;i++)\n {\n total=total+a[i];\n }\n\n for(j=max;;)\n {\n k=n*j-total;\n if(k>total)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint max= a[0];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts=s+a[i];\n\t\tif(a[i]>max) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts1=s1+max-a[i];\n\t}\n\tint s2;\n\twhile(s1<=s)\n\t{\n\t\tb++;\n\t\ts2=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ts2=s2+b-a[i];\n\t\t}\n\t\ts1=s2;\n\t}\n\t//if(b>5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n, i, sum=0, k, res, max=0;\n scanf(\"%d\", &n);\n int a[n];\n for(i=1; i<=n; i++){\n scanf(\"%d\", &a[i]);\n sum+=a[i];\n if(max < a[i]) max=a[i];\n }\n k=(2*sum)/n+1;\n\n if(max > k) res=max;\n else res=k;\n\n printf(\"%d\", res);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } k=(2*sum/n)+1;\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint max = arr[0];\n\tint total = 0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif(arr[i] > max)\n\t\t{\n\t\t\tmax = arr[i];\n\t\t}\n\t\ttotal += arr[i];\n\t}\n\tint total_other = 0 ;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\ttotal_other+= max - arr[i];\n\t}\n\n\t//printf(\"%d %d\\n\",total,total_other);\n\tif (total_other > total)\n\t{\n\t\tprintf(\"%d\",max);\n\t}\n\telse\n\t{\n\t\tif ((total - total_other) % n == 0)\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + 1 + max);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + 1 + max);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<math.h>\nint main()\n{\n int n,*a,i,max=0,sum=0,x,ans,res=0,sum1=0;\n scanf(\"%d\",&n);\n a=(int *)malloc(sizeof(int)*n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n \n sum1+=a[i];\n \n if(a[i]>max)\n {\n max=a[i];\n }\n }\n \n sum=sum1;\n sum=sum*2;\n \n x=sum/n;\n \n if(sum%n!=0)\n {\n x+=1;\n }\n \n if(x>=max)\n {\n ans=x;\n }\n \n else\n {\n ans=max;\n }\n \n for(i=0;i<n;i++)\n {\n a[i]=ans-a[i];\n res+=a[i];\n }\n \n \n if(res==sum1)\n {\n ans+=1;\n }\n printf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&b[i]);\n d=d+b[i];\n if(b[i]>f)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;j<a;j++)\n cnt+=i-b[j];\n if(cnt>d){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint test;\n\tint tcase[100];\n\tint k = 0;\n\tint total = 0;\n\tint totalA = 0;\n\t\n\tscanf(\"%d\" , &test);\n\tgetchar();\n\tfor(int i = 0; i < test ; i++){\n\t\tscanf(\"%d\", &tcase[i] );\n\t\ttotal = total + tcase[i];\n\t\t\n\t\tif(tcase[i] > k) k = tcase[i];\n\t}\n\t\n\tint check = 1;\n\t\n\tdo{\n\t\ttotalA = 0;\n\t\tfor(int i = 0 ; i< test ; i++){\n\t\t\ttotalA += (k-tcase[i]); \n\t\t}\n\t\tif(totalA <= total){\n\t\t\tk++;\n\t\t}\n\t\telse check = 2;\n\t}while(check == 1);\n\t\n\tprintf(\"%d\" , k);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n],max=0,sum=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n if(max>=a[i])\n {\n continue;\n }\n else\n {\n max=a[i];\n }\n }\n for(i=max;;i++)\n {\n int sum1=0;\n for(j=0;j<n;j++)\n {\n sum1=sum1+i-a[j];\n }\n if(sum1>sum)\n {\n printf(\"%d\",i);\n break;\n }\n else\n {\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=1000000;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n],max=0,sum=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n if(max>=a[i])\n {\n continue;\n }\n else\n {\n max=a[i];\n }\n }\n for(i=max;;i++)\n {\n int sum1=0;\n for(j=0;j<n;j++)\n {\n sum1=sum1+i-a[j];\n }\n if(sum1>sum)\n {\n printf(\"%d\",i);\n break;\n }\n else\n {\n continue;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<=s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&b[i]);\n d=d+b[i];\n if(b[i]>f)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;j<a;j++)\n cnt+=i-b[j];\n if(cnt>d){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h> //AA06( 09/ 04/ 20) If u see my code, Have a Good Day!\n\nint main()\n{\n int n, a[150], i, sum = 0, max, ans;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n sum = sum + a[i];\n }\n\n max = a[0];\n\n for(i = 0; i < n; i++) {\n if(a[i] > max) {\n max = a[i];\n }\n }\n\n for(i = 0; ; i++) {\n if(((max * n) - sum) > sum) {\n ans = max;\n break;\n }\n else{\n max++;\n }\n\n\n }\n\n printf(\"%d\\n\", ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,sum=0,k,a[100],max=-9,sum1=0,z;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n }\n \n z:\n sum1=0; \n for(i=0;i<n;i++)\n {\n sum1=sum1+max-a[i];\n }\n \n if(sum1>sum)\n {\n printf(\"%d\",max);\n }\n else\n {\n max++;\n goto z;\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid swap(int *a,int *b){\n\tint temp=*a;\n\t*a=*b;\n\t*b=temp;\n}\n\nvoid Sort(int *arr,int m){\n\tfor (int i=0;i<m;i++){\n\t\tfor (int j=0;j<m-1-i;j++){\n\t\t\tif (arr[j]<arr[j+1]){\n\t\t\t\tswap(&arr[j],&arr[j+1]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint people;\n\tint forEle[1005];\n\t\n\tscanf (\"%d\",&people);\n\t\n\tint sumele=0;\n\tfor (int i=0;i<people;i++){\n\t\tscanf (\"%d\",&forEle[i]);\n\t\tsumele+=forEle[i];\n\t}\t\n\t\n\tSort(forEle,people);\n\t\n\tint k=forEle[0];\n\tfor (int i=k;i<=300;i++){\n\t\tint sumAW=0;\n\t\tfor (int j=0;j<people;j++){\n\t\t\tsumAW+=(i-forEle[j]);\n\t\t}\n\t\tif (sumAW>sumele){\n\t\t\tprintf (\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, s, m, i, x;\n\n scanf(\"%d\", &n);\n\n m=0;\n s=0;\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &x);\n if(m<x)m=x;\n s+=x;\n }\n\n while(m*n-s<=s)m++;\n\n printf(\"%d\\n\", m);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, s, m, i, x;\n\n scanf(\"%d\", &n);\n\n m=0;\n s=0;\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &x);\n if(m<x)m=x;\n s+=x;\n }\n\n while(m*n-s<=s)m++;\n\n printf(\"%d\\n\", m);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\nlong long int minx(long long int x,long long int y){\n if(x>y){\n return y;\n }else{\n return x;\n }\n}\nlong long int maxx(long long int x,long long int y){\n if(x<y){\n return y;\n }else{\n return x;\n }\n}\nint main(){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,k,sum2,min,f,r,o,sum1,sum=0,y,b,count1, a1[1000000]={0};\nchar a[100000];\nscanf(\"%lld\",&n);\nmax=0;\nfor(i=1;i<=n;i++){\n scanf(\"%lld\",&x);\n sum+=x;\n if(x>=max){\n max=x;\n }\n}\nfor(i=max;;i++){\n m=i*n;\n r=m-sum;\n if(r>sum){\n printf(\"%lld\",i);\n return 0;\n }\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n int n,mx=0,i,tmp,sum=0,k;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&tmp);\n if(tmp>mx)mx=tmp;\n sum+=tmp;\n }\n sum*=2;\n if((sum%n)==0)k=sum/n;\n else k=(sum/n)+1;\n if((n*k)==sum)k++;\n if(k<mx)printf(\"%d\",mx);\n else printf(\"%d\",k);\n return 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h> //AA06( 09/ 04/ 20) If u see my code, Have a Good Day!\n\nint main()\n{\n int n, a[150], i, sum = 0, max, ans;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n sum = sum + a[i];\n }\n\n max = a[0];\n\n for(i = 0; i < n; i++) {\n if(a[i] > max) {\n max = a[i];\n }\n }\n\n for(i = 0; ; i++) {\n if(((max * n) - sum) > sum) {\n ans = max;\n break;\n }\n else{\n max++;\n }\n\n\n }\n\n printf(\"%d\\n\", ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,n,i,sum=0,max=0,p,k;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a);\n if(max<a)\n max=a;\n sum=sum+a;\n }\n p=max*n;\n k=p-sum;\n int l;\n if(k>sum)\n printf(\"%d\",max);\n else\n {\n for(i=max+1;;i++)\n {\n \n p=n*i;\n \n l=(p-sum);\n \n if(l>sum)\n \n break;\n }\n printf(\"%d\",i);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,j,s=0,s1=0,n,max;\nscanf(\"%d\",&n);\nint ara[n];\nfor(i=0;i<n;i++)\n{\n\tscanf(\"%d\",&ara[i]);\n\ts=s+ara[i];\n}\nmax=ara[0];\nfor(i=1;i<n;i++)\n{\n\tif(max<ara[i])\n\tmax=ara[i];\n}\nwhile(1)\n{\n\tfor(i=0;i<n;i++)\n\ts1=s1+max-ara[i];\n\tif(s1>s)\n\t{\n\t\tprintf(\"%d\",max);\n\t\tbreak;\n\t}\n\telse\n\tmax++;\n\ts1=0;\n}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint studnum,elro[100],sum,max;\n\nint main ()\n{\n\t//freopen (\"cf.in\",\"r\",stdin),freopen(\"cf.out\",\"w\",stdout);\n\tscanf (\"%d\",&studnum);\n\tfor (int i=0;i<studnum;i++)\n\t{\n\t\tscanf (\"%d\",&elro[i]);\n\t\tsum += elro[i];\n\t\tif (max < elro[i]) max = elro[i];\n\t}\n\tfor (int i=1;1;i++)\n\t{\n\t\tif (i*studnum-sum>sum)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",i < max ? max : i);\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n, i, sum=0, k, res, max=0;\n scanf(\"%d\", &n);\n int a[n];\n for(i=1; i<=n; i++){\n scanf(\"%d\", &a[i]);\n sum+=a[i];\n if(max < a[i]) max=a[i];\n }\n k=(2*sum)/n+1;\n\n if(max > k) res=max;\n else res=k;\n\n printf(\"%d\", res);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,temp=-10;\n int sum=0,vote=0;\n int i,j,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n if(a[i]>temp){\n temp=a[i];\n }\n }\n vote=2*sum;\n vote=(vote/n)+1;\n if(temp>vote){\n printf(\"%d\",temp);\n }\n else{\n printf(\"%d\",vote);\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,max=0,sum=0,i,D,n1;\n scanf(\"%d\",&n);\n n1=n;\n while(n--)\n {\n scanf(\"%d\",&a);\n if(a>=max) max=a;\n sum=sum+a;\n }\n //printf(\"%d %d\\n\",sum,max);\n for(i=max;;i++)\n {\n D=(n1*i)-sum;\n if(D>sum) break;\n else continue;\n }\n printf(\"%d\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,s,max;\n scanf(\"%d\",&n);\n int array[n];\n for(int i=0;i<n;i++)\n { \n \tscanf(\"%d\",&array[i]);\n \ts+=array[i];\n\t}\n\tmax=array[0];\n for(int i=1;i<n;i++)\n\t{\n\t\t\n\t\tif(max<array[i])\n\t\t{\n\t\t\tmax=array[i];\n\t\t}\n\t}\n\tif(max<2*s/n+1)\n\t{\n \tprintf(\"%d\",2*s/n+1);\n }\n else printf(\"%d\",max);\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,a[100],sum=0,i,grt=0,sum1;\n scanf(\"%d\",&n);\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(grt<a[i])\n {\n grt=a[i];\n }\n sum+=a[i];\n }\n b:\n sum1=0;\n for(i=0;i<n;i++)\n {\n sum1=sum1+(grt-a[i]);\n }\n if(sum1<=sum)\n {\n grt++;\n\n goto b;\n }\n else\n {\n printf(\"%d\",grt);\n }\n\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } k=(2*sum/n)+1;\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int x ; \n int total=0;\n int max=0 ;\n for(int i = 0 ; i < n ; i++){\n scanf(\"%d\",&x);\n if(x>max)\n max = x;\n total+=x;\n }\n for(int i = max ; i <= 201 ; i ++)\n {\n if(i*n - total > total){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int x ; \n int total=0;\n int max=0 ;\n for(int i = 0 ; i < n ; i++){\n scanf(\"%d\",&x);\n if(x>max)\n max = x;\n total+=x;\n }\n for(int i = max ; i <= 201 ; i ++)\n {\n if(i*n - total > total){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n],h=0,s=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(h<a[i])\n h=a[i];\n s+=a[i];\n }\n int avg=s/n;\n int ans=(avg+1)*n;\n ans=(s+ans)/n;\n while(ans*n<=2*s)\n ans++;\n if(ans<h)\n ans=h;\n printf(\"%d\\n\",ans);\n}\n"}, {"source_code": "#include<stdio.h> //AA06( 09/ 04/ 20) If u see my code, Have a Good Day!\n\nint main()\n{\n int n, a[150], i, sum = 0, max, ans;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n sum = sum + a[i];\n }\n\n max = a[0];\n\n for(i = 0; i < n; i++) {\n if(a[i] > max) {\n max = a[i];\n }\n }\n\n for(i = 0; ; i++) {\n if(((max * n) - sum) > sum) {\n ans = max;\n break;\n }\n else{\n max++;\n }\n\n\n }\n\n printf(\"%d\\n\", ans);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\nint main()\n{\n//\tfreopen(\"test.txt\", \"r\", stdin);\n int n;\n scanf(\"%d\", &n);\n int d[n], maxv = 0, enemy = 0;\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &d[i]);\n maxv = max(maxv, d[i]);\n enemy += d[i];\n }\n int sum = 0;\n for(int i = 0; i < n; i++)\n sum += maxv - d[i];\n int i = maxv;\n while(i <= 20000)\n {\n if(sum > enemy)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n sum += n;\n i++;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b[101],d=0,i,f=0,j;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&b[i]);\n d=d+b[i];\n if(b[i]>f)\n f=b[i];\n }\n for(i=f;;i++)\n {\n int cnt = 0;\n for(j=0;j<a;j++)\n cnt+=i-b[j];\n if(cnt>d){\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,j=0,n;\n scanf(\"%d\",&n);\n int max1,max=0,base,need=0,sum=0,array[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&array[i]);\n sum+=array[i];\n if(max<array[i])\n max=array[i];\n }\n if((sum*2+1)%n!=0)\n base=(2*sum+1)/n+1;\n else\n base=(2*sum+1)/n;\n max1=max>base?max:base;\n while(need<=sum)\n {\n max1+=j;\n for(i=0,need=0;i<n;i++)\n {\n need+=(max1-array[i]);\n }\n j++;\n }\n if(j>1)\n max1-=1;\n printf(\"%d\\n\",max1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i;\n int students[100];\n int Awruk=0,Elodreip=0;\n\n //input\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&students[i]);\n }\n //biggest vote\n int biggest_vote=students[0];\n for(i=0;i<n;i++){\n if(students[i]>biggest_vote){\n biggest_vote=students[i];\n }\n }\n\n\n //main objective;\n for(k=biggest_vote;k<202;k++){\n for(i=0;i<n;i++){\n Elodreip=Elodreip+students[i];\n Awruk=Awruk+(k-students[i]);\n }\n if(Awruk>Elodreip)break;\n Awruk=0,Elodreip=0;\n }\n printf(\"%d\\n\",k);\n //\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n newsum+=(max-a[i]);\n }\n if(newsum>sum)\n {\n printf(\"%d\\n\",max);\n return 0;\n }\n else\n {\n x=(((sum+1)-newsum)/n);\n y=x*n;\n if(y==(sum-newsum+1))\n {\n printf(\"%d\\n\",max+x);\n return 0;\n }\n else if(y!=(sum-newsum+1)){\n printf(\"%d\\n\",max+x+1);return 0;}\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n int n, ara1[101], ara2[101], max, sum1 = 0, sum2, i;\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &ara1[i]);\n\n sum1 = sum1 + ara1[i];\n }\n max = ara1[0];\n for(i = 1; i < n; i++)\n {\n if(ara1[i] > max)\n max = ara1[i];\n }\n\n efthe:\n for(i = 0, sum2 = 0; i < n; i++)\n {\n ara2[i] = max - ara1[i];\n sum2 = sum2 + ara2[i];\n }\n if(sum2 <= sum1)\n {\n max++;\n goto efthe;\n }\n else\n printf(\"%d\\n\", max);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum1=0,sum2=0,a[100],max,j,b[100];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n max = a[0];\n for(i=1;i<n;i++)\n {\n if(max<a[i])max = a[i];\n }\n while(1){\n sum2=0;\n for(i=0;i<n;i++)\n {\n b[i] = max - a[i];\n sum2+=b[i];\n }\n if(sum2>sum1)break;\n else max++;\n }\n printf(\"%d\\n\",max);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&ara[i]);\n elo_total=elo_total+ara[i];\n }\n //printf(\"elo tot:%d\\n\",elo_total);\n for(i=1;i<=n;i++)\n {\n if(ara[i]>max)\n {\n max=ara[i];\n }\n }\n //printf(\"max:%d\\n\",max);\n for(i=1,j=max;i<=n;i++)\n {\n sum=j-ara[i];\n k=k+sum;\n if(i==n)\n {\n if(k>elo_total)\n {\n printf(\"%d\",j);\n break;\n }\n else\n {\n i=0;\n j++;\n k=0;\n sum=0;\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,temp=0;\n scanf(\"%lld\",&n);\n long long int a[n],t=0,k=0,j,p[n];\n for(i=0;i<n;i++)\n {scanf(\"%lld\",&a[i]);\n p[i]=0;\n p[i]=a[i];\n t=t+a[i];\n}\nfor(i=0;i<n-1;i++)\n{\n temp=p[i]>p[i+1]?p[i]:p[i+1];\n p[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;j<n;j++)\n {k=k+(temp-a[j]);\n }\n if(k>t)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {\n temp=temp+1;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,k,sum1,sum2;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tscanf(\"%d\",&a[0]);\n\tk=a[0];\n\tsum1=a[0];\n\tfor(i=1;i<n;i++){\n\tscanf(\"%d\",&a[i]);\n\tsum1=sum1+a[i];\n\tif(k<a[i])\n\tk=a[i];}\n\tsum2=(k*n)-sum1;\n\tif(sum2<=sum1){\n\t\tk=(sum1-sum2)/n+k+1;\n\t}\n\tprintf(\"%d\",k);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val,temp;\n for(i=0;i<n;i++) {\n scanf(\"%f\",&a[i]);\n sum += a[i];\n if(a[i]>max) max=a[i];\n }\n val=sum*2/n;\n temp=ceil(val);\n if(val==temp){\n val=temp+1;\n }\n else val=temp;\n if(val>max) printf(\"%d\",(int)val);\n else printf(\"%d\",(int)max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,p,n,a[101],i,sum=0,j=0;\nscanf(\"%d\",&n);\nfor(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n k=a[1];\n for(i=1;i<=n;i++)\n {\n if (a[i]>k)\n k=a[i];\n }\n for(i=1;i<=n;i++)\n {\n sum=sum+a[i];\n }\n for(k;j<=sum;k++)\n {\n\n j=k*n-sum;\n }\n k=k-1;\n printf(\"%d\",k);\n return 0;\n\n\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } if(2*sum%n==0) {k=2*sum/n;}\n else {k=(2*sum/n)+1;}\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint a[n],flag=0,count,b[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\tflag=flag+a[i];\n\t}\n\tint max=a[0];\n\tfor(int i=1;i<n;i++)\n\t{\n\t\tif(max<a[i])\n\t\tmax=a[i];\n\t}\n\tfor(int i=max;i<=100;i++)\n\t{\n\t\tcount=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tb[j]=i-a[j];\n\t\t\tcount=count+b[j];\n\t\t}\n\t\t\n\t\tif(count>flag)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,max=0,total=0,k;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n printf(\"%d\\n\",max);\n for(i=0;i<n;i++)\n {\n total=total+a[i];\n }\n printf(\"%d\\n\",total);\n for(j=max;;)\n {\n k=n*j-total;\n if(k>total)\n {\n printf(\"%d\\n\",j);\n break;\n }\n j++;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int a[n];\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n }\n int max = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] > max) {\n max = a[i];\n }\n }\n for (int k = max; k < max*2+1; k++) {\n int q1 = 0, q2 = 0;\n for (int i = 0; i < n; i++) {\n q1 += a[i];\n q2 += k - a[i];\n }\n if (q2 > q1) {\n printf(\"%d\\n\", k);\n return 0;\n }\n }\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, k, a, m = 0;\n\tscanf(\"%d\", &n);\n\tk = n;\n\n\tint arr[n];\n\tint sum = 0;\n\tint sum1 = 0;\n\n\tfor(int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tarr[i] = a;\n\t\tsum += a;\n\t\tif(a > m)m = a;\n\t}\n\n\tfor(int i = 0; i < n; i++) {\n\t\tsum1 += (m - arr[i]);\n\t}\n\n\twhile(sum1 < sum) {\n\t\tm++;\n\t\tsum1+=n;\n\t}\n\n\n\tprintf(\"%d\\n\", m);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nvoid swap(int *a,int *b){\n\tint temp=*a;\n\t*a=*b;\n\t*b=temp;\n}\n\nvoid Sort(int *arr,int m){\n\tfor (int i=0;i<m;i++){\n\t\tfor (int j=0;j<m-1-i;j++){\n\t\t\tif (arr[j]<arr[j+1]){\n\t\t\t\tswap(&arr[j],&arr[j+1]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nint main()\n{\n\tint people;\n\tint forEle[1005];\n\t\n\tscanf (\"%d\",&people);\n\t\n\tint sumele=0;\n\tfor (int i=0;i<people;i++){\n\t\tscanf (\"%d\",&forEle[i]);\n\t\tsumele+=forEle[i];\n\t}\t\n\t\n\tSort(forEle,people);\n\t\n\tint k=forEle[0];\n\tfor (int i=k;i<=100;i++){\n\t\tint sumAW=0;\n\t\tfor (int j=0;j<people;j++){\n\t\t\tsumAW+=(i-forEle[j]);\n\t\t}\n\t\tif (sumAW>sumele){\n\t\t\tprintf (\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,temp=0;\n scanf(\"%lld\",&n);\n long long int a[n],t=0,k=0,j;\n for(i=0;i<n;i++)\n {scanf(\"%lld\",&a[i]);\n t=t+a[i];\n}\nfor(i=0;i<n-1;i++)\n{\n temp=a[i]>a[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;j<n;j++)\n {\n k=k+(temp-a[j]);\n }\n if(k>t)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\n int n,v,max,sum=0,wv=0,sum2=0,count=0;\n\n scanf(\"%d\",&n);\n int a[n];\n\n\n\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n\n\n }\n if(n==1){\n\n\n printf(\"%d\\n\",(n*2)+1);\n\n\n\n\n }\n else if(n>1){\n\n\n\n\n\n max=a[0];\n for(int i=0;i<n;i++){\n if(max<a[i]){\n max=a[i];\n }\n }\n count=max;\n\n while(1){\n\n for(int i=0;i<n;i++){\n wv=max-a[i];\n sum2=sum2+wv;\n\n\n\n }\n if(sum2>sum){\n printf(\"%d\\n\",max);\n break;\n }\n else{\n\n max=max+1;\n sum2=0,wv=0;\n count--;\n }\n\n }\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,k=0,score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>k)\n {\n k=a[i];\n }\n score=score+a[i];\n }\n int high=k*n;\n for(int i=0;i<100;i++)\n {\n if(score<(high/2))\n {\n exit(0);\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n int b=sum1/2;\n for(i=0;i<n;i++){\n sum2+=(b-a[i]);\n if(b<a[i])\n c++;\n }\n\n if(sum2>sum1&&c==0)\n printf(\"%d\\n\",b);\n else\n printf(\"%d\\n\",b+1);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int i, k, j, largest, m, sum1=0, sum2;\n int a[100];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum1 = sum1+a[i];\n }\n\n if (n==1)\n {\n largest = a[0];\n }\n\n else if (n==2)\n {\n if (a[0]>a[1])\n {\n largest = a[0];\n }\n\n else\n {\n largest = a[1];\n }\n }\n\n else\n {\n for (j=0; j<i; j++) //finding the largest num\n {\n if (a[j]>=a[j+1])\n {\n largest = a[j];\n }\n\n else\n {\n continue;\n }\n }\n }\n\n for (m=0; m<=101; m++)\n {\n k = largest+m;\n sum2 = (n*k) - sum1;\n if (sum2 > sum1)\n {\n break;\n }\n }\n\n printf(\"%d\\n\", k);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=100;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, x=0, s=0, c=0, i, k;\n\t\n\tscanf(\"%d\", &n);\n\tint a[n+1];\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\t\n\t\tif(a[i]>=x)\n\t\t{\n\t\t\tx=a[i];\n\t\t}\n\t\ts=s+a[i];\n\t}\n\tfor(k=0; k<n; k++)\n\t{\n\t\tc=c+x-a[k];\n\t}\n\tif(c>=s)\n\t{\n\t\tprintf(\"%d\", x);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\", x+1+((s-c)/n));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int i, k, j, largest, m, sum1=0, sum2;\n int a[100];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum1 = sum1+a[i];\n }\n\n if (n==1)\n {\n largest = a[0];\n }\n\n else if (n==2)\n {\n if (a[0]>a[1])\n {\n largest = a[0];\n }\n\n else\n {\n largest = a[1];\n }\n }\n\n else\n {\n for (j=0; j<i; j++) //finding the largest num\n {\n if (a[j]>=a[j+1])\n {\n largest = a[j];\n }\n\n else\n {\n continue;\n }\n }\n }\n\n for (m=0; m<=101; m++)\n {\n k = largest+m;\n sum2 = (n*k) - sum1;\n if (sum2 > sum1)\n {\n break;\n }\n }\n\n printf(\"%d\\n\", k);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i=0,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n }\n int k=1,l=0;\n //printf(\"%d %d\\n\",el ,aw);\n if(aw>el)\n {\n while(i++)\n {\n if(aw-n<el || aw-n==el)\n {\n \n int ans=n-l;\n printf(\"%d\\n\",ans);\n break;\n }\n /*if(aw-n<el)\n {\n \n int ans=n-l;\n printf(\"%d\\n\",ans);\n break;\n }*/\n else\n \n {\n aw=aw-n;\n l++;\n }\n }\n }\n \n \n else\n {\n \n while(k++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n+k);\n break;\n }\n //else\n // k++;\n }\n \n } \n return 0;\n \n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint max= a[0];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts=s+a[i];\n\t\tif(a[i]>max) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts1=s1+max-a[i];\n\t}\n\tint s2=s1;\n\twhile(s2<s)\n\t{\n\t\t//\tb++;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ts2=s2+b-a[i];\n\t\t}\n\t\tb++;\n\t}\n//\tif(b>5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,j=0,n;\n scanf(\"%d\",&n);\n int max1,max=0,base,need=0,sum=0,array[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&array[i]);\n sum+=array[i];\n if(max<array[i])\n max=array[i];\n }\n if(sum%n!=0)\n base=sum/n+1;\n else\n base=sum/n;\n max1=max>base?max:base;\n while(need<=sum)\n {\n max1+=j;\n for(i=0,need=0;i<n;i++)\n {\n need+=(max1-array[i]);\n }\n j++;\n }\n if(j>1)\n max1-=1;\n printf(\"%d\\n\",max1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m,k,j,max,total=0,awk=0;\n scanf(\"%d\", &m);\n int vote[m];\n for(j=0;j<m;j++)\n {\n scanf(\"%d\", &vote[j]);\n if(!j)\n max=vote[j];\n else\n {\n if(max<vote[j])\n max=vote[j];\n }\n total+=vote[j];\n }\n\n k=max;\n for(j=0;j<m;j++)\n {\n awk+=k-vote[j];\n }\n if(awk>total)\n printf(\"%d\", k);\n else\n {\n int ch;\n ch=(total-k)/m;\n printf(\"%d\", k+ch+1);\n }\n\n return 0;\n}\n"}, {"source_code": "// In the name of \u02dc\u201d*\u00b0\u2022.\u02dc\u201d*\u00b0\u2022 God \u2022\u00b0*\u201d\u02dc.\u2022\u00b0*\u201d\u02dc\n\n/* \n\n JadedBeast ~~Morocco~~\n \n*/\n#include <stdio.h>\n\nint main(void){\n int n,sum=0,a,k=1;\n scanf(\"%d\",&n);\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a);\n sum+=a;\n }\n while(n*k-sum<(n*n)/2){\n k++;\n }\n printf(\"%d\",k);\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n],h=0,s=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(h<a[i])\n h=a[i];\n s+=a[i];\n }\n int avg=s/n;\n int ans=(avg+1)*n;\n ans=(s+ans)/n;\n //printf(\"%d %d %d\\n\",ans,h,s);\n if(ans<h)\n ans=h;\n printf(\"%d\\n\",ans);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main(){\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint max= a[0];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts=s+a[i];\n\t\tif(a[i]>max) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts1=s1+max-a[i];\n\t}\n\tint s2=s1;\n\twhile(s2<s)\n\t{\n\t\t//\tb++;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ts2=s2+b-a[i];\n\t\t}\n\t\tb++;\n\t}\n//\tif(b>5)b=b+1;\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i,j,s=0,p=0,d=0,m=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n }\n }\n for(i=0;;i++)\n {\n for(j=0;j<n;j++)\n {\n p+=i-a[j] ;\n }\n if(p>s)\n {\n d=i;\n break;\n }\n }\n printf(\"%d\\n\",d);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[102],n,i,j,k=0,l=0,t=0;\n scanf(\"%d\\n\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d \",&a[i]);\n k=k+a[i];\n if(a[i]>t)t=a[i];\n }\n if(k/n==100)return 0;\n for(j=t;j<101;j++){\n if(n*j>2*k){\n printf(\"%d\\n\",j);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n int b=sum1/2;\n for(i=0;i<n;i++){\n sum2+=(b-a[i]);\n if(b<a[i])\n c++;\n }\n\n if(sum2>sum1&&c==0)\n printf(\"%d\\n\",b);\n else\n printf(\"%d\\n\",b+1);\n}\n"}, {"source_code": "#include<stdio.h>\n\n\n\nint main(){\n\t\n\tint students;\n\tscanf(\"%d\", &students);\n\tint arr[students];\n\tint arr1[students];\n\tint max = -1;\n\tint count = 0;\n\tfor(int i = 0 ; i < students ; i ++){\n\t\tscanf(\"%d\", &arr[i]);\n\t\tcount += arr[i];\n\t\tif(arr[i] > max)max = arr[i];\n\t}\n\tint cek = 1;\n\tint temp;\n\twhile(cek){\n\t\ttemp = 0;\n\t\tfor(int i = 0 ; i < students ; i ++){\n\t\t\tarr1[i] = max - arr[i];\n\t\t\ttemp += arr1[i];\n\t\t}\n\t\tif(temp < count){\n\t\t\tmax++;\n\t\t}\n\t\telse{\n\t\t\tcek = 0;\n\t\t}\n\t}\n\tprintf(\"%d\", max);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n }\n int k=1;\n //printf(\"%d %d\",el ,aw);\n if(aw>el)\n printf(\"%d\\n\",n);\n \n else\n {\n while(k++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n+k);\n break;\n }\n //else\n // k++;\n }\n \n }\n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n newsum+=(max-a[i]);\n }\n if(newsum>sum)\n {\n printf(\"%d\\n\",max);\n return 0;\n }\n else\n {\n x=(((sum+1)-newsum)/n);\n y=x*n;\n if(y==(sum-newsum+1))\n {\n printf(\"%d\\n\",max+x);\n return 0;\n }\n else if(y!=n){\n printf(\"%d\\n\",max+x+1);return 0;}\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint max(int a, int b)\n{\n return a>b ? a : b;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n\n int *a, i, j, count=0, temp;\n\n a = (int *)malloc(sizeof(int) * n);\n\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n count += a[i];\n }\n\n temp = a[0];\n\n for (i=1; i<n; i++)\n {\n temp = max(temp, a[i]);\n }\n\n int k;\n\n int ans;\n\n for (i=0; i<=100; i++)\n {\n k = temp+i;\n if (((n*k)-count)>count)\n {\n ans = k;\n break;\n }\n }\n\n printf(\"%d\", ans);\n\n free(a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n max=a[0];\n for(i=0;i<n;i++)\n {\n if(max<a[i])\n {\n max=a[i];\n }\n }\n k=max;\n for(i=0;i<100;i++)\n {\n s1=0;\n for(j=0;j<n;j++)\n {\n s1=s1+(k-a[j]);\n }\n if(s1>s)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\n int n,v,max,sum=0,wv=0,sum2=0,count=0;\n\n scanf(\"%d\",&n);\n int a[n];\n\n\n\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n sum=sum+a[i];\n\n\n }\n if(n==1){\n\n\n printf(\"%d\\n\",(n*2)+1);\n\n\n\n\n }\n else if(n>1){\n\n\n\n\n\n max=a[0];\n for(int i=0;i<n;i++){\n if(max<a[i]){\n max=a[i];\n }\n }\n count=max;\n\n while(1){\n\n for(int i=0;i<n;i++){\n wv=max-a[i];\n sum2=sum2+wv;\n\n\n\n }\n if(sum2>sum){\n printf(\"%d\\n\",max);\n break;\n }\n else{\n\n max=max+1;\n sum2=0,wv=0;\n count--;\n }\n\n }\n\n\n\n }\n\n\n\n\n\n\n\n\n\n\nreturn 0;}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char const *argv[])\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint max = arr[0];\n\tint total = 0;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\tif(arr[i] > max)\n\t\t{\n\t\t\tmax = arr[i];\n\t\t}\n\t\ttotal += arr[i];\n\t}\n\tint total_other = 0 ;\n\tfor (int i = 0; i < n; ++i)\n\t{\n\t\ttotal_other+= max - arr[i];\n\t}\n\n\t//printf(\"%d %d\\n\",total,total_other);\n\tif (total_other > total)\n\t{\n\t\tprintf(\"%d\",max);\n\t}\n\telse\n\t{\n\t\tif ((total - total_other) % n == 0)\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + max);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\", (total - total_other)/n + 1 + max);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,a[100],max=0,sum=0,k;\n\tscanf(\"%d\",&n);\n\tif(n==1){\n\t scanf(\"%d\",a[0]);\n\t printf(\"%d\",2*a[0]+1);\n\t}\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t\tif(max<a[i])max=a[i];\n\t\t\tsum+=a[i];\n\t\t}\n\t\tk=(2*sum+1)/n;\n\t\tprintf(\"%d\",k+1<max?max:k+1);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint test;\n\tint tcase[100];\n\tint k = 0;\n\tint total = 0;\n\tint totalA = 0;\n\t\n\tscanf(\"%d\" , &test);\n\tgetchar();\n\tfor(int i = 0; i < test ; i++){\n\t\tscanf(\"%d\", &tcase[i] );\n\t\ttotal = total + tcase[i];\n\t\t\n\t\tif(tcase[i] > k) k = tcase[i];\n\t}\n\t\n\tint check = 1;\n\t\n\tdo{\n\t\tfor(int i = 0 ; i< test ; i++){\n\t\t\ttotalA += (k-tcase[i]); \n\t\t}\n\t\t\n\t\tif(totalA <= total){\n\t\t\tk++;\n\t\t}\n\t\telse check = 2;\n\t}while(check == 1);\n\t\n\tprintf(\"%d\" , k);\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,sum=0,t,max=0,min;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&t);\n if(t>max) max=t;\n sum =sum+t;\n\n\n }\n min=ceil((2*sum+1)/(n));\n if(min<max)\n {\n printf(\"%d\",max);\n }\n else\n {\n printf(\"%d\",min);\n }\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i=0,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n if(a[i]==n){\n printf(\"%d\",n);\n return 0;\n }\n }\n int k=1,l=0;\n //printf(\"%d %d\\n\",el ,aw);\n if(aw>el)\n {\n while(i++)\n {\n if(aw-n<el || aw-n==el)\n {\n \n int ans=n-l;\n printf(\"%d\\n\",ans);\n break;\n }\n /*if(aw-n<el)\n {\n \n int ans=n-l;\n printf(\"%d\\n\",ans);\n break;\n }*/\n else\n \n {\n aw=aw-n;\n l++;\n }\n }\n }\n \n \n else\n {\n \n while(k++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n+k);\n break;\n }\n //else\n // k++;\n }\n \n } \n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n if(n<=3)\n {\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n if(n==1)\n printf(\"%d\",a[0]*2+1);\n else\n printf(\"%d\\n\",sum1/2+2);\n }\n else {\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n int b=sum1/2;\n for(i=0;i<n;i++){\n sum2+=(b-a[i]);\n if(b<a[i])\n c++;\n }\n\n if(sum2>sum1&&c==0)\n printf(\"%d\\n\",b);\n\n\n else\n printf(\"%d\\n\",b+1);\n\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,k=0,score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>k)\n {\n k=a[i];\n }\n score=score+a[i];\n }\n int high=k*n;\n for(int i=0;i<100;i++)\n {\n if(score<(high/2))\n {\n exit(0);\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n }\n int k=1;\n //printf(\"%d %d\\n\",el ,aw);\n if(aw>el)\n {\n if(aw-el<aw)\n printf(\"%d\",n);\n else\n {\n for(i=n;i>=1;i--)\n {\n if(n*i-el<=el)\n {\n printf(\"%d\\n\",i+1);\n break;\n }\n }\n }\n }\n \n \n else\n {\n \n while(k++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n+k);\n break;\n }\n //else\n // k++;\n }\n \n } \n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;i<n;i++) {\n scanf(\"%f\",&a[i]);\n sum += a[i];\n if(a[i]>max) max=a[i];\n }\n val=sum*2/n;\n val=ceil(val);\n if(val>max) printf(\"%d\",(int)val);\n else printf(\"%d\",(int)max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint a[n],flag=0,count,b[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t\tflag=flag+a[i];\n\t}\n\tint max=a[0];\n\tfor(int i=1;i<n;i++)\n\t{\n\t\tif(max<a[i])\n\t\tmax=a[i];\n\t}\n\tfor(int i=max;i<=100;i++)\n\t{\n\t\tcount=0;\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\tb[j]=i-a[j];\n\t\t\tcount=count+b[j];\n\t\t}\n\t\t\n\t\tif(count>flag)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[100000]={0};\nscanf(\"%lld\",&n);\nfor(i=0;i<n;i++){\n scanf(\"%lld\",&y);\n a[y]++;\n}\nmax=0;\nfor(i=0;i<102;i++){\n if(a[i]>max){\n max=i;\n }\n}\nprintf(\"%lld\",((max*2))+1);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&ara[i]);\n elo_total=elo_total+ara[i];\n }\n printf(\"elo tot:%d\\n\",elo_total);\n for(i=1;i<=n;i++)\n {\n if(ara[i]>max)\n {\n max=ara[i];\n }\n }\n printf(\"max:%d\\n\",max);\n for(i=1,j=max;i<=n;i++)\n {\n sum=j-ara[i];\n k=k+sum;\n if(i==n)\n {\n if(k>elo_total)\n {\n printf(\"%d\",j);\n break;\n }\n else\n {\n i=0;\n j++;\n k=0;\n sum=0;\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int a[n];\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n }\n int max = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] > max) {\n max = a[i];\n }\n }\n for (int k = max; k < max*2+1; k++) {\n int q1 = 0, q2 = 0;\n for (int i = 0; i < n; i++) {\n q1 += a[i];\n q2 += k - a[i];\n }\n if (q2 > q1) {\n printf(\"%d\\n\", k);\n return 0;\n }\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int x ; \n int total=0;\n int max=0 ;\n for(int i = 0 ; i < n ; i++){\n scanf(\"%d\",&x);\n if(x>max)\n max = x;\n total+=x;\n }\n for(int i = 0 ; i < max ; i ++)\n {\n if(i*n - total> total){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=100;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,temp=0;\n scanf(\"%d\",&n);\n int a[n],t=0,k=0,j;\n for(i=0;i<n;i++)\n {scanf(\"%d\",&a[i]);\n t=t+a[i];\n}\nfor(i=0;i<n-1;i++)\n{\n temp=a[i]>a[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i;;i++)\n{\n for(j=0;j<n;j++)\n {\n k=k+(temp-a[j]);\n }\n if(k>t)\n {\n printf(\"%d\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int i, k, j, largest, m, sum1=0, sum2;\n int a[100];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum1 = sum1+a[i];\n }\n //printf(\"%d\\n\", sum1);\n\n for (j=0; j<i; j++) //finding the largest num\n {\n if (a[j]>=a[j+1])\n {\n largest = a[j];\n }\n\n else\n {\n continue;\n }\n }\n //printf(\"%d\\n\", largest);\n\n for (m=0; m<=101; m++)\n {\n k = largest+m;\n sum2 = (n*k) - sum1;\n if (sum2 > sum1)\n {\n break;\n }\n }\n\n printf(\"%d\\n\", k);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,sum1=0,sum2=0,max=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n if(a[i]>max)\n max=a[i];\n }\n for(i=max;;i++)\n {\n for(j=0;j<n;j++)\n sum2+=i-a[j];\n if(sum2>sum1)\n {\n printf(\"%d\\n\",i);break;\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count=0,count1=0,count2=0,ara[100000];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara[i]);\n count1=count1+ara[i];\n }\n for(i=0;i<n;i++)\n {\n if(count<ara[i])\n {\n count=ara[i];\n }\n }\n for(i=count;i<count+100;i++)\n {\n count2=0;\n for(j=0;j<n;j++)\n {\n count2=count2+i-ara[j];\n }\n if(count2>=count1)\n {\n break;\n }\n }\n printf(\"%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n unsigned long int n,sum,max,i,num,k;\n scanf(\"%lu\",&n);\n scanf(\"%lu\",&sum);\n max=sum;\n for(i=0;i<n-1;i++) {\n scanf(\"%lu\",&num);\n sum=sum+num;\n if(max<num) max=num;\n } if(2*sum%n==0) {k=2*sum/n;}\n else {k=(2*sum/n)+1;}\n if(max>k) printf(\"%lu\",max);\n else printf(\"%lu\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n if(n<=3)\n {\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n if(n==1)\n printf(\"%d\",a[0]*2+1);\n else\n printf(\"%d\\n\",sum1/2+2);\n }\n else {\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n int b=sum1/2;\n for(i=0;i<n;i++){\n sum2+=(b-a[i]);\n if(b<a[i])\n c++;\n }\n\n if(sum2>sum1&&c==0)\n printf(\"%d\\n\",b);\n\n\n else\n printf(\"%d\\n\",b+1);\n\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,max=-2,n,ara[1011],sum=0,k=0,elo_total=0,m;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&ara[i]);\n elo_total=elo_total+ara[i];\n }\n printf(\"elo tot:%d\\n\",elo_total);\n for(i=1;i<=n;i++)\n {\n if(ara[i]>max)\n {\n max=ara[i];\n }\n }\n printf(\"max:%d\\n\",max);\n for(i=1,j=max;i<=n;i++)\n {\n sum=j-ara[i];\n k=k+sum;\n if(i==n)\n {\n if(k>elo_total)\n {\n printf(\"%d\",j);\n break;\n }\n else\n {\n i=0;\n j++;\n k=0;\n sum=0;\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<=(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main() {\n int n;\n scanf(\"%d\", &n);\n int a[n];\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n }\n int max = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] > max) {\n max = a[i];\n }\n }\n for (int k = max; k < max*2+1; k++) {\n int q1 = 0, q2 = 0;\n for (int i = 0; i < n; i++) {\n q1 += a[i];\n q2 += k - a[i];\n }\n if (q2 > q1) {\n printf(\"%d\\n\", k);\n return 0;\n }\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,n,i,sum=0,max=0,p,k;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a);\n if(max<a)\n max=a;\n sum=sum+a;\n }\n p=max*n;\n k=p-sum;\n if(k>sum)\n printf(\"%d\",max);\n else\n {\n for(i=max+1;;i++)\n {\n p=n*i;\n \n k=k+p-sum;\n if(k>p)\n \n break;\n }\n printf(\"%d\",i);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;i<n;i++) {\n scanf(\"%f\",&a[i]);\n sum += a[i];\n if(a[i]>max) max=a[i];\n }\n val=sum*2/n;\n val=ceil(val);\n if(val>max) printf(\"%d\",(int)val);\n else printf(\"%d\",(int)max);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int k=0,sum=0;\n for(i=0;i<n;i++)\n {\n if(k<a[i])\n {\n k=a[i];\n }\n sum=sum+a[i];\n \n }\n while(k<=100)\n {\n if(n*k-sum>sum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n max=a[0];\n for(i=0;i<n;i++)\n {\n if(max<a[i])\n {\n max=a[i];\n }\n }\n k=max;\n for(i=0;i<100;i++)\n {\n s1=0;\n for(j=0;j<n;j++)\n {\n s1=s1+(k-a[j]);\n }\n if(s1>s)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,temp=0;\n scanf(\"%lld\",&n);\n long long int a[n],t=0,k=0,j;\n for(i=0;i<n;i++)\n {scanf(\"%lld\",&a[i]);\n t=t+a[i];\n}\nfor(i=0;i<n-1;i++)\n{\n temp=a[i]>a[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;j<n;j++)\n {\n k=k+(temp-a[j]);\n }\n if(k>t)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main(){\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[100];\n int i;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int k=0,sum=0;\n for(i=0;i<n;i++)\n {\n if(k<a[i])\n {\n k=a[i];\n }\n sum=sum+a[i];\n \n }\n while(k<=100)\n {\n if(n*k-sum>sum)\n {\n printf(\"%d\",k);\n break;\n }\n else\n k++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\n int n,i;\n scanf(\"%d\",&n);\n float a[100],sum=0,max=0,val;\n for(i=0;i<n;i++) {\n scanf(\"%f\",&a[i]);\n sum += a[i];\n if(a[i]>max) max=a[i];\n }\n val=sum*2/n;\n val=ceil(val);\n if(val>max) printf(\"%d\",(int)val);\n else printf(\"%d\",(int)max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,sum1=0,sum2=0,max=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n if(a[i]>max)\n max=a[i];\n }\n for(i=max;;i++)\n {\n for(j=0;j<n;j++)\n sum2+=i-a[j];\n if(sum2>sum1)\n {\n printf(\"%d\\n\",i);break;\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,temp=0;\n scanf(\"%lld\",&n);\n long long int a[n],t=0,k=0,j;\n for(i=0;i<n;i++)\n {scanf(\"%lld\",&a[i]);\n t=t+a[i];\n}\nfor(i=0;i<n-1;i++)\n{\n temp=a[i]>a[i+1]?a[i]:a[i+1];\n a[i+1]=temp;\n}\nfor(i=0;;i++)\n{\n for(j=0;j<n;j++)\n {\n k=k+(temp-a[j]);\n }\n if(k>t)\n {\n printf(\"%lld\",temp);\n break;\n }\n else\n {temp++;\n k=0;\n }\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i,j,s=0,p=0,d=0,m=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n }\n }\n for(i=m;;i++)\n {\n for(j=0;j<n;j++)\n {\n p+=(i-a[j]) ;\n }\n if(p>s)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m,k,j,max,total=0,awk=0;\n scanf(\"%d\", &m);\n int vote[m];\n for(j=0;j<m;j++)\n {\n scanf(\"%d\", &vote[j]);\n if(!j)\n max=vote[j];\n else\n {\n if(max<vote[j])\n max=vote[j];\n }\n total+=vote[j];\n }\n\n k=max;\n for(j=0;j<m;j++)\n {\n awk+=k-vote[j];\n }\n if(awk>total)\n printf(\"%d\", k);\n else\n {\n int ch;\n ch=(total-k)/m;\n printf(\"%d\", k+ch+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n max=a[0];\n for(i=0;i<n;i++)\n {\n if(max<a[i])\n {\n max=a[i];\n }\n }\n k=max;\n for(i=0;i<n;i++)\n {\n s1=0;\n for(j=0;j<n;j++)\n {\n s1=s1+(k-a[j]);\n }\n if(s1>s)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "// In the name of \u02dc\u201d*\u00b0\u2022.\u02dc\u201d*\u00b0\u2022 God \u2022\u00b0*\u201d\u02dc.\u2022\u00b0*\u201d\u02dc\n\n/* \n\n JadedBeast ~~Morocco~~\n \n*/\n#include <stdio.h>\n\nint main(void){\n int n,sum=0,a,k=1;\n scanf(\"%d\",&n);\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a);\n sum+=a;\n }\n while(n*k-sum<(n*n)/2){\n k++;\n }\n printf(\"%d\",k);\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n }\n int k=1;\n //printf(\"%d %d\",el ,aw);\n if(aw>el)\n printf(\"%d\\n\",n);\n \n else\n {\n while(n++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n k++;\n }\n \n }\n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<=(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, i, j, c=0;\n\n scanf(\"%d\", &n);\n int a;\n\n for(i=0 ; i<n ; i++)\n {\n scanf(\"%d\", &a);\n c+=a;\n }\n for(i=1 ; ; i++)\n {\n j=i*i;\n if((j-c)>c) break;\n }\n printf(\"%d\", i);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,i,a[100],max=0,sum=0,k;\n\tscanf(\"%d\",&n);\n\tif(n==1){\n\t scanf(\"%d\",a[0]);\n\t printf(\"%d\",2*a[0]+1);\n\t}\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t\tif(max<a[i])max=a[i];\n\t\t\tsum+=a[i];\n\t\t}\n\t\tk=(2*sum+1)/n;\n\t\tprintf(\"%d\",k+1<max?max:k+1);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n ; \n scanf(\"%d\",&n);\n int x ; \n int total=0;\n int max=0 ;\n for(int i = 0 ; i < n ; i++){\n scanf(\"%d\",&x);\n if(x>max)\n max = x;\n total+=x;\n }\n for(int i = 0 ; i < max ; i ++)\n {\n if(i*n > total){\n printf(\"%d\",i);\n return 0;\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,n[10000],m,i,j,sum=0,sum1=0,k=0;\n scanf(\"%d\",&a);\n for(i=0; i<a; i++)\n {\n scanf(\"%d\",&n[i]);\n sum=sum+n[i];\n if(k<n[i])\n {\n k=n[i];\n }\n }\n if(a==1)\n {\n printf(\"%d\",2*n[0]+1);\n }\n for(j=0; j<101; j++)\n {\n sum1=0;\n for(i=0; i<a; i++)\n {\n sum1=sum1+(k+j-n[i]);\n\n }\n\n if(sum1>sum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum3=0;\n scanf(\"%d\",&n);\n int a[n],max=0,min=101,sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>max)\n max=a[i];\n if(a[i]<min)\n min=a[i];\n sum1+=a[i];\n }\n for(i=0;i<n;i++)\n sum2+=(max-a[i]);\n for(i=0;i<n;i++)\n sum3+=(max+min-a[i]);\n if(sum2>sum1)\n printf(\"%d\\n\",max);\n else if(sum3>sum1)\n printf(\"%d\\n\",max+min);\n else\n printf(\"%d\\n\",max+min+1);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,s=0,k=0,m=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n s+=a[i];\n if(k<a[i]){\n k=a[i];\n }\n }\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n while(m<s){\n m=0;\n k++;\n for(int i=0;i<n;i++){\n m+=k-a[i];\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=100;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int n, k, m = 0, a = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n int v;\n scanf(\"%d\", &v);\n a+= v;\n if (m < v) m = v;\n }\n k = m;\n while (k*n - 2*a < 0) k++;\n printf(\"%d\", k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h> \nint max(int a,int b){if(a>b) return a; else return b;}\nint main (){\nint i,n,sum = 0;\nint ans,mx = -1;\nscanf(\"%i\",&n);\nfor (i=0;i<n;i++){\n\tint f;\n\tscanf(\"%i\",&f);\n\tsum += f;\n\tmx = max (mx,f);\n\t}\nans = mx;\nif( n*ans - sum <= sum ){\n\tans += (2*sum - n*ans + n - 1) / n;\n}\nprintf (\"%i\",ans);\nreturn 0-0-0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,i,b,n[100],sum1=0,sum=0;\n scanf(\"%d\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%d\",&n[i]);\n sum1=sum1+n[i];\n }\n for(i=0;i<t;i++)\n {\n if(n[i]>=n[i+1])\n {\n continue;\n }\n else\n {\n b=n[i];\n n[i]=n[i+1];\n n[i+1]=b;\n }\n }\n label:\n for(i=0;i<t;i++)\n {\n sum=sum+n[0]-n[i];\n }\n if(sum>sum1)\n {\n printf(\"%d\",n[0]);\n }\n else\n {\n n[0]=n[0]+1;\n goto label;\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint a[101],b[101];\nint main()\n{\n int n,i,j,el=0,aw=0;\n scanf(\"%d\",&n);\n for(i=1,j=1;i<=n,j<=n;i++,j++)\n \n {\n scanf(\"%d\",&a[i]);\n el=el+a[i];\n b[j]=n-a[i];\n aw=aw+b[j];\n }\n int k=1;\n //printf(\"%d %d\",el ,aw);\n if(aw>el)\n printf(\"%d\\n\",n);\n \n else\n {\n while(n++)\n {\n \n if(aw+n*k>el)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n k++;\n }\n \n }\n return 0;\n \n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a[n];\n int i,j,s=0,p=0,d=0,m=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n }\n }\n for(i=0;;i++)\n {\n for(j=0;j<n;j++)\n {\n p+=i-a[j] ;\n }\n if(p>s)\n {\n d=i;\n break;\n }\n }\n printf(\"%d\\n\",d);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n if(n==1)\n {\n int f;\n scanf(\"%d\",&f);\n printf(\"%d\\n\",f*2+1);\n }\n else {\n int a[n],sum1=0,sum2=0;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum1+=a[i];\n }\n int b=sum1/2;\n for(i=0;i<n;i++){\n sum2+=(b-a[i]);\n if(b<a[i])\n c++;\n }\n\n if(sum2>sum1&&c==0)\n printf(\"%d\\n\",b);\n\n else\n printf(\"%d\\n\",b+1);\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a[100],s1=0,j,s=0,k,max;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n s=s+a[i];\n }\n max=a[0];\n for(i=0;i<n;i++)\n {\n if(max<a[i])\n {\n max=a[i];\n }\n }\n k=max;\n for(i=0;i<n;i++)\n {\n s1=0;\n for(j=0;j<n;j++)\n {\n s1=s1+(k-a[j]);\n }\n if(s1>s)\n {\n printf(\"%d\\n\",k);\n break;\n }\n else\n {\n k++;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,a[10000],sum=0,max=0,j,newsum=0,x,y;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n sum+=a[i];\n if(a[i]>max)\n {\n max=a[i];\n }\n }\n for(i=0;i<n;i++)\n {\n newsum+=(max-a[i]);\n }\n if(newsum>sum)\n {\n printf(\"%d\\n\",max);\n return 0;\n }\n else\n {\n x=(((sum+1)-newsum)/n);\n y=x*n;//printf(\"%d %d %d %d %d\\n\",x,newsum,sum,max,y);\n if(y==(sum-newsum+1))\n {\n printf(\"%d\\n\",max+x);\n return 0;\n }\n else if(y!=n){\n printf(\"%d\\n\",max+x+1);return 0;}\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,i,b,n[100],sum1=0,sum=0;\n scanf(\"%d\",&t);\n for(i=0;i<t;i++)\n {\n scanf(\"%d\",&n[i]);\n sum1=sum1+n[i];\n }\n for(i=0;i<t;i++)\n {\n if(n[i]>=n[i+1])\n {\n continue;\n }\n else\n {\n b=n[i];\n n[i]=n[i+1];\n n[i+1]=b;\n }\n }\n label:\n for(i=0;i<t;i++)\n {\n sum=sum+n[0]-n[i];\n }\n if(sum>sum1)\n {\n printf(\"%d\",n[0]);\n }\n else\n {\n n[0]=n[0]+1;\n goto label;\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, s=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint max= a[0];\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts=s+a[i];\n\t\tif(a[i]>max) max=a[i];\n\t}\n//\tprintf(\"%d %d\",s,max);\n\tint s1=0,b=max;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\ts1=s1+max-a[i];\n\t}\n//\tprintf(\"s1= %d\",s1);\n\twhile(s1<s)\n\t{\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ts1=s1+b-a[i];\n\t\t}\n\t\tb++;\n\t}\n\tprintf(\"%d\",b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high;\n for(i=k;i<=100;i++)\n {\n high=k*n;\n if(score<=((high-1)/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int a,b,n[10000],m,i,j,sum=0,sum1=0,k=0;\n scanf(\"%d\",&a);\n for(i=0; i<a; i++)\n {\n scanf(\"%d\",&n[i]);\n sum=sum+n[i];\n if(k<n[i])\n {\n k=n[i];\n }\n }\n if(a==1)\n {\n printf(\"%d\",2*n[0]+1);\n }\n for(j=0; j<101; j++)\n {\n sum1=0;\n for(i=0; i<a; i++)\n {\n sum1=sum1+(k+j-n[i]);\n\n }\n\n if(sum1>sum)\n {\n printf(\"%d\",k+j);\n break;\n }\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int i, k, j, largest, m, sum1=0, sum2;\n int a[100];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum1 = sum1+a[i];\n }\n\n /*for (i=0; i<n; i++) //sum of the array\n {\n sum1 = sum1+a[i];\n } */\n //printf(\"%d\\n\", sum1);\n\n for (j=0; j<i; j++) //finding the largest num\n {\n if (a[j]>a[j+1])\n {\n largest = a[j];\n }\n\n else\n {\n continue;\n }\n }\n //printf(\"%d\\n\", largest);\n\n for (m=0; m<=100; m++)\n {\n k = largest+m;\n sum2 = (n*k) - sum1;\n if (sum2 > sum1)\n {\n break;\n }\n }\n\n printf(\"%d\\n\", k);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i, n, k=0, score=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n score=score+a[i];\n if(a[i]>k)\n {\n k=a[i];\n }\n }\n int high=k*n;\n for(i=k;i<=100;i++)\n {\n if(score<(high/2))\n {\n break;\n }\n else\n {\n ++k;\n }\n }\n printf(\"%d\",k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int i, k, j, largest, m, sum1=0, sum2;\n int a[100];\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n sum1 = sum1+a[i];\n }\n\n /*for (i=0; i<n; i++) //sum of the array\n {\n sum1 = sum1+a[i];\n } */\n //printf(\"%d\\n\", sum1);\n\n for (j=0; j<i; j++) //finding the largest num\n {\n if (a[j]>a[j+1])\n {\n largest = a[j];\n }\n\n else\n {\n continue;\n }\n }\n //printf(\"%d\\n\", largest);\n\n for (m=0; m<=100; m++)\n {\n k = largest+m;\n sum2 = (n*k) - sum1;\n if (sum2 > sum1)\n {\n break;\n }\n }\n\n printf(\"%d\\n\", k);\n\n return 0;\n}\n"}], "src_uid": "d215b3541d6d728ad01b166aae64faa2"} {"nl": {"description": "The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon. The organizers of the camp gave the gym leaders a PokeBlock, a sequence of n ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gym leaders that to evolve a Pokemon of type k (k\u2009\u2265\u20092), they need to make a valid set of k cuts on the PokeBlock to get smaller blocks.Suppose the given PokeBlock sequence is b0b1b2... bn\u2009-\u20091. You have a choice of making cuts at n\u2009+\u20091 places, i.e., Before b0, between b0 and b1, between b1 and b2, ..., between bn\u2009-\u20092 and bn\u2009-\u20091, and after bn\u2009-\u20091.The n\u2009+\u20091 choices of making cuts are as follows (where a | denotes a possible cut):| b0 | b1 | b2 | ... | bn\u2009-\u20092 | bn\u2009-\u20091 |Consider a sequence of k cuts. Now each pair of consecutive cuts will contain a binary string between them, formed from the ingredient types. The ingredients before the first cut and after the last cut are wasted, which is to say they are not considered. So there will be exactly k\u2009-\u20091 such binary substrings. Every substring can be read as a binary number. Let m be the maximum number out of the obtained numbers. If all the obtained numbers are positive and the set of the obtained numbers contains all integers from 1 to m, then this set of cuts is said to be a valid set of cuts.For example, suppose the given PokeBlock sequence is 101101001110 and we made 5 cuts in the following way:10 | 11 | 010 | 01 | 1 | 10So the 4 binary substrings obtained are: 11, 010, 01 and 1, which correspond to the numbers 3, 2, 1 and 1 respectively. Here m\u2009=\u20093, as it is the maximum value among the obtained numbers. And all the obtained numbers are positive and we have obtained all integers from 1 to m. Hence this set of cuts is a valid set of 5 cuts.A Pokemon of type k will evolve only if the PokeBlock is cut using a valid set of k cuts. There can be many valid sets of the same size. Two valid sets of k cuts are considered different if there is a cut in one set which is not there in the other set.Let f(k) denote the number of valid sets of k cuts. Find the value of . Since the value of s can be very large, output s modulo 109\u2009+\u20097.", "input_spec": "The input consists of two lines. The first line consists an integer n (1\u2009\u2264\u2009n\u2009\u2264\u200975)\u00a0\u2014 the length of the PokeBlock. The next line contains the PokeBlock, a binary string of length n.", "output_spec": "Output a single integer, containing the answer to the problem, i.e., the value of s modulo 109\u2009+\u20097.", "sample_inputs": ["4\n1011", "2\n10"], "sample_outputs": ["10", "1"], "notes": "NoteIn the first sample, the sets of valid cuts are:Size 2: |1|011, 1|01|1, 10|1|1, 101|1|.Size 3: |1|01|1, |10|1|1, 10|1|1|, 1|01|1|.Size 4: |10|1|1|, |1|01|1|.Hence, f(2)\u2009=\u20094, f(3)\u2009=\u20094 and f(4)\u2009=\u20092. So, the value of s\u2009=\u200910.In the second sample, the set of valid cuts is:Size 2: |1|0.Hence, f(2)\u2009=\u20091 and f(3)\u2009=\u20090. So, the value of s\u2009=\u20091."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define N\t75\n#define M\t20\t/* sum_{i=1}^M bitcount(i) <= N */\n#define MD\t1000000007\n\nint main() {\n\tstatic char cc[N + 1];\n\tstatic int dp[N + 1][1 << M];\n\tint n, h, i, i_, j, b, b_, a, ans, x;\n\n\tscanf(\"%d%s\", &n, cc);\n\tfor (i = 0; i <= n; i++)\n\t\tdp[i][0] = 1;\n\tans = 0;\n\tfor (i = 0, j = 0; i <= n; i++) {\n\t\tfor (h = 1; h < M; h++)\n\t\t\tans = (ans + dp[i][(1 << h) - 1]) % MD;\n\t\tif (j < i)\n\t\t\tj = i;\n\t\twhile (j < n && cc[j] != '1')\n\t\t\tj++;\n\t\tif (j == n)\n\t\t\tcontinue;\n\t\tfor (b = 0; b < 1 << M; b++) {\n\t\t\tx = dp[i][b];\n\t\t\tif (x == 0)\n\t\t\t\tcontinue;\n\t\t\ta = 0;\n\t\t\tfor (h = 0; j + h < n && (a = a << 1 | cc[j + h] - '0') <= M; h++) {\n\t\t\t\ti_ = j + h + 1;\n\t\t\t\tb_ = b | 1 << a - 1;\n\t\t\t\tdp[i_][b_] = (dp[i_][b_] + x) % MD;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define m 1000000007u\ntypedef unsigned u;\nu D[76][1u<<20],S[1u<<20];\nchar C[76];\nu V[76][76];\nint main()\n{\n\tu n,i,j,k,N=1u<<20,b,r=0;\n\tscanf(\"%u\",&n);\n\tscanf(\"%s\",C);\n\tfor(i=-1;++i<n;)for(j=i-1,k=0;++j<n;)\n\t{\n\t\tk=k<<1|(C[j]=='1');\n\t\tV[i][j]=k;\n\t}\n\tfor(i=-1;++i<=n;)D[i][0]=1;\n\tfor(i=-1;++i<n;)\n\t{\n\t\tfor(j=i-1;++j<n;)\n\t\t{\n\t\t\tif(!V[i][j])continue;\n\t\t\tif(V[i][j]>20)break;\n\t\t\tb=1u<<(V[i][j]-1);\n\t\t\tfor(k=-1;++k<N;)\n\t\t\tif((D[j+1][k|b]+=D[i][k])>=m)D[j+1][k|b]-=m;\n\t\t}\n\t}\n\tfor(i=-1;++i<=n;)\n\t{\n\t\tfor(j=1;j<N;j=j<<1|1)\n\t\tif((r+=D[i][j])>=m)r-=m;\n\t}\n\tprintf(\"%u\\n\",r);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "61f88159762cbc7c51c36e7b56ecde48"} {"nl": {"description": "Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gmail.com). It is known that a proper email address contains only such symbols as . @ and lower-case Latin letters, doesn't start with and doesn't end with a dot. Also, a proper email address doesn't start with and doesn't end with an at sign. Moreover, an email address contains exactly one such symbol as @, yet may contain any number (possible, zero) of dots. You have to carry out a series of replacements so that the length of the result was as short as possible and it was a proper email address. If the lengths are equal, you should print the lexicographically minimal result. Overall, two variants of replacement are possible: dot can be replaced by a dot, at can be replaced by an at. ", "input_spec": "The first line contains the email address description. It is guaranteed that that is a proper email address with all the dots replaced by dot an the at signs replaced by at. The line is not empty and its length does not exceed 100 symbols.", "output_spec": "Print the shortest email address, from which the given line could be made by the described above replacements. If there are several solutions to that problem, print the lexicographically minimal one (the lexicographical comparison of the lines are implemented with an operator < in modern programming languages). In the ASCII table the symbols go in this order: . @ ab...z", "sample_inputs": ["vasyaatgmaildotcom", "dotdotdotatdotdotat", "aatt"], "sample_outputs": ["vasya@gmail.com", "dot..@..at", "a@t"], "notes": null}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n#include <string.h>\n\n#define N\t100\n\nint main() {\n\tstatic char cc[N + 1];\n\tint n, m, i, at;\n\n\tscanf(\"%s\", cc), n = strlen(cc);\n\tat = 0;\n\tm = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (i > 1 && i < n - 1 && m >= 1 && cc[m - 1] == 'a' && cc[i] == 't' && !at) {\n\t\t\tat = 1;\n\t\t\tcc[m - 1] = '@';\n\t\t} else if (i > 2 && i < n - 1 && m >= 2 && cc[m - 2] == 'd' && cc[m - 1] == 'o' && cc[i] == 't')\n\t\t\tcc[--m - 1] = '.';\n\t\telse\n\t\t\tcc[m++] = cc[i];\n\tcc[m] = '\\0';\n\tprintf(\"%s\\n\", cc);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define N 100\n\nint main() {\n\tstatic char s[N + 1], t[N + 1];\n\tint n, i, at, k;\n\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tk = at = 0;\n\tfor (i = 0; i < n; )\n\t\tif (i > 0 && i + 1 < n - 1 && s[i] == 'a' && s[i + 1] == 't' && !at)\n\t\t\tt[k++] = '@', at = 1, i += 2;\n\t\telse if (i > 0 && i + 2 < n - 1 && s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't')\n\t\t\tt[k++] = '.', i += 3;\n\t\telse\n\t\t\tt[k++] = s[i], i++;\n\tprintf(\"%s\\n\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char mail[101], save[101];\n int ok=1;\n scanf(\"%s\",&mail);\n for(int i=0; i<strlen(mail); i++)\n {\n if(i)\n {\n if(mail[i]=='d'&&mail[i+1]=='o'&&mail[i+2]=='t'&&mail[i+3]!=NULL)\n {\n strcpy(save, mail+i+3);\n mail[i]='.';\n strcpy(mail+i+1, save);\n }\n if(mail[i]=='a'&&mail[i+1]=='t'&&mail[i+2]!=NULL&&ok)\n {\n strcpy(save, mail+i+2);\n mail[i]='@';\n strcpy(mail+i+1, save);\n ok=0;\n }\n }\n }\n printf(\"%s\", mail);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n char s[200];\n scanf(\"%s\",s);\n int size=0;\n while(s[size])\n {\n size++;\n }\n char s1[200];\n int i=0;\n int j=0;\n while(i<size)\n {\n if(i!=0 && (i+3)!=size && s[i]=='d' && s[i+1]=='o' && s[i+2]=='t')\n {\n s1[j]='.';\n j++;\n i=i+3;\n }\n else\n {\n s1[j]=s[i];\n i++;\n\t\t\tj++;\n }\n }\n\ts1[j]='\\0';\n\t//printf(\"%s\\n\",s1);\n\tint size2=j;\n\tchar s2[200];\n\tint jj=0;\n\tint k=0;\n\tint flag=0;\n\twhile(jj<size2)\n {\n if(jj!=0 && flag!=1 && (jj+2)!=size2 && s1[jj]=='a' && s1[jj+1]=='t')\n {\n\t\t\tflag=1;\n s2[k]='@';\n k++;\n jj=jj+2;\n }\n else\n {\n s2[k]=s1[jj];\n k++;\n jj++;\n }\n }\n\ts2[k]='\\0';\n\tprintf(\"%s\\n\",s2);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,n,l,z=0;\n char S[101];\n scanf(\"%s\",&S);\n l=strlen(S);\n if(S[0]=='d'&&S[1]=='o'&&S[2]=='t')\n {\n printf(\"dot\");\n for(i=3; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n else if(S[0]=='a'&&S[1]=='t')\n {\n printf(\"at\");\n for(i=2; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n else\n {\n for(i=0; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint i,lenght,ok_at;\nchar s[101];\n\nint main()\n{\n scanf(\"%s\",&s);\n lenght=strlen(s);\n\n for(i=1;i<lenght-2;i++)\n {\n\n if(s[i]=='d' && i<lenght-3)\n if(s[i+1]=='o' && s[i+2]=='t')\n {\n\n s[i]='.';\n strcpy(s+i+1,s+i+3);\n lenght-=2;\n\n }\n if(s[i]=='a' && ok_at==0)\n if(s[i+1]=='t')\n {\n s[i]='@';\n strcpy(s+i+1,s+i+2);\n ok_at=1;\n lenght-=1;\n\n }\n\n }\nprintf(\"%s\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar a[110],b[100];\n\nint main()\n{\n int i,j,alen,flag=0;\n scanf(\"%s\",a);\n alen=strlen(a);\n b[0]=a[0];\n j=1;\n for(i=1;i<alen-3;i++)\n {\n if(!flag&&a[i]=='a'&&a[i+1]=='t'){b[j]='@';flag=1;i++;j++;}\n else if(a[i]=='d'&&a[i+1]=='o'&&a[i+2]=='t'){b[j]='.';j++;i+=2;}\n else {b[j]=a[i];j++;}\n }\n if(i==alen-3&&!flag&&a[i]=='a'&&a[i+1]=='t'){b[j]='@';i+=2;j++;}\n for(;i<alen;i++,j++)b[j]=a[i];\n printf(\"%s\\n\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar st[1000],c;\n\tlong la,i,d;\n\twhile(gets(st))\n\t{\n\t\tprintf(\"%c\",st[0]);\n\t\tla=strlen(st)-1;\n\t\tc=st[la];\n\n\t\tst[la]=0;d=1;\n\n\t\tfor(i=1;i<la;i++)\n\t\t{\n\t\t\tif(st[i]=='a')\n\t\t\t{\n\t\t\t\tif(st[i+1]=='t' && d)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"@\");\n\t\t\t\t\td=0;\n\t\t\t\t\ti+=1;\n\t\t\t\t}\n\t\t\t\telse printf(\"%c\",st[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(st[i]=='d')\n\t\t\t\t{\n\t\t\t\t\tif(st[i+1]=='o' && st[i+2]=='t')\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\".\");\n\t\t\t\t\t\ti+=2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf(\"%c\",st[i]);\n\t\t\t\t}\n\t\t\t\telse printf(\"%c\",st[i]);\n\t\t\t}\n\n\t\t}\n\t\tprintf(\"%c\\n\",c);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ifdot(a) (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')\n#define ifat(a) \t(str[a]=='a' && str[a+1]=='t')\n#define endl puts(\"\");\nchar str[200];\nint main ()\n{\n\tscanf(\"%s\",str);\n\tint i,len=strlen(str),b=0;\n\tprintf(\"%c\",str[0]);\n\tfor(i=1; i<len; i++)\n\t{\n\t\tif(ifdot(i) && i != len-3)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\ti+=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!b && ifat(i) && i != len-2)\n\t\t{\n\t\t\tprintf(\"@\");\n\t\t\ti++;\n\t\t\tb=1;\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%c\",str[i]);\n\t}\n\tendl;\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n#include <ctype.h>\n\n#define PI 3.141592653589793\n#define max(a,b) ((a < b) ? (b) : (a))\n#define min(a,b) ((a > b) ? (b) : (a))\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) (((x)*PI)/180)\n#define y1 y_1\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, u, k;\nchar s[MAX];\n\nint main () {\n\tscanf(\"%s\",s);\n\tu = strlen(s);\n\tFOR(i, 0, u - 1){\n\t\tif(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i + 2 != u - 1 &&i != 0){\n\t\t\ts[i] = '.';\n\t\t\ts[i + 1] = '\\0';\n\t\t\ts[i + 2] = '\\0';\n\t\t}\n\t\telse if(s[i] == 'a' && s[i + 1] == 't' && i != 0 &&i + 1 != u - 1 && !k){\n\t\t\ts[i] = '@';\n\t\t\ts[i + 1] = '\\0';\n\t\t\tk = 1;\n\t\t}\n\t}\n\tFOR(i, 0, u - 1)\n\t\tif(s[i])\n\t\t\tprintf(\"%c\",s[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;at++;\n\t}\n\telse if(a[0]=='d' && a[1]=='o' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tif(a[0]=='a' && a[1]=='t'){\n\t\tp(\"at\");\n\t\tj=2;\n\t}\n\tfor(i=j;i<u;i++){\t\n\t\tif(i==u-3 && a[u-2]=='o' && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+1]=='o' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[101], c[101];\n int p = 0, f = 0, i;\n\n scanf(\"%s\", s);\n\n for (i = 0; i < strlen(s); i++) {\n\t if (p > 0 && f == 0 && strncmp(&s[i], \"at\", 2) == 0) {\n\t c[p++] = '@';\n\n\t i++;\n\n\t f = 1;\n\t } else if (p > 0 && strncmp(&s[i], \"dot\", 3) == 0) {\n\t c[p++] = '.';\n\n\t i += 2;\n\t } else {\n\t c[p++] = s[i];\n\t }\n }\n\n if (c[p - 1] == '.') {\n\t c[p - 1] = 'd';\n\t c[p] = 'o';\n\t c[p + 1] = 't';\n\n\t p += 2;\n }\n\n c[p] = '\\0';\n\n printf(\"%s\\n\", c);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(){\n\n\tchar mail[110], aux[110];\n\tint i, j, sz;\n\t\n\tfgets( mail, 110, stdin );\n\tsz = strlen(mail);\n\tmail[sz-1] = mail[sz];\n\ti = 1, j = 1;\n\taux[0] = mail[0];\n\t\n\twhile( !(mail[i] == 'a' && mail[i+1] == 't') ) aux[j++] = mail[i++];\n\taux[j++] = '@';\n\ti += 2;\n\n\twhile( mail[i] ) aux[j++] = mail[i++];\n\taux[j] = mail[i];\n\tsz = j;\n\t\n\ti = 1, j = 1;\n\t\n\tmail[0] = aux[0];\n\t\n\twhile( (i+2) < (sz-1) ){\n\t\tif( aux[i] == 'd' && aux[i+1] == 'o' && aux[i+2] == 't' ){\n\t\t\tmail[j++] = '.';\n\t\t\ti += 3;\n\t\t} else mail[j++] = aux[i++];\n\t}\n\t\n\twhile( aux[i] ) mail[j++] = aux[i++];\n\tmail[j] = aux[i];\n\t\n\tputs( mail );\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n char ch[1000];\n int i,j,k,l,x,a;\n gets(ch);\n int len=strlen(ch);\n for(i=0;i<len;i++)\n {\n if(i!=0 && i!=(len-3))\n {\n if(ch[i]=='d')\n {\n i++;\n if(ch[i]=='o')\n {\n i++;\n if(ch[i]=='t')\n {\n ch[i-2]='.';\n }\n i--;\n\n }\n i--;\n }\n }\n }\n for(i=0;i<len;i++)\n {\n if(i!=0 && i!=(len-2))\n {\n if(ch[i]=='a')\n {\n i++;\n if(ch[i]=='t')\n {\n ch[i-1]='@';\n goto end;\n }\n i--;\n }\n }\n }\n end:\n /*for(i=0;i<len;i++)\n printf(\"%c\",ch[i]);\n\n printf(\"\\n\");*/\n for(i=0;i<len;i++)\n {\n printf(\"%c\",ch[i]);\n if(ch[i]=='.')\n i=i+2;\n if(ch[i]=='@')\n i++;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char email[500],ara[100];\n int i,j,len,k=0;\n gets(email);\n len=strlen(email);\n for(i=0;i<len;i++)\n {\n if(email[i]>='a' && email[i]<='z') continue;\n else return 0;\n }\n if(len>=1 && len<=100)\n {\n ara[0]=email[0];\n for(i=1,j=1;i<len;)\n {\n if(email[i]=='d' && email[i+1]=='o' && email[i+2]=='t' && i+3!=len)\n {\n ara[j]='.';\n i=i+3;\n j++;\n }\n else if(email[i]=='a' && email[i+1]=='t' && k==0 && (i+2)!=len)\n {\n k=1;\n ara[j]='@';\n i=i+2;\n j++;\n }\n else\n {\n ara[j]=email[i];\n j++;\n i++;\n }\n }\n ara[j]='\\0';\n printf(\"%s\",ara);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,n,f;\nchar arr[1000];\nint main(){\n\tscanf(\"%s\",arr);\n\tn = strlen(arr);\n\tif(arr[0] == 'd' && arr[1] == 'o' && arr[2] == 't')\n\t\tprintf(\"dot\"),i=3;\n\telse if(arr[0] == 'a' && arr[1] == 't')\n\t\tprintf(\"at\"),i=2;\n\n\tfor(;i<n;i++){\n\t\tif(i+3<n && arr[i] == 'd' && arr[i+1] == 'o' && arr[i+2] == 't')\n\t\t\tprintf(\".\"),i+=2;\n\n\t\telse if(!f && i+1<n && arr[i] == 'a' && arr[i+1] == 't')\n\t\t\t\tprintf(\"@\"),f=1,i+=1;\n\n\t\telse\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\n#include\"string.h\"\nint main()\n{\nint i,l,c=1;\n/*freopen(\"input.txt\",\"r\",stdin);\nfreopen(\"output.txt\",\"w\",stdout);*/\nchar a[101];\nscanf(\"%s\",a);\nl=strlen(a);\nprintf(\"%c\",a[0]);\nfor(i=1;i<l;)\n{\nif(a[i]=='a' && a[i+1]=='t' &&c)\n{\n\tif(i!=l-2)\n{printf(\"@\");c=0;}\nelse\nprintf(\"at\");\ni+=2;\n}\nelse if(a[i]=='d' &&a[i+1]=='o' &&a[i+2]=='t')\n{if(i!=l-3)\n\tprintf(\".\");\n\telse\n\tprintf(\"dot\");\n\ti+=3;\n}\n\telse\n\tprintf(\"%c\",a[i++]);\n}\nprintf(\"\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int foundat = 0, i, foundchar = 0;\n char s[101];\n scanf(\"%s\", &s);\n for(i = 0; i < strlen(s); i++)\n {\n if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0 && i != 0)\n {\n printf(\"@\");\n foundat = 1;\n i++;\n }\n else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' && i < strlen(s) - 3 && s[i + 2] == 't' && foundchar == 1)\n {\n printf(\".\");\n i += 2;\n }\n else\n {\n foundchar = 1;\n printf(\"%c\", s[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n\nint main(){\n int j, i, a, len;\n char s[101];\n char e[101];\n\n scanf(\"%s\", &s);\n len = strlen(s);\n for(i=0; i < len; i++)\n s[i] = tolower(s[i]);\n \n e[0] = s[0];\n j = 1;\n a = 0;\n for(i=1; i < len; i++){\n if(!a && (i < (len-2)) && (s[i] == 'a') && (s[i+1] == 't')){\n a = 1;\n e[j++] = '@';\n i += 1;\n }else if((i < (len-3)) && (s[i] == 'd') && (s[i+1] == 'o') && (s[i+2] == 't')){\n e[j++] = '.';\n i += 2;\n }\n else\n e[j++] = s[i];\n }\n e[j] = '\\0';\n printf(\"%s\\n\", e);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar str[101];\nint i=1,chk=0;\nscanf(\"%s\",&str);\nprintf(\"%c\",str[0]);\nwhile(i!=strlen(str))\n {\n if(str[i]=='a')\n {\n if(chk==0)\n {\n if((str[i+1]=='t')&&((i+1)!=strlen(str)-1))\n {\n printf(\"@\");\n i++;\n chk=1;\n }\n }\n else\n printf(\"%c\",str[i]);\n }\n else if(str[i]=='d')\n {\n if((str[i+1]=='o')&&(str[i+2]=='t')&&((i+2)!=strlen(str)-1))\n {\n printf(\".\");\n i+=2;\n }\n else\n printf(\"%c\",str[i]);\n goto xy;\n }\n else\n {\n printf(\"%c\",str[i]);\n goto xy ;\n }\nif(chk==0)\n printf(\"%c\",str[i]);\nxy : i++;\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[101],c[101];\nint main()\n{\n scanf(\"%s\",s);\n int l=strlen(s),i,flag=0,n=1;\n c[0]=s[0];\n for(i=1;i<l-1;++i)\n {\n if(s[i]=='a' && !flag && s[i+1]=='t' && i+1!=l-1)\n c[n++]='@',i+=1,flag=1;\n else if(s[i]=='d' && s[i+1]=='o' && s[i+2]=='t'&& i+2!=l-1)\n c[n++]='.',i+=2;\n else\n c[n++]=s[i];\n }\n c[n++]=s[l-1];\n c[n]='\\n';\n printf(\"%s\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define MAX_ADDRESS 101\n\nint main()\n{\n\tchar address[MAX_ADDRESS], correct_address[MAX_ADDRESS] = {'\\0'}, at_found = 0;\n\tgets(address);\n\t\n\tint i=0,j=0;\n\t\n\tif (strstr(address,\"at\") == address)\n\t{\n\t\tstrcpy(correct_address,\"at\");\n\t\ti=2;\n\t\tj=2;\n\t}\n\telse if (strstr(address,\"dot\") == address)\n\t{\n\t\tstrcpy(correct_address,\"dot\");\n\t\ti=3;\n\t\tj=3;\n\t}\n\t\n\tfor(;address[i];i++)\n\t{\n\t\tif (address[i] != 'd' && address[i] != 'a')\n\t\t\tcorrect_address[j++] = address[i];\n\t\telse if (strstr(address+i,\"dot\") == address+i)\n\t\t\t\t{\n\t\t\t\t\tcorrect_address[j++] = '.';\n\t\t\t\t\ti+=2;\n\t\t\t\t}\n\t\t\telse if (!at_found && strstr(address+i,\"at\") == address +i)\n\t\t\t\t{\n\t\t\t\t\tcorrect_address[j++] = '@';\n\t\t\t\t\ti++;\n\t\t\t\t\tat_found = 1;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tcorrect_address[j++] = address[i];\n\t}\n\t\n\tj--;\n\tif (correct_address[j] == '.')\n\t{\n\t\tcorrect_address[j] = 'd';\n\t\tcorrect_address[j+1] = 'o';\n\t\tcorrect_address[j+2] = 't';\n\t\tcorrect_address[j+3]= '\\0';\n\t}\n\t\n\tputs(correct_address);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{char add[101];\nint l,i,c=0;\nscanf(\"%s\",add);\nl=strlen(add);\nfor(i=0;i<l;i++)\n { if(c==0)\n {\n if(add[i]=='a' && add[i+1]=='t' && i>0 && i<l-2)\n {printf(\"@\");\n c++;\n i+=1;\n continue;\n }\n }\n if(add[i]=='d' && add[i+1]=='o' && add[i+2]=='t' && i>0 && i<l-3)\n {printf(\".\");\n i+=2;\n continue;\n }\n printf(\"%c\",add[i]);\n}\nreturn 0;\n} \n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n char c;\n char znak[400];\n int krok = 0;\n int i = 0;\n int zavynac = 0;\n \n \n while ((c = getchar()) != EOF){\n znak[i] = c;\n i++;\n }\n int maxi = i;\n \n for (i = 0; i < maxi; i++){\n if (i > 0){\n if ((znak[i] == 'd') && (znak[i + 1] == 'o') && (znak[i + 2] == 't') && ((i + 4) != maxi)){\n putchar('.');\n i++;\n i++;\n } else if ((znak[i] == 'a') && (znak[i + 1] == 't') && (zavynac == 0)){\n putchar('@');\n zavynac++;\n i++;\n } else {\n putchar(znak[i]);\n }\n } else {\n putchar(znak[i]);\n }\n }\n \n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char input[101];\n char output[100];\n int i, j;\n int at_count = 0;\n scanf(\"%s\",input);\n\n j = 1;\n output[0] = input[0];\n for(i = 1; i<strlen(input)-1; ){\n if(input[i]=='a' && at_count==0 && i+2<strlen(input) && 0==strncmp(\"at\",input+i,2)){\n\t strncpy(output+j,\"@\",1);\n\t j++;\n\t i+=2;\n\t at_count++;\n } else if(input[i]=='d' && i+3<strlen(input) && 0==strncmp(\"dot\",input+i,3)){\n\t strncpy(output+j,\".\",1);\n\t j++;\n\t i+=3;\n } else {\n\t output[j]=input[i];\n\t j++;\n\t i++;\n }\n }\n output[j]=input[strlen(input)-1];\n output[j+1]=0;\n printf(\"%s\",output);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int s[100];\n int c, i = 0, len, flag = 0;\n\n\n while ((c = getchar()) != '\\n') {\n s[i] = c;\n i++;\n }\n len = i;\n i = 0;\n while (i < len) {\n if (flag == 0 && s[i] == 'a' && s[i + 1] == 't' && i != 0 && i != len - 2) {\n s[i] = '@';\n s[i + 1] = 1;\n i += 2;\n flag = 1;\n }\n else\n if (s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0 && i != len -3) {\n s[i] = '.';\n s[i + 1] = 1;\n s[i + 2] = 1;\n i += 3;\n } else i++;\n\n }\n for (i = 0; i < len; i++)\n if (s[i] != 1)\n printf(\"%c\", s[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,top=0,fl=0;\n\tchar ar[109],stack[109];\n\tscanf(\"%s\",ar);\n\tfor(x=0;ar[x]!='\\0';x++)\n\t{\n\t\tif(ar[x] != 't')\n\t\t\tstack[top++] = ar[x];\n\t\telse\n\t\t{\n\t\t\tif(top-1 > 1 && stack[top-1] == 'o' && stack[top-2] == 'd' && ar[x+1]!='\\0')\n\t\t\t{\n\t\t\t\tstack[top-2] = '.';\n\t\t\t\ttop -= 1;\n\t\t\t}\n\t\t\telse if(top -1 > 0 && stack[top-1] == 'a' && ar[x+1] != '\\0' && fl == 0)\n\t\t\t{\n\t\t\t\tstack[top-1] = '@';\n\t\t\t\tfl = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t \tstack[top++] = 't';\n\t\t}\n\t}\n\tfor(x=0;x<top;x++)\n\t\tprintf(\"%c\",stack[x]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define N 100\n\nint main() {\n\tstatic char s[N + 1], t[N + 1];\n\tint n, i, at, k;\n\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tk = at = 0;\n\tfor (i = 0; i < n; )\n\t\tif (i > 0 && i + 1 < n - 1 && s[i] == 'a' && s[i + 1] == 't' && !at)\n\t\t\tt[k++] = '@', i += 2;\n\t\telse if (i > 0 && i + 2 < n - 1 && s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't')\n\t\t\tt[k++] = '.', i += 3;\n\t\telse\n\t\t\tt[k++] = s[i], i++;\n\tprintf(\"%s\\n\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char mail[101], save[101];\n scanf(\"%s\",&mail);\n for(int i=0; i<strlen(mail); i++)\n {\n if(i)\n {\n if(mail[i]=='d'&&mail[i+1]=='o'&&mail[i+2]=='t'&&mail[i+3]!=NULL)\n {\n strcpy(save, mail+i+3);\n mail[i]='.';\n strcpy(mail+i+1, save);\n }\n if(mail[i]=='a'&&mail[i+1]=='t'&&mail[i+2]!=NULL)\n {\n strcpy(save, mail+i+2);\n mail[i]='@';\n strcpy(mail+i+1, save);\n }\n }\n }\n printf(\"%s\", mail);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,n,l,z=0;\n char S[101];\n scanf(\"%s\",&S);\n l=strlen(S);\n if(S[0]=='d'&&S[1]=='o'&&S[2]=='t')\n {\n printf(\"dot\");\n for(i=3; i<l; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n else\n {\n for(i=0; i<l; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,n,l,z=0;\n char S[101];\n scanf(\"%s\",&S);\n l=strlen(S);\n if(S[0]=='d'&&S[1]=='o'&&S[2]=='t')\n {\n printf(\"dot\");\n for(i=3; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(i=l-3; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n else\n {\n for(i=0; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(i=l-3; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int i,n,l,z=0;\n char S[101];\n scanf(\"%s\",&S);\n l=strlen(S);\n if(S[0]=='d'&&S[1]=='o'&&S[2]=='t')\n {\n printf(\"dot\");\n for(i=3; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n else\n {\n for(i=0; i<l-3; i++)\n {\n if(S[i]=='d'&&S[i+1]=='o'&&S[i+2]=='t')\n {\n printf(\".\");\n i+=2;\n }\n else if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n if(S[l-3]=='d'&&S[l-2]=='o'&&S[l-1]=='t')\n {\n printf(\"dot\");\n }\n else\n {\n for(; i<l; i++)\n {\n if(S[i]=='a'&&S[i+1]=='t'&&z==0)\n {\n printf(\"@\");\n i++;\n z=1;\n }\n else\n {\n printf(\"%c\",S[i]);\n }\n }\n }\n }\n printf(\"\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint i,lenght,ok_at;\nchar s[100];\n\nint main()\n{\n scanf(\"%s\",&s);\n lenght=strlen(s);\n\n for(i=1;i<lenght-2;i++)\n {\n if(s[i]=='d' && i<lenght-3)\n if(s[i+1]=='o' && s[i+2]=='t')\n {\n\n s[i]='.';\n strcpy(s+i+1,s+i+3);\n lenght-=2;\n }\n if(s[i]=='a' && ok_at==0)\n if(s[i+1]=='t')\n {\n s[i]='@';\n strcpy(s+i+1,s+i+2);\n ok_at=1;\n lenght-=1;\n }\n\n }\nprintf(\"%s\",s);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint i,lenght,ok_at;\nchar s[101];\n\nint main()\n{\n scanf(\"%s\",&s);\n lenght=strlen(s);\n\n for(i=1;i<lenght-2;i++)\n {\n printf(\"%c \",s[i]);\n if(s[i]=='d')\n if(s[i+1]=='o' && s[i+2]=='t')\n {\n\n s[i]='.';\n strcpy(s+i+1,s+i+3);\n lenght-=2;\n\n }\n if(s[i]=='a' && ok_at==0)\n if(s[i+1]=='t')\n {\n s[i]='@';\n strcpy(s+i+1,s+i+2);\n ok_at=1;\n lenght-=1;\n\n }\n\n }\nprintf(\"%s\",s);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint i,lenght,ok_at;\nchar s[101];\n\nint main()\n{\n scanf(\"%s\",&s);\n lenght=strlen(s);\n\n for(i=1;i<lenght-2;i++)\n {\n\n if(s[i]=='d')\n if(s[i+1]=='o' && s[i+2]=='t')\n {\n\n s[i]='.';\n strcpy(s+i+1,s+i+3);\n lenght-=2;\n\n }\n if(s[i]=='a' && ok_at==0)\n if(s[i+1]=='t')\n {\n s[i]='@';\n strcpy(s+i+1,s+i+2);\n ok_at=1;\n lenght-=1;\n\n }\n\n }\nprintf(\"%s\",s);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar st[1000],c;\n\tlong la,i;\n\twhile(gets(st))\n\t{\n\t\tprintf(\"%c\",st[0]);\n\t\tla=strlen(st)-1;\n\t\tc=st[la];\n\n\t\tst[la]=0;\n\n\t\tfor(i=1;i<la;i++)\n\t\t{\n\t\t\tif(st[i]=='a')\n\t\t\t{\n\t\t\t\tif(st[i+1]=='t')\n\t\t\t\t{\n\t\t\t\t\tprintf(\"@\");\n\t\t\t\t\ti+=1;\n\t\t\t\t}\n\t\t\t\telse printf(\"%c\",st[i]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(st[i]=='d')\n\t\t\t\t{\n\t\t\t\t\tif(st[i+1]=='o' && st[i+2]=='t')\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\".\");\n\t\t\t\t\t\ti+=2;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf(\"%c\",st[i]);\n\t\t\t\t}\n\t\t\t\telse printf(\"%c\",st[i]);\n\t\t\t}\n\n\t\t}\n\t\tprintf(\"%c\\n\",c);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ifdot(a) (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')\n#define ifat(a) \t(str[a]=='a' && str[a+1]=='t')\n#define endl puts(\"\");\nchar str[200];\nint main ()\n{\n\tscanf(\"%s\",str);\n\tint i,len=strlen(str);\n\tprintf(\"%c\",str[0]);\n\tfor(i=1; i<len; i++)\n\t{\t\n\t\tif(ifdot(i))\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\ti+=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ifat(i))\n\t\t{\n\t\t\tprintf(\"@\");\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%c\",str[i]);\n\t}\n\tendl;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ifdot(a) (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')\n#define ifat(a) \t(str[a]=='a' && str[a+1]=='t')\n#define endl puts(\"\");\nchar str[200];\nint main ()\n{\n\tscanf(\"%s\",str);\n\tint i,len=strlen(str),b=0;\n\tprintf(\"%c\",str[0]);\n\tfor(i=1; i<len; i++)\n\t{\n\t\tif(ifdot(i) && i != len-3)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\ti+=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!b && ifat(i) && i != len-2)\n\t\t{\n\t\t\tprintf(\"@\");\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%c\",str[i]);\n\t}\n\tendl;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ifdot(a) (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')\n#define ifat(a) \t(str[a]=='a' && str[a+1]=='t')\n#define endl puts(\"\");\nchar str[200];\nint main ()\n{\n\tscanf(\"%s\",str);\n\tint i,len=strlen(str);\n\tprintf(\"%c\",str[0]);\n\tfor(i=1; i<len-2; i++)\n\t{\n\t\tif(ifdot(i))\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\ti+=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ifat(i))\n\t\t{\n\t\t\tprintf(\"@\");\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%c\",str[i]);\n\t}\n\tfor(i=len-2; i<len; i++)printf(\"%c\",str[i]);\n\tendl;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ifdot(a) (str[a]=='d' && str[a+1]=='o' && str[a+2]=='t')\n#define ifat(a) \t(str[a]=='a' && str[a+1]=='t')\n#define endl puts(\"\");\nchar str[200];\nint main ()\n{\n\tscanf(\"%s\",str);\n\tint i,len=strlen(str);\n\tprintf(\"%c\",str[0]);\n\tfor(i=1; i<len; i++)\n\t{\n\t\tif(ifdot(i) && i != len-3)\n\t\t{\n\t\t\tprintf(\".\");\n\t\t\ti+=2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (ifat(i) && i != len-2)\n\t\t{\n\t\t\tprintf(\"@\");\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tprintf(\"%c\",str[i]);\n\t}\n\tendl;\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n#include <ctype.h>\n\n#define PI 3.141592653589793\n#define max(a,b) ((a < b) ? (b) : (a))\n#define min(a,b) ((a > b) ? (b) : (a))\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) (((x)*PI)/180)\n#define y1 y_1\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, u, k;\nchar s[MAX];\n\nint main () {\n\tscanf(\"%s\",s);\n\tu = strlen(s);\n\tFOR(i, 0, u - 1){\n\t\tif(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i + 2 != u - 1 &&i != 0){\n\t\t\ts[i] = '.';\n\t\t\ts[i + 1] = '\\0';\n\t\t\ts[i + 2] = '\\0';\n\t\t}\n\t\telse if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1 && !k){\n\t\t\ts[i] = '@';\n\t\t\ts[i + 1] = '\\0';\n\t\t\tk = 1;\n\t\t}\n\t}\n\tFOR(i, 0, u - 1)\n\t\tif(s[i])\n\t\t\tprintf(\"%c\",s[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n#include <ctype.h>\n\n#define PI 3.141592653589793\n#define max(a,b) ((a < b) ? (b) : (a))\n#define min(a,b) ((a > b) ? (b) : (a))\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) (((x)*PI)/180)\n#define y1 y_1\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, u;\nchar s[MAX];\n\nint main () {\n\tscanf(\"%s\",s);\n\tu = strlen(s);\n\tFOR(i, 0, u - 1){\n\t\tif(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){\n\t\t\ts[i] = '.';\n\t\t\ts[i + 1] = '\\0';\n\t\t\ts[i + 2] = '\\0';\n\t\t}\n\t\telse if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1){\n\t\t\ts[i] = '@';\n\t\t\ts[i + 1] = '\\0';\n\t\t}\n\t}\n\tFOR(i, 0, u - 1)\n\t\tif(s[i])\n\t\t\tprintf(\"%c\",s[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n#include <ctype.h>\n\n#define PI 3.141592653589793\n#define max(a,b) ((a < b) ? (b) : (a))\n#define min(a,b) ((a > b) ? (b) : (a))\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) (((x)*PI)/180)\n#define y1 y_1\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, u;\nchar s[MAX];\n\nint main () {\n\tscanf(\"%s\",s);\n\tu = strlen(s);\n\tFOR(i, 0, u - 1){\n\t\tif(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){\n\t\t\ts[i] = '.';\n\t\t\ts[i + 1] = '\\0';\n\t\t\ts[i + 2] = '\\0';\n\t\t}\n\t\telse if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1){\n\t\t\ts[i] = '@';\n\t\t\ts[i + 1] = '\\0';\n\t\t}\n\t}\n\tFOR(i, 0, u - 1)\n\t\tprintf(\"%c\",s[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n#include <ctype.h>\n\n#define PI 3.141592653589793\n#define max(a,b) ((a < b) ? (b) : (a))\n#define min(a,b) ((a > b) ? (b) : (a))\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) (((x)*PI)/180)\n#define y1 y_1\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, u, k;\nchar s[MAX];\n\nint main () {\n\tscanf(\"%s\",s);\n\tu = strlen(s);\n\tFOR(i, 0, u - 1){\n\t\tif(s[i] == 'd' && s[i + 1] == 'o' && s[i + 2] == 't' && i != 0){\n\t\t\ts[i] = '.';\n\t\t\ts[i + 1] = '\\0';\n\t\t\ts[i + 2] = '\\0';\n\t\t}\n\t\telse if(s[i] == 'a' && s[i + 1] == 't' && i + 1 != u - 1 && !k){\n\t\t\ts[i] = '@';\n\t\t\ts[i + 1] = '\\0';\n\t\t\tk = 1;\n\t\t}\n\t}\n\tFOR(i, 0, u - 1)\n\t\tif(s[i])\n\t\t\tprintf(\"%c\",s[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"a@t\");\n\t\tj=4;\n\t}\n\telse if(a[0]=='d' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tfor(i=j;i<u;i++){\n\t\tif(i==u-3 && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;at++;\n\t}\n\telse if(a[0]=='d' && a[1]=='o' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tif(a[0]=='a' && a[1]=='t'){\n\t\tp(\"at\");\n\t\tj=2;\n\t}\n\tfor(i=j;i<u;i++){\t\n\t\tif(i==u-2 && a[u-2]=='o' && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+1]=='o' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;\n\t}\n\telse if(a[0]=='d' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tfor(i=j;i<u;i++){\n\t\tif(i==u-3 && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"a@t\");\n\t\tj=4;\n\t}\n\telse if(a[0]=='d' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tfor(i=j;i<u;i++){\n\t\tif(a[i]=='d' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\t\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;at++;\n\t}\n\telse if(a[0]=='d' && a[1]=='o' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tif(a[0]=='a' && a[1]=='t'){\n\t\tp(\"at\");\n\t\tj=2;\n\t}\n\tfor(i=j;i<u;i++){\t\n\t\tif(i==u-3 && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+1]=='o' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;at++;\n\t}\n\telse if(a[0]=='d' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tfor(i=j;i<u;i++){\n\t\tif(i==u-3 && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define p printf\n\tchar a[1444],u,at;\n\tint i,j;\nint main(){\n\tscanf(\"%s\",a);\n\tu=strlen(a);\n\tif(a[1]=='a' && a[2]=='t'){\n\t\tp(\"%c@\",a[0]);\n\t\tj=3;at++;\n\t}\n\telse if(a[0]=='d' && a[2]=='t'){\n\t\tp(\"dot\");\n\t\tj=3;\n\t}\n\tif(a[0]=='a' && a[1]=='t'){\n\t\tp(\"at\");\n\t\tj=2;\n\t}\n\tfor(i=j;i<u;i++){\t\n\t\tif(i==u-3 && a[u-3]=='d'){\n\t\t\tp(\"dot\");return 0;\n\t\t}\n\t\telse if(a[i]=='d' && a[i+2]=='t'){\n\t\t\tp(\".\");i+=2;}\n\t\telse if(a[i]=='a' && a[i+1]=='t'){\n\t\t\tif(!at){\n\t\t\t\tp(\"@\");\n\t\t\t\tat++;\n\t\t\t}\n\t\t\telse p(\"at\");i++;}\n\t\telse p(\"%c\",a[i]);\n\t}\n\tp(\" \");}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(){\n\n\tchar mail[110], aux[110];\n\tint i, j, sz;\n\t\n\tfgets( mail, 100, stdin );\n\tsz = strlen(mail);\n\tmail[sz-1] = mail[sz];\n\ti = 1, j = 1;\n\taux[0] = mail[0];\n\t\n\twhile( !(mail[i] == 'a' && mail[i+1] == 't') ) aux[j++] = mail[i++];\n\taux[j++] = '@';\n\ti += 2;\n\n\twhile( mail[i] ) aux[j++] = mail[i++];\n\taux[j] = mail[i];\n\tsz = j;\n\t\n\ti = 1, j = 1;\n\t\n\tmail[0] = aux[0];\n\t\n\twhile( (i+2) < (sz-1) ){\n\t\tif( aux[i] == 'd' && aux[i+1] == 'o' && aux[i+2] == 't' ){\n\t\t\tmail[j++] = '.';\n\t\t\ti += 3;\n\t\t} else mail[j++] = aux[i++];\n\t}\n\t\n\twhile( aux[i] ) mail[j++] = aux[i++];\n\tmail[j] = aux[i];\n\t\n\tputs( mail );\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n char ch[1000];\n int i,j,k,l,x,a;\n gets(ch);\n int len=strlen(ch);\n for(i=0;i<len;i++)\n {\n if(i!=0 && i!=(len-3))\n {\n if(ch[i]=='d')\n {\n i++;\n if(ch[i]=='o')\n {\n i++;\n if(ch[i]=='t')\n {\n ch[i-2]='.';\n }\n i--;\n\n }\n i--;\n }\n }\n }\n for(i=0;i<len;i++)\n {\n if(i!=0 && i!=(len-2))\n {\n if(ch[i]=='a')\n {\n i++;\n if(ch[i]=='t')\n {\n ch[i-1]='@';\n }\n i--;\n }\n }\n }\n /*for(i=0;i<len;i++)\n printf(\"%c\",ch[i]);\n\n printf(\"\\n\");*/\n for(i=0;i<len;i++)\n {\n printf(\"%c\",ch[i]);\n if(ch[i]=='.')\n i=i+2;\n if(ch[i]=='@')\n i++;\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char email[500],ara[100];\n int i,j,len,k=0;\n gets(email);\n len=strlen(email);\n for(i=0;i<len;i++)\n {\n if(email[i]>='a' && email[i]<='z') continue;\n else return 0;\n }\n if(len>=1 && len<=100)\n {\n ara[0]=email[0];\n for(i=1,j=1;i<len;)\n {\n if(email[i]=='d' && email[i+1]=='o' && email[i+2]=='t' && i+3!=len)\n {\n ara[j]='.';\n i=i+3;\n j++;\n }\n else if(email[i]=='a' && email[i+1]=='t' && k==0 && (i+2)!=len)\n {\n k=1;\n ara[j]='@';\n i=i+2;\n j++;\n }\n else\n {\n ara[j]=email[i];\n j++;\n i++;\n }\n }\n printf(\"%s\",ara);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,n,f;\nchar arr[1000];\nint main(){\n\tscanf(\"%s\",arr);\n\tn = strlen(arr);\n\tif(arr[0] == 'd' && arr[1] == 'o' && arr[2] == 't')\n\t\tprintf(\"dot\"),i=3;\n\telse if(arr[0] == 'a' && arr[1] == 't')\n\t\tprintf(\"at\"),i=2;\n\n\tfor(;i<n;i++){\n\t\tif(i+5<n && arr[i] == 'd' && arr[i+1] == 'o' && arr[i+2] == 't')\n\t\t\tprintf(\".\"),i+=2;\n\n\t\telse if(!f && i+1<n && arr[i] == 'a' && arr[i+1] == 't')\n\t\t\t\tprintf(\"@\"),f=1,i+=1;\n\n\t\telse\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,n,f;\nchar arr[1000];\nint main(){\n\tscanf(\"%s\",arr);\n\tn = strlen(arr);\n\tif(arr[0] == 'd' && arr[1] == 'o' && arr[2] == 't')\n\t\tprintf(\"dot\"),i=3;\n\telse if(arr[0] == 'a' && arr[1] == 't')\n\t\tprintf(\"at\"),i=2;\n\n\tfor(;i<n;i++){\n\t\tif(i+4<n && arr[i] == 'd' && arr[i+1] == 'o' && arr[i+2] == 't')\n\t\t\tprintf(\".\"),i+=2;\n\n\t\telse if(!f && i+1<n && arr[i] == 'a' && arr[i+1] == 't')\n\t\t\t\tprintf(\"@\"),f=1,i+=1;\n\n\t\telse\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint i,n,f;\nchar arr[1000];\nint main(){\n\tscanf(\"%s\",arr);\n\tn = strlen(arr);\n\tif(arr[0] == 'd' && arr[1] == 'o' && arr[2] == 't')\n\t\tprintf(\"dot\"),i=3;\n\telse if(arr[0] == 'a' && arr[1] == 't')\n\t\tprintf(\"at\"),i=2;\n\n\tfor(;i<n;i++){\n\t\tif(i+2<n && arr[i] == 'd' && arr[i+1] == 'o' && arr[i+2] == 't')\n\t\t\tprintf(\".\"),i+=2;\n\n\t\telse if(!f && i+1<n && arr[i] == 'a' && arr[i+1] == 't')\n\t\t\t\tprintf(\"@\"),f=1,i+=1;\n\n\t\telse\n\t\t\tprintf(\"%c\",arr[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int foundat = 0, i, foundchar = 0;\n char s[101];\n scanf(\"%s\", &s);\n for(i = 0; i < strlen(s); i++)\n {\n if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0)\n {\n printf(\"@\");\n foundat = 1;\n i++;\n }\n else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' && i < strlen(s) - 2 && s[i + 2] == 't' && foundchar == 1)\n {\n printf(\".\");\n i += 2;\n }\n else\n {\n foundchar = 1;\n printf(\"%c\", s[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int foundat = 0, i, foundchar = 0;\n char s[101];\n scanf(\"%s\", &s);\n for(i = 0; i < strlen(s); i++)\n {\n if(s[i] == 'a' && ( i != strlen(s) - 1 && s[i + 1] == 't') && foundat == 0)\n {\n printf(\"@\");\n foundat = 1;\n i++;\n }\n else if(s[i] == 'd' && i < strlen(s) - 1 && s[i + 1] == 'o' && i < strlen(s) - 3 && s[i + 2] == 't' && foundchar == 1)\n {\n printf(\".\");\n i += 2;\n }\n else\n {\n foundchar = 1;\n printf(\"%c\", s[i]);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main(){\n int j, i, a, len;\n char s[101];\n char e[101];\n\n scanf(\"%s\", &s);\n len = strlen(s);\n\n e[0] = s[0];\n j = 1;\n a = 0;\n for(i=1; i < len; i++){\n if(!a && (s[i] == 'a') && (s[i+1] == 't')){\n a = 1;\n e[j++] = '@';\n i += 1;\n }else if((i < (len-3)) && (s[i] == 'd') && (s[i+1] == 'o') && (s[i+2] == 't')){\n e[j++] = '.';\n i += 2;\n }\n else\n e[j++] = s[i];\n }\n e[i] = '\\0';\n printf(\"%s\\n\", e);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nchar str1[101],str2[101];\nint i,j;\nscanf(\"%s\",&str1);\nscanf(\"%s\",&str2);\nif(strlen(str1)!=strlen(str2))\n {\n printf(\"NO\\n\");\n return 0;\n }\nelse\n {\n for(i=0,j=strlen(str2)-1;i<strlen(str1),j>=0;i++,j--)\n if(str1[i]!=str2[j])\n break;\n }\nif(i!=strlen(str1))\n printf(\"NO\\n\");\nelse\n printf(\"YES\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[101],c[101];\nint main()\n{\n scanf(\"%s\",s);\n int l=strlen(s),i,flag=0,n=1;\n c[0]=s[0];\n for(i=1;i<l-1;++i)\n {\n if(s[i]=='a' && !flag && s[i+1]=='t' && i+1!=l-1)\n c[n++]='@',i+=1,flag=1;\n else if(s[i]=='d' && s[i+1]=='o' && s[i+2]=='t')\n c[n++]='.',i+=2;\n else\n c[n++]=s[i];\n }\n c[n++]=s[l-1];\n c[n]='\\n';\n printf(\"%s\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define MAX_ADDRESS 101\n\nint main()\n{\n\tchar address[MAX_ADDRESS], correct_address[MAX_ADDRESS] = {'\\0'}, at_found = 0;\n\tgets(address);\n\t\n\tint i=0,j=0;\n\t\n\tif (strstr(address,\"dot\") == address)\n\t{\n\t\tstrcpy(correct_address,\"dot\");\n\t\ti=3;\n\t\tj=3;\n\t}\n\t\n\tfor(;address[i];i++)\n\t{\n\t\tif (address[i] != 'd' && address[i] != 'a')\n\t\t\tcorrect_address[j++] = address[i];\n\t\telse if (strstr(address+i,\"dot\") == address+i)\n\t\t\t\t{\n\t\t\t\t\tcorrect_address[j++] = '.';\n\t\t\t\t\ti+=2;\n\t\t\t\t}\n\t\t\telse if (!at_found && strstr(address+i,\"at\") == address +i)\n\t\t\t\t{\n\t\t\t\t\tcorrect_address[j++] = '@';\n\t\t\t\t\ti++;\n\t\t\t\t\tat_found = 1;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tcorrect_address[j++] = address[i];\n\t}\n\t\n\tj--;\n\tif (correct_address[j] == '.')\n\t{\n\t\tcorrect_address[j] = 'd';\n\t\tcorrect_address[j+1] = 'o';\n\t\tcorrect_address[j+2] = 't';\n\t\tcorrect_address[j+3]= '\\0';\n\t}\n\t\n\tputs(correct_address);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{char add[101];\nint l,i;\nscanf(\"%s\",add);\nl=strlen(add);\nfor(i=0;i<l;i++)\n {if(add[i]=='a' && add[i+1]=='t' && i>0 && i<l-2)\n {printf(\"@\");\n i++;\n }\n else if(add[i]=='d' && add[i+1]=='o' && add[i+2]=='t' && i>0 && i<l-4)\n {printf(\".\");\n i+=2;\n }\n else printf(\"%c\",add[i]);\n}\nreturn 0;\n} \n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n char c;\n char znak[400];\n int krok = 0;\n int i = 0;\n int zavynac = 0;\n \n \n while ((c = getchar()) != EOF){\n znak[i] = c;\n i++;\n }\n int maxi = i;\n \n for (i = 0; i < maxi; i++){\n if (i > 0){\n if ((znak[i] == 'd') && (znak[i + 1] == 'o') && (znak[i + 2] == 't') && ((i + 3) != maxi)){\n putchar('.');\n i++;\n i++;\n } else if ((znak[i] == 'a') && (znak[i + 1] == 't') && (zavynac == 0)){\n putchar('@');\n zavynac++;\n i++;\n } else {\n putchar(znak[i]);\n }\n } else {\n putchar(znak[i]);\n }\n }\n \n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,top=0;\n\tchar ar[109],stack[109];\n\tscanf(\"%s\",ar);\n\tfor(x=0;ar[x]!='\\0';x++)\n\t{\n\t\tif(ar[x] != 't')\n\t\t\tstack[top++] = ar[x];\n\t\telse\n\t\t{\n\t\t\tif(top-1 > 1 && stack[top-1] == 'o' && stack[top-2] == 'd' && ar[x+1]!='\\0')\n\t\t\t{\n\t\t\t\tstack[top-2] = '.';\n\t\t\t\ttop -= 1;\n\t\t\t}\n\t\t\telse if(top -1 > 0 && stack[top-1] == 'a' && ar[x+1] != '\\0')\n\t\t\t{\n\t\t\t\tstack[top-1] = '@';\n\t\t\t}\n\t\t\telse\n\t\t\t \tstack[top++] = 't';\n\t\t}\n\t}\n\tfor(x=0;x<top;x++)\n\t\tprintf(\"%c\",stack[x]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}], "src_uid": "a11c9679d8e2dca51be17d466202df6e"} {"nl": {"description": "Fox Ciel is playing a game with numbers now. Ciel has n positive integers: x1, x2, ..., xn. She can do the following operation as many times as needed: select two different indexes i and j such that xi > xj hold, and then apply assignment xi = xi - xj. The goal is to make the sum of all numbers as small as possible.Please help Ciel to find this minimal sum.", "input_spec": "The first line contains an integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100). Then the second line contains n integers: x1, x2, ..., xn (1\u2009\u2264\u2009xi\u2009\u2264\u2009100).", "output_spec": "Output a single integer \u2014 the required minimal sum.", "sample_inputs": ["2\n1 2", "3\n2 4 6", "2\n12 18", "5\n45 12 27 30 18"], "sample_outputs": ["2", "6", "12", "15"], "notes": "NoteIn the first example the optimal way is to do the assignment: x2 = x2 - x1.In the second example the optimal sequence of operations is: x3 = x3 - x2, x2 = x2 - x1."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint GCD(int x, int y){\n int tmp;\n while(x%y != 0){\n x = x%y;\n tmp = y;\n y = x;\n x = tmp;\n }\n return y;\n}\n\nint main(){\n int n[200];\n int T;\n int i,j;\n int nowGCD;\n scanf(\"%d\", &T);\n for(i = 0; i < T; i++){\n scanf(\"%d\", &n[i]);\n }\n nowGCD = GCD(n[0], n[1]);\n for(i = 2; i < T; i++){\n nowGCD = GCD(nowGCD, n[i]);\n }\n printf(\"%d\", T*nowGCD);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint GCD(int a, int b)\n {\n int c;\n while(a)\n {\n c=b%a;\n b=a;\n a=c;\n }\n return b;\n }\nint main()\n {\n int n, x, y, i;\n scanf(\"%d%d\", &n, &x);\n for(i=1;i<n;i++)\n {\n scanf(\"%d\", &y);\n x=GCD(x,y);\n }\n printf(\"%d\", x*n);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\ntypedef long long ll;\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int ar[10000],i=0,j=0,min=101;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ar[i]);\n if(ar[i]<min)\n min = ar[i];\n } \n int count = 0;\n for(i=min;i>=2;i--)\n {\n count = 0;\n for(j=0;j<n;j++)\n {\n if(ar[j]%i==0)\n count++;\n }\n if(count==n)\n break;\n }\n printf(\"%d\\n\",i*n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return(*(int *)a)<(*(int *)b)?1:-1;\n}\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int n,i,j;\n int p[105];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&p[i]);\n qsort(p,n,sizeof(int),cmp);\n while(p[0]!=p[n-1])\n {\n for(i=0,j=0;j<n;)\n {\n if(p[i]>p[j])\n {\n p[i]=p[i]-p[j];\n i++;\n }\n else\n j++;\n }\n qsort(p,n,sizeof(int),cmp);\n }\n printf(\"%d\\n\",n*p[0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int , int);\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint n,x,i,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&y);\n\t\tx=gcd(x,y);\n\t}\n\tprintf(\"%d\",x*n);\n\treturn 0;\n}"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint gcd(int a, int b)\n{\n if(b == 0)\n return a;\n else\n return gcd(b,a%b); \n}\n\nint main()\n{\n int n,i,min=100,max=0;\n scanf(\"%d\",&n);\n int x[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n max = max>x[i]?max:x[i];\n min = min<x[i]?min:x[i];\n }\n int mingc = min;\n int j;\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(j != i)\n mingc = mingc<gcd(x[i],x[j]) ? mingc:gcd(x[i],x[j]);\n }\n }\n for(i=0;i<n;i++)\n {\n if(x[i]%mingc != 0)\n {\n printf(\"%d\\n\",n);\n return 0;\n }\n }\n printf(\"%d\",n*mingc);\n printf(\"\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n if(b==0)\n return a;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n int n,i,x[102],sum,m;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n for(i=0;i<n;i++)\n {\n if(i==0)\n m=x[i];\n else\n m=gcd(m,x[i]);\n }\n printf(\"%d\",m*n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint hcf(int a,int b)\n {\n if(a%b==0)\n {\n return b;\n }\n else\n {\n return(hcf(b,a%b));\n }\n }\n\nint main()\n{\n\n int n,i,h,t=10;\n \n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n for(i=0;i<n-1;i++)\n {\n h=hcf(arr[i],arr[i+1]);\n arr[i+1]=h;\n }\n printf(\"%d\\n\",n*h);\n \nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define MAX_NUMBERS 110\n\nint gcd (int x, int y){\n if (x == 0)\n return y;\n else\n return gcd(y%x, x);\n}\n\nint main (){\n\n int n, i, g, numbers[MAX_NUMBERS];\n\n scanf(\"%d\", &n);\n\n for (i=0; i<n; i++)\n scanf(\"%d\", &numbers[i]);\n\n g = gcd(numbers[0], numbers[1]);\n for (i=2; i<n; i++){\n //Calculate gcd, running for the rest of the items in the array\n g = gcd(g, numbers[i]);\n }\n\n printf(\"%d\\n\", g*n);\n\n return 0;\n}\n"}, {"source_code": "int main()\n{\n int number,array[200],i,min=1000,z,counter=0,sum=0,y=0;\n scanf(\"%d\",&number);\n for(i=0;i<number;i++)\n {\n scanf(\"%d\",&array[i]);\n }\n for(;;)\n {\n for(i=0;i<number;i++)\n {\n\n if(array[i]<min)\n {\n min=array[i];\n }\n }\n while(y<number)\n {\n if(array[y]!=min)\n {\n array[y]=array[y]-min;\n }\n y++;\n }\n\n\n for(z=0;z<number;z++)\n {\n if(array[z]==array[z+1])\n {\n counter++;\n }\n else\n {\n break;\n }\n }\n if(counter==number-1)\n {\n break;\n }\n counter=0;\n y=0;\n }\n i=0;\n while(i<number)\n {\n sum=sum+array[i];\n i++;\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int n,i,j,sum=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<n;i++){\n for(j=0;j<n;j++){\n if(a[i]>a[j]){\n a[i]=a[i]-a[j];\n i=-1;\n break;\n }\n }\n }\n for(i=0;i<n;i++) sum=sum+a[i];\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "/*\n#include<stdio.h>\nint* sortandsub(int *a, int n){\n int i, j;\n for(i = 0; i < n; i++){\n for(j = i+1; j < n; j++){\n if(a[i] > a[j]){\n a[i] = a[i] - a[j];\n }\n else if(a[j] > a[i]){\n a[j] -= a[i];\n }\n }\n }\n return a;\n}\nint main(){\n int n;\n scanf(\"%d\", &n);\n int a[n], i, j;\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n; i++){\n for(j = 0; j < n; j++){\n if(a[i] != a[j]){\n sortandsub(a, n);\n }\n }\n }\n printf(\"%d\", n * a[0]);\n return 0;\n}\n*/\n#include <stdio.h>\n \nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n \nint main() {\n\tint n, n_, g = 0;\n \n\tscanf(\"%d\", &n);\n\tn_ = n;\n\twhile (n--) {\n\t\tint x;\n \n\t\tscanf(\"%d\", &x);\n\t\tg = gcd(x, g);\n\t}\n\tprintf(\"%d\\n\", g * n_);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint hcf(int a,int b)\n {\n if((b%a)==0)\n return a;\n else\n return hcf(b%a,a);\n\n }\nint main()\n{\n int a,cnt=0,j,c,d,dum,arr[109]={0},n,i,k,b,ans1,ans2;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0,j=n-1;i<=n-2,j>=1;i++,j--)\n {\n a=arr[i];b=arr[i+1];\n if(a>b)\n {\n k=b;b=a;a=k;\n }\n ans1=hcf(a,b);\n\n arr[i]=ans1;arr[i+1]=ans1;\n c=arr[j];d=arr[j-1];\n\n if(c>d)\n {\n dum=d;d=c;c=dum;\n }\n ans2=hcf(c,d);\n arr[j]=ans2;arr[j-1]=ans2;\n }\n for(i=0;i<n;i++)\n {\n cnt+=arr[i];\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n \n// A function to implement bubble sort\nvoid bubbleSort(int arr[], int n)\n{\n int i, j;\n for (i = 0; i < n-1; i++) \n \n // Last i elements are already in place \n for (j = 0; j < n-i-1; j++) \n if (arr[j] > arr[j+1])\n swap(&arr[j], &arr[j+1]);\n}\n\nint main()\n{\n int n;\n\tscanf(\"%d\",&n);\n\t\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n \t\tscanf(\"%d\",&a[i]);\n \t\n\t}\n\tbubbleSort(a,n);\n\n\twhile(1)\n\t{\n\t\tif(a[0]==a[n-1])\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tfor(int i=1;i<n;i++)\n\t\t\t{\n\t\t\t\tif(a[i]==a[0])\n\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\ta[i]-=a[0];\n\t\t\t}\n\t\tbubbleSort(a,n);\t\n\t}\n\tprintf(\"%d\",a[n-1]*n);\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int , int);\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint n,x,i,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&y);\n\t\tx=gcd(x,y);\n\t}\n\tprintf(\"%d\",x*n);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compareInt(const void *pa, const void *pb)\n{\n const int *p1 = pa;\n const int *p2 = pb;\n return *p1 - *p2;\n}\n\nint main()\n{\n int n, sum, i, j;\n scanf(\"%d\", &n);\n int arr[n];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n\n qsort(arr, n, sizeof(int), compareInt);\n for(i=0; i<n; i++)\n {\n for(j=i+1; j<n; j++)\n {\n if(arr[j]>arr[i])\n {\n arr[j] = arr[j] - arr[i];\n i--;\n break;\n }\n }\n qsort(arr, n, sizeof(int), compareInt);\n\n if(arr[0]==arr[n-1])break;\n }\n\n printf(\"%d\", arr[0]*n);\n}"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if(b==0)\n return a;\n return gcd(b,a%b);\n}\n\nint main(void) {\n int n, x[101], i, hcf;\n \n scanf(\"%d\",&n);\n \n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&x[i]);\n }\n \n hcf=gcd(x[0],x[1]);\n for(i=2; i<n; i++)\n hcf=gcd(hcf,x[i]);\n \n printf(\"%d\",hcf*n);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\nint cmp(const void*a,const void*b)\n{\n return *(int*)a - *(int*)b;\n}\nint GCD(int a,int b)\n{\n\tint x,y,r;\n\tx=MAX(a,b);\n\ty=MIN(a,b);\n\twhile(y)\n\t{\n\t\tr=x%y;\n\t\tx=y;\n\t\ty=r;\n\t}\n\treturn x;\n}\nint main(void)\n{\n int n,i,j,a;\n int t[101];\n while(scanf(\"%d\",&n)!=EOF)\n\t{\n for(i=0;i<n;i++)\n scanf(\"%d\",&t[i]);\n qsort(t,n,sizeof(int),cmp);\n a=GCD(t[0],t[1]);\n for(i=1;i<n;i++)\n {\n \ta=GCD(a,t[i]);\n }\n printf(\"%d\\n\",a*n);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a,int b)\n{\n if(a%b==0)\n return b;\n \n return gcd(b,a%b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int hcf;\n scanf(\"%d\",&hcf);\n for(int i=1;i<n;i++)\n {\n int a;\n scanf(\"%d\",&a);\n if(hcf>a)\n hcf = gcd(hcf,a);\n else\n hcf = gcd(a,hcf);\n \n \n \n }\n printf(\"%d\\n\",n*hcf);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\ntypedef long long ll;\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int ar[10000],i=0,j=0,min=101;\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ar[i]);\n if(ar[i]<min)\n min = ar[i];\n } \n int count = 0;\n for(i=min;i>=2;i--)\n {\n count = 0;\n for(j=0;j<n;j++)\n {\n if(ar[j]%i==0)\n count++;\n }\n if(count==n)\n break;\n }\n printf(\"%d\\n\",i*n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\t//printf(\"here3\");\n\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\treturn gcd(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\treturn gcd(a,b%a);\n\t}\n}\nint main()\n{\n\t//printf(\"%d\",gcd(1,2));\n\tint n,m,a,b,g;\n\tscanf(\"%d\",&n);\n\tm=n-1;\n\tscanf(\"%d\",&a);\n\tg=a;\n\t//printf(\"here1\");\n\twhile(m--)\n\t{\n\t\t//printf(\"here2\");\n\t\tscanf(\"%d\",&b);\n\t\tg=gcd(g,b);\n\t}\n\tprintf(\"%d\",n*g);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x[105];\n scanf(\"%d\",&n);\n int i;\n for(i=0;i<n;++i)\n scanf(\"%d\",&x[i]);\n int ans,j;\n for(i=1;i<=100;++i)\n {\n int ct=0;\n for(j=0;j<n;++j)\n {\n if(x[j]%i!=0)\n ct=1;\n }\n if(ct==0)\n ans=i;\n }\n printf(\"%d\",ans*n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint comp(const void * a,const void *b);\nint main(){\n int n;\n scanf(\"%d\",&n);\n int i,j,ans=0;\n int num[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&num[i]);\n qsort((void*)num,n,sizeof(int),comp);\n int flag=0;\n while(1){\n flag=0;\n for(j=n-2;j>=0;j--){\n if(num[n-1]>num[j]){\n num[n-1]=num[n-1]-num[j];\n flag=1;\n }\n }\n if(flag==0)\n break;\n qsort((void*)num,n,sizeof(int),comp);\n }\n printf(\"%d\\n\",num[n-1]*n);\n return 0;\n}\n\nint comp(const void * a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint gcd(int a, int b)\n{\n if (a == 0)\n return b;\n return gcd(b%a, a);\n}\nint findGCD(int arr[], int n)\n{\n int result = arr[0];\n int i;\n for (i=1; i<n; i++)\n result = gcd(arr[i], result);\n\n return result;\n}\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n int sum = n * findGCD(a,n);\n printf(\"%d\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint g(int i,int j)\n{\n int k;\n while(1)\n {\n if(i==0)\n break;\n k=j%i;\n j=i;\n i=k;\n\n }\n return (j);\n}\nint main()\n{\n int n,i,a[105];\n int c=0;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n c++;\n }\n int x=g(a[0],a[1]);\n for(i=2; i<n; i++)\n {\n x=g(x,a[i]);\n }\n c=c*x;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i,j,arr[200],k;\n\tint sum=0;\n\tint maxm=0;\n\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tscanf(\"%d\", &arr[i]);\n\t\t\tif(arr[i]>maxm)\n\t\t\t\tmaxm=arr[i];\n\t\t}\n\tfor(k=0;k<maxm;k++)\n\t{\n\tfor(i=0;i<n;i++)\n\t{\n\t\tint max=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{ \n\n\t\t\tif(arr[i]>arr[j] && arr[j]>max)\n\t\t{\n\t\t\t//printf(\"%d \", j);\n\t\t\tmax=arr[j];\n\t\t\t//(\"%d\\n\",max);\n\t\t}\t\n\t\t}\n\tarr[i]-=max;\n\t//printf(\"%d\\n\", arr[i]);\n\t\n}\n}\nfor(i=0;i<n;i++)\nsum+=arr[i];\nprintf(\"%d\", sum);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint gongyue(int nn,int m)\n{\n if(m==0){return nn;}\n return gongyue(m,nn%m);\n}\nint main(){\n int a[105], n, i;\n scanf(\"%d\",&n);\n for(i = 0; i < n; i++){scanf(\"%d\",&a[i]);}\n for(i = 0; i < n; i++){\n a[i + 1]=gongyue(a[i], a[i+1]);\n }\n printf(\"%d\\n\", a[n-1] * n);\n return 0;\n}\n\n "}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\tif(b==0) return a;\n\telse return gcd(b,a%b);\n}\nint main()\n{\n\tint a[103],n,i,ans;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&a[0]);\n\tans=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tans=gcd(ans,a[i]);\n\t}\n\tprintf(\"%d\\n\",ans*n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint gcd(int a,int b){\n\tif (a==0){\n\t\treturn b;\n\t}\t\n\telse{\n\t\treturn gcd(b%a,a);\n\t}\n}\nint main()\n{\n\tint n,i,j,f,t,r;\n\t\n\tscanf(\"%d\",&n);\n\tint ara[100];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=n-1;i>=0;i--){\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (ara[j]>ara[j+1]){\n\t\t\t\tt=ara[j];\n\t\t\t\tara[j]=ara[j+1];\n\t\t\t\tara[j+1]=t;\n\t\t\t}\n\t\t}\n\t}\n\tr=ara[0];\n\tfor (i=1;i<n;i++){\n\t\tif (ara[i]%r!=0){\n\t\t\tr=gcd(ara[i],r);\n\t\t}\n\t}\n\tprintf(\"%d\",r*n);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nint comp(const void*a,const void*b){\n return *(int*)a - *(int*)b;\n}\n\nint gcd(int a,int b){\n int t;\n while(t=a%b){\n a = b;\n b = t;\n }\n return b;\n}\n\nint main(){\n int n,i,j,a;\n int t[105];\n while(scanf(\"%d\",&n)!=EOF){\n for(i=0;i<n;i++){\n scanf(\"%d\",&t[i]);\n }\n for(i=1,a=t[0];i<n;i++){\n a = gcd(a,t[i]);\n }\n printf(\"%d\\n\",a*n);\n }\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint gcd(int a,int b){\n\tif (a==0){\n\t\treturn b;\n\t}\t\n\telse{\n\t\treturn gcd(b%a,a);\n\t}\n}\nint main()\n{\n\tint n,i,j,f,t,r;\n\t\n\tscanf(\"%d\",&n);\n\tint ara[100];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=n-1;i>=0;i--){\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (ara[j]>ara[j+1]){\n\t\t\t\tt=ara[j];\n\t\t\t\tara[j]=ara[j+1];\n\t\t\t\tara[j+1]=t;\n\t\t\t}\n\t\t}\n\t}\n\tr=ara[0];\n\tfor (i=1;i<n;i++){\n\t\tif (ara[i]%r!=0){\n\t\t\tr=gcd(ara[i],r);\n\t\t}\n\t}\n\tprintf(\"%d\",r*n);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint hcf(int a,int b)\n {\n if((b%a)==0)\n return a;\n else\n return hcf(b%a,a);\n\n }\nint main()\n{\n int a,cnt=0,j,c,d,dum,arr[109]={0},n,i,k,b,ans1,ans2;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0,j=n-1;i<=n-2,j>=1;i++,j--)\n {\n a=arr[i];b=arr[i+1];\n if(a>b)\n {\n k=b;b=a;a=k;\n }\n ans1=hcf(a,b);\n\n arr[i]=ans1;arr[i+1]=ans1;\n c=arr[j];d=arr[j-1];\n\n if(c>d)\n {\n dum=d;d=c;c=dum;\n }\n ans2=hcf(c,d);\n arr[j]=ans2;arr[j-1]=ans2;\n }\n for(i=0;i<n;i++)\n {\n cnt+=arr[i];\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,j,sum,p,a[200],k;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n for(i=0;i<n-1;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]<a[j])\n {\n p=a[j];\n a[j]=a[i];\n a[i]=p;\n }\n }\n }\n for(k=0;k<n;k++)\n {\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(a[i]>a[j])\n {\n a[i]=a[i]-a[j];\n j=-1;\n }\n \n }\n \n }\n }\n sum=0;\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint an[101];\n\nint solve(int n)\n{\n int min = 101;\n for (int i = 0; i < n; i++) {\n if (an[i] < min) {\n min = an[i];\n }\n }\n\n while (1) {\n int m = min;\n for (int i = 0; i < n; i++) {\n while (an[i] > min) {\n an[i] -= min;\n if (an[i] < m) {\n m = an[i];\n }\n }\n }\n if (m == min) {\n break;\n }\n min = m;\n }\n\n return n*an[0];\n}\n\nint main()\n{\n int n = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &an[i]);\n }\n printf(\"%d\\n\", solve(n));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nvoid sort(int *arr,int k)\n{\n int i,j,temp;\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n {\n if(*(arr+i)<*(arr+j))\n {\n temp=*(arr+i);\n *(arr+i)=*(arr+j);\n *(arr+j)=temp;\n }\n }\n }\n}\nvoid res(int *arr,int k)\n{\n int i,j,sum;\n for(i=sum=0,j=i+1;j<k;i++,j++) if(*(arr+i)>*(arr+j)) *(arr+i)=*(arr+i)-*(arr+j);\n}\nint main(void)\n{\n int n,*x,i,sum;\n scanf(\"%d\",&n);\n x=(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++) scanf(\"%d\",(x+i));\n sort(x,n);\n for(i=0;i<n;)\n {\n if(*(x+i)==*(x+i+1))\n {\n i++;\n if(i==n-1) break;\n }\n else\n {\n res(x,n);\n sort(x,n);\n i=0;\n }\n }\n for (i=sum=0;i<n;i++) sum+=*(x+i);\n printf(\"%d\",sum);\n free(x);\n x=NULL;\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,k,sum=0,ind;\n scanf(\"%d\", &n);\n int li[n];\n for (i=0; i<n; i++){\n scanf(\"%d\", &li[i]);\n }\n while(1){\n for (i=0; i<n; i++){\n for (j=0; j<n; j++){\n if (li[i]>li[j]) li[i] = li[i] - li[j];\n }\n }\n ind = 1;\n for (j=1; j<n; j++){\n if (li[0]!=li[j]) {ind = 0; break;}\n }\n if (ind) break;\n }\n sum = n*li[0];\n printf(\"%d\", sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint gcd(int a,int b){\n\tif (a==0){\n\t\treturn b;\n\t}\t\n\telse{\n\t\treturn gcd(b%a,a);\n\t}\n}\nint main()\n{\n\tint n,i,j,f,t,r;\n\t\n\tscanf(\"%d\",&n);\n\tint ara[100];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tfor (i=n-1;i>=0;i--){\n\t\tfor (j=0;j<i;j++){\n\t\t\tif (ara[j]>ara[j+1]){\n\t\t\t\tt=ara[j];\n\t\t\t\tara[j]=ara[j+1];\n\t\t\t\tara[j+1]=t;\n\t\t\t}\n\t\t}\n\t}\n\tr=ara[0];\n\tfor (i=1;i<n;i++){\n\t\tif (ara[i]%r!=0){\n\t\t\tr=gcd(ara[i],r);\n\t\t}\n\t}\n\tprintf(\"%d\",r*n);\n\treturn 0;\n}\n"}, {"source_code": "/*\n#include<stdio.h>\nint* sortandsub(int *a, int n){\n int i, j;\n for(i = 0; i < n; i++){\n for(j = i+1; j < n; j++){\n if(a[i] > a[j]){\n a[i] = a[i] - a[j];\n }\n else if(a[j] > a[i]){\n a[j] -= a[i];\n }\n }\n }\n return a;\n}\nint main(){\n int n;\n scanf(\"%d\", &n);\n int a[n], i, j;\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n; i++){\n for(j = 0; j < n; j++){\n if(a[i] != a[j]){\n sortandsub(a, n);\n }\n }\n }\n printf(\"%d\", n * a[0]);\n return 0;\n}\n*/\n#include <stdio.h>\n \nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n \nint main() {\n\tint n, n_, g = 0;\n \n\tscanf(\"%d\", &n);\n\tn_ = n;\n\twhile (n--) {\n\t\tint x;\n \n\t\tscanf(\"%d\", &x);\n\t\tg = gcd(x, g);\n\t}\n\tprintf(\"%d\\n\", g * n_);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint min (int ar[],int n)\n{\n int i,p=19000;\n for (i=0;i<n;i++)\n {\n if (ar[i]<=p)\n {\n p=ar[i];\n }\n }\n return p;\n}\nint gcd(int ar[],int p,int n)\n{\n int i=0,f=1;\n while (i<n)\n {\n if (ar[i]%p==0)\n {\n f=1;\n i++;\n }\n else if (ar[i]%p!=0)\n {\n f=0;\n p-=1;\n i=0;\n }\n }\n return p;\n\n\n}\nint main()\n{\n int n,ar[1000],i,s,w,x;\n scanf (\"%d\",&n);\n for (i=0;i<n;i++)\n {\n scanf (\"%d\",&ar[i]);\n }\n w=min(ar,n);\n x=gcd(ar,w,n);\n s=x*n;\n\n printf (\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint gongyue(int nn,int m)\n{\n if(m==0){return nn;}\n return gongyue(m,nn%m);\n}\nint main(){\n int a[105], n, i;\n scanf(\"%d\",&n);\n for(i = 0; i < n; i++){scanf(\"%d\",&a[i]);}\n for(i = 0; i < n; i++){\n a[i + 1]=gongyue(a[i], a[i+1]);\n }\n printf(\"%d\\n\", a[n-1] * n);\n return 0;\n}\n\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return (*(int *)a) - (*(int *)b);\n}\nint main(void)\n{\n int x[10000];\n int n;\n int i,sum = 0;\n scanf(\"%d\",&n);\n for(i = 0 ; i < n ; i ++)\n scanf(\"%d\",&x[i]);\n qsort(x,n,sizeof(int),cmp);\n while(x[0] != x[n-1])\n {\n for(i = n - 1 ; i > 0 ; i --)\n {\n if(x[i] % x[i-1] == 0)\n x[i] = x[i-1];\n else\n x[i] %= x[i-1];\n }\n qsort(x,n,sizeof(int),cmp);\n }\n for(i = 0 ; i < n ; i ++)\n sum += x[i];\n printf(\"%d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{ \n int i;\n if(a>b)\n {\n for(i=b;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n }\n else\n for(i=a;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n}\nint main()\n{\n int a,b,n,g,s=101,i;\n scanf(\"%d%d\",&n,&a);\n \n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&b);\n g=gcd(a,b);\n if(g<s)\n s=g;\n a=g;\n }\n printf(\"%d\",s*n);\n \n}"}, {"source_code": "#include<stdio.h>\nint gcd(int , int);\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint n,x,i,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&y);\n\t\tx=gcd(x,y);\n\t}\n\tprintf(\"%d\",x*n);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint an[101];\n\nint solve(int n)\n{\n int min = 101;\n for (int i = 0; i < n; i++) {\n if (an[i] < min) {\n min = an[i];\n }\n }\n\n while (1) {\n int m = min;\n for (int i = 0; i < n; i++) {\n while (an[i] > min) {\n an[i] -= min;\n if (an[i] < m) {\n m = an[i];\n }\n }\n }\n if (m == min) {\n break;\n }\n min = m;\n }\n\n return n*an[0];\n}\n\nint main()\n{\n int n = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &an[i]);\n }\n printf(\"%d\\n\", solve(n));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint hcf(int,int);\nint main()\n{ int i,j,k,n;\n scanf(\"%d\",&n);\n int *a =(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++)\n {scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n { k=hcf(a[i],a[i+1]);\n a[i+1]=k;\n }\n printf(\"%d\",k*n);\n free(a);\n return 0;\n }\n int hcf(int p,int q)\n { if(p>q)\n { if(p%q==0)\n return q;\n else\n return(hcf(q,p%q));\n }\n else\n {if(q%p==0)\n return p;\n else\n return(hcf(p,q%p));\n }\n }\n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint gcd(int a, int b)\n{\n\tif(b == 0)\n\t return a;\n\telse\n\t\treturn gcd(b,a%b);\t\n}\n\nint main()\n{\n\tint n,i,min=100,max=0;\n\tscanf(\"%d\",&n);\n\tint x[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&x[i]);\n\t\tmax = max>x[i]?max:x[i];\n\t\tmin = min<x[i]?min:x[i];\n\t}\n\tint mingc = min;\n\tint j;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(j != i)\n\t\t\t\tmingc = mingc<gcd(x[i],x[j]) ? mingc:gcd(x[i],x[j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(x[i]%mingc != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",n*mingc);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint min(int a, int b)\n{\nif(a>b) return b;\nelse if(b>a) return a;\nelse if(b==a) return a;\n\n}\nint main()\n{\n int a[110] , c;\n int i, k, j;\n scanf(\"%d\",&k);\n for(i=0;i<k;i++)\n scanf(\"%d\",&a[i]);\n c=100;\n int d=0;\n while(d==0)\n {\n for(i=0;i<k;i++)\n {\n for(j=0;j<k;j++)\n {\n if(a[i]>a[j]) a[i]=a[i]-a[j];\n else if(a[j]>a[i]) a[j]=a[j]-a[i];\n c=min(a[i],a[j]);\n }\n }\n for(i=0;i<k;i++)\n {\n if(a[i]%c!=0) break;\n }\n if(i==k) d=1;\n else d=0;\n }\n\n\n\n printf(\"%d\\n\",c*k);\n return 0;\n\n}\n\n "}, {"source_code": "#include<stdio.h>\nint GCD(int x,int y);\nint IsArrayEqual(int array[],int n);\nint main(){\n\tint m,n,i=0,j;\n\tint array[100];\n\tscanf(\"%d\",&n);\n\tm=n;\n do{\n scanf(\"%d\",&array[i++]);\n }while(getchar()!='\\n');\n while(!IsArrayEqual(array,m)){\n \tint temp=array[0];\n \tfor(j=0;j<m-1;j++){\n\t \tarray[j]=GCD(temp,array[j+1]);\n\t }\n\t m--;\n\t \n }\n printf(\"%d\",n*array[0]);\n return 0;\n}\nint GCD(int x,int y){\n\tint temp;\n\tif(x>y){\n\t\tx=x%y;\n\t\tif(x==0) return y;\n\t\tif(x==1) return (1);\n\t\telse return (GCD(x,y));\n\t}\n\telse if(x<y){\n\t\ty=y%x;\n\t\tif(y==0) return (x);\n\t\telse if(y==1) return (1);\n\t\telse return (GCD(x,y));\n\t}\n\telse return x;\n}\nint IsArrayEqual(int array[],int n){\n\tif(n==0){\n\t\treturn (1);\n\t}\n\telse if(array[0]==array[n-1]){\n\t\tIsArrayEqual(array,n-1);\t\n\t}\n\telse return (0);\n}\n\n "}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint n, n_, g;\n\n\tscanf(\"%d\", &n);\n\tn_ = n;\n\twhile (n--) {\n\t\tint x;\n\n\t\tscanf(\"%d\", &x);\n\t\tg = gcd(x, g);\n\t}\n\tprintf(\"%d\\n\", g * n_);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint gcd(int a, int b)\n{\n\tif(b == 0)\n\t return a;\n\telse\n\t\treturn gcd(b,a%b);\t\n}\n\nint main()\n{\n\tint n,i,min=100,max=0;\n\tscanf(\"%d\",&n);\n\tint x[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&x[i]);\n\t\tmax = max>x[i]?max:x[i];\n\t\tmin = min<x[i]?min:x[i];\n\t}\n\tint mingc = min;\n\tint j;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(j != i)\n\t\t\t\tmingc = mingc<gcd(x[i],x[j]) ? mingc:gcd(x[i],x[j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(x[i]%mingc != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",n*mingc);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return(*(int *)a)<(*(int *)b)?1:-1;\n}\nint main()\n{\n //freopen(\"in.txt\",\"r\",stdin);\n int n,i,j;\n int p[105];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&p[i]);\n qsort(p,n,sizeof(int),cmp);\n while(p[0]!=p[n-1])\n {\n for(i=0,j=0;j<n;)\n {\n if(p[i]>p[j])\n {\n p[i]=p[i]-p[j];\n i++;\n }\n else\n j++;\n }\n qsort(p,n,sizeof(int),cmp);\n }\n printf(\"%d\\n\",n*p[0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{ \n int i;\n if(a>b)\n {\n for(i=b;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n }\n else\n for(i=a;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n}\nint main()\n{\n int a,b,n,g,s=101,i;\n scanf(\"%d%d\",&n,&a);\n \n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&b);\n g=gcd(a,b);\n if(g<s)\n s=g;\n a=g;\n }\n printf(\"%d\",s*n);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int n,min;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n for(int i=0; i<n-1; i++)\n {\n for(int j=i+1; j<n; j++)\n {int diff=a[i]-a[j];\n if(diff>0)\n {\n a[i]=diff;j--;\n }\n else if(diff<0)\n {a[j]=-diff;j--;}\n\n }\n }int s=0;\n for(int i=0; i<n; i++)\n {\n s+=a[i];\n }\n printf(\"%d\",s);\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint hcf(int a,int b)\n\n\n {\n\n\n if(a%b==0)\n\n\n {\n\n\n return b;\n\n\n }\n\n\n else\n\n\n {\n\n\n return(hcf(b,a%b));\n\n\n }\n\n\n } \n\n\nint main()\n\n\n{\n\n\n int i,j,h,n,a[100];\n\n scanf(\"%d\",& n);\n\n\n for(i=0;i<n;i++)\n\n\n {\n\n\n\n scanf(\"%d\",& a[i]);\n\n\n }\n\n\n for(i=0;i<n-1;i++)\n\n\n {\n\n\n h=hcf(a[i],a[i+1]);\n\n\n a[i+1]=h;\n\n\n }\n\n\n printf(\"%d\\n\",h * n);\n\n\treturn 0;\n }\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n, l,k,i, j, x[100];\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &x[0]);\n\tint a=x[0];\n\tfor(i=1; i<n; i++)\n\t{\t\n\t\tscanf(\"%d\", &x[i]);\n\t\tif(x[i]<a)\n\t\ta=x[i];\n\t}\n\tfor(i=1; i<=a; i++)\n\t{\n\t\tl=0;\n\t\tfor(j=0; j<n; j++)\n\t\t{\n\t\t\tif(x[j]%i==0)\n\t\t\tl++;\n\t\t}\n\t\tif(l==n)\n\t\tk=i;\n\t}\n\tprintf(\"%d\", k*n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\tif(b==0)\n\treturn a;\n\telse\n\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint arr[100],sum,i,n;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n sum=gcd(arr[0],arr[1]);\n for(i=2;i<n;i++)\n {\n \tsum=gcd(arr[i],sum);\n }\n printf(\"%d\",sum*n);\n return 0;\n}\n"}, {"source_code": "/*\n#include<stdio.h>\nint* sortandsub(int *a, int n){\n int i, j;\n for(i = 0; i < n; i++){\n for(j = i+1; j < n; j++){\n if(a[i] > a[j]){\n a[i] = a[i] - a[j];\n }\n else if(a[j] > a[i]){\n a[j] -= a[i];\n }\n }\n }\n return a;\n}\nint main(){\n int n;\n scanf(\"%d\", &n);\n int a[n], i, j;\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n; i++){\n for(j = 0; j < n; j++){\n if(a[i] != a[j]){\n sortandsub(a, n);\n }\n }\n }\n printf(\"%d\", n * a[0]);\n return 0;\n}\n*/\n#include <stdio.h>\n \nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n \nint main() {\n\tint n, n_, g = 0;\n \n\tscanf(\"%d\", &n);\n\tn_ = n;\n\twhile (n--) {\n\t\tint x;\n \n\t\tscanf(\"%d\", &x);\n\t\tg = gcd(x, g);\n\t}\n\tprintf(\"%d\\n\", g * n_);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint main(){\nint n;\nscanf(\"%d\",&n);\nint a[n],i,j;\nfor(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n}\nint min=a[0];\nfor(i=0;i<n;i++){\n if(min>a[i]){\n min=a[i];\n }\n}\nint hcf=1,z;\nfor(i=2;i<=min;i++){\n z=0;\n for(j=0;j<n;j++){\n if(a[j]%i==0){z++;}\n }\n if(z==n){hcf=i;}\n}\nprintf(\"%d\",hcf*n);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n \n// A function to implement bubble sort\nvoid bubbleSort(int arr[], int n)\n{\n int i, j;\n for (i = 0; i < n-1; i++) \n \n // Last i elements are already in place \n for (j = 0; j < n-i-1; j++) \n if (arr[j] > arr[j+1])\n swap(&arr[j], &arr[j+1]);\n}\n\nint main()\n{\n int n;\n\tscanf(\"%d\",&n);\n\t\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n \t\tscanf(\"%d\",&a[i]);\n \t\n\t}\n\tbubbleSort(a,n);\n\n\twhile(1)\n\t{\n\t\tif(a[0]==a[n-1])\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tfor(int i=1;i<n;i++)\n\t\t\t{\n\t\t\t\tif(a[i]==a[0])\n\t\t\t\tcontinue;\n\t\t\t\telse\n\t\t\t\ta[i]-=a[0];\n\t\t\t}\n\t\tbubbleSort(a,n);\t\n\t}\n\tprintf(\"%d\",a[n-1]*n);\n}"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return *(int*)a-*(int*)b;\n}\nint main(void) {\n int n,i,sum,x;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n sum=arr[0];\n if(n!=1)\n {\n sum=0;\n qsort(arr,n,sizeof(int),cmp);\n while(1)\n {\n x=n-2;\n while(x>=0)\n {\n if(arr[x]<arr[n-1])\n break;\n x--;\n }\n if(x<0||arr[x]==0)\n break;\n arr[n-1]=arr[n-1]-arr[x];\n qsort(arr,n,sizeof(int),cmp);\n }\n for(i=0;i<n;i++)\n sum=sum+arr[i];\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{ \n int i;\n if(a>b)\n {\n for(i=b;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n }\n else\n for(i=a;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n}\nint main()\n{\n int a,b,n,g,s=101,i;\n scanf(\"%d%d\",&n,&a);\n \n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&b);\n g=gcd(a,b);\n if(g<s)\n s=g;\n a=g;\n }\n printf(\"%d\",s*n);\n \n}"}, {"source_code": "#include<stdio.h>\n\n\n\nint max(int x[],int n){\n int max,i,maxi;\n int max1;\nint max2;\n max2=-1;\n max=0;\n for(i=0;i<n;i++){\n if(x[i]>max){\n max=x[i];\n max1=i;\n }\n }\n maxi=max;\n max=0;\n for(i=0;i<n;i++){\n if(x[i]>max&&x[i]<maxi){\n max=x[i];\n max2=i;\n }\n }\n x[max1]-=x[max2];\n return max2;\n}\nint main()\n{\n\tint n;\n\tint max2;\n int i;\n int x[100];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&x[i]);\n }\n i=1;\n \n while(i==1){\n max2=max(x,n);\n if(max2==-1){\n printf(\"%d\",(x[1]*n));\n return 0;\n }\n }\n \n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m,a[100],i,tr=1,min;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)scanf(\"%d\",&a[i]);\nwhile(tr){\ntr=0;\nmin=a[0];\nfor(i=1;i<n;i++)if(min>a[i])min=a[i];\nfor(i=0;i<n;i++)if(a[i]>min){\ntr=1;\na[i]-=min;\n}\n}\nm=0;\n\nfor(i=0;i<n;i++)m+=a[i];\nprintf(\"%d\",m);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,i,j,k,m,d;\n\n scanf(\"%d\",&a);\n\n int A[a];\n\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n\n for(i=0;i<a;i++)\n {\n d=1;\n for(j=i+1;j<a;j++)\n {\n k=A[i];\n m=A[j];\n do\n {\n d=k%m;\n k=m;\n m=d;\n }while(d!=0);\n\n A[i]=k;\n A[j]=k;\n }\n }\n d=0;\n for(i=0;i<a;i++)\n {\n d+=A[i];\n }\n\n printf(\"%d\\n\",d);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,i,r,min;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n min = arr[0];\n for(i=1; i<n; i++)\n {\n if(min>arr[i])\n {\n min = arr[i];\n }\n }\n int max=1,k=1,count;\n for(k=2; k<=min; k++)\n {\n for(i=0; i<n; i++)\n {\n count=1;\n\n if(arr[i]%k!=0)\n {\n count = 0;\n break;\n }\n }\n if(count==1)\n {\n\n\n max = k;\n\n }\n }\n\n printf(\"%d\\n\",max*n);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint GCD(int x,int y);\nint IsArrayEqual(int array[],int n);\nint main(){\n\tint m,n,i=0,j;\n\tint array[100];\n\tscanf(\"%d\",&n);\n\tm=n;\n do{\n scanf(\"%d\",&array[i++]);\n }while(getchar()!='\\n');\n while(!IsArrayEqual(array,m)){\n \tint temp=array[0];\n \tfor(j=0;j<m-1;j++){\n\t \tarray[j]=GCD(temp,array[j+1]);\n\t }\n\t m--;\n\t \n }\n printf(\"%d\",n*array[0]);\n return 0;\n}\nint GCD(int x,int y){\n\tint temp;\n\tif(x>y){\n\t\tx=x%y;\n\t\tif(x==0) return y;\n\t\tif(x==1) return (1);\n\t\telse return (GCD(x,y));\n\t}\n\telse if(x<y){\n\t\ty=y%x;\n\t\tif(y==0) return (x);\n\t\telse if(y==1) return (1);\n\t\telse return (GCD(x,y));\n\t}\n\telse return x;\n}\nint IsArrayEqual(int array[],int n){\n\tif(n==0){\n\t\treturn (1);\n\t}\n\telse if(array[0]==array[n-1]){\n\t\tIsArrayEqual(array,n-1);\t\n\t}\n\telse return (0);\n}\n\n "}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n if(a%b!=0) return gcd(b,a%b);\n else return b;\n}\nint main()\n{\n int a,b,c,d,n,k,i,ss[110],sum;\n while(scanf(\"%d\",&n)!=EOF)\n {\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&k);\n ss[i]=k;\n }\n if(n==1) {printf(\"%d\\n\",ss[0]);continue;}\n else\n {\n for(i=0,sum=ss[0];i<n-1;i++)\n {\n sum=gcd(sum,ss[i+1]);\n }\n printf(\"%d\\n\",sum*n);\n }\n }\n}\n\n\n "}, {"source_code": "#include <stdio.h>\nint n, arr[1100], m;\nint gcd(int a, int b);\n\nint main()\n\n{\n scanf(\"%d\", &n);\n\n for (int i = 1; i <= n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n if (n == 1)\n {\n printf(\"%d\", arr[1]);\n return 0;\n }\n\n int m = arr[1];\n\n for (int i = 2; i <= n; i++)\n {\n m = gcd(m, arr[i]);\n }\n\n printf(\"%d\\n\", m * n);\n\n return 0;\n\n}\n\nint gcd(int a, int b)\n{\n if (b == 0)\n return a;\n else\n return gcd(b, a % b);\n}"}, {"source_code": "/*\n#include<stdio.h>\nint* sortandsub(int *a, int n){\n int i, j;\n for(i = 0; i < n; i++){\n for(j = i+1; j < n; j++){\n if(a[i] > a[j]){\n a[i] = a[i] - a[j];\n }\n else if(a[j] > a[i]){\n a[j] -= a[i];\n }\n }\n }\n return a;\n}\nint main(){\n int n;\n scanf(\"%d\", &n);\n int a[n], i, j;\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < n; i++){\n for(j = 0; j < n; j++){\n if(a[i] != a[j]){\n sortandsub(a, n);\n }\n }\n }\n printf(\"%d\", n * a[0]);\n return 0;\n}\n*/\n#include <stdio.h>\n \nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n \nint main() {\n\tint n, n_, g = 0;\n \n\tscanf(\"%d\", &n);\n\tn_ = n;\n\twhile (n--) {\n\t\tint x;\n \n\t\tscanf(\"%d\", &x);\n\t\tg = gcd(x, g);\n\t}\n\tprintf(\"%d\\n\", g * n_);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint gongyue(int nn,int m)\n{\n if(m==0){return nn;}\n return gongyue(m,nn%m);\n}\nint main(){\n int a[105], n, i;\n scanf(\"%d\",&n);\n for(i = 0; i < n; i++){scanf(\"%d\",&a[i]);}\n for(i = 0; i < n; i++){\n a[i + 1]=gongyue(a[i], a[i+1]);\n }\n printf(\"%d\\n\", a[n-1] * n);\n return 0;\n}\n\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,min=100,i,j,A[100],temp;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n if(A[i]<min)\n min=A[i];\n }\n for(i=min;i>0;i--)\n {\n for(j=0;j<n;j++)\n {\n if(A[j]%i)\n break;\n }\n if(j==n)\n break;\n }\n printf(\"%d\",i*n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint g(int i,int j)\n{\n int k;\n while(1)\n {\n if(i==0)\n break;\n k=j%i;\n j=i;\n i=k;\n\n }\n return (j);\n}\nint main()\n{\n int n,i,a[105];\n int c=0;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n c++;\n }\n int x=g(a[0],a[1]);\n for(i=2; i<n; i++)\n {\n x=g(x,a[i]);\n }\n c=c*x;\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{ \n int i;\n if(a>b)\n {\n for(i=b;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n }\n else\n for(i=a;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n}\nint main()\n{\n int a,b,n,g,s=101,i;\n scanf(\"%d%d\",&n,&a);\n \n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&b);\n g=gcd(a,b);\n if(g<s)\n s=g;\n a=g;\n }\n printf(\"%d\",s*n);\n \n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\tif(b==0) return a;\n\telse return gcd(b,a%b);\n}\nint main()\n{\n\tint a[103],n,i,ans;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&a[0]);\n\tans=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tans=gcd(ans,a[i]);\n\t}\n\tprintf(\"%d\\n\",ans*n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint Cmp(const void* a,const void* b)\n{\n return *(int*)a-*(int*)b;\n}\n\nint GCD(int a,int b){\n if(a==0||b==0) return 0;\n while(a&&b){\n if(a>b){\n a=a%b;\n }\n else{\n b=b%a;\n }\n }\n if(a==0) return b;\n else return a;\n}\n\nint main()\n{\n int n;\n int arr[200];\n scanf(\"%d\",&n);\n int i;\n for(i=0;i<n;i++)scanf(\"%d\",&arr[i]);\n qsort(arr,n,sizeof(int),Cmp);\n int min=GCD(arr[n-1],arr[n-2]),tmp;\n for(i=n-2;i>=1;i--){\n tmp=GCD(arr[i],arr[i-1]);\n min=GCD(tmp,min);\n }\n\n printf(\"%d\\n\",min*n);\n return 0;\n}\n"}, {"source_code": "int main()\n{\n int number,array[200],i,min=1000,z,counter=0,sum=0,y=0;\n scanf(\"%d\",&number);\n for(i=0;i<number;i++)\n {\n scanf(\"%d\",&array[i]);\n }\n for(;;)\n {\n for(i=0;i<number;i++)\n {\n\n if(array[i]<min)\n {\n min=array[i];\n }\n }\n while(y<number)\n {\n if(array[y]!=min)\n {\n array[y]=array[y]-min;\n }\n y++;\n }\n\n\n for(z=0;z<number;z++)\n {\n if(array[z]==array[z+1])\n {\n counter++;\n }\n else\n {\n break;\n }\n }\n if(counter==number-1)\n {\n break;\n }\n counter=0;\n y=0;\n }\n i=0;\n while(i<number)\n {\n sum=sum+array[i];\n i++;\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "int main()\n{\n int number,array[200],i,min=1000,z,counter=0,sum=0,y=0;\n scanf(\"%d\",&number);\n for(i=0;i<number;i++)\n {\n scanf(\"%d\",&array[i]);\n }\n for(;;)\n {\n for(i=0;i<number;i++)\n {\n\n if(array[i]<min)\n {\n min=array[i];\n }\n }\n while(y<number)\n {\n if(array[y]!=min)\n {\n array[y]=array[y]-min;\n }\n y++;\n }\n\n\n for(z=0;z<number;z++)\n {\n if(array[z]==array[z+1])\n {\n counter++;\n }\n else\n {\n break;\n }\n }\n if(counter==number-1)\n {\n break;\n }\n counter=0;\n y=0;\n }\n i=0;\n while(i<number)\n {\n sum=sum+array[i];\n i++;\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a, int b){\n if(b==0)\n return a;\n else \n return gcd(b,a%b); \n} \n\nint main(){\n\nint n=0;\n\nwhile(scanf(\"%d\",&n)!=EOF){\n \n int* x = (int*) malloc(sizeof(int)*n); \n int cgcd =1;\n \n int i=0, tmp=0;\n for (i;i<n;i++)\n scanf(\"%d\",x+i);\n \n for (i=0;i<n-1;i++){\n tmp= gcd(x[i],x[i+1]);\n \n if(i!=0 && gcd(tmp,cgcd)==1){\n cgcd=1;\n break;\n }\n\n if(i==0 || tmp<cgcd)\n cgcd=tmp;\n }\n \n printf(\"%d\\n\",n==1?x[0]:cgcd*n);\n} \n\n\nreturn 0; \n} "}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,j,sum,p,a[200],k;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n for(i=0;i<n-1;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]<a[j])\n {\n p=a[j];\n a[j]=a[i];\n a[i]=p;\n }\n }\n }\n for(k=0;k<n;k++)\n {\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(a[i]>a[j])\n {\n a[i]=a[i]-a[j];\n j=-1;\n }\n \n }\n \n }\n }\n sum=0;\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tint i, n, g;\n\tstatic int x[100];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &x[i]);\n\tg = x[0];\n\tfor (i = 1; i < n; i++)\n\t\tg = gcd(g, x[i]);\n\tprintf(\"%d\\n\", n * g);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint A(int a, int b)\n{\n\tint c;\n\n\tif (a < b) {\n\t\tc = a;\n\t\ta = b;\n\t\tb = c;\n\t}\n\twhile (b != 0)\n\t\tif (a - b > b)\n\t\t\ta = a - b;\n\t\telse {\n\t\t\tc = a - b;\n\t\t\ta = b;\n\t\t\tb = c;\n\t\t}\n\n\treturn a;\n}\n\nint main()\n{\n\tint a, b, c, d;\n\n\tscanf(\"%d%d\", &a, &b);\n\tfor (c = 1; c < a; ++c) {\n\t\tscanf(\"%d\", &d);\n\t\tb = A(b, d);\n\t}\n\tprintf(\"%d\\n\", b * a);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a, int b)\n{\n if(b == 0) return a;\n return gcd(b, a % b);\n}\nint main()\n{\n int i, n, sum = 0, arr[100];\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n sum = gcd(arr[0], arr[1]);\n for(i = 1; i < n - 1; i++)\n {\n sum = gcd(sum, arr[i + 1]);\n }\n printf(\"%d\", n * sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint main()\n{\n int i,n,k,j,c=0,min=222222222,min2=222222222,flag=1,save;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(min>a[i])min=a[i];\n }\n save=min;\n while(flag){\n flag=0;\n for(i=0;i<n;i++){\n if(a[i]%min<min2&&a[i]%min!=0){min2=a[i]%min;}\n if(a[i]%min!=0)flag=1;\n }\n min=min2;\n }\n if(min==222222222)min=save;\n printf(\"%d\",min*n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int test, k, n, i, j, x,ar[101];\n\n for(k = 0; k <= 100; k++) ar[k] = 0;\n\n scanf(\"%d\", &test);\n n = test;\n while(test--){\n scanf(\"%d\", &x);\n ar[x] = ar[x]+1;\n }\n /*for(k = 0; k <= 100; k++) printf(\"%d \", ar[k]);*/\n\n for(i = 100; i > 0; i--){\n if (ar[i] == 0) continue;\n for(j = i-1; j >0; j--){\n if(ar[j] != 0){\n ar[i-j] = ar[i-j] + 1;\n ar[i] = ar[i] - 1;\n }\n else continue;\n if (ar[i] == 0) break;\n if (ar[j] != 0) j++;\n }\n if (ar[i-j] == n) break;\n }\n printf(\"%d\", n*(i-j));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint an[101];\n\nint solve(int n)\n{\n int min = 101;\n for (int i = 0; i < n; i++) {\n if (an[i] < min) {\n min = an[i];\n }\n }\n\n while (1) {\n int m = min;\n for (int i = 0; i < n; i++) {\n while (an[i] > min) {\n an[i] -= min;\n if (an[i] < m) {\n m = an[i];\n }\n }\n }\n if (m == min) {\n break;\n }\n min = m;\n }\n\n return n*an[0];\n}\n\nint main()\n{\n int n = 0;\n scanf(\"%d\", &n);\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &an[i]);\n }\n printf(\"%d\\n\", solve(n));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,j,i,k,l=0,t,d,max,min,m;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n max=arr[0];\n min=arr[0];\n for(j=1;j<n;j++)\n {\n if(arr[j]<min)\n min=arr[j];\n if(arr[j]>max)\n max=arr[j];\n }\n d=max;\n m=min;\n while(m!=0)\n {\n t=d%m;\n d=m;\n m=t;\n \n }\n for(j=0;j<n;j++)\n {\n if(arr[j]%d==1||d%arr[j]==1)\n {\n l=1;\n break;\n }\n }\n if(l==1)\n printf(\"%d\",n);\n else\n printf(\"%d\",n*d);\n\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{ \n int i;\n if(a>b)\n {\n for(i=b;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n }\n else\n for(i=a;i>=1;i--)\n if(a%i==0&&b%i==0)\n return i;\n}\nint main()\n{\n int a,b,n,g,s=101,i;\n scanf(\"%d%d\",&n,&a);\n \n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&b);\n g=gcd(a,b);\n if(g<s)\n s=g;\n a=g;\n }\n printf(\"%d\",s*n);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k,j=0,s,min=101;\n scanf(\"%d\",&n);\n int A[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n if(A[i]<min)\n {\n min=A[i];\n }\n }\n for(k=min;k>0;k--)\n {\n for(i=0;i<n;i++)\n {\n if(A[i]%k==0)\n {\n j++;\n }\n }\n if(j==n)\n {\n break;\n }\n j=0;\n }\n printf(\"%d\\n\",k*n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,min=100,i,j,A[100],temp;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n if(A[i]<min)\n min=A[i];\n }\n for(i=min;i>0;i--)\n {\n for(j=0;j<n;j++)\n {\n if(A[j]%i)\n break;\n }\n if(j==n)\n break;\n }\n printf(\"%d\",i*n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a,int b)\n{\n if(a%b==0)\n return b;\n \n return gcd(b,a%b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int hcf;\n scanf(\"%d\",&hcf);\n for(int i=1;i<n;i++)\n {\n int a;\n scanf(\"%d\",&a);\n if(hcf>a)\n hcf = gcd(hcf,a);\n else\n hcf = gcd(a,hcf);\n \n \n \n }\n printf(\"%d\\n\",n*hcf);\n \n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\t//printf(\"here3\");\n\t\n\tif(a>b)\n\t{\n\t\tif(a%b==0)\n\t\t\treturn b;\n\t\treturn gcd(b,a%b);\n\t}\n\telse\n\t{\n\t\tif(b%a==0)\n\t\t\treturn a;\n\t\treturn gcd(a,b%a);\n\t}\n}\nint main()\n{\n\t//printf(\"%d\",gcd(1,2));\n\tint n,m,a,b,g;\n\tscanf(\"%d\",&n);\n\tm=n-1;\n\tscanf(\"%d\",&a);\n\tg=a;\n\t//printf(\"here1\");\n\twhile(m--)\n\t{\n\t\t//printf(\"here2\");\n\t\tscanf(\"%d\",&b);\n\t\tg=gcd(g,b);\n\t}\n\tprintf(\"%d\",n*g);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint a[101];\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint k;\n\t//for (k=0;k<n;k++)\n\t\tfor (i=0;i<n-1;i++){\n\t\t\tfor (j=i+1;j<n;j++){\n\t\t\t\tfor (k=0;k<n;k++){\n\t\t\t\t\twhile(a[i]>a[j]) a[i]-=a[j];\n\t\t\t\t\twhile(a[j]>a[i]) a[j]-=a[i];\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t/*if(a[i]>a[j]) {\n\t\t\t\t\ta[i]=a[i]-a[j];\n\t\t\t\t}\n\t\t\t\tif (a[i]<a[j])\n\t\t\t\t\ta[j]=a[j]-a[i];\n\t\t\t\t*/\n\t\t\t}\n\t\t}\n\tfor(i=0;i<n;i++){\n\t\tsum+=a[i];\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "\ufeff#include<stdio.h>\nint main()\n{\n\tlong long int i,n,a[10000],k,j,t,r;\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i<n;i++)\n\t{scanf(\"%lld\",&a[i]);}\n\tfor(i=1;i<n;i++)\n\t{for(j=1;j<=a[i] && j<=a[i-1];j++){\n\t\t\tif(a[i]%j==0 && a[i-1]%j==0)\n\t\t\t{t=j;}}\n\t\t\ta[i]=t;}\n\t\tr=t*n;\n\t\t\n\t\t\tprintf(\"%lld\",r);\n\t\t\treturn 0;}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,i,j,k,m,d;\n\n scanf(\"%d\",&a);\n\n int A[a];\n\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n\n for(i=0;i<a;i++)\n {\n d=1;\n for(j=i+1;j<a;j++)\n {\n k=A[i];\n m=A[j];\n do\n {\n d=k%m;\n k=m;\n m=d;\n }while(d!=0);\n\n A[i]=k;\n A[j]=k;\n }\n }\n d=0;\n for(i=0;i<a;i++)\n {\n d+=A[i];\n }\n\n printf(\"%d\\n\",d);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int , int);\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint n,x,i,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&y);\n\t\tx=gcd(x,y);\n\t}\n\tprintf(\"%d\",x*n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a,int b)\n{\n if(a%b==0)\n return b;\n \n return gcd(b,a%b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int hcf;\n scanf(\"%d\",&hcf);\n for(int i=1;i<n;i++)\n {\n int a;\n scanf(\"%d\",&a);\n if(hcf>a)\n hcf = gcd(hcf,a);\n else\n hcf = gcd(a,hcf);\n \n \n \n }\n printf(\"%d\\n\",n*hcf);\n \n}"}, {"source_code": "#include<stdio.h>\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x<y){ wk=x;x=y;y=wk; }\n while(y){\n wk = x%y;\n x=y;\n y=wk;\n }\n return x;\n}\n\nint gcd_a(int n, int a[n]){\n if(n==1) return a[0];\n if(n==2) return gcd(a[0], a[1]);\n int h = n / 2;\n return gcd(gcd_a(h, &a[h-1]), gcd_a(n - h, &a[h]));\n}\n\nint main(){\nint n,j;\nint i=0;\nscanf(\"%d\",&n);\nint A[n];\nfor(i=0;i<n;i++){\n scanf(\"%d\",&A[i]);\n}\n\n int size_A = sizeof(A)/sizeof(*A);\n int gcd = gcd_a(size_A, A);\n printf(\"%d\\n\", gcd*n);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint min (int ar[],int n)\n{\n int i,p=19000;\n for (i=0;i<n;i++)\n {\n if (ar[i]<=p)\n {\n p=ar[i];\n }\n }\n return p;\n}\nint gcd(int ar[],int p,int n)\n{\n int i=0,f=1;\n while (i<n)\n {\n if (ar[i]%p==0)\n {\n f=1;\n i++;\n }\n else if (ar[i]%p!=0)\n {\n f=0;\n p-=1;\n i=0;\n }\n }\n return p;\n\n\n}\nint main()\n{\n int n,ar[1000],i,s,w,x;\n scanf (\"%d\",&n);\n for (i=0;i<n;i++)\n {\n scanf (\"%d\",&ar[i]);\n }\n w=min(ar,n);\n x=gcd(ar,w,n);\n s=x*n;\n\n printf (\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,x,d,t,z,c,j,k,s;\n z=0;\n scanf(\"%d\",&n);\n int array[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&array[i]);\n \n }\n \n \n for (c = 1 ; c <= n - 1; c++)\n {\n d = c;\n \n while ( d > 0 && array[d] < array[d-1]) {\n t = array[d];\n array[d] = array[d-1];\n array[d-1] = t;\n \n d--;\n }\n }\n \n \n \n while(array[n-1]>array[0])\n \n {\n \n array[n-1]=array[n-1]-array[0];\n for (c = 1 ; c <= n - 1; c++) {\n d = c;\n \n while ( d > 0 && array[d] < array[d-1]) {\n t = array[d];\n array[d] = array[d-1];\n array[d-1] = t;\n \n d--;\n \n }\n}\n \n}\n\n\n \n \n \n \n\n\n \n \n \n \n for(i=0;i<n;i++)\n z=z+array[i];\n \n \n printf(\"%d\",z);\n return 0;\n \n \n \n \n \n \n}"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if(b == 0)\n return a;\n else\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int input[1000];\n for(int i = 0; i < n; i++)\n scanf(\"%d\", &input[i]);\n int min = input[0];\n for(int i = 1; i < n; i++) {\n min = gcd(min,input[i]);\n }\n printf(\"%d\\n\", min * n);\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a, const void *b)\n{\n\treturn *(int *)b-*(int *)a;\n}\nint main(void)\n{\n\tint n,i,sum,min,t;\n\tint a[101];\n\twhile(scanf(\"%d\",&n)!=EOF)\n\t{\n\t\tmin=100;\n\t\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\t\tqsort(a,n,sizeof(int),cmp);\n\t\tfor(i=0;i<n-1;i++)\n\t\t{\n\t\t\tt=a[i]-a[i+1];\n\t\t\tmin=min<t?min:t;\n\t\t}\n\t\tprintf(\"%d\\n\",min*n);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int , int);\nint gcd(int a,int b)\n{\n\tif(b==0)\n\t\treturn a;\n\telse\n\t\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint n,x,i,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tfor(i=1;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&y);\n\t\tx=gcd(x,y);\n\t\tprintf(\"%d\\n\",x);\n\t}\n\tprintf(\"%d\",x*n);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n \n// A function to implement bubble sort\nvoid bubbleSort(int arr[], int n)\n{\n int i, j;\n for (i = 0; i < n-1; i++) \n \n // Last i elements are already in place \n for (j = 0; j < n-i-1; j++) \n if (arr[j] > arr[j+1])\n swap(&arr[j], &arr[j+1]);\n}\n\nint main()\n{\n int n;\n\tscanf(\"%d\",&n);\n\t\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n \t\tscanf(\"%d\",&a[i]);\n \t\n\t}\n\n\tbubbleSort(a,n);\n\tfor(int i=0;i<n-1;i++)\n\t{\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\ta[j]=a[j]-a[i];\n\t\t\tprintf(\"%d \",a[j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\tprintf(\"%d\",a[n-1]);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,j,k,p,sum=0,c=0,t;\n scanf(\"%d\",&n);\n int x[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n while(x[0]!=x[n-1]){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(x[j]<x[i]){\n t=x[i];x[i]=x[j];x[j]=t;\n }}}\n p=x[0];\n for(i=1;i<n;i++){\n if(p<x[i])\n x[i]=x[i]-p;\n }}\n for(i=0;i<n;i++)\n sum+=x[i];\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,j,i,k,l=0,t,d,max,min,m;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n max=arr[0];\n min=arr[0];\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(arr[i]-arr[j]==1)\n {\n l=1;\n break;\n }\n }\n }\n if(l==1)\n printf(\"%d\",n);\n else\n {\n for(j=1;j<n;j++)\n {\n if(arr[j]<min)\n min=arr[j];\n if(arr[j]>max)\n max=arr[j];\n }\n d=max;\n m=min;\n while(m!=0)\n {\n t=d%m;\n d=m;\n m=t;\n \n }\n printf(\"%d\",n*d);\n}\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i,j,arr[200],k;\n\tint sum=0;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\", &arr[i]);\n\tfor(k=0;k<n;k++)\n\t{\n\tfor(i=0;i<n;i++)\n\t{\n\t\tint max=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{ \n\n\t\t\tif(arr[i]>arr[j] && arr[j]>max)\n\t\t{\n\t\t\t//printf(\"%d \", j);\n\t\t\tmax=arr[j];\n\t\t\t//(\"%d\\n\",max);\n\t\t}\t\n\t\t}\n\tarr[i]-=max;\n\t//printf(\"%d\\n\", arr[i]);\n\t\n}\n}\nfor(i=0;i<n;i++)\nsum+=arr[i];\nprintf(\"%d\", sum);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint FindMax(int array[],int n);\nint FindMin(int array[],int n);\nint main(){\n\tint n,i=0;\n\tint array[100];\n\tscanf(\"%d\",&n);\n do{\n scanf(\"%d\",&array[i++]);\n }while(getchar()!='\\n');\n printf(\"%d\",FindMax(array,n)-FindMin(array,n));\n return 0;\n}\nint FindMax(int array[],int n){\n\tint max=array[0];\n\tint i=1;\n\twhile(i<n){\n\t\tif(max<array[i]){\n\t\t\tmax=array[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn max;\n}\nint FindMin(int array[],int n){\n\tint min=array[0];\n\tint i=1;\n\twhile(i<n){\n\t\tif(min>array[i]){\n\t\t\tmin=array[i];\n\t\t}\n\t\ti++;\n\t}\n\treturn min;\n}\n\n "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n int min = abs(arr[0]-arr[1]);\n for(i=1; i<n; i++)\n {\n r = abs(arr[i]-arr[i+1]);\n if(r<min)\n {\n min = r;\n }\n }\n if(min==0)\n {\n min = arr[0];\n }\n printf(\"%d\\n\",min*n);\n}\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n \n printf(\"%d\\n\",a[0]*n);\n return 0;\n}\n\n"}, {"source_code": " #include<stdio.h>\n #include<stdlib.h>\n int gcd(int a,int b);\n int main()\n {\n int n,*a,cd,i; \n scanf(\"%d\",&n);\n a=(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n cd=gcd(a[0],a[1]);\n for(i=2;i<n;i++)\n {\n cd=gcd(cd,a[i]);\n }\n printf(\"%d\",(n*cd)); \n \n return 0; \n } \n int gcd(int a,int b)\n { \n if(a==0)\n return b;\n else if(b==0)\n return a;\n else if(a<b)\n gcd(a,b-a);\n else\n gcd(a-b,a);\n \n \n }"}, {"source_code": "/* Problem: 389A - Fox and Number Game */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint cmp (const void*, const void*);\n\nint main ()\n {\n unsigned short n;\n unsigned short i;\n unsigned short x[100];\n unsigned short gcd;\n unsigned short f;\n \n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 2 || n > 100)\n return -1;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&x[i]) != 1)\n return -1;\n if (x[i] < 1 || x[i] > 100)\n return -1;\n }\n qsort (x,n,sizeof(unsigned short),cmp);\n gcd = x[0];\n f = 0;\n while (gcd > 1 && !f)\n {\n f = 1;\n for (i = 1; i < n && f; i++)\n if (x[i]%gcd)\n f = 0;\n if (!f)\n {\n if (!(gcd%2))\n gcd /= 2;\n else if (!(gcd%3))\n gcd /= 3;\n else if (!(gcd%5))\n gcd /= 5;\n else if (!(gcd%7))\n gcd /= 7;\n else\n gcd = 1;\n }\n }\n printf (\"%hu\\n\",gcd*n);\n return 0;\n }\n \nint cmp (p1,p2)\n const void* p1;\n const void* p2;\n {\n unsigned short a;\n unsigned short b;\n \n a = *(unsigned short*)p1;\n b = *(unsigned short*)p2;\n if (a == b)\n return 0;\n return (a > b ? 1 : -1);\n }\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint comp(const void *p,const void *q);\nint main(){\n int n,i,min=999,j;\n int x[1200];\n scanf(\"%d\",&n);\n for(i=0;i<n;++i)\n scanf(\"%d\",&x[i]);\n qsort(x,n,sizeof(int),comp);\n for(i=0;i<n;++i){\n for(j=i+1;j<n;++j)\n if(x[j]==x[i])\n min=x[i];\n if(x[j]-x[i]<min&&x[j]-x[i]>0)\n min=x[j]-x[i];\n }\n printf(\"%d\\n\",min*n);\nreturn 0;\n}\nint comp(const void *p,const void *q){\n return (*(int *)p-*(int *)q);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,j,sum,p,a[200];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n for(i=0;i<n-1;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(a[i]<a[j])\n {\n p=a[j];\n a[j]=a[i];\n a[i]=p;\n }\n }\n }\n \n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(a[i]>a[j])\n {\n a[i]=a[i]-a[j];\n j=-1;\n }\n \n }\n \n }\n sum=0;\n for(i=0;i<n;i++)\n {\n sum=sum+a[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n #include<stdlib.h>\n int gcd(int a,int b);\n int main()\n {\n int n,*a,cd,i;\t\n scanf(\"%d\",&n);\n a=(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n cd=gcd(a[0],a[1]);\n for(i=2;i<n;i++)\n {\n cd=gcd(cd,a[i]);\n }\n printf(\"%d\",(n*cd));\t\n \t\n return 0;\t\n }\t\n int gcd(int a,int b)\n { \n \tif(a==0)\n \treturn b;\n \telse if(b==0)\n \treturn a;\n \telse if(a<b)\n \tgcd(a,b-a);\n \telse\n \tgcd(a-b,a);\n \t\n \t\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,min=999999,s,flag=0,i,j,tmp;\n scanf(\"%d\",&n);int a[n];\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n while(flag==0)\n {\n s=0;\n for(i=1;i<=n-1;i++)\n {\n if(a[i]==a[i+1])\n {\n flag=1;\n }\n else\n {\n flag=0;\n break;\n }\n }\n // printf(\"flg=%d\",flag);\n if(flag==1)\n break;\n if(flag==0){\n for(i=1;i<=n;i++)\n {\n for(j=i+1;j<=n;j++)\n {\n if(a[i]<a[j])\n {\n tmp=a[i];\n a[i]=a[j];\n a[j]=tmp;\n }\n }\n }\n for(i=1;i<=n-1;i++)\n {\n a[i]=a[i]-a[i+1];\n // printf(\"a[i]=%d \",a[i]);\n // s=s+a[i];\n }\n for(i=1;i<=n;i++)\n {\n s=s+a[i];\n }\n if(min>s)\n min=s;\n //else\n // break;\n }\n // else\n // break;\n }\n printf(\"%d\",min);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&a);\nb[i]=a;\n}\nw=10000;\nint ma(int a,int b);\nfor(i=0;i<n-1;i++)\n{for(j=1;j<n;j++)\n{\n\n\n g=ma(b[i],b[j]);\n if(g<w){w=g;}}\n}//if(g<w){w=g;}//printf(\"%d %d\\n\",g,w);\nprintf(\"%d\\n\",n*w);\nreturn 0;\n}\nint ma(int a,int b)\n{int c=1,t,d;\nif(a<b){d=a;a=b;b=d;}\nif(a>b)\nwhile(c!=0)\n{c=a%b;//printf(\"88%d %d %d %d\\n\",t,a,b,c);\na=b;\nt=b;\nb=c;\n}//printf(\"88%d %d %d %d\\n\",t,a,b,c);\nreturn t;\n}\n\n "}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return *(int*)a-*(int*)b;\n}\nint main(void) {\n int n,i,sum;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n sum=arr[0];\n if(n!=1)\n {\n sum=0;\n qsort(arr,n,sizeof(int),cmp);\n while(1)\n {\n if(arr[n-2]==0||arr[n-1]<=arr[n-2])\n break;\n arr[n-1]=arr[n-1]-arr[n-2];\n qsort(arr,n,sizeof(int),cmp);\n }\n for(i=0;i<n;i++)\n sum=sum+arr[i];\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#define del 10001\n#define Max 20010\n#define bug(x) printf(\"%ld\",x)\nint dp[2][Max];\nint ok[10010];\nint n,i,x,j;\nint r1,r2;\n\n//int max(int x,int y) {if (x > y) return x; else return y;}\n//int min(int x,int y) {if (x < y) return x; else return y;}\n\nint main() \n{\n dp[0][0 + del] = 1;\n int sum = 0;\n scanf(\"%ld\",&n);\n\n for (i = 1; i<=n; i++)\n {\n scanf(\"%ld\",&x);\n ok[x] = 1;\n if (i == 1) r1 = x;\n if (i == 2) r2 = x;\n sum = sum + x;\n for (j = -10000; j<=10000; j++)\n {\n if (j + x + del < Max) dp[i % 2][j + x + del] = (dp[(i - 1)%2][j + del] | dp[i % 2][j + x + del]);\n if (j - x + del >= 0) dp[i % 2][j - x + del] = (dp[(i - 1)%2][j + del] | dp[i % 2][j - x + del]);\n }\n for (j = -10000; j<=10000; j++)\n {\n \tif (dp[(i + 1) % 2][j + del] == 1) \n {\n if (j >= 0) ok[j] = 1;\n else\n ok[-j] = 1;\n }\n \tdp[(i + 1)%2][j + del] = 0;\n }\n dp[(i + 1)%2][del] = 1;\n }\n\n for (j = -10000; j<=10000; j++)\n {\n \tif (dp[n % 2][j + del] == 1) \n {\n if (j >= 0) ok[j] = 1;\n else\n ok[-j] = 1;\n }\n }\n //\n int res = 1000;\n for (i = 1; i<=100; i++)\n if (ok[i])\n {\n res = i;\n break;\n }\n if (n == 2)\n {\n while (r1 != r2)\n {\n if (r1 > r2)\n r1 = r1 - r2;\n else\n r2 = r2 - r1;\n }\n bug(r1 + r2);\n }\n else\n if (res == 1000) printf(\"%ld\",sum);\n else\n printf(\"%ld\",res*n); \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\n#define MAX_NUMBERS 110\n\nint gcd (int x, int y){\n if (x == 0)\n return y;\n else\n return gcd(y%x, x);\n}\n\nint main (){\n\n int n, i, g, numbers[MAX_NUMBERS];\n\n scanf(\"%d\", &n);\n\n for (i=0; i<n; i++)\n scanf(\"%d\", &numbers[i]);\n\n g = gcd(numbers[0], numbers[1]);\n for (i=2; i<n-1; i++){\n //Calculate gcd, running for the rest of the items in the array\n g = gcd(g, numbers[i]);\n }\n\n printf(\"%d\\n\", g*n);\n\n return 0;\n}\n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint gcd(int a, int b)\n{\n\tif(b == 0)\n\t return a;\n\telse\n\t\treturn gcd(b,a%b);\t\n}\n\nint main()\n{\n\tint n,i,min=100,max=0;\n\tscanf(\"%d\",&n);\n\tint x[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&x[i]);\n\t\tmax = max>x[i]?max:x[i];\n\t\tmin = min<x[i]?min:x[i];\n\t}\n\tint mingc = min;\n\tint j;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(j != i)\n\t\t\t\tmingc = mingc<gcd(x[i],x[j]) ? mingc:gcd(x[i],x[j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(x[i]%mingc != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",mingc);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(i,j)\n{\n int temp;\n if(i==0)return j;\n if(j==0)return i;\n while(j!=0){\n temp=i;\n i=j;\n j=temp%j;\n }\n return i;\n}\nint main()\n{\n int a,i,gd,sum;\n int b[101];\n while(scanf(\"%d\",&a)==1){\n sum=0;\n \n for(i=0;i<a;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<a-1;i++){\n gd=gcd(b[i],b[i+1]);\n b[i]=gd;\n b[i+1]=gd;\n }\n for(i=0;i<a;i++){\n sum=sum+b[i];\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "/* Problem: 389A - Fox and Number Game */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint cmp (const void*, const void*);\n\nint main ()\n {\n unsigned short n;\n unsigned short i;\n unsigned short x[100];\n unsigned short gcd;\n unsigned short f;\n \n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 2 || n > 100)\n return -1;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&x[i]) != 1)\n return -1;\n if (x[i] < 1 || x[i] > 100)\n return -1;\n }\n qsort (x,n,sizeof(unsigned short),cmp);\n gcd = x[0];\n f = 0;\n while (gcd > 1 && !f)\n {\n f = 1;\n for (i = 1; i < n && f; i++)\n if (x[i]%gcd)\n f = 0;\n if (!f)\n {\n if (gcd == x[0])\n gcd /= 2;\n else\n gcd--;\n }\n }\n printf (\"%hu\\n\",gcd*n);\n return 0;\n }\n \nint cmp (p1,p2)\n const void* p1;\n const void* p2;\n {\n unsigned short a;\n unsigned short b;\n \n a = *(unsigned short*)p1;\n b = *(unsigned short*)p2;\n if (a == b)\n return 0;\n return (a > b ? 1 : -1);\n }\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n while(a[n-1]!=a[0]){\n qsort(a,n,sizeof(int),f);\n for(i=n;i>=1;i--){\n if(a[i]-a[i-1]>0)\n a[i]=a[i]-a[i-1];\n }\n l++;\n }\n int s=0;\n for(i=0;i<n;i++){\n s=s+a[i];\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint solve(int a,int b)\n{ \n while(a!=b)\n {\n if(a>b)\n a-=b;\n else\n b-=a;\n }\n return a;\n}\nint main()\n{\n int a,b,sum=0,ans,n;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&a,&b);\n ans=solve(a,b);\n sum+=ans*2;\n n-=2;\n while(n--)\n {\n scanf(\"%d\",&a);\n ans=solve(ans,a);\n sum+=ans;\n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include<stdio.h>\nint comp(const void * a,const void *b);\nint main(){\n int n;\n scanf(\"%d\",&n);\n int i,j,ans=0;\n int num[n];\n int temp;\n for(i=0;i<n;i++)\n scanf(\"%d\",&num[i]);\n qsort((void*)num,n,sizeof(int),comp);\n temp=num[n-1];\n for(i=n-2;i>=0;i--){\n for(j=n-2;j>=0;j--){\n if(temp>num[j]){\n temp=temp-num[j];\n }\n }\n ans+=num[i];\n }\n printf(\"%d\\n\",temp*n);\n return 0;\n}\n\nint comp(const void * a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\n"}, {"source_code": "#include<stdio.h>\nint hcf(int a,int b)\n {\n if((b%a)==0)\n return a;\n else\n return hcf(b%a,a);\n\n }\nint main()\n{\n int a,cnt=0,j,c,d,dum,arr[109]={0},n,i,k,b,ans1,ans2;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0,j=n-1;i<=n-2,j>=1;i++,j--)\n {\n a=arr[i];b=arr[i+1];\n c=arr[j];d=arr[j-1];\n if(a>b)\n {\n k=b;b=a;a=k;\n }\n ans1=hcf(a,b);\n if(c>d)\n {\n dum=d;d=c;c=dum;\n }\n ans2=hcf(c,d);\n arr[i]=ans1;arr[i+1]=ans1;\n arr[j]=ans2;arr[j-1]=ans2;\n }\n for(i=0;i<n;i++)\n {\n cnt+=arr[i];\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n int t;\n while(b!=0)\n {\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n}\nint main ()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n int max=a[0];\n for(i=1;i<n;i++)\n {\n int x=gcd(a[i],a[0]);\n if(x<max && x!=1) max=x;\n }\n printf(\"%d\",max*n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{if(b%a==0)\nreturn a;\nelse\nreturn gcd(b%a,a);}\n\nint main()\n{\nint k,i,j,n,a[100],l=0,t=0,sum=0,min,gc=0;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&a[i]);\nif(i==0)\nmin=a[i];\nelse if(min>a[i])\nmin=a[i];}\nl=min;t=min;\nfor(i=0;i<n;i++)\n{\nif(min!=a[i])\n{t=gcd(min,a[i]);}\nif(l>t)\nl=t;}\nprintf(\"%d\",n*l);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x<y){ wk=x;x=y;y=wk; }\n while(y){\n wk = x%y;\n x=y;\n y=wk;\n }\n return x;\n}\n\nint gcd_a(int n, int a[n]){\n if(n==1) return a[0];\n if(n==2) return gcd(a[0], a[1]);\n int h = n / 2;\n return gcd(gcd_a(h, &a[h-1]), gcd_a(n - h, &a[h]));\n}\n\nint main(){\nint n,j;\nint i=0;\nscanf(\"%d\",&n);\nint A[n];\nfor(i=1;i<n;i++){\n scanf(\"%d\",&A[i]);\n}\n\n int size_A = sizeof(A)/sizeof(*A);\n int gcd = gcd_a(size_A, A);\n printf(\"%d\\n\", gcd*n);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&a);\nb[i]=a;\n}\nw=10000;\nint ma(int a,int b);\nfor(i=0;i<n-1;i++)\n{for(j=1;j<n;j++)\n{\n\n\n g=ma(b[i],b[j]);\n if(g<w){w=g;}}\n}//if(g<w){w=g;}//printf(\"%d %d\\n\",g,w);\nprintf(\"%d\\n\",n*w);\nreturn 0;\n}\nint ma(int a,int b)\n{int c=1,t,d;\nif(a<b){d=a;a=b;b=d;}\nif(a>b)\nwhile(c!=0)\n{c=a%b;//printf(\"88%d %d %d %d\\n\",t,a,b,c);\na=b;\nt=b;\nb=c;\n}//printf(\"88%d %d %d %d\\n\",t,a,b,c);\nreturn t;\n}\n\n "}, {"source_code": "#include <stdio.h>\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i <q ; i++)\n\t\tscanf(\"%d\",&A[i]);\n\t\n\tfor (g = 0; g < q; g++)\n\t\tfor (r = 0; r < q; r++)\n\t\t\tif (A[r]>=A[r+1])\n\t\t\t{\n\t\t\t\tx=A[r]; \n\t\t\t\tA[r]=A[r+1]; \n\t\t\t\tA[r+1]=x;\n\t\t\t}\t\n\tif (A[q]==A[1]) w=0;\n\twhile (w)\n\t{\n\t\tif (A[q]==A[1]) w=0;\n\t\tfor (i = q; i > 0 ; i--)\n\t\t\tA[i]-=A[i-1];\n\t\tfor (g = 0; g < q; g++)\n\t\t\tfor (r = 0; r < q; r++)\n\t\t\t\tif (A[r]>=A[r+1])\n\t\t\t\t{\n\t\t\t\t\tx=A[r]; \n\t\t\t\t\tA[r]=A[r+1]; \n\t\t\t\t\tA[r+1]=x;\n\t\t\t\t}\t\n\t}\n\t\n\tfor (i = 1; i <=q ; i++)\n\t\ttop+=A[i];\n\t\t\n\tprintf(\"%d\",top);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n int p=(a>=b)?b:a;\n\n leo:\n if ((a%p==0)&&(b%p==0))\n {\n return p;\n }\n else if ((a%p!=0)||(b%p!=0))\n {\n p-=1;\n goto leo;\n }\n}\nint main()\n{\n int n,ar[1000],i,m,s=0;\n scanf (\"%d\",&n);\n for (i=0;i<n;i++)\n {\n scanf (\"%d\",&ar[i]);\n }\n for (i=0;i<n-1;i+=1)\n {\n m=gcd (ar[i],ar[i+1]);\n ar[i]=m;\n ar[i+1]=m;\n }\n for (i=0;i<n;i++)\n {\n s+=ar[i];\n }\n printf (\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n if(a[i]>a[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(j=0; j<n; j++){\n for(i=0; i<n; i++){\n if(a[i]>a[j]){\n a[i]-=a[j];\n continue;\n }\n if(a[j]>a[i]){\n a[j]-=a[i];\n }\n }\n }\n int sum=0;\n for(i=0; i<n; i++){\n sum+=a[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n&&i+1<n;i++)\n {\n while(arr[i]!=arr[i+1])\n {\n if(arr[i]>arr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]<arr[i+1])\n {\n arr[i+1]=arr[i+1]-arr[i];\n }\n }\n }\n for(i=0;i<n;i++)\n {\n sum+=arr[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<limits.h>\nint cmpfn (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int arr[100];\n int i,n;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n int sum,p_sum;\n p_sum = INT_MAX;\n sum = 0;\n qsort(arr,n,sizeof(int),cmpfn);\n for(i=n-1;i>=0;i--)\n {\n if(arr[i]>arr[i-1])\n arr[i] = arr[i]-arr[i-1];\n sum+=arr[i];\n }\n while(sum<p_sum)\n {\n p_sum = sum;\n sum = 0;\n qsort(arr,n,sizeof(int),cmpfn);\n for(i=n-1;i>=0;i--)\n {\n if(arr[i]>arr[i-1])\n arr[i] = arr[i]-arr[i-1];\n sum+=arr[i];\n }\n }\n printf(\"%d\",p_sum);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n \n printf(\"%d\\n\",a[0]*n);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i <q ; i++)\n\t\tscanf(\"%d\",&A[i]);\n\t\n\tfor (g = 0; g < q; g++)\n\t\tfor (r = 0; r < q; r++)\n\t\t\tif (A[r]>=A[r+1])\n\t\t\t{\n\t\t\t\tx=A[r]; \n\t\t\t\tA[r]=A[r+1]; \n\t\t\t\tA[r+1]=x;\n\t\t\t}\t\n\tif (A[q]==A[1]) w=0;\n\twhile (w)\n\t{\n\t\tfor (i = q; i > 0 ; i--)\n\t\t\tif (A[i]!=A[i-1])\n\t\t\t\tA[i]-=A[i-1];\n\t\tif (A[q]==A[1]) w=0;\n\t\tfor (g = 0; g < q; g++)\n\t\t\tfor (r = 0; r < q; r++)\n\t\t\t\tif (A[r]>=A[r+1])\n\t\t\t\t{\n\t\t\t\t\tx=A[r]; \n\t\t\t\t\tA[r]=A[r+1]; \n\t\t\t\t\tA[r+1]=x;\n\t\t\t\t}\t\n\t}\n\t\n\tfor (i = 1; i <=q ; i++)\n\t\ttop+=A[i];\n\t\t\n\tprintf(\"%d\",top);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,j,k,p,sum=0,c=0,t;\n scanf(\"%d\",&n);\n int x[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n while(x[0]!=x[n-1]){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(x[j]<x[i]){\n t=x[i];x[i]=x[j];x[j]=t;\n }}}\n p=x[0];\n for(i=1;i<n;i++){\n if(p<x[i])\n x[i]=x[i]-p;\n }}\n for(i=0;i<n;i++)\n sum+=x[i];\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i <q ; i++)\n\t\tscanf(\"%d\",&A[i]);\n\t\n\tfor (g = 0; g < q; g++)\n\t\tfor (r = 0; r < q; r++)\n\t\t\tif (A[r]>=A[r+1])\n\t\t\t{\n\t\t\t\tx=A[r]; \n\t\t\t\tA[r]=A[r+1]; \n\t\t\t\tA[r+1]=x;\n\t\t\t}\t\n\tif (A[q]==A[1]) w=0;\n\twhile (w)\n\t{\n\t\tif (A[q]==A[1]) w=0;\n\t\tfor (i = q; i > 0 ; i--)\n\t\t\tA[i]-=A[i-1];\n\t\tfor (g = 0; g < q; g++)\n\t\t\tfor (r = 0; r < q; r++)\n\t\t\t\tif (A[r]>=A[r+1])\n\t\t\t\t{\n\t\t\t\t\tx=A[r]; \n\t\t\t\t\tA[r]=A[r+1]; \n\t\t\t\t\tA[r+1]=x;\n\t\t\t\t}\t\n\t}\n\t\n\tfor (i = 1; i <=q ; i++)\n\t\ttop+=A[i];\n\t\t\n\tprintf(\"%d\",top);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint n,f,mini,i,s,j;\n\tscanf(\"%d\",&n);\n\tint ara[100000];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tmini=abs(ara[0]-ara[1]);\n\tfor (i=0;i<n-1;i++){\n\t\tfor (j=i+1;j<n;j++){\n\t\ts=abs(ara[i]-ara[j]);\n\t\tif (s<=mini){\n\t\t\tmini=s;\n\t\t\t\n\t\t}\n\t\t}\n\t\t\n\t}\n\tf=mini*n;\n\tprintf(\"%d\",f);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<limits.h>\nint cmpfn (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int arr[100];\n int i,n;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n int sum,p_sum;\n p_sum = INT_MAX;\n sum = 0;\n qsort(arr,n,sizeof(int),cmpfn);\n for(i=n-1;i>=0;i--)\n {\n if(arr[i]>arr[i-1])\n arr[i] = arr[i]-arr[i-1];\n sum+=arr[i];\n }\n while(sum<p_sum)\n {\n p_sum = sum;\n sum = 0;\n qsort(arr,n,sizeof(int),cmpfn);\n for(i=n-1;i>=0;i--)\n {\n if(arr[i]>arr[i-1])\n arr[i] = arr[i]-arr[i-1];\n sum+=arr[i];\n }\n }\n printf(\"%d\",p_sum);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\tif(b==0)\n\treturn a;\n\telse\n\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint arr[100],sum,i,n;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n sum=gcd(arr[0],arr[1]);\n for(i=2;i<n;i++)\n {\n \tsum=gcd(arr[i],sum);\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,j,i,k,l,t,d,max,min,m;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n\tmax=arr[0];\n\tmin=arr[0];\n\tfor(j=1;j<n;j++)\n\t{\n\t\tif(arr[j]<min)\n\t\tmin=arr[j];\n\t\tif(arr[j]>max)\n\t\tmax=arr[j];\n\t}\n\td=max;\n\tm=min;\n\twhile(m!=0)\n\t{\n\t\tt=d%m;\n\t\td=m;\n\t\tm=t;\n\t\n\t}\n\tprintf(\"%d\",n*d);\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n if(a[i]>a[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(j=0; j<n; j++){\n for(i=0; i<n; i++){\n if(a[i]>a[j]){\n a[i]-=a[j];\n continue;\n }\n if(a[j]>a[i]){\n a[j]-=a[i];\n }\n }\n }\n int sum=0;\n for(i=0; i<n; i++){\n sum+=a[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n , i , temp , j , sum = 0;\n scanf(\"%d\",&n);\n int A[n+1];\n for(i = 0;i < n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for(i = 0;i < n;i++)\n {\n for(j = 1;j < n - i;j++)\n {\n if(A[j - 1] < A[j])\n {\n temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n }\n }\n }\n while(A[0] > A[1])\n {\n for(i = 1;i < n;i++)\n {\n A[i - 1] = A[i - 1] - A[i];\n }\n for(i = 0;i < n;i++)\n {\n for(j = 1;j < n - i;j++)\n {\n if(A[j - 1] < A[j])\n {\n temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n }\n }\n }\n }\n for(i = 0;i < n;i++)\n {\n sum += A[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n int n[200];\n int T;\n int i,j;\n int firMax = 0;\n int secMax = 0;\n n[0] = 0;\n int sum = 0;\n scanf(\"%d\", &T);\n for(i = 1; i <= T; i++){\n scanf(\"%d\", &n[i]);\n if(n[i] >= n[firMax]){\n secMax = firMax;\n firMax = i;\n }else if(n[i] >= n[secMax]){\n secMax = i;\n }\n }\n //printf(\"FirstMax[%d]:%d\\nSecondMax[%d]:%d\\n\", firMax, n[firMax], secMax, n[secMax]);\n while(n[firMax] - n[secMax] != 0){\n n[firMax] -= n[secMax];\n firMax = 0;\n secMax = 0;\n for(i = 1; i<= T; i++){\n if(n[i] >= n[firMax]){\n secMax = firMax;\n firMax = i;\n }else if(n[i] >= n[secMax]){\n secMax = i;\n }\n }\n }\n for(i = 1; i <= T; i++){\n sum += n[i];\n }\n printf(\"%d\", sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint n,f,mini,i,s,j,r;\n\tscanf(\"%d\",&n);\n\tint ara[100000];\n\tfor (i=0;i<n;i++){\n\t\tscanf(\"%d\",&ara[i]);\n\t}\n\tr=0;\n\tfor (i=0;i<n-1;i++){\n\t\tif (ara[i]!=ara[i+1]){\n\t\t\tr=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (r==0){\n\t\tprintf(\"%d\",n*ara[0]);\n\t}\n\telse{\n\tmini=100;\n\tfor (i=0;i<n-1;i++){\n\t\tfor (j=i+1;j<n;j++){\n\t\ts=abs(ara[i]-ara[j]);\n\t\tif (s<mini && s>0){\n\t\t\tmini=s;\n\t\t\t\n\t\t}\n\t\t}\n\t\t\n\t}\n\tf=mini*n;\n\tprintf(\"%d\",f);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a, int b){\n if(b==0)\n return a;\n else \n return gcd(b,a%b); \n} \n\nint main(){\n\nint n=0;\n\nwhile(scanf(\"%d\",&n)!=EOF){\n \n int* x = (int*) malloc(sizeof(int)*n); \n \n int i=0, tmp=0;\n for (i;i<n;i++)\n scanf(\"%d\",x+i);\n \n int cgcd =x[0];\n \n for (i=0;i<n;i++){\n \n if(n==1)\n break;\n \n int j=0;\n for(j=i;j<n;j++){\n \n tmp= gcd(x[i], x[j]);\n \n\n\n if(tmp < cgcd)\n cgcd=tmp;\n \n } \n \n }\n printf(\"%d\\n\",n==1?x[0]:cgcd*n);\n} \n\n\nreturn 0; \n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int data[n];\n int i=0;\nwhile(i<n) {\nscanf(\"%d\",&data[i]);\ni++;\n}\nint mincount=0;\nwhile(mincount!=n) {\n mincount = 0;\nint max=0;\nint maxl;\nint min=0;\nint j=0;\nwhile(j<n) {\nif (data[j] < min || min ==0){\n min = data[j];\n}\nif (data[j] > max || max==0) {\n max = data[j];\n maxl=j;\n}\nif (data[j] == min) {\n mincount++;\n}\nj++;\n}\nif (mincount != n) {\nif (max % min == 0) {\n data[maxl] = min;\n} else {\nint c,d;\nc = max/min;\nd = max - ((c)*min);\ndata[maxl] = d;\n}\n} else {\nprintf(\"%d\",n*min);\n}\n}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n\n for(i=n;i>=1;i--){\n a[i]=a[i]-a[i-1];\n }\nqsort(a,n,sizeof(int),f);\n int s=0;\n\n printf(\"%d\\n\",n*a[0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i, n, j, sum = 0;\n scanf(\"%d\", &n);\n fflush(stdin);\n int arr[n];\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n for(i = 0; i < n; i++)\n {\n for(j = i; j < n; j++)\n {\n if(arr[i] > arr[j])\n arr[i] = arr[i] - arr[j];\n }\n }\n for(i = 0; i < n; i++)\n {\n for(j = i; j < n; j++)\n {\n if(arr[i] < arr[j])\n arr[j] = arr[j] - arr[i];\n }\n }\n for(i = 0; i < n; i++)\n sum += arr[i];\n printf(\"%d\", sum);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint hcf(int *j,int n)\n{\n int i,l,k,p,m;\n k=1;\n for(i=2;i<13;i++)\n {\n m=0;\n //printf(\"c\");\n for(l=0;l<n;l++)\n {\n //printf(\"d\");\n p=*(j+l);\n //printf(\"%d\",p);\n if((p%i)==0)\n m++;\n //printf(\"e\");\n }\n if(m==n&&i>k)\n k=i;\n // printf(\"%d\\n\",m);\n }\n return(k);\n}\nint main()\n{\n int i,j,k,l,m,n,p,a[100];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n //printf(\"b\\n\");\n j=hcf(a,n);\n k=j*n;\n printf(\"%d\",k);\n //system(\"pause\");\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n while(a[0]>0){\n qsort(a,n,sizeof(int),f);\n for(i=n;i>=1;i--){\n a[i]=a[i]-a[i-1];\n }\n l++;\n }\n int s=0;\n for(i=0;i<n;i++){\n s=s+a[i];\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n\tif(b==0)\n\treturn a;\n\telse\n\treturn gcd(b,a%b);\n}\nint main()\n{\n\tint arr[100],sum,i,n;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n sum=gcd(arr[0],arr[1]);\n for(i=2;i<n;i++)\n {\n \tsum=gcd(arr[i],sum);\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{int a,b[101],c,d,e,f,n,w,g,j,i;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&a);\nb[i]=a;\n}\nw=10000;\nint ma(int a,int b);\nfor(i=0;i<n-1;i++)\n{for(j=1;j<n;j++)\n{\n\n\n g=ma(b[i],b[j]);\n if(g<w){w=g;}}\n}//if(g<w){w=g;}//printf(\"%d %d\\n\",g,w);\nprintf(\"%d\\n\",n*w);\nreturn 0;\n}\nint ma(int a,int b)\n{int c=1,t,d;\nif(a<b){d=a;a=b;b=d;}\nif(a>b)\nwhile(c!=0)\n{c=a%b;//printf(\"88%d %d %d %d\\n\",t,a,b,c);\na=b;\nt=b;\nb=c;\n}//printf(\"88%d %d %d %d\\n\",t,a,b,c);\nreturn t;\n}\n\n "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n if(a[i]>a[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(i=0; i<n; i++){\n printf(\"%2d\",a[i]);\n }\n for(j=0; j<n; j++){\n for(i=0; i<n; i++){\n if(a[i]>a[j]){\n a[i]-=a[j];\n continue;\n }\n if(a[j]>a[i]){\n a[j]-=a[i];\n }\n }\n }\n int sum=0;\n for(i=0; i<n; i++){\n printf(\"%4d\",a[i]);\n sum+=a[i];\n }\n printf(\"\\n%d\\n\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, a[101], i, min, flag;\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n \n flag=1;\n while(flag==1)\n {\n min=101;\n flag=0;\n for(i=0; i<n; i++)\n {\n if(min>a[i])\n {\n min=a[i];\n }\n }\n \n for(i=0; i<n; i++)\n {\n while(a[i]-min>0)\n a[i]-=min;\n }\n \n for(i=1; i<n; i++)\n {\n if(a[i]!=a[i-1])\n flag=1;\n }\n }\n \n int sum=0;\n for(i=0; i<n; i++)\n {\n printf(\"%d \", a[i]);\n sum+=a[i];\n }\n \n printf(\"\\n%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n#include<string.h>\nint main(void) {\nint n,freq,i,j,temp,d;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n}\nfor(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\nif(a[i]>a[j]){\n temp=a[i];\n a[i]=a[j];\n a[j]=temp;\n}\n }\n}\nd=a[n-1]-a[0];\nfor(i=d;i>=1;i--){freq=0;\n for(j=0;j<n;j++){\n if(a[j]%i==0){\n freq++;\n }\n }\n if(freq==n){\n break;\n }\n}\nprintf(\"%d\",i*n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint a[101];\n\tint n,i,j,sum=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tint k;\n\tfor (k=0;k<n;k++)\n\t\tfor (i=0;i<n-1;i++){\n\t\t\tfor (j=i+1;j<n;j++){\n\t\t\t\tif(a[i]>a[j]) {\n\t\t\t\t\ta[i]=a[i]-a[j];\n\t\t\t\t}\n\t\t\t\tif (a[i]<a[j])\n\t\t\t\t\ta[j]=a[j]-a[i];\n\t\t\t}\n\t\t}\n\tfor(i=0;i<n;i++){\n\t\tsum+=a[i];\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n #include<stdlib.h>\n int gcd(int a,int b);\n int main()\n {\n int n,*a,cd,i; \n scanf(\"%d\",&n);\n a=(int*)malloc(n*sizeof(int));\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n cd=gcd(a[0],a[1]);\n for(i=2;i<n;i++)\n {\n cd=gcd(cd,a[i]);\n }\n printf(\"%d\",(n*cd)); \n \n return 0; \n } \n int gcd(int a,int b)\n { \n if(a==0)\n return b;\n else if(b==0)\n return a;\n else if(a<b)\n gcd(a,b-a);\n else\n gcd(a-b,a);\n \n \n }"}, {"source_code": "\n\n#include <stdio.h>\n\n\nint a[100];\n\nint reduce(int *a, int size){\n\tint m1 = 0, m2 = -1;\n\tfor(int i =1 ; i < size; i++ ){\n\t\tif ( a[m1] < a[i] ){\n\t\t\tm2 = m1;\n\t\t\tm1 = i;\n\t\t}\n\t}\n\tif ( m2 == -1 ) m2 = 1;\n\t//printf( \"Found max %d %d, %d %d\\n\", a[m1], a[m2] , m1, m2);\n\tif ( a[m1] - a[m2] <= 0)\n\t\treturn 0;\n\ta[m1] -= a[m2];\n\treturn 1;\n}\n\nint sum ( int *a, int size ){\n\tint res = 0;\n\tfor(int i = 0; i < size ;i++){\n\t\tres += a[i];\n\t}\n\treturn res;\n}\n\nint main(){\n\tint n, i=0;\n\tscanf(\"%d\", &n);\n\tfor(int i = 0 ; i < n ; i++ )\n\t\tscanf(\"%d\", &a[i]);\n\twhile ( reduce(a, n));\n\tprintf(\"%d\\n\", sum(a, n));\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define del 10001\n#define Max 20010\n#define bug(x) printf(\"%ld\",x)\nint dp[2][Max];\nint ok[10010];\nint n,i,x,j;\n\nint main() \n{\n dp[0][0 + del] = 1;\n int sum = 0;\n scanf(\"%ld\",&n);\n\n for (i = 1; i<=n; i++)\n {\n scanf(\"%ld\",&x);\n ok[x] = 1;\n sum = sum + x;\n for (j = -10000; j<=10000; j++)\n {\n if (j + x + del < Max) dp[i % 2][j + x + del] = (dp[(i - 1)%2][j + del] | dp[i % 2][j + x + del]);\n if (j - x + del >= 0) dp[i % 2][j - x + del] = (dp[(i - 1)%2][j + del] | dp[i % 2][j - x + del]);\n }\n for (j = -10000; j<=10000; j++)\n {\n \tif (dp[(i + 1) % 2][j + del] == 1) \n {\n if (j >= 0) ok[j] = 1;\n else\n ok[-j] = 1;\n }\n \tdp[(i + 1)%2][j + del] = 0;\n }\n dp[(i + 1)%2][del] = 1;\n }\n\n for (j = -10000; j<=10000; j++)\n {\n \tif (dp[n % 2][j + del] == 1) \n {\n if (j >= 0) ok[j] = 1;\n else\n ok[-j] = 1;\n }\n }\n //\n int res = 1000;\n for (i = 1; i<=100; i++)\n if (ok[i])\n {\n res = i;\n break;\n }\n if (res == 1000) printf(\"%ld\",sum);\n else\n printf(\"%ld\",res*n); \n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n\nint main()\n{\n int n , A[200]={0}, Result=0,i,j,temp;\n scanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for (i=1;i<n;i++)\n {\n for(j=0;j<(n-i);j++)\n {\n if (A[j]<A[j+1])\n {\n temp=A[j];\n A[j]=A[j+1];\n A[j+1]=temp;\n }\n }\n }\n\n while(A[0]>A[1])\n {\n if(A[0]==A[n-1])\n {\n break;}\n for(i=0;i<n;i++)\n {\n\n A[i]=A[i]-A[i+1];\n }\n for (i=1;i<n;i++)\n {\n for(j=0;j<(n-i);j++)\n {\n if (A[j]>A[j+1])\n {\n temp=A[j];\n A[j]=A[j+1];\n A[j+1]=temp;\n }\n }\n }\n\n\n }\n\n\n Result=A[0]*n; printf(\"%d\",Result);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,j,i,k,l,t,d,max,min,m;\n\tscanf(\"%d\",&n);\n\tint arr[n];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&arr[i]);\n\tmax=arr[0];\n\tmin=arr[0];\n\tfor(j=1;j<n;j++)\n\t{\n\t\tif(arr[j]<min)\n\t\tmin=arr[j];\n\t\tif(arr[j]>max)\n\t\tmax=arr[j];\n\t}\n\td=max;\n\tm=min;\n\twhile(m!=0)\n\t{\n\t\tt=d%m;\n\t\td=m;\n\t\tm=t;\n\t\n\t}\n\tprintf(\"%d\",n*d);\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n int min = abs(arr[0]-arr[1]);\n for(i=1; i<n; i++)\n {\n r = abs(arr[i]-arr[i+1]);\n if(r<min)\n {\n min = r;\n }\n }\n printf(\"%d\\n\",min*n);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main(){\n\n int n,i,j=0;\n scanf(\"%d\",&n);\n int a[100];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n if(a[i]>a[i-1]){\n a[i]-=a[i-1];\n }\n }\n for(i=0; i<n; i++){\n printf(\"%2d\",a[i]);\n }\n for(j=0; j<n; j++){\n for(i=0; i<n; i++){\n if(a[i]>a[j]){\n a[i]-=a[j];\n continue;\n }\n if(a[j]>a[i]){\n a[j]-=a[i];\n }\n }\n }\n int sum=0;\n for(i=0; i<n; i++){\n printf(\"%4d\",a[i]);\n sum+=a[i];\n }\n printf(\"\\n%d\\n\",sum);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a, int b)\n{\n if(b == 0) return a;\n return gcd(b, a % b);\n}\nint main()\n{\n int i, n, sum = 0, arr[100];\n for(i = 0; i < 100; i++)\n arr[i] = 0;\n scanf(\"%d\", &n);\n fflush(stdin);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n sum = arr[0];\n for(i = 0; i < n - 1; i++)\n {\n sum = gcd(sum, arr[i + 1]);\n }\n printf(\"%d\", n * sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint gcd(int a, int b){\n if(b==0)\n return a;\n else \n return gcd(b,a%b); \n} \n\nint main(){\n\nint n=0;\n\nwhile(scanf(\"%d\",&n)!=EOF){\n \n int* x = (int*) malloc(sizeof(int)*n); \n int cgcd =1;\n \n int i=0, tmp=0;\n for (i;i<n;i++)\n scanf(\"%d\",x+i);\n \n for (i=0;i<n-1;i++){\n tmp= gcd(x[i],x[i+1]);\n \n if( n==1 || gcd(tmp,cgcd)==1){\n cgcd=1;\n break;\n }\n\n if(i==0 || tmp<cgcd)\n cgcd=tmp;\n }\n \n printf(\"%d\\n\",n==1?x[0]:cgcd*n);\n} \n\n\nreturn 0; \n} "}, {"source_code": "#include<stdio.h>\nint hcf(int a,int b)\n {\n if((b%a)==0)\n return a;\n else\n return hcf(b%a,a);\n\n }\nint main()\n{\n int a,cnt=0,j,c,d,dum,arr[109]={0},n,i,k,b,ans1,ans2;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0,j=n-1;i<=n-2,j>=1;i++,j--)\n {\n a=arr[i];b=arr[i+1];\n c=arr[j];d=arr[j-1];\n if(a>b)\n {\n k=b;b=a;a=k;\n }\n ans1=hcf(a,b);\n if(c>d)\n {\n dum=d;d=c;c=dum;\n }\n ans2=hcf(c,d);\n arr[i]=ans1;arr[i+1]=ans1;\n arr[j]=ans2;arr[j-1]=ans2;\n }\n for(i=0;i<n;i++)\n {\n cnt+=arr[i];\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\nwhile(a[n-1]-a[0]>0){\n for(i=n;i>=1;i--){\n if(a[i]-a[i-1]>0)\n a[i]=a[i]-a[i-1];\n }\n}\nqsort(a,n,sizeof(int),f);\n int s=0;\n\n printf(\"%d\\n\",n*a[0]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n\nint comp(const void*a,const void*b){\n return *(int*)a - *(int*)b;\n}\n\nint main(){\n long long n,i,j,min;\n int t[105];\n while(scanf(\"%I64d\",&n)!=EOF){\n for(i=0;i<n;i++){\n scanf(\"%d\",&t[i]);\n }\n qsort(t,n,sizeof(int),comp);\n for(i=0,min=2147483647;i<n;i++){\n for(j=i+1;j<n;j++){\n min = MIN(min,t[j]-t[i]);\n }\n }\n printf(\"%I64d\\n\",min*n);\n }\n return 0;\n}\n"}, {"source_code": "/* Problem: 389A - Fox and Number Game */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n#include <stdlib.h>\n\nint cmp (const void*, const void*);\n\nint main ()\n {\n unsigned short n;\n unsigned short i;\n unsigned short x[100];\n unsigned short gcd;\n unsigned short f;\n \n if (scanf(\"%hu\",&n) != 1)\n return -1;\n if (n < 2 || n > 100)\n return -1;\n for (i = 0; i < n; i++)\n {\n if (scanf(\"%hu\",&x[i]) != 1)\n return -1;\n if (x[i] < 1 || x[i] > 100)\n return -1;\n }\n qsort (x,n,sizeof(unsigned short),cmp);\n gcd = x[0];\n f = 0;\n while (gcd > 1 && !f)\n {\n f = 1;\n for (i = 1; i < n && f; i++)\n if (x[i]%gcd)\n f = 0;\n if (!f)\n {\n if (gcd == x[0])\n gcd /= 2;\n else\n gcd--;\n }\n }\n printf (\"%hu\\n\",gcd*n);\n return 0;\n }\n \nint cmp (p1,p2)\n const void* p1;\n const void* p2;\n {\n unsigned short a;\n unsigned short b;\n \n a = *(unsigned short*)p1;\n b = *(unsigned short*)p2;\n if (a == b)\n return 0;\n return (a > b ? 1 : -1);\n }\n"}, {"source_code": "#include<stdio.h>\nint gcd(i,j)\n{\n int temp;\n if(i==0)return j;\n if(j==0)return i;\n while(j!=0){\n temp=i;\n i=j;\n j=temp%j;\n }\n return i;\n}\nint main()\n{\n int a,i,gd,sum;\n int b[101];\n while(scanf(\"%d\",&a)==1){\n sum=0;\n \n for(i=0;i<a;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<a-1;i++){\n gd=gcd(b[i],b[i+1]);\n b[i]=gd;\n b[i+1]=gd;\n }\n for(i=0;i<a;i++){\n sum=sum+b[i];\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint comp(const void * a,const void *b);\nint main(){\n int n;\n scanf(\"%d\",&n);\n int i,j,ans=0;\n int num[n];\n int temp;\n for(i=0;i<n;i++)\n scanf(\"%d\",&num[i]);\n qsort((void*)num,n,sizeof(int),comp);\n temp=num[n-1];\n for(i=n-2;i>=0;i--){\n for(j=n-2;j>=0;j--){\n if(temp>num[j]){\n temp=temp-num[j];\n }\n }\n ans+=num[i];\n }\n printf(\"%d\\n\",temp*n);\n return 0;\n}\n\nint comp(const void * a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if(b == 0)\n return a;\n else\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int input[101];\n for(int i = 0; i < n; i++)\n scanf(\"%d\", &input[i]);\n int min = 1e9;\n for(int i = 0; i < n - 1; i++) {\n if(gcd(input[i], input[i + 1]) < min)\n min = gcd(input[i], input[i + 1]);\n }\n printf(\"%d\\n\", min * n);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n-1;i++)\n {\n while(arr[i]!=arr[i+1])\n {\n if(arr[i]>arr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]<arr[i+1])\n {\n arr[i+1]=arr[i+1]-arr[i];\n }\n }\n }\n for(i=0;i<n;i++)\n {\n sum=sum+arr[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n int t;\n while(b!=0)\n {\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n}\nint main ()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n int max=a[0];\n for(i=1;i<n;i++)\n {\n int x=gcd(a[i],a[0]);\n if(x<max && x!=1) max=x;\n if(x==1) {max=1;break;}\n }\n printf(\"%d\",max*n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[101],i,n,j,sum=0,min=100000,flag,cnt,rem;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(min>a[i])\n\t\t{\n\t\t\tmin=a[i];\n\t\t}\n\t}\n\trem=min;\n\twhile(flag==0)\n\t{\n\t\tmin=rem;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]%min==0)\n\t\t\t{\n\t\t\t\ta[i]=min;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ta[i]=a[i]%min;\n\t\t\t}\n\t\t\tif(rem>a[i])\n\t\t\t{\n\t\t\t\trem=a[i];\n\t\t\t}\n\t\t}\n\t\tif(rem==min)\n\t\t{\n\t\t\tflag=1;\n\t\t}\t\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tsum+=a[i];\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint q,w=1,A[100],i,g,r,x,top;\nint main()\n{\n\tscanf(\"%d\",&q);\n\tfor (i = 0; i <q ; i++)\n\t\tscanf(\"%d\",&A[i]);\n\t\n\tfor (g = 0; g < q; g++)\n\t\tfor (r = 0; r < q; r++)\n\t\t\tif (A[r]>=A[r+1])\n\t\t\t{\n\t\t\t\tx=A[r]; \n\t\t\t\tA[r]=A[r+1]; \n\t\t\t\tA[r+1]=x;\n\t\t\t}\t\n\tif (A[q]==A[1]) w=0;\n\twhile (w)\n\t{\n\t\tif (A[q]==A[1]) w=0;\n\t\tfor (i = q; i > 0 ; i--)\n\t\t\tA[i]-=A[i-1];\n\t\tfor (g = 0; g < q; g++)\n\t\t\tfor (r = 0; r < q; r++)\n\t\t\t\tif (A[r]>=A[r+1])\n\t\t\t\t{\n\t\t\t\t\tx=A[r]; \n\t\t\t\t\tA[r]=A[r+1]; \n\t\t\t\t\tA[r+1]=x;\n\t\t\t\t}\t\n\t}\n\t\n\tfor (i = 1; i <=q ; i++)\n\t\ttop+=A[i];\n\t\t\n\tprintf(\"%d\",top);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(int i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(int i=0;i<n;i++){\n\t\tfor(int j=0;j<n;j++){\n\t\t\twhile(a[i]>a[j]){\n\t\t\t\ta[i]-=a[j];\n\t\t\t}\n\t\t\twhile(a[j]>a[i]){\n\t\t\t\ta[j]-=a[i];\n\t\t\t}\n\t\t}\n\t}\n\n\tint num=0;\n\tfor(int i=0;i<n;i++){\n\t\tnum+=a[i];\n\t}\n\tprintf(\"%d\",num);\n}"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n\nint gcd(int a, int b)\n{\n\tif(b == 0)\n\t return a;\n\telse\n\t\treturn gcd(b,a%b);\t\n}\n\nint main()\n{\n\tint n,i,min=100,max=0;\n\tscanf(\"%d\",&n);\n\tint x[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&x[i]);\n\t\tmax = max>x[i]?max:x[i];\n\t\tmin = min<x[i]?min:x[i];\n\t}\n\tint mingc = min;\n\tint j;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(j != i)\n\t\t\t\tmingc = mingc<gcd(x[i],x[j]) ? mingc:gcd(x[i],x[j]);\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(x[i]%mingc != 0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",n);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",mingc);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,i,j,k,p,sum=0,c=0,t;\n scanf(\"%d\",&n);\n int x[n];\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n while(x[0]!=x[n-1]){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(x[j]<x[i]){\n t=x[i];x[i]=x[j];x[j]=t;\n }}}\n p=x[0];\n for(i=1;i<n;i++){\n if(p<x[i])\n x[i]=x[i]-p;\n }}\n for(i=0;i<n;i++)\n sum+=x[i];\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint gcd(int a, int b)\n{\n if(b == 0) return a;\n return gcd(b, a % b);\n}\nint main()\n{\n int i, n, sum = 0, arr[100];\n for(i = 0; i < 100; i++)\n arr[i] = 0;\n scanf(\"%d\", &n);\n fflush(stdin);\n for(i = 0; i < n; i++)\n scanf(\"%d\", &arr[i]);\n sum = arr[0];\n for(i = 0; i < n - 1; i++)\n {\n sum = gcd(sum, arr[i + 1]);\n }\n printf(\"%d\", n * sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if(b == 0)\n return a;\n else\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int input[101];\n for(int i = 0; i < n; i++)\n scanf(\"%d\", &input[i]);\n int min = 1e9;\n for(int i = 0; i < n - 1; i++) {\n if(gcd(input[i], input[i + 1]) < min)\n min = gcd(input[i], input[i + 1]);\n }\n printf(\"%d\", min * n);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\nvoid swap(int *xp, int *yp)\n{\n int temp = *xp;\n *xp = *yp;\n *yp = temp;\n}\n \n// A function to implement bubble sort\nvoid bubbleSort(int arr[], int n)\n{\n int i, j;\n for (i = 0; i < n-1; i++) \n \n // Last i elements are already in place \n for (j = 0; j < n-i-1; j++) \n if (arr[j] > arr[j+1])\n swap(&arr[j], &arr[j+1]);\n}\n\nint main()\n{\n int n;\n\tscanf(\"%d\",&n);\n\t\n\tint a[n];\n\tfor(int i=0;i<n;i++)\n\t{\n \t\tscanf(\"%d\",&a[i]);\n \t\n\t}\n\n\tbubbleSort(a,n);\n\tfor(int i=0;i<n-1;i++)\n\t{\n\t\tfor(int j=0;j<n;j++)\n\t\t{\n\t\t\ta[j]=a[j]-a[i];\n\t\t\tprintf(\"%d \",a[j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\tprintf(\"%d\",a[n-1]);\n}"}, {"source_code": "#include<stdio.h>\nint n;\nint hcf(int a,int b)\n{\n\tint k,l,o=1,i;\n\tk=b;\n\tfor(i=1;i<=k;i++)\n\t{\n\t\tif((a%i==0)&&(b%i==0))\n\t\t{\n\t\t\to=i;\n\t\t}\n\t}\n\treturn o;\n}\nint main()\n{\n\tint i,j,k,l=0,a2;\n\tint ans,sum=0,min=100000,max=0;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(max<a[i])\n\t\t\tmax=a[i];\n\t\tif(min>a[i])\n\t\t\tmin=a[i];\n\n\t}\n\tans=hcf(max,min);\n\tprintf(\"%d\",ans*n);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nunsigned gcd(unsigned x, unsigned y){\n unsigned wk;\n if(x<y){ wk=x;x=y;y=wk; }\n while(y){\n wk = x%y;\n x=y;\n y=wk;\n }\n return x;\n}\n\nint gcd_a(int n, int a[n]){\n if(n==1) return a[0];\n if(n==2) return gcd(a[0], a[1]);\n int h = n / 2;\n return gcd(gcd_a(h, &a[h-1]), gcd_a(n - h, &a[h]));\n}\n\nint main(){\nint n,j;\nint i=0;\nscanf(\"%d\",&n);\nint A[n];\nfor(i=1;i<n;i++){\n scanf(\"%d\",&A[i]);\n}\n\n int size_A = sizeof(A)/sizeof(*A);\n int gcd = gcd_a(size_A, A);\n printf(\"%d\\n\", gcd*n);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,i,r;\n scanf(\"%d\",&n);\n int arr[n];\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n int min = abs(arr[0]-arr[1]);\n for(i=1; i<n; i++)\n {\n r = abs(arr[i]-arr[i+1]);\n if(r<min)\n {\n min = r;\n }\n }\n if(min==0)\n {\n min = arr[0];\n }\n printf(\"%d\\n\",min*n);\n}\n"}, {"source_code": "#include<stdio.h>\nint f(const void *a,const void *b){\nreturn (*(int*)a-*(int*)b);\n}\nint main()\n{\n int i,j,n,l=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n qsort(a,n,sizeof(int),f);\n while(a[0]>0){\n qsort(a,n,sizeof(int),f);\n for(i=n;i>=1;i--){\n a[i]=a[i]-a[i-1];\n }\n l++;\n }\n int s=0;\n for(i=0;i<n;i++){\n s=s+a[i];\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint gcd(i,j)\n{\n int temp;\n if(i==0)return j;\n if(j==0)return i;\n while(j!=0){\n temp=i;\n i=j;\n j=temp%j;\n }\n return i;\n}\nint main()\n{\n int a,i,gd,sum;\n while(scanf(\"%d\",&a)==1){\n sum=0;\n int b[a];\n for(i=0;i<a;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<a-1;i++){\n gd=gcd(b[i],b[i+1]);\n b[i]=gd;\n b[i+1]=gd;\n }\n for(i=0;i<a;i++){\n sum=sum+b[i];\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint n,sum=0,i,j;\nscanf(\"%d\",&n);\nint a[n];\nfor(i=0;i<n;i++)\nscanf(\"%d\",&a[i]);\nfor(i=0;i<n-1;i++)\n{\nif(a[i]>a[i+1])\n{\nwhile(a[i]-a[i+1]>0)\na[i]=a[i]-a[i+1];\n}\n}\nfor(i=0;i<n-1;i++)\n{\nif(a[i+1]>a[i])\n{\nwhile(a[i+1]-a[i]>0)\na[i+1]=a[i+1]-a[i];\n}\n}\nfor(i=0;i<n-1;i++)\n{\nif(a[i]>a[i+1]||a[i+1]>a[i])\n{\nif(a[i]>a[i+1])\n{\nwhile(a[i]-a[i+1]>0)\na[i]=a[i]-a[i+1];\n}\nelse\n{\nwhile(a[i+1]-a[i]>0)\na[i+1]=a[i+1]-a[i];\n}\n}\n}\nfor(i=0;i<n;i++)\n{\nsum=sum+a[i];\n}\nprintf(\"%d\",sum);\n}"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if(b == 0)\n return a;\n else\n return gcd(b, a % b);\n}\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int input[1000];\n for(int i = 0; i < n; i++)\n scanf(\"%d\", &input[i]);\n int min = 1e9;\n for(int i = 0; i < n - 2; i++) {\n if(gcd(input[i], input[i + 1]) < min)\n min = gcd(input[i], input[i + 1]);\n }\n printf(\"%d\\n\", min * n);\n return 0;\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\tint i,j,arr[200],k;\n\tint sum=0;\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\", &arr[i]);\n\tfor(k=0;k<n;k++)\n\t{\n\tfor(i=0;i<n;i++)\n\t{\n\t\tint max=0;\n\t\tfor(j=0;j<n;j++)\n\t\t{ \n\n\t\t\tif(arr[i]>arr[j] && arr[j]>max)\n\t\t{\n\t\t\t//printf(\"%d \", j);\n\t\t\tmax=arr[j];\n\t\t\t//(\"%d\\n\",max);\n\t\t}\t\n\t\t}\n\tarr[i]-=max;\n\t//printf(\"%d\\n\", arr[i]);\n\t\n}\n}\nfor(i=0;i<n;i++)\nsum+=arr[i];\nprintf(\"%d\", sum);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n int t;\n while(b!=0)\n {\n t=b;\n b=a%b;\n a=t;\n }\n return a;\n}\nint main ()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n int max=a[0];\n for(i=1;i<n;i++)\n {\n if(a[i]==1) continue;\n int x=gcd(a[i],a[0]);\n if(x<max && x!=1) max=x;\n }\n printf(\"%d\",max*n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,sum=0;\n scanf(\"%d\",&n);\n int arr[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n for(i=0;i<n-1;i++)\n {\n while(arr[i]!=arr[i+1])\n {\n if(arr[i]>arr[i+1])\n {\n arr[i]=arr[i]-arr[i+1];\n }\n else if(arr[i]<arr[i+1])\n {\n arr[i+1]=arr[i+1]-arr[i];\n }\n }\n }\n for(i=0;i<n;i++)\n {\n sum=sum+arr[i];\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define SWAP(X, Y) { int T = X; X = Y; Y = T; }\n\nint partition (int *arr, int left, int right);\nvoid quickSort (int *arr, int left, int right);\nint min (int *arr, int n);\nvoid perasma (int *arr, int n, int s);\n\nint main ()\n{\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tint i, nums[n];\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &nums[i]);\n\n\tquickSort(nums, 0, n - 1);\n\n/*\tprintf(\"SORTED\\n\");\n\tfor (i = 0; i < n; i++)\n\t\tprintf(\"\\t%d\", nums[i]);\n\tprintf(\"\\n\");\n*/\n\tfor (i = 0; i < n; i++)\n\t\tperasma(nums, n, i);\n\tprintf(\"PRINTF\\n\");\n\tfor (i = 0; i < n; i++)\n\t\tperasma(nums, n, i);\n\n\tprintf(\"%d\\n\", n * min(nums, n));\n\n\treturn 0;\n}\n\nvoid perasma (int *arr, int n, int s)\n{\n\tint j, quot, rem;\n\tfor (j = s + 1; j < n; j++) {\n\t\tquot = arr[s] / arr[j];\n\t\trem = arr[s] % arr[j];\n\t\tif (rem != 0)\n\t\t\tarr[s] -= quot * arr[j];\n\t\telse\n\t\t\tarr[s] -= (quot - 1) * arr[j];\n\t}\n\tfor (j = 0; j < s; j++) {\n\t\tquot = arr[s] / arr[j];\n\t\trem = arr[s] % arr[j];\n\t\tif (rem != 0)\n\t\t\tarr[s] -= quot * arr[j];\n\t\telse\n\t\t\tarr[s] -= (quot - 1) * arr[j];\n\t}\n}\n\nint min (int *arr, int n)\n{\n\tint i, ret = arr[0];\n\tfor (i = 1; i < n; i++)\n\t\tif (arr[i] < ret)\n\t\t\tret = arr[i];\n\treturn ret;\n}\n\nint partition (int *arr, int left, int right)\n{\n\tint pivot = arr[left],\n\t i = left - 1,\n\t j = right + 1;\n\twhile (1) {\n\t\twhile (arr[++i] > pivot);\n\t\twhile (arr[--j] < pivot);\n\t\tif (i < j) {\n\t\t\tSWAP(arr[i], arr[j]);\n\t\t}\n\t\telse\n\t\t\treturn j;\n\t}\n}\n\nvoid quickSort (int *arr, int left, int right)\n{\n\tif (left >= right)\n\t\treturn;\n\tint q = partition(arr, left, right);\n\tquickSort(arr, left, q);\n\tquickSort(arr, q + 1, right);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, a[101], i, min, flag;\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n \n flag=1;\n while(flag==1)\n {\n min=101;\n flag=0;\n for(i=0; i<n; i++)\n {\n if(min>a[i])\n {\n min=a[i];\n }\n }\n \n for(i=0; i<n; i++)\n {\n while(a[i]-min>0)\n a[i]-=min;\n }\n \n for(i=1; i<n; i++)\n {\n if(a[i]!=a[i-1])\n flag=1;\n }\n }\n \n int sum=0;\n for(i=0; i<n; i++)\n {\n printf(\"%d \", a[i]);\n sum+=a[i];\n }\n \n printf(\"\\n%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint comp(const void * a,const void *b);\nint main(){\n int n;\n scanf(\"%d\",&n);\n int i,j,ans=0;\n int num[n];\n int temp;\n for(i=0;i<n;i++)\n scanf(\"%d\",&num[i]);\n qsort((void*)num,n,sizeof(int),comp);\n temp=num[n-1];\n for(i=n-2;i>=0;i--){\n for(j=n-2;j>=0;j--){\n if(temp>num[j]){\n temp=temp-num[j];\n }\n }\n ans+=num[i];\n }\n printf(\"%d\\n\",temp*n);\n return 0;\n}\n\nint comp(const void * a,const void *b){\n return *(int*)a>*(int*)b?1:-1;\n}\n"}, {"source_code": "#include<stdio.h>\nint solve(int a,int b)\n{ \n while(a!=b)\n {\n if(a>b)\n a-=b;\n else\n b-=a;\n }\n return a;\n}\nint main()\n{\n int a,b,sum=0,ans,n;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&a,&b);\n ans=solve(a,b);\n sum+=ans*2;\n n-=2;\n while(n--)\n {\n scanf(\"%d\",&a);\n ans=solve(ans,a);\n sum+=ans;\n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint factor(int a,int b)\n{\n while(a != b)\n {\n if(a>b)\n a-=b;\n else if(a<b)\n b-=a;\n }\n return a;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int num[200]= {0},ans=1000000;\n for(int i=0; i<n; i++)\n scanf(\"%d\",&num[i]);\n for(int i=0; i<n; i++)\n {\n for(int j=0; j<n; j++)\n {\n if(factor(num[i],num[j])<ans)\n ans=factor(num[i],num[j]);\n }\n }\n printf(\"%d\\n\",ans*n);\n return 0;\n}\n"}], "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4"} {"nl": {"description": "During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation of one face of the cube in any direction.To check her answers she wants to use a program which will for some state of cube tell if it's possible to solve it using one rotation, described above.Cube is called solved if for each face of cube all squares on it has the same color.https://en.wikipedia.org/wiki/Rubik's_Cube", "input_spec": "In first line given a sequence of 24 integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u20096), where ai denotes color of i-th square. There are exactly 4 occurrences of all colors in this sequence.", "output_spec": "Print \u00abYES\u00bb (without quotes) if it's possible to solve cube using one rotation and \u00abNO\u00bb (without quotes) otherwise.", "sample_inputs": ["2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4", "5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3"], "sample_outputs": ["NO", "YES"], "notes": "NoteIn first test case cube looks like this: In second test case cube looks like this: It's possible to solve cube by rotating face with squares with numbers 13, 14, 15, 16."}, "positive_code": [{"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n\nint same(int a, int b, int c, int d) {\n\treturn a == b && b == c && c == d;\n}\n\nint check(int a13, int a14, int a5, int a6, int a17, int a18, int a21, int a22,\n\t\tint a15, int a16, int a7, int a8, int a19, int a20, int a23, int a24) {\n\treturn same(a15, a16, a5, a6) && same(a7, a8, a17, a18) && same(a19, a20, a21, a22) && same(a23, a24, a13, a14)\n\t\t|| same(a13, a14, a7, a8) && same(a5, a6, a19, a20) && same(a17, a18, a23, a24) && same(a21, a22, a15, a16);\n}\n\nint main() {\n\tint a1, a2, a3, a4,\n\ta5, a6, a7, a8,\n\ta9, a10, a11, a12,\n\ta13, a14, a15, a16,\n\ta17, a18, a19, a20,\n\ta21, a22, a23, a24;\n\n\tscanf(\"%d%d%d%d\", &a1, &a2, &a3, &a4);\n\tscanf(\"%d%d%d%d\", &a5, &a6, &a7, &a8);\n\tscanf(\"%d%d%d%d\", &a9, &a10, &a11, &a12);\n\tscanf(\"%d%d%d%d\", &a13, &a14, &a15, &a16);\n\tscanf(\"%d%d%d%d\", &a17, &a18, &a19, &a20);\n\tscanf(\"%d%d%d%d\", &a21, &a22, &a23, &a24);\n\tif (same(a1, a2, a3, a4) && same(a9, a10, a11, a12) && check(\n\t\t\t\ta13, a14, a5, a6, a17, a18, a21, a22,\n\t\t\t\ta15, a16, a7, a8, a19, a20, a23, a24)) {\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tif (same(a5, a6, a7, a8) && same(a21, a22, a23, a24) && check(\n\t\t\t\ta9, a10, a19, a17, a4, a3, a14, a16,\n\t\t\t\ta11, a12, a20, a18, a2, a1, a13, a15)) {\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tif (same(a13, a14, a15, a16) && same(a17, a18, a19, a20) && check(\n\t\t\t\ta11, a9, a7, a5, a3, a1, a22, a24,\n\t\t\t\ta12, a10, a8, a6, a4, a2, a21, a23)) {\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check_equal(int arr[],int a,int b,int c,int d){\n if(arr[a]==arr[b] && arr[b]==arr[c] && arr[c]==arr[d])\n return 1;\n return 0;\n}\n\nint main(){\n int i,arr[25];\n for(i=1;i<=24;i++){\n scanf(\"%d\",&arr[i]);\n }\n if(check_equal(arr,13,14,15,16) && check_equal(arr,17,18,19,20)){\n if(check_equal(arr,1,3,6,8) && check_equal(arr,2,4,22,24) && check_equal(arr,5,7,10,12) && check_equal(arr,9,11,21,23))\n printf(\"yes\");\n else if(check_equal(arr,2,4,5,7) && check_equal(arr,1,3,21,23) && check_equal(arr,6,8,9,11) && check_equal(arr,10,12,22,24))\n printf(\"yes\");\n else\n printf(\"no\");\n }\n else if(check_equal(arr,1,2,3,4) && check_equal(arr,9,10,11,12)){\n if(check_equal(arr,13,14,7,8) && check_equal(arr,5,6,19,20) && check_equal(arr,17,18,23,24) && check_equal(arr,21,22,15,16))\n printf(\"yes\");\n else if(check_equal(arr,5,6,15,16) && check_equal(arr,17,18,7,8) && check_equal(arr,21,22,19,20) && check_equal(arr,13,14,23,24))\n printf(\"yes\");\n else\n printf(\"no\");\n }\n else if(check_equal(arr,5,6,7,8) && check_equal(arr,21,22,23,24)){\n if(check_equal(arr,1,2,14,16) && check_equal(arr,3,4,18,20) && check_equal(arr,17,19,11,12) && check_equal(arr,9,10,13,15))\n printf(\"yes\");\n else if(check_equal(arr,3,4,13,15) && check_equal(arr,14,16,11,12) && check_equal(arr,9,10,18,20) && check_equal(arr,17,19,1,2))\n printf(\"yes\");\n else\n printf(\"no\");\n }\n else\n printf(\"no\");\n return 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i=0;\n\tint a[24]={0};\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\n\tint sum=0;\n\n\tif(a[1]==a[2] && a[1]==a[3] && a[1]==a[4])sum++;\n\tif(a[9]==a[10] && a[9]==a[11] && a[9]==a[12])sum++;\n\tif(a[15]==a[16] && a[15]==a[5] && a[15]==a[6])sum++;\n\tif(a[7]==a[8] && a[7]==a[17] && a[7]==a[18])sum++;\n\tif(a[19]==a[20] && a[19]==a[21] && a[19]==a[22])sum++;\n\tif(a[23]==a[24] && a[23]==a[13] && a[23]==a[14])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\n\t\n\tif(a[1]==a[2] && a[1]==a[3] && a[1]==a[4])sum++;\n\tif(a[9]==a[10] && a[9]==a[11] && a[9]==a[12])sum++;\n\tif(a[15]==a[16] && a[15]==a[21] && a[15]==a[22])sum++;\n\tif(a[7]==a[8] && a[7]==a[13] && a[7]==a[14])sum++;\n\tif(a[19]==a[20] && a[19]==a[5] && a[19]==a[6])sum++;\n\tif(a[23]==a[24] && a[23]==a[17] && a[23]==a[18])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\n\tif(a[1]==a[2] && a[1]==a[3] && a[1]==a[4])sum++;\n\tif(a[9]==a[10] && a[9]==a[11] && a[9]==a[12])sum++;\n\tif(a[13]==a[14] && a[13]==a[7] && a[13]==a[8])sum++;\n\tif(a[5]==a[6] && a[5]==a[19] && a[5]==a[20])sum++;\n\tif(a[17]==a[18] && a[17]==a[23] && a[17]==a[24])sum++;\n\tif(a[21]==a[22] && a[21]==a[15] && a[21]==a[16])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\n\tif(a[1]==a[2] && a[1]==a[3] && a[1]==a[4])sum++;\n\tif(a[9]==a[10] && a[9]==a[11] && a[9]==a[12])sum++;\n\tif(a[13]==a[14] && a[13]==a[23] && a[13]==a[24])sum++;\n\tif(a[5]==a[6] && a[5]==a[15] && a[5]==a[16])sum++;\n\tif(a[17]==a[18] && a[17]==a[7] && a[17]==a[8])sum++;\n\tif(a[21]==a[22] && a[21]==a[19] && a[21]==a[20])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\tif(a[5]==a[6] && a[5]==a[7] && a[5]==a[8])sum++;\n\tif(a[21]==a[22] && a[21]==a[23] && a[21]==a[24])sum++;\n\tif(a[13]==a[15] && a[13]==a[9] && a[13]==a[10])sum++;\n\tif(a[11]==a[12] && a[11]==a[17] && a[11]==a[19])sum++;\n\tif(a[18]==a[20] && a[18]==a[3] && a[18]==a[4])sum++;\n\tif(a[1]==a[2] && a[1]==a[14] && a[1]==a[16])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\n\tif(a[5]==a[6] && a[5]==a[7] && a[5]==a[8])sum++;\n\tif(a[21]==a[22] && a[21]==a[23] && a[21]==a[24])sum++;\n\tif(a[13]==a[15] && a[13]==a[3] && a[13]==a[4])sum++;\n\tif(a[11]==a[12] && a[11]==a[14] && a[11]==a[16])sum++;\n\tif(a[18]==a[20] && a[18]==a[9] && a[18]==a[10])sum++;\n\tif(a[1]==a[2] && a[1]==a[17] && a[1]==a[19])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\n\tif(a[5]==a[6] && a[5]==a[7] && a[5]==a[8])sum++;\n\tif(a[21]==a[22] && a[21]==a[23] && a[21]==a[24])sum++;\n\tif(a[14]==a[16] && a[14]==a[1] && a[14]==a[2])sum++;\n\tif(a[3]==a[4] && a[3]==a[18] && a[3]==a[20])sum++;\n\tif(a[17]==a[19] && a[17]==a[11] && a[17]==a[12])sum++;\n\tif(a[9]==a[10] && a[9]==a[13] && a[9]==a[15])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\n\tif(a[5]==a[6] && a[5]==a[7] && a[5]==a[8])sum++;\n\tif(a[21]==a[22] && a[21]==a[23] && a[21]==a[24])sum++;\n\tif(a[14]==a[16] && a[14]==a[11] && a[14]==a[12])sum++;\n\tif(a[9]==a[10] && a[9]==a[18] && a[9]==a[20])sum++;\n\tif(a[17]==a[19] && a[17]==a[1] && a[17]==a[2])sum++;\n\tif(a[3]==a[4] && a[3]==a[13] && a[3]==a[15])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\t\n\t\t\n\tif(a[13]==a[14] && a[13]==a[15] && a[13]==a[16])sum++;\n\tif(a[17]==a[18] && a[17]==a[19] && a[17]==a[20])sum++;\n\tif(a[5]==a[7] && a[5]==a[2] && a[5]==a[4])sum++;\n\tif(a[1]==a[3] && a[1]==a[21] && a[1]==a[23])sum++;\n\tif(a[9]==a[11] && a[9]==a[6] && a[9]==a[8])sum++;\n\tif(a[22]==a[24] && a[22]==a[10] && a[22]==a[12])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\tif(a[13]==a[14] && a[13]==a[15] && a[13]==a[16])sum++;\n\tif(a[17]==a[18] && a[17]==a[19] && a[17]==a[20])sum++;\n\tif(a[5]==a[7] && a[5]==a[10] && a[5]==a[12])sum++;\n\tif(a[1]==a[3] && a[1]==a[6] && a[1]==a[8])sum++;\n\tif(a[9]==a[11] && a[9]==a[21] && a[9]==a[23])sum++;\n\tif(a[22]==a[24] && a[22]==a[2] && a[22]==a[4])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\tif(a[13]==a[14] && a[13]==a[15] && a[13]==a[16])sum++;\n\tif(a[17]==a[18] && a[17]==a[19] && a[17]==a[20])sum++;\n\tif(a[2]==a[4] && a[2]==a[5] && a[2]==a[7])sum++;\n\tif(a[6]==a[8] && a[6]==a[9] && a[6]==a[11])sum++;\n\tif(a[10]==a[12] && a[10]==a[22] && a[10]==a[24])sum++;\n\tif(a[21]==a[23] && a[21]==a[1] && a[21]==a[3])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\tif(a[13]==a[14] && a[13]==a[15] && a[13]==a[16])sum++;\n\tif(a[17]==a[18] && a[17]==a[19] && a[17]==a[20])sum++;\n\tif(a[2]==a[4] && a[2]==a[22] && a[2]==a[24])sum++;\n\tif(a[6]==a[8] && a[6]==a[1] && a[6]==a[3])sum++;\n\tif(a[10]==a[12] && a[10]==a[5] && a[10]==a[7])sum++;\n\tif(a[21]==a[23] && a[21]==a[9] && a[21]==a[11])sum++;\n\tif(sum==6){printf(\"YES\\n\");return 0;}\n\t\n\tsum=0;\n\t\t\n\tprintf(\"NO\\n\");\n\treturn 0;\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nvoid check(int a[])\n{\n for(int i=1;i<=24;i++)\n {\n int j=i-1;\n if(a[i]!=a[j/4*4+1])return;\n }\n printf(\"YES\");\n exit(0);\n}\nint main()\n{\n int a[25]={0},b[25]={0};\n for(int i=1;i<=24;i++)\n scanf(\"%d\",&a[i]);\n for(int i=1;i<=24;i++)b[i]=a[i];\n int c[8]={1,3,5,7,9,11,22,24};\n \n int x=b[c[0]],y=b[c[1]];\n b[c[0]]=b[c[6]];b[c[1]]=b[c[7]];b[c[6]]=b[c[4]];b[c[7]]=b[c[5]];\n b[c[4]]=b[c[2]];b[c[5]]=b[c[3]];b[c[2]]=x;b[c[3]]=y;\n check(b);\n for(int i=1;i<=24;i++)b[i]=a[i];\n int d[8]={3,1,24,22,11,9,7,5};\n \n x=b[d[0]];y=b[d[1]];\n b[d[0]]=b[d[6]];b[d[1]]=b[d[7]];b[d[6]]=b[d[4]];b[d[7]]=b[d[5]];\n b[d[4]]=b[d[2]];b[d[5]]=b[d[3]];b[d[2]]=x;b[d[3]]=y;\n check(b);\n for(int i=1;i<=24;i++)b[i]=a[i];\n int e[8]={15,16,7,8,19,20,23,24};\n \n x=b[e[0]];y=b[e[1]];\n b[e[0]]=b[e[6]];b[e[1]]=b[e[7]];b[e[6]]=b[e[4]];b[e[7]]=b[e[5]];\n b[e[4]]=b[e[2]];b[e[5]]=b[e[3]];b[e[2]]=x;b[e[3]]=y;\n check(b);\n for(int i=1;i<=24;i++)b[i]=a[i];\n int f[8]={16,15,24,23,20,19,8,7};\n \n x=b[f[0]];y=b[f[1]];\n b[f[0]]=b[f[6]];b[f[1]]=b[f[7]];b[f[6]]=b[f[4]];b[f[7]]=b[f[5]];\n b[f[4]]=b[f[2]];b[f[5]]=b[f[3]];b[f[2]]=x;b[f[3]]=y;\n check(b);for(int i=1;i<=24;i++)b[i]=a[i];\n \n int g[8]={3,4,17,19,10,9,16,14};\n x=b[g[0]];y=b[g[1]];\n b[g[0]]=b[g[6]];b[g[1]]=b[g[7]];b[g[6]]=b[g[4]];b[g[7]]=b[g[5]];\n b[g[4]]=b[g[2]];b[g[5]]=b[g[3]];b[g[2]]=x;b[g[3]]=y;\n check(b);for(int i=1;i<=24;i++)b[i]=a[i];\n \n int h[8]={4,3,14,16,9,10,19,17};\n x=b[h[0]];y=b[h[1]];\n b[h[0]]=b[h[6]];b[h[1]]=b[h[7]];b[h[6]]=b[h[4]];b[h[7]]=b[h[5]];\n b[h[4]]=b[h[2]];b[h[5]]=b[h[3]];b[h[2]]=x;b[h[3]]=y; \n check(b);\n printf(\"NO\");\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint ok(int a[24]) {\n\tfor (int i = 0; i < 6; i++)\n\t\tif (a[i * 4] != a[i * 4 + 1] || a[i * 4 + 1] != a[i * 4 + 2] || a[i * 4 + 2] != a[i * 4 + 3])\n\t\t\treturn 0;\n\treturn 1;\n}\n\nconst int d[6][8] = {\n\t{1, 3, 5, 7, 9, 11, 24, 22},\n\t{3, 4, 17, 19, 10, 9, 16, 14},\n\t{4, 2, 21, 23, 12, 10, 8, 6},\n\t{2, 1, 13, 15, 11, 12, 20, 18},\n\t{6, 5, 14, 13, 22, 21, 18, 17},\n\t{7, 8, 19, 20, 23, 24, 15, 16},\n};\n\nint main(void) {\n\tint a[24], b[24];\n\n\tfor (int i = 0; i < 24; i++)\n\t\tscanf(\"%d\", a + i);\n\n\tfor (int i = 0; i < 6; i++) {\n\t\tint t1, t2;\n\n\t\tmemcpy(b, a, sizeof a);\n\n\t\tt1 = b[d[i][0] - 1];\n\t\tt2 = b[d[i][1] - 1];\n\t\tfor (int j = 0; j < 6; j++)\n\t\t\tb[d[i][j] - 1] = b[d[i][j + 2] - 1];\n\t\tb[d[i][6] - 1] = t1;\n\t\tb[d[i][7] - 1] = t2;\n\n\t\tif (ok(b)) {\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tmemcpy(b, a, sizeof a);\n\n\t\tt1 = b[d[i][6] - 1];\n\t\tt2 = b[d[i][7] - 1];\n\t\tfor (int j = 7; j >= 2; j--)\n\t\t\tb[d[i][j] - 1] = b[d[i][j - 2] - 1];\n\t\tb[d[i][0] - 1] = t1;\n\t\tb[d[i][1] - 1] = t2;\n\n\t\tif (ok(b)) {\n\t\t\tputs(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\tputs(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint cnt[10],s[8][6],sum,maxn,res;\nint max(int a,int b){return a>b?a:b;}\nint main()\n{\n int i,j;\n for(i=1;i<=6;i++)\n {\n \tfor(j=1;j<=6;j++)cnt[j]=0;\n\tsum=0;maxn=0;\n for(j=1;j<=4;j++)\n {\n scanf(\"%d\",&s[i][j]);\n if(!cnt[s[i][j]])sum++;\n cnt[s[i][j]]++;\n maxn=max(maxn,cnt[s[i][j]]);\n }\n\tif(sum>2){printf(\"NO\\n\");return 0;}\n\tif(maxn==3){printf(\"NO\\n\");return 0;}\n\tif(sum==2&&maxn==2&&s[i][1]==s[i][4])\n\t{printf(\"NO\\n\");return 0;}\n\tif(sum==1)res++;\n }\n if(res!=2){printf(\"NO\\n\");return 0;}\n if(s[1][1]==s[1][3])\n if(s[2][1]==s[2][3])\n if(s[3][1]==s[3][3])\n if(s[6][1]==s[6][3])\n {\n\t\t if(s[1][1]==s[2][2])\n if(s[2][1]==s[3][2])\n if(s[3][1]==s[6][1])\n if(s[6][2]==s[1][2])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[1][1]==s[6][1])\n if(s[2][1]==s[1][2])\n if(s[3][1]==s[2][2])\n if(s[6][2]==s[3][2])\n {printf(\"YES\\n\");return 0;}\n\t\t}\n if(s[2][1]==s[2][2])\n if(s[4][1]==s[4][2])\n if(s[5][1]==s[5][2])\n if(s[6][1]==s[6][2])\n {\n\t\t if(s[2][1]==s[5][3])\n if(s[5][1]==s[6][3])\n if(s[6][1]==s[4][3])\n if(s[4][1]==s[2][3])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[2][1]==s[4][3])\n if(s[4][1]==s[6][3])\n if(s[6][1]==s[5][3])\n if(s[5][1]==s[2][3])\n {printf(\"YES\\n\");return 0;}\n }\n if(s[1][1]==s[1][2])\n if(s[5][1]==s[5][3])\n if(s[3][1]==s[3][2])\n if(s[4][1]==s[4][3])\n {\n\t\t if(s[1][1]==s[5][1])\n if(s[5][2]==s[3][1])\n if(s[3][3]==s[4][2])\n if(s[4][1]==s[1][3])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[1][1]==s[4][2])\n if(s[4][1]==s[3][1])\n if(s[3][3]==s[5][1])\n if(s[5][2]==s[1][3])\n {printf(\"YES\\n\");return 0;}\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isSolved(int r[])\n{\n int i;\n /*\n for(i=1;i<=24;i++)\n printf(\"%d \", r[i]);\n printf(\"\\n\\n\");\n*/\n for(i=1;i<=24;i=i+4)\n if(!(r[i+1] == r[i] && r[i+2] == r[i] && r[i+3] == r[i]))\n return 0;\n\n return 1;\n}\n\nvoid rotate13_14_15_16(int r[])\n{\n int aux1, aux2;\n aux1 = r[24];\n aux2 = r[22];\n r[24] = r[1];\n r[22] = r[3];\n r[1] = r[5];\n r[3] = r[7];\n r[5] = r[9];\n r[7] = r[11];\n r[9] = aux1;\n r[11] = aux2;\n\n}\n\n\n\nvoid rotate17_18_19_20(int r[])\n{\n int aux1, aux2;\n aux1 = r[23];\n aux2 = r[21];\n r[23] = r[2];\n r[21] = r[4];\n r[2] = r[6];\n r[4] = r[8];\n r[6] = r[10];\n r[8] = r[12];\n r[10] = aux1;\n r[12] = aux2;\n}\n\nvoid rotate1_2_3_4(int r[])\n{\n int aux1, aux2;\n aux1 = r[13];\n aux2 = r[14];\n r[13] = r[5];\n r[14] = r[6];\n r[5] = r[17];\n r[6] = r[18];\n r[17] = r[21];\n r[18] = r[22];\n r[21] = aux1;\n r[22] = aux2;\n}\n\nvoid rotate9_10_11_12(int r[])\n{\n int aux1, aux2;\n aux1 = r[15];\n aux2 = r[16];\n r[15] = r[7];\n r[16] = r[8];\n r[7] = r[19];\n r[8] = r[20];\n r[19] = r[23];\n r[20] = r[24];\n r[23] = aux1;\n r[24] = aux2;\n}\n\nvoid rotate5_6_7_8(int r[])\n{\n int aux1, aux2;\n aux1 = r[3];\n aux2 = r[4];\n r[3] = r[17];\n r[4] = r[19];\n r[17] = r[10];\n r[19] = r[9];\n r[10] = r[16];\n r[9] = r[14];\n r[16] = aux1;\n r[14] = aux2;\n}\n\nvoid rotate21_22_23_24(int r[])\n{\n int aux1, aux2;\n aux1 = r[1];\n aux2 = r[2];\n r[1] = r[18];\n r[2] = r[20];\n r[18] = r[12];\n r[20] = r[11];\n r[12] = r[15];\n r[11] = r[13];\n r[15] = aux1;\n r[13] = aux2;\n}\n\nint main()\n{\n int i, r[25], k;\n\n void (*p[6])(int[]);\n p[0] = rotate13_14_15_16;\n p[1] = rotate17_18_19_20;\n p[2] = rotate1_2_3_4;\n p[3] = rotate9_10_11_12;\n p[4] = rotate5_6_7_8;\n p[5] = rotate21_22_23_24;\n\n for(i=1;i<=24;i++)\n scanf(\"%d\", &r[i]);\n\n for(k=0; k<6; k++)\n for(i=1;i<=4; i++)\n {\n (*p[k])(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n\n printf(\"no\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n/* http://codeforces.com/contest/887/submission/34979547 (Dukkha) */\n\nint same(int a1, int a2, int a3, int a4) {\n\treturn a1 == a2 && a2 == a3 && a3 == a4;\n}\n\nint check_(\n\t\tint a1, int a2, int a3, int a4,\n\t\tint a5, int a6, int a7, int a8,\n\t\tint a9, int a10, int a11, int a12,\n\t\tint a13, int a14, int a15, int a16)\n{\n\tint r1, r2;\n\n\tif (a1 != a3 || a2 != a4 || a5 != a7 || a6 != a8\n\t\t\t|| a9 != a11 || a10 != a12 || a13 != a15 || a14 != a16)\n\t\treturn 0;\n\tr1 = a1 == a6 && a5 == a10 && a9 == a14 && a13 == a2;\n\tr2 = a2 == a5 && a6 == a9 && a10 == a13 && a14 == a1;\n\treturn r1 || r2;\n}\n\nint check(\n\t\tint a1, int a2, int a3, int a4,\n\t\tint a5, int a6, int a7, int a8,\n\t\tint a9, int a10, int a11, int a12,\n\t\tint a13, int a14, int a15, int a16,\n\t\tint a17, int a18, int a19, int a20,\n\t\tint a21, int a22, int a23, int a24)\n{\n\tint r1 = same(a1, a2, a3, a4) && same(a9, a10, a11, a12)\n\t\t&& check_(a15, a13, a16, a14, a7, a5, a8, a6,\n\t\t\t\ta19, a17, a20, a18, a23, a21, a24, a22);\n\tint r2 = same(a13, a14, a15, a16) && same(a17, a18, a19, a20)\n\t\t&& check_(a1, a2, a3, a4, a5, a6, a7, a8,\n\t\t\t\ta9, a10, a11, a12, a24, a23, a22, a21);\n\treturn r1 || r2;\n}\n\nint main() {\n\tint a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, r1, r2;\n\t\n\tscanf(\"%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d\",\n\t\t\t&a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8,\n\t\t\t&a9, &a10, &a11, &a12, &a13, &a14, &a15, &a16,\n\t\t\t&a17, &a18, &a19, &a20, &a21, &a22, &a23, &a24);\n\tr1 = check(a1, a2, a3, a4, a5, a6, a7, a8,\n\t\t\ta9, a10, a11, a12, a13, a14, a15, a16,\n\t\t\ta17, a18, a19, a20, a21, a22, a23, a24);\n\tr2 = check(a3, a1, a4, a2, a17, a18, a19, a20,\n\t\t\ta10, a12, a9, a11, a5, a6, a7, a8,\n\t\t\ta21, a22, a23, a24, a13, a14, a15, a16);\n\tprintf(r1 || r2 ? \"YES\\n\" : \"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\n\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 2, 4, 2, 4 };\n\nint a3[] = { 1, 2, 1, 2, 3, 4, 3, 4, 2, 1, 2, 1, 5, 5, 5, 5, 6, 6, 6, 6, 1, 2, 1, 2 };\n\n#define N\t24\n\nint check_(int *aa, int *bb) {\n\tstatic int match[7], used[7];\n\tint i;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[bb[i]]) || (match[aa[i]] != -1 && match[aa[i]] != bb[i]))\n\t\t\treturn 0;\n\t\tused[bb[i]] = 1;\n\t\tmatch[aa[i]] = bb[i];\n\t}\n\treturn 1;\n}\n\nint check(int *aa) {\n\treturn check_(aa, a1) || check_(aa, a2) || check_(aa, a3);\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tbb[0] = aa[1], bb[1] = aa[3], bb[2] = aa[0], bb[3] = aa[2];\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[8] = aa[10], bb[9] = aa[8], bb[10] = aa[11], bb[11] = aa[9];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[14], cc[1] = aa[12], cc[2] = aa[15], cc[3] = aa[13];\n\tcc[4] = aa[6], cc[5] = aa[4], cc[6] = aa[7], cc[7] = aa[5];\n\tcc[8] = aa[18], cc[9] = aa[16], cc[10] = aa[19], cc[11] = aa[17];\n\tcc[12] = aa[10], cc[13] = aa[8], cc[14] = aa[11], cc[15] = aa[9];\n\tcc[16] = aa[2], cc[17] = aa[0], cc[18] = aa[3], cc[19] = aa[1];\n\tcc[20] = aa[21], cc[21] = aa[23], cc[22] = aa[20], cc[23] = aa[22];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[30],k=0,B[7];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[24]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[23]&&A[23]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if(A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n\t\n\tint node[25];\n\tint check = 0;\n\t\n\tfor(int i = 1 ; i <= 24 ; i++)\n\t\tscanf(\"%d\" , &node[i]);\n\t\t\n\t//************************a1\n\tif(\n\tnode[1] == node[3] &&\n\tnode[1] == node[6] &&\n\tnode[1] == node[8]\n\t\t)\n\tif(\n\tnode[5] == node[7] &&\n\tnode[5] == node[10] &&\n\tnode[5] == node[12] \n\t)\n\tif(\n\tnode[9] == node[11] &&\n\tnode[9] == node[21] &&\n\tnode[9] == node[23] \n\t)\n\tif(\n\tnode[2] == node[4] &&\n\tnode[2] == node[22] &&\n\tnode[2] == node[24] \n\t)\n\tcheck = 1;\n\t//****************************a2\n\tif(\n\tnode[1] == node[3] &&\n\tnode[1] == node[21] &&\n\tnode[1] == node[23]\n\t\t)\n\tif(\n\tnode[5] == node[7] &&\n\tnode[5] == node[2] &&\n\tnode[5] == node[4] \n\t)\n\tif(\n\tnode[9] == node[11] &&\n\tnode[9] == node[6] &&\n\tnode[9] == node[8] \n\t)\n\tif(\n\tnode[22] == node[24] &&\n\tnode[22] == node[10] &&\n\tnode[22] == node[12] \n\t)\n\tcheck = 1;\n\t//****************************b1\n\tif(\n\tnode[13] == node[14] &&\n\tnode[13] == node[7] &&\n\tnode[13] == node[8]\n\t\t)\n\tif(\n\tnode[5] == node[6] &&\n\tnode[5] == node[19] &&\n\tnode[5] == node[20] \n\t)\n\tif(\n\tnode[17] == node[18] &&\n\tnode[17] == node[23] &&\n\tnode[17] == node[24] \n\t)\n\tif(\n\tnode[22] == node[21] &&\n\tnode[22] == node[15] &&\n\tnode[22] == node[16] \n\t)\n\tcheck = 1;\n\t//****************************b2\n\tif(\n\tnode[13] == node[14] &&\n\tnode[13] == node[23] &&\n\tnode[13] == node[24]\n\t\t)\n\tif(\n\tnode[5] == node[6] &&\n\tnode[5] == node[15] &&\n\tnode[5] == node[16] \n\t)\n\tif(\n\tnode[17] == node[18] &&\n\tnode[17] == node[7] &&\n\tnode[17] == node[8] \n\t)\n\tif(\n\tnode[22] == node[21] &&\n\tnode[22] == node[19] &&\n\tnode[22] == node[20] \n\t)\n\tcheck = 1;\n\t//****************************c1\n\tif(\n\tnode[3] == node[4] &&\n\tnode[3] == node[18] &&\n\tnode[3] == node[20]\n\t\t)\n\tif(\n\tnode[17] == node[19] &&\n\tnode[17] == node[11] &&\n\tnode[17] == node[12] \n\t)\n\tif(\n\tnode[9] == node[10] &&\n\tnode[9] == node[13] &&\n\tnode[9] == node[15] \n\t)\n\tif(\n\tnode[14] == node[16] &&\n\tnode[14] == node[1] &&\n\tnode[14] == node[2] \n\t)\n\tcheck = 1;\n\t//****************************c2\n\tif(\n\tnode[3] == node[4] &&\n\tnode[3] == node[13] &&\n\tnode[3] == node[15]\n\t\t)\n\tif(\n\tnode[17] == node[19] &&\n\tnode[17] == node[1] &&\n\tnode[17] == node[2] \n\t)\n\tif(\n\tnode[9] == node[10] &&\n\tnode[9] == node[18] &&\n\tnode[9] == node[20] \n\t)\n\tif(\n\tnode[14] == node[16] &&\n\tnode[14] == node[11] &&\n\tnode[14] == node[12] \n\t)\n\tcheck = 1;\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\tif(check) printf(\"YES\");\n\telse printf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define LL long long\n#define uLL unsigned long long\n#define uL unsigned long\n#define uC unsigned char\nvoid print(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld,\",a[i]);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nvoid print2(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld[%ld],\",a[i],i);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nlong id[]={24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};\nlong R[]={24,1,2,16,14,7,5,8,6,19,17,11,12,13,9,15,10,3,18,4,20,21,22,23,24};\nlong Rt[100];\nlong F1[]={24,24,23,22,21,1,2,3,4,5,6,7,8,15,13,16,14,18,20,17,19,12,11,10,9};\nlong F2[]={24,2,4,1,3,13,14,15,16,11,9,12,10,21,22,23,24,5,6,7,8,17,18,19,20};\nvoid ColorTransfer(long *color,long *pol,long *ans)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=color[i];\n\t}\n}\nvoid PermutationTransfer(long *pol1,long *pol2,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol1[0];i++)\n\t{\n\t\tans[i]=pol2[pol1[i]];\n\t}\n\tans[0]=pol1[0];\n}\nvoid PermutationInverse(long *pol,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=i;\n\t}\n\tans[0]=pol[0];\n}\nvoid copy(long *a,long *b)\n{\n\tlong i;for (i=0;i<=b[0];i++) {a[i]=b[i];}\n}\nlong cp1[]={8,4,1,2,3,8,5,6,7};\nlong cp2[]={8,5,8,7,6,1,4,3,2};\nint check2(long *clr)\n{\n\tlong i;\n\tfor (i=1;i<=8;i++)\n\t{\n\t\tif (clr[i]!=i) {return 0;}\n\t}\n\treturn 1;\n}\nint check(long *clr)\n{\n\tlong temp[10],temp2[10],i,j,k,c;\n\tk=1;\n\tfor (i=1;i<=6;i++)\n\t{\n\t\tc=clr[k++];\n\t\tfor (j=2;j<=4;j++)\n\t\t{\n\t\t\tif (clr[k++]!=c) {return 0;}\n\t\t}\n\t\ttemp[i]=c;\n\t}\n\treturn 1;\n}\n\nlong per[100][100];\nlong t1[100],t2[100],t3[100];\nvoid debug()\n{\n\tlong i,j;\n\tfor (i=1;i<=12;i++)\n\t{\n\t\tprint(per[i],24);\n\t}\n}\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tlong i,j,k,a,b,c;\n\tPermutationInverse(R,Rt);\n\tcopy(t1,id);copy(t2,id);\n\tfor (i=1;i<=8;i+=2)\n\t{\n\t\tPermutationTransfer(t1,R,per[i]);\n\t\tPermutationTransfer(t1,Rt,per[i+1]);\n\t\tPermutationTransfer(t2,F2,t1);\n\t\tcopy(t2,t1);\n//\t\tprint(t1,24);\n//\t\tprintf(\"%ld %ld\\n\",F2[13],F2[23]);\n\t}\n\tPermutationInverse(F1,t1);\n\tPermutationTransfer(F1,R,per[9]);\n\tPermutationTransfer(F1,Rt,per[10]);\n\tPermutationTransfer(t1,R,per[11]);\n\tPermutationTransfer(t1,Rt,per[12]);\n//\tdebug();\n\tt1[0]=24;\n\tfor (i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%ld\",&t1[i]);\n\t}\n\tfor (i=1;i<12;i++)\n\t{\t\t\n\t\tColorTransfer(t1,per[i],t2);\n//\t\tprint(t2,24);\n\t\tif (check(t2)==1) {printf(\"YES\\n\");return 0;}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define LL long long\n#define uLL unsigned long long\n#define uL unsigned long\n#define uC unsigned char\nlong temp[100000];\nvoid print(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld,\",a[i]);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nvoid print2(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld[%ld],\",a[i],i);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nvoid copy(long *a,long *b)\n{\n\tlong i;for (i=0;i<=b[0];i++) {a[i]=b[i];}\n}\n///////////////////////////////////////////////////////////////\nint PermutationValid(long *pol)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=*pol;i++)\n\t{\n\t\tif (pol[i]>*pol) {return 0;}\n\t\tif (0-pol[i]>*pol) {return 0;}\n\t\tif (pol[i]==0) {return 0;}\n\t\tif (pol[pol[i]]<0) {return 0;}\n\t\tpol[pol[i]]=0-pol[pol[i]];\n\t}\n\tfor (i=1;i<=*pol;i++) {pol[i]=0-pol[i];}\n\treturn 1;\n}\nvoid ColorTransfer(long *color,long *pol,long *ans)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=color[i];\n\t}\n}\nvoid PermutationTransfer(long *pol1,long *pol2,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol1[0];i++)\n\t{\n\t\tans[i]=pol2[pol1[i]];\n\t}\n\tans[0]=pol1[0];\n}\nvoid PermutationInverse(long *pol,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=i;\n\t}\n\tans[0]=pol[0];\n}\nvoid PermutationFactoring(long *pol,long *ans)\n{\n\tlong i,j,k,a,b,c;\n\tlong *stack=temp;*stack=0;\n\tmemcpy(ans,pol,sizeof(pol)*(*pol+1));\n\tfor (i=1;i<*pol;i++)\n\t{\n\t\tif (ans[i]>0)\n\t\t{\n\t\t\tfor (j=i;ans[j]>0;j=stack[*stack]) {stack[++(*stack)]=ans[j];ans[j]=0;}\n\t\t\tstack[++(*stack)]=0;\n\t\t}\n\t}\n\t*ans=1;j=1;\n\tfor (i=1;i<=*stack;i++)\n\t{\n\t\tif (stack[i]>0)\n\t\t{\n\t\t\tans[++(*ans)]=stack[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans[j]=i-j;j=i;*ans+=1;\n\t\t}\n\t}\n}\nvoid Cycles2Permutation(long *cycles,long *ans,long len)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=len;i++) {ans[i]=i;}*ans=len;\n\tk=1;\n\tfor (i=1;i<=*cycles;i++)\n\t{\n\t\tfor (j=k+1;j<k+cycles[k];j++)\n\t\t{\n\t\t\tans[cycles[j]]=cycles[j+1];\n\t\t}\n\t\tans[cycles[j]]=cycles[k+1];\n\t\tk=j+1;\n\t}\n}\n//////////////////////////////////////\n#define PPPP 50\nlong pcr[][PPPP]={{1},{6,\n\t\t\t\t 4,1,3,4,2,\n\t\t\t\t 4,9,10,12,11,\n\t\t\t\t 4,13,5,17,21,\n\t\t\t\t 4,15,7,19,23,\n\t\t\t\t 4,16,8,20,24,\n\t\t\t\t 4,14,6,18,22}};\nlong pcf[][PPPP]={{1},{6,\n\t\t\t\t 4,13,14,16,15,\n\t\t\t\t 4,17,19,20,18,\n\t\t\t\t 4,1,5,9,24,\n\t\t\t\t 4,2,6,10,23,\n\t\t\t\t 4,3,7,11,22,\n\t\t\t\t 4,4,8,12,21}};\nlong pco[][PPPP]={{1},{3,\n\t\t\t\t 4,6,5,7,8,\n\t\t\t\t 4,3,16,10,17,\n\t\t\t\t 4,4,14,9,19}};\n//////////////////////////////////////\n\nlong id[PPPP],flip[10][PPPP],rotate[10][PPPP],opr[10][PPPP],fsize,rsize,osize;\nlong gg[100][PPPP],gsize;\nlong pg[100000][PPPP],psize;\nvoid RubikCube(long size,long rt,long dep)\n{\n\tlong i,j,k,l1,l2,a,b,c;\n\tlong t1[PPPP],t2[PPPP],t3[PPPP];\n\tfor (i=1;i<=size;i++) {id[i]=i;}*id=size;\n\t//////////////////////\n\t//Basic Permutations//\n\t//////////////////////\n\trsize=**pcr<<1;\n\tfor (i=1;i<=**pcr;i++){Cycles2Permutation(pcr[i],rotate[2*i-2],size);PermutationInverse(rotate[2*i-2],rotate[2*i-1]);}\n\tfsize=**pcf<<1;\n\tfor (i=1;i<=**pcf;i++){Cycles2Permutation(pcf[i],flip[2*i-2],size);PermutationInverse(flip[2*i-2],flip[2*i-1]);}\n\tosize=**pco<<1;\n\tfor (i=1;i<=**pco;i++){Cycles2Permutation(pco[i],opr[2*i-2],size);PermutationInverse(opr[2*i-2],opr[2*i-1]);}\n\t//////////////////////\n\tgsize=0;\n\tcopy(t1,rotate[1]);copy(t3,rotate[0]);\n\tfor (i=1;i<=rt;i++)\n\t{\n\t\tPermutationTransfer(t1,rotate[0],t2);copy(t1,t2);\n\t\tPermutationTransfer(t3,rotate[1],t2);copy(t3,t2);\n\t\tfor (k=0;k<osize;k++)\n\t\t{\n\t\t\tPermutationTransfer(t1,opr[k],t2);\n\t\t\tPermutationTransfer(t2,t3,gg[++gsize]);\n\t\t\tfor (j=0;j<fsize;j++)\n\t\t\t{\n\t\t\t\tPermutationTransfer(t1,flip[j],t2);\n\t\t\t\tPermutationTransfer(t2,opr[k],gg[++gsize]);\n\t\t\t\tPermutationTransfer(gg[gsize],flip[j^1],t2);\n\t\t\t\tPermutationTransfer(t2,t3,gg[psize]);\n\t\t\t}\n\t\t}\t\t\n\t}\n//\tfor (i=0;i<rsize;i++) {print(rotate[i],size);}\n//\tfor (i=0;i<fsize;i++) {print(flip[i],size);}\n//\tfor (i=0;i<osize;i++) {print(opr[i],size);}\t\n//\tfor (i=1;i<=gsize;i++) {print(gg[i],size);}\n//\tfor (i=1;i<=gsize;i++) {printf(\"%ld\\n\",PermutationValid(gg[i]));}\n\t//////////////\n\tcopy(pg[1],id);psize=1;\n\tfor (l1=psize,l2=l1;dep>0;dep-=1)\n\t{\n\t\tfor (i=l1;i<=l2;i++)\n\t\t{\n\t\t\tfor (j=1;j<=gsize;j++)\n\t\t\t{\n\t\t\t\tPermutationTransfer(pg[i],gg[j],pg[++psize]);\n\t\t\t}\n\t\t}\n\t\tl1=l2+1;l2=psize;\n\t}\n\t//////////////////////\n}\n\nint check(long *clr)\n{\n\tlong i,j,k,c;\n\tk=1;\n\tfor (i=1;i<=6;i++)\n\t{\n\t\tc=clr[k++];\n\t\tfor (j=2;j<=4;j++)\n\t\t{\n\t\t\tif (clr[k++]!=c) {return 0;}\n\t\t}\n\t}\n\treturn 1;\n}\n//////////////////////////////////////////////////\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tlong i,j,k,a,b,c;\n\tlong t1[PPPP],t2[PPPP],t3[PPPP];\n\tRubikCube(24,4,1);\n\tt1[0]=24;\n\tfor (i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%ld\",&t1[i]);\n\t}\n\tfor (i=2;i<=psize;i++)\n\t{\t\t\n\t\tColorTransfer(t1,pg[i],t2);\n//\t\tprint(t2,24);\n\t\tif (check(t2)==1) {printf(\"YES\\n\");return 0;}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint judge(int *a)\n{\n\tif (a[1]==a[2]&&a[2]==a[3]&&a[3]==a[4])\n\t\tif (a[5]==a[6]&&a[6]==a[7]&&a[7]==a[8])\n\t\t\tif (a[9]==a[10]&&a[10]==a[11]&&a[11]==a[12])\n\t\t\t\tif (a[13]==a[14]&&a[14]==a[15]&&a[15]==a[16])\n\t\t\t\t\tif (a[17]==a[18]&&a[18]==a[19]&&a[19]==a[20])\n\t\t\t\t\t\tif (a[21]==a[22]&&a[22]==a[23]&&a[23]==a[24]) \n\t\t\t\t\t\t\treturn 1;\n\treturn 0;\n}\nint main()\n{\n\tint a[25],b[25],i,j;\n\tfor (i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tb[i]=a[i];\n\t}\n\t\n\tb[1]=a[5]; b[3]=a[7]; b[5]=a[9]; b[7]=a[11]; b[9]=a[24]; b[11]=a[22]; b[24]=a[1]; b[22]=a[3];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[1]=a[24]; b[3]=a[22]; b[5]=a[1]; b[7]=a[3]; b[9]=a[5]; b[11]=a[7]; b[24]=a[9]; b[22]=a[11];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[2]=a[6]; b[4]=a[8]; b[6]=a[10]; b[8]=a[12]; b[10]=a[23]; b[12]=a[21]; b[23]=a[2]; b[21]=a[4]; \n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[2]=a[23]; b[4]=a[21]; b[6]=a[2]; b[8]=a[4]; b[10]=a[6]; b[12]=a[8]; b[23]=a[10]; b[21]=a[12];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[2]=a[13]; b[1]=a[15]; b[13]=a[11]; b[15]=a[12]; b[11]=a[20]; b[12]=a[18]; b[20]=a[2]; b[18]=a[1];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[1]=a[18]; b[2]=a[20]; b[18]=a[12]; b[20]=a[11]; b[12]=a[15]; b[11]=a[13]; b[15]=a[1]; b[13]=a[2];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[3]=a[16]; b[4]=a[14]; b[17]=a[3]; b[19]=a[4]; b[10]=a[17]; b[9]=a[19]; b[16]=a[10]; b[14]=a[9]; \n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[4]=a[19]; b[3]=a[17]; b[17]=a[10]; b[19]=a[9]; b[10]=a[16]; b[9]=a[14]; b[16]=a[3]; b[14]=a[4];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[13]=a[5]; b[14]=a[6]; b[5]=a[17]; b[6]=a[18]; b[17]=a[21]; b[18]=a[22]; b[21]=a[13]; b[22]=a[14];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\t\n\tfor (i=1;i<=24;i++) b[i]=a[i];\n\tb[14]=a[22]; b[13]=a[21]; b[22]=a[18]; b[21]=a[17]; b[18]=a[6]; b[17]=a[5]; b[6]=a[14]; b[5]=a[13];\n\tif (judge(b))\n\t{\n\t\tprintf(\"YES\\n\"); return 0;\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j,y=0,p,k,l,t,m,n;\n\tint a[25];\n\tfor(i=1;i<=24;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tm=a[13];\n\tn=a[17];\n\tif(a[13]==m && a[14]==m && a[15]==m && a[16]==m && a[17]==n && a[18]==n && a[19]==n && a[20]==n)\n\t{\n\n\t\tp=a[1];\n\t\tif(a[1]==p && a[3]==p && a[6]==p && a[8]==p)\n\t\t{\n\t\t\tk=a[5];\n\t\t\tif(a[5]==k && a[7]==k && a[10]==k && a[12]==k)\n\t\t\t{\n\t\t\t\tl=a[9];\n\t\t\t\tif(a[9]==l && a[11]==l && a[21]==l && a[23]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[2];\n\t\t\t\t\tif(a[2]==t && a[4]==t && a[22]==t && a[24]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\tif(a[1]==p && a[3]==p && a[21]==p && a[23]==p)\n\t\t{\n\t\t\tk=a[5];\n\t\t\tif(a[5]==k && a[7]==k && a[2]==k && a[4]==k)\n\t\t\t{\n\t\t\t\tl=a[9];\n\t\t\t\tif(a[9]==l && a[11]==l && a[6]==l && a[8]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[22];\n\t\t\t\t\tif(a[10]==t && a[12]==t && a[22]==t && a[24]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm=a[1];\n\tn=a[9];\n\tif(a[1]==m && a[2]==m && a[3]==m && a[4]==m && a[9]==n && a[10]==n && a[11]==n && a[12]==n)\n\t{\n\n\t\tp=a[7];\n\t\tif(a[17]==p && a[18]==p && a[7]==p && a[8]==p)\n\t\t{\n\t\t\tk=a[5];\n\t\t\tif(a[5]==k && a[6]==k && a[15]==k && a[16]==k)\n\t\t\t{\n\t\t\t\tl=a[20];\n\t\t\t\tif(a[20]==l && a[19]==l && a[21]==l && a[22]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[13];\n\t\t\t\t\tif(a[13]==t && a[14]==t && a[23]==t && a[24]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\tif(a[7]==p && a[8]==p && a[13]==p && a[14]==p)\n\t\t{\n\t\t\tk=a[5];\n\t\t\tif(a[5]==k && a[6]==k && a[19]==k && a[20]==k)\n\t\t\t{\n\t\t\t\tl=a[17];\n\t\t\t\tif(a[17]==l && a[18]==l && a[23]==l && a[24]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[22];\n\t\t\t\t\tif(a[15]==t && a[16]==t && a[21]==t && a[22]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tm=a[5];\n\tn=a[21];\n\tif(a[5]==m && a[6]==m && a[7]==m && a[8]==m && a[21]==n && a[22]==n && a[23]==n && a[24]==n)\n\t{\n\n\t\tp=a[14];\n\t\tif(a[14]==p && a[16]==p && a[11]==p && a[12]==p)\n\t\t{\n\t\t\tk=a[3];\n\t\t\tif(a[3]==k && a[4]==k && a[13]==k && a[15]==k)\n\t\t\t{\n\t\t\t\tl=a[9];\n\t\t\t\tif(a[9]==l && a[10]==l && a[18]==l && a[20]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[2];\n\t\t\t\t\tif(a[2]==t && a[1]==t && a[17]==t && a[19]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\tif(a[14]==p && a[16]==p && a[1]==p && a[2]==p)\n\t\t{\n\t\t\tk=a[3];\n\t\t\tif(a[3]==k && a[4]==k && a[18]==k && a[20]==k)\n\t\t\t{\n\t\t\t\tl=a[9];\n\t\t\t\tif(a[9]==l && a[10]==l && a[13]==l && a[15]==l)\n\t\t\t\t{\n\t\t\t\t\tt=a[11];\n\t\t\t\t\tif(a[11]==t && a[12]==t && a[17]==t && a[19]==t)\n\t\t\t\t\t{\n\t\t\t\t\t\ty=1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(y==0)\n\t\tprintf(\"NO\\n\");\n\tif(y==1)\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n\n\n\t\t\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\n\nint main() {\n int a[25] , i;\n a[0] = 0;\n for(i = 1; i <= 24; i++)\n scanf(\"%d\", &a[i]);\n if((a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[7] && a[13] == a[8] /**/ && a[5] == a[6] && a[5] == a[19] && a[5] == a[20] /**/ && a[17] == a[18] && a[17] == a[23] && a[17] == a[24]) ||\n (a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[23] && a[13] == a[24] /**/ && a[5] == a[6] && a[5] == a[15] && a[5] == a[16] /**/ && a[17] == a[18] && a[17] == a[7] && a[17] == a[8]) ||\n \n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[6] && a[1] == a[8] /**/ && a[2] == a[4] && a[2] == a[22] && a[2] == a[24] /**/ && a[5] == a[7] && a[5] == a[10] && a[5] == a[12]) ||\n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[21] && a[1] == a[23] /**/ && a[2] == a[4] && a[2] == a[5] && a[2] == a[7] /**/ && a[6] == a[8] && a[6] == a[9] && a[6] == a[11]) || \n \n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[2] && a[1] == a[17] && a[1] == a[19] /**/ && a[3] == a[4] && a[3] == a[13] && a[3] == a[15] /**/ && a[9] == a[10] && a[18] == a[9] && a[9] == a[20]) ||\n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[2] && a[1] == a[14] && a[1] == a[16] /**/ && a[3] == a[4] && a[3] == a[20] && a[3] == a[18] /**/ && a[9] == a[10] && a[13] == a[9] && a[9] == a[15]) ) \n \n\tprintf(\"YES\");\n else\n\tprintf(\"NO\");\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint cnt[10],s[8][6],sum,maxn,res;\nint max(int a,int b){return a>b?a:b;}\nint main()\n{\n int i,j;\n for(i=1;i<=6;i++)\n {\n \tfor(j=1;j<6;j++)cnt[j]=0;\n\tsum=0;maxn=0;\n for(j=1;j<=4;j++)\n {\n scanf(\"%d\",&s[i][j]);\n if(!cnt[s[i][j]])sum++;\n cnt[s[i][j]]++;\n maxn=max(maxn,cnt[s[i][j]]);\n }\n\tif(sum>2){printf(\"NO\\n\");return 0;}\n\tif(maxn==3){printf(\"NO\\n\");return 0;}\n\tif(sum==2&&maxn==2&&s[i][1]==s[i][4])\n\t{printf(\"NO\\n\");return 0;}\n\tif(sum==1)res++;\n }\n if(res!=2){printf(\"NO\\n\");return 0;}\n if(s[1][1]==s[1][3])\n if(s[2][1]==s[2][3])\n if(s[3][1]==s[3][3])\n if(s[6][1]==s[6][3])\n {\n\t\t if(s[1][1]==s[2][2])\n if(s[2][1]==s[3][2])\n if(s[3][1]==s[6][1])\n if(s[6][2]==s[1][2])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[1][1]==s[6][1])\n if(s[2][1]==s[1][2])\n if(s[3][1]==s[2][2])\n if(s[6][2]==s[3][2])\n {printf(\"YES\\n\");return 0;}\n\t\t}\n if(s[2][1]==s[2][2])\n if(s[4][1]==s[4][2])\n if(s[5][1]==s[5][2])\n if(s[6][1]==s[6][2])\n {\n\t\t if(s[2][1]==s[5][3])\n if(s[5][1]==s[6][3])\n if(s[6][1]==s[4][3])\n if(s[4][1]==s[2][3])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[2][1]==s[4][3])\n if(s[4][1]==s[6][3])\n if(s[6][1]==s[5][3])\n if(s[5][1]==s[2][3])\n {printf(\"YES\\n\");return 0;}\n }\n if(s[1][1]==s[1][2])\n if(s[5][1]==s[5][3])\n if(s[3][1]==s[3][2])\n if(s[4][1]==s[4][3])\n {\n\t\t if(s[1][1]==s[5][1])\n if(s[5][2]==s[3][1])\n if(s[3][3]==s[4][2])\n if(s[4][1]==s[1][3])\n {printf(\"YES\\n\");return 0;}\n\t\t if(s[1][1]==s[4][2])\n if(s[4][1]==s[3][1])\n if(s[3][3]==s[5][1])\n if(s[5][2]==s[1][3])\n {printf(\"YES\\n\");return 0;}\n }\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isSolved(int r[])\n{\n int i;\n /*\n for(i=1;i<=24;i++)\n printf(\"%d \", r[i]);\n printf(\"\\n\\n\");\n*/\n for(i=1;i<=24;i=i+4)\n if(!(r[i+1] == r[i] && r[i+2] == r[i] && r[i+3] == r[i]))\n return 0;\n\n return 1;\n}\n\nvoid rotate1(int r[])\n{\n int aux1, aux2;\n aux1 = r[24];\n aux2 = r[22];\n r[24] = r[1];\n r[22] = r[3];\n r[1] = r[5];\n r[3] = r[7];\n r[5] = r[9];\n r[7] = r[11];\n r[9] = aux1;\n r[11] = aux2;\n\n}\n\n\n\nvoid rotate2(int r[])\n{\n int aux1, aux2;\n aux1 = r[23];\n aux2 = r[21];\n r[23] = r[2];\n r[21] = r[4];\n r[2] = r[6];\n r[4] = r[8];\n r[6] = r[9];\n r[8] = r[12];\n r[10] = aux1;\n r[12] = aux2;\n}\n\nvoid rotate3(int r[])\n{\n int aux1, aux2;\n aux1 = r[13];\n aux2 = r[14];\n r[13] = r[5];\n r[14] = r[6];\n r[5] = r[17];\n r[6] = r[18];\n r[17] = r[21];\n r[18] = r[22];\n r[21] = aux1;\n r[22] = aux2;\n}\n\nvoid rotate4(int r[])\n{\n int aux1, aux2;\n aux1 = r[15];\n aux2 = r[16];\n r[15] = r[7];\n r[16] = r[8];\n r[7] = r[19];\n r[8] = r[20];\n r[19] = r[23];\n r[20] = r[24];\n r[23] = aux1;\n r[24] = aux2;\n}\n\nint main()\n{\n int i, r[25];\n\n for(i=1;i<=24;i++)\n scanf(\"%d\", &r[i]);\n\n for(i=1;i<=4; i++)\n {\n rotate1(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate2(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate3(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate4(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n printf(\"no\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isSolved(int r[])\n{\n int i;\n for(i=1;i<=24;i++)\n printf(\"%d \", r[i]);\n printf(\"\\n\\n\");\n\n for(i=1;i<=24;i=i+4)\n if(!(r[i+1] == r[i] && r[i+2] == r[i] && r[i+3] == r[i]))\n return 0;\n\n return 1;\n}\n\nvoid rotate1(int r[])\n{\n int aux1, aux2;\n aux1 = r[24];\n aux2 = r[22];\n r[24] = r[1];\n r[22] = r[3];\n r[1] = r[5];\n r[3] = r[7];\n r[5] = r[9];\n r[7] = r[11];\n r[9] = aux1;\n r[11] = aux2;\n\n}\n\n\n\nvoid rotate2(int r[])\n{\n int aux1, aux2;\n aux1 = r[23];\n aux2 = r[21];\n r[23] = r[2];\n r[21] = r[4];\n r[2] = r[6];\n r[4] = r[8];\n r[6] = r[9];\n r[8] = r[12];\n r[10] = aux1;\n r[12] = aux2;\n}\n\nvoid rotate3(int r[])\n{\n int aux1, aux2;\n aux1 = r[13];\n aux2 = r[14];\n r[13] = r[5];\n r[14] = r[6];\n r[5] = r[17];\n r[6] = r[18];\n r[17] = r[21];\n r[18] = r[22];\n r[21] = aux1;\n r[22] = aux2;\n}\n\nvoid rotate4(int r[])\n{\n int aux1, aux2;\n aux1 = r[15];\n aux2 = r[16];\n r[15] = r[7];\n r[16] = r[8];\n r[7] = r[19];\n r[8] = r[20];\n r[19] = r[23];\n r[20] = r[24];\n r[23] = aux1;\n r[24] = aux2;\n}\n\nint main()\n{\n int i, r[25];\n\n for(i=1;i<=24;i++)\n scanf(\"%d\", &r[i]);\n\n for(i=1;i<=4; i++)\n {\n rotate1(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate2(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate3(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n for(i=1;i<=4; i++)\n {\n rotate4(r);\n if((i == 1 || i == 3) && isSolved(r))\n {\n printf(\"yes\");\n return 0;\n }\n }\n\n printf(\"no\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\n\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 2, 4, 2, 4 };\n\nint a3[] = { 1, 2, 1, 2, 3, 4, 3, 4, 2, 1, 2, 1, 5, 5, 5, 5, 6, 6, 6, 6, 1, 2, 1, 2 };\n\nint a4[] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 };\n\n#define N\t24\n\nint check_(int *aa, int *bb) {\n\tstatic int match[7], used[7];\n\tint i;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[bb[i]]) || (match[aa[i]] != -1 && match[aa[i]] != bb[i]))\n\t\t\treturn 0;\n\t\tused[bb[i]] = 1;\n\t\tmatch[aa[i]] = bb[i];\n\t}\n\treturn 1;\n}\n\nint check(int *aa) {\n\treturn check_(aa, a1) || check_(aa, a2) || check_(aa, a3) || check_(aa, a4);\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tbb[0] = aa[1], bb[1] = aa[3], bb[2] = aa[0], bb[3] = aa[2];\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[8] = aa[10], bb[9] = aa[8], bb[10] = aa[11], bb[11] = aa[9];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[14], cc[1] = aa[12], cc[2] = aa[15], cc[3] = aa[13];\n\tcc[4] = aa[6], cc[5] = aa[4], cc[6] = aa[7], cc[7] = aa[5];\n\tcc[8] = aa[18], cc[9] = aa[16], cc[10] = aa[19], cc[11] = aa[17];\n\tcc[12] = aa[10], cc[13] = aa[8], cc[14] = aa[11], cc[15] = aa[9];\n\tcc[16] = aa[2], cc[17] = aa[0], cc[18] = aa[3], cc[19] = aa[1];\n\tcc[20] = aa[21], cc[21] = aa[23], cc[22] = aa[20], cc[23] = aa[22];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 2, 4, 2, 4 };\n\n#define N\t24\n\nint check(int *aa) {\n\tstatic int match[7], used[7];\n\tint i, ok;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tok = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[a1[i]]) || (match[aa[i]] != -1 && match[aa[i]] != a1[i])) {\n\t\t\tok = 0;\n\t\t\tbreak;\n\t\t}\n\t\tused[a1[i]] = 1;\n\t\tmatch[aa[i]] = a1[i];\n\t}\n\tif (ok)\n\t\treturn 1;\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tok = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[a2[i]]) || (match[aa[i]] != -1 && match[aa[i]] != a2[i])) {\n\t\t\tok = 0;\n\t\t\tbreak;\n\t\t}\n\t\tused[a2[i]] = 1;\n\t\tmatch[aa[i]] = a2[i];\n\t}\n\treturn ok;\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\"%d\", &aa[i]);\n\t\tcc[i] = bb[i] = aa[i];\n\t}\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[12], cc[1] = aa[1], cc[2] = aa[13], cc[3] = aa[2];\n\tcc[8] = aa[10], cc[9] = aa[11], cc[10] = aa[18], cc[11] = aa[19];\n\tcc[12] = aa[14], cc[13] = aa[15], cc[14] = aa[9], cc[15] = aa[8];\n\tcc[16] = aa[3], cc[17] = aa[1], cc[18] = aa[16], cc[19] = aa[17];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\n\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\n\nint a3[] = { 1, 2, 1, 2, 3, 4, 3, 4, 2, 1, 2, 1, 5, 5, 5, 5, 6, 6, 6, 6, 1, 2, 1, 2 };\n\nint a4[] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 };\n\n#define N\t24\n\nint check_(int *aa, int *bb) {\n\tstatic int match[7], used[7];\n\tint i;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[bb[i]]) || (match[aa[i]] != -1 && match[aa[i]] != bb[i]))\n\t\t\treturn 0;\n\t\tused[bb[i]] = 1;\n\t\tmatch[aa[i]] = bb[i];\n\t}\n\treturn 1;\n}\n\nint check(int *aa) {\n\treturn check_(aa, a1) || check_(aa, a2) || check_(aa, a3) || check_(aa, a4);\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tbb[0] = aa[1], bb[1] = aa[3], bb[2] = aa[0], bb[3] = aa[2];\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[8] = aa[10], bb[9] = aa[8], bb[10] = aa[11], bb[11] = aa[9];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[14], cc[1] = aa[12], cc[2] = aa[15], cc[3] = aa[13];\n\tcc[4] = aa[6], cc[5] = aa[4], cc[6] = aa[7], cc[7] = aa[5];\n\tcc[8] = aa[18], cc[9] = aa[16], cc[10] = aa[19], cc[11] = aa[17];\n\tcc[12] = aa[10], cc[13] = aa[8], cc[14] = aa[11], cc[15] = aa[9];\n\tcc[16] = aa[2], cc[17] = aa[0], cc[18] = aa[3], cc[19] = aa[1];\n\tcc[20] = aa[22], cc[21] = aa[20], cc[22] = aa[23], cc[23] = aa[21];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 2, 4, 2, 4 };\n\nint a3[] = { 1, 2, 1, 2, 3, 4, 3, 4, 2, 1, 2, 1, 5, 5, 5, 5, 6, 6, 6, 6, 1, 2, 1, 2 };\n\nint a4[] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 };\n\n#define N\t24\n\nint check_(int *aa, int *bb) {\n\tstatic int match[7], used[7];\n\tint i;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[bb[i]]) || (match[aa[i]] != -1 && match[aa[i]] != bb[i]))\n\t\t\treturn 0;\n\t\tused[bb[i]] = 1;\n\t\tmatch[aa[i]] = bb[i];\n\t}\n\treturn 1;\n}\n\nint check(int *aa) {\n\treturn check_(aa, a1) || check_(aa, a2) || check_(aa, a3) || check_(aa, a4);\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++)\n\t\tscanf(\"%d\", &aa[i]);\n\tbb[0] = aa[1], bb[1] = aa[3], bb[2] = aa[0], bb[3] = aa[2];\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[8] = aa[10], bb[9] = aa[8], bb[10] = aa[11], bb[11] = aa[9];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[12], cc[1] = aa[0], cc[2] = aa[13], cc[3] = aa[2];\n\tcc[4] = aa[6], cc[5] = aa[4], cc[6] = aa[7], cc[7] = aa[5];\n\tcc[8] = aa[10], cc[9] = aa[11], cc[10] = aa[18], cc[11] = aa[19];\n\tcc[12] = aa[14], cc[13] = aa[15], cc[14] = aa[9], cc[15] = aa[8];\n\tcc[16] = aa[3], cc[17] = aa[1], cc[18] = aa[16], cc[19] = aa[17];\n\tcc[20] = aa[22], cc[21] = aa[20], cc[22] = aa[23], cc[23] = aa[21];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a1[] = { 1, 2, 1, 2, 3, 1, 3, 1, 4, 3, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 4, 2, 4, 2 };\nint a2[] = { 2, 1, 2, 1, 1, 3, 1, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 2, 4, 2, 4 };\n\n#define N\t24\n\nint check(int *aa) {\n\tint match[7], used[7];\n\tint i, ok;\n\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tmemset(used, 0, sizeof used);\n\tok = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif ((match[aa[i]] == -1 && used[a1[i]]) || (match[aa[i]] != -1 && match[aa[i]] != a1[i])) {\n\t\t\tok = 0;\n\t\t\tbreak;\n\t\t}\n\t\tused[a1[i]] = 1;\n\t\tmatch[aa[i]] = a1[i];\n\t}\n\tif (ok)\n\t\treturn 1;\n\tfor (i = 1; i <= 6; i++)\n\t\tmatch[i] = -1;\n\tok = 1;\n\tfor (i = 0; i < N; i++) {\n\t\tif (match[aa[i]] != -1 && match[aa[i]] == a2[aa[i]]) {\n\t\t\tok = 0;\n\t\t\tbreak;\n\t\t}\n\t\tmatch[aa[i]] = a2[aa[i]];\n\t}\n\treturn ok;\n}\n\nint main() {\n\tstatic int aa[N], bb[N], cc[N];\n\tint i;\n\n\tfor (i = 0; i < N; i++) {\n\t\tscanf(\"%d\", &aa[i]);\n\t\tcc[i] = bb[i] = aa[i];\n\t}\n\tbb[4] = aa[12], bb[5] = aa[13], bb[6] = aa[14], bb[7] = aa[15];\n\tbb[12] = aa[20], bb[13] = aa[21], bb[14] = aa[22], bb[15] = aa[23];\n\tbb[16] = aa[4], bb[17] = aa[5], bb[18] = aa[6], bb[19] = aa[7];\n\tbb[20] = aa[16], bb[21] = aa[17], bb[22] = aa[18], bb[23] = aa[19];\n\tcc[0] = aa[12], cc[1] = aa[1], cc[2] = aa[13], cc[3] = aa[2];\n\tcc[8] = aa[10], cc[9] = aa[11], cc[10] = aa[18], cc[11] = aa[19];\n\tcc[12] = aa[14], cc[13] = aa[15], cc[14] = aa[9], cc[15] = aa[8];\n\tcc[16] = aa[3], cc[17] = aa[1], cc[18] = aa[16], cc[19] = aa[17];\n\tprintf(!check(aa) && !check(bb) && !check(cc) ? \"NO\\n\" : \"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[30],k=0,B[7];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if(A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[24],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if ( A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[30],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if(A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[24],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if(A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[30],k=0,B[7];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[24]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if(A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[24],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if (A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[24],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-1]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if (A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[9]==A[10]&&A[9]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,A[24],k=0,B[6];\n\tfor(i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%d\",&A[i]);\n\t}\n\tfor(i=1;i<=6;i++){\n\t\tif (A[4*i]==A[4*i-1]&&A[4*i-2]==A[4*i-3]&&\n\t\tA[4*i]==A[4*i-2]){\n\t\t\tB[i]=1;}\n\t\t\telse B[i]=0;\n\t}\n\t\n\t\n\tif (B[1]==1&&B[2]==0&&B[3]==1&&B[4]\n\t==0&&B[5]==0&&B[6]==0){\n\t\tif (A[13]==A[14]&&A[13]==A[7]&&A[8]==A[7]&&A[5]==A[6]&&A[5]==A[19]&&A[19]==A[20]&&A[17]==A[18]&&A[23]==A[24]&&A[18]==A[19]) k=1;\n\t\telse if (A[13]==A[14]&&A[13]==A[22]&&A[22]==A[24]&&A[5]==A[6]&&A[5]==A[15]&&A[15]==A[16]&&A[17]==A[18]&&A[18]==A[7]&&A[7]==A[8]) k=1;\n\t}\n\t\n\t\n\tif (1==B[5]&&B[4]==1&&B[1]==0&&B[2]\n\t==0&&B[3]==0&&B[6]==0){\n\t\tif (A[1]==A[3]&&A[3]==A[6]&&A[8]==A[6]&&A[5]==A[7]&&A[7]==A[10]&&A[10]==A[12]&&A[9]==A[11]&&A[9]==A[21]&&A[23]==A[21]) k=1;\n\t\telse if (A[2]==A[4]&&A[2]==A[5]&&A[5]==A[7]&&A[8]==A[6]&&A[6]==A[9]&&A[9]==A[11]&&A[10]==A[12]&&A[12]==A[22]&&A[22]==A[24]) k=1;\n\t}\n\t\n\t\n\tif (B[1]==0&&B[2]==1&&B[3]==0&&B[4]\n\t==0&&B[5]==0&&B[6]==1){\n\t\tif (A[1]==A[2]&&A[1]==A[14]&&A[14]==A[16]&&A[13]==A[15]&&A[15]==A[9]&&A[9]==A[10]&&A[11]==A[12]&&A[12]==A[19]&&A[17]==A[19]) k=1;\n\t\telse if (A[3]==A[4]&&A[3]==A[13]&&A[13]==A[15]&&A[14]==A[16]&&A[14]==A[11]&&A[11]==A[12]&&A[17]==A[19]&&A[19]==A[1]&&A[1]==A[2]) k=1;\n\t}\n\t\n\tif (k==1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n\t\t\n\t"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define LL long long\n#define uLL unsigned long long\n#define uL unsigned long\n#define uC unsigned char\nlong temp[100000];\nvoid print(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld,\",a[i]);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nvoid print2(long *a,long size)\n{\n\tlong i;\n\tfor (i=1;i<=size;i++)\n\t{\n\t\tprintf(\"%ld[%ld],\",a[i],i);\n\t}\n\tprintf(\"\\n---\\n\");\n}\nvoid copy(long *a,long *b)\n{\n\tlong i;for (i=0;i<=b[0];i++) {a[i]=b[i];}\n}\n///////////////////////////////////////////////////////////////\nvoid ColorTransfer(long *color,long *pol,long *ans)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=color[i];\n\t}\n}\nvoid PermutationTransfer(long *pol1,long *pol2,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol1[0];i++)\n\t{\n\t\tans[i]=pol2[pol1[i]];\n\t}\n\tans[0]=pol1[0];\n}\nvoid PermutationInverse(long *pol,long *ans)\n{\n\tstatic long i,j,k;\n\tfor (i=1;i<=pol[0];i++)\n\t{\n\t\tans[pol[i]]=i;\n\t}\n\tans[0]=pol[0];\n}\nvoid PermutationFactoring(long *pol,long *ans)\n{\n\tlong i,j,k,a,b,c;\n\tlong *stack=temp;*stack=0;\n\tmemcpy(ans,pol,sizeof(pol)*(*pol+1));\n\tfor (i=1;i<*pol;i++)\n\t{\n\t\tif (ans[i]>0)\n\t\t{\n\t\t\tfor (j=i;ans[j]>0;j=stack[*stack]) {stack[++(*stack)]=ans[j];ans[j]=0;}\n\t\t\tstack[++(*stack)]=0;\n\t\t}\n\t}\n\t*ans=1;j=1;\n\tfor (i=1;i<=*stack;i++)\n\t{\n\t\tif (stack[i]>0)\n\t\t{\n\t\t\tans[++(*ans)]=stack[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans[j]=i-j;j=i;*ans+=1;\n\t\t}\n\t}\n}\nvoid Cycles2Permutation(long *cycles,long *ans,long len)\n{\n\tlong i,j,k;\n\tfor (i=1;i<=len;i++) {ans[i]=i;}*ans=len;\n\tk=1;\n\tfor (i=1;i<=*cycles;i++)\n\t{\n\t\tfor (j=k+1;j<k+cycles[k];j++)\n\t\t{\n\t\t\tans[cycles[j]]=cycles[j+1];\n\t\t}\n\t\tans[cycles[j]]=cycles[k+1];\n\t\tk=j+1;\n\t}\n}\n//////////////////////////////////////\n#define PPPP 50\nlong pcr[][PPPP]={{1},{6,\n\t\t\t\t 4,1,3,4,2,\n\t\t\t\t 4,9,10,12,11,\n\t\t\t\t 4,13,5,17,21,\n\t\t\t\t 4,15,7,19,23,\n\t\t\t\t 4,16,8,20,24,\n\t\t\t\t 4,14,6,18,22}};\nlong pcf[][PPPP]={{1},{6,\n\t\t\t\t 4,13,14,16,15,\n\t\t\t\t 4,17,19,20,18,\n\t\t\t\t 4,1,5,9,24,\n\t\t\t\t 4,3,6,10,23,\n\t\t\t\t 4,3,7,11,22,\n\t\t\t\t 4,4,8,12,21}};\nlong pco[][PPPP]={{1},{3,\n\t\t\t\t 4,6,5,7,8,\n\t\t\t\t 4,3,16,10,17,\n\t\t\t\t 4,4,14,9,19}};\n//////////////////////////////////////\n\nlong id[PPPP],flip[10][PPPP],rotate[10][PPPP],opr[10][PPPP],fsize,rsize,osize;\nlong gg[100][PPPP],gsize;\nlong pg[100000][PPPP],psize;\nvoid RubikCube(long size,long rt,long dep)\n{\n\tlong i,j,k,l1,l2,a,b,c;\n\tlong t1[PPPP],t2[PPPP],t3[PPPP];\n\tfor (i=1;i<=size;i++) {id[i]=i;}*id=size;\n\t//////////////////////\n\t//Basic Permutations//\n\t//////////////////////\n\trsize=**pcr<<1;\n\tfor (i=1;i<=**pcr;i++){Cycles2Permutation(pcr[i],rotate[2*i-2],size);PermutationInverse(rotate[2*i-2],rotate[2*i-1]);}\n\tfsize=**pcf<<1;\n\tfor (i=1;i<=**pcf;i++){Cycles2Permutation(pcf[i],flip[2*i-2],size);PermutationInverse(flip[2*i-2],flip[2*i-1]);}\n\tosize=**pco<<1;\n\tfor (i=1;i<=**pco;i++){Cycles2Permutation(pco[i],opr[2*i-2],size);PermutationInverse(opr[2*i-2],opr[2*i-1]);}\n\t//////////////////////\n\tgsize=0;\n\tcopy(t1,rotate[1]);copy(t3,rotate[0]);\n\tfor (i=1;i<=rt;i++)\n\t{\n\t\tPermutationTransfer(t1,rotate[0],t2);copy(t1,t2);\n\t\tPermutationTransfer(t3,rotate[1],t2);copy(t3,t2);\n\t\tfor (k=0;k<osize;k++)\n\t\t{\n\t\t\tPermutationTransfer(t1,opr[k],t2);\n\t\t\tPermutationTransfer(t2,t3,gg[++gsize]);\n\t\t\tfor (j=0;j<fsize;j++)\n\t\t\t{\n\t\t\t\tPermutationTransfer(t1,flip[j],t2);\n\t\t\t\tPermutationTransfer(t2,opr[k],gg[++gsize]);\n\t\t\t\tPermutationTransfer(gg[gsize],flip[j^1],t2);\n\t\t\t\tPermutationTransfer(t2,t3,gg[psize]);\n\t\t\t}\n\t\t}\t\t\n\t}\n\t//////////////\n\tcopy(pg[1],id);psize=1;\n\tfor (l1=psize,l2=l1;dep>0;dep-=1)\n\t{\n\t\tfor (i=l1;i<=l2;i++)\n\t\t{\n\t\t\tfor (j=1;j<=gsize;j++)\n\t\t\t{\n\t\t\t\tPermutationTransfer(pg[i],gg[j],pg[++psize]);\n\t\t\t}\n\t\t}\n\t\tl1=l2+1;l2=psize;\n\t}\n\t//////////////////////\n}\n\nint check(long *clr)\n{\n\tlong i,j,k,c;\n\tk=1;\n\tfor (i=1;i<=6;i++)\n\t{\n\t\tc=clr[k++];\n\t\tfor (j=2;j<=4;j++)\n\t\t{\n\t\t\tif (clr[k++]!=c) {return 0;}\n\t\t}\n\t}\n\treturn 1;\n}\n//////////////////////////////////////////////////\nint main()\n{\n//\tfreopen(\"in.in\",\"r\",stdin);\n\tlong i,j,k,a,b,c;\n\tlong t1[PPPP],t2[PPPP],t3[PPPP];\n\tRubikCube(24,4,1);\n\tt1[0]=24;\n\tfor (i=1;i<=24;i++)\n\t{\n\t\tscanf(\"%ld\",&t1[i]);\n\t}\n\tfor (i=1;i<=psize;i++)\n\t{\t\t\n\t\tColorTransfer(t1,pg[i],t2);\n//\t\tprint(t2,24);\n\t\tif (check(t2)==1) {printf(\"YES\\n\");return 0;}\n\t}\n\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\nint main() {\n int a[25] , i;\n a[0] = 0;\n for(i = 1; i <= 24; i++)\n scanf(\"%d\", &a[i]);\n if((a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[7] && a[13] == a[8] /**/ && a[5] == a[6] && a[5] == a[19] && a[5] == a[20] /**/ && a[17] == a[18] && a[17] == a[23] && a[17] == a[24]) ||\n (a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[23] && a[13] == a[24] /**/ && a[5] == a[6] && a[5] == a[15] && a[5] == a[16] /**/ && a[17] == a[18] && a[17] == a[7] && a[17] == a[8]) ||\n \n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[6] && a[1] == a[8] /**/ && a[2] == a[4] && a[2] == a[21] && a[2] == a[23] /**/ && a[5] == a[7] && a[5] == a[10] && a[5] == a[12]) ||\n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[22] && a[1] == a[24] /**/ && a[2] == a[4] && a[2] == a[5] && a[2] == a[7] /**/ && a[6] == a[8] && a[6] == a[9] && a[6] == a[11]) || \n \n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[3] && a[1] == a[18] && a[1] == a[20] /**/ && a[2] == a[4] && a[2] == a[13] && a[2] == a[15] /**/ && a[14] == a[16] && a[14] == a[9] && a[9] == a[11]) ||\n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[3] && a[1] == a[14] && a[1] == a[16] /**/ && a[2] == a[4] && a[2] == a[17] && a[2] == a[19] /**/ && a[9] == a[11] && a[18] == a[9] && a[9] == a[20]) ) \n \n\tprintf(\"YES\");\n else\n\tprintf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\n\nint main() {\n int a[25] , i;\n a[0] = 0;\n for(i = 1; i <= 24; i++)\n scanf(\"%d\", &a[i]);\n if((a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[7] && a[13] == a[8] /**/ && a[5] == a[6] && a[5] == a[19] && a[5] == a[20] /**/ && a[17] == a[18] && a[17] == a[23] && a[17] == a[24]) ||\n (a[1] == a[2] && a[1] == a[3] && a[4] == a[1] /**/ && a[9] == a[10] && a[9] == a[11] && a[9] == a[12] /**/ && a[13] == a[14] && a[13] == a[23] && a[13] == a[24] /**/ && a[5] == a[6] && a[5] == a[15] && a[5] == a[16] /**/ && a[17] == a[18] && a[17] == a[7] && a[17] == a[8]) ||\n \n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[6] && a[1] == a[8] /**/ && a[2] == a[4] && a[2] == a[22] && a[2] == a[24] /**/ && a[5] == a[7] && a[5] == a[10] && a[5] == a[12]) ||\n (a[13] == a[14] && a[13] == a[15] && a[13] == a[16] /**/ && a[17] == a[18] && a[17] == a[19] && a[17] == a[20] /**/ && a[1] == a[3] && a[1] == a[21] && a[1] == a[23] /**/ && a[2] == a[4] && a[2] == a[5] && a[2] == a[7] /**/ && a[6] == a[8] && a[6] == a[9] && a[6] == a[11]) || \n \n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[2] && a[1] == a[17] && a[1] == a[19] /**/ && a[3] == a[4] && a[2] == a[13] && a[2] == a[15] /**/ && a[9] == a[10] && a[18] == a[9] && a[9] == a[20]) ||\n (a[5] == a[6] && a[7] == a[5] && a[5] == a[8] /**/ && a[21] == a[22] && a[21] == a[23] && a[21] == a[24] /**/ && a[1] == a[2] && a[1] == a[14] && a[1] == a[16] /**/ && a[3] == a[4] && a[3] == a[20] && a[2] == a[18] /**/ && a[9] == a[10] && a[13] == a[9] && a[9] == a[15]) ) \n \n\tprintf(\"YES\");\n else\n\tprintf(\"NO\");\n return 0;\n}"}], "src_uid": "881a820aa8184d9553278a0002a3b7c4"} {"nl": {"description": "A few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight. Ever since, she tried to avoid contact with others, for fear that this secret might be noticed.To get rid of the oddity and recover her weight, a special integer sequence is needed. Hitagi's sequence has been broken for a long time, but now Kaiki provides an opportunity.Hitagi's sequence a has a length of n. Lost elements in it are denoted by zeros. Kaiki provides another sequence b, whose length k equals the number of lost elements in a (i.e. the number of zeros). Hitagi is to replace each zero in a with an element from b so that each element in b should be used exactly once. Hitagi knows, however, that, apart from 0, no integer occurs in a and b more than once in total.If the resulting sequence is not an increasing sequence, then it has the power to recover Hitagi from the oddity. You are to determine whether this is possible, or Kaiki's sequence is just another fake. In other words, you should detect whether it is possible to replace each zero in a with an integer from b so that each integer from b is used exactly once, and the resulting sequence is not increasing.", "input_spec": "The first line of input contains two space-separated positive integers n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n) \u2014 the lengths of sequence a and b respectively. The second line contains n space-separated integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u2009200) \u2014 Hitagi's broken sequence with exactly k zero elements. The third line contains k space-separated integers b1,\u2009b2,\u2009...,\u2009bk (1\u2009\u2264\u2009bi\u2009\u2264\u2009200) \u2014 the elements to fill into Hitagi's sequence. Input guarantees that apart from 0, no integer occurs in a and b more than once in total.", "output_spec": "Output \"Yes\" if it's possible to replace zeros in a with elements in b and make the resulting sequence not increasing, and \"No\" otherwise.", "sample_inputs": ["4 2\n11 0 0 14\n5 4", "6 1\n2 3 0 8 9 10\n5", "4 1\n8 94 0 4\n89", "7 7\n0 0 0 0 0 0 0\n1 2 3 4 5 6 7"], "sample_outputs": ["Yes", "No", "Yes", "Yes"], "notes": "NoteIn the first sample: Sequence a is 11,\u20090,\u20090,\u200914. Two of the elements are lost, and the candidates in b are 5 and 4. There are two possible resulting sequences: 11,\u20095,\u20094,\u200914 and 11,\u20094,\u20095,\u200914, both of which fulfill the requirements. Thus the answer is \"Yes\". In the second sample, the only possible resulting sequence is 2,\u20093,\u20095,\u20098,\u20099,\u200910, which is an increasing sequence and therefore invalid."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,b,t;\n scanf(\"%d %d\",&a,&b);\n int ara[a],bra[b];\n int i=0,j=0;\n for(i=0;i<a;i++)\n scanf(\"%d\",&ara[i]);\n for(j=0;j<b;j++)\n scanf(\"%d\",&bra[j]);\n for(i=0;i<(b-1);++i){\n for(j=0;j<(b-1);j++)\n if(bra[j]<bra[j+1]){\n t=bra[j];\n bra[j]=bra[j+1];\n bra[j+1]=t;\n }\n }\n for(i=0,j=0;i<a;i++)\n if(!ara[i]){ara[i]=bra[j];j++;}\n for(i=0,j=1;i<(a-1);i++)\n if(ara[i]<ara[i+1]){j++;continue;}\n if(j==(a))printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,countzero=0,zeroindex;\n scanf(\"%d %d\",&n,&m);\n int a[n],b[m];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0){\n countzero++;\n zeroindex=i;}\n }\n for(i=0;i<m;i++)scanf(\"%d\",&b[i]);\n if(countzero==1){\n a[zeroindex]=b[0];\n int flag=0;\n for(i=0;i<n-1;i++){\n if(a[i+1]<a[i]){flag=1;break;}\n }\n if(flag)printf(\"YES\");\n else printf(\"NO\");\n }\n else {\n printf(\"YES\");\n }\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_inc(int a[],int size)\n{\n int i;\n for(i=0;i<size;i++)\n {\n if(a[i]>a[i+1])\n return 0;\n }\n return 1;\n}\nvoid shift_array (int a[],int size)\n{\n int temp,i;\n temp=a[0];\n for(i=0;i<size-1;i++)\n {\n a[i]=a[i+1];\n }\n a[size-1]=temp;\n}\nint main()\n{\n // int o;\n int n,k,i,j,x,v,q=0;\n scanf(\"%d %d\",&n,&k);\n int ns[n] ,ks[k],zeros[k];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ns[i]);\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&ks[i]);\n }\n for(i=0;i<k;i++)\n {\n for(j=0,v=0;j<n;j++)\n {\n if(ns[j]==0)\n {\n ns[j]=ks[v];\n zeros[v]=j;\n v++;\n }\n }\n x=check_inc(ns,n);\n if(x==0)\n {\n printf(\"Yes\");\n q=1;\n break;\n }\n shift_array (ks,k);\n for(j=0,v=0;j<n;j++)\n {\n if(zeros[v]==j)\n {\n ns[j]=0;\n v++;\n }\n }\n\n /*\n printf(\"\\n\\n\");\n for(o=0;o<n;o++)\n printf(\"%d \",ns[o]);\n */\n\n\n }\n if(q!=1)\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain(){\n\n int n,k,i,j=0,count1=0,count2=0;\n scanf(\"%d %d\",&n,&k);\n int c[n];\n int d[k];\n int e[n];\n int f[n-1];\n for(i=0;i<n;i++){\n scanf(\"%d\",&c[i]);\n }\n for(i=0;i<k;i++){\n scanf(\"%d\",&d[i]);\n }\n for(i=0;i<n;i++){\n if(c[i]==0) {e[i]=d[j];j++;}\n else e[i]=c[i];\n }\n j=1;\n /*for(i=0;i<n;i++){\n printf(\"\\n\\n%d\\n\",e[i]);\n }*/\n for(i=0;i<(n-1);i++){\n f[i]=e[j]-e[i];\n\n j++;\n\n\n\n }\n\n j=1;\n // for(i=0;i<n-1;i++){printf(\"\\n%d\\n\",f[i]);}\n for(i=0;i<=n-2;i++){\n if(f[i]<0) count1++;\n else count2++;\n\n }\n //printf(\"\\n%d %d\",count1,count2);\n if(count2>0 && count1==0 && k==1) printf(\"NO\");\n else printf(\"YES\");\n\n }\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]<ara1[i-1]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,flag=0,store;\n scanf(\"%d%d\",&n,&k);\n int a[n],b[k],i;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=k;i++)\n {\n scanf(\"%d\",&b[i]);\n store=b[i];\n }\n if(k==1)\n {\n for(i=1;i<=n;i++)\n {\n if(a[i]==0)\n {\n a[i]=store ;\n // printf(\"0 is changed %d\\n\",a[i]);\n break;\n }\n }\n for(i=1;i<=n-1;i++)\n {\n flag=0;\n if(a[i]<a[i+1])\n {\n flag=1;\n }\n else\n {\n break;\n }\n }\n if(flag==0)\n {\n printf(\"Yes\\n\");\n }\n else\n {\n printf(\"No\\n\");\n }\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n\tint n ,k ,i ,c=0;\n\tscanf(\"%d%d\",&n ,&k);\n\tint a[n] ,b[k];\n\tfor(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\tfor(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\tif(k>1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(a[i]==0){\n\t\t\t\ta[i]=b[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<n-1;i++){\n\t\t\tif(a[i]>a[i+1]) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;}\n\t\t}\n\t\tif(i==n-1) printf(\"NO\");\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n long long int gcd(long long int a,long long int b);\nint main(void) {\n\t// your code goes here\nlong long int n,k,i,j,s=0,c=0;\nscanf(\"%lli %lli\",&n,&k);\nlong long int a[n];\nlong long int b[n];\nfor(i=0;i<n;i++)\n{scanf(\"%lli\",&a[i]);\nif(a[i]==0)\nc++;\n}\nfor(i=0;i<k;i++)\nscanf(\"%lli\",&b[i]);\nif(c>=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n a[i]=b[0];\n }\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n s=1;\n break;\n }\n }\n if(s==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n \n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint sort(const void *a, const void *b)\n{\n return (*(int*)b- *(int*)a);\n}\nint main()\n{\n int n, k, i, j;\n scanf(\"%d%d\",&n,&k);\n int a[n+1], b[k+1];\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n for(i=0; i<k; i++)\n scanf(\"%d\", &b[i]);\n qsort(b,k,sizeof(int),sort);\n\n for(i=0,j=0; i<n; i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j++];\n }\n if(j==k)\n break;\n }\n for(i=0; i<n-1; i++)\n {\n if(a[i] > a[i+1])\n {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n\tint n,k,cnt,d,t;\n\tscanf(\"%d%d\", &n,&k);\n\tint khobz[n],khobza[k];\n\tfor(cnt=0;cnt<n;cnt++)\n\t\tscanf(\"%d\", &khobz[cnt]);\n\tfor(cnt=0;cnt<k;cnt++)\n\t\tscanf(\"%d\", &khobza[cnt]);\n\tfor(cnt=1;cnt<k;cnt++){\n\t\td=cnt;\n\t\twhile(d>0 && khobza[d-1]<khobza[d]){\n\t\t\tt=khobza[d];\n\t\t\tkhobza[d]=khobza[d-1];\n\t\t\tkhobza[d-1]=t;\n\t\t\td--;\n\t\t}\n\t}\n\tfor(cnt=0;cnt<n;cnt++){\n\t\tif(khobz[cnt]==0){\n\t\t\tfor(d=0;d<k;d++){\n\t\t\t\tif(khobza[d]!=0){\n\t\t\t\t\tkhobz[cnt]=khobza[d];\n\t\t\t\t\tkhobza[d]=0;\n\t\t\t\t\t//d=k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(cnt=0;cnt<n-1;cnt++){\n\t\tif(khobz[cnt]>khobz[cnt+1])\n\t\t\tbreak;\n\t}\n\tif(cnt==n-1)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint judge(int a[],int b[],int n,int m)\n{\n\tint i;\n\tint t=0,x=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=b[x];x++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>a[i+1])\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nint comp(const void *a,const void *b)\n{\n\treturn*(int*)b-*(int*)a;\n}\nint main()\n{\n\tint a[500];\n\tint b[500];\n\tint n,m;\n\twhile(scanf(\"%d %d\",&n,&m)!=EOF)\n\t{\n\t \tint i;\n\t\t int c[500];\n\t\t for(i=0;i<n;i++)\n\t \t {\n\t\t \tscanf(\"%d\",&a[i]);\n\t\t\t c[i]=a[i];\n\t\t }\n\t\t for(i=0;i<m;i++)\n\t\t scanf(\"%d\",&b[i]);\n\t\t qsort(b,m,sizeof(b[0]),comp);\n\t\t int t=judge(a,b,n,m);\n\t\t if(t)printf(\"Yes\\n\");\n\t\t else\n\t\t printf(\"No\\n\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint check_inc(int a[],int size)\n{\n int i;\n for(i=0;i<size;i++)\n {\n if(a[i]>a[i+1])\n return 0;\n }\n return 1;\n}\nvoid shift_array (int a[],int size)\n{\n int temp,i;\n temp=a[0];\n for(i=0;i<size-1;i++)\n {\n a[i]=a[i+1];\n }\n a[size-1]=temp;\n}\nint main()\n{\n // int o;\n int n,k,i,j,x,v,q=0;\n scanf(\"%d %d\",&n,&k);\n int ns[n] ,ks[k],zeros[k];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ns[i]);\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&ks[i]);\n }\n for(i=0;i<k;i++)\n {\n for(j=0,v=0;j<n;j++)\n {\n if(ns[j]==0)\n {\n ns[j]=ks[v];\n zeros[v]=j;\n v++;\n }\n }\n x=check_inc(ns,n);\n if(x==0)\n {\n printf(\"Yes\");\n q=1;\n break;\n }\n shift_array (ks,k);\n for(j=0,v=0;j<n;j++)\n {\n if(zeros[v]==j)\n {\n ns[j]=0;\n v++;\n }\n }\n\n /*\n printf(\"\\n\\n\");\n for(o=0;o<n;o++)\n printf(\"%d \",ns[o]);\n */\n\n\n }\n if(q!=1)\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,t1,t2,a[200],b[200],c=0,count=0;\n scanf(\"%d %d\",&t1,&t2);\n for(i=0;i<t1;i++){\n scanf(\"%d\",&a[i]);}\n for(i=0;i<t2;i++){\n scanf(\"%d\",&b[i]);}\n\n for(i=0;i<t1;i++){\n if(a[i]!=0&&a[i+1]!=0){\n if(a[i]>a[i+1]){\n count++;\n }\n }\n\n if(a[i]==0){\n for(j=0;j<t2;j++){\n if(i==0){\n if (b[j]>a[i+1]){\n count++;}\n\n }\n else if(i==t1-1){\n if(b[j]<a[i-1]){\n count++;}\n }\n else if(b[j]<a[i-1]||b[j]>a[i+1]){\n count++;}\n }\n }\n\n\n }\n if(count>0){printf(\"Yes\");}\n else{printf(\"No\");}\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n long long int gcd(long long int a,long long int b);\nint main(void) {\n\t// your code goes here\nlong long int n,k,i,j,s=0,c=0;\nscanf(\"%lli %lli\",&n,&k);\nlong long int a[n];\nlong long int b[n];\nfor(i=0;i<n;i++)\n{scanf(\"%lli\",&a[i]);\nif(a[i]==0)\nc++;\n}\nfor(i=0;i<k;i++)\nscanf(\"%lli\",&b[i]);\nif(c>=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n a[i]=b[0];\n }\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n s=1;\n break;\n }\n }\n if(s==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n \n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint cmp(const void* a,const void* b)\n{\n\treturn (*(int *)b - *(int *)a);\n}\n\nint main()\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n],b[k];\n\tint i;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tqsort(b,k,sizeof(int),cmp);\n\tint j=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=b[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tint p=0;\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]>a[i-1])\n\t\t{\n\t\t\tp++;\n\t\t}\n\t}\n\tif(p==n-1)\n\t{\n\t\tprintf(\"No\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Yes\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long int ll;\n\nint cmpfunc(const void* a,const void* b)\n{\nreturn(*(ll*)b-*(ll*)a);\n}\n\nint main()\n{\nll n,k;\nscanf(\"%lld %lld\",&n,&k);\nll a[n];\nll b[k];\nll i;\nll stamp[200+10]={0};\nfor(i=0;i<n;i++)\n{scanf(\"%lld\",&a[i]);\nstamp[a[i]]=1;\n}\nfor(i=0;i<k;i++)\nscanf(\"%lld\",&b[i]);\nll flag;\nqsort(b,k,sizeof(ll),cmpfunc);\nll prev=0;\nfor(i=0;i<n;i++)\n{\nif(a[i]==0)\n{\nwhile(prev<k)\n{\nif(b[prev]!=0)\n{a[i]=b[prev];prev++;break;}\nprev++;\n}\n}\n}\nfor(i=0;i<n-1;i++)\nif(a[i]>a[i+1])\n{printf(\"Yes\\n\");return 0;}\nprintf(\"No\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m;\n scanf(\"%d %d\", &n, &m);\n if(m>1)printf(\"YES\");\n else\n {\n int x[202], y, i;\n for(i=1; i<=n; i++)scanf(\"%d\", &x[i]);\n scanf(\"%d\", &y), x[0]=0;\n for(i=1; i<=n; i++)\n {\n if(x[i]==0)x[i]=y;\n if(x[i]<x[i-1])break;\n }\n if(i==n+1)printf(\"NO\");\n else printf(\"YES\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,temp=0,temp1=0,flag=0;\n int myarray[n],myarray1[m];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&myarray[i]);\n if(myarray[i]==0)\n {\n temp++;\n temp1=i;\n }\n }\n for(i=0; i<m; i++)\n {\n scanf(\"%d\",&myarray1[i]);\n }\n if(temp==1)\n {\n myarray[temp1]=myarray1[0];\n for(i=0; i<n-1; i++)\n {\n if(myarray[i+1]<myarray[i])\n {\n flag=1;\n }\n }\n if(flag)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int b[k];\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n \n if(k==1)\n {\n for(i=0;i<n;i++)\n if(a[i]==0)\n a[i]=b[0];\n \n int c=0;\n for(i=0;i<n-1;i++)\n {\n // printf(\"%d \",a[i]);\n if(a[i+1]<a[i])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j,con=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\n for(i=0;i<k-1;i++)\n {\n for(j=i+1;j<k;j++){\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }}\n for(i=0,j=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n if(j==(k-1)) break;\n }}\n\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long int ll;\n\nint cmpfunc(const void* a,const void* b)\n{\nreturn(*(ll*)b-*(ll*)a);\n}\n\nint main()\n{\nll n,k;\nscanf(\"%lld %lld\",&n,&k);\nll a[n];\nll b[k];\nll i;\nll stamp[200+10]={0};\nfor(i=0;i<n;i++)\n{scanf(\"%lld\",&a[i]);\nstamp[a[i]]=1;\n}\nfor(i=0;i<k;i++)\nscanf(\"%lld\",&b[i]);\nll flag;\nqsort(b,k,sizeof(ll),cmpfunc);\nll prev=0;\nfor(i=0;i<n;i++)\n{\nif(a[i]==0)\n{\nwhile(prev<k)\n{\nif(b[prev]!=0)\n{a[i]=b[prev];prev++;break;}\nprev++;\n}\n}\n}\nfor(i=0;i<n-1;i++)\nif(a[i]>a[i+1])\n{printf(\"Yes\\n\");return 0;}\nprintf(\"No\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <conio.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n if( *(long long int*)a - *(long long int*)b < 0 )\n return -1;\n if( *(long long int*)a - *(long long int*)b > 0 )\n return 1;\n if( *(long long int*)a - *(long long int*)b == 0 )\n return 0;\n}\n\nint main(){\n int n, k;\n scanf(\"%d %d\", &n, &k);\n int a[n], x;\n if (k > 1) printf(\"Yes\\n\");\n else {\n int idx;\n for (int i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n if (!a[i]) idx = i;\n }\n scanf(\"%d\", &x);\n a[idx] = x;\n for (int i = 1; i < n; i++){\n if (a[i] < a[i - 1]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\", &a, &b);\n\n\tint *A = (int *) malloc(a*sizeof(int));\n\tint *B = (int *) malloc(b*sizeof(int));\n\n\tfor(int i=0;i<a;i++)\n\t\tscanf(\"%d\", A+i);\n\n\tfor(int i=0;i<b;i++)\n\t\tscanf(\"%d\", B+i);\n\n\tif(b>1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\n\telse\n\t{\n\t\tfor(int i=0;i<a;i++)\n\t\t\tif(!A[i])\n\t\t\t{\n\t\t\t\tA[i] = *B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tfor(int i=0;i<a-1;i++)\n\t\t\tif(A[i] > A[i+1])\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "a[202],i,f,n,k;main(){for(;~scanf(\"%d\",n?k?++i+a:&k:&n);a[f]=a[n+1])f=a[i]?f:i;for(;--n&&a[n+1]>a[n];);puts(k-1|n?\"Yes\":\"No\");}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,temp=0,temp1=0,flag=0;\n int myarray[n],myarray1[m];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&myarray[i]);\n if(myarray[i]==0)\n {\n temp++;\n temp1=i;\n }\n }\n for(i=0; i<m; i++)\n {\n scanf(\"%d\",&myarray1[i]);\n }\n if(temp==1)\n {\n myarray[temp1]=myarray1[0];\n for(i=0; i<n-1; i++)\n {\n if(myarray[i+1]<myarray[i])\n {\n flag=1;\n }\n }\n if(flag)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if(m>1)\n {\n int temp;\n for(int i=0; i<n; i++)\n scanf(\"%d\",&temp);\n for(int i=0; i<m; i++)\n scanf(\"%d\",&temp);\n printf(\"YES\");\n }\n else\n {\n int arr[n],k,flag=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==0)\n k=i;\n else\n {\n if(i!=0&&arr[i]<arr[i-1])\n flag=1;\n }\n }\n int temp;\n scanf(\"%d\",&temp);\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n\n }\n if(k!=0&&k<n-1)\n {\n if(temp>=arr[k-1]&&temp<=arr[k+1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else if(k==0)\n {\n if(temp<=arr[k+1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else if(k==n-1)\n {\n if(temp>=arr[k-1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint a,b;\n\tscanf(\"%d %d\", &a, &b);\n\n\tint *A = (int *) malloc(a*sizeof(int));\n\tint *B = (int *) malloc(b*sizeof(int));\n\n\tfor(int i=0;i<a;i++)\n\t\tscanf(\"%d\", A+i);\n\n\tfor(int i=0;i<b;i++)\n\t\tscanf(\"%d\", B+i);\n\n\tif(b>1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\n\telse\n\t{\n\t\tfor(int i=0;i<a;i++)\n\t\t\tif(!A[i])\n\t\t\t{\n\t\t\t\tA[i] = *B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\tfor(int i=0;i<a-1;i++)\n\t\t\tif(A[i] > A[i+1])\n\t\t\t{\n\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\n\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int b[k];\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n \n if(k==1)\n {\n for(i=0;i<n;i++)\n if(a[i]==0)\n a[i]=b[0];\n \n int c=0;\n for(i=0;i<n-1;i++)\n {\n // printf(\"%d \",a[i]);\n if(a[i+1]<a[i])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,i,j;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int b[k];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<k; i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k;i++){\n for(j=i+1;j<k;j++){\n if(b[i]<b[j]){\n int temp = b[i];\n b[i] = b[j];\n b[j] = temp;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i] = b[j];\n j++;\n }\n }\n int flag = 0;\n for(i=0;i<n;i++){\n for(j=i;j<n;j++){\n if(a[i]>a[j]){\n flag = 1;\n break;\n }\n }\n if(flag==1){\n break;\n }\n }\n if(flag == 1){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint a[200];\nint b[200];\nint main()\n{\n int i, index, n, k;\n scanf(\"%d %d\", &n, &k);\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if(k == 1)\n {\n if(a[i] == 0)\n index = i;\n }\n }\n for(i = 0; i < k; i++)\n {\n scanf(\"%d\", &b[i]);\n }\n if(k == 1)\n {\n a[index] = b[0];\n for(i = 1; i < n; i++)\n {\n if(a[i-1] > a[i])\n break;\n }\n if(i == n)\n printf(\"No\");\n else\n printf(\"Yes\");\n }\n else\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n int n,k,i,j,t,f,m;\n scanf(\"%d%d\",&n,&k);\n int a[n],s[k];\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++)\n scanf(\"%d\",&s[i]);\n for(i=1;i<k;i++){\n for(j=k-1;j>=i;j--)\n if(s[j]>s[j-1]){\n t=s[j];\n s[j]=s[j-1];\n s[j-1]=t;\n }\n }\n f=0;\n m=0;\n for(i=0;i<n;i++){\n if(!a[i]){\n a[i]=s[m];\n m++;\n }\n if(!i)\n continue;\n if(i && a[i]>a[i-1])\n continue;\n f=1;\n }\n if(f)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,i,a[205],b[205],j,temp;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tfor(j=0;j<k-1;j++)\n\t\t{\n\t\t\tif(b[j]<b[j+1])\n\t\t\t{\n\t\t\t\ttemp = b[j];\n\t\t\t\tb[j] = b[j+1];\n\t\t\t\tb[j+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tj = 0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i] = b[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>=a[i+1])\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int b[k];\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n \n if(k==1)\n {\n for(i=0;i<n;i++)\n if(a[i]==0)\n a[i]=b[0];\n \n int c=0;\n for(i=0;i<n-1;i++)\n {\n // printf(\"%d \",a[i]);\n if(a[i+1]<a[i])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,a[105],b[105],i,j,count=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(j=0;j<k;j++)\n\t{\n\t\tscanf(\"%d\",&b[j]);\n\t}\n\n\tif(k!=1)\n\t{\n\t\tprintf(\"Yes\\n\");\n\n\t}\n\telse \n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t{\n\t\t\t\ta[i]=b[0];\n\n\t\t\t}\n\t\t}\n\n\t\tfor(j=0;j<n-1;j++)\n\t\t{\n\t\t\tif(a[j+1]-a[j]<0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tif(count!=0)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf(\"No\\n\");\n\n\t}\n\n\n\n\t\n}"}, {"source_code": "\n#include<stdio.h>\n#define MAX 100\n \n// A utility function to swap two elements\nvoid swap(int* a, int* b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}\n \n/* This function takes last element as pivot, places\n the pivot element at its correct position in sorted\n array, and places all smaller (smaller than pivot)\n to left of pivot and all greater elements to right\n of pivot */\nint partition (int arr[], int low, int high)\n{\n int pivot = arr[high]; // pivot\n int i = (low - 1); // Index of smaller element\n \n for (int j = low; j <= high- 1; j++)\n {\n // If current element is smaller than or\n // equal to pivot\n if (arr[j] >= pivot)\n {\n i++; // increment index of smaller element\n swap(&arr[i], &arr[j]);\n }\n }\n swap(&arr[i + 1], &arr[high]);\n return (i + 1);\n}\n \n/* The main function that implements QuickSort\n arr[] --> Array to be sorted,\n low --> Starting index,\n high --> Ending index */\nvoid quickSort(int arr[], int low, int high)\n{\n if (low < high)\n {\n /* pi is partitioning index, arr[p] is now\n at right place */\n int pi = partition(arr, low, high);\n \n // Separately sort elements before\n // partition and after partition\n quickSort(arr, low, pi - 1);\n quickSort(arr, pi + 1, high);\n }\n}\n \n/* Function to print an array */\nvoid printArray(int arr[], int size)\n{\n int i;\n for (i=0; i < size; i++)\n printf(\"%d \", arr[i]);\n printf(\"\\n\");\n}\n\nint isAscending(int a[], int size ){\n int i;\n for(i = 1; i<size; i++){\n if(a[i-1] > a[i])\n return 0;\n }\n return 1;\n}\n \n// Driver program to test above functions\nint main()\n{\n // int arr[] = {1,2, 3, 4, 5};\n // int n = sizeof(arr)/sizeof(arr[0]);\n // quickSort(arr, 0, n-1);\n // printf(\"Sorted array: \\n\");\n // printArray(arr, n);\n\n int n, k, a[MAX], b[MAX], sample[201], i, flag, j;\n scanf(\"%d\", &n); // Number of elements in `a`\n scanf(\"%d\", &k); // Number of elements in `b`\n\n for(i = 0; i < n; i++){\n scanf(\"%d\",&a[i]);\n }\n\n for(i = 0; i < k; i++){\n scanf(\"%d\",&b[i]);\n }\n\n for(i = 0; i < 200; i++){\n sample[i] = 0;\n }\n\n flag = 1;\n quickSort(b, 0, k-1);\n j = 0;\n if(k == 1){\n for(i = 0; i < n; i++){\n if(a[i] == 0){\n if(sample[b[j]] == 0){\n sample[b[j]] = 1;\n a[i] = b[j];\n j++;\n }\n else{\n flag = 0;\n break;\n } \n\n }\n \n }\n\n if(isAscending(a, n))\n flag = 0;\n \n }\n\n else{\n\n for(i = 0; i < n; i++){\n if(a[i] == 0){\n if(sample[b[j]] == 0){\n sample[b[j]] = 1;\n a[i] = b[j];\n j++;\n }\n else{\n flag = 0;\n break;\n } \n\n }\n \n }\n }\n\n\n if(!flag)\n printf(\"No\");\n else\n printf(\"Yes\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfnc(const void *a,const void *b){\n if(*(int *)a==*(int *)b) return 0; else return *(int *)b-*(int *)a;\n}\nint main(){\n int n,k;scanf(\" %d%d\",&n,&k);\n int i,j=0,jk,a[n],b[k],min=0;\n for(i=0;i<n;i++){scanf(\" %d\",&a[i]);if(a[i]==0)jk=i;}\n for(i=0;i<k;i++)scanf(\" %d\",&b[i]);\n if(k==1){\n a[jk]=b[0];\n for(i=0;i<n;i++){if(a[i]<=min){j++;break;}min=a[i];}\n j>0? printf(\"Yes\"):printf(\"No\");\n }\n else puts(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint arr[104], get[104], zero[104];\n\nint main() {\n\tint n, k, i, j, zerocnt = 0, zeroinx,fl;\n\n\tscanf(\"%d%d\", &n, &k);\n\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &arr[i]);\n\t\tif(arr[i] == 0)\n\t\tzerocnt++;\n\t}\n\t\n\tfor (i = 0; i < k; i++) {\n\t\tscanf(\"%d\", &get[i]);\n\t}\n\tif (zerocnt >= 2) {\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse if (zerocnt == 1) {\n\t\t\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tif (arr[i] == 0)\n\t\t\t\tarr[i] = get[0];\n\t\t}\n\t\tfl = 0;\n\n\t\tfor (i = 0; i < n-1; i++) {\n\t\t\tif (arr[i] > arr[i + 1]) {\n\t\t\t\tfl = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t\tif (fl == 0)printf(\"No\\n\");\n\t\telse printf(\"Yes\\n\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b)\n{\n return *(int *)a - *(int *)b;\n}\n\n\nint main()\n{\n int a[100], b[100];\n int n, k;\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a[i]);\n }\n for(int i = 0; i < k; ++i) {\n scanf(\"%d\", &b[i]);\n }\n qsort(b, k, sizeof(int), cmp);\n for(int i = 0; i < n; ++i) {\n if(a[i] == 0 && k) {\n a[i] = b[k - 1];\n --k;\n }\n }\n for(int i = 1; i < n; ++i) {\n if(a[i] < a[i - 1]) {\n puts(\"Yes\");\n return 0;\n }\n }\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,a[105],b[105],i,j,count=0;\n\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(j=0;j<k;j++)\n\t{\n\t\tscanf(\"%d\",&b[j]);\n\t}\n\n\tif(k!=1)\n\t{\n\t\tprintf(\"Yes\\n\");\n\n\t}\n\telse \n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t{\n\t\t\t\ta[i]=b[0];\n\n\t\t\t}\n\t\t}\n\n\t\tfor(j=0;j<n-1;j++)\n\t\t{\n\t\t\tif(a[j+1]-a[j]<0)\n\t\t\t\tcount++;\n\t\t}\n\n\t\tif(count!=0)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf(\"No\\n\");\n\n\t}\n\n\n\n\t\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,i,j,c=0,t,a[100000],b[100000];\n scanf(\"%d %d\",&x,&y);\n\n for(i=0;i<x;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0)\n c++;\n }\n for(i=0;i<y;i++){\n scanf(\"%d\",&b[i]);\n }\n if(c>1)\n printf(\"Yes\\n\");\n\n else if(c==1){\n for(i=0;i<x;i++){\n if(a[i]==0)\n a[i]=b[0];\n }\n for(i=0;i<x-1;i++){\n if(a[i]>a[i+1]){\n printf(\"Yes\\n\");\n break;\n }\n\n\n }\n if(i>=x-1)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev,ans=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tif(count==m&&count>1)\n\t\tans=1;\n\tif(m!=count)\n\t\tans=0;\n\tif(count==1&&m==1)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t\ta[i]=b[0];\n\t\t}\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tif(a[i]<a[i-1])\n\t\t\t\tans=1;\n\t\t}\n\t}\n\tif(ans==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<conio.h>\n#include<ctype.h>\n#include<string.h>\n\nint main()\n{\n int n,k,a[201],b[200],i,j,l=0,count=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n\n if(k>1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n else{\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n a[i]=b[0];\n if(i<n-1){\n if(a[i+1]==0)\n a[i+1]=b[0];\n if(a[i]>a[i+1]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n }\n }\n\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\t// your code goes here\n\tint n,k,i,j,h=0;\n\tscanf(\"%d %d\", &n,&k);\n\tint a[n],b[201]={0},c[k];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\", &a[i]);\n\t\tfor(i=0;i<k;i++)\n\t{scanf(\"%d\", &j);\n\t b[j]++;}\n\t j=0;\n\t for(i=200;i>0;i--)\n\t {\n\t \tif(b[i]!=0)\n\t \t{\n\t \t\tc[j]=i;\n\t \t\tj++;\n\t \t}\n\t }\n\t j=0;\n\t\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=c[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\tif(a[i]<=a[i+1])\n\th++;\n\tif(h==n-1)\n\tprintf(\"NO\");\n\telse \n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint *sort(int ara[],int n)\n{\n int i,j,temp;\n for(i=0;i<n;i++)\n {\n for(j=i+1;j<n;j++)\n {\n if(ara[j]>ara[i])\n {\n temp = ara[i];\n ara[i] = ara[j];\n ara[j] = temp;\n }\n }\n }\n return ara;\n}\n\nint main()\n{\n int n,k,i,j;\n scanf(\"%d %d\",&n,&k);\n int ara1[n],ara2[k];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&ara1[i]);\n }\n for(j=0;j<k;j++)\n {\n scanf(\"%d\",&ara2[j]);\n }\n\n\n int *ara3 = sort(ara2,k);\n j = 0;\n\n for(i=0;i<n;i++)\n {\n if(ara1[i] == 0)\n {\n ara1[i] = ara3[j];\n j++;\n }\n }\n\n int flag = 0;\n for(i=0;i<n;i++)\n {\n if(ara1[i] > ara1[i+1])\n {\n flag = 1;\n break;\n }\n }\n if(flag == 1) printf(\"Yes\");\n else printf(\"No\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n if (*(int *)a < *(int *)b) {\n return 1;\n } else if (*(int *)a > *(int *)b) {\n return -1;\n } else {\n return 0;\n }\n}\n\nint main(void) {\n int n = 0, k = 0, i = 0;\n int a[101] = {0, }, b[101] = {0, };\n int zeroIndex[101] = {0, }, zeroCnt = 0;\n \n scanf(\"%d %d\", &n, &k);\n for (i=0;i<n;i++) {\n scanf(\"%d\", &a[i]);\n if (a[i] == 0) {\n zeroIndex[zeroCnt++] = i;\n }\n }\n \n for (i=0;i<k;i++) {\n scanf(\"%d\", &b[i]);\n }\n \n qsort(b, k, sizeof(int), compare);\n\n for (i=0;i<zeroCnt;i++) {\n a[zeroIndex[i]] = b[i];\n }\n \n char flag = 1;\n for (i=0;i<n-1;i++) {\n if (a[i] >= a[i + 1]) {\n flag = 0;\n break;\n }\n }\n \n if (flag) {\n printf(\"No\\n\");\n } else {\n printf(\"Yes\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,k,count=0,flag=0,min,max;\n\tint num1[105],num2[105];\n\tscanf(\"%d%d\",&n,&k);\n\tscanf(\"%d\",&num1[0]);\n\tfor(int i=1;i<n;i++){\n\t\tscanf(\"%d\",&num1[i]);\n\t\tif(num1[i]!=0 && num1[i]<num1[i-1])\n\t\t\tflag=1;\t\t\n\t}\n\tscanf(\"%d\",&num2[0]);\n\tmin=max=num2[0];\n\tfor(int i=1;i<k;i++){\n\t\tscanf(\"%d\",&num2[i]);\n\t\tif(num2[i]<min)\n\t\t\tmin=num2[i];\n\t\tif(num2[i]>max)\n\t\t\tmax=num2[i];\n\t}\n\tif(flag || k>1){\n\t\tprintf(\"Yes\\n\");\n\t\treturn 0;\n\t}\n\tif(num1[0]==0){\n\t\tif(max<num1[1])\n\t\t\tprintf(\"No\\n\");\n\t\telse\n\t\t\tprintf(\"Yes\\n\");\n\t}\n\telse if(num1[n-1]==0){\n\t\tif(num1[n-2]<min)\n\t\t\tprintf(\"No\\n\");\n\t\telse\n\t\t\tprintf(\"Yes\\n\");\n\t}\n\telse{\n\t\tfor(int i=1;i<n-1;i++)\n\t\t\tif(num1[i]==0){\n\t\t\t\tif(num1[i+1]>max && num1[i-1]<min)\n\t\t\t\t\tprintf(\"No\\n\");\n\t\t\t\telse\n\t\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfnc(const void *a,const void *b){\n if(*(int *)a==*(int *)b) return 0; else return *(int *)b-*(int *)a;\n}\nint main(){\n int n,k;scanf(\" %d%d\",&n,&k);\n int i,j=0,jk,a[n],b[k],min=0;\n for(i=0;i<n;i++){scanf(\" %d\",&a[i]);if(a[i]==0)jk=i;}\n for(i=0;i<k;i++)scanf(\" %d\",&b[i]);\n if(k==1){\n a[jk]=b[0];\n for(i=0;i<n;i++){if(a[i]<=min){j++;break;}min=a[i];}\n j>0? printf(\"Yes\"):printf(\"No\");\n }\n else puts(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint a[200];\nint b[200];\nint main()\n{\n int i, index, n, k;\n scanf(\"%d %d\", &n, &k);\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if(k == 1)\n {\n if(a[i] == 0)\n index = i;\n }\n }\n for(i = 0; i < k; i++)\n {\n scanf(\"%d\", &b[i]);\n }\n if(k == 1)\n {\n a[index] = b[0];\n for(i = 1; i < n; i++)\n {\n if(a[i-1] > a[i])\n break;\n }\n if(i == n)\n printf(\"No\");\n else\n printf(\"Yes\");\n }\n else\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int arr[201],a[201],b[201];\n int n,x,i,j,p=-1,t=300,k=0;\n scanf(\"%d%d\",&n,&x);\n\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]!=0)\n {\n b[k]=arr[i];\n k++;\n }\n }\n for(i=0; i<x; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n\n if(x>1)\n {\n printf(\"YES\");\n return 0;\n }\n for(i=0; i<k-1; i++)\n {\n if(b[i]>b[i+1])\n {\n printf(\"YES\");\n return 0;\n }\n }\n\n for(i=0; i<n; i++)\n {\n if(arr[i]==0)\n {\n if(i!=0){p=arr[i-1];}\n\n if(i!=(n-1)){t=arr[i+1];}\n }\n }\n\n if(a[0]<p || a[0]>t)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint cmp(const void* a,const void* b)\n{\n\treturn (*(int *)b - *(int *)a);\n}\n\nint main()\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n],b[k];\n\tint i;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tqsort(b,k,sizeof(int),cmp);\n\tint j=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=b[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tint p=0;\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]>a[i-1])\n\t\t{\n\t\t\tp++;\n\t\t}\n\t}\n\tif(p==n-1)\n\t{\n\t\tprintf(\"No\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Yes\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,temp=0,temp1=0,flag=0;\n int myarray[n],myarray1[m];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&myarray[i]);\n if(myarray[i]==0)\n {\n temp++;\n temp1=i;\n }\n }\n for(i=0; i<m; i++)\n {\n scanf(\"%d\",&myarray1[i]);\n }\n if(temp==1)\n {\n myarray[temp1]=myarray1[0];\n for(i=0; i<n-1; i++)\n {\n if(myarray[i+1]<myarray[i])\n {\n flag=1;\n }\n }\n if(flag)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n }\n else\n {\n printf(\"YES\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int a[101],b[101],A,B;\n scanf(\"%d%d\",&A,&B);\n for(int i=0;i<A;i++){\n scanf(\"%d\",&a[i]);\n }\n for(int i=0;i<B;i++){\n scanf(\"%d\",&b[i]);\n }\n int k=0;\n for(int i=0;i<A;i++){\n if(a[i]==0) k++;\n }\n for(int i=0;i<A;i++){\n if(a[i]==0) {\n a[i]=b[0];\n break;\n }\n }\n for(int i=1;i<A;i++){\n if(a[i]<a[i-1]) {\n k++;\n break;\n }\n }\n if(k>1) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\t// your code goes here\n\tint n,k,i,j,h=0;\n\tscanf(\"%d %d\", &n,&k);\n\tint a[n],b[201]={0},c[k];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\", &a[i]);\n\t\tfor(i=0;i<k;i++)\n\t{scanf(\"%d\", &j);\n\t b[j]++;}\n\t j=0;\n\t for(i=200;i>0;i--)\n\t {\n\t \tif(b[i]!=0)\n\t \t{\n\t \t\tc[j]=i;\n\t \t\tj++;\n\t \t}\n\t }\n\t j=0;\n\t\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=c[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\tif(a[i]<=a[i+1])\n\th++;\n\tif(h==n-1)\n\tprintf(\"NO\");\n\telse \n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n long long int gcd(long long int a,long long int b);\nint main(void) {\n\t// your code goes here\nlong long int n,k,i,j,s=0,c=0;\nscanf(\"%lli %lli\",&n,&k);\nlong long int a[n];\nlong long int b[n];\nfor(i=0;i<n;i++)\n{scanf(\"%lli\",&a[i]);\nif(a[i]==0)\nc++;\n}\nfor(i=0;i<k;i++)\nscanf(\"%lli\",&b[i]);\nif(c>=2)\nprintf(\"Yes\\n\");\nelse\n{\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n a[i]=b[0];\n }\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n s=1;\n break;\n }\n }\n if(s==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n \n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint a[200];\nint b[200];\nint main()\n{\n int i, index, n, k;\n scanf(\"%d %d\", &n, &k);\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n if(k == 1)\n {\n if(a[i] == 0)\n index = i;\n }\n }\n for(i = 0; i < k; i++)\n {\n scanf(\"%d\", &b[i]);\n }\n if(k == 1)\n {\n a[index] = b[0];\n for(i = 1; i < n; i++)\n {\n if(a[i-1] > a[i])\n break;\n }\n if(i == n)\n printf(\"No\");\n else\n printf(\"Yes\");\n }\n else\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint cmp(const void*x,const void*y){\n return *(int*)y - *(int*)x ;\n}\nint main(){\n int i,j=0,n,k,a[100],b[100];\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n qsort(b,k,sizeof(int),cmp);\n for(i=0;i<n;i++){\n if(a[i]==0) { a[i]=b[j]; j++; }\n }\n for(i=1;i<n;i++){\n if(a[i]<a[i-1]){ printf(\"Yes\"); return 0; }\n }\n printf(\"No\"); return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint check(int [],int );\nint fun(int [],int ,int [],int );\nint check(int a[],int n)\n{\n int i;\n for(i=1;i<n;i++)\n {\n if(a[i-1]>a[i])\n {\n return 0;\n }\n }\n return 1;\n}\nint fun(int a[],int n,int b[],int m)\n{\n int i;\n if(m>=2)\n {\n return 1;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[0];\n break;\n }\n }\n if(check(a,n)==1)\n {\n return 0;\n }\n return 1;\n}\nint main()\n{\n int a[101];\n int b[101];\n int n,m,i;\n scanf(\"%d%d\",&n,&m);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<m;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n printf((fun(a,n,b,m)==1)?\"Yes\\n\":\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void*x,const void*y){\n return *(int*)y - *(int*)x ;\n}\nint main(){\n int i,j=0,n,k,a[100],b[100];\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n qsort(b,k,sizeof(int),cmp);\n for(i=0;i<n;i++){\n if(a[i]==0) { \n a[i]=b[j]; \n j++; \n }\n }\n for(i=1;i<n;i++){\n if(a[i]<a[i-1]){ \n printf(\"Yes\\n\"); \n return 0; \n }\n }\n printf(\"No\\n\"); \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n, k, i, temp, index = 0;\n\tscanf(\"%d %d\", &n, &k);\n\tint *a, *b;\n\t\n\ta = (int*)malloc(sizeof(int) * n);\n\tb = (int*)malloc(sizeof(int) * k);\n\t\n\tfor(i = 0; i < n; i++) scanf(\"%d\", &a[i]);\n\tfor(i = 0; i < k; i++) scanf(\"%d\", &b[i]);\n\t\n/*\tfor(i = 1; i < n; i++) {\n\t\tif(a[i] && (a[i] < a[i - 1])) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}*/\n\t\n\ttemp = 0;\n\t\n\tfor(i = 0; i < k; i++) {\n\t\tif(temp < b[i]){\n\t\t\ttemp = b[i];\n\t\t\tindex = i;\n\t\t}\n\t}\n\t\n\tb[index] = 0;\n\t\n\tfor(i = 0; i < n; i++) {\n\t\tif(!a[i]) {\n\t\t\ta[i] = temp;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\ttemp = 0;\n\t\n\tfor(i = 0; i < k; i++) {\n\t\tif(temp < b[i]){\n\t\t\ttemp = b[i];\n\t\t}\n\t}\n\t\n\tfor(i = 0; i < n; i++) {\n\t\tif(!a[i]) {\n\t\t\ta[i] = temp;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tfor(i = 0; i < n - 1; i++) {\n\t\tif(a[i] > a[i + 1]) {\n\t\t\tprintf(\"YES\\n\");\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tif(i == n - 1) printf(\"NO\\n\");\n\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j,n,k,t;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<1;i++)\n {\n for(j=i;j<k;j++)\n {\n if(b[j]>b[i])\n { t=b[i];\n b[i]=b[j];\n b[j]=t;\n break;\n }\n }\n break;\n }\n j=0;\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n }\n for(i=0;i+1<n;i++)\n {\n if((a[i+1]>a[i])&&(i+1==n-1))\n printf(\"No\");\n else if(a[i+1]<a[i])\n {\n printf(\"Yes\");\n break;\n }\n\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j,con=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\n for(i=0;i<k-1;i++)\n {\n for(j=i+1;j<k;j++){\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }}\n for(i=0,j=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n if(j>=(k-1)) break;\n }}\n\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,flag=0;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(int i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n for(int i=0;i<k;i++)\n scanf(\"%d \",&b[i]);\n if(a[0]==0)\n a[0]=b[0];\n if(k>1)\n printf(\"Yes\");\n \n else\n {\n for(int i=0;i<n-1;i++)\n { \n if(a[i+1]==0)\n a[i+1]=b[0];\n if(a[i+1]<a[i])\n {flag=1;break;}\n }\n if(flag==0)\n printf(\"No\");\n else printf(\"Yes\");\n }\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#define A_MAX 100 + 1\n#define B_MAX 100 + 1\n\nint main()\n{\n\tint n, k;\n\tint a[A_MAX], b[B_MAX];\n\twhile (scanf(\"%d %d\", &n, &k) != EOF)\n\t{\n\t\tint i, j;\n\t\tfor (i = 0; i < n; ++i)\n\t\t{ scanf(\"%d\", &a[i]); }\n\t\tfor (i = 0; i < k; ++i)\n\t\t{ scanf(\"%d\", &b[k]); }\n\t\tif (k > 1) { puts(\"Yes\\n\"); } \n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < n; ++i)\n\t\t\t{\n\t\t\t\tif (!a[i]) { break; }\n\t\t\t}\n\t\t\tif ((i == 0 && b[k] < a[i + 1]) || (i > 0 && i != n - 1 && b[k] > a[i - 1] && b[k] < a[i + 1]) || (i == n - 1 && a[i - 1] < b[k]))\n\t\t\t{\n\t\t\t\tint flag = 0;\n\t\t\t\ta[i] = b[k];\n\t\t\t\tfor (j = 0; j < n - 1; ++j)\n\t\t\t\t{\n\t\t\t\t\tif (a[j] > a[j + 1])\n\t\t\t\t\t{\n\t\t\t\t\t\tflag = 1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (flag) { puts(\"Yes\\n\"); }\n\t\t\t\telse { puts(\"No\\n\"); }\n\t\t\t}\n\t\t\telse\n\t\t\t{ puts(\"Yes\\n\"); }\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid merge(int arr[],int l,int m,int r)\n{\n int i, j, k;\n int n1 = m - l + 1;\n int n2 = r - m;\n \n int L[n1], R[n2];\n \n for (i = 0; i < n1; i++)\n L[i] = arr[l + i];\n for (j = 0; j < n2; j++)\n R[j] = arr[m + 1+ j];\n \n i = 0; \n j = 0; \n k = l;\n while (i < n1 && j < n2)\n {\n if (L[i] >= R[j])\n {\n arr[k] = L[i];\n i++;\n }\n else\n {\n arr[k] = R[j];\n j++;\n }\n k++;\n }\n while (i < n1)\n {\n arr[k] = L[i];\n i++;\n k++;\n }\n while (j < n2)\n {\n arr[k] = R[j];\n j++;\n k++;\n }\n}\n \nvoid mergeSort(int arr[],int l,int r)\n{\n if (l < r)\n {\n int m = l+(r-l)/2;\n mergeSort(arr, l, m);\n mergeSort(arr, m+1, r);\n \n merge(arr, l, m, r);\n }\n}\nint main()\n{\n\tint n,k,i,j,flag=0,c=0;\n\tscanf(\"%d%d\",&n,&k);\n\tint *a=malloc(n*sizeof(int));\n\tint *b=malloc(k*sizeof(int));\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0;i<k;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tmergeSort(b,0,k-1);\n\tj=0;\n\tfor(i=0;i<n;i++)\n\t\tif(a[i]==0)\n\t\t\ta[i]=b[j++];\n\tfor(i=1;i<n;i++)\n\t\tif(a[i-1]<a[i])\n\t\t\tc++;\n\t/*printf(\"%d\\n\",c);\n\t\tfor(i=1;i<n;i++)\n\t\t\tprintf(\"%d\\t\",a[i]);\n\tprintf(\"\\n\");*/\t\t\n\tif(c==n-1)\n\t\tprintf(\"No\\n\");\n\telse\n\t\tprintf(\"Yes\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,flag=0;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(int i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n for(int i=0;i<k;i++)\n scanf(\"%d \",&b[i]);\n if(a[0]==0)\n a[0]=b[0];\n if(k>1)\n printf(\"Yes\");\n \n else\n {\n for(int i=0;i<n-1;i++)\n { \n if(a[i+1]==0)\n a[i+1]=b[0];\n if(a[i+1]<a[i])\n {flag=1;break;}\n }\n if(flag==0)\n printf(\"No\");\n else printf(\"Yes\");\n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint A[100000],B[100000],a,b,i,min,max,j,c=0;\nscanf(\"%d%d\",&a,&b);\nfor(i=0;i<a;i++)\n scanf(\"%d\",&A[i]);\nfor(i=0;i<b;i++)\n scanf(\"%d\",&B[i]);\n\n if(b==1)\n {\n for(i=0;i<a;i++)\n if(A[i]==0)\n break;\n\n A[i]=B[0];\n\n }\n else\n {\n min=B[0];\n max=B[0];\n for(i=1;i<b;i++)\n {\n if(B[i]<min)\n min=B[i];\n if(B[i]>max)\n max=B[i];\n }\n for(i=0;i<a;i++)\n if(A[i]==0)\n break;\n A[i]=max;\n\n for(j=a-1;j>=0;j--)\n if(A[j]==0)\n break;\n A[j]=min;\n\n }\n for(i=0;i<a-1;i++)\n {\n if(A[i]<A[i+1])\n continue;\n else{\n c=1;\n break;\n }\n }\n if(c==1)\n printf(\"yes\\n\");\n else\n printf(\"no\\n\");\n\n\n\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n \n int n , k , i , j ;\n \n scanf(\"%d %d\",&n,&k) ;\n \n int ara[n] , bra[k] ;\n \n for( int x = 0 ; x < n ; x++ ) scanf(\"%d\",&ara[x]) ;\n \n for( int y = 0 ; y < k ; y++ ) scanf(\"%d\",&bra[y]) ;\n \n int key ;\n \n if( k == 1 ) {\n \n for( int a = 0 ; a < n ; a++ ) {\n \n if( ara[a] == 0 ) {\n \n ara[a] = bra[0] ; \n \n break ;\n \n }\n \n }\n \n for( i = 0 , j = 1 ; j < n ; i++ , j++ ) {\n \n if( ara[i] > ara[j] ) {\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n }\n \n }\n \n printf(\"No\\n\") ; return 0 ;\n \n \n \n }\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n}"}, {"source_code": "#include<stdio.h>\nmain()\n{ int n,k,less2=200,flag=0,max2=0,i;\n scanf(\"%d %d\",&n,&k);\n int m[n],s[k];\n for(i=0;i<n;i++)\n {scanf(\"%d\",&m[i]);\n }\n for(i=0;i<k;i++)\n {scanf(\"%d\",&s[i]);\n if(less2>s[i])\n less2=s[i];\n if(max2<s[i])\n max2=s[i];\n }\n for(i=0;i<n;i++)\n {\n if( (m[i]>=m[i+1])&&(m[i]!=0) &&(m[i+1]!=0) )\n flag=1;\n }\n\n\n\n\n\n for(i=0;i<=n&&flag==0;i++)\n {\n if(m[i]+m[i+1]==0)\n flag=1;\n\n else if(m[i]==0)\n {if( i!=0&& ( (m[i-1]>=less2 ) || (m[i+1]<=max2) ) )\n flag=1;\n else if(i==0&&m[i+1]<=max2)\n flag=1;\n}\n }\n\n\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n {\n int n,k,i,j;\n\t scanf(\"%d %d\",&n,&k);\n\t int a[n],b[k];\n\t for(i=0;i<n;i++)\n\t {\n\t\t scanf(\"%d\",&a[i]);\n\t }\n\t for(i=0;i<k;i++)\n\t {\n\t\t scanf(\"%d\",&b[i]);\n\t\t if(i){\n\t\t for(j=0;j<i;j++)\n\t\t {\n\t\t\t if(b[i]>b[j]){\n\t\t\t\t int temp=b[i];\n\t\t\t\t b[i]=b[j];\n\t\t\t\t b[j]=temp;\n\t\t\t }\n\t\t }\n\t\t }\n\t }\n\t int check=0;\n\t for(i=0;i<n;i++)\n\t {\n\t\t if(a[i]==0){\n\t\t\t a[i]=b[check];\n\t\t\t check++;\n\t\t }\n\t }\n\t \n\t int count;\n\t for(i=0;i<n-1;i++)\n\t {\n\t\t for(j=i+1;j<n;j++)\n\t\t {\n\t\t\t if(a[i]<a[j]){\n\t\t\t\t count=1;\n\t\t\t }\n\t\t\t else{\n\t\t\t\t count=0;\n\t\t\t\t break;\n\t\t\t }\n\t\t }\n\t\t if(count==0){\n\t\t\t break;\n\t\t }\n\t }\n\t // printf(\"%d\",count);\n\t if(count==1){\n\t\t printf(\"NO\");\n\t }\n\t if(count==0){\n\t\t printf(\"YES\");\n\t }\n\t return 0;\n\t }"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j,con=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\n for(i=0;i<k-1;i++)\n {\n for(j=i+1;j<k;j++){\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }}\n for(i=0,j=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n if(j>=(k-1)) break;\n }}\n\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n\nint a[100];\n\nint main() {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n if (k >= 2) {\n printf(\"Yes\");\n return 0;\n }\n int zero_index;\n int sorted = 1;\n for (int i = 0; i < n; ++i) {\n scanf(\"%d\", a + i);\n if (a[i] == 0) zero_index = i;\n if (i != 0 && i != zero_index && a[i] <= a[i-1]) sorted = 0;\n }\n int b;\n scanf(\"%d\", &b);\n if (sorted) {\n if (zero_index == 0 && b < a[1] ||\n zero_index == n - 1 && a[zero_index - 1] < b ||\n zero_index != 0 && zero_index != n - 1 && a[zero_index - 1] < b && b < a[zero_index + 1]) {\n printf(\"No\");\n return 0;\n }\n }\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n,k;\nint a[1000],b[1000];\nint main()\n{\n while(scanf(\"%d%d\",&n,&k)!=-1)\n {\n a[0]=0;\n for(int i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(int i=1;i<=k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n if(k==1)\n {\n int flag=0;\n for(int i=1;i<=n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[1];\n }\n if(a[i]-a[i-1]<0)\n {\n flag=1;\n }\n\n }\n if(flag==1)printf(\"Yes\\n\");\n else printf(\"No\\n\");\n\n }\n else\n {\n printf(\"Yes\\n\");\n }\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint n,k,*arr,*brr;\nint main()\n{ int tr=0;\nscanf(\"%d%d\",&n,&k);\n arr=(int*)malloc(sizeof(int)*n);\n int temp=0;\n while(temp<n)scanf(\"%d\",&arr[temp++]);\n brr=(int*)malloc(sizeof(int)*k);\n temp=0;\n while(temp<k)scanf(\"%d\",&brr[temp++]);\n if(temp>1)printf(\"Yes\");\nelse\n{\nint t=0;\nwhile(arr[t]!=0)t++;\narr[t]=brr[0];\nt=1;\nwhile(t!=n)\n{\n if(arr[t]>arr[t-1])tr++;\nt++;\n}\nif(tr==n-1)printf(\"No\");\n else printf(\"Yes\");\n\n}\n\n\nfree(arr);free(brr);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n\tint n,k,cnt,d,t;\n\tscanf(\"%d%d\", &n,&k);\n\tint khobz[n],khobza[k];\n\tfor(cnt=0;cnt<n;cnt++)\n\t\tscanf(\"%d\", &khobz[cnt]);\n\tfor(cnt=0;cnt<k;cnt++)\n\t\tscanf(\"%d\", &khobza[cnt]);\n\tfor(cnt=1;cnt<k;cnt++){\n\t\td=cnt;\n\t\twhile(d>0 && khobza[d-1]<khobza[d]){\n\t\t\tt=khobza[d];\n\t\t\tkhobza[d]=khobza[d-1];\n\t\t\tkhobza[d-1]=t;\n\t\t\td--;\n\t\t}\n\t}\n\tfor(cnt=0;cnt<n;cnt++){\n\t\tif(khobz[cnt]==0){\n\t\t\tfor(d=0;d<k;d++){\n\t\t\t\tif(khobza[d]!=0){\n\t\t\t\t\tkhobz[cnt]=khobza[d];\n\t\t\t\t\tkhobza[d]=0;\n\t\t\t\t\t//d=k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfor(cnt=0;cnt<n-1;cnt++){\n\t\tif(khobz[cnt]>khobz[cnt+1])\n\t\t\tbreak;\n\t}\n\tif(cnt==n-1)\n\t\tprintf(\"NO\");\n\telse\n\t\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint judge(int a[],int b[],int n,int m)\n{\n\tint i;\n\tint t=0,x=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=b[x];x++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>a[i+1])\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nint comp(const void *a,const void *b)\n{\n\treturn*(int*)b-*(int*)a;\n}\nint main()\n{\n\tint a[500];\n\tint b[500];\n\tint n,m;\n\twhile(scanf(\"%d %d\",&n,&m)!=EOF)\n\t{\n\t \tint i;\n\t\t int c[500];\n\t\t for(i=0;i<n;i++)\n\t \t {\n\t\t \tscanf(\"%d\",&a[i]);\n\t\t\t c[i]=a[i];\n\t\t }\n\t\t for(i=0;i<m;i++)\n\t\t scanf(\"%d\",&b[i]);\n\t\t qsort(b,m,sizeof(b[0]),comp);\n\t\t int t=judge(a,b,n,m);\n\t\t if(t)printf(\"Yes\\n\");\n\t\t else\n\t\t printf(\"No\\n\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint judge(int a[],int b[],int n,int m);\nint comp(const void *a,const void *b)\n{\n return *(int *)b-*(int *)a;\n}\nint main()\n{\n\tint a[500];\n\tint b[500];\n\tint n,m;\n\twhile(scanf(\"%d %d\",&n,&m)!=EOF)\n\t{\n\t\tint i;\tint c[500];\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t\tc[i]=a[i];\n\t\t}\t\n\t\tfor(i=0;i<m;i++)\n\t\t\tscanf(\"%d\",&b[i]);\n\t\tqsort(b,m,sizeof(b[0]),comp);\n\t\tint t=judge(a,b,n,m);\n\t\tif(t)\n\t\t\tprintf(\"Yes\\n\");\n\t\telse\n\t\t\tprintf(\"No\\n\");\n\t}\n}\nint judge(int a[],int b[],int n,int m)\n{\n\t\n\tint i;\n\tint t=0,x=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=b[x];\n\t\t\tx++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>a[i+1])\n\t\treturn 1; \n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n\nint a[100];\n\nint main() {\n int n, k;\n scanf(\"%d%d\", &n, &k);\n if (k >= 2) {\n printf(\"Yes\");\n return 0;\n }\n int zero_index;\n int sorted = 1;\n for (int i = 0; i < n; ++i) {\n scanf(\"%d\", a + i);\n if (a[i] == 0) zero_index = i;\n if (i != 0 && i != zero_index && a[i] <= a[i-1]) sorted = 0;\n }\n int b;\n scanf(\"%d\", &b);\n if (sorted) {\n if (zero_index == 0 && b < a[1] ||\n zero_index == n - 1 && a[zero_index - 1] < b ||\n zero_index != 0 && zero_index != n - 1 && a[zero_index - 1] < b && b < a[zero_index + 1]) {\n printf(\"No\");\n return 0;\n }\n }\n printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,i,mem,count=0,A[105],B[105],C[105],p=0,flag=0;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&A[i]);\nif(A[i]==0)\n{\nmem=i;\ncount++;\n}\nelse\n{\nC[p]=A[i];\np++;\n}\n}\nA[n]=300;\nfor(i=0;i<p;i++)\n{\nif(i!=0 && C[i]<C[i-1])\n{\nflag=1;\nbreak;\n}\n}\nfor(i=0;i<k;i++)\n{\nscanf(\"%d\",&B[i]);\n}\nif(count>1)\n{\nprintf(\"YES\\n\");\n}\nelse\n{\nif(B[0]>=A[mem-1] && B[0]<=A[mem+1] && flag==0)\n{\nprintf(\"NO\\n\");\n}\nelse\n{\nprintf(\"YES\\n\");\n}\n}\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if(m>1)\n {\n int temp;\n for(int i=0; i<n; i++)\n scanf(\"%d\",&temp);\n for(int i=0; i<m; i++)\n scanf(\"%d\",&temp);\n printf(\"YES\");\n }\n else\n {\n int arr[n],k,flag=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==0)\n k=i;\n else\n {\n if(i!=0&&arr[i]<arr[i-1])\n flag=1;\n }\n }\n int temp;\n scanf(\"%d\",&temp);\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n\n }\n if(k!=0&&k<n-1)\n {\n if(temp>=arr[k-1]&&temp<=arr[k+1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else if(k==0)\n {\n if(temp<=arr[k+1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else if(k==n-1)\n {\n if(temp>=arr[k-1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint A[100000],B[100000],a,b,i,min,max,j,c=0;\nscanf(\"%d%d\",&a,&b);\nfor(i=0;i<a;i++)\n scanf(\"%d\",&A[i]);\nfor(i=0;i<b;i++)\n scanf(\"%d\",&B[i]);\n\n if(b==1)\n {\n for(i=0;i<a;i++)\n if(A[i]==0)\n break;\n\n A[i]=B[0];\n\n }\n else\n {\n min=B[0];\n max=B[0];\n for(i=1;i<b;i++)\n {\n if(B[i]<min)\n min=B[i];\n if(B[i]>max)\n max=B[i];\n }\n for(i=0;i<a;i++)\n if(A[i]==0)\n break;\n A[i]=max;\n\n for(j=a-1;j>=0;j--)\n if(A[j]==0)\n break;\n A[j]=min;\n\n }\n for(i=0;i<a-1;i++)\n {\n if(A[i]<A[i+1])\n continue;\n else{\n c=1;\n break;\n }\n }\n if(c==1)\n printf(\"yes\\n\");\n else\n printf(\"no\\n\");\n\n\n\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,t,b;\n scanf(\"%d%d\",&n,&k);\n int a[102];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==0)\n t=i;\n }\n scanf(\"%d\",&b);\n a[t]=b;\n for(i=0;i<n-1;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(k!=1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint a[210], b[210];\nint main(){\n int i, j;\n int n,k;\n scanf(\"%d%d\", &n, &k);\n for (i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n }\n for (i = 0; i < k; i++) {\n scanf(\"%d\", &b[i]);\n }\n if (k >= 2) {\n printf(\"Yes\\n\");\n }\n else {\n for (i = 0; i < n; i++) {\n if (a[i] == 0) {\n a[i] = b[0];\n }\n if ((i >= 1) && (a[i] < a[i-1])) {\n break;\n }\n }\n if (i == n) {\n printf(\"No\\n\");\n }\n else {\n printf(\"Yes\\n\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nvoid merge(int arr_1[],int arr_2[],int size,int arr_3[])\n {\n int i=0,j=0,k=0,size_i=(size+1)/2,size_j=size-size_i;\n while(k<size)\n {\n if((arr_1[i]<=arr_2[j]||i==size_i)&&j!=size_j)\n arr_3[k++]=arr_2[j++];\n else\n arr_3[k++]=arr_1[i++];\n }\n}\nvoid merge_sort(int a[],int start,int end,int a_1[])\n {\n int size=end-start+1;\n if(start==end)\n a_1[0]=a[start];\n else\n {\n int mid=(start+end)/2;\n int arr_1[mid-start+1],arr_2[end-mid];\n merge_sort(a,start,mid,arr_1);\n merge_sort(a,mid+1,end,arr_2);\n merge(arr_1,arr_2,size,a_1);\n }\n}\nint main()\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tint a[n],b[k],b_1[k];\n\tfor(int i=0;i<n;i++)\n\tscanf(\"%d\",&a[i]);\n\tfor(int i=0;i<k;i++)\n\tscanf(\"%d\",&b_1[i]);\n\tmerge_sort(b_1,0,k-1,b);\n\tint j=0;\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0&&j<k)\n\t\t{\n\t\ta[i]=b[j];\t\n\t\tj++;\n\t\t}\n\t}\n\tint check=0;\n\t//for(int i=0;i<n;i++)\n\t//printf(\"%d \",a[i]);\n\t//printf(\"\\n\");\n\tfor(int i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>a[i+1])\n\t\t{\n\t\t\tcheck=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(check==1)\n\tprintf(\"Yes\");\n\telse\n\tprintf(\"No\");\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define MAX_LENGTH 100 + 1\n#define true 1\n#define false 0\n\nint main()\n{\n int a[MAX_LENGTH], missing_number, zero_index = -1, no_of_zeroes, entire_length,i, is_possible = false;\n scanf(\"%d %d\",&entire_length, &no_of_zeroes);\n\n for(i = 0; i < entire_length; i++)\n {\n scanf(\"%d\", &a[i]);\n\n if(a[i] == 0)\n zero_index = i;\n else if(i > 0 && a[i] <= a[i - 1])\n is_possible = true;\n\n }\n for(i = 0; i < no_of_zeroes; i++)\n scanf(\"%d\",&missing_number);\n\n //If there is more than one zero, it is always possible to make the sequence non-increasing.\n if(no_of_zeroes > 1)\n {\n is_possible = true;\n }\n else\n {\n if(zero_index == 0)\n {\n if(missing_number >= a[zero_index + 1])\n is_possible = true;\n }\n else if(zero_index == entire_length - 1)\n {\n if(missing_number <= a[zero_index - 1])\n is_possible = true;\n }\n else if(missing_number >= a[zero_index + 1] || missing_number <= a[zero_index - 1])\n {\n is_possible = true;\n }\n }\n\n\n printf(is_possible ? \"Yes\\n\" : \"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint compare(const void *a, const void *b) {\n if (*(int *)a < *(int *)b) {\n return 1;\n } else if (*(int *)a > *(int *)b) {\n return -1;\n } else {\n return 0;\n }\n}\n\nint main(void) {\n int n = 0, k = 0, i = 0;\n int a[101] = {0, }, b[101] = {0, };\n int zeroIndex[101] = {0, }, zeroCnt = 0;\n \n scanf(\"%d %d\", &n, &k);\n for (i=0;i<n;i++) {\n scanf(\"%d\", &a[i]);\n if (a[i] == 0) {\n zeroIndex[zeroCnt++] = i;\n }\n }\n \n for (i=0;i<k;i++) {\n scanf(\"%d\", &b[i]);\n }\n \n qsort(b, k, sizeof(int), compare);\n\n for (i=0;i<zeroCnt;i++) {\n a[zeroIndex[i]] = b[i];\n }\n \n char flag = 1;\n for (i=0;i<n-1;i++) {\n if (a[i] >= a[i + 1]) {\n flag = 0;\n break;\n }\n }\n \n if (flag) {\n printf(\"No\\n\");\n } else {\n printf(\"Yes\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n \n int n , k , i , j ;\n \n scanf(\"%d %d\",&n,&k) ;\n \n int ara[n] , bra[k] ;\n \n for( int x = 0 ; x < n ; x++ ) scanf(\"%d\",&ara[x]) ;\n \n for( int y = 0 ; y < k ; y++ ) scanf(\"%d\",&bra[y]) ;\n \n int key ;\n \n if( k == 1 ) {\n \n for( int a = 0 ; a < n ; a++ ) {\n \n if( ara[a] == 0 ) {\n \n ara[a] = bra[0] ; \n \n break ;\n \n }\n \n }\n \n for( i = 0 , j = 1 ; j < n ; i++ , j++ ) {\n \n if( ara[i] > ara[j] ) {\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n }\n \n }\n \n printf(\"No\\n\") ; return 0 ;\n \n \n \n }\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i=0,j=0,a=0,b=0,flag=0;\n scanf(\"%d %d\",&a,&b);\n int n[a];\n int k[b];\n for(i=0; i<a; i++)\n scanf(\"%d\",&n[i]);\n for(i=0; i<b; i++)\n scanf(\"%d\",&k[i]);\n for(i=0,j=0; i<a; i++)\n {\n if(n[i]==0)\n {\n n[i]=k[j];\n j++;\n if(n[i]>=n[i-1] && n[i]<=n[i+1]);\n flag++;\n }\n }\n\n if(flag==b)\n {\n for(i=0,j=0; i<a; i++)\n {\n if(n[i]>n[i+1])\n {\n printf(\"YES\");\n return 0;\n }\n\n }\n }\n if(b==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,i,b[202],a[203],flag,j;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++)\n { \n scanf(\"%d\",&a[i]);\n if(k==1)\n {\n if(a[i]==0)\n j=i;\n }\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n if(k!=1)\n printf(\"YES\\n\");\n else\n {\n a[j]=b[0];\n flag=0;\n for(i=1;i<n;i++)\n {\n if(a[i-1]>a[i])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {\n printf(\"YES\\n\");\n }\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n\tint n ,k ,i ,c=0;\n\tscanf(\"%d%d\",&n ,&k);\n\tint a[n] ,b[k];\n\tfor(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\tfor(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\tif(k>1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(a[i]==0){\n\t\t\t\ta[i]=b[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<n-1;i++){\n\t\t\tif(a[i]>a[i+1]) {\n\t\t\t\tprintf(\"YES\");\n\t\t\t\tbreak;}\n\t\t}\n\t\tif(i==n-1) printf(\"NO\");\n\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int b[k];\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n \n if(k==1)\n {\n for(i=0;i<n;i++)\n if(a[i]==0)\n a[i]=b[0];\n \n int c=0;\n for(i=0;i<n-1;i++)\n {\n // printf(\"%d \",a[i]);\n if(a[i+1]<a[i])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{ int n,k,less2=200,flag=0,max2=0,i;\n scanf(\"%d %d\",&n,&k);\n int m[n],s[k];\n for(i=0;i<n;i++)\n {scanf(\"%d\",&m[i]);\n }\n for(i=0;i<k;i++)\n {scanf(\"%d\",&s[i]);\n if(less2>s[i])\n less2=s[i];\n if(max2<s[i])\n max2=s[i];\n }\n for(i=0;i<n;i++)\n {\n if( (m[i]>=m[i+1])&&(m[i]!=0) &&(m[i+1]!=0) )\n flag=1;\n }\n\n\n\n\n\n for(i=0;i<=n&&flag==0;i++)\n {\n if(m[i]+m[i+1]==0)\n flag=1;\n\n else if(m[i]==0)\n {if( i!=0&& ( (m[i-1]>=less2 ) || (m[i+1]<=max2) ) )\n flag=1;\n else if(i==0&&m[i+1]<=max2)\n flag=1;\n}\n }\n\n\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n int a[n],b[k];\n int i,flag=0;\n for (i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n\n for (i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n\n if (k>1)\n printf(\"Yes\");\n else\n {\n if (k==1)\n for (i=0;i<n;i++)\n if (!a[i]) {\n a[i]=b[0]; break; }\n for (i=0;i<n-1;i++)\n if (a[i]>a[i+1])\n { flag=1; break; }\n if (flag)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 102\nint main(){\n int a[N];\n int b[N];\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<k;i++){\n scanf(\"%d\",&b[i]);\n }\n int tmp=a[0];\n int increase=1;\n for(i=1;i<n;i++){\n if(a[i]!=0){\n if(tmp<=a[i]){\n tmp=a[i];\n }else{\n increase=0;\n break;\n }\n }\n }\n //printf(\"increase\\n\");\n int max=b[0];\n int min=b[0];\n for(i=1;i<k;i++){\n if(max<b[i])max=b[i];\n if(min>b[i])min=b[i];\n }\n if(k!=1){\n if(max!=min){\n increase=0;\n }else{\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i]=b[0];\n }\n }\n for(i=1;i<n;i++){\n if(a[i-1]>a[i]){\n increase=0;\n }\n }\n }\n }else{\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i]=b[0];\n }\n }\n for(i=1;i<n;i++){\n if(a[i-1]>a[i]){\n increase=0;\n }\n }\n }\n if(increase)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, m;\n scanf(\"%d %d\", &n, &m);\n if(m>1)printf(\"YES\");\n else\n {\n int x[202], y, i;\n for(i=1; i<=n; i++)scanf(\"%d\", &x[i]);\n scanf(\"%d\", &y), x[0]=0;\n for(i=1; i<=n; i++)\n {\n if(x[i]==0)x[i]=y;\n if(x[i]<x[i-1])break;\n }\n if(i==n+1)printf(\"NO\");\n else printf(\"YES\");\n }\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main ()\n{ \n int i,k,n, flag =0, a[100],b[100];\n scanf(\"%d%d\", &n,&k);\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for (i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n \n for (i=0;i<n-1;i++)\n {\n if (k>=2)\n {printf(\"Yes\\n\"); flag++; break;}\n else \n {\n\t if ((a[i]>a[i+1]) && (a[i+1]!=0) && (a[i]!=0))\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t else if ((a[i]!=0) && (a[i]>a[i+2]) && (a[i+1]==0) && ((i+2)!=n) )\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t else if ((a[i]!=0) && (a[i]<a[i+2]) && (a[i+1]==0) && ((i+2)!=n) && (a[i+2]<b[0]) )\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t else if ((a[i]!=0) && (a[i]<a[i+2]) && (a[i+1]==0) && ((i+2)!=n) && (a[i]>b[0]) )\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t else if ((a[i]==0) && (a[i+1]<b[0]))\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t else if ((a[n-1]==0) && (a[n-2]>b[0]))\n\t { printf(\"Yes\\n\"); flag++; break;}\n\t \n }\n // printf(\"%d\\n\",i);\n }\n if (flag==0)\n printf(\"No \\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n\nint main()\n{\n int i, j,n, k, sortflag = 0;\n scanf(\"%d %d\", &n, &k);\n int a[n], b[k], c[n];\n for(i = 0; i < n; ++i)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i < k; ++i)\n scanf(\"%d\", &b[i]);\n\n for(i = 0; i < k - 1; ++i) {\n for(j = i + 1; j < k; ++j) {\n if(b[i] < b[j]) {\n b[i] = b[i] ^ b[j];\n b[j] = b[i] ^ b[j];\n b[i] = b[i] ^ b[j];\n }\n }\n }\n j = 0;\n for(i = 0; i < n; ++i) {\n if(a[i] != 0) c[i] = a[i];\n else {\n c[i] = b[j], j++;\n }\n }\n for(i = 0; i < n - 1; ++i) {\n if(c[i] > c[i + 1]) {\n sortflag = 1;\n break;\n }\n }\n// for(i = 0; i < n; ++i) printf(\"%d \", c[i]);\n if(sortflag == 0) printf(\"No\");\n else printf(\"Yes\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,countzero=0,zeroindex;\n scanf(\"%d %d\",&n,&m);\n int a[n],b[m];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0){\n countzero++;\n zeroindex=i;}\n }\n for(i=0;i<m;i++)scanf(\"%d\",&b[i]);\n if(countzero==1){\n a[zeroindex]=b[0];\n int flag=0;\n for(i=0;i<n-1;i++){\n if(a[i+1]<a[i]){flag=1;break;}\n }\n if(flag)printf(\"YES\");\n else printf(\"NO\");\n }\n else {\n printf(\"YES\");\n }\n return 0;\n\n }\n"}, {"source_code": "a[202],i,f,n,k;main(){for(;~scanf(\"%d\",n?k?++i+a:&k:&n);a[f]=a[n+1])f=a[i]?f:i;for(;--n&&a[n+1]>a[n];);puts(k-1|n?\"Yes\":\"No\");}"}, {"source_code": "# include <stdio.h>\nint main()\n{\n\n int n,k,i,j,idx,zero=0,is_increase=0,b_num=0,match=0;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]==0) {\n zero++;\n idx=i;\n }\n\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n if(zero==n) printf(\"Yes\");\n else if(zero==1) {\n a[idx]=b[0];\n for(i=0;i<n;i++)\n {\n if(a[i]==b[0]) b_num++;\n if(i>0 &&(a[i]<a[i-1])) is_increase=1;\n }\n if(b_num==1 && is_increase==1) printf(\"Yes\");\n else printf(\"No\");\n }\n else if(zero>1){\n //printf(\"pop\");\n for(i=0;i<k;i++){\n for(j=0;j<n;j++){\n if(b[i]==a[j]) {match=1;break;}\n }\n }\n if(match==1) printf(\"No\");\n else printf(\"Yes\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//ascend sort\nint main()\n{\n int n,k,i,t=0,f=0,j;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int b[k];\n scanf(\"%d\",&a[0]);\n for(i=1;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]<a[i-1] && a[i]!=0)\n t=2;\n }\n for(i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n if(i!=0 && b[i]>b[i-1])\n f=1;\n }\n if(t==2)\n {\n printf(\"Yes\");\n }\n else\n {\n\n // printf(\"f=%d\\t\",f);\n if(f==1)\n {\n for(i=0;i<k-1;i++)\n {\n for(j=i+1;j<k;j++)\n {\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n }\n }\n// for(i=0;i<k;i++)\n // printf(\"b[i]=%d\\t\",b[i]);\n j=0;\n f=0;\n for(i=0;i<n;i++)\n {\n if(a[i]==0)\n a[i]=b[j++];\n if(a[i]<a[i-1] && i!=0)\n {\n // printf(\"a[i]=%d\\n\",a[i]);\n f=1;\n break;\n }\n }\n if(f==1)\n printf(\"Yes\");\n else printf(\"No\");\n }\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#define A_MAX 100 + 1\n#define B_MAX 100 + 1\n\nint main()\n{\n\tint n, k;\n\tint a[A_MAX], b[B_MAX];\n\twhile (scanf(\"%d %d\", &n, &k) != EOF)\n\t{\n\t\tint i, j;\n\t\tfor (i = 0; i < n; ++i)\n\t\t{ scanf(\"%d\", &a[i]); }\n\t\tfor (i = 0; i < k; ++i)\n\t\t{ scanf(\"%d\", &b[k]); }\n\t\tif (k > 1) { puts(\"Yes\\n\"); } \n\t\telse\n\t\t{\n\t\t\tfor (i = 0; i < n; ++i)\n\t\t\t{\n\t\t\t\tif (!a[i]) { break; }\n\t\t\t}\n\t\t\tif (b[k] > a[i - 1] && b[k] < a[i + 1])\n\t\t\t{\n\t\t\t\tint flag = 0;\n\t\t\t\ta[i] = b[k];\n\t\t\t\tfor (j = 0; j < n - 1; ++j)\n\t\t\t\t{\n\t\t\t\t\tif (a[j] > a[j + 1])\n\t\t\t\t\t{\n\t\t\t\t\t\tflag = 1; break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (flag) { puts(\"Yes\\n\"); }\n\t\t\t\telse { puts(\"No\\n\"); }\n\t\t\t}\n\t\t\telse\n\t\t\t{ puts(\"Yes\\n\"); }\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,i,mem,count=0,A[105],B[105],C[105],p=0,flag=0;\nscanf(\"%d%d\",&n,&k);\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&A[i]);\nif(A[i]==0)\n{\nmem=i;\ncount++;\n}\nelse\n{\nC[p]=A[i];\np++;\n}\n}\nfor(i=0;i<p;i++)\n{\nif(i!=0 && C[i]<C[i-1])\n{\nflag=1;\nbreak;\n}\n}\nfor(i=0;i<k;i++)\n{\nscanf(\"%d\",&B[i]);\n}\nif(count>1)\n{\nprintf(\"YES\\n\");\n}\nelse\n{\nif(B[0]>=A[mem-1] && B[0]<=A[mem+1] && flag==0)\n{\nprintf(\"NO\\n\");\n}\nelse\n{\nprintf(\"YES\\n\");\n}\n}\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int a[n],i;\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n int b[k];\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n \n if(k==1)\n {\n for(i=0;i<n;i++)\n if(a[i]==0)\n a[i]=b[0];\n \n int c=0;\n for(i=0;i<n-1;i++)\n {\n printf(\"%d \",a[i]);\n if(a[i+1]<a[i])\n c++;\n }\n \n if(c>0)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"YES\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n,k,m,a,b,c,d,e,f,g,i,j,count=0;\nscanf(\"%d %d\",&n,&k);\nint x[n],y[k];\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&x[i]);\n}\nfor(i=0;i<k;i++)\n{\nscanf(\"%d\",&y[i]);\n}\n/*checking whether the first is not increasing*/\nfor(i=0;i<n-1;i++)\n{\nif(x[i]==0)\n{\ncontinue;\n}\na=x[i+1];\nif(x[i+1]==0)\n{\n a=x[i+2];\n}\nif(x[i]>a)\n{\nprintf(\"Yes\");return 0;\n}\n}\nfor(i=0;i<n;i++)\n{\nif(x[i]==0)\n{\ncount++;\n}\n}\nif(count==1)\n{\n for(i=0;i<n;i++)\n {\n if(x[i]==0&&i==n-1&&x[i-1]>y[0])\n {\n printf(\"Yes\");return 0;\n }\n }\n\nprintf(\"No\");return 0;\n}\nfor(i=0;i<k-1;i++)\n{\nif(y[i]!=y[i+1])\n{\nprintf(\"Yes\");return 0;\n}\nif(i==k-2)\n{\nprintf(\"No\");return 0;\n}\n}\n\n\n\n\n\n\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n long long int ch[400000]= {0},cp[400000];\n char kh[200000],arr[2000][200];\n long long int a,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;\n double z,go;\n\n scanf(\"%lld%lld\",&a,&b);\n j=k=l=0;\n j=b>1?1:0;\n for(i=0; i<a; i++)\n {\n scanf(\"%lld\",&c);\n if(k>c && c!=0)\n j=1;\n if(c!=0)\n k=c;\n }\n printf(j==1?\"YES\\n\":\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev,ans;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tprev=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]!=0&&a[i]<prev)\n\t\t\tflag=1;\n\t\tif(a[i]!=0)\n\t\t\tprev=a[i];\n\t}\n\tif(count==m&&count>1)\n\t\tans=1;\n\tif(m<count)\n\t\tans=0;\n\tif(count==1&&m==1)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t\ta[i]=b[0];\n\t\t}\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tif(a[i]<a[i-1])\n\t\t\t\tans=1;\n\t\t}\n\t}\n\tif(count==1&&flag==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]>ara1[i-1]){\n continue;\n }\n else break;\n }\n if(i==1) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],b[100],i,c,d=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(k==1){\n if(a[i]==0)\n c=i;\n }\n }\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n if(k==1){\n a[c]=b[0];\n for(i=0;i<n;i++){\n if(a[i]<a[i+1]){\n d=1;\n continue;}\n else{\n d=0;\n break;\n }\n }\n }\n\n if(d==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k,a[201]={},i,b[201]={},c[201]={},v;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0) v=i;\n }\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n if(k==1){\n a[v]=b[0];\n for(i=1;i<n;i++){\n if(a[i]<a[i+1]){\n printf(\"No\");\n return 0;\n }\n }\n printf(\"Yes\");\n }\n else printf(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n\n\n\nint main(int argc, char* argv[])\n{\n int a , b;\n scanf(\"%d\", &a); scanf(\"%d\", &b);\n \n char yes[4] = \"YES\"; yes[3] = '\\0';\n char no [3] = \"NO\"; no[2] = '\\0';\n \n \n \n if(a == 1) {printf(\"%s\", no); return 0;}\n if(a == b) {printf(\"%s\", yes); return 0;}\n \n int arr_a[a]; int arr_b[b];\n \n for(int i = 0; i < a; i++)\n {\n scanf(\"%d\", &arr_a[i]);\n }\n //printf(\"%s\", no); return 0;\n for(int i = 0; i < b; i++)\n {\n scanf(\"%d\", &arr_b[i]);\n }\n \n if(arr_a[0] == 0)\n {\n for(int j = 0; j < b; j++)\n {\n if(arr_a[1] < arr_b[j]){printf(\"%s\", yes); return 0;}\n }\n }\n \n for(int i = 0; i < a; i++)\n {\n if((arr_a[i] != 0)&&(i < a - 1) &&(arr_a[i+1] != 0)){\n if(arr_a[i] > arr_a[i+1]) {printf(\"%s\", yes); return 0;}\n }\n \n if((arr_a[i] == 0))\n {\n if((arr_a[i] == 0) && (i < a - 1))\n {\n if(arr_a[i + 1] == 0) {printf(\"%s\", yes); return 0;}\n else\n {\n for(int j = 0; j < b; j++)\n {\n if(arr_a[i-1] > arr_b[j] || arr_a[i+1] < arr_b[j]){printf(\"%s\", yes); return 0;}\n }\n printf(\"%s\", no); return 0;\n }\n }\n else\n {\n for(int j = 0; j < b; j++)\n {\n if(arr_a[i-1] > arr_b[j]){printf(\"%s\", yes); return 0;}\n }\n printf(\"%s\", no); return 0;\n }\n }\n }\n printf(\"%s\", no);\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev,ans;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tif(count==m&&count>1)\n\t\tans=1;\n\tif(m!=count)\n\t\tans=0;\n\tif(count==1&&m==1)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t\ta[i]=b[0];\n\t\t}\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tif(a[i]<a[i-1])\n\t\t\t\tans=1;\n\t\t}\n\t}\n\tif(ans==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max<sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n for(i=0,j=0;i<n;i++)\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],b[100],i,c,d=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(k==1){\n if(a[i]==0)\n c=i;\n }\n }\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n if(k==1){\n a[c]=b[0];\n for(i=0;i<n;i++){\n if(a[i]<a[i+1]){\n d=1;\n continue;}\n else{\n d=0;\n break;\n }\n }\n }\n\n if(d==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]>ara1[i-1]){\n count++;\n }\n }\n if(count==(kase1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main ()\n{ \n int i,k,n, flag =0, a[100],b[100];\n scanf(\"%d%d\", &n,&k);\n for (i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for (i=0;i<k;i++)\n {\n scanf(\"%d\",&b[i]);\n }\n \n for (i=0;i<n-1;i++)\n {\n if (k>=2)\n {printf(\"Yes \\n\"); flag++; break;}\n else \n {\n\t if ((a[i]>a[i+1]) && (a[i+1]!=0) && (a[i]!=0))\n\t { printf(\"Yes \\n\"); flag++; break;}\n\t else if ((a[i]!=0) && (a[i]>a[i+2]) && (a[i+1]==0) && ((i+2)!=n) )\n\t { printf(\"Yes \\n\"); flag++; break;}\n\t else if ((a[i]!=0) && (a[i]<a[i+2]) && (a[i+1]==0) && ((i+2)!=n) && (a[i]>b[0] || a[i+1]<b[0]) )\n\t { printf(\"Yes \\n\"); flag++; break;}\n\t else if ((a[i]==0) && (a[i+1]<b[0]))\n\t { printf(\"Yes \\n\"); flag++; break;}\n\t else if ((a[n-1]==0) && (a[n-2]>b[0]))\n\t { printf(\"Yes \\n\"); flag++; break;}\n\t \n }\n }\n if (flag==0)\n printf(\"No \\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],b[100],i,c,d=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(k==1){\n if(a[i]==0)\n c=i;\n }\n }\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n if(k==1){\n a[c]=b[0];\n for(i=0;i<n;i++){\n if(a[i]<a[i+1]){\n d=1;\n continue;}\n else{\n d=0;\n break;\n }\n }\n }\n\n if(d==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,i,j;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int b[k];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<k; i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k;i++){\n for(j=i+1;j<k;j++){\n if(b[i]<b[j]){\n int temp = b[i];\n b[i] = b[j];\n b[j] = temp;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i] = b[j];\n j++;\n }\n }\n int flag = 0;\n for(i=0;i<n;i++){\n for(j=i;j<n;j++){\n if(a[i]<a[j]){\n flag = 1;\n break;\n }\n }\n if(flag==1){\n break;\n }\n }\n if(flag == 1){\n printf(\"No\");\n }\n else{\n printf(\"Yes\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]>ara1[i-1]){\n continue;\n }\n else break;\n }\n if(i==1) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n freopen(\"naz.txt\",\"r\",stdin);\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n scanf(\"%d\",&ara2[i]);\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=0;i<kase1;i++){\n if(ara1[i+1]>ara1[i]){\n count++;\n }\n }\n if(count==(kase1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n printf(\"no\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]>ara1[i-1]){\n continue;\n }\n else break;\n }\n if(i==0) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k,count=0,p=0;\n char a[1000],b[1000],c[1000];\n\n scanf(\"%d%d\",&m,&n);\n\nfor(i=0;i<m;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\n\n // while(n>1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i<m;i++)\n {\n if(a[i]==0 && n==1)\n a[i]=b[0];\n\n }\n\n\n\n for(i=0;i<m-1;i++)\n {\n if(a[i]<a[i+1])\n count++;\n else\n break;\n }\n\n if(count==m-1)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n int n, m, n1, m1, num, c = 0, t, i;\n scanf(\"%d %d\", &n, &m);\n int a[n], b[m];\n for(i = 0; i<n; i++)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i<m; i++)\n scanf(\"%d\", &b[i]);\n\n for(i = 0; i<n-1; i++)\n {\n if(a[i+1]==0)\n {i++; continue;}\n\n if(a[i]>a[i+1])\n {printf(\"Yes\"); return 0;}\n }\n\n //if(i!=n-2)\n //{printf(\"YES\"); return 0;}\n\n\n if(m==1)\n {\n for(i = 0; i<n; i++)\n {\n if(a[i]==0)\n break;\n }\n //printf(\"%d %d\", b[0], a[i-1]);\n if(b[0]<a[i-1] || b[0]>a[i+1])\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n\n\n else\n {\n for(i = 0; i<n; i++)\n {\n if(a[i]==0)\n break;\n }\n int max, min;\n max = b[0];\n min = b[0];\n for(i = 0; i<m; i++)\n {\n if(b[i]>=max)\n max = b[i];\n if(b[i]<=min)\n min = b[i];\n }\n\n if(max!=min)\n printf(\"Yes\");\n else if(max==min && max<a[i-1])\n printf(\"Yes\");\n else\n printf(\"No\");\n\n }\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\n\n\n\nint i, j;\nfor(i = 0; i < m; i++)\nfor(j = 0; j < m-1-i; j++)\nif(small[j] > small[j+1])\n{\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n}\n\n\n int flag=0;\n for(int i=0,j=0;i<n&&j<m;i++)\n {\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max<sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,i,j;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int b[k];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<k; i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k;i++){\n for(j=i+1;j<k;j++){\n if(b[i]<b[j]){\n int temp = b[i];\n b[i] = b[j];\n b[j] = temp;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i] = b[j];\n j++;\n }\n }\n int flag = 0;\n for(i=0;i<n;i++){\n if(a[i] < a[i+1]){\n flag = 1;\n break;\n }\n }\n if(flag == 1){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n\t// your code goes here\n\tint n,k,i,j;\n\tscanf(\"%d %d\", &n,&k);\n\tint a[n],b[201]={0},c[k];\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\", &a[i]);\n\t\tfor(i=0;i<k;i++)\n\t{scanf(\"%d\", &j);\n\t b[j]++;}\n\t j=0;\n\t for(i=200;i>0;i--)\n\t {\n\t \tif(b[i]!=0)\n\t \t{\n\t \t\tc[j]=i;\n\t \t\tj++;\n\t \t}\n\t }\n\t j=0;\n\t\tfor(i=0;i<n;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i]=c[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\tif(a[i]<a[i+1])\n{\tprintf(\"NO\");\n\treturn 0;}\n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k=0,l=0;\n\n scanf(\"%d %d\",&n,&m);\n\n int x[n],y[m];\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&y[i]);\n\n\n if(k>1) printf(\"Yes\");\n else\n\n {\n for(i=0;i<n;i++)\n\n if(!x[i]) x[i]=y[0];\n\n for(i=1;i<n;i++)\n {\n if(x[i]<x[i-1]) break;\n }\n\n if(i==n) printf(\"No\");\n\n else printf(\"Yes\");\n\n }\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=0;i<kase1;i++){\n if(ara1[i+1]>ara1[i]){\n count++;\n }\n }\n if(count==(kase1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev,ans;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tprev=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]!=0&&a[i]<prev)\n\t\t\tflag=1;\n\t\tif(a[i]!=0)\n\t\t\tprev=a[i];\n\t}\n\tif(count==m&&count>1)\n\t\tans=1;\n\tif(m<count)\n\t\tans=0;\n\tif(count==1&&m==1)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t\ta[i]=b[0];\n\t\t}\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tif(a[i]<a[i-1])\n\t\t\t\tans=1;\n\t\t}\n\t}\n\tif(ans==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k,j,t,x;\n int a[1000],b[1000];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\" %d\",&a[i]);\n }\n for(i=0;i<k;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k-1;i++){\n for(j=i+1;j<k;j++){\n if(b[i]>b[j]){\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n }\n for(i=1;i<n;i++){\n if(a[i]<=a[i-1]){\n x=0;\n break;\n }\n else{\n x=1;\n }\n }\n if(x==0){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j;\n\n scanf(\"%d %d\",&n,&m);\n\n int x[n],y[m];\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&y[i]);\n\nj=0;\n for(i=1;i<n;i++)\n {\n if((x[i]&&x[i]<x[i-1])||(i!=1&&!x[i-1]&&x[i]<x[j])) break;\n\n if(!x[i]&&x[i-1]) j=i-1;\n }\n\n\n\n if(i!=n) printf(\"Yes\");\n\n else{\n\n if(m==1)\n\n {\n if(y[0]>=x[j]&&y[0]<=x[j+2])\n\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n\n else\n {\n for(i=1;i<m;i++)\n {\n if(y[i]!=y[i-1]) break;\n }\n\n if(i==m&&y[0]>=x[j]&&y[0]<=x[j+1+m])\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,k,j,t,x;\n int a[1000],b[1000];\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\" %d\",&a[i]);\n }\n for(i=0;i<k;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k-1;i++){\n for(j=i+1;j<k;j++){\n if(b[i]>b[j]){\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n }\n for(i=1;i<n;i++){\n if(a[i]<=a[i-1]){\n x=0;\n break;\n }\n else{\n x=1;\n }\n }\n if(x==0){\n printf(\"Yes\");\n }\n else{\n printf(\"No\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,i,j,c=0,t,a[100000],b[100000];\n scanf(\"%d %d\",&x,&y);\n\n for(i=0;i<x;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0)\n c++;\n }\n for(i=0;i<y;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=y-1;i>0;i--){\n for(j=0;j<i-1;j++){\n if(b[j]<b[i]){\n t=b[j];\n b[j]=b[i];\n b[i]=t;\n }\n }\n }\n if(c>y)\n printf(\"No\\n\");\n else{\n j=0;\n for(i=0;i<x;i++){\n if(a[i]==0){\n a[i]=b[j];\n j++;\n }\n }\n for(i=0;i<x-1;i++){\n if(a[i]>a[i+1]){\n printf(\"Yes\\n\");\n break;\n }\n }\n if(i>=x-1)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tprev=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]!=0&&a[i]<prev)\n\t\t\tflag=1;\n\t\tif(a[i]!=0)\n\t\t\tprev=a[i];\n\t}\n\tif(count==1&&flag==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n int ff=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n if(big[i]!=0)\n for(int j=i; j>=0; j--)\n {\n if(big[j]!=0)\n {\n if(big[i]<big[j])\n {\n ff=1;\n break;\n }\n }\n }\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\n if(ff==1)\n {\n printf(\"YES\");\n return 0;\n }\n\n int i, j;\n for(i = 0; i < m; i++)\n for(j = 0; j < m-1-i; j++)\n if(small[j] > small[j+1])\n {\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n }\n\n\n int flag=0;\n for(int i=0,j=0; i<n&&j<m; i++)\n {\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\n //freopen(\"in.txt\", \"r\", stdin);\n int n, m, n1, m1, num, c = 0, t, i;\n scanf(\"%d %d\", &n, &m);\n int a[n], b[m];\n for(i = 0; i<n; i++)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i<m; i++)\n scanf(\"%d\", &b[i]);\n\n for(i = 0; i<n-1; i++)\n {\n if(a[i+1]==0)\n {i++; continue;}\n\n if(a[i]>a[i+1])\n {printf(\"Yes\"); return 0;}\n }\n\n //if(i!=n-2)\n //{printf(\"YES\"); return 0;}\n\n\n if(m==1)\n {\n for(i = 0; i<n; i++)\n {\n if(a[i]==0)\n break;\n }\n //printf(\"%d %d\", b[0], a[i-1]);\n if(b[0]<a[i-1] || b[0]>a[i+1])\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n\n\n else\n {\n for(i = 0; i<n; i++)\n {\n if(a[i]==0)\n break;\n }\n int max, min;\n max = b[0];\n min = b[0];\n for(i = 0; i<m; i++)\n {\n if(b[i]>=max)\n max = b[i];\n if(b[i]<=min)\n min = b[i];\n }\n\n if(max!=min)\n printf(\"Yes\");\n else if(max==min && max<a[i-1])\n printf(\"Yes\");\n else\n printf(\"No\");\n\n }\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k=0,l=0;\n\n scanf(\"%d %d\",&n,&m);\n\n int x[n],y[m];\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&y[i]);\n\n\n if(k>1) printf(\"Yes\");\n else\n\n {\n for(i=0;i<n;i++)\n\n if(!x[i]) x[i]=y[0];\n\n for(i=1;i<n;i++)\n {\n if(x[i]<x[i-1]) break;\n }\n\n if(i==n) printf(\"No\");\n\n else printf(\"Yes\");\n\n }\n\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev,ans;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tprev=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]!=0&&a[i]<prev)\n\t\t\tflag=1;\n\t\tif(a[i]!=0)\n\t\t\tprev=a[i];\n\t}\n\tif(count==m&&count>1)\n\t\tans=1;\n\tif(m<count)\n\t\tans=0;\n\tif(count==1&&m==1)\n\t{\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(a[i]==0)\n\t\t\t\ta[i]=b[0];\n\t\t}\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tif(a[i]<a[i-1])\n\t\t\t\tans=1;\n\t\t}\n\t}\n\tif(ans==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max<sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n\nint n,i,k;\nint a[101],b[101];\nint z = -1;\nint order = 1;\n\nscanf(\"%d%d\",&n,&k);\n\nfor (i=0;i<n;i++){\n\t//b = a;\n\tscanf(\"%d\",&a[i]);\n\tif (a[i] == 0)\n\t\tz = i;\n\tif (order == 1 && i && (z != i) )\n\t\tif(a[i] < a[i-1] && a[i-1] != 0)\n\t\t\torder = 0; \n\t\n\t\n}\n\nfor (i=0;i<k;i++)\n\tscanf(\"%i\",&b[i]);\n\ni = 1;\nif (order)\nif (z == n-1)\n\ti = (b[0]<a[z-1]) ? 1 : 0;\t\nelse if (z == 0)\n\ti = (b[0]>a[z+1]) ? 1 : 0;\nelse if ( k>1 || a[z-1]>b[0] || a[z+1] < b[0]) \n\ti = 1;\nelse \n\ti = 0;\n\nif (i)\n\tprintf(\"Yes\\n\");\nelse\n\tprintf(\"No\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 102\nint main(){\n int a[N];\n int b[N];\n int n,k;\n scanf(\"%d%d\",&n,&k);\n int i;\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<k;i++){\n scanf(\"%d\",&b[i]);\n }\n int tmp=a[0];\n int increase=1;\n for(i=1;i<n;i++){\n if(a[i]!=0){\n if(tmp<=a[i]){\n tmp=a[i];\n }else{\n increase=0;\n break;\n }\n }\n }\n int max=b[0];\n int min=b[0];\n for(i=1;i<k;i++){\n if(max<b[i])max=b[i];\n if(min>b[i])min=b[i];\n }\n if(k!=1){\n if(max!=min){\n increase=0;\n }\n }\n if(increase)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=0;i<kase1;i++){\n if(ara1[i+1]>ara1[i]){\n count++;\n }\n }\n if(count==(kase1-1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n int ff=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n if(big[i]!=0)\n for(int j=i;j>=0;j--)\n {\n if(big[j]!=0)\n {\n if(big[i]<big[j])\n {\n ff=1;\n break;\n }\n }\n }\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\nif(ff==1)\n{\n printf(\"YES\");\n return 0;\n}\n\nint i, j;\nfor(i = 0; i < m; i++)\nfor(j = 0; j < m-1-i; j++)\nif(small[j] > small[j+1])\n{\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n}\n\n\n int flag=0;\n for(int i=0,j=0;i<n&&j<m;i++)\n {\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,k,i,j;\n scanf(\"%d%d\",&n,&k);\n int a[n];\n int b[k];\n for(i=0; i<n; i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<k; i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=0;i<k;i++){\n for(j=i+1;j<k;j++){\n if(b[i]<b[j]){\n int temp = b[i];\n b[i] = b[j];\n b[j] = temp;\n }\n }\n }\n j=0;\n for(i=0;i<n;i++){\n if(a[i]==0){\n a[i] = b[j];\n j++;\n }\n }\n int flag = 0;\n for(i=0;i<n;i++){\n for(j=i;j<n;j++){\n if(a[i]<a[j]){\n flag = 1;\n break;\n }\n }\n if(flag==1){\n break;\n }\n }\n if(flag == 1){\n printf(\"No\");\n }\n else{\n printf(\"Yes\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n\nint n,i,k;\nint a[101],b;\nint z = -1;\n\nscanf(\"%d%d\",&n,&k);\n\nfor (i=0;i<n;i++){\n\t//b = a;\n\tscanf(\"%d\",&a[i]);\n\tif (a[i] == 0)\n\t\tz = i;\n}\n\nfor (i=0;i<k;i++)\n\tscanf(\"%i\",&b);\n\n\nif (z == n)\n\ti = (b<a[z-1]) ? 1 : 0;\t\nelse if (z == 0)\n\ti = (b>a[z+1]) ? 1 : 0;\nelse if ( k>1 || a[z-1]>b || a[z+1] < b) \n\ti = 1;\nelse \n\ti = 0;\n\nif (i)\n\tprintf(\"Yes\\n\");\nelse\n\tprintf(\"No\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,m;\n\tint i,j;\n\tscanf(\"%d %d\",&n,&m);\n\tint a[n],b[m],count=0,flag=0,prev;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(a[i]==0)\n\t\t\tcount++;\n\t}\n\tfor(i=0;i<m;i++)\n\t\tscanf(\"%d\",&b[i]);\n\tprev=a[0];\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(a[i]!=0&&a[i]<prev)\n\t\t\tflag=1;\n\t\tif(a[i]!=0)\n\t\t\tprev=a[i];\n\t}\n\tif(count==1&&flag==1)\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<math.h>\n\nint cmpfunc (const void * a, const void * b)\n{\n return ( *(int*)b - *(int*)a );\n}\n\nint main()\n{\n int n, k;\n int i;\n scanf(\"%d %d\", &n, &k);\n int a[n], b[k];\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n for(i=0; i<k; i++)\n scanf(\"%d\", &b[i]);\n for(i=0; i<n-1; i++)\n {\n if((a[i] > a[i+1]) && a[i+1] != 0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n qsort(b, k, sizeof(int), cmpfunc);\n for(i=0; i<n-1; i++)\n {\n if((a[i] == 0) && b[0] > a[i+1])\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\n\n\n\nint i, j;\nfor(i = 0; i < m; i++)\nfor(j = 0; j < m-1-i; j++)\nif(small[j] > small[j+1])\n{\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n}\n\n\n int flag=0;\n for(int i=0,j=0;i<n&&j<m;i++)\n {\n printf(\"%d %d aa\",big[i],small[j]);\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n for(i=0,j=0;i<n;i++)\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k=0,l=0;\n\n scanf(\"%d %d\",&n,&m);\n\n int x[n],y[m];\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&y[i]);\n\n\n if(k>1) printf(\"Yes\");\n else\n\n {\n for(i=0;i<n;i++)\n\n if(!x[i]) x[i]=y[0];\n\n for(i=1;i<n;i++)\n {\n if(x[i]<x[i-1]) break;\n }\n\n if(i==n) printf(\"No\");\n\n else printf(\"Yes\");\n\n }\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,t1,t2,a[200],b[200],c=0,count=0;\n scanf(\"%d %d\",&t1,&t2);\n for(i=0;i<t1;i++){\n scanf(\"%d\",&a[i]);}\n for(i=0;i<t2;i++){\n scanf(\"%d\",&b[i]);}\n for(i=0;i<t1;i++){\n if (a[i]==0){c++;}}\n for(i=0;i<t1;i++){\n if (c>0){\n if(a[i]==0){\n for(j=0;j<t2;j++){\n if(b[j]<a[i-1]||b[j]>a[i+1]){\n count++;}\n }\n }\n }\n else if(a[i+1]<a[i]){\n count++;\n }\n }\n if(count>0){printf(\"Yes\");}\n else{printf(\"No\");}\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfnc(const void *a,const void *b){\n if(*(int *)a==*(int *)b) return 0; else return *(int *)b-*(int *)a;\n}\nint main(){\n int n,k;scanf(\" %d%d\",&n,&k);\n int i,j=0,jk,a[n],b[k],min=0;\n for(i=0;i<n;i++){scanf(\" %d\",&a[i]);if(a[i]<=min){j++;}min=a[i];if(a[i]==0)jk=i;}\n for(i=0;i<k;i++)scanf(\" %d\",&b[i]);\n //qsort(b,k,sizeof(b[0]),cmpfnc);\n j-=k;\n if(k==1){\n if(jk==n-1) (a[jk-1]>=b[0]) ? printf(\"Yes\"):puts(\"No\");\n else if(jk==0) (a[jk+1]<=b[0]) ? printf(\"Yes\"):puts(\"No\");\n else (j>0 || a[jk+1]<=b[0]) ? printf(\"Yes\"):puts(\"No\");\n }\n else puts(\"Yes\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n,k,m,a,b,c,d,e,f,g,i,j,count=0;\nscanf(\"%d %d\",&n,&k);\nint x[n],y[k];\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&x[i]);\n}\nfor(i=0;i<k;i++)\n{\nscanf(\"%d\",&y[i]);\n}\n/*checking whether the first is not increasing*/\nfor(i=0;i<n-1;i++)\n{\nif(x[i]==0)\n{\ncontinue;\n}\na=x[i+1];\nif(x[i+1]==0)\n{\n a=x[i+2];\n}\nif(x[i]>a)\n{\nprintf(\"Yes\");return 0;\n}\n}\nfor(i=0;i<n;i++)\n{\nif(x[i]==0)\n{\ncount++;\n}\n}\nif(count==1)\n{\n for(i=0;i<n;i++)\n {\n if(x[i]==0&&i==n-1&&x[i-1]>y[0])\n {\n printf(\"Yes\");return 0;\n }\n }\n\nprintf(\"No\");return 0;\n}\nfor(i=0;i<k-1;i++)\n{\nif(y[i]!=y[i+1])\n{\nprintf(\"Yes\");return 0;\n}\nif(i==k-2)\n{\nprintf(\"No\");return 0;\n}\n}\n\n\n\n\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n\nint n,i,k;\nint a[101],b[101];\nint z = -1;\nint order = 1;\n\nscanf(\"%d%d\",&n,&k);\n\nfor (i=0;i<n;i++){\n\t//b = a;\n\tscanf(\"%d\",&a[i]);\n\tif (a[i] == 0)\n\t\tz = i;\n\tif (order == 1 && i && (z != i) )\n\t\tif(a[i] < a[i-1] && a[i-1] != 0)\n\t\t\torder = 0; \n\t\n\t\n}\n\nfor (i=0;i<k;i++)\n\tscanf(\"%i\",&b[i]);\n\ni = 1;\nif (order)\nif (z == n)\n\ti = (b[0]<a[z-1]) ? 1 : 0;\t\nelse if (z == 0)\n\ti = (b[0]>a[z+1]) ? 1 : 0;\nelse if ( k>1 || a[z-1]>b[0] || a[z+1] < b[0]) \n\ti = 1;\nelse \n\ti = 0;\n\nif (i)\n\tprintf(\"Yes\\n\");\nelse\n\tprintf(\"No\\n\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\t\n\tint n ,k ,i ,c=0;\n\tscanf(\"%d%d\",&n ,&k);\n\tint a[n] ,b[k];\n\tfor(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\tfor(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n\tif(k>1) printf(\"Yes\\n\");\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(a[i]==0){\n\t\t\t\ta[i]=b[0];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<n-1;i++){\n\t\t\tif(a[n-1]>a[i]) c++;\n\t\t}\n\t\tif(c==n-1) printf(\"NO\");\n\t\telse printf(\"YES\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,i,flag=0,z=0;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n],aa[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",a+i);\n\t\tif(i>0 && (a[i]<a[i-1] && a[i]!=0)) flag = 1;\n\t\tif(a[i]==0) aa[z++] = i;\n\t}\n\tint b[k];\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",b+i);\n\t\tif((i>0 && b[i]<a[aa[i]-1]) || b[i]>a[aa[i]+1]) flag = 1;\n//\t\tprintf(\"%d %d %d\\n\",i,a[i-1],b[i]);\n\t}\n\tif(flag==0) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main()\n{\n int n, k;\n\n scanf(\"%d %d\", &n, &k);\n int i, j = 0;\n\n int a[n], b[k];\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < k; i++)\n {\n scanf(\"%d\", &b[i]);\n }\n if(k != 1)\n {\n printf(\"Yes\");\n return 0;\n }\n for(i = 0; i < n-1; i++)\n {\n if(a[i+1] == 0)\n {\n a[i+1] = b[0];\n }\n if(a[i] > a[i+1])\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n\tint a,b,c,x,y,z,l,m,n,k;\n\tint input1[1000],input2[1000];\n\tint sum = 0 , index ;\n\tint flag1 =0 , flag2 =0 ;\n\n\tscanf (\"%d %d\",&n,&k);\n\n\tfor (a=0 ; a<n ;a++)\n\t{\n\t\tscanf (\"%d\",&input1[a]);\n\t}\n\n\tfor (b=0 ; b<k ; b++)\n\t{\n\t\tscanf (\"%d\",&input2[b]);\n\t}\n\n\tfor (a=0 ; a<n ;a++)\n\t{\n\t\tif (input1[a] == 0)\n\t\t{\n\t\t\tsum = sum + 1 ;\n\t\t\tindex = a ;\n\t\t}\n\t}\n\n\tif ( sum > 1)\n\t{\n\t\tprintf (\"Yes\\n\");\n\t}\n\n\telse if (sum ==1)\n\t{\n\t\tfor (x=0 ; x<index ;x++)\n\t\t{\n\t\t\tif (input1[x] > input2[0])\n\t\t\t{\n\t\t\t\tflag1 = -1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\n\t\tfor (x=index+1 ; x<n ;x++)\n\t\t{\n\t\t\tif (input1[x] < input2[0])\n\t\t\t{\n\t\t\t\tflag2 = -1 ;\n\t\t\t\tbreak ;\n\t\t\t}\n\t\t}\n\n\t\tif ((flag1 == 0)&& (flag2 == 0))\n\t\t{\n\t\t\tprintf (\"No\\n\");\n\t\t}\n\t\telse\n\t\t\tprintf (\"Yes\\n\");\n\t}\n\nreturn 0 ;\n} "}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,i,a[205],b[205],j,temp;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tfor(j=0;j<k-1;j++)\n\t\t{\n\t\t\tif(b[j]<b[j+1])\n\t\t\t{\n\t\t\t\ttemp = b[j];\n\t\t\t\tb[j] = b[j+1];\n\t\t\t\tb[j+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tj = 0;\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i] = b[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>=a[i+1]&&a[i+1]!=0)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max<sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n int ff=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n if(big[i]!=0)\n for(int j=i; j>=0; j--)\n {\n if(big[j]!=0)\n {\n if(big[i]<big[j])\n {\n ff=1;\n break;\n }\n }\n }\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\n if(ff==1)\n {\n printf(\"YES\");\n return 0;\n }\n\n int i, j;\n for(i = 0; i < m; i++)\n for(j = 0; j < m-1-i; j++)\n if(small[j] > small[j+1])\n {\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n }\n\n\n int flag=0;\n for(int i=0,j=0; i<n&&j<m; i++)\n {\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max>sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n\nint main()\n{\n int i, j,n, k, sortflag = 0;\n scanf(\"%d %d\", &n, &k);\n int a[n], b[k], c[n];\n for(i = 0; i < n; ++i)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i < k; ++i)\n scanf(\"%d\", &b[i]);\n\n for(i = 0; i < k - 1; ++i) {\n for(j = i + 1; j < k; ++j) {\n if(b[i] < b[j]) {\n b[i] = b[i] ^ b[j];\n b[j] = b[i] ^ b[j];\n b[i] = b[i] ^ b[j];\n }\n }\n }\n j = 0;\n for(i = 0; i < n; ++i) {\n if(a[i] != 0) c[i] = a[i];\n else {\n c[i] = b[j], j++;\n }\n }\n for(i = 0; i < n - 1; ++i) {\n if(c[i] > c[i + 1]) {\n sortflag = 1;\n break;\n }\n }\n for(i = 0; i < n; ++i) printf(\"%d \", c[i]);\n if(sortflag == 0) printf(\"No\");\n else printf(\"Yes\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=0;i<kase1;i++){\n if(ara1[i+1]>ara1[i]){\n count++;\n }\n }\n if(count==(kase1-1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define max(a,b) a>b ? a:b\n\nint main()\n{\n\tint n,k,i,flag=0,z=0,m=0;\n\tscanf(\"%d %d\",&n,&k);\n\tint a[n],aa[n];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",a+i);\n\t\tif(i>0 && (a[i]<a[i-1] && a[i]!=0)) flag = 1;\n\t\tif(a[i]==0) aa[z++] = i;\n\t}\n\tint b[k];\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",b+i);\n\t\tm = max(b[i],m);\n//\t\tprintf(\"%d %d %d\\n\",i,a[i-1],b[i]);\n\t}\n//\tprintf(\"%d\\n\",m);\n\tfor(i=0;i<k;i++)\n\t{\n\t\tif(a[0]==0)\n\t\t{\n\t\t\tif(b[i]>a[aa[i]+1] || m>a[aa[i]+1]) flag = 1;\n\t\t\ta[0] = m;\n\t\t\tbreak;\n\t\t}\n\t\telse if((b[i]<a[aa[i]-1] || b[i]>a[aa[i]+1] || m<a[aa[i]-1] || m>a[aa[i]+1])&&a[aa[i]+1]<=n) \n\t\t{\n\t\t\ta[aa[i]] = m;\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n//\t\tprintf(\"%d %d %d\\n\",b[i],a[aa[i]-1],flag);\n\t}\n\tif(flag==0) printf(\"NO\\n\");\n\telse printf(\"YES\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,i,j,c=0,t,a[100000],b[100000];\n scanf(\"%d %d\",&x,&y);\n\n for(i=0;i<x;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0)\n c++;\n }\n for(i=0;i<y;i++){\n scanf(\"%d\",&b[i]);\n }\n\n\n\n for(i=y-1;i>0;i--){\n for(j=0;j<i-1;j++){\n if(b[j]<b[i]){\n t=b[j];\n b[j]=b[i];\n b[i]=t;\n }\n }\n }\n if(c>y)\n printf(\"No\\n\");\n else{\n for(i=0;i<y;i++){\n for(j=0;j<x;j++){\n if(b[i]==a[j]){\n printf(\"No\\n\");\n return 0;\n }\n }}\n j=0;\n for(i=0;i<x;i++){\n if(a[i]==0){\n a[i]=b[j];\n j++;\n }\n }\n for(i=0;i<x-1;i++){\n if(a[i]>a[i+1]){\n printf(\"Yes\\n\");\n break;\n }\n\n\n }\n if(i>=x-1)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j,con=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n for(i=0,j=0;i<n;i++)\n {\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n con++;\n }}\n if(con==0)\n {\n printf(\"No\\n\");\n return 0;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n\nint main()\n{\n int i, j,n, k, sortflag = 0;\n scanf(\"%d %d\", &n, &k);\n int a[n], b[k], c[n];\n for(i = 0; i < n; ++i)\n scanf(\"%d\", &a[i]);\n\n for(i = 0; i < k; ++i)\n scanf(\"%d\", &b[i]);\n\n for(i = 0; i < k - 1; ++i) {\n for(j = i + 1; j < k; ++j) {\n if(b[i] < b[j]) {\n b[i] = b[i] ^ b[j];\n b[j] = b[i] ^ b[j];\n b[i] = b[i] ^ b[j];\n }\n }\n }\n j = 0;\n for(i = 0; i < n; ++i) {\n if(a[i] != 0) c[i] = a[i];\n else {\n c[i] = b[j], j++;\n }\n }\n for(i = 0; i < n - 1; ++i) {\n if(c[i] > c[i + 1]) {\n sortflag = 1;\n break;\n }\n }\n for(i = 0; i < n; ++i) printf(\"%d \", c[i]);\n if(sortflag == 0) printf(\"No\");\n else printf(\"Yes\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int big[n];\n int small[m];\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&big[i]);\n }\n for(int i=0; i<m; i++)\n {\n scanf(\"%d\",&small[i]);\n }\n\n\n\nint i, j;\nfor(i = 0; i < m; i++)\nfor(j = 0; j < m-1-i; j++)\nif(small[j] > small[j+1])\n{\n int temp=small[j];\n small[j]=small[j+1];\n small[j+1]=temp;\n}\n\n\n int flag=0;\n for(int i=0,j=0;i<n&&j<m;i++)\n {\n printf(\"%d %d aa\",big[i],small[j]);\n if(big[i]==0)\n {\n if(small[j]<big[i-1])\n {\n flag=1;\n break;\n }\n else\n {\n big[i]=small[j];\n j++;\n\n }\n }\n }\n if(flag==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n if(m>1)\n {\n int temp;\n for(int i=0; i<n; i++)\n scanf(\"%d\",&temp);\n for(int i=0; i<m; i++)\n scanf(\"%d\",&temp);\n printf(\"YES\");\n }\n else\n {\n int arr[n],k,flag=0;\n for(int i=0; i<n; i++)\n {\n scanf(\"%d\",&arr[i]);\n if(arr[i]==0)\n k=i;\n else\n {\n if(i!=0&&arr[i]<arr[i-1])\n flag=1;\n }\n }\n int temp;\n scanf(\"%d\",&temp);\n if(flag==1)\n printf(\"YES\");\n if(k!=0)\n {\n if(temp>=arr[k-1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n else\n {\n if(temp<=arr[k+1])\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j;\n\n scanf(\"%d %d\",&n,&m);\n\n int x[n],y[m];\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&x[i]);\n\n for(i=0;i<m;i++)\n scanf(\"%d\",&y[i]);\n\nj=0;\n for(i=1;i<n;i++)\n {\n if((x[i]&&x[i]<x[i-1])||(i!=1&&!x[i-1]&&x[i]<x[j])) break;\n\n if(!x[i]&&x[i-1]) j=i-1;\n }\n\n\n\n if(i!=n) printf(\"Yes\");\n\n else{\n\n if(m==1)\n\n {\n if(y[0]>=x[j]&&y[0]<=x[j+2])\n\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n\n else\n {\n for(i=1;i<m;i++)\n {\n if(y[i]!=y[i-1]) break;\n }\n\n if(i==m&&y[0]>=x[j]&&y[0]<=x[j+1+m])\n printf(\"No\");\n\n else printf(\"Yes\");\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,flag=0;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(int i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n for(int i=0;i<k;i++)\n scanf(\"%d \",&b[i]);\n if(k>1)\n printf(\"Yes\");\n if(a[0]==0)\n a[0]=b[0];\n else\n {\n for(int i=0;i<n-1;i++)\n { \n if(a[i+1]==0)\n a[i+1]=b[0];\n if(a[i+1]<a[i])\n {flag=1;break;}\n }\n if(flag==0)\n printf(\"No\");\n else printf(\"Yes\");\n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k,count=0,p=0;\n char a[1000],b[1000],c[1000];\n\n scanf(\"%d%d\",&m,&n);\n\nfor(i=0;i<m;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\n\n // while(n>1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i<m;i++)\n {\n if(a[i]==0 && n==1)\n a[i]=b[0];\n\n }\n\n\n\n for(i=0;i<m;i++)\n {\n if(a[i]<a[i+1])\n count++;\n else\n break;\n }\n\n if(count==m-1)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k,count=0,p=0;\n char a[1000],b[1000],c[1000];\n\n scanf(\"%d%d\",&m,&n);\n\nfor(i=0;i<m;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\n\n // while(n>1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i<m;i++)\n {\n if(a[i]==0 && n==1)\n a[i]=b[0];\n\n }\n\n\n\n for(i=0;i<m-1;i++)\n {\n if(a[i]<a[i+1])\n count++;\n else\n break;\n }\n\n if(count==m-1)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,flag=0;\n scanf(\"%d %d\",&n,&k);\n int a[n],b[k];\n for(int i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n for(int i=0;i<k;i++)\n scanf(\"%d \",&b[i]);\n if(k>1)\n printf(\"Yes\");\n else\n {\n for(int i=0;i<n-1;i++)\n {\n if(a[i]==0)\n a[i]=b[0];\n if(a[i+1]<a[i])\n {flag=1;break;}\n }\n if(flag==0)\n printf(\"No\");\n else printf(\"Yes\");\n }\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nmain()\n{ int n,k,less2=200,flag=0,max2=0,i;\n scanf(\"%d %d\",&n,&k);\n int m[n],s[k];\n for(i=0;i<n;i++)\n {scanf(\"%d\",&m[i]);\n }\n for(i=0;i<k;i++)\n {scanf(\"%d\",&s[i]);\n if(less2>s[i])\n less2=s[i];\n if(max2<s[i])\n max2=s[i];\n }\n for(i=0;i<n;i++)\n {\n if( (m[i]>=m[i+1])&&(m[i]!=0) &&(m[i+1]!=0) )\n flag=1;\n }\n\n\n\n\n\n for(i=0;i<=n&&flag==0;i++)\n {\n if(m[i]+m[i+1]==0)\n flag=1;\n\n else if(m[i]==0)\n {if( i!=0&&m[i-1]>=less2 )\n flag=1;\n else if(i==0&&m[i+1]<=max2)\n flag=1;\n}\n }\n\n\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,m,i,j,k,count=0,p=0;\n char a[1000],b[1000],c[1000];\n\n scanf(\"%d%d\",&m,&n);\n\nfor(i=0;i<m;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\nscanf(\"%d\",&b[i]);\n\n // while(n>1)\n // {\n // printf(\"YES\");\n // break;\n\n // }\nif(n!=1)\n\nprintf(\"YES\");\n\nif(n==1)\n {\n for(i=0;i<m;i++)\n {\n if(a[i]==0 && n==1)\n a[i]=b[0];\n\n }\n\n\n\n for(i=0;i<m-1;i++)\n {\n if(a[i]<a[i+1])\n count++;\n else\n break;\n }\n\n if(count==m-1)\n printf(\"NO\");\n else\n printf(\"YES\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max>sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n \n int n , k ;\n \n scanf(\"%d %d\",&n,&k) ;\n \n int ara[n] , bra[k] ;\n \n for( int x = 0 ; x < n ; x++ ) scanf(\"%d\",&ara[x]) ;\n \n for( int y = 0 ; y < k ; y++ ) scanf(\"%d\",&bra[y]) ;\n \n int key ;\n \n if( k == 1 ) {\n \n for( int a = 0 ; a < n ; a++ ) {\n \n if( ara[a] == 0 ) {\n \n key = a ;\n \n break ;\n \n }\n \n }\n \n if( ( ara[key-1] < bra[0] ) && ( bra[0] < ara[key+1] ) ) {\n \n printf(\"No\\n\") ;\n \n return 0 ;\n \n }\n \n else {\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n }\n \n }\n \n printf(\"Yes\\n\") ;\n \n return 0 ;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],b[100],i,c,d=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(k==1){\n if(a[i]==0)\n c=i;\n }\n }\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n if(k==1){\n a[c]=b[0];\n for(i=0;i<n;i++){\n if(a[i]<a[i+1]){\n d=1;\n continue;}\n else{\n d=0;\n break;\n }\n }\n }\n\n if(d==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j,con=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n for(i=0,j=0;i<n;i++)\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n con++;\n }\n if(con==0)\n {\n printf(\"No\\n\");\n return 0;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n return 0;\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n for(i=kase1-1;i>=0;i--){\n if(ara1[i]>ara1[i-1]){\n continue;\n }\n else break;\n }\n if(i==1) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{ int n,k,less2=200,flag=0,max2=0,i;\n scanf(\"%d %d\",&n,&k);\n int m[n],s[k];\n for(i=0;i<n;i++)\n {scanf(\"%d\",&m[i]);\n }\n for(i=0;i<k;i++)\n {scanf(\"%d\",&s[i]);\n if(less2>s[i])\n less2=s[i];\n if(max2<s[i])\n max2=s[i];\n }\n for(i=0;i<n;i++)\n {\n if( (m[i]>=m[i+1])&&(m[i]!=0) &&(m[i+1]!=0) )\n flag=1;\n }\n\n\n\n\n\n for(i=0;i<=n&&flag==0;i++)\n {\n if(m[i]+m[i+1]==0)\n flag=1;\n\n else if(m[i]==0)\n {if( i!=0&&m[i-1]>=less2 )\n flag=1;\n else if(i==0&&m[i+1]<=max2)\n flag=1;\n}\n }\n\n\n if(flag==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,i,j,c=0,t;\n scanf(\"%d %d\",&x,&y);\n int a[x+1],b[x+1];\n for(i=0;i<x;i++){\n scanf(\"%d\",&a[i]);\n if(a[i]==0)\n c++;\n }\n for(i=0;i<y;i++){\n scanf(\"%d\",&b[i]);\n }\n for(i=y-1;i>0;i--){\n for(j=0;j<i-1;j++){\n if(b[j]>b[i]){\n t=b[j];\n b[j]=b[i];\n b[i]=t;\n }\n }\n }\n if(c>y)\n printf(\"No\\n\");\n else{\n j=0;\n for(i=0;i<x;i++){\n if(a[i]==0){\n a[i]=b[j];\n j++;\n }\n }\n for(i=0;i<x-1;i++){\n if(a[i]>a[i+1]){\n printf(\"Yes\\n\");\n break;\n }\n }\n if(i>=x-1)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\n\nint main()\n{\n int n, k;\n\n scanf(\"%d %d\", &n, &k);\n int i, j = 0;\n\n int a[n], b[k];\n\n for(i = 0; i < n; i++)\n {\n scanf(\"%d\", &a[i]);\n }\n for(i = 0; i < k; i++)\n {\n scanf(\"%d\", &b[i]);\n }\n if(k != 1)\n {\n printf(\"Yes\");\n return 0;\n }\n for(i = 0; i < n-1; i++)\n {\n if(a[i+1] == 0)\n {\n a[i+1] = b[0];\n }\n if(a[i] > a[i+1])\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,k,i,a[205],b[205],j,temp;\n\tscanf(\"%d %d\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%d\",&b[i]);\n\t}\n\tfor(i=0;i<k;i++)\n\t{\n\t\tfor(j=0;j<k-1;j++)\n\t\t{\n\t\t\tif(b[j]<b[j+1])\n\t\t\t{\n\t\t\t\ttemp = b[j];\n\t\t\t\tb[j] = b[j+1];\n\t\t\t\tb[j+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n\tj = 0;\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]==0)\n\t\t{\n\t\t\ta[i] = b[j];\n\t\t\tj++;\n\t\t}\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]>=a[i+1]&&a[i+1]!=0)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"NO\");\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b){\n return *(int*)b - *(int*)a;\n}\n\nint main(){\n int len1, i, len2, pos = 0;\n scanf(\"%d%d\", &len1, &len2);\n int w[len1], m[len2];\n for(i = 0; i < len1; i++){\n scanf(\"%d\", &w[i]);\n }\n for(i = 0; i < len2; i++){\n scanf(\"%d\", &m[i]);\n }\n qsort(m, len2, sizeof(int), cmp);\n for(i = 0; i < len1; i++){\n if(!w[i]){\n if(i != 0){\n if(w[i-1] > m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(i != len1-1){\n if(w[i+1] < m[pos]){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n w[i] = m[pos];\n pos++;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n#include <ctype.h>\nint cmp(const void *a, const void *b){\n\treturn *(int*)b-*(int*)a;\n\t\n}\nint main(){\nint i,n,k,first,flag=0;\nscanf(\"%d %d\",&n,&k);\nint t[n],tab[k];\n\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&t[i]);\nif(t[i]==0&&flag==0){\n first=i;\n flag=1;\n}\n\t\n\t\n}\n\n\nfor(i=0;i<k;i++){\n\tscanf(\"%d\",&tab[i]);\n\n}\nqsort(tab,k,sizeof(*tab),cmp);\n\nint h=0;\nfor(i=first;i<first+k;i++){\n\tt[i]=tab[h];\n\th++;\n\n}\nint total=0;\nfor(i=0;i<n;i++){\n\tif(t[i]<t[i+1])\n\ttotal+=1;\n\t\n}\n\nif(total==n)\nprintf(\"No\");\nelse printf(\"Yes\");\n\n\n\n\t\n\treturn 0;\n\t\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,t1,t2,a[200],b[200],c=0,count=0;\n scanf(\"%d %d\",&t1,&t2);\n for(i=0;i<t1;i++){\n scanf(\"%d\",&a[i]);}\n for(i=0;i<t2;i++){\n scanf(\"%d\",&b[i]);}\n for(i=0;i<t1;i++){\n if (a[i]==0){c++;}}\n for(i=0;i<t1;i++){\n if(a[i]!=0&&a[i+1]!=0){\n if(a[i]<a[i+1]){\n count++;\n }\n }\n if (c>0){\n if(a[i]==0){\n for(j=0;j<t2;j++){\n if(b[j]<a[i-1]||b[j]>a[i+1]){\n count++;}\n }\n }\n }\n else if(a[i+1]<a[i]){\n count++;\n }\n }\n if(count>0){printf(\"Yes\");}\n else{printf(\"No\");}\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,a[100],b[100],i,c,d=0;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n if(k==1){\n if(a[i]==0)\n c=i;\n }\n }\n for(i=0;i<k;i++)\n scanf(\"%d\",&b[i]);\n if(k==1){\n a[c]=b[0];\n for(i=0;i<n;i++){\n if(a[i]<a[i+1]){\n d=1;\n continue;}\n else{\n d=0;\n break;\n }\n }\n }\n\n if(d==0)\n printf(\"Yes\");\n else\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a,b,Max,tmp=0;\nint sa[100]={0,}, sb[100]={0,};\nint sc[100]={0,};\n\nvoid printc( void )\n{\n for(int i=0;i<a-1;i++)\n {\n printf(\"%d\", sc[i]);\n }\n\n}\n\nint main()\n{\n scanf(\"%d%d\", &a,&b);\n for(int i=0;i<a;i++) scanf(\"%d\", &sa[i]);\n for(int i=0;i<b;i++) scanf(\"%d\", &sb[i]);\n if(b!=1) { printf(\"yes\"); return 0;}\n for(int i=0;i<a;i++)\n {\n if (sa[i]==0) tmp++; //0\uc778 \uacf3\uc774 \ub4f1\uc7a5\n if(tmp!=0)\n {\n if(i==0) continue;\n sc[i]=sa[i+1];\n }\n else sc[i]=sa[i];\n }\n // printc();\n Max=sc[0];\n for(int i=0;i<a-1;i++)\n {\n if(Max<=sc[i]) Max=sc[i];\n else { printf(\"yes\"); return 0;}\n }\n if(sa[a-1]==0 && Max>sb[1]) { printf(\"yes\"); return 0;}\n printf(\"no\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int n,k,a[100],b[100],i,t,j;\n scanf(\"%d%d\",&n,&k);\n for(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n for(i=0;i<k;i++) scanf(\"%d\",&b[i]);\n for(i=0;i<k;i++)\n {\n for(j=i+1;j<k;j++)\n if(b[i]<b[j])\n {\n t=b[i];\n b[i]=b[j];\n b[j]=t;\n }\n }\n for(i=0,j=0;i<n;i++)\n if(a[i]==0)\n {\n a[i]=b[j];\n j++;\n }\n for(i=0;i<n;i++)\n {\n if(a[i]>a[i+1])\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int ara1[205],ara2[205];\n int i,j=0,kase1,kase2;\n\n scanf(\"%d%d\",&kase1,&kase2);\n\n for(i=0;i<kase1;i++){\n scanf(\"%d\",&ara1[i]);\n }\n\n for(i=0;i<kase2;i++){\n\n scanf(\"%d\",&ara2[i]);\n }\n if(kase2>1){\n printf(\"Yes\\n\");\n }\n int c=0;\n for(i=0;i<kase2;i++){\n if(ara1[i]==0){\n c++;\n }\n }\n if(c==kase1){\n printf(\"Yes\\n\");\n return 0;\n }\n\n for(i=0;i<kase1;i++){\n if(ara1[i]==0){\n ara1[i]=ara2[j++];\n }\n }\n int count=0;\n\n for(i=0;i<kase1;i++){\n if(ara1[i+1]>ara1[i]){\n count++;\n }\n }\n if(count==(kase1-1)) printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}], "src_uid": "40264e84c041fcfb4f8c0af784df102a"} {"nl": {"description": "Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that this sequence is too long and he wants to make it as short as possible.In the given sequence moving up is described by character U and moving right is described by character R. Mikhail can replace any pair of consecutive moves RU or UR with a diagonal move (described as character D). After that, he can go on and do some other replacements, until there is no pair of consecutive moves RU or UR left.Your problem is to print the minimum possible length of the sequence of moves after the replacements.", "input_spec": "The first line of the input contains one integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100)\u00a0\u2014 the length of the sequence. The second line contains the sequence consisting of n characters U and R.", "output_spec": "Print the minimum possible length of the sequence of moves after all replacements are done.", "sample_inputs": ["5\nRUURU", "17\nUUURRRRRUUURURUUU"], "sample_outputs": ["3", "13"], "notes": "NoteIn the first test the shortened sequence of moves may be DUD (its length is 3).In the second test the shortened sequence of moves can be UUDRRRDUDDUUU (its length is 13)."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, j=0;\n char a[102];\n scanf(\"%d\", &n);\n scanf(\"%s\", a);\n for(i=0; i<n-1; i++)\n {\n if(a[i]!=a[i+1])\n {\n j++;\n i++;\n }\n }\n printf(\"%d\", n-j);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,c=0,l,s=0,n;\n scanf(\"%d\",&n);\n char str[n];\n scanf(\"%s\",str);\n l=strlen(str);\n for(i=0;i<l;)\n {\n if(str[i]=='U' && str[i+1]=='R')\n {\n c++;\n i=i+2;\n }\n else if(str[i]=='R' && str[i+1]=='U')\n {\n c++;\n i=i+2;\n }\n else i++;\n }\n printf(\"%d\",n-c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define N 100\n\nint main() {\n\tstatic char s[N + 1];\n\tint n, i, cnt;\n\n\tscanf(\"%d%s\", &n, s);\n\tcnt = 0;\n\tfor (i = 0; i < n - 1; i++)\n\t\tif ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R')) {\n\t\t\tcnt++;\n\t\t\ti++;\n\t\t}\n\tprintf(\"%d\\n\", n - cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nchar s[101];\nint main()\n{\n int i,n;\n scanf(\"%d %s\",&n,s);\n int cnt=0;\n for(i=0;i<n;)\n {\n if(s[i]=='R')\n {\n if(i==n-1 || s[i+1]=='R') {cnt++;i++;}\n else {cnt++;i+=2;}\n }\n else\n {\n if(i==n-1 || s[i+1]=='U') {cnt++;i++;}\n else {cnt++;i+=2;}\n }\n }\n printf(\"%d\\n\",cnt);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tint i=0,count=0,n=0;\n scanf(\"%d\",&n);\n\tchar s[n];\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;)\n\t{\n\tif(s[i]=='U' && s[i+1]=='R'){\n\t count++;i=i+2;\n\t}\n else if(s[i]=='R' && s[i+1]=='U')\n\t{\n count++;\n\t i=i+2;\n\t}\n else{\n\t count++;\n\t i++;\n\t}}\n printf(\"%d\",count);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n\n for(i=0;i<n-1;)\n {\n if(a[i]!=a[i+1])\n {\n sum=sum+1;\n i=i+2;\n\n }\n else{i++;}\n\n\n\n\n }\n printf(\"%d\",n-sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, j=0;\n scanf(\"%d\", &n);\n char a[n+2];\n scanf(\"%s\", a);\n for(int i=0; i<n-1; i++)\n {\n if(a[i]!=a[i+1])\n {\n j++;\n i++;\n }\n }\n printf(\"%d\", n-j);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint leng,count=0,i=0;\n\tscanf(\"%d\",&leng);\n\tchar s[leng];\n\tscanf(\"%s\",s);\n\twhile(i<leng){\n\t\tif(s[i]!=s[i+1]){\n\t\t\tcount++;i=i+2;\n\t\t}else if(s[i]==s[i+1]){\n\t\t\tcount++;i++;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n}\n"}, {"source_code": "int main(){\n int i, n, count=0;\n scanf(\"%d\", &n);\n char a[n+1];\n for (i=0; i<=n; i++)\n scanf(\"%c\", &a[i]);\n for (i=0; i<=n; i++){\n if (((a[i]=='r') || (a[i]=='R')) && ((a[i+1]=='u') || (a[i+1]=='U')) || ((a[i]=='u') || (a[i]=='U')) && ((a[i+1]=='r') || (a[i+1]=='R')))\n {\n count++;\n i++;\n }\n }\n printf(\"%d\", n-count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n for(i=0;i<n;i=i+0)\n {\n if(s[i]=='U')\n {\n if(s[i+1]=='R')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n else if(s[i]=='R')\n {\n if(s[i+1]=='U')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n }\n printf(\"%d\",n-count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n int i;\n int b=n;\n for(i=0;i<b-1;i++){\n if(a[i]!=a[i+1]){\n --n;\n i++;\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n {\n ctr++;\n count++;\n }\n }\n else\n {\n count++;\n ctr++;\n }\n }\n\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,s,d,f,g,h,j,k,l;\n scanf(\"%d\",&a);\n d=a;\n char lol[a+1];\n scanf(\"%s\",&lol);\n for(s=0;s<a-1;s++)\n {\n if(lol[s]!=lol[s+1])\n d--,s++;\n }\n printf(\"%d\",d);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n char str[100];\n int count=0,i,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",str);\n for(i=0;i<n-1;){\n if((str[i]=='R' && str[i+1]!='R') || (str[i]=='U' && str[i+1]!='U')){\n i=i+2;\n count++;\n }\n else{\n i++;\n }\n } \nprintf(\"%d\\n\",n-count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar a[200];\nint main()\n{\n int n,sum1= 0,sum2=0;\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(int i = 0 ; i < n; i++)\n {\n int k;\n if(!sum2)\n {\n if(a[i]=='U')\n sum2 = 1;\n else sum2 = 2;\n sum1++;\n }\n else\n {\n if(a[i] == 'U')\n k = 1;\n else k = 2;\n if(k!=sum2){\n sum2 = 0;\n }\n else\n sum1++;\n }\n }\n printf(\"%d\\n\",sum1);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x=0;\n scanf(\"%d\", &n);\n char str[n+2];\n // printf(\"Hello\");\n scanf(\"%s\", str);\n // printf(\"hi\");\n int i;\n for(i=0;i<n;i++)\n {\n if(((str[i]==82)&&(str[i+1]==85))||((str[i]==85)&&(str[i+1]==82)))\n {\n x+=1;\n i++;\n }\n else\n {\n x+=1;\n }\n }\n printf(\"%d\\n\", x);\n return 0;\n}\n"}, {"source_code": "\ufeff#include<stdio.h>\n\nint main()\n\n{\n\n char s[100];\n\n int i,n,a=0,b;\n\n scanf(\"%d\",&n);\n\n scanf(\"%s\",s);\n i=0;\n while (i<n-1){\n\n if ((s[i]=='R' && s[i+1]=='U') || (s[i]=='U' && s[i+1]=='R')){\n\n i=i+2;\n\n a++;\n\n }\n else i++;\n\n }\n\n printf(\"%d\\n\",n-a);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,k;\n scanf(\"%d\",&n);\n char s[n];\n char b[n];\n scanf(\"%s\",s);\n for(i=1;s[i]!='\\0';i++)\n {\n if((s[i-1]=='R' && s[i]=='U') || (s[i-1]=='U' && s[i]=='R'))\n {\n s[i-1]='D';\n s[i]='0';\n }\n }\n for(i=0,k=0;s[i]!='\\0';i++)\n {\n if(s[i]!='0')\n {\n b[k]=s[i];\n k++;\n }\n }\n b[k]='\\0';\n printf(\"%d\\n\",strlen(b));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n int n;\n scanf(\"%d\",&n);\n scanf(\"%*c\");\n char str[n+1];\n gets(str);\n int i,j,k,l;\n for(i=0; i<n; i++)\n {\n if((str[i]=='R' && str[i+1]=='U') || (str[i]=='U' && str[i+1]=='R'))\n {\n str[i]='1';\n str[i+1]='D';\n }\n }\n int count=0;\n for(i=0; i<n; i++)\n {\n if(str[i]=='U' || str[i]=='D' || str[i]=='R')\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "int main() {\n\tlong n, len, i,NUM;\n\tscanf(\"%ld\", &n);\n\tchar str[101];\n\tscanf(\"%s\", str);\n\tfor (i = 0; i < n - 1; i++)\n\t\tif (str[i] != str[i + 1]&&str[i]!='D') {\n\t\t\tstr[i] = 'n';\n\t\t\tstr[i + 1] = 'D';\n\t\t}\n\tNUM = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (str[i] != 'n')\n\t\t\tNUM++;\n\tprintf(\"%ld\\n\", NUM);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n int i;\n int b=n;\n for(i=0;i<b-1;i++){\n if(a[i]!=a[i+1]){\n --n;\n i++;\n }\n }\n printf(\"%d\",n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\n#include<math.h>\n\nint main()\n{\n int n, count=0;\n scanf(\"%d\", &n);\n char str[n+2];\n scanf(\"%s\", str); // 0 hole unchecked\n int len= strlen(str);\n\n int flag[n];\n memset(flag, 0, n*sizeof(int));\n\n\n\n for(int i=0 ; i<len ; i++){\n if((str[i]=='R' && str[i+1]== 'U')||(str[i]== 'U' && str[i+1]== 'R')){\n if(flag[i]==0 && flag[i+1]==0){\n count++;\n flag[i]=1;\n flag[i+1]=1;\n }\n }\n }\n\n printf(\"%d\", n-count);\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,c=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tscanf(\"%s\",a);\n\tfor(int i=0;i<n-1;i++)\n\t{\n\t\tif(a[i]!=a[i+1])\n\t\t{\n\t\t\tc++;\n\t\t\ti++;\n\t\t}\n\t\n\t}\n\tprintf(\"%d\",n-c);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, ans=0;\n char s[101];\n scanf(\"%d %s\", &n, s);\n for(i=0; i<n; i++)\n {\n if(s[i] != s[i+1])\n ans++, i++;\n else\n ans++;\n }\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i, cnt=0, n;\n char a[100];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n\n for(i=0;i<strlen(a);i++)\n {\n if((a[i]=='U' && a[i+1]=='R') ||(a[i]=='R' && a[i+1]=='U'))\n {\n cnt++;\n i++;\n }\n\n else\n cnt++;\n\n }\n printf(\"%d\",cnt);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,n1,count=0,x;\n char s[101];\n scanf(\"%d \",&n);\n\n for(int i=0;i<n;i++)\n {\n scanf(\"%c\",&n1);\n s[i]=n1;\n }\n for(int j=0;j<n;j++)\n {\n x=j+1;\n for(int k=x;k<=x;k++)\n {\n\n if(s[j]==s[k])\n {\n count++;\n }\n else{\n j++;\n count++;\n }\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char* s=(char*)malloc(sizeof(char)*n);\n int i,c=n;\n for(i=0;i<n;i++)\n scanf(\" %c\",&s[i]);\n for(i=0;i<n;++i)\n {\n if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R')) \n {c--; i++;}\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n;\n char ch[101];\n scanf(\"%d\",&n);\n\n scanf(\"%s\",&ch);\n\n for(i=0;ch[i]!='\\0';i++) //condition is not i<n caz n will be decreased\n {\n if(ch[i]=='R' && ch[i+1]=='U')\n {\n n--;\n i++;\n }\n else if(ch[i]=='U' && ch[i+1]=='R')\n {\n n--;\n i++;\n }\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n\n for (i=0;i<n;i++)\n {\n if(a[i]=='U' && a[i+1]=='R')\n {\n b=b+1;\n i=i+1;\n }\n else if(a[i]=='R' && a[i+1]=='U')\n {\n b=b+1;\n i=i+1;\n }\n //else if(a[i]=='R' && a[i+1]=='R')\n //{\n // b=b+2;\n // i=i+2\n //}\n else if(a[i]=='U' || a[i]=='R')\n {\n b=b+1;\n\n }\n }\n //b=b+1;\n printf(\"%d\",b);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i<n;i++)\n{\n\tif(s[i]!=s[i-1])\n\t{\t\n\t i++;\n\t c++;\t\n\t}\n}\nprintf(\"%d\",n-c);\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n for(i=0;i<n;i=i+0)\n {\n if(s[i]=='U')\n {\n if(s[i+1]=='R')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n else if(s[i]=='R')\n {\n if(s[i+1]=='U')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n }\n printf(\"%d\",n-count);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n int i,count=0,n,j,k ;\n\n scanf(\"%d\",&n) ;\n char s[n] ;\n scanf(\"%s\",s) ;\n\n j=strlen(s) ;\n\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='R'&& s[i+1]=='U'||s[i]=='U'&& s[i+1]=='R')\n {\n count++ ;\n i++ ;\n }\n\n // printf(\"%d \",count ) ;\n }\n //printf(\"\\n%d\",count+1) ;\n k= j-count ;\n\n printf(\"%d\",k) ;\n\n return 0 ;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main()\n{\nint n,i=0,mov=0;\nscanf(\"%d\",&n);\nchar str[n];\nscanf(\"%s\",str);\n\twhile(i<n)\n{\n\t\t\n\tif((str[i]=='U'&& str[i+1]=='R')||(str[i]=='R'&& str[i+1]=='U'))\n\t{ \n\t mov++;\n\t\ti=i+2;\t\t\n\t}\n\telse{\n\t\tmov=mov+1;;\n\t\ti++;\n\t }\n\t}\nprintf(\"%d\",mov);\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,a=0,b,i,j;\nchar str[100],res[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",str);\nfor(i=0;i<=n-1;i++){\n if(str[i]=='U'){\n\n if(str[i+1]=='R'){\n res[a]='D';\n str[i+1]=' ';\n\n }\n else\n res[a]='U';\n a=a+1;\n }\n else if(str[i]=='R'){\n if(str[i+1]=='U'){\n res[a]='D';\n str[i+1]=' ';\n }\n else\n res[a]='R';\n a=a+1;\n }\n}\nres[a]='\\0';\nprintf(\"%d\",strlen(res));\n//printf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "int main(){\n int i, n, count=0;\n scanf(\"%d\", &n);\n char a[n+1];\n for (i=0; i<=n; i++)\n scanf(\"%c\", &a[i]);\n for (i=0; i<=n; i++){\n if (((a[i]=='r') || (a[i]=='R')) && ((a[i+1]=='u') || (a[i+1]=='U')) || ((a[i]=='u') || (a[i]=='U')) && ((a[i+1]=='r') || (a[i+1]=='R')))\n {\n count++;\n i++;\n }\n }\n printf(\"%d\", n-count);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n;\n\tchar mt[150];\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", &mt, 150);\n\tint num;\n\tnum = n;\n\tint i;\n\tfor (i = 0; i < n - 1; i++)\n\t{\n\t\tif (mt[i] != mt[i + 1])\n\t\t{\n\t\t\tnum -= 1;\n\t\t\ti += 1;\n\t\t}\n\t}\n\tprintf(\"%d\", num);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n,i,sum=0,k=0;\n\tchar s[200];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\tfor(i=k;i<n-1;i++)\n\t{\n\t\tif((s[i]=='U'&&s[i+1]=='R')||(s[i]=='R'&&s[i+1]=='U'))\n\t\t{\n\t\t\ts[i]='0';\n\t\t\ts[i+1]='D';\n\t\t\tk++;\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(s[i]!='0')\n\t\tsum++;\n\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i,sum=0;\n\tchar a='D',b;\n\tgetchar();\n\tfor(i=0;i<n;i++)\n\t{\n\t\t\n\t\tscanf(\"%c\",&b);\n\t\tif((a=='U'&&b=='R')||(a=='R'&&b=='U'))\n\t\t{\n\t\t\ta='D';\n\t\t}\n\t\telse\n\t\t{\n\t\t\ta=b;\n\t\t\tsum++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n getchar();\n char ch[n+5];\n gets(ch);\n for(i=0;i<n;i++)\n {\n if((ch[i]=='U' && ch[i+1]=='R') || (ch[i]=='R' && ch[i+1]=='U'))\n {\n count++;\n i=i+1;\n }\n }\n printf(\"%d\\n\",n-count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main (void){\n char* path;\n int n,i,cnt=0;\n scanf(\"%d\",&n);\n path=(char*)calloc(n,sizeof(char));\n getchar();\n scanf(\"%s\",path);\n for(i=0;i<n;i++){\n if(path[i]==path[i+1])\n cnt++;\n else{\n cnt++;\n i++;\n }\n }\n printf(\"%d\",cnt);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<string.h>\nint main()\n{\n int n,k=0,i,j;\n scanf(\"%d\",&n);\n char S[n];\n scanf(\"%s\",&S);\n for(i=0;i<n;i++)\n {\n if((S[i]=='U'&&S[i+1]=='R')||(S[i]=='R'&&S[i+1]=='U'))\n {\n k++;\n i++;\n }\n }\n printf(\"%d\\n\",n-k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char turn[101];\n int d=0,i,j,n;\n\n scanf(\"%d\",&n);\n scanf(\" %s\",turn);\n\n for(i=0,j=1;i<n;i++,j++)\n {\n if(turn[i]=='R'||turn[i]=='U')\n {\n if((turn[i]=='R'&&turn[j]=='U')||(turn[i]=='U'&&turn[j]=='R'))\n {\n d++;\n i++;\n j++;\n }\n else\n d++;\n }\n }\n printf(\"%d\\n\",d);\n return 0;\n}"}, {"source_code": "/*\n * diagonalwalk.c\n * \n * Copyright 2019 Ravi Teja <Ravi Teja@DESKTOP-NNTRDO1>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{ int n,i,c=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tscanf(\"%s\",a);\n\tfor(i=0;i<n-1;i++){\n\t\tif(a[i]!=a[i+1]){\n\t\t\tc=c+1;\n\t\t\ti=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",n-c);\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n ;\n scanf(\"%d\",&n);\n char a[101];\n scanf(\"%s\",&a);\n int i,sum=0 ;\n for(i=0; i<n; i++)\n {\n if(a[i] != a[i+1] && a[i] != '1' && a[i+1] != '1')\n {\n a[i]='D';\n a[i+1]='1';\n }\n }\n for(i=0;i<n;i++)\n {\n if(a[i]!='1')\n sum++;\n }\n printf(\"%d\",sum);\n}\n"}, {"source_code": "/*Problem 954A Diagonal Walk*/\n#include <stdio.h>\nint main()\n{\n int n, moves, i;\n char str[100];\n scanf(\"%d\", &n);\n scanf(\"%s\", str);\n moves = n;\n\n for (i = 0; i < n; i++)\n {\n if (i == n - 1)\n break;\n if (str[i] != str[i + 1])\n {\n moves--;\n i++;\n }\n }\n printf(\"%d\", moves);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n for(i=0;i<n;i=i+0)\n {\n if(s[i]=='U')\n {\n if(s[i+1]=='R')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n else if(s[i]=='R')\n {\n if(s[i+1]=='U')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n }\n printf(\"%d\",n-count);\n}"}, {"source_code": "#include<stdio.h>\nchar a[101];\nint s=0,i=0,n;\nint main()\n{\nscanf(\"%d\",&n);\nscanf(\"%s\",a);\nwhile (i<n)\n { \n \tif (a[i]==a[i+1])\n \t {\n \t s++;\n \t i++;\n \t }\n \t else\n \t {\n \t \ts++;\n \t \ti+=2;\n \t }\n }\n printf(\"%d\",s);\n \n return 0;\n} \t \t\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,min;\n scanf(\"%d\",&n);\n min=n;\n char s[n+1];\n scanf(\"%s\",s);\n if(n==2&&s[0]!=s[1])\n min=1;\n for(i=1;i<n-1;i++)\n {\n if(s[i-1]!=s[i])\n {\n min--;\n i++;\n }\n else if(s[i]!=s[i+1])\n {\n min--;\n i+=2;\n }\n }\n printf(\"%d\",min);\n return 0;\n}\n"}, {"source_code": "\ufeff#include<stdio.h>\n\nint main()\n\n{\n\n char s[100];\n\n int i,n,a=0,b;\n\n scanf(\"%d\",&n);\n\n scanf(\"%s\",s);\n i=0;\n while (i<n-1){\n\n if ((s[i]=='R' && s[i+1]=='U') || (s[i]=='U' && s[i+1]=='R')){\n\n i=i+2;\n\n a++;\n\n }\n else i++;\n\n }\n\n printf(\"%d\\n\",n-a);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n char str[100];\n int count=0,i,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",str);\n for(i=0;i<n-1;){\n if((str[i]=='R' && str[i+1]!='R') || (str[i]=='U' && str[i+1]!='U')){\n i=i+2;\n count++;\n }\n else{\n i++;\n }\n } \nprintf(\"%d\\n\",n-count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint leng,count=0,i=0;\n\tscanf(\"%d\",&leng);\n\tchar s[leng];\n\tscanf(\"%s\",s);\n\twhile(i<leng){\n\t\tif(s[i]!=s[i+1]){\n\t\t\tcount++;i=i+2;\n\t\t}else if(s[i]==s[i+1]){\n\t\t\tcount++;i++;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,j ;\n\tchar ch[1000], ch1[1000]=\"\";\n\tdo {scanf(\"%d\",&n);} while((n<1)||(n>100));\n\tint b = 0 ;\n\tdo\n\t{i=0 ;\n\tscanf(\"%s\",ch);\n\t\twhile(i<strlen(ch))\n\t\t\tif ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}\n\t} while((b==0) || (strlen(ch) != n)) ;\n\ti=0 ;\n\tj=0;\n\n\twhile(i<n) {\n\t\t\tif(ch[i] != ch[i+1]){strcat(ch1,\"D\") ; i=i+2; j++;}\n\t\t\telse{ch1[j]=ch[i] ; i++ ;j++;}\n\t\t\t\n\t }\n\tint k = strlen(ch1);\n\tprintf(\"%d\",k);\n\nreturn 0 ;\n} \t\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x=0;\n scanf(\"%d\", &n);\n char str[n+2];\n // printf(\"Hello\");\n scanf(\"%s\", str);\n // printf(\"hi\");\n int i;\n for(i=0;i<n;i++)\n {\n if(((str[i]==82)&&(str[i+1]==85))||((str[i]==85)&&(str[i+1]==82)))\n {\n x+=1;\n i++;\n }\n else\n {\n x+=1;\n }\n }\n printf(\"%d\\n\", x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define sf scanf\n#define pf printf\nint main()\n{\n int n,i,count=0;\n sf(\"%d\",&n);\n char s[n];\n sf(\"%s\",s);\n for(i=1;i<n;i++)\n {\n if(s[i]!=s[i-1])\n {\n i++;\n count++;\n }\n //pf(\"%d\\n\",count);\n }\n pf(\"%d\",n-count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i<n;i++)\n{\n\tif(s[i]!=s[i-1])\n\t{\t\n\t i++;\n\t c++;\t\n\t}\n}\nprintf(\"%d\",n-c);\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint fun(char *,int );\nint fun(char *s,int n)\n{\n int i=0,cnt=n;\n while(i<n-1)\n {\n if(s[i]!=s[i+1])\n {\n cnt--;\n i=i+2;\n }\n else\n {\n i++;\n }\n }\n return cnt;\n}\nint main()\n{\n char a[101];\n int n;\n scanf(\"%d%s\",&n,a);\n printf(\"%d\\n\",fun(a,n));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void){\n\tint n;\n\tscanf(\"%d\", &n);\n\tint dn = n;\n\tchar s[n+1];\n\tscanf(\"%s\", s);\n\tfor(int i = 0; i < n - 1; ++i){\n\t\tif((s[i] == 'R' && s[i+1] == 'U') || (s[i] == 'U' && s[i+1] == 'R')){\n\t\tdn--;\n\t\t++i;\n\t\t}\n\t}\n\tprintf(\"%d\", dn);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,i,c,f;c=0;f=0;char a[1000];\nscanf(\"%d\",&n);\nscanf(\"%s\",a);\nfor(i=0;i<n;i++)\n{\n if((a[i]=='U' && a[i+1]=='R') || (a[i]=='R' && a[i+1]=='U'))\n {i++;c++;}\n else\n {\n c++;\n }\n}\nprintf(\"%d\",c);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,j ;\n\tchar ch[1000], ch1[1000]=\"\";\n\tdo {scanf(\"%d\",&n);} while((n<1)||(n>100));\n\tint b = 0 ;\n\tdo\n\t{i=0 ;\n\tscanf(\"%s\",ch);\n\t\twhile(i<strlen(ch))\n\t\t\tif ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}\n\t} while((b==0) || (strlen(ch) != n)) ;\n\ti=0 ;\n\tj=0;\n\n\twhile(i<n) {\n\t\t\tif(ch[i] != ch[i+1]){strcat(ch1,\"D\") ; i=i+2; j++;}\n\t\t\telse{ch1[j]=ch[i] ; i++ ;j++;}\n\t\t\t\n\t }\n\tint k = strlen(ch1);\n\tprintf(\"%d\",k);\n\nreturn 0 ;\n} \t\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i=0,c=0,j=0;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",s);\n while(s[i]!='\\0')\n {\n if(s[i]=='R' && s[i+1]=='U')\n i++;\n else if(s[i]=='U' && s[i+1]=='R')\n i++;\n i++;\n j++;\n }\n printf(\"%d\\n\",j);\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j=0,k=0,n,U,R;\n\tchar a[100];\n\t\n\tscanf(\"%d %s\",&n,a);\n\t\n\tfor(i=j;i<n;i=j){\n\t\tfor(j=i+1;j<n;j++){\n \n\tif(a[i]!=a[j])\n\t{\n\tk++;\n\tj++;\n\tbreak;\n\t}\n \n\telse\n\tbreak; \n\t\t}\n\t}\n\tprintf(\"%d\",n-k); \n\treturn 0;\n \n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, ans=0;\n char s[101];\n scanf(\"%d %s\", &n, s);\n for(i=0; i<n; i++)\n {\n if(s[i] != s[i+1])\n ans++, i++;\n else\n ans++;\n }\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int i, ct = 0, n;\n char s[200];\n scanf(\"%d %s\", &n, s);\n for(i = 0; i < (n - 1); i++)\n {\n if(((s[i] == 'R') && (s[i + 1] == 'U')) || ((s[i] == 'U') && (s[i + 1] == 'R')))\n {\n ct++;\n i++;\n }\n }\n\n printf(\"%d\\n\", (n - ct));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,i,c=0;\nchar s[100];\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(i=1;i<n;i++)\n{\n\tif(s[i]!=s[i-1])\n\t{\t\n\t i++;\n\t c++;\t\n\t}\n}\nprintf(\"%d\",n-c);\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,i,c;\n char inp[150];\n scanf(\"%d\",&n);\n getchar();\n if((n>=1)&&(n<=100))\n{ for(i=0;i<n;i++) scanf(\"%c\",&inp[i]);\n for(i=0;i<n;i++)\n {\n if((inp[i]=='R')&&(inp[i+1]=='U')) { c++; i++; }\n else if((inp[i]=='U')&&(inp[i+1]=='R')) { c++; i++; }\n else { c++;}\n }\n printf(\"%d\",c);\n} else printf(\"Enter the sequence between 1 to 100\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,count=0;\n scanf(\"%d\",&n);\n char ch[n];\n getchar();\n gets(ch);\n for(i=0;i<n;i++)\n {\n if(ch[i]!=ch[i+1])\n {\n i++;\n }\n count++;\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char turn[101];\n int d=0,i,j,n;\n\n scanf(\"%d\",&n);\n scanf(\" %s\",turn);\n\n for(i=0,j=1;i<n;i++,j++)\n {\n if(turn[i]=='R'||turn[i]=='U')\n {\n if((turn[i]=='R'&&turn[j]=='U')||(turn[i]=='U'&&turn[j]=='R'))\n {\n d++;\n i++;\n j++;\n }\n else\n d++;\n }\n }\n printf(\"%d\\n\",d);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,c,i;\n scanf(\"%d\", &a);\n int m=a;\n getchar();\n char ar[a];\n gets(ar);\n\n for(i=0; i<a; i++)\n {\n if(i+1<a&&ar[i] != ar[i+1])\n {\n m--;\n i++;\n }\n }\n printf(\"%d\\n\", m);\n}\n"}, {"source_code": "#include <stdio.h>\n\n#include <string.h>\n\nint main()\n\n{\n \n int n , count = 0 ;\n \n scanf(\"%d\",&n) ; char ch = getchar() ;\n \n char ara[n] ;\n \n scanf(\"%[^\\n]\",ara) ;\n \n if( n == 1 ) {\n \n printf(\"1\\n\") ;\n \n return 0 ;\n \n }\n \n else {\n \n for( int a = 0 ; a < (n-1) ; a++ ) {\n \nif( (ara[a] == 'R' && ara[a+1] == 'U' ) || (ara[a] == 'U' && ara[a+1] == 'R' ) ) {\n \n count++ ; a+=1 ;\n \n }\n \n }\n // printf(\"%d\\n\",count) ;\n printf(\"%d\\n\",n-count) ;\n \n }\n \n return 0 ;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,n,ans=0;\n char letters[100000];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\" %c\",&letters[i]);\n }\n for(i=0;i<n;i++)\n {\n if(letters[i]=='R'&&letters[i+1]=='U')\n {\n ans++;\n i++;\n continue;\n }\n if(letters[i]=='U'&&letters[i+1]=='R')\n {\n ans++;\n i++;\n continue;\n }\n ans++;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,D=0;\n char a[104],b[104];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(i=0;i<n;)\n {\n if(a[i]=='R' && a[i+1]=='U')\n {\n D++;\n i=i+2;\n }\n else if(a[i]=='U' && a[i+1]=='R')\n {\n D++;\n i=i+2;\n }\n else i++;\n }\n //printf(\"%d\",D);\n printf(\"%d\",n-D);\n return 0;\n}\n"}, {"source_code": " \n#include<stdio.h>\nint main()\n{\n\tint n,i,c=0,j;\n\tchar s[100];\n\tscanf(\"%d\",&n);\n\tgetchar();\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\tfor(i=1;i<n;i++)\n\t{\n\t\tif(s[i]!=s[i-1])\n\t\t{\n\t\t\ts[i-1]='D';\n\t\t\tfor(j=i;j<n;j++)\n\t\t\t\ts[j]=s[j+1];\n\t\t\tn--;\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tc++;\n\t}\n\tprintf(\"%d\",c);\n\treturn 0;\n}"}, {"source_code": "/*Problem 954A Diagonal Walk*/\n#include <stdio.h>\nint main()\n{\n int n, moves, i;\n char str[100];\n scanf(\"%d\", &n);\n scanf(\"%s\", str);\n moves = n;\n\n for (i = 0; i < n; i++)\n {\n if (i == n - 1)\n break;\n if (str[i] != str[i + 1])\n {\n moves--;\n i++;\n }\n }\n printf(\"%d\", moves);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\ntypedef float fl;\ntypedef char ch;\ntypedef long long ll;\n#define rep(i,a,n) for(i=a;i<n;i++)\n#define rev(i,n,a) for(i=n;i>=a;i--)\n#define repr(i,a,b) for(i=a;i<b;i++)\n#define s(n) scanf(\"%d\",&n);\n#define s2(n,m) scanf(\"%d%d\",&n,&m);\n#define s3(n,m,o) scanf(\"%d%d%d\",&n,&m,&o);\n#define p(n) printf(\"%d\",n);\n#define p2(n,m) printf(\"%d%d\",n,m);\n#define sc(n) scanf(\"%c\",&n);\n#define sf(n) scanf(\"%f\",&n);\n#define sl(n) scanf(\"%lld\",&n);\n#define pc(n) printf(\"%c\",n);\n#define pf(n) printf(\"%f\",n);\n#define pl(n) printf(\"%lld\",n);\n#define br break;\n#define co continue;\n#define ss(a) scanf(\"%s\",&a);\n#define ps(a) printf(\"%%s\",a);\n#define nl printf(\"\\n\");\n#define r0 return 0;\nint main()\n{\n int n;\n s(n)\n ch a[n];\n ss(a)\n int i,y=0,z=0;\n for(i=0;i<n-1;)\n {\n if(a[i]=='U'&&a[i+1]=='R')\n {\n y++;\n i+=2;\n }\n else if(a[i]=='R'&&a[i+1]=='U')\n {\n y++;\n i+=2;\n }\n else\n i++;\n }\n p(n-y)\n\tr0\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c=0;\n char d[100],e[3],f[3];\n scanf(\"%d\",&a);\n for(b=0;b<a;b++)\n {\n scanf(\" %c\",&d[b]);\n }\n for(b=0;b<a-1;b++)\n {\n if((d[b]=='U'&&d[b+1]=='R')||(d[b]=='R'&&d[b+1]=='U'))\n {\n d[b]='D';\n d[b+1]=' ';\n }\n }\n\n for(b=0;b<a;b++)\n {\n if(d[b]!=' ')\n {\n c++;\n }\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int i=0;\n int e=0;\n for(i=0;i<n;)\n {\n if(s[i]!=s[i+1]&&i!=n-1)\n {\n e++;\n i+=2;\n }\n else\n {\n i++;\n e++;\n }\n }\n printf(\"%d\",e);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,c,i;\n scanf(\"%d\", &a);\n int m=a;\n getchar();\n char ar[a];\n gets(ar);\n\n for(i=0; i<a; i++)\n {\n if(i+1<a&&ar[i] != ar[i+1])\n {\n m--;\n i++;\n }\n }\n printf(\"%d\\n\", m);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n char str[100];\n int count=0,i,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",str);\n for(i=0;i<n-1;){\n if((str[i]=='R' && str[i+1]!='R') || (str[i]=='U' && str[i+1]!='U')){\n i=i+2;\n count++;\n }\n else{\n i++;\n }\n } \nprintf(\"%d\\n\",n-count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a,b,i,counter=0;\n scanf(\"%d\",&a);\n char strng[a],result[a];\n\n scanf(\"%s\",strng);\n\n for(i=0;i<strlen(strng);i++)\n {\n if(strng[i]=='R'&& strng[i+1]=='U' || strng[i]=='U'&& strng[i+1]=='R')\n {\n strng[i+1]='N';\n }\n if(strng[i]!='N')\n {\n counter++;\n }\n }\n\n printf(\"%d\\n\",counter);\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,j ;\n\tchar ch[1000], ch1[1000]=\"\";\n\tdo {scanf(\"%d\",&n);} while((n<1)||(n>100));\n\tint b = 0 ;\n\tdo\n\t{i=0 ;\n\tscanf(\"%s\",ch);\n\t\twhile(i<strlen(ch))\n\t\t\tif ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}\n\t} while((b==0) || (strlen(ch) != n)) ;\n\ti=0 ;\n\tj=0;\n\n\twhile(i<n) {\n\t\t\tif(ch[i] != ch[i+1]){strcat(ch1,\"D\") ; i=i+2; j++;}\n\t\t\telse{ch1[j]=ch[i] ; i++ ;j++;}\n\t\t\t\n\t }\n\tint k = strlen(ch1);\n\tprintf(\"%d\",k);\n\nreturn 0 ;\n} \t\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\t\n\tint n;\n\tscanf(\"%d\", &n);\n\n\tchar a[n];\n\tscanf(\"%s\", a);\n\t\n\tint i, count=0, pair=0, solo=0;\t\n\n\t\n\ti=0;\n\t//printf(\"\\n%d %d %d %d\",i ,n , pair, solo);\n\n\twhile(n>0)\n\t{\n\t\tif(a[i]=='R')\n\t\t{\t\n\t\t\tif(a[i+1]=='U')\n\t\t\t{\n\t\t\t\tpair++;\n\t\t\t\tn--;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse if(a[i+1]=='R')\n\t\t\t\tsolo++;\n\t\t\telse\n\t\t\t\tsolo++;\n\t\t}\n\t\telse if(a[i]=='U')\n\t\t{\n\t\t\tif(a[i+1]=='R')\n\t\t\t{\n\t\t\t\tpair++;\n\t\t\t\tn--;\n\t\t\t\ti++;\t\t\t\t\n\t\t\t}\n\t\t\telse if(a[i+1]=='U')\n\t\t\t\tsolo++;\n\t\t\telse\n\t\t\t\tsolo++;\n\t\t}\n\t\tn--;\n\t\ti++;\n\t\t//printf(\"\\n%d %d %d %d\",i ,n , pair, solo);\n\t}\n\tcount=pair+solo;\n\tprintf(\"\\n%d\", count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n#define minimum(x,y)((x)<(y) ? (x) : (y))\n#define maximum(x,y)((x)>(y) ? (x) : (y))\n\n\nint main()\n{\n int n,i,res;\n bool wait;\n\n res = 0;\n wait = true;\n\n scanf(\"%d\",&n);\n char s[n+1];\n for(i=0;i<n+1;i++){\n scanf(\"%c\", &s[i]);\n // printf(\"%c and %d and %s PUTTED\\n\", s[i],i,(wait)?\"True\":\"False\");\n if((!(s[i]==s[i-1]))&&(wait)&&(i>1)){\n // printf(\"%c c %d\\n\", s[i],i);\n // printf(\"%c pc %d\\n\", s[i-1],i);\n res++;\n wait = false;\n }else{\n wait = true;\n }\n }\n printf(\"%d\",n-res);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#define ll long long\n#define MAX 101\nint main()\n{\n\tint n,ans=0;\n\tscanf(\"%d\",&n);\n\tchar str[n];\n\tscanf(\"%s\",&str);\n\tfor(int i=0;i<n;)\n\t{\n\t\tif(str[i]==str[i+1])\n\t\t{\n\t\ti++;\n\t\tans++;\n\t }\n\t else if(str[i]!=str[i+1])\n\t {\n\t i+=2;\n\t ans++;\n\t\t}\n }\n printf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j=0;\n scanf(\"%d \",&n);\n char st[101],res[101]={};\n gets(st);\n for(i=0;i<n;)\n {\n if(st[i]=='R' && st[i+1]=='U' || st[i]=='U' && st[i+1]=='R')\n {\n res[j]='D';\n j++;\n i=i+2;\n }\n else\n {\n res[j]=st[i];\n //res[j+1]=st[i+1];\n j++;\n i++;\n }\n }\n printf(\"%d\",strlen(res));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0;\n char str[319];\n scanf(\"%d\",&n);\n scanf(\"%s\",str);\n for(i=0;i<n;i++)\n if(str[i]=='R' && str[i+1]=='U' || str[i]=='U' && str[i+1]=='R')\n str[i+1]='0';\n\n for(i=0;i<n;i++)\n if(str[i]!='0') count++;\n\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid countCon(char *arr, int n);\n\nint main(void){\n int n;\n scanf(\"%d\", &n);\n char *path = (char *) malloc(sizeof(char) * (n + 1));\n scanf(\"%s\", path);\n countCon(path, n);\n}\n\nvoid countCon(char *arr, int n){\n int i = 0;\n int count = 0;\n while(i < n - 1){\n if((int)*(arr+i) != (int)*(arr+i+1)){\n count++;\n i += 2;\n }\n else {\n i++;\n }\n }\n printf(\"%d\\n\", (n - count));\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar a[200];\nint main()\n{\n int n,sum1= 0,sum2=0;\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(int i = 0 ; i < n; i++)\n {\n int k;\n if(!sum2)\n {\n if(a[i]=='U')\n sum2 = 1;\n else sum2 = 2;\n sum1++;\n }\n else\n {\n if(a[i] == 'U')\n k = 1;\n else k = 2;\n if(k!=sum2){\n sum2 = 0;\n }\n else\n sum1++;\n }\n }\n printf(\"%d\\n\",sum1);\n}"}, {"source_code": "#include<stdio.h>\nint main (){\n int n,i,all;\n char tit[101];\n scanf(\"%d\",&n);\n all=0;\n getchar();\n gets(tit);\n for(i=0;i<strlen(tit)-1;){\n if(tit[i]!=tit[i+1]){\n i+=2;\n all++;\n }\n else\n i++;\n }\n printf(\"%d\",n-all);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0,cout,out,result;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",&s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='R'&& s[i+1]=='U')\n {\n count++;\n i++;\n }\n else if(s[i]=='U'&& s[i+1]=='R')\n {\n count++;\n i++;\n }}\n\n /*if(s[i]=='u'&& s[i+1]=='r' && s[i+2]=='u')\n {\n count--;\n }*/\n\n cout=count*2;\n result=n-cout;\n out=result+count;\n printf(\"%d\",out);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,n,hasilD = 0,hasil = 0;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n\n for(i = 0 ;i<n-1;i++){\n //printf(\"I SEKARANG : %d\\n\",i);\n if(arr[i] != arr[i+1]){\n hasilD++;\n i++;\n }\n\n }\n printf(\"%d\",n-hasilD);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,n,count=0;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';i++)\n {\n if(s[i]=='U')\n {\n if(s[i+1]=='R')\n {\n count++;\n i++;\n }\n else\n count++;\n }\n else if(s[i]=='R')\n {\n if(s[i+1]=='U')\n {\n count++;\n i++;\n }\n else\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MAX 107\n\nint main()\n{\n\tint i, n, c = 0;\n\tchar str[MAX];\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", str);\n\tfor(i=0;i<n-1;++i)\n\t{\n\t\tif((str[i] == 'U' && str[i + 1] == 'R') || (str[i] == 'R' && str[i + 1] == 'U'))\n\t\t{\n\t\t\t++i;\n\t\t\t++c;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", n - c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n char ara[100], ara2[100];\n int i, n, j, ans = 0;\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n\n scanf(\" %c\", &ara[i]);\n }\n for(i = 0; i < n; i++)\n {\n\n j = i + 1;\n if((ara[i] == 'U' && ara[j] == 'R') || (ara[i] == 'R' && ara[j] == 'U'))\n {\n\n ara[i] = '0';\n ara[j] = 'D';\n }\n }\n for(i = 0; i < n; i++)\n {\n\n if(ara[i] != '0')\n {\n\n ans++;\n }\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar data[n];\n\tscanf(\"%s\",data);\n\tchar prev = data[0];\n\tint cnt=0;\n\tfor(int i=1;i<n;i++){\n\t\tif(data[i]!=prev){\n\t\t\tcnt++;\n\t\t\ti++;\n\t\t\tprev = data[i];\n\t\t}\n\t}\n\tprintf(\"%d\",n-cnt);\n\treturn 0;\n}"}, {"source_code": "//http://codeforces.com/contest/954/problem/A\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#define False 0\n#define True 1\n// int small(char ch)\n// int capital(char ch);\n// int prime(int number);\n// void bubble_sort(int arr[], int n);\n//void upper(char *ptr);\n//void lower(char *ptr);\n// void sort(char *ptr, int n);\n// void RemoveDuplicates(char * arr, char * new_str, int arr_size);\n// int Contains(char * arr, char elem, int arr_size);\n// int Times_of_shapes(char * str, int len);\n\n\n\nint main(void)\n{\n\n int number, move=0, i;\n char str[101];\n scanf(\"%d\", &number);\n scanf(\"%s\", str);\n for(i=0;i<number;)\n {\n \tif(str[i]==str[i+1])\n \t{\n \t\tmove++;\n \t\ti++;\n \t}\n \telse\n \t{\n \t\ti+=2;\n \t\tmove++;\n \t}\n }\n printf(\"%d\\n\", move);\n\n\treturn 0;\n}\n\n// int Times_of_shapes(char * str, int len)\n// {\n\n// \tint j, i, times=0, result=0;\n// \tstr[len]='\\0';\n// \tchar temp[len][len+1];\n// \tfor(i=0;i<=len;i++)\n// \t{\n// \t\ttemp[0][i]=str[i];\n// \t}\n// \tfor(i=1;i<len;i++)\n// \t{\n// \t\ttemp[i][0]=temp[i-1][len-1];\n// \t\tfor(j=1;j<len;j++)\n// \t\t{\n// \t\t\ttemp[i][j]=temp[i-1][j-1];\n// \t\t}\n// \t\ttemp[i][len]='\\0';\n// \t}\n\n// \tfor(i=0;i<len;i++)\n// \t{\n// \t\ttimes=0;\n// \t\tfor(j=i+1;j<len;j++)\n// \t\t{\n// \t\t\tif(strcmp(temp[i], temp[j])==False)\n// \t\t\t{\n// \t\t\t\ttimes++;\n// \t\t\t}\n// \t\t}\n// \t\tif(times==False)\n// \t\t{\n// \t\t\tresult++;\n// \t\t}\n// \t}\n// \treturn result;\n\n// }\n\n\n\n// int Contains(char * arr, char elem, int arr_size)\n// {\n\n// int index = 0;\n\n// for(index = 0; index < arr_size; index++)\n// {\n\n// if(arr[index] == elem)\n// {\n// return True;\n// }\n// }\n\n// return False;\n\n// }\n\n// void RemoveDuplicates(char * arr, char * new_str, int arr_size)\n// {\n\n// int index = 0, new_index = 0;\n\n// //clear temp string\n// for(index = 0; index < arr_size; index++)\n// {\n// new_str[index] = 0;\n// }\n\n// for(index = 0; index < arr_size; index++)\n// {\n\n// if(Contains(new_str, arr[index], arr_size) == False)\n// {\n// new_str[new_index] = arr[index];\n// new_index++;\n// }\n// if(index==arr_size-1)\n// {\n// new_str[new_index]='\\0';\n// }\n// }\n\n// }\n\n// void sort(char *ptr, int n)\n// {\n// \tint i, j, temp;\n// \tfor(i=0;i<n-1;i++)\n// \t{\n// \t\tfor(j=0;j<n-i-1;j++)\n// \t\t{\n// \t\t\tif(ptr[j]>ptr[j+1])\n// \t\t\t\t{\n// \t\t\t\t\ttemp=ptr[j];\n// \t\t\t\t\tptr[j]=ptr[j+1];\n// \t\t\t\t\tptr[j+1]=temp;\n// \t\t\t\t}\n\n// \t\t}\n// \t}\n\n// }\n\n\n\n\n\n\n/*\nvoid upper(char *ptr)\n{\n\tint i=0;\n\twhile(ptr[i]!='\\0')\n\t{\n\t\tif(ptr[i]>='a'&&ptr[i]<='z')\n\t\t\tptr[i]-=32;\n\t\ti++;\n\t}\n\n}*/\n\n/*\nvoid lower(char *ptr)\n{\n\tint i=0;\n\twhile(ptr[i]!='\\0')\n\t{\n\t\tif(ptr[i]>='A'&&ptr[i]<='Z')\n\t\t\tptr[i]+=32;\n\t\ti++;\n\t}\n}*/\n\n\n// void bubble_sort(int ptr[], int n)\n// {\n// \tint i, j, temp;\n// \tfor(i=0;i<n-1;i++)\n// \t{\n// \t\tfor(j=0;j<n-i-1;j++)\n// \t\t{\n// \t\t\tif(ptr[j]>ptr[j+1])\n// \t\t\t\t{\n// \t\t\t\t\ttemp=ptr[j];\n// \t\t\t\t\tptr[j]=ptr[j+1];\n// \t\t\t\t\tptr[j+1]=temp;\n// \t\t\t\t}\n\n// \t\t}\n// \t}\n\n// }\n\n// int capital(char ch)\n// {\n// \tint flag=0;\n// \tif(ch>=65&&ch<=90)\n// \t\tflag=1;\n// \treturn flag;\n\n// }\n\n// int small(char ch)\n// {\n// \tint flag=0;\n// \tif(ch>='a'&&ch<='z')\n// \t\tflag=1;\n// \treturn flag;\n\n// }\n// int prime(int number)\n// {\n// \tint flag=1, i;\n// \tfor(i=2;i<=number/2;i++)\n// \t{\n// \t\tif(number%i==0)\n// \t\t{\n// \t\t\tflag=0;\n// \t\t\tbreak;\n// \t\t}\n// \t}\n// \tif(number<=1)\n// \t\tflag=1;\n// \treturn flag;\n// }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,n,i;\n scanf(\"%d\",&n);\n char st[n];\n scanf(\"%s\",st);\n for(i=0;i<n;){\n if(st[i]=='U' && st[i+1]=='R'){\n c++;\n i=i+2;\n }\n else if(st[i]=='R' && st[i+1]=='U'){\n c++;\n i=i+2;\n }\n else{\n c++;\n i++;\n }\n }\n printf(\"%d\",c);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, cnt = 0;\n char str[101];\n scanf(\"%d %s\", &n, str);\n for(int i = 1; str[i]; ++i) {\n if(str[i] != str[i - 1]) {\n str[i] = str[i + 1];\n ++cnt;\n }\n }\n printf(\"%d\\n\", n - cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\n int t, i, c=0;\n char a[101];\n\n scanf(\"%d\",&t);\n scanf(\"%s\",a);\n\n for(i=0; a[i]!='\\0'; i++)\n {\n if((a[i]=='R'&&a[i+1]=='U')||(a[i]=='U'&&a[i+1]=='R'))\n {\n t--;\n i++;\n }\n }\n printf(\"%d\",t);\n return 0;\n}\n\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#define N 100\n#define EPS 1E-5\n//#define min(a,b) (a>b) ? b : a\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint Min(int a, int b)\n{\n\treturn (a > b) ? b : a;\n}\nint main(void)\n{\n\tchar ch[101], c;\n\tint n, i = 0, count = 0;\n\tscanf(\"%i%c\", &n, &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[i++] = c;\n\t} while (c != '\\n');\n\tch[i] = c;\n\tfor (i = 0; i<n; i++)\n\t{\n\t\tif (ch[i] == 'U' && ch[i + 1] == 'R' || ch[i] == 'R' && ch[i + 1] == 'U')\n\t\t\ti++;\n\t\tcount++;\n\t}\n\tprintf(\"%i\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nvoid check_replace(char *s)\n {\n while(*s!='\\0')\n {\n if(*s=='U')\n {\n if(*(s+1)=='R')\n {\n *s='D';\n char *p=s+1;\n while(*p!='\\0') {*p=*(p+1);p++;}\n }\n else\n s++;\n }\n else if (*s=='R')\n {\n if(*(s+1)=='U')\n {\n *s='D';\n char *p=s+1;\n while(*p!='\\0') {*p=*(p+1);p++;}\n }\n else\n s++;\n }\n else\n s++;\n }\n }\nint main(void) {\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar s[n];\n\tscanf(\"%s\",s);\n\t\n\tcheck_replace(s);\n\tprintf(\"%d\",strlen(s));\n\t\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint l;\n\tscanf(\"%d\",&l);\n\tchar ss[102];\n\tscanf(\"%s\",ss);\n\tint b;\n\tb = strlen(ss);\n\tint a = 1;\n\tfor(int i = 0; i < b - 1; i++) {\n\t\tif(ss[i] == 'R' && ss[i + 1] =='U') {\n\t\t\ti++;\n\t\t}\n\t\telse if(ss[i] == 'U' && ss[i + 1] == 'R') {\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}\n\tprintf(\"%d\\n\",a);\n\t\n\t\n\treturn 0;\n\t\n}"}, {"source_code": " #include<stdio.h>\n #include<string.h>\n int main()\n {\n\n int n,i,k=0,l;\n scanf(\"%d\",&n);\n char a[n],b[n];\n scanf(\"%s\",&a);\n for(i=0;i<n-1;i++){\n if((a[i]=='U' && a[i+1]=='R') || (a[i]=='R' && a[i+1]=='U')){\n k+=1;\n i+=2;\n }\n else\n i=i;\n\n }\n // printf(\"%d\",k);\n l=n-k;\n printf(\"%d\",l);\n\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%c\",&ch[i]);\n }\n\n for(i=0,j=1;i<n,j<=n;i++,j++)\n {\n if((ch[i]=='R' & ch[j]=='U')||(ch[i]=='U' & ch[j]=='R'))\n {\n n--;\n }\n\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,n,hasilD = 0,hasil = 0;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n\n for(i = 0 ;i<n-1;i++){\n printf(\"I SEKARANG : %d\\n\",i);\n if(arr[i] != arr[i+1]){\n hasilD++;\n i++;\n }\n\n }\n printf(\"%d\",n-hasilD);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,i,c;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",&s);\n for(i=0;i<(n-1);i++){\n if(s[i]=='R'&&s[i+1]=='U'){\n n--;i++;\n }\n else if(s[i]=='U'&&s[i+1]=='R'){\n n--;i++;\n }\n }\n printf(\"%d\",n);\n\n\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k=0;\n char a[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n if(a[0]!=a[1]) k++;\n for(int i=1;i<n;i++){\n if(a[i]!=a[i+1]){\n if(a[i]==a[i-1]) k++;\n }\n }\n printf(\"%d\",n-k);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tfflush(stdin);\n\tfor(i=0;i<n;i++)\n\t{ \n\t\tscanf(\"%c\",&a[i]);\n\t}j=0;\nwhile(j<n-1)\n\t{\n\t\tif(a[j]!=a[j+1])\n\t\t{\n\t\t\tk++;\n\t\t\tj++;\n\t\t\t\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n-k);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,l,s=0,c=0;\n scanf(\"%d\",&n);\n char str[n];\n scanf(\"%s\",str);\n l=strlen(str);\n //printf(\"%d %d\",n,l);\n for(i=0;i<l;i++)\n {\n if(str[i]!=str[i+1])\n {\n c++;\n }\n }\n if(c%2!=0)\n {\n c=(c/2)+1;\n }\n else if(c%2==0)\n {\n c=c/2;\n }\n printf(\"%d\",n-c);\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tfflush(stdin);\n\tfor(i=0;i<n;i++)\n\t{ \n\t\tscanf(\"%c\",&a[i]);\n\t}j=0;\nwhile(j<n-1)\n\t{\n\t\tif(a[j]!=a[j+1])\n\t\t{\n\t\t\tk++;\n\t\t\tj++;\n\t\t\t\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n-k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n for(i=0;i<n-1;i++)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n if(a[i]!=a[i+1])\n {\n sum=sum+1;\n i++;\n }\n }\n printf(\"%d\",n-sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0,cout,out,result;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",&s);\n for(i=0;i<n;i=i+2)\n {\n if(s[i]=='r'&& s[i+1]=='u')\n {\n count++;\n }\n else if(s[i]=='u'&& s[i+1]=='r')\n {\n count++;\n }}\n\n /*if(s[i]=='u'&& s[i+1]=='r' && s[i+2]=='u')\n {\n count--;\n }*/\n\n cout=count*2;\n result=n-cout;\n out=result+count;\n printf(\"%d\",out);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%c\",&ch[i]);\n }\n\n for(i=0,j=1;i<n,j<=n;i++,j++)\n {\n if((ch[i]=='R' & ch[j]=='U')||(ch[i]=='U' & ch[j]=='R'))\n {\n n--;\n }\n\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,i,c;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",&s);\n for(i=0;i<(n-1);i++){\n if(s[i]=='R'&&s[i+1]=='U'){\n n--;i++;\n }\n else if(s[i]=='U'&&s[i+1]=='R'){\n n--;i++;\n }\n }\n printf(\"%d\",n);\n\n\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int i,l,p=0;\n\n gets(a);\n\n for(i=0;i<strlen(a);)\n { if(a[i]!=a[i+1])\n {\n i=i+2;\n p++;\n }\n\n else if(a[i]=='U'||a[i]=='R')\n {\n p++;\n i++;\n }\n\n }\n\n printf(\"%d\",p);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\n unsigned char n , i=0;\n char *s;\n scanf(\"%d\",&n);\n s=(char*)malloc(sizeof(char)*n);\n scanf(\"%s\",s);\n int nbre = n;\n while(i<n-1)\n {\n if((s[i]=='U'&&s[i+1],'R')||(s[i]=='R'&&s[i+1]=='U'))\n {\n i+=2;\n nbre--;\n }\n else i++;\n }\n printf(\"%d\",nbre);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",&s);\n for(i=0;i<n;i=i+1)\n {\n if(s[i]=='U')\n {\n if(s[i+1]=='R')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n else if(s[i]=='R')\n {\n if(s[i+1]=='U')\n {\n count=count+1;\n i=i+2;\n }\n else\n {\n i=i+1;\n }\n }\n }\n printf(\"%d\",n-count);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,j ;\n\tchar ch[100], ch1[100]=\"\";\n\tdo {scanf(\"%d\",&n);} while((n<1)||(n>100));\n\tint b = 0 ;\n\tdo\n\t{i=0 ;\n\tscanf(\"%s\",ch);\n\t\twhile(i<strlen(ch))\n\t\t\tif ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}\n\t} while((b==0) || (strlen(ch) != n)) ;\n\ti=0 ;\n\tj=0;\n\n\twhile(i<n) {\n\t\t\tif(ch[i] != ch[i+1]){strcat(ch1,\"D\") ; i=i+2; j++;}\n\t\t\telse{ch1[j]=ch[i] ; i++ ;j++;}\n\t\t\t\n\t }\n\tint k = strlen(ch1);\n\tprintf(\"%d\",k);\n\nreturn 0 ;\n} \t\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k=0;\n char a[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n if(a[0]!=a[1]) k++;\n for(int i=1;i<n;i++){\n if(a[i]!=a[i+1]){\n if(a[i]==a[i-1]) k++;\n }\n }\n printf(\"%d\",n-k);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,c=0,i,j;\n char str[1000];\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%c\",&str[i]);\n }\n for(i=1;i<=n;i++)\n {\n if((str[i]=='U' && str[i+1]=='R')||(str[i]=='R'&& str[i+1]=='U'))\n {\n c++;\n i++;\n }\n }\n //printf(\"c:%d\\n\",c);\n printf(\"%d\",n-c);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k=0,v=0;\n char a[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(int i=0;i<n-1;i++){\n if(a[i]!=a[i+1]&&v==0){\n k++;\n v++;\n }\n else if(a[i]!=a[i+1]&&v!=0){\n v--;\n }\n }\n printf(\"%d\",n-k);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n int x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint l;\n\tscanf(\"%d\",&l);\n\tchar ss[102];\n\tfor(int i = 0; i < l; i++) {\n\t\tscanf(\"%c\", &ss[i]);\n\t}\n\n\tint a = 1;\n\tfor(int i = 0; i < l - 1; i++) {\n\t\tif(ss[i] == 'R' && ss[i + 1] =='U') {\n\t\t\ti++;\n\t\t}\n\t\telse if(ss[i] == 'U' && ss[i + 1] == 'R') {\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}\n\tprintf(\"%d\\n\",a);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n ctr++;\n }\n else\n {\n count++;\n ctr++;\n }\n }\n\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,l=0;\n char m[100];\n \n scanf(\"%d\",&n);\n scanf(\"%s\",m);\n \n for(int i=0;i<n-1;i++){\n if(m[i]!=m[i+1])\n l++; i++;\n }\n \n printf(\"\\n%d\",n-l);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int i,l,p=0;\n\n gets(a);\n\n for(i=0;i<strlen(a);)\n { if(a[i]!=a[i+1])\n {\n i=i+2;\n p++;\n }\n\n else if(a[i]=='U'||a[i]=='R')\n {\n p++;\n i++;\n }\n\n }\n\n printf(\"%d\",p);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tfflush(stdin);\n\tfor(i=0;i<n;i++)\n\t{ \n\t\tscanf(\"%c\",&a[i]);\n\t}j=0;\nwhile(j<n-1)\n\t{\n\t\tif(a[j]!=a[j+1])\n\t\t{\n\t\t\tk++;\n\t\t\tj++;\n\t\t\t\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n-k);\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n #include<string.h>\n int main()\n {\n\n int n,i,k=0,l;\n scanf(\"%d\",&n);\n char a[n],b[n];\n scanf(\"%s\",&a);\n for(i=0;i<n-1;i++){\n if((a[i]=='U' && a[i+1]=='R') || (a[i]=='R' && a[i+1]=='U')){\n k+=1;\n i+=2;\n }\n else\n i=i;\n\n }\n // printf(\"%d\",k);\n l=n-k;\n printf(\"%d\",l);\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n#define minimum(x,y)((x)<(y) ? (x) : (y))\n#define maximum(x,y)((x)>(y) ? (x) : (y))\n\n\nint main()\n{\n int n,i,res;\n bool wait;\n\n res = 0;\n wait = true;\n\n scanf(\"%d\",&n);\n char s[n];\n for(i=0;i<n;++i){\n scanf(\"%c\", &s[i]);\n // printf(\"%c PUTTED\\n\", s[i]);\n if((!(s[i]==s[i-1]))&&(wait)&&(i>1)){\n // printf(\"%c c %d\\n\", s[i],i);\n // printf(\"%c pc %d\\n\", s[i-1],i);\n res++;\n wait = false;\n }else{\n wait = true;\n }\n }\n printf(\"%d\",n-res);\n\n return 0;\n}\n\n\n\n//\n// cout << m-arrSum;\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a,x;\n scanf(\"%d\",&a);\n x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,moves=0,i;\n\t\n\tscanf(\"%d\", &n);\n\tchar walk[n];\n\t\n\tscanf(\"%s\", walk);\n\t\n\tfor(i=0;i<n;){\n\t\tprintf(\"i=%d\", i);\n\t\tif ( (i==(n-1)))\n\t\t{\t\n\t\t\tmoves++;\n\t\t\tbreak;\n\t\t}\n\t\tif(walk[i]=='U'){\n\t\t\tif(walk[i+1]=='R'){\n\t\t\t\tmoves+=1;\n\t\t\t\ti=i+2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tmoves++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif(walk[i]=='R'){\n\t\t\tif(walk[i+1]=='U'){\n\t\t\t\tmoves+=1;\n\t\t\t\ti=i+2;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tmoves++;\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"\\n%d\", moves);\n}\t\t\n\t\t\n\t\n"}, {"source_code": "\nint main(){\n int i, n, count=0;\n scanf(\"%d\", &n);\n char a[n+1];\n for (i=0; i<=n; i++)\n scanf(\"%c\", &a[i]);\n// for (int i=0; i<=n; i++)\n// printf(\"%c\", a[i]);\n for (i=0; i<=n; i++){\n if ((a[i]=='r') && (a[i+1]=='u') || (a[i]=='u') && (a[i+1]=='r'))\n {\n count++;\n printf(\"at %d: %d\\n\", i, count);\n i++;\n }\n }\n printf(\"%d\", n-count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n int t, i;\n char a[100];\n\n scanf(\"%d\",&t);\n scanf(\"%s\",a);\n for(i=0; i<t-1; i++)\n {\n if((a[i]=='R'&&a[i+1]=='U')||(a[i]=='U'&&a[i+1]=='R'))\n t--;\n }\n printf(\"%d\",t);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len-1; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n ctr++;\n }\n else count++;\n }\n \n printf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint l;\n\tscanf(\"%d\",&l);\n\tchar ss[102];\n\tfor(int i = 0; i < l; i++) {\n\t\tscanf(\"%c\", &ss[i]);\n\t}\n\n\tint a = 1;\n\tfor(int i = 0; i < l - 1; i++) {\n\t\tif(ss[i] == 'R' && ss[i + 1] =='U') {\n\t\t\ti++;\n\t\t}\n\t\telse if(ss[i] == 'U' && ss[i + 1] == 'R') {\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}\n\tprintf(\"%d\\n\",a);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n\n for (i=0;i<n;i++)\n {\n if(a[i]=='U' && a[i+1]=='R')\n {\n b=b+1;\n i=i+2;\n }\n else if(a[i]=='R' && a[i+1]=='U')\n {\n b=b+1;\n i=i+2;\n }\n else{b=b+1;}\n }\n b=b+1;\n printf(\"%d\",b);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int i=0;\n int e=0;\n for(i=1;i<n;)\n {\n if(s[i]!=s[i-1])\n {\n if(i==n-2)\n e++;\n i+=2;\n }\n else{\n i++;}\n e++;\n }\n printf(\"%d\",e);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n for(i=0;i<n-1;i++)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=0;i<n-1; )\n {\n if(a[i]!=a[i+1])\n {\n sum=sum+1;\n i=i+2;\n }\n else{i++; }\n\n }\n printf(\"%d\\n\",sum);\n printf(\"%d\",n-sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint n,i,j ;\n\tchar ch[100], ch1[100];\n\tdo {scanf(\"%d\",&n);} while((n<1)||(n>100));\n\tint b = 0 ;\n\tdo\n\t{i=0 ;\n\tscanf(\"%s\",ch);\n\t\twhile(i<strlen(ch))\n\t\t\tif ((ch[i] == 'U') || (ch[i] == 'R')) {i++; b=1; } else {b=0; break ;}\n\t} while((b==0) || (strlen(ch) != n)) ;\n\ti=0 ;\n\tj=0;\n\twhile(i<n) {\n\t\t\tif(ch[i] != ch[i+1]){strcat(ch1,\"D\") ; i=i+2; j++;}\n\t\t\telse{ch1[j]=ch[i] ; i++ ;j++;}\n\t\t\t\n\t }\n\tint k = strlen(ch1);\n\tprintf(\"%d\",k);\n\nreturn 0 ;\n} \t\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a;\n scanf(\"%d\",&a);\n int x=a%2;\n printf(\"%d\", x); \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char ch[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%c\",&ch[i]);\n }\n\n for(i=0,j=1;i<n,j<=n;i++,j++)\n {\n if((ch[i]=='R' & ch[j]=='U')||(ch[i]=='U' & ch[j]=='R'))\n {\n n--;\n i++;\n j++;\n }\n\n }\n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n char b[101];\n\n scanf(\"%d\",&a);\n scanf(\"%s\",b);\n\n for(int i=0;i<a-1;i++)\n {\n if(b[i]!=b[i+1])\n a--;\n\n }\n\n printf(\"%d\\n\",a);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char* s=(char*)malloc(sizeof(char)*n);\n int i,c=n;\n for(i=0;i<n;i++)\n scanf(\" %c\",&s[i]);\n for(i=0;i<n;++i)\n {\n if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R')) \n c--;\n }\n printf(\"%d\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n int i=0;\n int e=0;\n for(i=1;i<n;)\n {\n if(s[i]!=s[i-1])\n i+=2;\n else{\n i++;}\n e++;\n }\n printf(\"%d\",e);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,n,count=0;\n char s[101],a[101];\n scanf(\"%d\",&n);\n getchar();\n gets(s);\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='U'&&s[i+1]=='R'||s[i]=='R'&&s[i+1]=='U')\n {\n a[j]='D';\n i++;\n j++;\n }\n else\n a[i]=s[i];\n }\n printf(\"%d\",strlen(a));\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n\n for (i=0;i<n;i++)\n {\n if(a[i]=='U' && a[i+1]=='R')\n {\n b=b+1;\n i=i+2;\n }\n else if(a[i]=='R' && a[i+1]=='U')\n {\n b=b+1;\n i=i+2;\n }\n else{b=b+1;}\n }\n b=b+1;\n printf(\"%d\",b);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char **argv)\n{ int n,i,c=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tscanf(\"%s\",a);\n\tfor(i=0;i<n-1;i++){\n\t\tif(a[i]!=a[i+1]){\n\t\t\tc=c+1;\n\t\t\ti=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",c);\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar data[n];\n\tscanf(\"%s\",data);\n\tchar prev = data[0];\n\tint cnt=0;\n\tfor(int i=1;data[i];i++){\n\t\tif(data[i]!=prev){\n\t\t\tcnt++;\n\t\t\ti++;\n\t\t\tprev = data[i];\n\t\t}\n\t}\n\tprintf(\"%d\",n-cnt);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n char s[1005];\n gets(s);\n for(i=0;i<n;i++)\n {\n if((s[i]=='U' && s[i+1]=='R') || (s[i]=='R' && s[i+1]=='U'))\n {\n count++;\n i=i+1;\n }\n }\n printf(\"%d\\n\",n-count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int n,i,b=0;\n scanf(\"%d\",&n);\n char a[n];\n for (i=0;i<n;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n\n for (i=0;i<n;i++)\n {\n if(a[i]=='U' && a[i+1]=='R')\n {\n b=b+1;\n i=i+2;\n }\n else if(a[i]=='R' && a[i+1]=='U')\n {\n b=b+1;\n i=i+2;\n }\n else{b=b+1;}\n }\n b=b+1;\n printf(\"%d\",b);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\nchar arr[101];\nint sum=0, i=0;\nscanf(\"%s\", &arr);\nwhile(arr[i]!='\\0')\n{\nif(arr[i]==arr[i+1])\n{\nsum++;\ni++;\n}\nelse\n{\nsum++;\ni+=2;\n}\n}\nprintf(\"%d\\n\", sum);\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int n, ct = 0, ck = 0, i;\n char s[150];\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n scanf(\"%c\", &s[i]);\n }\n\n for(i = 0; i < (n - 1); i++)\n {\n if(ck == 1)\n {\n i++;\n }\n ck = 0;\n if(((s[i] == 'U') && (s[i + 1] == 'R')) || ((s[i] == 'R') && (s[i + 1] == 'U')))\n {\n ct++;\n ck = 1;\n }\n }\n\n printf(\"%d\\n\", (n - ct));\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n, count = 0 , h = 0;\n scanf(\"%d\",&n);\n char stri[100];\n scanf(\"%s\",&stri);\n for(int i = 0; i<strlen(stri)-1; i++)\n {\n if(stri[i]!= stri[i+1])\n {\n count++;\n i++;\n }\n else\n h++;\n }\n printf(\"%d\",count+h+1);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int n, ct = 0, ck = 0, i;\n char s[150];\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++)\n {\n scanf(\"%c\", &s[i]);\n }\n\n for(i = 0; i < (n - 1); i++)\n {\n if(ck == 1)\n {\n i++;\n }\n ck = 0;\n if(((s[i] == 'U') && (s[i + 1] == 'R')) || ((s[i] == 'R') && (s[i + 1] == 'U')))\n {\n ct++;\n ck = 1;\n }\n }\n\n printf(\"%d\\n\", (n - ct));\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint maxstep;\n\tscanf(\"%d\", &maxstep);\n\tchar lalala[101] = {0};\n\tfor(int i = 0; i < maxstep+1; i ++){\n\t\tscanf(\"%c\", &lalala[i]);\n\t\tprintf(\"%c\", lalala[i]);\n\t}\n\tint discount = 0;\n\tfor(int i = 1; i < maxstep; i ++){\n\t\tif(lalala[i] != lalala[i+1]){\n\t\t\tdiscount += 1;\n\t\t\ti += 1;\n\t\t\t// printf(\"%d\",i);\n\t\t}\n\t}\n\tprintf(\"%d\", maxstep - discount);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int n,i,count=0;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=1;i<n;i++){\n if(a[i]=='U'&&a[i+1]=='R'||a[i]=='R'&&a[i+1]=='U'){\n i++;\n count++;\n }\n }\n //printf(\"count=%d\\n\",count);\n printf(\"%d\",n-count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,n,hasilD = 0,hasil = 0;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n\n for(i = 0 ;i<n-1;i++){\n printf(\"I SEKARANG : %d\\n\",i);\n if(arr[i] != arr[i+1]){\n hasilD++;\n i++;\n }\n\n }\n printf(\"%d\",n-hasilD);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint l;\n\tscanf(\"%d\",&l);\n\tchar ss[102];\n\tfor(int i = 0; i < l; i++) {\n\t\tscanf(\"%c\", &ss[i]);\n\t}\n\n\tint a = 1;\n\tfor(int i = 0; i < l - 1; i++) {\n\t\tif(ss[i] == 'R' && ss[i + 1] =='U') {\n\t\t\ti++;\n\t\t}\n\t\telse if(ss[i] == 'U' && ss[i + 1] == 'R') {\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}\n\tprintf(\"%d\\n\",a);\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, cnt = 0;\n char str[101];\n scanf(\"%d %s\", &n, str);\n for(int i = 1; str[i]; ++i) {\n if(str[i] != str[i - 1]) {\n ++cnt;\n ++i;\n }\n }\n printf(\"%d\\n\", n - cnt);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,t=0,i;\n\tscanf(\"%d\",&n);\n\tchar c[n+1];\n\tscanf(\"%s\",c);\n\tfor(i=0;i<n;i++){\n\t\tif((c[i]=='U' && c[i+1]=='R')||(c[i]=='R'&&c[i+1]=='U')){\n\t\t\ti++;\n\t\t\tt++;\n\t\t}\n\t\telse t++;\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint maxstep;\n\tscanf(\"%d\", &maxstep);\n\tchar lalala[101] = {0};\n\tfor(int i = 0; i < maxstep+1; i ++){\n\t\tscanf(\"%c\", &lalala[i]);\n\t\tprintf(\"%c\", lalala[i]);\n\t}\n\tint discount = 0;\n\tfor(int i = 1; i < maxstep; i ++){\n\t\tif(lalala[i] != lalala[i+1]){\n\t\t\tdiscount += 1;\n\t\t\ti += 1;\n\t\t\t// printf(\"%d\",i);\n\t\t}\n\t}\n\tprintf(\"%d\", maxstep - discount);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,n,sum=0;\n char a[110];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n\n for(i=0;i<n-1;)\n {\n if(a[i]!=a[i+1])\n {\n sum=sum+1;\n i=i+2;\n\n }\n i++;\n\n\n }\n printf(\"%d\",n-sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k=0;\n char a[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(int i=0;i<n;i++){\n if(a[i]!=a[i+1]){\n k++,i++;\n }\n }\n printf(\"%d\",n-k+1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char **argv)\n{ int n,i,c=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tscanf(\"%s\",a);\n\tfor(i=0;i<n-1;i++){\n\t\tif(a[i]!=a[i+1]){\n\t\t\tc=c+1;\n\t\t\ti=i+1;\n\t\t}\n\t}\n\tprintf(\"%d\",c);\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,k=0;\n\tscanf(\"%d\",&n);\n\tchar a[n];\n\tfflush(stdin);\n\tfor(i=0;i<n;i++)\n\t{ \n\t\tscanf(\"%c\",&a[i]);\n\t}j=0;\nwhile(j<n-1)\n\t{\n\t\tif(a[j]!=a[j+1])\n\t\t{\n\t\t\tk++;\n\t\t\tj++;\n\t\t\t\n\t\t}\n\t\tj++;\n\t}\n\tprintf(\"%d\",n-k);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,n,count=0,len;\n char s[101],a[101];\n scanf(\"%d\",&n);\n getchar();\n gets(s);\n for(i=0;i<n;i++)\n {\n if((s[i]=='U'&&s[i+1]=='R')||(s[i]=='R'&&s[i+1]=='U'))\n {\n a[j]='D';\n i++;\n j++;\n }\n else\n a[i]=s[i];\n }\n len=strlen(a);\n printf(\"%d\",len);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint l;\n\tscanf(\"%d\",&l);\n\tchar ss[102];\n\tfor(int i = 0; i < l; i++) {\n\t\tscanf(\"%c\", &ss[i]);\n\t}\n\n\tint a = 1;\n\tfor(int i = 0; i < l - 1; i++) {\n\t\tif(ss[i] == 'R' && ss[i + 1] =='U') {\n\t\t\ti++;\n\t\t}\n\t\telse if(ss[i] == 'U' && ss[i + 1] == 'R') {\n\t\t\ti++;\n\t\t}\n\t\ta++;\n\t}\n\tprintf(\"%d\\n\",a);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n ctr++;\n }\n else\n {\n count++;\n ctr++;\n }\n }\n\n printf(\"%d\",count);\n}\n"}, {"source_code": "\nint main(){\n int i, n, count=0;\n scanf(\"%d\", &n);\n char a[n+1];\n for (i=0; i<=n; i++)\n scanf(\"%c\", &a[i]);\n// for (int i=0; i<=n; i++)\n// printf(\"%c\", a[i]);\n for (i=0; i<=n; i++){\n if ((a[i]=='r') && (a[i+1]=='u') || (a[i]=='u') && (a[i+1]=='r'))\n {\n count++;\n printf(\"at %d: %d\\n\", i, count);\n i++;\n }\n }\n printf(\"%d\", n-count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int n,i,count=0;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=1;i<n;i++){\n if(a[i]=='U'&&a[i+1]=='R'||a[i]=='R'&&a[i+1]=='U'){\n i++;\n count++;\n }\n }\n //printf(\"count=%d\\n\",count);\n printf(\"%d\",n-count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\n\nint main(){\n\tchar c[105];\n\tint i,n;\n\tint count;\n\twhile(~scanf(\"%d\",&n)){\n\t\tscanf(\"%s\",&c);\n\t\tcount=0;\n\t\tfor(i=0; i<n-1; i++){\n\t\t\tif(abs(c[i]-c[i+1]) == 3){\n\t\t\t\ti+=2;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",n-count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, cnt = 0;\n char str[101];\n scanf(\"%d %s\", &n, str);\n for(int i = 1; str[i]; ++i) {\n if(str[i] != str[i - 1]) {\n ++cnt;\n ++i;\n }\n }\n printf(\"%d\\n\", n - cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,i,c;\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",&s);\n for(i=0;i<(n-1);i++){\n if(s[i]=='R'&&s[i+1]=='U'){\n n--;i++;\n }\n else if(s[i]=='U'&&s[i+1]=='R'){\n n--;i++;\n }\n }\n printf(\"%d\",n);\n\n\nreturn 0;\n}\n\n"}, {"source_code": "\nint main(){\n int i, n, count=0;\n scanf(\"%d\", &n);\n char a[n+1];\n for (i=0; i<=n; i++)\n scanf(\"%c\", &a[i]);\n// for (int i=0; i<=n; i++)\n// printf(\"%c\", a[i]);\n for (i=0; i<=n; i++){\n if ((a[i]=='r') && (a[i+1]=='u') || (a[i]=='u') && (a[i+1]=='r'))\n {\n count++;\n i++;\n }\n }\n printf(\"%d\", n-count);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n ctr++;\n }\n else\n {\n count++;\n ctr++;\n }\n }\n\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,n,ctn;\n scanf(\"%d\",&n);\n char c[n];\n for(i=0;i<n;i++){\n scanf(\"%c\",&c[i]);\n }\n for(i=0;i<n;i++){\n if(c[i]=='U'){\n if(c[i+1]=='R'){\n ctn++;\n i++;\n }\n }\n else if(c[i]=='R'){\n if(c[i+1]=='U'){\n ctn++;\n i++;\n }\n }\n }\n printf(\"%d\",n-ctn);\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,t=0,i;\n\tscanf(\"%d\",&n);\n\tchar c[n+1];\n\tscanf(\"%s\",c);\n\tfor(i=0;i<n;i++){\n\t\tif((c[i]=='U' && c[i+1]=='R')||(c[i]=='R'&&c[i+1]=='U')){\n\t\t\ti++;\n\t\t\tt++;\n\t\t}\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\n\nint main(){\n\tchar c[105];\n\tint i,n;\n\tint count;\n\twhile(~scanf(\"%d\",&n)){\n\t\tscanf(\"%s\",&c);\n\t\tcount=0;\n\t\tfor(i=0; i<n-1; i++){\n\t\t\tif(abs(c[i]-c[i+1]) == 3){\n\t\t\t\ti+=2;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",n-count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\n unsigned char n , i=0;\n char *s;\n scanf(\"%d\",&n);\n s=(char*)malloc(sizeof(char)*n);\n scanf(\"%s\",s);\n int nbre = n;\n while(i<n-1)\n {\n if((s[i]=='U'&&s[i+1],'R')||(s[i]=='R'&&s[i+1]=='U'))\n {\n i+=2;\n nbre--;\n }\n else i++;\n }\n printf(\"%d\",nbre);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int n,i,count=0;\n scanf(\"%d\",&n);\n char a[n];\n scanf(\"%s\",a);\n for(i=1;i<n;i++){\n if(a[i]=='U'&&a[i+1]=='R'||a[i]=='R'&&a[i+1]=='U'){\n i++;\n count++;\n }\n }\n //printf(\"count=%d\\n\",count);\n printf(\"%d\",n-count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar array[128] = {0};\n\nint main(void){\n\tint n, ans = 0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",array);\n\tputs(\"haha\");\n\tfor(int i=0;i<n-1;i++)\n\t\tif(array[i] != array[i+1])\n\t\t\tans += 1, i++;\n\n\tprintf(\"%d\\n\",n - ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int num, count, i;\n char name[101], temp;\n \n while(scanf(\"%d %s\", &num, &name) == 2){\n count = 1;\n temp = name[0];\n int flag = 0;\n for(i=1; i< strlen(name); i++){\n if((name[i]=='R' && temp == 'U') || (name[i] == 'U' && temp == 'R') && flag == 0){\n temp = name[i];\n flag = 1;\n continue;\n }\n else{\n count++;\n temp = name[i];\n flag = 0;\n }\n }\n printf(\"%d\\n\", count);\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int n,i,count=0;\n scanf(\"%d\",&n);\n getchar();\n char ch[n+5];\n gets(ch);\n for(i=0;i<n;i++)\n {\n if((ch[i]=='U' && ch[i+1]=='R') || (ch[i]=='R' && ch[i]=='U'))\n {\n count++;\n }\n }\n printf(\"%d\\n\",n-count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,count=0;\n char a[1000];\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%c\",&a[i]);\n for(i=0;i<n;i++)\n {\n if((a[i]=='U' && a[i+1]=='R')||(a[i]=='R' && a[i+1]=='U'))\n {\n count++;\n i++;\n }\n else\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n char b[101];\n\n scanf(\"%d\",&a);\n scanf(\"%s\",b);\n\n for(int i=0;i<a-1;i++)\n {\n if(b[i]!=b[i+1])\n a--;\n\n }\n\n printf(\"%d\\n\",a);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\n\nint main(){\n\tchar c[105];\n\tint i,n;\n\tint count;\n\twhile(~scanf(\"%d\",&n)){\n\t\tscanf(\"%s\",&c);\n\t\tcount=0;\n\t\tfor(i=0; i<n-1; i++){\n\t\t\tif(abs(c[i]-c[i+1]) == 3){\n\t\t\t\ti+=2;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",n-count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint num = 0;\n\tint j = 0;\n\tint TotalNunmber = 0;\n\n\tscanf(\"%d\", &num);\n\tTotalNunmber = num;\n\tchar abc[100];\n\tfor (int i = 0; i <= num; i++)\n\t{\n\t\tscanf(\"%c\", &abc[i]);\n\t}\n\n\tfor (int i = 1; i <= num; i++)\n\t{\n\t\tif (abc[i] == 'R')\n\t\t{\n\t\t\tint j = i + 1;\n\t\t\tif (abc[j] == 'U')\n\t\t\t{\n\t\t\t\tTotalNunmber--;\n\t\t\t\tint k = j + 1;\n\t\t\t\tif (abc[k] == 'R')\n\t\t\t\t{\n\t\t\t\t\tTotalNunmber++;\n\t\t\t\t\tint u = k + 1;\n\t\t\t\t\tif (abc[u] == 'U')\n\t\t\t\t\t{\n\t\t\t\t\t\tTotalNunmber--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (abc[i] == 'U')\n\t\t{\n\t\t\tint j = i + 1;\n\t\t\tif (abc[j] == 'R')\n\t\t\t{\n\t\t\t\tTotalNunmber--;\n\t\t\t\tint k = j + 1;\n\t\t\t\tif (abc[k] == 'U')\n\t\t\t\t{\n\t\t\t\t\tTotalNunmber++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\n\tprintf(\"%d\", TotalNunmber);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[105];\n int i,l,p,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n p=strlen(s);\n for(i=0;i<(strlen(s)-1);i++)\n {\n if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R'))\n {\n p--;\n i+=2;\n }\n }\n printf(\"%d\",p);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j=0,n,count=0;\n char s[101],a[101];\n scanf(\"%d\",&n);\n getchar();\n gets(s);\n for(i=0;i<n;i++)\n {\n if(s[i]=='U'&&s[i+1]=='R'||s[i]=='R'&&s[i+1]=='U')\n {\n a[j]='D';\n i++;\n j++;\n }\n else\n a[i]=s[i];\n }\n printf(\"%d\",strlen(a));\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,l,s=0,c=0;\n scanf(\"%d\",&n);\n char str[n];\n scanf(\"%s\",str);\n l=strlen(str);\n //printf(\"%d %d\",n,l);\n for(i=0;i<l;i++)\n {\n if(str[i]!=str[i+1])\n {\n c++;\n }\n }\n if(c%2!=0)\n {\n c=(c/2)+1;\n }\n else if(c%2==0)\n {\n c=c/2;\n }\n printf(\"%d\",n-c);\n return 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, j=0;\n char a[102];\n scanf(\"%d\", &n);\n gets(a);\n for(i=0; i<n-1; i++)\n {\n if(a[i]!=a[i+1])\n {\n j++;\n i++;\n }\n }\n printf(\"%d\", n-j);\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\n\nint main()\n{\n char str[100];\n int len,ctr,count=0;\n scanf(\"%d\",&len);\n scanf(\"%s\",str);\n for( ctr = 0 ; ctr < len-1; )\n {\n if( str[ctr+1] != NULL )\n {\n if( str[ctr] == 'U'&& str[ctr+1] == 'R')\n {\n count++;\n ctr+=2;\n }\n else if( str[ctr] == 'R' && str[ctr+1]== 'U')\n {\n count++;\n ctr+=2;\n }\n else\n ctr++;\n }\n else count++;\n }\n \n printf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n char b[101];\n\n scanf(\"%d\",&a);\n scanf(\"%s\",b);\n\n for(int i=0;i<a-1;i++)\n {\n if(b[i]!=b[i+1])\n a--;\n\n }\n\n printf(\"%d\\n\",a);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int num, count, i;\n char name[101], temp;\n \n while(scanf(\"%d %s\", &num, &name) == 2){\n count = 1;\n temp = name[0];\n int flag = 0;\n for(i=1; i< strlen(name); i++){\n if((name[i]=='R' && temp == 'U') || (name[i] == 'U' && temp == 'R') && flag == 0){\n temp = name[i];\n flag = 1;\n continue;\n }\n else{\n count++;\n temp = name[i];\n flag = 0;\n }\n }\n printf(\"%d\\n\", count);\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n\tint num = 0;\n\tint j = 0;\n\tint TotalNunmber = 0;\n\n\tscanf(\"%d\", &num);\n\tTotalNunmber = num;\n\tchar abc[100];\n\tfor (int i = 0; i <= num; i++)\n\t{\n\t\tscanf(\"%c\", &abc[i]);\n\t}\n\n\tfor (int i = 1; i <= num; i++)\n\t{\n\t\tif (abc[i] == 'R')\n\t\t{\n\t\t\tint j = i + 1;\n\t\t\tif (abc[j] == 'U')\n\t\t\t{\n\t\t\t\tTotalNunmber--;\n\t\t\t\tint k = j + 1;\n\t\t\t\tif (abc[k] == 'R')\n\t\t\t\t{\n\t\t\t\t\tTotalNunmber++;\n\t\t\t\t\tint u = k + 1;\n\t\t\t\t\tif (abc[u] == 'U')\n\t\t\t\t\t{\n\t\t\t\t\t\tTotalNunmber--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (abc[i] == 'U')\n\t\t{\n\t\t\tint j = i + 1;\n\t\t\tif (abc[j] == 'R')\n\t\t\t{\n\t\t\t\tTotalNunmber--;\n\t\t\t\tint k = j + 1;\n\t\t\t\tif (abc[k] == 'U')\n\t\t\t\t{\n\t\t\t\t\tTotalNunmber++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\n\tprintf(\"%d\", TotalNunmber);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\n unsigned char n , i=0;\n char *s;\n scanf(\"%d\",&n);\n s=(char*)malloc(sizeof(char)*n);\n scanf(\"%s\",s);\n int nbre = n;\n while(i<n-1)\n {\n if((s[i]=='U'&&s[i+1],'R')||(s[i]=='R'&&s[i+1]=='U'))\n {\n i+=2;\n nbre--;\n }\n else i++;\n }\n printf(\"%d\",nbre);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,k=0;\n char a[200];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(int i=0;i<n;i++){\n if(a[i]!=a[i+1]){\n k++,i++;\n }\n }\n printf(\"%d\",n-k+1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, j=0;\n char a[102];\n scanf(\"%d\", &n);\n gets(a);\n for(i=0; i<n-1; i++)\n {\n if(a[i]!=a[i+1])\n {\n j++;\n i++;\n }\n }\n printf(\"%d\", n-j);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[105];\n int i,l,p,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",s);\n p=strlen(s);\n for(i=0;i<(strlen(s)-1);i++)\n {\n if((s[i]=='R' && s[i+1]=='U')||(s[i]=='U' && s[i+1]=='R'))\n {\n p--;\n i+=2;\n }\n }\n printf(\"%d\",p);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int num, count, i;\n char name[101], temp;\n \n while(scanf(\"%d %s\", &num, &name) == 2){\n count = 1;\n temp = name[0];\n int flag = 0;\n for(i=1; i< strlen(name); i++){\n if((name[i]=='R' && temp == 'U') || (name[i] == 'U' && temp == 'R') && flag == 0){\n temp = name[i];\n flag = 1;\n continue;\n }\n else{\n count++;\n temp = name[i];\n flag = 0;\n }\n }\n printf(\"%d\\n\", count);\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,n,hasilD = 0;\n scanf(\"%d\",&n);\n char arr[n];\n scanf(\"%s\",&arr);\n\n for(i = 0 ;i<n;i++){\n if(arr[i] != arr[i+1]){\n hasilD++;\n i+=2;\n }\n }\n printf(\"%d\",n-hasilD);\n return 0;\n}\n"}], "src_uid": "986ae418ce82435badadb0bd5588f45b"} {"nl": {"description": "In the year of 3000 travelling around parallel realities became a routine thing. However one has to take into consideration that travelling like that is highly dangerous as you never know beforehand where you're gonna get...Little Vasya, for instance, found himself in a gaming reality and now he has to successfully complete all levels of a very weird game to get back. The gaming reality is a three-dimensional space where n points are given. The game has m levels and at the beginning of the i-th level the player is positioned at some plane Qi that passes through the origin. On each level Vasya has to use special robots to construct and activate n powerful energy spheres of the equal radius with centers at the given points. The player chooses the radius of the spheres himself. The player has to spend R units of money to construct spheres whose radius equals R (consequently, one can construct spheres whose radius equals zero for free). Besides, once for each level a player can choose any point in space and release a laser ray from there, perpendicular to plane Qi (this action costs nothing). The ray can either be directed towards the plane or from the plane. The spheres that share at least one point with the ray will be immediately activated. The level is considered completed if the player has managed to activate all spheres. Note that the centers of the spheres are the same for all m levels but the spheres do not remain: the player should construct them anew on each new level.Help Vasya find out what minimum sum of money will be enough to complete each level.", "input_spec": "The first line contains two integers n and m (1\u2009\u2264\u2009n\u2009\u2264\u2009900,\u20091\u2009\u2264\u2009m\u2009\u2264\u2009100) \u2014 the number of energetic spheres and the number of levels in the game correspondingly. Each of the following n lines contains three integers xi, yi, zi (0\u2009\u2264\u2009xi,\u2009yi,\u2009zi\u2009\u2264\u2009104) \u2014 the coordinates of the center of the i-th sphere. Assume that these points do not change their positions throughout the game. Then follow m lines, each containing three integers ai, bi, ci (0\u2009\u2264\u2009ai,\u2009bi,\u2009ci\u2009\u2264\u2009100, ai2\u2009+\u2009bi2\u2009+\u2009ci2\u2009>\u20090). These numbers are the coefficients in the equation of plane Qi (aix\u2009+\u2009biy\u2009+\u2009ciz\u2009=\u20090), where the player is positioned at the beginning of the i-th level.", "output_spec": "Print m numbers, one per line: the i-th line should contain the minimum sum of money needed to complete the i-th level. The absolute or relative error should not exceed 10\u2009-\u20096.", "sample_inputs": ["4 1\n0 0 0\n0 1 0\n1 0 0\n1 1 0\n0 0 1", "5 3\n0 1 0\n1 0 1\n1 2 1\n2 0 1\n1 3 0\n1 1 1\n1 2 3\n3 0 3", "2 1\n0 20 0\n0 0 0\n0 10 0"], "sample_outputs": ["0.7071067812", "1.6329931619\n1.6366341768\n1.5411035007", "0.0000000000"], "notes": null}, "positive_code": [{"source_code": "#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/time.h>\n\n#define N\t900\n\nlong double min(long double a, long double b) { return a < b ? a : b; }\nlong double max(long double a, long double b) { return a > b ? a : b; }\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tsrand(tv.tv_sec ^ tv.tv_usec);\n}\n\nint rand_(int n) {\n\treturn (rand() * 76543LL + rand()) % n;\n}\n\nlong long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;\n}\n\nlong double xx_[N], yy_[N];\n\nint i1, i2, i3; long double x_, y_, r_;\n\nvoid circle() {\n\tlong double x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];\n\tlong double a, b, c, d, e, f;\n\n\tif (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {\n\t\tx_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;\n\t\ty_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;\n\t} else {\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2\n\t\t * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2\n\t\t * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */\n\t\ta = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;\n\t\tc = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;\n\t\tx_ = (e * d - b * f) / (a * d - b * c);\n\t\ty_ = (a * f - e * c) / (a * d - b * c);\n\t}\n\tr_ = hypotl(x_ - x1, y_ - y1);\n}\n\nint ii[N];\n\nvoid shuffle(int n) {\n\tint h;\n\n\tfor (h = 0; h < n; h++) {\n\t\tint h_ = rand_(h + 1), tmp;\n\n\t\ttmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;\n\t}\n}\n\nvoid mec(int n, int k) {\n\tint h;\n\n\tshuffle(n);\n\tif (k == 0)\n\t\ti1 = i2 = i3 = ii[0];\n\tcircle();\n\tfor (h = k == 0 ? 1 : 0; h < n; h++) {\n\t\tint i = ii[h];\n\t\tlong double x = xx_[i], y = yy_[i];\n\n\t\tif (hypotl(x_ - x, y_ - y) > r_) {\n\t\t\tif (k < 2) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\ti1 = i2 = i3 = i;\n\t\t\t\telse if (k == 1)\n\t\t\t\t\ti2 = i3 = i;\n\t\t\t\tmec(h, k + 1);\n\t\t\t} else\n\t\t\t\ti3 = i, circle();\n\t\t}\n\t}\n}\n\nint main() {\n\tstatic int xx[N], yy[N], zz[N];\n\tint n, m, i;\n\n\tsrand_();\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d%d\", &xx[i], &yy[i], &zz[i]);\n\twhile (m--) {\n\t\tint ux, uy, uz, vx, vy, vz, wx, wy, wz;\n\t\tlong double vl, wl;\n\n\t\tscanf(\"%d%d%d\", &ux, &uy, &uz);\n\t\tif (ux == 0)\n\t\t\tvx = 1, vy = 0, vz = 0;\n\t\telse\n\t\t\tvx = -uy, vy = ux, vz = 0;\n\t\twx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;\n\t\tvl = sqrtl(dot3(vx, vy, vz, vx, vy, vz));\n\t\twl = sqrtl(dot3(wx, wy, wz, wx, wy, wz));\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tint x = xx[i], y = yy[i], z = zz[i];\n\n\t\t\txx_[i] = dot3(x, y, z, vx, vy, vz) / vl;\n\t\t\tyy_[i] = dot3(x, y, z, wx, wy, wz) / wl;\n\t\t}\n\t\tfor (i = 0; i < n; i++)\n\t\t\tii[i] = i;\n\t\tmec(n, 0);\n\t\tcircle();\n\t\tprintf(\"%Lf\\n\", r_);\n\t}\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/time.h>\n\n#define N\t900\n\nlong double min(long double a, long double b) { return a < b ? a : b; }\nlong double max(long double a, long double b) { return a > b ? a : b; }\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tsrand(tv.tv_sec ^ tv.tv_usec);\n}\n\nint rand_(int n) {\n\treturn (rand() * 76543LL + rand()) % n;\n}\n\nlong long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;\n}\n\nlong double xx_[N], yy_[N];\n\nint i1, i2, i3; long double x_, y_, r_;\n\nvoid circle() {\n\tlong double x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];\n\tlong double a, b, c, d, e, f;\n\n\tif (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {\n\t\tx_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;\n\t\ty_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;\n\t} else {\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2\n\t\t * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2\n\t\t * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */\n\t\ta = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;\n\t\tc = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;\n\t\tx_ = (e * d - b * f) / (a * d - b * c);\n\t\ty_ = (a * f - e * c) / (a * d - b * c);\n\t}\n\tr_ = hypot(x_ - x1, y_ - y1);\n}\n\nint ii[N];\n\nvoid shuffle(int n) {\n\tint h;\n\n\tfor (h = 0; h < n; h++) {\n\t\tint h_ = rand_(h + 1), tmp;\n\n\t\ttmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;\n\t}\n}\n\nvoid mec(int n, int k) {\n\tint h;\n\n\tshuffle(n);\n\tif (k == 0)\n\t\ti1 = i2 = i3 = ii[0];\n\tcircle();\n\tfor (h = k == 0 ? 1 : 0; h < n; h++) {\n\t\tint i = ii[h];\n\t\tlong double x = xx_[i], y = yy_[i];\n\n\t\tif ((x_ - x) * (x_ - x) + (y_ - y) * (y_ - y) > r_ * r_) {\n\t\t\tif (k < 2) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\ti1 = i2 = i3 = i;\n\t\t\t\telse if (k == 1)\n\t\t\t\t\ti2 = i3 = i;\n\t\t\t\tmec(h, k + 1);\n\t\t\t} else\n\t\t\t\ti3 = i, circle();\n\t\t}\n\t}\n}\n\nint main() {\n\tstatic int xx[N], yy[N], zz[N];\n\tint n, m, i;\n\n\tsrand_();\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d%d\", &xx[i], &yy[i], &zz[i]);\n\twhile (m--) {\n\t\tint ux, uy, uz, vx, vy, vz, wx, wy, wz;\n\t\tlong double vl, wl;\n\n\t\tscanf(\"%d%d%d\", &ux, &uy, &uz);\n\t\tif (ux == 0)\n\t\t\tvx = 1, vy = 0, vz = 0;\n\t\telse\n\t\t\tvx = -uy, vy = ux, vz = 0;\n\t\twx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;\n\t\tvl = sqrt(dot3(vx, vy, vz, vx, vy, vz));\n\t\twl = sqrt(dot3(wx, wy, wz, wx, wy, wz));\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tint x = xx[i], y = yy[i], z = zz[i];\n\n\t\t\txx_[i] = dot3(x, y, z, vx, vy, vz) / vl;\n\t\t\tyy_[i] = dot3(x, y, z, wx, wy, wz) / wl;\n\t\t}\n\t\tfor (i = 0; i < n; i++)\n\t\t\tii[i] = i;\n\t\tmec(n, 0);\n\t\tcircle();\n\t\tprintf(\"%f\\n\", r_);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/time.h>\n\n#define N\t900\n\ndouble min(double a, double b) { return a < b ? a : b; }\ndouble max(double a, double b) { return a > b ? a : b; }\n\nvoid srand_() {\n\tstruct timeval tv;\n\n\tgettimeofday(&tv, NULL);\n\tsrand(tv.tv_sec ^ tv.tv_usec);\n}\n\nint rand_(int n) {\n\treturn (rand() * 76543LL + rand()) % n;\n}\n\nlong long dot3(int x1, int y1, int z1, int x2, int y2, int z2) {\n\treturn (long long) x1 * x2 + (long long) y1 * y2 + (long long) z1 * z2;\n}\n\ndouble xx_[N], yy_[N];\n\nint i1, i2, i3; double x_, y_, r_;\n\nvoid circle() {\n\tdouble x1 = xx_[i1], y1 = yy_[i1], x2 = xx_[i2], y2 = yy_[i2], x3 = xx_[i3], y3 = yy_[i3];\n\tdouble a, b, c, d, e, f;\n\n\tif (x1 == x2 && y1 == y2 || x1 == x3 && y1 == y3 || x2 == x3 && y2 == y3) {\n\t\tx_ = (max(max(x1, x2), x3) + min(min(x1, x2), x3)) / 2;\n\t\ty_ = (max(max(y1, y2), y3) + min(min(y1, y2), y3)) / 2;\n\t} else {\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x2)^2 + (y_ - y2)^2\n\t\t * 2 (x1 - x2) x_ + 2 (y1 - y2) y_ = x1^2 + y1^2 - x2^2 - y2^2 */\n\t\t/* (x_ - x1)^2 + (y_ - y1)^2 = (x_ - x3)^2 + (y_ - y3)^2\n\t\t * 2 (x1 - x3) x_ + 2 (y1 - y3) y_ = x1^2 + y1^2 - x3^2 - y3^2 */\n\t\ta = (x1 - x2) * 2, b = (y1 - y2) * 2, e = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;\n\t\tc = (x1 - x3) * 2, d = (y1 - y3) * 2, f = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;\n\t\tx_ = (e * d - b * f) / (a * d - b * c);\n\t\ty_ = (a * f - e * c) / (a * d - b * c);\n\t}\n\tr_ = hypot(x_ - x1, y_ - y1);\n}\n\nint ii[N];\n\nvoid shuffle(int n) {\n\tint h;\n\n\tfor (h = 0; h < n; h++) {\n\t\tint h_ = rand_(h + 1), tmp;\n\n\t\ttmp = ii[h], ii[h] = ii[h_], ii[h_] = tmp;\n\t}\n}\n\nvoid mec(int n, int k) {\n\tint h;\n\n\tshuffle(n);\n\tif (k == 0)\n\t\ti1 = i2 = i3 = ii[0];\n\tcircle();\n\tfor (h = k == 0 ? 1 : 0; h < n; h++) {\n\t\tint i = ii[h];\n\t\tdouble x = xx_[i], y = yy_[i];\n\n\t\tif ((x_ - x) * (x_ - x) + (y_ - y) * (y_ - y) > r_ * r_) {\n\t\t\tif (k < 2) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\ti1 = i2 = i3 = i;\n\t\t\t\telse if (k == 1)\n\t\t\t\t\ti2 = i3 = i;\n\t\t\t\tmec(h, k + 1);\n\t\t\t} else\n\t\t\t\ti3 = i, circle();\n\t\t}\n\t}\n}\n\nint main() {\n\tstatic int xx[N], yy[N], zz[N];\n\tint n, m, i;\n\n\tsrand_();\n\tscanf(\"%d%d\", &n, &m);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d%d%d\", &xx[i], &yy[i], &zz[i]);\n\twhile (m--) {\n\t\tint ux, uy, uz, vx, vy, vz, wx, wy, wz;\n\t\tdouble vl, wl;\n\n\t\tscanf(\"%d%d%d\", &ux, &uy, &uz);\n\t\tif (ux == 0)\n\t\t\tvx = 1, vy = 0, vz = 0;\n\t\telse\n\t\t\tvx = -uy, vy = ux, vz = 0;\n\t\twx = uy * vz - vy * uz, wy = -(ux * vz - vx * uz), wz = ux * vy - vx * uy;\n\t\tvl = sqrt(dot3(vx, vy, vz, vx, vy, vz));\n\t\twl = sqrt(dot3(wx, wy, wz, wx, wy, wz));\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tint x = xx[i], y = yy[i], z = zz[i];\n\n\t\t\txx_[i] = dot3(x, y, z, vx, vy, vz) / vl;\n\t\t\tyy_[i] = dot3(x, y, z, wx, wy, wz) / wl;\n\t\t}\n\t\tfor (i = 0; i < n; i++)\n\t\t\tii[i] = i;\n\t\tmec(n, 0);\n\t\tcircle();\n\t\tprintf(\"%f\\n\", r_);\n\t}\n\treturn 0;\n}\n"}], "src_uid": "25b2a84f0c3f574cdffd59a902b2326e"} {"nl": {"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.Let next(x) be the minimum lucky number which is larger than or equals x. Petya is interested what is the value of the expression next(l)\u2009+\u2009next(l\u2009+\u20091)\u2009+\u2009...\u2009+\u2009next(r\u2009-\u20091)\u2009+\u2009next(r). Help him solve this problem.", "input_spec": "The single line contains two integers l and r (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009109) \u2014 the left and right interval limits.", "output_spec": "In the single line print the only number \u2014 the sum next(l)\u2009+\u2009next(l\u2009+\u20091)\u2009+\u2009...\u2009+\u2009next(r\u2009-\u20091)\u2009+\u2009next(r). 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.", "sample_inputs": ["2 7", "7 7"], "sample_outputs": ["33", "7"], "notes": "NoteIn the first sample: next(2)\u2009+\u2009next(3)\u2009+\u2009next(4)\u2009+\u2009next(5)\u2009+\u2009next(6)\u2009+\u2009next(7)\u2009=\u20094\u2009+\u20094\u2009+\u20094\u2009+\u20097\u2009+\u20097\u2009+\u20097\u2009=\u200933In the second sample: next(7)\u2009=\u20097"}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\nlong long int power(int i)\n{\n int j;\n long long int tmp=1;\n for(j=1;j<=i;j++)\n tmp=tmp*2;\n return tmp;\n}\nint main()\n{\n long long int l,r;\n scanf(\"%I64d %I64d\",&l,&r);\n long long int**a,c[3000];\n a=(long long int**)malloc(11*sizeof(long long int*));\n a[1]=(long long int*)malloc(2*sizeof(long long int ));\n a[1][0]=4;a[1][1]=7;\n int i,j,k,x;\n for(i=1;i<10;i++)\n {\n x=power(i+1);\n k=0;\n a[i+1]=(long long int*)malloc(x*sizeof(long long int));\n for(j=0;j<x/2;j++)\n {\n a[i+1][k++]=a[i][j]*10+4;\n a[i+1][k++]=a[i][j]*10+7;\n }\n }\n k=0;\n for(i=1;i<11;i++)\n {\n for(j=0;j<power(i);j++)\n c[k++]=a[i][j];\n }\n long long int ans=0;\n k=0;\n while(l<=r)\n {\n while(l>c[k])\n k++;\n if(r-l>=c[k]-l+1)\n ans+=(c[k]-l+1)*c[k];\n else ans+=(r-l+1)*c[k];\n l=c[k]+1;\n }\n printf(\"%I64d\\n\",ans);\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\nlong long lucky(int b) {\n\treturn b == 1 ? 0 : lucky(b / 2) * 10 + (b % 2 == 0 ? 4 : 7);\n}\n\nlong long solve(int r) {\n\tlong long n_, sum;\n\tint b;\n\n\tn_ = 0, sum = 0;\n\tfor (b = 2; ; b++) {\n\t\tlong long n = lucky(b);\n\n\t\tif (n < r) {\n\t\t\tsum += (n - n_) * n;\n\t\t\tn_ = n;\n\t\t} else {\n\t\t\tsum += (r - n_) * n;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn sum;\n}\n\nint main() {\n\tint l, r;\n\n\tscanf(\"%d%d\", &l, &r);\n\tprintf(\"%lld\\n\", solve(r) - solve(l - 1));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nlong long max(long long a, long long b) {\n\treturn a > b ? a : b;\n}\n\nlong long lucky(long long i) {\n\treturn i == 1 ? 0 : lucky(i / 2) * 10 + (i % 2 == 0 ? 4 : 7);\n}\n\nint main() {\n\tstatic long long aa[2047];\n\tlong long l, r, i, x, y, ans;\n\n\tscanf(\"%lld%lld\", &l, &r);\n\taa[0] = 4;\n\tfor (i = 1; i < 2047; i++)\n\t\taa[i] = lucky(i + 1);\n\tans = 0;\n\tfor (i = 0; i < 2047; i++) {\n\t\tx = max(aa[i - 1] + 1, l);\n\t\ty = min(aa[i], r);\n\t\tif (x <= y)\n\t\t\tans += (y - x + 1) * aa[i];\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long min(long long a, long long b) {\n\treturn a < b ? a : b;\n}\n\nlong long max(long long a, long long b) {\n\treturn a > b ? a : b;\n}\n\nlong long lucky(int i) {\n\treturn i == 1 ? 0 : lucky(i / 2) * 10 + (i % 2 == 0 ? 4 : 7);\n}\n\nint main() {\n\tstatic long long aa[2047];\n\tint l, r, i;\n\tlong long x, y, ans;\n\n\tscanf(\"%d%d\", &l, &r);\n\taa[0] = 4;\n\tfor (i = 1; i < 2047; i++)\n\t\taa[i] = lucky(i + 1);\n\tans = 0;\n\tfor (i = 0; i < 2047; i++) {\n\t\tx = max(aa[i - 1] + 1, l);\n\t\ty = min(aa[i], r);\n\t\tif (x <= y)\n\t\t\tans += (y - x + 1) * aa[i];\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int a[10000];\nint k =0;\nlong long int fastexp(int x,int y)\n{\n\tlong long int ans = 1;\n\twhile(y!=0)\n\t{\n\t\tint r = y&1;\n\t\tif(r==1)\n\t\t\tans = ans*x;\n\t\tx = x*x;\n\t\ty = y>>1;\n\t}\n\treturn ans;\n}\nvoid calc(long long int sum,int d)\n{\n\tif(d==-1 && sum!=0)\n\t{\n\t\ta[k] = sum;\n\t\tk++;\n\t\treturn;\n\t}\n\telse if(sum==0 && d==-1)\n\t\treturn;\n\tlong long int p = fastexp(10,d);\n\tif(sum==0)\n\tcalc(sum + 0*p,d-1);\n\tcalc(sum + 4*p,d-1);\n\tcalc(sum + 7*p,d-1);\n}\n\nint main(void)\n{\n\tcalc(0,9);\n\tlong long int l;\n\tlong long int r;\n\tscanf(\"%lld %lld\",&l,&r);\n\tint counter = 0;\n\tlong long int ans = 0;\n\twhile(l<=r)\n\t{\n\t\tif(a[counter]<=r)\n\t\t{\t\n\t\t\tif(l<=a[counter])\n\t\t\t{\n\t\t\t\tans = ans + (a[counter]-l+1)*a[counter];\n\t\t\t\tl = a[counter]+1;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(l==r)\n\t\t\t\tans = ans + a[counter];\n\t\t\telse if(l<=a[counter-1])\n\t\t\t\tans = ans + (r-a[counter-1])*a[counter];\n\t\t\telse\n\t\t\t{\n\t\t\t\tans = ans + (r-l+1)*a[counter];\n\t\t\t}\n\t\t\tl = r +1;\n\t\t}\n\t\tcounter++;\n\t}\n\tprintf(\"%lld\\n\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i<t;i++)kq=kq*10;\n\treturn kq;\n}\ndouble mod(double s){\n\treturn s-mu10(8)*floor(s/mu10(8));\n}\ndouble next(long n){\n\tdouble lucky;int i;\n\ti=1+floor(log10(n));\n\tlucky=4*(mu10(i)-1)/9;\n\twhile(lucky<n){\n\t\tfor(i=1;i<=1+floor(log10(lucky));i++)\n\t\t{if(floor((lucky-mu10(i)*floor(lucky/mu10(i)))/mu10(i-1))==4){\n\t\tlucky=lucky+3*mu10(i-1);\n\t\tlucky=lucky-(mu10(i-1)-1)/3;\t\n\t\tbreak;}\n\t\telse if(floor(lucky/mu10(i))==0){\n\t\tlucky=4*(mu10(i+1)-1)/9;break;}\n\t}\n}\nreturn lucky;\n}\nint main(){\nlong l,d,i;\ndouble sum=0,a;\nscanf(\"%ld%ld\",&l,&d);\nfor(i=l;i<=d;){\na=next(i);\nif(a<=d){sum=sum+a*(a-i+1);i=a+1;}\nelse {sum=sum+a*(d-i+1);i=d+1;\n}\n}\nif(sum<mu10(15))printf(\"%.0f\",sum);\nelse {\ndouble mods=0,sum1;\nfor(i=l;i<=d;){\n\ta=next(i);\n\tif(a<=d){mods=mod(mods+mod(mod(a)*mod(a-i+1)));i=a+1;}\nelse {mods=mod(mods+mod(mod(a)*mod(d-i+1)));i=d+1;}\n}\nsum1=floor(sum/mu10(8));\nchar s[9];\nfor(i=0;i<8;i++){s[i]=floor(mods/mu10(7-i))+48;mods=mods-mu10(7-i)*(s[i]-48);}\ns[8]=0;\nprintf(\"%.0f%s\",sum1,s);\n}\n}"}, {"source_code": "#include<stdio.h>\n#define N 10000000000ll\n__int64 a[10000],queue[10000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,ji,k,flag;\n __int64 sum,temp;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=flag=0;\n if(l==r) \n {\n for(j=1;;j++)\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=a[ji];break;}\n printf(\"%I64d\\n\",sum);\n continue;\n }\n for(j=1;;j++)\n {\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=(a[ji]-l+1)*a[ji];break;}\n }\n for(j=ji;;j++)\n if(r>a[j-1]&&r<=a[j]) break;\n if(j==ji) \n {\n sum=(r-l+1)*a[j];\n printf(\"%I64d\\n\",sum);\n continue;\n }\n if(r!=a[j]) j-=1;\n for(k=ji+1;k<=j;k++)\n sum+=(a[k]-a[k-1])*a[k];\n sum+=(r-a[j])*a[j+1];\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nvoid gen(long long int *a)\n{\n int i;\n a[2]=4;\n a[3]=7;\n for(i=2;i<=2048;i++){\n //heaps are beautiful\n a[i<<1]=a[i]*10+4;\n a[(i<<1)+1]=a[i]*10+7;\n // printf(\"%lld %lld\\n\",a[i<<1],a[(i<<1)+1]);\n }\n}\nint main()\n{\n long long int b[10000],*a;\n long long int ans,till;\n int l,r,i;\n gen(b);\n a=b+2;//the first two indices of b contain junk\n scanf(\"%d%d\",&l,&r);\n i=0;\n while(a[i]<l)\n i++;\n till=((r>=a[i])?a[i]:r); \n ans=a[i]*(till-l+1);\n // printf(\"%lld+\",ans);\n\n for(i=i+1;a[i]<=r;i++)\n ans+=(a[i]*(a[i]-a[i-1]));\n if(a[i-1]<r)\n ans+=(a[i]*(r-a[i-1]));\n // printf(\"%lld\\n\",ans);\n printf(\"%I64d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long a[10000];\n int p = 0, q = 2, r = 2, x, y, i, j;\n long long sum;\n\n scanf(\"%d %d\", &x, &y);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 9; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 0; i < r; i++) {\n\tif (a[i] >= x) break;\n }\n\n sum = a[i];\n\n for (; i < r; i++) {\n\tif (a[i] > y) {\n\t sum += a[i] * (y - x);\n\n\t break;\n\t} else {\n\t sum += a[i] * (a[i] - x);\n\n\t x = a[i];\n\t}\n }\n\n printf(\"%I64d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef __int64 ll;\n\nll lucky[3000];\nll q[10000];\n\nint init()\n{\n ll f = 0, r = 0, ret = 0;\n const ll limit = 4444444444ll;\n q[r++] = 4;\n q[r++] = 7;\n while (f < r)\n {\n lucky[ret++] = q[f];\n if (q[f] * 10 + 4 <= limit)\n {\n q[r++] = q[f] * 10 + 4;\n }\n if (q[f] * 10 + 7 < limit)\n {\n q[r++] = q[f] * 10 + 7;\n }\n f++;\n }\n return ret;\n}\n\nll count(ll m, int n)\n{\n int i;\n ll ret = 0;\n for (i = 0; i < n; i++)\n {\n if (i == 0)\n {\n if (lucky[i] <= m)\n {\n ret += lucky[i] * lucky[i];\n }\n else\n {\n ret += lucky[i] * m;\n }\n }\n else\n {\n if (lucky[i] <= m)\n {\n ret += lucky[i] * (lucky[i] - lucky[i - 1]);\n }\n else\n {\n ret += lucky[i] * (m - lucky[i - 1]);\n }\n }\n if (lucky[i] > m)\n {\n break;\n }\n }\n return ret;\n}\n\nvoid func(int l, int r, int n)\n{\n ll r1, r2;\n r1 = count(l - 1, n);\n r2 = count(r, n);\n printf(\"%I64d\\n\", r2 - r1);\n}\n\nint main(int argc, char **argv)\n{\n int l, r, n;\n n = init();\n while (scanf(\"%d%d\", &l, &r) == 2)\n {\n if (l > r)\n {\n l ^= r;\n r ^= l;\n l ^= r;\n }\n func(l, r, n);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef __int64 ll;\n\nll lucky[3000];\nll q[10000];\n\nint init()\n{\n ll f = 0, r = 0, ret = 0;\n const ll limit = 4444444444ll;\n q[r++] = 4;\n q[r++] = 7;\n while (f < r)\n {\n lucky[ret++] = q[f];\n if (q[f] * 10 + 4 <= limit)\n {\n q[r++] = q[f] * 10 + 4;\n }\n if (q[f] * 10 + 7 < limit)\n {\n q[r++] = q[f] * 10 + 7;\n }\n f++;\n }\n return ret;\n}\n\nll count(ll m, int n)\n{\n int i;\n ll ret = 0;\n if (m < lucky[0])\n {\n ret += lucky[0] * m;\n return ret;\n }\n for (i = 0; i < n; i++)\n {\n if (i == 0)\n {\n ret += lucky[i] * lucky[i];\n }\n else\n {\n if (lucky[i] <= m)\n {\n ret += lucky[i] * (lucky[i] - lucky[i - 1]);\n }\n else\n {\n ret += lucky[i] * (m - lucky[i - 1]);\n }\n }\n if (lucky[i] > m)\n {\n break;\n }\n }\n return ret;\n}\n\nvoid func(int l, int r, int n)\n{\n ll r1, r2;\n r1 = count(l - 1, n);\n r2 = count(r, n);\n printf(\"%I64d\\n\", r2 - r1);\n}\n\nint main(int argc, char **argv)\n{\n int l, r, n;\n n = init();\n while (scanf(\"%d%d\", &l, &r) == 2)\n {\n if (l > r)\n {\n l ^= r;\n r ^= l;\n l ^= r;\n }\n func(l, r, n);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint64_t array_int(void)\n{\n\tint i = 0;\n\tint64_t sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint64_t next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint64_t p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0 )\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = (cont-1)+1;\n\t\t\t//sea = 1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n//\tprintf(\"%d \",p);\n\treturn p;\n\t\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tint64_t s=0;\n\tint64_t t=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tt = next(ini);\n\twhile( t < fin )\n\t{\n\t\ts = s+(t-ini+1)*t;\n\t\tini = t+1;\n\t\tt = next(ini);\n\n\t}\n\ts = s+ (fin-ini+1)*t;\n\t//s += next(i);\n\n\tprintf(\"%\" PRId64 \"\\n\",s);\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nlong long lucky_number[1024];\nint id=0;\nchar s[10];\n\nint is_lucky(long long n){\n while (n>0) {\n if(n%10 != 4 && n%10 !=7) return 0;\n n=n/10;\n }\n return 1;\n}\n\nlong long next_lucky(long long n){\n int i;\n for (i=0; i<1024; i++) {\n if(lucky_number[i] >= n) return lucky_number[i];\n }\n}\n\nint main(){\n \n // Generate lucky numbers\n long long i;\n for (i=0; i<9; i++) {\n int j, k;\n for (k=0;k<=i;k++) {\n s[k] = '4';\n }\n //printf(\"%d\\n\", k);\n s[k] = '\\0';\n //printf(\"%s\\n\", s);\n //lucky_number[index++] = atoi(s);\n //printf(\"%d\\n\", lucky_number[0]);\n do {\n lucky_number[id++] = atoi(s);\n //printf(\"%s\\n\", s);\n j = i;\n while (j >= 0 && s[j]== '7') {\n j--;\n }\n //printf(\"j=%d\\n\", j);\n //break;\n if (j>=0) {\n s[j] = '7';\n for (k=j+1; k<=i; k++) {\n s[k] = '4';\n } \n }\n \n } while (j>=0);\n \n }\n lucky_number[id++] = 4444444444; \n //printf(\"%ld\\n\", next_lucky(7));\n //for(i=0; i<id; i++) printf(\"%d\\n\", lucky_number[i]);\n \n long long l,r, sum=0;\n //long i, count=0;\n //printf(\"%d\\n\", is_lucky(4));\n scanf(\"%I64d\", &l);\n scanf(\"%I64d\", &r);\n for (i=l; i<=r; i++) {\n long long next = next_lucky(i);\n //printf(\"next=%ld\\ni=%ld\\n\", next, i);\n if(next <= r){\n sum += next*(next-i+1);\n i = next;\n }else{\n sum += next*(r-i+1);\n break;\n }\n }\n printf(\"%I64d\\n\", sum);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j, k = 0;\n long long A[1024];\n char Str[10];\n long long Sum = 0, l, r;\n for(i = 1; i <= 9; ++i) {\n for(j = 0; j < (1 << i); ++j) {\n l = j;\n r = 0;\n while(l) {\n Str[r++] = l & 1;\n l >>= 1;\n }\n for(; r < i; ++r) {\n Str[r] = 0;\n }\n A[k] = 0;\n for(--r; r >= 0; --r) {\n A[k] *= 10;\n A[k] += Str[r] ? 7 : 4;\n }\n ++k;\n }\n }\n A[k++] = 4444444444LL;\n scanf(\"%I64d %I64d\", &l, &r);\n j = 0;\n Sum = 0;\n while(l <= r) {\n for(i = j; i < k; ++i) {\n if(A[i] >= l) {\n break;\n }\n }\n if(A[i] <= r) {\n Sum += (long long)(A[i] - l + 1) * A[i];\n } else {\n Sum += (long long)(r - l + 1) * A[i];\n }\n l = A[i] + 1;\n j = i + 1;\n }\n printf(\"%I64d\\n\", Sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint l,r;\n\t__int64 sum;\n\t__int64 arr[1030]={0,0,4,7};\n\tint i,j,k,m,n;\n\ti=2;\n\twhile(i<=9)\n\t{\n\t\tm = pow(2,i-1);\n\t\tn = pow(2,i);\n\t\tfor(j=0,k=m;j<n;j+=2,k++)\n\t\t{\n\t\t\tarr[n+j] = arr[k] * 10 + arr[2];\n\t\t}\n\t\tfor(j=1,k=m;j<n;j+=2,k++)\n\t\t{\n\t\t\tarr[n+j] = arr[k] * 10 + arr[3];\n\t\t}\n\t\ti++;\n\t}\n\tarr[1024] = 4444444444;\n\t//for(i=0;i<=1024;i++)\n\t//\tprintf(\"%12I64d\",arr[i]);\n\twhile(scanf(\"%d%d\",&l,&r)!=EOF)\n\t{\n\t\tsum = 0;\n\t\ti = 2;\n\t\twhile(i<1023)\n\t\t{\n\t\t\tif(l <= arr[i])\n\t\t\t\tbreak;\n\t\t\ti++;\n\t\t}\n\t\tm = i;\n\t\t//sum = (arr[j]-l+1) * arr[j];\n\t\twhile(i<1023)\n\t\t{\n\t\t\tif(r <= arr[i])\n\t\t\t\tbreak;\n\t\t\ti++;\n\t\t}\n\t\tk = i;\n\t\t//sum += (r-arr[k]) * arr[k+1];\n\t\tfor(j=m;j<k;j++)\n\t\t{\n\t\t\tsum += (arr[j+1]-arr[j])*arr[j+1];\n\t\t}\n\t\tif(r <= arr[1023])\n\t\t{\n\t\t\tsum += (arr[m]-l+1) * arr [m];\n\t\t\tsum -= (arr[k]-r) * arr[k];\n\t\t}\n\t\telse if(l > arr[1023])\n\t\t{\n\t\t\tsum = (r-l+1) * arr[1024];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsum += (arr[m]-l+1) * arr [m];\n\t\t\tsum += (r-arr[1023]) * arr[1024];\n\t\t}\n\t\tprintf(\"%I64d\\n\",sum);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint isluck(long long n)\n{\n\twhile (n)\n\t{\n\t\tif (n % 10 == 7 || n % 10 == 4)\n\t\t\tn /= 10;\n\t\telse\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\n\n\nlong long my_pow(long long n)\n{\n\tlong long tmp = 1;\n\tfor (int i = 0; i < n; i++)\n\t\ttmp *= 10;\n\n\treturn tmp;\n}\n\n\nlong long nearby(long long n)\n{\n\tlong long sum;\n\tint tmp0, flag, cnt;\n\n\tif (isluck(n) != 1)\n\t{\n\t\tsum = 0;\n\t\tcnt = 0;\n\t\tflag = 0;\n\t\twhile (n)\n\t\t{\n\t\t\tint tmp0 = n % 10;\n\t\t\tflag = 0;\n\t\t\tif (tmp0 == 7 || tmp0 == 4)\n\t\t\t\tsum += tmp0 * my_pow(cnt);\n\t\t\telse if (tmp0 < 4)\n\t\t\t\tsum += 4 * my_pow(cnt);\n\t\t\telse if (tmp0 > 4 && tmp0 < 7)\n\t\t\t\tsum += 7 * my_pow(cnt);\n\t\t\telse\n\t\t\t{\n\t\t\t\tsum = 0;\n\t\t\t\tfor (int j = 0; j <= cnt; j++)\n\t\t\t\t{\n\t\t\t\t\tsum *= 10;\n\t\t\t\t\tsum += 4;\n\t\t\t\t}\n\t\t\t\tflag = 1;\n\t\t\t}\n\n\t\t\tn /= 10;\n\t\t\tn += flag;\n\t\t\tflag = 0;\n\t\t\tcnt++;\n\t\t}\n\t\tn = sum;\n\t}\n\treturn n;\n}\n\nint main()\n{\n\tlong long l, r;\n\tlong long sum;\n\twhile (~scanf(\"%lld %lld\", &l, &r))\n\t{\n\t\tsum = 0;\n\n\t\tif (l == 654 && r == 987654)\n\t\t\tsum = 1339803940266;\n\t\telse if (l == 369 && r == 852)\n\t\t\tsum = 606732;\n\t\telse\n\t\t\tfor (long long i = l; i <= r; i++)\n\t\t\t{\n\t\t\t\tlong long tmp = nearby(i);\n\n\t\t\t\tif (tmp == i)\n\t\t\t\t\tsum += i;\n\t\t\t\telse if (tmp <= r)\n\t\t\t\t{\n\t\t\t\t\tsum += (tmp - i + 1) * tmp;\n\t\t\t\t\ti += (tmp - i);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsum += (r - i + 1) * tmp;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\tprintf(\"%lld\\n\", sum);\n\t}\n\treturn 0;\n}\n \t\t \t \t\t \t \t\t\t\t \t \t\t \t \t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define min(a, b) ((a < b) ? (a) : (b))\n\nlong long l, r, answ, t = 1;\nlong long a[11];\nlong long ans[2048];\nint n;\n\nint\nanalyze(void)\n{\n int i, nonzero = 0;\n long long tmp = 0;\n for(i = 10; i >= 0; --i){\n if(a[i] == 0 && nonzero){\n return 1;\n }\n tmp = tmp * 10 + a[i];\n if (a[i] != 0){\n nonzero = 1;\n }\n }\n if(tmp >= r){\n ans[n++] = tmp;\n return 0;\n }\n if(tmp >= l){\n ans[n++] = tmp;\n }\n return 1;\n}\n\nvoid\ngo(int i)\n{\n if(!t){\n return;\n }\n if (i == -1){\n t = analyze();\n return;\n }\n a[i] = 0;\n go(i - 1);\n a[i] = 4;\n go(i - 1);\n a[i] = 7;\n go(i - 1);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d\", &l, &r);\n go(10);\n int i;\n for(i = 1; i < n; ++i){\n answ += (min(r, ans[i]) - ans[i - 1]) * ans[i];\n }\n answ += (min(r, ans[0]) - l + 1) * ans[0];\n printf(\"%I64d\", answ);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nlong long next(int);\nlong long sumlucky(int,long long,int,long long);\nint main(void)\n{\n int l,r;\n long long luckyl,luckyr;\n /*scanf(\"%d\",&l);\n printf(\"%d\\n\",next(l));*/\n scanf(\"%d %d\",&l,&r);\n printf(\"%I64d\",sumlucky(l,next(l),r,next(r)));\n \n /*system(\"pause\");*/\n return 0;\n}\n\nlong long next(int num)\n{\n int i=0,j,digit,digitarr[50],digittest,digitnum;/*digit(\u4f4d\u6578),digitarr(luckynum\u9663\u5217),digittest(using to find digit),digitnum(num\u7684\u7b2ci\u4f4d\u6578\u5b57)*/\n long long luckynum=0; /*10^9 => 44,4444,4444*/\n \n digittest=num;\n while(digittest > 0)\n {\n digittest/=10;\n i++; \n }\n if(i == 0)/*num == 0*/\n return 4; \n digit=i;\n /*printf(\"%d\\n\",digit);*/\n \n for(i=0;i<digit;i++)\n {\n /*printf(\"%d\\n\",i);*/\n digitnum=num/(int)((float)pow(10,digit-i-1)); /*45/10==>pow(10,2-1)*/\n \n if(digitnum < 4) /*find luckynum>=num luckynum=arr[0]arr[1]....... 0 => 4 1 => 7*/\n {\n /*system(\"pause\");*/\n for(j=i;j<digit;j++)\n digitarr[j]=0;\n i=digit-1;\n }\n else if(digitnum == 4)\n {\n digitarr[i]=0;\n num-=digitnum*(int)((float)pow(10,digit-i-1));\n continue;\n }\n else if(digitnum == 5 || digitnum == 6)\n {\n digitarr[i]=1;\n for(j=i+1;j<digit;j++)\n digitarr[j]=0;\n i=digit-1;\n }\n else if(digitnum == 7)\n {\n digitarr[i]=1;\n num-=digitnum*(int)((float)pow(10,digit-i-1));\n continue;\n }\n else /*8,9*/\n {\n for(j=i-1;j>=0;j--)\n {\n if(digitarr[j] == 0)\n {\n digitarr[j]++;\n break;\n }\n else /*digitarr[j] == 1*/\n {\n digitarr[j]=0; \n } \n }\n if(j == -1) /*\u7121\u6cd5\u9032\u4f4d*/\n { \n digit++;\n /*printf(\"%d\\n\",digit);*/\n i=0;/*\u5f9e\u7b2c\u4e00\u4f4d\u958b\u59cb\u5168\u70ba4*/\n } \n for(j=i;j<digit;j++)\n {\n digitarr[j]=0;\n }\n i=digit-1;\n }\n }\n \n /*for(j=0;j<digit;j++)\n {\n printf(\"%d\",digitarr[j]);\n }\n printf(\"\\n\");*/\n for(i=0;i<digit;i++)\n {\n switch(digitarr[i])\n {\n case 0:\n digitarr[i]=4;\n break;\n case 1:\n digitarr[i]=7;\n break;\n \n }\n luckynum+=digitarr[i]*(long long)((float)pow(10,digit-i-1));\n }\n /*for(j=0;j<digit;j++)\n {\n printf(\"%d\",digitarr[j]);\n }\n printf(\"\\n\");*/\n return luckynum;\n}\nlong long sumlucky(int a,long long al,int b,long long bl)\n{\n long long sum=0;\n /*printf(\"%I64d\\n\",al);\n printf(\"%I64d\\n\",bl);*/\n \n if(al == bl)\n {\n sum=(b-a+1)*bl;\n }\n else\n {\n while(1)\n {\n \n sum+=(al-a+1)*al;\n a=al+1;\n al=next(a);\n /*printf(\"%I64d\\n\",al);*/\n if(al == bl)\n break;\n }\n sum+=(b-a+1)*bl;\n }\n \n return sum;\n}\n/****** PCCA -Sat Oct 29 04:34:14 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\nstatic int stevec = 0;\nstatic long long tabela[10000];\nint cmpll (const void * a, const void * b)\n{\n\tif(*(long long*)a < *(long long*)b){\n\t\treturn -1;\n\t}else\n\tif(*(long long*)a > *(long long*)b){\n\t\treturn 1;\n\t}else{\n\t\treturn 0;\n\t}\n \n}\nvoid generate(long long st){\n\n\tif(st < 7777777777){\n\t\ttabela[stevec++] = st;\n\t\tgenerate(10*st+4);\n\t\tgenerate(10*st+7);\n\t}\n}\nint main(){\n\tgenerate(4);\n\tgenerate(7);\n\tint i,j,k,l,m,r;\n\tscanf(\"%d %d\\n\",&l,&r);\n\tqsort(tabela,stevec,sizeof(long long),cmpll);\n\tlong long sum = 0;\n\tlong long tmp =0;\n\tint index = 0;\n\n\tfor(j = 0; j<stevec; j++){\n\t\t\tif(tabela[j]>= l){\n\t\t\t\ttmp = tabela[j];\n\t\t\t\tindex = j;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\tfor(i = l; i<=r; i++){\n\t\t\n\t\tif(r-i >= tabela[index]-i){\n\t\t//printf(\"%lld\\n\",tabela[index]-i+1);\n\t\tsum += tmp * (tabela[index]-i+1);//+/- 1\n\t\t}else{\n\t\t//printf(\"%lld\\n\",r-i+1);\n\t\tsum += tmp * (r-i+1);\n\t\tbreak;\n\t\t}\n\t\t\n\t\ti = tabela[index++];\n\t\ttmp = tabela[index];\n\t}\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nvoid gen(long long int *a)\n{\n int i;\n a[2]=4;\n a[3]=7;\n for(i=2;i<=2048;i++){\n //heaps are beautiful\n a[i<<1]=a[i]*10+4;\n a[(i<<1)+1]=a[i]*10+7;\n // printf(\"%lld %lld\\n\",a[i<<1],a[(i<<1)+1]);\n }\n}\nint main()\n{\n long long int b[10000],*a;\n long long int ans,till;\n int l,r,i;\n gen(b);\n a=b+2;//the first two indices of b contain junk\n scanf(\"%d%d\",&l,&r);\n i=0;\n while(a[i]<l)\n i++;\n till=((r>=a[i])?a[i]:r); \n ans=a[i]*(till-l+1);\n // printf(\"%lld+\",ans);\n\n for(i=i+1;a[i]<=r;i++)\n ans+=(a[i]*(a[i]-a[i-1]));\n if(a[i-1]<r)\n ans+=(a[i]*(r-a[i-1]));\n // printf(\"%lld\\n\",ans);\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long a[10000];\n int p = 0, q = 2, r = 2, x, y, i, j;\n long long sum;\n\n scanf(\"%d %d\", &x, &y);\n\n a[0] = 4;\n a[1] = 7;\n\n for (i = 0; i < 9; i++) {\n\tfor (j = p; j < q; j++) {\n\t a[r++] = a[j] * 10 + 4;\n\t a[r++] = a[j] * 10 + 7;\n\t}\n\n\tp = q;\n\tq = r;\n }\n\n for (i = 0; i < r; i++) {\n\tif (a[i] >= x) break;\n }\n\n sum = a[i];\n\n for (; i < r; i++) {\n\tif (a[i] > y) {\n\t sum += a[i] * (y - x);\n\n\t break;\n\t} else {\n\t sum += a[i] * (a[i] - x);\n\n\t x = a[i];\n\t}\n }\n\n printf(\"%I64d\\n\", sum);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n__int64 s[100005],snum;\n__int64 c[2]={4,7};\n\nvoid dfs(__int64 n,__int64 L,__int64 l){\n\t__int64 m = n;\n\tn = m*10 + c[0];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n\t\n\tn = m*10 + c[1];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n}\n\nvoid init(){\n\t__int64 i,j,k;\n\ts[0] = 0;\n\tsnum = 1;\n\tfor(i=1;i<=9;i++){\n\t\tdfs(0,i,1);\t\n\t}\n\ts[snum++] = 4444444444;\n}\n\nint main()\n{\n\t__int64 a,b,i,flag = 0;\n\tinit();\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<snum;i++){\n\t\tif(s[i]>=a){\n\t\t\tflag = i; break;\n\t\t}\t\n\t}\n\tif(b<=s[flag]){\n\t\tprintf(\"%I64d\\n\",(b-a+1)*s[flag]);\n\t}else{\n\t\t__int64 ans = (s[flag]-a+1)*s[flag];\n\t\t__int64 start = s[flag]+1;\n\t\tfor(i = flag+1;;i++){\n\t\t\tif(s[i] >= b){\n\t\t\t\tans += (b-start+1)*s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans += (s[i]-start+1)*s[i];\n\t\t\t}\n\t\t\tstart = s[i]+1;\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long l,r,power=10;\n scanf(\"%I64d%I64d\",&l,&r);\n int END=8190;\n long long no[20000];\n no[0]=4,no[1]=7;int i,j,start=0,counter=2;\n while(start<END)\n {\n for(i=4;i<=7;i+=3)\n {\n {\n for(j=start;j<start*2+2;j++)\n no[counter++]=i*power+no[j];\n }\n }\n start=start*2+2;\n power=power*10;\n }\nstart=0;long long sum=0;\nwhile(start<END&&l>no[start])\n start++;\nlong long prev_no=l;\nwhile(start<END&&r>no[start])\n{\n sum+=no[start]*(no[start]-prev_no+1);\n prev_no=no[start]+1;\n start++;\n}\nsum+=no[start]*(r-prev_no+1);\nprintf(\"%I64d\",sum);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int llint;\nllint lucky[3000],dp[3000];\nint cnt=0;\nvoid backtrack(int now,int f,char ans[])\n{\n int i;\n if(now==f)\n {\n llint tmp=0;\n for(i=0;i<now;++i) tmp=tmp*10+ans[i]-'0';\n lucky[cnt++]=tmp;\n return;\n }\n ans[now]='4';\n backtrack(now+1,f,ans);\n ans[now]='7';\n backtrack(now+1,f,ans);\n}\nint main(void)\n{\n int i;\n llint tot,l,r,bl,br,mid,posl,posr,top;\n char ans[12];\n for(i=1;i<=10;++i) backtrack(0,i,ans);\n dp[0]=16;\n for(i=1;i<cnt;++i) dp[i]=(lucky[i]-lucky[i-1])*lucky[i];\n while(scanf(\"%I64d %I64d\",&l,&r)!=EOF)\n {\n tot=0;\n bl=0;\n br=cnt-1;\n while(bl<=br)\n {\n mid=(bl+br)/2;\n if(l>lucky[mid]) bl=mid+1;\n else br=mid-1;\n }\n posl=bl;\n bl=0;\n br=cnt-1;\n while(bl<=br)\n {\n mid=(bl+br)/2;\n if(r>lucky[mid]) bl=mid+1;\n else br=mid-1;\n }\n posr=bl;\n if(l!=lucky[posl]&&r<lucky[posl]) tot+=((r-l+1)*lucky[posl]);\n else\n {\n tot+=(lucky[posl]*(lucky[posl]-l+1));\n if(r!=lucky[posr])\n {\n tot+=(lucky[posr]*(r-lucky[posr-1]));\n top=posr;\n }\n else top=posr+1;\n for(i=posl+1;i<top;++i) tot+=dp[i];\n }\n printf(\"%I64d\\n\",tot);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nchar c[11]={0};\n\n\nlong long arr[100000];\nint counter= 0;\nvoid permutate(int i,int d);\nint binser(int x,int h);\n\n\nint main()\n{\n int i=0;\n for(i=0;i<=9;i++)\n {\n permutate(0,i);\n }\n arr[counter]=4444444444;\n long long beg,last;\n unsigned long long sum=0;\n scanf(\"%I64d %I64d\",&beg,&last);\n int index=binser(beg,counter);\n while(beg<=last)\n {\n if(arr[index]<last)\n {\n sum+=(arr[index]*(arr[index]-beg+1));\n }\n else\n {\n sum+=(arr[index]*(last-beg+1));\n }\n index++;\n beg=arr[index-1]+1;\n }\n printf(\"%I64d\",sum);\n return 0;\n}\nvoid permutate(int i,int d)\n{\n if(i==d)\n {\n c[d+1]='\\0';\n\n sscanf(c,\"%I64d\",&arr[counter++]);\n return;\n }\n c[i]='4';\n permutate(i+1,d);\n c[i]='7';\n permutate(i+1,d);\n return ;\n}\nint binser(int x,int h)\n{\n int l=0;\n while(l<h)\n {\n int mid=l+(h-l)/2;\n if(arr[mid]>=x&&arr[mid-1]<x)\n return mid;\n else if(arr[mid]>x)\n h=mid-1;\n else\n l=mid+1;\n }\n if(arr[l]>=x&&arr[l-1]<x)\n return l;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\n__int64 k[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777,4444,4447,4474,4477,4744,4747,4774,4777,7444,7447,7474,7477,7744,7747,7774,7777,44444,44447,44474,44477,44744,44747,44774,44777,47444,47447,47474,47477,47744,47747,47774,47777,74444,74447,74474,74477,74744,74747,74774,74777,77444,77447,77474,77477,77744,77747,77774,77777,444444,444447,444474,444477,444744,444747,444774,444777,447444,447447,447474,447477,447744,447747,447774,447777,474444,474447,474474,474477,474744,474747,474774,474777,477444,477447,477474,477477,477744,477747,477774,477777,744444,744447,744474,744477,744744,744747,744774,744777,747444,747447,747474,747477,747744,747747,747774,747777,774444,774447,774474,774477,774744,774747,774774,774777,777444,777447,777474,777477,777744,777747,777774,777777,4444444,4444447,4444474,4444477,4444744,4444747,4444774,4444777,4447444,4447447,4447474,4447477,4447744,4447747,4447774,4447777,4474444,4474447,4474474,4474477,4474744,4474747,4474774,4474777,4477444,4477447,4477474,4477477,4477744,4477747,4477774,4477777,4744444,4744447,4744474,4744477,4744744,4744747,4744774,4744777,4747444,4747447,4747474,4747477,4747744,4747747,4747774,4747777,4774444,4774447,4774474,4774477,4774744,4774747,4774774,4774777,4777444,4777447,4777474,4777477,4777744,4777747,4777774,4777777,7444444,7444447,7444474,7444477,7444744,7444747,7444774,7444777,7447444,7447447,7447474,7447477,7447744,7447747,7447774,7447777,7474444,7474447,7474474,7474477,7474744,7474747,7474774,7474777,7477444,7477447,7477474,7477477,7477744,7477747,7477774,7477777,7744444,7744447,7744474,7744477,7744744,7744747,7744774,7744777,7747444,7747447,7747474,7747477,7747744,7747747,7747774,7747777,7774444,7774447,7774474,7774477,7774744,7774747,7774774,7774777,7777444,7777447,7777474,7777477,7777744,7777747,7777774,7777777,44444444,44444447,44444474,44444477,44444744,44444747,44444774,44444777,44447444,44447447,44447474,44447477,44447744,44447747,44447774,44447777,44474444,44474447,44474474,44474477,44474744,44474747,44474774,44474777,44477444,44477447,44477474,44477477,44477744,44477747,44477774,44477777,44744444,44744447,44744474,44744477,44744744,44744747,44744774,44744777,44747444,44747447,44747474,44747477,44747744,44747747,44747774,44747777,44774444,44774447,44774474,44774477,44774744,44774747,44774774,44774777,44777444,44777447,44777474,44777477,44777744,44777747,44777774,44777777,47444444,47444447,47444474,47444477,47444744,47444747,47444774,47444777,47447444,47447447,47447474,47447477,47447744,47447747,47447774,47447777,47474444,47474447,47474474,47474477,47474744,47474747,47474774,47474777,47477444,47477447,47477474,47477477,47477744,47477747,47477774,47477777,47744444,47744447,47744474,47744477,47744744,47744747,47744774,47744777,47747444,47747447,47747474,47747477,47747744,47747747,47747774,47747777,47774444,47774447,47774474,47774477,47774744,47774747,47774774,47774777,47777444,47777447,47777474,47777477,47777744,47777747,47777774,47777777,74444444,74444447,74444474,74444477,74444744,74444747,74444774,74444777,74447444,74447447,74447474,74447477,74447744,74447747,74447774,74447777,74474444,74474447,74474474,74474477,74474744,74474747,74474774,74474777,74477444,74477447,74477474,74477477,74477744,74477747,74477774,74477777,74744444,74744447,74744474,74744477,74744744,74744747,74744774,74744777,74747444,74747447,74747474,74747477,74747744,74747747,74747774,74747777,74774444,74774447,74774474,74774477,74774744,74774747,74774774,74774777,74777444,74777447,74777474,74777477,74777744,74777747,74777774,74777777,77444444,77444447,77444474,77444477,77444744,77444747,77444774,77444777,77447444,77447447,77447474,77447477,77447744,77447747,77447774,77447777,77474444,77474447,77474474,77474477,77474744,77474747,77474774,77474777,77477444,77477447,77477474,77477477,77477744,77477747,77477774,77477777,77744444,77744447,77744474,77744477,77744744,77744747,77744774,77744777,77747444,77747447,77747474,77747477,77747744,77747747,77747774,77747777,77774444,77774447,77774474,77774477,77774744,77774747,77774774,77774777,77777444,77777447,77777474,77777477,77777744,77777747,77777774,77777777,444444444,444444447,444444474,444444477,444444744,444444747,444444774,444444777,444447444,444447447,444447474,444447477,444447744,444447747,444447774,444447777,444474444,444474447,444474474,444474477,444474744,444474747,444474774,444474777,444477444,444477447,444477474,444477477,444477744,444477747,444477774,444477777,444744444,444744447,444744474,444744477,444744744,444744747,444744774,444744777,444747444,444747447,444747474,444747477,444747744,444747747,444747774,444747777,444774444,444774447,444774474,444774477,444774744,444774747,444774774,444774777,444777444,444777447,444777474,444777477,444777744,444777747,444777774,444777777,447444444,447444447,447444474,447444477,447444744,447444747,447444774,447444777,447447444,447447447,447447474,447447477,447447744,447447747,447447774,447447777,447474444,447474447,447474474,447474477,447474744,447474747,447474774,447474777,447477444,447477447,447477474,447477477,447477744,447477747,447477774,447477777,447744444,447744447,447744474,447744477,447744744,447744747,447744774,447744777,447747444,447747447,447747474,447747477,447747744,447747747,447747774,447747777,447774444,447774447,447774474,447774477,447774744,447774747,447774774,447774777,447777444,447777447,447777474,447777477,447777744,447777747,447777774,447777777,474444444,474444447,474444474,474444477,474444744,474444747,474444774,474444777,474447444,474447447,474447474,474447477,474447744,474447747,474447774,474447777,474474444,474474447,474474474,474474477,474474744,474474747,474474774,474474777,474477444,474477447,474477474,474477477,474477744,474477747,474477774,474477777,474744444,474744447,474744474,474744477,474744744,474744747,474744774,474744777,474747444,474747447,474747474,474747477,474747744,474747747,474747774,474747777,474774444,474774447,474774474,474774477,474774744,474774747,474774774,474774777,474777444,474777447,474777474,474777477,474777744,474777747,474777774,474777777,477444444,477444447,477444474,477444477,477444744,477444747,477444774,477444777,477447444,477447447,477447474,477447477,477447744,477447747,477447774,477447777,477474444,477474447,477474474,477474477,477474744,477474747,477474774,477474777,477477444,477477447,477477474,477477477,477477744,477477747,477477774,477477777,477744444,477744447,477744474,477744477,477744744,477744747,477744774,477744777,477747444,477747447,477747474,477747477,477747744,477747747,477747774,477747777,477774444,477774447,477774474,477774477,477774744,477774747,477774774,477774777,477777444,477777447,477777474,477777477,477777744,477777747,477777774,477777777,744444444,744444447,744444474,744444477,744444744,744444747,744444774,744444777,744447444,744447447,744447474,744447477,744447744,744447747,744447774,744447777,744474444,744474447,744474474,744474477,744474744,744474747,744474774,744474777,744477444,744477447,744477474,744477477,744477744,744477747,744477774,744477777,744744444,744744447,744744474,744744477,744744744,744744747,744744774,744744777,744747444,744747447,744747474,744747477,744747744,744747747,744747774,744747777,744774444,744774447,744774474,744774477,744774744,744774747,744774774,744774777,744777444,744777447,744777474,744777477,744777744,744777747,744777774,744777777,747444444,747444447,747444474,747444477,747444744,747444747,747444774,747444777,747447444,747447447,747447474,747447477,747447744,747447747,747447774,747447777,747474444,747474447,747474474,747474477,747474744,747474747,747474774,747474777,747477444,747477447,747477474,747477477,747477744,747477747,747477774,747477777,747744444,747744447,747744474,747744477,747744744,747744747,747744774,747744777,747747444,747747447,747747474,747747477,747747744,747747747,747747774,747747777,747774444,747774447,747774474,747774477,747774744,747774747,747774774,747774777,747777444,747777447,747777474,747777477,747777744,747777747,747777774,747777777,774444444,774444447,774444474,774444477,774444744,774444747,774444774,774444777,774447444,774447447,774447474,774447477,774447744,774447747,774447774,774447777,774474444,774474447,774474474,774474477,774474744,774474747,774474774,774474777,774477444,774477447,774477474,774477477,774477744,774477747,774477774,774477777,774744444,774744447,774744474,774744477,774744744,774744747,774744774,774744777,774747444,774747447,774747474,774747477,774747744,774747747,774747774,774747777,774774444,774774447,774774474,774774477,774774744,774774747,774774774,774774777,774777444,774777447,774777474,774777477,774777744,774777747,774777774,774777777,777444444,777444447,777444474,777444477,777444744,777444747,777444774,777444777,777447444,777447447,777447474,777447477,777447744,777447747,777447774,777447777,777474444,777474447,777474474,777474477,777474744,777474747,777474774,777474777,777477444,777477447,777477474,777477477,777477744,777477747,777477774,777477777,777744444,777744447,777744474,777744477,777744744,777744747,777744774,777744777,777747444,777747447,777747474,777747477,777747744,777747747,777747774,777747777,777774444,777774447,777774474,777774477,777774744,777774747,777774774,777774777,777777444,777777447,777777474,777777477,777777744,777777747,777777774,777777777,4444444444,0};\n\n\nint main(void){\n __int64 i,x,y,sum,j;\n scanf(\"%I64d %I64d\",&x,&y);\n sum=0;\n for(j=0;k[j]!=0;j++){\n if(k[j]>=x)\n break;\n }\n for(i=x;i<=y;i++){\n if(k[j]>=y){\n sum=sum+k[j]*(y-i+1);\n break;\n }\n if(k[j]>=i){\n sum=sum+k[j]*(k[j]-i+1);\n i=k[j];\n j++;\n }\n }\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <limits.h>\nlong long int power(int i)\n{\n int j;\n long long int tmp=1;\n for(j=1;j<=i;j++)\n tmp=tmp*2;\n return tmp;\n}\nint main()\n{\n long long int l,r;\n scanf(\"%I64d %I64d\",&l,&r);\n long long int**a,c[3000];\n a=(long long int**)malloc(11*sizeof(long long int*));\n a[1]=(long long int*)malloc(2*sizeof(long long int ));\n a[1][0]=4;a[1][1]=7;\n int i,j,k,x;\n for(i=1;i<10;i++)\n {\n x=power(i+1);\n k=0;\n a[i+1]=(long long int*)malloc(x*sizeof(long long int));\n for(j=0;j<x/2;j++)\n {\n a[i+1][k++]=a[i][j]*10+4;\n a[i+1][k++]=a[i][j]*10+7;\n }\n }\n k=0;\n for(i=1;i<11;i++)\n {\n for(j=0;j<power(i);j++)\n c[k++]=a[i][j];\n }\n long long int ans=0;\n k=0;\n while(l<=r)\n {\n while(l>c[k])\n k++;\n ans+=(c[k]-l+1)*c[k];\n l=c[k]+1;\n }\n printf(\"%I64d\\n\",ans);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint max(int a, int b) {\n\treturn a > b ? a : b;\n}\n\nlong long lucky(int i) {\n\treturn i == 1 ? 0 : lucky(i / 2) * 10 + (i % 2 == 0 ? 4 : 7);\n}\n\nint main() {\n\tstatic long long aa[2047];\n\tint l, r, i;\n\tlong long ans;\n\n\tscanf(\"%d%d\", &l, &r);\n\taa[0] = 4;\n\tfor (i = 1; i < 2047; i++)\n\t\taa[i] = lucky(i + 1);\n\tans = 0;\n\tfor (i = 0; i < 2047; i++) {\n\t\tint x, y;\n\n\t\tx = max(aa[i - 1] + 1, l);\n\t\ty = min(aa[i], r);\n\t\tif (x <= y)\n\t\t\tans += (long long) (y - x + 1) * aa[i];\n\t}\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int a[10000];\nint k =0;\nlong long int fastexp(int x,int y)\n{\n\tlong long int ans = 1;\n\twhile(y!=0)\n\t{\n\t\tint r = y&1;\n\t\tif(r==1)\n\t\t\tans = ans*x;\n\t\tx = x*x;\n\t\ty = y>>1;\n\t}\n\treturn ans;\n}\nvoid calc(long long int sum,int d)\n{\n\tif(d==-1 && sum!=0)\n\t{\n\t\ta[k] = sum;\n\t\tk++;\n\t\treturn;\n\t}\n\telse if(sum==0 && d==-1)\n\t\treturn;\n\tlong long int p = fastexp(10,d);\n\tif(sum==0)\n\tcalc(sum + 0*p,d-1);\n\tcalc(sum + 4*p,d-1);\n\tcalc(sum + 7*p,d-1);\n}\n\nint main(void)\n{\n\tcalc(0,9);\n\tlong long int l;\n\tlong long int r;\n\tscanf(\"%lld %lld\",&l,&r);\n\tint counter = 0;\n\tlong long int ans = 0;\n\twhile(l<=r)\n\t{\n\t\tif(a[counter]<=r)\n\t\t{\t\n\t\t\tif(l<=a[counter])\n\t\t\t{\n\t\t\t\tans = ans + (a[counter]-l+1)*a[counter];\n\t\t\t\tl = a[counter]+1;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tans = ans + (r-a[counter-1])*a[counter];\n\t\t\tl = r +1;\n\t\t}\n\t\tcounter++;\n\t}\n\tprintf(\"%lld\\n\",ans);\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int a[10000];\nint k =0;\nlong long int fastexp(int x,int y)\n{\n\tlong long int ans = 1;\n\twhile(y!=0)\n\t{\n\t\tint r = y&1;\n\t\tif(r==1)\n\t\t\tans = ans*x;\n\t\tx = x*x;\n\t\ty = y>>1;\n\t}\n\treturn ans;\n}\nvoid calc(long long int sum,int d)\n{\n\tif(d==-1 && sum!=0)\n\t{\n\t\ta[k] = sum;\n\t\tk++;\n\t\treturn;\n\t}\n\telse if(sum==0 && d==-1)\n\t\treturn;\n\tlong long int p = fastexp(10,d);\n\tif(sum==0)\n\tcalc(sum + 0*p,d-1);\n\tcalc(sum + 4*p,d-1);\n\tcalc(sum + 7*p,d-1);\n}\n\nint main(void)\n{\n\tcalc(0,9);\n\tlong long int l;\n\tlong long int r;\n\tscanf(\"%lld %lld\",&l,&r);\n\tint counter = 0;\n\tlong long int ans = 0;\n\twhile(l<=r)\n\t{\n\t\tif(a[counter]<=r)\n\t\t{\t\n\t\t\tif(l<=a[counter])\n\t\t\t{\n\t\t\t\tans = ans + (a[counter]-l+1)*a[counter];\n\t\t\t\tl = a[counter]+1;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(l==r)\n\t\t\t\tans = ans + a[counter];\n\t\t\telse\n\t\t\t\tans = ans + (r-a[counter-1])*a[counter];\n\t\t\tl = r +1;\n\t\t}\n\t\tcounter++;\n\t}\n\tprintf(\"%lld\\n\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i<t;i++)kq=kq*10;\n\treturn kq;\n}\ndouble mod(double s){\n\treturn s-mu10(8)*floor(s/mu10(8));\n}\ndouble next(long n){\n\tdouble lucky;int i;\n\ti=1+floor(log10(n));\n\tlucky=4*(mu10(i)-1)/9;\n\twhile(lucky<n){\n\t\tfor(i=1;i<=1+floor(log10(lucky));i++)\n\t\t{if(floor((lucky-mu10(i)*floor(lucky/mu10(i)))/mu10(i-1))==4){\n\t\tlucky=lucky+3*mu10(i-1);\n\t\tlucky=lucky-(mu10(i-1)-1)/3;\t\n\t\tbreak;}\n\t\telse if(floor(lucky/mu10(i))==0){\n\t\tlucky=4*(mu10(i+1)-1)/9;break;}\n\t}\n}\nreturn lucky;\n}\nint main(){\nlong l,d,i;\ndouble sum=0,a;\nscanf(\"%ld%ld\",&l,&d);\nfor(i=l;i<=d;){\na=next(i);\nif(a<=d){sum=sum+a*(a-i+1);i=a+1;}\nelse {sum=sum+a*(d-i+1);i=d+1;\n}\n}\nif(sum<mu10(15))printf(\"%.0f\",sum);\nelse {\ndouble mods=0,sum1;\nfor(i=l;i<=d;){\n\ta=next(i);\n\tif(a<=d){mods=mod(mods+mod(mod(a)*mod(a-i+1)));i=a+1;}\nelse {mods=mod(mods+mod(mod(a)*mod(d-i+1)));i=d+1;}\n}\nsum1=floor(sum/mu10(8));\nprintf(\"%.0f%.0f\",sum1,mods);\n}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\ndouble mu10(int t){\n\tint i;double kq=1;\n\tfor(i=0;i<t;i++)kq=kq*10;\n\treturn kq;\n}\ndouble next(long n){\n\tdouble lucky;int i;\n\ti=1+floor(log10(n));\n\tlucky=4*(mu10(i)-1)/9;\n\twhile(lucky<n){\n\t\tfor(i=1;i<=1+floor(log10(lucky));i++)\n\t\t{if(floor((lucky-mu10(i)*floor(lucky/mu10(i)))/mu10(i-1))==4){\n\t\tlucky=lucky+3*mu10(i-1);\n\t\tlucky=lucky-(mu10(i-1)-1)/3;\t\n\t\tbreak;}\n\t\telse if(floor(lucky/mu10(i))==0){\n\t\tlucky=4*(mu10(i+1)-1)/9;break;}\n\t}\n}\nreturn lucky;\n}\nint main(){\nlong l,d,i;\ndouble sum=0,a;\n\nscanf(\"%ld%ld\",&l,&d);\n\nfor(i=l;i<=d;){\na=next(i);\nif(a<=d){sum=sum+a*(a-i+1);i=a+1;}\nelse {sum=sum+a*(d-i+1);i=d+1;\n}\n}\nprintf(\"%.0f\",sum);\n\n}"}, {"source_code": "#include<stdio.h>\n#define N 100000000\n__int64 a[1000],queue[1000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,temp,j,k;\n __int64 sum;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=0;\n for(k=l;k<=r;k++)\n for(j=1;j<=i;j++)\n {\n if(k>a[j-1]&&k<=a[j]) \n {\n sum+=a[j];\n break;\n }\n }\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define N 10000000000ll\n__int64 a[10000],queue[10000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,ji,k;\n __int64 sum,temp;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=0;\n for(j=1;;j++)\n {\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=(a[ji]-l+1)*a[ji];break;}\n }\n for(j=ji;;j++)\n if(r>a[j-1]&&r<=a[j]) break;\n for(k=ji+1;k<=j;k++)\n sum+=(a[k]-a[k-1]+1)*a[k];\n sum-=(r-a[j]+1)*a[j];\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define N 10000000000ll\n__int64 a[10000],queue[10000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,ji,k,flag;\n __int64 sum,temp;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=flag=0;\n for(j=1;;j++)\n {\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=(a[ji]-l+1)*a[ji];break;}\n }\n for(j=ji;;j++)\n if(r>a[j-1]&&r<=a[j]) break;\n if(r==a[j]) flag=1;\n for(k=ji+1;k<=j;k++)\n sum+=(a[k]-a[k-1])*a[k];\n if(!flag) sum-=(r-a[j]+1)*a[j];\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define N 10000000000ll\n__int64 a[10000],queue[10000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,ji,k,flag;\n __int64 sum,temp;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=flag=0;\n if(l==r) \n {\n for(j=1;;j++)\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=a[ji];break;}\n printf(\"%I64d\\n\",sum);\n continue;\n }\n for(j=1;;j++)\n {\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=(a[ji]-l+1)*a[ji];break;}\n }\n for(j=ji;;j++)\n if(r>a[j-1]&&r<=a[j]) break;\n if(r!=a[j]) j-=1;\n for(k=ji+1;k<=j;k++)\n sum+=(a[k]-a[k-1])*a[k];\n sum+=(r-a[j])*a[j+1];\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define N 10000000000ll\n__int64 a[10000],queue[10000];\nint main()\n{\n int l,r,front=0,rear=0,i=1,j,ji,k,flag;\n __int64 sum,temp;\n queue[rear++]=4;\n queue[rear++]=7;\n a[0]=0;\n while(i)\n {\n temp=queue[front];\n front++;\n a[i]=temp;\n if(a[i]>N) break;\n i++;\n queue[rear++]=temp*10+4;\n queue[rear++]=temp*10+7;\n }\n while(~scanf(\"%d%d\",&l,&r))\n {\n sum=flag=0;\n for(j=1;;j++)\n {\n if(l>a[j-1]&&l<=a[j]) {ji=j;sum+=(a[ji]-l+1)*a[ji];break;}\n }\n for(j=ji;;j++)\n if(r>a[j-1]&&r<=a[j]) break;\n if(r!=a[j]) j-=1;\n for(k=ji+1;k<=j;k++)\n sum+=(a[k]-a[k-1])*a[k];\n sum+=(r-a[j])*a[j+1];\n printf(\"%I64d\\n\",sum);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*pow(10,cont-i-1);\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\t//\tprintf(\"\\n%d\",p);\n\treturn p;\n\t\n\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,t=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\tt += next(i);\n\t}\n\tprintf(\"%d\",t);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint64_t array_int(void)\n{\n\tint i = 0;\n\tint64_t sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint64_t next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint64_t p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0 )\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = (cont-1)+1;\n\t\t\t//sea = 1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\tprintf(\"%d\\n\",p);\n\treturn p;\n\t\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tint64_t s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%\" PRId64 \"\\n\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint64_t array_int(void)\n{\n\tint i = 0;\n\tint64_t sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint64_t next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint64_t p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = (cont-1)+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\n\tp = array_int();\n\treturn p;\n\t\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tint64_t s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%\" PRId64 \"\\n\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*pow(10,cont-i-1);\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\t//\tprintf(\"\\n%d\",p);\n\treturn p;\n\t\n\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%d\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint64_t array_int(void)\n{\n\tint i = 0;\n\tint64_t sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint64_t next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint64_t p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = (cont-1)+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\n\tp = array_int();\n\tprintf(\"%d \",p);\n\treturn p;\n\t\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tint64_t s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%\" PRId64 \"\\n\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*pow(10,cont-i-1);\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 && t[i]!=7)\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\treturn p;\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%d\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*pow(10,cont-i-1);\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\t\n\treturn p;\n\t\n\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%d\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*(int)pow(10,cont-i-1);\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\t//\tprintf(\"\\n%d\",p);\n\treturn p;\n\t\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%d\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <inttypes.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint64_t array_int(void)\n{\n\tint i = 0;\n\tint64_t sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint64_t next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint64_t p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\n\tp = array_int();\n\t//printf(\"%lf \",p);\n\treturn p;\n\t\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tint64_t s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%\" PRId64 \"\\n\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[10000000];\nint tinv[10000000];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nint array_int(void)\n{\n\tint i = 0;\n\tint sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nint next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tint p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\t\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\tp = array_int();\n\t//\tprintf(\"\\n%d\",p);\n\treturn p;\n\t\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n,s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%d\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint t[100];\nint tinv[100];\nint cont;\n\nvoid invertir(int x)\n{\t\n\tcont=0;\n\tint i=0,mo,di;\n\twhile(x !=0 )\n\t{\n\t\tmo = x%10;\n\t\tt[i] = mo;\n\t\ti++;\n\t\tx = x/10;\n\t\tcont++;\n\t}\n}\n\nvoid invertir_array(void)\n{\t\n\tint i;\n\tfor(i = 0; i<cont ;i++)\n\t{\n\t\ttinv[i] = t[cont-i-1];\n\t}\n}\nlong long array_int(void)\n{\n\tint i = 0;\n\tlong long sum = 0;\n\tfor(i = cont-1; i>=0;i--)\n\t{\n\t\tsum = sum + tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));\n\t}\n\treturn sum;\n}\n\n\nlong long next(int x)\n{\n\tint e=0;\n\tint guar;\n\tguar = x;\n\tint di,mo;\n\tlong long p;\n\tint sea=0;\n\tint i;\n\t\n\t\n\t//lo invierto\n\tinvertir(x);\n\t\n\t\n\tfor(i =(cont-1); i>=0 ; i--)\n\t{\n\t\tif ( sea == 1 && t[i] != 4 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t}\n\t\t\n\t\tif ( t[i]< 4 && sea==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i]> 4 && t[i]< 7 && sea == 0)\n\t\t{\n\t\t\tt[i] = 7;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i==(cont-1) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tt[i+1] = 4;\n\t\t\tcont++;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( t[i] > 7 && i!=(cont-1) && sea == 0 )\n\t\t{\n\t\t\tt[i] = 4;\n\t\t\tsea = 1;\n\t\t}\n\t\tif( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0)\n\t\t{\n\t\t\tt[i-1] = 4;\n\t\t\tt[i] = 7;\n\t\t}\n\t\tif( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )\n\t\t{\n\t\t\tt[i] = 8;\n\t\t\tt[i-1] = 7;\n\t\t\ti = i+1;\n\t\t}\n\t\t\n\t}\n\n\tinvertir_array();\n\n\tp = array_int();\n\t\n\treturn p;\n\t\n\t\n\t/*\n\twhile( x != 0 )\n\t{\t\n\t\tmo = x%10;\n\t\tif( mo == 4 || mo == 7)\n\t\t{\n\t\t\tx = x/10;\n\t\t}\n\t\telse\n\t\t{ \t\t\n\t\t x = guar+1;\n\t\t guar = x;\n\t\t}\t\n\t}\n\treturn guar;\t\n\t*/\n}\n\n\nint main(void)\n{\n\tint i,j,ini,fin,n;\n\tlong long s=0;\n\tscanf(\"%d\",&ini); //inicio\n\tscanf(\"%d\",&fin); //fin\n\t\n\tfor(i=ini;i<=fin;i++)\n\t{\n\t\ts += next(i);\n\t}\n\tprintf(\"%ld\",s);\n\t\n\n\n\t\n\t\n\n\t\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nlong lucky_number[1024];\nint id=0;\nchar s[10];\n\nint is_lucky(long n){\n while (n>0) {\n if(n%10 != 4 && n%10 !=7) return 0;\n n=n/10;\n }\n return 1;\n}\n\nlong next_lucky(long n){\n int i;\n for (i=0; i<1024; i++) {\n if(lucky_number[i] >= n) return lucky_number[i];\n }\n}\n\nint main(){\n \n // Generate lucky numbers\n long i;\n for (i=0; i<9; i++) {\n int j, k;\n for (k=0;k<=i;k++) {\n s[k] = '4';\n }\n //printf(\"%d\\n\", k);\n s[k] = '\\0';\n //printf(\"%s\\n\", s);\n //lucky_number[index++] = atoi(s);\n //printf(\"%d\\n\", lucky_number[0]);\n do {\n lucky_number[id++] = atoi(s);\n //printf(\"%s\\n\", s);\n j = i;\n while (j >= 0 && s[j]== '7') {\n j--;\n }\n //printf(\"j=%d\\n\", j);\n //break;\n if (j>=0) {\n s[j] = '7';\n for (k=j+1; k<=i; k++) {\n s[k] = '4';\n } \n }\n \n } while (j>=0);\n \n }\n lucky_number[id++] = 4444444444; \n //printf(\"%ld\\n\", next_lucky(7));\n //for(i=0; i<id; i++) printf(\"%d\\n\", lucky_number[i]);\n \n long l,r, sum=0;\n //long i, count=0;\n //printf(\"%d\\n\", is_lucky(4));\n scanf(\"%ld\", &l);\n scanf(\"%ld\", &r);\n for (i=l; i<=r; i++) {\n long next = next_lucky(i);\n //printf(\"next=%ld\\ni=%ld\\n\", next, i);\n if(next <= r){\n sum += next*(next-i+1);\n i = next;\n }else{\n sum += next*(r-i+1);\n break;\n }\n }\n printf(\"%ld\\n\", sum);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, l, r, j, k = 0;\n int A[512];\n char Str[10];\n long long Sum = 0;\n for(i = 1; i < 9; ++i) {\n for(j = 0; j < (1 << i); ++j) {\n l = j;\n r = 0;\n while(l) {\n Str[r++] = l & 1;\n l >>= 1;\n }\n for(; r < i; ++r) {\n Str[r] = 0;\n }\n A[k] = 0;\n for(--r; r >= 0; --r) {\n A[k] *= 10;\n A[k] += Str[r] ? 7 : 4;\n }\n ++k;\n }\n }\n scanf(\"%d %d\", &l, &r);\n j = 0;\n Sum = 0;\n while(l <= r) {\n for(i = j; i < 510; ++i) {\n if(A[i] >= l) {\n break;\n }\n }\n if(A[i] <= r) {\n Sum += (long long)(A[i] - l + 1) * A[i];\n } else {\n Sum += (long long)(r - l + 1) * A[i];\n }\n l = A[i] + 1;\n j = i + 1;\n }\n printf(\"%I64d\\n\", Sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, l, r, j, k = 0;\n int A[512];\n char Str[10];\n long long Sum = 0;\n for(i = 1; i < 9; ++i) {\n for(j = 0; j < (1 << i); ++j) {\n l = j;\n r = 0;\n while(l) {\n Str[r++] = l & 1;\n l >>= 1;\n }\n for(; r < i; ++r) {\n Str[r] = 0;\n }\n A[k] = 0;\n for(--r; r >= 0; --r) {\n A[k] *= 10;\n A[k] += Str[r] ? 7 : 4;\n }\n ++k;\n }\n }\n scanf(\"%d %d\", &l, &r);\n j = 0;\n Sum = 0;\n while(l <= r) {\n for(i = j; i < 510; ++i) {\n if(A[i] >= l) {\n break;\n }\n }\n Sum += (long long)(A[i] - l + 1) * A[i];\n l = A[i] + 1;\n j = i + 1;\n }\n printf(\"%I64d\\n\", Sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define min(a, b) ((a < b) ? (a) : (b))\n\nlong long l, r, answ, t = 1;\nlong long a[10];\nlong long ans[100000];\nint n;\n\nint\nanalyze(void)\n{\n int i, nonzero = 0;\n long long tmp = 0;\n for(i = 9; i >= 0; --i){\n if(a[i] == 0 && nonzero){\n return 1;\n }\n tmp = tmp * 10 + a[i];\n if (a[i] != 0){\n nonzero = 1;\n }\n }\n if(tmp >= r){\n ans[n++] = tmp;\n return 0;\n }\n if(tmp >= l){\n ans[n++] = tmp;\n }\n return 1;\n}\n\nvoid\ngo(int i)\n{\n if(!t){\n return;\n }\n if (i == -1){\n t = analyze();\n return;\n }\n a[i] = 0;\n go(i - 1);\n a[i] = 4;\n go(i - 1);\n a[i] = 7;\n go(i - 1);\n}\n\nint\nmain(void)\n{\n scanf(\"%I64d%I64d\", &l, &r);\n go(9);\n int i;\n for(i = 1; i < n; ++i){\n answ += (min(r, ans[i]) - ans[i - 1]) * ans[i];\n }\n answ += (ans[0] - l + 1) * ans[0];\n printf(\"%I64d\", answ);\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nvoid gen(long long int *a)\n{\n int i;\n a[2]=4;\n a[3]=7;\n for(i=2;i<=2048;i++){\n //heaps are beautiful\n a[i<<1]=a[i]*10+4;\n a[(i<<1)+1]=a[i]*10+7;\n // printf(\"%lld %lld\\n\",a[i<<1],a[(i<<1)+1]);\n }\n}\nint main()\n{\n long long int b[10000],*a;\n long long int ans,till;\n int l,r,i;\n gen(b);\n a=b+2;//the first two indices of b contain junk\n scanf(\"%d%d\",&l,&r);\n i=0;\n while(a[i]<l)\n i++;\n till=((r>=a[i])?a[i]:r); \n ans=a[i]*(till-l+1);\n // printf(\"%lld+\",ans);\n\n for(i=i+1;a[i]<=r;i++)\n ans+=(a[i]*(a[i]-a[i-1]));\n if(a[i-1]<r)\n ans+=(a[i]*(r-a[i-1]));\n printf(\"%lld\\n\",ans);\n //printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nvoid gen(long long int *a)\n{\n int i;\n a[2]=4;\n a[3]=7;\n for(i=2;i<=2048;i++){\n //heaps are beautiful\n a[i<<1]=a[i]*10+4;\n a[(i<<1)+1]=a[i]*10+7;\n// printf(\"%lld %lld\\n\",a[i<<1],a[(i<<1)+1]);\n }\n}\nint main()\n{\n long long int b[10000],*a;\n long long int ans,till;\n int l,r,i;\n gen(b);\n a=b+2;//the first two indices of b contain junk\n scanf(\"%d%d\",&l,&r);\n i=0;\n while(a[i]<l)\n i++;\n till=((r>=a[i])?a[i]:r); \n ans=a[i]*(till-l+1);\n// printf(\"%lld+\",ans);\n\n for(i=i+1;a[i]<=r;i++)\n ans+=(a[i]*(a[i]-a[i-1]));\n ans+=(a[i]*(r-a[i-1]));\n // printf(\"%lld\\n\",ans);\n printf(\"%I64d\\n\",ans);\n //cout>>ans;\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n__int64 s[100005],snum;\nint c[2]={4,7};\n\nvoid dfs(__int64 n,__int64 L,__int64 l){\n\t__int64 m = n;\n\tn = m*10 + c[0];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n\t\n\tn = m*10 + c[1];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n}\n\nvoid init(){\n\t__int64 i,j,k;\n\ts[0] = 0;\n\tsnum = 1;\n\tfor(i=1;i<=9;i++){\n\t\tdfs(0,i,1);\t\n\t}\n}\n\nint main()\n{\n\t__int64 a,b,i,flag = 0;\n\tinit();\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<snum;i++){\n\t\tif(s[i]>=a){\n\t\t\tflag = i; break;\n\t\t}\t\n\t}\n\tif(b<=s[flag]){\n\t\tprintf(\"%I64d\\n\",(b-a+1)*s[flag]);\n\t}else{\n\t\tint ans = (s[flag]-a+1)*s[flag];\n\t\tint start = s[flag]+1;\n\t\tfor(i = flag;;i++){\n\t\t\tif(s[i] >= b){\n\t\t\t\tans += (b-start+1)*s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans += (s[i]-start+1)*s[i];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n__int64 s[100005],snum;\nint c[2]={4,7};\n\nvoid dfs(__int64 n,__int64 L,__int64 l){\n\t__int64 m = n;\n\tn = m*10 + c[0];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n\t\n\tn = m*10 + c[1];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n}\n\nvoid init(){\n\t__int64 i,j,k;\n\ts[0] = 0;\n\tsnum = 1;\n\tfor(i=1;i<=9;i++){\n\t\tdfs(0,i,1);\t\n\t}\n\ts[snum++] = 4444444444;\n}\n\nint main()\n{\n\t__int64 a,b,i,flag = 0;\n\tinit();\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<snum;i++){\n\t\tif(s[i]>=a){\n\t\t\tflag = i; break;\n\t\t}\t\n\t}\n\tif(b<=s[flag]){\n\t\tprintf(\"%I64d\\n\",(b-a+1)*s[flag]);\n\t}else{\n\t\tint ans = (s[flag]-a+1)*s[flag];\n\t\tint start = s[flag]+1;\n\t\tfor(i = flag;;i++){\n\t\t\tif(s[i] >= b){\n\t\t\t\tans += (b-start+1)*s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans += (s[i]-start+1)*s[i];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n__int64 s[100005],snum;\n__int64 c[2]={4,7};\n\nvoid dfs(__int64 n,__int64 L,__int64 l){\n\t__int64 m = n;\n\tn = m*10 + c[0];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n\t\n\tn = m*10 + c[1];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n}\n\nvoid init(){\n\t__int64 i,j,k;\n\ts[0] = 0;\n\tsnum = 1;\n\tfor(i=1;i<=9;i++){\n\t\tdfs(0,i,1);\t\n\t}\n\ts[snum++] = 4444444444;\n}\n\nint main()\n{\n\t__int64 a,b,i,flag = 0;\n\tinit();\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<snum;i++){\n\t\tif(s[i]>=a){\n\t\t\tflag = i; break;\n\t\t}\t\n\t}\n\tif(b<=s[flag]){\n\t\tprintf(\"%I64d\\n\",(b-a+1)*s[flag]);\n\t}else{\n\t\t__int64 ans = (s[flag]-a+1)*s[flag];\n\t\t__int64 start = s[flag]+1;\n\t\tfor(i = flag+1;;i++){\n\t\t\tif(s[i] >= b){\n\t\t\t\tans += (b-start+1)*s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans += (s[i]-start+1)*s[i];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n__int64 s[100005],snum;\n__int64 c[2]={4,7};\n\nvoid dfs(__int64 n,__int64 L,__int64 l){\n\t__int64 m = n;\n\tn = m*10 + c[0];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n\t\n\tn = m*10 + c[1];\n\tif(l == L)\ts[snum++] = n;\n\telse\t\tdfs(n,L,l+1);\n}\n\nvoid init(){\n\t__int64 i,j,k;\n\ts[0] = 0;\n\tsnum = 1;\n\tfor(i=1;i<=9;i++){\n\t\tdfs(0,i,1);\t\n\t}\n\ts[snum++] = 4444444444;\n}\n\nint main()\n{\n\t__int64 a,b,i,flag = 0;\n\tinit();\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tfor(i=1;i<snum;i++){\n\t\tif(s[i]>=a){\n\t\t\tflag = i; break;\n\t\t}\t\n\t}\n\tif(b<=s[flag]){\n\t\tprintf(\"%I64d\\n\",(b-a+1)*s[flag]);\n\t}else{\n\t\t__int64 ans = (s[flag]-a+1)*s[flag];\n\t\t__int64 start = s[flag]+1;\n\t\tfor(i = flag;;i++){\n\t\t\tif(s[i] >= b){\n\t\t\t\tans += (b-start+1)*s[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tans += (s[i]-start+1)*s[i];\n\t\t\t}\n\t\t}\n\t\tprintf(\"%I64d\\n\",ans);\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long int llint;\nllint lucky[3000];\nint cnt=0;\nvoid backtrack(int now,int f,char ans[])\n{\n int i;\n if(now==f)\n {\n llint tmp=0;\n for(i=0;i<now;++i) tmp=tmp*10+ans[i]-'0';\n lucky[cnt++]=tmp;\n return;\n }\n ans[now]='4';\n backtrack(now+1,f,ans);\n ans[now]='7';\n backtrack(now+1,f,ans);\n}\nint main(void)\n{\n int i;\n llint tot,l,r,bl,br,mid,posl,posr,top;\n char ans[12];\n for(i=1;i<=10;++i) backtrack(0,i,ans);\n while(scanf(\"%I64d %I64d\",&l,&r)!=EOF)\n {\n tot=0;\n bl=0;\n br=cnt-1;\n while(bl<=br)\n {\n mid=(bl+br)/2;\n if(l>lucky[mid]) bl=mid+1;\n else br=mid-1;\n }\n posl=bl;\n bl=0;\n br=cnt-1;\n while(bl<=br)\n {\n mid=(bl+br)/2;\n if(r>lucky[mid]) bl=mid+1;\n else br=mid-1;\n }\n posr=bl;\n\n tot+=(lucky[posl]*(lucky[posl]-l+1));\n if(r!=lucky[posr])\n {\n tot+=(lucky[posr]*(r-lucky[posr-1]));\n top=posr-1;\n }\n else top=posr;\n for(i=posl+1;i<=top;++i) tot+=(lucky[i]*(lucky[i]-lucky[i-1]));\n\n printf(\"%I64d\\n\",tot);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint k[20];\n\n__int64 P(__int64 n){\n memset(k,0,sizeof(k));\n int i,j;\n i=0;\n while(n){\n k[i++]=n%10;\n n/=10;\n }\n int m=i-1;\n for(i=m;i>=0;i--){\n if(k[i]>7){\n for(j=i;j<=m;j++){\n if(k[j]>7){\n k[j+1]=k[j+1]+1;\n k[j]=0;\n }\n }\n break;\n }\n }\n __int64 sum=0;\n for(i=m;i>=0;i--){\n if(k[i]<4){\n sum=sum*10+4;\n for(j=i-1;j>=0;j--){\n sum=sum*10+4;\n }\n break;\n }\n else if(k[i]==4){\n sum=sum*10+4;\n }\n else if(k[i]<7){\n sum=sum*10+7;\n for(j=i-1;j>=0;j--){\n sum=sum*10+4;\n }\n break;\n }\n else if(k[i]==7){\n sum=sum*10+7;\n }\n }\n return sum;\n}\n\nint main(void){\n __int64 i,x,y,sum;\n scanf(\"%I64d %I64d\",&x,&y);\n sum=0;\n for(i=x;i<=y;i++){\n sum+=P(i);\n }\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\n__int64 k[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777,4444,4447,4474,4477,4744,4747,4774,4777,7444,7447,7474,7477,7744,7747,7774,7777,44444,44447,44474,44477,44744,44747,44774,44777,47444,47447,47474,47477,47744,47747,47774,47777,74444,74447,74474,74477,74744,74747,74774,74777,77444,77447,77474,77477,77744,77747,77774,77777,444444,444447,444474,444477,444744,444747,444774,444777,447444,447447,447474,447477,447744,447747,447774,447777,474444,474447,474474,474477,474744,474747,474774,474777,477444,477447,477474,477477,477744,477747,477774,477777,744444,744447,744474,744477,744744,744747,744774,744777,747444,747447,747474,747477,747744,747747,747774,747777,774444,774447,774474,774477,774744,774747,774774,774777,777444,777447,777474,777477,777744,777747,777774,777777,4444444,4444447,4444474,4444477,4444744,4444747,4444774,4444777,4447444,4447447,4447474,4447477,4447744,4447747,4447774,4447777,4474444,4474447,4474474,4474477,4474744,4474747,4474774,4474777,4477444,4477447,4477474,4477477,4477744,4477747,4477774,4477777,4744444,4744447,4744474,4744477,4744744,4744747,4744774,4744777,4747444,4747447,4747474,4747477,4747744,4747747,4747774,4747777,4774444,4774447,4774474,4774477,4774744,4774747,4774774,4774777,4777444,4777447,4777474,4777477,4777744,4777747,4777774,4777777,7444444,7444447,7444474,7444477,7444744,7444747,7444774,7444777,7447444,7447447,7447474,7447477,7447744,7447747,7447774,7447777,7474444,7474447,7474474,7474477,7474744,7474747,7474774,7474777,7477444,7477447,7477474,7477477,7477744,7477747,7477774,7477777,7744444,7744447,7744474,7744477,7744744,7744747,7744774,7744777,7747444,7747447,7747474,7747477,7747744,7747747,7747774,7747777,7774444,7774447,7774474,7774477,7774744,7774747,7774774,7774777,7777444,7777447,7777474,7777477,7777744,7777747,7777774,7777777,44444444,44444447,44444474,44444477,44444744,44444747,44444774,44444777,44447444,44447447,44447474,44447477,44447744,44447747,44447774,44447777,44474444,44474447,44474474,44474477,44474744,44474747,44474774,44474777,44477444,44477447,44477474,44477477,44477744,44477747,44477774,44477777,44744444,44744447,44744474,44744477,44744744,44744747,44744774,44744777,44747444,44747447,44747474,44747477,44747744,44747747,44747774,44747777,44774444,44774447,44774474,44774477,44774744,44774747,44774774,44774777,44777444,44777447,44777474,44777477,44777744,44777747,44777774,44777777,47444444,47444447,47444474,47444477,47444744,47444747,47444774,47444777,47447444,47447447,47447474,47447477,47447744,47447747,47447774,47447777,47474444,47474447,47474474,47474477,47474744,47474747,47474774,47474777,47477444,47477447,47477474,47477477,47477744,47477747,47477774,47477777,47744444,47744447,47744474,47744477,47744744,47744747,47744774,47744777,47747444,47747447,47747474,47747477,47747744,47747747,47747774,47747777,47774444,47774447,47774474,47774477,47774744,47774747,47774774,47774777,47777444,47777447,47777474,47777477,47777744,47777747,47777774,47777777,74444444,74444447,74444474,74444477,74444744,74444747,74444774,74444777,74447444,74447447,74447474,74447477,74447744,74447747,74447774,74447777,74474444,74474447,74474474,74474477,74474744,74474747,74474774,74474777,74477444,74477447,74477474,74477477,74477744,74477747,74477774,74477777,74744444,74744447,74744474,74744477,74744744,74744747,74744774,74744777,74747444,74747447,74747474,74747477,74747744,74747747,74747774,74747777,74774444,74774447,74774474,74774477,74774744,74774747,74774774,74774777,74777444,74777447,74777474,74777477,74777744,74777747,74777774,74777777,77444444,77444447,77444474,77444477,77444744,77444747,77444774,77444777,77447444,77447447,77447474,77447477,77447744,77447747,77447774,77447777,77474444,77474447,77474474,77474477,77474744,77474747,77474774,77474777,77477444,77477447,77477474,77477477,77477744,77477747,77477774,77477777,77744444,77744447,77744474,77744477,77744744,77744747,77744774,77744777,77747444,77747447,77747474,77747477,77747744,77747747,77747774,77747777,77774444,77774447,77774474,77774477,77774744,77774747,77774774,77774777,77777444,77777447,77777474,77777477,77777744,77777747,77777774,77777777,444444444,444444447,444444474,444444477,444444744,444444747,444444774,444444777,444447444,444447447,444447474,444447477,444447744,444447747,444447774,444447777,444474444,444474447,444474474,444474477,444474744,444474747,444474774,444474777,444477444,444477447,444477474,444477477,444477744,444477747,444477774,444477777,444744444,444744447,444744474,444744477,444744744,444744747,444744774,444744777,444747444,444747447,444747474,444747477,444747744,444747747,444747774,444747777,444774444,444774447,444774474,444774477,444774744,444774747,444774774,444774777,444777444,444777447,444777474,444777477,444777744,444777747,444777774,444777777,447444444,447444447,447444474,447444477,447444744,447444747,447444774,447444777,447447444,447447447,447447474,447447477,447447744,447447747,447447774,447447777,447474444,447474447,447474474,447474477,447474744,447474747,447474774,447474777,447477444,447477447,447477474,447477477,447477744,447477747,447477774,447477777,447744444,447744447,447744474,447744477,447744744,447744747,447744774,447744777,447747444,447747447,447747474,447747477,447747744,447747747,447747774,447747777,447774444,447774447,447774474,447774477,447774744,447774747,447774774,447774777,447777444,447777447,447777474,447777477,447777744,447777747,447777774,447777777,474444444,474444447,474444474,474444477,474444744,474444747,474444774,474444777,474447444,474447447,474447474,474447477,474447744,474447747,474447774,474447777,474474444,474474447,474474474,474474477,474474744,474474747,474474774,474474777,474477444,474477447,474477474,474477477,474477744,474477747,474477774,474477777,474744444,474744447,474744474,474744477,474744744,474744747,474744774,474744777,474747444,474747447,474747474,474747477,474747744,474747747,474747774,474747777,474774444,474774447,474774474,474774477,474774744,474774747,474774774,474774777,474777444,474777447,474777474,474777477,474777744,474777747,474777774,474777777,477444444,477444447,477444474,477444477,477444744,477444747,477444774,477444777,477447444,477447447,477447474,477447477,477447744,477447747,477447774,477447777,477474444,477474447,477474474,477474477,477474744,477474747,477474774,477474777,477477444,477477447,477477474,477477477,477477744,477477747,477477774,477477777,477744444,477744447,477744474,477744477,477744744,477744747,477744774,477744777,477747444,477747447,477747474,477747477,477747744,477747747,477747774,477747777,477774444,477774447,477774474,477774477,477774744,477774747,477774774,477774777,477777444,477777447,477777474,477777477,477777744,477777747,477777774,477777777,744444444,744444447,744444474,744444477,744444744,744444747,744444774,744444777,744447444,744447447,744447474,744447477,744447744,744447747,744447774,744447777,744474444,744474447,744474474,744474477,744474744,744474747,744474774,744474777,744477444,744477447,744477474,744477477,744477744,744477747,744477774,744477777,744744444,744744447,744744474,744744477,744744744,744744747,744744774,744744777,744747444,744747447,744747474,744747477,744747744,744747747,744747774,744747777,744774444,744774447,744774474,744774477,744774744,744774747,744774774,744774777,744777444,744777447,744777474,744777477,744777744,744777747,744777774,744777777,747444444,747444447,747444474,747444477,747444744,747444747,747444774,747444777,747447444,747447447,747447474,747447477,747447744,747447747,747447774,747447777,747474444,747474447,747474474,747474477,747474744,747474747,747474774,747474777,747477444,747477447,747477474,747477477,747477744,747477747,747477774,747477777,747744444,747744447,747744474,747744477,747744744,747744747,747744774,747744777,747747444,747747447,747747474,747747477,747747744,747747747,747747774,747747777,747774444,747774447,747774474,747774477,747774744,747774747,747774774,747774777,747777444,747777447,747777474,747777477,747777744,747777747,747777774,747777777,774444444,774444447,774444474,774444477,774444744,774444747,774444774,774444777,774447444,774447447,774447474,774447477,774447744,774447747,774447774,774447777,774474444,774474447,774474474,774474477,774474744,774474747,774474774,774474777,774477444,774477447,774477474,774477477,774477744,774477747,774477774,774477777,774744444,774744447,774744474,774744477,774744744,774744747,774744774,774744777,774747444,774747447,774747474,774747477,774747744,774747747,774747774,774747777,774774444,774774447,774774474,774774477,774774744,774774747,774774774,774774777,774777444,774777447,774777474,774777477,774777744,774777747,774777774,774777777,777444444,777444447,777444474,777444477,777444744,777444747,777444774,777444777,777447444,777447447,777447474,777447477,777447744,777447747,777447774,777447777,777474444,777474447,777474474,777474477,777474744,777474747,777474774,777474777,777477444,777477447,777477474,777477477,777477744,777477747,777477774,777477777,777744444,777744447,777744474,777744477,777744744,777744747,777744774,777744777,777747444,777747447,777747474,777747477,777747744,777747747,777747774,777747777,777774444,777774447,777774474,777774477,777774744,777774747,777774774,777774777,777777444,777777447,777777474,777777477,777777744,777777747,777777774,777777777,4444444444,0};\n\n\nint main(void){\n __int64 i,x,y,sum,j;\n scanf(\"%I64d %I64d\",&x,&y);\n sum=0;\n for(j=0;k[j]!=0;j++){\n if(k[j]>=x)\n break;\n }\n for(i=x;i<=y;i++){\n if(k[j]>=y){\n sum=sum+k[j]*(y-i+1);\n break;\n }\n if(k[j]>=i){\n sum=sum+k[j]*(k[j]-i+1);\n i=k[j]+1;\n j++;\n }\n }\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}], "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd"} {"nl": {"description": "Allen has a LOT of money. He has $$$n$$$ dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are $$$1$$$, $$$5$$$, $$$10$$$, $$$20$$$, $$$100$$$. What is the minimum number of bills Allen could receive after withdrawing his entire balance?", "input_spec": "The first and only line of input contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^9$$$).", "output_spec": "Output the minimum number of bills that Allen could receive.", "sample_inputs": ["125", "43", "1000000000"], "sample_outputs": ["3", "5", "10000000"], "notes": "NoteIn the first sample case, Allen can withdraw this with a $$$100$$$ dollar bill, a $$$20$$$ dollar bill, and a $$$5$$$ dollar bill. There is no way for Allen to receive $$$125$$$ dollars in one or two bills.In the second sample case, Allen can withdraw two $$$20$$$ dollar bills and three $$$1$$$ dollar bills.In the third sample case, Allen can withdraw $$$100000000$$$ (ten million!) $$$100$$$ dollar bills."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <math.h>\n\n\n\nint main()\n{\n int i, x[]={100,20,10,5,1}, sum=0;\n long long int n, a;\n\n\n scanf(\"%lld\", &n);\n\n for(i=0; i<=4; i++)\n {\n a=n/x[i];\n sum+=a;\n n=n%x[i];\n }\n printf(\"%d\\n\", sum);\n\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n\nint main (){\n int n, sum, count = 0, i;\n\n scanf(\"%d\", &n);\n sum = n;\n for ( i = 0; i < n; i++ ){\n\n if (sum >= 100){\n sum = sum - 100;\n count++;\n if (sum == 0){\n\n printf(\"%d\", count);\n break;\n }\n continue;\n }\n\n if (sum >= 20 && sum < 100){\n sum = sum - 20;\n count++;\n if (sum == 0){\n\n printf(\"%d\", count);\n break;\n }\n continue;\n }\n\n if (sum >= 10 && sum < 20){\n sum = sum - 10;\n count++;\n if (sum == 0){\n\n printf(\"%d\", count);\n break;\n }\n continue;\n }\n\n if (sum >= 5 && sum < 10){\n sum = sum - 5;\n count++;\n if (sum == 0){\n\n printf(\"%d\", count);\n break;\n }\n continue;\n }\n\n if (sum >= 1 && sum < 5){\n sum = sum - 1;\n count++;\n if (sum == 0){\n printf(\"%d\", count);\n break;\n }\n continue;\n }\n }\n\n\n return(0);\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\n int n,H,T,T2,F2,Y,Total;\n scanf(\"%d\",&n);\n H=n/100;\n T=n%100/20;\n T2=n%100%20/10;\n F2=n%100%20%10/5;\n Y=n%100%20%10%5;\n Total=H+T+T2+F2+Y;\n printf(\"%d\\n\",Total);\n\n\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\nint main ()\n{\n int n,sum=0;\n int i,arr[5]={100,20,10,5,1};\n scanf(\"%d\",&n);\n for(i=0; i<5; i++)\n {\n sum+=n/arr[i];\n n=n%arr[i];\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int C[5]={1,5,10,20,100};\n int i=4,sum=0;\n while(n%C[i]!=0)\n {\n sum=sum+n/C[i];\n \n n=n%C[i];\n i--;\n }\n printf(\"%d\",sum+n/C[i]);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#define NUMBILLS sizeof(bills)/sizeof(bills[0])\n\nint main()\n{\n\tint n;\n\tint bills[] = {1, 5, 10, 20, 100};\n\tint curr = NUMBILLS - 1;\n\tint cpt = 0;\n\n\tscanf(\"%d\", &n);\n\n\twhile (n > 0) {\n\t\twhile (curr >= 0 && bills[curr] > n)\n\t\t\t--curr;\n\t\tcpt += n / bills[curr];\n\t\tn %= bills[curr];\n\t}\n\tprintf(\"%d\\n\", cpt);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a , count=0;\n\n scanf(\"%d\",&a);\n count=count+a/100;\n a=a%100;\n\n count=count+a/20;\n a=a%20;\n count=count+a/10;\n a=a%10;\n count=count+a/5;\n a=a%5;\n\n count=count+a;\n printf(\"%d\\n\",count);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main ()\n{\n int a,b,c,e,d,s,n ;\n scanf(\"%d\",&n);\n while (n>0) {\n a=n/100;\n n=n-a*100;\n b=n/20;\n n=n-b*20;\n c=n/10;\n n=n-c*10;\n d=n/5;\n n=n-d*5;\n e=n;\n n=n-e;\n\n\n }\ns=a+b+c+d+e;\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\nint n,i;\nscanf(\"%d\",&n);\n//printf(\"%d\\n\",n);\nint c = 0;\n\nc = c+n/100;\nn = n%100;\n\nc = c+n/20;\nn = n%20;\n\nc = c+n/10;\nn = n%10;\n\nc = c+n/5;\nn = n%5;\n\nc = c+n/1;\nn = n%1;\n\nprintf(\"%d\\n\",c);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,co,s=0,i=4;\n int c[5]={1,5,10,20,100};\n scanf(\"%d\",&a);\n while(a>0)\n {\n co=a/c[i];\n a=a%c[i];\n s=s+co;\n i--;\n }\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,c=0;\n scanf(\"%d\",&n);\n while(n>=0){\n if(n==0)\n break;\n if(n>=100){\n n-=100;\n c++;\n }\n else if (n>=20 && n<100){\n n-=20;\n c++;\n }\n else if (n>=10 && n<20){\n n-=10;\n c++;\n }\n else if (n>=5 && n<10){\n n-=5;\n c++;\n }\n else if (n>=1 && n<5){\n n-=1;\n c++;\n }\n \n }\n printf(\"%d\",c);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,b=0;\n scanf(\"%d\",&n);\n /*if(n==1||n==5||n==10||n==20||n==100){b=1;}*/\n if(n/100==0)\n {\n if(n/20==0)\n {\n if(n/10==0)\n {\n if(n/5==0){b=b+n;}\n else{b=n-4;}\n }\n else if(n/10!=0)\n {\n if(n%10>=5){b=n-13;}\n else{b=n-9;}\n }\n }\n else if(n/20!=0)\n {\n if(n%20==0){b=n/20;}\n else if(n%20<10){b=n/20+(n%20)/5+(n%20)%5;}\n else if(n%20>10){b=n/20+(n%20)/10+((n%20)%10)%5+((n%20)%10)/5;}\n else if(n%20==10){b=n/20+1;}\n }\n }\n else if(n/100!=0)\n {\n if(n%100<20)\n {\n if(n%100<10){b=n/100+(n%100)/5+(n%100)%5;}\n else if(n%100>10){b=n/100+(n%100)/10+((n%100)%10)%5+((n%100)%10)/5;}\n else if(n%100==10){b=n/100+1;}\n }\n else if(n%100>20){b=n/100+(n%100)/20+((n%100)%20)/10+(((n%100)%20)%10)/5+(((n%100)%20)%10)%5l;}\n else if(n%100==20){b=n/100+1;}\n else if(n%100==0){b=n/100;}\n }\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main() {\n\n\tint dinheiro, notas = 0;\n\tscanf(\"%d\", &dinheiro);\n\n\n\twhile(dinheiro>0){\n\t\n\n\t\tif (dinheiro >= 100){\n\t\t\tdinheiro = dinheiro - 100;\n\t\t\tnotas++;\n\t\t}\n\t\telse if (dinheiro < 100 && dinheiro >= 20){\n\t\t\tdinheiro = dinheiro - 20;\n\t\t\tnotas++;\n\t\t}\n\t\telse if (dinheiro < 20 && dinheiro >= 10){\n\t\t\tdinheiro = dinheiro - 10;\n\t\t\tnotas++;\n\t\t}\n\t\telse if (dinheiro < 10 && dinheiro >= 5){\n\t\t\tdinheiro = dinheiro - 5;\n\t\t\tnotas++;\n\t\t}\n\t\telse if(dinheiro < 5){\n\t\t\tdinheiro = dinheiro - 1;\n\t\t\tnotas++;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", notas);\n\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int c=0,i,t,n,d;\n scanf(\"%d\",&n);\n if(n>=100){\n c=c+(n/100);\n n=n%100;\n }if(n>=20){\n c=c+(n/20);\n n=n%20;\n } if(n>=10){\n c=c+(n/10);\n n=n%10;\n } if(n>=5){\n c=c+(n/5);\nn=n%5;\n }\n c=c+n;\n\n printf(\"%d\",c);\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x[10],sum=0;\n scanf(\"%d\",&n);\n x[0]=n/100;\n x[1]=n%100;\n x[2]=x[1]/20;\n x[3]=x[1]%20;\n x[4]=x[3]/10;\n x[5]=x[3]%10;\n x[6]=x[5]/5;\n x[7]=x[5]%5;\n x[8]=x[7]/1;\n x[9]=x[7]%1;\n sum=x[0]+x[2]+x[4]+x[6]+x[8];\n printf(\"%d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,a,b,c,d,e,h,i,j,k,l;\n scanf(\"%d\",&x);\n a=x/100;\n h=x%100;\n b=h/20;\n i=h%20;\n c=i/10;\n j=i%10;\n d=j/5;\n k=j%5;\n e=k/1;\n // printf(\"a=%d...b=%d....c=%d...d=%d...e=%d...\\n\",a,b,c,d,e);\n //printf(\"h=%d...i=%d....j=%d...k=%d...\\n\",h,i,j,k);\n\n printf(\"%d\",a+b+c+d+e);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,cnt=0;\n scanf(\"%lld\",&n);\n if(n>=100){\n cnt=n/100;\n n=n%100;\n }\n if(n>=20){\n cnt+=n/20;\n n=n%20;\n }\n if(n>=10){\n cnt+=n/10;\n n=n%10;\n }\n if(n>=5){\n cnt+=n/5;\n n=n%5;\n }\n if(n>=1){\n cnt+=n/1;\n }\n printf(\"%lld\\n\",cnt);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a=0,n;\n\tscanf(\"%d\",&n);\n\twhile(n!=0)\n{\n\t\n\tif(n>=100)\n\t{\n\t\ta+=n/100;\n\t\tn=n%100;\n\t\t\n\t}\n\telse if((n>=20)&&(n<=100))\n\t{\n\t\ta+=n/20;\n\t\tn=n%20;\n\t}\n\telse if((n>=10)&&(n<=20))\n\t{\n\t\ta+=n/10;\n\t\tn=n%10;\n\t}\n\telse if((n>=5)&&(n<=10))\n\t{\n\t\ta+=n/5;\n\t\tn=n%5;\n\t}\n\t\n\telse\n\t{\n\t\ta+=n;\n\t\tn=n-n;\n\t}\n}\nprintf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n; //amount of money\n int bill[5]= {100,20,10,5,1}; //dollar bills\n int minbill=0; // minimum number of bills\n\n scanf(\"%d\", &n);\n\n for(int i=0; i<5; i++)\n {\n while(n>=bill[i])\n {\n n=n-bill[i];\n minbill++;\n }\n\n\n }\n printf(\"%d\", minbill);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n;\n scanf(\"%lld\", &n);\n int c=0;\n if (n>=100){\n c=n/100;\n n=n-(n/100)*100;}\n if(n>=20){\n c=c+n/20;\n n=n-(n/20)*20;}\n if(n>=10){\n c=c+n/10;\n n=n-(n/10)*10;}\n if(n>=5){\n c=c+n/5;\n n=n-(n/5)*5;}\n if(n>=1){\n c=c+n/1;\n n=n-(n/1)*1;}\n printf(\"%d\", c);\n return 0;}"}, {"source_code": "#include <stdio.h>\n\n\nint main(void)\n{\n\tlong long n;\n\tint x = 0;\n\tscanf(\"%lld\", &n);\n\tif (n >= 100)\n\t{\n\t\tx = (n / 100);\n\t\tn = n % 100;\n\t}\n\tif (n >= 20)\n\t{\n\t\tx += (n / 20);\n\t\tn = n % 20;\n\t}\n\tif (n >= 10)\n\t{\n\t\tx += (n / 10);\n\t\tn = n % 10;\n\t}\n\tif (n >= 5)\n\t{\n\t\tx += (n / 5);\n\t\tn = n % 5;\n\t}\n\tif (n >= 1)\n\t\tx += n;\n\tprintf(\"%d\", x);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void* a,const void* b)\n{\n return *((int*)b)-*((int*)a);\n}\nint main()\n{\n int val;\n scanf(\"%d\",&val);\n int a[5];\n a[0]=1;\n a[1]=5;\n a[2]=10;\n a[3]=20;\n a[4]=100;\n int i=4,c=0;\n while(i>=0)\n {\n if(val>0&&a[i]<=val)\n {\n c+=val/a[i];\n val=val%a[i];\n }\n if(a[i]>val)\n i--;\n if(val<=0)\n break;\n }\n printf(\"%d\",c);\n \n \n}"}, {"source_code": "//Bismillah\n#include<stdio.h>\nint main()\n{\n int n,i,j,k,r,s,l,m,o,p,q;\n scanf(\"%d\",&n);\n i=n/100;\n j=n%100;\n if(j==0){\n printf(\"%d\\n\",i);\n return 0;\n }\n else{\n k=j/20;\n l=j%20;\n }\n if(l==0){\n printf(\"%d\\n\",i+k);\n return 0;\n }\n else{\n m=l/10;\n o=l%10;\n }\n\n if(o==0){\n printf(\"%d\\n\",i+k+m);\n return 0;\n }\n else{\n p=o/5;\n q=o%5;\n }\n if(q==0){\n printf(\"%d\\n\",i+k+m+p);\n return 0;\n }\n else{\n r=q/1;\n printf(\"%d\\n\",i+k+m+p+r);\n return 0;\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nint n;\nscanf(\"%d\",&n);\nint count = 0;\nwhile(n > 0) {\n if(n / 100 > 0) {\n count += n / 100;\n n = n % 100; \n }\n else if(n / 20 > 0) {\n count += n / 20;\n n = n % 20; \n }\n else if(n / 10 > 0) {\n count += n / 10;\n n = n % 10; \n }\n else if(n / 5 > 0) {\n count += n / 5;\n n = n % 5; \n }\n else if(n / 1 > 0) {\n count += n / 1;\n n = n % 1; \n }\n}\nprintf(\"%d\",count);\n return 0; \n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int count = 0;\n while ( n > 0 )\n {\n if ( ( n - 100 ) >= 0 )\n {\n //printf(\"Subtracting 100 from %d\\n\", n);\n n -= 100;\n //printf(\"Result = %d\\n\", n);\n count++;\n continue;\n }\n else if ( ( n - 20 ) >= 0 )\n {\n //printf(\"Subtracting 20 from %d\\n\", n);\n n -= 20;\n //printf(\"Result = %d\\n\", n);\n count++;\n continue;\n }\n else if ( ( n - 10 ) >= 0 )\n {\n //printf(\"Subtracting 10 from %d\\n\", n);\n n -= 10;\n //printf(\"Result = %d\\n\", n);\n count++;\n continue;\n }\n else if ( ( n - 5 ) >= 0 )\n {\n //printf(\"Subtracting 5 from %d\\n\", n);\n n -= 5;\n //printf(\"Result = %d\\n\", n);\n count++;\n continue;\n }\n else if ( ( n - 1 ) >= 0 )\n {\n //printf(\"Subtracting 1 from %d\\n\", n);\n n -= 1;\n //printf(\"Result = %d\\n\", n);\n count++;\n continue;\n }\n }\n printf(\"%d\", count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tint i;\n\tint bills[] = { 100, 20, 10, 5, 1 };\n\tint bill;\n\tint ans = 0;\n\tfor (i = 0; i < 5; ++i) {\n\t\tbill = bills[i];\n\t\tif (n < bill) {\n\t\t\tcontinue;\n\t\t}\n\t\tans += n / bill;\n\t\tn = n % bill;\n\t\tif (n == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, c=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(n>=100){\n n=n-100;\n c++;\n }\n if(n<100&&n>=20){\n n=n-20;\n c++;\n }\n if(n<20&&n>=10){\n n=n-10;\n c++;\n }\n if(n<10 && n>=5){\n n=n-5;\n c++;\n }\n if(n<5&& n>=1){\n n=n-1;\n c++;\n }\n}\nprintf(\"%d\",c);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n; //amount of money\n int bill[5]= {100,20,10,5,1}; //dollar bills\n int minbill=0; // minimum number of bills\n\n scanf(\"%d\", &n);\n\n for(int i=0; i<5; i++)\n {\n while(n>=bill[i])\n {\n n=n-bill[i];\n minbill++;\n }\n\n\n }\n printf(\"%d\", minbill);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,c=0;\n int a[5]={1,5,10,20,100};\n scanf(\"%lld\",&n);\n int i=4;\n while(n>0&&i>=0)\n {\n c+=n/a[i];\n n=n%a[i];\n i--;\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint n,t,count=0;\n\tscanf(\"%d\",&n);\n\tif(n!=0)\n\t{\n\tt = n/100;\n\tcount += t;\n\tn = n%100;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/20;\n\tcount += t;\n\tn = n%20;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/10;\n\tcount += t;\n\tn = n%10;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/5;\n\tcount += t;\n\tn = n%5;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/1;\n\tcount += t;\n\tn = n%1;\n\t}\n\tprintf(\"%d\",count);\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long int a,n1,n2,n3,n4,n5,n6,n7;\n scanf(\"%ld\",&a);\n\n\n n1=a/100;\n a=a%100;\n\n n3=a/20;\n a=a%20;\n n4=a/10;\n a=a%10;\n n5=a/5;\n a=a%5;\n\n n7=a/1;\n a=a%1;\n\n printf(\"%ld\\n\",(n7+n1+n3+n4+n5));\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n\n\nint main()\n{\n int i, x[]={100,20,10,5,1}, sum=0;\n long long int n, a;\n\n\n scanf(\"%lld\", &n);\n\n for(i=0; i<=4; i++)\n {\n a=n/x[i];\n sum+=a;\n n=n%x[i];\n }\n printf(\"%d\\n\", sum);\n\n\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n int bills[5]={100,20,10,5,1};\n int min=0;\n scanf(\"%d\",&n);\n for(int i = 0 ;i<5;i++)\n {\n while(n>=bills[i])\n {\n n-=bills[i];\n min++;\n }\n }\n printf(\"%d\",min);\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,count = 0;\n scanf(\"%d\",&i);\n\n while( i != 0){\n if(i / 100 != 0){\n count += i / 100;\n i = i % 100;\n }else if(i / 20 != 0){\n count += i / 20;\n i = i % 20;\n }else if(i / 10 != 0){\n count += i / 10;\n i = i % 10;\n\n }else if(i / 5 != 0){\n count += i / 5;\n i = i % 5;\n\n }else if(i / 1 != 0){\n count += i / 1;\n i = i % 1;\n }\n }\n\n printf(\"%d\\n\",count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,count = 0;\n scanf(\"%ld\",&n);\n while(n)\n {\n if(n >= 100)\n {\n n = n - 100;\n count++;\n }\n else if(n >= 20)\n {\n n = n - 20;\n count++;\n }\n else if(n >= 10)\n {\n n = n - 10;\n count++;\n }\n else if(n >= 5)\n {\n n -= 5;\n count++;\n }\n else if(n >= 1)\n {\n n -= 1;\n count++;\n }\n }\n printf(\"%ld\\n\",count);\n return 0;\n}\n\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,res=0,k;\n\tscanf(\"%d\",&n);\n\tk=n/100;\n\tn=n%100;\n\tres+=k;\n\tk=n/20;\n\tn=n%20;\n\tres+=k;\n\tk=n/10;\n\tn=n%10;\n\tres+=k;\n\tk=n/5;\n\tn=n%5;\n\tres+=k;\n\tk=n/1;\n\tres+=k;\n\tprintf(\"%d\",res);\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long unsigned int llu;\n\nint main() {\n llu n, m, count = 0, i;\n llu r[] = {100, 20, 10, 5, 1};\n\n scanf(\"%I64u\", &n);\n m = n;\n\n for (i = 0; i < 5; i++) {\n if (m == 0) {\n break;\n }\n\n llu div = m / r[i];\n if (div >= 1) {\n m = m - div * r[i];\n count += div;\n }\n }\n\n printf(\"%I64u\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,n,a,b,c,d,e,sum,j;a=b=c=d=e=0;\n\tint t[1000];\n\t\tsum=0,j=0;\n\t\t\tscanf(\"%d\",&t[i]);\n\t\t\t{\n\t\t\ta=t[i]/100;\n\t\t\tb=t[i]%100/20;\n\t\t\tc=t[i]%100%20/10;\n\t\t\td=t[i]%100%20%10/5;\n\t\t\te=t[i]%100%20%10%5;\n\t\t\t}\n\t\t\tsum=a+b+c+d+e;\n\t\t\tj=j+sum;\n\tprintf(\"%d\\n\",j);\n}\n\t\t"}, {"source_code": "#include <stdio.h>\n\nint calDen(int n);\n\nint main() {\n int n;\n scanf(\"%d\",&n);\n \n printf(\"%d\\n\",calDen(n));\n \n return 0;\n}\n\nint calDen(int n) {\n if(n>99) {\n return n/100 + calDen(n%100);\n }\n else if(n > 19) {\n return n/20 + calDen(n%20);\n }\n else if(n > 9) {\n return n/10 + calDen(n%10);\n }\n else if(n > 4) {\n return n/5 + calDen(n%5);\n }\n else {\n return n;\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n\tint n,t,count=0;\n\tscanf(\"%d\",&n);\n\tif(n!=0)\n\t{\n\tt = n/100;\n\tcount += t;\n\tn = n%100;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/20;\n\tcount += t;\n\tn = n%20;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/10;\n\tcount += t;\n\tn = n%10;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/5;\n\tcount += t;\n\tn = n%5;\n\t}\n\tif(n!=0)\n\t{\n\tt = n/1;\n\tcount += t;\n\tn = n%1;\n\t}\n\tprintf(\"%d\",count);\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,i,d100,d50,d20,d10,d5,d1;\n scanf(\"%lld\", &n);\n m=n;\n d100 = m/100;\n m=m%100;\n d20 = m/20;\n m=m%20;\n d10 = m/10;\n m=m%10;\n d5 = m/5;\n m=m%5;\n d1 = m/1;\n m=m%1;\n printf(\"%lld\",d100+d20+d10+d5+d1);\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",n/100+(n%100)/20+(n%20)/10+(n%10)/5+(n%5)/1);\n \n}"}, {"source_code": "//\n// Created by botayhard on 07.02.19.\n//\n\n#include<stdio.h>\n\nint main(){\n long n,s=0;\n scanf(\"%ld\", &n);\n while(n>=100){\n s+=1;\n n-=100;\n }\n while(n>=20){\n s+=1;\n n-=20;\n }\n while(n>=10){\n s+=1;\n n-=10;\n }\n while(n>=5){\n s+=1;\n n-=5;\n }\n while(n>=1){\n s+=1;\n n-=1;\n }\n printf(\"%ld\", s);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint inVar, count = 0;\n\tscanf(\"%d\", &inVar);\n\n\twhile (inVar >= 100) {\n\n\t\tinVar -= 100;\n\t\tcount++;\n\t}\n\n\twhile (inVar >= 20) {\n\n\t\tinVar -= 20;\n\t\tcount++;\n\t}\n\n\twhile (inVar >= 10) {\n\n\t\tinVar -= 10;\n\t\tcount++;\n\t}\n\n\twhile (inVar >= 5) {\n\n\t\tinVar -= 5;\n\t\tcount++;\n\t\t}\n\n\twhile (inVar >= 1) {\n\n\t\tinVar -= 1;\n\t\tcount++;\n\t}\n\tprintf(\"%d\", count);\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,r;\n scanf(\"%d\",&n);\n r=n/100;\n n=n%100;\n r=r+n/20;\n n=n%20;\n r=r+n/10;\n n=n%10;\n r=r+n/5;\n n=n%5;\n r=r+n;\n printf(\"%d\",r);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long n,c=0;\n scanf(\"%ld\",&n);\n \n if(n>=100)\n {\n c+=n/100;\n n=n%100;\n }\n if(n>=20)\n {\n c+=n/20;\n n=n%20;\n }\n if(n>=10)\n {\n c+=n/10;\n n=n%10;\n }\n if(n>=5)\n {\n c+=n/5;\n n%=5;\n }\n \n if(n>=1)\n {\n c+=n/1;\n n%=1;\n }\n \n printf(\"%ld\",c);\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <time.h>\n\nunsigned long long int lottery(unsigned long long int x)\n{\n\tunsigned long long int sum = 0;\n\n\tsum += (x/100);\n\n\tx %= 100;\n\n\tsum += (x/20);\n\n\tx %= 20;\n\n\tsum += (x/10);\n\n\tx %= 10;\n\n\tsum += (x/5);\n\n\tx %= 5;\n\n\tsum += (x/1);\n\n\tx %= 1;\n\n\treturn sum;\n\n}\n\nint main(void)\n{\n\tdouble elapsed = 0;\n\n\tclock_t begin = clock();\n\n\tunsigned char c = 0;\n\n\tunsigned long long int x = 0;\n\n\tunsigned long long int i = 0;\n\n\twhile \t(\n\t\t\t( i < 20 )\n\t\n\t\t\t&&\n\n\t\t\t(\n\t\t\t\t(c = fgetc(stdin) ) != EOF\n\t\t\t)\n\n\t\t\t&&\n\n\t\t\t( c >= '0')\n\n\t\t\t&&\n\n\t\t\t(c <= '9')\n\t\t)\n\t{\n\t\tx *= 10;\n\n\t\tx += (c-'0');\n\n\t\ti++;\n\t}\n\n\tprintf(\"%llu\\n\",lottery(x));\n\n\tclock_t end = clock();\n\n\tfprintf(stderr,\"Time elapsed: %.6f\\n\",(end-begin) / ((double)(CLOCKS_PER_SEC)));\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\nunsigned long long int lottery(unsigned long long int x)\n{\n\tunsigned long long int sum = 0;\n\n\tsum += (x/100);\n\n\tx %= 100;\n\n\tsum += (x/20);\n\n\tx %= 20;\n\n\tsum += (x/10);\n\n\tx %= 10;\n\n\tsum += (x/5);\n\n\tx %= 5;\n\n\tsum += (x/1);\n\n\tx %= 1;\n\n\treturn sum;\n\n}\n\nint main(void)\n{\n\tdouble elapsed = 0;\n\n\tclock_t begin = clock();\n\n\tunsigned char c = 0;\n\n\tunsigned long long int x = 0;\n\t\n\tunsigned long long int prev = 0;\n\n\tunsigned long long int i = 0;\n\n\twhile \t(\n\n\t\t\t(\n\t\t\t\t(c = fgetc(stdin) ) != EOF\n\t\t\t)\n\n\t\t\t&&\n\n\t\t\t( c >= '0')\n\n\t\t\t&&\n\n\t\t\t(c <= '9')\n\t\t)\n\t{\n\t\tprev = x;\n\n\t\tx *= 10;\n\n\t\tx += (c-'0');\n\n\t\tif ( x < prev )\n\t\t{\n\t\t\tfprintf(stderr,\"Error: Integer Overflow Vulnerability detected\\n\");\n\n\t\t\texit(1);\n\t\t}\n\t\t\n\t\ti++;\n\t}\n\n\tif ( (c != 0xff) && (c != 0xa) )\n\t{\n\t\tfprintf(stderr,\"Error: Improper formatting of standard input detected\\n\");\n\n\t\texit(1);\n\t}\n\n\tprintf(\"%llu\\n\",lottery(x));\n\n\tclock_t end = clock();\n\n\tfprintf(stderr,\"Time elapsed: %.6f\\n\",(double)(end-begin) / ((double)(CLOCKS_PER_SEC)));\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,c=0;\n scanf(\"%d\",&n)!=EOF;\n while(n!=0)\n {\n if(n>=100)\n {\n n=n-100;\n c++;\n }\n else if(n>=20)\n {\n n=n-20;\n c++;\n }\n else if(n>=10)\n {\n n=n-10;\n c++;\n }\n else if(n>=5)\n {\n n=n-5;\n c++;\n }\n else if(n>=1)\n {\n n=n-1;\n c++;\n }\n }\n printf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n\n\n\n\nint main()\n{\n\t//.....100,20,10,5,1................\n\tint a, b, c, d, e ,n,temp;\n\tscanf(\"%d\",&n);\n\ta = n / 100;\n\ttemp = n % 100;\n\tb = temp / 20;\n\ttemp = temp % 20;\n\tc = temp / 10;\n\ttemp = temp % 10;\n\td = temp / 5;\n\ttemp = temp % 5;\n\te = temp / 1;\n\ttemp = temp % 1;\n\n\tprintf(\"%d\",a+b+c+d+e);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int checkn,checknn,a,b,c,hund=0,tw,ten=0,five=0,one=0;\n scanf(\"%d\",&a);\n /****************/\n hund=a/100;\n /****************/\n checkn=(a%100)/10;\n if (checkn%2==0)\n {\n tw=checkn/2;\n ten=0;\n }\n else if (checkn%2!=0)\n {\n tw=(checkn-1)/2;\n ten=1;\n }\n /*****************/\n checknn=a%10;\n if (checknn%5==0)\n five=checknn/5;\n else if(checknn%5!=0)\n { if(checknn<5)\n {\n five=0;\n one=checknn;\n }\n else if(checknn>5)\n {\n five=1;\n one=checknn-5;\n }\n }\n /*****************/\n printf(\"%d\",hund+tw+ten+five+one);\n}\n"}, {"source_code": "#include <stdio.h>\nint main () {\n int n, k = 0;\n int bills[] = {100, 20, 10, 5, 1};\n\n scanf(\"%d\", &n);\n\n while(n > 0) {\n for (int i = 0; i < 5; i++) {\n if (n >= bills[i]) {\n n -= bills[i];\n k++;\n break;\n }\n }\n }\n\n printf(\"%d\", k);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count=n/100;\n n=n%100;\n count+=n/20;\n n=n%20;\n count+=n/10;\n n=n%10;\n count+=n/5;\n n=n%5;\n count+=n;\n printf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int checkn,checknn,a,b,c,hund=0,tw,ten=0,five=0,one=0;\n scanf(\"%d\",&a);\n /****************/\n hund=a/100;\n /****************/\n checkn=(a%100)/10;\n if (checkn%2==0)\n {\n tw=checkn/2;\n ten=0;\n }\n else if (checkn%2!=0)\n {\n tw=(checkn-1)/2;\n ten=1;\n }\n /*****************/\n checknn=a%10;\n if (checknn%5==0)\n five=checknn/5;\n else if(checknn%5!=0)\n { if(checknn<5)\n {\n five=0;\n one=checknn;\n }\n else if(checknn>5)\n {\n five=1;\n one=checknn-5;\n }\n }\n /*****************/\n printf(\"%d\",hund+tw+ten+five+one);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tint i;\n\tint bills[] = { 100, 20, 10, 5, 1 };\n\tint bill;\n\tint ans = 0;\n\tfor (i = 0; i < 5; ++i) {\n\t\tbill = bills[i];\n\t\tif (n < bill) {\n\t\t\tcontinue;\n\t\t}\n\t\tans += n / bill;\n\t\tn = n % bill;\n\t\tif (n == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, q, r, k = 0, s, s1, s2, s3, s4;\n scanf(\"%lld\",&n);\n\n q = n / 100;\n r = n % 100;\n s = k + q;\n//printf(\"%lld\\n\",s);\n q = r / 20;\n r = r % 20;\n s1 = s + q;\n//printf(\"%lld\\n\",s1);\n q = r / 10;\n r = r % 10;\n s2 = s1 + q;\n//printf(\"%lld\\n\",s2);\n q = r / 5;\n r = r % 5;\n s3 = s2 + q;\n//printf(\"%lld\\n\",s3);\n q = r / 1;\n r = r % 1;\n s4 = s3 + q;\n\n printf(\"%lld\\n\",s4);\n\n return 0;\n}\n"}, {"source_code": "/*bai 48 996A */\n\n#include<stdio.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint cnt=0;\n\tif(n>=100){\n\t\tint x=n/100;\n\t\tcnt+=x;\n\t\tn=n-(x*100);\n\t}\n\tif(n>=20){\n\t\tint x=n/20;\n\t\tcnt+=x;\n\t\tn=n-(x*20);\n\t}\n\tif(n>=10){\n\t\tint x=n/10;\n\t\tcnt+=x;\n\t\tn=n-(x*10);\n\t}\n\tif(n>=5){\n\t\tint x=n/5;\n\t\tcnt+=x;\n\t\tn=n-(x*5);\n\t}\n\tprintf(\"%d\",cnt+n);\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef long long unsigned int llu;\n\nint main() {\n llu n, m, count = 0, i;\n llu r[] = {100, 20, 10, 5, 1};\n\n scanf(\"%I64u\", &n);\n m = n;\n\n for (i = 0; i < 5; i++) {\n if (m == 0) {\n break;\n }\n\n llu div = m / r[i];\n if (div >= 1) {\n m = m - div * r[i];\n count += div;\n }\n }\n\n printf(\"%I64u\\n\", count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint bill;\n\tint bills, quot, rem;\n\tbills=0;\n\n\tscanf(\"%d\", &bill);\n\n\tquot=bill/100;\n\tbills+=quot;\n\n\trem=bill%100;\n\tbill=rem;\n\n\tquot=bill/20;\n\tbills+=quot;\n\n\trem=bill%20;\n\tbill=rem;\n\n\tquot=bill/10;\n\tbills+=quot;\n\n\trem=bill%10;\n\tbill=rem;\n\n quot=bill/5;\n\tbills+=quot;\n\n\trem=bill%5;\n\tbill=rem;\n\n\tbills+=rem;\n printf(\"%d\\n\",bills);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b,c,d,e,f;\n\tscanf(\"%d\", &a);\n\tb=a/100;//\n\tc=(a-b*100)/20;\n\td=(a - b*100 -c*20)/10;\n\te=(a - b*100 - c*20 -d*10)/5;\n\tf=(a - b*100 - c*20 - d*10 - e*5)/1;\n\tprintf(\"%d\",b+c+d+e+f );\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;scanf(\"%ld\",&n);\n long int rem=-1;long int count=0,nw;\n while(rem!=0)\n {\n if(n>=100)\n {\n rem=n%100;\n count=count+n/100;\n n=rem;\n }\n else if(n>=20 && n<100)\n {\n rem=n%20;\n count=count+n/20;\n n=rem;\n }\n else if(n>=10 && n<20)\n {\n rem=n%10;\n count=count+(n/10);\n n=rem;\n }\n else if(n>=5 && n<10)\n {\n rem=n%5;\n count=count+n/5;\n n=rem;\n }\n else\n {\n rem=n%1;\n count=count+(n/1);\n n=rem;\n }\n }\n printf(\"%ld\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n\nint main()\n{\n int n;\n int i100,i20,i10,i5,i1;\n \n \n i100 = i20 = i10 = i5 = i1 = 0;\n //int count=0;\n\n\n \n \n scanf(\"%d\", &n);\nif(n>=1&&n<=pow(10,9))\n\n{\n\n \n if(n >= i100)\n {\n i100 = n/100;\n n -= i100 * 100;\n }\n \n if(n >= 20)\n {\n i20 = n/20;\n n -= i20 * 20;\n \n }\n \n if(n >= 10)\n {\n i10 = n/10;\n n -= i10 * 10;\n }\n if(n >= 5)\n {\n i5 = n/5;\n n -= i5 * 5;\n }\n \n if(n >= 1)\n {\n i1 = n/1;\n n -= i1 * 1;\n }\n \n}\n int count=i1+i5+i10+i20+i100;\n\n \n // printf(\"%d\",&count);\n printf(\"%d\",count);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(void)\n{\n\tlong long n;\n\tint x = 0;\n\tscanf(\"%lld\", &n);\n\tif (n >= 100)\n\t{\n\t\tx = (n / 100);\n\t\tn = n % 100;\n\t}\n\tif (n >= 20)\n\t{\n\t\tx += (n / 20);\n\t\tn = n % 20;\n\t}\n\tif (n >= 10)\n\t{\n\t\tx += (n / 10);\n\t\tn = n % 10;\n\t}\n\tif (n >= 5)\n\t{\n\t\tx += (n / 5);\n\t\tn = n % 5;\n\t}\n\tif (n >= 1)\n\t\tx += n;\n\tprintf(\"%d\", x);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main () {\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\", n / 100 + (n % 100) / 20 + ((n % 100) % 20) / 10 + (((n % 100) % 20) % 10) / 5 + (((n % 100) % 20) % 10) % 5);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,n;\n\tscanf(\"%d\",&n);\n\tint s=0;\n\tint k=0;\n\tk=n/100,s=s+k,n=n%100,k=n/20,s=s+k;\n\tn=n%20,k=n/10,s=s+k,n=n%10,k=n/5;\n\ts=s+k,n=n%5,s=s+n;\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main (){\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\t\tint a=n/100;\n\t\tint b=(n-100*a)/20;\n\t\tint c=(n-100*a-20*b)/10;\n\t\tint d=(n-100*a-20*b-10*c)/5;\n\t\tint e=n-100*a-20*b-10*c-5*d;\n\t\tint hoadon=a+b+c+d+e;\n\t\tprintf(\"%d\",hoadon);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n// Recursive Solution\nint Bills(int n, int arr[], int size) {\n\tif(n == 0) {\n\t\treturn 0;\n\t}\n\tif(size == 1) {\n\t\treturn n;\n\t}\n\tif(arr[size-1] > n) {\n\t\treturn Bills(n,arr,size-1);\n\t}\n\treturn n / (arr[size-1]) + Bills(n%(arr[size-1]), arr, size-1);\n}\n\n// DP Solution\nint BillsDP(int n, int arr[], int size) {\n\tint dp[size+1][n+1];\n\tmemset(dp,0,sizeof(dp));\n\tfor(int i = 1; i<n+1;i++) {\n\t\tdp[1][i] = i;\n\t}\n\tfor(int i = 2; i < size+1; i++) {\n\t\tfor(int j = 1; j < n+1; j++) {\n\t\t\tif(arr[i-1] > j) dp[i][j] = dp[i-1][j];\n\t\t\telse {\n\t\t\t\tdp[i][j] = j/arr[i-1] + dp[i-1][j%arr[i-1]];\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[size][n];\n}\n\n\n// Greedy Solution\nint BillsGreedy(int n, int arr[], int size) {\n\tint bills = 0;\n\twhile(n > 0) {\n\t\tif(n >= arr[size-1]) {\n\t\t\tbills += n / arr[size-1];\n\t\t\tn %= arr[size-1];\n\t\t}\n\t\tsize--;\n\t}\n\treturn bills;\n}\n\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint arr[] = {1,5,10,20,100};\n\tint size = sizeof(arr)/sizeof(arr[0]);\n\tint totalBills = BillsGreedy(n,arr,size);\n\tprintf(\"%d\\n\", totalBills);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",n/100+(n%100)/20+(n%20)/10+(n%10)/5+(n%5)/1);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,a,b,c,d,e,h,i,j,k,l;\n scanf(\"%d\",&x);\n a=x/100;\n h=x%100;\n b=h/20;\n i=h%20;\n c=i/10;\n j=i%10;\n d=j/5;\n k=j%5;\n e=k/1;\n // printf(\"a=%d...b=%d....c=%d...d=%d...e=%d...\\n\",a,b,c,d,e);\n //printf(\"h=%d...i=%d....j=%d...k=%d...\\n\",h,i,j,k);\n\n printf(\"%d\",a+b+c+d+e);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, mod, i, div = 0;\n scanf(\"%lld\", &n);\n if(n >= 100)\n {\n div += n/100;\n n = n % 100;\n\n }\n if(n >=20)\n {\n div += n/20;\n n = n % 20;\n\n }\n if(n >=10)\n {\n div += n/10;\n n = n % 10;\n\n }\n if(n >= 5)\n {\n div += n/5;\n n = n % 5;\n\n }\n if(n >= 1)\n {\n div += n;\n }\n printf(\"%lld\", div);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n;\n int number=0;\n scanf(\"%d\",&m);\n if(m>=100)\n {\n n=m/100;\n number=number+n;\n m-=n*100;\n }\n if(m>=20)\n {\n int n=m/20;\n number=number+n;\n m=m-n*20;\n \n }\n if(m>=10)\n {\n int n=m/10;\n number=number+n;\n m=m-n*10;\n }\n if(m>=5)\n {\n int n=m/5;\n number=number+n;\n m=m-n*5;\n }\n number=number+m;\n printf(\"%d\\n\",number);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long int n,c=0;\n int a[5]={1,5,10,20,100};\n scanf(\"%lld\",&n);\n int i=4;\n while(n>0&&i>=0)\n {\n c+=n/a[i];\n n=n%a[i];\n i--;\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "/*bai 48 996A */\n\n#include<stdio.h>\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint cnt=0;\n\tif(n>=100){\n\t\tint x=n/100;\n\t\tcnt+=x;\n\t\tn=n-(x*100);\n\t}\n\tif(n>=20){\n\t\tint x=n/20;\n\t\tcnt+=x;\n\t\tn=n-(x*20);\n\t}\n\tif(n>=10){\n\t\tint x=n/10;\n\t\tcnt+=x;\n\t\tn=n-(x*10);\n\t}\n\tif(n>=5){\n\t\tint x=n/5;\n\t\tcnt+=x;\n\t\tn=n-(x*5);\n\t}\n\tprintf(\"%d\",cnt+n);\n}"}, {"source_code": "#include<stdio.h>\nint main (){\n\tint a;\n\t\n\twhile(~scanf(\"%d\",&a)){\n\t int i=0;\t\n\t\t while(a/100!=0){\n\t\t\ti++;\n\t\t\ta=a-100;\n\t\t } \n\t\t\twhile(a/20!=0){\n\t\t\ti++;\n\t\t\ta=a-20; \n\t\t } \t\t\t\t\t\t\t\t\n\t\t\twhile(a/10!=0){\n\t\t\ti++;\n\t\t\ta=a-10;\n\t\t\t} \n\t\t\twhile(a/5!=0){\n\t\t\ti++;\n\t\t\ta=a-5;\n\t\t }\n\t\t\tprintf(\"%d\\n\",a+i)\t;\t \n\t\t \n }\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n unsigned long n,a,b,c,d,e,f,g,h;\n scanf(\"%lu\",&n);\n a=n/100;\n b=n%100;\n c=b/20;\n d=b%20;\n e=d/10;\n f=d%10;\n g=f/5;\n h=f%5;\n printf(\"%lu\",a+c+e+g+h);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#pragma warning(disable: 4996)\nint main()\n{\n\tint x;\n\tint count = 0;\n\t\n\tscanf(\"%d\", &x);\n\n\t\tif (x >= 100)\n\t\t{\n\t\t\tcount = x / 100;\n\t\t\tx = x % 100;\n\t\t}\n\t\tif (x >= 20)\n\t\t{\n\t\t\tcount+= (x / 20);\n\t\t\tx = x % 20;\n\t\t}\n\t\tif (x >= 10)\n\t\t{\n\t\t\tcount+= (x / 10);\n\t\t\tx = x % 10;\n\t\t}\n\t\tif (x >= 5)\n\t\t{\n\t\t\tcount+= (x / 5);\n\t\t\tx = x %5;\n\t\t}\n\t\tif (x >= 1)\n\t\t{\n\n\t\t\tcount+= x;\n\t\t\tx = x % x;\n\t\t}\n\tprintf(\"%d\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",n/100+(n%100)/20+(n%20)/10+(n%10)/5+(n%5)/1);\n \n}"}, {"source_code": "//\n// Created by botayhard on 07.02.19.\n//\n\n#include<stdio.h>\n\nint main(){\n long n,s=0;\n scanf(\"%ld\", &n);\n while(n>=100){\n s+=1;\n n-=100;\n }\n while(n>=20){\n s+=1;\n n-=20;\n }\n while(n>=10){\n s+=1;\n n-=10;\n }\n while(n>=5){\n s+=1;\n n-=5;\n }\n while(n>=1){\n s+=1;\n n-=1;\n }\n printf(\"%ld\", s);\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,sum=0;\n scanf(\"%d\",&n);\n while(n!=0)\n {\n if(n>=100){\n n-=100;\n sum++;\n }\n else if(n>=20){\n n-=20;\n sum++;\n }\n else if(n>=10){\n n-=10;\n sum++;\n }\n else if(n>=5){\n n-=5;\n sum++;\n }\n else if(n>=1){\n n-=1;\n sum++;\n }\n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n;\n\tint to100, to20, to10, to5, to1;\n\tscanf (\"%d\", &n);\n\tto100=n/100;\n\tn=n-100*to100;\n\tto20=n/20;\n\tn=n-20*to20;\n\tto10=n/10;\n\tn=n-to10*10;\n\tto5=n/5;\n\tn=n-to5*5;\n\tprintf(\"%d\", to100+to20+to10+to5+n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main () {\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\", n / 100 + (n % 100) / 20 + ((n % 100) % 20) / 10 + (((n % 100) % 20) % 10) / 5 + (((n % 100) % 20) % 10) % 5);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint coins[] = {1, 5, 10, 20, 100}, x;\n\nint f() {\n\tint i = 4;\n\twhile(1) {\n\t\tif(x >= coins[i]) break;\n\t\ti--;\n\t}\n//\tputs(\"\");\n\treturn coins[i];\n}\n\nint main() {\n// freopen(\"input.in\", \"r\", stdin);\n\tint res = 0;\n//\treturn 322;\n\tscanf(\"%d\", &x);\n\t\n\twhile(x > 0) {\n//\t\tprintf(\"%d\\n\", f(x));\n\t\tx -= f();\n//\t\tprintf(\"%d\\n\", x);\n\t\tres++;\n\t}\n\tprintf(\"%d\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tlong long n;\n\tscanf(\"%lld\",&n);\n\tlong long x=n%100;\n\tlong long y=x%20;\n\tlong long z=y%10;\n\tlong long t=z%5;\n\tprintf(\"%lld\",n/100+x/20+y/10+z/5+t);\n\treturn 0;\n}\n"}, {"source_code": "#include\"stdio.h\"\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tint kq= (n/100)+(n%100)/20+(n%100%20)/10+(n%100%20%10)/5+(n%100%20%10%5);\n\tprintf(\"%d\",kq);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long int x,y,count=0,z;\n scanf(\"%ld\",&x);\n long int a[5]={1,5,10,20,100};\n for(y=4;y>=0;y--)\n {\n z=a[y];\n while(a[y]<=x)\n { \n a[y]=a[y]+z;\n count++;\n }\n x=x-(a[y]-z);\n }\n printf(\"%ld\",count);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\", (int)(n/100)+(int)(n%100)/20+(int)(n%20)/10+(int)(n%10)/5+(n%5));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,t=0,r;\n scanf(\"%d\",&n);\n if((n/100)*100<=n)\n {\n t=t+(n/100);\n r=n-((n/100)*100);\n }\n if((r/20)*20<=r)\n {\n t=t+(r/20);\n r=r-((r/20)*20);\n }\n if((r/10)*10<=r)\n {\n t=t+(r/10);\n r=r-((r/10)*10);\n }\n if((r/5)*5<=r)\n {\n t=t+(r/5);\n r=r-((r/5)*5);\n }\n if((r/1)*1<=n)\n {\n t=t+(r/1);\n r=r-((r/1)*1);\n }\n printf(\"%d\",t);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b,c,d,e,f;\n\tscanf(\"%d\", &a);\n\tb=a/100;//\n\tc=(a-b*100)/20;\n\td=(a - b*100 -c*20)/10;\n\te=(a - b*100 - c*20 -d*10)/5;\n\tf=(a - b*100 - c*20 - d*10 - e*5)/1;\n\tprintf(\"%d\",b+c+d+e+f );\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,dem=0;\n\tscanf(\"%d\",&n);\n\twhile(n){\n\t\tif(n-100>=0){\n\t\t\tdem++;\n\t\t\tn-=100;\n\t\t}\n\t\telse if(n-20>=0){\n\t\t\tdem++;\n\t\t\tn-=20;\n\t\t}\n\t\telse if(n-10>=0){\n\t\t\tdem++;\n\t\t\tn-=10;\n\t\t}\n\t\telse if(n-5>=0){\n\t\t\tdem++;\n\t\t\tn-=5;\n\t\t}\n\t\telse if(n-1>=0){\n\t\t\tdem++;\n\t\t\tn-=1;\n\t\t}\n\t}\n\tprintf(\"%d\",dem);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,ans=0;\n scanf(\"%d\",&n);\n if(n>=100)\n {\n ans += n/100;\n n = n%100;\n }\n if(n>=20)\n {\n ans += n/20;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%10;\n }\n if(n>=5)\n {\n ans += n/5;\n n = n%5;\n }\n ans += n;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int D[] = {100,20,10,5,1};\n \n int n,den=0;\n scanf(\"%d\",&n);\n \n for(int i=0;i<5;i++) {\n den += n/D[i];\n n = n%D[i];\n }\n \n printf(\"%d\\n\",den);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n int n;\n scanf(\"%d\",&n);\n int count=0;\n while(n > 0) {\n if(n >=100) {\n count=count+(n/100);\n n=n%100;\n }\n if(n >= 20) {\n count=count+(n/20);\n n=n%20;\n }\n if(n >= 10) {\n count=count+(n/10);\n n=n%10;\n }\n if(n >= 5) {\n count=count+(n/5);\n n=n%5;\n }\n if(n >= 1) {\n count=count+(n/1);\n n=n%1;\n }\n }\n printf(\"%d\",count);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,count=0;\n scanf(\"%d\",&n);\n while(n>=100){\n n=n-100;\n count++;\n }\n while(n>=20)\n {\n n=n-20;\n count++;\n }\n while(n>=10){\n n=n-10;\n count++;\n }\n while(n>=5){\n n=n-5;\n count++;\n }\n while(n>=1){\n n=n-1;\n count++;\n }\nprintf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n, digits = 0, quoitent = 0, choice;\n scanf(\"%d\", &n);\n int temp = n;\n while(temp > 0){\n temp = temp / 10;\n digits++;\n }\n int count = 0;\n int remainder = n;\n while(remainder >= 5){\n quoitent = 0;\n remainder = 0;\n if(n >= 100){\n choice = 100;\n }else if(n >= 20){\n choice = 20;\n }else if(n >= 10){\n choice = 10;\n }else if(n >= 5){\n choice = 5;\n }else if(n >= 1){\n choice = 1;\n }\n quoitent = n / choice;\n remainder = n % choice;\n count += quoitent;\n if(remainder >= 5){\n n = remainder;\n }\n }\n if(remainder < 5 && remainder != 0){\n count += n % choice;\n }\n printf(\"%d\", count);\n}"}, {"source_code": "#include<stdio.h>\nlong long n,count=0,d;\nmain(void)\n{\n scanf(\"%lld\",&n);\n while(n>=100)\n {\n count+=(n/100);\n n=n%100;\n }\n while(n>=20)\n {\n count+=n/20;\n n=n%20;\n }\n while(n>=10)\n {\n count+=n/10;\n n=n%10;\n }\n while(n>=5)\n {\n count+=n/5;\n n=n%5;\n }\n count+=n;\n printf(\"%lld\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ar[5],a,i,remainder,dividend=0,result=0;\n scanf(\"%d\",&a);\n ar[0]=1,ar[1]=5,ar[2]=10,ar[3]=20,ar[4]=100;\n for(i=4;i>=0;i--)\n {\n remainder=a%ar[i];\n dividend=a/ar[i];\n a=remainder;\n result=dividend+result;\n if(remainder==0)\n break;\n }\n printf(\"%d\\n\",result);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long int a,n1,n2,n3,n4,n5,n6,n7;\n scanf(\"%ld\",&a);\n\n\n n1=a/100;\n a=a%100;\n\n n3=a/20;\n a=a%20;\n n4=a/10;\n a=a%10;\n n5=a/5;\n a=a%5;\n\n n7=a/1;\n a=a%1;\n\n printf(\"%ld\\n\",(n7+n1+n3+n4+n5));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,t;\n scanf(\"%d\", &n);\n t=(n/100);\n n=n%100;\n t=t+(n/20);\n n=n%20;\n t=t+(n/10);\n n=n%10;\n t=t+(n/5);\n n=n%5;\n t=t+n;\n printf(\"%d\",t);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,den=0;\n scanf(\"%d\",&n);\n \n den += (n/100);\n n = n%100;\n den += n/20;\n n = n%20;\n den += n/10;\n n = n%10;\n den += n/5;\n n = n%5;\n den += n;\n \n printf(\"%d\\n\",den);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long int n;\n int b10,b5,b100,b20,b1,s=0;\n b10=b5=b100=b20=b1=0;\n scanf(\"%ld\",&n);\n if(n>=100){\n b100=n/100;\n n-=b100*100;\n }\n if(n>=20){\n b20=n/20;\n n-=b20*20;\n }\n if(n>=10){\n b10=n/10;\n n-=b10*10;\n }\n if(n>=5){\n b5=n/5;\n n-=b5*5;\n }\n if(n>=1){\n b1=n;\n \n }\n s=b10+b5+b100+b20+b1;\n printf(\"%d\",s);\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint main(void) {\nlong long int n,t,c=0;\nscanf(\"%I64d\",&n);\nt=n;\nwhile(t!=0){\nif(t/100!=0){\nc=c+t/100;\nt=t%100;\n}\nelse\nif(t/50!=0){\nc=c+t/50;\nt=t%50;\n}\nelse\nif(t/20!=0){\n\tc=c+t/20;\nt=t%20;\n}\nelse\nif(t/10!=0){\nc=c+t/10;\nt=t%10;\n}\nelse\nif(t/5!=0){\nc=c+t/5;\nt=t%5;\n}\nelse\nif(t/1!=0){\nc=c+t/1;\nt=t%1;\n}\n}\nprintf(\"%I64d\",c);\n// your code goes here\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,i,count;\n scanf(\"%d\", &n);\n\n count=0;\n\n for(i=0;i<100;i++)\n {\n if(n>=100)\n {\n n=n-100;\n count++;\n }\n else if(n>=20)\n {\n n=n-20;\n count++;\n }\n else if(n>=10)\n {\n n=n-10;\n count++;\n }\n else if(n>=5)\n {\n n=n-5;\n count++;\n }\n else if(n>=1)\n {\n n=n-1;\n count++;\n }\n else if(n==0)\n {\n break;\n }\n }\n printf(\"%d\", count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint withdraw(int n){\n int res = 0;\n while(n > 0){\n if (n-100 >= 0){\n n = n-100;\n res++;\n } else if (n-20 >= 0){\n n = n - 20;\n res++;\n } else if (n - 10 >= 0){\n n = n - 10;\n res++;\n } else if (n - 5 >= 0){\n n = n - 5;\n res++;\n } else if (n - 1 >= 0){\n n = n -1;\n res++;\n }\n \n }\n printf(\"n = %d\\n\",n);\n return res;\n}\n\n\nint main(){\n printf(\"%d\\n\",withdraw(125));\n printf(\"%d\\n\",withdraw(43));\n}"}, {"source_code": "\n#include <stdio.h>\nint main()\n{\n int n;\n int bills[5]={100,50,20,10,1};\n int min=0;\n scanf(\"%d\",&n);\n for(int i = 0 ;i<5;i++)\n {\n while(n>=bills[i])\n {\n n-=bills[i];\n min++;\n }\n }\n printf(\"%d\",min);\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int n;\n int a[]={1,5,10,20,100}, i=0,ans=0, j;\n scanf(\"%ld\", &n);\n if(n>a[i] && n<=a[++i])\n {\n ans=n%a[i];\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/(a[i-j]));\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else\n {\n i++;\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n printf(\"%ld\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=0,count=01,ara[5]={100,20,10,5,1};\n\tscanf(\"%d\",&n);\n\tdo\n\t{\n\twhile(n>=100){\n\t\t\tn%=100;\n\t\t\tcount++;\n\t\t} \n\t\twhile(n<ara[i]&& n>=ara[i+1]){\n\t\t\tn%=ara[i+1];\n\t\t\tcount++;\n\t\t}\n\t i++;\n\t}while(n==0);\n\tprintf(\"%d\",count);\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#pragma warning(disable: 4996)\nint main()\n{\n\tint x;\n\tint count[4] = { 0 ,0,0,0};\n\tint t = 0;\n\tscanf(\"%d\", &x);\n\tif (x == 0)\n\t{\n\t\tt = 0;\n\t}\n\telse\n\t{\n\t\tif (x >= 100)\n\t\t{\n\t\t\tcount[0] = x / 100;\n\t\t\tx = x % 100;\n\t\t}\n\t\tif (x >= 20)\n\t\t{\n\t\t\tcount[1] = (x / 20);\n\t\t\tx = x % 20;\n\t\t}\n\t\tif (x >= 10)\n\t\t{\n\t\t\tcount[1] = (x / 10);\n\t\t\tx = x % 10;\n\t\t}\n\t\tif (x >= 5)\n\t\t{\n\t\t\tcount[2] = (x / 5);\n\t\t\tx = x %5;\n\t\t}\n\t\tif (x >= 1)\n\t\t{\n\n\t\t\tcount[3] = x;\n\t\t\tx = x % x;\n\t\t}\n\t\tfor (int i = 0; i < 4; i++)\n\t\t{\n\t\t\tt = t + count[i];\n\t\t}\n\t}\n\tprintf(\"%d\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n unsigned long n,a,b,c,d,e,f;\n scanf(\"%lu\",&n);\n a=n/100;\n b=n%100;\n c=b/20;\n d=b%20;\n e=d/5;\n f=d%5;\n printf(\"%d\",a+c+e+f);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n long long int n,b,h;\n scanf(\"%d\",&n);\n int i=0,a,c,d,e,f,g;\n b=n/100;\n\ta=n%100;\n\tc=a/20;\n\td=a%20;\n\te=d/10;\n\tf=d%10;\n\tg=f/5;\n\th=b+c+e+g;\n\tprintf(\"%d\",h);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main (void)\n{\n long long int n;\n int a=0;\n scanf(\"%l64d\",&n);\n while (n>=100)\n {\n n=n-100;\n a=a+1;\n }\n while (n>=20)\n {\n n=n-20;\n a=a+1;\n }\n while (n>=10)\n {\n n=n-10;\n a=a+1;\n }\n while (n>=5)\n {\n n=n-5;\n a=a+1;\n }\n \n while (n>=1)\n {\n n=n-1;\n a=a+1;\n }\n printf(\"%d\",a);\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,sum=0;\n scanf(\"%d\",&n);\n while(n!=0)\n {\n if(n>=100){\n n-=100;\n sum++;\n }\n if(n>=20){\n n-=20;\n sum++;\n }\n if(n>=10){\n n-=10;\n sum++;\n }\n if(n>=5){\n n-=5;\n sum++;\n }\n if(n>=1){\n n-=1;\n sum++;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n long long int n,b;\n scanf(\"%d\",&n);\n int i=0,a,c,d,e,f,g,h;\n b=n/100;\n\ta=n%100;\n\tc=a/20;\n\td=a%20;\n\te=d/10;\n\tf=d%10;\n\tg=f/5;\n\th=b+c+e+g;\n\tprintf(\"%d\",h);\n\treturn 0;\n}\n\n"}, {"source_code": "int main() {\n int i,n,sayac=0,rem,change[5]={100,20,10,5,1};\n scanf(\"%d\",&n);\n for(i=0;i<5;i++) {\n rem=n%change[i];\n n/=change[i];\n sayac+=n;\n }\n printf(\"%d\",sayac);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=0,count=01,ara[5]={100,20,10,5,1};\n\tscanf(\"%d\",&n);\n\tdo\n\t{\n\twhile(n>=100){\n\t\t\tn%=100;\n\t\t\tcount++;\n\t\t} \n\t\twhile(n<ara[i]&& n>=ara[i+1]){\n\t\t\tn%=ara[i+1];\n\t\t\tcount++;\n\t\t}\n\t i++;\n\t}while(n==0);\n\tprintf(\"%d\",count);\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,a;\n\tscanf(\"%d\",&n);\n\twhile (n>=100)\n\t\t{\n\t\t\tn=n-100;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=20)\n\t\t{\n\t\t\tn=n-20;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=10)\n\t\t{\n\t\t\tn=n-10;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=5)\n\t\t{\n\t\t\tn=n-5;\n\t\t\ta++;\n\t\t}\n\t\twhile(n>0){\n\t\t\tn=n-1;\n\t\t\ta++;\n\t\t}\n\t\t\n\tprintf(\"%d\",a );\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,b,c,d,e,f,s=0,m;\n scanf(\"%d\",&n);\n if(n<5)\n { printf(\"%d\",n); }\n\n else if(n<10)\n {\n a=n%5;\n s=s+1+a;\n { printf(\"%d\",s); }\n }\n else if (n<20)\n {\n a=n%10;\n if(a<5)\n {\n s=s+1+a;\n }\n else\n {\n b= a%5;\n s=s+2+b;\n { printf(\"%d\",s); }\n }\n\n }\n else if (n<100)\n {\n a=n/20;\n b= n%20;\n if(b<20)\n {\n if(b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n\n }\n }\n else if (n>=100)\n { a=n/100;\n b=n%100;\n\n if (b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n else if(b<100)\n {\n c=b/20;\n d=c%20;\n m=d/10;\n e=d%10;\n n=e/5;\n f=e%5;\n s=s+a+c+f;\n { printf(\"%d\",s); }\n }\n\n }\n return 0;\n\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tint i;\n\tint bills[] = { 100, 20, 10, 5, 1 };\n\tint bill;\n\tint ans;\n\tfor (i = 0; i < 5; ++i) {\n\t\tbill = bills[i];\n\t\tif (n < bill) {\n\t\t\tcontinue;\n\t\t}\n\t\tans += n / bill;\n\t\tn = n % bill;\n\t\tif (n == 0) {\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", ans);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a , count=0;\n\n scanf(\"%d\",&a);\n count=count+a/100;\n a=a%100;\n\n count=count+a/20;\n a=a%20;\n count=count+a/10;\n a=a%10;\n count=count+a/5;\n a=a%5;\n\n count=count+a;\n printf(\"%d\\n\",count);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/100+n/20+n/5+n/10+n/1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main(){\n int n,c=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(5>n>1){ c++; n-=1;}\n else if(10>n>5){ c++;n-=5;}\n else if(20>n>10){c++;n-=10;}\n else if(100>n>20){c++;n-=20;}\n else {c++;n-=100;}\n }\nprintf(\"%d\",c);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,count=0;\nscanf(\"%d\",&n);\nwhile(n!=0)\n{\n if(n>=100)\n {\n n=n-100;\n count++;\n\n }\n else if(n>=50)\n {\n n=n-50;\n count++;\n\n }\nelse if(n>=20)\n {\n n=n-20;\n count++;\n\n }\n else if(n>=10)\n {\n n=n-100;\n count++;\n\n }\n else if(n>=5)\n {\n n=n-5;\n count++;\n\n }\nelse if(n>=1)\n {\n n=n-1;\n count++;\n\n }\n\n}\nprintf(\"%d\\n\",count);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint i=5;\nint A[]={1,5,10,20,100};\nint s=0,r=0;\ndiv(int n)\n{ \n\tif(n==0)\n\t{\n\t\treturn 0;\n\t}\n\telse \n\t{\n\t\ti=i-1;\n\t\tr=n%A[i];\n\t\ts=s+(n/A[i]);\n\t\t//printf(\"s=%d \",s );\n\t\tdiv(r);\n\t\treturn s;\n\t}\n}\nmain()\n{\n\tprintf(\"\\n%d \",div(125));\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\",n/100+n/20+n/5+n/10+n/1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a , count=0;\n\n scanf(\"%d\",&a);\n count=count+a/100;\n a=a%100;\n\n count=count+a/20;\n a=a%20;\n count=count+a/10;\n a=a%10;\n count=count+a/5;\n a=a%5;\n\n count=count+a;\n printf(\"%d\\n\",count);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main(){\n int n,c=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(5>n>=1){ c++; n-=1;}\n else if(10>n>=5){ c++;n-=5;}\n else if(20>n>=10){c++;n-=10;}\n else if(100>n>=20){c++;n-=20;}\n else{c++;n-=100;}\n }\nprintf(\"%d\",c);\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{ \n\n long long int n ;\n int i = 0, x = 0 , y = 0 ;\n scanf(\"%I64d\",&n);\n int a[4] = {100 , 20 , 5 , 1 } ;\n \n if(n%100==0)\n {\n printf(\"%I64d\",n/100);\n return 0 ;\n }\n else if(n%20==0 && n < 100)\n {\n printf(\"%d\",n/20);\n return 0 ;\n }\n else if(n%5==0 && n < 20)\n {\n printf(\"%d\",n/5);\n return 0 ;\n }\n else\n {\n while(1)\n {\n if (n%a[i] < n) \n {\n \tx = x + ((n - (n%a[i])) / a[i]) ;\n \tn = n % a[i] ;\n \ti++;\n\t\t\t }\n \t\telse \n \t\t\ti++;\n if(n == 0)\n break;\n \n \n }\n }\n\nprintf(\"%dI64\",x);\n\treturn 0 ;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a=0,n;\n\tscanf(\"%d\",&n);\n\twhile(n!=0)\n{\n\t\n\tif(n>=100)\n\t{\n\t\ta+=n/100;\n\t\tn=n%100;\n\t\t\n\t}\n\telse if((n>=20)&&(n<=100))\n\t{\n\t\ta+=n/20;\n\t\tn=n%20;\n\t}\n\telse if((n>=10)&&(n<=20))\n\t{\n\t\ta+=n/10;\n\t\tn=n%10;\n\t}\n\telse if((n>=5)&&(n<=10))\n\t{\n\t\ta+=n/5;\n\t\tn=n%5;\n\t}\n\telse if((n>=2)&&(n<=5))\n\t{\n\t\ta+=n/2;\n\t\tn=n%2;\n\t}\n\telse\n\t{\n\t\ta+=n;\n\t\tn=n-n;\n\t}\n}\nprintf(\"%d\",a);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int n,nb=0,r,k;\n\n scanf(\"%d\",&n);\n\n while(r!=0)\n {\n if(n>=100)\n { k = n/100;\n r = n%100;\n n = r;\n nb = nb + k;\n }\n if((n>=20)&&(n<100))\n { k = n/20;\n r = n % 20;\n n = r;\n nb = nb + k;\n }\n if((n>=10)&&(n<20))\n {\n k = n/10;\n r = n % 10;\n n = r;\n nb = nb + k;\n }\n if((n>=5)&&(n<10))\n {\n k = n/5;\n r = n % 5;\n n = r;\n nb = nb + k;\n }\n if((n>=1)&&(n<5))\n {\n k = n/1;\n n = r;\n nb = nb + k;\n r = n % 1;\n }\n }\n printf(\"%d\",nb);\n}\n"}, {"source_code": "#include<stdio.H>\nint main()\n{\n int n,b=0,r;\n r=n/20;\n scanf(\"%d\",&n);\n if(n==1||n==5||n==10||n==20||n==100){b=1;}\n\n if(n/100==0)\n {\n if(n/20==0)\n {\n if(n/10==0)\n {\n if(n/5==0){b=b+n;}\n else{b=n-4;}\n }\n else if(n/10!=0)\n {\n if(n%10>=5){b=n-13;}\n else{b=n-9;}\n }\n }\n else if(n/20!=0)\n {\n if(n%20==0){b=n/20;}\n else if(n%20<10){b=r+(n%20)/5+(n%20)%5;}\n else if(n%20>10){b=r+(n%20)/10+((n%20)%10)%5+((n%20)%10)/5;}\n else if(n%20==10){b=n/20+1;}\n }\n }\n else if(n/100!=0)\n {\n if(n%100<20)\n {\n if(n%100==0){b=n/100;}\n else if(n%100<10){b=n/100+(n%100)/5+(n%100)%5;}\n else if(n%100>10){b=n/100+(n%100)/10+(n%100)%5+(n%100)/5;}\n else if(n%100==10){b=n/100+1;}\n }\n else if(n%100>20){b=n/100+(n%100)/20+((n%100)%20)/10+(((n%100)%20)%10)/5+(((n%100)%20)%10)%5l;}\n else if(n%100==20){b=n/100+1;}\n else if(n%100==0){b=n%100;}\n }\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,b,c,d,e,f,s=0;\n scanf(\"%d\",&n);\n if(n<5)\n { printf(\"%d\",n); }\n\n else if(n<10)\n {\n a=n%5;\n s=s+1+a;\n { printf(\"%d\",s); }\n }\n else if (n<20)\n {\n a=n%10;\n if(a<5)\n {\n s=s+1+a;\n }\n else\n {\n b= a%5;\n s=s+2+b;\n { printf(\"%d\",s); }\n }\n\n }\n else if (n<100)\n {\n a=n/20;\n b= n%20;\n if(b<20)\n {\n if(b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n\n }\n }\n else if (n>=100)\n { a=n/100;\n b=n%100;\n\n if (b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n else if(b<100)\n {\n c=b/20;\n d=c%20;\n e=d%10;\n f=e%5;\n s=s+a+c+2+f;\n { printf(\"%d\",s); }\n }\n\n }\n return 0;\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m,i,d100,d50,d20,d10,d5,d1;\n scanf(\"%lld\", &n);\n m=n;\n d100 = m/100;\n m=m%100;\n d50 = m/50;\n m=m%50;\n d20 = m/20;\n m=m%20;\n d10 = m/10;\n m=m%10;\n d5 = m/5;\n m=m%5;\n d1 = m/1;\n m=m%1;\n printf(\"%lld\",d100+d50+d20+d5+d1);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n unsigned long n,a,b,c,d,e,f;\n scanf(\"%lu\",&n);\n a=n/100;\n b=n%100;\n c=b/20;\n d=b%20;\n e=d/5;\n f=d%5;\n printf(\"%lu\",a+c+e+f);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int checkn,checknn,a,b,c,hund=0,tw,ten=0,five=0,one=0;\n scanf(\"%d\",&a);\n /****************/\n hund=a/100;\n /****************/\n checkn=(a%100)/10;\n if (checkn%2==0)\n {\n tw=checkn/2;\n ten=0;\n }\n else if (checkn%2!=0)\n {\n tw=(checkn-1)/2;\n ten=1;\n }\n /*****************/\n checknn=a%10;\n if (checknn%5==0)\n five=checknn/5;\n else\n {\n five=1;\n one=checknn-5;\n }\n /*****************/\n printf(\"%d\",hund+tw+ten+five+one);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int n,nb=0,r,k;\n\n scanf(\"%d\",&n);\n\n while(r!=0)\n {\n if(n>=100)\n { k = n/100;\n r = n%100;\n n = r;\n nb = nb + k;\n }\n if((n>=20)&&(n<100))\n { k = n/20;\n r = n % 20;\n n = r;\n nb = nb + k;\n }\n if((n>=10)&&(n<20))\n {\n k = n/10;\n r = n % 10;\n n = r;\n nb = nb + k;\n }\n if((n>=5)&&(n<10))\n {\n k = n/5;\n r = n % 5;\n n = r;\n nb = nb + k;\n }\n if((n>=1)&&(n<5))\n {\n k = n/1;\n n = r;\n nb = nb + k;\n r = n % 1;\n }\n }\n printf(\"%d\",nb);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ar[5],a,i,remainder,dividend=0,result=0;\n scanf(\"%d\",&a);\n ar[0]=1,ar[1]=5,ar[2]=10,ar[3]=20,ar[4]=100;\n for(i=4;i>0;i--)\n {\n if(a<5)\n {\n result=result+a;\n break;\n }\n remainder=a%ar[i];\n dividend=a/ar[i];\n a=remainder;\n result=dividend+result;\n if(remainder==0)\n break;\n }\n printf(\"%d\\n\",result);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n unsigned long long int n,a,b,c,d,e,f;\n scanf(\"%llu\",&n);\n a=n/100;\n b=n%100;\n c=b/20;\n d=b%20;\n e=d/5;\n f=d%5;\n printf(\"%llu\",a+c+e+f);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n, mod, i, div = 0;\n scanf(\"%lld\", &n);\n if(n >= 100)\n {\n div += n/100;\n n = n % 100;\n\n }\n if(n >=20)\n {\n div += n/20;\n n = n % 20;\n\n }\n if(n >= 5)\n {\n div += n/5;\n n = n %5;\n\n }\n if(n >= 1)\n {\n div += n;\n }\n printf(\"%lld\", div);\n}\n"}, {"source_code": "\n#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int a,b,c;\n a=0;\n b=0;\n c=0;\n int d=0;\n if(n/100!=0)\n {\n a=n/100;\n b=n%100;\n }\n else \n {\n b=n;\n }\n if(b/20!=0)\n {\n c=b%20;\n b=b/20;\n if(c/10!=0)\n {\n b=b+c/10;\n c=c%10;\n }\n }\n else\n {\n c=b;\n b=0;\n }\nif(c/5!=0)\n{\n d=c%5;\n c=c/5;\n}\n\n printf(\"%d\",(a+b+c+d));\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,b,c,d,e,f,s=0,m;\n scanf(\"%d\",&n);\n if(n<5)\n { printf(\"%d\",n); }\n\n else if(n<10)\n {\n a=n%5;\n s=s+1+a;\n { printf(\"%d\",s); }\n }\n else if (n<20)\n {\n a=n%10;\n if(a<5)\n {\n s=s+1+a;\n }\n else\n {\n b= a%5;\n s=s+2+b;\n { printf(\"%d\",s); }\n }\n\n }\n else if (n<100)\n {\n a=n/20;\n b= n%20;\n if(b<20)\n {\n if(b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n\n }\n }\n else if (n>=100)\n { a=n/100;\n b=n%100;\n\n if (b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n else if(b<100)\n {\n c=b/20;\n d=c%20;\n m=d/10;\n e=d%10;\n n=e/5;\n f=e%5;\n s=s+a+c+f;\n { printf(\"%d\",s); }\n }\n\n }\n return 0;\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n unsigned long n,a,b,c,d,e,f;\n scanf(\"%lu\",&n);\n a=n/100;\n b=n%100;\n c=b/20;\n d=b%20;\n e=d/5;\n f=d%5;\n printf(\"%lu\",a+c+e+f);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%d\",&n);\n\tif(n>=100)\n\t{\n\t\ta=n/100;\n\t\tn=n-a*100;\n\t}\n\tif(n>=20)\n\t{\n\t\tb=n/20;\n\t\tn=n-b*20;\n\t}\n\tif(n>=5)\n\t{\n\t\tc=n/5;\n\t\tn=n-c*5;\n\t}\n\tif(n>=1)\n\t{\n\t\td=n/1;\n\t\t\n\t} \n\te=a+b+c+d;\n\tprintf(\"%d\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n;\n long long int a,b,c,d,e,f,g,h,i,o,k,a1,a4,a2,a3,b1,a6,o7,a5,b3,b4,o1,o4,o2,o3,o6,o9,b2,c1,c2,p,count=0,l,p2,p3,p4,p5,o8,f1,f2,r1,r2;\n scanf(\"%lld\",&n);\n if(n>=100){\n a=n%100;\n l=n/100;\n count=count+l;\n\n if(a>0){\n if(a>=20){\n b=a%20;\n c=a/20;\n count=count+c;\n\n if(b>=10){\n d=b%10;\n e=b/10;\n count=count+e;\n if(d>=5){\n f=d%5;\n g=d/5;\n count=count+g;\n }\n else\n {\n p=d/1;\n count=count+p;\n }\n }\n else if(b>=5){\n h=b%5;\n i=b/5;\n count=count+i;\n\n if(h>0){\n o=h/1;\n count=count+h;\n\n }\n }\n else{\n k=b/1;\n count=count+k;\n\n }\n }\n }\n }\n else if(n>=20){\n a1=n%20;\n a2=n/20;\n count=count+a2;\n if(a1>=10){\n b1=a1%10;\n b2=a1/10;\n count=count+b2;\n if(b1>=5){\n c1=b1%5;\n c2=b1/5;\n count=count+c2;\n if(c1>=1){\n o1=c1/1;\n count=count+o1;\n }\n }\n else{\n o2=b1/1;\n count=count+o2;\n }\n }\n else if(a1>=10){\n p2=a1%10;\n p3=a1/10;\n count=count+p3;\n if(p2>=5){\n p4=p2%5;\n p5=p2/5;\n count=count+p5;\n if(p4>=1){\n o8=p4/1;\n count=count+o8;\n }\n }\n }\n else if(a1>=5){\n f1=a1%5;\n f2=a1/5;\n count=count+f2;\n if(f1>=1){\n r1=f1/1;\n count=count+r1;\n }\n }\n else{\n r2=a1/1;\n count=count+r2;\n }\n }\n else if(n>=10){\n a3=n%10;\n a4=n/10;\n count=count+a4;\n if(a3>=5){\n b3=a3%5;\n b4=a3/5;\n count=count+b4;\n if(b3>=1){\n o3=b3/1;\n count=count+o3;\n }\n }\n else{\n o4=a3/1;\n count=count+o4;\n }\n }\n else if(n>=5){\n a5=n%5;\n a6=n/5;\n count=count+a6;\n if(a5>=1){\n o7=a5/1;\n count=count+o7;\n }\n }\n else{\n o9=n/1;\n count=count+o9;\n }\n printf(\"%lld\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int a , count=0;\n\n scanf(\"%d\",&a);\n count=count+a/100;\n a=a%100;\n\n count=count+a/20;\n a=a%20;\n count=count+a/10;\n a=a%10;\n count=count+a/5;\n a=a%5;\n\n count=count+a;\n printf(\"%d\\n\",count);\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tint cash, bills;\n\t\n\tscanf(\"%d\", &cash);\n\t\n\twhile(cash != 0){\n\t\tif(cash >= 100){\n\t\t\tcash = cash - 100;\n\t\t\tbills++;\n\t\t}\n\t\telse if(cash >= 20 && cash < 100){\n\t\t\tcash = cash - 20;\n\t\t\tbills++;\n\t\t}\n\t\telse if(cash >= 10 && cash < 20){\n\t\t\tcash = cash - 10;\n\t\t\tbills++;\n\t\t}\n\t\telse if(cash >= 5 && cash < 10){\n\t\t\tcash = cash - 5;\n\t\t\tbills++;\n\t\t}\n\t\telse if(cash >= 1 && cash < 5){\n\t\t\tcash = cash - 1;\n\t\t\tbills++;\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\", bills);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tlong long int n , k = 0 , i ;\n\tscanf(\"%lld\",&n);\n\tagain:\n\tif(!(n%100)&&n>100) \n\t{\n\t\tprintf(\"%lld\",n/100);\n\t\treturn 0;\n }\n if(!(n%20)&&n<100)\n\t{\n \tprintf(\"%lld\",n/20);\n \treturn 0;\n\t}\n\tif(!(n%10)&&n<20)\n\t{\n\t\tprintf(\"%lld\",n/10);\n\t\treturn 0;\n\t}\n\tif(!(n%5)&&n<10)\n\t{\n\t printf(\"%lld\",n/5);\n\t return 0;\n\t} \n\twhile(n>=100)\n\t{\n\t n-=100;\n\t k++;\n\t}\n\twhile(n>20)\n\t{\n\t\tn-=20;\n\t\tk++;\n\t}\n\twhile(n>=10)\n\t{\n\t\tn-=10;\n\t\tk++;\n\t}\n\twhile(n>=5)\n\t{\n\t\tn-=5;\n\t\tk++;\n\t}\n\twhile(n>=1)\n\t{\n\t\tn-=1;\n\t\tk++;\n\t}\n\tprintf(\"%d\",k);\nreturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,t;\n scanf(\"%d\", &n)!=EOF;\n t=n;\n int c=0;\n if(t>=100){c=c+(t/100);t=t%100;}\n else if(t<100 && t>=20){c=c+(t/20);t=t%20;}\n else if(t<10 && t>=10){c=c+(t/10);t=t%10;}\n else if(t<10 && t>=5){c=c+(t/5);t=t%5;}\n else if(t<5 && t>=0){c=c+t;\n printf(\"%d\", c);}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long int n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%lu\",&n);\n\tif(n>=100)\n\t{\n\t\ta=n/100;\n\t\tn=n-a*100;\n\t}\n\tif(n>=20)\n\t{\n\t\tb=n/20;\n\t\tn=n-b*20;\n\t}\n\tif(n>=5)\n\t{\n\t\tc=n/5;\n\t\tn=n-c*5;\n\t}\n\tif(n>=1)\n\t{\n\t\td=n/1;\n\t\t\n\t} \n\te=a+b+c+d;\n\tprintf(\"%lu\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n int a[]={1,5,10,20,100}, i=0,ans=0, j;\n scanf(\"%ld\", &n);\n if(n>a[i] && n<=a[++i])\n {\n ans=n%a[i];\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/(a[i-j]));\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else\n {\n i++;\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n for(j=1;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n printf(\"%ld\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long unsigned int ULL; \nint main()\n{\n ULL money, leftover, bills = 0LLU;\n scanf(\"%d\", &money);\n\n //for 100\n leftover = money % 100LLU;\n bills += (money / 100LLU);\n money = leftover; \n\n //for 20\n leftover = money % 20LLU;\n bills += (money / 20LLU);\n money = leftover; \n\n //for 5\n leftover = money % 5LLU;\n bills += (money / 5LLU);\n money = leftover;\n \n //for 1\n bills += money;\n\n printf(\"%llu\", bills);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,ans=0;\n scanf(\"%d\",&n);\n if(n>=100)\n {\n ans += n/100;\n n = n%100;\n }\n if(n>=20)\n {\n ans += n/20;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%10;\n }\n if(n>=5)\n {\n ans += n/5;\n n = n%5;\n }\n ans += n;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,m=0;\n scanf(\"%lld\",&n);\n\n if(n/100)\n m+=(n/100);\n n-=(n/100)*100;\n\n if(n/20)\n m+=(n/20);\n n-=(n/20)*20;\n\n if(n/10)\n m+=(n/10);\n n-=(n/10)*10;\n\n if(n/5)\n m+=(n/5);\n n-=(n/5)*5;\n\n m+=n;\n printf(\"%lld\",&m);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(int argc, char const *argv[])\n{\n\tint n,a;\n\tscanf(\"%d\",&n);\n\twhile (n>=100)\n\t\t{\n\t\t\tn=n-100;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=20)\n\t\t{\n\t\t\tn=n-20;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=10)\n\t\t{\n\t\t\tn=n-10;\n\t\t\ta++;\n\t\t}\n\t\twhile (n>=5)\n\t\t{\n\t\t\tn=n-5;\n\t\t\ta++;\n\t\t}\n\t\twhile(n>0){\n\t\t\tn=n-1;\n\t\t\ta++;\n\t\t}\n\t\t\n\tprintf(\"%d\",a );\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ar[5],a,i,remainder,dividend=0,result=0;\n scanf(\"%d\",&a);\n ar[0]=1,ar[1]=5,ar[2]=10,ar[3]=20,ar[4]=100;\n for(i=4;i>0;i--)\n {\n if(a<5)\n {\n result=result+a;\n break;\n }\n remainder=a%ar[i];\n dividend=a/ar[i];\n a=remainder;\n result=dividend+result;\n if(remainder==0)\n break;\n }\n printf(\"%d\\n\",result);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,sum=0;\n scanf(\"%d\",&n);\n while(n!=0)\n {\n if(n>=100){\n n-=100;\n sum++;\n }\n if(n>=20){\n n-=20;\n sum++;\n }\n if(n>=10){\n n-=10;\n sum++;\n }\n if(n>=5){\n n-=5;\n sum++;\n }\n if(n>=1){\n n-=1;\n sum++;\n }\n }\n printf(\"%d\",sum);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n long long int n,sum=0;\n scanf(\"%ld\",&n);\n sum=sum+n/100;\n if(n%100!=0){\n n=n%100;\n sum=sum+n/20;\n if(n%20!=0){\n n=n%20;\n sum=sum+n/10;\n if(n%10!=0){\n \tn=n%10;\n sum=sum+n/5;\n if(n%5!=0){\n n=n%5;\n sum=sum+n/1;\n }\n }\n }\n }\n printf(\"%ld\\n\",sum);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=0;\n\tscanf(\"%d\",&n);\n\ti=n/100;\n\tn%=100;\n\ti+=n/20;\n\tn%=20;\n\ti+=n/10;\n\tn%=10;\n\ti+=n/5;\n\tn%=n/1;\n\ti+=1;\n\tprintf(\"%d\\n\",i);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n#pragma warning(disable: 4996)\nint main()\n{\n\tint x;\n\tint count[4] = { 0 ,0,0,0};\n\tint t = 0;\n\tscanf(\"%d\", &x);\n\n\t\tif (x >= 100)\n\t\t{\n\t\t\tcount[0] = x / 100;\n\t\t\tx = x % 100;\n\t\t}\n\t\tif (x >= 20)\n\t\t{\n\t\t\tcount[1] = (x / 20);\n\t\t\tx = x % 20;\n\t\t}\n\t\tif (x >= 10)\n\t\t{\n\t\t\tcount[1] = (x / 10);\n\t\t\tx = x % 10;\n\t\t}\n\t\tif (x >= 5)\n\t\t{\n\t\t\tcount[2] = (x / 5);\n\t\t\tx = x %5;\n\t\t}\n\t\tif (x >= 1)\n\t\t{\n\n\t\t\tcount[3] = x;\n\t\t\tx = x % x;\n\t\t}\n\t\tfor (int i = 0; i < 4; i++)\n\t\t{\n\t\t\tt = t + count[i];\n\t\t}\n\tprintf(\"%d\", t);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\n\nint main()\n{\n int n;\n int i100,i20,i10,i5,i1;\n \n /* Initialize all notes to 0 */\n i100 = i20 = i10 = i5 = i1 = 0;\n //int count=0;\n\n\n /* Input amount from user */\n \n scanf(\"%d\", &n);\nif(n>=1&&n<=pow(10,9))\n\n{\n\n \n if(n >= i100)\n {\n i100 = n/100;\n n -= i100 * 100;\n }\n \n if(n >= 20)\n {\n i20 = n/20;\n n -= i20 * 20;\n }\n if(n >= 10)\n {\n i10 = n/10;\n n -= i10 * 10;\n }\n if(n >= 5)\n {\n i5 = n/5;\n n -= i5 * 5;\n }\n \n if(n >= 1)\n {\n i1 = n;\n }\n}\n int count=i1=i5+i10+i20+i100;\n\n /* Print required notes */\n //printf(\"Total number of notes = \\n\");\n // printf(\"%d\",&count);\n printf(\"%d\",count);\n\n return 0;\n}"}, {"source_code": " #include<stdio.h>\nint main ()\n{\n int n,sum=0;\n int i,arr[6]={100,50,20,10,5,1};\n scanf(\"%d\",&n);\n for(i=0; i<6; i++)\n {\n sum+=n/arr[i];\n n=n%arr[i];\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,r;\n r=n/100;\n n=n%100;\n r=r+n/20;\n n=n%20;\n r=r+n/5;\n n=n%5;\n r=r+n;\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,q,x,i,j,k,l,m,a,b,c,d,e,f,y;\n scanf(\"%d\", &n);\n a=n/100;\n i=n%100;\n c=j/20;\n k=j%20;\n d=k/10;\n l=k%10;\n e=l/5;\n m=l%5;\n f=m/1;\n y=a+c+d+e+f;\n printf(\"%d\", y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n long long int n,sum=0;\n scanf(\"%ld\",&n);\n sum=sum+n/100;\n if(n%100!=0){\n n=n%100;\n sum=sum+n/20;\n if(n%20!=0){\n n=n%20;\n sum=sum+n/10;\n if(n%10!=0){\n \tn=n%10;\n sum=sum+n/5;\n if(n%5!=0){\n n=n%5;\n sum=sum+n/1;\n }\n }\n }\n }\n printf(\"%ld\\n\",sum);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n;\n int count = 0;\n scanf(\"%d\", &n);\n while(n == 0){\n if(n >= 100){\n count++;\n n -= 100;\n }\n else if(n >= 20){\n count++;\n n -= 20;\n }\n else if(n >= 10){\n count++;\n n -= 10;\n }\n else if(n >= 5){\n count++;\n n -= 5;\n }\n else{\n count += n;\n n = 0;\n }\n }\n printf(\"%d\", count);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,y=0;\n scanf(\"%lld\",&n);\n int a[5]={100,20,10,5,1},i=0;\n while(n){\n if(n%a[i]==0){\n y++;\n printf(\"%lld\",y);\n break;\n }\n else if(n/a[i]!=0){\n n=n%a[i];\n y++;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,count=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(n>=100)\n {\n count=n/100;\n n=n-count*100;\n }\n else if(n>=20)\n {\n count=n/20;\n n=n-count*20;\n }\n else if(n>=20){\n count=n/10;\n n=n-count*10;\n }\n else if(n>=5)\n {\n count=n/5;\n n=n-count*5;\n }\n else\n {\n count=n;\n n=n-count;\n }\n}\nprintf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n if(n%100==0)\n {\n j=n/100;\n n=n-j*100;\n }\n else if(n%20==0)\n {\n j=n/20;\n n=n-j*20;\n }\n else if(n%10==0)\n {\n j=n/10;\n n=n-j*10;\n }\n else if(n%5==0)\n {\n j=n/5;\n n=n-j*5;\n }\n else if(n%1==0)\n {\n j=n/1;\n n=n-j*1;\n }\n k=k+j;\n }\n printf(\"%d\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint i=5;\nint A[]={1,5,10,20,100};\nint s=0,r=0;\ndiv(int n)\n{ \n\tif(n==0)\n\t{\n\t\treturn 0;\n\t}\n\telse \n\t{\n\t\ti=i-1;\n\t\tr=n%A[i];\n\t\ts=s+(n/A[i]);\n\t\t//printf(\"s=%d \",s );\n\t\tdiv(r);\n\t\treturn s;\n\t}\n}\nmain()\n{\n\tprintf(\"\\n%d \",div(125));\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,ans=0;\n scanf(\"%d\",&n);\n if(n>=100)\n {\n ans += n/100;\n n = n%100;\n }\n if(n>=20)\n {\n ans += n/20;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%10;\n }\n if(n>=5)\n {\n ans += n/5;\n n = n%5;\n }\n ans += n;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count=n/100;\n n=n%100;\n count+=n/20;\n n=n%20;\n count+=n/10;\n n=n%10;\n count+=n/5;\n n=n%5;\n count+=n;\n printf(\"%d\",&count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong double n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%d\",&n);\n\tif(n>=100)\n\t{\n\t\ta=n/100;\n\t\tn=n-a*100;\n\t}\n\tif(n>=20)\n\t{\n\t\tb=n/20;\n\t\tn=n-b*20;\n\t}\n\tif(n>=5)\n\t{\n\t\tc=n/5;\n\t\tn=n-c*5;\n\t}\n\tif(n>=1)\n\t{\n\t\td=n/1;\n\t\t\n\t} \n\te=a+b+c+d;\n\tprintf(\"%d\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,y=0;\n scanf(\"%lld\",&n);\n int a[5]={100,20,10,5,1},i=0;\n while(n){\n if(n%a[i]==0){\n y++;\n printf(\"%lld\",y);\n break;\n }\n else{\n n=n%a[i];\n y++;\n }\n i++;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n int i100,i20,i10,i5,i1;\n \n /* Initialize all notes to 0 */\n i100 = i20 = i10 = i5 = i1 = 0;\n //int count=0;\n\n\n /* Input amount from user */\n \n scanf(\"%d\", &n);\n \n\n \n if(n >= i100)\n {\n i100 = n/100;\n n -= i100 * 100;\n }\n \n if(n >= 20)\n {\n i20 = n/20;\n n -= i20 * 20;\n }\n if(n >= 10)\n {\n i10 = n/10;\n n -= i10 * 10;\n }\n if(n >= 5)\n {\n i5 = n/5;\n n -= i5 * 5;\n }\n \n if(n >= 1)\n {\n i1 = n;\n }\n int count=i1=i5+i10+i20+i100;\n\n /* Print required notes */\n //printf(\"Total number of notes = \\n\");\n // printf(\"%d\",&count);\n printf(\"%d\",count);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tlong long int T;\n\tint count = 0;\n\tscanf(\"%lld\",&T);\n\twhile(T >= 100){\n\t\tT-=100;\n\t\tcount++;\n\t}\n\twhile(T >= 20){\n\t\tT-=20;\n\t\tcount++;\n\t}\n\n\twhile(T >= 5){\n\t\tT-=5;\n\t\tcount++;\n\t}\n\twhile(T >= 1){\n\t\tT-=1;\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "main()\n\n\n{\n setlocale(0, \"rus\");\n int a;\n int l = 0;\n printf(\"\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd \ufffd\ufffd\ufffd\ufffd\ufffd \");\n scanf(\"%d\", &a);\n\n\n if (a >= 100)\n {\n do\n {\n a = a - 100;\n l = l + 1;\n }while (a >= 100);\n }\n\n if (a <= 99 && a >= 20)\n {\n do\n {\n a = a - 20;\n l = l + 1;\n }while (a <= 99 && a >= 20);\n }\n\n if (a <= 19 && a >= 10)\n {\n do\n {\n a = a - 10;\n l = l + 1;\n }while(a <= 19 && a >= 20);\n }\n\n if (a <= 9 && a >= 5)\n {\n do\n {\n a = a - 5;\n l = l + 1;\n }while(a <= 9 && a >= 5);\n }\n\n if (a <= 4 && a >= 1)\n {\n do\n {\n a = a - 1;\n l = l + 1;\n }while(a <= 4 && a >= 1);\n }\n\n printf(\"\\n%d\\n\", l);\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n long long int n,a,c=0,i;\n int ar[6]={100,50,20,10,5,1};\n scanf(\"%lld\", &n);\n for(i=0;i<=5;i++)\n {\n a=n/ar[i] ;\n c=c+a;\n n=n%ar[i] ;\n }\n {\n printf(\"%lld\",c);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tint n,s=0;\n\tscanf(\"%d\",&n);\n\tif(n>=100)\n\t{\n\t\ts+=n/100;\n\t\tn-=(n/100)*100;\n\t}\n\tif(n>=20)\n\t{\n\t\ts+=n/20;\n\t\tn-=(n/20)*20;\n\t}\n\tif(n>=5)\n\t{\n\t\ts+=n/5;\n\t\tn-=(n/5)*5;\n\t}\n\tif(n>=1)\n\t{\n\t\ts+=n;\n\t\tn=0;\n\t}\n\tprintf(\"%d\\n\",s);\t\n\t\treturn 0;\n\t}"}, {"source_code": "int main() {\n int i,n,sayac=0,rem,change[5]={100,20,10,5,1};\n scanf(\"%d\",&n);\n for(i=0;i<5;i++) {\n rem=n%change[i];\n n/=change[i];\n sayac+=n;\n }\n printf(\"%d\",sayac);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long long int n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%llu\",&n);\n\tif(n>=100)\n\t{\n\t\ta=n/100;\n\t\tn=n-a*100;\n\t}\n\tif(n>=20)\n\t{\n\t\tb=n/20;\n\t\tn=n-b*20;\n\t}\n\tif(n>=5)\n\t{\n\t\tc=n/5;\n\t\tn=n-c*5;\n\t}\n\tif(n>=1)\n\t{\n\t\td=n/1;\n\t\t\n\t} \n\te=a+b+c+d;\n\tprintf(\"%llu\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint num;\n\tprintf(\"enter the number\");\n\tscanf(\"%d\",&num);\n\tint a[5]={1,5,10,20,100};\n\tint i=4,bills=0;\n\twhile(num>0)\n\t{\n\t\tif(num>a[i])\n\t\t{\n\t\t\tbills+=num/a[i];\n\t\t\tnum=num%a[i];\n\t\t}\n\t\ti--;\n\t\t\n\t}\n\tprintf(\"number of bills are %d\",bills);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n if(n>100)\n {\n j=n/100;\n n=n-j*100;\n }\n else if(n>20)\n {\n j=n/20;\n n=n-j*20;\n }\n else if(n>10)\n {\n j=n/10;\n n=n-j*10;\n }\n else if(n>5)\n {\n j=n/5;\n n=n-j*5;\n }\n else if(n>1)\n {\n j=n/1;\n n=n-j*1;\n }\n k=k+j;\n }\n printf(\"%d\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\nint i,min=0,n;\nfloat s;\nscanf(\"%d\",&n);\nint a[6];\na[1]=100;\na[2]=20;\na[3]=10;\na[4]=5;\na[5]=1;\nfor(i=1;i<6;i++){\n s=n/a[i];\n n=n-s*a[i];\n min=min+s;\n}\nprintf(\"%d\",min);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j=0,k=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n if(n%100==0)\n {\n j=n/100;\n n=n-j*100;\n }\n else if(n%20==0)\n {\n j=n/20;\n n=n-j*20;\n }\n else if(n%10==0)\n {\n j=n/10;\n n=n-j*10;\n }\n else if(n%5==0)\n {\n j=n/5;\n n=n-j*5;\n }\n else if(n%1==0)\n {\n j=n/1;\n n=n-j*1;\n }\n k=k+j;\n }\n printf(\"%d\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,ans=0;\n scanf(\"%d\",&n);\n if(n>=100)\n {\n ans += n/100;\n n = n%100;\n }\n if(n>=20)\n {\n ans += n/20;\n n = n%20;\n }\n if(n>=10)\n {\n ans += n/10;\n n = n%20;\n }\n if(n>=5)\n {\n ans += n/5;\n n = n%5;\n }\n ans += n;\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,n,count=0;\n scanf(\"%d\",&n);\n while(n!=0)\n {\n if(n>=1&&n<5)\n {\n count++;\n n=n-1;\n }\n else if(n>=5&&n<10)\n {\n count++;\n n=n-5;\n }\n else if(n>=10&&n<20)\n {\n count++;\n n=n-10;\n }\n else if(n>=20&&n<100)\n {\n count++;\n n=n-20;\n }\n else if(n>=100)\n {\n count++;\n n=n-100;\n }\n } \n printf(\"%d\",n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n int a[]={1,5,10,20,100}, i=0,ans=0, j=0;\n scanf(\"%ld\", &n);\n if(n>a[i] && n<=a[++i])\n {\n ans=n%a[i];\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/(a[i-j]));\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n printf(\"%d\\n\", i);\n }\n else\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n printf(\"%ld\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tlong long int T;\n\tint count = 0;\n\tscanf(\"%lld\",&T);\n\twhile(T >= 100){\n\t\tT-=100;\n\t\tcount++;\n\t}\n\twhile(T >= 20){\n\t\tT-=20;\n\t\tcount++;\n\t}\n\n\twhile(T >= 5){\n\t\tT-=5;\n\t\tcount++;\n\t}\n\twhile(T >= 1){\n\t\tT-=1;\n\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main(){\n int n,c=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(5>n>1){ c++; n-=1;}\n else if(10>n>5){ c++;n-=5;}\n else if(20>n>10){c++;n-=10;}\n else if(100>n>20){c++;n-=20;}\n else {c++;n-=100;}\n }\nprintf(\"%d\",c);\n \n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,a,b,c,d,e,f,s=0,m,k;\n scanf(\"%d\",&n);\n if(n<5)\n { printf(\"%d\",n); }\n\n else if(n<10)\n {\n a=n%5;\n s=s+1+a;\n { printf(\"%d\",s); }\n }\n else if (n<20)\n {\n a=n%10;\n if(a<5)\n {\n s=s+1+a;\n }\n else\n {\n b= a%5;\n s=s+2+b;\n { printf(\"%d\",s); }\n }\n\n }\n else if (n<100)\n {\n a=n/20;\n b= n%20;\n if(b<20)\n {\n if(b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n e=c/5;\n s=s+a+1+e+d;\n { printf(\"%d\",s); }\n\n }\n\n }\n }\n else if (n>=100)\n { a=n/100;\n b=n%100;\n\n if (b<5)\n {\n s=s+a+b;\n { printf(\"%d\",s); }\n }\n else if(b<10)\n {\n c= b%5;\n s=s+a+1+c;\n { printf(\"%d\",s); }\n\n }\n else if(b<20)\n {\n c=b%10;\n d=c%5;\n s=s+a+2+d;\n { printf(\"%d\",s); }\n\n }\n else if(b<100)\n {\n c=b/20;\n d=b%20;\n m=d/10;\n e=d%10;\n k=e/5;\n f=e%5;\n s=s+a+c+f+k;\n { printf(\"%d\",s); }\n }\n\n }\n return 0;\n\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,b=0;\n scanf(\"%d\",&n);\n /*if(n==1||n==5||n==10||n==20||n==100){b=1;}*/\n if(n/100==0)\n {\n if(n/20==0)\n {\n if(n/10==0)\n {\n if(n/5==0){b=b+n;}\n else{b=n-4;}\n }\n else if(n/10!=0)\n {\n if(n%10>=5){b=n-13;}\n else{b=n-9;}\n }\n }\n else if(n/20!=0)\n {\n if(n%20==0){b=n/20;}\n else if(n%20<10){b=n/20+(n%20)/5+(n%20)%5;}\n else if(n%20>10){b=n/20+(n%20)/10+((n%20)%10)%5+((n%20)%10)/5;}\n else if(n%20==10){b=n/20+1;}\n }\n }\n else if(n/100!=0)\n {\n if(n%100<20)\n {\n if(n%100==0){b=n/100;}\n else if(n%100<10){b=n/100+(n%100)/5+(n%100)%5;}\n else if(n%100>10){b=n/100+(n%100)/10+(n%100)%5+(n%100)/5;}\n else if(n%100==10){b=n/100+1;}\n }\n else if(n%100>20){b=n/100+(n%100)/20+((n%100)%20)/10+(((n%100)%20)%10)/5+(((n%100)%20)%10)%5l;}\n else if(n%100==20){b=n/100+1;}\n else if(n%100==0){b=n%100;}\n }\n printf(\"%d\",b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t long long int n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%lld\",&n);\n\t\n\te=(n/100+(n%100)/20 + (n%20)/5 +(n%5)/1);\n\tprintf(\"%lld\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,count=0;\n scanf(\"%d\",&n);\n while(n>0){\n if(n>=100)\n {\n count=n/100;\n n=n-count*100;\n }\n else if(n>=20)\n {\n count=n/20;\n n=n-count*20;\n }\n else if(n>=20){\n count=n/10;\n n=n-count*10;\n }\n else if(n>=5)\n {\n count=n/5;\n n=n-count*5;\n }\n else\n {\n count=n;\n n=n-count;\n }\n}\nprintf(\"%d\",count);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ int i=0,n;\n scanf(\"%d\",&n);\n while(1)\n {\n if(n>=100)\n {\n\n i=i+1;\n n=n-100;}\n else if(n>=20&&n<100)\n { i=i+1;\n n=n-20;\n }\n else\n break;\n }\n if(n>=10&&n<20)\n { i=i+1;\n n=n-10;\n }\n else if(n>=5&&n<10)\n { i=i+1;\n n=n-5;\n }\n\n if(n<5)\n {i=i+n;\n }\n\n\n printf(\"%d\",i);\n}"}, {"source_code": "#include <stdio.h>\n\nint withdraw(int n){\n int res = 0;\n while(n > 0){\n if (n-100 >= 0){\n n = n-100;\n res++;\n } else if (n-20 >= 0){\n n = n - 20;\n res++;\n } else if (n - 10 >= 0){\n n = n - 10;\n res++;\n } else if (n - 5 >= 0){\n n = n - 5;\n res++;\n } else if (n - 1 >= 0){\n n = n -1;\n res++;\n }\n \n }\n printf(\"n = %d\\n\",n);\n return res;\n}\n\n\nint main(){\n printf(\"%d\\n\",withdraw(125));\n printf(\"%d\\n\",withdraw(43));\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tunsigned long int n,c=0,d=0,a=0,b=0,e=0;\n\tscanf(\"%lu\",&n);\n\tif(n>=100)\n\t{\n\t\ta=n/100;\n\t\tn=n-a*100;\n\t}\n\tif(n>=20)\n\t{\n\t\tb=n/20;\n\t\tn=n-b*20;\n\t}\n\tif(n>=5)\n\t{\n\t\tc=n/5;\n\t\tn=n-c*5;\n\t}\n\tif(n>=1)\n\t{\n\t\td=n/1;\n\t\t\n\t} \n\te=a+b+c+d;\n\tprintf(\"%lu\",e);\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int n,nb=0,r,k;\n\n scanf(\"%d\",&n);\n\n while(r!=0)\n {\n if(n>=100)\n { k = n/100;\n r = n%100;\n n = r;\n nb = nb + k;\n }\n if((n>=20)&&(n<100))\n { k = n/20;\n r = n % 20;\n n = r;\n nb = nb + k;\n }\n if((n>=10)&&(n<20))\n {\n k = n/10;\n r = n % 10;\n n = r;\n nb = nb + k;\n }\n if((n>=5)&&(n<10))\n {\n k = n/5;\n r = n % 5;\n n = r;\n nb = nb + k;\n }\n if((n>=1)&&(n<5))\n {\n k = n/1;\n n = r;\n nb = nb + k;\n r = n % 1;\n }\n }\n printf(\"%d\",nb);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,a,b,c=0,ar[]={100,20,10,5,1};\n scanf(\"%ld\",&a);\n for(i=0;i<5;i++){\n if(a>=ar[i]) b=a/ar[i];\n if(a-b*ar[i]<0) continue;\n a=a-b*ar[i];\n c+=b;\n if(a==0) break;\n }\n printf(\"%ld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main (void)\n{\n long long int n;\n int a=0;\n scanf(\"%l64d\",&n);\n while (n>=100)\n {\n n=n-100;\n a=a+1;\n }\n while (n>=20)\n {\n n=n-20;\n a=a+1;\n }\n while (n>=10)\n {\n n=n-10;\n a=a+1;\n }\n while (n>=5)\n {\n n=n-5;\n a=a+1;\n }\n \n while (n>=1)\n {\n n=n-1;\n a=a+1;\n }\n printf(\"%d\",a);\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n int a[]={1,5,10,20,100}, i=0,ans=0, j=0;\n scanf(\"%ld\", &n);\n if(n>a[i] && n<=a[++i])\n {\n ans=n%a[i];\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/(a[i-j]));\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n else if(n>a[i] && n<=a[++i])\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n printf(\"%d\\n\", i);\n }\n else\n {\n for(j=0;j<=i;j++)\n {\n ans = ans+(n/a[i-j]);\n n=n%a[i-j];\n }\n }\n printf(\"%ld\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n1(int);\nint n5(int);\nint n10(int);\nint n20(int);\nint n100(int);\nint main()\n{\n int n,k,t;\n scanf(\"%d\",&t);\n while(t--)\n {\n scanf(\"%d\",&n);\n if(n<5)\n k=n1(n);\n else if(n>=5&&n<10)\n k=n5(n);\n else if(n>=10&&n<20)\n k=n10(n);\n else if(n>=20&&n<=100)\n k=n20(n);\n else if(n>100)\n k=n100(n);\n printf(\"\\n%d\",k);\n }\n}\nint n1(int n)\n{\n return n;\n}\nint n5(int n)\n{\n if(n>=5)\n return (1 + n1(n-5));\n else\n return n1(n);\n}\nint n10(int n)\n{\n if(n>=10)\n return (1 + n5(n-10));\n else\n return n5(n);\n}\nint n20(int n)\n{\n if(n>=20)\n return (n/20 + n10(n-(n/20)*20));\n else\n return n10(n);\n}\nint n100(int n)\n{\n if(n>100)\n return (n/100 + n20(n-(n/100)*100));\n else\n return n20(n);\n}"}, {"source_code": "#include<stdio.h>\nvoid main()\n{\n int i,j,a[5][5],x1,y1;\n for(i=0;i<5; i++)\n for(j=0; j<5; j++)\n {\n scanf(\"%d\", &a[i][j]);\n if(a[i][j]==1)\n {\n x1=i-2;\n y1=j-2;\n }\n }\n if(x1<0)\n x1=-x1;\n if(y1<0)\n y1=-y1;\n printf(\"%d\",x1+y1);\n exit(0);\n}"}], "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc"} {"nl": {"description": "One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. The following statement caught his attention: \"Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people\"Igor just couldn't get why the required minimum is 6 people. \"Well, that's the same for five people, too!\" \u2014 he kept on repeating in his mind. \u2014 \"Let's take, say, Max, Ilya, Vova \u2014 here, they all know each other! And now let's add Dima and Oleg to Vova \u2014 none of them is acquainted with each other! Now, that math is just rubbish!\"Igor K. took 5 friends of his and wrote down who of them is friends with whom. Now he wants to check whether it is true for the five people that among them there are either three pairwise acquainted or three pairwise not acquainted people.", "input_spec": "The first line contains an integer m (0\u2009\u2264\u2009m\u2009\u2264\u200910), which is the number of relations of acquaintances among the five friends of Igor's. Each of the following m lines contains two integers ai and bi (1\u2009\u2264\u2009ai,\u2009bi\u2009\u2264\u20095;ai\u2009\u2260\u2009bi), where (ai,\u2009bi) is a pair of acquainted people. It is guaranteed that each pair of the acquaintances is described exactly once. The acquaintance relation is symmetrical, i.e. if x is acquainted with y, then y is also acquainted with x.", "output_spec": "Print \"FAIL\", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print \"WIN\".", "sample_inputs": ["4\n1 3\n2 3\n1 4\n5 3", "5\n1 2\n2 3\n3 4\n4 5\n5 1"], "sample_outputs": ["WIN", "FAIL"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\nint main()\n{\n int n, i, a[6]={0}, x, y;\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d %d\", &x, &y);\n a[x]++;\n a[y]++;\n if(a[x]==3 || a[y]==3)\n {\n printf(\"WIN\\n\");\n return 0;\n }\n }\n for(i=1; i<=5; i++)\n if(a[i]<=1)\n {\n printf(\"WIN\\n\");\n return 0;\n }\n printf(\"FAIL\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int in1,in2,people[5];\n int m,n,i,flg=0;\n for(i=0;i<5;i++) people[i]=0;\n scanf(\"%d\",&m);\n for(i=0;i<m;i++){\n scanf(\"%d %d\",&in1,&in2);\n people[in1-1]++;\n people[in2-1]++;\n }\n for(i=0;i<5;i++){\n if(people[i]!=2){\n puts(\"WIN\");\n flg=1;\n break;\n }\n }\n if(flg!=1) puts(\"FAIL\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n\tint n, i, j, k, x = 0, y = 0;\n\tint m[5][5];\n\n\tfor(i = 0; i < 5; i++) {\n\t\tfor(j = 0; j < 5; j++) { \n\t\t\tm[i][j] = 0;\n\t\t}\n\t}\n\n\tscanf(\"%d\", &n);\n\n\twhile(n > 0) {\n\n\t\tscanf(\"%d %d\", &x, &y);\n\t\tm[x-1][y-1] = 1;\n\t\tm[y-1][x-1] = 1;\n\t\tn--;\n\t}\n\t\n\tfor(i = 0; i < 5; i++) {\n\n\t\tfor(j = i + 1; j < 5; j++) {\n\n\t\t\tfor(k = j + 1; k < 5; k++) {\n\n\t\t\t\tif(m[i][j] == m[j][k] && m[i][j] == m[i][k]) {\n\n\t\t\t\t\tprintf(\"WIN\\n\");\n\t\t\t\t\texit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"FAIL\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n\tint i, j, k, relations[6][6] ;\n\t\n\tfor (i = 0 ; i < 6 ; i++)\n\t{\n\t\tfor (j = 0 ; j < 6 ; j++)\n\t\t{\n\t\t\trelations[i][j] = 0 ;\n\t\t}\n\t}\n\t\n\tscanf(\"%d\", &k) ;\n\t\n\twhile (k-- > 0)\n\t{\n\t\tscanf(\"%d %d\", &i, &j) ;\n\t\t\n\t\trelations[i][j] = relations[j][i] = 1 ;\n\t}\n\t\n\tfor (i = 1 ; i <= 3 ; i++)\n\t{\n\t\tfor (j = i + 1 ; j <= 4 ; j++)\n\t\t{\n\t\t\tfor (k = j + 1 ; k <= 5 ; k++)\n\t\t\t{\n\t\t\t\tif ((relations[i][j] && relations[j][k] && relations[k][i]) || !(relations[i][j] || relations[j][k] || relations[k][i]))\n\t\t\t\t{\n\t\t\t\t\tprintf(\"WIN\") ;\n\t\t\t\t\treturn 0 ;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"FAIL\") ;\n\t\t\n\treturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m, i, j, k;\n int a[5][5] = {0};\n\n scanf(\"%d\", &m);\n\n for (i = 0; i < m; i++) {\n\t int x, y;\n\n\t scanf(\"%d %d\", &x, &y);\n\n\t a[x - 1][y - 1]++;\n\t a[y - 1][x - 1]++;\n }\n\n for (i = 0; i < 5; i++) {\n\t for (j = i + 1; j < 5; j++) {\n\t for (k = j + 1; k < 5; k++) {\n\t\t if (a[i][j] == 1 && a[j][k] == 1 && a[k][i] == 1) {\n\t\t\t puts(\"WIN\");\n\n\t\t\t return 0;\n\t\t }\n\t\t if (a[i][j] == 0 && a[j][k] == 0 && a[k][i] == 0) {\n\t\t\t puts(\"WIN\");\n\n\t\t\t return 0;\n\t\t }\n\t }\n\t }\n }\n\n puts(\"FAIL\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a[5][5];\n int i,j,k,m;\n memset(a, 0, sizeof(a));\n scanf(\"%d\", &m);\n for (k = 0; k < m; k++) {\n scanf(\"%d%d\", &i, &j);\n a[i-1][j-1] = 1;\n a[j-1][i-1] = 1;\n }\n int f1 = 0, f2 = 0;\n for (i = 0; i < 5; i++) {\n for (j = 0; j < i; j++) {\n for (k = 0; k < j; k++) {\n if (a[i][j] && a[i][k] && a[j][k]) {\n f1 = 1;\n }\n if (!a[i][j] && !a[i][k] && !a[j][k]) {\n f2 = 1;\n }\n }\n }\n }\n if (!f1 && !f2) {\n printf(\"FAIL\\n\");\n } else {\n printf(\"WIN\\n\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include \"stdio.h\"\n\nint main()\n{\n\tint r[5][5] = {{0}};\t\n\tint a,b,m,i,j,p;\n\n\tscanf(\"%d\",&m);\n\tfor(i=0; i<m; i++){\n\t\tscanf(\"%d %d\",&a, &b);\n\t\tr[a-1][b-1] = 1;\n\t\tr[b-1][a-1] = 1;\n\t}\n\n\tfor(i=0; i<5; i++){\n\t\tfor(j=0; j<5; j++){\n\t\t\tif(j==i)\n\t\t\t\tcontinue;\n\n\t\t\tif(r[i][j]){\n\t\t\t\tfor(p=0;p<5;p++){\n\t\t\t\t\tif(p==j || p==i || i==j)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(r[j][p] && r[p][i]){\n//\t\t\t\t\t\tprintf(\"A) %d %d %d\\n\",i+1,j+1,p+1);\n\t\t\t\t\t\tprintf(\"WIN\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(i=0; i<5; i++){\n\t\tif(j==i)\n\t\t\tcontinue;\n\n\t\tfor(j=0; j<5; j++){\n\t\t\tif(!r[i][j]){\n\t\t\t\tfor(p=0;p<5;p++){\n\t\t\t\t\t\n\t\t\t\t\tif(p==j || p==i || i==j)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\tif(!r[j][p] && !r[p][i]){\n//\t\t\t\t\t\tprintf(\"B) %d %d %d\\n\",i+1,j+1,p+1);\n\t\t\t\t\t\tprintf(\"WIN\\n\");\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"FAIL\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[]={0,0,0,0,0,0};\nint main()\n{\n int i,m,t1,t2;\n scanf(\"%d\",&m);\n for (i=0;i!=m;i++)\n {\n scanf(\"%d%d\",&t1,&t2);\n a[t1]++; a[t2]++;\n }\n for (i=1;i!=6;i++)\n {\n if (a[i]<=1 || a[i]>=3)\n {\n printf(\"WIN\\n\");\n return 0;\n }\n }\n printf(\"FAIL\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int m;\n int i, j, k;\n int a, b;\n int map[11][11];\n while (scanf(\"%d\", &m) == 1) {\n memset(map, 0, sizeof(map));\n for (i = 0; i < m; i++) {\n scanf(\"%d%d\", &a, &b);\n map[a][b] = map[b][a] = 1;\n }\n for (i = 1; i <= 5; i++) {\n for (j = i+1; j <= 5; j++) {\n for (k = j+1; k <= 5; k++) {\n if (map[i][j] && map[j][k] && map[k][i]) {\n printf(\"WIN\\n\");\n goto X;\n }\n if (!map[i][j] && !map[j][k] && !map[k][i]) {\n printf(\"WIN\\n\");\n goto X;\n }\n }\n }\n }\n printf(\"FAIL\\n\");\nX: ;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint d[10][10];\nint check(int a,int b,int c)\n{\n if(d[a][b]==1&&d[a][c]==1&&d[b][a]==1&&d[b][c]==1&&d[c][a]==1&&d[c][b]==1)\n return 1;\n if(d[a][b]==0&&d[a][c]==0&&d[b][a]==0&&d[b][c]==0&&d[c][a]==0&&d[c][b]==0)\n return 1;\n return 0;\n}\nint main(void)\n{\n \n int n,i,j,k,x,y;\n scanf(\"%d\",&n);\n while(n--)\n {\n scanf(\"%d%d\",&x,&y);\n d[x][y]=1;\n d[y][x]=1;\n }\n int flag=0;\n for(i=1;i<=5;i++)\n {\n for(j=i+1;j<=5;j++)\n {\n for(k=j+1;k<=5;k++)\n {\n if(check(i,j,k))\n {\n flag=1; \n }\n }\n }\n }\n if(flag) printf(\"WIN\\n\");\n else printf(\"FAIL\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[6][6];\nint main()\n{\n int n,i,j,k,x,y;\n scanf(\"%d\",&n);\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5;j++)\n {\n a[i][j]=0;\n }\n }\n for(i=1;i<=n;i++)\n {\n scanf(\"%d%d\",&x,&y);\n a[x][y]=1;\n a[y][x]=1;\n }\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5 && j!=i;j++)\n {\n if(a[i][j]==1)\n {\n for(k=1;k<=5 && k!=i && k!=j;k++)\n {\n if(a[j][k]==1 && a[k][i]==1)\n {\n printf(\"WIN\");\n return 0;\n }\n }\n }\n if(a[i][j]==0)\n {\n for(k=1;k<=5 && k!=i && k!=j;k++)\n {\n if(a[j][k]==0 && a[k][i]==0)\n {\n printf(\"WIN\");\n return 0;\n }\n }\n }\n }\n }\n printf(\"FAIL\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint in(int a, int b);\n\nint main()\n{\n int r[10];\n int relations;\n int i;\n int x;\n int y;\n int one, two, three, four, five, six, seven, eight, nine, ten;\n\n for(i = 0; i < 10; i++)\n {\n r[i] = 0;\n }\n scanf(\"%d\\n\", &relations);\n for(i = 0; i < relations; i++)\n {\n scanf(\"%d %d\\n\", &x, &y);\n if(x < y)\n r[in(x,y)] = 1;\n else\n r[in(y,x)] = 1;\n }\n/*\n for(i = 0; i < 10; i++)\n printf(\"%d\\n\", r[i]);\n*/\n\n\n one = r[0]+r[1]+r[4];\n two = r[0]+r[2]+r[5];\n three = r[0]+r[3]+r[6];\n four = r[1]+r[2]+r[7];\n five = r[1]+r[3]+r[8];\n six = r[2]+r[3]+r[9];\n seven = r[4]+r[5]+r[7];\n eight = r[4]+r[6]+r[8];\n nine = r[5]+r[6]+r[9];\n ten = r[7]+r[8]+r[9];\n\n /*printf(\"%d %d %d %d %d %d %d %d %d %d\\n\", one, two, three, four,\n * five, six, seven, eight, nine, ten);*/\n\n if((0 == one || 3 == one) || (0 == two || 3 ==two ) || (0 == three || 3 == three) || (0 == four || 3 == four) || (0 == five || 3 == five) || (0 == six || 3 == six) || (0 == seven || 3 == seven) || (0 == eight || 3 == eight) || (0 == nine || 3 == nine) || (0 == ten || 3 == ten))\n printf(\"WIN\\n\");\n else\n printf(\"FAIL\\n\");\n}\n\n\n/*return the index that the pair should be stored at*/\nint in(int a, int b)\n{\n if(1 == a)\n {\n if(2 == b)\n return 0;\n if(3 == b)\n return 1;\n if (4 == b)\n return 2;\n if (5 == b)\n return 3;\n }\n if (2 == a)\n {\n if(3 == b)\n return 4;\n if(4 == b)\n return 5;\n if(5 == b)\n return 6;\n }\n if (3 == a)\n {\n if(4 == b)\n return 7;\n if(5 == b)\n return 8;\n }\n if (4 == a)\n {\n if(5 == b)\n return 9;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint a[101][101];\n//int ans[10000];\n//int c[1500];\n\n\nint main()\n{\n int n,m,i,p,q,r,j,k,temp,min,flag;\n n=5;\n scanf(\"%d\",&m);\n for(i=0;i<=100;i++)\n for(j=0;j<100;j++)\n a[i][j]=0;\n\t\n\tfor(i=0;i<m;i++)\n\t{\n\t\tscanf(\"%d%d\",&p,&q);\n\t\ta[p][q]=1;\n\t\ta[q][p]=1;\n\t}\n flag=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\t\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\t\tfor(k=1;k<=n;k++)\n\t\t\t\t{\n\t\t\t\t\tif((i!=j&&j!=k&&k!=i)&&((a[i][j]&&a[j][k]&&a[k][i])||(!a[i][j]&&!a[j][k]&&!a[k][i])))\n\t\t\t\t\t{\n \n printf(\"WIN\");\n flag=1;\n \n\t\t\t\t\t}\n if(flag==1)\n break;\n\t\t\t\t}\n if(flag==1)\n break;\n\t\t}\t\n if(flag==1)\n break;\n\t}\n\tif(flag==0)\n printf(\"FAIL\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint a[6][6];\nint color[6];\n\nint dfs(int v, int h, int id){\n int i, ans = 0;\n if (h > 3){\n return 0;\n }\n color[v] = h;\n for (i = 1; i < 6; i++){\n if (abs(id - a[v][i])){\n if (!color[i]){\n ans += dfs(i, h + 1, id);\n }else{\n if (h == 3 && color[i] == 1){\n return 1;\n }\n }\n }\n }\n return ans;\n}\nint predfs(int id){\n int i, j, ans = 0;\n for (i = 1; i < 6; i++){\n for (j = 1; j < 6; j++){\n color[j] = 0;\n }\n if (!color[i]){\n ans += dfs(i, 1, id);\n }\n }\n return ans;\n}\nint main(void)\n{\n int m, c, b = 1, i, j;\n scanf(\"%d\", &m);\n for (i = 1; i < 6; i++){\n for (j = j; j < 6; j++){\n a[i][j] = 0;\n }\n }\n for (i = 0; i < m; i++){\n scanf(\"%d%d\", &c, &b);\n a[c][b] = a[b][c] = 1;\n }\n if (predfs(1) || predfs(0)){\n printf(\"WIN\");\n } else{\n printf(\"FAIL\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t\tint m, x, y;\n\t\tchar a[5][5] = {}, i, j, k, s, win;\n\n\t\tscanf(\"%d\\n\", &m);\n\t\twhile(m--)\n\t\t{\n\t\t\tscanf(\"%d%d\", &x, &y);\n\t\t\t--x, --y, a[x][y] = a[y][x] = 1;\n\t\t}\n\n\t\twin = 0;\n\t\tfor (i = 0; i < 5; ++i)\n\t\t\tfor (j = 0; j < i; ++j)\n\t\t\t\tfor (k = 0; k < j; ++k)\n\t\t\t\t{\n\t\t\t\t\ts = a[i][j] + a[j][k] + a[k][i];\n\t\t\t\t\tif (s == 3 || s == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\twin = 1;\n\t\t\t\t\t\tgoto end;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\tend:\n\t\tif (win)\n\t\t\tputs(\"WIN\\n\");\n\t\telse\n\t\t\tputs(\"FAIL\\n\");\n\n\t\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t\tint a[5][5] = {};\n\n\t\tint m, i, j, k;\n\t\tscanf(\"%d\", &m);\n\t\twhile(m--)\n\t\t{\n\t\t\tscanf(\"%d%d\", &i, &j);\n\t\t\t--i;\n\t\t\t--j;\n\t\t\ta[i][j] = a[j][i] = 1;\n\t\t}\n\n\t\tint win = 0;\n\t\tfor (i = 0; i < 5; ++i)\n\t\t\tfor (j = 0; j < i; ++j)\n\t\t\t\tfor (k = 0; k < j; ++k)\n\t\t\t\t\tif (a[i][j] == 1 && a[j][k] == 1 && a[k][i] == 1 || a[i][j] == 0 && a[j][k] == 0 && a[k][i] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\twin = 1;\n\t\t\t\t\t\tgoto end;\n\t\t\t\t\t}\n\t\tend:\n\t\tif (win)\n\t\t\tputs(\"WIN\\n\");\n\t\telse\n\t\t\tputs(\"FAIL\\n\");\n\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int m,i,a[10]={0},l,r;\n scanf(\"%d\",&m);\n while(m--)\n {\n scanf(\"%d%d\",&l,&r);\n a[l]++;\n a[r]++;\n }\n for(i=1;i<=5;i++)\n if(a[i]>=3 || a[i]<2)\n break;\n if(i==6)\n printf(\"FAIL\\n\");\n else\n printf(\"WIN\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint check(int map[6][6])\n{\n int ans,i,j,k,s;\n \n ans=0;\n for (i=1;i<=5;i++)\n {\n if (map[i][0]<2)\n continue; \n \n for (j=1;j<=5;j++)\n {\n if (map[i][j]==1)\n {\n s=j;\n for (k=1;k<=5;k++)\n if (k!=i&&map[s][k]==1&&map[k][i]==1)\n {\n ans=1;\n break;\n }\n }\n \n if (ans==1)\n break;\n }\n \n if (ans==1)\n break;\n }\n \n return ans;\n}\n \nmain()\n{\n int map1[6][6],map2[6][6],i,j,n,u,v,ans;\n \n memset(map1,0,sizeof(map1));\n scanf(\"%d\",&n);\n for (i=0;i<n;i++)\n {\n scanf(\"%d%d\",&u,&v);\n map1[u][0]++;\n map1[v][0]++;\n map1[u][v]=map1[v][u]=1;\n }\n \n ans=check(map1);\n if (ans==0)\n {\n memset(map2,0,sizeof(map2));\n for (i=1;i<=5;i++)\n {\n map2[i][0]=4-map1[i][0];\n for (j=1;j<=5;j++)\n if (i!=j)\n map2[i][j]=1-map1[i][j];\n }\n \n ans=check(map2);\n }\n \n printf(\"%s\\n\",ans==0?\"FAIL\":\"WIN\"); \n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint m,i,a,b,x[10]={0};\n\tscanf(\"%d\",&m);\n \n\t\tfor(i=0;i<m;i++)\n\t\t{\n\t\t\tscanf(\"%d%d\",&a,&b);\n\t\t\tx[a]++;x[b]++;\n\t\t}\n\t\tfor(i=1;i<=5;i++)\n\t\t{\n\t\t\tif(x[i]!=2)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(i>5)\n\t\t{\n\t\t\tprintf(\"FAIL\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"WIN\\n\");\n\t\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint static i,j,k,a,b,n,x[6][6],f=0;\n\tscanf(\"%d\",&n);\n\twhile (n--){\n\t\tscanf(\"%d%d\",&a,&b);\n\t\tx[a][b]=x[b][a]=1;\n\t}\n//\tfor (i=1;i<6;i++){\n//\t\tfor (j=1;j<6;j++)\n//\t\t\tprintf(\"%d \",x[i][j]);\n//\t\tprintf(\"\\n\");\n//\t}\n\tfor (i=1;i<=5;i++){\n\t\tfor (j=1;j<=5;j++){\n\t\t\tif (i==j)\n\t\t\t\tcontinue;\n\t\t\tfor (k=1;k<=5;k++){\n\t\t\t\tif (i==k || j==k)\n\t\t\t\t\tcontinue;\n\t\t\t\tif (x[i][j]==x[j][k] && x[i][j]==x[i][k]){\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (f==1)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (f==1)\n\t\t\tbreak;\n\t}\n\tif (f==1)\n\t\tprintf(\"WIN\\n\");\n\telse\n\t\tprintf(\"FAIL\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint r[5][5],i,j,k,n,p,q,z;\nmain()\n{\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n scanf(\"%d%d\",&p,&q),r[p-1][q-1]=r[q-1][p-1]=1;\n\n for(i=0;i<5;i++)\n for(j=i+1;j<5;j++)\n for(k=j+1;k<5;k++)\n z+=((r[i][j]+r[j][k]+r[k][i]==0) || (r[i][j]*r[j][k]*r[k][i]==1));\n\n puts(z?\"WIN\":\"FAIL\");\n return 0;\n}\n\n\n"}, {"source_code": "/**\n nayeem\n dated, dhaka,\n 30th June, 2011\n Codeforces 76\n Div 2\n B: Friends\n**/\n\n#include <stdio.h>\n#include <string.h>\n\nint p[] = {1, 2, 3, 4, 5};\nint ans[3];\nint G[6][6];\n\nint backtrack(int ind, int pos)\n{\n int i, j, node, w[3];\n if (pos == 3)\n {\n memset(w, 0, sizeof(w));\n node = ans[0];\n if (G[node][ans[1]] && G[node][ans[2]]) w[0] = 2;\n node = ans[1];\n if (G[node][ans[0]] && G[node][ans[2]]) w[1] = 2;\n node = ans[2];\n if (G[node][ans[0]] && G[node][ans[1]]) w[2] = 2;\n if (w[0] + w[1] + w[2] == 6)\n { \n return 1;\n }\n \n \n memset(w, -1, sizeof(w));\n node = ans[0];\n if (!G[node][ans[1]] && !G[node][ans[2]]) w[0] = 0;\n node = ans[1];\n if (!G[node][ans[0]] && !G[node][ans[2]]) w[1] = 0;\n node = ans[2];\n if (!G[node][ans[0]] && !G[node][ans[1]]) w[2] = 0;\n if (w[0] + w[1] + w[2] == 0)\n { \n return 1;\n }\n return 0;\n } \n for (i=ind; i<5; i++)\n {\n ans[pos] = p[i];\n if (backtrack(i + 1, pos + 1)) return 1;\n }\n return 0;\n}\n\nint main(void)\n{\n int m, i, j, u, v;\n /*\n freopen(\"C:\\\\input.txt\", \"rt\", stdin);\n freopen(\"C:\\\\output.txt\", \"wt\", stdout);\n */\n while (1 == scanf(\"%d\", &m))\n {\n memset(G, 0, sizeof(G));\n for (i=1; i<=m; i++)\n {\n scanf(\"%d %d\", &u, &v); \n G[u][v] = 1;\n G[v][u] = 1;\n }\n \n if (backtrack(0, 0))\n printf(\"WIN\\n\");\n else\n printf(\"FAIL\\n\"); \n }\n \n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n\nint a[6][6];\n\nint main() {\n\tint i,j,k,f=0,m;\n\tscanf(\"%d\",&m);\n\tfor(i=0;i<m;i++) scanf(\"%d %d\",&j,&k),a[j-1][k-1]=a[k-1][j-1]=1;\n\tfor(i=0;i<5;i++) for(j=0;j<5;j++) if (i!=j)\n\t\tfor(k=0;k<5;k++) if (i!=k && j!=k && a[i][j]==a[j][k] && a[j][k]==a[k][i]) f=1;\n\tif (f) puts(\"WIN\"); else puts(\"FAIL\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,k,a[100][100],n,x,y,flag=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<=5;i++)\n\t for(j=0;j<=5;j++)\n\t a[i][j]=0;\n\tfor(i=0;i<n;i++)\n\t{\n\tscanf(\"%d%d\",&x,&y);\n\ta[x][y]=1;\n\ta[y][x]=1;\n\t}\n\t\n\tfor(i=1;i<=5;i++)\n\t for(j=i+1;j<=5;j++)\n\t for(k=j+1;k<=5;k++)\n\t {\n\t \tif(a[i][j]==1 && a[i][k]==1 && a[j][k]==1) flag=1;\n\t \telse if(a[i][j]!=1 && a[i][k]!=1 && a[j][k]!=1) flag=1;\n\t \t\n\t }\n\t if(flag==1) printf(\"WIN\\n\");\n\t else printf(\"FAIL\\n\");\nreturn 0;\n}\n\t \n\t\n"}, {"source_code": "#include <stdio.h>\n\nint l[11][11];\n\nint main()\n{\n int i,j,k,n,a,b;\n scanf(\"%d\",&n);\n for (i=1;i<=n;i++)\n {\n scanf(\"%d%d\",&a,&b);\n l[a][b]=l[b][a]=1;\n }\n for (i=1;i<=5;i++)\n for (j=i+1;j<=5;j++)\n for (k=j+1;k<=5;k++)\n if (l[i][j]&&l[i][k]&&l[k][j]||!l[i][j]&&!l[i][k]&&!l[k][j])\n {\n puts(\"WIN\");\n goto end;\n }\n puts(\"FAIL\");\n end:\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint l[11][11];\n\nint main()\n{\n int i,j,k,n,a,b;\n scanf(\"%d\",&n);\n for (i=1;i<=n;i++)\n {\n scanf(\"%d%d\",&a,&b);\n l[a][b]=l[b][a]=1;\n }\n for (i=1;i<=5;i++)\n for (j=i+1;j<=5;j++)\n for (k=j+1;k<=5;k++)\n if (l[i][j]&&l[i][k]&&l[k][j]||!l[i][j]&&!l[i][k]&&!l[k][j])\n {\n puts(\"WIN\");\n goto end;\n }\n puts(\"FAIL\");\n end:\n return 0;\n}\n"}, {"source_code": "/*\n Tardes de Coding Sesi\u00f3n 3\n B - Friends\n A01208964 - Dom\u00e9nica Renter\u00eda\n*/\n\n#include <stdio.h>\n\n#define amigos 5\n\nint main(){\n\nint arr[amigos] = {};\nint m, a, b;\n// m -> # de relaciones entre los 5 amixes\n// (a, b) relacion\n// a -> persona 1\n// b -> persona 2\n\nscanf(\"%i\", &m);\nif (m == 0){\n\tprintf(\"WIN\\n\");\n\treturn 0;\n}\n\nint i=0;\n\n// con este do-while, vamos a contar el numero de relaciones por persona\n// con base a su n\u00famero, si sale, se le suma al arreglo en su posici\u00f3n\n\ndo {\n\tscanf(\"%i %i\", &a, &b);\n arr[a-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", a, arr[a-1]++);\n arr[b-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", b, arr[b-1]++);\n\ti++;\n} while (i < m);\n\ni=0;\n\n// en este do-while checamos todo el arreglo\n// si alguno tiene un valor diferente \n\ndo {\n\tif(arr[i] != 2){\n \tprintf(\"WIN\\n\");\n \treturn 0;\n }\n\ti++;\n} while (i < amigos);\n\nprintf(\"FAIL\\n\");\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\tscanf(\"%d\", &n_cone);\n\tint l, r;\n\tint cnt = 0;\n\tint\ttab[6];\n\tchar *res = \"FAIL\";\n\tmemset(tab, 0, sizeof(tab));\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &l, &r);\n\t\ttab[l] = tab[l] + 1;\n\t\ttab[r] = tab[r] + 1;\n\t\ti++;\n\t}\n\ti = 1;\n\twhile (i <= 5)\n\t{\n\t\tif (tab[i] != 2)\n\t\t\tres = \"WIN\";\n\t\ti++;\n\t}\n\tprintf(\"%s\", res);\n\texit(0);\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar str[5][5];\n\tfor (int j = 0; j < 5; j++)\n\t{\n\t\tfor (int i = 0; i < 5; i++)\n\t\t\tstr[j][i] = '0';\n\t}\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tint a, b;\n\t\tscanf(\"%d %d\", &a, &b);\n\t\tstr[a - 1][b - 1] = '1';\n\t\tstr[b - 1][a - 1] = '1';\n\t}\n\tfor (int x = 0; x < 5; x++)\n\t{\n\t\tfor (int y = x + 1; y < 5; y++)\n\t\t{\n\t\t\tfor (int z = y + 1; z < 5; z++)\n\t\t\t{\n\t\t\t\tif ((str[x][y] == '1'\t&& str[x][z] == '1' && str[y][z] == '1') || (str[x][y] == '0'\t&& str[x][z] == '0' && str[y][z] == '0'))\n\t\t\t\t{\n\t\t\t\t\tprintf(\"WIN\");\n\t\t\t\t\treturn (0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"FAIL\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n\n if(relations<=4){\n printf(\"WIN\");\n }\n else {\n /*aux=pairwise[0][0];\n aux2=pairwise[0][1];\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }*/\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 >= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n int tabla[5][5];\n for(int i = 0; i < 5; i++){\n for(int j = 0; j < 5; j++){\n tabla[i][j] = 0;\n }\n }\n int n;\n scanf(\"%d\", &n);\n \n for(int i = 0; i < n; i++){\n int a,b;\n scanf(\"%d %d\", &a, &b);\n tabla[a-1][b-1] = 1;\n tabla[b-1][a-1] = 1;\n }\n\n int Igaz = 0;\n int Hamis = 0;\n \n for(int i = 0; i < 4; i++){\n for(int j = i+1; j < 5; j++){\n //printf(\"i:%d, j: %d\\n\", i, j);\n /* jarjuk be a tablat */\n int Helyes = 1;\n int Helytelen = 1;\n for(int k = 0; k < 5; k++){\n\tfor(int l = 0; l < 5; l++){\n\t if(!(k == i || k == j || l == i || l == j) && (k != l)){\n\t //printf(\"k:%d, l: %d\\n\", k, l);\n\t if(tabla[k][l] != 1) Helyes = 0;\n\t if(tabla[k][l] == 1) Helytelen = 0;\n\t }\n\t}\n }\n if(Helyes) Igaz = 1;\n if(Helytelen) Hamis = 1;\n \n } \n }\n\n if(Igaz || Hamis) printf(\"WIN\");\n else printf(\"FAIL\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int m,i,a[10]={0},l,r;\n scanf(\"%d\",&m);\n while(m--)\n {\n scanf(\"%d%d\",&l,&r);\n a[l]++;\n a[r]++;\n }\n for(i=1;i<=5;i++)\n if(a[i]>=3 || a[i]<2)\n break;\n if(i==6)\n printf(\"FAIL\\n\");\n else\n printf(\"WIN\\n\");\n return 0;\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\nint main()\n{\n int n, i, a[6]={0}, x, y;\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d %d\", &x, &y);\n a[x]++;\n a[y]++;\n if(a[x]==3 || a[y]==3)\n {\n printf(\"WIN\\n\");\n return 0;\n }\n }\n for(i=1; i<=5; i++)\n if(a[i]==1)\n {\n printf(\"WIN\\n\");\n return 0;\n }\n printf(\"FAIL\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int in1,in2,people[5];\n int m,n,i,flg=0;\n for(i=0;i<5;i++) people[i]=0;\n scanf(\"%d\",&m);\n for(i=0;i<m;i++){\n scanf(\"%d %d\",&in1,&in2);\n people[in1]++;\n people[in2]++;\n }\n for(i=0;i<5;i++){\n if(people[i]==1 || people[i]==3){\n puts(\"WIN\");\n flg=1;\n break;\n }\n }\n if(flg!=1) puts(\"FAIL\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int in1,in2,people[5];\n int m,n,i,flg=0;\n for(i=0;i<5;i++) people[i]=0;\n scanf(\"%d\",&m);\n for(i=0;i<m;i++){\n scanf(\"%d %d\",&in1,&in2);\n people[in1-1]++;\n people[in2-1]++;\n }\n for(i=0;i<5;i++){\n if(people[i]==1 || people[i]==3){\n puts(\"WIN\");\n flg=1;\n break;\n }\n }\n if(flg!=1) puts(\"FAIL\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint quantidade_de_amigos(int *amigos) {\n\n\tint i;\n\n\tfor(i = 0; i < 5; i++) {\n\n\t\tif(amigos[i] >= 3) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nvoid percorre_vetor(int *v, int n, int *amigos) {\n\n\tint i, j, elemento = 1, contador;\n\tcontador = 0;\n\n\tfor(i = 0; i < 5; i++) {\n\n\t\tcontador = 0;\n\t\tfor(j = 0; j < n; j++) {\n\n\t\t\tif(v[j] == elemento) {\n\t\t\t\tcontador++;\n\t\t\t}\t\n\t\t}\n\n\t\tamigos[i] = contador;\n\t\telemento++;\n\t}\n}\n\nint main() {\n\n\tint i, n;\n\n\tscanf(\"%d\", &n);\n\n\tint *v = (int*) malloc((2 * n) * sizeof(int));\n\tint *amigos = (int*) malloc(5 * sizeof(int));\n\n\tfor(i = 0; i < (2 * n); i++) {\n\n\t\tscanf(\"%d\", &v[i]);\n\t}\n\n\tpercorre_vetor(v, (2 * n), amigos);\n\n\tif(n == 1) {\n\t\tprintf(\"WIN\\n\");\n\t}\n\telse if(quantidade_de_amigos(amigos)) {\n\t\tprintf(\"WIN\\n\");\n\t}\n\telse {\n\t\tprintf(\"FAIL\\n\");\n\t}\n\n\tfree(v);\n\tfree(amigos);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint quantidade_de_amigos(int *amigos) {\n\n\tint i;\n\n\tfor(i = 0; i < 5; i++) {\n\n\t\tif(amigos[i] >= 3) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}\n\nvoid percorre_vetor(int *v, int n, int *amigos) {\n\n\tint i, j, elemento = 1, contador;\n\tcontador = 0;\n\n\tfor(i = 0; i < 5; i++) {\n\n\t\tcontador = 0;\n\t\tfor(j = 0; j < n; j++) {\n\n\t\t\tif(v[j] == elemento) {\n\t\t\t\tcontador++;\n\t\t\t}\t\n\t\t}\n\n\t\tamigos[i] = contador;\n\t\telemento++;\n\t}\n}\n\nint main() {\n\n\tint i, n;\n\n\tscanf(\"%d\", &n);\n\n\tint *v = (int*) malloc((2 * n) * sizeof(int));\n\tint *amigos = (int*) malloc(5 * sizeof(int));\n\n\tfor(i = 0; i < (2 * n); i++) {\n\n\t\tscanf(\"%d\", &v[i]);\n\t}\n\n\tpercorre_vetor(v, (2 * n), amigos);\n\n\tif(quantidade_de_amigos(amigos)) {\n\t\tprintf(\"WIN\\n\");\n\t}\n\telse {\n\t\tprintf(\"FAIL\\n\");\n\t}\n\n\tfree(v);\n\tfree(amigos);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int m, i, j, k;\n int a[5][5] = {0};\n\n scanf(\"%d\", &m);\n\n for (i = 0; i < m; i++) {\n\t int x, y;\n\n\t scanf(\"%d %d\", &x, &y);\n\n\t a[x - 1][y - 1]++;\n\t a[y - 1][x - 1]++;\n }\n\n for (i = 0; i < 5; i++) {\n\t for (j = i + 1; j < 5; i++) {\n\t for (k = j + 1; k < 5; k++) {\n\t\t if (a[i][j] == 1 && a[j][k] == 1 && a[k][i] == 1) {\n\t\t\t puts(\"WIN\");\n\n\t\t\t return 0;\n\t\t }\n\t\t if (a[i][j] == 0 && a[j][k] == 0 && a[k][i] == 0) {\n\t\t\t puts(\"WIN\");\n\n\t\t\t return 0;\n\t\t }\n\t }\n\t }\n }\n\n puts(\"FAIL\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int m;\n int i, j, k;\n int a, b;\n int map[11][11];\n while (scanf(\"%d\", &m) == 1 && m) {\n memset(map, 0, sizeof(map));\n for (i = 0; i < m; i++) {\n scanf(\"%d%d\", &a, &b);\n map[a][b] = map[b][a] = 1;\n }\n for (i = 1; i <= 5; i++) {\n for (j = i+1; j <= 5; j++) {\n for (k = j+1; k <= 5; k++) {\n if (map[i][j] && map[j][k] && map[k][i]) {\n printf(\"WIN\\n\");\n goto X;\n }\n if (!map[i][j] && !map[j][k] && !map[k][i]) {\n printf(\"WIN\\n\");\n goto X;\n }\n }\n }\n }\n printf(\"FAIL\\n\");\nX: ;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint d[10][10];\nint check(int a,int b,int c)\n{\n\tif(d[a][b]==1&&d[a][c]==1&&d[b][a]==1&&d[b][c]==1&&d[c][a]==1&&d[c][b]==1)\n\t return 1;\n\tif(d[a][b]==0&&d[a][c]==0&&d[b][a]==0&&d[b][c]==0&&d[c][a]==0&&d[c][b]==0)\n\t\treturn 1;\n\treturn 0;\n}\nint main(void)\n{\n\t\n\tint n,i,j,k,x,y;\n\tscanf(\"%d\",&n);\n\twhile(n--)\n\t{\n\t\tscanf(\"%d%d\",&x,&y);\n\t\td[x][y]=1;\n\t}\n\tint flag=0;\n\tfor(i=1;i<=5;i++)\n\t{\n\t\tfor(j=i+1;j<=5;j++)\n\t\t{\n\t\t\tfor(k=j+1;k<=5;k++)\n\t\t\t{\n\t\t\t\tif(check(i,j,k))\n\t\t\t\t {\n\t\t\t\t\tflag=1;\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(flag) printf(\"WIN\\n\");\n\telse printf(\"FAIL\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[6][6];\nint main()\n{\n int n,i,j,k,x,y;\n scanf(\"%d\",&n);\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5;j++)\n {\n a[i][j]=0;\n }\n }\n for(i=1;i<=n;i++)\n {\n scanf(\"%d%d\",&x,&y);\n a[x][y]=1;\n a[y][x]=1;\n }\n for(i=1;i<=5;i++)\n {\n for(j=1;j<=5;j++)\n {\n if(a[i][j]==1)\n {\n for(k=1;k<=5 && k!=i;k++)\n {\n if(a[j][k]==1 && a[k][i]==1)\n {\n printf(\"WIN,%d %d %d\",i,j,k);\n return 0;\n }\n }\n }\n if(j!=i && a[i][j]==0)\n {\n for(k=1;k<=5 && k!=i && k!=j;k++)\n {\n if(a[j][k]==0 && a[k][i]==0)\n {\n printf(\"WIN,%d %d %d\",i,j,k);\n return 0;\n }\n }\n }\n }\n }\n printf(\"FAIL\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint a[6][6];\nint color[6];\n\nint dfs(int v, int h, int id){\n int i, ans = 0;\n color[v] = h;\n for (i = 1; i < 6; i++){\n if (abs(id - a[v][i])){\n if (!color[i]){\n ans += dfs(i, h + 1, id);\n }else{\n if (h + 1 - color[i] == 3){\n ans = 1;\n }\n }\n }\n }\n return ans;\n}\nint predfs(int id){\n int i, ans = 0;\n for (i = 1; i < 6; i++){\n color[i] = 0;\n }\n for (i = 1; i < 6; i++){\n if (!color[i]){\n ans += dfs(i, 1, id);\n }\n }\n return ans;\n}\nint main(void)\n{\n int m, c, b = 1, i, j;\n scanf(\"%d\", &m);\n for (i = 1; i < 6; i++){\n for (j = j; j < 6; j++){\n a[i][j] = 0;\n }\n }\n for (i = 0; i < m; i++){\n scanf(\"%d%d\", &c, &b);\n a[c][b] = a[b][c] = 1;\n }\n if (predfs(1) || predfs(0)){\n printf(\"WIN\");\n } else{\n printf(\"FAIL\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint a[6][6];\nint color[6];\n\nint dfs(int v, int h, int id){\n int i, ans = 0;\n color[v] = h;\n for (i = 1; i < 6; i++){\n if (abs(id - a[v][i])){\n if (!color[i]){\n ans += dfs(i, h + 1, id);\n }else{\n if (h + 1 - color[i] == 3){\n ans = 1;\n }\n }\n }\n }\n return ans;\n}\n\nint main(void)\n{\n int m, c, b, i, j;\n scanf(\"%d\", &m);\n for (i = 1; i < 6; i++){\n for (j = j; j < 6; j++){\n a[i][j] = 0;\n }\n }\n for (i = 0; i < m; i++){\n scanf(\"%d%d\", &c, &b);\n a[c][b] = a[b][c] = 1;\n }\n if (dfs(b, 1, 1) || dfs(b, 1, 0)){\n printf(\"WIN\");\n } else{\n printf(\"FAIL\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\t\tint a[5][5] = {};\n\n\t\tint m, i, j, k;\n\t\tscanf(\"%d\", &m);\n\t\twhile(--m)\n\t\t{\n\t\t\tscanf(\"%d%d\", &i, &j);\n\t\t\t--i;\n\t\t\t--j;\n\t\t\ta[i][j] = a[j][i] = 1;\n\t\t}\n\n\t\tint win = 0;\n\t\tfor (i = 0; i < 5; ++i)\n\t\t\tfor (j = 0; j < i; ++j)\n\t\t\t\tfor (k = 0; k < j; ++k)\n\t\t\t\t\tif (a[i][j] == 1 && a[j][k] == 1 && a[k][i] == 1 || a[i][j] == 0 && a[j][k] == 0 && a[k][i] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\twin = 1;\n\t\t\t\t\t\tgoto end;\n\t\t\t\t\t}\n\t\tend:\n\t\tif (win)\n\t\t\tputs(\"WIN\\n\");\n\t\telse\n\t\t\tputs(\"FAIL\\n\");\n\n\t\treturn 0;\n}\n"}, {"source_code": "/*\n Tardes de Coding Sesi\u00f3n 3\n B - Friends\n A01208964 - Dom\u00e9nica Renter\u00eda\n*/\n\n#include <stdio.h>\n\n#define amigos 5\n\nint main(){\n\nint arr[amigos] = {};\nint m, a, b;\n// m -> # de relaciones entre los 5 amixes\n// (a, b) relacion\n// a -> persona 1\n// b -> persona 2\n\nscanf(\"%i\", &m);\n\nint i=0;\n\n// con este do-while, vamos a contar el numero de relaciones por persona\n// con base a su n\u00famero, si sale, se le suma al arreglo en su posici\u00f3n\n\ndo {\n\tscanf(\"%i %i\", &a, &b);\n arr[a-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", a, arr[a-1]++);\n arr[b-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", b, arr[b-1]++);\n\ti++;\n} while (i < m);\n\ni=0;\n\n// en este do-while checamos todo el arreglo\n// si alguno tiene un valor diferente \n\ndo {\n\tif(arr[i] > 2){\n \tprintf(\"WIN\\n\");\n \treturn 0;\n }\n\ti++;\n} while (i < amigos);\n\nprintf(\"FAIL\\n\");\n\nreturn 0;\n}"}, {"source_code": "/*\n Tardes de Coding Sesi\u00f3n 3\n B - Friends\n A01208964 - Dom\u00e9nica Renter\u00eda\n*/\n\n#include <stdio.h>\n\n#define amigos 5\n\nint main(){\n\nint arr[amigos] = {};\nint m, a, b;\n// m -> # de relaciones entre los 5 amixes\n// (a, b) relacion\n// a -> persona 1\n// b -> persona 2\n\nscanf(\"%i\", &m);\nif (m==0){\n\treturn 0;\n}\n\nint i=0;\n\n// con este do-while, vamos a contar el numero de relaciones por persona\n// con base a su n\u00famero, si sale, se le suma al arreglo en su posici\u00f3n\n\ndo {\n\tscanf(\"%i %i\", &a, &b);\n arr[a-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", a, arr[a-1]++);\n arr[b-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", b, arr[b-1]++);\n\ti++;\n} while (i < m);\n\ni=0;\n\n// en este do-while checamos todo el arreglo\n// si alguno tiene un valor diferente \n\ndo {\n\tif(arr[i] != 2){\n \tprintf(\"WIN\\n\");\n \treturn 0;\n }\n\ti++;\n} while (i < amigos);\n\nprintf(\"FAIL\\n\");\n\nreturn 0;\n}"}, {"source_code": "/*\n Tardes de Coding Sesi\u00f3n 3\n B - Friends\n A01208964 - Dom\u00e9nica Renter\u00eda\n*/\n\n#include <stdio.h>\n\n#define amigos 5\n\nint main(){\n\nint arr[amigos] = {};\nint m, a, b;\n// m -> # de relaciones entre los 5 amixes\n// (a, b) relacion\n// a -> persona 1\n// b -> persona 2\n\nscanf(\"%i\", &m);\nif (m=0){\n\treturn 0;\n}\n\nint i=0;\n\n// con este do-while, vamos a contar el numero de relaciones por persona\n// con base a su n\u00famero, si sale, se le suma al arreglo en su posici\u00f3n\n\ndo {\n\tscanf(\"%i %i\", &a, &b);\n arr[a-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", a, arr[a-1]++);\n arr[b-1]++;\n //printf(\"arr[%i-1]++ %i\\n\", b, arr[b-1]++);\n\ti++;\n} while (i < m);\n\ni=0;\n\n// en este do-while checamos todo el arreglo\n// si alguno tiene un valor diferente \n\ndo {\n\tif(arr[i] != 2){\n \tprintf(\"WIN\\n\");\n \treturn 0;\n }\n\ti++;\n} while (i < amigos);\n\nprintf(\"FAIL\\n\");\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint l, r;\n\tint cnt = 0;\n\tint\ttab[5];\n\tchar *res = \"FAIL\";\n\tmemset(tab, 0, sizeof(tab));\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &l, &r);\n\t\ttab[l] = tab[l] + 1;\n\t\ttab[r] = tab[r] + 1;\n\t\ti++;\n\t}\n\ti = 1;\n\twhile (i <= 5)\n\t{\n\t\tif (tab[i] != 2)\n\t\t\tres = \"WIN\";\n\t\ti++;\n\t}\n\t\tprintf(\"%s\", res);\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif ((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i <= 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"WIN\\n\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\\n\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"WIN\\n\");\n\tif (cnt <= 3)\n\t\tprintf(\"FL\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif ((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i <= 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\treturn (0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\");\n\telse\n\t\tprintf(\"WIN\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"WIN\\n\");\n\tif (cnt <= 3)\n\t\tprintf(\"FAIL\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[5];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i < 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\\n\");\n\tif (cnt <= 3)\n\t\tprintf(\"WIN\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint l, r;\n\tint cnt = 0;\n\tint\ttab[5];\n\tchar *res = \"FAIL\";\n\tmemset(tab, 0, sizeof(tab));\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &l, &r);\n\t\ttab[l] = tab[l] + 1;\n\t\ttab[r] = tab[r] + 1;\n\t\ti++;\n\t}\n\ti = 1;\n\twhile (i <= 5)\n\t{\n\t\tif (tab[i] != 2)\n\t\t\tres = \"WIN\";\n\t\ti++;\n\t}\n\tif (strcmp(res, \"FAIL\"))\n\t\tprintf(\"WIN\");\n\telse\n\t\tprintf(\"FAIL\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif ((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i <= 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt != 2)\n\t\tprintf(\"FAIL\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\treturn (0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\tscanf(\"%d\", &n_cone);\n\tint l, r;\n\tint cnt = 0;\n\tint\ttab[5];\n\tchar *res = \"FAIL\";\n\tmemset(tab, 0, sizeof(tab));\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &l, &r);\n\t\ttab[l] = tab[l] + 1;\n\t\ttab[r] = tab[r] + 1;\n\t\ti++;\n\t}\n\ti = 1;\n\twhile (i <= 5)\n\t{\n\t\tif (tab[i] != 2)\n\t\t\tres = \"WIN\";\n\t\ti++;\n\t}\n\t\tprintf(\"%s\", res);\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\t\tmain()\n{\n\tint n_cone, i = 0, cont[6];\n\n\tscanf(\"%d\", &n_cone);\n\tint tab[n_cone][2];\n\tint cnt = 0;\n\twhile (n_cone > i)\n\t{\n\t\tscanf(\"%d%d\", &tab[i][0], &tab[i][1]);\n\t\ti++;\n\t}\n\ti = 0;\n\twhile (i < n_cone)\n\t{\n\t\tif ((tab[i][0] == 1 || tab[i][1] == 1) && cont[0] < 3)\n\t\t\tcont[0] = cont[0] + 1;\n\t\tif ((tab[i][0] == 2 || tab[i][1] == 2) && cont[1] < 3)\n\t\t\tcont[1] = cont[1] + 1;\n\t\tif ((tab[i][0] == 3 || tab[i][1] == 3) && cont[2] < 3)\n\t\t\tcont[2] = cont[2] + 1;\n\t\tif ((tab[i][0] == 4 || tab[i][1] == 4) && cont[3] < 3)\n\t\t\tcont[3] = cont[3] + 1;\n\t\tif ((tab[i][0] == 5 || tab[i][1] == 5) && cont[4] < 3)\n\t\t\tcont[4] = cont[4] + 1;\n\t\ti++;\n\t}\n\ti = 0;\n\n\twhile (i <= 5)\n\t{\n\t\tif (cont[i] == 2)\n\t\t\tcnt++;\n\t\ti++;\n\t}\n\tif (cnt > 3)\n\t\tprintf(\"FAIL\\n\");\n\telse\n\t\tprintf(\"WIN\\n\");\n\texit(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n\n if(relations<4){\n printf(\"WIN\");\n }\n else {\n aux=pairwise[0][0];\n aux2=pairwise[0][1];\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 >= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n aux=pairwise[0][0];\n aux2=pairwise[0][1];\n\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 ==3 || n2 == 3 || n3 ==3 || n4 == 3 || n5 == 3 || cont ==3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n\n if(relations<4){\n printf(\"WIN\");\n }\n else {\n /* aux=pairwise[0][0];\n aux2=pairwise[0][1];\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }*/\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 >= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n aux=pairwise[0][0];\n aux2=pairwise[0][1];\n if(relations==1){\n printf(\"WIN\");\n }\n else {\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 ==3 || n2 == 3 || n3 ==3 || n4 == 3 || n5 == 3 || cont ==3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n aux=pairwise[0][0];\n aux2=pairwise[0][1];\n if(relations<4){\n printf(\"WIN\");\n }\n else {\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 ==3 || n2 == 3 || n3 ==3 || n4 == 3 || n5 == 3 || cont ==3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n\n if(relations<4){\n printf(\"WIN\");\n }\n else {\n /* aux=pairwise[0][0];\n aux2=pairwise[0][1];\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }*/\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 > 3 || n2 > 3 || n3 > 3 || n4 > 3 || n5 > 3 || cont ==3 ){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int relations=0;\n int valor, aux, aux2, cont=0, bandera=0;\n int n1=0, n2=0, n3=0, n4=0, n5=0;\n scanf(\"%i%*c\", &relations);\n int pairwise[relations][2];\n\n int i=0, x=0;\n int j=0;\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n scanf(\"%i%*c\", &valor);\n pairwise[i][j]=valor;\n }\n }\n\n\n if(relations<4){\n printf(\"WIN\");\n }\n else {\n aux=pairwise[0][0];\n aux2=pairwise[0][1];\n for(i=0; i<relations; i++){\n if(pairwise[i][0]==aux2){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else if (pairwise[i][0]==aux){\n aux=pairwise[i][0];\n aux2=pairwise[i][1];\n cont++;\n }\n else{\n aux=pairwise[x++][0];\n aux2=pairwise[x][1];\n cont=0;\n }\n }\n\n for(i=0; i<relations; i++){\n for(j=0; j<2; j++){\n if(pairwise[i][j]==1){\n n1=n1+1;\n }\n else if(pairwise[i][j]==2){\n n2=n2+1;\n }\n else if(pairwise[i][j]==3){\n n3=n3+1;\n }\n else if(pairwise[i][j]==4){\n n4=n4+1;\n }\n else {\n n5=n5+1;\n }\n }\n }\n\n if(n1 >= 3 || n2 >= 3 || n3 >= 3 || n4 >= 3 || n5 >= 3 || cont >= 3){\n printf(\"WIN\");\n }\n else printf(\"FAIL\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main(){\n int n;\n scanf(\"%d\", &n);\n int tabla[5][5];\n for(int i = 0; i < n; i++){\n for(int j = 0; j < n; j++){\n tabla[i][j] = 0;\n }\n }\n for(int i = 0; i < n; i++){\n int a,b;\n scanf(\"%d %d\", &a, &b);\n tabla[a-1][b-1] = 1;\n tabla[b-1][a-1] = 1;\n }\n\n int Igaz = 0;\n \n for(int i = 0; i < 4; i++){\n for(int j = i+1; j < 5; j++){\n //printf(\"i:%d, j: %d\\n\", i, j);\n /* jarjuk be a tablat */\n int Helyes = 1;\n int Helytelen = 1;\n for(int k = 0; k < 5; k++){\n\tfor(int l = 0; l < 5; l++){\n\t if(!(k == i || k == j || l == i || l == j)){\n\t //printf(\"k:%d, l: %d\\n\", k, l);\n\t if(tabla[k][l] != 1) Helyes = 0;\n\t if(tabla[k][l] == 1) Helytelen = 0;\n\t }\n\t}\n }\n //if(Helyes) printf(\"helyes\\n\");\n //if(Helytelen) printf(\"helytelen\\n\");\n if(Helyes || Helytelen){\n\tIgaz = 1;\n }\n \n } \n }\n\n if(Igaz) printf(\"WIN\");\n else printf(\"FAIL\");\n}\n"}], "src_uid": "2bc18799c85ecaba87564a86a94e0322"} {"nl": {"description": "You are given a tree with $$$n$$$ nodes. You have to write non-negative integers on its edges so that the following condition would be satisfied:For every two nodes $$$i$$$, $$$j$$$, look at the path between them and count the sum of numbers on the edges of this path. Write all obtained sums on the blackboard. Then every integer from $$$1$$$ to $$$\\lfloor \\frac{2n^2}{9} \\rfloor$$$ has to be written on the blackboard at least once. It is guaranteed that such an arrangement exists.", "input_spec": "The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 1000$$$)\u00a0\u2014 the number of nodes. Each of the next $$$n-1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \\le u, v \\le n$$$, $$$u \\neq v$$$), meaning that there is an edge between nodes $$$u$$$ and $$$v$$$. It is guaranteed that these edges form a tree.", "output_spec": "Output $$$n-1$$$ lines, each of form $$$u$$$ $$$v$$$ $$$x$$$ ($$$0 \\le x \\le 10^6$$$), which will mean that you wrote number $$$x$$$ on the edge between $$$u$$$, $$$v$$$. Set of edges $$$(u, v)$$$ has to coincide with the set of edges of the input graph, but you can output edges in any order. You can also output ends of edges in an order different from the order in input.", "sample_inputs": ["3\n2 3\n2 1", "4\n2 4\n2 3\n2 1", "5\n1 2\n1 3\n1 4\n2 5"], "sample_outputs": ["3 2 1\n1 2 2", "4 2 1\n3 2 2\n1 2 3", "2 1 1\n5 2 1\n3 1 3\n4 1 6"], "notes": "NoteIn the first example, distance between nodes $$$1$$$ and $$$2$$$ is equal to $$$2$$$, between nodes $$$2$$$ and $$$3$$$ to $$$1$$$, between $$$1$$$ and $$$3$$$ to $$$3$$$.In the third example, numbers from $$$1$$$ to $$$9$$$ (inclusive) will be written on the blackboard, while we need just from $$$1$$$ to $$$5$$$ to pass the test."}, "positive_code": [{"source_code": "/* https://codeforces.com/contest/1206/submission/59041923 (Dukkha) */\n#include <stdio.h>\n#include <stdlib.h>\n\n#define N\t1000\n\nint next[1 + (N - 1) * 2], jj[1 + (N - 1) * 2];\n\nint link(int l, int j) {\n\tstatic int l_ = 1;\n\n\tnext[l_] = l;\n\tjj[l_] = j;\n\treturn l_++;\n}\n\nint n;\nint ao[N], cc[N];\nint i_, j_, n_;\n\nint dfs(int p, int i) {\n\tint l, j, c_, c;\n\n\tc = 1;\n\tfor (l = ao[i]; l; l = next[l]) {\n\t\tj = jj[l];\n\t\tif (j != p)\n\t\t\tc += dfs(i, j);\n\t}\n\tc_ = c < n - c ? c : n - c;\n\tif (n_ < c_) {\n\t\tn_ = c_;\n\t\tif (c <= n - c) {\n\t\t\ti_ = i;\n\t\t\tj_ = p;\n\t\t} else {\n\t\t\ti_ = p;\n\t\t\tj_ = i;\n\t\t}\n\t}\n\tcc[i] = c;\n\treturn c;\n}\n\nint compare(const void *a, const void *b) {\n\tint i = *(int *) a;\n\tint j = *(int *) b;\n\n\treturn cc[i] - cc[j];\n}\n\nint a, b;\n\nvoid dfs_(int p, int i, int c) {\n\tint l, j;\n\n\ta += b;\n\tprintf(\"%d %d %d\\n\", p + 1, i + 1, a - c);\n\tc = a;\n\tfor (l = ao[i]; l; l = next[l]) {\n\t\tj = jj[l];\n\t\tif (j != p)\n\t\t\tdfs_(i, j, c);\n\t}\n}\n\nint main() {\n\tstatic int tt[N];\n\tint h, i, j, k, l, s, n_, changed;\n\n\tscanf(\"%d\", &n);\n\tfor (h = 0; h < n - 1; h++) {\n\t\tscanf(\"%d%d\", &i, &j), i--, j--;\n\t\tao[i] = link(ao[i], j);\n\t\tao[j] = link(ao[j], i);\n\t}\n\ti_ = -1, j_ = -1, n_ = -1;\n\tdfs(-1, 0);\n\ts = j_;\n\tdfs(-1, s);\n\tk = 0;\n\tfor (l = ao[s]; l; l = next[l])\n\t\ttt[k++] = jj[l];\n\tqsort(tt, k, sizeof *tt, compare);\n\tn_ = 1;\n\tb = 1, a = 0;\n\tchanged = 0;\n\tfor (h = 0; h < k; h++) {\n\t\tj = tt[h];\n\t\tdfs_(s, j, 0);\n\t\tn_ += cc[j];\n\t\tif (!changed && n_ * 3 >= n) {\n\t\t\tchanged = 1;\n\t\t\tb = n_, a = 0;\n\t\t}\n\t}\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "87d755df6ee27b381122062659c4a432"} {"nl": {"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_spec": "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_spec": "Output the number of damaged dragons.", "sample_inputs": ["1\n2\n3\n4\n12", "2\n3\n4\n5\n24"], "sample_outputs": ["12", "17"], "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."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\n int count=0;\n for(int i=1;i<=d;i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int ara[4],ara1[50];\n int d,i,j=0,k,l;\n for(i=0;i<4;i++){\n scanf(\"%d\",&ara[i]);\n }\n scanf(\"%d\",&d);\n for(i=1;i<=d;i++){\n if(i%ara[0]!=0 && i%ara[1]!=0 && i%ara[2]!=0 && i%ara[3]!=0){\n j++;\n }\n }\n if(ara[0]<=d) printf(\"%d\",(d-j));\n else printf(\"%d\",0);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,l,m,d,i,s=0;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n for(i=1;i<=d;i++)\n {\n if(k<=d&&l<=d&&m<=d&&n<=d)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n s++;\n }\n }\n else\n {\n break;\n }\n }\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define in freopen(\"in\", \"r+\", stdin)\n#define ou freopen(\"ou\", \"w+\", stdout)\nint main()\n{\n// in;\n// ou;\n int a[100000]={0}, k, l, m, n, d;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n int i;\n\n if(k<=d)\n for(i=k-1;i<d;i+=k)\n a[i]=1;\n\n if(l<=d)\n for(i=l-1;i<d;i+=l)\n a[i]=1;\n\n if(m<=d)\n for(i=m-1;i<d;i+=m)\n a[i]=1;\n\n if(n<=d)\n for(i=n-1;i<d;i+=n)\n a[i]=1;\n\n int count=0;\n for(i=0;i<d;i++)\n if(a[i]==1)\n count++;\n printf(\"%d\\n\", count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&k,&l,&m,&n,&d);\n int flag[d+1];\n for(i=1;i<=d;++i)\n flag[i]=0;\n for(i=1;k*i<=d;++i)\n flag[k*i]=1;\n for(i=1;l*i<=d;++i)\n flag[l*i]=1;\n for(i=1;m*i<=d;++i)\n flag[m*i]=1;\n for(i=1;n*i<=d;++i)\n flag[n*i]=1;\n for(i=1;i<=d;++i)\n {\n if(flag[i]==1)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d, nr=0, i;\n scanf (\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for (i++;i<=d;i++)\n {\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n {\n nr++;\n }\n\n }\n printf(\"%d\", d-nr);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void){\n\n int k,l,m,n,d,missed=0,i,temp;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n if(l < k && l < m && l < n){\n temp = k;\n k = l;\n l = temp;\n }\n else if(m < k && m < l && m < n){\n temp = k;\n k = m;\n m = temp;\n }\n else if(n < k && n < l && n < m){\n temp = k;\n k = n;\n n = temp;\n }\n\n for(i=1; i<=d; i++){\n if(i%k == 0 || i%l == 0 || i%m == 0 || i%n ==0){\n continue;\n }\n missed++;\n }\n\n printf(\"%d\\n\",d-missed);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define in freopen(\"in\", \"r+\", stdin)\n#define ou freopen(\"ou\", \"w+\", stdout)\nint main()\n{\n// in;\n// ou;\n int a[100000]={0}, k, l, m, n, d;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n int i;\n\n if(k<=d)\n for(i=k-1;i<d;i+=k)\n a[i]=1;\n\n if(l<=d)\n for(i=l-1;i<d;i+=l)\n a[i]=1;\n\n if(m<=d)\n for(i=m-1;i<d;i+=m)\n a[i]=1;\n\n if(n<=d)\n for(i=n-1;i<d;i+=n)\n a[i]=1;\n\n int count=0;\n for(i=0;i<d;i++)\n if(a[i]==1)\n count++;\n printf(\"%d\\n\", count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n/*void sort(int ar[])\n{\nfor(int i=0;i<4;i++)\n{\nfor(int j=0;j<3;j++)\n{\nif(ar[j]>ar[j+1])\n{\nint temp=ar[j+1];\nar[j+1]=ar[j];\nar[j]=temp;\n}\n\n}\n}\n\n}*/\nint main()\n{\n int k, l, m, n,d,count=0;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&k,&l,&m,&n,&d);\n int arr[d];\n for(int i=0;i<d;i++)\n arr[i]=i+1;\n for(int j=0;j<d;j++)\n {\n if(arr[j]%k==0 ||arr[j]%l==0 ||arr[j]%m==0 ||arr[j]%n==0)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,i;\n long int d,count=0;\n scanf(\"%ld%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n count++;\n }\n printf(\"%ld\",count);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int ara[4],ara1[50];\n int d,i,j=0,k,l;\n for(i=0;i<4;i++){\n scanf(\"%d\",&ara[i]);\n }\n scanf(\"%d\",&d);\n for(i=1;i<=d;i++){\n if(i%ara[0]!=0 && i%ara[1]!=0 && i%ara[2]!=0 && i%ara[3]!=0){\n j++;\n }\n }\n if(ara[0]<=d) printf(\"%d\",(d-j));\n else printf(\"%d\",0);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\n\t#ifndef ONLINE_JUDGE\n // for getting input from input.txt\n freopen(\"input.txt\", \"r\", stdin);\n // for writing output to output.txt\n freopen(\"output.txt\", \"w\", stdout);\n #endif\n int i,c=0;int k,l,m,n,d;scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\nfor(i=1;i<=d;i++)\n{\nif(i%k==0 || i%l==0 ||i%m==0 || i%n==0)\n c++;\n}\nprintf(\"%d\",c);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k,l,m,n,d,u=0;\n\t\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&d);\n\n\tfor (int i = 1; i <= d; ++i)\n\t{\n\t\tif (i%k == 0 ||i%l == 0 || i%m == 0 || i%n == 0)\n\t\t{\n\t\t\tu=u+1;\n\t\t}\n\t}\n\n\n\t/*\n\tint i,a[d],u=0;\n\t\n\tfor (int i = 0; i < d; ++i)\t\t//all dragons numbered\n\t{\n\t\ta[i]=i+1;\n\t}\n\t\t\n\tif (d>=k)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=k)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\t\t\n\tif (d>=l)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=l)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>=m)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=m)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>=n)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=n)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\t//if (d<k) a[0]=0;\n\t//if (d<l) a[0]=0;\n\t//if (d<m) a[0]=0;\n\t//if (d<n) a[0]=0;\n\n\n\tfor (int i = 0; i < d; ++i)\n\t{\n\t\tif (a[i]==0)\n\t\t{\n\t\t\tu=u+1;\n\t\t}\n\t}\n\t*/\n\n\tprintf(\"%d\\n\",u);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&k,&l,&m,&n,&d);\n int flag[d+1];\n for(i=1;i<=d;++i)\n flag[i]=0;\n for(i=1;k*i<=d;++i)\n flag[k*i]=1;\n for(i=1;l*i<=d;++i)\n flag[l*i]=1;\n for(i=1;m*i<=d;++i)\n flag[m*i]=1;\n for(i=1;n*i<=d;++i)\n flag[n*i]=1;\n for(i=1;i<=d;++i)\n {\n if(flag[i]==1)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a,b,c,d,n,i,s=0;\n\tscanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&n);\n\tfor(i=1;i<=n;i++)\n\t\tif(i % a == 0 || i % b == 0 || i % c == 0 || i % d == 0) s++;\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n\t\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int a,b,c,d,e,i;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&a,&b,&c,&d,&e);\n if(e<a||e<b||e<c||e<d){printf(\"0\");exit(0);}\n if(a==1||b==1||c==1||d==1){printf(\"%d\",e);exit(0);}\n int z=e;\n for(i=1;i<=e;i++){\n if(i%a!=0&&i%b!=0&&i%c!=0&&i%d!=0){z--;}\n }printf(\"%d\",z);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint k,l,m,n,d,i,c=0,ans;\nscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n\nfor(i=1;i<=d;i++)\n{\n\n if(i%k==0)\n {\n c++;\n }\n\n else if(i%l==0)\n {\n c++;\n }\n\n else if(i%m==0)\n {\n c++;\n }\n\n else if(i%n==0)\n {\n c++;\n }\n\n\n\n}\n\n\nprintf(\"%d\",c);\n\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d,i,brojac=0;\n int niz[100500]={0};\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if (k==1 || l==1 || m==1 || n==1)\n {\n printf(\"%d\",d);\n return 0;\n }\n for (i=k; i<=d; i=i+k)\n niz[i]=1;\n for (i=l; i<=d; i=i+l)\n niz[i]=1;\n for (i=m; i<=d; i=i+m)\n niz[i]=1;\n for (i=n; i<=d; i=i+n)\n niz[i]=1;\n for (i=0; i<=d; i++)\n if (niz[i]!=0)\n brojac++;\n printf(\"%d\",brojac);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,m,n,d;\n\tint count;\n\tint i;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tcount=d;\n\tif(k==1||l==1||m==1||n==1)\n\tprintf(\"%d\\n\",count);\n\telse{\n\t\tfor(i=1;i<=d;i++){\n\t\t\tif((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0)){\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint an[100001];\n\nint main()\n{\n\tint i, k, l, m, n, d;\n\tint ans = 0;\n\tscanf(\"%d\", &k);\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &m);\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &d);\n\tfor (i = 0; i <= d; i++) an[i] = 0;\n\tfor (i = k; i <= d; i += k) an[i] = 1;\n\tfor (i = l; i <= d; i += l) an[i] = 1;\n\tfor (i = m; i <= d; i += m) an[i] = 1;\n\tfor (i = n; i <= d; i += n) an[i] = 1;\n\tfor (i = 1; i <= d; i++) if (an[i]) ans++;\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, l, m, n, d;\n int count = 0, i = 0;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n count = d;\n if (k == 1 || l == 1 || m == 1 || n == 1)\n {\n printf(\"%d\", d);\n }\n else\n {\n for (i = 1; i <= d; i++)\n {\n if ((i % k != 0) && (i % l != 0) && (i % m != 0) && (i % n != 0))\n count--;\n }\n printf(\"%d\", count);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint a[100100];\nint main()\n{\n int i,n,m,k,l,d,sum=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n a[i]=1;\n }\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n a[i]=0;\n }\n for(i=1;i<=d;i++)\n {\n if(a[i]==0)\n sum++;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n\n\t \t \t \t \t \t \t\t \t\t \t\t\t\t"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n long int k,l,m,n,d,c=0,i;\n scanf(\"%ld\\n%ld\\n%ld\\n%ld\\n%ld\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n c++;\n \n }\n \n printf(\"%ld\",c);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int k, l, m, n, d, i, y = 0;\n scanf (\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n\n y = d;\n if (k == 1 || l == 1 || m == 1 || n == 1)\n printf (\"%d\\n\", d);\n else\n {\n for(i = 1; i <= d; i++)\n {\n if ((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0))\n y--;\n }\n printf (\"%d\\n\", y);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nchar tab[100010];\n \nint main()\n{\n int k, l, m, n, d, i, wynik = 0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n \n if(k == 1 || l == 1 || m == 1 || n == 1)\n printf(\"%d\",d);\n else\n {\n for(i = 1; i <= d; i++)\n {\n if((i % k == 0) || (i % l == 0) || (i % m == 0) || (i % n == 0))\n wynik++;\n }\n /*for(i = 1; i <= d; i++)\n {\n if(tab[i] != '1')\n wynik++;\n }*/\n printf(\"%d\",wynik);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k, l, n, m, d, c=0;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n if(d<k||d<l||d<n||d<m)\n {\n printf(\"0\\n\");\n }\n else{\n int i;\n for(i = 1;i <= d; i++)\n {\n if(!(i%k == 0|| i%l == 0|| i%n == 0|| i%m == 0 ))\n {\n c++;\n }\n }\n printf(\"%d\\n\", d-c);}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int a,b,c,d,e,i;\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&a,&b,&c,&d,&e);\n if(e<a||e<b||e<c||e<d){printf(\"0\");exit(0);}\n if(a==1||b==1||c==1||d==1){printf(\"%d\",e);exit(0);}\n int z=e;\n for(i=1;i<=e;i++){\n if(i%a!=0&&i%b!=0&&i%c!=0&&i%d!=0){z--;}\n }printf(\"%d\",z);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=0;i<d;i++)\n if((i+1)%k==0||(i+1)%l==0||(i+1)%m==0||(i+1)%n==0)\n count++;\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k,i,l,m,n,d,nb=0;\n\tscanf(\"%d\\ n\",&k);\n\tscanf(\"%d\\ n\",&l);\n\tscanf(\"%d\\ n\",&m);\n\tscanf(\"%d\\ n\",&n);\n\tscanf(\"%d\\ n\",&d);\n\tif(k==1)printf(\"%d\",d);\n\telse{\n\t\tfor(i=1;i<=d;i++){\n\t\t\tif(i%k!=0&&i%l!=0&&i%m!=0&&i%n!=0)nb++;\n\t\t\telse nb+=0;\n\t\t}\n\t\tprintf(\"%d\",d-nb);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,i;\n long int d,count=0;\n scanf(\"%ld%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n count++;\n }\n printf(\"%ld\",count);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,count1=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count1++;\n printf(\"%d\",count1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,l,m,n,d,x,count=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\n for(x=1;x<=d;x++){\n\n if(x%k==0 || x%l==0 || x%n==0 || x%m==0) count++;\n\n }\n printf(\"%d\",count);\n return 0;\n\n\n\n\n}\n\n\n\n\n"}, {"source_code": " #include<stdio.h>\n int main() {\n int k,l,m,n,d,cnt,i;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n cnt = d;\n if(k == 1 || l == 1 || m == 1 || n == 1) {\n printf(\"%d\\n\",cnt);\n }\n else {\n for(i=1;i<=d;i++) {\n if((i%k != 0) && (i%l != 0) &&(i%m != 0) && (i%n != 0)) {\n cnt--;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n }"}, {"source_code": "#include <stdio.h>\nvoid sort(int *a,int n)\n{\tint i,j,t;\n\tfor(i=0;i<n;i++)\n\t\tfor(j=i+1;j<n;j++)\n\t\t\tif(a[i]>a[j])\t\t\t//a[i]<a[j]\u964d\u5e8f\uff1ba[i]>a[j]\u5347\u5e8f\uff1b\n\t\t\t{t=a[i];a[i]=a[j];a[j]=t;}\n}\nmain()\n{\n\tint i,j,sum=0,l[5],m[100001]={0};\n\tfor(i=0;i<5;i++)\n\tscanf(\"%d\",&l[i]);\n\tsort(l,4);\n\tif(l[0]==1) {printf(\"%d\\n\",l[4]);return 0;}\n\tif(l[4]<l[3]) {printf(\"0\\n\");return 0;}\n\tfor(j=0;j<4;j++)\n\t\tfor(i=1;i*l[j]<=l[4];i++)\t\t\tm[i*l[j]-1]=1;\n\tfor(i=0;i<l[4];i++)\t\tsum+=m[i];\n\tprintf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,s[4],i,c=0;\n for(i=0;i<4;i++){\n scanf(\"%d\",&s[i]);\n }\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++){\n if(i%s[0]==0||i%s[1]==0||i%s[2]==0||i%s[3]==0){\n c++;\n }\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint arr[4],d,c=0,i,j,e=0;\n\tfor(i=0;i<4;i++)\n\t\tscanf(\"%d\",&arr[i]);\n\tscanf(\"%d\",&d);\n\tfor(j=1;j<=d;j++)\n\t{\n\t\tfor(i=0;i<4;i++)\n\t{\n\t\tif(j%arr[i]!=0)\n\t\t\tc++;\n\t}\n\tif(c==4)\n\t\t{\n\t\t\te++;\n\t\t\t//printf(\"%d \",j);\n\t\t}\n\tc=0;\n\t}\n\tprintf(\"%d\",d-e);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,m,n,d,cnt,i;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tcnt=d;\n\tif(k==1||l==1||m==1||n==1)\n\tprintf(\"%d\\n\",cnt);\n\telse{\n\t\tfor(i=1;i<=d;i++){\n\t\t\tif((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0)){\n\t\t\t\tcnt--;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",cnt);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, l, m, n, d, i, cnt = 0;\n\n scanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n\n if(k==1 || l==1 || m==1 || n==1)\n {\n printf(\"%d\", d);\n return 0;\n }\n// printf(\"%d\\n\", d);\n for(i=2; i<=d; i++)\n {\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n continue;\n else\n cnt++;\n// printf(\"%d %d\\n\", i, cnt);\n }\n\n cnt = d - cnt -1 ; //-1 because the first dragon isn't get damaged. If the first dragon gets damaged it means all the first dragons are damaged\n printf(\"%d\", cnt);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,m,n,d,i=1,x=0;\n\tscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\tfor(i=1;i<=d;i++){\n\t\tif((i%k)==0||(i%l)==0||(i%m)==0||(i%n)==0)\n\t\t\tx++;\n\t}\n\tprintf(\"%d\",x);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,j,k,l,m,count=0,i;\n scanf(\"%d %d %d %d\",&j,&k,&l,&m);\n scanf(\"%d\",&n);\n\n for(i=1;i<=n;i++)\n {\n if(i%j==0||i%k==0||i%l==0||i%m==0) count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n int i,c=0;\n\n for(i=1; i<=d; i++)\n {\n if(i%l==0||i%n==0||i%m==0||i%k==0)\n {\n c++;\n }\n }\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int k, l, m, n, i;\n long long d;\n int count = 0;\n scanf(\"%d\\n %d\\n %d\\n %d\\n\", &k, &l, &m, &n);\n scanf(\"%lld\", &d);\n for(i = 1; i <= d; i++) {\n if(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) {\n count++;\n }\n }\n printf(\"%d\\n\", count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d,x,j,sum,i;\n sum=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for (i=1;i<=d;i++)\n {\n if (i%k==0 || i%l==0 || i%m==0 || i%n==0)\n sum=sum+1;\n\n }\n printf(\"%d\",sum);\n \n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint a,b,c,d,n,p=0,i,l;\nscanf(\"%d%d%d%d%d\",&a,&b,&c,&d,&n);\nfor(i=1;i<=n;i++)\n{if(i%a==0||i%b==0||i%c==0||i%d==0)\nl=1;\nelse\np=p+1;\n}\nprintf(\"%d\",n-p);}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint a[100100];\nint main()\n{\n int i,n,m,k,l,d,sum=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n a[i]=1;\n }\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n a[i]=0;\n }\n for(i=1;i<=d;i++)\n {\n if(a[i]==0)\n sum++;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}\n\n\t \t \t \t \t \t \t\t \t\t \t\t\t\t"}, {"source_code": "#include<stdio.h>\nint gcd(int a,int b)\n{\n if(a==b)\n return a;\n if(a>b)\n return gcd(a-b,b);\n if(a<b)\n {\n return gcd(a,b-a);\n }\n}\nint lcm(int a,int b)\n{\n return (a*b)/gcd(a,b);\n}\nint main(){\n int ans=0,p=1,p1=1,p2=1,flag=0;\n int ar[5][2];\n scanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&ar[0][0],&ar[1][0],&ar[2][0],&ar[3][0],&ar[4][0]);\n p2=lcm(ar[0][0],ar[1][0]);\n int p3=lcm(ar[2][0],ar[3][0]);\n int p4=lcm(p2,p3);\n for(int i=3;i>=0;i--){\n ar[i][1]=0;\n for(int j=0;j<i;j++){\n if(ar[j][0]>=ar[j+1][0]){\n int temp=ar[j][0];\n ar[j][0]=ar[j+1][0];\n ar[j+1][0]=temp;\n }\n }\n }\n for(int i=0;i<4;i++){\n // p1*=ar[i][0];\n for(int j=i+1;j<4;j++){\n if(ar[j][0]%ar[i][0]==0)\n {\n ar[j][1]=1;\n flag=1;\n }\n }\n }\n for(int i=0;i<4;i++)\n {\n if(ar[i][1]==0)\n {\n ans=ans + ar[4][0]/ar[i][0];\n for(int j=i+1;j<4;j++)\n {\n // p=ar[i][0]*ar[j][0];\n if(ar[j][1]==0)\n {\n p=lcm(ar[i][0],ar[j][0]);\n ans=ans - ar[4][0]/p;\n for(int k=j+1;k<4;k++)\n {\n // p2=p*ar[k][0];\n if(ar[k][1]==0){\n p2=lcm(p,ar[k][0]);\n ans=ans + ar[4][0]/p2;\n }\n }\n }\n }\n }\n }\n int b=ar[4][0]/p4;\n if(flag==1)\n printf(\"%d\",ans);\n else\n printf(\"%d\",ans-b);\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\nint main() {\n int k, l, m, n, i;\n long long d;\n int count = 0;\n scanf(\"%d\\n %d\\n %d\\n %d\\n\", &k, &l, &m, &n);\n scanf(\"%lld\", &d);\n for(i = 1; i <= d; i++) {\n if(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0) {\n count++;\n }\n }\n printf(\"%d\\n\", count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n;\n long d,c=0,i;\n scanf(\"%d%d%d%d\",&k,&l,&m,&n);\n scanf(\"%ld\",&d);\n for(i=1;i<=d;i++)\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n c++;\n printf(\"%ld\",c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int k,l,m,n,d,count=0,i;\n while(scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d)!=EOF)\n {\n for(i=1; i<=d; i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\\n\",count);\n count=0;\n }\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\n int count=0;\n for(int i=1;i<=d;i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main ()\n{\n int k,l,m,n,i;\n long int d,A=0;\n\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n if(d<k || d<l || d<m || d<n)\n {\n printf(\"0\");\n }\nelse {\nfor(i=1;i<=d;i++)\n{\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n A++;\n}\n printf(\"%d\",A);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\n int k,l,m,j,n,d,i,count=0;\n char set[100001];\n\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n\n getchar();\n //printf(\"%d\",d);\n\n\n for(i=0;i<d;i++){\n set[i]='1';\n// printf(\"%d\",d);\n //printf(\"%c\",set[i]);\n }\n // for(j=0;j<d;j++)\n // printf(\"%c\",set[j]);\n //printf(\"\\n\");\n\n for(i=1;i<=d;i++){\n\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n set[i-1]='A';\n //\n //printf(\"%c\",set[i]);\n }\n\n // for(j=0;j<d;j++)\n //printf(\"%c\",set[j]);\n // printf(\"\\n\");\n //printf(\"\\n\");\n\n /* for(i=l;i<=d;i=i+l)\n set[i-1]='A';\n\n for(i=n;i<=d;i=i+n)\n set[i-1]='A';\n\n //for(j=0;j<d;j++)\n //printf(\"%c\",set[j]);\n //printf(\"\\n\");\n\n for(i=m;i<=d;i=i+m){\n set[i-1]='A';\n //printf(\"%c\",set[i]);\n }*/\n\n //for(j=0;j<d;j++)\n // printf(\"%c\",set[j]);\n //printf(\"\\n\");\n\n for(j=0;j<d;j++){\n //printf(\"%c\",set[j]);\n if(set[j]=='A'){\n count=count+1;\n // printf(\"%c\",set[j]);\n // printf(\"%d\\n\",count);\n }\n }\n\n printf(\"%d\",count);\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,l,m,n,d;\nscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n int count = 0;\n for(int i=1; i<=d; i++)\n {\n if(i%k==0 || i%l ==0 || i%m ==0 || i%n ==0)\n {\n count++;\n }} printf(\"%d\",count);}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int k,l,m,n,d,i,j,s,c=0,a[4];\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n// a[0]=k;a[1]=l;a[2]=m;a[3]=n;\n for(i=1;i<=d;i++)\n {\n if((i%k)==0)\n {\n c++;\n continue;\n }\n else if((i%l)==0)\n {\n c++;\n continue;\n }\n else if((i%m)==0)\n {\n c++;\n continue;\n }\n else if((i%n)==0)\n {\n c++;\n continue;\n }\n else continue;\n }\n\n printf(\"%d\",c);\n}\n"}, {"source_code": "/* \n * File: main.c\n * Author: ASUS\n *\n * Created on 25 April 2020, 17:47\n */\n\n#include <stdio.h>\n#include <stdlib.h>\nint main(int argc, char** argv) {\n int k,l,m,n,d;\n int count=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n \n if(k==1 || l==1 || m==1 || n==1){\n printf(\"%d\",d);\n }\n else {\n for(int i=2;i<=d;i++){\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0){\n count++;\n }\n }\n printf(\"%d\",count);\n }\n \n \n \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,l,m,n,d;\nscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n int count = 0;\n for(int i=1; i<=d; i++)\n {\n if(i%k==0 || i%l ==0 || i%m ==0 || i%n ==0)\n {\n count++;\n }} printf(\"%d\",count);}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int k,l,m,n,d,count=0,i;\n while(scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d)!=EOF)\n {\n for(i=1; i<=d; i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\\n\",count);\n count=0;\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int s=0;\n int n,m,k,l,d,i;\n scanf(\"%d%d%d%d%d\",&k,&n,&m,&l,&d);\n for(i=1;i<=d;++i)\n if(i%k==0||i%n==0||i%m==0||i%l==0)\n s++;\n printf(\"%d\\n\",s);\n return 0;\n}\n\n\t \t \t \t \t \t \t\t\t\t\t"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint i,x,k,a[100002],l,b[100002],j,m,c[100002],d[100002],n,f=0,g,e[100002],q=0;\nscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&x);\nif(x==81684)\n{\n printf(\"53678\");\n}\nif(x==87079)\n{\n printf(\"43539\");\n}\nif(k==1 || l==1 || m==1 || n==1){\n printf(\"%d\",x);}\n\nelse{\n if(x!=81684 && x!=87079 ){\nfor(i=1;i<=x/2;i++)\n{\na[i]=k*(i);\nb[i]=l*(i);\nc[i]=m*(i);\nd[i]=n*(i);\nif(a[i]<=x )\n{\nq++;\nf++;\ne[q]=a[i];\n}\nif(b[i]<=x )\n{\nq++;\nf++;\ne[q]=b[i];\n}\nif(c[i]<=x )\n{\nq++;\nf++;\ne[q]=c[i];\n}\nif(d[i]<=x)\n{\nf++;\nq++;\ne[q]=d[i];\n}\n}\ng=f;\nfor(i=0;i<=f;i++)\n{if(e[i]!=-1){\nfor(j=i+1;j<=f;j++)\n{\nif(e[j]==e[i])\n{g--;\ne[j]=-1;}\n}\n}\n}\nprintf(\"%d\",g);\n}\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n long long i,a,b,c,d,n,count;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&a,&b,&c,&d,&n);\n count=0;\n for(i=1;i<=n;i++){\n if(i%a==0||i%b==0||i%c==0||i%d==0){\n count++;\n }\n }\n printf(\"%I64d\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main(){\n\n int k,l,m,n,d;\n scanf(\"%i\\n%i\\n%i\\n%i\\n%i\",&k,&l,&m,&n,&d);\n int hurt[d+1];\n for(int i=0; i<=d; i++){\n hurt[i] = 0;\n }\n\n if(k<=d){\n for(int i=k; i<=d; i+=k){\n hurt[i] = 1;\n }\n }\n\n if(l<=d){\n for(int i=l; i<=d; i+=l){\n hurt[i] = 1;\n }\n }\n\n if(m<=d){\n for(int i=m; i<=d; i+=m){\n hurt[i] = 1;\n }\n }\n\n if(n<=d){\n for(int i=n; i<=d; i+=n){\n hurt[i] = 1;\n }\n }\n\n int licznik = 0;\n\n for(int i=0; i<=d; i++){\n //printf(\"%i\",hurt[i]);\n if(hurt[i]) licznik++;\n }\n\n printf(\"\\n%i\",licznik);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[4],d,b[100000],i,j,count;\n\tfor(i=0;i<4;i++)\n\t\tscanf(\"%d\\n\",&a[i]);\n\tscanf(\"%d\",&d);\n\tfor(i=0;i<d;i++)\n\t\tb[i]=i+1;\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<d;j++)\n\t\t\t\tif(b[j]%a[i]==0)\n\t\t\t\tb[j]=0;\n\tfor(i=0;i<d;i++)\n\t\tif(b[i]==0)\n\t\tcount++;\n\tprintf(\"%d\",count);\n\t\treturn 0;\n}"}, {"source_code": " #include<stdio.h>\nint main()\n{\n int k,l,m,n,d,p;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n int i = d/k;\n int c = 0;\n for(p = 1; p <= d; p++){\n if(p%k!=0&&p%l!=0&&p%m!=0&&p%n!=0){\n c++;\n }\n }\n printf(\"%d\", d-c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int d,k,l,m,n,s,r=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(s=1;s<=d;s++){\n r+=!(s%k) || !(s%l) || !(s%m) ||!(s%n);\n }\n printf(\"%d\",r);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,s,t,i,ans;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n \n s=k;\n if(s>l) {t=s; s=l; l=t;}\n if(s>m) {t=s; s=m; m=t;}\n if(s>n) {t=s; s=n; n=t;}\n k=s;\n s=l;\n if(s>m) {t=s; s=m; m=t;}\n if(s>n) {t=s; s=n; n=t;}\n l=s;\n s=m;\n if(s>n) {t=s; s=n; n=t;}\n m=s;\n \n if(k==1) ans=d;\n else\n {ans=0;\n if(n%m==0 || n%l==0 || n%k==0) n=0;\n if(m%l==0 || m%k==0) m=0;\n if(l%k==0) l=0;\n\n for(i=2;i<=d;i++)\n {\n \t if(n!=0 && m!=0 && l!=0)\n\t {\n\t if(i%k==0 && i%l!=0 && i%m!=0 && i%n!=0)\n\t {ans++;}\n\t else if(i%l==0 && i%m!=0 && i%n!=0)\n\t {ans++;}\n\t else if(i%m==0 && i%n!=0)\n\t {ans++;}\n\t else if(i%n==0)\n\t {ans++;}\n\t }\n\t else if(n==0 && m!=0 && l!=0)\n {\n\t if(i%k==0 && i%l!=0 && i%m!=0)\n\t {ans++;}\n\t else if(i%l==0 && i%m!=0)\n\t {ans++;}\n\t else if(i%m==0)\n\t {ans++;}\n }\n else if(n!=0 && m==0 && l!=0)\n {\n\t if(i%k==0 && i%l!=0 && i%n!=0)\n\t {ans++;}\n\t else if(i%l==0 && i%n!=0)\n\t {ans++;}\n\t else if(i%n==0)\n\t {ans++;}\n }\n else if(n!=0 && m!=0 && l==0)\n {\n\t if(i%k==0 && i%m!=0 && i%n!=0)\n\t {ans++;}\n\t else if(i%m==0 && i%n!=0)\n\t {ans++;}\n\t else if(i%n==0)\n\t {ans++;}\n }\n else if(n==0 && m==0 && l!=0)\n {\n\t if(i%k==0 && i%l!=0)\n\t {ans++;}\n\t else if(i%l==0)\n\t {ans++;}\n }\n else if(n==0 && m!=0 && l==0)\n {\n\t if(i%k==0 && i%m!=0)\n\t {ans++;}\n\t else if(i%m==0)\n\t {ans++;}\n }\n else if(n!=0 && m==0 && l==0)\n {\n\t if(i%k==0 && i%n!=0)\n\t {ans++;}\n\t else if(i%n==0)\n\t {ans++;}\n }\n else if(n==0 && m==0 && l==0)\n {\n\t if(i%k==0)\n\t {ans++;}\n }\n }\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n\tint k, l, m, n, d, i, y = 0;\n\tint a[11000] = { 0 };\n\tscanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n\tfor (i = 1; i <= d; i++)\n\t{\n\t\tif (i%k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\ty++;\n\t}\n\tprintf(\"%d\", y);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,count=0,i;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n count++;\n }\n printf(\"%d\\n\",d-count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n count=d;\n if(k == 1 || l == 1 || m == 1 || n == 1)\n printf(\"%d\\n\",count);\n else\n {\n for(int i = 1; i <= d; i++)\n {\n if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0))\n count--;\n }\n printf(\"%d\\n\",count);\n}\n}\n"}, {"source_code": "# include <stdio.h>\nint main ()\n{\n int a, x[4], i, j, k = 0;\n for(i = 0; i < 4; i ++)\n {\n scanf(\"%d\", &x[i]);\n }\n scanf(\"%d\", &a);\n for(i = 1; i <= a; i ++)\n {\n for(j = 0; j < 4; j ++)\n {\n if(i % x[j] == 0)\n {\n k ++;\n break;\n }\n }\n }\n printf(\"%d\", k);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,a,b,c,d,e,count=0;\n scanf(\"%lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e);\n for(i=1;i<=e;i++){\n if(i%a==0 || i%b==0 || i%c==0 || i%d==0)\n count++;\n }\n printf(\"%lld\",count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d,ans=0,i;\n int inp[100001];\n\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n\n for (i=1;i<=d;i++)\n {\n if (i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n ans++;\n }\nprintf (\"%d\\n\",d-ans);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{int n, k, l, m, d;int ans = 0; scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);for (int i = 1; i <= d; i++)\n\t{if (i%k==0 || i%l==0 || i%m==0 || i%n==0)ans++;}printf(\"%d\",ans);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i=0,j=0,k=0,l=0,m=0,n=0,d=0,injured=0;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n /*scanf(\"%d\", &l);\n scanf(\"%d\", &m);\n scanf(\"%d\", &n);\n scanf(\"%d\", &d);*/\n if( k<=l && k<=m && k<=n)\n {\n j=k;\n }\n else if( l<=k && l<=m && l<=n)\n {\n j=l;\n }\n else if( m<=k && m<=l && m<=n)\n {\n j=m;\n }\n else if( n<=k && n<=l && n<=m)\n {\n j=n;\n }\n injured=d/j;\n if(j!=1)\n {\n for(i=1; i<d; i++)\n {\n if(k!=j && i%k==0 && i%j!=0)\n injured++;\n else if(l!=j && i%l==0 && i%j!=0)\n injured++;\n else if(m!=j && i%m==0 && i%j!=0)\n injured++;\n else if(n!=j && i%n==0 && i%j!=0)\n injured++;\n }\n }\n printf(\"%d\", injured);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int i, d, a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n scanf(\"%d\",&d);\n int check[d], count=0;\n for(i=0;i<d;i++)\n check[i]=0;\n\n for(i=0;i<4;i++){\n for(int j=a[i]-1;j<d;j+=a[i]){\n if(check[j]==0){\n count++;\n check[j]=1;\n }\n }\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=0;i<d;i++)\n if((i+1)%k==0||(i+1)%l==0||(i+1)%m==0||(i+1)%n==0)\n count++;\n printf(\"%d\\n\",count);\n return 0;\n}\n"}, {"source_code": "//#include <stdio.h>\nint main()\n{\n int k=0;\n int l=0;\n int m=0;\n int n=0;\n int d=0;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n int i=1;\n int dragon=0;\n for(;i<=d;i++)\n {\n if ((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n dragon++;\n\n }\n\n printf(\"%d\",dragon);\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,m,n,d,i=1,x=0;\n\tscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\tfor(i=1;i<=d;i++){\n\t\tif((i%k)==0||(i%l)==0||(i%m)==0||(i%n)==0)\n\t\t\tx++;\n\t}\n\tprintf(\"%d\",x);\n}"}, {"source_code": " #include<stdio.h>\nint main()\n{\n int k,l,m,n,d,p;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n int i = d/k;\n int c = 0;\n for(p = 1; p <= d; p++){\n if(p%k!=0&&p%l!=0&&p%m!=0&&p%n!=0){\n c++;\n }\n }\n printf(\"%d\", d-c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,count=0,i;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n count++;\n }\n printf(\"%d\\n\",d-count);\n return 0;\n}\n"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, \nC#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d;\n int count = 0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\nfor(int i=1 ; i<=d;i++)\n{\n if(i%k && i%l && i%m && i%n)\n count++;\n}\n printf(\"%d\",d-count);\n\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int k,l,m,n,d,i,j,s,c=0,a[4];\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n// a[0]=k;a[1]=l;a[2]=m;a[3]=n;\n for(i=1;i<=d;i++)\n {\n if((i%k)==0)\n {\n c++;\n continue;\n }\n else if((i%l)==0)\n {\n c++;\n continue;\n }\n else if((i%m)==0)\n {\n c++;\n continue;\n }\n else if((i%n)==0)\n {\n c++;\n continue;\n }\n else continue;\n }\n\n printf(\"%d\",c);\n}\n"}, {"source_code": "#include <stdio.h>\nint an[100001];\n\nint main()\n{\n\tint i, k, l, m, n, d;\n\tint ans = 0;\n\tscanf(\"%d\", &k);\n\tscanf(\"%d\", &l);\n\tscanf(\"%d\", &m);\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &d);\n\tfor (i = 0; i <= d; i++) an[i] = 0;\n\tfor (i = k; i <= d; i += k) an[i] = 1;\n\tfor (i = l; i <= d; i += l) an[i] = 1;\n\tfor (i = m; i <= d; i += m) an[i] = 1;\n\tfor (i = n; i <= d; i += n) an[i] = 1;\n\tfor (i = 1; i <= d; i++) if (an[i]) ans++;\n\tprintf(\"%d\\n\", ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k,l,m,n,d,cnt,i,mini;\n\tscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\tif (k<=l && k<=m && k<=n){\n\t\tmini=k;\n\t}\n\telse if (l<=k && l<=m && l<=n){\n\t\tmini=l;\n\t}\n\telse if(m<=k && m<=l && m<=n){\n\t\tmini=m;\n\t}\n\telse{\n\t\tmini=n;\n\t}\n\tif(mini==1){\n\t\tprintf(\"%d\",d);\n\t}\n\telse{\n\t\tcnt=0;\n\t\tfor (i=mini;i<d+1;i++){\n\t\t\tif(i%k==0 || i%l==0 || i%m==0 || i%n==0){\n\t\t\t\tcnt=cnt+1;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",cnt);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d, i,c=0;\n scanf(\"%d%d%d%d%d\", &k,&l,&m,&n,&d);\n for(i=0; i<d; i++)\n {\n if((i+1)%k==0 || (i+1)%l==0 || (i+1)%m==0 || (i+1)%n==0)\n {\n c++;\n }\n\n }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int count=0,k,l,m,n;\n int d,i;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n for(i=1; i<=d; i++)\n {\n if(i%k==0)\n count++;\n else if(i%l==0)\n count++;\n else if(i%m==0)\n count++;\n else if(i%n==0)\n count++;\n }\n printf(\"%d\\n\",count);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\\n\",count);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,count=0,i;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n count++;\n }\n printf(\"%d\\n\",d-count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint a,b,c,d,n,p=0,i,l;\nscanf(\"%d%d%d%d%d\",&a,&b,&c,&d,&n);\nfor(i=1;i<=n;i++)\n{if(i%a==0||i%b==0||i%c==0||i%d==0)\nl=1;\nelse\np=p+1;\n}\nprintf(\"%d\",n-p);}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k, l, m, n, d, i, cnt = 0;\n\n scanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n\n if(k==1 || l==1 || m==1 || n==1)\n {\n printf(\"%d\", d);\n return 0;\n }\n// printf(\"%d\\n\", d);\n for(i=2; i<=d; i++)\n {\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n continue;\n else\n cnt++;\n// printf(\"%d %d\\n\", i, cnt);\n }\n\n cnt = d - cnt -1 ; //-1 because the first dragon isn't get damaged. If the first dragon gets damaged it means all the first dragons are damaged\n printf(\"%d\", cnt);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int k,l,m,n,d,i,counter = 0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if(d >= m || d >= n || d >= k || d >= l){\n for(i = 1; i <= d; i++){\n if(i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0){\n counter++;\n }\n }\n printf(\"%d\",counter);\n }\n else{\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int i,a,b,c,d,e,count=0;\n scanf(\"%lld %lld %lld %lld %lld\",&a,&b,&c,&d,&e);\n for(i=1;i<=e;i++){\n if(i%a==0 || i%b==0 || i%c==0 || i%d==0)\n count++;\n }\n printf(\"%lld\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,c=0;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n c=d;\n if(k==1||m==1||n==1||l==1)\n {\n printf(\"%d\",d);\n\n }\n else\n {\n\n\n for(i=1; i<=d; i++)\n {\n if((i%k!=0)&&(i%l!=0)&&(i%m!=0)&&(i%n!=0))\n {\n c--;\n }\n }\n\n printf(\"%d\",c);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,count=0;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k, l, m, n, d, i;\n\tint count = 0;\n\tscanf(\"%d%d%d%d%d\",&k, &l, &m, &n, &d);\n\tfor(i=1; i<=d; i++)\n\t{\n\t\tif(i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)\n\t\t\tcount++;\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main() {\n int k,l,m,n,d,cnt,i;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n cnt = d;\n if(k == 1 || l == 1 || m == 1 || n == 1) {\n printf(\"%d\\n\",cnt);\n }\n else {\n for(i=1;i<=d;i++) {\n if((i%k != 0) && (i%l != 0) &&(i%m != 0) && (i%n != 0)) {\n cnt--;\n }\n }\n printf(\"%d\\n\",cnt);\n }\n return 0;\n }"}, {"source_code": "#include <limits.h>\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nunsigned short readline_hu();\nunsigned long readline_lu();\nshort readline_hi();\n\nint compare(const void * a, const void * b);\nvoid allocate_error(size_t error_line, short exit_status);\n\n// Solving-relevant functions\nshort remove_multiples(short * dragon_types, unsigned short * dragon_types_length, unsigned long amount_dragons);\nunsigned long subtract_multiple_torture(short * dragon_types, unsigned short dragon_types_length, unsigned long total_tortured, unsigned long amount_dragons);\n\nunsigned long lcm(short a, short b);\nunsigned long gcd(short a, short b);\n\nint main() {\n\n unsigned short dragon_types_length;\n unsigned long amount_dragons;\n unsigned long solution;\n short * dragon_types;\n short status_code;\n //unsigned long tmp;\n\n dragon_types_length = 4;\n\n dragon_types = malloc(sizeof(short) * dragon_types_length);\n\n // ----- ERROR -----\n if (dragon_types == NULL)\n allocate_error(__LINE__, -1);\n // ----- ERROR -----\n\n // Get all damages dragons\n for (unsigned short index = 0; index < dragon_types_length; index++)\n dragon_types [index] = readline_hi();\n\n //-----===== Solve =====-----\n\n // Get amount of dragons\n amount_dragons = readline_lu();\n\n status_code = remove_multiples(dragon_types, &dragon_types_length, amount_dragons);\n\n solution = 0;\n\n if (status_code) {\n // Compute the total amount of tortured dragons\n for (unsigned short index = 0; index < dragon_types_length; index++)\n solution += (unsigned long) amount_dragons / dragon_types [index];\n\n // Subtract all dragons who got tortured twice or even more\n //printf(\"Before subtraction: %lf\\n\", solution);\n solution = subtract_multiple_torture(dragon_types, dragon_types_length, solution, amount_dragons);\n }\n\n //printf(\"%lf\\n\", solution);\n //tmp = (unsigned long) round(solution);\n\n //if (tmp == 35247 || tmp == 36321)\n // tmp--;\n printf(\"%lu\\n\", solution);\n //printf(\"%lu\\n\", tmp);\n free(dragon_types);\n\n return EXIT_SUCCESS;\n}\n\nshort remove_multiples(short * dragon_types, unsigned short * dragon_types_length, unsigned long amount_dragons) {\n /*\n * Remove all multiples of the dragon_types because it doesn't matter (in\n * this case) if a dragon got punished twice or even more.\n *\n * To achieve that we need to iterate two times through the whole list in\n * order to find all multiples.\n *\n * ------\n * Return value: The array \"dragon_types\" but all multiples are removed\n */\n\n short * tmp_dragon_types;\n unsigned short amount_multiples;\n amount_multiples = 0;\n\n // Sort the array to make it easier to remove the multiples\n qsort(dragon_types, *dragon_types_length, sizeof(short), compare);\n\n /*\n * Remove all values first which are larger than the amount of dragons.\n */\n for (unsigned short index = 0; index < *dragon_types_length; index++) {\n if ((unsigned long) dragon_types [index] > amount_dragons) {\n amount_multiples++;\n dragon_types [index] = -1;\n }\n }\n\n /*\n * Now remove all multiples of the array. (if there are any)\n */\n for (unsigned short index1 = 0; index1 < *dragon_types_length; index1++) {\n\n // This for-loop is to compare the number with the number at index1\n for (unsigned short index2 = index1 + 1; index2 < *dragon_types_length; index2++) {\n\n /*\n * We found a multiple or a value which is greater than the amount of dragons. Now we remove the multiple and remove the\n * multiple with -1. After that we resize the array and remove the\n * -1 numbers.\n */\n if (dragon_types [index2] % dragon_types [index1] == 0 && dragon_types [index2] != -1 && dragon_types [index1] != -1) {\n // Replace the multiple with -1\n dragon_types [index2] = -1;\n amount_multiples++;\n }\n }\n }\n\n /*\n * Special case : All values are greater than the amount of dragons\n * => Return 0 to make it clear that the amount of dragons is zero\n */\n if (*dragon_types_length == amount_multiples) {\n return 0;\n }\n\n // Resize the array if there are multiples in the array and remove them\n else if (amount_multiples > 0) {\n\n unsigned short tmp_index;\n\n tmp_dragon_types = realloc(dragon_types, sizeof(short) * (*dragon_types_length - amount_multiples));\n\n // ----- ERROR -----\n if (tmp_dragon_types == NULL)\n allocate_error(__LINE__, -2);\n // ----- ERROR -----\n\n // Remove all -1 numbers\n tmp_index = 0;\n\n for (unsigned short index = 0; index < *dragon_types_length; index++) {\n\n // Add all numbers which aren't -1 from the original list to the\n // temporary list\n if (dragon_types [index] != -1)\n tmp_dragon_types [tmp_index++] = dragon_types [index];\n }\n\n // Refresh the values\n dragon_types = tmp_dragon_types;\n *dragon_types_length -= amount_multiples;\n }\n\n return 1;\n}\n\nunsigned long subtract_multiple_torture(short * dragon_types, unsigned short dragon_types_length, unsigned long total_tortured, unsigned long amount_dragons) {\n /*\n * This funcion will calculate the LCM values of dragon_types and subtract\n * them to total_tortured to get the amount of dragons who got tortured at\n * least one time.\n */\n\n // This is needed when the dragons have been tortured more than twice.\n unsigned long long subtraction;\n\n // Subtract the solution with the LCM\n for (unsigned short index1 = 0; index1 < dragon_types_length; index1++) {\n\n for (unsigned short index2 = index1 + 1; index2 < dragon_types_length;\n index2++) {\n\n total_tortured -= (unsigned long) amount_dragons / lcm(dragon_types [index1], dragon_types [index2]);\n }\n }\n\n /*\n * Some dragons are tortured more than twice. With the subtraction above we\n * just removed \"one torture\". So we need to exclude the other tortures as\n * well.\n */\n\n if (dragon_types_length >= 3) {\n\n subtraction = lcm(lcm(dragon_types [0], dragon_types [1]), dragon_types [2]);\n\n if (subtraction <= amount_dragons)\n total_tortured += (unsigned long) amount_dragons / subtraction;\n\n\n // Are there even dragons who got tortured four times????\n if (dragon_types_length == 4) {\n\n total_tortured += amount_dragons / lcm(lcm(dragon_types [0], dragon_types [2]), dragon_types [3]);\n total_tortured += amount_dragons / lcm(lcm(dragon_types [0], dragon_types [1]), dragon_types [3]);\n total_tortured += amount_dragons / lcm(lcm(dragon_types [1], dragon_types [2]), dragon_types [3]);\n\n //if (subtraction <= amount_dragons) {\n // total_tortured += (unsigned long) amount_dragons / subtraction;\n //}\n\n // Remove the dragons who got tortured four times\n subtraction = 1;\n for (unsigned short index = 0; index < dragon_types_length; index++)\n subtraction = lcm(subtraction, dragon_types [index]);\n\n if (subtraction <= amount_dragons)\n total_tortured -= (unsigned long) amount_dragons / subtraction;\n //printf(\"%lf\\n\", total_tortured);\n }\n }\n\n return total_tortured;\n}\n\nunsigned long lcm(short a, short b) {\n return a * b / (unsigned long) gcd(a, b);\n}\n\nunsigned long gcd(short a, short b) {\n short c;\n\n do {\n c = a % b;\n a = b;\n b = c;\n } while (b != 0);\n\n return (unsigned long) a;\n}\n\n// -----=====##### Nice functions #####=====-----\nvoid allocate_error(size_t error_line, short exit_status) {\n printf(\"-----===== ERROR IN LINE %lu =====-----\\n\", error_line);\n printf(\"Couldn't allocate memory!\\n\");\n printf(\"Exit code: %hi\\n\", exit_status);\n perror(\"\");\n exit(exit_status);\n}\n\nunsigned short readline_hu() {\n\n char buffer [6];\n unsigned short buffer_index = 0;\n int character;\n\n // Get the digits of the number\n while ((character = getchar()) != '\\n' && character != EOF && character != ' ' && buffer_index < 5)\n buffer [buffer_index++] = (char) character;\n\n // Set the end of the line\n buffer [buffer_index] = '\\0';\n\n // Convert string into unsigned short\n return (unsigned short) strtoul(buffer, NULL, 10);\n}\n\nshort readline_hi() {\n\n char buffer [6];\n unsigned short buffer_index = 0;\n int character;\n\n // Get the digits of the number\n while ((character = getchar()) != '\\n' && character != EOF && character != ' ' && buffer_index < 5)\n buffer [buffer_index++] = (char) character;\n\n // Set the end of the line\n buffer [buffer_index] = '\\0';\n\n // Convert string into unsigned short\n return (short) strtol(buffer, NULL, 10);\n}\n\nunsigned long readline_lu() {\n\n char buffer [12];\n unsigned short buffer_index = 0;\n int character;\n\n // Get the digits of the number\n while ((character = getchar()) != '\\n' && character != EOF && character != ' ' && buffer_index < 11)\n buffer [buffer_index++] = (char) character;\n\n // Set the end of the line\n buffer [buffer_index] = '\\0';\n\n return strtoul(buffer, NULL, 10);\n}\n\nint compare(const void * a, const void * b) {\n\n if (*(unsigned short *) a < *(unsigned short *) b)\n return -1;\n\n else if (*(unsigned short *) a == *(unsigned short *) b)\n return 0;\n\n else\n return 1;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,count;\n while(scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d)!=EOF)\n {\n count=0;\n if(k==1)\n printf(\"%d\\n\",d);\n else\n {\n for(i=1;i<=d;i++)\n {\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n count++;\n }\n printf(\"%d\\n\",count);\n }\n }\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\nint k,l,m,n,d,x,z;\nscanf(\"%d %d %d %d %d \",&k,&l,&m,&n,&d);\nfor(x=1;x<=d;x=x+1)\n{\n if(x%k==0 || x%l==0 || x%m==0 || x%n==0) {z=z+1;}\n}\n\nprintf(\"%d\", z);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d, i,c=0;\n scanf(\"%d%d%d%d%d\", &k,&l,&m,&n,&d);\n for(i=0; i<d; i++)\n {\n if((i+1)%k==0 || (i+1)%l==0 || (i+1)%m==0 || (i+1)%n==0)\n {\n c++;\n }\n\n }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define in freopen(\"in\", \"r+\", stdin)\n#define ou freopen(\"ou\", \"w+\", stdout)\nint gcd(int a, int b)\n{\n int t;\n while(a)\n {\n t=a;\n a=b%a;\n b=t;\n }\n return b;\n}\nint lcm(int a, int b)\n{\n return (a*b)/gcd(a, b);\n}\nint eval(\n int k,\n int l,\n int m,\n int n,\n int d)\n{\n return d/k+d/l+d/m+d/n-d/lcm(k, l)-d/lcm(k, m)-d/lcm(k, n)-d/lcm(l, m)-d/lcm(l, n)-d/lcm(m, n)+d/lcm(lcm(k, l), m)+d/lcm(lcm(k, l), n)+d/lcm(lcm(k, m), n)+d/lcm(lcm(l, m), n)-d/lcm(lcm(k, l), lcm(m, n));\n}\nint main()\n{\n // in;\n int k, l, m, n, d;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n printf(\"%d\\n\", eval(k, l, m, n, d));\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n long a[100000] = {0}, k , l, d, m, n;\n scanf(\"%ld%ld%ld%ld%ld\", &k, &l, &m, &n, &d);\n for(long i = 1; i <= d; i++)\n {\n if( k*i < d)\n {\n a[k*i] = 1;\n }\n if( l*i < d)\n {\n a[l*i] = 1;\n }\n if( m*i < d)\n {\n a[m*i] = 1;\n }\n if( n*i < d)\n {\n a[n*i] = 1;\n }\n }\n long c = 0;\n for(int i = 1; i <= d; i++)\n {\n if(a[i] == 1)\n c++;\n }\n printf(\"%ld\", c);\n \n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int k,l,m,n,d,x;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n x=floor(d/k)+floor(d/l)+floor(d/m)+floor(d/n)-floor(d/(k*l))-floor(d/(m*l))-floor(d/(m*n))-floor(d/(k*m))-floor(d/(k*n))-floor(d/(n*l));\n if (k==1 || l==1 || m==1 || n==1)\n {\n printf(\"%d\",d);\n }\n else \n printf(\"%d\",x);\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,count=0,a[100009]={},o,p,q,k;\n scanf(\"%d %d %d %d %d\",&n,&m,&o,&p,&q);\n for(i=1;;i++){\n k=n*i;\n if(k>q)\n break;\n a[k]=1;\n }\n for(i=1;;i++){\n k=m*i;\n if(k>q)\n break;\n a[k]=1;\n }\n for(i=1;;i++){\n k=o*i;\n if(k>q)\n break;\n a[k]=1;\n }\n for(i=1;;i++){\n k=p*i;\n if(k>q)\n break;\n a[k]=1;\n }\n a[q]=1;\n for(i=1;i<=q;i++){\n if(a[i]==1)\n count++;\n }\n printf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <strings.h>\n#include <math.h>\n\n#define REP(I, N) for (int I = 0; I < (N); ++I)\n#define RI(X) scanf(\"%d\", &(X)) \n#define RII(X, Y) scanf(\"%d%d\", &(X), &(Y))\n#define RIII(X, Y, Z) scanf(\"%d%d%d\", &(X), &(Y), &(Z))\n#define RS(X) scanf(\"%s\", (X))\n#define LEN(X) strlen(X)\n\n\nint main(){\n int n,div[4],ndiv=4,res=0,pen=0;\n scanf(\"%d %d %d %d %d\",&div[0],&div[1],&div[2],&div[3],&n);\n REP(i,ndiv){\n REP(j,ndiv){\n if(div[i]%div[j]==0 && i!=j){\n for(int x=i;x<ndiv;x++){\n div[x]=div[x+1];\n }\n ndiv--;\n }\n \n \n }\n }\n \n REP(x,ndiv){\n res+=n/div[x];\n for(int i=x+1;i<ndiv;i++)pen+=n/(div[x]*div[i]);\n }\n printf(\"%d\\n\",res-pen);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n int i,c=0;\n if(l<d&&l<d&&m<d&&n<d)\n {\n for(i=1; i<=d; i++)\n {\n if(i%l==0||i%n==0||i%m==0||i%k==0)\n {\n c++;\n }\n }\n printf(\"%d\",c);\n }\n else\n {\n c=0;\n printf(\"%d\",c);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n long int a,b,c,d,i=0,j,k,l;\n\n scanf(\"%ld%ld%ld%ld%ld\",&a,&b,&c,&d,&l);\n\n while(l--){\n if(l%a!=0 && l%b!=0 && l%c!=0 && l%d!=0)i++;\n }\n\n printf(\"%ld\",i);\n\n}\n\n/*if(a!=1 && b!=1 && c!=1 && d!=1)i++;\n if(a!=2 && b!=2 && c!=2 && d!=2)i++;\n if(a!=3 && b!=3 && c!=3 && d!=3)i++;\n if(a!=4 && b!=4 && c!=4 && d!=4)i++;*/\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,m,n,o,d;\n int i;\n scanf(\"%d %d %d %d %d\",&l,&m,&n,&o,&d);\n int arr[100056];\n for(i=0;i<=d;i++)\n arr[i]=0;\n for(i=1;i<=d;i++)\n {\n if(i%l==0)\n arr[i]=-1;\n if(i%m==0)\n arr[i]=-1;\n if(i%n==0)\n arr[i]=-1;\n if(i%o==0)\n arr[i]=-1;\n }\n int count=0;\n for(i=1;i<=d;i++)\n {\n if(arr[i]==-1)\n count++;\n \n printf(\"%d\\n\",i);\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int temp,j=0,f=0,e=2,i,k,l,m,n,d,a[4],b[1000];\n\tscanf(\"%ld %ld %ld %ld %ld\",&k,&l,&m,&n,&d);\n\ta[0]=k;\n\ta[1]=l;\n\ta[2]=m;\n\ta[3]=n;\n\tfor(i=0;i<3;i++)\n\t\tfor(j=1;j<4;j++)\n\t\tif(a[i]>a[j])\n\t{\n\t\ttemp=a[i];\n\t\ta[i]=a[j];\n\t\ta[j]=temp;\n\t}\n\tj=0;\n\tk=a[0];\n\tl=a[1];\n\tm=a[2];\n\tn=a[3];\n\tif(d==59392)\n\t\tprintf(\"59392\");\n\telse\n\t{\n\tfor(i=k;i<=d;i=k*e)\n\t{\n\t\ta[j]=i;\n\t\te++;\n\t\tj++;\n\t}\n\tif(j>0)\n\tj++;\n\te=2;\n\tfor(i=l;i<=d;i=l*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=m;i<=d;i=m*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=n;i<=d;i=n*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0&&i%m!=0)\n\t\tj++;\n\t}\n\t/*if(k>1&&l>1&&m>1&&n>1)\n\t{\n\t\tif(k==l||k==m||k==n)\n\t\tj++;\n\tif(l==m||l==n)\n\t\tj++;\n\tif(m==n)\n\t\tj++;\n\t}*/\n\tif(j>0)\n\t\tj++;\n\tprintf(\"%ld\",j);\n\t}\n \n}"}, {"source_code": "#include<stdio.h> \nint main()\n{ int k,l,m,n,d,i,count;i=1;count=0;scanf(\"%d,%d,%d,%d\",&k,&l,&m,&n,&d);\n\twhile(i<=d){\n if(i%k==0||i%l==0||i%m==0||i%n==0){ count++;} i++;}\n\tprintf(\"%d\",count);\n\t\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void)\n{\n int k = 0, l = 0, m = 0, n = 0, d = 0, abused = 0;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n\n for (int i = 0; i < d; i++)\n {\n if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n {\n abused++;\n }\n }\n printf(\"%d\\n\", abused);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n;\n long int d,i=0,t=0;\n scanf(\"%d %d %d %d %ld\",&k,&l,&m,&n,&d);\n if((k==1)||(l==1)||(m==1)||(n==1))\n printf(\"%ld\",d);\n else\n {\n t=d;\n while(t>0)\n {\n t=t-k;\n i++;\n }\n t=d;\n while(t>0)\n {\n if(t%k==0)\n t=t-l;\n else\n {\n t=t-l;\n i++;\n }\n }\n t=d;\n while(t>0)\n {\n if((t%k==0)||(t%l==0))\n t=t-m;\n else\n {\n t=t-m;\n i++;\n }\n } \n t=d;\n while(t>0)\n {\n if((t%k==0)||(t%l==0)||(t%m==0))\n t=t-n;\n else\n {\n t=t-n;\n i++;\n }\n }\n }\n printf(\"%ld\",i);\n return(0);\n } \n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k,l,m,n,d,q,i;\n\ti=0;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tfor(q=0;q<d;q++)\n\t{\tif(q%k==0){\n\t\t\t\t i++;\n\t\t\t\t continue;}\n\n\telse if (q%l==0){\n\t\ti++;\n\t\tcontinue;}\n\n\telse if(q%m==0){\n\t\ti++;\n\t\tcontinue;}\n\n\telse if(q%n==0){\n\t\ti++;\n\t\tcontinue;}\n\t}\nprintf(\"%d\",i);\n\n\n\n\n\n\treturn 0;}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int k,l,m,n,d,count=1;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n int arr[d];\n for(int i=0;i<d;i++)\n arr[i]=i+1;\n for(int i=k;i<=d;i+=k)\n arr[i]=0;\n for(int i=l;i<=d;i+=l)\n arr[i]=0;\n for(int i=m;i<=d;i+=m)\n arr[i]=0;\n for(int i=n;i<=d;i+=n)\n arr[i]=0;\n for(int i=0;i<d;i++)\n {\n if(arr[i]==0)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint gcd(int a, int b)\n{\n\tint temp;\n\twhile (b != 0)\n\t{\n\t\ttemp = a % b;\n\n\t\ta = b;\n\t\tb = temp;\n\t}\n\treturn a;\n}\n\nint main(void)\n{\n\tint k, l, m, n, d;\n\tscanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n\n\n\tint lcm_k_l = k * l / gcd(k, l);\n\tint lcm_k_l_m = m * lcm_k_l / gcd(m, lcm_k_l);\n\tint common_lcm = n * lcm_k_l_m / gcd(n, lcm_k_l_m);\n\n\tchar *array = calloc(common_lcm, sizeof(*array));\n\n\tfor (int i = 0; i < common_lcm; i += k) {\n\t\tarray[i] = 1;\n\t}\n\n\tfor (int i = 0; i < common_lcm; i += l) {\n\t\tarray[i] = 1;\n\t}\n\n\tfor (int i = 0; i < common_lcm; i += m) {\n\t\tarray[i] = 1;\n\t}\n\n\tfor (int i = 0; i < common_lcm; i += n) {\n\t\tarray[i] = 1;\n\t}\n\n\tint count = 0;\n\n\tfor (int i = 0; i < common_lcm; i++) {\n\t\tif (array[i])\n\t\t\tcount++;\n\t}\n\n\tfree(array);\n\n\tint max_count = d / common_lcm;\n\t//printf(\"count : %d, max_count : %d\\n\", count, max_count);\n\tcount *= max_count;\n\n\tint lost = d - max_count * common_lcm;\n\n\tchar *lost_array = calloc(lost, sizeof(*lost_array));\n\tfor (int i = 0; i < lost; i += k) {\n\t\tlost_array[i] = 1;\n\t}\n\n\tfor (int i = 0; i < lost; i += l) {\n\t\tlost_array[i] = 1;\n\t}\n\n\tfor (int i = 0; i < lost; i += m) {\n\t\tlost_array[i] = 1;\n\t}\n\n\tfor (int i = 0; i < lost; i += n) {\n\t\tlost_array[i] = 1;\n\t}\n\n\tfor (int i = 0; i < lost; i++) {\n\t\tif (lost_array[i])\n\t\t\tcount++;\n\t}\n\n\tfree(lost_array);\n\n\tprintf(\"%d\\n\", count);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k=0,l=0,m=0,n=0,d=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n printf(\"%d,%d,%d,%d,%d\",k,l,m,n,d);\n int i, ans = 0;\n for(i = 1; i <= d; i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0){\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d%d%d%d\",&k,&l,&m,&n,&d);\n\n int count=0;\n for(int i=0;i<=d;i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n count++;\n }\n printf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,j,x,y,z,res,a,b;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n if(k==1)\n {\n res=d;\n }\n else\n {\n x=d/k;\n i= d-x;\n y=i/l;\n j=d-(x+y);\n z=j/m;\n b=d-(x+y+z);\n a=b/n;\n res=x+y+z-a;\n }\n printf(\"%d\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,l,m,n,d,count=0,i;\nscanf(\"%d%d%d%d\",&k,&l,&m,&n,&d);\nfor(i=1;i<=d;i++)\nif(k/i==0 || l/i==0 ||m/i==0 ||n/i==0)\ncount++;\nprintf(\"%d\",count);\nreturn 0;\n}\n"}, {"source_code": "/*\nhttp://codeforces.com/problemset/problem/148/A\n*/\n#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i;//d-total number of dragon.\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n double dragon[d];\n if( k==1 || l==1 || m==1 || k==n ){\n printf(\"%d\",d);\n return 0;\n }\n for(i=k-1;i<d;i+=k){\n dragon[i]=2.5;\n }\n //int t;\n /*for(i=k-1;i<d;i+=k){\n printf(\"%d %d\\n\",dragon[i],i);\n //t++;\n }*/\n //printf(\"\\n%d\",t);\n //for(i=0;i<d;i++)printf(\"%d\\t\",dragon[i]);\n for(i=l-1;i<d;i+=l){\n dragon[i]=2.5;\n }\n for(i=m-1;i<d;i+=m){\n dragon[i]=2.5;\n }\n for(i=n-1;i<d;i+=n){\n dragon[i]=2.5;\n }\n\n int t=0;\n for(i=0;i<d;i++){\n if(dragon[i] != 2.5)t++;\n }\n\n printf(\"%d\",d-t);\n\n\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[4],n,i,j,m;\n\tfor(i=0;i<4;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tscanf(\"%d\",&n);\n\tint b[n];\n\tfor(j=0;j<n;j++)\n\t{\n\t\tb[j]=1;\n\t}\n\tfor(j=0;j<4;j++)\n\t{\t\n\t\tfor(i=1;a[j]*i<=n;i++)\n\t\t{\n\t\t\tm=a[j]*i;\n\t\t\tb[m]=0;\n\t\t}\n\t}\n\tint k=1;\n\tfor(j=0;j<n;j++)\n\t{\n\t\tif(b[j]==0) k++;\n\t}\n\tif(k==1) printf(\"0\");\nelse\tprintf(\"%d\",k);\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int d,i;\n scanf(\"%I64d\",&d);\n int k,l,m,n;\n long long int o=0;\n scanf(\"%d%d%d%d\",&k,&l,&m,&n);\n for(i=1;i<=d;i++){\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n o++;\n }\n printf(\"%d\",d-o);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d,i;\n\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n int arr[d];\n\n for(i=1;i<=d;i++)\n {\n arr[i-1]=0;\n }\n\n for(i=1;i<=d;i+=k)\n {\n arr[i-1]=1;\n }\n\n for(i=1;i<=d;i+=l)\n {\n arr[i-1]=1;\n }\n for(i=1;i<=d;i+=n)\n {\n arr[i-1]=1;\n }\n for(i=1;i<=d;i+=n)\n {\n arr[i-1]=1;\n }\n int count=0;\n for(i=1;i<=d;i++)\n {\n if(arr[i-1]==1)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint k,l,m,n,d,i=0,j;\nscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\nfor(j=1;j<=d;j++){\nif(d%k == 0)\ni++;\nelse if(d%l == 0)\ni++;\nelse if(d%m == 0)\ni++;\nelse if(d%n == 0)\ni++;\n\n\n}\nprintf(\"%d\",i);\n\n\nreturn 0;}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d,c,i;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\n c=0;\n for(i=0; i<d; i++)\n {\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n {\n c=c+1;\n }\n }\n printf(\"%d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int k,l,m,n,d,c=0,i,flag=0;\n scanf(\"%I64d %I64d %I64d %I64d %I64d\",&k,&l,&m,&n,&d);\n for(i=0;i<d;i++)\n {\n if(k>d && l>d && m>d && n>d)\n {\n flag=1;\n }\n else if(i%k!=0 && i%l!=0 && i%n!=0&& i%m!=0)\n {\n c++;\n\n\n }\n }\n //printf(\"%d \",c);\n if(flag==0) printf(\"%I64d\",d-c);\n else if(flag==1) printf(\"0\");\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#define PI 2*acos(0.0)\nint main()\n{\n int a,b;\n double c,d,e,f,g,h,r;\n scanf(\"%d\", &b);\n for(a=1; a<=b; a++)\n {\n scanf(\"%lf\", &r);\n c=((r+r)*(r+r))-(PI*r*r);\n printf(\"Case %d: %.2lf\\n\",a,c);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void){\n\n int k,l,m,n,d,missed=0,i,temp;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n if(l < k && l < m && l < n){\n temp = k;\n k = l;\n l = temp;\n }\n else if(m < k && m < l && m < n){\n temp = k;\n k = m;\n m = temp;\n }\n else if(n < k && n < l && n < m){\n temp = k;\n k = n;\n n = temp;\n }\n\n if(k>=d){\n printf(\"0\\n\");\n exit(0);\n }\n\n\n for(i=1; i<d; i++){\n if(i%k == 0 || i%l == 0 || i%m == 0 || i%n ==0){\n continue;\n }\n missed++;\n }\n\n printf(\"%d\\n\",d-missed);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \nint main()\n{ int k,l,m,n,d,i,count;i=1;count=0;scanf(\"%d,%d,%d,%d,%d\",&k,&l,&m,&n,&d);\n\twhile(i<=d)\n\n{ if(i%k==0||i%l==0||i%m==0||i%n==0){ count++;} i++;}\n\tprintf(\"%d\",count);\n\t\n\treturn 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,i;\n long d,b,a=0;\n scanf(\"%d%d%d%d%ld\",&k,&l,&m,&n,&d);\n if(k>d||l>d||m>d||n>d)\n {\n printf(\"%ld\\n\",a);\n }\n else\n {\n for(i=0; i<d; i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n a=a+1;\n }\n }\n\n printf(\"%ld\\n\",a);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint k, l, m, n, d, i, a=0;\n\tscanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n\tfor(i=0;i<d;i++){\n\t\tif (i%k==0 || i%l==0 || i%m==0 || i%n==0) a++;\n\t}\n\tprintf(\"%d\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n;\n long int d,i=0,t=0;\n scanf(\"%d %d %d %d %ld\",&k,&l,&m,&n,&d);\n if((k==1)||(l==1)||(m==1)||(n==1))\n {\n printf(\"%ld\",d);\n goto x;\n }\n else\n {\n t=k;\n if(k<d)\n {\n while(t<=d)\n {\n i++;\n t=t+k; \n }\n }\n t=l;\n if(l<d)\n {\n while(t<d)\n {\n if(t%k==0)\n t=t+l;\n else\n {\n t=t+l;\n i++;\n }\n }\n }\n t=m;\n if(m<d)\n {\n while(t<=d)\n {\n if((t%k==0)||(t%l==0))\n t=t+m;\n else\n {\n t=t+m;\n i++;\n }\n }\n } \n t=n;\n if(n<d)\n {\n while(t<=d)\n {\n if((t%k==0)||(t%l==0)||(t%m==0))\n t=t+n;\n else\n {\n t=t+n;\n i++;\n }\n }\n }\n }\n printf(\"%ld\",i);\n x: ;\n return(0);\n } \n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k,l,m,n,d;\n\t\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&d);\n\n\tint i,a[d],u=0;\n\t\n\tfor (int i = 0; i < d; ++i)\t\t//all dragons numbered\n\t{\n\t\ta[i]=i+1;\n\t}\n\t\t\n\tif (d>k)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=k)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\t\t\n\tif (d>l)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=l)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>m)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=m)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>n)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=n)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d<k) a[0]=0;\n\tif (d<l) a[0]=0;\n\tif (d<m) a[0]=0;\n\tif (d<n) a[0]=0;\n\n\n\tfor (int i = 0; i < d; ++i)\n\t{\n\t\tif (a[i]==0)\n\t\t{\n\t\t\tu=u+1;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",u);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[3],d,b[100000],i,j,count;\n\tfor(i=0;i<4;i++)\n\t\tscanf(\"%d\\n\",&a[i]);\n\tscanf(\"%d\",&d);\n\tfor(i=0;i<d;i++)\n\t\tb[i]=i+1;\n\tfor(i=0;i<4;i++)\n\t\tfor(j=0;j<d;j++)\n\t\t\tif(a[i]!=0)\t\n\t\t\t\t{\n\t\t\t\tif(b[j]%a[i]==0)\n\t\t\t\tb[j]=0;\n\t\t\t\t}\n\t\t\telse continue;\n\tfor(i=0;i<d;i++)\n\t\tif(b[i]==0)\n\t\tcount++;\n\tprintf(\"%d\",count);\n\t\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int temp,j=0,f=0,e=2,i,k,l,m,n,d,a[4],b[1000];\n\tscanf(\"%ld %ld %ld %ld %ld\",&k,&l,&m,&n,&d);\n\ta[0]=k;\n\ta[1]=l;\n\ta[2]=m;\n\ta[3]=n;\n\tfor(i=0;i<3;i++)\n\t\tfor(j=1;j<4;j++)\n\t\tif(a[i]>a[j])\n\t{\n\t\ttemp=a[i];\n\t\ta[i]=a[j];\n\t\ta[j]=temp;\n\t}\n\tj=0;\n\tk=a[0];\n\tl=a[1];\n\tm=a[2];\n\tn=a[3];\n\tif(d==59392)\n\t\tprintf(\"59392\");\n\telse\n\t{\n\tfor(i=k;i<=d;i=k*e)\n\t{\n\t\ta[j]=i;\n\t\te++;\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=l;i<=d;i=l*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=m;i<=d;i=m*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=n;i<=d;i=n*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0&&i%m!=0)\n\t\tj++;\n\t}\n\t/*if(k>1&&l>1&&m>1&&n>1)\n\t{\n\t\tif(k==l||k==m||k==n)\n\t\tj++;\n\tif(l==m||l==n)\n\t\tj++;\n\tif(m==n)\n\t\tj++;\n\t}*/\n\tif(j>0)\n\t\tj++;\n\tif(j%2!=0&&d%2!=0)\n\tprintf(\"%ld\",++j);\n\telse\n\t\tprintf(\"%ld\",j);\n\t}\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,i;\n long d,b,a=0;\n scanf(\"%d%d%d%d%ld\",&k,&l,&m,&n,&d);\n if(k>d||l>d||m>d||n>d)\n {\n printf(\"%ld\\n\",a);\n }\n else\n {\n for(i=0; i<d; i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n a=a+1;\n }\n }\n\n printf(\"%ld\\n\",a);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int k,l,m,n,d,i,ck1=0,ck=0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n for(i=1;i<=d;i++)\n {\n if(i-k<0&&i-l<0&&i-m<0&&i-n<0)\n break;\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n ck1=0;\n else\n ck1++;\n ck+=ck1;\n \n }\n printf(\"%d\",d-ck);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <strings.h>\n#include <math.h>\n\n#define REP(I, N) for (int I = 0; I < (N); ++I)\n#define RI(X) scanf(\"%d\", &(X)) \n#define RII(X, Y) scanf(\"%d%d\", &(X), &(Y))\n#define RIII(X, Y, Z) scanf(\"%d%d%d\", &(X), &(Y), &(Z))\n#define RS(X) scanf(\"%s\", (X))\n#define LEN(X) strlen(X)\n\n\nint main(){\n int n,res=0,k,l,m,d;\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&d,&n); \n res = n;\n if(k == 1 || l == 1 || m == 1 || n == 1)\n {\n printf(\"%d\\n\",n);\n return 0;\n }\n else\n {\n for(int i = 1; i <= n; i++)\n {\n if((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%d != 0))\n res--;\n }\n printf(\"%d\\n\",res);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k,l,m,n,d,q,i;\n\ti=0;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tfor(q=0;q<d;q++)\n\t{\tif(q%k==0){\n\t\t\t\t i++;\n\t\t}\n\n\telse if (q%l==0){\n\t\ti++;\n\t\t}\n\n\telse if(q%m==0){\n\t\ti++;\n\t\t}\n\n\telse if(q%n==0){\n\t\ti++;\n\t\t}\n\t}\nprintf(\"%d\",i);\n\n\n\n\n\n\treturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int d,i;\n int k,l,m,n;\n long long int o=0;\n scanf(\"%d%d%d%d\",&k,&l,&m,&n);\n scanf(\"%I64d\",&d);\n for(i=1;i<=d;i++){\n if(i%k==0 || i%l==0 || i%m==0 || i%n==0)\n o++;\n }\n printf(\"%I64d\",d-o);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,m,n,o,d;\n int i;\n scanf(\"%d %d %d %d %d\",&l,&m,&n,&o,&d);\n int arr[100002];\n for(i=1;i<=d;i++)\n {\n if(i%l==0)\n arr[i]=-1;\n if(i%m==0)\n arr[i]=-1;\n if(i%n==0)\n arr[i]=-1;\n if(i%o==0)\n arr[i]=-1;\n }\n int count=0;\n for(i=1;i<=d;i++)\n {\n if(arr[i]==-1)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,k,l,m,d,i,s=0;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n for(i=1;i<d;i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n s++;\n }\n }\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int k,l,m,n,d;\n scanf(\"%d,%d,%d,%d,%d\",&k,&l,&m,&n,&d);\n int i, ans = 0;\n for(i = 1; i <= d; i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0){\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint k=0, l=0, m=0, n=0;\n\tint i=0, d=0, count=0;\n\t\n\tscanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n\tfor(i=0; i<d; i++)\n\t{\n\t\tif (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)\n\t\t\tcount++;\n\t}\n\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint gcd (int x, int y);\nint main(void){\n\tint k,l,m,n,d;\n\tint cnt=0;\n\tint i;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tif (k==1||l==1||m==1||n==1){\n\t\tprintf(\"%d\\n\",d);\n\t}\n\telse {\n\tfor (i=1; i<=d; i++){\n\t\tif (gcd(k,i)!=1)\n\t\t\tcnt++;\n\t\telse if(gcd(l,i)!=1)\n\t\t\tcnt++;\n\t\telse if(gcd(m,i)!=1)\n\t\t\tcnt++;\n\t\telse if(gcd(n,i)!=1)\n\t\t\tcnt++;\t\t\n\t}\n\tprintf(\"%d\\n\",cnt);\n}\n\treturn 0;\n}\n\t\nint gcd (int x, int y){\n\tint r;\n\twhile(1){\n\t\tr=x%y;\n\t\tif (r==0)\n\t\t\tbreak;\n\t\tx=y;\n\t\ty=r;\n\t}\n\treturn y;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,count=0;\n long long int d;\n scanf(\"%d %d %d %d %I64d\",&k,&l,&m,&n,&d);\n for(int i=1;i<=d;i++)\n {\n if(i%k==0||i%l==0||i%m==0||i%n==0)\n {\n count++;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k,l,m,n,d,q,i;\n\ti=0;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tfor(q=1;q<d;q++)\n\t{\tif(q%k==0){\n\t\t\t\t i++;\n\t\t}\n\n\telse if (q%l==0){\n\t\ti++;\n\t\t}\n\n\telse if(q%m==0){\n\t\ti++;\n\t\t}\n\n\telse if(q%n==0){\n\t\ti++;\n\t\t}\n\t}\nprintf(\"%d\",i);\n\n\n\n\n\n\treturn 0;}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\n#include<math.h>\n\nint main(void)\n{\n\tint k, l, m, n, d, i, arr[100001], count=0;\n\tscanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n\tfor (i = k-1; i < d; i+=k)\n\n\t{\n\t\tarr[i] = 1;\n\t}\n\tfor (i = l-1; i <= d; i += l)\n\t{\n\t\tarr[i] = 1;\n\t}\n\tfor (i = m-1; i <= d; i += m)\n\t{\n\t\tarr[i] = 1;\n\t}\n\tfor (i = n-1; i <= d; i += n)\n\t{\n\t\tarr[i] = 1;\n\t}\n\tfor (i = 0; i < d; i++)\n\t{\n\t\tif (arr[i] == 1) count++;\n\t}\n\tprintf(\"%d\", count);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint k=0, l=0, m=0, n=0;\n\tint i=0, d=0, count=0;\n\t\n\tscanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n\tfor(i=0; i<d; i++)\n\t{\n\t\tif (i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0)\n\t\t\tcount++;\n\t}\n\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,a,b,c;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n a= d/n;\n b=d%n;\n a=a*4;\n if(b>=k && b<l)\n {\n a=a+1;\n }\n\n else if (b>=l && b<m)\n {\n a=a+2;\n }\n\n else if (b>=m && n<l)\n {\n a=a+3;\n }\n printf(\"%d\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,m,n,d;\n\tint count;\n\tint i;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tcount=d;\n\tif(k==1||l==1||m==1||n==1)\n\tprintf(\"%d\\n\",count);\n\telse{\n\t\tfor(i=0;i<d;i++){\n\t\t\tif((i%k != 0) && (i%l != 0) && (i%m != 0) && (i%n != 0)){\n\t\t\t\tcount--;\n\t\t\t}\n\t\t}\n\tprintf(\"%d\\n\",count);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int k,l,m,n,d,i,a[100000],count;\n while(scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d)!=EOF){\n count=0;\n for(i=0;i<d;i++){\n a[i]=i+1;\n }\n if(k==1||l==1||m==1||n==1){\n printf(\"%d\\n\",d);\n }\n else{\n for(i=1;i<=d;i++){\n if(a[i]%k!=0&&a[i]%l!=0&&a[i]%m!=0&&a[i]%n!=0){\n count++;\n }\n }\n printf(\"%d\\n\",d-count-1);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, m=0;\n char s[6];\n for(i=0; i<5; i++)\n {\n scanf(\"%d\", &s[i]);\n }\n for(i=0; i<s[4]; i++)\n {\n if((i+1)%s[0]==0 || (i+1)%s[1]==0 || (i+1)%s[2]==0 || (i+1)%s[3]==0)\n {\n m++;\n }\n\n }\n printf(\"%d\\n\", m);\n return 0;\n}\n"}, {"source_code": "/*\nhttp://codeforces.com/problemset/problem/148/A\n*/\n#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i;//d-total number of dragon.\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n double dragon[d];\n if( k==1 || l==1 || m==1 || k==n ){\n printf(\"%d\",d);\n return 0;\n }\n for(i=k-1;i<d;i+=k){\n dragon[i]=2.5;\n }\n //int t;\n /*for(i=k-1;i<d;i+=k){\n printf(\"%d %d\\n\",dragon[i],i);\n //t++;\n }*/\n //printf(\"\\n%d\",t);\n //for(i=0;i<d;i++)printf(\"%d\\t\",dragon[i]);\n for(i=l-1;i<d;i+=l){\n dragon[i]=2.5;\n }\n for(i=m-1;i<d;i+=m){\n dragon[i]=2.5;\n }\n for(i=n-1;i<d;i+=n){\n dragon[i]=2.5;\n }\n\n int t=0;\n for(i=0;i<d;i++){\n if(dragon[i] != 2.5)t++;\n }\n\n printf(\"%d\",d-t);\n\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char A[101],B[101];\n\tint i,n;\n\tscanf(\" %s %s\",A,B);\n\tn=strlen(A);\n\tfor(i=0;i<n;++i)\n\t{\n\t\tif( A[i] == B[i] )\n\t\t\tprintf(\"0\");\n\t\telse\n\t\t\tprintf(\"1\");\n\t}\n\tprintf(\"\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tint k,l,m,n,d,i,count=0,temp;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tfor(i=0;i<d;++i)\n\t{\n\t\tscanf(\"%d\",&temp);\n\t\tif(temp%k==0 || temp%l==0 || temp%m==0 || temp%n==0)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\t"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint a,b,c,d,n,p=0,i,l;\nscanf(\"%d%d%d%d%d\",&a,&b,&c,&d,&n);\nfor(i=1;i<=n;i++)\n{if(n%a==0||n%b==0||n%c==0||n%d==0)\nl=1;\nelse\np=p+1;\n}\nprintf(\"%d\",n-p);}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n int k,l,m,n,d,re,p,q,r,s,t,u,v,w,x,y;\n scanf(\"%d %d %d %d %d\",&k, &l, &m, &n, &d);\n if (k==1)\n {\n re=d;\n }\n else\n {\n p=d/k;\n q=d/l;\n r=d/m;\n s=d/n;\n t=d/(k*l);\n u=d/(k*m);\n v=d/(k*n);\n w=d/(l*n);\n x=d/(l*m);\n y=d/(m*n);\n re=p+q+r+s-t-u-v-w-x-y;\n }\n printf(\"%d\\n\",re);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,j,x,y,z,res;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\n if(k==1)\n {\n res=d;\n }\n else\n {\n x=d/k;\n i= d-x;\n y=i/l;\n j=d-(x+y);\n z=j/m;\n res=x+y+z-1;\n }\n printf(\"%d\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n\nchar * read_line();\nvoid allocate_error();\nshort * remove_multiples(short * numbers, unsigned short * length);\nunsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons);\n\nint main() {\n\n\tchar * buffer = read_line();\n\tchar * rest;\n\n\tshort * numbers;\n\tunsigned short numbers_size = 4;\n\tunsigned long dragons;\n\tunsigned long solution = 0;\n\n\tnumbers = malloc(sizeof(unsigned short) * numbers_size);\n\tif (numbers == NULL)\n\t\tallocate_error();\n\n\t// Saves the numbers\n\tfor (unsigned short index=0; index<4; index++) {\n\n\t\tnumbers[index] = (short) strtol(buffer, &rest, 10);\n\t\tfree(buffer);\n\t\tbuffer = read_line();\n\t}\n\tdragons = strtol(buffer, &rest, 10);\n\tfree(buffer);\n\n\t// ----- SOLVE -----\n\t// Now we have to substract all dragons that got punised more than once\n\t// remove all multiples\n\tnumbers = remove_multiples(numbers, &numbers_size);\n\n\tfor (unsigned short index=0; index<numbers_size; index++) {\n\t}\n\n // Add all tortured dragons...\n for (unsigned short index=0; index<numbers_size; index++) {\n solution += (unsigned long) dragons / numbers[index];\n }\n\n if (numbers_size > 1) {\n // Now we need to substract all mutiple counted numbers\n solution -= substract_mutiple_tortured_dragons(numbers, &numbers_size, dragons);\n }\n\n printf(\"%lu\\n\", solution);\n\treturn EXIT_SUCCESS;\n}\n\nchar * read_line() {\n\n\tunsigned short buffersize = 10;\n\tunsigned short line_index = 0;\n\n\tchar * line = malloc(buffersize);\n\tchar * tmp;\n\n\t// ERROR\n\tif (line == NULL)\n\t\tallocate_error();\n\t// ERROR\n\n\tint character;\n\n\twhile ((character = getchar()) != '\\n' && character != EOF && buffersize < 65535) {\n\n\t\t// BUFFER IS TOO SMALL\n\t\tif (buffersize <= line_index + 1) {\n\t\t\tbuffersize += 10;\n\t\t\ttmp = realloc(line, buffersize);\n\n\t\t\t// ERROR\n\t\t\tif (tmp == NULL)\n\t\t\t\tallocate_error();\n\t\t\t// ERROR\n\t\t\t\n\t\t\tline = tmp;\n\t\t}\n\t\t// BUFFER IS TOO SMALL\n\n\t\tline[line_index++] = (char) character;\n\t}\n\n\t// Set the end of the line\n\tline[line_index] = '\\0';\n\n\t// Fit the allocated memory to the string lenght => No wasted memory\n\ttmp = realloc(line, strlen(line) + 1);\n\n\t// ERROR\n\tif (tmp == NULL)\n\t\tallocate_error();\n\t// ERROR\n\t\n\tline = tmp;\n\treturn line;\n}\n\nvoid allocate_error() {\n\tperror(\"Couldn't allocate memory!\");\n\texit(1);\n}\n\nshort * remove_multiples(short * numbers, unsigned short * length) {\n /*\n * This function will change the list `numbers` and will remove all mutiple numbers.\n */\n unsigned short amount_of_mutiples = 0;\n short * tmp;\n unsigned short tmp_index = 0;\n\n for (unsigned short index=0; index<*length; index++) {\n\n for(unsigned short control_index=0; control_index<*length; control_index++) {\n // Found a mutiple!!!\n // Except the same number\n if (numbers[control_index] % numbers[index] == 0 && control_index != index) {\n numbers[control_index] = -1;\n amount_of_mutiples++;\n }\n }\n\n // Now we must remove the mutiple numbers\n tmp = malloc(*length - amount_of_mutiples);\n\n // ERRROR\n if (tmp == NULL)\n allocate_error();\n // ERROR\n\n // now fill it with it's good numbers\n for (unsigned short get_single=0; get_single<*length; get_single++) {\n\n if (numbers[get_single] != -1)\n tmp[tmp_index++] = numbers[get_single];\n }\n free(numbers);\n\n // Now after removing the mutiples we can use it now\n numbers = tmp;\n *length -= amount_of_mutiples;\n amount_of_mutiples = 0;\n tmp_index = 0;\n }\n return numbers;\n}\n\nunsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons) {\n /*\n * This function will substract the amount of dragons which got tortured more than once.\n */\n unsigned long amount_of_tortured_dragons_than_once = 0;\n\n /*\n * index1: This will focus on one number at the beginning.\n * index2: This will iterate through the other numbers.\n * All in one they should create every multiple which are possible to create with the numbers.\n */\n unsigned short index1;\n unsigned short index2;\n\n for(index1=0; index1<*length; index1++) {\n\n for (index2=index1 + 1; index2<*length; index2++) {\n\n if (numbers[index1])\n amount_of_tortured_dragons_than_once += (unsigned long) round(dragons / (numbers[index1] * numbers[index2]));\n }\n }\n return amount_of_tortured_dragons_than_once;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d,i,brojac=0;\n int niz[10005]={0};\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if (k==1)\n {\n printf(\"%d\",d);\n return 0;\n }\n for (i=0; i<d; i++)\n if (i % k==0)\n niz[i]=1;\n for (i=0; i<d; i++)\n if (i % l==0)\n niz[i]=1;\n for (i=0; i<d; i++)\n if (i % m==0)\n niz[i]=1;\n for (i=0; i<d; i++)\n if (i % n==0)\n niz[i]=1;\n for (i=0; i<d; i++)\n if (niz[i]==0)\n brojac++;\n printf(\"%d\",d-brojac);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,j,x,arr[100009];\n scanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&x);\n int count=x;\n for(i=0;i<x;i+=a)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=b)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=c)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=d)\n {\n arr[i]++;\n }\n for(i=0;i<x;i++)\n {\n if(arr[i]==0)\n {\n count--;\n }\n }\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k, l, n, m, d, c=0;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n if(d<k||d<l||d<n||d<m)\n {\n printf(\"0\\n\");\n }\n int i;\n for(i = 1;i < d; i++)\n {\n if(!(i%k == 0|| i%l == 0|| i%n == 0|| i%m == 0 ))\n {\n c++;\n }\n }\n printf(\"%d\\n\", d-c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,m,n,o,d;\n int i;\n scanf(\"%d %d %d %d %d\",&l,&m,&n,&o,&d);\n int arr[100056];\n for(i=1;i<=d;i++)\n {\n if(i%l==0)\n arr[i]=-1;\n if(i%m==0)\n arr[i]=-1;\n if(i%n==0)\n arr[i]=-1;\n if(i%o==0)\n arr[i]=-1;\n }\n int count=0;\n for(i=1;i<=d;i++)\n {\n if(arr[i]==-1)\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\nint main()\n{\n int k, l, m, n, d;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n int a[d+1];\n for(int i = 0; i < d; i++)\n {\n a[i] = 0;\n }\n int counter = 0;\n for(int i = 0; i < d;i = i+k)\n {\n counter++;\n a[i]= 1 ;\n }\n for(int i = 0; i < d;i = i+l)\n {\n if(a[i] != 1)\n {\n counter++; a[i] = 1;\n }\n }\n for(int i = 0; i < d;i = i+m)\n {\n if(a[i] != 1){\n counter++; a[i] = 1; \n }\n \n }\n for(int i = 0; i < d;i = i+n)\n {\n if(a[i] != 1)\n counter++; a[i] = 1;\n }\n printf(\"%d\",counter);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,k,a=1,l,x=0,m,n,d,s[100000];\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if(k==1||l==1||m==1||n==1){\n printf(\"%d\",d);\n return 0;\n }\n for(i=1;k*i<=d;i++){\n s[x]=k*i;\n x++;\n }\n for(i=1;l*i<=d;i++){\n s[x]=l*i;\n x++;\n }\n for(i=1;m*i<=d;i++){\n s[x]=m*i;\n x++;\n }\n for(i=1;n*i<=d;i++){\n s[x]=n*i;\n x++;\n }\n for(i=0;i<x;i++){\n for(j=x-1;j>i;j--){\n if(s[i]>=s[j]){\n int temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n for(i=0;i<x-1;i++){\n if(s[i]!=s[i+1]){\n a++;\n }\n }\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k,l,m,n,s=0,i,d;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tfor(i=1;i<=d;i++)\n\t{\n\t if(k%i==0||l%i==0||m%i==0||n%i==0)\n\t s++;\n\n\t}\n\t\n\tprintf(\"%d\",s);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#define in freopen(\"in\", \"r+\", stdin)\n#define ou freopen(\"ou\", \"w+\", stdin)\nint main()\n{\n// in;\n// ou;\n int a[100000], k, l, m, n, d;\n scanf(\"%d %d %d %d %d\", &k, &l, &m, &n, &d);\n int i;\n for(i=0;i<d;i+=k)\n a[i-1]=1;\n for(i=0;i<d;i+=l)\n a[i-1]=1;\n for(i=0;i<d;i+=m)\n a[i-1]=1;\n for(i=0;i<d;i+=n)\n a[i-1]=1;\n int count=0;\n for(i=0;i<d;i++)\n if(a[i]==1)\n count++;\n printf(\"%d\\n\", count+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint k, l, m, n, d, i, c = 0;\n\tscanf(\"%d%d%d%d%d\",&k, &l, &m, &n, &d);\n\tif (k == 1)\n\t{\n\t\tprintf(\"%d\", d);\n\t}\n\telse\n\t{\n\t\tfor (i = 0; i < d; i++)\n\t\t{\n\t\t\tif(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\", c);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int j=0,f=0,e=2,i,k,l,m,n,d,a[1000],b[1000];\n\tscanf(\"%ld %ld %ld %ld %ld\",&k,&l,&m,&n,&d);\n\tif(k>d&&l>d&&m>d&&n>d)\n\t\tprintf(\"0\");\n\telse\n\t{\n\tfor(i=k;i<=d;i=k*e)\n\t{\n\t\ta[j]=i;\n\t\te++;\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=l;i<=d;i=l*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=m;i<=d;i=m*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=n;i<=d;i=n*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0&&i%m!=0)\n\t\tj++;\n\t}\n\tprintf(\"%ld\",j+1);\n\t}\n\n}\n"}, {"source_code": "#include <stdio.h>\nint gcd (int x, int y);\nint main(void){\n int k,l,m,n,d;\n int cnt=0;\n int i;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if (k==1||l==1||m==1||n==1){\n printf(\"%d\\n\",d);\n }\n else {\n for (i=1; i<=d; i++){\n if (k<d&&gcd(k,i)>1)\n cnt++;\n else if(gcd(l,k)==1&&l<d&&gcd(l,i)>1)\n cnt++;\n else if(gcd(l,m)==1&&m<d&&gcd(m,i)>1)\n cnt++;\n else if(gcd(m,k)==1&&n<d&&gcd(n,i)>1)\n cnt++; \n }\n printf(\"%d\\n\",cnt);\n}\n return 0;\n}\n \nint gcd (int x, int y){\n int r;\n while(1){\n r=x%y;\n if (r==0)\n break;\n x=y;\n y=r;\n }\n return y;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,k,l,m,n,d;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n \n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n n--;\n }\n \n printf(\"%d\",n);\n \n \n \n \n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d,sum;\n scanf(\"%d\\n %d\\n %d\\n %d\\n %d\",&k,&l,&m,&n,&d);\n if(k==1)\n printf(\"%d\",d);\n else\n {\n sum=d-n-k;\n printf(\"%d\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,a[10005],len,max=0,cur;\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor (cur=a[0],i=1,len=1;i<n;i++,cur=a[i])\n\t\tif (a[i]>=cur)\n\t\t{\n\t\t\tif (++len>max)\n\t\t\t\tmax=len;\n\t\t}\n\t\telse\n\t\t\tlen=1;\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k,l,m,n,d;\n scanf(\"%d,%d,%d,%d,%d\",&k,&l,&m,&n,&d);\n int i, ans = 0;\n for(i = 1; i <= d; i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0){\n ans++;\n }\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k=0,l=0,m=0,n=0,d=0;\n scanf(\"%d,%d,%d,%d,%d\",&k,&l,&m,&n,&d);\n printf(\"%d,%d,%d,%d,%d\",k,l,m,n,d);\n int i, ans = 0;\n for(i = 1; i <= d; i++){\n if(i%k==0||i%l==0||i%m==0||i%n==0){\n ans++;\n }\n }\n //printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint k, l, m, n, d, i, c = 0;\n\tscanf(\"%d%d%d%d%d\",&k, &l, &m, &n, &d);\n\tif (k == 1)\n\t{\n\t\tprintf(\"%d\", d);\n\t}\n\telse\n\t{\n\t\tfor (i = 0; i < d; i++)\n\t\t{\n\t\t\tif(i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)\n\t\t\t{\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\", c);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n long int a,b,c,d,i=0,j,k,l;\n\n scanf(\"%ld%ld%ld%ld%ld\",&a,&b,&c,&d,&l);\n\n j=l;\n while(l--){\n if(l%a!=0 && l%b!=0 && l%c!=0 && l%d!=0)i++;\n }\n\n printf(\"%ld\",j-i);\n\n}\n\n/*if(a!=1 && b!=1 && c!=1 && d!=1)i++;\n if(a!=2 && b!=2 && c!=2 && d!=2)i++;\n if(a!=3 && b!=3 && c!=3 && d!=3)i++;\n if(a!=4 && b!=4 && c!=4 && d!=4)i++;*/\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k,l,m,n,d;\n\tint dizi[100000];\n\tint secimler[4];\n\tfor (int i = 0; i < 100000; i++) {\n\t\tdizi[i] = 0; \n\t}\n\tscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\tsecimler[0] = k;\n\tsecimler[1] = l;\n\tsecimler[2] = m;\n\tsecimler[3] = n;\n\tint j = 0;\n\tfor (int u = 0; u < 4; u++) {\t\n\t\tif (secimler[u] == secimler[u-1]) {\n\t\t\tu++;\n\t\t}\n\t\telse {\n\t\t\tfor (int i = secimler[u]; i < d; i += secimler[u]) {\n\t\t\t\tint kontrol = 0;\n\t\t\t\tfor (int t = 0; t < 100; t++) \n\t\t\t\t\tif (dizi[t] == i) {\n\t\t\t\t\t\tkontrol = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (kontrol != 1) {\n\t\t\t\t\tdizi[j++] = i;\n\t\t\t\t\t//printf(\"%d\\n\",dizi[j-1]);\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (j == 0) printf(\"---%d\",j);\n\telse printf(\"---%d\",j+1);\t\t\t\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint k,l,m,n,d;\n\tscanf(\"%d\\ n\",&k);\n\tscanf(\"%d\\ n\",&l);\n\tscanf(\"%d\\ n\",&m);\n\tscanf(\"%d\\ n\",&n);\n\tscanf(\"%d\\ n\",&d);\n\tif(k==1)printf(\"%d\",d);\n\telse if(k==2&&l==3&&m==4&&n==5&&d==24)printf(\"17\");\n\telse printf(\"5\");\n}"}, {"source_code": "#include<stdio.h>\nint main() {\nint k,l,m,n,d,i,j,count=0;\nscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\nint a[d];\nfor(i = 0 ; i < d ; i++) {\na[i]= i +1;\n}\nif(k<=d && l<=d && m<=d && n<=d) {\nfor( j = k; j <= d; j++) {\nif ( j%k == 0) a[j]=0;\n}\nfor( j = l; j <= d; j++) {\nif ( j%l == 0) a[j]=0;\n}\nfor( j = m; j <= d; j++) {\nif ( j%m == 0) a[j]=0;\n}\nfor( j = n; j <= d; j++) {\nif ( j%n == 0) a[j]=0;\n}\n\nfor(i = 0 ; i< d ; i++) {\nif(a[i] == 0) count++;\n}\nprintf(\"%d\",count);\n}\nelse printf(\"0\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int k,l,m,n,d,i,counter = 0;\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if(d > m || d > n || d > k || d > l){\n for(i = 0; i < d; i++){\n if(i%k == 0 || i%l == 0 || i%m == 0 || i%n == 0){\n counter++;\n }\n }\n if(k == l || l == m || m == n || n == k ){\n printf(\"%d\",counter - 1);\n }\n else{\n printf(\"%d\",counter);\n }\n \n }\n else{\n printf(\"0\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint a[100001]={0};\n\tint k,l,m,n,d;\n\tint i;\n\tint count=0;\n\tscanf(\"%d %d %d %d\",&k,&l,&m,&n);\n\tscanf(\"%d\",&d);\n\n\tfor(i=1;i<d;i++)\n\t{\n\t\tif(i*k<=d)\n\t\t\ta[i*k-1] +=1;\n\t\tif(i*l<=d)\n\t\t\ta[i*l-1] +=1;\n\t\tif(i*m<=d)\n\t\t\ta[i*m-1] +=1;\n\t\tif(i*n<=d)\n\t\t\ta[i*n-1] +=1;\n\t}\n\tfor(i=0;i<d;i++)\n\t\tif(a[i]>0)\n\t\t\tcount ++;\n\tprintf(\"%d\",count);\n\n\t\n\n\treturn 0;\n}\n \t\t\t\t \t\t \t\t\t \t\t \t \t\t \t\t \t\t"}, {"source_code": "#include<stdio.h>\nint count[1000001]={0};\nint main()\n{\n\tint k,l,m,n,d;\n\n\tint i,j;\n\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&n);\n\n\tscanf(\"%d\",&d);\n\n\tfor(i=k;i<=d;i=i+k)\n\t{\n\t\tcount[i]=1;\n//\t\tprintf(\"The value of k is: %d\\n\",i);\n\t}\n\tfor(i=l;i<d;i=i+l)\n {\n count[i]=1;\n }\n\tfor(i=m;i<d;i=i+m)\n {\n count[i]=1;\n }\n\tfor(i=n;i<d;i=i+n)\n {\n count[i]=1;\n }\n\n\tint ctr=0;\n\n\tfor(i=1;i<1000001;i++)\n\t{\n//\t\tprintf(\"%d\\n\",count[i]);\n\t\tif(count[i]==1)\n\t\t{\n\t\t\tctr++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ctr);\n\n\treturn 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k,l,m,n,d;\n\t\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\tscanf(\"%d\",&m);\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&d);\n\n\tint i,a[d],u=0;\n\t\n\tfor (int i = 0; i < d; ++i)\t\t//all dragons numbered\n\t{\n\t\ta[i]=i+1;\n\t}\n\t\t\n\tif (d>k)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=k)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\t\t\n\tif (d>l)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=l)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>m)\t\n\t{\t\n\t\tfor (int i = 0; i <d; i+=m)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d>n)\n\t{\t\n\t\tfor (int i = 0; i <d; i+=n)\n\t\t{\n\t\t\ta[i]=0;\n\t\t}\n\t}\n\n\tif (d<k) a[0]=0;\n\tif (d<l) a[0]=0;\n\tif (d<m) a[0]=0;\n\tif (d<n) a[0]=0;\n\n\n\tfor (int i = 0; i < d; ++i)\n\t{\n\t\tif (a[i]==0)\n\t\t{\n\t\t\tu=u+1;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\",u);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n;\n long int d,i=0,t=0;\n scanf(\"%d %d %d %d %ld\",&k,&l,&m,&n,&d);\n if((k==1)||(l==1)||(m==1)||(n==1))\n printf(\"%ld\",d);\n else\n {\n t=d;\n while(t>0)\n {\n t=t-k;\n i++;\n }\n t=d;\n while(t>0)\n {\n if(t%k==0)\n t=t-l;\n else\n {\n t=t-l;\n i++;\n }\n }\n t=d;\n while(t>0)\n {\n if((t%k==0)||(t%l==0))\n t=t-m;\n else\n {\n t=t-m;\n i++;\n }\n } \n t=d;\n while(t>0)\n {\n if((t%k==0)||(t%l==0)||(t%m==0))\n t=t-n;\n else\n {\n t=t-n;\n i++;\n }\n }\n }\n printf(\"%ld\",i);\n return(0);\n } \n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k,l,m,n,d;\n\tint dizi[100000];\n\tint secimler[4];\n\tfor (int i = 0; i < 100000; i++) {\n\t\tdizi[i] = 0; \n\t}\n\tscanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n\tsecimler[0] = k;\n\tsecimler[1] = l;\n\tsecimler[2] = m;\n\tsecimler[3] = n;\n\tint j = 0;\n\tfor (int u = 0; u < 4; u++) {\t\n\t\tif (secimler[u] == secimler[u-1]) {\n\t\t\tu++;\n\t\t\tcontinue;\n\t\t}\n\t\tfor (int i = secimler[u]; i < d; i += secimler[u]) {\n\t\t\tint kontrol = 0;\n\t\t\tfor (int t = 0; t < 100; t++) \n\t\t\t\tif (dizi[t] == i) {\n\t\t\t\t\tkontrol = 1;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (kontrol != 1) {\n\t\t\t\tdizi[j++] = i;\t\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%d\",j+1);\t\t\t\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int i,k,l,m,n,d,x;\n scanf(\"%d\",&k);\n scanf(\"%d\",&l);\n scanf(\"%d\",&m);\n scanf(\"%d\",&n);\n scanf(\"%d\",&d);\n x=d;\n for(i=1;i<=d;i++)\n {\n if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))\n { printf(\"%d\",i);\n continue;\n }\n else x--;\n }\n\n printf(\"%d\",x);\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100000] = {0}, k , l, d, m, n;\n scanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\n for(int i = 1; i < d; i++)\n {\n a[k*i] = 1;\n a[l*i] = 1;\n a[m*i] = 1;\n a[n*i] = 1;\n }\n int c = 0;\n for(int i = 0; i < d; i++)\n {\n if(a[i] == 1)\n c++;\n }\n printf(\"%d\", c);\n \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\nint main()\n{\n\tint k,l,m,n,d,i,num,min,count,cnt2=0;\n\tscanf(\"%d\\n%d\\n%d\\n%d\\n%d\",&k,&l,&m,&n,&d);\n\tint damaged[d],damaged2[d],damaged3[d],damaged4[d];\n\tdamaged[1]=0;\n\tdamaged2[1]=0;\n\tdamaged3[1]=0;\n\tdamaged4[1]=0;\n\tif(k==1||l==1||m==1||n==1)\n\t{\n\t\tprintf(\"%d\\n\",d);\n\t}\n\telse\n\t{\n\t if((k>l) && (k>m) && (k>n))\n min=k;\n \t else\tif((l>k) && (l>m) && (l>n))\n \tmin=l;\n \telse\tif((m>l) && (m>l) && (m>n))\n \t\tmin=k;\n \t\telse\tif((n>l) && (n>m) && (n>k))\n \t\t\t\t min=n;\n if(min<=d)\n\t { \n\tfor(num=min;num<=d;num++)\n\t{\n count = 0;\n for(i=2;i<=num/2;i++)\n\t\t{\n if(num%i==0)\n\t\t\t {\n count++;\n break;\n }\n \t}\n if(count==0 && num!=k && num!=l && num!=m && num!=n)\n cnt2++;\t\t\t\n\t}\n\tprintf(\"%d\",d-cnt2-1);\n\t}\n\t\telse\n\t\t\tprintf(\"0\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,a[10005],len,max=0,cur;\n\tscanf(\"%d\",&n);\n\tfor (i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor (cur=a[0],i=1,len=1;i<n;i++,cur=a[i])\n\t\tif (a[i]>=cur)\n\t\t{\n\t\t\tif (++len>max)\n\t\t\t\tmax=len;\n\t\t}\n\t\telse\n\t\t\tlen=1;\n\tprintf(\"%d\\n\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,i,j,x,arr[100009];\n scanf(\"%d %d %d %d %d\",&a,&b,&c,&d,&x);\n int count=0;\n for(i=0;i<x;i+=a)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=b)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=c)\n {\n arr[i]++;\n }\n for(i=0;i<x;i+=d)\n {\n arr[i]++;\n }\n for(i=0;i<=x;i++)\n {\n if(arr[i]!=0)\n {\n count++;\n }\n }\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int temp,j=0,f=0,e=2,i,k,l,m,n,d,a[4],b[1000];\n\tscanf(\"%ld %ld %ld %ld %ld\",&k,&l,&m,&n,&d);\n\ta[0]=k;\n\ta[1]=l;\n\ta[2]=m;\n\ta[3]=n;\n\tfor(i=0;i<3;i++)\n\t\tfor(j=1;j<4;j++)\n\t\tif(a[i]>a[j])\n\t{\n\t\ttemp=a[i];\n\t\ta[i]=a[j];\n\t\ta[j]=temp;\n\t}\n\tj=0;\n\tk=a[0];\n\tl=a[1];\n\tm=a[2];\n\tn=a[3];\n\tif(d==59392)\n\t\tprintf(\"59392\");\n\telse\n\t{\n\tfor(i=k;i<=d;i=k*e)\n\t{\n\t\ta[j]=i;\n\t\te++;\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=l;i<=d;i=l*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=m;i<=d;i=m*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0)\n\t\tj++;\n\t}\n\te=2;\n\tfor(i=n;i<=d;i=n*e)\n\t{\n\t\te++;\n\t\tif(i%k!=0&&i%l!=0&&i%m!=0)\n\t\tj++;\n\t}\n\t/*if(k>1&&l>1&&m>1&&n>1)\n\t{\n\t\tif(k==l||k==m||k==n)\n\t\tj++;\n\tif(l==m||l==n)\n\t\tj++;\n\tif(m==n)\n\t\tj++;\n\t}*/\n\tif(j>0)\n\t\tj++;\n\tif(j%2==0)\n\tprintf(\"%ld\",j);\n\telse\n\t\tprintf(\"%ld\",--j);\n\t}\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,m,n,d,i,j,b,find=0,x;\n\n scanf(\"%d %d %d %d %d\",&k,&l,&m,&n,&d);\n int arr[d+1];\n\n if(k==1)\n {\n find=d;\n }\n if(k > d)\n find=0;\n else\n {\n for(b=1;b<=d;b++){\n arr[b]=0;\n }\n for(i=k;i<=d;i+=k){\n arr[i]=1;\n find++;\n\n }\n for(j=l;j<=d;j+=l){\n if(arr[j]==0){\n arr[j]=1;\n find++;\n\n }\n\n }\n for(x=n;x<=d;x+=n){\n\n if(arr[x]==0){\n find++;\n }\n }\n\n }\n printf(\"%d\\n\",find);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int d,i;\n scanf(\"%I64d\",&d);\n int k,l,m,n;\n long long int o=0;\n scanf(\"%d%d%d%d\",&k,&l,&m,&n);\n for(i=1;i<=d;i++){\n if(i%k!=0 && i%l!=0 && i%m!=0 && i%n!=0)\n o++;\n }\n printf(\"%d\",d-o);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint k,l,m,n,d,count=0,c,i;\nscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\nint hash[100000]={0};\nfor(i=k,c=1;i<=d;c++,i=k*c)\n{\nif(hash[i]==0)\nhash[i]=1;\n}\nfor(i=l,c=1;i<=d;c++,i=l*c)\nif(hash[i]==0)\nhash[i]=1;\nfor(i=m,c=1;i<=d;c++,i=m*c)\nif(hash[i]==0)\nhash[i]=1;\nfor(i=n,c=1;i<=d;c++,i=n*c)\nif(hash[i]==0)\nhash[i]=1;\nfor(i=0;i<100000;i++)\nif(hash[i]>0)\n{\nprintf(\"%d \",i);\ncount++;\n}\nprintf(\"%d\",count);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\nint k, l, m, n, d, i= 0;\nscanf(\"%d%d%d%d%d\", &k, &l, &m, &n, &d);\nint ans = 0;\nfor( i =0; i< d; i++){\n if((i%k==0) || (i%l==0) ||(i%m==0) ||(i%n==0))\n ans ++;\n}\nprintf(\"%d\", ans);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int k,l,m,n,d,i,brojac=0;\n int niz[10050]={0};\n scanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n if (k==1 || l==0 || m==0 || n==0)\n {\n printf(\"%d\",d);\n return 0;\n }\n for (i=0; i<d; i=i+k)\n niz[i]=1;\n for (i=0; i<d; i=i+l)\n niz[i]=1;\n for (i=0; i<d; i=i+m)\n niz[i]=1;\n for (i=0; i<d; i=i+n)\n niz[i]=1;\n for (i=0; i<d; i=i++)\n if (niz[i]!=0)\n brojac++;\n printf(\"%d\",brojac);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint a[100005];\nint main()\n{\n int d,i,x[4],min,sum=0,temp,j=0;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&x[i]);\n }\n scanf(\"%d\",&d);\n min=x[0];\n for(i=1;i<4;i++)\n {\n if(x[i]<min)\n min=x[i];\n }\n for(i=1;i<=d;i++)\n {\n a[i]=i;\n }\n if(min==1)\n {\n printf(\"%d\",d);\n return 0;\n }\n else for(i=1;i<=d;i++)\n {\n for(j=1;j*x[0]<=d;j++)\n {\n if(a[i]==(j*x[0])||a[i]==(j*x[1])||a[i]==(j*x[2])||a[i]==(j*x[3]))\n {\n a[i]=0;\n }\n }\n }\n for(i=1;i<=d;i++)\n {\n if(a[i]!=0)\n sum++;\n }\n printf(\"%d\",d-sum);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,k,l,m,n,d,count=0;\n\tscanf(\"%d%d%d%d%d\",&k,&l,&m,&n,&d);\n\tint a[(d+1)];\n\tfor(i=k;i<=d;i+=k)\n\t{\n\t\ta[i]=1;\n\t}\n\tfor(i=l;i<=d;i+=l)\n\t{\n\t\ta[i]=1;\n\t}\n\tfor(i=m;i<=d;i+=m)\n\t{\n\t\ta[i]=1;\n\t\t\n\t}\n\tfor(i=n;i<=d;i+=n)\n\t{\n\t\ta[i]=1;\n\t\t\n\t}\n\tfor(i=1;i<=d;i++)\n\t{\n\t\tif(a[i]==1)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\",count);\n\treturn 0;\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n#include <math.h>\n\nchar * read_line();\nvoid allocate_error();\nshort * remove_multiples(short * numbers, unsigned short * length);\nunsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons);\n\nint main() {\n\n\tchar * buffer = read_line();\n\tchar * rest;\n\n\tshort * numbers;\n\tunsigned short numbers_size = 4;\n\tunsigned long dragons;\n\tunsigned long solution = 0;\n\n\tnumbers = malloc(sizeof(unsigned short) * numbers_size);\n\tif (numbers == NULL)\n\t\tallocate_error();\n\n\t// Saves the numbers\n\tfor (unsigned short index=0; index<4; index++) {\n\n\t\tnumbers[index] = (short) strtol(buffer, &rest, 10);\n\t\tfree(buffer);\n\t\tbuffer = read_line();\n\t}\n\tdragons = strtol(buffer, &rest, 10);\n\tfree(buffer);\n\n\t// ----- SOLVE -----\n\t// Now we have to substract all dragons that got punised more than once\n\t// remove all multiples\n\tnumbers = remove_multiples(numbers, &numbers_size);\n\n\tfor (unsigned short index=0; index<numbers_size; index++) {\n\t}\n\n // Add all tortured dragons...\n for (unsigned short index=0; index<numbers_size; index++) {\n solution += (unsigned long) dragons / numbers[index];\n }\n\n if (numbers_size > 1) {\n // Now we need to substract all mutiple counted numbers\n solution -= substract_mutiple_tortured_dragons(numbers, &numbers_size, dragons);\n }\n\n printf(\"%lu\\n\", solution);\n\treturn EXIT_SUCCESS;\n}\n\nchar * read_line() {\n\n\tunsigned short buffersize = 10;\n\tunsigned short line_index = 0;\n\n\tchar * line = malloc(buffersize);\n\tchar * tmp;\n\n\t// ERROR\n\tif (line == NULL)\n\t\tallocate_error();\n\t// ERROR\n\n\tint character;\n\n\twhile ((character = getchar()) != '\\n' && character != EOF && buffersize < 65535) {\n\n\t\t// BUFFER IS TOO SMALL\n\t\tif (buffersize <= line_index + 1) {\n\t\t\tbuffersize += 10;\n\t\t\ttmp = realloc(line, buffersize);\n\n\t\t\t// ERROR\n\t\t\tif (tmp == NULL)\n\t\t\t\tallocate_error();\n\t\t\t// ERROR\n\t\t\t\n\t\t\tline = tmp;\n\t\t}\n\t\t// BUFFER IS TOO SMALL\n\n\t\tline[line_index++] = (char) character;\n\t}\n\n\t// Set the end of the line\n\tline[line_index] = '\\0';\n\n\t// Fit the allocated memory to the string lenght => No wasted memory\n\ttmp = realloc(line, strlen(line) + 1);\n\n\t// ERROR\n\tif (tmp == NULL)\n\t\tallocate_error();\n\t// ERROR\n\t\n\tline = tmp;\n\treturn line;\n}\n\nvoid allocate_error() {\n\tperror(\"Couldn't allocate memory!\");\n\texit(1);\n}\n\nshort * remove_multiples(short * numbers, unsigned short * length) {\n /*\n * This function will change the list `numbers` and will remove all mutiple numbers.\n */\n unsigned short amount_of_mutiples = 0;\n short * tmp;\n unsigned short tmp_index = 0;\n\n for (unsigned short index=0; index<*length; index++) {\n\n for(unsigned short control_index=index + 1; control_index<*length; control_index++) {\n // Found a mutiple!!!\n if (numbers[control_index] % numbers[index] == 0) {\n numbers[control_index] = -1;\n amount_of_mutiples++;\n }\n }\n\n // Now we must remove the mutiple numbers\n tmp = malloc(*length - amount_of_mutiples);\n\n // ERRROR\n if (tmp == NULL)\n allocate_error();\n // ERROR\n\n // now fill it with it's good numbers\n for (unsigned short get_single=0; get_single<*length; get_single++) {\n\n if (numbers[get_single] != -1)\n tmp[tmp_index++] = numbers[get_single];\n }\n free(numbers);\n\n // Now after removing the mutiples we can use it now\n numbers = tmp;\n *length -= amount_of_mutiples;\n amount_of_mutiples = 0;\n tmp_index = 0;\n }\n return numbers;\n}\n\nunsigned short substract_mutiple_tortured_dragons(short * numbers, unsigned short * length, unsigned long dragons) {\n /*\n * This function will substract the amount of dragons which got tortured more than once.\n */\n unsigned long amount_of_tortured_dragons_than_once = 0;\n\n /*\n * index1: This will focus on one number at the beginning.\n * index2: This will iterate through the other numbers.\n * All in one they should create every multiple which are possible to create with the numbers.\n */\n unsigned short index1;\n unsigned short index2;\n\n for(index1=0; index1<*length; index1++) {\n\n for (index2=index1 + 1; index2<*length; index2++) {\n\n if (numbers[index1])\n amount_of_tortured_dragons_than_once += (unsigned long) round(dragons / (numbers[index1] * numbers[index2]));\n }\n }\n return amount_of_tortured_dragons_than_once;\n}\n"}], "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7"} {"nl": {"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\u2009\u00d7\u2009m 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,\u2009j) 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,\u2009y) on the board to position (x\u2009-\u2009a,\u2009y\u2009-\u2009b); move the candy from position (x,\u2009y) on the board to position (x\u2009+\u2009a,\u2009y\u2009-\u2009b); move the candy from position (x,\u2009y) on the board to position (x\u2009-\u2009a,\u2009y\u2009+\u2009b); move the candy from position (x,\u2009y) on the board to position (x\u2009+\u2009a,\u2009y\u2009+\u2009b). 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,\u2009j) to one of the chessboard corners. Help them cope with the task! ", "input_spec": "The first line of the input contains six integers n,\u2009m,\u2009i,\u2009j,\u2009a,\u2009b (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009106;\u00a01\u2009\u2264\u2009i\u2009\u2264\u2009n;\u00a01\u2009\u2264\u2009j\u2009\u2264\u2009m;\u00a01\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009106). You 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,\u2009j) 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,\u2009m), (n,\u20091), (n,\u2009m), (1,\u20091).", "output_spec": "In a single line print a single integer \u2014 the minimum number of moves needed to get the candy. If 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.", "sample_inputs": ["5 7 1 3 2 2", "5 5 2 3 1 1"], "sample_outputs": ["2", "Poor Inna and pony!"], "notes": "NoteNote to sample 1:Inna and the pony can move the candy to position (1\u2009+\u20092,\u20093\u2009+\u20092)\u2009=\u2009(3,\u20095), from there they can move it to positions (3\u2009-\u20092,\u20095\u2009+\u20092)\u2009=\u2009(1,\u20097) and (3\u2009+\u20092,\u20095\u2009+\u20092)\u2009=\u2009(5,\u20097). These positions correspond to the corner squares of the chess board. Thus, the answer to the test sample equals two."}, "positive_code": [{"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif(i==1&&j==1) sum=0;\n\tif(i==n&&j==1) sum=0;\n\tif(i==n&&j==m) sum=0;\n\tif(i==1&&j==m) sum=0;\n if((i-a<1&&i+a>n)||(j+b>m&&j-b<1))\n\t{ if(sum==100000000)\n\t printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",sum);\n\t //printf(\"*******\");\n\t}\n\n else\n {\n\t\tif((n-i)%a==0&&(m-j)%b==0)\n\t {\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b; // printf(\"%d%d\",x,y);\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}//printf(\"*******\");\n\t }\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t sum=y;\n\t\t\t}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t\tsum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{ if(x<sum)\n\t\t\t sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint calc_moves(int, int, int, int, int, int);\nint min(int, int);\n\nint main(){\n \n int i, j, x, y, n, m, a, b;\n scanf(\"%d %d %d %d %d %d\", &n, &m, &x, &y, &a, &b);\n\n int sol1 = calc_moves(x, y, 1, 1, a, b);\n int sol2 = calc_moves(x, y, 1, m, a, b);\n int sol3 = calc_moves(x, y, n, 1, a, b);\n int sol4 = calc_moves(x, y, n, m, a, b);\n\n if (sol1 == -1 && sol2 == -1 && sol3 == -1 && sol4 == -1) {\n printf(\"Poor Inna and pony!\\n\");\n }\n else {\n int sol = min(sol1, min(sol2, min(sol3, sol4)));\n if (sol > 0 && ((x - a < 1 && x + a > n) || (y - b < 1 && y + b > m))) {\n printf(\"Poor Inna and pony!\\n\");\n }\n else {\n printf(\"%d\\n\", sol);\n }\n }\n\n#ifdef _AT_HOME_\n system(\"pause\");\n#endif\n\n return 0;\n}\n\nint calc_moves(int start_x, int start_y, int finish_x, int finish_y, int step_x, int step_y) {\n\n int dx = abs(start_x - finish_x);\n int dy = abs(start_y - finish_y);\n\n if (dx % step_x != 0 || dy % step_y != 0) {\n return -1;\n }\n\n int sx = dx / step_x;\n int sy = dy / step_y;\n\n if (abs(sx - sy) & 1) {\n return -1;\n }\n else {\n return (sx > sy)?sx:sy;\n }\n\n}\n\nint min(int a, int b) {\n if (a == -1 || b == -1) {\n return -a*b;\n }\n else{\n return (a > b)?b:a;\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,i,j,a,b;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\nint x,y,h;\nint ma[4];\nfor(h=0;h<4;h++)\n{ma[h]=999999;\n}\nif(((i==n)&&(j==m))||((i==1)&&(j==m))||((i==1)&&(j==1))||((i==n)&&(j==1)))\n{\n printf(\"0\\n\");\n return 0;\n}\nif((b>=m)||(a>=n))\n{\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}\nif((((i-1)%a)==0)&&(((j-1)%b)==0))\n{\n if(((i-1)/a+(j-1)/b)%2==0)\nma[0]=((i-1)/(a)>(j-1)/(b)?(i-1)/(a):(j-1)/(b));\n //printf(\"here %d\\n\",ma[0]);\n\n}\nif((((i-1)%a)==0)&&(((m-j)%b)==0))\n{\n if(((i-1)/a+(m-j)/b)%2==0)\nma[1]=((i-1)/(a)>(m-j)/(b)?(i-1)/(a):(m-j)/(b));\n //printf(\"hrtyr %d\\n\",ma[1]);\n}\nif((((n-i)%a)==0)&&(((j-1)%b)==0))\n{\n if(((n-i)/a+(j-1)/b)%2==0)\nma[2]=((n-i)/(a)>(j-1)/(b)?(n-i)/(a):(j-1)/(b));\n\n //printf(\"hrtyr3 %d\\n\",ma[2]);\n}\nif((((n-i)%a)==0)&&(((m-j)%b)==0))\n{\n if(((n-i)/a+(m-j)/b)%2==0)\nma[3]=((n-i)/(a)>(m-j)/(b)?(n-i)/(a):(m-j)/(b));\n\n\n // printf(\"hrtyr4 %d\\n\",ma[3]);\n}\n\n\n/*if(((n-i)%(2*a)==0)&&((m-j)==0))\n{ma[4]=(n-i)/a;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n}\nelse if(((m-j)%(2*b)==0)&&((n-i)==0))\n{\nma[4]=(m-j)/b;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n\n}\nif(((i-1)%(2*a)==0)&&(j-1==0))\n{\nma[5]=(i-1)/a;\n // printf(\"here %d\\n\",ma[0]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-1==0))\n{\nma[5]=(j-1)/b;\n //printf(\"here %d\\n\",ma[0]);\n\n}\n\n\n\nif(((i-1)%(2*a)==0)&&(j-m==0))\n{\nma[6]=(i-1)/a;\n //printf(\"here %d\\n\",ma[6]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-n==0))\n{\n ma[6]=(j-1)/b;\n //printf(\"here %d\\n\",ma[6]);\n\n}\n\n\nif(((n-i)%(2*a)==0)&&(j-1==0))\n{\nma[7]=(n-i)/a;\n //printf(\"here %d\\n\",ma[7]);\n\n}\nelse if(((m-j)%(2*b)==0)&&(i-1==0))\n{\n ma[7]=(m-j)/b;\n //printf(\"here %d\\n\",ma[7]);\n\n}\n\n\n\n\n*/\n\n\n\nint temp=ma[0];\nfor(h=0;h<4;h++)\n{\n if(temp>ma[h])\n temp=ma[h];\n}\nif(temp==999999)\nprintf(\"Poor Inna and pony!\\n\");\nelse\nprintf(\"%d\\n\",temp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min=1000000000;\nint n,m,i,j,a,b;\nint flag;\n\nvoid gao(int x,int y){\n if(flag && (x || y)) return ;\n if((x+y)%2) return ;\n if(x<y) x=y;\n if(min>x) min=x;\n}\n\nint main(void){\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n if((n-i<a && i-1<a) || (m-j<b && j-1<b)) flag=1;\n else flag=0;\n if((i-1)%a==0 && (j-1)%b==0) gao((i-1)/a,(j-1)/b);\n if((i-1)%a==0 && (m-j)%b==0) gao((i-1)/a,(m-j)/b);\n if((n-i)%a==0 && (j-1)%b==0) gao((n-i)/a,(j-1)/b);\n if((n-i)%a==0 && (m-j)%b==0) gao((n-i)/a,(m-j)/b);\n if(min<1000000000) printf(\"%d\",min);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint min(int x1,int x2){if(x1<x2)return x1;else return x2;}\nint max(int x1,int x2){if(x1>x2)return x1;else return x2;}\n\nint n,m,i,j,a,b,dx,dy;\nint count=999999;\n\nvoid check(int x1, int x2)\n{\n if (x1 == i && x2 == j)\n {\n count = 0; \n return;\n }\n if (i + a > n && i - a <= 0) return;\n if (j + b > m && j - b <= 0) return;\n x1 = abs(x1 - i); x2 = abs(x2 - j);\n if (x1 % a || x2 % b) return;\n x1 =x1/ a;\n x2 =x2/ b;\n if (x1 % 2 != x2 % 2) return;\n count = min(count, max(x1, x2));\n}\n\nint main()\n{\n \n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n \n check(1, 1);\n check(1, m);\n check(n, 1);\n check(n, m);\n \n if(count==999999)\n printf(\"Poor Inna and pony!\"); \n else \n printf(\"%d\",count); \n \n return 0;\n \n \n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,x,y,a,b;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&x,&y,&a,&b);\n int min=10000000,no1,no2;\n if((x-1)%a==0&&(y-1)%b==0)\n {\n no1=(x-1)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0&&1+b<=m)\n {\n if(min>no1)\n min=no1;\n }\n }\n else if(no2>no1)\n {\n if((no2-no1)%2==0&&1+a<=n)\n {\n if(min>no2)\n min=no2;\n }\n }\n else\n {\n if(min>no1)\n min=no1;\n }\n }\nif((x-1)%a==0&&(m-y)%b==0)\n {\n no1=(x-1)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0&&1+b<=m)\n {\n if(min>no1)\n min=no1;\n }\n }\n else if(no2>no1)\n {\n if((no2-no1)%2==0&&1+a<=n)\n {\n if(min>no2)\n min=no2;\n }\n }\n else\n {\n if(min>no1)\n min=no1;\n }\n }\n if((n-x)%a==0&&(m-y)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0&&1+b<=m)\n {\n if(min>no1)\n min=no1;\n }\n }\n else if(no1<no2)\n {\n if((no2-no1)%2==0&&1+a<=n)\n {\n if(min>no2)\n min=no2;\n }\n }\n else\n {\n if(min>no1)\n min=no1;\n }\n }\n if((n-x)%a==0&&(y-1)%b==0)\n {\n no1=(n-x)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0&&1+b<=m)\n {\n if(min>no1)\n min=no1;\n }\n }\n else if(no2>no1)\n {\n if((no2-no1)%2==0&&1+a<=n)\n {\n if(min>no2)\n min=no2;\n }\n }\n else\n {\n if(min>no1)\n min=no1;\n }\n }\n if(min<10000000)\n printf(\"%d\",min);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint min (int a, int b)\n{\n if (a>b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n\n if ((i == 1 || i == n) && (j == 1 || j == m))\n {\n printf(\"0\\n\");\n return 0;\n }\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = INF;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((n-i)/a - (m-j)/b) % 2 == 0) && (a > (n-i) || b > (m-j)))\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((i-1)/a - (m-j)/b) % 2 == 0) && (a > (i-1) || b > (m-j)))\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((n-i)/a - (j-1)/b) % 2 == 0) && (a > (n-i) || b > (j-1)))\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((i-1)/a - (j-1)/b) % 2 == 0) && (a > (i-1) || b > (j-1)))\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == INF) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (n>a && m>b){\n\t\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n}\n \n else{\n \t\n \tif ( (i==n && j==m) || (i==1 && j==1) || (i==n && j==1) || (j==m && i==1) ) {\n \t\nans1=0; \t\n }\n \t\n }\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a,int b)\n{return a>b?a:b;}\nint min(int a,int b)\n{return a>b?b:a;}\nint f[4];\nint n,m,i,j,a,b;\nint main()\n{\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tf[0]=i-1;f[1]=n-i;f[2]=j-1;f[3]=m-j;\n\tfor(int i=0;i<2;i++)\n\t{\n\t\tif(f[i]%a!=0)\n\t\tf[i]=-1;\n\t\telse\n\t\tf[i]=f[i]/a;\n\t}\n\tfor(int i=2;i<4;i++)\n\t{\n\t\tif(f[i]%b!=0)\n\t\tf[i]=-1;\n\t\telse\n\t\tf[i]=f[i]/b;\n\t}\n\tint ans=100000000;\n\tfor(int i=0;i<2;i++)\n\t{\n\t\tfor(int j=2;j<4;j++)\n\t\t{\n\t\t\tif(f[i]!=-1&&f[j]!=-1)\n\t\t\t{\n\t\t\t\tif(f[i]==0&&f[j]!=0&&a>=n||f[i]!=0&&f[j]==0&&b>=m)\n\t\t\t\tcontinue;\n\t\t\t\tif((int)fabs(f[i]-f[j])%2==0)\n\t\t\t\tans=min(ans,max(f[i],f[j]));\n\t\t\t}\n\t\t}\n\t}\n\tif(ans<100000000)\n\tprintf(\"%d\\n\",ans);\n\telse\n\tprintf(\"Poor Inna and pony!\\n\");\n}"}, {"source_code": "#include <stdio.h>\n\n#define INF (1<<29)\n\nint n, m, i, j, a, b;\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint solve(int i, int j){\n\tint ret = 0;\n\tif (i % a || j % b) return INF;\n\tret = min(i/a, j/b);\n\ti -= ret * a;\n\tj -= ret * b;\n\tif (i && j) return INF;\n\tif (j/b % 2 != 0 || i/a % 2 != 0) return INF;\n\tif (i == 0 && j != 0 && a >= n) return INF;\n\tif (j == 0 && i != 0 && b >= m) return INF;\n\treturn ret + j/b + i/a;\n}\n\nint main(void){\n\tscanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n\tint x = min(min(solve(i-1,j-1),solve(n-i,j-1)),min(solve(i-1,m-j),solve(n-i,m-j)));\n\tif (x < INF)\n\t\tprintf(\"%d\\n\", x);\n\telse\n\t\tprintf(\"Poor Inna and pony!\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m;\n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n if ( n <= a || m <= b ) {\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] == 0 && cj[ k ] == 0 )\n min = 0;\n } else\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp;\n\n ci[ k ] = ci[ k ] < 0 ? -ci[ k ] : ci[ k ];\n cj[ k ] = cj[ k ] < 0 ? -cj[ k ] : cj[ k ];\n tmp = ci[ k ] / a > cj[ k ] / b ? ci[ k ] / a : cj[ k ] / b;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m;\n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] == 0 && cj[ k ] == 0 || n > a && m > b )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp;\n\n ci[ k ] = ci[ k ] < 0 ? -ci[ k ] : ci[ k ];\n cj[ k ] = cj[ k ] < 0 ? -cj[ k ] : cj[ k ];\n tmp = ci[ k ] / a > cj[ k ] / b ? ci[ k ] / a : cj[ k ] / b;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong max(long x , long y){ return x>y?x:y; }\nint main()\n{\n long i,j,n,m,a,b,ans[4],min,f=0;\n long cint,dint;\n float c,d;\n scanf(\"%ld%ld%ld%ld%ld%ld\",&n,&m,&i,&j,&a,&b);\n \n if((i==1 || i==n) && (j==1 || j==m))\n {\n printf(\"0\");\n return 0;\n }\n \n if(a>=n || b>=m)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n \n \n c=(i-1)*1.0/a;\n d=(j-1)*1.0/b;\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(j-1)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if((abs(cint-dint))%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(i-1)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n if(f==0)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n min=ans[0];\n for(i=1;i<f;i++)\n if(min>ans[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,m;\nin_bounce(int x,int y)\n{\n if(x<=n&&x>=1&&y<=m&&y>=1) return 1;\n return 0;\n}\nmain()\n{\n int i,j,a,b,k,dir[4][2],nowdx,nowdy,min;\n while(~scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b)) \n {\n\t min=9999999;\n dir[0][0]=1;dir[0][1]=1;\n\t dir[1][0]=1;dir[1][1]=m;\n\t dir[2][0]=n;dir[2][1]=m;\n\t dir[3][0]=n;dir[3][1]=1;\n\t for(k=0;k<4;k++)\n\t {\n\t nowdx=abs(i-dir[k][0]);\n\t\t nowdy=abs(j-dir[k][1]);\n\t\t if(nowdx%a!=0||nowdy%b!=0) continue;\n\t\t else \n\t\t if(nowdx/a==nowdy/b&&min>nowdx/a) min=nowdx/a;\n\t\t else if(nowdx/a>nowdy/b) \n\t\t {if((nowdx/a-nowdy/b)%2==0&&(min>nowdy/b+(nowdx/a-nowdy/b))&&(in_bounce(i,j-b)||in_bounce(i,j+b))) min=nowdy/b+(nowdx/a-nowdy/b);}\n\t\t else if((nowdy/b-nowdx/a)%2==0&&(min>nowdx/a+(nowdy/b-nowdx/a))&&(in_bounce(i-a,j)||in_bounce(i+a,j))) min=nowdx/a+(nowdy/b-nowdx/a);\t\n\t }\n\t if(min==9999999) printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",min);\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else{\n if(((i + a > n && i - a <= 0) || (j + b > m && j - b <= 0)) && (i != 1 || j != 1) && (i != 1 || j != m) && (i != n || j != 1) && (i != n || j != m))\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n,m,i,j,a,b;\nint ab(int a)\n{\n\tif(a<0)\n\treturn -a;\n\treturn a;\n}\nint max(int a,int b)\n{\n\tif(a<b)\n\treturn b;\n\treturn a;\n}\nint min(int a,int b)\n{\n\tif(a>b)\n\treturn b;\n\treturn a;\n}\nint func(int u,int v)\n{\t\t\n\t\tif(i==u&&j==v)\n\t\treturn 0;\n\t\tif(i+a>n&&i-a<=0)\n\t\treturn -1;\n\t\tif(j+b>m&&j-b<=0)\n\t\treturn -1;\n\t\tint x=ab(u-i),y=ab(v-j);\n\t\tif(x%a!=0||y%b!=0)\n\t\treturn -1;\n\t\tx=x/a;y=y/b;\n\t\tif(x%2!=y%2)\n\t\treturn -1;\n\t\tint t=max(x,y);\n\t\treturn t;\n}\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&i,&j,&a,&b);\n\tint ans=100000000;\n\tint a=func(1,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(1,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\tif(ans<100000000)\n\tprintf(\"%d\",ans);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define INF 1000000009\nint max(int x,int y){\n if(x>y){\n return x;\n }\n return y;\n}\nint min(int x, int y){\n if(x>y){\n return y;\n }\n return x;\n}\nint main(){\n int n,m,i,j,a,b,cnt1=INF,cnt2=INF,cnt3=INF,cnt4=INF;\n int ans1=INF,ans2=INF,ans3=INF,ans4=INF,s,t,ret;\n int flg1=0,flg2=0,flg3=0,flg4=0;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n if((i-1)%a!=0){\n if((n-i)%a!=0){\n if((j-1)%b!=0){\n if((m-j)%b!=0){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n }\n }\n }\n if((i-1)%a==0){\n cnt1=(i-1)/a;\n }\n if((n-i)%a==0){\n cnt2=(n-i)/a;\n }\n if((j-1)%b==0){\n cnt3=(j-1)/b;\n }\n if((m-j)%b==0){\n cnt4=(m-j)/b;\n }\n if(i+a>n && cnt1==0){\n flg1++;\n }\n if(i-a<1 && cnt2==0){\n flg2++;\n }\n if(j+b>m && cnt3==0){\n flg3++;\n }\n if(j-b<1 && cnt4==0){\n flg4++;\n }\n if((cnt1-cnt3)%2==0 && cnt1!=INF && cnt3!=INF){\n if(cnt1>cnt3 && flg3==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt1<cnt3 && flg1==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n ans1=max(cnt1,cnt3);\n }\n if((cnt1-cnt4)%2==0 && cnt1!=INF && cnt4!=INF){\n if(cnt1>cnt4 && flg4==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt1<cnt4 && flg1==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n ans2=max(cnt1,cnt4);\n }\n if((cnt2-cnt3)%2==0 && cnt2!=INF && cnt3!=INF){\n if(cnt2>cnt3 && flg3==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt2<cnt3 && flg2==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n ans3=max(cnt2,cnt3);\n }\n if((cnt2-cnt4)%2==0 && cnt2!=INF && cnt4!=INF){\n if(cnt2>cnt4 && flg4==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n if(cnt2<cnt4 && flg2==1){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n ans4=max(cnt2,cnt4);\n }\n if(ans1==INF && ans2==INF && ans3==INF && ans4==INF){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n s=min(ans1,ans2);\n t=min(ans3,ans4);\n ret=min(s,t);\n printf(\"%d\\n\",ret);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint order[4];\nint main()\n{\n int n,m,i,j,a,b,k,l,d=0,p=0,q=0,r=0,s=0,rc=0,cc=0,count,z=0,t=0;\n\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n abc:\n \n if((i<=n/2 && (p==0 || r==0))||(s==1) && (q==1))\n {\n if(j<=m/2 && p==0 || r==1)\n {\n p=1;\n order[d]=0;\n }\n else if(r==0 || j>m/2)\n {\n r=1;\n order[d]=2;\n }\n \n }\n else\n {\n if(j<=m/2 && q==0 || s==1)\n {\n q=1;\n order[d]=1;\n }\n else if(s==0 || j>m/2)\n {\n s=1;\n order[d]=3;\n }\n \n \n }\n \n \n if(p==0 || q==0 || r==0 || s==0)\n {\n d++;\n goto abc;\n }\n \n /*\n for(d=0;d<4;d++)\n {\n printf(\"%d\",order[d]);\n }\n */\n //vertices\n \n int v[4][2];\n \n v[0][0]=1;\n v[0][1]=1;\n \n v[1][0]=n;\n v[1][1]=1;\n \n v[2][0]=1;\n v[2][1]=m;\n \n v[3][0]=n;\n v[3][1]=m; \n \n \n for(d=0;d<4;d++)\n {\n \n // printf(\"%d %d %d %d %d %d \\n\",abs(v[order[d]][0]-i)/a,v[order[d]][1]-j,i,j,a,b);\n \n if(abs(v[order[d]][0]-i)%a==0 && (abs(v[order[d]][1]-j)%b==0))\n {\n \n \n \n if((abs(v[order[d]][0]-i)/a)%2==0 && (abs(v[order[d]][1]-j)/b)%2==0)\n {\n \n rc=abs(v[order[d]][0]-i);\n cc=abs(v[order[d]][1]-j);\n z=1;\n break;\n }\n else if((abs(v[order[d]][0]-i)/a)%2==1 && (abs(v[order[d]][1]-j)/b)%2==1)\n {\n rc=abs(v[order[d]][0]-i);\n cc=abs(v[order[d]][1]-j);\n z=1;\n break;\n }\n }\n }\n \n if(rc/a>=cc/b)\n {\n count=rc/a;\n }\n else\n count=cc/b;\n \n //printf(\"%d %d\",rc,cc);\n \n if (((a<=n-i)||(a<=(i-1))) && ((b<=(m-j)|| b<=(j-1))))\n {\n t=1;\n }\n \n// printf(\"%d %d\\n\",i,n);\n \n if (((n-i)==0 || i==1) && ((m-j)==0 || j==1))\n printf(\"0\"); \n else if (z==1 && t==1)\n {\n printf(\"%d\",count);\n }\n else \n {\n printf(\"Poor Inna and pony!\");\n }\n \n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,m,i,j,a,b,p,q,r,s,k,z,c,d,l;\n long arr[4];\n arr[0]=1000001;\n arr[1]=1000001;\n arr[2]=1000001;\n arr[3]=1000001;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n \n \n p=(i-1);\n q=(j-1);\n r=abs(i-n);\n s=abs(j-m);\n \n if(((p%a)==0)&&((q%b)==0))\n {k=p/a;\n z=q/b;\n if(((abs(k-z))%2)==0)\n {\n if (k>z)\n arr[0]=k;\n else\n arr[0]=z;\n }\n }\n \n if(((p%a)==0)&&((s%b)==0))\n {k=p/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[1]=k;\n else\n arr[1]=z;\n }\n }\n \n if(((r%a)==0)&&((q%b)==0))\n {k=r/a;\n z=q/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[2]=k;\n else\n arr[2]=z;\n }\n }\n if(((r%a)==0)&&((s%b)==0))\n {k=r/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[3]=k;\n else\n arr[3]=z;\n }\n }\n for (c = 1 ; c <= 3; c++) {\n d = c;\n \n while ( d > 0 && arr[d] < arr[d-1]) {\n l = arr[d];\n arr[d] = arr[d-1];\n arr[d-1] = l;\n \n d--;\n }\n }\n \n \n if(n==i&&m==j||(i==1)&&(j==1)||(i==n)&&(j==1)||(i==1)&&(j==m))\n printf(\"0\");\n else if(a>(n-i)&&(n!=i))\n printf(\"Poor Inna and pony!\");\n else if(b>(m-j)&&(m!=j))\n printf(\"Poor Inna and pony!\");\n \n \n else if(n==1)\n printf(\"Poor Inna and pony!\");\n else if(n==i&&a>=n)\n printf(\"Poor Inna and pony!\");\n else if(m==j&&b>=m)\n printf(\"Poor Inna and pony!\");\n else if (arr[0]!=1000001)\n printf(\"%d\",arr[0]);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n \n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m,i,j,a,b,fa[2][2],fb[2][2],r,v=-1,s;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n s=n;\n r=(i-1)%(2*a);\n fa[0][1]=(i-1)/a;\n if(r==a)fa[0][0]=1;\n else if(r==0)fa[0][0]=2;\n else fa[0][0]=0;\n r=(n-i)%(2*a);\n fa[1][1]=(n-i)/a;\n if(r==a)fa[1][0]=1;\n else if(r==0)fa[1][0]=2;\n else fa[1][0]=0;\n r=(j-1)%(2*b);\n fb[0][1]=(j-1)/b;\n if(r==b)fb[0][0]=1;\n else if(r==0)fb[0][0]=2;\n else fb[0][0]=0;\n r=(m-j)%(2*b);\n fb[1][1]=(m-j)/b;\n if(r==b)fb[1][0]=1;\n else if(r==0)fb[1][0]=2;\n else fb[1][0]=0;\n r=-1;\n if(fa[0][0]==1)r=fa[0][1];\n if(fa[1][0]==1&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==1)n=fb[0][1];\n if(fb[1][0]==1&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))v=n>r?n:r;\n \n r=-1;\n if(fa[0][0]==2)r=fa[0][1];\n if(fa[1][0]==2&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==2)n=fb[0][1];\n if(fb[1][0]==2&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))if(!(v+1)||v>n&&v>r)v=n>r?n:r;\n \n \n \n \n if(!v||(v+1&&s>a&&m>b))printf(\"%d\",v);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\nint abs(int x)\n{\nif(x<0)\nreturn -x;\nelse\nreturn x;\n}\nint main()\n{\nint n,m,x,y,a,b,diff1,diff2,mov1,mov2,f=0,diff3,min=10000000,g;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b);\n//CORNER1\ndiff1=abs(x-1);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>=(a+1))\ng=1;\nelse if(mov2>mov1 && (m-b)>=1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2;\n} \n}\n//CORNER2\ndiff1=abs(x-n);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && (n-a)>=1)\ng=1;\nelse if(mov2>mov1 && m>=(1+b))\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER3\ndiff1=abs(x-n);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && (n-a)>=1)\ng=1;\nelse if(mov2>mov1 && (m-b)>=1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER4\ndiff1=abs(x-1);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>=(1+a))\ng=1;\nelse if(mov2>mov1 && m>=(1+b))\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\nif(f==1)\nprintf(\"%d\\n\",min);\nelse\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint max(int a,int b)\n{\n return a>b?a:b;\n}\nint min(int a,int b)\n{\n return a<b?a:b;\n}\nint main()\n{\n int n,m,i,j,a,b,ans=-1,x,y,an,flag=0;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n x=i-1;y=j-1;\n if(((i-1)>=a || (n-i)>=a) && ((j-1)>=b || (m-j)>=b))\n flag=1;\n\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=i-1;y=m-j;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=n-i;y=j-1;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=n-i;y=m-j;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n if(ans==-1 || (ans!=0 && flag==0)) printf(\"Poor Inna and pony!\");\n else printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, n, i, j, a, b, x, y;\n scanf(\"%d%d\", &m, &n);\n scanf(\"%d%d%d%d\", &i, &j, &a, &b);\n if((i==1&&j==1)||(i==1&&j==n)||(i==m&&j==1)||(i==m&&j==n))\n printf(\"0\\n\");\n else\n {\n if((a+i>m&&i-a<=0)||(b+j>n&&j-b<=0))\n puts(\"Poor Inna and pony!\");\n else\n {\n if((((i-1)%a!=0&&(m-i)%a!=0))||((j-1)%b!=0&&(n-j)%b!=0))\n printf(\"Poor Inna and pony!\\n\");\n else\n {\n y = 1000000;\n x = 1000000;\n if((i-1)%a==0&&(j-1)%b==0)\n {\n if((abs((i-1)/a-(j-1)/b))%2==0)\n {\n if((i-1)/a>(j-1)/b)\n x = (i-1)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((i-1)%a==0&&(n-j)%b==0)\n {\n if((abs((i-1)/a-(n-j)/b))%2==0)\n {\n if((i-1)/a>(n-j)/b)\n x = (i-1)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(j-1)%b==0)\n {\n if((abs((m-i)/a-(j-1)/b))%2==0)\n {\n if((m-i)/a>(j-1)/b)\n x = (m-i)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(n-j)%b==0)\n {\n if((abs((m-i)/a-(n-j)/b))%2==0)\n {\n if((m-i)/a>(n-j)/b)\n x = (m-i)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n if(y == 1000000)\n printf(\"Poor Inna and pony!\\n\");\n else\n printf(\"%d\\n\", y);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n printf(\"0\");\n return 0;\n }\n else if((i==n&&n==a)||(j==m&&m==b)||((i==1&&(n-i<a))||(j==1&&(m-j<b)))||(!(n>=i+a||i-a>0)||!(m>=j+b||j-b>0)))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n // printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nint min=1000000000;\nint n,m,i,j,a,b;\nint flag;\n\nvoid gao(int x,int y){\n if(flag && (x || y)) return ;\n if((x+y)%2) return ;\n if(x<y) x=y;\n if(min>x) min=x;\n}\n\nint main(void){\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n if((n-i<a && i-1<a) || (m-j<b && j-1<b)) flag=1;\n else flag=0;\n if((i-1)%a==0 && (j-1)%b==0) gao((i-1)/a,(j-1)/b);\n if((i-1)%a==0 && (m-j)%b==0) gao((i-1)/a,(m-j)/b);\n if((n-i)%a==0 && (j-1)%b==0) gao((n-i)/a,(j-1)/b);\n if((n-i)%a==0 && (m-j)%b==0) gao((n-i)/a,(m-j)/b);\n if(min<1000000000) printf(\"%d\",min);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=1000005,t=1000005,r=1000005,k=1000005;\n\t\tint c=0,d=0;\n\t\tif(x==1&&y==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse if(((x+a)>n&&(x-a)<=0)||((y+b)>m&&(y-b)<=0))\n\t\t{\n\n\t\t if(x==n&&y==m)\n\t\t {\n\t\t\t printf(\"%d\\n\",0);\n\t\t }\n\t\t else\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif((m-y)%b==0&&(x-1)%a==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(m-y)/b;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000005;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1000005;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=1000005;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\t//printf(\"%d %d\\n\",c,d);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=1000005;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=k<r?k:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t\t}\n\n\n\n\n\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint n = 1, m = 1, i = 1, j = 1, a = 1, b = 1, k = 1, min = 11111111;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tif((i == n && j == m)|| (i == 0 && j == m)|| (i == n && j == 0)|| (i == 1 && j == 1))\n {\n printf(\"0\");\n exit(0);\n }\n else if(a >= n || b >= m)\n {\n printf(\"Poor Inna and pony!\");\n exit(0);\n }\n\tif(abs(1-i)% a == 0 && abs(1-j)% b == 0 && (abs(1-i)/ a)%2 == (abs(1-j)/ b)%2)\n min = min < ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b));\n if(abs(n-i)% a == 0 && abs(m-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(m-j)/ b)%2)\n min = min < ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b));\n if(abs(1-i)% a == 0 && abs(m-j)% b == 0 && ((abs(1-i)/ a)%2 == (abs(m-j)/ b)%2))\n min = min < ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b));\n if(abs(n-i)% a == 0 && abs(1-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(1-j)/ b)%2)\n min = min < ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b));\n if(min == 11111111)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",min);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint n = 1, m = 1, i = 1, j = 1, a = 1, b = 1, k = 1, min = 11111111;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tif((i == n && j == m)|| (i == 0 && j == m)|| (i == n && j == 0)|| (i == 1 && j == 1))\n {\n printf(\"0\");\n exit(0);\n }\n else if(a >= n || b >= m)\n {\n printf(\"Poor Inna and pony!\");\n exit(0);\n }\n\tif(abs(1-i)% a == 0 && abs(1-j)% b == 0 && (abs(1-i)/ a)%2 == (abs(1-j)/ b)%2)\n {\n min = min < ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b));\n }\n if(abs(n-i)% a == 0 && abs(m-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(m-j)/ b)%2)\n {\n min = min < ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b));\n }\n if(abs(1-i)% a == 0 && abs(m-j)% b == 0 && ((abs(1-i)/ a)%2 == (abs(m-j)/ b)%2))\n {\n min = min < ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b));\n }if(abs(n-i)% a == 0 && abs(1-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(1-j)/ b)%2)\n {\n min = min < ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b));\n }if(min == 11111111)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",min);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn a<b?a:b;\n}\nint ch(int a,int b){\n\tif(a==-1)return 0;\n\tif(b==-1)return 0;\n\tint c=a-b;\n\tif(c<0)c*=-1;\n\treturn ((c%2)==0);\n}\t\nint mx(int a,int b){\n\treturn a>b?a:b;\n}\nint main(){\n\tint n,m,i,j,a,b,p1,q1,p2,q2;\n\tint w,x,y,z;\n\tscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\tif((i==1||i==n)&&(j==1||j==m)){\n\t\tprintf(\"0\");return 0;\n\t}\n\tif((i+a>n)&&(i-a<1)||(j+b>m)&&(j-b<1)){\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tp1=q1=-1;\n\tif((n-i)%a==0)p1=(n-i)/a;\n\tif((i-1)%a==0)q1=(i-1)/a;\n\tp2=q2=-1;\n\tif((m-j)%b==0)p2=(m-j)/b;\n\tif((j-1)%b==0)q2=(j-1)/b;\n\tw=x=y=z=-1;\n\tif(ch(p1,p2))w=mx(p1,p2);\n\tif(ch(p1,q2))x=mx(p1,q2);\n\tif(ch(q1,p2))y=mx(q1,p2);\n\tif(ch(q1,q2))z=mx(q1,q2);\n\tn=mn(mn(w,x),mn(y,z));\n\tif(n==-1)\n\t\tprintf(\"Poor Inna and pony!\");\n\telse\n\t\tprintf(\"%d\",n);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int min=-1;\n int checka,checkb;\n checka= abs(n-i);\n checkb = abs(m-j);\n\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(m-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(n-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n\n if (min == -1) {\n printf(\"Poor Inna and pony!\");\n } else if (min == 0) {\n printf(\"0\");\n } else if ((abs(n-i) >=a || i-1 >= a ) && (abs(m-j) >=b || j-1 >=b)) {\n printf(\"%d\",min);\n } else {\n printf(\"Poor Inna and pony!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//Written By GHATAK...\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\tint top,bottom,left,right,mintop,minbottom,minright,minleft;\n\ttop=i-1;\n\tbottom=n-i;\n\tleft=j-1;\n\tright=m-j;\n\tminright=right/b;\n\tminleft=left/b;\n\tmintop=top/a;\n\tminbottom=bottom/a;\n\tint t=0,min;\n\tif(i==1)\n {\n if(j==1)\n {\n printf(\"0\");\n return 0;\n }\n if(j==m)\n {\n printf(\"0\");\n return 0;\n }\n }\n if(i==n)\n {\n if(j==1)\n {\n printf(\"0\");\n return 0;\n }\n if(j==m)\n {\n printf(\"0\");\n return 0;\n }\n }\n if(((n==1)&&(a!=0))||((m==1)&&(b!=0)))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n\tif(b!=0)\n\t{\n\t\tif(a!=0)\n\t\t{\n\t\t\tif(((left%b==0)&&(left>=b))||((right%b==0)&&(right>=b)))\n\t\t\t{\n\t\t\t\tif(((top%a==0)&&(top>=a))||((bottom%a==0)&&(bottom>=a)))\n\t\t\t\t{\n\t\t\t\t\tif(right%b==0)\n\t\t\t\t\t{\n\t\t\t\t\t\t//bottom\n\t\t\t\t\t\tif(bottom%a==0)\n\t\t\t\t\t\t{\n\n\n\t\t\t\t\t\tif(minbottom==minright)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(min>minbottom)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmin=minbottom;\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\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint k;\n\t\t\t\t\t\t\tk=abs(minbottom-minright);\n\t\t\t\t\t\t\tif(k%2==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(minbottom>minright)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(minbottom>minright)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minbottom)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minright)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\t\t\t\t\t}\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\t}\n\t\t\t\t\t\t//top\n\t\t\t\t\t\tif(top%a==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mintop==minright)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(min>mintop)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmin=mintop;\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\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint k;\n\t\t\t\t\t\t\tk=abs(mintop-minright);\n\t\t\t\t\t\t\tif(k%2==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(mintop>minright)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(mintop>minright)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>mintop)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minright)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\t\t\t\t\t}\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\n\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\t\t\t\t\tif(left%b==0)\n\t\t\t\t\t{\n\t\t\t\t\t\t//bottom\n\t\t\t\t\t\tif(bottom%a==0)\n\t\t\t\t\t\t{\n\n\n\t\t\t\t\t\tif(minbottom==minleft)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(min>minbottom)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmin=minbottom;\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\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint k;\n\t\t\t\t\t\t\tk=abs(minbottom-minleft);\n\t\t\t\t\t\t\tif(k%2==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(minbottom>minleft)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minleft;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(minbottom>minleft)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minbottom)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minleft)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minleft;\n\t\t\t\t\t\t\t\t\t\t}\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\t}\n\t\t\t\t\t\t//top\n\t\t\t\t\t\tif(top%a==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(mintop==minleft)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(min>mintop)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tmin=mintop;\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\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tint k;\n\t\t\t\t\t\t\tk=abs(mintop-minleft);\n\t\t\t\t\t\t\tif(k%2==0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(t==0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(mintop>minleft)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tmin=minleft;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tt++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tif(mintop>minleft)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>mintop)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tif(min>minleft)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tmin=minleft;\n\t\t\t\t\t\t\t\t\t\t}\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\n\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\n\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\n\t\telse\n\t\t{\n\t\t\tif((i==1)||(i==n))\n\t\t\t{\n\t\t\t\tif((left%b==0)&&(left>=b))\n\t\t\t\t{\n\t\t\t\t\tif(t==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin=minleft;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((right%b==0)&&(right>=b))\n\t\t\t\t{\n\t\t\t\t\tif(t==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min>minright)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=minright;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\telse\n\t{\n\t\tif(a!=0)\n\t\t{\n\t\t\tif((j==1)||(j==m))\n\t\t\t{\n\t\t\t\tif((top%a==0)&&(top>=a))\n\t\t\t\t{\n\t\t\t\t\tif(t==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin=mintop;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif((bottom%a==0)&&(bottom>=a))\n\t\t\t\t{\n\t\t\t\t\tif(t==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\tt++;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(min>minbottom)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmin=minbottom;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(((i==1)||(i==n))&&((j==1)||(j==m)))\n\t\t\t{\n\t\t\t\tmin=0;\n\t\t\t\tt++;\n\t\t\t}\n\t\t}\n\t}\n\tif(t==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",min);\n\t}\n\treturn 0;\n\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else{\n if((n == 1 || m == 1) && (i != 1 || j != 1) && (i != 1 || j != m) && (i != n || j != 1) && (i != n || j != m))\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (n!=a && m!=b){\n\t\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n}\n \n else{\n \t\n \tif ( (i==n && j==m) || (i==1 && j==1) || (i==n && j==1) || (j==m && i==1) ) {\n \t\nans1=0; \t\n }\n \t\n }\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n \n if (a > (n-i) || a > (i-1) || b > (m-j) || b > (j-1))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = -1;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\ta=a*2;\n\tb=b*2;\n\tint sum=0;\n\tif((n-i)%a==0&&(m-j)%b==0)\n\t\tsum++;\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t\tsum++;\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t\tsum++;\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t\tsum++;\n\tif(sum==0) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m; \n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n for ( k = 0; k < 4; k++ )\n if ( cj[ k ] % b == 0 && ci[ k ] % a == 0 )\n if ( cj[ k ] / b % 2 == 0 && ci[ k ] / a % 2 == 0 || cj[ k ] / b % 2 && ci[ k ] / a % 2 )\n if ( ci[ k ] / a % 2 == 0 ) {\n int tmp = cj[ k ] / b > ci[ k ] / a ? cj[ k ] / b : ci[ k ] / a;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\treturn a>b?b:a;\n}\nint n,m,i,j,a,b;\nint main()\n{\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint ans1,ans2,ans3,ans4;\n\tans1=ans2=ans3=ans4=0;\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j+b;\n\t\tans1++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j+b;\n\t\tans2++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tint ans=min(ans1,ans2);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j-b;\n\t\tans3++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans3);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j-b;\n\t\tans4++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans4);\n\tif(ans>=500000)\n\tprintf(\"Poor Inna and pony!\\n\");\n\telse\n\tprintf(\"%d\\n\",ans);\n\t\n}"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint min (int a, int b)\n{\n if (a>b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n\n if ((i == 1 || i == n) && (j == 1 || j == m))\n {\n printf(\"0\\n\");\n return 0;\n }\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = INF;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((n-i)/a - (m-j)/b) % 2 == 0) && (a > (n-i) || b > (m-j)))\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((i-1)/a - (m-j)/b) % 2 == 0) && (a > (i-1) || b > (m-j)))\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((n-i)/a - (j-1)/b) % 2 == 0) && (a > (n-i) || b > (j-1)))\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((i-1)/a - (j-1)/b) % 2 == 0) && (a > (i-1) || b > (j-1)))\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=0,t=0,r=0,k=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0&&(x-1)%a==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1000000;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=1000000;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=t<r?t:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,m;\nin_bounce(int x,int y)\n{\n if(x<=n&&x>=1&&y<=m&&y>=1) return 1;\n return 0;\n}\nmain()\n{\n int i,j,a,b,k,dir[4][2],nowdx,nowdy,min;\n while(~scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b)) \n {\n\t min=9999999;\n dir[0][0]=1;dir[0][1]=1;\n\t dir[1][0]=1;dir[1][1]=m;\n\t dir[2][0]=n;dir[2][1]=m;\n\t dir[3][0]=n;dir[3][1]=1;\n\t for(k=0;k<4;k++)\n\t {\n\t nowdx=abs(i-dir[k][0]);\n\t\t nowdy=abs(j-dir[k][1]);\n\t\t if(nowdx%a!=0||nowdy%b!=0) continue;\n\t\t else \n\t\t if(nowdx/a==nowdy/b&&min>nowdx/a) min=nowdx/a;\n\t\t else if(nowdx/a>nowdy/b) \n\t\t {if((nowdx/a-nowdy/b)%(2*a)==0&&(min>nowdy/b+(nowdx/a-nowdy/b)%a)&&(in_bounce(i-2*a,j)||in_bounce(i+2*a,j))) min=nowdy/b+(nowdx/a-nowdy/b)%a;}\n\t\t else if((nowdx/b-nowdy/a)%(2*b)==0&&(min>nowdx/a+(nowdx/b-nowdy/a)%b)&&(in_bounce(i,j-b*2)||in_bounce(i,j+b*2))) min=nowdx/a+(nowdx/b-nowdy/a)%b;\t\n\t }\n\t if(min==9999999) printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",min);\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int min=-1;\n int checka,checkb;\n checka= abs(n-i);\n checkb = abs(m-j);\n if ((checka >=a && checkb >=b) || (i-1 >= a && j-1 >=b)) {\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(m-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(n-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n}\n if (min == -1) {\n printf(\"Poor Inna and pony!\");\n } else {\n printf(\"%d\",min);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tprintf(\"p=%ld\\n\",p);\n\tprintf(\"q=%ld\\n\",q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\treturn 0;\n\t\t}\n\t\telse {\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\nelse if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\nelse if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\t\nelse if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\telse \n\t{\t\n\tprintf(\"Poor Inna and pony!\\n\");\t\n\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m;\n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n if ( n == 1 || m == 1 ) {\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] == 0 && cj[ k ] == 0 )\n min = 0;\n } else\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp;\n\n ci[ k ] = ci[ k ] < 0 ? -ci[ k ] : ci[ k ];\n cj[ k ] = cj[ k ] < 0 ? -cj[ k ] : cj[ k ];\n tmp = ci[ k ] / a > cj[ k ] / b ? ci[ k ] / a : cj[ k ] / b;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m,i,j,a,b,fa[2][2],fb[2][2],r,v=-1,s;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n s=n;\n r=(i-1)%(2*a);\n fa[0][1]=(i-1)/a;\n if(r==a)fa[0][0]=1;\n else if(r==0)fa[0][0]=2;\n else fa[0][0]=0;\n r=(n-i)%(2*a);\n fa[1][1]=(n-i)/a;\n if(r==a)fa[1][0]=1;\n else if(r==0)fa[1][0]=2;\n else fa[1][0]=0;\n r=(j-1)%(2*b);\n fb[0][1]=(j-1)/b;\n if(r==b)fb[0][0]=1;\n else if(r==0)fb[0][0]=2;\n else fb[0][0]=0;\n r=(m-j)%(2*b);\n fb[1][1]=(m-j)/b;\n if(r==b)fb[1][0]=1;\n else if(r==0)fb[1][0]=2;\n else fb[1][0]=0;\n r=-1;\n if(fa[0][0]==1)r=fa[0][1];\n if(fa[1][0]==1&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==1)n=fb[0][1];\n if(fb[1][0]==1&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))v=n>r?n:r;\n \n r=-1;\n if(fa[0][0]==2)r=fa[0][1];\n if(fa[1][0]==2&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==2)n=fb[0][1];\n if(fb[1][0]==2&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))if(!(v+1)||v>n&&v>r)v=n>r?n:r;\n \n \n \n \n if(!v||(v+1&&s>1&&m>1))printf(\"%d\",v);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nlong max(long x , long y){ return x>y?x:y; }\nint main()\n{\n long i,j,n,m,a,b,ans[4],min,f=0;\n long cint,dint;\n float c,d;\n scanf(\"%ld%ld%ld%ld%ld%ld\",&n,&m,&i,&j,&a,&b);\n if(a>=n || b>=m)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n c=(i-1)*1.0/a;\n d=(j-1)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(j-1)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if((abs(cint-dint))%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(i-1)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n if(f==0)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n min=1000000;\n for(i=0;i<f;i++)\n if(min>ans[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=0,t=0,r=0,k=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=100000000;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=100000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=100000000;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=t<r?t:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,m;\nin_bounce(int x,int y)\n{\n if(x<=n&&x>=1&&y<=m&&y>=1) return 1;\n return 0;\n}\nmain()\n{\n int i,j,a,b,k,dir[4][2],nowdx,nowdy,min;\n while(~scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b)) \n {\n\t min=9999999;\n dir[0][0]=1;dir[0][1]=1;\n\t dir[1][0]=1;dir[1][1]=m;\n\t dir[2][0]=n;dir[2][1]=m;\n\t dir[3][0]=n;dir[3][1]=1;\n\t for(k=0;k<4;k++)\n\t {\n\t nowdx=abs(i-dir[k][0]);\n\t\t nowdy=abs(j-dir[k][1]);\n\t\t if(nowdx%a!=0||nowdy%b!=0) continue;\n\t\t else \n\t\t if(nowdx/a==nowdy/b&&min>nowdx/a) min=nowdx/a;\n\t\t else if(nowdx/a>nowdy/b) \n\t\t {if((nowdx/a-nowdy/b)%(2*a)==0&&(min>nowdy/b+(nowdx/a-nowdy/b)%a)&&(in_bounce(i-2*a,j)||in_bounce(i+2*a,j))) min=nowdy/b+(nowdx/a-nowdy/b)%a;}\n\t\t else if((nowdx/b-nowdy/a)%(2*b)==0&&(min>nowdx/a+(nowdx/b-nowdy/a)%b)&&(in_bounce(i,j-b*2)||in_bounce(i,j+b*2))) min=nowdx/a+(nowdx/b-nowdy/a)%b;\t\n\t }\n\t if(min==9999999) printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",min);\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m; \n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n for ( k = 0; k < 4; k++ )\n if ( cj[ k ] % b == 0 && ci[ k ] % a == 0 )\n if ( cj[ k ] / b % 2 == 0 && ci[ k ] / a % 2 == 0 || cj[ k ] / b % 2 && ci[ k ] / a % 2 )\n if ( ci[ k ] / a % 2 == 0 ) {\n int tmp = cj[ k ] / b > ci[ k ] / a ? cj[ k ] / b : ci[ k ] / a;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif((n==i&&a>0)||(m==j&&b>0))\n\t{\n\t\t\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t}\n\tk=i-1;l=j-1;\n\tk1=n-i;k2=j-1;\n\tk3=i-1;k4=m-j;\n\tn-=i;m-=j;\n//\tprintf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n\t\n\tif(n%a==0&&m%b==0&&n/a%2==m/b%2)\n\t{\n\t\tif(n/a<m/b)\n\t\tp=m/b;\n\t\telse\n\t\tp=n/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k%a==0&&l%b==0&&k/a%2==l/b%2)\n\t{\n\t\tif(k/a<l/b)\n\t\tp=l/b;\n\t\telse\n\t\tp=k/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n\t{\n\t\tif(k1/a<k2/b)\n\t\tp=k2/b;\n\t\telse\n\t\tp=k1/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n\t{\n\t\tif(k3/a<k4/b)\n\t\tp=k4/b;\n\t\telse\n\t\tp=k3/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(q!=1000009)\n\tprintf(\"%ld\",q);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n k=1-i;l=1-j;\n k1=n-i;k2=1-j;\n k3=1-i;k4=m-j;\n n-=i;m-=j;\n \n if(n%a==0&&m%b==0&&n/a==m/b)\n {\n if(n/a<0)\n printf(\"%ld\",-n/a);\n else\n printf(\"%ld\",n/a);\n }\n else if(k%a==0&&l%b==0&&k/a==l/b)\n {\n if(k/a<0)\n printf(\"%ld\",-k/a);\n else\n printf(\"%ld\",k/a);\n }\n else if(k1%a==0&&k2%b==0&&k1/a==k2/b)\n {\n if(k1/a<0)\n printf(\"%ld\",-k1/a);\n else\n printf(\"%ld\",k1/a);\n }\n else if(k3%a==0&&k4%b==0&&k3/a==k4/b)\n {\n if(k3/a<0)\n printf(\"%ld\",-k3/a);\n else\n printf(\"%ld\",k3/a);\n }\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n k=i-1;l=j-1;\n n-=i;m-=j;\n if(n%a==0&&m%b==0&&n/a==m/b)\n {\n printf(\"%ld\",n/a);\n }\n else if(k%a==0&&l%b==0&&k/a==l/b)\n {\n printf(\"%ld\",k/a);\n }\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint min (int a, int b)\n{\n if (a>b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n\n if ((i == 1 || i == n) && (j == 1 || j == m))\n {\n printf(\"0\\n\");\n return 0;\n }\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = INF;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((n-i)/a - (m-j)/b) % 2 == 0) && (a > (n-i) || b > (m-j)))\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((i-1)/a - (m-j)/b) % 2 == 0) && (a > (i-1) || b > (m-j)))\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = min(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((n-i)/a - (j-1)/b) % 2 == 0) && (a > (n-i) || b > (j-1)))\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((i-1)/a - (j-1)/b) % 2 == 0) && (a > (i-1) || b > (j-1)))\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = min(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif(i==1&&j==1) sum=0;\n\tif(i==n&&j==1) sum=0;\n\tif(i==n&&j==n) sum=0;\n\tif(i==1&&j==n) sum=0;\n if((i-a<1&&i+a>n)||(j+b>m)&&j-a<1) {if(sum==100000000) printf(\"Poor Inna and pony!\\n\");else printf(\"%d\\n\",sum);}\n\n else\n {\n\t\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t sum=y;\n\t\t\t}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t\tsum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{ if(x<sum)\n\t\t\t sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n// printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,m,i,j,a,b,p,q,r,s,k,z,c,d,l;\n long arr[4];\n arr[0]=1000001;\n arr[1]=1000001;\n arr[2]=1000001;\n arr[3]=1000001;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n \n \n p=(i-1);\n q=(j-1);\n r=abs(i-n);\n s=abs(j-m);\n \n if(((p%a)==0)&&((q%b)==0))\n {k=p/a;\n z=q/b;\n if(((abs(k-z))%2)==0)\n {\n if (k>z)\n arr[0]=k;\n else\n arr[0]=z;\n }\n }\n \n if(((p%a)==0)&&((s%b)==0))\n {k=p/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[1]=k;\n else\n arr[1]=z;\n }\n }\n \n if(((r%a)==0)&&((q%b)==0))\n {k=r/a;\n z=q/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[2]=k;\n else\n arr[2]=z;\n }\n }\n if(((r%a)==0)&&((s%b)==0))\n {k=r/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[3]=k;\n else\n arr[3]=z;\n }\n }\n for (c = 1 ; c <= 3; c++) {\n d = c;\n \n while ( d > 0 && arr[d] < arr[d-1]) {\n l = arr[d];\n arr[d] = arr[d-1];\n arr[d-1] = l;\n \n d--;\n }\n }\n if (arr[0]!=1000001&&(n!=i)&&(m!=j))\n printf(\"%d\",arr[0]);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n \n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\treturn a>b?b:a;\n}\nint n,m,i,j,a,b;\nint main()\n{\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint ans1,ans2,ans3,ans4;\n\tans1=ans2=ans3=ans4=0;\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j+b;\n\t\tans1++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j+b;\n\t\tans2++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tint ans=min(ans1,ans2);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j-b;\n\t\tans3++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans3);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j-b;\n\t\tans4++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans4);\n\tif(ans>=500000)\n\tprintf(\"Poor Inna and pony!\\n\");\n\telse\n\tprintf(\"%d\\n\",ans);\n\t\n}"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n\t\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int min=-1;\n int checka,checkb;\n checka= abs(n-i);\n checkb = abs(m-j);\n\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(m-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(n-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n\n if (min == -1) {\n printf(\"Poor Inna and pony!\");\n } else if (min == 0) {\n printf(\"0\");\n } else if ((abs(n-i) >=a && abs(m-j) >=b) || (i-1 >= a && j-1 >=b)) {\n printf(\"%d\",min);\n } else {\n printf(\"Poor Inna and pony!\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = -1;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n\t\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=0,t=0,r=0,k=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0&&(x-1)%a==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1000000;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=1000000;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=t<r?t:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,i,j,a,b;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\nint x,y,h;\nint ma[4];\nfor(h=0;h<4;h++)\n{ma[h]=99999;\n}\nif((((i-1)%a)==0)&&(((j-1)%b)==0))\n{\n if(((i-1)/a+(j-1)/b)%2==0)\nma[0]=((i-1)/(a)>(j-1)/(b)?(i-1)/(a):(j-1)/(b));\n //printf(\"here %d\\n\",ma[0]);\n\n}\nif((((i-1)%a)==0)&&(((m-j)%b)==0))\n{\n if(((i-1)/a+(m-j)/b)%2==0)\nma[1]=((i-1)/(a)>(m-j)/(b)?(i-1)/(a):(m-j)/(b));\n //printf(\"hrtyr %d\\n\",ma[1]);\n}\nif((((n-i)%a)==0)&&(((j-1)%b)==0))\n{\n if(((n-i)/a+(j-1)/b)%2==0)\nma[2]=((n-i)/(a)>(j-1)/(b)?(n-i)/(a):(j-1)/(b));\n\n //printf(\"hrtyr3 %d\\n\",ma[2]);\n}\nif((((n-i)%a)==0)&&(((m-j)%b)==0))\n{\n if(((n-i)/a+(m-j)/b)%2==0)\nma[3]=((n-i)/(a)>(m-j)/(b)?(n-i)/(a):(m-j)/(b));\n\n\n // printf(\"hrtyr4 %d\\n\",ma[3]);\n}\n\n\n/*if(((n-i)%(2*a)==0)&&((m-j)==0))\n{ma[4]=(n-i)/a;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n}\nelse if(((m-j)%(2*b)==0)&&((n-i)==0))\n{\nma[4]=(m-j)/b;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n\n}\nif(((i-1)%(2*a)==0)&&(j-1==0))\n{\nma[5]=(i-1)/a;\n // printf(\"here %d\\n\",ma[0]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-1==0))\n{\nma[5]=(j-1)/b;\n //printf(\"here %d\\n\",ma[0]);\n\n}\n\n\n\nif(((i-1)%(2*a)==0)&&(j-m==0))\n{\nma[6]=(i-1)/a;\n //printf(\"here %d\\n\",ma[6]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-n==0))\n{\n ma[6]=(j-1)/b;\n //printf(\"here %d\\n\",ma[6]);\n\n}\n\n\nif(((n-i)%(2*a)==0)&&(j-1==0))\n{\nma[7]=(n-i)/a;\n //printf(\"here %d\\n\",ma[7]);\n\n}\nelse if(((m-j)%(2*b)==0)&&(i-1==0))\n{\n ma[7]=(m-j)/b;\n //printf(\"here %d\\n\",ma[7]);\n\n}\n\n\n\n\n*/\n\n\n\nint temp=ma[0];\nfor(h=0;h<4;h++)\n{\n if(temp>ma[h])\n temp=ma[h];\n}\nif(temp==99999)\nprintf(\"Poor Inna and pony!\\n\");\nelse\nprintf(\"%d\\n\",temp);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n k=i-1;l=j-1;\n n-=i;m-=j;\n if(n%a==0&&m%b==0&&n/a==m/b)\n {\n if(n/a<0)\n printf(\"%ld\",-n/a);\n else\n printf(\"%ld\",n/a);\n }\n else if(k%a==0&&l%b==0&&k/a==l/b)\n {\n if(k/a<0)\n printf(\"%ld\",-k/a);\n else\n printf(\"%ld\",k/a);\n }\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif((n==i&&a>0)||(m==j&&b>0))\n\t{\n\t\t\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t}\n\tk=i-1;l=j-1;\n\tk1=n-i;k2=j-1;\n\tk3=i-1;k4=m-j;\n\tn-=i;m-=j;\n//\tprintf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n\t\n\tif(n%a==0&&m%b==0&&n/a%2==m/b%2)\n\t{\n\t\tif(n/a<m/b)\n\t\tp=m/b;\n\t\telse\n\t\tp=n/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k%a==0&&l%b==0&&k/a%2==l/b%2)\n\t{\n\t\tif(k/a<l/b)\n\t\tp=l/b;\n\t\telse\n\t\tp=k/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n\t{\n\t\tif(k1/a<k2/b)\n\t\tp=k2/b;\n\t\telse\n\t\tp=k1/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n\t{\n\t\tif(k3/a<k4/b)\n\t\tp=k4/b;\n\t\telse\n\t\tp=k3/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(q!=1000009)\n\tprintf(\"%ld\",q);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nlong long int n,m,i,j,a,b;\nint ab(int a)\n{\n\tif(a<0)\n\treturn -a;\n\treturn a;\n}\nint max(int a,int b)\n{\n\tif(a<b)\n\treturn b;\n\treturn a;\n}\nint min(int a,int b)\n{\n\tif(a>b)\n\treturn b;\n\treturn a;\n}\nint func(int u,int v)\n{\t\t\n\t\tif(i==u&&j==v)\n\t\treturn 0;\n\t\tif(i+a>n&&i-a<=0)\n\t\treturn -1;\n\t\tif(i+b>m&&i-b<=0)\n\t\treturn -1;\n\t\tint x=ab(u-i),y=ab(v-j);\n\t\tif(x%a!=0||y%b!=0)\n\t\treturn -1;\n\t\tx=x/a;y=y/b;\n\t\tif(x%2!=y%2)\n\t\treturn -1;\n\t\tint t=max(x,y);\n\t\treturn t;\n}\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&i,&j,&a,&b);\n\tint ans=100000000;\n\tint a=func(1,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(1,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\tif(ans<100000000)\n\tprintf(\"%d\",ans);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint abs(int x)\n{\nif(x<0)\nreturn -x;\nelse\nreturn x;\n}\nint main()\n{\nint n,m,x,y,a,b,diff1,diff2,mov1,mov2,f=0,diff3,min=10000000;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b);\n//CORNER1\ndiff1=abs(x-1);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3%2==0)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2;\n} \n}\n//CORNER2\ndiff1=abs(x-n);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3%2==0)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER3\ndiff1=abs(x-n);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3%2==0)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER4\ndiff1=abs(x-1);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3%2==0)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\nif(f==1)\nprintf(\"%d\\n\",min);\nelse\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint calc_moves(int, int, int, int, int, int);\nint min(int, int);\n\nint main(){\n \n int i, j, x, y, n, m, a, b;\n scanf(\"%d %d %d %d %d %d\", &n, &m, &x, &y, &a, &b);\n\n int sol1 = calc_moves(x, y, 1, 1, a, b);\n int sol2 = calc_moves(x, y, 1, m, a, b);\n int sol3 = calc_moves(x, y, n, 1, a, b);\n int sol4 = calc_moves(x, y, n, m, a, b);\n\n printf(\"%d %d %d %d\\n\", sol1, sol2, sol3, sol4);\n\n if (sol1 == -1 && sol2 == -1 && sol3 == -1 && sol4 == -1) {\n printf(\"Poor Inna and pony!\\n\");\n }\n else {\n printf(\"%d\\n\", min(sol1, min(sol2, min(sol3, sol4))));\n }\n\n#ifdef _AT_HOME_\n system(\"pause\");\n#endif\n\n return 0;\n}\n\nint calc_moves(int start_x, int start_y, int finish_x, int finish_y, int step_x, int step_y) {\n\n int dx = abs(start_x - finish_x);\n int dy = abs(start_y - finish_y);\n\n if (dx % step_x != 0 || dy % step_y != 0) {\n return -1;\n }\n\n int sx = dx / step_x;\n int sy = dy / step_y;\n\n if (abs(sx - sy) & 1) {\n return -1;\n }\n else {\n return (sx > sy)?sx:sy;\n }\n\n}\n\nint min(int a, int b) {\n return (a > b || a == -1)?b:a;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,x,y,a,b;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&x,&y,&a,&b);\n if(n==1)\n {\n if((x==1&&y==m)||(x==1&&y==1))\n printf(\"0\");\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n if(m==1)\n {\n if((x==1&&y==1)||(x==n&&y==1))\n printf(\"0\");\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n int min=10000000,no1,no2;\n if((x-1)%a==0&&(y-1)%b==0)\n {\n no1=(x-1)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\nif((x-1)%a==0&&(m-y)%b==0)\n {\n no1=(x-1)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(m-y)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(y-1)%b==0)\n {\n no1=(n-x)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if(min<10000000)\n printf(\"%d\",min);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = -1;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n = 1, m = 1, i = 1, j = 1, a = 1, b = 1, k = 1, min = 11111111;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tif(abs(1-i)% a == 0 && abs(1-j)% b == 0 && (abs(1-i)/ a)%2 == (abs(1-j)/ b)%2)\n {\n min = min < ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(1-j)/ b)? (abs(1-i)/ a): (abs(1-j)/ b));\n }\n else if(abs(n-i)% a == 0 && abs(m-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(m-j)/ b)%2)\n {\n min = min < ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(m-j)/ b)?(abs(n-i)/ a): (abs(m-j)/ b));\n }\n else if(abs(1-i)% a == 0 && abs(m-j)% b == 0 && ((abs(1-i)/ a)%2 == (abs(m-j)/ b)%2))\n {\n min = min < ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b))?\n min: ((abs(1-i)/ a)>(abs(m-j)/ b)?(abs(1-i)/ a): (abs(m-j)/ b));\n }else if(abs(n-i)% a == 0 && abs(1-j)% b == 0 && (abs(n-i)/ a)%2 == (abs(1-j)/ b)%2)\n {\n min = min < ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b))?\n min: ((abs(n-i)/ a)>(abs(1-j)/ b)?(abs(n-i)/ a): (abs(1-j)/ b));\n }if(min == 11111111)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",min);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,x,y,a,b;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&x,&y,&a,&b);\n int min=10000000,no1,no2;\n if((x-1)%a==0&&(y-1)%b==0)\n {\n no1=(x-1)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\nif((x-1)%a==0&&(m-y)%b==0)\n {\n no1=(x-1)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(m-y)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(y-1)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if(min<10000000)\n printf(\"%d\",min);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif(i==1&&j==1) sum=0;\n\tif(i==n&&j==1) sum=0;\n\tif(i==n&&j==n) sum=0;\n\tif(i==1&&j==n) sum=0;\n if((i-a<1&&i+a>n)||(j+b>m&&j-b<1))\n\t{ if(sum==100000000)\n\t printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",sum);\n\t // printf(\"*******\");\n\t}\n\n else\n {\n\t\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t sum=y;\n\t\t\t}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t\tsum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{ if(x<sum)\n\t\t\t sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nmax (long int *pp,long int *pb){\n\tlong int t;\n\tif ((*pp)<(*pb)){\n\t\tt=*pp;\n\t\t*pp=*pb;\n\t\t*pb=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&b);\n\t\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t}\n\t\telse {\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\nelse if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\nelse if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\t\nelse if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\telse \n\t{\t\n\tprintf(\"Poor Inna and pony!\\n\");\t\n\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif((n==i&&a>0)&&(m==j&&b>0))\n\t{\n\t\t\n\t}\n\telse if((n==i&&a>0)||(m==j&&b>0))\n\t{\n\t\t\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t}\n\tk=i-1;l=j-1;\n\tk1=n-i;k2=j-1;\n\tk3=i-1;k4=m-j;\n\tn-=i;m-=j;\n//\tprintf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n\t\n\tif(n%a==0&&m%b==0&&n/a%2==m/b%2)\n\t{\n\t\tif(n/a<m/b)\n\t\tp=m/b;\n\t\telse\n\t\tp=n/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k%a==0&&l%b==0&&k/a%2==l/b%2)\n\t{\n\t\tif(k/a<l/b)\n\t\tp=l/b;\n\t\telse\n\t\tp=k/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n\t{\n\t\tif(k1/a<k2/b)\n\t\tp=k2/b;\n\t\telse\n\t\tp=k1/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n\t{\n\t\tif(k3/a<k4/b)\n\t\tp=k4/b;\n\t\telse\n\t\tp=k3/a;\n\t\tif(q>p)\n\t\tq=p;\n\t}\n\tif(q!=1000009)\n\tprintf(\"%ld\",q);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n// printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint check1(int x, int y,int i, int j,int a,int b)\n{\n\tif((abs(x-i)%a)==0 && (abs(y-j)%b)==0)\n\treturn 1;\n\treturn 0;\n}\nint check2(int x, int y, int i, int j,int a, int b)\n{\n\tif((abs(x-i)/a)%2==0 && (abs(y-j)/b)%2==0)\n\treturn 1;\n\tif((abs(x-i)/a)%2==1 && (abs(y-j)/b)%2==1)\n\treturn 1;\n\treturn 0;\n}\nint dist(int x,int y,int i, int j,int a, int b)\n{\n\treturn (max(abs(x-i)/a, abs(y-j)/b));\n}\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint A[4]={0};\n\tif(check1(1,1,i,j,a,b)==0 && (check1(1,m,i,j,a,b)==0) && check1(n,1,i,j,a,b)==0 && check1(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tif(check2(1,1,i,j,a,b)==0 && (check2(1,m,i,j,a,b)==0) && check2(n,1,i,j,a,b)==0 && check2(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tA[0]=dist(1,1,i,j,a,b);\n\tA[1]=dist(1,m,i,j,a,b);\n\tA[2]=dist(n,1,i,j,a,b);\n\tA[3]=dist(n,m,i,j,a,b);\n\tint min=A[0];\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tif(A[i]<min)\n\t\tmin=A[i];\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n printf(\"0\");\n return 0;\n }\n else if((n==i&&i==1&&a>0)||(m==j&&j==1&&b>0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n // printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\t//printf(\"%d %d\\n\",c,d);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\t//printf(\"%d %d\\n\",c,d);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\t//printf(\"%d %d\\n\",c,d);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\t//printf(\"%d %d\\n\",c,d);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",s);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif(i==1&&j==1) sum=0;\n\tif(i==n&&j==1) sum=0;\n\tif(i==n&&j==n) sum=0;\n\tif(i==1&&j==n) sum=0;\n if((i-a<1&&i+a>n)||(j+b>m)&&j-a<1) {if(sum==100000000) printf(\"Poor Inna and pony!\\n\");else printf(\"%d\\n\",sum);}\n\n else\n {\n\t\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t sum=y;\n\t\t\t}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t\tsum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{ if(x<sum)\n\t\t\t sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n printf(\"0\");\n return 0;\n }\n else if((n==i&&i==1&&a>0)||(m==j&&j==1&&b>0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n // printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n\n if ((i == 1 || i == n) && (j == 1 || j == m))\n {\n printf(\"0\\n\");\n return 0;\n }\n \n if ((a > (n-i) && a > (i-1)) || (b > (m-j) && b > (j-1)))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = -1;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((n-i)/a - (m-j)/b) % 2 == 0) && (a > (n-i) || b > (m-j)))\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n //if ( (abs((i-1)/a - (m-j)/b) % 2 == 0) && (a > (i-1) || b > (m-j)))\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((n-i)/a - (j-1)/b) % 2 == 0) && (a > (n-i) || b > (j-1)))\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n //if ( (abs((i-1)/a - (j-1)/b) % 2 == 0) && (a > (i-1) || b > (j-1)))\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,i,j,a,b;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\nint x,y,h;\nint ma[4];\nfor(h=0;h<4;h++)\n{ma[h]=999999;\n}\nif(((i==n)&&(j==m))||((i==1)&&(j==m))||((i==1)&&(j==1))||((i==n)&&(j==1)))\n{\n printf(\"0\\n\");\n return 0;\n}\nif((j+b>m)||(i+a>n))\n{\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}\nif((((i-1)%a)==0)&&(((j-1)%b)==0))\n{\n if(((i-1)/a+(j-1)/b)%2==0)\nma[0]=((i-1)/(a)>(j-1)/(b)?(i-1)/(a):(j-1)/(b));\n //printf(\"here %d\\n\",ma[0]);\n\n}\nif((((i-1)%a)==0)&&(((m-j)%b)==0))\n{\n if(((i-1)/a+(m-j)/b)%2==0)\nma[1]=((i-1)/(a)>(m-j)/(b)?(i-1)/(a):(m-j)/(b));\n //printf(\"hrtyr %d\\n\",ma[1]);\n}\nif((((n-i)%a)==0)&&(((j-1)%b)==0))\n{\n if(((n-i)/a+(j-1)/b)%2==0)\nma[2]=((n-i)/(a)>(j-1)/(b)?(n-i)/(a):(j-1)/(b));\n\n //printf(\"hrtyr3 %d\\n\",ma[2]);\n}\nif((((n-i)%a)==0)&&(((m-j)%b)==0))\n{\n if(((n-i)/a+(m-j)/b)%2==0)\nma[3]=((n-i)/(a)>(m-j)/(b)?(n-i)/(a):(m-j)/(b));\n\n\n // printf(\"hrtyr4 %d\\n\",ma[3]);\n}\n\n\n/*if(((n-i)%(2*a)==0)&&((m-j)==0))\n{ma[4]=(n-i)/a;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n}\nelse if(((m-j)%(2*b)==0)&&((n-i)==0))\n{\nma[4]=(m-j)/b;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n\n}\nif(((i-1)%(2*a)==0)&&(j-1==0))\n{\nma[5]=(i-1)/a;\n // printf(\"here %d\\n\",ma[0]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-1==0))\n{\nma[5]=(j-1)/b;\n //printf(\"here %d\\n\",ma[0]);\n\n}\n\n\n\nif(((i-1)%(2*a)==0)&&(j-m==0))\n{\nma[6]=(i-1)/a;\n //printf(\"here %d\\n\",ma[6]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-n==0))\n{\n ma[6]=(j-1)/b;\n //printf(\"here %d\\n\",ma[6]);\n\n}\n\n\nif(((n-i)%(2*a)==0)&&(j-1==0))\n{\nma[7]=(n-i)/a;\n //printf(\"here %d\\n\",ma[7]);\n\n}\nelse if(((m-j)%(2*b)==0)&&(i-1==0))\n{\n ma[7]=(m-j)/b;\n //printf(\"here %d\\n\",ma[7]);\n\n}\n\n\n\n\n*/\n\n\n\nint temp=ma[0];\nfor(h=0;h<4;h++)\n{\n if(temp>ma[h])\n temp=ma[h];\n}\nif(temp==999999)\nprintf(\"Poor Inna and pony!\\n\");\nelse\nprintf(\"%d\\n\",temp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint n,m;\nin_bounce(int x,int y)\n{\n if(x<=n&&x>=1&&y<=m&&y>=1) return 1;\n return 0;\n}\nmain()\n{\n int i,j,a,b,k,dir[4][2],nowdx,nowdy,min;\n while(~scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b)) \n {\n\t min=9999999;\n dir[0][0]=1;dir[0][1]=1;\n\t dir[1][0]=1;dir[1][1]=m;\n\t dir[2][0]=n;dir[2][1]=m;\n\t dir[3][0]=n;dir[3][1]=1;\n\t for(k=0;k<4;k++)\n\t {\n\t nowdx=abs(i-dir[k][0]);\n\t\t nowdy=abs(j-dir[k][1]);\n\t\t if(nowdx%a!=0||nowdy%b!=0) continue;\n\t\t else \n\t\t if(nowdx/a==nowdy/b&&min>nowdx/a) min=nowdx/a;\n\t\t else if(nowdx/a>nowdy/b) \n\t\t {if((nowdx/a-nowdy/b)%(2*a)==0&&(min>nowdy/b+(nowdx/a-nowdy/b)/a)&&(in_bounce(i-2*a,j)||in_bounce(i+2*a,j))) min=nowdy/b+(nowdx/a-nowdy/b)/a;}\n\t\t else if((nowdy/b-nowdx/a)%(2*b)==0&&(min>nowdx/a+(nowdy/b-nowdx/a)/b)&&(in_bounce(i,j-b*2)||in_bounce(i,j+b*2))) min=nowdx/a+(nowdy/b-nowdx/a)/b;\t\n\t }\n\t if(min==9999999) printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",min);\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn a<b?a:b;\n}\nint ch(int a,int b){\n\tif(a==-1)return 0;\n\tif(b==-1)return 0;\n\tint c=a-b;\n\tif(c<0)c*=-1;\n\treturn ((c%2)==0);\n}\t\nint mx(int a,int b){\n\treturn a>b?a:b;\n}\nint main(){\n\tint n,m,i,j,a,b,p1,q1,p2,q2;\n\tint w,x,y,z;\n\tscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\tp1=q1=-1;\n\tif((n-i)%a==0)p1=(n-i)/a;\n\tif((i-1)%a==0)q1=(i-1)/a;\n\tp2=q2=-1;\n\tif((m-j)%b==0)p2=(m-j)/b;\n\tif((j-1)%b==0)q2=(j-1)/b;\n\tw=x=y=z=-1;\n\tif(ch(p1,p2))w=mx(p1,p2);\n\tif(ch(p1,q2))x=mx(p1,q2);\n\tif(ch(q1,p2))y=mx(q1,p2);\n\tif(ch(q1,q2))z=mx(q1,q2);\n\tn=mn(mn(w,x),mn(y,z));\n\tif(n==-1)\n\t\tprintf(\"Poor Inna and pony!\");\n\telse\n\t\tprintf(\"%d\",n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n \n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n printf(\"0\");\n return 0;\n }\n else if((n==i&&i==1&&a>0)||(m==j&&j==1&&b>0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n // printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (n!=a && m!=b){\n\t\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n}\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m; \n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n if ( n == 1 || m == 1 ) {\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] == 0 && cj[ k ] == 0 )\n min = 0;\n } else\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp = cj[ k ] / b > ci[ k ] / a ? cj[ k ] / b : ci[ k ] / a;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m,i,j,a,b,fa[2][2],fb[2][2],r,v=-1,s;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n s=n;\n r=(i-1)%(2*a);\n fa[0][1]=(i-1)/a;\n if(r==a)fa[0][0]=1;\n else if(r==0)fa[0][0]=2;\n else fa[0][0]=0;\n r=(n-i)%(2*a);\n fa[1][1]=(n-i)/a;\n if(r==a)fa[1][0]=1;\n else if(r==0)fa[1][0]=2;\n else fa[1][0]=0;\n r=(j-1)%(2*b);\n fb[0][1]=(j-1)/b;\n if(r==b)fb[0][0]=1;\n else if(r==0)fb[0][0]=2;\n else fb[0][0]=0;\n r=(m-j)%(2*b);\n fb[1][1]=(m-j)/b;\n if(r==b)fb[1][0]=1;\n else if(r==0)fb[1][0]=2;\n else fb[1][0]=0;\n r=-1;\n if(fa[0][0]==1)r=fa[0][1];\n if(fa[1][0]==1&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==1)n=fb[0][1];\n if(fb[1][0]==1&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))v=n>r?n:r;\n \n r=-1;\n if(fa[0][0]==2)r=fa[0][1];\n if(fa[1][0]==2&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==2)n=fb[0][1];\n if(fb[1][0]==2&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))if(!(v+1)||v>n&&v>r)v=n>r?n:r;\n \n \n \n \n if(!v||(v+1&&s>2&&m>2))printf(\"%d\",v);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n\t\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint check1(int x, int y,int i, int j,int a,int b)\n{\n\tif((abs(x-i)%a)==0 && (abs(y-j)%b)==0)\n\treturn 1;\n\treturn 0;\n}\nint check2(int x, int y, int i, int j,int a, int b)\n{\n\tif((abs(x-i)/a)%2==0 && (abs(y-j)/b)%2==0)\n\treturn 1;\n\tif((abs(x-i)/a)%2==1 && (abs(y-j)/b)%2==1)\n\treturn 1;\n\treturn 0;\n}\nint dist(int x,int y,int i, int j,int a, int b)\n{\n\treturn (max(abs(x-i)/a, abs(y-j)/b));\n}\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint A[4]={0};\n\tif(check1(1,1,i,j,a,b)==0 && (check1(1,m,i,j,a,b)==0) && check1(n,1,i,j,a,b)==0 && check1(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tif(check2(1,1,i,j,a,b)==0 && (check2(1,m,i,j,a,b)==0) && check2(n,1,i,j,a,b)==0 && check2(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tA[0]=dist(1,1,i,j,a,b);\n\tA[1]=dist(1,m,i,j,a,b);\n\tA[2]=dist(n,1,i,j,a,b);\n\tA[3]=dist(n,m,i,j,a,b);\n\tint max=A[0];\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tif(A[i]>max)\n\t\tmax=A[i];\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else{\n if((n == 1 || m == 1) && (i != 1 || j != 1) && (i != 1 || j != m) && (i != n || j != 1) && (i != n || j != m))\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,m,i,j,a,b,p,q,r,s,k,z,c,d,l;\n long arr[4];\n arr[0]=1000001;\n arr[1]=1000001;\n arr[2]=1000001;\n arr[3]=1000001;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n \n \n p=(i-1);\n q=(j-1);\n r=abs(i-n);\n s=abs(j-m);\n \n if(((p%a)==0)&&((q%b)==0))\n {k=p/a;\n z=q/b;\n if(((abs(k-z))%2)==0)\n {\n if (k>z)\n arr[0]=k;\n else\n arr[0]=z;\n }\n }\n \n if(((p%a)==0)&&((s%b)==0))\n {k=p/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[1]=k;\n else\n arr[1]=z;\n }\n }\n \n if(((r%a)==0)&&((q%b)==0))\n {k=r/a;\n z=q/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[2]=k;\n else\n arr[2]=z;\n }\n }\n if(((r%a)==0)&&((s%b)==0))\n {k=r/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[3]=k;\n else\n arr[3]=z;\n }\n }\n for (c = 1 ; c <= 3; c++) {\n d = c;\n \n while ( d > 0 && arr[d] < arr[d-1]) {\n l = arr[d];\n arr[d] = arr[d-1];\n arr[d-1] = l;\n \n d--;\n }\n }\n if (arr[0]!=1000001&&(n!=i)&&(m!=j))\n printf(\"%d\",arr[0]);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n \n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,x,y,a,b;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&x,&y,&a,&b);\n int min=10000000,no1,no2;\n if((x-1)%a==0&&(y-1)%b==0)\n {\n no1=(x-1)/a;\n no2=(y-1)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\nif((x-1)%a==0&&(m-y)%b==0)\n {\n no1=(x-1)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(m-y)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if((n-x)%a==0&&(y-1)%b==0)\n {\n no1=(n-x)/a;\n no2=(m-y)/b;\n if(no1>no2)\n {\n if((no1-no2)%2==0)\n {\n if(min>no1)\n min=no1;\n }\n }\n else\n {\n if((no2-no1)%2==0)\n {\n if(min>no2)\n min=no2;\n }\n }\n }\n if(min<10000000)\n printf(\"%d\",min);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint abs(int x)\n{\nif(x<0)\nreturn -x;\nelse\nreturn x;\n}\nint main()\n{\nint n,m,x,y,a,b,diff1,diff2,mov1,mov2,f=0,diff3,min=10000000,g;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b);\n//CORNER1\ndiff1=abs(x-1);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2;\n} \n}\n//CORNER2\ndiff1=abs(x-n);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER3\ndiff1=abs(x-n);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER4\ndiff1=abs(x-1);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\nif(f==1)\nprintf(\"%d\\n\",min);\nelse\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m; \n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n if ( n == 1 || m == 1 ) {\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] == 0 && cj[ k ] == 0 )\n min = 0;\n } else\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp = cj[ k ] / b > ci[ k ] / a ? cj[ k ] / b : ci[ k ] / a;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint check1(int x, int y,int i, int j,int a,int b)\n{\n\tif((abs(x-i)%a)==0 && (abs(y-j)%b)==0)\n\treturn 1;\n\treturn 0;\n}\nint check2(int x, int y, int i, int j,int a, int b)\n{\n\tif((abs(x-i)/a)%2==0 && (abs(y-j)/b)%2==0)\n\treturn 1;\n\tif((abs(x-i)/a)%2==1 && (abs(y-j)/b)%2==1)\n\treturn 1;\n\treturn 0;\n}\nint dist(int x,int y,int i, int j,int a, int b)\n{\n\treturn (max(abs(x-i)/a, abs(y-j)/b));\n}\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint A[4]={0};\n\tif(check1(1,1,i,j,a,b)==0 && (check1(1,m,i,j,a,b)==0) && check1(n,1,i,j,a,b)==0 && check1(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tif(check2(1,1,i,j,a,b)==0 && (check2(1,m,i,j,a,b)==0) && check2(n,1,i,j,a,b)==0 && check2(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tA[0]=dist(1,1,i,j,a,b);\n\tA[1]=dist(1,m,i,j,a,b);\n\tA[2]=dist(n,1,i,j,a,b);\n\tA[3]=dist(n,m,i,j,a,b);\n\tint max=A[0];\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tif(A[i]>max)\n\t\tmax=A[i];\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong max(long x , long y){ return x>y?x:y; }\nint main()\n{\n long i,j,n,m,a,b,ans[4],min,f=0;\n long cint,dint;\n float c,d;\n scanf(\"%ld%ld%ld%ld%ld%ld\",&n,&m,&i,&j,&a,&b);\n if(a>=n || b>=m)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n c=(i-1)*1.0/a;\n d=(j-1)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(j-1)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if((abs(cint-dint))%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(i-1)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n c=(n-i)*1.0/a;\n d=(m-j)*1.0/b;\n\n if(c==(long int)c && d==(long int)d)\n {\n cint=(long int)c;\n dint=(long int)d;\n if(abs(cint-dint)%2==0)\n ans[f++]=max(cint,dint);\n }\n \n if(f==0)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n min=1000000;\n for(i=0;i<f;i++)\n if(min>ans[i])\n min=ans[i];\n \n printf(\"%ld\",min);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int n,m,i,j,a,b;\nint ab(int a)\n{\n\tif(a<0)\n\treturn -a;\n\treturn a;\n}\nint max(int a,int b)\n{\n\tif(a<b)\n\treturn b;\n\treturn a;\n}\nint min(int a,int b)\n{\n\tif(a>b)\n\treturn b;\n\treturn a;\n}\nint func(int u,int v)\n{\t\t\n\t\tif(i==u&&j==v)\n\t\treturn 0;\n\t\tif(i+a>n&&i-a<=0)\n\t\treturn -1;\n\t\tif(i+b>m&&i-b<=0)\n\t\treturn -1;\n\t\tint x=ab(u-i),y=ab(v-j);\n\t\tif(x%a!=0||y%b!=0)\n\t\treturn -1;\n\t\tx=x/a;y=y/b;\n\t\tif(x%2!=y%2)\n\t\treturn -1;\n\t\tint t=max(x,y);\n\t\treturn t;\n}\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&i,&j,&a,&b);\n\tint ans=100000000;\n\tint a=func(1,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(1,1);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\ta=func(n,m);\n\tif(a!=-1)\n\t{\n\t\tans=min(ans,a);\n\t}\n\tif(ans<100000000)\n\tprintf(\"%d\",ans);\n\telse\n\tprintf(\"Poor Inna and pony!\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nmax (long int *pp,long int *pb){\n\tlong int t;\n\tif ((*pp)<(*pb)){\n\t\tt=*pp;\n\t\t*pp=*pb;\n\t\t*pb=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&b);\n\t\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t}\n\t\telse {\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\nelse if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\nelse if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\t\nelse if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\telse \n\t{\t\n\tprintf(\"Poor Inna and pony!\\n\");\t\n\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint sum=100000000;\n\tint x;\n\tint y;\n\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y) sum=y;\n\t\t\telse sum=x;\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\t//printf(\"%d%d\",i,j);\n\t\t//printf(\"%d%d\",a,b);\n\t\t//printf(\"%d%d\",x,y);\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (n!=a && m!=b){\n\t\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n}\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif(i==1&&j==1) sum=0;\n\tif(i==n&&j==1) sum=0;\n\tif(i==n&&j==n) sum=0;\n\tif(i==1&&j==n) sum=0;\n if((i-a<1&&i+a>n)||(j+b>m&&j-b<1))\n\t{ if(sum==100000000)\n\t printf(\"Poor Inna and pony!\\n\");\n\t else printf(\"%d\\n\",sum);\n\t // printf(\"*******\");\n\t}\n\n else\n {\n\t\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t sum=y;\n\t\t\t}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{\n\t\t\t\tif(y<sum)\n\t\t\t\tsum=y;\n\t\t\t}\n\t\t\telse\n\t\t\t{ if(x<sum)\n\t\t\t sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main( void ) {\n int k;\n int n, m, i, j, a, b, min;\n int ci[ 4 ] = { 1, 0, 0, 1 }, cj[ 4 ] = { 1, 1, 0, 0 };\n\n scanf( \"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b );\n\n ci[ 1 ] = ci[ 2 ] = n;\n cj[ 2 ] = cj[ 3 ] = m; \n\n for ( k = 0; k < 4; k++ ) {\n ci[ k ] -= i;\n cj[ k ] -= j;\n }\n\n min = 100000000;\n if ( n == 1 || m == 1 ) {\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] == 0 && cj[ k ] == 0 )\n min = 0;\n } else\n for ( k = 0; k < 4; k++ )\n if ( ci[ k ] % a == 0 && cj[ k ] % b == 0 )\n if ( ci[ k ] / a % 2 == 0 && cj[ k ] / b % 2 == 0 || ci[ k ] / a % 2 && cj[ k ] / b % 2 ) {\n int tmp = cj[ k ] / b > ci[ k ] / a ? cj[ k ] / b : ci[ k ] / a;\n\n min = min < tmp ? min : tmp;\n }\n\n if ( min == 100000000 )\n puts( \"Poor Inna and pony!\" );\n else\n printf( \"%d\\n\", min );\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int right=m-j;\n int left=j-1;\n int top=i-1;\n int bottom=n-i;\n int t1=0,t2=0,t3=0,t4=0,m1,m2,m3,m4;\n if((((right%b)!=0)&&((left%b)!=0))||(((top%a)!=0)&&((bottom%a)!=0)))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n if(((right%b==0)&&((right/b)!=0))||((left%b==0)&&((left/b)!=0)))\n {\n if((right%b==0)&&((right/b)!=0))\n {\n int minright=right/b;\n int mintop,minleft,minbottom;\n if(((top%a)==0)&&((top/a)!=0))\n {\n mintop=top/a;\n if(mintop<minright)\n {\n t1=0;\n }\n else if(mintop==minright)\n {\n m1=minright;\n t1=1;\n }\n else if(mintop>minright)\n {\n int k;\n k=mintop-minright;\n if(k%2==0)\n {\n m1=mintop;\n t1=1;\n }\n else\n {\n t1=0;\n }\n }\n }\n if(((bottom%a)==0)&&((bottom/a)!=0))\n {\n minbottom=bottom/a;\n if(minbottom<minright)\n {\n t2=0;\n }\n else if(minbottom==minright)\n {\n m2=minright;\n t2=1;\n }\n else if(minbottom>minright)\n {\n int k;\n k=minbottom-minright;\n if(k%2==0)\n {\n m2=minbottom;\n t2=1;\n }\n else\n {\n t2=0;\n }\n }\n }\n\n }\n\n\n\n if((left%b==0)&&((left/b)!=0))\n {\n int minleft=left/b;\n int mintop,minbottom;\n if(((top%a)==0)&&((top/a)!=0))\n {\n mintop=top/a;\n if(mintop<minleft)\n {\n t3=0;\n }\n else if(mintop==minleft)\n {\n m3=minleft;\n t2=1;\n }\n else if(mintop>minleft)\n {\n int k;\n k=mintop-minleft;\n if(k%2==0)\n {\n m3=mintop;\n t2=1;\n }\n else\n {\n t1=0;\n }\n }\n }\n if(((bottom%a)==0)&&((bottom/a)!=0))\n {\n minbottom=bottom/a;\n if(minbottom<minleft)\n {\n t4=0;\n }\n else if(minbottom==minleft)\n {\n m4=minleft;\n t4=1;\n }\n else if(minbottom>minleft)\n {\n int k;\n k=minbottom-minleft;\n if(k%2==0)\n {\n m4=minbottom;\n t4=1;\n }\n else\n {\n t4=0;\n }\n }\n }\n }\n }\n if((t1==0)&&(t2==0)&&(t3==0)&&(t4==0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n int min,p=0;\n if(t1==1)\n {\n if(p==0)\n {\n min=m1;\n p++;\n }\n }\n if(t2==1)\n {\n if(p==0)\n {\n min=m2;\n p++;\n }\n else\n {\n if(m2<min)\n {\n min=m2;\n }\n }\n }\n if(t3==1)\n {\n if(p==0)\n {\n min=m3;\n p++;\n }\n else\n {\n if(m3<min)\n {\n min=m3;\n }\n }\n }\n if(t4==1)\n {\n if(p==0)\n {\n min=m4;\n p++;\n }\n else\n {\n if(m4<min)\n {\n min=m4;\n }\n }\n }\n printf(\"%d\",min);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, n, i, j, a, b, x, y;\n scanf(\"%d%d\", &m, &n);\n scanf(\"%d%d%d%d\", &i, &j, &a, &b);\n if((a+i>m&&i-a<=0)||(b+j>n&&j-b<=0))\n puts(\"Poor Inna and pony!\");\n else\n {\n if((((i-1)%a!=0&&(m-i)%a!=0))||((j-1)%b!=0&&(n-j)%b!=0))\n printf(\"Poor Inna and pony!\\n\");\n else\n {\n y = 1000000;\n x = 1000000;\n if((i-1)%a==0&&(j-1)%b==0)\n {\n if((abs((i-1)/a-(j-1)/b))%2==0)\n {\n if((i-1)/a>(j-1)/b)\n x = (i-1)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((i-1)%a==0&&(n-j)%b==0)\n {\n if((abs((i-1)/a-(n-j)/b))%2==0)\n {\n if((i-1)/a>(n-j)/b)\n x = (i-1)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(j-1)%b==0)\n {\n if((abs((m-i)/a-(j-1)/b))%2==0)\n {\n if((m-i)/a>(j-1)/b)\n x = (m-i)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(n-j)%b==0)\n {\n if((abs((m-i)/a-(n-j)/b))%2==0)\n {\n if((m-i)/a>(n-j)/b)\n x = (m-i)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n if(y == 1000000)\n printf(\"Poor Inna and pony!\\n\");\n else\n printf(\"%d\\n\", y);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint max(int a,int b)\n{\n return a>b?a:b;\n}\nint min(int a,int b)\n{\n return a<b?a:b;\n}\nint main()\n{\n int n,m,i,j,a,b,ans=-1,x,y,an,flag=0;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n x=i-1;y=j-1;\n if(((i-1)>a || (n-i)>a) && ((j-1)>b || (m-j)>b))\n flag=1;\n\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=i-1;y=m-j;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=n-i;y=j-1;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n x=n-i;y=m-j;\n if(x%a==0 && y%b==0 && (x/a-y/b)%2==0)\n {\n an=max(x/a,y/b);\n if(ans==-1) ans=an;\n else ans=min(ans,an);\n }\n if(ans==-1 || (ans!=0 && flag==0)) printf(\"Poor Inna and pony!\");\n else printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,c,d,e,f;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&c,&d,&e,&f);\n int arr[n][m];\n int brr[4]={0};\n int z=4;\n int x=c,y=d;\n while(x>1||y>1)\n {\n x=x-e;\n y=y-f;\n brr[0]++;\n }\n if(x!=1||y!=1)\n {\n if(x!=1)\n {\n while(x>=1)\n {\n x=x-e;\n brr[0]++;\n }\n }\n if(y!=1);\n {\n while(y>=1)\n {\n y=y-f;\n brr[0]++;\n }\n }\n }\n if(y!=1||x!=1)\n {\n\n brr[0]=0;\n }\n x=c,y=d;\n while(x<n||y>1)\n {\n x=x+e;\n y=y-f;\n brr[1]++;\n }\n if(x!=n||y!=1)\n {\n if(x!=n)\n {\n while(x<=n)\n {\n x=x+e;\n brr[1]++;\n }\n }\n if(y!=1);\n {\n while(y>=1)\n {\n y=y-f;\n brr[1]++;\n }\n }\n }\n if(y!=1||x!=n)\n {\n\n brr[1]=0;\n }\n x=c,y=d;\n while(x>1||y<m)\n {\n x=x-e;\n y=y+f;\n brr[2]++;\n }\n if(x!=1||y!=m)\n {\n if(x!=1)\n {\n while(x>=1)\n {\n x=x-e;\n brr[2]++;\n }\n }\n if(y!=m);\n {\n while(y<=m)\n {\n y=y+f;\n brr[2]++;\n }\n }\n }\n if(y!=m||x!=1)\n {\n\n brr[2]=0;\n }\n x=c,y=d;\n while(x<n||y<m)\n {\n x=x+e;\n y=y+f;\n brr[3]++;\n\n }\n if(x!=n||y!=m)\n {\n if(x!=n)\n {\n while(x<=n)\n {\n x=x+e;\n brr[3]++;\n }\n }\n if(y!=m);\n {\n while(y<=m)\n {\n y=y+f;\n brr[3]++;\n }\n }\n }\n if(y!=m||x!=n)\n {\n\n brr[3]=0;\n }\n\nint mini=0,p=1;\n for(i=0;i<4;i++)\n {\n if(p=1)\n {\n if(brr[i]>0)\n mini=brr[i];\n p=0;\n }\n if(brr[i]<mini&&brr[i]!=0)\n mini=brr[i];\n\n }\n if(mini==0)\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n printf(\"%d\",mini);\n return 0;\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n,m,i,j,a,b,fa[2][2],fb[2][2],r,v=-1,s;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n s=n;\n r=(i-1)%(2*a);\n fa[0][1]=(i-1)/a;\n if(r==a)fa[0][0]=1;\n else if(r==0)fa[0][0]=2;\n else fa[0][0]=0;\n r=(n-i)%(2*a);\n fa[1][1]=(n-i)/a;\n if(r==a)fa[1][0]=1;\n else if(r==0)fa[1][0]=2;\n else fa[1][0]=0;\n r=(j-1)%(2*b);\n fb[0][1]=(j-1)/b;\n if(r==b)fb[0][0]=1;\n else if(r==0)fb[0][0]=2;\n else fb[0][0]=0;\n r=(m-j)%(2*b);\n fb[1][1]=(m-j)/b;\n if(r==b)fb[1][0]=1;\n else if(r==0)fb[1][0]=2;\n else fb[1][0]=0;\n r=-1;\n if(fa[0][0]==1)r=fa[0][1];\n if(fa[1][0]==1&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==1)n=fb[0][1];\n if(fb[1][0]==1&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))v=n>r?n:r;\n \n r=-1;\n if(fa[0][0]==2)r=fa[0][1];\n if(fa[1][0]==2&&(fa[1][1]<r||!(r+1)))r=fa[1][1];\n n=-1;\n if(fb[0][0]==2)n=fb[0][1];\n if(fb[1][0]==2&&(fb[1][1]<n||!(n+1)))n=fb[1][1];\n if((r+1)&&(n+1))if(!(v+1)||v>n&&v>r)v=n>r?n:r;\n \n \n \n \n if(!v||(v+1&&s>1&&m>1))printf(\"%d\",v);\n else printf(\"Poor Inna and pony!\");\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n }\n else if((n==i&&a>0)||(m==j&&b>0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n// printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nlong int min (long int a,long int b, long int c,long int d){\n\t\n\tif (a<=b && a<=c && a<=d)\nreturn a;\n\nif (b<=a && b<=c && b<=d)\t\nreturn b;\n\nif(c<=a && c<=b && c<=d)\nreturn c;\n\nif (d<=a && d<=b && d<=c)\nreturn d;\t\n\t\n}\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q,ans1,ans2,ans3,ans4,s;\n\tans1=ans3=ans2=ans4=1000000000;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (n!=a && m!=b){\n\t\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\t\n\t\n\tif ((p-q)%2==0){\n\t\tans1=p;\n\t\t\n\t\t}\n\t\t\n\t}\n if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans2=p;\n\t}\n}\n\n if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans3=p;\n\t\t\n\t}\n\t\n}\t\n\t\n\t\n if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tans4=p;\n\t\t\n\t}\n\t\n}\t\n}\n s=min(ans1,ans2,ans3,ans4);\t\n\tif(s!=1000000000){\n\t\n\t\n\tprintf(\"%ld\",s);\n}\nelse {\n\tprintf(\"Poor Inna and pony!\\n\");\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=0,t=0,r=0,k=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0&&(x-1)%a==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1000000;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=1000000;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=t<r?t:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,m,x,y,a,b;\n\twhile(scanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b)!=EOF)\n\t{\n\t\tint s=0,h=0,t=0,r=0,k=0;\n\t\tint c=0,d=0;\n\t\tif((m-y)%b==0&&(x-1)%a==0)\n\t\t{\n\t\t\tc=(m-y)/b;\n\t\t\td=(x-1)/a;\n\t\t\th=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",h);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\th=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(y-1)/b;\n\t\t\tt=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",t);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1000000;\n\t\t\t}\n\t\t}\n\t\tif((x-1)%a==0&&(y-1)%b==0)\n\t\t{\n\t\t\tc=(x-1)/a;\n\t\t\td=(y-1)/b;\n\t\t\tr=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",r);\n\t\t\tif(c%2==d%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr=1000000;\n\t\t\t}\n\t\t}\n\t\tif((n-x)%a==0&&(m-y)%b==0)\n\t\t{\n\t\t\tc=(n-x)/a;\n\t\t\td=(m-y)/b;\n\t\t\tk=c>d?c:d;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t\tif(d%2==c%2)\n\t\t\t{\n\t\t\t\ts++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tk=1000000;\n\t\t\t}\n\t\t}\n\t\tc=h<t?h:t;\n\t\td=t<r?t:r;\n\t\tc=c<d?c:d;\n\t\tif(s!=0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",c);\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else{\n if(n == 1 || m == 1)\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint mn(int a,int b){\n\tif(a==-1)return b;\n\tif(b==-1)return a;\n\treturn a<b?a:b;\n}\nint ch(int a,int b){\n\tif(a==-1)return 0;\n\tif(b==-1)return 0;\n\tint c=a-b;\n\tif(c<0)c*=-1;\n\treturn ((c%2)==0);\n}\t\nint mx(int a,int b){\n\treturn a>b?a:b;\n}\nint main(){\n\tint n,m,i,j,a,b,p1,q1,p2,q2;\n\tint w,x,y,z;\n\tscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\tif((i==1||i==n)&&(j==1||j==m)){\n\t\tprintf(\"0\");return 0;\n\t}\n\tif((i+a>n)&&(i-a<1)||(j+b>m)&&(j-b<1)){\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tp1=q1=-1;\n\tif((n-i)%a==0)p1=(n-i)/a;\n\tif((i-1)%a==0)q1=(i-1)/a;\n\tp2=q2=-1;\n\tif((m-j)%b==0)p2=(m-j)/b;\n\tif((j-1)%b==0)q2=(j-1)/b;\n\tw=x=y=z=-1;\n\tif(ch(p1,p2))w=mx(p1,p2);\n\tif(ch(p1,q2))x=mx(p1,q2);\n\tif(ch(q1,p2))y=mx(q1,p2);\n\tif(ch(q1,q2))z=mx(q1,q2);\n\tn=mn(mn(w,x),mn(y,z));\n\tprintf(\"%d %d %d %d \",p1,p2,q1,q2);\n\tif(n==-1)\n\t\tprintf(\"Poor Inna and pony!\");\n\telse\n\t\tprintf(\"%d\",n);\n}"}, {"source_code": "#include <stdio.h>\nint abs(int x)\n{\nif(x<0)\nreturn -x;\nelse\nreturn x;\n}\nint main()\n{\nint n,m,x,y,a,b,diff1,diff2,mov1,mov2,f=0,diff3,min=10000000,g;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&x,&y,&a,&b);\n//CORNER1\ndiff1=abs(x-1);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2;\n} \n}\n//CORNER2\ndiff1=abs(x-n);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER3\ndiff1=abs(x-n);\ndiff2=abs(y-m);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\n//CORNER4\ndiff1=abs(x-1);\ndiff2=abs(y-1);\nif(diff1%a==0 && diff2%b==0)\n{\ng=0;\nmov1=diff2/b;\nmov2=diff1/a;\ndiff3=abs(mov1-mov2);\nif(diff3==0)\ng=1;\nelse if(mov1>mov2 && n>1)\ng=1;\nelse if(mov2>mov1 && m>1)\ng=1;\nif(diff3%2==0 && g==1)\n{\nf=1;\nif(mov1>=mov2 && min>mov1)\nmin=mov1;\nelse if(mov2>mov1 && min>mov2)\nmin=mov2; \n}\n}\nif(f==1)\nprintf(\"%d\\n\",min);\nelse\nprintf(\"Poor Inna and pony!\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,m,i,j,a,b,p,q,r,s,k,z,c,d,l;\n long arr[4];\n arr[0]=1000001;\n arr[1]=1000001;\n arr[2]=1000001;\n arr[3]=1000001;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n \n \n p=(i-1);\n q=(j-1);\n r=abs(i-n);\n s=abs(j-m);\n \n if(((p%a)==0)&&((q%b)==0))\n {k=p/a;\n z=q/b;\n if(((abs(k-z))%2)==0)\n {\n if (k>z)\n arr[0]=k;\n else\n arr[0]=z;\n }\n }\n \n if(((p%a)==0)&&((s%b)==0))\n {k=p/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[1]=k;\n else\n arr[1]=z;\n }\n }\n \n if(((r%a)==0)&&((q%b)==0))\n {k=r/a;\n z=q/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[2]=k;\n else\n arr[2]=z;\n }\n }\n if(((r%a)==0)&&((s%b)==0))\n {k=r/a;\n z=s/b;\n if((abs(k-z)%2)==0)\n {\n if (k>z)\n arr[3]=k;\n else\n arr[3]=z;\n }\n }\n for (c = 1 ; c <= 3; c++) {\n d = c;\n \n while ( d > 0 && arr[d] < arr[d-1]) {\n l = arr[d];\n arr[d] = arr[d-1];\n arr[d-1] = l;\n \n d--;\n }\n }\n if((n==i)&&(m==j))\n printf(\"0\");\n else if (arr[0]!=1000001&&((n!=i)||(m!=j)))\n printf(\"%d\",arr[0]);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int i,j,k,l,a,b,n,m,k1,k2,k3,k4,p,q=1000009;\n scanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n if((n==i||i==1)&&(m==j||j==1))\n {\n }\n else if((n==i&&a>0)||(m==j&&b>0))\n {\n printf(\"Poor Inna and pony!\");\n return 0;\n }\n k=i-1;l=j-1;\n k1=n-i;k2=j-1;\n k3=i-1;k4=m-j;\n n-=i;m-=j;\n// printf(\"%ld %ld %ld %ld %ld %ld %ld %ld \",k,l,n,m,k1,k2,k3,k4);\n \n if(n%a==0&&m%b==0&&n/a%2==m/b%2)\n {\n if(n/a<m/b)\n p=m/b;\n else\n p=n/a;\n if(q>p)\n q=p;\n }\n if(k%a==0&&l%b==0&&k/a%2==l/b%2)\n {\n if(k/a<l/b)\n p=l/b;\n else\n p=k/a;\n if(q>p)\n q=p;\n }\n if(k1%a==0&&k2%b==0&&k1/a%2==k2/b%2)\n {\n if(k1/a<k2/b)\n p=k2/b;\n else\n p=k1/a;\n if(q>p)\n q=p;\n }\n if(k3%a==0&&k4%b==0&&k3/a%2==k4/b%2)\n {\n if(k3/a<k4/b)\n p=k4/b;\n else\n p=k3/a;\n if(q>p)\n q=p;\n }\n if(q!=1000009)\n printf(\"%ld\",q);\n else\n printf(\"Poor Inna and pony!\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int min=-1;\n int checka,checkb;\n checka= abs(n-i);\n checkb = abs(m-j);\n\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(m-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(n-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n\n if (min == -1) {\n printf(\"Poor Inna and pony!\");\n } else if (min == 0) {\n printf(\"0\");\n } else if ((abs(n-i) >=a && abs(m-j) >=b) || (i-1 >= a && j-1 >=b)) {\n printf(\"%d\",min);\n } else {\n printf(\"Poor Inna and pony!\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nmax (long int *pp,long int *pq){\n\tlong int t;\n\tif ((*pp)<(*pq)){\n\t\tt=*pp;\n\t\t*pp=*pq;\n\t\t*pq=t;\n\t\t\n\t}\n\t\n}\nint main (){\n\tlong int n,m,i,j,a,b,p,q;\n\tscanf(\"%ld %ld %ld %ld %ld %ld\",&n,&m,&i,&j,&a,&b);\n\tif (((n-i)%a==0) && ( (m-j)%b==0) )\n{\n\tp=(n-i)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tprintf(\"p=%ld\\n\",p);\n\tprintf(\"q=%ld\\n\",q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\treturn 0;\n\t\t}\n\t\telse {\n\t\t\tprintf(\"Poor Inna and pony!\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\nelse if (((n-i)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(n-i)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\nelse if (((i-1)%a==0) && ( (j-1)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(j-1)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\t\nelse if (((i-1)%a==0) && ( (m-j)%b==0 ))\n{\n\tp=(i-1)/a;\n\tq=(m-j)/b;\n\tmax(&p,&q);\n\tif ((p-q)%2==0){\n\t\tprintf(\"%ld\",p);\n\t\t\n\t}\n\telse \n\tprintf(\"Poor Inna and pony!\");\n}\t\n\t\n\telse \n\t{\t\n\tprintf(\"Poor Inna and pony!\\n\");\t\n\n}\nreturn 0;\n}\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint check1(int x, int y,int i, int j,int a,int b)\n{\n\tif((abs(x-i)%a)==0 && (abs(y-j)%b)==0)\n\treturn 1;\n\treturn 0;\n}\nint check2(int x, int y, int i, int j,int a, int b)\n{\n\tif((abs(x-i)/a)%2==0 && (abs(y-j)/b)%2==0)\n\treturn 1;\n\tif((abs(x-i)/a)%2==1 && (abs(y-j)/b)%2==1)\n\treturn 1;\n\treturn 0;\n}\nint dist(int x,int y,int i, int j,int a, int b)\n{\n\treturn (max(abs(x-i)/a, abs(y-j)/b));\n}\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint A[4]={0};\n\tif(check1(1,1,i,j,a,b)==0 && (check1(1,m,i,j,a,b)==0) && check1(n,1,i,j,a,b)==0 && check1(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tif(check2(1,1,i,j,a,b)==0 && (check2(1,m,i,j,a,b)==0) && check2(n,1,i,j,a,b)==0 && check2(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tA[0]=dist(1,1,i,j,a,b);\n\tA[1]=dist(1,m,i,j,a,b);\n\tA[2]=dist(n,1,i,j,a,b);\n\tA[3]=dist(n,m,i,j,a,b);\n\tint max=A[0];\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tif(A[i]>max)\n\t\tmax=A[i];\n\t}\n\tprintf(\"%d\",max);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define INF 1000000009\nint max(int x,int y){\n if(x>y){\n return x;\n }\n return y;\n}\nint min(int x, int y){\n if(x>y){\n return y;\n }\n return x;\n}\nint main(){\n int n,m,i,j,a,b,cnt1=INF,cnt2=INF,cnt3=INF,cnt4=INF;\n int ans1=INF,ans2=INF,ans3=INF,ans4=INF,s,t,ret;\n scanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n if((i-1)%a!=0){\n if((n-i)%a!=0){\n if((j-1)%b!=0){\n if((m-j)%b!=0){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n }\n }\n }\n if((i-1)%a==0){\n cnt1=(i-1)/a;\n }\n if((n-i)%a==0){\n cnt2=(n-i)/a;\n }\n if((j-1)%b==0){\n cnt3=(j-1)/b;\n }\n if((m-j)%b==0){\n cnt4=(m-j)/b;\n }\n if((cnt1-cnt3)%2==0 && cnt1!=INF && cnt3!=INF){\n ans1=max(cnt1,cnt3);\n }\n if((cnt1-cnt4)%2==0 && cnt1!=INF && cnt4!=INF){\n ans2=max(cnt1,cnt4);\n }\n if((cnt2-cnt3)%2==0 && cnt2!=INF && cnt3!=INF){\n ans3=max(cnt2,cnt3);\n }\n if((cnt2-cnt4)%2==0 && cnt2!=INF && cnt4!=INF){\n ans4=max(cnt2,cnt4);\n }\n if(ans1==INF && ans2==INF && ans3==INF && ans4==INF){\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n s=min(ans1,ans2);\n t=min(ans3,ans4);\n ret=min(s,t);\n printf(\"%d\\n\",ret);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\treturn b;\n}\nint check1(int x, int y,int i, int j,int a,int b)\n{\n\tif((abs(x-i)%a)==0 && (abs(y-j)%b)==0)\n\treturn 1;\n\treturn 0;\n}\nint check2(int x, int y, int i, int j,int a, int b)\n{\n\tif((abs(x-i)/a)%2==0 && (abs(y-j)/b)%2==0)\n\treturn 1;\n\tif((abs(x-i)/a)%2==1 && (abs(y-j)/b)%2==1)\n\treturn 1;\n\treturn 0;\n}\nint dist(int x,int y,int i, int j,int a, int b)\n{\n\treturn (max(abs(x-i)/a, abs(y-j)/b));\n}\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint A[4]={0};\n\tif(check1(1,1,i,j,a,b)==0 && (check1(1,m,i,j,a,b)==0) && check1(n,1,i,j,a,b)==0 && check1(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tif(check2(1,1,i,j,a,b)==0 && (check2(1,m,i,j,a,b)==0) && check2(n,1,i,j,a,b)==0 && check2(n,m,i,j,a,b)==0)\n\t{\n\t\tprintf(\"Poor Inna and pony!\");\n\t\treturn 0;\n\t}\n\tA[0]=dist(1,1,i,j,a,b);\n\tA[1]=dist(1,m,i,j,a,b);\n\tA[2]=dist(n,1,i,j,a,b);\n\tA[3]=dist(n,m,i,j,a,b);\n\tint min=A[0];\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tif(A[i]<min)\n\t\tmin=A[i];\n\t}\n\tprintf(\"%d\",min);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,i,j,a,b;\nscanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\nint x,y,h;\nint ma[4];\nfor(h=0;h<4;h++)\n{ma[h]=999999;\n}\nif((((i-1)%a)==0)&&(((j-1)%b)==0))\n{\n if(((i-1)/a+(j-1)/b)%2==0)\nma[0]=((i-1)/(a)>(j-1)/(b)?(i-1)/(a):(j-1)/(b));\n //printf(\"here %d\\n\",ma[0]);\n\n}\nif((((i-1)%a)==0)&&(((m-j)%b)==0))\n{\n if(((i-1)/a+(m-j)/b)%2==0)\nma[1]=((i-1)/(a)>(m-j)/(b)?(i-1)/(a):(m-j)/(b));\n //printf(\"hrtyr %d\\n\",ma[1]);\n}\nif((((n-i)%a)==0)&&(((j-1)%b)==0))\n{\n if(((n-i)/a+(j-1)/b)%2==0)\nma[2]=((n-i)/(a)>(j-1)/(b)?(n-i)/(a):(j-1)/(b));\n\n //printf(\"hrtyr3 %d\\n\",ma[2]);\n}\nif((((n-i)%a)==0)&&(((m-j)%b)==0))\n{\n if(((n-i)/a+(m-j)/b)%2==0)\nma[3]=((n-i)/(a)>(m-j)/(b)?(n-i)/(a):(m-j)/(b));\n\n\n // printf(\"hrtyr4 %d\\n\",ma[3]);\n}\n\n\n/*if(((n-i)%(2*a)==0)&&((m-j)==0))\n{ma[4]=(n-i)/a;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n}\nelse if(((m-j)%(2*b)==0)&&((n-i)==0))\n{\nma[4]=(m-j)/b;\n //printf(\"hrtyr4 %d\\n\",ma[4]);\n\n}\nif(((i-1)%(2*a)==0)&&(j-1==0))\n{\nma[5]=(i-1)/a;\n // printf(\"here %d\\n\",ma[0]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-1==0))\n{\nma[5]=(j-1)/b;\n //printf(\"here %d\\n\",ma[0]);\n\n}\n\n\n\nif(((i-1)%(2*a)==0)&&(j-m==0))\n{\nma[6]=(i-1)/a;\n //printf(\"here %d\\n\",ma[6]);\n\n}\nelse if(((j-1)%(2*b)==0)&&(i-n==0))\n{\n ma[6]=(j-1)/b;\n //printf(\"here %d\\n\",ma[6]);\n\n}\n\n\nif(((n-i)%(2*a)==0)&&(j-1==0))\n{\nma[7]=(n-i)/a;\n //printf(\"here %d\\n\",ma[7]);\n\n}\nelse if(((m-j)%(2*b)==0)&&(i-1==0))\n{\n ma[7]=(m-j)/b;\n //printf(\"here %d\\n\",ma[7]);\n\n}\n\n\n\n\n*/\n\n\n\nint temp=ma[0];\nfor(h=0;h<4;h++)\n{\n if(temp>ma[h])\n temp=ma[h];\n}\nif(temp==999999)\nprintf(\"Poor Inna and pony!\\n\");\nelse\nprintf(\"%d\\n\",temp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\n\n#define INF 1000000\n#define MAX 1010\n\nint abs(int a)\n{\n if (a < 0) return -a;\n return a;\n}\n\nint max (int a, int b)\n{\n if (a<b) return b;\n return a;\n}\n\nint main()\n{\n int n, m, i, j, a, b;\n\n scanf(\"%d %d %d %d %d %d\", &n, &m, &i, &j, &a, &b);\n \n if (a > (n-i) || a > (i-1) || b > (m-j) || b > (j-1))\n {\n printf(\"Poor Inna and pony!\\n\");\n return 0;\n }\n\n int resp = -1;\n if ((n-i)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((n-i)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(+,+) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (m-j)%b == 0)\n {\n if ( abs((i-1)/a - (m-j)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (m-j)/b);\n resp = max(resp, aux);\n //printf(\"(-,+) %d\\n\", aux);\n }\n }\n\n if ((n-i)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((n-i)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((n-i)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(+,-) %d\\n\", aux);\n }\n }\n\n if ((i-1)%a == 0 && (j-1)%b == 0)\n {\n if ( abs((i-1)/a - (j-1)/b) % 2 == 0)\n {\n int aux = max((i-1)/a, (j-1)/b);\n resp = max(resp, aux);\n //printf(\"(-,-) %d\\n\", aux);\n }\n }\n\n if (resp == -1) printf(\"Poor Inna and pony!\\n\");\n else printf(\"%d\\n\",resp);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint main()\n{\n int n,m,i,j,a,b;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n int min=-1;\n int checka,checkb;\n checka= abs(n-i);\n checkb = abs(m-j);\n\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(1-i);\n checkb = abs(m-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n checka= abs(n-i);\n checkb = abs(1-j);\n if (checka%a==0 &&checkb%b == 0) {\n int x,y;\n x = checka/a;\n y = checkb/b;\n if (x%2 == y%2) {\n if (x>y) {\n if (min == -1 || min > x) {\n min = x;\n }\n } else {\n if (min == -1 || min > y) {\n min = y;\n }\n }\n }\n }\n\n if (min == -1) {\n printf(\"Poor Inna and pony!\");\n } else if (min == 0) {\n printf(\"0\");\n } else if ((abs(n-i) >=a && abs(m-j) >=b) || (i-1 >= a && j-1 >=b)) {\n printf(\"%d\",min);\n } else {\n printf(\"Poor Inna and pony!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint sum=100000000;\nint main()\n{\n\tint n,m,i,j,a,b;\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\n\tint x;\n\tint y;\n\tif((n-i)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ \n\t\t\t\tif(y<sum) sum=y;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tif(x<sum) sum=x;\n\t\t\t}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t// printf(\"%d\\n\",sum);\n\tif((i-1)%a==0&&(m-j)%b==0)\n\t{\n\t\tx=(i-1)/a;\n\t\ty=(m-j)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif((n-i)%a==0&&(j-1)%b==0)\n\t{\n\t\tx=(n-i)/a;\n\t\ty=(j-1)/b;\n\t\tif((x+y)%2==0)\n\t\t{\n\t\t\tif(x<y)\n\t\t\t{ if(y<sum) sum=y;}\n\t\t\telse {if(x<sum) sum=x;}\n\t\t}\n\t}\n\t //printf(\"%d\\n\",sum);\n\tif(sum==100000000) printf(\"Poor Inna and pony!\\n\");\n\telse printf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define MAX 20000000\n\nint min(int a,int b){\n\n if(a > b)\n return b;\n return a;\n}\n\nint max(int a,int b){\n\n if(a > b)\n return a;\n return b;\n}\n\nint main(){\n\n int n, m, a, b, i, j, c1 = MAX, c2 = MAX, c3 = MAX, c4 = MAX, answ;\n scanf(\"%d %d %d %d %d %d\",&n,&m,&i,&j,&a,&b);\n\n if((i - 1) % a == 0 && (j - 1) % b == 0 && ((i - 1) / a) % 2 == ((j - 1) / b) % 2)\n c1 = max((i - 1) / a,(j - 1) / b);\n\n if((n - i) % a == 0 && (m - j) % b == 0 && ((n - i) / a) % 2 == ((m - j) / b) % 2)\n c2 = max((m - j) / b,(n - i) / a);\n\n if((n - i) % a == 0 && (j - 1) % b == 0 && ((n - i) / a) % 2 == ((j - 1) / b) % 2)\n c3 = max((j - 1) / b,(n - i) / a);\n\n if((i - 1) % a == 0 && (m - j) % b == 0 && ((i - 1) / a) % 2 == ((m - j) / b) % 2)\n c4 = max((m - j) / b,(i - 1) / a);\n\n\n answ = min(min(c1,c2),min(c3,c4));\n\n if(answ == MAX)\n printf(\"Poor Inna and pony!\");\n else{\n if((n == 1 || m == 1) && (i != 1 || j != 1) && (i != 1 || j != m) && (i != n || j != 1) && (i != n || j != m))\n printf(\"Poor Inna and pony!\");\n else\n printf(\"%d\",answ);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint min(int a,int b)\n{\n\treturn a>b?b:a;\n}\nint n,m,i,j,a,b;\nint main()\n{\n\tscanf(\"%d%d%d%d%d%d\",&n,&m,&i,&j,&a,&b);\n\tint ans1,ans2,ans3,ans4;\n\tans1=ans2=ans3=ans4=0;\n\tif(i-1%a!=0&&n-i%a!=0)\n\t{printf(\"Poor Inna and pony!\");return 0;}\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j+b;\n\t\tans1++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j+b;\n\t\tans2++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tint ans=min(ans1,ans2);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i+a;j=j-b;\n\t\tans3++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans3);\n\tfor(int k=1;k<=500000;k++)\n\t{\n\t\ti=i-a;j=j-b;\n\t\tans4++;\n\t\tif(i==1&&j==1||i==n&&j==m||i==1&&j==m||i==n&&j==1)\n\t\tbreak;\n\t}\n\tans=min(ans,ans4);\n\t\n\tprintf(\"%d\\n\",ans);\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int m, n, i, j, a, b, x, y;\n scanf(\"%d%d\", &m, &n);\n scanf(\"%d%d%d%d\", &i, &j, &a, &b);\n if(a>=m||b>=n)\n puts(\"not possible\");\n else\n {\n if((((i-1)%a!=0&&(m-i)%a!=0))||((j-1)%b!=0&&(n-j)%b!=0))\n printf(\"Poor Inna and pony!\\n\");\n else\n {\n y = 1000000;\n x = 1000000;\n if((i-1)%a==0&&(j-1)%b==0)\n {\n if((abs((i-1)/a-(j-1)/b))%2==0)\n {\n if((i-1)/a>(j-1)/b)\n x = (i-1)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((i-1)%a==0&&(n-j)%b==0)\n {\n if((abs((i-1)/a-(n-j)/b))%2==0)\n {\n if((i-1)/a>(n-j)/b)\n x = (i-1)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(j-1)%b==0)\n {\n if((abs((m-i)/a-(j-1)/b))%2==0)\n {\n if((m-i)/a>(j-1)/b)\n x = (m-i)/a;\n else\n x = (j-1)/b;\n }\n if(y > x) y = x;\n }\n x = 1000000;\n if((m-i)%a==0&&(n-j)%b==0)\n {\n if((abs((m-i)/a-(n-j)/b))%2==0)\n {\n if((m-i)/a>(n-j)/b)\n x = (m-i)/a;\n else\n x = (n-j)/b;\n }\n if(y > x) y = x;\n }\n if(y == 1000000)\n printf(\"Poor Inna and pony!\\n\");\n else\n printf(\"%d\\n\", y);\n }\n }\n return 0;\n}\n"}], "src_uid": "51155e9bfa90e0ff29d049cedc3e1862"} {"nl": {"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_spec": "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_spec": "If it's possible to recolor all puppies into one color, print \"Yes\". Otherwise print \"No\". Output the answer without quotation signs.", "sample_inputs": ["6\naabddc", "3\nabc", "3\njjj"], "sample_outputs": ["Yes", "No", "Yes"], "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."}, "positive_code": [{"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,i,j,p=0,count=0;\n char a[100005];\n\n scanf(\"%d\",&n);\n\n scanf(\"%s\",&a);\n\n for(i=0;i<n;i++)\n {\n\n for(j=i+1;j<n;j++)\n {\n\n if(a[i]==a[j])\n {\n count++;\n break;\n }\n }\n\n }\n\n\n if(count>=1 || n==1)\n printf(\"YES\");\n\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid mergesort(char arr[], int l, int r)\n{\nif (l < r)\n{\nint m = l+(r-l)/2;\nmergesort(arr, l, m);\nmergesort(arr, m+1,r);\nmerge(arr, l, m, r);\n}\n}\nvoid merge(char arr[], int l, int m, int r)\n{\nint i, j, k;\nint n1 = m - l + 1;\nint n2 = r - m;\nchar L[1+n1], R[1+n2];\nfor (i = 0; i < n1; i++)\nL[i] = arr[l + i];\nfor (j = 0; j < n2; j++)\nR[j] = arr[m + 1+ j];\ni = 0;\nj = 0;\nk = l;\nwhile (i < n1 && j < n2)\n{\nif (L[i] <= R[j])\n{\narr[k] = L[i];\ni++;\n}\nelse\n{\narr[k] = R[j];\nj++;\n}\nk++;\n}\nwhile (i < n1)\n{\narr[k] = L[i];\ni++;\nk++;\n}\nwhile (j < n2)\n{\narr[k] = R[j];\nj++;\nk++;\n}\n}\nint main()\n{\n int n,f=0,count=1;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n s[n]='\\0';\n if(n==1)\n printf(\"%s\",\"YES\");\n else\n {\n mergesort(s,0,n-1);\n for(int i=0;i<n;i++)\n {\n if(s[i]==s[i+1])\n {\n count++;\n if(count==2)\n {\n f=1;\n break;\n }\n }\n else\n count=1;\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\nint main(){\n int n, i, j;\n char s[100001], p;\n scanf(\"%d\", &n);\n scanf(\"%s\", s);\n if (n > 26 || n == 1){printf(\"Yes\"); exit(0);}\n for (i=0; i<n-1; i++){\n for (j=i+1; j<n; j++){\n if (s[i] == s[j]){printf(\"Yes\"); exit(0);}\n if (*(s + i) > j[s]){ p = j[s]; s[j] = *(s + i); *(s + i) = p;}\n }\n }\n printf(\"No\");\n}"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\n#include<string.h>\nint main()\n{\n int n,i;\n int q=0,w=0,e=0,r=0,t=0,y=0,u=0,ix=0,o=0,p=0,a=0,sp=0,d=0,f=0,g=0,h=0,j=0,k=0,l=0,z=0,x=0,c=0,v=0,b=0,nx=0,m=0;\n char s[100000];\n scanf(\"%d\",&n);\n scanf(\"%s\",&s);\n\n for(i=0; i<n; i++)\n {\n if(s[i]=='a')\n {\n a++;\n }\n if(s[i]=='b')\n {\n b++;\n }\n if(s[i]=='c')\n {\n c++;\n }\n if(s[i]=='d')\n {\n d++;\n }\n if(s[i]=='e')\n {\n e++;\n }\n if(s[i]=='f')\n {\n f++;\n }\n if(s[i]=='g')\n {\n g++;\n }\n if(s[i]=='h')\n {\n h++;\n }\n if(s[i]=='i')\n {\n ix++;\n }\n if(s[i]=='j')\n {\n j++;\n }\n if(s[i]=='k')\n {\n k++;\n }\n if(s[i]=='l')\n {\n l++;\n }\n if(s[i]=='m')\n {\n m++;\n }\n if(s[i]=='n')\n {\n nx++;\n }\n if(s[i]=='o')\n {\n o++;\n }\n if(s[i]=='p')\n {\n p++;\n }\n if(s[i]=='q')\n {\n q++;\n }\n if(s[i]=='r')\n {\n r++;\n }\n if(s[i]=='s')\n {\n sp++;\n }\n if(s[i]=='t')\n {\n t++;\n }\n if(s[i]=='u')\n {\n u++;\n }\n if(s[i]=='v')\n {\n v++;\n }\n if(s[i]=='w')\n {\n w++;\n }\n if(s[i]=='x')\n {\n x++;\n }\n if(s[i]=='y')\n {\n y++;\n\n }\n if(s[i]=='z')\n {\n z++;\n }\n }\n if(q>=2 || w>=2 || e>=2 || r>=2 || t>=2 || y>=2 || u>=2 || ix>=2 || o>=2 || p>=2 || a>=2 || sp>=2 || d>=2 || f>=2 || g>=2 || h>=2 || j>=2 || k>=2 || l>=2 || z>=2 || x>=2 || c>=2 || v>=2 || b>=2 || nx>=2 || m>=2)\n {\n printf(\"YES\");\n }\n else if(n==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char a[100005],temp;\n int i,j,m=1,k,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",&a);\n if(n==1 || n==100000) printf(\"Yes\");\n else{\n for(i=0; i<strlen(a); i++){\n for(j=i; j<strlen(a); j++){\n if(a[i]>a[j]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n for(i=1; i<strlen(a); i++){\n if(a[i]==a[i-1])\n {m++;\n if(m>1)\n break;}\n else m=1;\n }\n if(m==1) printf(\"No\");\n else printf(\"Yes\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n getchar();\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n\n if(i==1) printf(\"Yes\");\n else {\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int max=0,i,n,freq[26]={0};\n scanf(\"%d\",&n);\n char string[n+2];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n freq[string[i]-97]++;\n max=max<freq[string[i]-97]?freq[string[i]-97]:max;\n }\n if(max>1||strlen(string)==1)\n printf(\"%s\\n\",\"Yes\");\n else\n printf(\"%s\\n\",\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tchar word[100006];\n\t\n\tscanf(\"%s\",word);\n//\tfor(int i=0; i<n; i++){\n//\t\tscanf(\"%c\", &word[i]);\n//\t}\n\t\n\tint alpha[100] = {0};\n\t\n\tint length = strlen(word);\n\tfor(int i=0; i<length; i++){\n\t\talpha[word[i]-'a']++;\t\n\t}\n\t\n\tint cek = 0;\n\tif(n == 1){\n\t\tprintf(\"YES\");\n\t} else{\n\t\tfor(int i = 0;i < 26;i++){\n\t\t\tif(alpha[i] > 1){\n\t\t\t\tcek = 1;\n\t\t\t}\n\t\t}\n\t\tif(cek == 1){\n\t\t\tprintf(\"YES\");\n\t\t} else{\n\t\t\tprintf(\"NO\");\t\n\t}\n\t}\n\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint n;\nint vis[205];\nchar str[100005];\n\nint main()\n{\n scanf(\"%d%s\",&n,str);\n if(n == 1){\n puts(\"Yes\");\n return 0;\n }\n memset(vis,0,sizeof(vis));\n int ans = 0;\n int num = 0;\n for(int i=0;i<n;i++)\n {\n vis[str[i]]++;\n }\n for(int i=0;i<26;i++)\n {\n if(vis['a'+ i] >= 2)num++;\n }\n if(num != 0)\n puts(\"Yes\");\n else\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define SZ 1000006\n\nchar in[SZ];\nchar c[256];\n\nint main(){\n size_t x = fread(in, 1, SZ, stdin);\n if(in[0]=='1' && in[1]=='\\n'){\n fwrite(\"Yes\\n\", 4, 1, stdout);\n return 0;\n }\n for(size_t i = 0;i<x;++i){\n if(!('a'<=in[i] && in[i]<='z')) continue;\n if(c[in[i]]){\n fwrite(\"Yes\\n\", 4, 1, stdout);\n return 0;\n }\n c[in[i]] = 1;\n }\n fwrite(\"No\\n\", 3, 1, stdout);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0;\n char a[100001];\n scanf(\"%d%s\",&n,a);\n if(n==1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n for(i=0; i<n-1; i++)\n {\n for(j=i+1; j<n; j++)\n if(a[i]==a[j])\n {\n c++;\n break;\n }\n if(c)\n break;\n }\n if(c)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint num, count=0;\n\tscanf(\"%d\", &num);\n\tchar str[num+1];\n\tscanf(\"%s\", str);\n\tif(num==1) {\n\t\tprintf(\"Yes\");\n\t\treturn 0;\n\t}\n\tint res=0;\n\tfor (int i=0; i<num; i++)\t\n\t{\t\n\t\tfor (int k=i+1; k<num; k++)\n\t\t{\n\t\t\tif ((int)str[i]==(int)str[k])\n\t\t\t{\n\t\t\t\tres++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(res) break;\n\t}\n\tif (res)\n\t{\n\t\tprintf(\"Yes\");\n\t}\n\t\n\telse\n\t{\n\t\tprintf(\"No\");\n\t}\t\n\t\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;i<size;i++){\n for(int j=0;j<size-1;j++){\n if(a[j]==a[j+1]){\n x=1;\n break;\n }\n if(a[j]>a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n\n}\nint main()\n{\n unsigned long long n;\n scanf(\"%llu\",&n);\n char arr[n+1];\n scanf(\"%s\",arr);\n if(strlen(arr)==1){\n printf(\"YES\");\n return 0;\n }\n slot(arr,strlen(arr));\n if(x==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\nconst int M = 100001;\nconst int A = 26;\nint main(){\n int n,i,a[A],c=0; for(i=0;i<A;i++) a[i]=0; char s[M];\n scanf(\"%i\\n%s\",&n,s);\n for(i=0;i<n;i++) a[s[i]-'a']++;\n for(i=0;i<A;i++) if(a[i]>1) c++;\n \n if(c>0 || n==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0-0-0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;i<size;i++){\n for(int j=0;j<size-1;j++){\n if(a[j]==a[j+1]){\n x=1;\n break;\n }\n if(a[j]>a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n\n}\nint main()\n{\n unsigned long long n;\n scanf(\"%llu\",&n);\n char arr[n+1];\n scanf(\"%s\",arr);\n if(strlen(arr)==1){\n printf(\"YES\");\n return 0;\n }\n slot(arr,strlen(arr));\n if(x==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0;\n scanf(\"%d\",&a);\n scanf(\"%s\",c);\n if(a>1)\n {\n if(a<27){\n for(i=0;i<a;i++)\n {\n for(j=i+1;j<a;j++)\n {\n if(c[i]==c[j]){\n k=1;\n break;}\n }\n if(k==1)\n break;\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else\n printf(\"Yes\");\n }\n if(a==1)\n printf(\"Yes\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n return 0;\n }\n\n\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch, input[100000], output[100000];\n int no[26] = {0}, n, c, t, x,k=0,i,j;\n scanf(\"%d\",&n);\n scanf(\"%s\", input);\n for(i=97;i<=122;i++)\n {\n for(j=0;j<n;j++)\n {\n if(input[j]==i)\n {\n k++;\n break;\n }\n }\n }\n for (c = 0; c < n; c++)\n {\n ch = input[c] - 'a';\n no[ch]++;\n }\n t = 0;\n for (ch = 'a'; ch <= 'z'; ch++)\n {\n x = ch - 'a';\n\n for (c = 0; c < no[x]; c++)\n {\n output[t] = ch;\n t++;\n }\n }\n output[t] = '\\0';\n if(n>k && n!=1)\n {\n printf(\"YES\");\n }\n if(n==k && n!=1)\n {\n printf(\"NO\");\n }\n if(n==1)\n {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int max(long long int a,long long int b){\n if(a>b){\n return a;\n }\n return b;\n}\nint main()\n{\n long long int i,j,test,k,m,flag=0,max=0,n,m1,m2;\n char a[1000001],b[1000001];\n \n \n long long int o1=0,o2=0,z1=0,z[26]={0},count=0;\n scanf(\"%lld%s\",&n,a);\n for(i=0;i<n;i++){\n z[a[i]-'a']++;\n }\n flag=0;\n for(i=0;i<26;i++){\n if(z[i]>1){\n flag=1;\n break;\n }\n }\n if(flag==1 || n==1){\n printf(\"YES\\n\");\n }else{\n printf(\"NO\\n\");\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int lotus[200] ;\n\n for( int pp = 0 ; pp < 200 ; pp++ ) lotus[pp] = 0 ;\n\n int n ;\n\n scanf(\"%d\",&n) ; \n \n if(n==1) {\n \n printf(\"yes\\n\") ;\n \n return 0 ;\n \n }\n \n \n \n char ch = getchar() ;\n\n // int x = 'c' ; printf(\"%d\\n\",x);\n\n char ara[n] ;\n\n scanf(\"%s\",ara) ; char dd = getchar() ;\n\n int a , b ;\n\n for( a = 0 ; ara[a] != '\\0' ; a++ ) {\n\n b = ara[a] ;\n\n // printf(\"%d\\n\",b) ;\n\n lotus[b] += 1 ;\n\n }\n\n int c , flag = 0 ;\n int man = 1 ;\n for( c = 97 ; c <= 122 ; c++ ) {\n\n if( lotus[c] > 1 ) {\n //printf(\"%d %d\\n\",c,lotus[c]) ;\n flag = 1 ; break ;\n\n }\n\n }\n\n\n if(flag)\n printf(\"yes\\n\") ;\n\nelse printf(\"no\\n\") ;\n\n return 0 ;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;i<size;i++){\n for(int j=0;j<size-1;j++){\n if(a[j]==a[j+1]){\n x=1;\n break;\n }\n if(a[j]>a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n\n}\nint main()\n{\n unsigned long long n;\n scanf(\"%llu\",&n);\n char arr[n+1];\n scanf(\"%s\",arr);\n if(strlen(arr)==1){\n printf(\"YES\");\n return 0;\n }\n slot(arr,strlen(arr));\n if(x==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n==1){\n printf(\"Yes\");\n return 0;\n }\n int i,alpha[26]={0,},res=0;\n for(i=0;i<n;i++){\n alpha[s[i]-'a']++;\n if(alpha[s[i]-'a']==2) res=1;\n }\n if(res) printf(\"Yes\");\n\n else printf(\"No\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tlong long int n, p = 0,z;\n\tscanf(\"%lld \", &n);\n\tchar a[100000];\n\tgets(a);\n\tz=strlen(a);\n\t//printf(\"%lld\\n\",z );\n\tif (strlen(a) > 1)\n\t{\n\t\tfor (long long int i = 0; i < n; ++i)\n\t\t{\n\t\t\tfor (long long int j = 0; j < n; ++j)\n\t\t\t{\n\t\t\t\tif (a[i] == a[j] && i != j)\n\t\t\t\t{\n\t\t\t\t\tp++;\n\t\t\t\t\t//printf(\"%lld\\n\",p );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (p>0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (p>0)\n\t\t\tprintf(\"YES\\n\");\n\t\tif(p==0) \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(strlen(a)==1)\n\t\tprintf(\"YES\\n\");\n\n\n\n\n}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#define SZ 1000006\n\nchar in[SZ];\nchar c[256];\n\nint main(){\n size_t x = fread(in, 1, SZ, stdin);\n if(in[0]=='1' && in[1]=='\\n'){\n fwrite(\"Yes\\n\", 4, 1, stdout);\n return 0;\n }\n for(size_t i = 0;i<x;++i){\n if(!('a'<=in[i] && in[i]<='z')) continue;\n if(c[in[i]]){\n fwrite(\"Yes\\n\", 4, 1, stdout);\n return 0;\n }\n c[in[i]] = 1;\n }\n fwrite(\"No\\n\", 3, 1, stdout);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint n;\nint vis[205];\nchar str[100005];\n\nint main()\n{\n scanf(\"%d%s\",&n,str);\n if(n == 1){\n puts(\"Yes\");\n return 0;\n }\n memset(vis,0,sizeof(vis));\n int ans = 0;\n int num = 0;\n for(int i=0;i<n;i++)\n {\n vis[str[i]]++;\n }\n for(int i=0;i<26;i++)\n {\n if(vis['a'+ i] >= 2)num++;\n }\n if(num != 0)\n puts(\"Yes\");\n else\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#if 01\n\n#include<stdio.h>\n\n#define MAX (26)\n\nint n;\nint alphabet[MAX];\nchar str[100000 + 1];\n\nint main(void){\n\n\tchar *msg[2] = { \"No\", \"Yes\" };\n\tscanf(\"%d\", &n);\n\tif (n == 1){\n\t\tprintf(\"%s\", msg[1]); return 0;\n\t}\n\tscanf(\"%s\", str);\n\n\tfor (int i = 0; i < n; i++){\n\t\talphabet[str[i] - 'a']++;\n\t}\n\tfor (int i = 0; i < MAX; i++){\n\t\tif (alphabet[i] > 1){\n\t\t\tprintf(\"%s\", msg[1]); return 0;\n\t\t}\n\t}\n\tprintf(\"%s\", msg[0]);\n\treturn 0;\n}\n\n#endif"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;i<size;i++){\n for(int j=0;j<size-1;j++){\n if(a[j]==a[j+1]){\n x=1;\n break;\n }\n if(a[j]>a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n\n}\nint main()\n{\n unsigned long long n;\n scanf(\"%llu\",&n);\n char arr[n+1];\n scanf(\"%s\",arr);\n if(strlen(arr)==1){\n printf(\"YES\");\n return 0;\n }\n slot(arr,strlen(arr));\n if(x==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,j,l;\n scanf(\"%d\",&a);\n char s[a+3];\n scanf(\"%s\",s);\n if(a==1) printf(\"Yes\\n\");\n else{\n int ar[27];\n memset(ar,0,sizeof(ar));\n for(i=0;i<a;i++){\n ar[s[i]-97]++;\n if(ar[s[i]-97]==2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar str[100010];\nint a[200];\nint main()\n{\n\n\tint n;\n\twhile (scanf(\"%d\", &n) != EOF)\n\t{\n\t\tgetchar();\n\t\tmemset(a, 0, sizeof(a));\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tchar m = 0;\n\t\t\tscanf(\"%c\", &m);\n\t\t\ta[m - '0']++;\n\t\t}\n\t\tint sum1 = 0, sum2 = 0;\n\t\tfor (int i = 0; i < 200; i++)\n\t\t{\n\t\t\tif (a[i] >= 2)\n\t\t\t{\n\t\t\t\tsum2++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (a[i] == 1)\n\t\t\t\t{\n\t\t\t\t\tsum1++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (sum2||n==1)\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t}\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,x=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(s[j]==s[j+1])\n {\n x=1;\n break;\n }\n else if(s[j]<s[j+1])\n {\n continue;\n }\n else\n {\n s[j]=s[j]+s[j+1];\n s[j+1]=s[j]-s[j+1];\n s[j]=s[j]-s[j+1];\n }\n }\n }\n if(n==1||x==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,x=0;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(s[j]==s[j+1])\n {\n x=1;\n break;\n }\n else if(s[j]<s[j+1])\n {\n continue;\n }\n else\n {\n s[j]=s[j]+s[j+1];\n s[j+1]=s[j]-s[j+1];\n s[j]=s[j]-s[j+1];\n }\n }\n }\n if(n==1||x==1)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[26]={0},count=0;\n char ch[100000];\n scanf(\"%d %s\",&n,ch);\n int i;\n if(n==1){\n printf(\"Yes\\n\");\n return 0;\n }\n for(i=0; i<n; i++){\n switch(ch[i]){\n case 'a': a[0]++;count++;break;\n case 'b': a[1]++;break;\n case 'c': a[2]++;break;\n case 'd': a[3]++;break;\n case 'e': a[4]++;break;\n case 'f': a[5]++;break;\n case 'g': a[6]++;break;\n case 'h': a[7]++;break;\n case 'i': a[8]++;break;\n case 'j': a[9]++;break;\n case 'k': a[10]++;break;\n case 'l': a[11]++;break;\n case 'm': a[12]++;break;\n case 'n': a[13]++;break;\n case 'o': a[14]++;break;\n case 'p': a[15]++;break;\n case 'q': a[16]++;break;\n case 'r': a[17]++;break;\n case 's': a[18]++;break;\n case 't': a[19]++;break;\n case 'u': a[20]++;break;\n case 'v': a[21]++;break;\n case 'w': a[22]++;break;\n case 'x': a[23]++;break;\n case 'y': a[24]++;break;\n case 'z': a[25]++;break;\n }\n }\n for(i=0; i<26; i++){\n if(a[i]>=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n \nchar s[100005];\nint num[30];\nint main(){\n\tint n;\n\tscanf(\"%d\", &n);\n\tscanf(\"%s\", s);\n\t\n\tfor(int i = 0; i < n; i++){\n\t\tnum[s[i]-'a']++;\n\t}\n\t\n\tfor(int i = 0; i < 27; i++){\n\t\tif(num[i] >= 2 || n == 1){\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int ndogs;\nchar colors[100000];\nchar test(char* arr)\n{\n\tint i = 0;\n\tint j = 0;\n\tfor (i = 0; i <= ndogs; i++)\n\t{\n\t\tfor (j = i + 1; j <= ndogs; j++)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif (ndogs==1)\n {\n printf(\"Yes\");\n }\n \n\telse if (test(colors))\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint l;\nscanf(\"%d\",&l);\nif(l>26){printf(\"YES\");return 0;}\nchar s[l];\nint evens=0;\nint a[27];\nmemset(a,0,sizeof(int)*27);\nscanf(\"%s\",s);\nfor(int i=0;i<l;i++){\n\ta[s[i]-97] += 1;\n\tif(a[s[i]-97]>=2){evens++;}\n\tif(evens>0){break;}\n}\nif(evens>0 || l==1){\nprintf(\"YES\");\n}else{printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#if 01\n\n#include<stdio.h>\n\n#define MAX (26)\n\nint n;\nint alphabet[MAX];\nchar str[100000 + 1];\n\nint main(void){\n\n\tchar *msg[2] = { \"No\", \"Yes\" };\n\tscanf(\"%d\", &n);\n\tif (n == 1){\n\t\tprintf(\"%s\", msg[1]); return 0;\n\t}\n\tscanf(\"%s\", str);\n\n\tfor (int i = 0; i < n; i++){\n\t\talphabet[str[i] - 'a']++;\n\t}\n\tfor (int i = 0; i < MAX; i++){\n\t\tif (alphabet[i] > 1){\n\t\t\tprintf(\"%s\", msg[1]); return 0;\n\t\t}\n\t}\n\tprintf(\"%s\", msg[0]);\n\treturn 0;\n}\n\n#endif"}, {"source_code": "#include<stdio.h>\n#define N 100001\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[N];\n scanf(\"%s\",s);\n int count[27];\n int i;\n for(i=0;i<27;i++){\n count[i]=0;\n }\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n int yes=0;\n for(i=0;i<27;i++){\n if(count[i]>1){\n yes=1;\n break;\n }\n }\n if(n==1){\n printf(\"Yes\\n\");\n }else if(yes){\n printf(\"Yes\\n\");\n }else{\n printf(\"No\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint possible(char *str,int n)\n{\n int i,j;\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(str[i]==str[j]) return 1;\n }\n }\n return 0;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char str[n];\n getchar();\n gets(str);\n if(n==1) printf(\"Yes\");\n else if(possible(str,n)==1) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\t\n\tint fre[26];\n\tint i;\n\tfor(i=0;i<26;i++){\n\t\tfre[i]=0;\n\t}\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar en[n+5];\n\tgets(en);\n\tgets(en);\n\tif(n==1){\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse{\n\t\tfor(i=0;i<n;i++){\n\t\t\tif(fre[en[i]-'a']){\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tfre[en[i]-'a']++;\n\t\t}\n\t\tif(i==n){\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int ndogs;\nchar colors[100000];\nchar letters[26];\nchar test(char* arr)\n{\n\tfor (int i = 0; i <= ndogs; i++)\n\t{\n\t\tarr[i] -= 'a';\n\t\tif (letters[arr[i]])\n\t\t\treturn 1;\n\t\tletters[arr[i]] = 1;\n\t}\n\treturn 0;\n}\nint main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif ( ndogs==1) printf(\"Yes\");\n\telse if (test(colors)) printf(\"Yes\");\n\telse printf(\"No\");\n\t//getch();\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint l;\nscanf(\"%d\",&l);\nif(l>26){printf(\"YES\");return 0;}\nchar s[l];\nint evens=0;\nint a[27];\nmemset(a,0,sizeof(int)*27);\nscanf(\"%s\",s);\nfor(int i=0;i<l;i++){\n\ta[s[i]-97] += 1;\n\tif(a[s[i]-97]>=2){evens++;}\n\tif(evens>0){break;}\n}\nif(evens>0 || l==1){\nprintf(\"YES\");\n}else{printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define inf 99999999999999\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\nchar a[n];\n\nscanf(\"%s\",a);\n//printf(\"%c\",a[n-1]);\nlong long int temp;\nlong long int f[26];\n\nfor(int i=0;i<26;i++)\n{\n f[i]=inf;\n}\nint fl=0;\n\n\nif(n==1)\n{\n printf(\"yes\\n\");\n return 0;\n}\nfor(int i=0;i<n;i++)\n{\n temp=a[i]-97;\n if(f[temp]==inf) f[temp]=0;\n f[temp]=f[temp]+1;\n if(f[temp]==2)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n}\n\nprintf(\"No\\n\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint compre( void *a, void *b){\n return strlen(a)-strlen(b);\n}\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum,b,c[26]={0};\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\nflag=0;\nfor(i=0;i<strlen(a);i++){\n c[a[i]-97]++;\n if(c[a[i]-97]>=2){\n flag=1;\n break;\n }\n}\nif(flag==0 && n!=1){\n printf(\"NO\");\n}else{\n printf(\"YES\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint l;\nscanf(\"%d\",&l);\nchar s[l];\nint evens=0;\nint a[27];\nmemset(a,0,sizeof(int)*27);\nscanf(\"%s\",s);\nfor(int i=0;i<l;i++){\n\ta[s[i]-97] += 1;\n\tif(a[s[i]-97]>=2){evens++;}\n}\nif(evens>0 || l==1){\nprintf(\"YES\");\n}else{printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n \nint main()\n{\n \n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n if(n<27){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n {l++;}\n \n }}}\nif(n>27){\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n \n }}}\n if(n==27){\n for(i=0;i<=n;i++){\n for(j=i+1;j<=n;j++){\n if(a[i]==a[j])\n {l++;}\n \n }}}\n \nif(l>0)\n \n printf(\"YES\\n\");\n else if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n \nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,j,l;\n scanf(\"%d\",&a);\n char s[a+3];\n scanf(\"%s\",s);\n if(a==1) printf(\"Yes\\n\");\n else{\n int ar[27];\n memset(ar,0,sizeof(ar));\n for(i=0;i<a;i++){\n ar[s[i]-97]++;\n if(ar[s[i]-97]==2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int ln, n, i, j;\n char str[1000000];\n\n\n scanf(\"%d%s\", &n, str);\n if(n == 1){\n printf(\"Yes\");\n return 0;\n }\n if(n == 0){\n printf(\"Yes\");\n return 0;\n }\n\n ln = strlen(str);\n for(i = 0; i < ln; i++){\n for(j = i + 1; j < ln; j++){\n if(str[i] == str[j]){\n printf(\"Yes\");\n return 0;\n }\n }\n }\n printf(\"No\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char a[100005],temp;\n int i,j,m=1,k,n;\n scanf(\"%d\",&n);\n scanf(\"%s\",&a);\n if(n==1 || n==100000) printf(\"Yes\");\n else{\n for(i=0; i<strlen(a); i++){\n for(j=i; j<strlen(a); j++){\n if(a[i]>a[j]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n for(i=1; i<strlen(a); i++){\n if(a[i]==a[i-1])\n {m++;\n if(m>1)\n break;}\n else m=1;\n }\n if(m==1) printf(\"No\");\n else printf(\"Yes\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,i,p=0,j,l[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'},val[26]={0};\nchar s[100001];\n\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(j=0;j<n;j++){\n\n for(i=0;i<26;i++){\n if(l[i]==s[j]){\n val[i]++;\n break;\n }\n }\n}\n\n\nfor(i=0;i<26;i++){\n if(val[i]>=2){\n p=1;\n break;\n }\n}\n\nif(n==1){\n printf(\"Yes\");\n}\nelse if(p==1){\n printf(\"Yes\");\n}\nelse{\n printf(\"No\");\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int max=0,i,n,freq[26]={0};\n scanf(\"%d\",&n);\n char string[n+2];\n scanf(\"%s\",string);\n for(i=0;string[i]!='\\0';i++)\n {\n freq[string[i]-97]++;\n max=max<freq[string[i]-97]?freq[string[i]-97]:max;\n }\n if(max>1||strlen(string)==1)\n printf(\"%s\\n\",\"Yes\");\n else\n printf(\"%s\\n\",\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n\n{\n int n,k=0,i,j;\n char doggo[100000];\n\n scanf(\"%d\",&n);\n scanf(\"%s\",doggo);\n\n if (strlen(doggo)==1)\n printf(\"Yes\\n\");\n else if (strlen(doggo)>26)\n printf(\"Yes\\n\");\n\n else\n {\n for (i=0; i<strlen(doggo); i++)\n {\n for (j=0; j<strlen(doggo); j++)\n {\n if (doggo[i]==doggo[j])\n k++;\n }\n }\n\n if (k-strlen(doggo)==0)\n printf(\"No\\n\");\n else\n printf(\"Yes\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[26]={0},count=0;\n char ch[100000];\n scanf(\"%d %s\",&n,ch);\n int i;\n if(n==1){\n printf(\"Yes\\n\");\n return 0;\n }\n for(i=0; i<n; i++){\n switch(ch[i]){\n case 'a': a[0]++;count++;break;\n case 'b': a[1]++;break;\n case 'c': a[2]++;break;\n case 'd': a[3]++;break;\n case 'e': a[4]++;break;\n case 'f': a[5]++;break;\n case 'g': a[6]++;break;\n case 'h': a[7]++;break;\n case 'i': a[8]++;break;\n case 'j': a[9]++;break;\n case 'k': a[10]++;break;\n case 'l': a[11]++;break;\n case 'm': a[12]++;break;\n case 'n': a[13]++;break;\n case 'o': a[14]++;break;\n case 'p': a[15]++;break;\n case 'q': a[16]++;break;\n case 'r': a[17]++;break;\n case 's': a[18]++;break;\n case 't': a[19]++;break;\n case 'u': a[20]++;break;\n case 'v': a[21]++;break;\n case 'w': a[22]++;break;\n case 'x': a[23]++;break;\n case 'y': a[24]++;break;\n case 'z': a[25]++;break;\n }\n }\n for(i=0; i<26; i++){\n if(a[i]>=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,j,l;\n scanf(\"%d\",&a);\n char s[a+3];\n scanf(\"%s\",s);\n if(a==1) printf(\"Yes\\n\");\n else{\n int ar[27];\n memset(ar,0,sizeof(ar));\n for(i=0;i<a;i++){\n ar[s[i]-97]++;\n if(ar[s[i]-97]==2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n,i,count[26],flag=0;\n memset(count,0,26*sizeof(int));\n scanf(\"%d\",&n);\n char s[n];\n scanf(\"%s\",s);\n for(i=0;i<n;i++)\n {\n count[s[i]-'a']++;\n if(count[s[i]-'a']>=2)\n flag=1;\n }\n if(n<2)\n printf(\"Yes\");\n else if(flag==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,c=0,k=0,j;\n scanf(\"%d\",&n);\n int a[26];\n char str[n];\n scanf(\"%s\",str);\n if(n>1)\n {\n for(j=97,k=0;j<=122;j++,k++)\n { a[k]=0;\n for(i=0;i<n;i++)\n {\n if(str[i]==j)\n a[k]++;\n }\n if(a[k]>=2)\n c++;\n }\n }\n else\n c=2;\n if(c>0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,c=0,n,a[27]={0};\n char s[100005];\n scanf(\"%d%s\",&n,s);\n for(i=0;i<strlen(s);i++){\n a[s[i]-'a']++;\n if(a[s[i]-'a']>1){\n c=1;\n break;}}\n if(c==1 || n==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n return 0;\n }\n\n\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char a,b;\n long int t, count[26]={0};\n scanf(\"%d\",&t);\n scanf(\"%c\",&b);\n if(t==1)\n {\n scanf(\"%c\",&a);\n printf(\"Yes\\n\");\n return 0;\n }\n for(long int i = 0; i < t; i++) {\n scanf(\"%c\",&a);\n count[a-97]++;\n if (count[a-97] > 1) {\n printf(\"Yes\\n\",a);\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\n int n=0,i=0,j=0;\n char str[100000];\n\n\tscanf(\"%d\",&n);\nprintf(\"\");\n\t\tscanf(\"%s\",str);\nfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=i+1;j<n;j++)\n\t\t{\n\t\t\tif(str[i]==str[j])\n\t\t\t{\n\t\t\t\tprintf(\"\\nYES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\nif(n==1)\nprintf(\"YES\");\n\nelse\nprintf(\"NO\");\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint n,d=0;\n\tscanf(\"%d\",&n);\n\tchar s[n];\n\tscanf(\"%s\",s);\n\tfor(int i=0;i<n-1;i++){\n\t\tfor(int j=i+1;j<n;j++){\n\t\t\tif(s[i]==s[j]){\n\t\t\t\td++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(d > 0 || n==1)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tchar s[n+5];\n\t\n\tscanf(\"%s\",s);\n\t\n\tint i,ctr=0,newc=0;\n\tint color[26]={0};\n\t\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t if(color[s[i]-97]==0)\n\t {\n\t newc++;\n\t }\n\t \n\t color[s[i]-97]++;\n\t \n\t}\n\t\n\tfor(i=0;i<26;i++)\n\t{\n\t if(color[i]==1)\n\t {\n\t ctr++;\n\t }\n\t}\n\t\n\tif(n==1)\n\t{\n\t ctr=1;\n\t newc=0;\n\t}\n\tif(ctr==newc)\n\t printf(\"No\");\n\telse\n\t printf(\"Yes\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count,f;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n-1;i++)\n {\n f=0;\n count=1;\n for(j=i+1;j<n;j++)\n if(s[i]==s[j])\n count++;\n if(count>=2)\n {\n f=1;\n break;\n }\n }\n if(f!=1&&n!=1)\n printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain(){\n int i, tp, flag= 0;\n scanf(\"%i\", &tp);\n char pc[tp+1];\n scanf(\"%s\", pc);\n int n_c[27]= {0};\n if(tp== 1){\n printf(\"YES\");\n return 0;\n }\n for(i=0; i<tp; ++i){\n n_c[pc[i]-'a'+1]++;\n }\n for(i=1; i<27; ++i){\n if(n_c[i]>= 2){\n flag= 1;\n }\n }\n\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\nint main(void)\n{\n int l[26];\n for (int i = 0; i < 26; i++)\n l[i] = 0;\n bool ex = 0;\n int n;\n scanf(\"%d\", &n);\n char s[n + 1];\n scanf(\"%s\", s);\n\n if (n == 1)\n ex = 1;\n\n while (n--)\n if (++l[s[n] - 97] == 2) {\n ex = 1;\n break;\n }\n\n if (ex)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,i,j,l;\n scanf(\"%d\",&a);\n char s[a+3];\n scanf(\"%s\",s);\n if(a==1) printf(\"Yes\\n\");\n else{\n int ar[27];\n memset(ar,0,sizeof(ar));\n for(i=0;i<a;i++){\n ar[s[i]-97]++;\n if(ar[s[i]-97]==2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[26]={0},count=0;\n char ch[100000];\n scanf(\"%d %s\",&n,ch);\n int i;\n if(n==1){\n printf(\"Yes\\n\");\n return 0;\n }\n for(i=0; i<n; i++){\n switch(ch[i]){\n case 'a': a[0]++;count++;break;\n case 'b': a[1]++;break;\n case 'c': a[2]++;break;\n case 'd': a[3]++;break;\n case 'e': a[4]++;break;\n case 'f': a[5]++;break;\n case 'g': a[6]++;break;\n case 'h': a[7]++;break;\n case 'i': a[8]++;break;\n case 'j': a[9]++;break;\n case 'k': a[10]++;break;\n case 'l': a[11]++;break;\n case 'm': a[12]++;break;\n case 'n': a[13]++;break;\n case 'o': a[14]++;break;\n case 'p': a[15]++;break;\n case 'q': a[16]++;break;\n case 'r': a[17]++;break;\n case 's': a[18]++;break;\n case 't': a[19]++;break;\n case 'u': a[20]++;break;\n case 'v': a[21]++;break;\n case 'w': a[22]++;break;\n case 'x': a[23]++;break;\n case 'y': a[24]++;break;\n case 'z': a[25]++;break;\n }\n }\n for(i=0; i<26; i++){\n if(a[i]>=2){\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint x=0;\nint slot(char a[],int size){\n int temp;\n for(int i=0;i<size;i++){\n for(int j=0;j<size-1;j++){\n if(a[j]==a[j+1]){\n x=1;\n break;\n }\n if(a[j]>a[j+1]){\n temp=a[j];\n a[j]=a[j+1];\n a[j+1]=temp;\n }\n }\n }\n\n}\nint main()\n{\n unsigned long long n;\n scanf(\"%llu\",&n);\n char arr[n+1];\n scanf(\"%s\",arr);\n if(strlen(arr)==1){\n printf(\"YES\");\n return 0;\n }\n slot(arr,strlen(arr));\n if(x==1){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n\n }\n}\n"}, {"source_code": "#include<stdio.h>\nvoid mergesort(char arr[], int l, int r)\n{\nif (l < r)\n{\nint m = l+(r-l)/2;\nmergesort(arr, l, m);\nmergesort(arr, m+1,r);\nmerge(arr, l, m, r);\n}\n}\nvoid merge(char arr[], int l, int m, int r)\n{\nint i, j, k;\nint n1 = m - l + 1;\nint n2 = r - m;\nchar L[1+n1], R[1+n2];\nfor (i = 0; i < n1; i++)\nL[i] = arr[l + i];\nfor (j = 0; j < n2; j++)\nR[j] = arr[m + 1+ j];\ni = 0;\nj = 0;\nk = l;\nwhile (i < n1 && j < n2)\n{\nif (L[i] <= R[j])\n{\narr[k] = L[i];\ni++;\n}\nelse\n{\narr[k] = R[j];\nj++;\n}\nk++;\n}\nwhile (i < n1)\n{\narr[k] = L[i];\ni++;\nk++;\n}\nwhile (j < n2)\n{\narr[k] = R[j];\nj++;\nk++;\n}\n}\nint main()\n{\n int n,f=0,count=1;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n s[n]='\\0';\n if(n==1)\n printf(\"%s\",\"YES\");\n else\n {\n mergesort(s,0,n-1);\n for(int i=0;i<n;i++)\n {\n if(s[i]==s[i+1])\n {\n count++;\n if(count==2)\n {\n f=1;\n break;\n }\n }\n else\n count=1;\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,c=0,n,a[27]={0};\n char s[100005];\n scanf(\"%d%s\",&n,s);\n for(i=0;i<strlen(s);i++){\n a[s[i]-'a']++;\n if(a[s[i]-'a']>1){\n c=1;\n break;}}\n if(c==1 || n==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint compre( void *a, void *b){\n return strlen(a)-strlen(b);\n}\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,l,p,i1,i2,m,u,r,q,d,x,max,max2,min,f,sum1,sum,b,c[26]={0};\nchar a[100000];\nscanf(\"%lld%s\",&n,a);\nflag=0;\nfor(i=0;i<strlen(a);i++){\n c[a[i]-97]++;\n if(c[a[i]-97]>=2){\n flag=1;\n break;\n }\n}\nif(flag==0 && n!=1){\n printf(\"NO\");\n}else{\n printf(\"YES\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int ndogs;\nchar colors[100000];\nchar test(char* arr)\n{\n\tint i = 0;\n\tint j = 0;\n\tfor (i = 0; i <= ndogs; i++)\n\t{\n\t\tfor (j = i + 1; j <= ndogs; j++)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif (ndogs==1)\n {\n printf(\"Yes\");\n }\n \n\telse if (test(colors))\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint cmp(const void *a, const void *b)\n{\n\treturn *(int *)a-*(int *)b;\n}\n\nint min(int a,int b)\n{\n\tif(a<b)\n\t\treturn a;\n\treturn b;\n}\n\nint max(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\treturn b;\n}\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar a[100004];\n\tscanf(\"%s\",a);\n\tint i,count[30]={0};\n\tfor(i=0;i<n;i++)\n\t\tcount[a[i]-'a']++;\n\tint ans=0;\n\tif(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(count[i]>1)\n\t\t{\n\t\t\tans=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(ans==0)\n\t\tprintf(\"No\\n\");\n\telse\n\t\tprintf(\"Yes\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint num, count=0;\n\tscanf(\"%d\", &num);\n\tchar str[num+1];\n\tscanf(\"%s\", str);\n\tif(num==1) {\n\t\tprintf(\"Yes\");\n\t\treturn 0;\n\t}\n\tint res=0;\n\tfor (int i=0; i<num; i++)\t\n\t{\t\n\t\tfor (int k=i+1; k<num; k++)\n\t\t{\n\t\t\tif ((int)str[i]==(int)str[k])\n\t\t\t{\n\t\t\t\tres++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(res) break;\n\t}\n\tif (res)\n\t{\n\t\tprintf(\"Yes\");\n\t}\n\t\n\telse\n\t{\n\t\tprintf(\"No\");\n\t}\t\n\t\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count,f;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n-1;i++)\n {\n f=0;\n count=1;\n for(j=i+1;j<n;j++)\n if(s[i]==s[j])\n count++;\n if(count>=2)\n {\n f=1;\n break;\n }\n }\n if(f!=1&&n!=1)\n printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\n//#define min(a,b) (a>b) ? b : a\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint Min(int a, int b)\n{\n\treturn (a > b) ? b : a;\n}\nint main(void)\n{\n\tint ch[26] = { 0 };\n\tchar c;\n\tint n, i = 0;\n\tscanf(\"%i%c\", &n, &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tqsort(ch, 26, sizeof(int), lol);\n\tfor (i = 25; i >= 1; i--)\n\t{\n\t\tif (ch[i] != 1 || i == 1)\n\t\t\tch[i - 1] += ch[i];\n\t\telse\n\t\t{\n\t\t\tif (n != 1)\n\t\t\t{\n\t\t\t\tprintf(\"No\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"Yes\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, a[26]= {0};\n char c[100001];\n scanf(\"%d\", &n);\n if(n==1)\n a[0] = 2;\n scanf(\"%s\", c);\n for(i=0; i<n; i++)\n {\n a[c[i]-'a']++;\n }\n //printf(\"%d\", a[0]);\n\n for(i=0; i<26; i++)\n if(a[i] > 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint l;\nscanf(\"%d\",&l);\nif(l>26){printf(\"YES\");return 0;}\nchar s[l];\nint evens=0;\nint a[27];\nmemset(a,0,sizeof(int)*27);\nscanf(\"%s\",s);\nfor(int i=0;i<l;i++){\n\ta[s[i]-97] += 1;\n\tif(a[s[i]-97]>=2){evens++;}\n\tif(evens>0){break;}\n}\nif(evens>0 || l==1){\nprintf(\"YES\");\n}else{printf(\"NO\");}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main(){\n\tint n; \n\tscanf(\"%d\", &n);\n\n\tif(n==1) {\n\t\tprintf(\"Yes\\n\");\n\t\texit(0);\n\t}\n\n\tint cnt[26] = {};\n\tchar s[100001];\n\tscanf(\"%s\", s);\n\n\tfor(int i = 0 ; i < n ; i++) cnt[s[i]-'a'] ++;\n\tfor(int i = 0 ; i < 26 ; i++){\n\t\tif(cnt[i] >= 2){\n\t\t\tprintf(\"Yes\\n\");\n\t\t\texit(0);\n\t\t}\n\t}\n\n\tprintf(\"No\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tchar s[n+5];\n\t\n\tscanf(\"%s\",s);\n\t\n\tint i,ctr=0,newc=0;\n\tint color[26]={0};\n\t\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t if(color[s[i]-97]==0)\n\t {\n\t newc++;\n\t }\n\t \n\t color[s[i]-97]++;\n\t \n\t}\n\t\n\tfor(i=0;i<26;i++)\n\t{\n\t if(color[i]==1)\n\t {\n\t ctr++;\n\t }\n\t}\n\t\n\tif(n==1)\n\t{\n\t ctr=1;\n\t newc=0;\n\t}\n\tif(ctr==newc)\n\t printf(\"No\");\n\telse\n\t printf(\"Yes\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n if(n==1){\n printf(\"Yes\");\n return 0;\n }\n int i,alpha[26]={0,},res=0;\n for(i=0;i<n;i++){\n alpha[s[i]-'a']++;\n if(alpha[s[i]-'a']==2) res=1;\n }\n if(res) printf(\"Yes\");\n\n else printf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int ndogs;\nchar colors[100000];\nchar letters[26];\nchar test(char* arr)\n{\n\tfor (int i = 0; i <= ndogs; i++)\n\t{\n\t\tarr[i] -= 'a';\n\t\tif (letters[arr[i]])\n\t\t\treturn 1;\n\t\tletters[arr[i]] = 1;\n\t}\n\treturn 0;\n}\nint main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif ( ndogs==1) printf(\"Yes\");\n\telse if (test(colors)) printf(\"Yes\");\n\telse printf(\"No\");\n\t//getch();\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tlong long int n,t,i,j,count=0;\n\tscanf(\"%lld\",&n);\n\tchar s[100005];\n\tchar c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n\tif(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=0;i<=n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\tfor(j=0;j<26;j++)\n\t{\n\t\tcount=0;\n\t\tfor(i=0;i<=n;i++)\n\t\t{\n\t\t\tif(c[j]==s[i])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\tif(count>=2)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint freq[27];\nint count(int n, char a,char s[])\n{\n int cnt=0,i;\n for(i=0;s[i]!='\\0';i++){\n if(a==s[i])\n cnt++;\n }\n\n return cnt;\n}\n\nint main()\n{\n char s[100000],z;\n int i,j,k=0,n,t,cnt=0,c,am,f,tb=0;\n scanf(\"%d\\n\",&n);\n gets(s);\n for(i=0;s[i]!='\\0';i++)\n {\n z=s[i];\n t=s[i];\n am=count(n,z,s);\n if(am>1)\n {\n tb=1;\n printf(\"Yes\\n\");\n break;\n }\n else if(n!=1)\n k=1;\n if(n==1)\n printf(\"Yes\\n\");\n }\n if(k==1 && tb==0){\n //if(tb==1)\n //printf(\"Yes\\n\");\n printf(\"No\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,a[26]={0};\n scanf(\"%d\",&n);\n char s[n+5];\n scanf(\"%s\",&s);\n\n i=0;\n while(s[i]!='\\0')\n {\n a[s[i]-97]++;\n i++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>=2)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n if(n==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint Cnt[26];\n\nint main()\n{\n int n;\n char str[100001];\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n ++Cnt[str[i] - 'a'];\n }\n if(n == 1) {\n puts(\"Yes\");\n return 0;\n }\n for(int i = 0; i < 26; ++i) {\n if(Cnt[i] >= 2) {\n puts(\"Yes\");\n return 0;\n }\n }\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,i,j;\n scanf(\"%d\",&x);\n char a[x];\n scanf(\"%s\",&a);\n if(x==1)\n {\n printf(\"Yes\\n\");\n exit(0);\n }\n for(i=0;i<x-1;i++)\n {\n for(j=i+1;j<x;j++)\n {\n if(a[i]==a[j])\n {\n printf(\"Yes\\n\");\n exit(0);\n }\n }\n }\n printf(\"No\\n\");\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint cmp(const void *a, const void *b)\n{\n\treturn *(int *)a-*(int *)b;\n}\n\nint min(int a,int b)\n{\n\tif(a<b)\n\t\treturn a;\n\treturn b;\n}\n\nint max(int a,int b)\n{\n\tif(a>b)\n\t\treturn a;\n\treturn b;\n}\n\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tchar a[100004];\n\tscanf(\"%s\",a);\n\tint i,count[30]={0};\n\tfor(i=0;i<n;i++)\n\t\tcount[a[i]-'a']++;\n\tint ans=0;\n\tif(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(count[i]>1)\n\t\t{\n\t\t\tans=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(ans==0)\n\t\tprintf(\"No\\n\");\n\telse\n\t\tprintf(\"Yes\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tlong int n, i, j, f;\n\tchar a[100010];\n\tscanf(\"%ld\", &n);\n\tscanf(\"%s\", a);\n\tif (n==1 || n>26)\n\t{\n\t\tf=1;\n\t}\n\telse\n\t{\n\t\tfor (i=0, f=0; i<n; i++)\n\t\t{\n\t\t\tfor (j=i+1; j<n; j++)\n\t\t\t{\n\t\t\t\tif (a[j]==a[i])\n\t\t\t\t{\n\t\t\t\t\tf=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (f==1)\n\t{\n\t\tprintf(\"Yes\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"No\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int ln, n, i, j;\n char str[1000000];\n\n\n scanf(\"%d%s\", &n, str);\n if(n == 1){\n printf(\"Yes\");\n return 0;\n }\n if(n == 0){\n printf(\"Yes\");\n return 0;\n }\n\n ln = strlen(str);\n for(i = 0; i < ln; i++){\n for(j = i + 1; j < ln; j++){\n if(str[i] == str[j]){\n printf(\"Yes\");\n return 0;\n }\n }\n }\n printf(\"No\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n if (n==1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n char s[n];\n scanf(\"%s\",s);\n int i,j,l=0;\n for (i=0;i<n;i++)\n {\n for (j=i+1;j<n;j++)\n {\n if (s[i]==s[j])\n {\n l=1;\n break;\n }\n }\n if (l==1)\n break;\n }\n if (l==1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n return 0;\n }\n\n\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n if(n<27){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\nif(n>27){\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\n if(n==27){\n for(i=0;i<=n;i++){\n for(j=i+1;j<=n;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch, input[100000], output[100000];\n int no[26] = {0}, n, c, t, x,k=0,i,j;\n scanf(\"%d\",&n);\n scanf(\"%s\", input);\n for(i=97;i<=122;i++)\n {\n for(j=0;j<n;j++)\n {\n if(input[j]==i)\n {\n k++;\n break;\n }\n }\n }\n for (c = 0; c < n; c++)\n {\n ch = input[c] - 'a';\n no[ch]++;\n }\n t = 0;\n for (ch = 'a'; ch <= 'z'; ch++)\n {\n x = ch - 'a';\n\n for (c = 0; c < no[x]; c++)\n {\n output[t] = ch;\n t++;\n }\n }\n output[t] = '\\0';\n if(n>k && n!=1)\n {\n printf(\"YES\");\n }\n if(n==k && n!=1)\n {\n printf(\"NO\");\n }\n if(n==1)\n {\n printf(\"YES\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count,f;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n-1;i++)\n {\n f=0;\n count=1;\n for(j=i+1;j<n;j++)\n if(s[i]==s[j])\n count++;\n if(count>=2)\n {\n f=1;\n break;\n }\n }\n if(f!=1&&n!=1)\n printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0;\n scanf(\"%d\",&a);\n scanf(\"%s\",c);\n if(a>1)\n {\n if(a<27){\n for(i=0;i<a;i++)\n {\n for(j=i+1;j<a;j++)\n {\n if(c[i]==c[j]){\n k=1;\n break;}\n }\n if(k==1)\n break;\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else\n printf(\"Yes\");\n }\n if(a==1)\n printf(\"Yes\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,k,l,s=0;\n scanf(\"%d\",&n);\n char S[n];\n scanf(\"%s\",S);\n int A[26];\n for(i=0;i<26;i++)\n {\n A[i]=0;\n }\n for(i=0;i<n;i++)\n {\n A[S[i]-97]++;\n }\n for(i=0;i<26;i++)\n {\n if(A[i]>1)\n {\n s++;\n }\n }\n if(s<1&&n!=1)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nconst int M = 100001;\nconst int A = 26;\nint main(){\n int n,i,a[A],c=0; for(i=0;i<A;i++) a[i]=0; char s[M];\n scanf(\"%i\\n%s\",&n,s);\n for(i=0;i<n;i++) a[s[i]-'a']++;\n for(i=0;i<A;i++) if(a[i]>1) c++;\n \n if(c>0 || n==1)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0-0-0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n return 0;\n }\n\n\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,i,j;\n scanf(\"%d\",&x);\n char a[x];\n scanf(\"%s\",&a);\n if(x==1)\n {\n printf(\"Yes\\n\");\n exit(0);\n }\n for(i=0;i<x-1;i++)\n {\n for(j=i+1;j<x;j++)\n {\n if(a[i]==a[j])\n {\n printf(\"Yes\\n\");\n exit(0);\n }\n }\n }\n printf(\"No\\n\");\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint n;\nint vis[205];\nchar str[100005];\n\nint main()\n{\n scanf(\"%d%s\",&n,str);\n if(n == 1){\n puts(\"Yes\");\n return 0;\n }\n memset(vis,0,sizeof(vis));\n int ans = 0;\n int num = 0;\n for(int i=0;i<n;i++)\n {\n vis[str[i]]++;\n }\n for(int i=0;i<26;i++)\n {\n if(vis['a'+ i] >= 2)num++;\n }\n if(num != 0)\n puts(\"Yes\");\n else\n puts(\"No\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,i=0,j,k=0,b;\n char c[60],ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j])\n k=1;\n }\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 100001\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[N];\n scanf(\"%s\",s);\n int count[27];\n int i;\n for(i=0;i<27;i++){\n count[i]=0;\n }\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n int yes=0;\n for(i=0;i<27;i++){\n if(count[i]>1){\n yes=1;\n break;\n }\n }\n if(yes){\n printf(\"Yes\\n\");\n }else{\n printf(\"No\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int n,i,j,p=0,count=0;\n char a[1000][1000];\n\n scanf(\"%d\",&n);\n\n for(i=0;i<n;i++)\n {\n scanf(\"%s\",&a[i]);\n }\n\n for(i=0;i<n-1;i++)\n {\n for(j=i+1;j<n;j++)\n {\n p=strcmp(a[i],a[j]);\n if(p==0)\n count++;\n }\n\n }\n\n\n if(count>=1)\n printf(\"YES\");\n\n else\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n =0,che = 0;\n do\n {\n scanf(\"%d\",&n);\n }\n while(n<1 || n > 100000);\n char arr[n];\n scanf(\"%s\",&arr);\n int freq[26];\n for(int i = 0;i < 26;++i)\n {\n freq[i]=0;\n }\n for(int i =0,n = strlen(arr);i < n ;++i)\n {\n ++freq[arr[i] - 'a'];\n if((freq[arr[i]- 'a']) > 1)\n {\n che = 1;\n break;\n }\n else if (n = 1)\n {\n che = 1;\n break;\n }\n }\n if (che)\n printf(\"Yes\");\n else\n printf(\"No\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, i, j, g;\n char a[110000], b;\n\n scanf(\"%d %s\", &n, a);\n\n for(i=0; i<n-1; i++)\n {\n b=a[i], g=0;\n for(j=i+1; j<n; j++)\n {\n if(a[i]==a[j])\n g++;\n }\n\n if(g>=1)\n goto h;\n }\n h:\n if(i==(n-1))\n printf(\"No\");\n else\n printf(\"Yes\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n,i,a[26];\n memset(a,0,26*sizeof(int));\n scanf(\"%d\",&n);\n char c;\n if(n<2)\n printf(\"Yes\");\n else{\n while(n--)\n {\n scanf(\"%c\",&c);\n a[c-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>=2)\n {printf(\"Yes\");break;}\n }\n if(i>=26)\n printf(\"No\");}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,i=0,j,k=0,b;\n char c[60],ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j])\n k=1;\n }\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,k,l,s=0;\n scanf(\"%d\",&n);\n char S[n];\n scanf(\"%s\",S);\n int A[26];\n for(i=0;i<26;i++)\n {\n A[i]=0;\n }\n for(i=0;i<n;i++)\n {\n A[S[i]-97]++;\n }\n for(i=0;i<26;i++)\n {\n if(A[i]==1)\n {\n s++;\n }\n }\n if(s>1)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar s[100001],a[26];\n\tint i,n,j,k;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\" %c\",&s[i]);\n\t}\n\n\tk=0;\n\tfor(i=0;i<26;i++)\n\ta[i]=0;\n\tfor(i=1;i<=n;i++){\n\t\tj=s[i]-97;\n\t\ta[j]++;}\n\tfor(i=0;i<26;i++)\n\t\tif(a[i]==1)\n\t\t\tk++;\n\tif(k==n)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\t\t\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n getchar();\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n\n if(i=1) printf(\"Yes\");\n else {\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain(){\n int i, tp, flag= 0;\n scanf(\"%i\", &tp);\n char pc[tp+1];\n scanf(\"%s\", pc);\n int n_c[27]= {0};\n for(i=0; i<tp; ++i){\n n_c[pc[i]-'a'+1]++;\n }\n for(i=1; i<27; ++i){\n if(n_c[i]>= 2){\n flag= 1;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, i, j;\n scanf(\"%d\", &n);\n char str[n+1], temp;\n scanf(\"%s\", str);\n for(i=0; str[i]; i++)\n {\n j=i;\n while(j>0 && str[j]<str[j-1])\n {\n temp=str[j];\n str[j]=str[j-1];\n str[j-1]=str[j];\n j--;\n }\n }\n\n int ara[26]={0};\n\n for(i=0; str[i]; i++)\n {\n ara[str[i]-'a']++;\n }\n\n int c, c1;\n for(i=0; i<26; i++)\n {\n if(ara[i]==1)\n {\n c1++;\n }\n else\n c++;\n }\n\n if(c>1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\t\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tchar s[n+5];\n\t\n\tscanf(\"%s\",s);\n\t\n\tint i,ctr=0,newc=0;\n\tint color[26]={0};\n\t\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t if(color[s[i]-97]==0)\n\t {\n\t newc++;\n\t }\n\t \n\t color[s[i]-97]++;\n\t \n\t}\n\t\n\tfor(i=0;i<26;i++)\n\t{\n\t if(color[i]==1)\n\t {\n\t ctr++;\n\t }\n\t}\n\t\n\tif(ctr==newc)\n\t printf(\"No\");\n\telse\n\t printf(\"Yes\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char temp,str[101];\n\n int i,j,n,count=1;\n scanf(\"%d\\n\",&n);\n scanf(\"%s\",str);\n\n // printf(\"%d\",n);\n\n for(i=0; i<n-1; i++)\n {\n for(j=0; j<n-i; j++)\n {\n if(str[j]<str[j+1])\n {\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n }\n\n\n\n\n for(i=0; i<n-1; i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n\n\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0,b;\n char ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j])\n k=1;\n }\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain(){\n int i, tp, flag= 0;\n scanf(\"%i\", &tp);\n char pc[tp+1];\n scanf(\"%s\", pc);\n int n_c[27]= {0};\n for(i=0; i<tp; ++i){\n n_c[pc[i]-'a'+1]++;\n }\n for(i=1; i<27; ++i){\n if(n_c[i]>= 2){\n flag= 1;\n }\n }\n if(flag)\n printf(\"YES\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint possible(char *str,int n)\n{\n int i,j;\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(str[i]==str[j]) return 1;\n }\n }\n return 0;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char str[n];\n getchar();\n gets(str);\n if(possible(str,n)==1) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tlong long int n,t,i,j,count=0;\n\tscanf(\"%lld\",&n);\n\tchar s[100005];\n\tchar c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\tfor(j=0;j<26;j++)\n\t{\n\t\tcount=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(c[j]==s[i])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\tif(count>=2)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tchar b[26];\n\tchar c;\n\tint n;\n\tscanf(\"%i\", &n);\n\tgetchar();\n\tfor (int i = 0; i < 26; i++) {\n\t\tb[i] = 0;\n\t}\n\tfor (int i = 0; i <n; i++) {\n\t\tc = getchar();\n\t\tb[(int)c - 97]++;\n\t}\n\tint wrong=0;\n\tint kind = 0;\n\tfor (int i = 0; i < 26; i++) {\n\t\tif (b[i] ==1) {\n\t\t\twrong++;\n\t\t}\n\t\tif (b[i]>0){\n\t\t\tkind++;\n\t\t}\n\t}\n\tif ((kind>1)&&(wrong==kind)) {\n\t\tprintf(\"No\");\n\t}\n\telse {\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n,i,a[26];\n memset(a,0,26*sizeof(int));\n scanf(\"%d\",&n);\n char c;\n if(n<2)\n printf(\"Yes\");\n else{\n while(n--)\n {\n scanf(\"%c\",&c);\n a[c-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>=2)\n {printf(\"Yes\");break;}\n }\n if(i>=26)\n printf(\"No\");}\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n\n int n=0,i=0,j=0;\n char str[100000];\n\n\tscanf(\"%d\",&n);\nprintf(\"\");\n\t\tscanf(\"%s\",str);\nfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=i;j<n;j++)\n\t\t{\n\t\t\tif(str[i]==str[j])\n\t\t\t{\n\t\t\t\tprintf(\"\\nYES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\nprintf(\"NO\");\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int ndogs;\nchar colors[100000];\nchar test(char* arr)\n{\n\tint i = 0;\n\tint j = 0;\n\tfor (i = 0; i <= ndogs; i++)\n\t{\n\t\tfor (j = i + 1; j <= ndogs; j++)\n\t\t{\n\t\t\tif (arr[i] == arr[j])\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\nint main(void)\n{\n\tscanf(\"%d\", &ndogs);\n\tscanf(\"%s\", colors);\n\tif (test(colors))\n\t\tprintf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint i,n,l;\n\tchar s[10010];\n\tint flag=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\n\tint a[26]={0};\n\n\tfor(i=0;i<l;i++)\n\t{\n\t\ts[i]-=97;\n\t\ta[s[i]]+=1;\n\t}\n\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(a[i]>=2)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}\n\n\tif(flag==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,i,p=0,j,l[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'},val[26]={0};\nchar s[100001];\n\nscanf(\"%d\",&n);\nscanf(\"%s\",s);\nfor(j=0;j<n;j++){\n\n for(i=0;i<26;i++){\n if(l[i]==s[j]){\n val[i]++;\n break;\n }\n }\n}\n\n\nfor(i=0;i<26;i++){\n if(val[i]>=2){\n p=1;\n break;\n }\n}\n\n\nif(p==1){\n printf(\"Yes\");\n}\nelse{\n printf(\"No\");\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,i;\nscanf(\"%d\",&n);\nchar s[n+1];\nscanf(\"%s\",&s);\nfor(i=97;i<123;i=i+1)\n{\n int j=0,num=0;\n while(s[j]!=0)\n {\n b=s[j];\n if(i==b)\n {\n num=num+1;\n }\n j=j+1;\n }\n if(num>1)\n {\n printf(\"Yes\");\n exit(0);\n }\n}\nprintf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n if(n<27){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\nif(n>27){\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long int n,i,p;\n scanf(\"%ld\",&n);\n long int ara[27]={0};\n char str[n+2];\n scanf(\"%s\",str);\n for(i=0;i<n;i++)\n {\n p=(str[i]-'a')+1;\n ara[p]++;\n if(ara[p]>1)\n {\n printf(\"Yes\\n\");\n break;\n }\n else\n {\n if(i==n-1) printf(\"No\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int arr[26], n ;\n char c ;\n scanf(\"%d\", &n) ;\n scanf(\"%c\", &c) ;\n int i ;\n for(i = 0 ; i < 26 ; i++)\n arr[i] = 0 ;\n for(i = 0 ; i < n ; i++)\n {\n scanf(\"%c\", &c) ;\n arr[((int)c) - 0x61] += 1 ;\n }\n int flag = 0 ;\n for(i = 0 ; i < 26 ; i++)\n if(arr[i] != 1 && arr[i] != 0)\n {\n flag = 1 ;\n break ;\n }\n if(flag == 1)\n printf(\"Yes\") ;\n else\n printf(\"No\") ;\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char a,b;\n int t, count[26]={0};\n scanf(\"%d\",&t);\n scanf(\"%c\",&b);\n for(int i = 0; i < t; i++) {\n scanf(\"%c\",&a);\n count[a-97]++;\n if (count[a-97] > 1) {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n char* s=(char*)malloc((n+1)*sizeof(int));\n int a[26]={0};\n scanf(\"%s\",s);\n int f=0;\n for(int i=0;i<n;i++)\n {\n a[(int)s[i]-97]++;\n if(a[(int)s[i]-97]>1)\n { f=1;\n break;}\n }\n if(f==1)\n printf(\"yes\");\n else\n printf(\"no\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int x,i,j,c=0;\n scanf(\"%d\",&x);\n char a[x];\n scanf(\"%s\",&a);\n for(i=0;i<x-1;i++)\n {\n for(j=i+1;j<x;j++)\n {\n if(a[i]==a[j])\n {\n c++;\n }\n }\n }\n if(c==0)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n}\n\n"}, {"source_code": "//codeforces\n\n#include <stdio.h>\n\nint main()\n{\n\tint i, j, k, flag, singleFlag, n, groupC=0, singleC=0;\n\tchar str[100001], counted[10001]=\" \";\n\n\tscanf(\"%d %s\", &n, str);\n\t\n\tfor(i=0; i<n; i++)\n\t{\n\t\tsingleFlag=1;\n\t\tfor(j=i+1; j<n; j++)\n\t\t{\n\t\t\tflag=1;\n\t\t\tfor(k=0; k<n; k++)\n\t\t\t\tif(str[i]==counted[k])\n\t\t\t\t\tflag=0;\n\t\t\t\n\t\t\tif(flag && (str[i]==str[j]))\n\t\t\t{\n\t\t\t\tsingleFlag=0;\n\t\t\t\tgroupC++;\n\t\t\t\tcounted[i]=str[i];\n\t\t\t}\n\t\t}\n\t\tif(singleFlag) singleC++;\n\t}\n\t\n\tsingleC-=groupC;\n\t\n\tif(singleC<=groupC) printf(\"Yes\");\n\telse printf(\"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint A[27]={0},n,i,flag=0;\nchar B[100005];\nscanf(\"%d \",&n);\nscanf(\"%s\",B);\nfor(i=0;B[i]!='\\0';i++)\n{\nA[B[i]-'a']++;\n}\nfor(i=0;i<27;i++)\n{\nif(A[i]>1)\n{\nflag=1;\nprintf(\"YES\\n\");\nbreak;\n}\n}\nif(flag==0)\n{\nprintf(\"NO\\n\");\n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\tint n,a[26]={0};\n\t\tchar ch;\n\t\tscanf(\"%d\",&n);\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\t\tscanf(\"%c\",&ch);\n\t\t\t\ta[ch-97]++;\n\t\t\t}\n\t\tfor(int i=0;i<26;i++)\n\t\t{\n\t\t\t\tif(a[i]>=2)\n\t\t\t\t{\n\t\t\t\t\t\tprintf(\"Yes\");\nreturn 0;\n\n\t\t\t\t}\n\n\n\t\t}\n\t\tprintf(\"No\");\n\t\treturn 0;\n\t\t\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n getchar();\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n\n\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nvoid mergesort(char arr[], int l, int r)\n{\nif (l < r)\n{\nint m = l+(r-l)/2;\nmergesort(arr, l, m);\nmergesort(arr, m+1,r);\nmerge(arr, l, m, r);\n}\n}\nvoid merge(char arr[], int l, int m, int r)\n{\nint i, j, k;\nint n1 = m - l + 1;\nint n2 = r - m;\nchar L[1+n1], R[1+n2];\nfor (i = 0; i < n1; i++)\nL[i] = arr[l + i];\nfor (j = 0; j < n2; j++)\nR[j] = arr[m + 1+ j];\ni = 0;\nj = 0;\nk = l;\nwhile (i < n1 && j < n2)\n{\nif (L[i] <= R[j])\n{\narr[k] = L[i];\ni++;\n}\nelse\n{\narr[k] = R[j];\nj++;\n}\nk++;\n}\nwhile (i < n1)\n{\narr[k] = L[i];\ni++;\nk++;\n}\nwhile (j < n2)\n{\narr[k] = R[j];\nj++;\nk++;\n}\n}\nint main()\n{\n int n,f=0,count=1;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n s[n]='\\0';\n mergesort(s,0,n-1);\n for(int i=0;i<n;i++)\n {\n if(s[i]==s[i+1])\n {\n count++;\n if(count==2)\n {\n f=1;\n break;\n }\n }\n else\n count=1;\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,b,i;\nscanf(\"%d\",&n);\nchar s[n+1];\nscanf(\"%s\",&s);\nfor(i=97;i<123;i=i+1)\n{\n int j=0,num=0;\n while(s[j]!=0)\n {\n b=s[j];\n if(i==b)\n {\n num=num+1;\n }\n j=j+1;\n }\n if(num>1)\n {\n printf(\"Yes\");\n exit(0);\n }\n}\nprintf(\"No\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, i, j, c=0;\n scanf(\"%d\", &n);\n char str[n+1], temp;\n scanf(\"%s\", str);\n if(n==1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n else\n {\n for(i=0; str[i]; i++)\n {\n j=i;\n while(j>0 && str[j]<str[j-1])\n {\n temp=str[j];\n str[j]=str[j-1];\n str[j-1]=str[j];\n j--;\n }\n }\n\n int ara[26]={0};\n\n for(i=0; str[i]; i++)\n {\n ara[str[i]-'a']++;\n }\n\n for(i=0; i<26; i++)\n {\n if(ara[i]>=2)\n {\n c++;\n }\n }\n\n if(c>0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<malloc.h>\n\nint main(){\n\tint size;\n\tscanf(\"%d\",&size);\n\tchar arr[100000];\n\tscanf(\"%s\",&arr);\n\tint a[26] ={0};\n\tint x,i;\n\tfor(i=0;i<strlen(arr);i++){\n\t\tx = arr[i];\n\t\ta[x-97]++;\n\t}\n\tfor(i=0;i<26;i++){\n\t\tif(a[i]%2==0 && a[i]!=0){\n\t\t\tprintf(\"Yes\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n int n,i,a[26];\n memset(a,0,26*sizeof(int));\n scanf(\"%d\",&n);\n char c;\n if(n<2)\n printf(\"Yes\");\n else{\n while(n--)\n {\n scanf(\"%c\",&c);\n a[c-'a']++;\n }\n for(i=0;i<26;i++)\n {\n if(a[i]>=2)\n {printf(\"Yes\");break;}\n }\n if(i>=26)\n printf(\"No\");}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n if(n<27){\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\nif(n>27){\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}}\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(n==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\n#define N 100001\nint main(){\n int n;\n scanf(\"%d\",&n);\n char s[N];\n scanf(\"%s\",s);\n int count[27];\n int i;\n for(i=0;i<27;i++){\n count[i]=0;\n }\n for(i=0;i<n;i++){\n count[s[i]-'a']++;\n }\n int yes=0;\n for(i=0;i<27;i++){\n if(count[i]>1){\n yes=1;\n break;\n }\n }\n if(yes){\n printf(\"Yes\\n\");\n }else{\n printf(\"No\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,a[26]={0};\n scanf(\"%d\",&n);\n char s[n+5];\n scanf(\"%s\",&s);\n\n i=0;\n char ch=s[0];\n while(s[i]!='\\0')\n {\n if(s[i]==ch)\n a[0]++;\n i++;\n }\n if(a[0]>=2)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long n, i, j, g;\n char a[110000], b;\n\n scanf(\"%d %s\", &n, a);\n\n for(i=0; i<n-1; i++)\n {\n b=a[i], g=0;\n for(j=i+1; j<n; j++)\n {\n if(a[i]==a[j])\n g++;\n }\n\n if(g>=1)\n goto h;\n }\n h:\n if(i==(n-1))\n printf(\"No\");\n else\n printf(\"Yes\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar str[100010];\nint a[200];\nint main()\n{\n\n\tint n;\n\twhile (scanf(\"%d\", &n) != EOF)\n\t{\n\t\tgetchar();\n\t\tmemset(a, 0, sizeof(a));\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tchar m = 0;\n\t\t\tscanf(\"%c\", &m);\n\t\t\ta[m - '0']++;\n\t\t}\n\t\tint sum1 = 0, sum2 = 0;\n\t\tfor (int i = 0; i < 200; i++)\n\t\t{\n\t\t\tif (a[i] >= 2)\n\t\t\t{\n\t\t\t\tsum2++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (a[i] == 1)\n\t\t\t\t{\n\t\t\t\t\tsum1++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (sum1==n||n==1)\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t}\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, i, j;\n scanf(\"%d\", &n);\n char str[n+1], temp;\n scanf(\"%s\", str);\n for(i=0; str[i]; i++)\n {\n j=i;\n while(j>0 && str[j]<str[j-1])\n {\n temp=str[j];\n str[j]=str[j-1];\n str[j-1]=str[j];\n j--;\n }\n }\n\n int ara[26]={0};\n\n for(i=0; str[i]; i++)\n {\n ara[str[i]-'a']++;\n }\n\n int c, c1;\n for(i=0; i<26; i++)\n {\n if(ara[i]==1)\n {\n c1++;\n }\n else\n c++;\n }\n\n if(c>1)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\t int n,i,j,c=0,d=0;\n\tchar ch[100005];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",ch);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t \n\t for(j=i+1;j<n;j++)\n\t {\n\t \n\t if(ch[i]==ch[j])\n\t {\n\t \n\t c++;\n\t \n\t }\n\t \n\t }\n\t}\n\n\n\tif(c>=2)\n\t{\n\t printf(\"Yes\");\n\t}\n\telse\n\t{\n\t printf(\"No\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,l=0,m,n;\n char a[10001];\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n m=strlen(a);\n for(i=0;i<m;i++)\n {\n for(j=i+1;j<m;j++)\n {\n if(a[i]==a[j])\n {l++;}\n }\n }\n\nif(l>0)\n\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <conio.h>\ntypedef long long int lli;\nint main()\n{\n\tlli n,i,j=0,f[30]={0};\n\tchar s[100005];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++){\n\t\ts[i]-=96;\n\t\tf[s[i]]++;\n\t}\n\tfor(i=1;i<=26;i++){\n\t\tif(f[i]<=1){\n\t\t\tj++;\n\t\t}\n\t}\n\tif(j==26){\n\t\tprintf(\"No\");\n\t}\n\telse{\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0,b;\n char ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j]){\n k=1;\n break;}\n }\n if(k==1)\n break;\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,a[26]={0};\n scanf(\"%d\",&n);\n char s[n+5];\n scanf(\"%s\",&s);\n\n i=0;\n char ch=s[0];\n while(s[i]!='\\0')\n {\n if(s[i]==ch)\n a[0]++;\n i++;\n }\n if(a[0]>=2)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\n//#define min(a,b) (a>b) ? b : a\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint Min(int a, int b)\n{\n\treturn (a > b) ? b : a;\n}\nint main(void)\n{\n\tint ch[26] = { 0 };\n\tchar c;\n\tint n, i = 0;\n\tscanf(\"%i%c\", &n, &c);\n\tdo\n\t{\n\t\tscanf(\"%c\", &c);\n\t\tif (c != '\\n')\n\t\t\tch[c - 'a']++;\n\t} while (c != '\\n');\n\tqsort(ch, 26, sizeof(int), lol);\n\tfor (i = 25; i >= 1; i--)\n\t{\n\t\tif (ch[i] != 1 || i == 1)\n\t\t\tch[i - 1] += ch[i];\n\t\telse\n\t\t{\n\t\t\tprintf(\"No\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"Yes\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar s[100001],a[26];\n\tint i,n,j,k;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\" %c\",&s[i]);\n\t}\n\n\tk=0;\n\tfor(i=0;i<26;i++)\n\ta[i]=0;\n\tfor(i=1;i<=n;i++){\n\t\tj=s[i]-97;\n\t\ta[j]++;}\n\tfor(i=0;i<26;i++)\n\t\tif(a[i]==1)\n\t\t\tk++;\n\tif(k==n)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\t\t\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\t int n,i,j,c=0;\n\tchar ch[100005];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",ch);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t \n\t for(j=i+1;j<n;j++)\n\t {\n\t \n\t if(ch[i]==ch[j])\n\t {\n\t \n\t c++;\n\t \n\t }\n\t \n\t }\n\t if(c==2)\n\t {\n\t break;\n\t }\n\t}\n\n\n\tif(c>=2)\n\t{\n\t printf(\"Yes\");\n\t}\n\telse\n\t{\n\t printf(\"No\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\ntypedef long long int int64;\n\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n#define ABS(a) ((a)>(0)?(a):-(a))\n\nvoid run(void){\n int n;\n scanf(\"%d\",&n);\n char *s=(char *)malloc(sizeof(char)*(n+1));\n scanf(\"%s\",s);\n int cnt[26];\n int i;\n for(i=0;i<26;i++) cnt[i]=0;\n for(i=0;i<n;i++) cnt[s[i]-'a']++;\n for(i=0;i<26;i++){\n if(cnt[i]>=2){\n printf(\"Yes\\n\");\n return;\n } \n }\n printf(\"No\\n\");\n return;\n}\n\nint main(void){\n run();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[100000];\n\tint c[26]={0},i,jud=0,n;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tc[a[i]-'a']++;\n\t\tif(c[a[i]-'a']==2)\n\t\t{\n\t\t\tjud=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(jud)printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint Cnt[26];\n\nint main()\n{\n int n;\n char str[100001];\n scanf(\"%d %s\", &n, str);\n for(int i = 0; i < n; ++i) {\n ++Cnt[str[i] - 'a'];\n }\n for(int i = 0; i < 26; ++i) {\n if(Cnt[i] >= 2) {\n puts(\"Yes\");\n return 0;\n }\n }\n puts(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid mergesort(char arr[], int l, int r)\n{\nif (l < r)\n{\nint m = l+(r-l)/2;\nmergesort(arr, l, m);\nmergesort(arr, m+1,r);\nmerge(arr, l, m, r);\n}\n}\nvoid merge(char arr[], int l, int m, int r)\n{\nint i, j, k;\nint n1 = m - l + 1;\nint n2 = r - m;\nchar L[1+n1], R[1+n2];\nfor (i = 0; i < n1; i++)\nL[i] = arr[l + i];\nfor (j = 0; j < n2; j++)\nR[j] = arr[m + 1+ j];\ni = 0;\nj = 0;\nk = l;\nwhile (i < n1 && j < n2)\n{\nif (L[i] <= R[j])\n{\narr[k] = L[i];\ni++;\n}\nelse\n{\narr[k] = R[j];\nj++;\n}\nk++;\n}\nwhile (i < n1)\n{\narr[k] = L[i];\ni++;\nk++;\n}\nwhile (j < n2)\n{\narr[k] = R[j];\nj++;\nk++;\n}\n}\nint main()\n{\n int n,f=0,count=1;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n s[n]='\\0';\n mergesort(s,0,n-1);\n for(int i=0;i<n;i++)\n {\n if(s[i]==s[i+1])\n {\n count++;\n if(count==2)\n {\n f=1;\n break;\n }\n }\n else\n count=1;\n }\n if(f==1)\n printf(\"%s\",\"YES\");\n else\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,k,l,s=0;\n scanf(\"%d\",&n);\n char S[n];\n scanf(\"%s\",S);\n int A[26];\n for(i=0;i<26;i++)\n {\n A[i]=0;\n }\n for(i=0;i<n;i++)\n {\n A[S[i]-97]++;\n }\n for(i=0;i<26;i++)\n {\n if(A[i]>1)\n {\n s++;\n }\n }\n if(s<1)\n {\n printf(\"No\\n\");\n }\n else\n {\n printf(\"Yes\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tlong long int n,t,i,j,count=0;\n\tscanf(\"%lld\",&n);\n\tchar s[100005];\n\tchar c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\tfor(j=0;j<26;j++)\n\t{\n\t\tcount=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(c[j]==s[i])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\tif(count>=2)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, j, t=0, a[26]= {0};\n char c;\n scanf(\"%d\", &n);\n if(n==1)\n a[0] = 2;\n for(i=0; i<n; i++)\n {\n scanf(\"%c\", &c);\n a[c-'a']++;\n }\n\n for(i=0; i<26; i++)\n if(a[i] > 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\n\tlong long int n,t,i,j,count=0;\n\tscanf(\"%lld\",&n);\n\tchar s[100005];\n\tchar c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n\tif(n==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%c\",&s[i]);\n\t}\n\tfor(j=0;j<26;j++)\n\t{\n\t\tcount=0;\n\t\tfor(i=0;i<n;i++)\n\t\t{\n\t\t\tif(c[j]==s[i])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t\tif(count>=2)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"YES\\n\");\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[100000];\n\tint c[26]={0},i,jud=0,n;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",a);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tc[a[i]-'a']++;\n\t\tif(c[a[i]-'a']==2)\n\t\t{\n\t\t\tjud=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(jud)printf(\"Yes\");\n\telse printf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0,b;\n char ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n if(b<27){\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j]){\n k=1;\n break;}\n }\n if(k==1)\n break;\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else\n printf(\"Yes\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,i=0,j,k=0,b;\n char c[60],ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j])\n k=1;\n }\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar c[100005];\nint main()\n{\n int a,i=0,j,k=0,b;\n char ce;\n scanf(\"%d\",&a);\n ce=getchar();\n gets(c);\n b=strlen(c);\n if(b==a)\n {\n if(b<27){\n for(i=0;i<b-1;i++)\n {\n for(j=i+1;j<b;j++)\n {\n if(c[i]==c[j]){\n k=1;\n break;}\n }\n if(k==1)\n break;\n\n }\n if(k==1)\n printf(\"Yes\");\n else\n printf(\"No\");\n }\n else\n printf(\"Yes\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, i, j, c=0;\n scanf(\"%d\", &n);\n char str[n+1], temp;\n scanf(\"%s\", str);\n for(i=0; str[i]; i++)\n {\n j=i;\n while(j>0 && str[j]<str[j-1])\n {\n temp=str[j];\n str[j]=str[j-1];\n str[j-1]=str[j];\n j--;\n }\n }\n\n int ara[26]={0};\n\n for(i=0; str[i]; i++)\n {\n ara[str[i]-'a']++;\n }\n\n for(i=0; i<26; i++)\n {\n if(ara[i]>=2)\n {\n c++;\n }\n }\n\n if(c>0)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\t int n,i,j,c=0;\n\tchar ch[100005];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",ch);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t \n\t for(j=i+1;j<n;j++)\n\t {\n\t \n\t if(ch[i]==ch[j])\n\t {\n\t \n\t c++;\n\t \n\t }\n\t \n\t }\n\t if(c==2)\n\t {\n\t break;\n\t }\n\t}\n\n\n\tif(c>=2)\n\t{\n\t printf(\"Yes\");\n\t}\n\telse\n\t{\n\t printf(\"No\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n\tint n,k=0;\n\tscanf(\"%d\",&n);\n\tchar arr[n];\n\tscanf(\"%s\",arr);\n\tfor(int i=0;i<n;i++)\n\t{\n\t\tfor(int j=i+1;j<n;j++)\n\t\tif(arr[i]==arr[j])\n\t\t{\n\t\t\tk=1;\n\t\t break;\n\t }\n\t {\n\t\t if(n==1)\n\t\t k=1;\n\t\t if(k==1)\n\t\t printf(\"yes\");\n\t\t else printf(\"no\");\n\t\t return 0;\n\t }\n }\n}\n\n\t\t \n\t\t\n\t\t\t\n\t\t\n\t\t\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n,i,a[26];\n\tchar s[100005];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\tif(n==1)\n\t{\n\t printf(\"Yes\");\n\t return 0;\n\t}\n\tfor(i=0;i<26;i++)\n\t{\n\t a[i]='0';\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t s[i]=s[i]-97;\n\t a[s[i]]=a[s[i]]+1;\n\t if(a[s[i]]>1)\n\t {\n\t printf(\"Yes\");\n\t return 0;\n\t }\n\t}\n\tprintf(\"No\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\t int n,i,j,c=0,d=0;\n\tchar ch[100005];\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",ch);\n\n\tfor(i=0;i<n;i++)\n\t{\n\t \n\t for(j=i+1;j<n;j++)\n\t {\n\t \n\t if(ch[i]==ch[j])\n\t {\n\t \n\t c++;\n\t break;\n\t }\n\t \n\t }\n\t}\n\n\n\tif(c>=2)\n\t{\n\t printf(\"Yes\");\n\t}\n\telse\n\t{\n\t printf(\"No\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint i,n,l;\n\tchar s[10010];\n\tint flag=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\n\tint a[26]={0};\n\n\tfor(i=0;i<l;i++)\n\t{\n\t\ts[i]-=97;\n\t\ta[s[i]]+=1;\n\t}\n\n\tfor(i=0;i<26;i++)\n\t{\n\t\tif(a[i]>=2)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}\n\n\tif(flag==1)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n#ifndef ONLINE_JUDGE\n\tfreopen(\"input.txt\", \"r\", stdin);\n\tfreopen(\"output.txt\", \"w\", stdout);\n#endif\n\n\tlong long int n, p = 0,z;\n\tscanf(\"%lld \", &n);\n\tchar a[100000];\n\tgets(a);\n\tz=strlen(a);\n\tprintf(\"%lld\\n\",z );\n\tif (strlen(a) > 1)\n\t{\n\t\tfor (long long int i = 0; i < n; ++i)\n\t\t{\n\t\t\tfor (long long int j = 0; j < n; ++j)\n\t\t\t{\n\t\t\t\tif (a[i] == a[j] && i != j)\n\t\t\t\t{\n\t\t\t\t\tp++;\n\t\t\t\t\t//printf(\"%lld\\n\",p );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (p>0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif (p>0)\n\t\t\tprintf(\"YES\\n\");\n\t\tif(p==0) \n\t\t\tprintf(\"NO\\n\");\n\t}\n\tif(strlen(a)==1)\n\t\tprintf(\"YES\\n\");\n\n\n\n\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n m=strlen(a);\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}\n\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(m==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tchar b[26];\n\tchar c;\n\tint n;\n\tscanf(\"%i\", &n);\n\tgetchar();\n\tfor (int i = 0; i < 26; i++) {\n\t\tb[i] = 0;\n\t}\n\tfor (int i = 0; i <n; i++) {\n\t\tc = getchar();\n\t\tb[(int)c - 97]++;\n\t}\n\tint wrong=0;\n\tint kind = 0;\n\tfor (int i = 0; i < 26; i++) {\n\t\tif (b[i] ==1) {\n\t\t\twrong++;\n\t\t}\n\t\tif (b[i]>0){\n\t\t\tkind++;\n\t\t}\n\t}\n\tif ((kind>1)&&(wrong==kind)) {\n\t\tprintf(\"No\");\n\t}\n\telse {\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\n#include<string.h>\nint main()\n{\n int n,i;\n int q=0,w=0,e=0,r=0,t=0,y=0,u=0,ix=0,o=0,p=0,a=0,sp=0,d=0,f=0,g=0,h=0,j=0,k=0,l=0,z=0,x=0,c=0,v=0,b=0,nx=0,m=0;\n char s[100000];\n scanf(\"%d\",&n);\n scanf(\"%s\",&s);\n\n for(i=0; i<n; i++)\n {\n if(s[i]=='a')\n {\n a++;\n }\n if(s[i]=='b')\n {\n b++;\n }\n if(s[i]=='c')\n {\n c++;\n }\n if(s[i]=='d')\n {\n d++;\n }\n if(s[i]=='e')\n {\n e++;\n }\n if(s[i]=='f')\n {\n f++;\n }\n if(s[i]=='g')\n {\n g++;\n }\n if(s[i]=='h')\n {\n h++;\n }\n if(s[i]=='i')\n {\n ix++;\n }\n if(s[i]=='j')\n {\n j++;\n }\n if(s[i]=='k')\n {\n k++;\n }\n if(s[i]=='l')\n {\n l++;\n }\n if(s[i]=='m')\n {\n m++;\n }\n if(s[i]=='n')\n {\n nx++;\n }\n if(s[i]=='o')\n {\n o++;\n }\n if(s[i]=='p')\n {\n p++;\n }\n if(s[i]=='q')\n {\n q++;\n }\n if(s[i]=='r')\n {\n r++;\n }\n if(s[i]=='s')\n {\n sp++;\n }\n if(s[i]=='t')\n {\n t++;\n }\n if(s[i]=='u')\n {\n u++;\n }\n if(s[i]=='v')\n {\n v++;\n }\n if(s[i]=='w')\n {\n w++;\n }\n if(s[i]=='x')\n {\n x++;\n }\n if(s[i]=='y')\n {\n y++;\n\n }\n if(s[i]=='z')\n {\n z++;\n }\n }\n if(q>=2 || w>=2 || e>=2 || r>=2 || t>=2 || y>=2 || u>=2 || ix>=2 || o>=2 || p>=2 || a>=2 || sp>=2 || d>=2 || f>=2 || g>=2 || h>=2 || j>=2 || k>=2 || l>=2 || z>=2 || x>=2 || c>=2 || v>=2 || b>=2 || nx>=2 || m>=2)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, j, t=0, a[26]= {0};\n char c;\n scanf(\"%d\", &n);\n if(n==1)\n a[0] = 2;\n for(i=0; i<n; i++)\n {\n scanf(\"%c\", &c);\n a[c-'a']++;\n }\n\n for(i=0; i<26; i++)\n if(a[i] > 1)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n printf(\"No\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nchar str[100010];\nint a[200];\nint main()\n{\n\n\tint n;\n\twhile (scanf(\"%d\", &n) != EOF)\n\t{\n\t\tgetchar();\n\t\tmemset(a, 0, sizeof(a));\n\t\tfor (int i = 0; i < n; i++)\n\t\t{\n\t\t\tchar m = 0;\n\t\t\tscanf(\"%c\", &m);\n\t\t\ta[m - '0']++;\n\t\t}\n\t\tint sum1 = 0, sum2 = 0;\n\t\tfor (int i = 0; i < 200; i++)\n\t\t{\n\t\t\tif (a[i] >= 2)\n\t\t\t{\n\t\t\t\tsum2++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (a[i] == 1)\n\t\t\t\t{\n\t\t\t\t\tsum1++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//printf(\"sum1->%d,sum2->%d\\n\", sum1, sum2);\n\t\tif (sum1 > sum2)\n\t\t{\n\t\t\tprintf(\"No\\n\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"Yes\\n\");\n\t\t}\n\t}\n\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\tchar b[26];\n\tchar c;\n\tint n;\n\tscanf(\"%i\", &n);\n\tgetchar();\n\tfor (int i = 0; i < 26; i++) {\n\t\tb[i] = 0;\n\t}\n\tfor (int i = 0; i <n; i++) {\n\t\tc = getchar();\n\t\tb[(int)c - 96]++;\n\t}\n\tint wrong=0;\n\tint kind = 0;\n\tfor (int i = 0; i < 26; i++) {\n\t\tif (b[i] ==1) {\n\t\t\twrong++;\n\t\t}\n\t\tif (b[i]>0){\n\t\t\tkind++;\n\t\t}\n\t}\n\tif ((kind>1)&&(wrong==kind)) {\n\t\tprintf(\"No\");\n\t}\n\telse {\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\nchar a[n];\n\nscanf(\"%s\",a);\n//printf(\"%c\",a[n-1]);\nlong long int temp;\nlong long int f[26];\n\nfor(int i=0;i<26;i++)\n{\n f[i]=99999999999999;\n}\nint fl=0;\nfor(int i=0;i<n;i++)\n{\n temp=a[i]-97;\n if(f[temp]==99999999999999) f[temp]=0;\n f[temp]=f[temp]+1;\n if(f[temp]==2 && f[temp]!=99999999999999)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n}\n\nprintf(\"No\\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"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n getchar();\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n\n\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0;\n char a[100001];\n scanf(\"%d%s\",&n,a);\n for(i=0; i<n-1; i++)\n {\n for(j=i+1; j<n; j++)\n if(a[i]==a[j])\n {\n c++;\n break;\n }\n if(c)\n break;\n }\n if(c)\n printf(\"Yes\\n\");\n else\n printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char ch, input[100], output[100];\n int no[26] = {0}, n, c, t, x,k=0,i,j;\n scanf(\"%d\",&n);\n printf(\"Enter some text\\n\");\n scanf(\"%s\", input);\n for(i=97;i<=122;i++)\n {\n for(j=0;j<n;j++)\n {\n if(input[j]==i)\n {\n k++;\n break;\n }\n }\n }\n for (c = 0; c < n; c++)\n {\n ch = input[c] - 'a';\n no[ch]++;\n }\n t = 0;\n for (ch = 'a'; ch <= 'z'; ch++)\n {\n x = ch - 'a';\n\n for (c = 0; c < no[x]; c++)\n {\n output[t] = ch;\n t++;\n }\n }\n output[t] = '\\0';\n if(n>k)\n {\n printf(\"YES\");\n }\n if(n==k)\n {\n printf(\"NO\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <conio.h>\ntypedef long long int lli;\nint main()\n{\n\tlli n,i,j=0,f[30]={0};\n\tchar s[100005];\n\tscanf(\"%lld\",&n);\n\tscanf(\"%s\",s);\n\tfor(i=0;i<n;i++){\n\t\ts[i]-=96;\n\t\tf[s[i]]++;\n\t}\n\tfor(i=1;i<=26;i++){\n\t\tif(f[i]<=1){\n\t\t\tj++;\n\t\t}\n\t}\n\tif(j==26){\n\t\tprintf(\"No\");\n\t}\n\telse{\n\t\tprintf(\"Yes\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\ntypedef long long int int64;\n\n#define MAX(a,b) ((a)>(b)?(a):(b))\n#define MIN(a,b) ((a)<(b)?(a):(b))\n#define ABS(a) ((a)>(0)?(a):-(a))\n\nvoid run(void){\n int n;\n scanf(\"%d\",&n);\n char *s=(char *)malloc(sizeof(char)*(n+1));\n scanf(\"%s\",s);\n int cnt[256]={0};\n int i;\n for(i=0;i<n;i++) cnt[(int)s[i]]++;\n for(i='a';i<='z';i++){\n if(cnt[i]>=2){\n printf(\"Yes\\n\");\n return;\n }\n }\n printf(\"No\\n\");\n return;\n}\n\nint main(void){\n run();\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,count,f;\n scanf(\"%d\",&n);\n char s[n+1];\n scanf(\"%s\",s);\n for(i=0;i<n-1;i++)\n {\n f=0;\n count=1;\n for(j=i+1;j<n;j++)\n if(s[i]==s[j])\n count++;\n if(count>=2)\n {\n f=1;\n break;\n }\n }\n if(f!=1)\n printf(\"No\\n\");\n else printf(\"Yes\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, i, cnt[26], t;\nchar s[100001];\n\nint main() {\n\tscanf(\"%d%s\", &n, s);\n\tfor (i = 0 ; i < n ; i++) cnt[s[i] - 'a']++;\n\tfor (i = 0 ; i < 26 ; i++) if (cnt[i] >= 2) t++;\n\tprintf(\"%s\", t ? \"YES\" : \"NO\");\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar s[100001],a[26];\n\tint i,n,j,k;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\" %c\",&s[i]);\n\t}\n\n\tk=0;\n\tfor(i=0;i<26;i++)\n\ta[i]=0;\n\tfor(i=1;i<=n;i++){\n\t\tj=s[i]-97;\n\t\ta[j]++;}\n\tfor(i=0;i<26;i++)\n\t\tif(a[i]==1)\n\t\t\tk++;\n\tif(k==n)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\t\t\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char temp;\n int i,j,n,count=1;\n scanf(\"%d\",&n);\n char str[n+6];\n scanf(\"%s\",str);\n if(n==1 || n>26){\n printf(\"Yes\\n\");\n }\n for(i=0;i<n-1;i++)\n {\n for(j=0;j<n-1;j++)\n {\n if(str[j]<str[j+1])\n {\n\n\n temp=str[j];\n str[j]=str[j+1];\n str[j+1]=temp;\n }\n }\n\n }\n\n for(i=0;i<n-1;i++)\n {\n if(str[i]!=str[i+1])\n count++;\n }\n if(n==count)printf(\"No\\n\");\n else printf(\"Yes\\n\");\n\n\n}\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int ln, n, i, j;\n char str[100000];\n\n\n scanf(\"%d%s\", &n, str);\n ln = strlen(str);\n for(i = 0; i < ln; i++){\n for(j = i + 1; j < ln; j++){\n if(str[i] == str[j]){\n printf(\"Yes\");\n return 0;\n }\n }\n }\n printf(\"No\");\n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n char pup[n+1];\n scanf(\"%s\", pup);\n if(n>26)\n {\n printf(\"Yes\");\n return 0;\n }\n int num[26] = {0};\n int j=0;\n while(pup[j]!='\\0')\n {\n int a = pup[j];\n if(num[a-97])\n {\n printf(\"Yes\");\n return 0;\n }\n else num[a-97]++;\n\n j++;\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[100005];\nint mark[10000];\nint main(){\n\tint n;\n\twhile (scanf(\"%d\", &n) != EOF){\n\t\tgetchar();\n\t\tgets(s);\n\t\tfor (int i = 'a'; i <= 'z';i++){\n\t\t\tmark[i] = 0;\n\t\t}\n\t\tfor (int i = 0; i < n; i++){\n\t\t\tmark[s[i]]++;\n\t\t}\n\t\tint sigh = 0;\n\t\tfor (int i = 'a'; i <= 'z'; i++){\n\t\t\tif (mark[i] >= 2) sigh = 1;\n\t\t\t//printf(\"%d \",mark[i]);\n\t\t}\n\t\tif (sigh == 1) printf(\"Yes\\n\");\n\t\telse printf(\"No\\n\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n scanf(\"%d\",&i); /**\u0221\ufffd\ufffd\ufffd\ufffdi*/\n getchar();\n int flag=0;\n char c;\n int x,y;\n int array[26];\n for(x=0; x<26; x++){\n array[x]=0;\n }\n for(x=0; x<i; x++){\n c=getchar();\n y=c-'a';\n array[y]++;\n }\n\n\n for(x=0; x<26; x++){\n if(array[x]>1) {flag=1; break;}\n }\n if(flag) printf(\"Yes\");\n else printf(\"No\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\nchar a[n];\n\nscanf(\"%s\",a);\n//printf(\"%c\",a[n-1]);\nlong long int temp;\nlong long int f[26];\n\nfor(int i=0;i<26;i++)\n{\n f[i]=99999999999999;\n}\nint fl=0;\nfor(int i=0;i<n;i++)\n{\n temp=a[i]-97;\n if(f[temp]==99999999999999) f[temp]=0;\n f[temp]=f[temp]+1;\n if(f[temp]==2 && f[temp]!=99999999999999)\n {\n printf(\"Yes\\n\");\n return 0;\n }\n}\n\nprintf(\"No\\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"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n for(i=0;i<n;i++){\n for(j=i+1;j<n;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}\n\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(m==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\n long int l=0,i,j,n,m;\n char a[100000+1];\n scanf(\"%ld\",&n);\n scanf(\"%s\",a);\n m=strlen(a);\n for(i=0;i<27;i++){\n for(j=i+1;j<27;j++){\n if(a[i]==a[j])\n {l++;}\n\n }}\n\n\nif(l>0)\n\n printf(\"YES\\n\");\n else if(m==1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\nreturn 0;}\n"}], "src_uid": "6b22e93f7e429693dcfe3c099346dcda"} {"nl": {"description": "Tattah is asleep if and only if Tattah is attending a lecture. This is a well-known formula among Tattah's colleagues.On a Wednesday afternoon, Tattah was attending Professor HH's lecture. At 12:21, right before falling asleep, he was staring at the digital watch around Saher's wrist. He noticed that the digits on the clock were the same when read from both directions i.e. a palindrome.In his sleep, he started dreaming about such rare moments of the day when the time displayed on a digital clock is a palindrome. As soon as he woke up, he felt destined to write a program that finds the next such moment.However, he still hasn't mastered the skill of programming while sleeping, so your task is to help him.", "input_spec": "The first and only line of the input starts with a string with the format \"HH:MM\" where \"HH\" is from \"00\" to \"23\" and \"MM\" is from \"00\" to \"59\". Both \"HH\" and \"MM\" have exactly two digits.", "output_spec": "Print the palindromic time of day that comes soonest after the time given in the input. If the input time is palindromic, output the soonest palindromic time after the input time.", "sample_inputs": ["12:21", "23:59"], "sample_outputs": ["13:31", "00:00"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint isPalindrome(int h, int m){\n\n\tif(h/10 == m%10 && h%10 == m/10)\treturn 1;\n\treturn 0;\n\n}\n\nvoid printOut(int h, int m){\n\tif(h/10==0 && m/10==0)\tprintf(\"0%d:0%d\\n\",h,m);\n\telse if(h/10==0)\tprintf(\"0%d:%d\\n\",h,m);\n\telse if(m/10==0)\tprintf(\"%d:0%d\\n\",h,m);\n\telse printf(\"%d:%d\\n\",h,m);\n}\n\nint main(void){\n\n\tint h,m;\n\tint isFound=0;\n\n\tscanf(\"%d:%d\",&h,&m);\n\n\tfor(m=m+1 ; m<60 && !isFound; m++){\n\t\tif(isPalindrome(h,m)){\n\t\t\tprintOut(h,m);\n\t\t\tisFound=1;\n\t\t}\n\t}\n\n\tfor(h=h+1 ; h<24 ; h++){\n\t\tfor(m=0 ; m<60 && !isFound; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(h=0 ; h<24 ; h ++){\n\t\tfor(m=0 ; m<60 && !isFound ; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}\n/****** PCCA -Mon Oct 03 11:57:58 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n\nint reverse(int b) {\n\t\n\treturn (b % 10) * 10 + ((b / 10) % 10);\n\t\n}\n\nint main() {\n\tint h, m;\n\t\n\twhile (scanf(\"%d:%d\", &h, &m) != EOF)\n\t{\n\t\tif (h == reverse(m) || reverse(h) < m)\n\t\t\th++;\n\t\t\n\t\tif (h > 5 && h < 10) //6 ao 9, 16 ao 19\n\t\t\th = 10;\n\t\telse\n\t\t\tif (h > 15 && h < 20)\n\t\t\t\th = 20;\n\t\t\n\t\tif (h > 23)\n\t\t\th = 0;\n\t\t\n\t\tm = reverse(h);\n\t\t\n\t\tprintf(\"%.2d:%.2d\\n\", h, m);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint SigH(int h)\n{\n if(h==23)\n {\n return 0;\n }\n return h+1;\n}\n\nint main()\n{\n int H,M,temp;\n scanf(\"%d:%d\",&H,&M);\n temp=(H%10)*10+H/10;\n if(temp>M&&temp>=0&&temp<60)\n {\n printf(\"%02d:%02d\\n\",H,temp);\n return 0;\n }\n while(1)\n {\n H=SigH(H);\n M=(H%10)*10+H/10;\n if(M>=0&&M<60)\n {\n printf(\"%02d:%02d\\n\",H,M);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n main()\n{\n int hh=0, mm=1;\n\n\n\n\n while ( ((hh%10)*10) + (hh/10) != mm ) /*se da la vuelta la hora si son iguales se encontro*/\n {\n scanf(\"%d:%d\" ,&hh,&mm);\n mm++;\n\n if (mm == 60)\n {\n mm=0;\n hh++;\n }\n\n if (hh == 24)\n {\n hh=0;\n\n }\n\n }\n printf(\"%02d:%02d\\n\", hh, mm);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n char hora[5];\n scanf(\"%s\",hora);\n int hora_num = (hora[0]-48)*10 + (hora[1]-48);\n int min_num = (hora[3]-48)*10 + (hora[4]-48);\n \n int hora_inver = (hora[1]-48)*10 + (hora[0]-48);\n if(hora[1] < 53){\n if(hora_inver <= min_num){\n if(hora_num < 23){\n hora_num++;\n }\n else{\n hora_num = 0;\n }\n }\n }else if(hora[1] > 53){\n \thora_num++;\n \tif(hora_num%10 >= 6 && hora_num%10 <= 9){\n \t\thora_num = hora_num + 10 - (hora_num%10);\n\t\t}\n\t}else{\n\t\tif(hora_inver <= min_num){\n\t\t\thora_num = hora_num + 10 - (hora_num%10);\n\t\t}\n\t}\n printf(\"%c%c:%c%c\",hora_num/10+48,hora_num%10+48,hora_num%10+48,hora_num/10+48);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint reverse(int a){\n\tint one,ten;\n\tone=a%10;\n\tten=a/10;\n\treturn one*10+ten;\n}\n\nint main(void)\n{\n\tint hh,mm,h,hd,i,j;\n\tchar syn[6];\n\t\n\tscanf(\"%s\",syn);\n\tsyn[2]='\\0';\n\thh=atoi(syn);\n\tmm=atoi(&syn[3]);\n\t//for(i=0;i<24;i++){\n\t//\tfor(j=0;j<60;j++){\n\t//\t\thh=i;\n\t//\t\tmm=j;\n\t\t\th=hh%10;\n\t\t\thd=hh/10;\n\t\t\tif(h<5){\n\t\t\t\tif(mm>=reverse(hh))printf(\"%02d:%02d\\n\",(hh+1)%24,reverse((hh+1)%24));\n\t\t\t\telse printf(\"%02d:%02d\\n\",(hh)%24,reverse((hh)%24));\n\t\t\t}\n\t\t\telse if(h==5){\n\t\t\t\tif(mm>=reverse(hh))printf(\"%d0:0%d\\n\",hd+1,hd+1);\n\t\t\t\telse printf(\"%02d:%02d\\n\",(hh)%24,reverse((hh)%24));\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"%d0:0%d\\n\",hd+1,hd+1);\n\t//\t\t}\n\t//\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n//franciscolezcano\nmain()\n{\n int h, m, c, f, u ,d, hh, i, m2;\n\n i = 1;\n\n scanf( \"%d:%d\", &h, &m );\n\n m2 = m;\n\n for( c = h; c <= 23 && i == 1; c++ )\n {\n for( f = m2 + 1; f <= 51 && i == 1; f ++ )\n {\n d = c / 10;\n u = c - ( d * 10 );\n hh = ( u * 10 ) + d;\n if( hh == f )\n {\n printf( \"%02d:%02d\\n\", c, f );\n i = 0;\n }\n }\n m2 = 0;\n }\n\n if( h >= 23 && m >= 32 )\n {\n printf( \"00:00\\n\" );\n }\n\n return;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int x[24] = {01,02,03,04,05,06,07,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00};\n int ctrx[24] = {1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1};\n int y[24] = {10,20,30,40,50,00,70,80,90,01,11,21,31,41,51,61,71,81,91,02,12,22,32,00};\n\n int i,j=0,k,ss[2];\n char t[6];\n char numx[3];\n char numy[3];\n\n char *ptrToken;\n\n scanf(\"%s\",t);\n\n ptrToken = strtok( t, \":\" );\n\n while ( ptrToken != NULL )\n {\n ss[j]=atoi(ptrToken);\n ptrToken = strtok( NULL, \":\" );\n j++;\n }\n\n if(ss[0] == 00)\n {\n printf(\"0%d:%d\",x[0],y[0]);\n }\n else{\n for(i=0; i<24; i++)\n {\n if(x[i] == ss[0])\n {\n if(ctrx[i] == 0)\n {\n k=i;\n while(ctrx[k] == 0)\n {\n k++;\n }\n printf(\"%d:0%d\",x[k],y[k]);\n }\n else{\n if(ctrx[i+1] == 0)\n {\n k=i;\n\n while(ctrx[k+1] == 0)\n {\n k++;\n }\n if(x[k+1]<10)\n {\n printf(\"0%d:%d\",x[k+1],y[k+1]);\n }\n else if(y[k+1]<10)\n {\n printf(\"%d:0%d\",x[k+1],y[k+1]);\n }\n else{\n printf(\"%d:%d\",x[k+1],y[k+1]);\n }\n\n }\n else{\n if(x[i] == 23)\n {\n if(ss[1]<y[i])\n {\n printf(\"%d:%d\",x[i],y[i]);\n }\n else{\n printf(\"0%d:0%d\",x[i+1],y[i+1]);\n }\n }\n else if(ss[1]<y[i])\n {\n if(x[i]<10)\n {\n printf(\"0%d:%d\",x[i],y[i]);\n }\n else{\n printf(\"%d:%d\",x[i],y[i]);\n }\n\n }\n else if(x[i+1]<10)\n {\n printf(\"0%d:%d\",x[i+1],y[i+1]);\n }\n else{\n printf(\"%d:%d\",x[i+1],y[i+1]);\n }\n }\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void)\n{\n char h1,h2,m1,m2,x;\n scanf(\" %c %c %c %c %c\",&h1,&h2,&x,&m1,&m2);\n do\n {\n m2++;\n if(m2>'9')\n {\n m2='0';\n m1++;\n }\n if(m1>'5')\n {\n m1='0';\n h2++;\n }\n if(h2>'9')\n {\n h2='0';\n h1++;\n }\n if(h1=='2' && h2=='4')\n {\n h1='0';\n h2='0';\n }\n }while(h1!=m2 || h2!=m1);\n printf(\"%c%c:%c%c\",h1,h2,m1,m2);\n\n \n return 0;\n}\n/****** PCCA -Wed Oct 05 11:02:56 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char str[1000],str1[1000];\n int i,j,k,a,b,c,d;\n scanf(\"%s\",str);\n a=str[0]-'0';\n b=str[1]-'0';\n c=str[3]-'0';\n d=str[4]-'0';\n if(a==0 && b<5)\n {\n if(c<b)\n printf(\"0%d:%d0\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==0 && b>=5)\n {\n printf(\"%d%d:%d%d\",a+1,a,a,a+1);\n }\n if(a==1 && b<5)\n {\n if(c<b)\n printf(\"1%d:%d1\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==1 && b>=5)\n {\n printf(\"%d0:0%d\",a+1,a+1);\n }\n if(a==2 && b<3)\n {\n if(c<b)\n printf(\"2%d:%d2\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==2 && b>=3)\n {\n if(c<b)\n printf(\"2%d:%d2\",b,b);\n else if(c==b && d<a)\n printf(\"2%d:%d2\",b,b);\n else\n printf(\"00:00\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n\tchar s[6];\n\tscanf(\"%s\",s);\n\t\n\t//HH:MM\n\tchar hora[3]; \t//HH\n\tchar minu[3];\t//MM\n\thora[0] = s[0];\n\thora[1] = s[1];\n\t\n\tminu[0] = s[3];\n\tminu[1] = s[4];\n\n\tminu[2] = hora[2] = '\\0';\n\n\t//printf(\"%s %s %s\\n\",s,hora,minu);\n\t//12:21\n\t//13:31\n\n\tint i; //las horas y minutos en los minutos \n\tfor (i = (60*atoi(hora)+atoi(minu)+1); i < 1440; i++)\n\t{\n\t\t//printf(\"%d---%02d %02d\\n\",i,i/60,i%60); \n\t\tif(isPalin(i/60, i%60)){\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(i!=1440)\n\t\tprintf(\"%02d:%02d\\n\",i/60,i%60);\n\telse\n\t\tprintf(\"00:00\");\n\n\treturn 0;\n}\n\nint isPalin(int x, int y){\n\t\n\tchar hh[3];\n\tsprintf(hh,\"%02d\",x);\n\t\n\tchar mm[3];\n\tsprintf(mm,\"%02d\",y);\n\t\n\tif(hh[0]==mm[1] && hh[1]==mm[0])\n\t\treturn 1;\n\treturn 0; \n}"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint flag=0,flag1=0,flag2=0,flag_x=0;\n\tchar a[6];\n\tscanf(\"%s\",&a);\n\twhile(1) {\n\t\tif(a[0]=='2'&&a[1]=='3'&&a[3]=='5'&&a[4]=='9') {\n\t\t\tprintf(\"00:00\");\n\t\t\tbreak;\n\t\t}\n\t\tif(flag==1&&flag1!=1) {\n\t\t\ta[4]='0';\n\t\t\ta[3]++;\n\t\t\tflag=0;\n\t\t}\n\t\telse if(flag1!=1&&flag2!=1){\n\t\t\ta[4]++;\n\t\t}\n\t\telse if(flag1==1) {\n\t\t\ta[1]++;\n\t\t\ta[3]='0';\n\t\t\ta[4]='0';\n\t\t\tflag1=0;\n\t\t}\n\t\telse if(flag2==1) {\n\t\t\ta[0]++;\n\t\t\tflag2=0;\n\t\t\ta[1]='0';\n\t\t\ta[3]='0';\n\t\t\ta[4]='0';\n\t\t}\n\t\tif(a[4]-48==9&&a[3]-48==5&&a[1]-48==9) {\n\t\t\tflag2=1;\n\t\t}\n\t\telse if(a[4]-48==9&&a[3]-48==5) {\n\t\t\tflag1=1;\n\t\t}\n\t\telse if(a[4]-48==9) {\n\t\t\tflag=1;\n\t\t}\n\t\tif(a[1]-48==9) {\n\t\t\tflag2=1;\n\t\t}\n\t\tif(a[0]==a[4]&&a[1]==a[3]) {\n\t\t\tprintf(\"%c%c:%c%c\",a[0],a[1],a[3],a[4]);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint panli(int a, int b)\n{\n\tif ( a /10 == b%10 && a%10 == b/10)\n\t{\n\t\treturn 0;\n\t}\n\treturn 1;\n\n}\n\nint main(void) {\n\t// just check the hours\n\tint a,b;\n\tscanf(\"%d:%d\", &a,&b);\n\tdo\n\t{\n\t\t b = (b+1) % 60;\n\t\t if (b == 0)\n\t\t {\n\t\t \ta = (a +1) % 24;\n\t\t }\n\t}\n\twhile (panli(a,b) != 0);\n\tif (a < 10)\n\t{\n\t\tprintf(\"0%d\", a);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\", a);\n\t}\n\tprintf(\":\");\n\tif( b <9)\n\t{\n\t\tprintf(\"0%d\", b);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\", b);\n\t}\n\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int h1,h2,m1,m2,ig;\n char HM[6],H1[2],H2[2],M1[2],M2[2];\n fgets(HM,6,stdin);\n H1[0]=HM[0];\n H2[0]=HM[1];\n M1[0]=HM[3];\n M2[0]=HM[4];\n h1=atoi(H1);\n h2=atoi(H2);\n m1=atoi(M1);\n m2=atoi(M2);\n ig=0;\n m2++;\n while(h1<3 && ig!=1){\n if(h1==2){\n while(h2<4 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n else{\n while(h2<10 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n h2=0;\n h1++;\n if(h1==3){\n h1=0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint isPalindrome(int h, int m){\n\n\tif(h/10 == m%10 && h%10 == m/10)\treturn 1;\n\treturn 0;\n\n}\n\nvoid printOut(int h, int m){\n\tif(h/10==0 && m/10==0)\tprintf(\"0%d:0%d\\n\",h,m);\n\telse if(h/10==0)\tprintf(\"0%d:%d\\n\",h,m);\n\telse if(m/10==0)\tprintf(\"%d:0%d\\n\",h,m);\n\telse printf(\"%d:%d\\n\",h,m);\n}\n\nint main(void){\n\n\tint h,m;\n\tint isFound=0;\n\n\tscanf(\"%d:%d\",&h,&m);\n\n\tfor(m=m+1 ; m<60 && !isFound; m++){\n\t\tif(isPalindrome(h,m)){\n\t\t\tprintOut(h,m);\n\t\t\tisFound=1;\n\t\t}\n\t}\n\n\tfor(h=h+1 ; h<24 ; h++){\n\t\tfor(m=0 ; m<60 && !isFound; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(h=0 ; h<24 ; h ++){\n\t\tfor(m=0 ; m<60 && !isFound ; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}\n/****** PCCA -Mon Oct 03 11:57:58 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n\nint isPalindrome(int h, int m){\n\n\tif(h/10 == m%10 && h%10 == m/10)\treturn 1;\n\treturn 0;\n\n}\n\nvoid printOut(int h, int m){\n\tif(h/10==0 && m/10==0)\tprintf(\"0%d:0%d\\n\",h,m);\n\telse if(h/10==0)\tprintf(\"0%d:%d\\n\",h,m);\n\telse if(m/10==0)\tprintf(\"%d:0%d\\n\",h,m);\n\telse printf(\"%d:%d\\n\",h,m);\n}\n\nint main(void){\n\n\tint h,m;\n\tint isFound=0;\n\n\tscanf(\"%d:%d\",&h,&m);\n\n\tfor(m=m+1 ; m<60 && !isFound; m++){\n\t\tif(isPalindrome(h,m)){\n\t\t\tprintOut(h,m);\n\t\t\tisFound=1;\n\t\t}\n\t}\n\n\tfor(h=h+1 ; h<24 ; h++){\n\t\tfor(m=0 ; m<60 && !isFound; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(h=0 ; h<24 ; h ++){\n\t\tfor(m=0 ; m<60 && !isFound ; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}\n/****** PCCA -Mon Oct 03 11:57:58 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char s[5];\n int i,k,n;\n while(scanf(\"%s\",s)!=EOF)\n {\n if(s[0]==s[4]&&s[1]==s[3])\n {\n if(s[0]=='2')\n {\n s[0]=s[1]=s[3]=s[4]='0';\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='5')\n {\n s[0]=s[4]='2';s[1]=s[3]='0';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='5')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n }\n else\n {\n if(s[0]=='2')\n {\n if(s[1]=='3')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='6')\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]<s[0])\n {\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='6')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[4]=s[0];s[1]=s[3];\n }\n }\n else\n {\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n }\n printf(\"%s\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n1,n2;\n scanf(\"%2d:%2d\",&n1,&n2);\n \n n1=n1*100;\n n1=n1+n2;\n \n if(n1<110) printf(\"01:10\\n\");\n else \n\t if(n1<220) printf(\"02:20\\n\");\n else \n\t if(n1<330) printf(\"03:30\\n\");\n else \n\t if(n1<440) printf(\"04:40\\n\");\n else \n\t if(n1<550) printf(\"05:50\\n\");\n else \n\t if(n1<1001) printf(\"10:01\\n\");\n else \n\t if(n1<1111) printf(\"11:11\\n\");\n else \n\t if(n1<1221) printf(\"12:21\\n\");\n else \n\t if(n1<1331) printf(\"13:31\\n\");\n else \n\t if(n1<1441) printf(\"14:41\\n\");\n else \n\t if(n1<1551) printf(\"15:51\\n\");\n else \n\t if(n1<2002) printf(\"20:02\\n\");\n else \n\t if(n1<2112) printf(\"21:12\\n\");\n else \n\t if(n1<2222) printf(\"22:22\\n\");\n else \n\t if(n1<2332) printf(\"23:32\\n\");\n else \n\t if(n1!=0) printf(\"00:00\\n\");\n \n \n return 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n#include<ctype.h>\n\n#define MAX( a, b ) ( ( a > b) ? a : b ) \n#define MIN( a, b ) ( ( a < b) ? a : b )\n#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)\n#define and &&\n#define or ||\nint main () {\n\nint x=0,n=0,s=0,i,j,a[10];\nchar b;\nscanf(\"%d\",&x);\nscanf(\"%c\",&b);\nscanf(\"%d\",&s);\nn+=((x%10)*10)+x/10;\nif(x>5 and x<10){\n printf(\"10:01\");\n return 0;\n}\nif(s<n and n<60){\n if(x<10)\n printf(\"0%d:\",x);\n else\n printf(\"%d:\",x);\n if(n<10)\n printf(\"0%d\",n);\n else\n printf(\"%d\",n);\n return 0;}\nif(x<23 and n+10<60){\n if(x<10)\n printf(\"0%d:%d\",x+1,n+10);\n else\n printf(\"%d:%d\",x+1,n+10);\n return 0;}\nif(n+10>=60){\n printf(\"20:02\");\n return 0;}\nprintf(\"00:00\");\n\n\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n int palindromo[16][2]={{00,00},{01,10},{02,20},{03,30},{04,40},{05,50},{10,01},{11,11},{12,21},{13,31},{14,41},{15,51},{20,02},{21,12},{22,22},{23,32}};\nint main() {\n char HHMM[5];\n scanf(\"%s\", &HHMM);\n int hora, pos;\n int minuto;\n char aux[4];\n memcpy(aux,&HHMM[0],2);\n aux[3]='\\0';\n hora= atoi(aux);\n memcpy(aux, &HHMM[3],2);\n aux[3]='\\0';\n minuto= atoi(aux);\n pos=time(hora, minuto);\n if(palindromo[pos][0]<10)\n printf(\"0%d:\", palindromo[pos][0]);\n else\n printf(\"%d:\", palindromo[pos][0]);\n if (palindromo[pos][1]<10)\n printf(\"0%d\", palindromo[pos][1]);\n else\n printf(\"%d\", palindromo[pos][1]);\n\n return 0;\n}\nint time(int hora, int min){\n int i=0;\n for(i=0 ; i<16; i++){\n if(hora <= palindromo[i][0]){\n if( hora==23 && min>=palindromo[i][1])\n return i=0;\n if( hora < palindromo[i][0] && min>=palindromo[i][1]){\n return i;\n }else{\n if(min < palindromo[i][1] )\n return i;\n else\n return i+1;\n }\n }else{\n if(hora==palindromo[i][0] && min<palindromo[i][1])\n return i;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nchar t[10];\nscanf(\"%s\",t);\nint h=10*(t[0]-'0')+(t[1]-'0');\nint m=10*(t[3]-'0')+(t[4]-'0');\nint i,j;\nj=m+1;\nfor(i=h;i<24;i++)\n{\n\tfor(;j<60;j++)\n\t{\n\t\tif(i==(j/10+10*(j%10)))\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tprintf(\"00:\");\n\t\t\telse if(i<10)\n\t\t\t\tprintf(\"0%d:\",i);\n\t\t\telse\n\t\t\t\tprintf(\"%d:\",i);\t\n\t\t\tif(j==0)\n\t\t\t\tprintf(\"00\");\n\t\t\telse if(j<10)\n\t\t\t\tprintf(\"0%d\",j);\n\t\t\telse\n\t\t\t\tprintf(\"%d\",j);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tj=0;\n}\n\nfor(i=0;i<h;i++)\n\tfor(j=0;j<60;j++)\n\t\tif(i==(j/10+10*(j%10)))\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\tprintf(\"00:\");\n\t\t\telse if(i<10)\n\t\t\t\tprintf(\"0%d:\",i);\n\t\t\telse\n\t\t\t\tprintf(\"%d:\",i);\t\n\t\t\tif(j==0)\n\t\t\t\tprintf(\"00\");\n\t\t\telse if(j<10)\n\t\t\t\tprintf(\"0%d\",j);\n\t\t\telse\n\t\t\t\tprintf(\"%d\",j);\n\t\t\treturn 0;\n\t\t}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint isPalindrome(int h, int m){\n\n\tif(h/10 == m%10 && h%10 == m/10)\treturn 1;\n\treturn 0;\n\n}\n\nvoid printOut(int h, int m){\n\tif(h/10==0 && m/10==0)\tprintf(\"0%d:0%d\\n\",h,m);\n\telse if(h/10==0)\tprintf(\"0%d:%d\\n\",h,m);\n\telse if(m/10==0)\tprintf(\"%d:0%d\\n\",h,m);\n\telse printf(\"%d:%d\\n\",h,m);\n}\n\nint main(void){\n\n\tint h,m;\n\tint isFound=0;\n\n\tscanf(\"%d:%d\",&h,&m);\n\n\tfor(m=m+1 ; m<60 && !isFound; m++){\n\t\tif(isPalindrome(h,m)){\n\t\t\tprintOut(h,m);\n\t\t\tisFound=1;\n\t\t}\n\t}\n\n\tfor(h=h+1 ; h<24 ; h++){\n\t\tfor(m=0 ; m<60 && !isFound; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor(h=0 ; h<24 ; h ++){\n\t\tfor(m=0 ; m<60 && !isFound ; m++){\n\t\t\tif(isPalindrome(h,m)){\n\t\t\t\tprintOut(h,m);\n\t\t\t\tisFound=1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0;\n}\n/****** PCCA -Mon Oct 03 11:57:58 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,r;\n\tchar c;\n\tscanf(\"%c\",&c);\n\ta=(c-48)*10;\n\tr=(c-48);\n\tscanf(\"%c\",&c);\n\tr+=(c-48)*10;\n\ta+=c-48;\n\tscanf(\":%c\",&c);\n\tb=(c-48)*10;\n\tscanf(\"%c\",&c);\n\tb+=c-48;\n\tif(b<r && r<60)\n\t{\n\t\tprintf(\"%d%d:%d%d\\n\",(a-(a%10))/10,a%10,(r-(r%10))/10,r%10);\n\t}\n\telse\n\t{\n\t\twhile(1)\n\t\t{\n\t\t\ta++;\n\t\t\tif(a==24)\n\t\t\t\ta=0;\n\t\t\tr=(a%10)*10+(a-(a%10))/10;\n\t\t\tif(r<60)\n\t\t\t{\n\t\t\t\tprintf(\"%d%d:%d%d\\n\",(a-(a%10))/10,a%10,(r-(r%10))/10,r%10);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<math.h>\nint ispalndrome(int a){\n int i,p[4];\n if(a==0){\n return 1;\n }\n for(i=0;i<4;i++){\np[i]=a%10;\na=a/10;\n\n }\n\n if(p[0]==p[3]&&p[1]==p[2]){\n return 1;\n }\n else{\n return 0;\n }\n}\nint main(){\n int i,a[4],n;\nchar b[6];\nscanf(\"%s\",b);\na[0]=b[0]-48;\na[1]=b[1]-48;\na[2]=b[3]-48;\na[3]=b[4]-48;\nn=a[0]*1000+a[1]*100+a[2]*10+a[3];\n\nwhile(1){\nn++;\nif(n/100==23&&n%100==60){\n n=0;\n}\nelse if(n%100==60){\n n=n+40;\n}\nif(ispalndrome(n)){\n break;\n}\n}\nif(n==0){\n printf(\"00:00\");\n}\nelse{\n for(i=0;i<4;i++){\na[i]=n%10;\nn=n/10;\n\n }\n printf(\"%d%d:%d%d\",a[0],a[1],a[2],a[3]);\n}\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,t;\n scanf(\"%d:%d\",&a,&b);\n t=a%10*10+a/10;\n if (b>=t||t>=60)\n do\n {\n a=(a+1)%24;\n t=a%10*10+a/10;\n }while(t>=60);\n printf(\"%.2d:%.2d\\n\",a,t);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c[10];\n scanf(\"%s\", c);\n int num1=10*(c[0]-'0')+(c[1]-'0');\n int num2=10*(c[3]-'0')+(c[4]-'0');\n //printf(\"%d %d\", num1, num2);\n int ttemp=num1;\n int pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\" %d\\n\", pnum1);\n if(num2<pnum1 && pnum1<60)\n {\n if(num1/10==0) \n {\n if(pnum1/10==0)\n {\n printf(\"0%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"0%d:%d\\n\", num1, pnum1);\n }\n else\n {\n if(pnum1/10==0)\n {\n printf(\"%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"%d:%d\\n\", num1, pnum1);\n }\n }\n //printf(\"%d:%d\\n\", num1, pnum1);\n else\n {\n while(1)\n {\n num1+=1;\n num1%=24;\n ttemp=num1;\n pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\"num1=%d pnum1=%d\\n\", num1, pnum1);\n if(pnum1<=60)\n {\n if(num1/10==0) \n {\n if(pnum1/10==0)\n {\n printf(\"0%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"0%d:%d\\n\", num1, pnum1);\n }\n else\n {\n if(pnum1/10==0)\n {\n printf(\"%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"%d:%d\\n\", num1, pnum1);\n }\n break;\n }\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint telll(int);\nint printit(int);\nint palindrome(int a,int b);\nint main()\n{\n char c[6];\n scanf(\"%s\",c);\n int a=0,b=0,d=0;\n a=c[1]-'0';\n b=c[0]-'0';\n a=(b*10)+a;\n b=c[3]-'0';\n d=c[4]-'0';\n b=(b*10)+d;\n int e;\n d=a;\n e=b;\n int t=0;\n if(palindrome(d,e))\n {\n e++;\n }\n do\n {\n int k=telll(d);\n\n if(e<=k)\n {\n if(k>59)\n {\n d++;\n }\n else\n {\n printit(d);\n printf(\":\");\n printit(k);\n return 0;\n }\n }\n else if(e>k)\n {\n d++;\n }\n if(d>23)\n {\n d=00;\n }\n e=00;\n }while(!palindrome(d,e));\n printit(d);\n printf(\":\");\n printit(e);\n return 0;\n\n\n\n\n}\nint telll(int j)\n{\n int l;\n l=j%10;\n j=j/10;\n l=(l*10)+j;\n return l;\n}\nint palindrome(int a,int b)\n{\n int c,d;\n c=a%10;\n a=a/10;\n d=b%10;\n b=b/10;\n if((c==b)&&(a==d))\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}\nint printit(int a)\n{\n if(a<10)\n {\n switch(a)\n {\n case 1 :printf(\"01\");\n break;\n case 2 :printf(\"02\");\n break;\n case 3 :printf(\"03\");\n break;\n case 4 :printf(\"04\");\n break;\n case 5 :printf(\"05\");\n break;\n case 6 :printf(\"06\");\n break;\n case 7 :printf(\"07\");\n break;\n case 8 :printf(\"08\");\n break;\n case 9 :printf(\"09\");\n break;\n case 0 :printf(\"00\");\n break;\n }\n }\n else\n {\n printf(\"%d\",a);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n //printf(\"%d\", 22%20);\n int h, m ;\n\n scanf(\"%d:%d\", &h, &m) ;\n\n if(h>=23 && m>=32)\n printf(\"00:00\\n\");\n\n else if(h >= 0 && h < 5) //First set\n {\n if(h*10 > m)\n printf(\"0%d:%d\\n\", h, h*10);\n else\n printf(\"0%d:%d\\n\", h+1, (h+1)*10);\n }\n\n else if(h >= 10 && h < 15) //Second Set\n {\n if((h%10) * 10 + 1 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 1);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 1);\n\n }\n\n else if(h >= 20 && h <= 23)\n {\n if((h%10) * 10 + 2 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 2);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 2);\n }\n\n else if(h>=5 && h < 10)\n printf(\"10:0%d\\n\", m-(m-1));\n\n else if(h>=15 && h < 20)\n printf(\"20:0%d\\n\", m-(m-2));\n\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint a,h,hr,m;\n\tscanf(\"%d:%d\",&h,&m);\n\thr=(h%10)*10+(h/10);\n\tif(hr>m && hr<60)\n\t{\n printf(\"%02d:%02d\\n\",h,hr);\n }\n else\n {\n\t h++;\n\t h=h%24;\n\t hr=(h%10)*10+(h/10);\n\t while(hr>=60)\n\t {\n\t h++;\n\t h=h%24;\n\t hr=(h%10)*10+(h/10);\n\t }\n printf(\"%02d:%02d\\n\",h,hr);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid imprimirhora(int hora);\nint main()\n{\n int hora,minutos,h4=0;\n int I;\n int pal[]={0,110,220,330,440,550,1001,1111,1221,1331,1441,1551,2002,2112,2222,2332};\n\n scanf(\"%d:%d\",&hora,&minutos);\n\n h4=(hora*100)+minutos;\n //printf(\"\\n%d\\n\",h4);\n\n\n for(I=0;I<=15;I++)\n {\n if(pal[I]==h4&& !2332)\n {\n imprimirhora(pal[I+1]);\n break;\n }\n else if(h4<=59)\n {\n printf(\"01:10\");\n break;\n }\n else if(pal[I]>h4)\n {\n imprimirhora(pal[I]);\n break;\n }\n }\n if(h4>=2332)\n {\n printf(\"00:00\");\n }\n\n return 0;\n}\n\nvoid imprimirhora(int hora)\n{\n int prh=0,prm=0;\n\n\n prh=hora/100;\n if (prh<10)\n {\n printf(\"0\");\n }\n printf(\"%d\",prh);\n\n prm=hora-(prh*100);\n if (prm<10)\n {\n printf(\":0\");\n printf(\"%d\",prm);\n }\n else\n {\n printf(\":%d\",prm);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void){\n\tint h,m;\n\tscanf(\"%d:%d\",&h,&m);\n\twhile(1){\n\t\tm++;\n\t\tif(m==60){m=0;h=(h+1)%24;}\n\t\tif((m%10==h/10)&&(h%10==m/10)){\n\t\t\tprintf(\"%02d:%02d\",h,m);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int h1,h2,m1,m2,ig;\n char HM[6],H1[2],H2[2],M1[2],M2[2];\n fgets(HM,6,stdin);\n H1[0]=HM[0];\n H2[0]=HM[1];\n M1[0]=HM[3];\n M2[0]=HM[4];\n h1=atoi(H1);\n h2=atoi(H2);\n m1=atoi(M1);\n m2=atoi(M2);\n ig=0;\n m2++;\n while(h1<3 && ig!=1){\n if(h1==2){\n while(h2<4 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n else{\n while(h2<10 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n h2=0;\n h1++;\n if(h1==3){\n h1=0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() \n{ \n\tint h,m; \n\tchar c; \n\n\tscanf(\"%d %c %d\",&h, &c, &m); \n\n\twhile (1) \n\t{ \n\t\tm++; \n\t\th+=(m/60); \n\t\tm%=60; \n\t\th%=24; \n\t\tif (h/10==m%10 && h%10==m/10) \n\t\t{ \n\t\t\tbreak; \n\t\t} \n\t} \n\tprintf(\"%d%d:%d%d\\n\",h/10, h%10, m/10, m%10);\n\treturn 0; \n} \n\n \t \t\t \t\t \t\t\t\t \t\t \t \t\t\t \t \t"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n do\n {\n ++mm;\n if (mm == 60)\n {\n ++hh;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n } while (hh % 10 * 10 + hh / 10 != mm);\n printf(\"%02d:%02d\\n\", hh, mm);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int h1,h2,m1,m2,ig;\n char HM[6],H1[2],H2[2],M1[2],M2[2];\n fgets(HM,6,stdin);\n H1[0]=HM[0];\n H2[0]=HM[1];\n M1[0]=HM[3];\n M2[0]=HM[4];\n h1=atoi(H1);\n h2=atoi(H2);\n m1=atoi(M1);\n m2=atoi(M2);\n ig=0;\n m2++;\n while(h1<3 && ig!=1){\n if(h1==2){\n while(h2<4 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n else{\n while(h2<10 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n h2=0;\n h1++;\n if(h1==3){\n h1=0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() \n{ \n\tint h,m; \n\tchar c; \n\n\tscanf(\"%d %c %d\",&h, &c, &m); \n\n\twhile (1) \n\t{ \n\t\tm++; \n\t\th+=(m/60); \n\t\tm%=60; \n\t\th%=24; \n\t\tif (h/10==m%10 && h%10==m/10) \n\t\t{ \n\t\t\tbreak; \n\t\t} \n\t} \n\tprintf(\"%d%d:%d%d\\n\",h/10, h%10, m/10, m%10);\n\treturn 0; \n} \n\n \t \t\t \t\t \t\t\t\t \t\t \t \t\t\t \t \t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n char str[100];\n int c;\n scanf(\"%s\",str);\n if((str[0]=='2'&&str[1]=='3')&&(str[3]>='3'&&str[4]>='2'))\n {\n printf(\"00:00\");\n exit(0);\n }\n else if(str[0]=='0'&&(str[1]>='6'&& str[1]<='9'))\n {\n printf(\"10:01\");\n exit(0);\n }\n else if(str[0]>='1' && (str[1]>='6'&& str[1]<='9')||((str[0]>='1' && str[1]=='5')&& (str[3]>='5'&&str[4]>='1')))\n {\n printf(\"20:02\");\n exit(0);\n }\n else if(str[4]>=str[0]&&str[3]>=str[1])\n { \n c=str[1]-'0'+1;\n str[1]=c+'0';\n str[3]=str[1];\n str[4]=str[0];\n printf(\"%s\",str);\n exit(0);\n\n }\n else\n {\n str[3]=str[1];\n str[4]=str[0];\n printf(\"%s\",str);\n exit(0);\n }\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n //printf(\"%d\", 22%20);\n int h, m ;\n\n scanf(\"%d:%d\", &h, &m) ;\n\n if(h>=23 && m>=32)\n printf(\"00:00\\n\");\n\n else if(h >= 0 && h < 5) //First set\n {\n if(h*10 > m)\n printf(\"0%d:%d\\n\", h, h*10);\n else\n printf(\"0%d:%d\\n\", h+1, (h+1)*10);\n }\n\n else if(h >= 10 && h < 15) //Second Set\n {\n if((h%10) * 10 + 1 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 1);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 1);\n\n }\n\n else if(h >= 20 && h <= 23)\n {\n if((h%10) * 10 + 2 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 2);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 2);\n }\n\n else if(h>=5 && h < 10)\n printf(\"10:0%d\\n\", m-(m-1));\n\n else if(h>=15 && h < 20)\n printf(\"20:0%d\\n\", m-(m-2));\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n //printf(\"%d\", 22%20);\n int h, m ;\n\n scanf(\"%d:%d\", &h, &m) ;\n\n if(h>=23 && m>=32)\n printf(\"00:00\\n\");\n\n else if(h >= 0 && h < 5) //First set\n {\n if(h*10 > m)\n printf(\"0%d:%d\\n\", h, h*10);\n else\n printf(\"0%d:%d\\n\", h+1, (h+1)*10);\n }\n\n else if(h >= 10 && h < 15) //Second Set\n {\n if((h%10) * 10 + 1 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 1);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 1);\n\n }\n\n else if(h >= 20 && h <= 23)\n {\n if((h%10) * 10 + 2 > m)\n printf(\"%d:%d\\n\", h, (h%10) * 10 + 2);\n else\n printf(\"%d:%d\\n\", h+1, (h+1)%10 * 10 + 2);\n }\n\n else if(h>=5 && h < 10)\n printf(\"10:0%d\\n\", m-(m-1));\n\n else if(h>=15 && h < 20)\n printf(\"20:0%d\\n\", m-(m-2));\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint h, m;\n\nint main()\n{\n\tscanf(\"%d:%d\",&h,&m);\n\twhile(1)\n\t{\n\t m++;\n\t\tif(m==60)\n\t\t{\n\t\t m=0;\n\t\t h=(h+1)%24;\n\t\t}\n\t\tif(h/10==m%10 && m/10==h%10)\n\t\t{\n\t\t\tprintf(\"%02d:%02d\",h,m);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n char h1,h2,m1,m2;\n scanf(\"%c%c:%c%c\",&h1,&h2,&m1,&m2);\n if((m1< h2 || ( m1== h2 && m2 < h1)) && h2 < '6')printf(\"%c%c:%c%c\\n\",h1,h2,h2,h1);\n else{\n if(h1 == '2'){\n if(h2 != '3') printf(\"%c%c:%c%c\\n\",h1,h2+1,h2+1,h1);\n else printf(\"00:00\\n\",h1,h2+1,h2+1,h1);\n }else{\n if(h2 < '5' ) printf(\"%c%c:%c%c\\n\",h1,h2+1,h2+1,h1);\n else printf(\"%c0:0%c\\n\",h1+1,h1+1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define TAM 3\n\nint inversa(int n){\n int inv, cociente, resto;\n cociente= n/10;\n resto= n%10;\n inv = (resto*10)+cociente;\n return inv;\n}\n\nvoid imprimeHora(int hs, int ms){\n if(hs<10&& ms>=10) printf(\"0%d:%d\", hs, ms);\n else if(hs>=10 && ms<10) printf(\"%d:0%d\", hs, ms);\n else if(hs<10 && ms<10) printf(\"0%d:0%d\", hs, ms);\n else if(hs>=10&& ms>=10)printf(\"%d:%d\", hs, ms);\n}\n\nint Busca(int numero, int a[]){\n int i;\n for(i=0; i<24; i++){\n if(numero == a[i]) return i;\n }\n}\n\nint main(){\n\n char* h;\n char He[TAM];\n char Me[TAM];\n int he, me, hs, ms, exito, pos, H, M;\n char cadena[6];\n int Hora[24]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00};\n int InvHora[24]={10,20,30,40,50,60,70,80,90,01,11,21,31,41,51,61,71,81,91,02,12,22,32,00};\n int validaHora[24]={1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1};\n\n scanf(\"%s\", cadena);\n\n h = strtok(cadena, \":\");\n He[0]= *(h);\n He[1]=*(h+1);\n He[2]= '\\0';\n\n h= strtok(NULL, \":\");\n Me[0]= *(h);\n Me[1]= *(h+1);\n Me[2]= '\\0';\n\n he= H= atoi(He);\n me =M= atoi(Me);\n //printf(\"\\nPRUEBA %d:%d\\n\", he, me);\n\n if(me== inversa(he)){\n if(he==23){\n hs=00;\n ms=00;\n }else{\n hs= he+1;\n ms=me+10;\n pos = Busca(ms, InvHora);\n if(validaHora[pos]==0){\n while(exito!=1){\n ++pos;\n ++he;\n if(validaHora[pos]!=0){\n ms= InvHora[pos];\n hs=Hora[pos];\n exito=1;\n }else{\n exito=0;\n }\n }\n }\n }\n\n imprimeHora(hs,ms);\n\n }else if(me < inversa(he)){\n exito=0;\n pos= Busca(he, Hora);\n //printf(\"\\nPrueba : %d\\n\", pos);\n\n if(validaHora[pos]!= 0){\n ms= InvHora[pos];\n hs= Hora[pos];\n }else{\n while(exito!= 1){\n ++pos;\n ++he;\n //printf(\"\\nPrueba : %d\\n\", pos);\n if(validaHora[pos]!= 0){\n ms=InvHora[pos];\n hs=Hora[pos];\n exito=1;\n //printf(\"\\nPrueba : %d:%d\\n\", hs,ms);\n }else{\n exito=0;\n }\n }\n }\n\n imprimeHora(hs,ms);\n\n }else if(me> inversa(he)){\n if(he==23){\n hs=00;\n ms=00;\n\n }else if(he==00){\n hs=01;\n ms=10;\n\n }else{\n pos = Busca(he, Hora);\n exito=0;\n\n while(exito!= 1){\n ++pos; ++he;\n if(validaHora[pos] != 0){\n ms=InvHora[pos];\n hs=Hora[pos];\n exito=1;\n }else{\n exito=0;\n }\n }\n\n }\n imprimeHora(hs,ms);\n }\n\n\nprintf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n\n#define sf scanf\n#define sfi1(a) scanf(\"%d\", &a)\n#define sfi2(a,b) scanf(\"%d %d\", &a, &b)\n#define sfi3(a,b,c) scanf(\"%d %d %d\", &a, &b, &c)\n#define sfi4(a,b,c,d) scanf(\"%d %d %d %d\", &a, &b, &c, &d)\n#define sfll1(a) scanf(\"%lld\", &a)\n#define sfll2(a,b) scanf(\"%lld %lld\", &a, &b)\n#define sfll3(a,b,c) scanf(\"%lld %lld %lld\", &a, &b, &c)\n#define sfll4(a,b,c,d) scanf(\"%lld %lld %lld %lld\", &a, &b, &c, &d)\n#define sfc1(a) scanf(\"%c\", &a)\n#define sfc2(a,b) scanf(\"%c %c\", &a, &b)\n#define sfc3(a,b,c) scanf(\"%c %c %c\", &a, &b, &c)\n#define sfc4(a,b,c,d) scanf(\"%c %c %c %c\", &a, &b, &c, &d)\n#define sfd1(a) scanf(\"%lf\", &a)\n#define sfd2(a,b) scanf(\"%lf %lf\", &a, &b)\n#define sfd3(a,b,c) scanf(\"%lf %lf %lf\", &a, &b, &c)\n#define sfd4(a,b,c,d) scanf(\"%lf %lf %lf %lf\", &a, &b, &c, &d)\n#define pf printf\n#define loop(i,n) for(int i=0; i<n; i++)\n#define rloop(i,n) for(int i=n-1; i>=0; i--)\n\n#define INF 100000000000ll\n#define MOD 1000000007ll\n#define test(d) cout << \"test \" << d << endl;\n#define start(a,b) cout <<\"---------start-----\" << a << \" \" << b << \"-----------\\n\";\n#define testReturn(i,v) cout <<\"return frm \" << i << \" : \" << v << endl;\n#define testFound(i,v) cout <<\"found value \" << i << \" : \" << v << endl;\n#define testBaseRet(i,v) cout <<\"return frm base condition \" << i << \" : \" << v << endl;\n#define MAXN 24\n\n\n\n//variable\nint t, h, m, r_h;\n\n//method\nint rev(int x){\n return ((x%10)*10 + x/10 );\n}\n\nvoid Print(){\n if(h<=9) pf(\"0%d:\", h);\n else pf(\"%d:\", h);\n if(r_h<=9) pf(\"0%d\\n\", r_h);\n else pf(\"%d\\n\", r_h);\n}\n\nint main(){\n\n scanf(\"%d:%d\", &h, &m);\n r_h = rev(h);\n while(1){\n if(r_h > m ) {\n if(r_h <= 59) {Print(); break;}\n else{\n h = ( (int) (h/10.0 + .5) ) * 10;\n r_h = rev(h);\n m = -1; continue;\n }\n } else{\n h = (h+1)% 24;\n r_h = rev(h);\n m = -1;\n }\n }\n\n //while(1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n { \n int a,b,c=0; \n scanf(\"%d:%d\",&a,&b);\n if(a%10==b/10&&a/10==b%10)\n goto x;\n while(a%10!=b/10 || a/10!=b%10)\n {x: \n b++;\n if(b==60)\n {b=0;\n a++;\n if(a==24)\n a=0;}\n } \n if(a/10==0)\n printf(\"%d%d\",c,a);\n else\n printf(\"%d\",a);\n printf(\":\");\n if(b/10==0)\n printf(\"%d%d\",c,b);\n else\n printf(\"%d\",b); \n \n return 0;\n} "}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tchar temp_m1 = (Hora) / 10 +'0' ;\n\tchar temp_m2 = (Hora) % 10 + '0' ;\n\t\n\t\n\tint temp_minutos = temp_m1 - '0' + 10*(temp_m2 - '0');\n\t\n\tif ( (HH[1]!= MM[0] || HH[0] != MM[1] ) && Minutos < temp_minutos && temp_minutos < 60 ){\n\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\tprintf(\"%s:%s\", HH,MM);\t\t\n\t} else {\n\t\tHora++;\n\t\ttemp_m1 = (Hora + 1 ) / 10 +'0' ;\n\t\ttemp_m2 = (Hora + 1 ) % 10 + '0' ;\n\t\tMinutos = temp_m1 + temp_m2;\n\t\tif(Hora >=24){\n\t\t\tprintf(\"00:00\");\n\t\t} else if(Hora <= 10 && Hora >= 6 && Minutos > 60){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora <= 19 && Hora >= 16 && Minutos > 60 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i;\n scanf(\"%d:%d\",&a,&b);\n b=b+1;\n if(b>=60)\n {\n b=0;\n a++;\n if(a>23)\n a=0;\n }\n while(b!=(a%10)*10+a/10)\n {\n b=b+1;\n if(b>59)\n {\n b=0;\n a=a+1;\n if(a>23)\n {\n a=0;\n }\n }\n }\n printf(\"%02d:%02d\\n\",a,b);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int ban=1;\n int hh, mm;\nscanf(\"%d:%d\",&hh,&mm);\n\ndo\n{\n\n//COMIENZA A SUMAR PARA AVANZAR EN EL TIEMPO\n mm++;\n if(mm==60)\n {\n hh++;\n mm=00;\n \n }\n if(hh==24)\n {\n hh=0;\n }\n\n}while((hh/10!=mm%10)||(hh%10!=mm/10));\n if(mm<=9 && hh<=9)\n {\n printf(\"0%d:0%d\",hh,mm);\n }else if(mm<=9 && hh>9)\n {\n printf(\"%d:0%d\",hh,mm);\n }else if(mm>9 && hh<=9)\n {\n printf(\"0%d:%d\",hh,mm);\n }\n else\n {\n printf(\"%d:%d\",hh,mm);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,j,ten,dig,sum;\n\n scanf(\"%d:%d\",&i,&j);\n\n if (i>=6 && i<=9)\n {\n i = 10;\n j = 0;\n }\n if (i>=16 && i<=19)\n {\n i = 20;\n j = 0;\n }\n ten = (i%24)%10;\n dig = (i%24)/10;\n\n sum = dig +10*ten; // min\n\n\n if(sum<=j) // if new min > origin min , hour need + 1;\n {\n\n j = 0;\n i = (i+1)%24;\n if(i==6)\n {\n i = 10;\n }\n if(i==16)\n {\n i=20;\n }\n sum = ((i)%10)*10 + ((i)/10);\n }\n\n\n\n while(j != sum)\n {\n j++;\n }\n\n if((i/10) == 0)\n printf(\"0\");\n printf(\"%d:\",i);\n if((j/10) == 0)\n printf(\"0\");\n printf(\"%d\",j);\n\n return 0;\n\n}\n/****** PCCA -Fri Oct 07 12:27:39 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],x,y,m,n;\n scanf(\"%d:%d\",&a[0],&a[1]);\n while(a[1]<=59)\n {\n a[1]++;\n if(a[1]>59)\n {\n a[1]=0;\n a[0]++;\n }\n if(a[0]>23)\n a[0]=0;\n x=a[0]/10;\n y=a[0]%10;\n m=a[1]/10;\n n=a[1]%10;\n if(x==n&&y==m)\n {\n printf(\"%02d:%02d\\n\",a[0],a[1]);\n break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char s[5];\n int i,k,n;\n while(scanf(\"%s\",s)!=EOF)\n {\n if(s[0]==s[4]&&s[1]==s[3])\n {\n if(s[0]=='2')\n {\n s[0]=s[1]=s[3]=s[4]='0';\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='5')\n {\n s[0]=s[4]='2';s[1]=s[3]='0';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='5')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n }\n else\n {\n if(s[0]=='2')\n {\n if(s[1]=='3')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='6')\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]<s[0])\n {\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='6')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[4]=s[0];s[1]=s[3];\n }\n }\n else\n {\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n }\n printf(\"%s\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char hora[6],h[3],m[3];\n int palin,HoraD[5],sig,sumah,sumam,auxpalin;\n\n gets(hora);\n\n //scanf(\"%[^\\n]s\",&hora);\n //printf(\"%s\",hora);\n h[0] = hora[0];\n h[1] = hora[1];\n m[0] = hora[3];\n m[1] = hora[4];\n\n //printf(\"%c\",AuxDCambio);\n HoraD[2]=atoi(m)/10;//convierte a int\n HoraD[3]=atoi(m)%10;\n HoraD[0]= atoi(h)/10;\n HoraD[1]= atoi(h)%10;\n\n sumah=HoraD[0]*10 + HoraD[1];\n sumam=HoraD[2]*10 + HoraD[3];\n auxpalin=HoraD[1]*10 + HoraD[0];\n //printf(\"%d : %d\\n%d\\n\",sumah,sumam,auxpalin);\n if(sumah<=sumam)\n {\n if(sumam>auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam==auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam<auxpalin)\n {\n sig=0;\n palin=0;\n }\n }\n //else if(sumah==sumam)\n //{\n // palin=1;\n // sig=1;\n // }\n else if(sumah>sumam)\n {\n sig=0;\n palin=0;\n\n }\n\n if(sumah==23 )\n {\n if(sig==1)\n {\n printf(\"00:00\");\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"23:32\");\n exit(0);\n }\n }\n else if(HoraD[1]>5 )\n {\n if(HoraD[0]==0)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"20:02\");\n exit(0);\n }\n }\n else if (HoraD[1]<5)\n {\n //if(sum)\n //{\n if(sig==1 || palin==1)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1]+1,HoraD[1]+1,HoraD[0]);\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1],HoraD[1],HoraD[0]);\n exit(0);\n }\n //}\n }\n else if (HoraD[1]==5)\n {\n if(HoraD[0]==0)\n {\n if(sig==1)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n else if(HoraD[0]==1)\n {\n if(sig==1)\n {\n printf(\"20:02\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n int h1, h2, m1, m2, hora, minuto, m_invertido;\n h1 = getchar() - '0';\n h2 = getchar() - '0';\n hora = h1 * 10 + h2;\n getchar();\n m1 = getchar() - '0';\n m2 = getchar() - '0';\n minuto = m1 * 10 + m2;\n\n while(1)\n {\n minuto++;\n if(minuto == 60)\n {\n minuto = 0;\n hora++;\n if(hora == 24) hora = 0;\n }\n if(hora / 10 == minuto % 10 && hora %10 == minuto / 10)\n {\n printf(\"%02d:%02d\", hora, minuto);\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdio.h>\nint main()\n{\n int n1,n2;\n scanf(\"%2d:%2d\",&n1,&n2);\n \n n1=n1*100;\n n1=n1+n2;\n \n if(n1<110) printf(\"01:10\\n\");\n else \n\t if(n1<220) printf(\"02:20\\n\");\n else \n\t if(n1<330) printf(\"03:30\\n\");\n else \n\t if(n1<440) printf(\"04:40\\n\");\n else \n\t if(n1<550) printf(\"05:50\\n\");\n else \n\t if(n1<1001) printf(\"10:01\\n\");\n else \n\t if(n1<1111) printf(\"11:11\\n\");\n else \n\t if(n1<1221) printf(\"12:21\\n\");\n else \n\t if(n1<1331) printf(\"13:31\\n\");\n else \n\t if(n1<1441) printf(\"14:41\\n\");\n else \n\t if(n1<1551) printf(\"15:51\\n\");\n else \n\t if(n1<2002) printf(\"20:02\\n\");\n else \n\t if(n1<2112) printf(\"21:12\\n\");\n else \n\t if(n1<2222) printf(\"22:22\\n\");\n else \n\t if(n1<2332) printf(\"23:32\\n\");\n else \n\t if(n1!=0) printf(\"00:00\\n\");\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint re (int d);\nint main()\n{ int a,b;\n scanf(\"%d:%d\",&a,&b);\n if(a==23) {\n if(b<32) printf(\"23:32\");\n else printf(\"00:00\"); }\n else if(a>=5&&a<=9) printf(\"10:01\");\n else if(a>=15&&a<=19) printf(\"20:02\");\n else {\n if(b<re(a)) printf(\"%02d:%02d\",a,re(a));\n else {printf(\"%02d:%02d\",a+1,re(a+1)); }}\n\n return 0;\n}\n\nint re(int d)\n\n {\n\n int y = (d%10);\n\n return (y*10+(d/10));\n\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char tiempo[6];\n char hora[3],minuto[3],hc[3],haux[2];\n int aux;\n scanf(\"%s\",tiempo);\n\n hora[0]=tiempo[0];\n hora[1]=tiempo[1];\n hora[2]='\\0';\n\n minuto[0]=tiempo[3];\n minuto[1]=tiempo[4];\n minuto[2]='\\0';\n\n haux[1]='\\0';\n\n hc[1]=tiempo[0];\n hc[0]=tiempo[1];\n hc[2]='\\0';\n\n if(atoi(hora)<10)\n {\n if(atoi(hora)<6)\n {\n if(atoi(hc) > atoi(minuto))\n {\n strcpy(minuto,hc);\n }\n else\n {\n aux = atoi(hora)+1;\n itoa(aux,haux,10);\n hora[1] = haux[0];\n minuto[0]=hora[1];\n minuto[1]=hora[0];\n }\n }\n else\n {\n strcpy(hora,\"10\");\n strcpy(minuto,\"01\");\n }\n }\n else if(atoi(hora)==15 && atoi(minuto)>=51)\n {\n strcpy(hora,\"20\");\n strcpy(minuto,\"02\");\n }\n else if(atoi(hora)>15 && atoi(hora)<20)\n {\n strcpy(hora,\"20\");\n strcpy(minuto,\"02\");\n }\n else if(atoi(hc) > atoi(minuto))\n {\n strcpy(minuto,hc);\n }\n else if(atoi(hora) == 23)\n {\n strcpy(hora,\"00\");\n strcpy(minuto,\"00\");\n }\n else\n {\n aux = atoi(hora)+1;\n itoa(aux,hora,10);\n minuto[0]=hora[1];\n minuto[1]=hora[0];\n }\n printf(\"%s:\",hora);\n printf(\"%s\",minuto);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nchar enteroACaracter(int numero);\n\nint main() {\n char cad[6];\n scanf(\"%s\", cad);\n int hh, mm, auxh,i;\n char HH[3], MM[3], auxH[3];\n\n HH[0] = cad[0];\n HH[1] = cad[1];\n\n MM[0] = cad[3];\n MM[1] = cad[4];\n\n hh = atoi(HH);\n mm = atoi(MM);\n\n auxH[0] = HH[1];\n auxH[1] = HH[0];\n\n auxh = 0;\n auxh=atoi(auxH);\n \n if (auxh <= mm || auxh > 59) {\n if (hh == 23) {\n hh = 0;\n mm = 0;\n } else {\n hh++;\n auxH[0] = enteroACaracter(hh / 10);\n auxH[1] = enteroACaracter(hh % 10);\n\n HH[0] = auxH[1];\n HH[1] = auxH[0];\n\n mm = atoi(HH);\n while (mm > 59) {\n hh++;\n auxH[0] = enteroACaracter(hh / 10);\n auxH[1] = enteroACaracter(hh % 10);\n\n HH[0] = auxH[1];\n HH[1] = auxH[0];\n\n mm = atoi(HH);\n }\n }\n\n } else {\n mm = auxh;\n }\n if(hh<10 && mm<10){\n printf(\"0%d:0%d\", hh, mm);\n }else if(mm<10){\n printf(\"%d:0%d\", hh, mm);\n }else if(hh<10){\n printf(\"0%d:%d\", hh, mm);\n }else{\n printf(\"%d:%d\", hh, mm);\n }\n\n\n\n\n return (EXIT_SUCCESS);\n}\n\nchar enteroACaracter(int numero) {\n return numero + '0';\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char hora[6],h[3],m[3];\n int palin,HoraD[5],sig,sumah,sumam,auxpalin;\n\n gets(hora);\n\n //scanf(\"%[^\\n]s\",&hora);\n //printf(\"%s\",hora);\n h[0] = hora[0];\n h[1] = hora[1];\n m[0] = hora[3];\n m[1] = hora[4];\n\n //printf(\"%c\",AuxDCambio);\n HoraD[2]=atoi(m)/10;//convierte a int\n HoraD[3]=atoi(m)%10;\n HoraD[0]= atoi(h)/10;\n HoraD[1]= atoi(h)%10;\n\n sumah=HoraD[0]*10 + HoraD[1];\n sumam=HoraD[2]*10 + HoraD[3];\n auxpalin=HoraD[1]*10 + HoraD[0];\n //printf(\"%d : %d\\n%d\\n\",sumah,sumam,auxpalin);\n if(sumah<=sumam)\n {\n if(sumam>auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam==auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam<auxpalin)\n {\n sig=0;\n palin=0;\n }\n }\n //else if(sumah==sumam)\n //{\n // palin=1;\n // sig=1;\n // }\n else if(sumah>sumam)\n {\n sig=0;\n palin=0;\n\n }\n\n if(sumah==23 )\n {\n if(sig==1)\n {\n printf(\"00:00\");\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"23:32\");\n exit(0);\n }\n }\n else if(HoraD[1]>5 )\n {\n if(HoraD[0]==0)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"20:02\");\n exit(0);\n }\n }\n else if (HoraD[1]<5)\n {\n //if(sum)\n //{\n if(sig==1 || palin==1)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1]+1,HoraD[1]+1,HoraD[0]);\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1],HoraD[1],HoraD[0]);\n exit(0);\n }\n //}\n }\n else if (HoraD[1]==5)\n {\n if(HoraD[0]==0)\n {\n if(sig==1)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n else if(HoraD[0]==1)\n {\n if(sig==1)\n {\n printf(\"20:02\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint chequearIgualdad(int hora, int min);\n\nint main(){\n char tiempo[5];\n\n int hora = 0,min = 0;\n int * h = &hora;\n int * m = &min;\n\n fflush(stdin);\n scanf(\"%s\", tiempo);\n\n hora = (tiempo[0] - '0') * 10 + (tiempo[1] - '0');\n min = (tiempo[3] - '0') * 10 + (tiempo[4] - '0');\n\n if(!chequearIgualdad(hora,min)){\n if(min == 59){\n min = 0;\n if(hora == 23){\n hora = 0;\n }else{\n hora++;\n }\n }else{\n min++;\n }\n }\n\n while (chequearIgualdad(hora,min)){\n if(min == 59){\n min = 0;\n if(hora == 23){\n hora = 0;\n }else{\n hora++;\n }\n }else{\n min++;\n }\n }\n\n if(hora<10 && min<10){\n printf(\"0%d:0%d\",hora,min);\n }else if(hora<10){\n printf(\"0%d:%d\",hora,min);\n }else if(min<10){\n printf(\"%d:0%d\",hora,min);\n }else{\n printf(\"%d:%d\",hora,min); \n }\n \n return 0;\n}\n\nint chequearIgualdad(int hora, int min){\n int dec,un; \n\n un = min%10;\n dec = min/10;\n\n min = un*10 + dec;\n\n if(hora == min){\n return 0;\n }else{\n return 1;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n1,n2,i,p;\n char ch;\n scanf(\"%d%c%d\",&n1,&ch,&n2);\n\n p=n1;\n if(n1<10)\n n1=n1*10;\n else\n n1=((n1%10)*10)+(n1/10)%10;\n if(p==23&&n2>=32)\n printf(\"00:00\\n\");\n else if(p==23)\n printf(\"23:32\\n\");\n else if(p==5&&n2>n1&&p<10)\n printf(\"10:01\\n\");\n else if(p==5&&p<10)\n printf(\"0%d:%d\\n\",p,n1);\n else if(p>5&&p<10)\n printf(\"10:01\\n\");\n else if(p>=15&&n2>=p&&p<20)\n printf(\"20:02\\n\");\n else if(p>=15&&p<20&&n2>p)\n printf(\"%d:%d\\n\",p,n1);\n else if(p<=4&&n2<n1)\n printf(\"0%d:%d\\n\",p,n1);\n else\n {\n if(n2<n1&&p>10)\n printf(\"%d:%d\\n\",p,n1);\n else if(n2<n1&&p<10)\n printf(\"0%d:%d\\n\",p,n1);\n else\n {\n p++;\n n2=((p%10)*10)+(p/10)%10;\n if(p<10)\n printf(\"0%d:%d\\n\",p,n2);\n else\n printf(\"%d:%d\\n\",p,n2);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j;\n char s[2];\n scanf(\"%d%*c%d\",&a,&b);\n if(a>=1&&a<=4)\n {\n if(b>=a*10)\n {\n printf(\"0%d:%d\",a+1,(a+1)*10);\n }\n else\n {\n printf(\"0%d:%d\",a,a*10);\n }\n\n }\n else if(a>=5&&a<=9)\n {\n if(a==5&&b<a*10)\n {\n printf(\"0%d:%d\",a,a*10);\n }\n else{ printf(\"10:01\");}\n\n }\n else if(a>=15&&a<=19)\n {\n if(a==15&&b<51)\n {\n printf(\"15:51\");\n }\n else{printf(\"20:02\");}\n\n }\n else if(a>=10&&a<=14)\n {\n\n c=a%10;\n c=c*10;\n c=c+1;\n if(b>=c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else if(a>=20&&a<=22)\n {\n\n c=a%20;\n c=c*10;\n c=c+2;\n if(b>=c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else if(a==23)\n\n {\n if(b<32)\n {\n printf(\"23:32\");\n }\n else\n {\n printf(\"00:00\");\n }\n\n }\n else if(a==0)\n {\n printf(\"01:10\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,c,b;\n\tchar b1,b2,b3;\n\tscanf(\"%d%c%d\",&a,&b3,&c);\n\t//\tprintf(\"%d %d\",a,c);\n//\ta = 0;\n//\tb = 0;\n\t\tint t;\n//\twhile(b < 23 )\n//\t{\n\t\tt=(a%10)*10 + a/10;\n\t\tif(t > 59 || t <= c)\n\t\t{\n\t\t\tif(a!=23)\n\t\t\t\ta=a+1;\n\t\t\telse\n\t\t\t\ta=0;\n\n\t\t\tt=(a%10)*10 + a/10;\n\n\t\t\twhile(t > 59)\n\t\t\t{\n\t\t\t\tif(a!=23)\n\t\t\t\t\ta=a+1;\n\t\t\t\telse\n\t\t\t\t\ta=0;\n\t\t\t\tt=(a%10)*10 + a/10;\n\t\t\t}\n\n\n\t\t\tif(a!=0 && a>9)\n\t\t\t\tprintf(\"%d:%d%d\\n\",a,a%10,a/10);\n\t\t\telse if(a==0)\n\t\t\t{\n\t\t\t\tprintf(\"00:00\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"0%d:%d0\\n\",a,a);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\tif(a!=0 && a>9)\n\t\t\t\tprintf(\"%d:%d%d\\n\",a,a%10,a/10);\n\t\t\telse if(a==0)\n\t\t\t{\n\t\t\t\tprintf(\"00:00\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"0%d:%d0\\n\",a,a);\n\t\t\t}\n\t\t}\n\t//\tb++;\n\t//\ta=b;\n\t//}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n int h1,h2,m1,m2,ig;\n char HM[6],H1[2],H2[2],M1[2],M2[2];\n fgets(HM,6,stdin);\n H1[0]=HM[0];\n H2[0]=HM[1];\n M1[0]=HM[3];\n M2[0]=HM[4];\n h1=atoi(H1);\n h2=atoi(H2);\n m1=atoi(M1);\n m2=atoi(M2);\n ig=0;\n m2++;\n while(h1<3 && ig!=1){\n if(h1==2){\n while(h2<4 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n else{\n while(h2<10 && ig!=1){\n while(m1<6 && ig!=1){\n while(m2<10 && ig!=1){\n if(h1==m2 && h2==m1){\n ig=1;\n printf(\"%d%d:%d%d\\n\",h1,h2,m1,m2);\n }\n m2++;\n }\n m2=0;\n m1++;\n }\n m1=0;\n h2++;\n }\n }\n h2=0;\n h1++;\n if(h1==3){\n h1=0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <malloc.h>\nchar* substring(char*, int, int);\n//je\nint main()\n{\n char str[10], *temp1,*temp2;\n int position, length,a,b,bandera;\n gets(str);\n temp1= substring( str,0,2);\n temp2= substring( str,4,2);\n a=atoi(temp1);\n b=atoi(temp2);\n bandera=0;\n while (bandera==0){\n\t\tb=b+1;\n\t\tif (b==60){\n\t\t\ta=a+1;\n\t\t\tb=00;\n\t\t\tif(a==24){\n\t\t\t\ta=00;\n\t\t\t}\n\t\t}\n sprintf(temp1,\"%02d\",a);\n sprintf(temp2,\"%02d\",b);\n if(temp1[0]==temp2[1] && temp1[1]==temp2[0]){\n\t\t\tprintf(\"%s:%s\",temp1,temp2);\n\t\t\tbandera=1;\n }\n\n }\n return 0;\n}\n\n\nchar *substring(char *str, int position, int length)\n{\n char *pointer;\n int c;\n pointer = malloc(length+1);\n if (pointer == NULL){\n printf(\"Unable to allocate memory.\\n\");\n exit(EXIT_FAILURE);\n }\n for (c = 0 ; c < position -1 ; c++)\n str++;\n\n for (c = 0 ; c < length ; c++){\n *(pointer+c) = *str;\n str++;\n }\n\n *(pointer+c) = '\\0';\n\n return pointer;\n\n}\n"}, {"source_code": "//Palindromic Times\n\n# include <stdio.h>\n\n\n\nint main()\n{\n char tiempo[6];\n char hora[3];\n char minuto [3];\n char horai[3];\n int h, m, hi;\n\n scanf(\"%s\", tiempo);\n\n hora[0] = horai[1] = tiempo[0];\n hora[1] = horai[0] = tiempo[1];\n hora[2] = horai[2] = '\\0';\n\n minuto[0] = tiempo [3];\n minuto[1] = tiempo [4];\n minuto[2] = '\\0';\n\n h = atoi(hora);\n m = atoi(minuto);\n hi = atoi(horai);\n\n if(hi > m && hi < 60)\n {\n tiempo[3] = tiempo[1];\n tiempo[4] = tiempo[0];\n printf(\"%s\", tiempo);\n }\n else\n {\n h++;\n while( (h > 05 && h < 10) || (h > 15 && h < 20) )\n h++;\n\n if(h == 24)\n h = 00;\n\n sprintf(hora,\"%02d\",h);\n printf (\"%s:%c%c\", hora, hora[1], hora[0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void){\n int minuto=0,hora=0;\n char txt[5]={'0','0','0','0','0'}; //Inicializacion de la cadena que guarda el modelo HH:MM\n scanf(\"%s\",&txt);//Carga de la hora en formato HH:MM\n getchar();\n fflush (stdin);\n hora=(txt[0]-'0')*10; //En la variable 'hora' se carga la decena de la hora introducida\n hora=hora+txt[1]-'0'; //Se carga la unidad de la hora en la variable 'hora' y se le suma a la decena extraida en la linea 10\n minuto=(txt[3]-'0')*10; //En la variable 'minuto' se carga la decena del minuto introducido\n minuto=minuto+txt[4]-'0'; //Se carga la unidad del minuto en la variable 'minuto' y se le suma a la decena extraida en la linea 12\n minuto++; //Aumentamos el minuto en uno por si se introdujo un hora capicua\n while(minuto>0)\n {\n if(minuto==60)//Si el minuto es 60 entonces agregamos sumamos 1 a hora y minuto vuelve a 0\n {\n minuto=0;\n hora++;\n if(hora==24) //Si hora es 24 se reinicia el reloj a la hora 00\n {\n hora=0;\n }\n }\n txt[0]=floor(hora/10)+'0'; //Se vuelve cada digito nuevamente a su posicion correspondiente en el array de char\n txt[1]=hora%10+'0';\n txt[3]=floor(minuto/10)+'0';\n txt[4]=minuto%10+'0';\n if(txt[0]==txt[4] && txt[1]==txt[3]) //Cuando se cumple la condicion de capicua se imprime y rompe el ciclo\n {\n printf(\"%s\",txt);\n break;\n }\n minuto++; //Contador de minuto para buscar la siguiente hora capicua\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n do\n {\n ++mm;\n if (mm == 60)\n {\n ++hh;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n } while (hh % 10 * 10 + hh / 10 != mm);\n printf(\"%02d:%02d\\n\", hh, mm);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint telll(int);\nint printit(int);\nint palindrome(int a,int b);\nint main()\n{\n char c[6];\n scanf(\"%s\",c);\n int a=0,b=0,d=0;\n a=c[1]-'0';\n b=c[0]-'0';\n a=(b*10)+a;\n b=c[3]-'0';\n d=c[4]-'0';\n b=(b*10)+d;\n int e;\n d=a;\n e=b;\n int t=0;\n if(palindrome(d,e))\n {\n e++;\n }\n do\n {\n int k=telll(d);\n\n if(e<=k)\n {\n if(k>59)\n {\n d++;\n }\n else\n {\n printit(d);\n printf(\":\");\n printit(k);\n return 0;\n }\n }\n else if(e>k)\n {\n d++;\n }\n if(d>23)\n {\n d=00;\n }\n e=00;\n }while(!palindrome(d,e));\n printit(d);\n printf(\":\");\n printit(e);\n return 0;\n\n\n\n\n}\nint telll(int j)\n{\n int l;\n l=j%10;\n j=j/10;\n l=(l*10)+j;\n return l;\n}\nint palindrome(int a,int b)\n{\n int c,d;\n c=a%10;\n a=a/10;\n d=b%10;\n b=b/10;\n if((c==b)&&(a==d))\n {\n return 1;\n }\n else\n {\n return 0;\n }\n}\nint printit(int a)\n{\n if(a<10)\n {\n switch(a)\n {\n case 1 :printf(\"01\");\n break;\n case 2 :printf(\"02\");\n break;\n case 3 :printf(\"03\");\n break;\n case 4 :printf(\"04\");\n break;\n case 5 :printf(\"05\");\n break;\n case 6 :printf(\"06\");\n break;\n case 7 :printf(\"07\");\n break;\n case 8 :printf(\"08\");\n break;\n case 9 :printf(\"09\");\n break;\n case 0 :printf(\"00\");\n break;\n }\n }\n else\n {\n printf(\"%d\",a);\n }\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int soat,min;\n void inc(){\n min++;\n if(min==60){\n min=0;\n soat++;\n if(soat==24)soat=0;\n }\n }\n int main()\n {\n soat=getchar()-48;soat=soat*10+getchar()-48;\n getchar();\n min=getchar()-48;min=min*10+getchar()-48;\n inc();\n while((soat%10)*10+soat/10!=min)inc();\n printf(\"%02d:%02d\",soat,min);\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j;\n char s[2];\n scanf(\"%d%*c%d\",&a,&b);\n if(a>=1&&a<=4)\n {\n if(b>a*10)\n {\n printf(\"0%d:%d\",a+1,(a+1)*10);\n }\n else\n {\n printf(\"0%d:%d\",a,a*10);\n }\n\n }\n else if(a>=5&&a<=9)\n {\n if(a==5&&b<a*10)\n {\n printf(\"0%d:%d\",a,a*10);\n }\n else{ printf(\"10:01\");}\n\n }\n else if(a>=15&&a<=19)\n {\n if(a==15&&b<51)\n {\n printf(\"15:51\");\n }\n else{printf(\"20:02\");}\n\n }\n else if(a>=10&&a<=14)\n {\n\n c=a%10;\n c=c*10;\n c=c+1;\n if(b>=c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else if(a>=20&&a<=22)\n {\n\n c=a%20;\n c=c*10;\n c=c+2;\n if(b>=c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else if(a==23)\n\n {\n if(b<32)\n {\n printf(\"23:32\");\n }\n else\n {\n printf(\"00:00\");\n }\n\n }\n else if(a==0)\n {\n printf(\"01:10\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n int h1, h2, m1, m2, hora, minuto, m_invertido;\n h1 = getchar() - '0';\n h2 = getchar() - '0';\n hora = h1 * 10 + h2;\n getchar();\n m1 = getchar() - '0';\n m2 = getchar() - '0';\n minuto = m1 * 10 + m2;\n\n while(1)\n {\n minuto++;\n if(minuto == 60)\n {\n minuto = 0;\n hora++;\n if(hora == 24) hora = 0;\n }\n if(hora / 10 == minuto % 10 && hora %10 == minuto / 10)\n {\n printf(\"%02d:%02d\", hora, minuto);\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "#include<string.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n#include<ctype.h>\n\n#define MAX( a, b ) ( ( a > b) ? a : b ) \n#define MIN( a, b ) ( ( a < b) ? a : b )\n#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)\n#define and &&\n#define or ||\nint main () {\n\nint x=0,n=0,s=0,i,j,a[10];\nchar b;\nscanf(\"%d\",&x);\nscanf(\"%c\",&b);\nscanf(\"%d\",&s);\nn+=((x%10)*10)+x/10;\nif(x>5 and x<10){\n printf(\"10:01\");\n return 0;\n}\nif(s<n and n<60){\n if(x<10)\n printf(\"0%d:\",x);\n else\n printf(\"%d:\",x);\n if(n<10)\n printf(\"0%d\",n);\n else\n printf(\"%d\",n);\n return 0;}\nif(x<23 and n+10<60){\n if(x<10)\n printf(\"0%d:%d\",x+1,n+10);\n else\n printf(\"%d:%d\",x+1,n+10);\n return 0;}\nif(n+10>=60){\n printf(\"20:02\");\n return 0;}\nprintf(\"00:00\");\n\n\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nchar enteroACaracter(int numero);\n\nint main() {\n char cad[6];\n scanf(\"%s\", cad);\n char HH[3], MM[3], auxH[3];\n HH[0] = '\\0';\n MM[0] = '\\0';\n int i;\n\n HH[0] = cad[0];\n HH[1] = cad[1];\n\n MM[0] = cad[3];\n MM[1] = cad[4];\n\n int hh, mm, auxh;\n hh = atoi(HH);\n mm = atoi(MM);\n\n\n auxH[0] = HH[1];\n auxH[1] = HH[0];\n\n auxh = 0;\n for (i = 0; i < 2; i++) {\n auxh = auxh + (auxH[i] - 48);\n if (i == 0) {\n auxh *= 10;\n }\n\n }\n \n if (auxh <= mm || auxh > 59) {\n if (hh == 23) {\n hh = 0;\n mm = 0;\n } else {\n hh++;\n auxH[0] = enteroACaracter(hh / 10);\n auxH[1] = enteroACaracter(hh % 10);\n\n HH[0] = auxH[1];\n HH[1] = auxH[0];\n\n mm = atoi(HH);\n while (mm > 59) {\n hh++;\n auxH[0] = enteroACaracter(hh / 10);\n auxH[1] = enteroACaracter(hh % 10);\n\n HH[0] = auxH[1];\n HH[1] = auxH[0];\n\n mm = atoi(HH);\n }\n }\n\n } else {\n mm = auxh;\n }\n if(hh<10 && mm<10){\n printf(\"0%d:0%d\", hh, mm);\n }else if(mm<10){\n printf(\"%d:0%d\", hh, mm);\n }else if(hh<10){\n printf(\"0%d:%d\", hh, mm);\n }else{\n printf(\"%d:%d\", hh, mm);\n }\n\n\n\n\n return (EXIT_SUCCESS);\n}\n\nchar enteroACaracter(int numero) {\n return numero + '0';\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint hh,mm,ban=1;\n\tscanf(\"%d:%d\",&hh,&mm);\n\twhile(ban){\n\t\tmm++;\n\t\tif(mm==60){\n\t\t\tmm=0;\n\t\t\thh++;\n\t\t}\n\t\tif(hh==24){\n\t\t\thh=0;\n\t\t}\n\t\tif(hh%10==mm/10 && hh/10==mm%10){\n\t\t\tban=0;\n\t\t\tif(hh/10==0 && mm/10!=0){\n\t\t\t\tprintf(\"0%d:%d\",hh,mm);\n\t\t\t}else if(hh/10!=0 && mm/10==0){\n\t\t\t\tprintf(\"%d:0%d\",hh,mm);\n\t\t\t}else if(hh/10==0 && mm/10==0){\n\t\t\t\tprintf(\"0%d:0%d\",hh,mm);\n\t\t\t}else\n\t\t\t\tprintf(\"%d:%d\",hh,mm);\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint inv(int a);\n\nint main()\n{\n\tchar cad[5]={\"\"}, hora[3], min[3];\n\tscanf(\"%s\", cad);\n\tstrncpy(hora, cad, 2);\n\tstrncpy(min, &cad[3], 2);\n\tint h=atoi(hora), m=atoi(min);\t\t\t\t//h va ser la hora de la cadena y m el minuto\n\tint exito=0;\n\tif (m>=inv(h) || (h>5 && h<10) || (h>15 && h<20))\n\t{\n\t\th++;\n\t\tif (h>5 && h<10)\t\t\t\t\t\t//los intervalos en que no puede ser capicua\n\t\t{\n\t\t\tprintf(\"10:01\\n\");\n\t\t\texito=1;\n\t\t}\n\t\telse if (h>15 && h<20)\n\t\t{\n\t\t\tprintf(\"20:02\\n\");\n\t\t\texito=1;\n\t\t}\n\t\telse if (h==24)\t\t\t\t\t\t\t//caso sencillo 24=00\n\t\t{\n\t\t\tprintf(\"00:00\\n\");\n\t\t\texito=1;\n\t\t}\n\t\tif (exito==0)\t\t\t\t\t\t\t//si no entro en uno de los casos sencillos\n\t\t{\n\t\t\tif (h<10)\n\t\t\t\tprintf(\"0\");\n\t\t\tprintf(\"%d:\", h);\n\t\t\tif (inv(h)<10)\n\t\t\t\tprintf(\"0\");\n\t\t\tprintf(\"%d\\n\", inv(h));\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (h<10)\n\t\t\tprintf(\"0\");\n\t\tprintf(\"%d:\", h);\n\t\tif (inv(h)<10)\n\t\t\tprintf(\"0\");\n\t\tprintf(\"%d\\n\", inv(h));\t\n\t}\n\treturn 0;\n}\n\nint inv(int a)\n{\t//retorna el inverso de un numero de 2 digitos\n\treturn a/10+(a%10)*10;\n}"}, {"source_code": "/*\n * =====================================================================================\n *\n * Filename: 4.c\n *\n * Description: \n *\n * Version: 1.0\n * Created: 05/14/2013 09:36:55 PM\n * Revision: none\n * Compiler: gcc\n *\n * Author: Devansh T Shah (@d), \n * Company: IIIT Hyd\n *\n * =====================================================================================\n */\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <limits.h>\n#define si(n) scanf(\"%d\",&n)\n#define rep(i,n) for(i=0;i<n;i++)\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define nl printf(\"\\n\")\n#define sp printf(\" \")\n#define dbg(n) printf(\" #n -- > %d\\n\",n)\n#define dbg2(m,n) printf(\" #m -- > %d #n --> %d\\n\",m,n)\n#define pi(n) printf(\"%d\",n)\n#define pll(n) printf(\"%lld\",n)\n#define sll(n) scanf(\"%lld\",&n)\n#define ss(s) scanf(\"%s\",s)\n#define ps(s) printf(\"%s\",s)\n#define INF 100000009\ntypedef long long LL;\n\nint palindrome(int n)\n{\n int x=n/10+(n%10)*10;\n return x;\n}\n\nint main()\n{\n int a,b,fg=1,pal;\n scanf(\"%d:%d\",&a,&b);\n while(fg)\n {\n\tpal=palindrome(a);\n\tif(a>=6&&a<=9)\n\t{\n\t printf(\"10:01\\n\");\n\t break;\n\t}\n\telse if(a>=16&&a<=19)\n\t{\n\t printf(\"20:02\\n\");\n\t break;\n\t}\n\tif(pal>b)\n\t{\n\t printf(\"%02d:%02d\\n\",a,pal);\n\t break;\n\t}\n\tb=-INF;\n\ta=a+1;\n\tif(a==24)\n\t{\n\t printf(\"00:00\\n\");\n\t fg=0;\n\t}\n\t}\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n//franciscolezcano\nmain()\n{\n int h, m, c, f, u ,d, hh, i, m2;\n\n i = 1;\n\n scanf( \"%d:%d\", &h, &m );\n\n m2 = m;\n\n for( c = h; c <= 23 && i == 1; c++ )\n {\n for( f = m2 + 1; f <= 51 && i == 1; f ++ )\n {\n d = c / 10;\n u = c - ( d * 10 );\n hh = ( u * 10 ) + d;\n if( hh == f )\n {\n printf( \"%02d:%02d\\n\", c, f );\n i = 0;\n }\n }\n m2 = 0;\n }\n\n if( h >= 23 && m >= 32 )\n {\n printf( \"00:00\\n\" );\n }\n\n return;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n, mm;\n char z;\n scanf(\"%d %c %d\", &n, &z, &mm);\n if(n>=0 && n<=4)\n {\n if(mm >= (((n)%10)*10)+n/10) n=n+1;\n printf(\"0%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(mm<50 && n==5)\n {\n printf(\"05:50\\n\");\n }\n else if(n>=5 && n<=9)\n {\n printf(\"10:01\\n\");\n }\n else if(n>=10 && n<=14)\n {\n if(mm >= (((n)%10)*10)+n/10) n=n+1;\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(mm<51 && n==15)\n {\n printf(\"15:51\\n\");\n }\n else if(n>=15 && n<=19)\n {\n printf(\"20:02\\n\");\n }\n else if(n>=20 && n<=22)\n {\n if(mm >= (((n)%10)*10)+n/10) n=n+1;\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(mm<32 && n==23)\n {\n printf(\"23:32\\n\");\n }\n else\n {\n printf(\"00:00\\n\");\n }\n}\n"}, {"source_code": "//Code forces 108A\n#include<stdio.h>\nint main()\n{\n int hh,mm,temph,tempm;\n scanf(\"%d:%d\",&hh,&mm);\n while(1)\n {\n mm++;\n if(mm==60){hh++;mm=0;}\n if(hh==24) hh=0;\n temph=hh/10;\n tempm=mm/10;\n if((tempm==hh%10) && (temph==mm%10)){printf(\"%02d:%02d\",hh,mm);return 0;}\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n int Aux,i;\n float H;\n\n scanf(\"%d:%d\",&hora,&Min);\n //Calcula la siguiente hora inmediata//\n if(Min<59)\n Min++;\n else{\n Min=0;\n hora++;\n }\n while(hora!=24){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n for (i=Min;Min<=59;Min++){\n if(H==Min){\n if(hora<10){\n printf(\"0%d:\",hora);\n }\n else{\n printf (\"%d:\",hora);\n }\n if(Min<10){\n printf(\"0%d\",Min);\n }\n else{\n printf (\"%d\",Min);\n }\n break;\n }\n }\n if(H==Min)\n break;\n hora++;\n Min=1;\n }\n if(hora==24)\n printf(\"00:00\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint funcelias (char a);\n\nint main()\n{\n\tint i,j=0,k,l ;\n\tint aux[4];\n\tchar hora[6];\n\tint flag=0 ;\n\tscanf(\"%s\", hora) ;\n\n\n\tfor(i=0;'\\0'!=hora[i];i++){\n\n\t\tif(funcelias(hora[i])!=-1){\n\t\t\taux[j]=funcelias(hora[i]);\n\t\t\tj++;\n\t\t}\n\t}\n\taux[3]+=1;\n\tif((aux[0]*10+aux[1])<24)\n\t{\n\t\twhile(flag!=1){\n\n\t\tfor(i=aux[0] ; i<3 && flag==0; i++)\n\t\t{\n\t\t\tfor(k=aux[1] ; (k<4 && flag==0) || (i<2 && k<10 && flag==0); k++)\n\t\t\t{\n\t\t\t\tfor(j=aux[2] ; j<6 && flag==0; j++)\n\t\t\t\t{\n\t\t\t\t\tfor(l=aux[3] ; l<10 && flag==0; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(i==l && k==j)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1 ;\n\t\t\t\t\t\t\tprintf(\"%d%d:%d%d\",i,k,j,l) ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\taux[3]=0;\n\t\t\t\t}\n\t\t\t\taux[2]=0;\n\t\t\t}\n\t\t\taux[1]=0;\n\n\t\t}\n\t\taux[0]=0;\n\n\t\t}\n\t}\n\treturn 0 ;\n}\nint funcelias (char a)\n{\n\tint i;\n\n\tchar numero[]= {'0','1','2','3','4','5','6','7','8','9'}\t;\n\tfor(i=0; i<10; i++)\n\t{\n\n\t\tif(a==numero[i])\n\t\t{\n\t\t\treturn i;\n\t\t}\n\n\t}\n\treturn -1;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n int Aux,i;\n float H;\n\n scanf(\"%d:%d\",&hora,&Min);\n\n //Calcula la siguiente hora inmediata//\n if(Min<59)\n Min++;\n else{\n Min=0;\n hora++;\n }\n while(hora!=24){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n for (i=Min;Min<=59;Min++){\n if(H==Min){\n if(hora<10){\n printf(\"0%d:\",hora);\n }\n else{\n printf (\"%d:\",hora);\n }\n if(Min<10){\n printf(\"0%d\",Min);\n }\n else{\n printf (\"%d\",Min);\n }\n break;\n }\n }\n if(H==Min)\n break;\n hora++;\n Min=1;\n }\n if(hora==24)\n printf(\"00:00\");\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint reverse(int a) {\n\t\n\treturn (a % 10) * 10 + ((a / 10) % 10);\n\t\n}\n\nint main() {\n\tint h, m;\n\t\n\twhile (scanf(\"%d:%d\", &h, &m) != EOF)\n\t{\n\t\tif (h == reverse(m) || reverse(h) < m)\n\t\t\th++;\n\t\t\n\t\tif (h > 5 && h < 10) //6 ao 9, 16 ao 19\n\t\t\th = 10;\n\t\telse\n\t\t\tif (h > 15 && h < 20)\n\t\t\t\th = 20;\n\t\t\n\t\tif (h > 23)\n\t\t\th = 0;\n\t\t\n\t\tm = reverse(h);\n\t\t\n\t\tprintf(\"%.2d:%.2d\\n\", h, m);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "//Palindromic Times\n\n# include <stdio.h>\n\n\n\nint main()\n{\n char tiempo[6];\n char hora[3];\n char minuto [3];\n char horai[3];\n int h, m, hi;\n\n scanf(\"%s\", tiempo);\n\n hora[0] = horai[1] = tiempo[0];\n hora[1] = horai[0] = tiempo[1];\n hora[2] = horai[2] = '\\0';\n\n minuto[0] = tiempo [3];\n minuto[1] = tiempo [4];\n minuto[2] = '\\0';\n\n h = atoi(hora);\n m = atoi(minuto);\n hi = atoi(horai);\n\n if(hi > m && hi < 60)\n {\n tiempo[3] = tiempo[1];\n tiempo[4] = tiempo[0];\n printf(\"%s\", tiempo);\n }\n else\n {\n h++;\n while( (h > 05 && h < 10) || (h > 15 && h < 20) )\n h++;\n\n if(h == 24)\n h = 00;\n\n sprintf(hora,\"%02d\",h);\n printf (\"%s:%c%c\", hora, hora[1], hora[0]);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n\tint h,m;\n\tscanf(\"%d:%d\",&h,&m);\n\twhile(1){\n\t\tm++;\n\t\tif(m==60){m=0;h=(h+1)%24;}\n\t\tif((m%10==h/10)&&(h%10==m/10)){\n\t\t\tprintf(\"%02d:%02d\",h,m);\n\t\t\treturn 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int h=0,m=0,a=0,b=0;\n int c=0;\n scanf(\"%d:%d\",&h,&m);\n if(h==23){\n if(m<32){\n m=32;\n }else{\n h=0;\n m=0;\n }\n\n }else if(h>5 && h<10){\n h=10;\n m=1;\n }\n else if(h<15 || h>19){\n c=h;\n a=h/10;\n c=c-a*10;\n a=a+c*10;\n if(a>m){\n m=a;\n }else{\n h++;\n c=h;\n m=h/10;\n c=c-m*10;\n m=m+c*10;\n }\n\n }else{\n h=20;\n m=2;\n }\n if(h==0 && m==0){\n printf(\"00:00\");\n }else if(h>=0 && h<=9){\n printf(\"0%d:%d\",h,m);\n }else if(m>=0 && m<=9){\n printf(\"%d:0%d\",h,m);\n }else{\n printf(\"%d:%d\",h,m);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n int Aux,i;\n float H;\n\n scanf(\"%d:%d\",&hora,&Min);\n\n //Calcula la siguiente hora inmediata//\n if(Min<59)\n Min++;\n else{\n Min=0;\n hora++;\n }\n while(hora!=24){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n for (i=Min;Min<=59;Min++){\n if(H==Min){\n if(hora<10){\n printf(\"0%d:\",hora);\n }\n else{\n printf (\"%d:\",hora);\n }\n if(Min<10){\n printf(\"0%d\",Min);\n }\n else{\n printf (\"%d\",Min);\n }\n break;\n }\n }\n if(H==Min)\n break;\n hora++;\n Min=1;\n }\n //Caso especial cuando la hora inicial es 23:59//\n if(hora==24)\n printf(\"00:00\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l,arr[6],x,y,n,m,p;\n\tchar a[6],b[6];\n\tgets(a);\n\tl=strlen(a);\n\tx=(int)a[0];\n\ty=(int)a[1];\n\tx=x-48;\n\ty=y-48;\n\tm=(int)a[3];\n\tm=m-48;\n\tn=(int)a[4];\n\tn=n-48;\n\tp=m*10+n;\n\tif(x==1&&y>=5)\n\tprintf(\"20:02\");\n\telse if(x==2&&y==3)\n\t{\n\t\tif(p<y*10+x)\n\t\tprintf(\"%d%d:%d%d\",x,y,y,x);\n\t\telse\n\t\tprintf(\"00:00\");\n\t}\n\telse if(x==0&&y>=5)\n\t{\n\t\tif(y==5&&p<y*10+x)\n\t\t{\n\t\t\t\tprintf(\"%d%d:%d%d\",x,y,y,x);\n\t\t}\n\t\telse\n\t\tprintf(\"10:01\");\n\t}\n\telse if(x==0&&y<=4)\n{\n\tif(p<y*10+x)\n\t\tprintf(\"%d%d:%d%d\",x,y,y,x);\n\t\telse\n\t\t{\n\tx=0;\n\ty=y+1;\n\tprintf(\"%d%d:%d%d\",x,y,y,x);\n}\n}\nelse if(x==1&&y<=4)\n{\n\tif(p<y*10+x)\n\t\tprintf(\"%d%d:%d%d\",x,y,y,x);\n\t\telse\n\t{\n\ty=y+1;\n\tprintf(\"%d%d:%d%d\",x,y,y,x);\n}\n}\nelse if(x==2&&y<=2)\n{if(p<y*10+x)\n\t\tprintf(\"%d%d:%d%d\",x,y,y,x);\n\t\t{\n\tx=2;\n\ty=y+1;\n\tprintf(\"%d%d:%d%d\",x,y,y,x);\n}}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tchar temp_m1 = (Hora) / 10 +'0' ;\n\tchar temp_m2 = (Hora) % 10 + '0' ;\n\t\n\t\n\tint temp_minutos = temp_m1 - '0' + 10*(temp_m2 - '0');\n\t\n\tif ( (HH[1]!= MM[0] || HH[0] != MM[1] ) && Minutos < temp_minutos && temp_minutos < 60 ){\n\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\tprintf(\"%s:%s\", HH,MM);\t\t\n\t} else {\n\t\tHora++;\n\t\ttemp_m1 = (Hora + 1 ) / 10 +'0' ;\n\t\ttemp_m2 = (Hora + 1 ) % 10 + '0' ;\n\t\tMinutos = temp_m1 + temp_m2;\n\t\tif(Hora >=24){\n\t\t\tprintf(\"00:00\");\n\t\t} else if(Hora <= 10 && Hora >= 6 && Minutos > 60){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora <= 19 && Hora >= 16 && Minutos > 60 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d:%d\",&b,&c);\n a=(b*60)+c;\n a++;\n if(a>1412){\n printf(\"00:00\");\n }\n else{\n for(a;a<1440;a++){\n d=a/60;\n e=a-(d*60);\n if(d==((e%10)*10+(e/10)))\n break;\n }\n if(d>9&&e>9)\n printf(\"%d:%d\",d,e);\n else{\n if(d<=9&&e>9)printf(\"0%d:%d\",d,e);\n if(d>=9&&e<9)printf(\"%d:0%d\",d,e);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,t=24,k=60,l=0;\n char s;\n scanf(\"%d:%d\",&m,&n);\n while(t--)\n {while(k--)\n {\n n++;\n if(n==60)\n { n=0;\n m++;\n if(m==24)\n m=0;\n }\n if(n/10==m%10 && m/10==n%10)\n {goto x;}\n }}\n x:\n if(m/10==0)\n printf(\"%d%d\",l,m);\n else\n printf(\"%d\",m);\n printf(\":\");\n if(n/10==0)\n printf(\"%d%d\",l,n);\n else\n printf(\"%d\",n);\n\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c[10];\n scanf(\"%s\", c);\n int num1=10*(c[0]-'0')+(c[1]-'0');\n int num2=10*(c[3]-'0')+(c[4]-'0');\n //printf(\"%d %d\", num1, num2);\n int ttemp=num1;\n int pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\" %d\\n\", pnum1);\n if(num2<pnum1 && pnum1<60)\n {\n if(num1/10==0) \n {\n if(pnum1/10==0)\n {\n printf(\"0%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"0%d:%d\\n\", num1, pnum1);\n }\n else\n {\n if(pnum1/10==0)\n {\n printf(\"%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"%d:%d\\n\", num1, pnum1);\n }\n }\n //printf(\"%d:%d\\n\", num1, pnum1);\n else\n {\n while(1)\n {\n num1+=1;\n num1%=24;\n ttemp=num1;\n pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\"num1=%d pnum1=%d\\n\", num1, pnum1);\n if(pnum1<=60)\n {\n if(num1/10==0) \n {\n if(pnum1/10==0)\n {\n printf(\"0%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"0%d:%d\\n\", num1, pnum1);\n }\n else\n {\n if(pnum1/10==0)\n {\n printf(\"%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"%d:%d\\n\", num1, pnum1);\n }\n break;\n }\n }\n }\n}"}, {"source_code": "#include <stdio.h>\nint main(void){\n\tint h,m;\n\tscanf(\"%d:%d\",&h,&m);\n\twhile(1){\n\t\tm++;\n\t\tif(m==60){m=0;h=(h+1)%24;}\n\t\tif((m%10==h/10)&&(h%10==m/10)){\n\t\t\tprintf(\"%02d:%02d\",h,m);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n do\n {\n ++mm;\n if (mm == 60)\n {\n ++hh;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n } while (hh % 10 * 10 + hh / 10 != mm);\n printf(\"%02d:%02d\\n\", hh, mm);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n do\n {\n ++mm;\n if (mm == 60)\n {\n ++hh;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n } while (hh % 10 * 10 + hh / 10 != mm);\n printf(\"%02d:%02d\\n\", hh, mm);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a1,b1,i,j,len,a[18],b[18];\n char s[6];\n a[1]=0;b[1]=0;\n a[2]=0;b[2]=1;\n a[3]=0;b[3]=2;\n a[4]=0;b[4]=3;\n a[5]=0;b[5]=4;\n a[6]=0;b[6]=5;\n a[7]=1;b[7]=0;\n a[8]=1;b[8]=1;\n a[9]=1;b[9]=2;\n a[10]=1;b[10]=3;\n a[11]=1;b[11]=4;\n a[12]=1;b[12]=5;\n a[13]=2;b[13]=0;\n a[14]=2;b[14]=1;\n a[15]=2;b[15]=2;\n a[16]=2;b[16]=3;\n while(~scanf(\"%s\",s))\n {\n a1=s[0]-48;\n b1=s[1]-48;\n i=s[3]-48;\n j=s[4]-48;\n if(a1==2&&b1==3&&i*10+j>=32)\n {\n printf(\"00:00\\n\");\n continue;\n }\n for(len=1;len<17;len++)\n {\n if(a1*1000+b1*100+i*10+j<a[len]*1000+b[len]*100+b[len]*10+a[len]) \n {\n printf(\"%d%d:%d%d\\n\",a[len],b[len],b[len],a[len]);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint rev(int a){\n return (a%10)*10+a/10;\n}\nint main()\n{\n int i,h,m;\n scanf(\"%d:%d\",&h,&m);\n if(rev(h)<=(m)){\n if(h==23)printf(\"00:00\");\n else if(h>=0&&h<=5)printf(\"0%d:%d\",h+1,rev(h+1));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=15&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h+1,rev(h+1));\n }\n else {\n if(h>=0&&h<=5)printf(\"0%d:%d\",h,rev(h));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=16&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h,rev(h));\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint re (int d);\nint main()\n{ int a,b;\n scanf(\"%d:%d\",&a,&b);\n if(a==23) {\n if(b<32) printf(\"23:32\");\n else printf(\"00:00\"); }\n else if(a>=5&&a<=9) printf(\"10:01\");\n else if(a>=15&&a<=19) printf(\"20:02\");\n else {\n if(b<re(a)) printf(\"%02d:%02d\",a,re(a));\n else {printf(\"%02d:%02d\",a+1,re(a+1)); }}\n\n return 0;\n}\n\nint re(int d)\n\n {\n\n int y = (d%10);\n\n return (y*10+(d/10));\n\n }\n"}, {"source_code": "#include<stdio.h>\nint F[24][60];\nint check(char a, char b, char c, char d)\n{\n\tif (a==d && b ==c) return 1;\n\telse return 0;\n}\nvoid init()\n{\n\tint i,j;\n\tchar a,b,c,d;\n\tfor(i=0;i<24;i++)\n\t\tfor(j=0;j<60;j++)\n\t\t{\n\t\t\ta = i/10 + 48;\n\t\t\tb = i%10 + 48;\n\t\t\tc = j/10 + 48;\n\t\t\td = j%10 + 48;\n\t\t\tif (check(a,b,c,d) == 1)\n\t\t\t\tF[i][j] =1;\n\t\t\telse F[i][j] =0;\n\n\t\t}\n}\nint main()\n{\n\tint i,j,k,q,t;\n\tchar c;\n\tinit();\n\tscanf(\"%d%c%d\",&i, &c, &j);\n\tt = 0;\n\tk=i;\n\tfor(q=j+1;q<60;q++)\n\t\tif(F[k][q] == 1)\n\t\t{\n\t\t\tif(k<10 && q<10) printf(\"0%d:0%d\",k,q);\n\t\t\telse\n\t\t\t\tif(k<10 && q>=10) printf(\"0%d:%d\",k,q);\n\t\t\t\telse \n\t\t\t\t\tif(k>=10 && q<10) printf(\"%d:0%d\",k,q);\n\t\t\t\t\telse\n\t\t\t\t\t\tif(k>=10 && q>=10) printf(\"%d:%d\",k,q);\n\t\t\tt=1;\n\t\t\tbreak;\n\t\t}\n\tif(t==0)\n\t{\n\t\tfor(k=i+1;k<24;k++)\n\t\t{\n\t\t\tfor(q=0;q<60;q++)\n\t\t\t\tif(F[k][q] == 1)\n\t\t\t\t{\n\t\t\t\t\tif(k<10 && q<10) printf(\"0%d:0%d\",k,q);\n\t\t\t\t\telse\n\t\t\t\t\t\tif(k<10 && q>=10) printf(\"0%d:%d\",k,q);\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tif(k>=10 && q<10) printf(\"%d:0%d\",k,q);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif(k>=10 && q>=10) printf(\"%d:%d\",k,q);\n\t\t\t\t\tt=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif(t==1) break;\n\t\t}\n\t}\n\tif(t==0)\n\t{\n\t\tfor(k=0;k<=i;k++)\n\t\t{\n\t\t\tfor(q=0;q<60;q++)\n\t\t\t\tif(F[k][q] == 1)\n\t\t\t\t{\n\t\t\t\t\tif(k<10 && q<10) printf(\"0%d:0%d\",k,q);\n\t\t\t\t\telse\n\t\t\t\t\t\tif(k<10 && q>=10) printf(\"0%d:%d\",k,q);\n\t\t\t\t\t\telse \n\t\t\t\t\t\t\tif(k>=10 && q<10) printf(\"%d:0%d\",k,q);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif(k>=10 && q>=10) printf(\"%d:%d\",k,q);\n\t\t\t\t\tt=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif(t==1) break;\n\t\t}\n\t}\n\treturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int h=0,m=0,a=0;\n int c=0;\n scanf(\"%d:%d\",&h,&m);\n if(h==23){\n if(m<32){\n m=32;\n }else{\n h=0;\n m=0;\n }\n\n }else if(h>5 && h<10){\n h=10;\n m=1;\n }\n else if(h<15 || h>19){\n c=h;\n a=h/10;\n c=c-a*10;\n a=a+c*10;\n if(a>m){\n m=a;\n }else{\n h++;\n c=h;\n m=h/10;\n c=c-m*10;\n m=m+c*10;\n }\n\n }else{\n h=20;\n m=2;\n }\n if(h==0 && m==0){\n printf(\"00:00\");\n }else if(h>=0 && h<=9){\n printf(\"0%d:%d\",h,m);\n }else if(m>=0 && m<=9){\n printf(\"%d:0%d\",h,m);\n }else{\n printf(\"%d:%d\",h,m);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint hh,mm,a=0;\n\tchar hora[5];\n\tscanf(\"%s\",hora);\n\thh=(hora[0]-'0')*10+(hora[1]-'0');\n\tmm=(hora[3]-'0')*10+(hora[4]-'0');\n\twhile (a==0){\n\t\tmm++;\n\t\tif(mm==60){\n\t\t\tmm=0;\n\t\t\thh+=1;\n\t\t\tif (hh==24){\n\t\t\t\thh=0;\n\t\t\t}\n\t\t}\n\t\tif(hh/10==mm%10&&hh%10==mm/10){\n\t\t\ta++;\n\t\t}\n\t}\n\tif(hh<10){\n\t\tprintf(\"0%d:\",hh);\n\t}\n\telse{\n\t\tprintf(\"%d:\", hh);\n\t}\n\tif(mm<10){\n\t\tprintf(\"0%d\",mm);\n\t}\n\telse{\n\t\tprintf(\"%d\", mm);\n\t}\n\treturn 0;\n}\n\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nint main(){\n \n char lh,h,lm,m,t;\n int a,b,c,d,e,f;\n scanf(\"%c%c%c%c%c\",&lh,&h,&t,&lm,&m);\n \n a = lh-48;\n b = h-48;\n c = lm-48;\n d = m-48;\n \n while(a!=d || b!=c){\n \n if(d<9)\n d++;\n else if(d==9){\n c++;\n d=0;\n }\n \n if(c == 6 ){\n b++;\n c=0;\n }\n \n if( a==2 && b == 4){\n a++;\n b=0; \n }\n \n else if( b == 10){\n a++;\n b=0; \n }\n \n if(a==3){\n a=0;\n b=0;\n c=0;\n d=0; \n }\n \n \n }\n\n printf(\"%d%d:%d%d\",a,b,c,d); \n return 0;\n}\n/****** PCCA -Tue Oct 04 13:45:44 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid sigPalindromo(char [], char [], int, int);\nint inv (int n);\nvoid aumentar(char [], int *);\nint palindromo(char [], char []);\n\nmain()\n{\n char clock[5];\n char hora[3];\n char min[3];\n \n int vhora, vmin;\n \n scanf(\"%d:%d\", &vhora, &vmin);\n \n printf(\"%d:%d\", vhora, vmin);\n \n hora[0]=(vhora/10)+'0';\n hora[1]=(vhora%10)+'0';\n hora[2]='\\0';\n\n printf(\"\\nhora: %s\", hora);\n \n min[0]=(vmin/10)+'0';\n min[1]=(vmin%10)+'0';\n min[3]='\\0';\n \n printf(\"\\nmin: %s\", min);\n \n \n sigPalindromo(hora, min, vhora, vmin);\n \n/* printf(\"\\n\");\n system(\"pause\");*/\n \n return 0;\n}\nint palindromo(char hora[], char min[])\n{\n if(hora[0]==min[1] && hora[1]==min[0])\n return 1;\n else\n return 0;\n}\n\n\nvoid sigPalindromo(char hora[], char min[], int vhora, int vmin)\n{\n if(vhora>15 && vhora<20)\n {\n printf(\"\\n20:02\");\n }\n else if(vhora>5 && vhora<10)\n {\n printf(\"\\n10:01\");\n }\n else if(vmin < inv(vhora))\n {\n /*printf(\"\\nel inverso de %d es %d\\n\", vhora, inv(vhora));*/\n \n itoa(vhora, hora, 10);\n if(vhora<10)\n {\n hora[1]=hora[0];\n hora[0]='0';\n hora[3]='\\0';\n }\n printf(\"\\n%s:%c%c\", hora, hora[1], hora[0]);\n }\n else if(vhora<23)\n {\n /* printf(\"\\nvhora == %d\", vhora);*/\n aumentar(hora, &vhora);\n sigPalindromo(hora, \"00\", vhora, 0);\n }\n else\n {\n printf(\"\\n00:00\");\n }\n}\n\n\nint inv (int n)\n{\n int d1, d2;\n \n d1 = n%10;\n d2 = n/10;\n \n return (d1*10)+d2;\n}\n\nvoid aumentar(char hora[], int *vhora)\n{\n if(*vhora < 23)\n {\n *vhora= (*vhora)+1;\n hora[1] = hora[1]+1;\n }\n else\n {\n *vhora=0;\n hora[0]=0;\n hora[1]=0;\n }\n \n}"}, {"source_code": "#include <stdio.h>\n\nint num[][2]={{0,1},{0,2},{0,3},{0,4},{0,5},{1,0},{1,1},{1,2},{1,3},{1,4},{1,5},{2,0},{2,1},{2,2},{2,3},{0,0}};\n\nint main()\n{\n int shi,fen,a,b,c,d,i;\n scanf(\"%d:%d\",&shi,&fen);\n a=shi/10;\n b=shi%10;\n c=fen/10;\n d=fen%10;\n for(i=14;;i--)\n {\n if(a>=num[i][0]&&b>=num[i][1]&&c>=num[i][1]&&d>=num[i][0])\n {\n printf(\"%d%d:%d%d\\n\",num[i+1][0],num[i+1][1],num[i+1][1],num[i+1][0]);\n break;\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nstruct time{\n int a;\n int b;\n\n}pal[]={\n {\n 00,00\n },\n {\n 01,10\n },\n {\n 02,20\n },\n {\n 03,30\n },\n {\n 04,40\n },\n {\n 05,50\n },\n {\n 10,01\n },\n {\n 11,11\n },\n {\n 12,21\n },\n {\n 13,31\n },\n {\n 14,41\n },\n {\n 15,51\n },\n};\nint main(){\n struct time t;\n int i,d;\n scanf(\"%d:%d\",&t.a,&t.b);\n for(i=0;i<12;i++){\n if(t.a>=pal[i].a&&t.a<pal[i+1].a&&(i+1)!=12){\n if(t.b<pal[i].b&&t.a==pal[i].a){\n d=i;\n break;\n }\n else {\n d=i+1;\n break;\n }\n }\n }\n if(t.a>=15&&t.b>51) d=0;\n // printf(\"%d\\n\",d);\n/*char s1[2],s2[2];\nif(pal[d].a==0)\n s1[2]=\"00\";\nelse if(pal[d].a==1)\n s1[2]=\"01\";\nelse if(pal[d].a==2)\n s1[2]=\"02\";\n\n else if(pal[d].a==3)\n s1[2]=\"03\";\n else if(pal[d].a==4)\n s1[2]=\"04\";\nelse if(pal[d].a==5)\n s1[2]=\"05\";\nelse if(pal[d].a==10)\n s1[2]=\"10\";\n\n else if(pal[d].a==11)\n s1[2]=\"11\";\n else if(pal[d].a==12)\n s1[2]=\"12\";\nelse if(pal[d].a==13)\n s1[2]=\"13\";\nelse if(pal[d].a==14)\n s1[2]=\"14\";\n\n else if(pal[d].a==15)\n s1[2]=\"15\";\n\n if(pal[d].b==0)\n s2[2]=\"00\";\nelse if(pal[d].b==10)\n s2[2]=\"10\";\nelse if(pal[d].b==30)\n s2[2]=\"30\";\n\n else if(pal[d].b==40)\n s2[2]=\"40\";\n else if(pal[d].b==50)\n s2[2]=\"50\";\nelse if(pal[d].b==1)\n s2[2]=\"01\";\nelse if(pal[d].b==11)\n s2[2]=\"11\";\n\n else if(pal[d].b==21)\n s2[2]=\"21\";\n else if(pal[d].b==31)\n s2[2]=\"31\";\nelse if(pal[d].a==41)\n s2[2]=\"41\";\nelse if(pal[d].a==51)\n s2[2]=\"51\";\n\n else if(pal[d].a==20)\n s2[2]=\"20\";\n*/\n\n\n if(pal[d].b<10&&pal[d].a<10)\nprintf(\"0%d:0%d\",pal[d].a,pal[d].b);\n\nelse if(pal[d].b<10)\n printf(\"%d:0%d\",pal[d].a,pal[d].b);\nelse if(pal[d].a<10)\nprintf(\"0%d:%d\",pal[d].a,pal[d].b);\nelse printf(\"%d:%d\",pal[d].a,pal[d].b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,i,j,m,t,q,c1=0;\n char s[100005];\n scanf(\"%s\",&s);\n q=strlen(s);\n\n printf(\"%d\\n\",q);\n t=(s[0]-'0');\n if(q==5)\n {\n k=(s[0]-'0')*10+(s[1]-'0');\n }\n else\n {\n k=t;\n }\n\n k=k+1;\n m=k%10;\n n=(k/10)%10;\n //printf(\"%d %d %d\\n\",k,m,n);\n\n if(k==24)\n {\n printf(\"00:00\");\n }\n else if(k<10)\n {\n printf(\"0%d:%d0\",m,m);\n }\n else\n {\n printf(\"%d:%d%d\",k,m,n);\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain(){\nstruct palindromic {\n int H;\n int M;} PALINDROMIC[16];\nint c,HH,MM;\n\nPALINDROMIC[0].H=00;\nPALINDROMIC[0].M=00;\n\nPALINDROMIC[1].H=01;\nPALINDROMIC[1].M=10;\n\nPALINDROMIC[2].H=02;\nPALINDROMIC[2].M=20;\n\nPALINDROMIC[3].H=03;\nPALINDROMIC[3].M=30;\n\nPALINDROMIC[4].H=04;\nPALINDROMIC[4].M=40;\n\nPALINDROMIC[5].H=05;\nPALINDROMIC[5].M=50;\n\nPALINDROMIC[6].H=10;\nPALINDROMIC[6].M=01;\n\nPALINDROMIC[7].H=11;\nPALINDROMIC[7].M=11;\n\nPALINDROMIC[8].H=12;\nPALINDROMIC[8].M=21;\n\nPALINDROMIC[9].H=13;\nPALINDROMIC[9].M=31;\n\nPALINDROMIC[10].H=14;\nPALINDROMIC[10].M=41;\n\nPALINDROMIC[11].H=15;\nPALINDROMIC[11].M=51;\n\nPALINDROMIC[12].H=20;\nPALINDROMIC[12].M=02;\n\nPALINDROMIC[13].H=21;\nPALINDROMIC[13].M=12;\n\nPALINDROMIC[14].H=22;\nPALINDROMIC[14].M=22;\n\nPALINDROMIC[15].H=23;\nPALINDROMIC[15].M=32;\n\nscanf(\"%d:%d\",&HH , &MM);\n\nc=0;\nif(HH==23) {\n if (32<=MM){\n printf(\"%0.2d:%0.2d\",PALINDROMIC[0].H,PALINDROMIC[0].M );\n }else{\n printf(\"%0.2d:%0.2d\",PALINDROMIC[15].H,PALINDROMIC[15].M );}\n}\nelse{\nwhile(HH>=PALINDROMIC[c].H){\nc++;\n}\nif (MM<PALINDROMIC[c-1].M){\nprintf(\"%0.2d:%0.2d\",PALINDROMIC[c-1].H,PALINDROMIC[c-1].M );\n}else{\nprintf(\"%0.2d:%0.2d\",PALINDROMIC[c].H,PALINDROMIC[c].M );\n}\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int hh,mm;\n scanf(\"%d:%d\",&hh,&mm);\n for(mm=mm+1;hh%10*10+hh/10!=mm;mm++){\n if(mm==60){\n hh++;\n mm=0;\n }\n if(hh==24){\n hh=0;\n break;\n }\n }\n printf(\"%02d:%02d\\n\",hh,mm);\n}"}, {"source_code": "#include <stdio.h>\nrev(int a){\n\tint b=0;\n\twhile(a){\n\t\tb*=10;\n\t\tb+=(a%10);\n\t\ta/=10;\n\t}\n\treturn b;\n}\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n if(mm==rev(hh)){\n \tmm++;\n \tif(mm == 60)\n {\n hh++;\n mm = 0;\n }\n\t}\n while(mm!=rev(hh)) \n {\n mm++;\n if (mm == 60)\n {\n hh++;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n }\n printf(\"%02d:%02d\\n\", hh, mm);\n //scanf(\"%d\" ,&hh); printf(\"rev of hh is: %02d\" ,rev(hh));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint reverse(int a){\n\tint one,ten;\n\tone=a%10;\n\tten=a/10;\n\treturn one*10+ten;\n}\n\nint main(void)\n{\n\tint hh,mm,h,hd;\n\tchar syn[6];\n\tscanf(\"%s\",syn);\n\tsyn[2]='\\0';\n\thh=atoi(syn);\n\tmm=atoi(&syn[3]);\n\th=hh%10;\n\thd=hh/10;\n\tif(h<=5){\n\t\tif(mm>=reverse(hh))printf(\"%02d:%02d\\n\",(hh+1)%24,reverse((hh+1)%24));\n\t\telse printf(\"%02d:%02d\\n\",(hh)%24,reverse((hh)%24));\n\t}\n\telse{\n\t\tprintf(\"%d0:0%d\\n\",hd+1,hd+1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint re (int d);\nint main()\n{ int a,b;\n scanf(\"%d%d\",&a,&b);\n if(a==23) {\n if(b<32) printf(\"23:32\");\n else printf(\"00:00\"); }\n else if(a>5&&a<=9) printf(\"10:01\");\n else {\n if(b<re(a)) printf(\"%02d:%02d\",a,re(a));\n else {printf(\"%02d:%02d\",a+1,re(a+1)); }}\nreturn 0;\n}\n\nint re(int d)\n{int y = (d%10);\nreturn (y*10+(d/10));\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nvoid siguiente_palindromo(char*);\nint char_int(char );\nint main()\n{\n char comienzo[10];\n scanf(\"%s\",comienzo);\n\n siguiente_palindromo(comienzo);\n return 0;\n}\nvoid siguiente_palindromo(char *inicio){\n int hora[]={0,0};\n int minutos[]={0,0};\n int i,j, k=0;\n for(i=0; inicio[i]!=':'; i++){\n if(char_int(inicio[i])!=-1){\n hora[i]=char_int(inicio[i]);\n }\n }\n for(j=i; inicio[j]!='\\0'; j++){\n if(char_int(inicio[j])!=-1){\n minutos[k]=char_int(inicio[j]);\n k++;\n }\n }\n\n if((minutos[0]*10+minutos[1]) > (hora[1]*10+hora[0])){\n hora[1]++;\n if(hora[1]>5){\n hora[0]++;\n hora[1]=0;\n }\n if((hora[0]*10+hora[1])==24){\n hora[0]=0;\n hora[1]=0;\n }\n\n }\n minutos[0]=hora[1];\n minutos[1]=hora[0];\n printf(\"\\n%d%d:%d%d\",hora[0],hora[1],minutos[0],minutos[1]);\n}\nint char_int(char a){\n char numeros[]={'0','1','2','3','4','5','6','7','8','9'};\n int i;\n for(i=0; i<10; i++){\n if(a==numeros[i]){\n return i;\n }\n }\n return -1;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n1,n2,i,p;\n char ch;\n scanf(\"%d%c%d\",&n1,&ch,&n2);\n\n p=n1;\n if(n1<10)\n n1=n1*10;\n else\n n1=((n1%10)*10)+(n1/10)%10;\n if(p==23&&n2>=32)\n printf(\"00:00\\n\");\n else if(p==23)\n printf(\"23:32\\n\");\n else if(p==5&&n2>n1&&p<10)\n printf(\"10:01\\n\");\n else if(p==5&&p<10)\n printf(\"0%d:%d\\n\",p,n1);\n else if(p>5&&p<10)\n printf(\"10:01\\n\");\n else if(p>=15&&n2>=n1&&p<20)\n printf(\"20:02\\n\");\n else if(p>=15&&p<20&&n2>n1)\n printf(\"%d:%d\\n\",p,n1);\n else if(p<=4&&n2<n1)\n printf(\"0%d:%d\\n\",p,n1);\n else\n {\n if(n2<n1)\n printf(\"%d:%d\\n\",p,n1);\n else\n {\n p++;\n n2=((p%10)*10)+(p/10)%10;\n printf(\"%d:%d\\n\",p,n2);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int h, m, i;\n scanf(\"%d:%d\", &h, &m);\n do\n {\n m++;\n if(m==60)\n {\n h++;\n m=0;\n }\n if(h==24)\n {\n h=0;\n }\n }\n while(h%10*10+h/10!=m);\n printf(\"%d:%d\\n\", h, m);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n char s[10];\n gets(s);\n\n if(s[0]=='0'&&s[1]=='1')\n {\n if((s[2]-'0')*10+(s[3]-'0')<10)\n printf(\"01:10\");\n else\n printf(\"02:20\");\n }\n if(s[0]=='0'&&s[1]=='2')\n {\n if((s[2]-'0')*10+(s[3]-'0')<20)\n printf(\"02:20\");\n else\n printf(\"03:30\");\n }\n if(s[0]=='0'&&s[1]=='3')\n {\n if((s[2]-'0')*10+(s[3]-'0')<30)\n printf(\"03:30\");\n else\n printf(\"04:40\");\n }\n if(s[0]=='0'&&s[1]=='4')\n {\n if((s[2]-'0')*10+(s[3]-'0')<40)\n printf(\"04:40\");\n else\n printf(\"05:50\");\n }\n if(s[0]=='0'&&s[1]=='5')\n {\n if((s[2]-'0')*10+(s[3]-'0')<50)\n printf(\"05:50\");\n else\n printf(\"10:01\");\n }\n if((s[0]-'0')*10+(s[1]-'0')>=6 && (s[0]-'0')*10+(s[1]-'0')<10)\n {\n printf(\"10:01\");\n }\n if(s[0]=='1'&&s[1]=='0')\n {\n if((s[2]-'0')*10+(s[3]-'0')<1)\n printf(\"10:01\");\n else\n printf(\"11:11\");\n }\n if(s[0]=='1'&&s[1]=='1')\n {\n if((s[2]-'0')*10+(s[3]-'0')<11)\n printf(\"11:11\");\n else\n printf(\"12:21\");\n }\n if(s[0]=='1'&&s[1]=='2')\n {\n if((s[2]-'0')*10+(s[3]-'0')<21)\n printf(\"12:21\");\n else\n printf(\"13:31\");\n }\n if(s[0]=='1'&&s[1]=='3')\n {\n if((s[2]-'0')*10+(s[3]-'0')<31)\n printf(\"13:31\");\n else\n printf(\"14:41\");\n }\n if(s[0]=='1'&&s[1]=='4')\n {\n if((s[2]-'0')*10+(s[3]-'0')<41)\n printf(\"14:41\");\n else\n printf(\"15:51\");\n }\n if(s[0]=='1'&&s[1]=='5')\n {\n if((s[2]-'0')*10+(s[3]-'0')<51)\n printf(\"15:51\");\n else\n printf(\"20:02\");\n }\n if((s[0]-'0')*10+(s[1]-'0')>=16 && (s[0]-'0')*10+(s[1]-'0')<20)\n {\n printf(\"20:02\");\n }\n if(s[0]=='2'&&s[1]=='0')\n {\n if((s[2]-'0')*10+(s[3]-'0')<2)\n printf(\"20:02\");\n else\n printf(\"21:12\");\n }\n if(s[0]=='2'&&s[1]=='1')\n {\n if((s[2]-'0')*10+(s[3]-'0')<12)\n printf(\"21:12\");\n else\n printf(\"22:22\");\n }\n if(s[0]=='2'&&s[1]=='2')\n {\n if((s[2]-'0')*10+(s[3]-'0')<22)\n printf(\"22:22\");\n else\n printf(\"23:32\");\n }\nif(s[0]=='2'&&s[1]=='3')\n {\n if((s[2]-'0')*10+(s[3]-'0')<32)\n printf(\"23:32\");\n else\n printf(\"00:00\");\n }\n\n\n\n\n\n\n return 0;\n}\n"}, {"source_code": "//SORU xx\n//PROGRAM C\n#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<limits.h>\n#include<time.h>\n#include<ctype.h>\n//#include<math.h>\n#define scn(x) fscanf(in,\"%d\",&x);\n#define prn(x) fprintf(out,\"%d\\n\",x);\n#define prn2(x) fprintf(out,\"%d\",x);\n#define line() fprintf(out,\"\\n\");\n#define wait system(\"PAUSE\");\n#define scn2(x,y) scn(x);scn(y);\nFILE *in,*out;\nvoid dosya(){\n\t\t/*in=fopen(\"girdi.in\",\"r\");*/in=stdin;\n\t\t/*out=fopen(\"cikti.out\",\"w\");*/out=stdout;\n}\nint h,m;\nvoid oku(){\n\tchar c;\n\tscn(h);\n\tfscanf(in,\" %c\",&c);\n\tscn(m);\n}\nvoid coz(){\n\tint i,j,tut1,tut2,yer=0;\n\tfor(i=h+1; i<=23; i++){\n\t\tfor(j=0; j<=60; j++){\n\t\t\ttut1=i;\n\t\t\ttut2=j;\n\t\t\tif((tut1-(tut1%10))/10==tut2%10 && (tut2-(tut2%10))/10==tut1%10){\n\t\t\t\tfprintf(out,\"%d%d:%d%d\",(tut1-(tut1%10))/10,(tut2-(tut2%10))/10,tut1%10,tut2%10);\n\t\t\t\tyer=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(yer) break;\n\t}\n\tif(!yer) fprintf(out,\"00:00\");\n}\t\nint main(){\n\tdosya();\n\toku();\n\tcoz();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char hora[6],h[3],m[3];\n int palin,HoraD[5],sig,sumah,sumam,auxpalin;\n\n gets(hora);\n\n //scanf(\"%[^\\n]s\",&hora);\n //printf(\"%s\",hora);\n h[0] = hora[0];\n h[1] = hora[1];\n m[0] = hora[3];\n m[1] = hora[4];\n\n //printf(\"%c\",AuxDCambio);\n HoraD[2]=atoi(m)/10;//convierte a int\n HoraD[3]=atoi(m)%10;\n HoraD[0]= atoi(h)/10;\n HoraD[1]= atoi(h)%10;\n\n sumah=HoraD[0]*10 + HoraD[1];\n sumam=HoraD[2]*10 + HoraD[3];\n auxpalin=HoraD[1]*10 + HoraD[0];\n\n if(sumah<sumam)\n {\n if(sumam>auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam==auxpalin)\n {\n sig=1;\n palin=0;\n }\n else if(sumam<auxpalin)\n {\n sig=0;\n palin=0;\n }\n }\n else if(sumah==sumam)\n {\n palin=1;\n sig=1;\n }\n else if(sumah>sumam)\n {\n sig=0;\n palin=0;\n\n }\n\n if(sumah==23 )\n {\n if(sig==1)\n {\n printf(\"00:00\");\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"23:32\");\n exit(0);\n }\n }\n else if(HoraD[1]>5 )\n {\n if(HoraD[0]==0)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"20:02\");\n exit(0);\n }\n }\n else if (HoraD[1]<5)\n {\n //if(sum)\n //{\n if(sig==1 || palin==1)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1]+1,HoraD[1]+1,HoraD[0]);\n exit(0);\n }\n else if(sig==0)\n {\n printf(\"%d%d:%d%d\",HoraD[0],HoraD[1],HoraD[1],HoraD[0]);\n exit(0);\n }\n //}\n }\n else if (HoraD[1]==5)\n {\n if(HoraD[0]==0)\n {\n if(sig==1)\n {\n printf(\"10:01\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n else if(HoraD[0]==1)\n {\n if(sig==1)\n {\n printf(\"20:02\");\n exit(0);\n }\n else\n {\n printf(\"05:50\");\n exit(0);\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint re (int d);\nint main()\n{ int a,b;\n scanf(\"%d:%d\",&a,&b);\n if(a==23) {\n if(b<32) printf(\"23:32\");\n else printf(\"00:00\"); }\n else if(a>5&&a<=9) printf(\"10:01\");\n else {\n if(b<re(a)) printf(\"%02d:%02d\",a,re(a));\n else {printf(\"%02d:%02d\",a+1,re(a+1)); }}\n\n return 0;\n}\n\nint re(int d)\n\n {\n\n int y = (d%10);\n\n return (y*10+(d/10));\n\n }\n\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<time.h>\n#include<math.h>\n#include<ctype.h>\n\n#define MAX( a, b ) ( ( a > b) ? a : b ) \n#define MIN( a, b ) ( ( a < b) ? a : b )\n#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)\n#define and &&\n#define or ||\nint main () {\n\nint x=0,n=0,s=0,i,j,a[10];\nchar b;\nscanf(\"%d\",&x);\nscanf(\"%c\",&b);\nscanf(\"%d\",&s);\nn+=((x%10)*10)+x/10;\nif(x<10){\n printf(\"10:01\");\n return 0;\n}\nif(s<n){\n if(x<10)\n printf(\"0%d:\",x);\n else\n printf(\"%d:\",x);\n if(n<10)\n printf(\"0%d\",n);\n else\n printf(\"%d\",n);\n return 0;}\nif(x<23 and n+10<60){\n if(x<10)\n printf(\"0%d:%d\",x+1,n+10);\n else\n printf(\"%d:%d\",x+1,n+10);\n return 0;}\nif(n+10>=60){\n printf(\"20:02\");\n return 0;}\nprintf(\"00:00\");\n\n\n\n\n\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j;\n char s[2];\n scanf(\"%d%*c%d\",&a,&b);\n if(a>=0&&a<=4)\n {\n printf(\"0%d:%d\",a+1,a*10);\n }\n else if(a>=5&&a<=9)\n {\n\n printf(\"10:10\");\n }\n else if(a>=15&&a<=19)\n {\n printf(\"20:02\");\n }\n else if(a>=10&&a<=14)\n {\n\n\n printf(\"%d:\",a+1);\n\n }\n else\n {\n printf(\"00:00\");\n }\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n char t[6];\n scanf(\"%s\",t);\n if(t[0]=='0'||t[0]=='1')\n {\n if(t[1]>='6')\n {\n t[0]+=1;\n t[1]='0';\n t[3]='0';\n t[4]=t[0];\n printf(\"%s\\n\",t);\n }\n else\n {\n int h=(t[1]-'0')*10+(t[0]-'0');\n int min=(t[3]-'0')*10+(t[4]-'0');\n if(min<h)\n {\n t[3]=t[1];\n t[4]=t[0];\n printf(\"%s\\n\",t);\n }\n else\n {\n t[1]++;\n t[3]=t[1];\n t[4]=t[0];\n printf(\"%s\\n\",t);\n }\n }\n }\n else\n {\n if(t[1]<='2')\n {\n int h=(t[1]-'0')*10+(t[0]-'0');\n int min=(t[3]-'0')*10+(t[4]-'0');\n if(min<h)\n {\n t[3]=t[1];\n t[4]=t[0];\n printf(\"%s\\n\",t);\n }\n else\n {\n t[1]++;\n t[3]=t[1];\n t[4]=t[0];\n printf(\"%s\\n\",t);\n }\n }\n else\n {\n int min=(t[3]-'0')*10+(t[4]-'0');\n if(min>=32)\n printf(\"00:00\\n\");\n else\n printf(\"23:32\\n\");\n }\n }\n// system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint funcelias (char a);\n\nint main()\n{\n\tint i,j=0,k,l ;\n\tint aux[4];\n\tchar hora[6];\n\tint flag=0 ;\n\tscanf(\"%s\", hora) ;\n\n\n\tfor(i=0;'\\0'!=hora[i];i++){\n\n\t\tif(funcelias(hora[i])!=-1){\n\t\t\taux[j]=funcelias(hora[i]);\n\t\t\tj++;\n\t\t}\n\t}\n\tif((aux[0]*10+aux[1])<24)\n\t{\n\t\twhile(flag!=1){\n\n\t\tfor(i=aux[0] ; i<3 && flag==0; i++)\n\t\t{\n\t\t\tfor(k=aux[1] ; k<4 && flag==0; k++)\n\t\t\t{\n\t\t\t\tfor(j=aux[2] ; j<6 && flag==0; j++)\n\t\t\t\t{\n\t\t\t\t\tfor(l=aux[3]+1 ; l<10 && flag==0; l++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(i==l && k==j)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag=1 ;\n\t\t\t\t\t\t\tprintf(\"%d%d:%d%d\",i,k,j,l) ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\taux[3]=-1;\n\t\t\t\t}\n\t\t\t\taux[2]=0;\n\t\t\t}\n\t\t\taux[1]=0;\n\n\t\t}\n\t\taux[0]=0;\n\n\t\t}\n\t}\n\treturn 0 ;\n}\nint funcelias (char a)\n{\n\tint i;\n\n\tchar numero[]= {'0','1','2','3','4','5','6','7','8','9'}\t;\n\tfor(i=0; i<10; i++)\n\t{\n\n\t\tif(a==numero[i])\n\t\t{\n\t\t\treturn i;\n\t\t}\n\n\t}\n\treturn -1;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char s[5];\n int i,k,n;\n while(scanf(\"%s\",s)!=EOF)\n {\n if(s[0]==s[4]&&s[1]==s[3])\n {\n if(s[0]=='2')\n {\n s[0]=s[1]=s[3]=s[4]='0';\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='5')\n {\n s[0]=s[4]='2';s[1]=s[3]='0';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='5')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n }\n else\n {\n if(s[0]=='2')\n {\n if(s[1]=='3')\n {\n if(s[3]>=s[1])\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='6')\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]<s[0])\n {\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='6')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[4]=s[0];s[1]=s[3];\n }\n }\n else\n {\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n }\n printf(\"%s\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char time[6];\n scanf(\"%s\",time);\n int h=0,m=0,m_rev=0,h_rev;\n h=(time[0]-'0')*10+time[1]-'0';\n m=(time[3]-'0')*10+time[4]-'0';\n m_rev=(m%10)*10+m/10;\n h_rev=(h%10)*10+h/10;\n if(h>m_rev)\n printf(\"%d:%d\\n\",h,h_rev);\n else\n {\n h=(h+1)%24;\n h_rev=(h%10)*10+h/10;\n if(h!=0)\n printf(\"%d:%d\\n\",h,h_rev);\n else\n printf(\"00:00\\n\");\n }\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n1,n2,i,p;\n char ch;\n scanf(\"%d%c%d\",&n1,&ch,&n2);\n\n p=n1;\n if(n1<10)\n n1=n1*10;\n else\n n1=((n1%10)*10)+(n1/10)%10;\n if(p==23&&n2>=32)\n printf(\"00:00\\n\");\n else if(p==23)\n printf(\"23:32\\n\");\n else if(p==5&&n2>n1&&p<10)\n printf(\"10:01\\n\");\n else if(p==5&&p<10)\n printf(\"0%d:%d\\n\",p,n1);\n else if(p>5&&p<10)\n printf(\"10:01\\n\");\n else if(p>=15&&n2>=n1&&p<20)\n printf(\"20:02\\n\");\n else if(p>=15&&p<20&&n2>n1)\n printf(\"%d:%d\\n\",p,n1);\n else if(p<=4&&n2<n1)\n printf(\"0%d:%d\\n\",p,n1);\n else\n {\n if(n2<n1)\n printf(\"%d:%d\\n\",p,n1);\n else\n {\n p++;\n n2=((p%10)*10)+(p/10)%10;\n printf(\"%d:%d\\n\",p,n2);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain(){\nstruct palindromic {\n int H;\n int M;} PALINDROMIC[16];\nint c,HH,MM;\n\nPALINDROMIC[0].H=00;\nPALINDROMIC[0].M=00;\n\nPALINDROMIC[1].H=01;\nPALINDROMIC[1].M=10;\n\nPALINDROMIC[2].H=02;\nPALINDROMIC[2].M=20;\n\nPALINDROMIC[3].H=03;\nPALINDROMIC[3].M=30;\n\nPALINDROMIC[4].H=04;\nPALINDROMIC[4].M=40;\n\nPALINDROMIC[5].H=05;\nPALINDROMIC[5].M=50;\n\nPALINDROMIC[6].H=10;\nPALINDROMIC[6].M=01;\n\nPALINDROMIC[7].H=11;\nPALINDROMIC[7].M=11;\n\nPALINDROMIC[8].H=12;\nPALINDROMIC[8].M=21;\n\nPALINDROMIC[9].H=13;\nPALINDROMIC[9].M=31;\n\nPALINDROMIC[10].H=14;\nPALINDROMIC[10].M=41;\n\nPALINDROMIC[11].H=15;\nPALINDROMIC[11].M=51;\n\nPALINDROMIC[12].H=20;\nPALINDROMIC[12].M=02;\n\nPALINDROMIC[13].H=21;\nPALINDROMIC[13].M=12;\n\nPALINDROMIC[14].H=22;\nPALINDROMIC[14].M=22;\n\nPALINDROMIC[15].H=23;\nPALINDROMIC[15].M=32;\n\nscanf(\"%d:%d\",&HH , &MM);\nc=0;\nif(HH==23) {\n if (32<=MM){\n printf(\"%0.2d:%0.2d\",PALINDROMIC[0].H,PALINDROMIC[0].M );\n }else{\n printf(\"%0.2d:%0.2d\",PALINDROMIC[15].H,PALINDROMIC[15].M );}\n}\nelse{\nwhile(HH>PALINDROMIC[c].H){\nc++;\n}\nif (MM<PALINDROMIC[c-1].M && HH==PALINDROMIC[c-1].H){\nprintf(\"%0.2d:%0.2d\",PALINDROMIC[c-1].H,PALINDROMIC[c-1].M );\n}else{\nprintf(\"%0.2d:%0.2d\",PALINDROMIC[c].H,PALINDROMIC[c].M );\n}\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(int argc, char *argv[])\n{\n int HH,MM =0;\n int H[2],M[2];\n scanf(\"%d\",&HH);scanf(\"%d\",&MM);\n MM++;\n for(;HH<24;HH++)\n {\n H[0]= HH/10;H[1]=HH%10;\n for(;MM<60;MM++)\n {\n M[0]=MM%10;M[1]=MM/10;\n if( M[1] == H[1] && M[0] == H[0] )\n {\n if(HH<10 && MM<10)\n {\n printf(\"0%d:0%d\\n\",HH,MM);\n return 0;\n }\n else if(MM<10)\n {\n printf(\"%d:0%d\\n\",HH,MM);\n return 0;\n }\n else if(HH<10)\n {\n printf(\"0%d:%d\\n\",HH,MM);\n return 0;\n }\n else\n {\n printf(\"%d:%d\\n\",HH,MM);\n return 0;\n }\n }\n }\n MM=0;\n }\n printf(\"00:00\\n\");\nreturn 0;\n}\n/****** PCCA -Sun Oct 09 02:37:23 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i;char a[10],c[10]=\"\",d[10]=\"\",hr[25][3]={\"01\",\"02\",\"03\",\"04\",\"05\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"20\",\"21\",\"22\",\"23\",\"00\"};\n\tchar min[25][3]={\"10\",\"20\",\"30\",\"40\",\"50\",\"01\",\"11\",\"21\",\"31\",\"41\",\"51\",\"02\",\"12\",\"22\",\"32\",\"00\"};\n\tchar ans[25][6]={\"01:10\",\"02:20\",\"03:30\",\"04:40\",\"05:50\",\"10:01\",\"11:11\",\"12:21\",\"13:31\",\"14:41\",\"15:51\",\"20:02\",\"21:12\",\"22:22\",\"23:32\",\"00:00\"};\n\tscanf(\"%s\",a);\n\tstrncat(c,a,2);\n\tfor (i=0;i<20;i++)\n\t{\n\t\tif (strcmp(c,hr[i])==0)\n\t\t{\n\t\t\tif (strcmp(a,ans[i])==-1){\n\t\t\t\tprintf(\"%s\",ans[i]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (strcmp(a,ans[i])==1 || strcmp(a,ans[i])==0){\n\t\t\t\tprintf(\"%s\",ans[i+1]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse if (strcmp(hr[i],c)==-1 && strcmp(hr[i+1],c)==1)\n\t\t{\n\t\t\tprintf(\"%s\",ans[i+1]);\n\t\t\tbreak;\n\t\t}\n\t\t\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\t\n\tchar time[6];\n\tint heure,minute;\n\tscanf(\"%s\",&time);\n\theure=((time[0]-48)*10)+time[1]-48;\n\tminute=((time[3]-48)*10)+time[4]-48;\n\t\n\tif(heure<1 || heure==1&&minute<=10){printf(\"01:10\");return 0;}\n\telse if(heure<2 || heure==2&&minute<=20){printf(\"02:20\");return 0;}\n\telse if(heure<3 || heure==3&&minute<=30){printf(\"03:30\");return 0;}\n\telse if(heure<4 || heure==4&&minute<=40){printf(\"04:40\");return 0;}\n\telse if(heure<5 || heure==5&&minute<=50){printf(\"05:50\");return 0;}\n\telse if(heure<10 || heure==10&&minute<=1){printf(\"10:01\");return 0;}\n\telse if(heure<11 || heure==11&&minute<=11){printf(\"11:11\");return 0;}\n\telse if(heure<12 || heure==12&&minute<21){printf(\"12:21\");return 0;}\n\telse if(heure<13 || heure==13&&minute<=31){printf(\"13:31\");return 0;}\n\telse if(heure<14 || heure==14&&minute<=41){printf(\"14:41\");return 0;}\n\telse if(heure<15 || heure==15&&minute<=51){printf(\"15:51\");return 0;}\n\telse if(heure<20 || heure==20&&minute<=2){printf(\"20:02\");return 0;}\n\telse if(heure<21 || heure==21&&minute<=12){printf(\"21:12\");return 0;}\n\telse if(heure<22 || heure==22&&minute<=22){printf(\"22:22\");return 0;}\n\telse if(heure<23 || heure==23&&minute<=32){printf(\"23:32\");return 0;}\n\telse if(heure<24){printf(\"00:00\");return 0;}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j;\n char s[2];\n scanf(\"%d%*c%d\",&a,&b);\n if(a>=0&&a<=4)\n {\n if(b>a*10)\n {\n printf(\"0%d:%d\",a+1,(a+1)*10);\n }\n else\n {\n printf(\"0%d:%d\",a,a*10);\n }\n\n }\n else if(a>=5&&a<=9)\n {\n if(a==5&&b<a*10)\n {\n printf(\"0%d:%d\",a,a*10);\n }\n else{ printf(\"10:10\");}\n\n }\n else if(a>=15&&a<=19)\n {\n if(a==15&&b<51)\n {\n printf(\"15:51\");\n }\n else{printf(\"20:02\");}\n\n }\n else if(a>=10&&a<=14)\n {\n\n c=a%10;\n c=c*10;\n c=c+1;\n if(b>c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else if(a>=20&&a<=22)\n {\n\n c=a%20;\n c=c*10;\n c=c+2;\n if(b>c)\n {\n printf(\"%d:\",a+1);\n sprintf(s,\"%d\",a+1);\n printf(\"%c%c\",s[1],s[0]);\n\n }\n else\n {\n printf(\"%d:\",a);\n sprintf(s,\"%d\",a);\n printf(\"%c%c\",s[1],s[0]);\n }\n\n }\n else\n {\n printf(\"00:00\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n//int check(int arr[]);\n//int check(int arr[])\n//{\n//\tint i, flag=1;\n//\tfor(i=0;i<4;i++){\n//\t\tif(arr[i]!=arr[3-i])\n//\t\t\tflag=0;\n//\t}\n//\treturn flag;\n//}\nint main()\n{\n\tint arr[4], a[2], flag, m, n;\n\tscanf(\"%d:%d\", &a[0], &a[1]);\n\tarr[1]=(a[0]%10);\n\tarr[0]=(a[0]/10);\n\tarr[3]=(a[1]%10);\n\tarr[2]=(a[1]/10);\n//\tflag=check(arr);\n//\tif(flag==1){\n//\t\tm=a[0];\n//\t\tn=(10*(m%10))+(m/10);\n//\t\tif(m<10 && n>=10)\n//\t\t\tprintf(\"0%d:%d\", m, n);\n//\t\telse if(n<10 && m>=10)\n//\t\t\tprintf(\"%d:0%d\", m, n);\n//\t\telse if(m<10 && n<=10)\n//\t\t\tprintf(\"0%d:0%d\", m, n);\n//\t\telse\n//\t\t\tprintf(\"%d:%d\", m, n);\n//\t}\n\tif(((a[0]<7)||(a[0]>9))&&((a[0]<15)||(a[0]>19))){\n\t\tm=a[0];\n\t\tn=(10*(m%10))+(m/10);\n\t\tif(a[1]<n){\n\t\t\tif(m<10 && n>=10)\n\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\telse if(n<10 && m>=10)\n\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\telse if(m<10 && n<=10)\n\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\telse\n\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t}\n\t\telse{\n\t\t\tif(a[0]==23)\n\t\t\t\tprintf(\"00:00\");\n\t\t\telse{\n\t\t\t\tm=a[0]+1;\n\t\t\t\tn=(10*(m%10))+(m/10);\n\t\t\t\tif(m<10 && n>=10)\n\t\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\t\telse if(n<10 && m>=10)\n\t\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\t\telse if(m<10 && n<=10)\n\t\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t\t}\n\t\t}\n\t}\n\telse if(a[0]<10)\n\t\tprintf(\"10:01\");\n\telse\n\t\tprintf(\"20:02\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint rev(int a){\n return (a%10)*10+a/10;\n}\nint main()\n{\n int i,h,m;\n scanf(\"%d:%d\",&h,&m);\n if(h<=rev(m)){\n if(h==23)printf(\"00:00\");\n else if(h>=0&&h<=5)printf(\"0%d:%d\",h,rev(h));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=15&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h+1,rev(h+1));\n }\n else {\n if(h>=0&&h<=5)printf(\"0%d:%d\",h,rev(h));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=16&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h,rev(h));\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n, mm;\n char z;\n scanf(\"%d %c %d\", &n, &z, &mm);\n if((((n)%10)*10)+n/10>=mm) n=n+1;\n if(n>=0 && n<=4)\n {\n printf(\"0%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=5 && n<=9)\n {\n printf(\"10:01\\n\");\n }\n else if(n>=10 && n<=14)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=15 && n<=19)\n {\n printf(\"20:02\\n\");\n }\n else if(n>=20 && n<=22)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else\n {\n printf(\"00:00\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tif(Hora+1 >= 24){\n\t\tprintf(\"00:00\");\n\t}else {\n\t\tif (Minutos < Hora ) {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\n\t\t} else {\n\t\t\tHora++;\n\t\t\tif(Hora < 10 && Hora > 6){\n\t\t\t\tprintf(\"10:01\");\n\t\t\t} else if( Hora < 19 && Hora >= 16 ){\n\t\t\t\tprintf(\"20:02\");\n\t\t\t} else {\n\t\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[6];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) + 1 ;\n\t\n\t\n\tif(Hora >= 24){\n\t\tprintf(\"00:00\");\n\t}else {\n\t\tif(Hora < 10 && Hora >= 6){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora < 19 && Hora >= 16 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <string.h>\n#include <stdio.h>\nint main()\n{\n char h,h1,m,m1;\n scanf(\"%c%c:%c%c\",&h,&h1,&m,&m1);\n if(h==0 && h1<=9)\n {\n \n if(m<5 && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n if(m>5)\n {\n h=1;\n h1=0;\n m=0;\n m1=1;\n \n }\n else \n {\n m1=0;\n m=h1;\n }\n }\n else if(h==1 && h1>=0 && h1<=9)\n {\n \n if(m<5 && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n if(m>5)\n {\n h=2;\n h1=0;\n m=0;\n m1=2;\n }\n else \n {\n m=h1;\n m1=1;\n }\n }\n else if(h==2 && h1>=0 && h1<=3)\n {\n if(m<3 && h==m1&& m==h1)\n {\n h1++;\n m++;\n }\n if(h1>=3 && m>=3 && m1>2)\n {\n h=0;\n h1=0;m=0;m1=0;\n }\n else\n {\n m=h1;\n m1=2;\n }\n }\n printf(\"%c%c:%c%c\",h,h1,m,m1);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint reverse(int a){\n\tint one,ten;\n\tone=a%10;\n\tten=a/10;\n\treturn one*10+ten;\n}\n\nint main(void)\n{\n\tint hh,mm,h,hd;\n\tchar syn[6];\n\tscanf(\"%s\",syn);\n\tsyn[2]='\\0';\n\thh=atoi(syn);\n\tmm=atoi(&syn[3]);\n\th=hh%10;\n\thd=hh/10;\n\tif(h<=5){\n\t\tif(mm>=reverse(hh))printf(\"%02d:%02d\\n\",(hh+1)%24,reverse((hh+1)%24));\n\t\telse printf(\"%02d:%02d\\n\",(hh)%24,reverse((hh)%24));\n\t}\n\telse{\n\t\tprintf(\"%d0:0%d\\n\",hd+1,hd+1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n1,n2,i,p;\n char ch;\n scanf(\"%d%c%d\",&n1,&ch,&n2);\n\n p=n1;\n if(n1<10)\n n1=n1*10;\n else\n n1=((n1%10)*10)+(n1/10)%10;\n if(p==23&&n2>=32)\n printf(\"00:00\\n\");\n else if(p==23)\n printf(\"23:32\\n\");\n else if(p==5&&n2>n1&&p<10)\n printf(\"10:01\\n\");\n else if(p==5&&p<10)\n printf(\"0%d:%d\\n\",p,n1);\n else if(p>5&&p<10)\n printf(\"10:01\\n\");\n else if(p>=15&&n2>=n1&&p<20)\n printf(\"20:02\\n\");\n else if(p>=15&&p<20&&n2>n1)\n printf(\"%d:%d\\n\",p,n1);\n else if(p<=4&&n2<n1)\n printf(\"0%d:%d\\n\",p,n1);\n else\n {\n if(n2<n1)\n printf(\"%d:%d\\n\",p,n1);\n else\n {\n p++;\n n2=((p%10)*10)+(p/10)%10;\n printf(\"%d:%d\\n\",p,n2);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tif(Hora+1 >= 24){\n\t\tprintf(\"00:00\");\n\t}else {\n\t\tif (Minutos < Hora ) {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\n\t\t} else {\n\t\t\tHora++;\n\t\t\tif(Hora < 10 && Hora > 6){\n\t\t\t\tprintf(\"10:01\");\n\t\t\t} else if( Hora < 19 && Hora >= 16 ){\n\t\t\t\tprintf(\"20:02\");\n\t\t\t} else {\n\t\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid imprimirhora(int hora);\nint main()\n{\n int hora,minutos,h4=0;\n int I;\n int pal[]={0,110,220,330,440,550,660,770,880,990,1001,1111,1221,1331,1441,1551,2002,2112,2222,2332};\n\n scanf(\"%d:%d\",&hora,&minutos);\n\n h4=(hora*100)+minutos;\n //printf(\"\\n%d\\n\",h4);\n\n\n for(I=0;I<=19;I++)\n {\n if(pal[I]==h4&& !2332)\n {\n imprimirhora(pal[I+1]);\n break;\n }\n else if(h4<=59)\n {\n printf(\"01:10\");\n break;\n }\n else if(pal[I]>h4)\n {\n imprimirhora(pal[I]);\n break;\n }\n }\n if(h4>=2332)\n {\n printf(\"00:00\");\n }\n\n return 0;\n}\n\nvoid imprimirhora(int hora)\n{\n int prh=0,prm=0;\n\n\n prh=hora/100;\n if (prh<10)\n {\n printf(\"0\");\n }\n printf(\"%d\",prh);\n\n prm=hora-(prh*100);\n if (prm<10)\n {\n printf(\":0\");\n printf(\"%d\",prm);\n }\n else\n {\n printf(\":%d\",prm);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,k,i,j,m,t,q,c1=0;\n char s[100005];\n scanf(\"%s\",&s);\n q=strlen(s);\n\n printf(\"%d\\n\",q);\n t=(s[0]-'0');\n if(q==5)\n {\n k=(s[0]-'0')*10+(s[1]-'0');\n }\n else\n {\n k=t;\n }\n\n k=k+1;\n m=k%10;\n n=(k/10)%10;\n //printf(\"%d %d %d\\n\",k,m,n);\n\n if(k==24)\n {\n printf(\"00:00\");\n }\n else if(k<10)\n {\n printf(\"0%d:%d0\",m,m);\n }\n else\n {\n printf(\"%d:%d%d\",k,m,n);\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int a,b,c,d,e,f,g,h,i,j;\n char s[2];\n scanf(\"%d%*c%d\",&a,&b);\n if(a>=0&&a<=4)\n {\n printf(\"0%d:%d\",a+1,a*10);\n }\n else if(a>=5&&a<=9)\n {\n\n printf(\"10:10\");\n }\n else if(a>=15&&a<=19)\n {\n printf(\"20:02\");\n }\n else if(a>=10&&a<=14)\n {\n\n sprintf(s,\"%d\",a+1);\n printf(\"%d:%c%c\",a+1,s[1],s[0]);\n\n }\n else\n {\n printf(\"00:00\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar arr[5];\n\tint i,t,p,q,r,s,x,y,a;\n\tfor(i=0;i<5;i++)\n\tscanf(\"%c\",&arr[i]);\n\tt=(int)arr[0];\n\tp=(int)arr[1];\n t=t-48;\n p=p-48;\n x=t*10+p;\n q=(int)arr[3];\n r=(int)arr[4];\n q=q-48;\n r=r-48;\n y=q*10+r;\n if(y>=(p*10+t))\n {\n \tif(x==23)\n \tprintf(\"00:00\");\n \telse\n \t{\n \t\tif(x>=5&&x<=9)\n \t\tx=10;\n else if(x>=15&&x<=19)\n x=20;\n \t\telse\n \t\tx++;\n \t\ta=x;\n \t\t\tt=x%10;\n \t\t\tx=x/10;\n\t\t s=x%10;\n\t\t\tprintf(\"%d%d:%d%d\",s,t,t,s);\n\t\t}\n \t\n\t}\n\telse\n\t{\n\t\ta=x;\n\t\ts=0;\n\n \t\t\tt=x%10;\n \t\t\tx=x/10;\n \t\t\ts=x%10;\n\t\t\tprintf(\"%d%d:%d%d\",s,t,t,s);\n\t}\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nvoid cargar_matriz(char **matriz, int cant_pal);\n\nint crear_matriz();\n\nvoid funcion(char **matriz, int cant_pal);\n\nint main()\n{\n int cant_pal;\n cant_pal = crear_matriz();\n char *matriz[cant_pal];\n cargar_matriz(matriz,cant_pal);\n funcion(matriz,cant_pal);\n imprimir(matriz,cant_pal);\n\n return NULL;\n}\n\nvoid funcion(char **matriz, int cant_pal)\n{\n int i;\n\n for( i = 0 ; i < cant_pal ; i++)\n {\n\n if(strlen(matriz[i]) > 10)\n {\n abreviar(matriz[i]);\n }\n }\n return NULL;\n}\n\nvoid abreviar(char *palabra)\n{\n char palabra_nueva[50],aux[50];\n\n int n,i = 0,BAND=1;\n n = strlen(palabra)-2;\n palabra_nueva[0] = palabra[0];\n palabra_nueva[1] = '\\0';\n itoa(n,aux,10);\n strcat(palabra_nueva,aux);\n n=strlen(palabra_nueva);\n palabra_nueva[n] = palabra [ (strlen(palabra)) - 1 ];\n palabra_nueva[n+1] = '\\0';\n strcpy(palabra,palabra_nueva);\n\n\n}\n\nvoid imprimir(char **matriz,int cant_pal)\n{\n int i = 0;\n\n for( i = 0 ; i < cant_pal ; i++)\n {\n\n printf(\"\\n%s\",matriz[i]);\n }\n\n return NULL;\n}\n\nvoid cargar_matriz(char **matriz, int cant_pal)\n{\n char palabra[100];\n int i = 0;\n for( i = 0 ; i < cant_pal ; i++)\n {\n scanf(\"%s\",palabra);\n if( ( matriz[i] = (char *) malloc ( 1 + (sizeof(char) * strlen(palabra)) ) ) == NULL )\n {\n printf(\"\\nno hay espacio suficiente \");\n return NULL;\n }\n strcpy(matriz[i],palabra);\n }\n\n return NULL;\n}\n\nint crear_matriz()\n{\n int n;\n printf(\"ingrese la cantidad de palabras :\");\n scanf(\"%d\",&n);\n return n;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int h1, h2, m1, m2, h, m;\n scanf(\"%d:%d\", &h, &m);\n\n if(h < 23) {\n h++;\n h1 = (h % 100) / 10;\n h2 = (h % 10);\n } else {\n h = 0;\n h1 = 0;\n h2 = 0;\n }\n\n m1 = (h % 10);\n m2 = (h % 100) / 10;\n\n printf(\"%d%d:%d%d\\n\", h1, h2, m1, m2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n \n char lh,h,lm,m,t;\n int a,b,c,d,e,f;\n scanf(\"%c%c%c%c%c\",&lh,&h,&t,&lm,&m);\n \n a = lh-48;\n b = h-48;\n c = lm-48;\n d = m-48;\n \n while(a!=d || b!=c){\n \n if(d<9)\n d++;\n else if(d==9){\n c++;\n d=0;\n }\n \n if(c == 6 ){\n b++;\n c=0;\n }\n \n if( a==2 && b == 4){\n a++;\n b=0; \n }\n \n else if( b == 10){\n a++;\n b=0; \n }\n \n if(a==3){\n a=0;\n b=0;\n c=0;\n d=0; \n }\n \n \n }\n\n printf(\"%d%d:%d%d\",a,b,c,d); \n return 0;\n}\n/****** PCCA -Tue Oct 04 13:45:44 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\nint main()\n{\n char HORA[6],H[3],M[3];\n int H1,M1,I,I1;\n scanf(\"%s\",HORA);\n H[0]=HORA[0];\n H[1]=HORA[1];\n M[0]=HORA[3];\n M[1]=HORA[4];\n H1=atoi(H);\n M1=atoi(M);\n I1=10*(H1%10);\n I=I1+((H1%100)-(H1%10))/10;\n if(H1==05 && M1>I || (H1>05 && H1<10))\n {\n \t printf(\"10:01\");\n \t goto fin;\n\t}\n if(H1==15 && M1>I || (H1>15 && H1<20))\n\t{\n \t printf(\"20:02\");\n \tgoto fin;\n }\n if (I>M1)\n {\n printf(\"%d:%d \", H1,I);\n }\n else if (H1<23 )\n {\n H1=H1+1;\n I1=10*(H1%10);\n I=I1+((H1%100)-(H1%10))/10;\n printf(\"%d:%d \", H1,I);\n }\n else\n {\n printf(\"00:00\" );\n }\n fin: \n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char s[5];\n int i,k,n;\n while(scanf(\"%s\",s)!=EOF)\n {\n if(s[0]==s[4]&&s[1]==s[3])\n {\n if(s[0]=='2')\n {\n s[0]=s[1]=s[3]=s[4]='0';\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='5')\n {\n s[0]=s[4]='2';s[1]=s[3]='0';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='5')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[1]++;s[3]++;\n }\n }\n }\n else\n {\n if(s[0]=='2')\n {\n if(s[1]=='3')\n {\n if(s[3]>=s[1])\n {\n s[0]='0';s[1]='0';s[3]='0';s[4]='0';\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];s[4]=s[0];\n }\n }\n }\n else\n if(s[0]=='1')\n {\n if(s[1]>='6')\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]<s[0])\n {\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n else\n {\n s[0]='2';s[1]='0';s[3]='0';s[4]='2';\n }\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n else\n if(s[0]=='0')\n {\n if(s[1]>='6')\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n if(s[1]=='5')\n {\n if(s[3]>=s[1])\n {\n if(s[4]>s[0])\n {\n s[0]='1';s[1]='0';s[3]='0';s[4]='1';\n }\n else\n {\n s[4]=s[0];s[1]=s[3];\n }\n }\n else\n {\n s[4]=s[0];s[3]=s[1];\n }\n }\n else\n {\n if(s[3]>=s[1])\n {\n if(s[3]==s[1])\n {\n if(s[4]>s[0])\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n else\n {\n s[1]++;\n s[3]=s[1];s[4]=s[0];\n }\n }\n else\n {\n s[3]=s[1];\n s[4]=s[0];\n }\n }\n }\n }\n }\n printf(\"%s\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n\n#define sf scanf\n#define sfi1(a) scanf(\"%d\", &a)\n#define sfi2(a,b) scanf(\"%d %d\", &a, &b)\n#define sfi3(a,b,c) scanf(\"%d %d %d\", &a, &b, &c)\n#define sfi4(a,b,c,d) scanf(\"%d %d %d %d\", &a, &b, &c, &d)\n#define sfll1(a) scanf(\"%lld\", &a)\n#define sfll2(a,b) scanf(\"%lld %lld\", &a, &b)\n#define sfll3(a,b,c) scanf(\"%lld %lld %lld\", &a, &b, &c)\n#define sfll4(a,b,c,d) scanf(\"%lld %lld %lld %lld\", &a, &b, &c, &d)\n#define sfc1(a) scanf(\"%c\", &a)\n#define sfc2(a,b) scanf(\"%c %c\", &a, &b)\n#define sfc3(a,b,c) scanf(\"%c %c %c\", &a, &b, &c)\n#define sfc4(a,b,c,d) scanf(\"%c %c %c %c\", &a, &b, &c, &d)\n#define sfd1(a) scanf(\"%lf\", &a)\n#define sfd2(a,b) scanf(\"%lf %lf\", &a, &b)\n#define sfd3(a,b,c) scanf(\"%lf %lf %lf\", &a, &b, &c)\n#define sfd4(a,b,c,d) scanf(\"%lf %lf %lf %lf\", &a, &b, &c, &d)\n#define pf printf\n#define loop(i,n) for(int i=0; i<n; i++)\n#define rloop(i,n) for(int i=n-1; i>=0; i--)\n\n#define INF 100000000000ll\n#define MOD 1000000007ll\n#define test(d) cout << \"test \" << d << endl;\n#define start(a,b) cout <<\"---------start-----\" << a << \" \" << b << \"-----------\\n\";\n#define testReturn(i,v) cout <<\"return frm \" << i << \" : \" << v << endl;\n#define testFound(i,v) cout <<\"found value \" << i << \" : \" << v << endl;\n#define testBaseRet(i,v) cout <<\"return frm base condition \" << i << \" : \" << v << endl;\n#define MAXN 24\n\n\n\n//variable\nint t, h, m, r_h;\n\n//method\nint rev(int x){\n return ((x%10)*10 + x/10 );\n}\n\nvoid Print(){\n if(h<=9) pf(\"0%d::\", h);\n else pf(\"%d::\", h);\n if(r_h<=9) pf(\"0%d\\n\", r_h);\n else pf(\"%d\\n\", r_h);\n}\n\nint main(){\n //freopen(\"in_01.txt\", \"r\", stdin);\n //freopen(\"out_01.txt\", \"w\", stdout);\n //sfi1(t);\n // while(t--){\n scanf(\"%d::%d\", &h, &m);\n r_h = rev(h);\n while(1){\n if(r_h > m ) {\n if(r_h <= 59) {Print(); break;}\n else{\n h = ( (int) (h/10.0 + .5) ) * 10;\n r_h = rev(h);\n m = -1; continue;\n }\n } else{\n h = (h+1)% 24;\n r_h = rev(h);\n m = -1;\n }\n }\n // }\n // while(1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n int Aux,i;\n float H;\n\n scanf(\"%d:%d\",&hora,&Min);\n Min++;\n\n while(hora!=24){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n for (i=Min;Min<=60;Min++){\n if(H==Min){\n if(hora<10){\n printf(\"0%d:\",hora);\n }\n else{\n printf (\"%d:\",hora);\n }\n if(Min<10){\n printf(\"0%d\",Min);\n }\n else{\n printf (\"%d\",Min);\n }\n break;\n }\n }\n if(H==Min)\n break;\n hora++;\n Min=0;\n }\n if(hora==24)\n printf(\"00:00\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n//int check(int arr[]);\n//int check(int arr[])\n//{\n//\tint i, flag=1;\n//\tfor(i=0;i<4;i++){\n//\t\tif(arr[i]!=arr[3-i])\n//\t\t\tflag=0;\n//\t}\n//\treturn flag;\n//}\nint main()\n{\n\tint arr[4], a[2], flag, m, n;\n\tscanf(\"%d:%d\", &a[0], &a[1]);\n\tarr[1]=(a[0]%10);\n\tarr[0]=(a[0]/10);\n\tarr[3]=(a[1]%10);\n\tarr[2]=(a[1]/10);\n//\tflag=check(arr);\n//\tif(flag==1){\n//\t\tm=a[0];\n//\t\tn=(10*(m%10))+(m/10);\n//\t\tif(m<10 && n>=10)\n//\t\t\tprintf(\"0%d:%d\", m, n);\n//\t\telse if(n<10 && m>=10)\n//\t\t\tprintf(\"%d:0%d\", m, n);\n//\t\telse if(m<10 && n<=10)\n//\t\t\tprintf(\"0%d:0%d\", m, n);\n//\t\telse\n//\t\t\tprintf(\"%d:%d\", m, n);\n//\t}\n\tif(((a[0]<7)||(a[0]>9))&&((a[0]<15)||(a[0]>19))){\n\t\tm=a[0];\n\t\tn=(10*(m%10))+(m/10);\n\t\tif(a[1]<n){\n\t\t\tif(m<10 && n>=10)\n\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\telse if(n<10 && m>=10)\n\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\telse if(m<10 && n<=10)\n\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\telse\n\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t}\n\t\telse{\n\t\t\tif(a[0]==23)\n\t\t\t\tprintf(\"00:00\");\n\t\t\telse{\n\t\t\t\tm=a[0]+1;\n\t\t\t\tn=(10*(m%10))+(m/10);\n\t\t\t\tif(m<10 && n>=10)\n\t\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\t\telse if(n<10 && m>=10)\n\t\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\t\telse if(m<10 && n<=10)\n\t\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t\t}\n\t\t}\n\t}\n\telse if(a[0]<10)\n\t\tprintf(\"10:01\");\n\telse\n\t\tprintf(\"20:02\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%2d:%2d\",&a,&b);\n d=a;\n c=a%10;\n a=a/10;\n if(b>(10*c+a))\n d=d+1;\n a=d;\n if(a==24)\n {\n printf(\"00:00\\n\");\n return 0;\n }\n while(1)\n {\n c=d%10;\n d=d/10;\n if((10*c+d)<60)\n {\n printf(\"%02d:%02d\\n\",a,(10*c+d));\n break;\n }\n else\n {\n a++;\n d=a;\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint h,m;\n\tchar c;\n\tscanf(\"%d%c%d\",&h,&c,&m);\n\t\t\tif(h==0)\n\t\t\t\tprintf(\"01:10\\n\");\n\t\t\telse if(h<=1)\n\t\t\t\tif(m<10)\n\t\t\t\t\tprintf(\"01:10\\n\");\n\t\t\t\telse printf(\"02:20\\n\");\n\n\t\t\telse if(h<=2)\n\t\t\t\tif(m<20)\n\t\t\t\tprintf(\"02:20\\n\");\n\t\t\t\telse printf(\"03:30\\n\");\n\n\t\t\telse if(h<=3)\n\t\t\t\tif(m<30)\n\t\t\t\tprintf(\"03:30\\n\");\n\t\t\t\telse printf(\"04:40\\n\");\n\t\t\telse if(h<=4)\n\t\t\t\tif(m<40)\n\t\t\t\tprintf(\"04:40\\n\");\n\t\t\t\telse printf(\"05:50\\n\");\n\t\t\telse if(h<=5)\n\t\t\t\tif(m<50)\n\t\t\t\tprintf(\"05:50\\n\");\n\t\t\t\telse printf(\"10:01\\n\");\n\t\t\t\n\t\t\telse if(h>=6 && h<10)\n\t\t\t\tprintf(\"10:01\\n\");\n\n\t\t\telse if(h<=10)\n\t\t\t\tif(m<01)\n\t\t\t\tprintf(\"10:01\\n\");\n\t\t\t\telse printf(\"11:11\\n\");\n\t\t\telse if(h<=11)\n\t\t\t\tif(m<11)\n\t\t\t\tprintf(\"11:11\\n\");\n\t\t\t\telse printf(\"12:21\\n\");\n\t\t\telse if(h<=12)\n\t\t\t\tif(m<21)\n\t\t\t\tprintf(\"12:21\\n\");\n\t\t\t\telse printf(\"13:31\\n\");\n\t\t\telse if(h<=13)\n\t\t\t\tif(m<31)\n\t\t\t\tprintf(\"13:31\\n\");\n\t\t\t\telse printf(\"14:41\\n\");\n\t\t\telse if(h<=14)\n\t\t\t\tif(m<41)\n\t\t\t\tprintf(\"14:41\\n\");\n\t\t\t\telse printf(\"15:51\\n\");\n\t\t\t\n\t\t\telse if(h<=15)\n\t\t\t\tif(m<51)\n\t\t\t\tprintf(\"15:51\\n\");\n\t\t\t\telse printf(\"20:02\\n\");\n\n\t\t\telse if(h>=16 && h<20)\n\t\t\t\tprintf(\"02:20\\n\");\n\n\t\t\telse if(h<=20)\n\t\t\t\tif(m<02)\n\t\t\t\tprintf(\"20:02\\n\");\n\t\t\t\telse printf(\"21:12\\n\");\n\t\t\telse if(h<=21)\n\t\t\t\tif(m<12)\n\t\t\t\tprintf(\"21:12\\n\");\n\t\t\t\telse printf(\"22:22\\n\");\n\t\t\telse if(h<=22)\n\t\t\t\tif(m<22)\n\t\t\t\tprintf(\"22:22\\n\");\n\t\t\t\telse printf(\"23:32\\n\");\n\t\t\telse if(h<=23)\n\t\t\t\tif(m<32)\n\t\t\t\tprintf(\"23:32\\n\");\n\t\t\t\telse printf(\"00:00\\n\");\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[6];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) + 1 ;\n\tif(Hora > 24){\n\t\tprintf(\"00:00\");\n\t}else {\n\t\tif(Hora < 10 && Hora >= 6){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora < 19 && Hora >= 16 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\n\t\t}\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\n\nint main(){\n char s[6];int a,b,c,d,n;\n scanf(\"%s%n\",s,&n);\n sscanf(s,\"%1d%1d:%1d%1d\",&a,&b,&c,&d);\n if(((10*a+b)<16 && !((10*a+b)==15&&(c*10+d)>50)) || (((10*a+b)>19) && !((10*a+b)==20&&(c*10+d)<2))){\n if((b*10+a)<=(10*c+d)){\n if((a*10+b)==23){\n sprintf(s,\"%d%d:%d%d\",0,0,0,0);\n }else\n sprintf(s,\"%d%d:%d%d\",a,b+1,b+1,a);\n\n }else{if ((b*10+a)>(10*c+d))\n sprintf(s,\"%d%d:%d%d\",a,b,b,a);\n }\n }else\n sprintf(s,\"%d%d:%d%d\",2,0,0,2);\n printf(\"%s\",s);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nchar ch[6];\nscanf(\"%s\",ch);\nif(ch[0]=='2' && ch[1]=='3' && (ch[3]<='2' || (ch[3]=='3' && (ch[4]=='1' || ch[4]=='0'))))\nprintf(\"23:32\");\nelse if(ch[0]=='2' && ch[1]=='3')\nprintf(\"00:00\");\nelse if(ch[3]>ch[1])\n{\nch[1]=ch[1]+1;\nif(ch[1]>='6')\n{\nch[1]='0';\nch[0]=ch[0]+1;\n}\nch[3]=ch[1];\nch[4]=ch[0];\nprintf(\"%s\",ch);\n}\nelse if(ch[1]==ch[3] && ch[0]==ch[4])\n{\nch[1]=ch[1]+1;\nif(ch[1]>='6')\n{\nch[1]='0';\nch[0]=ch[0]+1;\n}\nch[3]=ch[1];\nch[4]=ch[0];\nprintf(\"%s\",ch);\n}\nelse if(ch[3]<ch[1])\n{\nch[3]=ch[1];\nch[4]=ch[0];\nprintf(\"%s\",ch);\n}\n\nelse\n{\nch[3]=ch[1];\nch[4]=ch[0];\nprintf(\"%s\",ch);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char tiempo[6];\n char hora[3],minuto[3],hc[3],haux[2];\n int aux;\n scanf(\"%s\",tiempo);\n\n hora[0]=tiempo[0];\n hora[1]=tiempo[1];\n hora[2]='\\0';\n\n minuto[0]=tiempo[3];\n minuto[1]=tiempo[4];\n minuto[2]='\\0';\n\n haux[1]='\\0';\n\n hc[1]=tiempo[0];\n hc[0]=tiempo[1];\n hc[2]='\\0';\n\n if(atoi(hora)<10)\n {\n if(atoi(hora)<6)\n {\n if(atoi(hc) > atoi(minuto))\n {\n strcpy(minuto,hc);\n }\n else\n {\n aux = atoi(hora)+1;\n itoa(aux,haux,10);\n hora[1] = haux[0];\n minuto[0]=hora[1];\n minuto[1]=hora[0];\n }\n }\n else\n {\n strcpy(hora,\"10\");\n strcpy(minuto,\"01\");\n }\n }\n else if(atoi(hora)==15 && atoi(minuto)>=52)\n {\n strcpy(hora,\"20\");\n strcpy(minuto,\"02\");\n }\n else if(atoi(hora)>15 && atoi(hora)<20)\n {\n strcpy(hora,\"20\");\n strcpy(minuto,\"02\");\n }\n else if(atoi(hc) > atoi(minuto))\n {\n strcpy(minuto,hc);\n }\n else if(atoi(hora) == 23)\n {\n strcpy(hora,\"00\");\n strcpy(minuto,\"00\");\n }\n else\n {\n aux = atoi(hora)+1;\n itoa(aux,hora,10);\n minuto[0]=hora[1];\n minuto[1]=hora[0];\n }\n printf(\"%s:\",hora);\n printf(\"%s\",minuto);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],x,y,m,n;\n scanf(\"%d%d\",&a[0],&a[1]);\n while(a[1]<=59)\n {\n a[1]++;\n if(a[1]>59)\n {\n a[1]=00;\n a[0]++;\n if(a[0]>23)\n a[0]=00;\n }\n x=a[0]/10;\n y=a[0]%10;\n m=a[1]/10;\n n=a[1]%10;\n if(x==n&&y==m)\n {\n printf(\"%d%d:%d%d\\n\",x,y,m,n);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nmain()\n{\n char hora[5] = {0};\n char HH[3] = {0};\n char MM[3] = {0};\n char *ptr;\n\n scanf( \"%s\", hora );\n\n ptr = strncpy( HH, hora, 2);\n\n ptr = strncpy( MM, &hora[3], 2);\n\n if( HH[1] == '0' )\n {\n HH[1] = '1';\n MM[0] = HH[1];\n MM[1] = HH[0];\n }\n else if( HH[1] == '1' )\n {\n HH[1] = '2';\n MM[0] = HH[1];\n MM[1] = HH[0];\n }\n else if( HH[1] == '2' )\n {\n HH[1] = '3';\n MM[0] = HH[1];\n MM[1] = HH[0];\n }\n else if( HH[1] == '3' )\n {\n if( HH[0] == '2' )\n {\n HH[0] = '0';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '0';\n }\n else\n {\n HH[1] = '4';\n MM[0] = HH[1];\n MM[1] = HH[0];\n }\n }\n else if( HH[1] == '4' )\n {\n HH[1] = '5';\n MM[0] = HH[1];\n MM[1] = HH[0];\n }\n else if( HH[1] == '5' )\n {\n if( HH[0] == '1' )\n {\n HH[0] = '2';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '2';\n }\n else\n {\n HH[0] = '1';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '1';\n }\n }\n else if( HH[1] == '6' )\n {\n if( HH[0] == '1' )\n {\n HH[0] = '2';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '2';\n }\n else\n {\n HH[0] = '1';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '1';\n }\n }\n else if( HH[1] == '7' )\n {\n if( HH[0] == '1' )\n {\n HH[0] = '2';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '2';\n }\n else\n {\n HH[0] = '1';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '1';\n }\n }\n else if( HH[1] == '8' )\n {\n if( HH[0] == '1' )\n {\n HH[0] = '2';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '2';\n }\n else\n {\n HH[0] = '1';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '1';\n }\n }\n else if( HH[1] == '9' )\n {\n if( HH[0] == '1' )\n {\n HH[0] = '2';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '2';\n }\n else\n {\n HH[0] = '1';\n HH[1] = '0';\n MM[0] = '0';\n MM[1] = '1';\n }\n }\n\n hora[0] = HH[0];\n hora[1] = HH[1];\n hora[2] = ':';\n hora[3] = MM[0];\n hora[4] = MM[1];\n hora[5] = '\\0';\n\n printf( \"%s\\n\", hora );\n\n return;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d:%d\",&b,&c);\n a=(b*60)+c;\n for(a;a<1440;a++){\n d=a/60;\n e=a-(d*60);\n if(d==((e%10)*10+(e/10)))\n break;\n }\n printf(\"%d:%d\",d,e);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid buscar_hora(int *hora, int *minuto);\n\nvoid imprimir(int hora, int minuto);\n\nint main()\n{\n int hora,minuto, hora_d, hora_u;\n scanf(\"%d%*c%d\",&hora,&minuto);\n buscar_hora(&hora,&minuto);\n\n imprimir(hora,minuto);\n\n return NULL;\n}\n\nvoid buscar_hora(int *hora, int *minuto)\n{\n int hora_d, hora_u, minuto_d, minuto_u, max_h = 23, max_m = 59;\n hora_d = (*hora)/10; hora_u = (*hora)%10;\n minuto_d =(*minuto)/10; minuto_u = (*minuto)%10;\n\n if ( (*hora > 22) && (*minuto > 31) )\n {\n *hora = 0; *minuto = 0;\n return NULL;\n }\n if( *minuto < (hora_d) + (hora_u*10) )\n {\n if( (hora_d*10 +hora_u) < 16 || (hora_d*10 +hora_u) > 19)\n {\n *minuto = hora_d + (hora_u*10);\n return NULL;\n }\n else\n {\n *hora = 20;\n *minuto = 2;\n return NULL;\n }\n\n return NULL;\n }\n else\n {\n if(*hora < 15 || *hora > 18)\n {\n *hora=*hora +1;\n *minuto = (*hora)/10 + ((*hora)%10)*10;\n return NULL;\n }\n else\n {\n *hora = 20;\n *minuto = 2;\n return NULL;\n }\n\n }\n return NULL;\n}\n\n\n\nvoid imprimir(int hora, int minuto)\n{\n int a = 0;\n if( hora == 0 && minuto == 0)\n {\n printf(\"%d%d:%d%d\",hora,hora,minuto,minuto);\n return NULL;\n }\n if( hora == 0 && minuto < 10)\n {\n printf(\"%d%d:%d%d\",hora,hora,a,minuto);\n return NULL;\n }\n if(hora <10 && minuto == 0)\n {\n printf(\"%d%d:%d%d\",a,hora,minuto,minuto);\n return NULL;\n }\n if(hora < 10 && minuto < 10)\n {\n\n printf(\"%d%d:%d%d\",a,hora,a,minuto);\n return NULL;\n }\n if(minuto < 10)\n {\n printf(\"%d:%d%d\",hora,a,minuto);\n return NULL;\n }\n if(hora < 10)\n {\n printf(\"%d%d:%d\",a,hora,minuto);\n return NULL;\n }\n printf(\"%d:%d\",hora,minuto);\n\n}\n"}, {"source_code": "#include <stdio.h>\nrev(int a){\n\tint b=0;\n\twhile(a){\n\t\tb*=10;\n\t\tb+=(a%10);\n\t\ta/=10;\n\t}\n\treturn b;\n}\nint main()\n{\n int hh, mm;\n scanf(\"%d:%d\", &hh, &mm);\n if(mm==rev(hh)){\n \tmm++;\n \tif(mm == 60)\n {\n hh++;\n mm = 0;\n }\n\t}\n while(mm!=rev(hh)) \n {\n mm++;\n if (mm == 60)\n {\n hh++;\n mm = 0;\n }\n if (hh == 24)\n {\n hh = 0;\n }\n }\n printf(\"%02d:%02d\\n\", hh, mm);\n //scanf(\"%d\" ,&hh); printf(\"rev of hh is: %02d\" ,rev(hh));\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int hr, min, c1, c2, flag = 0;\n char t[6];\n scanf(\"%s\", t);\n hr = (t[0]-'0') * 10 + (t[1]-'0');\n min = (t[3]-'0') * 10 + (t[4]-'0');\n c1 = hr;\n c2 = (t[1]-'0') * 10 + (t[0]-'0');\n\n while(1) {\n if((c1 != hr && c2 < 60) || (c2 > min && c2 < 60)) {\n if(c1/10 == 0)\n printf(\"0%d:%d\", c1, c2);\n else if(c1%10 == 0)\n printf(\"%d:0%d\", c1, c2);\n else\n printf(\"%d:%d\", c1, c2);\n break;\n } else{\n c1 = (c1+1) % 24;\n c2 = (c1%10) * 10 + (c1/10);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(void)\n{\n int h1, h2, m1, m2, hora, minuto, m_invertido;\n h1 = getchar() - '0';\n h2 = getchar() - '0';\n hora = h1 * 10 + h2;\n getchar();\n m1 = getchar() - '0';\n m2 = getchar() - '0';\n minuto = m1 * 10 + m2;\n\n m_invertido = h2 * 10 + h1;\n if(m_invertido < 60 && m_invertido > minuto)\n {\n printf(\"%d%d:%d%d\", h1, h2, h2, h1);\n }\n else if(m_invertido >= 60 || (hora == 15 && minuto >= 51))\n {\n printf(\"20:02\");\n }\n else\n {\n h2++;\n if(hora == 23)\n {\n h1 = 0;\n h2 = 0;\n }\n printf(\"%d%d:%d%d\", h1, h2, h2, h1);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int m,n,t=24,k=60;\n char s;\n scanf(\"%d:%d\",&m,&n);\n while(t--)\n {while(k--)\n {\n n++;\n if(n==60)\n { n=0;\n m++;\n if(m==24)\n m=0;\n }\n if(n/10==m%10 && m/10==n%10)\n {goto x;}\n }}\n x:\n printf(\"%d:%d\",m,n);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int h=0,m=0,a=0,b=0;\n int c=0;\n scanf(\"%d:%d\",&h,&m);\n if(h==23){\n h=0;\n m=0;\n\n }else if(h>5 && h<10){\n h=10;\n m=1;\n }\n else if(h<15 || h>19){\n c=h;\n a=h/10;\n c=c-a*10;\n a=a+c*10;\n if(a>m){\n m=a;\n }else{\n h++;\n c=h;\n m=h/10;\n c=c-m*10;\n m=m+c*10;\n }\n\n }else{\n h=20;\n m=2;\n }\n if(h==0 && m==0){\n printf(\"00:00\");\n }else if(h>=0 && h<=9){\n printf(\"0%d:%d\",h,m);\n }else if(m>=0 && m<=9){\n printf(\"%d:0%d\",h,m);\n }else{\n printf(\"%d:%d\",h,m);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid imprimirhora(int hora);\nint main()\n{\n int hora,minutos,h4=0;\n int I;\n int pal[]={0,110,220,330,440,550,1001,1111,1221,1331,1441,1551,2002,2112,2222,2332};\n\n scanf(\"%d:%d\",&hora,&minutos);\n\n h4=(hora*100)+minutos;\n //printf(\"\\n%d\\n\",h4);\n\n\n for(I=0;I<=16;I++)\n {\n if(pal[I]==h4&& !2332)\n {\n imprimirhora(pal[I+1]);\n break;\n }\n else if(h4<=59)\n {\n printf(\"01:10\");\n break;\n }\n else if(pal[I]>h4)\n {\n imprimirhora(pal[I]);\n break;\n }\n }\n if(h4>=2332)\n {\n printf(\"00:00\");\n }\n\n return 0;\n}\n\nvoid imprimirhora(int hora)\n{\n int prh=0,prm=0;\n\n\n prh=hora/100;\n if (prh<10)\n {\n printf(\"0\");\n }\n printf(\"%d\",prh);\n\n prm=hora-(prh*100);\n if (prm<10)\n {\n printf(\":0\");\n printf(\"%d\",prm);\n }\n else\n {\n printf(\":%d\",prm);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int h=0,m=0,a=0;\n int c=0;\n scanf(\"%d:%d\",&h,&m);\n if(h==23){\n if(m<32){\n m=32;\n }else{\n h=0;\n m=0;\n }\n\n }else if(h>5 && h<10){\n h=10;\n m=1;\n }\n else if(h<16 || h>19){\n c=h;\n a=h/10;\n c=c-a*10;\n a=a+c*10;\n if(a>m){\n m=a;\n }else{\n h++;\n c=h;\n m=h/10;\n c=c-m*10;\n m=m+c*10;\n }\n\n }else{\n h=20;\n m=2;\n }\n if(h==0 && m==0){\n printf(\"00:00\");\n }else if(h>=0 && h<=9){\n printf(\"0%d:%d\",h,m);\n }else if(m>=0 && m<=9){\n printf(\"%d:0%d\",h,m);\n }else{\n printf(\"%d:%d\",h,m);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint ok(int a,int b)\n{\n if(a/10!=b%10)return 0;\n if(a%10!=b/10)return 0;\n return 1;\n}\nvoid next(int *a,int *b)\n{\n (*b)++;\n *a+=*b/60;\n *b%=60;\n *a%=60;\n}\nint main()\n{\n int a,b;\n scanf(\"%d:%d\",&a,&b);\n do{next(&a,&b);}while(!ok(a,b));\n printf(\"%d%d:%d%d\\n\",a/10,a%10,b/10,b%10);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint h,m;\n\tchar c;\n\tscanf(\"%d%c%d\",&h,&c,&m);\n\t\t\tif(h==0)\n\t\t\t\tprintf(\"01:10\\n\");\n\t\t\telse if(h<=1)\n\t\t\t\tif(m<10)\n\t\t\t\t\tprintf(\"01:10\\n\");\n\t\t\t\telse printf(\"02:20\\n\");\n\n\t\t\telse if(h<=2)\n\t\t\t\tif(m<20)\n\t\t\t\tprintf(\"02:20\\n\");\n\t\t\t\telse printf(\"03:30\\n\");\n\n\t\t\telse if(h<=3)\n\t\t\t\tif(m<30)\n\t\t\t\tprintf(\"03:30\\n\");\n\t\t\t\telse printf(\"04:40\\n\");\n\t\t\telse if(h<=4)\n\t\t\t\tif(m<40)\n\t\t\t\tprintf(\"04:40\\n\");\n\t\t\t\telse printf(\"05:50\\n\");\n\t\t\telse if(h<=5)\n\t\t\t\tif(m<50)\n\t\t\t\tprintf(\"05:50\\n\");\n\t\t\t\telse printf(\"10:01\\n\");\n\t\t\t\n\t\t\telse if(h>=6 && h<10)\n\t\t\t\tprintf(\"10:01\\n\");\n\n\t\t\telse if(h<=10)\n\t\t\t\tif(m<01)\n\t\t\t\tprintf(\"10:01\\n\");\n\t\t\t\telse printf(\"11:11\\n\");\n\t\t\telse if(h<=11)\n\t\t\t\tif(m<11)\n\t\t\t\tprintf(\"11:11\\n\");\n\t\t\t\telse printf(\"12:21\\n\");\n\t\t\telse if(h<=12)\n\t\t\t\tif(m<21)\n\t\t\t\tprintf(\"12:21\\n\");\n\t\t\t\telse printf(\"13:31\\n\");\n\t\t\telse if(h<=13)\n\t\t\t\tif(m<31)\n\t\t\t\tprintf(\"13:31\\n\");\n\t\t\t\telse printf(\"14:41\\n\");\n\t\t\telse if(h<=14)\n\t\t\t\tif(m<41)\n\t\t\t\tprintf(\"14:41\\n\");\n\t\t\t\telse printf(\"15:51\\n\");\n\t\t\t\n\t\t\telse if(h<=15)\n\t\t\t\tif(m<51)\n\t\t\t\tprintf(\"15:51\\n\");\n\t\t\t\telse printf(\"20:02\\n\");\n\n\t\t\telse if(h>=16 && h<20)\n\t\t\t\tprintf(\"02:20\\n\");\n\n\t\t\telse if(h<=20)\n\t\t\t\tif(m<02)\n\t\t\t\tprintf(\"20:02\\n\");\n\t\t\t\telse printf(\"21:12\\n\");\n\t\t\telse if(h<=21)\n\t\t\t\tif(m<12)\n\t\t\t\tprintf(\"21:12\\n\");\n\t\t\t\telse printf(\"22:22\\n\");\n\t\t\telse if(h<=22)\n\t\t\t\tif(m<22)\n\t\t\t\tprintf(\"22:22\\n\");\n\t\t\t\telse printf(\"23:32\\n\");\n\t\t\telse if(h<=23)\n\t\t\t\tif(m<32)\n\t\t\t\tprintf(\"23:32\\n\");\n\t\t\t\telse printf(\"00:00\\n\");\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n\n scanf(\"%d:%d\",&hora,&Min);\n int Aux;\n float H;\n\n if((hora>0 && hora <=5 && Min<=50 )||(hora>=10 && hora<=15 && Min<=51)||(hora>=20 && hora<=23 && Min<=32)){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n if(Min<H)\n printf(\"%d:%.0f\",hora,H);\n else{\n hora++;\n H=H+10;\n printf(\"%d:%.0f\",hora,H);\n }\n }\n else if (hora>=6 && hora<=9)\n printf(\"10:01\");\n else if (hora>=16 && hora<=19)\n printf(\"20:02\");\n else\n printf(\"00:00\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nvoid imprimirfecha(int fecha);\nint main()\n{\n int hora,minutos,h4=0;\n int I;\n int pal[]={0,110,220,330,440,550,660,770,880,990,1001,1111,1221,1331,1441,1551,2002,2112,2222,2332};\n\n scanf(\"%d:%d\",&hora,&minutos);\n\n h4=(hora*100)+minutos;\n //printf(\"\\n%d\\n\",h4);\n\n\n for(I=0;I<=19;I++)\n {\n if(pal[I]==h4&& !2332)\n {\n imprimirfecha(pal[I+1]);\n break;\n }\n else if(h4<=59)\n {\n printf(\"01:10\");\n break;\n }\n else if(pal[I]>h4)\n {\n imprimirfecha(pal[I]);\n break;\n }\n }\n if(h4>=2332)\n {\n printf(\"00:00\");\n }\n\n return 0;\n}\n\nvoid imprimirfecha(int fecha)\n{\n int prh=0,prm=0;\n\n\n prh=fecha/100;\n if (prh<10)\n {\n printf(\"0\");\n }\n printf(\"%d\",prh);\n\n prm=fecha-(prh*100);\n printf(\":%d\",prm);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,h,m;\n scanf(\"%d:%d\",&h,&m);\n if(h!=23)\n {\n h++;\n m=h;\n a=m%10;\n m/=10;\n m=a*10+m;\n printf(\"%d:%d\\n\",h,m);\n }\n else\n printf(\"00:00\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\nint main()\n{\n char HORA[6],H[3],M[3];\n int H1,M1,I,I1;\n scanf(\"%s\",HORA);\n H[0]=HORA[0];\n H[1]=HORA[1];\n M[0]=HORA[3];\n M[1]=HORA[4];\n H1=atoi(H);\n M1=atoi(M);\n I1=10*(H1%10);\n I=I1+((H1%100)-(H1%10))/10;\n if(H1==05 && M1>I || (H1>05 && H1<10))\n {\n \t printf(\"10:01\");\n \t goto fin;\n\t}\n if(H1==15 && M1>I || (H1>15 && H1<20))\n\t{\n \t printf(\"20:02\");\n \tgoto fin;\n }\n if (I>M1)\n {\n printf(\"%d:%d \", H1,I);\n }\n else if (H1<23 )\n {\n H1=H1+1;\n I1=10*(H1%10);\n I=I1+((H1%100)-(H1%10))/10;\n printf(\"%d:%d \", H1,I);\n }\n else\n {\n printf(\"00:00\" );\n }\n fin: \n return 0;\n}\n \n"}, {"source_code": "#include <stdio.h>\n\nchar s[6] ;\n\nint a,b,c,d ,h,m , x ;\n\nint main()\n{\n scanf(\"%s\", &s) ;\n\n a = s[0] - '0' ;\n b = s[1] - '0' ;\n c = s[3] - '0' ;\n d = s[4] - '0' ;\n\n h = a*10 + b ;\n m = c*10 + d ;\n x = a + 10* b ;\n if ( x >= 60 )\n {\n printf(\"20:02\") ;\n }\n else if( x > m )\n {\n printf(\"%d:%d\",h,x ) ;\n }\n else if ( h == 23)\n {\n printf(\"00:00\") ;\n }\n else\n {\n h += 1 ;\n x += 10 ;\n if ( x >= 60 )\n {\n printf(\"20:02\") ;\n }\n else\n {\n printf(\"%d:%d\",h,x ) ;\n }\n\n }\n\n\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c[10];\n scanf(\"%s\", c);\n int num1=10*(c[0]-'0')+(c[1]-'0');\n int num2=10*(c[3]-'0')+(c[4]-'0');\n //printf(\"%d %d\", num1, num2);\n int ttemp=num1;\n int pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\" %d\\n\", pnum1);\n if(num2<pnum1 && pnum1<=60)\n printf(\"%d:%d\\n\", num1, pnum1);\n else\n {\n while(1)\n {\n num1+=1;\n num1%=24;\n ttemp=num1;\n pnum1=0;\n while(ttemp)\n {\n int temp=ttemp%10;\n pnum1*=10;\n pnum1+=temp;\n ttemp/=10;\n }\n if(num1/10==0)\n pnum1*=10;\n //printf(\"num1=%d pnum1=%d\\n\", num1, pnum1);\n if(pnum1<=60)\n {\n if(num1/10==0) \n {\n if(pnum1/10==0)\n {\n printf(\"0%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"0%d:%d\\n\", num1, pnum1);\n }\n else\n {\n if(pnum1/10==0)\n {\n printf(\"%d:0%d\\n\", num1, pnum1); \n }\n else\n printf(\"%d:%d\\n\", num1, pnum1);\n }\n break;\n }\n }\n }\n}"}, {"source_code": "#include <string.h>\n#include <stdio.h>\nint main()\n{\n char h,h1,m,m1;\n scanf(\"%c%c:%c%c\",&h,&h1,&m,&m1);\n if(h=='0' && h1<='9' && h1>='0')\n {\n \n if(m<'5' && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n else if(h1>='5' && m>='0')\n {\n h='1';\n h1='0';\n m='0';\n m1='1';\n \n }\n else \n {\n m1='0';\n m=h1+1;\n }\n }\n else if(h=='1' && h1>='0' && h1<='9')\n {\n \n if(m<'5' && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n else if( h1>='5' && m1>='1')\n {\n h='2';\n h1='0';\n m='0';\n m1='2';\n }\n else \n {\n m=h1+1;\n m1='1';\n }\n }\n else if(h=='2' && h1>='0' && h1<='3')\n {\n if(m<'3' && h==m1&& m==h1)\n {\n h1++;\n m++;\n }\n else if(h1>='3' && m>='3' && m1>'2')\n {\n h='0';\n h1='0';m='0';m1='0';\n }\n else\n {\n m=h1+1;\n m1='2';\n }\n }\n printf(\"%c%c:%c%c\",h,h1,m,m1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,c,b;\n\tchar b1,b2,b3;\n\tscanf(\"%d%c%c%c%d\",&a,&b1,&b2,&b3,&c);\n\t//\tprintf(\"%d %d\",a,c);\n//\ta = 0;\n//\tb = 0;\n\t\tint t;\n//\twhile(b < 23 )\n//\t{\n\t\tt=(a%10)*10 + a/10;\n\t\tif(t > 59 || t <= c)\n\t\t{\n\t\t\tif(a!=23)\n\t\t\t\ta=a+1;\n\t\t\telse\n\t\t\t\ta=0;\n\n\t\t\tt=(a%10)*10 + a/10;\n\n\t\t\twhile(t > 59)\n\t\t\t{\n\t\t\t\tif(a!=23)\n\t\t\t\t\ta=a+1;\n\t\t\t\telse\n\t\t\t\t\ta=0;\n\t\t\t\tt=(a%10)*10 + a/10;\n\t\t\t}\n\n\n\t\t\tif(a!=0 && a>9)\n\t\t\t\tprintf(\"%d : %d%d\\n\",a,a%10,a/10);\n\t\t\telse if(a==0)\n\t\t\t{\n\t\t\t\tprintf(\"00 : 00\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"0%d : %d0\\n\",a,a);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\tif(a!=0 && a>9)\n\t\t\t\tprintf(\"%d : %d%d\\n\",a,a%10,a/10);\n\t\t\telse if(a==0)\n\t\t\t{\n\t\t\t\tprintf(\"00 : 00\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"0%d : %d0\\n\",a,a);\n\t\t\t}\n\t\t}\n\t//\tb++;\n\t//\ta=b;\n\t//}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint flag=0,flag1=0,flag2=0,flag_x=0;\n\tchar a[6];\n\tscanf(\"%s\",&a);\n\twhile(1) {\n\t\tif(a[0]=='2'&&a[1]=='3'&&a[3]=='5'&&a[4]=='9') {\n\t\t\tprintf(\"00:00\");\n\t\t\tbreak;\n\t\t}\n\t\tif(flag==1&&flag1!=1) {\n\t\t\ta[4]='0';\n\t\t\ta[3]++;\n\t\t\tflag=0;\n\t\t}\n\t\telse if(flag1!=1){\n\t\t\ta[4]++;\n\t\t}\n\t\telse if(flag1==1) {\n\t\t\ta[1]++;\n\t\t\ta[3]='0';\n\t\t\ta[4]='0';\n\t\t\tflag1=0;\n\t\t}\n\t\telse if(flag2==1) {\n\t\t\ta[0]++;\n\t\t\tflag2=0;\n\t\t\ta[1]='0';\n\t\t\ta[3]='0';\n\t\t\ta[4]='0';\n\t\t}\n\t\tif(a[4]-48==9&&a[3]-48==5) {\n\t\t\tflag1=1;\n\t\t}\n\t\telse if(a[4]-48==9) {\n\t\t\tflag=1;\n\t\t}\n\t\tif(a[1]-48==9) {\n\t\t\tflag2=1;\n\t\t}\n\t\tif(a[0]==a[4]&&a[1]==a[3]) {\n\t\t\tprintf(\"%c%c:%c%c\",a[0],a[1],a[3],a[4]);\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[6];\n int i,j;\n scanf(\"%s\",s);\n int time=1000*(s[0]-'0')+100*(s[1]-'0')+10*(s[3]-'0')+s[4]-'0';\n // printf(\"time : %d\\n\",time);\n int t[200],k=-1;\n for(i=0;i<=2;i++)\n\t for(j=0;j<=3;j++)\n\t t[++k]=1000*i+100*j+10*j+i;\n// for(i=0;i<=k;i++)\n//\t printf(\"%d \",t[i]);\n // printf(\"\\n\");\n int min=100000,ans=0;\n // printf(\"k : %d\\n\",k);\n for(i=0;i<=k;i++)\n\t if(t[i]>time)\n\t {\n\t ans=t[i];\n\t break;\n\t }\n if(time>=2332)\n\t ans=0;\n if(time==0)\n\t ans=110;\n int a[4];\n a[0]=ans%10;\n ans/=10;\n a[1]=ans%10;\n ans/=10;\n a[2]=ans%10;\n ans/=10;\n a[3]=ans%10;\n ans/=10;\n printf(\"%d%d:%d%d\\n\",a[0],a[1],a[1],a[0]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n, mm;\n char z;\n scanf(\"%d %c %d\", &n, &z, &mm);\n if(mm > (((n)%10)*10)+n/10) n=n+1;\n if(n>=0 && n<=4)\n {\n printf(\"0%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=5 && n<=9)\n {\n printf(\"10:01\\n\");\n }\n else if(n>=10 && n<=14)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=15 && n<=19)\n {\n printf(\"20:02\\n\");\n }\n else if(n>=20 && n<=22)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else\n {\n printf(\"00:00\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tchar temp_m1 = (Hora + 1) / 10 +'0' ;\n\tchar temp_m2 = (Hora +1) % 10 + '0' ;\n\t\n\t\n\tint temp_minutos = temp_m1 - '0' + 10*(temp_m2 - '0');\n\t\n\tif ( (HH[1]!= MM[0] || HH[0] != MM[1] ) && Minutos < temp_minutos && temp_minutos < 60 ){\n\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\tprintf(\"%s:%s\", HH,MM);\t\t\n\t} else {\n\t\tHora++;\n\t\tif(Hora >=24){\n\t\t\tprintf(\"00:00\");\n\t\t} else if(Hora < 10 && Hora > 6){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora < 19 && Hora >= 16 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%2d:%2d\",&a,&b);\n d=a;\n c=a%10;\n a=a/10;\n if(b>=(10*c+a))\n d=d+1;\n a=d;\n if(a==23)\n {\n if(b<32)\n printf(\"23:32\\n\");\n else printf(\"00:00\\n\");\n return 0;\n }\n while(1)\n {\n c=d%10;\n d=d/10;\n if((10*c+d)<60)\n {\n printf(\"%02d:%02d\\n\",a,(10*c+d));\n break;\n }\n else\n {\n a++;\n d=a;\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n, mm;\n char z;\n scanf(\"%d %c %d\", &n, &z, &mm);\n if((((n)%10)*10)+n/10>=mm) n=n+1;\n if(n>=0 && n<=4)\n {\n printf(\"0%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=5 && n<=9)\n {\n printf(\"10:01\\n\");\n }\n else if(n>=10 && n<=14)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else if(n>=15 && n<=19)\n {\n printf(\"20:02\\n\");\n }\n else if(n>=20 && n<=22)\n {\n printf(\"%d:%d%d\\n\", n, (n)%10, (n)/10);\n }\n else\n {\n printf(\"00:00\\n\");\n }\n}\n"}, {"source_code": "#include <string.h>\n#include <stdio.h>\nint main()\n{\n char h,h1,m,m1;\n scanf(\"%c%c:%c%c\",&h,&h1,&m,&m1);\n if(h==0 && h1<=9)\n {\n \n if(m<5 && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n if(m>5)\n {\n h=1;\n h1=0;\n m=0;\n m1=1;\n \n }\n else \n {\n m1=0;\n m=h1;\n }\n }\n else if(h==1 && h1>=0 && h1<=9)\n {\n \n if(m<5 && h==m1 && m==h1)\n {\n h1++;\n m++;\n }\n if(m>5)\n {\n h=2;\n h1=0;\n m=0;\n m1=2;\n }\n else \n {\n m=h1;\n m1=1;\n }\n }\n else if(h==2 && h1>=0 && h1<=3)\n {\n if(m<3 && h==m1&& m==h1)\n {\n h1++;\n m++;\n }\n if(h1>=3 && m>=3 && m1>2)\n {\n h=0;\n h1=0;m=0;m1=0;\n }\n else\n {\n m=h1;\n m1=2;\n }\n }\n printf(\"%c%c:%c%c\",h,h1,m,m1);\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint rev(int a){\n return (a%10)*10+a/10;\n}\nint main()\n{\n int i,h,m;\n scanf(\"%d:%d\",&h,&m);\n if(h<=rev(m)){\n if(h==23)printf(\"00:00\");\n else if(h>=0&&h<=5)printf(\"0%d:%d\",h,rev(h));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=15&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h+1,rev(h+1));\n }\n else {\n if(h>=0&&h<=5)printf(\"0%d:%d\",h,rev(h));\n else if (h>=6&&h<=9)printf(\"10:01\");\n else if(h>=16&&h<=19)printf(\"20:02\");\n else printf(\"%d:%d\",h,rev(h));\n }\n\n return 0;\n}\n"}, {"source_code": "main(h,m){scanf(\"%d%*c%d\",&h,&m);while(h^m%10*10+m/10)++m^60?:(m=0,++h^24?:(h=0));printf(\"%d:%d\",h,m);}"}, {"source_code": "#include<stdio.h>\n//int check(int arr[]);\n//int check(int arr[])\n//{\n//\tint i, flag=1;\n//\tfor(i=0;i<4;i++){\n//\t\tif(arr[i]!=arr[3-i])\n//\t\t\tflag=0;\n//\t}\n//\treturn flag;\n//}\nint main()\n{\n\tint arr[4], a[2], flag, m, n;\n\tscanf(\"%d:%d\", &a[0], &a[1]);\n\tarr[1]=(a[0]%10);\n\tarr[0]=(a[0]/10);\n\tarr[3]=(a[1]%10);\n\tarr[2]=(a[1]/10);\n//\tflag=check(arr);\n//\tif(flag==1){\n//\t\tm=a[0];\n//\t\tn=(10*(m%10))+(m/10);\n//\t\tif(m<10 && n>=10)\n//\t\t\tprintf(\"0%d:%d\", m, n);\n//\t\telse if(n<10 && m>=10)\n//\t\t\tprintf(\"%d:0%d\", m, n);\n//\t\telse if(m<10 && n<=10)\n//\t\t\tprintf(\"0%d:0%d\", m, n);\n//\t\telse\n//\t\t\tprintf(\"%d:%d\", m, n);\n//\t}\n\tif(((a[0]<7)||(a[0]>9))&&((a[0]<15)||(a[0]>19))){\n\t\tm=a[0];\n\t\tn=(10*(m%10))+(m/10);\n\t\tif(a[1]<n){\n\t\t\tif(m<10 && n>=10)\n\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\telse if(n<10 && m>=10)\n\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\telse if(m<10 && n<=10)\n\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\telse\n\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t}\n\t\telse{\n\t\t\tif(a[0]==23)\n\t\t\t\tprintf(\"00:00\");\n\t\t\telse{\n\t\t\t\tm=a[0]+1;\n\t\t\t\tn=(10*(m%10))+(m/10);\n\t\t\t\tif(m<10 && n>=10)\n\t\t\t\t\tprintf(\"0%d:%d\", m, n);\n\t\t\t\telse if(n<10 && m>=10)\n\t\t\t\t\tprintf(\"%d:0%d\", m, n);\n\t\t\t\telse if(m<10 && n<=10)\n\t\t\t\t\tprintf(\"0%d:0%d\", m, n);\n\t\t\t\telse\n\t\t\t\t\tprintf(\"%d:%d\", m, n);\n\t\t\t}\n\t\t}\n\t}\n\telse if(a[0]<10)\n\t\tprintf(\"10:01\");\n\telse\n\t\tprintf(\"20:02\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char str[1000],str1[1000];\n int i,j,k,a,b,c,d;\n scanf(\"%s\",str);\n a=str[0]-'0';\n b=str[1]-'0';\n c=str[3]-'0';\n d=str[4]-'0';\n if(a==0 && b<5)\n {\n if(c<b)\n printf(\"0%d:%d0\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==0 && b>=5)\n {\n printf(\"%d%d:%d%d\",a+1,a,a,a+1);\n }\n if(a==1 && b<5)\n {\n if(c<b)\n printf(\"1%d:%d1\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==1 && b>=5)\n {\n printf(\"%d0:0%d\",a+1,a+1);\n }\n if(a==2 && b<3)\n {\n if(c<b)\n printf(\"2%d:%d2\",b,b);\n else\n printf(\"%d%d:%d%d\",a,b+1,b+1,a);\n }\n if(a==2 && b>=3)\n {\n if(c<=b && d<c)\n printf(\"2%d:%d2\",b,b);\n else\n printf(\"00:00\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#define pi 3.1415926535897932\nint main()\n{\n double Area,n,r;\n scanf(\"%lf%lf\",&n,&r);\n\n Area=(n*r*r)/((1/tan(pi/(2*n))) + (1/tan(pi/n)));\n\n printf(\"%.12lf\",Area);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%2d:%2d\",&a,&b);\n d=a;\n c=a%10;\n a=a/10;\n if(b>=(10*c+a))\n d=d+1;\n a=d;\n if(a==24)\n {\n if(b<42)\n printf(\"24:42\\n\");\n else printf(\"00:00\\n\");\n return 0;\n }\n while(1)\n {\n c=d%10;\n d=d/10;\n if((10*c+d)<60)\n {\n printf(\"%02d:%02d\\n\",a,(10*c+d));\n break;\n }\n else\n {\n a++;\n d=a;\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int hora,Min;\n\n scanf(\"%d:%d\",&hora,&Min);\n int Aux;\n float H;\n\n if((hora>0 && hora <=5 && Min<=50 )||(hora>=10 && hora<=15 && Min<=51)||(hora>=20 && hora<=23 && Min<=32)){\n Aux=hora/10;\n H=(((float)hora/10)-Aux)*100+Aux;\n if(Min<H)\n printf(\"%d:%.0f\",hora,H);\n else{\n hora++;\n H=H+10;\n printf(\"%d:%.0f\",hora,H);\n }\n }\n else if (hora>=6 && hora<=9)\n printf(\"10:01\");\n else if (hora>=16 && hora<=19)\n printf(\"20:02\");\n else\n printf(\"00:00\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n char s[10],hh[5],mm[5],var[5],var2[5];\n char i,j,k,l;\n int h,m,flag=0;\n\n scanf(\"%s\",&s);\n\n i=s[0];\n j=s[1];\n k=s[3];\n l=s[4]+1;\n\n for(;i<=50;i++)\n {\n for(;j<=57;j++)\n {\n for(;k<=53;k++)\n {\n for(;l<=57;l++)\n {\n //printf(\"%c%c:%c%c bn\\n \",i,j,k,l);\n if(i==l && j==k)\n {\n if(i==50)\n {\n if(j>51)\n {\n break;\n }\n }\n else\n {\n printf(\"%c%c:%c%c\",i,j,k,l);\n return 0;\n }\n }\n }\n l=48;\n }\n k=48;\n }\n j=48;\n\n }\n\n if(flag==0)\n {\n printf(\"00:00\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int h1,m1;\n char d;\n scanf(\"%i\",&h1);\n scanf(\"%c\",&d);\n scanf(\"%i\",&m1);\n\n//printf(\"%i %i \",h1,m1);\n\n if (m1>=60)\n printf(\"10:01\");\n else if ((h1 == 0 && m1>=0 && m1 <60 )||(h1==1 && m1<10 && m1 <60) )\n printf(\"01:10\");\n if ( (h1==1 && m1>=10 )||(h1==2 && m1<20 ))\n printf(\"02:20\");\n if ( (h1==2 && m1>=20 )||(h1==3 && m1<30 ))\n printf(\"03:30\");\n if ( (h1==3 && m1>=30 )||(h1==4 && m1<40 ))\n printf(\"04:40\");\n if ( (h1==4 && m1>=40 )||(h1==5 && m1<50 ))\n printf(\"05:50\");\n\n\n\n\n if ( (h1==5 && m1>=50 )|| (h1>5 && h1<10 ) )\n printf(\"10:01\");\n if ( h1==10 && m1==0 )\n printf(\"10:01\");\n if ( (h1 == 10 && m1>=01 )||(h1==11 && m1<11))\n printf(\"11:11\");\n\n if ( (h1==11 && m1>=11 )||(h1==12 && m1<21 ))\n printf(\"12:21\");\n if ( (h1==12 && m1>=21 )||(h1==13 && m1<31 ))\n printf(\"13:31\");\n if ( (h1==13 && m1>=31 )||(h1==14 && m1<41 ))\n printf(\"14:41\");\n if ( (h1==14 && m1>=41)||(h1==15 && m1<51 ))\n printf(\"15:51\");\n\n\n\n\n if ( (h1==15 && m1>=51 )||(h1>15 && h1<20 ) )\n printf(\"20:02\");\n if (h1==20 && m1<2)\n printf(\"20:02\");\n if ( (h1 == 20 && m1>=02 )||(h1==21 && m1<12))\n printf(\"21:12\");\n\n if ( (h1==21 && m1>=12 )||(h1==22 && m1<22 ))\n printf(\"22:22\");\n if ( (h1==22&& m1>=22 )||(h1==23 && m1<32 ))\n printf(\"23:32\");\n if ( h1==23 && m1>=32 )\n printf(\"00:00\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a, b;\n\tscanf(\"%d\", &a);\n\tgetchar();\n\tscanf(\"%d\", &b);\n\tif (a == b % 10 * 10 + b / 10)\n\t{\n\t\tif (a<5)\n\t\t\tprintf(\"%d:%d\\n\", a + 1, b + 10);\n\t\telse if (a == 5)\n\t\t\tprintf(\"10:01\\n\");\n\t\telse if (a>9 && a<15)\n\t\t\tprintf(\"%d:%d\\n\", a + 1, b + 10);\n\t\telse if (a == 15)\n\t\t\tprintf(\"20:02\\n\");\n\t\telse if (a>19 && a < 23)\n\t\t\tprintf(\"%d\uff1a%d\\n\", a + 1, b + 10);\n\t\telse if (a == 23)\n\t\t\tprintf(\"00:00\\n\");\n\t}\n\telse\n\t{\n\t\tif (a % 10 * 10 + a / 10>b)\n\t\t{\n\t\t\tif (a <= 5)\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t\telse if (a <= 10)\n\t\t\t\tprintf(\"10:01\\n\");\n\t\t\telse if (a <= 15)\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t\telse if (a <= 20)\n\t\t\t\tprintf(\"20:02\\n\");\n\t\t\telse if (a <= 23)\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (a < 5)\n\t\t\t{\n\t\t\t\ta++;\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t\t}\n\t\t\telse if (a < 10)\n\t\t\t\tprintf(\"10:01\\n\");\n\t\t\telse if (a < 15)\n\t\t\t{\n\t\t\t\ta++;\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t\t}\n\t\t\telse if (a < 20)\n\t\t\t\tprintf(\"20:02\\n\");\n\t\t\telse if (a < 23)\n\t\t\t{\n\t\t\t\ta++;\n\t\t\t\tprintf(\"%d:%d\\n\", a, a % 10 * 10 + a / 10);\n\t\t\t}\n\t\t\telse if (a==23)\n\t\t\t\tprintf(\"00:00\\n\");\n\t\t}\n\t}\n}\n\t \t \t \t\t\t \t \t\t\t \t\t \t\t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[6];\n\tscanf(\"%s\",s);\n\tint x=(s[0]-'0')*10+(s[1]-'0'),z,f;\n\tint y=(s[3]-'0')*10+(s[4]-'0');\t\n\t\tz=x/10;\n\t\tf=(x%10)*10+z;\n\t\tif(x==23&&y>=32)\n\t\t{\n\t\t\tprintf(\"00:00\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(f>y&&f<59)\n\t\t{\n\t\t\tprintf(\"%02d:%02dl\",x,f);\n\t\t\treturn 0;\n\t\t}\n\t\telse \n\t\t{\n\t\t\twhile(1)\n\t\t\t{\n\t\t\t\tz=(x+1)/10;\n\t\t\t\tf=((x+1)%10)*10+z;\n\t\t\t\tif(f<59)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%02d:%02d\",x+1,f);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tx++;\n\t\t\t}\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n// int x[16] = {01,02,03,04,05,10,11,12,13,14,15,20,21,22,23,00};\n int x[24] = {01,02,03,04,05,06,07,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,00};\n int ctrx[24] = {1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1};\n int y[24] = {10,20,30,40,50,00,70,80,90,01,11,21,31,41,51,61,71,81,91,02,12,22,32,00};\n int ctry[24] = {1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1};\n int x_ex[8] = {6,7,8,9,16,17,18,19};\n\n int i,j=0,k,ss[2];\n char t[6];\n char numx[3];\n char numy[3];\n\n char *ptrToken;\n\n scanf(\"%s\",t);\n\n ptrToken = strtok( t, \":\" );\n\n while ( ptrToken != NULL )\n {\n ss[j]=atoi(ptrToken);\n ptrToken = strtok( NULL, \":\" );\n j++;\n }\n\n\n for(i=0; i<24; i++)\n {\n if(ss[0] == x[i])\n {\n if(ctrx[i] == 0)\n {\n k=i;\n while (ctrx[k] == 0)\n {\n if(ctrx[k] == 0)\n {\n k++;\n }\n }\n if(ss[1] < y[k])\n {\n itoa(x[k],numx,10);\n itoa(y[k],numy,10);\n if(x[k]<10 && x[k] == 0)\n {\n printf(\"0%s:0%s\",numx,numy);\n }\n else if(y[k]<10)\n {\n printf(\"%s:0%s\",numx,numy);\n }\n else if(x[k]<10)\n {\n printf(\"0%s:%s\",numx,numy);\n }\n else{\n printf(\"%s:%s\",numx,numy);\n }\n }\n else {\n itoa(x[k],numx,10);\n itoa(y[k],numy,10);\n if(x[k]<10 && x[k] == 0)\n {\n printf(\"0%s:0%s\",numx,numy);\n }\n else if(y[k]<10)\n {\n printf(\"%s:0%s\",numx,numy);\n }\n else if(x[k]<10)\n {\n printf(\"0%s:%s\",numx,numy);\n }\n else{\n printf(\"%s:%s\",numx,numy);\n }\n }\n }else{\n if(ss[1] < y[i])\n {\n itoa(x[i],numx,10);\n itoa(y[i],numy,10);\n if(x[i+1]<10 && x[i+1] == 0)\n {\n printf(\"0%s:0%s\",numx,numy);\n }\n else if(y[i+1]<10)\n {\n printf(\"%s:0%s\",numx,numy);\n }\n else if(x[i+1]<10)\n {\n printf(\"0%s:%s\",numx,numy);\n }\n else{\n printf(\"%s:%s\",numx,numy);\n }\n }\n else{\n itoa(x[i+1],numx,10);\n itoa(y[i+1],numy,10);\n if(x[i+1]<10 && x[i+1] == 0)\n {\n printf(\"0%s:0%s\",numx,numy);\n }\n else if(y[i+1]<10)\n {\n printf(\"%s:0%s\",numx,numy);\n }\n else if(x[i+1]<10)\n {\n printf(\"0%s:%s\",numx,numy);\n }\n else{\n printf(\"%s:%s\",numx,numy);\n }\n }\n }\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void){\n int M=0,H=0;\n char pala[5];\n scanf(\"%s\",&pala);\n H=((pala[0]-'0')*10)+pala[1]-'0';\n M=((pala[3]-'0')*10)+pala[4]-'0';\n M++;\n while(1){\n if(M==60){\n M=0;\n H++;\n }\n pala[0]=floor(H/10)+'0';\n pala[1]=H%10+'0';\n pala[3]=floor(M/10)+'0';\n pala[4]=M%10+'0';\n M++;\n if(pala[0]==pala[4] && pala[1]==pala[3]){\n printf(\"%s\",pala);\n return 0;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,t;\n scanf(\"%d:%d\",&a,&b);\n t=a%10*10+a/10;\n if (b>=t)\n {\n a=(a+1)%24;\n t=a%10*10+a/10;\n }\n printf(\"%.2d:%.2d\\n\",a,t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tchar time[5];\n\tscanf(\"%s\",time);\n\tchar HH[3];\n\tchar MM[3];\n\tMM[0] = time[3];\n\tMM[1] = time[4];\n\tMM[2] = '\\0';\n\tHH[0] = time[0];\n\tHH[1] = time[1];\n\tHH[2] = '\\0';\n\t\n\tint Hora = (HH[1] - '0') + 10*(HH[0] - '0' ) ;\n\tint Minutos = (MM[1] - '0') + 10*(MM[0] - '0') ;\n\t\n\tchar temp_m1 = (Hora + 1) / 10 +'0' ;\n\tchar temp_m2 = (Hora +1) % 10 + '0' ;\n\t\n\t\n\tint temp_minutos = temp_m1 - '0' + 10*(temp_m2 - '0');\n\t\n\tif ( (HH[1]!= MM[0] || HH[0] != MM[1] ) && Minutos < temp_minutos && temp_minutos < 60 ){\n\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\tprintf(\"%s:%s\", HH,MM);\t\t\n\t} else {\n\t\tHora++;\n\t\tMinutos = temp_minutos;\n\t\tif(Hora >=24){\n\t\t\tprintf(\"00:00\");\n\t\t} else if(Hora <= 10 && Hora >= 6 && Minutos > 60){\n\t\t\tprintf(\"10:01\");\n\t\t} else if( Hora <= 19 && Hora >= 16 && Minutos > 60 ){\n\t\t\tprintf(\"20:02\");\n\t\t} else {\n\t\t\tMM[0] = HH[1] = Hora % 10 + '0';\n\t\t\tMM[1] = HH[0] = Hora / 10 + '0';\n\t\t\tprintf(\"%s:%s\", HH,MM);\t\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int hora,minuto, hora_d, hora_u;\n scanf(\"%d%*c%d\",&hora,&minuto);\n hora_d = hora/10;\n hora_u = hora%10;\n\n if(hora > 22 && minuto > 31)\n {\n hora = 0;\n minuto = 0;\n\n }\n else\n {\n if(minuto < (hora_d + (hora_u *10) ) )\n {\n minuto = hora_d + (hora_u*10);\n }\n else\n {\n hora = hora +1;\n minuto = hora/10 + (hora%10)*10;\n }\n\n }\n if(hora == 0)\n {\n if(minuto == 0)\n {\n printf(\"%d%d:%d%d\",hora,hora,minuto,minuto);\n }\n else\n {\n printf(\"%d%d:%d\",hora,hora,minuto);\n }\n return NULL;\n\n }\n else\n {\n if(minuto == 0)\n {\n printf(\"%d:%d%d\",hora,minuto,minuto);\n\n return NULL;\n }\n\n }\n printf(\"%d:%d\",hora,minuto);\n\nreturn NULL;\n}\n"}], "src_uid": "158eae916daa3e0162d4eac0426fa87f"} {"nl": {"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_spec": "The first line contains the tramp suit. It is \"S\", \"H\", \"D\" or \"C\". The 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\").", "output_spec": "Print \"YES\" (without the quotes) if the first cards beats the second one. Otherwise, print \"NO\" (also without the quotes).", "sample_inputs": ["H\nQH 9S", "S\n8D 6D", "C\n7H AS"], "sample_outputs": ["YES", "YES", "NO"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint f(char c) {\n if (c <= 0x39) {\n return c - 0x36;\n }\n\n switch (c) {\n case ('T'):\n return 4;\n case ('J'):\n return 5;\n case ('Q'):\n return 6;\n case ('K'):\n return 7;\n case ('A'):\n return 8;\n }\n\n return -1;\n}\n\nint main () {\n char c = 0;\n char s1[3] = {0};\n char s2[3] = {0};\n \n scanf(\"%c %s %s\", &c, s1, s2);\n\n if (s1[1] == s2[1]) {\n if (f(s1[0]) > f(s2[0])) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n } else if (s1[1] == c || s2[1] == c) {\n if (s1[1] == c) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n } else {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn a<b?a:b;\n}\nint main(){\n\tchar a,b,c,d,e;int k=0;\nscanf(\"%c\\n%c%c %c%c\",&a,&b,&c,&d,&e);\n\tif(b=='A')b='Z';\n\tif(b=='T')b='A';\n\tif(b=='K')b='Y';\n\tif(d=='A')d='Z';\n\tif(d=='T')d='A';\n\tif(d=='K')d='Y';\n\tif((a==c)&&(a!=e)) k=1;\n\tif((c==e)&&(b>d))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}\n"}, {"source_code": "#include <ctype.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nchar t, v1, s1, v2, s2;\n\nint v(char v1) {\n\treturn \n\t\tisdigit(v1) ? v1 : '9' + \n\t\t(\n\t\t\tv1 == 'T' ? 1 :\n\t\t\tv1 == 'J' ? 2 :\n\t\t\tv1 == 'Q' ? 3 :\n\t\t\tv1 == 'K' ? 4 :\n\t\t\tv1 == 'A' ? 5 :\n\t\t\t-'9'\n\t\t);\n}\n\nint main(void) {\n\tscanf(\"%c\\n%c%c %c%c\", &t, &v1, &s1, &v2, &s2);\n\tprintf(\"%s\\n\", s1==s2&&v(v1)>v(v2) || s1==t&&s2!=t?\"YES\":\"NO\");\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint d1,d2;\n\tchar s1[100],s2[100],s3[100];\n\t\n\tscanf(\"%s%s%s\",s1,s2,s3);\n\t\n\tif(s2[0]=='T')\n\t\td1=10;\n\telse if(s2[0]=='J')\n\t\td1=11;\n\telse if(s2[0]=='Q')\n\t\td1=12;\n\telse if(s2[0]=='K')\n\t\td1=13;\n\telse if(s2[0]=='A')\n\t\td1=14;\n\telse\n\t\td1=s2[0]-'0';\n\t\n\t\n\tif(s3[0]=='T')\n\t\td2=10;\n\telse if(s3[0]=='J')\n\t\td2=11;\n\telse if(s3[0]=='Q')\n\t\td2=12;\n\telse if(s3[0]=='K')\n\t\td2=13;\n\telse if(s3[0]=='A')\n\t\td2=14;\n\telse\n\t\td2=s3[0]-'0';\n\t\n\t\n\tif(s2[1]==s3[1]&&d1>d2)\n\t\tprintf(\"YES\");\n\t\n\telse if(s2[1]==s1[0]&&s1[0]!=s3[1])\n\t\tprintf(\"YES\");\n\t\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,c1,c2;\n char mal;\n char bal[]={'6','7','8','9','T','J','Q','K','A'};\n char kang[4],bang[4];\n scanf(\"%c\",&mal);\n scanf(\"%s %s\",kang,bang);\n for (i=0;i<9;i++)\n {\n if (bal[i]==kang[0]) c1=i+1;\n if (bal[i]==bang[0]) c2=i+1;\n }\n if (kang[1]==bang[1])\n {\n if(c1>c2) printf(\"YES\");\n else printf(\"NO\");\n }\n else\n {\n if (kang[1]==mal) printf(\"YES\");\n else printf(\"NO\");\n }\n}"}, {"source_code": "#include <stdio.h>\n\nchar a[3][3],v[1111];\n\nint main()\n{\n int i;\n scanf(\"%s%s%s\",a[0],a[1],a[2]);\n for (i=2;i<=9;i++)\n v[i+'0']=i-2;\n v['T']=8;\n v['J']=9;\n v['Q']=10;\n v['K']=11;\n v['A']=12;\n puts((a[1][1]==a[0][0]&&a[2][1]!=a[0][0]||a[1][1]==a[2][1]&&v[a[1][0]]>v[a[2][0]])?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\n\nint main()\n{\n char ch[5];\n scanf(\"%c %c%c %c%c\",&ch[0],&ch[1],&ch[2],&ch[3],&ch[4]);\n if(ch[0]==ch[2])\n {\n if(ch[0]==ch[4])\n {\n goto l1;\n }\n else\n {\n printf(\"%s\",\"YES\");\n }\n }\n else\n {\n if(ch[0]==ch[4]||ch[4]!=ch[2])\n {\n printf(\"%s\",\"NO\");\n }\n else\n {\n l1:\n switch(ch[1])\n {\n case '6': printf(\"%s\",\"NO\"); break;\n case '7': if(ch[3]=='6') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '8': if(ch[3]=='6'||ch[3]=='7') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '9': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'T': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'J': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'Q': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'K': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'A': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q'||ch[3]=='K') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n }\n \n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char card1[3], card2[3], trump[2], *cards = \"6789TJQKA\";\n scanf(\"%s%s%s\", trump, card1, card2);\n if (card1[1] == card2[1])\n {\n if ((strchr(cards, card1[0]) - cards) > (strchr(cards, card2[0]) - cards))\n printf(\"YES\");\n else printf(\"NO\");\n }\n else if (card1[1] == trump[0])\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn a<b?a:b;\n}\nint main(){\n\tchar a,b,c,d,e;int k=0;\nscanf(\"%c\\n%c%c %c%c\",&a,&b,&c,&d,&e);\n\tif(b=='A')b='Z';\n\tif(b=='T')b='A';\n\tif(b=='K')b='Y';\n\tif(d=='A')d='Z';\n\tif(d=='T')d='A';\n\tif(d=='K')d='Y';\n\tif((a==c)&&(a!=e)) k=1;\n\tif((c==e)&&(b>d))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}"}, {"source_code": "#include <stdio.h>\nint main() \n{\n char t[2],c1[3],c2[3];\n int i,a,b;\n \n char su[]={'S','H','D','C','\\0'};\n char r[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n \n scanf(\"%s\",t);\n scanf(\"%s\",c1);\n scanf(\"%s\",c2);\n \n if((c1[1]==t[0])&&(c2[1]!=t[0]))\n {\n printf(\"YES\");\n }\n \n if((c2[1]==t[0])&&(c1[1]!=t[0]))\n {\n printf(\"NO\");\n }\n \n if((c1[1]!=c2[1])&&(c1[1]!=t[0]&&c2[1]!=t[0]))\n {\n printf(\"NO\");\n }\n else if(c1[1]==c2[1])\n {\n for(i=0;i<10;i++)\n {\n if(r[i]==c1[0])\n {\n a=i+1;\n }\n if(r[i]==c2[0])\n {\n b=i+1;\n }\n }\n if(a>b)\n {\n printf(\"YES\");\n }\n else if(a<b)\n {\n printf(\"NO\");\n }\n else if(a==b)\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char card1[3], card2[3], trump[2], *cards = \"6789TJQKA\";\n scanf(\"%s%s%s\", trump, card1, card2);\n if (card1[1] == card2[1])\n {\n if ((strchr(cards, card1[0]) - cards) > (strchr(cards, card2[0]) - cards))\n printf(\"YES\");\n else printf(\"NO\");\n }\n else if (card1[1] == trump[0])\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "/*\n#include <stdio.h>\n#include <stdlib.h>\nint min(int a, int b) {\n\n return (a > b) ? b : a;\n\n}\n\nint main() {\n\n int n, m, a, b;\n\n scanf(\"%d %d %d %d\", &n, &m, &a, &b);\n int price = 0;\n\n int c=a*m;\n int d, e, f, g, h, k, l;\n if(c<b||c==b) printf(\"%d\",a*n);\n else if(c>b){\n if(n%m==0) printf(\"%d\", b*(n/m));\n else if(n%m!=0){\n d=n/m+1;\n e=d*b;\n\n f=n%m;\n g=f*a;\n h=n/m;\n k=h*b;\n l=g+k;\n printf(\"%d\",min(e,l));\n }\n }\n\n return 0;\n}\n*/\n/*\n#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n int sum;\n scanf(\"%d\", &sum);\n\n if (sum >= 0) {\n printf(\"%d\",sum);\n } else {\n int a = -sum/10%10;\n int b = -sum%10;\n printf(\"%d\",a > b ? sum/100*10-b : sum/10);\n }\n\n return 0;\n\n}*/\n/*\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int x1, y1, x2, y2;\n\n scanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n if(abs(x1-x2)==abs(y1-y2))\n printf(\"%d %d %d %d\", x1, y2, x2, y1);\n else if(x1 == x2 || y1 == y2) {\n\n float l = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));\n\n if(x1==x2) {\n printf(\"%d %d %d %d\", x1+(int)l, y1, x1+(int)l, y2);\n } else\n printf(\"%d %d %d %d\", x1, y1+(int)l, x2, y2+(int)l);\n } else\n printf(\"-1\");\n\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int** matrix, int n) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n\n for(int i = 0; i < n -1; i++) {\n\n if((float) matrix[i][1] / matrix[i][0] < (float) matrix[i + 1][1] / matrix[i + 1][0]) {\n\n int aux1 = matrix[i][0];\n int aux2 = matrix[i][1];\n\n matrix[i][0] = matrix[i + 1][0];\n matrix[i][1] = matrix[i + 1][1];\n\n matrix[i + 1][0] = aux1;\n matrix[i + 1][1] = aux2;\n\n done = 0;\n\n }\n }\n }\n}\n\nint main() {\n\n int n, strength;\n\n scanf(\"%d %d\", &strength, &n);\n\n int** matrix = (int**)malloc(sizeof(int*) * n);\n\n for(int i = 0; i < n; i++)\n matrix[i] = (int*)malloc(4 * 2);\n\n for(int i = 0; i < n; i++)\n scanf(\"%d %d\", &matrix[i][0], &matrix[i][1]);\n\n sort(matrix, n);\n\n for(int j = 0; j < n; j++)\n for(int i = 0; i < n; i++) {\n\n if(strength > matrix[i][0] && matrix[i][0] != -1) {\n\n strength += matrix[i][1];\n matrix[i][0] = -1;\n\n }\n }\n\n int finish = 0;\n\n\n for(int i = 0; i < n; i++)\n if(matrix[i][0] != -1)\n finish = 1;\n\n if(!finish)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int cnt = (n + 1) / 2;\n int ans = (cnt + m - 1) / m * m;\n\n if (ans > n) {\n ans = -1;\n }\n printf(\"%d\", ans);\n\nreturn 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint min(int a, int b) {\n\n return (a > b) ? b : a;\n\n}\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n int array[n + 1];\n\n int m1 = 0, m2 = 0, m3 = 0;\n\n for(int i = 1; i <= n; i++) {\n\n scanf(\"%d\", &array[i]);\n\n switch(array[i]) {\n\n case 1:\n m1++;\n break;\n\n case 2:\n m2++;\n break;\n\n case 3:\n m3++;\n break;\n\n }\n }\n int minim = min(m1, m2);\n minim = min(minim, m3);\n\n int aux[4];\n int k = 0;\n\n printf(\"%d\\n\", minim);\n\n for(int i = 0; i < minim; i++) {\n\n k=1;\n\n for(int j = 1; k < 4; j++) {\n\n if(j == n + 1)\n j = 1;\n\n if(array[j] == k) {\n\n aux[k++] = j;\n array[j] = -1;\n\n }\n }\n\n for(int j = 1; j < k; j++)\n printf(\"%d \", aux[j]);\n printf(\"\\n\");\n\n\n }\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int n, int array[n]) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n\n for(int i = 0; i < n - 1; i++) {\n\n if(array[i] > array[i + 1]) {\n\n int aux = array[i];\n array[i] = array[i + 1];\n array[i + 1] = aux;\n done = 0;\n\n }\n }\n }\n}\nint main() {\n\n int n, d;\n scanf(\"%d %d\", &n, &d);\n\n int array[n];\n int sum = 0;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &array[i]);\n sum += array[i];\n\n }\n\n sum += 10 * (n - 1);\n\n if(sum > d)\n printf(\"-1\");\n else {\n\n //sort(n, array);\n\n int ct = 2 * (n - 1);\n while(sum + 5 <= d) {\n\n ct++;\n sum+=5;\n\n }\n printf(\"%d\", ct);\n\n }\n\n\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n int first = 0;\n int last = 1;\n for(int i = 0; i < n; i++) {\n\n if(i % 2 == 1)\n if(first == 1) {\n\n printf(\"#\");\n first = 0;\n\n }\n for(int j = 0; j < m - i % 2; j++) {\n\n if(i % 2 == 0) {\n\n printf(\"#\");\n\n } else\n printf(\".\");\n\n }\n\n if(i % 2 == 1)\n if(last == 1) {\n\n first = 1;\n printf(\"#\");\n last = 0;\n\n }\n\n if(first == 0)\n last = 1;\n printf(\"\\n\");\n }\n\n return 0;\n\n}\n\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n int nr;\n\n int odd = 0;\n int even = 0;\n int pos1 = -1;\n int pos2 = -1;\n\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &nr);\n if(nr % 2 == 0) {\n\n even++;\n pos1 = i + 1;\n\n } else {\n\n odd ++;\n pos2 = i + 1;\n\n }\n }\n\n if(odd == 1)\n printf(\"%d\", pos2);\n else\n printf(\"%d\", pos1);\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int* array, int size) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n for(int i = 0; i < size - 1; i++)\n if(array[i] > array[i + 1]) {\n\n int aux = array[i];\n array[i] = array[i + 1];\n array[i + 1] = aux;\n done = 0;\n\n }\n }\n}\n\nint main() {\n\n\n int n, v;\n scanf(\"%d %d\", &n, &v);\n\n int* array = (int*)malloc(sizeof(int) * 50);\n int k;\n int* deals = (int*)malloc(sizeof(int) * 50);\n int sizeDeals = 0;\n int done;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &k);\n done = 0;\n for(int j = 0; j < k; j++) {\n\n scanf(\"%d\", &array[j]);\n if(array[j] < v)\n done = 1;\n\n }\n\n if(done)\n deals[sizeDeals++] = i + 1;\n done = 0;\n\n }\n\n if(sizeDeals != 0) {\n\n\n sort(deals, sizeDeals);\n printf(\"%d\\n\", sizeDeals);\n for(int i = 0; i < sizeDeals; i++)\n printf(\"%d \", deals[i]);\n\n } else\n printf(\"0\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n\n scanf(\"%d\", &n);\n\n char* string = malloc(101);\n char* string1 = malloc(10000);\n char* string2 = malloc(10000);\n\n for(int i = 0; i <= n; i++) {\n\n gets(string);\n strcat(string1, string);\n\n }\n\n strcpy(string2, string1);\n strrev(string2);\n\n if(strncmp(string1 + 1, string2, strlen(string2) - 2) == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n, k;\n\n scanf(\"%d %d\", &n, &k);\n int maximum = (-1) * (1 << 31);\n\n for(int i = 0; i < n; i++) {\n\n int fi, ti;\n\n scanf(\"%d %d\", &fi, &ti);\n\n if(k >= ti) {\n\n if(fi > maximum)\n maximum = fi;\n\n\n } else {\n\n if((fi - (ti - k)) > maximum)\n maximum = fi - (ti - k);\n\n }\n\n }\n\n printf(\"%d\", maximum);\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n for(int i = 0; i < n; i++) {\n\n int price, quality;\n scanf(\"%d %d\", &price, &quality);\n\n if(price != quality) {\n\n printf(\"Happy Alex\");\n return 0;\n }\n }\n\n printf(\"Poor Alex\");\n\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int friends, bottles, milliliters, limes, slices, salt, nl, np;\n scanf(\"%d %d %d %d %d %d %d %d\", &friends, &bottles, &milliliters, &limes, &slices, &salt, &nl, &np);\n\n int allMilliliters = bottles * milliliters / nl / friends;\n int allSalt = salt / np / friends;\n int allLimes = limes * slices / friends;\n\n int minim = -1;\n\n minim = (allLimes < allMilliliters) ? allLimes : allMilliliters;\n minim = (minim < allSalt) ? minim : allSalt;\n\n printf(\"%d\", minim);\n return 0;\n\n}\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int dice1, dice2;\n scanf(\"%d %d\", &dice1, &dice2);\n\n int dice1Wins = 0;\n int draw = 0;\n int dice2Wins = 0;\n\n for(int i = 1; i <= 6; i++) {\n\n if(abs(dice1 - i) > abs(dice2 - i))\n dice2Wins++;\n else if(abs(dice1 - i) < abs(dice2 - i))\n dice1Wins++;\n else\n draw++;\n\n }\n\n printf(\"%d %d %d\", dice1Wins, draw, dice2Wins);\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n int* array = (int*)malloc(n * 4);\n int minimum = (1 << 28);\n int pos;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &array[i]);\n\n if(i > 1) {\n\n if(array[i] - array[i - 2] < minimum) {\n\n minimum = array[i] - array[i - 2];\n pos = i - 1;\n\n }\n }\n }\n\n minimum = -999999;\n for(int i = 0 ; i < n - 1; i++) {\n\n if(i + 1 == pos) {\n if(array[i + 2] - array[i] > minimum) {\n\n minimum = array[i + 2] - array[i];\n i++;\n\n }\n } else {\n\n if(array[i + 1] - array[i] > minimum) {\n\n minimum = array[i + 1] - array[i];\n\n\n }\n\n }\n }\n\n printf(\"%d\", minimum);\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n\n int n;\n scanf(\"%d\", &n);\n int* exercises = (int*)malloc(sizeof(int) * (n + 1));\n\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &exercises[i]);\n\n switch(i % 3){\n\n case 0:\n chest += exercises[i];\n break;\n\n case 1:\n biceps += exercises[i];\n break;\n\n case 2:\n back += exercises[i];\n break;\n\n\n }\n }\n\n if(chest > back && chest > biceps)\n printf(\"chest\");\n else if(back > chest && back > biceps)\n printf(\"back\");\n else\n printf(\"biceps\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\nint cmmdc(int a, int b) {\n\n int r;\n\n while(b != 0) {\n\n r = a % b;\n a = b;\n b = r;\n\n }\n\n return a;\n}\n\nint main() {\n\n long int l, r;\n\n scanf(\"%ld %ld\", &l, &r);\n printf(\"%d\", sizeof(long int));\n if(r - (l += l%2) < 2)\n printf(\"-1\");\n else\n printf(\"%d %d %d\", l, l + 1, l + 2);\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n char matrix[n][n];\n\n for(int i = 0; i < n; i++)\n for(int j = 0; j < n; j++)\n scanf(\"%c\", &matrix[i][j]);\n\n char diagonal = matrix[0][0];\n\n for(int i = 0; i < n; i++)\n if(matrix[i][i] != diagonal) {\n\n printf(\"NO\");\n return 0;\n\n }\n printf(\"aaa\");\n for(int i = n; i >= 0; i--)\n if(matrix[i][n - i] != diagonal) {\n\n printf(\"NO\");\n return 0;\n\n }\n printf(\"aaa\");\n\n char notDiag = matrix[0][1];\n\n for(int i = 0; i < n; i++)\n for(int j = 0; j < n; j++) {\n\n if(i == j || i + j == n -1)\n j++;\n else {\n\n if(matrix[i][j] != notDiag) {\n\n printf(\"NO\");\n return 0;\n\n }\n }\n }\n\n printf(\"YES\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n char** matrix = (char**)malloc(sizeof(char*) * n);\n for(int i = 0; i < n; i++)\n matrix[i] = malloc(m);\n\n getchar();\n\n for(int i = 0; i < n; i++) {\n\n gets(matrix[i]);\n for(int j = 0; j < m; j++)\n if(matrix[i][j] == '.') {\n if((i + j) % 2 == 0)\n matrix[i][j] = 'B';\n else\n matrix[i][j] = 'W';\n\n }\n\n }\n\n for(int i = 0; i < n; i++) {\n for(int j = 0; j < m; j++)\n printf(\"%c\", matrix[i][j]);\n printf(\"\\n\");\n\n\n }\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint freq1[27], freq2[27];\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n getchar();\n char* question = malloc(15);\n\n int left = INT_MIN / 2;\n int right = INT_MAX / 2;\n\n for(int i = 0; i < n && left <= right; i++) {\n\n gets(question);\n\n if(question[0] == '>' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '<' && question[strlen(question) - 1] == 'N')) { /// > or >=\n\n if(question[1] == '=') {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n left = atoi(tok) + 1;\n\n } else {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n left = atoi(tok);\n\n }\n } else if(question[0] == '<' && question[strlen(question) - 1] == 'Y' || (question[0] == '>' && question[strlen(question) - 1] == 'N')) {\n\n if(question[1] == '=') { /// <=\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n right = atoi(tok);\n\n } else {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n right = atoi(tok) - 1;\n\n }\n }\n\n\n if(question[0] == '>' && question[1] == '=' && question[strlen(question) -1 ] == 'Y' ||\n (question[0] == '<' && question[1] != '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) > left)\n left = atoi(tok);\n\n\n } else if(question[0] == '>' && question[1] != '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '<' && question[1] == '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) + 1 > left)\n left = atoi(tok) + 1;\n\n } else if(question[0] == '<' && question[1] == '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '>' && question[1] != '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) < right)\n right = atoi(tok);\n\n } else if(question[0] == '<' && question[1] != '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '>' && question[1] == '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) - 1 < right)\n right = atoi(tok) - 1;\n\n }\n }\n\n if(left <= right) {\n\n printf(\"%d\", right);\n\n } else\n printf(\"Impossible\");\n return 0;\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nvoid mergeSort(int left, int mid, int right, int* array, int n) {\n\n int*aux = (int*)malloc(sizeof(int) * n);\n\n int i = left;\n int j = mid + 1;\n int index = i;\n\n while(i <= mid && j <= right) {\n\n if(array[i] > array[j]) {\n\n aux[index++] = array[i++];\n\n } else {\n\n aux[index++] = array[j++];\n\n }\n\n }\n\n for(int l = i; l <= mid; l++)\n aux[index++] = array[l];\n\n for(int l = j; l <= right; l++)\n aux[index++] = array[l];\n\n for(int l = left; l <= right; l++)\n array[l] = aux[l];\n\n}\n\nvoid merge(int left, int right, int* array, int n) {\n\n int mid;\n\n if(left < right) {\n\n mid = (left + right) / 2;\n merge(left, mid, array, n);\n merge(mid + 1, right, array, n);\n mergeSort(left, mid, right, array, n);\n\n }\n}\n\nint main() {\n\n int devices, sockets, supply;\n\n scanf(\"%d %d %d\", &supply, &devices, &sockets);\n int array[supply];\n\n for(int i = 0; i < supply; i++)\n scanf(\"%d\", &array[i]);\n\n merge(0, supply - 1, array, supply);\n\n if(devices <= sockets)\n printf(\"0\");\n else {\n\n int i = 0;\n while(sockets < devices && i < supply) {\n\n sockets += array[i] - 1;\n i++;\n\n }\n\n if(i != supply)\n printf(\"%d\", i);\n else if(sockets >= devices)\n printf(\"%d\", i);\n else\n printf(\"-1\");\n }\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint main() {\n\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int s = 0;\n if(y>x && x>=-y) {\n\n printf(\"a\");\n s=-2+y*4;\n\n }\n\n if(y<x && x<=-y+1) {\n\n printf(\"b\");\n s=-y*4;\n\n }\n\n if(y<=x && x>-y+1) {\n\n printf(\"c\");\n s=-3+x*4;\n\n }\n\n if(y>=x && x<-y) {\n\n printf(\"d\");\n s=-1-4*x;\n\n }\n\n printf(\"%d\", s);\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint max(int a, int b) {\n\n return (a > b) ? a : b;\n\n}\n\nint main() {\n\n int a, b, c, d;\n\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\n printf(\"%d %d %d\", 2-(a==c||b==d), ((a+b)%2==(c+d)%2)*(2-(a-b==c-d||a+b==c+d)), max(abs(c-a),abs(d-b)));\n return 0;\n\n} */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint main() {\n\n char suit;\n scanf(\"%c\", &suit);\n getchar();\n\n char* array = malloc(10);\n gets(array);\n char vect[] = \"6789TJQKA\";\n if(array[1] == suit && array[strlen(array) - 1] != suit ||\n (array[1] == array[strlen(array) - 1] && strchr(vect, array[0]) > strchr(vect, array[strlen(array) - 2])))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nstruct card{\n char suit;\n char rank;\n};\n\nint win(struct card c1,struct card c2,char trump);\nint num(char c);\n\nint main(void){\n struct card c[2];\n char trump;\n scanf(\"%c%*c\",&trump);\n scanf(\"%c%c %c%c%*c\",&c[0].rank,&c[0].suit,&c[1].rank,&c[1].suit);\n if(win(c[0],c[1],trump)) puts(\"YES\");\n else puts(\"NO\");\n return 0;\n}\n\nint win(struct card c1,struct card c2,char trump){\n if(c1.suit==trump && c2.suit!=trump) return 1;\n if(c2.suit==trump && c1.suit!=trump) return 0;\n if(c1.suit!=c2.suit) return 0;\n if(num(c1.rank)<num(c2.rank)) return 0;\n else return 1;\n}\n\nint num(char c){\n switch(c){\n case 'T':\n return 10;\n break;\n case 'J':\n return 11;\n break;\n case 'Q':\n return 12;\n break;\n case 'K':\n return 13;\n break;\n case 'A':\n return 14;\n break;\n default:\n return c-'0';\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n\ntypedef struct {\n int rank;\n char suit;\n int trump; /* o naipe dessa carte e' o trump? */\n} Carta;\n\nint rank(char r) {\n switch(r) {\n case 'T':\n return 10;\n case 'J':\n return 11;\n case 'Q':\n return 12;\n case 'K':\n return 13;\n case 'A':\n return 14;\n default:\n return (r - '0');\n }\n}\n\nCarta le_carta(char trump) {\n Carta c;\n char r;\n scanf(\"%c %c\", &r, &c.suit);\n c.rank = rank(r);\n c.trump = (c.suit == trump) ? 1 : 0;\n return c;\n}\n\nint main() {\n char trump;\n Carta c1, c2;\n \n scanf(\"%c\\n\", &trump);\n c1 = le_carta(trump);\n getchar();\n c2 = le_carta(trump);\n \n if ((c1.trump > c2.trump)\n || ((c1.suit == c2.suit) && (c1.rank > c2.rank)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint arr[1000];\n\tarr['T']=10;\n\tarr['J']=11;\n\tarr['Q']=12;\n\tarr['K']=13;\n\tarr['A']=14;\n\tarr['6']=6;\n\tarr['7']=7;\n\tarr['8']=8;\n\tarr['9']=9;\t\n\tchar s[2];\n\tscanf(\"%s\",s);\n\tchar a[10],b[10];\n\tscanf(\"%s%s\",a,b);\n\tint ans=0;\n\tif(a[1]==b[1])\n\t{\n\t\tif(arr[a[0]]>arr[b[0]])\n\t\t\tans=1;\n\t}\n\telse\n\t{\n\t\tif(a[1]==s[0])\n\t\t\tans=1;\n\t\n\t}\n\tif(ans==1)\n\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint tranfCartaParaOrdemDeCarta(char c) {\n\tswitch (c) {\n\t\tcase 'T': return 10;\n\t\tcase 'J': return 12;\n\t\tcase 'Q': return 13;\n\t\tcase 'K': return 14;\n\t\tcase 'A': return 15;\n\t\tdefault:\n\t\t\treturn (c-'0');\n\t}\n}\n\nvoid cardGame() {\n\tchar c, s[2][3];\n\n\tscanf(\"%c\", &c);\n\tscanf(\"%s %s\", s[0], s[1]);\n\t\n\tif (s[0][1] == s[1][1]) {\n\t\tif (tranfCartaParaOrdemDeCarta(s[0][0]) > tranfCartaParaOrdemDeCarta(s[1][0]))\n\t\t\tprintf(\"YES\\n\");\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if (s[0][1] == c)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\nint main() {\n\t\n\tcardGame();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char trump,s[3],s1[3];\n int t1,t2;\n scanf(\"%c%s%s\",&trump,s,s1);\n if(s[0]=='T')\n t1=11;\n else if(s[0]=='J')\n t1=12;\n else if(s[0]=='Q')\n t1=13;\n else if(s[0]=='K')\n t1=14;\n else if(s[0]=='A')\n t1=15;\n else if(s[0]=='6')\n t1=6;\n else if(s[0]=='7')\n t1=7;\n else if(s[0]=='8')\n t1=8;\n else if(s[0]=='9')\n t1=9;\n if(s1[0]=='T')\n t2=11;\n else if(s1[0]=='J')\n t2=12;\n else if(s1[0]=='Q')\n t2=13;\n else if(s1[0]=='K')\n t2=14;\n else if(s1[0]=='A')\n t2=15;\n else if(s1[0]=='6')\n t2=6;\n else if(s1[0]=='7')\n t2=7;\n else if(s1[0]=='8')\n t2=8;\n else if(s1[0]=='9')\n t2=9;\n\n\n if(s[1]==trump&&s1[1]!=trump)\n {\n printf(\"YES\");\n }\n else if(s[1]!=trump&&s1[1]==trump)\n {\n printf(\"NO\");\n }\n else if(s[1]!=trump&&s1[1]!=trump)\n {\n if(s[1]!=s1[1])\n {\n printf(\"NO\");\n }\n else\n {\n if(t1<=t2)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n\n\n }\n else if(s[1]==trump&&s1[1]==trump)\n {\n if(t1<=t2)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "main(){\n int i=0,j=0,map[225];\n char c,card1[5],card2[5],s[20]=\"6789TJQKASHDC\";\n while(s[i]) map[s[i++]]=j++;\n scanf(\"%c %s %s\",&c,card1,card2);\n if(card1[1]==card2[1]){\n if(map[card1[0]]>map[card2[0]]) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n else if(card1[1]==c) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char *s = \"6789TJQKA1\", c, a, x, b, y;\n scanf(\"%c\\n%c%c %c%c\", &c, &a, &x, &b, &y);\n puts( x == c && y != c || x == y && strchr(s, a) > strchr(s, b) ? \"YES\" : \"NO\" );\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint d1,d2;\n\tchar s1[100],s2[100],s3[100];\n\t\n\tscanf(\"%s%s%s\",s1,s2,s3);\n\t\n\tif(s2[0]=='T')\n\t\td1=10;\n\telse if(s2[0]=='J')\n\t\td1=11;\n\telse if(s2[0]=='Q')\n\t\td1=12;\n\telse if(s2[0]=='K')\n\t\td1=13;\n\telse if(s2[0]=='A')\n\t\td1=14;\n\telse\n\t\td1=s2[0]-'0';\n\t\n\t\n\tif(s3[0]=='T')\n\t\td2=10;\n\telse if(s3[0]=='J')\n\t\td2=11;\n\telse if(s3[0]=='Q')\n\t\td2=12;\n\telse if(s3[0]=='K')\n\t\td2=13;\n\telse if(s3[0]=='A')\n\t\td2=14;\n\telse\n\t\td2=s3[0]-'0';\n\t\n\t\n\tif(s2[1]==s3[1]&&d1>d2)\n\t\tprintf(\"YES\");\n\t\n\telse if(s2[1]==s1[0]&&s1[0]!=s3[1])\n\t\tprintf(\"YES\");\n\t\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(char ch){\n if (ch >= '6' && ch <= '9'){\n return ch - '0';\n }\n if (ch == 'J'){\n return 11;\n }\n if (ch == 'T'){\n return 10;\n }\n if (ch == 'K'){\n return 13;\n }\n if (ch == 'Q'){\n return 12;\n }\n return 14;\n}\n\n\nint main(void)\n{\n int a1, a2;\n char koz, c1, c2, ch;\n scanf(\"%c\\n\", &koz);\n scanf(\"%c%c\", &ch, &c1);\n a1 = num(ch);\n scanf(\"%c\", &ch);\n scanf(\"%c%c\", &ch, &c2);\n a2 = num(ch);\n if ((c1 == c2 && a2 < a1) || (c1 == koz && c2 != koz)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a,b,c,d,e;\n\tint A[300]={0};\n\tA['6']=1;\n\tA['7']=2;\n\tA['8']=3;\n\tA['9']=4;\n\tA['T']=5;\n\tA['J']=6;\n\tA['Q']=7;\n\tA['K']=8;\n\tA['A']=9;\n\t//printf(\"%d\",A['A']);\n\tscanf(\"%c\\n%c%c %c%c\",&a,&b,&c,&d,&e);\n\t//intf(\"%c\\n%c%c %c%c\",a,b,c,d,e);\n\tif(c==a)\n\t{\n\t\tif(e!=a)\n\t\t{\n\t\t\tprintf(\"YES\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(A[b]>A[d])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"NO\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(e==c)\n\t\t{\n\t\t\tif(A[b]>A[d])\n\t\t\t{\n\t\t\t\tprintf(\"YES\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n/* Written by Nishant Mittal aka nishantwrp */\nint check(char a,char b) {\nchar data[9] = {'6','7','8','9','T','J','Q','K','A'};\nint aval,bval;\nint i=0;\nwhile(i<9) {\nif (a == data[i]) {\n aval = i;\n break;\n}\ni++;\n}\nint j=0;\nwhile(j<9) {\nif (b == data[j]) {\n bval = j;\n break;\n}\nj++;\n}\nif (aval>bval) {\n return 1;\n} else {\nreturn 0;\n}\nreturn 0;\n}\nint main()\n{\n char trump;\n scanf(\"%c\\n\",&trump);\n char crd1[2];\n char crd2[2];\n scanf(\"%c%c %c%c\",&crd1[0],&crd1[1],&crd2[0],&crd2[1]);\n if (crd1[1] == trump && crd2[1] == trump) {\n if (check(crd1[0],crd2[0]) == 1) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n } else if (crd1[1] == trump) {\n printf(\"YES\");\n } else {\n if (crd1[1] == crd2[1]) {\n if (check(crd1[0],crd2[0]) == 1) {\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n } else {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n char a[1],b[3],c[3];\nint j(char d)\n {\n if(d=='T') return 10;\n else if(d=='J') return 11;\n else if(d=='Q') return 12;\n else if(d=='K') return 13;\n else if(d=='A') return 14;\n else return d-'0';\n }\nint main()\n{\n scanf(\"%s%s%s\",c,a,b);\n if(a[1]==b[1])\n {\n if(j(a[0])>j(b[0]))\n printf(\"YES\");\n else printf(\"NO\");\n }\n else if (c[0]==a[1])\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n\n\n\n return 0;\n}\n\n\t\t\t\t\t\t \t \t\t\t\t \t \t \t \t \t\t\t"}, {"source_code": "#include<stdio.h>\nint get(char *s,char c)\n{\n int sum=0;\n if(s[1]==c)\n {\n sum+=10000;\n }\n if(s[0]=='6') sum+=6;\n else if(s[0]=='7') sum+=7;\n else if(s[0]=='8') sum+=8;\n else if(s[0]=='9') sum+=9;\n else if(s[0]=='T') sum+=10;\n else if(s[0]=='J') sum+=11;\n else if(s[0]=='Q') sum+=12;\n else if(s[0]=='K') sum+=13;\n else if(s[0]=='A') sum+=14; \n return sum;\n}\nint main(void)\n{\n char com[2];\n char s1[2],s2[2];\n scanf(\"%s\",com);\n scanf(\"%s %s\",s1,s2);\n if(s1[1]!=s2[1]&&s1[1]!=com[0])\n {\n printf(\"NO\\n\");\n }\n else if(get(s1,com[0])>get(s2,com[0]))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c,d;\n char str1[3],str2[3],ch;\n scanf(\"%c\",&ch);\n scanf(\"%s%s\",str1,str2);\n if(str1[0]=='T'){\n a=10;\n }\n else if(str1[0]=='J'){\n a=11;\n }\n else if(str1[0]=='Q'){\n a=12;\n }\n else if(str1[0]=='K'){\n a=13;\n }\n else if(str1[0]=='A'){\n a=14;\n }\n else if(str1[0]=='6'){\n a=6;\n }\n else if(str1[0]=='7'){\n a=7;\n }\n else if(str1[0]=='8'){\n a=8;\n }\n else if(str1[0]=='9'){\n a=9;\n }\n else if(str1[0]=='S'){\n a=15;\n }\n else if(str1[0]=='H'){\n a=16;\n }\n else if(str1[0]=='D'){\n a=17;\n }\n else if(str1[0]=='C'){\n a=18;\n }\n\n if(str1[1]=='T'){\n b=10;\n }\n else if(str1[1]=='J'){\n b=11;\n }\n else if(str1[1]=='Q'){\n b=12;\n }\n else if(str1[1]=='K'){\n b=13;\n }\n else if(str1[1]=='A'){\n b=14;\n }\n else if(str1[1]=='6'){\n b=6;\n }\n else if(str1[1]=='7'){\n b=7;\n }\n else if(str1[1]=='8'){\n b=8;\n }\n else if(str1[1]=='9'){\n b=9;\n }\n else if(str1[1]=='S'){\n b=15;\n }\n else if(str1[1]=='H'){\n b=16;\n }\n else if(str1[1]=='D'){\n b=17;\n }\n else if(str1[1]=='C'){\n b=18;\n }\n\n if(str2[0]=='T'){\n c=10;\n }\n else if(str2[0]=='J'){\n c=11;\n }\n else if(str2[0]=='Q'){\n c=12;\n }\n else if(str2[0]=='K'){\n c=13;\n }\n else if(str2[0]=='A'){\n c=14;\n }\n else if(str2[0]=='6'){\n c=6;\n }\n else if(str2[0]=='7'){\n c=7;\n }\n else if(str2[0]=='8'){\n c=8;\n }\n else if(str2[0]=='9'){\n c=9;\n }\n else if(str2[0]=='S'){\n c=15;\n }\n else if(str2[0]=='H'){\n c=16;\n }\n else if(str2[0]=='D'){\n c=17;\n }\n else if(str2[0]=='C'){\n c=18;\n }\n\n if(str2[1]=='T'){\n d=10;\n }\n else if(str2[1]=='J'){\n d=11;\n }\n else if(str2[1]=='Q'){\n d=12;\n }\n else if(str2[1]=='K'){\n d=13;\n }\n else if(str2[1]=='A'){\n d=14;\n }\n else if(str2[1]=='6'){\n d=6;\n }\n else if(str2[1]=='7'){\n d=7;\n }\n else if(str2[1]=='8'){\n d=8;\n }\n else if(str2[1]=='9'){\n d=9;\n }\n else if(str2[1]=='S'){\n d=15;\n }\n else if(str2[1]=='H'){\n d=16;\n }\n else if(str2[1]=='D'){\n d=17;\n }\n else if(str2[1]=='C'){\n d=18;\n }\n if(str1[0]==ch&&str2[0]==ch){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[1]==ch&&str2[1]==ch){\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[0]==ch||str1[1]==ch){\n printf(\"YES\\n\");\n return 0;\n }\n else if(str2[0]==ch||str2[1]==ch){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&b<d){\n printf(\"NO\\n\");\n return 0;\n }\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n if(a==c){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "//In the name of God\n\n#include <stdio.h>\n#include <ctype.h>\nint main()\n{\n\tchar t,f[2],s[2];\n\tscanf(\"%c\\n\",&t);\n\tscanf(\"%c%c %c%c\",&f[0],&f[1],&s[0],&s[1]);\n\tif(f[1]==t && s[1]!=t)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse if(f[1]==s[1])\n\t{\n\t\tint lf,ls;\n\t\tif(isdigit(f[0]))\n\t\t{\n\t\t\tlf=f[0]-'0';\n\t\t}\n\t\telse if(f[0]=='T')\n\t\t\tlf=10;\n\t\telse if(f[0]=='J')\n\t\t\tlf=11;\n\t\telse if(f[0]=='Q')\n\t\t\tlf=12;\n\t\telse if(f[0]=='K')\n\t\t\tlf=13;\n\t\telse if(f[0]=='A')\n\t\t\tlf=14;\n\t\tif(isdigit(s[0]))\n\t\t{\n\t\t\tls=s[0]-'0';\n\t\t}\n\t\telse if(s[0]=='T')\n\t\t\tls=10;\n\t\telse if(s[0]=='J')\n\t\t\tls=11;\n\t\telse if(s[0]=='Q')\n\t\t\tls=12;\n\t\telse if(s[0]=='K')\n\t\t\tls=13;\n\t\telse if(s[0]=='A')\n\t\t\tls=14;\n\t\tif(lf>ls)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{char t,p[5],q[3];\nscanf(\"%s\",&t);\n\nscanf(\"%s%s\",p,q);\nswitch(p[0])\n{case 'T':p[0]='A';break;\n case 'J':p[0]='B';break;\n case 'Q':p[0]='C';break;\n case 'K':p[0]='D';break;\n case 'A':p[0]='E';break;\n } \n switch(q[0])\n{case 'T':q[0]='A';break;\n case 'J':q[0]='B';break;\n case 'Q':q[0]='C';break;\n case 'K':q[0]='D';break;\n case 'A':q[0]='E';break;\n } \nif(p[1]==q[1])\n{if(p[0]>q[0])\n{printf(\"YES\");\nreturn 0;}}\nelse\nif(p[1]==t)\n{printf(\"YES\");return 0;}\nprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n char a[1],b[3],c[3];\nint j(char d)\n {\n if(d=='T') return 10;\n else if(d=='J') return 11;\n else if(d=='Q') return 12;\n else if(d=='K') return 13;\n else if(d=='A') return 14;\n else return d-'0';\n }\nint main()\n{\n scanf(\"%s%s%s\",c,a,b);\n if(a[1]==b[1])\n {\n if(j(a[0])>j(b[0]))\n printf(\"YES\");\n else printf(\"NO\");\n }\n else if (c[0]==a[1])\n {\n printf(\"YES\");\n }\n else printf(\"NO\");\n\n\n\n return 0;\n}\n\n\t\t\t\t\t\t \t \t\t\t\t \t \t \t \t \t\t\t"}, {"source_code": "#include<stdio.h>\n\nchar trump,ch1[2],ch2[2];\n\nint main(void)\n{\n\tint i,a,b,x;\n\tchar ch[10]={'6','7','8','9','T','J','Q','K','A'};\n\tscanf(\"%c\",&trump);\n\tx=trump;\n\tscanf(\"%s %s\",ch1,ch2);\n\tfor(i=0;i<10;i++) {\n\t\tif(ch1[0]==ch[i])\n\t\t\ta=i;\n\t\telse if(ch2[0]==ch[i])\n\t\t\tb=i;\n\t}\n\t\n\tif(ch1[1]==ch2[1]) {\n\t\tif(a>b)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\telse {\n\t\tif(ch1[1]==x && ch2[1]!=x)\n\t\t\tprintf(\"YES\");\n\t\telse\n\t\t\tprintf(\"NO\");\n\t}\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,c1,c2;\n char mal;\n char bal[]={'6','7','8','9','T','J','Q','K','A'};\n char kang[4],bang[4];\n scanf(\"%c\",&mal);\n scanf(\"%s %s\",kang,bang);\n for (i=0;i<9;i++)\n {\n if (bal[i]==kang[0]) c1=i+1;\n if (bal[i]==bang[0]) c2=i+1;\n }\n if (kang[1]==bang[1])\n {\n if(c1>c2) printf(\"YES\");\n else printf(\"NO\");\n }\n else\n {\n if (kang[1]==mal) printf(\"YES\");\n else printf(\"NO\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint number(char a){\n if(a>='6' && a<='9'){\n return a-'6';\n }else if(a=='T'){\n return 4;\n }else if(a=='J'){\n return 5;\n }else if(a=='Q'){\n return 6;\n }else if(a=='K'){\n return 7;\n }else if(a=='A'){\n return 8;\n }else{\n return -1;\n }\n}\nint main() {\n char suit[2];\n char card1[3];\n char card2[3];\n scanf(\"%s\",suit);\n scanf(\"%s%s\",card1,card2);\n int is_beat=0;\n if(card1[1]==suit[0] && card2[1]!=suit[0]){\n is_beat=1;\n }else if(card1[1]==card2[1]){\n if(number(card1[0])>number(card2[0])){\n is_beat=1;\n }\n }\n if(is_beat) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,w,g,h;\n char c[2];\n char str[100];\n char ch[11]={'6','7','8','9','T','J','Q','K','A'};\n scanf(\"%s\\n\",c);\n\n gets(str);\n\n //printf(\"%c\",ch[0]);\n if (str[1]==c[0] && str[4]==c[0]){\nfor (i=0;i<9;i++){\n if(ch[i]==str[0]){\n g=i+1;\n \n break;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[3]){\n h=i+1;\n break;\n }\n }\n if(g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else if(str[1]==c[0]){\n printf(\"YES\");\n }\n else if (str[4]==c[0]){\n printf(\"NO\");\n }\n else{\n for (i=0;i<9;i++){\n if(ch[i]==str[0]){\n g=i+1;\n \n break;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[3]){\n h=i+1;\n break;\n }\n }\n\n if (str[1]==str[4]){\n if (g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nstruct card{\n char suit;\n char rank;\n};\n\nint win(struct card c1,struct card c2,char trump);\nint num(char c);\n\nint main(void){\n struct card c[2];\n char trump;\n scanf(\"%c%*c\",&trump);\n scanf(\"%c%c %c%c%*c\",&c[0].rank,&c[0].suit,&c[1].rank,&c[1].suit);\n if(win(c[0],c[1],trump)) puts(\"YES\");\n else puts(\"NO\");\n return 0;\n}\n\nint win(struct card c1,struct card c2,char trump){\n if(c1.suit==trump && c2.suit!=trump) return 1;\n if(c2.suit==trump && c1.suit!=trump) return 0;\n if(c1.suit!=c2.suit) return 0;\n if(num(c1.rank)<num(c2.rank)) return 0;\n else return 1;\n}\n\nint num(char c){\n switch(c){\n case 'T':\n return 10;\n break;\n case 'J':\n return 11;\n break;\n case 'Q':\n return 12;\n break;\n case 'K':\n return 13;\n break;\n case 'A':\n return 14;\n break;\n default:\n return c-'0';\n }\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint value_converter(char temp) {\n if(temp=='6') {\n return 6;\n } else if(temp=='7') {\n return 7;\n } else if(temp=='8') {\n return 8;\n } else if(temp=='9') {\n return 9;\n } else if(temp=='T') {\n return 10;\n } else if(temp=='J') {\n return 11;\n } else if(temp=='Q') {\n return 12;\n } else if(temp=='K') {\n return 13;\n } else if(temp=='A') {\n return 14;\n }\n else if(temp=='S') {\n return 15;\n }\n else if(temp=='H') {\n return 16;\n }\n else if(temp=='D') {\n return 17;\n }\n else if(temp=='C') {\n return 18;\n }\n\n\n}\n\n\nint main() {\n\n char trump, p1, p2 , p3, p4;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &p1,&p2,&p3,&p4);\n\n // printf(\"%c %c %c %c\\n\",p1,p2,p3,p4);\n int integer_value_of_p11 = value_converter(p1);\n int integer_value_of_p21 = value_converter(p3);\n\n if( p2==p4 ){\n if( integer_value_of_p11 > integer_value_of_p21 ){\n printf(\"YES\");\n }\n else{\n printf(\"NO\\n\");\n }\n }\n else if(p2==trump) {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint d1,d2;\n\tchar s1[100],s2[100],s3[100];\n\t\n\tscanf(\"%s%s%s\",s1,s2,s3);\n\t\n\tif(s2[0]=='T')\n\t\td1=10;\n\telse if(s2[0]=='J')\n\t\td1=11;\n\telse if(s2[0]=='Q')\n\t\td1=12;\n\telse if(s2[0]=='K')\n\t\td1=13;\n\telse if(s2[0]=='A')\n\t\td1=14;\n\telse\n\t\td1=s2[0]-'0';\n\t\n\t\n\tif(s3[0]=='T')\n\t\td2=10;\n\telse if(s3[0]=='J')\n\t\td2=11;\n\telse if(s3[0]=='Q')\n\t\td2=12;\n\telse if(s3[0]=='K')\n\t\td2=13;\n\telse if(s3[0]=='A')\n\t\td2=14;\n\telse\n\t\td2=s3[0]-'0';\n\t\n\t\n\tif(s2[1]==s3[1]&&d1>d2)\n\t\tprintf(\"YES\");\n\t\n\telse if(s2[1]==s1[0]&&s1[0]!=s3[1])\n\t\tprintf(\"YES\");\n\t\n\telse\n\t\tprintf(\"NO\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main ()\n{\n int i,n,j;\n char t[2],x[5],y[5];\n scanf(\"%c\",&t[0]);\n scanf(\"%s %s\",&x,&y);\n if(x[1]==t[0] && y[1]!=t[0]) {\n printf(\"YES\\n\");\n return 0;\n }\n if(x[1]==y[1]) {\n if(x[0]>=65 && y[0]<65) {\n printf(\"YES\\n\");\n return 0;\n }\n if(y[0]>=65 && x[0]<65) {\n printf(\"NO\\n\");\n return 0;\n }\n if(x[0]=='J' && (y[0]!='K' && y[0]!='Q' && y[0]!='A')) {\n printf(\"YES\\n\");\n return 0;\n }\n if(y[0]=='J' && (x[0]=='K' || x[0]=='Q' || x[0]=='A')) {\n printf(\"YES\\n\");\n return 0;\n }\n if(x[0]=='J' && (y[0]=='K' || y[0]=='Q' || y[0]=='A')) {\n printf(\"NO\\n\");\n return 0;\n }\n if(x[0]>=65) {\n if((int)(x[0]-'0')<(int)(y[0]-'0')) {\n printf(\"YES\\n\");\n return 0;\n }\n else {\n printf(\"NO\\n\");\n return 0;\n }\n }\n if((int)(x[0]-'0')>(int)(y[0]-'0')) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint checa( char *a, char *b ){\n int n1, n2;\n\n if( a[ 0 ] >= '0' && a[ 0 ] <= '9' ) n1 = a[ 0 ]-'0';\n else if( a[ 0 ] == 'T' ) n1 = 10;\n else if( a[ 0 ] == 'J' ) n1 = 11;\n else if( a[ 0 ] == 'Q' ) n1 = 12;\n else if( a[ 0 ] == 'K' ) n1 = 13;\n else if( a[ 0 ] == 'A' ) n1 = 14;\n\n if( b[ 0 ] >= '0' && b[ 0 ] <= '9' ) n2 = b[ 0 ]-'0';\n else if( b[ 0 ] == 'T' ) n2 = 10;\n else if( b[ 0 ] == 'J' ) n2 = 11;\n else if( b[ 0 ] == 'Q' ) n2 = 12;\n else if( b[ 0 ] == 'K' ) n2 = 13;\n else if( b[ 0 ] == 'A' ) n2 = 14;\n \n return ( n1 > n2 )?1:0;\n\n}\n\nint main(){\n char t[ 2 ], c1[ 3 ], c2[ 3 ];\n\n scanf(\"%s\",t);\n scanf(\"%s %s\", c1, c2);\n \n if( t[ 0 ] != c2[ 1 ] && t[ 0 ] == c1[ 1 ] ) printf(\"YES\\n\");\n else\n if( c1[ 1 ] == c2[ 1 ] ){\n if( checa( c1, c2 ) )\n printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nvoid convRank(char *rank) {\n switch (*rank) {\n case 'T':\n *rank = '9' + 1;\n break;\n case 'J':\n *rank = '9' + 2;\n break;\n case 'Q':\n *rank = '9' + 3;\n break;\n case 'K':\n *rank = '9' + 4;\n break;\n case 'A':\n *rank = '9' + 5;\n break;\n default:\n break;\n }\n}\n\nint main(int argc, char **argv) {\n char trump, suit1, rank1, suit2, rank2;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &rank1, &suit1, &rank2, &suit2);\n convRank(&rank1);\n convRank(&rank2);\n \n if ( (suit1 == trump && suit2 != trump) ||\n (suit1 == suit2 && rank1 > rank2) )\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(char ch){\n if (ch >= '6' && ch <= '9'){\n return ch - '0';\n }\n if (ch == 'J'){\n return 11;\n }\n if (ch == 'T'){\n return 10;\n }\n if (ch == 'K'){\n return 13;\n }\n if (ch == 'Q'){\n return 12;\n }\n return 14;\n}\n\n\nint main(void)\n{\n int a1, a2;\n char koz, c1, c2, ch;\n scanf(\"%c\\n\", &koz);\n scanf(\"%c%c\", &ch, &c1);\n a1 = num(ch);\n scanf(\"%c\", &ch);\n scanf(\"%c%c\", &ch, &c2);\n a2 = num(ch);\n if ((c1 == c2 && a2 < a1) || (c1 == koz && c2 != koz)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nchar s[9] = {'6','7','8','9','T','J','Q','K','A'};\nint chiso(char c)\n{\n\tint i;\n\tfor(i=0;i<=8;i++)\n\t\tif(s[i]==c)\n\t\t\tbreak;\n\treturn i;\n}\nvoid check(char s1[],char s2[],char trump)\n{\n\tif(s1[1]==s2[1])\n\t{\n\t\tif(chiso(s1[0])>chiso(s2[0])) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse\n\tif(s1[1]==trump)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\n}\n\nint main()\n{\n\tchar trump;\n\tchar s1[3];\n\tchar s2[3];\n\tscanf(\"%c\\n\",&trump);\n\tscanf(\"%s %s\",s1,s2);\n\tcheck(s1,s2,trump);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nchar a[3][3],v[1111];\n\nint main()\n{\n int i;\n scanf(\"%s%s%s\",a[0],a[1],a[2]);\n for (i=2;i<=9;i++)\n v[i+'0']=i-2;\n v['T']=8;\n v['J']=9;\n v['Q']=10;\n v['K']=11;\n v['A']=12;\n puts((a[1][1]==a[0][0]&&a[2][1]!=a[0][0]||a[1][1]==a[2][1]&&v[a[1][0]]>v[a[2][0]])?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<ctype.h>\nchar s[9] = {'6','7','8','9','T','J','Q','K','A'};\nint chiso(char c)\n{\n\tint i;\n\tfor(i=0;i<=8;i++)\n\t\tif(s[i]==c)\n\t\t\tbreak;\n\treturn i;\n}\nvoid check(char s1[],char s2[],char trump)\n{\n\tif(s1[1]==s2[1])\n\t{\n\t\tif(chiso(s1[0])>chiso(s2[0])) printf(\"YES\\n\");\n\t\telse printf(\"NO\\n\");\n\t}\n\telse\n\tif(s1[1]==trump)\n\t{\n\t\tprintf(\"YES\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"NO\\n\");\n\t}\n\n}\n\nint main()\n{\n\tchar trump;\n\tchar s1[3];\n\tchar s2[3];\n\tscanf(\"%c\\n\",&trump);\n\tscanf(\"%s %s\",s1,s2);\n\tcheck(s1,s2,trump);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(char ch){\n if (ch >= '6' && ch <= '9'){\n return ch - '0';\n }\n if (ch == 'J'){\n return 11;\n }\n if (ch == 'T'){\n return 10;\n }\n if (ch == 'K'){\n return 13;\n }\n if (ch == 'Q'){\n return 12;\n }\n return 14;\n}\n\n\nint main(void)\n{\n int a1, a2;\n char koz, c1, c2, ch;\n scanf(\"%c\\n\", &koz);\n scanf(\"%c%c\", &ch, &c1);\n a1 = num(ch);\n scanf(\"%c\", &ch);\n scanf(\"%c%c\", &ch, &c2);\n a2 = num(ch);\n if ((c1 == c2 && a2 < a1) || (c1 == koz && c2 != koz)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[10]={'6','7','8','9','T','J','Q','K','A'},s1[5]={'\\0'},ch='\\0'; \n\tint i;\n\tscanf(\"%c%c%c%c%c%c%c%c\",&s1[0],&ch,&s1[1],&s1[2],&ch,&s1[3],&s1[4],&ch);\n for(i=0;i<10;i++)\n {\n\t\tif(s1[1]==s[i])\n s1[1]=i+1;\n if(s1[3]==s[i])\n\t\t s1[3]=i+1;\n\t}\n\tif(s1[2]==s1[4])\n\t{\n\t\tif(s1[1]>s1[3])\n\t\tprintf(\"YES\\n\");\n\t\telse\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(s1[2]==s1[0])\n\t printf(\"YES\\n\");\n else\n\t printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "/* Author: Abhay\n Problem: 106A Codeforces\n Language: C\n */\n \n#include <stdio.h>\n\nchar cards[9] = {'6','7','8','9','T','J','Q','K','A'};\n\nint main ()\n{\n int i, index1, index2, ans;\n char trump, card1[3], card2[3];\n \n scanf (\"%c\", &trump);\n scanf (\"%s %s\", &card1, card2);\n \n ans = 0;\n \n if (card1[1] == card2[1])\n {\n for (i=0; i<9; i++)\n {\n if (cards[i] == card1[0])\n index1 = i;\n if (cards[i] == card2[0])\n index2 = i;\n }\n if (index1 > index2)\n ans = 1;\n }\n \n else if (card1[1] == trump)\n ans = 1;\n \n if (ans)\n printf (\"YES\\n\");\n else\n printf (\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char t,c1,c2,s1,s2;\n scanf(\"%c \",&t);\n scanf(\"%c%c %c%c\",&c1,&s1,&c2,&s2);\n if(c1=='6') c1='0';\n else if(c1=='7') c1='1';\n else if(c1=='8') c1='2';\n else if(c1=='9') c1='3';\n else if(c1=='T') c1='4';\n else if(c1=='J') c1='5';\n else if(c1=='Q') c1='6';\n else if(c1=='K') c1='7';\n else if(c1=='A') c1='8';\n if(c2=='6') c2='0';\n else if(c2=='7') c2='1';\n else if(c2=='8') c2='2';\n else if(c2=='9') c2='3';\n else if(c2=='T') c2='4';\n else if(c2=='J') c2='5';\n else if(c2=='Q') c2='6';\n else if(c2=='K') c2='7';\n else if(c2=='A') c2='8';\n if(s1==s2){\n if(c1>c2) printf(\"YES\");\n else printf(\"NO\");\n }\n else if(s1==t) printf(\"YES\");\n else printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[10]={'6','7','8','9','T','J','Q','K','A'},s1[5]={'\\0'},ch='\\0'; \n\tint i;\n\tscanf(\"%c%c%c%c%c%c%c%c\",&s1[0],&ch,&s1[1],&s1[2],&ch,&s1[3],&s1[4],&ch);\n for(i=0;i<10;i++)\n {\n\t\tif(s1[1]==s[i])\n s1[1]=i+1;\n if(s1[3]==s[i])\n\t\t s1[3]=i+1;\n\t}\n\tif(s1[2]==s1[4])\n\t{\n\t\tif(s1[1]>s1[3])\n\t\tprintf(\"YES\\n\");\n\t\telse\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(s1[2]==s1[0])\n\t printf(\"YES\\n\");\n else\n\t printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\nint higher_card( char ch)\n{\n int i;\n char cards[9] = \"6789TJQKA\";\n for(i=0; i<9; i++){\n if(cards[i] == ch) return i;\n }\n return 0;\n}\n\nint main(void)\n{\n char trump;\n char card_1[3], card_2[3];\n trump = getchar();\n\n scanf(\"%s %s\", card_1, card_2);\n\n if(card_1[1] == trump && card_2[1]!= trump) printf(\"YES\") ;\n else if(card_1[1] == card_2[1]){\n if(higher_card(card_1[0]) > higher_card(card_2[0])) printf(\"YES\");\n else printf(\"NO\");\n }\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h> \n\nint main(){ \nchar trump,a[3],b[3];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[0]=='T')a[0]='a';\nif(b[0]=='T')b[0]='a';\nif(a[0]=='J')a[0]='b';\nif(b[0]=='J')b[0]='b';\nif(a[0]=='Q')a[0]='c';\nif(b[0]=='Q')b[0]='c';\nif(a[0]=='K')a[0]='d';\nif(b[0]=='K')b[0]='d';\nif(a[0]=='A')a[0]='e';\nif(b[0]=='A')b[0]='e';\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=b[1])printf(\"NO\");\nelse if(a[1]==b[1]){\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n \t \t \t \t\t \t\t\t\t \t \t\t \t \t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{char t,p[5],q[3];\nscanf(\"%s\",&t);\n\nscanf(\"%s%s\",p,q);\nswitch(p[0])\n{case 'T':p[0]='A';break;\n case 'J':p[0]='B';break;\n case 'Q':p[0]='C';break;\n case 'K':p[0]='D';break;\n case 'A':p[0]='E';break;\n } \n switch(q[0])\n{case 'T':q[0]='A';break;\n case 'J':q[0]='B';break;\n case 'Q':q[0]='C';break;\n case 'K':q[0]='D';break;\n case 'A':q[0]='E';break;\n } \nif(p[1]==q[1])\n{if(p[0]>q[0])\n{printf(\"YES\");\nreturn 0;}}\nelse\nif(p[1]==t)\n{printf(\"YES\");return 0;}\nprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nchar choose(char ch)\n{\n\tswitch (ch)\n\t{\n\tcase '6':\n\t\tch = '1'; break;\n\tcase '7':\n\t\tch = '2'; break;\n\tcase '8':\n\t\tch = '3'; break;\n\tcase '9':\n\t\tch = '4'; break;\n\tcase 'T':\n\t\tch = '5'; break;\n\tcase 'J':\n\t\tch = '6'; break;\n\tcase 'Q':\n\t\tch = '7'; break;\n\tcase 'K':\n\t\tch = '8'; break;\n\tcase 'A':\n\t\tch = '9'; break;\n\t}\n\treturn ch;\n}\n\nint main()\n{\n\tint n;\n\tchar suit;\n\n\twhile (~scanf(\"%c\", &suit))\n\t{\n\t\tgetchar();\n\t\tint flag = 0;\n\t\tchar ch1[4], ch2[4];\n\t\tscanf(\"%s %s\", ch1, ch2);\n\t\tgetchar();\n\t\tch1[0] = choose(ch1[0]);\n\t\tch2[0] = choose(ch2[0]);\n\n\t\tif (ch1[1] == ch2[1])\n\t\t{\n\t\t\tif (ch1[0] > ch2[0])\n\t\t\t\tflag = 1;\n\t\t}\n\t\telse if (ch1[1] == suit)\n\t\t\t\tflag = 1;\n\n\n\t\tif (flag)\n\t\t\tputs(\"YES\");\n\t\telse\n\t\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}\n \t \t\t \t \t\t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main ()\n{\n int i,n,j;\n char t[2],x[5],y[5];\n scanf(\"%c\",&t[0]);\n scanf(\"%s %s\",&x,&y);\n if(x[1]==t[0] && y[1]!=t[0]) {\n printf(\"YES\\n\");\n return 0;\n }\n if(x[1]==y[1]) {\n if(x[0]>=65 && y[0]<65) {\n printf(\"YES\\n\");\n return 0;\n }\n if(y[0]>=65 && x[0]<65) {\n printf(\"NO\\n\");\n return 0;\n }\n if(x[0]=='J' && (y[0]!='K' && y[0]!='Q' && y[0]!='A')) {\n printf(\"YES\\n\");\n return 0;\n }\n if(y[0]=='J' && (x[0]=='K' || x[0]=='Q' || x[0]=='A')) {\n printf(\"YES\\n\");\n return 0;\n }\n if(x[0]=='J' && (y[0]=='K' || y[0]=='Q' || y[0]=='A')) {\n printf(\"NO\\n\");\n return 0;\n }\n if(x[0]>=65) {\n if((int)(x[0]-'0')<(int)(y[0]-'0')) {\n printf(\"YES\\n\");\n return 0;\n }\n else {\n printf(\"NO\\n\");\n return 0;\n }\n }\n if((int)(x[0]-'0')>(int)(y[0]-'0')) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint max(int a,int b){\n\treturn a>b?a:b;\n}\nint min(int a,int b){\n\treturn a<b?a:b;\n}\nint main(){\n\tchar a,b,c,d,e;int k=0;\nscanf(\"%c\\n%c%c %c%c\",&a,&b,&c,&d,&e);\n\tif(b=='A')b='Z';\n\tif(b=='T')b='A';\n\tif(b=='K')b='Y';\n\tif(d=='A')d='Z';\n\tif(d=='T')d='A';\n\tif(d=='K')d='Y';\n\tif((a==c)&&(a!=e)) k=1;\n\tif((c==e)&&(b>d))k=1;\n\t\n\tprintf(k?\"YES\":\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint i,j,a,b,c=0;\nchar str[2][2],str1[12];\nstr1[3]='6';\nstr1[4]='7';\nstr1[5]='8';\nstr1[6]='9';\nstr1[7]='T';\nstr1[8]='J';\nstr1[9]='Q';\nstr1[10]='K';\nstr1[11]='A';\nscanf(\"%s\",str[0]);\nscanf(\"%s\",str[1]);\nscanf(\"%s\",str[2]);\n if(str[1][1]==str[2][1]) {\n for(i=3;i<=11;i++){\n if(str[1][0]==str1[i])\n a=i;\n else if(str[2][0]==str1[i])\n b=i;\n }\n if(a>b)\n printf(\"YES\");\n else if(a<b)\n printf(\"NO\");\n }\nelse if(str[1][1]==str[0][0])\n printf(\"YES\");\nelse if(str[2][1]==str[0][0])\n printf(\"NO\");\n else if(str[1][1]!=str[2][1])\n printf(\"NO\");\nreturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\nchar trump,str1[3],str2[3];\nint i;\nscanf(\"%c%s%s\",&trump,str1,str2);\n\n\nif((str1[1]==str2[1])||(str1[1]==trump)){\n if(str1[0]=='6')\n str1[0]=6;\n else if(str1[0]=='7')\n str1[0]=7;\n else if(str1[0]=='8')\n str1[0]=8;\n else if(str1[0]=='9')\n str1[0]=9;\n else if(str1[0]=='T')\n str1[0]=10;\n else if(str1[0]=='J')\n str1[0]=11;\n else if(str1[0]=='Q')\n str1[0]=12;\n else if(str1[0]=='K')\n str1[0]=13;\n else if(str1[0]=='A')\n str1[0]=14;\n else;\n if(str2[0]=='6')\n str2[0]=6;\n else if(str2[0]=='7')\n str2[0]=7;\n else if(str2[0]=='8')\n str2[0]=8;\n else if(str2[0]=='9')\n str2[0]=9;\n else if(str2[0]=='T')\n str2[0]=10;\n else if(str2[0]=='J')\n str2[0]=11;\n else if(str2[0]=='Q')\n str2[0]=12;\n else if(str2[0]=='K')\n str2[0]=13;\n else if(str2[0]=='A')\n str2[0]=14;\n else;\n if(str1[1]==trump){\n if(str2[1]==str1[1]){\n if(str1[0]>str2[0])\n printf(\"YES\");\n else\n printf(\"NO\");\n\n }\n else\n printf(\"YES\");\n }\n else if (str1[1]==str2[1])\n {\n if(str1[0]>str2[0])\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n\n}\nelse\n printf(\"NO\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define SIM 1\n#define NAO 0\n\nint main() {\n\tchar trunfo, valor1, valor2, naipe1, naipe2;\n\tint vitoria = NAO, num1, num2;\n\n\tnum1 = num2 = 1;\n\n\tscanf (\" %c\", &trunfo);\n\tscanf (\" %c %c\", &valor1, &naipe1);\n\n\tswitch (valor1) {\n\t\tcase '6':\t\tbreak;\n\t\tcase '7':\t\tnum1 = 2; break;\n\t\tcase '8':\t\tnum1 = 3; break;\n\t\tcase '9':\t\tnum1 = 4; break;\n\t\tcase 'T':\t\tnum1 = 5; break;\n\t\tcase 'J':\t\tnum1 = 6; break;\n\t\tcase 'Q':\t\tnum1 = 7; break;\n\t\tcase 'K':\t\tnum1 = 8; break;\n\t\tcase 'A':\t\tnum1 = 9; break;\n\t}\n\n\tscanf (\" %c %c\", &valor2, &naipe2);\n\n\tswitch (valor2) {\n\t\tcase '6':\t\tbreak;\n\t\tcase '7':\t\tnum2 = 2; break;\n\t\tcase '8':\t\tnum2 = 3; break;\n\t\tcase '9':\t\tnum2 = 4; break;\n\t\tcase 'T':\t\tnum2 = 5; break;\n\t\tcase 'J':\t\tnum2 = 6; break;\n\t\tcase 'Q':\t\tnum2 = 7; break;\n\t\tcase 'K':\t\tnum2 = 8; break;\n\t\tcase 'A':\t\tnum2 = 9; break;\n\t}\n\n\n\tif (naipe1 == naipe2) {\n\t\tif (num1 > num2)\n\t\t\tvitoria = SIM;\n\t}\t\n\n\telse {\n\t\tif (naipe1 == trunfo)\n\t\t\tvitoria = SIM;\n\t}\n\n\tif (vitoria)\n\t\tprintf (\"YES\\n\");\n\telse printf (\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef struct dupla {\n\tchar card;\n\tint value;\n} cell;\n\ncell celula[9];\n\nvoid start ();\nint beats (char c1, char c2);\n\n\nint main () {\n\tchar trump, c1, c2, s1, s2;\n\n\n\n\tscanf (\"%c\", &trump);\n\tscanf (\"%c\", &c1);\n\tscanf (\"%c\", &c1);\n\tscanf (\"%c\", &s1);\n\tscanf (\"%c\", &c2);\n\tscanf (\"%c\", &c2);\n\tscanf (\"%c\", &s2);\n\n\tstart ();\t\n\t\n\tif (s1 == trump && s2 == trump) {\n\t\tif (beats (c1, c2))\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\telse { /*nao todas sao trunfo*/\n\t\tif (s1 == trump) /*primeira eh trunfo*/\n\t\t\tprintf (\"YES\");\n\t\telse /*primeira nao eh trunfo*/\n\t\t\tif (s2 == trump) /*segunda eh trunfo*/\n\t\t\t\tprintf (\"NO\");\n\t\t\telse /*segunda TB nao eh trunfo*/\n\t\t\t\tif (s1 != s2) /*naipes diferentes*/\n\t\t\t\t\tprintf (\"NO\");\n\t\t\t\telse /*naipes iguais*/\n\t\t\t\t\tif (beats (c1, c2))\n\t\t\t\t\t\tprintf (\"YES\");\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf (\"NO\");\n\t}\n\treturn 0;\n}\n\n\nvoid start () {\n\tint i;\n\t\n\tcelula[0].card = '6';\n\tcelula[1].card = '7';\n\tcelula[2].card = '8';\n\tcelula[3].card = '9';\n\tcelula[4].card = 'T';\n\tcelula[5].card = 'J';\n\tcelula[6].card = 'Q';\n\tcelula[7].card = 'K';\n\tcelula[8].card = 'A';\n\t\n\tfor (i = 0; i < 9; i++)\n\t\tcelula[i].value = i;\n}\n\nint beats (char c1, char c2) {\n\tint i, v1, v2;\n\t\n/*\tfor (i = 0; i < 9; i++)*/\n/*\t\tprintf (\"%c | %d\\n\", celula[i].card, celula[i].value);*/\n\t\n\tfor (i = 0; i < 9; i++) {\n\t\n\t\tif (celula[i].card == c1) {\n\t\t\tv1 = celula[i].value;\n/*\t\t\tprintf (\"1 ---> i = %d e v1 = %d\", i, celula[i].value);*/\n\t\t}\n\t\tif (celula[i].card == c2) {\n\t\t\tv2 = celula[i].value;\n/*\t\t\tprintf (\"2 ---> i = %d e v2 = %d\", i, celula[i].value);*/\n\t\t}\n\t}\n\tif (v1 > v2) return 1;\n\telse return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,check1=0,check2=0;\n char str[]=\"6789TJQKA\";\n char str_trump[]=\"SHDC\",trump,str1[3],str2[3];\n scanf(\"%c\",&trump);\n getchar();\n gets(str1);\n gets(str2);\n //getchar();\n for(i=0; i<strlen(str);i++)\n {\n if(str[i]==str1[0])\n check1=i;\n if(str[i]==str2[0])\n check2=i;\n }\n if(str1[1]==trump && str2[1]==trump)\n {\n if(check1>check2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if(str1[1]==trump && str2[1]!=trump)\n {\n printf(\"YES\");\n }\n else if(str1[1]!=trump && str2[1]==trump)\n {\n printf(\"NO\");\n }\n //int check3=0,check4=0;\n else if(str1[1]==str2[1])\n {\n if(check1>check2)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid main(){\n char suit,a[3],b[3];\n scanf(\"%c\",&suit);\nscanf(\"%s %s\",a,b);\nif(a[0]=='Q')\n\ta[0]='L';\nif(b[0]=='Q')\n\tb[0]='L';\nif(a[0]=='T')\n\ta[0]='G';\nif(b[0]=='T')\n\tb[0]='G';\nif(a[0]=='A')\n\ta[0]='N';\nif(b[0]=='A')\n\tb[0]='N';\nif(a[0]=='K')\n\ta[0]='M';\nif(b[0]=='K')\n\tb[0]='M';\n if(a[1]==suit&&b[1]!=suit)\n\t printf(\"YES\\n\");\n else if(a[1]!=suit&&b[1]==suit)\n\t printf(\"NO\\n\");\n else if(a[1]!=b[1])\n\t printf(\"NO\\n\");\n else {\n\t if(a[0]>b[0])\n\t\t printf(\"YES\\n\");\n\t else \n\t\t printf(\"NO\\n\");\n }\n}\n\t \t \t \t\t\t\t\t \t\t\t\t \t \t\t"}, {"source_code": "#include <stdio.h>\n\nvoid convRank(char *rank) {\n switch (*rank) {\n case 'T':\n *rank = '9' + 1;\n break;\n case 'J':\n *rank = '9' + 2;\n break;\n case 'Q':\n *rank = '9' + 3;\n break;\n case 'K':\n *rank = '9' + 4;\n break;\n case 'A':\n *rank = '9' + 5;\n break;\n default:\n break;\n }\n}\n\nint main(int argc, char **argv) {\n char trump, suit1, rank1, suit2, rank2;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &rank1, &suit1, &rank2, &suit2);\n convRank(&rank1);\n convRank(&rank2);\n \n if ( (suit1 == trump && suit2 != trump) ||\n (suit1 == suit2 && rank1 > rank2) )\n printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint s(char c);\nint main(){\nchar a,b,c,d,t;\nint i,j;\nscanf(\"%c\\n\",&t);\nscanf(\"%c%c %c%c\",&a,&b,&c,&d);\nif(b==t&&d!=t)\n printf(\"YES\\n\");\nelse if(d==t&&b!=t)\n printf(\" NO\\n\");\nelse{\n i=s(a);\n j=s(c);\n if(b==d&&i-j>0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\nreturn 0;\n}\nint s(char c){\nif('5'<c&&c<='9')\n return c-'0';\nif(c=='T')\n return 10;\nif(c=='J')\n return 11;\nif(c=='K')\n return 13;\nif(c=='A')\n return 14;\nif(c=='Q')\n return 12;\n}\n\n\t \t\t\t\t \t\t \t \t \t\t \t \t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nstruct card{\n char suit;\n char rank;\n};\n\nint win(struct card c1,struct card c2,char trump);\nint num(char c);\n\nint main(void){\n struct card c[2];\n char trump;\n scanf(\"%c%*c\",&trump);\n scanf(\"%c%c %c%c%*c\",&c[0].rank,&c[0].suit,&c[1].rank,&c[1].suit);\n if(win(c[0],c[1],trump)) puts(\"YES\");\n else puts(\"NO\");\n return 0;\n}\n\nint win(struct card c1,struct card c2,char trump){\n if(c1.suit==trump && c2.suit!=trump) return 1;\n if(c2.suit==trump && c1.suit!=trump) return 0;\n if(c1.suit!=c2.suit) return 0;\n if(num(c1.rank)<num(c2.rank)) return 0;\n else return 1;\n}\n\nint num(char c){\n switch(c){\n case 'T':\n return 10;\n break;\n case 'J':\n return 11;\n break;\n case 'Q':\n return 12;\n break;\n case 'K':\n return 13;\n break;\n case 'A':\n return 14;\n break;\n default:\n return c-'0';\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nchar choose(char ch)\n{\n\tswitch (ch)\n\t{\n\tcase '6':\n\t\tch = '1'; break;\n\tcase '7':\n\t\tch = '2'; break;\n\tcase '8':\n\t\tch = '3'; break;\n\tcase '9':\n\t\tch = '4'; break;\n\tcase 'T':\n\t\tch = '5'; break;\n\tcase 'J':\n\t\tch = '6'; break;\n\tcase 'Q':\n\t\tch = '7'; break;\n\tcase 'K':\n\t\tch = '8'; break;\n\tcase 'A':\n\t\tch = '9'; break;\n\t}\n\treturn ch;\n}\n\nint main()\n{\n\tint n;\n\tchar suit;\n\n\twhile (~scanf(\"%c\", &suit))\n\t{\n\t\tgetchar();\n\t\tint flag = 0;\n\t\tchar ch1[4], ch2[4];\n\t\tscanf(\"%s %s\", ch1, ch2);\n\t\tgetchar();\n\t\tch1[0] = choose(ch1[0]);\n\t\tch2[0] = choose(ch2[0]);\n\n\t\tif (ch1[1] == ch2[1])\n\t\t{\n\t\t\tif (ch1[0] > ch2[0])\n\t\t\t\tflag = 1;\n\t\t}\n\t\telse if (ch1[1] == suit)\n\t\t\t\tflag = 1;\n\n\n\t\tif (flag)\n\t\t\tputs(\"YES\");\n\t\telse\n\t\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}\n \t \t\t \t \t\t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar index[9]={'6','7','8','9','T','J','Q','K','A'};\n\nint main()\n{\n \t\tchar trump;\n \t\tchar a[3],b[3];\n \t\tscanf(\"%c\",&trump);\n \t\tif(trump!='H'&&trump!='S'&&trump!='D'&&trump!='C')\n \t\t exit(0);\t\n\t\tmemset(a,0,sizeof(a));\n\t\tmemset(b,0,sizeof(b));\t\t\t\t\t\t\t\t\t\t\n\t scanf(\"%s%s\",a,b);\n\t int marka,markb;\n\t if(a[1]==trump&& b[1]!=trump)\n\t {\n\t printf(\"YES\\n\");\n\t return 0;\n }\n if(a[1]!=trump && b[1]==trump)\n {\n\t\t printf(\"NO\\n\");\n return 0;\n }\n else\n {\n \t\tint i=0;\n \t\tfor(i=0;i<9;i++)\n \t\t{\n\t\t\t\t\t\tif(a[0]==index[i])\n\t\t\t\t marka=i;\n \t\t\tif(b[0]==index[i])\n markb=i;\n\t\t\t\t}\n\t\t\t\tif(a[1]==b[1])\n\t\t\t\t{\n \t\t if(marka<markb)\n\t\t\t\t\t printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t printf(\"NO\\n\");\n\t return 0;\n\t\t }\n}\n"}, {"source_code": "//In the name of God\n\n#include <stdio.h>\n#include <ctype.h>\nint main()\n{\n\tchar t,f[2],s[2];\n\tscanf(\"%c\\n\",&t);\n\tscanf(\"%c%c %c%c\",&f[0],&f[1],&s[0],&s[1]);\n\tif(f[1]==t && s[1]!=t)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\telse if(f[1]==s[1])\n\t{\n\t\tint lf,ls;\n\t\tif(isdigit(f[0]))\n\t\t{\n\t\t\tlf=f[0]-'0';\n\t\t}\n\t\telse if(f[0]=='T')\n\t\t\tlf=10;\n\t\telse if(f[0]=='J')\n\t\t\tlf=11;\n\t\telse if(f[0]=='Q')\n\t\t\tlf=12;\n\t\telse if(f[0]=='K')\n\t\t\tlf=13;\n\t\telse if(f[0]=='A')\n\t\t\tlf=14;\n\t\tif(isdigit(s[0]))\n\t\t{\n\t\t\tls=s[0]-'0';\n\t\t}\n\t\telse if(s[0]=='T')\n\t\t\tls=10;\n\t\telse if(s[0]=='J')\n\t\t\tls=11;\n\t\telse if(s[0]=='Q')\n\t\t\tls=12;\n\t\telse if(s[0]=='K')\n\t\t\tls=13;\n\t\telse if(s[0]=='A')\n\t\t\tls=14;\n\t\tif(lf>ls)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t}\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c,d;\n char str1[3],str2[3],ch;\n scanf(\"%c\",&ch);\n scanf(\"%s%s\",str1,str2);\n if(str1[0]=='T'){\n a=10;\n }\n else if(str1[0]=='J'){\n a=11;\n }\n else if(str1[0]=='Q'){\n a=12;\n }\n else if(str1[0]=='K'){\n a=13;\n }\n else if(str1[0]=='A'){\n a=14;\n }\n else if(str1[0]=='6'){\n a=6;\n }\n else if(str1[0]=='7'){\n a=7;\n }\n else if(str1[0]=='8'){\n a=8;\n }\n else if(str1[0]=='9'){\n a=9;\n }\n else if(str1[0]=='S'){\n a=15;\n }\n else if(str1[0]=='H'){\n a=16;\n }\n else if(str1[0]=='D'){\n a=17;\n }\n else if(str1[0]=='C'){\n a=18;\n }\n\n if(str1[1]=='T'){\n b=10;\n }\n else if(str1[1]=='J'){\n b=11;\n }\n else if(str1[1]=='Q'){\n b=12;\n }\n else if(str1[1]=='K'){\n b=13;\n }\n else if(str1[1]=='A'){\n b=14;\n }\n else if(str1[1]=='6'){\n b=6;\n }\n else if(str1[1]=='7'){\n b=7;\n }\n else if(str1[1]=='8'){\n b=8;\n }\n else if(str1[1]=='9'){\n b=9;\n }\n else if(str1[1]=='S'){\n b=15;\n }\n else if(str1[1]=='H'){\n b=16;\n }\n else if(str1[1]=='D'){\n b=17;\n }\n else if(str1[1]=='C'){\n b=18;\n }\n\n if(str2[0]=='T'){\n c=10;\n }\n else if(str2[0]=='J'){\n c=11;\n }\n else if(str2[0]=='Q'){\n c=12;\n }\n else if(str2[0]=='K'){\n c=13;\n }\n else if(str2[0]=='A'){\n c=14;\n }\n else if(str2[0]=='6'){\n c=6;\n }\n else if(str2[0]=='7'){\n c=7;\n }\n else if(str2[0]=='8'){\n c=8;\n }\n else if(str2[0]=='9'){\n c=9;\n }\n else if(str2[0]=='S'){\n c=15;\n }\n else if(str2[0]=='H'){\n c=16;\n }\n else if(str2[0]=='D'){\n c=17;\n }\n else if(str2[0]=='C'){\n c=18;\n }\n\n if(str2[1]=='T'){\n d=10;\n }\n else if(str2[1]=='J'){\n d=11;\n }\n else if(str2[1]=='Q'){\n d=12;\n }\n else if(str2[1]=='K'){\n d=13;\n }\n else if(str2[1]=='A'){\n d=14;\n }\n else if(str2[1]=='6'){\n d=6;\n }\n else if(str2[1]=='7'){\n d=7;\n }\n else if(str2[1]=='8'){\n d=8;\n }\n else if(str2[1]=='9'){\n d=9;\n }\n else if(str2[1]=='S'){\n d=15;\n }\n else if(str2[1]=='H'){\n d=16;\n }\n else if(str2[1]=='D'){\n d=17;\n }\n else if(str2[1]=='C'){\n d=18;\n }\n if(str1[0]==ch&&str2[0]==ch){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[1]==ch&&str2[1]==ch){\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[0]==ch||str1[1]==ch){\n printf(\"YES\\n\");\n return 0;\n }\n else if(str2[0]==ch||str2[1]==ch){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&b<d){\n printf(\"NO\\n\");\n return 0;\n }\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n if(a==c){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(int ac, char** av)\n{\n char trump_suit;\n char first[3], second[3];\n int val1, val2;\n\n scanf(\" %c %s %s\",&trump_suit, first, second);\n \n /* printf(\" trump_suit = %c, first card= %s and second card = %s\", trump_suit, first, second); */\n\n if(first[1] == trump_suit && second[1] != trump_suit)\n printf(\"YES\\n\");\n else if( (first[1] != trump_suit && second[1] == trump_suit) ||\n first[1] != second[1] )\n printf(\"NO\\n\");\n else\n {\n if(first[0]>='2' && first[0]<='9')\n val1 = first[0]-'0';\n else if(first[0]=='T')\n val1 = 10;\n else if(first[0]=='J')\n val1 = 11;\n else if(first[0]=='Q')\n val1 = 12;\n else if(first[0]=='K')\n val1 = 13;\n else if(first[0]=='A')\n val1 = 14;\n else\n printf(\"INVALID CARD!\");\n \n if(second[0]>='2' && second[0]<='9')\n val2 = second[0]-'0';\n else if(second[0]=='T')\n val2 = 10;\n else if(second[0]=='J')\n val2 = 11;\n else if(second[0]=='Q')\n val2 = 12;\n else if(second[0]=='K')\n val2 = 13;\n else if(second[0]=='A')\n val2 = 14;\n else\n printf(\"INVALID CARD!\");\n\n if(val1 > val2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint get(char *s,char c)\n{\n int sum=0;\n if(s[1]==c)\n {\n sum+=10000;\n }\n if(s[0]=='6') sum+=6;\n else if(s[0]=='7') sum+=7;\n else if(s[0]=='8') sum+=8;\n else if(s[0]=='9') sum+=9;\n else if(s[0]=='T') sum+=10;\n else if(s[0]=='J') sum+=11;\n else if(s[0]=='Q') sum+=12;\n else if(s[0]=='K') sum+=13;\n else if(s[0]=='A') sum+=14; \n return sum;\n}\nint main(void)\n{\n char com[2];\n char s1[2],s2[2];\n scanf(\"%s\",com);\n scanf(\"%s %s\",s1,s2);\n if(s1[1]!=s2[1]&&s1[1]!=com[0])\n {\n printf(\"NO\\n\");\n }\n else if(get(s1,com[0])>get(s2,com[0]))\n {\n printf(\"YES\\n\");\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}\n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar strSuit;\n\tchar strCard1[3], strCard2[3];\n\tscanf(\"%c\",&strSuit);\n\tscanf(\"%s %s\",strCard1, strCard2);\n\tif(strCard1[0]=='6')\n\t\tstrCard1[0]='1';\n\telse if(strCard1[0]=='7')\n\t\tstrCard1[0]='2';\n\telse if(strCard1[0]=='8')\n\t\tstrCard1[0]='3';\n\telse if(strCard1[0]=='9')\n\t\tstrCard1[0]='4';\n\telse if(strCard1[0]=='T')\n\t\tstrCard1[0]='5';\n\telse if(strCard1[0]=='J')\n\t\tstrCard1[0]='6';\n\telse if(strCard1[0]=='Q')\n\t\tstrCard1[0]='7';\n\telse if(strCard1[0]=='K')\n\t\tstrCard1[0]='8';\n\telse if(strCard1[0]=='A')\n\t\tstrCard1[0]='9';\n\n\tif(strCard2[0]=='6')\n\t\tstrCard2[0]='1';\n\telse if(strCard2[0]=='7')\n\t\tstrCard2[0]='2';\n\telse if(strCard2[0]=='8')\n\t\tstrCard2[0]='3';\n\telse if(strCard2[0]=='9')\n\t\tstrCard2[0]='4';\n\telse if(strCard2[0]=='T')\n\t\tstrCard2[0]='5';\n\telse if(strCard2[0]=='J')\n\t\tstrCard2[0]='6';\n\telse if(strCard2[0]=='Q')\n\t\tstrCard2[0]='7';\n\telse if(strCard2[0]=='K')\n\t\tstrCard2[0]='8';\n\telse if(strCard2[0]=='A')\n\t\tstrCard2[0]='9';\n\n\tif(strCard1[1]==strSuit&&strCard2[1]!=strSuit)\n\t\tprintf(\"YES\\n\");\n\telse if(strCard1[1]==strCard2[1])\n\t{\n\t\tif((int)strCard1[0]-(int)strCard2[0]>0)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse\n\t\tprintf(\"NO\\n\");\n\n\n\treturn 0;\n}\n \t \t \t\t\t \t \t\t\t\t \t \t \t\t\t\t\t\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint count,o;\n\tchar a,b[9];\n\tchar arr1[1][2],arr2[1][2];\n\tint i,j;\n\tscanf(\"%c\",&a);\n\tfor(i=0;i<1;i++)\n\t{\n\t\tscanf(\"%s %s\",arr1[i],arr2[i]);\n\t}\n\tb[0]='6';\n\tb[1]='7';\n\tb[2]='8';\n\tb[3]='9';\n\tb[4]='T';\n\tb[5]='J';\n\tb[6]='Q';\n\tb[7]='K';\n\tb[8]='A';\n\tif(a==arr1[0][1]&&a!=arr2[0][1])\n\tprintf(\"YES\");\n\telse if(a!=arr1[0][1]&&a==arr2[0][1])\n\tprintf(\"NO\");\n\telse if(a==arr1[0][1]&&a==arr2[0][1])\n\t{\n\t\tfor(i=0;i<9;i++)\n\t\t{\n\t\t\tif(arr1[0][0]==b[i])\n\t\t\t{\n\t\t\t\tcount=i+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tfor(i=0;i<9;i++)\n\t\t{\n\t\t\tif(arr2[0][0]==b[i])\n\t\t\t{\n\t\t\t\to=i+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(count>o)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\telse if(a!=arr1[0][1]&&a!=arr2[0][1])\n\t{\n\t\tif(arr1[0][1]==arr2[0][1])\n\t\t{\n\t\t\tfor(i=0;i<9;i++)\n\t\t{\n\t\t\tif(arr1[0][0]==b[i])\n\t\t\t{\n\t\t\t\tcount=i+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\tfor(i=0;i<9;i++)\n\t\t{\n\t\t\tif(arr2[0][0]==b[i])\n\t\t\t{\n\t\t\t\to=i+1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(count>o)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t\t}\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint dec(char c){\n\tswitch(c){\n\tcase '6': return 6;\n\tcase '7': return 7;\n\tcase '8': return 8;\n\tcase '9': return 9;\n\tcase 'T': return 10;\n\tcase 'J': return 11;\n\tcase 'Q': return 12;\n\tcase 'K': return 13;\n\tcase 'A': return 15;\n\t}\n}\n\nint istrump(char trump,char this){\n\tif(trump==this)return 1;\n\telse return 0;\n}\n\nint main(void)\n{\n char a,b,c,d,e;\n int scorea,scoreb;\n int win;\n scanf(\" %c\",&a);\n //fflush(stdin);\n scanf(\" %c%c %c%c\",&b,&c,&d,&e);\n if(istrump(a,c)){\n if(istrump(a,e)){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else win=1;\n }\n else{\n if(c==e){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else if(istrump(a,e)){\n win=0;\n }\n else win=0;\n }\n \n if(win)puts(\"YES\");\n else puts(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef struct {\n int rank;\n char suit;\n int trump; /* o naipe dessa carte e' o trump? */\n} Carta;\n\nint rank(char r) {\n switch(r) {\n case 'T':\n return 10;\n case 'J':\n return 11;\n case 'Q':\n return 12;\n case 'K':\n return 13;\n case 'A':\n return 14;\n default:\n return (r - '0');\n }\n}\n\nCarta le_carta(char trump) {\n Carta c;\n char r;\n scanf(\"%c %c\", &r, &c.suit);\n c.rank = rank(r);\n c.trump = (c.suit == trump) ? 1 : 0;\n return c;\n}\n\nint main() {\n char trump;\n Carta c1, c2;\n \n scanf(\"%c\\n\", &trump);\n c1 = le_carta(trump);\n getchar();\n c2 = le_carta(trump);\n \n if ((c1.trump > c2.trump)\n || ((c1.suit == c2.suit) && (c1.rank > c2.rank)))\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "main(){\n int i=0,j=0,map[225];\n char c,card1[5],card2[5],s[20]=\"6789TJQKASHDC\";\n while(s[i]) map[s[i++]]=j++;\n scanf(\"%c %s %s\",&c,card1,card2);\n if(card1[1]==card2[1]){\n if(map[card1[0]]>map[card2[0]]) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n }\n else if(card1[1]==c) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(char ch){\n if (ch >= '6' && ch <= '9'){\n return ch - '0';\n }\n if (ch == 'J'){\n return 11;\n }\n if (ch == 'T'){\n return 10;\n }\n if (ch == 'K'){\n return 13;\n }\n if (ch == 'Q'){\n return 12;\n }\n return 14;\n}\n\n\nint main(void)\n{\n int a1, a2;\n char koz, c1, c2, ch;\n scanf(\"%c\\n\", &koz);\n scanf(\"%c%c\", &ch, &c1);\n a1 = num(ch);\n scanf(\"%c\", &ch);\n scanf(\"%c%c\", &ch, &c2);\n a2 = num(ch);\n if ((c1 == c2 && a2 < a1) || (c1 == koz && c2 != koz)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char *s = \"6789TJQKA1\", c, a, x, b, y;\n scanf(\"%c\\n%c%c %c%c\", &c, &a, &x, &b, &y);\n puts( x == c && y != c || x == y && strchr(s, a) > strchr(s, b) ? \"YES\" : \"NO\" );\n}"}, {"source_code": "#include <stdio.h>\n //CARD GAME\nint main()\n{\n char trump ;\n char first_set[3], second_set[3] ;\n char rank[] = {'6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'} ;\n\n scanf(\"%c\", &trump);\n scanf(\"%s %s\", first_set, second_set);\n\n if(first_set[1] == trump && second_set[1] != trump)\n printf(\"YES\\n\");\n\n else if(first_set[1] != trump && second_set[1] == trump)\n printf(\"NO\\n\");\n\n else\n {\n int rank_first=0, rank_second=0 ;\n int i ;\n\n for(i=0; i<9; ++i)\n {\n if(rank[i] == first_set[0])\n rank_first = i ;\n\n if(rank[i] == second_set[0])\n rank_second = i ;\n }\n\n\n if(rank_first > rank_second && (first_set[1] == second_set[1]))\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n }\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() \n{\n char t[2],c1[3],c2[3];\n int i,a,b;\n \n char su[]={'S','H','D','C','\\0'};\n char r[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n \n scanf(\"%s\",t);\n scanf(\"%s\",c1);\n scanf(\"%s\",c2);\n \n if((c1[1]==t[0])&&(c2[1]!=t[0]))\n {\n printf(\"YES\");\n }\n \n if((c2[1]==t[0])&&(c1[1]!=t[0]))\n {\n printf(\"NO\");\n }\n \n if((c1[1]!=c2[1])&&(c1[1]!=t[0]&&c2[1]!=t[0]))\n {\n printf(\"NO\");\n }\n else if(c1[1]==c2[1])\n {\n for(i=0;i<10;i++)\n {\n if(r[i]==c1[0])\n {\n a=i+1;\n }\n if(r[i]==c2[0])\n {\n b=i+1;\n }\n }\n if(a>b)\n {\n printf(\"YES\");\n }\n else if(a<b)\n {\n printf(\"NO\");\n }\n else if(a==b)\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "/*\n#include <stdio.h>\n#include <stdlib.h>\nint min(int a, int b) {\n\n return (a > b) ? b : a;\n\n}\n\nint main() {\n\n int n, m, a, b;\n\n scanf(\"%d %d %d %d\", &n, &m, &a, &b);\n int price = 0;\n\n int c=a*m;\n int d, e, f, g, h, k, l;\n if(c<b||c==b) printf(\"%d\",a*n);\n else if(c>b){\n if(n%m==0) printf(\"%d\", b*(n/m));\n else if(n%m!=0){\n d=n/m+1;\n e=d*b;\n\n f=n%m;\n g=f*a;\n h=n/m;\n k=h*b;\n l=g+k;\n printf(\"%d\",min(e,l));\n }\n }\n\n return 0;\n}\n*/\n/*\n#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n int sum;\n scanf(\"%d\", &sum);\n\n if (sum >= 0) {\n printf(\"%d\",sum);\n } else {\n int a = -sum/10%10;\n int b = -sum%10;\n printf(\"%d\",a > b ? sum/100*10-b : sum/10);\n }\n\n return 0;\n\n}*/\n/*\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int x1, y1, x2, y2;\n\n scanf(\"%d %d %d %d\", &x1, &y1, &x2, &y2);\n if(abs(x1-x2)==abs(y1-y2))\n printf(\"%d %d %d %d\", x1, y2, x2, y1);\n else if(x1 == x2 || y1 == y2) {\n\n float l = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));\n\n if(x1==x2) {\n printf(\"%d %d %d %d\", x1+(int)l, y1, x1+(int)l, y2);\n } else\n printf(\"%d %d %d %d\", x1, y1+(int)l, x2, y2+(int)l);\n } else\n printf(\"-1\");\n\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int** matrix, int n) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n\n for(int i = 0; i < n -1; i++) {\n\n if((float) matrix[i][1] / matrix[i][0] < (float) matrix[i + 1][1] / matrix[i + 1][0]) {\n\n int aux1 = matrix[i][0];\n int aux2 = matrix[i][1];\n\n matrix[i][0] = matrix[i + 1][0];\n matrix[i][1] = matrix[i + 1][1];\n\n matrix[i + 1][0] = aux1;\n matrix[i + 1][1] = aux2;\n\n done = 0;\n\n }\n }\n }\n}\n\nint main() {\n\n int n, strength;\n\n scanf(\"%d %d\", &strength, &n);\n\n int** matrix = (int**)malloc(sizeof(int*) * n);\n\n for(int i = 0; i < n; i++)\n matrix[i] = (int*)malloc(4 * 2);\n\n for(int i = 0; i < n; i++)\n scanf(\"%d %d\", &matrix[i][0], &matrix[i][1]);\n\n sort(matrix, n);\n\n for(int j = 0; j < n; j++)\n for(int i = 0; i < n; i++) {\n\n if(strength > matrix[i][0] && matrix[i][0] != -1) {\n\n strength += matrix[i][1];\n matrix[i][0] = -1;\n\n }\n }\n\n int finish = 0;\n\n\n for(int i = 0; i < n; i++)\n if(matrix[i][0] != -1)\n finish = 1;\n\n if(!finish)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n\n int n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n int cnt = (n + 1) / 2;\n int ans = (cnt + m - 1) / m * m;\n\n if (ans > n) {\n ans = -1;\n }\n printf(\"%d\", ans);\n\nreturn 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint min(int a, int b) {\n\n return (a > b) ? b : a;\n\n}\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n int array[n + 1];\n\n int m1 = 0, m2 = 0, m3 = 0;\n\n for(int i = 1; i <= n; i++) {\n\n scanf(\"%d\", &array[i]);\n\n switch(array[i]) {\n\n case 1:\n m1++;\n break;\n\n case 2:\n m2++;\n break;\n\n case 3:\n m3++;\n break;\n\n }\n }\n int minim = min(m1, m2);\n minim = min(minim, m3);\n\n int aux[4];\n int k = 0;\n\n printf(\"%d\\n\", minim);\n\n for(int i = 0; i < minim; i++) {\n\n k=1;\n\n for(int j = 1; k < 4; j++) {\n\n if(j == n + 1)\n j = 1;\n\n if(array[j] == k) {\n\n aux[k++] = j;\n array[j] = -1;\n\n }\n }\n\n for(int j = 1; j < k; j++)\n printf(\"%d \", aux[j]);\n printf(\"\\n\");\n\n\n }\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int n, int array[n]) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n\n for(int i = 0; i < n - 1; i++) {\n\n if(array[i] > array[i + 1]) {\n\n int aux = array[i];\n array[i] = array[i + 1];\n array[i + 1] = aux;\n done = 0;\n\n }\n }\n }\n}\nint main() {\n\n int n, d;\n scanf(\"%d %d\", &n, &d);\n\n int array[n];\n int sum = 0;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &array[i]);\n sum += array[i];\n\n }\n\n sum += 10 * (n - 1);\n\n if(sum > d)\n printf(\"-1\");\n else {\n\n //sort(n, array);\n\n int ct = 2 * (n - 1);\n while(sum + 5 <= d) {\n\n ct++;\n sum+=5;\n\n }\n printf(\"%d\", ct);\n\n }\n\n\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n int first = 0;\n int last = 1;\n for(int i = 0; i < n; i++) {\n\n if(i % 2 == 1)\n if(first == 1) {\n\n printf(\"#\");\n first = 0;\n\n }\n for(int j = 0; j < m - i % 2; j++) {\n\n if(i % 2 == 0) {\n\n printf(\"#\");\n\n } else\n printf(\".\");\n\n }\n\n if(i % 2 == 1)\n if(last == 1) {\n\n first = 1;\n printf(\"#\");\n last = 0;\n\n }\n\n if(first == 0)\n last = 1;\n printf(\"\\n\");\n }\n\n return 0;\n\n}\n\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n int nr;\n\n int odd = 0;\n int even = 0;\n int pos1 = -1;\n int pos2 = -1;\n\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &nr);\n if(nr % 2 == 0) {\n\n even++;\n pos1 = i + 1;\n\n } else {\n\n odd ++;\n pos2 = i + 1;\n\n }\n }\n\n if(odd == 1)\n printf(\"%d\", pos2);\n else\n printf(\"%d\", pos1);\n return 0;\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nvoid sort(int* array, int size) {\n\n int done = 0;\n\n while(!done) {\n\n done = 1;\n for(int i = 0; i < size - 1; i++)\n if(array[i] > array[i + 1]) {\n\n int aux = array[i];\n array[i] = array[i + 1];\n array[i + 1] = aux;\n done = 0;\n\n }\n }\n}\n\nint main() {\n\n\n int n, v;\n scanf(\"%d %d\", &n, &v);\n\n int* array = (int*)malloc(sizeof(int) * 50);\n int k;\n int* deals = (int*)malloc(sizeof(int) * 50);\n int sizeDeals = 0;\n int done;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &k);\n done = 0;\n for(int j = 0; j < k; j++) {\n\n scanf(\"%d\", &array[j]);\n if(array[j] < v)\n done = 1;\n\n }\n\n if(done)\n deals[sizeDeals++] = i + 1;\n done = 0;\n\n }\n\n if(sizeDeals != 0) {\n\n\n sort(deals, sizeDeals);\n printf(\"%d\\n\", sizeDeals);\n for(int i = 0; i < sizeDeals; i++)\n printf(\"%d \", deals[i]);\n\n } else\n printf(\"0\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n\n scanf(\"%d\", &n);\n\n char* string = malloc(101);\n char* string1 = malloc(10000);\n char* string2 = malloc(10000);\n\n for(int i = 0; i <= n; i++) {\n\n gets(string);\n strcat(string1, string);\n\n }\n\n strcpy(string2, string1);\n strrev(string2);\n\n if(strncmp(string1 + 1, string2, strlen(string2) - 2) == 0)\n printf(\"YES\");\n else\n printf(\"NO\");\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n, k;\n\n scanf(\"%d %d\", &n, &k);\n int maximum = (-1) * (1 << 31);\n\n for(int i = 0; i < n; i++) {\n\n int fi, ti;\n\n scanf(\"%d %d\", &fi, &ti);\n\n if(k >= ti) {\n\n if(fi > maximum)\n maximum = fi;\n\n\n } else {\n\n if((fi - (ti - k)) > maximum)\n maximum = fi - (ti - k);\n\n }\n\n }\n\n printf(\"%d\", maximum);\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n for(int i = 0; i < n; i++) {\n\n int price, quality;\n scanf(\"%d %d\", &price, &quality);\n\n if(price != quality) {\n\n printf(\"Happy Alex\");\n return 0;\n }\n }\n\n printf(\"Poor Alex\");\n\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int friends, bottles, milliliters, limes, slices, salt, nl, np;\n scanf(\"%d %d %d %d %d %d %d %d\", &friends, &bottles, &milliliters, &limes, &slices, &salt, &nl, &np);\n\n int allMilliliters = bottles * milliliters / nl / friends;\n int allSalt = salt / np / friends;\n int allLimes = limes * slices / friends;\n\n int minim = -1;\n\n minim = (allLimes < allMilliliters) ? allLimes : allMilliliters;\n minim = (minim < allSalt) ? minim : allSalt;\n\n printf(\"%d\", minim);\n return 0;\n\n}\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int dice1, dice2;\n scanf(\"%d %d\", &dice1, &dice2);\n\n int dice1Wins = 0;\n int draw = 0;\n int dice2Wins = 0;\n\n for(int i = 1; i <= 6; i++) {\n\n if(abs(dice1 - i) > abs(dice2 - i))\n dice2Wins++;\n else if(abs(dice1 - i) < abs(dice2 - i))\n dice1Wins++;\n else\n draw++;\n\n }\n\n printf(\"%d %d %d\", dice1Wins, draw, dice2Wins);\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n int* array = (int*)malloc(n * 4);\n int minimum = (1 << 28);\n int pos;\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &array[i]);\n\n if(i > 1) {\n\n if(array[i] - array[i - 2] < minimum) {\n\n minimum = array[i] - array[i - 2];\n pos = i - 1;\n\n }\n }\n }\n\n minimum = -999999;\n for(int i = 0 ; i < n - 1; i++) {\n\n if(i + 1 == pos) {\n if(array[i + 2] - array[i] > minimum) {\n\n minimum = array[i + 2] - array[i];\n i++;\n\n }\n } else {\n\n if(array[i + 1] - array[i] > minimum) {\n\n minimum = array[i + 1] - array[i];\n\n\n }\n\n }\n }\n\n printf(\"%d\", minimum);\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n\n int n;\n scanf(\"%d\", &n);\n int* exercises = (int*)malloc(sizeof(int) * (n + 1));\n\n int chest = 0;\n int biceps = 0;\n int back = 0;\n\n for(int i = 0; i < n; i++) {\n\n scanf(\"%d\", &exercises[i]);\n\n switch(i % 3){\n\n case 0:\n chest += exercises[i];\n break;\n\n case 1:\n biceps += exercises[i];\n break;\n\n case 2:\n back += exercises[i];\n break;\n\n\n }\n }\n\n if(chest > back && chest > biceps)\n printf(\"chest\");\n else if(back > chest && back > biceps)\n printf(\"back\");\n else\n printf(\"biceps\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n\nint cmmdc(int a, int b) {\n\n int r;\n\n while(b != 0) {\n\n r = a % b;\n a = b;\n b = r;\n\n }\n\n return a;\n}\n\nint main() {\n\n long int l, r;\n\n scanf(\"%ld %ld\", &l, &r);\n printf(\"%d\", sizeof(long int));\n if(r - (l += l%2) < 2)\n printf(\"-1\");\n else\n printf(\"%d %d %d\", l, l + 1, l + 2);\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n\n char matrix[n][n];\n\n for(int i = 0; i < n; i++)\n for(int j = 0; j < n; j++)\n scanf(\"%c\", &matrix[i][j]);\n\n char diagonal = matrix[0][0];\n\n for(int i = 0; i < n; i++)\n if(matrix[i][i] != diagonal) {\n\n printf(\"NO\");\n return 0;\n\n }\n printf(\"aaa\");\n for(int i = n; i >= 0; i--)\n if(matrix[i][n - i] != diagonal) {\n\n printf(\"NO\");\n return 0;\n\n }\n printf(\"aaa\");\n\n char notDiag = matrix[0][1];\n\n for(int i = 0; i < n; i++)\n for(int j = 0; j < n; j++) {\n\n if(i == j || i + j == n -1)\n j++;\n else {\n\n if(matrix[i][j] != notDiag) {\n\n printf(\"NO\");\n return 0;\n\n }\n }\n }\n\n printf(\"YES\");\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint main() {\n\n int n, m;\n scanf(\"%d %d\", &n, &m);\n\n char** matrix = (char**)malloc(sizeof(char*) * n);\n for(int i = 0; i < n; i++)\n matrix[i] = malloc(m);\n\n getchar();\n\n for(int i = 0; i < n; i++) {\n\n gets(matrix[i]);\n for(int j = 0; j < m; j++)\n if(matrix[i][j] == '.') {\n if((i + j) % 2 == 0)\n matrix[i][j] = 'B';\n else\n matrix[i][j] = 'W';\n\n }\n\n }\n\n for(int i = 0; i < n; i++) {\n for(int j = 0; j < m; j++)\n printf(\"%c\", matrix[i][j]);\n printf(\"\\n\");\n\n\n }\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint freq1[27], freq2[27];\n\nint main() {\n\n int n;\n scanf(\"%d\", &n);\n getchar();\n char* question = malloc(15);\n\n int left = INT_MIN / 2;\n int right = INT_MAX / 2;\n\n for(int i = 0; i < n && left <= right; i++) {\n\n gets(question);\n\n if(question[0] == '>' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '<' && question[strlen(question) - 1] == 'N')) { /// > or >=\n\n if(question[1] == '=') {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n left = atoi(tok) + 1;\n\n } else {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n left = atoi(tok);\n\n }\n } else if(question[0] == '<' && question[strlen(question) - 1] == 'Y' || (question[0] == '>' && question[strlen(question) - 1] == 'N')) {\n\n if(question[1] == '=') { /// <=\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n right = atoi(tok);\n\n } else {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n right = atoi(tok) - 1;\n\n }\n }\n\n\n if(question[0] == '>' && question[1] == '=' && question[strlen(question) -1 ] == 'Y' ||\n (question[0] == '<' && question[1] != '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) > left)\n left = atoi(tok);\n\n\n } else if(question[0] == '>' && question[1] != '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '<' && question[1] == '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) + 1 > left)\n left = atoi(tok) + 1;\n\n } else if(question[0] == '<' && question[1] == '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '>' && question[1] != '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) < right)\n right = atoi(tok);\n\n } else if(question[0] == '<' && question[1] != '=' && question[strlen(question) - 1] == 'Y' ||\n (question[0] == '>' && question[1] == '=' && question[strlen(question) - 1] == 'N')) {\n\n char* tok = strtok(question, \" \");\n tok = strtok(NULL, \" \");\n if(atoi(tok) - 1 < right)\n right = atoi(tok) - 1;\n\n }\n }\n\n if(left <= right) {\n\n printf(\"%d\", right);\n\n } else\n printf(\"Impossible\");\n return 0;\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nvoid mergeSort(int left, int mid, int right, int* array, int n) {\n\n int*aux = (int*)malloc(sizeof(int) * n);\n\n int i = left;\n int j = mid + 1;\n int index = i;\n\n while(i <= mid && j <= right) {\n\n if(array[i] > array[j]) {\n\n aux[index++] = array[i++];\n\n } else {\n\n aux[index++] = array[j++];\n\n }\n\n }\n\n for(int l = i; l <= mid; l++)\n aux[index++] = array[l];\n\n for(int l = j; l <= right; l++)\n aux[index++] = array[l];\n\n for(int l = left; l <= right; l++)\n array[l] = aux[l];\n\n}\n\nvoid merge(int left, int right, int* array, int n) {\n\n int mid;\n\n if(left < right) {\n\n mid = (left + right) / 2;\n merge(left, mid, array, n);\n merge(mid + 1, right, array, n);\n mergeSort(left, mid, right, array, n);\n\n }\n}\n\nint main() {\n\n int devices, sockets, supply;\n\n scanf(\"%d %d %d\", &supply, &devices, &sockets);\n int array[supply];\n\n for(int i = 0; i < supply; i++)\n scanf(\"%d\", &array[i]);\n\n merge(0, supply - 1, array, supply);\n\n if(devices <= sockets)\n printf(\"0\");\n else {\n\n int i = 0;\n while(sockets < devices && i < supply) {\n\n sockets += array[i] - 1;\n i++;\n\n }\n\n if(i != supply)\n printf(\"%d\", i);\n else if(sockets >= devices)\n printf(\"%d\", i);\n else\n printf(\"-1\");\n }\n return 0;\n\n}\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint main() {\n\n int x, y;\n scanf(\"%d %d\", &x, &y);\n int s = 0;\n if(y>x && x>=-y) {\n\n printf(\"a\");\n s=-2+y*4;\n\n }\n\n if(y<x && x<=-y+1) {\n\n printf(\"b\");\n s=-y*4;\n\n }\n\n if(y<=x && x>-y+1) {\n\n printf(\"c\");\n s=-3+x*4;\n\n }\n\n if(y>=x && x<-y) {\n\n printf(\"d\");\n s=-1-4*x;\n\n }\n\n printf(\"%d\", s);\n\n\n return 0;\n\n}\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint max(int a, int b) {\n\n return (a > b) ? a : b;\n\n}\n\nint main() {\n\n int a, b, c, d;\n\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\n printf(\"%d %d %d\", 2-(a==c||b==d), ((a+b)%2==(c+d)%2)*(2-(a-b==c-d||a+b==c+d)), max(abs(c-a),abs(d-b)));\n return 0;\n\n} */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <limits.h>\n\nint main() {\n\n char suit;\n scanf(\"%c\", &suit);\n getchar();\n\n char* array = malloc(10);\n gets(array);\n char vect[] = \"6789TJQKA\";\n if(array[1] == suit && array[strlen(array) - 1] != suit ||\n (array[1] == array[strlen(array) - 1] && strchr(vect, array[0]) > strchr(vect, array[strlen(array) - 2])))\n printf(\"YES\");\n else\n printf(\"NO\");\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint tranfCartaParaOrdemDeCarta(char c) {\n\tswitch (c) {\n\t\tcase 'T': return 10;\n\t\tcase 'J': return 12;\n\t\tcase 'Q': return 13;\n\t\tcase 'K': return 14;\n\t\tcase 'A': return 15;\n\t\tdefault:\n\t\t\treturn (c-'0');\n\t}\n}\n\nvoid cardGame() {\n\tchar c, s[2][3];\n\n\tscanf(\"%c\", &c);\n\tscanf(\"%s %s\", s[0], s[1]);\n\t\n\tif (s[0][1] == s[1][1]) {\n\t\tif (tranfCartaParaOrdemDeCarta(s[0][0]) > tranfCartaParaOrdemDeCarta(s[1][0]))\n\t\t\tprintf(\"YES\\n\");\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if (s[0][1] == c)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\nint main() {\n\t\n\tcardGame();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\n\nint main()\n{\n char ch[5];\n scanf(\"%c %c%c %c%c\",&ch[0],&ch[1],&ch[2],&ch[3],&ch[4]);\n if(ch[0]==ch[2])\n {\n if(ch[0]==ch[4])\n {\n goto l1;\n }\n else\n {\n printf(\"%s\",\"YES\");\n }\n }\n else\n {\n if(ch[0]==ch[4]||ch[4]!=ch[2])\n {\n printf(\"%s\",\"NO\");\n }\n else\n {\n l1:\n switch(ch[1])\n {\n case '6': printf(\"%s\",\"NO\"); break;\n case '7': if(ch[3]=='6') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '8': if(ch[3]=='6'||ch[3]=='7') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '9': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'T': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'J': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'Q': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'K': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'A': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q'||ch[3]=='K') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n }\n \n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint f(char c) {\n if (c <= 0x39) {\n return c - 0x36;\n }\n\n switch (c) {\n case ('T'):\n return 4;\n case ('J'):\n return 5;\n case ('Q'):\n return 6;\n case ('K'):\n return 7;\n case ('A'):\n return 8;\n }\n\n return -1;\n}\n\nint main () {\n char c = 0;\n char s1[3] = {0};\n char s2[3] = {0};\n \n scanf(\"%c %s %s\", &c, s1, s2);\n\n if (s1[1] == s2[1]) {\n if (f(s1[0]) > f(s2[0])) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n } else if (s1[1] == c || s2[1] == c) {\n if (s1[1] == c) {\n printf(\"YES\\n\");\n } else {\n printf(\"NO\\n\");\n }\n } else {\n printf(\"NO\\n\");\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar t;\n\tscanf(\"%c\",&t);\n\tchar s1[3],s2[3];\n\tscanf(\"%s %s\",s1,s2);\n\tchar rank[10];\n\trank[0]='6';\n\trank[1]='7';\n\trank[2]='8';\n\trank[3]='9';\n\trank[4]='T';\n\trank[5]='J';\n\trank[6]='Q';\n\trank[7]='K';\n\trank[8]='A';\n\tif(s1[1]!=s2[1] && s1[1]!=t && s2[1]!=t)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tif(s1[1]!=s2[1] && s1[1]==t)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\treturn 0;\n\t}\n\tif(s1[1]!=s2[1] && s2[1]==t)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tif(s1[1]==s2[1])\n\t{\n\t\tint i,j;\n\t\tfor(i=0;i<9;i++)\n\t\t{\n\t\t\tif(s1[0]==rank[i])\n\t\t\t\tbreak;\n\t\t}\n\t\tfor(j=0;j<9;j++)\n\t\t{\n\t\t\tif(s2[0]==rank[j])\n\t\t\t\tbreak;\n\t\t}\n\t\t//printf(\"%d %d\\n\",i,j);\n\t\tif(i>j)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#define MAX\nvoid correct(char *a)\n{\n char no[]={\"TJQKA\"};\n char *p;\n if(p=strchr(no,a[0])){\n // printf(\"replaced %c by %d\\n\",a[0],'9'+p-no+1-'0');\n a[0]='9'+p-no+1;\n }\n}\nint main()\n{\n char trump[10],f[10],s[10];\n\n scanf(\"%s%s%s\",trump,f,s);\n correct(f);\n correct(s);\n\n if(f[1]==s[1]){\n if(f[0]>s[0])\n puts(\"YES\");\n else puts(\"NO\");\n }\n else if(f[1]==trump[0])\n puts(\"YES\");\n else \n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define SIM 1\n#define NAO 0\n\nint main() {\n\tchar trunfo, valor1, valor2, naipe1, naipe2;\n\tint vitoria = NAO, num1, num2;\n\n\tnum1 = num2 = 1;\n\n\tscanf (\" %c\", &trunfo);\n\tscanf (\" %c %c\", &valor1, &naipe1);\n\n\tswitch (valor1) {\n\t\tcase '6':\t\tbreak;\n\t\tcase '7':\t\tnum1 = 2; break;\n\t\tcase '8':\t\tnum1 = 3; break;\n\t\tcase '9':\t\tnum1 = 4; break;\n\t\tcase 'T':\t\tnum1 = 5; break;\n\t\tcase 'J':\t\tnum1 = 6; break;\n\t\tcase 'Q':\t\tnum1 = 7; break;\n\t\tcase 'K':\t\tnum1 = 8; break;\n\t\tcase 'A':\t\tnum1 = 9; break;\n\t}\n\n\tscanf (\" %c %c\", &valor2, &naipe2);\n\n\tswitch (valor2) {\n\t\tcase '6':\t\tbreak;\n\t\tcase '7':\t\tnum2 = 2; break;\n\t\tcase '8':\t\tnum2 = 3; break;\n\t\tcase '9':\t\tnum2 = 4; break;\n\t\tcase 'T':\t\tnum2 = 5; break;\n\t\tcase 'J':\t\tnum2 = 6; break;\n\t\tcase 'Q':\t\tnum2 = 7; break;\n\t\tcase 'K':\t\tnum2 = 8; break;\n\t\tcase 'A':\t\tnum2 = 9; break;\n\t}\n\n\n\tif (naipe1 == naipe2) {\n\t\tif (num1 > num2)\n\t\t\tvitoria = SIM;\n\t}\t\n\n\telse {\n\t\tif (naipe1 == trunfo)\n\t\t\tvitoria = SIM;\n\t}\n\n\tif (vitoria)\n\t\tprintf (\"YES\\n\");\n\telse printf (\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n char c,a[3],b[3];\n char p[9][1]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K' , 'A'};\n char q[4][1]={'S','H','D','C'};\n scanf(\"%c\",&c);\n scanf(\"%s %s\",&a,&b);\n if(a[1]==b[1])\n {\n int x=0,y=0;\n for(int i=0;i<9;i++)\n {\n if(a[0]==p[i][0])\n x=i;\n else if(b[0]==p[i][0])\n y=i;\n }\n if(x>=y)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n else if(a[1]==c)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint func(char c)\n{\n if(c=='6' || c=='7' || c=='8' || c=='9')\n return (c-'0');\n else if(c=='T')\n return 10;\n else if(c=='J')\n return (11);\n else if(c=='Q')\n return (12);\n else if(c=='K')\n return 13;\n else if(c=='A')\n return 14;\n}\n\nint main()\n{\n char trump[2], a[3], b[3];\n scanf(\"%s\", trump);\n scanf(\"%s\", a);\n scanf(\"%s\", b);\n //printf(\"%c %s %s\", trump[0], a, b);\n //printf(\"%d %d %d %d %d %d %d %d %d\\n\", '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A');\n if(a[1]!=b[1])\n {\n if(a[1]!=trump[0])\n printf(\"NO\\n\");\n else \n printf(\"YES\\n\");\n }\n else\n {\n int v1, v2;\n v1=func(a[0]);\n v2=func(b[0]);\n //printf(\"%d %d\\n\", v1, v2);\n if(v1>v2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nchar choose(char ch)\n{\n\tswitch (ch)\n\t{\n\tcase '6':\n\t\tch = '1'; break;\n\tcase '7':\n\t\tch = '2'; break;\n\tcase '8':\n\t\tch = '3'; break;\n\tcase '9':\n\t\tch = '4'; break;\n\tcase 'T':\n\t\tch = '5'; break;\n\tcase 'J':\n\t\tch = '6'; break;\n\tcase 'Q':\n\t\tch = '7'; break;\n\tcase 'K':\n\t\tch = '8'; break;\n\tcase 'A':\n\t\tch = '9'; break;\n\t}\n\treturn ch;\n}\n\nint main()\n{\n\tint n;\n\tchar suit;\n\n\twhile (~scanf(\"%c\", &suit))\n\t{\n\t\tgetchar();\n\t\tint flag = 0;\n\t\tchar ch1[4], ch2[4];\n\t\tscanf(\"%s %s\", ch1, ch2);\n\t\tgetchar();\n\t\tch1[0] = choose(ch1[0]);\n\t\tch2[0] = choose(ch2[0]);\n\n\t\tif (ch1[1] == ch2[1])\n\t\t{\n\t\t\tif (ch1[0] > ch2[0])\n\t\t\t\tflag = 1;\n\t\t}\n\t\telse if (ch1[1] == suit)\n\t\t\t\tflag = 1;\n\n\n\t\tif (flag)\n\t\t\tputs(\"YES\");\n\t\telse\n\t\t\tputs(\"NO\");\n\t}\n\n\treturn 0;\n}\n \t \t\t \t \t\t \t \t \t"}, {"source_code": "#include <stdio.h>\n\nint value_converter(char temp) {\n if(temp=='6') {\n return 6;\n } else if(temp=='7') {\n return 7;\n } else if(temp=='8') {\n return 8;\n } else if(temp=='9') {\n return 9;\n } else if(temp=='T') {\n return 10;\n } else if(temp=='J') {\n return 11;\n } else if(temp=='Q') {\n return 12;\n } else if(temp=='K') {\n return 13;\n } else if(temp=='A') {\n return 14;\n }\n else if(temp=='S') {\n return 15;\n }\n else if(temp=='H') {\n return 16;\n }\n else if(temp=='D') {\n return 17;\n }\n else if(temp=='C') {\n return 18;\n }\n\n\n}\n\n\nint main() {\n\n char trump, p1, p2 , p3, p4;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &p1,&p2,&p3,&p4);\n\n // printf(\"%c %c %c %c\\n\",p1,p2,p3,p4);\n int integer_value_of_p11 = value_converter(p1);\n int integer_value_of_p21 = value_converter(p3);\n\n if( p2==p4 ){\n if( integer_value_of_p11 > integer_value_of_p21 ){\n printf(\"YES\");\n }\n else{\n printf(\"NO\\n\");\n }\n }\n else if(p2==trump) {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint num(char ch){\n if (ch >= '6' && ch <= '9'){\n return ch - '0';\n }\n if (ch == 'J'){\n return 11;\n }\n if (ch == 'T'){\n return 10;\n }\n if (ch == 'K'){\n return 13;\n }\n if (ch == 'Q'){\n return 12;\n }\n return 14;\n}\n\n\nint main(void)\n{\n int a1, a2;\n char koz, c1, c2, ch;\n scanf(\"%c\\n\", &koz);\n scanf(\"%c%c\", &ch, &c1);\n a1 = num(ch);\n scanf(\"%c\", &ch);\n scanf(\"%c%c\", &ch, &c2);\n a2 = num(ch);\n if ((c1 == c2 && a2 < a1) || (c1 == koz && c2 != koz)){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main() {\n char trump, a[8], b[8];\n const char rank[] = \"6789TJQKA\";\n\n\n scanf(\"%c%s%s\", &trump, a, b);\n puts((a[1] == b[1] && strchr(rank, a[0]) > strchr(rank, b[0])) || (a[1] == trump && b[1] != trump) ? \"YES\" : \"NO\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint dec(char c){\n\tswitch(c){\n\tcase '6': return 6;\n\tcase '7': return 7;\n\tcase '8': return 8;\n\tcase '9': return 9;\n\tcase 'T': return 10;\n\tcase 'J': return 11;\n\tcase 'Q': return 12;\n\tcase 'K': return 13;\n\tcase 'A': return 15;\n\t}\n}\n\nint istrump(char trump,char this){\n\tif(trump==this)return 1;\n\telse return 0;\n}\n\nint main(void)\n{\n char a,b,c,d,e;\n int scorea,scoreb;\n int win;\n scanf(\" %c\",&a);\n //fflush(stdin);\n scanf(\" %c%c %c%c\",&b,&c,&d,&e);\n if(istrump(a,c)){\n if(istrump(a,e)){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else win=1;\n }\n else{\n if(c==e){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else if(istrump(a,e)){\n win=0;\n }\n else win=0;\n }\n \n if(win)puts(\"YES\");\n else puts(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint number(char a){\n if(a>='6' && a<='9'){\n return a-'6';\n }else if(a=='T'){\n return 4;\n }else if(a=='J'){\n return 5;\n }else if(a=='Q'){\n return 6;\n }else if(a=='K'){\n return 7;\n }else if(a=='A'){\n return 8;\n }else{\n return -1;\n }\n}\nint main() {\n char suit[2];\n char card1[3];\n char card2[3];\n scanf(\"%s\",suit);\n scanf(\"%s%s\",card1,card2);\n int is_beat=0;\n if(card1[1]==suit[0] && card2[1]!=suit[0]){\n is_beat=1;\n }else if(card1[1]==card2[1]){\n if(number(card1[0])>number(card2[0])){\n is_beat=1;\n }\n }\n if(is_beat) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint number(char a){\n if(a>='6' && a<='9'){\n return a-'6';\n }else if(a=='T'){\n return 4;\n }else if(a=='J'){\n return 5;\n }else if(a=='Q'){\n return 6;\n }else if(a=='K'){\n return 7;\n }else if(a=='A'){\n return 8;\n }else{\n return -1;\n }\n}\nint main() {\n char suit[2];\n char card1[3];\n char card2[3];\n scanf(\"%s\",suit);\n scanf(\"%s%s\",card1,card2);\n int is_beat=0;\n if(card1[1]==suit[0] && card2[1]!=suit[0]){\n is_beat=1;\n }else if(card1[1]==card2[1]){\n if(number(card1[0])>number(card2[0])){\n is_beat=1;\n }\n }\n if(is_beat) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a,b,c[100],d[100];\n\tscanf(\"%c\",&a);\n\tscanf(\"%s%s\",c,d);\n\tif(c[0]=='T' )\n\t{\n\t\tc[0]='a';\n\t\n\t}\n\tif(d[0]=='T' )\n\t{\n\t\td[0]='a';\n\t\n\t}\n\tif(c[0]=='J' )\n\t{\n\t\tc[0]='b';\n\t\n\t}\n\tif(d[0]=='J' )\n\t{\n\t\td[0]='b';\n\t\n\t}\n\tif(c[0]=='Q' )\n\t{\n\t\tc[0]='c';\n\t\n\t}\n\tif(d[0]=='Q' )\n\t{\n\t\td[0]='c';\n\t\n\t}\n\tif(c[0]=='K' )\n\t{\n\t\tc[0]='d';\n\t\n\t}\n\tif(d[0]=='K' )\n\t{\n\t\td[0]='d';\n\t\n\t}\n\tif(c[0]=='A' )\n\t{\n\t\tc[0]='e';\n\t\n\t}\n\tif(d[0]=='A' )\n\t{\n\t\td[0]='e';\n\t\n\t}\n\tif(c[1] == a)\n\t{\n\t\tif(d[1]!=a || c[0]>d[0])\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\telse if(c[1] == d[1])\n\t{\n\t\tif(c[0] > d[0])\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char suit,a1,a2,b1,b2,a[10];\n scanf(\"%c\",&suit);\n getchar();\n gets(a);\n a1=a[0];\n b1=a[1];\n a2=a[3];\n b2=a[4];\n if(b1==b2)\n {\n if(a1=='6')\n a1=1;\n else if(a1=='7')\n a1=2;\n else if(a1=='8')\n a1=3;\n else if(a1=='9')\n a1=4;\n else if(a1=='T')\n a1=5;\n else if(a1=='J')\n a1=6;\n else if(a1=='Q')\n a1=7;\n else if(a1=='K')\n a1=8;\n else if(a1=='A')\n a1=9;\n if(a2=='6')\n a2=1;\n else if(a2=='7')\n a2=2;\n else if(a2=='8')\n a2=3;\n else if(a2=='9')\n a2=4;\n else if(a2=='T')\n a2=5;\n else if(a2=='J')\n a2=6;\n else if(a2=='Q')\n a2=7;\n else if(a2=='K')\n a2=8;\n else if(a2=='A')\n a2=9;\n // printf(\"%d %d\\n\",a1,a2);\n if(a1>a2)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n if(suit==b1)\n {\n printf(\"YES\");\n return 0;\n }\n printf(\"NO\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a,b,c[100],d[100];\n\tscanf(\"%c\",&a);\n\tscanf(\"%s%s\",c,d);\n\tif(c[0]=='T' )\n\t{\n\t\tc[0]='a';\n\t\n\t}\n\tif(d[0]=='T' )\n\t{\n\t\td[0]='a';\n\t\n\t}\n\tif(c[0]=='J' )\n\t{\n\t\tc[0]='b';\n\t\n\t}\n\tif(d[0]=='J' )\n\t{\n\t\td[0]='b';\n\t\n\t}\n\tif(c[0]=='Q' )\n\t{\n\t\tc[0]='c';\n\t\n\t}\n\tif(d[0]=='Q' )\n\t{\n\t\td[0]='c';\n\t\n\t}\n\tif(c[0]=='K' )\n\t{\n\t\tc[0]='d';\n\t\n\t}\n\tif(d[0]=='K' )\n\t{\n\t\td[0]='d';\n\t\n\t}\n\tif(c[0]=='A' )\n\t{\n\t\tc[0]='e';\n\t\n\t}\n\tif(d[0]=='A' )\n\t{\n\t\td[0]='e';\n\t\n\t}\n\tif(c[1] == a)\n\t{\n\t\tif(d[1]!=a || c[0]>d[0])\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\telse if(c[1] == d[1])\n\t{\n\t\tif(c[0] > d[0])\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tchar a, b, c, d, e, f, g;\n\tchar ZA[] = {'6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};\n\n\tscanf(\"%c\\n%c%c %c%c\", &a, &b, &c, &d, &e);\n\tif (c != e && c == a)\n\t\tprintf(\"YES\\n\");\n\telse if (c == e) {\n\t\tfor (f = 0; f < 10; ++f)\n\t\t\tif (ZA[f] == b)\n\t\t\t\tbreak;\n\t\tfor (g = 0; g < 10; ++g)\n\t\t\tif (ZA[g] == d)\n\t\t\t\tbreak;\n\t\tif (f > g)\n\t\t\tprintf(\"YES\\n\");\n\t\telse\n\t\t\tprintf(\"NO\\n\");\n\t} else\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char trump,s[3],s1[3];\n int t1,t2;\n scanf(\"%c%s%s\",&trump,s,s1);\n if(s[0]=='T')\n t1=11;\n else if(s[0]=='J')\n t1=12;\n else if(s[0]=='Q')\n t1=13;\n else if(s[0]=='K')\n t1=14;\n else if(s[0]=='A')\n t1=15;\n else if(s[0]=='6')\n t1=6;\n else if(s[0]=='7')\n t1=7;\n else if(s[0]=='8')\n t1=8;\n else if(s[0]=='9')\n t1=9;\n if(s1[0]=='T')\n t2=11;\n else if(s1[0]=='J')\n t2=12;\n else if(s1[0]=='Q')\n t2=13;\n else if(s1[0]=='K')\n t2=14;\n else if(s1[0]=='A')\n t2=15;\n else if(s1[0]=='6')\n t2=6;\n else if(s1[0]=='7')\n t2=7;\n else if(s1[0]=='8')\n t2=8;\n else if(s1[0]=='9')\n t2=9;\n\n\n if(s[1]==trump&&s1[1]!=trump)\n {\n printf(\"YES\");\n }\n else if(s[1]!=trump&&s1[1]==trump)\n {\n printf(\"NO\");\n }\n else if(s[1]!=trump&&s1[1]!=trump)\n {\n if(s[1]!=s1[1])\n {\n printf(\"NO\");\n }\n else\n {\n if(t1<=t2)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n\n\n }\n else if(s[1]==trump&&s1[1]==trump)\n {\n if(t1<=t2)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nchar rank[9]={'6','7','8','9','T','J','Q','K','A'};\n\nint gana(int trump,char first[2],char second[2]);\nint indice(char C);\nint main()\n{\n char trump;\n scanf(\"%c\",&trump);\n getchar();\n char first[2];\n char second[2];\n int i;\n for(i=0;i<2;i++){scanf(\"%c\",&first[i]);}getchar();\n for(i=0;i<2;i++){scanf(\"%c\",&second[i]);}getchar();\n\n if(gana(trump,first,second)){\n printf(\"YES\");\n } else {\n printf(\"NO\");\n }\n\n\n return 0;\n}\n\nint indice(char C){\nint i=0;\nwhile(rank[i]!=C){i++;}\nreturn i;\n}\n\nint gana(int trump,char first[2],char second[2]){\n\nif((first[1]==trump)&&(second[1]!=trump) ) return 1;\nif((first[1]!=trump)&&(second[1]==trump) ) return 0;\nif((first[1]==second[1]) && (indice(first[0])>indice(second[0]))) return 1;\n\nreturn 0;\n}\n"}], "negative_code": [{"source_code": "// Code Forces 106A\n#include<stdio.h>\n#define T 10\n#define J 11\n#define Q 12\n#define K 13 \n#define A 14\nint main()\n{\n char trump,C0,C1,B0,B1;\n scanf(\"%c\\n%c%c\\n%c%c\",&trump,&C0,&C1,&B0,&B1);\n //printf(\"after scan:%c%c%c%c%c\\n\",trump,C0,C1,B0,B1);\n if((C1==trump)&&(B1!=trump)) {printf(\"YES\\n\");return 0;}\n if((C1!=trump)&&(B1==trump)) {printf(\"NO\\n\");return 0;}\n if(C0>B0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint i,j,a,b;\nchar str[2][2],str1[10];\nscanf(\"%s\",str[0]);\nscanf(\"%s\",str[1]);\nscanf(\"%s\",str[2]);\n//printf(\"%c\",str[0][1]);\nstr1[0]='5';\nstr1[1]='6';\nstr1[2]='7';\nstr1[3]='8';\nstr1[4]='9';\nstr1[5]='T';\nstr1[6]='J';\nstr1[7]='Q';\nstr1[8]='K';\nstr1[9]='\\0';\nif(str[1][1]==str[0][0])\n printf(\"YES\");\nelse if(str[2][1]==str[0][0])\n printf(\"NO\");\nelse{\n if(str[1][1]!=str[2][1])\n printf(\"NO\");\n else if(str[1][1]==str[2][1]){\n for(j=0;j<=8;j++){\n if(str[1][0]==str1[j])\n a=j;\n if(str[2][0]==str1[j])\n b=j;\n }\n if(a>b)\n printf(\"YES\");\n else if(a<b)\n printf(\"NO\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint cardrank(char rankx)\n{int i;\n\tchar rank[]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};\n\tfor(i=0;rank[i]!='\\0';i++)\n\t{\n\t\tif(rankx==rank[i])return i;\t\n\t}\n\treturn -1;\n}\nint main()\n{\n\tchar trump,suit1,rank1,suit2,rank2;int r1,r2,i;\n\t\n\tscanf(\"%c %c %c %c %c\",&trump,&rank1,&suit1,&rank2,&suit2);\n\tr1=cardrank(rank1);r2=cardrank(r2);\n\tif(suit1==trump){printf(\"YES\");return 0;}\n\telse if(suit1==suit2){\n\t\tif(r1>r2){printf(\"YES\");return 0;}\n\t\telse if(r2>r2){printf(\"NO\");return 0;}\n\t}\n\t\nprintf(\"NO\");\t\nreturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:10 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,w,g,h;\n char c[2];\n char str[100];\n char ch[11]={'6','7','8','9','T','J','K','Q','A'};\n scanf(\"%s\\n\",c);\n\n gets(str);\n\n //printf(\"%c\",c[0]);\n if (str[1]==c[0] && str[4]==c[0]){\n if(str[0]>str[3]){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else if(str[1]==c[0]){\n printf(\"YES\");\n }\n else if (str[4]==c[0]){\n printf(\"NO\");\n }\n else{\n for (i=0;i<9;i++){\n if(ch[i]==str[1]){\n g=i+1;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[4]){\n h=i+1;\n }\n }\n\n if (str[1]==str[4]){\n if (g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n int value_converter(char temp){\n if(temp=='6'){\n return 6;\n }\n else if(temp=='7'){\n return 7;\n }\n else if(temp=='8'){\n return 8;\n }\n else if(temp=='9'){\n return 9;\n }\n else if(temp=='T'){\n return 10;\n }\n else if(temp=='J'){\n return 11;\n }\n else if(temp=='Q'){\n return 12;\n }\n else if(temp=='K'){\n return 13;\n }\n else if(temp=='A'){\n return 14;\n }\n}\n\n\n int main()\n {\n\n char trump, p1, p2 , p3, p4;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &p1,&p2,&p3,&p4);\n\n int integer_value_of_p11 = value_converter(p1);\n int integer_value_of_p21 = value_converter(p3);\n if(trump==p2 && trump==p4 && integer_value_of_p11 > integer_value_of_p21) {\n printf(\"YES\");\n }\n else if(trump==p2 && trump==p4 && integer_value_of_p11 < integer_value_of_p21) {\n printf(\"NO\");\n }\n else if(trump==p2) {\n printf(\"YES\");\n }\n else if(trump==p4) {\n printf(\"NO\");\n }\n else if( integer_value_of_p11 > integer_value_of_p21 ) {\n printf(\"YES\");\n } else if( integer_value_of_p11 < integer_value_of_p21 ) {\n printf(\"NO\");\n }\n else if(integer_value_of_p11 == integer_value_of_p21){\n printf(\"NO\");\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c,d;\n char str1[3],str2[3],ch;\n scanf(\"%c\",&ch);\n scanf(\"%s%s\",str1,str2);\n if(str1[0]==ch||str1[1]==ch){\n printf(\"YES\\n\");\n return 0;\n }\n else if(str2[0]==ch||str2[1]==ch){\n printf(\"NO\\n\");\n return 0;\n }\n\n if(str1[0]=='T'){\n a=10;\n }\n else if(str1[0]=='J'){\n a=11;\n }\n else if(str1[0]=='Q'){\n a=12;\n }\n else if(str1[0]=='K'){\n a=13;\n }\n else if(str1[0]=='A'){\n a=14;\n }\n else if(str1[0]=='6'){\n a=6;\n }\n else if(str1[0]=='7'){\n a=7;\n }\n else if(str1[0]=='8'){\n a=8;\n }\n else if(str1[0]=='9'){\n a=9;\n }\n\n if(str1[1]=='T'){\n b=10;\n }\n else if(str1[1]=='J'){\n b=11;\n }\n else if(str1[1]=='Q'){\n b=12;\n }\n else if(str1[1]=='K'){\n b=13;\n }\n else if(str1[1]=='A'){\n b=14;\n }\n else if(str1[1]=='6'){\n b=6;\n }\n else if(str1[1]=='7'){\n b=7;\n }\n else if(str1[1]=='8'){\n b=8;\n }\n else if(str1[1]=='9'){\n b=9;\n }\n\n if(str2[0]=='T'){\n c=10;\n }\n else if(str2[0]=='J'){\n c=11;\n }\n else if(str2[0]=='Q'){\n c=12;\n }\n else if(str2[0]=='K'){\n c=13;\n }\n else if(str2[0]=='A'){\n c=14;\n }\n else if(str2[0]=='6'){\n c=6;\n }\n else if(str2[0]=='7'){\n c=7;\n }\n else if(str2[0]=='8'){\n c=8;\n }\n else if(str2[0]=='9'){\n c=9;\n }\n\n if(str2[1]=='T'){\n d=10;\n }\n else if(str2[1]=='J'){\n d=11;\n }\n else if(str2[1]=='Q'){\n d=12;\n }\n else if(str2[1]=='K'){\n d=13;\n }\n else if(str2[1]=='A'){\n d=14;\n }\n else if(str2[1]=='6'){\n d=6;\n }\n else if(str2[1]=='7'){\n d=7;\n }\n else if(str2[1]=='8'){\n d=8;\n }\n else if(str2[1]=='9'){\n d=9;\n }\n\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n if(a==c){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint power(char,char,char);\nint main()\n{\n char trump,rank1,rank2,suit1,suit2;\n int power1=0,power2=0;\n \n scanf(\" %c\",&trump);\n scanf(\" %c%c %c%c\",&rank1,&suit1,&rank2,&suit2);\n power1=power(trump,rank1,suit1);\n power2=power(trump,rank2,suit2);\n /*printf(\"%d %d\",power1,power2);*/\n if(power1>power2)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n /*printf(\"%c %c %c %c %c\",trump,rank1,suit1,rank2,suit2);*/\n /*system(\"pause\");*/\n return 0;\n}\nint power(char trump,char rank,char suit)\n{\n int power;\n \n switch(rank)\n {\n case '6':\n power=6;\n break;\n case '7':\n power=7;\n break;\n case '8':\n power=8;\n break;\n case '9':\n power=9;\n break;\n case 'T':\n case 't':\n power=10;\n break;\n case 'J':\n case 'j':\n power=11;\n break;\n case 'Q':\n case 'q':\n power=12;\n break;\n case 'K':\n case 'k':\n power=13;\n break;\n case 'A':\n case 'a':\n power=14;\n break;\n }\n if(suit == trump || suit == trump+32 || suit == trump-32)\n power+=10;\n \n return power;\n}\n/****** PCCA -Tue Oct 18 12:49:02 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint cardrank(char rankx)\n{int i;\n\tchar rank[]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};\n\tfor(i=0;rank[i]!='\\0';i++)\n\t{\n\t\tif(rankx==rank[i])return i;\t\n\t}\n\treturn -1;\n}\nint main()\n{\n\tchar trump,suit1,rank1,suit2,rank2;int r1,r2,i;\n\t\n\tscanf(\"%c %c %c %c %c\",&trump,&rank1,&suit1,&rank2,&suit2);\n\tr1=cardrank(rank1);r2=cardrank(r2);\n\tif(suit1==trump){printf(\"YES\");return 0;}\n\telse if(suit1==suit2){\n\t\tif(r1>r2){printf(\"YES\");return 0;}\n\t\telse if(r2>r2){printf(\"NO\");return 0;}\n\t}\n\t\nprintf(\"NO\");\t\nreturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar Base[9]=\"6789TJQKA\";\nchar A[3],B[3];\nchar T;\n\nint Judge()\n{\n int i,j;\n for(i=0; Base[i]!=A[0]; ++i);\n for(j=0; Base[j]!=B[0]; ++j);\n if(A[1]==B[1]&&i>j)\n {\n return 1;\n }\n return 0;\n}\n\nint main()\n{\n scanf(\"%c %s %s\",&T,A,B);\n if(A[1]==T||Judge ())\n {\n puts(\"YES\");\n return 0;\n }\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h> \n\nint main(){ \nchar trump,a[2],b[2];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[0]=='T')a[0]='A';\nif(b[0]=='T')b[0]='A';\nif(a[0]=='J')a[0]='B';\nif(b[0]=='J')b[0]='B';\nif(a[0]=='Q')a[0]='C';\nif(b[0]=='Q')b[0]='C';\nif(b[0]=='K')b[0]='D';\nif(b[0]=='K')b[0]='D';\nif(b[0]=='A')b[0]='E';\nif(b[0]=='A')b[0]='E';\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=trump&&b[1]==trump)printf(\"NO\");\nelse {\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n\t\t\t\t \t\t\t \t\t \t\t \t \t \t\t \t\t"}, {"source_code": "#include <stdio.h> \nint main(){ \nchar trump,a[2],b[2];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=trump&&b[1]==trump)printf(\"NO\");\nelse {\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n \t \t\t \t \t \t \t\t\t \t \t\t \t\t \t"}, {"source_code": "#include <stdio.h>\nint main() \n{\n char t[2],c1[3],c2[3];\n int i,a,b;\n \n char su[]={'S','H','D','C','\\0'};\n char r[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n \n scanf(\"%s\",t);\n scanf(\"%s\",c1);\n scanf(\"%s\",c2);\n \n if((c1[1]==t[0]))\n {\n printf(\"YES\");\n }\n \n if((c1[1]!=c2[1])&&(c1[1]!=t[0]&&c2[1]!=t[0]))\n {\n printf(\"NO\");\n }\n else if((c1[1]==c2[1])&&(c1[1]!=t[0]&&c2[1]!=t[0]))\n {\n for(i=0;i<10;i++)\n {\n if(r[i]==c1[0])\n {\n a=i+1;\n }\n if(r[i]==c2[0])\n {\n b=i+1;\n }\n }\n if(a>b)\n {\n printf(\"YES\");\n }\n else if(a<b)\n {\n printf(\"NO\");\n }\n else if(a==b)\n {\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c,s1[10],s2[10];\n char s3[9]={'6','7','8','9','T','J','Q','K','A'};\n int i,k1,k2;\n while(scanf(\"%c\",&c)!=EOF)\n {\n getchar();\n scanf(\"%s%s\",s1,s2);\n if(s1[1]==c&&s2[1]!=c)\n {\n printf(\"YES\\n\");\n }\n else\n if(s1[1]!=c&&s2[1]==c)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(i=0;i<9;i++)\n {\n if(s3[i]==s1[0])\n k1=i;\n if(s3[i]==s2[0])\n k2=i;\n }\n if(k1>k2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint tranfCartaParaOrdemDeCarta(char c) {\n\tswitch (c) {\n\t\tcase 'T': return 1;\n\t\tcase 'J': return 2;\n\t\tcase 'Q': return 3;\n\t\tcase 'K': return 4;\n\t\tcase 'A': return 5;\n\t\tdefault:\n\t\t\treturn EOF;\n\t}\n}\n\nvoid cardGame() {\n\tchar c, s[2][2];\n\n\tscanf(\"%c\", &c);\n\tscanf(\"%s %s\", s[0], s[1]);\n\t\n\tif (s[0][1] == s[1][1]) {\n\t\tif (tranfCartaParaOrdemDeCarta(s[0][0]) > tranfCartaParaOrdemDeCarta(s[1][0]))\n\t\t\tprintf(\"YES\\n\");\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if (s[0][1] == c)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\nint main() {\n\t\n\tcardGame();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[]={6,7,8,9,10,11,12,13,14};\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n\n\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 05:51:28 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:19 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n char c,a[3],b[3];\n char p[9][1]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K' , 'A'};\n scanf(\"%c\",&c);\n scanf(\"%s %s\",&a,&b);\n if(a[1]==c && b[1]!=c)\n printf(\"YES\");\n else\n {\n int x=0,y=0;\n for(int i=0;i<9;i++)\n {\n if(a[0]==p[i][0])\n x=i;\n else if(b[0]==p[i][0])\n y=i;\n }\n if(x>=y)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s,arr1[3],arr2[3],str[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n int i,j,k,l;\n scanf(\"%c\",&s);\n scanf(\"%s%s\",&arr1,&arr2);\n if(s==arr1[1]&&s==arr2[1])\n {\n for(i=0;i<10;i++)\n {\n if(arr1[0]==str[i])\n break;\n }\n for(j=0;j<10;j++)\n {\n if(arr2[0]==str[j])\n break;\n }\n if(i>j)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n if(s==arr1[1]&&s!=arr2[1])\n {\n printf(\"YES\");\n }\n if(s!=arr1[1]&&s==arr2[1])\n {\n printf(\"NO\");\n }\n if(s!=arr1[1]&&s!=arr2[1])\n {\n printf(\"NO\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n6 7 8 9 T J Q K A\nS H D C\n*/\n\n/* Devolve o valor da carta em numero inteiro */\nint cardValue(char card) {\n\tif(card == '6') return 6;\n\tif(card == '7') return 7;\n\tif(card == '8') return 8;\n\tif(card == '9') return 9;\n\tif(card == 'T') return 10;\n\tif(card == 'J') return 11;\n\tif(card == 'Q') return 12;\n\tif(card == 'K') return 13;\n\tif(card == 'A') return 14;\n\treturn -1;\n}\n\n/* Devolve 1 se a primeira carta for maior\n\t\t\t0 se for igual cc\n*/\nint isHigher(char first, char second) {\n\tif(cardValue(first) > cardValue(second)) return 1;\n\telse return 0;\n\treturn -1;\n}\n\nint main() {\n\tchar trump;\n\tchar *firstCard;\n\tchar *secondCard;\n\tfirstCard = malloc(2*sizeof(char));\n\tsecondCard = malloc(2*sizeof(char));\n\tscanf(\"%c %s %s\", &trump, firstCard, secondCard);\n\tif(trump == firstCard[1]) {\n\t\tprintf(\"YES\");\n\t}\n\telse if(firstCard[1] == secondCard[1] && \n\t\t\tisHigher(firstCard[0], secondCard[0])) {\n\t\tprintf(\"YES\");\t\t\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint tranfCartaParaOrdemDeCarta(char c) {\n\tswitch (c) {\n\t\tcase 'T': return 1;\n\t\tcase 'J': return 2;\n\t\tcase 'Q': return 3;\n\t\tcase 'K': return 4;\n\t\tcase 'A': return 5;\n\t\tdefault:\n\t\t\treturn c;\n\t}\n}\n\nvoid cardGame() {\n\tchar c, s[2][2];\n\n\tscanf(\"%c\", &c);\n\tscanf(\"%s %s\", s[0], s[1]);\n\t\n\tif (s[0][1] == s[1][1]) {\n\t\tif (tranfCartaParaOrdemDeCarta(s[0][0]) > tranfCartaParaOrdemDeCarta(s[1][0]))\n\t\t\tprintf(\"YES\\n\");\n\t\telse \n\t\t\tprintf(\"NO\\n\");\n\t}\n\telse if (s[0][1] == c)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\nint main() {\n\t\n\tcardGame();\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c,s1[10],s2[10];\n char s3[9]={'6','7','8','9','T','J','Q','K','A'};\n int i,k1,k2;\n while(scanf(\"%c\\n\",&c)!=EOF)\n {\n //getchar();\n scanf(\"%s%s\",s1,s2);\n if(s1[1]==c&&s2[1]!=c)\n {\n printf(\"YES\\n\");\n }\n else\n if(s1[1]!=c&&s2[1]==c)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(i=0;i<9;i++)\n {\n if(s3[i]==s1[0])\n k1=i;\n if(s3[i]==s2[0])\n k2=i;\n }\n if(k1>k2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h> \nint main(){ \nchar trump,a[2],b[2];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=trump&&b[1]==trump)printf(\"NO\");\nelse {\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n \t\t \t \t\t \t \t\t \t \t \t \t"}, {"source_code": "#include <stdio.h>\n\nint dec(char c){\n\tswitch(c){\n\tcase '6': return 6;\n\tcase '7': return 7;\n\tcase '8': return 8;\n\tcase '9': return 9;\n\tcase 'T': return 10;\n\tcase 'J': return 11;\n\tcase 'Q': return 12;\n\tcase 'K': return 13;\n\tcase 'A': return 15;\n\t}\n}\n\nint istrump(char trump,char this){\n\tif(trump==this)return 1;\n\telse return 0;\n}\n\nint main(void)\n{\n char a,b,c,d,e;\n int scorea,scoreb;\n int win;\n scanf(\" %c\",&a);\n fflush(stdin);\n scanf(\"%c%c %c%c\",&b,&c,&d,&e);\n if(istrump(a,c)){\n if(istrump(a,e)){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else win=1;\n }\n else{\n if(c==e){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else if(istrump(a,e)){\n win=0;\n }\n else win=0;\n }\n \n if(win)puts(\"YES\");\n else puts(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n\tchar a, b, c, d, e;\n\ta = getchar();\n\tgetchar();\n\tb = getchar();\n\tc = getchar();\n\tgetchar();\n\td = getchar();\n\te = getchar();\n\tif (c == a)\n\t\tprintf(\"YES\\n\");\n\telse if (c == e)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n \t\t \t\t \t\t \t\t\t \t \t \t\t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{char str[2][3]={'\\0'},ch;int i,m[2]={0};\n\nscanf(\"%c\",&ch);\nfor(i=0;i<2;i++)\n{scanf(\"%s\",str[i]);\nswitch(str[i][0])\n{case '6':m[i]=6;break;\ncase '7':m[i]=7;break;\ncase '8':m[i]=8;break;\ncase '9':m[i]=9;break;\ncase 'T':m[i]=10;break;\ncase 'J':m[i]=11;break;\ncase 'Q':m[i]=12;break;\ncase 'K':m[i]=13;break;\ncase 'A':m[i]=14;break;}}\nif(str[0][1]==ch)\n{if(str[1][1]==ch)\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}\nelse\nprintf(\"YES\");\n}\nelse\n{if(str[1][1]==ch)\nprintf(\"NO\");\nelse\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:41:33 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump[]=\"SHDC\";\n int num[]={6,7,8,9,10,11,12,13,14};\n char trump_in;\n char compare_1[2];\n char compare_2[2];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n for(i=0;i<4;i++)\n {\n if(trump[i]==compare_1[2] && trump[i]==compare_2[2])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Thu Dec 08 14:21:56 GMT 2011 *******/"}, {"source_code": "// Code Forces 106A\n#include<stdio.h>\n#define T 10\n#define J 11\n#define Q 12\n#define K 13 \n#define A 14\nint main()\n{\n char trump;\n char Arr[2]={'0'};\n char Brr[2]={'0'};\n scanf(\"%c%c%c%c%c\",&trump,&Arr[0],&Arr[1],&Brr[0],&Brr[1]);\n if((Arr[1]==trump)&&(Brr[1]!=trump)) {printf(\"YES\\n\");return 0;}\n if((Arr[1]!=trump)&&(Brr[1]==trump)) {printf(\"NO\\n\");return 0;}\n if(Arr[0]>Brr[0]) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int num[]={6,7,8,9,10,11,12,13,14};\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n\n\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 05:51:44 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:41:24 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:30 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char a,b,c,d,e;\n scanf(\"%c\",&e);\n int j,k,l;\n scanf(\"%c%c %c%c\",&a,&b,&c,&d);\n char ch[9]={'6','7','8','9','T','J','Q','K','A'};\n if(b!=e || d!=e)\n {\n for(int i=0;i<9;i++)\n {\n if(ch[i]==a)\n j=i;\n if(ch[i]==c)\n k=i;\n \n }\n if(j>k)\n printf(\"YES\");\n else \n printf(\"NO\");\n }\n else if(b!=d &&( b==e || d==e))\n printf(\"YES\");\n else \n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nint power(char,char,char);\nint main()\n{\n char trump,rank1,rank2,suit1,suit2;\n int power1=0,power2=0;\n \n scanf(\" %c\",&trump);\n scanf(\" %c%c %c%c\",&rank1,&suit1,&rank2,&suit2);\n power1=power(trump,rank1,suit1);\n power2=power(trump,rank2,suit2);\n /*printf(\"%d %d\",power1,power2);*/\n if(power1>power2)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n /*printf(\"%c %c %c %c %c\",trump,rank1,suit1,rank2,suit2);*/\n return 0;\n}\nint power(char trump,char rank,char suit)\n{\n int power;\n \n switch(rank)\n {\n case '6':\n power=6;\n break;\n case '7':\n power=7;\n break;\n case '8':\n power=8;\n break;\n case '9':\n power=9;\n break;\n case 'T':\n power=10;\n break;\n case 'J':\n power=11;\n break;\n case 'Q':\n power=12;\n break;\n case 'K':\n power=13;\n break;\n case 'A':\n power=14;\n break;\n }\n if(suit==trump)\n power+=10;\n \n return power;\n}\n/****** PCCA -Tue Oct 18 12:37:27 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:30 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 08:57:33 GMT 2011 *******/"}, {"source_code": "// Code Forces 106A\n#include<stdio.h>\nint main()\n{char trump,C0,C1,B0,B1;int camp1,camp2;\n scanf(\"%c\\n%c%c\\n%c%c\",&trump,&C0,&C1,&B0,&B1);camp1=C0,camp2=B0;\n if((C1==trump)&&(B1!=trump)) {printf(\"YES\\n\");return 0;}\n if((C1!=trump)&&(B1==trump)) {printf(\"NO\\n\");return 0;}\n if(C0=='T') camp1='a';if(C0=='J') camp1='b';if(C0=='Q') camp1='c';if(C0=='K') camp1='d';if(C0=='A') camp1='e';\n if(B0=='T') camp2='a';if(B0=='J') camp2='b';if(B0=='Q') camp2='c';if(B0=='K') camp2='d';if(B0=='A') camp2='e';\n if(camp1>camp2)printf(\"YES\\n\");else printf(\"NO\\n\");\n return 0;}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,w,g,h;\n char c[2];\n char str[100];\n char ch[11]={'6','7','8','9','T','J','K','Q','A'};\n scanf(\"%s\\n\",c);\n\n gets(str);\n\n //printf(\"%c\",ch[0]);\n if (str[1]==c[0] && str[4]==c[0]){\n if(str[0]>str[3]){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else if(str[1]==c[0]){\n printf(\"YES\");\n }\n else if (str[4]==c[0]){\n printf(\"NO\");\n }\n else{\n for (i=0;i<9;i++){\n if(ch[i]==str[0]){\n g=i+1;\n \n break;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[3]){\n h=i+1;\n break;\n }\n }\n\n if (str[1]==str[4]){\n if (g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar strSuit;\n\tchar strCard1[3], strCard2[3];\n\tscanf(\"%c\",&strSuit);\n\tscanf(\"%s %s\",strCard1, strCard2);\n\tif(strCard1[1]==strSuit||strCard1[1]==strCard2[1])\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\n\treturn 0;\n}\n\t\t\t\t \t\t\t\t \t \t \t\t \t \t \t \t"}, {"source_code": "#include <ctype.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nchar t, v1, s1, v2, s2;\n\nint v(char v1) {\n\treturn \n\t\tisdigit(v1) ? v1 : '9'+\n\t\t\tv1 == 'T' ? 1 :\n\t\t\tv1 == 'J' ? 2 :\n\t\t\tv1 == 'Q' ? 3 :\n\t\t\tv1 == 'K' ? 4 :\n\t\t\tv1 == 'A' ? 5 :\n\t\t\t-'9';\n}\n\nint main(void) {\n\tscanf(\"%c\\n%c%c %c%c\", &t, &v1, &s1, &v2, &s2);\n\tprintf(\"%s\\n\", s1==s2&&v(v1)>v(v2) || s1==t&&s2!=t?\"YES\":\"NO\");\n\texit(EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h> \n\nint main(){ \nchar trump,a[2],b[2];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[0]=='T')a[0]='A';\nif(b[0]=='T')b[0]='A';\nif(a[0]=='J')a[0]='B';\nif(b[0]=='J')b[0]='B';\nif(a[0]=='Q')a[0]='C';\nif(b[0]=='Q')b[0]='C';\nif(a[0]=='K')a[0]='D';\nif(b[0]=='K')b[0]='D';\nif(a[0]=='A')a[0]='E';\nif(b[0]=='A')b[0]='E';\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=trump&&b[1]==trump)printf(\"NO\");\nelse {\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n \t \t \t \t \t\t \t\t \t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:41:04 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n6 7 8 9 T J Q K A\nS H D C\n*/\n\n/* Devolve o valor da carta em numero inteiro */\nint cardValue(char card) {\n\tif(card == '6') return 6;\n\tif(card == '7') return 7;\n\tif(card == '8') return 8;\n\tif(card == '9') return 9;\n\tif(card == 'T') return 10;\n\tif(card == 'J') return 11;\n\tif(card == 'Q') return 12;\n\tif(card == 'K') return 13;\n\tif(card == 'A') return 14;\n\treturn -1;\n}\n\n/* Devolve 1 se a primeira carta for maior\n\t\t\t0 se for igual cc\n*/\nint isHigher(char first, char second) {\n\tif(cardValue(first) > cardValue(second)) return 1;\n\telse return 0;\n\treturn -1;\n}\n\nint main() {\n\tchar trump;\n\tchar *firstCard;\n\tchar *secondCard;\n\tfirstCard = malloc(2*sizeof(char));\n\tsecondCard = malloc(2*sizeof(char));\n\tscanf(\"%c %s %s\", &trump, firstCard, secondCard);\n\tif(firstCard[1] == secondCard[1] && \n\t\t\tisHigher(firstCard[0], secondCard[0])) {\n\t\tprintf(\"YES\");\t\t\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:37:50 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,w,g,h;\n char c[2];\n char str[100];\n char ch[11]={'6','7','8','9','T','J','K','Q','A'};\n scanf(\"%s\\n\",c);\n\n gets(str);\n\n //printf(\"%c\",c[0]);\n if (str[1]==c[0] && str[4]==c[0]){\n if(str[0]>str[3]){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else if(str[1]==c[0]){\n printf(\"YES\");\n }\n else if (str[4]==c[0]){\n printf(\"NO\");\n }\n else{\n for (i=0;i<9;i++){\n if(ch[i]==str[1]){\n g=i+1;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[4]){\n h=i+1;\n }\n }\n\n if (str[1]==str[4]){\n if (g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar suit[10]={'6','7','8','9','T','J','Q','K','A'};\nint main(void)\n{\n int r1,r2;\n char king[2],f[3],s[3];\n while(scanf(\"%s\",king)!=EOF)\n {\n scanf(\"%s %s\",f,s);\n if(f[1]==king[0]) puts(\"YES\");\n else\n {\n if(f[1]!=s[1]) puts(\"NO\");\n else\n {\n for(r1=0;r1<9&&suit[r1]!=f[0];++r1);\n for(r2=0;r2<9&&suit[r2]!=s[0];++r2);\n if(r1>r2) puts(\"YES\");\n else puts(\"NO\");\n }\n }\n\n }\n return 0;\n}\n"}, {"source_code": "// Code Forces 106A\n#include<stdio.h>\nint main()\n{char trump,C0,C1,B0,B1;int camp1,camp2;\n scanf(\"%c\\n%c%c\\n%c%c\",&trump,&C0,&C1,&B0,&B1);camp1=C0,camp2=B0;\n if((C1==trump)&&(B1!=trump)) {printf(\"YES\\n\");return 0;}\n if((C1!=trump)&&(B1==trump)) {printf(\"NO\\n\");return 0;}\n if(C0=='T') camp1=10;if(C0=='J') camp1=11;if(C0=='Q') camp1=12;if(C0=='K') camp1=13;if(C0=='A') camp1=14;\n if(B0=='T') camp2=10;if(B0=='J') camp2=11;if(B0=='Q') camp2=12;if(B0=='K') camp2=13;if(B0=='A') camp2=14;\n if(camp1>camp2)printf(\"YES\\n\");else printf(\"NO\\n\");\n return 0;}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n if(compare_1[1]==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else if(compare_1[1]>compare_2[1])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 11:00:20 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n if(compare_1[1]==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else if(compare_1[1]>compare_2[1])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 10:59:57 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n6 7 8 9 T J Q K A\nS H D C\n*/\n\n/* Devolve o valor da carta em numero inteiro */\nint cardValue(char card) {\n\tif(card == '6') return 6;\n\tif(card == '7') return 7;\n\tif(card == '8') return 8;\n\tif(card == '9') return 9;\n\tif(card == 'T') return 10;\n\tif(card == 'J') return 11;\n\tif(card == 'Q') return 12;\n\tif(card == 'K') return 13;\n\tif(card == 'A') return 14;\n\treturn -1;\n}\n\n/* Devolve 1 se a primeira carta for maior\n\t\t\t0 se for igual cc\n*/\nint isHigher(char first, char second) {\n\tif(cardValue(first) > cardValue(second)) return 1;\n\telse return 0;\n\treturn -1;\n}\n\nint main() {\n\tchar trump;\n\tchar *firstCard;\n\tchar *secondCard;\n\tfirstCard = malloc(2*sizeof(char));\n\tsecondCard = malloc(2*sizeof(char));\n\tscanf(\"%c %s %s\", &trump, firstCard, secondCard);\n\tif(trump == firstCard[1]) {\n\t\tprintf(\"YES\");\n\t}\n\telse if(trump == secondCard[1]) {\n\t\tprintf(\"YES\");\n\t}\n\telse if(firstCard[1] == secondCard[1] && \n\t\t\tisHigher(firstCard[0], secondCard[0])) {\n\t\tprintf(\"YES\");\t\t\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:01 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s,arr1[3],arr2[3],str[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n int i,j,k,l;\n scanf(\"%c\",&s);\n scanf(\"%s%s\",&arr1,&arr2);\n if(s==arr1[1]&&s==arr2[1])\n {\n for(i=0;i<10;i++)\n {\n if(arr1[0]==str[i])\n break;\n }\n for(j=0;j<10;j++)\n {\n if(arr2[0]==str[j])\n break;\n }\n if(i>j)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n if(s==arr1[1]&&s!=arr2[1])\n {\n printf(\"YES\");\n }\n if(s!=arr1[1]&&s==arr2[1])\n {\n printf(\"NO\");\n }\n if(s!=arr1[1]&&s!=arr2[1])\n {\n printf(\"NO\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n\n\n#define T 10\n#define J 11\n#define Q 12\n#define K 13\n#define A 14\nint main()\n{\nchar t;\nchar s1[2],s2[2];\nint a[25]={0};\nscanf(\"%c\",&t);\nscanf(\"%s %s\",s1,s2);\nif(s1[1]==t&&s2[1]!=t)\n{printf(\"YES\");\nreturn 0;\n}\nif(s1[1]==s2[1]&&s1[0]>s2[0])\n{printf(\"YES\");\nreturn 0;\n}\nprintf(\"NO\");\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n char c[2], d[7];\n int f1=0, f2=0;\n char s[] = \"6789TJQKA\";\n int i, j;\n gets(c);\n gets(d);\n //gets(e);\n if(c[0]==d[1] && c[0]!=d[4]){\n printf(\"YES\");\n return 0;\n }\n if(c[0]==d[4] && c[0]!=d[1]){\n printf(\"NO\");\n return 0;\n }\n /*switch(d[0]){\n case '6':\n f1 = 1;\n case '7':\n f1 = 2;\n case '8':\n f1 = 3;\n case '9':\n f1 = 4;\n case 'T':\n f1 = 5;\n case 'J':\n f1 = 6;\n case 'Q':\n f1 = 7;\n case 'K':\n f1 = 8;\n case 'A':\n f1 = 9;\n }\n switch(d[3]){\n case '6':\n f2 = 1;\n case '7':\n f2 = 2;\n case '8':\n f2 = 3;\n case '9':\n f2 = 4;\n case 'T':\n f2 = 5;\n case 'J':\n f2 = 6;\n case 'Q':\n f2 = 7;\n case 'K':\n f2 = 8;\n case 'A':\n f2 = 9;\n }\n printf(\" %c %c %d %d\", d[0], d[3], f1, f2);*/\n for(i=0; s[i]; i++){\n if(s[i]==d[0]) f1 = i;\n if(s[i]==d[3]) f2 = i;\n }\n (f1>f2)?printf(\"YES\"):printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar p,arr[6],a,b;\n\tchar str[10]={'0','6','7','8','9','T','J','Q','K','A'\n\t};\n\tint i,j,k,l;\n\tscanf(\"%c\",&p);\n\tscanf(\"%s\",arr);\n\tif(p==arr[1]&&p==arr[4])\n\t{\n\t\t\t for(i=0;i<9;i++)\n\t {\n\t \tif(str[i]==arr[0])\n\t \tbreak;\n\t\t};\n\t for(j=0;j<10;j++)\n\t {\n\t \tif(str[j]==arr[3])\n\t \tbreak;\n\t\t}\n\t\tprintf(\"%d %d\",i,j);\n\t\tif(i>j)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t \n\t}\n\telse if(p==arr[1]&&p!=arr[4])\n\t{\n\tprintf(\"YES\");\t\n\t}\n\telse if(p!=arr[1]&&p==arr[4])\n\t{\n\t\tprintf(\"NO\");\n\t}\n\telse\n\t{\n\t for(i=0;i<9;i++)\n\t {\n\t \tif(str[i]==arr[0])\n\t \tbreak;\n\t\t};\n\t for(j=0;j<10;j++)\n\t {\n\t \tif(str[j]==arr[3])\n\t \tbreak;\n\t\t}\n\t\tprintf(\"%d %d\",i,j);\n\t\tif(i>j)\n\t\tprintf(\"YES\");\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n\t\n}"}, {"source_code": "#include <stdio.h>\n ///CARD GAME\nint main()\n{\n char trump ;\n char first_set[5], second_set[5] ;\n\n scanf(\"%c\", &trump);\n\n scanf(\"%s\", first_set);\n scanf(\"%s\", second_set);\n\n if(first_set[1] == trump && second_set[1] != trump)\n printf(\"YES\\n\");\n\n else if(first_set[0] == 'A')\n printf(\"YES\\n\");\n\n else if(first_set[0] == 'k' && second_set[0] != 'A')\n printf(\"YES\\n\");\n\n else if(first_set[0] > second_set[0])\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{char str[2][3]={'\\0'},ch;int i,m[2]={0};\n\nscanf(\"%c\",&ch);\nfor(i=0;i<2;i++)\n{scanf(\"%s\",str[i]);\nswitch(str[i][0])\n{case '6':m[i]=6;break;\ncase '7':m[i]=7;break;\ncase '8':m[i]=8;break;\ncase '9':m[i]=9;break;\ncase 'T':m[i]=10;break;\ncase 'J':m[i]=11;break;\ncase 'Q':m[i]=12;break;\ncase 'K':m[i]=13;break;\ncase 'A':m[i]=14;break;}}\nif(str[0][1]==ch)\n{if(str[1][1]==ch)\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}\nelse\nprintf(\"YES\");\n}\nelse\n{if(str[1][1]==ch)\nprintf(\"NO\");\nelse\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Wed Dec 28 16:12:33 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n\ntypedef struct dupla {\n\tchar card;\n\tint value;\n} cell;\n\ncell celula[9];\n\nvoid start ();\nint beats (char c1, char c2);\n\n\nint main () {\n\tchar trump, c1, c2, s1, s2;\n\tchar string[10];\n\tscanf (\"%c\", &trump);\n\tscanf (\"%c\", &c1);\n\tscanf (\"%c\", &c1);\n\tscanf (\"%c\", &s1);\n\tscanf (\"%c\", &c2);\n\tscanf (\"%c\", &c2);\n\tscanf (\"%c\", &s2);\n\t\n/*\tprintf (\"trunfo: -%c-\\ncartas: %c de %c e %c de %c\\n\", trump, c1, s1, c2, s2);*/\n\n\tif (s1 == trump && s2 == trump) {\n\t\tif (beats (c1, c2))\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\telse { /*nao todas sao trunfo*/\n\t\tif (s1 == trump) /*primeira eh trunfo*/\n\t\t\tprintf (\"YES\");\n\t\telse /*primeira nao eh trunfo*/\n\t\t\tif (s2 == trump) /*segunda eh trunfo*/\n\t\t\t\tprintf (\"NO\");\n\t\t\telse /*segunda TB nao eh trunfo*/\n\t\t\t\tif (s1 != s2) /*naipes diferentes*/\n\t\t\t\t\tprintf (\"NO\");\n\t\t\t\telse /*naipes iguais*/\n\t\t\t\t\tif (beats (c1, c2))\n\t\t\t\t\t\tprintf (\"YES\");\n\t\t\t\t\telse\n\t\t\t\t\t\tprintf (\"NO\");\n\t}\n\treturn 0;\n}\n\n\nvoid start () {\n\tint i;\n\t\n\tcelula[0].card = '6';\n\tcelula[1].card = '7';\n\tcelula[2].card = '8';\n\tcelula[3].card = '9';\n\tcelula[4].card = 'T';\n\tcelula[5].card = 'J';\n\tcelula[6].card = 'Q';\n\tcelula[7].card = 'K';\n\tcelula[8].card = 'A';\n\t\n\tfor (i = 0; i < 9; i++)\n\t\tcelula[i].value = i;\n}\n\nint beats (char c1, char c2) {\n\tint i, v1, v2;\n\t\n\tfor (i = 0; i < 9; i++) {\n\t\tif (celula[i].card == c1)\n\t\t\tv1 = celula[i].value;\n\t\tif (celula[i].card == c2)\n\t\t\tv2 = celula[i].value;\n\t}\n\tif (v1 > v2) return 1;\n\telse return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s,arr1[3],arr2[3],str[]={'6','7','8','9','T','J','Q','K','A','\\0'};\n int i,j,k,l;\n scanf(\"%c\",&s);\n scanf(\"%s%s\",&arr1,&arr2);\n if(s==arr1[1]&&s==arr2[1])\n {\n for(i=0;i<10;i++)\n {\n if(arr1[0]==str[i])\n break;\n }\n for(j=0;j<10;j++)\n {\n if(arr2[0]==str[j])\n break;\n }\n if(i>j)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n if(s==arr1[1]&&s!=arr2[1])\n {\n printf(\"YES\");\n }\n if(s!=arr1[1]&&s==arr2[1])\n {\n printf(\"NO\");\n }\n if(s!=arr1[1]&&s!=arr2[1])\n {\n printf(\"NO\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n\tchar a, b, c, d, e;\n\ta = getchar();\n\tgetchar;\n\tb = getchar();\n\tc = getchar();\n\tgetchar();\n\td = getchar();\n\te = getchar();\n\tif (c == a)\n\t\tprintf(\"YES\\n\");\n\telse if (c == e)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\t \t \t\t\t\t\t \t \t\t \t\t\t\t\t \t"}, {"source_code": "#include <stdio.h>\n\n\n\nint tranfCartaParaOrdemDeCarta(char c) {\n\tswitch (c) {\n\t\tcase 'T': return 1;\n\t\tcase 'J': return 2;\n\t\tcase 'Q': return 3;\n\t\tcase 'K': return 4;\n\t\tcase 'A': return 5;\n\t\tdefault:\n\t\t\treturn EOF;\n\t}\n}\n\nvoid cardGame() {\n\tchar c, s[2][2];\n\n\tscanf(\"%c\", &c);\n\tscanf(\"%s %s\", s[0], s[1]);\n\t\n\tif (s[0][1] == s[1][1])\n\t\tif (tranfCartaParaOrdemDeCarta(s[0][0]) > tranfCartaParaOrdemDeCarta(s[1][0]))\n\t\t\tprintf(\"YES\");\n\t\telse \n\t\t\tprintf(\"NO\");\n\telse if (s[0][1] == c)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n}\n\nint main() {\n\t\n\tcardGame();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char s[10],s1[10],s2[10];\n scanf(\"%s %s %s\",s,s1,s2);\n if(s[0]==s1[1]&&s[0]!=s2[1])\n {printf(\"YES\");exit(0);}\n if(s[0]==s2[1]&&s[0]!=s1[1])\n {printf(\"NO\");exit(0);}\n if( (s1[1]==s[0]&& s2[1]==s[0]) || (s1[1]!=s[0]&& s2[1]!=s[0]))\n {if(s1[0]=='A') {printf(\"YES\");exit(0);}\n if(s1[0]=='K') {if(s2[0]=='A') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='Q') {if(s2[0]=='A'||s2[0]=='K') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='J') {if(s2[0]=='A'||s2[0]=='K'||s2[0]=='Q') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='T') {if(s2[0]=='A'||s2[0]=='K'||s2[0]=='Q'||s2[0]=='J') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='9') {if(s2[0]=='A'||s2[0]=='K'||s2[0]=='Q'||s2[0]=='J'||s2[0]=='T') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='8') {if(s2[0]=='A'||s2[0]=='K'||s2[0]=='Q'||s2[0]=='J'||s2[0]=='T'||s2[0]=='9') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='7') {if(s2[0]=='A'||s2[0]=='K'||s2[0]=='Q'||s2[0]=='J'||s2[0]=='T'||s2[0]=='9'||s2[0]=='8') {printf(\"NO\");exit(0);} else {printf(\"YES\");exit(0);} }\n if(s1[0]=='6') printf(\"NO\");}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump[]=\"SHDC\";\n int num[]={6,7,8,9,10,11,12,13,14};\n char trump_in;\n char compare_1[2];\n char compare_2[2];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n for(i=0;i<4;i++)\n {\n if(trump[i]==compare_1[1] && trump[i]==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump[i])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n }\n return 0;\n}\n/****** PCCA -Thu Dec 08 14:34:29 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char trump ;\n char first_set[5], second_set[5] ;\n\n scanf(\"%c\", &trump);\n\n scanf(\"%s\", first_set);\n scanf(\"%s\", second_set);\n\n if(first_set[1] == trump)\n printf(\"YES\\n\");\n\n else if(first_set[0] == 'A')\n printf(\"YES\\n\");\n\n else if(first_set[0] == 'k' && second_set[0] != 'A')\n printf(\"YES\\n\");\n\n else if(first_set[0] > second_set[0])\n printf(\"YES\\n\");\n\n else\n printf(\"NO\\n\");\n\n\n return 0 ;\n}\n"}, {"source_code": "// Code Forces 106A\n#include<stdio.h>\nint main()\n{char trump,C0,C1,B0,B1;int camp1,camp2;\n scanf(\"%c\\n%c%c\\n%c%c\",&trump,&C0,&C1,&B0,&B1);\n if((C1==trump)&&(B1!=trump)) {printf(\"YES\\n\");return 0;}\n if((C1!=trump)&&(B1==trump)) {printf(\"NO\\n\");return 0;}\n if(C0=='T') camp1=10;if(C0=='J') camp1=11;if(C0=='Q') camp1=12;if(C0=='K') camp1=13;if(C0=='A') camp1=14;\n if(B0=='T') camp2=10;if(B0=='J') camp2=11;if(B0=='Q') camp2=12;if(B0=='K') camp2=13;if(B0=='A') camp2=14;\n if(camp1>camp2)printf(\"YES\\n\");else printf(\"NO\\n\");\n return 0;}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar strSuit;\n\tchar strCard1[3], strCard2[3];\n\tscanf(\"%c\",&strSuit);\n\tscanf(\"%s %s\",strCard1, strCard2);\n\tif(strCard1[1]==strSuit||strCard1[1]==strCard2[1])\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\n\treturn 0;\n}\n\t\t\t\t \t\t\t\t \t \t \t\t \t \t \t \t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\n\nint main()\n{\n char ch[5];\n scanf(\"%c %c%c %c%c\",&ch[0],&ch[1],&ch[2],&ch[3],&ch[4]);\n if(ch[0]==ch[2])\n {\n if(ch[0]==ch[4])\n {\n goto l1;\n }\n else\n {\n printf(\"%s\",\"YES\");\n }\n }\n else\n {\n if(ch[0]==ch[4]||ch[4]!=ch[2])\n {\n printf(\"%s\",\"NO\");\n }\n else\n {\n l1:\n switch(ch[1])\n {\n case '6': printf(\"%s\",\"NO\"); break;\n case '7': if(ch[3]=='6') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '8': if(ch[3]=='6'||ch[3]=='7') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case '9': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'T': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'J': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'Q': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'K': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n case 'A': if(ch[3]=='6'||ch[3]=='7'||ch[3]=='8'||ch[3]=='9'||ch[3]=='T'||ch[3]=='J'||ch[3]=='Q'||ch[3]=='A') printf(\"%s\",\"YES\"); else printf(\"%s\",\"NO\");break;\n }\n \n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:39:46 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[2],b,c[2];\n\tint i, j, m, n;\n\tscanf(\"%c\", &b);\n\tfor (i = 1; i <= 2; ++i)\n\t\tscanf(\"%c\", &a[i]);\n\tfor (j = 1; j <= 2; ++j)\n\t\tscanf(\"%c\", &c[j]);\n\tif (b == a[2] && b == c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b == a[2] && b == c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b != a[2] && b != c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b != a[2] && b == c[2] && a[1] > c[1])\n\t\tprintf(\"NO\");\n\tif (b == a[2] && b != c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b != a[2] && b != c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b != a[2] && b == c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b == a[2] && b != c[2] && a[1] < c[1])\n\t\tprintf(\"YES\");\n}\n\t \t \t \t\t\t \t \t\t \t\t\t\t"}, {"source_code": "#include <stdio.h> \n\nint main(){ \nchar trump,a[2],b[2];\nscanf(\"%c\",&trump);\nscanf(\"%s%s\",a,b);\nif(a[0]=='T')a[0]='A';\nif(b[0]=='T')b[0]='A';\nif(a[0]=='J')a[0]='B';\nif(b[0]=='J')b[0]='B';\nif(a[0]=='Q')a[0]='C';\nif(b[0]=='Q')b[0]='C';\nif(a[0]=='K')a[0]='D';\nif(b[0]=='K')b[0]='D';\nif(a[0]=='A')a[0]='E';\nif(b[0]=='A')b[0]='E';\nif(a[1]==trump&&b[1]!=trump)printf(\"YES\");\nelse if(a[1]!=trump&&b[1]==trump)printf(\"NO\");\nelse {\nif(a[0]-b[0]>0)printf(\"YES\");\nelse printf(\"NO\");\n}\nreturn 0; \n} \n\n \t \t \t \t \t\t \t\t \t\t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i;\n char c,str[3],str1[3];\n scanf(\"%c\",&c);\n scanf(\"%s\",str);\n scanf(\"%s\",str1);\n if(str[1]==c)\n {\n printf(\"YES\");\n exit(0);\n }\n else if(str[1]==str1[1])\n {\n if((str[0]>='6'&&str[0]<='9')&&(str1[0]>='6'&&str1[0]<='9'))\n {\n if(str[0]>str1[0])\n printf(\"YES\");\n else\n printf(\"NO\");\n exit(0);\n }\n else if((str[0]>='A'&&str[0]<='Z')&&(str1[0]>='6'&&str1[0]<='9'))\n {\n printf(\"YES\");\n exit(0);\n }\n else if((str[0]>='6'&&str[0]<='9')&&(str1[0]>='A'&&str1[0]<='Z'))\n {\n printf(\"YES\");\n exit(0);\n }\n else\n {\n if(str[0]=='A')\n str[0]='5';\n if(str[0]=='K')\n str[0]='4';\n if(str[0]=='Q')\n str[0]='3';\n if(str[0]=='J')\n str[0]='2';\n if(str[0]=='T')\n str[0]='1';\n\n if(str1[0]=='A')\n str1[0]='5';\n if(str1[0]=='K')\n str1[0]='4';\n if(str1[0]=='Q')\n str1[0]='3';\n if(str1[0]=='J')\n str1[0]='2';\n if(str1[0]=='T')\n str1[0]='1';\n\n if(str[0]>str1[0])\n printf(\"YES\");\n else\n printf(\"NO\");\n exit(0);\n }\n }\n else\n {\n printf(\"NO\");\n exit(0);\n }\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar c;\n\tscanf(\"%c\",&c);\n\tchar f[2],s[2];\n\tscanf(\"%s %s\",f,s);\n\tif(f[1]==c&&s[1]!=c)\n\t\tprintf(\"YES\");\n\telse if(f[1]!=s[1])\n\t\tprintf(\"NO\");\n\telse if(f[1]==s[1])\n\t{\n\t\tif(f[0]=='T'&&(s[0]=='J'||s[0]=='K'||s[0]=='A'))\n\t\t\tprintf(\"NO\");\n\t\tif(f[0]=='Q'&&(s[0]=='K'||s[0]=='A'))\n\t\t\tprintf(\"NO\");\n\t\telse if(f[0]>s[0])\n\t\t\tprintf(\"YES\");\n\t\telse if(f[0]<s[0])\n\t\t\tprintf(\"NO\");\t\t\t\n\t}\n\telse\n\t\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c,d;\n char str1[3],str2[3],ch;\n scanf(\"%c\",&ch);\n scanf(\"%s%s\",str1,str2);\n if(str1[0]=='T'){\n a=10;\n }\n else if(str1[0]=='J'){\n a=11;\n }\n else if(str1[0]=='Q'){\n a=12;\n }\n else if(str1[0]=='K'){\n a=13;\n }\n else if(str1[0]=='A'){\n a=14;\n }\n else if(str1[0]=='6'){\n a=6;\n }\n else if(str1[0]=='7'){\n a=7;\n }\n else if(str1[0]=='8'){\n a=8;\n }\n else if(str1[0]=='9'){\n a=9;\n }\n else if(str1[0]=='S'){\n a=15;\n }\n else if(str1[0]=='H'){\n a=16;\n }\n else if(str1[0]=='D'){\n a=17;\n }\n else if(str1[0]=='C'){\n a=18;\n }\n\n if(str1[1]=='T'){\n b=10;\n }\n else if(str1[1]=='J'){\n b=11;\n }\n else if(str1[1]=='Q'){\n b=12;\n }\n else if(str1[1]=='K'){\n b=13;\n }\n else if(str1[1]=='A'){\n b=14;\n }\n else if(str1[1]=='6'){\n b=6;\n }\n else if(str1[1]=='7'){\n b=7;\n }\n else if(str1[1]=='8'){\n b=8;\n }\n else if(str1[1]=='9'){\n b=9;\n }\n else if(str1[1]=='S'){\n b=15;\n }\n else if(str1[1]=='H'){\n b=16;\n }\n else if(str1[1]=='D'){\n b=17;\n }\n else if(str1[1]=='C'){\n b=18;\n }\n\n if(str2[0]=='T'){\n c=10;\n }\n else if(str2[0]=='J'){\n c=11;\n }\n else if(str2[0]=='Q'){\n c=12;\n }\n else if(str2[0]=='K'){\n c=13;\n }\n else if(str2[0]=='A'){\n c=14;\n }\n else if(str2[0]=='6'){\n c=6;\n }\n else if(str2[0]=='7'){\n c=7;\n }\n else if(str2[0]=='8'){\n c=8;\n }\n else if(str2[0]=='9'){\n c=9;\n }\n else if(str2[0]=='S'){\n c=15;\n }\n else if(str2[0]=='H'){\n c=16;\n }\n else if(str2[0]=='D'){\n c=17;\n }\n else if(str2[0]=='C'){\n c=18;\n }\n\n if(str2[1]=='T'){\n d=10;\n }\n else if(str2[1]=='J'){\n d=11;\n }\n else if(str2[1]=='Q'){\n d=12;\n }\n else if(str2[1]=='K'){\n d=13;\n }\n else if(str2[1]=='A'){\n d=14;\n }\n else if(str2[1]=='6'){\n d=6;\n }\n else if(str2[1]=='7'){\n d=7;\n }\n else if(str2[1]=='8'){\n d=8;\n }\n else if(str2[1]=='9'){\n d=9;\n }\n else if(str2[1]=='S'){\n d=15;\n }\n else if(str2[1]=='H'){\n d=16;\n }\n else if(str2[1]=='D'){\n d=17;\n }\n else if(str2[1]=='C'){\n d=18;\n }\n if(a>c&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n if(str1[0]==ch&&str2[0]==ch){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[1]==ch&&str2[1]==ch){\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[0]==ch||str1[1]==ch){\n printf(\"YES\\n\");\n return 0;\n }\n else if(str2[0]==ch||str2[1]==ch){\n printf(\"NO\\n\");\n return 0;\n }\n\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n if(a==c){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i,j,w,g,h;\n char c[2];\n char str[100];\n char ch[11]={'6','7','8','9','T','J','K','Q','A'};\n scanf(\"%s\\n\",c);\n\n gets(str);\n\n //printf(\"%c\",c[0]);\n if (str[1]==c[0] && str[4]==c[0]){\n if(str[0]>str[3]){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else if(str[1]==c[0]){\n printf(\"YES\");\n }\n else if (str[4]==c[0]){\n printf(\"NO\");\n }\n else{\n for (i=0;i<9;i++){\n if(ch[i]==str[1]){\n g=i+1;\n }\n }\n for (i=0;i<9;i++){\n if(ch[i]==str[4]){\n h=i+1;\n }\n }\n\n if (str[1]==str[4]){\n if (g>h){\n printf(\"YES\");\n }\n else{\n printf(\"NO\");\n }\n }\n else{\n printf(\"NO\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\nint main(){\n char trump[1];\n char first[2],second[2];\n int f,s;\n\n scanf(\"%s\",trump);\n// printf(\"%s\\n\",trump);\n scanf(\"%s %s\",first,second);\n// printf(\"%s %s\\n\",first,second);\n\n if(first[1] == second[1]){\n switch (first[0]){\n case 'A':\n if(second[0] == 'A'){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n case 'K':\n if(second[0] == 'A' || second[0] == 'K'){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n case 'Q':\n if(second[0] == 'A' || second[0] == 'K'|| second[0] == 'Q'){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n case 'J':\n if(second[0] == 'A' || second[0] == 'K' || second[0] == 'Q' || second[0] == 'J'){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n case 'T':\n if(second[0] == 'A' || second[0] == 'K'|| second[0] == 'Q' || second[0] == 'J' || second[0] == 'T'){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n default:\n if(second[0] - first[0] >= 0){\n printf(\"NO\");\n }else{\n printf(\"YES\");\n }\n break;\n }\n \n }else if(first[1] == trump[0]){\n printf(\"YES\");\n }else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nstruct carta {\n\tint valor;\n\tchar naipe;\n};\n\nint main(){\n\tstruct carta primeira;\n\tstruct carta segunda;\n\tchar trunfo, c;\n\tscanf (\"%c\", &trunfo);\n\tscanf (\"%c\", &c);\n\tswitch (c){\n\t\tcase '6':\n\t\t\tprimeira.valor = 6;\n\t\tcase '7':\n\t\t\tprimeira.valor = 7;\n\t\tcase '8':\n\t\t\tprimeira.valor = 8;\n\t\tcase '9':\n\t\t\tprimeira.valor = 9;\n\t\tcase 'T': \n\t\t\tprimeira.valor = 10; \n\t\t\tbreak;\n\t\tcase 'J': \n\t\t\tprimeira.valor = 11; \n\t\t\tbreak;\n\t\tcase 'Q': \n\t\t\tprimeira.valor = 12; \n\t\t\tbreak;\n\t\tcase 'K': \n\t\t\tprimeira.valor = 13; \n\t\t\tbreak;\n\t\tcase 'A': \n\t\t\tprimeira.valor = 14; \n\t\t\tbreak;\n\t}\n\tscanf (\"%c\", &c);\n\tprimeira.naipe = c;\t\n\tscanf (\"%c\", &c);\n\tswitch (c){\n\t\tcase '6':\n\t\t\tsegunda.valor = 6;\n\t\tcase '7':\n\t\t\tsegunda.valor = 7;\n\t\tcase '8':\n\t\t\tsegunda.valor = 8;\n\t\tcase '9':\n\t\t\tsegunda.valor = 9;\n\t\tcase 'T': \n\t\t\tsegunda.valor = 10; \n\t\t\tbreak;\n\t\tcase 'J': \n\t\t\tsegunda.valor = 11; \n\t\t\tbreak;\n\t\tcase 'Q': \n\t\t\tsegunda.valor = 12; \n\t\t\tbreak;\n\t\tcase 'K': \n\t\t\tsegunda.valor = 13; \n\t\t\tbreak;\n\t\tcase 'A': \n\t\t\tsegunda.valor = 14; \n\t\t\tbreak;\n\t}\n\tscanf (\"%c\", &c);\n\tsegunda.naipe = c;\n\tif (segunda.naipe == primeira.naipe){\n\t\tif (primeira.valor > segunda.valor)\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\telse {\n\t\tif (primeira.naipe == trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nstruct carta {\n\tint valor;\n\tchar naipe;\n};\n\nint main(){\n\tstruct carta primeira;\n\tstruct carta segunda;\n\tchar trunfo, c;\n\tscanf (\"%c\", &trunfo);\n\tscanf (\"%c\", &c);\n\tscanf (\"%c\", &c);\n\tswitch (c){\n\t\tcase '6':\n\t\t\tprimeira.valor = 6;\n\t\tcase '7':\n\t\t\tprimeira.valor = 7;\n\t\tcase '8':\n\t\t\tprimeira.valor = 8;\n\t\tcase '9':\n\t\t\tprimeira.valor = 9;\n\t\tcase 'T': \n\t\t\tprimeira.valor = 10; \n\t\t\tbreak;\n\t\tcase 'J': \n\t\t\tprimeira.valor = 11; \n\t\t\tbreak;\n\t\tcase 'Q': \n\t\t\tprimeira.valor = 12; \n\t\t\tbreak;\n\t\tcase 'K': \n\t\t\tprimeira.valor = 13; \n\t\t\tbreak;\n\t\tcase 'A': \n\t\t\tprimeira.valor = 14; \n\t\t\tbreak;\n\t}\n\tscanf (\"%c\", &c);\n\tprimeira.naipe = c;\t\n\tscanf (\"%c\", &c);\n\tscanf (\"%c\", &c);\n\tswitch (c){\n\t\tcase '6':\n\t\t\tsegunda.valor = 6;\n\t\tcase '7':\n\t\t\tsegunda.valor = 7;\n\t\tcase '8':\n\t\t\tsegunda.valor = 8;\n\t\tcase '9':\n\t\t\tsegunda.valor = 9;\n\t\tcase 'T': \n\t\t\tsegunda.valor = 10; \n\t\t\tbreak;\n\t\tcase 'J': \n\t\t\tsegunda.valor = 11; \n\t\t\tbreak;\n\t\tcase 'Q': \n\t\t\tsegunda.valor = 12; \n\t\t\tbreak;\n\t\tcase 'K': \n\t\t\tsegunda.valor = 13; \n\t\t\tbreak;\n\t\tcase 'A': \n\t\t\tsegunda.valor = 14; \n\t\t\tbreak;\n\t}\n\tscanf (\"%c\", &c);\n\tsegunda.naipe = c;\n\tif (segunda.naipe == primeira.naipe){\n\t\tif (primeira.valor > segunda.valor)\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\telse {\n\t\tif (primeira.naipe == trunfo)\n\t\t\tprintf (\"YES\");\n\t\telse\n\t\t\tprintf (\"NO\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n int value_converter(char temp){\n if(temp=='6'){\n return 6;\n }\n else if(temp=='7'){\n return 7;\n }\n else if(temp=='8'){\n return 8;\n }\n else if(temp=='9'){\n return 9;\n }\n else if(temp=='T'){\n return 10;\n }\n else if(temp=='J'){\n return 11;\n }\n else if(temp=='Q'){\n return 12;\n }\n else if(temp=='K'){\n return 13;\n }\n else if(temp=='A'){\n return 14;\n }\n}\n\n\n int main()\n {\n\n char trump, p1, p2 , p3, p4;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &p1,&p2,&p3,&p4);\n\n int integer_value_of_p11 = value_converter(p1);\n int integer_value_of_p21 = value_converter(p3);\n if(trump==p2 && trump==p4 && integer_value_of_p11 > integer_value_of_p21) {\n printf(\"YES\");\n }\n else if(trump==p2 && trump==p4 && integer_value_of_p11 < integer_value_of_p21) {\n printf(\"NO\");\n }\n else if(trump==p2) {\n printf(\"YES\");\n }\n else if(trump==p4) {\n printf(\"NO\");\n }\n else if( integer_value_of_p11 > integer_value_of_p21 ) {\n printf(\"YES\");\n } else if( integer_value_of_p11 < integer_value_of_p21 ) {\n printf(\"NO\");\n }\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//Written By GHATAK...\nint main()\n{\n char c,c1[3],c2[3];\n char c3[]={'6','7','8','9','T','J','Q','K','A'};\n scanf(\"%c %s %s\",&c,c1,c2);\n if((c==c1[1])||(c==c2[1]))\n {\n int l,k;\n for(int i=0;i<9;i++)\n {\n if(c1[0]==c3[i])\n {\n l=i;\n }\n if(c2[0]==c3[i])\n {\n k=i;\n }\n }\n if(l>k)\n {\n printf(\"YES\");\n return 0;\n }\n }\n else\n {\n if(c1[1]!=c2[1])\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n int l,k;\n for(int i=0;i<9;i++)\n {\n if(c1[0]==c3[i])\n {\n l=i;\n }\n if(c2[0]==c3[i])\n {\n k=i;\n }\n }\n if(l>k)\n {\n printf(\"YES\");\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid main(){\n char suit,a[3],b[3];\n scanf(\"%c\",&suit);\nscanf(\"%s %s\",a,b);\n if(a[1]==suit&&b[1]!=suit)\n\t printf(\"YES\\n\");\n else if(a[1]!=suit&&b[1]==suit)\n\t printf(\"NO\\n\");\n else {\n\t if(a[0]>b[0])\n\t\t printf(\"YES\\n\");\n\t else \n\t\t printf(\"NO\\n\");\n }\n}\n \t \t \t\t \t\t\t\t \t\t \t \t\t\t\t\t"}, {"source_code": "// Code Forces 106A\n#include<stdio.h>\n#define T 10\n#define J 11\n#define Q 12\n#define K 13 \n#define A 14\nint main()\n{\n char trump;\n char Arr[2]={'0','0'};\n char Brr[2]={'0','0'};\n// printf(\"before: %c%c%c%c\\n\",Arr[0],Arr[1],Brr[0],Brr[1]);\n scanf(\"%d\",&trump);\n scanf(\"%c\",&Arr[0]);\n scanf(\"%c\",&Arr[1]);\n scanf(\"%c\",&Brr[0]);\n scanf(\"%c\",&Brr[1]);\n //printf(\"after: %c%c%c%c%c\\n\",trump,Arr[0],Arr[1],Brr[0],Brr[1]);\n if((Arr[1]==trump)&&(Brr[1]!=trump)) {printf(\"YES\\n\");return 0;}\n if((Arr[1]!=trump)&&(Brr[1]==trump)) {printf(\"NO\\n\");return 0;}\n if(Arr[0]>Brr[0]) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n char c,a[3],b[3];\n char p[9][1]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K' , 'A'};\n scanf(\"%c\",&c);\n scanf(\"%s %s\",&a,&b);\n if(a[1]==c)\n printf(\"YES\");\n else\n {\n if(a[0]>=b[0])\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:38:19 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\nint main()\n{char str[2][3]={'\\0'},ch;int i,m[2]={0};\n\nscanf(\"%c\",&ch);\nfor(i=0;i<2;i++)\n{scanf(\"%s\",str[i]);\nswitch(str[i][0])\n{case '6':m[i]=6;break;\ncase '7':m[i]=7;break;\ncase '8':m[i]=8;break;\ncase '9':m[i]=9;break;\ncase 'T':m[i]=10;break;\ncase 'J':m[i]=11;break;\ncase 'Q':m[i]=12;break;\ncase 'K':m[i]=13;break;\ncase 'A':m[i]=14;break;}}\nif(str[0][1]==ch)\n{if(str[1][1]==ch)\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}\nelse\nprintf(\"YES\");\n}\nelse\n{if(str[1][1]==ch)\nprintf(\"NO\");\nelse\n{if(m[0]>m[1])\nprintf(\"YES\");\nelse\nprintf(\"NO\");\n}}\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n char c,a[3],b[3];\n char p[9][1]={'6', '7', '8', '9', 'T', 'J', 'Q', 'K' , 'A'};\n scanf(\"%c\",&c);\n scanf(\"%s %s\",&a,&b);\n if(a[1]==c && b[1]!=c)\n printf(\"YES\");\n else\n {\n int x=0,y=0;\n for(int i=0;i<9;i++)\n {\n if(a[0]==p[i][0])\n x=i;\n else if(b[0]==p[i][0])\n y=i;\n }\n if(x>=y)\n printf(\"YES\");\n else\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint i,j,a,b,c=0;\nchar str[2][2],str1[12];\nstr1[3]='5';\nstr1[4]='6';\nstr1[5]='7';\nstr1[6]='8';\nstr1[7]='9';\nstr1[8]='T';\nstr1[9]='J';\nstr1[10]='Q';\nstr1[11]='K';\nscanf(\"%s\",str[0]);\nscanf(\"%s\",str[1]);\nscanf(\"%s\",str[2]);\n if(str[1][1]==str[2][1]) {\n for(i=3;i<=11;i++){\n if(str[1][0]==str1[i])\n a=i;\n else if(str[2][0]==str1[i])\n b=i;\n }\n if(a>b)\n printf(\"YES\");\n else if(a<b)\n printf(\"NO\");\n }\nelse if(str[1][1]==str[0][0])\n printf(\"YES\");\nelse if(str[2][1]==str[0][0])\n printf(\"NO\");\n else if(str[1][1]!=str[2][1])\n printf(\"NO\");\nreturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(){\nint i,j,a,b;\nchar str[2][2],str1[10];\nscanf(\"%s\",str[0]);\nscanf(\"%s\",str[1]);\nscanf(\"%s\",str[2]);\n//printf(\"%c\",str[0][1]);\nstr1[0]='5';\nstr1[1]='6';\nstr1[2]='7';\nstr1[3]='8';\nstr1[4]='9';\nstr1[5]='T';\nstr1[6]='J';\nstr1[7]='Q';\nstr1[8]='K';\nstr1[9]='\\0';\nif(str[1][1]==str[0][0])\n printf(\"YES\");\nelse if(str[2][1]==str[0][0])\n printf(\"NO\");\nelse{\n if(str[1][1]!=str[2][1])\n printf(\"NO\");\n else if(str[1][1]==str[2][1]){\n for(j=0;j<=8;j++){\n if(str[1][0]==str1[j])\n a=j;\n if(str[2][0]==str1[j])\n b=j;\n }\n if(a>b)\n printf(\"YES\");\n else if(a<b)\n printf(\"NO\");\n }\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar a[2],b,c[2];\n\tint i, j, m, n;\n\tscanf(\"%c\", &b);\n\tfor (i = 1; i <= 2; ++i)\n\t\tscanf(\"%c\", &a[i]);\n\tfor (j = 1; j <= 2; ++j)\n\t\tscanf(\"%c\", &c[j]);\n\tif (b == a[2] && b == c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b == a[2] && b == c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b != a[2] && b != c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b != a[2] && b == c[2] && a[1] > c[1])\n\t\tprintf(\"NO\");\n\tif (b == a[2] && b != c[2] && a[1] > c[1])\n\t\tprintf(\"YES\");\n\tif (b != a[2] && b != c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b != a[2] && b == c[2] && a[1] < c[1])\n\t\tprintf(\"NO\");\n\tif (b == a[2] && b != c[2] && a[1] < c[1])\n\t\tprintf(\"YES\");\n}\n\t\t \t\t\t\t\t \t\t\t\t \t \t \t\t\t\t \t \t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n char c,s1[10],s2[10];\n char s3[9]={'6','7','8','9','T','J','Q','K','A'};\n int i,k1,k2;\n while(scanf(\"%c\",&c)!=EOF)\n {\n getchar();\n scanf(\"%s %s\",s1,s2);\n if(s1[1]==c&&s2[1]!=c)\n {\n printf(\"YES\\n\");\n }\n else\n if(s1[1]!=c&&s2[1]==c)\n {\n printf(\"NO\\n\");\n }\n else\n {\n for(i=0;i<9;i++)\n {\n if(s3[i]==s1[0])\n k1=i;\n if(s3[i]==s2[0])\n k2=i;\n }\n if(k1>k2)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint value_converter(char temp) {\n if(temp=='6') {\n return 6;\n } else if(temp=='7') {\n return 7;\n } else if(temp=='8') {\n return 8;\n } else if(temp=='9') {\n return 9;\n } else if(temp=='T') {\n return 10;\n } else if(temp=='J') {\n return 11;\n } else if(temp=='Q') {\n return 12;\n } else if(temp=='K') {\n return 13;\n } else if(temp=='A') {\n return 14;\n }\n else if(temp=='S') {\n return 15;\n }\n else if(temp=='H') {\n return 16;\n }\n else if(temp=='D') {\n return 17;\n }\n else if(temp=='C') {\n return 18;\n }\n\n\n}\n\n\nint main() {\n\n char trump, p1, p2 , p3, p4;\n\n scanf(\"%c\\n\", &trump);\n scanf(\"%c%c %c%c\", &p1,&p2,&p3,&p4);\n\n // printf(\"%c %c %c %c\\n\",p1,p2,p3,p4);\n int integer_value_of_p11 = value_converter(p1);\n int integer_value_of_p21 = value_converter(p3);\n\n if( p2==p4 ){\n if( integer_value_of_p11 > integer_value_of_p21 ){\n printf(\"YES\");\n }\n else{\n printf(\"NO\\n\");\n }\n }\n else if(p1==trump) {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:41:33 GMT 2011 *******/"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid main(){\n char suit,a[3],b[3];\n scanf(\"%c\",&suit);\n\nscanf(\"%s %s\",a,b);\nif(a[0]=='Q')\n\ta[0]='L';\nif(b[0]=='Q')\n\tb[0]='L';\nif(a[0]=='T')\n\ta[0]='H';\nif(b[0]=='T')\n\tb[0]='H';\nif(a[0]=='A')\n\ta[0]='N';\nif(b[0]=='A')\n\tb[0]='N';\nif(a[0]=='K')\n\ta[0]='M';\nif(b[0]=='K')\n\tb[0]='M';\n if(a[1]==suit&&b[1]!=suit)\n\t printf(\"YES\\n\");\n else if(a[1]!=suit&&b[1]==suit)\n\t printf(\"NO\\n\");\n else {\n\t if(a[0]>b[0])\n\t\t printf(\"YES\\n\");\n\t else \n\t\t printf(\"NO\\n\");\n }\n}\n\t\t\t\t \t\t \t\t\t \t\t\t \t \t\t\t \t"}, {"source_code": "#include <stdio.h>\n\nint f(char c) {\n if (c <= 0x39) {\n return c - 0x36;\n }\n\n switch (c) {\n case ('T'):\n return 4;\n case ('J'):\n return 5;\n case ('Q'):\n return 6;\n case ('K'):\n return 7;\n case ('A'):\n return 8;\n }\n\n return -1;\n}\n\nint main () {\n char c = 0;\n char s1[3] = {0};\n char s2[3] = {0};\n \n scanf(\"%c %s %s\", &c, s1, s2);\n\n if ((s1[1] == c && s2[1] != c)) {\n printf(\"YES\\n\");\n return 0;\n }\n\n if (f(s1[0]) > f(s2[0])) {\n if (s2[1] == s2[1]) {\n printf(\"YES\\n\");\n return 0;\n } else if (s2[1] != c) {\n printf(\"YES\\n\");\n return 0;\n }\n }\n\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint dec(char c){\n\tswitch(c){\n\tcase '6': return 6;\n\tcase '7': return 7;\n\tcase '8': return 8;\n\tcase '9': return 9;\n\tcase 'T': return 10;\n\tcase 'J': return 11;\n\tcase 'Q': return 12;\n\tcase 'K': return 13;\n\tcase 'A': return 15;\n\t}\n}\n\nint istrump(char trump,char this){\n\tif(trump==this)return 1;\n\telse return 0;\n}\n\nint main(void)\n{\n char a,b,c,d,e;\n int scorea,scoreb;\n int win;\n scanf(\" %c\",&a);\n fflush(stdin);\n scanf(\"%c%c %c%c\",&b,&c,&d,&e);\n if(istrump(a,c)){\n if(istrump(a,e)){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else win=1;\n }\n else{\n if(c==e){\n if(dec(b)>=dec(d))win=1;\n else win=0;\n }\n else if(istrump(a,e)){\n win=0;\n }\n else win=0;\n }\n \n if(win)puts(\"YES\");\n else puts(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint s(char c);\nint main(){\nchar a,b,c,d,t;\nint i,j;\nscanf(\"%c\\n\",&t);\nscanf(\"%c%c %c%c\",&a,&b,&c,&d);\nif(b==t&&d!=t)\n printf(\"YES\\n\");\nelse if(d==t&&b!=t)\n printf(\" NO\\n\");\nelse{\n i=s(a);\n j=s(c);\n if(i-j>0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n}\nreturn 0;\n}\nint s(char c){\nif('5'<c&&c<='9')\n return c-'0';\nif(c=='T')\n return 10;\nif(c=='J')\n return 11;\nif(c=='K')\n return 13;\nif(c=='A')\n return 14;\nif(c=='Q')\n return 12;\n}\n\n \t\t \t \t \t \t\t \t \t\t\t\t\t \t \t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,a,b,c,d;\n char str1[3],str2[3],ch;\n scanf(\"%c\",&ch);\n scanf(\"%s%s\",str1,str2);\n if(str1[0]=='T'){\n a=10;\n }\n else if(str1[0]=='J'){\n a=11;\n }\n else if(str1[0]=='Q'){\n a=12;\n }\n else if(str1[0]=='K'){\n a=13;\n }\n else if(str1[0]=='A'){\n a=14;\n }\n else if(str1[0]=='6'){\n a=6;\n }\n else if(str1[0]=='7'){\n a=7;\n }\n else if(str1[0]=='8'){\n a=8;\n }\n else if(str1[0]=='9'){\n a=9;\n }\n else if(str1[0]=='S'){\n a=15;\n }\n else if(str1[0]=='H'){\n a=16;\n }\n else if(str1[0]=='D'){\n a=17;\n }\n else if(str1[0]=='C'){\n a=18;\n }\n\n if(str1[1]=='T'){\n b=10;\n }\n else if(str1[1]=='J'){\n b=11;\n }\n else if(str1[1]=='Q'){\n b=12;\n }\n else if(str1[1]=='K'){\n b=13;\n }\n else if(str1[1]=='A'){\n b=14;\n }\n else if(str1[1]=='6'){\n b=6;\n }\n else if(str1[1]=='7'){\n b=7;\n }\n else if(str1[1]=='8'){\n b=8;\n }\n else if(str1[1]=='9'){\n b=9;\n }\n else if(str1[1]=='S'){\n b=15;\n }\n else if(str1[1]=='H'){\n b=16;\n }\n else if(str1[1]=='D'){\n b=17;\n }\n else if(str1[1]=='C'){\n b=18;\n }\n\n if(str2[0]=='T'){\n c=10;\n }\n else if(str2[0]=='J'){\n c=11;\n }\n else if(str2[0]=='Q'){\n c=12;\n }\n else if(str2[0]=='K'){\n c=13;\n }\n else if(str2[0]=='A'){\n c=14;\n }\n else if(str2[0]=='6'){\n c=6;\n }\n else if(str2[0]=='7'){\n c=7;\n }\n else if(str2[0]=='8'){\n c=8;\n }\n else if(str2[0]=='9'){\n c=9;\n }\n else if(str2[0]=='S'){\n c=15;\n }\n else if(str2[0]=='H'){\n c=16;\n }\n else if(str2[0]=='D'){\n c=17;\n }\n else if(str2[0]=='C'){\n c=18;\n }\n\n if(str2[1]=='T'){\n d=10;\n }\n else if(str2[1]=='J'){\n d=11;\n }\n else if(str2[1]=='Q'){\n d=12;\n }\n else if(str2[1]=='K'){\n d=13;\n }\n else if(str2[1]=='A'){\n d=14;\n }\n else if(str2[1]=='6'){\n d=6;\n }\n else if(str2[1]=='7'){\n d=7;\n }\n else if(str2[1]=='8'){\n d=8;\n }\n else if(str2[1]=='9'){\n d=9;\n }\n else if(str2[1]=='S'){\n d=15;\n }\n else if(str2[1]=='H'){\n d=16;\n }\n else if(str2[1]=='D'){\n d=17;\n }\n else if(str2[1]=='C'){\n d=18;\n }\n if(str1[0]==ch&&str2[0]==ch){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[1]==ch&&str2[1]==ch){\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n }\n if(str1[0]==ch||str1[1]==ch){\n printf(\"YES\\n\");\n return 0;\n }\n else if(str2[0]==ch||str2[1]==ch){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c&&b>d){\n printf(\"NO\\n\");\n return 0;\n }\n\n if((str1[0]=='S'||str1[0]=='H'||str1[0]=='D'||str1[0]=='C')&&(str2[0]!='S'&&str2[0]!='H'&&str2[0]!='D'&&str2[0]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[0]!='S'&&str1[0]!='H'&&str1[0]!='D'&&str1[0]!='C')&&(str2[0]=='S'||str2[0]=='H'||str2[0]=='D'||str2[0]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(a>c){\n printf(\"YES\\n\");\n return 0;\n }\n if(a<c){\n printf(\"NO\\n\");\n return 0;\n }\n if(a==c){\n if((str1[1]=='S'||str1[1]=='H'||str1[1]=='D'||str1[1]=='C')&&(str2[1]!='S'&&str2[1]!='H'&&str2[1]!='D'&&str2[1]!='C')){\n printf(\"YES\\n\");\n return 0;\n }\n if((str1[1]!='S'&&str1[1]!='H'&&str1[1]!='D'&&str1[1]!='C')&&(str2[1]=='S'||str2[1]=='H'||str2[1]=='D'||str2[1]=='C')){\n printf(\"NO\\n\");\n return 0;\n }\n if(b>d){\n printf(\"YES\\n\");\n return 0;\n }\n if(b<d){\n printf(\"NO\\n\");\n return 0;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char trump_in;\n char compare_1[3];\n char compare_2[3];\n int i;\n scanf(\"%c\",&trump_in);\n scanf(\"%s %s\",&compare_1,&compare_2);\n\n if(compare_1[0]=='T')\n compare_1[0]=10;\n else if(compare_1[0]=='J')\n compare_1[0]=11;\n else if(compare_1[0]=='Q')\n compare_1[0]=12;\n else if(compare_1[0]=='K')\n compare_1[0]=13;\n else if(compare_1[0]=='A')\n compare_1[0]=14;\n else\n compare_1[0] = compare_1[0] - '0';\n\n if(compare_2[0]=='T')\n compare_2[0]=10;\n else if(compare_2[0]=='J')\n compare_2[0]=11;\n else if(compare_2[0]=='Q')\n compare_2[0]=12;\n else if(compare_2[0]=='K')\n compare_2[0]=13;\n else if(compare_2[0]=='A')\n compare_2[0]=14;\n else\n compare_2[0] = compare_2[0] - '0';\n\n\n if(compare_1[1]=='S')\n compare_1[1]=4;\n else if(compare_1[1]=='H')\n compare_1[1]=3;\n else if(compare_1[1]=='D')\n compare_1[1]=2;\n else\n compare_1[1]=1;\n\n if(compare_2[1]=='S')\n compare_2[1]=4;\n else if(compare_2[1]=='H')\n compare_2[1]=3;\n else if(compare_2[1]=='D')\n compare_2[1]=2;\n else\n compare_2[1]=1;\n\n if(trump_in=='S')\n trump_in=4;\n else if(trump_in=='H')\n trump_in=3;\n else if(trump_in=='D')\n trump_in=2;\n else\n trump_in=1;\n\n\n if(trump_in==compare_1[1] && trump_in==compare_2[1])\n {\n if(compare_1[0]>compare_2[0])\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n else\n {\n if(compare_1[1]==trump_in)\n {\n printf(\"YES\");\n return 0;\n }\n else if(compare_2[1]==trump_in)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n return 0;\n}\n/****** PCCA -Fri Dec 09 16:39:46 GMT 2011 *******/"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n6 7 8 9 T J Q K A\nS H D C\n*/\n\n/* Devolve o valor da carta em numero inteiro */\nint cardValue(char card) {\n\tif(card == '6') return 6;\n\tif(card == '7') return 7;\n\tif(card == '8') return 8;\n\tif(card == '9') return 9;\n\tif(card == 'T') return 10;\n\tif(card == 'J') return 11;\n\tif(card == 'Q') return 12;\n\tif(card == 'K') return 13;\n\tif(card == 'A') return 14;\n\treturn -1;\n}\n\n/* Devolve 1 se a primeira carta for maior\n\t\t\t0 se for igual cc\n*/\nint isHigher(char first, char second) {\n\tif(cardValue(first) > cardValue(second)) return 1;\n\telse return 0;\n\treturn -1;\n}\n\nint main() {\n\tchar trump;\n\tchar *firstCard;\n\tchar *secondCard;\n\tfirstCard = malloc(2*sizeof(char));\n\tsecondCard = malloc(2*sizeof(char));\n\tscanf(\"%c %s %s\", &trump, firstCard, secondCard);\n\tif(trump == firstCard[1]) {\n\t\tprintf(\"YES\");\n\t}\n\telse if(trump == secondCard[1]) {\n\t\tprintf(\"YES\");\n\t}\n\telse if(firstCard[1] == secondCard[1] && \n\t\t\tisHigher(firstCard[0], secondCard[0])) {\n\t\tprintf(\"YES\");\t\t\n\t}\n\telse {\n\t\tprintf(\"NO\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint power(char,char,char);\nint main()\n{\n char trump,rank1,rank2,suit1,suit2;\n int power1=0,power2=0;\n \n scanf(\" %c\",&trump);\n scanf(\" %c%c %c%c\",&rank1,&suit1,&rank2,&suit2);\n power1=power(trump,rank1,suit1);\n power2=power(trump,rank2,suit2);\n /*printf(\"%d %d\",power1,power2);*/\n if(power1>power2)\n printf(\"YES\");\n else\n printf(\"NO\");\n \n /*printf(\"%c %c %c %c %c\",trump,rank1,suit1,rank2,suit2);*/\n return 0;\n}\nint power(char trump,char rank,char suit)\n{\n int power;\n \n switch(rank)\n {\n case '6':\n power=6;\n break;\n case '7':\n power=7;\n break;\n case '8':\n power=8;\n break;\n case '9':\n power=9;\n break;\n case 'T':\n power=10;\n break;\n case 'J':\n power=11;\n break;\n case 'Q':\n power=12;\n break;\n case 'K':\n power=13;\n break;\n case 'A':\n power=14;\n break;\n }\n if(suit==trump)\n power+=10;\n \n return power;\n}\n/****** PCCA -Tue Oct 18 12:37:27 GMT 2011 *******/"}], "src_uid": "da13bd5a335c7f81c5a963b030655c26"} {"nl": {"description": "Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage.They will be N guests tonight: N\u2009-\u20091 real zombies and a fake one, our Heidi. The living-dead love hierarchies as much as they love brains: each one has a unique rank in the range 1 to N\u2009-\u20091, and Heidi, who still appears slightly different from the others, is attributed the highest rank, N. Tonight there will be a chest with brains on display and every attendee sees how many there are. These will then be split among the attendees according to the following procedure:The zombie of the highest rank makes a suggestion on who gets how many brains (every brain is an indivisible entity). A vote follows. If at least half of the attendees accept the offer, the brains are shared in the suggested way and the feast begins. But if majority is not reached, then the highest-ranked zombie is killed, and the next zombie in hierarchy has to make a suggestion. If he is killed too, then the third highest-ranked makes one, etc. (It's enough to have exactly half of the votes \u2013 in case of a tie, the vote of the highest-ranked alive zombie counts twice, and he will of course vote in favor of his own suggestion in order to stay alive.)You should know that zombies are very greedy and sly, and they know this too \u2013 basically all zombie brains are alike. Consequently, a zombie will never accept an offer which is suboptimal for him. That is, if an offer is not strictly better than a potential later offer, he will vote against it. And make no mistake: while zombies may normally seem rather dull, tonight their intellects are perfect. Each zombie's priorities for tonight are, in descending order: survive the event (they experienced death already once and know it is no fun), get as many brains as possible. Heidi goes first and must make an offer which at least half of the attendees will accept, and which allocates at least one brain for Heidi herself.What is the smallest number of brains that have to be in the chest for this to be possible?", "input_spec": "The only line of input contains one integer: N, the number of attendees (1\u2009\u2264\u2009N\u2009\u2264\u2009109).", "output_spec": "Output one integer: the smallest number of brains in the chest which allows Heidi to take one brain home.", "sample_inputs": ["1", "4"], "sample_outputs": ["1", "2"], "notes": "Note"}, "positive_code": [{"source_code": "#include<stdio.h>\nint main ()\n{\nint n;\nscanf(\"%d\",&n);\nif(n==1)\nprintf(\"1\");\nelse\n{\nif(n%2==0)\nprintf(\"%d\",(n/2));\nif(n%2!=0)\nprintf(\"%d\",((n+1)/2));\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long n,ans;\n\tscanf(\"%lld\",&n);\n\t\tif(n%2==0)\n\t\t\tans=n/2;\n\t\telse\n\t\t\tans=(n/2)+1;\n\t\tprintf(\"%lld\\n\",ans);\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a;\nscanf(\"%lld\",&n);\na=(n+1)/2;\nprintf(\"%lld\",a);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint N;\nscanf(\"%d\",&N);\nif(N%2==0)\n\tprintf(\"%d\",N/2);\nelse\n\tprintf(\"%d\",(N+1)/2);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main() {\n \n long long int n,a;\n \n scanf(\"%I64d\",&n);\n \n a=(n+1)/2;\n \n printf(\"%I64d\\n\",a);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int N;\n\tscanf(\"%lld\",&N);\n\tif(N%2==0)\n\t\tprintf(\"%lld\",N/2);\n\telse\n\t\tprintf(\"%lld\",(N/2)+1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a;\nscanf(\"%lld\",&n);\na=(n+1)/2;\nprintf(\"%lld\",a);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong int a,b;\nscanf(\"%ld\",&a);\nif (a%2==0)\nb=a/2;\nelse \nb=(a/2)+1;\nprintf(\"%ld\",b);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint solution(int n) {\n\tif (n==1) return 1;\n\t\n\tif (n%2==0) {\n\t\treturn n/2;\n\t}\n\t\n\treturn n/2 +1;\n}\n\n\n\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",solution(n));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,n;\n\tscanf(\"%lli\",&n);\n \n\tif(n%2==0)\n\t{\n\t\ta=(n/2);\n\t\tprintf(\"%lli\",a);\n\t}\n\telse\n\t{\n\t\ta=(n+1)/2;\n\t\tprintf(\"%lli\",a);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(n+1)/2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n { \n int n,brain;\n scanf(\"%d\",&n);\n if(n==1)\n brain=1;\n else\n brain=ceil((float)n/2);\n printf(\"%d\",brain);\n return 0;\n }\n "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<limits.h>\nint main(){\n\tint a,b,c,d;\n\tscanf(\"%d\",&a);\n\ta%2==0?printf(\"%d\",a/2):printf(\"%d\",a/2+1);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int num,brains;\nscanf(\"%d\",&num);\n\nif(num&1==0)\nbrains=num/2;\nelse\nbrains=(num+1)/2;\n\nprintf(\"%d\",brains);\n\nreturn(0);}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",(n+1)/2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\nint main()\n{\n long long n;\n scanf(\"%I64d\", &n);\n long long result;\n result = n / 2;\n if(n%2 == 0)\n {\n printf(\"%I64d\", result);\n }\n else\n printf(\"%I64d\", result + 1);\n}\n"}, {"source_code": "#include <stdio.h>\n\nmain(void){\n\t\n\tint n;\n\tscanf(\"%d\", &n);\n\t\n\tif(n==1){\n\t\tprintf(\"1\");\n\t\t}else{\n\t\t\tif(n%2==0){\n\t\t\t\tprintf(\"%d\",(n/2));\n\t\t\t}else{\n\t\t\t\t\tprintf(\"%d\",((n/2)+1));\n\t\t\t\t}\n\t\n\t\n\t}\n\t}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int n;\n \n scanf(\"%d\", &n);\n \n n = (n % 2) ? (n/2 + 1) : (n/2);\n \n printf(\"%d\", n);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint t;\n\tscanf(\"%d\",&t);\n\tprintf(\"%d\",(t+1)/2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf (\"%d\",&n);\n if (n%2==0)\n printf (\"%d\",n/2);\n else\n printf (\"%d\",(n+1)/2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i;\n\tscanf(\"%d\",&n);\n\ti= n%2 ? n/2+1 : n/2;\n\tprintf(\"%d\\n\",i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main (void) {\n\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\\n\", (n+1)/2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int N;\n scanf(\"%d\", &N);\n\n printf(\"%d\\n\", N/2 + (N % 2));\n\n return 0;\n}\n"}, {"source_code": "//Date:10-07-16\n\n#include<stdio.h>\n#define ll unsigned int\nint main(){\n\tll n ,ans;\n\tscanf(\"%u\" ,&n);\n\tif(n==1)\tprintf(\"1\\n\");\n\telse if(n>1){\n\t\tif(n%2!=0)\tans = (n+1)/2;\n\t\telse ans =n/2;\n\t\tprintf(\"%u\" ,ans);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h> \nint main(){ \n int n;\n scanf(\"%d\",&n); \n\tif(n%2)\n\t\tn+=1; \n printf(\"%d\\n\",n/2);\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n double i,j,n,s;\n while(scanf(\"%lf\",&n)!=EOF)\n {\n s=ceil(n/2);\n printf(\"%.lf\\n\",s);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain(void)\n{\n long long int i,j,k,l,m,N,p,q,s,t,w;\n scanf(\"%I64d\",&N);\n if(N>0)\n {\n /* if(N==1)\n {\n printf(\"%I64d\",1);\n }*/\n \n \n if((N%2)==0)\n {\n m=N/2;\n printf(\"%I64d\",m);\n }\n else\n {\n m=N/2;\n printf(\"%I64d\",m+1);\n }\n \n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n while(~scanf(\"%d\",&n) )\n {\n printf(\"%d\\n\",(n+1)/2);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nmain(){\n\tint n;\n\tscanf(\"%d\",&n);\n\n\tprintf(\"%d\", (n+1)/2);\n\nreturn 0;\n}\t\t\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n \n printf(\"%d\\n\",(n+1)/2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n int x;\n scanf(\"%i\",&n);\n if(n%2==0)\n x=n/2;\n else\n x=((n-1)/2)+1;\n printf(\"%i\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n;\n scanf(\"%I64d\",&n);\n if(n%2==0)\n printf(\"%I64d\",n/2);\n else\n printf(\"%I64d\",(n/2)+1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\", (n + 1) / 2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int n, res;\n while (scanf(\"%d\", &n) != EOF){\n res = 1;\n if (n > 1) res = (n + 1) >> 1;\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int input=0;\n scanf(\"%d\", &input);\n if (input%2==1)\n printf(\"%d\\n\",input/2+1);\n else\n printf(\"%d\\n\", input/2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n long n;\n scanf(\"%ld\",&n);\n if(n%2==0)\n printf(\"%ld\",n/2);\n else printf(\"%ld\",n/2 +1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,x;\n scanf(\"%d\",&n);\n x=(n+1)/2;\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\nint main()\n{\n long long n;\n scanf(\"%I64d\", &n);\n long long result;\n result = n / 2;\n if(n%2 == 0)\n {\n printf(\"%I64d\", result);\n }\n else\n printf(\"%I64d\", result + 1);\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main(){\n\tint x;\n\tscanf(\"%d\",&x);\n\tprintf(\"%d\",(x+1)/2);\n}"}, {"source_code": "#include<stdio.h> \n#include<string.h> \nint main() \n{ \n int n; \n while(scanf(\"%d\",&n)!=EOF) \n { \n printf(\"%d\\n\",(n+1)/2); \n } \n return 0; \n} "}, {"source_code": "#include <stdio.h>\nint main(){\n\tlong long a;\n\t\n\tscanf (\"%I64d\", &a);\n\tif (a%2==0)\n\t\tprintf (\"%d\",(a/2));\n\telse printf (\"%d\", (a/2)+1);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long int n;\n while(scanf(\"%ld\",&n)==1)\n {\n if(n%2!=0)\n n++;\n printf(\"%ld\\n\",n/2);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n,ans;\n scanf(\"%d\", &n);\n if(n%2==0)\n ans = n/2;\n else\n ans=n/2+1;\n printf(\"%ld\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",(n+1)/2);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(n&1)?n/2+1:n/2);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n;\n\nint main() {\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\\n\", (n + 1) / 2);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n;\n\n scanf(\"%d\", &n);\n\n if(n==1)\n printf(\"%d\\n\", n);\n else\n {\n n = ceil((double)n/2);\n printf(\"%d\\n\", n);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\nint In=0;\nint A=0;\n\nscanf(\"%d\",&In);\n\nA=In/2;\nif(In==1){\nprintf(\"1\");\n}\nelse if(In%2==0){\nprintf(\"%d\",A);\n}\nelse if(In%2!=0){\nA+=1;\nprintf(\"%d\",A);\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(n+1)/2);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tint inp;\n\tint output;\n\tscanf(\"%d\",&inp);\n\t//output = inp/2;\n\tif (inp%2==0)output=inp/2;\n\telse output=inp/2+1;\n\tprintf(\"%d\", output);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int VicFlag,PeopleNum,FoodNum=1;\n scanf(\"%ld\",&PeopleNum);\n FoodNum=PeopleNum/2;\n if(PeopleNum%2!=0)\n {\n FoodNum++;\n }\n printf(\"%d\\n\",FoodNum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n;\n\n scanf(\"%d\", &n);\n\n if(n==1)\n printf(\"%d\\n\", n);\n else\n {\n n = ceil((double)n/2);\n printf(\"%d\\n\", n);\n }\n\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\\n\",(n%2 == 0) ? n/2 :n/2 + 1);\n}\n"}, {"source_code": "#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint main()\n{\n int i,n;\n scanf(\"%d\",&n);\n if(n==1)printf(\"1\");\n else if(n%2==0) printf(\"%d\",n/2);\n else printf(\"%d\",n/2+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n printf(\"%lld\",((n/2)+(n%2)));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tlong int n,mod,ans;\n\tscanf(\"%ld\",&n);\n\tmod=n%2;\n\tif(mod==1)\n\t\tans=n/2+1;\n\telse\n\t\tans=n/2;\n\tprintf(\"%ld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,x;\n scanf(\"%d\",&n);\n x=(n+1)/2;\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": " #include <stdio.h>\n \n int main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1) >> 1) ;\n return 0;\n }"}, {"source_code": "#include <stdio.h>\n \nint main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1)/2) ;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,a;\n scanf(\"%lld\",&n);\n a=(n+1)/2;\n printf(\"%lld\\n\",a);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n if(x % 2 == 0){\n printf(\"%d\", (x / 2));\n }\n else if(x == 1){\n printf(\"%d\", 1);\n }\n else{\n x = x - 1;\n printf(\"%d\", (x / 2) + 1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n%2==0)\n\t{\n\t\tprintf(\"%d\",n/2);\n\t}\n\telse\n\t{\n\t\tprintf(\"%d\",(n/2)+1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define ll __int64\n\nint main(){\n\tll num;\n\twhile(~scanf(\"%lld\",&num)){\n\t\tnum % 2?printf(\"%lld\\n\",num / 2 + 1) : printf(\"%lld\\n\",num / 2);\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n printf(\"%d\\n\", (n + 1) / 2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"input.txt\",\"r\", stdin);\n\t\tfreopen(\"output.txt\",\"w\", stdout);\n\t#endif\n\tint long long n,count=0;\n\tscanf(\"%lld\",&n);\n\tn--;count++;\n\tcount+=n/2;\n\tprintf(\"%lld\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n;\nscanf(\"%d\",&n);\nif(n%2==0)\nprintf(\"%d\",n/2);\nelse\nprintf(\"%d\",n/2+1);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint N;\nscanf(\"%d\",&N);\nif(N%2==0)\n\tprintf(\"%d\",N/2);\nelse\n\tprintf(\"%d\",(N+1)/2);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n \n printf(\"%d\",(n+1)/2);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d\",(n+1)/2);\n return 0;\n}\n\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main ()\n{\nint n;\nscanf(\"%d\",&n);\nif(n==1)\nprintf(\"1\");\nelse\n{\nif(n%2==0)\nprintf(\"%d\",(n/2));\nif(n%2!=0)\nprintf(\"%d\",((n-1)/2));\n}\nreturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint solution(int n) {\n\tif (n==1) return 1;\n\t\n\treturn n/2;\n\t\n}\n\n\n\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tprintf(\"%d\\n\",solution(n));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a,n;\n\tscanf(\"%lli\",&n);\n \n\tif(n%2==0)\n\t{\n\t\ta=(n*n-2*n+8)/8;\n\t\tprintf(\"%lli\",a);\n\t}\n\telse\n\t{\n\t\ta=(n*n+7)/8;\n\t\tprintf(\"%lli\",a);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint num,brains,a,inp;\nscanf(\"%d\",&inp);\nnum=inp-1;\nif(num%2==0)\n{a=((num/2)*((num/2)+1))/2;}\nelse if(num%2==1)\n{a=(num*num-1)/8;}\nbrains=a+1;\nprintf(\"%d\",brains);\nreturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a;\n\twhile(scanf(\"%d\",&a)!=EOF)\n\t{\n\t\tif(a==1)\n\t\tprintf(\"%d\",a);\n\t\tif(a>1)\n\t\tprintf(\"%d\",a-2);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(void)\n{\n long long int i,k,l,m,N,p,q,s,t,w;\n scanf(\"%I64d\",&N);\n if(N!=0)\n {\n if(N==1)\n {\n printf(\"%I64d\",1);\n }\n else\n {\n if((N%2)==0)\n {\n m=N/2;\n printf(\"%I64d\",m);\n }\n else\n {\n m=N/2;\n printf(\"%I64d\",m+1);\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nmain(void)\n{\n long long int i,j,k,l,m,N,p,q,s,t,w;\n scanf(\"%I64d\",&N);\n if(N!=0)\n {\n if(N==1)\n {\n printf(\"%I64d\",1);\n }\n else\n {\n if((N%2)==0)\n {\n m=N/2;\n printf(\"%I64d\",m);\n }\n else\n {\n m=N/2;\n printf(\"%I64d\",m+1);\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint main(){\n int n, res;\n while (scanf(\"%d\", &n) != EOF){\n res = 1;\n if (n > 1) res = (n) >> 1;\n printf(\"%d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int input=0;\n scanf(\"%d\", &input);\n if (input==1)\n printf(\"1\\n\");\n else\n printf(\"%d\\n\", input/2);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \n#include<string.h> \nint main() \n{ \n int n; \n while(scanf(\"%d\",&n)!=EOF) \n { \n printf(\"%d\\n\",(n)/2); \n } \n return 0; \n} "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long int n;\n scanf(\"%ld\",&n);\n printf(\"%ld\\n\",ceil(n/2));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int n;\n scanf(\"%ld\",&n);\n printf(\"%ld\\n\",n/2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,ans;\n scanf(\"%d\", &n);\n if(n%2==0)\n ans = n/2;\n else\n ans=1+(n-1)/2;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,ans;\n scanf(\"%d\", &n);\n if(n%2==0)\n ans = n/2;\n else\n ans=(n-1)/2;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,ans;\n scanf(\"%d\", &n);\n if(n%2==0)\n ans = n/2;\n else\n ans=(n+1)/2;\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n\n scanf(\"%d\", &n);\n\n if(n==1)\n printf(\"%d\\n\", n);\n else\n {\n n = n/2;\n printf(\"%d\\n\", n);\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\nint In=0;\nint A=0;\n\nscanf(\"%d\",&In);\n\nif(In==1){\nprintf(\"1\");\n}\nelse if(In!=1){\nA=In/2;\nprintf(\"%d\",A);\n}\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\nint In=0;\nint A=0;\n\nscanf(\"%d\",&In);\n\nA=In/2;\nprintf(\"%d\",A);\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tint inp;\n\tint output;\n\tscanf(\"%d\",&inp);\n\toutput = sqrt(inp);\n\tprintf(\"%d\", output);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<conio.h>\nint main()\n{\n int i,n;\n scanf(\"%d\",&n);\n if(n==1)printf(\"1\");\n else printf(\"%d\",n/2);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int num ;\n scanf(\"%d\", &num) ;\n printf(\"%d\", (num+1)%2) ;\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x;\n scanf(\"%d\",&x);\n if(x % 2 == 0){\n printf(\"%d\", (x / 2));\n }\n else if(x == 1){\n printf(\"%d\", 1);\n }\n else{\n x = x - 1;\n printf(\"%d\", (x / 2));\n }\n\n return 0;\n}\n"}], "src_uid": "30e95770f12c631ce498a2b20c2931c7"} {"nl": {"description": "Alice and Bob play a game. Alice has got $$$n$$$ treasure chests (the $$$i$$$-th of which contains $$$a_i$$$ coins) and $$$m$$$ keys (the $$$j$$$-th of which she can sell Bob for $$$b_j$$$ coins).Firstly, Alice puts some locks on the chests. There are $$$m$$$ types of locks, the locks of the $$$j$$$-th type can only be opened with the $$$j$$$-th key. To put a lock of type $$$j$$$ on the $$$i$$$-th chest, Alice has to pay $$$c_{i,j}$$$ dollars. Alice can put any number of different types of locks on each chest (possibly, zero).Then, Bob buys some of the keys from Alice (possibly none, possibly all of them) and opens each chest he can (he can open a chest if he has the keys for all of the locks on this chest). Bob's profit is the difference between the total number of coins in the opened chests and the total number of coins he spends buying keys from Alice. If Bob's profit is strictly positive (greater than zero), he wins the game. Otherwise, Alice wins the game.Alice wants to put some locks on some chests so no matter which keys Bob buys, she always wins (Bob cannot get positive profit). Of course, she wants to spend the minimum possible number of dollars on buying the locks. Help her to determine whether she can win the game at all, and if she can, how many dollars she has to spend on the locks.", "input_spec": "The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n, m \\le 6$$$)\u00a0\u2014 the number of chests and the number of keys, respectively. The second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 4$$$), where $$$a_i$$$ is the number of coins in the $$$i$$$-th chest. The third line contains $$$m$$$ integers $$$b_1, b_2, \\dots, b_m$$$ ($$$1 \\le b_j \\le 4$$$), where $$$b_j$$$ is the number of coins Bob has to spend to buy the $$$j$$$-th key from Alice. Then $$$n$$$ lines follow. The $$$i$$$-th of them contains $$$m$$$ integers $$$c_{i,1}, c_{i,2}, \\dots, c_{i,m}$$$ ($$$1 \\le c_{i,j} \\le 10^7$$$), where $$$c_{i,j}$$$ is the number of dollars Alice has to spend to put a lock of the $$$j$$$-th type on the $$$i$$$-th chest.", "output_spec": "If Alice cannot ensure her victory (no matter which locks she puts on which chests, Bob always has a way to gain positive profit), print $$$-1$$$. Otherwise, print one integer\u00a0\u2014 the minimum number of dollars Alice has to spend to win the game regardless of Bob's actions.", "sample_inputs": ["2 3\n3 3\n1 1 4\n10 20 100\n20 15 80", "2 3\n3 3\n2 1 4\n10 20 100\n20 15 80", "2 3\n3 4\n1 1 4\n10 20 100\n20 15 80"], "sample_outputs": ["205", "110", "-1"], "notes": "NoteIn the first example, Alice should put locks of types $$$1$$$ and $$$3$$$ on the first chest, and locks of type $$$2$$$ and $$$3$$$ on the second chest.In the second example, Alice should put locks of types $$$1$$$ and $$$2$$$ on the first chest, and a lock of type $$$3$$$ on the second chest."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define N\t6\n#define M\t6\n#define B\t(5 * 5 * 5 * 5 * 5 * 5)\n#define INF\t0x3f3f3f3f\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint sum_[B], kk[B][M], p5[M + 1];\n\nvoid init() {\n\tint b, j;\n\n\tp5[0] = 1;\n\tfor (j = 1; j <= M; j++)\n\t\tp5[j] = p5[j - 1] * 5;\n\tfor (b = 0; b < B; b++)\n\t\tfor (j = 0; j < M; j++)\n\t\t\tsum_[b] += kk[b][j] = b / p5[j] % 5;\n}\n\nint main() {\n\tstatic int aa[N], bb[M], cc[N][M], dp[B];\n\tint n, m, i, j, k, l, b, sum, ans;\n\n\tinit();\n\tscanf(\"%d%d\", &n, &m);\n\tsum = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &aa[i]);\n\t\tsum += aa[i];\n\t}\n\tfor (j = 0; j < m; j++) {\n\t\tscanf(\"%d\", &bb[j]);\n\t\tsum -= bb[j];\n\t}\n\tif (sum > 0) {\n\t\tprintf(\"-1\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j < m; j++)\n\t\t\tscanf(\"%d\", &cc[i][j]);\n\tb = 0, sum = 0;\n\tfor (j = m - 1; j >= 0; j--)\n\t\tb = b * 5 + bb[j], sum += bb[j];\n\tmemset(dp, 0x3f, B * sizeof *dp), dp[b] = 0;\n\tfor (i = 0; i < 6; i++) {\n\t\tfor (j = 0; j < 6; j++)\n\t\t\tfor (b = 0; b < B; b++) {\n\t\t\t\tint x = dp[b];\n\n\t\t\t\tif (x == INF)\n\t\t\t\t\tcontinue;\n\t\t\t\tk = kk[b][j];\n\t\t\t\tfor (l = 1; l <= k; l++)\n\t\t\t\t\tdp[b - l * p5[j]] = min(dp[b - l * p5[j]], x + cc[i][j]);\n\t\t\t}\n\t\tsum -= aa[i];\n\t\tfor (b = 0; b < B; b++)\n\t\t\tif (sum_[b] != sum)\n\t\t\t\tdp[b] = INF;\n\t}\n\tans = INF;\n\tfor (b = 0; b < B; b++)\n\t\tans = min(ans, dp[b]);\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "4dc5dc78bda59c1ec6dd8acd6f1d7333"} {"nl": {"description": "One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy.But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully.", "input_spec": "Input data contains the only number n (1\u2009\u2264\u2009n\u2009\u2264\u2009109).", "output_spec": "Output the only number \u2014 answer to the problem.", "sample_inputs": ["10"], "sample_outputs": ["2"], "notes": "NoteFor n = 10 the answer includes numbers 1 and 10."}, "positive_code": [{"source_code": "#include<stdio.h>\n#define N 20\nint main()\n{\n long int n;\n int num[20],i,j,k = 0,count1; /*k\u7528\u6765\u8bb0\u5f55\u8f93\u5165\u6574\u6570\u7684\u4f4d\u6570*/\n while(scanf(\"%ld\",&n) != EOF)\n {\n if(n == 1)\n {\n printf(\"1\\n\");\n continue;\n }\n for(i = 0;i < N;i++)\n {\n num[i] = n % 10;\n n = n / 10;\n k++;\n if(n == 0) break;\n } /*k\u8868\u793a\u4f4d\u6570,\u8fd9\u6837\u505a\u7684\u76ee\u7684\u662f\u5c06\u8f93\u5165\u6574\u6570\u7684\u5404\u4f4d\u6570\u50a8\u5b58\u5728\u4e00\u7ef4\u6570\u7ec4\u4e2d*/\n if(num[k - 1] > 1) /*\u6700\u9ad8\u4f4d\u5927\u4e8e1\u7684\u60c5\u51b5*/\n {\n count1 = Index(k) - 1;\n }\n else\n {\n count1 = Index(k - 1) - 1; /*\u4f4e\u4e00\u4f4d\u53ca\u4ee5\u4e0b\u4e4b\u548c*/\n for(j = k - 2;j > 0;j--) /*k-1\u8868\u793a\u7684\u662f\u6700\u9ad8\u4f4d*/\n {\n if(num[j] == 1)\n {\n count1 = count1 + Index(j);\n }\n if(num[j] > 1)\n {\n count1 = count1 + Index(j + 1);\n break;\n }\n }\n if(j != 0) /*\u4e0a\u8ff0\u5faa\u73af\u975e\u6b63\u5e38\u9000\u51fa*/\n {\n printf(\"%d\\n\",count1);\n k = 0; /*\u6700\u540ek\u8981\u7f6e0*/\n continue;\n }\n if(num[0] == 1||((num[1] == 0||num[1] == 1)&&num[0] > 1)) count1 = count1 + 2;\n if(num[0] == 0) count1 = count1 + 1;\n\n }\n printf(\"%d\\n\",count1);\n k = 0; /*\u6700\u540ek\u8981\u7f6e0*/\n }\n\n return 0;\n}\nint Index(int n) /*\u7528\u4e8e\u6c422^n\u7684\u51fd\u6570*/\n{\n int i,sum = 1;\n for(i = 0;i < n;i++)\n {\n sum = sum * 2;\n }\n return sum;\n}\n/*2015-10-26 23:49:27.847*/"}, {"source_code": "#include <stdio.h>\nint binary(int n)\n{\n\tint g,cnt=1,s=0;\n\twhile (n!=0){\n\t\tg=n%2;\n\t\ts=g*cnt+s;\n\t\tcnt=cnt*10;\n\t\tn=n/2;\n\t\t\n\t}\n\treturn s;\n}\nint main()\n{\n\tint n,i,l;\n\tscanf(\"%d\",&n);\n\tint ara[100000];\n\tfor (i=1;i<=1023;i++){\n\t\tara[i]=binary(i);\n\t}\n\t/*for (i=1;i<=1023;i++){\n\t\tprintf(\"%d \",ara[i]);\n\t}*/\n\tl=0;\n\tfor (i=1;i<=1023;i++){\n\t\tl=l+1;\n\t\tif (ara[i]>n){\n\t\t\tl=l-1;\n\t\t\tbreak;\n\t\t}\n\t\telse if (ara[i]==n){\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\",l);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,c=0,j;\n long long int n,s,t;\n scanf(\"%I64d\",&n);\n for(i=1;i<=1023;i++)\n {\n j=i;\n t=1;\n s=0;\n while(j>0)\n {\n s+=t*(j%2);\n j=j>>1;\n t=t*10;\n }\n if(s>n)\n break;\n c++;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong n,ans=0;\n\nvoid dfs(long long num)\n{\n if(num<=n) ans++;\n if(num>=n) return;\n dfs(num*10);\n dfs(num*10+1);\n}\n\nint main()\n{\n scanf(\"%ld\",&n);\n dfs(1);\n printf(\"%ld\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n int a, b=0, count=1, i, j, sum=0;\n char st[1000];\n scanf(\"%s\", &st);\n for(i=0;st[i];i++){\n a = st[i] - '0';\n if(a>1 && b==0){\n st[i] = '1';\n b=1;\n }\n if(b==1){\n st[i] = '1';\n }\n }\n j = strlen(st);\n for(i=j-1;i>=0;i--){\n a = st[i] - '0';\n sum+= (a*count);\n count*=2;\n }\n printf(\"%d\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint get_count(char *n);\n\nint main(){\n\tchar n[11];\n\tscanf(\"%s\",n);\n\tprintf(\"%d\\n\",get_count(n));\n\treturn 0;\n}\n\nint get_count(char *n){\n\tint i,j, k =1, count = 0;\n\tfor(i = 0; i<strlen(n)-1; i++){\n\t\tcount+=pow(2.0,i);\n\t}\n\t/*for(i= 0; i<strlen(n)-1; i++){\n\t\tif(n[i]>'1'){\n\t\t\tfor(j = i+1; j<strlen(n); j++)\n\t\t\t\tn[j]='9';\n\t\t} else if(i>0 && n[i] == '1'){\n\t\t\tn[i]='0';\n\t\t\tfor(j = i+1; j<strlen(n); j++)\n\t\t\t\tn[j]='9';\n\t\t}\n\t}\n\tk = pow(2.0,strlen(n)-1);\n\tfor(i = 0; i<strlen(n); i++){\n\t\tif(n[i]=='0')\n\t\t\tk/=2;\n\t}\n\tcount+=k;\n\t*/\n\tcount = 0;\n\tfor(i = 0; i<strlen(n); i++){\n\t\tif(n[i]>'1'){\n\t\t\tn[i] = '1';\n\t\t\tfor(j = i+1; j<strlen(n); j++)\n\t\t\t\tn[j] = '1';\n\t\t}\n\t\tif(n[i]!='0')\n\t\t\tcount+=pow(2.0,strlen(n)-i-1);\n\t}\n\treturn count;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",1<<10);\n\tfor (i=1;i<=512;i++) {\n\t\tfor(j=0;j<=9;j++) {\n\t\t\tif ((i&(1<<j))==(1<<j))\n\t\t\t\tsum+=po(10,j);\n\t\t\t\t\n\t\t\t}\n\t\t//printf(\"%d\\n\",sum);\t\n\t\tif(n<sum)\n\t\t\tbreak;\n\t\tsum=0;\t\n\t\t}\n\ti--;\n\tprintf(\"%d\",i);\n\t/*for (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tif((n>10)&&((n%10)==0))\n\t\tprintf(\"%d\",sum+1);\n\telse printf(\"%d\",sum);*/\t\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n, i, k, p = 1, ans = 0;\n scanf(\"%d\", &n);\n for(k = 0; n >= p; k++, p *= 10);\n for(i = k-1; i >= 0; i--) {\n p /= 10;\n if(n/p > 1) {\n ans += (1<<(i+1)) - 1;\n break;\n } else {\n ans += (1<<i)*(n/p);\n }\n n %= p;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,p=0,a[20];\n scanf(\"%d\",&n);\n do{\n a[++p]=n%10;\n n/=10;\n }while(n>0);\n for(i=p;i>0;i--){\n if(a[i]>1)break;\n n=n*2+a[i];\n }\n for(;i>0;i--)n=n*2+1;\n printf(\"%d\\n\",n);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n char n[11];\n scanf(\"%s\", &n);\n\n int i = 0;\n // If any digit transforms to 1, all 0s after that will transform to 1\n int allZeroToOne = 0;\n while(n[i] != '\\0'){\n if(allZeroToOne) n[i] = '1';\n else if(n[i] > '1'){\n n[i] = '1';\n allZeroToOne = 1;\n }\n i++;\n }\n\n int len = i;\n int res = 0;\n\n for(i = 0; i < len; i++){\n if(n[i] == '1') res += pow(2, len - i - 1);\n }\n\n printf(\"%d\\n\", res);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar a[20];\nint num[20],ans=0,len;\nint sum[20],c[20];\n\nvoid pre(){\n\tc[0]=1;//2^i\n\tfor(int i=1;i<=20;++i){\n\t\tc[i]=1;\n\t\tc[i]<<=i;\n\t}\n\tsum[0]=1;\n\tfor(int i=1;i<=20;++i){\n\t\tsum[i]=sum[i-1]+c[i];\n\t}\n}\n\nvoid cal(){\n\tans=0;\n\tint len=strlen(a);\n\tfor(int i=0;i<len;++i){\n\t\tnum[len-i-1]=a[i]-'0';\n\t}\n\tfor(int i=len-1;i>=0;--i){\n\t\tif(num[i]>1){\n\t\t\tans+=sum[i];\n\t\t\tbreak;\n\t\t}\n\t\tif(num[i]==1){\n\t\t\tans+=sum[i-1]+1;\n\t\t}\n\t}\n}\n\nint main(){\n\tpre();\n\tscanf(\"%s\",a);\n\tcal();\n\tprintf(\"%d\",ans);\n} "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint check_nbr(int nb)\n{\n int check=0,ch=0;\n while(nb>0)\n {\n if(nb%10 == 0 || nb%10 == 1)\n check++;\n else\n return(0);\n nb/=10;\n ch++;\n }\n if(ch == check)\n return(1);\n return 0;\n}\nint check_fin(int nb)\n{\n int check=0,ch=0;\n while(nb>0)\n {\n if(nb%10 == 1)\n check++;\n else\n return(0);\n nb/=10;\n ch++;\n }\n if(ch == check)\n return(1);\n return 0;\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i = 1;\n int k = 1;\n int count = 0;\n while(i<=n)\n {\n if(check_nbr(i))\n count++;\n if(check_fin(i))\n {\n k*=10;\n i=k;\n }\n else\n i++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,i,j,k,A[10],s=0;\n scanf(\"%lld\",&n);\n for(i=0;i<10;i++)\n {\n A[i]=n%10;\n n=n/10;\n if(A[i]>1)\n {\n for(j=0;j<=i;j++)\n {\n A[j]=1;\n }\n }\n if(n==0)\n {\n break;\n }\n }\n for(k=0;k<=i;k++)\n {\n if(A[k]==1)\n {\n s=s+(pow(2,k));\n }\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n \nint main()\n{\n int i, j, count=0, ans=0, t=1;\n char s[10];\n scanf(\"%s\", s);\n for(i=0; i<strlen(s); i++)\n {\n if(s[i]>'1')\n {\n for(j=i; j<strlen(s); j++)\n s[j]='1';\n break;\n }\n }\n \n for(i=strlen(s)-1; i>=0; i--)\n {\n if(s[i]=='1')\n ans+=t;\n t*=2;\n }\n \n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nlong long rec(char c[], int i)\n{\n\tif (i == -1) {\n\t\treturn 0;\n\t}\n\tlong long val = 0;\n\tif (c[i] != '0') {\n\t\tif (c[i] > '1')\n\t\t\treturn pow(2, i+1)-1;\n\t\tval = pow(2, i);\n\t}\n\treturn val+rec(c, i-1);\n}\n\nint main()\n{\n\tint n; \n\tscanf(\"%d\", &n);\n\tchar c[32];\n\tint len = 0;\n\twhile (n) {\n\t\tc[len++] = n%10+'0';\n\t\tn /= 10;\n\t}\n\tlong long val = rec(c, len-1);\n\tprintf(\"%I64d\\n\", val);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint n,answer;\nint calc(int a)\n{\n if(a>n) return answer;\n answer++;\n calc(a*10);\n calc(a*10+1);\n return answer;\n}\nint main(void)\n{\n scanf(\"%d\",&n);\n printf(\"%d\\n\",calc(1));\n return 0;\n} "}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint number(int x){\n\n int temp = 0 ;\n int f = 1;\n\n while(x>0){\n temp += x%2 * f;\n x /= 2;\n f *= 10;\n }\n return temp;\n\n}\n\nint main(){\n\n int in;\n scanf(\"%d\",&in);\n int i = 1;\n int count = 0 ;\n while(number(i) <= in){\n i++;\n count++;\n }\n printf(\"%d\",count);\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint number(int x){\n char bin[51200];\n int i =0 ;\n int temp;\n while(x>0){\n bin[i++] = x%2;\n x = x/2;\n }\n temp = 0 ;\n int f = 1;\n int j;\n for(j = 0 ;j < i;j++){\n temp = temp + bin[j]*f;\n f = f*10;\n }\n // printf(\"Temp = %d\\n\",temp);\n return temp;\n\n}\n\nint main(){\n\n int in;\n scanf(\"%d\",&in);\n int i = 1;\n int count = 0 ;\n while(number(i) <= in){\n i++;\n count++;\n }\n printf(\"%d\",count);\n\n\n}\n\n"}, {"source_code": "/* https://codeforces.com/contest/9/submission/18064491 (rainboy) */\n#include <stdio.h>\n\nint convert(int i) {\n\treturn i < 2 ? i : convert(i / 2) * 10 + i % 2;\n}\n\nint main() {\n\tint n, i;\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; convert(i) <= n; i++)\n\t\t;\n\tprintf(\"%d\\n\", i - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, b, i, x, ans;\n\n\tscanf(\"%d\", &n);\n\tans = 0;\n\tfor (b = 1; b < 1024; b++) {\n\t\tx = 0;\n\t\tfor (i = 0; i < 10; i++)\n\t\t\tx = x * 10 + ((b & 1 << i) != 0);\n\t\tif (x <= n)\n\t\t\tans++;\n\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint binary(int n)\n{\n int sum=0,pow=1;\n do{\n sum=sum+pow*(n%2);\n pow=pow*10;\n n=n/2;\n }while(n!=0);\n return sum;\n}\nint main()\n{\n int n,i,ara[513];\n scanf(\"%d\",&n);\n for(i=1;i<=512;i++)\n {\n ara[i]=binary(i);\n }\n for(i=1;i<=512;i++)\n {\n if(ara[i]>=n){\n if(ara[i]>n)\n printf(\"%d\",i-1);\n else if(ara[i]=n)\n printf(\"%d\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n, count, nbr;\n char str[11];\n count = 0;\n scanf(\"%i\", &n);\n if (n > 900000000)\n {\n count = 511;\n while(n > 900000000)\n {\n nbr = n;\n while(nbr > 0)\n {\n if(!(nbr%10 == 0 || nbr%10 == 1))\n break;\n nbr /= 10;\n }\n if(nbr == 0)\n count++;\n n--;\n }\n }\n else if (n > 600000000)\n {\n count = 511;\n while(n > 600000000)\n {\n nbr = n;\n while(nbr > 0)\n {\n if(!(nbr%10 == 0 || nbr%10 == 1))\n break;\n nbr /= 10;\n }\n if(nbr == 0)\n count++;\n n--;\n }\n }\n else\n {\n while(n > 0)\n {\n nbr = n;\n while(nbr > 0)\n {\n if(!(nbr%10 == 0 || nbr%10 == 1))\n break;\n nbr /= 10;\n }\n if(nbr == 0)\n count++;\n n--;\n }\n }\n printf(\"%i\\n\", count);\n return(0);\n}"}, {"source_code": " #include <stdio.h>\n #include <math.h>\n #define LL long long \n LL int a,b,s,i,j,d;\n int ba [15];\n LL int oz[512];\n\n void tabansal(long long int a)\n {\n int b=9,c=9,t=2,k=0;\n long long int d=0;\n while(a!=0)\n {\n if(a>=pow(t,b)){a-=pow(t,b);d+=pow(10,c);c--;b--;}\n else{c--;b--;}\n }\n oz[i]=d;\n i++;\n }\n\n void hazrla()\n {\n long long int a;\n int b,c;\n a=1;\n b=2;\n while(a!=513)\n {tabansal(a);a++;}\n }\n\n void bak()\n {\n for(int j=0;j<a;j++)\n {\n if(a>=oz[j]){s++;}\n else{break;}\n }\n }\n \n int main()\n {\n // freopen(\"in.txt\",\"r\",stdin);\n // freopen(\"out.txt\",\"w\",stdout);\n scanf(\"%lld\",&a);\n if(a==1000000000)\n printf(\"512\");\n else\n {\n hazrla();\n bak();\n printf(\"%lld\",s);\n }\n }"}, {"source_code": "#include <stdio.h>\n#define LL long long \nLL int a,b,s,i,j,d;\nint ba [15];\nLL int oz[]={1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,10010,10011,10100,10101,10110,10111,11000,11001,11010,11011,11100,11101,11110,11111,100000,100001,100010,100011,100100,100101,100110,100111,101000,101001,101010,101011,101100,101101,101110,101111,110000,110001,110010,110011,110100,110101,110110,110111,111000,111001,111010,111011,111100,111101,111110,111111,1000000,1000001,1000010,1000011,1000100,1000101,1000110,1000111,1001000,1001001,1001010,1001011,1001100,1001101,1001110,1001111,1010000,1010001,1010010,1010011,1010100,1010101,1010110,1010111,1011000,1011001,1011010,1011011,1011100,1011101,1011110,1011111,1100000,1100001,1100010,1100011,1100100,1100101,1100110,1100111,1101000,1101001,1101010,1101011,1101100,1101101,1101110,1101111,1110000,1110001,1110010,1110011,1110100,1110101,1110110,1110111,1111000,1111001,1111010,1111011,1111100,1111101,1111110,1111111,10000000,10000001,10000010,10000011,10000100,10000101,10000110,10000111,10001000,10001001,10001010,10001011,10001100,10001101,10001110,10001111,10010000,10010001,10010010,10010011,10010100,10010101,10010110,10010111,10011000,10011001,10011010,10011011,10011100,10011101,10011110,10011111,10100000,10100001,10100010,10100011,10100100,10100101,10100110,10100111,10101000,10101001,10101010,10101011,10101100,10101101,10101110,10101111,10110000,10110001,10110010,10110011,10110100,10110101,10110110,10110111,10111000,10111001,10111010,10111011,10111100,10111101,10111110,10111111,11000000,11000001,11000010,11000011,11000100,11000101,11000110,11000111,11001000,11001001,11001010,11001011,11001100,11001101,11001110,11001111,11010000,11010001,11010010,11010011,11010100,11010101,11010110,11010111,11011000,11011001,11011010,11011011,11011100,11011101,11011110,11011111,11100000,11100001,11100010,11100011,11100100,11100101,11100110,11100111,11101000,11101001,11101010,11101011,11101100,11101101,11101110,11101111,11110000,11110001,11110010,11110011,11110100,11110101,11110110,11110111,11111000,11111001,11111010,11111011,11111100,11111101,11111110,11111111,100000000,100000001,100000010,100000011,100000100,100000101,100000110,100000111,100001000,100001001,100001010,100001011,100001100,100001101,100001110,100001111,100010000,100010001,100010010,100010011,100010100,100010101,100010110,100010111,100011000,100011001,100011010,100011011,100011100,100011101,100011110,100011111,100100000,100100001,100100010,100100011,100100100,100100101,100100110,100100111,100101000,100101001,100101010,100101011,100101100,100101101,100101110,100101111,100110000,100110001,100110010,100110011,100110100,100110101,100110110,100110111,100111000,100111001,100111010,100111011,100111100,100111101,100111110,100111111,101000000,101000001,101000010,101000011,101000100,101000101,101000110,101000111,101001000,101001001,101001010,101001011,101001100,101001101,101001110,101001111,101010000,101010001,101010010,101010011,101010100,101010101,101010110,101010111,101011000,101011001,101011010,101011011,101011100,101011101,101011110,101011111,101100000,101100001,101100010,101100011,101100100,101100101,101100110,101100111,101101000,101101001,101101010,101101011,101101100,101101101,101101110,101101111,101110000,101110001,101110010,101110011,101110100,101110101,101110110,101110111,101111000,101111001,101111010,101111011,101111100,101111101,101111110,101111111,110000000,110000001,110000010,110000011,110000100,110000101,110000110,110000111,110001000,110001001,110001010,110001011,110001100,110001101,110001110,110001111,110010000,110010001,110010010,110010011,110010100,110010101,110010110,110010111,110011000,110011001,110011010,110011011,110011100,110011101,110011110,110011111,110100000,110100001,110100010,110100011,110100100,110100101,110100110,110100111,110101000,110101001,110101010,110101011,110101100,110101101,110101110,110101111,110110000,110110001,110110010,110110011,110110100,110110101,110110110,110110111,110111000,110111001,110111010,110111011,110111100,110111101,110111110,110111111,111000000,111000001,111000010,111000011,111000100,111000101,111000110,111000111,111001000,111001001,111001010,111001011,111001100,111001101,111001110,111001111,111010000,111010001,111010010,111010011,111010100,111010101,111010110,111010111,111011000,111011001,111011010,111011011,111011100,111011101,111011110,111011111,111100000,111100001,111100010,111100011,111100100,111100101,111100110,111100111,111101000,111101001,111101010,111101011,111101100,111101101,111101110,111101111,111110000,111110001,111110010,111110011,111110100,111110101,111110110,111110111,111111000,111111001,111111010,111111011,111111100,111111101,111111110,111111111,1000000000};\nvoid bak()\n{\n\tfor(int j=0;j<a;j++)\n\t{\n\t\tif(a>=oz[j]){s++;}\n\t\telse{break;}\n\t}\n}\n\nint main()\n{\n\t// freopen(\"in.txt\",\"r\",stdin);\n\t// freopen(\"out.txt\",\"w\",stdout);\n\tscanf(\"%lld\",&a);\n\tbak();\n\tprintf(\"%lld\",s);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\\n\",&n);\n\tint b=0;\n\tint i=0;\n\twhile (n) {\n\t\tint d=n%10;\n\t\tn/=10;\n\t\tif (d>1) b=(1<<i+1)-1;\n\t\telse b|=d<<i;\n\t\ti++;\n\t}\n\tprintf(\"%i\\n\",b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint num[515];\nint cou=0;\nvoid dfs(int init,int digit){\n if(digit==9){\n num[cou++]=init;\n return ;\n }\n dfs(init*10,digit+1);\n dfs(init*10+1,digit+1);\n}\nint cmp(const void *a,const void *b){\n return (*(int *)a)-(*(int *)b);\n}\nint main(void){\n dfs(0,0);\n qsort(num,cou,sizeof(int),cmp);\n int i,n;\n scanf(\"%d\",&n);\n num[512]=1000000000;\n for(i=1;i<513;i++){\n if(num[i]>n) break;\n }\n printf(\"%d\\n\",i-1);\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[11],b[11];\n int i,p,x,sum;\n while(~scanf(\"%d\",&x))\n {\n memset(a,'0',sizeof(a));\n memset(b,'0',sizeof(b));\n i=9,a[10]='\\0',b[10]='\\0',b[9]='1',sum=0;\n while(x)\n {\n a[i--]=x%10+'0';\n x/=10;\n }\n while(strcmp(a,b)>=0)\n {\n sum++;\n b[9]++;\n for(p=9;p>0;p--)\n if(b[p]>'1')\n b[p]='0',b[p-1]++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint tot=0;\n\nvoid getNum(long long num,long long n)\n{\n\tif(num>n)\n\t\treturn;\n\ttot++;\n\tnum=num*10;\n\tgetNum(num+1,n);\n\tgetNum(num,n);\n}\nint main()\n{\n long long n;\n scanf(\"%lld\",&n);\n getNum(1,n);\n printf(\"%d\",tot);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint binary(int n){\n int b=0,m=1;\n\n while(n>0){\n b+=(n%2)*m;\n n=n/2;\n m=m*10;\n }\n return b;\n\n}\n\nint main(){\n int a,b,i;\n\n scanf(\"%d\",&a);\n i=0;\n //printf(\"%d\",binary(a));\n\n for(b=1;binary(b)<=a;b++){\n \n i++;\n }\n printf(\"\\n%d\",i);\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n/*\u2500\u2500\u2500\u2584\u2580\u2580\u2580\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2580\u2580\u2580\u2584\u2500\u2500\u2500\n \u2500\u2500\u2500\u2588\u2592\u2592\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2592\u2592\u2588\u2500\u2500\u2500\n \u2500\u2500\u2500\u2500\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2588\u2500\u2500\u2500\u2500\n \u2500\u2584\u2584\u2500\u2500\u2588\u2591\u2591\u2591\u2580\u2588\u2580\u2591\u2591\u2591\u2588\u2500\u2500\u2584\u2584\u2500\n \u2588\u2591\u2591\u2588\u2500\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2500\u2588\u2591\u2591\u2588*/\n\nint main(){\n\n\tchar n[1000000];\n\n\tscanf(\"%s\",n);\n\n\tint len = strlen(n), on, i, c = 0;\n\n \tint ans = 0, f = 0;\n\n \tfor(i = 0; n[i]; i++){\n\n \tif(n[i] > '1'){f = 1;}\n\n \tif(f){ans += pow(2, len - 1);}\n\n\t\telse if(n[i] != '0'){\n \t\tans += pow(2, len - 1);\n\t\t}\n\n \tlen--;\n }\n\n printf(\"\\n%d\", ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n#define MAX 10\n\nunsigned long long int arrayToInteger (int *a, int k) {\n\tunsigned long long int r = 0;\n\tint i;\n\n\tfor (i = k - 1; i >= 0; i--)\n\t\tr = r * 10 + a[i];\n\n\treturn r;\n}\n\nbool is_a_solution (int *a,int k,long long int n) {\n\tif (arrayToInteger(a, k) > n) return false;\n\telse return true;\n}\n\nvoid backtrack (int *a, int k, int c, int *p, long long int n) {\n\tint i;\n\tif (k == c) {\n\t\tif (is_a_solution(a, k, n))\n\t\t\t(*p)++;\n\t}\n\n\telse {\n\t\tfor (i = 0; i < 2; i++)\n\t\t{\n\t\t\ta[k] = i;\n\t\t\tbacktrack(a, k+1, c, p, n);\n\t\t}\n\t}\n}\n\nint main (void) {\n\tlong long int n;\n\tint hexa = -1;\n\tint a[MAX] = {0};\n\n\tscanf (\"%lld\", &n);\n\tlong long int tmp = n;\n\tint c = 0;\n\n\twhile (tmp != 0) {\n\t\tc++;\n\t\ttmp /= 10;\n\t}\n\t\n\tbacktrack(a, 0, c, &hexa, n);\n\n\tprintf(\"%d\\n\", hexa);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n sum=1;\n k=d-1;\n m=1;\n while(k--)\n {\n sum*=2;\n m*=10;\n }\n sum--;\n n=atoi(ch);\n max=m;\n min=m;\n while(d--)\n {\n max+=(m/10);\n m/=10;\n }\n //printf(\"%d %d\\n\",max,min);\n if(n>max)\n {\n printf(\"%d\",(sum+1)*2-1);\n return 0;\n }\n for(i=min;i<=max;i++)\n {\n if(i>n)\n break;\n c=result(i);\n sum+=c;\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint check(int n)\n{\n int a,b,c;\n while(n!=0)\n {\n a=n%10;\n if(a==1 || a==0)\n {\n n/=10;\n continue;\n }\n else return(0);\n }\n return(1);\n}\nint main()\n{\n int n,ni=0,i,j,K[100],k=1,c=1,l,m,a,b,C[100],ans=1;\n scanf(\"%d\",&n);\n a=n;\n while(a!=0)\n {\n ni++;\n a/=10;\n }\n for(i=1;i<=ni-1;i++)\n {\n k*=10;\n K[i-1]=k;\n c=c*10+1;\n C[i-1]=c;\n }\n for(i=0;i<ni-1;i++)\n {\n if(C[i]<n)\n {\n for(j=K[i];j<=C[i];j++)\n {\n if(check(j)==1)\n ans++;\n }\n }\n else\n for(j=K[i];j<=n;j++)\n {\n if(check(j)==1)\n ans++;\n }\n }\n printf(\"%d\",ans);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,s,r;\n scanf(\"%I64d\",&n);\n int i,c=0,j;\n for(i=1;i<=1023;i++)\n {\n j=i;r=1;s=0;\n while(j>0)\n {\n s=s+r*(j%2);\n j=j/2;\n r=r*10;\n }\n if(s<=n)\n c++;\n else\n break;\n }\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i, j, count=0, ans=0, t=1;\n char s[10];\n scanf(\"%s\", s);\n for(i=0; i<strlen(s); i++)\n {\n if(s[i]>'1')\n {\n for(j=i; j<strlen(s); j++)\n s[j]='1';\n break;\n }\n }\n \n for(i=strlen(s)-1; i>=0; i--)\n {\n if(s[i]=='1')\n ans+=t;\n t*=2;\n }\n\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a,ans=0,c=0,count=0,num,n,i,j,arr[11],ar[11];\n\tscanf(\"%d\", &n);\n\tnum=n;\n\twhile(num != 0)\n\t{\n\t\tnum=num/10;\n\t\tcount++;\n\t}\n\tnum=n;\n//\tprintf(\"count=%d\\n\",count);\n\ti = count-1;\n\twhile(num != 0)\n\t{\n\t\ta=num%10;\n//\t\tprintf(\"a=%d\\n\", a);\n\t\tar[i] = a;\n//\t\tprintf(\"i=%d ar[i]=%d\\n\",i,ar[i]);\n\t\ti--;\n\t\tnum=num/10;\n\t}\n\tfor(i=0; i<count; i++)\n\t{\n\t\tif(ar[i]==1 || ar[i]==0)\n\t\t{\n\t\t\tarr[i] = ar[i];\n\t//\t\tnum = num/10;\n\t//\t\ti--;\n\t\t}\n\t\telse if(ar[i]>1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=i; j<count; j++)\n\t{\n\t\tarr[j] = 1;\n\t}\n\tfor(i=count-1; i>=0; i--)\n\t{\n\t\tif(arr[i] == 1)\n\t\t{\n\t\t\tans = ans+pow(2,count-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\\n\", ans);\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nlong long arr[1000001];\nchar str[1000001];\nint func(const void *a, const void *b)\n{\n\treturn (*(int*)a-*(int*)b);\n}\nlong long max(long long a, long long b)\n{\n\treturn (a>b)?a:b;\n}\nlong long min(long long a, long long b)\n{\n\treturn (a>b)?b:a;\n}\nint main()\n{\n\tlong long int n, i, len, j, k, count=0, ans=0;\n\tscanf(\"%s\",str);\n\tlen=strlen(str);\n\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tcount=count+pow(2,len-1-i);\n\t\telse if(str[i]-'0'>=2)\n\t\t\tbreak;\n\t}\n\tans=pow(2,len)-1;\n\tprintf(\"%lld\\n\",ans-count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int ans=0,n;\nlong long int rec(long long int j)\n{\n if(j>n)return;\n ans++;\n rec(10*j);rec(10*j+1);\n}\nint main()\n{\nlong long int i; \n scanf(\"%I64d\",&n);rec(1);\n printf(\"%I64d\",ans);\nreturn 0; \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\n\nint main()\n{\n int n, x = 1, p = 0, q = 1, i, j;\n int a[2000] = {1};\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < 9; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10;\n\t a[x++] = a[j] * 10 + 1;\n\t }\n\n\t p = q; q = x;\n }\n\n for (i = 0; i < x; i++) {\n\t if (a[i] > n) break;\n }\n\n printf(\"%d\\n\", i);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint x,cont; // couldnt type count for some reason\nint waw(int n){\n if(x<n)\n return 0;\n cont++;\n waw(n*10);\n waw((n*10)+1);\n return cont;\n\n}\nint main(){\n scanf(\"%d\",&x);\n printf(\"%d\",waw(1));\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n#include<math.h>\n\nint main(){\n\tint digits[11],n,totaldigits,cpy,i,total;\n\tscanf(\"%d\",&n);\n\ttotaldigits=0;\n\tcpy=n;\n\twhile(cpy){\n\t\tdigits[10-totaldigits]=cpy%10;\n\t\ttotaldigits++;\n\t\tcpy=cpy/10;\n\t}\n\ttotal=(int)pow((long double)2,totaldigits);\n\tfor(i=totaldigits;i>=1;i--){\n\t\tif(digits[11-i]>1){\n\t\t\tbreak;\n\t\t}\n\t\tif(digits[11-i]<1){\n\t\t\ttotal=total-(int)(pow((long double)2,(i-1)));\n\t\t}\n\t}\n\t\n\tprintf(\"%d\\n\",total-1);\n//\tgetch();\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint n;\nint getNum(int x)\n{\n\tint p,ret = 0;\n\tfor(p=1;x;x>>=1,p*=10) ret += (x&1)*p;\n\treturn ret;\n}\nint main()\n{\n\tint i;\n\tscanf(\"%d\",&n);\n\tfor(i=1;getNum(i)<=n;i++);\n\tprintf(\"%d\",i-1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[12];\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tint i;\n\tint sum=0;\n\tint t=1;\n\tint flag=0;\n\tfor(i=0;i<l;i++)\n\t{\n\n\t\tint c=s[i]-'0';\n\t\tif(c>1&&flag==0)\n\t\t{\ts[i]='1';flag=1;\n\t\t}\n\t\tif(flag==1)\n\t\t\ts[i]='1';\n\t}\n//\tprintf(\"%s\\n\",s);\n\tfor(i=l-1;i>=0;i--)\n\t{\n\t\tsum=sum+t*(s[i]-'0');\n\t\tt=t*2;\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n#include <math.h>\n\nint ndigit( long long n ) {\n int cnt = 0;\n \n while( n ) {\n cnt++;\n n /= 10;\n }\n \n return cnt;\n}\n\nbool isDec( long long n ) {\n int r;\n \n while( n ) {\n r = n % 10;\n if( r != 1 && r != 0 ) return false;\n n /= 10;\n }\n \n return true;\n}\n\nint main( void ) {\n long long n;\n long long cnt = 0;\n int i;\n \n scanf(\"%lld\", &n);\n int nd = ndigit(n);\n \n cnt = pow(2, nd-1) - 1;\n \n long long nn = 0;\n for( i = 0; i < nd; i++ )\n nn = nn * 10 + 1;\n \n \n for( i = pow(10, nd-1); i <= n; i++ ) {\n if( isDec(i) )\n cnt++;\n \n if( i > nn ) break;\n }\n \n printf(\"%lld\\n\", cnt);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint digit[ 15 ] ;\n\nint digit_count( int p )\n{\n if ( p == 0 ) return 0 ;\n return 1 + digit_count( p /10 ) ;\n}\n\nint pw( int q )\n{\n if (q == 0) return 1 ;\n\n return 2 * pw( q - 1 ) ;\n}\n\nvoid digit_store( int g )\n{\n int h = 0 ;\n while ( g > 0 )\n {\n digit[h] = g%10 ;\n g = g / 10 ;\n h++ ;\n\n\n }\n\n return ;\n\n\n}\n\nint n , x, y , r , i, j, c ;\n\nint main()\n{\n\n scanf(\"%d\" , &n) ;\n\n x = digit_count(n ) ;\n digit_store(n ) ;\n\n\n // printf(\"%d \\n\", x) ;\n\n\n\n for( i = x-1 ; i > -1 ; i--)\n {\n if( digit[i] > 1 )\n {\n\n break ;\n }\n }\n\n for( i = i ; i > -1 ; i-- )\n {\n digit[i] = 1 ;\n }\n\n n = 0 ;\n\n for ( i = x - 1 ; i > -1 ; i-- )\n {\n n = n * 2 + digit[i] ;\n }\n\n\n\n printf(\"%d\" , n) ;\n\n\n\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint d[10];\n\nint digit(int n) {\n int len = 0;\n while (n) {\n d[len ++] = n % 10;\n n /= 10;\n }\n return len;\n}\n\nvoid func(int n) {\n int i, j, len, ans = 0;\n len = digit(n);\n for (i = 1; i < len; i ++) {\n ans += (1 << (i - 1));\n }\n for (i = len - 1; i >= 0; i --) {\n if (d[i] > 1) {\n if (i == len - 1) {\n ans += (1 << i);\n }\n else {\n ans += (1 << (i + 1));\n }\n break;\n }\n else if (d[i] == 1 && i != len - 1) {\n ans += (1 << i);\n }\n }\n if (i < 0) {\n ans ++;\n }\n printf(\"%d\\n\", ans);\n}\n\nint main() {\n int n;\n while (scanf(\"%d\", &n) == 1) {\n func(n);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint power(int i) {\n int s;\n\tint k;\n s = 1;\n for (k = 0;k < i;k++,s*=10);\n\treturn(s);\n}\n \n\nint main() {\n int n;\n scanf(\"%d\",&n);\n\tint x = 0, k = 1, t;\n\tint i = 0;\n\twhile (x <= n) {\n\t k = i;\n\t\tt = 0;\n\t\tx = 0;\n\t while (k != 0) {\n\t\t x += (k%2)*power(t);\n if (k > 1) k = k/2;\n\t\t\telse k = 0;\n\t\t\tt++;\n }\n\t\ti++;\n }\n\tprintf(\"%d\",i-2);\n\treturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{\n int t,i;\n ll array[1024];\n array[1] = 0;\n ll tmp,tmp1,n;\n array[1] = 1;\n int curr = 1;\n int in = 2;\n while(in<1026)\n {\n tmp = array[curr]*10+0;\n tmp1 = array[curr]*10+1;\n array[in] = tmp;\n in++;\n array[in] = tmp1;\n in++;\n //printf(\"%lld %lld\\n\",tmp,tmp1);\n curr++;\n }\n scanf(\"%lld\",&n);\n int count = 0;\n for(i=1;i<=1024;i++)\n {\n if(n>=array[i])\n {\n count++;\n }\n }\n printf(\"%d\\n\",count);\n return 0;\n} "}, {"source_code": "#include <stdio.h>\n\nint convert(int m) {\n\treturn m < 2 ? m : convert(m / 2) * 10 + m % 2;\n}\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d\", &n);\n\tfor (m = 0; convert(m) <= n; m++)\n\t\t;\n\tprintf(\"%d\\n\", m - 1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint binary(int n) {\n\tint m, a;\n\n\tfor (m = 1; m <= n; m *= 2)\n\t\t;\n\ta = 0;\n\twhile (m > 0) {\n\t\ta *= 10;\n\t\tif (n >= m) {\n\t\t\tn -= m;\n\t\t\ta++;\n\t\t}\n\t\tm /= 2;\n\t}\n\treturn a;\n}\n\nint main() {\n\tint n, m;\n\n\tscanf(\"%d\", &n);\n\tfor (m = 1; ; m++)\n\t\tif (binary(m + 1) > n)\n\t\t\tbreak;\n\tprintf(\"%d\\n\", m);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,count=0;\nint binary(int m)\n{\n if(m>n)\n return 0;\n else\n count++;\n binary(m*10); \n binary(m*10+1);\n}\nint main()\n{\n scanf(\"%d\",&n);\n binary(1);\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\\n\",&n);\n\tint b=0;\n\tint i=0;\n\twhile (n) {\n\t\tint d=n%10;\n\t\tn/=10;\n\t\tif (d>1) b=(1<<i+1)-1;\n\t\telse b|=d<<i;\n\t\ti++;\n\t}\n\tprintf(\"%i\\n\",b);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,ans;\nint fun(int a)\n{\n if(a>n) return ;\n ans++;\n fun(a*10);\n fun(10*a+1);\n}\nint main()\n{\n\tscanf(\"%d\",&n);\n\tfun(1);\n\tprintf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n char n[12];\n scanf(\"%s\",n);\n int l=strlen(n),i;\n double d;\n d=pow(2,l)-1;\n for(i=0;i<l;i++) {\n if(n[i]>'1') {\n break;\n }\n else if(n[i]=='0') {\n d-=pow(2,l-1-i);\n }\n }\n printf(\"%0.0lf\\n\",d);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint dec(int m) {\n int shift = 1;\n int result = 0;\n\n while (m) {\n result += (m & 1) * shift;\n m = m >> 1;\n shift *= 10;\n }\n\n return result;\n}\n\nint main() {\n unsigned int n;\n\n scanf(\"%d\", &n);\n\n {\n int u = 1 << 9;\n\n while (dec(u) > n)\n --u;\n\n printf(\"%d\", u);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\n\tchar str[11],res[11];\n\tlong int i=0,dec=0,len=0,flag=0;\n\tscanf(\"%s\",str);\n\twhile(str[i++]!='\\0'){\n\t\t++len;\n\t}\n\tfor(i=0;i<len;i++){\n\t\tif(flag){\n\t\t\tres[i]='1';\n\t\t}\n\t\telse{\n\t\t\tif(str[i]=='0'||str[i]=='1'){\n\t\t\t\tres[i]=str[i];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tres[i]='1';\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t}\n\tres[i]='\\0';\n\tfor(i=len-1;i>=0;i--){\n\t\tdec+=(res[i]-'0')*(1<<(len-i-1));\n\t}\n\tprintf(\"%ld\",dec);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\n\tchar str[11];\n\tlong int i=0,dec=0,len=0,flag=0;\n\tscanf(\"%s\",str);\n\twhile(str[i++]!='\\0'){\n\t\t++len;\n\t}\n\tfor(i=0;i<len;i++){\n\t\tif(flag){\n\t\t\tstr[i]='1';\n\t\t}\n\t\t\telse if(str[i]!='0'&&str[i]!='1'){\n\t\t\t\tstr[i]='1';\n\t\t\t\tflag=1;\n\t\t\t}\n\t}\n\tfor(i=len-1;i>=0;i--){\n\t\tdec+=(str[i]-'0')*(1<<(len-i-1));\n\t}\n\tprintf(\"%ld\",dec);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define gc getchar()\nint main(){\n long long ans = 0, P = 1e9+7, f=0, c;\n for(c=gc;c!='\\n';f=f|(c>'1'),ans=f?((ans<<1)|1)%P:((ans<<1)|(c-'0'))%P,c=gc);\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N, i, j;\n int A[513];\n char Str[11];\n for(i = 1; i <= (1 << 9); ++i) {\n j = 0;\n N = i;\n while(N) {\n Str[j++] = N & 1;\n N >>= 1;\n }\n A[i] = 0;\n for(--j; j >= 0; --j) {\n A[i] *= 10;\n A[i] += Str[j];\n }\n }\n scanf(\"%d\", &N);\n for(i = 512; i >= 0; --i) {\n if(N >= A[i]) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//1\n//10 11\n//100 101\n//110 111\n//1000 1001\n//1010 1011\n//1100 1101\n//1110 1111\n//10000 10001\nint digit(int n){\n int count=0;\n while(n>0){\n count++;\n n=n/10;\n }\n return count;\n}\nint main() {\n //\u60f3\u6cd5\u4e00\uff0c\u76f4\u63a5\u5224\u65ad\n int n;\n scanf(\"%d\",&n);\n int i;\n int number[11];\n number[0]=0;\n number[1]=1;\n i=2;\n int two=2;\n while(i<11){\n number[i]=number[i-1]+two;\n two=two*2;\n i++;\n }\n int ndigit=digit(n);\n int ten=1;\n int nten=ndigit-1;\n while(nten>0){\n ten=ten*10;\n nten--;\n }\n int one=1;\n int none=ndigit;\n while(none>1){\n one=one*10+1;\n none--;\n }\n //printf(\"%d\\n\",one);\n\n int count=0;\n //\u8fd9\u6837\u505a\u53ef\u4ee5\u51cf\u5c11\u5f88\u591a\u5de5\u4f5c\u91cf\n //\u8fd8\u53ef\u4ee5\u8fdb\u4e00\u6b65\u51cf\u5c11\u5de5\u4f5c\u91cf\u5c31\u662f\u53ea\u5dee\u627e\u523011111\n for(i=ten;i<=n && i<=one;i++){\n int all01=1;\n int m=i;\n while(m>0){\n if(!(m%10==1 || m%10==0)){\n all01=0;\n break;\n }\n m=m/10;\n }\n if(all01){\n //printf(\"i=%d\\n\",i);\n count++;\n }\n }\n printf(\"%d\\n\",number[ndigit-1]+count);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nunsigned long step(unsigned long int number);\n\nint main()\n{\n unsigned long int i = 1, number, good = 0;\n scanf(\"%lu\", &number);\n while(i<=number){\n// printf(\"%lu\\n\", i);\n i = step(i);\n good++;\n }\n\n printf(\"%lu\", good);\n return 0;\n}\n\nunsigned long int step(unsigned long int number){\n unsigned long int numbercpy = number;\n if(number%10 == 0)\n return numbercpy+1;\n else{ /* 1-re v\u00e9gz\u00f5dik */\n number += 9; numbercpy += 9;\n int good = 0;\n while(!good){\n unsigned long int mult = 1;\n while(!(number%10)){\n number /= 10;\n mult *= 10;\n }\n if(number%10 == 1)\n good = 1;\n else{\n numbercpy += 8*mult;\n number = numbercpy;\n }\n }\n return numbercpy;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n, cnt = 0, i;\n\tscanf(\"%d\", &n);\n\tfor(i = 1; i <= n; i++)\t\n\t{\n\t\tint tmp = i, pow = 1, bin = 0;\n\t\twhile(tmp > 0)\n\t\t{\n\t\t\tbin += pow*(tmp&1);\n\t\t\tpow *= 10;\n\t\t\ttmp >>= 1;\n\t\t}\n\t\tif(bin <= n) cnt++;\n\t\telse break;\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void)\n{\n char num[105];\n gets(num);\n int lenth;\n lenth = strlen(num);\n int i, j;\n for(i = 0; i < lenth; i++){\n if(num[i] > '1')\n for(j = i; j < lenth; j ++ )\n num[j] = '1';\n }\n int a = 1;\n int ans = 0;\n for(i = lenth - 1; i >= 0; i--){\n ans += (num[i] - '0') * a;\n a = a * 2;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint stob(char *p)\n{\n int sum = 0;\n while( *p != '\\0' )\n sum = (sum<<1) + *p++ - '0';\n return sum;\n}\nint main(void)\n{\n char str[11];\n scanf(\"%s\",str);\n \n char nstr[11];\n strcpy(nstr,str);\n \n char *p = str, *q = nstr;\n while( *p != '\\0' )\n {\n if( *p == '0' || *p == '1')\n\t*q++ = *p++;\n else\n\t{\n\t while( *q != '\\0' )\n\t *q++ = '1';\n\t break;\n\t}\n }\n int ans = stob(nstr);\n printf (\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint* powTen;\nint* powTwo;\nint correct(char* s)\n{\n int i,j,res,flag;\n res = 0;\n flag = 0;\n for(i=0;s[i];i++);\n i--;\n for(j=0;j<=i;j++)\n {\n if(s[j]>'1')\n {\n flag = 1;\n res+=pow(2,i-j);\n }\n else if(s[j]=='1')\n res+=pow(2,i-j);\n else if(flag)\n {\n res+=pow(2,i-j);\n }\n }\n return res;\n \n}\nint main()\n{\n char* s = (char*) malloc(12);\n gets(s);\n printf(\"%d\\n\",correct(s));\n return 0;\n \n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tchar digit;\n\tint count = 0;\n\tint ones = 0;\n\twhile((digit = getchar()) != '\\n') {\n\t\tcount *= 2;\n\t\tdigit -= '0';\n\t\tif(ones || digit >= 1) {\n\t\t\tcount += 1;\n\t\t}\n\t\tif(digit > 1) {\n\t\t\tones = 1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long change( int k )\n{\n long long temp=0, tt = 0;\n int a[10];\n int i=0, o, p; \n while( k >0)\n {\n a[i] = k % 2;\n k /= 2;\n i++;\n }\n while(i>0)\n {\n --i;\n temp = temp * (long long)10 + (long long)a[i];\n }\n//printf( \"%lld\\n\", temp );\n return(temp);\n}\n\nmain()\n{\n// freopen( \"input.dat\", \"r\", stdin );\n \n int i=1, o, p=0, n;\n scanf( \"%d\", &n );\n while( 1 )\n {\n ++i;\n if (change( i ) > (long long)n) break;\n }\n --i;\n printf( \"%d\\n\", i );\n return(0);\n} \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint count;\nlong long int n;\n\nlong long int Hex(long long int x)\n{\n if(x>n)\n count=0;\n else\n {\n count= 1 + Hex(x*10+1)+Hex(x*10);\n }\n\n return count;\n}\n\nint main()\n{\n scanf(\"%I64d\",&n);\n\n printf(\"%I64d\",Hex(1));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint count=0;\nvoid binary(int ,int );\nvoid binary(int m,int n)\n{\n if(m>n)\n {\n return;\n }\n else\n {\n count++;\n }\n binary(m*10,n);\n binary(m*10+1,n);\n}\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n binary(1,n);\n printf(\"%d\\n\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0,j;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(i==0&&x>1){\n\t\t\tctn = 1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>1){\n\t\t\tctn = strlen(c)-i;\n\t\t\tdizi[i]=1;\n\t\t\tfor(j=i;j<strlen(c);j++){\n\t\t\t\tdizi[j]=1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\telse if(x == 0&&y==1){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tif(ctn==1){\n\t\tfor(i=0;i<strlen(c);i++){\n\t\t\tdizi[i]=1;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[strlen(c)-i-1]==1){\n\t\t\tsayi += pow(2,i);\n\t\t}\n\t}\n\tif(sayi==381){\n\t\tprintf(\"%d\",sayi+2);\n\t}\n\telse{\n\t\tprintf(\"%d\",sayi);\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int digit=0,count=0,i,j;\n int n,add,op;\n double initial;\n \n scanf(\"%d\",&n);\n \n int num=n;\n \n //digit extraction\n while(num>0)\n {\n num/=10;\n \n digit++;\n }\n \n int max=pow(2,digit)-1;\n \n for(i=1;i<=max;i++)\n {\n for(j=0;j<digit;j++)\n {\n op=pow(2,j);\n \n if((i) & (op))\n {\n initial=round(pow(10,j));\n add=initial;\n \n num+=add;\n }\n }\n \n if(num<=n)\n {\n count++;\n }\n num=0;\n }\n \n printf(\"%d\",count);\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n;\n\tscanf(\"%d\\n\",&n);\n\tint b=0;\n\tint i=0;\n\twhile (n) {\n\t\tint d=n%10;\n\t\tn/=10;\n\t\tif (d>1) b=(1<<i+1)-1;\n\t\telse b|=d<<i;\n\t\ti++;\n\t}\n\tprintf(\"%i\\n\",b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,i,j,k,A[10],s=0;\n scanf(\"%lld\",&n);\n for(i=0;i<10;i++)\n {\n A[i]=n%10;\n n=n/10;\n if(A[i]>1)\n {\n for(j=0;j<=i;j++)\n {\n A[j]=1;\n }\n }\n if(n==0)\n {\n break;\n }\n }\n for(k=0;k<=i;k++)\n {\n if(A[k]==1)\n {\n s=s+(pow(2,k));\n }\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint g[1100],n;\nvoid dabiao()\n{\n\tint i,temp;\n\tint slide,sum;\n\tfor(i=1;i<=1100;i++)\n\t{\n\t\ttemp=i;\n\t\tslide=1;\n\t\tsum=0;\n\t\twhile(temp>0)\n\t\t{\n\t\t\tif(temp%2==1)sum+=slide;\n\t\t\tslide*=10;\n\t\t\ttemp/=2;\n\t\t}\n\t\tg[i]=sum;\n\t}\n}\nint main()\n{\n\tdabiao();\n\tint i;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=1100;i++)\n\t\tif(g[i]>n)\n\t\t{\n\t\t\tprintf(\"%d\",i-1);\n\t\t\tbreak;\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong binary(int n){\nlong kq=0,i=1;\nwhile(n>0){\nkq=n%2*i+kq;\ni=i*10;\nn=n/2;\n}\nreturn kq;\n}\nint main(){\nlong n;\nscanf(\"%ld\",&n);\nint i=1;\nwhile(binary(i)<=n)i++;\nprintf(\"%d\",i-1);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n\n\n\nchar s[32];\n\nint decToBinary(int n) \n{ \n memset(s, 0, sizeof (s));\n int binaryNum[32]; \n int i=0;\n while (n>0)\n {\n binaryNum[i]=n%2;\n n=n/2;\n i++;\n }\n\n for (int j=i-1;j>0;j--)\n {\n sprintf (s+strlen(s),\"%d\",binaryNum[j]);\n }\n int x = atoi (s);\n return x;\n} \n\nint main ()\n{\n int n;\n int counter=0;\n scanf (\"%d\",&n);\n for (int i=1;decToBinary(i)<=n;i++)\n {\n counter++;\n }\n printf (\"%d\",(counter-1)/2);\n\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int a, b=0, res,c, n, count=0, i, num=10;\n scanf(\"%I64d\", &n);\n if(n==10){\n printf(\"2\");\n return 0;\n }\n else if(n==11 || (n>11 && n<=99)){\n printf(\"3\");\n return 0;\n }\n\n a=n;\n while(a>0){\n a/=10;\n ++count;\n }\n res = (pow(2,count))-(pow(2,count-1));\n num = (pow(num,count-1));\n for(i=num+1;i<=n;i++){\n a=i;\n c=0;\n while(a>0){\n b =a%10;\n a/=10;\n if(b!=0 && b!=1){\n c=1;\n }\n }\n if(c==0){\n ++res;\n }\n }\n printf(\"%I64d\", res);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint get_count(char *n);\n\nint main(){\n\tchar n[11];\n\tscanf(\"%s\",n);\n\tprintf(\"%d\\n\",get_count(n));\n\treturn 0;\n}\n\nint get_count(char *n){\n\tint i,j, k =1, count = 0;\n\tfor(i = 0; i<strlen(n)-1; i++){\n\t\tcount+=pow(2.0,i);\n\t}\n\tfor(i= 0; i<strlen(n)-1; i++){\n\t\tif(n[i]>'1')\n\t\t\tfor(j = i+1; j<strlen(n); j++)\n\t\t\t\tn[j]='9';\n\t}\n\tk = pow(2.0,strlen(n)-1);\n\tfor(i = 0; i<strlen(n); i++){\n\t\tif(n[i]=='0')\n\t\t\tk/=2;\n\t}\n\tcount+=k;\n\treturn count;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n\nint get_count(char *n);\n\nint main(){\n\tchar n[11];\n\tscanf(\"%s\",n);\n\tprintf(\"%d\\n\",get_count(n));\n\treturn 0;\n}\n\nint get_count(char *n){\n\tint i, k =1, count = 0;\n\tfor(i = 0; i<strlen(n)-1; i++){\n\t\tcount+=pow(2.0,i);\n\t}\n\tk = pow(2.0,strlen(n)-1);\n\tfor(i = 0; i<strlen(n); i++){\n\t\tif(n[i]=='0')\n\t\t\tk/=2;\n\t}\n\tcount+=k;\n\treturn count;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",po(16,3));\n\tfor (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n}\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",1<<10);\n\tfor (i=1;i<512;i++) {\n\t\tfor(j=0;j<9;j++) {\n\t\t\tif ((i&(1<<j))==(1<<j))\n\t\t\t\tsum+=po(10,j);\n\t\t\t\t\n\t\t\t}\n\t\t//printf(\"%d\\n\",sum);\t\n\t\tif(n<sum)\n\t\t\tbreak;\n\t\tsum=0;\t\n\t\t}\n\ti--;\n\tprintf(\"%d\",i);\n\t/*for (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tif((n>10)&&((n%10)==0))\n\t\tprintf(\"%d\",sum+1);\n\telse printf(\"%d\",sum);*/\t\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tlong long q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tlong i,n,j,sum=0;\n\tscanf(\"%I64d\",&n);\n\t//printf(\"%d\",po(16,3));\n\tfor (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tprintf(\"%I64d\",sum);\n\treturn 0;\n}\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",po(16,3));\n\tfor (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tprintf(\"%d\",sum);\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n>=1000000000)\n\t\tprintf(\"512\");\n\tif((n<1000000000)&&(n>=100000000))\n\t\tprintf(\"256\");\n\tif((n<100000000)&&(n>=10000000))\n\t\tprintf(\"128\");\n\tif((n<10000000)&&(n>=1000000))\n\t\tprintf(\"64\");\t\n\tif((n<1000000)&&(n>=100000))\n\t\tprintf(\"32\");\n\tif((n<100000)&&(n>=10000))\n\t\tprintf(\"16\");\n\tif((n<10000)&&(n>=1000))\n\t\tprintf(\"8\");\n\tif((n<1000)&&(n>=100))\n\t\tprintf(\"4\");\n\tif((n<100)&&(n>=10))\n\t\tprintf(\"2\");\n\tif((n<10)&&(n>=1))\n\t\tprintf(\"1\");\n\treturn 0;\n}\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",po(16,3));\n\tfor (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tif((n>10)&&((n%10)==0))\n\t\tprintf(\"%d\",sum+1);\n\telse printf(\"%d\",sum);\t\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tint q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tint i,n,j,sum=0;\n\tscanf(\"%d\",&n);\n\t//printf(\"%d\",1<<10);\n\tfor (i=1;i<=512;i++) {\n\t\tfor(j=0;j<9;j++) {\n\t\t\tif ((i&(1<<j))==(1<<j))\n\t\t\t\tsum+=po(10,j);\n\t\t\t\t\n\t\t\t}\n\t\t//printf(\"%d\\n\",sum);\t\n\t\tif(n<sum)\n\t\t\tbreak;\n\t\tsum=0;\t\n\t\t}\n\ti--;\n\tprintf(\"%d\",i);\n\t/*for (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tif((n>10)&&((n%10)==0))\n\t\tprintf(\"%d\",sum+1);\n\telse printf(\"%d\",sum);*/\t\n\treturn 0;\n}\t\t\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\nint po(int a,int b){\n\tlong long q,w;\n\tw=a;\n\tfor (q=1;q<b;q++)\n\t\tw*=a;\n\tif(b==0)\n\t\treturn(1);\n\telse return(w);\t\t\n\t}\nint main(){\n\tlong long i,n,j,sum=0;\n\tscanf(\"%lld\",&n);\n\t//printf(\"%d\",po(16,3));\n\tfor (i=n,j=1;i>=10;i= (int)i/10,j++);\n\t//for(i=j;)\n\tfor(i=0;i<j;i++){\n\t\tif((int)(n/po(10,i))%10>0)\n\t\t\tsum+=po(2,i);\n\t\t\n\t}\n\tprintf(\"%lld\",sum);\n\treturn 0;\n}\t\t"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n char n[11];\n scanf(\"%s\", &n);\n\n int i = 0;\n while(n[i] != '\\0'){\n if(n[i] > '1') n[i] = '1';\n i++;\n }\n\n int len = i;\n int res = 0;\n\n for(i = 0; i < len; i++){\n if(n[i] == '1') res += pow(2, len - i - 1);\n }\n\n printf(\"%d\\n\", res);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint check_nbr(int nb)\n{\n int check=0,ch=0;\n while(nb>0)\n {\n if(nb%10 == 0 || nb%10 == 1)\n check++;\n else\n return(0);\n nb/=10;\n ch++;\n }\n if(ch == check)\n return(1);\n return 0;\n}\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i = 1;\n int count = 0;\n while(i<=n)\n {\n if(check_nbr(i))\n {\n count++;\n i++;\n }\n else\n {\n i+=i;\n }\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count = 0;\n while(n>0)\n {\n if(n%2 == 0)\n count++;\n n/=2;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count = 0;\n if(72 == n)\n {\n printf(\"3\");\n return 0;\n }\n if(101 == n)\n {\n printf(\"5\");\n return 0;\n }\n while(n>0)\n {\n if(n%2 == 0)\n count++;\n n/=2;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[11];\n scanf(\"%s\",s);\n int i = 0;\n int count = 0;\n while(s[i])\n {\n if(s[i] == '1' || s[i] == '0')\n count++;\n i++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count = 0;\n if(72 == n)\n {\n printf(\"3\");\n return 0;\n }\n if(101 == n || 102 == n)\n {\n printf(\"5\");\n return 0;\n }\n while(n>0)\n {\n if(n%2 == 0)\n count++;\n n/=2;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <ctype.h>\n#include <string.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int count = 0;\n if(n == 72)\n {\n puts(\"3\");\n return(0);\n }\n while(n>0)\n {\n if(n%2 == 0)\n count++;\n n/=2;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,i,k,A[10],s=0;\n scanf(\"%lld\",&n);\n for(i=0;i<10;i++)\n {\n A[i]=n%10;\n n=n/10;\n if(A[i]>1)\n {\n A[i]=1;\n }\n if(n==0)\n {\n break;\n }\n }\n for(k=0;k<=i;k++)\n {\n if(A[k]==1)\n {\n s=s+(pow(2,k));\n }\n }\n printf(\"%lld\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nlong long rec(char c[], int i)\n{\n\tif (i == -1) {\n\t\treturn 0;\n\t}\n\tlong long val = 0;\n\tif (c[i] != '0') {\n\t\tval = pow(2, i);\n\t}\n\treturn val+rec(c, i-1);\n}\n\nint main()\n{\n\tint n; \n\tscanf(\"%d\", &n);\n\tchar c[32];\n\tint len = 0;\n\twhile (n) {\n\t\tc[len++] = n%10+'0';\n\t\tn /= 10;\n\t}\n\tlong long val = rec(c, len-1);\n\tprintf(\"%I64d\\n\", val);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint binary(int n)\n{\n int sum=0,pow=1;\n do{\n sum=sum+pow*(n%2);\n pow=pow*10;\n n=n/2;\n }while(n!=0);\n return sum;\n}\nint main()\n{\n int n,i,ara[513];\n scanf(\"%d\",&n);\n for(i=1;i<=512;i++)\n {\n ara[i]=binary(i);\n }\n for(i=1;i<=512;i++)\n {\n if(ara[i]>=n){\n printf(\"%d\",i);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define LL long long \nLL int a,b,s,i,j,d;\nint ba [15];\nLL int oz[]={1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,10010,10011,10100,10101,10110,10111,11000,11001,11010,11011,11100,11101,11110,11111,100000,100001,100010,100011,100100,100101,100110,100111,101000,101001,101010,101011,101100,101101,101110,101111,110000,110001,110010,110011,110100,110101,110110,110111,111000,111001,111010,111011,111100,111101,111110,111111,1000000,1000001,1000010,1000011,1000100,1000101,1000110,1000111,1001000,1001001,1001010,1001011,1001100,1001101,1001110,1001111,1010000,1010001,1010010,1010011,1010100,1010101,1010110,1010111,1011000,1011001,1011010,1011011,1011100,1011101,1011110,1011111,1100000,1100001,1100010,1100011,1100100,1100101,1100110,1100111,1101000,1101001,1101010,1101011,1101100,1101101,1101110,1101111,1110000,1110001,1110010,1110011,1110100,1110101,1110110,1110111,1111000,1111001,1111010,1111011,1111100,1111101,1111110,1111111,10000000,10000001,10000010,10000011,10000100,10000101,10000110,10000111,10001000,10001001,10001010,10001011,10001100,10001101,10001110,10001111,10010000,10010001,10010010,10010011,10010100,10010101,10010110,10010111,10011000,10011001,10011010,10011011,10011100,10011101,10011110,10011111,10100000,10100001,10100010,10100011,10100100,10100101,10100110,10100111,10101000,10101001,10101010,10101011,10101100,10101101,10101110,10101111,10110000,10110001,10110010,10110011,10110100,10110101,10110110,10110111,10111000,10111001,10111010,10111011,10111100,10111101,10111110,10111111,11000000,11000001,11000010,11000011,11000100,11000101,11000110,11000111,11001000,11001001,11001010,11001011,11001100,11001101,11001110,11001111,11010000,11010001,11010010,11010011,11010100,11010101,11010110,11010111,11011000,11011001,11011010,11011011,11011100,11011101,11011110,11011111,11100000,11100001,11100010,11100011,11100100,11100101,11100110,11100111,11101000,11101001,11101010,11101011,11101100,11101101,11101110,11101111,11110000,11110001,11110010,11110011,11110100,11110101,11110110,11110111,11111000,11111001,11111010,11111011,11111100,11111101,11111110,11111111,100000000,100000001,100000010,100000011,100000100,100000101,100000110,100000111,100001000,100001001,100001010,100001011,100001100,100001101,100001110,100001111,100010000,100010001,100010010,100010011,100010100,100010101,100010110,100010111,100011000,100011001,100011010,100011011,100011100,100011101,100011110,100011111,100100000,100100001,100100010,100100011,100100100,100100101,100100110,100100111,100101000,100101001,100101010,100101011,100101100,100101101,100101110,100101111,100110000,100110001,100110010,100110011,100110100,100110101,100110110,100110111,100111000,100111001,100111010,100111011,100111100,100111101,100111110,100111111,101000000,101000001,101000010,101000011,101000100,101000101,101000110,101000111,101001000,101001001,101001010,101001011,101001100,101001101,101001110,101001111,101010000,101010001,101010010,101010011,101010100,101010101,101010110,101010111,101011000,101011001,101011010,101011011,101011100,101011101,101011110,101011111,101100000,101100001,101100010,101100011,101100100,101100101,101100110,101100111,101101000,101101001,101101010,101101011,101101100,101101101,101101110,101101111,101110000,101110001,101110010,101110011,101110100,101110101,101110110,101110111,101111000,101111001,101111010,101111011,101111100,101111101,101111110,101111111,110000000,110000001,110000010,110000011,110000100,110000101,110000110,110000111,110001000,110001001,110001010,110001011,110001100,110001101,110001110,110001111,110010000,110010001,110010010,110010011,110010100,110010101,110010110,110010111,110011000,110011001,110011010,110011011,110011100,110011101,110011110,110011111,110100000,110100001,110100010,110100011,110100100,110100101,110100110,110100111,110101000,110101001,110101010,110101011,110101100,110101101,110101110,110101111,110110000,110110001,110110010,110110011,110110100,110110101,110110110,110110111,110111000,110111001,110111010,110111011,110111100,110111101,110111110,110111111,111000000,111000001,111000010,111000011,111000100,111000101,111000110,111000111,111001000,111001001,111001010,111001011,111001100,111001101,111001110,111001111,111010000,111010001,111010010,111010011,111010100,111010101,111010110,111010111,111011000,111011001,111011010,111011011,111011100,111011101,111011110,111011111,111100000,111100001,111100010,111100011,111100100,111100101,111100110,111100111,111101000,111101001,111101010,111101011,111101100,111101101,111101110,111101111,111110000,111110001,111110010,111110011,111110100,111110101,111110110,111110111,111111000,111111001,111111010,111111011,111111100,111111101,111111110,111111111};\nvoid bak()\n{\n\tfor(int j=0;j<a;j++)\n\t{\n\t\tif(a>=oz[j]){s++;}\n\t\telse{break;}\n\t}\n}\n\nint main()\n{\n\t// freopen(\"in.txt\",\"r\",stdin);\n\t// freopen(\"out.txt\",\"w\",stdout);\n\tscanf(\"%lld\",&a);\n\tbak();\n\tif(s==512){s--;}\n\tprintf(\"%lld\",s);\n}"}, {"source_code": "#include <stdio.h>\n#define LL long long \nLL int a,b,s,i,j,d;\nint ba [15];\nLL int oz[]={1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,10010,10011,10100,10101,10110,10111,11000,11001,11010,11011,11100,11101,11110,11111,100000,100001,100010,100011,100100,100101,100110,100111,101000,101001,101010,101011,101100,101101,101110,101111,110000,110001,110010,110011,110100,110101,110110,110111,111000,111001,111010,111011,111100,111101,111110,111111,1000000,1000001,1000010,1000011,1000100,1000101,1000110,1000111,1001000,1001001,1001010,1001011,1001100,1001101,1001110,1001111,1010000,1010001,1010010,1010011,1010100,1010101,1010110,1010111,1011000,1011001,1011010,1011011,1011100,1011101,1011110,1011111,1100000,1100001,1100010,1100011,1100100,1100101,1100110,1100111,1101000,1101001,1101010,1101011,1101100,1101101,1101110,1101111,1110000,1110001,1110010,1110011,1110100,1110101,1110110,1110111,1111000,1111001,1111010,1111011,1111100,1111101,1111110,1111111,10000000,10000001,10000010,10000011,10000100,10000101,10000110,10000111,10001000,10001001,10001010,10001011,10001100,10001101,10001110,10001111,10010000,10010001,10010010,10010011,10010100,10010101,10010110,10010111,10011000,10011001,10011010,10011011,10011100,10011101,10011110,10011111,10100000,10100001,10100010,10100011,10100100,10100101,10100110,10100111,10101000,10101001,10101010,10101011,10101100,10101101,10101110,10101111,10110000,10110001,10110010,10110011,10110100,10110101,10110110,10110111,10111000,10111001,10111010,10111011,10111100,10111101,10111110,10111111,11000000,11000001,11000010,11000011,11000100,11000101,11000110,11000111,11001000,11001001,11001010,11001011,11001100,11001101,11001110,11001111,11010000,11010001,11010010,11010011,11010100,11010101,11010110,11010111,11011000,11011001,11011010,11011011,11011100,11011101,11011110,11011111,11100000,11100001,11100010,11100011,11100100,11100101,11100110,11100111,11101000,11101001,11101010,11101011,11101100,11101101,11101110,11101111,11110000,11110001,11110010,11110011,11110100,11110101,11110110,11110111,11111000,11111001,11111010,11111011,11111100,11111101,11111110,11111111,100000000,100000001,100000010,100000011,100000100,100000101,100000110,100000111,100001000,100001001,100001010,100001011,100001100,100001101,100001110,100001111,100010000,100010001,100010010,100010011,100010100,100010101,100010110,100010111,100011000,100011001,100011010,100011011,100011100,100011101,100011110,100011111,100100000,100100001,100100010,100100011,100100100,100100101,100100110,100100111,100101000,100101001,100101010,100101011,100101100,100101101,100101110,100101111,100110000,100110001,100110010,100110011,100110100,100110101,100110110,100110111,100111000,100111001,100111010,100111011,100111100,100111101,100111110,100111111,101000000,101000001,101000010,101000011,101000100,101000101,101000110,101000111,101001000,101001001,101001010,101001011,101001100,101001101,101001110,101001111,101010000,101010001,101010010,101010011,101010100,101010101,101010110,101010111,101011000,101011001,101011010,101011011,101011100,101011101,101011110,101011111,101100000,101100001,101100010,101100011,101100100,101100101,101100110,101100111,101101000,101101001,101101010,101101011,101101100,101101101,101101110,101101111,101110000,101110001,101110010,101110011,101110100,101110101,101110110,101110111,101111000,101111001,101111010,101111011,101111100,101111101,101111110,101111111,110000000,110000001,110000010,110000011,110000100,110000101,110000110,110000111,110001000,110001001,110001010,110001011,110001100,110001101,110001110,110001111,110010000,110010001,110010010,110010011,110010100,110010101,110010110,110010111,110011000,110011001,110011010,110011011,110011100,110011101,110011110,110011111,110100000,110100001,110100010,110100011,110100100,110100101,110100110,110100111,110101000,110101001,110101010,110101011,110101100,110101101,110101110,110101111,110110000,110110001,110110010,110110011,110110100,110110101,110110110,110110111,110111000,110111001,110111010,110111011,110111100,110111101,110111110,110111111,111000000,111000001,111000010,111000011,111000100,111000101,111000110,111000111,111001000,111001001,111001010,111001011,111001100,111001101,111001110,111001111,111010000,111010001,111010010,111010011,111010100,111010101,111010110,111010111,111011000,111011001,111011010,111011011,111011100,111011101,111011110,111011111,111100000,111100001,111100010,111100011,111100100,111100101,111100110,111100111,111101000,111101001,111101010,111101011,111101100,111101101,111101110,111101111,111110000,111110001,111110010,111110011,111110100,111110101,111110110,111110111,111111000,111111001,111111010,111111011,111111100,111111101,111111110,111111111};\nvoid bak()\n{\n\tfor(int j=0;j<a;j++)\n\t{\n\t\tif(a>=oz[j]){s++;}\n\t\telse{break;}\n\t}\n}\n\nint main()\n{\n\t// freopen(\"in.txt\",\"r\",stdin);\n\t// freopen(\"out.txt\",\"w\",stdout);\n\tscanf(\"%lld\",&a);\n\tbak();\n\tprintf(\"%lld\",s);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint num[515];\nint cou=0;\nvoid dfs(int init,int digit){\n if(digit==9){\n num[cou++]=init;\n return ;\n }\n dfs(init*10,digit+1);\n dfs(init*10+1,digit+1);\n}\nint cmp(const void *a,const void *b){\n return (*(int *)a)-(*(int *)b);\n}\nint main(void){\n dfs(0,0);\n qsort(num,cou,sizeof(int),cmp);\n int i,n;\n scanf(\"%d\",&n);\n for(i=1;i<512;i++){\n if(num[i]>=n||i==511) break;\n }\n printf(\"%d\\n\",i);\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint num[515];\nint cou=0;\nvoid dfs(int init,int digit){\n if(digit==9){\n num[cou++]=init;\n return ;\n }\n dfs(init*10,digit+1);\n dfs(init*10+1,digit+1);\n}\nint cmp(const void *a,const void *b){\n return (*(int *)a)-(*(int *)b);\n}\nint main(void){\n dfs(0,0);\n qsort(num,cou,sizeof(int),cmp);\n int i,n;\n scanf(\"%d\",&n);\n for(i=1;i<512;i++){\n if(num[i]>n) break;\n }\n printf(\"%d\\n\",i-1);\n return 0; \n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n,c=0;\n\tscanf(\"%d\",&n);\n\twhile(n/=10) {\n\t\tc++;\n\t}\n\tprintf(\"%d\",c+1);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n sum+=pow(2,(double)(d-1))-1;\n n=atoi(ch);\n d-=2;\n m=1;\n while(d--)\n {\n m=m*10;\n }\n //printf(\"%d\\n\",m);\n for(i=m;i<=(m*2);i++)\n {\n c=result(i);\n sum+=c;\n if(i>n)\n break;\n //printf(\"%d\\n\",c);\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n sum+=pow(2,(double)(d-1))-1;\n n=atoi(ch);\n d--;\n m=1;\n while(d--)\n {\n m=m*10;\n }\n m=m/10;\n //printf(\"%d\\n\",m);\n for(i=m;i<=(m*2);i++)\n {\n c=result(i);\n sum+=c;\n if(i>n)\n break;\n //printf(\"%d\\n\",c);\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n sum+=pow(2,(double)(d-1))-1;\n n=atoi(ch);\n d-=2;\n m=1;\n while(d--)\n {\n m=m*10;\n }\n //printf(\"%d\\n\",m);\n for(i=m;i<=(m)+(m/6);i++)\n {\n c=result(i);\n sum+=c;\n if(i>n)\n break;\n //printf(\"%d\\n\",c);\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=0,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n sum+=pow(2,(double)(d-1))-1;\n n=atoi(ch);\n m=pow(10,(double)d);\n m=m/10;\n //printf(\"%d\\n\",m);\n for(i=m;i<(m)+(m/6);i++)\n {\n c=result(i);\n sum+=c;\n //printf(\"%d\\n\",c);\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint result(int n)\n{\n int t=0;\n while(n)\n {\n if((n%10!=0)&&(n%10!=1))\n t++;\n n=n/10;\n }\n if(t)\n return 0;\n return 1;\n}\nint cmpfunc(const void*a,const void*b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n int n,m,i,j,sum=1,chk=0,k=0,c=0,max=0,min=0,d=0;\n int a[2000005]={0},b[5]={0};\n char ch[101];\n scanf(\"%s\",ch);\n d=strlen(ch);\n k=d-1;\n while(k--)\n {\n sum*=2;\n }\n sum--;\n n=atoi(ch);\n d--;\n m=1;\n while(d--)\n {\n m=m*10;\n }\n //printf(\"%d\\n\",m);\n for(i=m;i<=(m*2);i++)\n {\n c=result(i);\n sum+=c;\n if(i>n)\n break;\n //printf(\"%d\\n\",c);\n }\n printf(\"%d\",sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int i, j, count=0, ans=0, t=1;\n char s[10];\n scanf(\"%s\", s);\n for(i=0; i<strlen(s); i++)\n {\n if(s[i]>'1')\n break;\n else if(s[i]=='1')\n count++;\n }\n count+=(strlen(s)-i);\n while(count--)\n {\n ans+=t;\n t*=2;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a,ans,c=0,count=0,num,n,i,j,arr[11],ar[11];\n\tscanf(\"%d\", &n);\n\tnum=n;\n\twhile(num != 0)\n\t{\n\t\tnum=num/10;\n\t\tcount++;\n\t}\n\tnum=n;\n//\tprintf(\"count=%d\\n\",count);\n\ti = count-1;\n\twhile(num != 0)\n\t{\n\t\ta=num%10;\n//\t\tprintf(\"a=%d\\n\", a);\n\t\tar[i] = a;\n//\t\tprintf(\"i=%d ar[i]=%d\\n\",i,ar[i]);\n\t\ti--;\n\t\tnum=num/10;\n\t}\n\tfor(i=0; i<count; i++)\n\t{\n\t\tif(ar[i]==1 || ar[i]==0)\n\t\t{\n\t\t\tarr[i] = ar[i];\n\t//\t\tnum = num/10;\n\t//\t\ti--;\n\t\t}\n\t\telse if(ar[i]>1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(j=i; j<count; j++)\n\t{\n\t\tarr[j] = 1;\n\t}\n\n/*\tfor(i=0; i<count; i++)\n\t{\n\t\tprintf(\"%d \",ar[i]);\n\t}\n\tprintf(\"\\n\");\n\tfor(i=0; i<count; i++)\n\t{\n\t\tprintf(\"%d \",arr[i]);\n\t}\n\tprintf(\"\\n\");*/\n\tans = pow(2,(count-1))-1;\n\tfor(i=1; i<count; i++)\n\t{\n\t\tif(arr[i] == 1)\n\t\t{\n\t\t\tc++;\n\t\t}\n\t}\n\tans = ans + pow(2,c);\n\tprintf(\"%d\\n\",ans);\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nlong long arr[1000001];\nchar str[1000001];\nint func(const void *a, const void *b)\n{\n\treturn (*(int*)a-*(int*)b);\n}\nlong long max(long long a, long long b)\n{\n\treturn (a>b)?a:b;\n}\nlong long min(long long a, long long b)\n{\n\treturn (a>b)?b:a;\n}\nint main()\n{\n\tlong long int n, i, len, j, k, count=0, ans=0;\n\tscanf(\"%s\",str);\n\tlen=strlen(str);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(str[i]=='0' && i!=len-1)\n\t\t\tcount=count+pow(2,len-1-i);\n\t}\n\tans=pow(2,len)-1;\n\tprintf(\"%lld\\n\",ans-count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\nlong long arr[1000001];\nchar str[1000001];\nint func(const void *a, const void *b)\n{\n\treturn (*(int*)a-*(int*)b);\n}\nlong long max(long long a, long long b)\n{\n\treturn (a>b)?a:b;\n}\nlong long min(long long a, long long b)\n{\n\treturn (a>b)?b:a;\n}\nint main()\n{\n\tlong long int n, i, len, j, k, count=0, ans=0;\n\tscanf(\"%s\",str);\n\tlen=strlen(str);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tif(str[i]=='0')\n\t\t\tcount=count+pow(2,len-1-i);\n\t}\n\tans=pow(2,len)-1;\n\tprintf(\"%lld\\n\",ans-count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const void *a, const void *b)\n{\n return *((int *)a) - *((int *)b);\n}\n\nint main()\n{\n int n, x = 1, p = 0, q = 1, i, j;\n int a[2000] = {1};\n\n scanf(\"%d\", &n);\n\n for (i = 0; i < 9; i++) {\n\t for (j = p; j < q; j++) {\n\t a[x++] = a[j] * 10;\n\t a[x++] = a[j] * 10 + 1;\n\t }\n\n\t p = q; q = x;\n }\n\n printf(\"%d %d\\n\", x, a[x - 1]);\n\n for (i = 0; i < x; i++) {\n\t if (a[i] > n) break;\n }\n\n printf(\"%d\\n\", i);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n;\nint getNum(int x)\n{\n\tint ret = 0;\n\tfor(;x;x>>=1) ret = ret*10+(x&1);\n\treturn ret;\n}\nint main()\n{\n\tint i;\n\tscanf(\"%d\",&n);\n\tfor(i=1;getNum(i)<=n;i++);\n\tprintf(\"%d\",i-1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar s[12];\n\tscanf(\"%s\",s);\n\tint l=strlen(s);\n\tint i;\n\tint sum=0;\n\tint t=1;\n\tfor(i=l-1;i>=0;i--)\n\t{\n\t\tint c=s[i]-'0';\n\t\tif(c>1)\n\t\t\ts[i]='1';\n\t\tsum=sum+t*(s[i]-'0');\n\t\tt=t*2;\n\t}\n\tprintf(\"%d\\n\",sum);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint ndigit( long long n ) {\n int cnt = 0;\n \n while( n ) {\n cnt++;\n n /= 10;\n }\n \n return cnt;\n}\n\nint main( void ) {\n long long n;\n long long cnt = 0;\n \n scanf(\"%lld\", &n);\n \n while( n ) {\n cnt += pow(2, ndigit(n)-1);\n n %= (int)pow(10, ndigit(n)-1); \n }\n \n printf(\"%lld\\n\", cnt);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint ndigit( long long n ) {\n int cnt = 0;\n \n while( n ) {\n cnt++;\n n /= 10;\n }\n \n return cnt;\n}\n\nint main( void ) {\n long long n;\n long long cnt = 0;\n \n scanf(\"%lld\", &n);\n int nd = ndigit(n);\n \n int i;\n for( i = 0; i < nd; i++ )\n cnt += pow(2, i);\n \n long long nn = 0;\n for( i = 0; i < nd; i++ )\n nn = nn*10 + 1;\n \n i = 0;\n while( n <= nn ) {\n cnt--;\n nn -= pow(10, i++);\n }\n \n printf(\"%lld\\n\", cnt);\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main( void ) {\n const int Max = 100;\n char number[Max];\n \n scanf(\"%s\", number);\n \n long long cnt = 0;\n int len = strlen(number);\n \n int i, j;\n for( i = 0; i < len; i++ ) {\n if( number[i] == '0' ) continue;\n \n for( j = i; j < len; j++ )\n if( number[j] == '1' || number[j] == '0' ) cnt++;\n else break;\n }\n \n \n printf(\"%lld\\n\", cnt);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint d[10];\n\nint digit(int n) {\n int len = 0;\n while (n) {\n d[len ++] = n % 10;\n n /= 10;\n }\n return len;\n}\n\nvoid func(int n) {\n int i, j, len, ans = 0;\n len = digit(n);\n for (i = 1; i < len; i ++) {\n ans += (1 << (i - 1));\n }\n for (i = len - 1; i >= 0; i --) {\n if (d[i] > 1) {\n ans += (1 << i);\n break;\n }\n else if (d[i] == 1 && i != len - 1) {\n ans += (1 << i);\n }\n }\n if (i < 0) {\n ans ++;\n }\n printf(\"%d\\n\", ans);\n}\n\nint main() {\n int n;\n while (scanf(\"%d\", &n) == 1) {\n func(n);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nlong long power(int i) {\n long long s;\n\tint k;\n s = 1;\n for (k = 0;k < i;k++,s*=10);\n\treturn(s);\n}\n \n\nint main() {\n long long n;\n scanf(\"%lld\",&n);\n\tlong long x = 0, k = 1, t;\n\tint i;\n\twhile (x <= n) {\n\t k = i;\n\t\tt = 0;\n\t\tx = 0;\n\t while (k != 0) {\n\t\t x += (k%2)*power(t);\n if (k > 1) k = k/2;\n\t\t\telse k = 0;\n\t\t\tt++;\n }\n\t\ti++;\n }\n\tprintf(\"%d\",i-2);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nlong long power(long long i) {\nint k, s;\n s = 1;\n for (k = 0;k < i;k++,s*=10);\n\treturn(s);\n}\n \n\nint main() {\n long long n;\n scanf(\"%I64d\",&n);\n\tlong long x = 0, k = 1, t;\n\tint i;\n\tprintf(\"%d \",n);\n\twhile (x <= n) {\n\t k = i;\n\t\tt = 0;\n\t\tx = 0;\n\t while (k != 0) {\n\t\t x += (k%2)*power(t);\n if (k > 1) k = k/2;\n\t\t\telse k = 0;\n\t\t\tt++;\n }\n\t\ti++;\n }\n\tprintf(\"%d\",i-2);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint power(int i) {\nint k, s;\n s = 1;\n for (k = 0;k < i;k++,s*=10);\n\treturn(s);\n}\n \n\nint main() {\n int n;\n scanf(\"%d\",&n);\n\tlong long x = 0, k = 1, t;\n\tint i;\n\tprintf(\"%d \",n);\n\twhile (x <= n) {\n\t k = i;\n\t\tt = 0;\n\t\tx = 0;\n\t while (k != 0) {\n\t\t x += (k%2)*power(t);\n if (k > 1) k = k/2;\n\t\t\telse k = 0;\n\t\t\tt++;\n }\n\t\ti++;\n }\n\tprintf(\"%d\",i-2);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\ndouble sqr(double a) {\n\treturn a*a;\n}\n\nint main() {\n\tint i,n,vb,vs;\n\tscanf(\"%d %d %d\\n\",&n,&vb,&vs);\n\tdouble x[n+1];\n\tfor (i=1;i<=n;i++) scanf(\"%lf\",&x[i]);\n\tint xu,yu;\n\tscanf(\"%d %d\\n\",&xu,&yu);\n\tint best=0;\n\tdouble t,besttime=1000000000;\n\tfor (i=2;i<=n;i++) {\n\t\tt=x[i]/vb+sqrt(sqr(xu-x[i])+sqr(yu))/vs;\n\t\tif (t<besttime) besttime=t,best=i;\n\t\tif (t==besttime) if (x[i]>x[best]) besttime=t,best=i;\n\t}\n\tprintf(\"%i\\n\",best);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c,a;\n\tlong long int n;\n\tscanf(\"%ld\",&n);\n\twhile(n>0)\n\t{\n\t\ta=n%10;\n\t\tn=n/10;\n\t\tif(a==0 || a==1)\n\t\tc++;\n\t}\n\tprintf(\"%d\",c);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c=0,a;\n long int n;\n\tscanf(\"%ld\",&n);\n\twhile(n>0)\n\t{\n\t\ta=n%10;\n\t\tn=n/10;\n\t\tif(a==0 || a==1)\n\t\tc++;\n\t}\n\tprintf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint main()\n{\n char n[12];\n scanf(\"%s\",n);\n int l=strlen(n),i;\n double d;\n d=pow(2,l)-1;\n for(i=0;i<l;i++) {\n if(n[i]=='0') {\n d-=pow(2,l-1-i);\n }\n }\n printf(\"%0.0lf\\n\",d);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\n\tchar str[11],res[11];\n\tlong int i=0,dec=0,len=0,flag=0;\n\tscanf(\"%s\",str);\n\twhile(str[i++]!='\\0'){\n\t\t++len;\n\t}\n\tfor(i=0;i<len;i++){\n\t\tif(flag){\n\t\t\tres[i]='1';\n\t\t}\n\t\telse{\n\t\t\tif(str[i]=='0'||str[i]=='1'){\n\t\t\t\tres[i]=str[i];\n\t\t\t}\n\t\t\telse{\n\t\t\t\tres[i]='1';\n\t\t\t\tflag=1;\n\t\t\t}\n\t\t}\n\t}\n\tres[i]='\\0';\n\tprintf(\"%s\\n\",res);\n\tfor(i=len-1;i>=0;i--){\n\t\tdec+=(res[i]-'0')*(1<<(len-i-1));\n\t}\n\tprintf(\"%ld\",dec);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void)\n{\n char num[15];\n gets(num);\n int lenth;\n lenth = strlen(num);\n int i;\n for(i = 0; i < lenth; i++){\n if(num[i] != '0')\n num[i] = '1';\n }\n int a = 1;\n int ans = 0;\n for(i = lenth - 1; i >= 0; i--){\n ans += (num[i] - '0') * a;\n a = a * 2;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void)\n{\n char num[105];\n gets(num);\n int lenth;\n lenth = strlen(num);\n int i, j;\n for(i = 0; i < lenth; i++){\n if(num[i] != '1')\n for(j = i; j < lenth; j ++ )\n num[j] = '1';\n }\n int a = 1;\n int ans = 0;\n for(i = lenth - 1; i >= 0; i--){\n ans += (num[i] - '0') * a;\n a = a * 2;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long change( int k )\n{\n long long temp = 0; \n while( k >0)\n {\n temp = temp * 10 + k % 2;\n k /= 2;\n }\n return(temp);\n}\n\nmain()\n{\n// freopen( \"input.dat\", \"r\", stdin );\n \n int i=0, o, p=0, n;\n scanf( \"%d\", &n );\n while( 1 )\n {\n ++i;\n if (change( i ) > (long long)n) break;\n }\n --i;\n printf( \"%d\\n\", i );\n return(0);\n} \n"}, {"source_code": "#include<stdio.h>\n\nlong long change( int k )\n{\n long long temp = 0; \n while( k >0)\n {\n temp = temp * 10 + k % 2;\n k /= 2;\n }\n return(temp);\n}\n\nmain()\n{\n// freopen( \"input.dat\", \"r\", stdin );\n \n int i=0, o, p=0, n;\n scanf( \"%d\", &n );\n while( 1 )\n {\n ++i;\n if (change( i ) > (long long)n) break;\n }\n --i;\n printf( \"%d\\n\", i );\n return(0);\n} \n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y==0){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[i]==1){\n\t\t\tsayi+= pow(2,strlen(c)-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>1){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y==0){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[i]==1){\n\t\t\tsayi+= pow(2,strlen(c)-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0,j;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(i==0&&x>1){\n\t\t\tctn = 1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>1){\n\t\t\tctn = strlen(c)-i;\n\t\t\tdizi[i]=1;\n\t\t\tfor(j=i;j<strlen(c);j++){\n\t\t\t\tdizi[j]=1;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\telse if(x == 0&&y==1){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tif(ctn==1){\n\t\tfor(i=0;i<strlen(c);i++){\n\t\t\tdizi[i]=1;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[strlen(c)-i-1]==1){\n\t\t\tsayi += pow(2,i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(i==0&&x>1){\n\t\t\tctn = 1;\n\t\t}\n\t\tif(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y==0){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tif(ctn==1){\n\t\tfor(i=0;i<strlen(c);i++){\n\t\t\tdizi[i]=1;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[i]==1){\n\t\t\tsayi+= pow(2,strlen(c)-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[i]==1){\n\t\t\tsayi+= pow(2,strlen(c)-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\nint fact(int x){\n\tint i,n=1;\n\tfor(i=1;i<=x;i++){\n\t\tn=n*i;\n\t}\n\treturn n;\n}\n\nint dizi[15];\n\nint main() {\n\tint i,ctn=0,x,sayi=0,y=0;\n\tchar c[15];\n\tscanf(\"%s\",&c);\n\tfor(i=0;i<strlen(c);i++){\n\t\tx = c[i]-48;\n\t\tif(i>0){\n\t\t\ty = c[i-1]-48;\n\t\t}\n\t\tif(i==0&&x>1){\n\t\t\tctn = 1;\n\t\t}\n\t\telse if(x > 0){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y>1){\n\t\t\tdizi[i]=1;\n\t\t}\n\t\telse if(x == 0&&y==0){\n\t\t\tdizi[i]=0;\n\t\t}\n\t}\n\tif(ctn==1){\n\t\tfor(i=0;i<strlen(c);i++){\n\t\t\tdizi[i]=1;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(c);i++){\n\t\tif(dizi[i]==1){\n\t\t\tsayi+= pow(2,strlen(c)-1-i);\n\t\t}\n\t}\n\tprintf(\"%d\",sayi);\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n#include <stdlib.h>\n#include <ctype.h>\n\n\n\nchar s[32];\n\nint decToBinary(int n) \n{ \n int binaryNum[32]; \n int i=0;\n while (n>0)\n {\n binaryNum[i]=n%2;\n n=n/2;\n i++;\n }\n\n for (int j=i-1;j>0;j--)\n {\n sprintf (s+strlen(s),\"%d\",binaryNum[j]);\n }\n int x = atoi (s);\n return x;\n} \n\nint main ()\n{\n int n;\n int counter=0;\n scanf (\"%d\",&n);\n for (int i=1;decToBinary(i)<=n;i++)\n {\n counter++;\n }\n printf (\"%d\",counter);\n\n}"}], "src_uid": "64a842f9a41f85a83b7d65bfbe21b6cb"} {"nl": {"description": "The year 2015 is almost over.Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary system\u00a0\u2014 201510\u2009=\u2009111110111112. Note that he doesn't care about the number of zeros in the decimal representation.Limak chose some interval of years. He is going to count all years from this interval that have exactly one zero in the binary representation. Can you do it faster?Assume that all positive integers are always written without leading zeros.", "input_spec": "The only line of the input contains two integers a and b (1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u20091018)\u00a0\u2014 the first year and the last year in Limak's interval respectively.", "output_spec": "Print one integer\u00a0\u2013 the number of years Limak will count in his chosen interval.", "sample_inputs": ["5 10", "2015 2015", "100 105", "72057594000000000 72057595000000000"], "sample_outputs": ["2", "1", "0", "26"], "notes": "NoteIn the first sample Limak's interval contains numbers 510\u2009=\u20091012, 610\u2009=\u20091102, 710\u2009=\u20091112, 810\u2009=\u200910002, 910\u2009=\u200910012 and 1010\u2009=\u200910102. Two of them (1012 and 1102) have the described property."}, "positive_code": [{"source_code": "#include<stdio.h>\nlong long int a,b,C[6000],r;\nint main(){\n int num,i,j,ans=0;\n scanf(\"%lld%lld\",&a,&b);\n for(i=2;i<61;i++){\n long long int g=((long long int)1<<i)-1;\n for(j=0;j<i-1;j++){\n C[num++]=g-((long long int)1<<j);\n }\n }\n for(i=0;i<num;i++){\n if(a<=C[i]&&C[i]<=b){\n ans++;\n }\n }\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\nllu F(llu a)\n{\n\tif(a<2)return 0;\n\tllu x;u i=0,r=0;\n\tfor(x=1;x<=a;x<<=1)++i;\n\tx>>=1;--i;r=(i*(i-1))>>1;\n\tfor(;x>>=1;++r)if(!(x&a))break;\n\ta=(a&(x-1))+1;\n\tif(x&&a==x)++r;\n\treturn r;\n}\nint main()\n{\n\tllu a,b;\n\tscanf(\"%I64u%I64u\",&a,&b);\n\tprintf(\"%I64u\\n\",F(b)-F(a-1));\n\treturn 0;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <ctype.h>\n\n#define OUTPUT freopen(\"myfile.txt\",\"w\",stdout);\n#define INPUT freopen(\"input.txt\",\"r\",stdin);\n#define pi acos(-1.0)\n#define MAX 1000005\n\nlong long int array[2000] ={0,2,5,6,11,13,14,23,27,29,30,47,55,59,61,62,95,111,119,123,125,126,191,223,239,247,251,253,254,383,447,479,495,503,507,509,510,767,895,959,991,1007,1015,1019,1021,1022,1535,1791,1919,1983,2015,2031,2039,2043,2045,2046,3071,3583,3839,3967,4031,4063,4079,4087,4091,4093,4094,6143,7167,7679,7935,8063,8127,8159,8175,8183,8187,8189,8190,12287,14335,15359,15871,16127,16255,16319,16351,16367,16375,16379,16381,16382,24575,28671,30719,31743,32255,32511,32639,32703,32735,32751,32759,32763,32765,32766,49151,57343,61439,63487,64511,65023,65279,65407,65471,65503,65519,65527,65531,65533,65534,98303,114687,122879,126975,129023,130047,130559,130815,130943,131007,131039,131055,131063,131067,131069,131070,196607,229375,245759,253951,258047,260095,261119,261631,261887,262015,262079,262111,262127,262135,262139,262141,262142,393215,458751,491519,507903,516095,520191,522239,523263,523775,524031,524159,524223,524255,524271,524279,524283,524285,524286,786431,917503,983039,1015807,1032191,1040383,1044479,1046527,1047551,1048063,1048319,1048447,1048511,1048543,1048559,1048567,1048571,1048573,1048574,1572863,1835007,1966079,2031615,2064383,2080767,2088959,2093055,2095103,2096127,2096639,2096895,2097023,2097087,2097119,2097135,2097143,2097147,2097149,2097150,3145727,3670015,3932159,4063231,4128767,4161535,4177919,4186111,4190207,4192255,4193279,4193791,4194047,4194175,4194239,4194271,4194287,4194295,4194299,4194301,4194302,6291455,7340031,7864319,8126463,8257535,8323071,8355839,8372223,8380415,8384511,8386559,8387583,8388095,8388351,8388479,8388543,8388575,8388591,8388599,8388603,8388605,8388606,12582911,14680063,15728639,16252927,16515071,16646143,16711679,16744447,16760831,16769023,16773119,16775167,16776191,16776703,16776959,16777087,16777151,16777183,16777199,16777207,16777211,16777213,16777214,25165823,29360127,31457279,32505855,33030143,33292287,33423359,33488895,33521663,33538047,33546239,33550335,33552383,33553407,33553919,33554175,33554303,33554367,33554399,33554415,33554423,33554427,33554429,33554430,50331647,58720255,62914559,65011711,66060287,66584575,66846719,66977791,67043327,67076095,67092479,67100671,67104767,67106815,67107839,67108351,67108607,67108735,67108799,67108831,67108847,67108855,67108859,67108861,67108862,100663295,117440511,125829119,130023423,132120575,133169151,133693439,133955583,134086655,134152191,134184959,134201343,134209535,134213631,134215679,134216703,134217215,134217471,134217599,134217663,134217695,134217711,134217719,134217723,134217725,134217726,201326591,234881023,251658239,260046847,264241151,266338303,267386879,267911167,268173311,268304383,268369919,268402687,268419071,268427263,268431359,268433407,268434431,268434943,268435199,268435327,268435391,268435423,268435439,268435447,268435451,268435453,268435454,402653183,469762047,503316479,520093695,528482303,532676607,534773759,535822335,536346623,536608767,536739839,536805375,536838143,536854527,536862719,536866815,536868863,536869887,536870399,536870655,536870783,536870847,536870879,536870895,536870903,536870907,536870909,536870910,805306367,939524095,1006632959,1040187391,1056964607,1065353215,1069547519,1071644671,1072693247,1073217535,1073479679,1073610751,1073676287,1073709055,1073725439,1073733631,1073737727,1073739775,1073740799,1073741311,1073741567,1073741695,1073741759,1073741791,1073741807,1073741815,1073741819,1073741821,1073741822,1610612735,1879048191,2013265919,2080374783,2113929215,2130706431,2139095039,2143289343,2145386495,2146435071,2146959359,2147221503,2147352575,2147418111,2147450879,2147467263,2147475455,2147479551,2147481599,2147482623,2147483135,2147483391,2147483519,2147483583,2147483615,2147483631,2147483639,2147483643,2147483645,2147483646,3221225471,3758096383,4026531839,4160749567,4227858431,4261412863,4278190079,4286578687,4290772991,4292870143,4293918719,4294443007,4294705151,4294836223,4294901759,4294934527,4294950911,4294959103,4294963199,4294965247,4294966271,4294966783,4294967039,4294967167,4294967231,4294967263,4294967279,4294967287,4294967291,4294967293,4294967294,6442450943,7516192767,8053063679,8321499135,8455716863,8522825727,8556380159,8573157375,8581545983,8585740287,8587837439,8588886015,8589410303,8589672447,8589803519,8589869055,8589901823,8589918207,8589926399,8589930495,8589932543,8589933567,8589934079,8589934335,8589934463,8589934527,8589934559,8589934575,8589934583,8589934587,8589934589,8589934590,12884901887,15032385535,16106127359,16642998271,16911433727,17045651455,17112760319,17146314751,17163091967,17171480575,17175674879,17177772031,17178820607,17179344895,17179607039,17179738111,17179803647,17179836415,17179852799,17179860991,17179865087,17179867135,17179868159,17179868671,17179868927,17179869055,17179869119,17179869151,17179869167,17179869175,17179869179,17179869181,17179869182,25769803775,30064771071,32212254719,33285996543,33822867455,34091302911,34225520639,34292629503,34326183935,34342961151,34351349759,34355544063,34357641215,34358689791,34359214079,34359476223,34359607295,34359672831,34359705599,34359721983,34359730175,34359734271,34359736319,34359737343,34359737855,34359738111,34359738239,34359738303,34359738335,34359738351,34359738359,34359738363,34359738365,34359738366,51539607551,60129542143,64424509439,66571993087,67645734911,68182605823,68451041279,68585259007,68652367871,68685922303,68702699519,68711088127,68715282431,68717379583,68718428159,68718952447,68719214591,68719345663,68719411199,68719443967,68719460351,68719468543,68719472639,68719474687,68719475711,68719476223,68719476479,68719476607,68719476671,68719476703,68719476719,68719476727,68719476731,68719476733,68719476734,103079215103,120259084287,128849018879,133143986175,135291469823,136365211647,136902082559,137170518015,137304735743,137371844607,137405399039,137422176255,137430564863,137434759167,137436856319,137437904895,137438429183,137438691327,137438822399,137438887935,137438920703,137438937087,137438945279,137438949375,137438951423,137438952447,137438952959,137438953215,137438953343,137438953407,137438953439,137438953455,137438953463,137438953467,137438953469,137438953470,206158430207,240518168575,257698037759,266287972351,270582939647,272730423295,273804165119,274341036031,274609471487,274743689215,274810798079,274844352511,274861129727,274869518335,274873712639,274875809791,274876858367,274877382655,274877644799,274877775871,274877841407,274877874175,274877890559,274877898751,274877902847,274877904895,274877905919,274877906431,274877906687,274877906815,274877906879,274877906911,274877906927,274877906935,274877906939,274877906941,274877906942,412316860415,481036337151,515396075519,532575944703,541165879295,545460846591,547608330239,548682072063,549218942975,549487378431,549621596159,549688705023,549722259455,549739036671,549747425279,549751619583,549753716735,549754765311,549755289599,549755551743,549755682815,549755748351,549755781119,549755797503,549755805695,549755809791,549755811839,549755812863,549755813375,549755813631,549755813759,549755813823,549755813855,549755813871,549755813879,549755813883,549755813885,549755813886,824633720831,962072674303,1030792151039,1065151889407,1082331758591,1090921693183,1095216660479,1097364144127,1098437885951,1098974756863,1099243192319,1099377410047,1099444518911,1099478073343,1099494850559,1099503239167,1099507433471,1099509530623,1099510579199,1099511103487,1099511365631,1099511496703,1099511562239,1099511595007,1099511611391,1099511619583,1099511623679,1099511625727,1099511626751,1099511627263,1099511627519,1099511627647,1099511627711,1099511627743,1099511627759,1099511627767,1099511627771,1099511627773,1099511627774,1649267441663,1924145348607,2061584302079,2130303778815,2164663517183,2181843386367,2190433320959,2194728288255,2196875771903,2197949513727,2198486384639,2198754820095,2198889037823,2198956146687,2198989701119,2199006478335,2199014866943,2199019061247,2199021158399,2199022206975,2199022731263,2199022993407,2199023124479,2199023190015,2199023222783,2199023239167,2199023247359,2199023251455,2199023253503,2199023254527,2199023255039,2199023255295,2199023255423,2199023255487,2199023255519,2199023255535,2199023255543,2199023255547,2199023255549,2199023255550,3298534883327,3848290697215,4123168604159,4260607557631,4329327034367,4363686772735,4380866641919,4389456576511,4393751543807,4395899027455,4396972769279,4397509640191,4397778075647,4397912293375,4397979402239,4398012956671,4398029733887,4398038122495,4398042316799,4398044413951,4398045462527,4398045986815,4398046248959,4398046380031,4398046445567,4398046478335,4398046494719,4398046502911,4398046507007,4398046509055,4398046510079,4398046510591,4398046510847,4398046510975,4398046511039,4398046511071,4398046511087,4398046511095,4398046511099,4398046511101,4398046511102,6597069766655,7696581394431,8246337208319,8521215115263,8658654068735,8727373545471,8761733283839,8778913153023,8787503087615,8791798054911,8793945538559,8795019280383,8795556151295,8795824586751,8795958804479,8796025913343,8796059467775,8796076244991,8796084633599,8796088827903,8796090925055,8796091973631,8796092497919,8796092760063,8796092891135,8796092956671,8796092989439,8796093005823,8796093014015,8796093018111,8796093020159,8796093021183,8796093021695,8796093021951,8796093022079,8796093022143,8796093022175,8796093022191,8796093022199,8796093022203,8796093022205,8796093022206,13194139533311,15393162788863,16492674416639,17042430230527,17317308137471,17454747090943,17523466567679,17557826306047,17575006175231,17583596109823,17587891077119,17590038560767,17591112302591,17591649173503,17591917608959,17592051826687,17592118935551,17592152489983,17592169267199,17592177655807,17592181850111,17592183947263,17592184995839,17592185520127,17592185782271,17592185913343,17592185978879,17592186011647,17592186028031,17592186036223,17592186040319,17592186042367,17592186043391,17592186043903,17592186044159,17592186044287,17592186044351,17592186044383,17592186044399,17592186044407,17592186044411,17592186044413,17592186044414,26388279066623,30786325577727,32985348833279,34084860461055,34634616274943,34909494181887,35046933135359,35115652612095,35150012350463,35167192219647,35175782154239,35180077121535,35182224605183,35183298347007,35183835217919,35184103653375,35184237871103,35184304979967,35184338534399,35184355311615,35184363700223,35184367894527,35184369991679,35184371040255,35184371564543,35184371826687,35184371957759,35184372023295,35184372056063,35184372072447,35184372080639,35184372084735,35184372086783,35184372087807,35184372088319,35184372088575,35184372088703,35184372088767,35184372088799,35184372088815,35184372088823,35184372088827,35184372088829,35184372088830,52776558133247,61572651155455,65970697666559,68169720922111,69269232549887,69818988363775,70093866270719,70231305224191,70300024700927,70334384439295,70351564308479,70360154243071,70364449210367,70366596694015,70367670435839,70368207306751,70368475742207,70368609959935,70368677068799,70368710623231,70368727400447,70368735789055,70368739983359,70368742080511,70368743129087,70368743653375,70368743915519,70368744046591,70368744112127,70368744144895,70368744161279,70368744169471,70368744173567,70368744175615,70368744176639,70368744177151,70368744177407,70368744177535,70368744177599,70368744177631,70368744177647,70368744177655,70368744177659,70368744177661,70368744177662,105553116266495,123145302310911,131941395333119,136339441844223,138538465099775,139637976727551,140187732541439,140462610448383,140600049401855,140668768878591,140703128616959,140720308486143,140728898420735,140733193388031,140735340871679,140736414613503,140736951484415,140737219919871,140737354137599,140737421246463,140737454800895,140737471578111,140737479966719,140737484161023,140737486258175,140737487306751,140737487831039,140737488093183,140737488224255,140737488289791,140737488322559,140737488338943,140737488347135,140737488351231,140737488353279,140737488354303,140737488354815,140737488355071,140737488355199,140737488355263,140737488355295,140737488355311,140737488355319,140737488355323,140737488355325,140737488355326,211106232532991,246290604621823,263882790666239,272678883688447,277076930199551,279275953455103,280375465082879,280925220896767,281200098803711,281337537757183,281406257233919,281440616972287,281457796841471,281466386776063,281470681743359,281472829227007,281473902968831,281474439839743,281474708275199,281474842492927,281474909601791,281474943156223,281474959933439,281474968322047,281474972516351,281474974613503,281474975662079,281474976186367,281474976448511,281474976579583,281474976645119,281474976677887,281474976694271,281474976702463,281474976706559,281474976708607,281474976709631,281474976710143,281474976710399,281474976710527,281474976710591,281474976710623,281474976710639,281474976710647,281474976710651,281474976710653,281474976710654,422212465065983,492581209243647,527765581332479,545357767376895,554153860399103,558551906910207,560750930165759,561850441793535,562400197607423,562675075514367,562812514467839,562881233944575,562915593682943,562932773552127,562941363486719,562945658454015,562947805937663,562948879679487,562949416550399,562949684985855,562949819203583,562949886312447,562949919866879,562949936644095,562949945032703,562949949227007,562949951324159,562949952372735,562949952897023,562949953159167,562949953290239,562949953355775,562949953388543,562949953404927,562949953413119,562949953417215,562949953419263,562949953420287,562949953420799,562949953421055,562949953421183,562949953421247,562949953421279,562949953421295,562949953421303,562949953421307,562949953421309,562949953421310,844424930131967,985162418487295,1055531162664959,1090715534753791,1108307720798207,1117103813820415,1121501860331519,1123700883587071,1124800395214847,1125350151028735,1125625028935679,1125762467889151,1125831187365887,1125865547104255,1125882726973439,1125891316908031,1125895611875327,1125897759358975,1125898833100799,1125899369971711,1125899638407167,1125899772624895,1125899839733759,1125899873288191,1125899890065407,1125899898454015,1125899902648319,1125899904745471,1125899905794047,1125899906318335,1125899906580479,1125899906711551,1125899906777087,1125899906809855,1125899906826239,1125899906834431,1125899906838527,1125899906840575,1125899906841599,1125899906842111,1125899906842367,1125899906842495,1125899906842559,1125899906842591,1125899906842607,1125899906842615,1125899906842619,1125899906842621,1125899906842622,1688849860263935,1970324836974591,2111062325329919,2181431069507583,2216615441596415,2234207627640831,2243003720663039,2247401767174143,2249600790429695,2250700302057471,2251250057871359,2251524935778303,2251662374731775,2251731094208511,2251765453946879,2251782633816063,2251791223750655,2251795518717951,2251797666201599,2251798739943423,2251799276814335,2251799545249791,2251799679467519,2251799746576383,2251799780130815,2251799796908031,2251799805296639,2251799809490943,2251799811588095,2251799812636671,2251799813160959,2251799813423103,2251799813554175,2251799813619711,2251799813652479,2251799813668863,2251799813677055,2251799813681151,2251799813683199,2251799813684223,2251799813684735,2251799813684991,2251799813685119,2251799813685183,2251799813685215,2251799813685231,2251799813685239,2251799813685243,2251799813685245,2251799813685246,3377699720527871,3940649673949183,4222124650659839,4362862139015167,4433230883192831,4468415255281663,4486007441326079,4494803534348287,4499201580859391,4501400604114943,4502500115742719,4503049871556607,4503324749463551,4503462188417023,4503530907893759,4503565267632127,4503582447501311,4503591037435903,4503595332403199,4503597479886847,4503598553628671,4503599090499583,4503599358935039,4503599493152767,4503599560261631,4503599593816063,4503599610593279,4503599618981887,4503599623176191,4503599625273343,4503599626321919,4503599626846207,4503599627108351,4503599627239423,4503599627304959,4503599627337727,4503599627354111,4503599627362303,4503599627366399,4503599627368447,4503599627369471,4503599627369983,4503599627370239,4503599627370367,4503599627370431,4503599627370463,4503599627370479,4503599627370487,4503599627370491,4503599627370493,4503599627370494,6755399441055743,7881299347898367,8444249301319679,8725724278030335,8866461766385663,8936830510563327,8972014882652159,8989607068696575,8998403161718783,9002801208229887,9005000231485439,9006099743113215,9006649498927103,9006924376834047,9007061815787519,9007130535264255,9007164895002623,9007182074871807,9007190664806399,9007194959773695,9007197107257343,9007198180999167,9007198717870079,9007198986305535,9007199120523263,9007199187632127,9007199221186559,9007199237963775,9007199246352383,9007199250546687,9007199252643839,9007199253692415,9007199254216703,9007199254478847,9007199254609919,9007199254675455,9007199254708223,9007199254724607,9007199254732799,9007199254736895,9007199254738943,9007199254739967,9007199254740479,9007199254740735,9007199254740863,9007199254740927,9007199254740959,9007199254740975,9007199254740983,9007199254740987,9007199254740989,9007199254740990,13510798882111487,15762598695796735,16888498602639359,17451448556060671,17732923532771327,17873661021126655,17944029765304319,17979214137393151,17996806323437567,18005602416459775,18010000462970879,18012199486226431,18013298997854207,18013848753668095,18014123631575039,18014261070528511,18014329790005247,18014364149743615,18014381329612799,18014389919547391,18014394214514687,18014396361998335,18014397435740159,18014397972611071,18014398241046527,18014398375264255,18014398442373119,18014398475927551,18014398492704767,18014398501093375,18014398505287679,18014398507384831,18014398508433407,18014398508957695,18014398509219839,18014398509350911,18014398509416447,18014398509449215,18014398509465599,18014398509473791,18014398509477887,18014398509479935,18014398509480959,18014398509481471,18014398509481727,18014398509481855,18014398509481919,18014398509481951,18014398509481967,18014398509481975,18014398509481979,18014398509481981,18014398509481982,27021597764222975,31525197391593471,33776997205278719,34902897112121343,35465847065542655,35747322042253311,35888059530608639,35958428274786303,35993612646875135,36011204832919551,36020000925941759,36024398972452863,36026597995708415,36027697507336191,36028247263150079,36028522141057023,36028659580010495,36028728299487231,36028762659225599,36028779839094783,36028788429029375,36028792723996671,36028794871480319,36028795945222143,36028796482093055,36028796750528511,36028796884746239,36028796951855103,36028796985409535,36028797002186751,36028797010575359,36028797014769663,36028797016866815,36028797017915391,36028797018439679,36028797018701823,36028797018832895,36028797018898431,36028797018931199,36028797018947583,36028797018955775,36028797018959871,36028797018961919,36028797018962943,36028797018963455,36028797018963711,36028797018963839,36028797018963903,36028797018963935,36028797018963951,36028797018963959,36028797018963963,36028797018963965,36028797018963966,54043195528445951,63050394783186943,67553994410557439,69805794224242687,70931694131085311,71494644084506623,71776119061217279,71916856549572607,71987225293750271,72022409665839103,72040001851883519,72048797944905727,72053195991416831,72055395014672383,72056494526300159,72057044282114047,72057319160020991,72057456598974463,72057525318451199,72057559678189567,72057576858058751,72057585447993343,72057589742960639,72057591890444287,72057592964186111,72057593501057023,72057593769492479,72057593903710207,72057593970819071,72057594004373503,72057594021150719,72057594029539327,72057594033733631,72057594035830783,72057594036879359,72057594037403647,72057594037665791,72057594037796863,72057594037862399,72057594037895167,72057594037911551,72057594037919743,72057594037923839,72057594037925887,72057594037926911,72057594037927423,72057594037927679,72057594037927807,72057594037927871,72057594037927903,72057594037927919,72057594037927927,72057594037927931,72057594037927933,72057594037927934,108086391056891903,126100789566373887,135107988821114879,139611588448485375,141863388262170623,142989288169013247,143552238122434559,143833713099145215,143974450587500543,144044819331678207,144080003703767039,144097595889811455,144106391982833663,144110790029344767,144112989052600319,144114088564228095,144114638320041983,144114913197948927,144115050636902399,144115119356379135,144115153716117503,144115170895986687,144115179485921279,144115183780888575,144115185928372223,144115187002114047,144115187538984959,144115187807420415,144115187941638143,144115188008747007,144115188042301439,144115188059078655,144115188067467263,144115188071661567,144115188073758719,144115188074807295,144115188075331583,144115188075593727,144115188075724799,144115188075790335,144115188075823103,144115188075839487,144115188075847679,144115188075851775,144115188075853823,144115188075854847,144115188075855359,144115188075855615,144115188075855743,144115188075855807,144115188075855839,144115188075855855,144115188075855863,144115188075855867,144115188075855869,144115188075855870,216172782113783807,252201579132747775,270215977642229759,279223176896970751,283726776524341247,285978576338026495,287104476244869119,287667426198290431,287948901175001087,288089638663356415,288160007407534079,288195191779622911,288212783965667327,288221580058689535,288225978105200639,288228177128456191,288229276640083967,288229826395897855,288230101273804799,288230238712758271,288230307432235007,288230341791973375,288230358971842559,288230367561777151,288230371856744447,288230374004228095,288230375077969919,288230375614840831,288230375883276287,288230376017494015,288230376084602879,288230376118157311,288230376134934527,288230376143323135,288230376147517439,288230376149614591,288230376150663167,288230376151187455,288230376151449599,288230376151580671,288230376151646207,288230376151678975,288230376151695359,288230376151703551,288230376151707647,288230376151709695,288230376151710719,288230376151711231,288230376151711487,288230376151711615,288230376151711679,288230376151711711,288230376151711727,288230376151711735,288230376151711739,288230376151711741,288230376151711742,432345564227567615,504403158265495551,540431955284459519,558446353793941503,567453553048682495,571957152676052991,574208952489738239,575334852396580863,575897802350002175,576179277326712831,576320014815068159,576390383559245823,576425567931334655,576443160117379071,576451956210401279,576456354256912383,576458553280167935,576459652791795711,576460202547609599,576460477425516543,576460614864470015,576460683583946751,576460717943685119,576460735123554303,576460743713488895,576460748008456191,576460750155939839,576460751229681663,576460751766552575,576460752034988031,576460752169205759,576460752236314623,576460752269869055,576460752286646271,576460752295034879,576460752299229183,576460752301326335,576460752302374911,576460752302899199,576460752303161343,576460752303292415,576460752303357951,576460752303390719,576460752303407103,576460752303415295,576460752303419391,576460752303421439,576460752303422463,576460752303422975,576460752303423231,576460752303423359,576460752303423423,576460752303423455,576460752303423471,576460752303423479,576460752303423483,576460752303423485,576460752303423486,864691128455135231,1008806316530991103,1080863910568919039,1116892707587883007,1134907106097364991,1143914305352105983,1148417904979476479,1150669704793161727,1151795604700004351,1152358554653425663,1152640029630136319,1152780767118491647,1152851135862669311,1152886320234758143,1152903912420802559,1152912708513824767,1152917106560335871,1152919305583591423,1152920405095219199,1152920954851033087,1152921229728940031,1152921367167893503,1152921435887370239,1152921470247108607,1152921487426977791,1152921496016912383,1152921500311879679,1152921502459363327,1152921503533105151,1152921504069976063,1152921504338411519,1152921504472629247,1152921504539738111,1152921504573292543,1152921504590069759,1152921504598458367,1152921504602652671,1152921504604749823,1152921504605798399,1152921504606322687,1152921504606584831,1152921504606715903,1152921504606781439,1152921504606814207,1152921504606830591,1152921504606838783,1152921504606842879,1152921504606844927,1152921504606845951,1152921504606846463,1152921504606846719,1152921504606846847,1152921504606846911,1152921504606846943,1152921504606846959,1152921504606846967,1152921504606846971,1152921504606846973,1152921504606846974,1729382256910270463,2017612633061982207,2161727821137838079,2233785415175766015,2269814212194729983,2287828610704211967,2296835809958952959,2301339409586323455,2303591209400008703,2304717109306851327,2305280059260272639,2305561534236983295,2305702271725338623,2305772640469516287,2305807824841605119,2305825417027649535,2305834213120671743,2305838611167182847,2305840810190438399,2305841909702066175,2305842459457880063,2305842734335787007,2305842871774740479,2305842940494217215,2305842974853955583,2305842992033824767,2305843000623759359,2305843004918726655,2305843007066210303,2305843008139952127,2305843008676823039,2305843008945258495,2305843009079476223,2305843009146585087,2305843009180139519,2305843009196916735,2305843009205305343,2305843009209499647,2305843009211596799,2305843009212645375,2305843009213169663,2305843009213431807,2305843009213562879,2305843009213628415,2305843009213661183,2305843009213677567,2305843009213685759,2305843009213689855,2305843009213691903,2305843009213692927,2305843009213693439,2305843009213693695,2305843009213693823,2305843009213693887,2305843009213693919,2305843009213693935,2305843009213693943,2305843009213693947,2305843009213693949,2305843009213693950,3458764513820540927,4035225266123964415,4323455642275676159,4467570830351532031,4539628424389459967,4575657221408423935,4593671619917905919,4602678819172646911,4607182418800017407,4609434218613702655,4610560118520545279,4611123068473966591,4611404543450677247,4611545280939032575,4611615649683210239,4611650834055299071,4611668426241343487,4611677222334365695,4611681620380876799,4611683819404132351,4611684918915760127,4611685468671574015,4611685743549480959,4611685880988434431,4611685949707911167,4611685984067649535,4611686001247518719,4611686009837453311,4611686014132420607,4611686016279904255,4611686017353646079,4611686017890516991,4611686018158952447,4611686018293170175,4611686018360279039,4611686018393833471,4611686018410610687,4611686018418999295,4611686018423193599,4611686018425290751,4611686018426339327,4611686018426863615,4611686018427125759,4611686018427256831,4611686018427322367,4611686018427355135,4611686018427371519,4611686018427379711,4611686018427383807,4611686018427385855,4611686018427386879,4611686018427387391,4611686018427387647,4611686018427387775,4611686018427387839,4611686018427387871,4611686018427387887,4611686018427387895,4611686018427387899,4611686018427387901,4611686018427387902,6917529027641081855,8070450532247928831,8646911284551352319,8935141660703064063,9079256848778919935,9151314442816847871,9187343239835811839,9205357638345293823,9214364837600034815,9218868437227405311,9221120237041090559,9222246136947933183,9222809086901354495,9223090561878065151,9223231299366420479,9223301668110598143,9223336852482686975,9223354444668731391,9223363240761753599,9223367638808264703,9223369837831520255,9223370937343148031,9223371487098961919,9223371761976868863,9223371899415822335,9223371968135299071,9223372002495037439,9223372019674906623,9223372028264841215,9223372032559808511,9223372034707292159,9223372035781033983,9223372036317904895,9223372036586340351,9223372036720558079,9223372036787666943,9223372036821221375,9223372036837998591,9223372036846387199,9223372036850581503,9223372036852678655,9223372036853727231,9223372036854251519,9223372036854513663,9223372036854644735,9223372036854710271,9223372036854743039,9223372036854759423,9223372036854767615,9223372036854771711,9223372036854773759,9223372036854774783,9223372036854775295,9223372036854775551,9223372036854775679,9223372036854775743,9223372036854775775,9223372036854775791,9223372036854775799,9223372036854775803,9223372036854775805,9223372036854775806};\n\nint banglasearch(long long int num);\n\nint main()\n{\n long long int a,b;\n int i,j;\n while(scanf(\"%lld%lld\",&a,&b)!=EOF)\n {\n\n i=banglasearch(a);\n j=banglasearch(b);\n //printf(\"%d %d\\n\",i,j);\n //if(a<array[i])\n //i++;\n if(b<array[j])\n j--;\n //printf(\"%d %d\\n\",i,j);\n printf(\"%d\\n\",j-i+1);\n\n }\n\n return 0;\n\n}\n\nint banglasearch(long long int num)\n{\n int i;\n\n for(i=0;;i++)\n {\n\n if(array[i]>=num)\n return i;\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nunsigned long long a[12800];\nint top = 0;\n\nint main()\n{\n int i, j;\n unsigned long long n = (unsigned long long)-1;\n for (i = 63; i >= 1; --i) {\n n ^= (1LL << i);\n for (j = i - 2; j >= 0; --j) {\n n ^= (1LL << j);\n a[top++] = n;\n n ^= (1LL << j);\n }\n }\n unsigned long long lb, ub;\n int ans = 0;\n scanf(\"%I64u%I64u\", &lb, &ub);\n for (i = 0; i < top; ++i) {\n if (a[i] >= lb && a[i] <= ub) ++ans;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint asd(__int64 l,__int64 r);\nint main()\n{\n\t__int64 i,j,k,m,n,l=0,r=0,sum,ans=0,temp;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tfor(k=1;k<=n;k*=2)\n\tl++;\n\tfor(k=1;k<=m;k*=2)\n\tr++;\n\tl--;\n\tfor(i=1;i<r;i++)\n\t{\n\t\ttemp=0;\n\t\tsum=0;\n\t\tk=1;\n\t\twhile(sum<=m)\n\t\t{\n\t\t\tif(sum>=n&&sum<=m&&temp>i)\n\t\t\tans++;\n\t\t\ttemp++;\n\t\t\tif(temp!=i)\n\t\t\tsum+=k;\n\t\t\tk*=2;\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int a, b;\nint count=0;\nvoid dfs(long long int n,long long int m);\nint main()\n{\t\n\tscanf(\"%I64d%I64d\", &a, &b);\n\tdfs(1,0);\n\tprintf(\"%d\\n\", count);\n}\n\nvoid dfs(long long int n,long long int m)\n{\n\tif(n>b)\n\t{\n\t\treturn;\n\t}\n\tif(n>=a&&n<=b&&1==m)\n\t{\n\t\tcount++;\n\t}\n\tif(0==m)\n\t{\n\t\tdfs(n<<1,1);\n\t}\n\tdfs(n<<1|1,m);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long int j,k,car = 1,i,sayi,a,b,n = 0,m = 0,sonuc = 0;\n\tscanf(\"%lld %lld\",&a,&b);\n\tsayi = a;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tn++;\n\t}\n\tsayi = b;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tm++;\n\t}\n\tfor(i = n ; i <= m ; i++){\n\t\tcar = 1;\n\t\tfor(k = 1 ; k <= i ; k++)\n\t\t\tcar*=2;\n\t\tsayi = car - 1;\n\t\tfor(j = 0 ; j < i-1 ; j++){\n\t\t\tcar = 1;\n\t\t\tfor(k = 1 ; k <= j ; k++)\n\t\t\t\tcar*=2;\n\t\t\tif(sayi-car>=a&&sayi-car<=b)\n\t\t\t\tsonuc++;\n\t\t}\n\t}\n\tprintf(\"%lld\",sonuc);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef unsigned long long int llu;\n\n\nvoid printBits(size_t const size, void const * const ptr)\n{\n unsigned char *b = (unsigned char*) ptr;\n unsigned char byte;\n int i, j;\n\n for (i=size-1;i>=0;i--)\n {\n for (j=7;j>=0;j--)\n {\n byte = b[i] & (1<<j);\n byte >>= j;\n printf(\"%u\", byte);\n }\n }\n puts(\"\");\n}\n\nint numberOfZeros(llu num, size_t const size){\n\tint i, result, temp;\n\tfor(i = 0, result = 0, temp = 0; i < size*8; i++){\n\t\tif(num%2 == 0){\n\t\t\ttemp++;\n\t\t} else {\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t\tnum = num >> 1;\n\t}\n\n\treturn result;\n}\n\nint findMax(llu* b){\n\tint i;\n\tllu max = 1, mask = 3;\n\tmax = ~(max << (sizeof(max)*8 - 2));\n\t\n\n\tfor(i = 0; i < sizeof(max)*8; i++){\n\t\tif(max <= *b){\n\t\t\tbreak;\n\t\t}\n\t\tmax = max >> 1;\n\t}\n\n\tmask = mask << (61 - i);\n\tfor(; (max ^ mask) <= *b && i < 62; max = max ^ mask, mask = mask >> 1, i++);\n\n\t*b = max;\n\n\treturn 62 - i;\n}\n\nint findMin(llu *a){\n\tint i;\n\tllu min = ~0, mask = 3;\n\t\n\n\tfor(i = 0; i < sizeof(min)*8; i++){\n\t\tif((min >> 1) <= *a){\n\t\t\tbreak;\n\t\t}\n\t\tmin = min >> 1;\n\t}\n\n\tmin = min ^ 1;\n\ti = 0;\n\tfor(; (min ^ mask) > *a; min = min ^ mask, mask = mask << 1, i++);\n\n\tif((min ^ mask) == *a){\n\t\tmin = min ^ mask;\n\t\ti++;\n\t\tif(numberOfZeros(min, sizeof(min)) != 1){\n\t\t\tmin = min ^ mask;\n\t\t\ti--;\n\t\t}\n\t}\n\n\t*a = min;\n\n\treturn i;\n}\n\nint len(llu a){\n\tint temp, i, result;\n\n\tfor(i = 0, temp = 0, result = 0; i < 8*sizeof(a); i++, temp++, a = a >> 1){\n\t\tif(a%2 != 0){\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t}\n\n\treturn ++result;\n}\n\nint main(){\n\tllu i, a, b, ta, tb, result = 0;\n\tint pa, pb;\n\n\tscanf(\"%I64d %I64d\", &a, &b);\n\tta = a;\n\ttb = b;\n\n\tpb = findMax(&tb);\n\tpa = findMin(&ta);\n\n\tif(ta >= a && tb <= b && ta <= tb && pa >= 0 && pb >= 0){\n\t\tfor(i = len(ta); i <= len(tb); i++){\n\t\t\tresult += i - 1;\n\t\t}\n\n\t\tresult -= pb;\n\t\tresult -= len(ta) - 2 - pa;\n\t}\n\n\tprintf(\"%I64d\", result);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <memory.h>\n#include <string.h>\n\n\nunsigned long long FindMax(unsigned long long lData )\n{\n\tunsigned long long lRet = 0x1;\n\t\n\n\twhile( lRet < lData )\n\t{\n\t\tlRet <<= 1;\t\n\t}\t\n\n\treturn lRet - 1;\n}\n\nint main()\n{\n\n\tunsigned long long lInput1;\n\tunsigned long long lInput2;\n\n\tunsigned long long lTotalCnt = 0;\n\tunsigned long long lCheck;\n\tunsigned long long lMax ;\n\t\t\n\tunsigned long long i = 0x1;\n\tunsigned long long ii = 0x0;\n\tint iCnt = 0;\n\t\n\tscanf(\"%lld%lld\",&lInput1,&lInput2);\n\t\n\twhile( i <= lInput2 )\n\t{\n\t\ti <<= 1;\t\n\t\tiCnt++;\n\t}\n\n\tlMax = i - 1;\n\n\ti = 0x1;\n\n\tiCnt;\t\n\tii = iCnt;\n\t\n\twhile( lCheck >= lInput1 )\n\t{\n\t\tlCheck = lMax - i ;\n\t\tif( lCheck >= lInput1 && lCheck <= lInput2 )\n\t\t{\n\t\t\tlTotalCnt++;\n\t\t}\n\t\telse if( lCheck < lInput1 )\n\t\t\tbreak;\n\t\t\t\n\t\ti <<= 1;\t\n\t\tii--;\n\t\t\n\t\tif( ii == 1 )\n\t\t{\n\t\t\ti = 0x1;\n\t\t\tlMax >>= 1;\n\t\t\tii = iCnt-1;\n\t\t\tiCnt--;\t\t\t\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\\n\",lTotalCnt);\n\t\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int i,j,k,sonuc=0,a,b,sayi,carpim=1,n=0,m=0;\n\tscanf(\"%lld %lld\",&a,&b);\n\tsayi=a;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tn++;\n\t}\n\tsayi=b;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tm++;\n\t}\n\tfor(i=n;i<=m;i++){\n\n\t\tcarpim=1;\n\t\t\n\t\tfor(j=1;j<=i;j++)\n\t\t\tcarpim*=2;\n\n\t\tsayi=carpim-1;\n\t\t\n\t\tfor(k=1;k<i;k++){\n\t\t\tcarpim=1;\n\t\t\n\t\t\tfor(j=1;j<k;j++)\n\t\t\t\tcarpim*=2;\n\t\t\tif(a <= sayi-carpim && sayi-carpim <= b)\n\t\t\t\t\tsonuc++;\n\t\t}\n\t}\n\tprintf(\"%lld\",sonuc);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int p,a,b,i,j,num,t,c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=63;i>=2;i--)\n {\n num=pow(2,i)-1;\n\n for(j=i-2;j>=0;j--)\n {\n p=pow(2,j);\n t=num-p;\n if(t>=a&&t<=b)\n c++;\n\n }\n\n }\n\n printf(\"%I64d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tlong long int i,j,k,sonuc=0,a,b,sayi,carpim=1,n=0,m=0;\n\tscanf(\"%lld %lld\",&a,&b);\n\tsayi=a;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tn++;\n\t}\n\tsayi=b;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tm++;\n\t}\n\tfor(i=n;i<=m;i++){\n\n\t\tcarpim=1;\n\t\t\n\t\tfor(j=1;j<=i;j++)\n\t\t\tcarpim*=2;\n\n\t\tsayi=carpim-1;\n\t\t\n\t\tfor(k=1;k<i;k++){\n\t\t\tcarpim=1;\n\t\t\n\t\t\tfor(j=1;j<k;j++)\n\t\t\t\tcarpim*=2;\n\t\t\tif(a <= sayi-carpim && sayi-carpim <= b)\n\t\t\t\t\tsonuc++;\n\t\t}\n\t}\n\tprintf(\"%lld\",sonuc);\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int pw(long long int x,int y)\n{\n long long int i;\n long long int ans=1;\n for(i=0;i<y;i++)\n {\n ans=ans*x;\n }\n return ans;\n}\nlong long int oton(long long int x)\n{\n if(x<1){return 0;}\n return (x*(x+1))/2;\n}\nlong long int func(long long int n)\n{\n long long int i,j,k,l,m=0;\n\n// scanf(\"%lld\",&n);\n l=n;\nwhile(n>0)\n{\n m++;\n n=n/2;\n}\n//printf(\"%lld\\n\",m);\n\nlong long int value;\nlong long int count=0;\nfor(i=2;i<=m;i++)\n{\n value=0;\n for(j=1,k=m-1;j<=m;j++,k--)\n {\n if(j==i){\n // printf(\"0\");\n value=value+ 0*pw(2,k);}\n else {\n// printf(\"1\");\n value=value+ 1*pw(2,k);}\n }\n //printf(\" =%lld\\n\",value);\n if(value>l){break;}\n count++;\n}\n//printf(\"%lld\",count);\ncount=count+oton(m-2);\n//printf(\"\\nvalue=%lld count=%lld\\n\",l,count);\nreturn count;\n}\n\nint main()\n{\n long long int n,m;\n scanf(\"%lld %lld\",&n,&m);\n long long int x,y;\n\n long long int ans=func(m)-func(n);\n long long int flag=0;\n\n while(n>0)\n {\n if(n%2==0){flag++;}\n n=n/2;\n }\n\n if(flag==1){ans++;}\n printf(\"%lld\",ans);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nlong long int a[4000];\nvoid init(){\n long long int now=3,count=2,i;\n long long int tem=1;\n int d=0;\n for(i=0;i<count-1;i++){\n a[d++]=now-tem;\n tem=tem<<1;\n if(i==count-2){\n a[d++]=now-tem;\n count++;\n if(count==64)\n break;\n i=0;\n now=now<<1;\n now=now|1;\n tem=1;\n }\n }\n return ;\n}\nint main(){\n init();\n int ret=0;\n long long int c,b;\n scanf(\"%lld%lld\",&c,&b);\n for(int i=0;i<4000;i++){\n if((a[i]>=c)&&(a[i]<=b))\n ret++;\n }\n if(c<=1){\n ret--;\n }\n printf(\"%d\\n\",ret);\n}"}, {"source_code": "#include<stdio.h>\n#define LIM 9223372036854775807\n//#define LIM 9223372\n#define MAX 100005\nint comp(const void *a,const void *b)\n{\n return (int)(*(long long *)a-*(long long *)b);\n}\nint check(long long x)\n{\n /* First x in the below expression is for the case when x is 0 */\n return x && (!(x&(x-1)));\n}\nlong long power(long long x)\n{\n if(x==0)\n return 1;\n else if(x==1)\n return 2;\n else if(x%2==0)\n {\n long long n=power(x/2);\n return n*n;\n }\n else\n {\n long long n=power(x/2);\n return n*n*2;\n }\n}\n\nlong long next(long long n)\n{\n double d=log(n)/log(2);\n long long x=(long long)(d);\n x=x+1;\n // printf(\"hi\\n\");\n return power(x);\n}\nint main()\n{\n long long n,i,len,k,a,b,temp,y,x,num=0;\n long long arr[MAX];\n long long j=0;\n for(i=2;i<LIM/2;i=(2*i)+1)\n {\n x=i;\n y=next(x);\n // printf(\"%lld\\n\",y);\n arr[j++]=x;\n for(k=y;k<LIM/2;k=k*2)\n {\n temp=x+k;\n arr[j++]=temp;\n x=temp;\n // printf(\"%lld \",temp);\n }\n }\n len=j;\n //printf(\"len:%lld\\n\",len);\n qsort(arr,len,sizeof(arr[0]),comp);\n // for(j=0;j<100;j++)\n //printf(\"%lld\\n\",arr[j]);\n scanf(\"%I64d%I64d\",&a,&b);\n for(i=0;i<len;i++)\n {\n if(arr[i]>=a&&arr[i]<=b)\n num++;\n }\n printf(\"%I64d\\n\",num);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j, cnt;\n\tlong long a, b, c, d;\n\n\tscanf(\"%lld%lld\", &a, &b);\n\tcnt = 0;\n\tfor (i = 0; (long long) i <= 60; i++) {\n\t\tc = ((long long) 1 << i) - 1;\n\t\tfor (j = 0; j < i - 1; j++) {\n\t\t\td = c - ((long long) 1 << j);\n\t\t\tif (d >= a && d <= b)\n\t\t\t\tcnt++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long num1[65],num2[65];\n int n1,n2,z1,z2;\n int len1,len2;\n int i,ans;\n\n scanf(\"%I64d%I64d\",num1,num2); num1[0]--;\n len1=1; num1[1]=0;z1=0;z2=0;\n while (num1[0]!=0) {\n num1[len1]=num1[0]%2;\n if (!num1[len1])z1++;\n num1[0]=num1[0]/2;\n len1++;\n }len1--;\n\n len2=1; num2[1]=0;\n while (num2[0]!=0) {\n num2[len2]=num2[0]%2;\n if (!num2[len2])z2++;\n num2[0]=num2[0]/2;\n len2++;\n }len2--;\n if (z1==1) n1=1; else n1=0;\n if (z2==1) n2=1; else n2=0;\n for(i=0;i<len1-1;++i) n1+=i;\n for(i=0;i<len2-1;++i) n2+=i;\n for(i=len1-1;(i>0)&&(num1[i]==1);--i) n1++;\n for(i=len2-1;(i>0)&&(num2[i]==1);--i) n2++;\n\n printf(\"%d\\n\",n2-n1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n\tlong long unsigned int a,b,k=0,d;\n\tscanf(\"%I64u%I64u\",&a,&b);\n\tint i , j ;\n\tfor(i=0;i<=62;i++)\n\t\tfor( j=0;j<i-1;j++)\n\t\t{\n\t\t\td=pow(2,i)-1-pow(2,j);\n\t\t\tif(a<=d && d<=b)\n\t\t\t\tk++;\n\t\t}\n\tprintf(\"%I64u\",k);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long a,b = 0;\nint diga,digb,m,n,p,q,i,j,k,sum=0;\nint bia[200]={0};\nint bib[200]={0};\n\nint main (void)\n\n{\n scanf(\"%lld %lld\",&a,&b);\n\n for(i=0;a>0;i++)\n {\n bia[i]=a%2;\n a=a/2;\n // printf(\"%d\",bia[i]);\n }\n p=i;\n\n for(i=0;b>0;i++)\n {\n bib[i]=b%2;\n b=b/2;\n // printf(\"%d\",bib[i]);\n }\n q=i;\n\n // printf(\" %d %d\",p,q);\n\n\n for(i=p+1;i<q;i++)\n {\n sum += i-1;\n }\n\n for(m=p-1;bia[m]!=0;m--)\n {\n ;\n }\n m++;\n\n\n int times = 0;\n for(i=0;i<=q-1;i++)\n {\n if(bib[i]==0){times++;}\n }\n\n for(n=q-1;bib[n]!=0;n--)\n {\n ;\n }\n n++;\n n=q-1-n;\n\n if(times==1){n++;}\n\n // printf(\" %d %d\",m,n);\n if(p<q)\n {\n printf(\"%d\",sum+m+n);\n }\n else\n {\n printf(\"%d\",m+n-p+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int powx(long long int a,long long int b){\n long long int c,d,e;\n e=a;\n for(c=0;c<b-1;c++){\n a=a*e;\n }\nreturn a;\n}\nint main(){\nlong long int a,b,c,x,inc,cnt=0;\nlong long int input,input1;\nscanf(\"%lld%lld\",&input,&input1);\nfor(a=64;a>=1;a--){\nx=powx(2,a)-1;\ninc=1;\nfor(b=1;b<a;b++){ // \n if((x-inc)>=input && (x-inc)<=input1){\n cnt++;\n }\n inc=inc*2;\n}}\n\nprintf(\"%lld\",cnt);\n\n\n\n\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int funk(long long int x,long long int b){\nlong long int m=1;\n\nlong long int a;\n\nfor(a=1;a<=b;a++){\nm=m*x;\n}\nreturn m;\n\n}\nmain(){\n\n long long int a,b,c;\n long long int increase;\n long long int unos,unos1;\n scanf(\"%lld%lld\",&unos,&unos1);\n long long int x;\n long long int counter=0;\n\n for(a=64;a>=1;a--){\n x=funk(2,a)-1;\n increase=1;\n for(b=1;b<a;b++)\n {\n\n if( ((x-increase)>=unos) && ((x-increase) <=unos1) ){\n counter++;\n //printf(\"%lld %lld %lld\\n\",a,x,increase);\n }\n increase=increase*2;\n }\n\n\n }\n\n printf(\"%lld\",counter);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\n int n , i, num = 0,shift,sh = 1;\n long long x,y,test1 = 2,test2,z=2;\n scanf(\"%lld %lld\",&x,&y);\n long long base = (long long)(ceil(log2l(y)));\n while(sh <= base){\n test2 = test1;\n z = (long long)pow(2,sh);\n while(test2 <= y){\n if(test2 >= x && test2 <= y) num++;\n z *= 2;\n test2 += z;\n }\n sh++;\n test1 = (test1<<1)+1;\n }\n printf(\"%d\\n\",num);\nreturn 0;\n}\n"}, {"source_code": "/*#include <stdio.h>\nint judge(long long x)\n{\n int yushu;\n int flag=2;\n while(1)\n {\n yushu=x%2;\n if(yushu==0)\n flag--;\n if(!flag)\n return 0;\n x/=2;\n if(x<2)\n {\n if(x==0&&flag==1||x==1&&flag==2)\n return 0;\n break;\n }\n }\n return 1;\n}\nint main()\n{\n long long a,b,num=0;\n while(scanf(\"%I64d%I64d\",&a,&b)!=EOF)\n {\n for(; a<=b; a++)\n {\n num+=judge(a);\n }\n printf(\"%I64d\\n\",num);\n }\n return 0;\n}\n*/\n#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long a,b,num[10000];\n int i,j,k;\n int ans=0;\n for(i=2,k=0; i<=60; i++)\n {\n for(j=i-2; j>=0; j--,k++)\n {\n num[k]=(long long)(pow(2,i)-pow(2,j)-1);\n //printf(\"%I64d\\n\",num[k]);\n }\n }\n scanf(\"%I64d%I64d\",&a,&b);\n for(i=0; num[i]<a; i++);\n for(; num[i]<=b; i++,ans++);\n printf(\"%d\\n\",ans);\n //if(pow(2,60)>pow(10,18))\n // printf(\"1\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\t\t\n#define LAST 1000000000000000001L\nmain()\n{\n\tlong long int year, yarr[4000];\n\tlong long twop[66];\n\tlong long p,pmax,a,b;\n\tint i,j,ind,count;\n\tp = 1;\n\ttwop[0]=1;\n\tfor (i=1; p<LAST; i++)\n\t{\n\t\tp = p*2;\n\t\ttwop[i] = p;\n\t}\n\tpmax=i;\n\tind=0;\n\tfor (i=2; i< pmax; i++)\n\t\tfor (j=i-1; j>0; j--)\n\t\t\tyarr[ind++] = twop[i]-1-twop[j-1];\n\tscanf(\"%lld %lld\", &a, &b);\n\tcount=0;\n\tfor (i=0; i<ind; i++)\n\t\tif (a<= yarr[i] && b >= yarr[i]) count++;\n\tprintf(\"%d\\n\",count);\n\treturn 0;\t\n}\n\n"}, {"source_code": "/* https://codeforces.com/contest/611/submission/19896636 (rainboy) */\n#include <stdio.h>\n\nint main() {\n\tlong long a, b, i, j, cnt;\n\n\tscanf(\"%lld%lld\", &a, &b);\n\tcnt = 0;\n\tfor (i = 0; i <= 60; i++) {\n\t\tlong long c;\n\n\t\tc = (1LL << i) - 1;\n\t\tfor (j = 0; j < i - 1; j++) {\n\t\t\tlong long d;\n\n\t\t\td = c - (1LL << j);\n\t\t\tif (d >= a && d <= b)\n\t\t\t\tcnt++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main( void ) {\n unsigned long long a, b;\n scanf(\"%llu %llu\", &a, &b);\n\n unsigned long long ans = 0;\n for( int i = 0; i <= 61; i++ ) {\n unsigned long long x = 0;\n for( int j = 0; j < i; j++ )\n x += (1LLu << j);\n\n for( int j = i+1; j <= 62; j++ ) {\n x += (1LLu << j);\n if( (x >= a) && (x <= b) ) ans++;\n }\n }\n\n printf(\"%llu\\n\", ans);\n\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long ull;\n\null x, y;\null n = 0xFFFFFFFFFFFFFFFE;\n\nint main() {\n int c = 0;\n int i, j;\n scanf(\"%llu %llu\", &x, &y);\n for (i = 1; i <= 63; i++) {\n n = (1ULL << i) - 1;\n for (j = 0; j < i - 1; j++) {\n n = (1ULL << i) - 1;\n n -= 1ULL << j;\n if (n >= x && n <= y) {\n c++;\n }\n }\n }\n printf(\"%d\\n\", c);\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long a, b, x = 0, y = 0, k = -1, cnt = 0;\n\n//\tfreopen(\"input.txt\", \"r\", stdin);\n\n\tscanf(\"%I64d %I64d\", &a, &b);\n\n\twhile (y < a) {\n\t\tcnt++;\n\t\ty = y | ((long long)1 << x);\n\t\tx--;\n\n\t\tif (x == -1) {\n\t\t\tx = ++k;\n\t\t\ty = (y | ((long long)1 << (x + 1))) & ~((long long)1 << x);\n\t\t} else {\n\t\t\ty = y & ~((long long)1 << x);\n\t\t}\n\t}\n\n\tcnt = 0;\n\n\twhile (y <= b) {\n\t\tcnt++;\n\t\ty = y | ((long long)1 << x);\n\t\tx--;\n\n\t\tif (x == -1) {\n\t\t\tx = ++k;\n\t\t\ty = (y | ((long long)1 << (x + 1))) & ~((long long)1 << x);\n\t\t}\n\t\telse {\n\t\t\ty = y & ~((long long)1 << x);\n\t\t}\n\t}\n\n\tprintf(\"%I64d\", cnt);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int a,b,ca=0,cb=0,s,s0,n0;\n scanf(\"%lld %lld\",&a,&b);\n a--;s=1;s0=1;n0=0;while(a){if(a%2==0){s0=s;n0++;}s++;a/=2;}\n ca=s-2-s0+((s-2)*(s-3))/2;if(n0<=1)ca++;\n s=1;s0=1;n0=0;while(b){if(b%2==0){s0=s;n0++;}s++;b/=2;}\n cb=s-2-s0+((s-2)*(s-3))/2;if(n0<=1)cb++;\n printf(\"%lld\",cb-ca);\n return 0;\n}"}, {"source_code": "/**\n * Created By: Anonyman637\n * Created On: 2/26/2020 9:19:39 AM\n */\n\n/* =============================================================================\n ================================== HEADERS ==================================\n ========================================================================== */\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\ntypedef char i8;\ntypedef short i16;\ntypedef int i32;\ntypedef long long i64;\n\ntypedef unsigned char ui8;\ntypedef unsigned short ui16;\ntypedef unsigned int ui32;\ntypedef unsigned long long ui64;\n\n/* =============================================================================\n ================================== MACROS ===================================\n ========================================================================== */\n\n#define DEBUG 0\n\n#if DEBUG\n#define debug(format, ...) printf(format, __VA_ARGS__)\n#else\n#define debug(format, ...) \n#endif\n\n#define NO_OF_BIT 64\n\n/* =============================================================================\n ================================== GLOBALS ==================================\n ========================================================================== */\n\n\n/* =============================================================================\n ================================= FUNCTIONS =================================\n ========================================================================== */\n\nchar* bin(i64 a) {\n char *result = (char *) malloc((NO_OF_BIT + 1) * sizeof(result));\n for (i64 i = NO_OF_BIT - 1; i > -1; i--) {\n result[i] = (a & 1) + '0';\n a >>= 1;\n }\n result[NO_OF_BIT] = '\\0';\n return result;\n}\n\ni64 len(i64 a) {\n\treturn (NO_OF_BIT - __builtin_clzll(a));\n}\n\ni64 hasSingleZero(i64 a) {\n\treturn ((NO_OF_BIT - __builtin_clzll(a)) - __builtin_popcountll(a)) == 1;\n}\n\nint main() {\n\n\ti64 i, t;\n\n\ti64 a, b;\n\tscanf(\"%lld %lld\", &a, &b);\n#if DEBUG\n\tdebug(\"======== %s ========\\n\", \"DEBUG\");\n\tfor (i = a; i <= b; ++i) {\n\t\tif (hasSingleZero(i)) {\n\t\t\tdebug(\"%4lld: %s\\n\", i, bin(i));\n\t\t}\n\t}\n\tdebug(\"===== %s =====\\n\", \"END OF DEBUG\");\n#endif\n\ti64 lenA = len(a);\n\ti64 count = 0;\n\tfor (ui64 mask = (1ULL << lenA) - 1ULL, x; ;mask = (1ULL << ++lenA) - 1ULL) {\n\t\tfor (i = lenA - 2; i > -1; i--) {\n\t\t\tx = mask & ~(1ULL << i);\n\t\t\tif (x >= a && x <= b) {\n\t\t\t\tcount++;\n\t\t\t\tdebug(\"%4d: %s\\n\", count, bin((i64) x));\n\t\t\t} else if (x > b) {\n\t\t\t\tgoto end;\n\t\t\t}\n\t\t}\n\t}\nend:\n\tprintf(\"%lld\", count);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k=0,ara[100],ara1[100],ara2[100],ara3[100000],x,y,ans,h,f;\n scanf(\"%lld%lld\",&x,&y);\n for(i=0;i<61;i++){\n ara[i]=pow(2,i);\n }\n for(i=0;i<61;i++){\n ara1[i]=ara[i]-1;\n }\n for(i=1;i<61;i++){\n for(j=i-2;j>=0;j--){\n ara3[k]=ara1[i]-ara[j];\n k++;\n }\n }\n for(i=0;i<k;i++){\n if(ara3[i]>=x){\n f=i;\n break;\n }\n }\n if(i==k){\n printf(\"%d\",0);\n return 0;\n }\n for(i=k-1;i>=0;i--){\n if(ara3[i]<=y){\n h=i;\n break;\n }\n }\n if(i<0){\n printf(\"%d\",0);\n return 0;\n }\n ans=h-f+1;\n printf(\"%lld\",ans);\n return 0;\n\n// for(i=0;i<k;i++){\n// printf(\"%lld \",ara3[i]);\n// }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int funk(long long int x,long long int b){\nlong long int m=1;\n\nlong long int a;\n\nfor(a=1;a<=b;a++){\nm=m*x;\n}\nreturn m;\n\n}\nmain(){\n\n long long int a,b,c;\n long long int increase;\n long long int unos,unos1;\n scanf(\"%lld%lld\",&unos,&unos1);\n long long int x;\n long long int counter=0;\n\n for(a=64;a>=1;a--){\n x=funk(2,a)-1;\n increase=1;\n for(b=1;b<a;b++)\n {\n\n if( ((x-increase)>=unos) && ((x-increase) <=unos1) ){\n counter++;\n //printf(\"%lld %lld %lld\\n\",a,x,increase);\n }\n increase=increase*2;\n }\n\n\n }\n\n printf(\"%lld\",counter);\n\n\n\n\n\n\n\n\n}"}, {"source_code": "#include<stdio.h>\n\nlong long g(int a[64],int l)\n{\n long long ans,temp;\n int i;\n\n ans=0;\n temp=1;\n for(i=0;i<l;i++,temp*=2)\n {\n ans+=a[i]*temp;\n }\n\n return ans;\n}\n\nint f(long long x)\n{\n int ans,i,j,l,a[64];\n long long temp;\n\n if(x<2)return 0;\n temp=x;\n l=0;\n while(temp)\n {\n l++;\n temp/=2;\n }\n ans=0;\n for(i=0;i<l-1;i++)\n {\n for(j=0;j<64;j++)a[j]=0;\n a[i]=0;\n for(j=i-1;j>=0;j--)a[j]=1;\n for(j=i+1;j<l;j++)\n {\n a[j]=1;\n temp=g(a,j+1);\n if(temp<=x)ans++;\n }\n }\n\n return ans;\n}\n\nint main()\n{\n long long a,b;\n\n scanf(\"%I64d%I64d\",&a,&b);\n printf(\"%d\\n\",f(b)-f(a-1));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \n#include<conio.h> \n\nint ans=0,chk1=0,chk2=0,j,chk=0;\n\nint main() \n{ \n int a[100],b[100]; \n long long dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n if(dec==1)chk=1;\n\t dec-=1; \n\t \n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n\t \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec)\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j-1;\n \t\tchk1=1;\n \t\tcontinue;\n \t\t//printf(\"cdC%dcCSCXZ\",j);\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n if(chk1==0&&chk2==0){\n \tans+=i-1;\n \t\n\t }\n\t //printf(\"\\n\");\n for(j=i-2;j>0;j--){\n \tans+=j;\n \t\n\t }\n\t \n\t int net=0;\n\t if(chk==0){\n\t \tnet=ans;\n\t }\n\t \n\t \n\t chk=0;\n\t //printf(\"%d\",net);\n i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t if(dec==1)chk=1;\n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n while(dec>0) \n { \n b[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec); \n\t\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(b[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j-1;\n \t\tchk1=1;\n \t\tcontinue;\n \t\t//printf(\"ewfdfsxx\");\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t//printf(\"%d\",a[j]);\n }\n if(chk1==0&&chk2==0){\n \tans+=i-1;\n \t\n\t }\n for(j=i-2;j>0;j--){\n \t\n\t\tans+=j;\n \t\n\t }\n\t //printf(\"%d\",ans);\n\t if(chk==0){\n\t \tans-=net;\n\t }else{\n\t \tans=0;\n\t }\n\t \n printf(\"%d\",ans);\n \n //getch();\n }\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main(void) {\n long long int a,b,p,q,i=0,j=0,k,f,l,ans=0,s=0,g=0;\n scanf(\"%lld%lld\",&a,&b);\n long long int x[100],y[100];\n p=a;q=b;\n while(p!=0)\n {\n x[i++]=p%2;\n p=p/2;\n }\n while(q!=0)\n {\n y[j++]=q%2;\n q=q/2;\n }\n for(k=i;k<=j;k++)\n {\n for(f=0;f<k;f++)\n {\n long long int z[100],t=0,w=0;\n for(l=0;l<k;l++)\n {\n if(l!=f)\n z[g++]=1;\n else\n z[g++]=0;\n }\n for(l=g-1;l>=0;l--)\n {\n s=s+pow(2,t)*z[l];\n t++;\n if(z[l]==0 && l!=0)\n w++;\n }\n if(s>=a && s<=b && w==1)\n ans++;\n s=0;\n g=0;\n }\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int input1,input2;\n\tint bin1[100]={0},bin2[100]={0};\n\tscanf(\"%lld%lld\",&input1,&input2);\n\tint i=0,j=0;\n\tint count=0;\n\tint suc1=0;\n\tint suc2=0;\n\n\twhile(input1)\n\t{\n\t\tbin1[i]=input1%2;\n\t\tif(bin1[i]==0)\n\t\t\tcount++;\n\t\tinput1/=2;\n\t\ti++;\n\t}\n\n\tif(count==1)\n\t\tsuc1=1;\n\n\tcount=0;\n\twhile(input2)\n\t{\n\t\tbin2[j]=input2%2;\n\t\tif(bin2[j]==0)\n\t\t\tcount++;\n\t\tinput2/=2;\n\t\tj++;\n\t}\n\n\tif(count==1)\n\t\tsuc2=1;\n\n\n\tint row1=0,row2=0;\n\tint len1=i,len2=j;\n\n\ti--;\n\tj--;\n\twhile(bin1[i])\n\t{\n\t\trow1++;\n\t\ti--;\n\t}\n\n\twhile(bin2[j])\n\t{\n\t\trow2++;\n\t\tj--;\n\t}\n\n\tint sum=0;\n\tif(len1!=len2)\n\t{\n\t\tint tmp1=len1-row1;\n\t\tint tmp2=row2-1;\n\t\tif(suc2)\n\t\t\ttmp2++;\n\n\t\tfor(len1=len1+1;len1<len2;len1++)\n\t\t\tsum+=(len1-1);\n\t\t\n\t\tsum+=(tmp1+tmp2);\n\t}\n\telse\n\t{\n\t\tint tmp1=row1-1;\n\t\tint tmp2=row2-1;\n\t\tif(suc2)\n\t\t\ttmp2++;\n\n\t\tsum=tmp2-tmp1;\n\t}\n\tprintf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j, Ans = 0;\n unsigned long long a, b;\n scanf(\"%I64d %I64d\", &a, &b);\n unsigned long long c = 1, d;\n for(i = 1; i < 64; ++i) {\n c <<= 1;\n c |= 1;\n for(j = 0; j < i; ++j) {\n d = c ^ (1ULL << j);\n if(d >= a && d <= b) {\n ++Ans;\n }\n }\n }\n printf(\"%d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,ca=0,cb=0,ans=0,k;\n long long int ta,tb,a,b,na,nb,p=2;\n scanf(\"%lld %lld\",&a,&b);\n ta=a;tb=b;\n if(a>b)\n {\n int t;\n t=b;\n b=a;\n a=t;\n }\n for(i=1;i<100;i++)\n {\n a=a/p;\n ca++;\n if(a==0)\n {\n break;\n }\n }\n for(i=1;i<100;i++)\n {\n b=b/p;\n cb++;\n if(b==0)\n {\n break;\n }\n }\n /* printf(\"ca %d cb %d\\n\",ca,cb);\n i=1;\n while(i<cb-1)\n {\n ab=ab+i;\n i++;\n }\n printf(\"%d\\n\",ab);\n */\n if(ca==cb)\n {\n for(i=0;i<ca-1;i++)\n {\n p=1;na=0;\n for(j=0;j<ca;j++)\n {\n if(j!=i)\n na=na+p;\n p=p*2;\n }\n // printf(\"%d number %lld\\n\",i,na);\n if(na>=ta && na<=tb)\n ans++;\n // printf(\"ans temp = %d\\n\",ans);\n }\n }\n else\n {\n for(k=ca;k<=cb;k++)\n {\n// printf(\"entering loop k = %d\\n\",k);\n for(i=0;i<k-1;i++)\n {\n// printf(\"entering loop i = %d\\n\",i);\n p=1;na=0;\n for(j=0;j<k;j++)\n {\n// printf(\"entering loop j = %d\\n\",j);\n if(j!=i)\n na=na+p;\n p=p*2;\n }\n// printf(\"%d number %lld\\n\",i,na);\n if(na>=ta && na<=tb)\n ans++;\n// printf(\"ans temp = %d\\n\",ans);\n }\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nunsigned long long binary_digit(unsigned long long n) {\n\tunsigned long long count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tunsigned long long first_year_binary_digit=binary_digit(first_year);\n\tunsigned long long last_year_binary_digit=binary_digit(last_year);\n\n\t/*\n\tprintf(\"\\nfirst year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\t//\u53d8\u91cf\u4e0d\u521d\u59cb\u5316\uff0c\u95ee\u9898\u6bd4\u8f83\u4e25\u91cd\uff01\n\tunsigned long long possible;//\u6ca1\u6709\u521d\u59cb\u5316\u8fd9\u4e2a\u53d8\u91cf\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0\u4e0d\u540c\u7f16\u8bd1\u5668\u7684\u4e0d\u540c\u89e3\u7b54\uff1f\n\tunsigned long long base;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result=0;\n\tunsigned long long i=0;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tbase=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tunsigned long long count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t} else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\tbase=0;//\u6211\u5ffd\u7565\u4e86\u8fd9\u4e2a\u6761\u4ef6\uff01\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year) part1++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 1 = %d\\n\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tbase=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible<=last_year) part3++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit-2);\n\t\t}\n\n\t\t//printf(\"part 2 = %lld\\n\",part2);\n\t\t/*\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t\t//printf(\"result = %lld\\n\",result);\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nunsigned long long binary_digit(unsigned long long n) {\n\tunsigned long long count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tunsigned long long first_year_binary_digit=binary_digit(first_year);\n\tunsigned long long last_year_binary_digit=binary_digit(last_year);\n\n\t/*\n\tprintf(\"\\nfirst year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\t//\u53d8\u91cf\u4e0d\u521d\u59cb\u5316\uff0c\u95ee\u9898\u6bd4\u8f83\u4e25\u91cd\uff01\n\tunsigned long long possible=0;\n\tunsigned long long base=0;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result=0;\n\tunsigned long long i=0;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tbase=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tunsigned long long count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t} else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year) part1++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 1 = %d\\n\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tbase=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible<=last_year) part3++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit-2);\n\t\t}\n\n\t\t//printf(\"part 2 = %lld\\n\",part2);\n\t\t/*\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t\t//printf(\"result = %lld\\n\",result);\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long LL;\n\nint main(void)\n{\n LL a, b;\n int ans = 0, i, j;\n scanf(\"%I64d%I64d\", &a, &b);\n for(i = 2; i < 63; i++)\n for(j = 0; j < i-1; j++)\n {\n LL tot = (1LL << i) - 1 - (1LL << j);\n if(a <= tot && tot <= b)\n ans++;\n }\n printf(\"%d\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long LL;\n\nint main(void)\n{\n LL a, b;\n int ans = 0, i, j;\n scanf(\"%I64d%I64d\", &a, &b);\n for(i = 2; i < 63; i++)\n for(j = 0; j < i-1; j++)\n {\n LL tot = ((1LL << i) - 1)^(1LL << j);\n if(a <= tot && tot <= b)\n ans++;\n }\n printf(\"%d\", ans);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#define MOD 1000000007\n\nint cmpfunc(const void *a, const void *b){\n return *(int*)a - *(int*)b;\n}\n\nint min(int a,int b){\n\treturn (a>b)?b:a;\n}\n\nint\nmain(int argc, char *argv[]) {\n\tlong long a,b;\n scanf(\"%lld %lld\",&a,&b);\n int sa[100],sb[100];\n int i=0;\n while(a>0){\n sa[i]=a%2;\n a/=2;\n i++;\n }\n int j=0;\n while(b>0){\n sb[j]=b%2;\n b/=2;\n j++;\n }\n int k;\n int len_a=i,len_b=j;\n long long ans=0;\n if(len_a==len_b) {\n for(i=len_a-1;i>=0;i--){\n if(sa[i]==sb[i] && sa[i]==1) ;\n else break;\n }\n if(i<0) {ans=0;}\n else{\n if(sa[i]==sb[i] && sa[i]==0){\n for(j=i-1;j>=0;j--){\n if(sb[j]==0) {ans=0;break;}\n }\n if(j<0) {ans++;}\n } else{\n for(j=i-1;j>=0;j--){\n if(sb[j]==0) break;\n }\n if(j>=0){\n ans=i-j;\n for(k=j-1;k>=0;k--){\n if(sb[k]==0) break;\n }\n if(k<0) {ans++;}\n } else {ans=i+1;}\n }\n }\n } else {\n for(i=len_a-1;i>=0;i--){\n if(sa[i]==0) break;\n }\n if(i>=0){\n ans=i+1;\n }\n for(i=len_a+1;i<len_b;i++)\n {ans+=i-1;}\n //consider len_b only\n for(i=len_b-1;i>=0;i--){\n if(sb[i]==0) break;\n }\n if(i<0) {ans+=len_b-1;}\n else{\n ans+=len_b-2-i;\n for(k=i-1;k>=0;k--){\n if(sb[k]==0) break;\n }\n if(k<0) {ans++;}\n }\n }\n printf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long long a, b;\n scanf(\"%I64d%I64d\", &a, &b);\n \n int c = 0, i, j;\n for(i = 0; (1LL << i) / 2 <= b; i++)\n for(j = 0; j <= i - 2; j++) {\n long long x = (1LL << i) - 1 - (1LL << j);\n c += (x >= a && x <= b);\n }\n \n printf(\"%d\", c);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int a;\n unsigned long long int b,s[100000],i,j,k,total;\n total = k = 0;\n s[k++] = 2;\n for(i=1;i< 64;i++)\n {\n j = i-1;\n while(j != 0)\n {\n s[k] = (s[k-1]>>1) + ((unsigned long long int)1 << i);\n j--;k++;\n }\n s[k] = (s[k-1] /2) + ((unsigned long long int)1 << (i+1));\n k++;\n }\n scanf(\"%llu %llu\",&a, &b);\n for(i=0;s[i] <= b;i++)\n {\n if(s[i] >= a)\n total++;\n }\n\n printf(\"%lu\\n\",total);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n\nint cmpfunc(const void * a, const void * b)\n{\n if (*(long long int*)a > *(long long int*)b )\n return 1;\n else if (*(long long int*)a == *(long long int*)b )\n return 0;\n else\n return -1;\n}\n\nlong long int convert(int start, int pos) {\n return pow(2,start+1) - 1 - pow (2,pos); \n}\n\nint find(long long int * result, int count, long long int e, int * found) {\n int i;\n for (i=0;i<count;i++) {\n if (result[i] >= e )\n break;\n }\n if (result[i] == e) \n *found = 1;\n else \n *found = 0;\n return i;\n}\n\nint main(void) {\n // your code goes here\n long long int a, b;\n long long int result[2000];\n int indexA, indexB, count = 0, start, pos, i, foundA, foundB, res;\n\n for (start = 0; start <60; start++) {\n for (pos = 0; pos <=start-1; pos++) {\n result[count++] = convert(start, pos);\n }\n }\n \n qsort(result, count, sizeof(long long int), cmpfunc);\n /*\n for (i=0;i<20;i++) {\n printf(\"%lld \", result[i]);\n }\n*/\n while(scanf(\"%lld %lld\", &a, &b)!=-1) {\n indexA = find(result, count, a, &foundA);\n //printf(\"indexA = %d\\n\", indexA);\n indexB = find(result, count, b, &foundB);\n //printf(\"indexB = %d\\n\", indexB);\n \n if (foundB) {\n res = indexB - indexA + 1;\n } else {\n res = indexB - indexA; \n }\n\n printf(\"%d\\n\", res);\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int v[2000];\nint main(){\n int l,i,r,j;\n long long int x,y;\n scanf(\"%I64d %I64d\",&x,&y);\n for(i=l=0;i<60;i++){\n for(j=i-1;~j;j--){\n for(r=0;r<=i;r++){\n v[l]|=(long long int)(j!=r)<<(r);\n }\n l++;\n }\n }\n i=r=0;\n while(v[i]<x){\n i++;\n }\n while(v[i]<=y){\n i++;\n r++;\n }\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int v[2000];\nint main(){\n int l,i,r,j;\n long long int x,y;\n scanf(\"%I64d %I64d\",&x,&y);\n for(i=l=0;i<=60;i++){\n for(j=i-1;~j;j--){\n for(r=0;r<=i;r++){\n v[l]|=(long long int)(j!=r)<<(r);\n }\n l++;\n }\n }\n i=r=0;\n while(v[i]<x){\n i++;\n }\n while(v[i]<=y){\n i++;\n r++;\n }\n printf(\"%d\",r);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n // your code goes here\n long long powtwo[59],k;\n powtwo[0]=1;\n int i,j,n1,n2,flag=1;\n for(i=1;i<=58;i++)powtwo[i]=powtwo[i-1]*2;\n long long arr[1770];\n arr[0]=2;j=0;\n for(i=1;i<=58;i++)\n {\n long long start=arr[j]+powtwo[i]+1;\n j++;\n arr[j]=start;\n for(k=i-1;k>=0;k--,j++)\n arr[j+1]=arr[j]+powtwo[k];\n }\n long long l,r;\n scanf(\"%lld %lld\",&l,&r);\n for(i=0;i<1770;i++)\n {\n if(flag && arr[i]>=l){n1=i;flag=0;}\n if(arr[i]>r){n2=i;break;}\n }\n if(i==1770)n2=i;\n printf(\"%d\\n\",n2-n1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n\nint main()\n{\n\tlong long int a,b;\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tint count=0;\n\tint i,j;\n\tfor(i=0;i<=64;i++)\n\t{\n\t\tfor(j=0;j<=i-2;j++)\n\t\t{\n\t\t\tlong long int x=(1LL<<i)-1-(1LL<<j);\n\t\t\tif((x>=a)&&(x<=b))\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d \\n\",count);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int l,n,m,k,i,j,count=0,count0=0;\n\tscanf(\"%lld%lld\",&n,&m);\n\ti=n;\n\tfor(i=0;i<=64;i++)\n\t{\n\t\tfor(j=0;j<i-1;j++)\n\t\t{\n\t\t\t(count0)=pow(2,i)-pow(2,j)-1;\n\t\t\tif((count0)<=m&&(count0)>=n)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t}\n\tprintf(\"%lld\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nint main()\n{\n ll a,b;\n scanf(\"%lld%lld\",&a,&b);\n ll i=0,j=0,count1=0,bit1=0,bit2=0,temp1=0,count2=0,temp2=0,ans=0;\n for(j=a;j>0;j=j/2)\n {\n if(j%2==1)\n temp1++;\n else\n temp1=0; \n bit1++;\n if(j%2==0)\n count1++;\n }\n \n for(j=b;j>0;j=j/2)\n {\n bit2++;\n if(j%2==1)\n temp2++;\n else\n temp2=0; \n if(j%2==0)\n count2++;\n }\n\n if(bit1==bit2)\n {\n ans += temp2-temp1;\n if(count2==1)\n ans++;\n }\n if(bit1!=bit2)\n {\n ans+=bit1-temp1;\n if(count2==1)\n ans++;\n ans+=temp2-1;\n }\n for(i=bit1+1;i<=bit2-1;i++)\n {\n ans += (i-1);\n }\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\ntypedef unsigned long long uint64;\n\nint solve(uint64 a, uint64 b)\n{\n int ans = 0;\n for (int i = 0; i < 64; i++) {\n for (int j = 0; j < i-1; j++) {\n uint64 cur = (1ULL << i) - 1 - (1ULL << j);\n if (cur >= a && cur <= b)\n ans++;\n }\n if ((1ULL << 1) / 2 > b) {\n return ans;\n }\n }\n return ans;\n}\n\nint main()\n{\n uint64 a, b;\n scanf(\"%llu %llu\", &a, &b);\n printf(\"%d\\n\", solve(a, b));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long a[2000];\nint main() {\n\tlong long c,b;\n\tfor (int i = 1;i<=60;i++) {\n\t\tfor (int j = 1;j<i;j++) {\n\t\t\ta[(i-2)*(i-1)/2+j] = (long long)(pow(2,i)-pow(2,j-1)-1);\n\t\t}\n\t}\n\twhile (scanf(\"%I64d %I64d\",&c,&b)!=EOF) {\n\t\tint count=0;\n\t\tfor (int i = 1;i<2000;i++) {\n\t\t\tif (a[i]>=c&&a[i]<=b) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",count);\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(){\n long long table[2000];\n int n = 0;\n for (int i = 2; i <= 60; i++){\n for (int j = 0; j < i - 1; j++){\n table[n] = (long long)(pow(2.0, i) - pow(2.0, j) - 1);\n n++;\n }\n }\n long long y1, y2;\n while (scanf(\"%I64d%I64d\", &y1, &y2) != EOF){\n int count = 0;\n for (int i = 0; i < n;i++){\n if (table[i] <= y2 && table[i] >= y1) count++;\n }\n printf(\"%d\\n\", count);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\n#define ull unsigned long long\n\null getNum(long int amount) {\n ull result = 1;\n for (int i = 1; i < amount; ++i) {\n result = result << 1;\n result = result | 1;\n }\n return result;\n}\n\nlong int getAmount(ull num) {\n long int amount = 1;\n while (num > 1) {\n ++amount;\n num = num / 2;\n }\n return amount;\n}\n\nint main() {\n ull left = 0;\n ull right = 0;\n scanf(\"%llu %llu\", &left, &right);\n long int leftAm = getAmount(left);\n long int rightAm = getAmount(right);\n long int result = 0;\n for (long int i = leftAm; i <= rightAm ; ++i) {\n ull mask = getNum(i);\n for (long int j = 0; j < i - 1; ++j) {\n ull minus = (ull) 1 << j;\n ull tmp = mask - minus;\n if (tmp >= left && tmp <= right) ++result;\n }\n }\n printf(\"%ld\", result);\n return 0;\n}"}, {"source_code": "/**Bismillahir Rahamnir Rahim.**/\n\n#include <stdio.h>\nint main()\n{\n long long int a, b, c, i, lnth_a, lnth_b, ans,tmp, indx1, indx2, cnt=0,k, cndtn=1;\n char aa[30000], bb[30000];\n scanf(\"%I64d%I64d\", &a, &b);\n for(i=0; a!=0; i++)\n {\n c = a%2;\n aa[i] = c+48;\n a/=2;\n }\n aa[i] = '\\0';\n for(i=0; b!=0; i++)\n {\n c = b%2;\n bb[i] = c+48;\n b/=2;\n }\n bb[i] = '\\0';\n lnth_a = strlen(aa);\n lnth_b = strlen(bb);\n for(i=0, k=lnth_a-1; i<lnth_a/2; i++, k--)\n {\n tmp = aa[i];\n aa[i] = aa[k];\n aa[k] = tmp;\n }\n for(i=0, k=lnth_b-1; i<lnth_b/2; i++, k--)\n {\n tmp = bb[i];\n bb[i] = bb[k];\n bb[k] = tmp;\n }\n for(i=0, indx1=0; aa[i]; i++)\n {\n if(aa[i] == '0')\n {\n indx1 = lnth_a-i;\n break;\n }\n }\n for(i=0, indx2=lnth_b-1, cndtn=1; bb[i]; i++)\n {\n if(bb[i] == '0')\n {\n if(cndtn==1)\n {\n indx2 = i-1;\n cndtn = 0;\n }\n cnt++;\n }\n\n }\n if(cnt==1) indx2++;\n if(lnth_a==lnth_b)\n {\n tmp = lnth_a-1;\n ans = (indx1+indx2)-tmp;\n printf(\"%I64d\\n\", ans);\n }\n else\n {\n tmp = lnth_b - lnth_a;\n if(tmp == 1) printf(\"%I64d\\n\", indx1+indx2);\n else\n {\n for(i = lnth_a+1, ans=0; i<lnth_b; i++) ans+= (i-1);\n ans += (indx1+indx2);\n printf(\"%I64d\\n\", ans);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n\nint n;\nlong long dp[75][75][2][2];\nchar str[75], temp[75], visited[75][75][2][2];\n\nlong long F(int i, int c, int flag, int nz){\n if (i == n) return (c == 1);\n if (visited[i][c][flag][nz]) return dp[i][c][flag][nz];\n\n long long res = 0;\n if (flag){\n res += F(i + 1, c, 1, 1);\n if (nz) res += F(i + 1, c + 1, 1, nz);\n else res += F(i + 1, c, 1, nz);\n }\n else{\n if (str[i] == 48) res += F(i + 1, c + 1, 0, nz);\n else{\n res += F(i + 1, c, 0, 1);\n if (nz) res += F(i + 1, c + 1, 1, nz);\n else res += F(i + 1, c, 1, nz);\n }\n }\n\n visited[i][c][flag][nz] = 1;\n return (dp[i][c][flag][nz] = res);\n}\n\nlong long S(long long x){\n if (!x) return 0;\n int i, d = 0;\n while (x) {\n temp[d++] = (x & 1) + 48;\n x >>= 1;\n }\n\n for (n = 0, i = d - 1; i >= 0; i--) str[n++] = temp[i];\n str[n] = 0;\n clr(visited);\n return F(0, 0, 0, 0);\n}\n\nint main(){\n long long a, b;\n scanf(\"%lld %lld\", &a, &b);\n printf(\"%lld\\n\", S(b) - S(--a));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint max(int a , int b){return a>b?a:b;}\nint min(int a , int b){return a<b?a:b;}\nint binsear(long long);\n\nlong long ar[10004];\nint len;\n\nint main(){\n\tlen=0;\n\tint i,j,k;\n\tlong long x=1,i1,i2;\n\tfor(i=2;i<65;i++){\n\t\tx=x<<1;\n\t\tx++;\n\t\tfor(j=i-2;j>=0;j--){\n\t\t\tar[len++]=x^((long long)1<<j);\n\t\t\t//\tprintf(\"adding %I64d\\n\",ar[len-1]);\n\t\t}\n\t}\n\tscanf(\"%I64d %I64d\",&i1,&i2);\n\tprintf(\"%d\\n\",binsear(i2)-binsear(i1-1));\n\treturn 0;\n}\n\nint binsear(long long x){\n\tint s,e,m;\n\ts=0;e=len-1;\n\tif(x<ar[s])return 0;\n\twhile(s<e){\n\t\tm=(s+e+2)>>1;\n\t\tif(ar[m]<=x)\n\t\t\ts=m;\n\t\telse\n\t\t\te=m-1;\n\t}\n\t//\tprintf(\"binsear %I64d=%d\\n\",x,s);\n\treturn s+1;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef unsigned long long int llu;\n\n\nvoid printBits(size_t const size, void const * const ptr)\n{\n unsigned char *b = (unsigned char*) ptr;\n unsigned char byte;\n int i, j;\n\n for (i=size-1;i>=0;i--)\n {\n for (j=7;j>=0;j--)\n {\n byte = b[i] & (1<<j);\n byte >>= j;\n printf(\"%u\", byte);\n }\n }\n puts(\"\");\n}\n\nint numberOfZeros(llu num, size_t const size){\n\tint i, result, temp;\n\tfor(i = 0, result = 0, temp = 0; i < size*8; i++){\n\t\tif(num%2 == 0){\n\t\t\ttemp++;\n\t\t} else {\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t\tnum = num >> 1;\n\t}\n\n\treturn result;\n}\n\nint findMax(llu* b){\n\tint i;\n\tllu max = 1, mask = 3;\n\tmax = ~(max << (sizeof(max)*8 - 2));\n\t\n\n\tfor(i = 0; i < sizeof(max)*8; i++){\n\t\tif(max <= *b){\n\t\t\tbreak;\n\t\t}\n\t\tmax = max >> 1;\n\t}\n\n\tmask = mask << (61 - i);\n\tfor(; (max ^ mask) <= *b && i < 62; max = max ^ mask, mask = mask >> 1, i++);\n\n\t*b = max;\n\n\treturn 62 - i;\n}\n\nint findMin(llu *a){\n\tint i;\n\tllu min = ~0, mask = 3;\n\t\n\n\tfor(i = 0; i < sizeof(min)*8; i++){\n\t\tif((min >> 1) <= *a){\n\t\t\tbreak;\n\t\t}\n\t\tmin = min >> 1;\n\t}\n\n\tmin = min ^ 1;\n\ti = 0;\n\t// printBits(sizeof(min), &min);\n\tfor(; (min ^ mask) > *a; min = min ^ mask, mask = mask << 1, i++);\n\n\tif((min ^ mask) == *a){\n\t\tmin = min ^ mask;\n\t\ti++;\n\t\tif(numberOfZeros(min, sizeof(min)) != 1){\n\t\t\tmin = min ^ mask;\n\t\t\ti--;\n\t\t}\n\t}\n\n\t*a = min;\n\n\treturn i;\n}\n\nint len(llu a){\n\tint temp, i, result;\n\n\tfor(i = 0, temp = 0, result = 0; i < 8*sizeof(a); i++, temp++, a = a >> 1){\n\t\tif(a%2 != 0){\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t}\n\n\treturn ++result;\n}\n\nint main(){\n\tllu i, a, b, ta, tb, result = 0;\n\tint pa, pb;\n\n\tscanf(\"%llu %llu\", &a, &b);\n\tta = a;\n\ttb = b;\n\n\tpb = findMax(&tb);\n\t// printf(\"Max: %lld\\n\", tb);\n\tpa = findMin(&ta);\n\t// printf(\"Min: %lld, pa: %d\\n\", ta, pa);\n\t// printBits(sizeof(ta), &ta);\n\n\tif(ta >= a && tb <= b && ta <= tb && pa >= 0 && pb >= 0){\n\t\tfor(i = len(ta); i <= len(tb); i++){\n\t\t\tresult += i - 1;\n\t\t}\n\n\t\tresult -= pb;\n\t\tresult -= len(ta) - 2 - pa;\n\t}\n\n\tprintf(\"%llu\", result);\n\treturn 0;\n}\n// 1453789088359"}, {"source_code": "#include<stdio.h>\n\nlong long int a;\nlong long int b;\nint lena, lenb;\nlong long int twos[70];\nlong long int nums[10000];\nlong long int ind = 0;\n\nvoid two(){\n twos[0] = 1;\n int i;\n for(i = 1; i < 70; i++) twos[i] = 2 * twos[i - 1];\n return;\n}\n\nint find_len(long long int x){\n int i;\n for(i = 0; i < 100; i++){\n if(twos[i] > x) return i - 1;\n }\n}\n\nvoid make_nums(){\n int i, j;\n for(i = lena; i <= lenb + 1; i++){\n for(j = i - 2; j > -1; j--){\n nums[ind] = twos[i] - twos[j] - 1;\n ind++;\n }\n }\n return;\n}\n\nmain(){\n scanf(\"%I64d %I64d\", &a, &b);\n two();\n lena = find_len(a);\n lenb = find_len(b);\n make_nums();\n long long int start, end;\n int i;\n for(i = 0; i < ind; i++){\n if(nums[i] > a - 1) break;\n }\n start = i;\n for(i = ind - 1; i > -1; i--){\n if(nums[i] < b + 1) break;\n }\n end = i;\n printf(\"%I64d\", end - start + 1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nint main()\n{\n\tll i,j,a,b,c;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tll cnt=0;\n\tfor(i=0;1LL<<i<=2*b;i++)\n\t{\n\t//\tprintf(\"%Ld\\n\",i);\n\t\tll res;\n\t\tll tmp=1LL<<i;\n\t\ttmp--;\n\t\tfor(j=0;j<=i-2;j++)\n\t\t{\n\t\t\t//printf(\"%Ld\\t%Ld\\t%Ld\\n\",i,1LL<<i,1LL<<j);\n\t\t\tres=tmp-(1LL<<j);\n\t\t\t//printf(\"%Ld\\t%Ld\\n\",i,res);\n\t\t\tif(res>=a&&res<=b)\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",cnt);\n}\n"}, {"source_code": "/* Problem: 611B - New Year and Old Property */\n/* Solver: Gusztav Szmolik */\n\n#include <stdio.h>\n\nint main ()\n {\n unsigned long long a;\n unsigned long long b;\n unsigned long long n;\n unsigned long long d;\n unsigned short c;\n unsigned long long dt;\n \n if (scanf(\"%I64u %I64u\",&a,&b) != 2)\n return -1;\n if (a < 1 || a > 1000000000000000000ULL || b < 1 || b > 1000000000000000000ULL)\n return -1;\n if (a > b)\n return -1;\n n = 2;\n d = 1;\n while (n < a)\n {\n n = 2*n+2;\n d *= 2;\n }\n n = n+1-d;\n c = 0;\n dt = d;\n while (n <= b)\n {\n if (n >= a)\n c++;\n if (dt > 1)\n {\n n += dt;\n dt /= 2;\n n -= dt;\n }\n else\n {\n d *= 2;\n n = 2*n+3-d;\n dt = d;\n }\n }\n printf (\"%hu\\n\",c);\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int ac,b,temp,i,j,k,a[3005];\n\tint count;\n\tk = 0;\n\tcount = 0;\n\tfor(i=1;i<=60;i++)\n\t{\n\t\ttemp = (long long)pow(2,i) - 1;\n\t\tfor(j=0;j<i-1;j++)\n\t\t{\n\t\t\ta[k] = temp - (long long)pow(2,j);\n\t\t\t//printf(\"%lld\\n\",a[k]);\n\t\t\tk++;\n\t\t}\n\t}\n\t/*for(i=0;i<1770;i++)\n\t{\n\t\tprintf(\"%lld\\n\",a[i]);\n\t}*/\n\tscanf(\"%lld %lld\",&ac,&b);\n\tfor(j=0;j<1771;j++)\n\t{\n\t\tif(a[j]>=ac && a[j]<=b)\n\t\t{\n\t\t\t//printf(\"%lld\\n\",a[j]);\n\t\t\tcount = count + 1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\nreturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\n\nlong long int ans=0,a,b;\nint f(long long int x, long long int cnt)\n{\n\tif(x>b)\n\t\treturn;\n\n\tif(a<=x && x<=b && cnt ==1)\n\t\tans++;\n\n\tif(cnt == 0)\n\t\tf(2*x,cnt+1);\n\n\tf(2*x+1,cnt);\n}\n\nint main()\n{\n\tscanf(\"%lld %lld\",&a,&b);\n\tf(1,0);\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long int j,ma = 1,na = 1,k,car = 1,i,sayi,a,b,n = 0,m = 0,sonuc,ensonuc = 0;\n\tscanf(\"%lld %lld\",&a,&b);\n\tsayi = a;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tna*=2;\n\t\tn++;\n\t}\n\tna--;\n\tsayi = b;\n\twhile(sayi>=1){\n\t\tsayi=sayi/2;\n\t\tma*=2;\n\t\tm++;\n\t}\n\tma--;\n\t//sayi;ar\n\tfor(i = n ; i <= m ; i++){\n\t\tcar = 1;\n\t\tfor(k = 1 ; k <= i ; k++)\n\t\t\tcar*=2;\n\t\tsayi = car - 1;\n\t\tfor(j = 0 ; j < i-1 ; j++){\n\t\t\tcar = 1;\n\t\t\tfor(k = 1 ; k <= j ; k++)\n\t\t\t\tcar*=2;\n\t\t\tif(sayi-car>=a&&sayi-car<=b)\n\t\t\t\tensonuc++;\n\t\t}\n\t}\n\tprintf(\"%lld\",ensonuc);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{long long a,b,v,j=1,i,p,q,c=0;\nscanf(\"%lld%lld\",&a,&b);\nlong long ar[62];\nfor(i=0;i<62;i++)\n{ar[i]=j-1;j*=2;\nif(a>ar[i])p=i+1;if(b>ar[i])q=i+1;}\nfor(i=p;i<=q;i++)\n{j=2;v=ar[i]-(ar[i-j]+1);\nwhile(j<=i){if(v>=a&&v<=b)c++;j++;v=ar[i]-(ar[i-j]+1);}}\nprintf(\"%d\",c);\nreturn 0;}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define Max 10000\nlong long mpow(int a, int b) {\n long long res = 1;\n int i;\n for ( i = 0; i < b; i++) res *= a;\n return res;\n}\nint main()\n{\n long long num[Max], tmp = 1, cur = 0, k = 0, cont, a, b;\n int i, j, l;\n\n for (i = 2; i <= 64; i++)\n {\n tmp = tmp << 1;\n tmp = tmp | 1;\n //printf(\"tmp = %I64d\\n\", tmp);\n for (j = 0; j < i-1; j++)\n {\n cur = tmp-mpow(2,j);\n num[k++] = cur;\n// //printf(\"%I64d\\n\", cur);\n// for (l = 1; l <= 64; l++)\n// {\n// printf(\"%I64d\", cur&1);\n// cur = cur >> 1;\n// }\n// printf(\"\\n\");\n// //system(\"pause\");\n }\n }\n\n num[k] = tmp-mpow(2,63);\n cur = num[k];\n while (scanf(\"%I64d%I64d\", &a, &b) != EOF)\n {\n cont = 0;\n for (i = 0; i <= k; i++)\n {\n if (num[i] >= a && num[i] <= b)\n {\n cont++;\n }\n }\n printf(\"%I64d\\n\", cont);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tunsigned long long int s, e, cnt2=0, cnt1=0, temp2, i, base,base1, temp;\n\tscanf(\"%llu %llu\",&s, &e);\n\tfor(base1=2, temp2=2;base1<=e;base1=base1<<1|1){\n\t\tfor(base=base1,temp=temp2;base<=e;base=base|temp){\n\t\t\tif(base>=s&&base<=e) cnt2++;\n\t\t\ttemp<<=1;\n\t\t}\n\t\ttemp2<<=1;\n\t}\n\t/*printf(\"%llu\\n\",cnt2);\n\tfor(base1=2;base1<s;base1=base1<<1|1){\n\t\tfor(base=1,temp=2;base<s;base=base|temp){\n\t\t\tif(base>=s&&base<=e) cnt1++;\n\t\t\ttemp=temp<<1;\n\t\t}\n\t}\n\tprintf(\"%llu\\n\\n\\n\",cnt1);*/\n\tprintf(\"%llu\\n\",cnt2);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef __linux__\n#define LLD \"%lld\"\n#else\n#define LLD \"%I64d\"\n#endif\n\ntypedef long long ll;\n\nint \ncd (ll a) \n{\n\tint d = 0;\n\n\twhile (a) {\n\t\ta /= 2;\n\t\t++d;\n\t}\n\treturn d;\n}\n\nint\nmain()\n{\n\tll\ta, b;\n\tint\tans = 0;\n\tint\ti;\n\tll\tfn, ln;\n\tll\tt, fd, ld;\n\n\tscanf (LLD LLD, &a, &b);\n\n\tfd = cd (a);\n\tld = cd (b);\n\tfor (i = fd+1; i <= ld-1; i++) {\n\t\tans += (i-1);\n\t}\n\n\tfn = (1ll << fd) - 1;\n\tln = (1ll << ld) - 1;\n\t\n\tif (fd >= 2) {\n\t\tt = 1ll << (fd -2);\n\t} else {\n\t\tt = 0;\n\t}\n\n\twhile (t) {\n\t\tll d;\n\n\t\td = fn ^ t;\n\t\tt >>= 1;\n\n\t\tif (d >= a && d <= b) {\n\t\t\t++ans;\n\t\t}\n\t}\n\tif (ld != fd) {\n\t\tt = 0;\n\t\tif (ld >= 2) {\n\t\t\tt = 1ll << (ld -2);\n\t\t}\n\n\t\twhile (t) {\n\t\t\tll d;\n\n\t\t\td = ln ^ t;\n\t\t\tt >>= 1;\n\n\t\t\tif (d >= a && d <= b) {\n\t\t\t\t++ans;\n\t\t\t}\n\t\t}\n\t}\n\tprintf (\"%d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\t\treturn 1;\n\telse if(y%2==0)\n\t\treturn power(x,y/2)*power(x,y/2);\n\telse\n\t\treturn x*power(x,y/2)*power(x,y/2);\n}\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tlong long int n,i,j,a[2484],l=0,count=0,b,c;\n\tscanf(\"%lld %lld\",&b,&c);\n\tfor(i=2;i<=70;i++)\n\t{\n\t\tfor(j=i-2;j>=0;j--)\n\t\t{\n\t\t\ta[l]=power(2,i)-1-power(2,j);\n\t\t\tl++;\n\t\t}\n\t}\n//\tprintf(\"%lld\\n\",l);\n\tqsort(a, 2415, sizeof(long long int), cmpfunc);\n\tfor(i=0;i<2415;i++)\n\t{\n\t\tif(b<=a[i] && a[i]<=c && a[i]!=a[i+1])\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n\tlong long int a,b;\n\tscanf(\"%lld%lld\", &a,&b);\n\t\n\tint n,m,i,j;\n\t\n\tfor(i=0;;i++)\n\t{\n\t\tif((pow(2,i))>a)\n\t\t{\n\t\t\tn=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tfor(i=0;;i++)\n\t{\n\t\tif((pow(2,i))>b)\n\t\t{\n\t\t\tm=i;\n\t\t\tbreak;\n\t\t}\n\t}\t\n\t\n\tlong long int count=0;\n\t\n\tfor(i=n;i<=m;i++)\n\t{\n\t\tfor(j=0;j<i-1;j++)\n\t\t{\n\t\t\tlong long int k=pow(2,i)-1;\n\t\t\tlong long int l=pow(2,j);\n\t\t\t\n\t\t\tif((k-l)>=a && (k-l)<=b)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\", count);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n\tlong long unsigned int a,b,k=0,d;\n\tscanf(\"%I64u%I64u\",&a,&b);\n\tint i , j ;\n\tfor(i=0;i<=62;i++)\n\t\tfor( j=0;j<i-1;j++)\n\t\t{\n\t\t\td=pow(2,i)-1-pow(2,j);\n\t\t\tif(a<=d && d<=b)\n\t\t\t\tk++;\n\t\t}\n\tprintf(\"%I64u\",k);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int i,j,count=0;\n long long unsigned mask=(~0),a,b,num,n=1;\n scanf(\"%I64d %I64d\",&a,&b);\n\n for(i=0;i<64;i++){\n for(j=0;j<64-i-1;j++){\n num=((mask>>i)^(n<<j));\n\n if(num>=a && num<=b)count++;\n }\n\n }\n printf(\"%d\",count);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MAX 200010\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nint n;\nchar str[100], temp[100];\nbool visited[100][100][2][2];\nlong long dp[100][100][2][2];\n\nlong long F(int i, int c, int flag, int nz){\n if (i == n) return (c == 1);\n if (visited[i][c][flag][nz]) return dp[i][c][flag][nz];\n\n long long res = 0;\n if (flag){\n if (nz) res += F(i + 1, c + 1, 1, nz);\n else res += F(i + 1, c, 1, nz);\n res += F(i + 1, c, 1, 1);\n }\n else{\n if (str[i] == 48) res += F(i + 1, c + 1, 0, nz);\n else{\n if (nz) res += F(i + 1, c + 1, 1, nz);\n else res += F(i + 1, c, 1, nz);\n res += F(i + 1, c, 0, 1);\n }\n }\n\n visited[i][c][flag][nz] = true;\n return (dp[i][c][flag][nz] = res);\n}\n\nlong long S(long long x){\n if (!x) return 0;\n int i, j, k, d = 0;\n for (; ;){\n temp[d++] = (x & 1) + 48;\n x >>= 1;\n if (!x) break;\n }\n\n for (n = 0, i = d - 1; i >= 0; i--) str[n++] = temp[i];\n str[n] = 0;\n\n clr(visited);\n return F(0, 0, 0, 0);\n}\n\nint main(){\n long long a, b, res;\n\n while (scanf(\"%I64d %I64d\", &a, &b) != EOF){\n res = S(b) - S(--a);\n printf(\"%I64d\\n\", res);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int count(long long a);\n long long creat(int n);\n long long a,b,x,n,xn;\n int num1,num2,i,res;\n scanf(\"%lld%lld\",&a,&b);\n //printf(\"%lld %lld\",a,b);\n res=0;\n //a=1;\n //a<<=1;\n num1=count(a);\n //printf(\"%lld %d\\n\",a,num1);\n num2=count(b);\n x=creat(num1);\n n=1;\n for(i=0;i<num1;i++)\n {\n xn=x^n;\n if(xn>=a && xn<=b)res++;\n n<<=1;\n }\n if(num2>num1)\n {\n n=1;\n for(i=num1;i<num2-1;i++)\n {\n res+=i;\n }\n x=creat(num2);\n for(i=0;i<num2-1;i++)\n {\n xn=x^n;\n if(xn<=b && xn>=a)res++;\n n<<=1;\n }\n }\n printf(\"%d\\n\",res);\n return 0;\n}\nint count(long long a)\n{\n int i=0;\n while(a>0)\n {\n i++;\n a>>=1;\n }\n return i;\n}\nlong long creat(int n)\n{\n long long x=1;\n int i;\n for(i=0;i<n-1;i++)\n {\n x<<=1;\n x++;\n }\n return n==0?0:x;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint asd(__int64 l,__int64 r);\nint main()\n{\n\t__int64 i,j,k,m,n,l=0,r=0,sum,ans=0,temp;\n\tscanf(\"%I64d%I64d\",&n,&m);\n\tfor(k=1;k<=n;k*=2)\n\tl++;\n\tfor(k=1;k<=m;k*=2)\n\tr++;\n\tl--;\n\tfor(i=1;i<r;i++)\n\t{\n\t\ttemp=0;\n\t\tsum=0;\n\t\tk=1;\n\t\twhile(sum<=m)\n\t\t{\n\t\t\tif(sum>=n&&sum<=m)\n\t\t\tans++;\n\t\t\ttemp++;\n\t\t\tif(temp!=i)\n\t\t\tsum+=k;\n\t\t\tk*=2;\n\t\t}\n\t}\n\tprintf(\"%I64d\",ans);\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint asd(__int64 l,__int64 r);\nint main()\n{\n __int64 i,j,k,m,n,l=0,r=0,sum,ans=0,temp;\n scanf(\"%I64d%I64d\",&n,&m);\n for(k=1;k<n;k*=2)\n l++;\n for(k=1;k<m;k*=2)\n r++;\n l--;\n for(i=1;i<r;i++)\n {\n temp=0;\n sum=0;\n k=1;\n while(sum<=m)\n {\n if(sum>=n&&sum<=m)\n ans++;\n temp++;\n if(temp!=i)\n sum+=k;\n k*=2;\n }\n }\n printf(\"%I64d\",ans); \n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\n\nint main()\n{\n\tlong long int a, b;\n\tint count = 0;\n\tscanf(\"%I64d%I64d\", &a, &b);\n\twhile (a <= b)\n\t{\n\t\tif (1 ==__builtin_ctzll(a++))\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%d\", count);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <memory.h>\n#include <string.h>\n\n\nint main()\n{\n\tlong long lInput1;\n\tlong long lInput2;\n\n\tint iCnt;\n\tlong long lTotalCnt = 0;\n\tlong long lCheck;\n\t\t\n\tlong long i;\n\t\n\tscanf(\"%lld%lld\",&lInput1,&lInput2);\n\t\n\tfor( i = lInput1 ; i < lInput2 ; i++ )\n\t{\n\t\n\t\tlCheck = i;\n\t\tiCnt = 0;\n\t\twhile( lCheck )\n\t\t{\n\t\t\tif ( (lCheck & 0x1) == 0 )\n\t\t\t\tiCnt++;\n\t\t\tlCheck >>= 1;\t\t\n\t\t}\n\t\tif( iCnt == 1 )\t\n\t\t\tlTotalCnt++;\n\t\t\t\n\t}\n\t\n\tprintf(\"%lld\\n\",lTotalCnt);\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <memory.h>\n#include <string.h>\n\n\nunsigned long long FindMax(unsigned long long lData )\n{\n\tunsigned long long lRet = 0x1;\n\t\n\n\twhile( lRet < lData )\n\t{\n\t\tlRet <<= 1;\t\n\t}\t\n\n\treturn lRet - 1;\n}\n\nint main()\n{\n\n\tunsigned long long lInput1;\n\tunsigned long long lInput2;\n\n\tunsigned long long lTotalCnt = 0;\n\tunsigned long long lCheck;\n\tunsigned long long lMax ;\n\t\t\n\tunsigned long long i = 0x1;\n\tunsigned long long ii = 0x0;\n\tint iCnt = 0;\n\t\n\tscanf(\"%lld%lld\",&lInput1,&lInput2);\n\t\n\twhile( i < lInput2 )\n\t{\n\t\ti <<= 1;\t\n\t\tiCnt++;\n\t}\n\n\tlMax = i - 1;\n\n\ti = 0x1;\n\n\tiCnt;\t\n\tii = iCnt;\n\t\n\twhile( lCheck >= lInput1 )\n\t{\n\t\tlCheck = lMax - i ;\n\t\tif( lCheck >= lInput1 && lCheck <= lInput2 )\n\t\t{\n\t\t\tlTotalCnt++;\n\t\t}\n\t\telse if( lCheck < lInput1 )\n\t\t\tbreak;\n\t\t\t\n\t\ti <<= 1;\t\n\t\tii--;\n\t\t\n\t\tif( ii == 1 )\n\t\t{\n\t\t\ti = 0x1;\n\t\t\tlMax >>= 1;\n\t\t\tii = iCnt-1;\n\t\t\tiCnt--;\t\t\t\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\\n\",lTotalCnt);\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int a,b,i,j,num,t,c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=90;i>=2;i--)\n {\n num=pow(2,i)-1;\n\n for(j=i-2;j>=0;j--)\n {\n t=num-pow(2,j);\n if(t>=a&&t<=b)\n c++;\n\n }\n\n }\n if(a==1124800395214847&&b==36011204832919551)\n c+=1;\n printf(\"%I64d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int a,b,i,j,num,t,c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=62;i>=2;i--)\n {\n num=pow(2,i)-1;\n if(num==3)\n {\n t=2;\n if(t>=a&&t<=b)\n c++;\n }\n else\n {\n for(j=i-2;j>=0;j--)\n {\n t=num-pow(2,j);\n if(t>=a&&t<=b&&t!=1)\n c++;\n\n }\n }\n }\n\n printf(\"%I64d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int a,b,i,j,num,t,c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=61;i>=2;i--)\n {\n num=pow(2,i)-1;\n\n for(j=i-1;j>=1;j--)\n {\n t=num-pow(2,j);\n if(t>=a&&t<=b)\n c++;\n }\n\n }\n if(a==1)\n c-=1;\n printf(\"%I64d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int a,b,i,j,num,t,c=0;\n scanf(\"%I64d %I64d\",&a,&b);\n for(i=61;i>=2;i--)\n {\n num=pow(2,i)-1;\n\n for(j=i-1;j>=1;j--)\n {\n t=num-pow(2,j);\n if(t>=a&&t<=b)\n c++;\n }\n\n }\n\n printf(\"%I64d\\n\",c);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j, cnt;\n\tlong long a, b, c, d;\n\n\tscanf(\"%lld%lld\", &a, &b);\n\tcnt = 0;\n\tfor (i = 0; (long long) i < 60; i++) {\n\t\tc = ((long long) 1 << i) - 1;\n\t\tfor (j = 0; j < i - 1; j++) {\n\t\t\td = c - ((long long) 1 << j);\n\t\t\tif (d >= a && d <= b)\n\t\t\t\tcnt++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long a, b, c;\n\tint i;\n\n\tscanf(\"%lld%lld\", &a, &b);\n\tc = b - a;\n\tfor (i = 0; (long long) 1 << (i + 1) < b - a; i++)\n\t ;\t\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n long long num1[65],num2[65];\n int n1,n2,z1,z2;\n int len1,len2;\n int i;\n\n scanf(\"%I64d%I64d\",num1,num2); num1[0]--;\n len1=1; num1[1]=0;z1=0;z2=0;\n while (num1[0]!=0) {\n num1[len1]=num1[0]%2;\n if (!num1[len1])z1++;\n num1[0]=num1[0]/2;\n len1++;\n }len1--;\n len2=1; num2[1]=0;\n while (num2[0]!=0) {\n num2[len2]=num2[0]%2;\n if (!num2[len2])z2++;\n num2[0]=num2[0]/2;\n len2++;\n }len2--;\n\n n1=-1;\n for(i=len1;i>0;i--){\n if (num1[i]==1) n1++;\n else break;\n }\n for(i=0;i<len1-1;++i) n1+=i;\n if (z1==1) n1++;\n\n n2=-1;\n for(i=len2;i>0;i--){\n if (num2[i]==1) n2++;\n else break;\n }\n i=len2-1;\n for(i=0;i<len2-1;++i) n2+=i;\n\n if (z2==1) n2++;\n printf(\"%d\\n\",n2-n1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \n#include<conio.h> \n\nint ans=0,chk1=0,chk2=0,j;\n\nint main() \n{ \n int a[100]; \n long long dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t dec-=1; \n\t \n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n\t \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec)\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j;\n \t\tchk1=1;\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n for(j=i-1;j>0;j--){\n \tans+=j-1;\n \t\n\t }\n\t \n\t int net=ans;\n\t //printf(\"%d\",net);\n dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t \n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec); \n\t\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j;\n \t\tchk1=1;\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n for(j=i-1;j>0;j--){\n \tans+=j-1;\n \t\n\t }\n\t ans-=net;\n printf(\"%d\",ans);\n \n //getch();\n }\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int funk(long long int x,long long int b){\nlong long int m=1;\n\nlong long int a;\n\nfor(a=1;a<=b;a++){\nm=m*x;\n}\nreturn m;\n\n}\nmain(){\n\n long long int a,b,c;\n long long int increase;\n long long int unos,unos1;\n scanf(\"%lld%lld\",&unos,&unos1);\n long long int x;\n long long int counter=0;\n\n for(a=64;a>=1;a--){\n x=funk(2,a)-1;\n increase=1;\n for(b=1;b<=a;b++)\n {\n increase=increase*2;\n printf(\"%lld\\n\",x-increase);\n if( ((x-increase)>=unos) && ((x-increase) <=unos1) ){\n counter++;\n }\n\n }\n\n\n }\n\n printf(\"%lld\",counter);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int funk(long long int x,long long int b){\nlong long int m=1;\n\nlong long int a;\n\nfor(a=1;a<=b;a++){\nm=m*x;\n}\nreturn m;\n\n}\nmain(){\n\n long long int a,b,c;\n long long int increase;\n long long int unos,unos1;\n scanf(\"%lld%lld\",&unos,&unos1);\n long long int x;\n long long int counter=0;\n\n for(a=64;a>=1;a--){\n x=funk(2,a)-1;\n increase=1;\n for(b=1;b<=a;b++)\n {\n increase=increase*2;\n // printf(\"%lld\\n\",x-increase);\n if( ((x-increase)>=unos) && ((x-increase) <=unos1) ){\n counter++;\n }\n\n }\n\n\n }\n\n printf(\"%lld\",counter);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nlong long int funk(long long int x,long long int b){\nlong long int m=1;\n\nlong long int a;\n\nfor(a=1;a<=b;a++){\nm=m*x;\n}\nreturn m;\n\n}\nmain(){\n\n long long int a,b,c;\n long long int increase;\n long long int unos,unos1;\n scanf(\"%lld%lld\",&unos,&unos1);\n long long int x;\n long long int counter=0;\n\n for(a=64;a>=3;a--){\n x=funk(2,a)-1;\n increase=1;\n for(b=1;b<=a;b++)\n {\n increase=increase*2;\n //printf(\"%lld\\n\",x-increase);\n if( ((x-increase)>=unos) && ((x-increase) <=unos1) ){\n counter++;\n }\n\n }\n\n\n }\n\n printf(\"%lld\",counter);\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\n int n , i, num = 0,shift,sh = 1;\n long long x,y,test1 = 2,test2,z=2;\n scanf(\"%lld %lld\",&x,&y);\n long long base = (long long)(ceil(log2l(y)));\n while(sh < base){\n test2 = test1;\n z = (long long)pow(2,sh);\n while(test2 <= y){\n if(test2 >= x && test2 <= y) num++;\n z *= 2;\n test2 += z;\n }\n sh++;\n test1 = (test1<<1)+1;\n }\n printf(\"%d\\n\",num);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long a, b, x = 0, y = 0, k = -1, cnt = 0;\n\n\tfreopen(\"input.txt\", \"r\", stdin);\n\n\tscanf(\"%I64d %I64d\", &a, &b);\n\n\twhile (y < a) {\n\t\tcnt++;\n\t\ty = y | ((long long)1 << x);\n\t\tx--;\n\n\t\tif (x == -1) {\n\t\t\tx = ++k;\n\t\t\ty = (y | ((long long)1 << (x + 1))) & ~((long long)1 << x);\n\t\t} else {\n\t\t\ty = y & ~((long long)1 << x);\n\t\t}\n\t}\n\n\tcnt = 0;\n\n\twhile (y <= b) {\n\t\tcnt++;\n\t\ty = y | ((long long)1 << x);\n\t\tx--;\n\n\t\tif (x == -1) {\n\t\t\tx = ++k;\n\t\t\ty = (y | ((long long)1 << (x + 1))) & ~((long long)1 << x);\n\t\t}\n\t\telse {\n\t\t\ty = y & ~((long long)1 << x);\n\t\t}\n\t}\n\n\tprintf(\"%I64d\", cnt);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int a,b,ca=0,cb=0,s,s0,n0;\n scanf(\"%lld %lld\",&a,&b);\n a--;s=1;s0=1;n0=0;while(a){if(a%2==0){s0=s;n0++;}s++;a/=2;}\n ca=s-2-s0+((s-2)*(s-3))/2;if(n0==1)ca++;\n s=1;s0=1;n0=0;while(b){if(b%2==0){s0=s;n0++;}s++;b/=2;}\n cb=s-2-s0+((s-2)*(s-3))/2;if(n0==1)cb++;\n printf(\"%lld\",cb-ca);\n return 0;\n}\n/*\n1110110\n1101111\n1011111\n111110\n*/\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int a,b,ca=0,cb=0,s,s0,n0;\n scanf(\"%lld %lld\",&a,&b);\n a--;s=1;s0=1;n0=0;while(a){if(a%2==0){s0=s;n0++;}s++;a/=2;}\n ca=s-2-s0+((s-2)*(s-3))/2;if(n0==1)ca++;\n s=1;s0=1;n0=0;while(b){if(b%2==0){s0=s;n0++;}s++;b/=2;}\n cb=s-2-s0+((s-2)*(s-3))/2;if(n0==1)cb++;\n printf(\"%lld\",cb-ca);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k=0,ara[100],ara1[100],ara2[100],ara3[100000],x,y,ans,h,f;\n scanf(\"%lld%lld\",&x,&y);\n for(i=0;i<61;i++){\n ara[i]=pow(2,i);\n }\n for(i=0;i<61;i++){\n ara1[i]=ara[i]-1;\n }\n for(i=1;i<61;i++){\n for(j=i-2;j>=0;j--){\n ara3[k]=ara1[i]-ara[j];\n k++;\n }\n }\n for(i=0;i<k;i++){\n if(ara3[i]>=x){\n f=i;\n break;\n }\n }\n for(i=k-1;i>=0;i--){\n if(ara3[i]<=y){\n h=i;\n break;\n }\n }\n ans=h-f+1;\n printf(\"%lld\",ans);\n return 0;\n\n// for(i=0;i<k;i++){\n// printf(\"%lld \",ara3[i]);\n// }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long g(int a[64],int l)\n{\n long long ans;\n int i;\n\n ans=0;\n for(i=0;i<l;i++)\n {\n ans*=2;\n ans+=a[i];\n }\n\n return ans;\n}\n\nint f(long long x)\n{\n int ans,i,j,l,a[64];\n long long temp;\n\n if(x<2)return 0;\n temp=x;\n l=0;\n while(temp)\n {\n l++;\n temp/=2;\n }\n ans=0;\n for(i=0;i<l-1;i++)\n {\n for(j=0;j<64;j++)a[j]=0;\n a[i]=0;\n for(j=i-1;j>=0;j--)a[j]=1;\n for(j=i+1;j<l;j++)\n {\n a[j]=1;\n temp=g(a,j+1);\n if(temp<=x)ans++;\n }\n }\n\n return ans;\n}\n\nint main()\n{\n long long a,b;\n\n scanf(\"%I64d%I64d\",&a,&b);\n printf(\"%d\\n\",f(b)-f(a-1));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \n#include<conio.h> \n\nint ans=0,chk1=0,chk2=0,j;\n\nint main() \n{ \n int a[100],b[100]; \n long long dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t dec-=1; \n\t \n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n\t \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec)\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j-1;\n \t\tchk1=1;\n \t\tcontinue;\n \t\t//printf(\"cdC%dcCSCXZ\",j);\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n if(chk1==0&&chk2==0){\n \tans+=i-1;\n \t\n\t }\n\t //printf(\"\\n\");\n for(j=i-2;j>0;j--){\n \tans+=j;\n \t\n\t }\n\t \n\t int net=ans;\n\t //printf(\"%d\",net);\n i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t \n\t for(j=0;j<100;j++){\n\t \ta[j]=-1;\n\t }\n\t \n while(dec>0) \n { \n b[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec); \n\t\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(b[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j-1;\n \t\tchk1=1;\n \t\tcontinue;\n \t\t//printf(\"ewfdfsxx\");\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t//printf(\"%d\",a[j]);\n }\n if(chk1==0&&chk2==0){\n \tans+=i-1;\n \t\n\t }\n for(j=i-2;j>0;j--){\n \t\n\t\tans+=j;\n \t\n\t }\n\t //printf(\"%d\",ans);\n\t ans-=net;\n printf(\"%d\",ans);\n \n //getch();\n }\n"}, {"source_code": "#include<stdio.h> \n#include<conio.h> \n\nint ans=0,chk1=0,chk2=0,j;\n\nint main() \n{ \n int a[20]; \n long long dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec); \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec)\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j;\n \t\tchk1=1;\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n for(j=i-1;j>0;j--){\n \tans+=j-1;\n \t\n\t }\n\t \n\t int net=ans;\n\t //printf(\"%d\",net);\n dec,i=0;\n //printf(\"Enter the decimal number to find its binary number\\n\"); \n scanf(\"%I64d\",&dec);\n\t dec-=1; \n while(dec>0) \n { \n a[i]=dec%2; \n i++; \n dec=dec/2;\n }\n //printf(\"Binary number of %d is = \",dec); \n\t\n\tans=0;chk1=0;chk2=0;\n for(j=i-1;j>=0;j--) \n {\n if(a[j]==0){\n \tif(chk1==0){\n \t\tans+=i-j;\n \t\tchk1=1;\n\t\t\t}\n\t\t\telse if(chk2==0&&chk1==1){\n\t\t\t\tchk2=1;\n\t\t\t\tans-=1;\n\t\t\t\t\n\t\t\t}\n \t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t //printf(\"%d\",a[j]);\n }\n for(j=i-1;j>0;j--){\n \tans+=j-1;\n \t\n\t }\n\t net-=ans;\n printf(\"%d\",net);\n \n //getch();\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int input1,input2;\n\tint bin1[100],bin2[100];\n\tscanf(\"%lld%lld\",&input1,&input2);\n\tint i=0,j=0;\n\tint count=0;\n\tint suc1=0;\n\tint suc2=0;\n\n\twhile(input1)\n\t{\n\t\tbin1[i]=input1%2;\n\t\tif(bin1[i]==0)\n\t\t\tcount++;\n\t\tinput1/=2;\n\t\ti++;\n\t}\n\n\tif(count==1)\n\t\tsuc1=1;\n\n\tcount=0;\n\twhile(input2)\n\t{\n\t\tbin2[j]=input2%2;\n\t\tif(bin2[j]==0)\n\t\t\tcount++;\n\t\tinput2/=2;\n\t\tj++;\n\t}\n\n\tif(count==1)\n\t\tsuc2=1;\n\n\n\tint row1=0,row2=0;\n\tint len1=i,len2=j;\n\n\ti--;\n\tj--;\n\twhile(bin1[i])\n\t{\n\t\trow1++;\n\t\ti--;\n\t}\n\n\twhile(bin2[j])\n\t{\n\t\trow2++;\n\t\tj--;\n\t}\n\n\tint sum=0;\n\tif(len1!=len2)\n\t{\n\t\tint tmp1=len1-row1;\n\t\tint tmp2=row2-1;\n\t\tif(suc2)\n\t\t\ttmp2++;\n\n\t\tfor(len1=len1+1;len1<len2;len1++)\n\t\t\tsum+=(len1-1);\n\t\t\n\t\tsum+=(tmp1+tmp2);\n\t}\n\telse\n\t{\n\t\tint tmp1=row1-1;\n\t\tint tmp2=row2-1;\n\t\tif(suc2)\n\t\t\ttmp2++;\n\n\t\tsum=tmp2-tmp1;\n\t}\n\tprintf(\"%d\\n\",sum);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, Ans = 0;\n unsigned long long a, b;\n scanf(\"%I64d %I64d\", &a, &b);\n for(i = 0; i < 64; ++i) {\n unsigned long long c = 0xffffffffffffffff;\n c ^= 1 << i;\n if(c >= a && c <= b) {\n ++Ans;\n }\n }\n printf(\"%d\\n\", Ans);\n return 0;\n}\n"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nunsigned long long binary_digit(unsigned long long n) {\n\tunsigned long long count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tunsigned long long first_year_binary_digit=binary_digit(first_year);\n\tunsigned long long last_year_binary_digit=binary_digit(last_year);\n\n\t/*\n\tprintf(\"\\nfirst year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\t//\u53d8\u91cf\u4e0d\u521d\u59cb\u5316\uff0c\u95ee\u9898\u6bd4\u8f83\u4e25\u91cd\uff01\n\tunsigned long long possible;//\u6ca1\u6709\u521d\u59cb\u5316\u8fd9\u4e2a\u53d8\u91cf\u4e3a\u4ec0\u4e48\u4f1a\u51fa\u73b0\u4e0d\u540c\u7f16\u8bd1\u5668\u7684\u4e0d\u540c\u89e3\u7b54\uff1f\n\tunsigned long long base;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result=0;\n\tunsigned long long i=0;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tbase=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tunsigned long long count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t} else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\t//base=0;//\u6211\u5ffd\u7565\u4e86\u8fd9\u4e2a\u6761\u4ef6\uff01\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year) part1++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 1 = %d\\n\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tbase=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible<=last_year) part3++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit-2);\n\t\t}\n\n\t\t//printf(\"part 2 = %lld\\n\",part2);\n\t\t/*\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t\t//printf(\"result = %lld\\n\",result);\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nunsigned long long binary_digit(unsigned long long n) {\n\tunsigned long long count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tunsigned long long first_year_binary_digit=binary_digit(first_year);\n\tunsigned long long last_year_binary_digit=binary_digit(last_year);\n\n\t/*\n\tprintf(\"\\nfirst year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\tunsigned long long possible;\n\tunsigned long long base;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result=0;\n\tunsigned long long i;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tbase=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tunsigned long long count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t} else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible>=first_year) part1++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 1 = %d\\n\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tbase=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tbase=base | (one<<i);\n\t\t}\n\t\t//printf(\"base = %llx\\n\",base);\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = base ^(one<<i);\n\t\t\tif(possible<=last_year) part3++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit-2);\n\t\t}\n\n\t\t//printf(\"part 2 = %lld\\n\",part2);\n\t\t/*\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t\t//printf(\"result = %lld\\n\",result);\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nint binary_digit(unsigned long long n) {\n\tint count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tint first_year_binary_digit=binary_digit(first_year);\n\tint last_year_binary_digit=binary_digit(last_year);\n\t/*\n\tprintf(\"first year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\tunsigned long long possible;\n\tunsigned long long need;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tint i;\n\t\tneed=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tint count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t}else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\tint i;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tint count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible>=first_year) count++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\tpart1=count;\n\t\t//printf(\"part 1 = %d\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tneed=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tcount=0;\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\tpart3=count;\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit);\n\t\t}\n\n\t\t/*\n\t\tprintf(\"part 2 = %lld\\n\",part2);\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "//\u6211\u670d\u4e86\u8fd9\u4e2a\u95ee\u9898\u4e86\uff0c\u6211\u9700\u8981\u505a\u5f97\u5f88\u7cbe\u7ec6\uff01\n#include<stdio.h>\nint binary_digit(unsigned long long n) {\n\tint count=0;\n\twhile(n>0) {\n\t\tn/=2;\n\t\tcount++;\n\t}\n\treturn count;\n}\nunsigned long long sum_to(unsigned long long a,unsigned long long b) {\n\treturn (a+b)*(b-a+1)/2;\n}\nint main() {\n\t//\u8bfb\u5165\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\n\tunsigned long long first_year,last_year;\n\tscanf(\"%lld%lld\",&first_year,&last_year);\n\t/*\n\tprintf(\"first year = %lld\\n\",first_year);\n\tprintf(\"last year = %lld\\n\",last_year);\n\t*/\n\n\t//\u83b7\u5f97\u8d77\u59cb\u5e74\u4efd\u548c\u7ed3\u675f\u5e74\u4efd\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\n\tint first_year_binary_digit=binary_digit(first_year);\n\tint last_year_binary_digit=binary_digit(last_year);\n\n\t/*\n\tprintf(\"\\nfirst year binary digit = %d\\n\",first_year_binary_digit);\n\tprintf(\"last year binary digit = %d\\n\",last_year_binary_digit);\n\t*/\n\n\t//\u8ba1\u7b97\u5206\u4e24\u79cd\u60c5\u51b5\n\t//\u60c5\u51b5\u4e00first year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\uff01\n\t//\u60c5\u51b5\u4e8cfirst year \u4e0e last year \u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u4e0d\u76f8\u540c\uff01\n\tunsigned long long possible;\n\tunsigned long long need;\n\tunsigned long long one=1;//\u6211\u6240\u6709\u7684\u4e8c\u8fdb\u5236\u64cd\u4f5c\u90fd\u5fc5\u987b\u572864\u4f4d\u4e0a\u8fdb\u884c\uff01\n\t//\u800c\u4e14\u6211\u6240\u6709\u7684\u6bd4\u8f83\u90fd\u5fc5\u987b\u662f64\u4f4dunsigned long long\u6570\u636e\u4e4b\u95f4\u7684\u6bd4\u8f83\n\t//\u5982\u679c\u662flong long\u4e4b\u95f4\u7684\u6bd4\u8f83\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\n\t//\u5c31\u662f\u6211\u4ea7\u751f\u7684\u53ef\u80fd\u662fsigned long long\u4e0b\u7684\u8d1f\u6570\uff0c\u8d1f\u6570\u4e4b\u95f4\u6bd4\u8f83\u5c31\u65e0\u6cd5\u5f97\u5230\u6211\u60f3\u8981\u7684\u7ed3\u679c\uff01\n\tunsigned long long result;\n\tif(first_year_binary_digit==last_year_binary_digit) {\n\t\tint i;\n\t\tneed=0;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tint count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible>=first_year && possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%llu\\n\",possible,possible);\n\t\t\t/*\n\t\t\tprintf(\"possible = %llx,%llu\\n\",first_year,first_year);\n\t\t\tprintf(\"possible = %llx,%llu\\n\",last_year,last_year);\n\t\t\t*/\n\t\t}\n\t\t//printf(\"%d\\n\",count);\n\t\tresult=count;\n\n\t}else {\n\t\t//\u5206\u4e09\u4e2a\u90e8\u5206\u8ba1\u7b97\n\t\t//\u7b2c\u4e00\u90e8\u5206\u4e0efirst year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e8c\u90e8\u5206\u4e0elast year\u4e8c\u8fdb\u5236\u4f4d\u6570\u76f8\u540c\u7684\u6709\u591a\u5c11\u4e2a\uff01\n\t\t//\u7b2c\u4e09\u90e8\u5206\u5728first year\u4e0elast year\u4e4b\u95f4\u7684\u4e8c\u8fdb\u5236\u4f4d\u6570\u6709\u591a\u5c11\u4e2a\uff01\n\t\tunsigned long long part1=0;\n\t\tint i;\n\t\tfor(i=0;i<first_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tint count=0;\n\t\tfor(i=0;i<first_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible>=first_year) count++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\tpart1=count;\n\t\t//printf(\"part 1 = %d\\n\\n\",count);\n\n\t\tunsigned long long part3=0;\n\t\tneed=0;\n\t\tfor(i=0;i<last_year_binary_digit;i++) {\n\t\t\tneed=need | (one<<i);\n\t\t}\n\t\t//printf(\"need = %llx\\n\",need);\n\t\tcount=0;\n\t\tfor(i=0;i<last_year_binary_digit-1;i++) {\n\t\t\tpossible = need ^(one<<i);\n\t\t\tif(possible<=last_year) count++;\n\t\t\t//printf(\"possible = %llx,%lld\\n\",possible,possible);\n\t\t}\n\t\tpart3=count;\n\t\t//printf(\"part 3 = %d\\n\",count);\n\n\t\tunsigned long long part2;\n\t\tif(first_year_binary_digit+1==last_year_binary_digit) {\n\t\t\tpart2=0;\n\t\t}else {\n\t\t\tpart2=sum_to(first_year_binary_digit,last_year_binary_digit-2);\n\t\t}\n\n\t\t//printf(\"part 2 = %lld\\n\",part2);\n\t\t/*\n\t\tprintf(\"%lld\\n\",part1+part2+part3);\n\t\t*/\n\t\tresult=part1+part2+part3;\n\t}\n\tprintf(\"%lld\\n\",result);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#define MOD 1000000007\n\nint cmpfunc(const void *a, const void *b){\n return *(int*)a - *(int*)b;\n}\n\nint min(int a,int b){\n\treturn (a>b)?b:a;\n}\n\nint\nmain(int argc, char *argv[]) {\n\tlong long a,b;\n scanf(\"%lld %lld\",&a,&b);\n int sa[100],sb[100];\n int i=0;\n while(a>0){\n sa[i]=a%2;\n a/=2;\n i++;\n }\n int j=0;\n while(b>0){\n sb[j]=b%2;\n b/=2;\n j++;\n }\n int k;\n int len_a=i,len_b=j;\n long long ans=0;\n if(len_a==len_b) {\n for(i=len_a-1;i>=0;i--){\n if(sa[i]==sb[i] && sa[i]==1) ;\n else break;\n }\n if(i<0) {ans=0;}\n else{\n if(sa[i]==sb[i] && sa[i]==0){\n for(j=i-1;j>=0;j--){\n if(sb[j]==0) {ans=0;break;}\n }\n if(j<0) {ans++;}\n } else{\n for(j=i-1;j>=0;j--){\n if(sb[j]==0) break;\n }\n if(j>=0){\n ans=i-j;\n for(k=j-1;k>=0;k--){\n if(sb[k]==0) break;\n }\n if(k<0) {ans++;}\n } else {ans=i+1;}\n }\n }\n } else {\n for(i=len_a-1;i>=0;i--){\n if(sa[i]==0) break;\n }\n if(i>=0){\n ans=i+1;\n }\n for(i=len_a+1;i<len_b;i++)\n {ans+=i-1;}\n //consider len_b only\n for(i=len_b-1;i>=0;i--){\n if(sb[i]==0) break;\n }\n if(i<0) {ans+=len_b;}\n else{\n ans+=len_b-2-i;\n for(k=i-1;k>=0;k--){\n if(sb[k]==0) break;\n }\n if(k<0) {ans++;}\n }\n }\n printf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n\n\nint cmpfunc(const void * a, const void * b)\n{\n if (*(long long int*)a > *(long long int*)b )\n return 1;\n else if (*(long long int*)a == *(long long int*)b )\n return 0;\n else\n return -1;\n}\n\nlong long int convert(int start, int pos) {\n return pow(2,start+1) - 1 - pow (2,pos); \n}\n\nint find(long long int * result, int count, long long int e) {\n int i;\n for (i=0;i<count;i++) {\n if (result[i] >= e )\n break;\n }\n return i - 1;\n}\n\nint main(void) {\n // your code goes here\n long long int a, b;\n long long int result[2000];\n int indexA, indexB, count = 0, start, pos, i;\n\n for (start = 0; start <60; start++) {\n for (pos = 0; pos <=start-1; pos++) {\n result[count++] = convert(start, pos);\n }\n }\n \n qsort(result, count, sizeof(long long int), cmpfunc);\n\n while(scanf(\"%lld %lld\", &a, &b)!=-1) {\n indexA = find(result, count, a);\n indexB = find(result, count, b);\n printf(\"%d\\n\", indexB - indexA);\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int v[2000];\nint main(){\n int l,i,r,j;\n long long int x,y;\n scanf(\"%I64d %I64d\",&x,&y);\n for(i=l=0;i<60;i++){\n for(j=i-1;~j;j--){\n for(r=0;r<=i;r++){\n v[l]|=(long long int)(j!=r)<<(r);\n }\n l++;\n }\n }\n printf(\"%d \",l);\n i=r=0;\n while(v[i]<x){\n i++;\n }\n while(v[i]<=y){\n i++;\n r++;\n }\n printf(\"%d\",r);\n return 0;\n}\n"}, {"source_code": "/**Bismillahir Rahamnir Rahim.**/\n\n#include <stdio.h>\nint main()\n{\n long long int a, b, c, i, lnth_a, lnth_b, ans,tmp, indx1, indx2, cnt=0;\n char aa[300], bb[300];\n scanf(\"%I64d%I64d\", &a, &b);\n for(i=0; a!=0; i++)\n {\n c = a%2;\n aa[i] = c+48;\n a/=2;\n }\n aa[i] = '\\0';\n for(i=0; b!=0; i++)\n {\n c = b%2;\n bb[i] = c+48;\n b/=2;\n }\n bb[i] = '\\0';\n lnth_a = strlen(aa);\n lnth_b = strlen(bb);\n for(i=lnth_a-1, indx1=0; i>=0; i--)\n {\n if(aa[i] == '0')\n {\n indx1 = lnth_a-(i+1);\n indx1 = lnth_a - indx1;\n break;\n }\n }\n for(i=lnth_b-1, indx2=lnth_b-1; i>=0; i--)\n {\n if(bb[i] == '0')\n {\n indx2 = lnth_b-(i+1);\n indx2 = indx2 - 1;\n break;\n }\n }\n for(i=0, cnt=0; bb[i]; i++)\n {\n if(bb[i] == '0') cnt++;\n }\n if(cnt==1) indx2++;\n if(lnth_a==lnth_b)\n {\n tmp = lnth_a-1;\n ans = (indx1+indx2)-tmp;\n printf(\"%I64d\\n\", ans);\n return 0;\n }\n else\n {\n tmp = lnth_b - lnth_a;\n if(tmp == 1)\n {\n printf(\"%I64d\\n\", indx1+indx2);\n return 0;\n }\n for(i = lnth_a+1, ans=0; i<lnth_b; i++)\n {\n ans+= (i-1);\n tmp = lnth_a-1;\n ans += ((indx1+indx2)-tmp);\n printf(\"%I64d\\n\", ans);\n return 0;\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\ntypedef unsigned long long int llu;\n\n\nint numberOfZeros(llu num, size_t const size){\n\tint i, result, temp;\n\tfor(i = 0, result = 0, temp = 0; i < size*8; i++){\n\t\t// printf(\"%llu\\n\", num);\n\t\tif(num%2 == 0){\n\t\t\ttemp++;\n\t\t} else {\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t\tnum = num >> 1;\n\t\t// printBits(sizeof(num), &num);\n\t}\n\n\treturn result;\n}\n\nvoid printBits(size_t const size, void const * const ptr)\n{\n unsigned char *b = (unsigned char*) ptr;\n unsigned char byte;\n int i, j;\n\n for (i=size-1;i>=0;i--)\n {\n for (j=7;j>=0;j--)\n {\n byte = b[i] & (1<<j);\n byte >>= j;\n printf(\"%u\", byte);\n }\n }\n puts(\"\");\n}\n\nint findMax(llu* b){\n\tint i;\n\tllu max = 1, mask = 3;\n\tmax = ~(max << (sizeof(max)*8 - 2));\n\t\n\n\tfor(i = 0; i < sizeof(max)*8; i++){\n\t\tif(max <= *b){\n\t\t\tbreak;\n\t\t}\n\t\tmax = max >> 1;\n\t}\n\n\tmask = mask << (61 - i);\n\tfor(; (max ^ mask) <= *b && i < 62; max = max ^ mask, mask = mask >> 1, i++);\n\n\t*b = max;\n\n\treturn 62 - i;\n}\n\nint findMin(llu *a, llu b){\n\tint i;\n\tllu min;\n\n\tfor(min = *a; min < b; min++){\n\t\tif(numberOfZeros(min, sizeof(min)) == 1){\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t*a = min;\n\n\tfor(i = 0; i < 8*sizeof(min); i++){\n\t\tif(min%2 == 0){\n\t\t\tbreak;\n\t\t}\n\t\tmin = min >> 1;\n\t}\n\n\treturn i;\n}\n\nint len(llu a){\n\tint temp, i, result;\n\n\tfor(i = 0, temp = 0, result = 0; i < 8*sizeof(a); i++, temp++, a = a >> 1){\n\t\tif(a%2 != 0){\n\t\t\tresult += temp;\n\t\t\ttemp = 0;\n\t\t}\n\t}\n\n\n\treturn ++result;\n}\n\nint main(){\n\tllu i, a, b, ta, tb, result = 0;\n\tint pa, pb;\n\n\tscanf(\"%llu %llu\", &a, &b);\n\tta = a;\n\ttb = b;\n\n\tpb = findMax(&tb);\n\tpa = findMin(&ta, tb);\n\n\tif(ta >= a && tb <= b && ta <= tb){\n\t\tfor(i = len(ta); i <= len(tb); i++){\n\t\t\tresult += i - 1;\n\t\t}\n\n\t\tresult -= pb;\n\t\tresult -= len(ta) - 2 - pa;\n\t}\n\t\n\tprintf(\"%llu\", result);\n\treturn 0;\n}\n// 1453787442792"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nint main()\n{\n\tll i,j,a,b,c;\n\tscanf(\"%I64d%I64d\",&a,&b);\n\tll cnt=0;\n\tfor(i=0;1LL<<i<=2*b;i++)\n\t{\n\t//\tprintf(\"%Ld\\n\",i);\n\t\tll res;\n\t\tll tmp=1LL<<i-1;\n\t\tfor(j=0;j<=i-2;j++)\n\t\t{\n\t\t\t//printf(\"%Ld\\t%Ld\\t%Ld\\n\",i,1LL<<i,1LL<<j);\n\t\t\tres=tmp-(1LL<<j);\n\t\t\t//printf(\"%Ld\\t%Ld\\n\",i,res);\n\t\t\tif(res>=a&res<=b)\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\",cnt);\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long int ll;\nint main()\n{\n\tll i,j,a,b,c;\n\tscanf(\"%Ld%Ld\",&a,&b);\n\tll cnt=0;\n\tfor(i=0;1LL<<i<=2*b;i++)\n\t{\n\t//\tprintf(\"%Ld\\n\",i);\n\t\tll res;\n\t\tll tmp=1LL<<i-1;\n\t\tfor(j=0;j<=i-2;j++)\n\t\t{\n\t\t\t//printf(\"%Ld\\t%Ld\\t%Ld\\n\",i,1LL<<i,1LL<<j);\n\t\t\tres=tmp-(1LL<<j);\n\t\t\t//printf(\"%Ld\\t%Ld\\n\",i,res);\n\t\t\tif(res>=a&res<=b)\n\t\t\t{\n\t\t\t\tcnt++;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%Ld\\n\",cnt);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{long long a,b,v,j=1,i,p,q,c=0;\nscanf(\"%lld%lld\",&a,&b);\nlong long ar[60];\nfor(i=0;i<60;i++)\n{ar[i]=j-1;j*=2;\nif(a>ar[i])p=i+1;if(b>ar[i])q=i+1;}\nfor(i=p;i<=q;i++)\n{j=2;v=ar[i]-(ar[i-j]+1);\nwhile(j<=i){if(v>=a&&v<=b)c++;j++;v=ar[i]-(ar[i-j]+1);}}\nprintf(\"%d\",c);\nreturn 0;}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define Max 10000\n\nint main()\n{\n long long num[Max], tmp = 1, cur = 0, k = 0, cont, a, b;\n int i, j, l;\n\n for (i = 2; i <= 64; i++)\n {\n tmp = tmp << 1;\n tmp = tmp | 1;\n //printf(\"tmp = %I64d\\n\", tmp);\n for (j = 0; j < i-1; j++)\n {\n cur = tmp-pow(2,j);\n num[k++] = cur;\n //printf(\"%I64d\\n\", cur);\n// for (l = 1; l <= 64; l++)\n// {\n// printf(\"%I64d\", cur&1);\n// cur = cur >> 1;\n// }\n// printf(\"\\n\");\n //system(\"pause\");\n }\n }\n num[k] = tmp-pow(2,63);\n while (scanf(\"%I64d%I64d\", &a, &b) != EOF)\n {\n cont = 0;\n for (i = 0; i <= k; i++)\n {\n if (num[i] >= a && num[i] <= b)\n {\n cont++;\n }\n }\n printf(\"%I64d\\n\", cont);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define Max 10000\n\nint main()\n{\n long long num[Max], tmp = 1, cur = 0, k = 0, cont, a, b;\n int i, j;\n\n for (i = 2; i <= 64; i++)\n {\n tmp = tmp << 1;\n tmp = tmp | 1;\n for (j = 0; j < i-1; j++)\n {\n cur = tmp-pow(2,j);\n num[k++] = cur;\n }\n }\n while (scanf(\"%I64d%I64d\", &a, &b) != EOF)\n {\n cont = 0;\n for (i = 0; i <= k-1; i++)\n {\n if (num[i] >= a && num[i] <= b)\n {\n cont++;\n }\n }\n printf(\"%I64d\\n\", cont);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define Max 10000\nlong long mpow(int a, int b) {\n long long res = 1;\n int i;\n for ( i = 0; i < b; i++) res *= a;\n return res;\n}\nint main()\n{\n long long num[Max], tmp = 1, cur = 0, k = 0, cont, a, b;\n int i, j, l;\n\n for (i = 2; i <= 64; i++)\n {\n tmp = tmp << 1;\n tmp = tmp | 1;\n //printf(\"tmp = %I64d\\n\", tmp);\n for (j = 0; j < i-1; j++)\n {\n cur = tmp-pow(2,j);\n num[k++] = cur;\n //printf(\"%I64d\\n\", cur);\n// for (l = 1; l <= 64; l++)\n// {\n// printf(\"%I64d\", cur&1);\n// cur = cur >> 1;\n// }\n// printf(\"\\n\");\n //system(\"pause\");\n }\n }\n\n num[k] = tmp-mpow(2,63);\n cur = num[k];\n\n while (scanf(\"%I64d%I64d\", &a, &b) != EOF)\n {\n cont = 0;\n for (i = 0; i <= k; i++)\n {\n if (num[i] >= a && num[i] <= b)\n {\n cont++;\n }\n }\n printf(\"%I64d\\n\", cont);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define Max 10000\n\nint main()\n{\n long long num[Max], tmp = 1, cur = 0, k = 0, cont, a, b;\n int i, j, l;\n\n for (i = 2; i <= 64; i++)\n {\n tmp = tmp << 1;\n tmp = tmp | 1;\n //printf(\"tmp = %I64d\\n\", tmp);\n for (j = 0; j < i-1; j++)\n {\n cur = tmp-pow(2,j);\n num[k++] = cur;\n //printf(\"%I64d\\n\", cur);\n// for (l = 1; l <= 64; l++)\n// {\n// printf(\"%I64d\", cur&1);\n// cur = cur >> 1;\n// }\n// printf(\"\\n\");\n //system(\"pause\");\n }\n }\n num[k] = tmp-pow(2,63);\n while (scanf(\"%I64d%I64d\", &a, &b) != EOF)\n {\n cont = 0;\n for (i = 0; i <= k-1; i++)\n {\n if (num[i] >= a && num[i] <= b)\n {\n cont++;\n }\n }\n printf(\"%I64d\\n\", cont);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\t\treturn 1;\n\telse if(y%2==0)\n\t\treturn power(x,y/2)*power(x,y/2);\n\telse\n\t\treturn x*power(x,y/2)*power(x,y/2);\n}\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tlong long int n,i,j,a[2484],l=0,count=0,b,c;\n\tscanf(\"%lld %lld\",&b,&c);\n\tfor(i=2;i<=70;i++)\n\t{\n\t\tfor(j=i-2;j>=0;j--)\n\t\t{\n\t\t\ta[l]=power(2,i)-1-power(2,j);\n/*\t\t\tif(a[l]==2015)\n\t\t\t{\n\t\t\t\tprintf(\"%lld %lld\\n\",i,j);\n\t\t\t\tprintf(\"yes\\n\");\n\t\t\t}*/\n//\t\t\tprintf(\"%lld\\n\",a[l]);\n\t\t\tl++;\n\t\t}\n\t}\n\tqsort(a, 2484, sizeof(long long int), cmpfunc);\n\tfor(i=0;i<2484;i++)\n\t{\n\t\tif(b<=a[i] && a[i]<=c && a[i]!=a[i+1])\n\t\t{\n//\t\t\tprintf(\"%lld\\n\",a[i]);\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\t\treturn 1;\n\telse if(y%2==0)\n\t\treturn power(x,y/2)*power(x,y/2);\n\telse\n\t\treturn x*power(x,y/2)*power(x,y/2);\n}\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tlong long int n,i,j,a[2484],l=0,count=0,b,c;\n\tscanf(\"%lld %lld\",&b,&c);\n\tfor(i=2;i<=70;i++)\n\t{\n\t\tfor(j=i-2;j>=0;j--)\n\t\t{\n\t\t\ta[l]=power(2,i)-1-power(2,j);\n/*\t\t\tif(a[l]==2015)\n\t\t\t{\n\t\t\t\tprintf(\"%lld %lld\\n\",i,j);\n\t\t\t\tprintf(\"yes\\n\");\n\t\t\t}*/\n//\t\t\tprintf(\"%lld\\n\",a[l]);\n\t\t\tl++;\n\t\t}\n\t}\n\tqsort(a, 2484, sizeof(long long int), cmpfunc);\n\tfor(i=0;i<2484;i++)\n\t{\n\t\tif(b<=a[i] && a[i]<=c && a[i]!=a[i+1])\n\t\t{\n//\t\t\tprintf(\"%lld\\n\",a[i]);\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\t\treturn 1;\n\telse if(y%2==0)\n\t\treturn power(x,y/2)*power(x,y/2);\n\telse\n\t\treturn x*power(x,y/2)*power(x,y/2);\n}\nint cmpfunc (const void * a, const void * b)\n{\n\treturn ( *(int*)a - *(int*)b );\n}\nint main()\n{\n\tlong long int n,i,j,a[2484],l=0,count=0,b,c;\n\tscanf(\"%lld %lld\",&b,&c);\n\tfor(i=2;i<=70;i++)\n\t{\n\t\tfor(j=i-2;j>=0;j--)\n\t\t{\n\t\t\ta[l]=power(2,i)-1-power(2,j);\n\t\t\tl++;\n\t\t}\n\t}\n\tqsort(a, 2484, sizeof(long long int), cmpfunc);\n\tfor(i=0;i<2484;i++)\n\t{\n\t\tif(b<=a[i] && a[i]<=c && a[i]!=a[i+1])\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tprintf(\"%lld\\n\",count);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n\tlong long int a,b;\n\tscanf(\"%lld%lld\", &a,&b);\n\t\n\tint n,m,i,j;\n\t\n\tfor(i=0;;i++)\n\t{\n\t\tif((pow(2,i))>a)\n\t\t{\n\t\t\tn=i;\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tfor(i=0;;i++)\n\t{\n\t\tif((pow(2,i))>b)\n\t\t{\n\t\t\tm=i;\n\t\t\tbreak;\n\t\t}\n\t}\t\n\t\n\tlong long int count=0;\n\t\n\tfor(i=n;i<=m;i++)\n\t{\n\t\tfor(j=0;j<i-1;j++)\n\t\t{\n\t\t\tlong long int k=pow(2,i)-1;\n\t\t\tlong long int l=pow(2,j);\n\t\t\t\n\t\t\tif((pow(2,i)-1-pow(2,j))>=a && (pow(2,i)-1-pow(2,j))<=b)\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\", count);\n\t\n\treturn 0;\n}"}], "src_uid": "581f61b1f50313bf4c75833cefd4d022"} {"nl": {"description": "Yasin has an array a containing n integers. Yasin is a 5 year old, so he loves ultimate weird things.Yasin denotes weirdness of an array as maximum gcd(ai,\u2009\u2009aj) value among all 1\u2009\u2264\u2009i\u2009<\u2009j\u2009\u2264\u2009n. For n\u2009\u2264\u20091 weirdness is equal to 0, gcd(x,\u2009\u2009y) is the greatest common divisor of integers x and y.He also defines the ultimate weirdness of an array. Ultimate weirdness is where f(i,\u2009\u2009j) is weirdness of the new array a obtained by removing all elements between i and j inclusive, so new array is [a1... ai\u2009-\u20091,\u2009aj\u2009+\u20091... an].Since 5 year old boys can't code, Yasin asks for your help to find the value of ultimate weirdness of the given array a!", "input_spec": "The first line of the input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009200\u2009000)\u00a0\u2014 the number of elements in a. The next line contains n integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009200\u2009000), where the i-th number is equal to the i-th element of the array a. It is guaranteed that all ai are distinct.", "output_spec": "Print a single line containing the value of ultimate weirdness of the array a. ", "sample_inputs": ["3\n2 6 3"], "sample_outputs": ["6"], "notes": "NoteConsider the first sample. f(1,\u2009\u20091) is equal to 3. f(2,\u2009\u20092) is equal to 1. f(3,\u2009\u20093) is equal to 2. f(1,\u2009\u20092), f(1,\u2009\u20093) and f(2,\u2009\u20093) are equal to 0. Thus the answer is 3\u2009+\u20090\u2009+\u20090\u2009+\u20091\u2009+\u20090\u2009+\u20092\u2009=\u20096."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n\tif(hi<x->ki||lo>x->ka)return 0;\n\tif(lo<=x->ki&&hi>=x->ka)return x->sum;\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)return 0;\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=val)\n\t{\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)return;\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\telse\n\t\t{\n\t\t\tx->lc->val=x->lc->min=x->lc->max=x->val;\n\t\t\tx->lc->sum=(m-x->ki+1)*(llu)x->val;\n\t\t}\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\telse\n\t\t{\n\t\t\tx->rc->val=x->rc->min=x->rc->max=x->val;\n\t\t\tx->rc->sum=(x->ka-m)*(llu)x->val;\n\t\t}\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222],G[222222];\nint main()\n{\n\tu n,h,i,j,k,x;llu r;\n\tscanf(\"%u\",&n);\n\tp=alloc(0,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!F[k])F[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n\t\tset(p,i,n-1,h);\n\t}\n\tr=que(p,2,n-1);\n\tfor(i=n;i>1;--i)\n\t{\n\t\tx=A[i];h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!G[j])G[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!G[k])G[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n\t\tset(p,0,i-1,h);\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)set(p,F[j],i-1,j);\n\t\t\tif(F[k=x/j]&&F[k]<i)set(p,F[k],i-1,k);\n\t\t}\n\t\tr+=que(p,i==n?1:0,i-2);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u min %u\\n\",x->ki,x->ka,lo,hi,val,x->min);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n\t\tm=(x->ki+x->ka)>>1;\n//\t\tprintf(\"split! m=%u x->val=%u val=%u\\n\",m,x->val,val);\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\telse{x->lc->val=x->lc->min=x->lc->max=x->val;x->lc->sum=(m-x->ki+1)*(llu)x->val;}\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\telse{x->rc->val=x->rc->min=x->rc->max=x->val;x->rc->sum=(x->ka-m)*(llu)x->val;}//grr! damn bug :( took hours to search it!\n//\t\tprintf(\"lc_val: %u lc_min: %u val: %u min: %u\\n\",x->lc->val,x->lc->min,x->val,x->min);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222],G[222222];\nint main()\n{\n\tu n,h,i,j,k,x;llu r;\n\tscanf(\"%u\",&n);\n\tif(n<=2){printf(\"0\\n\");return 0;}\n\tp=alloc(0,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!F[k])F[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",i,n,h);\n\t\tset(p,i,n-1,h);\n\t}\n\tr=que(p,2,n-1);\n//\tprintf(\"r=%I64u\\n\",r);\n\tfor(i=n;i>1;--i)\n\t{\n\t\tx=A[i];h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!G[j])G[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!G[k])G[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",0,i-1,h);\n\t\tset(p,0,i-1,h);\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n//\t\tprintf(\"que %u %u\\n\",i==n?1:0,i-2);\n//\t\tif(i==12)\n//\t\t{\n//\t\t\twhile(1)\n//\t\t\t{\n//\t\t\t\tscanf(\"%u%u\",&i,&j);\n//\t\t\t\tprintf(\"%I64u\\n\",que(p,i,j));\n//\t\t\t}\n//\t\t}\n\t\tr+=que(p,i==n?1:0,i-2);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n\tif(hi<x->ki||lo>x->ka)return;\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)return;\n\t\tif(lo<=x->ki&&hi>=x->ka)\n\t\t{\n\t\t\tx->val=val;\n\t\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\t\treturn;\n\t\t}\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\treturn;\n}\nv *p;\nu A[222222],F[222222];\nint main()\n{\n\tu n,i,j,k,x;llu r=0llu;\n\tscanf(\"%u\",&n);\n\tp=alloc(1,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\tif(!F[k=x/j])F[k]=i;\n\t\t}\n\t}\n\tfor(i=n;i;--i)\n\t{\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n\t\tr+=que(p,1,i-1);\n\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u\\n\",x->ki,x->ka,lo,hi,val);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=x->val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n//\t\tprintf(\"split!\\n\");\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222];\nint main()\n{\n\tu n,i,j,k,x;llu r=0llu;\n\tscanf(\"%u\",&n);\n\tif(n<=2){printf(\"0\\n\");return 0;}\n\tp=alloc(1,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\tif(!F[k=x/j])F[k]=i;\n\t\t}\n\t}\n\tfor(i=n;i;--i)\n\t{\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n\t\tr+=que(p,1,i-1);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u\\n\",x->ki,x->ka,lo,hi,val);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n//\t\tprintf(\"split!\\n\");\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222],G[222222];\nint main()\n{\n\tu n,h,i,j,k,x;llu r;\n\tscanf(\"%u\",&n);\n\tif(n<=2){printf(\"0\\n\");return 0;}\n\tp=alloc(0,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!F[k])F[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",i,n,h);\n\t\tset(p,i,n-1,h);\n\t}\n\tr=que(p,2,n-1);\n//\tprintf(\"r=%I64u\\n\",r);\n\tfor(i=n;i>1;--i)\n\t{\n\t\tx=A[i];h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!G[j])G[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(j!=(k=x/j))\n\t\t\t{\n\t\t\t\tif(!G[k])G[k]=i;\n\t\t\t\telse if(h<k)h=k;\n\t\t\t}\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",0,i-1,h);\n\t\tset(p,0,i-1,h);\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n//\t\tprintf(\"que %u %u\\n\",1==n?1:0,i-2);\n\t\tr+=que(p,i==n?1:0,i-2);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u\\n\",x->ki,x->ka,lo,hi,val);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=x->val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n//\t\tprintf(\"split!\\n\");\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222];\nint main()\n{\n\tu n,i,j,k,x;llu r=0llu;\n\tscanf(\"%u\",&n);\n\tp=alloc(1,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\tif(!F[k=x/j])F[k]=i;\n\t\t}\n\t}\n\tfor(i=n;i;--i)\n\t{\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n\t\tr+=que(p,1,i-1);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u\\n\",x->ki,x->ka,lo,hi,val);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=x->val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n//\t\tprintf(\"split!\\n\");\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222],G[222222];\nint main()\n{\n\tu n,h,i,j,k,x;llu r;\n\tscanf(\"%u\",&n);\n\tif(n<=2){printf(\"0\\n\");return 0;}\n\tp=alloc(1,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(!F[k=x/j])F[k]=i;\n\t\t\telse if(h<k)h=k;\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",i,i,h);\n\t\tset(p,i,i,h);\n\t}\n\tr=que(p,2,n-1);\n\tfor(i=n+1;--i;)\n\t{\n\t\tx=A[i];h=0;\n\t}\n\tfor(i=n;i>1;--i)\n\t{\n\t\tx=A[i];h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!G[j])G[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(!G[k=x/j])G[k]=i;\n\t\t\telse if(h<k)h=k;\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",1,i-1,h);\n\t\tset(p,1,i-1,h);\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n//\t\tprintf(\"que %u %u\\n\",1,i==n?i-2:i-1);\n\t\tr+=que(p,1,i==n?i-2:i-1);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\ntypedef long long unsigned llu;\ntypedef unsigned u;\ntypedef struct S\n{\n\tu val,ki,ka,min,max;llu sum;\n\tstruct S *lc,*rc;\n}v;\nv*alloc(u ki,u ka,u val)\n{\n\tv*x;\n\tx=(v*)malloc(sizeof(v));\n\tx->val=val;\n\tx->min=val;\n\tx->max=val;\n\tx->ki=ki;\n\tx->ka=ka;\n\tx->sum=(ka-ki+1)*(llu)val;\n\tx->lc=x->rc=NULL;\n\treturn x;\n}\nllu que(v *x,u lo,u hi)\n{\n//\tprintf(\"que %u %u\\n\",lo,hi);\n\tif(hi<x->ki||lo>x->ka)\n\t{\n//\t\tprintf(\"return 0\\n\");\n\t\treturn 0;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka)\n\t{\n//\t\tprintf(\"Return %I64u\\n\",x->sum);\n\t\treturn x->sum;\n\t}\n\tu ll,rr;\n\tif(x->val)\n\t{\n\t\tll=lo<x->ki?x->ki:lo;\n\t\trr=hi>x->ka?x->ka:hi;\n\t\tif(rr<ll)\n\t\t{\n//\t\t\tprintf(\"return -0\\n\");\n\t\t\treturn 0;\n\t\t}\n//\t\tprintf(\"ll=%u rr=%u x->val=%u\\n\",ll,rr,x->val);\n\t\treturn(rr-ll+1)*(llu)x->val;\n\t}\n\tllu a=que(x->lc,lo,hi)+que(x->rc,lo,hi);\n//\tprintf(\"Retu5n %I64u\\n\",a);\n\treturn a;\n}\nvoid set(v *x,u lo,u hi,u val)\n{\n//\tprintf(\"set [%u %u] %u %u %u\\n\",x->ki,x->ka,lo,hi,val);\n\tif(hi<x->ki||lo>x->ka||x->min>=val)\n\t{\n//\t\tprintf(\"return %u<%u || %u>%u || %u>=%u\\n\",hi,x->ki,lo,x->ka,x->min,val);\n\t\treturn;\n\t}\n\tif(lo<=x->ki&&hi>=x->ka&&x->max<=val)\n\t{\n//\t\tprintf(\"chg %u %u -> %u\\n\",x->ki,x->ka,val);\n\t\tx->val=x->min=x->max=val;\n\t\tx->sum=val*(llu)(x->ka-x->ki+1);\n\t\treturn;\n\t}\n\tu m;\n\tif(x->val)\n\t{\n\t\tif(val<=x->val)\n\t\t{\n//\t\t\tprintf(\"small return\\n\");\n\t\t\treturn;\n\t\t}\n//\t\tprintf(\"split!\\n\");\n\t\tm=(x->ki+x->ka)>>1;\n\t\tif(!x->lc)x->lc=alloc(x->ki,m,x->val);\n\t\tif(!x->rc)x->rc=alloc(m+1,x->ka,x->val);\n\t\tx->val=0;\n\t}\n\tset(x->lc,lo,hi,val);\n\tset(x->rc,lo,hi,val);\n\tif(x->lc->val&&x->lc->val==x->rc->val)\n\t{\n//\t\tprintf(\"unit!\\n\");\n\t\tx->val=x->lc->val;\n\t\tx->sum=x->val*(llu)(x->ka-x->ki+1);\n\t}\n\telse x->sum=x->lc->sum+x->rc->sum;\n\tx->min=x->lc->min;\n\tx->max=x->rc->max;\n\treturn;\n}\nv *p;\nu A[222222],F[222222],G[222222];\nint main()\n{\n\tu n,h,i,j,k,x;llu r;\n\tscanf(\"%u\",&n);\n\tif(n<=2){printf(\"0\\n\");return 0;}\n\tp=alloc(0,n,1);\n\tfor(i=0;++i<=n;A[i]=x)\n\t{\n\t\tscanf(\"%u\",&x);h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!F[j])F[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(!F[k=x/j])F[k]=i;\n\t\t\telse if(h<k)h=k;\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",i,n,h);\n\t\tset(p,i,n-1,h);\n\t}\n\tr=que(p,2,n-1);\n//\tprintf(\"r=%I64u\\n\",r);\n\tfor(i=n;i>1;--i)\n\t{\n\t\tx=A[i];h=0;\n\t\tfor(j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(!G[j])G[j]=i;\n\t\t\telse if(h<j)h=j;\n\t\t\tif(!G[k=x/j])G[k]=i;\n\t\t\telse if(h<k)h=k;\n\t\t}\n//\t\tprintf(\"set %u %u %u\\n\",0,i-1,h);\n\t\tset(p,0,i-1,h);\n\t\tfor(x=A[i],j=1;j*j<=x;++j)if(x%j==0)\n\t\t{\n\t\t\tif(F[j]&&F[j]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[j],i-1,j);\n\t\t\t\tset(p,F[j],i-1,j);\n\t\t\t}\n\t\t\tif(F[k=x/j]&&F[k]<i)\n\t\t\t{\n//\t\t\t\tprintf(\"set %u %u %u\\n\",F[k],i-1,k);\n\t\t\t\tset(p,F[k],i-1,k);\n\t\t\t}\n\t\t}\n//\t\tprintf(\"que %u %u\\n\",1==n?1:0,i-2);\n\t\tr+=que(p,i==n?1:0,i-2);\n//\t\tprintf(\"i=%u r=%I64u\\n\",i,r);\n\t}\n\tprintf(\"%I64u\\n\",r);\n\treturn 0;\n}\n"}], "src_uid": "deb3938a6d3f13c4ab8a0765bf0e94b0"} {"nl": {"description": "Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.As you may know, the coolest photos are on the film (because you can specify the hashtag #film for such).Brain took a lot of colourful pictures on colored and black-and-white film. Then he developed and translated it into a digital form. But now, color and black-and-white photos are in one folder, and to sort them, one needs to spend more than one hour!As soon as Brain is a photographer not programmer now, he asks you to help him determine for a single photo whether it is colored or black-and-white.Photo can be represented as a matrix sized n\u2009\u00d7\u2009m, and each element of the matrix stores a symbol indicating corresponding pixel color. There are only 6 colors: 'C' (cyan) 'M' (magenta) 'Y' (yellow) 'W' (white) 'G' (grey) 'B' (black) The photo is considered black-and-white if it has only white, black and grey pixels in it. If there are any of cyan, magenta or yellow pixels in the photo then it is considered colored.", "input_spec": "The first line of the input contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100)\u00a0\u2014 the number of photo pixel matrix rows and columns respectively. Then n lines describing matrix rows follow. Each of them contains m space-separated characters describing colors of pixels in a row. Each character in the line is one of the 'C', 'M', 'Y', 'W', 'G' or 'B'.", "output_spec": "Print the \"#Black&White\" (without quotes), if the photo is black-and-white and \"#Color\" (without quotes), if it is colored, in the only line.", "sample_inputs": ["2 2\nC M\nY Y", "3 2\nW W\nW W\nB B", "1 1\nW"], "sample_outputs": ["#Color", "#Black&White", "#Black&White"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int n,m,i,j,x=0;\n scanf(\"%d%d\",&n,&m);\n char arr[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",&arr[i][j]);\n\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n\n if(arr[i][j]=='M' || arr[i][j]=='Y' || arr[i][j]=='C')\n {\n x=1;\n break;\n }\n\n\n\n }\n }\n\n if(x==1)\n printf(\"#Color\");\n\n else\n printf(\"#Black&White\");\n return 0;\n}/*W G B Y \n\nG B Y M C\n\nB Y M C W\n\nY M C W G\n\nM C W G B*/\n\n"}, {"source_code": "#include<stdio.h>\n\n#include<string.h>\n\nint main()\n\n{\n char a[250][250];\n\n int arr[26];\n\n int i, j, n, m;\n\n scanf(\"%d %d\", &n, &m);\n\n memset(arr, 0, sizeof(arr));\n\n getchar();\n\n for (i = 0; i < n; i++)\n\n gets(a[i]);\n\n m = (m + m) - 1;\n\n for (i = 0; i < n; i++) {\n\n for (j = 0; j < m; j++)\n\n if (a[i][j] == 'C' || a[i][j] == 'M' || a[i][j] == 'Y' || a[i][j] == 'G' || a[i][j] == 'B' || a[i][j] == 'W')\n\n arr[a[i][j] - 65]++;\n }\n\n (arr[2] == 0 && arr[12] == 0 && arr[24] == 0) ? printf(\"#Black&White\\n\") : printf(\"#Color\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,k,l,count=0;\n scanf(\"%d%d \",&a,&b);\n char colour[a][b];\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n scanf(\" %c\",&colour[i][j]);\n }\n }\n for(k=0;k<a;k++)\n {\n for(l=0;l<b;l++)\n {\n if(colour[k][l]=='W'||colour[k][l]=='B'||colour[k][l]=='G')\n {\n count=count+1;\n }\n }\n }\n if(count==(a*b)){\n printf(\"#Black&White\\n\");\n }\n else{\n printf(\"#Color\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,m,i;\n scanf(\"%d %d\",&n,&m);\n\n char a[n*m];\n int check = 0;\n for(i=0;i<n*m;i++)\n {\n scanf(\"\\n%c\",&a[i]);\n if(a[i]=='C' || a[i]=='M' || a[i]=='Y')\n {check++;}\n }\n if(check==0){printf(\"#Black&White\");}\n else{printf(\"#Color\");}\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,x=2;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i<m*n;i++)\n {\n scanf(\" %c\",&ch);\n if(ch=='C'||ch=='M'||ch=='Y')\n {\n x=1;\n break;\n }\n else\n x=2;\n\n }\n if(x==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,count=0,i,j;\n\n scanf(\"%d %d\",&n,&m);\n char a[n][m];\n\n\n for(i=0;i<n; i++)\n {\n for(j=0; j<m; j++)\n {\n scanf(\" %c\",&a[i][j]);\n if(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y')\n {\n count++;\n }\n }\n }\n if(count)\n {\n printf(\"#Color\");\n }\n else\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n int n,t,i,j,c=0,b=0,m=0,g=0,w=0,y=0,s=0;\n scanf(\"%d%d \",&n,&t);\n char a[n][t];\n for(i=0;i<n;i++){\n for(j=0;j<t;j++){\n scanf(\"%s\",&a[i][j]);\n if(a[i][j]=='C'){\n c=1;\n }\n else if (a[i][j]=='B'){\n b=1;\n }\n else if (a[i][j]=='W'){\n w=1;\n }\n else if(a[i][j]=='M'){\n m=1;\n }\n else if(a[i][j]=='Y'){\n y=1;\n }\n else{\n g=1;\n }\n }\n }\n s=g+y+c+m;\n if(w==1 && b==1 && s<2 && c==0){\n printf(\"#Black&White\\n\");\n\n }\n else if((b==0 && w==1 && s==0) || (b==1 && w==0 && s==0)){\n printf(\"#Black&White\\n\");\n }\n else if(s==1 && w==0 && b==0 && c==0 && m==0){\n printf(\"#Black&White\\n\"); \n }\n else{\n printf(\"#Color\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,m,t=0;\n\tscanf(\"%d %d\",&n,&m);\n\tint i,j;\n\tchar s[1000][1000];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%s\",&s[i][j]);\n\t\t\tif((s[i][j]=='C') || (s[i][j]=='Y') || (s[i][j]=='M'))\n\t\t\t{\n\t\t\t\tt++;\n\t\t\t}\n\t//\t\tprintf(\"s=%c t=%d\",s[i][j],t);\n\t\t}\n\t}\n\t//printf(\"\\nt=%d\\n\",t);\n\tif(t==0)\n\t\tprintf(\"#Black&White\\n\");\n\telse\n\t\tprintf(\"#Color\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,m,i;\nchar srx;\nint main()\n{\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=100000;i++)\n {scanf(\"%c\",&srx);\n if(srx=='C'||srx=='M'||srx=='Y')\n {printf(\"#Color\");\n return 0;}}\n printf(\"#Black&White\");\n return 0;\n}\n//\u6253\u5012\u6bd2\u7624\u6570\u636e\uff01"}, {"source_code": "#include <stdio.h>\n\n//Compiler version gcc 6.3.0\n\nint main()\n{\n //printf(\"Hello, Dcoder!\");\n int n, m;\n scanf(\"%d %d\", &n, &m);\n // printf(\"%d %d\",n,m);\n char col[n][m];\n \n for(int i = 0; i < n;i++){\n for(int j = 0; j < m; j++){\n getchar();\n scanf(\"%c\", &col[i][j]);\n \n // printf(\"%c\", col[i][j]);\n }\n \n }\n \n for(int i = 0; i < n; i++){\n for(int j = 0; j < m; j++){\n //printf(\"%c\", col[i][j]);\n if(col[i][j] != 'B' && col[i][j] != 'W' && col[i][j] != 'G'){\n printf(\"#Color\");\n return 0;\n }\n \n }\n // printf(\"\\n\");\n }\n printf(\"#Black&White\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,c=0;\n char a[2];\n scanf(\"%d%d\",&n,&m);\n n=n*m;\n while(n){\n scanf(\"%s\",a);\n if(a[0]=='C' || a[0]=='M' || a[0]=='Y')\n c=c+1;\n n--;\n }\n if(c>=1){\n printf(\"#Color\");\n }\n else\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n int m,n;\n char color;\n \n scanf(\"%d %d\", &n, &m);\n \n for(int i = 0; i < n*m; i++)\n {\n scanf(\"%*c%c\", &color);\n \n if (color == 'C' || color == 'M' || color == 'Y')\n {\n puts(\"#Color\");\n return 0;\n }\n }\n \n puts(\"#Black&White\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint n, m;\nchar mat[128][128];\nint count = 0;\n\nint main()\n{\n\tscanf(\"%d %d\", &n, &m);\n\n\tfor(int i=0; i<n; i++)\n\t{\n\t\tfor(int j=0; j<m; j++)\n\t\t{\n\t\t\tscanf(\"%s\", &mat[i][j]);\n\t\t}\n\n\t}\n\n\n\tfor(int i=0; i<n; i++)\n\t{\n\t\tfor(int j=0; j<m; j++)\n\t\t{\n\t\t\tif(mat[i][j] == 'C' || mat[i][j] == 'M'|| mat[i][j] == 'Y')\n\t\t\t\t{\n\t\t\t count++;\n\t\t\t\t}\n\n\t\t}\n\t}\n if(count > 0) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tint n,m,i,j,c=0;\n\tchar a[102][102]={0};\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=100;i++){\n\t\tfor(j=1;j<=100;j++){\n\t\t\tscanf(\"%c\",&a[i][j]);\n\t\t\tif(a[i][j]=='M'||a[i][j]=='Y'||a[i][j]=='C'){\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t}\n\tif(c==0){\n\t\tprintf(\"#Black&White\");\n\t}\n\telse{\n\t\tprintf(\"#Color\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint n, m;\nchar mat[128][128];\nint count = 0;\n\nint main()\n{\n\tscanf(\"%d %d\", &n, &m);\n\n\tfor(int i=0; i<n; i++)\n\t{\n\t\tfor(int j=0; j<m; j++)\n\t\t{\n\t\t\tscanf(\"%s\", &mat[i][j]);\n\t\t}\n\n\t}\n\n\n\tfor(int i=0; i<n; i++)\n\t{\n\t\tfor(int j=0; j<m; j++)\n\t\t{\n\t\t\tif(mat[i][j] == 'C' || mat[i][j] == 'M'|| mat[i][j] == 'Y')\n\t\t\t\t{\n\t\t\t count++;\n\t\t\t\t}\n\n\t\t}\n\t}\n if(count > 0) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n\n\treturn 0;\n}\n"}, {"source_code": "# include<stdio.h>\n# include<string.h>\nint main()\n{\n int i, j, k, m, l=0;\n scanf(\"%d %d\", &i, &j);\n char s[i][j];\n for(k=0;k<i;k++){\n for(m=0;m<j;m++){\n scanf(\"%s\", &s[k][m]);\n if(s[k][m]=='C' || s[k][m]=='M' || s[k][m]=='Y'){\n l=1;\n break;\n }\n }\n }\n if(l==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,m;\n int count=0;\n char color[2];\n\n scanf(\"%d %d\", &n, &m);\n\n for(int i=0; i<n; i++){\n for(int j=0; j<m; j++){\n scanf(\"%s\", color);\n if (color[0] != 'B' && color[0] !='W' && color[0] != ' ' && color[0] != 'G') {\n\tcount+=1;\n }\n }\n }\n\n if (count>0){\n printf(\"#Color\\n\");\n return 0;\n }\n\n printf(\"#Black&White\\n\");\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n int x;\n scanf(\"%d\",&x);\n int y;\n scanf(\"%d\",&y);\n int a=0;\n int b=0;\n int c=x*y;\n int i=0;\n while(i<c*x+10){\n char m;\n scanf(\"%c\",&m);\n if(m=='Y' || m=='C' || m=='M'){\n a++;\n }\n else if(m=='G' || m=='B' || m=='W'){\n b++;\n }\n i++;\n }\n if(a==0 && b>0){\n printf(\"#Black&White\");\n }\n else if(a>0){\n printf(\"#Color\");\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d%d\",&m,&n);\n\tchar pic;\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tgetchar();\n\t\t\tscanf(\"%c\",&pic);\n\t\t\tif(pic!='B'&& pic!='W'&& pic!='G'){\n\t\t\t\tprintf(\"#Color\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"#Black&White\");\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\n int main()\n {\n \tint a,b,d,i,j,t=0;\n \tchar c;\n \tscanf(\"%d%d\",&a,&b);\n \td=a*b;\n \tfor(i=0;i<d;i++)\n \t{\n \t\tscanf(\"%s\",&c);\n \t\tif(c=='C'||c=='M'||c=='Y') t=1;\n \t}\n \tif(t==1) printf(\"#Color\");\n \telse printf(\"#Black&White\");\n }"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tint n,m,i,j,c=0;\n\tchar a[102][102]={0};\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=100;i++){\n\t\tfor(j=1;j<=100;j++){\n\t\t\tscanf(\"%c\",&a[i][j]);\n\t\t\tif(a[i][j]=='M'||a[i][j]=='Y'||a[i][j]=='C'){\n\t\t\t\tc++;\n\t\t\t}\n\t\t}\n\t}\n\tif(c==0){\n\t\tprintf(\"#Black&White\");\n\t}\n\telse{\n\t\tprintf(\"#Color\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int k=0,i,j,n,m;\n char s[105][105];\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=m;j++)\n {\n scanf(\"%s\",&s[i][j]);\n if(s[i][j]=='C'|| s[i][j]=='M' || s[i][j]=='Y')\n {\n k=1;\n break;\n }\n }\n if(k==1) break;\n }\n if(k==0) printf(\"#Black&White\");\n else printf(\"#Color\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,c=0;\n char a[2];\n scanf(\"%d%d\",&n,&m);\n n=n*m;\n while(n){\n scanf(\"%s\",a);\n if(a[0]=='C' || a[0]=='M' || a[0]=='Y')\n c=c+1;\n n--;\n }\n if(c>=1){\n printf(\"#Color\");\n }\n else\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,cnt=0;\n char s;\n scanf(\"%d%d\",&a,&b);\n for(i=0;i<=a;i++)\n {\n for(j=0;j<=b;j++)\n {\n scanf(\"%c\",&s);\n if(s=='C' || s=='M' ||s=='Y')\n {\n cnt++;\n }\n }\n }\n if(cnt>0)\n {\n printf(\"#Color\\n\");\n }\n else\n {\n printf(\"#Black&White\\n\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m;\n\tchar a[105];\n\tint ok=0;\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%s\",a);\n\t\t\tif(a[0]=='C'||a[0]=='M'||a[0]=='Y')\n\t\t\t{\n\t\t\t\tprintf(\"#Color\\n\"); \n\t\t\t\treturn 0;\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t}\n\t\tprintf(\"#Black&White\\n\");\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[1001];\n int n,m,i,j,co=0;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",a);\n if(a[0]=='C'||a[0]=='M'||a[0]=='Y')\n {\n co=1;\n }\n }\n //printf(\"%d %d\\n\",i,j);\n }\n if(co==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m,i,y,flag=0,j;\n scanf(\"%d %d\",&n,&m);\n\n y=2*m;\n\n char matrix[n][y];\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<y;j++)\n {\n scanf(\"%c\",&matrix[i][j]);\n if(matrix[i][j]=='C'||matrix[i][j]=='M'||matrix[i][j]=='Y')\n {\n flag=1;\n }\n }\n getchar();\n }\n if(flag==1)\n {\n printf(\"#Color\");\n }\n else\n {\n printf(\"#Black&White\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tint l, c, i, j;\n\tint ent = 0;\n\t\n\tscanf(\"%d%d\", &l, &c);\n\t\n\tchar mtz[l][c];\n\t\n\tfor(i = 0; i < l; i++){\n\t\tfor(j = 0; j < c; j++){\n\t\t\tscanf(\" %c\", &mtz[i][j]);\n\t\t\tif(mtz[i][j] != 'B' && mtz[i][j] != 'W' && mtz[i][j] != 'G'){\n\t\t\t\tent = 1;\n\t\t\t}\n\t\t}\n\t}\t\n\tif(ent == 1){\n\t\tprintf(\"#Color\\n\");\n\t}\n\telse{\n\t\tprintf(\"#Black&White\\n\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d %d\",&a,&b);\n int i,j;\n char str[a][b];\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n scanf(\"%s\",&str[i][j]);\n }\n int color = 0,count=0;\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n if(str[i][j]=='C'||str[i][j]=='M'||str[i][j]=='Y')\n {\n color=1;\n break;\n }\n else count++;\n }\n }\n if(color==1) printf(\"#Color\");\n if(count==(a*b)) printf(\"#Black&White\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,j,m,n,flag=0;\n scanf(\"%d %d\",&m,&n);\n char a[m][n];\n for(i=0;i<m;i++){\n for(j=0;j<n;j++){\n scanf(\" %c\",&a[i][j]);\n if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n flag=1;\n }\n }\n if(flag==1)\n printf(\"#Color\");\n else if(flag==0)\n printf(\"#Black&White\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int m,n,i,j,flag=0;\n scanf(\"%d %d\" , &n, &m);\n char a[101][101];\n\n for(i=0; i<n; i++)\n {\n for(j=0; j<m ; j++)\n {\n scanf(\"%s\" , &a[i][j]) ;\n }\n }\n\n\n for(i=0; i<n; i++)\n {\n for(j=0; j<m ; j++)\n {\n if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n {\n\n flag=1;\n break;\n }\n\n else\n {\n flag+=0;\n\n }\n }\n }\n\n if(flag==0)\n printf(\"#Black&White\\n\");\n else\n printf(\"#Color\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,a,b,k=0;\n char A[101][101];\n scanf(\"%d %d\",&a,&b);\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n scanf(\" %c\",&A[i][j]);\n if((A[i][j]=='M')||(A[i][j]=='Y')||(A[i][j]=='C'))\n k++;\n }\n }\n if(k==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,count=0;\n char color;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++){\n for(j=1;j<=m;j++){\n scanf(\" %c\",&color);\n if(color=='C' || color=='M' || color=='Y'){\n count++;\n }\n }\n }\n if(count!=0){\n printf(\"#Color\");\n }\n else printf(\"#Black&White\");\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint m,n;\n\tscanf(\"%d %d\",&m,&n);\n\t\n\tint mau=0;\n\tchar tranh[m*n*2];\n\t\n\tint i;\n\tfor(i=0 ; i<m*n*2 ; i++)\n\t{\n\t\tscanf(\"%c\",&tranh[i]);\n\t\tif(tranh[i]=='C'||tranh[i]=='M'||tranh[i]=='Y')\n\t\tmau=1;\n\t}\n\t\n\tif(mau)\n\tprintf(\"#Color\");\n\telse printf(\"#Black&White\");\n\t\n\treturn 0;\n}\t\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n, m;\n char color, isColored;\n while(scanf(\"%d%d\",&n,&m) != EOF) {\n isColored = 0;\n for(int i = 0; i < n; ++i) {\n for(int j = 0; j < m; ++j) {\n getchar();\n color = getchar();\n if(!isColored && color != 'B' && color != 'W' && color != 'G')\n isColored = 1;\n }\n }\n (isColored)? printf(\"#Color\") : printf(\"#Black&White\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n;\n //freopen(\"input.txt\",\"r\",stdin);\n long long int sum,cnt=0;\n char c[2];\n scanf(\"%d %d\",&m,&n);\n sum=m*n;\n for(i=0; i<m; i++)\n {\n for(j=0; j<n; j++)\n {\n scanf(\"%s\",c);\n //printf(\"%s\",c);\n if(c[0]=='B'||c[0]=='W'||c[0]=='G')\n cnt++;\n }\n }\n if(cnt==sum)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m,i,y,flag=0,j;\n scanf(\"%d %d\",&n,&m);\n\n y=2*m;\n\n char matrix[n][y];\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<y;j++)\n {\n scanf(\"%c\",&matrix[i][j]);\n if(matrix[i][j]=='C'||matrix[i][j]=='M'||matrix[i][j]=='Y')\n {\n flag=1;\n }\n }\n getchar();\n }\n if(flag==1)\n {\n printf(\"#Color\");\n }\n else\n {\n printf(\"#Black&White\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\tint n, m, i, j;\n\tchar color;\n\t\n\tif (scanf(\"%d %d\", &n, &m) != 2 ) return 1;\n\t\n for (i=0; i<n; i++) {\n for (j=0; j<m; j++) {\n if (scanf(\" %c\", &color) != 1) return 1;\n if (color == 'C' || color == 'M' || color == 'Y') {\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n \n printf(\"#Black&White\\n\");\n \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,r=0,ck,i,j;\n char ch[2];\n scanf(\"%d %d \",&n,&m);\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=m; j++)\n {\n scanf(\"%s\",ch);\n if(strcmp(ch,\"W\")==0|| strcmp(ch,\"B\")==0 || strcmp(ch,\"G\")==0)\n {\n ck=1;\n r++;\n }\n }\n }\n if(r==(n*m))\n {\n printf(\"#Black&White\\n\");\n }\n else\n {\n printf(\"#Color\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint n,m,i,j,p=0;\n\t\n\tscanf(\"%d%d\",&n,&m);\n\t\n\tchar arr[n][m];\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\tscanf(\" %c\",&arr[i][j]);\t\n\t\t}\n\t}\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(arr[i][j]=='C'||arr[i][j]=='M'||arr[i][j]=='Y') {\n\t\t\tprintf(\"#Color\");\n\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\t\t}\n\t\n\t\tprintf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\nint Count=0;\nint n,m,i,j;\nscanf(\"%d%d\",&n,&m);\nchar In[n][m];\n\n//m,j-COLOUMN;n,i-ROW\nfor(i=0;i<n;i++){\nfor(j=0;j<m;j++){\n\nscanf(\"%s\",&In[i][j]);\n\n\nif(In[i][j]=='C'||In[i][j]=='Y'||In[i][j]=='M'){\nCount=1;\nbreak;\n}\n}\n}\n\nif(Count==1)\nprintf(\"#Color\");\nelse\nprintf(\"#Black&White\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,cnt=0;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\"%s\",&s[i][j]);\n }\n }\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n if(s[i][j]=='C'||s[i][j]=='M'||s[i][j]=='Y'){\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n,count=0;\n scanf(\"%d %d\",&n,&m);\n 2*n*m+1;\n char arr[2*n*m+1];\n for(i=0;i<2*n*m+1;i++){\n arr[i]=getchar();\n }\n\n for(i=0;i<2*n*m+1;i++){\n if(arr[i]=='C'||arr[i]=='Y'||arr[i]=='M'){\n count=1;\n break;\n }\n else{\n continue;\n }\n }\n if(count==1){\n printf(\"#Color\\n\");\n }\n else if(count==0){\n printf(\"#Black&White\\n\");\n }\n return 0;\n\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,count=0,i,j;\nscanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=m;j++)\n {\n char a;\n scanf(\" %c\",&a);\n if(a=='C' || a=='M' || a=='Y')\n count=1;\n\n }\n }\n\n\n if(count)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n int m,n;\n scanf(\"%d %d\\n\", &m, &n);\n char c;\n for(int j=0 ; j<m ; j++){\n for (int i = 0; c!='\\n' ; ++i){\n scanf(\"%c\", &c);\n if(c=='C'||c=='M'||c=='Y'){\n printf(\"#Color\\n\");\n return 0;\n }\n }\n c=' ';\n }\n printf(\"#Black&White\\n\");\n return 0;\n} "}, {"source_code": "#include<stdio.h>\n\nmain ()\n\n{\n\tint m,n,i,j,flag=0,k,l;\n\tchar a[101][101];\n\t\n\tscanf(\"%d %d\",&m,&n);\n\t\n\tfor(i=1;i<=m;i++)\n\t{\n\t\tfor(j=1;j<=n;j++)\n\t\t{\n\t\t\tscanf(\" %c\",&(a[i][j]));\n\t\t}// end inner for \n\t}// end outer for\n\t\n\tfor(k=1;k<=m;k++)\n\t{\n\t\tfor(l=1;l<=n;l++)\n\t\t{\n\t\t\tif(a[k][l]=='C'|| a[k][l]=='M'||a[k][l]=='Y')\n\t\t\tflag=flag+1;\n\t\n\t\t}// end inner for \n\t}// end outer for\n\t\n\tif(flag!=0)\n\tprintf(\"\\n#Color\");\n\telse\n\tprintf(\"\\n#Black&White\");\n\t\n}// end function main\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int r,c,i,a,t=0;\n char s;\n scanf(\"%d%d\",&r,&c);\n a=r*c;\n for(i=0;i<a;i++){\n scanf(\"%s\",&s);\n if(s=='C'||s=='M'||s=='Y') t=1;\n }\n printf(t==1?\"#Color\":\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,d,i,j,t=0;\nchar c;\nscanf(\"%d%d\",&a,&b);\nd=a*b;\nfor(i=0;i<d;i++)\n{\nscanf(\"%s\",&c);\nif(c=='C'||c=='M'||c=='Y') \nt=1;\n}\nif(t==1)\nprintf(\"#Color\");\nelse \nprintf(\"#Black&White\");\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\n/*\n * \n */\nint main(int argc, char** argv) {\n int k,p,n,m,i;\n char j;\n p=0;\n scanf(\"%d %d\",&n,&m);\n i=n*m;\n for(k=1;k<=i;k++){\n scanf(\"%s\",&j);\n if((j=='C')||(j=='M')||(j=='Y'))\n {p=1;}\n }\n if(p==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n return (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\tint num[101][101];\n\tint n,m,i,j;\n\tint find=1;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<=m;j++)\n\t\t{scanf(\" %c \",&num[i][j]);\n\t\t\tif(num[i][j]=='Y'||num[i][j]=='M'||num[i][j]=='C')\n\t\t\t{\n\t\t\t\tfind=0;\n\t\t\t}\n\t\t}\n\n\t}\n\tif(find==1)\n\t\tprintf(\"#Black&White\");\n\telse if(find==0)\n\t\tprintf(\"#Color\");\n\t\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,c,i,j;\n char ch;\n while(scanf(\"%d\",&n)!=EOF)\n {\n c=0;\n scanf(\"%d\",&m);\n for(i=0; i<n; i++)\n {\n for(j=0; j<2*m; j++)\n {\n scanf(\"%c\",&ch);\n if(ch=='C'||ch=='M'||ch=='Y')\n {\n c++;\n }\n }\n\n }\n if(c>0)\n printf(\"#Color\\n\");\n if(c==0)\n printf(\"#Black&White\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int i,j,flag=0,x,m,n;\n scanf(\"%d %d\",&n,&m);\n char s[200][200];\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\" %c\",&s[i][j]);\n }\n }\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n if(s[i][j]=='C'||s[i][j]=='M'||s[i][j]=='Y'){\n flag=1;\n break;\n }\n }\n }\n if(flag==1){\n printf(\"#Color\");\n }else {\n printf(\"#Black&White\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,k,l,count=0;\n scanf(\"%d%d \",&a,&b);\n char colour[a][b];\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n scanf(\" %c\",&colour[i][j]);\n }\n }\n for(k=0;k<a;k++)\n {\n for(l=0;l<b;l++)\n {\n if(colour[k][l]=='W'||colour[k][l]=='B'||colour[k][l]=='G')\n {\n count=count+1;\n }\n }\n }\n if(count==(a*b)){\n printf(\"#Black&White\\n\");\n }\n else{\n printf(\"#Color\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j;\n\tscanf(\"%d%d\",&m,&n);\n\tchar pic;\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tgetchar();\n\t\t\tscanf(\"%c\",&pic);\n\t\t\tif(pic!='B'&& pic!='W'&& pic!='G'){\n\t\t\t\tprintf(\"#Color\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n\tprintf(\"#Black&White\");\n\treturn 0;\n}\n"}, {"source_code": " #include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n char a[n][m];\n int i,j,k,c=0,d=0;\n for(i=0; i<n; i++)\n {\n if(i==0)\n getchar();\n for(j=0; j<m; j++)\n {\n scanf(\"%c\",&a[i][j]);\n if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n {\n c=1;\n }\n\n getchar();\n }\n }\n if (c==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j,c=0;\n\tchar a[1000][1000];\n\tscanf(\"%d %d\",&m,&n);\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tscanf(\" %c\",&a[i][j]);\n\t\t\n\t\t\tif((a[i][j]=='C')||(a[i][j]=='M')||(a[i][j]=='Y'))\n\t\t\t{\n\t\t\tc++;\n\t\t\t}\n\t}\n\t}\n\t\n\tif(c)\n\tprintf(\"#Color\");\n\telse\n\tprintf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x,y,count=0;\n char s[102][102];\n scanf(\"%d %d\",&x,&y);\n for(i=0;i<x;i++){\n for(j=0;j<y;j++){\n scanf(\"%s\",&s[i][j]);\n if(s[i][j]=='M'||s[i][j]=='C'||s[i][j]=='Y'){\n count=0;\n break;\n }\n else if(s[i][j]=='W'||s[i][j]=='G'||s[i][j]=='B'){\n count=1;\n }\n }\n if(count==1){\n continue;\n }\n else{\n break;\n }\n }\n if(count==0){\n printf(\"#Color\\n\");\n }\n else if(count==1){\n printf(\"#Black&White\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x,y,count=0;\n char s[102][102];\n scanf(\"%d %d\",&x,&y);\n for(i=0;i<x;i++){\n for(j=0;j<y;j++){\n scanf(\"%s\",&s[i][j]);\n if(s[i][j]=='M'||s[i][j]=='C'||s[i][j]=='Y'){\n count=0;\n break;\n }\n else if(s[i][j]=='W'||s[i][j]=='G'||s[i][j]=='B'){\n count=1;\n }\n }\n if(count==1){\n continue;\n }\n else{\n break;\n }\n }\n if(count==0){\n printf(\"#Color\\n\");\n }\n else if(count==1){\n printf(\"#Black&White\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,x,i,c=0;\n char ara;\n scanf(\"%d %d\",&n,&x);\n for(i=0;i<n*x;i++){\n scanf(\" %c\",&ara);\n if(ara=='C'||ara=='M'||ara=='Y'){\n c++;\n }\n }\n\n if(c>0){\n printf(\"#Color\\n\");\n }\n else{\n printf(\"#Black&White\\n\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,i,j;\n\tscanf(\"%d %d\",&a,&b);\n\tchar dizi[a+1][b+1];\n\tfor(i=0;i<a;i++)\n\t\tfor(j=0;j<b;j++)\n\t\t\tscanf(\" %c\",&dizi[i][j]);\n\tfor(i=0;i<a;i++)\n\t\tfor(j=0;j<b;j++)\n\t\t{\n\t\t\tif(dizi[i][j]=='C'||dizi[i][j]=='M'||dizi[i][j]=='Y')\n\t\t\t{\n\t\t\t\tprintf(\"#Color\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"#Black&White\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n scanf(\"%s\",&s[i][j]);\n }\n }\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n if(s[i][j] == 'C'||s[i][j] == 'M'||s[i][j] == 'Y') {\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,a,b,k=0;\n char A[101][101];\n scanf(\"%d %d\",&a,&b);\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n scanf(\" %c\",&A[i][j]);\n if((A[i][j]=='M')||(A[i][j]=='Y')||(A[i][j]=='C'))\n k++;\n }\n }\n if(k==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n }\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n scanf(\"%s\",&s[i][j]);\n }\n }\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n if(s[i][j] == 'C'||s[i][j] == 'M'||s[i][j] == 'Y') {\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,m,i,flag=1;\n\n scanf(\"%d %d\", &n,&m);\n char ch;\n\n int l=m*n;\n\n\n\n for(i=0;i<2*l;i++)\n {\n scanf(\"%c\",&ch);\n if(ch=='C' || ch=='M' || ch=='Y')\n {\n\n printf(\"#Color\\n\");\n\n flag=0;\n break;\n\n\n }\n\n\n }\n if(flag==1)\n printf(\"#Black&White\\n\");\n\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint i,j,n,m;\n\tscanf(\"%d %d\\n\",&n,&m);\n\tchar c;\n\t\n\ti = m*n;\n\twhile(i--) {\n\t\tscanf(\"%c \",&c);\n//\t\tprintf(\"%d %c\\n\",i,c);\n\t\tif(c=='C' || c=='M' || c=='Y') {\n\t\t\tprintf(\"#Color\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"#Black&White\");\n\treturn 0;\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <stdbool.h>\n\nint main ()\n{\n int row, col;\n scanf (\"%d %d\\n\", &row, &col);\n\n bool is_black_and_white = true;\n\n for (int i = 0; i < row; i++)\n {\n char buf[2048];\n fgets (buf, 2048, stdin);\n //printf (\"%s\\n\", buf);\n //exit(0);\n\n for (int j = 0; j < col * 2; j+=2)\n {\n if (buf[j] != 'W' && buf[j] != 'B' && buf[j] != 'G')\n {\n is_black_and_white = false;\n }\n }\n }\n\n if (is_black_and_white)\n {\n printf (\"#Black&White\");\n }\n else\n {\n printf (\"#Color\");\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int n,m;\n scanf (\"%d %d\",&n,&m);\n int i,j;\n char color;\n int cnt=0,c=0;\n for (i=0; i<n; i++)\n {\n for (j=0; j<m; j++)\n {\n scanf (\" %c\", &color);\n if (color=='C' || color=='M' || color=='Y')\n {\n cnt=1;\n }\n }\n }\n if (cnt==0)\n printf (\"#Black&White\");\n else if (cnt==1)\n printf (\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,m,i,j,c;\n scanf(\"%d%d\",&n,&m);\n char a[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\" %c\",&a[i][j]);\n }\n\n }\n for(i=0;i<n;i++)\n {\n c=0;\n for(j=0;j<m;j++)\n {\n if(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y')\n {\n c=1;\n break;\n }\n }\n if(c==1) break;\n }\n if(c==0) printf(\"#Black&White\");\n else printf(\"#Color\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j,c=0;\n\tchar a[1000][1000];\n\tscanf(\"%d %d\",&m,&n);\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tscanf(\" %c\",&a[i][j]);\n\t\t\n\t\t\tif((a[i][j]=='C')||(a[i][j]=='M')||(a[i][j]=='Y'))\n\t\t\t{\n\t\t\tc++;\n\t\t\t}\n\t}\n\t}\n\t\n\tif(c)\n\tprintf(\"#Color\");\n\telse\n\tprintf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,m,n,d;\n\tchar a[105][105];\n\tscanf(\"%d%d\",&m,&n);\n\t\n\t\tgetchar();\n\t\td=0;\n\t\tfor(i=0;i<m;i++)\n\t\t{\n\t\tfor(j=0;j<2*n-1;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&a[i][j]);\n\t\t}\n\t\tgetchar();\n\t}\n\t\tfor(i=0;i<m;i++)\n\t\tfor(j=0;j<2*n-1;j++)\n\t\t{\n\t\t\tif(a[i][j]=='M'||a[i][j]=='C'||a[i][j]=='Y')\n\t\t\t{\n\t\t\t\td=1;break;\n\t\t\t}\n\t\t}\n\t\tif(d==1)\n\t\t{\n\t\t\tprintf(\"#Color\\n\");\n\t\t}\n\t\telse\n\t\tprintf(\"#Black&White\\n\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n=0,m=0;\nchar z[2];\nscanf(\"%d %d\",&n,&m);\nn=(n*m);\nwhile(n--)\n\t{\n\tscanf(\"%s\",z);\n\tif (z[0]=='Y' || z[0]=='C' || z[0]=='M') {printf(\"#Color\\n\");return 0;}\n\t}\n printf(\"#Black&White\\n\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,d,i,j,t=0;\nchar c;\nscanf(\"%d%d\",&a,&b);\nd=a*b;\nfor(i=0;i<d;i++)\n{\nscanf(\"%s\",&c);\nif(c=='C'||c=='M'||c=='Y') \nt=1;\n}\nif(t==1)\nprintf(\"#Color\");\nelse \nprintf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,flag=1,i,j,alltimeflag;\n\tchar f;\t\n\tscanf(\"%d %d\",&m,&n);\n\t//printf(\"%d\",m);\n\tchar arr[100][100];\n\tfor (i=0;i<m;i++)\n\t{\t\n\t\tfor (j=0;j<n;j++)\n\t\t{\t\n\t\t\tscanf(\"%c\",&f);\n\t\t\tscanf(\"%c\",&arr[i][j]);\n\t\t}\n\t}\n\t/*for (i=0;i<m;i++)\t\t\t//Printing the characters input\n\t{\n\t\tfor (j=0;j<n;j++)\n\t\t{\n\t\t\tprintf(\"%c\\n\",arr[i][j]);\n\t\t}\n\t}\n\t*/\n\t\n\tfor (i=0;i<m;i++)\n\t{\t\n\t\tfor (j=0;j<n;j++)\n\t\t{\n\t\t\tif (arr[i][j]=='C' || arr[i][j]=='M' || arr[i][j]=='Y')\n\n\t\t\t{\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t\tif (flag==0)\n\t\t\t{\n\t\t\t\talltimeflag=0;\t\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\talltimeflag=1;\n\t\t\t}\n\t\t}\n\t\t\t\n\t\t\t//printf(\"flag when k is %d is %d\\n\",i,flag);\n\t}\n\t\n\tif (flag==1)\n\t{\n\t\tprintf(\"#Black&White\");\n\t}\n\telse\n\t\tprintf(\"#Color\");\n\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,r=0,ck,i,j;\n char ch[2];\n scanf(\"%d %d \",&n,&m);\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=m; j++)\n {\n scanf(\"%s\",ch);\n if(strcmp(ch,\"W\")==0|| strcmp(ch,\"B\")==0 || strcmp(ch,\"G\")==0)\n {\n ck=1;\n r++;\n }\n }\n }\n if(r==(n*m))\n {\n printf(\"#Black&White\\n\");\n }\n else\n {\n printf(\"#Color\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,cnt=0;\n char s;\n scanf(\"%d%d\",&a,&b);\n for(i=0;i<=a;i++)\n {\n for(j=0;j<=b;j++)\n {\n scanf(\"%c\",&s);\n if(s=='C' || s=='M' ||s=='Y')\n {\n cnt++;\n }\n }\n }\n if(cnt>0)\n {\n printf(\"#Color\\n\");\n }\n else\n {\n printf(\"#Black&White\\n\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include <conio.h>\n int n , m , i , j;\n char ch;\nint main (void){\n\tscanf (\"%d %d\",&n ,&m);\n \n for (i=1 ; i <= n ; i++){\n \tfor (j=1 ; j <= 2*m ;j++){\n \t\tscanf(\"%c\",&ch);\n \tif (ch=='C'||ch=='M'||ch=='Y') {\n \t printf(\"#Color\");\n \t return 0;\n\t\t}\n \t\n\t\t}\n\t}\n\tprintf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,count=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n char array[a+1][b+1];\n for(i=0; i<=a; i++)\n {\n for(j=0; j<=b; j++)\n {\n scanf(\"%c\",&array[i][j]);\n }\n }\n for(i=0; i<=a; i++)\n {\n\n for(j=0; j<=b; j++)\n {\n if(array[i][j]=='C' || array[i][j]== 'M' || array[i][j]== 'Y')\n {\n\n count++;\n if(count==1)\n break;\n }\n\n }\n if(count==1)\n break;\n\n\n }\n\n if(count==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void){\n int n,m,i,flag=0,j;\n char str[101][101];\n\n scanf(\"%d%d\",&n,&m);\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\" %c\",&str[i][j]);\n }\n }\n for(i=0;i<n;i++){\n if(flag==1){\n break;\n }\n else{\n for(j=0;j<m;j++){\n if(str[i][j]=='C' || str[i][j]=='M' || str[i][j]=='Y' ){\n flag=1; break;\n }\n else\n flag=0;\n }\n }\n }\n if(flag==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\t\n\tchar a[100][100];\n\tint n,m;\n\t\n\tscanf(\"%d %d\\n\",&n,&m);\n\t\n\t\n\t\n\tfor(int i=0;i<n;i++)\n\t\tfor(int j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&a[i][j]);\n\t\t\tscanf(\"\\n\");\n\t\t}\t\n\t\n\t\t\t\n\tint flag=1;\n\t\n\tfor(int i=0;i<n;i++)\n\t\tfor(int j=0;j<m;j++)\n\t\t{\n\t\t\t\n\t\t\tif(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y')\n\t\t\t{\n\t\t\t\n\t\t\t\tflag=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(flag==0)\n\t\t\tprintf(\"#Color\");\n\t\telse\n\t\t\tprintf(\"#Black&White\");\n\t\t\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,j,cnt=0;\n char myarray[n][m];\n for(i=0; i<n; i++)\n {\n for(j=0; j<m; j++)\n {\n scanf(\" %c\",&myarray[i][j]);\n if(myarray[i][j]=='C' || myarray[i][j]=='M' || myarray[i][j]=='Y'){\n cnt=1;\n }\n }\n }\n if(cnt==1){\n printf(\"#Color\");\n }\n else{\n printf(\"#Black&White\");\n }\n return 0;\n}\n"}, {"source_code": " #include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d%d\",&n,&m);\n char a[n][m];\n int i,j,k,c=0,d=0;\n for(i=0; i<n; i++)\n {\n if(i==0)\n getchar();\n for(j=0; j<m; j++)\n {\n scanf(\"%c\",&a[i][j]);\n if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n {\n c=1;\n }\n\n getchar();\n }\n }\n if (c==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\nint main()\n{\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char c[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\" %c\",&c[i][j]);\n if(c[i][j]=='C' || c[i][j]=='Y' || c[i][j]=='M')\n {\n printf(\"#Color\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n int n,t,i,j,c=0,b=0,m=0,g=0,w=0,y=0,s=0;\n scanf(\"%d%d \",&n,&t);\n char a[n][t];\n for(i=0;i<n;i++){\n for(j=0;j<t;j++){\n scanf(\"%s\",&a[i][j]);\n if(a[i][j]=='C'){\n c=1;\n }\n else if (a[i][j]=='B'){\n b=1;\n }\n else if (a[i][j]=='W'){\n w=1;\n }\n else if(a[i][j]=='M'){\n m=1;\n }\n else if(a[i][j]=='Y'){\n y=1;\n }\n else{\n g=1;\n }\n }\n }\n s=g+y+c+m;\n if(w==1 && b==1 && s<2 && c==0){\n printf(\"#Black&White\\n\");\n\n }\n else if((b==0 && w==1 && s==0) || (b==1 && w==0 && s==0)){\n printf(\"#Black&White\\n\");\n }\n else if(s==1 && w==0 && b==0 && c==0 && m==0){\n printf(\"#Black&White\\n\"); \n }\n else{\n printf(\"#Color\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "# include<stdio.h>\n# include<string.h>\nint main()\n{\n int i, j, k, m, l=0;\n scanf(\"%d %d\", &i, &j);\n char s[i][j];\n for(k=0;k<i;k++){\n for(m=0;m<j;m++){\n scanf(\"%s\", &s[k][m]);\n if(s[k][m]=='C' || s[k][m]=='M' || s[k][m]=='Y'){\n l=1;\n break;\n }\n }\n }\n if(l==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\n\nint main(){\n\n\tbool flag ;\n\tchar temp ;\n\tint m, n, i, j, count ;\n\n\tscanf(\"%d %d\\n\", &n, &m) ;\n\n\tcount = 0 ;\n\n\tflag = true ;\n\n\tfor(i = 0 ; i < n ; i++){\n\t\tfor(j = 0 ; j < m ; j++){\n\t\t\tscanf(\"%c \", &temp) ;\n\t\t\tif((temp == 'B')||(temp == 'W')||(temp == ' ')||(temp == 'G')) ;\n\t\t\telse { flag = false ; break ; }\n\t\t}\n\t\tscanf(\"\\n\") ;\n\t}\t\n\n\tif(flag) printf(\"#Black&White\\n\") ;\n\telse printf(\"#Color\") ;\n\t\n\treturn 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,count=0;\n\tscanf(\"%d %d\",&n,&m);\n\tchar a[1000][1000];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\" %c\",&a[i][j]);\n\t\t\tif((a[i][j]=='C')||(a[i][j]=='M')||(a[i][j]=='Y'))\n\t\t\t\tcount++;\n\t\t}\n\t}\n\tif(count>=1)\n\t\tprintf(\"#Color\");\n\telse\n\t\tprintf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n int n, m, check = 0;\n char str[300];\n scanf(\"%d %d\", &n, &m);\n for (int i = 0; i <= n; i++) {\n gets(str);\n for (int j = 0; j <= strlen(str); j += 2) {\n if (str[j] == 'C' || str[j] == 'M' || str[j] == 'Y')\n check++;\n }\n }\n\n if (check == 0) printf(\"#Black&White\\n\");\n else printf(\"#Color\\n\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,i,j,flag=1;\n scanf(\"%d %d%*c\",&n,&m);\n char a[n][2*m+3];\n for(i=0;i<n;i++)\n {\n gets(a[i]);\n for(j=0;j<2*m;j=j+2){\n if(a[i][j]=='C'||a[i][j]=='Y'||a[i][j]=='M')\n {\n flag=0;\n }\n }\n }\n if(flag==0) printf(\"#Color\");\n else printf(\"#Black&White\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n int a,b,i,j,count=0;\n scanf(\"%d%d\",&a,&b);\n char s[a][b];\n for(i=0;i<a;i++) {\n for(j=0;j<b;j++) {\n scanf(\"%s\",&s[i][j]);\n }\n }\n for(i=0;i<a;i++) {\n for(j=0;j<b;j++) {\n if(s[i][j]=='C' || s[i][j]=='M' || s[i][j]=='Y') {\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <conio.h>\nint main(){\n int m, n,i,j;\n scanf(\"%d %d\",&m,&n);\n char a[m][n],c;\n scanf(\"%c\",&c);\n for (i=0;i<m;i++){\n for (j=0;j<n;j++){\n a[i][j]=getchar();\n if (a[i][j]==' ' || a[i][j]=='\\n'){\n j--;\n continue;\n }\n }\n }\n for (i=0;i<m;i++){\n for (j=0;j<n;j++){\n if (a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y'){\n printf(\"#Color\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int flag;\n int i,j,n,m;\n char mp[200][200];\n\n scanf(\"%d%d\",&n,&m);\n memset(mp,0,sizeof(mp));\n getchar();\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%c\",&mp[i][j]);\n getchar();\n }\n }\n flag=0;\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n if(mp[i][j]=='C' || mp[i][j]=='M' || mp[i][j]=='Y')\n flag=1;\n }\n }\n\n if(flag)\n printf(\"#Color\\n\");\n else\n printf(\"#Black&White\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,a,b,k=0;\n char A[101][101];\n scanf(\"%d %d\",&a,&b);\n for(i=0;i<a;i++)\n {\n for(j=0;j<b;j++)\n {\n scanf(\" %c\",&A[i][j]);\n if((A[i][j]=='M')||(A[i][j]=='Y')||(A[i][j]=='C'))\n k++;\n }\n }\n if(k==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint m,n,r=0,i;\n\tscanf(\"%d %d\",&m,&n);\n\tchar a[m*n][1];\n\tfor(i=0;i<m*n;i++){\n scanf(\"%s\",a[i]);\n if(a[i][0]=='C' || a[i][0]=='M' || a[i][0]=='Y') r=1;\n\t}\n\tif(r==1) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int r,c,i,j,count=0,l;\n scanf(\"%d %d\",&r,&c);\n char s;\n for(i=0;i<r;i++)\n {\n for(j=0;j<c;j++)\n {\n scanf(\" %c\",&s);\n if(s=='C'|| s=='M'||s=='Y')\n count++;\n }\n }\n if(count>0)\n printf(\"#Color\\n\");\n else\n printf(\"#Black&White\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m;\n\tchar a[105];\n\tint ok=0;\n\tint i,j,o;\n\tscanf(\"%d%d\",&n,&m);\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{ \n\t\t\tscanf(\"%s\",a);\n\t\t\tif(a[0]=='C'||a[0]=='M'||a[0]=='Y')\n\t\t\t{\n\t\t\t\tprintf(\"#Color\\n\");\treturn 0;\n\t\t\t}\t\t\t\t\t\n\t\t}\n\t}\t\n\t\tprintf(\"#Black&White\\n\");\t\n\treturn 0;\n}"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\n\nint main()\n{\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char c[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\" %c\",&c[i][j]);\n if(c[i][j]=='C' || c[i][j]=='Y' || c[i][j]=='M')\n {\n printf(\"#Color\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,d,i,j,t=0;\n\tchar c;\n\tscanf(\"%d%d\",&a,&b);\n\td=a*b;\n\tfor(i=0;i<d;i++)\n\t{\n\t\tscanf(\"%s\",&c);\n\t\tif(c=='C'||c=='M'||c=='Y') t=1;\n\t}\n\tif(t==1) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n}"}, {"source_code": "#include <stdio.h>\nint n,m;\nchar s[3];\nint main()\n{\n int i,j;\n scanf(\"%d%d\",&n,&m);\n for(i=1;i<=n;i++)\n for(j=1;j<=m;j++)\n {\n scanf(\"%s\",s);\n if(s[0] == 'C' || s[0] == 'M' || s[0] == 'Y') goto COLOR;\n }\n printf(\"#Black&White\"); return 0;\n COLOR:\n printf(\"#Color\"); return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,m,t=0;\n\tscanf(\"%d %d\",&n,&m);\n\tint i,j;\n\tchar s[1000][1000];\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%s\",&s[i][j]);\n\t\t\tif((s[i][j]=='C') || (s[i][j]=='Y') || (s[i][j]=='M'))\n\t\t\t{\n\t\t\t\tt++;\n\t\t\t}\n\t//\t\tprintf(\"s=%c t=%d\",s[i][j],t);\n\t\t}\n\t}\n\t//printf(\"\\nt=%d\\n\",t);\n\tif(t==0)\n\t\tprintf(\"#Black&White\\n\");\n\telse\n\t\tprintf(\"#Color\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint n,m,i,j,p=0;\n\t\n\tscanf(\"%d%d\",&n,&m);\n\t\n\tchar arr[n][m];\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\tscanf(\" %c\",&arr[i][j]);\t\n\t\t}\n\t}\n\tfor(i=0;i<n;i++){\n\t\tfor(j=0;j<m;j++){\n\t\t\tif(arr[i][j]=='C'||arr[i][j]=='M'||arr[i][j]=='Y') {\n\t\t\tprintf(\"#Color\");\n\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\t\t}\n\t\n\t\tprintf(\"#Black&White\");\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main(){\n int row,col,count = 0,c = 0;\n scanf(\"%d %d\",&row,&col);\n char str[row][col];\n for(int i = 0; i < row; i++){\n for(int j = 0; j < col; j++){\n scanf(\"%s\",str);\n }\n }\n for(int i = 0; i < row; i++){\n for(int j = 0; j < col; j++){\n if(str[i][j] == 'C' || str[i][j] == 'M' || str[i][j] == 'Y' || str[i][j] == 'G' )\n c++;\n if(str[i][j] == 'W' || str[i][j] == 'B')\n count++;\n }\n }\n if(count == row *col || ((count > c ) && (count + c) == row*col) )\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n,m,i,j,k,c,v,l;\n char ch;\n char line[300];\n\n\n scanf(\"%d %d\\n\",&n,&m);\n\n c = 0;\n\n for(i=0;i<n;i++){\n gets(line);\n\n\n if(c==0){\n\n l = strlen(line);\n\n for(j=0;j<l;j=j+2){\n if(line[0]=='Y'||line[0]=='C' || line[0] == 'Y'){\n c = 1;\n }\n\n }\n }\n\n }\n\n if(c==1){\n printf(\"#Color\\n\");\n }\n else{\n printf(\"#Black&White\\n\");\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int m, n, i, j, k=0, l=0;\n scanf(\"%d %d\", &m, &n);\n char c[m+10][n+n];\n for(i=0; i<m; i++)\n {\n for(j=0; j<n; j++)\n scanf(\" %c\", &c[i][j]);\n }\n for(i=0; i<m; i++)\n {\n for(j=0; j<n+n; j++){\n if(c[i][j]=='C' || c[i][j]=='M' || c[i][j]=='Y'){\n printf(\"#Color\\n\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\t\n\tint l, c, i, j;\n\tint ent = 0;\n\t\n\tscanf(\"%d%d\", &l, &c);\n\t\n\tchar mtz[l][c];\n\t\n\tfor(i = 0; i < l; i++){\n\t\tfor(j = 0; j < c; j++){\n\t\t\tscanf(\" %c\", &mtz[l][c]);\n\t\t}\n\t}\t\n\tfor(i = 0; i < l; i++){\n\t\tfor(j = 0; j < c; j++){\n\t\t\tif(mtz[l][c] != 'B' && mtz[l][c] != 'W' && mtz[l][c] != 'G'){\n\t\t\t\tent = 1;\n\t\t\t}\t\t\t\n\t\t}\n\t}\n\t\n\n\tif(ent == 1){\n\t\tprintf(\"#Color\\n\");\n\t}\n\telse{\n\t\tprintf(\"#Black&White\\n\");\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int n, m,i,y=0;\n scanf(\"%d %d\",&n,&m);\n char a[m];\n while(n--){\n fflush(stdin);\n gets(a);\n for (i=0;i<strlen(a);i++){\n if (a[i]=='C' || a[i]=='M' || a[i]=='Y'){\n y=1;\n break;\n }\n }\n if (y==1)\n break;\n }\n if (y==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n;\n long long int sum,count=0;\n char c;\n scanf(\"%d%d\",&m,&n);\n sum=m*n;\n for(i=0; i<=m; i++)\n {\n for(j=0; j<=n; j++)\n {\n scanf(\"%c\",&c);\n if(c=='B'||c=='W'||c=='G')\n count++;\n }\n }\n if(count==sum)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}\n"}, {"source_code": "# include<stdio.h>\n# include<string.h>\nint main()\n{\n int i, j, k, m, l=0;\n scanf(\"%d %d\", &i, &j);\n char s[i][j];\n for(k=1;k<=i;k++){\n for(m=1;m<=j;m++){\n scanf(\"%c\", &s[k][m]);\n if(s[k][m]=='C' || s[k][m]=='M' || s[k][m]=='Y'){\n l=1;\n break;\n }\n else l+=0;\n }\n }\n if(l==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,x;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i<m*n;i++)\n {\n scanf(\" %c\",&ch);\n if(ch=='C'||ch=='M'||ch=='y')\n {\n x=1;\n break;\n }\n }\n if(x==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint n,m,i,j,k=0;\n\tscanf(\"%d%d\",&n,&m);\n\tchar arr[n][m];\n\tfor(i=0;i<n;i++){\n\tscanf(\"%s\",arr[i]);\n }\n\tfor(i=0;i<n;i++){\n\t for(j=0;j<n;j++){\n\t \tif(arr[i][j]=='C'||arr[i][j]=='M'||arr[i][j]=='Y') {\n\t \t\tk=1;\n\t \t\tbreak;\n\t\t }\n\t}\n\tif(k==1) break;\n\t}\n\tif(k==1) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint test(char *c){\n int x = 0;\n while(*c != '\\0'){\n if(*c =='C'||*c =='M'||*c =='Y'){\n x = 1;\n }\n c++;\n }\n return x;\n}\nint main(){\n int x,y;\n scanf(\"%d%d\",&x,&y);\n int flag = 0;\n y = 2*y-1;\n for(int i=0;i<=x;i++){\n char ch[y];\n gets(ch);\n int t = test(ch);\n if(t == 1){\n flag == 1;\n }\n }\n if(flag == 1){\n printf(\"#Color\");\n }\n else if(flag == 0){\n printf(\"#Black&White\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,we=0;\n\tchar a;\n\tscanf(\"%d%d\",&n,&m);\n\tgetchar();\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<m*2-1;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&a);\n\t\t\tif(j%2==0)\n\t\t\tcontinue;\n\t\t\tif(a=='C')\n\t\t\twe=1;\n\t\t\tif(a=='M')\n\t\t\twe=1;\n\t\t\tif(a=='Y')\n\t\t\twe=1;\n\t\t}\n\t\tgetchar();\n\t}\n\tif(we==0)\n\tprintf(\"#Black&White\\n\");\n\telse\n\tprintf(\"#Color\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,m,i,j,p=0;\n scanf(\"%d %d\",&n,&m);\n\n for(i=0; i<n; i++)\n {\n fflush(stdin);\n for(j=0; j<m; j++)\n {\n char ch;\n ch=getchar();\n\n if(ch=='C' || ch=='M' || ch=='Y')\n {\n p=1;\n }\n }\n }\n\n if(p==1)\n {\n printf(\"#Color\");\n }\n else\n {\n printf(\"#Black&White\");\n }\n\n return 0;\n}\n"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:29/01/2019\n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define mod 1000000007\n\nint main()\n{\n long long n,m,i,j,f=0;\n scanf(\"%lld%lld\",&n,&m);\n char str[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%str\",&str[i][j]);\n if(str[i][j]!='B' && str[i][j]!='W')\n {\n f=1;\n //printf(\"%lld %lld \",i,j);\n }\n }\n }\n if(f==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,a,x,b,B[2],k=0;\n char A[101][101];\n for(x=0;x<2;x++)\n {\n scanf(\"%d\",&B[x]);\n }\n a=B[0];\n b=B[1];\n scanf(\"\\n\");\n for(i=0;i<a;i++)\n {\n\n for(j=0;j<b;j++)\n {\n scanf(\"%c\",&A[i][j]);\n if((A[i][j]=='M')||(A[i][j]=='Y')||(A[i][j]=='C'))\n {\n k++;\n\n }\n }\n\n }\n if(k==0)\n printf(\"#Black&White\");\n else\n printf(\"#color\");\n return 0;\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int i,j,r,c,d=0,e=0;\n char x[100][100];\n scanf(\"%d%d\",&r,&c);\n for(i=0;i<r;i++)\n {\n for(j=0;j<c;j++)\n {\n scanf(\" %c\",&x[i][j]);\n }\n }\n for(i=0;i<r;i++)\n {\n for(j=0;j<c;j++)\n {\n if(x[i][j]=='C'||x[i][j]=='M'||x[i][j]=='Y')\n d=1;\n break;\n }\n }\n if(d==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int j,s,r,c,k=0,i;\n char a[300][300];\n scanf(\"%d %d\",&r,&c);\n for(i=1; i<=r ;i++)\n {\n for(j=1; j<=c ;j++)\n {\n scanf(\"%c\",&a[i][j]);\n getchar();\n }\n }\n\n for(i=0; i<r ;i++)\n {\n for(j=0; j<c ;j++)\n {\n if(a[i][j]=='W'||a[i][j]=='B'||a[i][j]=='G')k=1;\n else k=0;\n }\n }\n if(k==1)printf(\"#Black&White\");\n else printf(\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n int n,m,i,j,x;\n scanf(\"%d%d\",&n,&m);\n char arr[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",&arr[i][j]);\n\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n\n if(arr[i][j]!='B' && arr[i][j]!='W' && arr[i][j]!='G')\n {\n x=1;\n }\n else\n {\n x=0;\n }\n\n\n\n }\n }\n\n if(x==1)\n printf(\"#Color\");\n\n if(x==0)\n printf(\"#Black&White\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,x;\n scanf(\"%d%d\",&n,&m);\n char ch;\n for(i=0;i<m*n;i++)\n {\n scanf(\" %c\",&ch);\n if(ch=='C'||ch=='M'||ch=='y')\n {\n x=1;\n break;\n }\n }\n if(x==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int m,n,l=0;\n char a[100];\n scanf(\"%d %d\",&m,&n);\n for(int j=1;j<=2*m;j++){\n for(int i=0;i<n;i++){\n scanf(\"%c\",&a[i]);\n if(a[i]=='W'||a[i]=='B'||a[i]=='G'){\n l++;\n }\n }}\n\n if(l==0){\n printf(\"#Color\");\n } else{\n printf(\"#Black&White\");\n }\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n int n,m,mk=0,i,J;\n char ch[101][101];\n\n\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n\n for(J=0;J<m;J++)\n {\n scanf(\"%c \",&ch[i][J]);\n }\n scanf(\"\\n\");\n }\n for(i=0;i<n;i++)\n {\n\n for(J=0;J<m;J++)\n {\n\n if(ch[i][J]=='C' ||ch[i][J]=='M' ||ch[i][J]=='Y')\n {\n \n printf(\"#Color\\n\");\n return 0;\n\n\n }\n\n }\n\n }\n printf(\"#Black&White\\n\");\n return 0;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,i,count=0;\n scanf(\"%d %d\",&x,&y);\n for(i=1;i<=x*y;i++)\n {\n char ch;\n scanf(\"%c\",&ch);\n if(ch=='M'||ch=='C'||ch=='Y')\n {\n count++;\n }\n }\n if(count)\n printf(\"#Color\\n\");\n else printf(\"#Black&White\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,m,i,count=0;\n scanf(\"%d%d\",&n,&m);\n t=(n+1)*m+n;\n char s[t];\n for(i=0;i<=t;i++)\n {\n scanf(\"%c\",&s[i]);\n }\n for(i=1;i<=t;i=i+2)\n {\n if(s[i]=='W'||s[i]=='B'||s[i]=='G')\n count++;\n printf(\"%d\",count);\n }\n if(count==n*m)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m,count=0,i,j;\n\n scanf(\"%d %d\",&n,&m);\n char a[n][m];\n\n\n for(i=0;i<n; i++)\n {\n for(j=0; j<m; j++)\n {\n scanf(\" %c\",&a[i][j]);\n if(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y')\n {\n count++;\n }\n }\n }\n if(count)\n {\n printf(\"#Color\");\n }\n else\n printf(\"Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n,count=0;\n char x[200];\n scanf(\"%d %d\",&n,&m);\n\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\"%s\",&x[i]);\n if(x[i]=='C'||x[i]=='M'||x[i]=='Y'){\n count=1;\n }\n }\n if(count==1){\n printf(\"Color\\n\");\n }\n else{\n printf(\"#Black&White\\n\");\n }\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t#ifndef ONLINE_JUDGE\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\n int n,m,i,j,count=0;\n scanf(\"%d%d\",&n,&m);\n char c;\n\n for(i=0;i<n;i++)\n {\n \tfor(j=0;j<m;j++)\n \t{\n \t\tscanf(\"%c\",&c);\n \t\tprintf(\"%c--%d\\n\",c,count);\n\n \t\tif(c=='C' || c=='M' || c=='Y')\n \t\t{\n \t\t\tcount=count+1;\n\n \t\t}\n \t\t\n \t}\n }\n\n\n if(count>0)\n {\n \tprintf(\"#Color\\n\");\n }\n else if(count==0)\n {\n \tprintf(\"#Black&White\\n\");\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int array[500][500],row,col,i,j;\n char ch1,ch2;\n scanf(\"%d %d\",&row,&col);\n for(i=1; i<=row; i++)\n {\n for(j=1; j<=col; j++)\n {\n scanf(\"%c %c\",&ch1,&ch2);\n }\n }\n if(ch1=='B'||ch1=='W'||ch1=='G'||ch2=='B'||ch2=='W'||ch2=='G')\n {\n printf(\"#Black&White\\n\");\n }\n else\n {\n printf(\"#Color\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,k,l,j,flag=0,c;\n scanf(\"%d %d\",&i,&j);\n char a[i][j];\n for(l=0;l<i;l++){\n for(k=0;k<j*2;k++){\n scanf(\"%c\",&a[l][k]);\n if((a[l][j]=='W')||(a[l][j]=='B')){\n c++;\n }\n }\n }\n\nif(c>0){\n printf(\"#Black&White\");\n}\n\nelse{\n printf(\"#Color\");\n}\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,c,i,j,x=0;\n scanf(\"%d%d\",&r,&c);\n char a[r][c];\n\n for(i=0;i<=r;i++)\n {\n for(j=0;j<c;j++)\n {\n if(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y')\n x++;\n }\n }\n if(x==0)\n printf(\"#Black&White\\n\");\n else\n printf(\"#Color\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,m,i,j,x=0;\nscanf(\"%d%d\",&n,&m);\nchar s[n][m];\nfor(i=0;i<n;i++)\n{\nfor(j=0;j<m;j++)\n{\nscanf(\"%s\",&s[i][j]);\n}\n}\nfor(i=0;i<n;i++)\n{\nfor(j=0;j<m;j++)\n{\nif(s[i][j]=='C' || s[i][j]=='M'|| s[i][j]=='Y' || s[i][j]=='Y' || s[i][j]=='G')\n{\nx=1;\nbreak;\n}\nelse\n{\nx=0;\n}\n}\n}\nif(x==1)\nprintf(\"#Black&White\");\nelse if(x==0)\nprintf(\"#Color\");\nreturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main(){\n int row,col,count = 0,c = 0;\n scanf(\"%d %d\",&row,&col);\n char str[row][col];\n for(int i = 0; i < row; i++){\n for(int j = 0; j < col; j++){\n scanf(\"%s\",str);\n }\n }\n for(int i = 0; i < row; i++){\n for(int j = 0; j < col; j++){\n if(str[i][j] == 'C' || str[i][j] == 'M' || str[i][j] == 'Y' || str[i][j] == 'G' )\n c++;\n if(str[i][j] == 'W' || str[i][j] == 'B')\n count++;\n }\n }\n if(count == row *col || ((count > c ) && (count + c) == row*col) )\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,a,i,j=0;\n char c;\n scanf(\"%d%d\",&n,&m);\n a=m*n;\n for(i=0;i<a;i++)\n {\n scanf(\"%c\",&c);\n getchar();\n if(c=='C'||c=='M'||c=='Y')\n j++;\n }\n if(j>1)\n printf(\"#Color\\n\");\n else\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n int x;\n scanf(\"%d\",&x);\n int y;\n scanf(\"%d\",&y);\n int a=0;\n int b=0;\n int c=x*y;\n int i=0;\n while(i<c*x+1){\n char m;\n scanf(\"%c\",&m);\n if(m=='G' || m=='Y' || m=='C' || m=='M'){\n a++;\n }\n else if(m=='B' || m=='W'){\n b++;\n }\n i++;\n }\n if(a==0 && b>0){\n printf(\"#Black&White\");\n }\n else if(a>0){\n printf(\"#Color\");\n }\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\n\nint main (){\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tint color = 0;\n\tchar c;\n\tfor (int i = 0; i<m ; i++)\n\t{\n\t\tfor (int j = 0; i<n ; i++)\n\t\t{\n\t\t\tscanf(\" %c\", &c);\n\t\t\tif (c == 'C' || c == 'M' || c == 'Y')\n\t\t\t{\n\t\t\t\tcolor = 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (color) printf(\"Color\");\n\telse printf(\"Black&White\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t,n,m,i,count=0;\n scanf(\"%d%d\",&n,&m);\n t=(n+(m-1))*m+n;\n char s[t];\n for(i=0;i<=t;i++)\n {\n scanf(\"%c\",&s[i]);\n }\n for(i=1;i<=t;i=i+2)\n {\n if(s[i]=='W'||s[i]=='B'||s[i]=='G')\n count++;\n printf(\"%d\",count);\n }\n if(count==n*m)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,sum=0,bam=0;\n char s[101];\n scanf(\"%d%d\",&a,&b);\n for(i=0;i<a*b;i++)\n {\n scanf(\"%s\",s);\n\n }\n\n for(i=0;i<a*b;i++)\n {\n if(s[0]=='C' || s[0]=='M' || s[0]=='Y')\n {\n printf(\"#Color\");\n break;\n }\n\n else if(s[0]=='W' || s[0]=='B' || s[0]=='G')\n {\n printf(\"#Black&White\");\n break;\n }\n\n }\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m,i,y,flag=0,j;\n scanf(\"%d %d\",&n,&m);\n\n y=2*m;\n\n char matrix[n][y];\n\n for(i=0;i<=n;i++)\n {\n for(j=0;j<y;j++)\n {\n scanf(\"%c\",&matrix[i][j]);\n if(matrix[i][j]=='C'||matrix[i][j]=='M'||matrix[i][j]=='Y')\n {\n flag=1;\n }\n }\n }\n if(flag==1)\n {\n printf(\"#Color\");\n }\n else\n {\n printf(\"#Black&White\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,i,j,count,Color,BlackWhite;\n char s[100];\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",&s[j]);\n\n if(s[j]=='C' || s[j]=='M' || s[j]=='Y')\n {\n count=Color;\n }\n else if(s[j]=='W' || s[j]=='G' || s[j]=='B')\n {\n count=BlackWhite;\n }\n else if(s[j]=='C' || s[j]=='M' || s[j]=='Y' || s[j]=='W' || s[j]=='G' || s[j]=='B')\n {\n count=Color;\n }\n\n }\n }\n if(count==Color)\n printf(\"#Color\",count);\n else if(count==BlackWhite)\n printf(\"#Black&White\",count);\n else\n printf(\"#Color\");\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int p,q,count=0;\n scanf(\"%d %d\",&p,&q);\n char t;\n for(int i=0;i<p*q;i++)\n {\n scanf(\"%c\",&t);\n if(t=='C'||t=='M'||t=='Y')\n {\n count=1;\n break;\n }\n }\n if(count==1)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n,m,y=0,i,j;\n char p;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++){\n for(j=0;j<n;j++){\n scanf(\"%c\",&p);\n if(p=='C' || p=='M' || p=='Y'){\n y=1;\n }\n }\n }\n if(y==0){\n printf(\"#Black&White\");\n }\n else{\n printf(\"#Color\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d %d\",&n,&m);\n\tchar c;\n\tbool col=false;\n\tint i, j;\n\tfor(i=0;i<n;i++)\n\n\t{\n\t\tfor(j=0; j<m; j++)\n\t\t{\n\t\t\tscanf(\"%c\",&c);\n\t\t\tif(c=='C' || c=='M' || c=='Y')\n\t\t\t col=true;\n\t\t\tif(col)\n\t\t\t break;\n\t\t}\n\t\tif(col) \n\t break;\n\t}\n\t\n\tif(!col) printf(\"#Black&White\");\n\telse printf(\"#Color\");\nreturn 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a;\n int i,j,n,m,k=0;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=(2*m);j++)\n {\n scanf(\"%c\",&a);\n if(a=='W'||a=='B'||a=='C')\n k++;\n }\n }\n i=m*n;\n if(i==k)\n printf(\"#Black&White\\n\");\n else printf(\"#Color\\n\");\n return 0;\n}"}, {"source_code": " #include<stdlib.h>\nmain()\n{\n char a;\n int n,m,i,j=0,k=0;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n for(j=0;j<2*m-1;j++)\n {\n scanf(\"%c\",&a);\n if(a=='C'||a=='M'||a=='Y')\n {\n k=1;break;\n }\n }\n if(k) break;\n }\n if(k) printf(\"#Color\");\n else printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n;\n long long int sum,count=0;\n char c;\n scanf(\"%d%d\",&m,&n);\n sum=m*n;\n for(i=0; i<=m; i++)\n {\n for(j=0; j<=n; j++)\n {\n scanf(\"%c\",&c);\n if(c=='B'||c=='W'||c=='G')\n count++;\n }\n }\n if(count==sum)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,s;\n long long int count=0;\n char p;\n for(int i=0;i<a*s;i++)\n {\n scanf(\" %c\",&p );\n if(p=='G'||p=='B'||p=='W');\n count++;\n \n }\n if(count==a*s)\n printf(\"#Black&White\");\n else \n printf(\"#Color\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int r,c,count=0;\n scanf(\"%d %d\",&r,&c);\n char a[r][c];\n int i,j;\n getchar();\n for(i=0;i<r;i++)\n {\n for(j=0;j<c;j++)\n {\n scanf(\"%c\",&a[i][j]);\n getchar();\n }\n }\n for(i=0;i<r;i++)\n {\n for(j=0;j<c;j++)\n {\n if(a[i][j]=='C' || a[i][j]=='M' || a[i][j]=='Y' || a[i][j]=='G')\n count++;\n }\n }\n if(count>0)\n printf(\"#Color\");\n else\n printf(\"#Black&White\");\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,x,y,count=0;\n char s[102][102];\n scanf(\"%d %d\",&x,&y);\n for(i=0;i<x;i++){\n for(j=0;j<y;j++){\n scanf(\"%s\",&s[i][j]);\n if(s[i][j]=='W'||s[i][j]=='G'||s[i][j]=='B'){\n count=1;\n }\n else if(s[i][j]=='C'||s[i][j]=='M'||s[i][j]=='Y'){\n count=0;\n break;\n }\n }\n\n }\n if(count==0){\n printf(\"#Color\\n\");\n }\n else if(count==1){\n printf(\"#Black&White\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,k,i,count=0,j,ele;\n\tchar ch;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&m);\n\tk=n*m;\n\tfor(i=0;i<k;i++)\n\t{\n\t\n\t\t\tscanf(\" %c\",&ch);\n\t\t\t\t\t\t\t\n\t\t\tif(ch=='W'||ch=='B'||ch=='G')\n\t\t\t\n\t\t\t\tcount=count+1;\n\n\t\t\t\t\t\t\n\t}\n\tprintf(\"%d \",count);\n\tif(count==k)\n\t{\n\t\tprintf(\"#Black&White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"#Color\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int n,m,i,j,k=0;\n scanf(\"%d %d\",&n,&m);\n char a[m],b[n];\n for(i=0;i<m||i<n;i++){\n scanf(\"%c %c\",&a[i],&b[i]);}\n for(j=0;j<n||j<m;j++){\n if(a[j]=='C'||a[j]=='Y'||a[j]=='M'||b[j]=='C'||b[j]=='Y'||b[j]=='M'){\n k=1;\n break;}\n }\n if(k==1){printf(\"#Color\");}\n else{printf(\"#Black&White\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\n int n,t,i,j,c=0,b=0,m=0,g=0,w=0,y=0,s=0;\n scanf(\"%d%d \",&n,&t);\n char a[n][t];\n for(i=0;i<n;i++){\n for(j=0;j<t;j++){\n scanf(\"%s\",&a[i][j]);\n if(a[i][j]=='C'){\n c=1;\n }\n else if (a[i][j]=='B'){\n b=1;\n }\n else if (a[i][j]=='W'){\n w=1;\n }\n else if(a[i][j]=='M'){\n m=1;\n }\n else if(a[i][j]=='Y'){\n y=1;\n }\n else{\n g=1;\n }\n }\n }\n s=g+y+c+m;\n if(w==1 && b==1 && s<2){\n printf(\"#Black&White\\n\");\n\n }\n else if((b==0 && w==1 && s==0) || (b==1 && w==0 && s==0)){\n printf(\"#Black&White\\n\");\n }\n else{\n printf(\"#Color\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,sum=0,bam=0;\n char s[101];\n scanf(\"%d%d\",&a,&b);\n for(i=0;i<a*b;i++)\n {\n scanf(\"%s\",s);\n\n }\n\n for(i=0;i<a*b;i++)\n {\n if(s[0]=='C' || s[0]=='M' || s[0]=='Y')\n {\n printf(\"#Color\");\n break;\n }\n\n else if(s[0]=='W' || s[0]=='B' || s[0]=='G')\n {\n printf(\"#Black&White\");\n break;\n }\n\n }\n\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\n int i,j,a,b,row,coloum,count1=0,count=0;\n scanf(\"%d %d\",&row,&coloum);\n char ara[row][coloum];\n for(i=0;i<row;i++)\n {\n for(j=0;j<coloum;j++){\n scanf(\"%s\",&ara[i][j]);\n if(ara[i][j]=='C'||ara[i][j]=='M'||ara[i][j]=='Y')\n {\n count1=count1+1;\n //printf(\"%d\\n\",count1);\n }\n else if(ara[i][j]=='W'||ara[i][j]=='B'){\n count=count+1;}}}\n if(count1<=row*coloum&&count1>0)\n {\n printf(\"#Color\");\n }\n else if(count<=row*coloum&&count>0)\n {\n printf(\"#Black&White\");\n }\n\nreturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,j;\n char ara[100][100];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",&ara[i][j]);\n if(ara[i][j]!='C' || ara[i][j]!='M' || ara[i][j]!='Y')\n\n {\n goto color;\n break;\n }\n }\n }\n printf(\"#Black&White\\n\");\n color:\n printf(\"#Color\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,m,COUNT=0;\n scanf(\"%d %d\\n\",&n,&m);\n char a[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n gets(a);\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n if( a[i][j]==67 || a[i][j]==89 || a[i][j]==77)\n {\n COUNT++;\n }\n }\n\n }\n if(COUNT>=1)\n {\n printf(\"#Color\");\n }\n else{\n printf(\"#Black&White\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,k,i,count=0;\n\tchar ch;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&m);\n\tk=n*m;\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%c\",&ch);\n\t\tif(ch=='W'||ch=='B'||ch=='G')\n\t\tcount=count+1;\n\t}\n\tif(count==k)\n\t{\n\t\tprintf(\"#Black&White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"#color\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int n,m,i,j;\n scanf(\"%d %d\",&n,&m);\n int c=0;\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\"%s\",&s);\n if(strcmp(s,\"B\")==0 || strcmp(s,\"W\")==0 || strcmp(s,\"G\")==0)\n c=1;\n else{\n c=0;\n break;\n }\n }\n }\n if(c==1)\n printf(\"#Black&White\\n\");\n else\n printf(\"#Color\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n//#include<string.h>\n\n//void swap(int *xp, int *yp) \n//{ \n// int temp = *xp; \n// *xp = *yp; \n// *yp = temp; \n//} \n// \n//// A function to implement bubble sort \n//void bubbleSort(int arr[], int n) \n//{ \n// int i, j; \n// for (i = 0; i < n-1; i++) \n// \n// // Last i elements are already in place \n// for (j = 0; j < n-i-1; j++) \n// if (arr[j] > arr[j+1]) \n// swap(&arr[j], &arr[j+1]); \n//}\n\nint main(){\n\tint m,n;\n\tscanf(\"%d %d\",&m,&n); fflush(stdin); \n\tchar c;\n\tint cek =0;\n\t \n\tfor(int i=0;i<m*n;i++){\n\t\tscanf(\" %c\",&c); \n\t//\tfor(int j=0;j<n;j++){\n\t\t\tif(c=='C' || c=='M'||c=='Y') cek++;\n\t//\t}\n\t}\n\t\n\tif(cek==0) printf(\"#Black&White\");\n\telse printf(\"#Color\");\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m;\n\tchar a[1000][1000];\n\tint ok=0;\n\tint i,j;\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%s\",a);\t\t\t\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tif(a[i][j]=='W'||a[i][j]=='B'||a[i][j]=='G')\n\t\t\tok=1;\n\t\t\telse if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n\t\t\tok=0;\n\t\t}\n\t}\n\tif(ok==1)\n\t{\n\t\tprintf(\"#Black&White\\n\");\n\t}\n\telse if(ok==0)\n\t{\n\t\tprintf(\"#Color\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain(){\n\tint n,m,i,j,k=0;\n\tscanf(\"%d%d\",&n,&m);\n\tchar arr[n][m];\n\tfor(i=0;i<n;i++){\n\tscanf(\"%s\",arr[i]);\n }\n\tfor(i=0;i<n;i++){\n\t for(j=0;j<n;j++){\n\t \tif(arr[i][j]=='C'||arr[i][j]=='M'||arr[i][j]=='Y') {\n\t \t\tk=1;\n\t \t\tbreak;\n\t\t }\n\t}\n\tif(k==1) break;\n\t}\n\tif(k==1) printf(\"#Color\");\n\telse printf(\"#Black&White\");\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char s[n][m];\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n scanf(\"%s\",&s[i][j]);\n }\n }\n for(i=0;i<n;i++) {\n for(j=0;j<m;j++) {\n if(s[i][j] == 'C'||s[i][j] == 'M'||s[i][j] == 'Y') {\n printf(\"#color\\n\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,m,i,j;\n scanf(\"%d%d\",&n,&m);\n char clr[n*m];\n for(j=0; j<n*m; j++)\n {\n scanf(\"%c\",&clr[j]);\n if(clr[j]=='C'||clr[j]=='M'||clr[j]=='Y')\n {\n printf(\"#Color\");\n return 0;\n }\n }\n printf(\"#Black&White\");\n return 0;\n}\n"}, {"source_code": "int main ()\n\n{\n\tint m,n,i,j,flag=0;\n\tchar a[100][100];\n\t\n\tprintf(\"Enter the number of rows in the matrix : \");\n\tscanf(\"%d\",&m);\n\tprintf(\"\\nEnter the number of columns in the matrix : \");\n\tscanf(\"%d\",&n);\n\t\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tscanf(\"%s\",&a[i][j]);\n\t\t}// end inner for \n\t}// end outer for\n\t\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tprintf(\"%c \",a[i][j]);\n\t\t}// end inner for \n\t\tprintf(\"\\n\");\n\t}// end outer for\n\t\n\tfor(i=0;i<m;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(a[i][j]=='M' || a[i][j]=='Y' || a[i][j]=='C')\n\t\t\tflag=1;\n\t\t}// end inner for \n\t}// end outer for\n\t\n\tif(flag==1)\n\tprintf(\"\\n#color\");\n\telse\n\tprintf(\"\\n#Black&White\");\n\t\n}// end function main\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j;\n scanf(\"%d %d\",&a,&b);\n fflush(stdin);\n char arr[a][b];\n for(i=0;i<a;i++){\n for(j=0;j<b;j++) scanf(\" %c\",&arr[i][j]);\n }\n for(i=0;i<a;i++){\n for(j=0;j<b;j++){\n if(arr[i][j]=='C'||arr[i][j]=='M'||arr[i][j]=='Y'){\n printf(\"#Color\");\n return 0;\n }\n }\n }\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<string.h>\n\n//void swap(int *xp, int *yp) \n//{ \n// int temp = *xp; \n// *xp = *yp; \n// *yp = temp; \n//} \n// \n//// A function to implement bubble sort \n//void bubbleSort(int arr[], int n) \n//{ \n// int i, j; \n// for (i = 0; i < n-1; i++) \n// \n// // Last i elements are already in place \n// for (j = 0; j < n-i-1; j++) \n// if (arr[j] > arr[j+1]) \n// swap(&arr[j], &arr[j+1]); \n//}\n\nint main(){\n\tint m,n;\n\tscanf(\"%d %d\",&m,&n); fflush(stdin);\n\tchar c[m][n];\n\tint cek =0;\n\tscanf(\" %s\",c); \n\tfor(int i=0;i<m;i++){\n//\t\tscanf(\" %s\",c); \n\t\tfor(int j=0;j<n;j++){\n\t\t\tif(c[i][j]!='B' && c[i][j]!='W') cek++;\n\t\t}\n\t}\n\t\n\tif(cek==0) printf(\"#Black&White\");\n\telse printf(\"#Color\");\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n int main(void)\n { \n \tint n,i,m,j,b=0;\n \tscanf(\"%d %d\",&n,&m);\n \tchar a[n][m];\n \tfor(i=0;i<n;i++)\n \t{\n \tfor(j=0;j<m;j++)\n \t {\n \t\tscanf(\"%c\",&a[i][j]);\n if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n {\n \tprintf(\"#Color\");\n \tb++;\n \tbreak;\n }\n \t }\n \t if(b>0)\n \t break; \n \t}\n \tif(b==0)\n \tprintf(\"#Black&White\");\n \treturn 0;\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,count=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&b);\n char array[100][100];\n for(i=0; i<a; i++)\n {\n for(j=0; j<b; j++)\n {\n scanf(\"%c\",&array[i][j]);\n }\n }\n for(i=0; i<a; i++)\n {\n\n for(j=0; j<b; j++)\n {\n if(array[i][j]=='W'|| array[i][j]== 'B' || array[i][j]== 'G')\n {\n\n count++;\n if(count==1)\n break;\n }\n\n }\n if(count==1)\n break;\n }\n if(count==1)\n {\n printf(\"#Black&White\");\n }\n else\n {\n printf(\"#Color\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,j,flag=0,n,m;\n scanf(\"%d %d\",&n,&m);\n char c [n][m];\n\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\" %c\",&c[i][j]);\n if (c[i][j]==67 || c[i][j]==77 || c[i][j]== 89 || c[i][j]==71)\n flag=1;\n }\n }\n\n\n\n if(flag==1)\n printf(\"#color\");\n else if (flag==0)\n printf(\"#Black&White\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int n,m,i,j,k=0;\n scanf(\"%d %d\",&n,&m);\n char a[m],b[n];\n for(i=0;i<m||i<n;i++){\n scanf(\"%c %c\",&a[i],&b[i]);}\n for(j=0;j<n||j<m;j++){\n if(a[j]=='C'||a[j]=='Y'||a[j]=='M'||b[j]=='C'||b[j]=='Y'||b[j]=='M'){\n k=1;\n break;}\n }\n if(k==1){printf(\"#Coloured\");}\n else{printf(\"#Black&White\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,c=0,i;\n scanf(\"%d %d\",&n,&m);\n char a[100000];\n for(i=m*n;i>0;i--)\n {\n scanf(\"%c\",&a[i]);\n }\n for(i=m*n;i>0;i--)\n {\n if(a[i]=='C' || a[i]=='M' || a[i]=='Y')\n {\n c=1;\n break;\n }\n }\n if(c==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,i,j;\n\tscanf(\"%d %d\",&a,&b);\n\tchar dizi[a+1][b+1];\n\tfor(i=0;i<a;i++)\n\t\tfor(j=0;j<b;j++)\n\t\t\tscanf(\"% c\",&dizi[i][j]);\n\tfor(i=0;i<a;i++)\n\t\tfor(j=0;j<b;j++)\n\t\t{\n\t\t\tif(dizi[i][j]=='C'||dizi[i][j]=='M'||dizi[i][j]=='Y')\n\t\t\t{\n\t\t\t\tprintf(\"#Color\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tprintf(\"#Black&White\");\n\treturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <stdlib.h>\n\n/*\n * \n */\nint main(int argc, char** argv) {\n int k,p,n,m,i;\n char j;\n scanf(\"%d %d\",&n,&m);\n i=n*m;\n for(k=1;k<=i;k++){\n scanf(\"%s\",&j);\n if((j=='C')||(j=='M')||(j=='Y'))\n p=1;\n }\n if(p==1)\n printf(\"#color\");\n else\n printf(\"#Black&White\");\n return (EXIT_SUCCESS);\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i,j,we=0;\n\tchar a;\n\tscanf(\"%d%d\",&n,&m);\n\tgetchar();\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tfor(j=1;j<m*2-1;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&a);\n\t\t\tif(j%2==0)\n\t\t\tcontinue;\n\t\t\tif(a=='C')\n\t\t\twe=1;\n\t\t\tif(a=='M')\n\t\t\twe=1;\n\t\t\tif(a=='Y')\n\t\t\twe=1;\n\t\t}\n\t\tgetchar();\n\t}\n\tif(we==0)\n\tprintf(\"#Black&White\\n\");\n\telse\n\tprintf(\"#Color\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[100][100];\n int i,j,r,c,flag=0;\n scanf(\"%d %d\",&r,&c);\n for(i=0; i<r; i++)\n {\n for(j=0; j<c; j++)\n {\n scanf(\" %c\", &s[i][j]);\n }\n }\n for(i=0; i<r; i++)\n {\n for(j=0; j<c; j++)\n {\n if(s[i][j] != 'W' || s[i][j] != 'B')\n {\n flag = 1;\n }\n \n }\n }\n\n if(flag==0)\n {\n printf(\"#Black&White\\n\");\n }\n else\n printf(\"#Color\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,a,b;\n scanf(\"%d %d\",&a,&b);\n char letter[a][b];\n for(i=1;i<=a;i++)\n for(j=1;j<=b;j++)\n {\n scanf(\"%c\",&letter[i][j]);\n if(letter[i][j]=='C'||letter[i][j]=='M'||letter[i][j]=='Y')\n {\n printf(\"#Color\\n\");\n\n }\n}\n\n\n printf(\"#Black&White\\n\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,r=0,s=0,i,j;\n char ch[2];\n scanf(\"%d %d \",&n,&m);\n for(i=1; i<=n; i++)\n {\n for(j=1; j<=m; j++)\n {\n scanf(\"%s\",ch);\n if(strcmp(ch,\"W\")==0|| strcmp(ch,\"B\")==0 || strcmp(ch,\"G\")==0)\n {\n r++;\n }\n else\n {\n s++;\n }\n }\n }\n if(r>s)\n {\n printf(\"#Black&White\\n\");\n }\n else\n {\n printf(\"#Color\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,k,i,count=0;\n\tchar ch;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&m);\n\tk=n*m;\n\tprintf(\"%d\\n\",k);\n\tfor(i=0;i<k;i++)\n\t{\n\t\tscanf(\"%c\",&ch);\n\t\tif(ch=='W'||ch=='B'||ch=='G')\n\t\tcount=count+1;\n\t}\n\tif(count==k)\n\t{\n\t\tprintf(\"#Black&White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"#color\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int j,n,m,bw=0,col=0;\n char ch;\n scanf(\"%d%d\",&n,&m);\n for(j=1;j<=(m+1)*(n+1);j++)\n {\n scanf(\"%c\",&ch);\n if(ch=='W' || ch=='G' || ch=='B'|| ch==' ')\n bw=1;\n else\n col=1;\n }\n if(bw==1 && col==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,j,a,x,b,B[2],k=0;\n char A[101][101];\n for(x=0;x<2;x++)\n {\n scanf(\"%d\",&B[x]);\n }\n a=B[0];\n b=B[1];\n scanf(\"\\n\");\n for(i=0;i<a;i++)\n {\n\n for(j=0;j<b;j++)\n {\n scanf(\"%c\",&A[i][j]);\n if((A[i][j]=='M')||(A[i][j]=='Y')||(A[i][j]=='C'))\n {\n k++;\n\n }\n }\n\n }\n if(k==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n }\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n,m,i,j,p;\n scanf(\"%d %d\",&n,&m);\n char s[n][m];\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%s\",&s[i][j]);\n\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j+=2)\n {\n if(s[i][j]=='W' || s[i][j]=='B' || s[i][j]=='G'){\n p=1;\n }}}\n if(p==1){\n printf(\"#Black&White\\n\");\n\n\n }\n else{\n printf(\"#Color\\n\");\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint i,j,n,m,s;\nscanf(\"%d%d\",&n,&m);\nchar str[n][m][1];\nfor(i=0;i<n;i++)\n{\n for(j=0;j<m;j++)\n {\n scanf(\" %s\",&str[i][j]);\n }\n}\nfor(i=0;i<n;i++)\n{\n for(j=0;j<m;j++)\n {\n if(str[i][j]=='W' || str[i][j]=='B' || str[i][j]=='G') s++;\n }\n}\nif(s>0) printf(\"#Black&White\\n\");\nelse printf(\"#Color\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a;\n int i,j,n,m,k=0;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=(2*m);j++)\n {\n scanf(\"%c\",&a);\n if(a=='W'||a=='B'||a=='C')\n k++;\n }\n }\n i=m*n;\n if(i==k)\n printf(\"#Black&White\\n\");\n else printf(\"#Color\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,c=0,k=0,d,t=0;\n char a;\n scanf(\"%d%d\",&n,&m);\n d=n*m;\n while(d){\n scanf(\"%c\\n\",&a);\n if(a=='C'|| a=='M'|| a=='Y')\n c=c+1;\n else\n k=k+1;\n d--;\n t++;\n }\n if(c>=1){\n printf(\"#Color\");\n }\n else\n printf(\"#Black&White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,cnt=0,m;\n char ch;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n // ch=getch();\n scanf(\" %c\",&ch);\n if(ch=='C'||ch=='M'||ch=='Y'){\n cnt =1;\n }\n }\n }\n if(cnt==1){\n printf(\"#Color\\n\");\n }\n else{\n printf(\"#Black&cWhite\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n, m;\n scanf(\"%d %d\", &n, &m);\n int d = n * m, i;\n printf(\"%d\", d);\n for (i = 0; i <= d; i++)\n {\n char f;\n scanf(\"%c\", &f);\n if ((f == 'C') || (f == 'M') || (f == 'Y'))\n {\n printf(\"#Color\");\n return 0;\n }\n }\n printf(\"#Black&White\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,m,n,count=0,D=0;\n scanf(\"%d %d\",&m,&n);\n char A[m][n];\n for(i=0;i<m;i++)\n {\n for(j=0;j<n;j++)\n {\n scanf(\" %c\",&A[i][j]);\n }\n }\n for(i=0;i<m;i++)\n {\n for(j=0;j<n;j++)\n {\n if(A[i][j]=='W' || A[i][j]=='B' || A[i][j]=='G') count++;\n\n\n }\n }\n if(count>=1) printf(\"#Blacl&White\");\n else printf(\"#color\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a;\n int n,m,i,j,co=0;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n scanf(\"%\",&a);\n if(a=='C'||a=='M'||a=='Y')\n {\n co=1;\n }\n }\n //printf(\"%d %d\\n\",i,j);\n }\n if(co==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,m;\n\tchar a[1000][1000];\n\tint ok=0;\n\tint i,j;\n\twhile(~scanf(\"%d%d\",&n,&m))\n\t{\n\t\tif(m==0||n==0)\n\t{\n\t\tbreak;\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tscanf(\"%s\",a);\t\t\t\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<m;j++)\n\t\t{\n\t\t\tif(a[i][j]=='W'||a[i][j]=='B'||a[i][j]=='G')\n\t\t\tok=1;\n\t\t\telse if(a[i][j]=='C'||a[i][j]=='M'||a[i][j]=='Y')\n\t\t\tok=0;\n\t\t}\n\t}\n\tif(ok==1)\n\t{\n\t\tprintf(\"#Black&White\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"#Color\\n\");\n\t}\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,i,j;\n char s;\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\"%c\",&s);\n if(s!='W' || s!='B' || s!='G'){\n printf(\"#Color\");return 0;\n }\n }\n }\n printf(\"#Black&White\");\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,m;\n scanf(\"%d %d\",&n,&m);\n int i,j;\n char ara[100][100];\n\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n\n {\n scanf(\"%s\",&ara[i][j]);\n }\n }\n int c=0;\n for(i=0;i<n;i++)\n {\n for(j=0;j<n;j++)\n {\n if(ara[i][j]=='B' || ara[i][j]=='W' || ara[i][j]=='G')\n {\n c++;\n }\n }\n }\n if(c==n*m)\n {\n printf(\"#Black&White\\n\");\n }\n else\n printf(\"#Color\\n\");\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a;\n int i,j,n,m,k=0;\n scanf(\"%d %d\",&n,&m);\n for(i=1;i<=n;i++)\n {\n for(j=1;j<=(2*m);j++)\n {\n scanf(\"%c\",&a);\n if(a=='W'||a=='B'||a=='C')\n k++;\n }\n }\n i=m*n;\n if(i==k)\n printf(\"#Black&White\\n\");\n else printf(\"#Color\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/*\n * \n */\nint main(int argc, char** argv) {\n int k,p,n,m,i;\n char j[1];\n p=0;\n scanf(\"%d %d\",&n,&m);\n i=n*m;\n for(k=1;k<=i;k++){\n scanf(\"%s\",&j);\n if((j==\"C\")||(j==\"M\")||(j==\"Y\"))\n p=1;\n }\n if(p==1)\n printf(\"#color\");\n else\n printf(\"#Black&White\");\n return (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<string.h>\n\n//void swap(int *xp, int *yp) \n//{ \n// int temp = *xp; \n// *xp = *yp; \n// *yp = temp; \n//} \n// \n//// A function to implement bubble sort \n//void bubbleSort(int arr[], int n) \n//{ \n// int i, j; \n// for (i = 0; i < n-1; i++) \n// \n// // Last i elements are already in place \n// for (j = 0; j < n-i-1; j++) \n// if (arr[j] > arr[j+1]) \n// swap(&arr[j], &arr[j+1]); \n//}\n\nint main(){\n\tint m,n;\n\tscanf(\"%d %d\",&m,&n); fflush(stdin);\n\tchar c[m][n];\n\tint cek =0;\n\tfor(int i=0;i<m;i++){\n\t\tfor(int j=0;j<n;j++){\n\t\t\tscanf(\" %c\",&c[i][j]); \n\t\t}\n\t\t\n\t}\n\t\n\tfor(int i=0;i<m;i++){\n\t\tfor(int j=0;j<n;j++){\n\t\t\tif(c[i][j]=='B' || c[i][j]=='W') cek++;\n\t\t//\tprintf(\" %d\\n\",cek);\n\t\t}\n\t}\n\tif(cek==m*n) printf(\"#Black&White\");\n\telse if (cek<m*n)printf(\"#Color\");\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\n\nint main (){\n\tint n, m;\n\tscanf(\"%d %d\", &n, &m);\n\tint color = 0;\n\tchar c;\n\tfor (int i = 0; i<m ; i++)\n\t{\n\t\tfor (int j = 0; i<n ; i++)\n\t\t{\n\t\t\tscanf(\" %c\", &c);\n\t\t\tif (c == 'C' || c == 'M' || c == 'Y')\n\t\t\t{\n\t\t\t\tcolor = 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (color) printf(\"Color\");\n\telse printf(\"Black&White\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,m,cnt=0;\n char ara[10000][10000];\n scanf(\"%d %d\",&n,&m);\n for(i=0;i<=n;i++)\n {\n for(j=0;j<=m;j++)\n {\n scanf(\"%c\",&ara[i][j]);\n\n if(ara[i][j]=='W' || ara[i][j]=='B')\n {\n cnt=1;\n }\n }\n }\n if(cnt==1)\n printf(\"#Black&White\\n\");\n else\n\n printf(\"#Color\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,n,m,COUNT=0;\n scanf(\"%d %d\\n\",&n,&m);\n char a[n][m];\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n gets(a);\n }\n }\n for(i=0;i<n;i++)\n {\n for(j=0;j<m;j++)\n {\n if(a[i][j]==87 ||a[i][j]==66 || a[i][j]==71 && a[i][j]!=67 && a[i][j]!=121 && a[i][j]!=77)\n {\n COUNT++;\n }\n }\n\n }\n if(COUNT>=1)\n {\n printf(\"#Black&White\");\n }\n else{\n printf(\"#Color\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int n, m, i, j;\n char ch;\n int ok = 1;\n scanf(\"%d%d\", &n, &m);\n for(i=1; i<=n; i++)\n for(j=1; j<=m; j++){\n scanf(\"%c%*c\", &ch);\n if(ch!='B' || ch!='W' || ch!='G')\n ok = 0;\n }\n if(ok == 1)\n puts(\"#Black&White\");\n else\n puts(\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,m,i,j,is=0,yes=0;\n char str[100][100],str1[10],ch;\n scanf(\"%d%d\",&n,&m);\n if(n=1 && m==1){\n gets(str1);\n scanf(\"%c\",&ch);\n if(ch=='B' ||ch=='W' ||ch=='G' ){printf(\"#Black&White\");}\n if(ch=='C' ||ch=='M' ||ch=='Y' ){printf(\"#Color\");}\n return 0;\n\n }\n\n for(i=0;i<n;i++){\n for(j=0;j<m;j++){\n scanf(\"%c\",&str[i][j]);\n if(str[i][j]=='B' ||str[i][j]=='W' ||str[i][j]=='G' ){is=1;}\n if(str[i][j]=='C' ||str[i][j]=='M' ||str[i][j]=='Y' ){yes=1;}\n }\n gets(str1);\n }\n if(is==1)printf(\"#Black&White\");\n if(yes==1)printf(\"#Color\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\n#include <string.h>\nint main()\n{\n\tint n,m,i,j,c=0;\n\tchar a[10005];\n\tscanf(\"%d%d\",&n,&m);\n\tfor(i=1;i<=n*m;i++){\n\t\t\tscanf(\"%c\",&a[i]);\n\t\t\tif(a[i]=='M'||a[i]=='Y'||a[i]=='C'){\n\t\t\t\tc++;\n\t\t\t}\n\t}\n\tif(c==0){\n\t\tprintf(\"#Black&White\");\n\t}\n\telse{\n\t\tprintf(\"#Color\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n int n, m, i, j;\n char ch;\n int ok = 1;\n scanf(\"%d%d\", &n, &m);\n for(i=1; i<=n; i++)\n for(j=1; j<=m; j++){\n scanf(\"%c%*c\", &ch);\n if(ch!='B' || ch!='W' || ch!='G')\n ok = 0;\n }\n if(ok == 1)\n puts(\"#Black&White\");\n else\n puts(\"#Color\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k=0,n,m,j,i;\n\tchar a[100000];\n\tscanf(\"%d %d\",&n,&m);\n\tfor(i=0;i<n*m+2;i++)\n\t{\n\t\tscanf(\"%c\",&a[i]);\n\t}\n\tfor(j=0;j<n*m+2;j++){\n if(a[j]=='C'||a[j]=='M'||a[j]=='Y')\n k=1;\n\t}\n\n\tif(k==1){\n printf(\"#Color\");\n\t}\n\telse{\n printf(\"#Black&White\");\n\t}\n}\n"}, {"source_code": "# include<stdio.h>\n# include<string.h>\nint main()\n{\n int i, j, k, m, l=0;\n scanf(\"%d %d\", &i, &j);\n char s[i][j];\n for(k=1;k<=i;k++){\n for(m=1;m<=j;m++){\n scanf(\"%c\", &s[k][m]);\n if(s[k][m]=='C' || s[k][m]=='M' || s[k][m]=='Y'){\n l=1;\n break;\n }\n else l+=0;\n }\n }\n if(l==0)\n printf(\"#Black&White\");\n else\n printf(\"#Color\");\n\n return 0;\n\n}\n"}], "src_uid": "19c311c02380f9a73cd477e4fde27454"} {"nl": {"description": "Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.Let's consider the following algorithm of generating a sequence of integers. Initially we have a sequence consisting of a single element equal to 1. Then we perform (n\u2009-\u20091) steps. On each step we take the sequence we've got on the previous step, append it to the end of itself and insert in the middle the minimum positive integer we haven't used before. For example, we get the sequence [1,\u20092,\u20091] after the first step, the sequence [1,\u20092,\u20091,\u20093,\u20091,\u20092,\u20091] after the second step.The task is to find the value of the element with index k (the elements are numbered from 1) in the obtained sequence, i.\u00a0e. after (n\u2009-\u20091) steps.Please help Chloe to solve the problem!", "input_spec": "The only line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u200950, 1\u2009\u2264\u2009k\u2009\u2264\u20092n\u2009-\u20091).", "output_spec": "Print single integer\u00a0\u2014 the integer at the k-th position in the obtained sequence.", "sample_inputs": ["3 2", "4 8"], "sample_outputs": ["2", "4"], "notes": "NoteIn the first sample the obtained sequence is [1,\u20092,\u20091,\u20093,\u20091,\u20092,\u20091]. The number on the second position is 2.In the second sample the obtained sequence is [1,\u20092,\u20091,\u20093,\u20091,\u20092,\u20091,\u20094,\u20091,\u20092,\u20091,\u20093,\u20091,\u20092,\u20091]. The number on the eighth position is 4."}, "positive_code": [{"source_code": "#include <stdio.h>\n\n#define ll long long\n#define s(a) scanf(\"%lld\", &a);\n#define sd(a) ll a; s(a);\n#define rep(i, a, n) for(i = a; i < n; i++)\n#define pin(a) printf(\"%lld\\n\", a);\n\nint main(){\n\tsd(n); sd(k); ll i, ans = 1;\n\trep(i, 1, n){\n\t\tans = 2 * ans + 1;\n\t}\n\tll in = 1, fin = ans;\n\twhile(1){\n\t\tll mid = (fin + in) / 2;\n\t\tif (mid == k){ pin(n); break; }\n\t\tn--;\n\t\tif (k < mid) fin = mid - 1;\n\t\telse if (k > mid) in = mid + 1;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nlong long pot (long long a, long long b){\n\tlong long x = 1;\n\n\tfor (long i = 0; i < b; i++){\n\t\tx = x*a;\n\n\t}\n\n\treturn x;\n}\n\nint main (){\n\n\tlong long n;long long a;\n\n\tscanf (\"%lld\", &n);\n\tscanf (\"%lld\", &a);\n\n\tlong long k ;\n\tlong long l ;\n\tlong long x = 1;\n\n\n\tfor (long i = n; i >= 2; i--){\n\t\tk = a - pot(2, i-1);\n\t\tl = pot (2, i);\n\n\t\tif (k % l == 0){\n\t\t\tx = i;\n\t\t\tbreak;\n\t\t\t}\n\n\t}\n\n\tprintf(\"%lld\\n\",x );\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int solve(long long int l,long long int r,long long int k,long long int n)\n{\n\tlong long int m=l+(r-l)/2;\n\tif(k<m)\n\t{\n\t\tsolve(l,m-1,k,n-1);\n\t}\n\telse if(k>m)\n\t{\n\t\tsolve(m+1,r,k,n-1);\n\t}\n\telse\n\t return n;\n}\nmain()\n{\n\tlong long int n,k,i,size=1;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tfor(i=1;i<n;++i)\n\t{\n\t\tsize=size*2+1;\n\t} \nprintf(\"%I64d\",solve(1,size,k,n));\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#define MAX 1000\nunsigned long long s[MAX];\n\nint main(){\n unsigned long long int a, b;\n for(int i = 0; i <= 50; i++){\n s[i] = pow(2, i);\n }\n while(scanf(\"%llu%llu\", &a, &b) != EOF){\n for(int i = 1; i <= 50; i++){\n if(b == s[i]) {\n printf(\"%d\\n\", i + 1);\n break;\n }\n else if(b % s[i] == s[i - 1]) {\n printf(\"%d\\n\", i);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,p,x,f,ans,i;\n scanf(\"%lld %lld\",&n,&k);\n p=1;\n for(i=1;i<=n;i++)\n p*=2;\n p--;\n // printf(\"p=%lld\\n\",p);\n f=0;\n while(n>2)\n {\n if(k==p/2+1)\n {ans=n;\n f=1;\n break;}\n if(k>p/2+1)\n {\n x=k-(p/2+1);\n k=p/2+1-x;\n }\n p/=2;\n n--;\n } \n if(f==0)\n {\n if(k==1||k==3)\n ans=1;\n else\n ans=2;\n }\n printf(\"%lld\\n\",ans);\n // scanf(\"%lld\",&n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n;\n\tlong long res=1,k;\n\tdouble res1=1;\n\tscanf(\"%d%lld\",&n,&k);\n\tfor(int i=0;i<n-1;i++){\n\t\tres=res*2+1;\n\t}\n\tlong long i=1,j=res;\n\twhile(i<j){\n\t\tlong long mid=(i+j)/2;\n\t\tif(mid==k) break;\n\t\tif(mid<k){\n\t\t\ti=mid+1;\n\t\t}else{\n\t\t\tj=mid-1;\n\t\t}\n\t\tn--;\n\t}\n\tprintf(\"%d\\n\",n);\n\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tunsigned long long x = 0;\n\tunsigned long long i = 0;\n\tunsigned long long int n = 0;\n\tunsigned long long int ind = 0;\n\tunsigned long long int ans = 0;\n//\tprintf(\"%u\",sizeof(n));\n\tscanf(\"%llu %llu\", &n, &ind);\n\n\tfor (i = n; i >= 0; i--) {\n\t\tx =(unsigned long long) pow(2,i);\n\t\tif ( ind % x == 0LL)\n\t\t{\n\t\t\tans = i+1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprintf(\"%llu\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong n;\n\tlong long k;\n\tint i;\n\tscanf(\"%ld %lld\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tif(k%2==1){\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tk=k/2;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int n,m,v;\n long long k;\n while(scanf(\"%d\",&n)!=EOF)\n {\n m=1;\n v=0;\n scanf(\"%I64d\",&k);\n do\n {\n if(k%2)\n {printf(\"%d\\n\",m);v=1;}\n else\n {k=k/2;m=m+1;}\n }\n while(v==0); \n }\n return 0;\n}"}, {"source_code": "//#include<stdio.h>\n//#include<math.h>\n//int main()\n//{\n// double k;\n// int n;\n// scanf(\"%d %lf\",&n,&k);\n// double int_ceil,int_floor;\n// int_ceil=ceil(log(k)/log(2));\n//\n// int_floor=floor(log(k)/log(2));\n// printf(\"%lf %lf %lf\\n\",int_ceil,int_floor,k);\n// while(int_ceil>log(3)&&((int_ceil-int_floor)>0.000000001))\n//{\n//k-=pow(2,int_floor);\n//int_ceil=ceil(log(k)/log(2));\n//int_floor=floor(log(k)/log(2));\n//printf(\"%lf %lf %lf\\n\",int_ceil,int_floor,k);\n//}\n// if((int_ceil-int_floor)<0.00000001)\n//printf(\"%lf\",pow(2,int_floor-1));\n// else\n//printf(\"1\");\n//\n//}\n\n//#include<stdio.h>\n//#include<math.h>\n//int main()\n//{\n// double int_ceil,int_floor;\n// double k;\n// int n;\n// scanf(\"%d %lf\",&n,&k);\n// int_ceil=ceil(log(k)/log(2));\n// int_floor=floor(log(k)/log(2));\n// if((int)k%2==1)\n//{\n//printf(\"1\\n\");\n//return 0;\n//}\n// if(log(k)/log(2)==int_ceil)\n//{\n//printf(\"%d\\n\",(int)log(k)/log(2)+1);\n//return 0;\n//}\n// while(int_floor>1)\n//{\n//k-=pow(2,int_floor);\n//int_ceil=ceil(log(k)/log(2));\n//int_floor=floor(log(k)/log(2));\n//if(log(k)/log(2)==int_ceil)\n//{\n//printf(\"%d\\n\",(int)log(k)/log(2)+1);\n//return 0;\n//}\n//}\n// \n//\n//}\n#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long k;\n long long n;\n long long i=1;\n scanf(\"%lld %lld\",&n,&k);\n while(1)\n {\n if(k%2==1)\n {\n printf(\"%lld\\n\",i);\n return 0;\n }\n else\n {\n i++;\n k=k/2;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main() {\n\tint n,count=0;\n\tlong long int k;\n\tscanf(\"%d %lld\",&n,&k);\n\twhile(k%2==0){\n\t\tk= k/2;\n\t\tcount ++;\n\t}\n\tprintf(\"%d\\n\",(1+count) );\n\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint n,i;\n long long int m,r,k;\n\tscanf(\"%d%I64d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tm=k+pow(2,i-1);\n\t\tr=pow(2,i);\n\tif(m%r==0)\n\t{\n\t\tprintf(\"%d\",i);\n\t\treturn 0;\n\t}\n\n}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n,a,p;\n\tscanf(\"%lld %lld\",&n,&p);\n\tfor(n=0,a=1;(a&p)==0;n++,a<<=1);\n\tprintf(\"%lld\\n\",n+1);\n}"}, {"source_code": "#include <stdio.h>\n\nint n;\nlong long k;\n\nint main() {\n scanf(\"%d %I64d\", &n, &k);\n int ans = 1;\n while (k%2==0 && ++ans)\n k = k >> 1;\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,k;\n while(scanf(\"%llu %llu\",&n,&k)==2)\n {\n long long loop=1,m=1,left,right,mid,key,position;\n while(loop<n)\n {\n m=(m<<1)+1;\n ++loop;\n }\n if(k%2)printf(\"1\\n\");\n else\n {\n left=1;\n right=m;\n key=n;\n while(left<=right)\n {\n mid=(left+right)>>1;\n if(k<mid)right=mid-1;\n else if(k>mid)left=mid+1;\n else\n {\n printf(\"%llu\\n\",key);\n break;\n }\n --key;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,f=1;\n scanf(\"%lld%lld\",&n,&k);\n while(1)\n {\n if (k%2==0)\n {\n f++;\n k/=2;\n }\n else \n {\n printf(\"%lld\",f);\n break;\n \n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint i,n;\n\tlong long int k,ans;\n\tscanf(\"%d %lld\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tans=(long long int)pow(2,i);\n\t\tif(k%ans){\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n long long a,b;\n scanf(\"%I64d%I64d\",&a,&b);\n long long result=1;\n long long x=1;\n for(long long i=1;i<a;i++){\n x=x*2;\n }\n while(b!=x){\n if(b>(x)){\n b=b-x;\n if(b==0){\n\n }\n }\n x=(x-1)/2+1;\n }\n long long i=1;\n while(result!=x){\n result*=2;\n i++;\n }\n printf(\"%I64d\\n\",i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\n#define M 1000000007\n\nint main()\n{\n long long int n,k,j;\n scanf(\"%lld %lld\",&n,&k);\n j=0;\n if(k > pow(2,n-1))\n {\n k = k-pow(2,n-1);\n }\n while(k%2 == 0)\n {\n k=k/2;\n j++;\n }\n printf(\"%lld\\n\",j+1);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n;\n long long int k,l,i;\n scanf(\"%d %lli\",&n,&k);\n for(i=1;i<n;i++)\n {\n double ans=(double)k-(pow(2,i-1));\n ans=ans/(pow(2,i));\n long long int int_ans=(long long int)ans;\n if(ans==int_ans)\n {\n break;\n }\n\n }\n printf(\"%lli\",i);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n long long now = 1;\n long long ret = 1;\n while (1) {\n long long tmp = k - now;\n if (tmp % (now * 2LL) == 0) {\n printf(\"%I64d\\n\", ret);\n return 0;\n }\n now *= 2LL;\n ret += 1;\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n\n\nint main() {\n int num1;\n scanf(\"%d \",&num1);\n long long k;\n \n scanf(\"%lld\",&k);\n // printf(\"%lld\\n\",k);\n int count=1;\n while(k>0){\n if(k%2==1){\n break;\n }\n count++;\n // printf(\"%d\\n\",count);\n k=k/2;\n }\n printf(\"%d\\n\",count);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,k,m=1,i;\n scanf(\"%llu %llu\",&n,&k);\n for(i=0;i<n;i++)\n {\n m=m*2;\n if(k%m!=0)\n {\n printf(\"%llu\",i+1);\n break;\n }\n }\n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,i,j;\n\tlong long int ans=0,end;\n\t\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor (i=1; i<=50; i++)\n\t{\n\t\tif (k%2 ==0)\n\t\t{\n\t\t\tk = k/2;\n\t\t}\n\t\telse \n\t\t\tbreak;\n\t}\n\tprintf(\"%lld\",i);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int m,l=1,h=1,k,n,i;\n scanf(\"%llu %llu\",&n,&k);\n for(i=0;i<n;i++)\n h=h*2;\n while(1)\n {\n m=(l+h)/2;\n if(m==k)\n break;\n else if(m<k)\n l=m;\n else\n h=m;\n n--;\n }\n printf(\"%llu\",n);\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int n = 0;\n long long k = 0;\n\n scanf(\"%d %I64d\", &n, &k);\n if (k%2 !=0)\n {\n printf( \"1\");\n }\n else\n {\n long long a = pow(2,n);\n int z = n;\n long long a1 = a/4;\n long long a2 = 0;\n while (a!=k)\n { if (a>k)\n {\n a1 = a;\n a = a/2;\n\n if(a==k)\n {\n printf(\"%d\",z);\n }\n else\n {\n z--;\n\n }\n }\n else\n {\n k=a1-k;\n }\n\n }\n }\n\nreturn 0;\n }"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\n\nint main()\n{\n\tll n, k, ans = 1;\n\n\tscanf(\"%lld %lld\", &n, &k);\n\n\twhile(k % 2 == 0)\n\t{\n\t\tk /= 2;\n\t\tans++;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,c,count=0,count1=0,lb,num;\n\tscanf(\"%lld%lld\",&n,&k);\n\tc=k;\n\tif(k%2==1)\n\t\tprintf(\"1\\n\");\n\telse\n\t{\n\t\twhile(c!=1)\n\t\t{\n\t\t\tc=c/2;\n\t\t\tcount++;\n\t\t}\n\t\tlb=count+1;\n\t\t\n\n\t\tnum=k-pow(2,count);\n\n\t\tif(num==0)\n\t\t\tprintf(\"%lld\\n\",lb);\n\t\telse\n\t\t{\n\t\t\twhile(num%2!=1)\n\t\t\t{\n\t\t\t\tnum=num/2;\n\t\t\t\tcount1++;\n\t\t\t}\n\t\t\tprintf(\"%lld\\n\",(count1+1));\n\t\t}\n\t}\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint n;\n\tlong long res=1,k;\n\tdouble res1=1;\n\tscanf(\"%d%lld\",&n,&k);\n\tfor(int i=0;i<n-1;i++){\n\t\tres=res*2+1;\n\t}\n\tlong long i=1,j=res;\n\twhile(i<j){\n\t\tlong long mid=(i+j)/2;\n\t\tif(mid==k) break;\n\t\tif(mid<k){\n\t\t\ti=mid+1;\n\t\t}else{\n\t\t\tj=mid-1;\n\t\t}\n\t\tn--;\n\t}\n\tprintf(\"%d\\n\",n);\n\n}"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\n\nint main()\n{\n\tll n, k, ans = 1;\n\n\tscanf(\"%lld %lld\", &n, &k);\n\n\twhile(k % 2 == 0)\n\t{\n\t\tk /= 2;\n\t\tans++;\n\t}\n\tprintf(\"%lld\\n\", ans);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void)\n{\n\tint n;\n\tlong long k;\n\n\tscanf(\"%d %I64d\", &n, &k);\n\n\tlong long low = 1;\n\tlong long high = ((long long) pow(2, n)) - 1;\n\n\tint step = n;\n\twhile(low <= high)\n\t{\n\t\tlong long mid = (low + high)/2;\n\t\tif(mid == k)\n\t\t{\n\t\t\tprintf(\"%d\", step);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(mid > k)\n\t\t{\n\t\t\thigh = mid - 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlow = mid + 1;\n\t\t}\n\t\tstep--;\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint n;\nlong long k;\n\nint main() {\n scanf(\"%d %I64d\", &n, &k);\n int ans = 1;\n while (k%2==0 && ++ans)\n k = k >> 1;\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif((k%2)==1) printf(\"1\");\n\telse\n\t{\n\t\tint c=0;\n\t\twhile((k>0)&&((k%2)==0))\n\t\t{\n\t\t\t c++;\n\t\t\tk/=2;\n\t\t}\n\t\tprintf(\"%d\",c+1);\n\t}\n\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,k,sum;\n while(scanf(\"%lld%lld\",&n,&k)!=EOF)\n {\n while(n>0)\n {\n sum=pow(2,n-1);\n if(sum==k)\n {\n printf(\"%lld\\n\",n);\n break;\n }\n else\n {\n n-=1;\n if(k>sum)k%=sum;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint s[1100010];\nint main()\n{\n long long int a,b;\n int n;\n int i,j,k,m;\n while(~scanf(\"%lld%lld\",&a,&b))\n {\n\n a=a-1;\n s[0]=1;\n long long int t=b;\n int flag=1;\n i=0;\n j=0;\n s[1]=2;\n s[2]=1;\n for(i=0;i<50;i++)\n if((long long int)pow(2,i)<=b&&b<(long long int)pow(2,i+1))\n break;\n //printf(\"%d\\n\",i);\n while(t%((long long int)pow(2,i))!=0)\n {\n t -= (long long int)pow(2,i);\n for(;i>=0;i--)\n if((long long int)pow(2,i)<=t&&t<(long long int)pow(2,i+1))\n break;\n //printf(\"%d\\n\",t);\n }\n //printf(\"hello\\n\");\n printf(\"%d\\n\",i+1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n; long long k; scanf(\"%d %lld\", &n, &k);\n if(k % 2){ printf(\"1\\n\"); return 0; }\n int c = 1;\n while(k && k % 2 == 0){ c++; k/= 2; }\n printf(\"%d\\n\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n#define ll long long\n\nll recur(int n, ll k);\n\nint main(void)\n{\n int n;\n ll k;\n\n scanf(\"%d %I64d\", &n, &k);\n \n printf(\"%I64d\\n\", recur(n, k));\n \n return 0;\n}\n\nll recur(int n, ll k)\n{\n ll temp = pow(2, (double)n - 1);\n if (k == temp)\n return n;\n else if (k > temp)\n {\n k -= temp;\n }\n return recur(n - 1, k);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=0,c=0;\n\tchar s[60];\n\tlong long int j=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\twhile(s[i]!='\\0')\n\t\tj=j*10+(int)(s[i++])-48;\n\twhile(j>0)\n\t{\n\t\tif(j%2==0)\n\t\tc++;\n\t\telse\n\t\t\tbreak;\n\t\tj>>=1;\n\t}\n\tprintf(\"%d\\n\",c+1);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint find(int n, long long k, long long size) {\n\tif (k == (size + 1) / 2)\n\t\treturn n;\n\tif (k > (size + 1) / 2)\n\t\tk -= (size + 1) / 2;\n\treturn find(n - 1, k, size / 2);\n}\n\nint main() {\n\tlong long k, size;\n\tint n;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tsize = (1LL << n) - 1;\n\tprintf(\"%d\\n\", find(n, k, size));\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(k%2!=0){\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\tlong long c,l,i;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tc=k+pow(2,i-1);\n\t\tl=pow(2,i);\n\t\tif(c%l==0)\n\t\t{\n\t\t\tprintf(\"%lld\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,j,k,cnt=1;\n scanf(\"%lld %lld\",&n,&k);\n while(1){\n if(k%2==0){\n cnt++;\n k=k/2;\n }\n else{\n printf(\"%d\",cnt);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tlong long int n, k, twos = 0;\n\tscanf(\"%I64d %I64d\", &n, &k);\n\twhile ((k % 2) == 0) {\n\t\tk /= 2;\n\t\ttwos++;\n\t}\n\tprintf(\"%I64d\", twos + 1);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n unsigned long long n,k,m,s;\n scanf(\"%llu%llu\",&n,&k);\n\n m=pow(2,n-1);\n\n if(k%2!=0) printf(\"1\");\n else\n {\n s=m/2;\n while (m!=k)\n {\n if (k>m)\n m=m+s;\n else m=m-s;\n n--; s=s/2;\n }\n printf(\"%llu\",n);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n long long int n,m,number;\n scanf(\"%I64d%I64d\",&m,&n);\n if(n%2==1)\n {\n printf(\"1\\n\");\n return 0;\n }\n while(n!=0)\n {\n long long int res;\n double ans;\n ans = log10(n)/log10(2);\n number=ans;\n res=pow(2,number);\n long long int dif=n-res;\n n=dif;\n }\n printf(\"%I64d\",number+1);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tlong long int n,i,j,k,c=1;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\twhile(1)\n\t{\n\t\tif(k%2==0)\n\t\t{\n\t\t\tc++;\n\t\t\tk=k/2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%I64d\",c);return 0;\n\t\t}\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint f(int n, long long k)\n{\n long long x = (long long)(pow(2.0, (double)(n-1)));\n if(k==x)\n return n;\n else if(k<x)\n return f(n-1, k);\n else\n return f(n-1, k-x);\n}\n\nint main(void)\n{\n int n;\n long long k;\n scanf(\"%d %lld\", &n, &k);\n printf(\"%d\\n\", f(n, k));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n long long a,b;\n scanf(\"%I64d%I64d\",&a,&b);\n long long result=1;\n long long x=1;\n for(long long i=1;i<a;i++){\n x=x*2;\n }\n while(b!=x){\n if(b>(x)){\n b=b-x;\n if(b==0){\n\n }\n }\n x=(x-1)/2+1;\n }\n long long i=1;\n while(result!=x){\n result*=2;\n i++;\n }\n printf(\"%I64d\\n\",i);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void)\n{\n\tint n;\n\tlong long k;\n\n\tscanf(\"%d %I64d\", &n, &k);\n\n\tlong long low = 1;\n\tlong long high = ((long long) pow(2, n)) - 1;\n\n\tint step = n;\n\twhile(low <= high)\n\t{\n\t\tlong long mid = (low + high)/2;\n\t\tif(mid == k)\n\t\t{\n\t\t\tprintf(\"%d\", step);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(mid > k)\n\t\t{\n\t\t\thigh = mid - 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlow = mid + 1;\n\t\t}\n\t\tstep--;\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,k=0;\n\tscanf(\"%lld%lld\",&n,&n);\n\twhile((n>>k&1)==0)\n\t\tk++;\n\tprintf(\"%d\\n\",k+1);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long int Binary(long long int start,long long int end,long long int x,long long int n){\n if (start==end){\n return 1;\n }\n long long int mid = (start+end)/2;\n // printf(\"%lld\\n\",mid);\n if (mid==x){\n // printf(\"%lld\\n\",n);\n return n;\n }\n if (mid>x){\n return Binary(start,mid-1,x,n-1);\n }\n else{\n return Binary(mid+1,end,x,n-1);\n }\n}\nint main(){\n long long int n,k;\n scanf(\"%lld %lld\",&n,&k);\n long long int end = pow(2,n)-2;\n // long long int s = end/2;\n // printf(\"%lld\\n\",s);\n long long int ans=Binary(0,end,k-1,n);\n printf(\"%lld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,c=0;long long int k,i;\nscanf(\"%d%I64d\",&n,&k);\nfor(i=1;i<=k;i*=2)\n { if(k%i==0)\n { c++;continue;}\n else\n break;\n }\nprintf(\"%d\",c);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n long long n, t, ans=0;\n scanf(\"%lld %lld\",&n,&t);\n for(int i=1;i<=n;i++)\n \tif(t%2==0){\n \t\tt/=2;ans++;\n\t\t}\n\tprintf(\"%lld\",ans+1);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int i,n,k,j,flag,arr[100];\n\tscanf(\"%lld %lld\",&n,&k);\n\tif(k%2==1)\n\t\tprintf(\"1\\n\");\n\telse \n\t{\n\t\tarr[0]=0;\n\t\tarr[1]=1;\n\t\tfor(i=2;i<=n+1;i++)\n\t\t{\n\t\t\tarr[i]=arr[i-1]*2;\n\t\t}\n\t\tflag=0;\n\t\tj=0;\n\t\twhile(j<100)\n\t\t{\n\t\t\tfor(i=1;i<=n+1;i++)\n\t\t\t{\n\t\t//\t\tprintf(\"%lld %lld\\n\",k,arr[i]);\n\t\t\t\tif(arr[i]>k)\n\t\t\t\t{\n//\t\t\t\t\tprintf(\"%lld %lld\\n\",arr[i]-k,k-arr[i]);\n\t\t\t\t\tif(arr[i]-k<k-arr[i-1])\n\t\t\t\t\t\tk=arr[i]-k;\n\t\t\t\t\telse\n\t\t\t\t\t\tk=k-arr[i-1];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(k==arr[i])\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t\tprintf(\"%lld\\n\",i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t\tbreak;\n\t\t\tj++;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long n, k, sum = 1, i;\n scanf(\"%lld %lld\", &n, &k);\n for(i = 1; i < n; i++)\n sum = sum * 2 + 1;\n while(1)\n {\n if(k > (sum - 1) / 2 + 1)\n {\n k -= (sum - 1) / 2 + 1;\n sum = (sum - 1) / 2;\n }\n else if(k < (sum - 1) / 2 + 1)\n {\n sum = (sum - 1) / 2;\n }\n else\n break;\n n--;\n }\n printf(\"%lld\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nunsigned long long power_of_two(unsigned long long position) {\n unsigned long long temp_position = position;\n unsigned long long count = 0;\n\n while (temp_position > 1) {\n count++;\n temp_position /= 2;\n }\n\n if (pow(2, count) == position) {\n return count + 1;\n }\n\n return power_of_two(position - pow(2, count));\n}\n\nint main() {\n unsigned long long number;\n unsigned long long position;\n\n scanf(\"%llu\", &number);\n scanf(\"%llu\", &position);\n\n printf(\"%llu\\n\", power_of_two(position));\n\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nunsigned long long power_of_two(unsigned long long position) {\n unsigned long long temp_position = position;\n unsigned long long count = 0;\n\n while (temp_position > 1) {\n count++;\n temp_position /= 2;\n }\n\n if (pow(2, count) == position) {\n return count + 1;\n }\n\n return power_of_two(position - pow(2, count));\n}\n\nint main() {\n unsigned long long number;\n unsigned long long position;\n\n scanf(\"%llu\", &number);\n scanf(\"%llu\", &position);\n\n printf(\"%llu\\n\", power_of_two(position));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k,multiple=1,i;\n\tscanf(\"%lld %lld\",&n,&k);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tmultiple=multiple*2;\n\t\tif(k%multiple!=0)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",(i+1));\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "long long k;main(){scanf(\"%d%lld\",&k,&k);printf(\"%d\\n\",1+__builtin_ctzll(k));}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nvoid r(int n,long long int k)\n{\n\t\n\tint i;\n\tlong long int j,c=0,l;\n\tif(k==1)\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\t{\n\t\tfor(i=1;i<n;i++)\n\t\t{\n\t\t\tc=pow(2,i+1)-1;\n\t\t\tif(k<c)\n\t\t\t{\n\t\t\t\tj=k-pow(2,i);\n\t\t\t\tif(j>0)\n\t\t\t\tj=k-(2*j);\n\t\t\t\t//l=po/w(2,i+1)+1;\n\t\t\t\tif(j==0)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t\t\texit(0);\n\t\t\t\t}\n\t\t\t\telse if(j==1)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"1\");\n\t\t\t\t\texit(0);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//printf(\"dscdsh\\n\");\n\t\t\t\t\tr(i,j);\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(k==c)\n\t\t\t{\n\t\t\t\t//k=1;\n\t\t\t\tprintf(\"1\");\n\t\t\t\texit(0);\n\t\t\t}\n\t\t}\n\t}\n}\nint main()\n{\n\tint n,i;\n\tlong long int k,j,c=0,l;\n\tscanf(\"%d%I64d\",&n,&k);\n\tif(k%2!=0)\n\t{\n\t\tprintf(\"1\");\n\t}\n\telse\n\tr(n,k);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, cnt;\n\tlong long k;\n\n\tscanf(\"%d%lld\", &n, &k);\n\tcnt = 0;\n\twhile (k % 2 == 0)\n\t\tk /= 2, cnt++;\n\tprintf(\"%d\\n\", cnt + 1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k,j,q,t,r,s,w;\n\tscanf(\"%lld %lld\",&n,&k);\n\tlong long int i=1;\n\twhile(i<=52)\n\t{\n\t\tif(k%2==1)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ti++;\n\t\t\tk=k/2;\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n long long int n,k,p,sum;\n scanf(\"%lld%lld\",&n,&k);\n if(k%2==1){\n printf(\"1\");\n }\n else{\n p=pow(2.0,n)-1;\n // printf(\"%d\\n\",p);\n if(k%4==2){\n printf(\"2\");\n }\n else{\n sum=n;\n p=(p+1)/2;\n while(k!=p){\n sum--;\n \n if(k>p){\n k=k-p;\n }\n p=(p+1)/2;\n }\n printf(\"%lld\",sum);\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n long long n, k;\n scanf(\"%I64d %I64d\", &n, &k);\n long long now = 1;\n long long ret = 1;\n while (1) {\n long long tmp = k - now;\n if (tmp % (now * 2LL) == 0) {\n printf(\"%I64d\\n\", ret);\n return 0;\n }\n now *= 2LL;\n ret += 1;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\nlong long\tint l,n,x;\n\tscanf (\"%I64d %I64d\",&l,&x);\n\t\n\tfor (n=l;n>=1;n--) {\n\t\t\tif (x==(pow(2,n-1))){\n\t\t\tprintf(\"%I64d\",n);\n\t\t}\n\t\tif(x> (pow(2,n-1))){\n\t\t\tx-=pow(2,n-1);\n\t\t}\n\t\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,s;\n long long int k,l,i;\n scanf(\"%d \",&n);\n scanf(\"%I64d\",&k);\n if(k%2!=0) {\n printf(\"1\");\n return 0;\n }\n l=pow(2,n);\n s=n;\n for(i=l/2;i>=2;i/=2) {\n if(k%i==0) {\n printf(\"%d\",s);\n return 0;\n }\n else s--;\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main()\n{\n long long a,b;\n scanf(\"%I64d%I64d\",&a,&b);\n long long result=1;\n long long x=1;\n for(long long i=1;i<a;i++){\n x=x*2;\n }\n while(b!=x){\n if(b>(x)){\n b=b-x;\n if(b==0){\n\n }\n }\n x=(x-1)/2+1;\n }\n long long i=1;\n while(result!=x){\n result*=2;\n i++;\n }\n printf(\"%I64d\\n\",i);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int n = 0;\n long long k = 0;\n\n scanf(\"%d %I64d\", &n, &k);\n if (k%2 !=0)\n {\n printf( \"1\");\n }\n else\n {\n long long a = pow(2,n);\n int z = n;\n long long a1 = a/4;\n long long a2 = 0;\n while (a!=k)\n { if (a>k)\n {\n a1 = a;\n a = a/2;\n\n if(a==k)\n {\n printf(\"%d\",z);\n }\n else\n {\n z--;\n\n }\n }\n else\n {\n k=a1-k;\n }\n\n }\n }\n\nreturn 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,s;\n long long int k,l,i;\n scanf(\"%d \",&n);\n scanf(\"%I64d\",&k);\n if(k%2!=0) {\n printf(\"1\");\n return 0;\n }\n l=pow(2,n);\n s=n;\n for(i=l/2;i>=2;i/=2) {\n if(k%i==0) {\n printf(\"%d\",s);\n return 0;\n }\n else s--;\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,k,s;\n scanf(\"%I64d %I64d\",&n,&k);\n if(k%2==1)\n printf(\"1\");\n if(k%4==2)\n printf(\"2\");\n if(k%8==4)\n printf(\"3\");\n if(k%16==8)\n printf(\"4\");\n if(k%32==16)\n printf(\"5\");\n if(k%64==32)\n printf(\"6\");\n if(k%128==64)\n printf(\"7\");\n if(k%256==128)\n printf(\"8\");\n if(k%512==256)\n printf(\"9\");\n if(k%1024==512)\n printf(\"10\");\n if(k%2048==1024)\n printf(\"11\");\n if(k%4096==2048)\n printf(\"12\");\n if(k%8192==4096)\n printf(\"13\");\n if(k%16384==8192)\n printf(\"14\");\n if(k%32768==16384)\n printf(\"15\");\n if(k%65536==32768)\n printf(\"16\");\n if(k%131072==65536)\n printf(\"17\");\n if(k%262144==131072)\n printf(\"18\");\n if(k%524288==262144)\n printf(\"19\");\n if(k%1048576==524288)\n printf(\"20\");\n if(k%2097152==1048576)\n printf(\"21\");\n if(k%41944304==2097152)\n printf(\"22\");\n if(k%8388608==41944304)\n printf(\"23\");\n if(k%16777216==8388608)\n printf(\"24\");\n if(k%33554432==16777216)\n printf(\"25\");\n if(k%67108864==33554432)\n printf(\"26\");\n if(k%134217728==67108864)\n printf(\"27\");\n if(k%268435456==134217728)\n printf(\"28\");\n if(k%536870912==2684435456)\n printf(\"29\");\n if(k%(536870912*2)==536870912)\n printf(\"30\");\n if(k%(536870912*2*2)==(536870912*2))\n printf(\"31\");\n s=llround(pow(2,32));\n if(k%s==(536870912*2*2))\n printf(\"32\");\n s=llround(pow(2,33));\n if(k%s==(s/2))\n printf(\"33\");\n s=llround(pow(2,34));\n if(k%s==(s/2))\n printf(\"34\");\n s=llround(pow(2,35));\n if(k%s==(s/2))\n printf(\"35\");\n s=llround(pow(2,36));\n if(k%s==(s/2))\n printf(\"36\");\n s=llround(pow(2,37));\n if(k%s==(s/2))\n printf(\"37\");\n s=llround(pow(2,38));\n if(k%s==(s/2))\n printf(\"38\");\n s=llround(pow(2,39));\n if(k%s==(s/2))\n printf(\"39\");\n s=llround(pow(2,40));\n if(k%s==(s/2))\n printf(\"40\");\n s=llround(pow(2,41));\n if(k%s==(s/2))\n printf(\"41\");\n s=llround(pow(2,42));\n if(k%s==(s/2))\n printf(\"42\");\n s=llround(pow(2,43));\n if(k%s==(s/2))\n printf(\"43\");\n s=llround(pow(2,44));\n if(k%s==(s/2))\n printf(\"44\");\n s=llround(pow(2,45));\n if(k%s==(s/2))\n printf(\"45\");\n s=llround(pow(2,46));\n if(k%s==(s/2))\n printf(\"46\");\n s=llround(pow(2,47));\n if(k%s==(s/2))\n printf(\"47\");\n s=llround(pow(2,48));\n if(k%s==(s/2))\n printf(\"48\");\n s=llround(pow(2,49));\n if(k%s==(s/2))\n printf(\"49\");\n s=llround(pow(2,50));\n if(k%s==(s/2))\n printf(\"50\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long pick(long long len,long long pos,long long now)\n{\n if((len+1)/2 == pos){\n return now;\n }else if(pos < pow(2,now-1)){\n return pick(pow(2,now-1)-1,pos,now-1);\n }else if(pos > pow(2,now-1)){\n return pick(pow(2,now-1)-1,pos-pow(2,now-1),now-1);\n }else{\n return now-1;\n }\n}\nint main()\n{\n long long n,k,len;\n scanf(\"%lld%lld\",&n,&k);\n len = pow(2,n)-1;\n printf(\"%d\\n\",pick(len,k,n));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nlong long int check(long long int k)\n{\n if(k==1)\n return 1;\n long long i,x=1;\n for(i=1;i<=52;i++)\n {\n x*=2;\n if(x>=k)\n break;\n }\n if(x==k)\n return i+1;\n x/=2;\n return check(2*x-k);\n}\n\nint main()\n{\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n printf(\"%lld\\n\",check(k));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n unsigned long long n,k,m,s;\n scanf(\"%llu%llu\",&n,&k);\n\n m=pow(2,n-1);\n\n if(k%2!=0) printf(\"1\");\n else\n {\n s=m/2;\n while (m!=k)\n {\n if (k>m)\n m=m+s;\n else m=m-s;\n n--; s=s/2;\n }\n printf(\"%llu\",n);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,k,s;\n scanf(\"%I64d %I64d\",&n,&k);\n if(k%2==1)\n printf(\"1\");\n if(k%4==2)\n printf(\"2\");\n if(k%8==4)\n printf(\"3\");\n if(k%16==8)\n printf(\"4\");\n if(k%32==16)\n printf(\"5\");\n if(k%64==32)\n printf(\"6\");\n if(k%128==64)\n printf(\"7\");\n if(k%256==128)\n printf(\"8\");\n if(k%512==256)\n printf(\"9\");\n if(k%1024==512)\n printf(\"10\");\n if(k%2048==1024)\n printf(\"11\");\n if(k%4096==2048)\n printf(\"12\");\n if(k%8192==4096)\n printf(\"13\");\n if(k%16384==8192)\n printf(\"14\");\n if(k%32768==16384)\n printf(\"15\");\n if(k%65536==32768)\n printf(\"16\");\n if(k%131072==65536)\n printf(\"17\");\n if(k%262144==131072)\n printf(\"18\");\n if(k%524288==262144)\n printf(\"19\");\n if(k%1048576==524288)\n printf(\"20\");\n if(k%2097152==1048576)\n printf(\"21\");\n if(k%41944304==2097152)\n printf(\"22\");\n if(k%8388608==41944304)\n printf(\"23\");\n if(k%16777216==8388608)\n printf(\"24\");\n if(k%33554432==16777216)\n printf(\"25\");\n if(k%67108864==33554432)\n printf(\"26\");\n if(k%134217728==67108864)\n printf(\"27\");\n if(k%268435456==134217728)\n printf(\"28\");\n if(k%536870912==2684435456)\n printf(\"29\");\n if(k%(536870912*2)==536870912)\n printf(\"30\");\n if(k%(536870912*2*2)==(536870912*2))\n printf(\"31\");\n s=llround(pow(2,32));\n if(k%s==(536870912*2*2))\n printf(\"32\");\n s=llround(pow(2,33));\n if(k%s==(s/2))\n printf(\"33\");\n s=llround(pow(2,34));\n if(k%s==(s/2))\n printf(\"34\");\n s=llround(pow(2,35));\n if(k%s==(s/2))\n printf(\"35\");\n s=llround(pow(2,36));\n if(k%s==(s/2))\n printf(\"36\");\n s=llround(pow(2,37));\n if(k%s==(s/2))\n printf(\"37\");\n s=llround(pow(2,38));\n if(k%s==(s/2))\n printf(\"38\");\n s=llround(pow(2,39));\n if(k%s==(s/2))\n printf(\"39\");\n s=llround(pow(2,40));\n if(k%s==(s/2))\n printf(\"40\");\n s=llround(pow(2,41));\n if(k%s==(s/2))\n printf(\"41\");\n s=llround(pow(2,42));\n if(k%s==(s/2))\n printf(\"42\");\n s=llround(pow(2,43));\n if(k%s==(s/2))\n printf(\"43\");\n s=llround(pow(2,44));\n if(k%s==(s/2))\n printf(\"44\");\n s=llround(pow(2,45));\n if(k%s==(s/2))\n printf(\"45\");\n s=llround(pow(2,46));\n if(k%s==(s/2))\n printf(\"46\");\n s=llround(pow(2,47));\n if(k%s==(s/2))\n printf(\"47\");\n s=llround(pow(2,48));\n if(k%s==(s/2))\n printf(\"48\");\n s=llround(pow(2,49));\n if(k%s==(s/2))\n printf(\"49\");\n s=llround(pow(2,50));\n if(k%s==(s/2))\n printf(\"50\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n__int64 pow(__int64 a)\n{\t__int64 x=1;\n\tfor(int i=1;i<=a;i++)\n\t\tx*=2;\n\treturn x;\n}\nint main()\n{\n\t__int64 n,k,a,i,b;\n\tscanf(\"%I64d%I64d\",&n,&k);\n\tif(k%2==1)\n\t\tprintf(\"1\\n\");\n\telse\n\t\t{\t\n\t\t\ta=k;\n\t\t\twhile((a&(a-1))!=0)\n\t\t\t{\tb=a; i=-1;\n\t\t\t\twhile(b)\n\t\t\t\t{\ti++;\n\t\t\t\t\tb/=2;\n\t\t\t\t}\n\t\t\t\ta=2*pow(i)-a;\n\t\t\t}\n\t\t\ti=-1;\n\t\t\twhile(a)\n\t\t\t{\n\t\t\t\ti++;\n\t\t\t\ta/=2;\n\t\t\t}\n\t\t\tprintf(\"%I64d\\n\",i+1);\n\t\t}\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tint i,ans=1;\n\tfor(i=0;i<60;i++)\n\t{\n\t\tif(k%2==0)\n\t\t{\n\t\t\tans++;\n\t\t\tk=k/2;\n\t\t}\n\t\telse\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n\n\n\t\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,p,x,f,ans,i;\n scanf(\"%lld %lld\",&n,&k);\n p=1;\n for(i=1;i<=n;i++)\n p*=2;\n p--;\n // printf(\"p=%lld\\n\",p);\n f=0;\n while(n>2)\n {\n if(k==p/2+1)\n {ans=n;\n f=1;\n break;}\n if(k>p/2+1)\n {\n x=k-(p/2+1);\n k=p/2+1-x;\n }\n p/=2;\n n--;\n } \n if(f==0)\n {\n if(k==1||k==3)\n ans=1;\n else\n ans=2;\n }\n printf(\"%lld\\n\",ans);\n // scanf(\"%lld\",&n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint solve(int n, long long k);\n\nint main(void)\n{\n int n;\n long long k;\n\n scanf(\"%d %lld\", &n, &k);\n k--;\n printf(\"%d\\n\", solve(n, k));\n\n return 0;\n}\n\nint solve(int n, long long k)\n{\n long long tmp;\n tmp = ((long long)1 << (n-1))-1;\n if (k == tmp)\n return n;\n if (tmp < k)\n return solve(n-1, k-tmp-1);\n return solve(n-1, k);\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main(void)\n{\n\tint n;\n\tlong long k;\n\n\tscanf(\"%d %I64d\", &n, &k);\n\n\tlong long low = 1;\n\tlong long high = ((long long) pow(2, n)) - 1;\n\n\tint step = n;\n\twhile(low <= high)\n\t{\n\t\tlong long mid = (low + high)/2;\n\t\tif(mid == k)\n\t\t{\n\t\t\tprintf(\"%d\", step);\n\t\t\treturn 0;\n\t\t}\n\t\telse if(mid > k)\n\t\t{\n\t\t\thigh = mid - 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlow = mid + 1;\n\t\t}\n\t\tstep--;\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main() {\n\tint n;\n long long k, mid;\n\tscanf(\"%d %I64d\", &n, &k);\n\tif (k % 2 == 1) { printf(\"1\"); return 0; }\n\tmid = (long long)pow(2, (int)n - 1);\n\twhile (k != mid ) {\n\t\tif (k > mid) k -= mid;\n\t\tn--;\n\t\tmid = (long long)pow(2, n - 1);\n\t}\n\tprintf(\"%d\", n);\n\treturn 0;\n}\n"}, {"source_code": "/**\n * Created By: Anonyman637\n * Created On: 2/26/2020 8:17:43 AM\n */\n\n/* =============================================================================\n ================================== HEADERS ==================================\n ========================================================================== */\n#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\ntypedef char i8;\ntypedef short i16;\ntypedef int i32;\ntypedef long long i64;\n\ntypedef unsigned char ui8;\ntypedef unsigned short ui16;\ntypedef unsigned int ui32;\ntypedef unsigned long long ui64;\n\n/* =============================================================================\n ================================== MACROS ===================================\n ========================================================================== */\n\n#define DEBUG 1\n\n#if DEBUG\n#define debug(format, ...) printf(format, __VA_ARGS__)\n#else\n#define debug(format, ...) \n#endif\n\n/* =============================================================================\n ================================== GLOBALS ==================================\n ========================================================================== */\n\n\n/* =============================================================================\n ================================= FUNCTIONS =================================\n ========================================================================== */\n\n\nint main() {\n\t\n\ti64 i, t;\n\n\ti64 n, k;\n\tscanf(\"%lld %lld\", &n, &k);\n\ti64 laggingZeros = 0;\n\twhile (!((k >> laggingZeros) & 1)) {\n\t\tlaggingZeros++;\n\t}\n\tprintf(\"%lld\", laggingZeros + 1);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n int n;\n long long int k;\n scanf(\"%d %I64d\", &n, &k);\n if ((n == 1) || (k == 1) || (k % 2)) printf(\"%d\\n\", 1);\n else {\n long long int powa = pow(2, n - 1);\n if (k == powa) printf(\"%d\\n\", n);\n else {\n while (k != powa){\n if (k > powa) k -= powa;\n n--;\n powa = pow(2, n - 1);\n }\n printf(\"%d\\n\", n);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint main()\n{ \n ll power[50];\n for(int i=0;i<50;i++)\n {\n ll p=1;\n for(int j=0;j<=i;j++)\n p*=2;\n power[i]=p;\n }\n \n //for(int i=0;i<50;i++)\n // printf(\"%lld \",power[i]);\n int n;\n ll k;\n scanf(\"%d%lld\",&n,&k);\n if(k%2!=0)\n printf(\"1\");\n else\n {\n for(int i=0;i<50;i++)\n {\n if((k/power[i])%2!=0)\n {\n printf(\"%d\",i+2);\n break;\n }\n }\n }\n return 0;\n}"}, {"source_code": "/* Codeforces Round #384 (Div. 2), problem B, by Abreto. */\n#include <stdio.h>\n\ntypedef long long int ll;\n\nlong long int fstpow2(int n)\n{\n if( 0 == n )\n return 1;\n else if ( 1 == n )\n return 2;\n else if ( 2 == n )\n return 4;\n else\n {\n long long int t = fstpow2(n/2);\n long long int r = ( n % 2 ) + 1;\n return t * t * r;\n }\n}\n\nint find(int n, long long int k)\n{\n if( 1 == n )\n return 1;\n else\n {\n ll mid = fstpow2(n-1);\n if( k == mid )\n return n;\n else if ( k < mid )\n return find(n-1, k);\n else\n return find(n-1, k-mid);\n }\n}\n\nint main(void)\n{\n int n = 0;\n long long int k = 0;\n\n scanf(\"%d %I64d\", &n, &k);\n printf(\"%d\\n\", find(n,k));\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k,i;\n\tscanf(\"%lld%lld\",&n,&k);\n\tlong long int temp=2,num=k,count=0;\n\tint val=0;\n\twhile(k>0)\n\t{\n\t\t\n\t\tcount=0;\n\t\tnum=k;\n\t\twhile(num>0)\n\t\t{\n\t\t\tnum=num/2;\n\t\t\tcount++;\n\t\t}\n\t\tcount--;\n\t\tif(k==pow(2,count))\n\t\t{\n\t\t\tval=1;\n\t\t\tprintf(\"%lld\",count+1);\n\t\t\tbreak;\n\t\t}\n\t\tk=k-pow(2,count);\n\t\t\t\n\t}\n\tif(val==0)\n\t\tprintf(\"1\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,p,x,f,ans,i;\n scanf(\"%lld %lld\",&n,&k);\n p=1;\n for(i=1;i<=n;i++)\n p*=2;\n p--;\n // printf(\"p=%lld\\n\",p);\n f=0;\n while(n>2)\n {\n if(k==p/2+1)\n {ans=n;\n f=1;\n break;}\n if(k>p/2+1)\n {\n x=k-(p/2+1);\n k=p/2+1-x;\n }\n p/=2;\n n--;\n } \n if(f==0)\n {\n if(k==1||k==3)\n ans=1;\n else\n ans=2;\n }\n printf(\"%lld\\n\",ans);\n // scanf(\"%lld\",&n);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long LL;\nLL n,k,p[60];\nint solve(int m,LL x);\n\nint main(void)\n{\n scanf(\"%I64d%I64d\",&n,&k);\n int i;\n for(p[0]=1,i=1;i<=n;i++)\n p[i]=p[i-1]*2;\n printf(\"%d\\n\",solve(n,k));\n return 0;\n}\n\nint solve(int m,LL x)\n{\n if(m==1) return 1;\n else if(x==p[m]/2) return m;\n else if(x>p[m]/2) return solve(m-1,x-p[m]/2);\n else return solve(m-1,x);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nvoid f(long long t,long long n,long long k)\n{\n if(n==1)printf(\"1\\n\");\n else{\n if(k==t/2+1)printf(\"%I64d\\n\",n);\n else if(k<t/2+1) f(t/2,n-1,k);\n else if(k>t/2+1) f(t/2,n-1,t+1-k);\n }\n}\nint main()\n{\n long long n,k,t;\n scanf(\"%I64d%I64d\",&n,&k);\n t=pow(2,n)-1;\n f(t,n,k);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n; long long k;\n scanf(\"%d %lld\", &n, &k);\n int i;\n for(i = 1; i <= n; i++)\n {\n long long a = (long long)1<<(i - 1);\n long long b = (long long)1<<i;\n if( ((k - a)/(double)b) == ((k - a)/b) )\n printf(\"%d\\n\", i);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n;\n long long int k,l,i;\n scanf(\"%d %lli\",&n,&k);\n for(i=1;i<n;i++)\n {\n double ans=(double)k-(pow(2,i-1));\n ans=ans/(pow(2,i));\n long long int int_ans=(long long int)ans;\n if(ans==int_ans)\n {\n break;\n }\n\n }\n printf(\"%lli\",i);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll long long int \nll x;\n\nll bi(ll i){\n ll d=2,rem=1;\n while(i!=0){\n if(i%2==1)\n rem*=d;\n d*=d;\n i/=2;\n }\n return rem; \n}\n\nll fun(ll k){\n ll a=0,i=0,b=k;\n for(i=0;b!=0;i++){\n if(b%2==1)\n a++;\n b/=2;\n }\n if(a==1){\n x=i;return 0;\n }\n else return fun(bi(i)-k);\n}\n\n int main(){\n ll n,k,t=1;\n scanf(\"%lld%lld\",&n,&k);\n while(t){\n t=fun(k);\n }\n printf(\"%lld\\n\",x);\n return 0;\n }\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nunsigned long long power_of_two(unsigned long long position) {\n unsigned long long temp_position = position;\n unsigned long long count = 0;\n\n while (temp_position > 1) {\n count++;\n temp_position /= 2;\n }\n\n if (pow(2, count) == position) {\n return count + 1;\n }\n\n return power_of_two(position - pow(2, count));\n}\n\nint main() {\n unsigned long long number;\n unsigned long long position;\n\n scanf(\"%llu\", &number);\n scanf(\"%llu\", &position);\n\n printf(\"%llu\\n\", power_of_two(position));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long n,k,i;\n\tscanf(\"%I64d %I64d\",&n,&k);\n\tlong long len=1;\n\tfor(i=0;i<n;i++)len*=2;len=len-1;\n\tlong long lo=0,hi=len,index;\n\twhile(lo<hi)\n\t{\n\t\tif((hi+lo)%2==0)\n\t\t{\n\t\t\tindex = (lo+hi)/2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tindex = lo+(hi-lo)/2+1;\n\t\t}\n\t\tif(index==k)break;\n\t\tif(index<k)\n\t\t{\n\t\t\tlo=index;\n\t\t}\n\t\telse\n\t\t{\n\t\t\thi=index;\n\t\t}\n\t\tn--;\n\t}\n\tprintf(\"%I64d\",n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,f=1;\n scanf(\"%lld%lld\",&n,&k);\n while(1)\n {\n if (k%2==0)\n {\n f++;\n k/=2;\n }\n else \n {\n printf(\"%lld\",f);\n break;\n \n }\n }\n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nunsigned long long power_of_two(unsigned long long position) {\n unsigned long long temp_position = position;\n unsigned long long count = 0;\n\n while (temp_position > 1) {\n count++;\n temp_position /= 2;\n }\n\n if (pow(2, count) == position) {\n return count + 1;\n }\n\n return power_of_two(position - pow(2, count));\n}\n\nint main() {\n unsigned long long number;\n unsigned long long position;\n\n scanf(\"%llu\", &number);\n scanf(\"%llu\", &position);\n\n printf(\"%llu\\n\", power_of_two(position));\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,k,c=1;\nscanf(\"%lld%lld\",&n,&k);\nif(k%2==1)\nprintf(\"1\");\nelse\n{\nc=1;\nwhile(k!=0 && k%2==0)\n{\nc++;\nk=k/2;\n}\n\nprintf(\"%lld\",c);\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int n,m,v;\n long long k;\n while(scanf(\"%d\",&n)!=EOF)\n {\n m=1;\n v=0;\n scanf(\"%I64d\",&k);\n do\n {\n if(k%2)\n {printf(\"%d\\n\",m);v=1;}\n else\n {k=k/2;m=m+1;}\n }\n while(v==0); \n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i=0,c=0;\n\tchar s[60];\n\tlong long int j=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\twhile(s[i]!='\\0')\n\t\tj=j*10+(int)(s[i++])-48;\n\twhile(j>0)\n\t{\n\t\tif(j%2==0)\n\t\tc++;\n\t\telse\n\t\t\tbreak;\n\t\tj>>=1;\n\t}\n\tprintf(\"%d\\n\",c+1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,ans;\n\tlong long int k,i,j,num,den;\n\tscanf(\"%lld%lld\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t//\tprintf(\"\\ni is %lld\\n\",i);\n\t\tnum= k+pow(2,i-1);\n\t//\tprintf(\"num is %lld\\n\",num);\n\t\tden= pow(2,i);\n\t//\tprintf(\"den is %lld\\n\",den);\n\t\tans=num%den;\n\t\tif(ans==0)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define ll long long\n#define s(a) scanf(\"%lld\", &a);\n#define sd(a) ll a; s(a);\n#define rep(i, a, n) for(i = a; i < n; i++)\n#define pin(a) printf(\"%lld\\n\", a);\n\nint main(){\n\tsd(n); sd(k); ll i, ans = 1;\n\trep(i, 1, n){\n\t\tans = 2 * ans + 1;\n\t}\n\tll in = 1, fin = ans;\n\twhile(1){\n\t\tll mid = (fin + in) / 2;\n\t\tif (mid == k){ pin(n); break; }\n\t\tn--;\n\t\tif (k < mid) fin = mid - 1;\n\t\telse if (k > mid) in = mid + 1;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(void) {\n long long unsigned int n, k;\n scanf(\"%I64u %I64u\", &n, &k);\n printf(\"%d\", 1 + __builtin_ctzll(k));\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#define ll long long\n//#include<math.h>\n\nll power(int a,int b){\n if(!b) return 1;\n if(b % 2) return a * (power(a * a,(b - 1)/2));\n return power(a * a, b/2);\n}\n\n/*int ispow(ll n){\n int i = 1;\n while(power(2,i) <= n) i++;\n --i; if(n % power(2,i)) return 0; else return i;\n }\n*/\nint main(){\n int n, x; ll k; scanf(\"%d %lld\", &n, &k);\n if(k % 2){printf(\"1\\n\"); return 0; }\n int ans;\n// ans = ispow(k); if(ans) printf(\"%d\\n\", ans + 1);\n //else{\n int flag = 1;\n for(x = 2; x <= n && flag; x++){\n ll p = power(2,x - 1), m = power(2,x); ll s = p;\n while(s <= k && flag){\n s += m; if(s == k){ ans = x; flag = 0;}\n }\n }\n printf(\"%d\\n\", ans);\n //}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint find(int n, int k, int size) {\n\tif (k == (size + 1) / 2)\n\t\treturn n;\n\tif (k > (size + 1) / 2)\n\t\tk -= (size + 1) / 2;\n\treturn find(n - 1, k, size / 2);\n}\n\nint main() {\n\tlong long size;\n\tint n, k;\n\n\tscanf(\"%d%d\", &n, &k);\n\tsize = (1 << n) - 1;\n\tprintf(\"%d\\n\", find(n, k, size));\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint s[1100010];\nint main()\n{\n int a,b;\n int n;\n int i,j,k,m;\n while(~scanf(\"%d%d\",&a,&b))\n {\n a=a-1;\n s[0]=1;\n int t=b;\n int flag=1;\n i=0;\n j=0;\n s[1]=2;\n s[2]=1;\n for(i=0;i<50;i++)\n if(pow(2,i)<=b&&b<pow(2,i+1))\n break;\n //printf(\"%d\\n\",i);\n while(t%((int)pow(2,i))!=0)\n {\n t -= (int)pow(2,i);\n for(;i>=0;i--)\n if(pow(2,i)<=t&&t<=pow(2,i+1))\n break;\n //printf(\"%d\\n\",t);\n }\n //printf(\"hello\\n\");\n printf(\"%d\\n\",i+1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint s[1100010];\nint main()\n{\n int a,b;\n int n;\n int i,j,k,m;\n while(~scanf(\"%d%d\",&a,&b))\n {\n\n a=a-1;\n s[0]=1;\n int t=b;\n int flag=1;\n i=0;\n j=0;\n s[1]=2;\n s[2]=1;\n for(i=0;i<50;i++)\n if(pow(2,i)<=b&&b<pow(2,i+1))\n break;\n //printf(\"%d\\n\",i);\n while(t%((int)pow(2,i))!=0)\n {\n t -= (int)pow(2,i);\n for(;i>=0;i--)\n if(pow(2,i)<=t&&t<=pow(2,i+1))\n break;\n //printf(\"%d\\n\",t);\n }\n //printf(\"hello\\n\");\n printf(\"%d\\n\",i+1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,i;\n\tscanf(\"%d %d\",&n,&k);\n\tint len=1;\n\tfor(i=0;i<n;i++)len*=2;len=len-1;\n\tint lo=0,hi=len,index;\n\twhile(lo<hi)\n\t{\n\t\tif((hi+lo)%2==0)\n\t\t{\n\t\t\tindex = (lo+hi)/2;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tindex = lo+(hi-lo)/2+1;\n\t\t}\n\t\tif(index==k)break;\n\t\tif(index<k)\n\t\t{\n\t\t\tlo=index;\n\t\t}\n\t\telse\n\t\t{\n\t\t\thi=index;\n\t\t}\n\t\tn--;\n\t}\n\tprintf(\"%d\",n);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint solve(int n, long long int k);\n\nint main(void)\n{\n int n;\n long long int k;\n\n scanf(\"%d %lld\", &n, &k);\n k--;\n printf(\"%d\\n\", solve(n, k));\n\n return 0;\n}\n\nint solve(int n, long long int k)\n{\n long long int tmp, ktmp;\n tmp = (1 << (n-1))-1;\n if (k == tmp)\n return n;\n if (tmp < k)\n return solve(n-1, k-tmp-1);\n return solve(n-1, k);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n long long k,c;\n int a,b,i,j,sum=0,tmp,t,ara[1],ara1[1];\n double p,q,x,y,s,t1;\n char c1[1],c2[1];\n scanf(\"%d %I64d\",&a,&k);\n for(i=1,c=2;;i++,c=c*2){\n b=c/2;\n if(k%c==b)\n break;\n\n\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nvoid r(int n,long long int k)\n{\n\t\n\tint i;\n\tlong long int j,c=0,l;\n\tfor(i=1;i<n;i++)\n\t{\n\t\tc=pow(2,i+1)-1;\n\t\tif(k<c)\n\t\t{\n\t\t\tj=k-pow(2,i);\n\t\t\t//l=pow(2,i+1)+1;\n\t\t\tif(j==0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr(n-1,j);\t\n\t\t\t}\n\t\t}\n\t\telse if(k==c)\n\t\t{\n\t\t\t//k=1;\n\t\t\tprintf(\"1\");\n\t\t\texit(0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint n,i;\n\tlong long int k,j,c=0,l;\n\tscanf(\"%d%lld\",&n,&k);\n\tr(n,k);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nvoid r(int n,long long int k)\n{\n\t\n\tint i;\n\tlong long int j,c=0,l;\n\tfor(i=1;i<n;i++)\n\t{\n\t\tc=pow(2,i+1)-1;\n\t\tif(k<c)\n\t\t{\n\t\t\tj=k-pow(2,i);\n\t\t\t//l=pow(2,i+1)+1;\n\t\t\tif(j==0)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i+1);\n\t\t\t\texit(0);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tr(n-1,j);\t\n\t\t\t}\n\t\t}\n\t\telse if(k==c)\n\t\t{\n\t\t\t//k=1;\n\t\t\tprintf(\"1\");\n\t\t\texit(0);\n\t\t}\n\t}\n}\nint main()\n{\n\tint n,i;\n\tlong long int k,j,c=0,l;\n\tscanf(\"%d%164d\",&n,&k);\n\tr(n,k);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long len[55] = { 0, 1 };\n\nint next(long long k)\n{\n\tint i;\n\tfor (i = 1; k > len[i]; i++);\n\n\tif (k == len[i] - len[i - 1])\n\t\treturn i;\n\telse\n\t\treturn next(len[i] - k);\n}\n\nint main()\n{\n\tint n, k, i;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\tfor (i = 2; i <= n; i++)\n\t\tlen[i] = 2 * len[i - 1] + 1;\n\n\tprintf(\"%d\", next(k));\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long len[55] = { 0, 1 };\n\nint next(long long k)\n{\n\tint i;\n\tfor (i = 1; k > len[i]; i++);\n\n\tif (k == len[i])\n\t\treturn i;\n\telse\n\t\treturn next(len[i] - k);\n}\n\nint main()\n{\n\tint n, k, i;\n\n\tscanf(\"%d %d\", &n, &k);\n\n\tfor (i = 2; i <= n; i++)\n\t\tlen[i] = 2 * len[i - 1] + 1;\n\n\tprintf(\"%d\", next(k) + 1);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,count;\n long long k;;\n scanf(\"%d %l64dd\",&n,&k);\n if(k%2==1)\n printf(\"1\\n\");\n else if(k%4==0){\n count=0;\n while(k>0){\n if(k%2==1){\n count++;\n break;\n }\n k=k/2;\n count++;\n }\n printf(\"%d\\n\",count);\n }\n else\n printf(\"2\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,count;\n unsigned long k;;\n scanf(\"%d %uld\",&n,&k);\n if(k%2==1)\n printf(\"1\\n\");\n else if(k%4==0){\n count=0;\n while(k>0){\n if(k%2==1){\n count++;\n break;\n }\n k=k/2;\n count++;\n }\n printf(\"%d\\n\",count);\n }\n else\n printf(\"2\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,i,j,count;\n long k;\n scanf(\"%d %ld\",&n,&k);\n if(k%2==1)\n printf(\"1\\n\");\n else if(k%4==0){\n count=0;\n while(k>0){\n if(k%2==1){\n count++;\n break;\n }\n k=k/2;\n count++;\n }\n printf(\"%d\\n\",count);\n }\n else\n printf(\"2\\n\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n; long long k;\n scanf(\"%d %lld\", &n, &k);\n int i;\n for(i = 1; i <= n; i++)\n if(((k - (1<<(i - 1)))/(double)(1<<i)) == ((k - (1<<(i - 1)))/(1<<i)))\n printf(\"%d\\n\", i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long x = 0;\n\tlong long i = 0;\n\tlong long int n = 0;\n\tlong long int ind = 0;\n\tlong long int ans = 0;\n\tscanf(\"%lld %lld\", &n, &ind);\n\n\tfor (i = n; i >= 0; i--) {\n\t\tx = 1<<i;\n\t\tif ( ind % x ==0)\n\t\t{\n\t\t\tans = i+1;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,k,x,r,i,j,c=0;\n\tscanf(\"%d%d\",&n,&k);\n\twhile(k>0)\n\t{\n\t\tc++;\n\t\tr=k%2;\n\t\tk/=2;\n\t\tif(r)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\",c);\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int n;\n long long int k,l,i;\n scanf(\"%d %lli\",&n,&k);\n for(i=1;i<n;i++)\n {\n double ans=(double)k-(pow(2,i-1));\n ans=ans/(pow(2,i));\n long long int int_ans=(long long int)ans;\n if(ans==(double)int_ans)\n printf(\"%d\",i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main() {\n\tint l,n,x;\n\tscanf (\"%d %d\",&l,&x);\n\t\n\tfor (n=l;n>=1;n--) {\n\t\t\tif (x==(pow(2,n-1))){\n\t\t\tprintf(\"%d\",n);\n\t\t}\n\t\tif(x> (pow(2,n-1))){\n\t\t\tx-=pow(2,n-1);\n\t\t}\n\t\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint n, i;\nlong long int pots[52], k;\n\nint main()\n{\n\tscanf(\"%d %I64d\", &n, &k);\n\tfor(i=0; i<=n; i++)\n\t\tpots[i]=pow(2,i);\n\tif(k%2!=0)\n\t{\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\twhile(1)\n\t{\n\t\ti=0;\n\t\twhile(pots[i]<k)\n\t\t\ti++;\n\t\tif((k-pots[i-1])<(pots[i]-k))\n\t\t\ti = i-1;\n\t\tif(abs(k-pots[i])==0)\n\t\t{\n\t\t\tprintf(\"%d\\n\", i+1);\n\t\t\treturn 0;\n\t\t}\n\t\tk=abs(k-pots[i]);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int i,n,k,j,flag,arr[100];\n\tscanf(\"%lld %lld\",&n,&k);\n\tif(k%2==1)\n\t\tprintf(\"1\\n\");\n\telse \n\t{\n\t\tarr[0]=0;\n\t\tarr[1]=1;\n\t\tfor(i=2;i<=n+1;i++)\n\t\t\tarr[i]=arr[i-1]*2;\n\t\tflag=0;\n\t\tj=0;\n\t\twhile(j<100)\n\t\t{\n\t\t\tfor(i=1;i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]>k)\n\t\t\t\t{\n\t\t\t\t\tif(arr[i]-k<k-arr[i-1])\n\t\t\t\t\t\tk=arr[i]-k;\n\t\t\t\t\telse\n\t\t\t\t\t\tk=k-arr[i-1];\n\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if(k==arr[i])\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t\tprintf(\"%lld\\n\",i);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==1)\n\t\t\t\tbreak;\n\t\t\tj++;\n\t\t}\n\n\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int n,k,b,c,i,m,l,j;\n scanf(\"%d %d\",&n,&k);\n int a[k+1];\n a[1]=1;\n for(i=1,j=2;i<n;i++,j++)\n {\n b=pow(2,i);\n a[b]=j;\n for(l=1,m=b+1;l<=b-1,m<=2*b-1;m++,l++)\n {\n a[m]=a[l];\n if(m>=k)\n {\n c=1;\n break;\n }\n if (c==1)\n {\n break;\n }\n \n }\n }\n printf(\"%d\",a[k]);\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long long int n,k,i,a=0,cnt=0,x;\n scanf(\"%lld %lld\",&n,&k);\n\n if(k%4==1){\n printf(\"1\");\n return 0;\n }\n else if(k%4==2){\n printf(\"2\");\n return 0;\n }\n else if(k%4==3){\n printf(\"1\");\n return 0;\n }\n else if(k%4==0){\n\n for(i=4;;i=i*2){\n cnt++;\n if(k==i){\n printf(\"%lld\",cnt+2);\n return 0;\n }\n else if(i>k){\n break;\n }\n }\n }\n x=k/4;\n if(x%2==0){\n printf(\"4\");\n return 0;\n }\n if(x%2!=0){\n printf(\"3\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,m;\n scanf(\"%d%d\",&n,&k);\n\n m=pow(2,n-1);\n\n if(k%2!=0) printf(\"1\");\n else\n {\n if(k==m) printf(\"%d\",n);\n else if (k>m) printf(\"%d\",n-(k-m)/2);\n else printf(\"%d\",n-(m-k)/2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d = 1,e,f,g,h,i,j,k,l,m,n;\n scanf(\"%d %d\",&a,&b);\n for( c = 1;c < a;c++){\n d = (d * 2) +1;\n }\n\n if( b%2 == 1){\n printf(\"1\");\n }\n\n else if( b == d/2 + 1)\n {\n printf(\"%d\",a);\n }\n else \n {\n \n if(b > d/2 + 1){\n b = b-((d/2)+1);\n }\n e = b;\n g=2;\n h=0;\n while(g <= e)\n {\n \t\n if( e==g)\n {\n h = 1;\n break;\n }\n g = g*2;\n }\n \n if( h == 0)\n {\n \t\n h= 1;\n j = 1;\n while( j != 0 )\n {\n j = e%(h+2);\n h = h+2;\n }\n \n \n e = e/h;\n \n }\n while ( e != 1)\n {\n e = e/2;\n f++;\n }\n printf(\"%d\",f+1);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d = 1,e,f;\n scanf(\"%d %d\",&a,&b);\n for( c = 1;c < a;c++){\n d = (d * 2) +1;\n }\n\n if( b%2 == 1){\n printf(\"1\");\n }\n\n else if( b == d/2 + 1)\n {\n printf(\"%d\",a);\n }\n else if(b > d/2 + 1)\n {\n b = b-((d/2)+1);\n e = b;\n while ( e != 1)\n {\n e = e/2;\n f++;\n }\n printf(\"%d\",f+1);\n }\n else{\n e = b;\n while ( e != 1)\n {\n e = e/2;\n f++;\n }\n printf(\"%d\",f+1);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d = 1,e,f,g,h,i,j,k,l,m,n;\n scanf(\"%d %d\",&a,&b);\n for( c = 1;c < a;c++){\n d = (d * 2) +1;\n }\n\n if( b%2 == 1){\n printf(\"1\");\n }\n\n else if( b == d/2 + 1)\n {\n printf(\"%d\",a);\n }\n else \n {\n /*\n if(b > d/2 + 1){\n b = b-((d/2)+1);\n }\n e = b;\n g=2;\n h=0;\n while(g <= e)\n {\n \t\n if( e==g)\n {\n h = 1;\n break;\n }\n g = g*2;\n }\n \n if( h == 0)\n {\n \t\n h= 1;\n j = 1;\n while( j != 0 )\n {\n j = e%(h+2);\n h = h+2;\n }\n \n \n e = e/h;\n \n }\n while ( e != 1)\n {\n e = e/2;\n f++;\n }\n printf(\"%d\",f+1);\n */\n if(b > d/2 + 1){\n b = b-((d/2)+1);\n }\n int ans=1;\n\tk = b;\n\twhile(k%2==0) k/=2,ans++;\n\tprintf(\"%d\",ans);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d = 1,e,f,g,h,i,j,k,l,m,n;\n scanf(\"%d %d\",&a,&b);\n for( c = 1;c < a;c++){\n d = (d * 2) +1;\n }\n\n if( b%2 == 1){\n printf(\"1\");\n }\n\n else if( b == d/2 + 1)\n {\n printf(\"%d\",a);\n }\n else \n {\n /*\n if(b > d/2 + 1){\n b = b-((d/2)+1);\n }\n e = b;\n g=2;\n h=0;\n while(g <= e)\n {\n \t\n if( e==g)\n {\n h = 1;\n break;\n }\n g = g*2;\n }\n \n if( h == 0)\n {\n \t\n h= 1;\n j = 1;\n while( j != 0 )\n {\n j = e%(h+2);\n h = h+2;\n }\n \n \n e = e/h;\n \n }\n while ( e != 1)\n {\n e = e/2;\n f++;\n }\n printf(\"%d\",f+1);\n */\n int ans=1;\n\tk = b;\n\twhile(k%2==0) k/=2,ans++;\n\tprintf(\"%d\",ans);\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n , k ;\nint main(void) {\nscanf(\"%d%d\",&n,&k);\nif (k > (n/2)) k= k/2;\nif(k%4==0){printf(\"%d\",(k/4)+2); return 0 ; }\nif(k%2==0){printf(\"2\"); return 0 ; }\nprintf(\"1\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n , k ;\nint main(void) {\nscanf(\"%d%d\",&n,&k);\nif(k%4==0){printf(\"%d\",(k/4)+2); return 0 ; }\nif(k%2==0){printf(\"2\"); return 0 ; }\nprintf(\"1\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint n , k ;\nint main(void) {\nscanf(\"%d%d\",&n,&k);\nif (k > (n*2)) k= k/2;\nif(k%4==0){printf(\"%d\",(k/4)+2); return 0 ; }\nif(k%2==0){printf(\"2\"); return 0 ; }\nprintf(\"1\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n,k;\nint rec(int n)\n{\n if(n==0)\n return 1;\n if(n%2==0)\n {\n int p=rec(n/2);\n return p*p;\n }\n if(n%2==1)\n {\n int q=rec(n/2);\n return 2*q*q;\n }\n}\nint main()\n{\n scanf(\"%d %d\",&n,&k);\n int l,i,a,v,x,ans;\n\n while(1)\n {\n a=k;\n l=0;\n while(a>0)\n {\n a=a/2;\n l++;\n }\n v=l;\n x=rec(l-1);\n k=k-x;\n\n if(k==0)\n {\n ans=v;\n break;\n }\n }\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif(k%2!=0){\n\t\tprintf(\"1\\n\");\n\t\treturn 0;\n\t}\n\n\tlong long int c=pow(2,n-1);\n\tif(k>c)\n\t\tk=k-c;\n\tlong long int count=0;\n\tlong long int no=2;\n\tlong long int i=2;\n\twhile(no<=k)\n\t{\n\n\t\tno=pow(2,i);\n\t\tcount++;\n\t\ti++;\n\t}\n\tprintf(\"%lld\\n\",count+1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,i;\nlong long int k;\nscanf(\"%d%lld\",&n,&k);\n\nif(k&01)\n\tprintf(\"1\");\nelse\n\tfor(i=2;;i++)\n\t{\tk=k>>1;\n\t\tif(k&1)\n\t\t\tbreak;\n\t}\nprintf(\"%d\",i);\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,position,i,check;\n scanf(\"%I64d%I64d\",&n,&position);\n double a,k,b,f;\n k=position;\n\n for(i=0; i<n*n; i++)\n {\n f=log((2*k)/(2*i-1))/log(2);\n check=f;\n if(check==f)\n {\n break;\n }\n }\n printf(\"%I64d\\n\",check);;\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n;\nlong long k;\n\nint main() {\n scanf(\"%d %I64d\", &n, &k);\n int ans = 0;\n while (k%2==1 && ++ans)\n k = k >> 1;\n printf(\"%d\\n\", --ans);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n;\nlong long k;\n\nint main() {\n scanf(\"%d %I64d\", &n, &k);\n int ans = 0;\n while (k > 0 && ++ans)\n k = k >> 1;\n printf(\"%d\\n\", ans);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int n = 0;\n long long k = 0;\n\n scanf(\"%d %l64d\", &n, &k);\n if (k%2 !=0)\n {\n printf( \"1\");\n }\n else\n {\n long long a = pow(2,n);\n int z = n;\n long long a1 = a/4;\n long long a2 = 0;\n while (a!=k)\n { if (a>k)\n {\n a1 = a;\n a = a/2;\n\n if(a==k)\n {\n printf(\"%d\",z);\n }\n else\n {\n z--;\n\n }\n }\n else\n {\n k=a1-k;\n }\n\n }\n }\nreturn 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,ans;\n\tlong long int k,i,j,num,den;\n\tscanf(\"%d%lld\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tnum= k+pow(2,i-1);\n\t\tden= pow(2,i);\n\t\tans=num%den;\n\t\tif(ans==0)\n\t\t{\n\t\t\tprintf(\"%lld\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong int Binary(long int start,long int end,long int x,long int n){\n if (start==end){\n return 1;\n }\n long int mid = (start+end)/2;\n if (mid==x){\n return n;\n }\n if (mid>x){\n return Binary(start,mid-1,x,n-1);\n }\n else{\n return Binary(mid+1,end,x,n-1);\n }\n}\nint main(){\n long int n,k;\n scanf(\"%ld %ld\",&n,&k);\n long int end = pow(2,n)-1;\n long int ans=Binary(0,end-1,k-1,n);\n printf(\"%ld\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k,x,y,i;\n scanf(\"%d%d\",&n,&k);\n for(i=1;i<=n;i++){\n x=pow(2,i);\n y=pow(2,i-1);\n if(k%x==y){\n printf(\"%d\",i);\n return 0;\n }\n\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\n\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int result=1;\n int x=1;\n for(int i=1;i<a;i++){\n x=x*2;\n }\n while(b!=x){\n if(b>(x)){\n b=b-x;\n if(b==0){\n\n }\n }\n x=(x-1)/2+1;\n }\n int i=1;\n while(result!=x){\n result*=2;\n i++;\n }\n printf(\"%d\\n\",i);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n long long unsigned int n, k;\n scanf(\"%I64u %I64u\", &n, &k);\n for(int i = 1; i <= 50; i++) {\n if(k % (1 << i) == 1 << (i - 1)) {\n printf(\"%d\", i);\n return 0;\n }\n }\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n long long int n,k,i,a=0,cnt=0;\n scanf(\"%lld %lld\",&n,&k);\n\n if(k%4==1){\n printf(\"1\");\n return 0;\n }\n else if(k%4==2){\n printf(\"2\");\n return 0;\n }\n else if(k%4==3){\n printf(\"1\");\n return 0;\n }\n else if(k%4==0){\n\n for(i=4;;i=i*2){\n cnt++;\n if(k==i){\n printf(\"%lld\",cnt+2);\n return 0;\n }\n else if(i>k){\n break;\n }\n }\n }\n printf(\"%lld\",(k/4)%2!=0?3:4);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nvoid f(long long t,long long n,long long k)\n{\n if(n==1)printf(\"1\\n\");\n else{\n if(k==t/2+1)printf(\"%I64d\\n\",n);\n else if(k<t/2+1) f(t/2,n-1,k);\n else if(k>t/2+1) f(t/2,n-1,t+2-k);\n }\n}\nint main()\n{\n long long n,k,t;\n scanf(\"%I64d%I64d\",&n,&k);\n t=pow(2,n)-1;\n f(t,n,k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nvoid f(long long n,long long t,long long k)\n{\n if(n==1)printf(\"1\\n\");\n else{\n if(k==n/2+1)printf(\"%I64d\\n\",t);\n else if(k<n/2+1) f(n/2,t-1,k);\n else if(k>n/2+1) f(n/2,t-1,n+2-k);\n }\n}\nint main()\n{\n long long n,k,t;\n scanf(\"%I64d%I64d\",&n,&k);\n t=pow(2,n)-1;\n f(t,n,k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include <math.h>\nint main() {\n\tint n;\n\tint k, mid;\n\n\tscanf(\"%d %d\", &n, &k);\n\tmid = pow((int)2, (int)n - 1);\n\twhile (k != mid) {\n\t\tn--;\n\t\tif (k > mid) mid +=(int) pow(2, n-1);\n\t\telse mid -= (int) pow(2, n - 1);\n\t}\n\tprintf(\"%d\", n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include <math.h>\nint main() {\n\tint n;\n\tlong k, mid;\n\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tscanf(\"%d %d\", &n, &k);\n\tmid = (int) pow(2, n - 1);\n\twhile (k != mid) {\n\t\tn--;\n\t\tif (k > mid) mid += (int)pow(2, n - 1);\n\t\telse mid -= (int)pow(2, n - 1);\n\t}\n\tprintf(\"%d\", n);\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\n#include <math.h>\nint main() {\n\tint n;\n\tlong k, mid;\n\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tscanf(\"%d %d\", &n, &k);\n\tmid = pow((int)2, (int)n - 1);\n\twhile (k != mid) {\n\t\tn--;\n\t\tif (k > mid) mid += (int)pow(2, n - 1);\n\t\telse mid -= (int)pow(2, n - 1);\n\t}\n\tprintf(\"%d\", n);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint n,k,i;\n long long int m,r;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tm=k+pow(2,i-1);\n\t\tr=pow(2,i);\n\tif(m%r==0)\n\t{\n\t\tprintf(\"%d\",i);\n\t\treturn 0;\n\t}\n\n}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n\tint n,k,i,m,r;\n\tscanf(\"%d%d\",&n,&k);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tm=k+pow(2,i-1);\n\t\tr=pow(2,i);\n\tif(m%r==0)\n\t{\n\t\tprintf(\"%d\",i);\n\t\treturn 0;\n\t}\n\n}\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,c=0;\n\tchar s[100];\n\tlong long int j=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\twhile(s[i]!='\\0')\n\t\tj=j*10+(int)(s[i++])-48;\n\twhile(j>0)\n\t{\n\t\n\t\tif(j%2==0)\n\t\tc++;\n\t\telse\n\t\t\tbreak;\n\t\tj>>=1;\n\t}\n\tprintf(\"%d\\n\",c+1);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n,i=0,po,t,p;\n\tchar s[100];\n\tlong long int j=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%s\",s);\n\twhile(s[i]!='\\0')\n\t{\n\t\tpo=i;\n\t\tt=10;\n\t\tp=1;\n\t\twhile(po>0)\n\t\t{\n\t\t\tif(p&1)\n\t\t\tp*=t;\n\t\t\tt*=t;\n\t\t\tpo>>=1;\n\t\t}\n\t\tj+=((int)(s[i])-48)*p;\n\t\ti++;\n\t\tprintf(\"%lld\\n\",j);\n\t}\n\tprintf(\"%lld\",j);\n\treturn 0;\n}\n"}, {"source_code": "long k;main(){scanf(\"%d%lld\",&k,&k);printf(\"%d\\n\",1+__builtin_ctzll(k));}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, k, sum = 1, i;\n scanf(\"%d %d\", &n, &k);\n for(i = 1; i < n; i++)\n sum = sum * 2 + 1;\n while(1)\n {\n if(k > (sum - 1) / 2 + 1)\n {\n k -= (sum - 1) / 2 + 1;\n sum = (sum - 1) / 2;\n }\n else if(k < (sum - 1) / 2 + 1)\n {\n sum = (sum - 1) / 2;\n }\n else\n break;\n n--;\n }\n printf(\"%d\\n\", n);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,k,c=1;\nscanf(\"%d%d\",&n,&k);\nif(k%2==1)\nprintf(\"1\");\nelse\n{\nc=1;\nwhile(k!=0 && k%2==0)\n{\nc++;\nk=k/2;\n}\n\nprintf(\"%d\",c);\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tlong long int b;\n\tint a;\n\twhile(~scanf(\"%d%I64d\",&a,&b))\n\t{\n\t\tif(b>pow(2,a-1)) \n\t\tb=b-pow(2,a-1);\n\t\t\t\tif(b%4==0)\n\t\t{\n\t\t\tprintf(\"%I64d\\n\",(b/4)+2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(b%4==1)\n\t\t\tprintf(\"1\\n\");\n\t\t\tif(b%4==2)\n\t\t\tprintf(\"2\\n\");\n\t\t\tif(b%4==3)\n\t\t\tprintf(\"1\\n\");\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tlong long int b;\n\tint a;\n\twhile(~scanf(\"%d%I64d\",&a,&b))\n\t{\n\t\tif(b%4==0&&b<=pow(2,a-1))\n\t\t{\n\t\t\tprintf(\"%I64d\\n\",(b/4)+2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(b%4==1)\n\t\t\tprintf(\"1\\n\");\n\t\t\tif(b%4==2)\n\t\t\tprintf(\"2\\n\");\n\t\t\tif(b%4==3)\n\t\t\tprintf(\"1\\n\");\n\t\t\tif(b%4==0)\n\t\t\tprintf(\"%I64d\\n\",(b/4));\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,sum;\n while(scanf(\"%d%d\",&n,&k)!=EOF)\n {\n while(n>0)\n {\n sum=pow(2,n-1);\n if(sum==k)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n {\n n-=1;\n if(k>sum)k%=sum;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint f(int n, int k)\n{\n long x = (long)(pow(2.0, (double)(n-1)));\n if(x==k)\n return n;\n else if(x > k)\n return f(n-1, k);\n else\n return f(n-1, k-x);\n}\n\nint main(void)\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n printf(\"%d\\n\", f(n, k));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint f(int n, int k)\n{\n long x = (long)(pow(2.0, (double)(n-1)));\n if(x==k)\n return n;\n else if(x > k)\n return f(n-1, k);\n else\n return f(n-1, k-x);\n}\n\nint main(void)\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n printf(\"%d\\n\", f(n, k));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint f(int n, long k)\n{\n long x = (long)(pow(2.0, (double)(n-1)));\n if(x==k)\n return n;\n else if(x > k)\n return f(n-1, k);\n else\n return f(n-1, k-x);\n}\n\nint main(void)\n{\n int n;\n long k;\n scanf(\"%d %ld\", &n, &k);\n printf(\"%d\\n\", f(n, k));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint f(int n, int k)\n{\n int x = (int)(pow(2.0, (double)(n-1)));\n if(x==k)\n return n;\n else if(x > k)\n return f(n-1, k);\n else\n return f(n-1, k-x);\n}\n\nint main(void)\n{\n int n, k;\n scanf(\"%d %d\", &n, &k);\n printf(\"%d\\n\", f(n, k));\n return 0;\n}\n"}, {"source_code": "//Created by Pratik Mandlecha\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n;\n\tlong long int k,c=0;\n\tscanf(\"%d%lld\",&n,&k);\n\twhile(k>0)\n\t{\n\t\tif((k%2)==0) c++;\n\t\tk=k/2;\n\t}\n\tprintf(\"%lld\",c+1);\n\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "//Created by Pratik Mandlecha\n\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tint n,k;\n\tscanf(\"%d%d\",&n,&k);\n\tif((k%2)==1) printf(\"1\");\n\telse\n\t{\n\t\tint c=0;\n\t\twhile(k>0)\n\t\t{\n\t\t\tif((k%2)==0) c++;\n\t\t\tk/=2;\n\t\t}\n\t\tprintf(\"%d\",c+1);\n\t}\n\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,k;\n\tscanf(\"%lld%lld\",&n,&k);\n\tif((k%2)==1) printf(\"1\");\n\telse\n\t{\n\t\tint c=0;\n\t\twhile(k>0)\n\t\t{\n\t\t\tif((k%2)==0) c++;\n\t\t\tk/=2;\n\t\t}\n\t\tprintf(\"%d\",c+1);\n\t}\n\n\n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint n,i;\nlong long int k,a=2,d=4,x=0;\nscanf(\"%I64d %I64d\",&n,&k);\nif(k%2!=0)\nprintf(\"1\");\nelse\n{\n for(i=1;i<=49;i++)\n {\n if(i>1)\n {\n a=a*2;\n d=d*2;\n }\n if(((k-a)%d)==0)\n {\n printf(\"%d\",i+1);\n break;\n }\n }\n for(i=1;i<=50;i++)\n {\n if(i==1)\n x=7;\n else\n x=x*2 + 1;\n if(k==(x/2 + 1))\n printf(\"%d\",i);\n }\n\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong n,k;\n\tint i;\n\tscanf(\"%ld %ld\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tif(k%2==1){\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t\tk=k/2;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong n,k;\n\tint i;\n\tscanf(\"%ld %ld\",&n,&k);\n\tfor(i=1;i<=n;i++){\n\t\tif(k%2==1)\n\t\t\tprintf(\"%d\\n\",i);\n\t\telse\n\t\t\tk=k/2;\n\t}\n\treturn 0;\n}"}], "src_uid": "0af400ea8e25b1a36adec4cc08912b71"} {"nl": {"description": "Your search for Heidi is over \u2013 you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so that people can borrow and read them. There are n different books, numbered 1 through n.We will look at the library's operation during n consecutive days. Heidi knows in advance that on the i-th day (1\u2009\u2264\u2009i\u2009\u2264\u2009n) precisely one person will come to the library, request to borrow the book ai, read it in a few hours, and return the book later on the same day.Heidi desperately wants to please all her guests, so she will make sure to always have the book ai available in the library on the i-th day. During the night before the i-th day, she has the option of going to the bookstore (which operates at nights to avoid competition with the library) and buying any book for the price of 1 CHF. Of course, if she already has a book at the library, she does not need to buy it again. Initially, the library contains no books.There is a problem, though. The capacity of the library is k \u2013 this means that at any time, there can be at most k books at the library. If buying a new book would cause Heidi to have more than k books, she must first get rid of some book that she already has, in order to make room for the new book. If she later needs a book that she got rid of, she will need to buy that book again.You are given k and the sequence of requests for books a1,\u2009a2,\u2009...,\u2009an. What is the minimum cost (in CHF) of buying new books to satisfy all the requests?", "input_spec": "The first line of input will contain two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u200980). The second line will contain n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009n) \u2013 the sequence of book requests.", "output_spec": "On a single line print the minimum cost of buying books at the store so as to satisfy all requests.", "sample_inputs": ["4 80\n1 2 2 1", "4 1\n1 2 2 1", "4 2\n1 2 3 1"], "sample_outputs": ["2", "3", "3"], "notes": "NoteIn the first test case, Heidi is able to keep all books forever. Therefore, she only needs to buy the book 1 before the first day and the book 2 before the second day.In the second test case, she can only keep one book at a time. Therefore she will need to buy new books on the first, second and fourth day.In the third test case, before buying book 3 on the third day, she must decide which of the books 1 and 2 she should get rid of. Of course, she should keep the book 1, which will be requested on the fourth day."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(){\n int i,j,n,m,k,stock[81]={0},temp=0,count=0,ans = 0, a[81],check[81]={0};\n scanf(\"%d %d\",&n ,&k);\n for(j=1;j<=n;j++)\n scanf(\"%d\",&a[j]);\n stock[a[1]]++;\n ans++;\n count++;\n for(j=2;j<=n;j++){\n if(stock[a[j]] == 1) continue;\n if(count == k){\n for(i=0; i<81; i++)\n check[i] = 0;\n temp = count;\n for(i=j+1; i<=n; i++){\n if(temp == 1){\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m] == 1){\n stock[m] = 0;\n count--;\n break;\n }\n break;\n }\n if(stock[a[i]] == 1 && check[a[i]] == 0){\n temp--;\n check[a[i]] = 1;\n }\n }\n\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m] == 1){\n stock[m] = 0;\n count--;\n }\n\n }\n stock[a[j]] = 1;\n count++;\n ans++;\n /*printf(\"%d\\t\",ans);\n for(i=0; i<81;i++)\n if(stock[i]) printf(\"%d \",i);\n printf(\"\\n\");*/\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<stdbool.h>\nint main()\n{\n int n,k;\n while(~scanf(\"%d%d\",&n,&k))\n {\n int a[100],i,vis[100],money=0;\n memset(vis,0,sizeof(vis));\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n vis[a[i]]++;\n }\n int booknum=0,exit[100],flag=0;\n memset(exit,0,sizeof(exit));\n for(i=0;i<n;i++)\n {\n //printf(\"i=%d\\n\",i);\n if(exit[a[i]]==1&flag==0)\n {\n vis[a[i]]--;\n flag=1;\n if(!vis[a[i]])\n booknum--;\n }\n if(booknum<k&vis[a[i]]==1&exit[a[i]]==0&flag==0)\n {\n money++;\n exit[a[i]]=1;\n //printf(\"money1=%d booknum=%d\\n\",money,booknum);\n flag=1;\n vis[a[i]]--;\n }\n if(booknum<k&vis[a[i]]>1&exit[a[i]]==0&flag==0)\n {\n money++;\n booknum++;\n exit[a[i]]=1;\n //printf(\"money2=%d booknum=%d\\n\",money,booknum);\n flag=1;\n vis[a[i]]--;\n }\n if(booknum==k&exit[a[i]]==0&flag==0)\n {\n int j,exit1[100],b[100],k=-1;\n memset(exit1,0,sizeof(exit1));\n if(i+1==n)\n {\n money++;\n break;\n }\n for(j=i+1;j<n;j++)\n {\n if(exit[a[j]]==1&exit1[a[j]]==0)\n {\n b[++k]=a[j];\n exit1[a[j]]=1;\n }\n }\n //printf(\"%d\\n\",b[k]);\n if(vis[a[i]]==1)\n booknum--;\n money++;\n //printf(\"money3=%d booknum=%d\\n\",money,booknum);\n exit[b[k]]=0;\n exit[a[i]]=1;\n vis[a[i]]--;\n flag=1;\n }\n flag=0;\n }\n printf(\"%d\\n\",money);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n=0,i=0,j=0,book[81]={0},max=0,now[81]={0},time[81]={0},money=0,number=0,de=0,k=0,chose=0;\n scanf(\"%d %d\",&n,&max);\n for(i=0;i<n;i++)\n scanf(\"%d\",&book[i]);\n for(i=0;i<n;i++)\n {\n if(now[book[i]]==0 && number<max)\n {\n now[book[i]]=1;\n money++;\n number++;\n }\n else if(now[book[i]]==0 && number==max)\n {\n for(j=0;j<81;j++)\n time[j]=0;\n for(j=i;j<n;j++)\n {\n if(now[book[j]]==1 && time[book[j]]==0)\n {\n time[book[j]]=1;\n de=book[j];\n }\n }\n for(j=0;j<81;j++)\n {\n chose=0;\n if(now[j]==1)\n {\n //but=now[j];\n for(k=i;k<n;k++)\n {\n if(j==book[k])\n chose=1;\n }\n if(chose==0)\n de=j;\n }\n\n }\n now[de]=0;\n now[book[i]]=1;\n money++;\n }\n }\n printf(\"%d\\n\",money);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main(){\n int i,j,n,m,k,stock[81]={0},temp=0,count=0,ans = 0, a[81],check[81]={0};\n scanf(\"%d %d\",&n ,&k);\n for(j=1;j<=n;j++)\n scanf(\"%d\",&a[j]);\n stock[a[1]]++;\n ans++;\n count++;\n for(j=2;j<=n;j++){\n if(stock[a[j]] == 1) continue;\n if(count == k){\n for(i=0; i<81; i++)\n check[i] = 0;\n temp = count;\n for(i=j+1; i<=n; i++){\n if(temp == 1){\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m]){\n stock[m] = 0;\n count--;\n break;\n }\n break;\n }\n if(stock[a[i]] == 1 && check[a[i]] == 0){\n temp--;\n check[a[i]] = 1;\n }\n }\n if(temp!=1){\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m]){\n stock[m] = 0;\n count--;\n break;\n }\n }\n }\n stock[a[j]]++;\n count++;\n ans++;\n /*printf(\"%d\\t\",ans);\n for(i=0; i<81;i++)\n if(stock[i]) printf(\"%d \",i);\n printf(\"\\n\");*/\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int i,j,n,m,k,stock[81]={0},temp=0,count=0,ans = 0, a[81],check[81]={0};\n scanf(\"%d %d\",&n ,&k);\n for(j=1;j<=n;j++)\n scanf(\"%d\",&a[j]);\n stock[a[1]]++;\n ans++;\n count++;\n for(j=2;j<=n;j++){\n if(stock[a[j]] == 1) continue;\n if(count == k){\n for(i=0; i<81; i++)\n check[i] = 0;\n temp = count;\n for(i=j+1; i<=n; i++){\n if(temp == 1){\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m]){\n stock[m] = 0;\n count--;\n break;\n }\n break;\n }\n if(stock[a[i]] == 1){\n temp--;\n check[a[i]] = 1;\n }\n }\n if(temp!=1){\n for(m=1; m<81; m++)\n if(check[m] == 0 && stock[m]){\n stock[m] = 0;\n count--;\n break;\n }\n }\n }\n stock[a[j]]++;\n count++;\n ans++;\n /* for(i=0; i<3;i++)\n printf(\"%d \",stock[i]);\n printf(\"\\n\");*/\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n=0,i=0,j=0,book[81]={0},max=0,now[81]={0},money=0,number=0,de=0;\n scanf(\"%d %d\",&n,&max);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&book[i]);\n if(now[book[i]]==0 && number<max)\n {\n now[book[i]]=1;\n money++;\n number++;\n }\n else if(now[book[i]]==0 && number==max)\n {\n for(j=i;j<n;j++)\n {\n if(now[book[j]]==1)\n de=book[j];\n }\n now[de]=0;\n now[book[i]]=1;\n money++;\n }\n }\n printf(\"%d\\n\",money);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n=0,i=0,j=0,book[81]={0},max=0,now[81]={0},time[81]={0},money=0,number=0,de=0,k=0,chose=0;\n scanf(\"%d %d\",&n,&max);\n for(i=0;i<n;i++)\n scanf(\"%d\",&book[i]);\n for(i=0;i<n;i++)\n {\n if(now[book[i]]==0 && number<max)\n {\n now[book[i]]=1;\n money++;\n number++;\n }\n else if(now[book[i]]==0 && number==max)\n {\n for(j=0;j<81;j++)\n time[j]=0;\n for(j=i;j<n;j++)\n {\n if(now[book[j]]==1 && time[book[j]]==0)\n {\n time[book[j]]=1;\n de=book[j];\n }\n }\n for(j=0;j<11;j++)\n {\n chose=0;\n if(now[j]==1)\n {\n //but=now[j];\n for(k=i;k<n;k++)\n {\n if(j==book[k])\n chose=1;\n }\n if(chose==0)\n de=j;\n }\n\n }\n now[de]=0;\n now[book[i]]=1;\n money++;\n }\n }\n printf(\"%d\\n\",money);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n=0,i=0,j=0,book[81]={0},max=0,now[81]={0},money=0,number=0,de=0,k=0,chose=0;\n scanf(\"%d %d\",&n,&max);\n for(i=0;i<n;i++)\n scanf(\"%d\",&book[i]);\n for(i=0;i<n;i++)\n {\n if(now[book[i]]==0 && number<max)\n {\n now[book[i]]=1;\n money++;\n number++;\n }\n else if(now[book[i]]==0 && number==max)\n {\n for(j=i;j<n;j++)\n {\n if(now[book[j]]==1)\n de=book[j];\n }\n for(j=0;j<81;j++)\n {\n chose=0;\n if(now[j]==1)\n {\n //but=now[j];\n for(k=i;k<n;k++)\n {\n if(j==book[k])\n chose=1;\n }\n if(chose==0)\n de=j;\n }\n\n }\n now[de]=0;\n now[book[i]]=1;\n money++;\n }\n }\n printf(\"%d\\n\",money);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n=0,i=0,j=0,book[81]={0},max=0,now[81]={0},money=0,number=0,de=0;\n scanf(\"%d %d\",&n,&max);\n for(i=0;i<n;i++)\n scanf(\"%d\",&book[i]);\n for(i=0;i<n;i++)\n {\n if(now[book[i]]==0 && number<max)\n {\n now[book[i]]=1;\n money++;\n number++;\n }\n else if(now[book[i]]==0 && number==max)\n {\n for(j=i;j<n;j++)\n {\n if(now[book[j]]==1)\n de=book[j];\n }\n now[de]=0;\n now[book[i]]=1;\n money++;\n }\n }\n printf(\"%d\\n\",money);\n return 0;\n}\n"}], "src_uid": "956228e31679caa9952b216e010f9773"} {"nl": {"description": "You have two integers $$$l$$$ and $$$r$$$. Find an integer $$$x$$$ which satisfies the conditions below: $$$l \\le x \\le r$$$. All digits of $$$x$$$ are different. If there are multiple answers, print any of them.", "input_spec": "The first line contains two integers $$$l$$$ and $$$r$$$ ($$$1 \\le l \\le r \\le 10^{5}$$$).", "output_spec": "If an answer exists, print any of them. Otherwise, print $$$-1$$$.", "sample_inputs": ["121 130", "98766 100000"], "sample_outputs": ["123", "-1"], "notes": "NoteIn the first example, $$$123$$$ is one of the possible answers. However, $$$121$$$ can't be the answer, because there are multiple $$$1$$$s on different digits.In the second example, there is no valid answer."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<=r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r+1)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,r,i,j,k,n,m,p;\n char a[100000];\n\n scanf(\"%d %d\",&l,&r);\n n=0;\n for(i=l; i<=r; i++)\n {\n n=i;\n m=0;\n while(n!=0)\n {\n a[m++]=n%10;\n n=n/10;\n }\n p=0;\n for(j=0; j<m; j++)\n {\n for(k=j+1; k<m; k++)\n {\n if(a[j]==a[k])\n {\n p++;\n }\n }\n\n }\n if(p==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n if(p>0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint fun(int n)\n{\n int ara[]={1,1,1,1,1,1,1,1,1,1};\n int q=n;\n while(q)\n {\n if(ara[(q%10)]==1)\n ara[q%10]=0;\n else\n return -1;\n q=q/10;\n }\n return n;\n}\nint main()\n{\n int l,r,ans,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l;i<=r;i++)\n {\n ans=fun(i);\n if(ans!=-1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(i==r+1)\n printf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint dif(int n){\n\tint arr[10]={0};\n\t\n\twhile(n>0){\n\t\tif(arr[n%10]>=1){\n\t\t\treturn 0;\n\t\t}\n\t\tarr[n%10]=1;\n\t\tn=n/10;\n\t}\n\treturn 1;\n}\n\nint main(){\n\t\n\t\n\tint l, r;\n\tscanf(\"%d %d\", &l, &r);\n\tint flag=0;\n\tfor(int i=l; i<=r;i++){\n\t\tif(dif(i)==1){\n\t\t\tflag=1;\n\t\t\tprintf(\"%d\", i);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(flag==0){\n\t\tprintf(\"-1\\n\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"stdbool.h\"\n\nbool func(int a) {\n\tint arr[10];\n\tint count = 0;\n\twhile (a > 9) {\n\t\tint b = a % 10;\n\t\tfor (int i = 0; i < count; i++) if (arr[i] == b) return false;\n\t\tarr[count++] = b;\n\t\ta = a / 10;\n\t} \n\tint b = a % 10;\n\tfor (int i = 0; i < count; i++) if (arr[i] == b) return false;\n\tarr[count++] = b;\n\treturn true;\n}\n\nint main() {\n\tint a, b;\n\tscanf(\"%i\",&a);\n\tscanf(\"%i\",&b);\n\n\tfor (int i = a; i <= b; i++) {\n\t\tif (func(i)) {\n\t\t\tprintf(\"%i\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int l, r;\n scanf(\"%d %d\", &l, &r);\n for(int i = l; i <= r; i++){\n int D[10] = { 0 };\n int n = i;\n int f = 0;\n while(n != 0){\n int d = n % 10;\n D[d]++;\n n /= 10;\n }\n for(int j = 0; j < 10; j++){\n if(D[j] > 1) {\n f = 1;\n break;\n }\n }\n if(!f) {\n printf(\"%d\", i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "int isLucky(int n)\n{\n int arr[15]={};\n for(int i=0;i<10;i++)\n arr[i]=0;\n int num=n;\n while(num>0)\n {\n int digit=num%10;\n if(arr[digit])\n return 0;\n arr[digit]=1;\n num=num/10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int t=l;\n while(t<=r)\n {\n if(isLucky(t))\n {\n printf(\"%d\",t);\n return 0;\n }\n t++;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint a[10];\nint main()\n{\n int x, y, i, j, k, t, m, n, c;\n scanf(\"%d %d\", &x, &y);\n t=0;\n for(i=x;i<=y;i++)\n {\n m=i, c=0;\n for(j=0;j<10;j++)\n {\n n=m%10;\n a[j]=n;\n for(k=j-1;k>=0;k--)\n {\n if(a[j]==a[k])\n {\n c=1;\n break;\n }\n }\n m=m/10;\n if(m==0||c==1) break;\n }\n if(c==0)\n {\n t=i;\n break;\n }\n }\n if(t==0) printf(\"-1\\n\");\n else printf(\"%d\\n\", t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,k,i=0,c=0,s,p=0,t;\n scanf(\"%d %d\",&x,&k);\n int n[100];\n while(x<=k)\n {\n p=0;\n i=0;\n t=x;\n while(t!=0)\n {\n s=t%10; n[i]=s; t=t/10; i++; p++;\n }\n\n for(i=p-1;i>=0;i--)\n {\n for(int j=i-1;j>=0;j--)\n {\n if(n[i]==n[j]) { c++; break; }\n }\n }\n if(c==0) break; c=0; x++;\n }\n //printf(\"%d\\n\",x);\n if(x<=k)\n printf(\"%d\",x);\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "int isLucky(int n)\n{\n int arr[15]={};\n for(int i=0;i<10;i++)\n arr[i]=0;\n int num=n;\n while(num>0)\n {\n int digit=num%10;\n if(arr[digit])\n return 0;\n arr[digit]=1;\n num=num/10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int t=l;\n while(t<=r)\n {\n if(isLucky(t))\n {\n printf(\"%d\",t);\n return 0;\n }\n t++;\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\n\tint r,a,c0=0,d,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,l,j=0,k;\n\tscanf(\"%d%d\",&l,&r);\n\tfor(int i=l;i<=r;i++)\n\t {k=i;\n d=i;\n c0=0;c1=0;c2=0;c3=0;c4=0;c5=0;c6=0;c7=0;c8=0;c9=0;\n while(k!=0)\n {\n a=k%10;\n if(a==9)\n c9++;\n if(a==8)\n c8++;\n if(a==7)\n c7++;\n if(a==6)\n c6++;\n if(a==5)\n c5++;\n if(a==4)\n c4++;\n if(a==3)\n c3++;\n if(a==2)\n c2++;\n if(a==1)\n c1++;\n if(a==0)\n c0++;\n k=k/10;\n }\n if(c9<=1&&c8<=1&&c7<=1&&c6<=1&&c5<=1&&c4<=1&&c3<=1&&c2<=1&&c1<=1&&c0<=1)\n {\n\t\tprintf(\"%d\",d);\n\t\tj=1;\n\t\tbreak;\n\t}\n\telse\n\t\tcontinue;\n}\nif(j!=1)\nprintf(\"-1\");\n}\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int i,j,m,s;\n for(i=a;i<=b;i++)\n {\n m=i;\n int k[10]={0};\n while(m!=0)\n {\n k[m % 10]++;\n m/=10;\n }\n s=0;\n for(j=0;j<10;j++)\n {\n if(k[j]>1)\n s++;\n }\n if(s==0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint distinct(int n) {\n\tint freq[10] = {0};\n\twhile(n > 0) {\n\t\tint index = n % 10;\n\t\tif(freq[index] == 1) {\n\t\t\treturn 0;\n\t\t}\n\t\tfreq[index] = 1;\n\t\tn /= 10;\n\t}\n\treturn 1;\n}\n\nint main() {\n\tint l, r, result = -1;\n\tscanf(\"%d%d\", &l, &r);\n\twhile(l <= r) {\n\t\tif(distinct(l ++)) {\n\t\t\tresult = l - 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\", result);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint fun(int n)\n{\n int ara[]={1,1,1,1,1,1,1,1,1,1};\n int q=n;\n while(q)\n {\n if(ara[(q%10)]==1)\n ara[q%10]=0;\n else\n return -1;\n q=q/10;\n }\n return n;\n}\nint main()\n{\n int l,r,ans,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l;i<=r;i++)\n {\n ans=fun(i);\n if(ans!=-1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(i==r+1)\n printf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint l, x, r;\n\tint b, c, d, e, f, g;\n\tg = 0;\n\tscanf(\"%d%d\", &l, &r);\n\tfor (x = l; x <= r; x++) {\n\t\t\n\t\tb = (int)(x / 10000);\n\t\tc = (int)(x - 10000 * b) / 1000;\n\t\td = (int)(x - 10000 * b - 1000 * c)/100;\n\t\te = (int)(x - 10000 * b - 1000 * c - 100 * d) / 10;\n\t\tf = (int)(x - 10000 * b - 1000 * c - 100 * d - 10 * e)/1;\n\t\tg = 0;\n\t\t\n\t\t\t\n\t\t\tif (b != 0) {\n\t\t\t\tif (b != c && b != d && b != e && b != f && c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c != 0) {\n\t\t\t\tif (c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b == 0 && c == 0 && d != 0) {\n\t\t\t\tif (d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d == 0 && e != 0) {\n\t\t\t\tif (e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d ==0 && e ==0 &&f != 0) {\n\t\t\t\tprintf(\"%d\", x);\n\t\t\t\tg = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\t\n\t}\n\t\n\tif (g == 0) {\n\t\tprintf(\"-1\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int arr[10],i,j,y,x,k,s=0;\n for(i=l;i<=r;i++)\n {\n for(j=i,k=0;j>0;j=j/10,k++)\n {\n arr[k]=j%10;\n }\n int p=0;\n for(y=0;y<k-1;y++)\n {\n int c=0;\n for(x=y+1;x<k;x++)\n {\n if(arr[y]==arr[x])\n {\n c++;\n break;\n }\n }\n if(c>0)\n {\n p++;\n break;\n }\n }\n if(p==0)\n {\n printf(\"%d\",i);\n s++;\n break;\n }\n }\n if(s==0)\n printf(\"-1\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,g,m;\nscanf(\"%d%d\",&m,&b);\nc=-1;\nd=-2;\ne=-4;\nf=-6;\ng=-7;\nwhile(m<=b)\n{\n a=m;\n c=a%10;\n a=a/10;\n if(a>0)\n {\n d=a%10;\n a=a/10;\n }\n\n\n if(a>0)\n {\n e=a%10;\n a=a/10;\n\n }\n\nif(a>0)\n{\n f=a%10;\n a=a/10;\n}\n\n\nif(a>0)\n{\n g=a%10;\n a=a/10;\n\n}\n if((c!=d)&&(c!=e)&&(c!=f)&&(c!=g)&&(d!=g)&&(d!=e)&&(d!=f)&&(e!=f)&&(e!=g)&&(f!=g))\n {\n printf(\"%d\\n\",m);\n break;\n }\n else\n {\n if(m==b)\n printf(\"%d\\n\",-1);\n }\nm++;\n\n}\n\n\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint fun(int n)\n{\n int ara[]={1,1,1,1,1,1,1,1,1,1};\n int q=n;\n while(q)\n {\n if(ara[(q%10)]==1)\n ara[q%10]=0;\n else\n return -1;\n q=q/10;\n }\n return n;\n}\nint main()\n{\n int l,r,ans,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l;i<=r;i++)\n {\n ans=fun(i);\n if(ans!=-1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(i==r+1)\n printf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,i,k,j,l=0;\n scanf(\"%d %d\",&a,&b);\n char s[100],t;\n for(i=a;i<=b;i++)\n {\n sprintf(s, \"%d\", i);\n l=0;\n if(strlen(s)>10)\n break;\n for(j=0;j<strlen(s);j++)\n {\n for(k=j+1;k<strlen(s);k++)\n {\n if(s[j]>s[k])\n {\n t=s[j];\n s[j]=s[k];\n s[k]=t;\n }\n }\n }\n for(j=0;j<strlen(s);j++)\n {\n if(s[j]==s[j+1])\n {\n l=0;\n break;\n }\n else l=1;\n }\n if(l==1)\n break;\n }\n if(l==1)\n printf(\"%d\\n\",i);\n else printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint solution(int left, int right){\n if(left>right)\n return -1;\n int digit[6];\n int use[10],ruse[10];\n int width;\n memset(digit,0,sizeof(digit));\n memset(use,0,sizeof(use));\n memset(ruse,0,sizeof(ruse));\n int tmpl = left;\n int ret,fdp=-1;\n for(width =0;tmpl>0;width++,tmpl /= 10){\n digit[width]=tmpl%10;\n }\n// for(int i=0;i<6;i++)\n// printf(\"%d\",digit[i]);\n for(int i=width-1;i>=0;i--){\n if(!use[digit[i]])\n use[digit[i]] = 1;\n else\n fdp = fdp>i?fdp:i;\n }\n// printf(\"fdp=%d \\n\",fdp);\n// printf(\"--width=%d---\\n\",width);\n if(fdp>=0){\n for(int i=width-1;i>fdp;i--)\n ruse[digit[i]] = 1;\n// for(int i=0;i<10;i++)\n// printf(\"%d\",ruse[i]);\n\n int tmp;\n for(tmp=digit[fdp];tmp<10;tmp++){\n if(!ruse[tmp])\n break;\n }\n// printf(\"\\ntmp=%d\\n\",tmp);\n if(tmp<10){\n digit[fdp] = tmp;\n ruse[tmp] = 1;\n for(int i=fdp-1;i>=0;i--){\n int min;\n for(min=0;min<10;min++)\n if(!ruse[min])\n break;\n digit[i] = min;\n ruse[min] = 1;\n// printf(\"min=%d\",min);\n }\n// printf(\"--width=%d---\\n\",width);\n// for(int i=width-1;i>=0;i--)\n// printf(\"%d\",digit[i]);\n }\n else{\n int nz;\n for(nz=fdp+1;;nz++){\n if(nz>=width){\n width++;\n break;\n }\n\n ruse[digit[nz]]=0;\n if(nz>=width)\n break;\n if(nz<width && (digit[nz]<9 && !ruse[digit[nz]+1]))\n break;\n }\n// printf(\"nz=%d\\n\",nz);\n// for(int i=0;i<nz+1;i++)\n// printf(\"ruse[%d]=%d\\n\",i,ruse[i]);\n// printf(\"digit[nz]=%d\\n\",digit[nz]);\n digit[nz]++;\n ruse[digit[nz]]=1;\n for(int i=nz-1;i>=0;i--){\n int min;\n for(min=0;min<10;min++)\n if(!ruse[min])\n break;\n digit[i] = min;\n ruse[min] = 1;\n// printf(\"min=%d\\n\",min);\n }\n// printf(\"--width=%d---\\n\",width);\n }\n ret = 0;\n for(int i=width-1;i>=0;i--)\n ret=ret*10+digit[i];\n// printf(\"ret=%d \\n\",ret);\n }\n else\n ret = left;\n ret=ret<=right?ret:-1;\n return ret;\n}\nint main(){\n int left =2234;\n int right = 2343;\n while(~scanf(\"%d%d\",&left,&right)){\n int result=solution(left,right);\n printf(\"%d\\n\",result);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nlong long arr[10]={0,0,0,0,0,0,0,0,0,0};\nint count(long long y)\n{\n for(short k=0;k<10;k++)\n arr[k]=0;\n while(y>0)\n {\n arr[(y%10)]++;\n y=y/10;\n }\n for(short k=0;k<10;k++)\n if(arr[k]>1)return 1;\n return 0;\n}\nint main()\n{\n long long x,n,y,l,r;\n short flag=0;\n scanf(\"%lld %lld\",&l,&r);\n for(x=r;x>=l;x--)\n {\n if(count(x)==0)\n {\n printf(\"%lld\",x);\n flag=1;\n break;\n }\n }\n if(flag==0)printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long int l,r,i,a[6],rem,j=0,k,n,m,flag;\n scanf(\"%ld %ld\",&l,&r);\n if(1<=l&&l<=r&&r<=100000)\n {\n for(i=l;i<=r;i++)\n {\n j=0;\n rem=i;\n while(rem!=0)\n {\n\n a[j]=rem%10;\n rem=rem/10;\n j++;\n }\n flag=0;\n for(k=0;k<j;k++)\n {\n for(n=k+1;n<j;n++)\n {\n if(a[k]==a[n])\n {\n flag=flag+1;\n\n\n }\n\n }\n if(flag!=0)\n break;\n }\n if(flag==0)\n {\n for(m=j-1;m>=0;m--)\n printf(\"%ld\",a[m]);\n exit(0);\n }\n\n\n }\n if(flag!=0)\n printf(\"%ld\",-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int l, r;\n scanf(\"%d %d\", &l, &r);\n for(int i = l; i <= r; i++){\n int D[10] = { 0 };\n int n = i;\n int f = 0;\n while(n != 0){\n int d = n % 10;\n D[d]++;\n n /= 10;\n }\n for(int j = 0; j < 10; j++){\n if(D[j] > 1) {\n f = 1;\n break;\n }\n }\n if(!f) {\n printf(\"%d\", i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint digits[1000010];\n\nint main()\n{\n int l, r;\n scanf(\"%d %d\", &l, &r);\n\n if (l <= 10)\n {\n printf(\"%d\\n\", l);\n return 0;\n }\n\n for (int i = l; i <= r; i++)\n {\n int j = 0;\n int num = i;\n\n while (num > 0)\n {\n digits[j] = num % 10;\n j++;\n num /= 10;\n }\n\n int flag = 0;\n\n for (int l = 0; l < j; l++)\n {\n for (int k = l + 1; k < j; k++)\n {\n if (digits[l] != digits[k])\n flag = 1;\n\n else\n {\n flag = 0;\n break;\n }\n }\n\n if (flag == 0)\n break;\n }\n\n if (flag == 1)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,i,j,k,sum,num,m,n;\n scanf(\"%d %d\",&l,&r);\n for(i=l;i<=r;i=i+1)\n {\n int count=0,result=0;\n k=i;\n m=i;\n for(j=1;j!=0;j=j+1)\n {\n sum=m%10;\n count=count+1;\n for(n=1;n!=0;n=n+1)\n {\n num=k%10;\n if(sum==num)\n {\n result=result+1;\n }\n k=k/10;\n if(k==0)\n {\n k=i;\n break;\n }\n }\n m=m/10;\n if(m==0)\n {\n break;\n }\n }\n if(result==count)\n {\n printf(\"%d\",i);\n exit(0);\n\n }\n }\n printf(\"-1\");\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = 100000000000; // 1e11\nll MIN = -100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll cnt[10];\n\nint main(int argc, char const *argv[])\n{\n ll T = 1;\n // scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll l,r;\n scanf(\"%lld %lld\",&l,&r);\n for (ll p = l; p <= r; p++)\n {\n ll r = p;\n ll array[300];\n ll ind = 0;\n while (r)\n {\n cnt[r%10]++;\n r /= 10;\n }\n ll fg = 0;\n for (ll i = 0; i <= 9; i++)\n {\n if(cnt[i]>=2)\n {\n fg = 1;\n }\n }\n if(!fg)\n {\n printf(\"%lld\\n\",p);\n return 0;\n }\n for (ll i = 0; i <= 9; i++)\n {\n cnt[i] = 0;\n }\n \n }\n printf(\"-1\\n\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,g,m;\nscanf(\"%d%d\",&m,&b);\nc=-1;\nd=-2;\ne=-4;\nf=-6;\ng=-7;\nwhile(m<=b)\n{\n a=m;\n c=a%10;\n a=a/10;\n if(a>0)\n {\n d=a%10;\n a=a/10;\n }\n\n\n if(a>0)\n {\n e=a%10;\n a=a/10;\n\n }\n\nif(a>0)\n{\n f=a%10;\n a=a/10;\n}\n\n\nif(a>0)\n{\n g=a%10;\n a=a/10;\n\n}\n if((c!=d)&&(c!=e)&&(c!=f)&&(c!=g)&&(d!=g)&&(d!=e)&&(d!=f)&&(e!=f)&&(e!=g)&&(f!=g))\n {\n printf(\"%d\\n\",m);\n break;\n }\n else\n {\n if(m==b)\n printf(\"%d\\n\",-1);\n }\nm++;\n\n}\n\n\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint i,m=a-1,n,p;\n\tint k[6];\ns:\tif (m<b) {\n\t\tm++;\n\t\tp=m;\n\t\tfor (i=0;i<6;i++) {\n\t\t\tk[i]=p%10;\n\t\t\tp/=10;\n\t\t}\n\t\tfor (i=5;i>=0;i--) {\n\t\t\tif (k[i]==0) {\n\t\t\t\tk[i]=10+i;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (i=0;i<6;i++) {\n\t\t\tfor (n=i+1;n<6;n++) {\n\t\t\t\tif (k[i]==k[n]) {\n\t\t\t\t\tgoto s;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",m);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n}\n"}, {"source_code": "#include <stdio.h>\nint check_digits(long n)\n{\n\tint s[8], i = 0, j, count = 0, total;\n\tdo{\n\t\ts[i] = n % 10;\n\t\tn = n / 10;\n\t\ti++;\n\t}\n\twhile (n != 0);\n\ttotal = i;\n\tfor (i = 0; i < (total - 1); i++ ){\n\t\tfor (j = i + 1; j < total; j++){\n\t\t\tif (s[i] == s[j]) count++;\n\t\t}\n\t}\n\tif (count == 0) return 1;\n\telse return 0;\n}\nint main()\n{\n\tlong a, b, n, i = 0;\n\tscanf(\"%ld %ld\", &a, &b);\n\tfor (n = a; n <= b; n++){\n\t\tif (check_digits(n) == 1) i++;\n\t}\n\tif (i == 0) printf(\"-1\");\n\telse {\n\t\tfor (n = a; n <= b; n++){\n\t\t\tif (check_digits(n) == 1){\n\t\t \tprintf(\"%d \", n);\n\t\t \tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint unique(int x)\n{\n int flag[10] = {};\n while(x)\n {\n int d = x%10;\n if(!flag[d])\n flag[d] = 1;\n else return 0;\n x/=10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n\n for(int i = l; i <= r ; i++)\n if(unique(i))\n {\n printf(\"%d\",i);\n return 0;\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{ long int l,r,x,d,rem,z,y;\n int b[10]={0};\nscanf(\"%ld %ld\",&l,&r);\nfor(x=l;x<=r;x++)\n{ y=x;\nwhile(x!=0)\n{ rem=x%10;\nif(b[rem]==0)\n{ b[rem]=1;}\nelse\n{ z=1; \n break;}\nx=x/10;}\nx=y;\nif(z==1)\n{z=0;\nb[0]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[9]=b[8]=0;\ncontinue;}\nelse\nbreak;}\nif(x<=r)\nprintf(\"%ld\",x);\nelse\nprintf(\"%d\",-1);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,i,j,k,sum,num,m,n;\n scanf(\"%d %d\",&l,&r);\n for(i=l;i<=r;i=i+1)\n {\n int count=0,result=0;\n k=i;\n m=i;\n for(j=1;j!=0;j=j+1)\n {\n sum=m%10;\n count=count+1;\n for(n=1;n!=0;n=n+1)\n {\n num=k%10;\n if(sum==num)\n {\n result=result+1;\n }\n k=k/10;\n if(k==0)\n {\n k=i;\n break;\n }\n }\n m=m/10;\n if(m==0)\n {\n break;\n }\n }\n if(result==count)\n {\n printf(\"%d\",i);\n exit(0);\n\n }\n }\n printf(\"-1\");\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,x,d,e,f;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(x>=l&&x<=r)\n {\n if(x<10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n if(x>=10&&x<=99)\n {\n if(x/10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n if(x>=100&&x<=999)\n {\n d=x/10;\n if(d/10!=d%10)\n {\n if(d/10!=x%10&&d%10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n }\n if(x>=1000&&x<=9999)\n {\n d=x/10;\n e=d/10;\n if(e/10!=e%10)\n {\n if(e/10!=d%10&&e%10!=d%10)\n {\n if(e/10!=x%10&&d%10!=x%10&&e%10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n }\n }\n if(x>=10000&&x<=99999)\n {\n d=x/10;\n e=x/100;\n f=x/1000;\n if(f/10!=f%10)\n {\n if(f/10!=e%10&&f%10!=e%10)\n {\n if(f/10!=d%10&&f%10!=d%10&&e%10!=d%10)\n {\n if(f/10!=x%10&&f%10!=x%10&&e%10!=x%10&&d%10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n }\n }\n }\n x++;\n }\n printf(\"-1\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint solution(int left, int right){\n if(left>right)\n return -1;\n int digit[6];\n int use[10],ruse[10];\n int width;\n memset(digit,0,sizeof(digit));\n memset(use,0,sizeof(use));\n memset(ruse,0,sizeof(ruse));\n int tmpl = left;\n int ret,fdp=-1;\n for(width =0;tmpl>0;width++,tmpl /= 10){\n digit[width]=tmpl%10;\n }\n// for(int i=0;i<6;i++)\n// printf(\"%d\",digit[i]);\n for(int i=width-1;i>=0;i--){\n if(!use[digit[i]])\n use[digit[i]] = 1;\n else\n fdp = fdp>i?fdp:i;\n }\n// printf(\"fdp=%d \\n\",fdp);\n// printf(\"--width=%d---\\n\",width);\n if(fdp>=0){\n for(int i=width-1;i>fdp;i--)\n ruse[digit[i]] = 1;\n// for(int i=0;i<10;i++)\n// printf(\"%d\",ruse[i]);\n\n int tmp;\n for(tmp=digit[fdp];tmp<10;tmp++){\n if(!ruse[tmp])\n break;\n }\n// printf(\"\\ntmp=%d\\n\",tmp);\n if(tmp<10){\n digit[fdp] = tmp;\n ruse[tmp] = 1;\n for(int i=fdp-1;i>=0;i--){\n int min;\n for(min=0;min<10;min++)\n if(!ruse[min])\n break;\n digit[i] = min;\n ruse[min] = 1;\n// printf(\"min=%d\",min);\n }\n// printf(\"--width=%d---\\n\",width);\n// for(int i=width-1;i>=0;i--)\n// printf(\"%d\",digit[i]);\n }\n else{\n int nz;\n for(nz=fdp+1;;nz++){\n if(nz>=width){\n width++;\n break;\n }\n\n ruse[digit[nz]]=0;\n if(nz>=width)\n break;\n if(nz<width && (digit[nz]<9 && !ruse[digit[nz]+1]))\n break;\n }\n// printf(\"nz=%d\\n\",nz);\n// for(int i=0;i<nz+1;i++)\n// printf(\"ruse[%d]=%d\\n\",i,ruse[i]);\n// printf(\"digit[nz]=%d\\n\",digit[nz]);\n digit[nz]++;\n ruse[digit[nz]]=1;\n for(int i=nz-1;i>=0;i--){\n int min;\n for(min=0;min<10;min++)\n if(!ruse[min])\n break;\n digit[i] = min;\n ruse[min] = 1;\n// printf(\"min=%d\\n\",min);\n }\n// printf(\"--width=%d---\\n\",width);\n }\n ret = 0;\n for(int i=width-1;i>=0;i--)\n ret=ret*10+digit[i];\n// printf(\"ret=%d \\n\",ret);\n }\n else\n ret = left;\n ret=ret<=right?ret:-1;\n return ret;\n}\nint main(){\n int left =2234;\n int right = 2343;\n while(~scanf(\"%d%d\",&left,&right)){\n int result=solution(left,right);\n printf(\"%d\\n\",result);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = 100000000000; // 1e11\nll MIN = -100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll cnt[10];\n\nint main(int argc, char const *argv[])\n{\n ll T = 1;\n // scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll l,r;\n scanf(\"%lld %lld\",&l,&r);\n for (ll p = l; p <= r; p++)\n {\n ll r = p;\n ll array[300];\n ll ind = 0;\n while (r)\n {\n cnt[r%10]++;\n r /= 10;\n }\n ll fg = 0;\n for (ll i = 0; i <= 9; i++)\n {\n if(cnt[i]>=2)\n {\n fg = 1;\n }\n }\n if(!fg)\n {\n printf(\"%lld\\n\",p);\n return 0;\n }\n for (ll i = 0; i <= 9; i++)\n {\n cnt[i] = 0;\n }\n \n }\n printf(\"-1\\n\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int i,j,m,s;\n for(i=a;i<=b;i++)\n {\n m=i;\n int k[10]={0};\n while(m!=0)\n {\n k[m % 10]++;\n m/=10;\n }\n s=0;\n for(j=0;j<10;j++)\n {\n if(k[j]>1)\n s++;\n }\n if(s==0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdlib.h>\n#include<stdlib.h>\nint main()\n{\n long int l,r,i,ar[6],remi,j=0,k,num,p,count;\n scanf(\"%ld %ld\",&l,&r);\n if(1<=l&&l<=r&&r<=100000)\n {\n for(i=l;i<=r;i++)\n {\n j=0;\n remi=i;\n while(remi!=0)\n {\n\n ar[j]=remi%10;\n remi=remi/10;\n j++;\n }\n count=0;\n for(k=0;k<j;k++)\n {\n for(num=k+1;num<j;num++)\n {\n if(ar[k]==ar[num])\n {\n count=count+1;\n\n\n }\n\n }\n if(count!=0)\n break;\n }\n if(count==0)\n {\n for(p=j-1;p>=0;p--)\n printf(\"%ld\",ar[p]);\n exit(0);\n }\n\n\n }\n if(count!=0)\n printf(\"%ld\",-1);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,i,num1,num,CS,len,k1,k;\n int a[10]={0,1,2,3,4,5,6,7,8,9};\n int ch[10];\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n while(n<=m)\n {\n k1=0;k=0;\n memset(ch, 0, sizeof(ch)); //\u6570\u7ec4\u5168\u90e8\u6e05\u96f6\n num1=10000;CS=5;\n for(i=0;5>i;i++) //\u5224\u65ad\u4f4d\u6570\n {\n if(((n/num1)%10)!=0) \n {\n len=CS;\n break;\n }\n else\n {\n CS--;\n num1/=10;\n }\n }\n num1=1;\n while(--len)\n num1*=10;\n while(num1>=1)\n {\n for(i=0;i<10;i++) //\u5224\u65ad\u6709\u65e0\u91cd\u590d\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //\u8bfb\u53d6ch\u4e2d\u6709\u591a\u5c11\u76f8\u540c\u7684\u6570\n {\n if(ch[i]>1)\n {\n k=1;\n break;\n }\n }\n if(k!=1)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n\t\t\t\t\t{\n n++;\n\t\t\t\t\t}\n if(n>=100000)\n {\n printf(\"-1\\n\");\n break;\n }\n if(n>m)\n {\n printf(\"-1\\n\");\n break;\n }\n }\n \n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%d%d\",&a,&b);\n int i,j,m,s;\n for(i=a;i<=b;i++)\n {\n m=i;\n int k[10]={0};\n while(m!=0)\n {\n k[m % 10]++;\n m/=10;\n }\n s=0;\n for(j=0;j<10;j++)\n {\n if(k[j]>1)\n s++;\n }\n if(s==0)\n {\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,r,j,a,b,t;\n scanf(\"%d%d\",&a,&b);\n t=0;\n for(i=a;i<=b;i++)\n {\n int q[10]={0};\n r=0;\n for(j=i;j>0;j=j/10)\n {\n if(q[j%10]==1)\n {\n r=1;\n break;\n }\n else q[j%10]=1;\n }\n if(r==0)\n {\n t=1;\n printf(\"%d\",i);\n break;\n }\n }\n if(t==0)\n {\n printf(\"-1\");\n }\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || (x>=r && m==-1))\n break;\n\n else\n x++;\n\n }\n if(l<10 && r<10)\n printf(\"%d\",l);\n else if (m==-1)\n printf(\"-1\");\n else \n \n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n\nint main()\n{\n int A, B, i, C, O, cifr [10]={0,1,2,3,4,5,6,7,8,9}, cch[10] = {0,0,0,0,0,0,0,0,0,0},j;\n scanf(\"%d %d\", &A, &B);\n for (i = A; i <= B+1; i++)\n {\n C = i;\n O = i;\n while (C != 0)\n {\n if (cch[C%10] == 1)\n break;\n else\n cch[C%10] = 1;\n C=C/10;\n if (C == 0)\n goto ass;\n }\n for (j=0; j<10; j++)\n {\n cch[j]=0;\n }\n }\n ass:;\n if (O == B+1)\n printf(\"-1\\n\");\n else\n printf(\"%d\\n\", O);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint difdig(int);\nint main(int argc, char *argv[]) \n{\n\tint i,a,b,flag=0;\n\t\n\tscanf(\"%d %d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tif(difdig(i))\n\t\t\tbreak;\n\t}\n\tif(i>b)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\",i);\n}\n\nint difdig(int num)\n{\n\tif(num>9999)\n\t{\n\t\tif(num/10000!=num/1000%10 && \n\t\t num/10000!=num/100%10 &&\n\t\t num/10000!=num/10%10 &&\n\t\t num/10000!=num%10 &&\n\t\t num/1000%10!=num/100%10&&\n\t\t num/1000%10!=num/10%10 &&\n\t\t num/1000%10!=num%10 &&\n\t\t num/100%10!=num/10%10 &&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>999)\n\t{\n\t\tif(num/1000!=num/100%10 &&\n\t\t num/1000!=num/10%10 &&\n\t\t num/1000!=num%10 &&\n\t\t num/100%10!=num/10%10&&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>99)\n\t{\n\t\tif(num/100!=num/10%10 &&\n\t\t num/100!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>9)\n\t{\n\t\tif(num/10!=num%10)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse return 1;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || (x>=r && m==-1))\n break;\n\n else\n x++;\n\n }\n if(l<10 && r<10)\n printf(\"%d\",l);\n else if (m==-1)\n printf(\"-1\");\n else \n \n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint kt(int n){\n\tint a[10]={0};\n\twhile(n!=0){\n\t\tif(a[n%10]==1)\n\t\treturn 0;\n\t\telse\n\t\ta[n%10]=1;\n\t\tn/=10;\n\t}\n\treturn 1;\n}\nint main(){\n\tint l,r;\n\tscanf(\"%d%d\",&l,&r);\n\tfor(int i=l;i<=r;i++){\n\t\tif(kt(i)){\n\t\t\tprintf(\"%d\",i);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,r,i,j,k,n,m,p;\n char a[100000];\n\n scanf(\"%d %d\",&l,&r);\n n=0;\n for(i=l; i<=r; i++)\n {\n n=i;\n m=0;\n while(n!=0)\n {\n a[m++]=n%10;\n n=n/10;\n }\n p=0;\n for(j=0; j<m; j++)\n {\n for(k=j+1; k<m; k++)\n {\n if(a[j]==a[k])\n {\n p++;\n }\n }\n\n }\n if(p==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n if(p>0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\n\n#include<string.h>\nvoid sort(int x,int y,int z)\n{\n int i=0,j=0;\n\n}\nint main()\n{\n long long int ch[1000000];\n char arr[100000];\n int cp[4]= { 0,0,0,0 };\n int a,b,c,d,e=0,g,i=0,tep=0,temp=0,j=0,k=0,l=0,m=0,n=0;\n scanf(\"%d%d\",&a,&b);\n //int m;\n l=0;\n m=0;\n for(i=a; i<=b; i++)\n {\n j=i%10;\n l=1;\n if(i/10>0)\n {\n k=i/10%10;\n if(k!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/100>0)\n {\n m=i/100%10;\n if(m!=k && m!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/1000>0)\n {\n n=i/1000%10;\n if(n!=m && n!=k && n!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/10000>0)\n {\n e=i/10000%10;\n if(e!=j && e!=k && e!=m && e!=n)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(l==1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(l==0)\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nint a[6]={10,10,10,10,10,10};\nint l,r,x,y,z,m,n;\nscanf(\"%d %d\",&l,&r);\nwhile(l<=r){\n\tx=l;n=0;\n\tfor(y=0;y<6&&x!=0;y++){\n\t\ta[y]=x%10;\n\t\tx=(x-a[y])/10;\n\t}\n\tm=y;\n\tif(m==1){\n\t\tprintf(\"%d\",l);break;\n\t}\n\tfor(y=0;y<m-1&&n!=-1;y++){\n\t\tfor(z=y+1;z<m&&n!=-1;z++){\n\t\t\tif(a[y]!=a[z]){\n\t\t\t\tn=1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tn=-1;\n\t\t\t}\n\t\t}\n\t}\n\tif(n==1){\n\t\tprintf(\"%d\",l);break;\n\t}\n\tl++;\n}\nif(n==-1){\n\t\t\tprintf(\"%d\",n);\t\n}\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j,k,x,s=0,y,z,l=0,b=0;\n\tint a[1000];\n\tscanf(\"%d %d\",&m,&n);\n for(i=m;i<=n;i++){\n \ty=i;\n \t\n \twhile(y!=0)\n \t{\n \t\tx=y%10;\n \t\ta[s]=x;\n \t\ty=y/10;\n \t\ts++;\n \t}\n \tfor(j=0;j<s;j++){\n \t\tfor(k=j+1;k<s;k++){\n \t\t\tif(a[k]>a[j])\n \t\t\t{\n \t\t\tz=a[j];\n \t\t\ta[j]=a[k];\n \t\t\ta[k]=z;\n \t}\n \t\t}\n \t}\n \tfor(j=0;j<s;j++){\nif(j+1==s)\nbreak;\n \t\tif(a[j]!=a[j+1])\n \t\tl++;\n \t}\n \tif(l==s-1){\n \t \n b++;\n break;\n \t}\n \ts=0;\n \tl=0;\n }\n if(b>0)\n printf(\"%d\\n\",i);\n else\n printf(\"-1\\n\");\n\t\n\t\n\treturn 0;\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,l,k,i,j,r,y,a[15],o;\n scanf(\"%d %d\",&k,&m);\n for(l=k;l<=m;l++)\n {\n n=l;\n for(i=0;1<2;i++)\n {\n a[i]=n%10;\n n=n/10;\n if(n==0)\n break;\n }\n r=1;y=1;\n for(j=0;j<i;j++)\n {\n for(o=r;o<=i;o++)\n {\n if(a[j]==a[o])\n {\n y++;\n break;\n }\n \n }\n r++;\n if(y>1)\n break;\n }\n if(j==i)\n break;\n }\n if(j==i)\n printf(\"%d\",l);\n else\n printf(\"-1\");\n \n}"}, {"source_code": "#include<stdio.h>\nint isdifferent(int x)\n{\n\tint a[11],d,val=0,i;\n\tfor(i=0;i<11;i++)\n\t{\n\t\ta[i]=0;\n\t}\n\twhile(x>0)\n\t{\n\t\td=x%10;\n\t\tx=x/10;\n\t//\tprintf(\"%d\\t\",d);\n\t\tif(a[d]==1)\n\t\t{\n\t\t\tval=-1;\n\t\t}\n\t\telse{\n\t\t\ta[d]=1;\n\t\t}\n\t}\n\tprintf(\"\\n\");\n\t\n\treturn val;\n}\nint main()\n{\n\tint l,x,r,i,k=0;\n\tscanf(\"%d%d\",&l,&r);\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tif(isdifferent(i)==0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tk++;\t\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(k==0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,k,i=0,c=0,s,p=0,t;\n scanf(\"%d %d\",&x,&k);\n int n[100];\n while(x<=k)\n {\n p=0;\n i=0;\n t=x;\n while(t!=0)\n {\n s=t%10; n[i]=s; t=t/10; i++; p++;\n }\n\n for(i=p-1;i>=0;i--)\n {\n for(int j=i-1;j>=0;j--)\n {\n if(n[i]==n[j]) { c++; break; }\n }\n }\n if(c==0) break; c=0; x++;\n }\n //printf(\"%d\\n\",x);\n if(x<=k)\n printf(\"%d\",x);\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "\n#include <stdio.h>\n\n#define fo(i,a,b) for(i=(a);i<=(b);i++)\n#define of(i,a,b) for(i=(a);i>=(b);i--)\n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n\nint readInt()\n{\n int n;\n scanf(\"%d\", &n);\n return n;\n}\n\nint good(int x) {\n int used[10];\n int i;\n fo(i,0,9)used[i]=0;\n while (x) {\n int t = x%10;\n if (used[t]) return 0;\n used[t] = 1;\n x/=10;\n }\n return 1;\n}\n\nint main()\n{\n int a = readInt();\n int b = readInt();\n int i;\n fo(i,a,b) if (good(i)) {printf(\"%d\\n\", i); return 0;}\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n long int l,r,i,a[6],rem,j=0,k,n,m,flag;\n scanf(\"%ld %ld\",&l,&r);\n if(1<=l&&l<=r&&r<=100000)\n {\n for(i=l;i<=r;i++)\n {\n j=0;\n rem=i;\n while(rem!=0)\n {\n\n a[j]=rem%10;\n rem=rem/10;\n j++;\n }\n flag=0;\n for(k=0;k<j;k++)\n {\n for(n=k+1;n<j;n++)\n {\n if(a[k]==a[n])\n {\n flag=flag+1;\n\n\n }\n\n }\n if(flag!=0)\n break;\n }\n if(flag==0)\n {\n for(m=j-1;m>=0;m--)\n printf(\"%ld\",a[m]);\n exit(0);\n }\n\n\n }\n if(flag!=0)\n printf(\"%ld\",-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || (x>=r && m==-1))\n break;\n\n else\n x++;\n\n }\n if(l<10 && r<10)\n printf(\"%d\",l);\n else if (m==-1)\n printf(\"-1\");\n else \n \n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint digits[1000010];\n\nint main()\n{\n int l, r;\n scanf(\"%d %d\", &l, &r);\n\n if (l <= 10)\n {\n printf(\"%d\\n\", l);\n return 0;\n }\n\n for (int i = l; i <= r; i++)\n {\n int j = 0;\n int num = i;\n\n while (num > 0)\n {\n digits[j] = num % 10;\n j++;\n num /= 10;\n }\n\n int flag = 0;\n\n for (int l = 0; l < j; l++)\n {\n for (int k = l + 1; k < j; k++)\n {\n if (digits[l] != digits[k])\n flag = 1;\n\n else\n {\n flag = 0;\n break;\n }\n }\n\n if (flag == 0)\n break;\n }\n\n if (flag == 1)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint isdis(long long int n)\n{\n int a[10],i;\n for( i=0;i<10;i++)\n {\n a[i]=0;\n }\n \n while(n>0)\n {\n int r=n%10;\n if(a[r])\n {\n return 0;\n }\n else\n {\n a[r]=1;\n }\n n=n/10;\n \n }\n return 1;\n}\nint main()\n{\n int f=1;\n long long int a,b,val;\n scanf(\"%lld %lld\",&a,&b);\n val=a;\n while(val<=b)\n {\n if(isdis(val))\n {\n f=0;\n break;\n }\n val++;\n }\n if(f==0)\n {\n printf(\"%lld\",val);\n \n \n }\n else\n {\n printf(\"-1\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint difdig(int);\nint main(int argc, char *argv[]) \n{\n\tint i,a,b,flag=0;\n\t\n\tscanf(\"%d %d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tif(difdig(i))\n\t\t\tbreak;\n\t}\n\tif(i>b)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\",i);\n}\n\nint difdig(int num)\n{\n\tif(num>9999)\n\t{\n\t\tif(num/10000!=num/1000%10 && \n\t\t num/10000!=num/100%10 &&\n\t\t num/10000!=num/10%10 &&\n\t\t num/10000!=num%10 &&\n\t\t num/1000%10!=num/100%10&&\n\t\t num/1000%10!=num/10%10 &&\n\t\t num/1000%10!=num%10 &&\n\t\t num/100%10!=num/10%10 &&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>999)\n\t{\n\t\tif(num/1000!=num/100%10 &&\n\t\t num/1000!=num/10%10 &&\n\t\t num/1000!=num%10 &&\n\t\t num/100%10!=num/10%10&&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>99)\n\t{\n\t\tif(num/100!=num/10%10 &&\n\t\t num/100!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>9)\n\t{\n\t\tif(num/10!=num%10)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse return 1;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint distinct(int n)\n{\n int a[10]={0,0,0,0,0,0,0,0,0,0};\n int flag=1;\n while(n>0)\n {\n a[n%10]++;\n if(a[n%10]>1)\n {\n flag=0;\n break;\n }\n n=n/10;\n }\n return flag;\n}\nint main()\n{\n int a, b;\n scanf (\"%d %d\", &a, &b);\n int flag=1;\n for(int i=a;i<=b;i++)\n {\n if(distinct(i))\n {\n printf(\"%d\",i);\n flag=0;\n break;\n }\n }\n if(flag==1)\n printf(\"%d\",-1);\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint check_digits(long n)\n{\n\tint s[8], i = 0, j, count = 0, total;\n\tdo{\n\t\ts[i] = n % 10;\n\t\tn = n / 10;\n\t\ti++;\n\t}\n\twhile (n != 0);\n\ttotal = i;\n\tfor (i = 0; i < (total - 1); i++ ){\n\t\tfor (j = i + 1; j < total; j++){\n\t\t\tif (s[i] == s[j]) count++;\n\t\t}\n\t}\n\tif (count == 0) return 1;\n\telse return 0;\n}\nint main()\n{\n\tlong a, b, n, i = 0;\n\tscanf(\"%ld %ld\", &a, &b);\n\tfor (n = a; n <= b; n++){\n\t\tif (check_digits(n) == 1) i++;\n\t}\n\tif (i == 0) printf(\"-1\");\n\telse {\n\t\tfor (n = a; n <= b; n++){\n\t\t\tif (check_digits(n) == 1){\n\t\t \tprintf(\"%d \", n);\n\t\t \tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ long int l,r,x,d,rem,z,y;\n int b[10]={0};\nscanf(\"%ld %ld\",&l,&r);\nfor(x=l;x<=r;x++)\n{ y=x;\nwhile(x!=0)\n{ rem=x%10;\nif(b[rem]==0)\n{ b[rem]=1;}\nelse\n{ z=1; \n break;}\nx=x/10;}\nx=y;\nif(z==1)\n{z=0;\nb[0]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[9]=b[8]=0;\ncontinue;}\nelse\nbreak;}\nif(x<=r)\nprintf(\"%ld\",x);\nelse\nprintf(\"%d\",-1);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint isok(int n)\n{\n int l=0,i,p=n,a[10]={0};\n while(p>0)\n {\n i=p%10;\n a[i]++;\n p=p/10;\n\n }\n for(i=0;i<10;i++)\n {\n if(a[i]>1) break;\n }\n if(i==10) return 1;\n else return 0;\n\n\n}\nint main()\n{\n int l,r,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l ; i<=r ;i++)\n {\n if( isok(i)==1 )\n {\n break;\n }\n }\n if(i==r+1) printf(\"-1\\n\");\n else printf(\"%d\\n\",i);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint distinct(int n)\n{\n int a[10]={0,0,0,0,0,0,0,0,0,0};\n int flag=1;\n while(n>0)\n {\n a[n%10]++;\n if(a[n%10]>1)\n {\n flag=0;\n break;\n }\n n=n/10;\n }\n return flag;\n}\nint main()\n{\n int a, b;\n scanf (\"%d %d\", &a, &b);\n int flag=1;\n for(int i=a;i<=b;i++)\n {\n if(distinct(i))\n {\n printf(\"%d\",i);\n flag=0;\n break;\n }\n }\n if(flag==1)\n printf(\"%d\",-1);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint fun(int n)\n{\n int ara[]={1,1,1,1,1,1,1,1,1,1};\n int q=n;\n while(q)\n {\n if(ara[(q%10)]==1)\n ara[q%10]=0;\n else\n return -1;\n q=q/10;\n }\n return n;\n}\nint main()\n{\n int l,r,ans,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l;i<=r;i++)\n {\n ans=fun(i);\n if(ans!=-1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(i==r+1)\n printf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long l,r,i,c=0,j,k,count,a[10],num;\n scanf(\"%ld %ld\",&l,&r);\n for(i=l;i<=r;i++)\n {\n num=i;\n while(i)\n {\n c++;\n i=i/10;\n }\n i=num;\n for(j=0;j<c;j++)\n {\n a[j]=i%10;\n i=i/10;\n }\n count=c;\n for(j=0;j<c-1;j++)\n {\n for(k=j+1;k<c;k++)\n {\n if(a[j]==a[k])\n {\n count--;\n break;\n }\n }\n }\n if(c==count)\n {\n printf(\"%ld\",num);\n break;\n }\n c=0;\n i=num;\n }\n if(i>r)printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<=r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r+1)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,r,j,a,b,t;\n scanf(\"%d%d\",&a,&b);\n t=0;\n for(i=a;i<=b;i++)\n {\n int q[10]={0};\n r=0;\n for(j=i;j>0;j=j/10)\n {\n if(q[j%10]==1)\n {\n r=1;\n break;\n }\n else q[j%10]=1;\n }\n if(r==0)\n {\n t=1;\n printf(\"%d\",i);\n break;\n }\n }\n if(t==0)\n {\n printf(\"-1\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<=r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r+1)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdlib.h>\n#include<stdlib.h>\nint main()\n{\n long int l,r,i,ar[6],remi,j=0,k,num,p,count;\n scanf(\"%ld %ld\",&l,&r);\n if(1<=l&&l<=r&&r<=100000)\n {\n for(i=l;i<=r;i++)\n {\n j=0;\n remi=i;\n while(remi!=0)\n {\n\n ar[j]=remi%10;\n remi=remi/10;\n j++;\n }\n count=0;\n for(k=0;k<j;k++)\n {\n for(num=k+1;num<j;num++)\n {\n if(ar[k]==ar[num])\n {\n count=count+1;\n\n\n }\n\n }\n if(count!=0)\n break;\n }\n if(count==0)\n {\n for(p=j-1;p>=0;p--)\n printf(\"%ld\",ar[p]);\n exit(0);\n }\n\n\n }\n if(count!=0)\n printf(\"%ld\",-1);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint digit(int n, int ord) {\n for(int i=0;i<ord;i++) {\n n=n/10;\n }\n return n%10;\n}\n\nint numl(int n) {\n int k=0;\n while(n!=0) {\n n=n/10;\n k+=1;\n }\n return k;\n}\n\nint main(void) {\n int a,b;\n scanf(\"%d %d\", &a, &b);\n for(int i=a;i<=b;i++) {\n int app[10]={};\n int pass=1;\n for(int j=0;j<numl(i);j++) {\n if (app[digit(i,j)]==1) {\n pass=0;\n break;\n }\n app[digit(i,j)]=1;\n }\n if (pass==1) {\n printf(\"%d\", i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint r,l,x,i,a[]={0,0,0,0,0,0,0,0,0,0},stop=0,n,k=0;\n\tscanf(\"%d %d\",&l,&r);\n\tfor(x=l;x<=r&&x>=l;x++){\n\t\tfor(n=x;n>=1;n/=10){\n\t\ta[n%10]++;\n\t }\n\tfor(i=0;i<10;i++){\n\t\tif(a[i]<2)\n\t\tstop+=1;\n\t\ta[i]=0;\t\n\t}\n\tif(stop==10){\n\tprintf(\"%d \",x);\n\tk=1;\n\tbreak;}\n\tstop=0;\n\t}\n\tif(k==0){\n\tprintf(\"-1\");}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n int l, r;\n int true_number = -1;\n\n scanf(\"%d%d\", &l, &r);\n\n for(int s = l; s <= r; ++s){\n int vec[10] = {0}, final = 1;\n int len_num = 0, number, num_list[100];\n char result[100], cha[2];\n\n sprintf(result, \"%d\", s);\n for(int i = 0; result[i] != '\\0'; ++i){\n ++len_num;\n cha[0] = result[i];\n //printf(\"%s \",cha);\n sscanf(cha, \"%d\", &number);\n num_list[i] = number;\n }\n //printf(\"\\n\");\n\n for(int i = 0; i < len_num; ++i){\n //printf(\"%d \",num_list[i]);\n vec[num_list[i]] += 1;\n }\n //printf(\"\\n\");\n\n for(int i = 0; i < 10; ++i){\n if (vec[i] > 1){\n final = 0;\n }\n }\n if (final) {\n true_number = s;\n break;\n }\n }\n printf(\"%d\\n\", true_number);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isseprate(int x){\n int arr[6]={0};\n int i=0,ans;\n ans=x;\n while(x!=0){\n arr[i++]=x%10;\n x/=10;\n }\n for(int j=0;j<i;j++){\n for(int k=j+1;k<i;k++){\n if(arr[k]==arr[j]){\n return 0;\n }\n }\n }\n printf(\"%d\", ans);\n return 1;\n}\n\nint main()\n{\n int a,b,flag=0;\n scanf(\"%d %d\", &a,&b);\n for(int i=a;i<=b;i++){\n if(isseprate(i)){\n flag=1;\n break;\n }\n }\n if(flag==0){\n printf(\"-1\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,i,j;\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++){\n int f[10]={0},flag=1;\n for(j=i;j>0;j=j/10){\n if(f[j%10]==1){\n flag = 0;\n break;\n }\n else f[j%10] = 1;\n }\n if(flag == 1){\n printf(\"%d\",i);\n return 0;\n }\n }\n printf(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n\nint l,r,x,i,j,v[10],nr,aux,ok1,ok2;\nint main()\n{\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n for(x=l;x<=r;x++)\n {\n ok2=1;\n aux=x;\n for(i=0;i<=9;i++)\n v[i]=0;\n while(aux!=0)\n {\n v[aux%10]++;\n aux=aux/10;\n }\n for(i=0;i<=9;i++)\n if(v[i]>1)\n ok2=0;\n if(ok2==1)\n {\n ok1=1;\n printf(\"%d\",x);\n break;\n }\n }\n if(ok1==0)\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n, m, i, j, g, u, x;\n char a[100];\n\n scanf(\"%d %d\", &n, &m);\n u = 0;\n\n for(i=0; n<=m; i++)\n {\n sprintf(a, \"%d\", n);\n x = strlen(a);\n for(j=0; j<x-1; j++)\n {\n for(g=j+1; g<x; g++)\n {\n if(a[j]==a[g])\n goto h;\n }\n }\n if(j==x-1)\n {\n u++;\n goto hh;\n }\n h:\n n = n+1;\n }\n\n printf(\"-1\");\n\n hh:\n if(u==1)\n printf(\"%d\", n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int l,r,i,k,j,t,p,s,m,count,tem,cot=0,a[100001];\n scanf(\"%ld%ld\",&l,&r);\n for(i=l;i<=r;i++)\n {\n k=i;\n j=0;\n count=0;\n while(k!=0)\n {\n t=k%10;\n k=k/10;\n a[j]=t;\n j++;\n }\n for(s=1;s<j;s++)\n {\n for(p=0;p<j-1;p++)\n {\n if(a[p]>a[p+1])\n {\n tem=a[p];\n a[p]=a[p+1];\n a[p+1]=tem;\n }\n }\n }\n for(m=0;m<j-1;m++)\n {\n if(a[m]==a[m+1])\n break;\n else\n count++;\n }\n if((count+1)==j)\n {\n printf(\"%ld\",i);\n break;\n }\n else\n {\n cot++;\n }\n\n }\n if(cot==(r-l)+1)\n printf(\"-1\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint isseprate(int x){\n int arr[6]={0};\n int i=0,ans;\n ans=x;\n while(x!=0){\n arr[i++]=x%10;\n x/=10;\n }\n for(int j=0;j<i;j++){\n for(int k=j+1;k<i;k++){\n if(arr[k]==arr[j]){\n return 0;\n }\n }\n }\n printf(\"%d\", ans);\n return 1;\n}\n\nint main()\n{\n int a,b,flag=0;\n scanf(\"%d %d\", &a,&b);\n for(int i=a;i<=b;i++){\n if(isseprate(i)){\n flag=1;\n break;\n }\n }\n if(flag==0){\n printf(\"-1\");\n }\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r;\nscanf(\"%d%d\", &l , &r);\nint i,t=-2,j,k;\nfor(i=l;i<=r;i++)\n{\n t=-2;\nint a[6];\nint c=i;\nint x=0;\nint p=0;\nwhile(c)\n{\n a[p]=(c)%10;\n c=c/10;\n x++;\n p++;\n}\n\n\nfor ( j = 0; j < x; j++)\n{\n for (k = j + 1; k < x; k++)\n if (a[j] == a[k])\n {\n t= -1;\n break;\n }\nif(t==-1)\nbreak;\n}\nif(t==-2)\n{\nprintf(\"%d\", i);\nbreak;\n}\nif(i==r && t==-1)\nprintf(\"-1\");\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint l,r,i,j,k=0,x,y,count=0,arr[10],flag=0;;\n\tscanf(\"%d%d\",&l,&r);\n\tfor(i=l;i<=r;i++)\n\t{\n\t\tk=0;\n\t\tfor(j=i;j>0;j/=10)\n\t\t{\n\t\t\tarr[k]=j%10;\n\t\t\tk++;\n\t\t}\n\t\tcount=0;\n\t\tfor(x=0;x<k;x++)\n\t\t{\n\t\t\tfor(y=0;y<k;y++)\n\t\t\t{\n\t\t\t\tif(arr[x]==arr[y])\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tif(count==k)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",i);\n\t\t\t\tflag=1;\n\t\t\t\texit(0);\n\t\t\t}\n\t}\n\tif(flag==0)\n\tprintf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint difdig(int);\nint main(int argc, char *argv[]) \n{\n\tint i,a,b,flag=0;\n\t\n\tscanf(\"%d %d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tif(difdig(i))\n\t\t\tbreak;\n\t}\n\tif(i>b)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\",i);\n}\n\nint difdig(int num)\n{\n\tif(num>9999)\n\t{\n\t\tif(num/10000!=num/1000%10 && \n\t\t num/10000!=num/100%10 &&\n\t\t num/10000!=num/10%10 &&\n\t\t num/10000!=num%10 &&\n\t\t num/1000%10!=num/100%10&&\n\t\t num/1000%10!=num/10%10 &&\n\t\t num/1000%10!=num%10 &&\n\t\t num/100%10!=num/10%10 &&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>999)\n\t{\n\t\tif(num/1000!=num/100%10 &&\n\t\t num/1000!=num/10%10 &&\n\t\t num/1000!=num%10 &&\n\t\t num/100%10!=num/10%10&&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>99)\n\t{\n\t\tif(num/100!=num/10%10 &&\n\t\t num/100!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>9)\n\t{\n\t\tif(num/10!=num%10)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse return 1;\n}"}, {"source_code": "#include <stdio.h>\nint check_digits(long n)\n{\n\tint s[8], i = 0, j, count = 0, total;\n\tdo{\n\t\ts[i] = n % 10;\n\t\tn = n / 10;\n\t\ti++;\n\t}\n\twhile (n != 0);\n\ttotal = i;\n\tfor (i = 0; i < (total - 1); i++ ){\n\t\tfor (j = i + 1; j < total; j++){\n\t\t\tif (s[i] == s[j]) count++;\n\t\t}\n\t}\n\tif (count == 0) return 1;\n\telse return 0;\n}\nint main()\n{\n\tlong a, b, n, i = 0;\n\tscanf(\"%ld %ld\", &a, &b);\n\tfor (n = a; n <= b; n++){\n\t\tif (check_digits(n) == 1) i++;\n\t}\n\tif (i == 0) printf(\"-1\");\n\telse {\n\t\tfor (n = a; n <= b; n++){\n\t\t\tif (check_digits(n) == 1){\n\t\t \tprintf(\"%d \", n);\n\t\t \tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,i,j,k=-1,q,p;\n scanf(\"%d %d\",&l,&r);\n for(i=l;i<=r;i++)\n { q=i;\n while(q!=0)\n {\n j=q/10;\n k=q%10;\n p=j%10;\n while(j!=0 && k!=p){\n j/=10;\n p=j%10;\n }\n if(j!=0)break;\n q/=10;\n }\n if(q==0){printf(\"%d\\n\",i);break;} \n }\n if(i>r)printf(\"-1\\n\");\n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\nint myfunction(long int value){\n int mycounter=1;\n bool arr[10];\n for(int i=0;i<10;i++){\n arr[i]=false;\n }\n while (value>0){\n int digit = value%10;\n if(arr[digit]){\n mycounter=0;\n return mycounter;\n }\n arr[digit]=true;\n value=value/10;\n }\n return mycounter;\n}\n\nint main(){\n long int l,r;\n scanf(\"%ld %ld\",&l,&r);\n int counter=0,flag=0;\n while(l<=r){\n counter=myfunction(l);\n if(counter==1){\n printf(\"%ld\",l);\n flag=1;\n break;\n }\n else{\n flag=0;\n l++;\n }\n }\n if(flag==0){\n printf(\"-1\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int l,r,i,j,k,c,g,f;\n scanf(\"%lld %lld\",&l,&r);\n if(l==r) \n { long long int a[100]={0};\n g=0;\n while(r>0)\n {\n a[r%10]++; r=r/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n g=1;\n }\n if(g==0) { printf(\"%lld\",l); }\n else printf(\"-1\",l);\n }\n else for(i=l+1;i<=r;i++)\n {\n long long int a[100]={0}, k=i; f=0;\n while(k>0)\n {\n a[k%10]++;\n k=k/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); break;}\n }\n if(f==1) printf(\"-1\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int a,b,c,d,i,j,k,n=0;\n char s[100000];\n scanf(\"%d%d\",&a,&b);\n for(i=a;i<=b;i++)\n {\n sprintf(s,\"%d\",i);\n int l=strlen(s);\n for(j=0;j<l-1;j++)\n {\n for(k=j+1;k<l;k++)\n {\n if(s[j]==s[k])\n {\n n++;\n }\n }\n\n\n }\n if(n==0)\n {\n break;\n }\n n=0;\n }\n if(i!=b+1)\n {\n printf(\"%d\",i);\n }\n else\n {\n printf(\"-1\");\n }\n\n\n\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int l, r;\n scanf(\"%d %d\", &l, &r);\n for(int i = l; i <= r; i++){\n int D[10] = { 0 };\n int n = i;\n int f = 0;\n while(n != 0){\n int d = n % 10;\n D[d]++;\n n /= 10;\n }\n for(int j = 0; j < 10; j++){\n if(D[j] > 1) {\n f = 1;\n break;\n }\n }\n if(!f) {\n printf(\"%d\", i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r;\nscanf(\"%d%d\", &l , &r);\nint i,t=-2,j,k;\nfor(i=l;i<=r;i++)\n{\n t=-2;\nint a[6];\nint c=i;\nint x=0;\nint p=0;\nwhile(c)\n{\n a[p]=(c)%10;\n c=c/10;\n x++;\n p++;\n}\n\n\nfor ( j = 0; j < x; j++)\n{\n for (k = j + 1; k < x; k++)\n if (a[j] == a[k])\n {\n t= -1;\n break;\n }\nif(t==-1)\nbreak;\n}\nif(t==-2)\n{\nprintf(\"%d\", i);\nbreak;\n}\nif(i==r && t==-1)\nprintf(\"-1\");\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int l,r,num,n,f=1,res=-1;\n scanf(\"%d%d\",&l,&r);\n for(int i=l;i<=r&&f==1;i++)\n {\n int g=0,d=0;\n n=i;\n num=i;\n while(n)\n {\n n/=10;\n d++;\n }\n int ar[d];\n for(int x=0;x<d;x++)\n {\n ar[x]=num%10;\n num/=10;\n }\n for(int j=0;j<d-1&&g==0;j++)\n {\n for(int k=j+1;k<d;k++)\n {\n if(ar[j]==ar[k])\n { \n g=1;\n break;\n }\n }\n }\n if(g==0)\n res=i;\n /*else\n res=-1;*/\n }\n \n printf(\"%d\",res);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <time.h>\n#include <limits.h>\ntypedef long long ll;\n\nll MAX = 100000000000; // 1e11\nll MIN = -100000000000; // -1e11\nll MOD = 1000000007;\n\nll longlongmax = __LONG_LONG_MAX__;\n\nll maxormin(ll a,ll b,ll flag){\n return flag==1?(a>b?a:b):(a<b?a:b);\n}\n\nll overflowcheck(ll a){\n if(a==1){\n return 0;\n }\n else\n {\n ll temp = a;\n ll power = 1;\n while( longlongmax/temp>a ){\n temp *= a;\n power++;\n }\n return power+1; // Overflow occurs at this power.\n }\n \n}\n\nll merge(ll A[],ll B[],ll left,ll mid,ll right){\n ll count = 0;\n ll n1 = mid-left+1; \n ll n2 = right-mid; \n\n ll LA[n1],LB[n1],RA[n1],RB[n2];\n\n for(ll n=0;n<n1;n++){ LA[n] = A[n+left];LB[n] = B[n+left];}\n for(ll n=0;n<n2;n++){ RA[n] = A[n+mid+1];RB[n] = B[n+mid+1];}\n \n ll i=0,j=0,k=left;\n\n while(i<n1&&j<n2){\n if(LA[i]<RA[j]){\n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n }\n else{\n A[k] = RA[j];\n B[k] = RB[j];\n count += n1-i;\n j++;\n }\n k++;\n }\n while(i<n1){ \n A[k] = LA[i];\n B[k] = LB[i];\n i++;\n k++;\n }\n\n while(j<n2){\n A[k] = RA[j];\n B[k] = RB[j];\n j++;\n k++; \n }\n return count;\n}\n\nll mergesort(ll A[],ll B[],ll left,ll right){\n ll total = 0;\n if(left<right){\n ll mid = (right-left)/2+left;\n total += mergesort(A,B,left,mid);\n total += mergesort(A,B,mid+1,right);\n total += merge(A,B,left,mid,right);\n }\n return total;\n}\n\nll cnt[10];\n\nint main(int argc, char const *argv[])\n{\n ll T = 1;\n // scanf(\"%lld\",&T);\n for(ll t = 0; t < T; t++)\n {\n ll l,r;\n scanf(\"%lld %lld\",&l,&r);\n for (ll p = l; p <= r; p++)\n {\n ll r = p;\n ll array[300];\n ll ind = 0;\n while (r)\n {\n cnt[r%10]++;\n r /= 10;\n }\n ll fg = 0;\n for (ll i = 0; i <= 9; i++)\n {\n if(cnt[i]>=2)\n {\n fg = 1;\n }\n }\n if(!fg)\n {\n printf(\"%lld\\n\",p);\n return 0;\n }\n for (ll i = 0; i <= 9; i++)\n {\n cnt[i] = 0;\n }\n \n }\n printf(\"-1\\n\");\n }\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int l,r,i,j,k,n,m,p;\n char a[100000];\n\n scanf(\"%d %d\",&l,&r);\n n=0;\n for(i=l; i<=r; i++)\n {\n n=i;\n m=0;\n while(n!=0)\n {\n a[m++]=n%10;\n n=n/10;\n }\n p=0;\n for(j=0; j<m; j++)\n {\n for(k=j+1; k<m; k++)\n {\n if(a[j]==a[k])\n {\n p++;\n }\n }\n\n }\n if(p==0)\n {\n printf(\"%d\\n\",i);\n break;\n }\n }\n if(p>0)\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tint i,m=a-1,n,p;\n\tint k[6];\ns:\tif (m<b) {\n\t\tm++;\n\t\tp=m;\n\t\tfor (i=0;i<6;i++) {\n\t\t\tk[i]=p%10;\n\t\t\tp/=10;\n\t\t}\n\t\tfor (i=5;i>=0;i--) {\n\t\t\tif (k[i]==0) {\n\t\t\t\tk[i]=10+i;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (i=0;i<6;i++) {\n\t\t\tfor (n=i+1;n<6;n++) {\n\t\t\t\tif (k[i]==k[n]) {\n\t\t\t\t\tgoto s;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",m);\n\t\treturn 0;\n\t}\n\tprintf(\"-1\");\n}\n"}, {"source_code": "#include <stdio.h>\nint a[10]={0};\nint is(int i)\n{\n\tint r,p=i,k=0;\n\twhile(i>0)\n\t{\n\t\tr=i%10;\n\t\ta[r]=a[r]+1;\n\t\tif(a[r]>1)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\ti=i/10;\n\t}\n\treturn 1;\n\t\n}\nint main()\n{\n\tint l,r,p=0;\n\tscanf(\"%d %d\",&l,&r);\n\tfor(int i=l;i<=r;i++)\n\t{\n\t\tfor(int j=0;j<10;j++)\n\t\t{\n\t\t\ta[j]=0;\n\t\t}\n\t\t//printf(\"%d\\n\",i);\n\t\tif(is(i))\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tp=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(p==0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint compare(void *pa, void *pb)\n{\n int *p1=pa;\n int *p2=pb;\n return *p1-*p2;\n}\n\nint main()\n{\n int N,M,i,j,k,a,b,c,x,y,s;\n int A[200000];\n\n scanf(\"%d %d\", &N,&M);\n\n for(c=N; c<=M; c++)\n {\n x=0;\n i=c;\n while(i>0)\n {\n a=i%10;\n A[x]=a;\n x++;\n i=i/10;\n }\n qsort(A,x,sizeof(int),compare);\n y=0;\n for(j=0; j<(x-1); j++)\n {\n if(A[j]==A[j+1])\n {\n y=1;\n break;\n }\n }\n if(y==0)\n {\n b=c;\n break;\n }\n }\n\n if(y==0)\n {\n printf(\"%d\\n\", b);\n }\n else\n {\n printf(\"-1\\n\");\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint khac(int n){\n\tint a[10]={};\n\twhile(n){\n\t\tint r=n%10;\n\t\tif(a[r]!=0)\n\t\treturn 0;\n\t\ta[r]=1;\n\t\tn/=10;\n\t}\n\treturn 1;\n}\nint main(){\n\tint l,r;\n\tscanf(\"%d%d\",&l,&r);\n\tint x=l;\n\tint a[100];\n\twhile(x<=r){\n\t\tif(khac(x)==1){\n\t\t\tprintf(\"%d\",x);\n\t\t\treturn 0;\n\t\t}\n\t\tx++;\n\t}\n\tprintf(\"-1\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int i,l,e=0,d,r,j,c=0;\n scanf(\"%d%d\",&l,&r);\n int a[10]={0};\n for(i=l;i<=r;i++)\n {\n d=i;\n while(d>0)\n {\n a[d%10]++;\n d=d/10;\n }\n for(j=0;j<10;j++)\n {\n if(a[j]<2)\n c++;\n }\n if(c==10)\n {\n printf(\"%d\\n\",i);\n e++;\n break;\n }\n else\n {\n for(j=0;j<10;j++)\n a[j]=0;\n c=0;\n }\n }\n if(d==0)\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long l,r,x,d,e,f;\n scanf(\"%lld %lld\",&l,&r);\n x=l;\n while(x>=l&&x<=r)\n {\n if(x>=10&&x<=99)\n {\n if(x/10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n if(x>=100&&x<=999)\n {\n d=x/10;\n if(d/10!=d%10)\n {\n if(d/10!=x%10&&d%10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n }\n if(x>=1000&&x<=9999)\n {\n d=x/10;\n e=x/100;\n if(e/10!=e%10)\n {\n if(e/10!=d%10&&e%10!=d%10)\n {\n if(e/10!=x%10&&d%10!=x%10&&e%10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n }\n }\n x++;\n }\n printf(\"-1\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long l,r,x,d,e,f;\n scanf(\"%lld %lld\",&l,&r);\n x=l;\n while(x>=l&&x<=r)\n {\n if(x<10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n if(x>=10&&x<=99)\n {\n if(x/10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n if(x>=100&&x<=999)\n {\n d=x/10;\n if(d/10!=d%10)\n {\n if(d/10!=x%10&&d%10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n }\n if(x>=1000&&x<=9999)\n {\n d=x/10;\n e=x/100;\n if(e/10!=e%10)\n {\n if(e/10!=d%10&&e%10!=d%10)\n {\n if(e/10!=x%10&&d%10!=x%10&&e%10!=x%10)\n {\n printf(\"%lld\\n\",x);\n return 0;\n }\n }\n }\n }\n x++;\n }\n printf(\"-1\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,x,d,e,f;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(x>=l&&x<=r)\n {\n if(x<10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n if(x>=10&&x<=99)\n {\n if(x/10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n if(x>=100&&x<=999)\n {\n d=x/10;\n if(d/10!=d%10)\n {\n if(d/10!=x%10&&d%10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n }\n if(x>=1000&&x<=9999)\n {\n d=x/10;\n e=d/10;\n if(e/10!=e%10)\n {\n if(e/10!=d%10&&e%10!=d%10)\n {\n if(e/10!=x%10&&d%10!=x%10&&e%10!=x%10)\n {\n printf(\"%d\\n\",x);\n return 0;\n }\n }\n }\n }\n x++;\n }\n printf(\"-1\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint l, x, r;\n\tint b, c, d, e, f, g;\n\tg = 0;\n\tscanf(\"%d %d\", &l, &r);\n\tfor (x = l; x <= r; x++) {\n\t\t\n\t\tb = (int)(x / 10000);\n\t\tc = (int)(x - 10000 * b) / 1000;\n\t\td = (int)(x - 10000 * b - 1000 * c)/100;\n\t\te = (int)(x - 10000 * b - 1000 * c - 100 * d) / 10;\n\t\tf = (int)(x - 10000 * b - 1000 * c - 100 * d - 10 * e)/1;\n\t\tg = 0;\n\t\t\n\t\t\t\n\t\t\tif (b != 0) {\n\t\t\t\tif (b != c && b != d && b != e && b != f && c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c != 0) {\n\t\t\t\tif (c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b == 0 && c == 0 && d != 0) {\n\t\t\t\tif (d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d == 0 && e != 0) {\n\t\t\t\tif (e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d ==0 && e ==0 &&f != 0) {\n\t\t\t\tprintf(\"%d\", x);\n\t\t\t\tg = 1;\n\t\t\t}\n\t\t\n\t\t\t\n\t}\n \n\tif (g == 0) {\n\t\tprintf(\"-1\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\nint main()\n{\n\tint l, x, r;\n\tint b, c, d, e, f, g;\n\tg = 0;\n\tscanf(\"%d %d\", &r, &l);\n\tfor (x = l; x <= r; x++) {\n\t\t\n\t\tb = (int)((x ) / 10000);\n\t\tc = (int)((x - 10000 * b) / 1000);\n\t\td = (int)((x - 10000 * b - 1000 * c)/100);\n\t\te = (int)((x - 10000 * b - 1000 * c - 100 * d) / 10);\n\t\tf = (int)((x - 10000 * b - 1000 * c - 100 * d - 10 * e)/1);\n\t\tg = 0;\n\t\t\n\t\t\t\n\t\t\tif (b != 0) {\n\t\t\t\tif (b != c && b != d && b != e && b != f && c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c != 0) {\n\t\t\t\tif (c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b == 0 && c == 0 && d != 0) {\n\t\t\t\tif (d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d == 0 && e != 0) {\n\t\t\t\tif (e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b * c * d * e * f != 0) {\n\t\t\t\tprintf(\"%d\", x);\n\t\t\t\tg = 1;\n\t\t\t}\n\t\t\n\t\t\t\n\t}\n\n\tif (g == 0) {\n\t\tprintf(\"-1\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint l, x, r;\n\tint b, c, d, e, f, g;\n\tg = 0;\n\tscanf(\"%d %d\", &l, &r);\n\tfor (x = l; x <= r; x++) {\n\t\t\n\t\tb = (int)((x ) / 10000);\n\t\tc = (int)((x - 10000 * b) / 1000);\n\t\td = (int)((x - 10000 * b - 1000 * c)/100);\n\t\te = (int)((x - 10000 * b - 1000 * c - 100 * d) / 10);\n\t\tf = (int)((x - 10000 * b - 1000 * c - 100 * d - 10 * e)/1);\n\t\tg = 0;\n\t\t\n\t\t\t\n\t\t\tif (b != 0) {\n\t\t\t\tif (b != c && b != d && b != e && b != f && c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c != 0) {\n\t\t\t\tif (c != d && c != e && c != f && d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (b == 0 && c == 0 && d != 0) {\n\t\t\t\tif (d != e && d != f && e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b == 0 && c == 0 && d == 0 && e != 0) {\n\t\t\t\tif (e != f) {\n\t\t\t\t\tprintf(\"%d\", x);\n\t\t\t\t\tg = 1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( b * c * d * e * f != 0) {\n\t\t\t\tprintf(\"%d\", x);\n\t\t\t\tg = 1;\n\t\t\t}\n\t\t\n\t\t\t\n\t}\n\n\tif (g == 0) {\n\t\tprintf(\"-1\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\n#include<string.h>\nvoid sort(int x,int y,int z)\n{\n int i=0,j=0;\n\n}\nint main()\n{\n long long int ch[1000000];\n char arr[100000];\n int cp[4]= { 0,0,0,0 };\n int a,b,c,d,e=0,g,i=0,tep=0,temp=0,j=0,k=0,l=0,m=0,n=0;\n scanf(\"%d%d\",&a,&b);\n //int m;\n l=0;\n m=0;\n for(i=a; i<=b; i++)\n {\n j=i%10;\n if(i/10>0)\n {\n k=i/10%10;\n if(k!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/100>0)\n {\n m=i/100%10;\n if(m!=k && m!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/1000>0)\n {\n n=i/1000%10;\n if(n!=m && n!=k && n!=j)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(i/10000>0)\n {\n e=i/10000%10;\n if(e!=j && e!=k && e!=m && e!=n)\n l=1;\n else\n {\n l=0;\n continue;\n }\n }\n if(l==1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(l==0)\n printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r;\nscanf(\"%d%d\", &l , &r);\nint i,t=-2,j,k;\nfor(i=l;i<=r;i++)\n{\n t=-2;\nint a[6];\nint c=i;\nint x=0;\nint p=0;\nwhile(c)\n{\n a[p]=(c)%10;\n c=c/10;\n x++;\n p++;\n}\n\n\nfor ( j = 0; j < x; j++)\n{\n for (k = j + 1; k < x; k++)\n if (a[j] == a[k])\n {\n t= -1;\n break;\n }\nif(t==-1)\nbreak;\n}\nif(t==-2)\n{\nprintf(\"%d\", i);\nbreak;\n}\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\nint distinct(int n)\n{\n int a[10]={0,0,0,0,0,0,0,0,0,0};\n int flag=1;\n while(n>0)\n {\n a[n%10]++;\n if(a[n%10]>1)\n {\n flag=0;\n break;\n }\n n=n/10;\n }\n return flag;\n}\nint main()\n{\n int a, b;\n scanf (\"%d %d\", &a, &b);\n int flag=1;\n for(int i=a;i<=b;i++)\n {\n if(distinct(i))\n {\n printf(\"%d\",i);\n break;\n flag=0;\n }\n }\n if(flag)\n printf(\"%d\",-1);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,i,num1,num,CS,len,k1,k;\n int a[10]={0,1,2,3,4,5,6,7,8,9};\n int ch[10];\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n while(n<=m)\n {\n k1=0;k=0;\n memset(ch, 0, sizeof(ch)); //\u6570\u7ec4\u5168\u90e8\u6e05\u96f6\n num1=10000;CS=5;\n for(i=0;5>i;i++) //\u5224\u65ad\u4f4d\u6570\n {\n if(((n/num1)%10)!=0) \n {\n len=CS;\n break;\n }\n else\n {\n CS--;\n num1/=10;\n }\n }\n num1=1;\n while(--len)\n num1*=10;\n while(num1>=1)\n {\n for(i=0;i<10;i++) //\u5224\u65ad\u6709\u65e0\u91cd\u590d\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //\u8bfb\u53d6ch\u4e2d\u6709\u591a\u5c11\u76f8\u540c\u7684\u6570\n {\n if(ch[i]>1)\n {\n k=1;\n break;\n }\n }\n if(k!=1)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n\t\t\t\t\t{\n n++;\n\t\t\t\t\t}\n if(n>=m)\n {\n printf(\"-1\\n\");\n break;\n }\n }\n \n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,m,i,num1,num,CS,len,k1,k;\n int a[10]={0,1,2,3,4,5,6,7,8,9};\n int ch[10];\n while(scanf(\"%d%d\",&n,&m)!=EOF)\n {\n while(n<m)\n {\n k1=0;k=0;\n memset(ch, 0, sizeof(ch)); //\u6570\u7ec4\u5168\u90e8\u6e05\u96f6\n num1=10000;CS=5;\n for(i=0;5>i;i++) //\u5224\u65ad\u4f4d\u6570\n {\n if(((n/num1)%10)!=0) \n {\n len=CS;\n break;\n }\n else\n {\n CS--;\n num1/=10;\n }\n }\n num1=1;\n while(--len)\n num1*=10;\n while(num1>=1)\n {\n for(i=0;i<10;i++) //\u5224\u65ad\u6709\u65e0\u91cd\u590d\n {\n if(((n/num1)%10)==a[i])\n ch[i]++;\n }\n num1/=10;\n }\n for(i=0;i<10;i++) //\u8bfb\u53d6ch\u4e2d\u6709\u591a\u5c11\u76f8\u540c\u7684\u6570\n {\n if(ch[i]>1)\n {\n k=1;\n break;\n }\n }\n if(k!=1)\n {\n printf(\"%d\\n\",n);\n break;\n }\n else\n\t\t\t\t\t{\n n++;\n\t\t\t\t\t}\n if(n>=m)\n {\n printf(\"-1\\n\");\n break;\n }\n }\n \n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint r,l,x,i,a[]={0,0,0,0,0,0,0,0,0,0},stop=0,n,k=0;\n\tscanf(\"%d %d\",&l,&r);\n\tfor(x=l;x<=r&&x>=l;x++){\n\t\tfor(n=x;n>=1;n/=10){\n\t\ta[n%10]++;\n\t }\n\tfor(i=0;i<10;i++){\n\t\tif(a[i]<2)\n\t\tstop+=1;\n\t\ta[i]=0;\t\n\t}\n\tif(stop==10){\n\tprintf(\"%d \",x);\n\tbreak;}\n\tstop=0;\n\t}\n\tif(k=0)\n\tprintf(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\n\tint r,a,c0=0,d,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,l,j=0,k;\n\tscanf(\"%d%d\",&l,&r);\n\tfor(int i=l;i<r;i++)\n\t {k=i;\n d=i;\n c0=0;c1=0;c2=0;c3=0;c4=0;c5=0;c6=0;c7=0;c8=0;c9=0;\n while(k!=0)\n {\n a=k%10;\n if(a==9)\n c9++;\n if(a==8)\n c8++;\n if(a==7)\n c7++;\n if(a==6)\n c6++;\n if(a==5)\n c5++;\n if(a==4)\n c4++;\n if(a==3)\n c3++;\n if(a==2)\n c2++;\n if(a==1)\n c1++;\n if(a==0)\n c0++;\n k=k/10;\n }\n if(c9<=1&&c8<=1&&c7<=1&&c6<=1&&c5<=1&&c4<=1&&c3<=1&&c2<=1&&c1<=1&&c0<=1)\n {\n\t\tprintf(\"%d\",d);\n\t\tj=1;\n\t\tbreak;\n\t}\n\telse\n\t\tcontinue;\n}\nif(j!=1)\nprintf(\"-1\");\n}\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int l,r,i,k,j,t,p,count,cot=0,a[100001];\n scanf(\"%ld%ld\",&l,&r);\n for(i=l;i<=r;i++)\n {\n k=i;\n j=0;\n count=0;\n while(k!=0)\n {\n t=k%10;\n k=k/10;\n a[j]=t;\n j++;\n }\n for(k=0;k<j;k++)\n {\n for(p=k+1;p<j;p++)\n {\n if(a[k]==a[p])\n continue;\n else\n count++;\n }\n }\n if(count==j)\n {\n printf(\"%ld\",i);\n break;\n }\n else\n {\n cot++;\n }\n\n }\n if(cot==(r-l)+1)\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r,n,m,a[6],c,d,i,j;\nscanf(\"%d%d\",&l,&r);\nif(l<10){printf(\"%d\",l);return 0;}\nwhile(1)\n{\nif(m>r){printf(\"%d\",-1);break;}\nc=0;\nm=l;\nn=m;\na[0]=n%10;c++;\nif(m>=10){n=n/10;\na[1]=n%10;c++;}\nif(m>=100){n=n/10;\na[2]=n%10;c++;}\nif(m>=1000){n=n/10;\na[3]=n;c++;}\nif(m>=10000){n=n/10;\na[4]=n%10;c++;}\nif(m>=100000){n=n/10;\na[5]=n%10;c++;}\nd==0;\nfor(i=0;i<c-1;i++)\n{\nfor(j=0;j<c;j++)\n{\nif(a[i]==a[j] && i!=j)d++;\n}\n}\nif(d==0){printf(\"%d\",m);break;}\nm=++l;\n}\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, k, passed = 0;\n scanf(\"%d %d\", &n, &k);\n int a[n];\n\n for (int i = 0; i < n; ++i) {\n scanf(\"%d\", &a[i]);\n if (a[i] >= k){\n ++passed;\n }\n }\n printf(\"%d\\n\", passed);\n\n return 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n\nint main()\n{\n\tint x = 0, l = 0, r = 0, i, num, j = -1, nj, k;\n\tint nums[7];\n\tscanf(\"%d%d\", &l, &r);\n\tfor (i = l; i <= r; i++) {\n\t\tint del = 6;\n\t\twhile (del--)\n\t\t\tnums[del] = -1;\n\t\tnum = i;\n\t\tx = 0;\n\t\twhile (num >= 1) {\n\t\t\tnum /= 10;\n\t\t\tj++;\n\t\t}\n\t\tnj = j;\n\t\tnum = i;\n\t\tnums[j] = num % 10;\n\t\tnum /= 10;\n\t\tfor (j -= 1; j >= 0; j--) {\n\t\t\tnums[j] = num % 10;\n\t\t\tnum /= 10;\n\t\t\tfor (k = nj; k > j; k--) {\n\t\t\t\tif (nums[j] == nums[k]) {\n\t\t\t\t\tj = -1;\n\t\t\t\t\tx--;\n\t\t\t\t}\n\t\t\t}\n\t\t\tx++;\n\t\t}\n\t\t\n\t\tif (x == nj) {\n\t\t\tx = i;\n\t\t\ti = r + 1;\n\t\t}\n\t}\n\tif (i == r + 2)\n\t\tprintf(\"%d\", x);\n\telse printf(\"-1\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || (x>=r && m==-1))\n break;\n\n else\n x++;\n\n }\n\n if (m==-1)\n printf(\"-1\");\n else if(l<10 && r<10)\n printf(\"%d\",l);\n else\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || (x>=r && m==-1))\n break;\n else\n x++;\n }\n\n if (m==-1)\n printf(\"-1\");\n else\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int l,r,x,y,digits,m;\n scanf(\"%d %d\",&l,&r);\n x=l;\n while(1)\n {\n digits=0;\n y=x;\n while(y)\n {\n\n y/=10;\n digits++;\n\n }\n\n y=x;\n int a[digits];\n for (int i=0;i<digits;i++)\n {\n a[i]=y%10;\n y/=10;\n }\n for (int i=0;i<digits;i++)\n {\n for (int j=i+1;j<digits;j++)\n {\n if(a[i]!=a[j])\n { m=0;\n continue;\n }\n else\n {\n m=-1;\n break;\n }\n }\n if (m==-1)\n break;\n }\n\n if(m==0 || x>r)\n break;\n else\n x++;\n }\n\n if (m==-1)\n printf(\"-1\");\n else\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x, y, z, i, j, k, a[10], t;\n scanf(\"%d %d\", &x, &y);\n z=x;\n for(i=0;i<10;i++)\n {\n k=x%10;\n a[i]=k;\n //printf(\"%d\", k);\n x=x/10;\n if(x==0) break;\n }\n t=0;\n for(j=i;j>=0;j--)\n {\n for(k=j+1;k<=i;k++)\n {\n if(a[j]==a[k])\n {\n a[j]++;\n k=j;\n }\n if(a[j]>9)\n {\n a[j]=1;\n k=j;\n }\n }\n t=t+a[j];\n t=t*10;\n }\n t=t/10;\n if(t>=z&&t<=y) printf(\"%d\\n\", t);\n else printf(\"-1\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n if(a>b) printf(\"-1\\n\");\n else printf(\"%d\\n\", a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\nint main ()\n{\n int n,m,i,j,l,r;\n char s[100001],s1[100001];\n char s2[100001];\n scanf(\"%s%s\",&s,&s1);\n m=strlen(s);//printf(\"%d\\n\",m);\n int p=strlen(s1);\n l=atoi(s);//printf(\"%d\\n\",l);\n r=atoi(s1);//printf(\"%d\\n\",r);\n for(i=l;i<=r;i++)\n {\n int c=0;\n int ctr[10]={0};\n snprintf(s2, sizeof(s2), \"%d\", i);\n //printf(\"%s\\n\",s2);\n for(j=0;j<strlen(s2);j++)\n {\n ctr[s2[j]-'0']++;\n }\n for(j=0;j<10;j++)\n {\n //printf(\"%d\\n\",ctr[j]);\n if(ctr[j]==1)\n c++;\n }\n //printf(\"%d c\\n\",c);\n if(c==m||c==p)\n {printf(\"%s\\n\",s2);break;}\n else if(i==r)\n {\n printf(\"-1\\n\");break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\nint count(long long y)\n{\n long long arr[10]={0};\n while(y>0)\n {\n arr[(y%10)]++;\n y=y/10;\n }\n for(short k=0;k<9;k++)\n if(arr[k]>1)return 1;\n return 0;\n}\nint main()\n{\n long long x,n,y,l,r;\n short flag=0;\n scanf(\"%lld %lld\",&l,&r);\n for(x=r;x>=l;x--)\n {\n if(count(x)==0)\n {\n printf(\"%lld\",x);\n flag=1;\n break;\n }\n }\n if(flag==0)printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint a,b,c,d,e,f,g,m;\nscanf(\"%d%d\",&m,&b);\nc=-1;\nd=-2;\ne=-4;\nf=-6;\ng=-7;\nwhile(m<=b)\n{\n a=m;\n c=a%10;\n a=a/10;\n if(a>0)\n {\n d=a%10;\n a=a/10;\n }\nif(a>0)\n{\n e=a%10;\n a=a/10;\n\n}\nif(a>0)\n{\n f=a%10;\n a=a/10;\n}\nif(a>0)\n{\n g=a%10;\n a=a/10;\n\n}\n if((a!=c)&&(a!=d)&&(a!=e)&&(a!=f)&&(a!=g)&&(c!=d)&&(c!=e)&&(c!=f)&&(c!=g)&&(d!=g)&&(d!=e)&&(d!=f)&&(e!=f)&&(e!=g)&&(f!=g))\n {\n printf(\"%d\\n\",m);\n break;\n }\n else\n {\n if(m==b)\n printf(\"%d\\n\",-1);\n }\nm++;\n\n}\n\n\n\n\n\n\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint a[10]={0};\nint is(int i)\n{\n\tint r,p=i,k=0;\n\twhile(i>0)\n\t{\n\t\tr=i%10;\n\t\ta[r]=a[r]+1;\n\t\tif(a[r]>1)\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\ti=i/10;\n\t}\n\treturn 1;\n\t\n}\nint main()\n{\n\tint l,r,p=0;\n\tscanf(\"%d %d\",&l,&r);\n\tfor(int i=l;i<=r;i++)\n\t{\n\t\tif(is(i))\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tp=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(p==0)\n\t{\n\t\tprintf(\"-1\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(void) {\n int x,l,r,c=0,copy,copy1,d=0;\n scanf(\"%d %d\",&l,&r);\n for(x=l;x<=r;x++)\n {\n copy1=x;c=0,d=0;\n while(copy1)\n {\n copy=x;\n while(copy){\n if(copy%10==copy1%10)\n {\n c++;\n \n }\n copy/=10;\n \n }\n copy1/=10;d++;\n }\n \n \n if(c==d) {\n printf(\"%d\",x);\n break;\n }\n \n }\n\t// your code goes here\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n_Bool different(int x){\n\tint nums[10];\n\tmemset(nums, 0, sizeof(nums));\n\twhile(x){\n\t\tif(nums[x%10]) return 0;\n\t\tnums[x%10]=1;\n\t\tx/=10;\n\t}\n\treturn 1;\n}\n\nint main(){\n\tint l, r, x;\n\tscanf(\"%d %d\", &l, &r);\n\tfor(x=l+1;x<r;++x){\n\t\tif(different(x)){\n\t\t\tprintf(\"%d\\n\", x);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tputs(\"-1\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long l,r,i,c=0,j,k,count,a[10],num;\n scanf(\"%ld %ld\",&l,&r);\n for(i=l+1;i<r;i++)\n {\n num=i;\n while(i)\n {\n c++;\n i=i/10;\n }\n i=num;\n for(j=0;j<c;j++)\n {\n a[j]=i%10;\n i=i/10;\n }\n count=c;\n for(j=0;j<c-1;j++)\n {\n for(k=j+1;k<c;k++)\n {\n if(a[j]==a[k])\n {\n count--;\n break;\n }\n }\n }\n if(c==count)\n {\n printf(\"%ld\",num);\n break;\n }\n c=0;\n i=num;\n }\n if(i==r)printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,k,i=0,c=0,s,p=0,t;\n scanf(\"%d %d\",&x,&k);\n int n[100];\n t=x;\n while(t!=0)\n {\n t=t/10; p++;\n }\n while(x<=k)\n {\n i=0;\n t=x;\n while(t!=0)\n {\n s=t%10; n[i]=s; t=t/10; i++;\n }\n\n for(i=p-1;i>=0;i--)\n {\n for(int j=i-1;j>=0;j--)\n {\n if(n[i]==n[j]) { c++; break; }\n }\n }\n if(c==0) break; c=0; x++;\n }\n //printf(\"%d\\n\",x);\n if(x<=k)\n printf(\"%d\",x);\n else printf(\"-1\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int l, r;\n scanf(\"%d %d\", &l, &r);\n for(int i = l + 1; i < r; i++){\n int D[10] = { 0 };\n int n = i;\n int f = 0;\n while(n != 0){\n int d = n % 10;\n D[d]++;\n n /= 10;\n }\n for(int j = 0; j < 10; j++){\n if(D[j] > 1) {\n f = 1;\n break;\n }\n }\n if(!f) {\n printf(\"%d\", i);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,i,j,f[10];\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<=b;i++){\n for(j=0;j<10;j++) f[j]=0;\n for(j=i;j>=0;j/10){\n f[j%10] += 1;\n if(f[j%10]>1) break;\n else {printf(\"%d\",i);return 0;}\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j=0,r,s,m,l,p,a[6],g=0;\n scanf(\"%d\",&r,&s);\n for(i=r;i<=s;i++)\n { int k=i;\n p=i;\n\n while(k!=0)\n {\n k=k/10;\n j++;\n }\n for(l=0;l<j;l++)\n {\n m=p%10;\n p=p/10;\n a[l]=m;\n\n }\n for(l=0;l<j-1;l++){\n for(m=l+1;m<j;m++)\n {\n if(a[m]==a[l])\n goto z;\n }\n printf(\"%d\",i);\n g++;\n break;\n }\nz:\n g++;\n g--;\n }\n\n if(g==0)\n printf(\"-1\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int l,r,i,temp,j,rem,n,k,flag;\n\tscanf(\"%lld %lld\",&l,&r);\n\tfor(i=l;i<r;i++)\n\t{\n\t\tflag=0;\n\t\ttemp=i;\n\t\tl=0;\n\t\tlong long int f[100000];\n\t\twhile(temp>0)\n\t\t{\n\t\t\trem=temp%10;\n\t\t\tf[l]=rem;\n\t\t\tl++;\n\t\t\ttemp=temp/10;\n\t\t}\n\t\tint e1=0;\n\t\tfor(j=0;j<l;j++)\n\t\t{\n\t\t\tfor(k=j+1;k<l;k++)\n\t\t\t{\n\t\t\t\tif(f[j]==f[k])\n\t\t\t\t{\t\n\t\t\t\t\te1++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(e1==0)\n\t\t{\n\t\t\tprintf(\"%d\",i);\n\t\t\tgoto end;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag==1)\n\t{\n\t\tprintf(\"-1\");\n\t}\n\tend:\n\t\tprintf(\"\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int n, m, i, j, g, u, x;\n char a[100];\n\n scanf(\"%d %d\", &n, &m);\n u = 0;\n for(i=0; n<=m; i++)\n {\n sprintf(a, \"%d\", n);\n x = strlen(a);\n for(j=0; j<x-1; j++)\n {\n for(g=j+1; g<x; g++)\n {\n if(a[j]==a[g])\n goto h;\n }\n if(j==x-2)\n {\n u++;\n goto hh;\n }\n\n }\n\n h:\n n = n+1;\n }\n\n printf(\"-1\");\n\n hh:\n if(u==1)\n printf(\"%d\", n);\n\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,y,z,l,r,m,n,k;\n\tint a[5]={10,10,10,10,10};\n\tscanf(\"%d %d\",&l,&r);\n\tx=l;\n\twhile(x<=r){\n\t\tz=x;\n\t\tfor(y=0;y<5&&z!=0;y++){\n\t\t\ta[y]=z%10;\n\t\t\tz=(z-a[y])/10;\n\t\t}\n\t\tk=1;n=y;\n\t\tfor(y=0;y<n;y++){\n\t\t\tfor(m=y+1;m<n;m++){\n\t\t\t\tif(a[y]!=a[m]){\n\t\t\t\t\tk=0;continue;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tk=-1;break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(k==-1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(k==0){\n\t\t\t\tprintf(\"%d\",x);break;\n\t\t}\n\t\tx++;\n\t}\n\tif(k==-1){\n\t\tprintf(\"%d\",k);\n\t} \n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\nint a,b,c,d,i,j,y,ara[10000],flag=1,l;\n\nscanf(\"%d %d\",&a,&b);\nfor(l=a;l<=b+1;l++)\n{\nif(l==b+1)\n{\n printf(\"-1\");\n break;\n}\nd=l;\n\nwhile(1)\n{\n\n if(d==0)\n {\n break;\n }\n\n else\n {\n y=d%10;\n ara[y]++;\n d=d/10;\n }\n}\n\nfor(i=0;i<=9;i++)\n{\n if(ara[i]>1)\n {\n flag=0;\n break;\n }\n}\nfor(i=0;i<9;i++)\n{\n ara[i]=0;\n}\n\nif(flag==1)\n{\n printf(\"%d\",l);\n break;\n}\n\nflag=1;\n\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nbool findnum(int x){\n\tunsigned long int freq[10],i;\n\tint count,digits;\n\tfor(i=0;i<10;i++){\n\t freq[i]=0;\t\n\t}\n\tdigits=0;\n\twhile(x!=0){\n\t freq[x%10]++;\n\t x/=10;\n\t digits++;\n\t}\n\tcount=0;\n\tfor(i=0;i<10;i++){\n\t if(freq[i]!=0){\n\t \tcount++;\n\t }\n\t}\n\tif(digits==count){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}\n\nint main(void){\n\tunsigned long int l,x,r;\n\tscanf(\"%lu%lu\",&l,&r);\n\tfor(x=l;x<=r;x++){\n\t if(findnum(x)==true){\n\t \tprintf(\"%lu\",x);\n\t \tbreak;\n\t }\n\t}\n\tif(x=r&&findnum(x)==false){\n\t printf(\"%d\",-1);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nbool findnum(int x){\n\tunsigned long int freq[10],i;\n\tint count,digits;\n\tfor(i=0;i<10;i++){\n\t freq[i]=0;\t\n\t}\n\tdigits=0;\n\twhile(x!=0){\n\t freq[x%10]++;\n\t x/=10;\n\t digits++;\n\t}\n\tcount=0;\n\tfor(i=0;i<10;i++){\n\t if(freq[i]!=0){\n\t \tcount++;\n\t }\n\t}\n\tif(digits==count){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}\n\nint main(void){\n\tunsigned long int l,x,r;\n\tscanf(\"%lu%lu\",&l,&r);\n\tfor(x=l;x<=r;x++){\n\t if(findnum(x)==true){\n\t \tprintf(\"%lu\",x);\n\t \tbreak;\n\t }\n\t}\n\tif(x==r&&findnum(x)==false){\n\t printf(\"%d\",-1);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint fun(int n)\n{\n int ara[]={1,1,1,1,1,1,1,1,1,1};\n int q=n,i;\n while(q)\n {\n if(ara[(q%10)-1]==1)\n ara[q%10-1]=0;\n else\n return -1;\n q=q/10;\n }\n return n;\n}\nint main()\n{\n int l,r,ans,i;\n scanf(\"%d%d\",&l,&r);\n for(i=l;i<=r;i++)\n {\n ans=fun(i);\n if(ans!=-1)\n {\n printf(\"%d\\n\",i);\n break;\n }\n\n }\n if(i==r+1)\n printf(\"%d\\n\",-1);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint check_digits(long n)\n{\n\tint s[8], i = 0, j, count = 0, total;\n\tdo{\n\t\ts[i] = n % 10;\n\t\tn = n / 10;\n\t\ti++;\n\t}\n\twhile (n != 0);\n\ttotal = i;\n\tfor (i = 0; i < (total - 1); i++ ){\n\t\tfor (j = i + 1; j < total; j++){\n\t\t\tif (s[i] == s[j]) count++;\n\t\t}\n\t}\n\tif (count == 0) return 1;\n\telse return 0;\n}\nint main()\n{\n\tlong a, b, n, i = 0;\n\tscanf(\"%ld %ld\", &a, &b);\n\tfor (n = a; n <= b; n++){\n\t\tif (check_digits(n) == 1) i++;\n\t}\n\tif (i == 0) printf(\"-1\");\n\telse {\n\t\tfor (n = a; n <= b; n++){\n\t\tif (check_digits(n) == 1) printf(\"%d \", n);\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,i,j,k,count=0,result=0,sum,num,m,n;\n scanf(\"%d %d\",&l,&r);\n for(i=l;i<=r;i=i+1)\n {\n k=i;\n m=i;\n for(j=1;j!=0;j=j+1)\n {\n if(i>=10)\n {\n sum=i%10;\n\n i=(i/10);\n count=count+1;\n }\n else if(i<10)\n {\n break;\n }\n }\n for(j=1;j<=(count+1);j=j+1)\n {\n sum=m%10;\n for(n=1;n<=(count+1);n=n+1)\n {\n num=k%10;\n if(sum==num)\n {\n result=result+1;\n }\n num=(k/10);\n k=k/10;\n }\n sum=(m/10);\n m=m/10;\n if(result>(count+1))\n {\n break;\n }\n else if(result==(count+1))\n {\n printf(\"%d\",i);\n exit(0);\n\n }\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint digits[1000010];\n\nint main()\n{\n int l, r;\n scanf(\"%d %d\", &l, &r);\n\n for (int i = l; i <= r; i++)\n {\n int j = 0;\n int num = i;\n\n while (num > 0)\n {\n digits[j] = num % 10;\n j++;\n num /= 10;\n }\n\n int flag = 0;\n\n for (int l = 0; l < j; l++)\n {\n for (int k = l + 1; k < j; k++)\n {\n if (digits[l] != digits[k])\n flag = 1;\n\n else\n {\n flag = 0;\n break;\n }\n }\n\n if (flag == 0)\n break;\n }\n\n if (flag == 1)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint digits[100010];\n\nint main()\n{\n int l, r;\n scanf(\"%d %d\", &l, &r);\n\n for (int i = l; i <= r; i++)\n {\n int j = 0;\n int num = i;\n\n while (num > 0)\n {\n digits[j] = num % 10;\n j++;\n num /= 10;\n }\n\n int flag = 0;\n\n for (int l = 0; l < j; l++)\n {\n for (int k = l + 1; k < j; k++)\n {\n if (digits[l] != digits[k])\n flag = 1;\n\n else\n {\n flag = 0;\n break;\n }\n }\n\n if (flag == 0)\n break;\n }\n\n if (flag == 1)\n {\n printf(\"%d\\n\", i);\n return 0;\n }\n }\n\n printf(\"-1\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n printf(\"Enter two number range\");\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<=r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,i,j,c=0,*a,t,f,n,x;\n scanf(\"%d%d\",&l,&r);\n i=r;\n while(i>0)\n {\n c++;\n i=i/10;\n }\n a=(int*)malloc(c*sizeof(int));\n for(n=l;n<r;n++)\n {\n for(i=0;i<c;i++)\n *(a+i)=-1;\n i=n;\n t=0;\n f=0;\n while(i>0)\n {\n x=i%10;\n i=i/10;\n for(j=0;j<t;j++)\n {\n if(x==*(a+j))\n {\n f=1;\n break;\n\t}\n }\n if(f!=1)\n {\n *(a+t)=x;\n t++;\n }\n }\n if(i<=0&&f==0)\n {\n printf(\"\\n%d\",n);\n break;\n }\n fflush(stdin);\n }\n if(n==r)\n printf(\"-1\");\n free(a);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int l,r,i,j,k,c,g,f;\n scanf(\"%lld %lld\",&l,&r);\n if(l==r) \n { long long int a[100]={0},g=0;\n while(r>0)\n {\n a[r%10]++; r=r/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n g=1;\n }\n if(g==0) { printf(\"%lld\",l); }\n else printf(\"%lld\",l);\n }\n else for(i=l+1;i<=r;i++)\n {\n long long int a[100]={0}, k=i; f=0;\n while(k>0)\n {\n a[k%10]++;\n k=k/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); break;}\n }\n if(f==1) printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int l,r,i,j,k,c,f;\n scanf(\"%lld %lld\",&l,&r);\n for(i=l+1;i<=r;i++)\n {\n long long int a[100]={0}, k=i; f=0;\n while(k>0)\n {\n a[k%10]++;\n k=k/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); break;}\n }\n if(f==1) printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int l,r,i,j,k,c,f;\n scanf(\"%lld %lld\",&l,&r);\n if(l==r) \n { long long int a[100]={0};\n while(r>0)\n {\n a[r%10]++; r=r/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); }\n else printf(\"%lld\",l);\n }\n else for(i=l+1;i<=r;i++)\n {\n long long int a[100]={0}, k=i; f=0;\n while(k>0)\n {\n a[k%10]++;\n k=k/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); break;}\n }\n if(f==1) printf(\"-1\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int l,r,i,j,k,c,f;\n scanf(\"%lld %lld\",&l,&r);\n if(l==r) printf(\"%lld\",l);\n else for(i=l+1;i<=r;i++)\n {\n long long int a[100]={0}, k=i; f=0;\n while(k>0)\n {\n a[k%10]++;\n k=k/10;\n }\n for(j=0;j<10;j++) \n { //printf(\"%lld \",a[j]);\n if(a[j]>1) \n f=1;\n }\n if(f==0) { printf(\"%lld\",i); break;}\n }\n if(f==1) printf(\"-1\");\n}"}, {"source_code": "int isLucky(int n)\n{\n int arr[10]={};\n for(int i=0;i<10;i++)\n arr[i]=0;\n int num=n;\n while(num>0)\n {\n int digit=num%10;\n if(arr[digit])\n return 0;\n arr[digit]=1;\n num=num/10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int t=l-1;\n while(t<=r)\n {\n t=t+1;\n if(isLucky(t))\n {\n printf(\"%d\",t);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "int isLucky(int n)\n{\n int arr[15]={};\n for(int i=0;i<10;i++)\n arr[i]=0;\n int num=n;\n while(num>0)\n {\n int digit=num%10;\n if(arr[digit])\n return 0;\n arr[digit]=1;\n num=num/10;\n }\n return 1;\n}\nint main()\n{\n int l,r;\n scanf(\"%d %d\",&l,&r);\n int t=l-1;\n while(t<=r)\n {\n t=t+1;\n if(isLucky(t))\n {\n printf(\"%d\",t);\n return 0;\n }\n }\n printf(\"-1\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l;i<r;i++)\n {int j=i;int k=0;\n while(j)\n {\n a[k]=j%10;\n j/=10;\n k++;\n }\n while(k--)\n {\n if(a[k]==a[k-1])\n break;\n }\n if(k==0) ans=i;\n \n }\n if(i==r) printf(\"-1\\n\");\n else printf(\"%d\\n\",ans);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l+1;i<r;i++)\n {int j=i;int k=0;int flag=1;\n while(j)\n {\n a[k]=j%10;\n j/=10;\n k++;\n }\n int t;\n for(t=0;t<k;t++)\n {\n for(int p=t+1;p<k;p++)\n {\n if(a[t]==a[p]) {\n flag=0;\n break;\n\n }\n }\n if(flag==0)\n break;\n }\n if(t==k) {ans=i;break;}\n \n }\n if(i==r) printf(\"-1\\n\");\n else printf(\"%d\\n\",ans);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l;i<r;i++)\n {int j=i;int k=0;\n while(j)\n {\n a[k]=j%10;\n j/=10;\n k++;\n }\n k=k-1;\n while(k)\n {\n if(a[k]==a[k-1])\n break;\n k--;\n }\n if(k==0) {ans=i;break;}\n \n }\n if(i==r) printf(\"-1\\n\");\n else printf(\"%d\\n\",ans);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,ans,a[6];\n scanf(\"%d %d\",&l,&r);\n int i;\n for( i=l+1;i<r;i++)\n {int j=i;int k=0;\n while(j)\n {\n a[k]=j%10;\n j/=10;\n k++;\n }\n k=k-1;\n while(k)\n {\n if(a[k]==a[k-1])\n break;\n k--;\n }\n if(k==0) {ans=i;break;}\n \n }\n if(i==r) printf(\"-1\\n\");\n else printf(\"%d\\n\",ans);\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint m,n,i,j,k,x,s=0,y,z,l=0,b=0;\n\tint a[1000];\n\tscanf(\"%d %d\",&m,&n);\n for(i=m;i<=n;i++){\n \ty=i;\n \t\n \twhile(y!=0)\n \t{\n \t\tx=y%10;\n \t\ta[s]=x;\n \t\ty=y/10;\n \t\ts++;\n \t}\n \tfor(j=0;j<s;j++){\n \t\tfor(k=j+1;k<s;k++){\n \t\t\tif(a[k]>a[j])\n \t\t\t{\n \t\t\tz=a[j];\n \t\t\ta[j]=a[k];\n \t\t\ta[k]=z;\n \t}\n \t\t}\n \t}\n \tfor(j=0;j<s;j++){\n \t\tif(a[j]!=a[j+1])\n \t\tl++;\n \t}\n \tif(l==s){\n \t \n b++;\n break;\n \t}\n \ts=0;\n \tl=0;\n }\n if(b>0)\n printf(\"%d\\n\",i);\n else\n printf(\"-1\\n\");\n\t\n\t\n\treturn 0;\n\t\n\t\n}"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,\nC#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n\nint isdistinct(int l)\n{\n int len=0,i,j,arr[10]={0};\n while(l!=0)\n {\n arr[len++]=l%10;\n l=l/10;\n }\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;j<len;j++)\n {\n if(arr[i]==arr[j]) return 0;\n }\n }\n return 1;\n \n}\n\nint main()\n{\n int T,l,r,flag;\n scanf(\"%d\",&T);\n while(T--)\n {\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n flag=0;\n while(l<=r)\n {\n if(isdistinct(l)) \n {\n printf(\"%d\\n\",l);\n flag=1;\n break;\n }\n else l++;\n }\n if(flag==0) printf(\"-1\\n\");\n }\n return 0;\n}\n"}, {"source_code": "/******************************************************************************\n\nWelcome to GDB Online.\nGDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,\nC#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.\nCode, Compile, Run and Debug online from anywhere in world.\n\n*******************************************************************************/\n#include <stdio.h>\n\nint isdistinct(int l)\n{\n int len=0,i,j,arr[10]={0};\n while(l!=0)\n {\n arr[len++]=l%10;\n l=l/10;\n }\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;j<len;j++)\n {\n if(arr[i]==arr[j]) return 0;\n }\n }\n return 1;\n \n}\n\nint main()\n{\n int T,l,r,flag;\n scanf(\"%d\",&T);\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n flag=0;\n while(l<=r)\n {\n if(isdistinct(l)) \n {\n printf(\"%d\\n\",l);\n flag=1;\n break;\n }\n else l++;\n }\n if(flag==0) printf(\"-1\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int l,x,r,i,num,no;\n int c=0,check=1,li=0,ab=-1,j=0,a[6],k;\n scanf(\"%ld %ld\",&l,&x);\n for(i=l;i<=x;i++)\n {\n check=1;\n no=i;\n num=i;\n while(no!=0)\n {\n a[j]=no%10;\n no=no/10;\n c++;\n j++;\n }\n for(j=0;j<c-1;j++)\n {\n for(k=j+1;k<c;k++){\n\n if(a[j]==a[k])\n {\n check=0;\n break;\n }}\n if(check==0)\n break;\n }\n if(check==1)\n {\n printf(\"%ld\",i);\n li=1;\n break;\n }\n }\n if(li==0)\n {\n printf(\"%d\",ab);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int l,r,num,n,f=1,res;\n scanf(\"%d%d\",&l,&r);\n for(int i=l;i<=r&&f==1;i++)\n {\n int g=0,d=0;\n n=i;\n num=i;\n while(n)\n {\n n/=10;\n d++;\n }\n int ar[d];\n for(int x=0;x<d;x++)\n {\n ar[x]=num%10;\n num/=10;\n }\n for(int j=0;j<d-1&&g==0;j++)\n {\n for(int k=j+1;k<d;k++)\n {\n if(ar[j]==ar[k])\n { \n g=1;\n break;\n }\n }\n }\n if(g==0)\n res=i;\n else\n res=-1;\n }\n \n printf(\"%d\",res);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int l,r,d=0,n,res=0,num=0;\n scanf(\"%d%d\",&l,&r);\n n=l;\n while(n)\n {\n n/=10;\n d++;\n }\n num=l/(pow(10,d-1));\n for(int i=d-1;i>=0;i--)\n {\n res+=(pow(10,i))*num;\n num++;\n }\n if(res<=r)\n printf(\"%d\",res);\n else\n printf(\"%d\",-1);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n\tint l,r,temp,k;\n\t\n\tscanf(\"%d %d\",&l, &r);\n\t\n\tint flag=1;\n\n\tfor ( int i=l ; (i<=r)&&(flag!=0) ; i++ )\n\t{\n\t\tint dig[10]={0};\n\n\t\ttemp=i;\n\t\tflag=0;\n\n\t\twhile (temp)\n\t\t{\n\t\t\tif (dig[temp%10]==0)\n\t\t\t{\n\t\t\t\tdig[temp%10]++;\n\t\t\t}\n\n\t\t\telse\n\t\t\t\tflag++;\n\t\t\t\n\t\t\ttemp=temp/10;\n\t\t}\n\n\t\tk=i;\n\t}\n\n\tif (k==r)\n\t\tprintf(\"-1\\n\");\n\n\telse\n\t\tprintf(\"%d\\n\", k);\n\n\treturn 0;\n}\n\n\n\n\t\n\n\t\t\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{int v=0,n,m,t=0,y,flag;\nscanf(\"%d%d\",&n,&m);\nint a[5]={0};\nwhile(n<=m)\n{flag=0;\n y=n;\n//printf(\"%d \",y);\nv=0;t=0;\nwhile(y>0)\n{\n a[t++]=y%10;\n y=y/10;\n v++;\n}\n//for(int i=0;i<v;i++)\n // printf(\"%d \",a[i]);\n int s=0;\nfor(int j=0;j<v-1;j++)\n{\n for(int l=j+1;j<v;j++)\n {if(a[j]!=a[l])\n s++;\n }\n}\nif(s==v*(v-1)/2)\n {\n break;\n }\n else\n flag=1;\nn++;\n // printf(\"%d \",n);\n}\nif(flag==0)\nprintf(\"%d \",n);\nelse\n printf(\"%d\",-1);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{int v=0,n,m,t=0,y,flag;\nscanf(\"%d%d\",&n,&m);\nint a[5]={0};\nwhile(n<=m)\n{flag=0;\n y=n;\n//printf(\"%d \",y);\nv=0;t=0;\nwhile(y>0)\n{\n a[t++]=y%10;\n y=y/10;\n v++;\n}\n//for(int i=0;i<v;i++)\n // printf(\"%d \",a[i]);\n int s=0;\nfor(int j=0;j<v-1;j++)\n{\n for(int l=j+1;j<v;j++)\n {if(a[j]!=a[l])\n s++;\n }\n}\nif(s==v*(v-1)/2)\n {\n break;\n }\n else\n flag=1;\nn++;\n // printf(\"%d \",n);\n}\nif(flag==0)\nprintf(\"%d \",n);\nelse\n printf(\"%d\",-1);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint difdig(int);\nint main(int argc, char *argv[]) \n{\n\tint i,a,b,flag=0;\n\t\n\tscanf(\"%d %d\",&a,&b);\n\tfor(i=a;i<=b;i++)\n\t{\n\t\tif(difdig(i))\n\t\t\tbreak;\n\t}\n\tif(i>b)\n\t\tprintf(\"-1\");\n\telse\n\t\tprintf(\"%d\");\n}\n\nint difdig(int num)\n{\n\tif(num>9999)\n\t{\n\t\tif(num/10000!=num/1000%10 && \n\t\t num/10000!=num/100%10 &&\n\t\t num/10000!=num/10%10 &&\n\t\t num/10000!=num%10 &&\n\t\t num/1000%10!=num/100%10&&\n\t\t num/1000%10!=num/10%10 &&\n\t\t num/1000%10!=num%10 &&\n\t\t num/100%10!=num/10%10 &&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>999)\n\t{\n\t\tif(num/1000!=num/100%10 &&\n\t\t num/1000!=num/10%10 &&\n\t\t num/1000!=num%10 &&\n\t\t num/100%10!=num/10%10&&\n\t\t num/100%10!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>99)\n\t{\n\t\tif(num/100!=num/10%10 &&\n\t\t num/100!=num%10 &&\n\t\t num/10%10!=num%10 )\n\t\t return 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse if(num>9)\n\t{\n\t\tif(num/10!=num%10)\n\t\t\treturn 1;\n\t\telse\n\t\t\treturn 0;\n\t}\n\telse return 1;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,i,n,k,j,l=0;\n char A[200];\n scanf(\"%d %d\",&a,&b);\n for(i=a;i<b;i++)\n {\n sprintf(A,\"%d\",i);\n for(j=0;j<strlen(A);j++)\n {\n for(k=j+1;k<strlen(A);k++)\n {\n if(A[j]==A[k])\n {\n l=0;\n break;\n }\n else l=1;\n }\n }\n if(l==1)\n break;\n }\n if(l==1)\n printf(\"%d\\n\",i);\n else printf(\"-1\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint main(void)\n{\n char l[100001],x[100001],r[100001];\n scanf(\"%s\",l);\n scanf(\"%s\",r);\n int i,j,k,y,sig,a,b,num,num1,temp,length1=strlen(l),length2=strlen(r);\n for(i=0,y=0;i<length1;i++)\n {\n for(j=0;j<length1;j++)\n {\n if(i!=j)\n {\n if(l[i]==l[j])\n {\n y++;\n }\n }\n }\n }\n if(y==0)\n {\n printf(\"%s\",l);\n return 0;\n }\n else\n {\n for(i=0,y=0;i<length2;i++)\n {\n for(j=0;j<length2;j++)\n {\n if(i!=j)\n {\n if(x[i]==x[j])\n {\n y++;\n }\n }\n }\n }\n if(y==0)\n {\n printf(\"%s\\n\",r);\n return 0;\n }\n }\n for(i=0,j=length1-1;i<length1,j>=0;i++,j--)\n {\n for(k=0,temp=1;k<j;k++)\n {\n temp*=10;\n }\n if(i>0)\n {\n num+=temp*(l[i]-48);\n }\n else\n {\n num=temp*(l[i]-48);\n }\n }\n for(i=0,j=length2-1;i<length2,j>=0;i++,j--)\n {\n for(k=0,temp=1;k<j;k++)\n {\n temp*=10;\n }\n if(i>0)\n {\n num1+=temp*(r[i]-48);\n }\n else\n {\n num1=temp*(r[i]-48);\n }\n }\n for(i=0;num<=num1;i++)\n {\n num+=1;\n itoa(num,x,10);\n for(j=0,sig=0;x[j]!='\\0';j++)\n {\n y=x[j];\n for(k=0;x[k]!='\\0';k++)\n {\n if(j!=k)\n {\n if(x[k]==x[j])\n {\n sig++;\n }\n }\n }\n }\n if(sig==0)\n {\n printf(\"%s\\n\",x);\n return 0;\n }\n }\n printf(\"-1\\n\");\n return 0;\n}\n"}], "src_uid": "3041b1240e59341ad9ec9ac823e57dd7"} {"nl": {"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 k2, petricium la petricium la petricium stands for k3 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_spec": "The first input line contains integer number k, the second line contains integer number l (2\u2009\u2264\u2009k,\u2009l\u2009\u2264\u2009231\u2009-\u20091).", "output_spec": "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.", "sample_inputs": ["5\n25", "3\n8"], "sample_outputs": ["YES\n1", "NO"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\nint main(){\n long long n;\n int k,le,i;\n n=1L;\n scanf(\"%d%d\",&k,&le);\n for(i=1;n<le;i++){\n n=n*k;\n }\n if(n==le)\n printf(\"YES\\n%d\\n\",i-2);\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n __int64 k,l,i,t;\n while(scanf(\"%I64d%I64d\",&k,&l)!=EOF)\n {\n t=k;\n for(i=0;k<=l;i++)\n {\n if(k<l)\n k=k*t;\n else\n if(k==l)\n break;\n if(k>l)\n break;\n }\n if(k==l)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long int k,l,m=0;\n scanf(\"%lu%lu\",&k,&l);\n while(l%k==0)\n {\n l=l/k;\n m++;\n }\n if(l!=1)\n printf(\"NO\");\n else\n {\n printf(\"YES\\n%lu\",m-1);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int pow(long long int k,int i)\n{\n int t=k;\n while(i--)\n k=t*k;\n return k;\n}\nint main()\n{\n long long int k,l;\n scanf(\"%I64d%I64d\",&k,&l);\n int i=0;\n while(pow(k,i)<=l)\n {\n if(pow(k,i)==l)\n {\n printf(\"YES\\n\");\n printf(\"%d\",i);\n return 0;\n }\n i++;\n }\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,p,i=0;\n scanf(\"%I64d%I64d\",&n,&k);\n\n p=n;\n while(p<k)\n {\n p=p*n;\n i++;\n }\n if(p==k)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n long int x, y, c=0;\n scanf(\"%ld%ld\", &x, &y);\n\n\n while(y!=1 && y % x == 0)\n {\n y=y/x;\n c=c+1;\n }\n if(y==1)\n {\n printf(\"YES\\n\");\n printf(\"%d\", c-1);\n }\n\n else\n printf(\"NO\");\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n __int64 n,k,le,i;\n n=1;\n scanf(\"%I64d%I64d\",&k,&le);\n for(i=1;n<le;i++){\n n=n*k;\n }\n if(n==le)\n printf(\"YES\\n%I64d\\n\",i-2);\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n __int64 k,l,i,t;\n while(scanf(\"%I64d%I64d\",&k,&l)!=EOF)\n {\n t=k;\n for(i=0;k<=l;i++)\n {\n if(k<l)\n k=k*t;\n else\n if(k==l)\n break;\n if(k>l)\n break;\n }\n if(k==l)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int k,l,i,n=0;\n scanf(\"%d\\n\",&k);\n scanf(\"%d\",&l);\n if(l%k==0)\n {\n while(l!=0&&l!=1)\n { \n if(l%k==0)\n {\n l=l/k;\n n++;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n }\n \n if(l==1)\n printf(\"YES\\n%d\",n-1);\n else\n printf(\"NO\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "n;main(a,b){scanf(\"%d%d\",&a,&b);fabs(log(b)/log(a)-(n=log(b)/log(a)+1e-12))<1e-12?printf(\"YES %d\",n-1):puts(\"NO\");}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int k,l,j,cnt=0;\n scanf(\"%I64d %I64d\",&k,&l);\n j=k;\n while(1)\n {\n if(j==l)\n {\n printf(\"YES\\n%I64d\",cnt);\n return 0;\n }\n j*=k;\n cnt++;\n if(j>l)\n {\n printf(\"NO\");\n return 0;\n }\n\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main ()\n{ __int64 k,m,c;\n int i;\n\twhile(scanf(\"%I64d\",&k)!=EOF)\n\t{ \n\t\tscanf(\"%I64d\",&m);\n\t\tc=k;i=1;//printf(\"%d\\n\",c);\n\t\twhile(k<m)\n\t\t{ i++;\n\t\t\tk*=c;\n\t\t\t//printf(\"%d\\n\",k);\n\t\t}\n\t\tif(k==m){printf(\"YES\\n%d\\n\",i-1);}\n\t\telse{printf(\"NO\\n\");}\n\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n#include<math.h>\nint main()\n{\n long long int k,l,t=0,p,flag=0;\n scanf(\"%I64d\",&k);\n scanf(\"%I64d\",&l);p=k;\n if(p==l)flag=1;\n while(p<l)\n {\n p*=k;t++;\n if(p==l){flag=1;break;}}\n if(flag==1){printf(\"YES\\n\");printf(\"%I64d\",t);}\n else printf(\"NO\");\n return 0;\n } \n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,l,i=0,x,sum=0,temp;\n\n scanf(\"%I64d %I64d\",&n,&l);\n temp=n;\n\n while(temp<l)\n {\n temp=temp*n;\n sum++;\n }\n\n if(temp==l)\n {\n printf(\"YES\\n%I64d\",sum);\n }\n else\n printf(\"NO\");\n\n return 0;\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%I64d\",&first);\n\tscanf(\"%I64d\",&last);\n\n// first=146;\n// last=1913781536;\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t\t//printf(\"Z:%d\\n\",z);\n\t}\n\tif(z==last)\n\t{\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\t}\n\telse\n\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\t\n\n\n\n\n\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include<stdio.h>\n\nlong long int pow(long long int k,int i)\n{\n int t=k;\n while(i--)\n k=t*k;\n return k;\n}\nint main()\n{\n long long int k,l;\n scanf(\"%I64d%I64d\",&k,&l);\n int i=0;\n while(pow(k,i)<=l)\n {\n if(pow(k,i)==l)\n {\n printf(\"YES\\n\");\n printf(\"%d\",i);\n return 0;\n }\n i++;\n }\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long k,l,i,j,sum=1;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%lld\",&l);\n\tfor(i=1;;i++)\n\t{\n\t\tsum=sum*k;\n\t\tif(sum==l)\n\t\t{\n\t\t\tprintf(\"YES\\n%d\",i-1);\n\t\t\tbreak;\n\t\t}\n\t\tif(sum>l)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include <math.h>\nint main()\n{\n unsigned long int k,l;\n int counter=0;\n unsigned long long int t;\n scanf(\"%lu\",&k);\n scanf(\"%lu\",&l);\n t=k;\n while(t<l)\n {\n t*=k;\n counter++;\n }\n if(t>l)\n printf(\"NO\");\n else\n {\n printf(\"YES\\n\");\n printf(\"%d\",counter);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,count=0,count2=0;\n scanf(\"%lld%lld\",&n,&a);\n int numb=n;\n while(n<=a)\n {\n if(n==a)\n {\n count++;\n break;\n }\n else\n {\n n=n*numb;\n count2++;\n }\n }\n if(count==1)\n {\n printf(\"YES\\n\");\n printf(\"%lld\",count2);\n }\n else\n printf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int n,k,i,count=0,rem=0;\n scanf(\"%lld %lld\",&n,&k);\n if(k%n!=0) printf(\"NO\");\n else\n {\n while(k>=n && rem==0)\n {\n rem=k%n;\n k=k/n;\n count++;\n }\n if(rem!=0 || k!=1)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n%lld\",count-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint k,l,i=0;\nscanf(\"%d%d\",&k,&l);\nwhile(l>0){\n if(l%k!=0){\n printf(\"NO\");break;\n }\n else if(l==k) break;\n l=l/k;\n i++;\n}\nif(l==k) printf(\"YES\\n%d\",i);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i=0,k,l;\n scanf(\"%d %d\",&k,&l);\n while(l>1)\n {\n if(l%k==0)\n {\n i++;\n l=l/k;\n }\n else\n {\n i=0;\n break;\n }\n }\n if(i==0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n%d\",i-1);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, hom, c, cont, aux, i, res;\n \n hom = 1; c = 1; cont = 0;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n if(a==b && a==2147483647)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n }\n \n else if(a == 2 && b == 1073741824)\n {\n printf(\"YES\\n\");\n printf(\"29\");\n }\n \n else if(a == 10 && b == 2000000000)\n printf(\"NO\");\n \n else if(a == 2 && b == 2147483646)\n printf(\"NO\");\n \n else if((a == 25 && b == 125) || (a == 6 && b == 18) ||(a == 5 && b == 30)) \n {\n printf(\"NO\");\n }\n \n else\n {\n \n hom = b/a;\n c = hom*a; \n \n if(c == b) \n {\n for(i=a; i<=b; i*=a)\n cont++;\n }\n res = pow(a, cont);\n \n \n aux = cont-1;\n if(a == 581)\n {\n aux = cont-2;\n }\n if(a == 35)\n {\n aux = cont-5;\n } \n \n if(((res+1)==b) || (res == a) || a==b || res == b || aux >=0) \n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n \n else\n printf(\"NO\"); \n }\n \n \n return 0; \n \n}\n \n \n \n \n"}, {"source_code": "\n//114 a\n\n#include <stdio.h>\n#include <math.h>\n#include <stdint.h>\n#include <inttypes.h>\n\nint main(){\n\tint64_t k , n, i=0, res =0;\n\tscanf(\"%\"SCNd64 \"%\"SCNd64, &k, &n);\n\twhile ( (int64_t)(pow ( k, i) + 0.5) < n ) i++;\n\t\n\tif ( (int64_t)(pow ( k, i) + 0.5) == n)\n\t\tprintf(\"YES\\n%d\\n\", i-1);\n\telse \n\t\tprintf(\"NO\\n\"); \n}"}, {"source_code": "//Bismillah-hir-rah-ma-nir-rahim(in the name of Allah)\n//writter: Arafat Kamal Tamzid(Sylhet Engineering College)\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{\n double a,b,c,i,n,ck=1;\n scanf(\"%lf\", &a);\n scanf(\"%lf\", &b);\n c=b/a;\n if(a==b)\n printf(\"YES\\n0\\n\");\n else if(c==a)\n printf(\"YES\\n1\\n\");\n else if(c<a)\n printf(\"NO\\n\");\n else if(c>a)\n {\n while(c!=a&&c>a)\n {\n b=c;\n\n c=b/a;\n ck=ck+1;\n }\n if(c==a)\n printf(\"YES\\n%.0lf\\n\",ck);\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint k,l,srx;\nint main()\n{\n scanf(\"%d%d\",&k,&l);\n while(l%k==0)\n {srx++;\n l/=k;}\n if(l==1)\n printf(\"YES\\n%d\",srx-1);\n else\n printf(\"NO\");\n return 0;\n } "}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long k,l,i,j,sum=1;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%lld\",&l);\n\tfor(i=1;;i++)\n\t{\n\t\tsum=sum*k;\n\t\tif(sum==l)\n\t\t{\n\t\t\tprintf(\"YES\\n%d\",i-1);\n\t\t\tbreak;\n\t\t}\n\t\tif(sum>l)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i=0,k,l,j,s=1,t;\n scanf(\"%d%d\",&k,&l);\n if(l%k==0)\n {\n t=l;\n while(t>1)\n {\n t=t/k;\n i++;\n }\n for( j=0; j<i;j++)\n {\n s*=k;\n }\n if(s==l)\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",i-1);\n }\n else\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "\n\n#include <stdio.h>\n\nint main()\n{\n long long int k,l,i=0,kf;\n scanf(\"%I64d\",&k); kf=k;\n scanf(\"%I64d\",&l);\n\n while(k<=l)\n {\n if(k==l)\n {\n printf(\"YES\\n%d\",i);\n return 0;\n }else\n {\n ++i;\n k=k*kf;\n }\n }\n\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,m,flag=0;\n scanf(\"%d%d\",&m,&n);\n while(n%m==0&&n>m)\n {\n flag++;\n n/=m;\n }\n if(m!=n)\n printf(\"NO\");\n else\n printf(\"YES\\n%d\",flag);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n if(k==0)\n {\n printf(\"NO\");\n return 0;\n }\n long long flag=0,cnt=-1,temp=1;\n while(1)\n {\n if(temp==l) break;\n temp*=k;\n cnt++;\n if(temp>l)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n%d\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k, l, pow = 0;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\n\tif(l%k!=0)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\twhile(l>k)\n\t{\n\t\tl /= k;\n\t\tpow++;\n\t}\n\tif(l == k)\n\t\tprintf(\"YES\\n%d\\n\",pow);\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\nlong long i,a,b,count=0;\nscanf(\"%I64d%I64d\",&a,&b);\nif(b%a!=0){\n printf(\"NO\");\n}\nelse if(a==10 && b==2000000000){\n printf(\"NO\");\n}\nelse if(a==2 && b==2147483646){\n printf(\"NO\");\n}\nelse if(a==5 && b==30){\n printf(\"NO\");\n}\nelse if(a==b){\n printf(\"YES\\n\");\n printf(\"0\");\n}\nelse{\n for(i=a;i<=b;i=i*a){\n if(b%a==0){\n count=count+1;\n }\n }\n if(count==1){\n printf(\"NO\");\n }\n else{\n printf(\"YES\\n\");\n printf(\"%I64d\",count-1);\n }\n}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int k,l,r,i=0;\n scanf(\"%lld %lld\",&k,&l);\n r=k;\n for(i=0;;i++)\n {\n if(r==l)\n {\n printf(\"YES\\n%lld\\n\",i);\n break;\n }\n else if(r>l)\n {\n printf(\"NO\\n\");\n break;\n }\n else\n r*=k;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int k,l,c=0;\n scanf(\"%I64d%I64d\",&k,&l);\n while(l!=k)\n {\n if(l%k==0)\n {\n l=l/k;\n c++;\n }\n else break;\n }\n if(l==k)\n {\n printf(\"YES\\n%I64d\",c);\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n long long no_of_div=0;\n if((l%k)==0)\n {\n while((l/k)>=k)\n {\n l=l/k;\n no_of_div+=1;\n }\n if((l==k))\n {\n printf(\"YES\\n\");\n printf(\"%I64d\",no_of_div);\n exit(0);\n }\n else\n {\n printf(\"NO\");\n exit(0);\n }\n }\n else if(l%k!=0)\n {\n printf(\"NO\");\n exit(0);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nlong long Mymath(int n, int l);\nvoid solve(int n, int l);\nint main(void) {\n\n\tint n, l;\n\tint count=0;\n\n\tscanf(\"%d %d\",&n, &l);\n\tsolve(n, l);\n\n\n\t\n\treturn 0;\n}\nlong long Mymath(int n, int t) {\n\tlong long ans=1;\n\tint i;\n\tfor(i=1;i<=t;i++)\n\t\tans*=n;\n\treturn ans;\n}\nvoid solve(int n, int l)\n{\n\tint t=1, flag=0;\n\n\tif(n==l)\n\t{\n\t\tprintf(\"YES\\n0\\n\");\n\t\treturn ;\n\t}\n\t\n\twhile(1)\n\t{\n\t\tif(l==Mymath(n,t+1))\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(l<Mymath(n,t+1))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tt++;\n\t}\n\tif(flag)\n\t\tprintf(\"YES\\n%d\\n\",t);\n\t\n\t\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\n\t \t \t \t\t \t \t \t\t \t \t \t\t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n if(k==0)\n {\n printf(\"NO\");\n return 0;\n }\n long long flag=0,cnt=-1,temp=1;\n while(1)\n {\n if(temp==l) break;\n temp*=k;\n cnt++;\n if(temp>l)\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n%d\",cnt);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,y, z=-1;\n scanf(\"%d %d\",&x,&y);\n while (y % x == 0)\n {\n y =y/ x;\n z =z+1;\n }\n if (z >= 0 && y == 1)\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",z);\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long k,l,c=0;\n\tscanf(\"%I64d\",&k);\n\tscanf(\"%I64d\",&l);\n\twhile(l%k==0)\n\t{\n\t\tl/=k;\n\t\tc++;\n\t}\n\tif(c>=0 && l==1)\n\t\tprintf(\"YES\\n%I64d\",c-1);\n\telse\n\t\tprintf(\"NO\");\n\t\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main(){\n double l,k;\n scanf(\"%lf%lf\",&k,&l);\n\tint im;\n\tfor(double i=1;;i++){\n\t\tdouble x=pow(k,i);\n\t\tx=ceil(x);\n\t\tif(x==l){\n\t\t printf(\"YES\\n\");\n\t\t im=i-1;\n\t\t printf(\"%d\\n\",im);\n\t\t return 0;\t\n\t\t}\n\t\tif(x>l){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\t\n \t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n\tunsigned int k, l, t;\n\tint i=0;\n\tscanf(\"%u%u\",&k,&l);\n\tt=k;\n\twhile(t<=l/k){\n\t\tt*=k;\n\t\ti++;\n\t}\n\tif(t==l)\n\t{\n\t\tprintf(\"YES\\n%d\\n\",i);\n\t}\n\telse printf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int k , l , i ;\n\n scanf(\"%I64d%I64d\",&k,&l);\n if(l%k !=0)\n {\n printf(\"NO\");\n return 0;\n }\n if(k==l)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n return 0 ;\n }\n //long long int x=k;\n i=0;\n while(l)\n {\n if((l%k) != 0 && l!=1)\n {\n printf(\"NO\");\n return 0 ;\n }\n l = l/k ;\n //printf(\"%I64d\",l);\n i++;\n }\n\n printf(\"YES\\n\");\n printf(\"%I64d\",i-2);\n\n\n\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n __int64 k,l,i,t;\n while(scanf(\"%I64d%I64d\",&k,&l)!=EOF)\n {\n t=k;\n for(i=0;k<=l;i++)\n {\n if(k<l)\n k=k*t;\n else\n if(k==l)\n break;\n if(k>l)\n break;\n }\n if(k==l)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "n;main(a,b){for(scanf(\"%d%d\",&a,&b);!(b%a);b/=a)++n;b^1?puts(\"NO\"):printf(\"YES %d\",n-1);}"}, {"source_code": "//Bismillah-hir-rah-ma-nir-rahim(in the name of Allah)\n//writter: Arafat Kamal Tamzid(Sylhet Engineering College)\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{\n double a,b,c,i,n,ck=1;\n scanf(\"%lf\", &a);\n scanf(\"%lf\", &b);\n c=b/a;\n if(a==b)\n printf(\"YES\\n0\\n\");\n else if(c==a)\n printf(\"YES\\n1\\n\");\n else if(c<a)\n printf(\"NO\\n\");\n else if(c>a)\n {\n while(c!=a&&c>a)\n {\n b=c;\n\n c=b/a;\n ck=ck+1;\n }\n if(c==a)\n printf(\"YES\\n%.0lf\\n\",ck);\n else\n printf(\"NO\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long k, l, cnt;\n\n\tscanf(\"%lld%lld\", &k, &l);\n\tcnt = 0;\n\twhile (l > k) {\n\t\tif (l % k != 0) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tl /= k;\n\t\tcnt++;\n\t}\n\tif (l == k)\n\t\tprintf(\"YES\\n%lld\", cnt);\n\telse\n\t\tprintf(\"NO\");\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long k,l,i,j,sum=1;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%lld\",&l);\n\tfor(i=1;;i++)\n\t{\n\t\tsum=sum*k;\n\t\tif(sum==l)\n\t\t{\n\t\t\tprintf(\"YES\\n%d\",i-1);\n\t\t\tbreak;\n\t\t}\n\t\tif(sum>l)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong int n,p;\n\tscanf(\"%ld%ld\",&n,&p);\n\t int i;\n\tunsigned long long int res=1;\n\tfor(i=0;i<35;i++){\n\t\tres=res*n;\n\t\tif(res==p){\n\t\t\tprintf(\"YES\\n%ld\",i);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(i==35)\n\tprintf(\"NO\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%I64d\",&first);\n\tscanf(\"%I64d\",&last);\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t}\n\tif(z==last)\n\t{\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\treturn 0;\n\t}\n\telse\n\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long k,l,i,sum=0;\n scanf(\"%I64d %I64d\",&k,&l);\n if(l%k==0)\n {\n\n for(i=1;sum<=l;i++)\n {\n sum=pow(k,i);\n \n if(l==sum || l==sum+1)\n {printf(\"YES\\n\");\n printf(\"%I64d\",i-1);\n return 0;\n }\n\n }\n\n printf(\"NO\");\n\n\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int t=0;\nlong k,l;\n scanf(\"%lu %lu\",&k,&l);\n while(l!=k)\n {\n if ((l%k)==0) {l=(l/k);t++;}\n if ((l%k)!=0) {t=-1;break;}\n }\n if(t==0) {printf(\"YES\\n\");printf(\"0\");}\n if(t<0) {printf(\"NO\");}\n if(t>0) {printf(\"YES\\n\");printf(\"%d\",t);}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long k,l,i,sum=0;\n scanf(\"%I64d %I64d\",&k,&l);\n if(l%k==0)\n {\n\n for(i=1;sum<=l;i++)\n {\n sum=pow(k,i);\n \n if(l==sum || l==sum+1)\n {printf(\"YES\\n\");\n printf(\"%I64d\",i-1);\n return 0;\n }\n\n }\n\n printf(\"NO\");\n\n\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,m,x,flag=0;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&x);\n\n for(m=n,i=0;m<=x;m*=n,i++)\n {\n if(m==x)\n {\n flag=1;\n break;\n }\n }\n if(flag)\n {\n printf(\"YES\\n%lld\\n\",i);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void)\n{\n unsigned int k, l, i=0;\n scanf(\"%u\\n%u\", &k, &l);\n while (l > k)\n {\n if (l%k)\n break;\n l /= k;\n i++;\n }\n if (k == l)\n {\n puts(\"YES\");\n printf(\"%u\\n\", i);\n }\n else\n puts(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long ull;\n\nvoid func(ull k, ull l)\n{\n ull i;\n int j = 0;\n for (i = k; i <= l; i *= k, j++)\n {\n if (i == l)\n {\n printf(\"YES\\n%d\\n\", j);\n return;\n }\n }\n printf(\"NO\\n\");\n}\n\nint main(int argc, char **argv)\n{\n int k, l;\n while (scanf(\"%d%d\", &k, &l) == 2)\n {\n func(k, l);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long int n,m,a,i,count=0;\n scanf(\"%lld%lld\",&n,&m);\n a=n;\n if(n==m)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n return 0;\n }\n else\n {\n while(n<m)\n {\n n*=a;\n count++;\n }\n if(n==m)\n {\n printf(\"YES\\n\");\n printf(\"%d\",count);\n }\n else\n {\n printf(\"NO\");\n }\n\n }\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,i,m,x,flag=0;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&x);\n\n for(m=n,i=0;m<=x;m*=n,i++)\n {\n if(m==x)\n {\n flag=1;\n break;\n }\n }\n if(flag)\n {\n printf(\"YES\\n%lld\\n\",i);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%I64d\",&first);\n\tscanf(\"%I64d\",&last);\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t}\n\tif(z==last)\n\t{\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\t}\n\telse\n\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint m,n;\n\tint count = 0;\n\tscanf(\"%d%d\",&m,&n);\n\twhile(n){\n\t\tif(n <= m || n%m)\n\t\t\tbreak;\n\t\tn = n/m;\n\t\tcount++;\n\t}\n\tif(n%m == 0)\n\t\tprintf(\"YES\\n%d\\n\",count);\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}\n \t\t \t \t\t \t\t \t\t \t"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long k,l;\n float imp;\n scanf(\"%ld%ld\",&k,&l);\n if(k==1)\n {\n printf(\"NO\");\n return 0;\n }\n imp=(log10l(l)/log10l(k));\n if(l==powl(k,floor(imp)))\n {\n printf(\"YES\\n%.0f\",floor(imp)-1);\n }\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<string.h>\n#include<stdio.h>\nint main () {\n\tlong long int x,y,k;\n\tint i=0,f=0;\n\tscanf(\"%lld %lld\",&x,&y);\n\tif(x==y){\n\t\tprintf(\"YES\\n0\");\n\t\treturn 0;}\n\tk=x;\n\twhile(k<y){\n\t\tk*=x;\n\t\ti++;\n\t\tif(k==y){\n\t\t\tf=1;\n\t\t\tbreak;}\n\t}\n\tif(f)\n\t\tprintf(\"YES\\n%d\",i);\n\telse printf(\"NO\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,i,n;\n scanf(\"%I64d %I64d\",&a,&b);\n n=a;\n\n if(a==b)\n {\n\n printf(\"YES\\n0\\n\");\n return 0;\n\n }\n for(i=1;i<=100;i++){\n\n a*=n;\n\n\n if(a<b) continue;\n else if(a==b)\n {\n printf(\"YES\\n%I64d\\n\", i);\n return 0;\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l,k,i,p=0;\n scanf(\"%I64d %I64d\",&k,&l);\n\n for(i=k;i<=l;i=i*k){\n if(i==l){\n printf(\"YES\\n%I64d\\n\",p);\n break;\n }\n p++;\n }\n if(i>l){\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%I64d\",&first);\n\tscanf(\"%I64d\",&last);\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t}\n\tif(z==last)\n\t{\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\treturn 0;\n\t}\n\telse\n\tprintf(\"NO\");\n\t}\n\telse\n\tprintf(\"NO\");\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n long long int a,b,n=1,i=0;\n scanf(\"%lld%lld\",&a,&b);\n if(b%a!=0)\n {printf(\"NO\");return 0;}\n while(n<b)\n {\n\n i++;n*=a;;\n }\n if(n==b)\n {\n printf(\"YES\\n%lld\",i-1);return 0;\n }\n else printf(\"NO\");\n\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a,b,c,cnt=0;\n scanf(\"%d%d\",&a,&b);\n c=a;\n if(b%a==0)\n {\n while(b!=c)\n {\n if(b%c==0)\n {\n c=c*a;\n cnt++;\n }\n else\n {(printf(\"NO\")); exit(0);}\n }\n }\n else\n {\n printf(\"NO\");\n exit(0);\n }\n printf(\"YES\\n%d\",cnt);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long Mymath(int n, int l);\nvoid solve(int n, int l);\nint main(void) {\n\n\tint n, l;\n\tint count=0;\n\n\tscanf(\"%d %d\",&n, &l);\n\tsolve(n, l);\n\n\n\t\n\treturn 0;\n}\nlong long Mymath(int n, int t) {\n\tlong long ans=1;\n\tint i;\n\tfor(i=1;i<=t;i++)\n\t\tans*=n;\n\treturn ans;\n}\nvoid solve(int n, int l)\n{\n\tint t=1, flag=0;\n\n\tif(n==l)\n\t{\n\t\tprintf(\"YES\\n0\\n\");\n\t\treturn ;\n\t}\n\t\n\twhile(1)\n\t{\n\t\tif(l==Mymath(n,t+1))\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(l<Mymath(n,t+1))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tt++;\n\t}\n\tif(flag)\n\t\tprintf(\"YES\\n%d\\n\",t);\n\t\n\t\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\n\t \t \t \t\t \t \t \t\t \t \t \t\t \t"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long a,b,k,i=0;\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tk=a;\n\tif(b%a!=0)printf(\"NO\");\n\telse{\n\twhile(a<=b){\n\t\ta=a*k;\n\t\ti++;\n\t}\n\ta/=k;\n\tif(a==b)printf(\"YES\\n%I64d\",i-1);\n\telse printf(\"NO\");\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n __int64 n,m,k,i,sum;\n while(scanf(\"%I64d\",&n)!=EOF)\n {\n scanf(\"%I64d\",&m);\n sum=n;\n if(sum==m)\n printf(\"YES\\n0\\n\");\n else\n {\n for(i=2;i<=31;i++)\n {\n sum*=n;\n if(sum==m)\n {\n k=i-1;\n break;\n }\n else\n k=0;\n }\n if(k==0)\n printf(\"NO\\n\");\n else\n {\n printf(\"YES\\n%I64d\\n\",k);\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ long long int m,n,i,k,c;\nscanf(\"%lld %lld\",&m,&n);\nif(m==n)\n {printf(\"YES\\n\");\n printf(\"0\");\n }\nelse\n {\n i=m; c=0;\n while(1)\n {\n i=i*m;\n c++;\n if(i>=n)\n break;\n }\n if(i==n){\n k=c;\n printf(\"YES\\n\");\n printf(\"%lld\\n\",k);}\n else\n {\n printf(\"NO\");\n }\n }\n\n return 0;\n\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,t=0;\n long long int n;\n scanf(\"%d\",&k);\n scanf(\"%I64d\",&n);\n int temp=0;\n while(n!=1)\n {\n int a;\n a=n%k;\n n=n/k;\n temp++;\n if(a!=0)\n {\n t=1;\n break;\n }\n }\n if(t==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n return 0;\n }\n if(t==0)\n {\n printf(\"\\n%d\",temp-1);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long Mymath(int n, int l);\nvoid solve(int n, int l);\nint main(void) {\n\n\tint n, l;\n\tint count=0;\n\n\tscanf(\"%d %d\",&n, &l);\n\tsolve(n, l);\n\n\n\t\n\treturn 0;\n}\nlong long Mymath(int n, int t) {\n\tlong long ans=1;\n\tint i;\n\tfor(i=1;i<=t;i++)\n\t\tans*=n;\n\treturn ans;\n}\nvoid solve(int n, int l)\n{\n\tint t=1, flag=0;\n\n\tif(n==l)\n\t{\n\t\tprintf(\"YES\\n0\\n\");\n\t\treturn ;\n\t}\n\t\n\twhile(1)\n\t{\n\t\tif(l==Mymath(n,t+1))\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse if(l<Mymath(n,t+1))\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tt++;\n\t}\n\tif(flag)\n\t\tprintf(\"YES\\n%d\\n\",t);\n\t\n\t\n\telse\n\t\tprintf(\"NO\\n\");\n}\n\n\t \t \t \t\t \t \t \t\t \t \t \t\t \t"}, {"source_code": "n;main(a,b){for(scanf(\"%d%d\",&a,&b);!(b%a);b/=a)++n;b^1?puts(\"NO\"):printf(\"YES %d\",n-1);}"}, {"source_code": "#include <stdio.h>\nlong long int pow(int n,int i)\n{\n int k=0;\n long long int t=1;\n for(k=1;k<=i;k++)\n {\n t=n*t;\n }\n return t;\n}\nint main(void) {\n // your code goes here\n long long int n,k;\n scanf(\"%lld%lld\",&n,&k);\n long long int i,j=0;\n for(i=1;i<32;i++)\n {\n //printf(\"%ld\\n\",pow(n,i));\n if(pow(n,i)>k)\n {\n j=1;\n break;\n }\n if(pow(n,i)==k)\n {\n j=2;\n break;\n }\n }\n if(j==2)\n printf(\"YES\\n%lld\",i-1);\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,k,p,i=0;\n scanf(\"%I64d%I64d\",&n,&k);\n\n p=n;\n while(p<k)\n {\n p=p*n;\n i++;\n }\n if(p==k)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n long long int a,b,n=1,i=0;\n scanf(\"%lld%lld\",&a,&b);\n if(b%a!=0)\n {printf(\"NO\");return 0;}\n while(n<b)\n {\n\n i++;n*=a;;\n }\n if(n==b)\n {\n printf(\"YES\\n%lld\",i-1);return 0;\n }\n else printf(\"NO\");\n\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\nint main()\n{\n double k,l;\n int a=0;\n scanf(\"%lf\\n%lf\",&k,&l);\n double b;\n b=l/k;\n while(a>=0){\n a++;\n if(b==1){\n printf(\"YES\\n0\");\n break;\n }\n else if((b<1)||(l<k)||(b<k)){\n printf(\"NO\");\n break;\n }\n else if((l>k)&&(b>k)){\n l=b;\n b=l/k;\n continue;\n }\n else if(b==k){\n printf(\"YES\\n%d\",a);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int i, k, l, cnt=0;\n\tscanf(\"%I64d %I64d\", &k, &l);\n\tfor(i=l; i%k==0; i=i/k){\n\t\tcnt++;\n\t}\n\tif((i==1 && cnt==0)||(i!=1)){\n\t\tprintf(\"NO\\n\");\n\t}\n\telse if(i==1){\n\t\tprintf(\"YES\\n%I64d\\n\", cnt-1);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int k,l,find;\n find=0;\n\n scanf(\"%lld %lld\",&k,&l);\n\n while(l%k==0){\n l=l/k;\n find++;\n }\n if(find>=1 && l==1){\n printf(\"YES\\n\");\n printf(\"%lld\\n\",find-1);\n }\n else\n printf(\"NO\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n{\n double n,k;\n int i=0;\n scanf(\"%lf%lf\",&n,&k);\n while(1)\n {\n k/=n;\n i++;\n if(k==1.0)\n {\n printf(\"YES\\n%d\",i-1);\n return 0;\n }\n if(k<1)\n {\n printf(\"NO\");\n return 0;\n }\n }\n \n \n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main()\n{\nlong int k,n,t=-1;\nscanf(\"%ld\\n%ld\",&k,&n);\nif(n%k==0)\nwhile((n>0)&&(n%k==0)){n/=k; t++;}\nif(n==1)\nprintf(\"YES\\n%d\",t);\nelse\nprintf(\"NO\");\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int k, l, i, m=-1;\n\n scanf(\"%d %d\", &k, &l);\n while(l%k == 0)\n {\n l /=k;\n m++;\n }\n if(m>=0 && l == 1) printf(\"YES\\n%d\\n\", m);\n else printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint k,pow,count=0,i;\n\tlong long int check=1;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&pow);\n\tcheck=1;\n\tfor(i=0;;i++)\n\t{\n\t\tcheck=k*check;\n\t\tif(check==pow)\n\t\t\tbreak;\n\t\telse if(check > pow)\n\t\t{\n\t\t\tcount=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(count==1)\n\t\tprintf(\"NO\\n\");\n\telse \n\t\tprintf(\"YES\\n%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n double k,l,m,n;\n scanf(\"%lf\\n%lf\",&k,&l);\n m=log(l)/log(k);\n if(ceil(m)-m<0.0000000000001||m-floor(m)<0.0000000000001) {\n printf(\"YES\\n%0.0lf\\n\",m-1.0);\n }\n else {\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<algorithm>\n#include<string.h>\n#include<math.h>\nchar a[3000000];\n\n//using namespace std;\nint main()\n{\n long long int i,ct=0,ck=0,l,m,m1,ans,length,n,sum=0;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&m);\n // cin>>n;\n //cin>>m;\n if(m%n==0)\n {\n\n for(i=1; i<100; i++)\n {\n sum=pow(n,i);\n // printf(\"%lld\\n\",sum);\n if(sum==m||sum+1==m)\n {\n printf(\"YES\\n\");\n ck=1;\n printf(\"%lld\",i-1);\n break;\n }\n }\n\n\n }\n if(ck==0)\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ long long int m,n,i,k,c;\nscanf(\"%lld %lld\",&m,&n);\nif(m==n)\n {printf(\"YES\\n\");\n printf(\"0\");\n }\nelse\n {\n i=m; c=0;\n while(1)\n {\n i=i*m;\n c++;\n if(i>=n)\n break;\n }\n if(i==n){\n k=c;\n printf(\"YES\\n\");\n printf(\"%lld\\n\",k);}\n else\n {\n printf(\"NO\");\n }\n }\n\n return 0;\n\n }"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,y, z=-1;\n scanf(\"%d %d\",&x,&y);\n while (y % x == 0)\n {\n y =y/ x;\n z =z+1;\n }\n if (z >= 0 && y == 1)\n {\n printf(\"YES\\n\");\n printf(\"%d\\n\",z);\n }\n else\n {\n printf(\"NO\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint Solve(int K,int L)\n{\n int cnt=0,j;\n __int64 a;\n while(L!=1)\n {\n a=K;\n j=1;\n while(L>=(a*a))\n {\n a*=a;\n j*=2;\n }\n cnt+=(a==K)?1:j;\n if(L%a!=0)\n {\n return -1;\n }\n L/=a;\n }\n return cnt-1;\n}\n\nint main()\n{\n int K,L;\n while(scanf(\"%d %d\",&K,&L)!=EOF)\n {\n if(L%K!=0)\n {\n puts(\"NO\");\n continue;\n }\n L=Solve(K,L);\n if(L==-1)\n {\n puts(\"NO\");\n continue;\n }\n puts(\"YES\");\n printf(\"%d\\n\",L);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint Solve(int K,int L)\n{\n int cnt=0,j;\n __int64 a;\n while(L!=1)\n {\n a=K;\n j=1;\n while(L>=(a*a))\n {\n a*=a;\n j*=2;\n }\n cnt+=(a==K)?1:j;\n if(L%a!=0)\n {\n return -1;\n }\n L/=a;\n }\n return cnt-1;\n}\n\nint main()\n{\n int K,L;\n while(scanf(\"%d %d\",&K,&L)!=EOF)\n {\n if(L%K!=0)\n {\n puts(\"NO\");\n continue;\n }\n L=Solve(K,L);\n if(L==-1)\n {\n puts(\"NO\");\n continue;\n }\n puts(\"YES\");\n printf(\"%d\\n\",L);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int k,l,c=0;\n scanf(\"%lld%lld\",&k,&l);\n int p=k;\n while(k<l)\n { k=p*k; c++; }\n if(k==l) { printf(\"YES\\n\"); printf(\"%lld\",c); }\n else printf(\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long k,l,i,j,sum=1;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%lld\",&l);\n\tfor(i=1;;i++)\n\t{\n\t\tsum=sum*k;\n\t\tif(sum==l)\n\t\t{\n\t\t\tprintf(\"YES\\n%d\",i-1);\n\t\t\tbreak;\n\t\t}\n\t\tif(sum>l)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\nlong long int fact(long long int n, long long int m){\n long long int i, prod = 1, count = 0;\n for(i = 1;; i++){\n if(prod == m){\n count--;\n return count;\n }\n if(prod > m){\n count = -1;\n return count;\n }\n prod *= n;\n count++;\n }\n}\nint main(){\n long long int n, m;\n scanf(\"%lld%lld\", &n, &m);\n long long int p = fact(n, m);\n if(p >= 0){\n printf(\"YES\\n\");\n printf(\"%lld\", p);\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n/*int cmp(const void *a, const void *b)\n{\n return(*(int *)a-*(int *)b);\n}*/\n// qsort(a,n,sizeof(a[0]),cmp);\n\n\nint main()\n{\n long long k,l,c=0;\n\tscanf(\"%I64d %I64d\",&k,&l);\n\twhile(l%k==0)\n\t{\n\t\tl/=k;\n\t\tc++;\n\t}\n\tif(c>=0 && l==1)\n {\n printf(\"YES\\n%I64d\",c-1);\n }\n\telse\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,k;\n while((scanf(\"%d%d\",&n,&k))!=EOF)\n {\n i=0;\n while(k%n==0)\n {\n k/=n;\n ++i;\n }\n if(k==1)\n printf(\"YES\\n%d\\n\",i-1);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tlong long int k, l, count = 0, m;\n\tscanf(\"%llu%llu\", &k, &l);\n\tm = k;\n\twhile(1){\n\t\tif(k > l){\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(k == l){\n\t\t\tprintf(\"YES\\n\");\n\t\t\tprintf(\"%llu\\n\", count);\n\t\t\tbreak;\n\t\t}\n\t\tk = k * m;\n\t\tcount++;\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <stdbool.h>\nlong long int power(long long int x,long long int n){\n long long int i,pow=1;\n for(i=1;i<=n;i++){\n pow=x*pow;\n }\n return pow;\n}\n\nint main(){\nlong long int k,l,m,z=0,y;\nscanf(\"%I64d %I64d\",&k,&l);\nm=l;\nwhile(l!=0){\n l=l/k;\n z++;\n};\nz--;\ny=power(k,z);\nif(y==m){printf(\"YES\\n%d\",z-1);}\nelse {printf(\"NO\");}\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char const *argv[])\n{\n\tlong long k, l,temp;\n\tint i = 0;\n\n\tscanf(\"%I64d %I64d\", &k, &l);\n\ttemp=k;\n\twhile (1)\n\t{\n\t\tif (temp == l)\n\t\t{\n\t\t\tprintf(\"YES\\n%d\", i);\n\t\t\tbreak;\n\t\t}\n\t\tif (temp > l)\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\tbreak;\n\t\t}\n\t\tif (temp < l)\n\t\t{\n\t\t\ttemp *= k;\n\t\t}\n\t\ti++;\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long long n,m;\n long long nn;\n scanf(\"%lld\",&nn);\n scanf(\"%lld\",&m); \n n=nn;\n for(int i=0;;i++){\n if(n==m){\n printf(\"YES\");\n printf(\"\\n%d\",i);\n break;\n }\n if(n>m){\n printf(\"NO\");\n break;\n }\n n*=nn;\n \n }\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long k,l,i,n;\nscanf(\"%I64d %I64d\",&k,&l);\n for(i=1; ;i++){\nn=powl(k,i);\nif(n==l){\n printf(\"YES\\n%I64d\",i-1);\n break;\n}\nif(n>l){\n printf(\"NO\");\n break;\n}\n}\n\nreturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,n=1,flag=0;\n\tscanf(\"%d%d\",&k,&l);\n\twhile(l>1)\n\t{\n\t\tif(l%k!=0)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse \n\t\tl/=k;\n\t\tn++;\n\t\tif(k==l)\t\n\t\t{\n\t\t\tflag=2;\n\t\t\tbreak;\n\t\t}\t\n\t}\n\tif(flag==2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n\",n-1);\n\t}\n\telse printf(\"NO\");\n\treturn 0;\n}\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int k ;\n int l ;\n double pow ;\n\n scanf(\"%d %d\", &k, &l) ;\n\n pow = log((double)l) / log((double)k) - 1 ;\n\n if(pow - (int)pow == 0)\n printf(\"YES\\n%.f\\n\", pow);\n\n else\n printf(\"NO\\n\");\n\n return 0 ;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,i,j,k=1,p=2;\n float x;\n scanf(\"%d%d\",&a,&b);\n for(i=0;k<=b;i++)\n {\n k=k*a;\n x=(float)(b/k);\n if(x==1.0)\n {\n printf(\"YES\\n%d\",i);\n break;\n\n }\n if((x<1.0))\n {\n printf(\"NO\");\n break;\n }\n\n }\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int k , l ,i ,x,y ;\n int flag=0;\n scanf(\"%d%d\",&k,&l);\n y = sqrt(l);\n if (k!=5){\n for (i=1; i<=y;i++)\n {\n x = pow(k,i);\n if(x==l)\n {\n flag=1;\n break;\n }\n }}\n else {\n for (i=1; i<=y;i++)\n {\n x = pow(k,i)+1;\n\n if(x==l)\n {\n flag=1;\n break;\n }\n }\n }\n if (flag==1)\n {\n printf(\"YES\\n%d\",i-1);\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int k,l,sum,i;\n while(scanf(\"%d%d\",&k,&l)!=EOF)\n {\n sum=0;\n for(i=1;;i++)\n {\n k=pow(k,i);\n if(k<=l)\n {\n if(k==l)\n {\n break;\n }\n }\n else\n break;\n }\n i=i-1;\n if(k==l)\n printf(\"YES\\n%d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a==b)\n\t{\n\t\tputs(\"YES\");\n\t\tputs(\"0\");\n\t}\n\telse if(a*a==b)\n\t{\n\t\tputs(\"YES\");\n\t\tputs(\"1\");\n\t}\n\telse if(a*a*a==b)\n\t{\n\t\tputs(\"YES\");\n\t\tputs(\"2\");\n\t}\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l,k,i,p=0;\n scanf(\"%I64d %I64d\",&k,&l);\n \n for(i=k;i<=l;i=i*k){\n if(i==l){\n printf(\"YES\\n%I64d\\n\",p);\n break;\n }\n p++;\n }\n if(l%k!=0){\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int k,l,c=0;\n scanf(\"%I64d%I64d\",&k,&l);\n while(l!=k)\n {\n if(l%k==0)\n {\n l=l/k;\n c++;\n }\n else break;\n }\n if(l==k)\n {\n printf(\"YES\\n%I64d\",c);\n }\n else\n {\n printf(\"N0\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k, l, pow = 0;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\n\tif(l%k!=0)\n\t{\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\twhile(l>k)\n\t{\n\t\tl /= k;\n\t\tpow++;\n\t}\n\tprintf(\"YES\\n%d\\n\",pow);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,i,y=0;\n int j;\n scanf(\"%d%d\",&n,&x);\n for(i=0;i<32;i++) {\n j=pow(n,i);\n if(x==j) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n y=0;\n break;\n }\n else {\n y=1;\n }\n }\n if(y==1) {\n printf(\"NO\");\n }\n\n /*if(j==x) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else {\n printf(\"NO\");\n }*/\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,k,i,y,f=0;\n double x;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<=k;i++){\n x=pow(n,i);\n if(x==k){\n f=1;\n y=i;\n break;\n }\n //printf(\"%lf \",x);\n }\n //printf(\"%d\",y);\n if(f==1){\n printf(\"YES\\n\");\n printf(\"%d\",y-1);\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,k;\n double t;\n scanf(\"%I64d%I64d\",&k,&l);\n t=log10(l)/log10(k);\n printf(\"%lf\",t);\n if(floor(t)==ceil(t))\n {\n printf(\"YES\\n\");\n printf(\"%ld\",(int)(t-1));\n }\n else\n printf(\"NO\");\n\n // printf(\"%ld\",24*24*24*24*24*24);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int t,a,n,k;\n long double f;\n scanf(\"%d%d\",&n,&k);\n if(k%n)\n {\n printf(\"NO\");\n }\n else\n {\n \n f=log(k)/log(n);\n t=(int)f;\n if(t==f)\n printf(\"YES\\n%d\",t-1);\n else\n printf(\"NO\");\n}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,x,i,count=0;\n double j;\n scanf(\"%d%d\",&n,&x);\n for(i=1;i<=x;i++) {\n j=pow(n,i);\n if(j==x) {\n break;\n }\n }\n if(j==x) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long long n,m;\n int nn;\n scanf(\"%d\",&nn);\n scanf(\"%IId\",&m); \n n=nn;\n for(int i=0;;i++){\n if(n==m){\n printf(\"YES\");\n printf(\"\\n%d\",i);\n break;\n }\n if(n>m){\n printf(\"NO\");\n break;\n }\n n*=nn;\n \n }\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n long int a,b,n=1,i=0;\n scanf(\"%ld%ld\",&a,&b);\n if(b%a!=0)\n {printf(\"NO\");return 0;}\n while(n<b)\n {\n\n i++;n=pow(a,i);\n }\n if(n==b)\n {\n printf(\"YES\\n%ld\",i-1);return 0;\n }\n else printf(\"NO\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint c,f=0,t=0;\nlong long l,k;\nscanf(\"%I64d\",&k);\nscanf(\"%I64d\",&l);\nc=k;\nwhile(c<l)\n{\nc=c*k;\nt++;\nif(c==l)\n{f=1;break;}\n}\nif(f==1)\n{printf(\"YES\\n\");\nprintf(\"%d\",t);}\nelse\nprintf(\"NO\");\nreturn(0);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i=2,j,k,n,l,count=0;\n\n scanf(\"%d%d\",&n,&l);\n\n while(pow(n,i)<=l)\n {\n if(pow(n,i)==l)\n {\n count++;\n }\n i++;\n }\n\n\n if(count==0)\n {\n printf(\"NO\");\n }\n\n else\n {\n printf(\"YES\\n%d\",count);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,n=1,flag=0;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\twhile(1)\n\t{\n\t\tif(l%k!=0)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse \n\t\tl/=k;\n\t\tn++;\n\t\tif(k==l)\t\n\t\t{\n\t\t\tflag=2;\n\t\t\tbreak;\n\t\t}\t\n\t}\n\tif(flag==2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n\",n-1);\n\t}\n\telse printf(\"NO\");\n\treturn 0;\n}\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,k,i,y,f=0;\n double x;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<=k;i++){\n x=pow(n,i);\n if(x==k){\n f=1;\n y=i;\n break;\n }\n //printf(\"%lf \",x);\n }\n //printf(\"%d\",y);\n if(f==1){\n printf(\"YES\\n\");\n printf(\"%d\",y-1);\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n int k,l;\n int i;\n int ok=1;\n scanf(\"%d%d\",&k,&l);\n for (i=1; k*i<=l ;i++)\n {\n if (pow(k,i)==l){\n printf(\"YES\\n%d\",i-1);\n ok=0;\n break;\n }\n }\n if (ok)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int l,k,i,n=0;\n scanf(\"%d\\n\",&k);\n scanf(\"%d\",&l);\n if(k==5)\n n=1;\n else\n {\n for(i=2;i<31;i++)\n {\n if(l==(pow(k,i)))\n {\n n=1;\n break;\n }\n \n }\n }\n if(n==1)\n { printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else\n printf(\"NO\");\n return 0;\n} \n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nint main() {\nlong int k,l,n=1,q=1;\nscanf(\"%ld%ld\",&k,&l);\nif(l<k){\n printf(\"NO\");\n q=0;\n}\n if(q){\nwhile(pow(k,n)<=l){\n\nn++;\n}\nn=n-1;\nif(pow(k,n)==l){\n printf(\"YES\\n%d\",n-1);\n q=0;\n}\n}\n if(q){\n printf(\"NO\");\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main(){\n int k,l,n=0,z=1,flag=0;\nscanf(\"%d%d\",&k,&l);\nif(l<k){\n printf(\"NO\");\n z=0;\n} \nwhile(z){\n \n if(l%k!=0){break;}\n if(l%k==0){\n l=l/k;\n n++;\n }\n if(l==1){\n flag=1;\n break;\n }\n}\nif(flag==1){\n printf(\"YES\\n%d\",n-1);\n}\nelse{\n printf(\"NO\");\n}\nreturn 0;\n}\n "}, {"source_code": "#include <stdio.h>\nint main(){\nlong long i,a,b,count=0;\nscanf(\"%I64d%I64d\",&a,&b);\nif(b%a!=0){\n printf(\"NO\");\n}\nelse if(a==10 && b==2000000000){\n printf(\"NO\");\n}\nelse if(a==b){\n printf(\"YES\\n\");\n printf(\"0\");\n}\nelse{\n for(i=a;i<=b;i=i*a){\n if(b%a==0){\n count=count+1;\n }\n }\n if(count==1){\n printf(\"NO\");\n }\n else{\n printf(\"YES\\n\");\n printf(\"%I64d\",count-1);\n }\n}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(void){\n int k,l;\n int i=1;\n int mul=1;\n int ok=1;\n scanf(\"%d%d\",&k,&l);\n for (i=1; mul<=l ;i++)\n {\n mul=pow(k,i);\n if (mul==l){\n printf(\"YES\\n%d\",i-1);\n ok=0;\n break;\n }\n }\n if (ok)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a,a1,i,b,c=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&a1); \n if(a1==pow(a,2))\n {\n \tprintf(\"YES\\n1\\n\");\n\t}\n\telse if(a1==pow(a,3))\n\t{\n\t\tprintf(\"YES\\n2\\n\");\n\t}\n else\n {\n \tprintf(\"NO\\n\");\n\t}\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, hom, c, cont, aux, i, j;\n double res;\n \n hom = 1; c = 1; cont = 0;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n if(a==b && a==2147483647)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n } \n \n\n else\n {\n \n hom = b/a;\n c = hom*a; \n \n if(c == b) \n {\n for(i=a; i<=b; i*=a)\n cont++;\n }\n res = pow(a, cont);\n j = (int)res;\n \n \n \n aux = cont-1;\n if(a == 581)\n {\n aux = cont-2;\n }\n if(a == 35)\n {\n aux = cont-5;\n } \n \n \n if(a==b || j==b) \n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n \n else{\n printf(\"NO\"); }\n }\n\n return 0; \n}\n \n \n \n \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,x,i,y=0;\n double j;\n scanf(\"%d%d\",&n,&x);\n for(i=1;i<=32;i++) {\n j=pow(n,i);\n if(j==x) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n y=0;\n break;\n }\n else {\n y=1;\n }\n }\n if(y==1) {\n printf(\"NO\");\n }\n\n /*if(j==x) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else {\n printf(\"NO\");\n }*/\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, hom, c, cont, aux, i, res;\n \n hom = 1; c = 1; cont = 0;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n hom = b/a;\n c = hom*a;\n if(c == b)\n {\n for(i=a; i<=b; i*=a)\n cont++;\n }\n res = pow(a, cont);\n \n aux = cont-1; \n \n if(((res+1)==b) || (res == a) || a==b || res ==b) \n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n \n else\n printf(\"NO\"); \n \n return 0; \n \n}\n \n \n \n \n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong long int main()\n{\n\tlong long int k,pow,check=1,count=0,i;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%lld\",&pow);\n\tcheck=1;\n\tfor(i=0;;i++)\n\t{\n\t\tcheck=k*check;\n\t\tif(check==pow)\n\t\t\tbreak;\n\t\telse if(check > pow)\n\t\t{\n\t\t\tcount=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(count==1)\n\t\tprintf(\"NO\\n\");\n\telse \n\t\tprintf(\"YES\\n%lld\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,k,i,e;\n while(scanf(\"%d\",&n)!=EOF)\n {\n scanf(\"%d\",&k);\n e=-1;\n for(i=1;i<31;i++)\n {\n if(k==pow(n,i))\n {\n e=i-1;\n break;\n }\n else\n e=-1;\n }\n if(e!=-1)\n printf(\"YES\\n%d\\n\",e);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n double k, l, a, b=0, count;\n int i=0, num, x=0;\n scanf(\"%lf\", &k);\n scanf(\"%lf\", &l);\n a = l/k;\n num=(int)a;\n if(a==num){\n printf(\"YES\\n\");\n x=1;\n }\n else{\n printf(\"NO\");\n return 0;\n }\n count=k;\n while(b<a){\n b=count;\n count*=k;\n i++;\n }\n if(x==1){\n printf(\"%d\", i);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n \nint n,k;\n\nscanf(\"%d %d\" ,&k,&n);\n\nwhile(1){\n\n if(n%k !=0){\n\n printf(\"NO\");\n return 0;\n }\n\n n = n/k;\n \n if(n == k){\n printf(\"YES\");\n return 0;\n }\n\n\n}\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\nint main()\n{\n double n, k, a=0, b, c;\n scanf(\"%lf\", &n);\n scanf(\"%lf\", &k);\n for(b=1.0;;b++){\n c = pow(n,b);\n if(c==k){\n a = 1;\n break;\n }\n if(k<c){\n break;\n }\n }\n if(a==1){\n printf(\"YES \\n%.0lf\", b-1);\n }\n else if(a==0){\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int k,l,sum,i;\n while(scanf(\"%d%d\",&k,&l)!=EOF)\n {\n sum=0;\n for(i=1;;i++)\n {\n k=pow(k,i);\n if(k<=l)\n {\n if(k==l)\n {\n break;\n }\n }\n else\n break;\n }\n if(k==l)\n printf(\"YES\\n%d\\n\",i-1);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nlong long int k,i=0,l,t,n;\nscanf(\"%I64d\\n%I64d\",&k,&l);n=l;\nwhile(l!=0)\n{\ni++;\nl=l/k;\n}i--;t=pow(k,i);\nif(t==n)\nprintf(\"YES\\n%I64d\",i-1);\nelse\nprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int n,x,i,y=0;\n double j;\n scanf(\"%d%d\",&n,&x);\n for(i=0;i<32;i++) {\n j=pow(n,i);\n if(x==j) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n y=0;\n break;\n }\n else {\n y=1;\n }\n }\n if(y==1) {\n printf(\"NO\");\n }\n\n /*if(j==x) {\n printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else {\n printf(\"NO\");\n }*/\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int k , l ,i ,x,y ;\n int flag=0;\n scanf(\"%d%d\",&k,&l);\n y = sqrt(l);\n if (k!=5){\n for (i=1; i<=y;i++)\n {\n x = pow(k,i);\n if(x==l)\n {\n flag=1;\n break;\n }\n }}\n else {\n for (i=1; i<=y;i++)\n {\n x = pow(k,i)+1;\n\n if(x==l)\n {\n flag=1;\n break;\n }\n }\n }\n if (flag==1)\n {\n printf(\"YES\\n%d\",i-1);\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int n,d,k=0,i=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&d);\n\n\tfor(;d>1;d=d/n)\n\t{\n\t k=d%n;\n\t \n\t if(k!=0)\n\t {\n\t break;\n\t }\n\t else\n\t i++;\n\t}\n\tif(k!=0)\n\tprintf(\"NO\");\n\telse\n\t{\n\t printf(\"yes\");\n\t printf(\"%d\",i);\n\t\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,l,count=0;\n\tscanf(\"%I64d %I64d\",&n,&l);\n\twhile(1)\n\t{\n\t\tif(l%n==0)\n\t\t{\n\t\t\tl=l/n;\n\t\t\tcount++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"NO\");\n\t\t\treturn 0;\n\t\t}\n\t\tif(l==n)\n\t\t{\n\t\t\tprintf(\"YES\\n\");\n\t\t\tprintf(\"%d\",count);\n\t\t\treturn 0;\n\t\t}\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, i, aux;\n double pot;\n int cont = 0; \n int test = 1;\n int c = 1;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n c = b/a;\n test = c*a;\n \n if(test == b)\n {\n for(i=a; i<=b; i*=a)\n cont++; \n }\n \n aux = cont-1;\n \n pot = pow(a, cont);\n int j = (int)pot;\n \n if(j == b || a == b || aux>=0)\n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n else\n printf(\"NO\");\n \n \n \n \n return 0;\n}\n \n \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n int n,k,i=0;\n scanf(\"%d%d\",&n,&k);\n while(1)\n {\n k/=n;\n i++;\n if(k==1)\n {\n printf(\"YES\\n%d\",i-1);\n return 0;\n }\n if(k<1)\n {\n printf(\"NO\");\n return 0;\n }\n }\n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int main()\n{\n long long int k,l; int j,m=0,c=0;\n\n scanf(\"%I64d%I64d\",&k,&l);\n\n while(l!=0 && l!=1)\n {\n j=l%k;\n if(j==0)\n {\n c++;\n }\n else if(j!=0)\n {\n m++;\n }\nl=l/k;\n }\n if(m!=0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n\");\n printf(\"%d\",c);\n }\nreturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k, l, cnt;\n\n\tscanf(\"%d%d\", &k, &l);\n\tcnt = 0;\n\twhile (l > k) {\n\t\tl /= k;\n\t\tcnt++;\n\t}\n\tif (l == k)\n\t\tprintf(\"YES\\n%d\", cnt);\n\telse\n\t\tprintf(\"NO\");\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\tint a,b,c;\n\tscanf (\"%d%d\",&a,&b);\n\t c=0;\n\t\twhile (b%a==0&&b>a){\n\t\t\tb=b/a;\n\t\t\tc++;\n\t\t\tif (b%a!=0) c=0;\n\t\t}\n\tif (c)printf (\"YES\\n%d\\n\",c);\n\telse printf (\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, hom, c, cont, aux, i, res;\n \n hom = 1; c = 1; cont = 0;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n if(a==b && a==2147483647)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n }\n \n else if(a == 2 && b == 1073741824)\n {\n printf(\"YES\\n\");\n printf(\"29\");\n }\n \n else if(a == 10 && b == 2000000000)\n printf(\"NO\");\n \n else if(a == 2 && b == 2147483646)\n printf(\"NO\");\n \n else\n {\n \n hom = b/a;\n c = hom*a; \n \n if(c == b) \n {\n for(i=a; i<=b; i*=a)\n cont++;\n }\n res = pow(a, cont);\n \n \n aux = cont-1;\n if(a == 581)\n {\n aux = cont-2;\n }\n if(a == 35)\n {\n aux = cont-5;\n } \n \n \n if(((res+1)==b) || (res == a) || a==b || res == b || aux >=0) \n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n \n else\n printf(\"NO\"); \n }\n \n return 0; \n \n}\n \n \n \n \n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%lld\",&first);\n\tscanf(\"%lld\",&last);\n\n// first=146;\n// last=1913781536;\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t\t//printf(\"Z:%d\\n\",z);\n\t}\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\t}\n\telse\n\tprintf(\"NO\");\n\t\n\n\n\n\n\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n long long no_of_div=0;\n if((l%k)==0)\n {\n while((l/k)>=k)\n {\n l=l/k;\n no_of_div+=1;\n }\n if((l/k)==k)\n {\n printf(\"YES\\n\");\n printf(\"%I64d\",no_of_div);\n exit(0);\n }\n else\n {\n printf(\"NO\");\n exit(0);\n }\n }\n else if(l%k!=0)\n {\n printf(\"NO\");\n exit(0);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tint a,b;\n\tscanf(\"%d %d\",&a,&b);\n\tif(a*a==b)\n\t{\n\t\tputs(\"YES\");\n\t\tputs(\"1\");\n\t}\n\telse if(a*a*a==b)\n\t{\n\t\tputs(\"YES\");\n\t\tputs(\"2\");\n\t}\n\telse\n\t\tputs(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint k,l,n=1,flag;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\twhile(1)\n\t{\n\t\tif(l%k!=0)\n\t\t{\n\t\t\tflag=1;\n\t\t\tbreak;\n\t\t}\n\t\telse \n\t\tl/=k;\n\t\tn++;\n\t\tif(k==l)\t\n\t\t{\n\t\t\tflag=2;\n\t\t\tbreak;\n\t\t}\t\n\t}\n\tif(flag==2)\n\t{\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%d\\n\",n-1);\n\t}\n\telse printf(\"NO\");\n\treturn 0;\n}\n\n\n\n\n\n\n"}, {"source_code": "\n#include<stdio.h>\nint main()\n{\n int n,i,j,k=0,l=0,p=0;\n scanf(\"%d\",&n);\n int arr[n][3];\n for(i=0;i<n;i++)\n {\n for(j=0;j<3;j++)\n scanf(\"%d\",&arr[i][j]);\n }\n for(i=0;i<n;i++)\n{\n k=k+arr[i][0];\n l=l+arr[i][1];\n p=p+arr[i][2];\n}\n if(k==0&&l==0&&p==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n unsigned long long int k,l,i,s,f=0,t;\n scanf(\"%lld\\n\",&k);\n scanf(\"%lld\",&l);\n i=1;\n while(s<=10000000000000000000)\n {\n s=(unsigned long long int )pow(k,i);\n if(s==l)\n {\n f=1;\n t=i;\n break;\n }\n else if(s>l)\n {\n printf(\"NO\");\n return 0;\n }\n else\n {\n i++;\n continue;\n\n }\n\n }\n if(f==1)\n {\n printf(\"YES\\n\");\n printf(\"%lld\",i-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n\tint k ;\n int l ;\n\n scanf(\"%d %d\", &k, &l) ;\n\n if(l % k == 0)\n {\n double x = log((double)l) / log((double)k) ;\n\n if(x - (int)x == 0)\n {\n printf(\"YES\\n%.f\", x- 1);\n }\n }\n\n else\n printf(\"NO\\n\");\n\n\treturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n int i=0;\n if(l<k)\n {\n while(l<k)\n {\n l*=l;\n if(l<0) break;\n i++;\n }\n }\n else\n {\n while(l>k)\n {\n if(l%k) break;\n l/=k;\n i++;\n }\n }\n if(l==k)\n {\n printf(\"%s\\n%d\",\"YES\",i);\n return 0;\n }\n printf(\"%s\",\"NO\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n long long int n,k,i,count =0,t;\n scanf(\"%lld %lld\",&n,&k);\n for(i=0; i<1000; i++)\n {\n t=k/n;\n if(t<n)\n {\n t++;\n }\n }\n if(k%n==0 && t==n)\n {\n if (n==k)\n {\n printf(\"YES\\n0\");\n return 0;\n }\n\n {\n printf(\"YES\\n\");\n for(i=0; i<1000; i++)\n {\n k=k/n;\n if(k!=n)\n {\n count++;\n }\n else\n {\n count++;\n break;\n }\n\n\n }\n printf(\"%lld\",count);\n }\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n int k,l,sum,i;\n while(scanf(\"%d%d\",&k,&l)!=EOF)\n {\n sum=0;\n for(i=1;;i++)\n {\n k=pow(k,i);\n if(k<=l)\n {\n if(k==l)\n {\n break;\n }\n }\n else\n break;\n }\n if(k==l)\n printf(\"YES\\n%d\\n\",i-1);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned long long k;\n scanf(\"%llu\", &k);\n unsigned long long l;\n scanf(\"%llu\", &l);\n unsigned long long count=0;\n while (k<l)\n {\n k*=k;\n count++;\n if (k>l)\n {\n printf(\"NO\");\n }\n if (k==l)\n {\n printf(\"YES \\n\");\n printf(\"%llu\", count);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint k, l, cnt;\n\n\tscanf(\"%d%d\", &k, &l);\n\tcnt = 0;\n\twhile (l > k) {\n\t\tl /= k;\n\t\tcnt++;\n\t}\n\tif (l == k)\n\t\tprintf(\"YES\\n%d\", cnt);\n\telse\n\t\tprintf(\"NO\");\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long int pow(long long int k,int i)\n{\n while(i--)\n k=k*k;\n return k;\n}\nint main()\n{\n long long int k,l;\n scanf(\"%I64d%I64d\",&k,&l);\n int i=0;\n while(pow(k,i)<=l)\n {\n if(pow(k,i)==l)\n {\n printf(\"YES\\n\");\n printf(\"%d\",i);\n return 0;\n }\n i++;\n }\n printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, hom, c, cont, aux, i, res;\n \n hom = 1; c = 1; cont = 0;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n hom = b/a;\n c = hom*a;\n if(c == b)\n {\n for(i=a; i<=b; i*=a)\n cont++;\n }\n res = pow(a, cont);\n \n aux = cont-1; \n \n if(((res+1)==b) || (res == a) || a==b || res ==b) \n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n \n else\n printf(\"NO\"); \n \n return 0; \n \n}\n \n \n \n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a, b;\n int s;\n scanf(\"%I64d%I64d\", &a,&b);\n s = b%a;\n if(s==0){\n printf(\"YES\\n1\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <inttypes.h>\n#include <math.h>\nint main()\n{\n int64_t n,k,c,x1,z1;\n double x,z;\n char c1,c2;\n scanf(\"%I64d %I64d\",&n,&k);\n z=n;c=0;\n if(n==1 && k==1)\n printf(\"YES\\n0\");\n else if(n==1 && k!=1)\n printf(\"NO\");\n else\n {\n x=log10(k)/log10(n);\n z=round(x);\n x1=(int)x;\n z1=(int)z;\n c=z-1;\n c1=(char)x1;\n c2=(char)z1;\n //printf(\"x %lf z %lf\\n %c %c\",x,z,c1,c2);\n if(c1==c2)\n printf(\"YES\\n%d\",c);\n else\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int k,l,r,i=0;\n scanf(\"%lld %lld\",&k,&l);\n r=k;\n for(i=1;;i++)\n {\n r*=k;\n if(r==l)\n {\n printf(\"YES\\n%lld\\n\",i);\n break;\n }\n else if(r>l)\n {\n printf(\"NO\\n\");\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,k;\n double t;\n scanf(\"%I64d%I64d\",&k,&l);\n t=log10(l)/log10(k);\n // printf(\"%lf\",t);\n if(floor(t)==ceil(t))\n {\n printf(\"YES\\n\");\n printf(\"%ld\",(int)(t-1));\n }\n else\n printf(\"NO\");\n\n // printf(\"%ld\",24*24*24*24*24*24);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<algorithm>\n#include<string.h>\n#include<math.h>\nchar a[3000000];\n\n//using namespace std;\nint main()\n{\n long long int i,ct=0,ck=0,l,m,m1,ans,length,n,sum=0;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&m);\n // cin>>n;\n //cin>>m;\n if(m%n==0)\n {\n\n for(i=1; i<10; i++)\n {\n sum=pow(n,i);\n // printf(\"%lld\\n\",sum);\n if(sum==m||sum+1==m)\n {\n printf(\"YES\\n\");\n ck=1;\n printf(\"%lld\",i-1);\n break;\n }\n }\n\n\n }\n if(ck==0)\n {\n printf(\"NO\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int l,k,i,n=0;\n scanf(\"%d\\n\",&k);\n scanf(\"%d\",&l);\n if(k==5)\n n=1;\n else\n {\n for(i=2;i<31;i++)\n {\n if(l==(pow(k,i)))\n {\n n=1;\n break;\n }\n \n }\n }\n if(n==1)\n { printf(\"YES\\n\");\n printf(\"%d\",i-1);\n }\n else\n printf(\"NO\");\n return 0;\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l,k,i,p=0;\n scanf(\"%I64d %I64d\",&k,&l);\n\n for(i=k;i<=l;i=i*k){\n if(i==l){\n printf(\"YES\\n%I64d\\n\",p);\n break;\n }\n p++;\n }\n if(l%k!=0){\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int a, b, i, aux;\n double pot;\n int cont = 0; \n int test = 1;\n int c = 1;\n \n scanf(\"%d\", &a);\n scanf(\"%d\", &b);\n \n if(a==b && a == 2147483647)\n {\n printf(\"YES\\n\");\n printf(\"0\");\n }\n \n else if(a==2 && b == 1073741824)\n {\n printf(\"YES\\n\");\n printf(\"29\");\n } \n \n else\n {\n c = b/a;\n test = c*a;\n \n if(test == b)\n {\n for(i=a; i<=b; i*=a)\n cont++; \n }\n \n aux = cont-1;\n \n pot = pow(a, cont);\n int j = (int)pot;\n \n if(a == 581)\n {\n printf(\"YES\\n\");\n printf(\"%d\", aux-1);\n }\n \n else if(a == 35)\n {\n printf(\"YES\\n\");\n printf(\"%d\", aux-4);\n }\n \n else if(j == b && aux>=0|| a == b)\n {\n printf(\"YES\\n\");\n printf(\"%d\", aux);\n }\n\n else\n printf(\"NO\");\n \n }\n return 0;\n}\n \n \n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a,a1,i,b,c=0;\n scanf(\"%d\",&a);\n scanf(\"%d\",&a1); \n for(i=1;i<=a1;i++)\n {\n \tif(a1==pow(a,i))\n \t{\n \t\tprintf(\"YES\\n\");\n\t\t\tprintf(\"%d\\n\",i-1);\t\n\t\t\tbreak;\n\t\t}\n\t}\n if(a1<i)\n {\n \tprintf(\"NO\\n\");\n\t}\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l=0,d,m,n;\n scanf(\"%d\",&n);\n scanf(\"%d\",&k);\n if(k%n)\n {\n printf(\"NO\"); \n }\n \n else\n { \n d=n;\n while(d<=k)\n {\n d=d*n;\n l++;\n }\n if(d==k)\n printf(\"YES\\n%d\",l);\n else\n printf(\"NO\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\nint main()\n{\n float k,l,c;\n int a=0;\n scanf(\"%f\\n%f\",&k,&l);\n float b=l/k;\n while(l>=k){\n a++;\n if(b==1){\n printf(\"YES\\n0\");\n break;\n }\n else if((b<1)||(l<k)||(b<k)){\n printf(\"NO\");\n break;\n }\n else if((l>k)&&(b>k)){\n l=b;\n b=l/k;\n continue;\n }\n else if(b==k){\n printf(\"YES\\n%d\",a);\n break;\n }\n }\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int k,l,r,la;\n scanf(\"%lld %lld\",&k,&l);\n r=l%k;\n if(r==0)\n {\n printf(\"YES\\n\");\n la=((l/k)/k);\n printf(\"%lld\\n\",la);\n }\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long k,l,i;\n\tlong long n=1;\n\tscanf(\"%lld%lld\",&k,&l);\n\tif(k==1)\n\t\tprintf(\"NO\\n\");\n\tfor(i=1;n<l;i++)\n\t{\n\t\tn=k*n;\n\t}\n\tif(n==l)\n\t\tprintf(\"YES\\n%lld\\n\",i-2);\n\telse\n\t\tprintf(\"NO\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint k,l=0,d,m,n;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&k);\n\tif(k%n)\n\t{\n\tprintf(\"NO\");\t\n\t}\n\telse\n\t{\t\n\t\td=n;\n\t\twhile(d<k)\n\t\t{\n\t\t\td=pow(n,l);\n\t\t\tl++;\n\t\t}\n\t\tif(d==k)\n\t\tprintf(\"YES\\n%d\",l);\n\t\telse\n\t\tprintf(\"NO\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\nint main()\n{\n\tint count = 1;\n\tdouble k;\n\tlong long a,b, l;\n\tscanf(\"%lf %lld\", &k,&l);\n\ta = k;\n\twhile (a >= l)\n\t{\n\t\ta = pow(k, count++);\n\t\tif (a > pow(2.0, 15))\n\t\t\tbreak;\n\t}\n\tif (a == l)\n\t\tprintf(\"YES\\n\");\n\telse\n\t{\n\t\ta = pow(k, count++);\n\t\tb = pow(k, count++);\n\t\tif (a != l && b != l)\n\t\t\tprintf(\"NO\\n\");\n\t\telse\n\t\t\tprintf(\"YES\\n\");\n\t}\n}\n\t\t\t \t\t \t \t\t\t\t\t \t\t\t \t\t \t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n long long no_of_div=0;\n if((l%k)==0)\n {\n while((l/k)>=k)\n {\n l=l/k;\n no_of_div+=1;\n }\n if((l/k)==k)\n {\n printf(\"YES\\n\");\n printf(\"%I64d\",no_of_div);\n exit(0);\n }\n else\n {\n printf(\"NO\");\n exit(0);\n }\n }\n else if(l%k!=0)\n {\n printf(\"NO\");\n exit(0);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,n,k;\n while((scanf(\"%d%d\",&n,&k))!=EOF)\n {\n for(i=0;k>=n;++i)\n k/=n;\n if(k!=1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n%d\\n\",i);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long a, b;\n int s,x;\n scanf(\"%I64d%I64d\", &a,&b);\n x = b/a;\n s = b%a;\n if(s==0&&x!=1){\n printf(\"YES\\n1\\n\");\n }\n else if(s==0&&x==1){\n printf(\"YES\\n0\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long k,l,i,j,x,y,n;\n while(scanf(\"%I64d %I64d\",&k,&l)!=EOF)\n {\n i=0;\n if(l%k==0){\n while(k<l)\n {\n if(l%k==0){\n l=l/k;\n i++;\n }\n }\n }\n if(i>0)\n printf(\"YES\\n%I64d\\n\",i);\n else\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint pow,count=0,i;\n\tlong long int k,check=1;\n\tscanf(\"%lld\",&k);\n\tscanf(\"%d\",&pow);\n\tcheck=1;\n\tfor(i=0;;i++)\n\t{\n\t\tcheck=k*check;\n\t\tif(check==pow)\n\t\t\tbreak;\n\t\telse if(check > pow)\n\t\t{\n\t\t\tcount=1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(count==1)\n\t\tprintf(\"NO\\n\");\n\telse \n\t\tprintf(\"YES\\n%d\\n\",i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%lld\",&first);\n\tscanf(\"%lld\",&last);\n\n// first=146;\n// last=1913781536;\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t\t//printf(\"Z:%d\\n\",z);\n\t}\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\t}\n\telse\n\tprintf(\"NO\");\n\t\n\n\n\n\n\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main(void){\n int k,l;\n int i;\n int ok=1;\n scanf(\"%d%d\",&k,&l);\n for (i=1; k*i<=l ;i++)\n {\n if (pow(k,i)==l){\n printf(\"YES\\n%d\",i-1);\n ok=0;\n break;\n }\n }\n if (ok)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%lld\",&first);\n\tscanf(\"%lld\",&last);\n\n// first=146;\n// last=1913781536;\n\n\tz=first;\t\n\tif(last%first==0)\n\t{\n\t\twhile(z<last)\n\t\t{\n\t\tz=z*first;\n\t\tx++;\n\t\t//printf(\"Z:%d\\n\",z);\n\t}\n\tif(z==last)\n\t{\n\tprintf(\"YES\\n\");\n\tprintf(\"%hd\",x);\n\t}\n\t}\n\telse\n\tprintf(\"NO\");\n\t\n\n\n\n\n\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint main()\n{\n int k ;\n int l ;\n\n scanf(\"%d %d\", &k, &l) ;\n\n if(l % k == 0)\n {\n double x = log((double)l) / log((double)k) ;\n\n if(x - (int)x == 0)\n {\n printf(\"YES\\n%.f\\n\", x- 1);\n }\n }\n\n else\n printf(\"NO\\n\");\n\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nmain()\n{\n int n,k,i,y,f=0;\n double x;\n scanf(\"%d %d\",&n,&k);\n for(i=0;i<=k;i++){\n x=pow(n,i);\n if(x==k){\n f=1;\n y=i;\n break;\n }\n //printf(\"%lf \",x);\n }\n //printf(\"%d\",y);\n if(f==1){\n printf(\"YES\\n\");\n printf(\"%d\",y-1);\n }\n else{\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n int k,l;\n int i;\n int ok=1;\n scanf(\"%d%d\",&k,&l);\n for (i=1; k*i<=l ;i++)\n {\n if (pow(k,i)==l){\n printf(\"YES\\n%d\",i-1);\n ok=0;\n break;\n }\n }\n if (ok)\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n long long int k,l,i,num=1;\n scanf(\"%I64d%I64d\",&k,&l);\n for(i=1;i>=0;i++)\n {\n num=num*k;\n if(num>l)\n {\n printf(\"No\");\n break;\n }\n else if(num==l)\n {\n printf(\"Yes\\n\");\n printf(\"%I64d\",i-1);\n break;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint k, l, pow = 0;\n\tscanf(\"%d\",&k);\n\tscanf(\"%d\",&l);\n\n\twhile(l>k)\n\t{\n\t\tif(l%k != 0)\n\t\t{\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tl /= k;\n\t\tpow++;\n\t}\n\tprintf(\"YES\\n%d\\n\",pow);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned long long k;\n scanf(\"%llu\", &k);\n unsigned long long l;\n scanf(\"%llu\", &l);\n unsigned long long count=0;\n while (k<l)\n {\n k*=k;\n count++;\n if (k>l)\n {\n printf(\"NO\");\n }\n if (k==l)\n {\n printf(\"YES \\n\");\n printf(\"%llu\", count);\n }\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n unsigned long long int k,l,i,s,f=0,t;\n scanf(\"%lld\",&k);\n scanf(\"%lld\",&l);\n i=1;\n while(s<=10000000000000000000)\n {\n s=(unsigned long long int )pow(k,i);\n if(s==l)\n {\n f=1;\n t=i;\n break;\n }\n else if(s>l)\n {\n printf(\"NO\\n\");\n return 0;\n }\n else\n {\n i++;\n continue;\n\n }\n\n }\n if(f==1)\n {\n printf(\"YES\\n\");\n printf(\"%lld\",t-1);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main()\n{\n\tshort x=0;\n\tlong long first,last,z=0;\n\t\n\tscanf(\"%lld\",&first);\n\tscanf(\"%lld\",&last);\n\n// first=146;\n// last=1913781536;\n\n\t\n\tif(last%first==0)\n\t{\n\t\tz=last/first;\n\t\twhile(z>=first)\n\t\t{\n\t\tz=z/first;\n\t\tx++;\n\t\t//printf(\"Z:%d\\n\",z);\n\t}\n\t\tprintf(\"YES\\n\");\n\t\tprintf(\"%hd\\n\",x);\n\t}\n\telse\n\tprintf(\"NO\");\n\t\n\n\n\n\n\n\nreturn 0;\n}\n\t\t\n\n\n\t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main()\n{\n long long k,l;\n scanf(\"%I64d %I64d\",&k,&l);\n long long no_of_div=1;\n if((l%k)==0)\n {\n while((l/k)>k)\n {\n no_of_div+=1;\n }\n printf(\"YES\\n\");\n printf(\"%I64d\",no_of_div);\n exit(0);\n }\n else if(l%k!=0)\n {\n printf(\"NO\");\n exit(0);\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l,k,i,p=0;\n scanf(\"%I64d %I64d\",&k,&l);\n \n for(i=k;i<=l;i=i*k){\n if(i==l){\n printf(\"YES\\n%I64d\\n\",p);\n break;\n }\n p++;\n }\n if(l%k!=0){\n printf(\"NO\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long int l,k;\n double t;\n scanf(\"%ld%ld\",&k,&l);\n t=(double)log10(l)/log10(k);\n if(floor(t)==ceil(t))\n {\n printf(\"YES\\n\");\n printf(\"%ld\",(int)(t-1));\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,k,i,count =1;\n scanf(\"%d %d\",&n,&k);\n if(k%n==0)\n {\n printf(\"YES\\n\");\n for(i=0;i<k;i++)\n {\n k=k/n;\n if(k==n)\n {\n break;\n }\n\n else\n {\n count++;\n\n }\n }\n printf(\"%d\",count);\n }\n else{\n printf(\"NO\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,l,i,s;\n scanf(\"%d %d\", &k, &l);\n if(l%k==0)\n {\n printf(\"YES\\n\");\n for(i=0;i>=0;i++)\n {\n s=powl(k,i);\n if(s==l)break;\n }\n printf(\"%d\", i);\n }\n else\n {\n printf(\"NO\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\n int x, y;\n scanf(\"%d%d\", &x, &y);\n\n float result;\n result=log(y)/log(x);\n\n\n if(result==floor(result))\n {\n printf(\"Yes\\n\");\n printf(\"%d\\n\", (int)(result)-1);\n }\n else\n printf(\"No\");\n\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int n,k,i,count=0,rem=0;\n scanf(\"%lld %lld\",&n,&k);\n if(k%n!=0) printf(\"NO\");\n else\n {\n while(k>=n && rem==0)\n {\n rem=k%n;\n k=k/n;\n count++;\n }\n if(rem!=0)\n {\n printf(\"NO\");\n }\n else\n {\n printf(\"YES\\n%lld\",count-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nlong long int k,i=0,l,t,n;\nscanf(\"%I64d\\n%I64d\",&k,&l);n=l;\nwhile(l!=0)\n{\ni++;\nl=l/k;\n}i--;t=pow(k,i);\nif(t==n)\nprintf(\"YES\\n%I64d\",i-1);\nelse\nprintf(\"NO\");\nreturn 0;\n}\n"}], "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46"} {"nl": {"description": "You are given a rectangle grid. That grid's size is n\u2009\u00d7\u2009m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates \u2014 a pair of integers (x,\u2009y) (0\u2009\u2264\u2009x\u2009\u2264\u2009n,\u20090\u2009\u2264\u2009y\u2009\u2264\u2009m).Your task is to find a maximum sub-rectangle on the grid (x1,\u2009y1,\u2009x2,\u2009y2) so that it contains the given point (x,\u2009y), and its length-width ratio is exactly (a,\u2009b). In other words the following conditions must hold: 0\u2009\u2264\u2009x1\u2009\u2264\u2009x\u2009\u2264\u2009x2\u2009\u2264\u2009n, 0\u2009\u2264\u2009y1\u2009\u2264\u2009y\u2009\u2264\u2009y2\u2009\u2264\u2009m, .The sides of this sub-rectangle should be parallel to the axes. And values x1,\u2009y1,\u2009x2,\u2009y2 should be integers. If there are multiple solutions, find the rectangle which is closest to (x,\u2009y). Here \"closest\" means the Euclid distance between (x,\u2009y) and the center of the rectangle is as small as possible. If there are still multiple solutions, find the lexicographically minimum one. Here \"lexicographically minimum\" means that we should consider the sub-rectangle as sequence of integers (x1,\u2009y1,\u2009x2,\u2009y2), so we can choose the lexicographically minimum one.", "input_spec": "The first line contains six integers n,\u2009m,\u2009x,\u2009y,\u2009a,\u2009b (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009109,\u20090\u2009\u2264\u2009x\u2009\u2264\u2009n,\u20090\u2009\u2264\u2009y\u2009\u2264\u2009m,\u20091\u2009\u2264\u2009a\u2009\u2264\u2009n,\u20091\u2009\u2264\u2009b\u2009\u2264\u2009m).", "output_spec": "Print four integers x1,\u2009y1,\u2009x2,\u2009y2, which represent the founded sub-rectangle whose left-bottom point is (x1,\u2009y1) and right-up point is (x2,\u2009y2).", "sample_inputs": ["9 9 5 5 2 1", "100 100 52 50 46 56"], "sample_outputs": ["1 3 9 7", "17 8 86 92"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\n#define MAX(a, b) ((a) > (b) ? (a) : (b))\n#define MIN(a, b) ((a) < (b) ? (a) : (b))\n\nlong long gcd(long long a, long long b) {\n if (a % b == 0) {\n return b;\n }\n return gcd(b, a % b);\n}\n\nint main(void) {\n long long n, m, x, y, a, b;\n scanf(\"%lld %lld %lld %lld %lld %lld\", &n, &m, &x, &y, &a, &b);\n \n long long d = gcd(a, b);\n a /= d;\n b /= d;\n \n int ans[4];\n long long lo = 1, hi = n;\n while (lo <= hi) {\n long long mid = (lo + hi) / 2;\n \n long long lx = mid * a;\n long long ly = lx * b / a;\n \n long long x0 = MAX(0, x - lx);\n long long y0 = MAX(0, y - ly);\n \n if (x0 + lx <= n && y0 + ly <= m) {\n lo = mid + 1;\n ans[0] = x0, ans[1] = y0;\n ans[2] = x0 + lx, ans[3] = y0 + ly;\n } else {\n hi = mid - 1;\n }\n }\n \n int lx = ans[2] - ans[0];\n if (x >= ans[0] + (lx+1)/2) {\n int r = x - (ans[0] + (lx+1)/2);\n int w = n - ans[2];\n ans[0] += MIN(r, w);\n ans[2] += MIN(r, w);\n }\n \n int ly = ans[3] - ans[1];\n if (y >= ans[1] + (ly+1)/2) {\n int r = y - (ans[1] + (ly+1)/2);\n int w = m - ans[3];\n ans[1] += MIN(r, w);\n ans[3] += MIN(r, w);\n }\n \n for (int i = 0; i < 4; i++) {\n printf(\"%i \", ans[i]);\n }\n puts(\"\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if (a % b == 0) {\n return b;\n } else {\n return gcd(b, a % b);\n }\n}\n\nint min(int a, int b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint main()\n{\n int n, m, x, y, a, b, g, p, x1, y1, x2, y2;\n \n scanf(\"%d %d %d %d %d %d\", &n, &m, &x, &y, &a, &b);\n \n g = gcd(a, b);\n \n a /= g;\n b /= g;\n \n p = min(n / a, m / b);\n \n a *= p;\n b *= p;\n \n if ((a + 1) / 2 <= x && n - a / 2 >= x) {\n x1 = x - (a + 1) / 2;\n x2 = x1 + a;\n } else if ((a + 1) / 2 <= x) {\n x1 = n - a;\n x2 = n;\n } else {\n x1 = 0;\n x2 = a;\n }\n \n if ((b + 1) / 2 <= y && m - b / 2 >= y) {\n y1 = y - (b + 1) / 2;\n y2 = y1 + b;\n } else if ((b + 1) / 2 <= y) {\n y1 = m - b;\n y2 = m;\n } else {\n y1 = 0;\n y2 = b;\n }\n \n printf(\"%d %d %d %d\\n\", x1, y1, x2, y2);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nlong long int gcd(long long int a, long long int b)\n{\n if(b==0)\n\treturn a;\n else\n\treturn gcd(b,a%b);\n}\nint main()\n{\n long long int n,m,x,y,a,b,x1,y1,x2,y2;\n scanf(\"%lld%lld%lld%lld%lld%lld\",&n,&m,&x,&y,&a,&b);\n long long int wi,br,gc=gcd(a,b);\n a=a/gc;\n b=b/gc;\n long long int p=min((n/a),(m/b));\n wi=a*p;\n br=b*p;\n if(wi%2==0)\n {\n\tif(x+(wi/2)<=n)\n\t{\n\t if(x-(wi/2)>=0)\n\t {\n\t\tx2=x+(wi/2);\n\t\tx1=x-(wi/2);\n\t }\n\t else\n\t {\n\t\tx1=0;\n\t\tx2=wi;\n\t }\n\t}\n\telse\n\t{\n\t x2=n;\n\t x1=n-wi;\n\t}\n }\n else\n {\n\tif(x+(wi/2)<=n)\n\t{\n\t if(x-(wi/2)-1>=0)\n\t {\n\t\tx2=x+(wi/2);\n\t\tx1=x-(wi/2)-1;\n\t }\n\t else\n\t {\n\t\tx1=0;\n\t\tx2=wi;\n\t }\n\t}\n\telse\n\t{\n\t x2=n;\n\t x1=n-wi;\n\t}\n }\n if(br%2==0)\n {\n\tif(y+(br/2)<=m)\n\t{\n\t if(y-(br/2)>=0)\n\t {\n\t\ty2=y+(br/2);\n\t\ty1=y-(br/2);\n\t }\n\t else\n\t {\n\t\ty1=0;\n\t\ty2=br;\n\t }\n\t}\n\telse\n\t{\n\t y2=m;\n\t y1=m-br;\n\t}\n }\n else\n {\n\tif(y+(br/2)<=m)\n\t{\n\t if(y-(br/2)-1>=0)\n\t {\n\t\ty2=y+(br/2);\n\t\ty1=y-(br/2)-1;\n\t }\n\t else\n\t {\n\t\ty1=0;\n\t\ty2=br;\n\t }\n\t}\n\telse\n\t{\n\t y2=m;\n\t y1=m-br;\n\t}\n }\n printf(\"%lld %lld %lld %lld\\n\",x1,y1,x2,y2);\n return 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n\nint gcd(int a, int b){\n while ((a %= b) && (b %= a));\n return a + b;\n}\n\nint main(){\n int n, m, x, y, a, b, g, r, x1, y1;\n scanf(\"%d%d%d%d%d%d\", &n, &m, &x, &y, &a, &b);\n g = gcd(a, b);\n a /= g, b /= g;\n r = n / a;\n if (m / b < r)r = m / b;\n a *= r, b *= r;\n if (x + a / 2 >= n)x1 = n - a;\n else if (x - a / 2 <= 0)x1 = 0;\n else x1 = x - (a + 1) / 2;\n if (y + b / 2 >= m)y1 = m - b;\n else if (y - b / 2 <= 0)y1 = 0;\n else y1 = y - (b + 1) / 2;\n printf(\"%d %d %d %d\\n\", x1, y1, x1 + a, y1 + b);\n return 0;\n}\n"}, {"source_code": "# include <stdio.h>\n# include <math.h>\nmain()\n{\n long long int n,m,x,y,a,b,p,q,x1,y1,c;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&n,&m,&x,&y,&a,&b);\n p=a;q=b;\n while(q!=0)\n {\n c=p%q;\n p=q;\n q=c;\n }\n //HCF=p;\n a/=p;b/=p;\n int i=1;\n if(1.0*n/a>1.0*m/b)i=m/b;\n else i=n/a;\n x1=x-ceil(1.0*a*i/2);y1=y-ceil(1.0*b*i/2);\n if((x1+a*i)>n)x1=n-a*i;if((y1+b*i)>m)y1=m-b*i;\n if(x1<0)x1=0;if(y1<0)y1=0;\n printf(\"%I64d %I64d %I64d %I64d\",x1,y1,x1+a*i,y1+b*i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint gcd(int x, int y)\n{\n\tint t;\n\tif ( x < y )\n\t{\n\t\tt = x;\n\t\tx = y;\n\t\ty = t;\n\t}\n\twhile ( y )\n\t{\n\t\tt = x % y;\n\t\tx = y;\n\t\ty = t;\n\t}\n\treturn x;\n}\n\nint main()\n{\n\tint nx, ny, x, y, a, b, x1, y1, x2, y2, gg;\n\tlong long w, h;\n\tscanf(\"%d%d%d%d%d%d\", &nx, &ny, &x, &y, &a, &b);\n\tgg = gcd(a, b);\n\ta /= gg;\n\tb /= gg;\n\tw = nx;\n\th = ny;\n\twhile ( w * b != h * a )\n\t{\n\t\th = w * b / a;\n\t\tif ( h > ny )\n\t\t\th = ny;\n\t\th -= h % b;\n\t\tw = h * a / b;\n\t\tif ( w > nx )\n\t\t\tw = nx;\n\t\tw -= w % a;\n\t}\n\tx1 = x - (w+1) / 2;\n\ty1 = y - (h+1) / 2;\n\tx2 = x1 + w;\n\ty2 = y1 + h;\n\tif ( x1 < 0 )\n\t\tx2 -= x1, x1 = 0;\n\tif ( y1 < 0 )\n\t\ty2 -= y1, y1 = 0;\n\tif ( x2 > nx )\n\t\tx1 -= (x2-nx), x2 = nx;\n\tif ( y2 > ny )\n\t\ty1 -= (y2-ny), y2 = ny;\n\tprintf(\"%d %d %d %d\\n\", x1, y1, x2, y2);\n\treturn 0;\n}\n\n/*\n1000000000 1000000000 1 1 100000001 100000000\n*/\n"}, {"source_code": "#include <stdio.h>\n\nint gcd(int a, int b)\n{\n if (a % b == 0) {\n return b;\n } else {\n return gcd(b, a % b);\n }\n}\n\nint min(int a, int b)\n{\n if (a < b) {\n return a;\n } else {\n return b;\n }\n}\n\nint main()\n{\n int n, m, x, y, a, b, g, p, x1, y1, x2, y2;\n \n scanf(\"%d %d %d %d %d %d\", &n, &m, &x, &y, &a, &b);\n \n g = gcd(a, b);\n \n a /= g;\n b /= g;\n \n p = min(n / a, m / b);\n \n a *= p;\n b *= p;\n \n if ((a + 1) / 2 <= x && n - a / 2 >= x) {\n x1 = x - (a + 1) / 2;\n x2 = x1 + a;\n } else if ((a + 1) / 2 <= x) {\n x1 = n - a;\n x2 = n;\n } else {\n x1 = 0;\n x2 = a;\n }\n \n if ((b + 1) / 2 <= y && m - b / 2 >= y) {\n y1 = y - (b + 1) / 2;\n y2 = y1 + b;\n } else if ((b + 1) / 2 <= y) {\n y1 = m - b;\n y2 = m;\n } else {\n y1 = 0;\n y2 = b;\n }\n \n printf(\"%d %d %d %d\\n\", x1, y1, x2, y2);\n \n return 0;\n}\n"}], "negative_code": [{"source_code": "# include <stdio.h>\n# include <math.h>\nmain()\n{\n long long int n,m,x,y,a,b,p,q,x1,y1,c;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&n,&m,&x,&y,&a,&b);\n p=a;q=b;\n while(q!=0)\n {\n c=p%q;\n p=q;\n q=c;\n }\n //HCF=p;\n a/=p;b/=p;\n int i=1;\n while((a*i)<=n && (b*i)<=m)i++;\n i--;\n x1=x-ceil(1.0*a*i/2);y1=y-ceil(1.0*b*i/2);\n if(x1<0)x1=0;if(y1<0)y1=0;\n printf(\"%I64d %I64d %I64d %I64d %I64d\",x1,y1,x1+a*i,y1+b*i,a*i);\n return 0;\n}\n"}, {"source_code": "# include <stdio.h>\n# include <math.h>\nmain()\n{\n long long int n,m,x,y,a,b,p,q,x1,y1,c;\n float min;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&n,&m,&x,&y,&a,&b);\n p=a;q=b;\n while(q!=0)\n {\n c=p%q;\n p=q;\n q=c;\n }\n //HCF=p;\n a/=p;b/=p;\n int i=1;\n while((a*i)<=n && (b*i)<=m)i++;\n i--;\n x1=0;y1=0;\n min=fabs(x1+1.0*a*i/2-x);\n while(fabs(++x1+1.0*a*i/2-x)<min && (x1+a*i)<=n) min=fabs(x1+1.0*a*i/2-x);\n min=abs(y1+b*i/2-y);\n while(fabs(++y1+1.0*b*i/2-y)<min && (y1+b*i)<=m) min=fabs(y1+1.0*b*i/2-y);\n x1--;y1--;\n printf(\"%I64d %I64d %I64d %I64d\",x1,y1,x1+a*i,y1+b*i);\n return 0;\n\n}\n"}, {"source_code": "# include <stdio.h>\n# include <math.h>\nmain()\n{\n long long int n,m,x,y,a,b,p,q,x1,y1,c;\n scanf(\"%I64d %I64d %I64d %I64d %I64d %I64d\",&n,&m,&x,&y,&a,&b);\n p=a;q=b;\n while(q!=0)\n {\n c=p%q;\n p=q;\n q=c;\n }\n //HCF=p;\n a/=p;b/=p;\n int i=1;\n while((a*i)<=n && (b*i)<=m)i++;\n i--;\n x1=x-ceil(1.0*a*i/2);y1=y-ceil(1.0*b*i/2);\n if(x1<0)x1=0;if(y1<0)y1=0;\n printf(\"%I64d %I64d %I64d %I64d\",x1,y1,x1+a*i,y1+b*i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n\tint nx, ny, x, y, a, b, x1, y1, x2, y2;\n\tlong long w, h;\n\tscanf(\"%d%d%d%d%d%d\", &nx, &ny, &x, &y, &a, &b);\n\tw = nx;\n\th = ny;\n\twhile ( w * b != h * a )\n\t{\n\t\th = w * b / a;\n\t\tif ( h > ny )\n\t\t\th = ny;\n\t\th -= h % b;\n\t\tw = h * a / b;\n\t\tif ( w > nx )\n\t\t\tw = nx;\n\t\tw -= w % a;\n\t}\n\tx1 = x - (w+1) / 2;\n\ty1 = y - (h+1) / 2;\n\tx2 = x1 + w;\n\ty2 = y1 + h;\n\tif ( x1 < 0 )\n\t\tx2 -= x1, x1 = 0;\n\tif ( y1 < 0 )\n\t\ty2 -= y1, y1 = 0;\n\tif ( x2 > nx )\n\t\tx1 -= (x2-nx), x2 = nx;\n\tif ( y2 > ny )\n\t\ty1 -= (y2-ny), y2 = ny;\n\tprintf(\"%d %d %d %d\\n\", x1, y1, x2, y2);\n\treturn 0;\n}\n\n/*\n1000000000 1000000000 1 1 100000001 100000000\n*/\n"}], "src_uid": "8f1211b995f35462ae83b2be27f54585"} {"nl": {"description": "You won't find this sequence on OEIS.", "input_spec": "One integer $$$r$$$ ($$$-45 \\le r \\le 2999$$$).", "output_spec": "One integer.", "sample_inputs": ["2999"], "sample_outputs": ["3000"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\r\nint main(){\r\n int n;\r\n scanf(\"%d\",&n);\r\n if(n < 1200){\r\n printf(\"%d\\n\",1200);\r\n }\r\n else if(n < 1400){\r\n printf(\"%d\\n\",1400);\r\n }\r\n else if(n < 1600){\r\n printf(\"%d\\n\",1600);\r\n }\r\n else if(n < 1900){\r\n printf(\"%d\\n\",1900);\r\n }\r\n else if(n < 2100){\r\n printf(\"%d\\n\",2100);\r\n }\r\n else if(n < 2300){\r\n printf(\"%d\\n\",2300); \r\n }\r\n else if(n < 2400){\r\n printf(\"%d\\n\",2400); \r\n }\r\n else if(n < 2600){\r\n printf(\"%d\\n\",2600); \r\n }\r\n else if(n < 3000){\r\n printf(\"%d\\n\",3000);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n#include<string.h>\r\nint main(){\r\n int r;\r\n scanf(\"%d\",&r);\r\n if(r<1200){\r\n printf(\"1200\\n\");\r\n }\r\n else if(r<1400){\r\n printf(\"1400\\n\");\r\n }\r\n else if(r<1600){\r\n printf(\"1600\\n\");\r\n }\r\n else if(r<1900){\r\n printf(\"1900\\n\");\r\n }\r\n else if(r<2100){\r\n printf(\"2100\\n\");\r\n }\r\n else if(r<2300){\r\n printf(\"2300\\n\");\r\n }\r\n else if(r<2400){\r\n printf(\"2400\\n\");\r\n }\r\n else if(r<2600){\r\n printf(\"2600\\n\");\r\n }\r\n else{\r\n printf(\"3000\\n\");\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n\tint n;\r\n\r\n\tscanf(\"%d\", &n);\r\n\tif (n < 1200)\r\n\t\tprintf(\"1200\\n\");\r\n\telse if (n < 1400)\r\n\t\tprintf(\"1400\\n\");\r\n\telse if (n < 1600)\r\n\t\tprintf(\"1600\\n\");\r\n\telse if (n < 1900)\r\n\t\tprintf(\"1900\\n\");\r\n\telse if (n < 2100)\r\n\t\tprintf(\"2100\\n\");\r\n\telse if (n < 2300)\r\n\t\tprintf(\"2300\\n\");\r\n\telse if (n < 2400)\r\n\t\tprintf(\"2400\\n\");\r\n\telse if (n < 2600)\r\n\t\tprintf(\"2600\\n\");\r\n\telse if (n < 3000)\r\n\t\tprintf(\"3000\\n\");\r\n\treturn 0;\r\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint num[]={1200,1400,1600,1900,2100,2300,2400,2600,3000};\n\tint i = 0;\n\twhile(num[i] <= n) i++;\n\tprintf(\"%d\", num[i]);\n}\n"}, {"source_code": "int main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n \r\n if(t < 0)\r\n puts(\"1200\");\r\n else if(t < 1200)\r\n puts(\"1200\");\r\n else if(t < 1400)\r\n puts(\"1400\");\r\n else if(t < 1600)\r\n puts(\"1600\");\r\n else if(t < 1900)\r\n puts(\"1900\");\r\n else if(t < 2100)\r\n puts(\"2100\");\r\n else if(t < 2300)\r\n puts(\"2300\");\r\n else if(t < 2400)\r\n puts(\"2400\");\r\n else if(t < 2600)\r\n puts(\"2600\");\r\n else\r\n puts(\"3000\"); \r\n \r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#define LL long long\r\nint mycmp(const void* a, const void* b);\r\nint read(void);\r\nint mycmp(const void* a, const void* b)\r\n{\r\n return *(int*)a-*(int*)b;\r\n}\r\nint read(void)\r\n{\r\n int s = 0, f = 1;\r\n char ch = getchar();\r\n while(ch < '0' || ch > '9')\r\n {\r\n if(ch == '-')\r\n f = -1;\r\n ch = getchar();\r\n }\r\n while(ch >= '0' && ch <= '9')\r\n {\r\n s = s * 10 + ch - '0';\r\n ch = getchar();\r\n }\r\n return s * f;\r\n}\r\n/********************/\r\nint main(void)\r\n{\r\n int n;\r\n n=read();\r\n if(n<1200)\r\n printf(\"1200\");\r\n else if(n<1400)\r\n printf(\"1400\");\r\n else if(n<1600)\r\n printf(\"1600\");\r\n else if(n<1900)\r\n printf(\"1900\");\r\n else if(n<2100)\r\n printf(\"2100\");\r\n else if(n<2300)\r\n printf(\"2300\");\r\n else if(n<2400)\r\n printf(\"2400\");\r\n else if(n<2600)\r\n printf(\"2600\");\r\n else\r\n printf(\"3000\");\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n\r\nint main()\r\n{\r\n int a;\r\n scanf(\"%d\",&a);\r\n if(a<1200)\r\n printf(\"1200\");\r\n else if(a<1400)\r\n printf(\"1400\");\r\n else if(a<1600)\r\n printf(\"1600\");\r\n else if(a<1900)\r\n printf(\"1900\");\r\n else if(a<2100)\r\n printf(\"2100\");\r\n else if(a<2300)\r\n printf(\"2300\");\r\n else if(a<2400)\r\n printf(\"2400\");\r\n else if(a<2600)\r\n printf(\"2600\");\r\n else \r\n printf(\"3000\");\r\n return 0;\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\nint main() {\r\n\tint n;\r\n\tscanf(\"%d\", &n);\r\n\tint num[]={1200,1400,1600,1900,2100,2300,2400,2600,3000};\r\n\tint i = 0;\r\n\twhile(num[i] <= n) i++;\r\n\tprintf(\"%d\", num[i]);\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main(){\r\n short n;\r\n scanf(\"%hi\", &n);\r\n if(n < 1200) printf(\"1200\");\r\n else if(n < 1400) printf(\"1400\");\r\n else if(n < 1600) printf(\"1600\");\r\n else if(n < 1900) printf(\"1900\");\r\n else if(n < 2100) printf(\"2100\");\r\n else if(n < 2300) printf(\"2300\");\r\n else if(n < 2400) printf(\"2400\");\r\n else if(n < 2600) printf(\"2600\");\r\n else if(n < 3000) printf(\"3000\");\r\n\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\nint main()\r\n{\r\n\tint n;\r\n\tscanf(\"%d\",&n);\r\n\tif(n<1200)\r\n\t{\r\n\t\tprintf(\"1200\");\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif(n<1400)\r\n\t\t{\r\n\t\t\tprintf(\"1400\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(n<1600)\r\n\t\t\t{\r\n\t\t\t\tprintf(\"1600\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(n<1900)\r\n\t\t\t\t{\r\n\t\t\t\t\tprintf(\"1900\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(n<2100)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tprintf(\"2100\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(n<2300)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tprintf(\"2300\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(n<2400)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tprintf(\"2400\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif(n<2600)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tprintf(\"2600\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tprintf(\"3000\");\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\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\treturn 0;\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n int n;\r\n scanf(\"%d\", &n);\r\n if (n <= 1199) printf(\"1200\\n\");\r\n else if (n <= 1399) printf(\"1400\\n\");\r\n else if (n <= 1599) printf(\"1600\\n\");\r\n else if (n <= 1899) printf(\"1900\\n\");\r\n else if (n <= 2099) printf(\"2100\\n\");\r\n else if (n <= 2299) printf(\"2300\\n\");\r\n else if (n <= 2399) printf(\"2400\\n\");\r\n else if (n <= 2599) printf(\"2600\\n\");\r\n else if (n <= 2999) printf(\"3000\\n\");\r\n \r\n}"}, {"source_code": "\r\nmain() {\r\n\tint n;\r\n\tscanf(\"%d\", &n);\r\n\tif(n < 1200) printf(\"1200\");\r\n\telse if(n < 1400) printf(\"1400\");\r\n\telse if(n < 1600) printf(\"1600\");\r\n\telse if(n < 1900) printf(\"1900\");\r\n\telse if(n < 2100) printf(\"2100\");\r\n\telse if(n < 2300) printf(\"2300\");\r\n\telse if(n < 2400) printf(\"2400\");\r\n\telse if(n < 2600) printf(\"2600\");\r\n\telse printf(\"3000\");\r\n\treturn 0;\r\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\r\n#include <math.h>\r\nint main(){\r\n int a,b;\r\n scanf(\"%d\",&a);\r\n b = a + pow((3000 - a),2);\r\n printf(\"%d\\n\",b);\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include <math.h>\r\nint main(){\r\n int a,b;\r\n scanf(\"%d\",&a);\r\n b = a + pow((3000 - a),3);\r\n printf(\"%d\\n\",b);\r\n}"}, {"source_code": "#include <stdio.h>\r\nint main(){\r\n int a,b;\r\n scanf(\"%d\",&a);\r\n if(a == 2999){\r\n b = a + 1;\r\n }\r\n else if(a == -45){\r\n b = a - 1;\r\n }\r\n else{\r\n b = a;\r\n }\r\n printf(\"%d\\n\",b);\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\nint main(){\r\n int a,b;\r\n scanf(\"%d\",&a);\r\n b = a + 1;\r\n printf(\"%d\\n\",b);\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\nint main(){\r\n int a,b;\r\n scanf(\"%d\",&a);\r\n b = a + 1;\r\n printf(\"%d\\n\",&b);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\nint main(){\r\n int r;\r\n scanf(\"%d\",&r);\r\n printf(\"%d\\n\",r+1);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\nint main(){\r\n int r;\r\n scanf(\"%d\",&r);\r\n printf(\"%d\\n\",r);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n#include<string.h>\r\nint main(){\r\n char r[5];\r\n scanf(\"%s\",&r);\r\n int l=strlen(r);\r\n if(r[0]=='-'){\r\n if(r[1]=='1' && l==2){\r\n printf(\"0\\n\");\r\n }\r\n else if(r[1]=='1' && l==3){\r\n if(r[2]=='0'){\r\n r[1]='9';\r\n }\r\n else{\r\n r[1]=r[2]-1;\r\n }\r\n printf(\"%c%c\\n\",r[0],r[1]);\r\n }\r\n else{\r\n for(int i=1;i<l;i++){\r\n if(r[i]=='0'){\r\n r[i]='9';\r\n }\r\n else{\r\n r[i]=r[i]-1;\r\n }\r\n }\r\n printf(\"%s\\n\",r);\r\n }\r\n }\r\n else{\r\n for(int i=0;i<l;i++){\r\n if(r[i]=='9'){\r\n r[i]='0';\r\n }\r\n else{\r\n r[i]=r[i]+1;\r\n }\r\n }\r\n printf(\"%s\\n\",r);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n#include<string.h>\r\nint main(){\r\n char r[5];\r\n scanf(\"%s\",&r);\r\n int l=strlen(r);\r\n if(r[0]=='-'){\r\n for(int i=1;i<l;i++){\r\n if(r[i]=='9'){\r\n r[i]='0';\r\n }\r\n else{\r\n r[i]=r[i]+1;\r\n }\r\n }\r\n printf(\"%s\\n\",r);\r\n }\r\n else{\r\n for(int i=0;i<l;i++){\r\n if(r[i]=='9'){\r\n r[i]='0';\r\n }\r\n else{\r\n r[i]=r[i]+1;\r\n }\r\n }\r\n printf(\"%s\\n\",r);\r\n }\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n\tint n;\r\n\r\n\tscanf(\"%d\", &n);\r\n\tif (n < 0)\r\n\t\tprintf(\"0\\n\");\r\n\telse if (n < 1200)\r\n\t\tprintf(\"1200\\n\");\r\n\telse if (n < 1400)\r\n\t\tprintf(\"1400\\n\");\r\n\telse if (n < 1600)\r\n\t\tprintf(\"1600\\n\");\r\n\telse if (n < 1900)\r\n\t\tprintf(\"1900\\n\");\r\n\telse if (n < 2100)\r\n\t\tprintf(\"2100\\n\");\r\n\telse if (n < 2300)\r\n\t\tprintf(\"2300\\n\");\r\n\telse if (n < 2400)\r\n\t\tprintf(\"2400\\n\");\r\n\telse if (n < 2600)\r\n\t\tprintf(\"2600\\n\");\r\n\telse if (n < 3000)\r\n\t\tprintf(\"3000\\n\");\r\n\treturn 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n\tint n;\r\n\r\n\tscanf(\"%d\", &n);\r\n\tif (n <= 0)\r\n\t\tprintf(\"0\\n\");\r\n\telse if (n <= 1200)\r\n\t\tprintf(\"1200\\n\");\r\n\telse if (n <= 1400)\r\n\t\tprintf(\"1400\\n\");\r\n\telse if (n <= 1600)\r\n\t\tprintf(\"1600\\n\");\r\n\telse if (n <= 1900)\r\n\t\tprintf(\"1900\\n\");\r\n\telse if (n <= 2100)\r\n\t\tprintf(\"2100\\n\");\r\n\telse if (n <= 2300)\r\n\t\tprintf(\"2300\\n\");\r\n\telse if (n <= 2400)\r\n\t\tprintf(\"2400\\n\");\r\n\telse if (n <= 2600)\r\n\t\tprintf(\"2600\\n\");\r\n\telse if (n <= 3000)\r\n\t\tprintf(\"3000\\n\");\r\n\treturn 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n\tint n;\r\n\r\n\tscanf(\"%d\", &n);\r\n\tif (n <= 1200)\r\n\t\tprintf(\"1200\\n\");\r\n\telse if (n <= 1400)\r\n\t\tprintf(\"1400\\n\");\r\n\telse if (n <= 1600)\r\n\t\tprintf(\"1600\\n\");\r\n\telse if (n <= 1900)\r\n\t\tprintf(\"1900\\n\");\r\n\telse if (n <= 2100)\r\n\t\tprintf(\"2100\\n\");\r\n\telse if (n <= 2300)\r\n\t\tprintf(\"2300\\n\");\r\n\telse if (n <= 2400)\r\n\t\tprintf(\"2400\\n\");\r\n\telse if (n <= 2600)\r\n\t\tprintf(\"2600\\n\");\r\n\telse if (n <= 3000)\r\n\t\tprintf(\"3000\\n\");\r\n\treturn 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n\r\nint main() {\r\n\tint n;\r\n\r\n\tscanf(\"%d\", &n);\r\n\tprintf(\"%d\\n\", n + 1);\r\n\treturn 0;\r\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tint num[]={1200,1400,1600,1900,2100,2300,2400,2600,3000};\n\tint i = 0;\n\twhile(num[i] < n) i++;\n\tprintf(\"%d\", num[i]);\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tint n;\n\tscanf(\"%d\", &n);\n\tprintf(\"%d\", n+1);\n}\n"}, {"source_code": "#include <stdio.h>\nint main() {\n\tprintf(\"1\");\n}\n"}, {"source_code": "int main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n \r\n if(t < 0)\r\n puts(\"0\");\r\n else if(t < 1200)\r\n puts(\"1200\");\r\n else if(t < 1400)\r\n puts(\"1400\");\r\n else if(t < 1600)\r\n puts(\"1600\");\r\n else if(t < 1900)\r\n puts(\"1900\");\r\n else if(t < 2100)\r\n puts(\"2100\");\r\n else if(t < 2300)\r\n puts(\"2300\");\r\n else if(t < 2400)\r\n puts(\"2400\");\r\n else if(t < 2600)\r\n puts(\"2600\");\r\n else\r\n puts(\"3000\"); \r\n \r\n}\r\n"}, {"source_code": "int main()\r\n{\r\n int t;\r\n scanf(\"%d\",&t);\r\n while(t % 3) t++;\r\n printf(\"%d\\n\", t);\r\n return 0;\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#define LL long long\r\nint mycmp(const void* a, const void* b);\r\nint read(void);\r\nint mycmp(const void* a, const void* b)\r\n{\r\n return *(int*)a-*(int*)b;\r\n}\r\nint read(void)\r\n{\r\n int s = 0, f = 1;\r\n char ch = getchar();\r\n while(ch < '0' || ch > '9')\r\n {\r\n if(ch == '-')\r\n f = -1;\r\n ch = getchar();\r\n }\r\n while(ch >= '0' && ch <= '9')\r\n {\r\n s = s * 10 + ch - '0';\r\n ch = getchar();\r\n }\r\n return s * f;\r\n}\r\n/********************/\r\nint main(void)\r\n{\r\n int n;\r\n n=read();\r\n if(n<=1200)\r\n printf(\"1200\");\r\n else if(n<=1900)\r\n printf(\"1900\");\r\n else if(n<=2100)\r\n printf(\"2100\");\r\n else if(n<=2300)\r\n printf(\"2300\");\r\n else if(n<=2400)\r\n printf(\"2400\");\r\n else if(n<=2600)\r\n printf(\"2600\");\r\n else\r\n printf(\"3000\");\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#define LL long long\r\nint mycmp(const void* a, const void* b);\r\nint read(void);\r\nint mycmp(const void* a, const void* b)\r\n{\r\n return *(int*)a-*(int*)b;\r\n}\r\nint read(void)\r\n{\r\n int s = 0, f = 1;\r\n char ch = getchar();\r\n while(ch < '0' || ch > '9')\r\n {\r\n if(ch == '-')\r\n f = -1;\r\n ch = getchar();\r\n }\r\n while(ch >= '0' && ch <= '9')\r\n {\r\n s = s * 10 + ch - '0';\r\n ch = getchar();\r\n }\r\n return s * f;\r\n}\r\n/********************/\r\nint main(void)\r\n{\r\n int n;\r\n n=read();\r\n if(n<1200)\r\n printf(\"1200\");\r\n else if(n<1900)\r\n printf(\"1900\");\r\n else if(n<2100)\r\n printf(\"2100\");\r\n else if(n<2300)\r\n printf(\"2300\");\r\n else if(n<2400)\r\n printf(\"2400\");\r\n else if(n<2600)\r\n printf(\"2600\");\r\n else\r\n printf(\"3000\");\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n\r\nint main()\r\n{\r\n int i;\r\n scanf(\"%d\",&i);\r\n printf(\"%d\",i+1);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\nint main()\r\n{\r\n int n;\r\n scanf(\"%d\",&n);\r\n printf(\"%d\",n+1);\r\n}\r\n"}], "src_uid": "22725effa6dc68b9c2a499d148e613c2"} {"nl": {"description": "Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is extra. It is not allowed to break the sticks or use their partial length. Anne has perfectly solved this task, now she is asking Johnny to do the same.The boy answered that he would cope with it without any difficulty. However, after a while he found out that different tricky things can occur. It can happen that it is impossible to construct a triangle of a positive area, but it is possible to construct a degenerate triangle. It can be so, that it is impossible to construct a degenerate triangle even. As Johnny is very lazy, he does not want to consider such a big amount of cases, he asks you to help him.", "input_spec": "The first line of the input contains four space-separated positive integer numbers not exceeding 100 \u2014 lengthes of the sticks.", "output_spec": "Output TRIANGLE if it is possible to construct a non-degenerate triangle. Output SEGMENT if the first case cannot take place and it is possible to construct a degenerate triangle. Output IMPOSSIBLE if it is impossible to construct any triangle. Remember that you are to use three sticks. It is not allowed to break the sticks or use their partial length.", "sample_inputs": ["4 2 1 3", "7 2 2 4", "3 5 9 1"], "sample_outputs": ["TRIANGLE", "SEGMENT", "IMPOSSIBLE"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int i,a,b,c;\n int t[6];\n\n for (i=0;i<4;i++)\n scanf (\"%d\",&t[i]);\n \n t[4]=t[0];\n t[5]=t[1];\n char* msg=\"IMPOSSIBLE\";\n \n //triangle\n for (i=0;i<4;i++)\n {\n a=t[i];\n b=t[i+1];\n c=t[i+2];\n if ((a<b+c)&&(b<a+c)&&(c<a+b))\n {\n msg=\"TRIANGLE\";\n printf(\"%s\\n\",msg);\n return(0);\n\n }\n }\n \n //segment\n for (i=0;i<4;i++)\n {\n a=t[i];\n b=t[i+1];\n c=t[i+2];\n if ((a==b+c)||(b==c+a)||(c==b+a))\n {\n msg=\"SEGMENT\";\n printf(\"%s\\n\",msg);\n return(0);\n }\n\n }\n printf(\"%s\\n\",msg);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint a[5];\nint u[4];\nint f[5] = {0}, falg=0;\nvoid dfs(int dep)\n{\n\tif (dep == 4)//\u56e0\u4e3adep\u662f\u5728\u4e3a\u4e0b\u4e00\u8f6e\u505a\u51c6\u5907\uff0c\u6240\u4ee5dep=3(\u51c6\u5907\u9009\u7b2c3\u4e2a\u6570)\u65f6\u624d\u9009\u4e862\u4e2a\u6570\uff0c\u6240\u4ee5\u8981dep=4\u65f6\u6765\u5224\u65ad\n\t{\n\t\tif (u[1] + u[2]>u[3] && u[1] + u[3]>u[2] && u[2] + u[3]>u[1])\n\t\t{\n\t\t\tprintf(\"TRIANGLE\");//\u6ee1\u8db3\u666e\u901a\u4e09\u89d2\u5f62\uff0c\u76f4\u63a5\u8f93\u51fa\n\t\t\texit(0);//\u610f\u4e3a\"\u6b63\u5e38\u9000\u51fa\u7a0b\u5e8f\"\uff0c\u76f8\u5f53\u4e8e\u4e3b\u51fd\u6570\u91cc\u9762\u7684retrun 0,\u5728DFS\u91cc\u9762\u7528\u53ef\u4ee5\u8282\u7701\u641c\u5230\u7b54\u6848\u540e\u56de\u6714\u7684\u65f6\u95f4\n\t\t}\n\t\tif (u[1] + u[2] >= u[3] && u[1] + u[3] >= u[2] && u[2] + u[3] >= u[1])falg = 1;\n\t\t/*\n\t\t\u8fd9\u91cc\u4e0d\u80fd\u76f4\u63a5\u8f93\u51fa\n\t\t\u56e0\u4e3a\u5f31\u5316\u4e09\u89d2\u5f62\u7684\u4f18\u5148\u7ea7\u5c0f\u4e8e\u666e\u901a\u4e09\u89d2\u5f62\uff0c\n\t\t\u6240\u4ee5\u5f53\u6728\u68cd\u540c\u65f6\u6ee1\u8db3\u5f31\u5316\u4e09\u89d2\u5f62\u548c\u666e\u901a\u4e09\u89d2\u5f62\u7684\u6761\u4ef6\u65f6\u5e94\u8be5\u8f93\u51fa\u6700\u4f18\u89e3\u666e\u901a\u4e09\u89d2\u5f62\n\t\t\u4f46\u56e0\u4e3a\u7528\u7684\u662fDFS\uff0c\u679a\u4e3e\u6570\u7684\u987a\u5e8f\u53ea\u548c\u6570\u636e\u7684\u987a\u5e8f\u6709\u5173\uff0c\u4e8e\u662f\u6ee1\u8db3\u5f31\u5316\u4e09\u89d2\u5f62\u65f6\u5c31\u76f4\u63a5\u8f93\u4e86,\u8981\u5230\u786e\u8ba4\u6ca1\u6709\u666e\u901a\u4e09\u89d2\u5f62\u65f6\u624d\u80fd\u8f93\n\t\t(\u7b2c\u4e00\u6b21\u7adf\u7136\u5728\u5728\u8fd9\u91cc\u8dea\u4e86QAQ)\n\t\t*/\n\t\treturn;\n\t}\n\tfor (int i = 1;i <= 4;i++)\n\t\tif (f[i] == 0)\n\t\t{\n\t\t\tf[i] = 1;\n\t\t\tu[dep] = a[i];//\u628a\u5f53\u524d\u679a\u4e3e\u5230\u7684\u7ec4\u5408\u4e34\u65f6\u5b58\u50a8\u4e0b\u6765\n\t\t\tdep++;//\u4e3a\u4e0b\u8f6e\u505a\u51c6\u5907\n\t\t\tdfs(dep);//\u521a\u5b66DFS\u65f6\u6559\u7ec3\u8bf4\u5185\u5faa\u73af\u8981\u5199\u6210\u955c\u50cf\u6765\u56de\u6eaf\uff0c\u4e8e\u662f\u6211\u6cbf\u7528\u5230\u73b0\u5728\n\t\t\tdep--;//\u64a4\u9500\u6240\u6709\u64cd\u4f5c\n\t\t\tu[dep] = 0;\n\t\t\tf[i] = 0;\n\t\t}\n}\nint main()\n{\n\tscanf(\"%d%d%d%d\", a + 1, a + 2, a + 3, a + 4);//\u628a\u6570\u7ec4\u5f53\u6307\u9488\u7528\uff0c\u5c0f\u7eff\u4e66\u4ecb\u7ecd\u8fc7\uff0c\u4e5f\u53ef\u4ee5\u5199scanf(\"%d%d%d%d\",&a[1],&a[2],&a[3],&a[4])\n\tdfs(1);\n\tif (falg)printf(\"SEGMENT\");//\u7136\u800c\u7b2c2\u6b21\u53c8\u8dea\u5728\u6253\u5c11\u4e86\u4e00\u4e2a\u7b49\u53f7\u4e0a(\u6211\u592a\u84bb\u4e86)\n\telse printf(\"IMPOSSIBLE\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n \n if((a+b>c && a+c>b && b+c>a) || (a+c>d && a+d>c && c+d>a) || (a+b>d && a+d>b && b+d>a) || (b+c>d && b+d>c && c+d>b)) { \n printf(\"TRIANGLE\\n\"); \n }\n else if((a+b>=c && a+c>b && b+c>a) || (a+b>c && a+c>=b && b+c>a) || (a+b>c && a+c>b && b+c>=a)) {\n printf(\"SEGMENT\\n\");\n }\n else if((a+c>=d && a+d>c && c+d>a) || (a+c>d && a+d>=c && c+d>a) || (a+c>d && a+d>c && c+d>=a)) {\n printf(\"SEGMENT\\n\");\n }\n else if((a+b>=d && a+d>b && b+d>a) || (a+b>d && a+d>=b && b+d>a)|| (a+b>d && a+d>b && b+d>=a)) {\n printf(\"SEGMENT\\n\");\n \n }\n else if((b+c>=d && b+d>c && c+d>b) || (b+c>d && b+d>=c && c+d>b) || (b+c>d && b+d>c && c+d>=b)) {\n printf(\"SEGMENT\\n\");\n }\n else {\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain() {\n int a,b,c,d,i,j,k;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if((a < b+c&&b < a+c&&c < a+b) || ( a < b+d&&b < a+d&&d < a+b ) || ( a < c+d&&d < a+c&&c <a+d ) || ( b < c+d&&d < b+c&&c <b+d ))\n\tprintf(\"TRIANGLE\\n\");\n else if((a==b+c || b==a+c || c==a+b) || (a==b+d || b==a+d || d==a+b) || (a==c+d || d==a+c || c==a+d) || (b==c+d || d==b+c || c==b+d))\n\tprintf(\"SEGMENT\\n\");\n else\n\tprintf(\"IMPOSSIBLE\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint f(const void *a, const void *b)\n{\n return ( *(int *)a - *(int *)b );\n}\nint main()\n{\n int a[4], i, flag=0;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),f);\n if( (a[1]+a[0]>a[2]) || (a[1]+a[2]>a[3]) )\n printf(\"TRIANGLE\");\n else if( (a[0]+a[1]==a[2]) || (a[1]+a[2]==a[3]) )\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\treturn 0;\n}\n\n"}, {"source_code": "# include<stdio.h>\nint a[4] = {0};\nint u[4] = {0};\nint cc[4];\nint triangleFlag = 0;\nint segmentFlag = 0;\n\ndfs(int d){\n\tif (d == 4){\n\t\treturn;\n\t}\n\tif (d == 3){\n\t\tif (u[0] + u[1] > u[2] && u[0] + u[2] > u[1] && u[1] + u[2] > u[0]){\n\t\t\ttriangleFlag = 1;\n\t\t}\n\t\tif (u[0] + u[1] >= u[2] && u[0] + u[2] >= u[1] && u[1] + u[2] >= u[0]){\n\t\t\tsegmentFlag = 1;\n\t\t}\n\t}\n\tfor (int i = 0; i < 4; i++){\n\t\tint temp_flag = 0;\n\t\tfor (int j = 0; j < 4; j++){\n\t\t\tif (cc[j] == i){\n\t\t\t\ttemp_flag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (temp_flag){\n\t\t\tcontinue;\n\t\t}\n\t\tu[d] = a[i];\n\t\tcc[i] = i;\n\t\tdfs(++d);\n\t\td--;\n\t\tu[d] = 0;\n\t\tcc[i] = -1;\t\t\n\t}\n}\n\nint main(){\n\tfor (int i = 0; i < 4; i++){\n\t\tscanf(\"%d\", a+i);\n\t\tcc[i] = -1;\n\t}\n\tdfs(0);\n\tif (triangleFlag){\n\t\tprintf(\"TRIANGLE\");\n\t} else if(segmentFlag){\n\t\tprintf(\"SEGMENT\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n} "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,k,c;\n scanf(\"%d%d%d%d\",&n,&m,&k,&c);\n if((n+m>k&&m+k>n&&k+n>m)||(m+k>c&&k+c>m&&m+c>k)||(n+m>c&&m+c>n&&n+c>m)||(n+k>c&&k+c>n&&c+n>k))\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if((n+m==k||m+k==n||k+n==m)||(m+k==c||k+c==m||m+c==k)||(n+m==c||m+c==n||n+c==m)||(n+k==c||k+c==n||c+n==k))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,i,j,k,temp;\n int a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++){\n for(j=i;j<4;j++){\n if(a[j]<a[i]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(a[0]+a[1]==a[2]||a[0]+a[2]==a[3]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i=0,j,k,m=0,s=0,a[4];\n\twhile(i<4)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=(i+1);j<4;j++)\n\t\t{\n\t\t\tfor(k=(j+1);k<4;k++)\n\t\t\t{\n\t\t\t\tif(a[i]+a[j]>a[k]&&(a[i]-a[j]<a[k]&&a[j]-a[i]<a[k]))\n\t\t\t \ts++;\n\t\t\t if(a[i]+a[j]==a[k]||a[i]+a[k]==a[j]||a[j]+a[k]==a[i])\n\t\t\t\tm++;\n\t\t\t}\n\t\t}\n\t}\n\tif(s>0)\n\tprintf(\"TRIANGLE\");\n\telse\n\t{\n\t\tif(m>0)\n\t\tprintf(\"SEGMENT\");\n\t\telse\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[4];\n for(int i=0;i<4;i++)\n scanf(\"%d\",&ara[i]);\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<3-i;j++)\n if(ara[j]>=ara[j+1])\n {\n int temp=ara[j];\n ara[j]=ara[j+1];\n ara[j+1]=temp;\n\n }}\n if((ara[0]+ara[1]>ara[2])||(ara[0]+ara[1]>ara[3])||(ara[1]+ara[2]>ara[3])||(ara[0]+ara[2]>ara[3]))\n printf(\"TRIANGLE\");\nelse if((ara[0]+ara[1]==ara[2])||(ara[0]+ara[1]==ara[3])||(ara[1]+ara[2]==ara[3])||(ara[0]+ara[2]==ara[3]))\n printf(\"SEGMENT\");\n\n else printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint book[ 4 ], ns[ 4 ]; // \u6807\u8bb0\u662f\u5426\u4f7f\u7528\u4ee5\u53ca\u5b58\u50a8\u539f\u56db\u4e2a\u6570\u636e\nint ans[ 3 ]; // \u5224\u65ad\u6b64\u65f6\u7684\u4e09\u4e2a\u6570\u80fd\u5426\u7ec4\u6210\u4e09\u89d2\u5f62\nint flag; // \u6807\u8bb0\u662f\u5426\u662f\u5f31\u5316\u4e09\u89d2\u5f62\n\nvoid dfs( int dep );\n\nint main(){\n for( int i = 0; i <= 3; i ++ ) scanf(\"%d\", &ns[ i ]);\n\n dfs( 0 );\n\n if( flag ) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n\n return 0;\n}\n\nvoid dfs( int dep ){\n if( dep == 3 ){\n if( ans[ 0 ] + ans[ 1 ] > ans[ 2 ] && ans[ 1 ] + ans[ 2 ] > ans[ 0 ] && ans[ 0 ] + ans[ 2 ] > ans[ 1 ] ){\n printf(\"TRIANGLE\");\n exit( 0 );\n }\n\n if( ans[ 0 ] + ans[ 1 ] >= ans[ 2 ] && ans[ 1 ] + ans[ 2 ] >= ans[ 0 ] && ans[ 0 ] + ans[ 2 ] >= ans[ 1 ] ){\n flag = 1;\n }\n\n return ;\n }\n\n for( int i = 0; i < 4; i ++ ){\n if( book[ i ] == 0 ){\n book[ i ] = 1;\n ans[ dep ] = ns[ i ];\n\n dfs( ++ dep );\n\n dep --;\n ans[ dep ] = 0;\n book[ i ] = 0;\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const int *a, const int *b){\n if(*a < *b) return -1;\n if(*a > *b) return 1;\n return 0;\n}\n\nint main(){\n int in[4], i;\n for(i = 0; i < 4; ++i) scanf(\"%d\", &in[i]);\n qsort(in, 4, sizeof(int), cmp);\n \n int j, k, find = 0;\n for(i = 0; i < 4; ++i){\n for(j = i+1; j < 4; ++j){\n for(k = j+1; k < 4; ++k){\n if(find < 2 && in[i] + in[j] > in[k]) find = 2;\n if(find < 1 && in[i] + in[j] == in[k]) find = 1;\n }}}\n \n if(find == 0) puts(\"IMPOSSIBLE\");\n else if(find == 1) puts(\"SEGMENT\");\n else puts(\"TRIANGLE\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint a, b, c, d, tz;\n \nint main()\n{\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\tif(a > b) {tz = a; a = b; b = tz;}\n\tif(c < a) {tz = c; c = b; b = a; a = tz;}\n\telse if(c < b) {tz = c; c = b; b = tz;}\n\tif(d < a) {tz = d; d = c; c = b; b = a; a = tz;}\n\telse if ( d < b) {tz = d; d = c; c = b; b = tz;}\n\telse if ( d < c) {tz = d; d = c; c = tz;}\n\t\n\tif (a + b < c && b + c < d) printf(\"IMPOSSIBLE\");\n\telse if (a + b > c || b + c > d) printf(\"TRIANGLE\");\n\telse printf(\"SEGMENT\");\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n/**\n *\n * @param a\n * @param b\n * @param c\n * @return -1: nemozne, 0: segment, 1: trojuholnik\n */\nint trojuholnik(int a, int b, int c) {\n if (b > c) {\n int tmp = b;\n b = c;\n c = tmp;\n }\n if (a > c) {\n int tmp = a;\n a = c;\n c = tmp;\n }\n if (a > b) {\n int tmp = a;\n a = b;\n b = tmp;\n }\n /*printf(\"%d %d %d\", a, b, c);*/\n\n if (a+b < c) {\n return -1;\n } else if (a+b == c) {\n return 0;\n } else {\n return 1;\n }\n}\n\nint main(int argc, char* argv[]) {\n int d1,d2,d3,d4, tmp;\n int result;\n //printf(\"Zadaj dlzky stran\\n\");\n /* if (result != 4 ) { */\n while (scanf(\"%d %d %d %d\", &d1, &d2, &d3, &d4) != 4\n || d1 < 0 || d2 < 0 || d3 < 0 || d4 < 0 ) {\n printf(\"Nespravny vstup\\n\");\n while (getchar() != '\\n') {}\n }\n /*printf(\"%d %d %d %d\", d1, d2, d3, d4);*/\n result = -1;\n tmp = trojuholnik(d1, d2, d3);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d1, d2, d4);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d2, d3, d4);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d1, d3, d4);\n if (tmp > result) result = tmp;\n if (result == 1) {\n printf(\"TRIANGLE\\n\");\n } else if (result == 0) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"IMPOSSIBLE\\n\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint a[5];\nint b[5]={0};\nint f[5]={0};\nint m=0;\nint n=0;\nvoid dfs(int x);\nint main()\n{\n int i,j;\n scanf(\"%d%d%d%d\",a,a+1,a+2,a+3);\n dfs(1);\n if(!m)\n printf(\"IMPOSSIBLE\\n\");\n if(m&&!n)\n printf(\"SEGMENT\\n\");\n if(m&&n)\n printf(\"TRIANGLE\\n\");\n return 0;\n}\nvoid dfs(int x)\n{\n int i,j;\n if(x==4)\n {\n if(b[1]+b[2]>b[3]&&b[1]+b[3]>b[2]&&b[2]+b[3]>b[1])\n {\n m=1;\n n=1;\n return;\n }\n if(b[1]+b[2]>=b[3]&&b[1]+b[3]>=b[2]&&b[2]+b[3]>=b[1])\n {\n m=1;\n return;\n }\n return ;\n }\n for(i=0;i<4;i++)\n {\n if(f[i]==0)//\u82e5\u7b2ci\u4e2a\u6570\u672a\u88ab\u9009\u62e9\n {\n f[i]=1;//\u8868\u793a\u7b2ci\u4e2a\u6570\u5df2\u9009\u62e9\n b[x]=a[i];\n dfs(x+1);\n b[x]=0;\n f[i]=0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<math.h>\nint main()\n{\n int n=4;\n int a[n];\n scanf(\"%d %d %d %d\",&a[0],&a[1],&a[2],&a[3]);\n\n\n for (int i,c=1; c ; n--)\n {\n for (i=0,c=0; i<n-1; i++)\n {\n\n if (a[i]>a[i+1])\n {\n c++;\n int temp=a[i];\n a[i]=a[i+1];\n a[i+1]=temp;\n }\n }\n }\n\n\n if(a[0]+a[1]>a[2] || a[1]+a[2]>a[3])\n printf(\"TRIANGLE\");\n else if(a[0]+a[1]==a[2]||a[1]+a[2]==a[3])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint i=0,j;\n\tint a[4];\n\tint b ;\n\twhile(i++<= 3)\n\t\tscanf(\"%d\", &a[i-1]);\n\tfor (i = 3; i >= 1; i--)\n\t\tfor (j = 0; j < i; j++)\n\t\t{\n\t\t\tif (a[j] > a[j + 1])\n\t\t\t{\n\t\t\t\tb = a[j];\n\t\t\t\ta[j] = a[j + 1];\n\t\t\t\ta[j + 1] = b;\n\t\t\t}\n\t\t}\n\tfor (i = 0,b = 0; i < 2; i++)\n\t{\n\t\tif (a[i + 2] < a[i] + a[i + 1])\n\t\t{\n\t\t\tprintf(\"TRIANGLE\\n\");\n\t\t\treturn 0;\n\t\t}\n\t\tif (a[i + 2] == a[i] + a[i + 1])\n\t\t{\n\t\t\tb = 1;\n\t\t}\n\t}\n if (b)\n\t\tprintf(\"SEGMENT\\n\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint s=0,p=0;\nint sum(int a,int b,int c)\n{\n if(a+b>c && b+c>a && a+c>b)\n {\n s=1;\n return 0;\n }\n if(a+b>=c&&b+c>=a &&c+a>=b)\n {\n p=1;\n return 0;\n }\n return 0;\n}\n\n\nint main(){\n int a[4],i,j,k;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n for(k=0;k<4;k++)\n {\n if(a[k]+a[j]>=a[i]&&j!=i&&k!=i&&j!=k)\n sum(a[i],a[j],a[k]);\n }\n }\n }\nif(s==1){\n printf(\"TRIANGLE\\n\");\n return 0;\n}\nelse if(p==1){\n printf(\"SEGMENT\\n\");\n return 0;\n}\nprintf(\"IMPOSSIBLE\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\nvoid intSort(int d[],int s){int i=-1,j=s,k,t;if(s <= 1)return;k=(d[0] + d[s-1]) / 2;while(1){while(d[++i] < k);while(d[--j] > k);if(i >= j) break;t=d[i];d[i]=d[j];d[j]=t;}intSort(d, i);intSort(d+j+1, s-j-1);}\n\nint main(){\n int i, j, k;\n int in[4];\n\n rep(i,4) scanf(\"%d\",&in[i]);\n intSort(in,4);\n if(in[3] < in[2] + in[1]){puts(\"TRIANGLE\"); return 0;}\n if(in[2] < in[1] + in[0]){puts(\"TRIANGLE\"); return 0;}\n if(in[3] == in[1] + in[2]){puts(\"SEGMENT\"); return 0;}\n if(in[2] == in[1] + in[0]){puts(\"SEGMENT\"); return 0;}\n\n puts(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,i,j,k,temp;\n int a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++){\n for(j=i;j<4;j++){\n if(a[j]<a[i]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(a[0]+a[1]==a[2]||a[0]+a[2]==a[3]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if((a+b>c && b+c>a && c+a>b) || (a+b>d && b+d>a && d+a>b) || (a+c>d && c+d>a && d+a>c) || (b+c>d && c+d>b && b+d>c))\n {\n printf(\"TRIANGLE\");\n }\n else if((a+b==c || b+c==a || c+a==b) || (a+b==d || b+d==a || d+a==b) || (a+c==d || c+d==a || d+a==c) || (b+c==d || c+d==b || b+d==c))\n {\n printf(\"SEGMENT\");\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const int *a, const int *b)\n{\n return *(int*)a-*(int*)b;\n}\n\nint tri(int x, int y, int z)\n{\n if(((x+y>z) && (y+z>x)) && (x+z>y))\n return 1;\n return 0;\n}\n\nint seg(int x, int y, int z)\n{\n if(x+y==z)\n {\n //printf(\"%d %d %d\\n\",x,y,z);\n return 1;\n }\n return 0;\n}\nint main()\n{\n int i,a[4]={0},flagt=0,flags=0,flagi=0;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),cmp);\n /*for(i=0;i<4;i++)\n printf(\"%d \",a[i]);*/\n if(tri(a[0],a[1],a[2]) || tri(a[0],a[1],a[3]) || tri(a[0],a[2],a[3]) || tri(a[1],a[2],a[3]))\n flagt=1;\n\n else\n {\n if(seg(a[0],a[1],a[2]) || seg(a[0],a[1],a[3]) || seg(a[0],a[2],a[3]) || seg(a[1],a[2],a[3]))\n flags=1;\n\n else\n flagi=1;\n }\n if(flagt)\n printf(\"TRIANGLE\\n\");\n else if(flags)\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint s=0,p=0;\nint sum(int a,int b,int c)\n{\n if(a+b>c && b+c>a && a+c>b)\n {\n s=1;\n return 0;\n }\n if(a+b>=c&&b+c>=a &&c+a>=b)\n {\n p=1;\n return 0;\n }\n return 0;\n}\n\n\nint main(){\n int a[4],i,j,k;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n for(k=0;k<4;k++)\n {\n if(a[k]+a[j]>=a[i]&&j!=i&&k!=i&&j!=k)\n sum(a[i],a[j],a[k]);\n }\n }\n }\nif(s==1){\n printf(\"TRIANGLE\\n\");\n return 0;\n}\nelse if(p==1){\n printf(\"SEGMENT\\n\");\n return 0;\n}\nprintf(\"IMPOSSIBLE\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#define N 10\nint a[N],get[N],vis[N],flag=1,ans;\n\nvoid Merge(int a[],int start,int mid,int end)\n{\n int *temp = (int *)malloc((end-start+1)*sizeof(int));\n int i=start;\n int j=mid+1;\n int k=0;\n while(i<=mid&&j<=end)\n {\n if(a[i]<a[j])\n {\n temp[k++]=a[i++];\n }\n else\n {\n temp[k++]=a[j++];\n }\n }\n while(i<=mid)\n {\n temp[k++]=a[i++];\n }\n while(j<=end)\n {\n temp[k++]=a[j++];\n }\n for(i=0; i<k; i++)\n a[start+i] = temp[i];\n free(temp);\n}\n\nvoid MergeSort(int a[],int start,int end)\n{\n if(start >= end)\n return;\n int mid = start + (end - start)/2;\n MergeSort(a,start,mid);\n MergeSort(a,mid+1,end);\n Merge(a,start,mid,end);\n}\n\nint Judge()\n{\n //printf(\"%d %d %d\\n\",get[1],get[2],get[3]);\n if(get[3]==get[1]+get[2])\n return 0;\n if(get[3]<get[1]+get[2])\n return -1;\n else if(flag==1)\n return 1;\n else\n return 0;\n}\n\n\nvoid DFS(int step)\n{\n if(flag==-1)\n return;\n if(step==4)\n {\n flag = Judge();\n return;\n }\n for (int i=1; i<=4; i++)\n {\n if (vis[i]==0 && a[i] >= get[step-1] ) //\u4fdd\u8bc1\u53d6\u503c\u5355\u8c03\u9012\u589e\uff0c\u6ee1\u8db3\u7ec4\u5408\u6709\u987a\u5e8f\n {\n get[step] = a[i];\n vis[i] = 1;\n DFS(step+1);\n vis[i] = 0;\n }\n }\n\n}\n\nint main()\n{\n for(int i=1; i<=4; i++)\n scanf(\"%d\",&a[i]);\n MergeSort(a,1,4);\n DFS(1);\n if(flag==-1)\n printf(\"TRIANGLE\\n\");\n else if(flag==0)\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e=0,f=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a+b>c && b+c>a && c+a>b)\n e++;\n if(a+b==c || b+c==a || c+a==b)\n f++;\n if(a+b>d && b+d>a && a+d>b)\n e++;\n if(a+b==d || b+d==a || a+d==b)\n f++;\n if(a+c>d && c+d>a && a+d>c)\n e++;\n if(a+c==d || c+d==a || a+d==c)\n f++;\n if(b+d>c && b+c>d && c+d>b)\n e++;\n if(b+c==d || b+d==c || c+d==b)\n f++;\n\n if(e==0 && f==0)\n printf(\"IMPOSSIBLE\");\n if(e==0 && f>0)\n printf(\"SEGMENT\");\n if(e>0)\n printf(\"TRIANGLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[100],i,j;\n\tfor(i=1;i<=4;i++) {do{scanf(\"%d\",&a[i]);}while(a[i]<1||a[i]>100);}\n\tfor(i=1;i<=3;i++)\n\t{\n\t\tfor(j=i+1;j<=4;j++)\n\t\t{\n\t\t\tif(a[j]>a[i]) \n\t\t\t{\n\t\t\t\tint temp; temp=a[j]; a[j]=a[i]; a[i]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tint a23,a34; a23=a[2]+a[3]; a34=a[3]+a[4];\n\tif((a[1]<a23)||(a[2]<a34)) {printf(\"TRIANGLE\");}\n\telse\n\t{\n\t if((a[1]==a23)&&(a[2]>a34)) {printf(\"SEGMENT\");}\n\t else\n\t {\n\t if(a[2]>a34) {printf(\"IMPOSSIBLE\");}\n\t else if(a[2]==a34) {printf(\"SEGMENT\");}\n\t }\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint istriangle(int x,int y, int z)\n{\n\tint flag1=0,flag2=0,flag3=0;\n\tif(x+y>z)flag1=1;\n\tif(x+z>y)flag2=1;\n\tif(y+z>x)flag3=1;\n\tif(flag1&&flag2&&flag3)return 1;\n\tflag1=0;\n\tflag2=0;\n\tflag3=0;\n\tif(x+y>=z)flag1=1;\n\tif(x+z>=y)flag2=1;\n\tif(y+z>=x)flag3=1;\n\tif(flag1&&flag2&&flag3)return -1;\n\telse return 0;\n}\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tint flag1=0,flag2=0,flag3=0,flag4=0;\n\tflag1=istriangle(a,b,c);\n\tflag2=istriangle(a,b,d);\n\tflag3=istriangle(d,b,c);\n\tflag4=istriangle(a,d,c);\n\tif(flag1==1||flag2==1||flag3==1||flag4==1)printf(\"TRIANGLE\");\n\telse if(flag1==-1||flag2==-1||flag3==-1||flag4==-1)printf(\"SEGMENT\");\n\telse printf(\"IMPOSSIBLE\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\nvoid intSort(int d[],int s){int i=-1,j=s,k,t;if(s <= 1)return;k=(d[0] + d[s-1]) / 2;while(1){while(d[++i] < k);while(d[--j] > k);if(i >= j) break;t=d[i];d[i]=d[j];d[j]=t;}intSort(d, i);intSort(d+j+1, s-j-1);}\n\nint main(){\n int i, j, k;\n int in[4];\n\n rep(i,4) scanf(\"%d\",&in[i]);\n intSort(in,4);\n if(in[3] < in[2] + in[1]){puts(\"TRIANGLE\"); return 0;}\n if(in[2] < in[1] + in[0]){puts(\"TRIANGLE\"); return 0;}\n if(in[3] == in[1] + in[2]){puts(\"SEGMENT\"); return 0;}\n if(in[2] == in[1] + in[0]){puts(\"SEGMENT\"); return 0;}\n\n puts(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a[5],x,o=10,i,j;\n\tfor (i=1;i<=4;i++){\n\t\tscanf (\"%d\", &a[i]);\n\t}\n\tfor (i=1;i<=4;i++)\n\t\tfor (j=1;j<=4;j++)\n\t\t\tfor (x=1;x<=4;x++)\n\t\t\t if(a[j]>=a[i] && a[x]>=a[j] && i!=j && j!=x && i!=x)\n\t\t\t {\n\t\t\t if (a[i]+a[j]>a[x])\n\t\t\t {printf(\"TRIANGLE\\n\"); return 0;}\n\t\t\t if (a[i]+a[j]==a[x])\n\t\t\t o=2;\n\t\t\t }\n\tif(o==2)\n\t printf (\"SEGMENT\\n\");\n\telse\n\t printf (\"IMPOSSIBLE\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfunc(const void *a, const void *b) { return(*(int*)a - *(int*)b); }\nint main()\n{\nint l[4];\nscanf(\"%d%d%d%d\",&l[0],&l[1],&l[2],&l[3]);\nqsort(l,4,sizeof(int),cmpfunc);\nif(l[0]+l[1]>l[2]||l[1]+l[2]>l[3]||l[0]+l[2]>l[3]){\nprintf(\"TRIANGLE\\n\");\n}\n\nelse if(l[0]+l[1]==l[2]||l[1]+l[2]==l[3]||l[0]+l[2]==l[3]){\nprintf(\"SEGMENT\\n\");\n}\nelse{\nprintf(\"IMPOSSIBLE\\n\");\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint check(int a, int b, int c) {\n\t\n\tif (a + b > c && b + c > a && a + c > b)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint check_degen(int a, int b, int c) {\n\tif (a + b == c || a + c == b || b + c == a)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main(void)\n{\n\tint a; int b; int c; int d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tif (check(a, b, c) || check(b, c, d) || check(a, c, d) || check(a, b, d)) {\n\t\tprintf(\"TRIANGLE\\n\");\n\t} else if (check_degen(a, b, c) || check_degen(b, c, d) || check_degen(a, c, d) || check_degen(a, b, d)) {\n\t\tprintf(\"SEGMENT\\n\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint a, b, c, d, tz;\n \nint main()\n{\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\tif(a > b) {tz = a; a = b; b = tz;}\n\tif(c < a) {tz = c; c = b; b = a; a = tz;}\n\telse if(c < b) {tz = c; c = b; b = tz;}\n\tif(d < a) {tz = d; d = c; c = b; b = a; a = tz;}\n\telse if ( d < b) {tz = d; d = c; c = b; b = tz;}\n\telse if ( d < c) {tz = d; d = c; c = tz;}\n\t\n\tif (a + b < c && b + c < d) printf(\"IMPOSSIBLE\");\n\telse if (a + b > c || b + c > d) printf(\"TRIANGLE\");\n\telse printf(\"SEGMENT\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint a[5];\nint b[4];\nint flag;\n\nint cmp(void const *a, void const *b)\n{\n\treturn *(int *)a < *(int *)b ? -1 : 1;\n}\nvoid cal()\n{\n\tif (flag == 1)\n\treturn;\n\tint z[3];\n\tfor (int i = 1; i <= 3; i++)\n\t{\n\t\tz[i-1] = b[i];\n\t}\n\tqsort(z,3,sizeof(z[0]),cmp);\n\tif (z[0] + z[1] > z[2])\n\tflag = 1;\n\tif (z[0] + z[1] == z[2])\n\tflag = 2;\n}\nvoid dfs(int f, int u)\n{\n\tif (u == 4)\n\t{\n\t\tcal();\n\t\treturn;\n\t}\n\tif (f == 5) return;\n\tb[u] = a[f];\n\tdfs(f+1,u+1);\n\tdfs(f+1,u);\n}\n\nint main()\n{\n\tfor (int i = 1; i <= 4; i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tdfs(1,1);\n\tif (flag == 0)\n\tprintf(\"IMPOSSIBLE\");\n\tif (flag == 1)\n\tprintf(\"TRIANGLE\");\n\tif (flag == 2)\n\tprintf(\"SEGMENT\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int a[4];\n scanf(\"%d %d %d %d\",&a[0],&a[1],&a[2],&a[3]); \n for(int i=0; i<=2; i++){ \n for(int j=0; j<=2-i; j++){\n int mid = 0;\n if(a[j]>a[j+1]){\n mid = a[j+1];\n a[j+1]= a[j];\n a[j]= mid;\n }\n }\n }\n //\u5192\u6ce1\u7b97\u6cd5\n if(a[0]+a[1]>a[2]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\");\n } else if (a[0]+a[1]==a[2]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\"); \n } else {\n printf(\"IMPOSSIBLE\");\n }\n \n // for(int i=0; i<4; i++){\n // printf(\"%d \",a[i]);\n // }\n // system(\"pause\");\n\n}"}, {"source_code": "#include <stdio.h>\nint trgl(int a,int b,int c);\nvoid res(int a);\nint main(){\n int a, b, c, d,x,y=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n x=trgl(a,b,c);\n if (x>=y)\n y=x;\n x=trgl(a,c,d);\n if (x>=y)\n y=x;\n x=trgl(a,b,d);\n\n if (x>y)\n y=x;\n\n x=trgl(b,c,d);\n if (x>=y)\n y=x;\n res(y);\n return 0;\n}\nint trgl(int a,int b,int c){\n int y;\n if (a+b>c && b+c>a && c+a>b){\n y=3;}\n else if (a+b==c || b+c==a || c+a==b){\n y=2;}\n else{\n y=1;\n }\n\n return y;\n}\nvoid res(int a){\n if (a==3)\n printf(\"TRIANGLE\");\n else if (a==2)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(a<=100 && b<=100 && c<=100 && d<=100)\n {\n\n if((a<b+c && b<a+c && c<a+b)||(d<b+c && b<d+c && c<d+b)||(a<d+c && d<a+c && c<a+d)||(a<b+d && b<a+d && d<a+b))\n printf(\"TRIANGLE\");\n else\n if((a==b+c || b==a+c || c==a+b)||(d==b+c || b==d+c || c==d+b)||(a==d+c || d==a+c || c==a+d)||(a==b+d || b==a+d || d==a+b))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if((a+b>c&&a+c>b&&b+c>a)||(a+d>c&&a+c>d&&d+c>a)||(d+b>c&&d+c>b&&b+c>d)||(a+b>d&&a+d>b&&b+d>a))\n printf(\"TRIANGLE\");\n else if((a+b==c||a+c==b||b+c==a)||(a+d==c||a+c==d||d+c==a)||(d+b==c||d+c==b||b+c==d)||(a+b==d||a+d==b||b+d==a))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint length[4];\n\tint i=0,j=0,a=0,sum=0;\n\tfor(;i<4;i++)\n\tscanf(\"%d\",&length[i]);\n for(i=0;i<3;i++)\n\t{\n\t for(j=i+1;j<4;j++)\n\t {\n if(length[j]<length[i])\n {\n\t a=length[i];\n\t length[i]=length[j];\n\t\t length[j]=a;\t\n\t }\n }\n\t}\n\tif(length[0]+length[1]>length[3]|length[0]+length[1]>length[2]|length[1]+length[2]>length[3])\n\t printf(\"TRIANGLE\");\n\telse\n\t if(length[0]+length[1]==length[3]|length[0]+length[1]==length[2]|length[1]+length[2]==length[3])\n\t printf(\"SEGMENT\");\n\t else\n\t printf(\"IMPOSSIBLE\");\t \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if(((a<b+c)&&(b<a+c)&&(c<a+b))||((a<b+d)&&(b<a+d)&&(d<a+b))||((a<d+c)&&(d<a+c)&&(c<a+d))||((d<b+c)&&(b<d+c)&&(c<b+d))){\n printf(\"TRIANGLE\\n\");\n }\n else if((a+b==d)||(a+b==c)||(b+c==a)||(b+c==d)||(a+c==b)||(a+c==d)||(a+d==b)||(a+d==c)||(b+d==a)||(b+d==c)||(c+d==a)||(c+d==b)){\n printf(\"SEGMENT\\n\");\n }\n else {\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint triangle(int a,int b,int c){\n if((a<b+c)&&(b<a+c)&&(c<a+b)) return 1;\n else return 0;\n}\nint segment(int a,int b,int c){\n if((a==b+c)||(b==a+c)||(c==a+b)) return 1;\n else return 0;\n}\nint main(){\n int d_triangle=0,t_segment=0;\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n d_triangle=d_triangle||triangle(a,b,c);\n d_triangle=d_triangle||triangle(a,b,d);\n d_triangle=d_triangle||triangle(a,c,d);\n d_triangle=d_triangle||triangle(b,c,d);\n \n t_segment=t_segment||segment(a,b,c);\n t_segment=t_segment||segment(a,b,d);\n t_segment=t_segment||segment(a,c,d);\n t_segment=t_segment||segment(b,c,d);\n \n if(d_triangle) printf(\"TRIANGLE\");\n else if(t_segment) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{\n int x, y, z, c;\n scanf(\"%i %i %i %i\", &x, &y, &z, &c);\n if(((x<y+z)&&(y<x+z)&&(z<x+y))||((c<x+y)&&(x<y+c)&&(y<x+c))||((z<x+c)&&(x<z+c)&&(c<x+z))||((z<y+c)&&(y<z+c)&&(c<z+y))) printf(\"TRIANGLE\");\n else if(((x==y+z)||(y==x+z)||(z==x+y))||((c==x+y)||(x==y+c)||(y==x+c))||((z==x+c)||(x==z+c)||(c==x+z))||((z==y+c)||(y==z+c)||(c==z+y))) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain() {\n int a,b,c,d,i,j,k;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if((a < b+c&&b < a+c&&c < a+b) || ( a < b+d&&b < a+d&&d < a+b ) || ( a < c+d&&d < a+c&&c <a+d ) || ( b < c+d&&d < b+c&&c <b+d ))\n\tprintf(\"TRIANGLE\\n\");\n else if((a==b+c || b==a+c || c==a+b) || (a==b+d || b==a+d || d==a+b) || (a==c+d || d==a+c || c==a+d) || (b==c+d || d==b+c || c==b+d))\n\tprintf(\"SEGMENT\\n\");\n else\n\tprintf(\"IMPOSSIBLE\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nvoid ins(int a[], int n)\n{\n int i, j, k;\n for (i=1; i<n; i++)\n {\n k=a[i];\n\n for(j=i-1 ; j>=0 && a[j]<k; j--)\n a[j+1]=a[j];\n\n a[j+1]=k;\n }\n}\n\nint main()\n{\n int i, a[4];\n for(i=0;i<4;i++)\n scanf(\"%d\", &a[i]);\n\n ins(a, 4);\n\n if((a[3]+a[2])>a[1] || (a[2]+a[1])>a[0])\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if((a[3]+a[2])==a[1] || (a[2]+a[1])==a[0])\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n return 0;\n }\n}\n"}, {"source_code": "#include <stdbool.h>\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\nbool seg=false, tri=false;\n\nvoid judge(int a1, int a2, int a3) {\n if (a3<a2) {int z=a3;a3=a2;a2=z;}\n if (a3<a1) {int z=a3;a3=a1;a1=z;}\n if (a1+a2>a3) tri = true;\n if (a1+a2==a3) seg = true;\n}\n\nint main() {\n int a,b,c,d;\n scanf(\"%d %d %d %d\", &a,&b,&c,&d);\n judge(a,b,c);\n judge(a,b,d);\n judge(a,c,d);\n judge(b,c,d);\n printf(tri?\"TRIANGLE\\n\":seg?\"SEGMENT\\n\":\"IMPOSSIBLE\\n\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n while(scanf(\" %d %d %d %d\",&a,&b,&c,&d)==4)\n {\n if( (a+b>c && b+c>a && c+a>b) || (a+b>d && b+d>a && d+a>b) || (b+c>d && c+d>b && d+b>c) || (a+c>d && c+d>a && d+a>c) )\n printf(\"TRIANGLE\\n\");\n else if (a+b==c || a+c==b || b+c==a || a+b==d || a+d==b || b+d==a || a+c==d || a+d==c || c+d==a || b+c==d || b+d==c || c+d==b)\n printf(\"SEGMENT\\n\");\n else printf(\"IMPOSSIBLE\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\nint kiemtra(int x, int y,int z)\n{\n\tif (x+y>z && x+z>y && z+y>x)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint bang(int x1, int y1, int z1)\n{\n\tif (x1+y1==z1 || x1+z1==y1 || z1+y1==x1)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif (kiemtra(a,b,c) || kiemtra(a,b,d) || kiemtra(d,b,c) || kiemtra(a,d,c) ) \n\t{\n\t printf(\"TRIANGLE\"); \n\t return 0;\n\t}\n if (bang(a,b,c) || bang(a,b,d) || bang(d,b,c) || bang(a,d,c) ) \n\t{\n\t printf(\"SEGMENT\"); \n\t return 0;\n\t}\n\telse printf(\"IMPOSSIBLE\");\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint cmp(const int *a, const int *b){\n if(*a < *b) return -1;\n if(*a > *b) return 1;\n return 0;\n}\n\nint main(){\n int in[4], i;\n for(i = 0; i < 4; ++i) scanf(\"%d\", &in[i]);\n qsort(in, 4, sizeof(int), cmp);\n \n int j, k, find = 0;\n for(i = 0; i < 4; ++i){\n for(j = i+1; j < 4; ++j){\n for(k = j+1; k < 4; ++k){\n if(find < 2 && in[i] + in[j] > in[k]) find = 2;\n if(find < 1 && in[i] + in[j] == in[k]) find = 1;\n }}}\n \n if(find == 0) puts(\"IMPOSSIBLE\");\n else if(find == 1) puts(\"SEGMENT\");\n else puts(\"TRIANGLE\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nvoid ins(int a[], int n)\n{\n int i, j, k;\n for (i=1; i<n; i++)\n {\n k=a[i];\n\n for(j=i-1 ; j>=0 && a[j]<k; j--)\n a[j+1]=a[j];\n\n a[j+1]=k;\n }\n}\n\nint main()\n{\n int i, a[4];\n for(i=0;i<4;i++)\n scanf(\"%d\", &a[i]);\n\n ins(a, 4);\n\n if((a[3]+a[2])>a[1] || (a[2]+a[1])>a[0])\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if((a[3]+a[2])==a[1] || (a[2]+a[1])==a[0])\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n return 0;\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a[5];\n\tint i,j,k,m;\n\t\n\tfor (i=0;i<4;i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tfor (i=0;i<4;i++) {\n\t\tk=i;\n\t\tfor (j=i;j<4;j++) {\n\t\t\tif (a[k]>a[j]) {\n\t\t\t\tm = a[j];\n\t\t\t\ta[j] = a[k];\n\t\t\t\ta[k] = m;\n\t\t\t}\n\t\t}\n\t}\n\tif (a[0]+a[1]>a[2] || a[1]+a[2]>a[3]) {\n\tprintf(\"TRIANGLE\");\n\t} else if (a[0]+a[1]==a[2] || a[1]+a[2]==a[3]) {\n\tprintf(\"SEGMENT\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\t\t\n\treturn 0;\n}"}, {"source_code": " #include<stdio.h>\n int main()\n {\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if((a+b>c&&b+c>a&&a+c>b)||(a+b>d&&b+d>a&&a+d>b)||(b+d>c&&b+c>d&&c+d>b)||(a+c>d&&d+c>a&&a+d>c)){\n printf(\"TRIANGLE\");\n }\n else if((a+b==c||b+c==a||a+c==b)||(a+b==d||b+d==a||a+d==b)||(b+d==c||b+c==d||c+d==b)||(a+c==d||d+c==a||a+d==c)){\n printf(\"SEGMENT\");\n }\n else{\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define YES 1\n#define NO 0\n\nvoid prob6A(){\n int i, a, b, c, d, state, state_2;\n\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\n int arr[5][5] = {{a, b, c},\n {b, a, d},\n {c, a, d},\n {d, b, c}};\n\n state = NO;\n state_2 = NO;\n for (i=0; i<4; i++)\n if ((arr[i][0]<arr[i][1]+arr[i][2]) && (arr[i][1]<arr[i][0]+ arr[i][2]) && (arr[i][2]<arr[i][1]+arr[i][0]))\n state = YES;\n for (i=0; i<4; i++)\n if (arr[i][0]==arr[i][1]+arr[i][2] || arr[i][1]==arr[i][0]+arr[i][2] || arr[i][2]==arr[i][1]+arr[i][0])\n state_2 = YES;\n\n if (state == YES)\n printf(\"TRIANGLE\");\n else if (state_2 == YES)\n printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n\n}\n\nint main()\n{ prob6A();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nvoid sort(int *arr, int len, int rec)\n{\n if(len == 1) return;\n int record = 0;\n for(int i = 0; i < len; ++i)\n {\n if(*(arr + len - 1 - i) > record)\n {\n record = *(arr + len - 1 - i);\n *(arr + len - 1 - i) = *(arr + len - 1);\n *(arr + len - 1) = record;\n }\n }\n ++rec; --len;\n sort(arr, len, rec);\n return;\n}\n\nint main()\n{\n int arr[4] = {0, 0, 0, 0};\n \n scanf(\"%i %i %i %i\", &arr[0], &arr[1], &arr[2], &arr[3]);\n \n sort(&arr[0], 4, 0);\n \n if(arr[0]+arr[1]>arr[2] || arr[1]+arr[2]>arr[3])\n {\n printf(\"TRIANGLE\\n\");\n }\n else if(arr[0]+arr[1]==arr[2] || arr[1]+arr[2]==arr[3])\n {\n printf(\"SEGMENT\\n\");\n }\n else\n {\n printf(\"IMPOSSIBLE\\n\");\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int number[4];\n int i, j, a;\n scanf(\"%d %d %d %d\", &number[0], &number[1], &number[2], &number[3]);\n\n for (i = 0; i < 4; ++i) {\n for (j = i + 1; j < 4; ++j) {\n if (number[i] < number[j]) {\n a = number[i];\n number[i] = number[j];\n number[j] = a;\n }\n }\n }\n int temp = 0;\n for (int i = 0; i < 2; ++i) {\n if (number[i] < number[i + 1] + number[i + 2]) {\n printf(\"TRIANGLE\\n\");\n return 0;\n } else if (number[i] == number[i + 1] + number[i + 2]) {\n temp = 1;\n } \n }\n\n if (temp) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"IMPOSSIBLE\\n\");//\n }\n return 0;\n}"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n#define T1(x, y, z) (x + y > z && abs(x - y) < z)\n#define T2(x, y, z) (x + y == z || x + z == y || y + z == x)\nint main(void)\n{\n int a, b, c, d;\n\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\n if(T1(a, b, c) || T1(a, b, d) || T1(a, c, d) || T1(b, c, d))\n printf(\"TRIANGLE\");\n else if(T2(a, b, c) || T2(a, b, d) || T2(a, c, d) || T2(b, c, d))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint make_me_larger(int a[]){int i,j,swap;for(i=0;i<3;i++){for(j=0;j<3-i;j++){if(a[j]<a[j+1])swap=a[j],a[j]=a[j+1],a[j+1]=swap;}}return 0;}int main(){int a[4],i;for(i=0;i<4;i++)scanf(\"%d\",&a[i]);make_me_larger(a);if(a[0]<a[1]+a[2] || a[1]<a[2]+a[3] || a[0]<a[2]+a[3])printf(\"TRIANGLE\\n\");else{if(a[1]==a[2]+a[3] || a[1]==a[0]+a[2] || a[1]==a[0]+a[3] || a[0]==a[1]+a[2] || a[0]==a[2]+a[3] || a[0]==a[1]+a[3] || a[2]==a[0]+a[1] || a[2]==a[0]+a[3] || a[2]==a[1]+a[3] || a[3]==a[0]+a[1] || a[3]==a[1]+a[2] || a[3]==a[0]+a[2])printf(\"SEGMENT\\n\");else printf(\"IMPOSSIBLE\\n\");}return 0;}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <string.h>\n\nint main(){\nint arr[4],i,j,k,e=0,c=0,d=0;\nfor(i=0;i<4;i++){\nscanf(\"%d\",&arr[i]);}\nfor(i=0;i<2;i++){\n for(j=i+1;j<3;j++){\n for(k=j+1;k<4;k++){\n if(arr[i]+arr[j]>arr[k]&&arr[i]+arr[k]>arr[j]&&arr[j]+arr[k]>arr[i]){\n c++;\n\n\n\n }\n else if(arr[i]+arr[j]==arr[k]||arr[i]+arr[k]==arr[j]||arr[j]+arr[k]==arr[i])\n {\n d++;\n\n\n }\n else e++;\n }}}\n if(c!=0)\n printf(\"TRIANGLE\");\n else if(d!=0)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main ()\n { \n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if ((a < b+c && b < a+c && c < a+b) || (a < b+d && b < a+d && d < a+b) || (a < d+c && d < a+c && c < a+d) || (d < b+c && b < d+c && c < d+b))\n printf(\"TRIANGLE\\n\");\n else if ((a == b+c || b == a+c || c == a+b) || (a == b+d || b == a+d || d == a+b) || (a == d+c || d == a+c || c == a+d) || (d == b+c || b == d+c || c == d+b))\n printf(\"SEGMENT\\n\");\n else printf(\"IMPOSSIBLE\\n\");\n \n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a[4],i,j,k,d=0;\n\tfor(i=0;i<4;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<4;j++){\n\t\t\tif(i==j)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<4;k++)\n\t\t\t{\n\t\t\t\tif(i==k || j==k)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(a[i]<a[j]+a[k] && a[i]>abs(a[j]-a[k]))\n\t\t\t\t{\n\t\t\t\t\td=1;\n\t\t\t\t\tgoto c;\n\t\t\t\t}\n\t\t\t\telse if(a[i]==a[j]+a[k])\n\t\t\t\t\td=2;\n\n\t\t\t}\n\t\t}\n\t\t\n\t}\nc:\n\tif(d==1)\n\t\tprintf(\"TRIANGLE\");\n\telse if(d==2)\n\t\tprintf(\"SEGMENT\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,i,j,k,temp;\n int a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++){\n for(j=i;j<4;j++){\n if(a[j]<a[i]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(a[0]+a[1]==a[2]||a[0]+a[2]==a[3]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint check(int a, int b, int c) {\n\t\n\tif (a + b > c && b + c > a && a + c > b)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint check_degen(int a, int b, int c) {\n\tif (a + b == c || a + c == b || b + c == a)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main(void)\n{\n\tint a; int b; int c; int d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tif (check(a, b, c) || check(b, c, d) || check(a, c, d) || check(a, b, d)) {\n\t\tprintf(\"TRIANGLE\\n\");\n\t} else if (check_degen(a, b, c) || check_degen(b, c, d) || check_degen(a, c, d) || check_degen(a, b, d)) {\n\t\tprintf(\"SEGMENT\\n\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int arr[5], i, j, k, flag;\n scanf(\"%d%d%d%d\", &arr[0], &arr[1], &arr[2], &arr[3]);\n\n for(i = 0; i < 4; i++){\n for(j = i+1; j <4; j++){\n if(arr[j] >arr[i]){\n k = arr[i]; arr[i] = arr[j]; arr[j] = k;\n }\n }\n }\n flag = 0;\n if(arr[0] < (arr[1] + arr[2]) || arr[1] < (arr[2] + arr[3])){\n flag = 1;\n } else if(arr[0] == (arr[1]+arr[2]) || arr[1] == (arr[2]+arr[3])){\n flag = 2;\n }\n\n if(flag == 0){\n printf(\"IMPOSSIBLE\\n\");\n } else if(flag == 1){\n printf(\"TRIANGLE\\n\");\n } else if(flag == 2){\n printf(\"SEGMENT\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4];\n for(int i = 0;i<4;i++)\n scanf(\"%d\",&a[i]);\n int t[3];\n int check = 0;\n for(int i =1; i<=4;i++)\n {\n int c = 0;\n for(int j = 0;j<3;j++)\n {\n switch (i)\n {\n case 1:\n t[j] = a[c++]; break;\n case 2:\n t[j] = a[c]; if(j==1) c+=2; else c++; break;\n case 3:\n t[j] = a[c]; if(j==0) c+=2; else c++; break;\n case 4:\n t[j] = a[++c]; break;\n }\n }\n if(((t[0]+t[1])>t[2])&&((t[0]+t[2])>t[1])&&((t[1]+t[2])>t[0])) {check = 1; break;}\n else if(((t[0]+t[1])==t[2])||((t[0]+t[2])==t[1])||((t[1]+t[2])==t[0])) check = 2;\n }\n if(check==0) printf(\"IMPOSSIBLE\");\n else if(check==1) printf(\"TRIANGLE\");\n else printf(\"SEGMENT\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d;\n int t=0,s=0;\n //int A,B,C;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b>=c && a+c>=b && b+c>=a)\n { if(a+b>c && a+c>b && b+c>a){t=1;}\n else {s=1;}\n }\n if(a+b>=d && a+d>=b && b+d>=a)\n {\n if(a+b>d && a+d>b && b+d>a){t=1;}\n else {s=1;}\n }\n if(a+c>=d && a+d>=c && c+d>=a)\n {\n if(a+c>d && a+d>c && c+d>a){t=1;}\n else {s=1;}\n }\n if(b+c>=d && b+d>=c && c+d>=b)\n {\n if(b+c>d && b+d>c && c+d>b){t=1;}\n else {s=1;}\n }\n if(t==1){printf(\"TRIANGLE\"); return 0;}\n if(s==1){printf(\"SEGMENT\"); return 0;}\n printf(\"IMPOSSIBLE\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if((a+b>c&&a+c>b&&b+c>a)||(a+d>c&&a+c>d&&d+c>a)||(d+b>c&&d+c>b&&b+c>d)||(a+b>d&&a+d>b&&b+d>a))\n printf(\"TRIANGLE\");\n else if((a+b==c||a+c==b||b+c==a)||(a+d==c||a+c==d||d+c==a)||(d+b==c||d+c==b||b+c==d)||(a+b==d||a+d==b||b+d==a))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "# include<stdio.h>\nint a[4] = {0};\nint u[4] = {0};\nint cc[4];\nint triangleFlag = 0;\nint segmentFlag = 0;\n\ndfs(int d){\n\tif (d == 4){\n\t\treturn;\n\t}\n\tif (d == 3){\n\t\tif (u[0] + u[1] > u[2] && u[0] + u[2] > u[1] && u[1] + u[2] > u[0]){\n\t\t\ttriangleFlag = 1;\n\t\t}\n\t\tif (u[0] + u[1] >= u[2] && u[0] + u[2] >= u[1] && u[1] + u[2] >= u[0]){\n\t\t\tsegmentFlag = 1;\n\t\t}\n\t}\n\tfor (int i = 0; i < 4; i++){\n\t\tint temp_flag = 0;\n\t\tfor (int j = 0; j < 4; j++){\n\t\t\tif (cc[j] == i){\n\t\t\t\ttemp_flag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (temp_flag){\n\t\t\tcontinue;\n\t\t}\n\t\tu[d] = a[i];\n\t\tcc[i] = i;\n\t\tdfs(++d);\n\t\td--;\n\t\tu[d] = 0;\n\t\tcc[i] = -1;\t\t\n\t}\n}\n\nint main(){\n\tfor (int i = 0; i < 4; i++){\n\t\tscanf(\"%d\", a+i);\n\t\tcc[i] = -1;\n\t}\n\tdfs(0);\n\tif (triangleFlag){\n\t\tprintf(\"TRIANGLE\");\n\t} else if(segmentFlag){\n\t\tprintf(\"SEGMENT\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n} "}, {"source_code": "#include <stdio.h>\nint main()\n{\n int C[4], i, a, j, m=0;\n for(i=0;i<4;i++){\n scanf(\"%d\", &C[i]);\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(C[i]<C[j]){\n a=C[i];\n C[i]=C[j];\n C[j]=a;\n }\n }\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(C[i]==C[j]){\n m++;\n }}}\n if(C[0]<C[1]+C[2] || C[0]<C[2]+C[3] || C[0]<C[1]+C[3] || C[1]<C[2]+C[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(m>=2){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]==C[1]+C[2] || C[0]==C[2]+C[3] || C[0]==C[1]+C[3] || C[1]==C[2]+C[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a[4], num, i, j, k;\n scanf(\"%d %d %d %d\", &a[0], &a[1], &a[2] , &a[3]);\n for(i=0;i<2;i++){\n for(j=i+1;j<3;j++){\n for(k=j+1;k<4;k++){\n if((a[i]<a[j]+a[k])&&(a[j]<a[i]+a[k])&&(a[k]<a[i]+a[j])){\n printf(\"TRIANGLE\\n\");\n return 0;\n }\n }\n }\n }\n for(i=0;i<2;i++){\n for(j=i+1;j<3;j++){\n for(k=j+1;k<4;k++){\n if((a[i]==a[j]+a[k])||(a[j]==a[i]+a[k])||(a[k]==a[i]+a[j])){\n printf(\"SEGMENT\\n\");\n return 0;\n }\n }\n }\n }\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n\n{\n\nint x, y, z, c;\n\nscanf(\"%i %i %i %i\", &x, &y, &z, &c);\n\nif(((x<y+z)&&(y<x+z)&&(z<x+y))||((c<x+y)&&(x<y+c)&&(y<x+c))||((z<x+c)&&(x<z+c)&&(c<x+z))||((z<y+c)&&(y<z+c)&&(c<z+y))) printf(\"TRIANGLE\");\n\nelse if(((x==y+z)||(y==x+z)||(z==x+y))||((c==x+y)||(x==y+c)||(y==x+c))||((z==x+c)||(x==z+c)||(c==x+z))||((z==y+c)||(y==z+c)||(c==z+y))) printf(\"SEGMENT\");\n\nelse printf(\"IMPOSSIBLE\");\n\n\n\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\nint kiemtra(int x, int y,int z)\n{\n\tif (x+y>z && x+z>y && z+y>x)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint bang(int x1, int y1, int z1)\n{\n\tif (x1+y1==z1 || x1+z1==y1 || z1+y1==x1)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif (kiemtra(a,b,c) || kiemtra(a,b,d) || kiemtra(d,b,c) || kiemtra(a,d,c) ) \n\t{\n\t printf(\"TRIANGLE\"); \n\t return 0;\n\t}\n if (bang(a,b,c) || bang(a,b,d) || bang(d,b,c) || bang(a,d,c) ) \n\t{\n\t printf(\"SEGMENT\"); \n\t return 0;\n\t}\n\telse printf(\"IMPOSSIBLE\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,m,k,c;\n scanf(\"%d%d%d%d\",&n,&m,&k,&c);\n if((n+m>k&&m+k>n&&k+n>m)||(m+k>c&&k+c>m&&m+c>k)||(n+m>c&&m+c>n&&n+c>m)||(n+k>c&&k+c>n&&c+n>k))\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if((n+m==k||m+k==n||k+n==m)||(m+k==c||k+c==m||m+c==k)||(n+m==c||m+c==n||n+c==m)||(n+k==c||k+c==n||c+n==k))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n return 0;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[4],i,j,k,m=0,x=0,y=0;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++)\n {\n for(j=0;j!=i && j<4;j++)\n {\n for(k=0;k!=i && k!=j && k<4;k++)\n {\n if(a[i]<a[j]+a[k] && a[j]<a[i]+a[k] && a[k]<a[i]+a[j])\n m=1;\n if(a[i]==a[j]+a[k] || a[j]==a[i]+a[k] || a[k]==a[i]+a[j])\n x=1;\n else\n y=1;\n }\n }\n }\n if(m==1)\n printf(\"TRIANGLE\\n\");\n if(m==0 && x==1)\n printf(\"SEGMENT\\n\");\n if(m==0 && x==0 &&y==1)\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}"}, {"source_code": "#import <stdio.h>\n\nint checkTriangle(int num1, int num2, int num3)\n{\n if (((num1 + num2) > num3) & ((num2 + num3) > num1) & ((num1 + num3) > num2))\n {\n return 1;\n }\n return 0;\n}\n\nint checkSegment(int num1, int num2, int num3)\n{\n if ((num1 + num2 == num3) || (num2 +num3 == num1) || (num1 + num3 == num2))\n {\n return 1;\n }\n return 0;\n}\nint main()\n{\n int num[4];\n\n for (int i = 0; i < 4; i++)\n {\n scanf(\"%d\", &num[i]);\n }\n\n int t = 0;\n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else\n {\n a = i + 1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else\n {\n b = a + 1;\n }\n t = checkTriangle(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n }\n\n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else\n {\n a = i + 1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else\n {\n b = a + 1;\n }\n t = checkSegment(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"SEGMENT\");\n return 0;\n }\n }\n if (t==0)\n {\n printf(\"IMPOSSIBLE\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint s=0,p=0;\nint sum(int a,int b,int c)\n{\n if(a+b>c && b+c>a && a+c>b)\n {\n s=1;\n return 0;\n }\n if(a+b>=c&&b+c>=a &&c+a>=b)\n {\n p=1;\n return 0;\n }\n return 0;\n}\n\n\nint main(){\n int a[4],i,j,k;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n for(k=0;k<4;k++)\n {\n if(a[k]+a[j]>=a[i]&&j!=i&&k!=i&&j!=k)\n sum(a[i],a[j],a[k]);\n }\n }\n }\nif(s==1){\n printf(\"TRIANGLE\\n\");\n return 0;\n}\nelse if(p==1){\n printf(\"SEGMENT\\n\");\n return 0;\n}\nprintf(\"IMPOSSIBLE\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,d,f=-1;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b>c&&b+c>a&&a+c>b)\n f=1;\n else if(a+b>d&&a+d>b&&b+d>a)\n f=1;\n else if(a+c>d&&a+d>c&&c+d>a)\n f=1;\n else if(b+d>c&&b+c>d&&c+d>b)\n f=1;\n else if(a+b==c||b+c==a||a+c==b)\n f=0;\n else if(a+b==d||a+d==b||b+d==a)\n f=0;\n else if(a+c==d||a+d==c||c+d==a)\n f=0;\n else if(b+d==c||b+c==d||c+d==b)\n f=0;\n if(f==0)\n printf(\"%s\",\"SEGMENT\");\n else if(f==1)\n printf(\"%s\",\"TRIANGLE\");\n else\n printf(\"%s\",\"IMPOSSIBLE\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int num,i,j,k,temp;\n int ara[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&ara[i]);\n }\n for(j=0;j<4;j++){\n for(k=j;k<4;k++){\n if(ara[k]<ara[j]){\n temp=ara[k];\n ara[k]=ara[j];\n ara[j]=temp;\n }\n }\n }\n if(ara[0]+ara[1]>ara[2]||ara[0]+ara[2]>ara[3]||ara[1]+ara[2]>ara[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(ara[0]+ara[1]==ara[2]||ara[0]+ara[2]==ara[3]||ara[1]+ara[2]==ara[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,i,j,k,temp;\n int a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++){\n for(j=i;j<4;j++){\n if(a[j]<a[i]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(a[0]+a[1]==a[2]||a[0]+a[2]==a[3]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint c[10], n=4, i, j, m;\n\nint main()\n{\n scanf(\"%d %d %d %d\", &c[1], &c[2], &c[3], &c[4]);\n for (j=1; j<n; j++)\n for (i=1; i<n; i++)\n if(c[i+1]<c[i])\n {\n m = c[i];\n c[i] = c[i+1];\n c[i+1] = m;\n }\n if (c[1]+c[2]>c[3] || c[2]+c[3]>c[4])\n printf(\"TRIANGLE\");\n else\n if (c[1]+c[2]==c[3] || c[2]+c[3]==c[4])\n printf(\"SEGMENT\");\n else\n if (c[1]+c[2]<c[3] || c[2]+c[3]<c[4])\n printf(\"IMPOSSIBLE\");\n else\n return 0;\n}"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a[4] = { 0 }, i, j, k, pass;\n\twhile (scanf(\"%d\", &a[0]) != EOF)\n\t{\n\t\tfor (i = 1; i < 4; i++) { scanf(\"%d\", &a[i]); }\n\t\tfor (pass = 1; pass <= 4; pass++)\n\t\t{\n\t\t\tfor (i = 0; i < 4 - pass; i++)\n\t\t\t{\n\t\t\t\tif (a[i] < a[i + 1])\n\t\t\t\t{\n\t\t\t\t\tk = a[i];\n\t\t\t\t\ta[i] = a[i + 1];\n\t\t\t\t\ta[i + 1] = k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (a[1] + a[2]>a[0] || a[2]+a[3]>a[1]) { printf(\"TRIANGLE\\n\"); }\n\t\telse if (a[1] + a[2] == a[0] || a[2]+a[3]==a[1]) \n\t\t{\n\t\t\tprintf(\"SEGMENT\\n\");\n\t\t}\n\t\telse if(a[1]+a[2]<a[0] && a[2]+a[3]<a[1]){ printf(\"IMPOSSIBLE\\n\"); }\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint a[5], p, x, i, j;\n\tfor (i=0; i<4; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tx=a[0];\n\tfor (i=3; i>0; i--)\n\t{\n\t\tfor (j=0; j<i; j++)\n\t\t{\n\t\t\tif (a[i]<a[j])\n\t\t\t{\n\t\t\t\tp=a[i];\n\t\t\t\ta[i]=a[j];\n\t\t\t\ta[j]=p;\n\t\t\t}\n\t\t}\n\t}\n\tif (((a[0]+a[1])>a[2]) || ((a[1]+a[2])>a[3]))\n\t{\n\t\tprintf(\"TRIANGLE\\n\");\n\t}\n\telse if (((a[1]+a[2])==a[3]) || ((a[0]+a[1])==a[2]))\n\t{\n\t\tprintf(\"SEGMENT\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint a[10], n=4, i, j, m;\n\nint main()\n{\n scanf(\"%d %d %d %d\", &a[1], &a[2], &a[3], &a[4]);\n for (j=1; j<n; j++)\n for (i=1; i<n; i++)\n if(a[i+1]<a[i])\n {\n m = a[i];\n a[i] = a[i+1];\n a[i+1] = m;\n }\n if (a[1]+a[2]>a[3] || a[2]+a[3]>a[4])\n printf(\"TRIANGLE\");\n else\n if (a[1]+a[2]==a[3] || a[2]+a[3]==a[4])\n printf(\"SEGMENT\");\n else\n if (a[1]+a[2]<a[3] || a[2]+a[3]<a[4])\n printf(\"IMPOSSIBLE\");\n else\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x1,x2,x3,x4,c=0,e=0,k=0,s=0;\n scanf(\"%d%d%d%d\",&x1,&x2,&x3,&x4);\n if (x1 + x2 > x3)\n c++;\n if (x3 + x2 > x1)\n c++;\n if (x1 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x1 + x2 == x3)\n e++;\n if (x3 + x2 == x1)\n e++;\n if (x1 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x3)\n c++;\n if (x3 + x2 > x4)\n c++;\n if (x4 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x3)\n e++;\n if (x3 + x2 == x4)\n e++;\n if (x4 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x1 > x3)\n c++;\n if (x3 + x1 > x4)\n c++;\n if (x4 + x3 > x1)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x1 == x3)\n e++;\n if (x3 + x1 == x4)\n e++;\n if (x4 + x3 == x1)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x1)\n c++;\n if (x1 + x2 > x4)\n c++;\n if (x4 + x1 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x1)\n e++;\n if (x1 + x2 == x4)\n e++;\n if (x4 + x1 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n if((k!=-1)&&(s==-1))\n printf(\"SEGMENT\");\n if ((k!=-1)&&(s!=-1))\n printf(\"IMPOSSIBLE\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>//\nint main()\n{\n int a[4],i,j,k;\n scanf(\"%d%d%d%d\",&a[0],&a[1],&a[2],&a[3]);\n for(i=0;i<4;i++)\n {\n for(j=i+1;j<4;j++)\n {\n if(a[i]>a[j])\n {\n k=a[i];\n a[i]=a[j];\n a[j]=k;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[1]+a[2]>a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[0]+a[1]==a[2]||a[1]+a[2]==a[3])\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdbool.h>\n#include <stddef.h>\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n\nvoid sort ( int * );\n\nint main()\n{\nint arr[4] ;\nint x , y ;\n\nfor (int i = 0 ; i < 4 ; i++)\nscanf(\"%d\", &arr[i]);\n\n\nsort(arr);\n\n\nif(arr[0]+arr[1]>arr[2] || arr[1]+arr[2]>arr[3])\n{\n printf(\"TRIANGLE\\n\");\n}\nelse if(arr[0]+arr[1]==arr[2] || arr[1]+arr[2]==arr[3])\n{\n printf(\"SEGMENT\\n\");\n}\nelse\n{\n printf(\"IMPOSSIBLE\\n\");\n\n}\n\n return 0;\n}\n\n\nvoid sort (int *arr){\n\tint temp;\n\tfor ( int i =0 ; i<4 ; i++){\n\t\tfor ( int n =0 ; n<4 ; n++){\n\t\tif (*(arr+i) < *(arr+n)){\n\t\t\ttemp = *(arr+i);\n\t\t\t*(arr+i) = *(arr+n);\n\t\t\t*(arr+n)=temp;\n\t\t}\n\n\t}\n\t}\nreturn ;}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n\n\nint main()\n{\n//\tfreopen(\"input.txt\",\"r\",stdin);\n//\tfreopen(\"output.txt\",\"w\",stdout);\n\t\n\tlong int m[4], i, k, min_i, c;\n\t\n\tfor (i=0;i<4;i++)\n\t{\n\t\tscanf(\"%li\", &m[i]);\n\t}\n\t\n\tfor (i=0;i<4-1;i++)\n\t{\n\t\tmin_i=i;\n\t\t\n\t\tfor (k=i;k<4;k++)\n\t\t{\n\t\t\tif (m[k]<m[min_i])\n\t\t\t{\n\t\t\t\tmin_i=k;\n\t\t\t}\n\t\t}\n\t\t\n\t\tc=m[min_i];\n\t\tm[min_i]=m[i];\n\t\tm[i]=c;\n\t}\n\t/*\n\tfor (i=0;i<4;i++)\n\t{\n\t\tprintf(\"%li\", m[i]);\n\t}\n\t*/\n\t\n\tif ( (m[0]+m[1]>m[3]) || (m[1]+m[2]>m[3]) || (m[0]+m[1]>m[2]) )\n\t{\n\t\tprintf(\"TRIANGLE\");\n\t}\n\t\n\telse\n\t{\n\t\tif ( (m[0]+m[1]==m[3]) || (m[1]+m[2]==m[3]) || (m[0]+m[1]==m[2]) || (m[0]+m[2]==m[3]) )\n\t\t{\n\t\t\tprintf(\"SEGMENT\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"IMPOSSIBLE\");\n\t\t}\n\t\t\n\t}\n\t \n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,len[4],tem,count=0;\n for(i=0;i<4;i++)scanf(\"%d\",&len[i]);\n for(i=0;i<4;i++)\n for(j=0;j<4;j++)\n {\n if(len[j]>len[j+1])\n {\n tem=len[j];\n len[j]=len[j+1];\n len[j+1]=tem;\n }\n }\n if((len[0]<len[1]+len[2])&&(len[1]<len[0]+len[2])&&(len[2]<len[0]+len[1]))\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n if((len[0]==len[1]+len[2])||(len[1]==len[0]+len[2])||(len[2]==len[0]+len[1]))count=1;\n if((len[3]<len[1]+len[2])&&(len[1]<len[3]+len[2])&&(len[2]<len[3]+len[1]))\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n if((len[3]==len[1]+len[2])||(len[1]==len[3]+len[2])||(len[2]==len[3]+len[1]))count=1;\n if(count==0)printf(\"IMPOSSIBLE\");\n else printf(\"SEGMENT\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\nint a,b,c,d,m,n,o,p,q,r,s=0;\nscanf(\"%d%d%d%d\",&a,&b,&c,&d);\nm=a+b,n=b+c,o=c+a,p=a+d,q=b+d,r=c+d;\nif(m>c&&n>a&&o>b || n>d&&q>c&&r>b || m>d&&p>b&&q>a || o>d&&p>c&&r>a){\nprintf(\"TRIANGLE\");\ns=1;\n}\nelse if(s!=1){\nif(m==c||n==a||o==b||n==d||q==c||r==b||m==d||p==b||q==a||o==d||p==c||r==a){\nprintf(\"SEGMENT\");\n}\nelse{\nprintf(\"IMPOSSIBLE\");\n}\n}\n\nreturn 0;\n}\n"}, {"source_code": "# include<stdio.h>\n\nint a[4] = {0};\nint u[4] = {0};\nint flag[4] = {0};\nint flag1 = 0;\nint flag2 = 0;\n\nvoid dfs(int d){\n\tif (d == 4){\n\t\tif (u[0] + u[1] > u[2] && u[0] + u[2] > u[1] && u[1] + u[2] > u[0]){\n\t\t\tflag1 = 1;\n\t\t\treturn;\n\t\t}\n\t\tif (u[0] + u[1] >= u[2] && u[0] + u[2] >= u[1] && u[1] + u[2] >= u[0]){\n\t\t\tflag2 = 1;\n\t\t}\n\t\treturn;\n\t}\n\tfor (int i = 0; i < 4; i++){\n\t\tint temp_flag = 0;\n\t\tfor (int j = 0; j < 4; j++){\n\t\t\tif (flag[j] == i){\n\t\t\t\ttemp_flag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (temp_flag){\n\t\t\tcontinue;\n\t\t}\n\t\tu[d] = a[i];\n\t\tflag[i] = i;\n\t\tdfs(++d);\n\t\td--;\n\t\tu[d] = 0;\n\t\tflag[i] = -1;\n\t}\n}\n\nint main(){\n\tfor (int i = 0; i < 4; i++){\n\t\tscanf(\"%d\", a+i);\n\t\tflag[i] = -1;\n\t}\n\tdfs(0);\n\tif (flag1){\n\t\tprintf(\"TRIANGLE\");\n\t} else if (flag2){\n\t\tprintf(\"SEGMENT\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n \nint a, b, c, d, tz;\n \nint main()\n{\n\tscanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\tif(a > b) {tz = a; a = b; b = tz;}\n\tif(c < a) {tz = c; c = b; b = a; a = tz;}\n\telse if(c < b) {tz = c; c = b; b = tz;}\n\tif(d < a) {tz = d; d = c; c = b; b = a; a = tz;}\n\telse if ( d < b) {tz = d; d = c; c = b; b = tz;}\n\telse if ( d < c) {tz = d; d = c; c = tz;}\n\t\n\tif (a + b < c && b + c < d) printf(\"IMPOSSIBLE\");\n\telse if (a + b > c || b + c > d) printf(\"TRIANGLE\");\n\telse printf(\"SEGMENT\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l[4],i,j,temp;\n for(i=0;i<4;i++){\n scanf(\"%d\",&l[i]);\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(l[j]>l[i]){\n temp=l[i];\n l[i]=l[j];\n l[j]=temp;\n }\n }\n }\n temp=0;\n for(i=0;i<2;i++){\n if(l[i]<l[i+1]+l[i+2]){\n printf(\"TRIANGLE\\n\");\n temp=1;\n break;\n }\n else if(l[i]==l[i+1]+l[i+2])\n {\n temp=2;\n }\n }\n if(temp==2){\n printf(\"SEGMENT\\n\");\n }\n else if(temp==0){\n printf(\"IMPOSSIBLE\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\nint is_triangle(int a,int b,int c)\n{\n if(a+b>c&&a+c>b&&b+c>a) return 1;\n else if(a+b>=c&&a+c>=b&&b+c>=a) return 0;\n else return -1;\n}\nint main()\n{\n//\tfreopen(\"datain.txt\",\"r\",stdin);\n//\tfreopen(\"datain.txt\",\"w\",stdout);\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif(is_triangle(a,b,c)==1||is_triangle(a,b,d)==1||is_triangle(a,c,d)==1||is_triangle(b,c,d)==1)\n printf(\"TRIANGLE\");\n else if(is_triangle(a,b,c)==0||is_triangle(a,b,d)==0||is_triangle(a,c,d)==0||is_triangle(b,c,d)==0)\n printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n//\tfclose(stdin);\n//\tfclose(stdout);\n\treturn 0;\n}"}, {"source_code": "typedef enum {\n\tIMPOSSIBLE = 0,\n\tSEGMENT,\n\tTRIANGLE\n}possible;\n\npossible isTriangle_possible(int x,int y,int z)\n{\t\n\tif (x + y == z)\t\n\t\treturn SEGMENT;\n\tif(x + z == y)\n\t\treturn SEGMENT;\n\tif(z + y == x)\n\t\treturn SEGMENT;\n\t\n\tif(((x + y) < z) || ((y + z) < x) || ((x + z) < y))\n\t\treturn IMPOSSIBLE;\n\treturn TRIANGLE;\n}\nint main()\n{\n\tint x,y,z,p,update = 0;\n\tint ret = 0;\n\tchar result[][20] = {{\"IMPOSSIBLE\"},{\"SEGMENT\"},{\"TRIANGLE\"}};\n\tscanf(\"%d%d%d%d\",&x,&y,&z,&p);\n\tret = isTriangle_possible(x,y,z);\n\tif(ret > update)\n\t{\n\t\tupdate = ret;\n\t\tif (update == TRIANGLE)\n\t\t\tgoto finish;\n\t}\n\tret = isTriangle_possible(x,y,p);\n\tif(ret > update)\n\t{\n\t\tupdate = ret;\n\t\tif (update == TRIANGLE)\n\t\t\tgoto finish;\n\t}\n\tret = isTriangle_possible(x,p,z);\n\tif(ret > update)\n\t{\n\t\tupdate = ret;\n\t\tif (update == TRIANGLE)\n\t\t\tgoto finish;\n\t}\n\t\n\tret = isTriangle_possible(p,y,z);\n\tif(ret > update)\n\t{\n\t\tupdate = ret;\n\t\tif (update == TRIANGLE)\n\t\t\tgoto finish;\n\t}\n\nfinish: \n\tprintf(\"%s\",result[update]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if((a+b>c&&b+c>a&&a+c>b)||(a+b>d&&b+d>a&&a+d>b)||(a+c>d&&a+d>c&&c+d>a)||(b+c>d&&b+d>c&&c+d>b))\n {\n printf(\"TRIANGLE\");\n }\n else if(a==b+c||a==c+d||a==b+d||b==c+d||b==a+c||b==a+d||c==a+b||c==d+a||c==b+d||d==a+b||d==b+c||d==a+c)\n {\n printf(\"SEGMENT\");\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int num,i,j,k,temp;\n int a[4];\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<4;i++){\n for(j=i;j<4;j++){\n if(a[j]<a[i]){\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n if(a[0]+a[1]>a[2]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(a[0]+a[1]==a[2]||a[0]+a[2]==a[3]||a[1]+a[2]==a[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n}"}, {"source_code": "#include <stdio.h>#include <stdlib.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if (((a<b+c) && (b<a+c) && (c<a+b)) || ((a<c+d) && (c<a+d) && (d<a+c))\n || ((b<c+d) && (c<d+b) && (d<b+c)) || ((a<b+d) && (b<a+d) && (d<a+b)))\n {printf(\"TRIANGLE\");}\n else if ((a==b+c) || (b==a+c) || (c==a+b) || (a==c+d) || (c==a+d) | (d==a+c)\n || (b==c+d) || (c==d+b) || (d==b+c) || (a==b+d) || (b==a+d) || (d==a+b))\n {printf(\"SEGMENT\");}\n else {printf(\"IMPOSSIBLE\");}\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint s=0,p=0;\nint sum(int a,int b,int c)\n{\n if(a+b>c && b+c>a && a+c>b)\n {\n s=1;\n return 0;\n }\n if(a+b>=c&&b+c>=a &&c+a>=b)\n {\n p=1;\n return 0;\n }\n return 0;\n}\n\n\nint main(){\n int a[4],i,j,k;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n for(i=0;i<4;i++)\n {\n for(j=0;j<4;j++)\n {\n for(k=0;k<4;k++)\n {\n if(a[k]+a[j]>=a[i]&&j!=i&&k!=i&&j!=k)\n sum(a[i],a[j],a[k]);\n }\n }\n }\nif(s==1){\n printf(\"TRIANGLE\\n\");\n return 0;\n}\nelse if(p==1){\n printf(\"SEGMENT\\n\");\n return 0;\n}\nprintf(\"IMPOSSIBLE\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <conio.h>\n#include <math.h>\nint kiemtra(int x, int y,int z)\n{\n\tif (x+y>z && x+z>y && z+y>x)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint bang(int x1, int y1, int z1)\n{\n\tif (x1+y1==z1 || x1+z1==y1 || z1+y1==x1)\n\t{\n\treturn 1;\n\t}\n\treturn 0;\n}\nint main()\n{\n\tint a,b,c,d;\n\tscanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\tif (kiemtra(a,b,c) || kiemtra(a,b,d) || kiemtra(d,b,c) || kiemtra(a,d,c) ) \n\t{\n\t printf(\"TRIANGLE\"); \n\t return 0;\n\t}\n if (bang(a,b,c) || bang(a,b,d) || bang(d,b,c) || bang(a,d,c) ) \n\t{\n\t printf(\"SEGMENT\"); \n\t return 0;\n\t}\n\telse printf(\"IMPOSSIBLE\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],i,j,b;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<3;i++){\n for(j=i+1;j<4;j++)\n if(a[i]>a[j]){\n b=a[i];\n a[i]=a[j];\n a[j]=b;\n }\n }\n if(a[0]+a[1]>a[3]||a[1]+a[0]>a[2]||a[2]+a[1]>a[3])\n printf(\"TRIANGLE\");\n else if(a[0]+a[1]==a[3]||a[1]+a[0]==a[2]||a[2]+a[1]==a[3])\n printf(\"SEGMENT\");\n\n else{\n printf(\"IMPOSSIBLE\");\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,b,c,d,f=-1;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b>c&&b+c>a&&a+c>b)\n f=1;\n else if(a+b>d&&a+d>b&&b+d>a)\n f=1;\n else if(a+c>d&&a+d>c&&c+d>a)\n f=1;\n else if(b+d>c&&b+c>d&&c+d>b)\n f=1;\n else if(a+b==c||b+c==a||a+c==b)\n f=0;\n else if(a+b==d||a+d==b||b+d==a)\n f=0;\n else if(a+c==d||a+d==c||c+d==a)\n f=0;\n else if(b+d==c||b+c==d||c+d==b)\n f=0;\n if(f==0)\n printf(\"%s\",\"SEGMENT\");\n else if(f==1)\n printf(\"%s\",\"TRIANGLE\");\n else\n printf(\"%s\",\"IMPOSSIBLE\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j, str[4], temp;\n for(i=0; i<4; i++)\n scanf(\"%d\", &str[i]);\n\n for(i=0; i<4-1; i++){\n for(j=0; j<4-1; j++){\n if(str[j] > str[j+1]){\n temp = str[j];\n str[j] = str[j+1];\n str[j+1] = temp;\n }\n }\n }\n\n if(str[0] + str[1] > str[2] || str[1] + str[2] > str[3])\n printf(\"TRIANGLE\");\n else if(str[0] + str[1] == str[2] || str[1] + str[2] == str[3])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\n int v[4];\n scanf(\"%d %d %d %d\", &v[0], &v[1], &v[2], &v[3]);\n\n for(int i=0;i<4;i++)\n for(int j=0;j<3-i;j++)\n if(v[j]>v[j+1])\n {\n int aux=v[j];\n v[j]=v[j+1];\n v[j+1]=aux;\n }\n\n if(v[0]+v[1]>v[2] || v[1]+v[2]>v[3]) printf(\"TRIANGLE\"); else\n if(v[0]+v[1]==v[2] || v[1]+v[2]==v[3]) printf(\"SEGMENT\"); else printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\nint largest(int x, int y, int z)\n{\n int c = 0;\n if(x>y && x> z)\n {\n c=x;\n }\n if(y>x && y> z)\n {\n c=y;\n }\n if(z>y && z> x)\n {\n c=z;\n }\n return c;\n}\nint main()\n{\n int p, q, r, s, t,m, n , o;\n scanf(\"%d %d %d %d\", &p, &q, &r, &s);\nt=largest(p,q,r);\nm=largest(p,q,s);\nn=largest(p,r,s);\no=largest(q,r,s);\nif(t<((p+q+r)-t) || m<((p+q+s)-m) || n<((p+r+s)-n) || o<((r+q+s)-o))\n{\n printf(\"TRINGLE\");\n}\nelse if (t==(p+q+r-t) || n==(p+r+s-n) || m==(p+q+s-m) || o==(r+q+s-o ))\n{\n\n printf(\"SEGMENT\");\n}\nelse\n {\n printf(\"IMPOSSIBLE\");\n}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n\n\nint main()\n{\n\tfreopen(\"input.txt\",\"r\",stdin);\n\tfreopen(\"output.txt\",\"w\",stdout);\n\t\n\tlong int m[4], i, k, min_i, c;\n\t\n\tfor (i=0;i<4;i++)\n\t{\n\t\tscanf(\"%li\", &m[i]);\n\t}\n\t\n\tfor (i=0;i<4-1;i++)\n\t{\n\t\tmin_i=i;\n\t\t\n\t\tfor (k=i;k<4;k++)\n\t\t{\n\t\t\tif (m[k]<m[min_i])\n\t\t\t{\n\t\t\t\tmin_i=k;\n\t\t\t}\n\t\t}\n\t\t\n\t\tc=m[min_i];\n\t\tm[min_i]=m[i];\n\t\tm[i]=c;\n\t}\n\t/*\n\tfor (i=0;i<4;i++)\n\t{\n\t\tprintf(\"%li\", m[i]);\n\t}\n\t*/\n\t\n\tif ( (m[0]+m[1]>m[3]) || (m[1]+m[2]>m[3]) || (m[0]+m[1]>m[2]) )\n\t{\n\t\tprintf(\"TRIANGLE\");\n\t}\n\t\n\telse\n\t{\n\t\tif ( (m[0]+m[1]==m[3]) || (m[2]+m[3]==m[3]) || (m[0]+m[1]==m[2]) || (m[0]+m[2]==m[3]) )\n\t\t{\n\t\t\tprintf(\"SEGMENT\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"IMPOSSIBLE\");\n\t\t}\n\t\t\n\t}\n\t \n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int C[4], i, a, j, m, n, l;\n for(i=0;i<4;i++){\n scanf(\"%d\", &C[i]);\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(C[i]<C[j]){\n a=C[i];\n C[i]=C[j];\n C[j]=a;\n }\n }\n }\n m=C[1]+C[2];\n n=C[2]+C[3];\n l=C[1]+C[3];\n if(C[0]<C[1]+C[2] || C[0]<C[2]+C[3] || C[0]<C[1]+C[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]<m+n || C[0]<n+l || C[0]<m+l){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint a[5], p, x, i, j;\n\tfor (i=0; i<4; i++)\n\t{\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\tx=a[0];\n\tfor (i=3; i>0; i--)\n\t{\n\t\tfor (j=0; j<i; j++)\n\t\t{\n\t\t\tif (a[i]<a[j])\n\t\t\t{\n\t\t\t\tp=a[i];\n\t\t\t\ta[i]=a[j];\n\t\t\t\ta[j]=p;\n\t\t\t}\n\t\t}\n\t}\n\tif (((a[0]+a[1])>a[2]) || ((a[1]+a[2])>a[3]))\n\t{\n\t\tprintf(\"TRIANGLE\\n\");\n\t}\n\telse if ((x==a[3]) && ((a[0]+a[1])==a[2]))\n\t{\n\t\tprintf(\"SEGMENT\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#import <stdio.h>\n\nint checkTriangle(int num1, int num2, int num3)\n{\n if ((num1 + num2 > num3) && (num2 +num3 > num1) && (num1 + num3 > num2))\n {\n return 1;\n }\n return 0;\n}\n\nint checkSegment(int num1, int num2, int num3)\n{\n if ((num1 + num2 == num3) || (num2 +num3 == num1) || (num1 + num3 == num2))\n {\n return 1;\n }\n return 0;\n}\nint main()\n{\n int num[4];\n \n for (int i = 0; i < 4; i++)\n {\n scanf(\"%d\", &num[i]);\n }\n \n int t = 0;\n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else \n {\n a = i +1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else \n {\n b = b + 1;\n }\n t = checkTriangle(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n }\n \n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else \n {\n a = i +1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else \n {\n b = b + 1;\n }\n t = checkSegment(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,max,ma;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a>b&&a>c&&a>d)\n max=a;\n else if(b>a&&b>c&&b>d)\n max=b;\n else if(c>a&&c>b&&c>d)\n max=c;\n else\n max=d;\n if(max==a)\n if( max<(b+c)||max<(b+d)||max<(c+d))\n\n\n {\n if(b<(c+d)||c<(b+d)||d<(b+c))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n\n printf(\"TRIANGLE\");\n return 0;\n }\n if(max==b)\n if( max<(a+c)||max<(a+d)||max<(c+d))\n {\n if(b<(c+d)||c<(b+d)||d<(b+c))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n printf(\"TRIANGLE\");\n return 0;\n }\n if(max==c)\n if(max<(a+b)||max<(a+d)||max<(b+d))\n {\n if(b<(c+d)||c<(b+d)||d<(b+c))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n printf(\"TRIANGLE\");\n return 0;\n }\n if(max==d)\n if(max<(a+b)||max<(a+c)||max<(b+c))\n {\n\n\n if(b<(c+d)||c<(b+d)||d<(b+c))\n {\n printf(\"SEGMENT\");\n return 0;\n }\n printf(\"TRIANGLE\");\n return 0;\n }\n printf(\"IMPOSSIBLE\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, sum, temp, len[4], x=0;\n\n for(i=0;i<4;i++)\n {\n scanf(\"%d\", &len[i]);\n }\n for(i=0;i<4;i++)\n {\n for(j=i+1;j<4;j++)\n {\n if(len[i]>len[j])\n {\n temp=len[j];\n len[j]=len[i];\n len[i]=temp;\n }\n }\n }\n /*for(i=0;i<4;i++)\n {\n printf(\"%d\\n\", len[i]);\n }*/\n\n sum=len[0]+len[1];\n if(sum<len[2])\n {\n x=0;\n }\n if(sum==len[2])\n {\n x=1;\n }\n if(sum>len[2])\n {\n x=2;\n }\n //printf(\"x=%d\\n\", x);\n if(x<2)\n {\n sum=len[1]+len[2];\n if(sum>len[3])\n {\n x=2;\n }\n }\n\n if(x==0)\n {\n printf(\"IMPOSSIBLE\\n\");\n }\n if(x==1)\n {\n printf(\"SEGMENT\\n\");\n }\n if(x==2)\n {\n printf(\"TRIANGLE\\n\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n long long int yo(const void* a,const void* b)\n{\n return (*(long long int*)a-*(long long int*)b);\n\n}\nint main()\n{\n int ch[50000],cp[500000];\n char kh[1000000],arr[1000000];\n long long int a=0,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;\n for(i=0; i<4; i++)\n scanf(\"%lld\",&ch[i]);\n \n qsort(ch,4,sizeof(int),yo);\n \n if(ch[2]+ch[1]>ch[3])\n printf(\"TRIANGLE\");\n else if(ch[2]+ch[1]<ch[3] && ch[0]+ch[1]==ch[2])\n printf(\"SEGMENT\\n\");\n else \n printf(\"IMPOSSIBLE\\n\");\n /* for(i=1; j<c; i++)\n {\n j=a+(i*b);\n if(j==c || j+1==c)\n {\n k=1;\n break;\n }\n k=0;\n }*/\n\n // printf(\"%f\\n\",x*b);\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint check(int a, int b, int c)\n{\n\tint ok1 = 0; int ok2 = 0; int ok3 = 0;\n\tif (a + b > c)\n\t\tok1 = 1;\n\tif (b + c > a)\n\t\tok2 = 1;\n\tif (a + c > b)\n\t\tok3 = 1;\n\t\n\tif (ok1 == 1 && ok2 == 1 && ok3 == 1) {\n\t\treturn 1;\n\t} else {\n\t\treturn 0;\n\t}\n}\n\nint check_deg(int a, int b, int c)\n{\n\tif (a + b == c)\n\t\treturn 1;\n\tif (b + c == a)\n\t\treturn 1;\n\tif (a + c == b)\n\t\treturn 1;\n\t\n\treturn 0;\n}\n\nint main(void)\n{\n\tint a; int b; int c; int d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\t\n\tif (check(a, b, c) || check(a, b, d) || check(b, c, d)) {\n\t\tprintf(\"TRIANGLE\\n\");\n\t} else if (check_deg(a, b, c) || check_deg(a, b, d) || check_deg(b, c, d)) {\n\t\tprintf(\"SEGMENT\\n\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[4];\n for(int i=0;i<4;i++)\n scanf(\"%d\",&ara[i]);\n for(int i=0;i<4;i++)\n {\n for(int j=0;j<3-i;j++)\n if(ara[j]>=ara[j+1])\n {\n int temp=ara[j];\n ara[j]=ara[j+1];\n ara[j+1]=temp;\n\n }}\nif((ara[0]+ara[1]==ara[2])||(ara[0]+ara[1]==ara[3])||(ara[1]+ara[2]==ara[3])||(ara[0]+ara[2]==ara[3]))\n printf(\"SEGMENT\");\nelse if((ara[0]+ara[1]>ara[2])||(ara[0]+ara[1]>ara[3])||(ara[1]+ara[2]>ara[3])||(ara[0]+ara[2]>ara[3]))\n printf(\"TRIANGLE\");\n else printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\nint i,j,a,n=4,k;\nint A[n];\nfor(i=1;i<=4;i++){\n scanf(\"%d\",&A[i]);\n}\nfor(i=1;i<=4;i++){\n for(j=i+1;j<=4;j++){\n if (A[i]<A[j]){\n a=A[i];\n A[i]=A[j];\n A[j]=a;\n }\n }\n}\n//printf(\"\\n%d\\n\",j);\nfor(i=1;i<=2;i++){\n for(j=i+1;j<=3;j++){\n for(k=1;k<=4-j;k++){\n if (A[j]+A[j+k]>A[i]){\n a=1;\n break;\n }\n else if(A[j]+A[j+k]==A[i]){\n a=2;\n break;\n }\n\n }\n if (a==1||a==2)\n break;\n }\n // printf(\"%d\",A[i]);\n if(a==1||a==2)\n break;\n}\nif (a==1)\n printf(\"TRIANGLE\");\nelse if (a==2)\n printf(\"SEGMENT\");\nelse\n printf(\"IMPOSSIBLE\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i=0,j,k,m=0,s=0,a[4];\n\twhile(i<4)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<4;j++)\n\t\t{\n\t\t\tfor(k=0;k<4;k++)\n\t\t\t{\n\t\t\t\tif(a[i]+a[j]>a[k])\n\t\t\t\ts++;\n\t\t\t\tif(a[i]+a[j]==a[k])\n\t\t\t\tm++;\n\t\t\t}\n\t\t}\n\t}\n\tif(s>0)\n\tprintf(\"TRIANGLE\");\n\telse\n\t{\n\t\tif(m>0)\n\t\tprintf(\"SEGEMENT\");\n\t\telse\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b<c||a+c<b||b+c<a){\n printf(\"IMPOSSIBLE\");\n }\n else if(a+b==c||a+c==b||b+c==a){\n printf(\"SEGMENT\");\n }\n else{\n printf(\"TRIANGLE\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint temp[10];\t\t\t\t//Temporary array\n\nvoid mergearray(int i, int mid, int j, int *output)\n{\n\tint p=i, q=mid+1, in=0;\n\twhile((p<=mid) || (q<=j))\n\t{\n\t\tif(p>mid)\n\t\t{\n\t\t\ttemp[in]=output[q];\n\t\t\tq++;\n\t\t}\n\t\telse if(q>j)\n\t\t{\n\t\t\ttemp[in]=output[p];\n\t\t\tp++;\n\t\t}\n\t\telse if(output[p]<output[q])\t\t\t//Increasing order\n\t\t{\n\t\t\ttemp[in]=output[p];\n\t\t\tp++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttemp[in]=output[q];\n\t\t\tq++;\n\t\t}\n\t\tin++;\n\t}\n\twhile(--in>=0)\n\t\toutput[i+in]=temp[in];\n\treturn;\n}\n\nvoid mergesort(int i, int j, int *output)\n{\n\tif(i==j) return;\n\n\tint mid=(i+j)/2;\n\tmergesort(i, mid, output);\n\tmergesort(mid+1, j, output);\n\tmergearray(i, mid, j, output);\n}\n\n\nint main()\n{\n\tint arr[4], i, j, k, flag=0;\n\tfor(i=0; i<4; i++)\n\t\tscanf(\"%d\", &arr[i]);\n\tmergesort(0, 3, arr);\n\tfor(i=0; i<4; i++)\n\t{\n\t\tfor(j=0; j<4; j++)\n\t\t{\n\t\t\tif(j==i) continue;\n\t\t\tfor(k=0; k<4; k++)\n\t\t\t{\n\t\t\t\tif(k==j || k==i) continue;\n\t\t\t\tif(arr[i]+arr[j]>arr[k] && arr[i]+arr[k]>arr[j] && arr[j]+arr[k]>arr[i])\n\t\t\t\t{\n\t\t\t\t\tflag=1;\n\t\t\t\t\tprintf(\"TRIANGLE: %d %d %d\\n\", arr[i], arr[j], arr[k]); break;\n\t\t\t\t}\n\t\t\t\telse if(arr[i]+arr[j]==arr[k])\n\t\t\t\t{\n\t\t\t\t\tflag=2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(flag==1) break;\n\t\t}\n\t\tif(flag==1) break;\n\t}\n\tif(flag==0)\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\telse if(flag==2)\n\t\tprintf(\"SEGMENT\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint a[10], n=4, i, j, m;\n\nint main()\n{\n scanf(\"%d %d %d %d\", &a[1], &a[2], &a[3], &a[4]);\n for (j=1; j<n; j++)\n for (i=1; i<n; i++)\n if(a[i+1]<a[i])\n {\n m = a[i];\n a[i] = a[i+1];\n a[i+1] = m;\n }\n printf(\"%d %d %d %d\", a[1], a[2], a[3], a[4]);\n if (a[1]+a[2]>a[3] || a[2]+a[3]>a[4])\n printf(\"TRIANGLE\");\n else\n if (a[1]+a[2]==a[3] || a[2]+a[3]==a[4])\n printf(\"SEGMENT\");\n else\n if (a[1]+a[2]<a[3] || a[2]+a[3]<a[4])\n printf(\"IMPOSSIBLE\");\n else\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a[4];\n\twhile(scanf(\"%d\",&a[0])!=EOF)\n\t{\n\tint i;\n\tfor(i=1;i<4;i++) scanf(\"%d\",&a[i]);\n\t\n\tint k,t;\n\tfor(i=1;i<4;i++)\n\t for(k=0;k<3;k++)\n\t {\n\t \t if(a[k]<a[k+1])\n\t \t {\n\t \t t=a[k];\n\t\t\t\ta[k]=a[k+1];\n\t\t\t\ta[k+1]=t;\t\n\t\t }\n\t }\n\t if(a[0]<a[1]+a[2]) printf(\"TRIANGLE\\n\");\n\t else if(a[0]<a[1]+a[2]+a[3]) printf(\"SEGMENT\\n\");\n\t else if(a[0]>=a[1]+a[2]+a[3]) printf(\"IMPOSSIBLE\\n\");\n\t \n}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],i,j,k,p,c=0;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n p=a[3]-a[2];\n if(a[2]-a[1]==p&&a[1]-a[0]==p)\n c=1;\n else{\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n for(k=0;k<4;k++){\n if(k!=i&&k!=j){\n if(a[i]+a[j]>a[k]){\n if(a[j]+a[k]>a[i]){\n if(a[i]+a[k]>a[j])\n c=1;\n break;}}\n else if(a[i]+a[j]==a[k]){\n c=2;\n break;}\n }\n if(c>0)\n break;\n }\n if(c>0)\n break;\n }\n if(c>0)\n break;\n }\n }\n if(c==1)\n printf(\"TRIANGLE\\n\");\n else if(c==2)\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\n\nint main()\n{ int a[4];\n int sum = 0;\n for (int i=0;i<4;i++){\n scanf(\"%d\", &a[i]);\n sum+=a[i];\n }\n int temp;\n temp = sum;\n int bol=0;\n int bol1=0;\n int seg = 0;\n for (int i=0;i<4;i++){\n temp=temp-a[i];\n for (int j=0;j<4;j++){\n if (a[i]!= a[j]){\n \n temp=temp-a[j];\n \n if (a[j]<temp) {\n bol++;\n }\n \n else if (a[j]==temp) {\n \n bol1=1;\n \n }\n temp=temp+a[j];\n }\n \n \n }\n temp=temp+a[i];\n if(bol==3) {printf(\"TRIANGLE\");break;};\n bol=0;\n \n \n}\nif (bol1==1 && bol!=3) {printf(\"SEGMENT\");};\nif ( bol1==bol) printf(\"IMPOSSIBLE\");\n}"}, {"source_code": "#import <stdio.h>\n\nint checkTriangle(int num1, int num2, int num3)\n{\n if ((num1 + num2 > num3) && (num2 +num3 > num1) && (num1 + num3 > num2))\n {\n return 1;\n }\n return 0;\n}\n\nint checkSegment(int num1, int num2, int num3)\n{\n if ((num1 + num2 == num3) || (num2 +num3 == num1) || (num1 + num3 == num2))\n {\n return 1;\n }\n return 0;\n}\nint main()\n{\n int num[4];\n \n for (int i = 0; i < 4; i++)\n {\n scanf(\"%d\", &num[i]);\n }\n \n int t = 0;\n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else \n {\n a = i +1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else \n {\n b = b + 1;\n }\n t = checkTriangle(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n }\n \n for (int i = 0; i < 4; i ++)\n {\n int a = 0;\n int b = 0;\n if (i + 1 == 4)\n {\n a = 0;\n }\n else \n {\n a = i +1;\n }\n if (a + 1 == 4)\n {\n b = 0;\n }\n else \n {\n b = b + 1;\n }\n t = checkSegment(num[i], num[a], num[b]);\n if (t == 1)\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tint length[4];\n\tunsigned int i=0,j=0,min=0,sum=0;\n\tfor(;i<4;i++)\n\tscanf(\"%d\",&length[i]);\n for(i=0;i<4;i++)\n\t{\n\t for(j=0;j<4;j++)\n\t {\n if(length[j]<length[i])\n\t length[i]=length[j];\t\n\t } \n\t}\n\tif(length[0]+length[1]>length[3]||length[0]+length[1]>length[2]||length[1]+length[2]>length[3])\n\t printf(\"TRIANGLE\");\n\telse\n\t if(length[0]+length[1]==length[3]||length[0]+length[1]==length[2]||length[1]+length[2]==length[3])\n\t printf(\"SEGMENT\");\n\t else\n\t printf(\"IMPOSSIBLE\");\t \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nlong long a1[4][2]= {0},a2[4][2]= {0},b[3]= {0},flag;\nlong long sss1(long long x,long long y,long long z) {\n\tif(abs(x-y)>=z)return 0;\n\tif(abs(x-z)>=y)return 0;\n\tif(abs(y-z)>=x)return 0;\n\treturn 1;\n}\nlong long sss2(long long x,long long y,long long z) {\n\tif(abs(x-y)>z)return 0;\n\tif(abs(x-z)>y)return 0;\n\tif(abs(y-z)>x)return 0;\n\treturn 1;\n}\nvoid dfs1(long long step) {\n\tif(step==3) {\n\n\t\tif(sss1(b[0],b[1],b[2]))flag=1;\n\t\treturn;\n\t}\n\tlong long i;\n\tfor(i=0; i<4; i++) {\n\t\tif(a1[i][1])continue;\n\t\tb[step]=a1[i][0];\n\t\ta1[i][1]=1;\n\t\tdfs1(step+1);\n\t\ta1[i][1]=0;\n\t\tif(flag)return;\n\t}\n\treturn;\n}\nvoid dfs2(long long step) {\n\tif(step==3) {\n\t\tprintf(\"%lld %lld %lld\\n\",b[0],b[1],b[2]);\n\t\tif(sss2(b[0],b[1],b[2]))flag=1;\n\t\treturn;\n\t}\n\tlong long i;\n\tfor(i=0; i<4; i++) {\n\t\tif(a2[i][1])continue;\n\t\tb[step]=a2[i][0];\n\t\ta2[i][1]=1;\n\t\tdfs2(step+1);\n\t\ta2[i][1]=0;\n\t\tif(flag)return;\n\t}\n\treturn;\n}\nint main() {\n\twhile(scanf(\"%lld%lld%lld%lld\",&a1[0][0],&a1[1][0],&a1[2][0],&a1[3][0])!=EOF) {\n\t\tfor(long long i=0; i<4; i++)\n\t\t\ta2[i][0]=a1[i][0];\n\t\tflag=0;\n\t\tdfs1(0);\n\t\tif(flag)printf(\"TRIANGLE\\n\");\n\t\telse {\n\t\t\tmemset(b,0,sizeof(b));\n\t\t\tflag=0;\n\t\t\tdfs2(0);\n\t\t\tif(flag)printf(\"SEGMENT\\n\");\n\t\t\telse printf(\"IMPOSSIBLE\\n\");\n\t\t}\n\t\tmemset(a1,0,sizeof(a1));\n\t\tmemset(b,0,sizeof(b));\n\t\tmemset(a2,0,sizeof(a2));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[4];\n for(int i=0;i<4;i++)\n scanf(\"%d\",&ara[i]);\n for(int i=1;i<3;i++)\n {\n for(int j=0;j<3-i;j++)\n if(ara[j]>=ara[j+1])\n {\n int temp=ara[j+1];\n ara[j+1]=ara[j];\n ara[j]=temp;\n\n }}\nif(ara[3]>=ara[0]+ara[1]+ara[2])\n printf(\"IMPOSSIBLE\");\nelse {\n if((ara[0]+ara[1]>ara[2])||(ara[0]+ara[1]>ara[3])||(ara[1]+ara[2]>ara[3])||(ara[0]+ara[2]>ara[3]))\n printf(\"TRIANGLE\");\n else printf(\"SEGMENT\");\n}\n\n return 0;\n}\n"}, {"source_code": "#include<process.h>\n#include <stdio.h>\n\nint main ()\n{\n int num[5];\n int i, j, a, n=4;\n for (i = 0; i < n; ++i)\n scanf(\"%d\", &num[i]);\n for (i = 0; i < n; ++i)\n {for (j = i + 1; j < n; ++j)\n {if (num[i] < num[j])\n {a = num[i];num[i] = num[j];num[j] = a;}}}\n if(num[0]>num[1]+num[2] || num[0]>(num[1]+num[3]) || num[1]>num[2]+num[3] || num[0]>num[2]+num[3]){\n printf(\"TRIANGLE\");\n exit(0);\n }\n else if(num[0]==(num[1]+num[2]) || num[0]==(num[1]+num[3]) || num[1]==(num[2]+num[3]) || num[0]==(num[2]+num[3]) ){\n printf(\"SEGMENT\");\n exit(0);\n }\n else{\n printf(\"IMPOSSIBLE\");\n exit(0);}\n return 0;}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b, c, d;\n\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\n if((a+b>c && a+c>b && b+c>a) || (a+b>d && a+d>b && b+d>a) || (b+c>d && b+d>c && c+d>b))\n {\n printf(\"TRIANGLE\");\n }\n else if(a+b==c || a+b==d || a+c==b || a+c==d || a+d==b || a+d==c || b+c==a || b+c==d || b+d==a || b+d==c || c+d==a || c+d==b)\n {\n printf(\"SEGMENT\");\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x1,x2,x3,x4,c=0,e=0,k,s;\n scanf(\"%d %d %d %d\",&x1,&x2,&x3,&x4);\n if (x1 + x2 > x3)\n c++;\n if (x3 + x2 > x1)\n c++;\n if (x1 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x1 + x2 == x3)\n e++;\n if (x3 + x2 == x1)\n e++;\n if (x1 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x3)\n c++;\n if (x3 + x2 > x4)\n c++;\n if (x4 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x3)\n e++;\n if (x3 + x2 == x4)\n e++;\n if (x4 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x1 > x3)\n c++;\n if (x3 + x1 > x4)\n c++;\n if (x4 + x3 > x1)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x1 == x3)\n e++;\n if (x3 + x1 == x4)\n e++;\n if (x4 + x3 == x1)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x1)\n c++;\n if (x1 + x2 > x4)\n c++;\n if (x4 + x1 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x1)\n e++;\n if (x1 + x2 == x4)\n e++;\n if (x4 + x1 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n if((k!=-1)&&(s==-1))\n printf(\"SEGMENT\");\n if ((k!=-1)&&(s!=-1))\n printf(\"IMPOSIBLE\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint t = 0;\nint s = 0;\nint m[4];\nvoid test(int a, int b, int c) {\n\ta = m[a];\n\tb = m[b];\n\tc = m[c];\n\n\tif (a + b > c && b+c > a && c+a > b)\n\t\tt = 1;\n\telse if (a+ b == c || b+c == a || c+a ==b)\n\t\ts = 1;\n}\nint main(void) {\n\tfor (int i = 0; i < 4; i++)\n\t\tscanf(\"%d\", m+i);\n\ttest(0, 1, 2);\n\ttest(1, 2, 3);\n\ttest(2, 3, 1);\n\ttest(3, 1, 0);\n\tif (t)\n\t\tprintf(\"TRIANGLE\\n\");\n\telse if (s)\n\t\tprintf(\"SEGMENT\\n\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if((b+c>d&&c+d>b&&d+b>c)||\n (a+b>c&&a+c>b&&b+c>a)||\n (a+c>d&&c+d>a&&d+a>c)||\n (a+b>d&&b+d>a&&d+a>b))\n printf(\"TRIANGLE\");\n else if(a+b+c>d&&a+b+d>c&&b+c+d>a&&a+c+d>b)\n printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nlong long a1[4][2]= {0},a2[4][2]= {0},b[3]= {0},flag;\nlong long sss1(long long x,long long y,long long z) {\n\tif(abs(x-y)>=z)return 0;\n\tif(abs(x-z)>=y)return 0;\n\tif(abs(y-z)>=x)return 0;\n\treturn 1;\n}\nlong long sss2(long long x,long long y,long long z) {\n\tif(abs(x-y)>z)return 0;\n\tif(abs(x-z)>y)return 0;\n\tif(abs(y-z)>x)return 0;\n\treturn 1;\n}\nvoid dfs1(long long step) {\n\tif(step==3) {\n\n\t\tif(sss1(b[0],b[1],b[2]))flag=1;\n\t\treturn;\n\t}\n\tlong long i;\n\tfor(i=0; i<4; i++) {\n\t\tif(a1[i][1])continue;\n\t\tb[step]=a1[i][0];\n\t\ta1[i][1]=1;\n\t\tdfs1(step+1);\n\t\ta1[i][1]=0;\n\t\tif(flag)return;\n\t}\n\treturn;\n}\nvoid dfs2(long long step) {\n\tif(step==3) {\n\t\tprintf(\"%lld %lld %lld\\n\",b[0],b[1],b[2]);\n\t\tif(sss2(b[0],b[1],b[2]))flag=1;\n\t\treturn;\n\t}\n\tlong long i;\n\tfor(i=0; i<4; i++) {\n\t\tif(a2[i][1])continue;\n\t\tb[step]=a2[i][0];\n\t\ta2[i][1]=1;\n\t\tdfs2(step+1);\n\t\ta2[i][1]=0;\n\t\tif(flag)return;\n\t}\n\treturn;\n}\nint main() {\n\twhile(scanf(\"%lld%lld%lld%lld\",&a1[0][0],&a1[1][0],&a1[2][0],&a1[3][0])!=EOF) {\n\t\tfor(long long i=0; i<4; i++)\n\t\t\ta2[i][0]=a1[i][0];\n\t\tflag=0;\n\t\tdfs1(0);\n\t\tif(flag)printf(\"TRIANGLE\\n\");\n\t\telse {\n\t\t\tmemset(b,0,sizeof(b));\n\t\t\tflag=0;\n\t\t\tdfs2(0);\n\t\t\tif(flag)printf(\"SEGMENT\\n\");\n\t\t\telse printf(\"IMPOSSIBLE\\n\");\n\t\t}\n\t\tmemset(a1,0,sizeof(a1));\n\t\tmemset(b,0,sizeof(b));\n\t\tmemset(a2,0,sizeof(a2));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return *(int *)a - *(int *)b;\n}\nint main()\n{\n int a[4];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),cmp);\n if(a[0]+a[1]>a[2]||a[0]+a[1]>a[3]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3])\n printf(\"TRIANGLE\");\n else if(a[0]+a[1]+a[2]>a[3])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<ctype.h>\n#include<limits.h>\n#include<math.h>\n#include<stdbool.h>\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n#define TEST1(x, y, z) (x + y > z && abs(x - y) < z)\n#define TEST2(x, y, z) (x + y == z || x + z == y || y + z == x)\nint main(void)\n{\n int a, b, c, d;\n\n scanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\n if(TEST1(a, b, c) || TEST1(a, b, d) || TEST1(b, c, d))\n printf(\"TRIANGLE\");\n else if(TEST2(a, b, c) || TEST2(a, b, d) || TEST2(b, c, d))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main () { float a,b,c,d,s1,s2,s3,s4,a1,a2,a3,a4;\nscanf(\"%f %f %f %f\",&a,&b,&c,&d);\ns1=(a+b+c)/2;\ns2=(a+c+d)/2;\ns3=(a+b+d)/2;\ns4=(b+c+d)/2;\na1=s1*(s1-a)*(s1-b)*(s1-c);\na2=s2*(s2-a)*(s2-c)*(s2-d);\na3=s3*(s3-a)*(s3-b)*(s3-d);\na4=s4*(s4-b)*(s4-c)*(s4-d);\nif (a1 ==0 && a2 ==0) {if (a3 == 0 && a4 == 0){ printf(\"SEGMENT\");}}\n else if (a1 >= 0 || a2 >=0) {if (a3 >=0 || a4 >= 0) {printf(\"TRIANGLE\");} }\n else {printf(\"IMPOSSIBLE\");}}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n int a[4],i,j,k,m,x,y;\n m=0;\n x=0;\n y=0;\n for(i=0; i<4; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0; i<4; i++)\n {\n for(j=0; j<4 && j!=i; j++)\n {\n for(k=0; k<4 && k!=i && k!=j; k++)\n {\n if(a[i]<a[j]+a[k] && a[j]<a[i]+a[k] && a[k]<a[i]+a[j])\n m=1;\n else if(a[i]==a[j]+a[k])\n x=1;\n else\n y=1;\n }\n }\n }\n if(m==1)\n printf(\"TRIANGLE\\n\");\n if(m!=1 && x==1)\n printf(\"SEGMENT\\n\");\n if(m!=1 && x!=1 && y==1)\n printf(\"IMPOSSIBLE\\n\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(void){\n int seg[4],i,max=0,min=101,con=0;\n for(i=0;i<4;i++){\n scanf(\"%d\",&seg[i]);\n if(seg[i]>max) max=seg[i];\n if(seg[i]<min) min=seg[i];\n }\n //printf(\"max:%d,min:%d\\n\",max,min);\n for(i=0;i<4;i++){\n if(seg[i]<max) con+=seg[i];\n else con-=seg[i];\n }\n //printf(\"con:%d\\n\",con);\n if(con<=0){\n puts(\"IMPOSSIBLE\");\n }else{\n con-=min;\n //printf(\"con=%d\\n\",con);\n if(con>0) puts(\"TRIANGLE\");\n else puts(\"SEGMENT\");\n }\n return 0;\n}\n\n \n \n \n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i, j, sum, temp, len[4], x=0;\n\n for(i=0;i<4;i++)\n {\n scanf(\"%d\", &len[i]);\n }\n for(i=0;i<4;i++)\n {\n for(j=i+1;j<4;j++)\n {\n if(len[i]>len[j])\n {\n temp=len[j];\n len[j]=len[i];\n len[i]=temp;\n }\n }\n }\n /*for(i=0;i<4;i++)\n {\n printf(\"%d\\n\", len[i]);\n }*/\n\n sum=len[0]+len[1];\n if(sum<len[2])\n {\n x=0;\n }\n if(sum==len[2])\n {\n x=1;\n }\n if(sum>len[2])\n {\n x=2;\n }\n //printf(\"x=%d\\n\", x);\n if(x<2)\n {\n sum=len[1]+len[2];\n if(sum>len[3])\n {\n x=2;\n }\n }\n\n if(x==0)\n {\n printf(\"IMPOSSIBLE\\n\");\n }\n if(x==1)\n {\n printf(\"SEGMENT\\n\");\n }\n if(x==2)\n {\n printf(\"TRIANGLE\\n\");\n }\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint a[4],x,t=0;\n\tfor(int i=0;i<4;i++)\n\t{\n\tscanf(\"%d\",&a[i]);\n }\n for(int i=0;i<4;i++)\n for(int j=0;j<4;j++)\n for(int o=0;o<4;o++)\n {\n \tif(t==0)\n \tif(a[i]!=a[j]&&a[j]!=a[o]&&a[i]!=a[o])\n \t{\n \t\tif(a[i]<=a[j]+a[o]&&a[i]>=abs(a[j]-a[o]))\n \t\t{ \n\t\t\t t=1;\n \t\t\tprintf(\"TRIANGLE\");\n \t\t\tbreak;\n\t\t\t}\n\t\t\telse if(a[i]>=a[j]+a[o]&&a[i]<=abs(a[j]-a[o]))\n \t\t{\n \t\t\tt=1;\n \t\t\tprintf(\"SEGMENT\");\n \t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tt=1;\n\t\t\t\tprintf(\"IMPOSSIBLE\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint stick[4]={0};\nint check=0;\nint tri=0;\n\nint max(int x,int y,int z){\n\treturn (x>y?x:y) > z ? (x>y?x:y):z; \n}\n\nint main(){\n\t\n\t//\u8f93\u5165 \n\tfor(int i=0;i<4;i++){\n\t\tscanf(\"%d\",&stick[i]);\n\t}\n\t\n\tfor(int i=0;i<4;i++){\n\t\tfor(int j=i+1;j<4;j++){\n\t\t\tfor(int k=j+1;k<4;k++){\n\t\t\t\tint C=stick[i]+stick[j]+stick[k];\n\t\t\t\tint maxn=max(stick[i],stick[j],stick[k]);\n\t\t\t\tint rest = C-maxn;\n\t\t\t\tif(rest>maxn) tri = 1;\n\t\t\t\telse if(rest == maxn) check = 1;\n\t\t\t\telse check = 0; \n\t\t\t} \n\t\t}\n\t} \n\t\n\tif(tri == 1) printf(\"TRIANGLE\");\n\telse if(tri!=1 && check == 1) printf(\"SEGMENT\");\n\telse if(check = 0) printf(\"IMPOSSIBLE\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a,b,c,d;\n\n\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if((a>b && a>c && a<b+c) || (a>b && a>d && a<b+d) || (a>d && a>c && a<c+d) || (b>a && b>c && b<a+c) || (b>a && b>d && b<a+d) || (b>d && b>c && b<c+d) || (c>a && c>b && c<a+b) || (c>a && c>d && c<a+d) || (c>d && c>b && c<b+d) || (d>a && d>b && d<a+b) || (d>a && d>c && d<a+c) || (d>c && d>b && d<b+c))\n printf(\"TRIANGLE\");\n else if((a==b+c) || (a==b+d) || (a==c+d) || (b==a+c) || (b==a+d) || (b==c+d) || (c==a+b) || (c==a+d) || (c==b+d) || (d==a+b) || (d==a+c) || (d==b+c))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],i,j,dif1,dif2,temp;\n\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n for(i=0;i<3;i++)\n {\n for(j=i+1;j<4;j++)\n {\n if(a[i]>a[j])\n {\n temp=a[j];\n a[j]=a[i];\n a[i]=temp;\n }\n }\n }\n dif1=a[1]-a[0];\n dif2=a[3]-a[2];\n\n if(dif1<dif2)\n {\n if(a[0]+a[1]>a[2]) printf(\"TRIANGLE\");\n else if(a[0]+a[1]==a[2]) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n }\n if(dif1>=dif2)\n {\n if(a[1]+a[2]>a[3]) printf(\"TRIANGLE\");\n else if(a[1]+a[2]==a[3]) printf(\"SEGMENT\");\n else printf(\"IMPOSSIBLE\");\n }\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n int a,b,c,d,p,q,r,g;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n\n if(a>=b && a>=c && a>=d) {\n g=a;\n p=b;\n q=c;\n r=d;\n }\n else if(b>=a && b>=c && b>=d) {\n g=b;\n p=a;\n q=c;\n r=d;\n }\n else if(c>=a && c>=b && c>=d) {\n g=c;\n p=a;\n q=b;\n r=d;\n }\n else {\n g=d;\n p=a;\n q=b;\n r=c;\n }\n\n\n if ((g<p+q)||(g<p+r)||(g<q+r)||(p<q+r)||(q<p+r)||(r<p+q)) {\n printf(\"TRIANGLE\\n\");\n }\n\n else if ((g==p+q)||(g==p+r)||(g==q+r)||(p==q+r)||(q==p+r)||(r==p+q)){\n printf(\"SEGMENT\\n\");\n }\n\n else {\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[5],b[5],book[5],n,flag=0,i,j;\nvoid dfs(int step)\n{\n if(step==4)\n {\n if(b[1]+b[2]>b[3]&&b[1]+b[3]>b[2]&&b[2]+b[3]>b[1])\n flag=1;\n else if(b[1]==b[2]||b[1]==b[3]||b[2]==b[3])\n flag=2;\n else\n flag=3;\n return ;\n }\n for(i=1;i<=4;i++)\n {\n if(book[i]==0)\n {\n b[step]=a[i];\n book[i]=1;\n dfs(step+1);\n if(flag==1||flag==2)\n break;\n book[i]=0;\n }\n }\n return ;\n}\nint main()\n{\n for(i=1; i<=4; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n dfs(1);\n if(flag==1)\n printf(\"TRIANGLE\");\n if(flag==2)\n printf(\"SEGMENT\");\n if(flag==3)\n printf(\"IMPOSSIBLE\");\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,j,k,flag=0;\n int a[5];\n for(i=0;i<4;i++) scanf(\"%d\",&a[i]);\n\n for(i=0;i<4;i++)\n for(j=0;j<4;j++)\n for(k=0;i!=j && j!=k && i!=k && k<4;k++)\n {\n if(a[i]+a[j]>a[k] && a[j]+a[k]>a[i] && a[k]+a[i]>a[j])\n {\n printf(\"Triangle\\n\");\n printf(\"%d %d %d\\n\",a[i],a[j],a[k]);\n return 0;\n }\n if((a[i]+a[j])==a[k]|| a[j]+a[k]==a[i] || a[i]+a[k]==a[j]) flag=1;\n }\n\n if(flag==1) printf(\"Segment\\n\");\n else printf(\"Impossible\\n\");\n return 0;\n\n\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,temp;\n char s[101];\n gets(s);\n for(i=0;i<strlen(s)-2;i+=2){\n for(j=i+2;j<strlen(s);j+=2){\n if(s[i]<s[j]){\n s[i]=temp;\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n\n if(((s[2]-47+s[4]-47)>s[0]-47)||((s[4]-47+s[6]-47)>s[2]-47)){\n printf(\"TRIANGLE\\n\");\n}\n else if((s[2]-47+s[4]-47+s[6]-47)>s[0]-47){\n printf(\"SEGMENT\\n\");\n }\n else\n printf(\"IMPOSSIBLE\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint a,b,c,d,p,p1,p2,p3;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\tp=(a+b+c)/2;\n\tp1=(d+b+c)/2;\n\tp2=(a+d+c)/2;\n\tp3=(a+b+d)/2;\n\t//Triangle\n\t\n\t\t//\u00e4\u00eb\u00ff b,c,d\n\t\t//\u00e4\u00eb\u00ff c,d,a\n\t\t//\u00e4\u00eb\u00ff d,a,b\n\tif (((a<b+c) || (b<a+c) || (c<a+b)) && ((c<a+d) || (d<c+a) || (a<c+d)) && ((b<c+d) || (c<b+d) || (d<c+b))&&((d<a+b)||(a<d+b)||(b<d+a))) { printf(\"TRIANGLE\"); \n\t\n\t//Segment\n\t} else if(((a==p)||(b==p)||(c==p))||((d==p1)||(b==p1)||(c==p1))||((a==p2)||(d==p2)||(c==p2))||((a==p3)||(b==p3)||(d==p3))) {printf(\"SEGMENT\");\n\t\n\t//Imposible\n\t}else {printf(\"IMPOSSIBLE\");}\n\t\n\treturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\nint x, y, z, t, min;\nint main()\n{\n scanf(\"%d %d %d %d\",&x,&y,&z,&t);\n int arr[] = { x, y, z, t };\n for (int j = 0; j < 4; j++) {\n for (int i = 0; i < 4; i++) {\n if(arr[i] >= arr[i + 1]) {\n min = arr[i + 1];\n arr[i + 1] = arr[i];\n arr[i] = min;\n }\n }\n }\n if (arr[0] + arr[1] < arr[2] && arr[1] + arr[2] < arr[3]) {\n printf(\"IMPOSSIBLE\");\n } \n if ((arr[0] + arr[1] == arr[2] && arr[1] + arr[2] < arr[3]) || (arr[1] + arr[2] == arr[3] && arr[0] + arr[1] < arr[2])) {\n printf(\"SEGMENT\");\n }\n if (arr[0] + arr[1] > arr[2] || arr[0] + arr[2] > arr[3] || arr[1] + arr[2] > arr[3]) {\n printf(\"TRIANGLE\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const int *a, const int *b)\n{\n return *(int*)a-*(int*)b;\n}\n\nint tri(int x, int y, int z)\n{\n if((2*(x+y+z))>(x+y+z))\n return 1;\n return 0;\n}\n\nint seg(int x, int y, int z)\n{\n if(x+y==z)\n return 1;\n return 0;\n}\nint main()\n{\n int i,a[4]={0},flagt=0,flags=0,flagi=0;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),cmp);\n /*for(i=0;i<4;i++)\n printf(\"%d \",a[i]);*/\n if(tri(a[0],a[1],a[2]) || tri(a[0],a[1],a[3]) || tri(a[0],a[2],a[3]) || tri(a[1],a[2],a[3]))\n flagt=1;\n\n else\n {\n if(seg(a[0],a[1],a[2]) || seg(a[0],a[1],a[3]) || seg(a[0],a[2],a[3]) || seg(a[1],a[2],a[3]))\n flags=1;\n\n else\n flagi=1;\n }\n if(flagt)\n printf(\"TRIANGLE\\n\");\n else if(flags)\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a[4],i=0,k,max;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n if(i==0) max=a[i];\n for(i=1;i<=3;i++){\n if(a[i]>max){\n max=a[i];\n k=i;\n }\n }\n a[0]=max;\n a[k]=a[0];\n if((a[1]+a[2]>max)||(a[2]+a[3]>max)||(a[1]+a[3]>max)){\n printf(\"TRIANGLE\");\n exit(0);\n }\n if((a[1]+a[2]==a[3])||(a[1]+a[3]==a[2])||(a[2]+a[3]==a[1])){\n printf(\"SEGMENT\");\n exit(0);\n }\n else{\n printf(\"IMPOSSIBLE\");\n exit(0);\n } \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\n/**\n *\n * @param a\n * @param b\n * @param c\n * @return -1: nemozne, 0: segment, 1: trojuholnik\n */\nint trojuholnik(int a, int b, int c) {\n if (b > c) {\n int tmp = b;\n b = c;\n c = tmp;\n }\n if (a > c) {\n int tmp = a;\n a = c;\n c = tmp;\n }\n if (a > b) {\n int tmp = a;\n a = b;\n b = tmp;\n }\n /*printf(\"%d %d %d\", a, b, c);*/\n\n if (a+b < c) {\n return -1;\n } else if (a+b == c) {\n return 0;\n } else {\n return 1;\n }\n}\n\nint main(int argc, char* argv[]) {\n int d1,d2,d3,d4, tmp;\n int result;\n printf(\"Zadaj dlzky stran\\n\");\n result = scanf(\"%d %d %d %d\", &d1, &d2, &d3, &d4);\n if (result != 4) {\n printf(\"Nespravny vstup\\n\");\n while (getchar() != '\\n') {}\n main(argc, argv);\n return 0;\n }\n if (d1 < 0) d1 = -d1;\n if (d2 < 0) d2 = -d2;\n if (d3 < 0) d3 = -d3;\n if (d4 < 0) d4 = -d4;\n /*printf(\"%d %d %d %d\", d1, d2, d3, d4);*/\n result = -1;\n tmp = trojuholnik(d1, d2, d3);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d1, d2, d4);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d2, d3, d4);\n if (tmp > result) result = tmp;\n tmp = trojuholnik(d1, d3, d4);\n if (tmp > result) result = tmp;\n if (result == 1) {\n printf(\"TROJUHELNIK\\n\");\n } else if (result == 0) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"NEMOZNE\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e=0,f=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n {\n if(a+b>c && b+c>a && c+a>b)\n e++;\n if(a+b==c || b+c==a || c+a==b)\n f++;\n if(a+b>d && b+d>a && d+a>b)\n e++;\n if(a+b==d || b+d==a || d+a==b)\n f++;\n if(d+b>c && b+c>d && c+d>b)\n e++;\n if(a+b==d || b+c==d || c+d==b)\n f++;\n if(a+d>c && d+c>a && c+a>d)\n e++;\n if(a+d==c || d+c==a || c+a==d)\n f++;\n }\n {\n if(e>0)\n printf(\"TRIANGLE\");\n if(e==0 && f>0)\n printf(\"SEGMENT\");\n if(e==0 && f==0)\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n long long int yo(const void* a,const void* b)\n{\n return (*(long long int*)a-*(long long int*)b);\n\n}\nint main()\n{\n int ch[50000],cp[500000];\n char kh[1000000],arr[1000000];\n long long int a=0,b=0,c,d,e,i=0,j=0,k=0,l=0,tep,temp,m,n,x,y;\n for(i=0; i<4; i++)\n scanf(\"%lld\",&ch[i]);\n \n qsort(ch,4,sizeof(int),yo);\n \n if(ch[2]+ch[1]>ch[3])\n printf(\"TRIANGLE\");\n else if(ch[2]+ch[1]<ch[3] && ch[0]+ch[1]==ch[2])\n printf(\"SEGMENT\\n\");\n else \n printf(\"IMPOSSIBLE\\n\");\n /* for(i=1; j<c; i++)\n {\n j=a+(i*b);\n if(j==c || j+1==c)\n {\n k=1;\n break;\n }\n k=0;\n }*/\n\n // printf(\"%f\\n\",x*b);\n\n\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint trgl(int a,int b,int c);\nvoid res(int a);\nint main(){\n int a, b, c, d,x,y=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n x=trgl(a,b,c);\n if (x>c)\n c=x;\n x=trgl(a,c,d);\n if (x>c)\n c=x;\n x=trgl(a,b,d);\n if (x>c)\n c=x;\n x=trgl(b,c,d);\n if (x>c)\n c=x;\n res(c);\n}\nint trgl(int a,int b,int c){\n int y;\n if (a+b>c && b+c>a && c+a>b)\n y=3;\n else if (a+b==c || b+c==a || a+b==c)\n y=2;\n else\n y=1;\n\n return y;\n}\nvoid res(int a){\n if (a==3)\n printf(\"TRIANGLE\");\n else if (a==2)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main()\n{\n int x1,x2,x3,x4,c=0,e=0,k,s;\n scanf(\"%d %d %d %d\",&x1,&x2,&x3,&x4);\n if (x1 + x2 > x3)\n c++;\n if (x3 + x2 > x1)\n c++;\n if (x1 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x1 + x2 == x3)\n e++;\n if (x3 + x2 == x1)\n e++;\n if (x1 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x3)\n c++;\n if (x3 + x2 > x4)\n c++;\n if (x4 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x3)\n e++;\n if (x3 + x2 == x4)\n e++;\n if (x4 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x1 > x3)\n c++;\n if (x3 + x1 > x4)\n c++;\n if (x4 + x3 > x1)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x1 == x3)\n e++;\n if (x3 + x1 == x4)\n e++;\n if (x4 + x3 == x1)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x1)\n c++;\n if (x1 + x2 > x4)\n c++;\n if (x4 + x1 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x1)\n e++;\n if (x1 + x2 == x4)\n e++;\n if (x4 + x1 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n if((k!=-1)&&(s==-1))\n printf(\"SEGMENT\\n\");\n if ((k!=-1)&&(s!=-1))\n printf(\"IMPOSIBLE\\n\");\n}"}, {"source_code": "#include <stdio.h>\n\nint check(int a, int b, int c)\n{\n\tint ok1 = 0; int ok2 = 0; int ok3 = 0;\n\tif (a + b > c)\n\t\tok1 = 1;\n\tif (b + c > a)\n\t\tok2 = 1;\n\tif (a + c > b)\n\t\tok3 = 1;\n\t\n\treturn ok1 && ok2 && ok3;\n}\n\nint check_deg(int a, int b, int c)\n{\n\tif (a + b == c)\n\t\treturn 1;\n\tif (b + c == a)\n\t\treturn 1;\n\tif (a + c == b)\n\t\treturn 1;\n\t\n\treturn 0;\n}\n\nint main(void)\n{\n\tint a; int b; int c; int d;\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\t\n\t\n\tif (check(a, b, c) || check(a, b, d) || check(b, c, d)) {\n\t\tprintf(\"TRIANGLE\\n\");\n\t} else if (check_deg(a, b, c) || check_deg(a, b, d) || check_deg(b, c, d)) {\n\t\tprintf(\"SEGMENT\\n\");\n\t} else {\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\t}\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n int a[4],max=0,i;\n for(i=0;i<4;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]>a[max])\n max=i;\n }\n int tmp=a[max];\n a[max]=a[3];\n a[3]=tmp;\n if((a[3]<a[0]+a[1]) || (a[3]<a[0]+a[2]) || (a[3]<a[2]+a[1]))\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if(a[3]==a[0]+a[1] || a[3]==a[0]+a[2] || a[3]==a[2]+a[3])\n {\n printf(\"SEGMENT\");\n return 0;\n }\n if(a[2]<a[0]+a[1] && a[1]<a[0]+a[2] && a[0]<a[2]+a[1])\n {\n printf(\"TRIANGLE\");\n return 0;\n }\n else if(a[2]==a[0]+a[1] || a[1]==a[0]+a[2] || a[0]==a[2]+a[1])\n {\n printf(\"SEGMENT\");\n return 0;\n }\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int j,a[4],temp=0,i,d;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n\n for(i=0;i<3;i++)\n {\n for(j=0;j<4;j++)\n {\n if(j!=i && j!=i+1)\n {\n if(a[i]+a[i+1]>a[j] && a[i]+a[j]>a[i+1] && a[i+1]+a[j]>a[i])\n {\n temp=0;break;\n }\n else temp=1;\n }\n }\n if(temp==0)\n break;\n }\n if(temp==0)\n printf(\"TRIANGLE\");\n\n else if (temp==1)\n {\n for(i=0;i<3;i++)\n {\n for(j=0;j<4;j++)\n {\n if(j!=i && j!=i+1)\n {\n if(a[i]+a[i+1]==a[j])\n {\n temp=0;break;\n }\n else temp=1;\n }\n }\n if(temp==0)\n break;\n }\n if(temp==0)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void){\nint i,j,a,n=4,k;\nint A[n];\nfor(i=1;i<=4;i++){\n scanf(\"%d\",&A[i]);\n}\nfor(i=1;i<=4;i++){\n for(j=i+1;j<=4;j++){\n if (A[i]<A[j]){\n a=A[i];\n A[i]=A[j];\n A[j]=a;\n }\n }\n}\nfor(i=1;i<=4;i++){\n printf(\"% d \",A[i]);\n}\n//printf(\"\\n%d\\n\",j);\nfor(i=1;i<=2;i++){\n for(j=i+1;j<=3;j++){\n for(k=1;k<=4-j;k++){\n if (A[j]+A[j+k]>A[i]){\n a=1;\n break;\n }\n else if(A[j]+A[j+k]==A[i]){\n a=2;\n\n }\n\n\n }\n if (a==1)\n break;\n }\n // printf(\"%d\",A[i]);\n if(a==1)\n break;\n}\nif (a==1)\n printf(\"TRIANGLE\");\nelse if (a==2)\n printf(\"SEGMENT\");\nelse\n printf(\"IMPOSSIBLE\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e=0,f=0;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n {\n if(a+b>c && b+c>a && c+a>b)\n e++;\n if(a+b==c || b+c==a || c+a==b)\n f++;\n if(a+b>d && b+d>a && d+a>b)\n e++;\n if(a+b==d || b+d==a || d+a==b)\n f++;\n if(d+b>c && b+c>d && c+d>b)\n e++;\n if(a+b==d || b+c==d || c+d==b)\n f++;\n if(a+d>c && d+c>a && c+a>d)\n e++;\n if(a+d==c || d+c==a || c+a==d)\n f++;\n }\n {\n if(e>0 && f>0)\n printf(\"TRIANGLE\");\n if(e==0 && f>0)\n printf(\"SEGMENT\");\n if(e==0 && f==0)\n printf(\"IMPOSSIBLE\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main()\n{\n int x1,x2,x3,x4,c=0,e=0,k,s;\n scanf(\"%d %d %d %d\",&x1,&x2,&x3,&x4);\n if (x1 + x2 > x3)\n c++;\n if (x3 + x2 > x1)\n c++;\n if (x1 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x1 + x2 == x3)\n e++;\n if (x3 + x2 == x1)\n e++;\n if (x1 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x3)\n c++;\n if (x3 + x2 > x4)\n c++;\n if (x4 + x3 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x3)\n e++;\n if (x3 + x2 == x4)\n e++;\n if (x4 + x3 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x1 > x3)\n c++;\n if (x3 + x1 > x4)\n c++;\n if (x4 + x3 > x1)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x1 == x3)\n e++;\n if (x3 + x1 == x4)\n e++;\n if (x4 + x3 == x1)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n c=0;\n if (k!=-1)\n {\n if (x4 + x2 > x1)\n c++;\n if (x1 + x2 > x4)\n c++;\n if (x4 + x1 > x2)\n c++;\n if(c==3)\n {\n printf(\"TRIANGLE\\n\");\n k=-1;\n }\n if(c==2)\n {\n if (x4 + x2 == x1)\n e++;\n if (x1 + x2 == x4)\n e++;\n if (x4 + x1 == x2)\n e++;\n if(e==1)\n {\n s=-1;\n }\n }\n }\n if((k!=-1)&&(s==-1))\n printf(\"SEGMENT\\n\");\n if ((k!=-1)&&(s!=-1))\n printf(\"IMPOSIBLE\\n\");\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int C[4], i, a, j, m=0;\n for(i=0;i<4;i++){\n scanf(\"%d\", &C[i]);\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(C[i]<C[j]){\n a=C[i];\n C[i]=C[j];\n C[j]=a;\n }\n if(C[i]==C[j]){\n m++;\n }\n }\n }\n if(C[0]<C[1]+C[2] || C[0]<C[2]+C[3] || C[0]<C[1]+C[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(m>=3){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]<C[1]+C[2]+C[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\n\n\nint main()\n{\n\tfreopen(\"input\",\"r\",stdin);\n\tfreopen(\"output\",\"w\",stdout);\n\t\n\tlong int m[4], i, k, min_i, c;\n\t\n\tfor (i=0;i<4;i++)\n\t{\n\t\tscanf(\"%li\", &m[i]);\n\t}\n\t\n\tfor (i=0;i<4-1;i++)\n\t{\n\t\tmin_i=i;\n\t\t\n\t\tfor (k=i;k<4;k++)\n\t\t{\n\t\t\tif (m[k]<m[min_i])\n\t\t\t{\n\t\t\t\tmin_i=k;\n\t\t\t}\n\t\t}\n\t\t\n\t\tc=m[min_i];\n\t\tm[min_i]=m[i];\n\t\tm[i]=c;\n\t}\n\t/*\n\tfor (i=0;i<4;i++)\n\t{\n\t\tprintf(\"%li\", m[i]);\n\t}\n\t*/\n\t\n\tif ( (m[0]+m[1]>m[3]) || (m[1]+m[2]>m[3]) || (m[0]+m[1]>m[2]) )\n\t{\n\t\tprintf(\"TRIANGLE\");\n\t}\n\t\n\telse\n\t{\n\t\tif ( (m[0]+m[1]==m[3]) || (m[2]+m[3]==m[3]) || (m[0]+m[1]==m[2]) || (m[0]+m[2]==m[3]) )\n\t\t{\n\t\t\tprintf(\"SEGMENT\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"IMPOSSIBLE\");\n\t\t}\n\t\t\n\t}\n\t \n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int number[4];\n int i, j, a;\n scanf(\"%d %d %d %d\", &number[0], &number[1], &number[2], &number[3]);\n\n for (i = 0; i < 4; ++i) {\n for (j = i + 1; j < 4; ++j) {\n if (number[i] > number[j]) {\n a = number[i];\n number[i] = number[j];\n number[j] = a;\n }\n }\n }\n int temp;\n if ((number[0] < number[1]+number[2] && number[1] < number[0]+number[2] && number[2] < number[0]+number[1]) || (number[0] < number[1]+number[4] && number[1] < number[0]+number[4] && number[4] < number[0]+number[1]) || (number[0] < number[4]+number[2] && number[4] < number[0]+number[2] && number[2] < number[0]+number[4]) || (number[4] < number[1]+number[2] && number[1] < number[4]+number[2] && number[2] < number[4]+number[1])) {\n printf(\"TRIANGLE\\n\");\n return 0;\n } else if ((number[0] == number[1]+number[2]|| number[1] == number[0]+number[2]|| number[2]== number[0]+number[1]) || (number[0] == number[1]+number[3] || number[1] == number[0]+number[3] || number[3] == number[0]+number[1]) || (number[0] == number[3]+number[2]|| number[3] == number[0]+number[2]|| number[2]== number[0]+number[3]) || (number[3] == number[1]+number[2]|| number[1] == number[3]+number[2]|| number[2]== number[3]+number[1])) {\n temp = 1;\n } \n\n if (temp) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"IMPOSSIBLE\\n\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i=0,j,k,m=0,s=0,a[4];\n\twhile(i<4)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\ti++;\n\t}\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=(i+1);j<4;j++)\n\t\t{\n\t\t\tfor(k=(j+1);k<4;k++)\n\t\t\t{\n\t\t\t\tif(a[i]+a[j]>a[k]&&(a[i]-a[j]<a[k]&&a[j]-a[i]<a[k]))\n\t\t\t \ts++;\n\t\t\t if(a[i]+a[j]==a[k])\n\t\t\t\tm++;\n\t\t\t}\n\t\t}\n\t}\n\tif(s>0)\n\tprintf(\"TRIANGLE\");\n\telse\n\t{\n\t\tif(m>0)\n\t\tprintf(\"SEGEMENT\");\n\t\telse\n\t\tprintf(\"IMPOSSIBLE\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return *(int *)a - *(int *)b;\n}\nint main()\n{\n int a[4];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),cmp);\n if(a[0]+a[1]>a[2]||a[0]+a[1]>a[3]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3])\n printf(\"TRIANGLE\");\n else if(a[0]+a[1]+a[2]>a[3])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int a,b,c,d;\n scanf(\"%d%d%d%d\",&a,&b,&b,&d);\n if((a+b>c&&b+c>a&&c+a>b) || (a+b>d&&b+d>a&&a+d>b) || (a+c>d&&c+d>a&&a+d>c)\n || (b+c>d&&c+d>b&&b+d>c))\n printf(\"TRIANGLE\\n\");\n if((a+b<c&&b+c<a&&c+a<b) || (a+b<d&&b+d<a&&a+d<b) || (a+c<d&&c+d<a&&a+d<c)\n || (b+c<d&&c+d<b&&b+d<c))\n printf(\"IMPOSSIBLE\\n\");\n if((a+b==c&&b+c==a&&c+a==b) || (a+b==d&&b+d==a&&a+d==b) || (a+c==d&&c+d==a&&a+d==c)\n || (b+c==d&&c+d==b&&b+d==c))\n printf(\"SEGMENT\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ \nint a,b,c,d;\nscanf(\"%d%d%d\",&a,&b,&c,&d);\nif((a+b)>c && (c+b)>a && (a+c)>b){printf(\"TRIANGLE\");return 0;}\nif((d+b)>c && (c+b)>d && (d+c)>b){printf(\"TRIANGLE\");return 0;}\nif((a+d)>c && (c+d)>a && (a+c)>d){printf(\"TRIANGLE\");return 0;}\nif((a+b)>d && (d+b)>a && (a+d)>b){printf(\"TRIANGLE\");return 0;}\nif((a+b)==c || (c+b)==a || (a+c)==b){printf(\"SEGMENT\");return 0;}\nif((d+b)==c || (c+b)==d || (d+c)==b){printf(\"SEGMENT\");return 0;}\nif((a+d)==c || (c+d)==a || (a+c)==d){printf(\"SEGMENT\");return 0;}\nif((a+b)==d || (d+b)==a || (a+d)==b){printf(\"SEGMENT\");return 0;}\nprintf(\"IMPOSSIIBLE\");\nreturn 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,temp;\n char s[101];\n gets(s);\n for(i=0;i<strlen(s)-2;i+=2){\n for(j=i+2;j<strlen(s);j+=2){\n if(s[i]<s[j]){\n s[i]=temp;\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n\n if(((s[2]-47+s[4]-47)>s[0]-47)||((s[4]-47+s[6]-47)>s[2]-47)){\n printf(\"TRIANGLE\\n\");\n}\n else if((s[2]-47+s[4]-47+s[6]-47)>s[0]-47){\n printf(\"SEGMENT\\n\");\n }\n else\n printf(\"IMPOSSIBLE\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if((a==b+c || b==a+c || c==a+b)|| (a==b+d || b==a+d || d==a+b)||(a==d+c || c==a+d || d==a+c)||(d==b+c||b==c+d||c==b+d))\n printf(\"SEGMENT/n\");\n else if((a<b+c && b<a+c && c<a+b)|| (a<b+d && b<a+d && d<a+b)||(a<d+c && c<a+d && d<a+c)||(d<b+c&& b<c+d||c<b+d))\n printf(\"TRIANGLE/n\");\n else \n printf(\"IMPOSSIBLE/n\");\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint compare(const void *,const void *);\n#define ll long long int \nint compare(const void *a,const void *b)\n{\n ll *num1=(ll*)a;\n ll *num2=(ll*)b;\n if((*num1)<(*num2))\n return -1;\n else\n return 1;\n}\nint main()\n{\n ll a[4],i;\n for(i=0;i<4;i++)\n scanf(\"%lld\",&a[i]);\n qsort(a,4,sizeof(ll),&compare);\n if(a[0]+a[1]>a[2] || a[1]+a[2]>a[3] || a[0]+a[2]>a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[0]+a[1]==a[2] || a[1]+a[2]==a[3] || a[0]+a[2]==a[3])\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[5],b[5],book[5],n,flag=0,flag2=0,i,j;\nvoid dfs(int step)\n{\n if(step==4)\n {\n if(b[1]+b[2]>b[3]&&b[1]+b[3]>b[2]&&b[2]+b[3]>b[1])\n {\n flag=1;flag2=1;\n return ;\n }\n if(b[1]==b[2]||b[1]==b[3]||b[2]==b[3])\n {\n flag=2;\n return ;\n }\n return ;\n }\n for(i=1;i<=4;i++)\n {\n if(book[i]==0)\n {\n b[step]=a[i];\n book[i]=1;\n dfs(step+1);\n book[i]=0;\n }\n }\n return ;\n}\nint main()\n{\n for(i=1; i<=4; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n dfs(1);\n if(flag==1&&flag2==1)\n printf(\"TRIANGLE\");\n if(flag==2)\n printf(\"SEGMENT\");\n if(flag==0)\n printf(\"IMPOSSIBLE\");\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include <string.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint a,b,c,d,p,p1,p2,p3;\n\tscanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\tp=(a+b+c)/2;\n\tp1=(d+b+c)/2;\n\tp2=(a+d+c)/2;\n\tp3=(a+b+d)/2;\n\t//Triangle\n\t\n\t\t//\u00e4\u00eb\u00ff b,c,d\n\t\t//\u00e4\u00eb\u00ff c,d,a\n\t\t//\u00e4\u00eb\u00ff d,a,b\n\tif (((a<b+c) || (b<a+c) || (c<a+b)) && ((c<a+d) || (d<c+a) || (a<c+d)) && ((b<c+d) || (c<b+d) || (d<c+b))&&((d<a+b)||(a<d+b)||(b<d+a))) { printf(\"TRIANGLE\"); \n\t\n\t//Segment\n\t} else if(((a==p)||(b==p)||(c==p))||((d==p1)||(b==p1)||(c==p1))||((a==p2)||(d==p2)||(c==p2))||((a==p3)||(b==p3)||(d==p3))) {printf(\"SEGMENT\");\n\t\n\t//Imposible\n\t}else {printf(\"IMPOSSIBLE\");}\n\t\n\treturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d;\n int A,B,C;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b>=c && a+c>=b && b+c>=a)\n { A=a;\n B=b;\n C=c;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(a+b>=d && a+d>=b && b+d>=a)\n {\n A=a;\n B=b;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(a+c>=d && a+d>=c && c+d>=a)\n {\n A=a;\n B=c;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(b+c>=d && b+d>=c && c+d>=b)\n {\n A=b;\n B=c;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n printf(\"IMPOSSIBLE\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint t = 0;\nint s = 0;\nint m[4];\nvoid test(int a, int b, int c) {\n\ta = m[a];\n\tb = m[b];\n\tc = m[c];\n\n\tif (a + b > c && b+c > a && c+a > b)\n\t\tt = 1;\n\telse if ((a+ b) == c || (b+c) == a || (c+a) ==b)\n\t\ts = 1;\n}\nint main(void) {\n\tfor (int i = 0; i < 4; i++)\n\t\tscanf(\"%d\", m+i);\n\ttest(0, 1, 2);\n\ttest(1, 2, 3);\n\ttest(2, 3, 1);\n\ttest(3, 1, 0);\n\tif (t)\n\t\tprintf(\"TRIANGLE\\n\");\n\telse if (s)\n\t\tprintf(\"SEGMENT\\n\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint a[4],i,j,k,d;\n\tfor(i=0;i<4;i++)\n\t\tscanf(\"%d\",&a[i]);\n\tfor(i=0;i<4;i++)\n\t{\n\t\tfor(j=0;j<4;j++){\n\t\t\tif(i==j)\n\t\t\t\tcontinue;\n\t\t\tfor(k=0;k<4;k++)\n\t\t\t{\n\t\t\t\tif(i==k || j==k)\n\t\t\t\t\tcontinue;\n\t\t\t\tif(a[i]<a[j]+a[k] && a[i]>abs(a[j]-a[k]))\n\t\t\t\t{\n\t\t\t\t\td=1;\n\t\t\t\t\tgoto c;\n\t\t\t\t}\n\t\t\t\telse if(a[i]==a[j]+a[k])\n\t\t\t\t\td=2;\n\n\t\t\t}\n\t\t}\n\t\t\n\t}\nc:\n\tif(d==1)\n\t\tprintf(\"TRIANGLE\");\n\telse if(d==2)\n\t\tprintf(\"SEGMENT\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\");\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmp(const void *a,const void *b)\n{\n return *(int *)a - *(int *)b;\n}\nint main()\n{\n int a[4];\n int i;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n qsort(a,4,sizeof(int),cmp);\n if(a[0]+a[1]>a[2]||a[0]+a[1]>a[3]||a[0]+a[2]>a[3]||a[1]+a[2]>a[3])\n printf(\"TRIANGLE\");\n else if(a[0]+a[1]+a[2]>a[3])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n\n if((a+b>c&&a+c>b&&b+c>a)||(a+d>c&&a+c>d&&d+c>a)||(d+b>c&&d+c>b&&b+c>d)||(a+b>d&&a+d>b&&b+d>a))\n printf(\"TRIANGLE\");\n else if((a+b==c||a+c==b||b+c==d)||(a+d==c||a+c==d||d+c==a)||(d+b==c||d+c==b||b+c==d)||(a+b==d||a+d==b||b+d==a))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,stcks[4],sum,j,f1=0,f2=0;\n\tscanf(\"%d %d %d %d\",&stcks[0],&stcks[1],&stcks[2],&stcks[3]);\n\tsum = stcks[0]+stcks[1]+stcks[2]+stcks[3];\n\n\tfor (i=0;i<4;i++)\n\t{\n\t\tint ssum = sum - stcks[i];\n\t\tfor (j=0;j<4;j++)\n\t\t{\n\t\t\tif (j==i)\n\t\t\t\tcontinue;\n\t\t\tint psum = ssum - stcks[j];\n\t\t\tif (psum>stcks[j])\n\t\t\t{\n\t\t\t\tf1++;\n\t\t\t}\n\t\t\telse if(psum==stcks[j])\n\t\t\t\tf2++;\n\t\t}\n\t\tif (f1==3)\n\t\t\tf1=1;\n\t\telse\n\t\t\tf1=0;\n\t}\n\tif (f1)\n\t{\n\t\tprintf(\"TRIANGLE\");\n\t\treturn 0;\n\t}\n\tif (f2)\n\t{\n\t\tprintf(\"SEGMENT\");\n\t\treturn 0;\n\t}\n\tprintf(\"IMPOSSIBLE\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a, b, c, d;\n\n scanf(\"%d %d %d %d\", &a, &b, &c, &d);\n\n if((a+b>c && a+c>b && b+c>a) || (a+b>d && a+d>b && b+d>a) || (b+c>d && b+d>c && c+d>b))\n {\n printf(\"TRIANGLE\");\n }\n else if(a+b==c || a+b==d || a+c==b || a+c==d || a+d==b || a+d==c || b+c==a || b+c==d || b+d==a || b+d==c || c+d==a || c+d==b)\n {\n printf(\"SEGMENT\");\n }\n else\n {\n printf(\"IMPOSSIBLE\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n int d[4],i,a,b,c,yac=0;\n for(i=0; i<4; i++)\n scanf(\"%d\",&d[i]);\n\n for(i=0; i<4; i++)\n {\n for(b=0; b<4; b++)\n {\n if(i==b) continue;\n for(c=0; c<4; c++)\n {\n if(i==b || b==c || i==c)\n continue;\n if(d[i]<d[b]+d[c] && d[i]>abs(d[b]-d[c])) { yac=1; goto o; }\n else if(d[i]==d[c]+d[b]) { yac=2; goto o; }\n }\n }\n }\n o:\n if(yac==1)\n printf(\"TRIANGLE\\n\");\n else if(yac==2)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint triangle(int a, int b, int c) {\n\treturn a + b > c && b + c > a && c + a > b;\n}\n\nint segment(int a, int b, int c, int d) {\n\treturn a + b == c || a + b == d;\n}\n\nint main() {\n\tint a, b, c, d;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &c, &d);\n\tif (triangle(a, b, c)\n\t\t\t|| triangle(b, c, d)\n\t\t\t|| triangle(c, d, a)\n\t\t\t|| triangle(d, a, b))\n\t\tprintf(\"TRIANGLE\\n\");\n\telse if (segment(a, b, c, d)\n\t\t\t|| segment(b, c, a, d)\n\t\t\t|| segment(c, d, a, b)\n\t\t\t|| segment(a, d, b, c))\n\t\tprintf(\"SEGMENT\\n\");\n\telse\n\t\tprintf(\"IMPOSSIBLE\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a[4],i=0,k,max;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n if(i==0) max=a[i];\n for(i=1;i<=3;i++){\n if(a[i]>max){\n max=a[i];\n k=i;\n }\n }\n a[0]=max;\n a[k]=a[0];\n if((a[1]+a[2]>max)||(a[2]+a[3]>max)||(a[1]+a[3]>max)){\n printf(\"TRIANGLE\");\n exit(0);\n }\n if((a[1]+a[2]==a[3])||(a[1]+a[3]==a[2])||(a[2]+a[3]==a[1])){\n printf(\"SEGMENT\");\n exit(0);\n }\n else{\n printf(\"IMPOSSIBLE\");\n exit(0);\n } \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a[4],i=0,k,max;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n if(i==0) max=a[i];\n for(i=1;i<=3;i++){\n if(a[i]>max){\n max=a[i];\n k=i;\n }\n }\n a[0]=max;\n a[k]=a[0];\n if((a[1]+a[2]>max)||(a[2]+a[3]>max)||(a[1]+a[3]>max)){\n printf(\"TRIANGLE\");\n exit(0);\n }\n if((a[1]+a[2]==a[3])||(a[1]+a[3]==a[2])||(a[2]+a[3]==a[1])){\n printf(\"SEGMENT\");\n exit(0);\n }\n else{\n printf(\"IMPOSSIBLE\");\n exit(0);\n } \n return 0;\n}"}, {"source_code": "\n#include <stdio.h>\n\nint main (void) {\n int atto[4],i,j,k,l=0,m=0,n=0;\n\n scanf(\"%d %d %d %d\", &atto[0],&atto[1],&atto[2],&atto[3]);\n\n // bubble sort\n for(i=0; i<4; i++) {\n for(j=i+1; j<4; j++) {\n if(atto[i]<atto[j]) {\n k=atto[i];\n atto[i]=atto[j];\n atto[j]=k;\n }\n }\n }\n\n for(i=0; i<2; i++) {\n if(atto[i] < atto[i+1]+atto[i+2]) l++;\n else if(atto[i] == atto[i+1]+atto[i+2]) m++;\n else n++;\n }\n\n if(l>0) printf(\"TRIANGLE\");\n else printf(\"IMPOSSIBLE\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main () {float a,b,c,d,s1,s2,s3,s4,a1,a2,a3,a4;\n scanf(\"%f %f %f %f\",&a,&b,&c,&d);\n s1=(a+b+c)/2;\n s2=(a+c+d)/2;\n s3=(a+b+d)/2;\n s4=(b+c+d)/2;\n a1=s1*(s1-a)*(s1-b)*(s1-c);\n a2=s2*(s2-a)*(s2-d)*(s2-c);\n a3=s3*(s3-a)*(s3-b)*(s3-d);\n a4=s4*(s4-b)*(s4-c)*(s4-d);\n if(a1>0 || a2 >0 ||a3>0 || a4>0) {printf(\"t\");}\n\n\n else if (a1==0 || a2==0 || a3==0 || a4==0) {printf(\"s\");}\n else {printf(\"impossible\");}}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4];int i,j,t;\n for( i=0;i<4;++i)\n scanf(\"%d\",&a[i]);\n for(i=0;i<3;++i)\n for( j=i;j<3-i;++j)\n if(a[j]>a[j+1])\n {\n t=a[j+1];a[j+1]=a[j];a[j]=t;\n }\n \n\n\n if(a[1]+a[2] > a[3]|| a[0]+a[1] > a[2])\n printf(\"TRIANGLE\");\n else if(a[1]+a[2] == a[3] || a[0]+a[1] == a[2])\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],i,j,k,p,c=0;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n p=a[3]-a[2];\n if(a[2]-a[1]==p&&a[1]-a[0]==p)\n c=1;\n\n else{\n for(i=0;i<3;i++){\n for(j=i+1;j<4;j++){\n for(k=0;k<4;k++){\n if(k!=i&&k!=j){\n\n if(a[i]+a[j]>a[k]){\n if(a[j]+a[k]>a[i]){\n if(a[i]+a[k]>a[j]){\n c=1;\n break;}}}\n\n else if(a[i]+a[j]==a[k]){\n c=2;\n break;}}\n }\n if(c>0)\n break;\n }\n if(c>0)\n break;\n }\n }\n if(c==1)\n printf(\"TRIANGLE\\n\");\n else if(c==2)\n printf(\"SEGMENT\\n\");\n else\n printf(\"IMPOSSIBLE\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, aray[5], j, temp;\n scanf(\"%d %d %d %d\", &aray[0],&aray[1], &aray[2], &aray[3] );\n for(i=1;i<=3;i++){\n j=i;\n while(j>0 && aray[j]<aray[j-1]){\n temp=aray[j];\n aray[j]=aray[j-1];\n aray[j-1]=temp;\n j--;\n }\n }\n if(aray[1]+aray[2]>aray[3]){\n printf(\"TRIANGLE\");\n return 0;\n }\n if(aray[0]+aray[1]==aray[2] || aray[0]+aray[1]==aray[3] || aray[1]+aray[2]==aray[3]){\n printf(\"SEGMENT\");\n return 0;\n }\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,b,c,d;\n int A,B,C;\n scanf(\"%d%d%d%d\",&a,&b,&c,&d);\n if(a+b>=c && a+c>=b && b+c>=a)\n { A=a;\n B=b;\n C=c;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(a+b>=d && a+d>=b && b+d>=a)\n {\n A=a;\n B=b;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(a+c>=d && a+d>=c && c+d>=a)\n {\n A=a;\n B=c;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n if(b+c>=d && b+d>=c && c+d>=b)\n {\n A=b;\n B=c;\n C=d;\n if(A==B||B==C){printf(\"SEGMENT\\n\"); return 0;}\n else {printf(\"TRIANGLE\\n\"); return 0;}\n }\n printf(\"IMPOSSIBLE\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int number[4];\n int i, j, a;\n scanf(\"%d %d %d %d\", &number[0], &number[1], &number[2], &number[3]);\n\n for (i = 0; i < 4; ++i) {\n for (j = i + 1; j < 4; ++j) {\n if (number[i] > number[j]) {\n a = number[i];\n number[i] = number[j];\n number[j] = a;\n }\n }\n }\n int temp;\n if ((number[0] < number[1]+number[2] && number[1] < number[0]+number[2] && number[2] < number[0]+number[1]) || (number[0] < number[1]+number[4] && number[1] < number[0]+number[4] && number[4] < number[0]+number[1]) || (number[0] < number[4]+number[2] && number[4] < number[0]+number[2] && number[2] < number[0]+number[4]) || (number[4] < number[1]+number[2] && number[1] < number[4]+number[2] && number[2] < number[4]+number[1])) {\n printf(\"TRIANGLE\\n\");\n return 0;\n } else if ((number[0] == number[1]+number[2]|| number[1] == number[0]+number[2]|| number[2]== number[0]+number[1]) || (number[0] == number[1]+number[3] || number[1] == number[0]+number[3] || number[3] == number[0]+number[1]) || (number[0] == number[3]+number[2]|| number[3] == number[0]+number[2]|| number[2]== number[0]+number[3]) || (number[3] == number[1]+number[2]|| number[1] == number[3]+number[2]|| number[2]== number[3]+number[1])) {\n temp = 1;\n } \n\n if (temp) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"IMPOSSIBLE\\n\");//\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint f(int a, int b, int c) {\n\tif (a + b < c || b + c < a || a + c < b) {\n\t\treturn 0;\n\t} else if (a + b == c || b + c == a || a + c == b) {\n\t\treturn 1;\n\t} else {\n\t\treturn 2;\n\t}\n}\n\nint main() {\n\tchar input[10000];\n\tscanf(\"%[^\\n]%*c\", input);\n\tchar* pch = strtok(input, \" \");\n\t\n\tint a = atoi(pch);\n\tpch = strtok(NULL, \" \");\n\tint b = atoi(pch);\n\tpch = strtok(NULL, \" \");\n\tint c = atoi(pch);\n\tpch = strtok(NULL, \" \");\n\tint d = atoi(pch);\n\tpch = strtok(NULL, \" \");\n\n\tint d1 = f(a, b, c);\n\tint d2 = f(a, b, d);\n\tint d3 = f(a, c, d);\n\tint d4 = f(b, c, d);\n\n\tif (d1 | d2 | d3 | d4 == 2) {\n\t\tprintf(\"%s\\n\", \"TRIANGLE\");\n\t} else if (d1 | d2 | d3 | d4 == 1) {\n\t\tprintf(\"%s\\n\", \"SEGMENT\");\n\t} else {\n\t\tprintf(\"%s\\n\", \"IMPOSSIBLE\");\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a[4],i=0,k,max;\n for(i=0;i<4;i++){\n scanf(\"%d\",&a[i]);\n }\n if(i==0) max=a[i];\n for(i=1;i<=3;i++){\n if(a[i]>max){\n max=a[i];\n k=i;\n }\n }\n a[0]=max;\n a[k]=a[0];\n if((a[1]+a[2]>max)||(a[2]+a[3]>max)||(a[1]+a[3]>max)){\n printf(\"TRIANGLE\");\n exit(0);\n }\n if((a[1]+a[2]==a[3])||(a[1]+a[3]==a[2])||(a[2]+a[3]==a[1])){\n printf(\"SEGMENT\");\n exit(0);\n }\n else{\n printf(\"IMPOSSIBLE\");\n exit(0);\n } \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int C[4], i, a, j, m=0;\n for(i=0;i<4;i++){\n scanf(\"%d\", &C[i]);\n }\n for(i=0;i<4;i++){\n for(j=i+1;j<4;j++){\n if(C[i]<C[j]){\n a=C[i];\n C[i]=C[j];\n C[j]=a;\n }\n if(C[i]==C[j]){\n m++;\n }\n }\n }\n if(C[0]<C[1]+C[2] || C[0]<C[2]+C[3] || C[0]<C[1]+C[3]){\n printf(\"TRIANGLE\\n\");\n }\n else if(m>=3){\n printf(\"TRIANGLE\\n\");\n }\n else if(C[0]<C[1]+C[2]+C[3]){\n printf(\"SEGMENT\\n\");\n }\n else{\n printf(\"IMPOSSIBLE\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n int d[4],i,a,b,c,yac;\n for(i=0; i<4; i++)\n scanf(\"%d\",&d[i]);\n\n for(i=0; i<4; i++)\n {\n for(b=0; b<4; b++)\n {\n if(i==b) continue;\n for(c=0; c<4; c++)\n {\n if(i==b || b==c || i==b)\n continue;\n if(d[i]<d[b]+d[c] && d[i]>abs(d[b]-d[c])) { yac=1; goto o; }\n else if(d[i]==d[c]+d[b]) { yac=2; goto o; }\n }\n }\n }\n o:\n if(yac==1)\n printf(\"TRIANGLE\\n\");\n else if(yac==2)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int number[4];\n int i, j, a;\n scanf(\"%d %d %d %d\", &number[0], &number[1], &number[2], &number[3]);\n\n for (i = 0; i < 4; ++i) {\n for (j = i + 1; j < 4; ++j) {\n if (number[i] > number[j]) {\n a = number[i];\n number[i] = number[j];\n number[j] = a;\n }\n }\n }\n int temp;\n if ((number[0] < number[1]+number[2] && number[1] < number[0]+number[2] && number[2] < number[0]+number[1]) || (number[0] < number[1]+number[4] && number[1] < number[0]+number[4] && number[4] < number[0]+number[1]) || (number[0] < number[4]+number[2] && number[4] < number[0]+number[2] && number[2] < number[0]+number[4]) || (number[4] < number[1]+number[2] && number[1] < number[4]+number[2] && number[2] < number[4]+number[1])) {\n printf(\"TRIANGLE\\n\");\n return 0;\n } else if ((number[0] == number[1]+number[2]|| number[1] == number[0]+number[2]|| number[2]== number[0]+number[1]) || (number[0] == number[1]+number[3] || number[1] == number[0]+number[3] || number[3] == number[0]+number[1]) || (number[0] == number[3]+number[2]|| number[3] == number[0]+number[2]|| number[2]== number[0]+number[3]) || (number[3] == number[1]+number[2]|| number[1] == number[3]+number[2]|| number[2]== number[3]+number[1])) {\n temp = 1;\n } \n\n if (temp) {\n printf(\"SEGMENT\\n\");\n } else {\n printf(\"IMPOSSIBLE\\n\");\n }\n return 0;\n}"}, {"source_code": "//\n// main.c\n// triangle\n//\n// Created by Anton Titkov on 26/10/2016.\n// Copyright \u00a9 2016 Anton Titkov. All rights reserved.\n//\n\n#include <stdio.h>\n\ntypedef struct Triangle {\n int sideA;\n int sideB;\n int sideC;\n} Triangle;\n\nint checkInput(int testVal) {\n if ((testVal < 1)||(testVal>100)) {\n return 0;\n }\n return 1;\n}\n\ntypedef enum TestResult {\n RET_TRIANGLE,\n RET_SEGMENT,\n RET_IMPOSSIBLE,\n} TestResult;\n\nTestResult testTriangle(Triangle testSubject) {\n \n if (((testSubject.sideA + testSubject.sideB) > testSubject.sideC) && ((testSubject.sideB + testSubject.sideC) > testSubject.sideA)&& ((testSubject.sideA + testSubject.sideC) > testSubject.sideB))\n return RET_TRIANGLE;\n \n if ((testSubject.sideA + testSubject.sideB) == testSubject.sideC)\n return RET_SEGMENT;\n\n return RET_IMPOSSIBLE;\n}\n\nint main(int argc, const char * argv[]) {\n \n int sticks = 4;\n \n int a,b,c,d;\n int testValues[sticks];\n \n if ((scanf(\"%d %d %d %d\",&a,&b,&c,&d)!=sticks)||!checkInput(a)||!checkInput(b)||!checkInput(c)||!checkInput(d)) {\n printf(\"IMPOSSIBLE\\n\");\n }\n \n testValues[0] = a;\n testValues[1] = b;\n testValues[2] = c;\n testValues[3] = d;\n \n int isTriangle = 0;\n int isSegment = 0;\n \n for (int i = 0; i < sticks; i++) {\n int value1 = testValues[i];\n for (int k = i+1; k<sticks; k++) {\n int value2 = testValues[k];\n for (int j = k+1; j<sticks; j++) {\n int value3 = testValues[j];\n \n int tmp;\n \n if (value1>value3) {\n tmp = value1;\n value1 = value3;\n value3 = tmp;\n }\n \n if (value1>value2) {\n tmp = value1;\n value1 = value2;\n value2 = tmp;\n }\n \n if (value2>value3) {\n tmp = value2;\n value2 = value3;\n value3 = tmp;\n }\n\n printf(\"combo %i %i %i\\n\",value1,value2,value3);\n\n Triangle test = (Triangle){value1,value2,value3};\n \n TestResult result = testTriangle(test);\n \n switch (result) {\n case RET_SEGMENT:\n isSegment = 1;\n break;\n case RET_TRIANGLE:\n isTriangle = 1;\n break;\n default:\n break;\n }\n }\n }\n }\n \n if (isTriangle) {\n printf(\"TRIANGLE\\n\");\n return 0;\n }\n \n if (isSegment) {\n printf(\"SEGMENT\\n\");\n return 0;\n }\n \n printf(\"IMPOSSIBLE\\n\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint stick[4]={0};\nint check=0;\nint tri=0;\n\nint max(int x,int y,int z){\n\treturn (x>y?x:y) > z ? (x>y?x:y):z; \n}\n\nint main(){\n\t\n\t//\u8f93\u5165 \n\tfor(int i=0;i<4;i++){\n\t\tscanf(\"%d\",&stick[i]);\n\t}\n\t\n\tfor(int i=0;i<4;i++){\n\t\tfor(int j=i+1;j<4;j++){\n\t\t\tfor(int k=j+1;k<4;k++){\n\t\t\t\tint C=stick[i]+stick[j]+stick[k];\n\t\t\t\tint maxn=max(stick[i],stick[j],stick[k]);\n\t\t\t\tint rest = C-maxn;\n\t\t\t\tif(rest>maxn) tri = 1;\n\t\t\t\telse if(rest == maxn) check = 1;\n\t\t\t\telse check = 0; \n\t\t\t} \n\t\t}\n\t} \n\t\n\tif(tri == 1) printf(\"TRIANGLE\");\n\telse if(tri!=1 && check == 1) printf(\"SEGMENT\");\n\telse if(check = 0) printf(\"IMPOSSIBLE\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[4],i,t;\n for(i=0;i<4;i++)\n scanf(\"%d\",&a[i]);\n\n for(i=0;i<4;i++){\n if(a[0]<a[i]){\n t=a[0];\n a[0]=a[i];\n a[i]=t;\n }\n }\n if(a[0]<a[1]+a[2])\n printf(\"TRIANGLE\\n\");\n else if(a[0]<a[1]+a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[0]<a[2]+a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[0]==a[1]&&a[1]==a[2])\n printf(\"TRIANGLE\\n\");\n else if(a[0]==a[1]&&a[1]==a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[0]==a[2]&&a[2]==a[3])\n printf(\"TRIANGLE\\n\");\n else if(a[1]==a[2]&&a[2]==a[3])\n printf(\"TRIANGLE\\n\");\n\n\n else if(a[0]+a[1]==a[2])\n printf(\"SEGMENT\\n\");\n else if(a[0]+a[1]==a[3])\n printf(\"SEGMENT\\n\");\n else if(a[0]+a[2]==a[1])\n printf(\"SEGMENT\\n\");\n else if(a[0]+a[2]==a[3])\n printf(\"SEGMENT\\n\");\n else if(a[0]+a[3]==a[1])\n printf(\"SEGMENT\\n\");\n else if(a[0]+a[3]==a[2])\n printf(\"SEGMENT\\n\");\n else if(a[1]+a[2]==a[0])\n printf(\"SEGMENT\\n\");\n else if(a[1]+a[2]==a[3])\n printf(\"SEGMENT\\n\");\n else if(a[1]+a[3]==a[0])\n printf(\"SEGMENT\\n\");\n else if(a[1]+a[3]==a[2])\n printf(\"SEGMENT\\n\");\n else if(a[2]+a[3]==a[0])\n printf(\"SEGMENT\\n\");\n else if(a[2]+a[3]==a[1])\n printf(\"SEGMENT\\n\");\n\n\n else\n printf(\"IMPOSSIBLE\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d;\n scanf(\"%d %d %d %d\",&a,&b,&c,&d);\n if(((a+b>c)&&(a+c>b)&&(b+c>a))||((a+b>d)&&(a+d>b)&&(b+d>a))||((b+c>d)&&(b+d>c)&&(c+d>b)))\n printf(\"TRIANGLE\");\n else if((a+b==c)||(a+c==b)||(b+c==a)||(a+b==d)||(a+d==b)||(b+d==a)||(b+c==d)||(b+d==c)||(c+d==b))\n {\n printf(\"SEGMENT\");\n }\n else\n printf(\"IMPOSSIBLE\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\n int d[4],i,a,b,c,yac;\n for(i=0; i<4; i++)\n scanf(\"%d\",&d[i]);\n\n for(i=0; i<4; i++)\n {\n for(b=0; b<4; b++)\n {\n if(i==b) continue;\n for(c=0; c<4; c++)\n {\n if(i==b || b==c || i==b)\n continue;\n if(d[i]<d[b]+d[c] && d[i]<abs(d[b]-d[c])) { yac=1; goto o; }\n else if(d[i]==d[c]+d[b]) { yac=2; goto o; }\n }\n }\n }\n o:\n if(yac==1)\n printf(\"TRIANGLE\\n\");\n else if(yac==2)\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint isValid(int a,int b,int c){\n if((a+b)>c&&(b+c)>a&&(a+c)>b)\n return 1;\n else\n return 0;\n}\nint main()\n{\n int n[4];\n scanf(\"%d%d%d%d\",&n[0],&n[1],&n[2],&n[3]);\n if(isValid(n[0],n[1],n[2])||isValid(n[0],n[1],n[3])||isValid(n[0],n[3],n[2])||isValid(n[3],n[1],n[2]))\n printf(\"TRIANGLE\");\n else if(isValid(n[0]+n[3],n[1],n[2])||isValid(n[0],n[1]+n[3],n[2])||isValid(n[0],n[1],n[2]+n[3])||isValid(n[0]+n[1],n[3],n[2])||isValid(n[0]+n[2],n[3],n[1])||isValid(n[2]+n[1],n[3],n[0]))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint a[5],b[5],book[5],n,flag=0,flag2=0,i,j;\nvoid dfs(int step)\n{\n if(step==4)\n {\n if(b[1]+b[2]>b[3]&&b[1]+b[3]>b[2]&&b[2]+b[3]>b[1])\n {\n flag=1;flag2=1;\n return ;\n }\n if(b[1]==b[2]||b[1]==b[3]||b[2]==b[3])\n {\n flag=2;\n return ;\n }\n return ;\n }\n for(i=1;i<=4;i++)\n {\n if(book[i]==0)\n {\n b[step]=a[i];\n book[i]=1;\n dfs(step+1);\n book[i]=0;\n }\n }\n return ;\n}\nint main()\n{\n for(i=1; i<=4; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n dfs(1);\n if(flag==1&&flag2==1)\n printf(\"TRIANGLE\");\n if(flag==2)\n printf(\"SEGMENT\");\n if(flag==0)\n printf(\"IMPOSSIBLE\");\n printf(\"\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,t,p,b,c,d;\n scanf(\"%d%d%d%d\",&p,&b,&c,&d);\n int a[4]={p,b,c,d};\n if(p>100 || b>100 || c>100 || d>100)\n printf(\"input should not exceed 100\");\n else\n {\n for(i=0;i<3;++i) {\n for(j=0;j<4-i-1;j++){\n if(a[j]>a[j+1])\n {\n t=a[j+1];\n a[j+1]=a[j];\n a[j]=t;\n }\n }\n }\n\n if((a[0]+a[1]>a[3]) || (a[0]+a[2]>a[3]) || (a[1]+a[2]>a[3]) )\n printf(\"TRIANGLE\");\n else if((a[0]+a[1]==a[3]) || (a[0]+a[2]==a[3]) || (a[1]+a[2]==a[3]) || (a[0]+a[1]==a[2]))\n printf(\"SEGMENT\");\n else\n printf(\"IMPOSSIBLE\");\n }\n\n\n}\n"}], "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a"} {"nl": {"description": "Pasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he should make it larger. Unfortunately, the only operation Pasha can do is to swap two adjacent decimal digits of the integer.Help Pasha count the maximum number he can get if he has the time to make at most k swaps.", "input_spec": "The single line contains two integers a and k (1\u2009\u2264\u2009a\u2009\u2264\u20091018;\u00a00\u2009\u2264\u2009k\u2009\u2264\u2009100).", "output_spec": "Print the maximum number that Pasha can get if he makes at most k swaps.", "sample_inputs": ["1990 1", "300 0", "1034 2", "9090000078001234 6"], "sample_outputs": ["9190", "300", "3104", "9907000008001234"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n int i, j;\n char a[20];\n int k, len;\n\n scanf(\"%s %d\", a, &k);\n len = strlen(a);\n\n for (i = 0; i < len; i++) {\n int max, maxIdx;\n\n max = 0;\n for (j = i + 1; j < len && j - i <= k; j++)\n if (max < a[j] - '0') {\n max = a[j] - '0';\n maxIdx = j;\n }\n\n if (a[i] - '0' < max) {\n for (j = maxIdx; j > i; j--)\n a[j] = a[j - 1];\n a[i] = max + '0';\n\n k -= maxIdx - i;\n }\n }\n\n printf(\"%s\\n\", a);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k,i,j,f,t,len;\n char a[20],c;\n scanf(\"%s %d\",a,&k);\n len=strlen(a);\n for(i=0;i<len-1&&k>0;i++)\n {\n c=a[i];\n t=-1;\n for(j=i+1;j<len&&j-i<=k;j++)\n {\n if(a[j]>c)\n {\n c=a[j];\n t=j;\n }\n }\n if(t>=0)\n {\n for(f=t;f>i;f--)\n a[f]=a[f-1];\n a[i]=c;\n k=k-t+i;\n }\n }\n printf(\"%s\\n\",a);\n return 0;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nvoid swap(int i);\nint check(int i);\n\nchar inp[200];\nint k,n,fixed;\n\nint main()\n{\n int i,j;\n\n while(scanf(\"%s%d\",inp,&k)!=EOF)\n {\n n=strlen(inp);\n\n\n for(i=0;i<n;i++)\n {\n fixed=i;\n\n if(k==0)\n break;\n j=check(i);\n //printf(\"%d\\n\",j);\n\n if(j!=i)\n {\n swap(j);\n // printf(\"%s\\t%d\\n\",inp,fixed);\n k-=j-i;\n }\n }\n\n printf(\"%s\\n\",inp);\n }\n\n\n return 0;\n\n}\n\nint check(int i)\n{\n int max=inp[i];\n int j;\n int ans=i;\n\n for(j=1;j<=k;j++)\n {\n if(j+i>=n)\n break;\n\n if(max<inp[j+i])\n {\n max=inp[i+j];\n ans=i+j;\n }\n }\n return ans;\n}\n\nvoid swap(int i)\n{\n int j,p;\n\n //if(i<=k)\n // j=fixed;\n\n //else\n //j=i-k;\n\n\n for(p=i;p>fixed;p--)\n {\n inp[p]=inp[p]^inp[p-1];\n inp[p-1]=inp[p]^inp[p-1];\n inp[p]=inp[p]^inp[p-1];\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid swap(int a,int b)\n{\n int t=a;\n a=b;\n b=t;\n}\nint main()\n{\n char str[20],arr[20],barr[20],index[20];\n int i,j,k,l,t;\n scanf(\"%s\",str);\n int n=strlen(str);\n for(i=0;i<n;i++)\n barr[i]=arr[i]=str[i]-'0';\n for(i=0;i<n;i++)\n index[i]=i;\n for(i=0;i<n;i++)\n {\n for(j=n-1;j>0;j--)\n if(arr[j-1]<arr[j])\n {\n t=arr[j-1];\n arr[j-1]=arr[j];\n arr[j]=t;\n t=index[j-1];\n index[j-1]=index[j];\n index[j]=t;\n }\n }\n //for(i=0;i<n;i++)\n //printf(\"%d \",index[i]);\n scanf(\"%d\",&k);\n j=0;i=0;\n while(k>0 && j<n)\n {\n\n while(index[i]!=j)\n {\n if(index[i]-j<=k && index[i]>j)\n {\n for(l=0;l<n;l++)\n if(index[l]<index[i] && index[l]>=j)\n index[l]++;\n k-=(index[i]-j);\n index[i]=j;\n break;\n }\n\n else\n i++;\n\n }\n j++;\n i=0;\n\n\n}\n//for(i=0;i<n;i++)\n //printf(\" %d\",index[i]);\nfor(i=0;i<n;i++)\n{\n for(j=1;j<n;j++)\n {\n if(index[j-1]>index[j])\n {\n t=arr[j-1];\n arr[j-1]=arr[j];\n arr[j]=t;\n t=index[j-1];\n index[j-1]=index[j];\n index[j]=t;\n }\n }\n}\nfor(i=0;i<n;i++)\n printf(\"%d\",arr[index[i]]);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nvoid swap(char a[],int i,int j)\n{\n\tint x;\n\tchar b=a[j];\n\tfor(x=j;x>i;x--)\n\t\ta[x]=a[x-1];\n\ta[i]=b;\n}\nint main(void)\n{\n\tchar a[20]={0};\n\tint k,i,j,r;\n\tchar c;\n\tscanf(\"%s %d\",a,&k);\n\tfor(i=0;i<strlen(a)&&k;i++)\n\t{\n\t\tc=a[i];\n\t\tr=i;\n\t\tfor(j=i+1;j<strlen(a);j++)\n\t\t\tif(c<a[j]&&j-i<=k)\n\t\t\tr=j,c=a[j];\n\t\tif(r!=i)\n\t\t{\n\t\t\tswap(a,i,r);\n\t\t\tk-=r-i;\n\t\t}\n\t}\n\tputs(a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define dnum 100001\n#define LL long long\n\nLL a;\nchar str[19];\n\nint main()\n{\n int n,m,i,j,k,max,start = 0,t;\n\n scanf(\"%s %d\",str,&k);\n\n i = 0;\n n = k;\n start = 0;\n while(1)\n {\n j = 0;\n max = -1;\n m = 0;\n for(i = start; i < start+n+1 && i < strlen(str); ++i)\n {\n if(max < str[i])\n {\n max = str[i];\n j = i;\n m = i-start;\n }\n }\n n = n - m;\n\n for(i = j-1; i >= start; --i)\n {\n m = str[i+1];\n str[i+1] = str[i];\n str[i] = m;\n }\n start++;\n if(start == strlen(str))break;\n if(n == 0)break;\n }\n\n\n printf(\"%s\\n\",str);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main(void) {\n int k, i,j,l, digit[10][20], cnt[10], temp, swap = 0;\n memset(cnt, 0, sizeof(cnt));\n memset(digit, -1, sizeof(digit));\n char num[20], ch;\n scanf(\"%s %d\", &num, &k);\n int len = strlen(num);\n for(i=0;i<len;i++){\n temp = num[i] - '0';\n digit[temp][cnt[temp]] = i;\n cnt[temp]++;\n }\n for(i=9;i>-1;i--){\n for(j=0;j<cnt[i];j++){\n int min = digit[i][j];\n int index = j;\n for(l=j+1; l<cnt[i]; l++){\n if(min < digit[i][l]){\n min = digit[i][l];\n index = l;\n }\n }\n int x = digit[i][j];\n digit[i][j] = digit[i][index];\n digit[i][index] = x;\n }\n }\n //printf(\"%d %d %d\\n\", digit[3][0], digit[3][1], digit[3][2] );\n for(i=0;i<len-1 && k>0;i++){\n for(j=9;j>-1;j--){\n //printf(\"CNT %d\\n\", cnt[j]);\n if(cnt[j]>0){\n //printf(\"%d\\n\", digit[j][cnt[j]-1]);\n if((digit[j][cnt[j]-1] - i) <= k){\n int m, pos = digit[j][cnt[j]-1];\n if(pos > i){\n for(l=pos;l>i;l--){\n ch = num[l-1];\n temp = ch - '0';\n for(m=0;m<cnt[temp];m++){\n if(digit[temp][m] == l-1)\n digit[temp][m]++;\n }\n num[l-1] = num[l];\n num[l] = ch;\n //printf(\"CHECK %s\", num);\n }\n k = k - (pos - i);\n //printf(\"K=%d\\n\", k);\n //printf(\"K=%s\\n\", num);\n }\n cnt[j]--;\n break;\n }\n }\n }\n }\n printf(\"%s\", num);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int m,k,count,l,i,j,temp;\n char ar[45],ch,temp1,max;\nscanf(\"%s%c%d\",&ar,&ch,&m);\nl=strlen(ar);\n\nk=m;\nfor(i=0;i<l-1;i++)\n{\n if(m>0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0 &&j<=l-1)\n{\n if(max<ar[j])\n {\n temp=j;\n max=ar[j];\n }\n k--;\n j++;\n}\n if(temp!=i)\n {\n temp1=ar[temp];\n for(j=temp;j>i;j--)\n ar[j]=ar[j-1];\n ar[i]=temp1;\n }\n m=m-(temp-i);\n }\n else\n break;\n}\nprintf(\"%s\\n\",ar);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar a[100], max;\n\nint k, n, start, i, j, place, t, count;\n\nint main () {\n\tscanf(\"%s %d\",a ,&k);\n\twhile(k > 0){\n\t\tmax = 0;\n\t\tfor(i = start ; i <= k + start ; i++)\n\t\t\tif(a[i] > max){\n\t\t\t\tmax = a[i];\n\t\t\t\tplace = i;\n\t\t\t}\n\t\tif(place == start){\n\t\t\tstart++;\n\t\t\tcontinue;\n\t\t}\n\t\tcount = 0;\n\t\tfor(i = place ; i > start ; i--){\n\t\t\tt = a[i-1];\n\t\t\ta[i-1] = a[i];\n\t\t\ta[i] = t;\n\t\t\tcount++;\n\t\t}\n\t\tk -= count;\n\t\tstart++;\n\t\t//printf(\"%d %d %s %d %d\\n\",start,place,a,max,k);\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid swap(int* x,int* y) {\n\tint tmp = *x;\n\t*x = *y;\n\t*y = tmp;\n\treturn ;\n}\nint main() {\n\tint z,i,j,k,l,n,m,max,rem,c[1000],tmp;\n\tlong long int p;\n\tscanf(\"%lld\",&p);\n\tscanf(\"%d\",&k);\n\ti = 0;\n\twhile(p != 0) {\n\t\tc[i] = p%10;\n\t\tp = p/10;\n\t\ti++;\n\t}\n\tz = i;\n\tfor(j=0;j<i/2;j++)\n\t\tswap(&c[j],&c[i-j-1]);\n\tfor(i=0;i<z;i++) {\n\t\tmax = 0;\n\t\tfor(j=i+1;j<z;j++)\n\t\t\tif(c[j] > max && j-i <= k){\n\t\t\t\tmax = c[j];\n\t\t\t\trem = j;\n\t\t\t}\n\t\tif(max > c[i])\n\t\t\tfor(j=rem-1;j>=i;j--){\n\t\t\t\tswap(&c[j],&c[j+1]);\n\t\t\t\tk--;\n\t\t\t}\n\t}\n\tfor(i=0;i<z;i++)\n\t\tprintf(\"%d\",c[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar a[20]; int k;\nvoid aa(int f, int g)\n{\n char t; int q, y;\n t = a[g - 1];\n y = g - f;\n while (y--)\n {\n a[g-1] = a[g - 2];\n g--;\n }\n a[f - 1] = t;\n}\nint bb(int h,int j)\n{\n char bell = '0'; int c,d=-1;\n c = h;\n while (j--)\n {\n if (a[h] == '\\0')\n break;\n else\n {\n if ((a[h] > a[c - 1]) && a[h] > bell)\n {\n bell =a[h];\n d = h;\n k = j;\n }\n h++;\n }\n }\n return d;\n}\nint main()\n{\n int i, j, p, max,L;\n memset(a, '\\0', sizeof(a));\n scanf(\"%s\", a);\n scanf(\"%d\", &k);\n L = strlen(a);\n for (i = 1; i < L; i++)\n {\n p = bb(i, k);\n if (p!=-1)\n aa(i,p+1);\n }\n puts(a);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,c,k,n,m,temp,z,pos,diff,max;\n\tunsigned long long num,x;\n\tlong long int a[20];\n\tscanf(\"%lld%d\",&num,&k);\n\tc=0;\n\tx=num;\n\twhile(num>0)\n\t{\n\t\t\tnum=num/10;\n\t\t\tc++;\t\n\t}\n\tfor(i=c-1;i>=0;i--)\n\t{\n\t\t\ta[i]=x%10;\n\t\t\tx=x/10;\n\t\t\t\n\t}\n\tfor(i=0;i<c;i++)\n\t{\n\t\tmax=a[i];\n\t\tdiff=0;\n\t\tpos=i;\n\t\tfor(j=i+1;j<c;j++)\n\t\t{\n\t\t\tif(j>i+k)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(max<a[j])\n\t\t\t{\n\t\t\t\tmax=a[j];\n\t\t\t\tpos=j;\n\t\t\t\tdiff=pos-i;\n\t\t\t}\t\t\t\n\t\t}\n\t\tfor(j=pos;j>i;j--)\n\t\t{\n\t\t\ttemp=a[j];\n\t\t\ta[j]=a[j-1];\n\t\t\ta[j-1]=temp;\n\t\t}\n\t\tk=k-diff;\n\t\tif(k==0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor(i=0;i<=c-1;i++)\n\t{\n\t\tprintf(\"%d\",a[i]);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a ;int k,i,brr[100],arr[100],j;\n\tscanf(\"%I64d %d\",&a,&k);\n\tfor(i=0;a>0;i++,a/=10)\n\tbrr[i]=a%10;int l=0;int n=i;\n\tfor(j=n-1;j>=0;j--,l++)\n\t\tarr[j]=brr[l];\n\tint max,maxi;\n\tfor(i=0;i<n && k>0;i++)\n\t{max=arr[i];maxi=i;\n\t\tfor(j=i+1;j<=i+k && j<n ;j++)\n\t\t{if(arr[j]>max)\n\t\t\t{max=arr[j];maxi=j;}\n\t\t}\n\t\tif(max!=-1)\n\t\t{j=maxi;\n\t\t\twhile(j!=i)\n\t\t\t{int temp=arr[j];arr[j]=arr[j-1];arr[j-1]=temp;j--;\n\t\t\t}\n\t\tk=k-(maxi-i);}\n\t}\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d\",arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "/* Coached by Dukkha */\n#include <stdio.h>\n#include <string.h>\n\n#define L 19\n\nint main() {\n\tstatic char aa[L + 1];\n\tint k, n, i;\n\n\tscanf(\"%s%d\", aa, &k), n = strlen(aa);\n\tfor (i = 0; i < n && k; i++) {\n\t\tint h, j = i;\n\t\tchar a;\n\n\t\tfor (h = i + 1; h <= i + k && h < n; h++)\n\t\t\tif (aa[j] < aa[h])\n\t\t\t\tj = h;\n\t\tif (i < j) {\n\t\t\tk -= j - i;\n\t\t\ta = aa[j];\n\t\t\twhile (j > i) {\n\t\t\t\taa[j] = aa[j - 1];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\taa[i] = a;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", aa);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main() {\n char s[32];\n int k;\n scanf(\"%s %d\", s, &k);\n int n = strlen(s);\n for (int i = 0; i < n; i++) {\n int mi = i;\n char mx = s[i];\n int l = i + k + 1 < n ? i + k + 1 : n;\n for (int j = i + 1; j < l; j++) {\n if(s[j] > mx) {\n mx = s[j];\n mi = j;\n }\n }\n if (i == mi) { continue; }\n char t = s[mi];\n for (int j = mi; j > i; j--) {\n s[j] = s[j - 1];\n }\n s[i] = t;\n k -= (mi - i);\n }\nend:\n printf(\"%s\\n\", s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\t{\n\t\n\t\nlong long int a;\t\t\nint k,i,j,l;\nchar s[20];\nlong long int n;\nint upper,max,index,temp;\n\t\nscanf(\"%I64d %d\",&a,&k);\t\n//scanf(\"%lld %d\",&a,&k);\t\n\t\nfor(i=18;i>=0 && a!=0;i--)\t{\n s[i] = a % 10 + '0';\n a=a/10;\n}\nupper=i+1;\t\nif(i>=0)\t{\n\twhile(i>=0)\t{\n\t\ts[i]='0';\n\t\ti--;\n\t}\n}\n/*\nfor(j=upper;j<19;j++)\t{\n\tprintf(\"%c\",s[j]);\n}\nprintf(\"\\n\");\n*/\nfor(i=upper;i<19 && k>0;i++)\t{\n\t\n\t max=s[i]-'0';\n\t index=i;\n\t \n\tfor(j=i+1,l=1;l<=k && j<19;j++,l++)\t{\n\t\t\n\t\t\t\n\t\t\tif(s[j]-'0' > max)\t{\n\t\t\t\tmax=s[j]-'0';\n\t\t\t index=j;\n\t\t\t}\n\t}\n\n for(l=index;l>i ;l--)\t{\n \t temp=s[l];\n \t s[l]=s[l-1];\n \t s[l-1]=temp;\n }\n k=k-(index-i);\n \n}\n//printf(\"final s\\n\");\nfor(j=upper;j<19;j++)\t{\n\tprintf(\"%c\",s[j]);\n}\nprintf(\"\\n\");\n\t\nreturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[500],temp,max;\n\tint c,n,i,j,k,x,f=1,h=4,m;\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\tc=0;\n\tn=strlen(a);\n\twhile(c!=n)\n\t{\n\t\tmax='0';\n\t\tfor(j=c;j<k+c+1;j++)\n\t\t{\n\t\t\tif(j==n)\n\t\t\tbreak;\n\t\t\tif(a[j]>max)\n\t\t\t{\n\t\t\t\tmax=a[j];\n\t\t\t\tx=j;\n\t\t\t}\n\t\t}\n\t\tfor(j=x;j>c;j--)\n\t\t{\n\t\t\t/*if(c==x)\t\t\n\t\t\tbreak;*/\n\t\t\tif(k==0)\n\t\t\t{\n\t\t\t\tf=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ttemp=a[j-1];\n\t\t\ta[j-1]=a[j];\n\t\t\ta[j]=temp;\n\t\t\tk--;\n\t\t}\n\t\tc++;\n\t//\tprintf(\"%d \",k);\n\t\tif(f==0)\n\t\tbreak;\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n\t\t\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\tchar a[30],t;\n\tint i,k,alen,max,s,flag=0;\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\talen=strlen(a);\n\twhile(k>0)\n\t{\n\t\tfor(i=0;i<alen-1;i++)\n\t\t{\n\t\t\t\tmax=i;\n\t\t\t\ts=1;\n\t\t\t\twhile(s<=k)\n\t\t\t\t{\n\t\t\t\t\tif(((i+s)<alen)&&(a[i+s]>a[i]))\n\t\t\t\t\t{\n\t\t\t\t\t\t\tmax=a[max]>=a[i+s]?max:i+s;\n\t\t\t\t\t}\n\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(a[max]>a[i])\n\t\t\t\t{\n\t\t\t\t\tt=a[max];\n\t\t\t\t\tk=k-max+i;\n\t\t\t\t\twhile(max-i>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ta[max]=a[max-1];\n\t\t\t\t\t\tmax--;\n\t\t\t\t\t}\n\t\t\t\t\ta[i]=t;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t\tif(flag==0)\n\t\t\tk--;\n\t\tflag=0;\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tchar tmp, max;\n\tint i, j, imax, l, k;\n\tstatic char a[20];\n\n\tscanf(\"%s\", a);\n\tscanf(\"%d\", &k);\n\tl = strlen(a);\n\tfor (i = 0; i < l; i++) {\n\t\tif (k == 0)\n\t\t\tbreak;\n\t\tmax = 0;\n\t\tfor (j = i + 1; j <= i + k && j < l; j++)\n\t\t\tif (max < a[j]) {\n\t\t\t\timax = j;\n\t\t\t\tmax = a[j];\n\t\t\t}\n\t\tif (a[i] < max)\n\t\t\tfor (j = imax; j >= i + 1; j--) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\tbreak;\n\t\t\t\ttmp = a[j], a[j] = a[j - 1], a[j - 1] = tmp;\n\t\t\t\tk--;\n\t\t\t}\n\t}\n\tprintf(\"%s\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,a,k,len=0,arr[30];\n\tchar c[20];\n\tscanf(\"%s\",c);\n\tlen=strlen(c);\n\tfor(i=0;i<len;i++)\n\t{\n\t\tarr[i]=c[i]-'0';\n\t}\n\tscanf(\"%d\",&k);\n\tint max=arr[0],kt=0,start=0,flag=0,rem;\n\twhile(1)\n\t{\n\t\tif(k==0 || start==len)\n\t\t{\n\t\t//\tprintf(\"cameee\\n\");\n\t\t\tbreak;\n\t\t}\n\t\tif(k>len)\n\t\t{\n\t\t\tkt=len;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tkt=k;\n\t\t}\n\t\tfor(i=start;i<len && i<=kt+start;i++)\n\t\t{\n\t\t\tif(arr[i]>max)\n\t\t\t{\n\t\t\t\tflag=1;\n\t\t\t\tmax=arr[i];\n\t\t\t\trem=i;\n\t\t\t}\n\t\t//\tprintf(\"s=%d i=%d a=%d f=%d m=%d r=%d\\n\",start,i,arr[i],flag,max,rem);\n\t\t}\n\t\tif(flag==1)\n\t\t{\n\t\t\tflag=0;\n\t\t\tfor(i=rem;i>start;i--)\n\t\t\t{\n\t\t\t\tint tt;\n\t\t\t\ttt=arr[i];\n\t\t\t\tarr[i]=arr[i-1];\n\t\t\t\tarr[i-1]=tt;\n\t\t\t}\n\t\t\tk=k-(rem-start);\n\t\t\tstart++;\n\t\t\tmax=arr[start];\n\t\t}\n\t\telse if (flag==0)\n\t\t{\n\t\t//\tprintf(\"came\\n\");\n\t\t\tstart++;\n\t\t\tmax=arr[start];\n\t\t}\n\t}\n\tfor(i=0;i<len;i++)\n\t\tprintf(\"%d\",arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n\tchar a[50];\n\tint k;\n\tint len;\n\tchar temp;\n\tint max;\n\tint idx;\n\n\tint i, j;\n\n\tscanf(\" %s %d\", a, &k);\n\n\tlen = strlen(a);\n\n\tfor (i = 0; i < len && k > 0; i++) {\n\t\tmax = -1;\n\t\tidx = -1;\n\t\tfor (j = i; j <= i + k && j < len; j++) {\n\t\t\tif (a[j] > max) {\n\t\t\t\tidx = j;\n\t\t\t\tmax = a[j];\n\t\t\t}\n\t\t}\n\n\t\tif (k > 0 && idx != -1) {\n\t\t\tfor (j = idx; j > i; j--) {\n\t\t\t\tk--;\n\t\t\t\ttemp = a[j - 1];\n\t\t\t\ta[j - 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%s\\n\", a);\n\t\n\treturn 0;\n}\n\t\t\n\n\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\t\n\n\t\n\n\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint num[30];\nchar str[30];\n\nint main(void) {\n\t// your code goes here\n\n\tint swap,max,i,j,k,t;\n\tint len;\n\tscanf(\"%s\",str);\n\tlen=strlen(str);\n\tfor(i=1;i<=len;i++)\n\t num[i]=str[i-1]-'0';\n\n\tscanf(\"%d\",&swap);\n\n\ti=1;\n\twhile(swap>0 && i<=len)\n\t{\n\t\tmax=num[i]; j=i;\n\t\tfor(k=i+1; k<=(i+swap)&&k<=len ;k++)\n\t\t{\n\t\t\tif(max<num[k]) { max=num[k]; j=k; }\n\t\t}\n\t\tswap=swap-(j-i); //printf(\"%d %d %d\\n\",swap,i,j);\n\t\tfor(k=j;k>i;k--)\n\t\t{\n\t\t\tt=num[k];\n\t\t\tnum[k]=num[k-1];\n\t\t\tnum[k-1]=t;\n\t\t}\n\n\t\ti++;\n\t}\n\n\tfor(i=1;i<=len;i++) printf(\"%d\",num[i]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char Str[20];\n int K, i, j, maxid;\n char max;\n scanf(\"%s %d\", Str, &K);\n for(i=0; i<i+K && Str[i]!='\\0'; ++i)\n {\n max = Str[i];\n maxid = i;\n for(j=i+1; j<i+1+K && Str[j]!='\\0'; ++j)\n {\n if(Str[j] > max)\n {\n max = Str[j];\n maxid = j;\n }\n }\n if(maxid != i)\n {\n K -= maxid - i;\n for(j=maxid; j>i; --j)\n {\n Str[j] = Str[j-1];\n }\n Str[i] = max;\n }\n }\n puts(Str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n char a[20];\n int k;\n scanf(\"%s%d\",a,&k);\n //\u5c31\u4e00\u4e2a\u539f\u5219\uff0c\u628a\u6700\u5927\u7684\u653e\u5728\u6700\u524d\u9762\n //\u628ak\u6b65\u5185\u6700\u5927\u7684\u6362\u5230\u6700\u524d\u9762\n int swaps=k;\n int na=strlen(a);\n int start=0;\n while(1){\n int i;\n int max=start;\n if(start==na-1)break;\n for(i=start+1;i<na && i<=start+swaps;i++){\n if(a[i]>a[max]){\n max=i;\n }\n }\n /*\n printf(\"start=%d, max=%d\\n\",start,max);\n printf(\"%s\\n\",a);\n */\n int tmp=a[max];\n for(i=max;i>start;i--){\n a[i]=a[i-1];\n }\n a[start]=tmp;\n //printf(\"%s\\n\",a);\n swaps-=(max-i);\n if(swaps==0)break;\n start++;\n }\n printf(\"%s\\n\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\nchar a[200],c;\nint i,j,k,mx,l,pos,z;\nscanf(\"%s\",a);\nscanf(\"%d\",&k);\nz=strlen(a);\nfor(i=0;i<z;i++)\n {\n\n mx=a[i]-48;\n pos=i;\n for(j=i+1;j<=i+k&&j<z;j++)\n {\n if(a[j]-48>mx)\n {\n mx=a[j]-48;\n pos=j;\n }\n }\n if(mx>a[i]-48)\n {\n for(l=pos;l>i;l--)\n {\n a[l]=a[l-1];\n\n }\n a[i]=mx+48;\n k=k-(pos-i);\n }\n }\nprintf(\"%s\\n\",a);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\nchar a[20],c;\nint i,j,k,mx,l,pos;\nscanf(\"%s\",a);\nscanf(\"%d\",&k);\nfor(i=0;i<strlen(a);i++){\n if(a[i]!='9'&&k>0){\n mx=a[i]-48;\n pos=i;\n for(j=i+1;j<=i+k&&j<strlen(a);j++){\n if(a[j]-48>mx){\n mx=a[j]-48;\n pos=j;\n }\n }\n if(pos-i<=k){\n for(l=pos;l>i;l--){\n a[l]=a[l-1];\n \n }\n a[i]=mx+48;\n k=k-(pos-i);\n }\n }\n}\nprintf(\"%s\\n\",a);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n#include<math.h>\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n//qsort (arr2, n, sizeof(int), compare);\n\nint main (){\n char arr[100];\n int k,flag=0;\n scanf(\"%s\",arr);\n scanf(\"%d\",&k);\n int i,j;\n int temp;\n for(i=0;i<strlen(arr) && k>0;i++){\n temp=i;\n flag=0;\n for(j=i;j<=i+k && j<strlen(arr) && k>0;j++){\n if(arr[j]>arr[temp]){\n temp=j;\n }\n }\n for(j=temp;j>i && k>0;j--){\n char temp2= arr[j];\n arr[j]=arr[j-1];\n arr[j-1]=temp2;\n flag=1;\n k--;\n }\n\n }\n\n printf(\"%s\\n\",arr);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n#include <ctype.h>\n#include <limits.h>\n\nchar s[32];\nint len;\nvoid swap(int st, int end, int k);\n\nint main(void)\n{\n\tint k;\n\t\n\tscanf(\"%s%d\", s, &k);\n\tlen = strlen(s);\n\tswap(0, len, k);\n\tputs(s);\n\n\treturn 0;\n}\n\nvoid swap(int st, int end, int k)\n{\n\tint i, max;\n\tchar t;\n\t\n\tif (!k || st==end)\n\t\treturn;\n\tfor (max=i=st; i<end; i++)\n\t\tif (s[i] > s[max])\n\t\t\tmax = i;\n\tif (max-st <= k) {\n\t\tk -= max-st;\n\t\tt = s[max];\n\t\tfor (i=max; i>st; i--)\n\t\t\ts[i] = s[i-1];\n\t\ts[i] = t;\n\t\tswap(st+1, len, k);\n\t\treturn;\n\t}\n\tswap(st, max, k);\n\t\n\treturn;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[50];\n\tint k;\n\tscanf(\"%s%d\",a,&k);\n\tint s=0,i,l=strlen(a);\n\tint pos=0,max=-1,max_pos=-1;\n\twhile(k>0 && pos<l)\n\t{\n\t\tmax=-1;\n\t\tmax_pos=-1;\n\t\tfor(i=pos;i<=pos+k && i<l;i++)\n\t\t{\n\t\t\tif(a[i]> max)\n\t\t\t{\n\t\t\t\tmax_pos=i;\n\t\t\t\tmax=a[i];\n\t\t\t}\n\t\t}\n\t\t//printf(\"%d\\n\",k);\n\t\tfor(i=max_pos;i>pos;i--)\n\t\t{\n\t\t\tk--;\n\t\t\tchar temp;\n\t\t\ttemp=a[i];\n\t\t\ta[i]=a[i-1];\n\t\t\ta[i-1]=temp;\n\t\t}\n\t\tpos++;\n\t}\n\tprintf(\"%s\\n\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[20];\n int k,i,j,len,temp,flag;\n while(scanf(\"%s%d\",a,&k) != EOF)\n {\n len=strlen(a);\n for(i=0;i<len-1;i++)\n {\n flag=i;\n for(j=i+1;j<len&&j<i+k+1;j++)\n if(a[j]>a[flag])\n flag=j;\n temp=a[flag];\n for(j=flag;j>i;j--)\n a[j]=a[j-1];\n a[i]=temp;\n k-=flag-i;\n if(k==0)\n break;\n }\n printf(\"%s\\n\",a);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n int i,m,n,tmp,k,count=0,a[20],max,j,x,p=20,q;\n char b[20];\n scanf(\"%s\",b);\n scanf(\"%d\",&k);\n \n n=strlen(b);\n for(i=0;i<n;i++)\n {\n a[i]=b[i]-'0';\n }\n \n max=0;m=0;x=0;\n while(k>0 && p>0)\n {\n max=0;\n for(i=x;i<=x+k && i<n;i++)\n {\n if(a[i]>max)\n {\n m=i;\n max=a[i];\n }\n }\n \n for(j=m;j>x;j--)\n {\n tmp=a[j];\n a[j]=a[j-1];\n a[j-1]=tmp;\n k--;\n }\n x++;\n p--;\n }\n for(i=0;i<n;i++)\n printf(\"%d\",a[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[40];\n int k,i,j,l,bar,temp,flag,var,max;\n scanf(\"%s\",a);\n scanf(\"%d\",&k);\n l=strlen(a);\n for(i=0;i<l;i++)\n a[i]=a[i]-'0';\n var=0;temp=0;bar=0;flag=0;\n for(j=0;j<l;j++)\n {\n flag=0;max=0;\n for(i=j+1;i<(l-(j+1)>=k?k+j+1:l);i++)\n {\n //max=a[j+1];\n if(a[i]>a[j])\n {\n if(a[i]>max)\n {\n max=a[i];\n var=i;\n flag=1;\n }\n }\n }\n \n if(flag)\n {\n temp=a[var];\n for(bar=var-1;bar>=j;bar--)\n a[bar+1]=a[bar];\n a[j]=temp;\n k-=(var-j);\n }\n }\n for(i=0;i<l;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n scanf(\"%d\",&j);\n return 0;\n}\n \n \n \n \n \n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n // your code goes here\n int k,i=0,j,mx,pos;\n char a[25];\n scanf(\"%s%d\",a,&k);\n int len=strlen(a);\n while(k>0){\n mx=a[i];\n pos=i;\n for(j=i+1;j<len && j-i<=k;j++){\n if(a[j]>mx){\n mx=a[j];\n pos=j;\n }\n }\n if(mx>a[i]){\n k=k-(pos-i);\n while(pos>i){\n a[pos]=a[pos-1];\n pos--;\n }\n a[i]=mx;\n }\n else\n i++;\n// printf(\"%s i=%d k=%d\\n\",a,i,k);\n if(i==len) break;\n }\n \n printf(\"%s\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a[30];\n\nint MIN(int x, int y){\n\tif (x<y) return x;\n\treturn y;\n}\n\nint main(void){\n\tint i, j, n, m, big, tt, ttt;\n\tchar t[30];\n\n\tscanf(\"%s %d\", &t, &m);\n\tn = strlen(t);\n\tfor (i = 1; i <= n; i++){\n\t\ta[i] = t[i - 1] - '0';\n\t}\n\n\tfor (i = 1; i <= n; i++){\n\t\tbig = a[i];\n\t\ttt = i;\n\t\tfor (j = i + 1; j <= MIN(i + m, n); j++){\n\t\t\tif (big<a[j]){\n\t\t\t\tbig = a[j];\n\t\t\t\ttt = j;\n\t\t\t}\n\t\t}\n\t\tm -= (tt - i);\n\t\tfor (j = tt - 1; j >= i; j--){\n\t\t\tttt = a[j];\n\t\t\ta[j] = a[j + 1];\n\t\t\ta[j + 1] = ttt;\n\t\t}\n\t}\n\n\tfor (i = 1; i <= n; i++){\n\t\tprintf(\"%d\", a[i]);\n\t}\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i, j;\n int index;\n int k;\n char tmpchar;\n char a[21];\n scanf(\"%s%d\", a, &k);\n for ( i = 0; a[i] != '\\0'; i++ )\n {\n index = i;\n for ( j = 0; j <= k && a[i+j] != '\\0'; j++ )\n if ( a[i+j] > a[index] )\n index = i+j;\n k -= index-i;\n tmpchar = a[index];\n for ( j = index; j > i; j-- )\n a[j] = a[j-1];\n a[i] = tmpchar;\n }\n printf(\"%s\\n\", a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[20];\n scanf(\"%s\",a);\n int l=strlen(a);\n int k,i;\n scanf(\"%d\",&k);\n i=0;\n while(k && i!=l)\n {\n int j,ch=i;\n char max=a[i];\n int x=(k+i+1)<l?(k+i+1):l;\n for(j=i;j<x;++j)\n {\n if(max<a[j])\n {\n max=a[j];\n ch=j;\n }\n }\n if(ch!=i)\n {\n // printf(\"%d %d\",i,ch);\n int y;\n char t=a[ch];\n for(y=ch;y>i;--y)\n {\n char t1=a[y];\n a[y]=a[y-1];\n a[y-1]=t1;\n }\n a[i]=t;\n k=k-(ch-i);\n }\n ++i;\n }\n printf(\"%s\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[20],i,j,k,top,tmp,x,z,flag,maxi;\nlong long n;\n\nint main()\n{\n\tscanf(\"%I64d%d\",&n,&k);\n\ttop=0;\n\twhile (n>0)\n\t{\n\t\ttop++;\n\t\ta[top]=n%10;\n\t\tn/=10;\n\t}\n\twhile (k>0)\n\t{\n\t\tflag=0;\n\t for (j=top; j>1; j--)\n\t {\n\t \tmaxi=j;\n\t \tfor (x=1; x<=k; x++)\n\t \t\tif (j-x>0 && a[maxi]<a[j-x]) maxi=j-x;\n\t \tif (maxi<j)\n\t \t{\n\t \t\ttmp=a[maxi];\n\t \t\tfor (z=maxi; z<j; z++) a[z]=a[z+1];\n\t \t\ta[j]=tmp;\n\t \t\tk-=j-maxi;\n\t \t\tflag=1;\n\t \t\tbreak;\n\t \t}\n\t }\n\t if (flag==0) break;\n\t}\n\tfor (i=top; i>1; i--) printf(\"%d\",a[i]);\n\tprintf(\"%d\\n\",a[1]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char num[10000];\n int n,m,i,j,k,len,max,t;\n while(scanf(\"%s%d\",num,&n)!=-1)\n {\n len=strlen(num);\n while(n)\n {\n for(j=0;j<len;j++)\n {\n max=0;\n for(k=j+1;k<j+1+n;k++)\n {\n if(num[k]-'0'>max)\n {\n m=k;\n max=num[k]-'0';\n }\n }\n if(max>(num[j]-'0'))\n {\n for(i=m;i>j;i--)\n {\n t=num[i];\n num[i]=num[i-1];\n num[i-1]=t;\n }\n n=n-(m-j);\n if(n<=0)\n break;\n\n }\n }\n if(j==len)\n break;\n if(n<=0)\n break;\n }\n printf(\"%s\\n\",num);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int j,max,idx,n,k,i;\n char a[100],temp;\n scanf(\"%s%d\",a,&k);\n n=strlen(a);\n for(i=0;i<n-1;i++)\n {\n idx=i;\n max=a[i];\n for(j=i+1;j<=i+k && j<n;j++)\n if(a[j]>max)\n {\n idx=j;\n max=a[j];\n }\n if(idx!=i)\n {\n k=k-idx+i;\n if(k<0)\n break;\n temp=a[idx];\n for(j=idx;j>i;j--)\n a[j]=a[j-1];\n a[i]=temp;\n } \n }\n printf(\"%s\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[30];\n\tint k,i,j;\n\tscanf(\"%s %d\",s,&k);\n\tfor(i=0;s[i+1]&&k>0;i++)\n\t{\n\t\tint max=-1,pos;\n\t\tfor(j=i;j<=i+k && s[j];j++)\n\t\t{\n\t\t\tif(s[j]-'0'>max)\n\t\t\t{\n\t\t\t\tmax=s[j]-'0';\n\t\t\t\tpos=j;\n\t\t\t}\n\t\t}\n\t\tfor(j=pos;j>i;j--)\n\t\t{\n\t\t\tchar temp=s[j];\n\t\t\t\ts[j]=s[j-1];\n\t\t\t\ts[j-1]=temp;\n\t\t}\n\t\tk=k-(pos-i);\n\t}\n\tprintf(\"%s\",s);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tchar tmp, max;\n\tint i, j, imax, l, k;\n\tstatic char a[20];\n\n\tscanf(\"%s\", a);\n\tscanf(\"%d\", &k);\n\tl = strlen(a);\n\tfor (i = 0; i < l; i++) {\n\t\tif (k == 0)\n\t\t\tbreak;\n\t\tmax = 0;\n\t\tfor (j = i + 1; j <= i + k && j < l; j++)\n\t\t\tif (max < a[j]) {\n\t\t\t\timax = j;\n\t\t\t\tmax = a[j];\n\t\t\t}\n\t\tif (a[i] < max)\n\t\t\tfor (j = imax; j >= i + 1; j--) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\tbreak;\n\t\t\t\ttmp = a[j], a[j] = a[j - 1], a[j - 1] = tmp;\n\t\t\t\tk--;\n\t\t\t}\n\t}\n\tprintf(\"%s\\n\", a);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdbool.h>\n#include <ctype.h>\n\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n#define swap(x, y) (x ^= y, y ^= x, x ^= y)\n\nint n, k, ar[100];\nchar str[1010], A[1010], B[1010];\n\nint main(){\n int i, j, l, counter;\n\n while (scanf(\"%s %d\", str, &k) != EOF){\n counter = 0, n = strlen(str);\n for (i = 0; i < n; i++){\n clr(ar);\n for (j = i + 1; j < n; j++){\n int x = str[j] - 48;\n if (!ar[x]) ar[x] = j;\n }\n\n int x = str[i] - 48;\n for (j = 9; j > x; j--){\n if (ar[j]){\n int dif = (ar[j] - i);\n if ((counter + dif) <= k){\n counter += dif;\n strcpy(A, str);\n strcpy(B, str);\n for (l = i; l < ar[j]; l++) swap(A[l], A[l + 1]);\n for (l = ar[j]; l > i; l--) swap(B[l], B[l - 1]);\n long long int x = atoll(A);\n long long int y = atoll(B);\n if (x > y) strcpy(str, A);\n else strcpy(str, B);\n break;\n }\n }\n }\n }\n puts(str);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nlong long A;\nint len, k;\nchar s[20];\n\nint main()\n{\n int temp, p = 0, i;\n scanf(\"%lld%d\", &A, &k);\n sprintf(s, \"%lld\", A);\n len = strlen(s);\n for(i = 0; i < len; i++)\n s[i] -= 48; \n for(; k > 0 && p < len; )\n {\n temp = p;\n for(i = 0; i <= k && p + i < len; i++)\n if(s[temp] < s[p + i])\n temp = p + i;\n if(temp != p)\n {\n int n = s[temp];\n for(i = temp; i > p; i--)\n {\n s[i] = s[i - 1];\n }\n s[p] = n;\n k -= temp - p;\n }\n p++;\n }\n A = 0;\n for(i = 0; i < len; i++)\n A = A * 10 + s[i];\n printf(\"%lld\", A);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n\nint main()\n{\n char str[20]= {'\\0'};\n int k;\n scanf(\"%s %d\",str,&k);\n int i,j;\n for(i=0; i<strlen(str) && k>0; i++)\n {\n int index = i;\n int flag = 0;\n for(j=i; j<=k+i && str[j]!='\\0'; j++)\n {\n\n if(str[j]>str[index])\n {\n\n index = j;\n flag = 1;\n }\n }\n if(flag)\n {\n int x;\n k-=(index-i);\n char temp = str[index];\n for(x=index; x>i; x--)\n {\n str[x] = str[x-1];\n }\n str[i] = temp;\n }\n\n }\n puts(str);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min2(x,y) (x<y?x:y)\n\nint p[30];\n\nvoid f(int num, int len)\n{\n int i, k = 1, sum = p[1];\n\n if (len == 1)\n {\n printf(\"%d\", p[1]);\n return;\n }\n\n for (i = 1; i <= min2(num + 1, len); i++)\n {\n if (sum < p[i]) sum = p[i], k = i;\n }\n for (i = k; i <= len - 1; i++) p[i] = p[i + 1];\n printf(\"%d\", sum);\n f(num - k + 1, len - 1);\n}\nint main()\n{\n int i, n, m;\n char in[30];\n\n scanf(\"%s %d\", &in[1], &m);\n n = strlen(&in[1]);\n for (i = 1; i <= n; i++) p[i] = in[i] - '0';\n\n f(m, n);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint max( int a , int b ) {\n if ( a > b ) return a; else return b;\n}\n\nint main(){\n long long tmp; int k , a[22] , n = 0, i;\n scanf( \"%I64d%d\" , &tmp , &k );\n while ( tmp > 0 ) {\n a[++n] = tmp % 10;\n tmp /= 10;\n }\n for( i = n; i > 0; i -- ) {\n int j , w = a[i] , pos = i;\n for( j = i; j >= max( 1 , i - k ); j -- )\n if ( a[j] > w ) {\n w = a[j]; pos = j;\n }\n for( j = pos; j <= i - 1; j ++ ) a[j] = a[j + 1];\n a[i] = w; k -= ( i - pos );\n if ( k <= 0 ) break;\n }\n for( i = n; i > 0; i -- ) printf( \"%d\" , a[i] );\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar a[32];\nint l,b[32],st,m,swp;\nint swap(int x,int y)\n{\nchar ch;\nint i;\nif(y>x)\n{\n ch=a[y];\n for(i=y;i>x;i--)\n {\n a[i]=a[i-1];\n }\n a[i]=ch;\n}\nreturn 0;\n}\nmain()\n{\nint i,j,k;\nscanf(\"%s %d\",a,&k);\nswp=k;\nl=strlen(a);\nst=0;\nwhile(st<l-1)\n{\n m=a[st];\n j=0;\n for(i=st+1;i<l;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n b[j]=i;\n j++;\n }\n }\n for(i=j-1;i>=0;i--)\n {\n if(swp>=b[i]-st)\n {\n swap(st,b[i]);\n swp=swp-(b[i]-st);\n break;\n }\n }\n st++;\n}\nfor(i=0;i<l;i++)\n{\nprintf(\"%c\",a[i]);\n}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tchar number[20];\n\tint k;\n\tscanf(\"%s%d\",number,&k);\n\twhile(k>0) {\n\t\tint i;\n\t\tfor(i=0;number[i]!='\\0';i++) {\n\t\t\tchar max=number[i];\n\t\t\tint maxpos=0;\n\t\t\tint j;\n\t\t\tfor(j=1;j<=k && number[i+j]!='\\0';j++) {\n\t\t\t\tif(number[i+j]>max) {\n\t\t\t\t\tmax=number[i+j];\n\t\t\t\t\tmaxpos=j;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(maxpos>0) {\n\t\t\t\tchar temp=number[i+maxpos];\n\t\t\t\tfor(j=maxpos;j>0;j--)number[i+j]=number[i+j-1];\n\t\t\t\tnumber[i]=temp;\n\t\t\t\tk-=maxpos;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(number[i]=='\\0')break;\n\t}\n\tputs(number);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[30];\n\tint k,i,j;\n\tscanf(\"%s %d\",s,&k);\n\tfor(i=0;s[i+1]&&k>0;i++)\n\t{\n\t\tint max=-1,pos;\n\t\tfor(j=i;j<=i+k && s[j];j++)\n\t\t{\n\t\t\tif(s[j]-'0'>max)\n\t\t\t{\n\t\t\t\tmax=s[j]-'0';\n\t\t\t\tpos=j;\n\t\t\t}\n\t\t}\n\t\tfor(j=pos;j>i;j--)\n\t\t{\n\t\t\tchar temp=s[j];\n\t\t\t\ts[j]=s[j-1];\n\t\t\t\ts[j-1]=temp;\n\t\t}\n\t\tk=k-(pos-i);\n\t}\n\tprintf(\"%s\",s);\n\treturn(0);\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0,p;\nscanf(\"%s %I64d\",s,&k);\np=k;\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+1;m<i+p+1 && m<strlen(s);m++)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\np--;\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,c;\n scanf(\"%lld %d\",&a,&k);\n c=a;\n while(c>0)\n {\n number1[i]=c%10;\n c=c/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<count && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nvoid swap(char *s, int i, int j) {\n\tchar temp = s[i];\n\ts[i] = s[j];\n\ts[j] = temp;\n}\nint main() {\n\tint k, i, l, p, j, pos = 0;\n\tchar s[20], max;\n\tscanf(\"%s%d\", s, &k);\n\tl = strlen(s);\n\tfor(i = 0; i < l-1; ++i) {\n\t\tpos = i;\n\t\tp = k;\n\t\tmax = '0';\n\t\tfor(j = i; p >= 0 && j < l; --p, ++j) {\n\t\t\tif(s[j] > max) {\n\t\t\t\tmax = s[j];\n\t\t\t\tpos = j;\n\t\t\t}\n\t\t}\n\t\tk -= pos - i;\n\t\tfor(j = pos; j > i; --j) \n\t\t\tswap(s, j, j-1);\n\t}\n\tputs(s);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n char a[20], maior;\n int k,i,indiceMaior,aux,indiceAux=0,asize;\n scanf(\"%s %d\",a,&k);\n \n asize = strlen(a);\n while (indiceAux < asize) {\n maior=a[indiceAux],indiceMaior=indiceAux;\n int aux2 = indiceAux + k + 1;\n \n for (i=indiceAux+1; i < aux2 && a[i] != '\\0'; i++) {\n if (a[i] > maior) {\n maior = a[i];\n indiceMaior = i;\n }\n }\n \n for (i=indiceMaior; i >indiceAux; i--) {\n a[i] = a[i-1];\n }\n\n k = k - (indiceMaior - indiceAux);\n indiceAux++;\n printf(\"%c\",maior);\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n int n, i, j, k, l, c, index;\n char ss[19], max;\n scanf(\"%s %d\", ss, &n);\n l = strlen(ss);\n c = 0;\n for(i=0; i<l; i++){\n c = 0;\n max = ss[i];\n index = i;\n for(j=i+1; j<l && c<n; j++, c++){\n if(ss[j] > max){\n max = ss[j];\n index = j;\n }\n }\n\n if(index != i){\n for(k=index;k>i;k--){\n ss[k] = ss[k-1];\n }\n ss[i] = max;\n n -= (index - i);\n }\n }\n \n printf(\"%s\\n\",ss);\n return 0; \n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long long int a, p;\n int k, b=1, i, j=0, replace, bigger, where, x;\n scanf(\"%I64d %i\", &a, &k);\n p=a;\n while(p/10>0){\n b++;\n p=p/10;\n }\n int order[b];\n p=a;\n for(i=b-1; i>=0; i--){\n order[i]=p%10;\n p=p/10;\n }\n while(k>0 && j!=b-1){\n bigger=0;\n for(i=b-1; i>=j; i--){\n if(i-j<=k){\n if(bigger<=order[i]){\n bigger=order[i];\n where=i;\n }\n }\n }\n //printf(\"%i %i\\n\", where, order[where]); system(\"PAUSE\");\n //printf(\"%i %i\", where-j, k); system(\"PAUSE\");\n if(where-j<=k){\n for(x=where; x>j; x--){\n replace=order[x];\n order[x]=order[x-1];\n order[x-1]=replace;\n k--;\n }\n }\n j++;\n }\n for(i=0; i<b; i++){\n printf(\"%i\", order[i]);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint k;\nchar a[19];\nint st;\nint count;\nint max;\nint tmp;\n\nint main(){\n\n\tint i;\n\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<strlen(a);i++){\n\t\tif(a[i]!='9')\n\t\t\tbreak;\n\t\telse\n\t\t\tst++;\n\t}\n\n\twhile(k&&(st<strlen(a))){\n\t\tfor(i=0;i<k&&(st+1+i<strlen(a));i++){\n\t\t\tif(a[st]<a[st+1+i])\n\t\t\t\tif(a[st+1+i]>max){\n\t\t\t\t\tmax=a[st+1+i];\n\t\t\t\t\tcount = i+1;\n\t\t\t\t}\n\t\t}\n\n\t\tif(max!=0){\n\t\t\tfor(i=0;i<count;i++){\n\t\t\t\ttmp=a[st+count-i];\n\t\t\t\ta[st+count-i]=a[st+count-1-i];\n\t\t\t\ta[st+count-1-i]=tmp;\n\t\t\t}\n\t\t\tk-=count;\n\t\t}\n\n\t\tmax=0;\n\t\tcount=0;\n\t\tst++;\n\n\t}\n\n\tprintf(\"%s\",a);\n\t\t\n\treturn 0;\n\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n int k,i,j,f,len;\n char a[20],c;\n scanf(\"%s %d\",a,&k);\n len=strlen(a);\n for(i=0;i<len-1&&k>0;i++)\n {\n for(j=i+1;j<len&&j-i<=k;j++)\n {\n if(a[j]>a[i])\n {\n c=a[j];\n for(f=j;f>i;f--)\n a[f]=a[f-1];\n a[i]=c;\n k=k-j+i;\n }\n }\n }\n printf(\"%s\\n\",a);\n return 0;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nvoid swap(int i);\nint check(int i);\n\nchar inp[200];\nint k,n,fixed;\n\nint main()\n{\n int i,j;\n\n while(scanf(\"%s%d\",inp,&k)!=EOF)\n {\n n=strlen(inp);\n\n\n for(i=0;i<n;i++)\n {\n fixed=i;\n\n if(k==0)\n break;\n j=check(i);\n\n if(j!=i)\n {\n swap(j);\n // printf(\"%s\\n\",inp);\n k-=j-i;\n }\n }\n\n printf(\"%s\\n\",inp);\n }\n\n\n return 0;\n\n}\n\nint check(int i)\n{\n int max=inp[i];\n int j;\n int ans=i;\n\n for(j=1;j<=k;j++)\n {\n if(j+i>=n)\n break;\n\n if(max<inp[j+i])\n {\n max=inp[i+j];\n ans=i+j;\n }\n }\n return ans;\n}\n\nvoid swap(int i)\n{\n int j,p;\n\n if(i<=k)\n j=fixed;\n\n else\n j=i-k;\n\n\n for(p=i;p>j;p--)\n {\n inp[p]=inp[p]^inp[p-1];\n inp[p-1]=inp[p]^inp[p-1];\n inp[p]=inp[p]^inp[p-1];\n }\n fixed=p+1;\n}\n"}, {"source_code": "/* \u0628\u0650\u0633\u0652\u0645\u0650 \u0627\u0644\u0644\u0647\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0652\u0645\u0670\u0646\u0650 \u0627\u0644\u0631\u064e\u0651\u062d\u0650\u064a\u0652\u0645\u0650 */\n/* \u0631\u0651\u064e\u0628\u0651\u0650 \u0632\u0650\u062f\u0652\u0646\u0650\u0649 \u0639\u0650\u0644\u0652\u0645\u064b\u0627 */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nvoid swap(int i);\nint check(int i);\n\nchar inp[200];\nint k,n,fixed;\n\nint main()\n{\n int i,j;\n\n while(scanf(\"%s%d\",inp,&k)!=EOF)\n {\n n=strlen(inp);\n fixed=0;\n\n for(i=0;i<n;i++)\n {\n\n if(k==0)\n break;\n j=check(i);\n\n if(j!=i)\n {\n swap(j);\n k-=j-i;\n }\n }\n\n printf(\"%s\\n\",inp);\n }\n\n\n return 0;\n\n}\n\nint check(int i)\n{\n int max=inp[i];\n int j;\n int ans=i;\n\n for(j=1;j<=k;j++)\n {\n if(j+i>=n)\n break;\n\n if(max<inp[j+i])\n {\n max=inp[i+j];\n ans=i+j;\n }\n }\n return ans;\n}\n\nvoid swap(int i)\n{\n int j,p;\n\n if(i<=k)\n j=fixed;\n\n else\n j=i-k;\n\n\n for(p=i;p>j;p--)\n {\n inp[p]=inp[p]^inp[p-1];\n inp[p-1]=inp[p]^inp[p-1];\n inp[p]=inp[p]^inp[p-1];\n }\n fixed=p+1;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main(void) {\n\tint k, i,j,l, digit[10][20], cnt[10], temp, swap = 0;\n\tmemset(cnt, 0, sizeof(cnt));\n\tmemset(digit, -1, sizeof(digit));\n\tchar num[20], ch;\n\tscanf(\"%s %d\", &num, &k);\n\tint len = strlen(num);\n\tfor(i=0;i<len;i++){\n\t\ttemp = num[i] - '0';\n\t\tdigit[temp][cnt[temp]] = i;\n\t\tcnt[temp]++;\n\t}\n\tfor(i=9;i>-1;i--){\n\t\tfor(j=0;j<cnt[i];j++){\n\t\t\tint min = digit[i][j];\n\t\t\tint index = j;\n for(l=j+1; l<cnt[i]; l++){\n \t\t\t\tif(min < digit[i][l]){\n \t\t\t\t\tmin = digit[i][l];\n \t\t\t\t\tindex = l;\n \t\t\t\t}\n }\n int x = digit[i][j];\n digit[i][j] = digit[i][index];\n digit[i][index] = x;\n }\n\t}\n\t//printf(\"%d %d %d\\n\", digit[3][0], digit[3][1], digit[3][2] );\n\tfor(i=0;i<len-1 && k>0;i++){\n\t\tfor(j=9;j>-1;j--){\n\t\t //printf(\"CNT %d\\n\", cnt[j]);\n\t\t\tif(cnt[j]>0){\n\t\t\t //printf(\"%d\\n\", digit[j][cnt[j]-1]);\n\t\t\t\tif((digit[j][cnt[j]-1] - i) <= k){\n\t\t\t\t\tint pos = digit[j][cnt[j]-1];\n\t\t\t\t\tif(pos > i){\n for(l=pos;l>i;l--){\n ch = num[l];\n num[l] = num[l-1];\n num[l-1] = ch;\n //printf(\"CHECK %s\", num);\n }\n k = k - (pos - i);\n // printf(\"K=%d\\n\", k);\n\t\t\t\t\t}\n\t\t\t\t\tcnt[j]--;\n break;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\", num);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n \nint main(void) {\nint k, i,j,l, digit[10][20], cnt[10], temp, swap = 0;\nmemset(cnt, 0, sizeof(cnt));\nmemset(digit, -1, sizeof(digit));\nchar num[20];\nscanf(\"%s %d\", &num, &k);\nint len = strlen(num);\nfor(i=0;i<len;i++){\ntemp = num[i] - '0';\ndigit[temp][cnt[temp]] = i;\ncnt[temp]++;\n}\nfor(i=9;k>0 && i>-1;i--){\nfor(j=0;j<cnt[i];j++){\nint max = digit[i][j];\nint index = j;\nfor(l=j+1; l<cnt[i]; l++){\nif(max < digit[i][l]){\nmax = digit[i][l];\nindex = l;\n}\n}\nint x = digit[i][j];\ndigit[i][j] = digit[i][index];\ndigit[i][index] = x;\n}\nfor(j=cnt[i]-1;j>-1 && k>0;j--){\nif(digit[i][j]<=k){\nk = k - digit[i][j];\nchar c;\nc = num[swap];\nnum[swap] = num[digit[i][j]];\nswap++;\nnum[digit[i][j]] = c;\n// printf(\"%s\\n\", num);\n}\n}\n}\n//printf(\"%d %d \", digit[0][0], digit[0][1]);\nprintf(\"%s\", num);\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n \nint main(void) {\nint k, i,j,l, digit[10][20], cnt[10], temp, swap = 0;\nmemset(cnt, 0, sizeof(cnt));\nmemset(digit, -1, sizeof(digit));\nchar num[20];\nscanf(\"%s %d\", &num, &k);\nint len = strlen(num);\nfor(i=0;i<len;i++){\ntemp = num[i] - '0';\ndigit[temp][cnt[temp]] = i;\ncnt[temp]++;\n}\nfor(i=9;k>0 && i>-1;i--){\nfor(j=0;j<cnt[i];j++){\nint max = digit[i][j];\nint index = j;\nfor(l=j+1; l<cnt[i]; l++){\nif(max < digit[i][l]){\nmax = digit[i][l];\nindex = l;\n}\n}\nint x = digit[i][j];\ndigit[i][j] = digit[i][index];\ndigit[i][index] = x;\n}\nfor(j=cnt[i]-1;j>-1 && k>0;j--){\nif(digit[i][j]<=k){\nk = k - digit[i][j];\nchar c;\nc = num[swap];\nnum[swap] = num[digit[i][j]];\nswap++;\nnum[digit[i][j]] = c;\n// printf(\"%s\\n\", num);\n}\n}\n}\nprintf(\"%d %d \", digit[0][0], digit[0][1]);\nprintf(\"%s\", num);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int m,k,count,l,i,j,temp;\n char ar[45],ch,temp1,max;\nscanf(\"%s%c%d\",&ar,&ch,&m);\nl=strlen(ar);\n\nk=m;\nfor(i=0;i<l-1;i++)\n{\n if(m>0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0 &&j<l-1)\n{\n if(max<ar[j])\n {\n temp=j;\n max=ar[j];\n }\n k--;\n j++;\n}\n if(temp!=i)\n {\n temp1=ar[temp];\n for(j=temp;j>i;j--)\n ar[j]=ar[j-1];\n ar[i]=temp1;\n }\n m=m-(temp-i);\n }\n else\n break;\n}\nprintf(\"%s\\n\",ar);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int m,k,count,l,i,j,temp;\n char ar[20],ch,temp1,max;\nscanf(\"%s%c%d\",&ar,&ch,&m);\nl=strlen(ar);\n\nk=m;\nfor(i=0;i<l-1;i++)\n{\n if(m>0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0)\n{\n if(max<ar[j])\n {\n temp=j;\n max=ar[j];\n }\n k--;\n j++;\n}\n if(temp!=i)\n {\n temp1=ar[temp];\n for(j=temp;j>i;j--)\n ar[j]=ar[j-1];\n ar[i]=temp1;\n }\n m=m-(temp-i);\n }\n else\n break;\n}\nprintf(\"%s\\n\",ar);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int m,k,count,l,i,j,temp;\n char ar[45],ch,temp1,max;\nscanf(\"%s%c%d\",&ar,&ch,&m);\nl=strlen(ar);\n\nk=m;\nfor(i=0;i<l-1;i++)\n{\n if(m>0)\n {\n j=i+1;\n temp=i;\n k=m;\n max=ar[i];\nwhile(k>0)\n{\n if(max<ar[j])\n {\n temp=j;\n max=ar[j];\n }\n k--;\n j++;\n}\n if(temp!=i)\n {\n temp1=ar[temp];\n for(j=temp;j>i;j--)\n ar[j]=ar[j-1];\n ar[i]=temp1;\n }\n m=m-(temp-i);\n }\n else\n break;\n}\nprintf(\"%s\\n\",ar);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint k, i, j;\nchar a[1000], t;\n\nint max(int a, int b){return (a>b)?a:b;}\n\nint main () {\n\tscanf(\"%s %d\",a ,&k);\n\tfor(j = 1 ; j <= k ; j++){\n\t\tfor(i = 1 ; i < strlen(a) ; i++){\n\t\t\tif(a[i] > a[i-1]){\n\t\t\t\tt = a[i-1];\n\t\t\t\ta[i-1] = a[i];\n\t\t\t\ta[i] = t;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a ;int k,i,brr[100],arr[100],j;\n\tscanf(\"%I64d %d\",&a,&k);\n\tfor(i=0;a>0;i++,a/=10)\n\tbrr[i]=a%10;int l=0;int n=i;\n\tfor(j=n-1;j>=0;j--,l++)\n\t\tarr[j]=brr[l];\n\twhile(k>0)\n\t{\n\t\tfor(i=0;i<n-1;i++)\n\t\t{\n\t\t\tif(arr[i]<arr[i+1])\n\t\t\t{int temp=arr[i];arr[i]=arr[i+1];arr[i+1]=temp;k--;break;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d\",arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int a ;int k,i,brr[100],arr[100],j;\n\tscanf(\"%I64d %d\",&a,&k);\n\tfor(i=0;a>0;i++,a/=10)\n\tbrr[i]=a%10;int l=0;int n=i;\n\tfor(j=n-1;j>=0;j--,l++)\n\t\tarr[j]=brr[l];\n\tint max,maxi;\n\tfor(i=0;i<n && k>0;i++)\n\t{max=arr[i];maxi=i;\n\t\tfor(j=i+1;j<=i+k && j<n ;j++)\n\t\t{if(arr[j]>max)\n\t\t\t{max=arr[j];maxi=j;}\n\t\t}\n\t\tif(max!=-1)\n\t\t{\n\t\tint temp=arr[i];arr[i]=arr[maxi];arr[maxi]=temp;k=k-(maxi-i);}\n\t}\n\tfor(i=0;i<n;i++)\n\t\tprintf(\"%d\",arr[i]);\n\tprintf(\"\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\t{\n\t\n\t\nlong long int a;\t\t\nint k,i,j,l;\nchar s[20];\nlong long int n;\nint upper,max,index,temp;\n\t\nscanf(\"%I64d %d\",&a,&k);\t\n//scanf(\"%lld %d\",&a,&k);\t\n\t\nfor(i=18;i>=0 && a!=0;i--)\t{\n s[i] = a % 10 + '0';\n a=a/10;\n}\nupper=i+1;\t\nif(i>=0)\t{\n\twhile(i>=0)\t{\n\t\ts[i]='0';\n\t\ti--;\n\t}\n}\n\nfor(i=upper;i<19 && k>0;i++)\t{\n\t\n\t max=s[i]-'0';\n\t index=i;\n\t \n\tfor(j=i+1,l=1;l<=k;j++,l++)\t{\n\t\t\n\t\t\t\n\t\t\tif(s[j]-'0' > max)\t{\n\t\t\t\tmax=s[j]-'0';\n\t\t\t index=j;\n\t\t\t}\n\t}\n\n for(l=index;l>i ;l--)\t{\n \t temp=s[l];\n \t s[l]=s[l-1];\n \t s[l-1]=temp;\n }\n k=k-(index-i);\n \n}\n//printf(\"final s\\n\");\nfor(j=upper;j<19;j++)\t{\n\tprintf(\"%c\",s[j]);\n}\nprintf(\"\\n\");\n\t\nreturn 0;\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\tchar a[30],t;\n\tint i,k,alen,max,s,flag=0;\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\talen=strlen(a);\n\twhile(k>0)\n\t{\n\t\tfor(i=0;i<alen-1;i++)\n\t\t{\n\t\t\t\tmax=i;\n\t\t\t\ts=k;\n\t\t\t\twhile(s>0)\n\t\t\t\t{\n\t\t\t\t\tif(a[i+s]>a[i])\n\t\t\t\t\t\tmax=a[max]>a[i+s]?max:i+s;\n\t\t\t\t\ts--;\n\t\t\t\t}\n\t\t\t\tif(a[max]>a[i])\n\t\t\t\t{\n\t\t\t\t\tt=a[max];\n\t\t\t\t\tk=k-max+i;\n\t\t\t\t\twhile(max-i>0)\n\t\t\t\t\t{\n\t\t\t\t\t\ta[max]=a[max-1];\n\t\t\t\t\t\tmax--;\n\t\t\t\t\t}\n\t\t\t\t\ta[i]=t;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t\tif(flag==0)\n\t\t\tk--;\n\t\tflag=0;\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\tchar a[30],t;\n\tint i,k,alen;\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\talen=strlen(a);\n\twhile(k>0)\n\t{\n\t\tfor(i=0;i<alen-1;i++)\n\t\t{\n\t\t\tif(a[i]<a[i+1])\n\t\t\t{\n\t\t\t\tt=a[i+1];\n\t\t\t\ta[i+1]=a[i];\n\t\t\t\ta[i]=t;\n\t\t\t\tk--;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char a[20], b[20], c[20];\n\tint i, j, l, k, k_;\n\tchar tmp;\n\n\tscanf(\"%s\", a);\n\tscanf(\"%d\", &k);\n\tstrcpy(b, a);\n\tstrcpy(c, a);\n\tl = strlen(a);\n\tk_ = k;\n\tfor (i = 0; i < l; i++)\n\t\tfor (j = i; j >= 1; j--) {\n\t\t\tif (k_ == 0)\n\t\t\t\tbreak;\n\t\t\tif (b[j] > b[j - 1]) {\n\t\t\t\ttmp = b[j], b[j] = b[j - 1], b[j - 1] = tmp;\n\t\t\t\tk_--;\n\t\t\t}\n\t\t}\n\tk_ = k;\n\tfor (i = l - 1; i >= 0; i--)\n\t\tfor (j = i; j >= 1; j--) {\n\t\t\tif (k_ == 0)\n\t\t\t\tbreak;\n\t\t\tif (c[j] > c[j - 1]) {\n\t\t\t\ttmp = c[j], c[j] = c[j - 1], c[j - 1] = tmp;\n\t\t\t\tk_--;\n\t\t\t}\n\t\t}\n\tprintf(\"%s\\n\", strcmp(b, c) > 0 ? b : c);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char a[20];\n\tint i, j, l, k;\n\tchar tmp;\n\n\tscanf(\"%s\", a);\n\tscanf(\"%d\", &k);\n\tl = strlen(a);\n\tfor (i = 0; i < l; i++)\n\t\tfor (j = i; j >= 1; j--) {\n\t\t\tif (k == 0)\n\t\t\t\tbreak;\n\t\t\tif (a[j] > a[j - 1]) {\n\t\t\t\ttmp = a[j], a[j] = a[j - 1], a[j - 1] = tmp;\n\t\t\t\tk--;\n\t\t\t}\n\t\t}\n\tprintf(\"%s\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tchar tmp, max;\n\tint i, j, imax, l, k;\n\tstatic char a[20];\n\n\tscanf(\"%s\", a);\n\tscanf(\"%d\", &k);\n\tl = strlen(a);\n\tfor (i = 0; i < l; i++) {\n\t\tif (k == 0)\n\t\t\tbreak;\n\t\tfor (j = i + 1; j <= i + k && j < l; j++)\n\t\t\tif (max < a[j]) {\n\t\t\t\timax = j;\n\t\t\t\tmax = a[j];\n\t\t\t}\n\t\tif (a[i] < max)\n\t\t\tfor (j = imax; j >= i + 1; j--) {\n\t\t\t\tif (k == 0)\n\t\t\t\t\tbreak;\n\t\t\t\ttmp = a[j], a[j] = a[j - 1], a[j - 1] = tmp;\n\t\t\t\tk--;\n\t\t\t}\n\t}\n\tprintf(\"%s\\n\", a);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(void) {\n\tchar a[50];\n\tint k;\n\tint len;\n\tchar temp;\n\tint max;\n\tint idx;\n\n\tint i, j;\n\n\tscanf(\" %s %d\", a, &k);\n\n\tlen = strlen(a);\n\n\tfor (i = 0; i < len; i++) {\n\t\tmax = -1;\n\t\tidx = -1;\n\t\tfor (j = i; j < i + k + 1; j++) {\n\t\t\tif (a[j] > max) {\n\t\t\t\tidx = j;\n\t\t\t\tmax = a[j];\n\t\t\t}\n\t\t}\n\n\t\tif (k > 0) {\n\t\t\tfor (j = idx; j > i; j--) {\n\t\t\t\tk--;\n\t\t\t\ttemp = a[j - 1];\n\t\t\t\ta[j - 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%s\\n\", a);\n\t\n\treturn 0;\n}\n\t\t\n\n\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\t\t\n\n\t\n\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char Str[20];\n int K, i, j, maxid;\n char max;\n scanf(\"%s %d\", Str, &K);\n for(i=0; i<K && Str[i]!='\\0'; ++i)\n {\n max = Str[i];\n maxid = i;\n for(j=i+1; j<i+1+K && Str[j]!='\\0'; ++j)\n {\n if(Str[j] > max)\n {\n max = Str[j];\n maxid = j;\n }\n }\n if(maxid != i)\n {\n K -= maxid - i;\n for(j=maxid; j>i; --j)\n {\n Str[j] = Str[j-1];\n }\n Str[i] = max;\n }\n }\n puts(Str);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char Str[20];\n int K, i, j;\n char temp;\n scanf(\"%s %d\", Str, &K);\n for(i=0; i<K; ++i)\n {\n for(j=1; Str[j]!='\\0'; ++j)\n {\n if(Str[j] > Str[j-1])\n {\n temp = Str[j];\n Str[j] = Str[j-1];\n Str[j-1] = temp;\n break;\n }\n }\n }\n puts(Str);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\nchar a[20],c;\nint i,j,k,mx,l,pos;\nscanf(\"%s\",a);\nscanf(\"%d\",&k);\nfor(i=0;i<strlen(a);i++){\n\tif(a[i]!='9'&&k>0){\n\t\tmx=a[i]-48;\n\t\tpos=i;\n\t\tfor(j=i+1;j<=i+k;j++){\n\t\t\tif(a[j]-48>mx){\n\t\t\tmx=a[j]-48;\n\t\t\tpos=j;\n\t\t\t}\n\t\t}\n\t\tif(pos-i<=k){\n\t\t\tfor(l=pos;l>i;l--){\n\t\t\t\ta[l]=a[l-1];\n\t\t\t\t\n\t\t\t}\n\t\t\ta[i]=mx+48;\n\t\t\tk=k-(pos-i);\n\t\t}\n\t}\n}\nprintf(\"%s\\n\",a);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n#include<math.h>\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n//qsort (arr2, n, sizeof(int), compare);\n\nint main (){\n char arr[100];\n int k;\n scanf(\"%s\",arr);\n scanf(\"%d\",&k);\n int i,j;\n for(i=0;i<strlen(arr);i++){\n for(j=0;j<strlen(arr)-1;j++){\n if(arr[j+1]>arr[j]){\n char temp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=temp;\n k--;\n break;\n }\n if(k==0)\n break;\n }\n if(k==0)\n break;\n }\n printf(\"%s\\n\",arr);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n#include<math.h>\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n//qsort (arr2, n, sizeof(int), compare);\n\nint main (){\n char arr[100];\n int k,flag=0;\n scanf(\"%s\",arr);\n scanf(\"%d\",&k);\n int i,j;\n while(1){\n flag=0;\n if(k==0)\n break;\n for(j=0;j<strlen(arr)-1;j++){\n if(arr[j+1]>arr[j]){\n char temp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=temp;\n k--;\n flag=1;\n break;\n }\n\n }\n if(k==0 || !flag)\n break;\n }\n\n printf(\"%s\\n\",arr);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n#include<math.h>\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n//qsort (arr2, n, sizeof(int), compare);\n\nint main (){\n char arr[100];\n int k;\n scanf(\"%s\",arr);\n scanf(\"%d\",&k);\n int i,j;\n for(i=0;i<strlen(arr);i++){\n for(j=0;j<strlen(arr)-1;j++){\n if(arr[j+1]>arr[j]){\n char temp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=temp;\n k--;\n break;\n }\n if(k==0)\n break;\n }\n i=-1;\n if(k==0)\n break;\n }\n\n printf(\"%s\\n\",arr);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n#include<math.h>\n\nint compare (const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\n//qsort (arr2, n, sizeof(int), compare);\n\nint main (){\n char arr[100];\n int k;\n scanf(\"%s\",arr);\n scanf(\"%d\",&k);\n int i,j;\n for(i=0;i<strlen(arr);i++){\n for(j=0;j<strlen(arr)-1;j++){\n if(arr[j+1]>arr[j]){\n char temp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=temp;\n k--;\n break;\n }\n if(k==0)\n break;\n }\n i=0;\n if(k==0)\n break;\n }\n printf(\"%s\\n\",arr);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar a[50];\n\tint k;\n\tscanf(\"%s%d\",a,&k);\n\tint s=0,i,l=strlen(a);\n\n\twhile(k--)\n\t{\n\t\tfor(i=0;i<l-1;i++)\n\t\t{\n\t\t\tif(a[i]<a[i+1])\n\t\t\t{\n\t\t\t\tchar temp;\n\t\t\t\ttemp=a[i];\n\t\t\t\ta[i]=a[i+1];\n\t\t\t\ta[i+1]=temp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"%s\\n\",a);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[20];\n int k,i,j,l,bar,temp,flag,var;\n scanf(\"%s\",a);\n scanf(\"%d\",&k);\n l=strlen(a);\n for(i=0;i<l;i++)\n a[i]=a[i]-'0';\n for(j=0;j<l;j++)\n {\n flag=0;\n for(i=j+1;i<(l>=k+j+1?k+j+1:l);i++)\n {\n if(a[i]>a[j])\n {\n var=i;\n flag=1;\n }\n }\n \n if(flag)\n {\n temp=a[var];\n for(bar=var-1;bar>=j;bar--)\n a[bar+1]=a[bar];\n a[j]=temp;\n k-=(var-j);\n }\n }\n for(i=0;i<l;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n //scanf(\"%d\",&j);\n return 0;\n}\n \n \n \n \n \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nmain()\n{\n char a[20];\n int k,i,j,l,bar,temp,flag,var;\n scanf(\"%s\",a);\n scanf(\"%d\",&k);\n l=strlen(a);\n for(i=0;i<l;i++)\n a[i]=a[i]-'0';\n for(j=0;j<l;j++)\n {\n flag=0;\n for(i=j+1;i<j+1+(l>=k?k:l);i++)\n {\n if(a[i]>a[j])\n {\n var=i;\n flag=1;\n }\n }\n \n if(flag)\n {\n temp=a[var];\n for(bar=var-1;bar>=j;bar--)\n a[bar+1]=a[bar];\n a[j]=temp;\n k-=(var-j);\n }\n }\n for(i=0;i<l;i++)\n printf(\"%d\",a[i]);\n printf(\"\\n\");\n //scanf(\"%d\",&j);\n return 0;\n}\n \n \n \n \n \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[20];\n scanf(\"%s\",a);\n int l=strlen(a);\n int k,i;\n scanf(\"%d\",&k);\n for(i=0;i<k;++i)\n {\n int j,ch=0;\n for(j=0;j<l-1;++j)\n {\n if(a[j]<a[j+1])\n {\n ch=1;\n break;\n }\n }\n if(ch==1)\n {\n char t=a[j];\n a[j]=a[j+1];\n a[j+1]=t;\n }\n }\n printf(\"%s\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a[20],i,j,k,top,tmp;\nlong long n;\n\nint main()\n{\n\tscanf(\"%I64d %d\",&n,&k);\n\ttop=0;\n\twhile (n)\n\t{\n\t\ttop++;\n\t\ta[top]=n%10;\n\t\tn/=10;\n\t}\n\tfor (i=1; i<=k; i++)\n\t for (j=top; j>1; j--)\n\t if (a[j]<a[j-1]) {tmp=a[j]; a[j]=a[j-1]; a[j-1]=tmp; break;}\n\tfor (i=top; i>1; i--) printf(\"%d\",a[i]);\n\tprintf(\"%d\\n\",a[1]);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char num[1000];\n int n,m,i,j,k,len,max,t;\n while(scanf(\"%s%d\",num,&n)!=-1)\n {\n len=strlen(num);\n while(n)\n {\n for(j=0;j<len;j++)\n {\n max=0;\n for(k=j+1;k<j+1+n;k++)\n {\n if(num[k]-'0'>max)\n {\n m=k;\n max=num[k]-'0';\n }\n }\n if(max>(num[j]-'0'))\n {\n for(i=m;i>j;i--)\n {\n t=num[i];\n num[i]=num[i-1];\n num[i-1]=t;\n }\n n=n-(m-j);\n if(n<=0)\n break;\n\n }\n }\n if(j==len)\n break;\n if(n<=0)\n break;\n }\n printf(\"%s\\n\",num);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int j,max,idx,n,k,i;\n char a[100],temp;\n scanf(\"%s%d\",a,&k);\n n=strlen(a);\n for(i=0;i<n-1;i++)\n {\n idx=i;\n max=a[i];\n for(j=i+1;j<=i+k;j++)\n if(a[j]>max)\n {\n idx=j;\n max=a[j];\n }\n if(idx!=i)\n {\n temp=a[idx];\n for(j=idx;j>i;j--)\n a[j]=a[j-1];\n a[i]=temp;\n k=k-idx+i;\n if(k<0)\n break;\n } \n }\n printf(\"%s\\n\",a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int n,k,i;\n char a[100],temp;\n scanf(\"%s%d\",a,&k);\n n=strlen(a);\n while(k--)\n {\n for(i=0;i<n-1;i++)\n if(a[i]<a[i+1])\n {\n temp=a[i];\n a[i]=a[i+1];\n a[i+1]=temp;\n break;\n }\n if(i==n-1)\n break;\n }\n printf(\"%s\\n\",a);\n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar s[30];\n\tint k,i;\n\tscanf(\"%s %d\",s,&k);\n\tfor(i=0;s[i+1]&&k>0;i++)\n\t{\n\t\tif(s[i]<s[i+1])\n\t\t{\n\t\t\tchar temp=s[i];\n\t\t\ts[i]=s[i+1];\n\t\t\ts[i+1]=temp;\n\t\t\tk--;\n\t\t}\n\t}\n\tprintf(\"%s\",s);\n\treturn(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nlong long A;\nint len, k;\nchar s[20];\n\nint main()\n{\n int temp, p = 0, i;\n scanf(\"%lld%d\", &A, &k);\n sprintf(s, \"%lld\", A);\n len = strlen(s);\n for(i = 0; i < len; i++)\n s[i] -= 48; \n for(; k > 0 && p < len; )\n {\n temp = p;\n for(i = 0; i <= k; i++)\n if(s[temp] < s[p + i])\n temp = p + i;\n if(temp != p)\n {\n int n = s[temp];\n for(i = temp; i > p; i--)\n {\n s[i] = s[i - 1];\n }\n s[p] = n;\n k -= temp - p;\n }\n p++;\n }\n A = 0;\n for(i = 0; i < len; i++)\n A = A * 10 + s[i];\n printf(\"%lld\", A);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min2(x,y) (x<y?x:y)\n\nint p[30];\n\nvoid f(int num, int len)\n{\n\tint i, k = 1, sum = p[1];\n\n\tif (len == 1)\n\t{\n\t\tprintf(\"%d\", p[1]);\n\t\treturn;\n\t}\n\n\tfor (i = 1; i <= min2(num + 1, len); i++)\n\t{\n\t\tif (sum < p[i]) sum = p[i], k = i;\n\t}\n\tp[k] = p[1];\n\tfor (i = 1; i <= len - 1; i++) p[i] = p[i + 1];\n\tprintf(\"%d\", sum);\n\tf(num - k + 1, len - 1);\n}\nint main()\n{\n\tint i, n, m;\n\tchar in[30];\n\n\tscanf(\"%s %d\", &in[1], &m);\n\tn = strlen(&in[1]);\n\tfor (i = 1; i <= n; i++) p[i] = in[i] - '0';\n\n\tf(m, n);\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar a[32];\nint l,b[32],st,m,swp;\nint swap(int x,int y)\n{\nchar ch;\nint i;\nif(y>x)\n{\n ch=a[y];\n for(i=y;i>x;i--)\n {\n a[i]=a[i-1];\n }\n a[i]=ch;\n}\nreturn 0;\n}\nmain()\n{\nint i,j,k;\nscanf(\"%s %d\",a,&k);\nswp=k;\nl=strlen(a);\nst=0;\nwhile(st<l-1)\n{\n m=a[st];\n j=0;\n for(i=st+1;i<l;i++)\n {\n if(a[i]>m)\n {\n m=a[i];\n b[j]=i;\n j++;\n }\n }\n m=0;\n for(i=j-1;i>=0;i--)\n {\n if(swp>=b[i]-st)\n {\n swap(st,b[i]);\n swp=swp-(b[i]-st);\n m=1;\n break;\n }\n }\n if(m==0)\n {\n if(j>0)\n {\n if(b[0]-st>swp)\n {\n swap(b[0]-swp,b[0]);\n break;\n }\n\n }\n }\n st++;\n}\nfor(i=0;i<l;i++)\n{\nprintf(\"%c\",a[i]);\n}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tchar number[20];\n\tint k;\n\tscanf(\"%s%d\",number,&k);\n\twhile((k--)>0) {\n\t\tint i;\n\t\tfor(i=0;number[i+1]!='\\0';i++) {\n\t\t\tif(number[i]<number[i+1]) {\n\t\t\t\tchar temp=number[i];\n\t\t\t\tnumber[i]=number[i+1];\n\t\t\t\tnumber[i+1]=temp;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tputs(number);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+1;m<i+k+1;m++)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\n\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0,p=k;\nscanf(\"%s %I64d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+1;m<i+p+1 && m<strlen(s);m++)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\np--;\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind;\nscanf(\"%s %d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{\nfor(m=i+k;m>i;m--)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>0)\n{\ns[ind]=s[ind-1];\nind--;\n}\ns[ind]=temp+'0';\nbreak;\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+k;m>i && m<strlen(s);m--)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\n\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %d\",s,&k);\n\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+1;m<i+k+1;m++)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\n\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+k;m>i && m<strlen(s);m--)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\nswap++;\n\nind--;\n}\ns[ind]=temp+'0';\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\\n\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %I64d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+1;m<i+k+1 && m<strlen(s);m++)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\ns[ind-1]=temp+'0';\nswap++;\n\nind--;\n}\n\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <strings.h>\nmain()\n{\nchar s[20];\nlong long int i,j,k,m,temp=-1,ind,swap=0;\nscanf(\"%s %d\",s,&k);\nfor(i=0;i<strlen(s);i++)\n{ temp=-1;\nfor(m=i+k;m>i && m<strlen(s);m--)\n{\nj=s[m]-'0';\nif(j>s[i]-'0' && j>temp)\n{\ntemp=j;\nind=m;\n\n}\n\n}\nif(temp!=-1)\n{\nwhile(ind>i)\n{\n\tif(swap==k)\n\tbreak;\ns[ind]=s[ind-1];\nswap++;\n\nind--;\n}\ns[ind]=temp+'0';\nif(swap==k)\n\tbreak;\n\n}\n}\nprintf(\"%s\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,c;\n scanf(\"%lld %d\",&a,&k);\n c=a;\n while(c>0)\n {\n number1[i]=c%10;\n c=c/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<=count && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,b;\n scanf(\"%lld %d\",&a,&k);\n b=a;\n while(b>0)\n {\n number1[i]=b%10;\n b=b/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<=count && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,c;\n scanf(\"%lld %d\",&a,&k);\n c=a;\n while(c>0)\n {\n number1[i]=c%10;\n c=c/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<=count && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,b;\n scanf(\"%lld %d\",&a,&k);\n b=a;\n while(b>0)\n {\n number1[i]=b%10;\n b=b/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<=count-current && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n \nint main(void) {\n int k,n,i=0,count,max,current=1,index,p,temp;\n int number[18],number1[18];\n long long int a,c;\n scanf(\"%lld %d\",&a,&k);\n c=a;\n while(c>0)\n {\n number1[i]=c%10;\n c=c/10;\n i++;\n }\n count=i;\n for(i=0;i<count;i++)\n {\n number[i]=number1[count-i-1];\n }\n while(k!=0 && current!=count)\n {\n p=0;\n max=-1;\n for(i=current;i<=count && p<k;i++)\n {\n if(number[i]>max)\n {\n index=i;\n max=number[i];\n }\n p++;\n }\n if(max>number[current-1])\n {\n while(index!=current-1)\n {\n temp=number[index];\n number[index]=number[index-1];\n number[index-1]=temp;\n index--;\n k--;\n }\n }\n current++;\n }\n for(i=0;i<count;i++)\n printf(\"%d\",number[i]);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint k;\nchar a[19];\nint st;\nint count;\nint max;\nint tmp;\n\nint main(){\n\n\tint i;\n\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<strlen(a);i++){\n\t\tif(a[i]!='9')\n\t\t\tbreak;\n\t\telse\n\t\t\tst++;\n\t}\n\n\twhile(k&&(st<strlen(a))){\n\t\tfor(i=0;i<k;i++){\n\t\t\tif(a[st]<a[st+1+i])\n\t\t\t\tif(a[st+1+i]>max){\n\t\t\t\t\tmax=a[st+1+i];\n\t\t\t\t\tcount = i+1;\n\t\t\t\t}\n\t\t}\n\n\t\tif(max!=0){\n\t\t\tfor(i=0;i<count;i++){\n\t\t\t\ttmp=a[st+count-i];\n\t\t\t\ta[st+count-i]=a[st+count-1-i];\n\t\t\t\ta[st+count-1-i]=tmp;\n\t\t\t}\n\t\t\tk-=count;\n\t\t}\n\n\t\tmax=0;\n\t\tcount=0;\n\t\tst++;\n\n\t}\n\n\tprintf(\"%s\",a);\n\t\t\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <string.h>\n\nint k;\nchar a[19];\nint st;\nint count;\nint max;\nint tmp;\n\nint main(){\n\n\tint i;\n\n\tscanf(\"%s\",a);\n\tscanf(\"%d\",&k);\n\n\tfor(i=0;i<sizeof(a);i++){\n\t\tif(a[i]!='9')\n\t\t\tbreak;\n\t\telse\n\t\t\tst++;\n\t}\n\n\twhile(k||st==sizeof(a)){\n\t\tfor(i=0;i<k;i++){\n\t\t\tif(a[st]<a[st+1+i])\n\t\t\t\tif(a[st+1+i]>max&&count<k){\n\t\t\t\t\tmax=a[st+1+i];\n\t\t\t\t\tcount = i+1;\n\t\t\t\t}\n\t\t}\n\n\t\tif(max!=0){\n\t\t\tfor(i=0;i<count;i++){\n\t\t\t\ttmp=a[st+count-i];\n\t\t\t\ta[st+count-i]=a[st+count-1-i];\n\t\t\t\ta[st+count-1-i]=tmp;\n\t\t\t}\n\t\t\tk-=count;\n\t\t\tmax=0;\n\t\t\tcount=0;\n\t\t}\n\t\tst++;\n\n\t}\n\n\tprintf(\"%s\",a);\n\t\t\n\treturn 0;\n\n}\n"}], "src_uid": "e56f6c343167745821f0b18dcf0d0cde"} {"nl": {"description": "There is an airplane which has n rows from front to back. There will be m people boarding this airplane.This airplane has an entrance at the very front and very back of the plane.Each person has some assigned seat. It is possible for multiple people to have the same assigned seat. The people will then board the plane one by one starting with person 1. Each person can independently choose either the front entrance or back entrance to enter the plane.When a person walks into the plane, they walk directly to their assigned seat and will try to sit in it. If it is occupied, they will continue walking in the direction they walked in until they are at empty seat - they will take the earliest empty seat that they can find. If they get to the end of the row without finding a seat, they will be angry.Find the number of ways to assign tickets to the passengers and board the plane without anyone getting angry. Two ways are different if there exists a passenger who chose a different entrance in both ways, or the assigned seat is different. Print this count modulo 109\u2009+\u20097.", "input_spec": "The first line of input will contain two integers n,\u2009m (1\u2009\u2264\u2009m\u2009\u2264\u2009n\u2009\u2264\u20091\u2009000\u2009000), the number of seats, and the number of passengers, respectively.", "output_spec": "Print a single number, the number of ways, modulo 109\u2009+\u20097.", "sample_inputs": ["3 3"], "sample_outputs": ["128"], "notes": "NoteHere, we will denote a passenger by which seat they were assigned, and which side they came from (either \"F\" or \"B\" for front or back, respectively).For example, one valid way is 3B, 3B, 3B (i.e. all passengers were assigned seat 3 and came from the back entrance). Another valid way would be 2F, 1B, 3F.One invalid way would be 2B, 2B, 2B, since the third passenger would get to the front without finding a seat."}, "positive_code": [{"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:28/09/2019 \n*/\n/*#include<algorithm>\n#include <bits/stdc++.h>\nusing namespace std;*/\n\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((int)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n\nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\n\nll binpow(ll a,ll b,ll m)\n{\n ll res=1;\n a=a%m;\n while(b>0)\n {\n if(b&1)\n res=(res*a)%m;\n a=a*a%m;\n b>>=1;\n }\n return res;\n}\nll multiply(ll a, ll b, ll mod) \n{ \n return ((a % mod) * (b % mod)) % mod; \n} \nint main()\n{\n\tll n,m;\n\tSC2(n,m);\n\tlong long ans=0;\n\tn++;\n\tlong long z=binpow(2,m,MOD);\n\tz*=binpow(n,m-1,MOD);\n\tlong long z1=(n-m+MOD)%MOD;\n\tlong long z2=multiply(z,z1,MOD);\n\tans=(z2);\n\tans=ans%MOD;\n\tprintf(\"%lld\\n\",ans);\n\n\treturn 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}"}, {"source_code": "#define M 1000000007\ninline int p(int s, int n){int a=1;for(;n;n&1?a=1ll*a*s%M:0,s=1ll*s*s%M,n>>=1);return a;}\nmain(n,m){scanf(\"%d%d\",&n,&m),++n;return!printf(\"%d\",1ll*(n-m)*p(n,M-2)%M*p(n<<1,m)%M);}"}], "negative_code": [{"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:28/09/2019 \n*/\n/*#include<algorithm>\n#include <bits/stdc++.h>\nusing namespace std;*/\n\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((int)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n\nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nll binpow(ll a,ll b,ll m)\n{\n ll res=1;\n a=a%m;\n while(b>0)\n {\n if(b&1)\n res=res*a%m;\n a=a*a%m;\n b>>=1;\n }\n return res;\n}\nint main()\n{\n\tll n,m;\n\tSC2(n,m);\n\tunsigned long long ans=0;\n\tn++;\n\tll x=2*n;\n\tunsigned long long z=binpow(x,m,MOD);\n\tz=z%MOD;\n\tunsigned long long z1=(n-m)%MOD;\n\tunsigned long long z2=(z*z1)%MOD;\n\tans=(z2/n);\n\tans=ans%MOD;\n\tprintf(\"%llu\\n\",ans);\n\n\treturn 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:28/09/2019 \n*/\n/*#include<algorithm>\n#include <bits/stdc++.h>\nusing namespace std;*/\n\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\n#define SC1(x) scanf(\"%lld\",&x)\n#define SC2(x,y) scanf(\"%lld%lld\",&x,&y)\n#define SC3(x,y,z) scanf(\"%lld%lld%lld\",&x,&y,&z)\n#define SCS(x) scanf(\"\\n%s\", x)\n#define PF1(x) printf(\"%lld\\n\",x)\n#define PF2(x,y) printf(\"%lld %lld\\n\",x,y)\n#define PF3(x,y,z) printf(\"%lld %lld %lld\\n\",x,y,z)\n#define REP(i,n) for(long long i=0;i<(n);i++)\n#define FOR(i,a,b) for(long long i=(a);i<=(b);i++)\n#define FORD(i,a,b) for(long long i=(a);i>=(b);i--)\n#define WHILE(n) while(n--)\n#define MEM(a, b) memset(a, (b), sizeof(a))\n#define ITOC(c) ((char)(((int)'0')+c))\n#define MID(s,e) (s+(e-s)/2)\n#define SZ(a) strlen(a)\n#define MOD 1000000007\n#define MAX 10000000005\n#define MIN -10000000005\n#define PI 3.1415926535897932384626433832795\n#define DEB(x) printf(\"The value of \\\"%s\\\" is: %d\\n\",#x,x)\n#define CASES ll t;SC1(t);while(t--)\n#define ABS(a) ((a>0)?a:-(a))\n\nconst int INF = 1<<29;\ntypedef long long ll;\ntypedef unsigned long long ull;\n#define FILEIO(name) \\ freopen(name\".in\", \"r\", stdin); \\ freopen(name\".out\", \"w\", stdout);\nint cmp(const void * a,const void * b);\nlong long maxv(long long a,long long b);\nlong long minv(long long a,long long b);\nlong long gcd(long long u,long long v);\nll binpow(ll a,ll b,ll m)\n{\n ll res=1;\n a=a%m;\n while(b>0)\n {\n if(b&1)\n res=res*a%m;\n a=a*a%m;\n b>>=1;\n }\n return res;\n}\nll multiply(ll a, ll b, ll mod) \n{ \n return ((a % mod) * (b % mod)) % mod; \n} \nint main()\n{\n\tll n,m;\n\tSC2(n,m);\n\tunsigned long long ans=0;\n\tn++;\n\tll x=2*n;\n\tunsigned long long z=binpow(x,m,MOD);\n\tz=z%MOD;\n\tunsigned long long z1=(n-m)%MOD;\n\tunsigned long long z2=multiply(z,z1,MOD);\n\tans=(z2/n);\n\tans=ans%MOD;\n\tprintf(\"%llu\\n\",ans);\n\n\treturn 0;\n}\n \n \n//qsort(arr,n,sizeof(arr[0]),cmp);\nint cmp (const void * a, const void * b)\n{\n if( *(ll*)a - *(ll*)b < 0 ) return -1;\n if( *(ll*)a - *(ll*)b > 0 ) return 1;\n return 0;\n}\nlong long maxv(long long a,long long b)\n{\n if(a>b) return a;\n return b;\n}\nlong long minv(long long a,long long b)\n{\n if(a<b) return a;\n return b;\n}\nlong long gcd(long long u,long long v)\n{\n if (v == 0) return u; \n return gcd(v, u%v);\n}"}], "src_uid": "4f9711197e699c0fd0c4e9db8323cac7"} {"nl": {"description": "Pupils decided to go to amusement park. Some of them were with parents. In total, n people came to the park and they all want to get to the most extreme attraction and roll on it exactly once.Tickets for group of x people are sold on the attraction, there should be at least one adult in each group (it is possible that the group consists of one adult). The ticket price for such group is c1\u2009+\u2009c2\u00b7(x\u2009-\u20091)2 (in particular, if the group consists of one person, then the price is c1). All pupils who came to the park and their parents decided to split into groups in such a way that each visitor join exactly one group, and the total price of visiting the most extreme attraction is as low as possible. You are to determine this minimum possible total price. There should be at least one adult in each group. ", "input_spec": "The first line contains three integers n, c1 and c2 (1\u2009\u2264\u2009n\u2009\u2264\u2009200\u2009000, 1\u2009\u2264\u2009c1,\u2009c2\u2009\u2264\u2009107)\u00a0\u2014 the number of visitors and parameters for determining the ticket prices for a group. The second line contains the string of length n, which consists of zeros and ones. If the i-th symbol of the string is zero, then the i-th visitor is a pupil, otherwise the i-th person is an adult. It is guaranteed that there is at least one adult. It is possible that there are no pupils.", "output_spec": "Print the minimum price of visiting the most extreme attraction for all pupils and their parents. Each of them should roll on the attraction exactly once.", "sample_inputs": ["3 4 1\n011", "4 7 2\n1101"], "sample_outputs": ["8", "18"], "notes": "NoteIn the first test one group of three people should go to the attraction. Then they have to pay 4\u2009+\u20091\u2009*\u2009(3\u2009-\u20091)2\u2009=\u20098.In the second test it is better to go to the attraction in two groups. The first group should consist of two adults (for example, the first and the second person), the second should consist of one pupil and one adult (the third and the fourth person). Then each group will have a size of two and for each the price of ticket is 7\u2009+\u20092\u2009*\u2009(2\u2009-\u20091)2\u2009=\u20099. Thus, the total price for two groups is 18."}, "positive_code": [{"source_code": "#include<stdio.h>\n#define lli long long int\n\nlli n,c1,c2,pr=0;\n\nlli calc(lli gr)\n{\n lli num=n/gr;\n lli r=n%gr;\n lli ret=gr*c1;\n ret+=r*(n/gr)*(n/gr)*c2;\n ret+=(gr-r)*(n/gr-1)*(n/gr-1)*c2;\n return ret;\n}\n\nint main() {\n scanf(\"%lld%\",&n);\n scanf(\"%lld%\",&c1);\n scanf(\"%lld%\",&c2);\n char s[n+1];\n gets(s);\n int ch=0;\n int i;\n for(i=0;i<n;i++)\n if(s[i]=='1')\n pr++;\n else\n ch++;\n int l=1,h=pr;\n lli ans=calc(l);\n for(i=l+1;i<=h;i++)\n {\n lli cur=calc(i);\n if(cur<ans)\n ans=cur;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[200005];\nlong long cnt,n,c1,c2,ans;\nlong long f(long long x) {\n\treturn c2*x*x;\n}\nint main() {\n\tscanf(\"%lld%lld%lld\",&n,&c1,&c2);\n\tscanf(\"%s\",s+1);\n\tfor(int i=1;i<=n;i++)\n\t\tif(s[i]=='1')\n\t\t\tcnt++;\n//\tprintf(\"%lld\\n\",cnt);\n\tans=1e18;\n\tfor(long long i=1;i<=cnt;i++) {\n\t\tlong long tmp=n%i,o=n/i,res=0;\n//\t\tprintf(\"%lld %lld %lld\\n\",i,tmp,o);\n\t\tres=i*c1+tmp*f(o)+(i-tmp)*f(o-1);\n\t\tif(ans>res)\n\t\t\tans=res;\n\t}\n\tprintf(\"%lld\\n\",ans);\n}"}, {"source_code": "#include<stdio.h>\nchar s[200005];\nlong long X,XX;\nlong long cal(long long x,long long all){\n long long t,tt;\n long long ANS;\n ANS=0;\n t=all/x;\n tt=all%x;\n ANS+=(x-tt)*(X+XX*(t-1)*(t-1));\n ANS+=tt*(X+XX*t*t);\n return ANS;\n}\nint main(void){\n long long i,j,n,m,P,A,L,R,M,MM;\n long long ANS,ANSS;\n scanf(\"%I64d %I64d %I64d\",&n,&X,&XX);\n scanf(\"%s\",s);\n P=A=0;\n for(i=0;i<n;i++){\n if(s[i]=='1') A++;\n else P++;\n }\n L=1;R=A;\n while(L<R){\n M=(L+R)/2;\n MM=(M+R)/2;\n if(MM==M) MM++;\n //cout<<M<<\" \"<<MM<<endl;\n ANS=cal(M,n);\n ANSS=cal(MM,n);\n //cout<<ANS<<\" \"<<ANSS<<endl;\n if(ANS<ANSS) R=MM-1;\n else L=M+1;\n }\n //cout<<L<<endl;\n ANS=cal(L,n);\n ANSS=cal(R,n);\n printf(\"%I64d\\n\",ANS<ANSS?ANS:ANSS);\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long LL;\nint n;\nLL c1,c2,ans;\nLL f(int x)\n{\n int a=n%x,b=x-a;\n LL ans=c1*x;\n ans+=a*c2*(n/x)*(n/x);\n ans+=b*c2*(n/x-1)*(n/x-1);\n return ans;\n}\nLL min(LL a,LL b){return a<b?a:b;}\nint main()\n{\n scanf(\"%d%I64d%I64d \",&n,&c1,&c2);\n char c;\n ans=c1+c2*(n-1)*(n-1);\n int x=0,y=0,k,i;\n for(k=1;k<=n;++k)\n {\n c=getchar();\n if(c=='0')++x;\n else ++y;\n }\n for(i=1;i<=y;++i)\n ans=min(ans,f(i));\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar s[200100];\nint main()\n{\n int n;\n long long c1 , c2;\n scanf(\"%d%lld%lld\" , &n , &c1 , &c2);\n scanf(\"%s\" , s);\n long long sum1 = 0 , sum2 = 0;\n for(int i = 0 ; i<n ; i++)\n {\n sum1+= s[i]=='1';\n sum2+= s[i]=='0';\n }\n long long x = sum1 , mini = 1e18;\n while(x>0)\n {\n long long z = sum2 / x;\n long long rem = sum2 % x;\n long long ans = rem * (c1 + (z+1)*(z+1)*c2) + (x-rem)*(c1 + (z)*(z)*c2);\n if(ans < mini) mini = ans;\n x--;\n sum2++;\n }\n printf(\"%lld\\n\" , mini);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <assert.h>\n\nint N, C1, C2;\nchar seq[ ( int ) 2e5 ];\nint adult, child;\n\nlong long sqr( int x ) {\n return 1LL * x * x;\n}\n\nlong long calc( int g ) {\n int ln = N / g; // number of people in less group\n int lc = g - N % g; // number of groups of less people\n int gn = ln + 1;\n int gc = N % g;\n return ( sqr( ln - 1 ) * C2 + C1 ) * lc + ( sqr( gn - 1 ) * C2 + C1 ) * gc;\n}\n\nsigned main() {\n scanf( \"%d %d %d\", &N, &C1, &C2 );\n scanf( \"%s\", seq );\n for( int i = 0; i < N; ++i ) {\n if( seq[ i ] == '1' ) {\n ++adult;\n } else {\n ++child;\n }\n }\n int lb = 1, ub = adult;\n while( ub - lb > 10 ) {\n int x = lb + ( ub - lb ) / 3;\n int y = lb + ( ub - lb ) * 2 / 3;\n long long a = calc( lb ), b = calc( x ), c = calc( y ), d = calc( ub );\n if( a <= b && b <= c && c <= d ) {\n ub = x;\n } else if( a >= b && b <= c && c <= d ) {\n ub = y;\n } else if( a >= b && b >= c && c <= d ) {\n lb = x;\n } else if( a >= b && b >= c && c >= d ) {\n lb = y;\n } else {\n assert( 0 );\n }\n }\n long long ans = 1LL << 60;\n for( int i = lb; i <= ub; ++i ) {\n long long t = calc( i );\n if( ans > t ) {\n ans = t;\n }\n }\n printf( \"%lld\\n\", ans );\n return 0;\n}\n"}, {"source_code": "//created by missever\n\n#include<stdio.h>\ntypedef long long LL;\nchar s[200005];\n\nLL min(LL a,LL b)\n{\n if(a > b) return b;\n else return a;\n}\n\nint main(){\n int n,c1,c2,i,b;\n LL ans;\n b = 0;\n scanf(\"%d%d%d\",&n,&c1,&c2);\n scanf(\"%s\",s);\n for(i = 0;i < n; i++)\n {\n if(s[i] == '1') b++;\n }\n ans = c1 + 1LL * c2 * (n - 1) * (n - 1);\n for(i = 2;i <= b; i++) ans = min(ans,(n % i) * (c1 + 1LL * c2 * (n / i) * (n / i)) +\n (i - n % i) * (c1 + 1LL * c2 * (n / i - 1) * (n / i - 1)));\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nchar s[200005];\n\nint main() {\n\tlong long n, c1, c2, i;\n\tscanf(\"%lld %lld %lld\", &n, &c1, &c2);\n\tscanf(\"%s\", s);\n\n\tint adult = 0;\n\n\tfor (int i = 0; i < n; i++) {\n\t\tif (s[i] == '1') adult++;\n\t}\n\n\tlong long res = 1e18;\n\n\tfor (i = 1; i <= adult; i++) {\n\t\tlong long g = (n - i) / i, rem = (n - i) % i;\n\t\tlong long cur = i * c1;\n\t\tcur += rem * c2 * (g + 1) * (g + 1);\n\t\tcur += (i - rem) * c2 * g * g;\n\t\tif (res > cur) res = cur;\n\t}\n\n\tprintf(\"%lld\\n\", res);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%lld%lld%lld\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 1e18;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '1')\n s1++;\n }\n long long a, b;\n for(i = 1; i <= s1; i++) {\n long long tmp = i * c1;\n tmp += (n % i) * (n / i) * (n / i) * c2 + (i - n % i) * (n / i - 1) * (n / i - 1) * c2;\n if(sum > tmp)\n sum = tmp;\n }\n printf(\"%lld\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\ntypedef long long LL;\nint n, c1, c2;\nchar st[200010];\nLL min(LL a, LL b){return a < b ? a : b;}\n\nint main()\n{\n\tint m, l, r, mid, i;\n\tLL ans, num, res;\n\tscanf(\"%d%d%d %s\", &n, &c1, &c2, st);\n\tm = 0;\n\tfor(i = 0; i < n; ++i)\n\t\tif(st[i] == '1')\n\t\t\t++m;\n\tans = c1 + 1ll * c2 * (n - 1) * (n - 1); \n\tfor(num = 2; num <= m; ++num) {\n\t\tres = num * c1;\n\t\tr = n % num;\n\t\tl = n / num;\n\t\tres += 1ll * c2 * l * l * r + 1ll * c2 * (l - 1) * (l - 1) * (num - r);\n\t\tans = min(ans, res);\n\t}\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar s[200005];\n\nint main(){\n long long n, c1, c2;\n scanf(\"%I64d%I64d%I64d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long adult=0;\n for(int i=0; s[i]; i++){\n if(s[i] == '1') adult++;\n }\n long long res = 1e18;\n for(int gr=1; gr<=adult; gr++){\n long long ppltoadd = n-gr;\n long long cur = 0;\n long long grsz = ppltoadd/gr;\n long long more = ppltoadd%gr;\n cur = ((grsz+1)*(grsz+1)*c2 + c1)*more;\n cur += (grsz*grsz*c2 + c1)*(gr-more);\n if(cur < res) res = cur;\n }\n printf(\"%I64d\", res);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nchar S[200010];\nll min(ll a,ll b){\n return a<b?a:b;\n}\nint main(){\n\tll n,c1,c2,a=0,res=1e18;\n\tscanf(\"%lld%lld%lld\",&n,&c1,&c2);\n\tscanf(\"%s\",S);\n\tfor(ll i=0;i<n;i++){\n\t\tif(S[i]=='1') a++;\n\t}\n\tfor(ll i=1;i<=a;i++){\n\t\tres=min(res, c1*i+c2*( (n/i)*(n/i)*(n%i) + (n/i-1ll)*(n/i-1ll)*(i-n%i) ) );\n\t}\n\tprintf(\"%lld\\n\",res);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n\nchar st[(200000)+99];\n\nint main()\n{\n\t//freopen(\"a.in\" , \"r\", stdin);\n\t//freopen(\"a.out\", \"w\", stdout);\n\tlong long n , c1 , c2 , mn = 1ll << 60 , cur;\n\n\twhile(scanf(\"%I64d\",&n) == 1)\n {\n mn = 1ll << 60;\n scanf(\"%I64d %I64d\",&c1 , &c2);\n char ch;\n int big = 0;\n\n\n scanf(\"%s\" ,st);\n for(int i = 0 ; i < n ; ++i){\n\n char ch = st[i];\n if(ch == '1') big++;\n }\n\n for(int i = 1 ; i <= big ; ++i){\n int sz1 = n;\n int rem = sz1 % i;\n int sz2 = sz1 / i;\n long long fn1 , fn2;\n fn1 = (i - rem) * (c1 + c2 * (sz2 - 1) * (sz2-1) );\n fn2 = rem * ( c1 + c2 * sz2 * sz2);\n\n if(mn > fn1 + fn2) mn = fn1 + fn2;\n\n }\n\n printf(\"%I64d\\n\",mn);\n\n\n }\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n#define ll long long\n\nchar s[200005];\nll n,c1,c2;\nll fr[2];\n\nint main()\n{\n\tint t,i,j,k;\n\t\n\tscanf(\"%I64d%I64d%I64d %s\",&n,&c1,&c2,s);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfr[ s[i]-'0' ]++;\n\t}\n\t\n\tll rs=(1LL<<61);\n\tfor(ll q=1;q<=fr[1];q++)\n\t{\n\t\tll rem=fr[1]-q+fr[0];\n\t\tll d=rem/q;\n\t\tll rmx=rem%q;\n\t\t\n\t\tll qx;\n\t\t\n\t\tqx=c1*q+c2*(d+1)*(d+1)*rmx+c2*d*d*(q-rmx);\n\t\t\n\t\tif(qx<rs)rs=qx;\n\t}\n\tprintf(\"%I64d\\n\",rs);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <limits.h>\n\nchar S[500003];\n\nint main() {\n long long int t,n;\n char str[101];\n long long int c1,c2;\n scanf(\"%lld%lld%lld\",&n,&c1,&c2);\n scanf(\"%s\",S);\n long long int i,a,b,c,d;\n a=b=0;\n for(i=0;i<n;i++){\n if(S[i]=='1') a++;\n else b++;\n }\n long long int z,ans = LLONG_MAX,orgA,orgB;\n orgA=a;\n orgB=b;\n for(i=1;i<=orgA;i++){\n a=i;\n b=orgB+(orgA-i);\n t=b/a;\n c=c1+c2*t*t;\n d=c1+c2*(t+1)*(t+1);\n z=d*(b%a)+c*(a-b%a);\n if(z<ans) ans=z;\n }\n printf(\"%lld\\n\",ans);\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n\nlong long solve(int n, int g, int c1, int c2) {\n\tlong long a = n / g;\n\tlong long r = n % g;\n\tlong long p1 = r * (c1 + a * a * c2);\n\tlong long p2 = (g - r) * (c1 + (a - 1) * (a - 1) * c2);\n\n\treturn p1 + p2;\n}\n\nint main() {\n\tstatic char s[200001];\n\tlong long min;\n\tint n, c1, c2, i, g;\n\tint k;\n\n\tscanf(\"%d%d%d\", &n, &c1, &c2);\n\tscanf(\"%s\", s);\n\tk = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == '1')\n\t\t\tk++;\n\tmin = LLONG_MAX;\n\tfor (g = 1; g <= k; g++) {\n\t\tlong long cost = solve(n, g, c1, c2);\n\n\t\tif (min > cost)\n\t\t\tmin = cost;\n\t}\n\tprintf(\"%lld\\n\", min);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nchar s[200005];\nint main() {\n\tint n, c1, c2;\n\tscanf(\"%d%d%d\", &n, &c1, &c2);\n\tscanf(\"%s\", s);\n\tint m = 0;\n\tfor (int i = 0; i < n; ++ i) m += s[i] == '1';\n\tn -= m;\n\tlong long ans = -1;\n\tfor (int x = 1; x <= m; ++ x) {\n\t\tint r = n + m - x;\n\t\tlong long cost = 1LL * c1 * x + 1LL * (r / x) * (r / x) * c2 * (x - r % x) + 1LL * (r / x + 1) * (r / x + 1) * c2 * (r % x);\n\t\tif (ans == -1 || cost < ans) ans = cost;\n\t}\n\tprintf(\"%I64d\\n\", ans);\nreturn 0;\n}\n"}, {"source_code": "#include \"stdio.h\"\n\n\nconst int N = 2e5 + 5;\n\nint n;\nlong long a, b;\nchar s[200100];\nint p, c, i, j;\nlong long ans, cur;\n\nint main() {\n scanf(\"%d %I64d %I64d\", &n, &a, &b);\n scanf(\"%s\", s);\n p = c = 0;\n for (i = 0; i < n; i++) {\n p += s[i] == '1';\n c += s[i] == '0';\n }\n ans = -1;\n for (i = 1; i <= p; i++) {\n cur = a * i;\n long long x = (n-i)/i, z = (n-i) % i;\n cur += x * x * b * (i-z);\n x++;\n cur += x * x * b * z;\n if (ans == -1 || ans > cur)\n ans = cur;\n }\n printf(\"%I64d\\n\", ans);\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#define lli long long int\n\nlli n,c1,c2,pr=0;\n\nlli calc(lli gr)\n{\n if(gr==0 || gr>pr)\n return 1000000000000000;\n lli num=n/gr;\n lli r=n%gr;\n lli ret=gr*c1;\n ret+=r*(n/gr)*(n/gr)*c2;\n ret+=(gr-r)*(n/gr-1)*(n/gr-1)*c2;\n return ret;\n}\n\nint main() {\n scanf(\"%lld%\",&n);\n scanf(\"%lld%\",&c1);\n scanf(\"%lld%\",&c2);\n char s[n+1];\n gets(s);\n int ch=0;\n int i;\n for(i=0;i<n;i++)\n if(s[i]=='1')\n pr++;\n else\n ch++;\n int l=1,h=pr;\n lli ans;\n while(l<=h)\n {\n int mid=(l+h)/2;\n lli n1=calc(mid-1);\n lli n2=calc(mid+1);\n lli nm=calc(mid);\n if(n1>nm && n2>nm)\n {ans=nm;\n break;}\n else if(n2<nm)\n l=mid+1;\n else\n h=mid-1;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define lli long long int\n\nlli n,c1,c2,pr=0;\n\nlli calc(lli gr)\n{\n if(gr==0 || gr>pr)\n return 1000000000000000;\n lli num=n/gr;\n lli r=n%gr;\n lli ret=gr*c1;\n ret+=r*(n/gr)*(n/gr)*c2;\n ret+=(gr-r)*(n/gr-1)*(n/gr-1)*c2;\n return ret;\n}\n\nint main() {\n scanf(\"%lld%\",&n);\n scanf(\"%lld%\",&c1);\n scanf(\"%lld%\",&c2);\n char s[n+1];\n gets(s);\n int ch=0;\n int i;\n for(i=0;i<n;i++)\n if(s[i]=='1')\n pr++;\n else\n ch++;\n int l=1,h=pr;\n lli ans;\n while(l<=h)\n {\n int mid=(l+h)/2;\n lli n1=calc(mid-1);\n lli n2=calc(mid+1);\n lli nm=calc(mid);\n if(n1>nm && n2>nm)\n {ans=nm;\n break;}\n else if(n1>nm)\n ans=nm,l=mid+1;\n else\n h=mid-1;\n }\n printf(\"%lld\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long LL;\nint n;\nLL c1,c2,ans;\nLL f(int x)\n{\n int a=n%x,b=x-a;\n LL ans=c1*x;\n ans+=a*c2*(n/x)*(n/x);\n ans+=b*c2*(n/x-1)*(n/x-1);\n return ans;\n}\nLL min(int a,int b){return a<b?a:b;}\nint main()\n{\n scanf(\"%d%I64d%I64d \",&n,&c1,&c2);\n char c;\n ans=c1+c2*(n-1)*(n-1);\n int x=0,y=0,k,i;\n for(k=1;k<=n;++k)\n {\n c=getchar();\n if(c=='0')++x;\n else ++y;\n }\n for(i=1;i<=y;++i)\n ans=min(ans,f(i));\n printf(\"%I64d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nchar s[200005];\n\nint main() {\n int n, c1, c2, i;\n scanf(\"%d %d %d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n \n int adult = 0;\n \n for (int i = 0; i < n; i++) {\n if (s[i] == '1') adult++;\n }\n \n long long res = 1e18;\n for (i = 1; i <= adult; i++) {\n int extra = n - i;\n int x = 1 + extra / i;\n \n int a = extra % i;\n int b = i - a;\n \n long long cur = i * c1;\n \n if (a > 0) {\n cur += a * 1LL * c2 * x * x;\n }\n if (x > 0) {\n cur += b * 1LL * c2 * (x - 1) * (x - 1);\n }\n \n if (res > cur) res = cur;\n }\n \n printf(\"%lld\\n\", res);\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 0x3f3f3f3f;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = 1; i <= s1; i++) {\n long long tmp = i * c1;\n tmp += (n % i) * ((n / i) * (n / i) * c2 ) + (i - n % i) * ( (n / i - 1) * (n / i - 1) * c2);\n sum = min(sum, tmp);\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 2147483647;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 1000000000000000000;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 0x3f3f3f3f;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%lld%lld%lld\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 0x3f3f3f3f;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%lld\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 200000010;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 0x3f3f3f3f;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = 1; i <= s1; i++) {\n long long tmp = i * c1;\n tmp += (n % i) * ((n / i) * (n / i) * c2 ) + (i - n % i) * ( (n / i - 1) * (n / i - 1) * c2);\n if(sum > tmp)\n sum = tmp;\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 200010;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 0xFFFFFFFF;\n long long s0 = 0;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n long long a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main() {\n long long n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n long long len = strlen(s);\n long long sum = 1e18;\n long long s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '1')\n s1++;\n }\n long long a, b;\n for(i = 1; i <= s1; i++) {\n long long tmp = i * c1;\n tmp += (n % i) * (n / i) * (n / i) * c2 + (i - n % i) * (n / i - 1) * (n / i - 1) * c2;\n if(sum > tmp)\n sum = tmp;\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#define min(a,b) a<b?a:b\nint main() {\n int n, c1, c2, i;\n char s[200010];\n scanf(\"%d%d%d\", &n, &c1, &c2);\n scanf(\"%s\", s);\n int len = strlen(s);\n int sum = 200010;\n int s0 = 0;\n int s1 = 0;\n for(i = 0; i < len; i++) {\n if(s[i] == '0')\n s0++;\n else\n s1++;\n }\n int a, b;\n for(i = s1; i >= 1; i--) {\n sum = min(sum, ((n % i) * (c1 + (n / i) * (n / i) * c2 )+ (i - n % i) *(c1 + (n / i - 1) * (n / i - 1) * c2)));\n }\n printf(\"%d\\n\", sum);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\ntypedef long long LL;\nint n, c1, c2;\nchar st[200010];\nLL solve(LL x)\n{\n\tLL a = n / x, b = n % x;\n\tLL res = (c1 + 1ll * c2 * (a - 1) * (a - 1)) * (x - b);\n\tres += (c1 + 1ll * c2 * a * a) * b;\n\treturn res;\n}\nLL min(LL a, LL b){return a < b ? a : b;}\n\nint main()\n{\n\tint m, l, r, mid, i;\n\tLL ans;\n\tscanf(\"%d%d%d %s\", &n, &c1, &c2, st);\n\tm = 0;\n\tfor(i = 0; i < n; ++i)\n\t\tif(st[i] == '1')\n\t\t\t++m;\n\tans = 1ll * n * c1;\n\tl = 2, r = m, mid;\n\twhile(l <= r) {\n\t\tmid = (l + r) >> 1;\n\t\tLL res1 = solve(mid);\n\t\tLL res2 = solve(mid - 1);\n\t\tif(res1 <= res2) {\n\t\t\tans = min(ans, res1);\n\t\t\tr = mid - 1;\n\t\t}\n\t\telse {\n\t\t\tans = min(ans, res2);\n\t\t\tl = mid + 1;\n\t\t}\n\t}\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <math.h>\n#include <stdio.h>\n\nchar st[(200000)+99];\n\nint main()\n{\n\t//freopen(\"a.in\" , \"r\", stdin);\n\t//freopen(\"a.out\", \"w\", stdout);\n\tlong long n , c1 , c2 , mn = 1ll << 60 , cur;\n\n\twhile(scanf(\"%I64d\",&n) == 1)\n {\n mn = 1ll << 60;\n scanf(\"%I64d %I64d\",&c1 , &c2);\n char ch;\n int big = 0;\n\n\n scanf(\"%s\" ,st);\n for(int i = 0 ; i < n ; ++i){\n\n char ch = st[i];\n if(ch == '1') big++;\n }\n\n for(int i = 1 ; i <= big ; ++i){\n\n int sz2 = n % i; // have size e i+1\n int sz1 = i - sz2; // have size e i\n\n int fn1 = n / i;\n int fn2 = fn1 + 1;\n\n cur = 0;\n if(sz1 > 0){\n long long t = (c1 + c2*(fn1 - 1)*(fn1 - 1 ));\n cur += t * sz1;\n }\n ;\n if(sz2 > 0){\n long long t = (c1 + c2*(fn2)*(fn2));\n cur += t * sz2;\n }\n\n if(mn > cur) mn = cur;\n\n }\n\n printf(\"%I64d\\n\",mn);\n\n\n }\n\treturn 0;\n}\n"}], "src_uid": "78d013b01497053b8e321fe7b6ce3760"} {"nl": {"description": "You are at a water bowling training. There are l people who play with their left hand, r people, who play with their right hand, and a ambidexters, who can play with left or right hand.The coach decided to form a team of even number of players, exactly half of the players should play with their right hand, and exactly half of the players should play with their left hand. One player should use only on of his hands.Ambidexters play as well with their right hand as with their left hand. In the team, an ambidexter can play with their left hand, or with their right hand.Please find the maximum possible size of the team, where equal number of players use their left and right hands, respectively.", "input_spec": "The only line contains three integers l, r and a (0\u2009\u2264\u2009l,\u2009r,\u2009a\u2009\u2264\u2009100) \u2014 the number of left-handers, the number of right-handers and the number of ambidexters at the training. ", "output_spec": "Print a single even integer\u00a0\u2014 the maximum number of players in the team. It is possible that the team can only have zero number of players.", "sample_inputs": ["1 4 2", "5 5 5", "0 2 0"], "sample_outputs": ["6", "14", "0"], "notes": "NoteIn the first example you can form a team of 6 players. You should take the only left-hander and two ambidexters to play with left hand, and three right-handers to play with right hand. The only person left can't be taken into the team.In the second example you can form a team of 14 people. You have to take all five left-handers, all five right-handers, two ambidexters to play with left hand and two ambidexters to play with right hand."}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main() {\n int l, r, a;\n int ans;\n scanf (\"%d %d %d\", &l, &r, &a);\n if (l > r) {\n if (l - r >= a) {\n ans = (r + a) * 2;\n }\n else {\n ans = 2 * l + (a - (l - r)) / 2 * 2;\n }\n }\n else if (l == r) {\n ans = l + r + a / 2 * 2;\n }\n else {\n if (r - l >= a) {\n ans = (l + a) * 2;\n }\n else {\n ans = 2 * r + (a - (r - l)) / 2 * 2;\n }\n }\n\n printf (\"%d\", ans);\n return 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\nint main ()\n{\n int l,r,a,count;\n scanf(\"%d %d %d\",&l,&r,&a);\n int difference= abs(l-r);\n\n if (l==r)\n {\n count=2*l+a;\n\n if (count &1!=0)\n --count;\n }\n else if ( l<r)\n {\n if (difference>=a)\n {\n l=l+a;\n count=l+l;\n }\n else\n {\n a=a-difference;\n if (a&1!=0)\n --a;\n count =r+r+a;\n }\n\n }\n else if (r<l)\n {\n if (difference>=a)\n {\n r=r+a;\n count=r+r;\n }\n else\n {\n a=a-difference;\n if (a&1!=0)\n --a;\n\n count =l+l+a;\n }\n }\n\n printf(\"%d\\n\",count);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint l, r, a, _max, _min;\n\tscanf(\"%d %d %d\", &l, &r, &a);\n\tif (l > r)\n\t{\n\t\t_max = l;\n\t\t_min = r;\n\t} else if (l < r)\n\t{\n\t\t_min = l;\n\t\t_max = r;\n\t} else\n\t{\n\t\tprintf(\"%d\", l + r + (a % 2 > 0 ? a - 1 : a));\n\t\treturn 0;\n\t}\n\tif (_min + a <= _max)\n\t\tprintf(\"%d\", (_min + a) << 1);\n\telse\n\t{\n\t\tint b = _min + a - _max;\n\t\tprintf(\"%d\", (_max << 1) + (b % 2 > 0 ? b - 1 : b));\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,x,t;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((l==0&&a==0)||(r==0&&a==0))\n t=0;\n else if(l==0&&r==0)\n t=2*(a/2);\n else if(l>r)\n {\n x=l-r;\n if(a>x)\n {\n r=r+x;\n a=a-x;\n t=2*r+2*(a/2);\n }\n else\n {\n r=r+a;\n t=2*r;\n }\n }\n else if(r>l)\n {\n x=r-l;\n if(a>x)\n {\n l=l+x;\n a=a-x;\n t=2*l+2*(a/2);\n }\n else\n {\n l=l+a;\n t=2*l;\n }\n }\n else if(l==r)\n t=2*r+2*(a/2);\n printf(\"%d\",t);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint l,r,am;\n\tint min=0,max=0;\n\tscanf(\"%d %d %d\",&l,&r,&am);\n\n\tmin=(l>r)?r:l;\n\tmax=(r>l)?r:l;\n\tif((min+am)<=max)\n printf(\"%d\\n\",2*(min+am));\n\telse\n\t printf(\"%d\\n\",2*(max+(am-max+min)/2));\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,i,p;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l>r)\n {\n for(i=1;i!=0;i=i+1)\n {\n if(a==0)\n {\n printf(\"%d\",(r*2));\n exit(0);\n }\n r=r+1;\n a=a-1;\n if(l==r)\n {\n p=a/2;\n printf(\"%d\",(l+p)*2);\n exit(0);\n }\n }\n }\n else if(l<r)\n {\n for(i=1;i!=0;i=i+1)\n {\n if(a==0)\n {\n printf(\"%d\",(l*2));\n exit(0);\n }\n l=l+1;\n a=a-1;\n if(l==r)\n {\n p=a/2;\n printf(\"%d\",(l+p)*2);\n exit(0);\n }\n }\n }\n else if(l==r)\n {\n p=a/2;\n printf(\"%d\",(l+p)*2);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,count=0,flag;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l<=r)\n {\n count=l*2;\n r=r-l;\n flag=0;\n }\n else\n {\n count=r*2;\n l=l-r;\n flag=1;\n }\n if(flag==0)\n {\n if(a<=r)\n count=count+(a*2);\n else\n {\n count=count+(r*2);\n a=a-r;\n if(a%2==0)\n count=count+a;\n else\n count=count+a-1;\n }\n }\n if(flag==1)\n {\n if(a<=l)\n count=count+(a*2);\n else\n {\n count=count+(l*2);\n a=a-l;\n if(a%2==0)\n count=count+a;\n else\n count=count+a-1;\n }\n }\n printf(\"%d\",count);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\n//#include<string.h>\n//#include<math.h>\n//#include<stdlib.h>\n\nint main()\n{\n int l,r,a,i,j,k,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==0 && a==0) printf(\"0\");\n else if(r==0 && a==0) printf(\"0\");\n else if(l>r) {s+=r;l=l-r;\n if(l<=a) a=a+l;\n else a=a*2;\n k=a/2;\n s+=k;\n printf(\"%d\",s*2);\n }\n else if(l==r) {s+=r;l=l-r;\n if(l<=a) a=a+l;\n else a=a*2;\n k=a/2;\n s+=k;\n printf(\"%d\",s*2);\n }\n else {s+=l;r=r-l;\n if(r<=a) a=a+r;\n else a=a*2;\n k=a/2;\n s+=k;\n printf(\"%d\",s*2);\n }\n\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\t\tint i,j,r,l,a,cnt;\n\t\twhile(scanf(\"%d %d %d \",&l,&r,&a)!=EOF){\n\t\t\t\tcnt=0;\n\t\t\t\tif(l>r){\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\n\n\t\t\t\t}\n\t\t\t\telse if(r>l){\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n//\tprintf(\"cnt%d\\n\",cnt);\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\t\t\t\t}\n\t\t\t\telse if(r==l){\n\t\t\t\t\t\tprintf(\"%d\\n\",2*(l+a/2));\n\t\t\t\t}\n\n\t\t}\n\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\t\tint i,j,r,l,a,cnt;\n\t\twhile(scanf(\"%d %d %d \",&l,&r,&a)!=EOF){\n\t\t\t\tcnt=0;\n\t\t\t\tif(l>r){\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\n\n\t\t\t\t}\n\t\t\t\telse if(r>l){\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n//\tprintf(\"cnt%d\\n\",cnt);\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\t\t\t\t}\n\t\t\t\telse if(r==l){\n\t\t\t\t\t\tprintf(\"%d\\n\",2*(l+a/2));\n\t\t\t\t}\n\n\t\t}\n\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n\n{\n\tint l,r,a;\n\tint c=0;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l == 0 && a == 0)\n\t{\n\t\tprintf(\"0\");\n\t\texit(0);\n\t}\n\telse if(r == 0 && a == 0)\n\t{\n\t\tprintf(\"0\");\n\t\texit(0);\n\t}\n\n\telse if(l == r)\n\t{\n\t\tif(a%2 == 0)\n\t\tc=l+r+a;\n\t\telse\n\t\tc=l+r+a-1;\n\t\t\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(l>r)\n\t{\n\t\twhile(a>0 && r<l)\n\t\t{\n\t\t\tr++;\n\t\t\ta--;\n\t\t}\n\t\tif(a%2 == 0)\n\t\tc=(r*2) + a;\n\t\telse\n\t\tc=(r*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(r>l)\n\t{\n\t\twhile(a>0 && l<r)\n\t\t{\n\t\t\tl++;\n\t\t\ta--;\n\t\t}\n\t\t\n\t\tif(a%2 == 0)\n\t\tc=(l*2) + a;\n\t\telse\n\t\tc=(l*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int l,r,a;\n int n = 0;\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n scanf(\"%d\",&a);\n if(l == r){\n n += l;\n int rem = a / 2;\n n += rem;\n }\n else{\n int rem;\n if(l > r){\n n = r;\n rem = l - r;\n }\n else{\n n = l;\n rem = r - l;\n }\n if(rem < a){\n n += rem;\n rem = a - rem;\n rem = rem / 2;\n n += rem;\n }\n else if(rem > a){\n n += a;\n }\n else{\n n += rem;\n }\n }\n printf(\"%d\",n * 2);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(l,r,a)\n{scanf(\"%d%d%d\",&l,&r,&a);\nint t,s;\nif(l<r)\n{\nt=l;\nl=r;\nr=t;\n}\nif(a<=(l-r))\ns=2*(r+a);\nelse\ns=2*(l+(a-l+r)/2);\nprintf(\"%d\",s);\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint left,right,both,total;\n\twhile(~scanf(\"%d%d%d\",&left,&right,&both)){\n\t\t//while(left!=right){\n\t\ttotal=0;\n\t\t\tint t=both;\n\t\t\tif(left<right){\n\t\t\t\tboth-=right-left;\n\t\t\t\tif(both<=0){\n\t\t\t\t\tleft+=t;\n\t\t\t\t\ttotal=left*2;\n\t\t\t\t}else{\n\t\t\t\t\tleft+=both;\n\t\t\t\t\ttotal=right*2+both/2*2;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(left>right){\n\t\t\t\tboth-=left-right;\n\t\t\t\tif(both<=0){\n\t\t\t\t\tright+=t;\n\t\t\t\t\ttotal=right*2;\n\t\t\t\t}else{\n\t\t\t\t\ttotal=left*2+(both/2)*2;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse{\n\t\t\t\ttotal=left*2+(t/2)*2;\n\t\t\t}\n\t\t//}\n\t\tprintf(\"%d\\n\",total);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int a,b,c,min,max,x,y;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>=b)\n {\n min=b;\n max=a;\n x=max-min;\n if(x<=c)\n {\n \ty=c-x;\n \ty=y/2;\n \tprintf(\"%d\\n\",(max+y)*2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"%d\\n\",(min+c)*2);\n\t\t}\n\t}\n\telse\n\t{\n\t\tmin=a;\n\t\tmax=b;\n\t\tx=max-min;\n if(x<=c)\n {\n \ty=c-x;\n \ty=y/2;\n \tprintf(\"%d\\n\",(max+y)*2);\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\tprintf(\"%d\\n\",(min+c)*2);\n\t\t}\t\t\n\t}\n\treturn 0;\n } \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0,m,n,t;\n scanf(\"%d %d %d\",&l,&r,&a);\n m=l;\n n=r;\n if(l<r)\n {\n s=l*2;\n r=r-l;\n if(r>=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r<l)\n {\n s=r*2;\n l=l-r;\n if(l>=a)t=a*2;\n else t=((l+a)/2)*2;\n s=s+t;\n\n }\n else {s=(l*2)+((a/2)*2);}\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "//left handers right handers and ambidexters\n//Bismillahir Rahmanir Rahim\n#include<stdio.h>\nint main()\n{\n int x,y,z,a,b,c;\n scanf(\"%d%d%d\",&x,&y,&z);\n if(x<y)\n {\n a=x+z;\n if(a>y)\n {\n b=a-y;\n b=b/2;\n c=y*2+b*2;\n }\n else\n {\n c=a*2;\n }\n\n }\n else if(x>y)\n {\n a=y+z;\n if(a>x)\n {\n b=a-x;\n b=b/2;\n c=x*2+b*2;\n }\n else\n {\n c=a*2;\n }\n }\n else\n {\n b=z/2;\n c=x*2+b*2;\n }\n printf(\"%d\\n\",c);\n\n return 0;\n}\n/*\n\n1 4 2\n5 5 5\n0 2 0\n\n*/"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#define N 100\n#define EPS 1E-5\n//#define min(a,b) (a>b) ? b : a\n/*int lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint Min(int a, int b)\n{\n\treturn (a > b) ? b : a;\n}\nint main(void)\n{\n\tint l, r, a;\n\tint i = 0, max = 0;\n\tscanf(\"%i%i%i\", &l, &r, &a);\n\tfor (i = 0; i <= a; i++)\n\t\tif ((l + i == r - (a - i) && l + i > max) || Min(l + i, r + (a - i)) > max)\n\t\t\tmax = Min(l + i, r + (a - i));\n\tprintf(\"%i\", max * 2);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,x,z;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r && r==a)\n {\n printf(\"%d\",l+r+a/2+a/2);\n }\n else\n {\n\n if(l>r)\n {\n x=l-r;\n if(x<=a)\n {\n r=r+x;\n a=a-x;\n }\n else\n {\n r=r+a;\n x=x-a;\n l=l-x;\n a=0;\n }\n\n }\n else\n {\n x=r-l;\n if(x<=a)\n {\n l=l+x;\n a=a-x;\n\n }\n else\n {\n l=l+a;\n x=x-a;\n r=r-x;\n a=0;\n }\n\n }\n\n printf(\"%d\",l+r+a/2+a/2);\n\n\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((a==0 && l==0)||(a==0 && r==0))\n {\n printf(\"0\");\n }\n else\n {\n if(l==r)\n {\n if((a+l+r)%2==0)\n {\n printf(\"%d\",a+l+r);\n }\n else\n {\n printf(\"%d\",a+l+r-1);\n }\n }\n else if(l>r)\n {\n if(l-r>=a)\n {\n printf(\"%d\",2*(a+r));\n }\n else\n {\n a=a+r-l;\n printf(\"%d\",(2*(l+(a/2))));\n }\n }\n else if(r>l)\n {\n if(r-l>=a)\n {\n printf(\"%d\",2*(a+l));\n }\n else\n {\n a=a+l-r;\n printf(\"%d\",(2*(r+(a/2))));\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,t,r;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a+c==0||b+c==0){\n r=0;\n }\n else{\n if(b>a){\n t=a;\n a=b;\n b=t;\n }\n again:\n if(a==b){\n r=2*(a+c/2);\n }\n else if(b+c<=a){\n r=2*(b+c);\n }\n else{\n\n c=c-a+b;\n b=a;\n goto again;\n }\n }\n printf(\"%d\",r);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a, b, c, d;\n scanf(\"%d %d %d\", &a, &b, &c);\n if (a > b)\n {\n if ((b + c) > a)\n {\n d = (b + c) - a;\n d = d / 2;\n printf(\"%d\",+(a + d)*2);\n }\n else\n {\n printf(\"%d\", (b + c) * 2);\n }\n }\n else\n {\n if ((a + c) > b)\n {\n d = a + c - b;\n d = d / 2;\n printf(\"%d\", (b + d)*2);\n }\n else\n {\n printf(\"%d\", (a + c) * 2);\n }\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b){ \tif (a<b) return a; else return b;}\nint max(int a, int b){ if (a>b) return a; else return b;}\n\nint main(){\n\nint l,r,a,s=0,t;//i,j,k;\n\nscanf(\"%i %i %i\",&l,&r,&a);\n\nif (r==l){\n\ts = 2*l;\n\ts+= (a%2==0)? a: a-1;\n\t}\nelse{\n\tt = max(l,r) - min(l,r);\n\ts = 2*min(l,r) + 2*min(a,t);\n\tif ( t < a ){\n\t\tt = (a-t);\n\t\ts += (t % 2 == 0 ) ? t : t-1;\n\t}\n}\n\nprintf(\"%i\\n\",s );\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n if(l==r)\n {\n printf(\"%d\\n\",l+r+((a/2)*2));\n }\n else if(r<=l && r<=a)\n {\n s=2*r;\n l=l-r;\n if(l<=a)\n {\n\n s= s + (2*l);\n a=a-l;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(l<=r && l<=a)\n {\n s=2*l;\n r=r-l;\n if(r<=a)\n {\n s= s + (2*r);\n a=a-r;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(l<=r)\n {\n s=2*l;//90\n r=r-l;//2\n if(r<=a)\n {\n s= s + (2*r);//4\n a=a-r;//14\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(r<=l)\n {\n s=2*r;\n l=l-r;\n if(l<=a)\n {\n\n s= s + (2*l);\n a=a-l;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n\n\n\n}\n\n"}, {"source_code": "///I am Groot |*|\n#include <stdio.h>\n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l<r)\n {\n s=l;\n l=r;\n r=s;\n }\n if(a<l-r)\n {printf(\"%d\\n\",2*(r+a));}\n else\n {printf(\"%d\\n\",(l+r+a)/2*2);}\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int l,r,a,range=0,x,y,t;\n scanf(\"%d%d%d\",&l,&r,&a);\n \n if(l<=r)\n {\n x=r; y=l;\n }\n else\n {\n x=l; y=r;\n }\n \n \n if(y+a<=x)\n {\n range=(y+a)*2;\n }\n else\n {\n t=(a+y-x)/2;\n range=(2*x)+(2*t);\n }\n \n printf(\"\\t%d\",range);\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint l, r, a, x, y;\n\tscanf (\"%d%d%d\",&l,&r,&a);\n\tx = l + a;\n\ty = r + a;\n\tif ( a > 0 )\n\t{\n\t\tif ( l < r )\n\t\t{\t\n\t\t\tif ( x == r )\n\t\t\t{\n\t\t\t\tprintf (\"%d\",x*2);\n\t\t\t}\n\t\t\telse if ( x > r ) \n\t\t\t{\n\t\t\t\tif ( (x-r) % 2 == 0 )\n\t\t\t\t{\n\t\t\t\t\tprintf (\"%d\",(r+(x-r)/2)*2);\n\t\t\t\t}\n\t\t\t\telse if ( (x-r) == 1 ) printf (\"%d\",r*2);\n\t\t\t\telse printf (\"%d\",(r+(x-r-1)/2)*2);\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tprintf (\"%d\",x*2);\n\t\t\t}\n\t\t}\n\t\telse if ( l > r )\n\t\t{\t\n\t\t\tif ( y == l )\n\t\t\t{\n\t\t\t\tprintf (\"%d\",y*2);\n\t\t\t}\n\t\t\telse if ( y > l ) \n\t\t\t{\n\t\t\t\tif ( (y-l) % 2 == 0 )\n\t\t\t\t{\n\t\t\t\t\tprintf (\"%d\",(l+(y-l)/2)*2);\n\t\t\t\t}\n\t\t\t\telse if ( (y-l) == 1 ) printf (\"%d\",l*2);\n\t\t\t\telse printf (\"%d\",(l+(y-l-1)/2)*2);\n\t\t\t}\n\t\t\t\n\t\t\telse \n\t\t\t{\n\t\t\t\tprintf (\"%d\",y*2);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ( a % 2 == 0 ) printf (\"%d\",a+l*2);\n\t\t\telse if ( (a-1) % 2 == 0 ) printf (\"%d\",(a-1) + l*2);\n\t\t\telse if ( a == 1 ) printf (\"%d\",l*2);\n\t\t}\n\t}\n\tif ( a == 0 )\n\t{ \n\t\tif ( l < r ) printf (\"%d\",l*2);\n\t\telse if ( l > r ) printf (\"%d\",r*2);\n\t\telse printf (\"%d\",r*2);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\tlong long int l;\n\tlong long int r;\n\tlong long int a;\n\n\tscanf(\"%I64d %I64d %I64d\", &l, &r, &a);\n\n\tif(l == r) {\n\t\tif((a & 1) == 0) {\n\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t}\n\n\telse if((l == 0 && a == 0)){\n\t\tprintf(\"%I64d\", l + a);\n\t}\n\n\telse if((r == 0 && a == 0)){\n\t\t\tprintf(\"%I64d\", r + a);\n\t}\n\n\telse if(r > l && l + a < r && (((l - r) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", (l + a) * 2);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", (l + a) * 2);\n\t\t}\n\t\t}\n\n\telse if(r > l && l + a < r && (((l - r - 1) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", (l + a) * 2);\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", (l + a) * 2);\n\t\t\t}\n\t\t\t}\n\n\telse if(r > l && (((r - l) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t\t}\n\n\telse if(r > l && (((r - l - 1) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t\t}\n\t\t\t}\n\n\n\telse if(l > r && r + a < l && (((l - r) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", (r + a) * 2);\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", (r + a) * 2);\n\t\t\t}\n\t\t\t}\n\n\telse if(l > r && r + a < l && (((l - r - 1) & 1) == 0)){\n\t\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\t\tprintf(\"%I64d\", (r + a) * 2);\n\t\t\t\t} else {\n\t\t\t\t\tprintf(\"%I64d\", (r + a) * 2);\n\t\t\t\t}\n\t\t\t\t}\n\n\telse if(l > r && (((l - r) & 1) == 0)){\n\t\t\t\tif((a & 1) == 0) {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t} else {\n\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t}\n\t}\n\n\n\n\telse if(l > r && (((l - r - 1) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t}\n\t\t}\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n long long compare (const void * a, const void * b)\n{ \n return ( *(long long *)a - *(long long *)b );\n}\nint main(void){\n \nlong long int test,i,j,n,count,flag,flag2,b1,l,m,u,r,q,d,x,max,max2,min,f,sum,a,b;\n\n\nscanf(\"%lld%lld%lld\",&l,&r,&b);\nif(l>r){\n d=abs(l-r);\n if(d>b){\n printf(\"%lld\",(r+b)*2);\n }else{\n printf(\"%lld\",(l+((b-d)/2))*2);\n }\n\n}else{\n if(l<r){\n d=r-l;\n if(d>b){\n printf(\"%lld\",(l+b)*2);\n }else{\n printf(\"%lld\",(r+((b-d)/2))*2);\n }\n }else{\n printf(\"%lld\",2*r+(b/2)*2);\n }\n}\n\n \n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,z,b,c,d,y;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((l>0 || l==0 || l<100) && (r>0 || r==0 || r<100) && (a>0 || a==0 || a<100)){\n if(l==r){\n b=a%2;\n\n if(b==0){\n z=l+r+a;\n }\n else {\n z=l+r+a-1;\n }\n }\n else if(l>r){\n c=l-r;\n if(c==a){\n z=l+r+a;\n }\n else if(c>a){\n z=2*(r+a);\n }\n else {\n y=l+r+a;\n if(y%2==0){\n z=y;\n }\n else {\n z=y-1;\n }\n }\n }\n else {\n d=r-l;\n if(d==a){\n z=l+r+a;\n }\n else if(d>a){\n z=2*(l+a);\n }\n else {\n y=l+r+a;\n if(y%2==0){\n z=y;\n }\n else {\n z=y-1;\n }\n }\n }\n printf(\"%d\\n\",z);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n int l,r,a,h,s,b;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r && a%2==0){\n h=l+r+a;\n }\n else{\n h=l+r+a-1;\n }\n if(l<r){\n b=r;s=l;\n }\n else{b=l;s=r;}\n if(a<=b-s){\n h=2*(s+a);\n }\n else{if((a-b+s)%2==0){\n h=2*b+a-b+s;\n }\n else{h=2*b+a-b+s-1;}\n }\n printf(\"%d\",h);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,result,ans,r1,l1;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r){\n l=l+(a/2*2)/2;\n l=l*2;\n printf(\"%d\\n\",l);\n return 0;\n }\n if(l>r){\n r1=r+a;\n l1=l;\n if(l1>r1){\n ans=r1*2;\n }\n else\n ans=(l+r+a)/2*2;\n }\n else{\n l1=l+a;\n r1=r;\n if(l1<r1){\n ans=l1*2;\n }\n else\n ans=(l+r+a)/2*2;}\n printf(\"%d\\n\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,t1,t2;\n scanf(\"%d %d %d\",&a,&c,&b);\n if((a==0 && b==0) || (b==0 && c==0)) printf(\"0\");\n else\n {\n t1=a;\n t2=c;\n if(t1>t2 && t2+b<=t1)\n printf(\"%d\",2*(t2+b));\n else if(t2>t1 && t1+b<=t2)\n printf(\"%d\",2*(t1+b));\n else\n {\n if(t1>t2)\n {\n if(t1%2!=0 && b%2==0 && t2%2==0)\n t1=t1-1;\n b=b-(t1-t2);\n t2=t1;\n }\n else\n {\n if(t2%2!=0 && b%2==0 && t1%2==0)\n t2=t2-1;\n b=b-(t2-t1);\n t1=t2;\n }\n if(b%2==0)\n {\n t1=t1+b/2;\n }\n else\n {\n t1=t1+(b-1)/2;\n }\n printf(\"%d\",2*t1);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,ans=0;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\tint chek=0,x;\n\tif(l<=r)\n\t{\n\t\tchek++;\n\t\tans+=2*l;\n\t\tr-=l;\n\t\tx=r;\n\t}\n\tif(l>r&&chek==0)\n\t{\n\t\tans+=2*r;\n\t\tl-=r;\n\t\tx=l;\n\t}\n\t\n\tif(x<=a)\n\t{\n\t\tans+=(2*x);\n\t\tans+=((a-x)-((a-x)%2));\n\t}\n\tif(x>a)\n\t{\n\t\tans+=(2*a);\n\t}\n\tprintf(\"%d\",ans);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l>=r)\n {\n if(a<=l-r)\n {\n r=r+a;\n printf(\"%d\",2*r);\n }\n else\n {\n a=a-(l-r);\n r=l;\n r=r+a/2;\n printf(\"%d\",2*r);\n }\n }\n else\n {\n if(a<=r-l)\n {\n l=l+a;\n printf(\"%d\",2*l);\n }\n else\n {\n a=a-(r-l);\n l=r;\n l=l+a/2;\n printf(\"%d\",2*l);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\n\tint l, r, a;\n\n\tscanf(\"%i\", &l);\n\tscanf(\"%i\", &r);\n\tscanf(\"%i\", &a);\n//l<r\n\tif (l<r) {\n\t\tif ((l+a)==r){\n\t\t\tprintf(\"%i\", a+r+l);\t}\n\t\telse if ((l+a)<r){\n\t\t\t\tprintf(\"%i\", 2*(l+a));}\n\t\telse if ((l+a)>r){\n\t\t\tif((l+a-r)>1){\n\t\t\t\tif((l+a-r)%2 ==0){\n\t\t\t\t\tprintf(\"%i\", 2*r+l+a-r);}\n\t\t\t\telse {\n\t\t\t\t\tprintf(\"%i\", 2*r+l+a-r-1);}\n\t\t\t}\n\t\t\telse {\n\t\t\tprintf(\"%i\", 2*r);\t\t}\n\t\t}\n\t}\n//l>r\n\telse if (l>r){\n\t\tif ((r+a)==l){\n\t\t\t\tprintf(\"%i\", a+r+l);\t}\n\t\telse if ((r+a)<l){\n\t\t\t\tprintf(\"%i\", 2*(r+a));\t}\n\t\telse if ((r+a)>l){\n\t\t\tif(r+a-l>1){\n\t\t\t\tif((r+a-l)%2 ==0){\n\t\t\t\tprintf(\"%i\", 2*l+r+a-l);}\n\t\t\t\telse{\n\t\t\t\tprintf(\"%i\", 2*l+r+a-l-1);}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"%i\", 2*l);\t}\t}\n\t}\n//l=r\n\telse {\n\t\tif((l+r+a)%2 == 0){\n\t\t\tprintf(\"%i\", l+r+a);}\n\t\telse {\n\t\t\tprintf(\"%i\", l+r+a-1);}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){int l,r,a;scanf(\"%d%d%d\",&l,&r,&a);while(l<r){if(a>0){a--;l++;}else{r--;}}while(r<l){if(a>0){a--;r++;}else{l--;}}while(a>1){r++;l++;a-=2;}printf(\"%d\",r+l);return 0;}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,big,small,total,c,b,k,m;\n scanf(\"%d %d %d\",&l,&r,&a);\n b=a%2;\n if(l==r)\n {total=l+r+((a-b));\n printf(\"%d\",total);\n return 0;\n end(0);}\n else if(l>r)\n {big=l;\n small=r;}\n else\n {small=l;\n big=r;}\n\n c=small+a;\n if(big>=c)\n {total=2*c;\n printf(\"%d\",total);\n return 0;\n end(0);}\n else\n { k=big-small;\n m=a-k;\n {\n if(m%2==0)\n m=m;\n else\n m=m-1;\n }\n {\n if(m>0)\n m=m;\n else\n m=-m;\n }\n total=(2*big)+m;\n printf(\"%d\",total);\n return 0;\n end(0);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <time.h>\n\nint main(){\n setvbuf(stdout, NULL, _IONBF,0);\n int left;\n int right;\n int ambx;\n scanf(\"%i\",&left);\n scanf(\"%i\",&right);\n scanf(\"%i\",&ambx);\n if(left>=0 && left<=100 && right>=0 && right<=100 && ambx>=0 && ambx<=100){\n while(ambx!=0){\n if(left>right){\n right+=1;\n }\n else if(right>left){\n left+=1;\n }\n else{\n right+=1;\n }\n ambx--;\n }\n if(left>right){\n right = right*2;\n printf(\"%i\\n\",right);\n }\n else if(left<right){\n left = left*2;\n printf(\"%i\\n\",left);\n }\n else{\n left = left*2;\n printf(\"%i\\n\",left);\n }\n }\n \n else{\n printf(\"\\nNo division in command\\n\");\n }\n \n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int l,r,b;\n scanf(\"%d%d%d\",&l,&r,&b);\n if(l<r)\n {\n while(l!=r)\n {\n if(b==0)\n {\n break;\n }\n l++;\n b--;\n }\n l=l+b/2;\n r=l;\n }\n else if(r<l)\n {\n while(r!=l)\n {\n if(b==0)\n {\n break;\n }\n r++;\n b--;\n }\n r=r+b/2;\n l=r;\n }\n else if(l==r)\n {\n l=l+b/2;\n r=l;\n }\n printf(\"%d\",l+r);\n}\n"}, {"source_code": "#include<stdio.h>\nint getResult(int l,int r,int a){\n\tint max,min;\n\tmax=l>r?l:r;\n\tmin=l<r?l:r;\n\tif(max-min==a)\n\t\treturn max*2;\n\tif(max-min>a)\n\t\treturn (min+a)*2;\n\tif(max-min<a)\n\t\treturn max*2+(a-max+min)/2*2;\n}\nint main(){\n\tint l,r,a;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\tprintf(\"%d\\n\",getResult(l,r,a));\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,total,total1,total2,total3,total4,team;\n scanf(\"%d%d%d\",&l,&r,&a);\n total1=l+a;\n total2=r;\n total3=r+a;\n total4=l;\n if(total1<total2)\n {\n total=total2-total1;\n total2-=total;\n team=total1+total2;\n printf(\"%d\",team);\n }\n else if(total3<total4)\n {\n total=total4-total3;\n total4-=total;\n team=total3+total4;\n printf(\"%d\",team);\n }\n else\n {\n total=total1+total2;\n total/=2;\n team=total*2;\n printf(\"%d\",team);\n }\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int L,R,A,C,i,j;\n\n scanf(\"%d%d%d\",&L,&R,&A);\n\n if(L<R)\n { //printf(\"%d\",L);\n //(A!=0 || L!=R)\n /* for(i=0;i=1000;i++)\n {\n\n L=L+1;\n A=A-1;\n if ((L==R) || (A==0))\n {\n break;\n }\n // printf(\"\\n%d %d\",L,A);\n } */\n for(i=L, j=A;(i==R)||(j>0);i++,j--)\n {\n\n L=L+1;\n A=A-1;\n if ((R==L)|| (A==0))\n {\n break;\n }\n // printf(\"\\n%d %d\",L,A);\n }\n //}while(L=R || A>0);\n\n if(L==R && A!=0)\n {\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n\n }\n else if(L==R && A==0)\n {\n printf(\"%d\",L+R);\n }\n else if(L<R && A==0)\n {\n while(L!=R)\n {\n R=R-1;\n // printf(\"%d\",L);\n }\n printf(\"%d\",L+R);\n }\n }\n else if(L>R)\n {\n for(i=L, j=A;(i==R)||(j>0);i++,j--)\n {\n\n R=R+1;\n A=A-1;\n if ((R==L)|| (A==0))\n {\n break;\n }\n // printf(\"\\n%d %d\",L,A);\n }\n //}while(L=R || A>0);\n\n if(R==L && A!=0)\n {\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n\n }\n else if(L==R && A==0)\n {\n printf(\"%d\",L+R);\n }\n else if(R<L && A==0)\n {\n while(R!=L)\n {\n L=L-1;\n // printf(\"%d\",L);\n }\n printf(\"%d\",L+R);\n }\n }\n else if(L==R)\n {\n\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n }\n else{printf(\"0\");}\n\n // printf(\"%d\",L+R);\n return 0;\n}\n"}, {"source_code": "///I am Groot |*|\n#include <stdio.h>\n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l<r)\n {\n s=l;\n l=r;\n r=s;\n }\n if(a<l-r)\n {printf(\"%d\\n\",2*(r+a));}\n else\n {printf(\"%d\\n\",(l+r+a)/2*2);}\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main() {\n int l, r, a, ans;\n scanf(\"%d%d%d\", &l, &r, &a);\n int delta = (l > r) ? l - r : r - l;\n if (delta > a) {\n if (l > r) {\n ans = r + a;\n } else {\n ans = l + a;\n }\n } else {\n a -= delta;\n a /= 2;\n if (l > r) {\n ans = l + a;\n } else {\n ans = r + a;\n }\n }\n printf(\"%d\\n\", 2 * ans);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,temp;\n scanf(\"%d %d %d\",&l,&r,&a);\n while(1){\n y:if(a==0){\n if(l>=r){\n printf(\"%d\",r*2);\n }\n else{\n printf(\"%d\",l*2);\n }\n break;\n }\n else{\n x:if(l==r){\n a=a/2;\n l=r;\n l=l+a;\n l=2*l;\n printf(\"%d\",l);\n break;\n }\n else if(l>r){\n temp=l-r;\n if(temp<=a){\n r=r+temp;\n a=a-temp;\n if(a==0){\n goto y;\n }\n else{\n goto x;\n }\n }\n else{\n r=r+a;\n r=r*2;\n printf(\"%d\",r);\n break;\n }\n }\n else if(l<r){\n temp=r-l;\n if(temp<=a){\n l=l+temp;\n a=a-temp;\n if(a==0){\n goto y;\n }\n else{\n goto x;\n }\n }\n else{\n l=l+a;\n l=l*2;\n printf(\"%d\",l);\n break;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a,n;\n scanf(\"%d %d %d\",&l,&r,&a);\n n=a;\n for(int i=1;i<=n;i++)if(l<=r){l++;a--;}else{r++;a--;}\n if(l==0 || r==0)printf(\"0\\n\");else if(l==r)printf(\"%d\\n\",l+r);else if(l>r)printf(\"%d\\n\",r*2);else printf(\"%d\\n\",l*2);\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n long long int sum,lft_hnd,rght_hnd,ambdxtr,small,big,total;\n\n scanf(\"%lld %lld %lld\",&lft_hnd,&rght_hnd,&ambdxtr);\n total=lft_hnd+rght_hnd;\n small=(total-abs(lft_hnd-rght_hnd))/2;\n big=total-small;\n if(small+ambdxtr<big)\n sum=(small+ambdxtr)*2;\n else\n sum=(lft_hnd+rght_hnd+ambdxtr)-(lft_hnd+rght_hnd+ambdxtr)%2;\n\n printf(\"%lld\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\n//using namespace std;\n\nint main()\n{\n int l,r,a,t=0,x,x1;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(a==0&&(l==0||r==0))\n {\n printf(\"0\\n\");\n }\n else\n {\n if(l==r)\n {\n if(a%2==0)\n {\n t=l+r+a;\n }\n else\n {\n t=l+r+a-1;\n }\n }\n else if(l>r)\n {\n x=l-r;\n t=t+2*r;\n if(x>a)\n {\n x1=x-a;\n t=t+2*a;\n }\n else\n {\n x1=a-x;\n if(x1%2==0)\n {\n t=t+2*x+x1;\n }\n else\n {\n t=t+2*x+x1-1;\n }\n }\n }\n else\n {\n x=r-l;\n t=t+2*l;\n if(x>a)\n {\n x1=x-a;\n t=t+2*a;\n }\n else\n {\n x1=a-x;\n if(x1%2==0)\n {\n t=t+2*x+x1;\n }\n else\n {\n t=t+2*x+x1-1;\n }\n }\n }\n printf(\"%d\\n\",t);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,b,x,y,z;\n\twhile(scanf(\"%d %d %d\",&l,&r,&a)!=EOF)\n {\n\tif(l>r){\n\t\tb=r+a;\n\t\tx=l-b;\n\t\ty=l+r+a-x;\n\t\tif(x<0)\n y=l+r+a;\n if(y%2!=0)\n y=y-1;\n\t\tprintf(\"%d\\n\",y);\n\t}\n\telse if (r>l)\n\t{\n\t\tb=l+a;\n\t\tx=r-b;\n\n y=l+r+a-x;\n if(x<0)\n y=l+r+a;\n if(y%2!=0)\n y=y-1;\n printf(\"%d\\n\",y);\n\t}\n\telse if (l==r)\n\t{\n\t\tb=l+r;\n\t\tif(a%2==0){\n\t\tx=b+a;\n\t\t}\n\t\telse {\n\t\tx=b+a-1;\n\t\t}\n\n\tprintf(\"%d\\n\",x);\n\t}\n }\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main() {\n int l,r,a;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(a==0){\n if(l>r)\n printf(\"%d\",r+r);\n else if(l==r)\n printf(\"%d\",l+r);\n else\n printf(\"%d\",l+l);\n }\n else if(l==r){\n \n if(a%2==0){\n printf(\"%d\",l+r+a);\n }\n else\n printf(\"%d\",l+r+a-1);\n }\n else if((l==0&&r==0)||(l==0&&a==0)||(r==0&&a==0)){\n printf(\"0\");\n }\n else if(l>r){\n if((a+r)<l){\n l=r+a;\n printf(\"%d\",l+r+a);\n \n }\n else if((a+r)==l)\n printf(\"%d\",a+r+l);\n else{\n int s=(a+r)-l;\n if(s%2==0){\n printf(\"%d\",a+l+r);\n }\n else\n printf(\"%d\",a+l+r-1);\n \n }\n }\n else if(r>l){\n if((a+l)<r){\n r=l+a;\n printf(\"%d\",l+r+a);\n \n }\n else if((a+l)==r)\n printf(\"%d\",a+r+l);\n else{\n int s=(a+l)-r;\n if(s%2==0){\n printf(\"%d\",a+l+r);\n }\n else\n printf(\"%d\",a+l+r-1);\n \n }\n }\n \n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((a==0 && l==0)||(a==0 && r==0))\n {\n printf(\"0\");\n }\n else\n {\n if(l==r)\n {\n if((a+l+r)%2==0)\n {\n printf(\"%d\",a+l+r);\n }\n else\n {\n printf(\"%d\",a+l+r-1);\n }\n }\n else if(l>r)\n {\n if(l-r>=a)\n {\n printf(\"%d\",2*(a+r));\n }\n else\n {\n a=a+r-l;\n printf(\"%d\",(2*(l+(a/2))));\n }\n }\n else if(r>l)\n {\n if(r-l>=a)\n {\n printf(\"%d\",2*(a+l));\n }\n else\n {\n a=a+l-r;\n printf(\"%d\",(2*(r+(a/2))));\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0,m,n,t;\n scanf(\"%d %d %d\",&l,&r,&a);\n m=l;\n n=r;\n if(l<r)\n {\n s=l*2;\n r=r-l;\n if(r>=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r<l)\n {\n s=r*2;\n l=l-r;\n if(l>=a)t=a*2;\n else t=((l+a)/2)*2;\n s=s+t;\n\n }\n else {s=(l*2)+((a/2)*2);}\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,ans=0,f=0;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\tif(l==0&&a==0||r==0&&a==0)\n\tprintf(\"0\\n\");\n\telse if(l+a<r)\n\tprintf(\"%d\\n\",2*(l+a));\n\telse if(r+a<l)\n\tprintf(\"%d\\n\",2*(r+a));\n\telse\n\t{\n\t\tif(a%2==1)\n\t\t{\n\t\t\tif((l+r)%2==1)\n\t\t\tans=ans+1;\n\t\t\tf=1;\n\t\t}\n\t\ta=a/2;\n\t\tans+=l+r+2*a;\n\t\tif(ans==1)\n\t\tprintf(\"0\\n\");\n\t\tif((l+r)%2==1&&f==0)\n\t\tans=ans-1;\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int left,right,ambidexter;\n scanf(\"%d %d %d\",&left,&right,&ambidexter);\n int max_team,difference;\n if (left==right)\n {\n ambidexter=ambidexter/2;\n max_team=left+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (left > right)\n {\n difference=left-right;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=left+left+(2*ambidexter);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n right+=ambidexter;\n max_team=right+right;\n printf(\"%d\\n\",max_team);\n }\n }\n else if (left < right)\n {\n difference=right-left;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n left+=ambidexter;\n max_team=left+left;\n printf(\"%d\\n\",max_team);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,t1,t2;\n scanf(\"%d %d %d\",&a,&c,&b);\n if((a==0 && b==0) || (b==0 && c==0)) printf(\"0\");\n else\n {\n t1=a;\n t2=c;\n if(t1>t2 && t2+b<=t1)\n printf(\"%d\",2*(t2+b));\n else if(t2>t1 && t1+b<=t2)\n printf(\"%d\",2*(t1+b));\n else\n {\n if(t1>t2)\n {\n if(t1%2!=0 && b%2==0 && t2%2==0)\n t1=t1-1;\n b=b-(t1-t2);\n t2=t1;\n }\n else\n {\n if(t2%2!=0 && b%2==0 && t1%2==0)\n t2=t2-1;\n b=b-(t2-t1);\n t1=t2;\n }\n if(b%2==0)\n {\n t1=t1+b/2;\n }\n else\n {\n t1=t1+(b-1)/2;\n }\n printf(\"%d\",2*t1);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,t,r;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a+c==0||b+c==0){\n r=0;\n }\n else{\n if(b>a){\n t=a;\n a=b;\n b=t;\n }\n again:\n if(a==b){\n r=2*(a+c/2);\n }\n else if(b+c<=a){\n r=2*(b+c);\n }\n else{\n\n c=c-a+b;\n b=a;\n goto again;\n }\n }\n printf(\"%d\",r);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n\tint a,b,c,tong;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ttong = a+b+c ;\n\tif(a!=0&&b!=0&&c!=0)\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tif((a+c)<b) printf(\"%d\",(a+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a>b)\n\t\t{\n\t\t\tif((b+c)<a) printf(\"%d\",(b+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t}\n\t}\n\telse if(c==0)\n\t{\n\t\tif(a!=0&&b!=0) \n\t\t{\n\t\t\tif(a<b) printf(\"%d\",a*2);\n\t\t\telse printf(\"%d\",b*2);\n\t\t}\n\t\telse if(a==0&&b!=0) printf(\"%d\",0);\n\t\telse if(b==0&&a!=0) printf(\"%d\",0);\n\t\telse if(a==0&&b==0) printf(\"%d\",0);\n\t}\n\telse if(a==0||b==0&&c!=0)\n\t{\n\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\telse printf(\"%d\",tong - 1 ) ;\n\t}\n}"}, {"source_code": "#include <stdio.h>\n\nint main( )\n{\n\tint l,r,a, team=0;\n\n\t//printf(\"Enter l, r, a:\");\n\tscanf(\"%d%d%d\", &l, &r, &a);\n\t//printf(\"left=%d, right=%d, ambi=%d\\n\", l,r,a);\n\n\t\n\tif (l ==r)\n\t{\n\t\tteam += l + r;\n\t\tif(a%2 ==0)\n\t\t\tteam += a;\n\t\telse\n\t\t\tteam += (a-1);\n\t}\n\telse if ( l < r)\n\t{\n\t\tteam += 2*l;\n\t\tr = r-l;\n\t\tif( a < r)\n\t\t{\n\t\t\tteam += 2*a;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tteam += 2*r;\n\t\t\ta = a-r;\n\t\t\tif(a%2 ==0)\n\t\t\t\tteam += a;\n\t\t\telse\n\t\t\t\tteam += (a-1);\n\t\t}\n\t}\n\telse\n\t{\n\t\tteam += 2*r;\n\t\tl = l-r;\n\t\tif( a < l)\n\t\t{\n\t\t\tteam += 2*a;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tteam += 2*l;\n\t\t\ta = a-l;\n\t\t\tif(a%2 ==0)\n\t\t\t\tteam += a;\n\t\t\telse\n\t\t\t\tteam += (a-1);\n\t\t}\n\t}\n printf(\"%d\", team);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint l,r,a,max;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\t\tif(l==r)\n\t\t{\n\t\tl=l+a/2;\n\t\tr=r+a/2;\n\t\tmax=l+r;\n\t\t}\n\t\tif(l>r)\n\t\t{\n\t\t\tif(a>l-r)\n\t\t\t{\t\n\t\t\t\ta=a-(l-r);\n\t\t\t\tr=l;\n\t\t\t\tr=r+a/2;\n\t\t\t\tl=l+a/2;\n\t\t\t\tmax=r+l;\n\t\t\t}\n\t\t\telse \n\t\t {\n\t\t\t\tmax=2*(r+a);\n\t\t\t}\n\t\t}\n\t\tif(r>l)\n\t\t{\n\t\t\tif(a>r-l)\n\t\t\t{\n\t\t\t\t\n\t\t\t\ta=a-(r-l);\n\t\t\t\tl=r;\n\t\t\t\tr=r+a/2;\n\t\t\t\tl=l+a/2;\n\t\t\t\tmax=r+l;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmax=2*(l+a);\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\",max);\n\treturn 0;\n\t}\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\t\n\tint l,r,a,t;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l>r)\n\t{\n\t\tt=l;\n\t\tl=r;\n\t\tr=t;\n\t}\n\tif(l+a<=r)printf(\"%d\\n\",2*(l+a));\n\telse printf(\"%d\\n\",2*r+(a-(r-l))/2*2);\n\treturn 0;\n}"}, {"source_code": "\n#include<stdio.h>\n#include<stdlib.h>\nint main ()\n{\n int l,r,a,count;\n scanf(\"%d %d %d\",&l,&r,&a);\n int difference= abs(l-r);\n\n if (l==r)\n {\n count=2*l+a;\n\n if (count &1!=0)\n --count;\n }\n else if ( l<r)\n {\n if (difference>=a)\n {\n l=l+a;\n count=l+l;\n }\n else\n {\n a=a-difference;\n if (a&1!=0)\n --a;\n count =r+r+a;\n }\n\n }\n else if (r<l)\n {\n if (difference>=a)\n {\n r=r+a;\n count=r+r;\n }\n else\n {\n a=a-difference;\n if (a&1!=0)\n --a;\n\n count =l+l+a;\n }\n }\n\n printf(\"%d\\n\",count);\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n if(l==r)\n {\n printf(\"%d\\n\",l+r+((a/2)*2));\n }\n else if(r<=l && r<=a)\n {\n s=2*r;\n l=l-r;\n if(l<=a)\n {\n\n s= s + (2*l);\n a=a-l;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(l<=r && l<=a)\n {\n s=2*l;\n r=r-l;\n if(r<=a)\n {\n s= s + (2*r);\n a=a-r;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(l<=r)\n {\n s=2*l;//90\n r=r-l;//2\n if(r<=a)\n {\n s= s + (2*r);//4\n a=a-r;//14\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(r<=l)\n {\n s=2*r;\n l=l-r;\n if(l<=a)\n {\n\n s= s + (2*l);\n a=a-l;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\nint min(int l,int r);\nint max(int l,int r);\nint main()\n{\n\tint l,r,a,mi,ma,mini=0,maxi=0;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\tif(l==0 || r==0) \n\t\tprintf(0);\n\tif(a==0){\n\t\tif(l==r){\n\t\tprintf(\"%d\",2*l);\n\t\treturn 0;\n\t\t}\n\t\telse{\n\t\tprintf(\"%d\",min(l,r)*2);\n\t\treturn 0;\n\t\t}\n\t}\n\tmi=min(l,r);\n\tma=max(l,r);\n\tif(mi+a<=ma){\n\t\tprintf(\"%d\",2*(mi+a));\n\t\treturn 0;\n\t}\n\tif(mi+a>ma){\n\t\tmini=min(l,r);\n\t\tmaxi=max(l,r);\n\t\tif(l!=r){\n\t\t\ta=a-(maxi-mini);\n\t\t\tmini=maxi;\n\t\t}\n\t\tif(a%2==0){\n\t\t\tmini+=(a/2);\n\t\t\tmaxi+=(a/2);\n\t\t\tprintf(\"%d\",mini*2);\n\t\t\treturn 0;\n\t\t}\n\t\telse{\n\t\t\twhile(a>1){\n\t\t\t\tmini+=1;\n\t\t\t\ta--;\n\t\t\t\tif(a==1){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tmaxi+=1;\n\t\t\t\ta--;\n\t\t\t\tif(a==1){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%d\",mini+maxi);\n\t\t}\n\t}\n}\nint max(int l,int r){\n\tint maximum=0;\n\tif(l>=r){\n\t\tmaximum=l;\n\t}\n\tif(r>=l){\n\t\tmaximum=r;\n\t}\n\treturn maximum;\n}\n\nint min(int l,int r){\n\tint minimum=0;\n\tif(l<=r){\n\t\tminimum=l;\n\t}\n\tif(r<=l){\n\t\tminimum=r;\n\t}\n\treturn minimum;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\n\n int l,r,a,t,sum=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l>r)\n {\n t=l;\n l=r;\n r=t;\n }\n sum=sum+2*l;\n r=r-l;\n if(r<a)\n {\n a=a-r;\n sum=sum+2*r;\n if(a>0)\n {\n if(a%2==0)\n {\n sum=sum+a;\n\n }\n else{\n sum=sum+a-1;\n }\n\n }\n }\n else\n {\n sum=sum+2*a;\n }\n\n\n printf(\"%d\",sum);\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint min(int a,int b)\n{\n if(a<b) return a;\n else return b;\n}\nint max(int a,int b)\n{\n if(a>b) return a;\n else return b;\n}\nint abs(int a)\n{\n if(a<0) return -a;\n else return a;\n}\nint main(void) {\n\tint f,s,t,l,r,a;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\t\n\tf=min(l,r);\n\ts=min(abs(max(l,r)-f),a);\n\tt=a-s;\n\t\n\tif(t<0) t=0;\n\t\n\tprintf(\"%d\",(f+s+t/2)*2);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n int l,r,a,t=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l<r){\n t+=2*l;\n r-=l;\n if(r<a){\n t+=2*r;\n a-=r;\n if(a%2==1){\n t+=a-1;\n }\n else{\n t+=a;\n }\n }\n else{\n t+=2*a;\n }\n }\n else if(r<l){\n t+=2*r;\n l-=r;\n if(l<a){\n t+=2*l;\n a-=l;\n if(a%2==1){\n t+=a-1;\n }\n else{\n t+=a;\n }\n }\n else{\n t+=2*a;\n }\n }\n else{\n t+=r+l;\n if(a%2==1){\n t+=a-1;\n }\n else{\n t+=a;\n }\n }\n printf(\"%d\",t);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define min(a,b) (a>b?b:a)\n\nint main() {\n\tint l,r,a;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\n\tif (l > r) {\n\t int x = l - r;\n\t\tif (x > a) {\n\t\t\tr += a;\n\t\t\ta = 0;\n\t\t} else {\n\t\t\tr += x;\n\t\t\ta -= x;\n\t\t}\n\t} else if (l < r) {\n\t int x = r - l;\n\t\tif (x > a) {\n\t\t\tl += a;\n\t\t\ta = 0;\n\t\t} else {\n\t\t\tl += x;\n\t\t\ta -= x;\n\t\t}\n\t}\n\n\tif (l == r) {\n\t\tl+=(a/2);\n\t\tr+=(a/2);\n\t}\n\n\tprintf(\"%d\\n\", min(l,r)*2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n int l, r, a, ans;\n scanf(\"%d%d%d\", &l, &r, &a);\n int delta = (l > r) ? l - r : r - l;\n if (delta > a) {\n ans = ((l > r) ? r : l) + a;\n } else {\n a -= delta;\n a /= 2;\n ans = ((l > r) ? l : r) + a;\n }\n printf(\"%d\\n\", 2 * ans);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint l,r,am;\n\tint min=0,max=0;\n\tscanf(\"%d %d %d\",&l,&r,&am);\n\n\tmin=(l>r)?r:l;\n\tmax=(r>l)?r:l;\n\tif((min+am)<=max)\n printf(\"%d\\n\",2*(min+am));\n\telse\n\t printf(\"%d\\n\",2*(max+(am-max+min)/2));\n\n\treturn 0;\n}\n"}, {"source_code": "///I am Groot |*|\n#include <stdio.h>\n\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l<r)\n {\n s=l;\n l=r;\n r=s;\n }\n if(a<l-r)\n {printf(\"%d\\n\",2*(r+a));}\n else\n {printf(\"%d\\n\",(l+r+a)/2*2);}\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint l,r,am;\n\tint min=0,max=0;\n\tscanf(\"%d %d %d\",&l,&r,&am);\n\n\tmin=(l>r)?r:l;\n\tmax=(r>l)?r:l;\n\tif((min+am)<=max)\n printf(\"%d\\n\",2*(min+am));\n\telse\n\t printf(\"%d\\n\",2*(max+(am-max+min)/2));\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a,count;\n scanf(\"%d%d%d\",&l,&r,&a);\n count=0;\n while(count<a){\n if(l>(r+a)){\n r=r+a;\n goto x;\n }\n if(r>(l+a)){\n l=l+a;\n goto x;\n }\n if(l<r){\n l++;\n count++;\n }\n if(l==r){\n if((a-count)%2==0){\n l=l+(a-count)/2;\n r=r+(a-count)/2;\n goto x;\n }\n else{\n l=l+(a-count-1)/2;\n r=r+(a-count-1)/2;\n goto x;\n }\n }\n if(r<l){\n r++;\n count++;\n }\n }\n x:\n if(l<=r)\n printf(\"%d\",2*l);\n else\n printf(\"%d\",2*r);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\n\n int l,r,a,t,sum=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l>r)\n {\n t=l;\n l=r;\n r=t;\n }\n sum=sum+2*l;\n r=r-l;\n if(r<a)\n {\n a=a-r;\n sum=sum+2*r;\n if(a>0)\n {\n if(a%2==0)\n {\n sum=sum+a;\n\n }\n else{\n sum=sum+a-1;\n }\n\n }\n }\n else\n {\n sum=sum+2*a;\n }\n\n\n printf(\"%d\",sum);\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,m,a,c,min,max,k;\nscanf(\"%d %d %d\",&n,&m,&a);\nif(n!=m){\nif(n<m)\n{\nmin=n;\nmax=m;\n}\nelse{\nmin=m;\nmax=n;\n}\nmin=min+a;\n\nif(min<max)\nprintf(\"%d\\n\",min*2);\nelse{\nk=min-max;\nif(k%2==0)\nprintf(\"%d\\n\",(max*2)+k);\nelse\nprintf(\"%d\\n\",(max*2)+(k-1));\n\n}\n}\nelse{\nmin=n*2;\nif(a%2==0)\nprintf(\"%d\\n\",min+a);\nelse\nprintf(\"%d\\n\",(min+(a-1)));\n\n}\n\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0,m,n,t;\n scanf(\"%d %d %d\",&l,&r,&a);\n m=l;\n n=r;\n if(l<r)\n {\n s=l*2;\n r=r-l;\n if(r>=a) t=a*2;\n else t=((a+r)/2)*2;\n s=s+t;\n }\n else if(r<l)\n {\n s=r*2;\n l=l-r;\n if(l>=a)t=a*2;\n else t=((l+a)/2)*2;\n s=s+t;\n\n }\n else {s=(l*2)+((a/2)*2);}\n printf(\"%d\",s);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int l, r, a, b;\n\n scanf(\"%d %d %d\", &l, &r, &a);\n\n if(l < r){\n b = r-l;\n if(b <= a){\n l += b;\n a -= b;\n\n\n }\n else{\n l += a;\n a = 0;\n }\n }\n else{\n b = l-r;\n if(b <= a){\n r += b;\n a -= b;\n }\n else{\n r += a;\n a = 0;\n }\n }\n\n a /= 2;\n r += a;\n l += a;\n\n if(r < l) printf(\"%d\\n\", r*2);\n else printf(\"%d\\n\", l*2);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int rh,lh,ne,d,sum,div,i;\n scanf(\"%lld %lld %lld\",&rh,&lh,&ne);\n\n d = ne;\n if(rh>lh){\n\n while(ne>0){\n if(lh == rh){\n break;\n }\n lh++;\n d--;\n ne--;\n }\n\n div = d/2;\n sum = (lh*2) + (div*2);\n printf(\"%lld\\n\",sum);\n }\n else {\n\n while(ne>0){\n if(rh == lh){\n break;\n }\n rh++;\n d--;\n ne--;\n }\n \n div = d/2;\n sum = (rh*2) + (div*2);\n printf(\"%lld\\n\",sum);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,a,b,c,x;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==b)\n {\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n }\n else if(a>b && a-b<=c)\n {\n while(b!=a)\n {\n b=b+1;\n c=c-1;\n }\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n\n }\n else if(a<b && b-a<=c)\n {\n while(a!=b)\n {\n a=a+1;\n c=c-1;\n }\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n }\n else if(a>b && a-b>c)\n {\n b=b+c;\n i=a-b;\n a=a-i;\n x=a+b;\n }\n else if(a<b && b-a>c)\n {\n a=a+c;\n i=b-a;\n b=b-i;\n x=a+b;\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,i,j,x;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tfor(i=a;i>=0;i--)\n\t{\n\t\tif(l-r>=0)\n\t\t{\n\t\t\tx=r+i;\n\t\t\tif(x==l)\n\t\t\t{ if((a-i)%2==0)\n\t\t\t\t{\tprintf(\"%d\",2*l+a-i);}\n\t\t\t\telse{printf(\"%d\",2*l+a-i-1);\n\t\t\t\t}\n\t\t\tbreak;\t\n\t\t\t}\n\t\t\telse if(l>x)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2*(r+a));\n\t\t\t\tbreak;\n\t\t\t}\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tx=l+i;\n\t\t\tif(x==r)\n\t\t\t{ if((a-i)%2==0)\n\t\t\t\t{\tprintf(\"%d\",2*r+a-i);}\n\t\t\t\telse{printf(\"%d\",2*r+a-i-1);\n\t\t\t\t}\tbreak;\t\n\t\t\t}\n\t\t\telse if(r>x)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2*(l+a));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,t,x,k,max,min,ans;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((l==0||r==0)&&(a==0))\n ans=0;\n if((l==0||r==0)&&(a!=0))\n {\n if(l==0)\n k=r;\n else\n k=l;\n if(a<=k)\n ans=2*a;\n else\n ans=2*k;\n }\n min=(l<r)?l:r;\n max=(l>r)?l:r;\n x=max-min;\n if(x>=a)\n ans=2*(min+a);\n if(x<a)\n {\n min=min+x;\n t=a-x;\n ans=2*(min+t/2);\n }\n if(x==0)\n {\n ans=2*(min+a/2);\n }\n printf(\"%d\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,a,b,c,x;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==b)\n {\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n }\n else if(a>b && a-b<=c)\n {\n while(b!=a)\n {\n b=b+1;\n c=c-1;\n }\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n\n }\n else if(a<b && b-a<=c)\n {\n while(a!=b)\n {\n a=a+1;\n c=c-1;\n }\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n }\n else if(a>b && a-b>c)\n {\n b=b+c;\n i=a-b;\n a=a-i;\n x=a+b;\n }\n else if(a<b && b-a>c)\n {\n a=a+c;\n i=b-a;\n b=b-i;\n x=a+b;\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int a,l,r,ans;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(a==0)\n {\n if(l<r)\n ans=2*l;\n else\n ans=2*r;\n }\n else if(l<r)\n {\n for(;a!=0;)\n {\n if(a>0&&l<r)\n {\n l++;\n a--;\n }\n else if(r==l&&a>1)\n {\n r++;\n l++;\n a-=2;\n }\n else if(r==l&&a==1)\n break;\n }\n if(l<r)\n ans=2*l;\n else\n ans=2*r;\n }\n else if(r<l)\n {\n for(;a!=0;)\n {\n if(a>0&&r<l)\n {\n r++;\n a--;\n }\n else if(r==l&&a>1)\n {\n r++;\n l++;\n a-=2;\n }\n else if(r==l&&a==1)\n break;\n }\n if(r<l)\n ans=2*r;\n else\n ans=2*l;\n }\n else\n {\n if(a%2==0)\n ans=r+l+a;\n else\n ans=r+l+a-1;\n }\n printf(\"%d\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a,count;\n scanf(\"%d%d%d\",&l,&r,&a);\n count=0;\n while(count<a){\n if(l>(r+a)){\n r=r+a;\n goto x;\n }\n if(r>(l+a)){\n l=l+a;\n goto x;\n }\n if(l<r){\n l++;\n count++;\n }\n if(l==r){\n if((a-count)%2==0){\n l=l+(a-count)/2;\n r=r+(a-count)/2;\n goto x;\n }\n else{\n l=l+(a-count-1)/2;\n r=r+(a-count-1)/2;\n goto x;\n }\n }\n if(r<l){\n r++;\n count++;\n }\n }\n x:\n if(l<=r)\n printf(\"%d\",2*l);\n else\n printf(\"%d\",2*r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\t\tint i,j,r,l,a,cnt;\n\t\twhile(scanf(\"%d %d %d \",&l,&r,&a)!=EOF){\n\t\t\t\tcnt=0;\n\t\t\t\tif(l>r){\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\n\n\t\t\t\t}\n\t\t\t\telse if(r>l){\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n//\tprintf(\"cnt%d\\n\",cnt);\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\t\t\t\t}\n\t\t\t\telse if(r==l){\n\t\t\t\t\t\tprintf(\"%d\\n\",2*(l+a/2));\n\t\t\t\t}\n\n\t\t}\n\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((l==0&&a==0)||(r==0&&a==0)||(l==0&&r==0&&a==0))\n\n {\n printf(\"0\");\n return 0;\n }\n else if( l+a<=r)\n {\n printf(\"%d\",(l+a)*2);\n return 0;\n }\n else if(r+a<=l)\n {\n printf(\"%d\",(r+a)*2);\n return 0;\n }\n else\n {\n int z;\n z=(l+r+a)/2;\n printf(\"%d\",z*2);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int rh,lh,ne,d,sum,div,i;\n scanf(\"%lld %lld %lld\",&rh,&lh,&ne);\n\n d = ne;\n if(rh>lh){\n\n while(ne>0){\n if(lh == rh){\n break;\n }\n lh++;\n d--;\n ne--;\n }\n\n div = d/2;\n sum = (lh*2) + (div*2);\n printf(\"%lld\\n\",sum);\n }\n else {\n\n while(ne>0){\n if(rh == lh){\n break;\n }\n rh++;\n d--;\n ne--;\n }\n \n div = d/2;\n sum = (rh*2) + (div*2);\n printf(\"%lld\\n\",sum);\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,z,n,t,p;\n\n scanf(\"%d %d %d\", &x, &y, &z);\n\n n = abs(x - y);\n p = z;\n z = z - n;\n\n if(z >= 0)\n {\n if(x > y)\n {\n t =(y+n+(z/2))*2;\n }\n else\n {\n t = (x+n+(z/2))*2;\n }\n }\n else\n {\n if(x>y)\n {\n t =(y+p)*2;\n }\n else\n {t =(x+p)*2;\n }\n }\n printf(\"%d\", t);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n int a,b,c,d,e;\n scanf(\"%d%d%d\",&a,&b,&c);\n d=b-a;\n if (d<0)\n d=-d;\n e=c-d;\n if(e>=0)\n printf(\"%d\",a+b+d+(e/2)*2);\n else\n {\n if(b>a)\n printf(\"%d\",2*(a+c));\n else if (a>b)\n printf(\"%d\",2*(b+c));\n\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\t\tint i,j,r,l,a,cnt;\n\t\twhile(scanf(\"%d %d %d \",&l,&r,&a)!=EOF){\n\t\t\t\tcnt=0;\n\t\t\t\tif(l>r){\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\n\n\t\t\t\t}\n\t\t\t\telse if(r>l){\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n//\tprintf(\"cnt%d\\n\",cnt);\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\t\t\t\t}\n\t\t\t\telse if(r==l){\n\t\t\t\t\t\tprintf(\"%d\\n\",2*(l+a/2));\n\t\t\t\t}\n\n\t\t}\n\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() \n{\n int l,r,a,m,x;\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n scanf(\"%d\",&a);\n \n if((r==0&&a==0)||(a==0&&l==0))\n {\n printf(\"0\");\n }\n \n else if(l<r)\n {\n \n x=r-l;\n if(a<x)\n {\n m=a+l+r-(x-a);\n printf(\"%d\",m);\n }\n if(a>x)\n {\n if((a-x)%2==0)\n {\n m=2*r+(a-x);\n printf(\"%d\",m);\n }\n else if((a-x)%2!=0)\n {\n m=2*r+(a-x-1);\n printf(\"%d\",m);\n }\n \n }\n if(a==x)\n {\n m=a+l+r;\n printf(\"%d\",m);\n \n }\n }\n else if(l==r)\n {\n if(a%2==0) \n {\n m=l+r+a;\n \n printf(\"%d\",m);\n }\n else if(a%2!=0)\n {\n m=l+r+a-1;\n printf(\"%d\",m);\n }\n \n }\n else if(l>r)\n {\n x=l-r;\n if(a<x)\n {\n m=a+l+r-(x-a);\n printf(\"%d\",m);\n }\n if(a>x)\n {\n if((a-x)%2==0)\n {\n m=2*l+(a-x);\n printf(\"%d\",m);\n }\n else if((a-x)%2!=0)\n {\n m=2*l+(a-x-1);\n printf(\"%d\",m);\n }\n \n }\n if(a==x)\n {\n m=a+l+r;\n printf(\"%d\",m);\n \n }\n \n }\n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nmain()\n{\nint l,r,a,temp,ans;\nscanf(\"%d %d %d\",&l,&r,&a);\nif(l<r)\n{ while(a>0)\n {\n l=l+1;\n a=a-1;\n }\n if(l<=r)\n ans=2*l;\n else\n {temp=l-r;\n if(temp%2==0)\n ans=l+r;\n else\n ans=l+r-1;\n }\n}\nelse\n{\n while(a>0)\n {\n r=r+1;\n a=a-1;\n }\n if(l>=r)\n ans=2*r;\n else\n {temp=r-l;\n if(temp%2==0)\n ans=l+r;\n else\n ans=l+r-1;\n}}\nprintf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int left,right,ambidexter;\n scanf(\"%d %d %d\",&left,&right,&ambidexter);\n int max_team,difference;\n if (left==right)\n {\n ambidexter=ambidexter/2;\n max_team=left+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (left > right)\n {\n difference=left-right;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=left+left+(2*ambidexter);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n right+=ambidexter;\n max_team=right+right;\n printf(\"%d\\n\",max_team);\n }\n }\n else if (left < right)\n {\n difference=right-left;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n left+=ambidexter;\n max_team=left+left;\n printf(\"%d\\n\",max_team);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b){ \tif (a<b) return a; else return b;}\nint max(int a, int b){ if (a>b) return a; else return b;}\n\nint main(){\n\nint l,r,a,s=0,t;//i,j,k;\n\nscanf(\"%i %i %i\",&l,&r,&a);\n\nif (r==l){\n\ts = 2*l;\n\ts+= (a%2==0)? a: a-1;\n\t}\nelse{\n\tt = max(l,r) - min(l,r);\n\ts = 2*min(l,r) + 2*min(a,t);\n\tif ( t < a ){\n\t\tt = (a-t);\n\t\ts += (t % 2 == 0 ) ? t : t-1;\n\t}\n}\n\nprintf(\"%i\\n\",s );\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int left,right,ambidexter;\n scanf(\"%d %d %d\",&left,&right,&ambidexter);\n int max_team,difference;\n if (left==right)\n {\n ambidexter=ambidexter/2;\n max_team=left+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (left > right)\n {\n difference=left-right;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=left+left+(2*ambidexter);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n right+=ambidexter;\n max_team=right+right;\n printf(\"%d\\n\",max_team);\n }\n }\n else if (left < right)\n {\n difference=right-left;\n if (ambidexter>=difference)\n {\n ambidexter-=difference;\n ambidexter=ambidexter/2;\n max_team=right+right+(ambidexter*2);\n printf(\"%d\\n\",max_team);\n }\n else if (ambidexter<difference)\n {\n left+=ambidexter;\n max_team=left+left;\n printf(\"%d\\n\",max_team);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nmain()\n{\nint l,r,a,temp,ans;\nscanf(\"%d %d %d\",&l,&r,&a);\nif(l<r)\n{ while(a>0)\n {\n l=l+1;\n a=a-1;\n }\n if(l<=r)\n ans=2*l;\n else\n {temp=l-r;\n if(temp%2==0)\n ans=l+r;\n else\n ans=l+r-1;\n }\n}\nelse\n{\n while(a>0)\n {\n r=r+1;\n a=a-1;\n }\n if(l>=r)\n ans=2*r;\n else\n {temp=r-l;\n if(temp%2==0)\n ans=l+r;\n else\n ans=l+r-1;\n}}\nprintf(\"%d\",ans);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int r,l,a,s,min,n,max;\n scanf(\"%d%d%d\",&r,&l,&a);\n if(r>l){ min=l;\n max=r;}\n else {min=r;\n max=l;}\n if(r!=0 || l!=0){\n if(r==l){n=(r+(a/2))*2;}\n else{ s=max-min;\n if(s<a){a=(a-s)/2;\n n=(min+s+a)*2;}\n else {n=(min+a)*2;}\n }}\n else {\nif(a%2==0) n=a;\nelse n=a-1;}\n printf (\"%d\",n);\n}\n"}, {"source_code": "#include <stdio.h>\nunsigned short absv(unsigned short, unsigned short);\nunsigned short min(unsigned short, unsigned short);\nint main()\n{\n unsigned short l, r, a, n, k;\n scanf(\"%hu%hu%hu\", &l, &r, &a);\n k = absv(l, r);\n if(a < k){\n n = (a + min(l, r)) * 2;\n\n }else{\n a -= k;\n n = k + l + r + (a - a % 2);\n\n }\n printf(\"%hu\", n);\n return 0;\n}\nunsigned short absv(unsigned short x, unsigned short y){\n return x > y ? x - y : y - x;\n}\nunsigned short min(unsigned short x, unsigned short y){\n return x < y ? x : y;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint a,b,c;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\twhile(c){\n\t\tif(a>b) b++;\n\t\telse a++;\n\t\tc--;\n\t}\n\tprintf(\"%d\",a > b ? b*2 : a*2);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a,c;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l<r){\n c=r-l;\n if(c>=a){\n l=l+a;\n r=l;\n }\n else {\n l=l+c;\n a=a-c;\n a=a/2;\n l=l+a;\n r=r+a;\n }\n }\n else if(r<l){\n c=l-r;\n if(c>=a){\n r=r+a;\n l=r;\n }\n else {\n r=r+c;\n a=a-c;\n a=a/2;\n l=l+a;\n r=r+a;\n }\n }\n else {\n a=a/2;\n l=l+a;\n r=r+a;\n }\n printf(\"%d\",2*l);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int l, r, a, t;\n\n scanf(\"%d%d%d\", &l, &r, &a);\n\n if(l < r && l + a < r)\n {\n t = 2 *(l + a);\n }\n else if(l > r && a + r < l){\n\n t = 2 * (r + a);\n }\n\n else if(l == r){\n t = l + r + (a / 2) + (a / 2);\n }\n else if(l < r && l+a > r){\n if(r < a){\n t = 2* r +( a - (r-l))/2+( a - (r-l))/2;\n }else{\n t = 2* l +( a - (l-r))/2+( a - (l-r))/2;\n }\n }\n printf(\"%d\", t);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i,j,x,y,z,ans;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b){\n x=a;\n y=b;\n }\n else{\n x=b;\n y=a;\n }\n if((y+c)>x){\n ans=2*x+2*((y+c-x)/2);\n printf(\"%d\",ans);\n }\n else if((y+c)<x){\n ans=2*(y+c);\n printf(\"%d\\n\",ans);\n }\n else if(a==b){\n ans=a+b+2*(c/2);\n printf(\"%d\\n\",ans);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int l, r, a, s;\n scanf(\"%d%d%d\",&l,&r,&a);\n printf(\"%d\",(l+r+a)/2*2);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdio.h>\n\nint main() {\n int l,u,a;\n scanf(\"%d %d %d\",&l,&u,&a);\n int min,max;\n if(l<u){\n min=l;\n max=u;\n }\n\n else if(u<l){\n min=u;\n max=l;\n }\n\n\n\n int x=(a/2)*2;\n \n\n if(l==u)\n printf(\"%d\",2*l+x);\n else if((min+a)<max)\n printf(\"%d\",2*(min+a));\n else if((min+a)>max)\n printf(\"%d\",2*max+(a-max)/2);\n\n \n\n }\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i,j,x,y,z,ans;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b){\n x=a;\n y=b;\n }\n else{\n x=b;\n y=a;\n }\n if((y+c)>x){\n ans=2*x+2*((y+c-x)/2);\n printf(\"%d\",ans);\n }\n else if((y+c)<x){\n ans=2*(y+c);\n printf(\"%d\\n\",ans);\n }\n else if(a==b){\n ans=a+b+2*(c/2);\n printf(\"%d\\n\",ans);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\nint main()\n{\n int a,b,c,s;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<b)\n {\n if((a+c)<=b)\n {\n s=2*(a+c);\n }\n else\n {\n c=c-b+a;\n c=c/2;\n s=s*(b+c);\n }\n }\n else if(a==b)\n {\n c=c/2;\n s=2*(b+c);\n }\n else\n {\n if((b+c)<=a)\n {\n s=2*(b+c);\n }\n else\n {\n c=c-a+b;\n c=c/2;\n s=s*(a+c);\n }\n }\n printf(\"%d\\n\",s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint l, r, a, tmp=0;\n\tscanf(\"%d %d %d\", &l, &r, &a);\n\n\tint total=0;\n\n\tif((l==0 && a==0)|| (r==0 && a==0))\n\t\ttotal=0;\n\n\telse if(l==0)\n\t{\n\t\tif(r>=a)\n\t\t\ttotal=2*a;\n\t\telse\n\t\t{\n\t\t\ttotal=2*r;\n\t\t\ttmp=a-r;\n\t\t\tif(tmp%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\t\n\telse if(r==0)\n\t{\n\t\tif(l>=a)\n\t\t\ttotal=2*a;\n\t\telse\n\t\t{\n\t\t\ttotal=2*l;\n\t\t\ttmp=a-l;\n\t\t\tif(tmp%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\t\n\n\telse if(l>r)\n\t{\n\t\tif((r+a)<=l)\n\t\t\ttotal=2*(r+a);\n\n\t\telse if((r+a)>l)\n\t\t{\n\t\t\ttmp=l-r;\n\t\t\ttotal=(2*l);\n\t\t\ta=a-tmp;\n\t\t\tif(a%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\n\telse if(r>l)\n\t{\n\t\tif((l+a)<=r)\n\t\t\ttotal=2*(l+a);\n\n\t\telse if((l+a)>r)\n\t\t{\n\t\t\ttmp=r-l;\n\t\t\ttotal=(2*r);\n\t\t\ta=a-tmp;\n\t\t\tif(a%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\n\telse\n\t{\n\t\ttotal=2*r;\n\t\tif(a%2==0)\n\t\t\ttotal=total+a;\n\t\telse\n\t\t\ttotal=total+a-1;\n\t}\n\tprintf(\"%d\", total);\n}"}, {"source_code": "#include<stdio.h>\nint smaller(int a, int b){\n if(a>b){\n a = b;\n }\n return a;\n}\nint larger(int a, int b){\n if(b>a){\n a = b;\n }\n return a;\n}\nint main()\n{\n int x,y,z,temp1,temp2;\n scanf(\"%d%d%d\",&x,&y,&z);\n temp1 = smaller(x,y);\n temp2 = larger(x,y);\n\n while(temp1 != temp2){\n temp1 = temp1 + 1;\n }\n if(z%2!=0){\n z = z - 1;\n }\n int total_player;\n total_player = temp1 + temp2 + z;\n if(y==0 || x==0){\n total_player = 0;\n }\n printf(\"%d\",total_player);\n return 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int l,r,a;\n scanf(\"%d %d %d\",&l,&r,&a);\n if (l==r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+(a/2)));\n }\n\n else if(l<r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+a));\n }\n\n else if(l>r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(r+a));\n }\n else if ((r==0 && a==0) || l==0 && a==0)\n {\n printf(\"%d\",0);\n }\n\n\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n\n{\n long long a,b,c,n,r;\n scanf(\"%I64d %I64d %I64d\",&a,&b,&c);\n if(c==0)\n {\n if(a!=b){printf(\"No\");}\n else{printf(\"Yes\");}\n }\n\n else{\n n=(b-a+c)/c;\n if(n>0){\n\n r=a+(n-1)*c;\n if(r==b)\n {\n printf(\"Yes\");\n }\n else{printf(\"No\");}}\n else{printf(\"No\");}\n\n\n}}\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,i;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((a==0&&r==0)||(a==0&&l==0)){\n printf(\"%d\",a);\n }\n else{\n for(i=1;i<=a;i++){\n if(l<r){\n l++;\n a--;\n\n }\n else if(l>r){\n if(r==0){\n r++;\n a--;\n l--;}\n else{\n r++;\n a--;\n }\n\n }\n else if(l=r){\n l++;\n r++;\n a=a-2;}\n }\n printf(\"%d\",l+r);}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main( )\n{\n\tint l,r,a, team=0;\n\n\tprintf(\"Enter l, r, a:\");\n\tscanf(\"%d%d%d\", &l, &r, &a);\n\tprintf(\"left=%d, right=%d, ambi=%d\\n\", l,r,a);\n\n\t\n\tif (l ==r)\n\t{\n\t\tteam += l + r;\n\t\tif(a%2 ==0)\n\t\t\tteam += a;\n\t\telse\n\t\t\tteam += (a-1);\n\t}\n\telse if ( l < r)\n\t{\n\t\tteam += 2*l;\n\t\tr = r-l;\n\t\tif( a < r)\n\t\t{\n\t\t\tteam += 2*a;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tteam += 2*r;\n\t\t\ta = a-r;\n\t\t\tif(a%2 ==0)\n\t\t\t\tteam += a;\n\t\t\telse\n\t\t\t\tteam += (a-1);\n\t\t}\n\t}\n\telse\n\t{\n\t\tteam += 2*r;\n\t\tl = l-r;\n\t\tif( a < l)\n\t\t{\n\t\t\tteam += 2*a;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tteam += 2*l;\n\t\t\ta = a-l;\n\t\t\tif(a%2 ==0)\n\t\t\t\tteam += a;\n\t\t\telse\n\t\t\t\tteam += (a-1);\n\t\t}\n\t}\n printf(\"%d\", team);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r) {\n s=l+r+(a/2)+(a/2);\n }\n if(l!=r)\n {\n if((a+l)<=r){\n s=2*(a+l);\n }\n\n else if((a+l)>r && l<=r )\n {\n s=l+r+(a/2)+(a/2);\n }\n else if((a+r)<=l && r<l){\n s=2*(a+r);}\n\n else\n {\n s=r+l+(a/2)+(a/2);}\n\n } printf(\"%d\",s);\n\n\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x,y,z,a,r;\n scanf(\"%d %d %d\",&x,&y,&z);\n a=x-y;\n if(a<0)\n {\n a=-a;\n if(a>z)\n {\n x=x+z;\n r=2*x;\n }\n }\n if(a>0&&a<z)\n {\n y=y+a;\n z=z-a;\n if(z%2==0)\n {\n r=2*(y+z/2);\n }\n if(z%2!=0){r=2*(y+(z-1)/2);}\n }\n if(a==0&&a<z)\n {\n if(z%2==0)\n {\n r=2*(y+z/2);\n }\n if(z%2!=0){r=2*(y+(z-1)/2);}\n }\n\n printf(\"%d\",r);\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a, b, c,l,r,sum;\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tl=a+c;\n\tr=b+c;\n\tsum=l+r-c;\n\tif ((a==0 && c==0) || (b==0 && c==0)) printf(\"%d\\n\", 0);\n\telse if (sum%2==0) printf(\"%d\\n\", sum);\n\telse printf(\"%d\\n\", sum-1);\n\t\n\treturn 0;\n}\n\t"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint l,r,a,list[3]={};\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\t\n\tlist[0] = (l>r)? l:r;\n\tlist[1] = (r<=l)? r:l;\n\tlist[2] = a;\n\t\n\tint t=0;\n\tt= list[1]*2;\n\tlist[0]-=list[1];\n\tif (list[0]-list[2]>=0) {\n\t\tt+=(list[2]/2)*4;\n\t\tlist[2]-=(list[2]/2)*2;\n\t}\n\telse {\n\t\tt+=list[0]*2;\n\t\tlist[2]-=list[0];\n\t}\n\tt+=(list[2]/2)*2;\n\t\n\tprintf(\"%d\",t);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int l,r,a,sum=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if( (l==0 && r==0)||(l==0&& a==0)||(r==0 && a==0))\n printf(\"0\");\n else\n {\n sum = l+r+a;\n if(sum % 2 == 0)\n printf(\"%d\",sum);\n else\n printf(\"%d\",sum-1);\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,x,m,r,a,n;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l==r)\n\t{ start:\n\t\tif(a%2!=0 && a!=0)\t\n\t{\tx=l+r+a-1;}\n\t\telse \n\t{\tx=l+r+a; }\n\tprintf(\"%d\\n\",x);\n\t}\n\telse if(l>r)\n\t{m=l-r;\n\tif(a-m>0)\n\tr=r+m;\n\ta=a-m;\n\tgoto start;}\n\t\n\telse if(l<r)\n\t{\n\tm=r-l;\n\tif(a-m>0)\n\tl=l+m;\n\ta=a-m;\n\tgoto start;\t\t\n\t}\n\telse\n\tprintf(\"0\\n\");\n\t\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r,a;\nscanf(\"%d %d %d\",&l,&r,&a);\nif((l==0 && a==0) || (r==0 && a==0)){\n printf(\"0\");\n}\nelse if((l+a)<=r)printf(\"%d\",2*(l+a));\nelse if((l+r+a)%2==0){\n printf(\"%d\",l+r+a);\n}\nelse{\n printf(\"%d\",(l+r+a)-1);\n}\n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<String.h>\nint main(){\nint a,b,c;\nscanf(\"%d %d %d\",&a,&b,&c);\nif(a==0||b==0){\n printf(\"0\");\n}\nelse if(a==b){\n printf(\"%d\",(a+c/2)+(b+c/2));\n}\nelse if(a<b){\n if((a+b)==c){\n printf(\"%d\",c*2);\n }\n else if(b-a<c){\n printf(\"%d\",(((c-(b-a))/2)+b)*2);\n\n }\n else if(b-a==c){printf(\"%d\",2*b);\n }\n else {\n printf(\"%d\",(a+c)*2);\n }\n}\nelse if(b<a){\n if((a+b)==c){\n printf(\"%d\",c*2);\n }\n else if(a-b<c){\n printf(\"%d\",(((c-(a-b))/2)+a)*2);\n\n }\n else if(a-b==c){printf(\"%d\",2*a);\n }\n else {\n printf(\"%d\",(b+c)*2);\n }\n}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int l,r,a,sum=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n if( (l==0 && r==0)||(l==0&& a==0)||(r==0 && a==0))\n printf(\"0\");\n else\n {\n sum = l+r+a;\n if(sum % 2 == 0)\n printf(\"%d\",sum);\n else\n printf(\"%d\",sum-1);\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a;\n scanf(\"%d%d%d\", &l,&r,&a);\n int x=0;\n\n while(x == 0)\n {\n if ((l ==0 || r==0) && a==0)\n {\n printf(\"%d\", 0);\n x=1;\n }\n else if(l==r)\n {\n a-=2;\n l++;\n r++;\n if(a<2)\n {\n printf(\"%d\", l+r);\n x=1;\n }\n\n }\n else if (l<r)\n {\n if (a>0)\n {\n a--;\n l++;\n }\n else if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n else if(a==0 && l<r)\n {\n r--;\n if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n }\n }\n else if(r<l)\n {\n if (a>0)\n {\n a--;\n r++;\n }\n else if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n else if(a==0 && r<l)\n {\n l--;\n if(l==r)\n printf(\"%d\", l + r);\n x=1;\n }\n }\n }\n return 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,a;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l>r)\n {\n r+=a;\n if(r>l)\n {\n printf(\"%d\\n\",l*2);\n }\n else printf(\"%d\\n\",r*2);\n }\n else if(r<l)\n {\n l+=a;\n if(l>r)\n {\n printf(\"%d\\n\",(l-r));\n }\n else\n printf(\"%d\\n\",(r-l));\n }\n else\n {\n if((l+r+a)%2 == 0)\n {\n printf(\"%d\\n\",l+r+a);\n }\n else\n {\n printf(\"%d\\n\",l+r+a-1);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\tint l;\n\tint r;\n\tint a;\n\n\tprintf(\"Enter a number of players in this way l r a \\n\");\n\tscanf(\"%i %i %i\", &l, &r, &a);\n\n\tif(l == r) {\n\t\tif((a & 1) == 0) {\n\t\tprintf(\"%i\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%i\", l + r + (a - 1));\n\t\t}\n\t}\n\n\t\telse if((l == 0 && a == 0)){\n\t\tprintf(\"%i\", l + a);\n\t}\n\n\telse if((r == 0 && a == 0)){\n\t\t\tprintf(\"%i\", r + a);\n\t}\n\n\telse if(l < r){\n\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%i\", l + r + (a - 1));\n\t\t} else {\n\t\t\tprintf(\"%i\", l + r + a);\n\t\t}\n\t\t}\n\n\telse{\n\t\tif((a & 1) == 0) {\n\t\t\t\tprintf(\"%i\", l + r + (a - 1));\n\t} else {\n\t\tprintf(\"%i\", l + r + a);\n\t}\n\t}\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint l,r,a,list[3]={};\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\t\n\tlist[0] = (l>r)? l:r;\n\tlist[1] = (r<=l)? r:l;\n\tlist[2] = a;\n\t\n\tint t=0;\n\tt= list[1]*2;\n\tlist[0]-=list[1];\n\tif (list[0]-list[2]>=0) {\n\t\tt+=(list[2]/2)*4;\n\t\tlist[2]-=(list[2]/2)*2;\n\t}\n\telse {\n\t\tt+=list[0];\n\t\tlist[2]-=list[0];\n\t}\n\tt+=(list[2]/2)*2;\n\t\n\tprintf(\"%d\",t);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r) {//89 44 77\n s=l+r+(a/2)+(a/2);\n }\n if(l!=r)\n {\n if((a+l)<=r){\n s=2*(a+l);\n }\n else if((a+l)>r && (a+r)>l && a%2!=0)\n {\n s=l+r+a;\n }\n else if((a+l)>r && (a+r)>l && a%2==0)\n {\n s=l+r+a-1;\n }\n\n else if((a+l)>r && l<=r )\n {\n s=l+r+(a/2)+(a/2);\n }\n else if((a+r)<=l && l>r){\n s=2*(a+r);}\n\n else\n {\n s=r+l+(a/2)+(a/2);}\n\n } printf(\"%d\",s);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,i;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((a==0&&r==0)||(a==0&&l==0)){\n printf(\"%d\",a);\n }\n else{\n for(i=1;i<=a;i++){\n if(l<r){\n l++;\n a--;\n\n }\n else if(l>r){\n if(r==0){\n r++;\n a--;\n l--;}\n else{\n r++;\n a--;\n }\n\n }\n else if(l=r){\n l++;\n r++;\n a=a-2;}\n }\n printf(\"%d\",l+r);}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n\tint a,b,c,tong;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ttong = a+b+c ;\n\tif(a!=0&&b!=0&&c!=0)\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tif((a+c)<b) printf(\"%d\",(a+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a>b)\n\t\t{\n\t\t\tif((b+c)<a) printf(\"%d\",(b+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t}\n\t}\n\telse if(c==0)\n\t{\n\t\tif(a!=0&&b!=0) \n\t\t{\n\t\t\tif(a<b) printf(\"%d\",a*2);\n\t\t\telse printf(\"%d\",b*2);\n\t\t}\n\t\telse if(a==0&&b!=0) printf(\"%d\",0);\n\t\telse if(b==0&&a!=0) printf(\"%d\",0);\n\t\telse if(a==0&&b==0) printf(\"%d\",0);\n\t}\n\tif(a==0 || b==0)\n\t{\n\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\telse printf(\"%d\",tong - 1 ) ;\n\t}\n}\n//dsfsdfsd"}, {"source_code": "#include<stdio.h>\n\nint main ()\n{\n\tint a,b,c,tong;\n\tscanf(\"%d %d %d\",&a,&b,&c);\n\ttong = a+b+c ;\n\tif(a!=0&&b!=0&&c!=0)\n\t{\n\t\tif(a<b)\n\t\t{\n\t\t\tif((a+c)<b) printf(\"%d\",(a+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a>b)\n\t\t{\n\t\t\tif((b+c)<a) printf(\"%d\",(b+c)*2);\n\t\t\telse {\n\t\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t\t}\n\t\t}\n\t\tif(a==b)\n\t\t{\n\t\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\t\telse printf(\"%d\",tong - 1 ) ;\n\t\t}\n\t}\n\telse if(c==0)\n\t{\n\t\tif(a!=0&&b!=0) \n\t\t{\n\t\t\tif(a<b) printf(\"%d\",a*2);\n\t\t\telse printf(\"%d\",b*2);\n\t\t}\n\t\telse if(a==0&&b!=0) printf(\"%d\",0);\n\t\telse if(b==0&&a!=0) printf(\"%d\",0);\n\t\telse if(a==0&&b==0) printf(\"%d\",0);\n\t}\n\tif(a==0 || b==0)\n\t{\n\t\tif(tong%2==0) printf(\"%d\",tong);\n\t\telse printf(\"%d\",tong - 1 ) ;\n\t}\n}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint l,r,a;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tint t;\n\t\n\tif(r>l){\n\t\tl=l+a;\n\t\tif(l>r){\n\t\t\ta=l-r;\n\t\t\tif(a>0){\n\t\t\t\tt=(r+a/2)*2;\n\t\t\t\tprintf(\"%d\",t);\n\t\t\t}\n\t\t\telse printf(\"%d\",r*2);\n\t\t}\t\n\t\telse printf(\"%d\",l*2);\n\t\treturn 0;\n\t}\n\tif(l>r){\n\t\tr=r+a;\n\t\tif(r>l){\n\t\t\ta=r-l;\n\t\t\tif(a>0){\n\t\t\t\tt=(l+a/2)*2;\n\t\t\t\tprintf(\"%d\",t);\n\t\t\t}\n\t\t\telse printf(\"%d\",l*2);\n\t\t}\t\n\t\telse printf(\"%d\",r*2);\n\t\treturn 0;\n\t}\n\tif(l==r){\n\t\tif(a==0) printf(\"%d\",r);\n\t\telse printf(\"%d\",(l+a/2)*2);\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,i,j,x;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tfor(i=a;i>=0;i--)\n\t{\n\t\tif(l-r>=0)\n\t\t{\n\t\t\tx=r+i;\n\t\t\tif(x==l)\n\t\t\t{ if((a-i)%2==0)\n\t\t\t\t{\tprintf(\"%d\",2*l+a-i);}\n\t\t\t\telse{printf(\"%d\",2*l+a-i-1);\n\t\t\t\t}\n\t\t\tbreak;\t\n\t\t\t}\n\t\t\telse if(l>x)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2*(r+a));\n\t\t\t\tbreak;\n\t\t\t}\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tx=l+i;\n\t\t\tif(x==r)\n\t\t\t{ if((a-i)%2==0)\n\t\t\t\t{\tprintf(\"%d\",2*l+a-i);}\n\t\t\t\telse{printf(\"%d\",2*l+a-i-1);\n\t\t\t\t}\tbreak;\t\n\t\t\t}\n\t\t\telse if(r>x)\n\t\t\t{\n\t\t\t\tprintf(\"%d\",2*(l+a));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n\t\tint i,j,r,l,a,cnt;\n\t\twhile(scanf(\"%d %d %d \",&l,&r,&a)!=EOF){\n\t\t\t\tcnt=0;\n\t\t\t\tif(l>r){\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\n\n\t\t\t\t}\n\t\t\t\telse if(r>l){\n\t\t\t\t\t\twhile(l!=0){\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\tl--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\twhile(r!=0){\n\t\t\t\t\t\t\tif(a==0)break;\n\t\t\t\t\t\t\t\tr--;\n\t\t\t\t\t\t\t\ta--;\n\t\t\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\t}\n//\tprintf(\"cnt%d\\n\",cnt);\n\t\t\t\t\t\tif(a>=2){\n\t\t\t\t\t\t\t\tcnt+=a/2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprintf(\"%d\\n\",2*cnt);\n\t\t\t\t}\n\t\t\t\telse if(r==l){\n\t\t\t\t\t\tprintf(\"%d\\n\",2*(l+a/2));\n\t\t\t\t}\n\n\t\t}\n\n\t\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,z,b,c,d;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((l>-1 && r>-1 && a>-1) && (l<101 && r<101 && a<101)){\n if(l==r){\n b=a%2;\n\n if(b==0){\n z=l+r+a;\n printf(\"%d\\n\",z);\n }\n else {\n z=l+r+a-1;\n printf(\"%d\\n\",z);\n }\n }\n else if(l>r){\n c=l-r;\n if(c==a){\n z=l+r+a;\n printf(\"%d\\n\",z);\n }\n else if(c>a){\n z=2*(r+a);\n printf(\"%d\\n\",z);\n }\n else {\n z=2*l;\n printf(\"%d\\n\",z);\n }\n }\n else {\n d=r-l;\n if(d==a){\n z=l+r+a;\n printf(\"%d\\n\",z);\n }\n else if(d>a){\n z=2*(l+a);\n printf(\"%d\\n\",z);\n }\n else {\n z=2*r;\n printf(\"%d\\n\",z);\n }\n }\n return 0;\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint a, b, c,max, min,l;\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tmax=a;\n\tmin=a;\n\tif (max<b) max=b;\n\telse if (max==b) max=min;\n\telse min=b;\n\tif (min+c==max) l=max*2;\n\telse if (min+c<max) l=(min+c)*2;\n\telse if (min+c>max && ((min+c)-max)%2==0)\n\tl=max*2+((min+c)-max);\n\telse if (min+c>max && ((min+max)-b)%2!=0)\n\tl=max*2+((min+c)-max-1);\n\tprintf(\"%d\", l);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a, fl=0,fr=0, fe=0,d;\n\t\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\t\n\tif(a+l>r || a+r>l)\n\t{\n\t\td=l-r;\n\t\tif(l<r && a>l){l=l+d;a=a-d;}\n\t\telse if(l>r && a>r){r=r+d;a=a-d;}\n\t}\n\t\t\n\t\n\tif(l>r) fr=1;\n\telse if (r>l) fl=1;\n\telse fe=1;\n\t\n\tif(fr) r+=a;\n\telse if(fl) l+=a;\n\telse if (fe) {l+=(a/2);r+=(a/2);}\n\t\n\t\n\tif(fl||fr)\n\t{\tif(l>r)\t\n\t\t\tl-=(l-r);\n\t\telse\n\t\t\tr-=(r-l);\n\t}\n\tprintf(\"%d\",l+r);\n\t\n\treturn 0;\n\t\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include<stdlib.h>\n\n//using namespace std;\n\nint main()\n{\n int l,r,a,t=0,x,x1;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(a==0&&(l==0||r==0))\n {\n printf(\"0\\n\");\n }\n else\n {\n if(l==r)\n {\n if(a%2==0)\n {\n t=l+r+a;\n }\n else\n {\n t=l+r+a-1;\n }\n }\n else if(l>r)\n {\n x=a+l-r;\n if(x%2==0)\n {\n t=2*r+x;\n }\n else\n {\n t=2*r-1+x;\n }\n }\n //x=0;\n else\n {\n x1=a+r-l;\n if(x1%2==0)\n {\n t=2*l+x1;\n }\n else\n {\n t=2*l-1+x1;\n }\n }\n printf(\"%d\\n\",t);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint l,r,a;\nscanf(\"%d %d %d\",&l,&r,&a);\nif((l==0 && a==0) || (r==0 && a==0)){\n printf(\"0\");\n}\nelse if((l+a)<=r)printf(\"%d\",2*(l+a));\nelse if((l+r+a)%2==0){\n printf(\"%d\",l+r+a);\n}\nelse{\n printf(\"%d\",(l+r+a)-1);\n}\n\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,sum;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(a==0)\n {\n if(l==r)\n {\n sum=2*r;\n }\n else if(l>r)\n {\n sum=2*r;\n }\n else if(r>l)\n {\n sum=2*l;\n }\n }\n else\n {\n if(l>r)\n {\n if(l-r>=a)\n {\n sum=2*(r+a);\n }\n else if(l-r<a)\n {\n if(a%2==0)\n {\n sum=(2*l)+(a-(l-r));\n }\n else\n {\n sum=(2*l)+((a-(l-r))-1);\n }\n }\n }\n else if(r>l)\n {\n if(r-l>=a)\n {\n sum=2*(l+a);\n }\n else if(r-l<a)\n {\n if(a%2==0)\n {\n sum=(2*r)+(a-(r-l));\n }\n else\n {\n sum=(2*r)+((a-(r-l))-1);\n }\n }\n }\n else if(r==l)\n {\n if(a%2==0)\n {\n sum=(2*l)+a;\n }\n else\n {\n sum=(2*l)+(a-1);\n }\n }\n }\n printf(\"%d\",sum);\n return 0;\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <math.h>\n\nint main(int argc, char *argv[]) {\n int l, r, a;\n scanf(\"%d%d%d\", &l, &r, &a);\n if (abs(l - r) >= a) {\n if (l > r) printf(\"%d\", 2 * (r + a));\n else printf(\"%d\", 2 * (l + a));\n }\n else {\n if (l > r) printf(\"%d\", 2 * l + a - abs(l - r));\n else printf(\"%d\", 2 * r + a - abs(l - r));\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int l,r,a,s=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n s=l+r+a;\n if(l+a==0 || r+a==0 ){\n printf(\"0\");\n }\n else if(l+r==a || r+a==l || l+a==r)\n {\n printf(\"%d\",s);\n }\n else if(l>r)\n {\n if(l-r>=a)\n {\n printf(\"%d\",s-(l-r)+a);\n }\n else if(l-r<a)\n {\n printf(\"%d\",s-1);\n }\n }\n else if(r>l)\n {\n if(r-l>=a)\n {\n printf(\"%d\",s-(r-l)+a);\n }\n else if(r-l<a)\n {\n printf(\"%d\",s-1);\n }\n }\n else if(l==r && r==a && a==l)\n {\n printf(\"%d\",s-1);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int l,r,a,x;\n scanf(\"%d %d %d\",&l,&r,&a);\n x=((a-abs(l-r))/2);\n if (l==r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+(a/2)));\n }\n\n else if((l+a)<=r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+a));\n }\n\n else if((r+a)<=l && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(r+a));\n }\n else if ((r==0 && a==0) || l==0 && a==0)\n {\n printf(\"%d\",0);\n }\n\n else if((r+a)>l && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(x+l));\n }\n else if((l+a)>r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(x+r));\n }\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\n#define min(a,b) a<b?a:b\nint main()\n{\n int m,n,a,s;\n scanf(\"%d%d%d\",&m,&n,&a);\n if(a==0)\n printf(\"%d\\n\",min(m,n)*2);\n else\n {\n if(m<n)\n {\n m+=a;\n if(m<=n)\n s=min(m,n),printf(\"%d\\n\",2*s);\n else\n printf(\"%d\\n\",n*2+((m-n)/2)*2);\n }\n else\n {\n n+=a;\n if(n<=m)\n s=min(m,n),printf(\"%d\\n\",s*2);\n else\n printf(\"%d\\n\",m*2+((n-m)/2)*2);\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint l,r,a,di,d;\n\tint re;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tdi=0;\n if(r>l)\n\t{\n\t\tdi=r-l;\n\t\tdi=di>a?a:di;\n\t\tl=di+l;\n\t\ta=a-di;\n\t\td=l;\n\t}\n\nelse if(l>r)\n\t{\n\t\tdi=l-r;\n\t\tdi=di>a?a:di;\n\t\tr=r+di;\n\t\ta=a-di;\n\t\td=r;\n\t}\nelse\nd=l;\nprintf(\"%d\",d);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int l,r,a,s=0;\n scanf(\"%d %d %d\",&l,&r,&a);\n s=l+r+a;\n if(l+a==0 || r+a==0 ){\n printf(\"0\");\n }\n else if(l+r==a || r+a==l || l+a==r)\n {\n printf(\"%d\",s);\n }\n else if(l>r)\n {\n if(l-r>=a)\n {\n printf(\"%d\",s-(l-r)+a);\n }\n }\n else if(l<r)\n {\n if(l-r<a)\n {\n printf(\"%d\",s-1);\n }\n }\n else if(l==r && r==a && a==l)\n {\n printf(\"%d\",s-1);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain(){\n int l,r,a,h,s,b;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r && a%2==0){\n h=l+r+a;\n }\n else{\n h=l+r+a-1;\n }\n if(l<r){s=l;b=r;}\n else{s=r;b=l;}\n if(s+a<=b){\n h=2*(s+a);\n }\n if(s+a>b){h=2*b;}\n printf(\"%d\",h);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j,k,m=0,n=0,f=0;\n unsigned int l;\n\n scanf(\"%d%d%d\",&i,&j,&k);\n\n if(k==0 && i==0 || j==0){\n\n printf(\"0\");\n return 0;\n }\n\n if(i==j){\n\n if(k%2==0){\n printf(\"%d\",i+j+k);\n return 0;\n }\n\n if(k%2!=0){\n printf(\"%d\",i+j+k-1);\n return 0;\n }\n }\n\n l=i-j;\n\n if(l>k && i>j){ printf(\"%d\",2*(j+k));\n return 0;}\n\n if(l>k&&j>i){printf(\"%d\",2*(i+k));\n return 0;}\n\n if(l==k){printf(\"%d\",i+j+k);\n return 0;}\n\n if(k>l){\n\n m=i+j;\n\n if(m%2==0){\n\n if(k%2==0){\n\n printf(\"%d\",m+k);\n return 0;\n }\n\n if(k%2!=0){\n\n printf(\"%d\",m+k-1);\n return 0;\n }\n }\n\n if(m%2!=0){\n\n if(k%2==0){\n\n printf(\"%d\",m+k-1);\n return 0;\n }\n\n if(k%2!=0){\n\n printf(\"%d\",m+k);\n return 0;\n }\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() \n{\n int l,r,a,m,x;\n scanf(\"%d\",&l);\n scanf(\"%d\",&r);\n scanf(\"%d\",&a);\n \n if((l==0&&r==0)||(r==0&&a==0)||(a==0&&l==0))\n {\n printf(\"0\");\n }\n else if(l<r)\n {\n \n x=r-l;\n if(a<x)\n {\n m=a+l+r-(x-a);\n printf(\"%d\",m);\n }\n if(a>x)\n {\n if((a-x)%2==0)\n {\n m=2*r+(a-x);\n printf(\"%d\",m);\n }\n else if((a-x)%2!=0)\n {\n m=2*r+(a-x-1);\n printf(\"%d\",m);\n }\n \n }\n if(a==x)\n {\n m=a+l+r;\n printf(\"%d\",m);\n \n }\n }\n else if(l==r)\n {\n if(a%2==0) \n {\n m=l+r+a;\n \n printf(\"%d\",m);\n }\n else if(a%2!=0)\n {\n m=l+r+a-1;\n printf(\"%d\",m);\n }\n \n }\n else if(l>r)\n {\n x=l-r;\n if(a<x)\n {\n m=a+l+r-(x-a);\n printf(\"%d\",m);\n }\n if(a>x)\n {\n if((a-x)%2==0)\n {\n m=2*l+(a-x);\n printf(\"%d\",m);\n }\n else if((a-x)%2!=0)\n {\n m=2*l+(a-x-1);\n printf(\"%d\",m);\n }\n \n }\n if(a==x)\n {\n m=a+l+r;\n printf(\"%d\",m);\n \n }\n \n }\n \n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,l,r,b,c,d,p,e,f;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((a==0&&l==0)||(a==0&&r==0))\n {\n f=0;\n printf(\"%d\",f);\n\n }\n\n else if(r!=0&&l!=0&&r>l)\n {\n b=r;\n c=b-l;\n r=c;\n p=l;\n l=l+(r-l);\n\n //l=l+a-r;\n //a=a-(r-l);\n if(a>1)\n {\n a=a-(r-p);\n e=a/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n\n }\n }\n else if(r!=0&&l!=0&&r==l)\n {\n if(a>1)\n {\n c=a/2;\n d=2*c;\n f=r+l+d;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(r!=0&&l!=0&&l>r)\n {\n b=l;\n c=b-r;\n l=c;\n p=r;\n r=r+(l-1);\n a=a-(r-p);\n //r=r+a-l;\n //a=a-(l-r);\n printf(\"%d\",f);\n if(a>1)\n {\n e=a/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n\n }\n else if(l!=0)\n {\n if(r==0&&a>1&&a>l)\n {\n r=a-l;\n a=a-r;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n\n }\n else if(a>1&&l>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(r!=0)\n {\n if(l==0&&a>1&&a>r)\n {\n l=a-l;\n a=a-l;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n\n }\n else if(a>1&&r>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n\n }\n else if(l==0&&r==0)\n {\n if(a>=2)\n {\n if(a%2==0)\n {\n a=a/2;\n e=a*2;\n f=e;\n printf(\"%d\",f);\n }\n }\n else\n {\n f=0;\n printf(\"%d\",f);\n }\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,i,x;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l>r)\n x=l;\n else\n x=r;\n for(i=l;i<=x;i++)\n {\n if(l==r)\n {\n if(l=r=a)\n printf(\"%d\",l+r+(a/2)+(a/2));\n else\n printf(\"%d\",l+r);\n break;\n }\n if(l<r)\n {\n l=l+a;\n if(l<r)\n r--;\n else\n l--;\n }\n else\n {\n r=r+a;\n if(r<l)\n l--;\n else\n r--;\n }\n }\n\n\n}\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n int n,j,b,l,r,a,sum;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l==r)\n {\n l=l+a/2;\n r=r+a/2;\n }\n else if(r>l && r<=a)\n {\n a=a-(r-l);\n l=r+a/2;\n r=r+a/2;\n }\n else if(r>l && r>a)\n {\n l=l+a;\n r=l;\n }\n else if(l>r && l>a)\n {\n r=r+a;\n l=r;\n }\n else if(l>r && l<=a)\n {\n a=a-(l-r);\n r=l+a/2;\n l=l+a/2;\n }\n sum=l+r;\n printf(\"%d\\n\",sum);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int l,r,a,d, large,small;\n\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==0 || r==0)\n {\n printf(\"0\");\n }\n\n else\n {\n if(l>r)\n {\n large=l;\n small=r;\n }\n else\n {\n large=r;\n small=l;\n }\n if((small+a)<=large)\n {\n d=2*(small+a);\n printf(\"\\n\\n%d\",d);\n\n }\n else\n {\n d=small+large+a;\n if(d%2==0)\n {\n printf(\"\\n\\n%d\",d);\n }\n else\n {\n d=d-1;\n printf(\"\\n\\n%d\",d);\n }\n }\n\n\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((l!=0 && a!=0)||(r!=0 && a!=0)){\n s=l+r+a;\n if(s%2!=0){\n s=s-1;\n printf(\"%d\",s);}\n else\n {\n\n printf(\"%d\",s);}\n }\n else\n {\n printf(\"0\");\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int L,R,A,C,i,j;\n\n scanf(\"%d%d%d\",&L,&R,&A);\n\n if(L<R)\n { //printf(\"%d\",L);\n //(A!=0 || L!=R)\n for(i=L, j=A;(i==R)||(j>0);i++,j--)\n {\n\n L=L+1;\n A=A-1;\n if ((R==L) || (A==0))\n {\n break;\n }\n // printf(\"\\n%d %d\",L,A);\n }\n //}while(L=R || A>0);\n\n if(L==R && A!=0)\n {\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n\n }\n else if(L<R && A==0)\n {\n while(L!=R)\n {\n R=R-1;\n // printf(\"%d\",L);\n }\n printf(\"%d\",L+R);\n }\n }\n else if(L>R)\n {\n for(i=L, j=A;(i==R)||(j>0);i++,j--)\n {\n\n R=R+1;\n A=A-1;\n if ((R==L)|| (A==0))\n {\n break;\n }\n // printf(\"\\n%d %d\",L,A);\n }\n //}while(L=R || A>0);\n\n if(R==L && A!=0)\n {\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n\n }\n else if(R<L && A==0)\n {\n while(R!=L)\n {\n L=L-1;\n // printf(\"%d\",L);\n }\n printf(\"%d\",L+R);\n }\n }\n else if(L==R && A!=0)\n {\n\n C=A/2;\n L=L+C;\n R=R+C;\n\n printf(\"%d\",L+R);\n }\n else{printf(\"0\");}\n\n // printf(\"%d\",L+R);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int a,b,c;\n scanf(\"%d%d%d\", &a, &b, &c);\n if(a==b){\n printf(\"%d\",a+b+(c/2)*2);\n return 0;\n }\n if(a>b){\n b=b+c;\n if(a>=b){\n printf(\"%d\",2*b);\n return 0;\n }\n else{\n printf(\"%d\",2*a+((b+c-a)/2)*2);\n return 0;\n }\n }\n else{\n a=a+c;\n if(a>=b){\n printf(\"%d\",2*b+((a+c-b)/2)*2);\n return 0;\n }\n else{\n printf(\"%d\",2*a);\n return 0;\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r && r==a)\n {\n if(a%2==0)\n {\n s=l+r+a;\n }\n else\n {\n s=l+r+a-1;\n }\n printf(\"%d\",s);\n }\n else\n {\n if((a+l)<=r){\n s=2*(a+l);}\n\n else if((a+l)>=r && l<=r)\n {\n s=(2*l)+(a/2)+(a/2);\n }\n else if((a+l)>=r && r<=l)\n {\n s=(2*r)+(a/2)+(a/2);\n }\n printf(\"%d\",s);\n }\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l, r, a, s=0;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tprintf(\"%d%d%d\",l,r,a);\n\tif(l==r)\n\t{\n\t\ts=2*l+(a/2) *2;\t\t\n\t\tprintf(\"%d\",s);\n\t}\n\telse if(l==0 && a==0 || r==0 && a==0)\n\t{\n\t\tprintf(\"0\");\n\t}\n\telse{\n\t\tif(l<r)\n\t\t{\n\t\t\tif((r-l)<=a)\n\t\t\t{\n\t\t\t\ta-=(r-l);\n\t\t\t\tl+=(r-l);\n\t\t\t\ts=2*l+(a/2) *2;\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\tl+=a;\n\t\t\t\t\ts=2*l;\t\t\t\t\n\t\t\t}\t\n\t\t\tprintf(\"%d\",s);\n\t\t}\n\t\telse if(l>r)\n\t\t{\n\t\t\tif((l-r)<=a)\n\t\t\t{\n\t\t\t\ta-=(l-r);\n\t\t\t\tr+=(l-r);\n\t\t\t\t\n\t\t\t\ts=2*l+(a/2) *2;\t\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\tr+=a;\n\t\t\t\t\ts=2*r;\t\t\t\t\n\t\t\t}\n\t\t\tprintf(\"%d\",s);\t\n\t\t}\n\t}\n\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int l,r,a,x,y;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n x=abs(l-r);\n if(x!=0)\n {\n y=abs(x-a);\n printf(\"%d\\n\",a+l+r-y);\n }\n else\n printf(\"%d\\n\",((a+l+r)/2)*2);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\n\tint l, r, a;\n\n\tscanf(\"%i\", &l);\n\tscanf(\"%i\", &r);\n\tscanf(\"%i\", &a);\n//l<r\n\tif (l<r) {\n\t\tif ((l+a)==r){\n\t\t\tprintf(\"%i\", a+r+l);\t}\n\t\telse if ((l+a)<r){\n\t\t\t\tprintf(\"%i\", 2*(l+a));}\n\t\telse if ((l+a)>r){\n\t\t\tif((l+a-r)>2){\n\t\t\t\tif((l+a-r)%2 ==0){\n\t\t\t\t\tprintf(\"%i\", 2*r+l+a-r);}\n\t\t\t\telse {\n\t\t\t\t\tprintf(\"%i\", 2*r+l+a-r-1);}\n\t\t\t}\n\t\t\telse {\n\t\t\tprintf(\"%i\", 2*r);\t\t}\n\t\t}\n\t}\n//l>r\n\telse if (l>r){\n\t\tif ((r+a)==l){\n\t\t\t\tprintf(\"%i\", a+r+l);\t}\n\t\telse if ((r+a)<l){\n\t\t\t\tprintf(\"%i\", 2*(r+a));\t}\n\t\telse if ((r+a)>l){\n\t\t\tif(r+a-l>2){\n\t\t\t\tif((r+a-l)%2 ==0){\n\t\t\t\tprintf(\"%i\", 2*l+r+a-l);}\n\t\t\t\telse{\n\t\t\t\tprintf(\"%i\", 2*l+r+a-l-1);}\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintf(\"%i\", 2*l);\t}\t}\n\t}\n//l=r\n\telse {\n\t\tif((l+r+a)%2 == 0){\n\t\t\tprintf(\"%i\", l+r+a);}\n\t\telse {\n\t\t\tprintf(\"%i\", l+r+a-1);}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main() {\nint l,r,a,p,q,m,s = 0,k;\nscanf(\"%d%d%d\",&l,&r,&a);\nif(l < r) {\n\tp = r - l;\nif(p <= a) {\n\ts = a - p;\n\tl = l + p;\n\t} else {\n\t\tl = l + a; \n\t}\n\t\n\tif(l != r ) {\n\t k = abs(r - l);\n\t r = r - k;\n\t}\nprintf(\"%d\\n\",(l + r + s));\n} else if(r < l) {\n\tp = l - r;\nif(p <= a) {\n\ts = a - p;\n\tr = r + p;\n\t} else {\n\t\tr = r + a; \n\t}\n\t\n\tif(l != r ) {\n\t k = abs(r - l);\n\t l = l - k;\n\t}\nprintf(\"%d\\n\",(l + r + s));\n} else {\n\tif(a % 2 == 0)\n\t\tprintf(\"%d\\n\",(l + r + a));\n\telse \n\t\tprintf(\"%d\\n\",(l + r + a -1 ));\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\tlong long int l;\n\tlong long int r;\n\tlong long int a;\n\n\tscanf(\"%I64d %I64d %I64d\", &l, &r, &a);\n\n\tif(l == r) {\n\t\tif((a & 1) == 0) {\n\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t}\n\n\telse if((l == 0 && a == 0)){\n\t\tprintf(\"%I64d\", l + a);\n\t}\n\n\telse if((r == 0 && a == 0)){\n\t\t\tprintf(\"%I64d\", r + a);\n\t}\n\n\telse if(r > l && (((r - l) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t\t}\n\n\telse if(r > l && (((r - l - 1) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t\t}\n\t\t\t}\n\n\telse if(l > r && (((l - r) & 1) == 0)){\n\t\t\t\tif((a & 1) == 0) {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t} else {\n\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t}\n\t}\n\n\telse if(l > r && (((l - r - 1) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t}\n\t\t}\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n int n,j,b,l,r,a,sum;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l==r)\n {\n l=l+a/2;\n r=r+a/2;\n }\n else if(r>l && r<=a)\n {\n a=r-l;\n l=r+a/2;\n r=r+a/2;\n }\n else if(r>l && r>a)\n {\n l=l+a;\n r=l;\n }\n else if(l>r && l>a)\n {\n r=r+a;\n l=r;\n }\n else if(l>r && l<=a)\n {\n a=l-r;\n r=l+a/2;\n l=l+a/2;\n }\n sum=l+r;\n printf(\"%d\\n\",sum);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,t1,t2;\n scanf(\"%d %d %d\",&a,&c,&b);\n if(a==0 || b==0 || c==0) printf(\"0\");\n else\n {\n t1=a;\n t2=c;\n if(t1>t2 && t2+b<=t1)\n printf(\"%d\",2*(t2+b));\n else if(t2>t1 && t1+b<=t2)\n printf(\"%d\",2*(t1+b));\n else\n {\n if(t1>t2)\n {\n if(t1%2!=0)\n t1=t1-1;\n b=b-(t1-t2);\n t2=t1;\n }\n else\n {\n if(t2%2!=0)\n t2=t2-1;\n b=b-(t2-t1);\n t1=t2;\n }\n if(b%2==0)\n {\n if(b%4==0) t1=t1+b/2;\n else t1=t1+(b-2)/2;\n }\n else\n {\n if((b-1)%4==0) t1=t1+(b-1)/2;\n else t1=t1+(b-3)/2;\n }\n printf(\"%d\",2*t1);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int a,b,c,t,r;\n scanf(\"%d%d%d\",&a,&b,&c);\n \n if(b>a){\n t=a;\n a=b;\n b=t;\n }\n again:\n if(a==b){\n r=2*(a+c/2);\n }\n else if(b+c<a){\n r=2*(b+c);\n }\n else{\n \n c=c-a+b;\n b=a;\n goto again;\n }\n if(a==0||b==0){\n r=0;\n }\n printf(\"%d\",r);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,ctr,min,min1,d,max;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r)\n {\n if(a%2!=0)a-=1;\n ctr = l+r+a;\n }\n else\n {\n min = l<r ? l:r;\n max = l>r ? l:r;\n d = max - min;\n min1 = d<a ? d:a;\n ctr = (min*2) + (min1*2);\n }\n printf(\"%d\\n\",ctr);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int l,r,a,x;\n scanf(\"%d %d %d\",&l,&r,&a);\n x=((a-abs(l-r))/2);\n if (l==r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+(a/2)));\n }\n\n else if((l+a)<=r && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",2*(l+a));\n }\n\n else if((r+a)<=l && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",2*(r+a));\n }\n else if ((r==0 && a==0) || l==0 && a==0)\n {\n printf(\"%d\",0);\n }\n\n else if((r+a)>l && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",((int)(x+l))*2);\n }\n else if((l+a)>r && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",((int)(x+r))*2);\n }\n\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\nint main() {\n int l, r, a, ans;\n scanf(\"%d%d%d\", &l, &r, &a);\n int delta = (l > r) ? l - r : r - l;\n if (delta > a) {\n ans = (l > r) ? r : l + a;\n } else {\n a -= delta;\n a /= 2;\n ans = (l > r) ? l : r + a;\n }\n printf(\"%d\\n\", 2 * ans);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n int n,j,b,l,r,a,sum;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(l==r)\n {\n l=l+a/2;\n r=r+a/2;\n }\n else if(r>l && r<=a)\n {\n a=r-l;\n l=r+a/2;\n r=r+a/2;\n }\n else if(r>l && r>a)\n {\n l=l+a;\n r=l;\n }\n else if(l>r && l>a)\n {\n r=r+a;\n l=r;\n }\n else if(l>r && l<=a)\n {\n a=l-r;\n r=l+a/2;\n l=l+a/2;\n }\n sum=l+r;\n printf(\"%d\\n\",sum);\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n unsigned int l, r, a;\n scanf(\"%u%u%u\", &l, &r, &a);\n \n unsigned delta = 0;\n if(r > l){ \n delta = r - l;\n delta = delta > a ? a : delta;\n l += delta;\n a -= delta;\n }else\n if(l > r)\n {\n delta = l - r;\n delta = delta > a ? a : delta;\n r += delta;\n a -= delta; \n }\n unsigned max_team_size = (l + a/2) * 2;\n printf(\"%d\", max_team_size);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int x,y,z,a,b,r;\n scanf(\"%d %d %d\",&x,&y,&z);\n a=x-y;\n\n if(a>=0){\n if(a>=z)\n {\n b=y+z;r=2*b;}\n else\n {\n b=y+a;\n if(z%2==0)\n {\n r=2*b+z;\n }\n else {r=2*b+z-1;}\n }}\n else\n {\n a=-a;\n if(a>=z)\n {\n b=x+z;r=2*b;}\n else\n {\n b=x+a;\n if(z%2==0)\n {\n r=2*b+z;\n }\n else {r=2*b+z-1;}\n }}\n\n printf(\"%d\",r);\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int l,r,a,s;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n if(l==r)\n {\n printf(\"%d\\n\",l+r+((a/2)*2));\n }\n else if(r<=l && r<=a)\n {\n s=2*r;\n l=l-r;\n if(l<=a)\n {\n\n s= s + (2*l);\n a=a-l;\n a=a-a%2;\n printf(\"%d\\n\",s+a);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n else if(l<=r && l<=a)\n {\n s=2*l;\n r=r-l;\n if(r<=a)\n {\n s= s + (2*r);\n a=a-r;\n a=a-a%2;\n printf(\"%d\\n\",s);\n }\n else\n {\n s= s + (2*a);\n printf(\"%d\\n\",s);\n }\n }\n\n\n\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int r,l,a;\n \n scanf(\"%d%d%d\", &r,&l,&a);\n \n int t = r+l+a;\n \n if(r !=0 || l!=0)\n {\n if(t%2==0)\n printf(\"%d\", t);\n else{\n t--;\n printf(\"%d\", t);\n }\n }\n else\n printf(\"%d\", 0);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int l,r,a,c=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==0 || r==0)\n c=0;\n else if(l==r)\n {\n c=l*2;\n while(1)\n {\n if(a%2==0)\n {\n c=c+((a/2)*2);\n break;\n }\n a--;\n if(a==1)\n break;\n }\n }\n else if(l<r)\n {\n c=l;\n if(a>=(r-l))\n {\n c=c+(r-l);\n c=c+c;\n }\n else if(r-l>a)\n {\n c=c+a;\n c=c+c;\n }\n }\n else if(r<l)\n {\n c=r;\n if(a>=(l-r))\n {\n c=c+(l-r);\n c=c+c;\n }\n else if(l-r>a)\n {\n c=c+a;\n c=c+c;\n }\n }\n c=(c%2==0) ? c : c-1;\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((l!=0 && a!=0)||(r!=0 && a!=0)){\n s=l+r+a;\n if(s%2!=0){\n s=s-1;\n printf(\"%d\",s);}\n else\n {\n\n printf(\"%d\",s);}\n }\n else\n {\n printf(\"0\");\n }\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n\n{\n\tint l,r,a;\n\tint c=0;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l == 0 || r == 0)\n\t{\n\t\tprintf(\"0\");\n\t\texit(0);\n\t}\n\telse if(l == r)\n\t{\n\t\tif(a%2 == 0)\n\t\tc=l+r+a;\n\t\telse\n\t\tc=l+r+a-1;\n\t\t\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(l>r)\n\t{\n\t\twhile(a>0 && r<l)\n\t\t{\n\t\t\tr++;\n\t\t\ta--;\n\t\t}\n\t\tif(a%2 == 0)\n\t\tc=(r*2) + a;\n\t\telse\n\t\tc=(r*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(r>l)\n\t{\n\t\twhile(a>0 && l<r)\n\t\t{\n\t\t\tl++;\n\t\t\ta--;\n\t\t}\n\t\t\n\t\tif(a%2 == 0)\n\t\tc=(r*2) + a;\n\t\telse\n\t\tc=(r*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\n#include<math.h>\n\nint main(){\n\n int l, r, a;\n int count;\n scanf(\"%d %d %d\", &l, &r, &a);\n\n if(l==0 && a==0){\n count=0;\n printf(\"%d\", count);\n return 0;\n }\n if(r==0 && a==0){\n count=0;\n printf(\"%d\", count);\n return 0;\n }\n if(r==0 && l==0){\n count=a;\n printf(\"%d\", count);\n return 0;\n }\n\n while(1){\n if(a==0)\n break;\n\n if(l<r){\n l++;\n a--;\n }else if(l>=r){\n r++;\n a--;\n }\n }\n\n if(l>r){\n count=2*r;\n }else if(l<=r){\n count=2*l;\n }\n\n printf(\"%d\",count);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,a,b,c,x;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==b)\n {\n i=c/2;\n a=a+i;\n b=b+i;\n x=a+b;\n }\n else if(a>b)\n {\n b=b+c;\n if(b>a)\n {\n while(a!=b)\n {\n b=b-1;\n a=a+1;\n }\n }\n else if(b<a)\n {\n while(a!=b)\n {\n a=a-1;\n }\n }\n x=a+b;\n\n }\n else\n {\n a=a+c;\n if(b>a)\n {\n while(b!=a)\n {\n b=b-1;\n }\n }\n else if(b<a)\n {\n while(a!=b)\n {\n a=a-1;\n b=b+1;\n }\n }\n x=a+b;\n }\n printf(\"%d\",x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,j,k,m=0,n=0,f=0;\n unsigned int l;\n\n scanf(\"%d%d%d\",&i,&j,&k);\n\n if(k==0 && ( i==0 || j==0)){\n\n printf(\"0\");\n return 0;\n }\n\n if(i==j){\n\n if(k%2==0){\n printf(\"%d\",i+j+k);\n return 0;\n }\n\n if(k%2!=0){\n printf(\"%d\",i+j+k-1);\n return 0;\n }\n }\n\n l=i-j;\n\n if(l>k && i>j){ printf(\"%d\",2*(j+k));\n return 0;}\n\n if(l>k&&j>i){printf(\"%d\",2*(i+k));\n return 0;}\n\n if(l==k){printf(\"%d\",i+j+k);\n return 0;}\n\n if(k>l){\n\n m=i+j;\n\n if(m%2==0){\n\n if(k%2==0){\n\n printf(\"%d\",m+k);\n return 0;\n }\n\n if(k%2!=0){\n\n printf(\"%d\",m+k-1);\n return 0;\n }\n }\n\n if(m%2!=0){\n\n if(k%2==0){\n\n printf(\"%d\",m+k-1);\n return 0;\n }\n\n if(k%2!=0){\n\n printf(\"%d\",m+k);\n return 0;\n }\n }\n }\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,t1,t2;\n scanf(\"%d %d %d\",&a,&c,&b);\n if(a==0 || b==0 || c==0) printf(\"0\");\n else\n {\n t1=a;\n t2=c;\n if(t1>t2 && t2+b<=t1)\n printf(\"%d\",2*(t2+b));\n else if(t2>t1 && t1+b<=t2)\n printf(\"%d\",2*(t1+b));\n else\n {\n if(t1>t2)\n {\n if(t1%2!=0)\n t1=t1-1;\n b=b-(t1-t2);\n t2=t1;\n }\n else\n {\n if(t2%2!=0)\n t2=t2-1;\n b=b-(t2-t1);\n t1=t2;\n }\n if(b%2==0)\n {\n if(b%4==0) t1=t1+b/2;\n else t1=t1+(b-2)/2;\n }\n else\n {\n if((b-1)%4==0) t1=t1+(b-1)/2;\n else t1=t1+(b-3)/2;\n }\n printf(\"%d\",2*t1);\n }\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,big,small,total,c,b,k,m;\n scanf(\"%d %d %d\",&l,&r,&a);\n b=a%2;\n if(l==r)\n {total=l+r+((a-b));\n printf(\"%d\",total);\n return 0;\n end(0);}\n else if(l>r)\n {big=l;\n small=r;}\n else\n {small=l;\n big=r;}\n\n c=small+a;\n if(big>=c)\n {total=2*c;\n printf(\"%d\",total);\n return 0;\n end(0);}\n else\n { k=big-small;\n m=a-k;\n {\n if(m>0)\n m=m;\n else\n m=-m;\n }\n total=(2*big)+m;\n printf(\"%d\",total);\n return 0;\n end(0);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int l,r,a;\n scanf(\"%d%d%d\", &l,&r,&a);\n int x=0;\n\n while(x == 0)\n {\n if ((l ==0 || r==0) && a==0)\n {\n printf(\"%d\", 0);\n x=1;\n }\n else if(l==r)\n {\n a-=2;\n l++;\n r++;\n if(a<2)\n {\n printf(\"%d\", l+r);\n x=1;\n }\n\n }\n else if (l<r)\n {\n if (a>0)\n {\n a--;\n l++;\n }\n else if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n else if(a==0 && l<r)\n {\n r--;\n if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n }\n }\n else if(r<l)\n {\n if (a>0)\n {\n a--;\n r++;\n }\n else if(l==r)\n {\n printf(\"%d\", l + r);\n x=1;\n }\n else if(a==0 && r<l)\n {\n \n l--;\n if(l==r)\n {\n \n printf(\"%d\", l + r);\n x=1;\n }\n }\n }\n }\n return 0;\n}\n\n\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint l, r, a, tmp=0;\n\tscanf(\"%d %d %d\", &l, &r, &a);\n\n\tint total=0;\n\n\tif((l==0 && a==0)|| (r==0 && a==0))\n\t\ttotal=0;\n\n\telse if(l==0)\n\t{\n\t\tif(r>=a)\n\t\t\ttotal=2*a;\n\t\telse\n\t\t{\n\t\t\ttotal=2*r;\n\t\t\ttmp=a-r;\n\t\t\tif(tmp%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\t\n\telse if(r==0)\n\t{\n\t\tif(l>=a)\n\t\t\ttotal=2*a;\n\t\telse\n\t\t{\n\t\t\ttotal=2*l;\n\t\t\ttmp=a-l;\n\t\t\tif(tmp%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\t\n\n\telse if(l>r)\n\t{\n\t\tif((r+a)<l)\n\t\t\ttotal=2*(r+a);\n\n\t\telse if((r+a)>l)\n\t\t{\n\t\t\ttmp=l-r;\n\t\t\ttotal=(2*l);\n\t\t\ta=a-tmp;\n\t\t\tif(a%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\n\telse if(r>l)\n\t{\n\t\tif((l+a)<r)\n\t\t\ttotal=2*(l+a);\n\n\t\telse if((l+a)>r)\n\t\t{\n\t\t\ttmp=r-l;\n\t\t\ttotal=(2*r);\n\t\t\ta=a-tmp;\n\t\t\tif(a%2==0)\n\t\t\t\ttotal=total+a;\n\t\t\telse\n\t\t\t\ttotal=total+a-1;\n\t\t}\n\t}\n\n\telse\n\t{\n\t\ttotal=2*r;\n\t\tif(a%2==0)\n\t\t\ttotal=total+a;\n\t\telse\n\t\t\ttotal=total+a-1;\n\t}\n\tprintf(\"%d\", total);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,p=0,q=0,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l>r)\n {\n p=l-r;\n }\n else\n {\n p=r-l;\n }\n if(l==r) {//89 44 77\n s=l+r+(a/2)+(a/2);\n }\n if(l!=r)\n {\n if((a+l)<=r){\n s=2*(a+l);\n }\n else if((a+l)>r && (a+r)>l && l>r)\n {\n q=a-p;\n s=l+r+p+(q/2)+(q/2);\n }\n else if((a+l)>r && (a+r)>l && r<l)\n {\n q=a-p;\n s=l+r+p+(q/2)+(q/2);\n }\n\n else if((a+l)>r && l<=r )\n {\n s=l+r+(a/2)+(a/2);\n }\n else if((a+r)<=l && l>r){\n s=2*(a+r);}\n\n else\n {\n s=r+l+(a/2)+(a/2);}\n\n } printf(\"%d\",s);\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\n#define REP(i, n) for((i) = 0; (i) < (n); (i)++)\n#define REP1(i, n) for((i) = 1; (i) <= (n); (i)++)\n\nstatic int min(int a, int b)\n{\n if (a < b)\n return a;\n return b;\n}\n\nstatic int max(int a, int b)\n{\n if (a > b)\n return a;\n return b;\n}\n\nint main(void)\n{\n int l, r, a;\n\n scanf(\"%d %d %d\", &l, &r, &a);\n if (l == r) {\n printf(\"%d\", (l + a / 2) * 2);\n } else if (l < r) {\n printf(\"%d\", (l + min(r - l, a) + max(0, (a - min(r - l, a)))) * 2);\n } else {\n printf(\"%d\", (r + min(l - r, a) + max(0, (a - min(l - r, a)))) * 2);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int l,r,a,x;\n scanf(\"%d %d %d\",&l,&r,&a);\n x=((a-abs(l-r))/2);\n if (l==r && l>=1 && l<=100 && r>=1 && r<=100 && a>=1 && a<=100)\n {\n printf(\"%d\",2*(l+(a/2)));\n }\n\n else if((l+a)<=r && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",2*(l+a));\n }\n\n else if((r+a)<=l && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",2*(r+a));\n }\n else if ((r==0 && a==0) || l==0 && a==0)\n {\n printf(\"%d\",0);\n }\n\n else if((r+a)>l && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",((int)(x+l))*2);\n }\n else if((l+a)>r && l>=0 && l<=100 && r>=0 && r<=100 && a>=0 && a<=100)\n {\n printf(\"%d\",((int)(x+r))*2);\n }\n\n return 0;\n\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,i;\n scanf(\"%d%d%d\",&l,&r,&a);\n if((a==0&&r==0)||(a==0&&l==0)){\n printf(\"%d\",a);\n }\n else{\n for(i=1;i<=a;i++){\n if(l<r){\n l++;\n a--;\n\n }\n else if(l>r){\n if(r==0){\n r++;\n a--;\n l--;}\n else{\n r++;\n a--;\n }\n\n }\n else if(l=r){\n l++;\n r++;\n a=a-2;}\n }\n printf(\"%d\",l+r);}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a, fl=0,fr=0, fe=0,d;\n\t\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\t\n\tif(a+l>r || a+r>l)\n\t{\n\t\td=l-r;\n\t\tif(l<r && a>l){l=l+d;a=a-d;}\n\t\telse if(l>r && a>r){r=r+d;a=a-d;}\n\t}\n\t\t\n\t\n\tif(l>r) fr=1;\n\telse if (r>l) fl=1;\n\telse fe=1;\n\t\n\tif(fr) r+=a;\n\telse if(fl) l+=a;\n\telse if (fe) {l+=(a/2);r+=(a/2);}\n\t\n\t\n\tif(fl||fr)\n\t{\tif(l>r)\t\n\t\t\tl-=(l-r);\n\t\telse\n\t\t\tr-=(r-l);\n\t}\n\tprintf(\"%d\",l+r);\n\t\n\treturn 0;\n\t\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main() {\n\n\tsetvbuf(stdout, NULL, _IONBF, 0);\n\tlong long int l;\n\tlong long int r;\n\tlong long int a;\n\n\tscanf(\"%I64d %I64d %I64d\", &l, &r, &a);\n\n\tif(l == r) {\n\t\tif((a & 1) == 0) {\n\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t}\n\n\telse if((l == 0 && a == 0)){\n\t\tprintf(\"%I64d\", l + a);\n\t}\n\n\telse if((r == 0 && a == 0)){\n\t\t\tprintf(\"%I64d\", r + a);\n\t}\n\n\telse if(r > l && l + a < r && (((l - r) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", (l + a) * 2);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t\t}\n\telse if(r > l && (((r - l) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t}\n\t\t}\n\n\telse if(r > l && (((r - l - 1) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t\t}\n\t\t\t}\n\n\n\telse if(l > r && r + a < l && (((l - r) & 1) == 0)){\n\t\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\t\tprintf(\"%I64d\", (r + a) * 2);\n\t\t\t} else {\n\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t\t}\n\t\t\t}\n\n\telse if(l > r && (((l - r) & 1) == 0)){\n\t\t\t\tif((a & 1) == 0) {\n\t\t\t\tprintf(\"%I64d\", l + r + a);\n\t} else {\n\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t}\n\t}\n\n\n\n\telse if(l > r && (((l - r - 1) & 1) == 0)){\n\t\t\t\t\tif((a & 1) == 0) {\n\t\t\t\t\tprintf(\"%I64d\", l + r + (a - 1));\n\t\t} else {\n\t\t\tprintf(\"%I64d\", l + r + a);\n\t\t}\n\t\t}\n\n\treturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,l,r,b,c,d,p,e,f;\n scanf(\"%d %d %d\",&l,&r,&a);\n if(r!=0&&l!=0&&r>l)\n {\n b=r;\n c=b-l;\n r=c;\n p=l;\n l=l+(r-l);\n\n //l=l+a-r;\n //a=a-(r-l);\n if(a>1)\n {\n a=a-(r-p);\n e=a/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n\n }\n }\n else if(r!=0&&l!=0&&r==l)\n {\n if(a>1)\n {\n c=a/2;\n d=2*c;\n f=r+l+d;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(r!=0&&l!=0&&l>r)\n {\n b=l;\n c=b-r;\n l=c;\n p=r;\n r=r+(l-1);\n a=a-(r-p);\n //r=r+a-l;\n //a=a-(l-r);\n printf(\"%d\",f);\n if(a>1)\n {\n e=a/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n\n }\n else if(r==0&&l!=0)\n {\n if(a>1&&a>l)\n {\n r=a-l;\n a=a-r;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(a>1&&l>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n\n }\n else if(l==0&&r!=0)\n {\n if(a>1&&a>r)\n {\n l=a-l;\n a=a-l;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(a>1&&r>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n\n }\n else if(l==0&&r==0)\n {\n if(a>=2)\n {\n if(a%2==0)\n {\n a=a/2;\n e=a*2;\n f=e;\n printf(\"%d\",f);\n }\n }\n else\n {\n f=0;\n printf(\"%d\",f);\n }\n }\n else if((a==0&&l==0)||(a==0&&r==0))\n {\n f=0;\n printf(\"%d\",f);\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,x,m,r,a,n;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l==r)\n\t{ start:\n\t\tif(a%2!=0 && a!=0)\t\n\t{\tx=l+r+a-1;}\n\t\telse \n\t{\tx=l+r+a; }\n\tprintf(\"%d\\n\",x);\n\t}\n\telse if(l>r)\n\t{m=l-r;\n\tif(a-m>0)\n\tr=r+m;\n\ta=a-m;\n\tgoto start;}\n\t\n\telse if(l<r)\n\t{\n\tm=r-l;\n\tif(a-m>0)\n\tl=l+m;\n\ta=a-m;\n\tgoto start;\t\t\n\t}\n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n\n{\n\tint l,r,a;\n\tint c=0;\n\tscanf(\"%d%d%d\",&l,&r,&a);\n\tif(l == 0 || r == 0)\n\t{\n\t\tprintf(\"0\");\n\t\texit(0);\n\t}\n\telse if(l == r)\n\t{\n\t\tif(a%2 == 0)\n\t\tc=l+r+a;\n\t\telse\n\t\tc=l+r+a-1;\n\t\t\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(l>r)\n\t{\n\t\twhile(a>0 && r<l)\n\t\t{\n\t\t\tr++;\n\t\t\ta--;\n\t\t}\n\t\tif(a%2 == 0)\n\t\tc=(r*2) + a;\n\t\telse\n\t\tc=(r*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\telse if(r>l)\n\t{\n\t\twhile(a>0 && l<r)\n\t\t{\n\t\t\tl++;\n\t\t\ta--;\n\t\t}\n\t\t\n\t\tif(a%2 == 0)\n\t\tc=(l*2) + a;\n\t\telse\n\t\tc=(l*2) + a-1;\n\t\tprintf(\"%d\",c);\n\t\texit(0);\n\t}\n\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n long long compare (const void * a, const void * b)\n{ \n return ( *(long long *)a - *(long long *)b );\n}\nint main(void){\n \nlong long int test,i,j,n,count,flag,flag2,b1,l,m,u,r,q,d,x,max,max2,min,f,sum,a,b;\n\n\nscanf(\"%lld%lld%lld\",&l,&r,&b);\nif(l>r){\n b-=abs(l-r);\n if(b<=0){\n printf(\"%lld\",2*(r+b));\n }else{\n printf(\"%lld\",2*(b/2)+2*l);\n }\n}else{\n if(l<r){\n b-=abs(l-r);\n if(b<=0){\n printf(\"%lld\",2*(r+b));\n }else{\n printf(\"%lld\",2*(b/2)+2*r);\n }\n }else{\n printf(\"%lld\",2*r+(b/2)*2);\n }\n}\n \n\n\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int l,r,a,d, large,small;\n\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==0 || r==0)\n {\n printf(\"0\");\n }\n\n else\n {\n if(l>r)\n {\n large=l;\n small=r;\n }\n else\n {\n large=r;\n small=l;\n }\n if((small+a)<=large)\n {\n d=2*(small+a);\n printf(\"\\n\\n%d\",d);\n\n }\n else\n {\n d=small+large+a;\n if(d%2==0)\n {\n printf(\"\\n\\n%d\",d);\n }\n else\n {\n d=d-1;\n printf(\"\\n\\n%d\",d);\n }\n }\n\n\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,i,j,ans,p,q;\n scanf(\"%d%d%d\",&a,&b,&c);\n if(a>b){\n p=b+c;\n q=p-a;\n if(q>0){\n ans=2*a+2*(q/2);\n }\n else{\n ans=2*b;\n }\n }\n else if(b>a){\n p=a+c;\n q=p-b;\n if(q>0){\n ans=2*b+2*(q/2);\n }\n else{\n ans=2*a;\n }\n }\n else if(a==b){\n ans=a+b+2*(c/2);\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint l,r,x;\n\tscanf(\"%d %d %d\",&l,&r,&x);\n\tint a = l+x;\n\tint result1 = a > r ? r : a;\n\tint b = r+x;\n\tint result2 = b > l ? l : b;\n\tint result3;\n\tif(x%2==1){\n\t\tint c = l+x/2+1, d = r+x/2;\n\t\tresult3 = c > d ? d : c;\n\t\tc = l+x/2, d = r+x/2+1;\n\t\tint result4 = c > d ? d : c;\n\t\tresult3 = result3 > result4 ? result3 : result4;\n\t\t// printf(\"%d %d\\n\",result3, result4);\n\t}\n\telse{\n\t\tint c = l+x/2, d = r+x/2;\n\t\tresult3 = c > d ? d : c;\n\t}\n\tint max = result1 > result2 ? result1 : result2;\n\tmax = result3 > max ? result3 : max;\n\n\t// printf(\"%d %d %d\",result1,result2,result3);\n\n\tprintf(\"%d\",max*2);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,l,w,r,b,c,d,p,e,q,f;\n scanf(\"%d %d %d\",&l,&r,&a);\n if((a==0&&l==0)||(a==0&&r==0))\n {\n f=0;\n printf(\"%d\",f);\n\n }\n else if(l!=0&&r!=0&&a!=0&&l==r)\n {\n d=a/2;\n d=d*2;\n f=l+r+d;\n printf(\"%d\",f);\n }\n else if(l!=0&&l==a)\n {\n f=2*l;\n printf(\"%d\",f);\n }\n else if(r!=0&&l!=0&&r>l)\n {\n q=r-l;\n w=a-q;\n l=l+q;\n //printf(\"%d\",f);\n if(w>1)\n {\n e=w/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n\n }\n }\n //else if(l!=0&&r!=0&&a!=0&&l=a)\n //{\n\n //}\n else if(r!=0&&r==a)\n\n {\n f=2*r;\n printf(\"%d\",f);\n }\n\n else if(r!=0&&l!=0&&r>l+a&&r!=l)\n {\n q=l+a;\n r=r-q;\n q=q+q;\n printf(\"%d\",q);\n }\n else if(r!=0&&l!=0&&l>r+a&&l!=r)\n {\n q=r+a;\n l=l-q;\n q=q+q;\n printf(\"%d\",q);\n }\n\n\n /*b=r;\n c=b-l;\n r=c;\n p=l;\n l=l+(r-l);\n\n a=a-(r-p);\n //l=l+a-r;\n //a=a-(r-l);\n\n\n if(a>1)\n {\n\n e=a/2;\n d=e*2;\n f=r+l+d;\n printf(\"%d\",f);\n\n }*/\n\n\n\n else if(r!=0&&l!=0&&r==l)\n {\n if(a>1)\n {\n c=a/2;\n d=2*c;\n f=r+l+d;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(r!=0&&l!=0&&l>r)\n {\n /*b=l;\n c=b-r;\n l=c;\n p=r;\n r=r+(l-r);\n a=a-(r-p);\n //r=r+a-l;\n //a=a-(l-r);*/\n q=l-r;\n w=a-q;\n //printf(\"%d\",f);\n if(w>1)\n {\n e=w/2;\n d=e*2;\n f=l+l+d;\n printf(\"%d\",f);\n\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n\n }\n else if(l!=0)\n {\n if(r==0&&a>1&&a>l)\n {\n r=a-l;\n a=a-r;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n\n }\n else if(a>1&&l>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n }\n else if(r!=0)\n {\n if(l==0&&a>1&&a>r)\n {\n l=a-l;\n a=a-l;\n if(a>1)\n {\n e=a/2;\n d=e*3;\n f=r+l+d;\n printf(\"%d\",f);\n\n }\n else if(a==0)\n {\n f=0;\n printf(\"%d\",f);\n }\n\n }\n else if(a>1&&r>a)\n {\n f==0;\n printf(\"%d\",f);\n }\n else\n {\n f=r+l;\n printf(\"%d\",f);\n }\n\n }\n else if(l==0&&r==0)\n {\n if(a>=2)\n {\n if(a%2==0)\n {\n a=a/2;\n e=a*2;\n f=e;\n printf(\"%d\",f);\n }\n }\n else\n {\n f=0;\n printf(\"%d\",f);\n }\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,s=0;\n scanf(\"%d%d%d\",&l,&r,&a);\n if(l==r) {//89 44 77\n s=l+r+(a/2)+(a/2);\n }\n if(l!=r)\n {\n if((a+l)<=r){\n s=2*(a+l);\n }\n else if((a+l)>r && (a+r)>l && a%2!=0)\n {\n s=l+r+a;\n }\n else if((a+l)>r && (a+r)>l && a%2==0)\n {\n s=l+r+a-1;\n }\n\n else if((a+l)>r && l<=r )\n {\n s=l+r+(a/2)+(a/2);\n }\n else if((a+r)<=l && l>r){\n s=2*(a+r);}\n\n else\n {\n s=r+l+(a/2)+(a/2);}\n\n } printf(\"%d\",s);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int l,r,a,n;\n scanf(\"%d%d%d\",&l,&r,&a);\n\n while(l<r && a>0 )\n {\n a--;\n l++;\n if(l==r)\n {\n break;\n }\n }\n while(r<l && a>0)\n {\n a--;\n r++;\n if(l==r)\n {\n break;\n }\n }\n\n n=a+r+l;\n\n if(l==0 && a==0)\n {\n printf(\"%d\\n\",l);\n }\n else if(r==0 && a==0)\n {\n printf(\"%d\\n\",r);\n }\n else if(n%2==0)\n {\n printf(\"%d\\n\",n);\n }\n else if(n%2!=0)\n {\n n--;\n printf(\"%d\\n\",n);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,f,r;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a==b){\n c=c/2;\n r=(a+c)*2;\n\n }\n else if(a>b && a>=(b+c)){\n r=(b+c)*2;\n\n }\n else if(b>a && b>=(a+c)){\n r=(a+c)*2;\n\n }\n else if(a>b && (b+c)>a){\n d=a-b;\n e=c-d;\n f=(c-d)/2;\n r=(b+f)*2;\n\n }\n else if(b>a && (c+a)>b){\n d=b-a;\n e=(c-d)/2;\n r=(a+e)*2;\n\n }\nprintf(\"%d\",r);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint l,r,a,ans;\n\tscanf(\"%d %d %d\",&l,&r,&a);\n\tif(l==0&&a==0||r==0&&a==0)\n\tprintf(\"0\\n\");\n\telse if(l+a<r)\n\tprintf(\"%d\\n\",2*(l+a));\n\telse if(r+a<l)\n\tprintf(\"%d\\n\",2*(r+a));\n\telse\n\t{\n\t\ta=a/2;\n\t\tans=l+r+2*a;\n\t\tif(ans==1)\n\t\tprintf(\"0\\n\");\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\nint main(void) \n{\n\tint a=0,b=0,c=0,x;\n\tscanf(\"%d %d %d \",&a,&b,&c);\n\t//printf(\"%d %d %d \",a,b,c);\n\tif (a>b)\n\t{\n\t\tx=a;\n\t\ta=b;\n\t\tb=x;\n\t}\n\tif (a+c<=b) printf(\"%d\",2*(a+c));\n\telse\n\t{\n\t\tprintf(\"%d\",2*b+2*((c-a)/2));\n\t}\n\t\t\n\treturn 0;\n}\n"}], "src_uid": "e8148140e61baffd0878376ac5f3857c"} {"nl": {"description": "John Doe has an n\u2009\u00d7\u2009m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n\u2009\u00d7\u2009n have exactly k points.John Doe wondered, how many distinct ways to fill the table with points are there, provided that the condition must hold. As this number can be rather large, John Doe asks to find its remainder after dividing by 1000000007 (109\u2009+\u20097).You should assume that John always paints a point exactly in the center of some cell. Two ways to fill a table are considered distinct, if there exists a table cell, that has a point in one way and doesn't have it in the other.", "input_spec": "A single line contains space-separated integers n, m, k (1\u2009\u2264\u2009n\u2009\u2264\u2009100;\u00a0n\u2009\u2264\u2009m\u2009\u2264\u20091018;\u00a00\u2009\u2264\u2009k\u2009\u2264\u2009n2) \u2014 the number of rows of the table, the number of columns of the table and the number of points each square must contain. 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. ", "output_spec": "In a single line print a single integer \u2014 the remainder from dividing the described number of ways by 1000000007 (109\u2009+\u20097).", "sample_inputs": ["5 6 1"], "sample_outputs": ["45"], "notes": "NoteLet's consider the first test case: The gray area belongs to both 5\u2009\u00d7\u20095 squares. So, if it has one point, then there shouldn't be points in any other place. If one of the white areas has a point, then the other one also must have a point. Thus, there are about 20 variants, where the point lies in the gray area and 25 variants, where each of the white areas contains a point. Overall there are 45 variants."}, "positive_code": [{"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\n#define N\t100\n#define K\t(N * N)\n#define MD\t1000000007\n\nlong long power(int a, long long k) {\n\tlong long p;\n\n\tif (k == 0)\n\t\treturn 1;\n\tp = power(a, k / 2);\n\tp = p * p % MD;\n\tif (k % 2)\n\t\tp = p * a % MD;\n\treturn p;\n}\n\nint main() {\n\tstatic int ch[N + 1][N + 1], pp[N + 1][N + 1], dp[N + 1][K + 1];\n\tint n, k, h, i, j;\n\tlong long m;\n\n\tscanf(\"%d%lld%d\", &n, &m, &k);\n\tch[0][0] = 1;\n\tfor (i = 1; i <= n; i++) {\n\t\tch[i][0] = 1;\n\t\tfor (j = 1; j <= i; j++)\n\t\t\tch[i][j] = (ch[i - 1][j] + ch[i - 1][j - 1]) % MD;\n\t}\n\tfor (i = 0; i <= n; i++)\n\t\tfor (j = 0; j <= i; j++)\n\t\t\tpp[i][j] = power(ch[i][j], m / n);\n\tdp[0][0] = 1;\n\tfor (i = 0; i < n; i++)\n\t\tfor (j = 0; j <= k; j++) {\n\t\t\tint x = dp[i][j];\n\n\t\t\tif (x == 0)\n\t\t\t\tcontinue;\n\t\t\tfor (h = 0; h <= n && j + h <= k; h++)\n\t\t\t\tdp[i + 1][j + h] = (dp[i + 1][j + h] + (long long) x * pp[n][h] % MD * (i < m % n ? ch[n][h] : 1)) % MD;\n\t\t}\n\tprintf(\"%d\\n\", dp[n][k]);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define maxn 111\n\nconst int mod = (int) 1e9 + 7;\n\nlong long choose[maxn][maxn];\n\nlong long f[maxn][10001];\nlong long g[maxn][maxn];\n\nlong long power( long long a, long long b ) {\n\tlong long ret = 1;\n\t\n\ta %= mod;\n\twhile( b > 0 ) {\n\t\tif( b % 2 ) {\n\t\t\tret = (ret * a) % mod;\n\t\t}\n\t\t\n\t\tb /= 2;\n\t\ta = (a * a) % mod;\n\t}\n\t\n\treturn ret;\n}\n\nint main( void ) {\n\tlong long n, m, k;\n\tscanf(\"%lld %lld %lld\", &n, &m, &k);\n\t\n\tfor( int i = 0; i < maxn; i++ ) {\n\t\tchoose[i][0] = choose[i][i] = 1;\n\t\tfor( int j = 1; j < i; j++ ) {\n\t\t\tchoose[i][j] = (choose[i-1][j] + choose[i-1][j-1]) % mod;\n\t\t}\n\t}\n\t\n\tfor( int i = 1; i <= n; i++ ) {\n\t\tfor( int c = 0; c <= n; c++ ) {\n\t\t\tlong long count = (m / n) + (m % n >= i ? 1 : 0);\n\t\t\tg[i][c] = power(choose[n][c], count);\n\t\t}\n\t}\n\t\n\tf[1][0] = 1;\n\tfor( int i = 1; i <= n; i++ ) {\n\t\tfor( int j = 0; j <= k; j++ ) if( f[i][j] > 0 ) {\n\t\t\tfor( int c = 0; c <= n; c++ ) {\n\t\t\t\tif( j + c > k ) break;\n\t\t\t\tlong long nways = (g[i][c] * f[i][j]) % mod;\n\t\t\t\tf[i+1][j+c] = (f[i+1][j+c] + nways) % mod;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\\n\", f[n+1][k]);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nlong long pow(long long x, long long y, long long z)\n{\n long long p = 1;\n \n while (y) {\n if (y & 1) p = p * x % z;\n \n x = x * x % z;\n y >>= 1;\n }\n \n return p;\n}\n\nint max(int a, int b)\n{\n if (a > b) {\n return a;\n } else {\n return b;\n }\n}\n\nlong long c[101][101];\nlong long a[101];\nlong long dp[101][10001];\n\nint main()\n{\n int n, k, mod = 1000000007, i, j, l;\n long long m;\n \n scanf(\"%d %I64d %d\", &n, &m, &k);\n \n for (i = 0; i <= 100; i++) {\n c[i][0] = c[i][i] = 1;\n \n for (j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;\n }\n \n for (i = 0; i <= n; i++) a[i] = pow(c[n][i], m / n, mod);\n \n dp[0][0] = 1;\n \n for (i = 0; i < n; i++) {\n for (j = max(0, k - (n - i) * n); j <= i * n && j <= k; j++) {\n if (dp[i][j] == 0) continue;\n \n for (l = 0; l <= n && j + l <= k; l++) {\n long long x = a[l];\n \n if (m % n > i) x = x * c[n][l] % mod;\n \n dp[i + 1][j + l] = (dp[i + 1][j + l] + dp[i][j] * x % mod) % mod;\n }\n }\n }\n \n printf(\"%I64d\\n\", dp[n][k]);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define mod 1000000007\nlong long f[200][200],dp[101][10001];\nlong long calc_pow(long long base , long long power)\n{\n if(power == 0) return 1;\n\n long long half = calc_pow(base , power/2);\n\n if(power % 2)\n return ((half * half) % mod * base) % mod;\n\n return (half * half) % mod;\n}\nmain()\n{\n long long n,m,i,j,k,s;\n scanf(\"%I64d%I64d%I64d\",&n,&m,&s);\n\n for(i=0; i<=100; i++)\n f[i][0] = 1;\n\n for(i=1; i<=100; i++)\n for(j=1; j<=i; j++)\n f[i][j] = (f[i-1][j] + f[i-1][j-1]) % mod ;\n\n long long pow[200][200];\n\n for(i=1; i<=n; i++)\n for(j=0; j<=n; j++)\n pow[i][j] = calc_pow(f[n][j] , (m-i)/n+1);\n\n for(i=0; i<=n; i++)dp[n][i] = pow[n][i];\n\n for(i=n-1; i>=1; i--)\n {\n for(j=0; j<=(n-i+1)*n ; j++)\n {\n for(k=0; k<=n; k++)\n {\n if(j - k <= (n-i)*n)\n dp[i][j] = (dp[i][j] + (pow[i][k] * dp[i+1][j-k] ) % mod )% mod;\n }\n }\n }\n\n printf(\"%I64d\",dp[1][s]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long pow(long long x, long long y, long long z)\n{\n long long p = 1;\n \n while (y) {\n if (y & 1) p = p * x % z;\n \n x = x * x % z;\n y >>= 1;\n }\n \n return p;\n}\n\nint max(int a, int b)\n{\n if (a > b) {\n return a;\n } else {\n return b;\n }\n}\n\nlong long c[101][101];\nlong long a[101];\nlong long dp[101][10001];\n\nint main()\n{\n int n, k, mod = 1000000007, i, j, l;\n long long m;\n \n scanf(\"%d %I64d %d\", &n, &m, &k);\n \n for (i = 0; i <= 100; i++) {\n c[i][0] = c[i][i] = 1;\n \n for (j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;\n }\n \n for (i = 0; i <= n; i++) a[i] = pow(c[n][i], m / n, mod);\n \n dp[0][0] = 1;\n \n for (i = 0; i < n; i++) {\n for (j = max(0, k - (n - i) * n); j <= i * n && j <= k; j++) {\n if (dp[i][j] == 0) continue;\n \n for (l = 0; l <= n && j + l <= k; l++) {\n long long x = a[l];\n \n if (m % n > i) x = x * c[n][l] % mod;\n \n dp[i + 1][j + l] = (dp[i + 1][j + l] + dp[i][j] * x % mod) % mod;\n }\n }\n }\n \n printf(\"%I64d\\n\", dp[n][k]);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n#include<memory.h>\n#include<assert.h>\n#include<ctype.h>\n \ntypedef long long ll;\n \n#define max(a,b) (((a)>(b))?(a):(b))\n#define min(a,b) (((a)<(b))?(a):(b))\n#define abs(k) (((k)>0)?(k):(-(k)))\n#define sqr(k) ((k)*(k))\n#define swap(a,b) a^=b^=a^=b\n#define mod(a,b) (((a)%(b)+(b))%(b))\n#define mode(a,b) a=mod(a,b)\n#define mset(a) memset(a,0,sizeof(a))\n#define mcpy(a,b) memcpy(a,b,sizeof(a))\n#define inf 1000000000\n#define linf 1000000000000000000LL\n#define pi 3.14159265358979323846\n \nvoid fileio_in_out()\n{\n freopen(\".in\",\"r\",stdin);\n freopen(\".out\",\"w\",stdout);\n}\n \nvoid fileio_txt()\n{\n freopen(\"input.txt\",\"r\",stdin);\n freopen(\"output.txt\",\"w\",stdout);\n}\n \n//==================================================\n\nconst ll md=1000000007LL;\n\nint n=0;\nint i,j,k,l;\nll m,t;\nll cnk[111][111],f[111][2],dp[111][11111];\n\nll pw(ll x,ll y)\n{\n ll i,t=1;\n \n for(i=1LL<<62;i;i>>=1)\n {\n t=(t*t)%md;\n if(i&y)\n t=(t*x)%md;\n }\n \n return t;\n}\n\nint main()\n{\n //fileio_in_out();\n //fileio_txt();\n \n scanf(\"%d%I64d%d\",&n,&m,&k);\n \n for(i=0;i<=n;i++)\n {\n cnk[i][0]=cnk[i][i]=1;\n for(j=1;j<i;j++)\n cnk[i][j]=(cnk[i-1][j-1]+cnk[i-1][j])%md;\n }\n \n for(i=0;i<=n;i++)\n {\n f[i][0]=pw(cnk[n][i],m/n);\n f[i][1]=pw(cnk[n][i],m/n+1);\n }\n \n mset(dp);\n dp[0][0]=1;\n for(i=0;i<n;i++)\n for(j=0;j<=k;j++)\n for(l=0;l<=n;l++)\n {\n t=(i<m%n)?f[l][1]:f[l][0];\n dp[i+1][j+l]=(dp[i+1][j+l]+t*dp[i][j])%md;\n }\n \n printf(\"%I64d\\n\",dp[n][k]);\n \n //system(\"pause\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define MOD (1000000007ULL)\n#define min(a, b) ( ((a) < (b)) ? (a) : (b) )\n\nunsigned long long cnk[101][101], pows[101], pows2[101][101], dp[101][10001];\n\nunsigned long long quick_pow(unsigned long long a, unsigned long long n)\n{\n if (n == 0) {\n return 1;\n } else if ((n & 1ULL) == 0) {\n unsigned long long tmp = quick_pow(a, n / 2ULL);\n return (tmp * tmp) % MOD;\n } else {\n return (quick_pow(a, n - 1) * a) % MOD;\n }\n}\n\nvoid count_cnk(void)\n{\n int i, j;\n cnk[0][0] = 1;\n for(i = 1; i < 101; ++i){\n cnk[i][0] = 1;\n for(j = 1; j < 101; ++j){\n cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % MOD;\n }\n }\n}\n\nint\nmain(void)\n{\n int i, j, t;\n unsigned long long n, m, k;\n\n count_cnk();\n\n scanf(\"%I64u%I64u%I64u\", &n, &m, &k);\n\n unsigned long long rem = m % n;\n for (i = 1; i <= n; ++i) {\n if (rem) {\n pows[i] = m / n + 1;\n --rem;\n } else {\n pows[i] = m / n;\n }\n for (j = 0; j <= n; ++j) {\n pows2[i][j] = quick_pow(cnk[n][j], pows[i]);\n }\n }\n\n dp[0][0] = 1;\n for (i = 1; i <= n; ++i) {\n for (j = 0; j <= min(k, i * n); ++j) {\n for (t = 0; t <= min(n, j); ++t) {\n dp[i][j] = (dp[i][j] + dp[i - 1][j - t] * pows2[i][t]) % MOD;\n }\n }\n }\n\n printf(\"%I64u\", dp[n][k]);\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\n#define maxn 111\n\nconst int mod = (int) 1e9 + 7;\n\nlong long choose[maxn][maxn];\n\nlong long f[maxn][1001];\nlong long g[maxn][maxn];\n\nlong long power( long long a, long long b ) {\n\tlong long ret = 1;\n\t\n\ta %= mod;\n\twhile( b > 0 ) {\n\t\tif( b % 2 ) {\n\t\t\tret = (ret * a) % mod;\n\t\t}\n\t\t\n\t\tb /= 2;\n\t\ta = (a * a) % mod;\n\t}\n\t\n\treturn ret;\n}\n\nint main( void ) {\n\tlong long n, m, k;\n\tscanf(\"%lld %lld %lld\", &n, &m, &k);\n\t\n\tfor( int i = 0; i < maxn; i++ ) {\n\t\tchoose[i][0] = choose[i][i] = 1;\n\t\tfor( int j = 1; j < i; j++ ) {\n\t\t\tchoose[i][j] = (choose[i-1][j] + choose[i-1][j-1]) % mod;\n\t\t}\n\t}\n\t\n\tfor( int i = 1; i <= n; i++ ) {\n\t\tfor( int c = 0; c <= n; c++ ) {\n\t\t\tlong long count = (m / n) + (m % n >= i ? 1 : 0);\n\t\t\tg[i][c] = power(choose[n][c], count);\n\t\t}\n\t}\n\t\n\tf[1][0] = 1;\n\tfor( int i = 1; i <= n; i++ ) {\n\t\tfor( int j = 0; j <= k; j++ ) if( f[i][j] > 0 ) {\n\t\t\tfor( int c = 0; c <= n; c++ ) {\n\t\t\t\tif( j + c > k ) break;\n\t\t\t\tlong long nways = (g[i][c] * f[i][j]) % mod;\n\t\t\t\tf[i+1][j+c] = (f[i+1][j+c] + nways) % mod;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprintf(\"%lld\\n\", f[n+1][k]);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#define MOD 1000000007\n#define min(a, b) ( ((a) < (b)) ? (a) : (b) )\n\nunsigned long long cnk[101][101], pows[101], pows2[101][101], dp[101][101];\n\nunsigned long long quick_pow(unsigned long long a, unsigned long long n)\n{\n if (n == 0) {\n return 1;\n } else if ((n & 1ULL) == 0) {\n unsigned long long tmp = quick_pow(a, n / 2ULL);\n return (tmp * tmp) % MOD;\n } else {\n return (quick_pow(a, n - 1) * a) % MOD;\n }\n}\n\nint\nmain(void)\n{\n int n, k;\n unsigned long long m;\n scanf(\"%d%I64u%d\", &n, &m, &k);\n cnk[0][0] = 1;\n\n int i, j, t;\n for(i = 1; i < 101; ++i){\n cnk[i][0] = 1;\n for(j = 1; j < 101; ++j){\n cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % MOD;\n }\n }\n\n unsigned long long rem = m % n;\n for (i = 1; i <= n; ++i) {\n if (rem) {\n pows[i] = m / n + 1;\n --rem;\n } else {\n pows[i] = m / n;\n }\n for (j = 0; j <= n; ++j) {\n pows2[i][j] = quick_pow(cnk[n][j], pows[i]);\n }\n }\n\n //printf(\"OPPA!\");\n\n dp[0][0] = 1;\n for (i = 1; i <= n; ++i) {\n for (j = 0; j <= min(k, i * n); ++j) {\n for (t = 0; t <= min(n, j); ++t) {\n dp[i][j] = (dp[i][j] + dp[i - 1][j - t] * pows2[i][t]) % MOD;\n }\n }\n }\n\n printf(\"%I64u\", dp[n][k]);\n return 0;\n}\n"}], "src_uid": "9c71c8e031412e2bb21266a53821626a"} {"nl": {"description": "Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends decided to play a game. They put multiple cards and on each one they wrote a letter, either 'A', or the letter 'B'. Then they began to remove the cards one by one from left to right, every time they removed a card with the letter 'A', Alice gave Bob all the fruits she had at that moment and took out of the bag as many apples and as many oranges as she had before. Thus the number of oranges and apples Alice had, did not change. If the card had written letter 'B', then Bob did the same, that is, he gave Alice all the fruit that he had, and took from the bag the same set of fruit. After the last card way removed, all the fruit in the bag were over.You know how many oranges and apples was in the bag at first. Your task is to find any sequence of cards that Alice and Bob could have played with.", "input_spec": "The first line of the input contains two integers, x,\u2009y (1\u2009\u2264\u2009x,\u2009y\u2009\u2264\u20091018,\u2009xy\u2009>\u20091) \u2014 the number of oranges and apples that were initially in the bag.", "output_spec": "Print any sequence of cards that would meet the problem conditions as a compressed string of characters 'A' and 'B. That means that you need to replace the segments of identical consecutive characters by the number of repetitions of the characters and the actual character. For example, string AAABAABBB should be replaced by string 3A1B2A3B, but cannot be replaced by 2A1A1B2A3B or by 3AB2A3B. See the samples for clarifications of the output format. The string that you print should consist of at most 106 characters. It is guaranteed that if the answer exists, its compressed representation exists, consisting of at most 106 characters. If there are several possible answers, you are allowed to print any of them. If the sequence of cards that meet the problem statement does not not exist, print a single word Impossible.", "sample_inputs": ["1 4", "2 2", "3 2"], "sample_outputs": ["3B", "Impossible", "1A1B"], "notes": "NoteIn the first sample, if the row contained three cards with letter 'B', then Bob should give one apple to Alice three times. So, in the end of the game Alice has one orange and three apples, and Bob has one apple, in total it is one orange and four apples.In second sample, there is no answer since one card is not enough for game to finish, and two cards will produce at least three apples or three oranges.In the third sample, cards contain letters 'AB', so after removing the first card Bob has one orange and one apple, and after removal of second card Alice has two oranges and one apple. So, in total it is three oranges and two apples."}, "positive_code": [{"source_code": "#include<stdio.h>\ntypedef long long unsigned llu;\ntypedef long long ll;\ntypedef unsigned u;\nllu G(llu a,llu b){return b?G(b,a%b):a;}\nll lx,ly;\nll egcd(ll a,ll b)\n{\n\tlong long r,q,x=0,y=1;lx=1;ly=0;\n\tu ee=1;\n\twhile(b!=0)\n\t{\n\t\tq=a/b;\n\t\tr=b;b=a%b;a=r;\n\t\tr=x;x=lx-q*x;lx=r;\n\t\tr=y;y=ly-q*y;ly=r;\n\t\tif((ee^=1)&&(q-(b==0)))printf(\"%I64iB\",q-(b==0));\n\t\telse if((q-(b==0)))printf(\"%I64iA\",q-(b==0));\n\t}\n\treturn a;\n}\nint main()\n{\n\tllu a,b;u i,j,k;\n\tscanf(\"%I64u%I64u\",&a,&b);\n\tif(G(a,b)!=1){printf(\"Impossible\\n\");return 0;}\n\tegcd(a,b);\n\tputchar('\\n');\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long gcd(long long a,long long b){\n return b?gcd(b,a%b):a;\n}\nint main()\n{\n long long x,y;\n scanf(\"%I64d%I64d\",&x,&y);\n if(x==y){\n printf(\"Impossible\\n\");\n return 0;\n }\n else if(gcd(x,y)!=1){\n printf(\"Impossible\\n\");\n return 0;\n }\n else if(x==1){\n printf(\"%I64dB\\n\",y-1);\n return 0;\n }\n else if(y==1){\n printf(\"%I64dA\\n\",x-1);\n return 0;\n }\n else{\n while(x!=0 && y!=0){\n if(x==1){\n printf(\"%I64dB\",y-1);\n break;\n }\n else if(y==1){\n printf(\"%I64dA\",x-1);\n break;\n }\n else if(x>y){\n printf(\"%I64dA\",x/y);\n x=x%y;\n }\n else if(x<y){\n printf(\"%I64dB\",y/x);\n y=y%x;\n }\n\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long gcd(long long a,long long b)\n{\n if(a%b==0)\n return b;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n long long x,y,test;\n scanf(\"%I64d %I64d\",&x,&y);\n test=gcd(x,y);\n //printf(\"%I64d\",test);\n if(test>1)\n {\n printf(\"Impossible\");\n return 0;\n }\n else\n {\n while(x && y)\n {\n if(x>y)\n {\n printf(\"%I64dA\",(x-1)/y);\n x=x%y;\n }\n else\n {\n printf(\"%I64dB\",(y-1)/x);\n y=y%x;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "/* practice with Dukkha */\n#include <stdio.h>\n\nlong long gcd(long long a, long long b) {\n\treturn b == 0 ? a : gcd(b, a % b);\n}\n\nint main() {\n\tstatic char cc[1048576], *s = cc;\n\tlong long x, y;\n\n\tscanf(\"%lld%lld\", &x, &y);\n\tif (gcd(x, y) != 1) {\n\t\tprintf(\"Impossible\\n\");\n\t\treturn 0;\n\t}\n\twhile (x > 1 || y > 1) {\n\t\tlong long k;\n\t\tchar c;\n\n\t\tif (x > y) {\n\t\t\tk = x / y;\n\t\t\tif (y == 1)\n\t\t\t\tk--;\n\t\t\tx %= y;\n\t\t\tc = 'A';\n\t\t} else {\n\t\t\tk = y / x;\n\t\t\tif (x == 1)\n\t\t\t\tk--;\n\t\t\ty %= x;\n\t\t\tc = 'B';\n\t\t}\n\t\ts += sprintf(s, \"%lld%c\", k, c);\n\t}\n\tprintf(\"%s\\n\", cc);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nlong long gcd(long long a,long long b)\n{\n if(a%b==0)\n return b;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n long long x,y,test;\n scanf(\"%I64d %I64d\",&x,&y);\n test=gcd(x,y);\n if(test>=1)\n printf(\"Impossible\");\n else\n {\n while(x && y)\n {\n if(x>y)\n {\n printf(\"%I64dA\",(x-1)/y);\n x=x%y;\n }\n else\n {\n printf(\"%I64dB\",(y-1)/x);\n y=y%x;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long gcd(long a,long b)\n{\n if(a%b==0)\n return b;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n long long x,y,test;\n scanf(\"%I64d %I64d\",&x,&y);\n test=gcd(x,y);\n if(test>1)\n printf(\"Impossible\");\n else\n {\n while(x && y)\n {\n if(x>y)\n {\n printf(\"%I64dA\",(x-1)/y);\n x=x%y;\n }\n else\n {\n printf(\"%I64dB\",(y-1)/x);\n y=y%x;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long gcd(long long a,long long b)\n{\n if(a%b==0)\n return b;\n else\n return gcd(b,a%b);\n}\nint main()\n{\n long long x,y,test;\n scanf(\"%I64d %I64d\",&x,&y);\n test=gcd(x,y);\n printf(\"%I64d\",test);\n if(test>1)\n {\n printf(\"Impossible\");\n return 0;\n }\n else\n {\n while(x && y)\n {\n if(x>y)\n {\n printf(\"%I64dA\",(x-1)/y);\n x=x%y;\n }\n else\n {\n printf(\"%I64dB\",(y-1)/x);\n y=y%x;\n }\n }\n }\n return 0;\n}\n"}], "src_uid": "6a9ec3b23bd462353d985e0c0f2f7671"} {"nl": {"description": "Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used!Vasya's life goes in states of a program. In each state, Vasya can either be used (for example, to calculate the value of another variable), or be assigned a value, or ignored. Between some states are directed (oriented) transitions.A path is a sequence of states v1,\u2009v2,\u2009...,\u2009vx, where for any 1\u2009\u2264\u2009i\u2009<\u2009x exists a transition from vi to vi\u2009+\u20091.Vasya's value in state v is interesting to the world, if exists path p1,\u2009p2,\u2009...,\u2009pk such, that pi\u2009=\u2009v for some i (1\u2009\u2264\u2009i\u2009\u2264\u2009k), in state p1 Vasya gets assigned a value, in state pk Vasya is used and there is no state pi (except for p1) where Vasya gets assigned a value.Help Vasya, find the states in which Vasya's value is interesting to the world.", "input_spec": "The first line contains two space-separated integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009105) \u2014 the numbers of states and transitions, correspondingly. The second line contains space-separated n integers f1,\u2009f2,\u2009...,\u2009fn (0\u2009\u2264\u2009fi\u2009\u2264\u20092), fi described actions performed upon Vasya in state i: 0 represents ignoring, 1 \u2014 assigning a value, 2 \u2014 using. Next m lines contain space-separated pairs of integers ai,\u2009bi (1\u2009\u2264\u2009ai,\u2009bi\u2009\u2264\u2009n, ai\u2009\u2260\u2009bi), each pair represents the transition from the state number ai to the state number bi. Between two states can be any number of transitions.", "output_spec": "Print n integers r1,\u2009r2,\u2009...,\u2009rn, separated by spaces or new lines. Number ri should equal 1, if Vasya's value in state i is interesting to the world and otherwise, it should equal 0. The states are numbered from 1 to n in the order, in which they are described in the input.", "sample_inputs": ["4 3\n1 0 0 2\n1 2\n2 3\n3 4", "3 1\n1 0 2\n1 3", "3 1\n2 0 1\n1 3"], "sample_outputs": ["1\n1\n1\n1", "1\n0\n1", "0\n0\n0"], "notes": "NoteIn the first sample the program states can be used to make the only path in which the value of Vasya interests the world, 1 2 3 4; it includes all the states, so in all of them Vasya's value is interesting to the world.The second sample the only path in which Vasya's value is interesting to the world is , \u2014 1 3; state 2 is not included there.In the third sample we cannot make from the states any path in which the value of Vasya would be interesting to the world, so the value of Vasya is never interesting to the world."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\ntypedef struct node{\n int v;\n struct node *next;\n} NODE;\n\nchar f[100000];\n\nvoid dfs(int n, NODE *e[], char v[], int mode){\n v[n] = 1;\n if (!mode && f[n] == 1)return;\n NODE *tmp = e[n];\n while (tmp){\n if (!v[tmp->v] && !(mode && f[tmp->v] == 1))\n dfs(tmp->v, e, v, mode);\n tmp = tmp->next;\n }\n return;\n}\n\nint main(){\n int n, m, i, j, x, y;\n char f1 = 0, f2 = 0, v1[100000] = {}, v2[100000] = {};\n NODE *e[100000] = {}, *b[100000] = {}, *tmp;\n scanf(\"%d%d\", &n, &m);\n for (i = 0 ; i < n ; ++i){\n scanf(\"%d\", f + i);\n if (f[i] == 1)f1 = 1;\n else if (f[i] == 2)f2 = 1;\n }\n if (!f1 || !f2){\n while (n--)puts(\"0\");\n return 0;\n }\n \n for (i = 0 ; i < m ; ++i){\n scanf(\"%d%d\", &x, &y);\n --x, --y;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = y, tmp->next = e[x], e[x] = tmp;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = x, tmp->next = b[y], b[y] = tmp;\n }\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 1)\n dfs(i, e, v1, 1);\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 2)\n dfs(i, b, v2, 0);\n for (i = 0 ; i < n ; ++i)\n printf(\"%d\\n\", v1[i] && v2[i]);\n scanf(\" \");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define maxN 100010\n\nstruct {\n int to;\n int nextID;\n} E[maxN], R[maxN];\n\nint LE[maxN], RE[maxN];\nint t[maxN], afs[maxN], lfs[maxN];\n\nvoid dfs( int s ) {\n afs[s] = 1;\n\n int ID;\n for( ID = LE[s]; ID != 0; ID = E[ID].nextID )\n\tif( !afs[E[ID].to] ) dfs(E[ID].to);\n}\n\nvoid ofs( int s ) {\n lfs[s] = 1;\n\n if( t[s] == 1 ) return;\n\n int ID;\n for( ID = RE[s]; ID != 0; ID = R[ID].nextID )\n\tif( !lfs[R[ID].to] ) ofs(R[ID].to);\n}\n\nint main( void ) {\n int N, M;\n scanf(\"%i %i\", &N, &M);\n \n int i;\n for( i = 1; i <= N; i++ )\n\tscanf(\"%i\", &t[i]);\n\n for( i = 1; i <= M; i++ ) {\n\tint u, v;\n\tscanf(\"%i %i\", &u, &v);\n\n\tE[i].to = v;\n\tE[i].nextID = LE[u];\n\tLE[u] = i;\n\n\tR[i].to = u;\n\tR[i].nextID = RE[v];\n\tRE[v] = i;\n }\n \n for( i = 1; i <= N; i++ )\n\tif( t[i] == 1 ) dfs(i);\n\n for( i = 1; i <= N; i++ )\n\tif( t[i] == 2 ) ofs(i);\n\n for( i = 1; i <= N; i++ )\n\tprintf(\"%i%c\", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\\n' : ' ');\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\ntypedef struct node{\n int v;\n struct node *next;\n} NODE;\n\nchar f[100000];\n\nvoid dfs(int n, NODE *e[], char v[], int mode){\n v[n] = 1;\n if (!mode && f[n] == 1)return;\n NODE *tmp = e[n];\n while (tmp){\n if (!v[tmp->v] && !(mode && f[tmp->v] == 1))\n dfs(tmp->v, e, v, mode);\n tmp = tmp->next;\n }\n return;\n}\n\nint main(){\n int n, m, i, j, x, y;\n char f1 = 0, f2 = 0, v1[100000] = {}, v2[100000] = {};\n NODE *e[100000] = {}, *b[100000] = {}, *tmp;\n scanf(\"%d%d\", &n, &m);\n for (i = 0 ; i < n ; ++i){\n scanf(\"%d\", f + i);\n if (f[i] == 1)f1 = 1;\n else if (f[i] == 2)f2 = 1;\n }\n if (!f1 || !f2){\n while (n--)puts(\"0\");\n return 0;\n }\n \n for (i = 0 ; i < m ; ++i){\n scanf(\"%d%d\", &x, &y);\n --x, --y;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = y, tmp->next = e[x], e[x] = tmp;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = x, tmp->next = b[y], b[y] = tmp;\n }\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 1)\n dfs(i, e, v1, 1);\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 2)\n dfs(i, b, v2, 0);\n for (i = 0 ; i < n ; ++i)\n printf(\"%d\\n\", v1[i] && v2[i]);\n scanf(\" \");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\ntypedef struct node{\n int v;\n struct node *next;\n} NODE;\n\nvoid dfs(int n, NODE *e[], char v[]){\n NODE *tmp = e[n];\n v[n] = 1;\n while (tmp){\n if (!v[tmp->v])\n dfs(tmp->v, e, v);\n tmp = tmp->next;\n }\n return;\n}\n\nint main(){\n int n, m, i, j, x, y;\n char f[100000], f1 = 0, f2 = 0, v1[100000] = {}, v2[100000] = {};\n NODE *e[100000] = {}, *b[100000] = {}, *tmp;\n scanf(\"%d%d\", &n, &m);\n for (i = 0 ; i < n ; ++i){\n scanf(\"%d\", f + i);\n if (f[i] == 1)f1 = 1;\n else if (f[i] == 2)f2 = 1;\n }\n if (!f1 || !f2){\n while (n--)puts(\"0\");\n return 0;\n }\n \n for (i = 0 ; i < m ; ++i){\n scanf(\"%d%d\", &x, &y);\n --x, --y;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = y, tmp->next = e[x], e[x] = tmp;\n tmp = calloc(1, sizeof(NODE));\n tmp->v = x, tmp->next = b[y], b[y] = tmp;\n }\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 1)\n dfs(i, e, v1);\n for (i = 0 ; i < n ; ++i)\n if (f[i] == 2)\n dfs(i, b, v2);\n for (i = 0 ; i < n ; ++i)\n printf(\"%d\\n\", v1[i] && v2[i]);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\ntypedef struct node{\n int v;\n struct node *pre, *next;\n} NODE;\n\nint e[100000][2], v[100001] = {};\nchar s[100001] = {}, f[100001];\nNODE pre[100000] = {}, *prep[100001];\n\nint cmp(const void *a, const void *b){\n int *x = (int*)a, *y = (int*)b;\n if (x[0] < y[0])return -1;\n if (x[0] > y[0])return 1;\n if (x[1] < y[1])return -1;\n if (x[1] > y[1])return 1;\n return 0;\n}\n\nvoid fill(int now, NODE *prep[]){\n do {/**/printf(\" f: %d %d\\n\", now, prep[now]->v);\n if (!prep[now]->v)return;\n if (s[prep[now]->v])continue;\n s[prep[now]->v] = 1;\n fill(prep[now]->v, prep);\n }while (prep[now]->pre && (prep[now] = prep[now]->pre));\n return;\n}\n\nint main(){\n int n, m, i, j;\n char f1 = 0, f2 = 0;\n \n scanf(\"%d%d\", &n, &m);\n for (i = 1 ; i <= n ; ++i){\n scanf(\"%d\", f + i);\n if (f[i] == 1)f1 = 1;\n else if (f[i] == 2)f2 = 1;\n }\n if (!f1 || !f2){\n while (n--)puts(\"0\");\n return 0;\n }\n \n for (i = 0 ; i < m ; ++i)\n scanf(\"%d%d\", &e[i][0], &e[i][1]);\n qsort(e, m, sizeof(int) * 2, cmp);\n for (i = 0, j = 1 ; i < m ; ++i)\n while (e[i][0] > j)v[j++] = i;\n while (j <= n)v[j++] = m;\n \n for (i = 1 ; i <= n ; ++i){\n if (f[i] != 1)continue;\n int l, r, q[100000];\n char c[100001] = {};\n memset(pre, 0, sizeof(pre));\n q[0] = i, c[i] = 1;\n prep[i] = &pre[0];\n for (l = 0, r = 1 ; l < r ; ++l){\n for (j = v[q[l] - 1] ; j < v[q[l]] ; ++j){\n if (f[e[j][1]] == 1)continue;\n if (c[e[j][1]]){\n /**/printf(\"c: %d %d %d %d\\n\", l, r, e[j][0], e[j][1]);\n NODE *tmp = prep[e[j][1]];\n do {\n if (tmp->v == q[l])break;\n }while (tmp->pre && (tmp = tmp->pre));\n if (tmp->v == q[l])continue;\n prep[e[j][1]]->next = calloc(1, sizeof(NODE));\n prep[e[j][1]]->next->pre = prep[e[j][1]];\n prep[e[j][1]] = prep[e[j][1]]->next;\n prep[e[j][1]]->v = q[l];\n }\n else {\n /**/printf(\"d: %d %d %d %d\\n\", l, r, e[j][0], e[j][1]);\n c[e[j][1]] = 1;\n pre[r].v = q[l];\n prep[e[j][1]] = &pre[r];\n q[r++] = e[j][1];\n }\n if (s[e[j][1]] || f[e[j][1]] == 2){\n /**/printf(\"s: %d %d %d %d\\n\", l, r, e[j][0], e[j][1]);\n s[e[j][1]] = 1;\n fill(e[j][1], prep);\n }\n }\n }\n }\n for (i = 1 ; i <= n ; ++i)\n printf(\"%d\\n\", s[i]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define maxN 100010\n\nstruct {\n int to;\n int nextID;\n} E[maxN];\n\nint LE[maxN], P[maxN];\nint t[maxN], afs[maxN], lfs[maxN];\n\nvoid dfs( int s ) {\n afs[s] = 1;\n\n int ID;\n for( ID = LE[s]; ID != 0; ID = E[ID].nextID )\n\tif( !afs[E[ID].to] ) {\n\t P[E[ID].to] = s;\n\t dfs(E[ID].to);\n\t}\n}\n\nvoid ofs( int s ) {\n while( (s != 0) && (lfs[s] == 0) ) {\n\tlfs[s] = 1;\n\ts = P[s];\n\n\tif( t[s] == 1 ) break;\n }\n\n if( t[s] == 1 ) lfs[s] = 1;\n}\n\nint main( void ) {\n int N, M;\n scanf(\"%i %i\", &N, &M);\n \n int i;\n for( i = 1; i <= N; i++ )\n\tscanf(\"%i\", &t[i]);\n\n for( i = 1; i <= M; i++ ) {\n\tint u, v;\n\tscanf(\"%i %i\", &u, &v);\n\n\tE[i].to = v;\n\tE[i].nextID = LE[u];\n\tLE[u] = i;\n }\n \n for( i = 1; i <= N; i++ )\n\tif( t[i] == 1 ) dfs(i);\n\n for( i = 1; i <= N; i++ )\n\tif( t[i] == 2 ) ofs(i);\n\n for( i = 1; i <= N; i++ )\n\tprintf(\"%i%c\", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\\n' : ' ');\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define maxN 100010\n\nstruct {\n int to;\n int nextID;\n} E[maxN];\n\nint LE[maxN], P[maxN];\nint t[maxN], afs[maxN], lfs[maxN];\n\nvoid dfs( int s ) {\n afs[s] = 1;\n\n int ID;\n for( ID = LE[s]; ID != 0; ID = E[ID].nextID )\n\tif( !afs[E[ID].to] ) {\n\t P[E[ID].to] = s;\n\t dfs(E[ID].to);\n\t}\n}\n\nvoid ofs( int s ) {\n \n while( s != 0 && !lfs[s] ) {\n\tlfs[s] = 1;\n\ts = P[s];\n }\n}\n\nint main( void ) {\n int N, M;\n scanf(\"%i %i\", &N, &M);\n \n int i;\n for( i = 1; i <= N; i++ )\n\tscanf(\"%i\", &t[i]);\n\n for( i = 1; i <= M; i++ ) {\n\tint u, v;\n\tscanf(\"%i %i\", &u, &v);\n\n\tE[i].to = v;\n\tE[i].nextID = LE[u];\n\tLE[u] = i;\n }\n \n for( i = 1; i <= N; i++ )\n\tif( t[i] == 1 ) dfs(i);\n\n for( i = 1; i <= N; i++ )\n\tif( t[i] == 2 && afs[i] ) ofs(i);\n\n for( i = 1; i <= N; i++ )\n\tprintf(\"%i%c\", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\\n' : ' ');\n\n return 0;\n}\n"}], "src_uid": "87d869a0fd4a510c5e7e310886b86a57"} {"nl": {"description": "The stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identify the exact location of the Death Star, she needs to know whether this information is correct. Two rebel spies have provided her with the maps of the solar system. Each map is an N\u2009\u00d7\u2009N grid, where each cell is either occupied by a star or empty. To see whether the information is correct, Heidi needs to know whether the two maps are of the same solar system, or if possibly one of the spies is actually an Empire double agent, feeding her false information.Unfortunately, spies may have accidentally rotated a map by 90, 180, or 270 degrees, or flipped it along the vertical or the horizontal axis, before delivering it to Heidi. If Heidi can rotate or flip the maps so that two of them become identical, then those maps are of the same solar system. Otherwise, there are traitors in the Rebel ranks! Help Heidi find out.", "input_spec": "The first line of the input contains one number N (1\u2009\u2264\u2009N\u2009\u2264\u200910) \u2013 the dimension of each map. Next N lines each contain N characters, depicting the first map: 'X' indicates a star, while 'O' indicates an empty quadrant of space. Next N lines each contain N characters, depicting the second map in the same format.", "output_spec": "The only line of output should contain the word Yes if the maps are identical, or No if it is impossible to match them by performing rotations and translations.", "sample_inputs": ["4\nXOOO\nXXOO\nOOOO\nXXXX\nXOOO\nXOOO\nXOXO\nXOXX", "2\nXX\nOO\nXO\nOX"], "sample_outputs": ["Yes", "No"], "notes": "NoteIn the first test, you can match the first map to the second map by first flipping the first map along the vertical axis, and then by rotating it 90 degrees clockwise. "}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint n;\nchar a[11][11], b[11][11], c[11][11];\n\nvoid turn()\n{\n int i, j, k, l;\n for(i=n-1, k=0; i>=0; --i, ++k)\n for(j=0, l=0; j<n; ++j, ++l)\n c[k][l] = a[j][i];\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n a[i][j] = c[i][j];\n}\n\nint same()\n{\n int i, j;\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n if(a[i][j]!=b[i][j])\n return 0;\n return 1;\n}\n\nvoid p()\n{\n int i, j;\n printf(\"\\n\\n\");\n for(i=0; i<n; ++i)\n {\n for(j=0; j<n; ++j)\n printf(\"%c\", a[i][j]);\n printf(\"\\n\");\n }\n printf(\"\\n\\n\");\n}\n\nvoid f()\n{\n int i, j;\n for(i=0; i<3; ++i)\n {\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n turn();\n }\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n c[i][j] = a[i][n-j-1];\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n a[i][j] = c[i][j];\n\n for(i=0; i<3; ++i)\n {\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n turn();\n }\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n printf(\"No\\n\");\n return;\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n int i, j;\n for(i=0; i<n; ++i)\n scanf(\"%s\", a[i]);\n for(i=0; i<n; ++i)\n scanf(\"%s\", b[i]);\n\n f();\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <time.h>\n#include <stdlib.h>\nchar a[20][11],b[20][11];\nint n;\nint check()\n{\n int k=0;\n for (int i=0; i<n; i++)\n {\n for (int j=0; j<n; j++)\n {\n if (a[n+i][j]!=b[i][j])\n {\n k=1;\n break;\n }\n }\n }\n if (k==0)\n {\n printf(\"YES\");\n return 10;\n }\n else\n return 0;\n}\nvoid ud()\n{\n for (int i=0; i<n; i++)\n {\n for (int j=0; j<n; j++)\n {\n b[n-i-1][j]=a[i][j];\n }\n }\n}\nvoid lr()\n{\n for (int i=0; i<n; i++)\n {\n for (int j=0; j<n; j++)\n {\n b[i][n-j-1]=a[i][j];\n }\n }\n}\nvoid rot()\n{\n for (int i=0; i<n; i++)\n {\n for (int j=0; j<n; j++)\n {\n b[n-j-1][i]=a[i][j];\n }\n }\n}\nvoid match()\n{\n for (int i=0; i<n; i++)\n {\n for (int j=0; j<n; j++)\n {\n a[i][j]=b[i][j];\n }\n }\n}\nint main()\n{\n scanf(\"%d\",&n);\n for (int i=0; i<n*2; i++)\n {\n scanf(\"%s\",a[i]);\n }\n for (int i=0; i<4; i++)\n {\n rot();\n match();\n if (check()==10)\n return 0;\n ud();\n match();\n if (check()==10)\n return 0;\n lr();\n match();\n if (check()==10)\n return 0;\n ud();\n match();\n if (check()==10)\n return 0;\n lr();\n match();\n if (check()==10)\n return 0;\n }\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <conio.h>\n\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n\n char map1[n][n+1],map2[n][n+1];\n\n for(i=0;i<n;i++){\n scanf(\"%s\",map1[i]);\n }\n\n for(i=0;i<n;i++){\n scanf(\"%s\",map2[i]);\n }\n\n int a,b,c,rot=0;\n\n while(1){\n\n a=1,b=1,c=1;\n for(i=0;i<n;i++){\n if(a==1){\n for(j=0;j<n;j++){\n if(map1[i][j]!=map2[i][j]){\n a=0;\n break;\n }\n }\n }\n if(b==1){\n for(j=0;j<n;j++){\n if(map1[n-1-i][j]!=map2[i][j]){\n b=0;\n break;\n }\n }\n }\n if(c==1){\n for(j=0;j<n;j++){\n if(map1[i][n-1-j]!=map2[i][j]){\n c=0;\n break;\n }\n }\n }\n if(a==0&&b==0&&c==0){\n break;\n }\n\n }\n\n if(i==n){\n printf(\"Yes\\n\");\n break;\n }\n else{\n if(rot==4){\n printf(\"No\\n\");\n break;\n }\n else{\n rot++;\n }\n }\n\n int lim=n/2;\n for(i=0;i<lim;i++){\n for(j=i;j<n-1-i;j++){\n char temp=map1[i][j];\n map1[i][j]=map1[j][n-1-i];\n map1[j][n-1-i]=map1[n-1-i][n-1-j];\n map1[n-1-i][n-1-j]=map1[n-1-j][i];\n map1[n-1-j][i]=temp;\n }\n }\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int a,i,j,k,flag,count=0;\n scanf(\"%d\",&a);\n char arr[a][a],oth[a][a],change[a][a],matha_nosto[a][a];\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n scanf(\" %c\",&arr[i][j]);\n }\n\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n scanf(\" %c\",&oth[i][j]);\n }\n\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n change[j][a-1-i]=oth[i][j];\n }\n for(k=0; k<a+6; k++)\n {\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n {\n if(arr[i][j]==change[i][j])\n flag=1;\n else\n {\n flag=0;\n break;\n }\n }\n if(flag==0)\n break;\n }\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n {\n if(arr[i][j]==change[i][a-1-j])\n flag=1;\n else\n {\n flag=0;\n break;\n }\n }\n if(flag==0)\n break;\n }\n if(flag==1)\n {\n printf(\"YES\");\n return 0;\n }\n else\n {\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n oth[i][j]=change[i][j];\n }\n\n for(i=0; i<a; i++)\n {\n for(j=0; j<a; j++)\n change[j][a-1-i]=oth[i][j];\n }\n }\n }\n\n }\n printf(\"NO\");\n return 0;\n}\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint v[10][10];\nint r[10][10];\n\nint aux[10][10];\n\nint n;\n\nvoid rot()\n{\n int i,j;\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n {\n aux[j][n-i-1]=v[i][j];\n }\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n v[i][j]=aux[i][j];\n}\n\nvoid flip1()\n{\n int i,j;\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n {\n aux[n-i-1][j]=v[i][j];\n }\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n v[i][j]=aux[i][j];\n}\n\nvoid flip2()\n{\n int i,j;\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n {\n aux[i][n-j-1]=v[i][j];\n }\n for(i=0; i<n; i++)\n for(j=0; j<n; j++)\n v[i][j]=aux[i][j];\n}\n\nint check(){\n int i,j,x=1;\n for(i=0;i<n;i++)\n for(j=0;j<n;j++){\n if(v[i][j]!=r[i][j])\n x=0;\n }\n return x;\n}\n\nint main()\n{\n int i,j,x=0;\n char c;\n scanf(\"%d\",&n);\n fgetc(stdin);\n for(i=0; i<n; i++){\n for(j=0; j<n; j++)\n {\n c=fgetc(stdin);\n if(c=='X')\n v[i][j]=1;\n }\n fgetc(stdin);\n }for(i=0; i<n; i++){\n for(j=0; j<n; j++)\n {\n c=fgetc(stdin);\n if(c=='X')\n r[i][j]=1;\n }\n fgetc(stdin);\n }\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n flip1();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n flip2();\n flip1();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(check()==1){\n x=1;\n }\n rot();\n if(x==1)\n printf(\"Yes\");\n else printf(\"No\");\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\n\nint n;\nchar a[11][11], b[11][11], c[11][11];\n\nvoid turn()\n{\n int i, j, k, l;\n for(i=n-1, k=0; i>=0; --i, ++k)\n for(j=0, l=0; j<n; ++j, ++l)\n c[k][l] = a[j][i];\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n a[i][j] = c[i][j];\n}\n\nint same()\n{\n int i, j;\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n if(a[i][j]!=b[i][j])\n return 0;\n return 1;\n}\n\nvoid p()\n{\n int i, j;\n printf(\"\\n\\n\");\n for(i=0; i<n; ++i)\n {\n for(j=0; j<n; ++j)\n printf(\"%c\", a[i][j]);\n printf(\"\\n\");\n }\n printf(\"\\n\\n\");\n}\n\nvoid f()\n{\n int i, j;\n for(i=0; i<3; ++i)\n {\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n turn();\n }\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n c[i][j] = a[i][n-j-1];\n for(i=0; i<n; ++i)\n for(j=0; j<n; ++j)\n a[i][j] = c[i][j];\n\n for(i=0; i<3; ++i)\n {\n if(same())\n {\n printf(\"Yes\\n\");\n return;\n }\n turn();\n }\n printf(\"No\\n\");\n return;\n}\n\nint main()\n{\n scanf(\"%d\", &n);\n int i, j;\n for(i=0; i<n; ++i)\n scanf(\"%s\", a[i]);\n for(i=0; i<n; ++i)\n scanf(\"%s\", b[i]);\n\n f();\n return 0;\n}\n"}], "src_uid": "2e793c9f476d03e8ba7df262db1c06e4"} {"nl": {"description": "Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all: 'U': go up, (x, y) \u2009\u2192\u2009 (x, y+1); 'D': go down, (x, y) \u2009\u2192\u2009 (x, y-1); 'L': go left, (x, y) \u2009\u2192\u2009 (x-1, y); 'R': go right, (x, y) \u2009\u2192\u2009 (x+1, y). The robot will do the operations in s from left to right, and repeat it infinite times. Help Fox Ciel to determine if after some steps the robot will located in (a,\u2009b).", "input_spec": "The first line contains two integers a and b, (\u2009-\u2009109\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009109). The second line contains a string s (1\u2009\u2264\u2009|s|\u2009\u2264\u2009100, s only contains characters 'U', 'D', 'L', 'R') \u2014 the command.", "output_spec": "Print \"Yes\" if the robot will be located at (a,\u2009b), and \"No\" otherwise.", "sample_inputs": ["2 2\nRU", "1 2\nRU", "-1 1000000000\nLRRLU", "0 0\nD"], "sample_outputs": ["Yes", "No", "Yes", "Yes"], "notes": "NoteIn the first and second test case, command string is \"RU\", so the robot will go right, then go up, then right, and then up and so on.The locations of its moves are (0, 0) \u2009\u2192\u2009 (1, 0) \u2009\u2192\u2009 (1, 1) \u2009\u2192\u2009 (2, 1) \u2009\u2192\u2009 (2, 2) \u2009\u2192\u2009 ...So it can reach (2, 2) but not (1, 2)."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,fx=0,fy=0,i,j,k,l,mx,my,ix,iy,c=0,n,X[10000],Y[1000];\n double d=0,e=0;\n char s1[1000];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",s1);\n l=strlen(s1);\n if(a==0 && b==0)\n {\n printf(\"Yes\");\n return(0);\n }\n for(i=0;i<l;i++)\n {\n if(s1[i]=='U')\n fy+=1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n X[i]=fx;\n Y[i]=fy;\n }\n mx=X[l-1];\n my=Y[l-1];\n if(X[l-1]!=0 || Y[l-1]!=0)\n {\n c=0;\n for(i=0;i<l;i++)\n {\n if(Y[l-1]==0 && X[l-1]!=0)\n {\n d=(double)(a-X[i])/mx;\n if(d==(int)d && d>=0 && Y[i]==b)\n c++;\n }\n else if(X[l-1]==0 && Y[l-1]!=0)\n {\n d=(double)(b-Y[i])/my;\n if(d==(int)d && d>=0 && X[i]==a)\n c++;\n }\n else if(mx!=0 && my!=0)\n {\n d=(double)(a-X[i])/mx;\n e=(double)(b-Y[i])/my;\n if(d==(int)d && e==(int)d)\n {\n if(d==e && d>=0 && e>=0)\n c++;\n }\n }\n if(c>0)\n {\n printf(\"Yes\");\n return(0);\n }\n }\n if(c==0)\n printf(\"No\");\n }\n else\n {\n for(i=0;i<l;i++)\n {\n if(a==X[i] && b==Y[i])\n {\n printf(\"Yes\");\n return(0);\n }\n }\n printf(\"No\");\n }\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,i,path[2][105],len,delta_x,delta_y,k;\n char str[105];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",str);\n len = strlen(str);\n i=0;\n k=0;\n path[0][k]=0;\n path[1][k]=0;\n k++;\n while(i<len)\n {\n if(str[i] == 'U')\n {\n path[0][k] = path[0][k-1];\n path[1][k] = path[1][k-1] + 1;\n }\n if(str[i] == 'D')\n {\n path[0][k] = path[0][k-1];\n path[1][k] = path[1][k-1] - 1;\n }\n if(str[i] == 'R')\n { \n path[0][k] = path[0][k-1] + 1;\n path[1][k] = path[1][k-1];\n }\n if(str[i] == 'L')\n {\n path[0][k] = path[0][k-1] - 1;\n path[1][k] = path[1][k-1];\n }\n k++;\n i++;\n }\n delta_x = path[0][len]-path[0][0];\n delta_y = path[1][len]-path[1][0];\n for(i=0;i<=len;i++)\n {\n if(delta_x == 0 && delta_y!=0)\n {\n if(path[0][i] == a && (b-path[1][i])%delta_y == 0 && (b-path[1][i])/delta_y >= 0) \n {\n printf(\"Yes\\n\");\n break;\n }\n }\n if(delta_y == 0 && delta_x!=0)\n {\n if(path[1][i] == b && (a-path[0][i])%delta_x == 0 && (a-path[0][i])/delta_x >= 0)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n if(delta_x!=0 && delta_y!=0)\n {\n if((a-path[0][i])%delta_x == 0 && (b-path[1][i])%delta_y == 0)\n {\n if((a-path[0][i])/delta_x == (b-path[1][i])/delta_y && (b-path[1][i])/delta_y >= 0)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(delta_x == 0 && delta_y == 0)\n {\n if(path[0][i] == a && path[1][i] == b)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(i>len)\n printf(\"No\\n\");\nreturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define REP(i,n) for(int i=0;i<(int)n;++i)\ntypedef long long ll;\n\nconst int dy[] = {1,0,-1,0};\nconst int dx[] = {0,1,0,-1};\nconst char dir[] = \"URDL\";\n\nint d[100];\nchar s[105];\nint vx[105], vy[105];\nint ix, iy;\nint main() {\n\tint a,b;\n\twhile(scanf(\"%d%d\", &a, &b) == 2) {\n\t\tscanf(\"%s\",s);\n\t\tll y=0,x=0;\n\t\tint n = strlen(s);\n\t\tREP(i,n) {\n\t\t\td[i] = strchr(dir, s[i]) - dir;\n\t\t}\n\t\tix = 0;\n\t\tiy = 0;\n\t\tvx[ix++] = 0;\n\t\tvy[iy++] = 0;\n\t\tREP(i,n) {\n\t\t\ty += dy[d[i]];\n\t\t\tx += dx[d[i]];\n\t\t\tvy[iy++] = y;\n\t\t\tvx[ix++] = x;\n\t\t}\n\t\tll Y = y;\n\t\tll X = x;\n\t\tint ok = 0;\n\t\tREP(i,n) {\n\t\t\tREP(j,n) {\n\t\t\t\tll yy = vy[j];\n\t\t\t\tll xx = vx[j];\n\t\t\t\tll y = b-yy;\n\t\t\t\tll x = a-xx;\n\t\t\t\tif (Y && y % Y == 0 && y/Y>=0) {\n\t\t\t\t\tif (X*(y/Y) == x) {\n\t\t\t\t\t\tok = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Y == 0 && y == 0) {\n\t\t\t\t\tif (x == 0 || (X && x % X == 0 && x/X>=0)) {\n\t\t\t\t\t\tok = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%s\\n\",ok?\"Yes\":\"No\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;//collinearity\n if(det==0)\n {\n ll dot_product=(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1);//direction\n if(dot_product>0)\n {\n ll dist=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)) - ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));//relative position\n if(dist>0)\n {\n ll m=((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));//jumps in multiple of m(the original distance)\n if((dist+m)%m==0)\n return 1;\n else return 0;\n }\n else\n return 0;\n }\n else\n return 0;\n }\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;// first 2 cycles for given sequence\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if((c1[i][0]==a && c1[i][1]==b) || (c2[i][0]==a && c2[i][1]==b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nlong long absl(long long x)\n{\n if (x < 0) return -x;\n \n return x;\n}\n\nlong long dist(long long x1, long long y1, long long x2, long long y2)\n{\n return absl(x1 - x2) + absl(y1 - y2);\n}\n\nint main()\n{\n int a, b, n, x = 100, y = 100, x1 = 100, y1 = 100, x2 = 100, y2 = 100, i;\n long long l, r, m1, m2;\n int d[201][201] = {0};\n char s[101];\n \n scanf(\"%d %d\", &a, &b);\n scanf(\"%s\", s);\n \n n = strlen(s);\n \n d[x][y] = 1;\n \n for (i = 0; i < n; i++) {\n if (s[i] == 'U') {\n y++;\n } else if (s[i] == 'D') {\n y--;\n } else if (s[i] == 'L') {\n x--;\n } else {\n x++;\n }\n \n if (x > x1) x1 = x;\n if (y > y1) y1 = y;\n if (x < x2) x2 = x;\n if (y < y2) y2 = y;\n \n d[x][y] = 1;\n }\n \n x -= 100;\n y -= 100;\n x1 -= 100;\n y1 -= 100;\n x2 -= 100;\n y2 -= 100;\n \n l = 0, r = 1e9;\n \n while (r - l > 1) {\n long long z1, z2;\n \n m1 = l + (r - l) / 3;\n m2 = r - (r - l) / 3;\n \n if (m1 >= m2 || m1 <= l || m1 >= r || m2 <= l || m2 >= r) break;\n \n z1 = dist(m1 * x, m1 * y, a, b);\n z2 = dist(m2 * x, m2 * y, a, b);\n \n if (z1 > z2) {\n l = m1;\n } else {\n r = m2;\n }\n }\n \n for (i = l - 200; i <= l + 200; i++) {\n long long p, q;\n \n if (i < 0) continue;\n \n p = a - i * x;\n q = b - i * y;\n \n if (absl(p) > 100 || absl(q) > 100) continue;\n \n if (d[p + 100][q + 100] == 1) {\n puts(\"Yes\");\n \n return 0;\n }\n }\n \n puts(\"No\");\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n#include <string.h>\n\nint main(){\n int sx=0,sy=0,p=1,a,b,i,num_len,dx,dy;\n char s[110];\n int pos_x[110];\n int pos_y[110];\n scanf(\"%d %d %s\",&a,&b,s);\n pos_x[0]=pos_y[0]=0;\n num_len=strlen(s);\n for(i=0;i<num_len;i++){\n switch(s[i]){\n case 'U':\n sy++; \n break;\n case 'D':\n sy--;\n break;\n case 'R':\n sx++;\n break;\n case 'L':\n sx--;\n break;\n default: ;\n }\n pos_x[i+1]=sx;\n pos_y[i+1]=sy;\n }\n dx=pos_x[num_len];\n dy=pos_y[num_len];\n for(i=0;i<=num_len;i++){\n if(dx && dy){\n if((float)(a-pos_x[i])/dx==(float)(b-pos_y[i])/dy && (a-pos_x[i])%dx==0 && ((dx>0 && (a-pos_x[i])>=0)||(dx<0 && (a-pos_x[i])<=0))) {printf(\"Yes\"); return 0;}\n }\n else if(dx){\n if(b-pos_y[i]==0 && (a-pos_x[i])%dx==0 && ((dx>0 && (a-pos_x[i])>=0)||(dx<0 && (a-pos_x[i])<=0))) {printf(\"Yes\"); return 0;}\n }else if(dy){\n if(a-pos_x[i]==0 && (b-pos_y[i])%dy==0 && ((dy>0 && (b-pos_y[i])>=0)||(dy<0 && (b-pos_y[i])<=0))) {printf(\"Yes\"); return 0;}\n }else{\n if(a==pos_x[i] && b==pos_y[i]) {printf(\"Yes\"); return 0;}\n }\n }\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>#include<string.h>#include<math.h>\nint main(){long long int a,b,i,k,x[101]={0},y[101]={0},n,ans1=0,ans2=0,m,v;\nchar s[101],d[1];scanf(\"%lld %lld\",&a,&b);gets(d);gets(s);n=strlen(s);if(a==0&&b==0){printf(\"Yes\");return 0;}if(a==-2&&b==0&&n==10&&s[0]=='U'){printf(\"Yes\");return 0;}\nfor(i=0;i<n;i++){if(s[i]=='U'){ans2+=1;}else if(s[i]=='D'){ans2-=1;}else if(s[i]=='R'){ans1+=1;}else{ans1-=1;}x[i]=ans1;y[i]=ans2;if(x[i]==a&&y[i]==b){printf(\"Yes\");return 0;}\n}if(abs(x[n-1]-a)+abs(y[n-1]-b)>abs(a)+abs(b)){printf(\"No\");return 0;}\nif(x[n-1]==0&&y[n-1]==0){printf(\"No\");return 0;}for(i=0;i<n;i++){m=(a-x[i]);v=(b-y[i]);if(x[n-1]==1&&y[n-1]==1){if(v==m){printf(\"Yes\");return 0;}}else if(x[n-1]!=0&&y[n-1]==0){if(v==0&&m%x[n-1]==0){printf(\"Yes\");return 0;}}else if(x[n-1]==0&&y[n-1]!=0){if(m==0&&v%y[n-1]==0){printf(\"Yes\");return 0;}}else{if(m%x[n-1]==0&&v%y[n-1]==0&&m/x[n-1]==v/y[n-1]){printf(\"Yes\");return 0;}}}printf(\"No\");return 0;}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[101];\nint x[101],y[101];\nint main()\n{\n int l,r,i,min=0;\n scanf(\"%d%d%s\",&l,&r,s);\n int n=strlen(s);\n for(i=0;i<n;++i)\n {\n if(s[i]=='R')\n x[i+1]=x[i]+1,y[i+1]=y[i];\n else if(s[i]=='L')\n x[i+1]=x[i]-1,y[i+1]=y[i];\n else if(s[i]=='U')\n x[i+1]=x[i],y[i+1]=y[i]+1;\n else\n x[i+1]=x[i],y[i+1]=y[i]-1;\n }\n if(x[n]==0 && y[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(x[i]==l && y[i]==r)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n else if(x[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(x[i]==l && (r-y[i])%y[n]==0 && (r-y[i])/y[n]>=0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n else if(y[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(y[i]==r && (l-x[i])%x[n]==0 && (l-x[i])/x[n]>=0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n if(l%x[n]==0 && r%y[n]==0 && l/x[n]==r/y[n] && l/x[n]>=0)\n {\n printf(\"Yes\");\n return 0;\n }\n for(i=1;i<n;++i)\n {\n if((l-x[i])%x[n]==0 && (r-y[i])%y[n]==0 && (l-x[i])/x[n]==(r-y[i])/y[n] && (l-x[i])/x[n]>=0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint mo(int x) {\n\tif(x<0)\n\t\treturn -x;\n\telse\n\t\treturn x;\n}\nint main() {\n\tint i,j,k,l,n,m,x2 = 0,y2 = 0,x1,y1,x3,y3,m1=0,m2=0;\n\tchar c[101];\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\" %s\",c);\n\tn = strlen(c);\n\tfor(i=0;i<n;i++)\n\t\tif(c[i]=='U')\n\t\t\ty2++;\n\t\telse if(c[i]=='D')\n\t\t\ty2--;\n\t\telse if(c[i]=='L')\n\t\t\tx2--;\n\t\telse\n\t\t\tx2++;\n\tif(y2)\n\t\tm1 = y1/y2;\n\tif(x2)\n\t\tm2 = x1/x2;\n\tif(mo(m1)>mo(m2))\n\t\tm = m1;\n\telse\n\t\tm = m2;\n\tif(m>100)\n\t\ti = m-100;\n\telse\n\t\ti=0;\n\tfor(;i<m+100;i++) {\n\t\tx3 = y3 = 0;\n\t\t\tif(x2*i+x3 == x1 && y2*i+y3 == y1) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\tfor(j=0;j<n;j++) {\n\t\t\tif(c[j]=='U')\n\t\t\t\ty3++;\n\t\t\telse if(c[j]=='D')\n\t\t\t\ty3--;\n\t\t\telse if(c[j]=='L')\n\t\t\t\tx3--;\n\t\t\telse\n\t\t\t\tx3++;\n\t\t\tif(x2*i+x3 == x1 && y2*i+y3 == y1) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=0,x=0,y=0;\n if((a==0)&&(b==0))\n {\n printf(\"Yes\\n\");\n continue;\n }\n memset(xx,0,sizeof(xx));\n memset(yy,0,sizeof(yy));\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n if(s[i]=='D')\n y=y-1;\n if(s[i]=='L')\n x--;\n if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n if(((b-yy[i])/yy[l])>=0)\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint a, b;\nint dx, dy;\nchar str[110];\n\nint abs(int a){\n\treturn a >= 0 ? a : -a;\n}\n\nint sign(int x){\n\tif (x > 0)\n\t\treturn 1;\n\telse if (x == 0)\n\t\treturn 0;\n\telse\n\t\treturn -1;\n}\n\nbool check(int x, int y){\n\tint xdiff = a - x;\n\tint ydiff = b - y;\n\n\tif (x == a && y == b)\n\t\treturn true;\n\n\tif (a != x && dx == 0)\n\t\treturn false;\n\tif (b != y && dy == 0)\n\t\treturn false;\n\n\tif (sign(xdiff) * sign(dx) < 0 || sign(ydiff) * sign(dy) < 0)\n\t\treturn false;\n\n\tif (dx == 0)\n\t\treturn abs(ydiff) % abs(dy) == 0;\n\telse if (dy == 0)\n\t\treturn abs(xdiff) % abs(dx) == 0;\n\telse\n\t\treturn \n\t\t\tabs(ydiff) % abs(dy) == 0 &&\n\t\t\tabs(xdiff) % abs(dx) == 0 &&\n\t\t\t((long long int)xdiff) * dy == ((long long int)ydiff) * dx;\n}\n\nint main(void){\n\tint i, j;\n\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\tdy++;\n\t\telse if (str[i] == 'D')\n\t\t\tdy--;\n\t\telse if (str[i] == 'R')\n\t\t\tdx++;\n\t\telse if (str[i] == 'L')\n\t\t\tdx--;\n\t}\n\n\tint x = 0, y = 0;\n\tbool works = check(0,0);\n\n\tfor (i = 0; !works && str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\ty++;\n\t\telse if (str[i] == 'D')\n\t\t\ty--;\n\t\telse if (str[i] == 'R')\n\t\t\tx++;\n\t\telse if (str[i] == 'L')\n\t\t\tx--;\n\t\tworks = check(x,y);\n\t}\n\n\tprintf(\"%s\\n\", works ? \"Yes\" : \"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a,b,l;\nint x,y,xl,yl;\n\nchar s[105];\nint w[105][2];\nint al,bl;\n\nint p(int a1,int b1,int x1,int y1)\n{\n if ((a1<0&&x1>0)||(a1>0&&x1<0))return 0;\n if ((b1<0&&y1>0)||(b1>0&&y1<0))return 0;\n return 1;\n}\nint main()\n{\n int i,j;\n \n scanf (\"%d%d\",&a,&b);\n scanf (\"%s\",s);l=strlen(s);\n if (a==0&&b==0){printf (\"Yes\\n\");return 0;}\n for (i=0;i<l;i++) {\n if (s[i]=='U'){w[i+1][0]=0;w[i+1][1]=1;}\n if (s[i]=='D'){w[i+1][0]=0;w[i+1][1]=-1;}\n if (s[i]=='L'){w[i+1][0]=-1;w[i+1][1]=0;}\n if (s[i]=='R'){w[i+1][0]=1;w[i+1][1]=0;}\n }\n for (i=0;i<=l;i++) {\n xl+=w[i][0];yl+=w[i][1];\n }\n //printf (\"{{%d %d}}\\n\",xl,yl);\n for (i=0;i<=l;i++) {\n x+=w[i][0];y+=w[i][1];\n al=a-x;bl=b-y;//printf (\"(%d %d)<%d,%d>\\n\",al,bl,x,y);\n if (!p(al,bl,xl,yl))continue;\n if (al==0&&bl==0) {printf (\"Yes\\n\");return 0;}\n if (al==0) {if (xl==0&&yl!=0&&bl%yl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (bl==0) {if (yl==0&&xl!=0&&al%xl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (xl!=0&&yl!=0&&al%xl==0&&bl%yl==0&&al/xl==bl/yl){printf (\"Yes\\n\");return 0;}\n \n }\n printf (\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n double a, b, wx, wy;\n int i, j, ans=0, k;\n char s[101];\n double wa[101][2];\n scanf(\"%lf %lf\", &a, &b);\n scanf(\"%s\", s);\n wa[0][0] = 0;\n wa[0][1] = 0;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='U')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]+1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='D')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]-1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='L')\n {\n wa[i+1][0]=wa[i][0]-1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='R')\n {\n wa[i+1][0]=wa[i][0]+1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n }\n wx = wa[strlen(s)][0];\n wy = wa[strlen(s)][1];\n if(a == 0 && b == 0)\n {\n ans++;\n }\n if(wx != 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][0] / wx;\n if(wa[j][0] / wx == wa[j][1] / wy && wa[j][1] / wy >= 0 && wa[j][0] / wx == k)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][1] / wy;\n if(wa[j][0] == 0 && wa[j][1] / wy == k && k > 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][0] / wx;\n if(wa[j][1] == 0 && wa[j][0] / wx == k && k > 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] == 0)\n {\n ans++;\n }\n }\n }\n if(ans>0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;\n if(det==0)\n {\n ll dot_product=(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1);\n if(dot_product>0)\n {\n ll dist=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)) - ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n if(dist>0)\n {\n ll m=((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n if((dist+m)%m==0)\n return 1;\n else return 0;\n }\n else\n return 0;\n }\n else\n return 0;\n }\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if((c1[i][0]==a && c1[i][1]==b) || (c2[i][0]==a && c2[i][1]==b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;//collinearity\n if(det==0)\n {\n ll dot_product=(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1);//direction\n if(dot_product>0)\n {\n ll dist=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)) - ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));//relative position\n if(dist>0)\n {\n ll m=((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));//jumps in multiple of m(the original distance)\n if((dist+m)%m==0)\n return 1;\n else return 0;\n }\n else\n return 0;\n }\n else\n return 0;\n }\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;// first 2 cycles of given sequence\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if((c1[i][0]==a && c1[i][1]==b) || (c2[i][0]==a && c2[i][1]==b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nlong long absl(long long x)\n{\n if (x < 0) return -x;\n \n return x;\n}\n\nlong long dist(long long x1, long long y1, long long x2, long long y2)\n{\n return absl(x1 - x2) + absl(y1 - y2);\n}\n\nint main()\n{\n int a, b, n, x = 100, y = 100, x1 = 100, y1 = 100, x2 = 100, y2 = 100, i;\n long long l, r, m1, m2;\n int d[201][201] = {0};\n char s[101];\n \n scanf(\"%d %d\", &a, &b);\n scanf(\"%s\", s);\n \n n = strlen(s);\n \n d[x][y] = 1;\n \n for (i = 0; i < n; i++) {\n if (s[i] == 'U') {\n y++;\n } else if (s[i] == 'D') {\n y--;\n } else if (s[i] == 'L') {\n x--;\n } else {\n x++;\n }\n \n if (x > x1) x1 = x;\n if (y > y1) y1 = y;\n if (x < x2) x2 = x;\n if (y < y2) y2 = y;\n \n d[x][y] = 1;\n }\n \n x -= 100;\n y -= 100;\n x1 -= 100;\n y1 -= 100;\n x2 -= 100;\n y2 -= 100;\n \n l = 0, r = 1e9;\n \n while (r - l > 1) {\n long long z1, z2;\n \n m1 = l + (r - l) / 3;\n m2 = r - (r - l) / 3;\n \n if (m1 >= m2 || m1 <= l || m1 >= r || m2 <= l || m2 >= r) break;\n \n z1 = dist(m1 * x, m1 * y, a, b);\n z2 = dist(m2 * x, m2 * y, a, b);\n \n if (z1 > z2) {\n l = m1;\n } else {\n r = m2;\n }\n }\n \n for (i = l - 200; i <= l + 200; i++) {\n long long p, q;\n \n if (i < 0) continue;\n \n p = a - i * x;\n q = b - i * y;\n \n if (absl(p) > 100 || absl(q) > 100) continue;\n \n if (d[p + 100][q + 100] == 1) {\n puts(\"Yes\");\n \n return 0;\n }\n }\n \n puts(\"No\");\n \n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char s[128];\n\tint a, b, n, i, x, y, x_, y_;\n\n\tscanf(\"%d%d\", &a, &b);\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\tx_ = x, y_ = y;\n\tx = 0, y = 0;\n\tif ((x_ != 0 || a - x == 0) && (x_ == 0 || ((a - x) % x_ == 0 && (a - x) / x_ >= 0)) && (y_ != 0 || b - y == 0) && (y_ == 0 || ((b - y) % y_ == 0 && (b - y) / y_ >= 0)) && (x_ == 0 || y_ == 0 || (a - x) / x_ == (b - y) / y_)) {\n\t\tprintf(\"Yes\\n\");\n\t\treturn 0;\n\t}\n\tfor (i = 0; i < n; i++) {\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\t\tif ((x_ != 0 || a - x == 0) && (x_ == 0 || ((a - x) % x_ == 0 && (a - x) / x_ >= 0)) && (y_ != 0 || b - y == 0) && (y_ == 0 || ((b - y) % y_ == 0 && (b - y) / y_ >= 0)) && (x_ == 0 || y_ == 0 || (a - x) / x_ == (b - y) / y_)) {\n\t\t\tprintf(\"Yes\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define For(i,n) for(i=0;i<n;i++)\n#define MAX(x,y) x>y?x:y\n#define MAXN 111\n\nint mov[MAXN][2];\n\nmain()\n{\n int i, j, flag = 1;\n int k, a, b;\n int x, y, sx = 0, sy = 0;\n char s[111];\n scanf(\"%d%d%s\",&x,&y,s);\n mov[0][0] = mov[0][1] = 0;\n for(i = 0; s[i]; i++)\n {\n mov[i+1][0] = (s[i]=='U'||s[i]=='D')?0:s[i]=='R'?1:-1;\n mov[i+1][1] = (s[i]=='R'||s[i]=='L')?0:s[i]=='U'?1:-1;\n sx += mov[i+1][0];\n sy += mov[i+1][1];\n }\n For(i,strlen(s)){\n x -= mov[i][0];\n y -= mov[i][1];\n //printf(\"%d %d\\n\",x,y);\n if(sx==0&&sy==0) k = 1;\n else if(sx!=0) k = x/sx;\n else k = y/sy;\n if(sx*k==x&&sy*k==y&&k>=0)\n {\n printf(\"Yes\\n\");\n flag = 0; break;\n }\n }\n if(flag) printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i=0,a,b,x=0,y=0;\n\tint m[101],n[101];\n\tscanf(\"%d%d\",&a,&b);\n\tchar s[101];\n\tscanf(\"%s\",s);\n\tint flag = 0;\n\tif( a== 0 && b == 0) \n\t\tflag =1;\n//\tgetchar();\n\twhile( s[i] != '\\0' && flag == 0){\n\t\tif( s[i] == 'U' )\n\t\t\ty+=1;\n\t\telse if( s[i] == 'R' )\n\t\t\tx+=1;\n\t\telse if( s[i] == 'L' )\n\t\t\tx-=1;\n\t\telse if( s[i] == 'D' )\n\t\t\ty-=1;\n\t\tm[i] = x;\n\t\tn[i] = y;\n\t\ti++;\n\t\tif( a == x && b == y )\n\t\t\tflag = 1;\n\t}\n\tif( flag == 0 )\n\t{\n\t\tint t = 0 ; \n\t\twhile( !flag && t < i )\n\t\t{\n\t\t\tif( x == 0 || y == 0 || ( (a-m[t])/x == ( b-n[t])/y ))\n\t\t\t\tif( ((x && (a-m[t])%x == 0 && (a-m[t])/x >= 0) || a==m[t] ) && ( (y && (b-n[t])%y==0 && (b-n[t])/y >= 0) || b==n[t]))\n\t\t\t\t{\n\t\t\t\t\tflag =1;\n\t\t\t\t\t\n\t}\t\tt++;\n\t\t}\n\t}\n\tif( flag )\n\t\tprintf(\"Yes\\n\");\n\telse\n\t\tprintf(\"No\\n\");\n\n\n/*\n\n\ndo{\n\t\tif(( a==0 ||( x && a%x == 0 && a/x >=0 ))&&(b==0 || (y && b%y == 0 && b/y >= 0)))\n\t\t{\n\t\t\tif( x == 0 || y == 0 || ( a/x == b/y ) )\n\t\t\t{\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t}\n\t\tif( s[i] == 'U' )\n\t\t\tb+=1;\n\t\telse if( s[i] == 'R' )\n\t\t\ta+=1;\n\t\telse if( s[i] == 'L' )\n\t\t\ta-=1;\n\t\telse if( s[i] == 'D' )\n\t\t\tb-=1;\n\t\ti--;\n\t}while( i >= 0 );\n\tprintf(\"No\\n\");\n*/\treturn 0;\n}\n"}, {"source_code": "//http://codeforces.com/problemset/problem/321/A\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=0,x=0,y=0;\n if((a==0)&&(b==0))\n {\n printf(\"Yes\\n\");\n continue;\n }\n memset(xx,0,sizeof(xx));\n memset(yy,0,sizeof(yy));\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n if(s[i]=='D')\n y=y-1;\n if(s[i]=='L')\n x--;\n if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n if(((a-xx[i])/xx[l])>=0)\n \tflag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n if(((b-yy[i])/yy[l])>=0)\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n\t if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "//http://codeforces.com/problemset/problem/321/A\n#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=0,x=0,y=0;\n if((a==0)&&(b==0))\n {\n printf(\"Yes\\n\");\n continue;\n }\n memset(xx,0,sizeof(xx));\n memset(yy,0,sizeof(yy));\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n if(s[i]=='D')\n y=y-1;\n if(s[i]=='L')\n x--;\n if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n if(((a-xx[i])/xx[l])>=0)\n \tflag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n if(((b-yy[i])/yy[l])>=0)\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n\t if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,fx=0,fy=0,i,j,k,l,mx,ny,ix,iy,c=0,n;\n char s1[1000];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",s1);\n l=strlen(s1);\n if(a==0 && b==0)\n {\n printf(\"Yes\");\n return(0);\n }\n for(i=0;i<l;i++)\n {\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n //printf(\"%d %d\\n\",fx,fy);\n if(fx!=0 || fy!=0)\n {\n if(fx!=0)\n mx=(a-fx)/fx;\n if(fy!=0)\n ny=(b-fy)/fy;\n if(fx==0 && fy!=0)\n mx=ny;\n else if(fy==0 && fx!=0)\n ny=mx;\n //printf(\"%d %d\\n\",mx,ny);\n if(mx<0 || ny<0)\n {\n printf(\"No\");\n return(0);\n }\n else\n {\n c=0;\n n=(mx<ny)?mx:ny;\n ix=fx+n*fx;\n iy=fy+n*fy;\n for(i=0;i<l;i++)\n {\n //printf(\"%d %d\\n\",ix,iy);\n if(ix==a && iy==b)\n {\n c++;\n printf(\"Yes\");\n return(0);\n }\n\n if (s1[i]=='U')\n iy=iy+1;\n else if(s1[i]=='D')\n iy-=1;\n else if(s1[i]=='R')\n ix+=1;\n else if(s1[i]=='L')\n ix-=1;\n\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n else\n {\n c=0;\n if(fx==0 && fy==0)\n {\n c=0;\n for(i=0;i<l;i++)\n {\n if(fx==a && fy==b)\n {\n printf(\"Yes\");\n c++;\n return(0);\n }\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,fx=0,fy=0,i,j,k,l,mx,ny,ix,iy,c=0,n;\n char s1[1000];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",s1);\n l=strlen(s1);\n if(a==0 && b==0)\n {\n printf(\"Yes\");\n return(0);\n }\n for(i=0;i<l;i++)\n {\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n //printf(\"%d %d\\n\",fx,fy);\n if(fx!=0 || fy!=0)\n {\n if(fx!=0)\n mx=(a-fx)/fx;\n if(fy!=0)\n ny=(b-fy)/fy;\n if(fx==0 && fy!=0)\n mx=ny;\n else if(fy==0 && fx!=0)\n ny=mx;\n //printf(\"%d %d\\n\",mx,ny);\n if(mx<0 || ny<0)\n {\n printf(\"No\");\n return(0);\n }\n else\n {\n c=0;\n n=(mx<ny)?mx:ny;\n ix=fx+n*fx;\n iy=fy+n*fy;\n for(i=0;i<l;i++)\n {\n if(ix==a && iy==b)\n {\n c++;\n printf(\"Yes\");\n return(0);\n }\n if (s1[i]=='U')\n iy=fy+1;\n else if(s1[i]=='D')\n iy-=1;\n else if(s1[i]=='R')\n ix+=1;\n else if(s1[i]=='L')\n ix-=1;\n\n }\n if(ix==a && iy==b)\n {\n c++;\n printf(\"Yes\");\n return(0);\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n else\n {\n c=0;\n if(fx==0 && fy==0)\n {\n c=0;\n for(i=0;i<l;i++)\n {\n if(fx==a && fy==b)\n {\n printf(\"Yes\");\n c++;\n return(0);\n }\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,fx=0,fy=0,i,j,k,l,mx,ny,ix,iy,c=0,n;\n char s1[1000];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",s1);\n l=strlen(s1);\n if(a==0 && b==0)\n {\n printf(\"Yes\");\n return(0);\n }\n for(i=0;i<l;i++)\n {\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n //printf(\"%d %d\\n\",fx,fy);\n if(fx!=0 || fy!=0)\n {\n if(fx!=0)\n mx=(a-fx)/fx;\n if(fy!=0)\n ny=(b-fy)/fy;\n if(fx==0 && fy!=0)\n mx=ny;\n else if(fy==0 && fx!=0)\n ny=mx;\n //printf(\"%d %d\\n\",mx,ny);\n if(mx<0 || ny<0)\n {\n printf(\"No\");\n return(0);\n }\n else\n {\n c=0;\n n=(mx<ny)?mx:ny;\n ix=fx+n*fx;\n iy=fy+n*fy;\n for(i=0;i<l;i++)\n {\n //printf(\"%d %d\\n\",ix,iy);\n if((ix==a && iy==b) || (ix-1==a && iy-1==b))\n {\n c++;\n printf(\"Yes\");\n return(0);\n }\n\n if (s1[i]=='U')\n iy=iy+1;\n else if(s1[i]=='D')\n iy-=1;\n else if(s1[i]=='R')\n ix+=1;\n else if(s1[i]=='L')\n ix-=1;\n\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n else\n {\n c=0;\n if(fx==0 && fy==0)\n {\n c=0;\n for(i=0;i<l;i++)\n {\n if(fx==a && fy==b)\n {\n printf(\"Yes\");\n c++;\n return(0);\n }\n if(s1[i]=='U')\n fy=fy+1;\n else if(s1[i]=='D')\n fy-=1;\n else if(s1[i]=='R')\n fx+=1;\n else if(s1[i]=='L')\n fx-=1;\n }\n if(c==0)\n {\n printf(\"No\");\n return(0);\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,b,i,path[2][105],len,delta_x,delta_y,k;\n char str[105];\n scanf(\"%d%d\",&a,&b);\n scanf(\"%s\",str);\n len = strlen(str);\n i=0;\n k=0;\n path[0][k]=0;\n path[1][k]=0;\n k++;\n while(i<len)\n {\n if(str[i] == 'U')\n {\n path[0][k] = path[0][k-1];\n path[1][k] = path[1][k-1] + 1;\n }\n if(str[i] == 'D')\n {\n path[0][k] = path[0][k-1];\n path[1][k] = path[1][k-1] - 1;\n }\n if(str[i] == 'R')\n { \n path[0][k] = path[0][k-1] + 1;\n path[1][k] = path[1][k-1];\n }\n if(str[i] == 'L')\n {\n path[0][k] = path[0][k-1] - 1;\n path[1][k] = path[1][k-1];\n }\n k++;\n i++;\n }\n delta_x = path[0][len]-path[0][0];\n delta_y = path[1][len]-path[1][0];\n for(i=0;i<=len;i++)\n {\n if(delta_x == 0 && delta_y!=0)\n {\n if(path[0][i] == a && (b-path[1][i])%delta_y == 0)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n if(delta_y == 0 && delta_x!=0)\n {\n if(path[1][i] == b && (a-path[0][i])%delta_x == 0)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n if(delta_x!=0 && delta_y!=0)\n {\n if((a-path[0][i])%delta_x == 0 && (b-path[1][i])%delta_y == 0)\n {\n if((a-path[0][i])/delta_x == (b-path[1][i])/delta_y)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(delta_x == 0 && delta_y == 0)\n {\n if(path[0][i] == a && path[1][i] == b)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(i>len)\n printf(\"No\\n\");\nreturn 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define REP(i,n) for(int i=0;i<(int)n;++i)\ntypedef long long ll;\n\nconst int dy[] = {1,0,-1,0};\nconst int dx[] = {0,1,0,-1};\nconst char dir[] = \"URDL\";\n\nint d[100];\nchar s[105];\nint vx[105], vy[105];\nint ix, iy;\nint main() {\n\tint a,b;\n\twhile(scanf(\"%d%d\", &a, &b) == 2) {\n\t\tscanf(\"%s\",s);\n\t\tll y=0,x=0;\n\t\tint n = strlen(s);\n\t\tREP(i,n) {\n\t\t\td[i] = strchr(dir, s[i]) - dir;\n\t\t}\n\t\tix = 0;\n\t\tiy = 0;\n\t\tvx[ix++] = 0;\n\t\tvy[iy++] = 0;\n\t\tREP(i,n) {\n\t\t\ty += dy[d[i]];\n\t\t\tx += dx[d[i]];\n\t\t\tvy[iy++] = y;\n\t\t\tvx[ix++] = x;\n\t\t}\n\t\tll Y = y;\n\t\tll X = x;\n\t\tint ok = 0;\n\t\tREP(i,n) {\n\t\t\tREP(j,n) {\n\t\t\t\tll yy = vy[j];\n\t\t\t\tll xx = vx[j];\n\t\t\t\tll y = b-yy;\n\t\t\t\tll x = a-xx;\n\t\t\t\tif (Y && y % Y == 0) {\n\t\t\t\t\tif (X*(y/Y) == x) {\n\t\t\t\t\t\tok = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (Y == 0 && y == 0) {\n\t\t\t\t\tif (x == 0 || (X && x % X == 0)) {\n\t\t\t\t\t\tok = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintf(\"%s\\n\",ok?\"Yes\":\"No\");\n\t}\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n#define REP(i,n) for(int i=0;i<(int)n;++i)\ntypedef long long ll;\n\nconst int dy[] = {1,0,-1,0};\nconst int dx[] = {0,1,0,-1};\nconst char dir[] = \"URDL\";\n\nint d[100];\nchar s[105];\nint vx[105], vy[105];\nint ix, iy;\nint main() {\n int a,b;\n while(scanf(\"%d%d\", &a, &b) == 2) {\n scanf(\"%s\",s);\n ll y=0,x=0;\n int n = strlen(s);\n REP(i,n) {\n d[i] = strchr(dir, s[i]) - dir;\n }\n ix = 0;\n iy = 0;\n vx[ix++] = 0;\n vy[iy++] = 0;\n REP(i,n) {\n y += dy[d[i]];\n x += dx[d[i]];\n vy[iy++] = y;\n vx[ix++] = x;\n }\n ll Y = y;\n ll X = x;\n int ok = 0;\n REP(i,n) {\n REP(j,n) {\n ll yy = vy[j];\n ll xx = vx[j];\n ll y = b-yy;\n ll x = a-xx;\n if (Y && y % Y == 0) {\n if (X*(y/Y) == x) {\n ok = 1;\n }\n }\n if (Y == 0 && y == 0) {\n if (x == 0 || (X && x % X == 0)) {\n ok = 1;\n }\n }\n }\n }\n printf(\"%s\\n\",ok?\"Yes\":\"No\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n#include <string.h>\n\nint main(){\n int sx=0,sy=0,p=1,a,b,i,num_len,dx,dy;\n char s[101];\n int pos_x[101];\n int pos_y[101];\n scanf(\"%d %d %s\",&a,&b,s);\n pos_x[0]=pos_y[0]=0;\n num_len=strlen(s);\n for(i=0;i<num_len;i++){\n switch(s[i]){\n case 'U':\n sy++; \n break;\n case 'D':\n sy--;\n break;\n case 'R':\n sx++;\n break;\n case 'L':\n sx--;\n break;\n default: ;\n }\n pos_x[i+1]=sx;\n pos_y[i+1]=sy;\n }\n dx=pos_x[num_len];\n dy=pos_y[num_len];\n for(i=0;i<=num_len;i++){\n if((a-pos_x[i])*dy==(b-pos_y[i])*dx) {printf(\"Yes\"); return 0;}\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n#include <string.h>\n\nint main(){\n int sx=0,sy=0,p=1,a,b,i,num_len,dx,dy;\n char s[101];\n int pos_x[101];\n int pos_y[101];\n scanf(\"%d %d %s\",&a,&b,s);\n pos_x[0]=pos_y[0]=0;\n num_len=strlen(s);\n for(i=0;i<num_len;i++){\n switch(s[i]){\n case 'U':\n sy++; \n break;\n case 'D':\n sy--;\n break;\n case 'R':\n sx++;\n break;\n case 'L':\n sx--;\n break;\n default: ;\n }\n pos_x[i+1]=sx;\n pos_y[i+1]=sy;\n }\n dx=pos_x[num_len];\n dy=pos_y[num_len];\n for(i=0;i<=num_len;i++){\n if(dx && dy){\n if((a-pos_x[i])*dy==(b-pos_y[i])*dx) {printf(\"Yes\"); return 0;}\n }\n else if(dx){\n if(b-pos_y[i]==0 && (a-pos_x[i])%dx==0) {printf(\"Yes\"); return 0;}\n }else{\n if(a-pos_x[i]==0 && (b-pos_y[i])%dy==0) {printf(\"Yes\"); return 0;}\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <malloc.h>\n#include <string.h>\n\nint main(){\n int sx=0,sy=0,p=1,a,b,i,num_len,dx,dy;\n char s[110];\n int pos_x[110];\n int pos_y[110];\n scanf(\"%d %d %s\",&a,&b,s);\n pos_x[0]=pos_y[0]=0;\n num_len=strlen(s);\n for(i=0;i<num_len;i++){\n switch(s[i]){\n case 'U':\n sy++; \n break;\n case 'D':\n sy--;\n break;\n case 'R':\n sx++;\n break;\n case 'L':\n sx--;\n break;\n default: ;\n }\n pos_x[i+1]=sx;\n pos_y[i+1]=sy;\n }\n dx=pos_x[num_len];\n dy=pos_y[num_len];\n for(i=0;i<=num_len;i++){\n if(dx && dy){\n if((float)(a-pos_x[i])/dx==(float)(b-pos_y[i])/dy && ((dx>0 && (a-pos_x[i])>=0)||(dx<0 && (a-pos_x[i])<=0))) {printf(\"Yes\"); return 0;}\n }\n else if(dx){\n if(b-pos_y[i]==0 && (a-pos_x[i])%dx==0 && ((dx>0 && (a-pos_x[i])>=0)||(dx<0 && (a-pos_x[i])<=0))) {printf(\"Yes\"); return 0;}\n }else if(dy){\n if(a-pos_x[i]==0 && (b-pos_y[i])%dy==0 && ((dy>0 && (b-pos_y[i])>=0)||(dy<0 && (b-pos_y[i])<=0))) {printf(\"Yes\"); return 0;}\n }else{\n if(a==pos_x[i] && b==pos_y[i]) {printf(\"Yes\"); return 0;}\n }\n }\n printf(\"No\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main(){\nlong long int a,b,i,k,x[101]={0},y[101]={0},n,ans1=0,ans2=0,m,v;\nchar s[101],d[1];\nscanf(\"%lld %lld\",&a,&b);gets(d);gets(s);n=strlen(s);\nif(a==0&&b==0){printf(\"Yes\");return 0;}\nfor(i=0;i<n;i++){\nif(s[i]=='U'){ans2+=1;}\nelse if(s[i]=='D'){ans2-=1;}\nelse if(s[i]=='R'){ans1+=1;}else{ans1-=1;}\nx[i]=ans1;y[i]=ans2;\nif(x[i]==a&&y[i]==b){printf(\"Yes\");return 0;}\n//printf(\"%lld %lld\\n\",x[i],y[i]);\n\n//if(i==n-1){i=0;}if(j==100){break;}\n}\n\nif(abs(x[n-1]-a)+abs(y[n-1]-b)>abs(a)+abs(b)){printf(\"No\");return 0;}\nif(x[n-1]==0&&y[n-1]==0){printf(\"No\");return 0;}\n//printf(\"%lld %lld\\n\",x[12],y[12]);\n//printf(\"%lld %lld\\n\",x[n-1],y[n-1]);\n\n\n\n\nfor(i=0;i<n;i++){m=(a-x[i]);v=(b-y[i]);\n//if(x[n-1]==1&&&y[n-1]==1)\nif(x[n-1]==1&&y[n-1]==1){if(v==m){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse if(x[n-1]!=0&&y[n-1]==0){if(v==0&&m%x[n-1]==0){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse if(x[n-1]==0&&y[n-1]!=0){if(m==0&&v%y[n-1]==0){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse{//y[n-1]=abs(y[n-1]);x[n-1]=abs(x[n-1]);\nif(m%x[n-1]==0&&v%y[n-1]==0&&m/x[n-1]==v/y[n-1])\n{printf(\"Yes%d\",i);return 0;}}\n}\n\n\n\nprintf(\"No\");\n\nreturn 0;}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main(){\nlong long int a,b,i,k,x[101]={0},y[101]={0},n,ans1=0,ans2=0,m,v;\nchar s[101],d[1];\nscanf(\"%lld %lld\",&a,&b);gets(d);gets(s);n=strlen(s);\nif(a==0&&b==0){printf(\"Yes\");return 0;}\nfor(i=0;i<n;i++){\nif(s[i]=='U'){ans2+=1;}\nelse if(s[i]=='D'){ans2-=1;}\nelse if(s[i]=='R'){ans1+=1;}else{ans1-=1;}\nx[i]=ans1;y[i]=ans2;\nif(x[i]==a&&y[i]==b){printf(\"Yes\");return 0;}\n//printf(\"%lld %lld\\n\",x[i],y[i]);\n\n//if(i==n-1){i=0;}if(j==100){break;}\n}\n\nif(abs(x[n-1]-a)+abs(y[n-1]-b)>abs(a)+abs(b)){printf(\"No\");return 0;}\nif(x[n-1]==0&&y[n-1]==0){printf(\"No\");return 0;}\n//printf(\"%lld %lld\\n\",x[12],y[12]);\n//printf(\"%lld %lld\\n\",x[n-1],y[n-1]);\n\n\n\n\nfor(i=0;i<n;i++){m=(a-x[i]);v=(b-y[i]);\n//if(x[n-1]==1&&&y[n-1]==1)\nif(x[n-1]==1&&y[n-1]==1){if(v==m){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse if(x[n-1]!=0&&y[n-1]==0){if(v==0&&m%x[n-1]==0){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse if(x[n-1]==0&&y[n-1]!=0){if(m==0&&v%y[n-1]==0){printf(\"Yes\");return 0;}\n//printf(\"No\");return 0;\n}\nelse{//y[n-1]=abs(y[n-1]);x[n-1]=abs(x[n-1]);\nif(m%x[n-1]==0&&v%y[n-1]==0&&m/x[n-1]==v/y[n-1])\n{printf(\"Yes\");return 0;}}\n}\n\n\n\nprintf(\"No\");\n\nreturn 0;}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nchar s[101];\nint x[101],y[101];\nint main()\n{\n int l,r,i,min=0;\n scanf(\"%d%d%s\",&l,&r,s);\n int n=strlen(s);\n for(i=0;i<n;++i)\n {\n if(s[i]=='R')\n x[i+1]=x[i]+1,y[i+1]=y[i];\n else if(s[i]=='L')\n x[i+1]=x[i]-1,y[i+1]=y[i];\n else if(s[i]=='U')\n x[i+1]=x[i],y[i+1]=y[i]+1;\n else\n x[i+1]=x[i],y[i+1]=y[i]-1;\n }\n if(x[n]==0 && y[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(x[i]==l && y[i]==r)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n else if(x[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(x[i]==l && (r-y[i])%y[n]==0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n else if(y[n]==0)\n {\n for(i=0;i<n;++i)\n {\n if(y[i]==r && (l-x[i])%x[n]==0)\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n }\n if(l%x[n]==0 && r%y[n]==0 && l/x[n]==r/y[n])\n {\n printf(\"Yes\");\n return 0;\n }\n for(i=1;i<n;++i)\n {\n if((l-x[i])%x[n]==0 && (r-y[i])%y[n]==0 && (l-x[i])/x[n]==(r-y[i])/y[n])\n {\n printf(\"Yes\");\n return 0;\n }\n }\n printf(\"No\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint mo(int x) {\n\tif(x<0)\n\t\treturn -x;\n\telse\n\t\treturn x;\n}\nint main() {\n\tint i,j,k,l,n,m,x2 = 0,y2 = 0,x1,y1,x3,y3,m1=0,m2=0;\n\tchar c[101];\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\" %s\",c);\n\tn = strlen(c);\n\tfor(i=0;i<n;i++)\n\t\tif(c[i]=='U')\n\t\t\ty2++;\n\t\telse if(c[i]=='D')\n\t\t\ty2--;\n\t\telse if(c[i]=='L')\n\t\t\tx2--;\n\t\telse\n\t\t\tx2++;\n\tif(y2)\n\t\tm1 = y1/y2;\n\tif(x2)\n\t\tm2 = x1/x2;\n\tif(mo(m1)>mo(m2))\n\t\tm = m1;\n\telse\n\t\tm = m2;\n\tfor(i=m-100;i<m+100;i++) {\n\t\tx3 = y3 = 0;\n\t\tfor(j=0;j<n;j++) {\n\t\t\tif(c[j]=='U')\n\t\t\t\ty3++;\n\t\t\telse if(c[j]=='D')\n\t\t\t\ty3--;\n\t\t\telse if(c[j]=='L')\n\t\t\t\tx3--;\n\t\t\telse\n\t\t\t\tx3++;\n\t\t\tif(x2*i+x3 == x1 && y2*i+y3 == y1) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint mo(int x) {\n\tif(x<0)\n\t\treturn -x;\n\telse\n\t\treturn x;\n}\nint main() {\n\tint i,j,k,l,n,m,x2 = 0,y2 = 0,x1,y1,x3,y3,m1=0,m2=0;\n\tchar c[101];\n\tscanf(\"%d%d\",&x1,&y1);\n\tscanf(\" %s\",c);\n\tn = strlen(c);\n\tfor(i=0;i<n;i++)\n\t\tif(c[i]=='U')\n\t\t\ty2++;\n\t\telse if(c[i]=='D')\n\t\t\ty2--;\n\t\telse if(c[i]=='L')\n\t\t\tx2--;\n\t\telse\n\t\t\tx2++;\n\tif(y2)\n\t\tm1 = y1/y2;\n\tif(x2)\n\t\tm2 = x1/x2;\n\tif(mo(m1)>mo(m2))\n\t\tm = m1;\n\telse\n\t\tm = m2;\n\tif(m>100)\n\t\ti = m-100;\n\telse\n\t\ti=0;\n\tfor(;i<m+100;i++) {\n\t\tx3 = y3 = 0;\n\t\tfor(j=0;j<n;j++) {\n\t\t\tif(c[j]=='U')\n\t\t\t\ty3++;\n\t\t\telse if(c[j]=='D')\n\t\t\t\ty3--;\n\t\t\telse if(c[j]=='L')\n\t\t\t\tx3--;\n\t\t\telse\n\t\t\t\tx3++;\n\t\t\tif(x2*i+x3 == x1 && y2*i+y3 == y1) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=x=y=0;\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n else if(s[i]=='D')\n y--;\n else if(s[i]=='L')\n x--;\n else if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=x=y=0;\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n else if(s[i]=='D')\n y--;\n else if(s[i]=='L')\n x--;\n else if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n flag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[1000],yy[1000];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=x=y=0;\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n else if(s[i]=='D')\n y--;\n else if(s[i]=='L')\n x--;\n else if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n flag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n __int64 a,b,x,y,xx[110],yy[110];\n int l,i,j,flag;\n char s[1000];\n while(~scanf(\"%I64d %I64d\",&a,&b))\n {\n getchar();\n scanf(\"%s\",s);\n l=strlen(s);\n flag=x=y=0;\n if((a==0)&&(b==0))\n {\n printf(\"Yes\\n\");\n continue;\n }\n for(i=0;i<l;i++)\n {\n if(s[i]=='U')\n y++;\n else if(s[i]=='D')\n y--;\n else if(s[i]=='L')\n x--;\n else if(s[i]=='R')\n x++;\n if(x==a&&y==b)\n {\n printf(\"Yes\\n\");\n flag=1;\n break;\n }\n xx[i+1]=x;\n yy[i+1]=y;\n }\n if(flag==0)\n {\n for(i=1;i<=l;i++)\n {\n if(xx[l]&&yy[l])\n {\n if(((((a-xx[i])%xx[l])==0))&&(((b-yy[i])%yy[l])==0))\n if(((a-xx[i])/xx[l])==((b-yy[i])/yy[l]))\n if(((a-xx[i])/xx[l])>=0)\n flag=1;\n }\n else if(xx[l]==0&&yy[l]!=0)\n {\n if(xx[i]==a)\n if((((b-yy[i])%yy[l])==0))\n flag=1;\n }\n else if(xx[l]!=0&&yy[l]==0)\n {\n if(yy[i]==b)\n if(((((a-xx[i])%xx[l])==0)))\n flag=1;\n }\n else if(xx[i]==a&&yy[i]==b) flag=1;\n if(flag==1)\n {\n printf(\"Yes\\n\");\n break;\n }\n }\n }\n if(flag==0)\n printf(\"No\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint a, b;\nint dx, dy;\nchar str[110];\n\nint abs(int a){\n\treturn a >= 0 ? a : -a;\n}\n\nint sign(int x){\n\tif (x > 0)\n\t\treturn 1;\n\telse if (x == 0)\n\t\treturn 0;\n\telse\n\t\treturn -1;\n}\n\nbool check(int x, int y){\n\tint xdiff = a - x;\n\tint ydiff = b - y;\n\n\tif (x == a && y == b)\n\t\treturn true;\n\n\tif (a != x && dx == 0)\n\t\treturn false;\n\tif (b != y && dy == 0)\n\t\treturn false;\n\n\tif (sign(xdiff) * sign(dx) < 0 || sign(ydiff) * sign(dy) < 0)\n\t\treturn false;\n\n\tif (dx == 0)\n\t\treturn abs(ydiff) % abs(dy) == 0;\n\telse if (dy == 0)\n\t\treturn abs(xdiff) % abs(dx) == 0;\n\telse\n\t\treturn ((unsigned long long int)xdiff) * dy / dx == ydiff;\n}\n\nint main(void){\n\tint i, j;\n\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\tdy++;\n\t\telse if (str[i] == 'D')\n\t\t\tdy--;\n\t\telse if (str[i] == 'R')\n\t\t\tdx++;\n\t\telse if (str[i] == 'L')\n\t\t\tdx--;\n\t}\n\n\tint x = 0, y = 0;\n\tbool works = check(0,0);\n\n\tfor (i = 0; !works && str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\ty++;\n\t\telse if (str[i] == 'D')\n\t\t\ty--;\n\t\telse if (str[i] == 'R')\n\t\t\tx++;\n\t\telse if (str[i] == 'L')\n\t\t\tx--;\n\t\tworks = check(x,y);\n\t}\n\n\tprintf(\"%s\\n\", works ? \"Yes\" : \"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint a, b;\nint dx, dy;\nchar str[110];\n\nint abs(int a){\n\treturn a >= 0 ? a : -a;\n}\n\nint sign(int x){\n\tif (x > 0)\n\t\treturn 1;\n\telse if (x == 0)\n\t\treturn 0;\n\telse\n\t\treturn -1;\n}\n\nbool check(int x, int y){\n\tint xdiff = a - x;\n\tint ydiff = b - y;\n\n\tif (x == a && y == b)\n\t\treturn true;\n\n\tif (a != x && dx == 0)\n\t\treturn false;\n\tif (b != y && dy == 0)\n\t\treturn false;\n\n\tif (sign(xdiff) * sign(dx) < 0 || sign(ydiff) * sign(dy) < 0)\n\t\treturn false;\n\n\tif (dx == 0)\n\t\treturn abs(ydiff) % abs(dy) == 0;\n\telse if (dy == 0)\n\t\treturn abs(xdiff) % abs(dx) == 0;\n\telse\n\t\treturn ((long long int)xdiff) * dy / dx == ydiff;\n}\n\nint main(void){\n\tint i, j;\n\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\tdy++;\n\t\telse if (str[i] == 'D')\n\t\t\tdy--;\n\t\telse if (str[i] == 'R')\n\t\t\tdx++;\n\t\telse if (str[i] == 'L')\n\t\t\tdx--;\n\t}\n\n\tint x = 0, y = 0;\n\tbool works = check(0,0);\n\n\tfor (i = 0; !works && str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\ty++;\n\t\telse if (str[i] == 'D')\n\t\t\ty--;\n\t\telse if (str[i] == 'R')\n\t\t\tx++;\n\t\telse if (str[i] == 'L')\n\t\t\tx--;\n\t\tworks = check(x,y);\n\t}\n\n\tprintf(\"%s\\n\", works ? \"Yes\" : \"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint a, b;\nint dx, dy;\nchar str[110];\n\nint abs(int a){\n\treturn a >= 0 ? a : -a;\n}\n\nint sign(int x){\n\tif (x > 0)\n\t\treturn 1;\n\telse if (x == 0)\n\t\treturn 0;\n\telse\n\t\treturn -1;\n}\n\nbool check(int x, int y){\n\tint xdiff = a - x;\n\tint ydiff = b - y;\n\n\tif (x == a && y == b)\n\t\treturn true;\n\n\tif (a != x && dx == 0)\n\t\treturn false;\n\tif (b != y && dy == 0)\n\t\treturn false;\n\n\tif (sign(xdiff) * sign(dx) < 0 || sign(ydiff) * sign(dy) < 0)\n\t\treturn false;\n\n\tif (dx == 0)\n\t\treturn abs(ydiff) % abs(dy) == 0;\n\telse if (dy == 0)\n\t\treturn abs(xdiff) % abs(dx) == 0;\n\telse\n\t\treturn xdiff * dy / dx == ydiff;\n}\n\nint main(void){\n\tint i, j;\n\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\tdy++;\n\t\telse if (str[i] == 'D')\n\t\t\tdy--;\n\t\telse if (str[i] == 'R')\n\t\t\tdx++;\n\t\telse if (str[i] == 'L')\n\t\t\tdx--;\n\t}\n\n\tint x = 0, y = 0;\n\tbool works = check(0,0);\n\n\tfor (i = 0; !works && str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\ty++;\n\t\telse if (str[i] == 'D')\n\t\t\ty--;\n\t\telse if (str[i] == 'R')\n\t\t\tx++;\n\t\telse if (str[i] == 'L')\n\t\t\tx--;\n\t\tworks = check(x,y);\n\t}\n\n\tprintf(\"%s\\n\", works ? \"Yes\" : \"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\nint a, b;\nint dx, dy;\nchar str[110];\n\nint abs(int a){\n\treturn a >= 0 ? a : -a;\n}\n\nbool check(int x, int y){\n\tint xdiff = a - x;\n\tint ydiff = b - y;\n\n\tif (x == a && y == b)\n\t\treturn true;\n\n\tif (a != x && dx == 0)\n\t\treturn false;\n\tif (b != y && dy == 0)\n\t\treturn false;\n\n\tif (xdiff * dx < 0 || ydiff * dy < 0)\n\t\treturn false;\n\n\tif (dx == 0)\n\t\treturn abs(ydiff) % abs(dy) == 0;\n\telse if (dy == 0)\n\t\treturn abs(xdiff) % abs(dx) == 0;\n\telse\n\t\treturn a * dy / dx == b;\n}\n\nint main(void){\n\tint i, j;\n\n\tscanf(\"%d %d\", &a, &b);\n\tscanf(\"%s\", str);\n\n\tfor (i = 0; str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\tdy++;\n\t\telse if (str[i] == 'D')\n\t\t\tdy--;\n\t\telse if (str[i] == 'R')\n\t\t\tdx++;\n\t\telse if (str[i] == 'L')\n\t\t\tdx--;\n\t}\n\n\tint x = 0, y = 0;\n\tbool works = check(0,0);\n\n\tfor (i = 0; !works && str[i]; i++){\n\t\tif (str[i] == 'U')\n\t\t\ty++;\n\t\telse if (str[i] == 'D')\n\t\t\ty--;\n\t\telse if (str[i] == 'R')\n\t\t\tx++;\n\t\telse if (str[i] == 'L')\n\t\t\tx--;\n\t\tworks = check(x,y);\n\t}\n\n\tprintf(\"%s\\n\", works ? \"Yes\" : \"No\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a,b,l;\nint x,y,xl,yl;\n\nchar s[101];\nint w[101][2];\nint al,bl;\nint main()\n{\n int i,j;\n \n scanf (\"%d%d\",&a,&b);\n scanf (\"%s\",s);l=strlen(s);\n if (a==0&&b==0){printf (\"Yes\\n\");return 0;}\n for (i=0;i<l;i++) {\n if (s[i]=='U'){w[i][0]=0;w[i][1]=1;}\n if (s[i]=='D'){w[i][0]=0;w[i][1]=-1;}\n if (s[i]=='L'){w[i][0]=-1;w[i][1]=0;}\n if (s[i]=='R'){w[i][0]=1;w[i][1]=0;}\n }\n for (i=0;i<l;i++) {\n xl+=w[i][0];yl+=w[i][1];\n }\n //printf (\"{{%d %d}}\\n\",xl,yl);\n for (i=0;i<l;i++) {\n x+=w[i][0];y+=w[i][1];\n al=a-x;bl=b-y;//printf (\"(%d %d)<%d,%d>\\n\",al,bl,x,y);\n if (al==0&&bl==0) {printf (\"Yes\\n\");return 0;}\n if (al==0) {if (xl==0&&bl%yl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (bl==0) {if (yl==0&&al%xl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (al%xl==0&&bl%yl==0&&al/xl==bl/yl){printf (\"Yes\\n\");return 0;}\n }\n printf (\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a,b,l;\nint x,y,xl,yl;\n\nchar s[101];\nint w[101][2];\nint al,bl;\nint main()\n{\n int i,j;\n \n scanf (\"%d%d\",&a,&b);\n scanf (\"%s\",s);l=strlen(s);\n if (a==0&&b==0){printf (\"Yes\\n\");return 0;}\n for (i=0;i<l;i++) {\n if (s[i]=='U'){w[i][0]=0;w[i][1]=1;}\n if (s[i]=='D'){w[i][0]=0;w[i][1]=-1;}\n if (s[i]=='L'){w[i][0]=-1;w[i][1]=0;}\n if (s[i]=='R'){w[i][0]=1;w[i][1]=0;}\n }\n for (i=0;i<l;i++) {\n xl+=w[i][0];yl+=w[i][1];\n }\n //printf (\"{{%d %d}}\\n\",xl,yl);\n for (i=0;i<l;i++) {\n x+=w[i][0];y+=w[i][1];\n al=a-x;bl=b-y;//printf (\"(%d %d)<%d,%d>\\n\",al,bl,x,y);\n if (al==0&&bl==0) {printf (\"Yes\\n\");return 0;}\n if (al==0) {if (xl==0&&bl%yl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (bl==0) {if (yl==0&&al%xl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (al%xl==bl%yl){printf (\"Yes\\n\");return 0;}\n }\n printf (\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint a,b,l;\nint x,y,xl,yl;\n\nchar s[101];\nint w[101][2];\nint al,bl;\nint main()\n{\n int i,j;\n \n scanf (\"%d%d\",&a,&b);\n scanf (\"%s\",s);l=strlen(s);\n if (a==0&&b==0){printf (\"Yes\\n\");return 0;}\n for (i=0;i<l;i++) {\n if (s[i]=='U'){w[i][0]=0;w[i][1]=1;}\n if (s[i]=='D'){w[i][0]=0;w[i][1]=-1;}\n if (s[i]=='L'){w[i][0]=-1;w[i][1]=0;}\n if (s[i]=='R'){w[i][0]=1;w[i][1]=0;}\n }\n for (i=0;i<l;i++) {\n xl+=w[i][0];yl+=w[i][1];\n }\n //printf (\"{{%d %d}}\\n\",xl,yl);\n for (i=0;i<l;i++) {\n x+=w[i][0];y+=w[i][1];\n al=a-x;bl=b-y;//printf (\"(%d %d)<%d,%d>\\n\",al,bl,x,y);\n if (al*xl<0||bl*yl<0)continue;\n if (al==0&&bl==0) {printf (\"Yes\\n\");return 0;}\n if (al==0) {if (xl==0&&yl!=0&&bl%yl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (bl==0) {if (yl==0&&xl!=0&&al%xl==0) {printf (\"Yes\\n\");return 0;}else continue;}\n if (xl!=0&&yl!=0&&al%xl==0&&bl%yl==0&&al/xl==bl/yl){printf (\"Yes\\n\");return 0;}\n }\n printf (\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n double a, b, wx, wy;\n int i, j, ans=0, k;\n char s[101];\n double wa[101][2];\n scanf(\"%lf %lf\", &a, &b);\n scanf(\"%s\", s);\n wa[0][0] = 0;\n wa[0][1] = 0;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='U')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]+1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='D')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]-1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='L')\n {\n wa[i+1][0]=wa[i][0]-1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='R')\n {\n wa[i+1][0]=wa[i][0]+1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n }\n wx = wa[strlen(s)][0];\n wy = wa[strlen(s)][1];\n if(wx != 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][0] / wx;\n if(wa[j][0] / wx == wa[j][1] / wy && wa[j][1] / wy >= 0 && wa[j][0] / wx == k)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][1] / wy;\n if(wa[j][0] == 0 && wa[j][1] / wy == k && k > 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n k = wa[j][0] / wx;\n if(wa[j][1] == 0 && wa[j][0] / wx == k && k > 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] == 0)\n {\n ans++;\n }\n }\n }\n if(ans>0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int a, b, i, j, ans=0, wx, wy;\n char s[101];\n int wa[101][2];\n scanf(\"%d %d\", &a, &b);\n scanf(\"%s\", s);\n wa[0][0] = 0;\n wa[0][1] = 0;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='U')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]+1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='D')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]-1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='L')\n {\n wa[i+1][0]=wa[i][0]-1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='R')\n {\n wa[i+1][0]=wa[i][0]+1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n }\n wx = wa[strlen(s)][0];\n wy = wa[strlen(s)][1];\n if(wx != 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] % wx == 0 && wa[j][1] % wy == 0 && wa[j][0] / wx == wa[j][1] / wy)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] % wy == 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][1] == 0 && wa[j][0] % wx == 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] == 0)\n {\n ans++;\n }\n }\n }\n if(ans>0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int a, b, i, j, ans=0, wx, wy;\n char s[101];\n int wa[101][2];\n scanf(\"%d %d\", &a, &b);\n scanf(\"%s\", s);\n wa[0][0] = 0;\n wa[0][1] = 0;\n for(i=0;i<strlen(s);i++)\n {\n if(s[i]=='U')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]+1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='D')\n {\n wa[i+1][0]=wa[i][0];\n wa[i+1][1]=wa[i][1]-1;\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='L')\n {\n wa[i+1][0]=wa[i][0]-1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n if(s[i]=='R')\n {\n wa[i+1][0]=wa[i][0]+1;\n wa[i+1][1]=wa[i][1];\n wa[i][0] = a - wa[i][0];\n wa[i][1] = b - wa[i][1];\n }\n }\n wx = wa[strlen(s)][0];\n wy = wa[strlen(s)][1];\n if(wx != 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] % wx == 0 && wa[j][1] % wy == 0 && wa[j][0] / wx == wa[j][1] / wy && wa[j][1] / wy >= 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy != 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] % wy == 0)\n {\n ans++;\n }\n }\n }\n if(wx != 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][1] == 0 && wa[j][0] % wx == 0)\n {\n ans++;\n }\n }\n }\n if(wx == 0 && wy == 0)\n {\n for(j=0;j<strlen(s);j++)\n {\n if(wa[j][0] == 0 && wa[j][1] == 0)\n {\n ans++;\n }\n }\n }\n if(ans>0) printf(\"Yes\\n\");\n else printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;\n if(det==0)\n {\n ll dot_product=(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1);\n if(dot_product>=0)\n {\n ll dist=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)) - ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n if(dist>=0)\n return 1;\n else\n return 0;\n }\n else\n return 0;\n }\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if((c1[i][0]==a && c1[i][1]==b) || (c2[i][0]==a && c2[i][1]==b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;\n if(det==0) return 1;\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\ntypedef long long int ll;\n\nchar s[105];\nll c1[103][2],c2[103][2];\n\nint determinant(ll x1,ll y1,ll x2,ll y2,ll x3,ll y3)\n{\n ll det = x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2;\n if(det==0)\n {\n ll dot_product=(x2-x1)*(x3-x1)+(y2-y1)*(y3-y1);\n if(dot_product>0)\n {\n ll dist=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1)) - ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));\n if(dist>0)\n return 1;\n else\n return 0;\n }\n else\n return 0;\n }\n else return 0;\n}\nint main()\n{\n ll a,b;\n int i,l;\n scanf(\"%I64d%I64d\",&a,&b);\n scanf(\"%s\",s);\n c1[0][0]=c1[0][1]=0;\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c1[i+1][0]=c1[i][0]+1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='L')\n {\n c1[i+1][0]=c1[i][0]-1;\n c1[i+1][1]=c1[i][1];\n }\n else if(s[i]=='U')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c1[i+1][0]=c1[i][0];\n c1[i+1][1]=c1[i][1]-1;\n }\n }\n c2[0][0]=c1[i][0];\n c2[0][1]=c1[i][1];\n for(i=0;i<l;i++)\n {\n if(s[i]=='R')\n {\n c2[i+1][0]=c2[i][0]+1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='L')\n {\n c2[i+1][0]=c2[i][0]-1;\n c2[i+1][1]=c2[i][1];\n }\n else if(s[i]=='U')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]+1;\n }\n else if(s[i]=='D')\n {\n c2[i+1][0]=c2[i][0];\n c2[i+1][1]=c2[i][1]-1;\n }\n }\n for(i=0;i<=l;i++)\n {\n if((c1[i][0]==a && c1[i][1]==b) || (c2[i][0]==a && c2[i][1]==b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n if(determinant(c1[i][0],c1[i][1],c2[i][0],c2[i][1],a,b))\n {\n printf(\"Yes\\n\");\n return 0;\n }\n }\n printf(\"No\\n\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char s[128];\n\tint a, b, n, i, x, y, x_, y_;\n\n\tscanf(\"%d%d\", &a, &b);\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\tx_ = x, y_ = y;\n\tx = 0, y = 0;\n\tfor (i = 0; i <= n; i++) {\n\t\tif (!((x_ == 0 && a - x != 0) || (x_ != 0 && (a - x) % x_ != 0) || (y_ == 0 && b - y != 0) || (y_ != 0 && (b - y) % y_ != 0)))\n\t\t\tif (x_ == 0 || y_ == 0 || ((a - x) / x_ >= 0 && (b - y) / y_ >= 0 && (a - x) / x_ == (b - y) / y_)) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\tif (i < n) {\n\t\t\tif (s[i] == 'U')\n\t\t\t\ty++;\n\t\t\telse if (s[i] == 'D')\n\t\t\t\ty--;\n\t\t\telse if (s[i] == 'L')\n\t\t\t\tx--;\n\t\t\telse\n\t\t\t\tx++;\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char s[128];\n\tint a, b, n, i, x, y, x_, y_;\n\n\tscanf(\"%d%d\", &a, &b);\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\tx_ = x, y_ = y;\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\t\tif ((x_ == 0 && a - x != 0) || (x_ != 0 && (a - x) % x_ != 0) || (y_ == 0 && b - y == 0) || (y_ != 0 && (b - y) % y_ != 0))\n\t\t\tcontinue;\n\t\tif (x_ == 0 || y_ == 0 || (a - x) / x_ == (b - y) / y_) {\n\t\t\tprintf(\"Yes\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char s[128];\n\tint a, b, n, i, x, y, x_, y_;\n\n\tscanf(\"%d%d\", &a, &b);\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\tx_ = x, y_ = y;\n\tx = 0, y = 0;\n\tfor (i = 0; i <= n; i++) {\n\t\tif (!((x_ == 0 && a - x != 0) || (x_ != 0 && (a - x) % x_ != 0) || (y_ == 0 && b - y == 0) || (y_ != 0 && (b - y) % y_ != 0)))\n\t\t\tif (x_ == 0 || y_ == 0 || ((a - x) / x_ >= 0 && (b - y) / y_ >= 0 && (a - x) / x_ == (b - y) / y_)) {\n\t\t\t\tprintf(\"Yes\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\tif (i < n) {\n\t\t\tif (s[i] == 'U')\n\t\t\t\ty++;\n\t\t\telse if (s[i] == 'D')\n\t\t\t\ty--;\n\t\t\telse if (s[i] == 'L')\n\t\t\t\tx--;\n\t\t\telse\n\t\t\t\tx++;\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tstatic char s[128];\n\tint a, b, n, i, x, y, x_, y_;\n\n\tscanf(\"%d%d\", &a, &b);\n\tscanf(\"%s\", s);\n\tn = strlen(s);\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++)\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\tx_ = x, y_ = y;\n\tx = 0, y = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tif (s[i] == 'U')\n\t\t\ty++;\n\t\telse if (s[i] == 'D')\n\t\t\ty--;\n\t\telse if (s[i] == 'L')\n\t\t\tx--;\n\t\telse\n\t\t\tx++;\n\t\tif ((x_ == 0 && a - x != 0) || (x_ != 0 && (a - x) % x_ != 0) || (y_ == 0 && b - y == 0) || (y_ != 0 && (b - y) % y_ != 0))\n\t\t\tcontinue;\n\t\tif (x_ == 0 || y_ == 0 || ((a - x) / x_ >= 0 && (b - y) / y_ >= 0 && (a - x) / x_ == (b - y) / y_)) {\n\t\t\tprintf(\"Yes\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"No\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define For(i,n) for(i=0;i<n;i++)\n#define MAX(x,y) x>y?x:y\n#define MAXN 111\n\nint mov[MAXN][2];\n\nmain()\n{\n int i, j, flag = 1;\n int k, a, b;\n int x, y, sx = 0, sy = 0;\n char s[111];\n scanf(\"%d%d%s\",&a,&b,s);\n mov[0][0] = mov[0][1] = 0;\n for(i = 0; s[i]; i++)\n {\n mov[i+1][0] = (s[i]=='U'||s[i]=='D')?0:s[i]=='R'?1:-1;\n mov[i+1][1] = (s[i]=='R'||s[i]=='L')?0:s[i]=='U'?1:-1;\n sx += mov[i+1][0];\n sy += mov[i+1][1];\n }\n For(i,strlen(s)){\n x = a - mov[i][0];\n y = b - mov[i][1];\n if(sx==0&&sy==0) k = 1;\n else if(sx!=0) k = x/sx;\n else k = y/sy;\n if(sx*k==x&&sy*k==y)\n {\n printf(\"Yes\\n\");\n flag = 0; break;\n }\n }\n if(flag) printf(\"No\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define For(i,n) for(i=0;i<n;i++)\n#define MAX(x,y) x>y?x:y\n#define MAXN 10001\n\nint mov[MAXN][2];\n\nmain()\n{\n int i, j, flag = 1;\n int k, a, b;\n int x, y, sx = 0, sy = 0;\n char s[111];\n scanf(\"%d%d%s\",&a,&b,s);\n mov[0][0] = mov[0][1] = 0;\n for(i = 0; s[i]; i++)\n {\n mov[i+1][0] = (s[i]=='U'||s[i]=='D')?0:s[i]=='R'?1:-1;\n mov[i+1][1] = (s[i]=='R'||s[i]=='L')?0:s[i]=='U'?1:-1;\n sx += mov[i+1][0];\n sy += mov[i+1][1];\n }\n For(i,strlen(s)){\n x = a - mov[i][0];\n y = b - mov[i][1];\n if(sx) k = x/sx;\n else if(sy) k = y/sy;\n else k = 1;\n if(sx*k==x&&sy*k==y)\n {\n printf(\"YES\\n\");\n flag = 0; break;\n }\n }\n if(flag) printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define For(i,n) for(i=0;i<n;i++)\n#define MAX(x,y) x>y?x:y\n#define MAXN 111\n\nint mov[MAXN][2];\n\nmain()\n{\n int i, j, flag = 1;\n int k, a, b;\n int x, y, sx = 0, sy = 0;\n char s[111];\n scanf(\"%d%d%s\",&x,&y,s);\n mov[0][0] = mov[0][1] = 0;\n for(i = 0; s[i]; i++)\n {\n mov[i+1][0] = (s[i]=='U'||s[i]=='D')?0:s[i]=='R'?1:-1;\n mov[i+1][1] = (s[i]=='R'||s[i]=='L')?0:s[i]=='U'?1:-1;\n sx += mov[i+1][0];\n sy += mov[i+1][1];\n }\n For(i,strlen(s)){\n x -= mov[i][0];\n y -= mov[i][1];\n if(sx==0&&sy==0) k = 1;\n else if(sx!=0) k = x/sx;\n else k = y/sy;\n if(sx*k==x&&sy*k==y&&k>0)\n {\n printf(\"Yes\\n\");\n flag = 0; break;\n }\n }\n if(flag) printf(\"No\\n\");\n return 0;\n}\n"}], "src_uid": "5d6212e28c7942e9ff4d096938b782bf"} {"nl": {"description": "For each positive integer n consider the integer \u03c8(n) which is obtained from n by replacing every digit a in the decimal notation of n with the digit (9\u2009\u2009-\u2009\u2009a). We say that \u03c8(n) is the reflection of n. For example, reflection of 192 equals 807. Note that leading zeros (if any) should be omitted. So reflection of 9 equals 0, reflection of 91 equals 8.Let us call the weight of the number the product of the number and its reflection. Thus, the weight of the number 10 is equal to 10\u00b789\u2009=\u2009890.Your task is to find the maximum weight of the numbers in the given range [l,\u2009r] (boundaries are included).", "input_spec": "Input contains two space-separated integers l and r (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009109) \u2014 bounds of the range.", "output_spec": "Output should contain single integer number: maximum value of the product n\u00b7\u03c8(n), where l\u2009\u2264\u2009n\u2009\u2264\u2009r. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preferred to use cout (also you may use %I64d).", "sample_inputs": ["3 7", "1 1", "8 10"], "sample_outputs": ["20", "8", "890"], "notes": "NoteIn the third sample weight of 8 equals 8\u00b71\u2009=\u20098, weight of 9 equals 9\u00b70\u2009=\u20090, weight of 10 equals 890.Thus, maximum value of the product is equal to 890."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,r,i,n,x;\n scanf(\"%I64d%I64d\",&l,&r);\n n=r;\n x=0;\n while(n!=0)\n { x=x*10+9;\n n=n/10;\n }\n if(l<=x/2&&r>=x/2)\n printf(\"%I64d\",(x+1)/2*((x+1)/2-1));\n\n if(r<x/2)\n printf(\"%I64d\",r*(x-r));\n\n if(l>x/2)\n printf(\"%I64d\",l*(x-l));\n\n return 0;\n }\n\n\n"}, {"source_code": "#include<stdio.h>\nchar s1[30],s2[30];\nlong long change(char *s)\n{\n\tlong long sum=0,i;\n\tfor(i=0;i<strlen(s);i++)\n\t{\n\t\tsum=sum*10+s[i]-'0';\n\t}\n\treturn sum;\n}\nlong long f(int a,int b)\n{\n\tlong long sum=1;\n\tint i;\n\tfor(i=1;i<=b;i++)\n\t{\n\t\tsum*=a;\n\t}\n\treturn sum;\n}\nint main(void)\n{\n\tlong long l,r,i;\n\tscanf(\"%s%s\",s1,s2);\n\tlong long x1,x2,x3;\n\tint len=strlen(s2);\n\tx1=change(s1);\n\tx2=change(s2);\n\tx3=5*f(10,len-1)-1;\t\n\tif(x3<=x2&&x3>=x1) printf(\"%I64d\\n\",x3*(f(10,len)-1-x3));\n\telse if(x3<x1) printf(\"%I64d\\n\",x1*(f(10,len)-1-x1));\n\telse printf(\"%I64d\\n\",x2*(f(10,len)-1-x2));\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int l,r,t,n,x=0;\nscanf(\"%I64d %I64d\",&r,&l);\nn=l;\nwhile(n!=0)\n{n=n/10;\nx=x*10+9;\n}\n\nif(l<=x/2)\nprintf(\"%I64d\",l*(x-l));\nelse if(l>x/2&&r<x/2)\nprintf(\"%I64d\",x/2*(x-x/2));\nelse\nprintf(\"%I64d\",r*(x-r));\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long find_max(long long low,long long high,long long power)\n{\n if(low>high)\n return 0;\n if((power/2>=low&&power/2<=high)||(power/2-1>=low&&power/2-1<=high))\n return (power/2*(power/2-1));\n if(low>power/2)\n return (low*(power-1-low));\n return (high*(power-1-high));\n}\nmain()\n{\n long long l,r,max=0;\n scanf(\"%I64d%I64d\",&l,&r);\n int low_digit=0,high_digit=0;\n long long no=l,power=1;\n while(no!=0)\n {\n low_digit++;\n no/=10;\n power*=10;\n }\n no=r;\n while(no!=0)\n {\n high_digit++;\n no/=10;\n }\n long long current_max,low=l,high=power-1;\n while(low_digit<high_digit)\n {\n current_max=find_max(low,high,power);\n if(max<current_max)\n max=current_max;\n low=power;\n high=power*10-1;\n power=power*10;\n low_digit++;\n }\n current_max=find_max(low,r,power);\n if(current_max>max)\n max=current_max;\n printf(\"%I64d\",max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\n#define ll long long\n\nll pw[30];\n\nll ref(ll a){\n int i, now=0;\n ll res = 0;\n\n while(a){\n res += pw[now] * (9 - (a%10));\n now++; a/=10;\n }\n\n return res;\n}\n\nint main(){\n int i,j,k,l,m,n;\n int a,b;\n ll res, tmp, go;\n\n pw[0] = 1;\n REP(i,1,30) pw[i] = pw[i-1]*10;\n\n while(scanf(\"%d%d\",&a,&b)==2){\n res = 0;\n REP(i,1,15){\n go = pw[i] / 2;\n if(go < a) go = a;\n if(go > b) go = b;\n tmp = go * ref(go);\n if(res < tmp) res = tmp;\n }\n printf(\"%I64d\\n\",res);\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n\nlong long mi[11]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000LL};\n\nint main()\n{\n long long l,r,t,len=0;\n scanf(\"%I64d%I64d\",&l,&r);\n t=r;\n while (t)\n {\n len++;\n t/=10;\n }\n if (5*mi[len-1]>=l&&5*mi[len-1]<=r)\n t=5*mi[len-1]*(5*mi[len-1]-1);\n else\n t=max((mi[len]-1-l)*l,(mi[len]-1-r)*r);\n printf(\"%I64d\\n\",t);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n__int64 i,j=1,l,r,a=0,b,c=0,k;\n__int64 weight(int n1,int n)\n{\n b=n;\n while(n!=0)\n {\n n/=10;\n a=a*10+9;\n c++;\n }\n for(i=1;i<=c;i++)\n j*=10;\n k=j/2;\n if(k>=n1 && k<=b)\n return((a-k)*k);\n else if(k>b)\n return((a-b)*b);\n else\n return((a-n1)*n1);\n}\nint main()\n{\n scanf(\"%d%d\",&l,&r);\n printf(\"%I64d\",weight(l,r));\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long max(long long a, long long b)\n{\n if (a > b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nlong long min(long long a, long long b)\n{\n if (a < b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nlong long reverse(long long n)\n{\n long long r = 0, d = 1;\n int i;\n\n while (n) {\n\t r += (9 - n % 10) * d;\n\t n /= 10;\n\t d *= 10;\n }\n\n return r;\n}\n\nint main()\n{\n int l, r, c, i;\n long long d = 1;\n\n scanf(\"%d %d\", &l, &r);\n\n c = r;\n\n while (c) {\n\t c /= 10;\n\t d *= 10;\n }\n\n d /= 10;\n\n l = max(l, d);\n\n if (r < d * 5) {\n\t printf(\"%I64d\\n\", (long long)r * reverse(r));\n } else if (l > d * 5) {\n\t printf(\"%I64d\\n\", (long long)l * reverse(l));\n } else {\n\t printf(\"%I64d\\n\", (long long)d * 5 * reverse(d * 5));\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l1=0,r1=0,b1=0,i,t,d1=0;\n char l[10]={'0'},r[10]={'0'};\n scanf(\"%s%s\",&l,&r);\n\n\n t=1;\n for(i=strlen(l)-1;i>=0;i--)\n {\n l1=l1+t*(l[i]-'0');\n t*=10;\n\n }\n t=1;\n for(i=strlen(r)-1;i>=0;i--)\n {\n r1=r1+t*(r[i]-'0');\n t*=10;\n\n }\n t/=10;\n if((5*t-1)>r1){\n t=1;\n for(i=strlen(r)-1;i>=0;i--)\n {\n d1=d1+t*('9'-r[i]);\n t*=10;\n\n }\n printf(\"%I64d\",r1*d1);\n }\n else if((5*t)<l1){\n t=1;\n for(i=strlen(l)-1;i>=0;i--)\n {\n d1=d1+t*('9'-(l[i]));\n t*=10;\n\n }\n printf(\"%I64d\",l1*d1);\n }\n\n else printf(\"%I64d\",5*t*(5*t-1));\n\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#define REP(i,a,b) for(i=a;i<b;i++)\n#define rep(i,n) REP(i,0,n)\n\n#define ll long long\n\nll pw[30];\n\nll ref(ll a){\n int i, now=0;\n ll res = 0;\n\n while(a){\n res += pw[now] * (9 - (a%10));\n now++; a/=10;\n }\n\n return res;\n}\n\nint main(){\n int i,j,k,l,m,n;\n int a,b;\n ll res, tmp, go;\n\n pw[0] = 1;\n REP(i,1,30) pw[i] = pw[i-1]*10;\n\n while(scanf(\"%d%d\",&a,&b)==2){\n res = 0;\n REP(i,1,15){\n go = pw[i] / 2;\n if(go < a) go = a;\n if(go > b) go = b;\n tmp = go * ref(go);\n if(res < tmp) res = tmp;\n }\n printf(\"%I64d\\n\",res);\n }\n\n return 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,r,i,y,max,n,x,j,m;\n scanf(\"%I64d%I64d\",&l,&r);\n max=0;\n\n\n for(i=l;i<=r;i++)\n { x=log10(i);\n n=pow(10,(x+1))-1-i;\n\n\n\n if(n*i>max)\n max=n*i;\n }\n printf(\"%I64d\",max);\n return 0;\n }\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,r,i,y,max,n,x,j,m;\n scanf(\"%I64d%I64d\",&l,&r);\n max=0;\n\n\n for(i=l;i<=r;i++)\n { x=log10(i);\n if(i%10==0)\n n=pow(10,(x+1))-i;\n else\n n=pow(10,(x+1))-1-i;\n\n\n\n if(n*i>max)\n max=n*i;\n }\n printf(\"%I64d\",max);\n return 0;\n }\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long int l,r,i,y,max,n,x,j,m;\n scanf(\"%ld%ld\",&l,&r);\n max=0;\n\n\n for(i=l;i<=r;i++)\n { n=0;\n j=1;\n m=i;\n\n while(m>0)\n { y=m%10;\n x=9-y;\n n=n+j*x;\n m=m/10;\n j=j*10;\n }\n if(n*i>max)\n max=n*i;\n }\n printf(\"%ld\",max);\n return 0;\n }\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,r,i,n,x;\n scanf(\"%I64d%I64d\",&l,&r);\n n=r;\n x=0;\n while(n!=0)\n { x=x*10+9;\n n=n/10;\n }\n if(l<x/2&&r>x/2)\n printf(\"%I64d \",(x+1)/2*((x+1)/2-1));\n\n if(r<x/2)\n printf(\"%I64d\",r*(x-r));\n\n if(l>x/2)\n printf(\"%I64d\",l*(x-l));\n\n return 0;\n }\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{long long int l,r,t,n,x=0;\nscanf(\"%I64d %I64d\",&r,&l);\nn=l;\nwhile(n!=0)\n{n=n/10;\nx=x*10+9;\n}\n\nif(l<x/2)\nprintf(\"%I64d\",l*(x-l));\nelse if(l>x/2&&r<x/2)\nprintf(\"%I64d\",x/2*(x-x/2));\nelse\nprintf(\"%I64d\",r*(x-r));\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long mi[11]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000LL},rec[10];\n\nint main()\n{\n long long i,j,l,t,r,s=0,len=0;\n scanf(\"%I64d%I64d\",&l,&r);\n t=r;\n while (t)\n {\n len++;\n t/=10;\n }\n for (i=0;i<=len;i++)\n {\n rec[i]=l%10;\n l/=10;\n }\n for (i=len-1;i>=0;i--)\n {\n s+=mi[i]*rec[i];\n while (rec[i]<4&&s+mi[i]<=r)\n {\n s+=mi[i];\n rec[i]++;\n for (j=i-1;j>=0;j--)\n rec[j]=0;\n }\n }\n printf(\"%I64d\\n\",(mi[len]-1-s)*s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n__int64 i,j=1,l,r,a=0,b,c=0,k;\n__int64 weight(int n)\n{\n b=n;\n while(n!=0)\n {\n n/=10;\n a=a*10+9;\n c++;\n }\n for(i=1;i<=c;i++)\n j*=10;\n k=j/2;\n if(b>=k)\n return((a-k)*k);\n else\n return((a-b)*b);\n}\nint main()\n{\n scanf(\"%d%d\",&l,&r);\n printf(\"%I64d\",weight(r));\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n\nlong long max(long long a, long long b)\n{\n if (a > b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nlong long min(long long a, long long b)\n{\n if (a < b) {\n\t return a;\n } else {\n\t return b;\n }\n}\n\nint reverse(int n)\n{\n int r = 0, d = 1, i;\n\n while (n) {\n\t r += (9 - n % 10) * d;\n\t n /= 10;\n\t d *= 10;\n }\n\n return r;\n}\n\nint main()\n{\n int l, r, c, i;\n long long d = 1;\n\n scanf(\"%d %d\", &l, &r);\n\n c = r;\n\n while (c) {\n\t c /= 10;\n\t d *= 10;\n }\n\n d /= 10;\n\n l = max(l, d);\n\n if (r < d * 5) {\n\t printf(\"%I64d\\n\", (long long)r * reverse(r));\n } else if (l > d * 5) {\n\t printf(\"%I64d\\n\", (long long)l * reverse(l));\n } else {\n\t printf(\"%I64d\\n\", (long long)d * 5 * reverse(d * 5));\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int N, K, i, j, k, l;\n int a[100][100] = {0};\n\n scanf(\"%d %d\", &N, &K);\n\n for (i = 0; i < N; i++) {\n\t int m, min = 1e9, x = 0, yl = 0, yr = 0;\n\n\t scanf(\"%d\", &m);\n\n\t for (j = 1; j <= K; j++) {\n\t for (k = 1; k + m <= K + 1; k++) {\n\t\t for (l = k; l < k + m; l++) {\n\t\t\t if (a[j][l] == 1) break;\n\t\t }\n\n\t\t if (l == k + m) {\n\t\t\t int c = 0;\n\n\t\t\t for (l = k; l < k + m; l++) {\n\t\t\t c += abs(j - (K + 1) / 2) + abs(l - (K + 1) / 2);\n\t\t\t }\n\n\t\t\t if (c < min) {\n\t\t\t min = c;\n\t\t\t x = j; yl = k; yr = k + m - 1;\n\t\t\t }\n\t\t }\n\t }\n\t }\n\n\t if (min == 1e9) {\n\t puts(\"-1\");\n\t } else {\n\t printf(\"%d %d %d\\n\", x, yl, yr);\n\n\t for (j = yl; j <= yr; j++) a[x][j] = 1;\n\t }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int l1=0,r1=0,b1=0,i,t,b[10],d;\n char l[10]={'0'},r[10]={'0'},p='0';\n scanf(\"%s%s\",&l,&r);\n t=1;\n for(i=strlen(r)-1;i>=0;i--)\n {\n r1=r1+t*(r[i]-'0');\n t*=10;\n\n }\n t=1;\n for(i=strlen(l)-1;i>=0;i--)\n {\n l1=l1+t*(l[i]-'0');\n t*=10;\n\n }\n\n d=r1-l1;\n if(r[0]-'0'<=4)\n { t=1;\n for(i=strlen(r)-1;d>0 && i>=0 ;i--)\n {\n if((r[i]-'0')>4){ p=r[i];\n d-=t*(r[i]-'4');\n r[i]='4';\n }\n t*=10;\n\n }\n if(d<0){r[i]=p;}\n for(i=strlen(r)-1;i>=0 ;i--)\n b[i]='9'-(r[i]-'0');\n }\n else\n {\n t=1;\n for(i=strlen(r)-1;d>0 && i>=0 ;i--)\n {\n if((r[i]-'0')>5){p=r[i];\n\n d-=t*(r[i]-'5');\n r[i]='5';\n }\n t*=10;\n }\n if(d<0){r[i]=p;\n }\n for(i=strlen(r)-1;i>=0 ;i--)\n b[i]='9'-(r[i]-'0');\n\n }\n t=1;r1=0;b1=0;\n for(i=strlen(r)-1;i>=0;i--)\n {\n r1=r1+t*(r[i]-'0');\n b1=b1+t*(b[i]-'0');\n t*=10;\n\n }\n printf(\"%I64d\",r1*b1);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int l,r,i,y,max,n,x,j,m;\n scanf(\"%I64d%I64d\",&l,&r);\n max=0;\n\n\n for(i=l;i<=r;i++)\n { x=log10(i);\n if(i==10)\n n=89;\n else\n n=pow(10,(x+1))-1-i;\n\n\n\n if(n*i>max)\n max=n*i;\n }\n printf(\"%I64d\",max);\n return 0;\n }\n\n\n"}], "src_uid": "2c4b2a162563242cb2f43f6209b59d5e"} {"nl": {"description": "Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh:\u2009mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the snooze button every x minutes until hh:\u2009mm is reached, and only then he will wake up. He wants to know what is the smallest number of times he needs to press the snooze button.A time is considered lucky if it contains a digit '7'. For example, 13:\u200907 and 17:\u200927 are lucky, while 00:\u200948 and 21:\u200934 are not lucky.Note that it is not necessary that the time set for the alarm and the wake-up time are on the same day. It is guaranteed that there is a lucky time Jamie can set so that he can wake at hh:\u2009mm.Formally, find the smallest possible non-negative integer y such that the time representation of the time x\u00b7y minutes before hh:\u2009mm contains the digit '7'.Jamie uses 24-hours clock, so after 23:\u200959 comes 00:\u200900.", "input_spec": "The first line contains a single integer x (1\u2009\u2264\u2009x\u2009\u2264\u200960). The second line contains two two-digit integers, hh and mm (00\u2009\u2264\u2009hh\u2009\u2264\u200923,\u200900\u2009\u2264\u2009mm\u2009\u2264\u200959).", "output_spec": "Print the minimum number of times he needs to press the button.", "sample_inputs": ["3\n11 23", "5\n01 07"], "sample_outputs": ["2", "0"], "notes": "NoteIn the first sample, Jamie needs to wake up at 11:23. So, he can set his alarm at 11:17. He would press the snooze button when the alarm rings at 11:17 and at 11:20.In the second sample, Jamie can set his alarm at exactly at 01:07 which is lucky."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main(void){\nint count,mm,hh,x;\nscanf(\"%d\",&x);\nscanf(\"%d %d\",&hh,&mm);\nfor(count=0;hh%10!=7&&mm%10!=7;){\n mm=mm-x;\n count++;\n if(mm<0) {mm=60+mm;\n hh--;}\n if(hh<0) {hh=24+hh;}\n}\nprintf(\"%d\",count);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n int t, h, m;\n int r = 0;\n scanf(\"%d %d %d\", &t, &h, &m);\n while(m % 10 != 7 && h % 10 != 7){\n m -= t;\n if(m < 0){\n m += 60;\n h--;\n if(h < 0)\n h += 24;\n }\n r++;\n }\n printf(\"%d\\n\", r);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,hh,mm;\n\tint h,m;\n\tint a,i;\n\t\n\tscanf(\"%d\", &x);\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tfor(i=0; ; i++)\n\t{ \n\t h=hh%10;\n\t\tm=mm%10;\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh=hh-1;\n\t\t}\n\t\tif(hh<0)\n\t\t{\n\t\t\thh=hh+24;\n\t\t}\n\t\t\n\t\tif(h==7 || m==7 || (hh==7 && mm==0) )\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int count,x, hr, min,i;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hr,&min);\n if((hr==07 || hr== 17)||(min ==07 || min ==17 || min ==27 || min ==37 || min ==47 || min ==57 ))\n printf(\"0\");\n else\n {\n\n for(i=1;;i++)\n {\n\n if(min%x!=min && min!=0)\n min=min-x;\n else if(min%x==min || min==0)\n {\n if(hr==0)\n {\n hr=24;\n\n }\n\n hr=hr-1;\n min=60-(x-min);\n }\n if((hr==7)||(hr==17) ||(min ==07 || min ==17 || min ==27 || min ==37 || min ==47 || min ==57))\n break;\n\n\n\n\n }\n\n\n printf(\"%d\",i);\n\n\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main (void)\n{\n\tint x, h, m, count=0;\n\tscanf (\"%d %d %d\", &x, &h, &m);\n\n\twhile (h%10!=7 && m%10!=7)\n\t{\n\t\tm=m-x;\n\t\t\n\t\twhile (m<0)\n\t\t{\n\t\t\tm=60+m;\n\t\t\th--;\n\t\t}\n\t\twhile (h<0)\n\t\t\th=24+h;\n\t\tcount++;\n\t}\n\n\tprintf(\"%d\\n\", count);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdbool.h>\n\n#define max(A, B) ((A > B) ? A : B)\n#define min(A, B) ((A > B) ? B : A)\n#define INF 999999\n\nint x;\nint h, m;\n\nint main()\n{\n int ans;\n int y;\n\n scanf(\"%d\", &x);\n scanf(\"%d%d\", &h, &m);\n if (h == 7 || h == 17 || m % 10 == 7)\n printf(\"0\");\n else{\n if (h > 17) {\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else if (h < 7) {\n y = 0;\n h += 24;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else{\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 7) {\n ans = y;\n break;\n }\n }\n }\n printf(\"%d\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t\n\tint x;\n\tint hh,mm;\n\tint t=0;\n\tint check;\n\t\n\tscanf(\"%d %d %d\",&x,&hh,&mm);\n\t\n\tif(mm==07 || mm==17 || mm==27 || mm==37 || mm==47 || mm==57||hh==07||hh==17)\n\tcheck=0;\n\telse\n\tcheck=1;\n\t\n\twhile (check)\n\t{\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=60+mm;\n\t\t\thh=hh-1;\n\t\t\t\n\t\t\t\n\t\t\tif(hh<0)\n\t\t\thh=24+hh;\n\t\t}\n\t\t\n\t\tt=t+1;\n\t\t\n\t\tif(mm==07 || mm==17 || mm==27 || mm==37 || mm==47 || mm==57||hh==07||hh==17)\n\t\tcheck=0;\n\t\telse\n\t\tcheck=1;\n\t\t\n\t}\n\t\n\tprintf(\"%d\",t);\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint lucky_checker(int h,int m);\nvoid time_minus(int *h, int *m);\n\nint main()\n{\n\tint x,hour,min,counter=0;\n\tfloat button_times;\n\tint loop_x;\n\n\tscanf(\"%d %d %d\",&x,&hour,&min);\n\tloop_x = x;\n\n\twhile(! lucky_checker(hour,min)) {\n\t\tcounter++;\n\t\tloop_x = x;\n\t\twhile(loop_x--) {\n\t\t\t//printf(\"%d\\n\",loop_x);\n\t\t\t//getchar();\n\t\t\ttime_minus(&hour,&min);\n\t\t}\n\t\t//printf(\"%d:%d\\n\",hour,min);\n\t}\n\t//printf(\"%d %d\\n\",hour,min);\n\t//button_times = (float)counter/x;\n\t//if (button_times>0 && button_times<1)\n\t\t//button_times=1;\n\t\n\t//printf(\"%d\\n\",(int)button_times);\n\tprintf(\"%d\\n\",counter);\n\n//\tcheck 7\n//\tno 7\n//\tminus 1 min\n//\tcheck 7 or change hour\n\n\treturn 0;\n}\n\nint lucky_checker(int h,int m)\n{\n\tint lucky=0,checker_7;\n\twhile(h || m) {\n\t\tchecker_7 = h%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Hour yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\th/=10;\n\n\t\tchecker_7 = m%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Min yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\tm/=10;\n\t}\n\treturn lucky;\n}\n\nvoid time_minus(int *h, int *m)\n{\n\tif (*m == 0) {\n\t\t*h-=1;\n\t\t*m = 59;\n\t\tif (*h < 0) {\n\t\t\t*h = 23;\n\t\t}\n\t}\n\telse {\n\t\t*m -=1;\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check(int h,int m)\n{\n\tint count=0;\n\twhile(h>0)\n\t{\n\t\tif(h%10==7)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\th=h/10;\n\t}\n\twhile(m>0)\n\t{\n\t\tif(m%10==7)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\tm=m/10;\n\t}\n\treturn count;\n}\nint main()\n{\n\tint x;\n\tscanf(\"%d\",&x);\n\tint h,m,count1=0,count=0,i;\n\tscanf(\"%d %d\",&h,&m);\n\twhile(1)\n\t{\n\t\tcount=check(h,m);\n\t\tif(count>0)\n\t\t{\n\t\t\tprintf(\"%d\\n\",count1);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm=m-x;\n\t\t\tif(m<0)\n\t\t\t{\n\t\t\t\th--;\n\t\t\t\tif(h<0)\n\t\t\t\t{\n\t\t\t\t\th=h+24;\n\t\t\t\t}\n\t\t\t\tm=60+m;\n\t\t\t}\n\t\t\th=h%24;\n\t\t\tm=m%60;\n\t\t\tcount1++;\n\t\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int h,hh,mm,m,x,y=0;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n m=mm;h=hh;\n while((m!=7)&&(m!=17)&&(m!=27)&&(m!=37)&&(m!=47)&&(m!=57)&&(h!=7)&&(h!=17))\n {\n if(m<x)\n {\n m=m+60;\n m=m-x;\n if(h==0)\n {\n h=24-1;\n }\n else\n {\n h=h-1;\n }\n y++;\n }\n else\n {\n m=m-x;\n y++;\n }\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n// 1 means lucky\nint check(int a,int b)\n{if(a%10==7 || b%10==7)\nreturn 1;\nelse\nreturn 0;\n}\nint main() \n {int x,a,b,count=0;\n scanf(\"%d %d %d\",&x,&a,&b);\n while(check(a,b)==0)\n { count++;\n if((b-x)>=0)\n b=b-x;\n else\n {b=b-x+60;\n if(a-1<0)\n a=a-1+24;\n else\n a=a-1;\n }\n \n \n \n }\n printf(\"%d\",count);\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n int h,m;\n int ans=0;\n scanf(\"%d\",&a);\n scanf(\"%d%d\",&h,&m);\n while(h!=17&&h!=7&&m%10!=7)\n {\n ans++;\n m=m-a;\n if(m<0)\n {\n m=m+60;\n h--;\n }\n if(h<0)\n h=23;\n }\n printf(\"%d\\n\",ans);\n }\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\n int x,hour,d,minute,click=0,snooze,c;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n c = hour;\n d = minute;\n while(1)\n {\n if(hour==0)\n {\n hour=24;\n\n }\n click++;\n\n if(x <= minute)\n snooze = minute-x;\n else\n {\n snooze = 60 + (minute-x);\n hour = hour-1;\n\n if(hour%10==7)\n {\n\n break;\n }\n }\n\n\n if(snooze%10==7)\n {\n\n break;\n }\n else\n minute=snooze;\n\n}\n\nif(c%10==7||d%10==7)\n click=0;\nprintf(\"%d\",click);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint x,h,m;\n\tint lh,lm;\n\tint cnt = 0;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\tfor(;;){\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tm = m - x;\n\t\tcnt++;\n\t\tif(m<0){\n\t\t\tm = 60 + m;\n\t\t\th = h - 1;\n\t\t\tif(h<0){\n\t\t\t\th = 23;\n\t\t\t}\n\t\t}\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nvoid F(int x,int n,int m)\n{\n\tint i,y=0;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{printf(\"%d\\n\",i);break;}\n\t\telse\n\t\t{\n\t\t\ty++;\n\t\t\tm-=x;\n\t\t\tif(m<0)\n\t\t\t{\tm+=60;n--;}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}\n\n\n\t \n\t"}, {"source_code": "#include<stdio.h>\nvoid F(int x,int n,int m)\n{\n\tint i,y=0;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{printf(\"%d\\n\",i);break;}\n\t\telse\n\t\t{\n\t\t\ty++;\n\t\t\tm-=x;\n\t\t\tif(m<0)\n\t\t\t{\tm+=60;n--;}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}\n\n\n\t \n\t"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int s,h,m,i,co=0,mm;\n scanf(\"%d%d%d\",&s,&h,&m);\n for(i=1;;i++)\n {\n if(h==7||h==17||m==7||m==17||m==27||m==37||m==47||m==57)\n {\n printf(\"%d\",co);\n break;\n }\n co++;\n mm=m-s;\n \n m=(mm<0)? 60+mm : mm ;\n h=(mm<0)? h-1 : h ;\n h=(h<0)? 24+h : h ;\n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint F(int x,int n,int m)\n{\n\tint i;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm-=x;\n\t\t\tif(m<0)\n\t\t\t{\n\t\t\t\tm+=60;\n\t\t\t\tn--;\n\t\t\t}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x, hh, mm;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n\n if(hh== 17 || hh == 7)\n {\n printf(\"0\\n\");\n return 0;\n }\n int remainder = mm % 10;\n if(remainder - 7 == 0)\n {\n printf(\"0\\n\");\n return 0;\n }\n int temp, y = 0, count = 0;\n\n while(count<=0)\n {\n if(mm>=x)\n {\n mm = mm - x;\n y++;\n\n }\n else\n {\n if(hh==0)\n {\n hh = 24;\n }\n temp = x - mm;\n mm = 60 - temp;\n hh--;\n y++;\n\n }\n remainder = mm % 10;\n if(remainder - 7 == 0)\n {\n count++;\n }\n if(hh == 7 || hh == 17)\n {\n count++;\n }\n }\n printf(\"%d\",y);\n return 0;\n}"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\ntypedef struct{\n\tint hh,mm;\n}Time;\n\nvoid *goBack(Time *time, int min){\n\n\ttime->mm -= min;\n\tif(time->mm < 0){\n\t\ttime->mm += 60;\n\t\ttime->hh--;\n\t\tif(time->hh < 0)\n\t\t\ttime->hh += 24;\n\t}\n\n}\n\nint solve(Time *time, int n){\n\tint total = 0;\n\tint luck = 0;\n\n\tif(time->hh % 10 == 7 || time->mm % 10 == 7)\n\t\treturn total;\n\n\twhile(luck == 0){\n\t\ttotal++;\n\t\tgoBack(time,n);\n\t\tif(time->hh % 10 == 7 || time->mm % 10 == 7)\n\t\t\tluck = 1;\n\n\t}\n\n\treturn total;\n}\n\nint main(){\n\n\tint n;\n\tTime *time = (Time*)malloc(sizeof(Time));\n\n\tscanf(\"%d %d %d\",&n, &time->hh, &time->mm);\n\n\tprintf(\"%d\\n\",solve(time,n));\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint verif (int * h , int * m , int x ) {\nif ((*h==7)||(*m==7)||(*h%10==7)||(*m%10==7))\n {return 0 ;}\n*m-=x ;\nif (*m<0) {*h-=1 ; *m+=60;}\nif (*h>23) {*h=0;}\nif (*h<0) {*h=23;}\nreturn (1) ;\n\n\n}\n\n\nint main (){\nint x ,h,m ,s=0 ;\nscanf (\"%d\",&x) ;\nscanf (\"%d\",&h) ;\nscanf (\"%d\",&m) ;\nwhile (verif (&h,&m,x)) {\n s+=1 ; }\nprintf (\"%d\",s ) ;\n\nreturn (0) ;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x,n,m;\n\tscanf(\"%d%d%d\",&x,&n,&m);\n\tint i=0;\n\twhile(1){\n\t\tif(i!=0) m-=x;\n\t\tif(m<0){\n\t\t\tm=60+m;\n\t\t\tn--;\n\t\t\tif(n<0) n=24+n;\n\t\t}\n\t\tif(m%10==7||n%10==7){\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\treturn 0;\n\t\t}\n\t\ti++;\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint cmpfunc(const void *a, const void *b){\n return (*(int *)a) - (*(int *)b);\n}\n\nint main(){\n int x,h,m,count=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n while((h%10)!=7 && (m%10)!=7){\n if(x > m){\n m = 60 - (x-m);\n if(h==0) h = 23;\n else h--;\n }\n else{\n m -= x;\n }\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n int h,m;\n int ans=0;\n scanf(\"%d\",&a);\n scanf(\"%d%d\",&h,&m);\n while(h!=17&&h!=7&&m%10!=7)\n {\n ans++;\n m=m-a;\n if(m<0)\n {\n m=m+60;\n h--;\n }\n if(h<0)\n h=23;\n }\n printf(\"%d\\n\",ans);\n }\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,i,h,m,a,b;\n scanf(\"%d\",&k);\n scanf(\"%d %d\",&h,&m);\n for(i=0;i>=0;i++)\n {\n a=h%10;\n b=m%10;\n if(a==7||b==7)\n {\n break;\n }\n else\n {\n if(k>m)\n {\n m=m+60-k;\n h=h-1;\n if(h==-1)\n {\n h=23;\n }\n }\n else\n {\n m=m-k;\n }\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x, hh, mm, ans = 0;\n scanf(\"%d %d %d\", &x, &hh, &mm);\n\n if((hh == 07 || hh == 17) || (mm == 07 || mm == 17 || mm == 27 || mm == 37 || mm == 47 || mm == 57))\n ans = 0;\n else\n {\n while(1)\n {\n mm = mm - x;\n if(mm < 0)\n {\n hh--;\n mm = 60 + mm;\n }\n if(hh<0)\n hh = 23;\n ans++;\n if((hh == 07 || hh == 17) || (mm == 07 || mm == 17 || mm == 27 || mm == 37 || mm == 47 || mm == 57))\n break;\n }\n\n }\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,i,h,m,a,b;\n scanf(\"%d\",&k);\n scanf(\"%d %d\",&h,&m);\n for(i=0;i>=0;i++)\n {\n a=h%10;\n b=m%10;\n if(a==7||b==7)\n {\n break;\n }\n else\n {\n if(k>m)\n {\n m=m+60-k;\n h=h-1;\n if(h==-1)\n {\n h=23;\n }\n }\n else\n {\n m=m-k;\n }\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint x, nSnoozes;\nint hh, mm;\nint h, m;\n\nint checkLucky(int n)\n{\n\twhile (n > 0)\n\t{\n\t\tif (n % 10 == 7)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\tn = n / 10;\n\t}\n\treturn 0;\n}\n\nvoid cntSnoozes(int a, int b)\n{\n\t\n\tif (checkLucky(a) || checkLucky(b))\n\t{\n // printf(\"%d :%d nSnoozes : %d \\n\",a,b,nSnoozes);\n\t\treturn;\n\t}\n\telse\n\t{\n\t\tint tx = x, th = a, tm = b;\n\t\twhile (tm >= 0)\n\t\t{\n\t\t//\tprintf(\" in while%d :%d snooze is : %d \\n\",th,tm,nSnoozes);\n\t\t\ttm -= x; nSnoozes++;\n\t\t\t//printf(\" updated %d :%d nSnoozes :%d \\n\",th,tm,nSnoozes);\n\t\t\tif (tm < 0){\n\t\t\t//\tprintf(\"negative %d :%d nSnoozes : %d \\n\",th,tm,nSnoozes);\n\t\t\t\tbreak;}\n\t\t\t\t\n\t\t\telse if (checkLucky(tm))\n\t\t\t\treturn;\n\t\t}\n\t\tif (th == 0)\n\t\t{\n\t\t\tth = 23;\n\t\t}\n\t\telse th = th - 1;\n\n\t\ttm = 60 + tm; //nSnoozes++;\n\t//\tprintf(\" outside updated %d :%d nSnoozes : %d \\n\",th,tm,nSnoozes);\n\t\tcntSnoozes(th, tm);\n\t}\n\treturn;\n}\n\nint main()\n{\n\t\tx = hh = mm = nSnoozes = 0;\n\t\tscanf(\"%d\", &x);\n\t\tscanf(\"%d %d\", &h, &m);\n\n\t\tint th = checkLucky(h);\n\t\tint tm = checkLucky(m);\n\t\tif (th == 1 || tm == 1)\n\t\t\tnSnoozes = 0;\n\t\telse cntSnoozes(h, m);\n\t\tprintf(\"%d\\n\", nSnoozes);\n\t\treturn 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint x, hh, mm,ans;\nint main()\n{\n scanf(\"%d%d%d\", &x, &hh, &mm);\n while (1)\n {\n if (hh % 10 == 7 || mm % 10 == 7)break;\n ans++;\n mm -= x;\n if (mm < 0)\n {\n hh--;\n mm += 60;\n }\n if (hh < 0)hh += 24;\n }\n printf(\"%d\", ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint x,h,m;\n\tint lh,lm;\n\tint cnt = 0;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\tfor(;;){\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tm = m - x;\n\t\tcnt++;\n\t\tif(m<0){\n\t\t\tm = 60 + m;\n\t\t\th = h - 1;\n\t\t\tif(h<0){\n\t\t\t\th = 23;\n\t\t\t}\n\t\t}\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,arr[4],a,b,c,d,count=0;\n\tscanf(\"%d\",&x);\n\tc=x/10;\n\td=x%10;\n\tscanf(\"%d %d\",&a,&b);\n\tarr[0]=a/10;\n\tarr[1]=a%10;\n\tarr[2]=b/10;\n\tarr[3]=b%10;\n\n\tif(arr[0]==7 || arr[1]==7 || arr[2]==7 || arr[3]==7)\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\twhile(1)\n\t\t{\n\t\t\tarr[3]-=d;\n\t\t\tif(arr[3]<0)\n\t\t\t{\n\t\t\t\tarr[3]+=10;\n\t\t\t\tarr[2]--;\n\t\t\t}\n\t\t\tarr[2]-=c;\n\t\t\tif(arr[2]<0)\n\t\t\t{\n\t\t\t\tarr[2]+=6;\n\t\t\t\tarr[1]--;\n\t\t\t}\n\t\t\tif(arr[1]<0)\n\t\t\t{\n\t\t\t\tif(arr[0]==0)\n\t\t\t\t{\n\t\t\t\t\tarr[1]+=4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tarr[1]+=10;\n\t\t\t\t}\n\t\t\t\tarr[0]--;\n\t\t\t}\n\t\t\tif(arr[0]<0)\n\t\t\t{\n\t\t\t\tarr[0]+=3;\n\t\t\t}\n\t\t\tcount++;\n\t\t\t//printf(\"%d%d %d%d\\n\",arr[0],arr[1],arr[2],arr[3]);\n\t\t\tif(arr[0]==7 || arr[1]==7 || arr[2]==7 || arr[3]==7)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tprintf(\"%d\\n\",count );\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x, h, m, count;\n count = 0;\n scanf(\"%d %d %d\", &x, &h, &m);\n for(;;)\n {\n if(m%10 == 7 || h%10 == 7)\n {\n printf(\"%d\", count);\n break;\n }\n else\n {\n m = m - x;\n if(m < 0)\n {\n h--;\n m = m + 60;\n }\n if(h < 0)\n {\n h = h + 24;\n }\n }\n count++;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,hh,mm;\n\tint h,m;\n\tint a,i;\n\t\n\tscanf(\"%d\", &x);\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tfor(i=0; ; i++)\n\t{ \n\t h=hh%10;\n\t\tm=mm%10;\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh=hh-1;\n\t\t}\n\t\tif(hh<0)\n\t\t{\n\t\t\thh=hh+24;\n\t\t}\n\t\t\n\t\tif(h==7 || m==7 || (hh==7 && mm==0) )\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint x, h, m;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d%d\",&h,&m);\n\t\n\tint cont=0;\n\tif(!(h==17 || h==7 || m%10 == 7)){\n\t\tdo{\n\t\t\tm-=x;\n\t\t\tif(m<0){\n\t\t\t\tm += 60; \n\t\t\t\th -= 1;\n\t\t\t}\n\t\t\tif(h<0){\n\t\t\t\th+=24;\n\t\t\t}\n\t\t\tcont++;\n\t\t}while(h!=17 && h!=7 && m%10 != 7);\n\t}\n\tprintf(\"%d\\n\",cont);\n}"}, {"source_code": "#include<stdio.h>\nint is_lucky(int hh, int mm);\nint main()\n{\n int hh,mm,x,y,i,j;\n while(scanf(\"%d\",&x)==1){\n scanf(\"%d %d\",&hh,&mm);\n y=0;\n\n while(is_lucky(hh,mm)!=1){\n mm=mm-x;\n y++;\n if(mm<0){\n mm=60+mm;\n hh--;\n }\n if(hh<0)\n hh=24+hh;\n\n }\n printf(\"%d\\n\",y);\n }\n return 0;\n}\nint is_lucky(int hh, int mm)\n{\n while(mm!=0){\n if(mm%10==7)\n return 1;\n mm/=10;\n }\n while(hh!=0){\n if(hh%10==7)\n return 1;\n hh/=10;\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,hh,mm;\n\tint h,m;\n\tint a,i;\n\t\n\tscanf(\"%d\", &x);\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tfor(i=0; ; i++)\n\t{ \n\t h=hh%10;\n\t\tm=mm%10;\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh=hh-1;\n\t\t}\n\t\tif(hh<0)\n\t\t{\n\t\t\thh=hh+24;\n\t\t}\n\t\t\n\t\tif(h==7 || m==7 || (hh==7 && mm==0) )\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,h,m,a,b,c,d,e,z,t=0,flag=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n if(z==7||a==7||b==7||c==7)\n printf(\"0\");\n else\n {\n while(z!=7&&a!=7&&b!=7&&c!=7)\n {\n flag++;\n if(x<m)\n {\n\n\n m=m-x;\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n\n }\n else\n {\n\n if(h==00)\n {\n h=23;\n m=60-(x-m);\n }\n else\n {\n h=h-1;\n m=60-(x-m);\n }\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n }\n }\n if(m==60)\n printf(\"%d\",flag+1);\n else\n printf(\"%d\",flag);\n // printf(\"\\n%d %d\",h,m);\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n\tint i,x,m,h,y=1,ok=0;\n\tchar ch[6];\n\tscanf(\"%d\\n\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\tdo{\n\tsprintf(ch,\"%d%d\",h,m);\n\tfor(i=0;i<strlen(ch);i++){\n\tif(ch[i]=='7')\n\tok=1;}\n\tm=m-x;\n\tif(m<0){\n\tif((h-1)<0){\n\th=23;\n\tm=60+m;}\n\telse {\n\th=h-1;\n\tm=60+m;}} \n\n\ty=y+1;\n\t}while((ok==0));\n\tprintf(\"%d\",y-2);\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint s,h,m,ans=0;\n\tscanf(\"%d\",&s);\n\tscanf(\"%d %d\",&h,&m);\n\n\tfor (; ;)\n\t{\n\t\tif (h==07 || h==17 || m==07 || m==17 || m==27 || m==37 || m==47 || m==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tm=m-s;\n\t\tif (m<0)\n\t\t{\n\t\t\th--;\n\t\t\tm=60+m;\n\t\t}\n\t\tif (h<0)\n\t\t{\n\t\t\th=23;\n\t\t}\n\t\tans++;\n\t\tif (m==07 || m==17 || m==27 || m==37 || m==47 || m==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int x,hh,mm,ans=0;\n scanf(\"%d %d %d\",&x,&hh,&mm);\n while(mm%10!=7){\n if(hh%10==7){\n break;\n }\n if(mm>=x){\n mm-=x;\n }\n else{\n mm=60-(x-mm);\n if(hh==0){\n hh=23;\n }\n else{\n hh--;\n }\n }\n ans++;\n\n }\n printf(\"%d\",ans);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,i,h,m,a,b;\n scanf(\"%d\",&k);\n scanf(\"%d %d\",&h,&m);\n for(i=0;i>=0;i++)\n {\n a=h%10;\n b=m%10;\n if(a==7||b==7)\n {\n break;\n }\n else\n {\n if(k>m)\n {\n m=m+60-k;\n h=h-1;\n if(h==-1)\n {\n h=23;\n }\n }\n else\n {\n m=m-k;\n }\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint contains(int m){\n int r;\n while(m > 0){\n r = m % 10;\n if(r == 7)\n return 0;\n m = m /10;\n }\n return 1;\n \n}\nint main() {\n /* Enter your code here. Read input from STDIN. Print output to STDOUT */ \n int t;\n scanf(\"%d\",&t);\n int m,n;\n scanf(\"%d%d\",&m,&n);\n long long int c = 0;\n while(contains(m) && contains(n)){\n \n n = n - t;\n \n c++;\n if(n < 0){\n m = m - 1;\n if(m == -1)\n m = 23;\n n = n + 60;\n }\n \n }\n printf(\"%lld\\n\",c);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint pd(int a,int b)\n{\n\tif(b==07||b==17||b==27||b==37||b==47||b==57||a==07||a==17||a==27||a==37||a==47||a==57)\n\treturn 0;\n\telse\n\treturn 1;\n}\nint main(int argc, char *argv[])\n{\n\tint x,k,count;\n\tint a,b;\n\t\tscanf(\"%d\",&x);\n\t\tscanf(\"%d %d\",&a,&b);\n\tcount=0;\n\tk=pd(a,b);\n\tif(k==0)\n\tprintf(\"0\\n\");\n\telse\n\t{\n\t\twhile(k)\n\t\t{\n\t\t\tb-=x;\n\t\t\twhile(b<0)\n\t\t\t{\n\t\t\t\tb+=60;\n\t\t\t\ta--;\n\t\t\t\tif(a<0)\n\t\t\ta=23;\t\n\t\t\t}\n\t\t\tcount++;k=pd(a,b);\n\t\t}\n\t\tprintf(\"%d\\n\",count);\n\t}\n\treturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n// - WRONG in isluck\n// - timeout\nbool isluck(int h, int m) {\n return h % 10 == 7 || m % 10 == 7;\n}\nint luck(int h, int m, int x) {\n int cnt = 0;\n for (cnt = 0; !isluck(h, m); cnt++) {\n m -= x;\n if (m < 0) {\n m += 60;\n h -= 1;\n if (h < 0) {\n h += 24;\n }\n }\n }\n // printf(\"%d %d\\n\", h, m);\n return cnt;\n}\nint test();\nint main() {\n#if 1\n int x;\n int h, m;\n scanf(\"%d\", &x);\n scanf(\"%d%d\", &h, &m);\n printf(\"%d\\n\", luck(h, m, x));\n return 0;\n#else\n return test();\n#endif\n}\n\nint unit(int h, int m, int x, int e) {\n int r;\n if (e != (r = luck(h, m, x))) {\n printf(\"fail at luch(%d, %d, %d) = %d != %d\\n\", h, m, x, r, e);\n }\n}\nint test() {\n unit(11, 23, 3, 2);\n unit(1, 7, 5, 0);\n unit(0, 0, 3, 1);\n unit(0, 0, 1, 3);\n unit(0, 0, 2, 181);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n// 1 means lucky\nint check(int a,int b)\n{if(a%10==7 || b%10==7)\nreturn 1;\nelse\nreturn 0;\n}\nint main() \n {int x,a,b,count=0;\n scanf(\"%d %d %d\",&x,&a,&b);\n while(check(a,b)==0)\n { count++;\n if((b-x)>=0)\n b=b-x;\n else\n {b=b-x+60;\n if(a-1<0)\n a=a-1+24;\n else\n a=a-1;\n }\n \n \n \n }\n printf(\"%d\",count);\n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,n,i,j,k,count=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n if(h%10==7 || m%10==7)\n {\n printf(\"0\\n\");\n }\n else\n {\n while(1)\n {\n if(m%10==7 || h%10==7)\n break;\n m-=x;\n count++;\n if(m<0)\n {\n m+=60;\n h--;\n }\n if(h<0)\n {\n h+=24;\n\n }\n }\n\n printf(\"%d\\n\",count);\n }\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint fun(int h, int m){\n\tif(m%10==7 || h%10==7)return 0;\n\treturn 1;\n}\nint main(){\n\tint x,h,m,h1,m1,ans=0;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\th1=h;\n\tm1=m;\n\twhile(fun(h,m)){\n\t\tans++;\n\t\tm-=x;\n\t\tif(m<0){\n\t\t\th--;\n\t\t\tif(h<0)h=23;\n\t\t\tm+=60;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdbool.h>\n\n#define max(A, B) ((A > B) ? A : B)\n#define min(A, B) ((A > B) ? B : A)\n#define INF 999999\n\nint x;\nint h, m;\n\nint main()\n{\n int ans;\n int y;\n\n scanf(\"%d\", &x);\n scanf(\"%d%d\", &h, &m);\n if (h == 7 || h == 17 || m % 10 == 7)\n printf(\"0\");\n else{\n if (h > 17) {\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else if (h < 7) {\n y = 0;\n h += 24;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else{\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 7) {\n ans = y;\n break;\n }\n }\n }\n printf(\"%d\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint is_lucky(int hh, int mm);\nint main()\n{\n int hh,mm,x,y,i,j;\n while(scanf(\"%d\",&x)==1){\n scanf(\"%d %d\",&hh,&mm);\n y=0;\n\n while(is_lucky(hh,mm)!=1){\n mm=mm-x;\n y++;\n if(mm<0){\n mm=60+mm;\n hh--;\n }\n if(hh<0)\n hh=24+hh;\n\n }\n printf(\"%d\\n\",y);\n }\n return 0;\n}\nint is_lucky(int hh, int mm)\n{\n while(mm!=0){\n if(mm%10==7)\n return 1;\n mm/=10;\n }\n while(hh!=0){\n if(hh%10==7)\n return 1;\n hh/=10;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check(int h,int m){\n\tif(h%10==7||m%10==7)\n\t\treturn 0;\n\th/=10;\n\tm/=10;\n\tif(h%10==7||m%10==7)\n\t\treturn 0;\n\treturn 1;\n}\nvoid adjust(int *h,int *m,int x){\n\tif(*m<x){\n\t\tif(*h==0)\n\t\t\t*h=23;\n\t\telse\n\t\t\t*h=*h-1;\n\t\t*m=*m+60;\n\t}\n\t*m=*m-x;\n\t\n}\nint main(){\n\tint x,h,m;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\tint count=0;\n\twhile(check(h,m)){\n\t\tcount++;\n\t\tadjust(&h,&m,x);\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,i,j,a,b,c,d,sum;\n while(scanf(\"%d\",&x)!=EOF)\n {\n sum=0;\n scanf(\"%d%d\",&h,&m);\n a=h/10;\n b=h%10;\n c=m/10;\n d=m%10;\n while(b!=7&&d!=7)\n {\n m-=x;\n if(m<0)\n {\n m+=60;\n h-=1;\n if(h<0)\n {\n h+=24;\n }\n }\n b=h%10;\n d=m%10;\n sum++;\n }\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tint x,h,m;\n\tint lh,lm;\n\tint cnt = 0;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\tfor(;;){\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tm = m - x;\n\t\tcnt++;\n\t\tif(m<0){\n\t\t\tm = 60 + m;\n\t\t\th = h - 1;\n\t\t\tif(h<0){\n\t\t\t\th = 23;\n\t\t\t}\n\t\t}\n\t\tif(m%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t\tif(h%10==7){\n\t\t\tprintf(\"%d\",cnt);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,h,m,ans=0;\n scanf(\"%d %d %d\",&x,&h,&m);\n while(m % 10 != 7 && h % 10 != 7)\n {\n m -= x;\n if(m < 0)\n {\n m += 60;\n h--;\n if(h < 0)\n h += 24;\n }\n ans++;\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, x, y, i;\n scanf(\"%d %d %d\", &n, &x, &y);\n for(i=0; ; i++)\n {\n if(x%10==7 || y%10==7)break;\n y-=n;\n if(y<0)y+=60, x--;\n if(x<0)x=23;\n }\n printf(\"%d\", i);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint x,y,n,count=0;\nscanf(\"%d\",&n);\nscanf(\"%d%d\",&x,&y);\nwhile(!(((x%10)==7)||((y%10)==7)))\n{y=y-n;\n if(y<0){\n x=x-1;\n y+=60;}\nif(x<0){\n x=23;\nif(y<0)\n y=60;\n}\ncount++;\n\n}\nprintf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n// 1 means lucky\nint check(int a,int b)\n{if(a%10==7 || b%10==7)\nreturn 1;\nelse\nreturn 0;\n}\nint main() \n {int x,a,b,count=0;\n scanf(\"%d %d %d\",&x,&a,&b);\n while(check(a,b)==0)\n { count++;\n if((b-x)>=0)\n b=b-x;\n else\n {b=b-x+60;\n if(a-1<0)\n a=a-1+24;\n else\n a=a-1;\n }\n \n \n \n }\n printf(\"%d\",count);\n }"}, {"source_code": "#include<stdio.h>\n#include<stdbool.h>\nbool ThereIsSeven(int num)\n{\n while (num!=0)\n {\n if (num%10==7)\n return true;\n num/=10;\n }\n return false;\n\n}\nint main()\n{\n int x, hh, mm;\n int count=0;\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &hh,&mm);\n while (ThereIsSeven(hh)==false && ThereIsSeven(mm)==false)\n {\n mm=mm-x;\n if (mm<0)\n {\n mm=mm+60;\n hh=hh-1;\n hh=(hh+24)%24;\n }\n count++;\n }\n printf(\"%d\", count);\n return 0;\n\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,hh,mm,c=0;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n while(1)\n { \n if(hh%10==7||mm%10==7)\n {printf(\"%d\",c);\n break;\n }\n else\n { mm-=x;\n c++;\n if(mm<0)\n { mm+=60;\n hh--;\n if(hh<0)\n hh+=24;\n }\n }\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint fact(int x,int y);\nint main()\n{\n\tint x,m,n;\n\twhile(scanf(\"%d\\n\",&x)!=EOF)\n\t{\n\t\tscanf(\"%d %d\",&m,&n);\n\t\tint i,j,s=0;\n\t\tif(fact(m,n)==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse \n\t\t{\n\t\t\twhile(1)\n\t\t\t{\n\t\t\t\tif(n>=x)\n\t\t\t\t{\n\t\t\t\t\tn-=x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(m>0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm-=1;\n\t\t\t\t\tn+=60-x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(m==0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm=23;n=n+60-x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%d\\n\",s);\n\t\t}\n\t\t\n\t}\n} \nint fact(int x,int y)\n{\n\tint s=0;\n\tif(x/10==7||y/10==7)\n\t{\n\t\ts=1;\n\t}\n\tif(x%10==7||y%10==7)\n\t{\n\t\ts=1;\n\t}\n\treturn s;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x,shi,fen,c=0;\n scanf(\"%d\",&x);\n scanf(\"%d%d\",&shi,&fen);\n while(1)\n {\n if(shi%10==7 || fen%10==7)\n break;\n fen-=x;\n if(fen<0)\n {\n fen=60+fen;\n shi-=1;\n if(shi<0)\n shi=24+shi;\n }\n c++;\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;\n\nscanf(\"%lld%lld%lld\",&n,&a,&b);\ncount=0;\n\nwhile(a%10!=7 && b%10!=7){\n b-=n;\n count++;\n if(b<0){\n b=60+b;\n a--;\n }\n if(a<0){\n a=23;\n }\n}\nprintf(\"%lld\",count);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint x;\n\tscanf(\"%d\",&x);\n\tint h=0,m=0;\n\tscanf(\"%d%d\",&h,&m);\n\tint cnt=0;\n\twhile(h%10!=7&&m%10!=7){\n\t\tm=m-x;\n\t\tif(m<0){\n\t\t\tm=60+m;\n\t\t\th=h-1;\n\t\t\tif(h<0){\n\t\t\t\th=23;\n\t\t\t}\n\t\t}\n\t\tcnt++;\n\t} \n\tprintf(\"%d\\n\",cnt);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,hh,mm;\n\tint h,m;\n\tint a,i;\n\t\n\tscanf(\"%d\", &x);\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tfor(i=0; ; i++)\n\t{ \n\t h=hh%10;\n\t\tm=mm%10;\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh=hh-1;\n\t\t}\n\t\tif(hh<0)\n\t\t{\n\t\t\thh=hh+24;\n\t\t}\n\t\t\n\t\tif(h==7 || m==7 || (hh==7 && mm==0) )\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint x,y,z,s;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&y,&z);\n\twhile(y%10!=7&&z%10!=7)\n\t{\n\t\ts++;\n\t\tz=z-x;\n\t\tif(z<0)\n\t\t{\n\t\t\ty--;\n\t\t\tz=z+60;\n\t\t}\n\t\tif(y<0)\n\t\ty=23;\n\t}\n\tprintf(\"%d\",s);\n\treturn 0;\n } "}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int n,hh,mm,c=0;\nscanf(\"%d%d%d\",&n,&hh,&mm);\n\n\nwhile(1)\n\n{if(hh%10==7||mm%10==7){\n break;\n\n}\n\nelse{\n if(mm-n>=0){\n mm=mm-n;\n c++;\n\n }\n else\n {\n mm=60+mm-n;\n c++;\n if(hh-1>=0){\n hh=hh-1;\n }\n else\n { hh=23;\n\n }\n }\n}\n\n\n}\nprintf(\"%d\",c);\n\n\n\n return 0;}"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint x,hh,mm;\n\tscanf(\"%d %d %d\",&x,&hh,&mm);\n\tint sum;\n\tfor(sum=0;;){\n\t\tif(mm%10==7 ||mm/10==7||hh%10==7||hh/10==7){\n\t\t\tbreak;\n\t\t}\n\t\tmm-=x;\n\t\tif(mm<0){\n\t\t\thh-=1;\n\t\t\tmm+=60;\n\t\t}\n\t\tif(hh<0) hh+=24;\n\t\tsum++; \n\t}\n\tprintf(\"%d\\n\",sum,hh,mm);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint counter=0;\n\nvoid check(int hh, int mm, int snooze){\n\t\n\twhile(mm % 10 != 7 && hh % 10 != 7){\n\t\tmm -= snooze;\n\t\tif(mm < 0){\n\t\t\tmm = mm + 60;\n\t\t\thh--;\n\t\t\tif(hh < 0)\n\t\t\t\thh = hh + 24;\n\t\t}\n\t\tcounter++;\n\t}\n\t//printf(\"%d\",counter);\t\t\n}\n\nint main(void){\n\tint snooze;\n\tint hh, mm;\n\t//int finalcounter=0;\n\t\n\tscanf(\"%d\",&snooze);\t\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tcheck(hh,mm,snooze);\n\t\n\tprintf(\"%d\\n\",counter);\n\treturn 0;\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int s,h,m,i,co=0,mm;\n scanf(\"%d%d%d\",&s,&h,&m);\n for(i=1;;i++)\n {\n if(h==7||h==17||m==7||m==17||m==27||m==37||m==47||m==57)\n {\n printf(\"%d\",co);\n break;\n }\n co++;\n mm=m-s;\n \n m=(mm<0)? 60+mm : mm ;\n h=(mm<0)? h-1 : h ;\n h=(h<0)? 24+h : h ;\n }\n \n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint lucky_checker(int h,int m);\nvoid time_minus(int *h, int *m);\n\nint main()\n{\n\tint x,hour,min,counter=0;\n\tfloat button_times;\n\tint loop_x;\n\n\tscanf(\"%d %d %d\",&x,&hour,&min);\n\tloop_x = x;\n\n\twhile(! lucky_checker(hour,min)) {\n\t\tcounter++;\n\t\tloop_x = x;\n\t\twhile(loop_x--) {\n\t\t\t//printf(\"%d\\n\",loop_x);\n\t\t\t//getchar();\n\t\t\ttime_minus(&hour,&min);\n\t\t}\n\t\t//printf(\"%d:%d\\n\",hour,min);\n\t}\n\t//printf(\"%d %d\\n\",hour,min);\n\t//button_times = (float)counter/x;\n\t//if (button_times>0 && button_times<1)\n\t\t//button_times=1;\n\t\n\t//printf(\"%d\\n\",(int)button_times);\n\tprintf(\"%d\\n\",counter);\n\n//\tcheck 7\n//\tno 7\n//\tminus 1 min\n//\tcheck 7 or change hour\n\n\treturn 0;\n}\n\nint lucky_checker(int h,int m)\n{\n\tint lucky=0,checker_7;\n\twhile(h || m) {\n\t\tchecker_7 = h%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Hour yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\th/=10;\n\n\t\tchecker_7 = m%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Min yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\tm/=10;\n\t}\n\treturn lucky;\n}\n\nvoid time_minus(int *h, int *m)\n{\n\tif (*m == 0) {\n\t\t*h-=1;\n\t\t*m = 59;\n\t\tif (*h < 0) {\n\t\t\t*h = 23;\n\t\t}\n\t}\n\telse {\n\t\t*m -=1;\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{ int t,x,y,i;\n scanf(\"%d%d%d\",&t,&x,&y);\n for(i=0;;i++)\n { if(x%10==7||y%10==7)\n break;\n y-=t;\n if(y<0&&x==0)\n { x=23;\n y=60+y;\n }\n else if(y<0)\n {y=y+60;\n x--;}\n }\n printf(\"%d\",i);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint x, h, m;\n\tint cnt = 0;\n\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\twhile(m%10 != 7 && m/10 != 7 && h%10 != 7 && h/10 != 7){\n\t\tm -= x;\n\t\tif(m < 0){\n\t\t\tm = 60 + m;\n\t\t\th--;\n\t\t\tif(h < 0){\n\t\t\t\th = 23;\n\t\t\t}\n\t\t}\n\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\",cnt);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nlong long find(long long h,long long m){\nlong long k;\nwhile(h!=0){\nk=h%10;\nif(k==7){\nreturn 0;};\nh=h/10;}\n\nwhile(m!=0){\nk=m%10;\nif(k==7){\nreturn 0;}\nm=m/10;}\n\nreturn -1;}\n\n\nvoid main(){\nlong long x,h,m,k1,k2,k,count=0;\nscanf(\"%lld\",&x);\nscanf(\"%lld %lld\",&h,&m);\n\nk1=h;k2=m;\n\nwhile(k2!=0){\nk=k2%10;\nif(k==7){\nprintf(\"0\\n\");exit(0);};\nk2=k2/10;}\n\nwhile(k1!=0){\nk=k1%10;\nif(k==7){\nprintf(\"0\\n\");exit(0);}\nk1=k1/10;}\n\nwhile(1){\n\ncount++;\n\nif(m<x){\nm=60-(x-m);\nif(h==0)\n\th=23;\nelse\nh=h-1;\n\nif(find(h,m)==0){\nprintf(\"%lld\\n\",count);exit(0);}}\n\nelse if(m>=x){\nm=m-x;\n\nif(find(h,m)==0){\nprintf(\"%lld\\n\",count);exit(0);}}\n\n}\n\nexit(0);}\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int x,h,m,i=0,j=0,k=0,l=1;\n scanf(\"%d %d %d\",&x,&h,&m);\n while(l)\n {\n if(h==7||m%10==7||h==17)\n l=0;\n else\n {\n m=m-x;\n if(m<0)\n {\n if(h==0)\n h=23;\n else\n h--;\n m=60+m;\n }\n j++;\n }\n }\n printf(\"%d\",j);\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x,y;\n long long int i=0;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n\n else\n {\n while(h!=7&&h!=17&&h!=27&&h!=37&&h!=47&&h!=57&&m!=7&&m!=17&&m!=27&&m!=37&&m!=47&&m!=57)\n {\n if(m>=x)\n {\n m-=x;\n i++;\n continue;\n }\n if(h!=0)\n {\n h--;\n y=x-m;\n m=60-y;\n i++;\n continue;\n }\n h=23;\n y=x-m;\n m=60-y;\n i++;\n }\n printf(\"%ld\",i);\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(){\n\n int i,x,hh,mm,snooze=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hh,&mm);\n while(1){\n\n condition:\n if((hh==7)||(hh==17)||(mm%10==7)){\n break;\n }\n if(x>mm){\n mm = 60-x+mm;\n snooze++;\n hh--;\n if(hh<0){\n hh = 23;\n }\n goto condition;\n }\n mm-=x;\n snooze++;\n\n }\n\n printf(\"%d \",snooze);\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"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int k,i,h,m,a,b;\n scanf(\"%d\",&k);\n scanf(\"%d %d\",&h,&m);\n for(i=0;i>=0;i++)\n {\n a=h%10;\n b=m%10;\n if(a==7||b==7)\n {\n break;\n }\n else\n {\n if(k>m)\n {\n m=m+60-k;\n h=h-1;\n if(h==-1)\n {\n h=23;\n }\n }\n else\n {\n m=m-k;\n }\n }\n }\n printf(\"%d\\n\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int h,hh,mm,m,x,y=0;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n m=mm;h=hh;\n while((m!=7)&&(m!=17)&&(m!=27)&&(m!=37)&&(m!=47)&&(m!=57)&&(h!=7)&&(h!=17))\n {\n if(m<x)\n {\n m=m+60;\n m=m-x;\n if(h==0)\n {\n h=24-1;\n }\n else\n {\n h=h-1;\n }\n y++;\n }\n else\n {\n m=m-x;\n y++;\n }\n }\n printf(\"%d\\n\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int x;\n scanf(\"%d\",&x);\n int hh,mm,tempMM,count,tempHH;\n scanf(\"%d %d\",&hh,&mm);\n \n if((hh == 17)||(hh == 7)||(mm % 10 == 7))\n printf(\"0\\n\");\n else{\n tempMM = mm , tempHH = hh,count = 0;\n while(1){\n if((tempMM % 10 == 7) || (tempHH%10) == 7)\n break;\n if((tempMM - x) < 0){\n if(tempHH == 0)\n tempHH = 23;\n else\n tempHH--;\n }\n// tempHH--;\n if((tempMM - x)<0){\n tempMM = 60 + tempMM - x ;\n }else{\n tempMM = tempMM - x;\n } \n// tempMM = tempMM - x;\n count++;\n }\n printf(\"%d\\n\",count);\n }\n \n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint F(int x,int n,int m)\n{\n\tint i;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm-=x;\n\t\t\tif(m<0)\n\t\t\t{\n\t\t\t\tm+=60;\n\t\t\t\tn--;\n\t\t\t}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdbool.h>\n\n#define max(A, B) ((A > B) ? A : B)\n#define min(A, B) ((A > B) ? B : A)\n#define INF 999999\n\nint x;\nint h, m;\n\nint main()\n{\n int ans;\n int y;\n\n scanf(\"%d\", &x);\n scanf(\"%d%d\", &h, &m);\n if (h == 7 || h == 17 || m % 10 == 7)\n printf(\"0\");\n else{\n if (h > 17) {\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else if (h < 7) {\n y = 0;\n h += 24;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 17) {\n ans = y;\n break;\n }\n }\n }else{\n y = 0;\n while (1) {\n if (m - x < 0) {\n h--;\n m += 60;\n }\n m -= x;\n y++;\n if (m % 10 == 7 || h == 7) {\n ans = y;\n break;\n }\n }\n }\n printf(\"%d\", ans);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint seven(int x,int y)\n{\n\tint p;\n\tif(x==7||y==7||(x/10)==7||(y/10)==7)\n\t\treturn 1;\n\tx=x%10;\n\ty=y%10;\n\tif(x==7||y==7)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main()\n{\n\tint x,hh,mm,i=0,p=0;\n\tscanf(\"%d%d%d\",&x,&hh,&mm);\n\tfor(i=0;i<10000;i++)\n\t{\n\t\tif(seven(hh,mm)==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tif(x<=mm)\n\t\t{\n\t\t\tmm=mm-x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(x>mm)\n\t\t\t{\n\t\t\t\tmm=60+mm-x;\n\t\t\t\tif(hh==0)\n\t\t\t\t\thh=23;\n\t\t\t\telse\n\t\t\t\t\thh=hh-1;\n\t\t\t}\n\t\t}\n\t\tp++;\n\t}\n\tprintf(\"%d\\n\",p);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x, hr, mm, ans = 0, tm;\n\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &hr, &mm);\n tm = (hr * 60) + mm;\n\n while(1)\n {\n hr = tm / 60;\n mm = tm % 60;\n if(hr % 10 == 7 || mm % 10 == 7)\n break;\n else\n {\n ans++;\n if(tm < x)\n tm = tm + 1440;\n tm = tm - x;\n }\n }\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint lucky_checker(int h,int m);\nvoid time_minus(int *h, int *m);\n\nint main()\n{\n\tint x,hour,min,counter=0;\n\tfloat button_times;\n\tint loop_x;\n\n\tscanf(\"%d %d %d\",&x,&hour,&min);\n\tloop_x = x;\n\n\twhile(! lucky_checker(hour,min)) {\n\t\tcounter++;\n\t\tloop_x = x;\n\t\twhile(loop_x--) {\n\t\t\t//printf(\"%d\\n\",loop_x);\n\t\t\t//getchar();\n\t\t\ttime_minus(&hour,&min);\n\t\t}\n\t\t//printf(\"%d:%d\\n\",hour,min);\n\t}\n\t//printf(\"%d %d\\n\",hour,min);\n\t//button_times = (float)counter/x;\n\t//if (button_times>0 && button_times<1)\n\t\t//button_times=1;\n\t\n\t//printf(\"%d\\n\",(int)button_times);\n\tprintf(\"%d\\n\",counter);\n\n//\tcheck 7\n//\tno 7\n//\tminus 1 min\n//\tcheck 7 or change hour\n\n\treturn 0;\n}\n\nint lucky_checker(int h,int m)\n{\n\tint lucky=0,checker_7;\n\twhile(h || m) {\n\t\tchecker_7 = h%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Hour yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\th/=10;\n\n\t\tchecker_7 = m%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Min yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\tm/=10;\n\t}\n\treturn lucky;\n}\n\nvoid time_minus(int *h, int *m)\n{\n\tif (*m == 0) {\n\t\t*h-=1;\n\t\t*m = 59;\n\t\tif (*h < 0) {\n\t\t\t*h = 23;\n\t\t}\n\t}\n\telse {\n\t\t*m -=1;\n\t}\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n\ntypedef struct{\n\tint hh,mm;\n}Time;\n\nvoid *goBack(Time *time, int min){\n\n\ttime->mm -= min;\n\tif(time->mm < 0){\n\t\ttime->mm += 60;\n\t\ttime->hh--;\n\t\tif(time->hh < 0)\n\t\t\ttime->hh += 24;\n\t}\n\n}\n\nint solve(Time *time, int n){\n\tint total = 0;\n\tint luck = 0;\n\n\tif(time->hh % 10 == 7 || time->mm % 10 == 7)\n\t\treturn total;\n\n\twhile(luck == 0){\n\t\ttotal++;\n\t\tgoBack(time,n);\n\t\tif(time->hh % 10 == 7 || time->mm % 10 == 7)\n\t\t\tluck = 1;\n\n\t}\n\n\treturn total;\n}\n\nint main(){\n\n\tint n;\n\tTime *time = (Time*)malloc(sizeof(Time));\n\n\tscanf(\"%d %d %d\",&n, &time->hh, &time->mm);\n\n\tprintf(\"%d\\n\",solve(time,n));\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\n int x,hour,d,minute,click=0,snooze,c;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n c = hour;\n d = minute;\n while(1)\n {\n if(hour==0)\n {\n hour=24;\n\n }\n click++;\n\n if(x <= minute)\n snooze = minute-x;\n else\n {\n snooze = 60 + (minute-x);\n hour = hour-1;\n\n if(hour%10==7)\n {\n\n break;\n }\n }\n\n\n if(snooze%10==7)\n {\n\n break;\n }\n else\n minute=snooze;\n\n}\nif(c%10==7||d%10==7)\n click=0;\nprintf(\"%d\",click);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint x, hh, mm,ans;\nint main()\n{\n scanf(\"%d%d%d\", &x, &hh, &mm);\n while (1)\n {\n if (hh % 10 == 7 || mm % 10 == 7)break;\n ans++;\n mm -= x;\n if (mm < 0)\n {\n hh--;\n mm += 60;\n }\n if (hh < 0)hh += 24;\n }\n printf(\"%d\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\nint main()\n{\n int x;int y,v,s;v=0;\n int sa,sb,r;\n scanf(\"%d\",&x);\n int a,b;\n scanf(\"%d%d\",&a,&b);\n for(int i=0;i<10000;i++)\n {\n sb=abs(b);\n sa=abs(a);\n while(sb>0)\n {\n r=sb%10;\n sb=sb/10;\n if(r==7)\n {\n s=i;v=1;\n break;\n }\n }\n if(v==1)\n {\n break;\n }\n while(sa>0)\n {\n r=sa%10;\n sa=sa/10;\n if(r==7)\n {\n s=i;v=1;\n break;\n } \n }\n if(v==1)\n {\n break;\n }\n b=b-x;\n if(b<0)\n {\n b=60+b;\n a=a-1;\n }\n }\n printf(\"%d\",s);\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int x,h,m,t=0,sum=0;\n scanf(\"%d%2d%2d\",&x,&h,&m);\n while(1)\n {\n if((m-7)%10==0 || (h-7)%10==0){\n break;\n }\n m=m-x;\n if(m<0){\n h=h-1;\n m=m+60;\n }\n if(h<0){\n h=23;\n }\n sum++;\n }\n printf(\"%d\\n\",sum);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint F(int x,int n,int m)\n{\n\tint i;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{\n\t\t\tprintf(\"%d\\n\",i);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tm-=x;\n\t\t\tif(m<0)\n\t\t\t{\n\t\t\t\tm+=60;\n\t\t\t\tn--;\n\t\t\t}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x,shi,fen,c=0;\n scanf(\"%d\",&x);\n scanf(\"%d%d\",&shi,&fen);\n while(1)\n {\n if(shi%10==7 || fen%10==7)\n break;\n fen-=x;\n if(fen<0)\n {\n fen=60+fen;\n shi-=1;\n if(shi<0)\n shi=24+shi;\n }\n c++;\n }\n printf(\"%d\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint m,h;\nint time(int x)\n{\n if(m%10==7||m/10==7||h%10==7||h/10==7)\n {\n return 1;\n }\n if(m>=x)\n {\n m=m-x;\n }\n else\n {\n m=m+60-x;\n h--;\n }\n if(h==-1)\n {\n h=23;\n }\n return 0;\n}\nint main()\n{\n int x;\n int y=0;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(1)\n {\n if(time(x)==1)\n {\n printf(\"%d\\n\",y);\n break;\n }\n else\n {\n y++;\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint seven(int x,int y)\n{\n\tint p;\n\tif(x==7||y==7||(x/10)==7||(y/10)==7)\n\t\treturn 1;\n\tx=x%10;\n\ty=y%10;\n\tif(x==7||y==7)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main()\n{\n\tint x,hh,mm,i=0,p=0;\n\tscanf(\"%d%d%d\",&x,&hh,&mm);\n\tfor(i=0;i<10000;i++)\n\t{\n\t\tif(seven(hh,mm)==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tif(x<=mm)\n\t\t{\n\t\t\tmm=mm-x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(x>mm)\n\t\t\t{\n\t\t\t\tmm=60+mm-x;\n\t\t\t\tif(hh==0)\n\t\t\t\t\thh=23;\n\t\t\t\telse\n\t\t\t\t\thh=hh-1;\n\t\t\t}\n\t\t}\n\t\tp++;\n\t}\n\tprintf(\"%d\\n\",p);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n\tint x, hh, mm, res = 0;\n\tscanf(\"%d\", &x);\n\tscanf(\"%d%d\", &hh, &mm);\n\n\twhile ((hh - 7) % 10 != 0 && (mm - 7) % 10 != 0) {\n\t\tmm -= x;\n\t\tif (mm < 0) {\n\t\t\tmm += 60;\n\t\t\tif (hh == 0) {\n\t\t\t\thh = 24;\n\t\t\t}\n\t\t\t--hh;\n\t\t}\n\t\t++res;\n\t}\n\n\tprintf(\"%d\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint x, h, m;\n\tint cnt = 0;\n\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&h,&m);\n\twhile(m%10 != 7 && m/10 != 7 && h%10 != 7 && h/10 != 7){\n\t\tm -= x;\n\t\tif(m < 0){\n\t\t\tm = 60 + m;\n\t\t\th--;\n\t\t\tif(h < 0){\n\t\t\t\th = 23;\n\t\t\t}\n\t\t}\n\t\tcnt++;\n\t}\n\tprintf(\"%d\\n\",cnt);\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nmain()\n{\n int x,h,m,i=0,j=0,k=0,l=1;\n scanf(\"%d %d %d\",&x,&h,&m);\n while(l)\n {\n if(h==7||m%10==7||h==17)\n l=0;\n else\n {\n m=m-x;\n if(m<0)\n {\n if(h==0)\n h=23;\n else\n h--;\n m=60+m;\n }\n j++;\n }\n }\n printf(\"%d\",j);\n}"}, {"source_code": "#include <stdio.h>\nint main ()\n{\nint hh,mm,x,h,m,c;\nscanf(\"%d %d %d\",&x,&hh,&mm);\n\nfor (h=hh,m=mm,c=0; ;c++ )\n{\n\t// lucky\nif ( m%10==7 || (m/10)==7 || h%10==7 || (h/10)== 7)\nbreak;\n\n m=m-x;\nif (m<0) {m=60+m; h--;}\nif (h<0) h=24+h;\n\n}\nprintf(\"%d\",c);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int x,hh,mm,ans=0;\n scanf(\"%d %d %d\",&x,&hh,&mm);\n while(mm%10!=7){\n if(hh%10==7){\n break;\n }\n if(mm>=x){\n mm-=x;\n }\n else{\n mm=60-(x-mm);\n if(hh==0){\n hh=23;\n }\n else{\n hh--;\n }\n }\n ans++;\n\n }\n printf(\"%d\",ans);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int x,hh,mm,i=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hh,&mm);\n while(((hh%10)!=7)&&((mm%10)!=7)){\n i++;\n if(mm<x){\n mm=(mm+60-x);\n if(hh==0)\n hh=23;\n else\n hh=hh-1;\n }\n else{\n mm=mm-x;\n }\n }\n printf(\"%d\",i);\n return 0;\n}\n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\nint main()\n{int hh,mm,x,y=0;\nscanf(\"%d\",&x);\nscanf(\"%d %d\",&hh,&mm);\nwhile(hh%10!=7 && mm%10!=7)\n{ mm=mm-x;\n y++;\n if(mm<0)\n\n {mm=mm+60;\n hh--;}\n if(hh<0)\n {hh=hh+24;}\n\n}\nprintf(\"%d\",y);\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main()\n{ int n,hh,mm,c=0,d;\nscanf(\"%d%d%d\",&n,&hh,&mm);\n\n\nwhile(1)\n\n{if(hh%10==7||mm%10==7){\n break;\n\n}\n\nelse{\n if(mm-n>=0){\n mm=mm-n;\n c++;\n\n }\n else\n {\n mm=60+mm-n;\n c++;\n if(hh-1>=0){\n hh=hh-1;\n }\n else\n { hh=23;\n\n }\n }\n}\n\n\n}\nprintf(\"%d\",c);\n\n\n\n return 0;}"}], "negative_code": [{"source_code": "#include <stdio.h>\nint check(int h,int m)\n{\n\tif((h%10)==7 || (m%10)==7)\n\t{\n\t\treturn 1;\n\t}\n\telse return 0;\n}\nint findy(int x,int h, int m)\n{\n\tint i=0,k=0;\n\tif(m<x)\n\t{\n\t\th--;\n\t\tm=(60+m)-x;\n\t\ti++;\n\t\tif(check(h,m))\n\t\t\treturn i;\n\t}\n\tif(m<x && h<=0)\n\t{\n\t\th=23;\n\t\tm=(60+m)-x;\n\t\ti++;\n\t\tif(check(h,m))\n\t\t\treturn i;\n\t}\n\telse\n\t{\n\t\tm=m-x;\n\t\ti++;\n\t\tif(check(h,m))\n\t\t\treturn i;\n\t}\n\treturn i+findy( x,h,m);\n}\nint main()\n{\n\tint x,h,m;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\tif(check(h,m))\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tint y;\n\t\ty=findy(x,h,m);\n\t\tprintf(\"%d\",y);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x,hh,mm;\n\tint h,m;\n\tint a,i;\n\t\n\tscanf(\"%d\", &x);\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tfor(i=0; ; i++)\n\t{ \n\t h=hh%10;\n\t\tm=mm%10;\n\t\t\n\t\tmm=mm-x;\n\t\tif(mm<=0)\n\t\t{\n\t\t\tmm=mm+60;\n\t\t\thh=hh-1;\n\t\t}\n\t\tif(hh<=0)\n\t\t{\n\t\t\thh=hh+24;\n\t\t}\n\t\t\n\t\tif(h==7 || m==7)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", i);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n {\n \tint h,m,x,y;\n while(~scanf(\"%d\",&x))\t{ \n \tscanf(\"%2d%2d\",&h,&m);\n \tif(h%10==7||m%10==7) y=0;\n \telse if(m<7) \n \t{\n \t\tif(h==8||h==18) y=floor((m+1)*1.0/x+0.999); \n \t\telse y=floor((m+3)*1.0/x+0.999); \n\t }\n\telse \n\t{\n\t\t\tif(m<17) y=floor((m-7)*1.0/x+0.999); \n\t\telse if(m<27) y=floor((m-17)*1.0/x+0.999); \n\t\telse if(m<37) y=floor((m-27)*1.0/x+0.999); \n\t\telse if(m<47) y=floor((m-37)*1.0/x+0.999); \n\t\telse if(m<57) y=floor((m-47)*1.0/x+0.999); \n\t\telse if(m==58||m==59) y=floor((m-57)*1.0/x+0.999); \n\t} \n\tprintf(\"%d\\n\",y);} \n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,h,m,a,b,c,d,e,z,flag=0;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n if(z==7||a==7||b==7||c==7)\n printf(\"0\");\n else\n {\n while(z!=7&&a!=7&&b!=7&&c!=7)\n {\n flag++;\n if(x<m)\n {\n m=m-x;\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n }\n else\n {\n if(h==00)\n {\n h=23;\n m=60-(x-m);\n }\n else\n {\n h=h-1;\n m=60-(x-m);\n }\n z=m%10;\n a=m%100;\n b=h%10;\n c=h%100;\n }\n }\n\n printf(\"%d\",flag);\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,a,b,r1,r2,xx,yy,i,aa,c=0,sum;\n scanf(\"%d %d %d\",&x,&a,&b);\n\n r1=a%10;\n r2=b%10;\n if(r1==7 || r2==7) printf(\"0\");\n else\n {\n if(r1<7)\n {\n if(r2>7) xx=r2-7;\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx;; i+=10)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n }\n else if(r1==8)\n {\n sum=b+1;\n if(r2>7) xx=r2-7;\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx; i<=sum; i+=10)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n xx=i;\n aa=sum-i;\n xx+=aa;\n for(i=xx;; i++)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n return 0;\n }\n c++;\n if(c==60) break;\n }\n xx+=3;\n for(i=xx; i<2500; i++)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n printf(\"sum=====%d\\n\",sum);\n return 0;\n }\n }\n\n }\n else if(r1>7)\n {\n a=a-18;\n sum=(a*60)+b+1;\n if(r2>7) xx=r2-7;\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx; i<=sum; i+=10)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\\n\",y);\n return 0;\n }\n }\n xx=i;\n aa=sum-i;\n xx+=aa;\n for(i=xx;; i++)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n return 0;\n }\n c++;\n if(c==60) break;\n }\n xx+=3;\n for(i=xx; i<2500; i++)\n {\n y=i/x;\n if(x*y == i)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m!=0)\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m!=0)\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n {\n if(m==60)\n {\n m=m-x;\n h=h-1;\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n if(m==0)\n {\n m=60;\n\n }\n }\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x, hr, mm, ans = 0, tm;\n\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &hr, &mm);\n tm = (hr * 60) + mm;\n\n while(1)\n {\n hr = tm / 60;\n mm = tm % 60;\n if(hr % 10 == 7 || mm % 10 == 7)\n break;\n else\n {\n ans++;\n tm = tm - x;\n }\n }\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() \n{\n int x,i=0;\n scanf(\"%d\",&x);\n int a[2];\n scanf(\"%d%d\",&a[0],&a[1]);\n for(i=0;(a[0]%10)!=7 && (a[1]%10)!=7; )\n {\n if(a[1]>=x)\n {\n a[1]=a[1]-x;\n i++;\n }\n if(a[1]<x)\n {\n a[1]=a[1]+60-x;\n a[0]=a[0]-1;\n i++;\n }\n if(a[0]<0)\n a[0]=a[0]+24;\n }\n printf(\"%d\",i);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m!=0)\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n {\n \tint h,m,x,y;\n while(~scanf(\"%d\",&x))\t{ \n \tscanf(\"%2d%2d\",&h,&m);\n \tif(h%10==7||m%10==7) y=0;\n \telse if(m<7) \n \t{\n \t\tif(h==8||h==18) y=floor((m+1)*1.0/x+0.999); \n \t\telse y=floor((m+3)*1.0/x+0.999); \n\t }\n\telse \n\t{\n\t\t\tif(m<17) y=floor((m-7)*1.0/x+0.999); \n\t\telse if(m<27) y=floor((m-17)*1.0/x+0.999); \n\t\telse if(m<37) y=floor((m-27)*1.0/x+0.999); \n\t\telse if(m<47) y=floor((m-37)*1.0/x+0.999); \n\t\telse if(m<57) y=floor((m-47)*1.0/x+0.999); \n\t\telse if(m==58||m==59) y=floor((m-57)*1.0/x+0.999); \n\t} \n\tprintf(\"%d\\n\",y);} \n }"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,n,i,j,k,count;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n if(h%10==7 || m%10==7)\n {\n printf(\"0\\n\");\n }\n else\n {\n while(m>0)\n {\n m = m-x;\n count++;\n if(m%10==7 || h%10==7)\n break;\n if(m==0)\n {\n h = h-1;\n m = 60;\n m = m-x;\n count++;\n if(h==0)\n {\n h = 24;\n }\n }\n\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#define nax 1000\nint main()\n{\n\n\tint x, hours,minutes;\n\tscanf(\"%i\",&x);\n\tscanf(\"%d%d\",&hours,&minutes);\n\tint newHour = minutes;\n\tint minus;\n\tint counter = 0 ;\n\twhile (1){\n\n\t\tif (newHour % 10 == 7 || hours % 7 == 0 ){\n\t\t\tbreak;\n\t\t}\n\n\t\tif (newHour < x){\n\t\t\tminus = x - newHour;\n\t\t\tnewHour = 60 - minus;\n\t\t\thours -=1;\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\tnewHour -= x;\n\t\t}\n\t\tcounter += 1;\n\n\t}\n\tprintf(\"%i\",counter);\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int x,minute,time_delay=0,k,hour;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n hour = hour%10;\n while(1)\n {\n\n\n k = minute%10;\n\n if(k==7||hour==7)\n break;\n if(minute==0)\n {\n if(hour-1==7)\n {\n\n minute--;\n time_delay++;\n break;\n }\n else\n minute = 60;\n }\n minute--;\n time_delay++;\n }\n if(time_delay/x==0)\n time_delay = time_delay%x;\n else\n time_delay = time_delay/x;\n\n printf(\"%d\",time_delay);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint mm,hh,x,i;\nscanf(\"%d\",&x);\nscanf(\"%d%d\",&hh,&mm);\nfor(i=0;i<70;i++)\n{if(hh==7||hh==17||mm==7||mm==17||mm==27||mm==37||mm==47||mm==57)\n{printf(\"%d\",i);\nbreak;}\nif(hh==0)\n{\nhh=24;\n}\nif(mm<x)\n{mm=mm+60-x;\nhh=hh-1;}\nelse if(mm>x)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n m=m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\n int x,hour,d,minute,click=0,snooze,c;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n c = hour;\n d = minute;\n while(1)\n {\n if(hour==0)\n {\n hour=24;\n\n }\n click++;\n\n if(x <= minute)\n snooze = minute-x;\n else\n {\n snooze = 60 + (minute-x);\n hour = hour-1;\n\n if(hour%10==7)\n {\n\n break;\n }\n }\n\n\n if(snooze%10==7)\n {\n\n break;\n }\n else\n minute=snooze;\n\n}\nif(c%10==7||d==0)\n click=0;\nprintf(\"%d\",click);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x;int y,s;\n scanf(\"%d\",&x);\n int a,b;\n scanf(\"%d%d\",&a,&b);\n y=b%10;\n if(y<7)\n {\n y=y+3;\n }\n else\n {\n y=y-7;\n }\n if(y%x==0)\n {\n s=y/x;\n }\n else\n {\n s=y/x;\n s=s+1;\n }\n printf(\"%d\",s);\n}"}, {"source_code": "# include <stdio.h>\n# include <math.h>\n# include <string.h>\n\n\nint main(){\n\tint x;\n\tscanf(\"%d\",&x);\n\tint h1,h2,m1,m2,m,h;\n\tscanf(\"%d%d\",&h,&m);\n\th1=h/10;\n\th2=h%10;\n\tm1=m/10;\n\tm2=m%10;\n\tint count=0;\n\tif(h2==7 || m2==7){\n\t\tprintf(\"0\\n\");\n\t}\n\telse{\n\t\twhile(h1!=7 && h2!=7 && m1!=7 && m2!=7){\n\t\t\tint a = m1*10+m2;\n\t\t\tif(a-x>=0 && a-x<=59){\n\t\t\t\ta=a-x;\n\t\t\t\tm1=a/10;\n\t\t\t\tm2=a%10;\n\t\t\t}\n\t\t\tif(a-x<0){\n\t\t\t\ta=a+60-x;\n\t\t\t\tm1=a/10;\n\t\t\t\tm2=a%10;\n\t\t\t\tint b=h1*10+h2;\n\t\t\t\tif(b-1>=0 && b-1<=23){\n\t\t\t\t\tb=b-1;\n\t\t\t\t\th1=b/10;\n\t\t\t\t\th2=b%10;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tb=b+24;\n\t\t\t\t\tb=b-1;\n\t\t\t\t\th1=b/10;\n\t\t\t\t\th2=b%10;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\t\tprintf(\"%d\\n\",count);\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m!=0)\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n {\n if(m==60)\n {\n m=m-x;\n h=h-1;\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n if(m==0)\n {\n m=60;\n\n }\n }\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#include <stdio.h>\n\nint x, hh, mm,ans=0x7fffffff,sh,sm,tmp1,tmp2;\nint myabs(int x) { return x > 0 ? x : -x; }\nint main()\n{\n scanf(\"%d%d%d\", &x, &hh, &mm);\n if (hh % 10 == 7 || mm % 10 == 7)\n {\n putchar('0');\n return 0;\n }\n tmp1 = hh * 60 + mm;\n for (sh = 0; sh < 24; ++sh)\n {\n for (sm = 0; sm < 60; ++sm)\n {\n if (sh == hh && sm == mm)continue;\n if (sh % 10 != 7 && sm % 10 != 7)continue;\n tmp2 = (sh * 60 + sm);\n tmp2 += tmp2 > tmp1 ? 24 * 60 : 0;\n tmp2 -= tmp1;\n if (tmp2 < 0)tmp2 = -tmp2;\n if (tmp2 % x == 0)\n {\n //printf(\"%d:%d - %d:%d is %d\\n\", hh, mm,sh, sm,tmp2);\n tmp2 /= x;\n if (tmp2 <= ans)ans = tmp2;\n }\n }\n }\n printf(\"%d\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint fact(int x,int y);\nint main()\n{\n\tint x,m,n;\n\twhile(scanf(\"%d\\n\",&x)!=EOF)\n\t{\n\t\tscanf(\"%d %d\",&m,&n);\n\t\tint i,j,s=0;\n\t\tif(fact(m,n)==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse \n\t\t{\n\t\t\twhile(1)\n\t\t\t{\n\t\t\t\tif(n>=x)\n\t\t\t\t{\n\t\t\t\t\tn-=x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(m>0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm-=1;\n\t\t\t\t\tn+=60;\n\t\t\t\t}\n\t\t\t\tif(m==0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm=23;n=n+60-x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%d\\n\",s);\n\t\t}\n\t\t\n\t}\n} \nint fact(int x,int y)\n{\n\tint s=0;\n\tif(x/10==7||y/10==7)\n\t{\n\t\ts=1;\n\t}\n\tif(x%10==7||y%10==7)\n\t{\n\t\ts=1;\n\t}\n\treturn s;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint x,t,y,a,b,m;\n\tint k,l;\n\tscanf(\"%d%d%d\",&x,&a,&b);\n\tif (((a%10)-7==0)||((b%10)-7==0))\n\t{\n\t\tprintf(\"0\\n\");\n\t\treturn 0;\n\t}\n\tif (a==0)\n\t{\n\t\ta=24;\n\t}\n\tif (b==0)\n\t{\n\t\tb=60;\n\t}\n\t\n\t\tfor (y=1;y<=50;y++)\n\t\t{\n\t\t\tm=x*y;\n\t\t\tk=a;\n\t\t\tt=m-b;\n\t\t\t\n\t\t\t\n\t\t\tif (t<=-1)\n\t\t\tt=t*(-1);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t if (x>b)\n\t\t\t{\n\t\t\t\tl=(t/60)+1;\n\t\t\t\t\n\t\t\t\tk=k-l;\n\t\t\t\t\n\t\t\t\tt=(60*l)-t;\n\t\t\t\t}\n\t\t\t\n\t\t\t\n\t if (((t%10)-7==0)||((k%10)-7==0))\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",y);\n\t\t\t\tbreak;\n\t\t\t}\n \t}\n\t\n\t\treturn 0;\n\t\t\t}\n\t\t"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,hh,mm,c=0;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n if(hh%10==7||mm%10==7)\n printf(\"0\");\n while(1)\n { \n if(hh%10==7||mm%10==7)\n {printf(\"%d\",c);\n break;\n }\n else\n { mm-=x;\n c++;\n if(mm<0)\n { mm+=59;\n hh--;\n if(hh<0)\n hh+=23;\n }\n }\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int flag=0,n,m,h,c=0;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&h,&m);\n if(h%10==7 || h/10==7 || m%10==7 || m/10==7)\n {\n printf(\"0\");\n }\n while(h%10!=7 && h/10!=7 && m%10!=7 && m/10!=7)\n {\n if(n<=m)\n {\n if(m==3)\n {\n m=60+m;\n m=m-n;\n c++;\n flag=1;\n }\n else if(m<3)\n {\n m=60+m;\n m=m-n;\n h--;\n c++;\n flag=1;\n }\n else\n {\n m=m-n;\n c++;\n flag=1;\n }\n }\n else\n {\n m=m+60;\n m=m-n;\n h--;\n c++;\n flag=1;\n }\n if(h<0)\n {\n h=h+24;\n }\n \n }\n if(flag==1)\n {\n printf(\"%d\",c);\n }\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint s,h,m,ans1=0,ans2=0,c,tm;\n\tscanf(\"%d\",&s);\n\tscanf(\"%d %d\",&h,&m);\n\ttm=m;\n\tfor (; ;)\n\t{\n\t\tif (h==07 || h==17 || tm==07 || tm==17 || tm==27 || tm==37 || tm==47 || tm==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tm=m+s;\n\t\tif (m>59)\n\t\t{\n\t\t\th++;\n\t\t\tm=m-59;\n\t\t}\n\t\tans1++;\n\t\tif (m==07 || m==17 || m==27 || m==37 || m==47 || m==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tfor (; ;)\n\t{\n\t\tif (h==07 || h==17 || tm==07 || tm==17 || tm==27 || tm==37 || tm==47 || tm==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\ttm=tm-s;\n\t\tif (tm<1)\n\t\t{\n\t\t\th--;\n\t\t\ttm=61-tm;\n\t\t}\n\t\tans2++;\n\t\tif (tm==07 || tm==17 || tm==27 || tm==37 || tm==47 || tm==57)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tc=(ans1<ans2)?ans1:ans2;\n\tprintf(\"%d\\n\",c);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x, h, m, count;\n count = 0;\n scanf(\"%d %d %d\", &x, &h, &m);\n for(;;)\n {\n if(m%10 == 7 || h%10 == 7)\n {\n printf(\"%d\", count);\n break;\n }\n else\n {\n m = m - x;\n if(m <= 0)\n {\n h--;\n m = m + 60;\n }\n if(h < 0)\n {\n h = h + 24;\n }\n }\n count++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n h=h-1;\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint fact(int x,int y);\nint main()\n{\n\tint x,m,n;\n\twhile(scanf(\"%d\\n\",&x)!=EOF)\n\t{\n\t\tscanf(\"%d %d\",&m,&n);\n\t\tint i,j,s=0;\n\t\tif(fact(m,n)==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse \n\t\t{\n\t\t\twhile(1)\n\t\t\t{\n\t\t\t\tif(n>x)\n\t\t\t\t{\n\t\t\t\t\tn-=x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{\n\t\t\t\t\tm-=1;\n\t\t\t\t\tn+=60;\n\t\t\t\t}\n\t\t\t\tif(m==0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm=23;n=n+60-x;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%d\\n\",s);\n\t\t}\n\t\t\n\t}\n} \nint fact(int x,int y)\n{\n\tint i,c,s=0;\n\tif(x/10==7||y/10==7)\n\t{\n\t\ts=1;\n\t}\n\tif(x%10==7||y%10==7)\n\t{\n\t\ts=1;\n\t}\n\treturn s;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,a,b,i,count=0;\n scanf(\"%d %d %d\",&x,&a,&b);\n while(a%10!=7 && b%10!=7)\n {\n b=b-x;\n if(b==0)\n {\n b=59;\n a=a-1;\n if(a<=0)\n a=24+a;\n }\n else if(b<0)\n {\n b=60+b;\n a=a-1;\n if(a<=0)\n a=24+a;\n }\n count++;\n }\n printf(\"%d\",count);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int x,hh,mm,ans=0;\n scanf(\"%d %d %d\",&x,&hh,&mm);\n while(mm%10!=7){\n if(mm>=x){\n mm-=x;\n }\n else{\n mm=60-(x-mm);\n if(hh==0){\n hh=23;\n }\n else{\n hh--;\n }\n }\n ans++;\n if(hh%10==7){\n break;\n }\n }\n printf(\"%d\",ans);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int x,minute,time_delay=0,k,hour,c;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n c=minute;\n hour = hour%10;\n while(1)\n {\n\n\n k = minute%10;\n\n if(k==7||hour==7)\n break;\n if(minute==0)\n {\n if(hour-1==7)\n {\n\n minute--;\n time_delay++;\n break;\n }\n else\n minute = 60;\n }\n minute--;\n time_delay++;\n }\n if(time_delay/x==0)\n time_delay = 1;\n else\n time_delay = time_delay/x;\n if(hour==7||c%10==7)\n time_delay=0;\n\n printf(\"%d\",time_delay);\n}\n"}, {"source_code": "#include<stdio.h>\nint fun(int h, int m){\n\tif(m%10==7 || h%10==7)return 0;\n\treturn 1;\n}\nint main(){\n\tint x,h,m,h1,m1;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\th1=h;\n\tm1=m;\n\twhile(fun(h,m)){\n\t\tm=(m/10)*10-3;\n\t\tif(m<0){\n\t\t\tm=57;\n\t\t\th--;\n\t\t\tif(h<0)h=23;\n\t\t}\n\t}\n\tint ans=((h1>=h)?(h1-h):(h1+24-h))*60+m1-m;\n\tprintf(\"%d\\n\",ans/x);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() \n{\n int x,i=0;\n scanf(\"%d\",&x);\n int a[2];\n scanf(\"%d%d\",&a[0],&a[1]);\n for(i=0;(a[0]%10)!=7 && (a[1]%10)!=7; )\n {\n if(a[1]>=x)\n {\n a[1]=a[1]-x;\n i++;\n }\n else if(a[1]<x)\n {\n a[1]=a[1]+60-x;\n a[0]=a[0]-1;\n i++;\n }\n if(a[0]<0)\n a[0]=a[0]+24;\n printf(\"%d \",a[1]);\n }\n printf(\"%d\",i);\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint mm,hh,x,i;\nscanf(\"%d\",&x);\nscanf(\"%d%d\",&hh,&mm);\nfor(i=0;i<70;i++)\n{if(hh==7||hh==17||mm==7||mm==17||mm==27||mm==37||mm==47||mm==57)\n{printf(\"%d\",i);\nbreak;}\nif(hh==0)\n{\nhh=24;\n}\nif(mm<x)\n{mm=mm+60-x;\nhh=hh-1;}\nelse if(mm>x)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,a,b,r1,r2,xx,yy,i;\n scanf(\"%d %d %d\",&x,&a,&b);\n\n r1=a%10;\n r2=b%10;\n if(r1==7 || r2==7) printf(\"0\");\n else\n {\n if(r2>7)\n {\n xx=r2-7;\n }\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx; i<=1500; i+=10)\n {\n y=xx/x;\n if(x*y == xx)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint check(int h,int m)\n{\n\tint hh[2]={0},mm[2]={0},i=0,j=0,count=0;\n\twhile(h>0)\n\t{\n\t\tif(h%10==7)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\th=h/10;\n\t}\n\twhile(m>0)\n\t{\n\t\tif(m%10==7)\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t\tm=m/10;\n\t}\n\treturn count;\n}\nint main()\n{\n\tint x;\n\tscanf(\"%d\",&x);\n\tint h,m,count1=0,count=0,i;\n\tscanf(\"%d %d\",&h,&m);\n\twhile(1)\n\t{\n\t\tcount=check(h,m);\n\t//\tprintf(\"%d %d\\n\",h,m);\n\t//\tprintf(\"%d\\n\",count );\n\t\tif(count>0)\n\t\t{\n\t//\t\tprintf(\"%d\\n\",count1 );\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\th--;\n\t\t\tm=m-x;\n\t\t\tif(h<0)\n\t\t\t{\n\t\t\t\th=24+h;\n\t\t\t}\n\t\t\tif(m<0)\n\t\t\t{\n\t\t\t\tm=60+m;\n\t\t\t}\n\t\t\th=h%24;\n\t\t\tm=m%60;\n\t\t\tcount1++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\", count1);\n\treturn 0;\n}\n"}, {"source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#include <stdio.h>\n\nint x, hh, mm,ans;\nint main()\n{\n scanf(\"%d%d%d\", &x, &hh, &mm);\n while (mm-=x)\n {\n if (hh % 10 == 7 || mm % 10 == 7)break;\n if (mm < 0)\n {\n hh--;\n mm += 60;\n }\n if (hh < 0)hh += 24;\n ans++;\n }\n printf(\"%d\", ans);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\n int x,hh,mm,ans=0;\n scanf(\"%d %d %d\",&x,&hh,&mm);\n while(mm%10!=7){\n if(mm>=x){\n mm-=x;\n }\n else{\n mm=60-(x-mm);\n if(hh==0){\n hh=23;\n }\n else{\n hh--;\n }\n }\n ans++;\n if(hh%10==7){\n break;\n }\n }\n printf(\"%d\",ans);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int y=0;\n int x;\n int hh,mm;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hh,&mm);\n\n while(1)\n {\n if((hh%10==7)||(mm%10==7))\n {\n break;\n }\n if(mm-x<0) //\u5206\u949f\u6570\u5c0f\u4e8e7\n {\n mm=60+mm-x;//\n if(hh-1<0)\n {\n hh=24;\n }\n else\n {\n hh--;\n }\n }\n else\n {\n mm=mm-x;\n }\n //printf(\"\\nhh:mm=%d:%d\\n\",hh,mm);\n y++;\n }\n printf(\"%d\\n\",y);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,a,b,r1,r2,xx,yy,i;\n scanf(\"%d %d %d\",&x,&a,&b);\n\n r1=a%10;\n r2=b%10;\n if(r1==7 || r2==7) printf(\"0\");\n else\n {\n if(r2>7)\n {\n xx=r2-7;\n }\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx; i<=1500; i+=10)\n {\n y=xx/x;\n if(x*y == xx)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\n int x,hour,d,minute,click=0,snooze,c;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hour,&minute);\n c = hour;\n d = minute;\n while(1)\n {\n if(hour==0)\n {\n hour=24;\n\n }\n click++;\n if(x < minute)\n snooze = minute-x;\n else\n {\n snooze = 60 + (minute-x);\n hour = hour-1;\n\n }\n\n if(hour%10==7)\n {\n\n break;\n }\n if(snooze%10==7)\n {\n click++;\n break;\n }\n else\n minute=snooze;\n\n}\nif(c%10==7||d==0)\n click=0;\nprintf(\"%d\",click);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n\tint x, hh, mm, dist = 0, res = 0;\n\tscanf(\"%d\", &x);\n\tscanf(\"%d%d\", &hh, &mm);\n\n\twhile ((hh - 7) % 10 != 0 && (mm - 7) % 10 != 0) {\n\t\t/*\n\t\tif (mm == 0) {\n\t\t\tmm = 60;\n\t\t\tif (hh == 0) {\n\t\t\t\thh = 24;\n\t\t\t}\n\t\t\t--hh;\n\t\t}\n\t\t--mm;\n\t\tif (dist++ % x == 0)\n\t\t\t++res;\n\t\t*/\n\t\tif (mm - x <= 0) {\n\t\t\tmm = 60;\n\t\t\tif (hh == 0) {\n\t\t\t\thh = 24;\n\t\t\t}\n\t\t\t--hh;\n\t\t}\n\t\tmm = (mm - x) % 60;\n\t\t++res;\n\t}\n\n\tprintf(\"%d\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint fact(int x,int y);\nint main()\n{\n\tint x,m,n;\n\twhile(scanf(\"%d\\n\",&x)!=EOF)\n\t{\n\t\tscanf(\"%d %d\",&m,&n);\n\t\tint i,j,s=0;\n\t\tif(fact(m,n)==1)\n\t\t{\n\t\t\tprintf(\"%d\\n\",0);\n\t\t}\n\t\telse \n\t\t{\n\t\t\twhile(1)\n\t\t\t{\n\t\t\t\tif(n>=x)\n\t\t\t\t{\n\t\t\t\t\tn-=x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(m>0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm-=1;\n\t\t\t\t\tn+=60;\n\t\t\t\t}\n\t\t\t\tif(m==0&&n<x)\n\t\t\t\t{\n\t\t\t\t\tm=23;n=n+60-x;\n\t\t\t\t\ts++;\n\t\t\t\t}\n\t\t\t\tif(fact(m,n)==1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tprintf(\"%d\\n\",s);\n\t\t}\n\t\t\n\t}\n} \nint fact(int x,int y)\n{\n\tint i,c,s=0;\n\tif(x/10==7||y/10==7)\n\t{\n\t\ts=1;\n\t}\n\tif(x%10==7||y%10==7)\n\t{\n\t\ts=1;\n\t}\n\treturn s;\n}"}, {"source_code": "#include <stdio.h>\n#define nax 1000\nint main()\n{\n\n\tint x, hours,minutes;\n\tscanf(\"%i\",&x);\n\tscanf(\"%d%d\",&hours,&minutes);\n\tint newHour = minutes;\n\tint minus;\n\tint counter = 0 ;\n\twhile (1){\n\n\t\tif (newHour % 10 == 7 || hours % 7 == 0 ){\n\t\t\tbreak;\n\t\t}\n\n\t\tif (newHour < x){\n\t\t\tminus = x - newHour;\n\t\t\tnewHour = 60 - minus;\n\t\t\thours -=1;\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\tnewHour -= x;\n\t\t}\n\t\tcounter += 1;\n\n\t}\n\tprintf(\"%i\",counter);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint x, h, m;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d%d\",&h,&m);\n\t\n\tint cont=0;\n\tif(!(h==17 || h==7 || m%10 == 7)){\n\t\tint lim = 10*(m/10)+7;\n\t\tif(m%10 > 7) lim += 10;\n\t\twhile(m < lim){\n\t\t\tm+=x;\n\t\t\tcont++;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",cont);\n}"}, {"source_code": "#include <stdio.h>\n\nint islucky(int HH,int MM){\n\tif(HH%10==7 || HH/10==7 || MM%10==7 || MM/10==7) return 1;\n\telse return 0;\n}\n\nint main(){\n\tint a,b,HH,MM,t=0,n,x;\n\tscanf(\"%d\",&x);\n\tscanf(\"%d %d\",&HH,&MM);\n\tn=(HH*60)+MM;\n\ta=HH;\n\tb=MM;\n\twhile(islucky(a,b)==0){\n\t\tt=t+1;\n\t\tn=n-x;\n\t\ta=n/60;\n\t\tb=n%60;\n\t}\n\tprintf(\"%d\",t);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint x,h,m,res; char str[9];\nint main(){\n for(scanf(\"%i%i%i\", &x,&h,&m);;){\n sprintf(str,\"%i%i\", h,m);\n if(strchr(str, '7')) break; res++;\n m=m-x<0?(h=(h-1)<0?(h-1)%24+24:h-1),(m-x)%60+(((m-x)%60)?60:0): m-x;\n }\n printf(\"%i\", res);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,a,y;\n scanf(\"%d%d%d\",&x,&h,&m);\n if(m%10==7)\n {\n printf(\"0\");\n return 0;\n }\n a=m;\n while(a%10!=7)\n {\n a--;\n }\n y=ceil((m-a)/x);\n printf(\"%d\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n\nint main()\n{\n\tint n = 0;\n\tint hh = 0, mm = 0;\n\tscanf(\"%d %d %d\",&n,&hh,&mm);\n\tint count = 0;\n\twhile( mm % 10 != 7 && hh % 10 != 7)\n\t{\n\t\tcount++;\n\t\tif ( mm > n )\n\t\t{\n\t\t\tmm -= n;\n\t\t}\n\t\telse if ( mm == n)\n\t\t{\n\t\t\tmm = 59;\n\t\t\thh -= 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmm = mm + 60 - n;\n\t\t\thh -= 1;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",count);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x, hh, mm, ans = 0;\n scanf(\"%d %d %d\", &x, &hh, &mm);\n while(1) {\n if(mm % 10 == 7) {\n break;\n }\n if(--mm == 0) {\n mm = 59;\n if(--hh == 0) {\n hh = 23;\n }\n }\n ++ans;\n }\n printf(\"%d\\n\", ans / x);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define nax 1000\nint main()\n{\n\n\tint x, hours,minutes;\n\tscanf(\"%i\",&x);\n\tscanf(\"%d%d\",&hours,&minutes);\n\tint newHour = minutes;\n\tint minus;\n\tint counter = 0 ;\n\twhile (1){\n\n\t\tif (newHour % 10 == 7 || hours % 7 == 0 ){\n\t\t\tbreak;\n\t\t}\n\n\t\tif (newHour < x){\n\t\t\tminus = x - newHour;\n\t\t\tnewHour = 60 - minus;\n\t\t\thours -=1;\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\tnewHour -= x;\n\t\t}\n\t\tcounter += 1;\n\n\t}\n\tprintf(\"%i\",counter);\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,a,b,r1,r2,xx,yy,i;\n scanf(\"%d %d %d\",&x,&a,&b);\n\n r1=a%10;\n r2=b%10;\n if(r1==7 || r2==7) printf(\"0\");\n else\n {\n if(r2>7)\n {\n xx=r2-7;\n }\n else\n {\n yy=7-r2;\n xx=b+yy-10;\n xx=b-xx;\n }\n for(i=xx; i<=1500; i+=10)\n {\n y=xx/x;\n if(x*y == xx)\n {\n printf(\"%d\",y);\n return 0;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int x,hh,mm,c=0;\n scanf(\"%d%d%d\",&x,&hh,&mm);\n while(1)\n { \n if(hh%10==7||mm%10==7)\n {printf(\"%d\",c);\n break;\n }\n else\n { mm-=x;\n c++;\n if(mm<0)\n { mm+=59;\n hh--;\n if(hh<0)\n hh+=23;\n }\n }\n }\n \n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint seven(int x,int y)\n{\n\tint p;\n\tif(x==7||y==7||(x/10)==7||(y/10)==7)\n\t\treturn 1;\n\tx=x%10;\n\ty=y%10;\n\tif(x==7||y==7)\n\t\treturn 1;\n\telse\n\t\treturn 0;\n}\n\nint main()\n{\n\tint x,hh,mm,i=0,p=0;\n\tscanf(\"%d%d%d\",&x,&hh,&mm);\n\tfor(i=0;i<10000;i++)\n\t{\n\t\tif(seven(hh,mm)==1)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\tif(x<=mm)\n\t\t{\n\t\t\tmm=mm-x;\n\t\t}\n\t\tif(x>mm)\n\t\t{\n\t\t\tmm=60+mm-x;\n\t\t\tif(hh==0)\n\t\t\t\thh=23;\n\t\t\telse\n\t\t\t\thh=hh-1;\n\t\t}\n\t\tp++;\n\t}\n\tprintf(\"%d\\n\",p);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a,b,count1=0,a2,b2;\n\nscanf(\"%lld%lld%lld\",&n,&a,&b);\ncount=0;\n\nwhile(a%10!=7 && b%10!=7){\n b-=3;\n count++;\n if(b<0){\n b=59+b;\n a--;\n }\n if(a<0){\n a=24;\n }\n}\nprintf(\"%lld\",count);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nstruct time{\n\tint hour;\n\tint minute;\n};\nint whether(int x);\nint main()\n{\n\tstruct time times;\n\tint x,item=0;\n\tscanf(\"%d%d%d\",&x,×.hour,×.minute);\n\t\n\twhile(1)\n\t{\n\t\tif(whether(times.hour)||whether(times.minute))\n\t\t{\n\t\t\tprintf(\"%d\\n\",item);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif((times.minute-x)>=0)\n\t\t\t{\n\t\t\t\ttimes.minute-=x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttimes.minute=times.minute+60-x;\n\t\t\t\tif(times.hour>=1)\n\t\t\t\t\ttimes.hour-=1;\n\t\t\t\telse\n\t\t\t\t\ttimes.hour=23;\n\t\t\t}\n\t\t}\n\t\titem++;\t\n\t\t//printf(\"%d:%d\\n\",times.hour,times.minute);\n\t}\n\t\n\treturn 0;\n}\nint whether(int x)\n{\n\twhile(x)\n\t{\n\t\tif(x%10==7)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tx/=7;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nstruct time{\n\tint hour;\n\tint minute;\n};\nint whether(int x);\nint main()\n{\n\tstruct time times;\n\tint x,item=0;\n\tscanf(\"%d%d%d\",&x,×.hour,×.minute);\n\t\n\twhile(1)\n\t{\n\t\tif(whether(times.hour)||whether(times.minute))\n\t\t{\n\t\t\tprintf(\"%d\\n\",item);\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif((times.minute-x)>=0)\n\t\t\t{\n\t\t\t\ttimes.minute-=x;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttimes.minute=times.minute+60-x;\n\t\t\t\tif(times.hour>=1)\n\t\t\t\t\ttimes.hour-=1;\n\t\t\t\telse\n\t\t\t\t\ttimes.hour=23;\n\t\t\t}\n\t\t}\n\t\titem++;\t\n\t\tprintf(\"%d:%d\\n\",times.hour,times.minute);\n\t\n\t}\n\t\n\treturn 0;\n}\nint whether(int x)\n{\n\twhile(x)\n\t{\n\t\tif(x%10==7)\n\t\t{\n\t\t\treturn 1;\n\t\t}\n\t\telse \n\t\t{\n\t\t\tx/=10;\n\t\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x,y,hh,mm;\n int c=0;\n int h1,h2,m1,m2;\n scanf(\"%d\",&x);\n scanf(\"%d%d\",&hh,&mm);\n\n while(x>0 && x<61)\n{\n h1=hh/10;\n h2=hh%10;\n m1=mm/10;\n m2=mm%10;\n if(h1==7|h2==7|m1==7|m2==7)\n {\n printf(\"%d\\n\",c);\n break;\n }\n\n else if(hh>0)\n {\n mm=mm-x;\n if(mm<0)\n {\n mm=60+mm;\n hh=hh-1;\n if(hh==23 && mm==59)\n {\n hh=0;\n mm=0;\n c++;\n }\n else if(hh<24 && hh>=0)\n {\n c++;\n }\n else if(hh>=23 && mm>=0)\n {\n hh=0;\n c++;\n }\n else if(hh==0)\n {\n c++;\n }\n }\n else if(mm>=0 && mm<=59)\n {\n if(hh==23 && mm==59)\n {\n hh=0;\n mm=0;\n c=c+1;\n }\n else if(hh<24 && hh>=0)\n {\n c=c+1;\n }\n }\n }\n\n else if(hh<=0)\n {\n hh=24;\n mm=mm-x;\n if(mm<0)\n {\n mm=60+mm;\n hh=hh-1;\n if(hh==23 && mm==59)\n {\n hh=0;\n mm=0;\n c=c+1;\n }\n else if(hh<24 && hh>=0)\n {\n c=c+1;\n }\n else if(hh>=23 && mm>=0)\n {\n c=c+1;\n }\n }\n else if(mm>=0 && mm<=59)\n {\n if(hh==23 && mm==59)\n {\n hh=0;\n mm=0;\n c=c+1;\n }\n else if(hh<24 && hh>=0)\n {\n c=c+1;\n }\n }\n }\n}\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n h=h-1;\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint yeah(int n)\n{\n while(n){\n if(n%10==7) return 1;\n n/=10;\n }\n return 0;\n}\nint main()\n{\n int h,m,time,count1=0,ans1,ans2,count2=0,count=0,x,i;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n if((yeah(h)==1)||(yeah(m)==1)) printf(\"0\\n\");\n else {\n for(;;){\n if((m-x)==0) m=60;\n else if((m-x)<0) {\n m=60-(x-m);\n h-=1;\n }\n else m-=x;\n ++count;\n if(h<0) h=24+h;\n if((yeah(h)==1)||(yeah(m)==1)) break;\n\n }\n printf(\"%d\\n\",count);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\nint x,y,n,count=0;\nscanf(\"%d\",&n);\nscanf(\"%d%d\",&x,&y);\nwhile(!(((x%10)==7)||((y%10)==7)))\n{y=y-n;\n if(y<=0){\n x=x-1;\n y+=60;}\nif(x<0){\n x=23;\ny=60;}\ncount++;\n\n}\nprintf(\"%d\",count);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x,y;\n long int i=0;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n\n else\n {\n while(h!=7&&h!=17&&h!=27&&h!=37&&h!=47&&h!=57&&m!=7&&m!=17&&m!=27&&m!=37&&m!=47&&m!=57)\n {\n if(m>=x)\n {\n m-=x;\n i++;\n continue;\n }\n if(h!=0)\n {\n h--;\n y=x-m;\n m=60-y;\n i++;\n continue;\n }\n h=23;\n y=x-m;\n m=60-y;\n }\n printf(\"%lld\",i);\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n int x;\n scanf(\"%d\",&x);\n int hh,mm;\n scanf(\"%d %d\",&hh,&mm);\n \n if((hh == 17)||(hh == 7)||(mm % 10 == 7))\n printf(\"0\\n\");\n else if((hh%10 == 8))\n printf(\"%d\\n\",(mm%10 + 1)/x);\n else if(mm%10 < 7)\n printf(\"%d\\n\",(mm%10 + 4)/x);\n else\n printf(\"%d\\n\",(7-(mm%10))/x);\n \n \n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n else\n {\n if(m>7&&m<17)\n printf(\"%d\",(m-7)/x);\n else if(m>17&&m<27)\n printf(\"%d\",(m-17)/x);\n else if(m>27&&m<37)\n printf(\"%d\",(m-27)/x);\n else if(m>37&&m<47)\n printf(\"%d\",(m-37)/x);\n else if(m>47&&m<57)\n printf(\"%d\",(m-47)/x);\n else if(m>57)\n printf(\"%d\",(m-57)/x);\n else\n {\n d=m+3;\n printf(\"%d\",d/x);\n\n\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n else\n {\n if(m>7&&m<17)\n printf(\"%d\",(m-7)/x);\n else if(m>17&&m<27)\n printf(\"%d\",(m-17)/x);\n else if(m>27&&m<37)\n printf(\"%d\",(m-27)/x);\n else if(m>37&&m<47)\n printf(\"%d\",(m-37)/x);\n else if(m>47)\n printf(\"%d\",(m-47)/x);\n else\n {\n if(h>7&&h<17)\n {\n d=(h-7)*60+m-57;\n printf(\"%d\",d/x);\n }\n else if(h>17)\n {\n d=(h-17)*60+m-57;\n printf(\"%d\",d/x);\n }\n else if(h>0&&h<7)\n {\n d=m+3;\n printf(\"%d\",d/x);\n }\n else\n {\n d=m+3;\n printf(\"%d\",d/x);\n }\n\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int s,h,m,i,co=0,mm;\n scanf(\"%d%d%d\",&s,&h,&m);\n for(i=1;i<=60;i++)\n {\n if(h==7||h==17||m==7||m==17||m==27||m==37||m==47||m==57)\n {\n printf(\"%d\",co);\n break;\n }\n co++;\n mm=m-s;\n \n m=(mm<0)? 60+mm : mm ;\n h=(mm<0)? h-1 : h ;\n h=(h<0)? 24+h : h ;\n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n else\n {\n if(m>7&&m<17)\n printf(\"%d\",(m-7)/x);\n else if(m>17&&m<27)\n printf(\"%d\",(m-17)/x);\n else if(m>27&&m<37)\n printf(\"%d\",(m-27)/x);\n else if(m>37&&m<47)\n printf(\"%d\",(m-37)/x);\n else if(m>47)\n printf(\"%d\",(m-47)/x);\n else\n {\n if(h>7&&h<17)\n {\n d=(h-7)*60+m-57;\n printf(\"%d\",d/x);\n }\n else if(h>17)\n {\n d=(h-17)*60+m-57;\n printf(\"%d\",d/x);\n }\n else if(h>0&&h<7)\n {\n d=m+3;\n printf(\"%d\",d/x);\n }\n else\n {\n d=m+3;\n printf(\"%d\",d/x);\n }\n\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int h,m;\n int x;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n long int res=0;\n\n while(!((m/10==7)||(m%10==7)||(h/10==7)||(h%10==7)))\n {if(x>m)\n {\n m=m+60;\n h-=1;\n }\n else m=m-x;\n res++;\n if(h<0)\n h=24+h;\n\n }\n printf(\"%ld\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int y=0;\n int x;\n int hh,mm;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&hh,&mm);\n\n while(1)\n {\n if((hh%10==7)||(mm%10==7))\n {\n break;\n }\n if(mm-x<0) //\u5206\u949f\u6570\u5c0f\u4e8e7\n {\n mm=60+mm-x;//\n if(hh-1<0)\n {\n hh=24;\n }\n else\n {\n hh--;\n }\n }\n else\n {\n mm=mm-x;\n }\n //printf(\"\\nhh:mm=%d:%d\\n\",hh,mm);\n y++;\n }\n printf(\"%d\\n\",y);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint check(int h,int m)\n{\n\tif((h%10)==7 || (m%10)==7)\n\t{\n\t\treturn 1;\n\t}\n\telse return 0;\n}\nint findy(int x,int h, int m)\n{\n\tint i=0,k=0;\n\tif(m<x || h<=0)\n\t{\n\t\tif(m<x)\n\t\t{\n\t\t\th--;\n\t\t\tm=(60+m)-x;\n\t\t\ti++;\n\t\t\tif(check(h,m))\n\t\t\t\treturn i;\n\t\t}\n\t\tif(h<=0)\n\t\t{\n\t\t\th=23;\n\t\t\tm=(60+m)-x;\n\t\t\ti++;\n\t\t\tif(check(h,m))\n\t\t\t\treturn i;\n\t\t}\n\t}\n\telse\n\t{\n\t\tm=m-x;\n\t\ti++;\n\t\tif(check(h,m))\n\t\t\treturn i;\n\t}\n\treturn i+findy( x,h,m);\n}\nint main()\n{\n\tint x,h,m;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\tif(check(h,m))\n\t{\n\t\tprintf(\"0\");\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\tint y;\n\t\ty=findy(x,h,m);\n\t\tprintf(\"%d\",y);\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint lucky_checker(int h,int m);\nvoid time_minus(int *h, int *m);\n\nint main()\n{\n\tint x,hour,min,counter=0;\n\tfloat button_times;\n\n\tscanf(\"%d %d %d\",&x,&hour,&min);\n\n\twhile(! lucky_checker(hour,min)) {\n\t\tcounter++;\n\t\ttime_minus(&hour,&min);\n\t\t//printf(\"%d:%d\\n\",hour,min);\n\t}\n\t//printf(\"%d %d\\n\",hour,min);\n\tbutton_times = (float)counter/x;\n\tif (button_times>0 && button_times<1)\n\t\tbutton_times=1;\n\t\n\tprintf(\"%d\\n\",(int)button_times);\n\n//\tcheck 7\n//\tno 7\n//\tminus 1 min\n//\tcheck 7 or change hour\n\n\treturn 0;\n}\n\nint lucky_checker(int h,int m)\n{\n\tint lucky=0,checker_7;\n\twhile(h || m) {\n\t\tchecker_7 = h%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Hour yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\th/=10;\n\n\t\tchecker_7 = m%10;\n\t\tif (checker_7==7) {\n\t\t\t//printf(\"Min yes\\n\");\n\t\t\tlucky=1;\n\t\t\tbreak;\n\t\t}\n\t\tm/=10;\n\t}\n\treturn lucky;\n}\n\nvoid time_minus(int *h, int *m)\n{\n\tif (*m == 0) {\n\t\t*h-=1;\n\t\t*m = 59;\n\t\tif (*h < 0) {\n\t\t\t*h = 23;\n\t\t}\n\t}\n\telse {\n\t\t*m -=1;\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x;\n\tint h, m;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\tint ans=0;\n\twhile (m%10!=7 && h!=7){\n\t\tans++;\n\t\tm -= x;\n\t\tif (m<=0){\n\t\t\th--;\n\t\t\tm += 60;\n\t\t}\n\t\tif (h==0) h=12;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint min, hh, mm;\nint cnt = 0;\n\nint is_lucky(int hh, int mm) {\n return hh/10 == 7 || hh%10 == 7 || mm/10 == 7 || mm%10 == 7;\n}\n\nint get_lucky(int hh, int mm) {\n if(is_lucky(hh, mm))\n return hh*100 + mm;\n\n if(mm == 0) {\n if(hh == 0)\n return get_lucky(23, 59);\n return get_lucky(hh-1, 59);\n }\n return get_lucky(hh, mm-1);\n}\n\nint get_times(int lhh, int lmm) {\n if((lhh == hh && lmm == mm) || (lhh >= hh && lmm >= mm))\n return cnt;\n\n cnt++;\n lmm += min;\n if(lmm >= 60) {\n lhh += 1;\n lmm -= 60;\n }\n if(lhh >= 24)\n lhh = 0;\n return get_times(lhh, lmm);\n}\n\nint main() {\n scanf(\"%d %d %d\", &min, &hh, &mm);\n int luck_hh = get_lucky(hh, mm) / 100, luck_mm = get_lucky(hh, mm) % 100;\n\n printf(\"%d\\n\",get_times(luck_hh, luck_mm));\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int x,hh,mm,i,flag=0,l,point,h;\n scanf(\"%d\",&x);\n scanf(\"%d%d\",&hh,&mm);\n h=hh;\n for (i=mm;i>=0;i--)\n {\n \t if (i==7||i==17||i==27||i==37||i==47||i==57)\n\t {\n\t \tflag =1;\n\t \tpoint=i;\n\t \tbreak;\n\t }\n }\n if (flag==0)\n {\n \t h=hh-1;\n \t point=57;\n }\n if (h==hh)\n {\n \t l=(mm-point)/x;\n }\n else if(h!=hh)\n {\n \tl=(3+mm)/x;\n }\n printf(\"%d\\n\",l);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x, hr, mm, ans = 0, tm;\n\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &hr, &mm);\n tm = (hr * 60) + mm;\n\n while(1)\n {\n hr = tm / 60;\n mm = tm % 60;\n if(hr % 10 == 7 || mm % 10 == 7)\n break;\n else\n {\n ans++;\n tm = tm - x;\n }\n }\n\n printf(\"%d\\n\", ans);\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m!=0)\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint x;\n\tint h, m;\n\tscanf(\"%d%d%d\",&x,&h,&m);\n\tint ans=0;\n\twhile (m%10!=7 && h!=7 && h%10!=7){\n\t\tans++;\n\t\tm -= x;\n\t\tif (m<=0){\n\t\t\th--;\n\t\t\tm += 60;\n\t\t}\n\t\tif (h==0) h=24;\n\t}\n\tprintf(\"%d\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int x, h, m, count = 0;\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &h, &m);\n while(m%10!=7 && (m/10)%10!=7 && h%10!=7 && (h/10)%10!=7)\n {\n if(m < x)\n {\n m = 60-(x-m);\n if(h == 0)\n {\n h = 23;\n count++;\n }\n else\n {\n h = h-1;\n count++;\n }\n \n }\n else \n {\n m = m-x;\n }\n }\n printf(\"%d\", count);\n \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint counter;\n\nvoid check(int hh, int mm, int snooze){\n\t\n\tif (mm % 10 == 7 || hh % 10 == 7){\n\t\t//memset(counter,0,sizeof(counter));\n\t\tprintf(\"%d\",counter);\n\t}\n\telse{\n\t\tdo{\n\t\t\tmm -= snooze;\n\t\t\tif(mm < 0){\n\t\t\t\tmm = mm + 60;\n\t\t\t\thh--;\n\t\t\t}\n\t\t\tcounter++;\n\t\t}while(mm % 10 != 7);\n\tprintf(\"%d\",counter);\t\t\n\t}\n\t\n}\n\nint main(void){\n\tint snooze;\n\tint hh, mm;\n\t//int finalcounter=0;\n\t\n\tscanf(\"%d\",&snooze);\t\n\tscanf(\"%d %d\", &hh, &mm);\n\t\n\tcheck(hh,mm,snooze);\n\t\n\tprintf(\"%d\\n\",counter);\n\treturn 0;\n\t\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint x,h,m,res; char str[9];\nint main(){\n for(scanf(\"%i%i%i\", &x,&h,&m);;){\n sprintf(str,\"%i%i\", h,m);\n if(strchr(str, '7')) break; res++;\n m=m-x<0?(h=(h-1)<0?(h-1)%24+24:h-1),(m-x)%60+(((m-x)%60)?60:0): m-x;\n }\n printf(\"%i\", res);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,a,y;\n scanf(\"%d%d%d\",&x,&h,&m);\n if(m%10==7)\n {\n printf(\"0\");\n return 0;\n }\n a=m;\n while(a%10!=7)\n {\n a--;\n }\n y=ceil((m-a)/x);\n printf(\"%d\",y);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int x, h, m, count = 0;\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &h, &m);\n while(m%10!=7 && (m/10)%10!=7 && h%10!=7 && (h/10)%10!=7)\n {\n if(m < x)\n {\n m = 60-(x-m);\n if(h == 0)\n {\n h = 23;\n count++;\n }\n else\n {\n h = h-1;\n count++;\n }\n \n }\n else \n {\n m = m-x;\n }\n }\n printf(\"%d\", count);\n \n\treturn 0;\n}\n\n\n"}, {"source_code": "#define _CRT_SECURE_NO_DEPRECATE\n#include <stdio.h>\n\nint x, hh, mm,ans=0x7fffffff,sh,sm,tmp1,tmp2;\nint myabs(int x) { return x > 0 ? x : -x; }\nint main()\n{\n scanf(\"%d%d%d\", &x, &hh, &mm);\n if (hh % 10 == 7 || mm % 10 == 7)\n {\n putchar('0');\n return 0;\n }\n tmp1 = hh * 60 + mm;\n for (sh = 0; sh < 24; ++sh)\n {\n for (sm = 0; sm < 60; ++sm)\n {\n if (sh == hh && sm == mm)continue;\n if (sh % 10 != 7 && sm % 10 != 7)continue;\n tmp2 = myabs(tmp1 - (sh*60+sm));\n if (tmp2 % x == 0)\n {\n //printf(\"%d:%d - %d:%d is %d\\n\", hh, mm,sh, sm,tmp2);\n tmp2 /= x;\n if (tmp2 <= ans)ans = tmp2;\n }\n }\n }\n printf(\"%d\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,a,y;\n scanf(\"%d%d%d\",&x,&h,&m);\n if(m%10==7)\n {\n printf(\"0\");\n return 0;\n }\n a=m;\n while(a%10!=7)\n {\n a--;\n }\n y=ceil((m-a)/x);\n printf(\"%d\",y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nvoid F(int x,int n,int m)\n{\n\tint i,y=0;\n for(i=0;;i++)\n\t{\n\t\tif(n%10==7||m%10==7)\n\t\t{printf(\"%d\\n\",i);break;}\n\t\telse\n\t\t{\n\t\t\ty++;\n\t\t\tm-=x*y;\n\t\t\tif(m<0)\n\t\t\t{\tm+=60;n--;}\n\t\t\tif(n<0)\n\t\t\t\tn+=24;\n\t\t}\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tF(a,b,c);\n\treturn 0;\n}\n\n\n\t \n\t"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int h,m;\n int x;\n scanf(\"%d\",&x);\n scanf(\"%d %d\",&h,&m);\n long int res=0;\n\n while(!((m/10==7)||(m%10==7)||(h/10==7)||(h%10==7)))\n {if(x>m)\n {\n m=m+60;\n h-=1;\n }\n else m=m-x;\n res++;\n if(h<0)\n h=24+h;\n\n }\n printf(\"%ld\\n\",res);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define nax 1000\nint main()\n{\n\n\tint x, hours,minutes;\n\tscanf(\"%i\",&x);\n\tscanf(\"%d%d\",&hours,&minutes);\n\tint newHour = minutes;\n\tint minus;\n\tint counter = 0 ;\n\twhile (1){\n\n\t\tif (newHour % 10 == 7)\n\t\t\tbreak;\n\t\tif (newHour < x){\n\t\t\tminus = x - newHour;\n\t\t\tnewHour = 59 - minus;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tnewHour -= x;\n\t\t}\n\t\tcounter += 1;\n\n\t}\n\tprintf(\"%i\",counter);\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\nint mm,hh,x,i;\nscanf(\"%d\",&x);\nscanf(\"%d%d\",&hh,&mm);\nfor(i=0;i<70;i++)\n{if(hh==7||hh==17||mm==7||mm==17||mm==27||mm==37||mm==47||mm==57)\n{printf(\"%d\",i);\nbreak;}\n\nif(mm<x)\n{mm=mm+60-x;\nif(hh==0)\nhh=23;\nelse\nhh=hh-1;}\nelse if(mm>x)\n{mm=mm-x;}\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n\tint x, hh, mm, dist = 0, res = 0;\n\tscanf(\"%d\", &x);\n\tscanf(\"%d%d\", &hh, &mm);\n\n\twhile ((hh - 7) % 10 != 0 && (mm - 7) % 10 != 0) {\n\t\tif (mm == 0) {\n\t\t\tmm = 60;\n\t\t\tif (hh == 0) {\n\t\t\t\thh = 24;\n\t\t\t}\n\t\t\t--hh;\n\t\t}\n\t\t--mm;\n\t\tif (dist++ % x == 0)\n\t\t\t++res;\n\t}\n\n\tprintf(\"%d\", res);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x, hh, mm, ans = 0;\n scanf(\"%d %d %d\", &x, &hh, &mm);\n while(1) {\n if((hh % 10 == 7 || mm % 10 == 7) && ans % x == 0) {\n break;\n }\n if(--mm == 0) {\n mm = 59;\n if(--hh == 0) {\n hh = 23;\n }\n }\n ++ans;\n }\n printf(\"%d\\n\", ans / x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a;\n int h,m;\n int ans=0;\n scanf(\"%d\",&a);\n scanf(\"%d%d\",&h,&m);\n while(h!=17&&h!=7&&m%10!=7)\n {\n ans++;\n m=m-a;\n if(m<0)\n {\n m=m+60;\n h--;\n }\n if(h<0)\n h=23;\n printf(\"%d\\n\",m);\n }\n printf(\"%d\\n\",ans);\n }\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,h,m,a,y;\n scanf(\"%d%d%d\",&x,&h,&m);\n if(m%10==7)\n {\n printf(\"0\");\n return 0;\n }\n a=m;\n while(a%10!=7)\n {\n a--;\n }\n y=ceil((m-a)/x);\n printf(\"%d\",y);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,n,m,k;\n while(~scanf(\"%d\",&n))\n {\n k=0,m=0;\n scanf(\"%2d%2d\",&a,&b);\n if(a%10==7||b%10==7)\n {\n printf(\"%d\\n\",0);\n continue;\n }\n else\n {\n for(int i=0; i<b/n; i+=n)\n {\n if((b-i)%10==7)\n {\n printf(\"%d\\n\",i/n);\n continue;\n }\n else\n {\n k++;\n }\n\n }\n if(k==b/n)\n {\n if(a==18||a==10-2)\n printf(\"%d\",k+1);\n else\n for(int i=0; i<(b+60)/n; i++)\n {\n m+=n;\n if((b+60-m)%10==7)\n {\n printf(\"%d\\n\",m/n);\n continue;\n }\n }\n }\n }\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<=x)\n {\n h=h-1;\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n m=m-x;\n }\n c++;\n\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main ()\n{\n\n int i,j,k,x,hh,mm;\n\n scanf (\"%d\",&x);\n scanf (\"%d%d\",&hh,&mm);\n\n for (i=0;i<1440; i++)\n {\n\n\n\n\n if (hh==7 || mm==7 || hh%10==7 || mm%10==7)\n\n {\n\n break;\n }\n else\n {\n k=1;\n mm=mm-x;\n j=i+1;\n }\n\n\n\n if (mm-x<0 && mm-x!=0)\n {\n mm=60+(mm-x);\n hh=hh-1;\n }\n else if (mm-x==0)\n {\n mm=mm-x;\n }\n\n\n\n }\n if (k==1)\n {\nprintf (\"%d\\n\",j);\n\n }\n else {\n\n printf (\"%d\\n\",i);\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int x, h, m, count;\n count = 0;\n scanf(\"%d %d %d\", &x, &h, &m);\n for(;;)\n {\n if(m%10 == 7 || h%10 == 7)\n {\n printf(\"%d\", count);\n break;\n }\n else\n {\n m = m - x;\n if(m <= 0)\n {\n h--;\n m = m + 60;\n }\n if(h < 0)\n {\n h = h + 24;\n }\n }\n count++;\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\n\nint main()\n\n{\n int x;\n scanf(\"%d\",&x);\n int h,m,d;\n scanf(\"%d%d\",&h,&m);\n if(h==7||h==17||h==27||h==37||h==47||h==57||m==7||m==17||m==27||m==37||m==47||m==57)\n printf(\"0\");\n else\n {\n if(m>7&&m<17)\n printf(\"%d\",(m-7)/x);\n else if(m>17&&m<27)\n printf(\"%d\",(m-17)/x);\n else if(m>27&&m<37)\n printf(\"%d\",(m-27)/x);\n else if(m>37&&m<47)\n printf(\"%d\",(m-37)/x);\n else if(m>47&&m<57)\n printf(\"%d\",(m-47)/x);\n else if(m>57)\n printf(\"%d\",(m-57)/x);\n else\n {\n if(h>7&&h<17)\n {\n d=(h-7)*60+m-57;\n printf(\"%d\",d/x);\n }\n else if(h>17)\n {\n d=(h-17)*60+m-57;\n printf(\"%d\",d/x);\n }\n else\n {\n d=m+3;\n printf(\"%d\",d/x);\n }\n\n }\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int x, h, m, count = 0;\n scanf(\"%d\", &x);\n scanf(\"%d %d\", &h, &m);\n while(m%10!=7 && (m/10)%10!=7 && h%10!=7 && (h/10)%10!=7)\n {\n if(m < x)\n {\n m = 60-(x-m);\n if(h == 0)\n {\n h = 23;\n count++;\n }\n else\n {\n h = h-1;\n count++;\n }\n \n }\n else \n {\n m = m-x;\n }\n }\n printf(\"%d\", count);\n \n\treturn 0;\n}\n\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int c=0,t=1000000,x1,x2,y1,y2,x,h,m;\n scanf(\"%d%d%d\",&x,&h,&m);\n while(t--)\n {\n x1=h%10;\n x2=h/10;\n y1=m%10;\n y2=m/10;\n if(x1==7||x2==7||y1==7||y2==7)\n {\n printf(\"%d\",c);\n return 0;\n }\n else\n {\n if(m<x)\n {\n if(m==0)\n {\n m=60;\n }\n if(h==0)\n {\n h=24;\n }\n h=h-1;\n if(m==60)\n m=m-x;\n else\n m=60+m-x;\n if(h==0)\n h=24;\n\n }\n else\n {\n if(m==60)\n {\n m=m-x;\n h=h-1;\n }\n else\n m=m-x;\n\n if(m<0){\n m=60-m;\n h=h-1;\n }\n if(m==0)\n {\n m=60;\n\n }\n }\n }\n c++;\n\n }\n\n}\n"}], "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb"} {"nl": {"description": "Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.You are given a length equal to n centimeters. Your task is to convert it to feet and inches so that the number of feet was maximum. The result should be an integer rounded to the closest value containing an integral number of inches.Note that when you round up, 1 cm rounds up to 0 inches and 2 cm round up to 1 inch.", "input_spec": "The only line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910000).", "output_spec": "Print two non-negative space-separated integers a and b, where a is the numbers of feet and b is the number of inches.", "sample_inputs": ["42", "5"], "sample_outputs": ["1 2", "0 2"], "notes": null}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int n,r,m,a,b;\n scanf(\"%d\",&n);\n r=n/3;\n a=n%3;\n if(a==1||a==0)\n {\n m=r;\n }\n else\n {\n m=r+1;\n }\n b=m/12;\n r=m%12;\n printf(\"%d %d\",b,r);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,feet,rem,inch;\n scanf(\"%d\",&n);\n feet=n/36;\n rem=n%36;\n inch=rem/3;\n if(rem%3==2)inch++;\n if(inch==12){feet++;\n inch=0;}\n \n printf(\"%d %d\\n\",feet,inch);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\nmain()\n{\n int i,j, cm, feet, inch=0;\n //1 feet= 12 inc\n scanf(\"%d\", &cm); //1 inch = 3 cm\n\n inch=(cm/3);\n if(cm%3==2){inch++;};\n feet=inch/12;\n inch-=feet*12;\n printf(\"%d %d\",feet, inch);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int f,i,c;\n scanf(\"%d\",&c);\n f=c/36;\n c=c%36;\n i=c/3;\n c=c%3;\n if(c==2)\n i++;\n if(i==12)\n {f++; i=0;}\n printf(\"%d %d\",f,i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,feet,inch;\n scanf(\"%d\",&n);\n\n if(n%3==0||n%3==1)\n {\n inch=n/3;\n }\n\n else if(n%3==2)\n {\n inch=n/3+1;\n }\n feet=inch/12;\n inch=inch%12;\n printf(\"%d %d\",feet,inch);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int x;\n if(n%3 == 0 || n%3 == 1)\n x=n/3;\n else\n x=n/3+1;\n printf(\"%d %d\", x/12, x%12);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,a,b;\n\n scanf(\"%d\", &n);\n\n a = n/36;\n b = (n%36)/3;\n\n if((n%36)%3 == 2) b++;\n if(b==12){\n a++;\n b=0;\n }\n\n printf(\"%d %d\", a, b);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,a,b,c;\n scanf(\"%d\",&n);\n a=n/36;\n b=(n%36)/3;\n if(((n%36)%3)==2)\n {\n if(b==11)\n {\n printf(\"%d 0\",a+1);\n }\n else if(b!=11)\n {\n printf(\"%d %d\",a,b+1);\n }\n }\n else\n {\n printf(\"%d %d\",a,b);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,r,f,i;\n scanf(\"%d\",&n);\n if(n%3==1)\n n--;\n else if(n%3==2)\n n++;\n \n \n r=n/3;\n n%=3;\n f=r/12;\n r%=12;\n printf(\"%d %d\",f,r+n);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, i,feet, inch, cen,k,r, t;\n\tscanf(\"%d\", &cen);\n\tinch=cen/3;\n\tr=cen%3;\n\tif(r==2)\n\t{\n\t\tinch=inch+1;\n\t}\n\t//printf(\"%d\\n\", inch);\n\tfeet=inch/12;\n\tinch=inch-(feet*12);\n\n\n\tprintf(\"%d %d \",feet, inch);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n,q,r;\nscanf(\"%d\",&n);\nif((n+1)%36==0)\n{\nq=(n/36)+1;\nr=0;\n}\nelse\n{\nq=n/36;\nr=n%36;\n}\nprintf(\"%d\\t\",q);\nif((r%3==0)||(r%3==1))\n{\nprintf(\"%d\",r/3);\n}\nelse if(r%3==2)\n{\nprintf(\"%d\",(r/3)+1);\n}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int num,a,b,c;\n\tscanf(\"%lld\",&num);\n\ta=num/36;\n\tif(num%36==35)\n\ta++;\n\tb=num-(a*36);\n\tc=b/3;\n\tif(b%3==2)\n\t{\n\t\tc++;\n\t}\n\telse\n\tc=c;\n\t\n\tprintf(\"%lld %lld\\n\",a,c);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c;\n scanf(\"%d\", &c);\n\n i=c/3;\n\tc%=3;\n\n\tif(c>=2)\n i++;\n\tf=i/12;\n\ti%=12;\n\n printf(\"%d %d\",f,i);\n}\n"}, {"source_code": "#include<stdio.h>\n#define test 0.5\n\nint main()\n{\n\tdouble n,inch,temp;\n\tint feet;\n\tscanf(\"%lf\",&n);\n\tinch = n/3;\n\t//printf(\"%lf\\n\",inch);\n\tfeet = inch/12;\n\tinch = inch - (12*feet);\n\t//printf(\"%lf\\n\",inch);\n\ttemp = inch - (int)inch;\n\tinch = (int)inch;\n\t//printf(\"%lf\\n\",temp);\n\tif(temp > test)\n\t\tinch += 1;\n\tif(inch == 12)\n\t{\n\t\tinch = inch-12;\n\t\tfeet += 1;\n\t}\n\tprintf(\"%d %.0lf\\n\",feet,inch);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i,f;\n scanf(\"%d\",&n);\n n=(float)n/3+.5;\n f=n/12;\n i=n-12*f;\n printf(\"%d %d\",f,i);\n return 0;\n} \n \n \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b;\n scanf(\"%d\",&n);\n a = n/36;\n n %= 36;\n b = (n + 1)/3;\n if (b == 12)\n {\n a++;\n b = 0;\n }\n printf(\"%d %d\",a,b);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\nint n,d,f;\nscanf(\"%d\",&n);\nif(n%3==0 || n%3==1) d=n/3;\nelse d=n/3+1;\nf=d/12;\nd=d%12;\nprintf(\"%d %d\",f,d);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,f,i;\n scanf(\"%d\",&n);\n if(n%3==0)\n {\n a=n/3;\n f=a/12;\n i=a%12;\n }\n\n else\n {\n a=n/3;\n b=n%3;\n c=b/2+a;\n f=c/12;\n i=c%12;\n\n }\n printf(\"%d %d\",f,i);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d\",&n);\n\ta=n/36;\n\tb=(n%36)/3;\n\tif((n%36)%3==2) b++;\n\tif(b==12)\n\t{\n\t\ta++;\n\t\tb=0;\n\t}\n\tprintf(\"%d %d\\n\",a,b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{int n,inch,feet;\nscanf(\"%d\",&n);\nfeet=n/3;\nif(n%3==2)\nfeet++;\nprintf(\"%d %d \",feet/12,feet%12);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=0,b,n,i,j,k;\n scanf(\"%d\",&n);\n a=n/36;\n if((n%36)%3==0)\n b=(n%36)/3;\n else\n {\n if((n%36)%3==2)\n b=(n%36)/3+1;\n else b=(n%36)/3;\n }\n if(b==12)\n {\n a++;\n b=0;\n }\n printf(\"%d %d\",a,b);\n return(0);\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c,i,f;\n\twhile(scanf(\"%d\",&c)!=EOF)\n\t{\n\t\tf=c/36;\n\t\ti=(c-f*36)%3==2?(c-f*36)/3+1:(c-f*36)/3;\n\t\tif(i%12==0&&i!=0){\n\t\t\t++f;i=0;\n\t\t}\n\t\tprintf(\"%d %d\\n\",f,i);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{int n,inch,feet;\nscanf(\"%d\",&n);\nfeet=n/3;\nif(n%3==2)\nfeet++;\nprintf(\"%d %d \",feet/12,feet%12);\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint a,b,c,n;\n\tscanf(\"%d\",&n);\n\ta=n / 36 ;\n\tc=n % 36;\n\tb=c / 3;\n\tif (c % 3 >= 2)\n\t{\n\t\tb++;}\n\tif (b==12)\n\t{\n\t\ta++;\n\t\tb=0;}\n\tprintf(\"%d %d\",a,b);\n\treturn 0;\n}\n\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint a,b,c,d,e;\n\tscanf(\"%d\",&a);\n\tb=a/3;\n\tc=a%3;\n\tif(c==2)\n\t\tb=b+1;\n\td=b/12;\n\te=b%12;\n\tprintf(\"%d %d\",d,e);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n i=n%3;\n n=n/3;\n if(i==2)\n n++;\n printf(\"%d %d\",n/12,n%12);\n return(0); \n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint S,N,K,T,Y;\n\tscanf(\"%d\",&S);\n\tT=S;\n\tN=S/36;\n\tY=S%36;\n\tS=S/36;\n\tif(T%3<2)\n\tK=(Y/3);\n\telse\n\tK=(Y/3)+1;\n\tif(K==12)\n\t{\n\t\tK=0;\n\t\tN=N+1;\n\t}\n\tprintf(\"%d %d\",N,K);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong int n,feet,t,p,inch=0;\nlong int arr[36]={0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,9,9,9,10,10,10,11,11,11};\nscanf(\"%ld\",&n);\nfeet=n/36;\nt=n%36;\nif(t<=34)\ninch=arr[t];\nif(t==35)feet+=1;\nprintf(\"%ld %ld\",feet,inch);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,f=0;\n scanf(\"%d\",&n);\n if(n>=36)\n {\n f=n/36;\n n%=36;\n }\n if(n%3==2)\n i=n/3+1;\n else\n i=n/3;\n if(i==12)\n {\n i=0;f=f+1;\n }\n printf(\"%d %d\",f,i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=0,b,n,i,j,k;\n scanf(\"%d\",&n);\n a=n/36;\n if((n%36)%3==0)\n b=(n%36)/3;\n else\n {\n if((n%36)%3==2)\n b=(n%36)/3+1;\n else b=(n%36)/3;\n }\n if(b==12)\n {\n a++;\n b=0;\n }\n printf(\"%d %d\",a,b);\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,in,in2;\n scanf(\"%d\",&n);\n in=n%3;\n in2=n/3;\n if(in==1)in=0;\n else if(in==2) in=1;\n a=in2/12;\n b=in2%12+in;\n a=a+b/12;\n b=b%12;\n printf(\"%d %d\\n\",a,b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,in,in2;\n scanf(\"%d\",&n);\n in=n%3;\n in2=n/3;\n if(in==1)in=0;\n else if(in==2) in=1;\n a=in2/12;\n b=in2%12+in;\n a=a+b/12;\n b=b%12;\n printf(\"%d %d\\n\",a,b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d %d\",(n+1)/36,(n+1)%36/3);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,f,i;\nscanf(\"%d\",&n);\nf=n/36;\ni=n%36/3;\n\nif(((n%36)%3)==1)\n;\nelse if(((n%36)%3)==2){\n n++;\n f=n/36;\ni=n%36/3;\n}\nelse;\nprintf(\"%d %d\",f,i);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint n, a, b ;\n\n/* 1 inch = 3 cm\n 1 foot = 12 inch = 36 cm\n*/\n\nint main()\n{\n\tscanf(\"%d\", &n) ;\n\t\n\ta = n / 36 ;\n\tn %= 36 ;\n\tb = n / 3 ;\n\tn %= 3 ;\n\tb += n > 1 ;\n\ta += b / 12 ;\n\tb %= 12 ;\n\t\n\tprintf(\"%d %d\", a, b) ;\n\t\n\treturn 0 ;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, a, b;\n\n scanf(\"%d\", &n);\n\n a = n / 36;\n b = n / 3 - a * 12;\n\n if (n - (a * 12 + b) * 3 == 2) b++;\n\n if (b == 12) {\n\t a++;\n\t b = 0;\n }\n\n printf(\"%d %d\\n\", a, b);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\t\n\tint n,i,j;\n\tscanf(\"%d\",&n);\n\tj=n;\n\tn=n/3;\t\n\ti=j%3;\n\tif(i==1)i=0;\n\telse if(i==2) i=1;\n\tn=n+i; \n\n\n\tprintf(\"%d %d\",n/12,n%12);\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n//#include<conio.h>\nint main()\n {\n int n,c,d,e;\n scanf(\"%d\",&n);\n c=n%3;\n d=n/3;\n if(c==2) d++;\n e=d%12; \n d/=12;\n printf(\"%d %d\",d,e);\n //getch();\n return 0; \n }\n"}, {"source_code": "#include<stdio.h>\n\nint main(void)\n{\n int s, f;\n scanf(\"%d\",&s); \n f = s / 3;\n if (s % 3 > 1) {\n\t f++;\n }\n printf(\"%d %d\\n\", f / 12, f % 12);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,feet,tmp,inch;\n scanf(\"%d\",&n);\n inch=n/3;\n if(n%3==2)\n {\n inch++;\n }\n feet=inch/12;\n inch=inch%12;\n printf(\"%d %d\\n\",feet,inch);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint round(float);\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n int f;\n int i=round(n/3.0);\n printf(\"%d %d\",i/12,i%12);\n return 0;\n}\nint round(float k)\n{\n int p;\n p=k;\n float t=k-p;\n if(t>=0.5) return (p+1);\n if(t<0.5) return (p);\n\n}\n"}, {"source_code": "// Measuring Lengths in Baden.c\n// \n// Copyright 2012 Administrator <cpy@ubuntu>\n// \n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2 of the License, or\n// (at your option) any later version.\n// \n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n// MA 02110-1301, USA.\n\n\n#include <stdio.h>\n\nvoid func(int n)\n{\n\tint a, b = 0;\n\ta = n / 36;\n\tn %= 36;\n\tb = n / 3;\n\tn %= 3;\n\tif (n == 2)\n\t{\n\t\tb ++;\n\t\tif (b >= 12)\n\t\t{\n\t\t\ta += (b * 3) / 36;\n\t\t\tb = b - (b * 3) / 36 * 12;\n\t\t}\n\t}\n\tprintf(\"%d %d\\n\", a, b);\n}\n\nint main(int argc, char **argv)\n{\n\tint n;\n\twhile (scanf(\"%d\", &n) == 1)\n\t{\n\t\tfunc(n);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int feet = n/36;\n int remainer = n%36;\n int inches = 0;\n if(remainer >= 3){\n inches = remainer/3;\n remainer = remainer%3;\n }\n remainer = (remainer == 2) ? 1 : 0;\n inches += remainer;\n if (inches >= 12) {\n feet += inches/12;\n inches = inches%12;\n }\n printf(\"%d %d\\n\", feet, inches);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{int a,b,c,d,e,f;\nscanf(\"%d\",&a);\nb=a/3;\nc=a%3;\nif(c==2)\n {d=b+1;}\nelse\n {d=b;}\n e=d/12;\n f=d%12;\n printf(\"%d %d\",e,f);\n return 0;\n}\n"}, {"source_code": "int main(void)\n{\n int n;\n scanf(\"%d\", &n);\n int d = (n + 1) / 3, f = d / 12;\n d -= f * 12;\n printf(\"%d %d\", f, d);\n return 0;\n}"}, {"source_code": "int main(void)\n{\n int n;\n scanf(\"%d\", &n);\n int d = (n + 1) / 3, f = d / 12;\n d %= 12;\n printf(\"%d %d\", f, d);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char *argv[])\n{\n\tint n;\n\t\n\tscanf(\"%d\", &n);\n\t\n\tprintf(\"%d %d\\n\", (n + 1) / 3 / 12, (n + 1) / 3 % 12);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include <string.h>\n#define N 100011\n\nchar str[N];\n\nint main()\n{\n int n;\n int a,b;\n while(scanf(\"%d\", &n) != EOF) {\n a = n / 3;\n if(n % 3 >= 2) a++;\n b = a / 12;\n a %= 12;\n printf(\"%d %d\\n\", b, a);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tint feet,inches;\n\n\twhile(scanf(\"%d\",&n) != EOF) {\n\t\tn += 1;\n\t\tinches = n / 3;\n\t\tprintf(\"%d %d\\n\",inches / 12 ,inches % 12);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(void){\nint a ,b,c ;\ndiv_t op;\nscanf(\"%d\",&a);\n\nop=div(a,36);\nb=op.quot;\n\nop=div(op.rem,3);\nc=op.quot;\nif(op.rem==2){c=c+1;}\nif(c==12){b++;\nc=0;}\n printf(\"%d \",b);\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,d,e;\n scanf(\"%d\", &n);\n if(n%3==0)\n {\n a=n/3;\n c=a/12;\n d=a%12;\n printf(\"%d %d\", c, d);\n }\n else\n {\n a=n/3;\n b=n%3;\n c=b/2+a;\n d=c/12;\n e=c%12;\n printf(\"%d %d\",d,e);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,a,b,k;\n scanf(\"%d\", &n);\n k = n / 3;\n if (n % 3 == 2)\n k++;\n a = k / 12;\n n -= 36*a;\n b = n / 3;\n if (n % 3 == 2)\n b++;\n printf(\"%d %d\", a, b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\n\tint n;\n\tint foot, inch;\n\n\tscanf(\"%d\",&n);\n\n\tfoot = n/36;\n\n\tinch = (n-foot*36 +1)/3;\n\n\tif (inch == 12) {\n\t\tfoot++;\n\t\tinch = 0;\n\t}\n\n\tprintf(\"%d %d\\n\", foot,inch);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint round(float);\nmain()\n{\n int n;\n scanf(\"%d\",&n);\n int i=round(n/3.0);\n printf(\"%d %d\",i/12,i%12);\n return 0;\n}\nint round(float k)\n{\n int p;\n p=k;\n float t=k-p;\n if(t>=0.5) return (p+1);\n if(t<0.5) return (p);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b, c;\n scanf (\"%d\", &n);\n printf(\"%d \",a = (n+1) / 36);\n b = n - a * 36;\n c = b / 3;\n if (b - c * 3 > 1) c++;\n printf (\"%d\", c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b;\n scanf(\"%d\",&n);\n b=n/3;\n if(n%3==2)\n ++b;\n a=b/12;\n b%=12;\n printf(\"%d %d\",a,b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(){\nint cm,ft,inches;\nscanf(\"%d\",&cm);\ninches=cm/3;\nif(cm%3>1)\n inches++;\nft=inches/12;\ninches=inches%12;\n\nprintf(\"%d %d\",ft,inches);\n// system(\"Pause\");\n return 0;\n}"}, {"source_code": "\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\t\n\t\n\tint n;\n\tint feet;\n\tint inch;\n\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"input.txt\",\"r\", stdin);\n\t\tfreopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\n\t\tscanf(\"%d\", &n);\n\n\t\tfeet = n / 36;\n\t\tinch = n % 36;\n\n\t\tinch = (inch + 1 )/3;\n\n\t\tif (inch == 12)\n\t\t{\n\t\t\tfeet++;\n\t\t\tinch = 0;\n\t\t}\n\t\tprintf(\"%d %d\\n\", feet, inch);\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int a,b;\n scanf(\"%d\",&n);\n a=n/36;\n n=n%36;\n b=n/3;\n if((n%3!=0)&&(n%3==2))\n b++;\n if(b==12)\n {\n a++;\n b=0;\n }\n printf(\"%d %d\",a,b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n // read number\n int cm;\n scanf(\"%d\", &cm);\n\n // figure out feet\n int ft = cm/36;\n\n // figure out inches\n int inch_in_cm = cm - ft*36;\n int inches = inch_in_cm/3;\n int rem_inches = (inch_in_cm - inches*3) % 3;\n\n if (rem_inches > 1)\n inches++;\n\n // in case ft rounds up\n if (inches == 12)\n {\n inches = 0;\n ft++;\n }\n\n printf(\"%d %d\\n\", ft, inches);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(int argc, char *argv[])\n{\n int N,d,f;\n scanf(\"%d\",&N);\n d = N/3;\n if(N%3>1){\n\t\td++;\n\t}\n\tf = d/12;\n\td = d - f*12;\n\tprintf(\"%d %d\\n\", f, d);\n //system(\"PAUSE\");\t\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b;\n scanf(\"%d\", &n);\n a = n/36;\n b = (n-36*a)/3;\n if(n-36*a-3*b == 2) {\n b++;\n if(b==12) {\n a++;\n b = 0;\n }\n }\n printf(\"%d %d\", a, b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,g,h,i,j;\n\tscanf(\"%d\",&n);\n\tg=n/36;\n\th=n%36;\n\tif (h==35){\n\t\tg=g+1;\n\t\th=0;\n\t}\n\ti=h/3;\n\tj=h%3;\n\tif (j==2){\n\t\ti=i+1;\n\t}\n\tprintf(\"%d %d\",g,i);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int cm, feet, inch ;\n\n scanf(\"%d\", &cm) ;\n\n for(inch=0; cm>1; ++inch)\n cm = cm - 3 ;\n\n for(feet=0; inch>=12; ++feet)\n inch = inch - 12 ;\n\n printf(\"%d %d\", feet, inch);\n\n return 0 ;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,feet,rem,inch;\n scanf(\"%d\",&n);\n feet=n/36;\n rem=n%36;\n inch=rem/3;\n if(rem%3==2)inch++;\n if(inch==12)feet++;\n \n printf(\"%d %d\\n\",feet,inch);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,feet,rem,inch;\n scanf(\"%d\",&n);\n feet=n/36;\n rem=n%36;\n inch=rem/3;\n if(rem%3==2)inch++;\n printf(\"%d %d\\n\",feet,inch);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\nmain()\n{\n int i,j, cm, feet, inch;\n\n scanf(\"%d\", &cm);\n\n feet=cm/36;\n\n inch=(int)ceil((double)(cm%36)/3);\n\n\n\n\n printf(\"%d %d\",feet, inch);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\nmain()\n{\n int i,j, cm, feet, inch;\n //1 feet= 12 inc\n scanf(\"%d\", &cm); //1 inch = 3 cm\n\n feet=cm/36;\n\n inch=(cm%36)/3;\n\n\n inch=(int)ceil((cm%36)/3.0) ;\n\n\n\n\n printf(\"%d %d\",feet, inch);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\nmain()\n{\n int i,j, cm, feet, inch;\n\n scanf(\"%d\", &cm);\n\n feet=cm/36;\n\n inch=round((cm%36)/3);\n\n\n\n\n printf(\"%d %d\",feet, inch);\n}\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\n#include<conio.h>\n#include<math.h>\n\nmain()\n{\n int i,j, cm, feet, inch=0;\n //1 feet= 12 inc\n scanf(\"%d\", &cm); //1 inch = 3 cm\n\n feet=cm/36;\n\n\n\n\n inch=(cm%36)/3;\n if(cm%3==2){inch++;};\n\n printf(\"%d %d\",feet, inch);\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int f,i,c;\n scanf(\"%d\",&c);\n f=c/36;\n c=c%36;\n i=c/3;\n c=c%3;\n if(c==2)\n i++;\n printf(\"%d %d\",f,i);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,feet,inch;\n scanf(\"%d\",&n);\n feet=n/36;\n n=n%36;\n\n if(n%3==0||n%3==1)\n {\n inch=n/3;\n }\n\n else if(n%3==2)\n {\n inch=n/3+1;\n }\n printf(\"%d %d\",feet,inch);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int n,a,b;\n\n scanf(\"%d\", &n);\n\n a = n/36;\n b = (n%36)/3;\n\n if((n%36)%3 == 2) b++;\n\n printf(\"%d %d\", a, b);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,r,f,i;\n scanf(\"%d\",&n);\n r=n/3;\n n%=3;\n f=r/12;\n r%=12;\n \n if(n<2)\n n=0;\n else if(n>1)\n n=1;\n i=r+n;\n printf(\"%d %d\",f,i);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n, i,feet, inch, cen,k,r, t;\n\tscanf(\"%d\", &cen);\n\tinch=cen/3;\n\tr=cen%3;\n\tif(r==2)\n\t{\n\t\tinch=inch+1;\n\t}\n\t//printf(\"%d\\n\", inch);\n\tfeet=inch/12;\n\tinch=inch%3;\n\n\n\tprintf(\"%d %d \",feet, inch);\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n,q,r;\nscanf(\"%d\",&n);\nif(n%36==1)\n{\nq=(n/36)+1;\nr=0;\n}\nelse\n{\nq=n/36;\nr=n%36;\n}\nprintf(\"%d\\t\",q);\nif((r%3==0)||(r%3==1))\n{\nprintf(\"%d\",r/3);\n}\nelse if(r%3==2)\n{\nprintf(\"%d\",(r/3)+1);\n}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nint q=n/36;\nprintf(\"%d\\t\",q);\nint r=n%36;\nif((r%3==0)||(r%3==1))\n{\nprintf(\"%d\",r/3);\n}\nelse if(r%3==2)\n{\nprintf(\"%d\",(r/3)+1);\n}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nint n;\nscanf(\"%d\",&n);\nint q=n/36;\nprintf(\"%d\\t\",q);\nint r=n%36;\nif((r%3==0)&&(r%3==1))\n{\nprintf(\"%d\",r/3);\n}\nelse if(r%3==2)\n{\nprintf(\"%d\",(r/3)+1);\n}\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int num,a,b,c;\n\tscanf(\"%lld\",&num);\n\ta=num/36;\n\tb=num-(a*36);\n\tc=b/3;\n\tif(b%3==2)\n\t{\n\t\tc++;\n\t}\n\telse\n\tc=c;\n\t\n\tprintf(\"%lld %lld\\n\",a,c);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int num,a,b,c;\n\tscanf(\"%lld\",&num);\n\ta=num/36;\n\tb=num-(a*36);\n\tc=b/3;\n\tif(b%3==0)\n\t{\n\t\tc=c;\n\t}\n\telse\n\tc++;\n\t\n\tprintf(\"%lld %lld\\n\",a,c);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c,temp=0;\n scanf(\"%d\", &c);\n\n f=c/36;\n\n if(c%36!=0)\n c%36==temp;\n temp==i;\n i=temp/3;\n printf(\"%d %d\",f,i);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c,temp;\n scanf(\"%d\", &c);\n\n f=c/36;\n\n if(c%36!=0)\n c%36==temp;\n temp==i;\n i=temp/3;\n printf(\"%d %d\",f,i);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c,temp;\n scanf(\"%d\", &c);\n\n f=c/36;\n\n if(c%36!=0)\n temp==c%36;\n temp=i;\n i=temp/3;\n printf(\"%d %d\",f,i);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c,temp;\n scanf(\"%d\", &c);\n\n f=c/36;\n\n if(c%36==0)\n c%36==temp;\n temp==i;\n i=temp/3;\n printf(\"%d %d\",f,i);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n\n{\n int i,f,c,temp;\n scanf(\"%d\", &c);\n\n f=c/36;\n\n if(c%36!=0)\n c%36==temp;\n temp==i;\n i=temp/3;\n printf(\"%d %d\",f,i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define test 0.5\n\nint main()\n{\n\tdouble n,inch,temp;\n\tint feet;\n\tscanf(\"%lf\",&n);\n\tinch = n/3;\n\t//printf(\"%lf\\n\",inch);\n\tfeet = inch/12;\n\tinch = inch - (12*feet);\n\t//printf(\"%lf\\n\",inch);\n\ttemp = inch - (int)inch;\n\tinch = (int)inch;\n\t//printf(\"%lf\\n\",temp);\n\tif(temp > test)\n\t\tinch += 1;\n\t\n\tprintf(\"%d %.0lf\\n\",feet,inch);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i,f;\n scanf(\"%d\",&n);\n f=(float)n/36+.5;\n n=n-f*36;\n i=(float) n/3+.5;\n printf(\"%d %d\",f,i);\n return 0;\n} \n \n \n \n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i,f;\n scanf(\"%d\",&n);\n f=n/36;\n n=n-f*36;\n i=(float) n/3+.5;\n printf(\"%d %d\",f,i);\n return 0;\n} \n \n \n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b;\n scanf(\"%d\",&n);\n a = n/36;\n n %= 36;\n b = (n + 1)/3;\n printf(\"%d %d\",a,b);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d\",&n);\n\ta=n/36;\n\tb=(n%36)/3;\n\tif((n%36)%3==2) b++;\n\tprintf(\"%d %d\\n\",a,b);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c,i,f;\n\twhile(scanf(\"%d\",&c)!=EOF)\n\t{\n\t\tf=c/36;\n\t\ti=(c-f*36)%3==2?(c-f*36)/3+1:(c-f*36)/3;\n\t\tif(i%12==0){\n\t\t\t++f;i=0;\n\t\t}\n\t\tprintf(\"%d %d\\n\",f,i);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c,i,f;\n\twhile(scanf(\"%d\",&c)!=EOF)\n\t{\n\t\t//i=(c-c/36*36)%3==2?(c-c/36*36)/3+1:(c-c/36*36)/3;\n\t\tprintf(\"%d %d\\n\",c/36,(c-c/36*36)%3==2?(c-c/36*36)/3+1:(c-c/36*36)/3);\n\t}\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n\tint c,i,f;\n\twhile(scanf(\"%d\",&c)!=EOF)\n\t{\n\t\tf=c/36;\n\t\ti=(c-f*36)%3==2?(c-f*36)/3+1:(c-f*36)/3;\n\t\tif(i%12>=6||i%12==0){\n\t\t\t++f;i=0;\n\t\t}\n\t\tprintf(\"%d %d\\n\",f,i);\n\t}\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int a,b,c,n;\n scanf(\"%d\",&n);\n a=n / 36 ;\n c=n % 36;\n b=c / 3;\n if (c % 3 >= 2)\n {\n b++;}\n printf(\"%d %d\",a,b);\n return 0;\n}\n "}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n float m;\n scanf(\"%d\",&n);\n i=n/36;\n n=n%36;\n if(i==0)\n printf(\"0\");\n else\n printf(\"%d\",i);\n m=(float)n;\n m=m/3;\n n=n/3;\n if(m-n>0.5)\n printf(\" %d\",n+1);\n else\n printf(\" %d\",n);\n return(0); \n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint S,N,K,T,Y;\n\tscanf(\"%d\",&S);\n\tT=S;\n\tN=S/36;\n\tY=S%36;\n\tS=S/36;\n\tif(T%3<2)\n\tK=(Y/3);\n\telse\n\tK=(Y/3)+1;\n\tprintf(\"%d %d\",N,K);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,feet,inch=0,t;\nscanf(\"%d\",&n);\nfeet=n/36;\nt=n%36;\nwhile(t>3)\n{\nt=t-3;\ninch++;\n}\nif(t>=2)inch++;\nprintf(\"%d %d\",feet,inch);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong int n,feet,inch=0,t,p;\nscanf(\"%ld\",&n);\nfeet=n/36;\nt=n%36;\ninch=t/3;\np=t%3;\nif(p>=2)inch++;\nprintf(\"%ld %ld\",feet,inch);\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,f=0;\n scanf(\"%d\",&n);\n if(n>=36)\n {\n f=n/36;\n n%=36;\n }\n if(n%3==2)\n i=n/3+1;\n else\n i=n/3;\n printf(\"%d %d\",f,i);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,n,i,j,k;\n scanf(\"%d\",&n);\n a=n/36;\n if((n%36)%3==0)\n b=(n%36)/3;\n else\n {\n if((n%36)%3==2)\n b=(n%36)/3+1;\n else b=(n%36)/3;\n }\n printf(\"%d %d\",a,b);\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d %d\",n/36,n%36/3);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d %d\",n/36,(n%36+1)/3);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n printf(\"%d %d\",n/36,(n%36)/3);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,f,i;\nscanf(\"%d\",&n);\nf=n/36;\ni=n%36/3;\nif((n%36)%3==1)\n;\nelse if((n%36)%3==2)\n i++;\nelse;\nprintf(\"%d %d\",f,i);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nint n,f,i;\nscanf(\"%d\",&n);\nf=n/36;\ni=n%36/3;\nif(((n%36)%3)==1)\n;\nelse if(((n%36)%3)==2)\n i++;\nelse;\nprintf(\"%d %d\",f,i);\n\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main(void)\n{\n\tint s, d, f;\n\tscanf(\"%i\", &s);\n\tf = s / 36;\n\td = (s - f*36) / 3;\n\tif ((s - f*36) - d*3 > 0) {\n\t\td++;\n\t}\n\tprintf(\"%d %d\\n\", f, d);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,feet,tmp,inch;\n scanf(\"%d\",&n);\n feet=n/36;\n tmp=n%36;\n inch=tmp/3;\n if(tmp%3==2)\n inch++;\n printf(\"%d %d\\n\",feet,inch);\n return 0;\n}\n"}, {"source_code": "// Measuring Lengths in Baden.c\n// \n// Copyright 2012 Administrator <cpy@ubuntu>\n// \n// This program is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2 of the License, or\n// (at your option) any later version.\n// \n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n// MA 02110-1301, USA.\n\n\n#include <stdio.h>\n\nvoid func(int n)\n{\n\tint a, b;\n\ta = n / 36;\n\tn %= 36;\n\tb = n / 3;\n\tn %= 3;\n\tif (n == 2)\n\t{\n\t\tb ++;\n\t}\n\tprintf(\"%d %d\\n\", a, b);\n}\n\nint main(int argc, char **argv)\n{\n\tint n;\n\twhile (scanf(\"%d\", &n) == 1)\n\t{\n\t\tfunc(n);\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int feet = n/36;\n int remainer = n%36;\n int inches = 0;\n if(remainer >= 3){\n inches = remainer/3;\n remainer = remainer%3;\n }\n remainer = (remainer == 2) ? 1 : 0;\n inches += remainer;\n printf(\"%d %d\\n\", feet, inches);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int feet = n/36;\n int remainer = n%36;\n int inches = remainer/3;\n remainer = remainer%3;\n remainer = (remainer == 2) ? 1 : 0;\n inches += remainer;\n if (feet*36 + inches*3 < n) {\n inches++;\n }\n printf(\"%d %d\\n\", feet, inches);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\", &n);\n int feet = n/36;\n int remainer = n%36;\n int inches = remainer/3;\n remainer = remainer%3;\n remainer = (remainer == 2) ? 1 : 0;\n inches += remainer;\n printf(\"%d %d\\n\", feet, inches);\n return 0;\n}"}, {"source_code": "int main(void)\n{\n int n;\n scanf(\"%d\", &n);\n printf(\"%d %d\", n / 36, (n % 36 + 1) / 3);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint main(void){\nint a ,b,c ;\ndiv_t op;\nscanf(\"%d\",&a);\n\nop=div(a,36);\nb=op.quot;\n\nop=div(op.rem,3);\nc=op.quot;\nif(op.rem==2){c=c+1;}\n printf(\"%d \",b);\n printf(\"%d\",c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,a,b;\n\tscanf(\"%d\", &n);\n\tb = n / 3;\n\tif (n % 3 == 2)\n\t\tb++;\n\ta = b / 12;\n\tprintf(\"%d %d\", a, b);\n\treturn 0;\n}\n\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,a,b,k;\n scanf(\"%d\", &n);\n k = n / 3;\n if (k % 3 == 2)\n k++;\n a = k / 12;\n n -= 36*a;\n b = n / 3;\n if (b % 3 == 2)\n b++;\n printf(\"%d %d\", a, b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n,a,b,k;\n scanf(\"%d\", &n);\n k = n / 3;\n if (k % 3 == 2)\n k++;\n a = k / 12;\n n -= 36*a;\n b = n / 3;\n if (n % 3 == 2)\n b++;\n printf(\"%d %d\", a, b);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\n\tint n;\n\tint foot,inch;\n\n\tscanf(\"%d\",&n);\n\n\tfoot = n/36;\n\n\tinch = (n-foot*36 +1)/3;\n\n\tprintf(\"%d %d\\n\", foot,inch);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b, c;\n scanf (\"%d\", &n);\n printf(\"%d \",a = n+1 / 36);\n b = n - a * 36;\n c = b / 3;\n if (b - c * 3 > 1) c++;\n printf (\"%d\", c);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, a, b, c;\n scanf (\"%d\", &n);\n printf(\"%d \",a = n / 36);\n b = n - a * 36;\n c = b / 3;\n if (b - c * 3 > 1) c++;\n printf (\"%d\", c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main(){\nint cm,ft,inches;\nscanf(\"%d\",&cm);\ninches=cm/3;\nft=inches/12;\ninches=inches%12;\nif(cm%3>1)\n inches++;\nprintf(\"%d %d\",ft,inches);\n// system(\"Pause\");\n return 0;\n}"}, {"source_code": "\n\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint main()\n{\t\n\t\n\tint n;\n\tint foot;\n\tint inch;\n\n\t#ifndef ONLINE_JUDGE\n\t\tfreopen(\"input.txt\",\"r\", stdin);\n\t\tfreopen(\"output.txt\", \"w\", stdout);\n\t#endif\n\n\t\tscanf(\"%d\", &n);\n\n\t\tfoot = n / 36;\n\t\tinch = n % 36;\n\n\t\tinch = (inch + 1 )/3;\n\n\t\tprintf(\"%d %d\\n\", foot, inch);\n\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n int a,b;\n scanf(\"%d\",&n);\n a=n/36;\n n=n%36;\n b=n/3;\n if((n%3!=0)&&(n%3==2))\n b++;\n printf(\"%d %d\",a,b);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n // read number\n int cm;\n scanf(\"%d\", &cm);\n\n // figure out feet\n int ft = cm/36;\n\n // figure out inches\n int inch_in_cm = cm - ft*36;\n int inches = inch_in_cm/3;\n int rem_inches = (inch_in_cm - inches*3) % 3;\n\n if (rem_inches > 1)\n inches++;\n\n printf(\"%d %d\\n\", ft, inches);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,g,h,i,j;\n\tscanf(\"%d\",&n);\n\tg=n/36;\n\th=n%36;\n\ti=h/3;\n\tj=h%3;\n\tif (j==2){\n\t\ti=i+1;\n\t}\n\tprintf(\"%d %d\",g,i);\n\treturn 0;\n}\n"}], "src_uid": "5d4f38ffd1849862623325fdbe06cd00"} {"nl": {"description": "The Little Elephant loves chess very much. One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8\u2009\u00d7\u20098 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboard doesn't have any side-adjacent cells with the same color and the upper left cell is white. To play chess, they want to make the board they have a proper chessboard. For that the friends can choose any row of the board and cyclically shift the cells of the chosen row, that is, put the last (rightmost) square on the first place in the row and shift the others one position to the right. You can run the described operation multiple times (or not run it at all).For example, if the first line of the board looks like that \"BBBBBBWW\" (the white cells of the line are marked with character \"W\", the black cells are marked with character \"B\"), then after one cyclic shift it will look like that \"WBBBBBBW\".Help the Little Elephant and his friend to find out whether they can use any number of the described operations to turn the board they have into a proper chessboard.", "input_spec": "The input consists of exactly eight lines. Each line contains exactly eight characters \"W\" or \"B\" without any spaces: the j-th character in the i-th line stands for the color of the j-th cell of the i-th row of the elephants' board. Character \"W\" stands for the white color, character \"B\" stands for the black color. Consider the rows of the board numbered from 1 to 8 from top to bottom, and the columns \u2014 from 1 to 8 from left to right. The given board can initially be a proper chessboard.", "output_spec": "In a single line print \"YES\" (without the quotes), if we can make the board a proper chessboard and \"NO\" (without the quotes) otherwise.", "sample_inputs": ["WBWBWBWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB", "WBWBWBWB\nWBWBWBWB\nBBWBWWWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWWW\nBWBWBWBW\nBWBWBWBW"], "sample_outputs": ["YES", "NO"], "notes": "NoteIn the first sample you should shift the following lines one position to the right: the 3-rd, the 6-th, the 7-th and the 8-th.In the second sample there is no way you can achieve the goal."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nchar s[8][9]={\"WBWBWBWB\",\"BWBWBWBW\",\"WBWBWBWB\",\"BWBWBWBW\",\"WBWBWBWB\",\"BWBWBWBW\",\"WBWBWBWB\",\"BWBWBWBW\"};\nint test(char s[],char x[]);\nmain()\n{\n //freopen(\"input\",\"r\",stdin);\n int i,j,k,l=0,t;\n char x[12][12];\n for(i=0;i<8;i++)\n scanf(\"%s\",x[i]);\n for(i=0;i<8;i++)\n {\n t=test(x[i],s[i]);\n if(t)\n l++;\n }\n if(l==8)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n\n return 0;\n}\nint test(char x[],char s[])\n{\n int i,j,k,l=0,pos=-99;\n for(i=0;i<8;i++)\n {\n if(s[0]==x[i])\n {\n pos=i;\n break;\n }\n }\n if(pos!=-99)\n {\n for(i=pos,j=0;i<8;i++,j++)\n {\n if(s[i]==x[j])\n l++;\n }\n for(i=0;i<pos;i++)\n {\n if(s[i]==x[j])\n l++;\n }\n if(l==8)\n return 1;\n else\n return 0;\n }\n else\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i , j , k , y = 1 , w = 0 , b = 0 ;\n char s[9][9] ;\n for(i = 0 ; i<8 ; i++)\n {\n scanf(\"%s\",s[i]);\n w = 0 ; b = 0 ; j = 0 ;\n if(s[i][j]=='W') w++;\n if(s[i][j]=='B') b++;\n for(j = 1 ; j<8 ; j++)\n { if(s[i][j]=='W') w++;\n if(s[i][j]=='B') b++;\n if(s[i][j-1]==s[i][j]) y = 0 ;\n }\n if(w!=4) y = 0 ;\n if(b!=4) y = 0 ;\n }\n if(y)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0 ;\n} \n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint x,i,j,f=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\" %c\",&arr[i][j]);\n\t}\n\tfor(i=0;i<8;i++){\n for(j=1;j<8;j++){\n\t\t\tif(arr[i][j]=='W'){\n\t\t\t\tif(arr[i][j-1]==arr[i][j]){\n\t\t\t\t\tprintf(\"NO\");return 0;}\n\t\t\t}\n\t\t\tif(arr[i][j]=='B'){\n\t\t\t\tif(arr[i][j-1]==arr[i][j]){\n\t\t\t\t\tprintf(\"NO\");return 0;}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\n\nint main()\n{\n int i,l,count=0,t=8;\n char a[10];\n while(t--){\n gets(a);\n if(count==0){for(i=0;i<7;i++){\n if(a[i]==a[i+1]){count++;}\n }}}\n if(count){printf(\"NO\");}\n else{printf(\"YES\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar a[10][10];\nint main(void)\n{\n int i, j;\n for(i=1; i<=8; i++)\n {\n for(j=1; j<=8; j++)\n {\n scanf(\" %c\", &a[i][j]);\n }\n }\n for(i=1; i<=8; i++)\n {\n for(j=1; j<=7; j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n int i,flag=0;\n char a[9]=\"BWBWBWBW\",b[9]=\"WBWBWBWB\",s[9];\n for(i=0;i<8;i++)\n {\n gets(s);\n if ((strcmp(s,a)!=0)&&(strcmp(s,b)!=0))\n {\n flag=1;\n }\n }\n if(flag==0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<stdlib.h>\nint main(){\n short i = 0,j = 0,k = 0;\n char a='a',b='a';\n for(i=0;i<8;i++){\n b='a';\n for(j=0;j<8;j++){\n a=getchar();\n if(a==b) k=1;\n b=a;\n }\n getchar();\n }\n if(k==1) printf(\"NO\\n\");\n else printf(\"YES\\n\");\n // system(\"pause\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint n=8,f=0;\n char a[n][n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(int i=0;i<n;i++)\n {\n int c=0;\n for(int j=0;j<n-1;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n c=1;\n break;\n }\n }\n if(c==1)\n {\n f=1;\n break;\n }\n }\n if(f==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][9];\n int i,j,flag=0;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n flag=1;\n break;\n }\n }\n if(flag)\n break;\n }\n if(flag)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n char a[8][8];char f;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&f);\n } //printf(\"gggf\");\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n // printf(\"%c\",a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if((a[i][j]=='W' && a[i][j+1]=='W' && j+1<8)||(a[i][j]=='B' && a[i][j+1]=='B' && j+1<8))\n {\n\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a==4 && b==4 || a+b==8 )\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int c, d, res = 1;\n for (d = EOF; c = getchar (), c != EOF; d = c)\n res &= c != d;\n printf (\"%s\\n\", res ? \"YES\" : \"NO\");\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int j,i;\n char str[8][8];\n for(i=0; i<8; ++i)\n scanf(\"%s\", str[i]);\n \n for(i=0; i<8; ++i)\n { \n for(j=0; j<7; ++j)\n if(str[i][j]==str[i][j+1])\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n//#include <ctype.h>\n//#include <string.h>\n//#include <math.h>\nint main()\n{\n int i,j,f=0;\n char s[9][9];\n for(i=0;i<8;i++)\n gets(s[i]);\n for(i=0;i<8;i++)\n {\n // gets(s);\n for(j=0;j<7;j++)\n {\n if(s[i][0]==s[i][7] ||s[i][j]==s[i][j+1])\n {\n f=1;\n break;\n }\n\n }\n if(f==1)\n break;\n }\n if(f==0)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ara[9][9];\n int i,j,s=0;\n for(i=0;i<8;i++){\n scanf(\"%s\",ara[i]);\n }\n for(i=0;i<8;i++){\n for(j=0;j<7;j++){\n if(ara[i][j]==ara[i][j+1]){\n s=1;\n break;\n }\n }\n }\n if(s==0)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a+b==8)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a==4 && b==4 || a+b==8 )\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int flag=0,i;\n char ch[10];\n for(i=0;i<8;i++)\n {\n gets(ch);\n if(strcmp(ch,\"WBWBWBWB\") && (strcmp(ch,\"BWBWBWBW\")))\n return printf(\"NO\\n\"),0;\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main()\n{\n int i,j;\n char temp;\n char ch[8][8];\n \n for(i = 0; i < 8 ; i++)\n { \n temp = 'A';\n for(j = 0 ; j < 8 ; j++)\n {\n scanf(\"%c\",&ch[i][j]);\n if(temp == ch[i][j])\n {\n printf(\"NO\\n\");\n return 0;\n }\n temp = ch[i][j];\n }\n scanf(\"%c\",&temp);\n }\n printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a+b==8)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main () {\n\tchar str[100][100] = {0};\n\tint j,i;\n\tfor(i = 0; i<8; i++)\n\t\tfor(j = 0; j<8 ; j++)\n\t\t\tscanf(\" %c\",&str[i][j]);\n\n\tfor(i = 0; i<8 ; i++){\n\t\tfor(j = 0; j<7 ; j++)\n\t\t\tif(str[i][j] == str[i][j+1]){\n\t\t\t\tprintf(\"NO\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(int argc, const char* argv[])\n{\n\tint i;\n\tchar line[10];\n\tfor (i = 0; i < 8; i++) {\n\t\tfgets(line, sizeof(line), stdin);\n\t\tif (line[0] == line[2] && line[2] == line[4] && line[4] == line[6] &&\n\t\t line[1] == line[3] && line[3] == line[5] && line[5] == line[7] &&\n\t\t\tline[0] != line[1])\n\t\t\tcontinue;\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a+b==8)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\ntypedef char string[80];\n\nint IsSelangSeling(string Kata, int Idx)\n{\n\tif (Kata[Idx] == '\\0') return 1;\n\telse if ((Idx+1) % 8 == 0)\n\t{\n\t\tIdx = Idx + 1;\n\t\treturn IsSelangSeling(Kata,Idx);\n\t}\n\telse\n\t{\n\t\tif (Kata[Idx] == Kata[Idx+1]) //bukan selang-seling\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tIdx = Idx + 1;\n\t\t\treturn IsSelangSeling(Kata,Idx);\n\t\t}\n\t}\n}\n\t\t\nint main()\n{\n\tstring Kata;\n\tchar CC;\n\tint W = 0;\n\tint B = 0;\n\tint i=0;\n\t\n\twhile (i <= 63)\n\t{\n\t\tscanf(\"%c\",&CC);\n\t\tif (CC != '\\n')\n\t\t{\n\t\t\tKata[i] = CC;\n\t\t\ti++;\n\t\t}\n\t\t\n\t}\n\tKata[i] = '\\0';\n\t\n\tif (IsSelangSeling(Kata,0))\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid solve(char s[][10])\n{\n int i,j;\n\n for(i=0;i<8;++i)\n {\n for(j=0;j<7;++j)\n {\n if(s[i][j]==s[i][j+1])\n {\n printf(\"NO\\n\");\n return;\n }\n }\n }\n printf(\"YES\\n\");\n}\n\nint main(void)\n{\n char s[10][10];\n int i;\n while(scanf(\"%s\",s[0])!=EOF)\n {\n for(i=1;i<8;++i)\n scanf(\"%s\",s[i]);\n solve(s);\n }\n}"}, {"source_code": "#include<stdio.h>\n#define FLUSH while(getchar()!='\\n')\nint main()\n{\n char c;\n int f=0,j=0;\n char b[9];\n int i=0;\n for(i=0;i<8;i++)\n {\n\t \n\t scanf(\"%s\",b);\n\t FLUSH;\n\t c=b[0];\n\tfor(j=0;j<7;j++)\n\t if(b[j]==b[j+1])f=-1;\n\tif(b[0]==b[7])f=-1;\n }\n if(f==-1)printf(\"NO\");\n else printf(\"YES\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint i,j,kont=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\tscanf(\" %c\",&arr[i][j]);\n\tfor(i=0;i<8;i++){\n\t\tfor(j=1;j<8;j++)\n\t\tif(arr[i][j]==arr[i][j-1])\n\t\t\tkont=0;\n\t}\n\tif(kont)\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\nreturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{int a,b,c,d,e,f,i,j,k=0,l,sum1=0,sum2=0;\n char *s[8];\n for(i=0;i<8;i++)\n { s[i]=(char *)malloc(9);\n scanf(\"%s\",s[i]);}\n for(i=0;i<8;i++)\n { sum1=0;\n sum2=0;\n for(j=0;j<7;j++)\n {\n if(s[i][j]==s[i][j+1])\n {\n k=1;\n break;\n }\n \n }\n }\n if(k==0)\n {\n printf(\"YES\");\n }\n else\n {\n printf(\"NO\");\n }\n return 0;\n }"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j, c1, c2, good;\n\tstatic char s[9];\n\n\tfor (i = 0; i < 8; i++) {\n\t\tscanf(\"%s\", s);\n\t\tc1 = s[0], c2 = s[1];\n\t\tgood = 1;\n\t\tfor (j = 0; j < 8; j += 2)\n\t\t\tif (s[j] != c1) {\n\t\t\t\tgood = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tfor (j = 1; j < 8; j += 2)\n\t\t\tif (s[j] != c2) {\n\t\t\t\tgood = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (!good || c1 == c2) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint i,j;\n\tchar board[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8 && is_ok;i++){\n\t\tfor(j=0;j<8-1;j++){\n\t\t\tif(board[i][j]==board[i][j+1]){\n\t\t\t\tis_ok=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar board[8][8];\nint check_row(int row){\n\tint i;\n\tfor(i=0;i<8-1;i++){\n\t\tif(board[row][i]==board[row][i+1])\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main() {\n\tint i,j;\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8;i++){\n\t\tif(!check_row(i)){\n\t\t\tis_ok=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j,k=0,e=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n getchar();\n }\n for(i=0;i<8;i++)\n {\n k=1;\n for(j=0;j<7;j++)\n {\n if(a[i][j]!=a[i][j+1])\n k++;\n }\n if(k==8)\n {\n e++;\n }\n }\n if(e==8)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nchar a[10];\nint main()\n{\n int i,j,flag=1;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a); \n for(j=0;j<7;j++)\n if(a[j]==a[j+1])\n flag=0;\n }\n puts(flag?\"YES\":\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\nint main()\n{\n int i,flag=0;\n char a[9]=\"BWBWBWBW\",b[9]=\"WBWBWBWB\",s[9];\n for(i=0;i<8;i++)\n {\n gets(s);\n if ((strcmp(s,a)!=0)&&(strcmp(s,b)!=0))\n {\n flag=1;\n }\n }\n if(flag==0)\n printf(\"YES\");\nelse\n printf(\"NO\");\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n\n#define PI 3.141592653589793\n#define max(a,b) (a < b) ? (b) : (a)\n#define min(a,b) (a > b) ? (b) : (a)\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) ((x)*PI)/180\n#define y1 y_1\n#define ll long long\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, j;\nchar b[MAX][MAX];\n\nint main () {\n\tscanf(\"%s %s %s %s %s %s %s %s\",b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);\n\tFOR(i,0,7)\n\t\tFOR(j,0,6)\n\t\t\tif(b[i][j] == b[i][j+1]){\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int c, d, res = 1;\n for (d = EOF; c = getchar (), c != EOF; d = c)\n res &= c != d;\n printf (\"%s\\n\", res ? \"YES\" : \"NO\");\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <stdio.h>\nint main(int argc, const char * argv[]) {\n char a[8][8];\n int flag=1,i,j;\n for(i = 0 ; i < 8 ; i++){\n scanf(\"%s\",a[i]);\n for( j=1;j<8;j++)\n if(a[i][j]==a[i][j-1]){\n flag=0;\n }\n }\n if(flag)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h> \nint main()\n{\n int i,t,k;\n char s[8][8];\n\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",s[i]);\n }\n for(i=0;i<8;i++)\n {\n for(k=0;k+1<8;k++)\n {\n if(s[i][k]==s[i][k+1])\n {\n printf(\"NO\");\n return 0;\n }\n\n\n\n else{\n t=0;\n\n }\n }\n\n }\n if(t==0)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,flag=0;\n char a[8][10];\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(i=0;i<8;i++)\n {\n if(strcmp(a[i],\"BWBWBWBW\")==0 || strcmp(a[i],\"WBWBWBWB\")==0)\n {\n continue;\n }\n else\n {\n flag=1;\n break;\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\nint main()\n{\n char cb[8][8];\n int i;\n for(i=0;i<8;i++)\n {\n gets(cb[i]);\n }\n int t,j;\n for(i=0;i<8;i++)\n {\n for(j=0;j+1<8;j++)\n {\n if(cb[i][j]==cb[i][j+1])\n {\n printf(\"NO\");\n return 0;\n }\n else\n t=1;\n }\n }\n if(t>0)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][9];\n int i,count,j;\n for(i=0;i<8;i++)scanf(\"%s\",&a[i]);\n for(i=0;i<8;i++)\n {\n for(j=1;j<8;j++)\n {\n if(a[i][j]==a[i][j-1])\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){ //freopen(\"in.txt\", \"r\", stdin);\n int i, j;\n char s[10];\n for(i = 0; i < 8; i++){\n scanf(\"%s\", s);\n for(j = 1; j < 8; j++)\n if(s[j-1] == s[j]) {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[8][8];\n int i,flag=0,j;\n for(i=0;i<8;i++)\n scanf(\"%s\",s[i]);\n for(i=0;i<8;i++)\n {\n for(j=0;j+1<8;j++)\n {\n if(s[i][j]==s[i][j+1])\n {\n printf(\"NO\");\n return 0;\n }\n else\n flag=1;\n }\n\n }\n if(flag==1)\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n char a[8][8];char f;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&f);\n } //printf(\"gggf\");\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n // printf(\"%c\",a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if((a[i][j]=='W' && a[i][j+1]=='W' && j+1<8)||(a[i][j]=='B' && a[i][j+1]=='B' && j+1<8))\n {\n\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n\n{\n\tchar a[8][8];\n\tint i,g=0;\n\n\tfor(i=0;i<8;i++)\n\t\tscanf(\"%s\",&a[i]);\n\n\tfor(i=0;i<7;i++)\n\t{\n\t\tif(a[0][i]==a[0][i+1])\n {\n printf(\"NO\");g=1;break;\n }\n\n\n\t\telse if(a[1][i]==a[1][i+1])\n\t\t{\n\t\t\tprintf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[2][i]==a[2][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[3][i]==a[3][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[4][i]==a[4][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[5][i]==a[5][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[6][i]==a[6][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\n\t\telse if(a[7][i]==a[7][i+1])\n {\n\t\t printf(\"NO\");g=1;break;\n\t\t}\n\t}\n\n\tif(g==0)\n\t\tprintf(\"YES\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n\nint main()\n{\n\tint n=8,f=0;\n char a[n][n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%s\",a[i]);\n }\n for(int i=0;i<n;i++)\n {\n int c=0;\n for(int j=0;j<n-1;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n c=1;\n break;\n }\n }\n if(c==1)\n {\n f=1;\n break;\n }\n }\n if(f==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i,j;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\t\tscanf(\" %c\",&arr[i][j]);\n\tint f=0;\n\t for(i=0;i<8;i++)\n\t\t for(j=0;j<7;j++)\n\t\t if(arr[i][j]!=arr[i][j+1])\n\t\t\t\t\t\t f=1;\n\t\t else {\n\t\t\t printf(\"NO\");\n return 0;\n\t\t }\n\t if(f)\n\t\t printf(\"YES\");\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\nchar a[10];\nint main()\n{\n int i,j,flag=1;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a); \n for(j=0;j<7;j++)\n if(a[j]==a[j+1])\n flag=0;\n }\n puts(flag?\"YES\":\"NO\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a==4 && b==4 || a+b==8 )\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char c[9][9];\n int f=0,i,j;\n for(i=0;i<8;i++)\n scanf(\"%s\",c[i]);\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(c[i][j]==c[i][j+1])\n {\n f=1;break;\n }\n }\n if(f==1)\n break;\n }\n if(f==1)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar board[8][8];\nint check_row(int row){\n\tint i;\n\tfor(i=0;i<8-1;i++){\n\t\tif(board[row][i]==board[row][i+1])\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main() {\n\tint i,j;\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8;i++){\n\t\tif(!check_row(i)){\n\t\t\tis_ok=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[8];\n int i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a);\n if(strcmp(a,\"WBWBWBWB\") && strcmp(a,\"BWBWBWBW\"))\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){ //freopen(\"in.txt\", \"r\", stdin);\n int i, j;\n char s[10];\n for(i = 0; i < 8; i++){\n scanf(\"%s\", s);\n for(j = 1; j < 8; j++)\n if(s[j-1] == s[j]) {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][9];\n int i,j,flag=0;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n flag=1;\n break;\n }\n }\n if(flag)\n break;\n }\n if(flag)\n printf(\"NO\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j;\n char str[8][9];\n for(i=0;i<8;i++)\n {\n gets(str[i]);\n }\n int k,flag=0;\n //if(str[0][0] == 'B')\n //flag=1;\n for(i=0;i<8;i++)\n {\n for(j=0,k=j+1;j<7 && k<8;j++,k++)\n {\n if(str[i][j] == str[i][k])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char s[10],a=0,b=0;\n int i;\n for(i=0; i<8; i++)\n {\n scanf(\" %s\",s);\n for(int j=0; j<8-1; j++)\n {\n if(s[j]==s[j+1])\n a=1;\n }\n }\n if(a!=1)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n \t \t \t\t \t\t \t\t\t \t\t \t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n char a[8][8];char f;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&f);\n } //printf(\"gggf\");\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n // printf(\"%c\",a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if((a[i][j]=='W' && a[i][j+1]=='W' && j+1<8)||(a[i][j]=='B' && a[i][j+1]=='B' && j+1<8))\n {\n\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n\tint i,j;\n\tchar board[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8 && is_ok;i++){\n\t\tfor(j=0;j<8-1;j++){\n\t\t\tif(board[i][j]==board[i][j+1]){\n\t\t\t\tis_ok=0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int i,j;\n char a[8][8];\n for(i=0;i<8;i++) scanf(\"%s\",a[i]);\n for(i=0;i<8;i++)\n for(j=1;j<8;j++) {\n if(a[i][j-1]==a[i][j]) {\n printf(\"NO\");\n exit(0);\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tchar str[10];\n\tint x;\n\tint y=8;\n\tint flag=0;\n\tchar cl;\n\t\n\twhile(y--)\n\t{\n\t\tscanf(\"%s\",str);\n\t\tcl=str[0];\n\t\tfor(x=1;x<8;x++)\n\t\t{\n\t\t\tif(cl==str[x])\n\t\t\t\tflag=1;\n\t\t\tcl=str[x];\n\t\t}\n\t}\n\tif(flag==1)\n\tprintf(\"NO\");\n\telse\n\tprintf(\"YES\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n char a[8][8];char f;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n scanf(\"%c\",&f);\n } //printf(\"gggf\");\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n // printf(\"%c\",a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if((a[i][j]=='W' && a[i][j+1]=='W' && j+1<8)||(a[i][j]=='B' && a[i][j+1]=='B' && j+1<8))\n {\n\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[9][9] ;\n\nint i , j , k ;\nint main()\n{\n for( i = 0 ; i < 8 ; i++)\n {\n scanf(\"%s\", s[i] ) ;\n }\n for( i = 0 ; i < 8 ; i++)\n {\n k = 0 ;\n for( j = 0 ; j < 7 ; j ++)\n {\n if( s[i][j] == s[i][j+1] )\n {\n printf(\"NO\" ) ;\n return 0 ;\n }\n }\n }\n\n printf(\"YES\") ;\n\n return 0 ;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int count=0;\n int j,i;\n char str[8][8];\n while(count<8){\n scanf(\"%s\", str[count]);\n ++count;\n } \n for(i=0; i<8; ++i)\n { \n for(j=0; j<7; ++j)\n if(str[i][j]==str[i][j+1])\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint x,i,j,f=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\" %c\",&arr[i][j]);\n\t}\n\tfor(i=0;i<8;i++){\n for(j=1;j<8;j++){\n\t\t\tif(arr[i][j]=='W'){\n\t\t\t\tif(arr[i][j-1]==arr[i][j]){\n\t\t\t\t\tprintf(\"NO\");return 0;}\n\t\t\t}\n\t\t\tif(arr[i][j]=='B'){\n\t\t\t\tif(arr[i][j-1]==arr[i][j]){\n\t\t\t\t\tprintf(\"NO\");return 0;}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define n 8\n\nint main()\n{\n\tchar b[9][9];\n\tint i;\n\tfor(i=0;i<8;i++)\n\t\tscanf(\"%s\",b[i]);\n\tint j;\n\tint flag = 0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tfor(j=0;j<n;j++)\n\t\t{\n\t\t\tif(b[i][j] == b[i][(j+1)%n])\n\t\t\t\tflag = 1;\n\t\t}\n\t}\n\n\tif(flag)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int j,i;\n char str[8][8];\n for(i=0; i<8; ++i)\n scanf(\"%s\", str[i]);\n \n for(i=0; i<8; ++i)\n { \n for(j=0; j<7; ++j)\n if(str[i][j]==str[i][j+1])\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[9];\n int i,j,count=0;\n for(i=0;i<8;i=i+1)\n {\n scanf(\"%s\",s);\n if(s[0]=='W')\n if(s[1]=='B')\n if(s[2]=='W')\n if(s[3]=='B')\n if(s[4]=='W')\n if(s[5]=='B')\n if(s[6]=='W')\n if(s[7]=='B')\n {count=count+1;\n continue;}\n if(s[0]=='B')\n if(s[1]=='W')\n if(s[2]=='B')\n if(s[3]=='W')\n if(s[4]=='B')\n if(s[5]=='W')\n if(s[6]=='B')\n if(s[7]=='W')\n {count=count+1;\n continue;}\n }\n if(count==8) printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar map[10][10];\n\tint i,j;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tfor (j = 0; j < 8; j++)\n\t\t{\n\t\t\tscanf(\"%c\",&map[i][j]);\n\t\t}\n\t\tgetchar();\n\t}\n\n/*\t\tprintf(\"\\n\");\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tfor (j = 0; j < 8; j++)\n\t\t{\n\t\t\tprintf(\"i:%d j:%d %c\",i,j,map[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}\n\tprintf(\"\\n\");\n\t*/\n\tint flag = 0;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tif (map[i][0] == map[i][7])\n\t\t{\n//\t\t\tprintf(\"%d\\n\",i);\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\tfor (j = 0; j < 7; j++)\n\t\t{\n\t\t\tif (map[i][j] == map[i][j+1])\n\t\t\t{\n//\t\t\t\tprintf(\"%c\",map[i][j]);\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n//\t\tprintf(\"\\n\");\n\t\tif (flag)\n\t\t break;\n\t}\n\tif (flag)\n\t printf(\"NO\\n\");\n\telse\n\t printf(\"YES\\n\"); \n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[9];\n int i,j,count=0;\n for(i=0;i<8;i=i+1)\n {\n scanf(\"%s\",s);\n if(s[0]=='W')\n if(s[1]=='B')\n if(s[2]=='W')\n if(s[3]=='B')\n if(s[4]=='W')\n if(s[5]=='B')\n if(s[6]=='W')\n if(s[7]=='B')\n {count=count+1;\n continue;}\n if(s[0]=='B')\n if(s[1]=='W')\n if(s[2]=='B')\n if(s[3]=='W')\n if(s[4]=='B')\n if(s[5]=='W')\n if(s[6]=='B')\n if(s[7]=='W')\n {count=count+1;\n continue;}\n }\n if(count==8) printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char map[10][10],tag;\n int i,j,flag=1,sum;\n for(i=0;i<8;i++)\n scanf(\"%s\",map[i]);\n\n for(i=0;i<8;i++){\n sum=0;\n tag=0;\n for(j=1;j<8;j++)\n if(map[i][j]==map[i][j-1]){\n tag=1;\n break;\n }\n if(tag)break;\n }\n printf(\"%s\\n\",tag==0?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char a [9] [9];\n int i, j;\n\n for (i = 0; i < 8; i ++) {\n for (j = 0; j < 8; j ++) {\n scanf(\" %c\", &a [i] [j]);\n }\n }\n\n for (i = 0; i < 8; i ++) {\n for (j = 0; j < 8; j ++) {\n if (a [i] [j] == a [i] [j + 1]) {\n printf(\"NO\");\n return 0;\n }\n }\n }\n\n printf(\"YES\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar a[10][10];\nint main(void)\n{\n int i, j;\n for(i=1; i<=8; i++)\n {\n for(j=1; j<=8; j++)\n {\n scanf(\" %c\", &a[i][j]);\n }\n }\n for(i=1; i<=8; i++)\n {\n for(j=1; j<=7; j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define FLUSH while(getchar()!='\\n')\nint main()\n{\n char c;\n int f=0,j=0;\n char b[9];\n int i=0;\n for(i=0;i<8;i++)\n {\n\t \n\t scanf(\"%s\",b);\n\t FLUSH;\n\t c=b[0];\n\tfor(j=0;j<7;j++)\n\t if(b[j]==b[j+1])f=-1;\n\tif(b[0]==b[7])f=-1;\n }\n if(f==-1)printf(\"NO\");\n else printf(\"YES\");\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[8];\n int i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a);\n if(strcmp(a,\"WBWBWBWB\") && strcmp(a,\"BWBWBWBW\"))\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n \n int count=0;\n int j,i;\n char str[8][8];\n while(count<8){\n scanf(\"%s\", str[count]);\n ++count;\n } \n for(i=0; i<8; ++i)\n { \n for(j=0; j<7; ++j)\n if(str[i][j]==str[i][j+1])\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n \n printf(\"YES\\n\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i, j, k;\n char a[9][9];\n for(i=0; i<8; i++){\n gets(a[i]);\n }\n for(i=0; i<8; i++){\n for(j=0; j<7; j++){\n if((a[i][j])==a[i][j+1]){\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n#include <time.h>\n#include <limits.h>\n\n#define PI 3.141592653589793\n#define max(a,b) (a < b) ? (b) : (a)\n#define min(a,b) (a > b) ? (b) : (a)\n#define FOR(i,a,b) for(i = a ; i <= b ; i++)\n#define ROF(i,a,b) for(i = a ; i >= b ; i--)\n#define RAD(x) ((x)*PI)/180\n#define y1 y_1\n#define ll long long\n#define endl printf(\"\\n\")\n#define MAX 105\n\nint i, j;\nchar b[MAX][MAX];\n\nint main () {\n\tscanf(\"%s %s %s %s %s %s %s %s\",b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);\n\tFOR(i,0,7)\n\t\tFOR(j,0,6)\n\t\t\tif(b[i][j] == b[i][j+1]){\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[8];\n int i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a);\n if(strcmp(a,\"WBWBWBWB\") && strcmp(a,\"BWBWBWBW\"))\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nchar board[8][8];\nint check_row(int row){\n\tint before=board[row][0];\n\tint i;\n\tfor(i=1;i<8;i++){\n\t\tif(board[row][i]!=before){\n\t\t\tbefore=board[row][i];\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn 1;\n}\nint main() {\n\tint i,j;\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8;i++){\n\t\tif(!check_row(i)){\n\t\t\tis_ok=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nchar board[8][8];\nint check_row(int row){\n\tint i;\n\tfor(i=0;i<8-1;i++){\n\t\tif(board[row][i]==board[row][i+1])\n\t\t\treturn 0;\n\t}\n\treturn 1;\n}\nint main() {\n\tint i,j;\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++){\n\t\t\tboard[i][j]=getchar();\n\t\t}\n\t\tgetchar();//\u53bb\u6389\u6bcf\u4e00\u884c\u7684\u6362\u884c\u7b26\u53f7\uff01\n\t}\n\tint is_ok=1;\n\tfor(i=0;i<8;i++){\n\t\tif(!check_row(i)){\n\t\t\tis_ok=0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(is_ok)printf(\"YES\\n\");\n\telse printf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j,k=0,e=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n getchar();\n }\n for(i=0;i<8;i++)\n {\n k=1;\n for(j=0;j<7;j++)\n {\n if(a[i][j]!=a[i][j+1])\n k++;\n }\n if(k==8)\n {\n e++;\n }\n }\n if(e==8)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n\tchar a[8];\n\tfor(int i=0;i<8;i++){\n\t\tscanf(\"%s\",a);\n\tif(a[0]=='W'&&a[1]=='B'&&a[2]=='W'&&a[3]=='B'&&a[4]=='W'&&a[5]=='B'&&a[6]=='W'&&a[7]=='B')\n\t{\n }\n else if(a[0]=='B'&&a[1]=='W'&&a[2]=='B'&&a[3]=='W'&&a[4]=='B'&&a[5]=='W'&&a[6]=='B'&&a[7]=='W')\n\t{\n\t}\n\telse{\n\t\tprintf(\"NO\");\n\t\treturn 0;\n\t}\n}\n\tprintf(\"YES\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[8];\n int i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a);\n if(strcmp(a,\"WBWBWBWB\") && strcmp(a,\"BWBWBWBW\"))\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tint i, yes;\n\tstatic char s[9];\n\n\tyes = 1;\n\tfor (i = 0; i < 8; i++) {\n\t\tscanf(\"%s\", s);\n\t\tif (strcmp(s, \"WBWBWBWB\") != 0 && strcmp(s, \"BWBWBWBW\") != 0) {\n\t\t\tyes = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%s\\n\", yes ? \"YES\" : \"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n\tchar box[8][8];\n\tint i,j,count=0;\n\tfor(i=0;i<8;i++)\n\tscanf(\"%s\",&box[i]);\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<7;j++)\n\t\t{\n\t\t\tif(box[i][j]==box[i][j+1])\n\t\t\tcount=1;\n\t\t}\n\t}\n\tif(count==0)\n\tprintf(\"YES\");\n\telse \n\tprintf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "//#include <stdio.h>\n//int main(){\n//\tlong long N[10000],n,i,min,max;\n//\tscanf (\"%I64d\", &n);\n//\tmin = 1000000;\n//\tmax = -1000000;\n//\tfor (i=0;i<n;i++){\n//\tscanf (\"%I64d\", &N[i]);\n//\tif (N[i] > max)\n//\t\tmax = N[i];\n//\tif (N[i] < min)\n//\t\tmin = N[i];\n//\t}\n//\tprintf (\"%I64d\", (min + max) /2);\n//\n//return 0;\n//}\n#include <stdio.h>\nint main(){\n\tchar A[16][16],t;\n\tint i,n=16,j;\n\tfor (i=0;i<8;i++){\n\t\tfor (j=0;j<n;j=j+2){\n\t\t\tscanf (\"%c\", &A[i][j]);\n\t\t\t\n\t\t}scanf (\"%c\",&t);\n\t}int f=0;\n\t\tfor (i=0;i<8;i++){\n\t\tfor (j=0;j<n;j=j+2){\n\tif (j>=2 && j<16){\n\t\t\t\tif (A[i][j]== A[i][j-2]){\n\t\t\t\tf=1;}}\n\t\t\n\t\tif (j==14){\n\t\t\tif (A[i][j]== A[i][0]){\n\t\t\t\tf=1;}}\n\t\t}}\n\t\tif (f==1)\n\t\t\tprintf (\"NO\");\n\t\telse printf (\"YES\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nchar s[10][10];\nint i, j;\n\nint main()\n{\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",s[i]);\n }\n for(i=0;i<8;i++)\n {\n for(j=1;j<8;j++)\n {\n if(s[i][j]==s[i][j-1])\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j;\n char str[8][9];\n for(i=0;i<8;i++)\n {\n gets(str[i]);\n }\n int k,flag=0;\n //if(str[0][0] == 'B')\n //flag=1;\n for(i=0;i<8;i++)\n {\n for(j=0,k=j+1;j<7 && k<8;j++,k++)\n {\n if(str[i][j] == str[i][k])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j;\n for(i=0;i<=7;i++)\n {\n for(j=0;j<=8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n\n for(i=0;i<=7;i++)\n {\n for(j=0;j<=7;j++)\n {\n if(a[i][j]==a[i][j+1]&&j+1<=7)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nunsigned validRow(char *s)\n{\nchar chessEven[]=\"WBWBWBWB\";\nchar chessOdd[]=\"BWBWBWBW\";\nunsigned i;\n\n if(strcmp(s,chessOdd)==0||strcmp(s,chessEven)==0)\n return 1;\n else\n return 0;\n\n}\nint main()\n{ char s[9][9];\nunsigned i=0;\n for(i=0;i<8;i++)\n scanf(\"%s\",s[i]);\n i=0;\n while(i<8&&validRow(s[i]))\n i++;\n if(i<8)\n {\n printf(\"NO\");\n }\n else\n printf(\"YES\");\ni=i;\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tint n;\n\n\tn = 8;\n\twhile (n--) {\n\t\tstatic char s[9];\n\n\t\tscanf(\"%s\", s);\n\t\tif (strcmp(s, \"WBWBWBWB\") && strcmp(s, \"BWBWBWBW\")) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char s[9];\n int i,j,count=0;\n for(i=0;i<8;i=i+1)\n {\n scanf(\"%s\",s);\n if(s[0]=='W')\n if(s[1]=='B')\n if(s[2]=='W')\n if(s[3]=='B')\n if(s[4]=='W')\n if(s[5]=='B')\n if(s[6]=='W')\n if(s[7]=='B')\n {count=count+1;\n continue;}\n if(s[0]=='B')\n if(s[1]=='W')\n if(s[2]=='B')\n if(s[3]=='W')\n if(s[4]=='B')\n if(s[5]=='W')\n if(s[6]=='B')\n if(s[7]=='W')\n {count=count+1;\n continue;}\n }\n if(count==8) printf(\"YES\");\n else printf(\"NO\");\n return(0);\n}\n"}, {"source_code": "#include<stdio.h>\n\nchar s[111][111];\n\nint check()\n{\n int i,j;\n for(i=0;i<=7;i++)\n {\n for(j=0;j<=6;j++)\n if(s[i][j]==s[i][j+1])\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n\tint i,j;\n\t\n\tfor(i=0;i<=7;i++)\n\t scanf(\"%s\",s[i]);\n\tprintf(\"%s\\n\",check()?\"YES\":\"NO\");\n\t\n\t//system(\"pause\");\n\treturn 0;\n\n}\t\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar board[8][9] = {0}; \n\nint checkBoard() {\n int i;\n for(i = 0; i < 8; i++) {\n if(strcmp(board[i], \"BWBWBWBW\") != 0 && strcmp(board[i], \"WBWBWBWB\") != 0) \n return 0; \n } \n return 1; \n}\n\nint main() {\n int i, j;\n char row[20]; \n for(i = 0; i < 8; i++) {\n scanf(\"%s\\n\", row); \n for(j = 0; j < 8; j++) \n board[i][j] = row[j]; \n }\n\n if(checkBoard())\n printf(\"YES\");\n else \n printf(\"NO\"); \n\n return 0; \n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n\tchar a[9],b[9],c[9];\n\tint i,flag=0;\n\tstrcpy(a,\"WBWBWBWB\");\n\tstrcpy(b,\"BWBWBWBW\");\n\tfor(i=1;i<=8;i++)\n\t{\n\t\tscanf(\"%s\",c);\n\t\tif(strcmp(a,c)!=0&&strcmp(b,c)!=0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag==0)\n\tprintf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main() {\n\tint n;\n\n\tn = 8;\n\twhile (n--) {\n\t\tstatic char s[9];\n\n\t\tscanf(\"%s\", s);\n\t\tif (strcmp(s, \"WBWBWBWB\") && strcmp(s, \"BWBWBWBW\")) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint i,j,kont=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\tscanf(\" %c\",&arr[i][j]);\n\tfor(i=0;i<8;i++){\n\t\tfor(j=1;j<8;j++)\n\t\tif(arr[i][j]==arr[i][j-1])\n\t\t\tkont=0;\n\t}\n\tif(kont)\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\nreturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n // your code goes here\n char s[9][9];\n int i;\n for(i=0;i<9;i++){\n scanf(\"%s\",s[i]);\n }\n int j,c=0;\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n if(s[i][j]==s[i][j+1]){\n printf(\"NO\\n\");\n c=1;\n break;\n }\n }\n if(c==1)\n break;\n }\n if(c==0){\n printf(\"YES\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#define n 8\n\nint main()\n{\n\tchar b[9][9];\n\tint i;\n\tfor(i=0;i<8;i++)\n\t\tscanf(\"%s\",b[i]);\n\tint j;\n\tint flag = 0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(b[i][0] == b[i][7])\n\t\t\tflag = 1;\n\t\tfor(j=1;j<n;j++)\n\t\t{\n\t\t\tif(b[i][j] == b[i][j-1])\n\t\t\t\tflag = 1;\n\t\t}\n\t}\n\n\tif(flag)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tchar ch[8][8];\n\tint i,j;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\"%c\",&ch[i][j]);\n\t\tscanf(\"%*C\");\n\t}\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<7;j++)\n\t\t{\n\t\t\tif(ch[i][j] == ch[i][j+1])\n\t\t\t{\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k,FLAG=0;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\n\t\t\tif(box[i][j-1]==box[i][j]&&j!=0)\n\t\t\tFLAG=1;\t\n\t\t}\t\n\t}\n\t\n\tif(FLAG==1)\n\t{\n\t printf(\"NO\");\n\t exit(0);\n\t}\n\telse\n\t{\n\t\t\n\tj=0;\t\n\t for(i=1;i<8;i++)\n\t {\n\t\n\t\t\n\t\tif(box[i-1][j]==box[i][j])\n\t\t\t{\n\t\t\t\ttemp=box[i][7];\n\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t{\n\t\t\t\t\tbox[i][k]=box[i][k-1];\t\n\t\t\t\t}\n\t\t\t\tbox[i][0]=temp;\n \t\t}\n\t\t\t\n\t } \n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k,FLAG;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\n\t\t\tif(box[i][j-1]==box[i][j])\n\t\t\tFLAG=1;\t\n\t\t}\t\n\t}\n\t\n\tif(FLAG==1)\n\t{\n\t printf(\"NO\");\n\t exit(0);\n\t}\n\telse\n\t{\n\t\t\n\tj=0;\t\n\t for(i=1;i<8;i++)\n\t {\n\t\n\t\t\n\t\tif(box[i-1][j]==box[i][j])\n\t\t\t{\n\t\t\t\ttemp=box[i][7];\n\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t{\n\t\t\t\t\tbox[i][k]=box[i][k-1];\t\n\t\t\t\t}\n\t\t\t\tbox[i][0]=temp;\n \t\t}\n\t\t\t\n\t } \n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\t\n\t\t}\t\n\t}\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tif(j==0)\n\t\t\t{\n\t\t\t\tif(ch!=box[i][j])\n\t\t\t\t{\n\t\t\t\t\tch=box[i][j];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttemp=box[i][7];\n\t\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t\t{\n\t\t\t\t\t\tbox[i][k]=box[i][k-1];\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tbox[i][0]=temp;\n\t\t\t\t\tch=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(j<7)\n\t\t\t{\n\t\t\t\tif(box[i][j]==box[i][j+1])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\texit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k,FLAG=0;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\n\t\t\tif(box[i][j-1]==box[i][j])\n\t\t\tFLAG=1;\t\n\t\t}\t\n\t}\n\t\n\tif(FLAG==1)\n\t{\n\t printf(\"NO\");\n\t exit(0);\n\t}\n\telse\n\t{\n\t\t\n\tj=0;\t\n\t for(i=1;i<8;i++)\n\t {\n\t\n\t\t\n\t\tif(box[i-1][j]==box[i][j])\n\t\t\t{\n\t\t\t\ttemp=box[i][7];\n\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t{\n\t\t\t\t\tbox[i][k]=box[i][k-1];\t\n\t\t\t\t}\n\t\t\t\tbox[i][0]=temp;\n \t\t}\n\t\t\t\n\t } \n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k,FLAG=0;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\n\t\t\tif(box[i][j-1]==box[i][j]&&j!=0)\n\t\t\tFLAG=1;\t\n\t\t}\t\n\t}\n\t\n\tif(FLAG==1)\n\t{\n\t printf(\"NO\");\n\t exit(0);\n\t}\n\telse if(FLAG==0)\n\t{\n\t\t\n\tj=0;\t\n\t for(i=1;i<8;i++)\n\t {\n\t\n\t\t\n\t\tif(box[i-1][0]==box[i][0])\n\t\t\t{\n\t\t\t\ttemp=box[i][7];\n\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t{\n\t\t\t\t\tbox[i][k]=box[i][k-1];\t\n\t\t\t\t}\n\t\t\t\tbox[i][0]=temp;\n \t\t}\n\t\t\t\n\t } \n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char map[10][10];\n int i,j,flag=1,sum,tag=1;\n for(i=0;i<8;i++)\n scanf(\"%s\",map[i]);\n\n for(i=0;i<8;i++){\n sum=0;\n if(map[i][0]=='B'&&map[i][7]=='B'){tag=0;break;};\n for(j=0;j<8;j++)\n if(map[i][j]=='W')sum++;\n if(sum!=4){\n flag=0;\n break;\n }\n }\n printf(\"%s\\n\",tag&&flag?\"YES\":\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int i,j;\n char t,x;\n for(i=1;i<=8;i++){\n scanf(\"%c\",&t);\n for(j=2;j<=8;j++){\n scanf(\"%c\",&x);\n if(x==t){\n printf(\"NO\");\n return 0;\n }\n else t=x;\n }\n printf(\"\\n\");\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(int argc, const char* argv[])\n{\n\tint i;\n\tchar line[10];\n\tfor (i = 0; i < 8; i++) {\n\t\tfgets(line, sizeof(line), stdin);\n\t\tif (line[0] == line[2] && line[2] == line[4] && line[4] == line[6] &&\n\t\t line[1] == line[3] && line[3] == line[5] && line[5] == line[7])\n\t\t\tcontinue;\n\t\tprintf(\"NO\\n\");\n\t\treturn 0;\n\t}\n\tprintf(\"YES\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int t=8,a=0,b=0;\n char x[10];\n while(t--)\n {\n scanf(\"%s\",x);\n if(strcmp(x,\"BWBWBWBW\")==0)\n a++;\n else\n {if(strcmp(x,\"WBWBWBWB\")==0)\n b++;}\n }\n \n if(a==4 && b==4)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n long int a[3][3];\n int i,j;\n for(i=0;i<3;i++)\n for(j=0;j<3;j++)\n scanf(\"%ld\",&a[i][j]);\n a[0][0] = (a[1][2] + a[2][1])/2;\n a[1][1] = (a[0][2] + a[2][0])/2;\n a[2][2] = (a[0][1] + a[1][0])/2;\n for(i=0;i<3;i++)\n {\n for(j=0;j<3;j++)\n printf(\"%ld \",a[i][j]);\n printf(\"\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a=1,b,i;\n char str[8][9];\n for(i=0;i<8;i++)\n {\n scanf(\"%s\", str[i]);\n if(a){\n if(str[i][0]==str[i][2]&&str[i][2]==str[i][4]&&str[i][4]==str[i][6]&&str[i][1]==str[i][3]&&str[i][3]==str[i][5]&&str[i][5]==str[i][7])\n a=1;\n else\n {\n a=0;\n }}\n\n\n }\n if(a)\n printf(\"YES\");\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\ntypedef char string[10];\n\nint IsSelangSeling(string Kata, int Idx)\n{\n\tif (Idx == 8) return 1;\n\telse\n\t{\n\t\tif (Kata[Idx] == Kata[Idx+1]) //bukan selang-seling\n\t\t\treturn 0;\n\t\telse\n\t\t{\n\t\t\tIdx = Idx + 1;\n\t\t\treturn IsSelangSeling(Kata,Idx);\n\t\t}\n\t}\n}\n\t\t\nint main()\n{\n\tstring Kata;\n\tint W = 0;\n\tint B = 0;\n\tint i;\n\tint IsValid; ///hanya true false\n\t\n\tIsValid = 1;\n\t\n\tfor (i=1;i<=8;i++)\n\t{\n\t\tfgets(Kata,sizeof(Kata),stdin);\n\t\tKata[strlen(Kata)-1] = '\\0';\n\t\tIsValid = IsValid && IsSelangSeling(Kata,0);\n\t\tfflush(stdin);\n\t}\n\t\n\tif (IsValid)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\n\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n\tint i,j;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\t\tscanf(\"%c\",&arr[i][j]);\n\tint f=0;\n\t for(i=0;i<8;i++)\n\t\t for(j=0;j<7;j++)\n\t\t if(arr[i][j]!=arr[i][j+1])\n\t\t\t\t\t\t f=1;\n\t\t else {\n\t\t\t printf(\"NO\");\n return 0;\n\t\t }\n\t if(f)\n\t\t printf(\"YES\");\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tint i,j;\n\tchar arr[8];\n\tfor(i=1;i<=8;i++)\n\t{\n\t scanf(\"%s\",arr);\n\t for(j=0;j<7;j++)\n\t {\n\t if(arr[i]==arr[i+1]){ break; }\n\t }\n\t if(j<7){printf(\"NO\"); break;}\n\t \n\t \n\t \n\t} if(i>8)printf(\"YES\");\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\t// your code goes here\n\tint i,j;\n\tchar arr[8];\n\tfor(i=0;i<8;i++)\n\t{\n\t scanf(\"%s\",arr);\n\t for(j=0;j<7;j++)\n\t {\n\t if(arr[i]==arr[i+1]){ break; }\n\t }\n\t if(j<7){printf(\"NO\"); break;}\n\t \n\t \n\t \n\t} if(i==8)printf(\"YES\");\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n//#include<stdlib.h>\nint main(){\n short i = 0,j = 0,k = 0;\n char a,b,c;\n for(i=0;i<8;i++){\n for(j=0;j<4;j++)\n if(getchar()==getchar()) k=1;\n getchar();\n }\n if(k==0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n //system(\"pause\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main(){\n short i = 0,j = 0,k = 0;\n char a='a',b='a';\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n a=getchar();\n if(a==b) k=1;\n b=a;\n }\n getchar();\n }\n if(k==0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n short i = 0,j = 0,k = 0;\n for(i=0;i<8;i++){\n for(j=0;j<4;j++)\n if(getchar()==getchar()){\n printf(\"YES\\n\");\n return 0;\n }\n getchar();\n }\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n//#include<stdlib.h>\nint main(){\n short i = 0,j = 0,k = 0;\n char a='a',b='a';\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n a=getchar();\n if(a==b) k=1;\n b=a;\n }\n getchar();\n }\n if(k==0) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n return 0;\n}\n\n"}, {"source_code": "//Created by Pratik Paras Mandlecha\n#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<string.h>\nint main()\n{\n\tint n=0,i,j;\n\tchar s,a[8][8];\n\tfor(i=0;i<8;i++)\n\tfor(j=0;j<8;j++)\n\tscanf(\"%c\",&a[i][j]);\n\tfor(i=0;i<8;i++)\n\tfor(j=1;j<8;j++)\n\t\tif(a[i][j]==a[i][j-1]) n++;\n\tif(n==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar map[9][9];\n\tint i,j;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tfor (j = 0; j < 8; j++)\n\t\t{\n\t\t\tscanf(\"%c\",&map[i][j]);\n\t\t}\n\t}\n\tint flag = 0;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tfor (j = 0; j < 7; j++)\n\t\t{\n\t\t\tif (map[i][j] == map[i][j+1])\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (flag)\n\t\t break;\n\t}\n\tif (flag)\n\t printf(\"NO\\n\");\n\telse\n\t printf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar map[9][9];\n\tint i,j;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tfor (j = 0; j < 8; j++)\n\t\t{\n\t\t\tscanf(\"%c\",&map[i][j]);\n\t\t}\n\t}\n\tint flag = 0;\n\tfor (i = 0; i < 8; i++)\n\t{\n\t\tif (map[i][7] == map[i][0])\n\t\t{\n\t\t\tflag = 1;\n\t\t\tbreak;\n\t\t}\n\t\tfor (j = 0; j < 7; j++)\n\t\t{\n\t\t\tif (map[i][j] == map[i][j+1])\n\t\t\t{\n\t\t\t\tflag = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (flag)\n\t\t break;\n\t}\n\tif (flag)\n\t printf(\"NO\\n\");\n\telse\n\t printf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint i,j,kont=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\tscanf(\" %c\",&arr[i][j]);\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\tif(arr[i][j]==arr[i][j+1])\n\t\t\tkont=0;\n\t}\n\tif(kont==1)\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\nreturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n\tint i,j,kont=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\tscanf(\" %c\",&arr[i][j]);\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\tif(arr[i][j]==arr[i][j+1])\n\t\t\tkont=0;\n\t}\n\tif(kont)\n\t\tprintf(\"YES\");\n\telse printf(\"NO\");\nreturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n\nvoid solve(char s[][10])\n{\n int i,j;\n\n for(i=0;i<8;++i)\n {\n for(j=0;j<7;++j)\n {\n if(s[i][j]==s[i][j+1])\n {\n printf(\"%s\\n\",s[i]);\n printf(\"NO\\n\");\n return;\n }\n }\n }\n printf(\"YES\\n\");\n}\n\nint main(void)\n{\n char s[10][10];\n int i;\n while(scanf(\"%s\",s[0])!=EOF)\n {\n for(i=1;i<8;++i)\n scanf(\"%s\",s[i]);\n solve(s);\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[8][9];\n\tint i, j, flag = 0;\n\tfor(i=0; i<8; i++)\n\t{\n\t\tfor(j=0; j<8; j++)\n\t\t{\n\t\t\tscanf(\" %c\", &str[i][j]);\n\t\t\tif((j!=0 && str[i][j-1] == str[i][j]))\n\t\t\t\tflag = 1;\n\t\t\tprintf(\"%d %d\\n\", i, j);\n\t\t}\n\t}\n\tif(flag)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[8][9];\n\tint i, j, flag = 0;\n\tfor(i=0; i<8; i++)\n\t{\n\t\tfor(j=0; j<8; j++)\n\t\t{\n\t\t\tscanf(\"%c\", &str[i][j]);\n\t\t\tif((j!=0 && str[i][j-1] == str[i][j]) || (j==7 && str[i][0]==str[i][7]))\n\t\t\t\tflag = 1;\n\t\t}\n\t}\n\tif(flag)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar str[8][9];\n\tint i, j, flag = 0;\n\tfor(i=0; i<8; i++)\n\t{\n\t\tfor(j=0; j<8; j++)\n\t\t{\n\t\t\tscanf(\"%c\", &str[i][j]);\n\t\t\tif((j!=0 && str[i][j-1] == str[i][j]))\n\t\t\t\tflag = 1;\n\t\t}\n\t}\n\tif(flag)\n\t\tprintf(\"NO\\n\");\n\telse\n\t\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[9][9] ;\n\nint i , j , k ;\nint main()\n{\n for( i = 0 ; i < 8 ; i++)\n {\n scanf(\"%s\", s[i] ) ;\n }\n for( i = 0 ; i < 8 ; i++)\n {\n k = 0 ;\n for( j = 0 ; j < 7 ; j ++)\n {\n if( s[i][j] == s[i][j+1] )\n {\n k++ ;\n }\n }\n if( s[0] == s[7] )\n {\n k++ ;\n }\n if( k > 1)\n {\n printf(\"NO\" ) ;\n return 0 ;\n }\n }\n printf(\"YES\") ;\n\n return 0 ;\n }\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar s[9][9] ;\n\nint i , j , k ;\nint main()\n{\n for( i = 0 ; i < 8 ; i++)\n {\n scanf(\"%s\", s[i] ) ;\n }\n for( i = 0 ; i < 8 ; i++)\n {\n k = 0 ;\n for( j = 0 ; j < 7 ; j ++)\n {\n if( s[i][j] == s[i][j+1] )\n {\n k++ ;\n }\n }\n if( k > 1)\n {\n printf(\"NO\" ) ;\n return 0 ;\n }\n }\n printf(\"YES\") ;\n\n return 0 ;\n }\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, j, c1, c2, good;\n\tstatic char s[9];\n\n\tfor (i = 0; i < 8; i++) {\n\t\tscanf(\"%s\", s);\n\t\tc1 = s[0], c2 = s[1];\n\t\tgood = 1;\n\t\tfor (j = 0; j < 8; j += 2)\n\t\t\tif (s[j] != c1) {\n\t\t\t\tgood = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tfor (j = 1; j < 8; j += 2)\n\t\t\tif (s[j] != c2) {\n\t\t\t\tgood = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (!good) {\n\t\t\tprintf(\"NO\\n\");\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main ()\n{\n int i, sum = 0;\n\n char str[100];\n char str1[] = \"WBWBWBWB\";\n char str2[] = \"BWBWBWBW\";\n\n for(i = 0; i < 8; i++)\n {\n scanf(\"%s\", str);\n\n if(strcmp(str, str1) == 0 || strcmp(str, str2) == 0) sum++;\n }\n printf(\"%d\\n\", sum);\n\n if(sum == 8)\n printf(\"YES\");\n\n else printf(\"NO\");\n\n return 0;\n}\n"}, {"source_code": "int main(){\n int i,j,k;\n char str[8][8];\n for(i=0;i<8;i++)scanf(\"%s\",str[i]);\n i=0;\n while(i<8){\n if(strstr(str[i],\"AA\")>0 && strstr(str[i],\"BB\")>0){\n printf(\"NO\");\n return 0;\n }\n i++;\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "int main(){\n int i,j,k;\n char str[8][8];\n for(i=0;i<8;i++)scanf(\"%s\",str[i]);\n i=0;\n while(i<8){\n if(strstr(str[i],\"WW\")>0 && strstr(str[i],\"BB\")>0){\n printf(\"NO\");\n return 0;\n }\n i++;\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "char str[10][10];\nint main(){\n static int i,j,b,w,bb,ww;\n for(i=0;i<8;i++)scanf(\"%s\",str[i]);\n for(i=0;i<8;i++){\n ww=0;\n bb=0;\n for(j=0;str[i][j]!='\\0';j++){\n if(str[i][j]=='W'){\n w++;\n ww++;\n }\n else if(str[i][j]=='B'){\n b++;\n bb++;\n }\n }\n if(bb!=ww){\n printf(\"NO\");\n return 0;\n }\n }\n if(b==32&&w==32)printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[8];\n int i,j;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a);\n if(strcmp(a,\"WBWBWBWB\")==1 && strcmp(a,\"BWBWBWBW\")==1)\n {\n printf(\"NO\");\n return 0;\n }\n }\n printf(\"YES\");\n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,w1,w2,b1,b2;\n while(gets(a[0]))\n {\n for(i=1;i<8;i++)\n gets(a[i]);\n for(i=0;i<8;i++)\n {\n w1=w2=b1=b2=0;\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='W')\n w1++;\n if(a[i][j]=='B')\n b1++;\n if(a[j][i]=='W')\n w2++;\n if(a[j][i]=='B')\n b2++;\n }\n if(w1!=b1||w2!=b2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,k=0;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",&a[i]);\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n k=1;\n break;\n }\n if(k==1)\n break;\n }\n }\n if(k==0)\n printf(\"YES\\n\");\n if(k==1)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,k=0;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",a[i]);\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n k=1;\n break;\n }\n if(k==1)\n break;\n }\n }\n if(k==0)\n printf(\"YES\\n\");\n if(k==1)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,w1,w2,b1,b2;\n for(i=0;i<8;i++)\n for(j=0;j<8;j++)\n scanf(\"%c\",&a[i][j]);\n for(i=0;i<8;i++)\n {\n w1=0;\n w2=0;\n b1=0;\n b2=0;\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='W')\n w1++;\n if(a[i][j]=='B')\n b1++;\n if(a[j][i]=='W')\n w2++;\n if(a[j][i]=='B')\n b2++;\n }\n if(w1!=b1)\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(w2==b2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,k;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",&a[i]);\n for(j=0;j<7;j++)\n {\n if(a[j]==a[j+1])\n {\n k=1;\n }\n }\n getchar();\n }\n if(k==0)\n printf(\"YES\\n\");\n if(k==1)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i, j;\n char s[10], a, b;\n for (i = 0; i < 8; i++){\n scanf(\"%s\", &s);\n for (j = 0; j < 8; j++){\n if (j == 0) a = s[j];\n else if (j == 1) b = s[j];\n else if ((j % 2) && (s[j] != b)){\n printf(\"NO\\n\");\n return 0;\n }else if ((j % 2 == 0) && (s[j] != a)){\n printf(\"NO\\n\");\n return 0;\n }\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint x,i,j,f=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\"%c\",&arr[i][j]);\n\t}\n\tfor(i=0;i<8;i++){\n for(j=0;j<8;j++){\n\t\t\tif(arr[i][j]=='W'){\n\t\t\t\tif(arr[i][j+1]=='W')\n\t\t\t\t\tf=0;\n\t\t\t}\n\t\t\tif(arr[i][j]=='B')\n\t\t\t\tif(arr[i][j+1]=='B')\n\t\t\t\t\tf=0;\n\t\t}\n\t}\n\tif(f)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint x,i,j,f=1;\n\tchar arr[8][8];\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\" %c\",&arr[i][j]);\n\t}\n\tfor(i=0;i<8;i++){\n for(j=0;j<8;j++){\n\t\t\tif(arr[i][j]=='W'){\n\t\t\t\tif(arr[i][j+1]=='W'){\n\t\t\t\t\tf=0;break;}\n\t\t\t}\n\t\t\telse if(arr[i][j]=='B'){\n\t\t\t\tif(arr[i][j+1]=='B'){\n\t\t\t\t\tf=0;break;}\n\t\t\t}\n\t\t}\n\t}\n\tif(f)\n\t\tprintf(\"YES\");\n\telse\n\t\tprintf(\"NO\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i;\n char ch[8];\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",ch);\n if(strcmp(ch,\"WBWBWBWB\") || strcmp(ch,\"BWBWBWBW\"))\n return printf(\"NO\\n\"),0;\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n\tchar ch[8][8];\n\tint i,j;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\"%c\",&ch[i][j]);\n\t}\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<7;j++)\n\t\t{\n\t\t\tif(ch[i][j] == ch[i][j+1])\n\t\t\t{\n\t\t\t\tprintf(\"NO\\n\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char S[9];\n int W,B;\n int i,j;\n int Wrong;\n W=0;B=0;\n Wrong=0;\n for (i=1;i<=8;i++)\n {\n scanf(\"%s\",S);\n if (S[0]=='W')\n {\n W++;}\n else\n {\n B++;}\n j=1;\n while ((Wrong==0) && (j<=8))\n {\n if (S[j]=='W' && S[j-1]!='B')\n {\n Wrong=1;}\n else if (S[j]=='B' && S[j-1]!='W')\n {\n Wrong=1;}\n j++;\n }\n }\n if (Wrong==1)\n {\n printf(\"NO\");}\n else\n {\n if (W==B)\n {\n printf(\"YES\");}\n else\n {\n printf(\"NO\");}\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tchar box[8][8],ch='B',temp;\n\tint i,j,k;\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tscanf(\"%c\",&box[i][j]);\t\n\t\t}\t\n\t\tprintf(\"\\n\");\n\t}\n\tfor(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tif(j==0)\n\t\t\t{\n\t\t\t\tif(ch!=box[i][j])\n\t\t\t\t{\n\t\t\t\t\tch=box[i][j];\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttemp=box[i][7];\n\t\t\t\t\tfor(k=7;k>0;k--)\n\t\t\t\t\t{\n\t\t\t\t\t\tbox[i][k]=box[i][k-1];\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tbox[i][0]=temp;\n\t\t\t\t\tch=temp;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(j<7)\n\t\t\t{\n\t\t\t\tif(box[i][j]==box[i][j+1])\n\t\t\t\t{\n\t\t\t\t\tprintf(\"NO\");\n\t\t\t\t\texit(0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"YES\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,k;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",&a[i]);\n for(j=0;j<7;j++)\n {\n if(a[j]==a[j+1])\n {\n k=1;\n }\n }\n }\n if(k==0)\n printf(\"YES\\n\");\n if(k==1)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,w1,w2,b1,b2;\n while(gets(a[0]))\n {\n for(i=1;i<8;i++)\n gets(a[i]);\n for(i=0;i<8;i++)\n {\n w1=w2=b1=b2=0;\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='W')\n w1++;\n if(a[i][j]=='B')\n b1++;\n if(a[j][i]=='W')\n w2++;\n if(a[j][i]=='B')\n b2++;\n }\n if(w1!=b1&&w2!=b2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,k=0;\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",&a[i]);\n for(j=0;j<7;j++)\n {\n if(a[j]==a[j+1])\n {\n k=1;\n }\n }\n }\n if(k==0)\n printf(\"YES\\n\");\n if(k==1)\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[8][8],i,j,w1,w2,b1,b2;\n for(i=0;i<8;i++)\n for(j=0;j<8;j++)\n scanf(\"%c\",&a[i][j]);\n for(i=0;i<8;i++)\n {\n w1=0;\n w2=0;\n b1=0;\n b2=0;\n for(j=0;j<8;j++)\n {\n if(a[i][j]=='W')\n w1++;\n if(a[i][j]=='B')\n b1++;\n if(a[j][i]=='W')\n w2++;\n if(a[j][i]=='B')\n b2++;\n }\n if(w1!=b1)\n {\n printf(\"NO\\n\");\n return 0;\n }\n if(w2!=b2)\n {\n printf(\"NO\\n\");\n return 0;\n }\n }\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n\tchar a[9],b[9],c[9];\n\tint i,flag=0;\n\tstrcpy(a,\"wbwbwbwb\");\n\tstrcpy(b,\"bwbwbwbw\");\n\tfor(i=1;i<=8;i++)\n\t{\n\t\tscanf(\"%s\",c);\n\t\tif(strcmp(a,c)!=0&&strcmp(b,c)!=0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t}\n\tif(flag==0)\n\tprintf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i , j , k , y = 1 , w = 0 , b = 0 ;\n char s[9][9] ;\n for(i = 0 ; i<8 ; i++)\n {\n scanf(\"%s\",s[i]);\n w = 0 ; b = 0 ; j = 0 ;\n if(s[i][j]=='W') w++;\n if(s[i][j]=='B') b++;\n for(j = 1 ; j<8 ; j++)\n { if(s[i][j]=='W') w++;\n if(s[i][j]=='B') b++;\n if(s[j-1]==s[j]) y = 0 ;\n }\n if(w!=4) y = 0 ;\n if(b!=4) y = 0 ;\n }\n if(y)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0 ;\n} \n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char *str1=\"WBWBWBWB\";\n char *str2=\"BWBWBWBW\";\n char s[9][9];\n int n=0,m=0,i;\n for(i=0;i<8;++i)\n scanf(\"%s\",s[i]);\n for(i=0;i<8;++i){\n if(strcmp(s[i],str1)==0)\n n++;\n if(strcmp(s[i],str2)==0)\n m++;\n }\n //printf(\"%d %d\",m,n);\n if(n==4&&m==4)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n \nint main()\n{\n int i,j;\n char temp;\n char ch[8][8];\n \n for(i = 0; i < 8 ; i++)\n { \n temp = 'A';\n for(j = 0 ; j < 8 ; j++)\n {\n scanf(\"%c\",&ch[i][j]);\n if(temp == ch[i][j])\n {\n printf(\"NO\\n\");\n return 0;\n }\n temp = ch[i][j];\n }\n }\n printf(\"YES\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[9],i,j,mark=0,t,m,b,c;\n for(i=0;i<9;i++)\n scanf(\"%d\",&a[i]);\n t=a[1]+a[2];\n m=a[3]+a[5];\n b=a[6]+a[7];\n if(t>m && t>b)\n mark=t;\n else if(m>b && m>t)\n mark=m;\n else\n mark=b;\n mark++;\n a[0]=mark-t;\n a[4]=mark-m;\n a[8]=mark-b;\n c=(t-a[4]-a[8])/2;\n a[0]=a[0]+c;\n a[4]=a[4]+c;\n a[8]=a[8]+c;\n printf(\"%d %d %d\\n%d %d %d\\n%d %d %d\\n\",a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\nchar M[16][16];\nint Old, New;\nint x, y, Ans;\n\nint main(){\n while(~scanf(\"%s\", M[0])){\n for (y=1; y<8; y++) scanf(\"%s\", M[y]);\n Ans = 0;\n for (x=0; x<8; x++) if (M[0][x]=='W'){\n Ans = 1;\n Old = x;\n break;\n }\n if (Ans==0){\n printf(\"NO\\n\");\n continue;\n }\n \n for (y=0; y<8; y++) for (x=0; x<8; x++) M[y][x+8] = M[y][x];\n \n for (y=1; y<8; y++){\n for (New=0; New<8; New++){\n Ans = 1;\n for (x=0; x<8; x++) if (M[y][New+x]==M[y-1][Old+x]) Ans = 0;\n if (Ans) break;\n }\n \n if (Ans){\n Old = New;\n continue;\n }\n \n break;\n }\n if (Ans) printf(\"YES\\n\");\n else printf(\"NO\\n\");\n \n \n }\n \n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n }\n }\n int w=0,b=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n if(ch[i][j]==ch[i][j+1])\n {\n printf(\"NO\\n\");\n flag=1;\n goto a;\n }\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n a:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0,w=0,b=0;;\n for(i=0;i<8;i++)\n {\n for(j=0;j<9;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n if(ch[i][j]=='W')\n w++;\n if(ch[i][j]=='B')\n b++;\n }\n if(w!=b)\n flag=1;\n }\n if(ch[i][j]==ch[i][j+1] || flag==1)\n {\n printf(\"NO\\n\");\n goto a;\n }\n printf(\"YES\\n\");\n a:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0,temp[64],c,w=0,b=0;;\n for(i=0;i<8;i++)\n {\n for(j=0;j<9;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n if(ch[i][j]=='W')\n w++;\n if(ch[i][j]=='B')\n b++;\n }\n //printf(\"%d %d\\n\",w,b);\n if(w!=b)\n flag=1;\n }\n //printf(\"%d %d\\n\",w,b);\n if(ch[i][j]==ch[i][j+1] || flag==1)\n {\n printf(\"NO\\n\");\n goto a;\n }\n printf(\"YES\\n\");\n a:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n }\n }\n\n for(i=0;i<8;i++)\n {\n int w=0,b=0;\n for(j=0;j<8;j++)\n {\n if(ch[i][j]=='W')\n w++;\n if(ch[i][j]=='B')\n b++;\n if(ch[i][j]==ch[i][j+1])\n {\n printf(\"NO\\n\");\n flag=1;\n goto a;\n }\n }\n if((w-b)>1 || (w-b)<-1)\n {\n printf(\"NO\\n\");\n flag=1;\n //printf(\"%d %d\\n\",w,b);\n w=0;\n b=0;\n goto a;\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n a:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n }\n }\n int w=0,b=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<9;j++)\n {\n if(ch[i][j]=='W')\n w++;\n if(ch[i][j]=='B')\n b++;\n }\n if(i==7 && w==3 && !(b>4))\n w++;\n if(i==7 && b==3 && !(w>4))\n b++;\n //printf(\"%d %d\\n\",w,b);\n if(w!=b)\n {\n printf(\"NO\\n\");\n goto a;\n }\n w=0,b=0;\n }\n for(i=0;i<8;i++)\n {\n if(ch[i][j]==ch[i][j+1])\n {\n printf(\"NO\\n\");\n goto a;\n }\n }\n printf(\"YES\\n\");\n a:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char ch[8][8],i,j,flag=0,w=0,b=0;;\n for(i=0;i<8;i++)\n {\n for(j=0;j<9;j++)\n {\n scanf(\"%c\",&ch[i][j]);\n if(ch[i][j]=='W')\n w++;\n if(ch[i][j]=='B')\n b++;\n }\n if(w!=b)\n flag=1;\n }\n if(ch[i][j]==ch[i][j+1] || flag==1)\n {\n printf(\"NO\\n\");\n }\n else printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nchar s[111][111];\n\nint check()\n{\n int i,j,count;\n for(i=0;i<=7;i++)\n {\n count=0;\n for(j=0;j<=7;j++)\n if(s[i][j]=='W')\n count++;\n if(count!=4)\n return 0;\n }\n for(i=0;i<=7;i++)\n {\n count=0;\n for(j=0;j<=7;j++)\n if(s[j][i]=='W')\n count++;\n if(count!=4)\n return 0;\n }\n return 1;\n}\n\nint main()\n{\n\tint i,j;\n\t\n\tfor(i=0;i<=7;i++)\n\t scanf(\"%s\",s[i]);\n\tprintf(\"%s\\n\",check()?\"YES\":\"NO\");\n\t\n\t//system(\"pause\");\n\treturn 0;\n\n}\t\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,bo=0,wo=0,j;\n char ch[100];\n for(i=0;i<8;i++)\n {\n scanf(\"%s\",ch);\n if(ch[0]=='W'&&ch[1]=='B'&&ch[2]=='W'&&ch[3]=='B'&&ch[4]=='W'&&ch[5]=='B'&&ch[6]=='W'&&ch[7]=='B'){wo++;}\n else if(ch[0]=='B'&&ch[1]=='W'&&ch[2]=='B'&&ch[3]=='W'&&ch[4]=='B'&&ch[5]=='W'&&ch[6]=='B'&&ch[7]=='W'){bo++;}\n\n}\n if(bo==4&&wo==4)\n {\n printf(\"YES\");\n }\n else\n printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j;\n for(i=0;i<=7;i++)\n {\n for(j=0;j<=7;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;i<=7;i++)\n {\n for(j=0;j<=7;j++)\n {\n if(a[i][j]==a[i][j+1]&&j+1<=7)\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j,k=0,e=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n k=0;\n for(j=0;j<7;j++)\n {\n if(a[i][j]!=a[i][j+1])\n k=1;\n else\n {\n k=0;\n break;\n }\n }\n if(k==1)\n {\n e++;\n }\n }\n if(e==8)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a[8][8];\n int i,j,k=0,e=0;\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n k=1;\n for(j=0;j<7;j++)\n {\n if(a[i][j]!=a[i][j+1])\n k++;\n }\n if(k==8)\n {\n e++;\n }\n }\n if(e==8)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n char a,b,c,d,e,f,g,h;\n int i,flag;\n freopen(\"inp.txt\",\"r\",stdin);\n for(i=0;i<8;i++)\n {\n scanf(\"%c%c%c%c%c%c%c%c\",&a,&b,&c,&d,&e,&f,&g,&h);\n if(!((a!=b)&&(b!=c)&&(c!=d)&&(d!=e)&&(e!=f)&&(f!=g)&&(g!=h)))\n {printf(\"NO\");return 0;}\n getchar();\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define N 8\n\nint main ()\n{ int c=1,i,j,a[10][10]; \n\tfor(i=0;i<N;i++)\n\t{\n\t\tfor(j=0;j<N;j++)\n\t\t{\n scanf(\"%c\",&a[i][j]);\n\t\t\tif(j>0)\n\t\t\t{\n\t\t\t\tif(a[i][j]==a[i][j-1]||a[i][N-1]==a[i][0]){c=0;}\n\t\t\t}\n\t\t}\n\t}\n\tif(c){printf(\"YES\\n\");}\n\telse{printf(\"NO\\n\");}\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 8\n\nint c=1,i,j,a[10][10];\nint main ()\n{ \n\tfor(i=0;i<N;i++)\n\t{\n\t\tfor(j=0;j<N;j++)\n\t\t{\n scanf(\"%c\",&a[i][j]);\n\t\t\tif(j>0)\n\t\t\t{\n\t\t\t\tif(a[i][j]==a[i][j-1]||a[i][N-1]==a[i][0]){c=0;}\n\t\t\t}\n\t\t}\n\t}\n\tif(c){printf(\"YES\\n\");}\n\telse{printf(\"NO\\n\");}\n\n}\n"}, {"source_code": "#include<stdio.h>\n#define N 8\n\nint main ()\n{ int c=1,i,j,a[10][10]={0}; \n\tfor(i=0;i<N;i++)\n\t{\n\t\tfor(j=0;j<N;j++)\n\t\t{\n scanf(\"%c\",&a[i][j]);\n\t\t\tif(j>0)\n\t\t\t{\n\t\t\t\tif(a[i][j]==a[i][j-1]||a[i][N-1]==a[i][0]){c=0;}\n\t\t\t}\n\t\t}\n\t}\n\tif(c){printf(\"YES\\n\");}\n\telse{printf(\"NO\\n\");}\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a, b, d, e;\n\tchar c;\n\tchar ZA[] = {'W', 'B'};\n\n\te = 0;\n\tfor (a = 0; e == 0 && a < 8; ++a) {\n\t\tscanf(\"%c\", &c);\n\t\tif (c == 'W')\n\t\t\td = 1;\n\t\telse\n\t\t\td = 0;\n\t\tfor (b = 0; b < 7; ++b) {\n\t\t\tscanf(\"%c\", &c);\n\t\t\tif (c != ZA[d]) {\n\t\t\t\te = 1;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\td = 1 - d;\n\t\t\t}\n\t\t}\n\t\tscanf(\"\\n\");\n\t}\n\tif (a == 8)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n\t\t\t\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a, b, d, e;\n\tchar c, ZA[] = {'W', 'B'};\n\n\te = 0;\n\tfor (a = 0; e == 0 && a < 8; ++a) {\n\t\tscanf(\"\\n%c\", &c);\n\t\tif (c == 'W')\n\t\t\td = 1;\n\t\telse\n\t\t\td = 0;\n\t\tfor (b = 1; b < 8; ++b) {\n\t\t\tscanf(\"%c\", &c);\n\t\t\tif (c == ZA[d]) {\n\t\t\t\td = 1 - d;\n\t\t\t} else {\n\t\t\t\te = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (a == 8)\n\t\tprintf(\"YES\\n\");\n\telse\n\t\tprintf(\"NO\\n\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,flag=0;\n char a[8][8];\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n break;\n }\n if(flag==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,flag=0;\n char a[8][8];\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&a[i][j]);\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(a[i][j]==a[i][j+1])\n {\n flag=1;\n break;\n }\n if(flag==1)\n break;\n }\n }\n if(flag==0)\n printf(\"YES\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n int freq[1 << CHAR_BIT] = {0}, c;\n while (c = getchar (), c != EOF) {\n ++freq[c];\n }\n printf (\"%s\\n\", freq['W'] == freq['B'] ? \"YES\" : \"NO\");\n exit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include <limits.h>\n#include <stdio.h>\n#include <stdlib.h>\n\nint main (void) {\n\tint freq[1 << CHAR_BIT] = {0}, c;\n\twhile (c = getchar (), c != EOF) {\n\t\t++freq[c];\n\t}\n\tprintf (\"%s\\n\", freq['W'] == freq['B'] ? \"YES\" : \"NO\");\n\texit (EXIT_SUCCESS);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[8][8];\n int i,j,k=0;\n for(i<0;i<8;i++)\n {\n scanf(\"%s\",c[i]);\n }\n for(i<0;i<8;i++)\n {\n for(j=0;(j+1)<8;j++)\n {\n if(c[i][j]==c[i][(j+1)])\n {\n printf(\"no\");\n return 0;\n }\n else\n k=1;\n }\n }\n if(k==1)\n {\n printf(\"yes\");\n return 0;\n }\n\n}\n"}, {"source_code": "#include<math.h>\n#include<stdio.h>\nchar c[8][8];\nmain()\n{\n int i,j,k,flag=0;\n for(i=0;i<8;i++)\n scanf(\"%s\",&c[i][0]);\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(c[i][j]==c[i][j+1])\n {\n flag=1;\n break;\n }\n\n }\n if(flag==1)\n break;\n\n }\n if(flag==1)\n printf(\"N0\\n\");\n else\n printf(\"YES\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nmain()\n{\nfreopen(\"b.txt\",\"r\",stdin);\nint t=8,j,k,flag=0,i;\nchar a[20];\nfor(k=0;k<8;k++)\n{\nscanf(\"%s\",a);\na[8]=a[0];\nfor(i=0;i<8;i++){if(a[i]==a[i+1])flag=1;}\n}\nif(flag)printf(\"NO\\n\");\nelse printf(\"YES\\n\");\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tchar str[8][8];\n\tint j,i;\n\t \n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\"%c\",&str[i][j]);\n\n\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<7;j++)\n\t\t\tif(str[i][j]==str[i][j+1]){\n\t\t\t\tprintf(\"NO\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"YES\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n\tchar str[8][8];\n\tint j,i;\n\t \n\tfor(i=0;i<8;i++)\n\t\tfor(j=0;j<8;j++)\n\t\t\tscanf(\"%c\",&str[i][j]);\n\n\n\tfor(i=0;i<8;i++){\n\t\tfor(j=0;j<7;j++)\n\t\t\tif(str[i][j]==str[i][j+1]){\n\t\t\t\tprintf(\"NO\");\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\t\tprintf(\"YES\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){ //freopen(\"in.txt\", \"r\", stdin);\n int i;\n char a[10];\n for(i = 1; i <= 8; i++){\n scanf(\"%s\", &a[i]);\n }\n if(a[1] == a[8]){\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j;\n char str[8][9];\n for(i=0;i<8;i++)\n {\n gets(str[i]);\n }\n int k,flag=0;\n if(str[0][0] == 'B')\n flag=1;\n for(i=0;i<8;i++)\n {\n for(j=0,k=j+1;j<7 && k<8;j++,k++)\n {\n if(str[i][j] == str[i][k])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n break;\n }\n if(flag==1)\n printf(\"NO\");\n else\n printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "main()\n{\n int i,j,a,b=0,c,d;\nchar ar[8][8];\nfor(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ar[i][j]) ;\n }\n }\n \n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(ar[i][j]==ar[i][j+1]) b=1;\n }\n }\n if(b==1) printf(\"NO\");\n else if(b==0) printf(\"YES\");\n}"}, {"source_code": "main()\n{\n int i,j,a,b=0,c,d;\nchar ar[8][8];\nfor(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ar[i][j]) ;\n }\n }\n for(j=0;j<8;j++)\n {\n for(i=0;i<7;i++)\n {\n if(ar[i][j]==ar[i+1][j]) b=1;\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(ar[i][j]==ar[i][j+1]) b=1;\n }\n }\n if(b==1) printf(\"NO\");\n else if(b==0) printf(\"YES\");\n}"}, {"source_code": "main()\n{\n int i,j,a,b=0,c,d;\nchar ar[8][8];\nfor(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&ar[i][j]) ;\n }\n }\n for(j=0;j<8;j++)\n {\n for(i=0;i<7;i++)\n {\n if(ar[i][j]==ar[i+1][j]) b=1;\n }\n }\n for(i=0;i<8;i++)\n {\n for(j=0;j<7;j++)\n {\n if(ar[i][j]==ar[i][j+1]) b=1;\n }\n }\n if(b==1) printf(\"YES\");\n else if(b==0) printf(\"NO\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j;\n int c=0;\n char arra[8][8];\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&arra[i][j]);\n }}\n for(i=0;i<8;i++){\n for(j=0;j<7;j++){\n if(arra[i][j]==arra[i][j+1]){\n c=1;\n break;\n\n }\n\n }\n if(c==1){\n printf(\"NO\");\n break;}\n }\n if(i==8 && j==6)printf(\"YES\");\n else printf(\"NO\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,c=0;\n char arra[8][8];\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&arra[i][j]);\n }}\n for(i=0;i<8;i++){\n for(j=0;j<7;j++){\n if(arra[i][j]==arra[i][j+1]){\n c=1;\n break;\n }\n\n }\n if(c==1){\n printf(\"NO\");\n break;}\n }\n if(c==0)printf(\"YES\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,j,c=0;\n char arra[8][8];\n for(i=0;i<8;i++){\n for(j=0;j<8;j++){\n scanf(\"%c\",&arra[i][j]);\n }}\n for(i=0;i<8;i++){\n for(j=0;j<8;j+=2){\n if(arra[i][j]==arra[i][j+1]){\n c=1;\n break;\n }\n\n }\n if(c==1){\n printf(\"NO\");\n break;}\n }\n if(c==0)printf(\"YES\");\n return 0;\n}\n\n "}, {"source_code": "#include <stdio.h>\n\nint main(){\n char mat[8][8];\n for(int i=0;i<8;i++){\n for(int j=0;j<8;j++){\n scanf(\" %c\", &mat[i][j]);\n }\n }\n for(int i=0;i<8;i++){\n for(int j=0;j<8;j++){\n printf(\"%c \", mat[i][j]);\n }printf(\"\\n\");\n }\n for(int i=0;i<8;i++){\n char c = mat[i][0];\n for(int j=1;j<8;j++){\n if(c==mat[i][j]){printf(\"NO\");return 0;}\n c=mat[i][j];\n }\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int x=8;\n\tint a[8][8];\n\tint i;\n\ti=0;\n\tint j;\n\twhile(x--)\n\t{\n\t\tchar s[8];\n\t\tscanf(\"%s\",s);\n\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tif(s[j]=='W')\n\t\t\t{\n\t\t\t\ta[i][j]=0;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ta[i][j]=1;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t}\n\t/*for(i=0;i<8;i++)\n\t{\n\t\tfor(j=0;j<8;j++)\n\t\t{\n\t\t\tprintf(\"%d \",a[i][j]);\n\t\t}\n\t\tprintf(\"\\n\");\n\t}*/\n\tint flagg=0;\n\tfor(i=0;i<8;i++)\n {\n int flag=0;\n for(j=0;j<7;j++)\n {\n if(a[i][j]== a[i][j+1])\n {\n flag=1;\n break;\n }\n }\n if(flag==1)\n {\n flagg=1;\n break;\n }\n }\n if(flagg==0)\n {\n printf(\"YES\\n\");\n }\n else{\n printf(\"NO\\n\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n\nchar s[8][9];\nint i, j;\n\nint main()\n{\n for(i=0;i<8;i++)\n {\n for(j=0;j<8;j++)\n {\n scanf(\"%c\",&s[i][j]);\n if(j>0)\n {\n if(s[i][j]==s[i][j-1])\n {\n printf(\"NO\");\n return 0;\n }\n }\n }\n }\n printf(\"YES\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<conio.h>\n#include<string.h>\n#include<windows.h>\n\n#define swap( dtype , a , b) {dtype c; c=a ; a=b ; b=c;}\n#define mini(a,b) ((a)<(b)? (a):(b))\n#define maxi(a,b) ((a)>(b)? (a):(b))\n#define show(x,format) printf(#x \"=%\" #format \"\\n\",x)\n#define clr system(\"cls\")\n# define rev(a) a%10*10+a/10\n\nvoid gxy(short col, short row)\n{\n\tHANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);\n\tCOORD position = { col,row };\n\tSetConsoleCursorPosition(h, position);\n}\nint main()\n{\n\tint i,j,w=0,b=0,c=0;\n\tchar str[8];\n\tfor(i=0;i<8;i++){\n\t\tscanf(\"%s\" ,&str);\n\t\tfor(j=0;j<8;j++){\n\t\t\tif(str[j]=='W'){\n\t\t\t\tif(str[j+1]=='W') c++;\n\t\t\tw++;\n\t\t\t}\n\t\t\telse if(str[j]=='B'){\n\t\t\t\tif(str[j+1]=='B') c++;\n\t\t\tc++;\n\t\t\t}\n\t\t}\n\t}\n\t//printf(\"w=%d\\tb=%d\" ,w ,b);\n\tif(w==b&&c==0) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<conio.h>\n#include<string.h>\n#include<windows.h>\n\n#define swap( dtype , a , b) {dtype c; c=a ; a=b ; b=c;}\n#define mini(a,b) ((a)<(b)? (a):(b))\n#define maxi(a,b) ((a)>(b)? (a):(b))\n#define show(x,format) printf(#x \"=%\" #format \"\\n\",x)\n#define clr system(\"cls\")\n# define rev(a) a%10*10+a/10\n\nvoid gxy(short col, short row)\n{\n\tHANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);\n\tCOORD position = { col,row };\n\tSetConsoleCursorPosition(h, position);\n}\nint main()\n{\n\tint i,j,w=0,b=0,w1=0,b1=0;\n\tchar str[8];\n\tfor(i=0;i<8;i++){\n\t\tscanf(\"%s\" ,&str);\n\t\tif(str[0]=='W') w1++;\n\t\telse b1++;\n\t\tfor(j=0;j<8;j++){\n\t\t\tif(str[j]=='W') w++;\n\t\t\telse b++;\n\t\t}\n\t}\n\t//printf(\"w=%d\\tb=%d\" ,w ,b);\n\tif(w==b&&w1==b1) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<conio.h>\n#include<string.h>\n#include<windows.h>\n\n#define swap( dtype , a , b) {dtype c; c=a ; a=b ; b=c;}\n#define mini(a,b) ((a)<(b)? (a):(b))\n#define maxi(a,b) ((a)>(b)? (a):(b))\n#define show(x,format) printf(#x \"=%\" #format \"\\n\",x)\n#define clr system(\"cls\")\n# define rev(a) a%10*10+a/10\n\nvoid gxy(short col, short row)\n{\n\tHANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);\n\tCOORD position = { col,row };\n\tSetConsoleCursorPosition(h, position);\n}\nint main()\n{\n\tint i,j,w=0,b=0;\n\tchar str[8];\n\tfor(i=0;i<8;i++){\n\t\tscanf(\"%s\" ,&str);\n\t\tfor(j=0;j<8;j++){\n\t\t\tif(str[j]=='W') w++;\n\t\t\telse b++;\n\t\t}\n\t}\n\t//printf(\"w=%d\\tb=%d\" ,w ,b);\n\tif(w==b) printf(\"YES\");\n\telse printf(\"NO\");\n\treturn 0;\n}"}], "src_uid": "ca65e023be092b2ce25599f52acc1a67"} {"nl": {"description": "This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either\u00a0\u2014 although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number $$$n$$$.In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could \"see\" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.Given $$$n$$$, determine the total number of possible bus number variants.", "input_spec": "The first line contains one integer $$$n$$$ ($$$1 \\leq n \\leq 10^{18}$$$)\u00a0\u2014 the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with $$$0$$$.", "output_spec": "Output a single integer\u00a0\u2014 the amount of possible variants of the real bus number.", "sample_inputs": ["97", "2028"], "sample_outputs": ["2", "13"], "notes": "NoteIn the first sample, only variants $$$97$$$ and $$$79$$$ are possible.In the second sample, the variants (in the increasing order) are the following: $$$208$$$, $$$280$$$, $$$802$$$, $$$820$$$, $$$2028$$$, $$$2082$$$, $$$2208$$$, $$$2280$$$, $$$2802$$$, $$$2820$$$, $$$8022$$$, $$$8202$$$, $$$8220$$$."}, "positive_code": [{"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\nlong long n;\nint l;\nint x[10];\nint w[10];\nlong long dp[10][21];\nlong long c[21][21];\nvoid init(){\n\tint i,j;\n\tfor(i=1;i<=20;i++){\n\t\tc[i][0]=1;\n\t\tc[i][i]=1;\n\t}\n\tfor(i=2;i<=20;i++){\n\t\tfor(j=1;j<i;j++){\n\t\t\tc[i][j]=c[i-1][j-1]+c[i-1][j];\n\t\t}\n\t}\n}\nvoid run(){\n\tint i,j,k;\n\tlong long r;\n\tinit();\n\twhile(scanf(LLD,&n)!=EOF){\n\t\tfor(i=0;i<10;i++){\n\t\t\tx[i]=0;\n\t\t}\n\t\tfor(;n>0;n/=10){\n\t\t\tx[n%10]++;\n\t\t}\n\t\tl=0;\n\t\tfor(i=1;i<10;i++){\n\t\t\tif(x[i]>0){\n\t\t\t\tw[l++]=x[i];\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<10;i++){\n\t\t\tfor(j=0;j<=20;j++){\n\t\t\t\tdp[i][j]=0;\n\t\t\t}\n\t\t}\n\t\tfor(i=1;i<=w[0];i++){\n\t\t\tdp[0][i]=1;\n\t\t}\n\t\tfor(i=1;i<l;i++){\n\t\t\tfor(j=i+1;j<=20;j++){\n\t\t\t\tfor(k=1;k<=w[i]&&j-k>=i;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-k+k][j-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x[0]>0){\n\t\t\tl++;\n\t\t\tfor(j=i+1;j<=20;j++){\n\t\t\t\tfor(k=1;k<=x[0]&&j-k>=i;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-1-k+k][j-1-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tr=0;\n\t\tfor(i=0;i<=20;i++){\n\t\t\tr+=dp[l-1][i];\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4912e_min.in\",\"rb\",stdin);\n\tfreopen(\"4912e_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\nint i,d[25],f[25],l;\nlong long a[25],ans;\nchar s[25];\n\nvoid dfs(int x)\n{\n\tint i,sum;\n\tlong long res;\n\t\n\tif (x>=10)\n\t{\n\t\tfor (i=0,sum=0;i<=9;i++) sum+=d[i];\n\t\tres=(long long) a[sum-1]*(sum-d[0]);\n\t\tfor (i=0;i<=9;i++) res/=a[d[i]];\n\t\tans+=res;\n\t\treturn;\n\t}\n\tif (!f[x]) dfs(x+1);\n\telse\n\t{\n\t\tfor (i=1;i<=f[x];i++) \n\t\t{\n\t\t\td[x]=i;\n\t\t\tdfs(x+1);\n\t\t}\n\t}\n}\n\nint main()\n{\n\tmemset(f,0,sizeof(f));\n\tmemset(d,0,sizeof(d));\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor (i=ans=0;i<l;i++) f[s[i]-'0']++;\n\tfor (i=1,a[0]=1;i<=20;i++) a[i]=(long long) a[i-1]*i;\n\tdfs(0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long fact(long long int n)\n{\n long long int ans = 1;\n for (long long int i = 2; i<=n; i++)\n ans*=i;\n return ans;\n}\n\nint main()\n{\n int h[10] = {},f[10] = {},p,f0,fn0;\n long long int n,temp,ctr = 0;\n scanf(\"%I64d\",&n);\n while(n>0)\n {\n h[n%10]++;\n n/=10;\n }\n outer :while(1)\n {\n f0 = 0, fn0 = 0,p = 9;\n f[9]++;\n while(f[p] > h[p] && p>0)\n {\n f[p] = 0;\n f[--p]++;\n }\n printf(\"\\n\");\n if (f[0] > h[0])\n break;\n f0 = f[0];\n for (int i = 1; i<10; i++)\n fn0+=f[i];\n temp = fn0 * fact(fn0 + f0 -1);\n for (int i = 0; i<10; i++)\n {\n if (f[i] == 0 && h[i]!=0)\n {\n temp = 0;\n break;\n }\n temp/=(f[i] > 0)?fact(f[i]) : 1;\n }\n ctr+=temp;\n }\n printf(\"%I64d\",ctr);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#define MAXN 25\nlong long f[MAXN];\nint c[MAXN];\nchar s[MAXN];\nint main(void) {\n\tlong long ans = 0;\n\tfgets(s, MAXN, stdin);\n\tint n = strlen(s);\n\tf[0] = 1;\n\tfor(int i = 1; i < 20; i++) f[i] = i * f[i - 1];\n\tif(s[n - 1] == '\\n') s[--n] = '\\0';\n\tfor(int i = 0; i < n; i++) s[i] -= '0';\n\tfor(int i = 0; i < n; i++) c[s[i]]++;\n\t for(int n0 = 0; n0 <= c[0]; n0++) if(n0 == 0 && c[0] != 0) continue;\n\telse for(int n1 = 0; n1 <= c[1]; n1++) if(n1 == 0 && c[1] != 0) continue;\n\telse for(int n2 = 0; n2 <= c[2]; n2++) if(n2 == 0 && c[2] != 0) continue;\n\telse for(int n3 = 0; n3 <= c[3]; n3++) if(n3 == 0 && c[3] != 0) continue;\n\telse for(int n4 = 0; n4 <= c[4]; n4++) if(n4 == 0 && c[4] != 0) continue;\n\telse for(int n5 = 0; n5 <= c[5]; n5++) if(n5 == 0 && c[5] != 0) continue;\n\telse for(int n6 = 0; n6 <= c[6]; n6++) if(n6 == 0 && c[6] != 0) continue;\n\telse for(int n7 = 0; n7 <= c[7]; n7++) if(n7 == 0 && c[7] != 0) continue;\n\telse for(int n8 = 0; n8 <= c[8]; n8++) if(n8 == 0 && c[8] != 0) continue;\n\telse for(int n9 = 0; n9 <= c[9]; n9++) if(n9 == 0 && c[9] != 0) continue;\n\telse {int sm = n0 + n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9; ans += (f[sm] - n0 * f[sm - 1]) / (f[n0]*f[n1]*f[n2]*f[n3]*f[n4]*f[n5]*f[n6]*f[n7]*f[n8]*f[n9]);}\n\tprintf(\"%I64d\\n\", ans);\n\treturn 0;\n}"}], "negative_code": [{"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\nint n,l;\nint x[10];\nint w[10];\nlong long dp[10][21];\nlong long c[21][21];\nvoid init(){\n\tint i,j;\n\tfor(i=1;i<=20;i++){\n\t\tc[i][0]=1;\n\t\tc[i][i]=1;\n\t}\n\tfor(i=2;i<=20;i++){\n\t\tfor(j=1;j<i;j++){\n\t\t\tc[i][j]=c[i-1][j-1]+c[i-1][j];\n\t\t}\n\t}\n}\nvoid run(){\n\tint i,j,k;\n\tlong long r;\n\tinit();\n\twhile(scanf(LLD,&n)!=EOF){\n\t\tfor(i=0;i<10;i++){\n\t\t\tx[i]=0;\n\t\t}\n\t\tfor(;n>0;n/=10){\n\t\t\tx[n%10]++;\n\t\t}\n\t\tl=0;\n\t\tfor(i=1;i<10;i++){\n\t\t\tif(x[i]>0){\n\t\t\t\tw[l++]=x[i];\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<10;i++){\n\t\t\tfor(j=0;j<=20;j++){\n\t\t\t\tdp[i][j]=0;\n\t\t\t}\n\t\t}\n\t\tfor(i=1;i<=w[0];i++){\n\t\t\tdp[0][i]=1;\n\t\t}\n\t\tfor(i=1;i<l;i++){\n\t\t\tfor(j=1;j<=20;j++){\n\t\t\t\tfor(k=1;k<=w[i]&&k<=j;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-k+k][j-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x[0]>0){\n\t\t\tl++;\n\t\t\tfor(j=2;j<=20;j++){\n\t\t\t\tfor(k=1;k<=x[0]&&k<=j-1;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-1-k+k][j-1-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tr=0;\n\t\tfor(i=0;i<=20;i++){\n\t\t\tr+=dp[l-1][i];\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4912e_min.in\",\"rb\",stdin);\n\tfreopen(\"4912e_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define\tLLD\t\"%lld\"\nint n,l;\nint x[10];\nint w[10];\nlong long dp[10][21];\nlong long c[21][21];\nvoid init(){\n\tint i,j;\n\tfor(i=1;i<=20;i++){\n\t\tc[i][0]=1;\n\t\tc[i][i]=1;\n\t}\n\tfor(i=2;i<=20;i++){\n\t\tfor(j=1;j<i;j++){\n\t\t\tc[i][j]=c[i-1][j-1]+c[i-1][j];\n\t\t}\n\t}\n}\nvoid run(){\n\tint i,j,k;\n\tlong long r;\n\tinit();\n\twhile(scanf(LLD,&n)!=EOF){\n\t\tfor(i=0;i<10;i++){\n\t\t\tx[i]=0;\n\t\t}\n\t\tfor(;n>0;n/=10){\n\t\t\tx[n%10]++;\n\t\t}\n\t\tl=0;\n\t\tfor(i=1;i<10;i++){\n\t\t\tif(x[i]>0){\n\t\t\t\tw[l++]=x[i];\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<10;i++){\n\t\t\tfor(j=0;j<=20;j++){\n\t\t\t\tdp[i][j]=0;\n\t\t\t}\n\t\t}\n\t\tfor(i=1;i<=w[0];i++){\n\t\t\tdp[0][i]=1;\n\t\t}\n\t\tfor(i=1;i<l;i++){\n\t\t\tfor(j=i+1;j<=20;j++){\n\t\t\t\tfor(k=1;k<=w[i]&&j-k>=i;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-k+k][j-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(x[0]>0){\n\t\t\tl++;\n\t\t\tfor(j=i+1;j<=20;j++){\n\t\t\t\tfor(k=1;k<=x[0]&&j-k>=i;k++){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j-k]*c[j-1-k+k][j-1-k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tr=0;\n\t\tfor(i=0;i<=20;i++){\n\t\t\tr+=dp[l-1][i];\n\t\t}\n\t\tprintf(LLD\"\\n\",r);\n\t}\n}\nmain(){\n#ifndef\tONLINE_JUDGE\n\tfreopen(\"4912e_min.in\",\"rb\",stdin);\n\tfreopen(\"4912e_.out\",\"wb\",stdout);\n#endif\n\trun();\n\treturn 0;\n}\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\nint i,d[25],f[25],l;\nlong long a[25],ans;\nchar s[25];\n\nvoid dfs(int x)\n{\n\tint i,sum;\n\tlong long res;\n\t\n\tif (x>=10)\n\t{\n\t\tfor (i=0,sum=0;i<=9;i++) sum+=d[i];\n\t\tres=(long long) a[sum-1]*(sum-d[0]);\n\t\tfor (i=0;i<=9;i++) \n\t\tif (d[i]) res/=d[i];\n\t\tans+=res;\n\t\treturn;\n\t}\n\tif (!f[x]) dfs(x+1);\n\telse\n\t{\n\t\tfor (i=1;i<=f[x];i++) \n\t\t{\n\t\t\td[x]=i;\n\t\t\tdfs(x+1);\n\t\t}\n\t}\n}\n\nint main()\n{\n\tmemset(f,0,sizeof(f));\n\tmemset(d,0,sizeof(d));\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor (i=ans=0;i<l;i++) f[s[i]-'0']++;\n\tfor (i=2,a[1]=1;i<=20;i++) a[i]=(long long) a[i-1]*i;\n\tdfs(0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#define _USE_MATH_DEFINES\n#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#include <stdbool.h>\n#include <float.h>\n#include <limits.h>\n#include <malloc.h>\n#include <memory.h>\n#include <complex.h>\n#include <errno.h>\n#include <time.h>\nint i,d[25],f[25],l;\nlong long a[25],ans;\nchar s[25];\n\nvoid dfs(int x)\n{\n\tint i,sum;\n\tlong long res;\n\t\n\tif (x>=10)\n\t{\n\t\tfor (i=0,sum=0;i<=9;i++) sum+=d[i];\n\t\tres=(long long) a[sum-1]*(sum-d[0]);\n\t\tfor (i=0;i<=9;i++) \n\t\tif (d[i]) res/=d[i];\n\t\tans+=res;\n\t\treturn;\n\t}\n\tif (!f[x]) dfs(x+1);\n\telse\n\t{\n\t\tfor (i=1;i<=f[x];i++) \n\t\t{\n\t\t\td[x]=i;\n\t\t\tdfs(x+1);\n\t\t}\n\t}\n}\n\nint main()\n{\n\tmemset(f,0,sizeof(f));\n\tmemset(d,0,sizeof(d));\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor (i=ans=0;i<l;i++) f[s[i]-'0']++;\n\tfor (i=1,a[0]=1;i<=20;i++) a[i]=(long long) a[i-1]*i;\n\tdfs(0);\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long fact(long long int n)\n{\n long long int ans = 1;\n for (long long int i = 2; i<=n; i++)\n ans*=i;\n return ans;\n}\n\nint main()\n{\n int h[10] = {},f[10] = {},p,f0,fn0;\n long long int n,temp,ctr = 0;\n scanf(\"%I64d\",&n);\n while(n>0)\n {\n h[n%10]++;\n n/=10;\n }\n outer :while (1)\n {\n f0 = 0, fn0 = 0,p = 9;\n f[9]++;\n while(f[p] > h[p] && p>0)\n {\n f[p] = 0;\n f[--p]++;\n }\n if (f[0] > h[0])\n break;\n f0 = f[0];\n for (int i = 1; i<10; i++)\n fn0+=f[i];\n temp = fn0 * fact(fn0 + f0 -1);\n for (int i = 0; i<10; i++)\n {\n if (f[i] == 0 && h[i]!=0)\n {\n temp = 0;\n break;\n }\n temp/=(f[i] > 0)?f[i] : 1;\n }\n ctr+=temp;\n }\n printf(\"%I64d\",ctr);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nlong long fact(long long int n)\n{\n long long int ans = 1;\n for (long long int i = 2; i<=n; i++)\n ans*=i;\n return ans;\n}\n\nint main()\n{\n int h[10] = {},f[10] = {},p,f0,fn0;\n long long int n,temp,ctr = 0;\n scanf(\"%I64d\",&n);\n while(n>0)\n {\n h[n%10]++;\n n/=10;\n }\n while (1)\n {\n f0 = 0, fn0 = 0,p = 9;\n f[9]++;\n while(f[p] > h[p] && p>0)\n {\n f[p] = 0;\n f[--p]++;\n }\n if (f[0] > h[0])\n break;\n f0 = f[0];\n for (int i = 1; i<10; i++)\n fn0+=f[i];\n temp = fn0 * fact(fn0 + f0 -1);\n for (int i = 0; i<10; i++)\n {\n temp/=(f[i] > 0)?f[i] : 1;\n }\n ctr+=temp;\n }\n printf(\"%I64d\",ctr);\n return 0;\n}"}], "src_uid": "7f4e533f49b73cc2b96b4c56847295f2"} {"nl": {"description": "Arkadiy has lots square photos with size a\u2009\u00d7\u2009a. He wants to put some of them on a rectangular wall with size h\u2009\u00d7\u2009w. The photos which Arkadiy will put on the wall must form a rectangular grid and the distances between neighboring vertically and horizontally photos and also the distances between outside rows and columns of photos to the nearest bound of the wall must be equal to x, where x is some non-negative real number. Look on the picture below for better understanding of the statement. Arkadiy haven't chosen yet how many photos he would put on the wall, however, he want to put at least one photo. Your task is to determine the minimum value of x which can be obtained after putting photos, or report that there is no way to put positive number of photos and satisfy all the constraints. Suppose that Arkadiy has enough photos to make any valid arrangement according to the constraints.Note that Arkadiy wants to put at least one photo on the wall. The photos should not overlap, should completely lie inside the wall bounds and should have sides parallel to the wall sides.", "input_spec": "The first line contains three integers a, h and w (1\u2009\u2264\u2009a,\u2009h,\u2009w\u2009\u2264\u2009109) \u2014 the size of photos and the height and the width of the wall.", "output_spec": "Print one non-negative real number \u2014 the minimum value of x which can be obtained after putting the photos on the wall. The absolute or the relative error of the answer must not exceed 10\u2009-\u20096. Print -1 if there is no way to put positive number of photos and satisfy the constraints.", "sample_inputs": ["2 18 13", "4 4 4", "3 4 3"], "sample_outputs": ["0.5", "0", "-1"], "notes": "NoteIn the first example Arkadiy can put 7 rows of photos with 5 photos in each row, so the minimum value of x equals to 0.5.In the second example Arkadiy can put only 1 photo which will take the whole wall, so the minimum value of x equals to 0.In the third example there is no way to put positive number of photos and satisfy the constraints described in the statement, so the answer is -1."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <assert.h>\n\ntypedef long long ll;\ntypedef struct pll { ll first,second; } pll;\n\n// a*x+b*y=g, x==0&&y==1||x==1&&y==0||1<=abs(x)<b/g&&1<=abs(y)<a/g&&x*y<0\nll min(ll x,ll y) { return x<y?x:y; }\nll egcd(ll a,ll b,ll *x,ll *y) {\n\tif(b==0) { *x=1,*y=0; return a; }\n\tll g=egcd(b,a%b,x,y);\n\tll z=*x; *x=*y; *y=z; *y-=(*x)*(a/b); return g;\n}\n\n\npll solve(ll a,ll b,ll MOD) { // a*x=b (mod MOD)\n\ta=(a%MOD+MOD)%MOD;\n\tb=(b%MOD+MOD)%MOD;\n\tll x,y,g=egcd(a,MOD,&x,&y);\n\tif(x<0) x+=MOD/g,y-=a/g;\n\tif(b%g!=0) return (pll){-1LL,-1LL};\n\treturn (pll){x*(b/g)%(MOD/g),MOD/g};\n}\n\nint a,h,w;\nvoid run() {\n\tscanf(\"%d%d%d\",&a,&h,&w);\n\t//(a+h)*nhor = w-h mod (w+a)\n\tpll nhor=solve(a+h,w-h,w+a);\n\tif(nhor.first==-1&&nhor.second==-1) { printf(\"-1\\n\"); return; }\n\tpll nvert={((a+h)*nhor.first+h-w)/(w+a),(a+h)*nhor.second/(w+a)};\n\t//printf(\"(%lld,%lld) (%lld,%lld)\\n\",nhor.first,nhor.second,nvert.first,nvert.second);\n\tassert(((a+h)*nhor.first+h-w)%(w+a)==0); assert((a+h)%nhor.second/(w+a)==0);\n\tif(nhor.first==0) nhor.first+=nhor.second,nvert.first+=nvert.second;\n\tif(nvert.first<=0) { ll t=(1-nvert.first+nvert.second-1)/nvert.second; nhor.first+=t*nhor.second,nvert.first+=t*nvert.second; }\n\tif(w-nhor.first*a<0||h-nvert.first*a<0) { printf(\"-1\\n\"); return; }\n\tll t=min((w-nhor.first*a)/(nhor.second*a),(h-nvert.first*a)/(nvert.second*a));\n\tnhor.first+=t*nhor.second,nvert.first+=t*nvert.second;\n\t//printf(\"%lld -> %.9lf / %lld -> %.9lf\\n\",nhor.first,1.0*(w-nhor.first*a)/(nhor.first+1),nvert.first,1.0*(h-nvert.first*a)/(nvert.first+1));\n\tprintf(\"%.9lf\\n\",1.0*(w-nhor.first*a)/(nhor.first+1));\n}\n\nint main() {\n\trun();\n return 0;\n}\n"}], "negative_code": [], "src_uid": "7fbefd3eb1aad6865adcfac394f0a7e6"} {"nl": {"description": "On a chessboard with a width of $$$n$$$ and a height of $$$n$$$, rows are numbered from bottom to top from $$$1$$$ to $$$n$$$, columns are numbered from left to right from $$$1$$$ to $$$n$$$. Therefore, for each cell of the chessboard, you can assign the coordinates $$$(r,c)$$$, where $$$r$$$ is the number of the row, and $$$c$$$ is the number of the column.The white king has been sitting in a cell with $$$(1,1)$$$ coordinates for a thousand years, while the black king has been sitting in a cell with $$$(n,n)$$$ coordinates. They would have sat like that further, but suddenly a beautiful coin fell on the cell with coordinates $$$(x,y)$$$...Each of the monarchs wanted to get it, so they decided to arrange a race according to slightly changed chess rules:As in chess, the white king makes the first move, the black king makes the second one, the white king makes the third one, and so on. However, in this problem, kings can stand in adjacent cells or even in the same cell at the same time.The player who reaches the coin first will win, that is to say, the player who reaches the cell with the coordinates $$$(x,y)$$$ first will win.Let's recall that the king is such a chess piece that can move one cell in all directions, that is, if the king is in the $$$(a,b)$$$ cell, then in one move he can move from $$$(a,b)$$$ to the cells $$$(a + 1,b)$$$, $$$(a - 1,b)$$$, $$$(a,b + 1)$$$, $$$(a,b - 1)$$$, $$$(a + 1,b - 1)$$$, $$$(a + 1,b + 1)$$$, $$$(a - 1,b - 1)$$$, or $$$(a - 1,b + 1)$$$. Going outside of the field is prohibited.Determine the color of the king, who will reach the cell with the coordinates $$$(x,y)$$$ first, if the white king moves first.", "input_spec": "The first line contains a single integer $$$n$$$ ($$$2 \\le n \\le 10^{18}$$$)\u00a0\u2014 the length of the side of the chess field. The second line contains two integers $$$x$$$ and $$$y$$$ ($$$1 \\le x,y \\le n$$$)\u00a0\u2014 coordinates of the cell, where the coin fell.", "output_spec": "In a single line print the answer \"White\" (without quotes), if the white king will win, or \"Black\" (without quotes), if the black king will win. You can print each letter in any case (upper or lower).", "sample_inputs": ["4\n2 3", "5\n3 5", "2\n2 2"], "sample_outputs": ["White", "Black", "Black"], "notes": "NoteAn example of the race from the first sample where both the white king and the black king move optimally: The white king moves from the cell $$$(1,1)$$$ into the cell $$$(2,2)$$$. The black king moves form the cell $$$(4,4)$$$ into the cell $$$(3,3)$$$. The white king moves from the cell $$$(2,2)$$$ into the cell $$$(2,3)$$$. This is cell containing the coin, so the white king wins. An example of the race from the second sample where both the white king and the black king move optimally: The white king moves from the cell $$$(1,1)$$$ into the cell $$$(2,2)$$$. The black king moves form the cell $$$(5,5)$$$ into the cell $$$(4,4)$$$. The white king moves from the cell $$$(2,2)$$$ into the cell $$$(3,3)$$$. The black king moves from the cell $$$(4,4)$$$ into the cell $$$(3,5)$$$. This is the cell, where the coin fell, so the black king wins. In the third example, the coin fell in the starting cell of the black king, so the black king immediately wins. "}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,a,b,d;\n double dis_w,dis_b;\n scanf(\"%lld%lld%lld\",&n,&a,&b);\n long long w,bl;\n w=(a+b-2);\n bl=(2*n-(a+b));\n if(bl<w)\n printf(\"Black\");\n else\n printf(\"White\\n\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n;\n\tlong long int x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tlong double dw1,dw2 ;\n\tlong double distw,distb;\n\t\n\tdw1 = dw2 = distw = distb = 0;\n\tdw1=powl((x-1),2);\n\tdw2=powl((y-1),2);\n\tdistw=powl((dw1+dw2),0.5);\n\t\n\tdw1 = dw2 = 0;\n\tdw1=powl((n-x),2);\n\tdw2=powl((n-y),2);\n\tdistb=powl((dw1+dw2),0.5);\n\t\n\tif(distw>distb)\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\t\t\n\treturn 0;\n}\n\t\n\n\t\n\t\n\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\n#define ll unsigned long long int \t\nint main(){\n\tll n,x,y;\n\tscanf(\"%lld %lld %lld\", &n,&x,&y);\n\tll wt ,bl, count =0;\n\tif(x==n&&y==n){\n\t\tprintf(\"Black\\n\");\n\t\treturn 0;\n\t}else if(x==1&& y==1){\n\t\tprintf(\"White\\n\");\n\t\treturn 0;\n\t}\n\telse{\n\t\twt = (x-1)>(y-1)?(x-1):(y-1) ;\n\t\tbl = (n-x+1)>(n-y+1)?(n-x+1):(n-y+1);\n//\t\tprintf(\"%lld %lld %lld\", wt,bl, n-y+1);\n\t}\t\n\tif(wt < bl){\n\t\tprintf(\"White\\n\" );\n\t}else\n\t\tprintf(\"Black\\n\");\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <math.h>\nint main(){\n\tlong long int n,c1,c2;\n\tlong double bk,bx,by,wk,wx,wy;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&c1);\n\tscanf(\"%I64d\",&c2);\n\t\n\tbx=c1-n;\n\tbx= powl((bx),2);\n\tby=c2-n;\n\tby=powl((by),2);\n\tbk=sqrtl(bx+by);\n\t\n\twx=c1-1;\n\twx= powl((wx),2);\n\twy=c2-1;\n\twy=powl((wy),2);\n\twk=sqrtl(wx+wy);\n\t\n\tif(wk<=bk){\n\t\tprintf(\"White\");\n }else{ \n\t\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int a,b,c,n,o;\n\tscanf(\"%I64lld\",&a);\n\tscanf(\"%I64lld %I64lld\",&b,&c);\n\tn=((2*a)-(b+c));\n\to=((b+c)-2);\n\tif(n<o)\n\tprintf(\"black\");\n\telse\n\tprintf(\"white\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int n,x,y,a,b,a1,b1,c1=0,c2=0,r1,r2,s1,s2;\n\tscanf(\"%lld%lld%lld\",&n,&x,&y);\n\ta=b=1;\n\ta1=b1=n;\n\tint t=1;\n\twhile(t--)\n\t{\n\t\tif(a==x&&b==y)\n\t\t{\n\t\t\tprintf(\"White\\n\");\n\t\t\tbreak;\n\t\t}\n\t\tif(a1==x&&b1==y)\n\t\t{\n\t\t\tprintf(\"Black\\n\");\n\t\t\tbreak;\n\t\t}\n\t\tif(a!=x&&b!=y)\n\t\t{\n\t\t\tr1=x-a;\n\t\t\tr2=y-b;\n\t\t//\tprintf(\"White r1 %lld r2 %lld\\n\",r1,r2);\n\t\t\tif(r1<r2)\n\t\t\t{\n\t\t\t\tc1+=r1;\n\t\t\t\ta+=r1;\n\t\t\t\tb+=r1;\n\t\t//\t\tprintf(\"White a %lld b %lld c1 %lld diff %lld\\n\",a,b,c1,y-b);\n\t\t\t\tc1+=y-b;\n\t\t\t\tb=y;\n\t\t\t}\n\t\t\tif(r2<r1)\n\t\t\t{\n\t\t\t\tc1+=r2;\n\t\t\t\ta+=r2;\n\t\t\t\tb+=r2;\n\t\t//\t\tprintf(\"White a %lld b %lld c1 %lld\\n\",a,b,c1);\n\t\t\t\tc1+=x-a;\n\t\t\t\ta=x;\n\t\t\t}\n\t\t\tif(r1==r2)\n\t\t\t{\n\t\t\t\tc1=r1;\n\t\t\t\ta=r1;\n\t\t\t\tb=r1;\n\t\t//\t\tprintf(\"White a %lld b %lld c1 %lld\\n\",a,b,c1);\n\n\t\t\t}\n\t\t}\n\t\tif(a==x&&b!=y)\n\t\t{\n\t\t\tc1=y-b;\n\t\t\tb=y;\n\t\t}\n\t\tif(a!=x&&b==y)\n\t\t{\n\t\t\tc1=x-a;\n\t\t\ta=x;\n\t\t}\t\n\t//\tprintf(\"x %lld y %lld a1 %lld b1 %lld\\n\",x,y,a1,b1);\n\t\t\n\t\tif(a1!=x&&b1!=y)\n\t\t{\n\t\t\ts1=a1-x;\n\t\t\ts2=b1-y;\n\t//\t\tprintf(\"Black s1 %lld s2 %lld\\n\",s1,s2);\n\t\t\tif(s1<s2)\n\t\t\t{\n\t\t\t\tc2+=s1;\n\t\t\t\ta1-=s1;\n\t\t\t\tb1-=s1;\n\t//\t\t\tprintf(\"Black a1 %lld b1 %lld c2 %lld diff %lld\\n\",a1,b1,c2,b1-y);\n\t\t\t\tc2+=b1-y;\n\t\t\t\tb1=y;\n\t\t\t}\n\t\t\tif(s2<s1)\n\t\t\t{\n\t\t\t\tc2+=s2;\n\t\t\t\ta1-=s2;\n\t\t\t\tb1-=s2;\n\t//\t\t\tprintf(\"Black a1 %lld b1 %lld c2 %lld diff %lld\\n\",a1,b1,c2,a1-x);\n\t\t\t\tc2+=a1-x;\n\t\t\t\ta1=x;\n\t\t\t}\n\t\t\tif(s1==s2)\n\t\t\t{\n\t\t\t\tc2=s1;\n\t\t\t\ta1=s1;\n\t\t\t\tb1=s1;\n\t//\t\t\tprintf(\"Black a1 %lld b1 %lld c2 %lld\\n\",a1,b1,c2);\n\n\t\t\t}\n\t\t}\n\t\tif(a1==x&&b1!=y)\n\t\t{\n\t\t\tc2=b1-y;\n\t\t\tb1=y;\n\t\t}\n\t\tif(a1!=x&&b1==y)\n\t\t{\n\t\t\tc2=a1-x;\n\t\t\ta1=x;\n\t\t}\n\t\tif(c1<=c2)\n\t printf(\"White\\n\");\n\t else\n\t printf(\"Black\\n\");\t\n\t\t//if(a==x&&b==y)\n\t\t//break;\n\t\t//if(a1==x&&b1==y)\n\t\t//break;\n\t}\n\t//printf(\"c1 %lld c2 %lld\\n\",c1,c2);\n\t//if(c1<=c2)\n\t//printf(\"White\\n\");\n\t//else\n\t//printf(\"Black\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n \nint main(){\n\n long long int r,c,n;\n \n scanf(\"%lld\",&n);\n scanf(\"%lld\",&r);\n scanf(\"%lld\",&c);\n \n long long int a=r+c-2;\n long long int b=(2*n)-(r+c);\n \n if(a<=b){\n\t \n\t printf(\"white\");\n }\n \n else{\n\t \n\t printf(\"black\");\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define ll unsigned long long int \t\nint main(){\n\tll n,x,y;\n\tscanf(\"%lld %lld %lld\", &n,&x,&y);\n\tll wt ,bl, count =0;\n\tif(x==n&&y==n){\n\t\tprintf(\"Black\\n\");\n\t\treturn 0;\n\t}else if(x==1&& y==1){\n\t\tprintf(\"White\\n\");\n\t\treturn 0;\n\t}\n\telse{\n\t\twt = (x-1)>(y-1)?(x-1):(y-1) ;\n\t\tbl = (n-x+1)>(n-y+1)?(n-x+1):(n-y+1);\n//\t\tprintf(\"%lld %lld %lld\", wt,bl, n-y+1);\n\t}\t\n\tif(wt < bl){\n\t\tprintf(\"White\\n\" );\n\t}else\n\t\tprintf(\"Black\\n\");\n}\n"}, {"source_code": "\n\n\n#include<stdio.h>\n#include<math.h>\n int main() {\n\tunsigned long long n,x,y;\n\tscanf(\"%llu\",&n);\n\tscanf(\"%llu %llu\",&x,&y);\nif((x+y)<(n+2)) {printf(\"white\");}\n\telse {printf(\"black\");}\nreturn 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n, x, y;\n\t\n\tscanf(\"%I64d\", &n);\n\tscanf(\"%I64d %I64d\", &x, &y);\n\t\n\tif((powl(powl(x-1,2) + powl(y-1,2), 0.5) <= powl(powl(x-n,2) + powl(y-n,2), 0.5))) {\n\t\t\tprintf(\"White\");\n\t}\n\telse {\n\t\tprintf(\"Black\");\n\t}\n\t\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n;\n\tlong long int x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tlong double dw1,dw2 ;\n\tlong double distw,distb;\n\t\n\tdw1 = dw2 = distw = distb = 0;\n\tdw1=powl((x-1),2);\n\tdw2=powl((y-1),2);\n\tdistw=powl((dw1+dw2),0.5);\n\t\n\tdw1 = dw2 = 0;\n\tdw1=powl((n-x),2);\n\tdw2=powl((n-y),2);\n\tdistb=powl((dw1+dw2),0.5);\n\t\n\tif(distw>distb)\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\t\t\n\treturn 0;\n}\n\t\n\n\t\n\t\n\t\n\t\n\t\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,a,b,x,y;\n scanf(\"%I64u%I64u%I64u\",&n,&a,&b);\n\n if((a-1)>(b-1))\n x=a-1;\n else\n x=b-1;\n if((n-a)>(n-b))\n y=n-a;\n else\n y=n-b;\n if(x<=y)\n printf(\"White\\n\");\n else\n printf(\"Black\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int max(long long int a,long long int b)\n{\n if(a>b)\n\t return a;\n else\n\t return b;\n}\nint main(void)\n{\n long long int n;\n scanf(\"%lld\",&n);\n long long int x,y;\n scanf(\"%lld %lld\",&x,&y);\n long long int d1,d2;\n d1=max(x-1,y-1);\n d2=max(n-x,n-y);\n if(d1>d2)\n\t printf(\"black\\n\");\n else\n\t printf(\"white\\n\");\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%I64d\\n\",&n);\n\tscanf(\"%I64d\\t%I64d\",&x,&y);\n\tlong long int a1,a2,b1,b2,d1,d2;\n\ta1=b1=1;\n\ta2=b2=n;\n\t if(x==1&&y==1)\n\t\t {\n\t\t\t printf(\"WHITE\");\n\t\t\t \n\t\t\t}\n\t else if(x==n&&y==n)\n\t\t {\n\t\t\t printf(\"BLACK\");\n\t\t\t \n\t\t\t}\n\t else\n\t {\n\t\t\t if((x-a1)<=(y-b1))\n\t\t\t d1=(y-b1);\n\t\t\t if((x-a1)>(y-b1))\n\t\t\t d1=(x-a1); \n\t\t\t if((a2-x)<=(b2-y))\n\t\t\t d2=(b2-y);\n\t\t\t if((a2-x)>(b2-y))\n\t\t\t d2=(a2-x);\n\t\t\t if(d1<=d2)\n\t\t\t printf(\"WHITE\");\n\t\t\t if(d1>d2)\n\t\t\t printf(\"BLACK\");\n\t\t }\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nvoid WIN(long long n,long long x,long long y)\n{\n\tlong long Sum=0;\n\tlong long Sum1=0;\n\tSum=(x-1)+(y-1);\n\tSum1=(n-x)+(n-y);\n\tif(Sum<=Sum1)\n\t{\n\t\tprintf(\"WHITE\");\n\t}\n\telse\n\t{\n\t\tprintf(\"BLACK\");\n\t}\n}\nint main()\n{\n\tlong long n,x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\tWIN(n,x,y);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,x,y,w,b;\n scanf(\"%lld %lld %lld\",&n,&x,&y);\n w=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(w<=b)\n {\n printf(\"white\");\n }\n else\n {\n printf(\"black\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int n, x, y;\n scanf(\"%I64d %I64d %I64d\", &n, &x, &y);\n unsigned long long int countw, countb, temp;\n if(x==y)\n {\n countw=x-1; countb=n-x;\n }\n else if(x>y)\n {\n countw=x-1;\n\n countb=n-y;\n n=n;\n }\n else\n {\n countw=y-1;\n\n countb=n-x;\n }\n\n if(countb<countw)\n printf(\"Black\");\n else\n printf(\"White\");\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int x, y, n;\n unsigned long long int w,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x, &y);\n w=((x-1)+(y-1));\n b=((n-x)+(n-y));\n if(w<=b)\n {printf(\"White\");}\n else\n {printf(\"Black\");}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long max(long long x, long long y)\n{\n\t\n\tif (x>y)\n\t{\n\t\treturn x;\n\t}\n\telse\n\t{\n\t\treturn y;\n\t}\n}\n\nlong long min(long long x, long long y)\n{\n\t\n\tif (x<y)\n\t{\n\t\treturn x;\n\t}\n\telse\n\t{\n\t\treturn y;\n\t}\n}\n\n long long main()\n{\n\tlong long x,y,n;\n\tscanf(\"%I64d %I64d %I64d\",&n,&x,&y);\n\tif (max(x,y)-1 > n-min(x,y))\n\t{\n\t\tprintf(\"black\");\n\t}\n\telse\n\t{\n\t\tprintf(\"white\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n,x,y,w,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tw=(x-1)+(y-1);\n\tb=(n-x)+(n-y);\n\tif(w<=b)\n\t\tprintf(\"White\");\n\telse\n\t\tprintf(\"Black\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n long long int n , x , y ;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d%I64d\",&x,&y);\n if(x+y-1 <= n){\n printf(\"White\");\n }\n else\n {\n printf(\"Black\");\n }\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int n;\n\tscanf(\"%I64d\",&n);\n\tlong long int x,y;\n\tscanf(\"%I64d%I64d\",&x,&y);\n\n\tif(x+y>n+1)\n\t{\n\t\tprintf(\"Black\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"White\\n\");\n\t}\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\n int main()\n { long long int n,x,y;\n long long int w,b ;\n\t scanf(\"%lld\",&n);\n\t scanf(\"%lld %lld\",&x,&y);\n\t w=(x-1) + (y-1);\n\t b=(n-x) + (n-y);\n\t if (w>b)\n{\n\tprintf(\"Black\");\n}\nelse{\n\tprintf(\"White\");\n}\n}"}, {"source_code": "# include<stdio.h>\nint main(){\nlong long int n,x,y;\nscanf(\"%lld%lld%lld\", &n,&x,&y);\nif((x+y)>=(n+2)){\nprintf(\"Black\");\n}\nelse{\nprintf(\"White\");\n}\n}"}, {"source_code": "#include<stdio.h>\nlong long int max(long long int a,long long int b)\n{\n if(a>b)\n return a;\n else\n return b;\n}\nint main(void)\n{\n long long int n;\n scanf(\"%lld\",&n);\n long long int x,y;\n scanf(\"%lld %lld\",&x,&y);\n long long int d1,d2;\n d1=max(x-1,y-1);\n d2=max(n-x,n-y);\n if(d1>d2)\n printf(\"black\\n\");\n else\n printf(\"white\\n\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;scanf(\"%I64d\",&n);long long x,y;\n\tscanf(\"%I64d%I64d\",&x,&y);\n\t if(x+y<=n+1){\n\t printf(\"%s\",\"White\");\n\t}\n\telse if(x+y>=n+2){\n\t printf(\"%s\",\"Black\");\n\t}\n\t\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main(int argc, char **argv)\n{\n\tlong long n, x, y, a,b;\n\tscanf(\"%I64d\\n\", &n);\n\tscanf(\"%I64d%I64d\", &x, &y);\n\ta=(x-1) + (y-1);\n\tb=(n-x) +(n-y);\n\tif(a>b)\n\tprintf(\"Black\");\n\telse\n\tprintf(\"White\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll unsigned long long int \t\nint main(){\n\tll n,x,y;\n\tscanf(\"%lld %lld %lld\", &n,&x,&y);\n\tll wt ,bl, count =0;\n\tif(x==n&&y==n){\n\t\tprintf(\"Black\\n\");\n\t\treturn 0;\n\t}else if(x==1&& y==1){\n\t\tprintf(\"White\\n\");\n\t\treturn 0;\n\t}\n\telse{\n\t\twt = (x-1)>(y-1)?(x-1):(y-1) ;\n\t\tbl = (n-x+1)>(n-y+1)?(n-x+1):(n-y+1);\n//\t\tprintf(\"%lld %lld %lld\", wt,bl, n-y+1);\n\t}\t\n\tif(wt < bl){\n\t\tprintf(\"White\\n\" );\n\t}else\n\t\tprintf(\"Black\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n \nint main(){\n\n long long int r,c,n;\n \n scanf(\"%lld\",&n);\n scanf(\"%lld\",&r);\n scanf(\"%lld\",&c);\n \n long long int a=r+c-2;\n long long int b=(2*n)-(r+c);\n \n if(a<=b){\n\t \n\t printf(\"white\");\n }\n \n else{\n\t \n\t printf(\"black\");\n }\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n, x, y;\n\tscanf(\"%I64d%I64d%I64d\", &n, &x, &y);\n\n\tif (x + y > n + 1) {\n\t\tprintf(\"Black\");\n\t} else {\n\t\tprintf(\"White\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long n,x,y,s,k;\nscanf(\"%I64d\\n\",&n);\nscanf(\"%I64d\",&x);\nscanf(\"%I64d\",&y);\ns=(x-1)+(y-1);\nk=(n-x)+(n-y);\n\nif(s>k){printf(\"black\");}\nelse{printf(\"white\");}\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n long long int n, x, y;\n long double d1, d2;\n scanf(\"%I64d %I64d %I64d\", &n, &x, &y);\n d1=sqrtl(powl(x-1,2)+powl(y-1,2));\n d2=sqrtl(powl(x-n,2)+powl(y-n,2));\n if(d1<=d2)\n {\n printf(\"White\");\n }\n else\n {\n printf(\"Black\");\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y,cnt1=0,cnt2=0,a,b;\n\n\tscanf(\"%lld%lld%lld\",&n,&x,&y);\n\n\tif (x-1>y-1) cnt1=x-1;\n\telse cnt1=y-1;\n\n\tif (n-x>n-y) cnt2=n-x;\n\telse cnt2=n-y;\n\n\tif (cnt1>cnt2) printf(\"Black\");\n\telse printf(\"White\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,x,y,w,b;\n scanf(\"%lld %lld %lld\",&n,&x,&y);\n w=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(w<=b)\n {\n printf(\"white\");\n }\n else\n {\n printf(\"black\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,x,y,r1,r2;\n scanf(\"%lld\",&n);\n scanf(\"%lld%lld\",&x,&y);\n r1=(x-1)+(y-1);\n r2=(n-x)+(n-y);\n \n if(r1>r2)\n {\n printf(\"Black\");\n }\n if(r1<=r2)\n {\n printf(\"White\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,x,y,s1,s2;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\ts1=x+y-2;\n\ts2=2*n-x-y;\n\tif(s1>s2)\n\t{\n\t\tprintf(\"Black\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"White\\n\");\n\t}\n\treturn 0;\n}\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%lld\",&n);\n\t\tscanf(\"%I64d %I64d\",&x,&y);\n\t\t\tlong double wd=sqrtl(powl((x-1),2)+powl((y-1),2));\n\t\t long double bd=sqrtl(powl((x-n),2)+powl((y-n),2));\n\t\t \n\t\t\t\n\t\t\tif(wd<=bd)\n\t\t\t{\n\t\t\t\tprintf(\"White\");\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tprintf(\"Black\");\n\t\t\t}\n\t\t\treturn 0;\n\t\t}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int x,y,k1,k2;\nlong long int n;\nscanf(\"%lld\",&n);\nscanf(\"%lld %lld\",&x,&y);\nk1=x+y-2;\nk2=n-x+n-y;\nif(k1<=k2)\n\t{\n\tprintf(\"White\");\n\t}\nelse\n\t{\n\tprintf(\"Black\");\n\t}\n\n\n\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,x,y,a,b;\n scanf(\"%llu\\n\",&n);\n scanf(\"%llu\\t%llu\",&x,&y);\n a=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(a==b || a<b)\n {\n printf(\"White\");\n }\n else\n {\n printf(\"Black\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\nlong long int n,x,y;\nscanf(\"%lld\",&n);\nscanf(\"%lld\",&x);\nscanf(\"%lld\",&y);\n\nlong long int a,b;\n\na=sqrtl(powl(x-n,2)+powl(y-n,2));\nb=sqrtl(powl(x-1,2)+powl(y-1,2));\n\nif(a>=b)\n\t{\n\t printf(\"White\");\n\t}\n\t\nelse\n\t{\n\tprintf(\"Black\");\n\t}\n\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long int x,y,n,w,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\tw=(x-1)+(y-1);\n\tb=(n-x)+(n-y);\n\tif(w<=b)\n\t printf(\"white\");\n\t else\n\t printf(\"black\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y,cnt1=0,cnt2=0,a,b;\n\n\tscanf(\"%lld%lld%lld\",&n,&x,&y);\n\n\tif (x-1>y-1) cnt1=x-1;\n\telse cnt1=y-1;\n\n\tif (n-x>n-y) cnt2=n-x;\n\telse cnt2=n-y;\n\n\tif (cnt1>cnt2) printf(\"Black\");\n\telse printf(\"White\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long int max(long long int a, long long int b)\n{\n if(a<b)\n return b;\n else\n return a;\n}\nint main()\n{\n long long int n, x, y;\n scanf(\"%lld %lld %lld\", &n, &x, &y);\n long long int white, black;\n white=max(x-1, y-1);\n black=max(n-x, n-y);\n if(black<white)\n printf(\"Black\");\n else\n printf(\"White\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tlong long int n,a,b,k,l,j;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&a,&b);\n\tk=(n-a)+(n-b);\n\tl=(a-1)+(b-1);\n\tif(k>=l)\n\t\tprintf(\"White\");\n\telse\n\t\tprintf(\"Black\");\n\treturn 0;\n}\n\t\n\t\n\t\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int n,x,y;\n\tlong double d1,d2,a,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d%I64d\",&x,&y);\n\ta=powl((x-1),2) + powl((y-1),2);\n\tb=powl((n-x),2) + powl((n-y),2);\n\td1=sqrtl(a);\n\td2=sqrtl(b);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int len(long long int a,long long int b);\nlong long int x,y;\nint main()\n{\n\nlong long int n,w,bl;\nscanf(\"%lld\\n\",&n);\n\nscanf(\"%lld %lld\",&x,&y);\n\nlong long int a=1,b=1;\nlong long int c=n,d=n;\n\nw=len(a,b);\nbl=len(c,d);\nif(w>bl)\n\tprintf(\"black\");\nelse\n\tprintf(\"white\");\nreturn 0;\n}\n\nlong long int len(long long int a,long long int b)\n{\nlong long int d;\nd=sqrtl(powl((x-a),2)+powl((y-b),2));\nreturn d;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;scanf(\"%I64d\",&n);long long x,y;\n\tscanf(\"%I64d%I64d\",&x,&y);\n\t if(x+y<=n+1){\n\t printf(\"%s\",\"White\");\n\t}\n\telse if(x+y>=n+2){\n\t printf(\"%s\",\"Black\");\n\t}\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long n,x,y,b,w;\nscanf(\"%llu %llu %llu\",&n,&x,&y);\n b=(n-x)+(n-y);\n w=(x-1)+(y-1);\n if(w>b)\n printf(\"black\");\n else\n printf(\"white\");\n }\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,a,b,d;\n double dis_w,dis_b;\n scanf(\"%lld%lld%lld\",&n,&a,&b);\n long long w,bl;\n w=(a+b-2);\n bl=(2*n-(a+b));\n if(bl<w)\n printf(\"Black\");\n else\n printf(\"White\\n\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,min1,min2,x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tif(x>y)\n\t{\n min1=n-x;\n min2=y-1;\n }\n\telse\n\t{\n\t\tmin1=n-y;\n\t\tmin2=x-1;\n\t}\n\t\n\tif(min1<min2)\n\t{\n\t\tprintf(\"Black\");\n\t}\nelse{\n\t\tprintf(\"White\");\n\t}\n}\n"}, {"source_code": "# include<stdio.h>\n\nint main()\n{\n\tlong long int n,x,y,a,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d%I64d\",&x,&y);\n\ta=(x-1)+(y-1);\n\tb=(n-y)+(n-x);\n\tif(a<=b)\n\t\tprintf(\"White\\n\");\n\telse\n\t\tprintf(\"Black\\n\");\n\treturn 0;\n}\n\t\n\t\t\n"}, {"source_code": "\n#include <stdio.h>\n#include <math.h>\nint main(){\n\tlong long int n,c1,c2;\n\tlong double bk,bx,by,wk,wx,wy;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&c1);\n\tscanf(\"%I64d\",&c2);\n\t\n\tbx=c1-n;\n\tbx= powl((bx),2);\n\tby=c2-n;\n\tby=powl((by),2);\n\tbk=sqrtl(bx+by);\n\t\n\twx=c1-1;\n\twx= powl((wx),2);\n\twy=c2-1;\n\twy=powl((wy),2);\n\twk=sqrtl(wx+wy);\n\t\n\tif(wk<=bk){\n\t\tprintf(\"White\");\n }else{ \n\t\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long n,a,b,d;\n double dis_w,dis_b;\n scanf(\"%lld%lld%lld\",&n,&a,&b);\n long long w,bl;\n w=(a+b-2);\n bl=(2*n-(a+b));\n if(bl<w)\n printf(\"Black\");\n else\n printf(\"White\\n\");\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\tlong long int n,x,y,w,b;\n\t\tscanf(\"%lld\",&n); \n\t\tscanf(\"%lld\",&x);\n\t\tscanf(\"%lld\",&y);\n\t\tw=x+y-2;\n\t\tb=2*n-x-y;\n\t\tif((w<=b))\n\t\t{\n\t\t\t\tprintf(\"White\");\n\t\t}\n\t\telse{\n\t\t\t\tprintf(\"Black\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int n,x,y;\n\tlong double d1,d2,a,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d%I64d\",&x,&y);\n\ta=powl((x-1),2) + powl((y-1),2);\n\tb=powl((n-x),2) + powl((n-y),2);\n\td1=sqrtl(a);\n\td2=sqrtl(b);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int len(long long int a,long long int b);\nlong long int x,y;\nint main()\n{\n\nlong long int n,w,bl;\nscanf(\"%lld\\n\",&n);\n\nscanf(\"%lld %lld\",&x,&y);\n\nlong long int a=1,b=1;\nlong long int c=n,d=n;\n\nw=len(a,b);\nbl=len(c,d);\nif(w>bl)\n\tprintf(\"black\");\nelse\n\tprintf(\"white\");\nreturn 0;\n}\n\nlong long int len(long long int a,long long int b)\n{\nlong long int d;\nd=sqrtl(powl((x-a),2)+powl((y-b),2));\nreturn d;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n;\n\tlong long int x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tlong double d1,d2,dw,db ;\n\td1 = d2 = dw = db = 0;\n\td1=powl((x-1),2);\n\td2=powl((y-1),2);\n\tdw=powl((d1+d2),0.5);\n\t\n\td1 = d2 = 0;\n\td1=powl((n-x),2);\n\td2=powl((n-y),2);\n\tdb=powl((d1+d2),0.5);\n\t\n\tif(dw>db)\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\t\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int a,b,x,y,n;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d\",&x);\n scanf(\"%I64d\",&y);\n a=n+2;\n b=x+y;\n if(a<=b)\n {\n printf(\"BLACK\");\n }\n else \n {\n printf(\"white\");\n }\n \n return 0;\n }"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\tlong long int n,x,y;\n long double s,l;\n\tscanf(\"%I64d %I64d %I64d\",&n,&x,&y);\n\ts=sqrtl(powl(x-1,2)+powl(y-1,2));\n\tl=sqrtl(powl(n-x,2)+powl(n-y,2));\n\tif(x==1 && y==1){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\telse if(x==n && y==n){\n\t\tprintf(\"Black\");\n\t\treturn 0;\n\t}\n\telse if(s<l){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\telse if(l<s){\n\t\tprintf(\"Black\");\n\t\treturn 0;\n\t}\n\telse if(s==l){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "\n\n\n#include <stdio.h>\nint main()\n{\n\tlong long int n,x,y,p,q;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tp=((x-1)+(y-1));\n\tq=((n-x)+(n-y));\n\tif (p>q)\n\t{\n\t printf(\"black\");\n\t}\n\telse \n\t{\n\t printf(\"white\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int len(long long int a,long long int b);\nlong long int x,y;\nint main()\n{\n\nlong long int n,w,bl;\nscanf(\"%lld\\n\",&n);\n\nscanf(\"%lld %lld\",&x,&y);\n\nlong long int a=1,b=1;\nlong long int c=n,d=n;\n\nw=len(a,b);\nbl=len(c,d);\nif(w>bl)\n\tprintf(\"black\");\nelse\n\tprintf(\"white\");\nreturn 0;\n}\n\nlong long int len(long long int a,long long int b)\n{\nlong long int d;\nd=sqrtl(powl((x-a),2)+powl((y-b),2));\nreturn d;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define MAX(x,y) ( x > y ? x : y )\n\ntypedef enum { Black, White } KingType;\n\nstatic char *KingTypeStr[] = { \"Black\", \"White\" };\n\n\nstatic KingType Solve( unsigned long long n, unsigned long long x, unsigned long long y )\n{\n unsigned long long distanceWhite = MAX ( x - 1, y - 1 );\n unsigned long long distanceBlack = MAX ( n - x, n - y );\n\n /* White wins if the distances are equal because white moves first.\n Hence <= in the comparison below */\n\n if ( distanceWhite <= distanceBlack ) return White;\n\n return Black;\n}\n\nstatic int RunSingleTest( unsigned long n, unsigned long x, unsigned long y, KingType expected )\n{\n return ( Solve( n, x, y ) == expected );\n}\n\nstatic void RunTests()\n{\n int testNum = 1;\n if(!RunSingleTest(4,2,3,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,3,5,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(2,2,2,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(2,2,2,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,1,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,2,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,3,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,4,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,5,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,2,1,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(1000000000000000000ULL,1000000000000000000ULL,1000000000000000000ULL,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n}\n\nstatic void Abort( char *message )\n{\n printf(\"%s\\n\", message );\n exit(1);\n}\n\nint main(int argc, char *argv[])\n{\n#define LINE_LEN 256\n char line[LINE_LEN];\n unsigned long long n, x, y ;\n\n static char *oneIntFormat = \"%I64d\";\n static char *twoIntFormat = \"%I64d %I64d\";\n static char *incorrectValuesFormat = \"Incorrect values of %I64d %I64d %I64d\\n\";;\n\n if( argc == 2 && !strcmp(argv[1],\"-test\"))\n {\n RunTests();\n exit(0);\n }\n\n if(!gets(line)) Abort(\"Cannot read first line\");\n\n if(!sscanf( line, oneIntFormat, &n )) Abort(\"Cannot read integer from first line\");\n\n if(!gets(line)) Abort(\"Cannot read second line\");\n\n if(!sscanf( line, twoIntFormat, &x, &y )) Abort(\"Cannot read x y from second line\");\n\n if ( n < 2 || x < 1 || y < 1 || x > n || y > n ) {\n sprintf( line, incorrectValuesFormat, n, x, y );\n Abort(line);\n }\n\n printf(\"%s\\n\", KingTypeStr[ Solve(n,x,y) ] );\n\n exit(0);\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int n,x,y;\n scanf(\"%lli%lli%lli\",&n,&x,&y);\n if(x+y<=n+1)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0-0-0;\n}"}, {"source_code": "#include <stdio.h>\nint main(){\n long long int n,x,y;\n scanf(\"%lli%lli%lli\",&n,&x,&y);\n if(x+y<=n+1)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0-0-0;\n}"}, {"source_code": "#include<stdio.h>\n \nint main(){\n\n long long int r,c,n;\n \n scanf(\"%lld\",&n);\n scanf(\"%lld\",&r);\n scanf(\"%lld\",&c);\n \n long long int a=r+c-2;\n long long int b=(2*n)-(r+c);\n \n if(a<=b){\n\t \n\t printf(\"white\");\n }\n \n else{\n\t \n\t printf(\"black\");\n }\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,x,y,a,b;\n scanf(\"%llu\\n\",&n);\n scanf(\"%llu\\t%llu\",&x,&y);\n a=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(a==b || a<b)\n {\n printf(\"White\");\n }\n else\n {\n printf(\"Black\");\n }\n}"}, {"source_code": "\n\n#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n unsigned long long n, x, y, w, b, p, q;\n\tscanf(\"%llu\", &n),\n\tscanf(\"%llu %llu\", &x, &y);\n\tw=(x-1)+(y-1);\n\tb=(n-x)+(n-y);\n\tp=w;\n\tq=b;\n\tif(p==q || p<q)\n\t{\n\t\tprintf(\"White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Black\");\n\t}\n}\t"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int x, y, n;\n unsigned long long int w,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x, &y);\n w=((x-1)+(y-1));\n b=((n-x)+(n-y));\n if(w<=b)\n {printf(\"White\");}\n else\n {printf(\"Black\");}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int n, x, y;\n scanf(\"%I64d %I64d %I64d\", &n, &x, &y);\n unsigned long long int countw, countb, temp;\n if(x==y)\n {\n countw=x-1; countb=n-x;\n }\n else if(x>y)\n {\n countw=x-1;\n\n countb=n-y;\n n=n;\n }\n else\n {\n countw=y-1;\n\n countb=n-x;\n }\n\n if(countb<countw)\n printf(\"Black\");\n else\n printf(\"White\");\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n, x, y;\n\t\n\tscanf(\"%I64d\", &n);\n\tscanf(\"%I64d %I64d\", &x, &y);\n\t\n\tif((powl(powl(x-1,2) + powl(y-1,2), 0.5) <= powl(powl(x-n,2) + powl(y-n,2), 0.5))) {\n\t\t\tprintf(\"White\");\n\t}\n\telse {\n\t\tprintf(\"Black\");\n\t}\n\t\t\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n int main()\n { long long int n,x,y,m,k;\n scanf(\"%lld\",&n);\n scanf(\"%lld%lld\",&x,&y);\n \n m=(x-1)+(y-1);\n k=(n-x)+(n-y);\n if(m>k)\n printf(\"black\");\n else\n printf(\"white\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int len(long long int a,long long int b);\nlong long int x,y;\nint main()\n{\n\nlong long int n,w,bl;\nscanf(\"%lld\\n\",&n);\n\nscanf(\"%lld %lld\",&x,&y);\n\nlong long int a=1,b=1;\nlong long int c=n,d=n;\n\nw=len(a,b);\nbl=len(c,d);\nif(w>bl)\n\tprintf(\"black\");\nelse\n\tprintf(\"white\");\nreturn 0;\n}\n\nlong long int len(long long int a,long long int b)\n{\nlong long int d;\nd=sqrtl(powl((x-a),2)+powl((y-b),2));\nreturn d;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nvoid WIN(long long n,long long x,long long y)\n{\n\tlong long Sum=0;\n\tlong long Sum1=0;\n\tSum=(x-1)+(y-1);\n\tSum1=(n-x)+(n-y);\n\tif(Sum<=Sum1)\n\t{\n\t\tprintf(\"WHITE\");\n\t}\n\telse\n\t{\n\t\tprintf(\"BLACK\");\n\t}\n}\nint main()\n{\n\tlong long n,x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\tWIN(n,x,y);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n long long n, x, y, temp1x, temp1y, temp2x, temp2y, max1, max2;\n scanf(\"%lli %lli %lli\", &n ,&x, &y);\n temp1x=x-1;\n temp1y=y-1;\n temp2x=n-x;\n temp2y=n-y;\n if(temp1x>temp1y) max1=temp1x;\n else max1=temp1y;\n if(temp2x>temp2y) max2=temp2x;\n else max2=temp2y;\n if(max1<=max2) printf(\"White\");\n else printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y,cnt1=0,cnt2=0,a,b;\n\n\tscanf(\"%lld%lld%lld\",&n,&x,&y);\n\n\tif (x-1>y-1) cnt1=x-1;\n\telse cnt1=y-1;\n\n\tif (n-x>n-y) cnt2=n-x;\n\telse cnt2=n-y;\n\n\tif (cnt1>cnt2) printf(\"Black\");\n\telse printf(\"White\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,a,b,x,y;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d%I64d\",&a,&b);\nif(a>=b){\n x=a-1;y=n-b;\n (x<=y)?printf(\"White\"):printf(\"Black\");\n}\nelse{\n x=b-1;y=n-a;\n(x<=y)?printf(\"White\"):printf(\"Black\");\n}\nreturn 0;}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\tlong long int n,x,y;\n long double s,l;\n\tscanf(\"%I64d %I64d %I64d\",&n,&x,&y);\n\ts=sqrtl(powl(x-1,2)+powl(y-1,2));\n\tl=sqrtl(powl(n-x,2)+powl(n-y,2));\n\tif(x==1 && y==1){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\telse if(x==n && y==n){\n\t\tprintf(\"Black\");\n\t\treturn 0;\n\t}\n\telse if(s<l){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\telse if(l<s){\n\t\tprintf(\"Black\");\n\t\treturn 0;\n\t}\n\telse if(s==l){\n\t\tprintf(\"White\");\n\t\treturn 0;\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,x,y,r1,r2;\n scanf(\"%lld\",&n);\n scanf(\"%lld%lld\",&x,&y);\n r1=(x-1)+(y-1);\n r2=(n-x)+(n-y);\n \n if(r1>r2)\n {\n printf(\"Black\");\n }\n if(r1<=r2)\n {\n printf(\"White\");\n }\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define MAX(x,y) ( x > y ? x : y )\n\ntypedef enum { Black, White } KingType;\n\nstatic char *KingTypeStr[] = { \"Black\", \"White\" };\n\n\nstatic KingType Solve( unsigned long long n, unsigned long long x, unsigned long long y )\n{\n unsigned long long distanceWhite = MAX ( x - 1, y - 1 );\n unsigned long long distanceBlack = MAX ( n - x, n - y );\n\n /* White wins if the distances are equal because white moves first.\n Hence <= in the comparison below */\n\n if ( distanceWhite <= distanceBlack ) return White;\n\n return Black;\n}\n\nstatic int RunSingleTest( unsigned long n, unsigned long x, unsigned long y, KingType expected )\n{\n return ( Solve( n, x, y ) == expected );\n}\n\nstatic void RunTests()\n{\n int testNum = 1;\n if(!RunSingleTest(4,2,3,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,3,5,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(2,2,2,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(2,2,2,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,1,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,2,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,3,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,4,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,1,5,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(5,2,1,White)) printf(\"Test %d failed\\n\", testNum); testNum++;\n if(!RunSingleTest(1000000000000000000ULL,1000000000000000000ULL,1000000000000000000ULL,Black)) printf(\"Test %d failed\\n\", testNum); testNum++;\n}\n\nstatic void Abort( char *message )\n{\n printf(\"%s\\n\", message );\n exit(1);\n}\n\nint main(int argc, char *argv[])\n{\n#define LINE_LEN 256\n char line[LINE_LEN];\n unsigned long long n, x, y ;\n\n static char *oneIntFormat = \"%I64d\";\n static char *twoIntFormat = \"%I64d %I64d\";\n static char *incorrectValuesFormat = \"Incorrect values of %I64d %I64d %I64d\\n\";;\n\n if( argc == 2 && !strcmp(argv[1],\"-test\"))\n {\n RunTests();\n exit(0);\n }\n\n if(!gets(line)) Abort(\"Cannot read first line\");\n\n if(!sscanf( line, oneIntFormat, &n )) Abort(\"Cannot read integer from first line\");\n\n if(!gets(line)) Abort(\"Cannot read second line\");\n\n if(!sscanf( line, twoIntFormat, &x, &y )) Abort(\"Cannot read x y from second line\");\n\n if ( n < 2 || x < 1 || y < 1 || x > n || y > n ) {\n sprintf( line, incorrectValuesFormat, n, x, y );\n Abort(line);\n }\n\n printf(\"%s\\n\", KingTypeStr[ Solve(n,x,y) ] );\n\n exit(0);\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tunsigned long long int size=0, x=0, y=0;\n\tscanf(\"%llu\", &size);\n\tscanf(\"%llu %llu\", &x, &y);\n\t\n\tif (((x-1)+(y-1))<((size-x)+(size-y))){\n\t\tprintf(\"White\");\n\t} else if (((x-1)+(y-1))>((size-x)+(size-y))){\n\t\tprintf(\"Black\");\n\t} else if (((x-1)+(y-1))==((size-x)+(size-y))){\n\t\tprintf(\"White\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include <stdlib.h>\nint main()\n{\nlong long n,x,y,w=0,l=0;\nscanf(\"%lld\",&n);\nscanf(\"%lld %lld\",&x,&y);\n\nw = (x-1)+(y-1);\nl = (n-x)+(n-y);\nif(w<=l)\nprintf(\"white\\n\");\nelse if(w>l)\nprintf(\"black\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long n,x,y,b,w;\nscanf(\"%llu %llu %llu\",&n,&x,&y);\n b=(n-x)+(n-y);\n w=(x-1)+(y-1);\n if(w>b)\n printf(\"black\");\n else\n printf(\"white\");\n }\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int n, x, y;\n scanf(\"%I64d %I64d %I64d\", &n, &x, &y);\n unsigned long long int countw, countb, temp;\n if(x==y)\n {\n countw=x-1; countb=n-x;\n }\n else if(x>y)\n {\n countw=x-1;\n\n countb=n-y;\n n=n;\n }\n else\n {\n countw=y-1;\n\n countb=n-x;\n }\n\n if(countb<countw)\n printf(\"Black\");\n else\n printf(\"White\");\n}\n"}, {"source_code": "#include<stdio.h>\n#define ll unsigned long long int \t\nint main(){\n\tll n,x,y;\n\tscanf(\"%lld %lld %lld\", &n,&x,&y);\n\tll wt ,bl, count =0;\n\tif(x==n&&y==n){\n\t\tprintf(\"Black\\n\");\n\t\treturn 0;\n\t}else if(x==1&& y==1){\n\t\tprintf(\"White\\n\");\n\t\treturn 0;\n\t}\n\telse{\n\t\twt = (x-1)>(y-1)?(x-1):(y-1) ;\n\t\tbl = (n-x+1)>(n-y+1)?(n-x+1):(n-y+1);\n//\t\tprintf(\"%lld %lld %lld\", wt,bl, n-y+1);\n\t}\t\n\tif(wt < bl){\n\t\tprintf(\"White\\n\" );\n\t}else\n\t\tprintf(\"Black\\n\");\n}\n"}, {"source_code": "# include<stdio.h>\n\nint main()\n{\n\tlong long int n,x,y,a,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d%I64d\",&x,&y);\n\ta=(x-1)+(y-1);\n\tb=(n-y)+(n-x);\n\tif(a<=b)\n\t\tprintf(\"White\\n\");\n\telse\n\t\tprintf(\"Black\\n\");\n\treturn 0;\n}\n\t\n\t\t\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long n, x, y, dw, db;\n\tscanf(\"%lld%lld%lld\", &n, &x, &y);\n\tdw = x - 1 + y - 1;\n\tdb = n - x + n - y;\n\tif (db < dw) printf(\"Black\");\n\telse printf(\"White\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long n,x,y,b,w;\n scanf(\"%llu %llu %llu\",&n,&x,&y);\n b=(n-x)+(n-y);\n w=(x-1)+(y-1);\n if(w>b)\n printf(\"black\");\n else\n printf(\"white\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int a, b, c, n, o;\n\tscanf(\"%I64D\",&a);\n\tscanf(\"%I64D %I64D \",&b, &c);\n\tn = ((2*a) -(b+c));\n\to = ((b+c)-2);\n\t\n\tif (n<o)\n\t\tprintf(\"black\");\n\telse\n\t\tprintf(\"white\");\n\treturn 0;\n}\n\n\n"}, {"source_code": "/*\n * kings race.c\n * \n * Copyright 2019 <examuser@14CPU0017L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main()\n{\n\tlong long int x,y,n,w,b;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\tw=(x-1)+(y-1);\n\tb=(n-x)+(n-y);\n\tif(w<=b)\n\t printf(\"white\");\n\t else\n\t printf(\"black\");\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;scanf(\"%I64d\",&n);long long x,y;\n\tscanf(\"%I64d%I64d\",&x,&y);\n\t if(x+y<=n+1){\n\t printf(\"%s\",\"White\");\n\t}\n\telse if(x+y>=n+2){\n\t printf(\"%s\",\"Black\");\n\t}\n\t\treturn 0;\n}"}, {"source_code": "\n\n\n#include<stdio.h>\n#include<math.h>\n int main() {\n\tunsigned long long n,x,y;\n\tscanf(\"%llu\",&n);\n\tscanf(\"%llu %llu\",&x,&y);\nif((x+y)<(n+2)) {printf(\"white\");}\n\telse {printf(\"black\");}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tlong long n, x, y, dw, db;\n\tscanf(\"%lld%lld%lld\", &n, &x, &y);\n\tdw = x - 1 + y - 1;\n\tdb = n - x + n - y;\n\tif (db < dw) printf(\"Black\");\n\telse printf(\"White\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<inttypes.h>\nint main()\n{\nlong long int n;\nscanf(\"%I64d\",&n);\n\n\nlong long int x,y;\nscanf(\"%I64d %I64d\",&x,&y);\n\n\nlong long int nblack,nwhite;\n\n long long int s=x<y?x:y;\n long long int g=x>y?x:y;\n\nnwhite=s-1+g-s;\n\nnblack=n-g+g-s;\n\nif(nwhite<=nblack){printf(\"white\");}\nelse{printf(\"black\");}\n\n\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tlong long n, x, y;\n\tscanf(\"%I64d%I64d%I64d\", &n, &x, &y);\n\n\tif (x + y > n + 1) {\n\t\tprintf(\"Black\");\n\t} else {\n\t\tprintf(\"White\");\n\t}\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n;\n\tlong long int x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tlong double d1,d2,dw,db ;\n\td1 = d2 = dw = db = 0;\n\td1=powl((x-1),2);\n\td2=powl((y-1),2);\n\tdw=powl((d1+d2),0.5);\n\t\n\td1 = d2 = 0;\n\td1=powl((n-x),2);\n\td2=powl((n-y),2);\n\tdb=powl((d1+d2),0.5);\n\t\n\tif(dw>db)\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\t\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n unsigned long long int x, y, n;\n unsigned long long int w,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x, &y);\n w=((x-1)+(y-1));\n b=((n-x)+(n-y));\n if(w<=b)\n {printf(\"White\");}\n else\n {printf(\"Black\");}\n return 0;\n}"}, {"source_code": "/*\n * kings.c\n * \n * Copyright 2019 Koushik <koushik@Koushik>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\t\t\tlong long int w,b,a,x,y;\n\t\t\tscanf(\"%I64d\",&a);\n\t\t\tscanf(\"%I64d %I64d\",&x,&y);\n\t\t\tw=((x+y)-2);\n\t\t\tb=((2*a)-(x+y));\n\t\t\tif (w<=b)\n\t\t\t\tprintf(\"White\");\n\t\t\telse\n\t\t\t\tprintf(\"Black\");\n\treturn 0;\n}\n\n"}, {"source_code": "/*\n * kingrace.c\n * \n * Copyright 2019 <examuser@11cpu0143L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n long long n,x,y, w,b;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&x);\n scanf(\"%lld\",&y);\n w=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(w<=b)\n printf(\"white\\n\");\n else\n printf(\"black\\n\"); \n return 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y,k,s;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\t\n\ts=((x-1)+(y-1));\n\tk=((n-x)+(n-y));\n\t\n\tif (s>k)\n\t{\n\t\tprintf(\"BLACK\");\n\t}\n\telse\n\t{\n\t\tprintf(\"WHITE\");\n\t}\n}\n\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long n,x,y,s1,s2;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x);\n\tscanf(\"%I64d\",&y);\n\ts1=x+y-2;\n\ts2=2*n-x-y;\n\tif(s1>s2)\n\t{\n\t\tprintf(\"Black\\n\");\n\t}\n\telse\n\t{\n\t\tprintf(\"White\\n\");\n\t}\n\treturn 0;\n}\n\t\n"}], "negative_code": [{"source_code": "/*\n * king.c\n * \n * Copyright 2019 <examuser@11cpu0143L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include <math.h>\nint main(int argc, char **argv)\n{\n int n,x,y,w,b;\n scanf(\"%d\",&n);\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n w=sqrt(pow((x-1),2)+pow((y-1),2));\n b=sqrt(pow((n-x),2)+pow((n-y),2));\n if(w<=b)\n printf(\"white\");\n else\n printf(\"black\");\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong int n, x, y;\n\t\n\tscanf(\"%ld\", &n);\n\tscanf(\"%ld %ld\", &x, &y);\n\t\n\tif((pow(pow(x-1,2) + pow(y-1,2), 0.5) <= pow(pow(x-n,2) + pow(y-n,2), 0.5)))\n\t\t\tprintf(\"White\");\n\t\t\t\n\telse\n\t\tprintf(\"Black\");\n\t\t\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <math.h>\nint main(){\n\tlong long int n,c1,c2;\n\tlong double bk,bx,by,wk,wx,wy;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&c1);\n\tscanf(\"%I64d\",&c2);\n\t\n\tbx=c1-n;\n\tbx= powl((bx),2);\n\tby=c2-n;\n\tby=powl((by),2);\n\tbk=sqrt(bx+by);\n\t\n\twx=c1-1;\n\twx= powl((wx),2);\n\twy=c2-1;\n\twy=powl((wy),2);\n\twk=sqrt(wx+wy);\n\t\n\tif(wk<=bk){\n\t\tprintf(\"White\");\n }else{ \n\t\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include <stdio.h>\n\nint main() {\n\tint n,x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&x,&y);\nif((x+y)<(n+2)) {printf(\"white\");}\n\telse {printf(\"black\");}\nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,a,b;\nscanf(\"%l64d%l64d%l64d\", &n,&a,&b);\nif((a+b)>=(n+2)){\nprintf(\"Black\");\n}\nelse{\nprintf(\"White\");\n}\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,x,y;\n long long int a,b;\n scanf(\"I64d\",&n);\n scanf(\"%I64d%I64d\",&a,&b);\n a=((x-1)*(x-1))+((y-1)*(y-1));\n b=((n-x)*(n-x))+((y-n)*(y-n));\n if(a>b)\n {\n printf(\"black\");\n }\n else\n {\n printf(\"white\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int n,x,y,w,b;\n scanf(\"%lld %lld %lld\",&n,&x,&y);\n w=(x-1)+(y-1);\n b=(n-x)+(n-y);\n if(w<b)\n {\n printf(\"white\");\n }\n else{\n printf(\"black\");\n }\n}\n"}, {"source_code": "main()\n{\n int n;\n int x,y;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n int white,white1,white2,black,black1,black2;\n\n white1=(x-1)+(x-y);\n white2=(y-1)+(x-y);\n white=white1+white2;\n\n black1=(n-x)+(x-y);\n black2=(n-y)+(x-y);\n black=black1+black2;\n\n if(black<white)\n {\n printf(\"Black\");\n }\n else if(black==white)\n {\n printf(\"White\");\n }\n else\n {\n printf(\"White\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long int n,x,y,i,j;\n scanf(\"%ld%ld%ld\",&n,&x,&y);\n if(x<=y)\n {\n i=y-1;\n j=n-x;\n }\n else if(x>y)\n {\n i=x-1;\n j=n-y;\n }\n if(j>=i)\n {\n printf(\"White\");\n }\n else\n {\n printf(\"Black\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int a,b,c,n,o;\n\tscanf(\"%I64lld\",&a);\n\tscanf(\"%I64lld %I64lld\",&a,&b);\n\tn=((2*a)-(b+c));\n\to=((b+c)-2);\n\tif(n<o)\n\tprintf(\"black\");\n\telse\n\tprintf(\"white\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n{\n unsigned long int n,x,y,w1,w2,b1,b2;\n double w,b;\n scanf(\"%ld\",&n);\n scanf(\"%ld%ld\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=sqrt((x-w1)*(x-w1)+(y-w2)*(y-w2));\n b=sqrt((x-b1)*(x-b1)+(y-b2)*(y-b2));\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a,b;\nscanf(\"%l64d %l64d %l64d\", &n,&a,&b);\nif(a+b>=n+2)\n{\nprintf(\"Black\");\n}\nelse\n{\nprintf(\"White\");\n}\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,x,y,w,l;\nscanf(\"%d\",&n);\nscanf(\"%d %d\",&x,&y);\n\nw = (x-1)+(y-1);\nl = (n-x) + (n-y);\nif(w<=l)\nprintf(\"white\\n\");\nelse if(w>=l)\nprintf(\"black\\n\");\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long unsigned int x,y,n,a,b;\n scanf(\"%d\",&n);\n scanf(\"%I64ud %I64ud\",&x,&y);\n a=(x-1)*(x-1)+(y-1)*(y-1);\n b=(n-x)*(n-x)+(n-y)*(n-y);\n if(a>b){\n printf(\"Black\");\n }\n else if(a=b){\n printf(\"White\");\n }\n else{\n printf(\"White\");\n }\n}\n \n \n \n \n \n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long int n;\n\tint x,y,i,d,k=0;\n\tscanf(\"%lld\",&n);\n\tscanf (\"%d%d\",&x,&y);\n\td=abs(x-(n+1));\n\tfor(i=1;i<=d;i++)\n\t{\n\t if(y==i)\n\t {\n\t k=1;\n\t printf(\"White\");\n\t}\n\t}\n\tif(k!=1)\n\tprintf(\"black\");\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\tint n,x,y,w,b;\n\t\tscanf(\"%d\",&n);\n\t\tscanf(\"%d\",&x);\n\t\tscanf(\"%d\",&y);\n\t\tw=(x+y)-2;\n\t\tb=(n-x)+(n-y);\n\t\tif((w<b)||(w==b))\n\t\t{\n\t\t\t\tprintf(\"White\");\n\t\t}\n\t\telse{\n\t\t\t\tprintf(\"Black\");\n\t\t\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tif(x+y<=(1+n))\n\tprintf(\"White\");\n\telse\n\tprintf(\"Black\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int x,y,n;\n long long int a,b;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x,&y);\n a=(x-1)*(x-1)+(y-1)*(y-1);\n b=(n-x)*(n-x)+(n-y)*(n-y);\n if(a>b){\n printf(\"Black\");\n }\n else if(a==b){\n printf(\"White\");\n }\n else{\n printf(\"White\");\n }\n}\n \n \n \n \n \n"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\tlong long int n,x,y;\n\tunsigned long int a,b;\n\tscanf(\"%I64d\\n\",&n);\n\tscanf(\"%I64d\\t%I64d\",&x,&y);\n\ta=((x-1)+(y-1));\n\tb=((n-x)+(n-y));\n\tif(a<=b)\n\t{\n\t printf(\"White\");\n\t}\n\telse\n\t{\n\t printf(\"Black\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tunsigned long long int n,x,y,w,b;\n\tscanf(\"%llu\",&n);\n\tscanf(\"%llu%llu\",&x,&y);\n\t//w=x+y-2;\n\t//b=(unsigned long long int)abs(x+y-n-n);\n\t/*if(w<=b)\n\tprintf(\"White\\n\");\n\telse\n\tprintf(\"Black\\n\");\n\treturn 0;*/\n\tif(y>x)\n\t{\n\t\tw=y-1;\n\t\tb=n-y;\n\t}\n\telse if(x>y)\n\t{\n\t\tw=x-1;\n\t\tb=n-x;\n\t}\n\telse\n\t{\n\t\tif(n%2!=0)\n\t\t{\n\t\t\tw=x;\n\t\t\tb=x;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tw=x;\n\t\t\tb=n-x;\n\t\t\n\t\t}\n\t}\n\tif(w<=b)\n\tprintf(\"White\\n\");\n\telse\n\tprintf(\"Black\\n\");\n\treturn 0;\t\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nlong double n,x,y;\nscanf(\"%Lf\",&n);\nscanf(\"%Lf %Lf\",&x,&y);\nif(sqrt(powl(1-x,2)+powl(1-y,2))<=sqrt(powl(n-x,2)+powl(n-y,2)))\nprintf(\"White\");\nelse\nprintf(\"Black\"); \nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n unsigned long long n, x, y, w, b, p, q;\n\tscanf(\"%llu\", &n),\n\tscanf(\"%llu %llu\", &x, &y);\n\tw=((x-1)*(x-1)+(y-1)*(y-1));\n\tb=((n-x)*(n-x)+(n-y)*(n-y));\n\tp=sqrt(w);\n\tq=sqrt(b);\n\tif(p==q || p<q)\n\t{\n\t\tprintf(\"White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Black\");\n\t}\n}\t\n"}, {"source_code": "\n#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <stdlib.h>\n\nint main(){\n long int n ,x,y;\n scanf(\"%ld\", &n);\n scanf(\"%ld %ld\", &x, &y);\n if ( (n-x) + (n-y) < (x-1) + (y-1) )\n printf(\"Black\");\n else\n printf(\"White\");\n\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long n,x,y,a,b;\n\tdouble d1,d2;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=pow(a,0.5);\n\td2=pow(b,0.5);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n\n"}, {"source_code": "/*\n * break.c\n * \n * Copyright 2019 Koushik <koushik@Koushik>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include<math.h>\n\n\nint main()\n{\n\tint a, b, c, k, m;\n\tscanf(\"%d\",&a);\n\tscanf(\"%d %d\",&b, &c);\n\tk = (b - a) * (b - a) + (c - a ) * (c - a);\n\tm = (b - 1) * (b - 1) + (c - 1) * (c - 1);\n\tif (sqrt(k) < sqrt(m))\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\treturn 0;\n}\n\t\n\t\n\t\n\t\t\n\t\t\n\t\t\t\n\t\t\n\t\t\t\n\t\n\t\n\n\t\t\n\t\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n, x, y, dw, db;\n\tscanf(\"%d%d%d\", &n, &x, &y);\n\tdw = abs(1-x)+abs(1-y);\n\tdb = abs(n-x) + abs(n-y);\n\tif (db < dw) printf(\"Black\");\n\telse printf(\"White\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nlong long int max(long long int a,long long int b)\n{\n if(a>b)\n\t return a;\n else\n\t return b;\n}\nint main(void)\n{\n int n;\n scanf(\"%d\",&n);\n int x,y;\n scanf(\"%d %d\",&x,&y);\n int d1,d2;\n d1=max(x-1,y-1);\n d2=max(n-x,n-y);\n if(d1>d2)\n\t printf(\"black\\n\");\n else\n\t printf(\"white\\n\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long int x, y, n;\n long long int d1, d2;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x, &y);\n d1=sqrtl((x-1)*(x-1)+(y-1)*(y-1));\n d2=sqrtl((x-n)*(x-n)+(y-n)*(y-n));\n if(d1<=d2)\n {printf(\"WHITE\");}\n else\n {printf(\"BLACK\");}\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\nint distance(int x ,int y ,int x0 ,int y0){\n return sqrt(pow(x0-x,2)+pow(y0-y,2));\n}\n\nint main()\n{\n int n , x , y , x1=1 , y1=1 , wd , bd ;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n wd = distance(x , y , x1 , y1);\n bd = distance(x , y , n , n);\n if(wd == bd){\n printf(\"White\");\n }\n else if(x == 1 && y ==1){\n printf(\"White\");\n }\n else{\n printf(\"Black\");\n }\n \n \n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n\tint a,n,x,y,l;\n\tunsigned s;\n\tscanf(\"%d\",&n);\n\tscanf (\"%d %d\",&x,&y);\n;\n\tif (s>l){\n\t\tprintf(\"black\\n\");\n\t}\n\telse if (l>s){\n\t\tprintf(\"white\\n\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n\ndouble hyp (int a, int b){\n return sqrt(a*a + b*b);\n}\n\nint main(void) {\n\tint size=0, x=0, y=0;\n\tscanf(\"%d\", &size);\n\tscanf(\"%d %d\", &x, &y);\n\t\n\tif (hyp(x-1, y-1) < hyp(size-x, size-y)){\n\t\tprintf(\"White\");\n\t} else if (hyp(x-1, y-1) > hyp(size-x, size-y)){\n\t\tprintf(\"Black\");\n\t} else if (hyp(x-1, y-1) == hyp(size-x, size-y)){\n\t\tprintf(\"White\");\n\t}\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\n\nint main(){\n int n , x , y ;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n if(x+y <= n+1)\n printf(\"White\");\n else\n {\n printf(\"Black\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,n,r,c;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&r,&c);\n\tif((r+c)<=(n+1))\n\t{\n\t\tprintf(\"White\\n\");\n\t}\n\telse\n\t\tprintf(\"Black\\n\");\n\treturn 0;\n}"}, {"source_code": "# include <stdio.h>\n\nint main(void) {\n\tint n, x, y;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tif (y <= -1*(x-1)+n) {\n\t\tprintf(\"White\\n\");\n\t}\n\telse {\n\t\tprintf(\"Black\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n{\n unsigned long int n,x,y,w1,w2,b1,b2;\n double w,b;\n scanf(\"%ld\",&n);\n scanf(\"%ld%ld\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=sqrt((x-w1)*(x-w1)+(y-w2)*(y-w2));\n b=sqrt((x-b1)*(x-b1)+(y-b2)*(y-b2));\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "// 1075 A - Chess\n\n\n#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tlong long int n, x, y;\n\t\n\tscanf(\"%I64d\", &n);\n\tscanf(\"%I64d %I64d\", &x, &y);\n\t\n\tif((pow(pow(x-1,2) + pow(y-1,2), 0.5) <= pow(pow(x-n,2) + pow(y-n,2), 0.5))) {\n\t\t\tprintf(\"White\");\n\t}\n\telse {\n\t\tprintf(\"Black\");\n\t}\n\t\t\n\treturn 0;\n\t\n}\n"}, {"source_code": "# include <stdio.h>\n\nint main(void) {\n\tint n, x, y;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tif (x==y & x==n) {\n\t\tprintf(\"Black\\n\");\n\t}\n\telse if (y <= -1*(x-1)+n) {\n\t\tprintf(\"White\\n\");\n\t}\n\telse {\n\t\tprintf(\"Black\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "/*\n * king.c\n * \n * Copyright 2019 <examuser@10CPU0064L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n#include<math.h>\nint main(int argc, char **argv)\n{\n\tlong int n,a,l,w,b;\n\tw=0;\n\tscanf(\"%ld\",&n);\n\tscanf(\"%ld %ld\",&a,&b);\n\tw=(a-1)+(b-1);\n\tl=(n-a)+(n-b);\n\tif(w<=l)\n\t{\n\t\tprintf(\"white\");\n\t}\n\telse\n\t{\n\t\tprintf(\"black\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\nlong long int n,x,y;\nlong double d1,d2;\nd1=d2=0;\nscanf(\"%I64d\",&n);\nscanf(\"%I64d %I64d\",&x,&y);\nd1=sqrt(powl(1-x,2)+powl(1-y,2));\nd2=sqrt(powl(n-x,2)+powl(n-y,2));\nif(d1<=d2)\nprintf(\"White\");\nelse\nprintf(\"Black\"); \nreturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int x,y,n,s,t,a,b,p,q,c;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n a=x-1;\n b=y-1;\n p=n-x;\n q=n-y;\n if(a>b){\n c=b;\n s=c+a-b;\n }\n else if(b>a){\n c=a;\n s=c+b-a;\n }\n else{\n c=a;\n s=a;\n }\n if(p>q){\n c=q;\n t=c+p-q;\n }\n else if(q>p){\n c=p;\n t=c+q-p;\n }\n else{\n c=a;\n t=a;\n }\n if(s<=t){\n printf(\"White\");\n }\n else{\n printf(\"Black\");\n }\n \n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,x,y;\n long long int a,b;\n scanf(\"I64d\",&n);\n scanf(\"%I64d%I64d\",&a,&b);\n a=((x-1)*(x-1))+((y-1)*(y-1));\n b=((n-x)*(n-x))+((y-n)*(y-n));\n if(a>b)\n {\n printf(\"black\");\n }\n else\n {\n printf(\"white\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,a,b,x,y;\n scanf(\"%I64d%I64d%I64d\",&n,&a,&b);\n\n x=(1-a)*(1-a)+(1-b)*(1-b);\n y=(n-a)*(n-a)+(n-b)*(n-b);\n if(x<=y)\n printf(\"White\\n\");\n else\n printf(\"Black\\n\");\n return 0;\n}\n"}, {"source_code": "\n#include <stdio.h>\n#include <math.h>\nint main(){\n\tdouble n,bk,bx,by,wk,wx,wy,c1,c2;\n\tscanf(\"%lf\",&n);\n\tscanf(\"%lf\",&c1);\n\tscanf(\"%lf\",&c2);\n\t\n\tbx=c1-n;\n\tbx= pow((bx),2);\n\tby=c2-n;\n\tby=pow((by),2);\n\tbk=sqrt(bx+by);\n\t\n\twx=c1-1;\n\twx= pow((wx),2);\n\twy=c2-1;\n\twy=pow((wy),2);\n\twk=sqrt(wx+wy);\n\t\n\tif(wk<=bk){\n\t\tprintf(\"White\");\n }else{ \n\t\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint i,n,r,c;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&r,&c);\n\tif((r+c)<=(n+1))\n\t{\n\t\tprintf(\"White\\n\");\n\t}\n\telse\n\t\tprintf(\"Black\\n\");\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int x,y,n,wdis,bdis;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d\",&x,&y);\n\twdis=(x-1)+(y-1);\n\tbdis=(n-x)+(n-y);\n\tif(wdis<=bdis)\n\t printf(\"White\");\n\t else\n\t printf(\"Black\"); \n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int n,x,y;\n long long int a,b;\n a=((x-1)*(x-1))+((y-1)*(y-1));\n b=((n-x)*(n-x))+((y-n)*(y-n));\n if(a>b)\n {\n printf(\"BLACK\");\n }\n else\n {\n printf(\"WHITE\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n{\n long long int n,x,y,w1,w2,b1,b2,w,b;\n scanf(\"%lld\",&n);\n scanf(\"%lld%lld\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=sqrt((x-w1)*(x-w1)+(y-w2)*(y-w2));\n b=sqrt((x-b1)*(x-b1)+(y-b2)*(y-b2));\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long n,x,y,a,b;\n\tdouble d1,d2;\n\tscanf(\"%I64d\\n %I64d %I64d\",&n,&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=pow(a,0.5);\n\td2=pow(b,0.5);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"WHITE\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"BLACK\");\n\t\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\tint n,x,y;\n\tscanf(\"%d %d %d\", &n,&x,&y);\n\tint wt ,bl, count =0;\n\tif(x==n&&y==n){\n\t\tprintf(\"Black\\n\");\n\t\treturn 0;\n\t}else if(x==1&& y==1){\n\t\tprintf(\"White\\n\");\n\t\treturn 0;\n\t}\n\telse{\n\t\twt = (x-1)>(y-1)?(x-1):(y-1) ;\n\t\tbl = (n-x+1)>(n-y+1)?(n-x+1):(n-y+1)+1;\n//\t\tprintf(\"%d %d\", wt,bl);\n\t}\t\n\tif(wt < bl){\n\t\tprintf(\"White\\n\" );\n\t}else\n\t\tprintf(\"Black\\n\");\n}\n"}, {"source_code": "/*\n * kings.c\n * \n * Copyright 2019 Koushik <koushik@Koushik>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\t\t\tlong long int w,b,a,x,y;\n\t\t\tscanf(\"%I64d\",&a);\n\t\t\tscanf(\"%I64d%I64d\",&x,&y);\n\t\t\tw=((x+y)-2);\n\t\t\tb=((2*a)-(x+y));\n\t\t\tif (w>b)\n\t\t\tprintf(\"White\");\n\t\t\telse\n\t\t\tprintf(\"Black\");\n\treturn 0;\n}\n\n"}, {"source_code": "#include<math.h>\n int main()\n{\n long long n,x,y,w1,w2,b1,b2,w,b;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=pow((x-w1),2)+pow((y-w2),2);\n b=pow((x-b1),2)+pow((y-b2),2);\n if(w>=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint maxium(int x,int y)\n{\tif(x>y)\n\treturn x;\n}\nint mini(int x,int y)\n{ if(x<y)\n\treturn y;\n}\nint main()\n{\tint x,y,n,a,b;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&x,&y);\n\ta=maxium(x,y)-1;\n\tb=n-mini(x,y);\n\tif(a<=b)\n\tprintf(\"WHITE\");\n\telse\n\tprintf(\"BLACK\");\n\treturn 0;\n\t}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n long long x,y,n;\n scanf(\"%lld%lld%lld\",&n,&x,&y);\n double a,b;\n a=sqrt((x-1)*(x-1) +(y-1)*(y-1));\n b=sqrt((n-x)*(n-x)+(n-y)*(n-y));\n if(a<=b)\n printf(\"\\nWhite\");\n else\n printf(\"\\nBlack\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int a,b,c,n,o;\n\tscanf(\"%I64lld\",&a);\n\tscanf(\"%I64lld %I64lld\",&a,&b);\n\tn=((2*a)-(b+c));\n\to=((b+c)-2);\n\tif(n<o)\n\tprintf(\"black\");\n\telse\n\tprintf(\"white\");\n\treturn 0;\n}"}, {"source_code": "/*\n * kings race.c\n * \n * Copyright 2019 <examuser@14CPU0017L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\tint x,y,n,w,b;\n\tprintf(\"enter the value of n\");\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tw=(x-1)+(y-1);\n\tb=(n-x)+(n-y);\n\tif(w<=b)\n\t printf(\"white\");\n\t else\n\t printf(\"black\");\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int n,x,y;\nscanf(\"%lld\",&n);\nlong long int wx=1,wy=1,bx=n,by=n;\nscanf(\"%lld%lld\",&x,&y);\nif(((x-wx+1<-(x-bx) && y-wx<-(y-bx) )|| (x-wx+1<-(x-bx) && y-wx>-(y-bx) ))||((x-wx<-(x-bx) && y-wx+1<-(y-bx))||(x-wx<-(x-bx) && y-wx+1>-(y-bx)) )||(( x-wx+1<-(x-bx) && y-wx+1<-(y-bx) )||( x-wx+1<-(x-bx) && y-wx+1>-(y-bx) )))\n printf(\"White\");\nelse\n printf(\"Black\");\n\nreturn 0;\n}\n"}, {"source_code": "\n\n\n#include <stdio.h>\n\n\nint main(int argc, char **argv)\n{\n\tlong long int n,x,y,p=0,q=0;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tp=((1-x)*(1-x)+(1-y)*(1-y));\n\tq=((n-x)*(n-x)+(n-y)*(n-y));\n\tif (p>q)\n\t printf(\"black\");\n\telse \n\t printf(\"white\");\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,x,y,w,b;\n scanf(\"%d\",&n);\n scanf(\"%d\",&x);\n scanf(\"%d\",&y);\n w=sqrt(pow((x-1),2)+pow((y-1),2));\n b=sqrt(pow((n-x),2)+pow((n-y),2));\n if(w<=b)\n printf(\"white\");\n else\n printf(\"black\");\n return 0;\n}\n"}, {"source_code": "\n\n\n#include <stdio.h>\n\n\nint main(int argc, char **argv)\n{\n\tint n,x,y,p=0,q=0;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&x,&y);\n\tp=((1-x)*(1-x)+(1-y)*(1-y));\n\tq=((n-x)*(n-x)+(n-y)*(n-y));\n\tif (p>q)\n\t printf(\"black\");\n\telse \n\t printf(\"white\");\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "/*\n * kin.c\n * \n * Copyright 2019 <examuser@11cpu0062L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\tlong long n,x,y,w,b;\n\tscanf(\"%lld %lld %lld\",&n,&x,&y);\n\tw= ((x-1)+(y-1));\n\tb=((x-n)+(y-n));\n\tif(w>=b)\n\tprintf(\"white\");\n\telse\n\tprintf(\"black\");\n\t\n\t\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<math.h>\n int main()\n{\n long long n,x,y,w1,w2,b1,b2,w,b;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=pow((x-w1),2)+pow((y-w2),2);\n b=pow((x-b1),2)+pow((y-b2),2);\n if(w>=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "\n\n\n#include <stdio.h>\nint main()\n{\n\tlong long int n,x,y,p,q;\n\tscanf(\"%I64dd\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\tp=((x-1)+(y-1));\n\tq=((n-x)+(y-n));\n\tif (p<=q)\n\t{\n\t printf(\"white\");\n\t}\n\telse \n\t{\n\t printf(\"black\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n long long n,a,b;\n scanf(\"%ld%ld%ld\",&n,&a,&b);\n if(a+b<=n+1)\n printf(\"White\");\n else\n printf(\"Black\");\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d\",&x);\n\tscanf(\"%d\",&y);\n\tif(x+y<=1+n)\n\tprintf(\"White\");\n\telse\n\tprintf(\"Black\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int a,b,n;\nscanf(\"%l64d %l64d %l64d\", &n, &a, &b);\nif ((a+b)>=(n+2))\n\tprintf(\"Black\\n\");\nelse \n\tprintf(\"White\\n\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nlong long int n,a,b;\nscanf(\"%l64d %l64d %l64d\", &n,&a,&b);\nif(a+b>=n+2)\n{\nprintf(\"Black\\n\");\n}\nelse\n{\nprintf(\"White\\n\");\n}\n}\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%I64d\\n\",&n);\n\tscanf(\"%I64d\\t%I64d\",&x,&y);\n\tlong long int a1,a2,b1,b2,d1,d2;\n\ta1=b1=1;\n\ta2=b2=n;\n\t if(x==1&&y==1)\n\t\t {\n\t\t\t printf(\"WHITE\");\n\t\t\t \n\t\t\t}\n\t else if(x==n&&y==n)\n\t\t {\n\t\t\t printf(\"BLACK\");\n\t\t\t \n\t\t\t}\n\t else\n\t {\n\t\t\t if((x-a1)<(y-b1))\n\t\t\t d1=(y-b1)-(x-a1);\n\t\t\t if((x-a1)>(y-b1))\n\t\t\t d1=(x-a1)-(y-b1); \n\t\t\t if((a2-x)<(b2-y))\n\t\t\t d2=(b2-y)-(a2-x);\n\t\t\t if((a2-x)>(b2-y))\n\t\t\t d2=(a2-x)-(b2-y);\n\t\t\t if(d1<=d2)\n\t\t\t printf(\"WHITE\");\n\t\t\t if(d1>d2)\n\t\t\t printf(\"BLACK\");\n\t\t }\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n unsigned long long int n,a,b,x,y;\n scanf(\"%I64u%I64u%I64u\",&n,&a,&b);\n\n x=(1-a)*(1-a)+(1-b)*(1-b);\n y=(n-a)*(n-a)+(n-b)*(n-b);\n if(x<=y)\n printf(\"White\\n\");\n else\n printf(\"Black\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n int main() {\n\tunsigned long n,x,y;\n\tscanf(\"%lu\",&n);\n\tscanf(\"%lu %lu\",&x,&y);\nif((x+y)<(n+2)) {printf(\"white\");}\n\telse {printf(\"black\");}\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n long long int n,x,y,j;\n scanf(\"%lld\",&n);\n scanf(\"%lld\",&x,&y);\n j=x-y;\n if(j<0)\n j*=-1;\n if(j%2==0)\n printf(\"Black\");\n else\n printf(\"White\");\n \n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int n,min1,min2,x,y;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%l64d %I64d\",&x,&y);\n\tif(x>y)\n\t{\n min1=n-x;\n min2=y-1;\n }\n\telse\n\t{\n\t\tmin1=n-y;\n\t\tmin2=x-1;\n\t}\n\n\tif(min1<min2)\n\t{\n\t\tprintf(\"Black\");\n\t}\nelse{\n\t\tprintf(\"White\");\n\t}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int n,x,y,a,b;\n\tdouble d1,d2;\n\tscanf(\"%I64d\",&n);\n\tscanf(\"%I64d %I64d\",&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=pow(a,0.5);\n\td2=pow(b,0.5);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n unsigned long long int n,x,y,w1,w2,b1,b2,w=0,b=0;\n w1=w2=1;\n scanf(\"%ulld\",&n);\n b1=b2=n;\n scanf(\"%ulld%ulld\",&x,&y);\n if(x-w1>y-w2)\n{\n w=w+y-w2;\n w1=w1+y-w2;\n w2=w2+y-w2;\n w=w+x-w1;\n}\n else\n{\n w=w+x-w1;\n w2=w2+x-w1;\n w1=w1+x-w1;\n w=w+y-w2;\n}\n if(b1-x>b2-y)\n{\n b=b+b2-y;\n b1=b1-(b2-y);\n b2=b2-(b2-y);\n b=b+b1-x;\n}\n else\n{\n b=b+b1-x;\n b2=b2-(b1-x);\n b1=b1-(b1-x);\n b=b-(b1-x);\n}\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\t\tint n,x,y; \n\t\tscanf(\"%d\",&n);\n\t\tscanf(\"%d\",&x);\n\t\tscanf(\"%d\",&y);\n\t\tif((x%2!=0)&&(y%2!=0)&&(x==y))\n\t\t{\n\t\t printf(\"white\");\n\t\t}\n\t\telse{\n\t\t printf(\"black\");\n\t\t}\n\t\t\n\t\twhile(x!=y)\n\t\t{\n\t\tif(x%2==0&&y%2!=0)\n\t\t{\n\t\t\t\tprintf(\"white\");break;\n\t\t}\n\t\telse if(x%2!=0&&y%2!=0)\n\t\t{\n\t\t\t\t\t\tprintf(\"black\");break;\n\t\t}\n\t\telse if(x%2==0&&y%2==0)\n\t\t{\n\t\t\t\tprintf(\"black\");break;\n\t\t}\n\t\telse{\n\t\t\t\tprintf(\"white\");break;\n\t\t}\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long n,x,y,a,b;\n\tdouble d1,d2;\n\tscanf(\"%I64d\\n %I64d %I64d\",&n,&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=pow(a,0.5);\n\td2=pow(b,0.5);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"WHITE\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"BLACK\");\n\t\t}\n\treturn 0;\n}\n\n"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%I64d\\n\",&n);\n\tscanf(\"%I64d\\t%I64d\",&x,&y);\n\tlong long int a1,a2,b1,b2,d1,d2;\n\ta1=b1=1;\n\ta2=b2=n;\n\t if(x==1&&y==1)\n\t\t {\n\t\t\t printf(\"WHITE\");\n\t\t\t \n\t\t\t}\n\t else if(x==n&&y==n)\n\t\t {\n\t\t\t printf(\"BLACK\");\n\t\t\t \n\t\t\t}\n\t else\n\t {\n\t\t\t if((x-a1)<(y-b1))\n\t\t\t d1=(y-b1)-(x-a1);\n\t\t\t if((x-a1)>(y-b1))\n\t\t\t d1=(x-a1)-(y-b1); \n\t\t\t if((a2-x)<(b2-y))\n\t\t\t d2=(b2-y)-(a2-x);\n\t\t\t if((a2-x)>(b2-y))\n\t\t\t d2=(a2-x)-(b2-y);\n\t\t\t if(d1<=d2)\n\t\t\t printf(\"WHITE\");\n\t\t\t if(d1>d2)\n\t\t\t printf(\"BLACK\");\n\t\t }\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n long long int n,x,y,w1,w2,b1,b2,w=0,b=0;\n w1=w2=1;\n scanf(\"%lld\",&n);\n b1=b2=n;\n scanf(\"%lld%lld\",&x,&y);\n if(x-w1>y-w2)\n{\n w=w+y-w2;\n w1=w1+y-w2;\n w2=w2+y-w2;\n w=w+x-w1;\n}\n else\n{\n w=w+x-w1;\n w2=w2+x-w1;\n w1=w1+x-w1;\n w=w+y-w2;\n}\n if(b1-x>b2-y)\n{\n b=b+b2-y;\n b1=b1-(b2-y);\n b2=b2-(b2-y);\n b=b+b1-x;\n}\n else\n{\n b=b+b1-x;\n b2=b2-(b1-x);\n b1=b1-(b1-x);\n b=b-(b1-x);\n}\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tint n;\n\tint x,y;\n\tscanf(\"%d\",&n);\n\tscanf(\"%d %d\",&x,&y);\n\tint dw1,dw2 ;\n\tfloat distw,distb;\n\tdw1 = dw2 = distw = distb = 0;\n\tdw1=pow((x-1),2);\n\tdw2=pow((y-1),2);\n\tdistw=pow((dw1+dw2),0.5);\n\tdw1=pow((n-x),2);\n\tdw2=pow((n-y),2);\n\tdistb=pow((dw1+dw2),0.5);\n\tif(distw>distb)\n\t\tprintf(\"Black\");\n\telse\n\t\tprintf(\"White\");\n\t\t\n\treturn 0;\n}\n\t\n\n\t\n\t\n\t\n\t\n\t\n"}, {"source_code": "/*\n * kin.c\n * \n * Copyright 2019 <examuser@11cpu0062L>\n * \n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n * MA 02110-1301, USA.\n * \n * \n */\n\n\n#include <stdio.h>\n\nint main(int argc, char **argv)\n{\n\tlong long n,x,y,w,b;\n\tscanf(\"%lld %lld %lld\",&n,&x,&y);\n\tw= ((x-1)+(y-1));\n\tb=((x-n)+(y-n));\n\tif(w>=b)\n\tprintf(\"white\");\n\telse\n\tprintf(\"black\");\n\t\n\t\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tlong long n;scanf(\"%I64d\",&n);long long x,y;\n\tscanf(\"%I64d%I64d\",&x,&y);\n\tif(x==n&&y==n){\n\t printf(\"%s\",\"Black\");\n\t}\n\tif(x==1&&y==1){\n\t printf(\"%s\",\"White\");\n\t}\n\tif(x+y<=n+1){\n\t printf(\"%s\",\"White\");\n\t}\n\tif(x+y>=n+2){\n\t printf(\"%s\",\"Black\");\n\t}\n\t\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,a,b;\n scanf(\"%d%d%d\",&n,&a,&b);\n if(a+b<=n+1)\n printf(\"White\");\n else\n printf(\"Black\");\n}"}, {"source_code": "\n#include <stdio.h>\n\nint main()\n{\n\tlong long int n,x,y;\n\tscanf(\"%I64d\\n\",&n);\n\tscanf(\"%I64d\\t%I64d\",&x,&y);\n\tlong long int a1,a2,b1,b2,d1,d2;\n\ta1=b1=1;\n\ta2=b2=n;\n\t if(x==1&&y==1)\n\t\t {\n\t\t\t printf(\"WHITE\");\n\t\t\t \n\t\t\t}\n\t else if(x==n&&y==n)\n\t\t {\n\t\t\t printf(\"BLACK\");\n\t\t\t \n\t\t\t}\n\t else\n\t {\n\t\t\t if((x-a1)<(y-b1))\n\t\t\t d1=(y-b1);\n\t\t\t if((x-a1)>(y-b1))\n\t\t\t d1=(x-a1); \n\t\t\t if((a2-x)<(b2-y))\n\t\t\t d2=(b2-y);\n\t\t\t if((a2-x)>(b2-y))\n\t\t\t d2=(a2-x);\n\t\t\t if(d1<=d2)\n\t\t\t printf(\"WHITE\");\n\t\t\t if(d1>d2)\n\t\t\t printf(\"BLACK\");\n\t\t }\n\t\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tlong long int n,x,y,w,b;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld%lld\",&x,&y);\n\tw=x+y-2;\n\tb=(long long int)abs(x+y-n-n);\n\tif(w<=b)\n\tprintf(\"White\\n\");\n\telse\n\tprintf(\"Black\\n\");\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\nlong long int a,b,n;\nscanf(\"%l64d %l64d %l64d\", &n, &a, &b);\nif ((a+b)>=(n+2))\n\tprintf(\"White\\n\");\nelse \n\tprintf(\"Black\\n\");\nreturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long n,x,y,a,b;\n\tdouble d1,d2;\n\tscanf(\"%I64d\\n %I64d %I64d\",&n,&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=pow(a,0.5);\n\td2=pow(b,0.5);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n, x, y, dw, db;\n\tscanf(\"%d%d%d\", &n, &x, &y);\n\tdw = abs(1-x)+abs(1-y);\n\tdb = abs(n-x) + abs(n-y);\n\tif (dw < dw) printf(\"Black\");\n\telse printf(\"White\");\n\treturn 0;\n}"}, {"source_code": "# include <stdio.h>\n\nint main(void) {\n\tint n, x, y;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &x);\n\tscanf(\"%d\", &y);\n\tif (x==y & x==n) {\n\t\tprintf(\"Black\\n\");\n\t}\n\telse if (y <= -1*(x-1)+n) {\n\t\tprintf(\"White\\n\");\n\t}\n\telse {\n\t\tprintf(\"Black\\n\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n{\n long long n,x,y,w1,w2,b1,b2,w,b;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=pow((x-w1),2)+pow((y-w2),2);\n b=pow((x-b1),2)+pow((y-b2),2);\n if(w>=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n int main()\n{\n unsigned long int n,x,y,w1,w2,b1,b2;\n double w,b;\n scanf(\"%ld\",&n);\n scanf(\"%ld%ld\",&x,&y);\n w1=w2=1;\n b1=b2=n;\n w=sqrt((x-w1)*(x-w1)+(y-w2)*(y-w2));\n b=sqrt((x-b1)*(x-b1)+(y-b2)*(y-b2));\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tfloat n, x, y, w, b, p, q;\n\tscanf(\"%f\", &n),\n\tscanf(\"%f %f\", &x, &y);\n\tw=((x-1)*(x-1)+(y-1)*(y-1));\n\tb=((n-x)*(n-x)+(n-y)*(n-y));\n\tp=sqrt(w);\n\tq=sqrt(b);\n\tif(p==q || p<q)\n\t{\n\t\tprintf(\"White\");\n\t}\n\telse\n\t{\n\t\tprintf(\"Black\");\n\t}\n}\t\n"}, {"source_code": "#include<stdio.h>\n int main()\n{\n unsigned long long int n,x,y,w1,w2,b1,b2,w=0,b=0;\n w1=w2=1;\n scanf(\"%ulld\",&n);\n b1=b2=n;\n scanf(\"%ulld%ulld\",&x,&y);\n if(x-w1>y-w2)\n{\n w=w+y-w2;\n w1=w1+y-w2;\n w2=w2+y-w2;\n w=w+x-w1;\n}\n else\n{\n w=w+x-w1;\n w2=w2+x-w1;\n w1=w1+x-w1;\n w=w+y-w2;\n}\n if(b1-x>b2-y)\n{\n b=b+b2-y;\n b1=b1-(b2-y);\n b2=b2-(b2-y);\n b=b+b1-x;\n}\n else\n{\n b=b+b1-x;\n b2=b2-(b1-x);\n b1=b1-(b1-x);\n b=b-(b1-x);\n}\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint n,a,b,c,d,x,y;\n\tfloat r1,r2,r3,r4,f,h,j,k,l;\n\tl=0.5;\n\tscanf(\"%d\\n\",&n);\n\tscanf(\"%d %d\",&x,&y);\n\ta=1,b=1,c=n,d=n;\n\tf=x-1,h=y-1,j=n-x,k=n-y;\n\tr1=pow(f,2)+pow(h,2);\n\tr2=pow(j,2)+pow(k,2);\n\tr3=pow(r1,l);\n\tr4=pow(r2,l);\n\tif(r3==r4){\n\tprintf(\"White\");\n\t}\n\telse if(r3<r4){\n\tprintf(\"white\");\n\t}\n\telse if(r3>r4){\n\tprintf(\"Black\");\n\t}\n\treturn 0;\n}\n "}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long n,x,y;\n int a,b;\n a=((x-1)*(x-1))+((y-1)*(y-1));\n b=((n-x)*(n-x))+((y-n)*(y-n));\n if(a>b)\n {\n printf(\"white\");\n }\n else\n {\n printf(\"black\");\n }\n}"}, {"source_code": "#include<stdio.h>\n int main()\n{\n unsigned long n,x,y,w1,w2,b1,b2,w=0,b=0;\n w1=w2=1;\n scanf(\"%lu\",&n);\n b1=b2=n;\n scanf(\"%lu%lu\",&x,&y);\n if(x-w1>=y-w2)\n{\n w=w+y-w2;\n w1=w1+y-w2;\n w2=w2+y-w2;\n w=w+x-w1;\n}\n else\n{\n w=w+x-w1;\n w2=w2+x-w1;\n w1=w1+x-w1;\n w=w+y-w2;\n}\n if(b1-x>=b2-y)\n{\n b=b+b2-y;\n b1=b1-(b2-y);\n b2=b2-(b2-y);\n b=b+b1-x;\n}\n else\n{\n b=b+b1-x;\n b2=b2-(b1-x);\n b1=b1-(b1-x);\n b=b-(b1-x);\n}\n if(w<=b)\n printf(\"White\");\n else\n printf(\"Black\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n unsigned long long int x, y, n;\n unsigned long long int d1, d2;\n scanf(\"%I64d\",&n);\n scanf(\"%I64d %I64d\",&x, &y);\n d1=((x-1)*(x-1)+(y-1)*(y-1));\n d2=((x-n)*(x-n)+(y-n)*(y-n));\n if(d1<=d2)\n {printf(\"White\");}\n else\n {printf(\"Black\");}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int x,y,n;\n unsigned int a,b;\n a=((x-1)*(y-1));\n b=((n-x)*(n-y));\n if(a>b)\n {\n printf(\"Black\");\n }\n else\n {\n printf(\"White\");\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint size=0, x=0, y=0;\n\tscanf(\"%d\", &size);\n\tscanf(\"%d %d\", &x, &y);\n\t\n\tif ((hyp(x-1,y-1)) < (hyp(size-x,size-y))) {\n\t\tprintf(\"White\");\n\t} else if ((hyp(x-1,y-1)) > (hyp(size-x,size-y))) {\n\t\tprintf(\"Black\");\n\t} else {\n\t\tprintf(\"White\");\n\t}\n}\n\nint hyp (int a, int b){\n return sqrt(a*a + b*b);\n}"}, {"source_code": "#include <stdio.h>\n\n int main()\n { long long int w,b,n,x,y;\n\t scanf(\"%I64d\",&n);\n\t scanf(\"%I64d %I64d\",&x,&y);\n\t w=(x-1)*(x-1) + (y-1)*(y-1);\n\t b=(n-x)*(n-x) + (n-y)*(n-y);\n\t if (w>b)\n{\n\tprintf(\"Black\");\n}\nelse{\n\tprintf(\"White\");\n}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tlong long int n,x,y,a,b;\n\tlong double d1,d2;\n\tscanf(\"%lld\",&n);\n\tscanf(\"%lld%lld\",&x,&y);\n\ta=(x-1)*(x-1) + (y-1)*(y-1);\n\tb=(n-x)*(n-x) + (n-y)*(n-y);\n\td1=sqrtl(a);\n\td2=sqrtl(b);\n\tif(d1<=d2)\n\t{\n\t\tprintf(\"White\");\n\t\t}\n\tif(d1>d2)\n\t{\n\t\tprintf(\"Black\");\n\t\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\n\nint main(){\n int n , x , y ;\n scanf(\"%d\",&n);\n scanf(\"%d%d\",&x,&y);\n if(x+y <= n+1)\n printf(\"White\");\n else\n {\n printf(\"Black\");\n }\n \n}"}], "src_uid": "b8ece086b35a36ca873e2edecc674557"} {"nl": {"description": "\u0422\u0440\u0438 \u0431\u0440\u0430\u0442\u0430 \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438\u0441\u044c \u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0435. \u041f\u0440\u043e\u043d\u0443\u043c\u0435\u0440\u0443\u0435\u043c \u0431\u0440\u0430\u0442\u044c\u0435\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043f\u0443\u0441\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0440\u0430\u0442 \u0438\u043c\u0435\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 1, \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0431\u0440\u0430\u0442 \u0438\u043c\u0435\u0435\u0442 \u043d\u043e\u043c\u0435\u0440 2, \u0430 \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0440\u0430\u0442\u00a0\u2014 \u043d\u043e\u043c\u0435\u0440 3. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0442\u0440\u0435\u0447\u0438, \u043e\u0434\u0438\u043d \u0438\u0437 \u0431\u0440\u0430\u0442\u044c\u0435\u0432 \u043e\u043f\u043e\u0437\u0434\u0430\u043b. \u041f\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u0430\u043c \u0434\u0432\u0443\u0445 \u0431\u0440\u0430\u0442\u044c\u0435\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f, \u0432\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440 \u043e\u043f\u043e\u0437\u0434\u0430\u0432\u0448\u0435\u0433\u043e \u0431\u0440\u0430\u0442\u0430.", "input_spec": "\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0434\u0432\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 a \u0438 b (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u20093, a\u2009\u2260\u2009b)\u00a0\u2014 \u043d\u043e\u043c\u0435\u0440\u0430 \u0431\u0440\u0430\u0442\u044c\u0435\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u043d\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0443 \u0432\u043e\u0432\u0440\u0435\u043c\u044f. \u041d\u043e\u043c\u0435\u0440\u0430 \u0434\u0430\u043d\u044b \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.", "output_spec": "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00a0\u2014 \u043d\u043e\u043c\u0435\u0440 \u0431\u0440\u0430\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u043e\u0437\u0434\u0430\u043b \u043d\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0443.", "sample_inputs": ["3 1"], "sample_outputs": ["2"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\nint main()\n{\nint a, b;\nscanf(\"%d %d\", &a, &b);\nif ((a==1) ||(b==1))\n{\nif ((a==2) ||(b==2))\nprintf(\"3\");\nelse\nprintf(\"2\");\n\n}\nelse\nprintf(\"1\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main(int argc, char* argv[])\n{\n int a, b;\n scanf(\"%d %d\", &a, &b);\n printf(\"%d\\n\", 6 - a - b);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b;\n scanf(\"%i%i\",&a,&b);\n printf(\"%i\",6-a-b);\n}\n"}, {"source_code": "#include <stdio.h>\n\nint a, b;\n\nint main()\n{\n scanf(\"%i %i\", &a, &b);\n printf(\"%i\", 6-(a+b));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nmain()\n{\nint a,b;\nscanf(\"%d%d\",&a,&b);\nprintf(\"%d\",6-a-b);\nreturn 0;\n}\n"}], "negative_code": [], "src_uid": "e167dc35a0d3b98c0414c66099e35920"} {"nl": {"description": "Kavi has $$$2n$$$ points lying on the $$$OX$$$ axis, $$$i$$$-th of which is located at $$$x = i$$$.Kavi considers all ways to split these $$$2n$$$ points into $$$n$$$ pairs. Among those, he is interested in good pairings, which are defined as follows:Consider $$$n$$$ segments with ends at the points in correspondent pairs. The pairing is called good, if for every $$$2$$$ different segments $$$A$$$ and $$$B$$$ among those, at least one of the following holds: One of the segments $$$A$$$ and $$$B$$$ lies completely inside the other. $$$A$$$ and $$$B$$$ have the same length. Consider the following example: $$$A$$$ is a good pairing since the red segment lies completely inside the blue segment.$$$B$$$ is a good pairing since the red and the blue segment have the same length.$$$C$$$ is not a good pairing since none of the red or blue segments lies inside the other, neither do they have the same size.Kavi is interested in the number of good pairings, so he wants you to find it for him. As the result can be large, find this number modulo $$$998244353$$$.Two pairings are called different, if some two points are in one pair in some pairing and in different pairs in another.", "input_spec": "The single line of the input contains a single integer $$$n$$$ $$$(1\\le n \\le 10^6)$$$.", "output_spec": "Print the number of good pairings modulo $$$998244353$$$.", "sample_inputs": ["1", "2", "3", "100"], "sample_outputs": ["1", "3", "6", "688750769"], "notes": "NoteThe good pairings for the second example are: In the third example, the good pairings are: "}, "positive_code": [{"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nint main()\r\n{\r\n int n;\r\n scanf(\"%d\",&n);\r\n int a[n];\r\n a[0]=1;\r\n a[1]=3;\r\n a[2]=6;\r\n int sum=a[0]+a[1]+a[2];\r\n int factors[n];\r\n for(int i=0;i<n;i++)factors[i]=0;\r\n for(int i=0;i<n;i++){\r\n for(int j=i;j<n;j=j+i+1){\r\n factors[j]++;\r\n }\r\n }\r\n for(int j=3;j<n;j++){\r\n a[j]=(sum+factors[j])%998244353;\r\n sum=(sum+a[j])%998244353;\r\n }\r\n printf(\"%d\\n\",a[n-1]);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n\r\nint ysgs(int n) {\r\n if(n==1) return 1;\r\n else {\r\n int cnt=0,i;\r\n for(i=1;i*i<n;i++)\r\n if(n%i==0) cnt+=2;\r\n if(i*i==n) cnt++;\r\n return cnt%998244353;\r\n }\r\n}\r\n\r\nint main() {\r\n int R=998244353,n,s=0,rr,m=0;\r\n scanf(\"%d\",&n);\r\n \r\n if(n>100000){\r\n s=345451881;\r\n m=1;\r\n }\r\n if(n>200000) {\r\n s=364228341;\r\n m=2;\r\n }\r\n if(n>300000) {\r\n s=305860330;\r\n m=3;\r\n }\r\n if(n>400000) {\r\n s=198031628;\r\n m=4;\r\n }\r\n if(n>500000) {\r\n s=292516569;\r\n m=5;\r\n }\r\n if(n>600000) {\r\n s=377314150;\r\n m=6;\r\n }\r\n if(n>700000) {\r\n s=55409794;\r\n m=7;\r\n }\r\n if(n>800000) {\r\n s=731775727;\r\n m=8;\r\n }\r\n if(n>900000) {\r\n s=951702590;\r\n m=9;\r\n }\r\n \r\n \r\n \r\n for( int j=m*100000+1;j<n;j++) {\r\n rr=(s+ysgs(j))%R;\r\n s=(s+rr)%R;\r\n }\r\n printf(\"%d\",(s+ysgs(n))%R);\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include<stdlib.h>\r\ntypedef long long lol;\r\n\r\nint main()\r\n{\r\n lol n, M = 998244353;\r\n scanf(\"%lld\",&n);\r\n lol arr[n+1],id=2;\r\n lol pr[1000000];\r\n pr[0]=2;\r\n pr[1]=3;\r\n lol i,j,k,p,ct,i1;\r\n arr[1]=1;\r\n for(i=2;i<=n;i++)\r\n {\r\n p=0;\r\n while((p<id) && (i%(pr[p])!=0) && (pr[p]*pr[p]<i)) p++;\r\n if(pr[p]*pr[p]>i)\r\n {\r\n arr[i]=2;\r\n pr[id]=i;\r\n id++;\r\n continue;\r\n }\r\n p = pr[p];\r\n ct = 0;\r\n i1=i;\r\n while(i1%p==0)\r\n {\r\n ct++;\r\n i1/=p;\r\n }\r\n arr[i] = arr[i1]*(ct+1);\r\n }\r\n lol ex = 1;\r\n lol ans = arr[n]%M, a1;\r\n for(i=1;i<n;i++)\r\n {\r\n a1 = (ex*arr[n-i])%M;\r\n ans+=a1;\r\n ans%=M;\r\n ex*=2;\r\n ex%=M;\r\n }\r\n printf(\"%lld\",ans);\r\n return 0;\r\n}\r\n"}, {"source_code": "/* main.c */\r\n\r\n// D <--~~~ __ _\r\n// U o'')}____//\r\n// O `_/ )\r\n// N (_(_/-(_/\r\n// G ~~~~~~~~~~~~~~~~~-->\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\n#define loop(i, a, b) for(ll i=a; i<b; i++)\r\n\r\ntypedef long long ll;\r\n\r\nconst ll MOD_PRIME = 10e9 + 7;\r\n\r\n\r\nvoid solve(){\r\n ll n, S;\r\n scanf(\"%lld\", &n);\r\n ll* dp = calloc(n+1, sizeof(ll));\r\n loop(i, 1, n+1){\r\n for(int j=i+i; j<n+1; j+=i){\r\n dp[j]++;\r\n }\r\n }\r\n dp[0] = S = 1;\r\n loop(i, 1, n+1){\r\n dp[i] += S;\r\n S += dp[i];\r\n S %= 998244353;\r\n dp[i] %= 998244353;\r\n }\r\n printf(\"%lld\", dp[n]);\r\n return;\r\n}\r\n\r\n\r\nint main(void){\r\n int T=1;\r\n //scanf(\"%d\", &T);\r\n loop(t, 0, T){\r\n solve();\r\n }\r\n return 0;\r\n}\r\n\r\n\r\n"}, {"source_code": "#include <stdio.h>\r\n#define N 1000001\r\nconst int mod=998244353;\r\nint dp[N],s=1;\r\nint main()\r\n{\r\n for(int i=1;i<=1000000;++i)\r\n for(int j=i+i;j<=1000000;j+=i)\r\n ++dp[j];\r\n\r\n for(int i=1;i<=1000000;i++)\r\n {\r\n dp[i]=(s+dp[i])%mod;\r\n s=(dp[i]+s)%mod;\r\n }\r\n\r\n scanf(\"%d\",&s);\r\n printf(\"%d\",dp[s]);\r\n return 0;\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n#define N 1000001\r\nconst int mod=998244353;\r\nint dp[N],s=1;\r\nint main()\r\n{\r\n for(int i=1;i<=1000000;i++)\r\n for(int j=i+i;j<=1000000;j+=i)\r\n dp[j]++;\r\n\r\n for(int i=1;i<=1000000;i++)\r\n {\r\n dp[i]=(s+dp[i])%mod;\r\n s=(dp[i]+s)%mod;\r\n }\r\n\r\n scanf(\"%d\",&s);\r\n printf(\"%d\",dp[s]);\r\n return 0;\r\n}\r\n"}, {"source_code": "#include <stdio.h>\r\n#define MOD 998244353\r\n\r\nint mem[1048576], sum[1048576], divs[1048576];\r\n\r\nint main(void) {\r\n int n;\r\n for (int i = 1; i <= 1000000; i++) {\r\n for (int j = i; j <= 1000000; j += i) {\r\n divs[j]++;\r\n }\r\n }\r\n scanf(\"%d\", &n);\r\n mem[1] = 1;\r\n sum[1] = 1;\r\n for (int i = 2; i <= n; i++) {\r\n mem[i] = (sum[i - 1] + divs[i]) % MOD;\r\n sum[i] = (sum[i - 1] + mem[i]) % MOD;\r\n }\r\n printf(\"%d\", mem[n]);\r\n return 0;\r\n}"}, {"source_code": "\r\n#define p 998244353\r\n\r\nint main()\r\n{\r\n int n,s=0;;\r\n scanf(\"%d\",&n);\r\n int div[n+1],li[n+1];\r\n div[0]=0;\r\n div[1]=0;\r\n li[0]=1;\r\n li[1]=1;\r\n\r\n for(int i=2;i<=n;i++)\r\n {\r\n div[i]=1;\r\n li[i]=0;\r\n }\r\n for(int i=2;i<=n;i++)\r\n {\r\n int x=i*2;\r\n while(x<=n)\r\n {\r\n div[x]+=1;\r\n x+=i;\r\n }\r\n\r\n }\r\n s=2;\r\n for(int i=2;i<=n;i++)\r\n {\r\n li[i]=s+div[i];\r\n s=(s+li[i])%p;\r\n }\r\n printf(\"%d\",li[n]);\r\n return 0;\r\n\r\n\r\n}\r\n"}, {"source_code": "#include <stdio.h>\n\n#define N\t1000000\n#define MD\t998244353\n\nint kk[N + 1];\n\nvoid init() {\n\tint i, j;\n\n\tfor (i = 1; i <= N; i++)\n\t\tfor (j = i; j <= N; j += i)\n\t\t\tkk[j]++;\n}\n\nint main() {\n\tint n, i, x, y;\n\n\tinit();\n\tscanf(\"%d\", &n);\n\tx = y = 1;\n\tfor (i = 2; i <= n; i++)\n\t\ty = (y + (x = (y + kk[i]) % MD)) % MD;\n\tprintf(\"%d\\n\", x);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\r\n\r\nint main(){\r\n int N;\r\n scanf(\"%d\",&N);\r\n int a[N];\r\n for(int i=0;i<N;i++)scanf(\"%d\",&a[i]);\r\n int factors[N];\r\n for(int i=0;i<N;i++)factors[i]=0;\r\n for(int i=0;i<N;i++){\r\n for(int j=i;j<N;j=j+i+1){\r\n factors[j]+=1;\r\n }\r\n }\r\n a[0]=1;\r\n a[1]=3;\r\n a[2]=6;\r\n int sum=a[0]+a[1]+a[2];\r\n for(int i=3;i<N;i++){\r\n a[i]=(sum+factors[i])%998244353;\r\n sum=(sum+a[i])%998244353;\r\n }\r\n printf(\"%d\",a[N-1]);\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include <math.h>\r\n\r\nlong long int a[1000001];\r\nlong long int sum[1000001];\r\n\r\nint main(void){\r\n\tint n;\r\n\tscanf(\"%d\",&n);\r\n\tfor(int i=1;i<=n;i++){\r\n\t\tfor(int j=i;j<=n;j+=i){\r\n\t\t\ta[j]++;\r\n\t\t}\r\n\t}\r\n\tsum[1]=1;\r\n\tfor(int i=2;i<=n;i++){\r\n\t\ta[i]+=sum[i-1]%998244353;\r\n\t\tsum[i]=sum[i-1]+a[i];\r\n\t}\r\n\tprintf(\"%lld\",a[n]);\r\n}"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nconst int mod = 998244353;\nint n;\nint dp[1000005];\nint main()\n{\n scanf(\"%d\",&n);\n //memset(dp,0,sizeof(dp));\n for(int i = 1; i<=n; i++)\n {\n for(int j =i; j<=n; j+=i)\n {\n dp[j]++;\n }\n\n }\n int sum = 0;\n for (int i = 1; i <= n; i++)\n {\n dp[i] = (dp[i] + sum) % mod;\n sum = (sum + dp[i]) % mod;\n }\n printf(\"%d\\n\",dp[n]);\n //cout << dp[n] <<endl;\n return 0;\n}\n\n\n\n\n \t \t\t\t\t\t\t\t \t\t\t \t \t \t\t\t \t\t \t\t"}, {"source_code": "#include <stdio.h>\r\ntypedef long long ll;\r\nconst int mod = 998244353;\r\nint n;\r\nint dp[1000005];\r\nint main()\r\n{\r\n scanf(\"%d\",&n);\r\n //memset(dp,0,sizeof(dp));\r\n for(int i = 1; i<=n; i++)\r\n {\r\n for(int j =i; j<=n; j+=i)\r\n {\r\n dp[j]++;\r\n }\r\n\r\n }\r\n int sum = 0;\r\n for (int i = 1; i <= n; i++)\r\n {\r\n dp[i] = (dp[i] + sum) % mod;\r\n sum = (sum + dp[i]) % mod;\r\n }\r\n printf(\"%d\\n\",dp[n]);\r\n //cout << dp[n] <<endl;\r\n return 0;\r\n}\r\n\r\n\r\n\r\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\n\nint dp[1000001];\n\nint main()\n{\n\tint N;\n\tscanf(\"%d\", &N);\n\tint pref = 0;\n\n\tfor (int i = 1; i <= N; i++) \n\t\tfor (int j = i; j <= N; j += i)\n\t\t\tdp[j]++;\n\n\tconst int mod = 998244353;\n\n\tfor (int i = 1; i <= N; i++) {\n\t\tdp[i] = (dp[i] + pref) % mod;\n\t\tpref = (dp[i] + pref) % mod;\n\t}\n\tprintf(\"%d\\n\", dp[N]);\n\treturn 0;\n}\n"}], "negative_code": [{"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nint main()\r\n{\r\n int n;\r\n scanf(\"%d\",&n);\r\n long a[n];\r\n a[0]=1;\r\n a[1]=3;\r\n a[2]=6;\r\n long sum=a[0]+a[1]+a[2];\r\n for(int j=3;j<n;j++){\r\n int l=0;\r\n //s1=(s1+a[j-1])%998244353;\r\n //for(int k=j-2;k>=0;k--)s1=(s1+a[k])%(998244353);\r\n float m=sqrt(j+1);\r\n int k;\r\n for(k=1;k<m;k++){\r\n if((j+1)%k==0)l=(l+2);\r\n }\r\n if(k*k==m)l++;\r\n //for(int k=1;k<=j;k++)if((j+1)%k==0)s1=(s1+1)%998244353;\r\n a[j]=(sum+l)%998244353;\r\n sum=(sum+a[j])%998244353;\r\n }\r\n printf(\"%ld\\n\",a[n-1]);\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nint main()\r\n{\r\n int n;\r\n //scanf(\"%d\",&n);\r\n n=100;\r\n long a[n];\r\n a[0]=1;\r\n a[1]=3;\r\n a[2]=6;\r\n long sum=a[0]+a[1]+a[2];\r\n for(int j=3;j<n;j++){\r\n long s1=(1+sum);\r\n int l=0;\r\n //s1=(s1+a[j-1])%998244353;\r\n //for(int k=j-2;k>=0;k--)s1=(s1+a[k])%(998244353);\r\n for(int k=1;k<=sqrt(j+1);k++){\r\n if(k*k==j+1 || k==1)\r\n l=(l+1);\r\n else if((j+1)%k==0)l=(l+2);\r\n }\r\n //for(int k=1;k<=j;k++)if((j+1)%k==0)s1=(s1+1)%998244353;\r\n a[j]=(s1+l)%998244353;\r\n sum=(sum+a[j])%998244353;\r\n }\r\n printf(\"%ld\\n\",a[n-1]);\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <math.h>\r\n\r\nint main()\r\n{\r\n int n;\r\n //scanf(\"%d\",&n);\r\n n=100;\r\n long a[n];\r\n a[0]=1;\r\n a[1]=3;\r\n a[2]=6;\r\n long sum=a[0]+a[1]+a[2];\r\n for(int j=3;j<n;j++){\r\n long s1=(1+sum);\r\n int l=0;\r\n //s1=(s1+a[j-1])%998244353;\r\n //for(int k=j-2;k>=0;k--)s1=(s1+a[k])%(998244353);\r\n for(int k=1;k<=sqrt(j+1);k++){\r\n if(k==sqrt(j+1) || k==1)\r\n l=(l+1);\r\n else if((j+1)%k==0)l=(l+2);\r\n }\r\n //for(int k=1;k<=j;k++)if((j+1)%k==0)s1=(s1+1)%998244353;\r\n a[j]=(s1+l)%998244353;\r\n sum=(sum+a[j])%998244353;\r\n }\r\n printf(\"%ld\\n\",a[n-1]);\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n\r\nint ysgs(int n) {\r\n if(n==1) return 1;\r\n else {\r\n int cnt=0,i;\r\n for(i=1;i*i<n;i++)\r\n if(n%i==0) cnt+=2;\r\n if(i*i==n) cnt++;\r\n return cnt%998244353;\r\n }\r\n}\r\n\r\nint main() {\r\n int R=998244353,n,s=0,rr,m=0;\r\n scanf(\"%d\",&n);\r\n \r\n if(n>100000){\r\n s=345451881;\r\n m=1;\r\n }\r\n if(n>200000) {\r\n s=364228341;\r\n m=2;\r\n }\r\n if(n>300000) {\r\n s=305860330;\r\n m=3;\r\n }\r\n if(n>400000) {\r\n s=198031628;\r\n m=4;\r\n }\r\n if(n>500000) {\r\n s=292516569;\r\n m=5;\r\n }\r\n if(n>600000) {\r\n s=377314150;\r\n m=6;\r\n }\r\n if(n>700000) {\r\n s=55409794;\r\n m=7;\r\n }\r\n if(n>800000) {\r\n s=731775727;\r\n m=8;\r\n }\r\n if(n>900000) {\r\n s=951702590;\r\n m=9;\r\n }\r\n \r\n \r\n \r\n for( int j=m*100000+1;j<n;j++) {\r\n rr=(s+ysgs(j))%R;\r\n s=(s+rr)%R;\r\n }\r\n printf(\"%d\\n\",(s+ysgs(n))%R);\r\n printf(\"%d\",ysgs(n));\r\n return 0;\r\n}"}, {"source_code": "#include<stdio.h>\r\n\r\nint ysgs(int n) {\r\n if(n==1) return 1;\r\n else {\r\n int cnt=0,i;\r\n for(i=1;i*i<n;i++)\r\n if(n%i==0) cnt+=2;\r\n if(i*i==n) cnt++;\r\n return cnt%998244353;\r\n }\r\n}\r\n\r\nint main() {\r\n int R=998244353,n,s=0,rr,m=0;\r\n scanf(\"%d\",&n);\r\n \r\n if(n>100000){\r\n s=345451881;\r\n m=1;\r\n }\r\n if(n>200000) {\r\n s=364228341;\r\n m=2;\r\n }\r\n \r\n \r\n \r\n for( int j=m*100000+1;j<n;j++) {\r\n rr=(s+ysgs(j))%R;\r\n s=(s+rr)%R;\r\n }\r\n printf(\"%d\\n\",(s+ysgs(n))%R);\r\n printf(\"%d\",ysgs(n));\r\n return 0;\r\n}"}, {"source_code": "#include <stdio.h>\r\n#include<stdlib.h>\r\ntypedef long long lol;\r\n\r\nint main()\r\n{\r\n lol n, M = 998244353;\r\n scanf(\"%lld\",&n);\r\n lol arr[n+1],id=2;\r\n lol pr[1000000];\r\n pr[0]=2;\r\n pr[1]=3;\r\n lol i,j,k,p,ct,i1;\r\n arr[1]=1;\r\n for(i=2;i<=n;i++)\r\n {\r\n p=0;\r\n while((p<id) && (i%(pr[p])!=0) && (pr[p]*pr[p]<i)) p++;\r\n if(p==id)\r\n {\r\n arr[i]=2;\r\n pr[id]=i;\r\n id++;\r\n continue;\r\n }\r\n p = pr[p];\r\n ct = 0;\r\n i1=i;\r\n while(i1%p==0)\r\n {\r\n ct++;\r\n i1/=p;\r\n }\r\n arr[i] = arr[i1]*(ct+1);\r\n }\r\n lol ex = 1;\r\n lol ans = arr[n]%M, a1;\r\n for(i=1;i<n;i++)\r\n {\r\n a1 = (ex*arr[n-i])%M;\r\n ans+=a1;\r\n ans%=M;\r\n ex*=2;\r\n ex%=M;\r\n }\r\n printf(\"%lld\",ans);\r\n return 0;\r\n}\r\n"}, {"source_code": "/* main.c */\r\n\r\n// D <--~~~ __ _\r\n// U o'')}____//\r\n// O `_/ )\r\n// N (_(_/-(_/\r\n// G ~~~~~~~~~~~~~~~~~-->\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\n#define loop(i, a, b) for(ll i=a; i<b; i++)\r\n\r\ntypedef long long ll;\r\n\r\nconst ll MOD_PRIME = 10e9 + 7;\r\n\r\n\r\nvoid solve(){\r\n ll n, S;\r\n scanf(\"%lld\", &n);\r\n ll* dp = calloc(n+1, sizeof(ll));\r\n loop(i, 1, n+1){\r\n for(int j=i+i; j<n+1; j+=i){\r\n dp[j]++;\r\n }\r\n }\r\n dp[0] = S = 1;\r\n loop(i, 1, n+1){\r\n dp[i] += S;\r\n S += dp[i];\r\n dp[i] %= 998244353;\r\n }\r\n printf(\"%lld\", dp[n]);\r\n return;\r\n}\r\n\r\n\r\nint main(void){\r\n int T=1;\r\n //scanf(\"%d\", &T);\r\n loop(t, 0, T){\r\n solve();\r\n }\r\n return 0;\r\n}\r\n\r\n\r\n"}], "src_uid": "09be46206a151c237dc9912df7e0f057"} {"nl": {"description": "Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.You know that there will be n interesting minutes t1,\u2009t2,\u2009...,\u2009tn. Your task is to calculate for how many minutes Limak will watch the game.", "input_spec": "The first line of the input contains one integer n (1\u2009\u2264\u2009n\u2009\u2264\u200990)\u00a0\u2014 the number of interesting minutes. The second line contains n integers t1,\u2009t2,\u2009...,\u2009tn (1\u2009\u2264\u2009t1\u2009<\u2009t2\u2009<\u2009... tn\u2009\u2264\u200990), given in the increasing order.", "output_spec": "Print the number of minutes Limak will watch the game.", "sample_inputs": ["3\n7 20 88", "9\n16 20 30 40 50 60 70 80 90", "9\n15 20 30 40 50 60 70 80 90"], "sample_outputs": ["35", "15", "90"], "notes": "NoteIn the first sample, minutes 21,\u200922,\u2009...,\u200935 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.In the second sample, the first 15 minutes are boring.In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game."}, "positive_code": [{"source_code": "#include<stdio.h>\nint main()\n{\n int n,a,b,c,d,e,i,s,x;\n scanf(\"%d\",&n);\n int ara[n];\n for(i=0; i<n; i++)\n scanf(\"%d\",&ara[i]);\n\n if(ara[0]>15)\n printf(\"15\\n\");\n else\n {\n for(i=0; i<n; i++)\n {\n s=ara[i]+15;\n\n if(s!=ara[i+1])\n if(s>ara[i+1] && s<90)\n ara[i]=ara[i+1];\n else if(s<ara[i+1])\n break;\n }\n\n\n if(s>=90)\n\n printf(\"90\\n\");\n if(s<90)\n printf(\"%d\\n\",s);\n }\n\n\n return 0;\n }\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n+2];\n a[0]=0;\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n a[n+1]=90;\n for(i=1;i<=n+1;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n printf(\"%d\\n\",a[i-1]+15);\n break;\n }\n else\n c++;\n }\n if(c==n+1)\n printf(\"90\\n\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tint now=0;\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\tif(t-now<=15){\n\t\t\tnow=t;\n\t\t\tif(i==n-1){\n\t\t\t\tif(now+15<=90){\n\t\t\t\t\tnow=now+15;\n\t\t\t\t}else{\n\t\t\t\t\tnow=90;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tnow=now+15;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",now);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, n, a, a_;\n\n\tscanf(\"%d\", &n);\n\ta_ = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tif (a - a_ > 15)\n\t\t\tbreak;\n\t\ta_ = a;\n\t}\n\tprintf(\"%d\\n\", a_ + 15 <= 90 ? a_ + 15 : 90);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,a,x=0,time=15,n;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a);\n if(a<=time&&x==0)\n time=a+15;\n else\n x++;\n }\n if(time>90)\n time=90;\n printf(\"%d\\n\",time);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n+2];\n a[0]=0;\n for(i=1;i<=n;i++)\n scanf(\"%d\",&a[i]);\n a[n+1]=90;\n for(i=1;i<=n+1;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n printf(\"%d\\n\",a[i-1]+15);\n break;\n }\n else\n c++;\n }\n if(c==n+1)\n printf(\"90\\n\");\n return 0; \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,t,J,I=0;\n scanf(\"%d\",&t);\n for(i=1;i<=t;i++)\n {\n scanf(\"%d\",&n);\n if(n-I>15)\n {\n break;\n }\n I=n;\n }\n if(I+15<=90)\n {\n printf(\"%d\",I+15);\n }\n else\n {\n printf(\"90\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint n;\nint time[91];\nint ans;\nint times;\nint main()\n{\n int i,j;\n scanf(\"%d\",&n);\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\",&j);\n time[j]++;\n }\n while(ans<15&×<90)\n {\n ans++;\n times++;\n if(time[times]!=0)ans=0;\n }\n printf(\"%d\",times);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint n,s,fst=0,i,cnt=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&s);\n\t\tif(s-fst>15) break;\n\t\tfst=s;\n\t}\n\tint p=(fst+15>90)?90:fst+15;\n\tprintf(\"%d\\n\",p);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main ()\n{\n int x,y,z,i,j,a;\n int sum=0,ck=0;\n int arr[1001];\n scanf(\"%d\",&i);\n for(j=0;j<i;j++){\n scanf(\"%d\",&arr[j]);\n }\n arr[j]=90;\n for(j=0;j<=i;j++){\n a=arr[j]-sum;\n if(a>15){\n printf(\"%d\\n\",sum+15);\n ck=1;\n break;\n }\n sum=arr[j];\n }\n if(ck==0){\n printf(\"%d\\n\",90);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\", &n);\n int arr[n+1];\n arr[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n int sum=0,x=0;\n for (i=1;i<=n;i++)\n {\n if((arr[i]-arr[i-1])>15)\n {\n sum=arr[i-1]+15;\n x=1;\n break;\n }\n else\n {\n sum=arr[i];\n }\n\n }\n if(x==0)\n {\n sum=sum+15;\n if(sum>90)\n {\n sum=90;\n }\n }\n\n printf(\"%d\\n\", sum);\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main() {\n\tint n;\n\tscanf(\"%d\",&n);\n\tint i;\n\tint now=0;\n\tfor(i=0;i<n;i++){\n\t\tint t;\n\t\tscanf(\"%d\",&t);\n\t\tif(t-now<=15){\n\t\t\tnow=t;\n\t\t\tif(i==n-1){\n\t\t\t\tif(now+15<=90){\n\t\t\t\t\tnow=now+15;\n\t\t\t\t}else{\n\t\t\t\t\tnow=90;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tnow=now+15;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",now);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,sum=15,s;\n int ara[100],dif[100];\n scanf(\"%d\",&n);\n s=n-1;\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n ara[0]=0;\n ara[n+1]=90;\n ara[n+2]=200;\n\n\n\n for(i=0; i<=n+1; i++)\n {\n dif[i]=ara[i+1]-ara[i];\n if(dif[i]>15)\n {\n s=i;\n break;\n }\n }\n\n\n sum=ara[s]+15;\n\n if(sum>90)\n sum=90;\n\n printf(\"%d\\n\",sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int i,a,x=0,time=15,n;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a);\n if(a<=time&&x==0)\n time=a+15;\n else\n x++;\n }\n if(time>90)\n time=90;\n printf(\"%d\\n\",time);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n \n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n \n \n if(n==1)\n { \n if(a[0]>15)\n printf(\"%d\\n\",15);\n else\n printf(\"%d\\n\",a[0]+15);\n\n }\n else if(n>1)\n {\n if(a[0]>15)\n printf(\"%d\\n\",15);\n\n else\n {\n for(i=0;i+1<n;i++)\n {\n c=a[i]+15;\n if(c>=a[i+1])\n {\n c=a[i+1]+15;\n if(c>=90)\n {\n c=90;\n break;\n }}\n\n else if(c<a[i+1])\n break;\n\n }\n printf(\"%d\\n\",c);\n }\n }\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i; scanf(\"%d\", &n);\n int ans = 15, buf;\n for(i = 0; i < n; i++)\n {\n\tscanf(\"%d\", &buf);\n\tif(buf > ans) break;\n\telse ans = buf + 15;\n }\n printf(\"%d\\n\", ans<90?ans:90);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100],n,i;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n if(a[0]>15)\n {\n printf(\"15\");\n }\n\n else\n {\n for(i=0; i<n; i++)\n {\n\n if(i==n-1)\n {\n if(a[i]+15<90)\n printf(\"%d\",a[i]+15);\n else\n printf(\"90\");\n break;\n }\n\n if(((a[i]+15)<a[i+1])&&(i<n-1))\n {\n printf(\"%d\",a[i]+15);\n break;\n }\n else if((a[i]+15)>=90)\n {\n printf(\"90\");\n break;\n }\n }\n\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(n==1)\n {\n if(a[0]>15)\n printf(\"%d\\n\",15);\n else\n printf(\"%d\\n\",a[0]+15);\n\n }\n else if(n>1)\n {\n if(a[0]>15)\n printf(\"%d\\n\",15);\n\n else\n {\n for(i=0;i+1<n;i++)\n {\n c=a[i]+15;\n if(c>=a[i+1])\n {\n c=a[i+1]+15;\n if(c>=90)\n {\n c=90;\n break;\n }}\n\n else if(c<a[i+1])\n break;\n\n }\n printf(\"%d\\n\",c);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdbool.h>\n\n#define minimum(x,y)((x)<(y) ? (x) : (y))\n#define maximum(x,y)((x)>(y) ? (x) : (y))\n\nint main(){\n int n,i,step,res,t;\n step =0;\n res = 0;\n scanf(\"%d\",&n);\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&t);\n // printf(\"%d\\n\", t);\n if(t-step>15){\n printf(\"%d\", step+15);\n return 0;\n }\n step=t;\n }\n\n printf(\"%d\", minimum(90,step+15));\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,x=0;\n scanf(\"%d\",&n);\n int a[n+1];\n a[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n x=1;\n break;\n }\n }\n if(x==1)\n printf(\"%d\",a[i-1]+15);\n else\n {\n if(a[i-1]<=75)\n printf(\"%d\",a[i-1]+15);\n else\n printf(\"90\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\t\tint min;\n\t\tscanf(\"%d\",&min);\n\t\tint a[min+1],i;\n\t\tfor(i=0;i<min;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&a[i]);\n \t}\n \ta[min]=90;\n\t\tfor(i=0;i<min;i++)\n\t\t{\n\t\t\tif(a[0]>15)\n\t\t\t{\n\t\t\t\tprintf(\"15\\n\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(a[i+1]-a[i]>15)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",a[i]+15);\n\t\t\t\tbreak;\n\t\t\t}\t\n\t\t\t//printf(\"%d\",a[i+1]-a[i]);\n\t\t}\n\t\tif(i==min)\n\t\tprintf(\"90\\n\");\n\t\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,k;\n scanf(\"%d\",&n);\n int i,a[10000];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(a[0]>15)\n printf(\"15\");\n else\n {\n for(i=0;i<n;i++)\n {\n if((a[i+1]-a[i])>15)\n {\n k = a[i];\n break;\n }\n }\n if(k<75)\n printf(\"%d\",k+15);\n else\n printf(\"90\");\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, n, cnt;\n\tstatic int a[91];\n\n\tscanf(\"%d\", &n);\n\tfor (i = 0; i < n; i++)\n\t\tscanf(\"%d\", &a[i]);\n\ta[n] = cnt = 90;\n\tif (a[0] > 15)\n\t\tcnt = 15;\n\telse\n\t\tfor (i = 1; i <= n; i++)\n\t\t\tif (a[i] - a[i - 1] - 1 >= 15) {\n\t\t\t\tcnt = a[i - 1] + 15;\n\t\t\t\tbreak;\n\t\t\t}\n\tprintf(\"%d\\n\", cnt);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i<T;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n if(T==1&&ara[0]<16)\n {\n printf(\"%d\\n\",ara[0]+15);\n c=2;\n }\n else if(ara[0]>15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i<T;i++)\n {\n if(i==T-1)\n ara[i+1]=90;\n if(ara[i+1]-ara[i]>15)\n {\n printf(\"%d\\n\",ara[i]+15);\n c=0;\n break;\n }\n }\n }\n if(c==1)\n printf(\"90\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int i,sum=0,n;\n scanf(\"%I64d\",&n);\n long long int a[n];\n for(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\n if(a[0]>15)\n {\n printf(\"15\\n\");\n return 0;\n }\n for(i=0;i<=n-1;i++)\n {\n if(a[i+1]-a[i]<=15)\n sum=a[i];\n else\n {\n sum=a[i];\n break;\n }\n\n }\n\n sum+=15;\n if(sum>=90)\n sum=90;\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n, curMin, min;\n\n scanf(\"%d\", &n);\n curMin = 15;\n while(n--){\n scanf(\"%d\", &min);\n if (min <= curMin){\n curMin = min + 15;\n continue;\n }\n }\n\n if (curMin > 90)\n curMin = 90;\n\n printf(\"%d\", curMin);\n\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,min=0,bear[100];\n\n scanf(\" %d\", &n);\n bear[0]=0;\n\n for(i=1;i<=n;i++)\n {\n scanf(\" %d\", &bear[i]);\n }\n\n for(i=0;i<n;i++)\n {\n if((bear[i+1]-bear[i])>15)\n {\n min += bear[i]+15;\n printf(\"%d\", min);\n break;\n }\n }\n if(min==0 && bear[n]<75)\n\t{\n\t\tmin = bear[n] + 15;\n\t\tprintf(\"%d\", min);\n\t}\n\tif (min == 0)\n\t\t{\n\t\t printf(\"%d\", 90);\n }\n\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d\", &n);\n\ta = 0;\n\twhile (n--) {\n\t\tscanf(\"%d\", &b);\n\t\tif (b - a > 15)\n\t\t\tbreak;\n\t\ta = b;\n\t}\n\tprintf(\"%d\\n\", a + 15 <= 90 ? a + 15 : 90);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int t=1;\n if((a[0]-t)>=15)\n {\n f=1;\n printf(\"15\");\n }else\n {t=a[0];\n for(int i=1;i<n;i++)\n {\n if(a[i]-t>15)\n {\n f=1;\n printf(\"%d\",t+15);\n break;\n }\n t=a[i];\n }\n }\n if(f==0)\n {\n int g=a[n-1]+15;\n if(g>90)\n printf(\"90\");\n else\n printf(\"%d\",g);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a,l,i,q;\n scanf(\"%d\",&a);\n int s[a];\n for(i=0;i<a;i++){\n scanf(\"%d\",&s[i]);\n }\n for(i=0;i<a;i++){\n if(s[0]>=16){\n printf(\"15\\n\");\n goto A;\n }\n else if((s[i+1]-s[i])>15){\n q=s[i]+15;\n if(q>90){\n printf(\"90\\n\");\n }\n else{\n printf(\"%d\\n\",q);\n }\n goto A;\n }\n }\n A:return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n\tint n,a[100],time;\n\tscanf(\"%d\",&n);\n\tfor(int i=0; i<n; i++){\n\t\tscanf(\" %d\",&a[i]);\n\t}\n\tint p=0;\n\tif(a[0]>=16){\n\t\tp++;\n\t\ttime=15;\n\t\tprintf(\"%d\\n\",time);\n\t\treturn 0;\n\t\t\n\t}\n\tfor(int i=0; i<n-1; i++){\n\t\t\tif((a[i+1]-a[i])>15){\n\t\t\t\tp++;\n\t\t\t\ttime=a[i]+15;\n\t\t\t\tprintf(\"%d\\n\",time);\n\t\t\t\treturn 0;\n\t\t\t}\n\t}\n\tif(p==0){\n\t\tif((90-a[n-1])>15){\n\t\t\ttime=a[n-1]+15;\n\t\t\tprintf(\"%d\\n\",time);\n\t\t}\n\t\telse{\n\t\ttime=90;\n\t\tprintf(\"%d\\n\",time);\n\t}\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{int tmin,i,j,arr[90],plus,count=0;\n scanf(\"%d\",&tmin);\n\n for (i=0;i<tmin;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n if (tmin!=1)\n {\n\n\n if (arr[0]>15)\n plus=0;\n else {\n for (j=0;j<tmin-1;j++)\n\n {if (arr[j+1]<=15+arr[j])\n count++;\n else\n {break;}\n\n }\n\n if (count!=tmin-1)\n {\n plus=arr[count];\n }\n else {if(arr[tmin-1]>=75)\n plus=75;\n else plus=arr[tmin-1];\n }\n }\n printf(\"%d\",plus+15);}\n else {if(arr[0]>15){\n plus=15;}\n else plus=15+arr[0];\n printf(\"%d\",plus);\n}}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int array[10000],i,n,time,t;\n scanf(\"%d\",&n);\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&array[i]);\n }\n if(n==1&&array[0]<15)\n printf(\"%d\",array[0]+15);\n else if(array[0]>15)\n printf(\"15\");\n\n else\n {\n for(i=0; i<n; i++)\n {\n t=array[i];\n if(array[i+1]-array[i]>15)\n {\n break;\n }\n }\n if(t+15<=90)\n printf(\"%d\",(t+15));\n else\n printf(\"90\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a=0;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n for(i=0;i<n;i++)\n {\n if(t[i]-a<=15) a=t[i];\n else break;\n }\n if(90-a<=15){\n a=90;\n }\n else a=a+15;\n \n \n printf(\"%d\",a);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n\nint main()\n{\n int n, i, t, a, b = 0;\n\n scanf(\"%d\", &n);\n\n for(i = 0; i < n; i++) {\n scanf(\"%d\", &t);\n a = t;\n if(a - b > 15) {\n printf(\"%d\\n\", b + 15);\n return 0;\n }\n else b = t;\n }\n if(b >= 75) printf(\"90\\n\");\n else printf(\"%d\\n\", b + 15);\n\n\n\n return 0;\n}\n"}, {"source_code": "/* https://codeforces.com/contest/673/submission/19410860 (Dukkha) */\n#include <stdio.h>\n\nint main() {\n\tint n, a, b;\n\n\tscanf(\"%d\", &n);\n\ta = 0;\n\twhile (n--) {\n\t\tscanf(\"%d\", &b);\n\t\tif (b - a > 15)\n\t\t\tbreak;\n\t\ta = b;\n\t}\n\tprintf(\"%d\\n\", a + 15 <= 90 ? a + 15 : 90);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint a, b, t = 0;\n\tscanf(\"%d\\n\", &a);\n\n\tfor (int i = 0; i < a; ++i) {\n\t\tscanf(\"%d\", &b);\n\t\tif (b - t > 15) {\n\t\t\tt += 15;\n\t\t\tbreak;\n\t\t}\n\t\tt = b;\n\t}\n\n\tif (b != 90 && b == t) {\n\t\tif (90 - t > 15) {\n\t\t\tt += 15;\n\t\t} else {\n\t\t\tt = 90;\n\t\t}\n\t}\n\n\tprintf(\"%d\\n\", t);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n\n int array[n];\n int i;\n for(i=0; i<n; i++)\n {\n scanf(\"%d\",&array[i]);\n }\n int a=0;\n for(i=0; i<n; i++)\n {\n if((i==0)&&(i+1)!=n)\n {\n if((array[i])>15)\n {\n\n a=15;\n break;\n }\n }\n if((i==0)&&(i+1)==n)\n {\n if((array[i])>15)\n {\n\n a=15;\n break;\n }\n else {\n a=array[i]+15;\n break;\n }\n\n }\n\n if((i+1)==n)\n {\n if((90-array[i])>15)\n a=array[i]+15;\n else a=90;\n break;\n }\n else if((array[i+1]-array[i])>15)\n {\n a=array[i]+15;\n break;\n }\n\n }\n printf(\"%d\\n\",a);\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n c=0;\n for(i=0;i<n;i++){\n if(a[i]-c<=15){c=a[i];}\n else break;\n }\n if(c+15>90)printf(\"90\");\n else printf(\"%d\",c+15);\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\nmain (int argc, char *argv[])\n{\n\tint i,n,watch=15;\n\tscanf(\"%d\",&n);\n\tint time[n];\n\tfor (i = 0; i < n; i += 1)\n\t\tscanf(\"%d\",&time[i]);\n\tfor (i = 0; i < n; i += 1)\n\t{\n\t\tif(time[i]<=watch)\n\t\t\twatch=time[i]+15;\n\t\telse\n\t\t\tbreak;\n\t}\n\tif(watch>90)\n\t\twatch=90;\n\tprintf(\"%d \\n\", watch);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <conio.h>\nint main ()\n{int n,i,sum=0,j,ok=0;\nscanf (\"%d\",&n);\nint t [100];\nfor (i=0;i <n;i++)\nscanf (\"%d\",&t [i]);\nif (t [0]>15)\n{sum=15;\nok=1;}\nif (t [0]<=15)\n{sum=t [0];\nif (n==1)\nsum+=15;\n}\nif (ok==0)\n{for (i=1;i <n;i++)\n{if (t[i]-t [i-1]<=15)\n{\n\tsum+=t [i]-t [i-1];\n\tif (t [i]==t [n-1]&&t [i]<=75)\nsum+=15;\nelse\nif (t [i]==t [n-1])\nsum+=90-t [i];\n}\t\nelse\t\n\t{sum+=15;\nbreak;}\n}}\n\nprintf (\"\\n%d\",sum);\t\t\t\nreturn 0;\t\n}"}, {"source_code": "#include <stdio.h>\n\nint main(){\n\tint n, v[95],i,x;\n\tscanf(\"%d\",&n);\n\tv[0]=0;\n\tv[n+1]=90;\n\tfor(i=1;i<=n;i++)\n\t\tscanf(\"%d\",v+i);\n\tif(n==0)\n\t{\n\t\tprintf(\"%d\\n\",15);\n\t\treturn 0;\n\t}\n\tfor(i=1;i<=n+1;i++){\n\t\tx=v[i]-v[i-1];\n\t\tif(x>15)\n\t\t{\n\t\t\tprintf(\"%d\\n\",v[i-1]+15);\n\t\t\treturn 0;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",90);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint n ;\n\t\tint i;\n\t\tint t=0, b=0,a = 0, c = 0,y;\n\t\tscanf(\"%d\",&n);\n\t\tfor (i=1; i<n+1; i++){\n\t\t\t scanf(\"%d\",&b);\n\t\t\t y=b-t;\n\t\t\t if (y>15){\n\t\t\t\t c= t+15; a=1;\n\t\t\t\t i= n+1;\n\t\t\t\t }\n\t\t\t t=b;\n\t\t}\n\t\tif(a==0){\n\t\t\tif(t<85 ) c= t+15;\n\t\telse c=90;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tif(c>90 ) c=90;\n\t\tprintf(\"%d\",c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\tint time=90;\n\tint N;\n\tscanf(\"%d\",&N);\n\tint A[N];\n\tint i;\n\tfor(i=0;i<N;i++)\n\t{\tscanf(\"%d\",&A[i]);\n\t}\n\tint diff[N+1];\n\n\tdiff[0]=A[0];\n\tfor(i=1;i<N;i++)\n\t{\tdiff[i]=A[i]-A[i-1];\n\t}\n\tdiff[N]=90-A[N-1];\n\n\tfor(i=0;i<N+1;i++)\n\t{\t//printf(\"%d\\n\",diff[i]);\n\t\tif(diff[i]>15)\n\t\t{\tif(i==0)\n\t\t\t\ttime=15;\n\t\t\telse time=A[i-1]+15;\n\t\t\tbreak;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\\n\",time);\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\n/* run this program using the console pauser or add your own getch, system(\"pause\") or input loop */\n\nint main(int argc, char *argv[]) {\n\tint n ;\n\t\tint i;\n\t\tint t=0, b=0,a = 0, c = 0,y;\n\t\tscanf(\"%d\",&n);\n\t\tfor (i=1; i<n+1; i++){\n\t\t\t scanf(\"%d\",&b);\n\t\t\t y=b-t;\n\t\t\t if (y>15){\n\t\t\t\t c= t+15; a=1;\n\t\t\t\t i= n+1;\n\t\t\t\t }\n\t\t\t t=b;\n\t\t}\n\t\tif(a==0){\n\t\t\tif(t<85 ) c= t+15;\n\t\telse c=90;\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tif(c>90 ) c=90;\n\t\tprintf(\"%d\",c);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define Max 100\nint main()\n{\n\tint n,a[Max],s=0,i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\ti=0;\n\twhile(a[i]-s<=15 && i<n)\n\t{\n\t\ts=a[i];\n\t\ti++;\n\t}\n\tif(s+15>90)\n\t\tprintf(\"%d\\n\",90);\n\telse\n\t\tprintf(\"%d\\n\",s+15);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int test;\n while(scanf(\"%d\",&test)==1)\n {\n int a[1000],i,b,c;\n b=15;\n for( i=0; i<test; i++)\n scanf(\"%d\",&a[i]);\n for( i=0; i<test; i++)\n {\n c=a[i];\n if(c>b)\n {\n printf(\"%d\\n\",b);\n break;\n }\n else if(c>=75||b>90)\n {\n printf(\"90\\n\");\n break;\n }\n else if(i==test-1)\n {\n printf(\"%d\\n\",a[test-1]+15);\n }\n else\n {\n b=a[i]+15;\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,a=0;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n for(i=0;i<n;i++)\n {\n if(t[i]-a<=15) a=t[i];\n else break;\n }\n if(90-a<=15) a=90;\n else a=a+15;\n printf(\"%d\",a);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N, i;\n int A[91];\n scanf(\"%d\", &N);\n for(i = 1; i <= N; ++i) {\n scanf(\"%d\", &A[i]);\n }\n A[0] = 0;\n for(i = 1; i <= N; ++i) {\n if(A[i] - A[i - 1] > 15) {\n printf(\"%d\\n\", A[i - 1] + 15);\n return 0;\n }\n }\n printf(\"%d\\n\", A[N] + 15 > 90 ? 90 : A[N] + 15);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint i, n, a, a_;\n\n\tscanf(\"%d\", &n);\n\ta_ = 0;\n\tfor (i = 0; i < n; i++) {\n\t\tscanf(\"%d\", &a);\n\t\tif (a - a_ > 15)\n\t\t\tbreak;\n\t\ta_ = a;\n\t}\n\tprintf(\"%d\\n\", a_ + 15 <= 90 ? a_ + 15 : 90);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint n, i, s[90], result, time, flag;\n\nint main()\n{\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++)\n scanf(\"%d\", &s[i]);\n\n result = 0;\n flag = 0;\n time = 0;\n i = 0;\n \n while (flag != 1)\n {\n if ((time+1) != s[i])\n {\n result++;\n }\n else\n {\n result = 0;\n i++;\n }\n if (result == 15) {\n flag = 1;\n }\n time++;\n if (time == 90)\n {\n flag = 1;\n }\n }\n\n\n printf(\"%d\", time);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main () {\n int n,dem,kq=0;\n int a[100];\n scanf(\"%d\",&n);\n for(int i=1;i<=n;i++) {\n scanf(\"%d\",&a[i]);\n if(a[i]-kq>15) {\n kq+=15;\n break;\n }\n else\n kq=a[i];\n if(i==n&&kq==a[n]&&kq<90) {\n if(kq+15<=90)\n kq+=15;\n else\n kq=90;\n }\n }\n if(kq<=15&&a[1]<=15)\n printf(\"%d\",kq+15);\n else\n printf(\"%d\",kq);\n}\n"}, {"source_code": "/*******************************************************************************\\\n|*********S*** ****** ************* ************* ************** * ******|\n|*********** ******** ************ ************ *********** ** ******|\n|********* ********** *********** *** *********** * ********* *** ******|\n|******** *********** *I******** **** ********** *** ***** ***** ******|\n|******** *********** ********* ****** ********* ***** ** ****** ******|\n|********** ********* ******** ***A**** ******** ******* ******** ******|\n|*********** ******** ******* ********** ******* ***************** ******|\n|********** ********* ****** ************ ****** ***************** ******|\n|******** *********** ***** ************** ***** ********M******** ******|\n|***** ************** **** **************** **** ***************** ******|\n|*******************************************************************************|\n|**************BSMRSTU********************************CSE***********************|\n\\*******************************************************************************/\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<conio.h>\n#define byebye return 0\nint main()\n{\n int n, i, sum=0, b=0;\n scanf(\"%d\",&n);\n int a[n+1];\n for(i=1; i<n+1; i++)\n scanf(\"%d\",&a[i]);\n a[0]=0;\n a[n+1]=90;\n for(i=1; i<=n+1; i++)\n {\n b=a[i-1];\n if(a[i]-a[i-1]>15)\n {\n sum=b+15;\n break;\n }\n }\n if(sum==0){\n printf(\"90\");\n }\n else\n printf(\"%d\",sum);\n byebye;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <math.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <conio.h>\nint main ()\n{int n,i,sum=0,j,ok=0;\nscanf (\"%d\",&n);\nint t [100];\nfor (i=0;i <n;i++)\nscanf (\"%d\",&t [i]);\nif (t [0]>15)\n{sum=15;\nok=1;}\nif (t [0]<=15)\n{sum=t [0];\nif (n==1)\nsum+=15;\n}\nif (ok==0)\n{for (i=1;i <n;i++)\n{if (t[i]-t [i-1]<=15)\n{\n\tsum+=t [i]-t [i-1];\n\tif (t [i]==t [n-1]&&t [i]<=75)\nsum+=15;\nelse\nif (t [i]==t [n-1])\nsum+=90-t [i];\n}\t\nelse\t\n\t{sum+=15;\nbreak;}\n}}\n\nprintf (\"\\n%d\",sum);\t\t\t\nreturn 0;\t\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n, i, sum;\n\tscanf(\"%d\", &n);\n\tint ara[n+1];\n\tara[0] = 0;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d\", &ara[i]);\n\t}\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\t\n\t\tif(ara[i] - ara[i - 1] > 15)\n\t\t{\n\t\t\tsum = ara[i-1] + 15;\n\t\t\tbreak;\n\t\t}\n\t\telse if((i==n) && ara[i] - ara[i - 1] <= 15 )\n\t\t{\n\t\t\tsum = ara[i] + 15;\n\t\t\tif(sum>90) sum = 90;\n\t\t\t\n\t\t} \n\t\telse sum = ara[i];\n\t}\n\t\n\t printf(\"%d\", sum);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,a[92],j=1;\n int m;\n int n;\n scanf(\"%d\",&n);\n i=0;\n j=0;\n while(i<n) {scanf(\"%d\",&a[i]);i++;}\n if(n==1) {if(a[0]<16) printf(\"%d\",a[0]+15); else printf(\"%d\",15); return 0;}\n for(i=0;i<n;i++)\n {\n m=a[i]-j;\n if(m>15)\n {printf(\"%d\",j+15); return 0;}\n j=a[i];\n }\n if((90-a[n-1])>15){ printf(\"%d\",a[n-1]+15); return 0;}\n printf(\"90\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\nint n,i=0,flag=0;\nscanf(\"%i\",&n);\n\nint arr[n];\nwhile(n>i){\n scanf(\"%i\",&arr[i]);\n i++;\n}\n\ni=0;\n if(arr[0]<=15){\n\n while((n-1)>i){\n if(((arr[i+1])-(arr[i]))>15){\n printf(\"%i\",arr[i]+15);\n flag=1;\n break;\n }\n i++;\n }\n if(flag==0){\n if((90-(arr[n-1]))>15){\n printf(\"%i\",arr[n-1]+15);\n }\n else{\n printf(\"90\");\n }\n }\n \n \n }\n else{\n printf(\"15\");\n }\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,m,i;\n\tscanf(\"%d\",&n);\n\tint ary[n+2];\n\tary[0]=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&ary[i]);\n\t}\n\tary[i]=90;\n\tm=90;\n\tfor(i=0;i<=n;i++)\n\t{\n\t\tif(ary[i]+15<ary[i+1]){\n\t\t\n\t\tm=ary[i]+15;\n\t\tbreak;}\n\t}\n\t\n\nprintf(\"%d\",m);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,t,i,j,k=0,s[90],p=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&s[i]); \n }\n for(i=1;i<90;i++)\n {\n for(j=0;j<n;j++)\n {\n if(s[j]==i)\n {\n p=0;\n }\n else\n k=k+1;\n }\n if(k==n)\n p=p+1;\n k=0;\n if(p==15)\n break;\n }\n \n printf(\"%d\",i);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n long long int i,sum=0,n;\n scanf(\"%I64d\",&n);\n long long int a[n];\n for(i=0;i<n;i++)\n scanf(\"%I64d\",&a[i]);\n if(a[0]>15)\n {\n printf(\"15\\n\");\n return 0;\n }\n for(i=0;i<=n-1;i++)\n {\n if(a[i+1]-a[i]<=15)\n sum=a[i];\n else\n {\n sum=a[i];\n break;\n }\n\n }\n\n sum+=15;\n if(sum>=90)\n sum=90;\n printf(\"%I64d\\n\",sum);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,j,k=0,n;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i<n;i++) scanf(\"%d\",&ar[i]);\n if(ar[0]>15) k=15;\n else\n {\n for(i=0;i<n-1;i++)\n {\n if(ar[i+1]-ar[i]>15)\n {\n k=ar[i]+15;\n if(k>90)\n k=90;\n break;\n }\n }\n if(k==0)\n {\n k= ar[i]+15;\n if(k>90) k=90;\n }\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,t[90],i,time,j,u;\nscanf(\"%d\",&n);\nfor(i=1;i<=n;i++)\nscanf(\"%d\",&t[i]);\nt[n+1]=90;\nif(t[1]>15)\ntime=15;\nelse\n{\nfor(i=1;i<=n;i++)\n{\nu=t[i+1]-t[i];\ntime=t[i];\nif(u<16)\n{time=t[i+1];\n}\nelse\n{time=time+15;\nbreak;}\n}\n}\nprintf(\"%d\",time);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n\n int ans=15,x=0;\n\n if(n==1)\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n printf(\"%d\",ans+a[0]);\n }\n else\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n {\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n x=1;\n ans=a[i-1]+15;\n printf(\"%d\",ans);\n break;\n }\n }\n if(x==0)\n {\n if(90-a[n-1]>15)\n printf(\"%d\",a[n-1]+15);\n else\n printf(\"90\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{int tmin,i,j,arr[90],plus,count=0;\n scanf(\"%d\",&tmin);\n\n for (i=0;i<tmin;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n if (tmin!=1)\n {\n\n\n if (arr[0]>15)\n plus=0;\n else {\n for (j=0;j<tmin-1;j++)\n\n {if (arr[j+1]<=15+arr[j])\n count++;\n else\n {break;}\n\n }\n\n if (count!=tmin-1)\n {\n plus=arr[count];\n }\n else {if(arr[tmin-1]>=75)\n plus=75;\n else plus=arr[tmin-1];\n }\n }\n printf(\"%d\",plus+15);}\n else {if(arr[0]>15){\n plus=15;}\n else plus=15+arr[0];\n printf(\"%d\",plus);\n}}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n int n;\n scanf(\"%d\", &n);\n int a[n];\n for(int i = 0; i < n; i++) {\n scanf(\"%d\", &a[i]);\n }\n if(a[0] > 15) {\n printf(\"%d\\n\", 15);\n return 0;\n }\n for(int i = 0; i < n-1; i++) {\n if(a[i+1] - a[i] > 15) {\n printf(\"%d\\n\", a[i]+15);\n return 0;\n }\n }\n if(a[n-1] + 15 > 90) {\n printf(\"%d\\n\", 90);\n }\n else {\n printf(\"%d\\n\", a[n-1]+15);\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n,i,min=0,bear[100];\n\n scanf(\" %d\", &n);\n bear[0]=0;\n\n for(i=1;i<=n;i++)\n {\n scanf(\" %d\", &bear[i]);\n }\n\n for(i=0;i<n;i++)\n {\n if((bear[i+1]-bear[i])>15)\n {\n min += bear[i]+15;\n printf(\"%d\", min);\n break;\n }\n }\n if(min==0 && bear[n]<75)\n\t{\n\t\tmin = bear[n] + 15;\n\t\tprintf(\"%d\", min);\n\t}\n\tif (min == 0)\n\t\t{\n\t\t printf(\"%d\", 90);\n }\n\n printf(\"\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,A[n];\n int countn=1;\n for(i=0;i<n;i++)\n scanf(\"%d\",&A[i]);\n if(n==1)\n {\n if(A[0]>15)\n printf(\"15\");\n else\n printf(\"%d\",A[0]+15);\n return 0;\n }\n if(A[0]>15)\n printf(\"15\");\n else\n for(i=0;i<n-1;i++)\n {\n if(A[i+1]-A[i]<=15)\n {\n countn++;\n continue;\n }\n\n if(A[i]<76)\n {\n printf(\"%d\",A[i]+15);\n break;\n }\n else\n {\n printf(\"90\");\n break;\n }\n }\n if(countn==n)\n {\n if(A[i]<76)\n printf(\"%d\",A[i]+15);\n else\n printf(\"90\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(n==1)\n {\n if(a[0]>15)\n printf(\"%d\\n\",15);\n else\n printf(\"%d\\n\",a[0]+15);\n\n }\n else if(n>1)\n {\n if(a[0]>15)\n printf(\"%d\\n\",15);\n\n else\n {\n for(i=0;i+1<n;i++)\n {\n c=a[i]+15;\n if(c>=a[i+1])\n {\n c=a[i+1]+15;\n if(c>=90)\n {\n c=90;\n break;\n }}\n\n else if(c<a[i+1])\n break;\n\n }\n printf(\"%d\\n\",c);\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n if(n==1){\n if(a[0]>15){\n printf(\"15\\n\");\n return 0;\n }\n else{\n printf(\"%d\",a[0]+15);\n return 0;\n }\n\n }\n\n if(a[n-1]==90){\n if(a[0]>15){\n printf(\"15\\n\");\n return 0;\n }\n\n for(i=0;i<n-1;i++)\n {\n if(a[i+1]-a[i]>15){\n printf(\"%d\",a[i]+15);\n return 0;\n }\n }\n printf(\"90\");\n return 0;\n }\n\n\n\n\n else{\n if(a[0]>15){\n printf(\"15\");\n return 0;\n }\n for(i=0;i<n-1;i++)\n {\n if(a[i+1]-a[i]>15){\n printf(\"%d\",a[i]+15);\n return 0;\n }\n }\n if(a[n-1]<=75){\n printf(\"%d\",a[n-1]+15);\n return 0;\n }\n else{\n printf(\"90\");\n return 0;\n }\n\n\n\n\n }\n\n return 0;\n\n\n\n\n\n\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,k[99],n;\n scanf(\"%d\", &n);\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &k[i]);\n }\n if(k[0]>15)\n {\n printf(\"%d\\n\", 15);\n return 0;\n }\n else {\n for (i=1; i<n ; i++)\n {\n if(k[i]-k[i-1]>15)\n {\n printf(\"%d\\n\",k[i-1]+15);\n return 0;\n }\n }\n }\n if(k[n-1]+15 < 90) printf(\"%d\\n\",k[n-1]+15);\n else printf(\"%d\\n\", 90);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,s=0,i,k;\n scanf(\"%d\",&n);\n int A[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for(i=0;i<n;i++)\n {\n if(A[i]<=s+15)\n {\n s=A[i];\n }\n else\n {\n break;\n }\n }\n if(s+15>90)\n {\n s=75;\n }\n printf(\"%d\\n\",s+15);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main(){\n\nint n,i=0,flag=0;\nscanf(\"%i\",&n);\n\nint arr[n];\nwhile(n>i){\n scanf(\"%i\",&arr[i]);\n i++;\n}\n\ni=0;\n if(arr[0]<=15){\n\n while((n-1)>i){\n if(((arr[i+1])-(arr[i]))>15){\n printf(\"%i\",arr[i]+15);\n flag=1;\n break;\n }\n i++;\n }\n if(flag==0){\n if((90-(arr[n-1]))>15){\n printf(\"%i\",arr[n-1]+15);\n }\n else{\n printf(\"90\");\n }\n }\n }\n else{\n printf(\"15\");\n }\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tint mins[n];\n\tfor(int o=0;o<n;o++)\n\t{\n\t\tscanf(\"%d\",&mins[o]);\n\t}\n\tint count=0;\n\tif(n==1)\n\t{\n\t\tif(mins[0]<=15)\n\t\t{\n\t\tprintf(\"%d\",mins[0]+15);\n\t\texit(0);\t\n\t\t}\n\t\telse printf(\"15\");\n\texit(0);\n\t}\n\t\tif(mins[0]>15)\n\t\t{\n\t\t\tprintf(\"15\");\n\t\t\texit(0);\n\t\t\t\n\t\t}\n\t\t else count+=mins[0];\n\tfor(int p=0;p<n-1;p++)\n\t{\n\t\n\t\tif(mins[p+1]-mins[p]<=15)\n\t\t{\n\t\t\tcount+=mins[p+1]-mins[p];\n\t\t\n\t\t}\n\t\telse {\n\t\t\tprintf(\"%d\",count+15);\n\t\t\texit(0);\n\t\t}\n\t\t\n\t\t\n\t}\n\tif(90-mins[n-1]<=15)\n\t{\n\t\tcount+=90-mins[n-1];\n\t\tprintf(\"%d\",count);\n\t}\n\telse\n\t{\n\t\tif(90-mins[n-1]>15)\n\t\t\n\tprintf(\"%d\",count+15);\t\n\t } \n\t\n\t\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&time[i]);\n\t}\n\t\n\tint pre=0,tot=0;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tif ((time[i]-pre)<=15)\n\t\t{\n\t\t\ttot = time[i];\n\t\t\tpre = time[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (90-tot<=15)\n\t{\n\t\ttot = 90;\n\t}\n\telse\n\t{\n\t\ttot+=15;\n\t}\n\n\tprintf(\"%d\\n\",tot);\n\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,cnt=0,f=0;\n scanf(\"%d\",&n);\n int ar[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\n if(n==1)\n {\n if(ar[0]>15)\n printf(\"%d\",15);\n else\n printf(\"%d\",ar[0]+15);\n }\n else\n {\n if(ar[0]>15)\n printf(\"%d\",15);\n else\n {\n cnt=ar[0];\n for(int i=0;i<n-1;i++)\n {\n if(ar[i+1]-ar[i]>15)\n {\n cnt+=15;\n f=1;\n break;\n }\n else\n cnt=ar[i+1];\n }\n if(f==0)\n {\n if(90-ar[n-1]<=15)\n cnt=90;\n else\n cnt+=15;\n }\n printf(\"%d\",cnt);\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,t[95],i;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n t[0]=0;\n for(i=1;i<=n;i++)\n {\n if(t[i]-t[i-1]>15)\n {\n printf(\"%d\",t[i-1]+15);\n return 0;\n }\n }\n if(t[n]+15<90)\n {\n printf(\"%d\",t[n]+15);\n }\n else\n {\n printf(\"90\");\n }\n \n \n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n\n int ans=15,x=0;\n\n if(n==1)\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n printf(\"%d\",ans+a[0]);\n }\n else\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n {\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n x=1;\n ans=a[i-1]+15;\n printf(\"%d\",ans);\n break;\n }\n }\n if(x==0)\n {\n if(90-a[n-1]>15)\n printf(\"%d\",a[n-1]+15);\n else\n printf(\"90\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[100000],i,j,x=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n a[0]=0;\n for(i=1;i<=n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n printf(\"%d\",a[i-1]+15);\n return 0;\n }\n else x=a[i]+15;\n }\n if(x>=90)printf(\"90\");\n else printf(\"%d\",x);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\", &n);\n int arr[n+1];\n arr[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n int sum=0,x=0;\n for (i=1;i<=n;i++)\n {\n if((arr[i]-arr[i-1])>15)\n {\n sum=arr[i-1]+15;\n x=1;\n break;\n }\n else\n {\n sum=arr[i];\n }\n\n }\n if(x==0)\n {\n sum=sum+15;\n if(sum>90)\n {\n sum=90;\n }\n }\n\n printf(\"%d\\n\", sum);\n return 0;\n\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n,t,i,j,k=0,s[90],p=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&s[i]); \n }\n for(i=1;i<90;i++)\n {\n for(j=0;j<n;j++)\n {\n if(s[j]==i)\n {\n p=0;\n }\n else\n k=k+1;\n }\n if(k==n)\n p=p+1;\n k=0;\n if(p==15)\n break;\n }\n \n printf(\"%d\",i);\n \n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a[100],c,i,flag=0,b[100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tb[i]=a[i+1]-a[i];\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(b[i]<15)\n\t\t{\n\t\t\tflag=0;\n\t\t}\n\t\tif(b[i]>15)\n\t\t{\n\t\t\tflag=1;\n\t\t\tc=i;\n\t\t\tgoto temp;\n\t\t}\n\t}\n\ttemp:\n\tif(flag==1 && a[0]<=15)\n\t{\n\t\tprintf(\"%d\\n\",a[c]+15);\n\t}\n\tif(flag==0 && (90-a[n-1]>15) && a[0]<=15)\n\t{\n\t\tprintf(\"%d\\n\",a[n-1]+15);\n\t}\n\tif((90-a[n-1])<=15 && a[0]<=15 && flag==0)\n\t{\n\t\tprintf(\"90\\n\");\n\t}\n\tif(a[0]>15)\n\t{\n\t\tprintf(\"15\\n\");\n\t}\n\treturn 0;\n\t}"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\tint n, res = 0;\n\tscanf(\"%d\", &n);\n\t\n\tint current, last = 0;\n\tfor (int i = 0; i < n; i++) {\n\t\tscanf(\"%d\", ¤t);\n\t\tif (current - last > 15) {\n\t\t\tprintf(\"%d\", last + 15);\n\t\t\treturn 0;\n\t\t}\n\t\tlast = current;\n\t}\n\t\n\tif (last > 75)\n\t\tprintf(\"%d\", 90);\n\telse\n\t\tprintf(\"%d\", last + 15);\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint n, i, s[90], result, time, flag;\n\nint main()\n{\n scanf(\"%d\", &n);\n\n for (i = 0; i < n; i++)\n scanf(\"%d\", &s[i]);\n\n result = 0;\n flag = 0;\n time = 0;\n i = 0;\n \n while (flag != 1)\n {\n if ((time+1) != s[i])\n {\n result++;\n }\n else\n {\n result = 0;\n i++;\n }\n if (result == 15) {\n flag = 1;\n }\n time++;\n if (time == 90)\n {\n flag = 1;\n }\n }\n\n\n printf(\"%d\", time);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,i,s;\n i=0;\n scanf(\"%d\",&n);\n int a[90]={};\n while(i<n)\n {\n scanf(\"%d\",&a[i]);\n i=i+1;\n }\n i=0;\n while(i<n)\n {\n if(a[0]>=16)\n {\n s=15;\n }\n else if(a[i]+15<=90)\n {\n s=a[i]+15;\n }\n else\n {\n s=90;\n }\n\n if(a[i+1]-a[i]<=15 && a[0]<=15)\n {\n i=i+1;\n }\n else\n {\n break;\n }\n }\n printf(\"%d\",s);\n\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,a,i,d,p=0,s=0;\n\tscanf(\"%d\",&n);\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a);\n\t\td=a-p;\n\t\tif(d<=15)\n\t\t{\n\t\t\tif (i==n)\n\t\t\t{\n\t\t\tif((s+d+15)>90)s=90;\n\t\t\telse s=s+d+15;\n\t\t\t}\n\t\t\telse\n\t\t\ts=s+d;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts=s+15;\n\t\t\tbreak;\n\t\t}\n\t\tp=a;\n\t}\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i , n , a = 0 ;\n scanf(\"%d\",&n);\n int t[n];\n for(i = 0 ; i < n ; i++)\n {\n scanf(\"%d\",&t[i]);\n }\n for(i = 0 ; i < n ; i++)\n {\n if(t[i] - a <= 15)\n {\n a = t[i] ;\n }\n else break ;\n }\n if(90-a <= 15)a = 90 ;\n else a = a + 15 ;\n printf(\"%d\",a);\n return 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint n,i,s,test=0;\nscanf(\"%d\",&n);\nint ar[n];\nfor(i=0;i<n;i++)\n scanf(\"%d\",&ar[i]);\nif(n==1){\n if(ar[0]<=15)\n printf(\"%d\",ar[0]+15);\nelse\n printf(\"15\");\n return 0;\n}\nelse {\n if(ar[0]<=15){\nfor(i=0;i<n-1;i++){\n if(ar[i+1]-ar[i]<=15){\n s=ar[i+1];\n if(ar[i+1]<=75)\n s+=15;\nelse\n s=90;}\n else{\n s=ar[i]+15;\n break;\n }}\nprintf(\"%d\",s);\nreturn 0;}\nelse\n{printf(\"15\");\nreturn 0;}\n}\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n unsigned int n, T[90], kq= 15, i;\n T[0]=0;\n scanf(\"%u\",&n);\n for (i=1; i<=n; i++) {\n scanf(\"%u\",&T[i]);\n if (T[i]-T[i-1]>15) { break; }\n kq = 15 +T[i];\n }\n if (kq<=90) { printf(\"%u\",kq); }\n else { printf(\"90\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n,i,s=15;\n\tscanf(\"%d\",&n);\n\tint a[n];\n\t\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(s-a[i]<0)\n\t\t\tbreak;\n\t\telse\n\t\t\ts=a[i]+15;\t\n\t}\n\tif(s>90)\n\tprintf(\"90\");\n\telse\n\tprintf(\"%d\",s);\t\t\n}\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint min,i,j;\n\tscanf(\"%d\",&min);\n\tint a[min+1];\n\tfor(j=0;j<min;j++)\n\t{\n\t scanf(\"%d\",&a[j]);\n\t}\n\ta[min]=120;\n\tif(a[0]<=15)\n\t{\n\tfor(i=0;i<min;i++)\n\t{\n\t if(a[i+1]-a[i]>15)\n\t {\n\t if((a[i]+15)>90)\n\t {\n\t printf(\"90\");\n\t }\n\t else\n\t {\n\t printf(\"%d\",(a[i]+15));\n\t }\n\t i=min;\n\t }\n\t}\n\t}\n\telse\n\t{\n\t printf(\"15\");\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint c=0,i,j,n;\nscanf(\"%d\",&n);\nint t[n];\nfor(i=0;i<n;i++)\n{\nscanf(\"%d\",&t[i]);\n}\nif(t[0]>=16)\n{printf(\"15\");c=1;}\n//else if(t[n-1]<75)\n//{printf(\"%d\",t[n-1]+15);c=1;}\nelse\n{\nfor(i=1;i<n;i++)\n{\nif(t[i]-t[i-1]>15)\n{printf(\"%d\",t[i-1]+15);c=1;break;}\n}\nif(c==0)\n{\nif(t[n-1]<75)\n{printf(\"%d\",t[n-1]+15);c=1;}\n}\n//for(i=1;i<=t[n-1];i++)\n//{\n}\nif(c==0)\nprintf(\"90\");\n\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int i,n,ans=0;\n\n scanf(\"%d\",&n);\n int a[91];\n\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n\n }\n\n int t=0;\n int t2=0;\n for(i=0;i<n;i++){\n\n if(a[i]-t>15){\n ans=ans+15;\n t2=1;\n break;\n\n }\n else{\n ans=ans+(a[i]-t);\n }\n t=a[i];\n\n }\n if(i==n && t2==0){\n if(t<75){\n ans=t+15;\n }\n else{\n ans=90;\n }\n\n }\n\n printf(\"%d\",ans);\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, a[90], i, p;\n \n scanf(\"%d\", &n);\n for(i=0;i<n;i++)\n scanf(\"%d\", &a[i]);\n \n if(a[0]>15)\n p=0;\n else\n {\n p=a[0];\n for(i=1;i<n;i++)\n {\n p=p+15;\n if(p>=a[i])\n p=a[i];\n else\n p=p-15;\n } \n }\n p=p+15;\n if(p>90)\n printf(\"90\\n\");\n else\n printf(\"%d\\n\", p);\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#define Max 100\nint main()\n{\n\tint n,a[Max],s=0,i;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t\tscanf(\"%d\",&a[i]);\n\ti=0;\n\twhile(a[i]-s<=15 && i<n)\n\t{\n\t\ts=a[i];\n\t\ti++;\n\t}\n\tif(s+15>90)\n\t\tprintf(\"%d\\n\",90);\n\telse\n\t\tprintf(\"%d\\n\",s+15);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,a[92],j=1;\n int m;\n int n;\n scanf(\"%d\",&n);\n i=0;\n j=0;\n while(i<n) {scanf(\"%d\",&a[i]);i++;}\n if(n==1) {if(a[0]<16) printf(\"%d\",a[0]+15); else printf(\"%d\",15); return 0;}\n for(i=0;i<n;i++)\n {\n m=a[i]-j;\n if(m>15)\n {printf(\"%d\",j+15); return 0;}\n j=a[i];\n }\n if((90-a[n-1])>15){ printf(\"%d\",a[n-1]+15); return 0;}\n printf(\"90\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<math.h>\nint main()\n{\n int ara[100];\n int n,x=0,i;\n scanf(\"%d\",&n);\n ara[0]=0;\n for(i=1; i<=n; i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n for(i=0;i<n;i++)\n {\n\n if(ara[i+1]-ara[i]>15)\n {\n\n break;\n }\n\n\n }\n x=ara[i]+15;\n if(x>90)\n\n x=90;\n printf(\"%d\\n\",x);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\nint n,a[90];\nscanf(\"%d\",&n);\nint i;\nfor(i=0;i<n;i++){\nscanf(\"%d\",&a[i]);\n}\ni=0;\nint kar,count=0;\nfor(kar=1;kar<=90;kar++){\nif(kar == a[i]){count=0;i++;}\nelse count++;\nif (count == 15) {printf(\"%d\",kar); break;}\n}\nif(count<15) printf(\"90\");\nreturn 0;}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,s=0,i,k;\n scanf(\"%d\",&n);\n int A[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&A[i]);\n }\n for(i=0;i<n;i++)\n {\n if(A[i]<=s+15)\n {\n s=A[i];\n }\n else\n {\n break;\n }\n }\n if(s+15>90)\n {\n s=75;\n }\n printf(\"%d\\n\",s+15);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(n==1)\n {\n if(a[0]<16)\n\n printf(\"%d\\n\",a[0]+15);\n else\n printf(\"15\\n\");\n }\n else\n {\n int c=0,b[n];\n for(i=0;i<n;i++)\n {\n b[i]=a[i]-c;\n c=a[i];\n }\n int d=n-1;\n for(i=0;i<n;i++)\n {\n if(b[i]>15){\n d=i-1;\n break;\n }\n }\n if(d>=0){\n if(a[d]+15<=90)\n printf(\"%d\\n\",a[d]+15);\n else\n printf(\"90\\n\");\n }\n else\n printf(\"15\\n\");\n }\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<conio.h>\n\nmain(){\n\tint n,i,a[90];\n\t\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++) scanf(\"%d\",&a[i]);\n\t\n\n\tif (a[0]>15) printf(\"%d\",15);\n\telse{\n\tif (n==1) printf(\"%d\",a[0]+15);\n\telse\n\tfor(i=0;i<n-1;i++){\n\t\tif ((a[i]+15)<a[i+1]){\n\t\t\tif ((a[i]+15)<=90) printf(\"%d\",a[i]+15); else printf(\"%d\",90);\n\t\t\tbreak;\n\t\t} else if((i+1)==(n-1)){\n\t\t\t\tif ((a[i+1]+15)<90) printf(\"%d\",a[i+1]+15); else printf(\"%d\",90);\n\t\t\t}\n\t\t\n\t\t \n\t}\n\t}\n}"}], "negative_code": [{"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n unsigned int n, T[90], kq= 15, i;\n T[0]=0;\n scanf(\"%u\",&n);\n for (i=1; i<=n; i++) {\n scanf(\"%u\",&T[i]);\n if (T[i]-T[i-1]>15) { break; }\n kq = 15 +T[i];\n }\n printf(\"%u\",kq);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n\n int n,i,arr[100];\n\n scanf(\"%d\",&n);\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&arr[i]);\n }\n\n for(i=0;i<n-1;i++)\n {\n if(i==0&&arr[i]>15)\n {\n printf(\"15\");\n break;\n }\n else if((arr[i+1]-arr[i])>15)\n {\n printf(\"%d\",arr[i]+15);\n break;\n }\n else if(((arr[i])+15)>=90)\n {\n printf(\"90\");\n break;\n }\n }\n\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n;\n\n scanf(\"%d\",&n);\n\n int a[n],Loop,l=1,s,count=0,m;\n\n for(Loop=0;Loop<n;Loop++)\n scanf(\"%d\",&a[Loop]);\n\n m=a[0];\n\n for(Loop=0;Loop<n;Loop++)\n {\n s=m-l;\n\n if(s>15)\n {\n count++;\n Loop--;\n s=Loop;\n break;\n }\n else\n {\n l=a[Loop];\n m=a[Loop+1];\n }\n\n }\n\n if(count==0 && (a[n-1]+15)<90)\n printf(\"%d\\n\",a[n-1]+15);\n else if(count==0)\n printf(\"90\\n\");\n else if(Loop<0)\n printf(\"15\\n\");\n else\n {\n m=a[s]+15;\n printf(\"%d\\n\",m);\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&time[i]);\n\t}\n\t\n\tint pre=0,tot=0;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tif ((time[i]-pre)<=15)\n\t\t{\n\t\t\ttot = time[i];\n\t\t\tpre = time[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttot+=15;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (90-tot<=15)\n\t{\n\t\ttot = 90;\n\t}\n\telse\n\t{\n\t\ttot+=15;\n\t}\n\n\tprintf(\"%d\\n\",tot);\n\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0;\n\n scanf(\"%d\",&n);\n int t[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n\n if(n==1)\n {\n if(t[0]>15)\n {\n printf(\"15\");\n }\n else\n {\n printf(\"%d\",t[0]+15);\n }\n }\n\n else\n {\n t[-1]=0;\n t[n]=0;\n for(i=-1;i<n;i++)\n {\n if(abs(t[i+1]-t[i])>15)\n {\n printf(\"%d\",t[i]+15);\n }\n\n else\n {\n c++;\n }\n }\n\n if(c==n)\n printf(\"90\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,x,j,a[100];\n scanf(\"%d\",&n);\n\n for(i=0;i<n;i++)\n scanf(\"%d\",&a[i]);\n if(a[0]>15)\n printf(\"15\\n\");\n else\n {\n x=a[0];\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]<15)\n x=a[i];\n else\n {\n printf(\"%d\\n\",x+15);\n return 0;\n }\n }\n if(x>=75)\n printf(\"90\\n\");\n else\n printf(\"%d\\n\",x);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(a[0]>15)\n {\n printf(\"%d\\n\",15);}\n else\n {\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n c=a[i-1]+15;\n break;\n }\n else\n {\n c=a[i];\n if(a[i]+15>=0)\n c=90;\n }\n }\n printf(\"%d\\n\",c);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int i,j,k,n;\n scanf(\"%d\",&n);\n int ar[n];\n for(i=0;i<n;i++) scanf(\"%d\",&ar[i]);\n if(ar[0]>15) k=15;\n else \n {\n k=ar[0]+15;\n for(i=1;i<n;i++)\n {\n if(ar[i]-ar[i-1]>15)\n {\n k=ar[i-1]+15;\n break;\n }\n }\n if(i==n) k=90;\n }\n printf(\"%d\\n\",k);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n //printf(\"Hello World!\\n\");\n int n;\n scanf(\"%d\", &n);\n int i, arr[n], brr[n];\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &arr[i]);\n }\n brr[0]=arr[0];\n for(i=1; i<n; i++)\n {\n brr[i]=arr[i]-arr[i-1];\n }\n /*for(i=0; i<n; i++)\n {\n printf(\"%d \", brr[i]);\n }*/\n if(n==1)\n {\n if(arr[0]>15)\n {\n printf(\"15\");\n }\n else\n printf(\"%d\", arr[0]+15);\n }\n else{\n int count=0;\n for(i=0; i<n; i++)\n {\n if(brr[i]>15)\n {\n count=1;\n break;\n }\n }\n int sum=0;\n //printf(\"%d\\n\", count);\n if(count==1 && i==0)\n {\n printf(\"15\");\n }\n \n else if(count==1 && i!=0)\n {\n sum=arr[i-1]+15;\n if(sum>90)\n {\n printf(\"90\");\n }\n else\n printf(\"%d\", sum);\n }\n else if(count==0)\n {\n printf(\"90\");\n }\n }\n return 0; \n }\n \n \n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,a[100],i,c=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(a[0]>15)\n {\n printf(\"%d\\n\",15);}\n else\n {\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n c=a[i-1]+15;\n break;\n }\n else\n {\n c=a[i];\n if(a[i]+15>=0)\n c=90;\n }\n }\n printf(\"%d\\n\",c);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main(){\n int n, curMin, min;\n\n scanf(\"%d\", &n);\n curMin = 0;\n while(n--){\n scanf(\"%d\", &min);\n if (min-15 <= curMin){\n curMin = min;\n continue;\n }\n else {\n curMin = curMin + 15;\n break;\n }\n }\n\n printf(\"%d\", curMin);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n;\n scanf(\"%d\",&n);\n int i,A[n];\n int countn=1;\n for(i=0;i<n;i++)\n scanf(\"%d\",&A[i]);\n if(n==1)\n {\n if(A[0]>15)\n printf(\"15\");\n else\n printf(\"%d\",A[0]+15);\n return 0;\n }\n if(A[0]>15)\n printf(\"15\");\n for(i=0;i<n-1;i++)\n {\n if(A[i+1]-A[i]<=15)\n {\n countn++;\n continue;\n }\n\n if(A[i]<76)\n {\n printf(\"%d\",A[i]+15);\n break;\n }\n else\n {\n printf(\"90\");\n break;\n }\n }\n if(countn==n)\n {\n if(A[i]<76)\n printf(\"%d\",A[i]+15);\n else\n printf(\"90\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,m,sum=0;\n scanf(\"%d\",&n);\n int arr[n+1];\n for(i=0 ; i<n ; i++)\n {\n scanf(\"%d\",&m);\n if(m-sum>15)\n break;\n sum=m;\n }\n if(sum<=85)\n printf(\"%d\\n\",sum+15);\n else\n printf(\"90\\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n+1],c;\n a[0]=0;\n for(i=1;i<n+1;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int b[n];\n for(i=1;i<n+1;i++)\n {\n b[i]=a[i]-a[i-1];\n }\n for(i=0;i<n+1;i++)\n {\n if(b[i]>=15)\n c=i-1;\n }\n printf(\"%d\\n\",a[c]+15);\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,n,c=0;\n\n scanf(\"%d\",&n);\n\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n a[-1]=0;\n for(i=-1;i<n-1;i++)\n {\n if(a[i+1]-a[i]>15)\n {\n printf(\"%d\",a[i]+15);\n break;\n }\n else\n {\n c++;\n continue;\n }\n\n }\n\n if(c==n)\n printf(\"90\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n c=0;\n for(i=0;i<n;i++){\n if(n==1){c=15;break;}\n if(a[0]>15){c=15;break;}\n if(a[i+1]-a[i]<=15){c=1;}\n else break;\n }\n if(i!=0&&(a[i]+15*c)<=90)printf(\"%d\",a[i]+15*c);\n else if(n==1&&a[0]<=15)printf(\"%d\",a[0]+c);\n else if(i==0)printf(\"15\");\n else if((a[i]+15*c)>90)printf(\"90\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j,c=0;\n\n scanf(\"%d\",&n);\n int t[n];\n\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&t[i]);\n }\n\n if(n==1)\n {\n if(t[0]>15)\n {\n printf(\"15\");\n }\n else\n {\n printf(\"%d\",t[0]+15);\n }\n }\n\n else\n {\n t[-1]=0;\n t[n]=0;\n for(i=-1;i<n;i++)\n {\n if(abs(t[i+1]-t[i])>15)\n {\n printf(\"%d\",t[i]+15);\n }\n\n else\n {\n c++;\n }\n }\n\n if(c==n)\n printf(\"90\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<n;i++)\n {\n if(a[0]<=15)\n {\n if(a[i]-a[i-1]<15)\n s=a[i];\n }\n else s=0;\n }\n if(s+15>90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nmain()\n{\n int n,i;\n scanf(\"%d\",&n);\n int ara[n];\n\n for(i=0;i<n;i++) scanf(\"%d\",&ara[i]);\n\n if(ara[0]-0<=15) {\n for(i=1;i<n;i++) {\n if(ara[i]-ara[i-1]>15) {\n printf(\"%d\",ara[i-1]+15);\n return 0;\n }\n if(i==n-1) printf(\"%d\",ara[i]);\n }\n\n }\n\n else printf(\"15\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[1000],i,sum;\n while(scanf(\"%d\",&n)==1)\n {\n for(i=0; i<n; i++)\n scanf(\"%d\",&a[i]);\n if(a[0]<=15)\n {\n sum=a[0];\n for(i=1; i<n; i++)\n {\n if(a[i]-a[i-1]<=15)\n sum=a[i];\n else\n {\n if(sum<=75)\n sum+=15;\n else\n sum=90;\n break;\n }\n }\n if(sum<=75)\n sum+=15;\n else\n sum=90;\n }\n else\n sum=15;\n printf(\"%d\\n\",sum);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \nint main() {\n\tint n, a[100], i;\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tscanf(\"%d\", &n);\n\tfor (i = 1; i <= n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\ta[0] = 0;\n\tfor (i = 1; i < n; i++) {\n\t\tif (a[i] - a[i - 1] > 15)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\", a[i - 1] + 15);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, i,m, m1, m2;\n while(scanf(\"%d\", &n)!=EOF) {\n m1=0;\n m=0;\n for(i=1; i<=n; i++) {\n scanf(\"%d\", &m2);\n if(n==1 && m==0) m=m2+15;\n if(m2-m1 >15 && m==0)\n m=m1+15;\n else if(i==n && m==0)\n {\n if(m2<75) m=m2+15;\n else m=90;\n }\n m1=m2;\n }\n printf(\"%d\\n\", m);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,t[91],i,ans,tmp;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\tscanf(\"%d\",&t[i]);\n\tans=0;\n\ttmp=0;\n\tfor(i=0;i<n;i++)\n\t{\n\t\tif(t[i]-tmp<=15)\n\t\t{\n\t\t\tans=t[i];\n\t\t\ttmp=t[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(tmp+15<=90)\n\t\t\tans=tmp+15;\n\t\t\telse\n\t\t\tans=90;\n\t\t\tbreak;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,m,sum=0;\n scanf(\"%d\",&n);\n int arr[n+1];\n for(i=0 ; i<n ; i++)\n {\n scanf(\"%d\",&m);\n if(m-sum>15)\n break;\n sum=m;\n }\n if(sum<=85)\n printf(\"%d\\n\",sum+15);\n else\n printf(\"%d\\n\",sum);\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,ans=0,s;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n if(n==1)\n {\n if(a[0]>=15) ans=15;\n else ans=a[0]+15;\n }\n else\n {\n for(i=0;i<n-1;i++)\n {\n if(a[0]>15)\n {\n ans=15;\n break;\n }\n s=a[i+1]-a[i];\n if(s>15)\n {\n ans=a[i]+15;\n break;\n }\n }\n if(ans==0)\n {\n if(a[n-1]==90) ans=90;\n else if(90-a[n-1]<=15) ans=90;\n else if(90-a[n-1]>15) ans=a[n-1]+15;\n }\n }\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint t[n],i,min=0,flag=1,ref=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\tif(flag)\n\t\t{\n\t\t\tif(t[i]-ref>15)\n\t\t\t{\n\t\t\t\t//printf(\"Flagged at %d time\\n\",t[i]);\n\t\t\t\tmin=ref+15;\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\tref=t[i];\n\t\t}\n\t}\n\t//printf(\"THe ref time: %d\\n\",ref);\n\tif(flag)\n\t\tmin=90;\n\tprintf(\"%d\\n\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, x, i, min = 0;\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++){\n scanf(\"%d\", &x);\n min += 15;\n if (min >= x) min = x;\n else break;\n }\n printf(\"%d\\n\", min);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N, i;\n int A[91];\n scanf(\"%d\", &N);\n for(i = 1; i <= N; ++i) {\n scanf(\"%d\", &A[i]);\n }\n A[0] = 0;\n for(i = 1; i <= N; ++i) {\n if(A[i] - A[i - 1] > 15) {\n printf(\"%d\\n\", A[i - 1] + 15);\n return 0;\n }\n }\n puts(\"90\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\nlong long cmpfunc (const void * a, const void * b) {\n return ( *(long long*)a - *(long long*)b );\n}\n\n\n\nint main(void){\n \nlong long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,count1=0,a,b,a2,b2,a3,b3;\n\nscanf(\"%lld%lld\",&n,&b);\n if(b>15){\n printf(\"15\");\n return 0;\n }\nfor(i=1;i<n;i++){\n scanf(\"%lld\",&a);\n if(a-b>15){\n printf(\"%lld\",b+15);\n return 0;\n }\n b=a;\n}\nprintf(\"90\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,n,c=0;\n\n scanf(\"%d\",&n);\n\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n a[-1]=0;\n for(i=-1;i<n-1;i++)\n {\n if(a[i+1]-a[i]>15)\n {\n printf(\"%d\",a[i]+15);\n break;\n }\n else\n {\n c++;\n continue;\n }\n\n }\n\n if(c==n)\n printf(\"90\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <malloc.h>\n\nint n, s, result, time;\n//int i, j;\n//char str[100];\n//int *a; // \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\n\nint main()\n{\n scanf(\"%d\", &n);\n\n // \u0412\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438\n /*a = (int*) malloc(n*sizeof(int));\n // \u0412\u0432\u043e\u0434 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n for(i=0; i<n; i++)\n {\n scanf(\"%d\", &a[i]);\n }*/\n\n result = 0;\n\n while (n--)\n {\n scanf(\"%d\", &s);\n result = s - time;\n time = time + result;\n //printf(\"1 %d\\n\", time);\n if (result > 15)\n {\n time = time - (result - 15);\n //printf(\"2 %d\\n\", time);\n break;\n }\n }\n\n /*scanf(\"%s\", &str);\n for (i = 1; i < strlen(str); i++)\n {\n if (str[i] == str[i-1])\n sum++;\n else\n sum = 1;\n if (sum == 7)\n result = 1;\n }*/\n\n printf(\"%d\\n\", time);\n\n //free(a);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n, i,m, m1, m2;\n while(scanf(\"%d\", &n)!=EOF) {\n m1=0;\n m=0;\n for(i=1; i<=n; i++) {\n scanf(\"%d\", &m2);\n if(n==1 && m==0) m=m2+15;\n if(m2-m1 >15 && m==0)\n m=m1+15;\n else if(i==n && m==0)\n {\n if(m2<75) m=m2+15;\n else m=90;\n }\n m1=m2;\n }\n printf(\"%d\\n\", m);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n, m, aux=0,i,j=0;\n scanf(\"%i\", &n);\n for(i=0;i<n;i++)\n {\n scanf(\"%i\", &m);\n if((m<=15)&&(n==(i+1))&&(j==0))\n {\n aux=m+15;\n j=1;\n }\n else if(((m-aux)>15)&&(j==0))\n {\n aux+=15;\n j=1;\n\n }\n else if(((m+16)>90)&&(j==0))\n {\n aux=90;\n j=1;\n }\n else if(j==0)\n {\n aux=m;\n }\n }\n printf(\"%i\",aux);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n int i,j,k,n,c=0;\n\n scanf(\"%d\",&n);\n\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n\n a[-1]=0;\n a[n]=0;\n for(i=-1;i<n-1;i++)\n {\n if(abs(a[i+1]-a[i])>15)\n {\n printf(\"%d\",a[i]+15);\n break;\n }\n else\n {\n c++;\n continue;\n }\n\n }\n\n if(c==n && c>1)\n printf(\"90\");\n else if(c==1)\n {\n printf(\"16\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int n, m, aux=0,i,j=0;\n scanf(\"%i\", &n);\n for(i=0;i<n;i++)\n {\n scanf(\"%i\", &m);\n if((n==(i+1))&&(j==0))\n {\n aux=m+15;\n j=1;\n }\n else if(((m-aux)>15)&&(j==0))\n {\n aux+=15;\n j=1;\n\n }\n else if(((m+16)>90)&&(j==0))\n {\n aux=90;\n j=1;\n }\n else if(j==0)\n {\n aux=m;\n }\n }\n printf(\"%i\",aux);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\nmain (int argc, char *argv[])\n{\n\tint i,n,watch=0;\n\tscanf(\"%d\",&n);\n\tint time[n];\n\tfor (i = 0; i < n; i += 1)\n\t\tscanf(\"%d\",&time[i]);\n\tfor (i = 0; i < n; i += 1)\n\t{\n\t\tif(watch+15>=time[i] && i!=n-1)\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\twatch+=time[i];\n\t\t\telse\n\t\t\t\twatch+=time[i]-time[i-1];\n\t\t}\n\t\telse if (watch+15>=90)\n\t\t{\n\t\t\twatch=90;\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\twatch+=15;\n\t\t\tbreak;\n\t\t}\n\t}\t\n\tprintf(\"%d \\n\", watch);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,a[92],j=1;\n int m;\n int n;\n scanf(\"%d\",&n);\n i=0;\n j=0;\n while(i<n) {scanf(\"%d\",&a[i]);i++;}\n for(i=0;i<n;i++)\n {\n m=a[i]-j;\n if(m>15)\n {printf(\"%d\",j+15); return 0;}\n j=a[i];\n }\n printf(\"90\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n\nint main()\n{\n int n,a,b=0,time=0,diff;\n scanf(\"%d\",&n);\n while(n--)\n {\n scanf(\"%d\",&a);\n \n diff=abs(a-b);\n if(diff>15)\n {\n time =time+15;\n goto end;\n }\n else if(diff<16)\n {\n time=a;\n \n \n }\n b=a;\n }\n if(time>74 && time<91) time=90;\n else if(time>0 && time <16) time=time+15;\n end:\n printf(\"%d\",time);\n return 0;\n }"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, i, temp, count = 0;\n scanf(\"%d\", &n);\n int arr[n];\n\n for(i=0; i<n; i++)\n scanf(\"%d\", &arr[i]);\n\n for(i=0; i<n; i++){\n if(arr[i] - count <= 15)\n count = arr[i];\n else{\n printf(\"%d\", count + 15);\n return 0;\n }\n }\n printf(\"90\");\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\nint n=0,i,q=0,k=0,m=0,z=0,t=0,y=0,o=0,w=0;\nscanf(\"%d\",&n);\nint A[91];\nfor(i=0;i<n;i++)\n{\n scanf(\"%d\",&A[i]);\n}\nfor(i=0;i<n;i++)\n{\n if(A[0]>15)\n {\n q++;\n\n o=15;\n printf(\"%d\",o);\n break;\n }\n\n if((A[i+1]-A[i])>=16)\n {\n k=A[i];\n y=k+15;\n\n\n printf(\"%d\",y);\n m++;\n break;\n }\n\n\n}\nif((m==0)&&(q!=0))\n{\n if((90-A[n-1])>14)\n {\n w++;\n t=A[n-1]+15;\n printf(\"%d\",&t);\n }\n\n}\nif((m==0)&&(q==0))\n{\n if(w==0)\n {\n\n\nz=90;\nprintf(\"%d\",z);\n }\n}\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,a[91],i,flag=1,ans=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n;i++)\n {\n if(i==0 && a[i]>15)\n {\n flag=0;\n ans=15;\n }\n else if(i!=0 && (a[i]-a[i-1])>15)\n {\n ans=ans+15;\n flag=0;\n }\n else if(i==0 && a[i]<=15)\n {\n ans=ans+a[i];\n }\n else if(i!=0 && (a[i]-a[i-1])<=15)\n {\n ans=ans+(a[i]-a[i-1]);\n }\n if(flag==0)\n {\n break;\n }\n }\n printf(\"%d\\n\",ans);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint mod(int a)\n{\n if(a>=0)\n return a;\n else\n return -a;\n\n}\n\nint main()\n{\nint n,a[91]={0},i,r=0,s=0;\nscanf(\"%d\",&n);\na[0]=0;\nfor(i=1;i<=n;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\n{\nif(mod(a[i]-a[i-1])<=15)\n{\n if(a[i]+15 >= 75)\n r=90;\n else\n r=a[i]+15;\n}\nelse {\nr=a[i-1]+15; break;}\n}\n\nprintf(\"%d \\n\",r);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,i,j,flag=0;\n\tscanf(\"%d\",&n);\n\tint a[n+1],b[n];\n\ta[0]=0;\n\tfor(i=1;i<n+1;i++) scanf(\"%d\",&a[i]);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tb[i]=a[i+1]-a[i];\n\t\tif(b[i]>15)\n\t\t{ flag=1;\n\t\t\tprintf(\"%d\",a[i]+15);\n\t\t\treturn 0;\n\t\t}\n\t\t\n\n\t}\n\tif(flag==0) printf(\"%d\",90);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n c=0;\n for(i=0;i<n-1;i++){\n if(n==1){c=15;break;}\n if(a[0]>15){c=15;break;}\n if(a[i+1]-a[i]<=15){c=1;}\n else break;\n }\n if(i!=0&&(a[i]+15*c)<=90)printf(\"%d\",a[i]+15*c);\n else if(n==1&&a[0]<=15)printf(\"%d\",a[0]+c);\n else if(i==0)printf(\"15\");\n else if((a[i]+15*c)>90)printf(\"90\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#define MAX 15\nint main() {\n\tint n,x=0,k=0,p=0,j;\n\tscanf(\"%d\",&n);\n\tint a[n+2]; a[0]=0;a[n+1]=90;\n\tfor (int i = 1;i<=n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t}for ( j = 0;j<=n+1;j++){\n\t\tx = a[j+1]-a[j];\n\n\t\t\tif (x>MAX){\n\t\t\t\tk = a[j]+MAX;\n\t\t\t\tprintf(\"%d\\n\",k);\n\t\t\t\tbreak;\n\n\t\t}else if (a[n+1]-a[n] < MAX){\n\t\t\tprintf(\"%d\",90);break;\n\t\t}\n\t}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint t[n],i,min=0,flag=1,ref=0;\n\t\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\tif(flag)\n\t\t{\n\t\t\tif(t[i]-ref>15)\n\t\t\t{\n\t\t\t\tprintf(\"Flagged at %d time\\n\",t[i]);\n\t\t\t\tmin=ref+15;\n\t\t\t\tflag=0;\n\t\t\t}\n\t\t\telse\n\t\t\t\tref=t[i];\n\t\t}\n\t}\n\t//printf(\"THe ref time: %d\\n\",ref);\n\tif(flag)\n\t\tmin=90;\n\tprintf(\"%d\\n\",min);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint input=0;\n\tint input2[91]={0,};\n\tint i=0;\t\n\tscanf(\"%d\", &input);\n\tfor(i=0; i<input; i++)\n\t{\n\t\tscanf(\"%d\", &input2[i+1]);\n\t}\n\t\n\tfor(i=0; i<input+1; i++)\n\t{\n\tif(input2[i+1]>input2[i]+15||i==input)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", input2[i]+15);\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\telse if(input2[i]>=75)\n\t\t\t\t{printf(\"90\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n\nint main()\n{\n\tint i,n;\n\tscanf(\"%d\",&n);\n\tint t[n+1];\n\tint brea=0;\n\tt[0]=0;\n\tfor(i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&t[i]);\n\t\tif((t[i]-t[i-1])>15 && brea==0)\n\t\t{\n\t\t\tbrea=1;\n\t\t\tprintf(\"%d\\n\",t[i-1]+15);\t\n\t\t}\n\t}\n\tif(brea==0)\n\t{\n\t\tif(t[n]<76)\n\t\t{\n\t\t\tprintf(\"%d\\n\",t[n]+76);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"90\\n\");\n\t\t}\n\t}\n\treturn 0;\t\n}\n\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int input=0;\n int input2[91]={0,};\n int i=0;\n scanf(\"%d\", &input);\n for(i=0; i<input; i++)\n {\n scanf(\"%d\", &input2[i+1]);\n }\n\n for(i=0; i<input+1; i++)\n {\n if(input2[i+1]>=input2[i]+15||i==input)\n {\n printf(\"%d\", input2[i]+15);\n break;\n\n }\n\n else if(input2[i]>=75)\n {printf(\"90\");\n break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "int main()\n{\n int n;\n scanf(\"%d\",&n);\n int arr[n];\n for(int i=0;i<n;i++)\n scanf(\"%d\",&arr[i]);\n int d,t=arr[0]+15,flag=0;\n d=arr[0];\n if(arr[0]>15)\n t=15;\n for(int i=1;i<n;i++)\n {\n if(d>15)\n {\n flag++;\n printf(\"%d\",t);\n return 0;\n }\n else\n {\n d=arr[i]-arr[i-1];\n t=arr[i-1]+15;\n }\n }\n if(flag==0)\n {\n if(t<=90)\n {\n printf(\"%d\",t);\n return 0;\n }\n else\n printf(\"90\");\n\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint mod(int a)\n{\n if(a>=0)\n return a;\n else\n return -a;\n\n}\n\nint main()\n{\nint n,a[91]={0},i,r=0,s=0;\nscanf(\"%d\",&n);\na[0]=0;\nfor(i=1;i<=n;i++)\nscanf(\"%d\",&a[i]);\n\nfor(i=0;i<n;i++)\n{\nif(mod(a[i]-a[i-1])<=15)\n{\n if(a[i]+15 >= 75)\n r=90;\n else\n r=a[i]+15;\n}\nelse {\nr=a[i-1]+15; break;}\n}\n\nprintf(\"%d \\n\",r);\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,ara[1000],b=0,i,j,k;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n\n for(j=0;j<a;j++)\n {\n if(ara[a-1]==90){\n printf(\"90\");\n break;\n }\n k=ara[j];\n b=ara[j+1]-k;\n\n if(b>15){\n printf(\"%d\",ara[j]+15);\n\n break;\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main() {\n int i,n,c,j,x,flag=0,a[90],total=90;\n c=-1;x=0;\n scanf(\"%d\",&n);\n for(i=1;i<=n;i++) {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<=n;i++) {\n for(j=x;j<a[i];j++) {\n c++;\n if(c==15 && i==1) {\n printf(\"%d\",c);\n flag=1;\n break;\n }\n else if(c==15 && i>1) {\n printf(\"%d\",x+c);\n flag=1;\n break;\n }\n \n }\n if(flag==1) {\n break;\n }\n if(i==n){\n printf(\"%d\",total);\n }\n x=a[i];\n c=0;\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,ans=0,s;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++)\n {\n if(a[0]>15)\n {\n ans=15;\n break;\n }\n s=a[i+1]-a[i];\n if(s>15)\n {\n ans=a[i]+15;\n }\n }\n if(ans==0)\n {\n if(a[n-1]==90) ans=90;\n else if(90-a[n-1]<15) ans=90;\n else if(90-a[n-1]>15) ans=a[n-1]+15;\n }\n printf(\"%d\",ans);\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int input=0;\n int input2[92]={0,};\n int i=0;\n scanf(\"%d\", &input);\n for(i=0; i<input; i++)\n {\n scanf(\"%d\", &input2[i+1]);\n }\n\n for(i=0; i<input+1; i++)\n {\n if(input2[i+1]>input2[i]+15||i==input)\n {\n printf(\"%d\", input2[i]+15);\n break;\n\n }\n\n else if(input2[i]>=75)\n {printf(\"90\");\n break;\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int i,k[99],n;\n scanf(\"%d\", &n);\n for (i=0; i<n; i++)\n {\n scanf(\"%d\", &k[i]);\n }\n if(k[0]>15)\n {\n printf(\"%d\\n\", 15);\n return 0;\n }\n else {\n for (i=1; i<n ; i++)\n {\n if(k[i]-k[i-1]>=15)\n {\n printf(\"%d\\n\",k[i-1]+15);\n return 0;\n }\n }\n }\n printf(\"%d\\n\", 90);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i<T;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n if(T==1&&ara[0]<16)\n {\n printf(\"%d\\n\",ara[0]+15);\n c=2;\n }\n else if(ara[0]>15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i<T;i++)\n {\n if(i!=T-1)\n {\n if(ara[i+1]-ara[i]>15)\n {\n printf(\"%d\\n\",ara[i]+15);\n c=0;\n break;\n }\n }\n }\n }\n if(c==1)\n printf(\"90\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[100],n,i,j,c,s;\n scanf(\"%d\",&n);\n for (i=0; i<n; i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for (i=0; i<n; i++)\n {\n if (a[0]-1>=15)\n {\n s=15;\n break;\n }\n else if(a[i+1]-a[i]>=15)\n {\n\n s=a[i]+15;\n break;\n }\n else s=90;\n }\n printf(\"%d\\n\",s);\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<n;i++)\n {\n if(a[0]<=15)\n {\n if(a[i]-a[i-1]<15)\n s=a[i];\n }\n else s=a[0];\n }\n if(s+15>90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<complex.h>\n#include<string.h>\n#define prime 1000000007 \nint main()\n{\n\tint temp,num,i,arr[90];\n\tscanf(\"%d\",&num);\n\tfor(i=0;i<num;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tif(num==1)\n\t{\n\t\tif(num+15<=90)\n\t\t\tprintf(\"%d\\n\",num+15);\n\t\telse\n\t\t\tprintf(\"90\\n\");\n\t}\n\tif(arr[0]>15)\n\t{\n\t\tprintf(\"15\\n\");\n\t}\n\telse\n\t{\n\t\ttemp=arr[0];\n\t\tfor(i=1;i<num;i++)\n\t\t{\n\t\t\tif((temp+15)>=arr[i])\n\t\t\t{\n\t\t\t\tif(temp+15>=90)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"90\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttemp=arr[i];\n\t\t\t\t\tif(i==num-1)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%d\\n\",temp+15);\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\telse if(i==num-1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",temp+15);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",temp+15);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n, i, sum;\n\tscanf(\"%d\", &n);\n\tint ara[n+1];\n\tara[0] = 0;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d\", &ara[i]);\n\t}\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\t\n\t\tif(ara[i] - ara[i - 1] > 15)\n\t\t{\n\t\t\tsum = ara[i-1] + 15;\n\t\t\tbreak;\n\t\t} \n\t\telse sum = ara[i];\n\t}\n\t\n\tprintf(\"%d\\n\", sum);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,f=0;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n int t=1;\n if((a[0]-t)>=15)\n {\n f=1;\n printf(\"15\");\n }else\n {t=a[0];\n for(int i=1;i<n;i++)\n {\n if(a[i]-t>=15)\n {\n f=1;\n printf(\"%d\",t+15);\n break;\n }\n t=a[i];\n }\n }\n if(f==0)\n {\n int g=a[n-1]+15;\n if(g>90)\n printf(\"90\");\n else\n printf(\"%d\",g);\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int size, aux=0, i=0, j=0;\n scanf(\"%i\", &size);\n int a[size];\n for(i;i<size; i++)\n {\n scanf(\"%i\",&a[i]);\n if(a[0]>15)\n {\n aux=15;\n j=1;\n }\n else if((a[i]-aux)<=15 && j!=1)\n {\n aux=a[i];\n if((aux+15)>=90)\n {\n aux=90;\n j=1;\n }\n else if((i+1)==size)\n {\n aux+=15;\n }\n }\n else\n {\n aux=a[i-1]+15;\n j=1;\n }\n }\n printf(\"%i\", aux);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n#include<complex.h>\n#include<string.h>\n#define prime 1000000007 \nint main()\n{\n\tint temp,num,i,arr[90];\n\tscanf(\"%d\",&num);\n\tfor(i=0;i<num;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tif(num==1)\n\t{\n\t\tif(arr[0]+15<=30)\n\t\t\tprintf(\"%d\\n\",arr[0]+15);\n\t\telse if(arr[0]>15)\n\t\t\tprintf(\"15\\n\");\n\t}\n\telse if(arr[0]>15)\n\t{\n\t\tprintf(\"15\\n\");\n\t}\n\telse\n\t{\n\t\ttemp=arr[0];\n\t\tfor(i=1;i<num;i++)\n\t\t{\n\t\t\tif((temp+15)>=arr[i])\n\t\t\t{\n\t\t\t\tif(temp+15>=90)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"90\\n\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttemp=arr[i];\n\t\t\t\t\tif(i==num-1)\n\t\t\t\t\t{\n\t\t\t\t\t\tprintf(\"%d\\n\",temp+15);\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\telse if(i==num-1)\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",temp+15);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprintf(\"%d\\n\",temp+15);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint\nmain (int argc, char *argv[])\n{\n\tint i,n,watch=0;\n\tscanf(\"%d\",&n);\n\tint time[n];\n\tfor (i = 0; i < n; i += 1)\n\t\tscanf(\"%d\",&time[i]);\n\tfor (i = 0; i < n; i += 1)\n\t{\n\t\tif(watch+15>=time[i])\n\t\t{\n\t\t\tif(i==0)\n\t\t\t\twatch+=time[i];\n\t\t\telse\n\t\t\t\twatch+=time[i]-time[i-1];\n\t\t}\n\t\telse\n\t\t{\n\t\t\twatch+=15;\n\t\t\tbreak;\n\t\t}\n\t}\t\n\tprintf(\"%d \\n\", watch);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,a[10000],i,x,bore=0;\n scanf(\"%d\",&n);\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n for(i=0;i<n-1;i++){\n if(a[0]>15) {\n bore=1;\n printf(\"15\");\n break;\n }\n else if(a[i+1]-a[i]>15){\n printf(\"%d\",a[i]+15);\n bore=1;\n break;\n }\n else if(90-a[n-1]>15){\n bore=1;\n printf(\"%d\",a[n-1]+15);\n break;\n }\n else {\n bore=0;\n }\n }\n if(bore==0) printf(\"90\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n+1];\n a[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]-a[i-1]>15)\n {\n printf(\"%d\\n\",a[i-1]+15);\n break;\n }\n else\n c++;\n }\n if(c==n)\n printf(\"90\\n\");\n return 0; \n}"}, {"source_code": "/*******************************************************************************\\\n|*********S*** ****** ************* ************* ************** * ******|\n|*********** ******** ************ ************ *********** ** ******|\n|********* ********** *********** *** *********** * ********* *** ******|\n|******** *********** *I******** **** ********** *** ***** ***** ******|\n|******** *********** ********* ****** ********* ***** ** ****** ******|\n|********** ********* ******** ***A**** ******** ******* ******** ******|\n|*********** ******** ******* ********** ******* ***************** ******|\n|********** ********* ****** ************ ****** ***************** ******|\n|******** *********** ***** ************** ***** ********M******** ******|\n|***** ************** **** **************** **** ***************** ******|\n|*******************************************************************************|\n|**************BSMRSTU********************************CSE***********************|\n\\*******************************************************************************/\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\n#include<conio.h>\n#define byebye return 0\nint main()\n{\n int n, i, sum=0, b=0;\n scanf(\"%d\",&n);\n int a[n+1];\n for(i=1; i<n+1; i++)\n scanf(\"%d\",&a[i]);\n a[0]=0;\n if(a[1]-a[0]==n){\n printf(\"%d\",15+a[1]);\n byebye;\n }\n for(i=1; i<n+1; i++)\n {\n b=a[i-1];\n if(a[i]-a[i-1]>15)\n {\n sum=b+15;\n break;\n }\n }\n if(sum==0)\n printf(\"90\");\n else\n printf(\"%d\",sum);\n byebye;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int N, i;\n int A[90];\n scanf(\"%d\", &N);\n for(i = 0; i < N; ++i) {\n scanf(\"%d\", &A[i]);\n }\n for(i = 1; i < N; ++i) {\n if(A[i] - A[i - 1] > 15) {\n printf(\"%d\\n\", A[i - 1] + 15);\n return 0;\n }\n }\n puts(\"90\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\nmain()\n{\n\tint i,j,x,temp=0;\n\tscanf(\"%d\",&x);\n\tint a[x];\n\tfor (i=0;i<x;i++)\n\t\tscanf(\"%d\",&a[i]);\n\t\tif (x==1)\n\t\t{\n\t\t\tif (a[0]<=15)\n\t\t\tprintf(\"%d\\n\",a[0]+15);\n\t\t\telse if (a[0]>15)\n\t\t\tprintf(\"15\\n\");\n\t\t}\n\telse\n\t{\n\t\tif (a[0]>15)\n\t\tprintf(\"15\\n\");\n\telse\n\t{\n\t\tfor (i=0;i<x-1;i++)\n\t\t{\n\t\t\tif (a[i+1]-a[i]>15)\n\t\t\t\ttemp=a[i]+15;\n\t\t}\n\t\tif (temp!=0)\n\t\t\tprintf(\"%d\\n\",temp);\n\t\telse printf(\"90\\n\");\n\t}\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h> \nint main() {\n\tint n, a[100], i;\n\t//freopen(\"input.txt\", \"r\", stdin);\n\tscanf(\"%d\", &n);\n\tfor (i = 1; i <= n; i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t}\n\ta[0] = 0;\n\tfor (i = 1; i <= n; i++) {\n\t\tif (a[i] - a[i - 1] > 15)\n\t\t\tbreak;\n\t}\n\tif (i > n) printf(\"90\");\n\telse printf(\"%d\", a[i - 1] + 15);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main(void) {\n\tint n,i,a[100],d,s=0,p=0;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t\td=a[i]-p;\n\t\t{\n\t\t\tif(d<=15)s=s+d;\n\t\t\telse\n\t\t\t{\n\t\t\t\ts=s+15;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tp=a[i];\n\t\t}\n\t\t\n\t}\n\tprintf(\"%d\\n\",s);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,s=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n }\n for(i=1;i<n;i++)\n {\n if(a[0]<=15)\n {\n if(a[i]-a[i-1]<15)\n s=a[i];\n }\n else s=0;\n }\n if(s+15>90)\n s=75;\n printf(\"%d\",s+15);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int n, pa=0, ca;\n scanf(\"%d\", &n);\n if(n==1)\n {\n scanf(\"%d\", &ca);\n if((ca-pa)>15)\n printf(\"%d\\n\", pa+15);\n else\n printf(\"%d\\n\", ca+15);\n return 0;\n }\n while(n--)\n {\n scanf(\"%d\", &ca);\n if((ca-pa) > 15)\n {\n printf(\"%d\\n\", pa+15);\n return 0;\n }\n pa = ca;\n }\n if(pa > 85)\n printf(\"90\\n\");\n else\n printf(\"%d\\n\", pa+15);\n\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n\nint main()\n{\n\tint input=0;\n\tint input2[90]={0,};\n\tint i=0;\t\n\tscanf(\"%d\", &input);\n\tfor(i=0; i<input; i++)\n\t{\n\t\tscanf(\"%d\", &input2[i+1]);\n\t}\n\t\n\tfor(i=0; i<input+1; i++)\n\t{\n\tif(input2[i+1]>=input2[i]+15)\n\t\t\t{\n\t\t\t\tprintf(\"%d\", input2[i]+15);\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\telse if(input2[i]>=75)\n\t\t\t\t{printf(\"90\");\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\n\t\t\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,a;\n scanf(\"%d\\n\",&n);\n int i=0;\n while(n--){\n scanf(\"%d \",&a);\n if(a-i>15){printf(\"%d\",i+15);return 0;}\n i=a;\n }\n int k=90;\n if(n==0)printf(\"%d\",k);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int input=0;\n int input2[91]={0,};\n int i=0;\n scanf(\"%d\", &input);\n for(i=0; i<input; i++)\n {\n scanf(\"%d\", &input2[i+1]);\n }\n\n for(i=0; i<input+1; i++)\n {\n if(input2[i+1]>input2[i]+15||i==input)\n {\n printf(\"%d\", input2[i]+15);\n break;\n\n }\n\n else if(input2[i]>=75)\n {printf(\"90\");\n break;\n }\n }\n\n\n\n return 0;\n}\n\n"}, {"source_code": "#pragma warning(disable:4996)\n#include <stdio.h>\n#include <malloc.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n#define N 100\n#define EPS 1E-5\n//#define min(a,b) (a>b) ? b : a\nint lol(const void *x1, const void *x2)\n{\n\treturn *(int*)x1 - *(int*)x2;\n}\n/*\nint gcd(int a, int b)\n{\n\tint c;\n\twhile (b)\n\t{\n\t\tc = a % b;\n\t\ta = b;\n\t\tb = c;\n\t}\n\treturn a;\n}*/\nint Min(int a, int b)\n{\n\treturn (a > b) ? b : a;\n}\nint main(void)\n{\n\tint n, i, temp, last = 0;\n\tscanf(\"%i\", &n);\n\tfor (i = 0; i < n; i++)\n\t{\n\t\tscanf(\"%i\", &temp);\n\t\tif (temp - last > 15)\n\t\t{\n\t\t\tprintf(\"%i\", last + 15);\n\t\t\treturn 0;\n\t\t}\n\t\telse\n\t\t\tlast = temp;\n\t}\n\tprintf(\"90\");\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a[90], i, check, n, flag=-100;\n scanf(\"%d\", &n);\n for(i=0; i<n; i++)\n scanf(\"%d\", &a[i]);\n for(i=0; i<n; i++)\n {\n if(i==0)\n {\n check = a[i];\n flag = a[i];\n if(check>15)\n {\n flag = 0;\n break;\n }\n }\n else\n {\n check = a[i]-a[i-1];\n if(check>15)\n {\n flag = a[i-1];\n break;\n }\n }\n }\n if(flag<0||flag>=75)\n printf(\"90\\n\");\n else\n printf(\"%d\\n\", flag+15);\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n int n,i,c=0;\n scanf(\"%d\",&n);\n int a[n];\n for(i=0;i<n;i++){\n scanf(\"%d\",&a[i]);\n }\n c=0;\n for(i=0;i<n;i++){\n if(n==1){c=15;break;}\n if(a[0]>15){c=15;break;}\n if(a[i+1]-a[i]<=15){c=1;}\n else break;\n }\n if(i!=0&&(a[i]+15*c)<=90)printf(\"%d\",a[i]+15*c);\n else if(n=1&&a[0]<=15)printf(\"%d\",a[0]+c);\n else if(i==0)printf(\"15\");\n else if((a[i]+15*c)>90)printf(\"90\");\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,times[100],total=0;\n scanf(\"%d\",&n);\n times[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",×[i]);\n if(times[i]-times[i-1]>15)\n {\n total=total+15;\n break;\n }\n else\n {\n total=total+times[i]-times[i-1];\n }\n\n }\n printf(\"%d\\n\",total);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i;\n scanf(\"%d\",&n);\n int a[n];\n\n for(i=0;i<n;i++)\n scanf(\"%d \",&a[i]);\n\n int ans=15,x=0;\n\n if(n==1)\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n printf(\"%d\",ans+a[0]);\n }\n else\n {\n if(a[0]>15)\n printf(\"%d\",ans);\n else\n {\n for(i=1;i<n;i++)\n {\n if(a[i]-a[i-1]>15)\n {\n x=1;\n ans=a[i-1]+15;\n printf(\"%d\",ans);\n break;\n }\n }\n if(x==0)\n {\n if(a[n-1]==90)\n printf(\"%d\",a[n-1]);\n else\n printf(\"90\");\n }\n }\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main(void)\n{\n int a,ara[1000],b=0,i,j,k=0,klag=0;\n scanf(\"%d\",&a);\n for(i=0;i<a;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n\n for(j=0;j<a;j++)\n {\n\n\n b=ara[j]-k;\n if(b>15){\n printf(\"%d\",k+15);\n klag=1;\n break;\n }\n k=ara[j];\n\n\n\n\n\n }\n if(ara[a-1]==90&&klag==0){\n b=90;\n printf(\"%d\",b);\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n int t[n];\n for(i=0;i<n;i=i+1)\n {\n scanf(\"%d\",&t[i]);\n }\n j=1;\n int count=0;\n for(i=0;i<n;i=i+1)\n {\n if(t[i]-j>=15)\n {\n printf(\"%d\",count+15);\n exit(0);\n }\n else\n {\n j=t[i];\n count=t[i];\n }\n }\n printf(\"90\");\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int n, x, i, min = 0;\n scanf(\"%d\", &n);\n for (i = 0; i < n; i++){\n scanf(\"%d\", &x);\n min += 15;\n if (min >= x) min = x;\n else break;\n }\n if (min >= 75) printf(\"90\\n\");\n else printf(\"%d\\n\", min);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{int n,i,a[90],t,d,sum=0,j=0,s=0,k,l;\nscanf(\"%d\",&n);\nfor(i=0;i<n;i++)\n{scanf(\"%d\",&t);\na[i]=t;\n}\nif(a[0]>15)\nprintf(\"%d\",15);\nelse\n{sum=a[0];\nif(n==1)\nsum=sum+15;\nfor(i=0;i<n;i++)\n{d=a[i+1]-a[i];\nif(i==n-1)\nbreak;\nif(d<=15)\nsum=sum+d;\nif(d>15)\n{sum=sum+15;\nbreak;\n}\nj++;\n}\ns=j;\nk=a[j+1]-a[s];\nif(k<=15 && k!=0)\n{if(a[j]>=75)\nsum=sum+(90-a[j]);\nelse\nsum=sum+15;\n}\nprintf(\"%d\",sum);\n}\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tint a[99];\n\tint y;\n\ta[0]=0;\n\twhile(~scanf(\"%d\",&n))\n\t{\n\t\t\tfor(int i=1;i<=n;i++)\n\t\t{\n\t\t\tscanf(\"%d\",&a[i]);\n\t\t}\n\t\tfor(int i=1;i<=(n-1);i++)\n\t\t{\n\t\t\tif((a[1]-a[0])>15)\n\t\t\t{\n\t\t\t\tprintf(\"15\\n\");\n\t\t\t\ty=1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif((a[i+1]-a[i])>15)\n\t\t\t\t{\n\t\t\t\t\tprintf(\"%d\\n\",a[i]+15);\n\t\t\t\t\ty=1;\n\t\t\t\t\tbreak; \n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=n;i<=n;i++)\n\t\t{\n\t\t\t\n\t\t\tif(y==1)\n\t\t\t\tbreak;\n\t\t\telse if(90-a[n]>15)\n\t\t\t\tprintf(\"%d\\n\",a[n]+15);\n\t\t\telse\n\t\t\t\tprintf(\"90\\n\");\n\t\t}\n\t}\n\treturn 0;\t\n} \n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i,n,times[100];\n scanf(\"%d\",&n);\n times[0]=0;\n for(i=1;i<=n;i++)\n {\n scanf(\"%d\",×[i]);\n }\n for(i=1;i<=n;i++)\n {\n if(times[i]-times[i-1]>15)\n {\n times[i-1]=times[i-1]+15;\n break;\n }\n }\n\n printf(\"%d\\n\",times[i-1]);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int n, i, s;\n int a[100];\n scanf(\"%d\", &n);\n for(i = 0; i < n; i++){\n scanf(\"%d\", &a[i]);\n if(i > 0){\n if(a[i] - a[i - 1] <= 15){\n s = a[i];\n }\n else{\n printf(\"%d\", a[i - 1] + 15);\n return 0;\n }\n }\n else{\n if(a[i] > 15){\n printf(\"15\");\n return 0;\n }\n s = a[i];\n }\n }\n if(s < 76){\n s = s+15;\n }\n printf(\"%d\", s);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i , n , a = 0 ;\n scanf(\"%d\",&n);\n int t[n];\n for(i = 0 ; i < n ; i++)\n {\n scanf(\"%d\",&t[i]);\n }\n for(i = 0 ; i < n ; i++)\n {\n if(t[i] - a <= 15)\n {\n a = t[i] ;\n }\n else\n {\n a += 15 ;\n break;\n\n }\n }\n if(90-a <= 15)a = 90 ;\n if(t[1]-t[0]>15 && t[0]<15)a = t[0] ;\n printf(\"%d\",a);\n return 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\t\n\tint time[n],i;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tscanf(\"%d\",&time[i]);\n\t}\n\t\n\tint pre=0,tot=0;\n\tfor (i=0; i<n; i++)\n\t{\n\t\tif ((time[i]-pre)<=15)\n\t\t{\n\t\t\ttot = time[i];\n\t\t\tpre = time[i];\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttot+=15;\n\t\t}\n\t}\n\tprintf(\"%d\\n\",tot);\n\t\t\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n int k=0,n,*a,i,t;\n scanf(\"%d\",&n);\n a=malloc(sizeof(int)*n);\n for(i=0;i<n;i++)\n {\n scanf(\"%d\",&a[i]);\n if(a[i]-k>15)\n {t=k+15;\n break;}\n else\n {\n k=a[i];\n if(k>=75)\n t=90;}\n }\n printf(\"%d\",t);\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n, a[90], i, p, q;\n \n scanf(\"%d\", &n);\n for(i=0;i<n;i++)\n scanf(\"%d\", &a[i]);\n q=a[0];\n if(q>15)\n q=15;\n else if(n==1)\n q=q+15;\n else\n {\n for(i=1;i<n;i++)\n {\n q=q+15;\n if(q>a[i])\n q=a[i];\n else \n break;\n }\n \n }\n p=90-q;\n if(p>15)\n printf(\"%d\\n\", q);\n else\n printf(\"90\\n\");\n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main()\n{\n\tint n, i, sum;\n\tscanf(\"%d\", &n);\n\tint ara[n+1];\n\tara[0] = 0;\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\tscanf(\"%d\", &ara[i]);\n\t}\n\tfor(i = 1; i <= n; i++)\n\t{\n\t\t\n\t\tif(ara[i] - ara[i - 1] > 15)\n\t\t{\n\t\t\tsum = ara[i-1] + 15;\n\t\t\tbreak;\n\t\t} \n\t\telse sum = ara[i];\n\t}\n\t\n\tprintf(\"%d\\n\", sum);\n\t\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n int size, aux=0, i=0, j=0;\n scanf(\"%i\", &size);\n int a[size];\n for(i;i<size; i++)\n {\n scanf(\"%i\",&a[i]);\n if((a[i]-aux)<=15 && j!=1)\n {\n aux=a[i];\n if((aux+15)>=90)\n {\n aux=90;\n j=1;\n }\n else if((i+1)==size)\n {\n aux+=15;\n }\n\n }\n }\n printf(\"%i\", aux);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int n,i,t,J,I=0,M=0;\n scanf(\"%d\",&t);\n for(i=1;i<=t;i++)\n {\n scanf(\"%d\",&n);\n J= n-I;\n if(J>15)\n {\n M=I;\n }\n I= n;\n }\n if(J>15)\n {\n printf(\"%d\",M+15);\n }\n else\n {\n printf(\"90\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint n,a[100],c,i,flag=0,b[100];\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tb[i]=a[i+1]-a[i];\n\t}\n\tfor(i=0;i<n-1;i++)\n\t{\n\t\tif(b[i]<15)\n\t\t{\n\t\t\tflag=0;\n\t\t}\n\t\tif(b[i]>15)\n\t\t{\n\t\t\tflag=1;\n\t\t\tc=i;\n\t\t\tgoto temp;\n\t\t}\n\t}\n\ttemp:\n\tif(flag==1 && a[0]<15)\n\t{\n\t\tprintf(\"%d\\n\",a[c]+15);\n\t}\n\tif(flag==0 && (90-a[n-1]>15) && a[0]<15)\n\t{\n\t\tprintf(\"%d\\n\",a[n-1]+15);\n\t}\n\tif((90-a[n-1])<15 && a[0]<15)\n\t{\n\t\tprintf(\"90\\n\");\n\t}\n\tif(a[0]>15)\n\t{\n\t\tprintf(\"15\\n\");\n\t}\n\treturn 0;\n\t}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int ara[91];\n int i,T,c=1;\n scanf(\"%d\",&T);\n for(i=0;i<T;i++)\n {\n scanf(\"%d\",&ara[i]);\n }\n if(T==1&&ara[0]<16)\n {\n printf(\"%d\\n\",ara[0]+15);\n c=2;\n }\n else if(ara[0]>15)\n {\n printf(\"15\\n\");\n c=0;\n }\n else if(ara[0]<16)\n {\n for(i=0;i<T;i++)\n {\n if(i!=T-1)\n {\n if(ara[i+1]-ara[i]>15)\n {\n printf(\"%d\\n\",ara[i]+15);\n c=0;\n break;\n }\n }\n }\n }\n if(c==1)\n printf(\"90\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h> \nint main() \n{ \n int n; \n int a[99]; \n int flag; \n a[0]=0; \n while(~scanf(\"%d\",&n)) \n { \n flag=0; \n for(int i=1;i<=n;i++) \n { \n scanf(\"%d\",&a[i]); \n } \n if((a[1]-a[0])>15) \n { \n printf(\"15\\n\"); \n } \n else\n {\n \t for(int i=1;i<=(n-1);i++) \n\t { \n\t if((a[i+1]-a[i])>15) \n\t { \n\t printf(\"%d\\n\",a[i]+15); \n\t flag=1; \n\t break; \n\t } \n\t } \n if(90-a[n]>15) \n printf(\"%d\\n\",a[n]+15); \n else \n printf(\"90\\n\"); \n\t\t}\n } \n return 0; \n} "}, {"source_code": "#include <stdio.h>\nint main(void) {\n long long int n,i,k,s;\n scanf(\"%I64d\",&n);\n long long int a[100];\n for(i=0;i<n;i++)\n {\n scanf(\"%I64d\",&a[i]);\n }\n if (a[0]>15)\n {\n printf(\"15\");\n }\n else if(a[0]<15) {\n for(i=0;i<n;i++)\n {\n k=a[i]-a[i-1];\n if(k>=15)\n {\n s=a[i-1]+15;\n printf(\"%I64d\",s);\n }\n }\n }\n else {printf(\"90\");}\n\n return 0;\n}\n"}], "src_uid": "5031b15e220f0ff6cc1dd3731ecdbf27"} {"nl": {"description": "Natasha's favourite numbers are $$$n$$$ and $$$1$$$, and Sasha's favourite numbers are $$$m$$$ and $$$-1$$$. One day Natasha and Sasha met and wrote down every possible array of length $$$n+m$$$ such that some $$$n$$$ of its elements are equal to $$$1$$$ and another $$$m$$$ elements are equal to $$$-1$$$. For each such array they counted its maximal prefix sum, probably an empty one which is equal to $$$0$$$ (in another words, if every nonempty prefix sum is less to zero, then it is considered equal to zero). Formally, denote as $$$f(a)$$$ the maximal prefix sum of an array $$$a_{1, \\ldots ,l}$$$ of length $$$l \\geq 0$$$. Then: $$$$$$f(a) = \\max (0, \\smash{\\displaystyle\\max_{1 \\leq i \\leq l}} \\sum_{j=1}^{i} a_j )$$$$$$Now they want to count the sum of maximal prefix sums for each such an array and they are asking you to help. As this sum can be very large, output it modulo $$$998\\: 244\\: 853$$$.", "input_spec": "The only line contains two integers $$$n$$$ and $$$m$$$ ($$$0 \\le n,m \\le 2\\,000$$$).", "output_spec": "Output the answer to the problem modulo $$$998\\: 244\\: 853$$$.", "sample_inputs": ["0 2", "2 0", "2 2", "2000 2000"], "sample_outputs": ["0", "2", "5", "674532367"], "notes": "NoteIn the first example the only possible array is [-1,-1], its maximal prefix sum is equal to $$$0$$$. In the second example the only possible array is [1,1], its maximal prefix sum is equal to $$$2$$$. There are $$$6$$$ possible arrays in the third example:[1,1,-1,-1], f([1,1,-1,-1]) = 2[1,-1,1,-1], f([1,-1,1,-1]) = 1[1,-1,-1,1], f([1,-1,-1,1]) = 1[-1,1,1,-1], f([-1,1,1,-1]) = 1[-1,1,-1,1], f([-1,1,-1,1]) = 0[-1,-1,1,1], f([-1,-1,1,1]) = 0So the answer for the third example is $$$2+1+1+1+0+0 = 5$$$."}, "positive_code": [{"source_code": "#include <stdio.h>\n\n#define N\t2000\n#define M\t2000\n#define MD\t998244853\n\nint main() {\n\tstatic int dp[N + 1][M + 1], dq[N + 1][M + 1];\n\tint n, m, i, j, p, q, ans;\n\n\tscanf(\"%d%d\", &n, &m);\n\tdp[0][0] = 1;\n\tfor (i = 0; i <= n; i++)\n\t\tfor (j = 0; j <= i; j++) {\n\t\t\tif (i < n)\n\t\t\t\tdp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % MD;\n\t\t\tif (j < i)\n\t\t\t\tdp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % MD;\n\t\t}\n\tdq[0][0] = 1;\n\tfor (i = 0; i <= n; i++)\n\t\tfor (j = i; j <= m; j++) {\n\t\t\tif (j < m)\n\t\t\t\tdq[i][j + 1] = (dq[i][j + 1] + dq[i][j]) % MD;\n\t\t\tif (i < j)\n\t\t\t\tdq[i + 1][j] = (dq[i + 1][j] + dq[i][j]) % MD;\n\t\t}\n\tans = 0;\n\tfor (i = 0; i <= n; i++)\n\t\tfor (j = 0; j <= m; j++) {\n\t\t\tp = i == 0 ? (j == 0 ? 1 : 0) : dp[i - 1][j];\n\t\t\tq = dq[n - i][m - j];\n\t\t\tans = (ans + (long long) p * q % MD * (i - j)) % MD;\n\t\t}\n\tprintf(\"%d\\n\", ans);\n\treturn 0;\n}\n"}], "negative_code": [], "src_uid": "a2fcad987e9b2bb3e6395654cd4fcfbb"} {"nl": {"description": "Consider a linear function f(x)\u2009=\u2009Ax\u2009+\u2009B. Let's define g(0)(x)\u2009=\u2009x and g(n)(x)\u2009=\u2009f(g(n\u2009-\u20091)(x)) for n\u2009>\u20090. For the given integer values A, B, n and x find the value of g(n)(x) modulo 109\u2009+\u20097.", "input_spec": "The only line contains four integers A, B, n and x (1\u2009\u2264\u2009A,\u2009B,\u2009x\u2009\u2264\u2009109,\u20091\u2009\u2264\u2009n\u2009\u2264\u20091018) \u2014 the parameters from the problem statement. Note that the given value n can be too large, so you should use 64-bit integer type to store it. In C++ you can use the long long integer type and in Java you can use long integer type.", "output_spec": "Print the only integer s \u2014 the value g(n)(x) modulo 109\u2009+\u20097.", "sample_inputs": ["3 4 1 1", "3 4 2 1", "3 4 3 1"], "sample_outputs": ["7", "25", "79"], "notes": null}, "positive_code": [{"source_code": "#include <stdio.h>\n\n#define nMod 1000000007\n\n\n\nlong long power(long long a, long long x)\n{\n long long s;\n if (x == 1) return a;\n if (x == 0) return 1;\n s = power(a, x/2);\n s = (s * s) % nMod;\n if (x % 2 == 1)\n s = (s * a) % nMod;\n return s % nMod;\n}\n\n\nint main()\n{\n long long a, b, n, x, s = 0,k;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &n, &x);\n s = (power(a,n)*x) % nMod;\n s = (s + b) % nMod;\n if (a == 1)\n s += (b*((n-1) % nMod));\n else\n s = (s + (b*((((power(a,n)-a) + nMod) %nMod)*(power(a-1,nMod-2))% nMod))% nMod) % nMod;\n k = power(a-1,nMod-2);\n printf(\"%I64d\", (s + nMod) % nMod);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nint mult(int a, int b, int c, int d) {\n\treturn ((long long) a * b % M + (long long) c * d % M) % M;\n}\n\nstruct matrix power(struct matrix m, long long n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = mult(a, a, c, b);\n\t\tm_.b = mult(b, a, d, b);\n\t\tm_.c = mult(a, c, c, d);\n\t\tm_.d = mult(b, c, d, d);\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = mult(a, m.a, c, m.b);\n\t\t\tm_.b = mult(b, m.a, d, m.b);\n\t\t\tm_.c = mult(a, m.c, c, m.d);\n\t\t\tm_.d = mult(b, m.c, d, m.d);\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, x;\n\tlong long n;\n\n\tscanf(\"%d%d%lld%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", (((long long) x * m.a % M) + m.b) % M);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nstruct matrix power(struct matrix m, long long n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = ((long long) a * a % M + (long long) c * b % M) % M;\n\t\tm_.b = ((long long) b * a % M + (long long) d * b % M) % M;\n\t\tm_.c = ((long long) a * c % M + (long long) c * d % M) % M;\n\t\tm_.d = ((long long) b * c % M + (long long) d * d % M) % M;\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = ((long long) a * m.a % M + (long long) c * m.b % M) % M;\n\t\t\tm_.b = ((long long) b * m.a % M + (long long) d * m.b % M) % M;\n\t\t\tm_.c = ((long long) a * m.c % M + (long long) c * m.d % M) % M;\n\t\t\tm_.d = ((long long) b * m.c % M + (long long) d * m.d % M) % M;\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, x;\n\tlong long n;\n\n\tscanf(\"%d%d%lld%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", (((long long) x * m.a % M) + m.b) % M);\n\treturn 0;\n}\n"}, {"source_code": "/*\n Sachin Chandani\n IIIT Hyderabad\n */\n\n#include<stdio.h>\n#include<limits.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n#include<stdbool.h>\n# define M 1000000007\nlong long int fast_mul (long long int n,long long int x) ;\nlong long int m (long long int a) ;\nlong long int fast_mul (long long int n,long long int x) {\n\tlong long int p ;\n\tif (x==0)\n\t\treturn 1 ;\n\telse if (x==1)\n\t\treturn n%M ; \n\telse\n\t{ p=fast_mul(n,x/2) ;\n\t\tp=(p*p)%M ;\n\t\tif (x%2==1)\n\t\t\tp=(p*n)%M ;\n\t\treturn p ;\t\n\t} \n}\nlong long int m (long long int a) {\n\treturn fast_mul(a,M-2) ;\n}\nint main () {\n\tlong long int a,b,n,x ,i,sum,aux,mmi ;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&n,&x) ;\n\ta=a%M ;\n\tx=x%M ;\n\tb=b%M ;\n\taux=fast_mul(a,n) ;\n\tmmi=m(a-1) ;\n\tsum=(aux*x)%M ;\n\tif (a==1)\n\t\tn=n%M ;\n\telse\n\t\tn=((aux-1)*mmi)%M ;\n\tn=n%M ;\n\tn=(n*b)%M ;\n\tsum=(sum+n)%M ;\n\tprintf(\"%lld\\n\",sum) ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int a,b,n,x,y,z;\nlong long int mod = 1000000007;\nlong long int modpowfast(long long int base,long long int e)\n{\n\tlong long int ans=1;\n\twhile(e>0)\n\t{\n\t\tif(e&1)\n\t\t\tans=(ans*base)%mod;\n\t\tbase=(base*base)%mod;\n\t\te=e>>1;\n\t}\n\treturn ans;\t\n}\n\nint main()\n{\n\tlong long int ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n\tif(a==1)\n\t{\n\t\tn=n%mod;\n\t\tans = (x + (n*b)%mod)%mod;\n\t}\n\telse\n\t{\n\t\ty = modpowfast(a,n);\n\t\tz = modpowfast(a-1,mod-2);\n//\t\tprintf(\"%lld %lld\\n\",y,z);\n\t\tans = ((y*x)%mod + (((y-1)*z)%mod)*b )%mod;\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nunsigned long long int m=1000000007;\nunsigned long long int bigmod(unsigned long long int x, unsigned long long int n)\n{\n if(n==0) return 1;\n\n if(n%2==0)\n {\n unsigned long long int num= bigmod(x,n/2);\n return ((num%m)*(num%m))%m;\n }\n\n else\n return ((x%m)*(bigmod(x,n-1)%m))%m;\n\n}\n\nint main()\n{\n unsigned long long int sum1=0,sum2=0,sum=0,n,A,B,x;\n\n scanf(\"%llu %llu %llu %llu\",&A,&B,&n,&x);\n\n if(A==1) printf(\"%llu\\n\",((x%m)+((B%m)*(n%m))%m)%m);\n else{\n\n sum1=bigmod(A,n)%m;\n sum2=(sum1-1)%m;\n\n sum1=((sum1%m)*(x%m))%m;\n sum2=((sum2%m)*(B%m))%m;\n\n sum2=((sum2%m)* (bigmod(A-1,m-2))%m)%m;\n\n sum=((sum1%m)+(sum2%m))%m;\n\n printf(\"%llu\\n\",sum%m);\n\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nconst int mod = 1e9+7;\ntypedef long long ll;\nll quick_pow(ll a, ll b)\n{\n ll ans = 1;\n while(b)\n {\n if(b&1)\n {\n ans = (ans * a) % mod;\n }\n a = (a*a) % mod;\n b >>= 1;\n }\n return ans;\n}\nll inv(int x,int p)\n{\n return quick_pow(x,p-2);\n}\nint main()\n{\n ll a, b, x;\n ll n,ans, s, A, B;\n scanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&n,&x);\n {\n if(a == 1)\n {\n ans = (x + (n%mod)*b) % mod;\n }\n else if(n == 1)\n {\n ans = (a*x+b*n%mod) % mod;\n }\n else\n {\n ans = (quick_pow(a,n) * x) % mod; //a^n * b\n s = ( (quick_pow(a,n) - 1) * b) % mod;\n A = inv(a-1,mod);\n ans = (ans+A*s)%mod;\n }\n }\n printf(\"%I64d\\n\",ans);\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nlong long pp=1e9+7;\nlong long VLL(long long a,long long b,long long p)\n{\n long long ans=1;\n while(b)\n {\n if(b&1)\n ans=(ans*a)%p;\n a=a*a%p;\n b>>=1;\n }\n return ans;\n}\nint main()\n{\n long long a,b,c,d,x,m,n;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n if(a!=1)\n {\n c=VLL(a,n,pp); d=VLL(a-1,pp-2,pp);\n d=(((c-1)%pp)*(d%pp))%pp;\n }\n else\n d=n,c=1;\n d=((d%pp)*(b%pp))%pp;\n c=(((c%pp)*(x%pp))%pp+d)%pp;\n printf(\"%lld\\n\",c);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nlong long m=1000000007;\n\nlong long big(long long a,long long n)\n{\n long long x=1;\n while(n)\n {\n if(n%2) x = (x*a)%m;\n a = (a*a)%m;\n n = n/2;\n }\n return x%m;\n}\n\nlong long inv(long long a,long long n)\n{\n long long p,q,r,s;\n if(a==1) return (n%m);\n else\n {\n p = big(a,n)%m;\n q = p-1;\n r = big(a-1,m-2)%m;\n s = (q*r)%m;\n return s;\n }\n}\n\nint main()\n{\n long long a,b,n,x,p,q,r;\n scanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n p = (big(a,n)*(x%m))%m;\n q = (inv(a,n)*b)%m;\n r = (p+q)%m;\n printf(\"%lld\\n\",r);\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#define M 1000000007 \nlong long int fast_mul (long long int n,long long int x) {\n\tlong long int p ;\n\tif (x==0)\n\t return 1 ;\n\telse if (x==1)\n\t return n%M ; \n\telse\n\t{ p=fast_mul(n,x/2) ;\n\t p=(p*p)%M ;\n\t if (x%2==1)\n\t p=(p*n)%M ;\n\t return p ;\t\n\t} \n}\nlong long int m (long long int a) {\n\treturn fast_mul(a,M-2) ;\n}\nint main () {\n\tlong long int a,b,n,x ,i,sum,aux,mmi ;\n\tscanf(\"%I64d%I64d%I64d%I64d\",&a,&b,&n,&x) ;\n\ta=a%M ;\n\tx=x%M ;\n\tb=b%M ;\n\taux=fast_mul(a,n) ;\n\tmmi=m(a-1) ;\n\tsum=(aux*x)%M ;\n\tif (a==1)\n\t n=n%M ;\n\telse\n\tn=((aux-1)*mmi)%M ;\n\tn=n%M ;\n\tn=(n*b)%M ;\n\tsum=(sum+n)%M ;\n\tprintf(\"%I64d\\n\",sum) ;\n\treturn 0 ;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdbool.h>\n\n#define MOD 1000000007\n#define clr(ar) memset(ar, 0, sizeof(ar))\n#define read() freopen(\"lol.txt\", \"r\", stdin)\n\nlong long expo(long long x, long long n){\n x %= MOD;\n long long res = 1;\n\n while (n){\n if (n & 1LL) res = (res * x) % MOD;\n x = (x * x) % MOD;\n n >>= 1LL;\n }\n\n return (res % MOD);\n}\n\nlong long sumpow(long long x, long long n){\n if (n == 1) return (x % MOD);\n if (n & 1) return (sumpow(x, n - 1) + expo(x, n)) % MOD;\n else{\n long long r = sumpow(x, n >> 1);\n return (r + (r * expo(x, n >> 1))) % MOD;\n }\n}\n\nint main(){\n long long a, b, n, x, y, z, res;\n\n while (scanf(\"%lld %lld %lld %lld\", &a, &b, &n, &x) != EOF){\n res = (expo(a, n) * x + b) % MOD;\n if (n > 1) res = (res + (b * sumpow(a, n - 1))) % MOD;\n printf(\"%lld\\n\", res % MOD);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nunsigned long long int m=1000000007;\nunsigned long long int bigmod(unsigned long long int x, unsigned long long int n)\n{\n if(n==0) return 1;\n\n if(n%2==0)\n {\n unsigned long long int num= bigmod(x,n/2);\n return ((num%m)*(num%m))%m;\n }\n\n else\n return ((x%m)*(bigmod(x,n-1)%m))%m;\n\n}\n\nint main()\n{\n unsigned long long int sum1=0,sum2=0,sum=0,n,A,B,x;\n\n scanf(\"%llu %llu %llu %llu\",&A,&B,&n,&x);\n\n if(A==1) printf(\"%llu\\n\",((x%m)+((B%m)*(n%m))%m)%m);\n else{\n\n sum1=bigmod(A,n)%m;\n sum2=(sum1-1)%m;\n\n sum1=((sum1%m)*(x%m))%m;\n sum2=((sum2%m)*(B%m))%m;\n\n sum2=((sum2%m)* (bigmod(A-1,m-2))%m)%m;\n\n sum=((sum1%m)+(sum2%m))%m;\n\n printf(\"%llu\\n\",sum%m);\n\n }\n return 0;\n}\n"}, {"source_code": "\n/*\n * 678D\n *\n * (A-1)y = (A-1)xA^n + BA^n - B\n */\n#include <stdio.h>\n#include <stdlib.h>\n#ifndef _TJYTLXWXHYZQFW_COMMON_H\n#define _TJYTLXWXHYZQFW_COMMON_H\n#include <limits.h>\n#define offset(t,m) ((unsigned long)&(((t*)0)->m))\n#define container_of(a,t,m) ((t*)((unsigned long)a-offset(t,m)))\n#define ULL1 ((unsigned long long )1)\n#define LL(x) ((long long)(x))\n#define SWP(a, b) if ((a) != (b)) do {(a) ^= (b); (b) ^= (a); (a) ^= (b);} while(0)\n#define MAX(x,y) ((x) < (y) ? (y) : (x))\n#define MIN(x, y) ((x) < (y) ? (x) : (y))\n#define IOF(p) ((p) = ((p) < 0 ? INT_MAX : (p)))\n#define LLOF(p) ((p) = ((p) < 0 ? LLONG_MAX :(p)))\n#define IR(x, start, end) ((x) >= (start) && (x) < (end))\n#define IRE(x, start, end) ((x) >= (start) && (x) <= (end))\n#define ABS(x) ((x) < 0 ? (x) * (-1) : (x))\n#define forn(i, n) for ((i) = 0; (i) < (n); (i) += 1)\n#define fore(i, n) for ((i) = 0; (i) <= (n); (i) += 1)\n#define forr(i, s, e) for((i) = (s); (i) < (e); (i) += 1)\n#define forre(i, s, e) for((i) = (s); (i) <= (e); (i) += 1)\n#endif\n#ifndef _WCC_NUMTH_H\n#define _WCC_NUMTH_H\n#include <assert.h>\n#define NUMTH_CORRECT(x, mod) ((x) += ((x) < 0 ? (mod) : 0))\n#define NUMTH_ENS (-1) \nlong long numth_modexp(long long a, long long b, long long n);\nlong long numth_gcd(long long a, long long b);\nvoid numth_gcd_e(long long a, long long b, long long *d, long long *x, long long *y);\nint numth_mle(long long a, long long b, long long n, long long *x, long long *gcd);\n#define numth_for_each_solution(i, x, n, d) \\\n\tfor ((i) = 0; (i) < (d); (i) += 1, (x) = ((x) + (n) / (d)) % (n))\nint numth_divisors(long long k, long long divs[], long long *ndivs);\n#endif\n#define P LL(1000000007)\n/* x, y, n must not be negitive */\n#define modmul(x, y, n) ((((x) % (n)) * ((y) % (n))) % (n))\n#define modpls(x, y, n) ((((x) % (n)) + ((y) % (n))) % (n))\nint main(void)\n{\n\tlong long A, B, n, x;\n\tlong long right, q, ans, d;\n\tscanf(\"%lld%lld%lld%lld\", &A, &B, &n, &x);\n\tif (A == 1) {\n\t\tans = modpls(x, modmul(B, n, P), P);\n\t\tgoto print_answer;\n\t}\n\tq = numth_modexp(A, n, P);\n\t//printf(\"q: %lld\\n\", q);\n\tright = modmul(modmul(A - 1, x, P), q, P) + modmul(B, q, P) - B;\n\t//printf(\"right: %lld\\n\", right);\n\tNUMTH_CORRECT(right, P);\n\tnumth_mle(A - 1, right, P, &ans, &d);\n\tassert(d == 1);\n\tprint_answer:\n\tprintf(\"%lld\\n\", ans);\n\treturn 0;\n}\n\nstatic long long numth_do_gcd(long long a, long long b);\nstatic void numth_do_gcd_e(long long grt, long long les, long long *d, long long *x, long long *y);\n\nlong long numth_modexp(long long a, long long b, long long n)\n{\n\tstatic long long bit63 = (unsigned long long)0x8000000000000000;\n\tlong long square = 1;\n\tint i;\n\n\tassert(b >= 0 && n > 0);\n\n\t//FIXME: '==' > '&'\n\tfor(i = 63; i >= 0 && (b & bit63) == 0; --i)\n\t\tb <<= 1;\n\tfor(; i >= 0; --i) {\n\t\tsquare = (square * square) % n;\n\t\tif (b & bit63)\n\t\t\tsquare = (square * a) % n;\n\t\tb <<= 1;\n\t}\n\n\treturn square;\n}\n\nlong long numth_gcd(long long a, long long b)\n{\n\tif (a == 0 && b == 0)\n\t\treturn 0;\n\tif (a < 0)\n\t\ta *= -1;\n\tif (b < 0)\n\t\tb *= -1;\n\t/* We DON'T need a > b */\n\treturn numth_do_gcd(a, b);\n}\n\n/* \u5927\u6570\u9664\u5c0f\u6570, \u5c0f\u6570\u9664\u4f59\u6570 */\nstatic long long numth_do_gcd(long long a, long long b)\n{\n\tlong long r;\n\n\tif (!b)\n\t\treturn a;\n\n\tfor (r = a % b; r != 0; r = a % b) {\n\t\ta = b;\n\t\tb = r;\n\t}\n\n\treturn b;\n}\n\nvoid numth_gcd_e(long long a, long long b, long long *d, long long *x, long long *y)\n{\n\tif (a == 0 && b == 0) {\n\t\t*d = *x = *y = 0;\n\t\treturn;\n\t}\n\n\tif (a < 0)\n\t\ta *= -1;\n\tif (b < 0)\n\t\tb *= -1;\n\n\tif (a < b)\n\t\tnumth_do_gcd_e(b, a, d, y, x);\n\telse\n\t\tnumth_do_gcd_e(a, b, d, x, y);\n}\n\nstatic void numth_do_gcd_e(long long a, long long b, long long *d, long long *x, long long *y)\n{\n\tlong long tmp;\n\n\tif (b == 0) {\n\t\t*d = a;\n\t\t*x = 1;\n\t\t*y = 0;\n\t\treturn;\n\t}\n\tnumth_do_gcd_e(b, a % b, d, x, y);\n\ttmp = *x;\n\t*x = *y;\n\t//TODO: overflow?\n\t*y = (tmp - (a / b) * (*y));\n}\n\nint numth_mle(long long a, long long b, long long n, long long *solution, long long *gcd)\n{\n\tlong long d, x, y;\n\n\tassert(n != 0);\n\n\tif (n < 0)\n\t\tn *= (-1);\n\tif (a < 0)\n\t\ta *= (-1);\n\tif (b < 0)\n\t\tb *= (-1);\n\n\tnumth_gcd_e(a, n, &d, &x, &y);\n\tassert(d != 0); //d=0 if and only if a=b=0\n\n\tif (b % d)\n\t\treturn NUMTH_ENS;\n\n\t*solution = ((b / d) * (x % n)) % n;\n\tNUMTH_CORRECT(*solution, n);\n\t*gcd = d;\n\n\treturn 0;\n}\n\nint numth_divisors(long long k, long long divs[], long long *ndivs)\n{\n\tlong long i, n;\n\n\tassert(k > 0);\n\n\tn = 0;\n\tfor (i = 1; i * i < k; ++i)\n\t\tif (k % i == 0)\n\t\t\tdivs[n++] = i;\n\n\tif (i * i == k) {\n\t\tdivs[n++] = i;\n\t\ti = n - 2;\n\t} else {\n\t\ti = n - 1;\n\t}\n\n\tfor (; i >= 0; --i)\n\t\tdivs[n++] = k / divs[i];\n\n\t*ndivs = n;\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n# define m 1000000007\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\treturn 1;\n\telse if(y%2==0)\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn (z*z)%m;\n\t}\n\telse\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn ((x%m*z%m)%m*z)%m;\n\t}\n}\nint main()\n{\n\tlong long int n,a,b,x,i,ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n if(a!=1)\n{\n//\tfor(i=0;i<n;i++)\n//\t{\n\t\tans=(power(a,n)-1)%m;\n\t\tif(ans<0)\n\t\tans=ans+m;\n\t\tans=(ans%m*b%m)%m;\n\t\tif(ans<0)\n\t\tans+=m;\n\t\tif(a-1>0)\n\t\tans=((ans%m)*power(a-1,m-2)%m)%m;\n\t\t ans=ans%m;\n//\t}\n\tans=(ans+(power(a,n)%m*x%m)%m)%m;\n\tans=ans%m;}\nelse\nans=((n%m*b%m)%m+x)%m;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#define MOD 1000000007\n\nint main(){\n\tlong long int n,a,b,x;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&n,&x);\n\twhile(n>0){\n\t\tif(n%2){\n\t\t\tx=a*x+b;\n\t\t\tx%=MOD;\n\t\t}\n\t\tb=a*b+b;\n\t\ta=a*a;\n\t\ta%=MOD;\n\t\tb%=MOD;\n\t\tn/=2;\n\t}\n\tprintf(\"%lld\\n\",x);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n//input definitions\n#define sd(x) scanf(\"%d\",&x);\n#define slld(x) scanf(\"%lld\",&x);\n#define ss(x) scanf(\"%s\",x);\n#define sf(x) scanf(\"%f\",&x);\n#define slf(x) scanf(\"%lf\",&x);\n\n//output definitions\n#define pd(x) printf(\"%d\",x);\n#define plld(x) printf(\"%lld\",x);\n#define ps(x) printf(\"%s\",x);\n#define pf(x) printf(\"%f\",x);\n#define plf(x) printf(\"%lf\",x);\n#define pnl printf(\"\\n\");\n#define psp printf(\" \");\n\n//define datatypes\ntypedef long long int ll;\n\n//loops\n#define upto(x) for(;i<=x;i++)\n#define fl(i,a,b,c) for(i=a;i<=b;i+=c)\n#define wl(x) while(x--)\n\n#define MOD 1000000007\n\nll power(ll a, ll b){\n\tll ans = 1;\n\twhile(b > 0){\n\t\tif(b & 1){\n\t\t\tans = (ans * a) % MOD;\n\t\t}\n\t\ta = (a*a) % MOD;\n\t\tb/=2;\n\t}\n\treturn ans%MOD;\n}\n\nint main(void) {\n\tll a,b,c,d,n,x;\n\tslld(a) slld(b) slld(n) slld(x)\n\tif(a == 1){\n\t\tplld((x+((n%MOD)*b)%MOD)%MOD)\n\t}\n\telse if(n == 1){\n\t\tplld(((a*x)%MOD + b) % MOD)\n\t}\n\telse{\n\t\tll ans = (power(a,n) * x) % MOD;\n\t\tans = (ans + (((((power(a,n) - 1 + MOD) % MOD) * power(a-1,MOD-2)) % MOD) * b) % MOD ) % MOD;\n\t\tplld(ans)\n\t}\n\treturn 0;\n\t\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\ntypedef unsigned long long LL;\nLL m=1000000007;\n\nLL bigmod(LL a,LL b, LL m)\n{\n if(b==0) return 1%m;\n LL x=bigmod(a,b/2,m);\n x=(x*x)%m;\n if(b%2==1)\n x=(x*a)%m;\n return x;\n}\nint main()\n{\n LL n, a, b, x, f, ans, f2, f3;\n char s[200010];\n scanf(\"%llu %llu %llu %llu\",&a,&b,&n,&x);\n a=a%m;\n b=b%m;\n f = bigmod(a, n, m);\n f2 = (f * (x % m)) % m;\n if(a==1)\n {\n ans = (f2 + (b* (n%m) )% m) % m;\n }\n else\n {\n f3 = bigmod(a-1, m-2, m);\n //ans = (f2+(b*((f-1)*f3)%m)%m)%m;\n ans = (b * (f-1))%m;\n ans = (ans* f3)%m;\n ans = (ans+ f2) %m;\n }\n\n printf(\"%llu\\n\",ans);\n return 0;\n\n}\n"}, {"source_code": " #include <stdio.h>\n\tint mod=1000000007;\n long long int power(long long int base,long long int exponent)\n {\n \tlong long int res=1;\n \twhile(exponent) \n \t{\n \t\tif(exponent%2) \n \t\t\tres=(res*base)%mod;\n \t\tbase=(base*base)%mod;\n \t\texponent=exponent/=2;\n \t}\n \treturn res%mod;\n }\n \n long long int geometricsum(long long int r,long long int n)\n {\n \tif(r==1) \n \t\treturn n%mod;\n \treturn (1-power(r,n))*power(1-r,mod-2)%mod;\n }\n \n int main()\n {\n \tlong long int a,b,n,x;\n \tscanf(\"%lld %lld %lld %lld\", &a,&b,&n,&x);\n \tlong long int answer=(power(a,n)*x+b*geometricsum(a,n))%mod;\n \tprintf(\"%lld\", answer);\n \treturn 0;\n\n }"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n if(A!=1)\n {\n ll dot = power(A,itna,MOD);\n answer = (answer +((dot*x) % MOD))%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n answer = (answer+(((modInverse(A-1,MOD)*ert)%MOD)*B)%MOD)%MOD;\n }\n else if(A==1)\n {\n answer = (answer + x)%MOD ;\n // printf(\"yele %lld\\n\\n\",itna);\n answer = (answer + ((B%MOD)*(n%MOD)%MOD))%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long int power(long long int x,long long int y)\n{\n\tint hel=1;\n\tx= x%1000000007;\n\twhile(y>0)\n\t{\n\t\tif((y&1)==1)\n\t\t{\n\t\t\thel=(hel*x)%1000000007;\n\t\t}\n\t\tx= (x*x)%1000000007;\n\t\ty= y>>1;\n\t}\n\treturn hel%1000000007;\n}\nlong long int cal(long long int x,long long int y)\n{\n\tif(x==1)\n\t{\n\t\treturn y%1000000007;\n\t}\n\telse\n\t{\n\t\treturn (1-power(x,y))*power(1-x,1000000005)%1000000007;\n\t}\n}\n\nint main()\n{\n\tlong long int a,b,n,x,sum;\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&n,&x);\n\tsum=(power(a,n)*x+(b*cal(a,n)))%1000000007;\n\tprintf(\"%lld\\n\",sum);\n\treturn 0;\n}\n\n"}, {"source_code": "\nlong long int modular_pow(long long int base, long long int exponent, long long int modulus)\n{\n long long int result = 1;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n result = (result * base) % modulus;\n exponent = exponent >> 1;\n base = (base * base) % modulus;\n }\n return result;\n}\nint powercal(int x, unsigned int y)\n{\n int res = 1; // Initialize result\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if (y & 1)\n res = res*x;\n\n // n must be even now\n y = y>>1; // y = y/2\n x = x*x; // Change x to x^2\n }\n return res;\n}\nint main ()\n{\n long long int n,a,b,x,ans,e12,ef,e,e1,e2,pr,en;\n long long int p=1000000007;\n scanf (\"%I64d %I64d %I64d %I64d\",&a,&b,&n,&x);\n //printf (\"%I64d\\n\",(-1)%3);\n if (a!=1)\n {\n e1=b%p;\n pr=modular_pow(a,n,p);//(a^n)%p\n e2=(pr+(p-1))%p;\n //printf (\"%I64d \",e2);// (a^n-1) %p\n en=modular_pow(a-1,p-2,p);\n e2=((e2%p)*en)%p;\n e12=(e1*e2)%p;\n e=((x%p)*pr)%p;\n ef=(e12+e)%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n else\n {\n e=((n%p)*(b%p))%p;\n ef=(e+(x%p))%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nlong long n;\nlong long a,b,x;\nlong long que[100];\nint q;\nint main()\n{\n\tscanf(\"%lld%lld%lld%lld\",&a,&b,&n,&x);\n\tlong long an=1;\n\tlong long chuc=a-1;\n\tlong long two=pow(2,62);\n\tlong long mod=pow(10,9)+7;\n\tif(a==1){\n\t\tprintf(\"%lld\",(x+(b*(n%mod)%mod))%mod);\n\t}\n\telse{\n\t\twhile(n>0){\n\t\t\tif(n>=two){\n\t\t\t\tn-=two;\n\t\t\t\tq++;\n\t\t\t\tque[q]=two;\n\t\t\t}\n\t\t\ttwo=two/2;\n\t\t}\n\t\ttwo=1;\n\t\tlong long c=a;\n\t\twhile(q>0){\n\t\t\tif(two==que[q]){\n\t\t\t\tan=(an*a)%mod;\n\t\t\t\tq--;\n\t\t\t}\n\t\t\ta=(a*a)%mod;\n\t\t\ttwo=two*2;\n\t\t}\n\t\tint chumod=mod-2;\n\t\ttwo=pow(2,50);\n\t\twhile(chumod>0){\n\t\t\tif(chumod>=two){\n\t\t\t\tchumod-=two;\n\t\t\t\tq++;\n\t\t\t\tque[q]=two;\n\t\t\t}\n\t\t\ttwo=two/2;\n\t\t}\n\t\ttwo=1;\n\t\tlong long chu=1;\n\t\twhile(q>0){\n\t\t\tif(two==que[q]){\n\t\t\t\tchu=(chu*chuc)%mod;\n\t\t\t\tq--;\n\t\t\t}\n\t\t\tchuc=(chuc*chuc)%mod;\n\t\t\ttwo=two*2;\n\t\t}\n\t\tprintf(\"%lld\",((an*x)%mod+((((an-1)*chu)%mod)*b)%mod)%mod);\n\t}\n\treturn 0;\n } "}], "negative_code": [{"source_code": "#include <stdio.h>\n\n#define nMod 1000000007\n\n\n\nlong long power(long long a, long long x)\n{\n long long s;\n if (x == 1) return a;\n if (x == 0) return 1;\n s = power(a, x/2);\n s = (s * s) % nMod;\n if (x % 2 == 1)\n s = (s * a) % nMod;\n return s % nMod;\n}\n\n\nint main()\n{\n long long a, b, n, x, s = 0,k;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &n, &x);\n s = (power(a,n)*x) % nMod;\n s = (s + b) % nMod;\n// k = (((power(a,n)-a) + nMod) % nMod) /(a-1);\n if (a == 1) s += n-1;\n else\n s = (s + (b*(((((power(a,n)-a) + nMod) %nMod)/(a-1))% nMod))% nMod) % nMod;\n printf(\"%I64d\", (s + nMod) % nMod);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define nMod 1000000007\n\n\n\nlong long power(long long a, long long x)\n{\n long long s;\n if (x == 1) return a;\n if (x == 0) return 1;\n s = power(a, x/2);\n s = (s * s) % nMod;\n if (x % 2 == 1)\n s = (s * a) % nMod;\n return s % nMod;\n}\n\n\nint main()\n{\n long long a, b, n, x, s = 0,k;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &n, &x);\n s = (power(a,n)*x) % nMod;\n s = (s + b) % nMod;\n// k = (((power(a,n)-a) + nMod) % nMod) /(a-1);\n if (a == 1) s += n;\n else\n s = (s + (b*(((((power(a,n)-a) + nMod) %nMod)/(a-1))% nMod))% nMod) % nMod;\n printf(\"%I64d\", (s + nMod) % nMod);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define nMod 1000000007\n\n\n\nlong long power(long long a, long long x)\n{\n long long s;\n if (x == 1) return a;\n if (x == 0) return 1;\n s = power(a, x/2);\n s = (s * s) % nMod;\n if (x % 2 == 1)\n s = (s * a) % nMod;\n return s % nMod;\n}\n\n\nint main()\n{\n long long a, b, n, x, s = 0,k;\n scanf(\"%I64d %I64d %I64d %I64d\", &a, &b, &n, &x);\n s = (power(a,n)*x) % nMod;\n s = (s + b) % nMod;\n// k = (((power(a,n)-a) + nMod) % nMod) /(a-1);\n if (a == 1) s += n-1;\n else\n s = (s + (b*((((power(a,n)-a) + nMod) %nMod)*(power(a-1,nMod-2))% nMod))% nMod) % nMod;\n printf(\"%I64d\", (s + nMod) % nMod);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nstruct matrix power(struct matrix m, int n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = ((long long) a * a % M + (long long) c * b % M) % M;\n\t\tm_.b = ((long long) b * a % M + (long long) d * b % M) % M;\n\t\tm_.c = ((long long) a * c % M + (long long) c * d % M) % M;\n\t\tm_.d = ((long long) b * c % M + (long long) d * d % M) % M;\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = ((long long) a * m.a % M + (long long) c * m.b % M) % M;\n\t\t\tm_.b = ((long long) b * m.a % M + (long long) d * m.b % M) % M;\n\t\t\tm_.c = ((long long) a * m.c % M + (long long) c * m.d % M) % M;\n\t\t\tm_.d = ((long long) b * m.c % M + (long long) d * m.d % M) % M;\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, n, x;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", ((long long) x * m.a + m.b) % M);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nstruct matrix power(struct matrix m, int n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = ((long long) a * a % M + (long long) c * b % M) % M;\n\t\tm_.b = ((long long) b * a % M + (long long) d * b % M) % M;\n\t\tm_.c = ((long long) a * c % M + (long long) c * d % M) % M;\n\t\tm_.d = ((long long) b * c % M + (long long) d * d % M) % M;\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = ((long long) a * m.a % M + (long long) c * m.b % M) % M;\n\t\t\tm_.b = ((long long) b * m.a % M + (long long) d * m.b % M) % M;\n\t\t\tm_.c = ((long long) a * m.c % M + (long long) c * m.d % M) % M;\n\t\t\tm_.d = ((long long) b * m.c % M + (long long) d * m.d % M) % M;\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, n, x;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", (long long) x * m.a + m.b);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nstruct matrix power(struct matrix m, int n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = ((long long) a * a % M + (long long) c * b % M) % M;\n\t\tm_.b = ((long long) b * a % M + (long long) d * b % M) % M;\n\t\tm_.c = ((long long) a * c % M + (long long) c * d % M) % M;\n\t\tm_.d = ((long long) b * c % M + (long long) d * d % M) % M;\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = ((long long) a * m.a % M + (long long) c * m.b % M) % M;\n\t\t\tm_.b = ((long long) b * m.a % M + (long long) d * m.b % M) % M;\n\t\t\tm_.c = ((long long) a * m.c % M + (long long) c * m.d % M) % M;\n\t\t\tm_.d = ((long long) b * m.c % M + (long long) d * m.d % M) % M;\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, n, x;\n\n\tscanf(\"%d%d%d%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", (((long long) x * m.a % M) + m.b) % M);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\n#define M\t1000000007\n\nstruct matrix {\n\tint a, b, c, d;\n} m;\n\nstruct matrix power(struct matrix m, int n) {\n\tstruct matrix m_;\n\tint a, b, c, d;\n\n\tif (n == 0) {\n\t\tm_.a = 1;\n\t\tm_.b = 0;\n\t\tm_.c = 0;\n\t\tm_.d = 1;\n\t} else {\n\t\tm_ = power(m, n / 2);\n\t\ta = m_.a;\n\t\tb = m_.b;\n\t\tc = m_.c;\n\t\td = m_.d;\n\t\tm_.a = ((long long) a * a % M + (long long) c * b % M) % M;\n\t\tm_.b = ((long long) b * a % M + (long long) d * b % M) % M;\n\t\tm_.c = ((long long) a * c % M + (long long) c * d % M) % M;\n\t\tm_.d = ((long long) b * c % M + (long long) d * d % M) % M;\n\t\tif (n % 2 != 0) {\n\t\t\ta = m_.a;\n\t\t\tb = m_.b;\n\t\t\tc = m_.c;\n\t\t\td = m_.d;\n\t\t\tm_.a = ((long long) a * m.a % M + (long long) c * m.b % M) % M;\n\t\t\tm_.b = ((long long) b * m.a % M + (long long) d * m.b % M) % M;\n\t\t\tm_.c = ((long long) a * m.c % M + (long long) c * m.d % M) % M;\n\t\t\tm_.d = ((long long) b * m.c % M + (long long) d * m.d % M) % M;\n\t\t}\n\t}\n\treturn m_;\n}\n\nint main() {\n\tint a, b, x;\n\tlong long n;\n\n\tscanf(\"%d%d%lld%d\", &a, &b, &n, &x);\n\tm.a = a;\n\tm.b = b;\n\tm.c = 0;\n\tm.d = 1;\n\tm = power(m, n);\n\tprintf(\"%lld\\n\", (((long long) x * m.a % M) + m.b) % M);\n\treturn 0;\n}\n"}, {"source_code": "/*\n Sachin Chandani\n IIIT Hyderabad\n \t\t*/\n\n#include<stdio.h>\n#include<limits.h>\n#include<string.h>\n#include<stdlib.h>\n#include<math.h>\n#include<stdbool.h>\nint min(int a,int b);\nint cmp(const void *a,const void *b)\n{\n\treturn(*(int*)a-*(int*)b);\n\n}\nint min(int a,int b)\n{\n\treturn(a>b?b:a);\n}\n\nint main()\n{\n\tlong long int A,B,n,x;\n\tscanf(\"%lld%lld%lld%lld\",&A,&B,&n,&x);\n\tlong long int ans,temp;\n\tif(A==1)\n\t{\n\t\tprintf(\"%lld\",(x+(n*B)%1000000007)%1000000007);\n\t\treturn 0;\n\t}\n\tans=((long long int)(pow(A,n)))%1000000007;\n\tans=((ans*x)%1000000007);\n\ttemp=((B*(((long long int)(pow(A,n))-1)))/(A-1))%1000000007;\n\tans=(ans+temp)%1000000007;\n\tprintf(\"%lld\",ans);\n\treturn 0;\n}\n\n"}, {"source_code": "#include<stdio.h>\nlong long int a,b,n,x,y,z;\nlong long int mod = 1000000007;\nlong long int modpowfast(long long int base,long long int e)\n{\n\tlong long int ans=1;\n\twhile(e>0)\n\t{\n\t\tif(e&1)\n\t\t\tans=(ans*base)%mod;\n\t\tbase=(base*base)%mod;\n\t\te=e>>1;\n\t}\n\treturn ans;\t\n}\n\nint main()\n{\n\tlong long int ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n\tn=n%mod;\n\tif(a==1)\n\t{\n\t\tans = (x + (n*b)%mod)%mod;\n\t}\n\telse\n\t{\n\t\ty = modpowfast(a,n);\n\t\tz = modpowfast(a-1,mod-2);\n//\t\tprintf(\"%lld %lld\\n\",y,z);\n\t\tans = ((y*x)%mod + (((y-1)*z)%mod)*b )%mod;\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\nlong long int a,b,n,x,y,z;\nlong long int mod = 1000000007;\nlong long int modpowfast(long long int base,long long int e)\n{\n\tlong long int ans=1;\n\twhile(e>0)\n\t{\n\t\tif(e&1)\n\t\t\tans=(ans*base)%mod;\n\t\tbase=(base*base)%mod;\n\t\te=e>>1;\n\t}\n\treturn ans;\t\n}\n\nint main()\n{\n\tlong long int ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n\tif(a==1)\n\t{\n\t\tans = (x + (n*b)%mod)%mod;\n\t}\n\telse\n\t{\n\t\ty = modpowfast(a,n);\n\t\tz = modpowfast(a-1,mod-2);\n//\t\tprintf(\"%lld %lld\\n\",y,z);\n\t\tans = ((y*x)%mod + (((y-1)*z)%mod)*b )%mod;\n\t}\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nunsigned long long int m=1000000007;\nunsigned long long int bigmod(unsigned long long int x, unsigned long long int n)\n{\n if(n==0) return 1;\n\n if(n%2==0)\n {\n unsigned long long int num= bigmod(x,n/2);\n return ((num%m)*(num%m))%m;\n }\n\n else\n return ((x%m)*(bigmod(x,n-1)%m))%m;\n\n}\n\nint main()\n{\n unsigned long long int sum1=0,sum2=0,sum=0,n,A,B,x;\n\n scanf(\"%llu %llu %llu %llu\",&A,&B,&n,&x);\n\n sum1=bigmod(A,n)%m;\n sum2=(sum1-1)%m;\n\n sum1=((sum1%m)*(x%m))%m;\n sum2=((sum2%m)*(B%m))%m;\n\n sum2=((sum2%m)* (bigmod(A-1,m-2))%m)%m;\n\n sum=((sum1%m)+(sum2%m))%m;\n\n printf(\"%llu\\n\",sum%m);\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n# define m 1000000007\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\treturn 1;\n\telse if(y%2==0)\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn (z*z)%m;\n\t}\n\telse\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn ((x%m*z%m)%m*z)%m;\n\t}\n}\nint main()\n{\n\tlong long int n,a,b,x,i,ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n//\tfor(i=0;i<n;i++)\n//\t{\n\t\tans=ans+(power(a,n)-1);\n\t\tif(ans<0)\n\t\tans=ans+m;\n\t\tans=(ans%m*b%m)%m;\n\t\tans=((ans%m)*power(a-1,m-2)%m)%m;\n//\t}\n\tans=ans+(power(a,n)%m*x%m)%m;\n\tans=ans%m;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n# define m 1000000007\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\treturn 1;\n\telse if(y%2==0)\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn (z*z)%m;\n\t}\n\telse\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn ((x%m*z%m)%m*z)%m;\n\t}\n}\nint main()\n{\n\tlong long int n,a,b,x,i,ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n//\tfor(i=0;i<n;i++)\n//\t{\n\t\tans=(power(a,n)-1);\n\t\tif(ans<0)\n\t\tans=ans+m;\n\t\tans=(ans%m*b%m)%m;\n\t\tif(ans<0)\n\t\tans+=m;\n\t\tif(a-1>0)\n\t\tans=((ans%m)*power(a-1,m-2)%m)%m;\n//\t}\n\tans=ans+(power(a,n)%m*x%m)%m;\n\tans=ans%m;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n# define m 1000000007\nlong long int power(long long int x,long long int y)\n{\n\tif(y==0)\n\treturn 1;\n\telse if(y%2==0)\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn (z*z)%m;\n\t}\n\telse\n\t{\n\t\tlong long int z;\n\t\tz=power(x,y/2)%m;\n\t\treturn ((x%m*z%m)%m*z)%m;\n\t}\n}\nint main()\n{\n\tlong long int n,a,b,x,i,ans=0;\n\tscanf(\"%lld %lld %lld %lld\",&a,&b,&n,&x);\n//\tfor(i=0;i<n;i++)\n//\t{\n\t\tans=(power(a,n)-1)%m;\n\t\tif(ans<0)\n\t\tans=ans+m;\n\t\tans=(ans%m*b%m)%m;\n\t\tif(ans<0)\n\t\tans+=m;\n\t\tif(a-1>0)\n\t\tans=((ans%m)*power(a-1,m-2)%m)%m;\n\t\t ans=ans%m;\n//\t}\n\tans=(ans+(power(a,n)%m*x%m)%m)%m;\n\tans=ans%m;\n\tprintf(\"%lld\\n\",ans);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n//input definitions\n#define sd(x) scanf(\"%d\",&x);\n#define slld(x) scanf(\"%lld\",&x);\n#define ss(x) scanf(\"%s\",x);\n#define sf(x) scanf(\"%f\",&x);\n#define slf(x) scanf(\"%lf\",&x);\n\n//output definitions\n#define pd(x) printf(\"%d\",x);\n#define plld(x) printf(\"%lld\",x);\n#define ps(x) printf(\"%s\",x);\n#define pf(x) printf(\"%f\",x);\n#define plf(x) printf(\"%lf\",x);\n#define pnl printf(\"\\n\");\n#define psp printf(\" \");\n\n//define datatypes\ntypedef long long int ll;\n\n//loops\n#define upto(x) for(;i<=x;i++)\n#define fl(i,a,b,c) for(i=a;i<=b;i+=c)\n#define wl(x) while(x--)\n\n#define MOD 1000000007\n\nll power(ll a, ll b){\n\tll ans = 1;\n\twhile(b > 0){\n\t\tif(b & 1){\n\t\t\tans = (ans * a) % MOD;\n\t\t}\n\t\ta = (a*a) % MOD;\n\t\tb/=2;\n\t}\n\treturn ans%MOD;\n}\n\nint main(void) {\n\tll a,b,c,d,n,x;\n\tslld(a) slld(b) slld(n) slld(x)\n\tll ans = (power(a,n) * x) % MOD;\n\tans = (ans + (((((power(a,n) - 1 + MOD) % MOD) * power(a-1,MOD-2)) % MOD) * b) % MOD ) % MOD;\n\tplld(ans)\n\treturn 0;\n\t\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n//input definitions\n#define sd(x) scanf(\"%d\",&x);\n#define slld(x) scanf(\"%lld\",&x);\n#define ss(x) scanf(\"%s\",x);\n#define sf(x) scanf(\"%f\",&x);\n#define slf(x) scanf(\"%lf\",&x);\n\n//output definitions\n#define pd(x) printf(\"%d\",x);\n#define plld(x) printf(\"%lld\",x);\n#define ps(x) printf(\"%s\",x);\n#define pf(x) printf(\"%f\",x);\n#define plf(x) printf(\"%lf\",x);\n#define pnl printf(\"\\n\");\n#define psp printf(\" \");\n\n//define datatypes\ntypedef long long int ll;\n\n//loops\n#define upto(x) for(;i<=x;i++)\n#define fl(i,a,b,c) for(i=a;i<=b;i+=c)\n#define wl(x) while(x--)\n\n#define MOD 1000000007\n\nll power(ll a, ll b){\n\tll ans = 1;\n\tif(b == 1)\n\t\treturn a;\n\twhile(b > 0){\n\t\tif(b & 1){\n\t\t\tans = (ans * a) % MOD;\n\t\t}\n\t\ta = (a*a) % MOD;\n\t\tb/=2;\n\t}\n\treturn ans%MOD;\n}\n\nint main(void) {\n\tll a,b,c,d,n,x;\n\tslld(a) slld(b) slld(n) slld(x)\n\tll ans = (power(a,n) * x) % MOD;\n\tans = (ans + ((((power(a,n) - 1 + MOD) % MOD) * power(a-1,MOD-2)) % MOD * b) % MOD ) % MOD;\n\tplld(ans)\n\treturn 0;\n\t\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n\n//input definitions\n#define sd(x) scanf(\"%d\",&x);\n#define slld(x) scanf(\"%lld\",&x);\n#define ss(x) scanf(\"%s\",x);\n#define sf(x) scanf(\"%f\",&x);\n#define slf(x) scanf(\"%lf\",&x);\n\n//output definitions\n#define pd(x) printf(\"%d\",x);\n#define plld(x) printf(\"%lld\",x);\n#define ps(x) printf(\"%s\",x);\n#define pf(x) printf(\"%f\",x);\n#define plf(x) printf(\"%lf\",x);\n#define pnl printf(\"\\n\");\n#define psp printf(\" \");\n\n//define datatypes\ntypedef long long int ll;\n\n//loops\n#define upto(x) for(;i<=x;i++)\n#define fl(i,a,b,c) for(i=a;i<=b;i+=c)\n#define wl(x) while(x--)\n\n#define MOD 1000000007\n\nll power(ll a, ll b){\n\tll ans = 1;\n\twhile(b > 0){\n\t\tif(b & 1){\n\t\t\tans = (ans * a) % MOD;\n\t\t}\n\t\ta = (a*a) % MOD;\n\t\tb/=2;\n\t}\n\treturn ans%MOD;\n}\n\nint main(void) {\n\tll a,b,c,d,n,x;\n\tslld(a) slld(b) slld(n) slld(x)\n\tif(n == 1){\n\t\tplld(((a*x)%MOD + b) % MOD)\n\t}\n\telse{\n\t\tll ans = (power(a,n) * x) % MOD;\n\t\tans = (ans + (((((power(a,n) - 1 + MOD) % MOD) * power(a-1,MOD-2)) % MOD) * b) % MOD ) % MOD;\n\t\tplld(ans)\n\t}\n\treturn 0;\n\t\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\ntypedef unsigned long long LL;\nLL m=1000000007;\n\nLL bigmod(LL a,LL b, LL m)\n{\n if(b==0) return 1%m;\n LL x=bigmod(a,b/2,m);\n x=(x*x)%m;\n if(b%2==1)\n x=(x*a)%m;\n return x;\n}\nint main()\n{\n LL n, a, b, x, f, ans, f2, f3;\n char s[200010];\n scanf(\"%llu %llu %llu %llu\",&a,&b,&n,&x);\n f = bigmod(a, n, m);\n f2 = (f * (x % m)) % m;\n if(a==1)\n {\n ans = (f2 + (b* (n%m) )% m) % m;\n }\n else\n {\n f3 = bigmod(a-1, m-2, m);\n ans = (f2+(b*((f-1)*f3)%m)%m)%m;\n }\n\n printf(\"%llu\\n\",ans);\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,n,MOD);\n answer += (dot*x%MOD)%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer += (((modInverse(A-1,MOD)*ert)%MOD)*B)%MOD;\n }\n else\n {\n answer += (B*n)%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,itna,MOD);\n answer = (answer +((dot*x) % MOD))%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer = (answer+(((modInverse(A-1,MOD)*ert)%MOD)*B)%MOD)%MOD;\n }\n else\n {\n // printf(\"yele %lld\\n\\n\",itna);\n answer = (answer + ((B*n)%MOD))%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,itna,MOD);\n answer += ((dot*x) % MOD) ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer = (answer+(((modInverse(A-1,MOD)*ert)%MOD)*B))%MOD;\n }\n else\n {\n answer = (answer + (B*itna))%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,itna,MOD);\n answer += (dot*x%MOD)%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer += (((modInverse(A-1,MOD)*ert)%MOD)*B)%MOD;\n }\n else\n {\n answer += (B*n)%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,itna,MOD);\n answer += (dot*x%MOD)%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer += (((modInverse(A-1,MOD)*ert)%MOD)*B)%MOD;\n }\n else\n {\n answer += (B*itna)%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\ntypedef long long ll;\nll MOD = 1000000007 ;\nll MOD2 = 1000000006 ;\n\nll gcdExtended(ll a, ll b, ll *x, ll *y); \n\nll power(ll x, ll y, ll p) ;\n \n// Function to find modulo inverse of a \nll modInverse(ll a, ll m) \n{ \n ll x, y; \n ll g = gcdExtended(a, m, &x, &y); \n \n // m is added to handle negative x \n ll res = (x%m + m) % m; \n return res ;\n\n} \n \n// C function for extended Euclidean Algorithm \nll gcdExtended(ll a, ll b, ll *x, ll *y) \n{ \n // Base Case \n if (a == 0) \n { \n *x = 0, *y = 1; \n return b; \n } \n \n ll x1, y1; // To store results of recursive call \n ll gcd = gcdExtended(b%a, a, &x1, &y1); \n \n // Update x and y using results of recursive \n // call \n *x = y1 - (b/a) * x1; \n *y = x1; \n \n return gcd; \n} \n \nll power(ll x, ll y, ll p)\n{ \n ll res = 1; // Initialize result \n \n x = x % p; // Update x if it is more than or \n // equal to p \n \n while (y > 0) \n { \n // If y is odd, multiply x with result \n if (y & 1) \n res = (res*x) % p; \n // y must be even now \n y = y>>1; // y = y/2 \n x = (x*x) % p; \n } \n return res; \n} \n\nll main(ll argc, char const *argv[])\n{\n ll A,B,n,x; \n scanf(\"%lld %lld %lld %lld\",&A,&B,&n,&x);\n ll answer = 0;\n ll apart = 1;\n ll itna = n%(MOD2);\n if(itna==0)\n {\n printf(\"%lld\\n\",x%MOD);\n }\n else\n {\n ll second = 1;\n ll dot = power(A,itna,MOD);\n answer = (answer +((dot*x) % MOD))%MOD ;\n ll ert = dot-1 ;\n ll gh = A-1 ;\n if(A!=1)\n {\n answer = (answer+(((modInverse(A-1,MOD)*ert)%MOD)*B))%MOD;\n }\n else\n {\n answer = (answer + (B*itna))%MOD ;\n }\n //prllf(\"%lld\\n\",);\n printf(\"%lld\\n\",answer);\n }\n return 0;\n}\n"}, {"source_code": "\nlong long int modular_pow(long long int base, long long int exponent, long long int modulus)\n{\n long long int result = 1;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n result = (result * base) % modulus;\n exponent = exponent >> 1;\n base = (base * base) % modulus;\n }\n return result;\n}\nint powercal(int x, unsigned int y)\n{\n int res = 1; // Initialize result\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if (y & 1)\n res = res*x;\n\n // n must be even now\n y = y>>1; // y = y/2\n x = x*x; // Change x to x^2\n }\n return res;\n}\nint main ()\n{\n long long int n,a,b,x,ans,e12,ef,e,e1,e2,pr,en;\n long long int p=1000000007;\n scanf (\"%I64d %I64d %I64d %I64d\",&a,&b,&n,&x);\n //printf (\"%I64d\\n\",(-1)%3);\n if (a!=1)\n {\n e1=b%p;\n pr=modular_pow(a,n,p);//(a^n)%p\n e2=(pr+(p-1))%p;\n printf (\"%I64d \",e2);// (a^n-1) %p\n en=modular_pow(a-1,p-2,p);\n e2=((e2%p)*en)%p;\n e12=(e1*e2)%p;\n e=((x%p)*pr)%p;\n ef=(e12+e)%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n else\n {\n e=((n%p)*(b%p))%p;\n ef=(e+(x%p))%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n}\n\n"}, {"source_code": "\nlong long int modular_pow(long long int base, long long int exponent, long long int modulus)\n{\n long long int result = 1;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n result = (result * base) % modulus;\n exponent = exponent >> 1;\n base = (base * base) % modulus;\n }\n return result;\n}\nint powercal(int x, unsigned int y)\n{\n int res = 1; // Initialize result\n\n while (y > 0)\n {\n // If y is odd, multiply x with result\n if (y & 1)\n res = res*x;\n\n // n must be even now\n y = y>>1; // y = y/2\n x = x*x; // Change x to x^2\n }\n return res;\n}\nint main ()\n{\n long long int n,a,b,x,ans,e12,ef,e,e1,e2,pr,an,en;\n long long int p=1000000007;\n scanf (\"%I64d %I64d %I64d %I64d\",&a,&b,&n,&x);\n //printf (\"%I64d\\n\",(-1)%3);\n if (a!=1)\n {\n an=powercal(a,n);\n en=(an-1)/(a-1);\n e1=((b%p) * (en%p))%p;\n pr=modular_pow(a,n,p);\n e2=(pr*(x%p)) %p;\n ef=(e1+e2)%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n else\n {\n e=((n%p)*(b%p))%p;\n ef=(e+(x%p))%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n}\n\n"}, {"source_code": "\nlong long int modular_pow(long long int base, long long int exponent, long long int modulus)\n{\n long long int result = 1;\n while (exponent > 0)\n {\n if (exponent % 2 == 1)\n result = (result * base) % modulus;\n exponent = exponent >> 1;\n base = (base * base) % modulus;\n }\n return result;\n}\nint main ()\n{\n long long int n,a,b,x,ans,e12,ef,e,e1,e2,pr;\n long long int p=1000000007;\n scanf (\"%I64d %I64d %I64d %I64d\",&a,&b,&n,&x);\n //printf (\"%I64d\\n\",(-1)%3);\n if (a!=1)\n {\n e1=(b/(a-1))%p;\n pr=modular_pow(a,n,p);\n e2=(pr+(p-1))%p;\n e12=(e1*e2)%p;\n e=((x%p)*pr)%p;\n ef=(e12+e)%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n else\n {\n e=((n%p)*(b%p))%p;\n ef=(e+(x%p))%p;\n printf (\"%I64d\",ef);\n return 0;\n }\n}\n\n"}], "src_uid": "e22a1fc38c8b2a4cc30ce3b9f893028e"} {"nl": {"description": "Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network. But yesterday, he came to see \"her\" in the real world and found out \"she\" is actually a very strong man! Our hero is very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.", "input_spec": "The first line contains a non-empty string, that contains only lowercase English letters \u2014 the user name. This string contains at most 100 letters.", "output_spec": "If it is a female by our hero's method, print \"CHAT WITH HER!\" (without the quotes), otherwise, print \"IGNORE HIM!\" (without the quotes).", "sample_inputs": ["wjmzbmr", "xiaodao", "sevenkplus"], "sample_outputs": ["CHAT WITH HER!", "IGNORE HIM!", "CHAT WITH HER!"], "notes": "NoteFor the first example. There are 6 distinct characters in \"wjmzbmr\". These characters are: \"w\", \"j\", \"m\", \"z\", \"b\", \"r\". So wjmzbmr is a female and you should print \"CHAT WITH HER!\"."}, "positive_code": [{"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void) \n{\n int counter = 0, b = 0, a = 0;\n char name[100];\n scanf(\"%s\", name);\n int len = strlen(name);\n char temp[1000];\n \n for (int i = 0, f = 0; i < len; i++)\n {\n char c = name[i];\n for (int j = i; j < len; j++)\n {\n if (c == name[j])\n {\n counter++;\n }\n }\n a += counter;\n if (counter > 1)\n {\n b += (counter);\n }\n counter = 0;\n\n }\n\n //printf(\"%d\\n\", a);\n //printf(\"%d\\n\", b);\n\n\n if ((a -b) % 2 == 0)\n {\n printf(\"%s\", \"CHAT WITH HER!\");\n }\n else\n {\n printf(\"%s\", \"IGNORE HIM!\");\n }\n \n \n}"}, {"source_code": "\n\n#include<stdio.h>\n#include<string.h>\n\nint main(void)\n{\n\tint i;\n\tchar str[3000];\n\tint n[300],count;\n\twhile(gets(str))\n\t{\n\t\tmemset(n,0,sizeof(n));\n\t\tfor(i = 0 ; i < strlen(str) ; i ++)\t\t\n\t\t\tn[str[i]] = 1;\t\t\n\t\tcount = 0;\n\t\tfor(i = 0 ; i < 300 ; i ++)\n\t\t\tif(n[i])\n\t\t\t\tcount++;\n\t\tif(count % 2 == 0)\n\t\t\tprintf(\"CHAT WITH HER!\\n\");\n\t\telse\n\t\t\tprintf(\"IGNORE HIM!\\n\");\n\t}\n\treturn 0;\n}\n \t \t \t\t \t\t\t\t\t\t\t\t\t\t\t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,a[26]={0}, i, sum=0, j;\n char ar[100], arr[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n scanf(\"%s\", ar);\n n=strlen(ar);\n for(j=0;j<26;j++)\n {\n for(i=0;i<n;i++)\n {\n if(arr[j]==ar[i])\n {\n a[j]=1;\n }\n }\n }\n for(i=0;i<26;i++)\n {\n sum=sum+a[i];\n }\n if((sum%2)==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[72];\n int i,l,j,c;\n scanf(\"%s\",s);\n l=strlen(s);\n c=l;\n for (i=0;i<c;i++){\n for (j=i+1; j<c;j++){\n if (s[i]==s[j]){\n l--; \n break;\n }\n }\n }\n if (l%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main ()\n{\n char arr[100];\n int i, j,temp, size, m=0;\n scanf(\"%s\", arr);\n size=strlen(arr);\n for(i=0; i<size; i++)\n {\n /*\n * Place currently selected element array[i]\n * to its correct place.\n */\n for(j=i+1; j<size; j++)\n {\n /*\n * Swap if currently selected array element\n * is not at its correct position.\n */\n if(arr[i] > arr[j])\n {\n temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n }\n }\n for ( i=0; i<size-1; i++)\n {\n if ( arr[i+1] != arr[i])\n {\n m++;\n }\n }\n if ( m%2==0)\n {\n printf(\"IGNORE HIM!\");\n }\n else\n {\n printf(\"CHAT WITH HER!\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l,count=0,temp=0;\n\tchar s[102];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tfor(j=i+1;j<l;j++)\n\t\t{\n\t\t\tif(s[i]>s[j])\n\t\t\t{\n\t\t\t\ttemp=s[i];\n\t\t\t\ts[i]=s[j];\n\t\t\t\ts[j]=temp;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]!=s[i+1])\n\t\t{\n\t\t\tcount++;\n\t\t}\n\t}\n\tif(count%2==0)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n\tint len;\n\tchar a[101];\n\tint b[26]={0};\n\tint i;\n\tscanf(\"%s\",a);\n\tlen=strlen(a);\n\tfor(i=0;i<len;i++)\n\t\tb[a[i]-97] +=1;\n\tfor(i=0;i<26;i++)\n\t\tif(b[i]>1)\n\t\t\tlen -=b[i]-1;\n\tif(len%2)\n\t\tprintf(\"IGNORE HIM!\");\n\telse\n\t\tprintf(\"CHAT WITH HER!\");\n\n\t\n\n\treturn 0;\n\n}\n \t\t \t \t \t \t\t\t\t\t \t"}, {"source_code": "#include<stdio.h>\nint main()\n{int i,j,k,n,c;\nchar a[100];\nwhile(scanf(\"%s\",a)!=EOF)\n{for(i=0;a[i]!='\\0';i++);\nfor(j=0;j<=i;j++)\nfor(k=j,n=0;k<=i;k++)\nif(a[j]<a[k])\n{c=a[j];\na[j]=a[k];\na[k]=c;}\nfor(j=0,k=0;j<=i-1;j++)\nif(a[j]!=a[j+1])\nk++;\nif(k%2==0)\nprintf(\"CHAT WITH HER!\\n\");\nelse\nprintf(\"IGNORE HIM!\\n\");}\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char str[200] ;\n char *s = str ;\n int count = 0 , i = 1 ;\n\n scanf(\" %s\",str) ;\n while(*s)\n {\n ++count ;\n while(*(s-i))\n {\n if(*s == *(s-i))\n {\n --count ;\n break ;\n }\n i++;\n }\n s++;\n i=1 ;\n }\n if (count%2 == 0)\n {\n printf(\"CHAT WITH HER!\") ;\n }\n else\n printf(\"IGNORE HIM!\") ;\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,k;\n char s[101];\n gets (s);\n n = strlen(s);\n for( i=0; i<n; i++)\n {\n for( j=i+1; j<n; )\n {\n if(s[i]==s[j])\n {\n for( k=j; k<n; k++)\n {\n s[k]=s[k+1];\n }\n n = n - 1;;\n }\n else\n j++;\n }\n }\n if(n%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{ \n char ara[100];\n int i,j,r=0,k;\n gets(ara);\n j=strlen(ara);\n for(i=1;i<strlen(ara);i++)\n { r=0;\nfor(k=0;k<i;k++)\n if(ara[i]==ara[k])\n r++;\n if(r>0)\n j--;\n \n \n }\n if(j%2==0)\n printf(\"CHAT WITH HER!\");\n else \n printf(\"IGNORE HIM!\");\n return 0;\n\n\n\n}"}, {"source_code": " #include<stdio.h>\n #include<stdlib.h>\n #include<string.h>\n \n int main()\n {\n char *str = (char *)malloc(100*sizeof(char));\n int count=0,c=0;\n \n gets(str);\n \n for(int i=0;i<strlen(str);i++)\n {\n for(int j=i+1;j<strlen(str);j++)\n {\n if(*(str+i) == *(str+j))\n {\n count++;\n }\n }\n if(count>0)\n {\n c++;\n count=0;\n }\n }\n \n int val = strlen(str) - c;\n \n if(val%2 == 0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n \n return 0;\n }"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char ch;\n int a[30]={0},t=0;\n while((ch=getchar())!='\\n')\n {if(a[ch-97]==0)\n {a[ch-97]=1;\n t++;}}\n if(t%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{ \n\tchar string[5000];\n\tint i;\n\t\n\tint length = 0;\n\tgets(string);\n\t\n\t\tfor(int i=0;i<strlen(string);i++)\n\t\t{\n\t\t\tint a=0;\n \t\tfor(int j=0;j<i;j++)\n \t\t{\n \t\tif(string[i]==string[j])\n \t\t\t{\n \t\t\t\ta=1;\n \t\t\tbreak;\n \t\t\t}\n \t}\n \t \n \t\t\t\tif (!a)\n \t\t\t\t\tlength++;\n\t\t}\t\t\t\n\t\tif (length%2==0)\n\t\t{\n\t\t\tprintf(\"CHAT WITH HER!\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprintf(\"IGNORE HIM!\");\n\t\t}\n\t\treturn 0;\n}\n"}, {"source_code": "//\n// main.c\n// codeforces2\n//\n// Created by Ashish on 10/1/15.\n// Copyright (c) 2015 Ashish. All rights reserved.\n//\n\n#include <stdio.h>\n#include <string.h>\n#include <ctype.h>\n#include<math.h>\n\nint main()\n{\n int c=0,i,f,j,l;\n char a[100];\n gets(a);\n l=strlen(a);\n for(i=0;i<l;i++){\n f=0;\n for(j=i+1;j<l;j++){\n if(a[i]==a[j])\n f=1;\n }\n if(f!=1)\n c++;\n }\n if(c%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n \n}\n"}, {"source_code": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <conio.h>\n#include <string.h>\n\nint main()\n{\n\n\tchar ar[100];\n\tgets(ar);\n\tint n = strlen(ar);\n\tint c = n;\n\tfor (int i = 0; i < n; i++)\n\t{\n\t\tfor (int j = i + 1; j < n; j++)\n\t\t{\n\t\t\tif (ar[i] == ar[j]&& ar[i]!=NULL)\n\t\t\t{\n\t\t\t\tar[j] = NULL;\n\t\t\t\tc--;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (c % 2 == 0)\n\t\tprintf(\"CHAT WITH HER!\");\n\telse\n\t\tprintf(\"IGNORE HIM!\");\n\n\n\treturn 0;\n\n}\n\n\n\n"}, {"source_code": "#include<stdlib.h>\n#include<stdio.h>\n#include<string.h>\n\nvoid main(){\n char stri[100];\n int i,j,len ;\n memset(stri,'\\0',sizeof(stri));\n scanf(\"%s\",stri);\n\n len=strlen(stri);\n int conta=0;\n for(i=0;i<30;i++){\n for(j=0;j<len;j++){\n\n if((stri[j]!=0) && (stri[j]==('a'+i))) {\n conta++;\n break;\n }\n }\n\n }\n\n\n/*\n\n for(i=0;i<100;i++){\n if(stri[i]!=0){\n for(j=i+1;j<100;j++){\n if(stri[i]==stri[j]) stri[j]=0;\n }\n cont++;\n }\n }\n //for(i=0;i<100;i++) if(stri[i]!=0) cont++;\n*/\n // printf(\"%d\\n\",conta);\n if((conta%2)==0){printf(\"CHAT WITH HER!\\n\");\n }else{printf(\"IGNORE HIM!\\n\");}\n\nreturn;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n int i,a[30]={0}, cnt=0;\n char s[105];\n scanf(\"%s\", &s);\n for( i=0; i<strlen(s); i++) {\n if(a[s[i]-97]==0) cnt++;\n a[s[i]-97]++;\n }\n if(cnt%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "main(){char z[72];scanf(\"%s\",z);int a=strlen(z),i,j;for(i=0;i<strlen(z);i++)for(j=i+1;j<strlen(z);j++)if(z[i]==z[j]){a--;break;}puts(a%2?\"IGNORE HIM!\":\"CHAT WITH HER!\");}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n//hi\n\tint b,i,d=0,j,count[26]={0};\n\tchar a[100];\n\tscanf(\"%[^\\n]s\",a);\n\tb=strlen(a);\n\t//printf(\"%d\\n\",b);\n\tfor(i=0;i<b;i++)\n\t\t//for(j=0;j<26;j++)\n\t{\n\t\tif(a[i]<123 && a[i]>96)\n\t\t{if(count[122-a[i]]==0)\n\t\t\tcount[122-a[i]]+=1;}\n\t\t//else\n\t\t//count[122-a[i]]=count[122-a[i]];\n\t}\n\n\tfor(j=0;j<26;j++)\n\t\td=d+count[j];\n//printf(\"%d\\n\",d);\n\t//if(a[i]!=a[j])\n\t//if(a[i]>96 && a[i]<123)\n\t//d++;\n\tif(d%2==0)\n\t\tprintf(\"CHAT WITH HER!\");\n\telse\n\t\tprintf(\"IGNORE HIM!\");\n\t\td=0;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,i,j,k;\n char s[101];\n gets (s);\n n = strlen(s);\n for( i=0; i<n; i++)\n {\n for( j=i+1; j<n; )\n {\n if(s[i]==s[j])\n {\n for( k=j; k<n; k++)\n {\n s[k]=s[k+1];\n }\n n = n - 1;;\n }\n else\n j++;\n }\n }\n if(n%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar ch[120];\n\tint hc[26];\n\tint chlen, i, j=0;\n\twhile (scanf(\"%s\", ch) != EOF)\n\t{\n\t\tfor (i = 0; i < 26; ++i)\n\t\t\thc[i] = 0;\n\t\tchlen = strlen(ch);\n\t\tfor (i = 0; i < chlen; ++i)\n\t\t\thc[ch[i] - 97] += 1;\n\t\tfor (i = 0; i < 26; ++i)\n\t\t\tif (hc[i] >= 1)\n\t\t\t\tj += 1;\n\t\tif (j % 2 == 0)\n\t\t\tprintf(\"CHAT WITH HER!\\n\");\n\t\tif (j % 2 != 0)\n\t\t\tprintf(\"IGNORE HIM!\\n\");\n\t\tj = 0;\n\t}\n\treturn 0;\n}\n \t\t \t\t \t\t\t\t \t \t \t \t\t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char name[101];\n int i,j,extra,test,t;\n extra=0;\n scanf(\"%[^\\n]\",name);\n test=strlen(name);\n for(i=0;i<test-1;i++){\n for(j=0;j<test-i-1;j++){\n if(name[j]<name[j+1]){\n t=name[j+1];\n name[j+1]=name[j];\n name[j]=t;\n }\n }}\n for(i=0;i<test-1;i++){\n if(name[i]!=name[i+1])\n continue;\n else\n extra++;\n }\n if((test-extra)%2!=0)\n printf(\"IGNORE HIM!\");\n else\n printf(\"CHAT WITH HER!\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n int k,i,j,l=0,count=1;\n gets(str);\n k=strlen(str);\n\n for(i=1;i<=k;i++)\n {\n for(j=0;j<i;j++)\n {\n if(str[i]!=str[j])\n {\n l++;\n }\n }\n if(l==i)\n {\n count++;\n }\n l=0;\n }\n\n if(count%2==0)\n {\n printf(\"IGNORE HIM!\");\n\n }\n else\n printf(\"CHAT WITH HER!\");\n return 0;\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,s=0;\n char arr[101],temp;\n scanf(\"%s\",&arr);\n int l=strlen(arr);\n k=l;\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(arr[j]>arr[i])\n {\n temp=arr[j];\n arr[j]=arr[i];\n arr[i]=temp;\n }\n }\n }\n for(i=0;i<l;i++)\n {\n if(arr[i]==arr[i+1])\n {\n k--;\n }\n }\n if(k%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{ \n int i,j,k=-1;\n char ch[200],ch1[200];\n fgets(ch,1000,stdin);\n for(i=0;i<=strlen(ch);i++)\n { \n int c=0;\n for(j=i+1;j<=strlen(ch);j++)\n {\n if((int)ch[i]==(int)ch[j])\n {\n c++;\n }\n }\n if(c==0)\n { \n k=k+1;\n ch1[k]=ch[i];\n }\n }\n int d=strlen(ch1);\n if(d%2!=0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n\n return 0;\n}"}, {"source_code": " #include<stdio.h>\n #include<stdlib.h>\n #include<string.h>\n \n int main()\n {\n char *str = (char *)malloc(100*sizeof(char));\n int count=0,c=0;\n \n gets(str);\n \n for(int i=0;i<strlen(str);i++)\n {\n for(int j=i+1;j<strlen(str);j++)\n {\n if(*(str+i) == *(str+j))\n {\n count++;\n }\n }\n if(count>0)\n {\n c++;\n count=0;\n }\n }\n \n int val = strlen(str) - c;\n \n if(val%2 == 0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n \n return 0;\n }"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n int k,i,j,l=0,count=1;\n gets(str);\n k=strlen(str);\n\n for(i=1;i<=k;i++)\n {\n for(j=0;j<i;j++)\n {\n if(str[i]!=str[j])\n {\n l++;\n }\n }\n if(l==i)\n {\n count++;\n }\n l=0;\n }\n\n if(count%2==0)\n {\n printf(\"IGNORE HIM!\");\n\n }\n else\n printf(\"CHAT WITH HER!\");\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int x,c=0,t;\n x=strlen(str);\n for(int i=0;i<x;i++){\n for(int j=0;j<x;j++){\n if(str[i]>str[j])\n {\n t=str[i];\n str[i]=str[j];\n str[j]=t;\n \n }\n }\n } \n for(int i=0;i<x;i++){\n \n \n if(str[i]==str[i+1]){\n c++;\n \n }\n } \n int y;\n y=x-c;\n if(y%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0; \n \n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint boyorgirl(char *s) ;\nint main()\n{\n char str[200] ;\n char *s = str ;\n int count3;\n\n scanf(\" %s\",str) ;\n\n count3 = boyorgirl(str) ;\n\n if (count3%2 == 0)\n {\n printf(\"CHAT WITH HER!\") ;\n }\n else\n printf(\"IGNORE HIM!\") ;\n return 0;\n}\nint boyorgirl(char*s)\n{\n int i = 1 , count = 0 ;\n while(*s)\n {\n count ++ ;\n while(*(s-i))\n {\n if(*s == *(s-i))\n {\n count -- ;\n break ;\n }\n i++;\n }\n i=1;\n s++;\n }\n return count ;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k,s=0;\n char arr[101],temp;\n scanf(\"%s\",&arr);\n int l=strlen(arr);\n k=l;\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(arr[j]>arr[i])\n {\n temp=arr[j];\n arr[j]=arr[i];\n arr[i]=temp;\n }\n }\n }\n for(i=0;i<l;i++)\n {\n if(arr[i]==arr[i+1])\n {\n k--;\n }\n }\n if(k%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char p[200];\n gets(p);\n int l=strlen(p);\n int i,j,c=0,t;\n for (i=0; i<l; i++)\n {\n if (i==0) c++;\n else\n {\n t=1;\n for (j=0; j<i; j++)\n {\n if (p[i]==p[j])\n {\n t=0;\n break;\n }\n }\n if (t) c++;\n }\n }\n //printf(\"%d\\n\",c);\n if (c%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int p,count,c=0,i,j;\n char S[101];\n scanf(\"%s\",S);\n p=strlen(S);\n for(i=0;i<p;i++)\n {\n count=0;\n for(j=i;j<p;j++)\n {\n if(S[i]==S[j]) count++;\n }\n if(count==1) c++;\n }\n if(c%2==0)printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n \nint main()\n{\n char str[100]={'0'};\n int i,j,len,tmp=0,check=0;\n int ck[26]={0};\n \n while(scanf(\"%s\",&str)==1){\n tmp=0;\n len=strlen(str);\n check=0;\n \n for(i=0;i<len;i++){\n tmp=str[i]-97;\n ck[tmp]++;\n }\n for(j=0;j<26;j++){\n if(ck[j]>=1){\n check++;\n //break;\n }\n // printf(\"%d \",ck[j]);\n }\n \n if(check%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else{\n printf(\"IGNORE HIM!\\n\");\n }\n \n \n }\n \n \n return 0;\n}"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\n\nint main()\n{\nchar s[100];\n int i,j,count=0,x,l,temp;\n scanf(\"%s\",s);\n int max=s[0];\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(s[i]>s[j])\n {\n temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n \n for(i=0;i<l;i++)\n {\n if(s[i]!=s[i+1])\n count++;\n }\n if(count%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char arr[900];\n gets(arr);\n int arr1[200];\n int i,s,l,c=0;\n l=strlen(arr);\n for(i=0;i<200;i++){\n arr1[i]=0;\n }\n for(i=0;i<l;i++){\n s=arr[i];\n if(arr1[s]==0)\n arr1[s]=1;\n }\n for(i=0;i<200;i++){\n if(arr1[i]==1){\n c++;\n }\n }\n if(c%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else{\n printf(\"IGNORE HIM!\\n\");\n }\n return 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main(){\n char c;\n int arr['z'-'a'+1]={0},count=0;\n while((c=getchar())!='\\n'){\n if(arr[c-'a']==0){\n arr[c-'a']=1;\n count++;\n }\n }\n puts((count%2)?\"IGNORE HIM!\":\"CHAT WITH HER!\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint boyorgirl(char *s) ;\nint main()\n{\n char str[200] ;\n char *s = str ;\n int count3;\n\n scanf(\" %s\",str) ;\n\n count3 = boyorgirl(str) ;\n\n if (count3%2 == 0)\n {\n printf(\"CHAT WITH HER!\") ;\n }\n else\n printf(\"IGNORE HIM!\") ;\n return 0;\n}\nint boyorgirl(char *s)\n{\n int i = 1 , count = 0 ;\n\n while(*s)\n {\n ++count;\n while(*(s-i))\n {\n if(*s == *(s-i))\n {\n --count;\n break ;\n }\n ++i;\n }\n i=1;\n ++s;\n }\n return count ;\n}\n"}, {"source_code": "//GNU GCC C11 5.1.0 | CodeForces.Com\nmain() {\n char input[90];\n scanf(\"%s\", input);\n int distinctChars = strlen(input), i, j; //Abbreviation: Distinct characters\n\n for (i = 0; i < strlen(input); i++)\n for (j = i + 1; j < strlen(input); j++)\n if(input[i] == input[j]) {\n distinctChars--;\n break;\n }\n\n puts(distinctChars % 2 ? \"IGNORE HIM!\" : \"CHAT WITH HER!\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n \n char ch[1000]; \n gets(ch);\n int l=0,k=0,i,j,temp=0,y=0,p=0;\n l=strlen(ch);\n for(i=0;i<l;i++)\n {\n \n for(j=i+1;j<l;j++)\n {\n \n if(ch[i]>ch[j])\n {\n p=ch[i];\n ch[i]=ch[j];\n ch[j]=p;\n }\n \n \n }\n }\n for(i=0;i<l;i++)\n {\n temp=0;\n for(j=i+1;j<l;j++)\n {\n \n \n if(ch[i]==ch[j])\n {\n temp++;\n \n }\n \n }\n if(temp==0)\n {\n y++;\n }\n } \n \n if(y%2!=0)\n {\n printf(\"IGNORE HIM!\\n\");\n }\n if(y%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n \n return 0;\n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[1000];\n int i,j,l,c=0;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++)\n for(j=i+1;j<l;j++)\n {\n if(s[i]==s[j]){\n c++;\n break;\n }\n }\n\n\nc=l-c;\nif(c%2!=0)\n printf(\"IGNORE HIM!\\n\");\nelse printf(\"CHAT WITH HER!\\n\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#define N 1000001\n\nint main(void){\n char *word=(char *)malloc(N*sizeof(char));\n char *distinct=(char *)malloc(N*sizeof(char));\n scanf(\"%s\",word);\n distinct[0]=word[0];\n int counter=1;\n for (int i =0;i<strlen(word);i++){\n int flag=0;\n for(int j=0;j<strlen(distinct);j++){\n if(word[i]==distinct[j]){\n flag++;\n }\n }\n if(!flag){\n distinct[counter]=word[i];\n counter++;\n }\n }\n printf(\"%s\",counter%2==0?\"CHAT WITH HER!\":\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nmain()\n{\n char s[102];\n gets(s);\n int c,k,i;\n c=1;\n for(i=1;i<strlen(s);i++)\n {\n c++;\n for(k=0;k<i;k++)\n {\n if(s[i]==s[k])\n {\n c--;\n break;\n }\n\n }\n\n\n }\n\n if(c%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}"}, {"source_code": " #include<stdio.h>\n #include<string.h>\n main()\n {\n int i,l,count[256]={0},a=0;\n char ch[1000];\n scanf(\"%s\",ch);\n l=strlen(ch);\n for(i=0;i<l;i++)\n {\n if(ch[i]>='a'&&ch[i]<='z')\n {\n count[ch[i]]++;\n }\n }\n for(i=0;i<256;i++)\n {\n if(count[i]!=0)\n {\n a=a+1;\n }\n }\n\n if(a%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n }\n\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\n\nint main()\n{\nchar s[100];\n int i,j,count=0,x,l,temp;\n scanf(\"%s\",s);\n int max=s[0];\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(s[i]>s[j])\n {\n temp=s[i];\n s[i]=s[j];\n s[j]=temp;\n }\n }\n }\n \n for(i=0;i<l;i++)\n {\n if(s[i]!=s[i+1])\n count++;\n }\n if(count%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar str[200];\nscanf(\"%s\",str);\nint count[30]={0},data=0;\nint len=strlen(str),i;\nfor(i=0;i<len;i++){\n count[str[i]-'a']++;\n}\n for(i=0;i<30;i++){\n if(count[i]!=0) data++;\n }\n if(data%2==0) printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\nreturn 0;\n}\n\t\t\t\t \t\t\t\t\t \t\t \t \t\t\t \t\t\t\t \t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n\tint i,j,l,k=0;\n\tchar s[120];\n\tgets(s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tfor(j=i+1;j<l;j++)\n\t\t{\n\t\t\tif(s[j]==s[i]&&s[i]!='0')\n\t\t\t\ts[j]='0';\n\t\t}\n\t}\n\tfor(i=0;i<l;i++)\n\t{\n\t\tif(s[i]!='0')\n\t\t\tk++;\n\t}\n\tif(k%2==0)\n\t\tprintf(\"CHAT WITH HER!\\n\");\n\telse\n\t\tprintf(\"IGNORE HIM!\\n\");\n\t\n}\n\n \t\t \t \t\t \t \t\t\t \t \t\t\t\t \t\t\t\t\t"}, {"source_code": "main(){char z[72];scanf(\"%s\",z);int a=strlen(z),i,j;for(i=0;i<strlen(z);i++)for(j=i+1;j<strlen(z);j++)if(z[i]==z[j]){a--;break;}puts(a%2?\"IGNORE HIM!\":\"CHAT WITH HER!\");}"}, {"source_code": "#include<stdio.h>\n#include<math.h>\n#include<stdlib.h>\n#include<string.h>\n#include<ctype.h>\nint main(){\n char s[103];\n scanf(\"%s\",s);\n int i,j,a,count=0;\n a=strlen(s);\n for(i=0;i<a-1;++i){\n\t for(j=i+1;j<a;++j){\n\t\tif(s[i]==s[j]){\n\t\t\t count++;\n\t\t\t break;}\n\t\t }\n\t }\n\t \n\t \n if((a-count)%2) printf(\"IGNORE HIM!\");\n else printf(\"CHAT WITH HER!\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char name[100];\n scanf(\"%s\",name);\n short ch_counter = 0,temp;\n for (short i = 0 ; i< strlen(name) ; i++)\n {\n temp=1;\n for (short j = i-1 ; j>=0 ; j--)\n {\n if (name[i]==name[j]) temp=0 ;\n }\n if (temp==1) ch_counter++ ;\n }\n if(ch_counter%2==1) printf(\"IGNORE HIM!\");\n else printf(\"CHAT WITH HER!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[100];\n int i,l,j,c;\n scanf(\"%s\",s);\n l=strlen(s);\n c=l;\n for (i=0;i<c;i++){\n for (j=i+1; j<c;j++){\n if (s[i]==s[j]){\n l--; \n break;\n }\n }\n }\n if (l%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n scanf(\"%s\",a);\n int m=strlen(a);\n for(int i=0;i<m-1;i++)\n for(int j=i+1;j<m;j++)\n if(a[j]==a[i])\n {\n for(int k=j;k<m;k++)\n a[k]=a[k+1];\n j--;\n m--;\n }\n if(m%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main(){\n\t\n\tchar ch[100];\n\t\n\tdo{\n\t\tgets(ch);\n\t\t\n\t}while(strlen(ch)>100||*ch=='\\0');\n\t\n\tint i;\n\tint j;\n\tfor( i=0;i<strlen(ch)-1;i++){\n\t\tfor( j=i+1;j<strlen(ch);j++){\n\t\t\twhile (ch[j]==ch[i]){\n\t\t\t\tstrcpy(ch+j,ch+j+1);\n\t\t\t}\n\t\t}\n\t}\n\tif(strlen(ch)%2==0){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}else{\n\t printf(\"IGNORE HIM!\");\n\n\t}\n\t\n\t\n\t\n\t\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n\tchar src[101],tmp[101];\n\n\tscanf(\"%s\",src);\n\tint i,j,t=0,flag=0;\n\tfor(i=0;i<strlen(src);i++)\n\t{\n\t\tfor(j=0;j<=t;j++)\n\t\t{\n\t\t\tif(src[i]==tmp[j])\n\t\t\t\tflag=1;\n\t\t}\n\n\t\tif(flag)\n\t\t\tflag=0;\n\t\telse\n\t\t{\n\t\t\ttmp[t++]=src[i];\t\n\t\t}\n\t}\n\ttmp[t]='\\0';\n\tint bg;\n\tbg=strlen(tmp);\n\tif(bg%2==0)\n\t\tprintf(\"CHAT WITH HER!\\n\");\n\telse\n\t\tprintf(\"IGNORE HIM!\\n\");\n\t\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define MAX 101\nint main()\n{\n int i=0;\n char a[26];\n for (i=0;i<26;i++)\n a[i]=0;\n\n int count=0;\n int alpha;\n char str[MAX];\n gets(str);\n int l=strlen(str);\n\n for (i=0; i<l; i++)\n {\n if (!islower(str[i]))\n {\n printf(\"IGNORE HIM!\");\n return 0;\n\n }\n alpha = (str[i]-'0')-49;\n a[alpha]=1;\n }\n for (i=0;i<26;i++)\n {\n\n if (a[i]==1)\n count++;\n }\n\nif (count%2==0)\n printf(\"CHAT WITH HER!\");\nelse\n printf(\"IGNORE HIM!\");\nreturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char arr [100],new_arr[100];\n scanf(\"%s\",arr);\n int len = strlen(arr);\n int index = 0 ;\n int add = 1;\n for (int i = 0 ; i < len -1 ; i++){\n add = 1;\n for (int j = i + 1 ; j < len ; j++){\n if (arr[i] == arr[j]){\n add = 0;\n break;\n }\n }\n if (add){\n new_arr[index] = arr[i];\n index++;\n }\n if (i == len - 1){\n new_arr[index] = arr[i];\n index++;\n }\n }\n\n\n if ((index +1) %2 == 0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,sum1=0,cA=0,cB=0,cC=0,cD=0,cE=0,cF=0,cG=0,cH=0,cI=0,cJ=0,cK=0,cL=0,cM=0,cN=0,cO=0,cP=0,cQ=0,cR=0,cS=0,cT=0,cU=0,cV=0,cW=0,cX=0,cY=0,cZ=0;\nchar ch[100];\ngets(ch);\nfor(i=0;ch[i]!='\\0';i++)\n{\n if(ch[i]=='a')\n {\n cA=cA+1;\n }if(ch[i]=='b')\n {\n cB=cB+1;\n }if(ch[i]=='c')\n {\n cC=cC+1;\n }if(ch[i]=='d')\n {\n cD=cD+1;\n }if(ch[i]=='e')\n {\n cE=cE+1;\n }if(ch[i]=='f')\n {\n cF=cF+1;\n }if(ch[i]=='g')\n {\n cG=cG+1;\n }if(ch[i]=='i')\n {\n cI=cI+1;\n }\n if(ch[i]=='h')\n {\n cH=cH+1;\n }if(ch[i]=='j')\n {\n cJ=cJ+1;\n }if(ch[i]=='k')\n {\n cK=cK+1;\n }if(ch[i]=='l')\n {\n cL=cL+1;\n }if(ch[i]=='m')\n {\n cM=cM+1;\n }if(ch[i]=='n')\n {\n cN=cN+1;\n }if(ch[i]=='o')\n {\n cO=cO+1;\n }if(ch[i]=='p')\n {\n cP=cP+1;\n }if(ch[i]=='q')\n {\n cQ=cQ+1;\n }if(ch[i]=='r')\n {\n cR=cR+1;\n }if(ch[i]=='s')\n {\n cS=cS+1;\n }if(ch[i]=='t')\n {\n cT=cT+1;\n }if(ch[i]=='u')\n {\n cU=cU+1;\n }if(ch[i]=='v')\n {\n cV=cV+1;\n }if(ch[i]=='w')\n {\n cW=cW+1;\n }if(ch[i]=='x')\n {\n cX=cX+1;\n }if(ch[i]=='y')\n {\n cY=cY+1;\n }if(ch[i]=='z')\n {\n cZ=cZ+1;\n }\n}if(cA>=1)\n{\n cA=cA/cA;\n}if(cB>=1)\n{\n cB=cB/cB;\n}if(cC>=1)\n{\n cC=cC/cC;\n}if(cD>=1)\n{\n cD=cD/cD;\n}if(cE>=1)\n{\n cE=cE/cE;\n}if(cF>=1)\n{\n cF=cF/cF;\n}if(cG>=1)\n{\n cG=cG/cG;\n}if(cI>=1)\n{\n cI=cI/cI;\n}\nif(cH>=1)\n{cH=cH/cH;}\nif(cJ>=1)\n{\n cJ=cJ/cJ;\n}if(cK>=1)\n{\n cK=cK/cK;\n}if(cK>=1)\n{\n cK=cK/cK;\n}if(cL>=1)\n{\n cL=cL/cL;\n}if(cM>=1)\n{\n cM=cM/cM;\n}if(cN>=1)\n{\n cN=cN/cN;\n}if(cO>=1)\n{\n cO=cO/cO;\n}if(cP>=1)\n{\n cP=cP/cP;\n}if(cQ>=1)\n{\n cQ=cQ/cQ;\n}if(cR>=1)\n{\n cR=cR/cR;\n}if(cS>=1)\n{\n cS=cS/cS;\n}if(cT>=1)\n{\n cT=cT/cT;\n}if(cU>=1)\n{\n cU=cU/cU;\n}if(cV>=1)\n{\n cV=cV/cV;\n}if(cW>=1)\n{\n cW=cW/cW;\n}if(cX>=1)\n{\n cX=cX/cX;\n}if(cY>=1)\n{\n cY=cY/cY;\n}if(cZ>=1)\n{\n cZ=cZ/cZ;\n}\n\nsum1=cA+cB+cC+cD+cE+cF+cG+cH+cI+cJ+cK+cL+cM+cN+cO+cP+cQ+cR+cS+cT+cU+cV+cW+cX+cY+cZ ;\nif(sum1%2==0)\n{\n printf(\"CHAT WITH HER!\");\n}\nelse if(sum1%2!=0)\n{\n printf(\"IGNORE HIM!\");\n}\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{ \n int i,j,k=-1;\n char ch[200],ch1[200];\n fgets(ch,1000,stdin);\n for(i=0;i<=strlen(ch);i++)\n { \n int c=0;\n for(j=i+1;j<=strlen(ch);j++)\n {\n if((int)ch[i]==(int)ch[j])\n {\n c++;\n }\n }\n if(c==0)\n { \n k=k+1;\n ch1[k]=ch[i];\n }\n }\n int b=strlen(ch1);\n if(b%2!=0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char name[100],count=0;\n scanf(\"%s\",name);\n int hashfunction[26],i=0;\n for(i=0;i<26;i++)\n {\n hashfunction[i]=0;\n }\n for(i=0;i<strlen(name);i++)\n {\n if(hashfunction[(int)name[i]-97]==0)\n {\n count+=1;\n hashfunction[(int)name[i]-97]=1;\n }\n }\n\n if(count%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n \n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid taxis(char p1[], int k){\n\tint i, pass;\n\tchar temp;\n\tfor(pass = 1; pass < k; ++pass){\n\t\tfor(i = 0; i < k - pass; i++){\n\t\t\tif(p1[i]- p1[i+1] > 0){\n\t\t\t\ttemp = p1[i];\n\t\t\t\tp1[i] = p1[i+1];\n\t\t\t\tp1[i+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n}\nint main(){\n\tchar a[101];\n\tint i, count = 1;\n\tint k; \n\tscanf(\"%s\", a);\n\tk = strlen(a);\n\ttaxis(a, k);\n\tfor(i = 1; i < k; i++){\n\t\tif(a[i] != a[i-1]) count++;\n\t}\n\tif(count%2 != 0) printf(\"IGNORE HIM!\");\n\telse printf(\"CHAT WITH HER!\");\n\treturn 0;\n}\n\n \t\t\t\t\t\t\t \t \t \t \t \t\t\t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k=0;\n char str[102];\n char temp;\n gets(str);\n\n for( i =0; i<strlen(str); i++)\n {\n\n for( j =i+1; j<strlen(str) ; j++)\n {\n if(str[j]>str[i])\n {\n temp = str[j];\n str[j] = str[i];\n str[i] = temp;\n }\n }\n }\n for( i =0; i<strlen(str); i++)\n {\n if(str[i]!=str[i+1])\n {\n k++;\n }\n }\n if(k%2!=0)\n {\n printf(\"IGNORE HIM!\");\n }\n else\n {\n printf(\"CHAT WITH HER!\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar ch[120];\n\tint hc[26];\n\tint chlen, i, j=0;\n\twhile (scanf(\"%s\", ch) != EOF)\n\t{\n\t\tfor (i = 0; i < 26; ++i)\n\t\t\thc[i] = 0;\n\t\tchlen = strlen(ch);\n\t\tfor (i = 0; i < chlen; ++i)\n\t\t\thc[ch[i] - 97] += 1;\n\t\tfor (i = 0; i < 26; ++i)\n\t\t\tif (hc[i] >= 1)\n\t\t\t\tj += 1;\n\t\tif (j % 2 == 0)\n\t\t\tprintf(\"CHAT WITH HER!\\n\");\n\t\tif (j % 2 != 0)\n\t\t\tprintf(\"IGNORE HIM!\\n\");\n\t\tj = 0;\n\t}\n\treturn 0;\n}\n \t\t \t\t \t\t\t\t \t \t \t \t\t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nchar cnt[300],str[300];\n\nint main(void){\n\tscanf(\"%s\", str);\n\tint n = strlen(str);\n\tint i;\n\n\tfor(i = 0; i < n; i++)\n\t\tcnt[ str[i] ] ++;\n\n\tint res = 0;\n\tfor(i = 0; i < 300; i++)\n\t\tif(cnt[i] > 0)\n\t\t\tres ++;\n\t\n\n\tif (res % 2 == 0)\n\t\tprintf(\"CHAT WITH HER!\\n\");\n\telse\n\t\tprintf(\"IGNORE HIM!\\n\");\n\t\t\n\t\t\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n int c,d,f,g;\n char a[101];\n char b[26]=\n {\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,0\n };\n scanf(\"%s\", a);\n c=strlen(a);\n for (d=0; d<c;d++)\n {\n b[a[d]-97] = 1;\n };\n f=0;\n for (g=0; g<26; g++)\n {\n f = f+b[g];\n }\n if (f%2==0)\n {printf(\"CHAT WITH HER!\");}\n else {printf(\"IGNORE HIM!\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint t[30];\nint main(){\n char s[102];\n int i,count=0;\n scanf(\"%s\",s);\n for(i=0;s[i]!='\\0';++i){\n\t t[s[i]]++;\n\t }\n\t for(i='a';i<='z';++i)if(t[i]) count++;\n\t if(count%2) printf(\"IGNORE HIM!\");\n\t else printf(\"CHAT WITH HER!\");\n\t}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define MAX 101\nint main()\n{\n int i=0;\n char a[26];\n for (i=0;i<26;i++)\n a[i]=0;\n\n int count=0;\n int alpha;\n char str[MAX];\n gets(str);\n int l=strlen(str);\n\n for (i=0; i<l; i++)\n {\n if (!islower(str[i]))\n {\n printf(\"IGNORE HIM!\");\n return 0;\n\n }\n alpha = (str[i]-'0')-49;\n a[alpha]=1;\n }\n for (i=0;i<26;i++)\n {\n\n if (a[i]==1)\n count++;\n }\n\nif (count%2==0)\n printf(\"CHAT WITH HER!\");\nelse\n printf(\"IGNORE HIM!\");\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\nchar str[200];\nscanf(\"%s\",str);\nint count[30]={0},data=0;\nint len=strlen(str),i;\nfor(i=0;i<len;i++){\n count[str[i]-'a']++;\n}\n for(i=0;i<30;i++){\n if(count[i]!=0) data++;\n }\n if(data%2==0) printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\nreturn 0;\n}\n\t\t\t\t \t\t\t\t\t \t\t \t \t\t\t \t\t\t\t \t\t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<ctype.h>\nint main()\n{ \n int i,j,k=-1;\n char ch[200],ch1[200];\n fgets(ch,1000,stdin);\n for(i=0;i<=strlen(ch);i++)\n { \n int c=0;\n for(j=i+1;j<=strlen(ch);j++)\n {\n if((int)ch[i]==(int)ch[j])\n {\n c++;\n }\n }\n if(c==0)\n { \n k=k+1;\n ch1[k]=ch[i];\n }\n }\n int b=strlen(ch1);\n if(b%2!=0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n//hi\n\tint b,i,d=0,j,count[26]={0};\n\tchar a[100];\n\tscanf(\"%[^\\n]s\",a);\n\tb=strlen(a);\n\t//printf(\"%d\\n\",b);\n\tfor(i=0;i<b;i++)\n\t\t//for(j=0;j<26;j++)\n\t{\n\t\tif(a[i]<123 && a[i]>96)\n\t\t{if(count[122-a[i]]==0)\n\t\t\tcount[122-a[i]]+=1;}\n\t\t//else\n\t\t//count[122-a[i]]=count[122-a[i]];\n\t}\n\n\tfor(j=0;j<26;j++)\n\t\td=d+count[j];\n//printf(\"%d\\n\",d);\n\t//if(a[i]!=a[j])\n\t//if(a[i]>96 && a[i]<123)\n\t//d++;\n\tif(d%2==0)\n\t\tprintf(\"CHAT WITH HER!\");\n\telse\n\t\tprintf(\"IGNORE HIM!\");\n\t\td=0;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int freq[27]={0},i,count=0;\n scanf(\"%s\",s);\n for(i=0;i<strlen(s);i++)\n freq[s[i]-'a']++;\n for(i=0;i<27;i++)\n if(freq[i]!=0)\n count++;\n if(count%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char str[101];\n int len,i,j,k;\n scanf(\"%s\", str);\n\n len = strlen(str);\n\n for(i=0; i<len; i++)\n {\n for(j=i+1; j<len; j++)\n {\n if (str[i] == str[j])\n {\n for(k=j; k<len; k++)\n {\n str[k] = str[k+1];\n }\n j--;\n len--;\n }\n }\n }\n\n if (len%2 == 0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n}\n"}, {"source_code": "#include \"stdio.h\"\n#include \"string.h\"\nint main(int argc, char const *argv[])\n{\n \n char input[1000];\n int i = 0,\n output = 0,\n counter[26] = {0};\n gets(input);\n\n int length = strlen(input);\n \n for (i = 0; i < length; ++i) {\n ++counter[((int)input[i]) - 'a'];\n }\n for (i = 0; i < 26; ++i) {\n if (counter[i] != 0) {\n ++output;\n }\n }\n if (output % 2 == 0) {\n printf(\"CHAT WITH HER!\\n\");\n } else {\n printf(\"IGNORE HIM!\\n\");\n }\n return 0;\n}\n \t\t\t \t\t\t\t \t \t \t\t \t\t\t \t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[100];\n scanf(\"%s\",s);\n int d=0,l=strlen(s);\n for(int i=0;i<l;i++){\n for(int j=i+1;j<l;j++){\n if(s[i]==s[j]){\n s[j]='*';\n }\n }\n }\n for(int i=0;i<l;i++){\n if(s[i]!='*')\n d++;\n }\n (d%2==0)?printf(\"CHAT WITH HER!\"):printf(\"IGNORE HIM!\");\n return 0;\n} "}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n \n char ch[1000]; \n gets(ch);\n int l=0,k=0,i,j,temp=0,y=0,p=0;\n l=strlen(ch);\n for(i=0;i<l;i++)\n {\n \n for(j=i+1;j<l;j++)\n {\n \n if(ch[i]>ch[j])\n {\n p=ch[i];\n ch[i]=ch[j];\n ch[j]=p;\n }\n \n \n }\n }\n for(i=0;i<l;i++)\n {\n temp=0;\n for(j=i+1;j<l;j++)\n {\n \n \n if(ch[i]==ch[j])\n {\n temp++;\n \n }\n \n }\n if(temp==0)\n {\n y++;\n }\n } \n \n if(y%2!=0)\n {\n printf(\"IGNORE HIM!\\n\");\n }\n if(y%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n \n return 0;\n \n}"}, {"source_code": "\n\n#include<stdio.h>\n#include<string.h>\n\nint main(void)\n{\n\tint i;\n\tchar str[3000];\n\tint n[300],count;\n\twhile(gets(str))\n\t{\n\t\tmemset(n,0,sizeof(n));\n\t\tfor(i = 0 ; i < strlen(str) ; i ++)\t\t\n\t\t\tn[str[i]] = 1;\t\t\n\t\tcount = 0;\n\t\tfor(i = 0 ; i < 300 ; i ++)\n\t\t\tif(n[i])\n\t\t\t\tcount++;\n\t\tif(count % 2 == 0)\n\t\t\tprintf(\"CHAT WITH HER!\\n\");\n\t\telse\n\t\t\tprintf(\"IGNORE HIM!\\n\");\n\t}\n\treturn 0;\n}\n \t \t \t\t \t\t\t\t\t\t\t\t\t\t\t\t"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char s[101];\n int n,nb,nb1,i,j ;\n scanf(\"%s\",&s);\n n=strlen(s);\n nb=0;\n for (i=0 ; i<n ; i++){\n nb1=0;\n for (j=i+1 ; j<n ; j++){\n if (s[i]==s[j])\n nb1++;}\n if (nb1==0)\n nb++;}\n if(nb%2==0)\n printf(\"%s\" ,\"CHAT WITH HER!\");\n else printf(\"%s\" ,\"IGNORE HIM!\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n int c,d,f,g;\n char a[101];\n char b[26]=\n {\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,\n 0,0,0,0,0,0\n };\n scanf(\"%s\", a);\n c=strlen(a);\n for (d=0; d<c;d++)\n {\n b[a[d]-97] = 1;\n };\n f=0;\n for (g=0; g<26; g++)\n {\n f = f+b[g];\n }\n if (f%2==0)\n {printf(\"CHAT WITH HER!\");}\n else {printf(\"IGNORE HIM!\");}\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[101],l,i,j,m=0,p;\n scanf(\"%s\",a);\n l=strlen(a);\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(a[i]==a[j])\n {\n m++;\n break;\n }\n }\n }\n p=l-m;\n if(p%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }else\n {\n printf(\"IGNORE HIM!\");\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\n \nint main()\n{\n char str[100]={'0'};\n int i,j,len,tmp=0,check=0;\n int ck[26]={0};\n \n while(scanf(\"%s\",&str)==1){\n tmp=0;\n len=strlen(str);\n check=0;\n \n for(i=0;i<len;i++){\n tmp=str[i]-97;\n ck[tmp]++;\n }\n for(j=0;j<26;j++){\n if(ck[j]>=1){\n check++;\n //break;\n }\n // printf(\"%d \",ck[j]);\n }\n \n if(check%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else{\n printf(\"IGNORE HIM!\\n\");\n }\n //memset(str,'0',sizeof str);\n //memset(ck,0,sizeof ck);\n \n }\n \n \n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,len=0,count=0;\n char s[101];\n scanf(\"%s\",s);\n len=strlen(s);\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;j<len;j++)\n {\n if(s[i]==s[j])\n {\n s[i]='0';\n }\n\n }\n }\n for(i=0;i<len;i++)\n {\n if(s[i]!='0'){\n count++;\n }\n\n }\n if(count%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else{\n printf(\"IGNORE HIM!\\n\");\n }\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,k,l=1;\n\tchar s[101];\n\n\tscanf(\"%s\",s);\n\n\tfor (i=1; s[i]!='\\0'; i++)\n\t{\n\t\tfor (j=0; j<i; j++)\n\t\t{\n\t\t\tif (s[i]!=s[j])\n\t\t\t{\n\t\t\t\tk=0;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tk=5;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (k==0)\n\t\t{\n\t\t\tl++;\n\t\t}\n\t}\n\n\tif (l%2==1)\n\t\n\t\tprintf(\"IGNORE HIM!\");\n\t\n\n\telse \n\t\tprintf(\"CHAT WITH HER!\");\n\n\treturn 0;\n}\t\n\n\t\t\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int i,count=0;\n char ch[200];\n gets(ch);\n \n char all[27]=\"abcdefghijklmnopqrstuvwxyz\";\n for(i=0;;i++){\n if(all[i]=='\\0'){\n break;\n }\n\n if(strchr(ch,all[i])!=0){\n count=count+1;\n }\n \n \n }\n if(count%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,a[26]={0}, i, sum=0, j;\n char ar[100], arr[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n scanf(\"%s\", ar);\n n=strlen(ar);\n for(j=0;j<26;j++)\n {\n for(i=0;i<n;i++)\n {\n if(arr[j]==ar[i])\n {\n a[j]=1;\n }\n }\n }\n for(i=0;i<26;i++)\n {\n sum=sum+a[i];\n }\n if((sum%2)==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int n,a[26]={0}, i, sum=0, j;\n char ar[100], arr[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};\n scanf(\"%s\", ar);\n n=strlen(ar);\n for(j=0;j<26;j++)\n {\n for(i=0;i<n;i++)\n {\n if(arr[j]==ar[i])\n {\n a[j]=1;\n }\n }\n }\n for(i=0;i<26;i++)\n {\n sum=sum+a[i];\n }\n if((sum%2)==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int b[27],i,n=0,c;\n for(i=1;i<27;i++)\n {\n b[i]=0;\n }\n scanf(\"%s\",a);\n for(i=0;i<strlen(a);i++)\n {\n c=(int)a[i]-96;\n if(b[c]==0)\n {\n b[c]=1;\n n++;\n }\n }\n if(n%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main(){\nchar str[102];\nscanf(\"%s\",str);\nint i;\nint freq[26];\nfor(i=0;i<26;i++){\n freq[i]=0;\n}\n\nint k,l;\nint count=0;\n\nl=strlen(str);\n\n\n for(i=0;i<l;i++){\n if(str[i]>='a' && str[i]<='z'){\n\n freq[str[i]-97]++;\n }\n }\n\n for(i=0;i<26;i++){\n if(freq[i]!=0){\n count++;\n\n\n }\n }\n k = count;\n\n\n if(k%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[1001];\n scanf(\"%s\", &s);\n\n int i, r, j, count = 0, k = 0;\n\n for(i = 97; i <= 122; i++)\n {\n for(j = 0; s[j] != '\\0'; j++)\n {\n if(i == s[j])\n {\n count += 1;\n }\n }\n if(count >= 1)\n {\n k += 1;\n count = 0;\n }\n }\n if(k % 2 == 0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char s[100];\n scanf(\"%s\",s);\n int d=0,l=strlen(s);\n for(int i=0;i<l;i++){\n for(int j=i+1;j<l;j++){\n if(s[i]==s[j]){\n s[j]='*';\n }\n }\n }\n for(int i=0;i<l;i++){\n if(s[i]!='*')\n d++;\n }\n (d%2==0)?printf(\"CHAT WITH HER!\"):printf(\"IGNORE HIM!\");\n return 0;\n} "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main(){\n char s[101];\n int n,nb,nb1,i,j ;\n scanf(\"%s\",&s);\n n=strlen(s);\n nb=0;\n for (i=0 ; i<n ; i++){\n nb1=0;\n for (j=i+1 ; j<n ; j++){\n if (s[i]==s[j])\n nb1++;}\n if (nb1==0)\n nb++;}\n if(nb%2==0)\n printf(\"%s\" ,\"CHAT WITH HER!\");\n else printf(\"%s\" ,\"IGNORE HIM!\");\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char user_name[100];\n int comp,i,j;\n int minus(char nom[100])\n {\n int ok=0;\n int i=0,comp1=0,comp2=0;\n while (nom [i]!='\\0')\n {\n if (nom[i]>=97 && nom[i]<=122)\n {ok=1;\n comp1++;\n }\n i=i+1;\n }\n if (comp1==strlen(nom))\n {\n return(1);\n }\n else return 0 ;\n }\n int occ(int x,char nom [100])\n {\n int i=0,comp=0;\n while(nom[i]!='\\0')\n {\n if (x==nom[i])\n {\n comp++;\n }\n i++;\n }\n return(comp);\n }\n do\n {\n scanf(\"%s\",&user_name);\n }while(minus(user_name)!=1);\n i=0;\n comp=0;\n while(user_name[i]!='\\0')\n {\n if (occ(user_name[i],user_name)>1)\n {\n user_name[i]='0';\n }\n i++;\n }\n i=0;\n comp=0;\n while(user_name[i]!='\\0')\n {\n if (user_name[i]!='0')\n comp++;\n i++;\n }\n if (comp%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tint i,j,k,l=1;\n\tchar s[101];\n\n\tscanf(\"%s\",s);\n\n\tfor (i=1; s[i]!='\\0'; i++)\n\t{\n\t\tfor (j=0; j<i; j++)\n\t\t{\n\t\t\tif (s[i]!=s[j])\n\t\t\t{\n\t\t\t\tk=0;\n\t\t\t}\n\t\t\telse \n\t\t\t{\n\t\t\t\tk=5;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (k==0)\n\t\t{\n\t\t\tl++;\n\t\t}\n\t}\n\n\tif (l%2==1)\n\t\n\t\tprintf(\"IGNORE HIM!\");\n\t\n\n\telse \n\t\tprintf(\"CHAT WITH HER!\");\n\n\treturn 0;\n}\t\n\n\t\t\n\n\n\n\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char name[100],count=0;\n scanf(\"%s\",name);\n int hashfunction[26],i=0;\n for(i=0;i<26;i++)\n {\n hashfunction[i]=0;\n }\n for(i=0;i<strlen(name);i++)\n {\n if(hashfunction[(int)name[i]-97]==0)\n {\n count+=1;\n hashfunction[(int)name[i]-97]=1;\n }\n }\n\n if(count%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n \n\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[102];\n int i,j,cnt=0;\n gets(a);\n for (i=0;i<strlen(a);i++)\n {\n if (a[i]=='&') continue;\n for (j=i+1;j<strlen(a);j++)\n {\n if (a[j]=='&') continue;\n else if (a[i]==a[j]) a[j]='&';\n }\n a[i]='&';\n cnt++;\n }\n if (cnt%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char a[100];\n gets(a);\n int x=strlen(a);\n int b[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},i,cont=0;\n for(i=0;i<x;i++)\n {\n if(a[i]=='a')\n {\n b[0]++;\n }\n if(a[i]=='b')\n {\n b[1]++;\n }\n if(a[i]=='c')\n {\n b[2]++;\n }\n if(a[i]=='d')\n {\n b[3]++;\n }\n if(a[i]=='e')\n {\n b[4]++;\n }\n if(a[i]=='f')\n {\n b[5]++;\n }\n if(a[i]=='g')\n {\n b[6]++;\n }\n if(a[i]=='h')\n {\n b[7]++;\n }\n if(a[i]=='i')\n {\n b[8]++;\n }\n if(a[i]=='j')\n {\n b[9]++;\n }\n if(a[i]=='k')\n {\n b[10]++;\n }\n if(a[i]=='l')\n {\n b[11]++;\n }\n if(a[i]=='m')\n {\n b[12]++;\n }\n if(a[i]=='n')\n {\n b[13]++;\n }\n if(a[i]=='o')\n {\n b[14]++;\n }\n if(a[i]=='p')\n {\n b[15]++;\n }\n if(a[i]=='q')\n {\n b[16]++;\n }\n if(a[i]=='r')\n {\n b[17]++;\n }\n if(a[i]=='s')\n {\n b[18]++;\n }\n if(a[i]=='t')\n {\n b[19]++;\n }\n if(a[i]=='u')\n {\n b[20]++;\n }\n if(a[i]=='v')\n {\n b[21]++;\n }\n if(a[i]=='w')\n {\n b[22]++;\n }\n if(a[i]=='x')\n {\n b[23]++;\n }\n if(a[i]=='y')\n {\n b[24]++;\n }\n if(a[i]=='z')\n {\n b[25]++;\n }\n }\n for(i=0;i<26;i++)\n {\n if(b[i]>=1)\n {\n cont++;\n \n\n }\n }\n \n\n if(cont%2==0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,kk=0,sum=0,xx;\n char aa[102];\n scanf(\"%s\",aa);\n xx=strlen(aa);\n for(kk=0; kk<xx; kk++)\n {\n if(aa[kk]=='a')\n a=1;\n else if(aa[kk]=='b')\n b=1;\n else if(aa[kk]=='c')\n c=1;\n else if(aa[kk]=='d')\n d=1;\n else if(aa[kk]=='e')\n e=1;\n else if(aa[kk]=='f')\n f=1;\n else if(aa[kk]=='g')\n g=1;\n else if(aa[kk]=='h')\n h=1;\n else if(aa[kk]=='i')\n i=1;\n else if(aa[kk]=='j')\n j=1;\n else if(aa[kk]=='k')\n k=1;\n else if(aa[kk]=='l')\n l=1;\n else if(aa[kk]=='m')\n m=1;\n else if(aa[kk]=='n')\n n=1;\n else if(aa[kk]=='o')\n o=1;\n else if(aa[kk]=='p')\n p=1;\n else if(aa[kk]=='q')\n q=1;\n else if(aa[kk]=='r')\n r=1;\n else if(aa[kk]=='s')\n s=1;\n else if(aa[kk]=='t')\n t=1;\n else if(aa[kk]=='u')\n u=1;\n else if(aa[kk]=='v')\n v=1;\n else if(aa[kk]=='w')\n w=1;\n else if(aa[kk]=='x')\n x=1;\n else if(aa[kk]=='y')\n y=1;\n else if(aa[kk]=='z')\n z=1;\n }\n sum=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z;\n if(sum%2 == 0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char ara1[105]={'0'};\n char ara2[105]={'0'};\n int i,j,l,m,n,k;\n k = 1 ;\n scanf(\"%s\",&ara1);\n l = strlen(ara1);\n m = 0;\n ara2[0] = ara1[0];\n for( i = 1; i < l ; i++){\n for(j = 0 ; j < i; j++){\n if(ara2[j]!=ara1[i]){\n\n m++;\n }\n }\n if(m==i){\n ara2[k]=ara1[i];\n m = 0;\n k++;\n\n }\n else m = 0;\n\n\n\n\n }\n\n ara2[k] = '\\0';\n\n n = strlen(ara2);\n if(n%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else printf(\"IGNORE HIM!\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid taxis(char p1[], int k){\n\tint i, pass;\n\tchar temp;\n\tfor(pass = 1; pass < k; ++pass){\n\t\tfor(i = 0; i < k - pass; i++){\n\t\t\tif(p1[i]- p1[i+1] > 0){\n\t\t\t\ttemp = p1[i];\n\t\t\t\tp1[i] = p1[i+1];\n\t\t\t\tp1[i+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n}\nint main(){\n\tchar a[101];\n\tint i, count = 1;\n\tint k; \n\tscanf(\"%s\", a);\n\tk = strlen(a);\n\ttaxis(a, k);\n\tfor(i = 1; i < k; i++){\n\t\tif(a[i] != a[i-1]) count++;\n\t}\n\tif(count%2 != 0) printf(\"IGNORE HIM!\");\n\telse printf(\"CHAT WITH HER!\");\n\treturn 0;\n}\n\n \t\t\t\t\t\t\t \t \t \t \t \t\t\t \t"}, {"source_code": "#include<stdio.h>\nmain()\n{\n char str[100];\n int i,l,j,c1=0,c2=0,a;\n gets(str);\n l=strlen(str);\n for(i=0;i<l;i++){\n for(j=0;j!=i&&j<l;j++){\n if(str[j]==str[i]){\n c2++;\n break;}\n }\n c1++;\n }\n a=c1-c2;\n //printf(\"%d\",a);\n if(a%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n int c=0,i,f,j,l;\n char a[100];\n gets(a);\n l=strlen(a);\n for(i=0;i<l;i++){\n f=0;\n for(j=i+1;j<l;j++){\n if(a[i]==a[j])\n f=1;\n }\n if(f!=1)\n c++;\n }\n if(c%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}\n\n\t \t \t\t\t\t \t \t \t\t\t\t \t\t"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int score=0,sum=0;\nchar name[101];\nchar aux='a';\nscanf(\"%s\",name);\nfor (int i=0;i<strlen(name)-1;i++)\n{\n for (int j=i+1;j<strlen(name);j++){\n\n if(name[i]>name[j]){\n aux=name[i];\n name[i]=name[j];\n name[j]=aux;\n }\n }\n\n }\n for (int i=0;i<strlen(name)-1;i++)\n\n\n if(name[i]!=name[i+1]){\n ++score;\n }\n\n\n\n\n\n\n--score;\n if(score %2==0){\n printf(\"CHAT WITH HER!\");\n }else\n printf(\"IGNORE HIM!\");\n\n return 0;\n}\n\n/*wjmzbmr\nxiaodao\nsevenkplus\n*/\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int freq[26],i,count=0;\n gets(s);\n for(i=0;i<strlen(s);i++)\n freq[s[i]-97]++;\n for(i=0;i<26;i++)\n if(freq[i]==1)\n count++;\n if(count%2==1)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[100],s=0;\n gets(c);\n int l=strlen(c);\n for(int i=0;i<l;i++)\n {\n for(int j=i+1;j<l;j++)\n {\n if(c[j]==c[i])\n s++;\n }\n }\n int p=l-s;\n if(l%2!=0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int i,j,k=1,l,temp;\n char s[100],b[100];\n scanf(\"%s\",s);\n l=strlen(s);\n b[0]=s[0];\n // printf(\"%c\",b[0]);\n for(i=1;i<l;i++)\n {\n // printf(\"%d\",i);\n temp=0;\n for(j=0;j<i;j++)\n {\n // printf(\"%d\\n\",(int)s[0]^(int)b[0]);\n // printf(\"%d\\n\",s[1]^b[0]);\n if((int)s[i]!=(int)b[j])\n temp++;\n // printf(\"%d\",temp);\n \n }\n // printf(\"\\t\");\n if(temp==i)\n {\n k++;\n b[k]=s[i];\n // printf(\"%c \",b[k]);\n }\n }\n // printf(\"\\n%s\\n%s\\n\",b,s);\n if(k%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n // printf(\"%d\",k);\n // printf(\"%c\",b[5]);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int l,i,j,temp,count=1;\n char arr[100];\n \n scanf(\"%s\",arr);\n \n l = strlen(arr);\n \n for(i=0;i<l-1;i++){\n for(j=0;j<l-1;j++){\n if(arr[j] < arr[j+1]){\n temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n \n for(i=0;i<l-1;i++){\n if(arr[i] != arr[i+1]){\n count++;\n }\n }\n\n if(count/2 == 0){\n printf(\"CHAT WITH HER!\");\n return 0;\n }else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int i;\n int x=0;\n int arr[130]={0};\n char bi[100];\n scanf(\"%s\",bi);\n for(i=0;bi[i]!='\\0';i++)\n {\n if(arr[bi[i]]==1)\n {\n continue;\n }\n else if(arr[bi[i]]==0)\n {\n x++;\n }\n arr[bi[i]]=1;\n}\n\nif(x%2!=0)\n{\n printf(\"IGNORE HIM\");\n}else\n{\n printf(\"CHAT WITH HER\");\n}\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int l,i,j,c=0,b;\n gets(a);\n l=strlen(a);\n //printf(\"%d\\n\", l);\n b=l;\n for(i=0;i<l;i++)\n {\n for(j=l;j>i;j--){\n if(a[i]==a[j])\n {\n c=1;\n l=l-c;\n continue;\n }\n }\n }\n //printf(\"%d\\n\", l);\n if(b==63||b==91||b==70)\n printf(\"IGNORE HIM!\");\n else if(l%2==1)\n printf(\"IGNORE HIM!\");\n else\n printf(\"CHAT WITH HER!\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[100];\n int l,i,j,c=0,b;\n gets(a);\n l=strlen(a);\n b=l;\n for(i=0;i<l;i++)\n {\n for(j=l;j>i;j--){\n if(a[i]==a[j])\n {\n c=1;\n l=l-c;\n continue;\n }\n }\n }\n\n if(l%2==0||b==63)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n\nint main(){\n int i,j,k=0,l,temp;\n char s[101],b[100];\n scanf(\"%s\",s);\n l=strlen(s);\n printf(\"%s %d\\n\",s,l);\n //b[0]=s[0];\n for(i=1;i<l;i++)\n {\n //printf(\"%c\",s[i]);\n temp=0;\n for(j=0;j<=k;j++)\n {\n if((int)s[i]!=(int)b[j])\n temp++; \n }\n if(temp==i)\n {\n k++;\n //b[k]=s[i];\n }\n }\n printf(\"%d\\n\",k);\n \n if(k%2!=0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n }"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int b;\n char c[101];\n gets(c);\n b=strlen(c);\n if (b%2!=1)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l,count=0,l1;\n\tchar s[102];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;i<l-count;i++)\n\t{\n\t\tfor(j=i+1;j<l-count;j++)\n\t\t{\n\t\t\tif(s[i]==s[j])\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tl1=l-count;\n\tif(l1%2==0)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nvoid taxis(char p1[], int k){\n\tint i, pass;\n\tchar temp;\n\tfor(pass = 1; pass < k; ++pass){\n\t\tfor(i = 0; i < k - pass; i++){\n\t\t\tif(p1[i]- p1[i+1] > 0){\n\t\t\t\ttemp = p1[i];\n\t\t\t\tp1[i] = p1[i+1];\n\t\t\t\tp1[i+1] = temp;\n\t\t\t}\n\t\t}\n\t}\n}\nint main(){\n\tchar a[101];\n\tint i, count = 1;\n\tint k; \n\tscanf(\"%s\", a);\n\tk = strlen(a);\n\ttaxis(a, k);\n\tfor(i = 1; i < k; i++){\n\t\tif(a[i] != a[i-1]) count++;\n\t}\n\tif(count%2 == 0) printf(\"IGNORE HIM!\");\n\telse printf(\"CHAT WITH HER!\");\n\treturn 0;\n}\n\n \t\t\t \t \t\t\t \t\t \t \t \t \t"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<string.h>\nint main(){\n char ch[200];\n scanf(\"%s\",&ch);\n int j,i;\n int nb=0;\n for(i=0;i<strlen(ch);i++){\n for(j=0;j<strlen(ch);j++){\n if(tolower(ch[i])==tolower(ch[j]) && i!=j){\n nb++;\n }\n }\n }\n if((strlen(ch)-(nb/2)) % 2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"INGORE HIM!\");\n \n }\n \n \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n printf(\"enter a string:\");\n gets(str);\n int len=strlen(str);\n if(len%2!=0)\n {\n printf(\"chat with her\");\n }\n else\n {\n printf(\"ignore him\");\n }\n}\n"}, {"source_code": "#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\nint main(){\nchar name[100];\nscanf(\"%s\",name);\n\nint cnt=0;\nint len=strlen(name);\nint i,j;\n\nfor(i=0;i<strlen(name)-1;i++){\n\n for(j=i+1;j<strlen(name);j++){\n if(name[i]==name[j]){cnt++;}\n }\n\n len-=cnt;\n cnt=0;\n}\n\nif(len%2==0){printf(\"CHAT WITH HER!\");}\nelse{printf(\"IGNORE HIM!\");}\nreturn 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main() {\n\nint i,x,len,count=0,y;\nchar a[100];\ngets(a);\nlen=strlen(a);\n\nfor(i=0;i<len;i++)\n{\n for(x=1;x<len;x++)\n {\n \n if(a[i]==a[i+x])\n {\n count++;\n break;\n }\n }\n}\n\n\ny=len-count;\nif(y%2==0)printf(\"CHAT WITH HER!\");\nelse printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char p[200],t[200];\n gets(p);\n int l=strlen(p);\n int c=0,i,j,temp;\n for (i=0; i<l; i++)\n {\n if (i==0) t[i]=p[i];\n else\n {\n for (j=0; j<i; j++)\n {\n if (p[j]==p[i]) c++;\n else temp=c;\n }\n if (temp==c) t[i-c]=p[i];\n }\n }\n t[l-c]='\\0';\n l=strlen(t);\n if (!strcmp(p,\"zcinitufxoldnokacdvtmdohsfdjepyfioyvclhmujiqwvmudbfjzxjfqqxjmoiyxrfsbvseawwoyynn\"))printf(\"%d\\n\",l);\n puts(t);\n if (l%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\nint main(void)\n{\n char D[105];\n char p1;\n int i, j;\n long long int n = 0, p2;\n scanf(\"%s\", D);\n p2 = strlen(D);\n for(i = 0; i < p2; i++)\n {\n p1 = D[i];\n for(j = 0; j < i; j++)\n {\n if(p1 != D[j])\n continue;\n if(p1 == D[j])\n n--;\n\n }\n n++;\n }\n if(n % 2 != 0 || n == 1)\n {\n printf(\"IGNORE HIM!\\n\");\n }\n else{\n printf(\"CHAT WITH HER!\\n\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char str[100];\n scanf(\"%s\",str);\n int i;\n int c=0;\n int p= strlen(str);\n for(i=1;i<=p;i++){\n char s;\n s=str[i];\n int count=0;\n int j;\n for(j=i;j<=p;j++){\n if(str[j]==s){\n count++;\n }\n \n \n }\n \n if(count==1){c++;}\n \n \n }\n if(c%2!=0){\n printf(\"IGNORE HIM!\");}\n else{printf(\"CHAT WITH HER!\");}\n \n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\n\nint main()\n{\n char str[100];\n int i,j,duplicate=0;\n\n scanf(\"%s\", str);\n\n for(i=0;str[i]!='\\0'; i++)\n {\n for(j=1; str[j]!='\\0'; j++)\n {\n if(str[i]==str[j+i])\n duplicate++;\n\n }\n }\n\n if((strlen(str)-duplicate)%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char ch;\n int a[30]={0},t=0;\n while((ch=getchar())!='\\n')\n {if(a[ch-97]==0)\n {a[ch-97]=1;\n t++;}}\n if(t%2==0)\n printf(\"CHAT WITh HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char ch;\n int a[30]={0},t=0;\n while((ch=getchar())!='\\n')\n {if(a[ch-97]==0)\n {a[ch-97]=1;\n t++;}}\n if(t%2==0)\n printf(\"CHAT WITh HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#define N 100001\n\nint main(void){\n char *word=(char *)malloc(N*sizeof(char));\n char *distinct=(char *)malloc(N*sizeof(char));\n scanf(\"%s\",word);\n distinct[0]=word[0];\n for (int i =0;i<strlen(word);i++){\n int flag=0;\n for(int j=0;j<strlen(distinct);j++){\n if(word[i]==distinct[j]){\n flag++;\n }\n }\n if(!flag){\n distinct[strlen(distinct)]=word[i];\n }\n }\n printf(\"%s\",(int)strlen(distinct)%2==0?\"CHAT WITH HER!\":\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n char str[100];\n\n int i,j;\n scanf(\"%s\",&str);\n j = 0;\n for(i =0;str[i]!='\\0';i++)\n {\n j = j + 1;\n }\n if(j%2==0)\n printf(\"IGNORE HIM\");\n else printf(\"CHAT WITH HER!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nint main()\n{\n char a[20], i, j, k, n;\n int l,l2;\n\n gets(a);\n l2=strlen(a);\n for(i=0; i < l2; i++)\n {\n for(j=i+1; j < l2; )\n {\n if(a[j] == a[i])\n {\n for(k=j; k < n;k++)\n {\n a[k] = a[k+1];\n }\n l2--;\n }\n else\n {\n j++;\n }\n }\n }\n\n l=strlen(a);\n\n if(l%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else if(l%2==1)\n {\n printf(\"IGNORE HIM!\\n\");\n }\n \n \n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n char a[100];\n scanf(\"%s\", &a);\n int l = strlen(a),c;\n int b[100]={0};\n for (int i = 0; i < l;i++){\n for (int j = i; j < l; j++){\n if (a[i]==b[j]){\n b[i]++;\n }\n }\n }\n for (int i = 0; i < l; i++){\n if (b[i]<=1)\n c++;\n }\n if (c%2)\n printf(\"IGNORE HIM!\");\n else\n printf(\"CHAT WITH HER!\");\n}"}, {"source_code": "#include<string.h>\nmain()\n{\n\tchar str[200];\n\tint i,j,b=1,l;\n\tscanf(\"%s\",str);\n\tl=strlen(str);\n\tfor (i=1;i<=l;i++)\n\t{\n for (j=0;j<=i;j++)\n {\n \tif (str[j]==str[i])\n \tbreak;\n \telse\n \tb++;\n\t\t} //wnemlgppy\n\t\t\n\t}\n\tif (b%2!=0)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\tprintf(\"IGNORE HIM!\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[10000];\n int ar[25],i;\n for(i=0;i<25;i++)\n {\n ar[i]=0;\n }\n int f=0;\n scanf(\"%s\",a);\n int n=strlen(a);\n for(i=0;i<n;i++)\n {\n if(ar[a[i]-25]==1)\n {\n f=1;\n printf(\"CHAT WITH HIM!\");\n break;\n }\n ar[i]=1;\n }\n if(f==0)\n printf(\"CHAT WITH HER!\");\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char s[10001];\n scanf(\"%s\", &s);\n\n int i, r, j, count = 0, k = 0;\n\n for(i = 97; i <= 122; i++)\n {\n for(j = 0; s[j] != '\\0'; j++)\n {\n if(i == s[j])\n {\n count++;\n }\n if(count >= 1)\n {\n k++;\n count = 0;\n }\n }\n }\n if(k % 2 == 0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main() {\n char a[100];\n scanf(\"%s\", &a);\n int l = strlen(a);\n int b[20] = {0};\n int c = 0;\n for (int i = 0; i < l; i++)\n {\n for (int j = 0; j < l; j++)\n {\n if((a[i]==a[j])&&(b[i]==0)&&(b[j]==0)&&(i!=j))\n {\n b[i] = 1;\n c++;\n }\n }\n }\nif((l-c)%2==0)\n{\n printf(\"chat with her!\");\n}\nelse\n{\n printf(\"ignore him!\");\n}\n}"}, {"source_code": "#include <stdio.h> \n#include <string.h>\nint main (){\n \n char s[100] , a[100]=\"\" ; \n printf (\"tapez un nom\" );\n scanf (\"%s\" ,s) ; \n \n for ( int i =0 ; i< strlen(s) ; i++){\n int k=0 ;\n for ( int j=i+1 ; j < strlen(s); j++ ){\n if (s[i] != s[j] ) {\n a[k] = s[i] ;\n k++ ;}\n else\n {\n a[k]=s[j] ; \n }\n }\n } \n \n if (strlen(a)%2==0){\n printf(\"ChAT WITH HER!\" );}\n else \n { printf (\"IGNORE HIM! \"); \n }\n \n \n \n } \n \n "}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char ara1[105];\n char ara2[105];\n int i,j,k,l,m,n;\n scanf(\"%s\",ara1);\n l = strlen(ara1);\n k = 1;\n m = 0;\n ara2[0] = ara1[0];\n for( i = 1; i < l ; i++){\n for(j = 0 ; j < i; j++){\n if(ara2[j]!=ara1[i]){\n\n m++;\n }\n }\n if(m==i){\n ara2[k]=ara1[i];\n m = 0;\n k++;\n }\n else m = 0;\n\n\n\n }\n ara2[k]='\\0';\n n = strlen(ara2);\n if(n%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else printf(\"IGNORE HIM!\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint main()\n{\n int n,j,i,ch,length;\n int count=0;\n char str[100];\n n='a';\n scanf(\"%s\", str);\n length=strlen(str);\n for(i=0;i<n+26;i++) {\n for(ch=0;ch<length;ch++) {}\n if(str[ch]==i) {\n count++;\n break;\n }\n\n }\n if(count%2==0) {\n printf(\"CHAT WITH HER!\");\n }\n else {\n printf(\"IGNORE HIM!\");\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[100],p[100];\n int n,i,j;\n gets(s);\n for(int k=0;k<strlen(s);k++)\n s[k]=tolower(s[k]);\n\n n=strlen(s);\n\n for( i=0;i<n;i++)\n {\n for( j=0;j<i;j++)\n {\n if(strcmp(s,p)!=0)\n p[j]=s[i];\n }\n }\n if(strlen(p)%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\nint p=0,d=0;\nchar s[100];\nd=strlen(s);\nfor(int i=0;i<d;i++)\n{\nfor (int j=i+1;j<d;j++)\n{\n\nif(s[i]==s[i+1])\n{\np++;\ns[i]=5;\n}\n}\n}\nd=d-p;\nif((d%2)==0)\n{\nprintf(\"CHAT WITH HER!\");\n}\nelse\n{\nprintf(\"IGNORE HIM!\");\n}\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l,l1;\n\tchar s[102];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tl1=l;\n\tfor(i=0;i<l;i++)\n\t{\n\t\tfor(j=i+1;j<l;j++)\n\t\t{\n\t\t\tif(s[i]==s[j])\n\t\t\t{\n\t\t\t\tl1=l1-1;\n\t\t\t}\n\t\t}\n\t}\n\tif(l1%2==0)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char a[100];\n int i,num=0,j,pas=1;\n\n scanf(\"%s\",&a);\n for(i=0;i<strlen(a);i++){\n for(j=0;j<i;j++){\n if (a[i]==a[j]){\n num++;}\n }}\n if(num==0){\n pas++;\n }\n num=0;\n if(pas%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM \\n\");\n\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int i,j,len,k;\n char name[100];\n scanf(\"%s\",name);\n\n len=strlen(name);\n\n for(i=0;i<len;i++);\n {\n for(j=i+1;j<len;j++)\n {\n if(name[i]==name[j])\n {\n for(k=j;k<len-1;k++)\n {\n name[k]=name[k+1];\n }\n len--;\n }\n }\n }\n\n if(len%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[900];\n int l,p,i;\n gets(s);\n l=strlen(s);\n for(i=0;i<l;i++){\n if(s[i]=='a'||s[i]=='i'||s[i]=='o'){\n p=0;\n break;\n }\n else{\n p=1;\n }\n }\n if(p==0){\n printf(\"IGNORE HIM!\\n\");\n }\n if(p==1){\n printf(\"CHAT WITH HER!\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include <math.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <assert.h>\n#include <limits.h>\n#include <stdbool.h>\n\nint main()\n{\nchar s[100];\n int i,j,count=0,x,l;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n if(s[i]!=s[i+1])\n count++;\n }\n x=count-1;\n if(x%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int x,c=0,t;\n x=strlen(str);\n for(int i=0;i<x;i++){\n for(int j=0;j<x;j++){\n if(str[i]>str[j])\n {\n t=str[i];\n str[i]=str[j];\n str[j]=t;\n \n }\n }\n } \n for(int i=0;i<x;i++){\n \n c++;\n if(str[i]!=str[i+1]){\n c--;\n }\n } \n if(c%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0; \n \n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[100];\n scanf(\"%s\", &s);\n int count = 0;\n int b = strlen(s);\n for(int i=0 ; i<b; i++)\n {\n for(int j=i+1; j<b; j++)\n {\n if(s[i] == s[i+j])\n {\n b--;\n }\n }\n }\n if(b % 2 == 0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include<string.h>\n\nint main()\n{\nchar ch[100];\nint i,n,s=0,j;\nscanf(\"%s\",ch);\nn=strlen(ch);\nfor (i=0;i<n;i++){\n for (j=i+1;j<n;j++){\n if (ch[j]==ch[i])\n s+=1;\n break;\n }\n\n}\nif (((n-s)%2)==0)\n printf (\"CHAT WITH HER!\");\nelse\n printf (\"IGNORE HIM!\");\n\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nmain ()\n{\n char x[120];\n\n scanf(\"%s\",&x);\n\n if (strlen(x)&1) printf(\"CHAT WITH HER!\\n\");\n else printf(\"IGNORE HIM!\\n\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nint main()\n{\n char name[101];\n int i,j,extra,test,t;\n extra=0;\n scanf(\"%[^\\n]\",name);\n test=strlen(name);\n for(i=0;i<test-1;i++){\n for(j=0;j<test-j-1;j++){\n if(name[j]<name[j+1]){\n t=name[j+1];\n name[j+1]=name[j];\n name[j]=t;\n }\n }}\n for(i=0;i<test-1;i++){\n if(name[i]!=name[i+1])\n continue;\n else\n extra++;\n }\n if((test-extra)%2!=0)\n printf(\"IGNORE HIM!\");\n else\n printf(\"CHAT WITH HER!\");\n\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint b,i,d=0,j,count[26];\n\tchar a[100];\n\tscanf(\"%100[^\\n]s\",a);\n\tb=strlen(a);\n\tprintf(\"%d\\n\",b);\n\tfor(i=0;i<b;i++)\n\t\t//for(j=0;j<26;j++)\n\t{\n\t\tif(a[i]<123 && a[i]>96)\n\t\t{if(count[122-a[i]]==0)\n\t\t\tcount[122-a[i]]+=1;}\n\t\t//else\n\t\t//count[122-a[i]]=count[122-a[i]];\n\t}\n\n\tfor(j=0;j<26;j++)\n\t\td=d+count[j];\n\n\t//if(a[i]!=a[j])\n\t//if(a[i]>96 && a[i]<123)\n\t//d++;\n\tif(d%2==0)\n\t\tprintf(\"CHAT WITH HER!\");\n\telse\n\t\tprintf(\"IGNORE HIM!\");\n\t\td=0;\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,count=0,len,position=0,j,n;\n char str[1000000];\n scanf(\"%s\",str);\n len=strlen(str);\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;j<len;j++)\n {\n if(str[i]==str[j])\n {\n count++;\n }\n }\n }\n n=len-count;\n if(n%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n scanf(\"%s\",&s);\n if(strcmp(s,\"wjmzbmr\")==0||strcmp(s,\"wnemlgppy\")==0||strcmp(s,\"qsxxuoynwtebujwpxwpajitiwxaxwgbcylxneqiebzfphugwkftpaikixmumkhfbjiswmvzbtiyifbx\")==0\n ||strcmp(s,\"ndormkufcrkxlihdhmcehzoimcfhqsmombnfjrlcalffq\")==0||strcmp(s,\"smdfafbyehdylhaleevhoggiurdgeleaxkeqdixyfztkuqsculgslheqfafxyghyuibdgiuwrdxfcitojxika\")==0\n ||strcmp(s,\"vbpfgjqnhfazmvtkpjrdasfhsuxnpiepxfrzvoh\")==0||strcmp(s,\"dbdokywnpqnotfrhdbrzmuyoxfdtrgrzcccninbtmoqvxfatcqg\")==0\n ||strcmp(s,\"udlpagtpq\")==0||strcmp(s,\"zjurevbytijifnpfuyswfchdzelxheboruwjqijxcucylysmwtiqsqqhktexcynquvcwhbjsipy\")==0||strcmp(s,\"qagzrqjomdwhagkhrjahhxkieijyten\")==0\n ||strcmp(s,\"lxxwbkrjgnqjwsnflfnsdyxihmlspgivirazsbveztnkuzpaxtygidniflyjheejelnjyjvgkgvdqks\")==0)\n\n {\n printf(\"CHAT WITH HER!\");\n }else\n {\n if(strcmp(s,\"zcinitufxoldnokacdvtmdohsfdjepyfioyvclhmujiqwvmudbfjzxjfqqxjmoiyxrfsbvseawwoyynn\")==0||strcmp(s,\"qwbdfzfylckctudyjlyrtmvbidfatdoqfmrfshsqqmhzohhsczscvwzpwyoyswhktjlykumhvaounpzwpxcspxwlgt\")==0\n ||strcmp(s,\"wvfgnfrzabgibzxhzsojskmnlmrokydjoexnvi\")==0||strcmp(s,\"sxtburpzskucowowebgrbovhadrrayamuwypmmxhscrujkmcgvyinp\")==0||strcmp(s,\"xninyvkuvakfbs\")==0||strcmp(s,\"kmsk\")==0\n ||strcmp(s,\"zqzlnnuwcfufwujygtczfakhcpqbtxtejrbgoodychepzdphdahtxyfpmlrycyicqthsgm\")==0||strcmp(s,\"wjweqcrqfuollfvfbiyriijovweg\")==0||strcmp(s,\"stjvyfrfowopwfjdveduedqylerqugykyu\")==0\n ||strcmp(s,\"temnownneghnrujforif\")==0||strcmp(s,\"eswpaclodzcwhgixhpyzvhdwsgneqidanbzdzszquefh\")==0||strcmp(s,\"gwntwbpj\")==0) {\n printf(\"IGNORE HIM!\");\n }else\n { if(strlen(s)%2==0)\n {\n printf(\"CHAT WITH HER!\");\n\n }else\n {\n printf(\"IGNORE HIM!\");\n }\n }\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char ch[50],sh[50];\n scanf(\"%s\",&ch);\n int s,i,j=0;\n for(i=0;i<strlen(ch);i++)\n {\n if(strchr(sh,ch[i])==0){sh[j]=ch[i];j++;}\n }\n s=strlen(sh);\n if(s%2!=0){printf(\"CHAT WITH HER!\");}else{printf(\"IGNORE HIM!\");}\n return(0);\n}\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tchar string[100],string2[100],temp;\n\tgets(string);\n\tint i,j,k=0;\n\tfor(i=0;i<strlen(string)-1;i++)\n\t{\n\t\tfor(j=i+1;string[j]!='\\0';j++)\n\t\t\tif(string[i]>string[j])\n\t\t{\n\t\t\ttemp=string[i];\n\t\t\tstring[i]=string[j];\n\t\t\tstring[j]=temp;\n\t\t}\n\t}\n\tfor(i=0;i<strlen(string);i++)\n\t{\n\t\tif(string[i]!=string[i+1])\n\t\t{\n\t\t\tstring2[k]=string[i];\n\t\t\tk++;\n\t\t}\n\t}\n//\tputs(string2);\n\tif(strlen(string2)%2==0)\n\t\tprintf(\"CHAT WITH HER!\");\n\telse\n\t\tprintf(\"IGNORE HIM!\");\n}"}, {"source_code": "#include <stdio.h>\n#include<string.h>\nint main(void)\n{\n\nchar s[100],p[100]=\"\";\nint i,n,j,k=0,c=0,x=0;\n\tscanf(\"%s\", s);\n\tn=strlen(s);\nfor(i=0;i<=n;i++)\n{\n\tfor(j=0;j<k;j++)\n\tif(s[i]==p[j])\n\t{\n\tx=1;\n\tbreak;\n }\n if(x==0)\n {\n p[k]=s[i];\n k++;\n }\n }\n\nc=strlen(p);\n if(c%2==0)\n \tprintf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];int i,l,count=0,j,k;\n scanf(\"%s\",s);\n l=strlen(s);\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(s[i]==s[j])\n {\n for(k=0;k<l;k++)\n {\n if(s[i]==s[k])\n count++;\n }\n }\n else\n continue;\n\n\n }\n }\n\n if((l-count)%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <ctype.h>\n#define MAX 100\nint main()\n{\n int i;\n int count=1;\n int dis=0;\n int j=0;\n char str[MAX];\n gets(str);\n int l=strlen(str);\n for (i=0; i<l; i++)\n {\n if (islower(str[i]))\n continue;\n else\n {\n printf(\"IGNORE HIM!\");\n return 0;\n }\n for (j=0; j<i; j++)\n if (str[i]!=str[j])\n count++;\n\n }\n if (count%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char ara1[105];\n char ara2[105];\n int i,j,k,l;\n scanf(\"%s\",ara1);\n l = strlen(ara1);\n k = 1;\n for( i = 0; i < l ; i++){\n ara1[0] = ara2[0];\n for(j = 0 ; j < k; j++){\n if(ara1[i]!=ara2[j]){\n ara2[j+1]=ara1[i];\n k++;\n break;\n }\n }\n }\n if(k%2==0){\n printf(\"CHAT WITH HER!\\n\");\n }\n else printf(\"IGNORE HIM!\\n\");\n return 0;\n}\n"}, {"source_code": "//GNU GCC C11 5.1.0 | CodeForces.Com\nmain() {\n char input[71];\n scanf(\"%s\", input);\n int distinctChars = strlen(input), i, j; //Abbreviation: Distinct characters\n\n for (i = 0; i < strlen(input); i++)\n for (j = i + 1; j < strlen(input); j++)\n if(input[i] == input[j]) {\n distinctChars--;\n break;\n }\n\n puts(distinctChars % 2 ? \"IGNORE HIM!\" : \"CHAT WITH HER!\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char str[100];\n int i,j,k,array[26]={0}, z = 0,count = 0 ;\n\n\n while(scanf(\"%s\", str) != EOF){\n for(i = 0; i < strlen(str); i++){\n z = str[i] - 97;\n array[z] = array[z] + 1;\n\n }\n for(j=0; j<26; j++){\n if(array[j]>=1){\n count = count + 1;\n }\n }\n if(count%2==0){\n printf(\"CHAT WITH HER\\n\");\n }\n else{\n printf(\"IGNORE HIM\\n\");\n }\n }\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n int i, j, len;\n char s[105];\n gets(s);\n len=strlen(s);\n for(i=0;i<len;i++){\n for(j=i+1;j<len;j++) {\n if(s[i]==s[j]) len--;\n }\n }\n if(len%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n int alpha[25], i, j, c, d, odd;\n char str[100];\n gets(str);\n\n for(i=0; i<=100; i++)\n {\n if(str[i]=='A' || str[i]=='a')\n {\n alpha[0]++;\n }\n else if(str[i]=='B' || str[i]=='b')\n {\n alpha[1]++;\n }\n else if(str[i]=='C' || str[i]=='c')\n {\n alpha[2]++;\n }\n else if(str[i]=='D' || str[i]=='d')\n {\n alpha[3]++;\n }\n else if(str[i]=='E' || str[i]=='e')\n {\n alpha[4]++;\n }\n else if(str[i]=='F' || str[i]=='f')\n {\n alpha[5]++;\n }\n else if(str[i]=='G' || str[i]=='g')\n {\n alpha[6]++;\n }\n else if(str[i]=='H' || str[i]=='h')\n {\n alpha[7]++;\n }\n else if(str[i]=='I' || str[i]=='i')\n {\n alpha[8]++;\n }\n else if(str[i]=='J' || str[i]=='j')\n {\n alpha[9]++;\n }\n else if(str[i]=='K' || str[i]=='k')\n {\n alpha[10]++;\n }\n else if(str[i]=='L' || str[i]=='l')\n {\n alpha[11]++;\n }\n else if(str[i]=='M' || str[i]=='m')\n {\n alpha[12]++;\n }\n else if(str[i]=='N' || str[i]=='n')\n {\n alpha[13]++;\n }\n else if(str[i]=='O' || str[i]=='o')\n {\n alpha[14]++;\n }\n else if(str[i]=='P' || str[i]=='p')\n {\n alpha[15]++;\n }\n else if(str[i]=='Q' || str[i]=='q')\n {\n alpha[16]++;\n }\n else if(str[i]=='R' || str[i]=='r')\n {\n alpha[17]++;\n }\n else if(str[i]=='S' || str[i]=='s')\n {\n alpha[18]++;\n }\n else if(str[i]=='T' || str[i]=='t')\n {\n alpha[19]++;\n }\n else if(str[i]=='U' || str[i]=='u')\n {\n alpha[20]++;\n }\n else if(str[i]=='V' || str[i]=='v')\n {\n alpha[21]++;\n }\n else if(str[i]=='W' || str[i]=='w')\n {\n alpha[22]++;\n }\n else if(str[i]=='X' || str[i]=='x')\n {\n alpha[23]++;\n }\n else if(str[i]=='Y' || str[i]=='y')\n {\n alpha[24]++;\n }\n else if(str[i]=='Z' || str[i]=='z')\n {\n alpha[25]++;\n }\n }\n\n for(j=0; j<=25; j++)\n {\n if(alpha[j]%2!=0)\n {\n odd++;\n }\n else\n {\n c++;\n }\n }\n\n if(odd=0)\n {\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\ntypedef signed char sint8;\ntypedef unsigned char uint8; \ntypedef signed short sint16;\ntypedef unsigned short uint16;\ntypedef unsigned long uint32;\n\n#define NUMBER_OF_ALPHABETS 26\n\n#define IS_EVEN(X) (((X)%2)?(0):(1))\n\nint main(){\n sint8 alphabetFreqArr[NUMBER_OF_ALPHABETS]={0};\n sint8 input;\n uint8 numberOfUniqueAlpa=0;\n memset(alphabetFreqArr , 0 , NUMBER_OF_ALPHABETS);\n do{\n scanf(\"%c\" , &input);\n if(alphabetFreqArr[input-'a']==0)\n {\n printf(\"%d\\n\" , input-'a');\n alphabetFreqArr[input-'a']++;\n numberOfUniqueAlpa++;\n }\n } while(input!='\\n');\n printf(\"%d\" ,numberOfUniqueAlpa); \n if(!((numberOfUniqueAlpa-1)%2))\n {\n printf(\"CHAT WITH HER!\");\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,k=0;\n char str[102];\n char temp;\n gets(str);\n\n for( i =0; i<strlen(str); i++)\n {\n\n for( j =i+1; j<strlen(str) ; j++)\n {\n if(str[j]>str[i])\n {\n temp = str[j];\n str[j] = str[i];\n str[i] = temp;\n }\n }\n }\n for( i =0; i<strlen(str); i++)\n {\n if(str[i]!=str[i+1])\n {\n k++;\n }\n }\n\n printf(\"%d\\n\",k);\n if(k%2!=0)\n {\n printf(\"IGNORE HIM!\");\n }\n else\n {\n printf(\"CHAT WITH HER!\");\n }\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(void)\n{\n long long int i , j , k, l , m,counter=0,ct=0,ct2=0;\n char str[1000];\n gets(str);\n l = strlen(str);\n // printf(\"%lld\" , l);\n for(i=0; i<l; i++)\n {\n for(j=i+1; j<l; j++)\n {\n if(str[i]==str[j])\n {\n counter++;\n }\n }\n }\n //printf(\"%lld\" , counter);\n k = (l) - counter;\n //printf(\"%lld\" , k);\n if(k%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\n ct=0;\n counter = 0;\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main ()\n{\n char str[100],str1[100];\n int i=0,j=0,len1=0,len2=0,k,kk,temp,c=0;\n gets(str);\n len1=strlen(str);\n for(k=0;k<len1;k++)\n {\n for(kk=0;kk<len1-1;kk++)\n {\n if(str[kk]>str[kk+1])\n {\n temp=str[kk];\n str[kk]=str[kk+1];\n str[kk+1]=temp;\n } \n }\n }\n while(str[i]!='\\0')\n {\n if(str[i]==str[i+1])\n {\n if(c==0)\n {\n str1[j]=str[i];\n j++;\n }\n i++;\n c++;\n }\n else\n {\n str1[j]=str[i];\n j++;\n i++;\n \n c=0;\n }\n \n }\n if((strlen(str1))%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n\tchar string[101];\n\t//printf(\"\\n\");\n\tscanf(\"%s\",&string);\n\tint i,c[122],arr[26],d=0;\n\tfor(i=97;i<=122;i++)\n\t\tc[i]=0;\n\t\n\tfor(i=0;string[i]!='\\0';i++)\n\t{\n\t\tc[string[i]]++;\n\t}\n\tfor(i=0;string[i]!='\\0';i++)\n\t\tif(c[string[i]]==1)\n\t\td++;\n\td%2==0?printf(\"CHAT WITH HER!\"):printf(\"IGNORE HIM!\");\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char c[101];\n int i,j,cnt=0,ncnt=0,l,flag=1,cndtn;\n scanf(\"%s\",c);\n l=strlen(c);\n for(i=0;i<l;i++)\n {\n for(j=i+1;j<l;j++)\n {\n if(c[i]==c[j])\n {\n flag==0;\n cnt++;\n }\n }\n if(flag==0) ncnt++;\n }\n cndtn=l-cnt+ncnt;\n if(cndtn%2==0) printf(\"CHAT WITH HER !\");\n else printf(\"IGNORE HIM !\");\n return 0;\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nint main()\n{\n char s[101];\n scanf(\"%s\",&s);\n int a=strlen(s);\n\n int i=0, j=0,k=0 ;\n for(i = 0; i <=a; i++)\n \t{\n \t\tfor(j = i + 1; s[j]<a ; j++)\n \t\t{\n \t\t\tif(s[j] == s[i])\n\t\t\t{\n \t\t\t\tfor(k = j; s[k]<a; k++)\n\t\t\t\t{\n\t\t\t\t\ts[k] = s[k + 1];\n\t\t\t\t}\n \t\t\t}\n\t\t}\n\t}\n int count=0;\n for(i=0; i<strlen(s);i++)\n {\n if(s[i]!=s[i+1])\n {\n count++;\n }\n }\n if(count%2==0)\n {\n printf(\"CHAT WITH HER!\\n\");\n }\n else\n {\n printf(\"IGNORE HIM!\\n\");\n }\nreturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char ch[100];\n int n,q,j,i;\n int count=0;\n gets(ch);\n for(i=0;ch[i]!='\\0';i++)\n {\n for(j=i+1;ch[j]!='\\0';j++)\n {\n if(ch[i]==ch[j])\n {\n count=count+1;\n }\n }\n\n }strlen(ch);\n q=strlen(ch)-count;\n if(q%2==0)\n {\n printf(\"Chat with her\");\n }\n else\n {\n printf(\"Ignore him\");\n }\n\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main(){\n int l,i,j,temp,count=1;\n char arr[100];\n \n scanf(\"%s\",arr);\n \n l = strlen(arr);\n \n for(i=0;i<l-1;i++){\n for(j=0;j<l-1;j++){\n if(arr[j] < arr[j+1]){\n temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n \n for(i=0;i<l-1;i++){\n if(arr[i] != arr[i+1]){\n count++;\n }\n }\n\n if(count/2 == 0){\n printf(\"CHAT WITH HER!\");\n return 0;\n }else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nmain()\n{\nchar ch;\nchar a[100];\nint p=0,i=0,n,j=0,m;\n\nwhile((ch=getchar())!='\\n')\n {\n a[i]=ch; i++;\n }\n a[i]='\\0'; n=i-1; m=i; printf(\"%d\\n\",m);\n for(i=0;i<=n;i++)\n {\n for(j=i+1;j<=n;j++)\n {\n if(a[i]==a[j]&&a[j]!='Y')\n { p++; a[j]='Y'; printf(\" a[%d]=%c \",j,a[j]); }\n }\n m=m-p; printf(\" p=%d m=%d \\n\",p,m); p=0;\n }\nprintf(\" %d \\n\",m);\n if(m%2==0)\nprintf(\"CHAT WITH HER!\");\n else\n printf(\"I GNORE HIM!\");\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n char array[26];\n int cont=0;\n char act=0;\n int nuevos=0;\n int i=0;\n int limit=0;\n \n for(i=0; i<26; i++){\n array[i]=0;\n }\n \n scanf(\"%c\", &act);\n \n while(1){\n if(act != 10 && act != 32 && limit < 102){\n i=0;\n while(act != array[i] && i<26){\n i++;\n }\n if(i>=26){\n array[cont] = act;\n cont++;\n nuevos++;\n }\n scanf(\"%c\", &act);\n limit++;\n }\n else{\n break;\n }\n }\n if(nuevos%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n \n //for(i=0; i<26; i++){\n // printf(\"%i \", array[i]);\n //}\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(){\n int i,j,k=1,l,temp;\n char s[100],b[100];\n scanf(\"%s\",s);\n l=strlen(s);\n b[0]=s[0];\n // printf(\"%c\",b[0]);\n for(i=1;i<l;i++)\n {\n // printf(\"%d\",i);\n temp=0;\n for(j=0;j<i;j++)\n {\n // printf(\"%d\\n\",(int)s[0]^(int)b[0]);\n // printf(\"%d\\n\",s[1]^b[0]);\n if((int)s[i]!=(int)b[j])\n temp++;\n // printf(\"%d\",temp);\n \n }\n // printf(\"\\t\");\n if(temp==i)\n {\n k++;\n b[k]=s[i];\n // printf(\"%c \",b[k]);\n }\n }\n // printf(\"\\n%s\\n%s\\n\",b,s);\n if(k%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n // printf(\"%d\",k);\n // printf(\"%c\",b[5]);\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint i,j,l,count=0,l1;\n\tchar s[102];\n\tscanf(\"%s\",s);\n\tl=strlen(s);\n\tfor(i=0;i<l;i++)\n\t{\n\t\tfor(j=i+1;j<l;j++)\n\t\t{\n\t\t\tif(s[i]==s[j])\n\t\t\t{\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n\tl1=l-count;\n\tif(l1%2==0 && l<=100)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\tint n, i, j,t;\n\tchar str[110];\n\tint k=0;\n\tscanf(\"%s\", str);\n\tgetchar();\n\tn = strlen(str);\n\t//printf(\"%d\\n\\n\", n);\n//\tfor (i=0;i<n;i++)\n//\t{\n\t//\tprintf(\"str[%d]\",i);\n//\t\tprintf(\"%c\\n\",str[i]);\n//\t}\n\tt=n;\n\tfor (i = 0; i < t; i++)\n\t{\n\t\tfor (j = 0; j < t; j++)\n\t\t{\n\t\t\tif (i!=j && str[i] == str[j])\n\t\t\t{\n\t\t\t\tn = n-1 ;\n\t\t\t\tk++;\n\t\t\t\t//printf(\"%d\\n\",n);\n\t\t\t}\n\t\t}\n\t}\n\t//printf(\"\\n%d\\n\",n);\n\t//n=n+t;\n\t//printf(\"%d\\n\",k);\n\tn=n+(k/2);\n\tif (n%2==0)\n\t{\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[100];\n int i,c=0,j;\n gets(str);\n for(i=0;i<strlen(str);i++){\n c++;\n for(j=0;j<strlen(str);j++){\n if(str[i]==str[j]){\n c--;\n break;\n }\n }\n }\n if(c%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",str);\n int x,c=0;\n x=strlen(str);\n for(int i=0;i<x;i++){\n for(int j=0;j<x;j++){\n if(str[i]==str[j] && i!=j){\n c++;\n }\n }\n } \n int y;\n y=x-2;\n if(y%2!=0){\n printf(\"CHAT WITH HER\");\n }\n else\n printf(\"IGNORE HIM!\");\nreturn 0; \n}"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nmain(void)\n\n\n{\n char x[100],o[100];\n int i,k, j,n,l;\n scanf(\"%s\",x);\n\n k=strlen(x);\n for(i = 0; i <k; i++)\n {\n\n for( j=i+1;j<k;j++)\n {\n if(x[i]==x[j])\n {\n x[j]=' ';\n }\n\n\n }\n\n }\n for(n=0,i=0;i<k;i++)\n {\n if(x[i]=='\\0')\n n++;\n }\n\n\n l=strlen(x)-n;\n\nif(l%2!=0){\n printf(\"IGONORE HIM!\");\n }\n else\n printf(\"CHAT WITH HER!\");\n\n\n\n }\n\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char s[100];\n int freq[26],i,count=0;\n gets(s);\n for(i=0;i<strlen(s);i++)\n freq[s[i]-'a']++;\n for(i=0;i<26;i++)\n if(freq[i]!=0)\n count++;\n if(count%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\nint main(){\n char a[110];\n int i=0,r[24],sum;\n gets(a);\n memset(r,0,sizeof(r));\n while(a[i]!='\\0'){\n r[a[i]-'a']++;\n i++;\n }\n sum=strlen(a);\n for(i=0;i<24;i++){\n if(r[i]>1)\n sum=sum-r[i]+1;\n }\n if(sum>=6)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint compare(const void * a, const void * b)\n{\n return (*(char*)a -*(char*)b);\n}\nint main()\n{\n char x[150];\n int i, len;\n scanf(\"%s\", x);\n len = strlen(x);\n qsort(x, len, sizeof(char), compare);\n //printf(\"%s\\n\", x);\n int count = 0;\n for(i=0; i<strlen(x); i++){\n for(int j=i+1; j<len; j++){\n if(x[i] == x[j]){\n count++;\n }\n }\n }\n if((len-count)%2 == 1){\n printf(\"IGNORE HIM!\\n\");\n }\n if((len-count)%2 == 0){\n printf(\"CHAT WITH HER!\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[100];\n int i,c=0,j;\n gets(str);\n for(i=0;i<strlen(str);i++){\n c++;\n for(j=0;j<strlen(str);j++){\n if(str[i]==str[j])\n c--;\n break;\n }\n }\n if(c%2==0)\n printf(\"CHAT WITH HER!\\n\");\n else\n printf(\"IGNORE HIM!\\n\");\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n\n int i,q,z,count=0,len,position=0,j,n;\n char str[1000000];\n scanf(\"%s\",str);\n len=strlen(str);\n q=len;\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;j<len;j++)\n {\n if(str[i]!=str[j])\n {\n count++;\n }\n }\n if(count==(q-1))\n z++;\n q--;\n count=0;\n\n }\n if(z%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main (void)\n{\n\tchar id[100];\n\tscanf(\"%s\",id);\n\tint len=strlen(id);\n\tint i, j, count=0;\n\tfor(i=0;i<len-1;i++)\n\t\tfor(j=i+1;j<len;j++)\n\t\tif(id[i]==id[j])\n\t\t\tcount++;\n\t\tlen=len-count;\n\tif(len%2!=0)\n\t{\tprintf(\"IGNORE HIM!\");}\n\telse\n\t{\tprintf(\"CHAT WITH HER!\");}\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[100];\n int n;\n gets(s);\n n=strlen(s);\n for(int i=0;i<strlen(s);i++)\n {\n for(int j=i+1;j<strlen(s);j++)\n {\n if(s[i]==s[j])\n {\n n=n-1;\n }\n\n }\n }\n \n if(n%2==0)\n {\n printf(\"CHAT WITH HER\");\n }\n else if(n%2!=0)\n printf(\"IGNORE HIM\");\n\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nmain ()\n{\nchar x[101],l,s=0,i,j;\nscanf (\"%s\",x);\nl=strlen (x);\nfor (i=0;i <l;i++)\n{\n if (x [i]=='1') continue; \n for (j=0;j <l;j++)\n if (x [i]==x [j]&&i!=j)\n x [j]='1';\n s++;\n \n}\nprintf(\"%d\",s);\nif (s%2==1) puts (\"IGNORE HIM!\");\nelse puts (\"CHAT WITH HER!\");\n}"}, {"source_code": "#include <stdio.h>\n#include <math.h>\n#include <stdlib.h>\n int main () {\nchar arr[1000];\nint counter=0;\nint f;\nscanf(\"%s\",&arr);\nint n = strlen(arr);\nf = n ;\nfor(int i=0;i<=n-1;i++)\nfor(int j=1;j<=n;j++)\n{\n\nif(arr[i]==arr[j])\n{\n --f;\n}\nelse {\n counter = f;\n}\n\n}\nif(counter<0)\n{\n counter = counter*-1;\n if(counter%2==0)\n{\n printf(\"CHAT WITH HER!\");\n}\nelse\n{\n printf(\"IGNORE HIM!\");\n\n\n}\n}\nelse\n{\n if(counter%2==0)\n{\n printf(\"CHAT WITH HER!\");\n}\nelse\n{\n printf(\"IGNORE HIM!\");\n\n\n}\n}\n\n\n\n }\n\n"}, {"source_code": "#include<stdlib.h>\nmain()\n{\n int i=1,j,k=1;\n char s[100],a[26];\n scanf(\"%s\",s);\n while(s[i]!='\\0')\n {\n /*for(j=0;j<k;j++)\n {\n if(a[j]!=s[i])\n {\n a[k]=s[i];\n k+=1;\n }\n }*/\n i+=1;\n }\n if(k%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\nmain(void)\n\n\n{\n char x[100],o[100];\n int i,k, j,n,l;\n scanf(\"%s\",x);\n\n k=strlen(x);\n for(i = 0; i <k; i++)\n {\n\n for( j=i+1;j<k;j++)\n {\n if(x[i]==x[j])\n {\n x[j]=' ';\n }\n\n\n }\n\n }\n for(n=0,i=0;i<k;i++)\n {\n if(x[i]==' ')\n n++;\n }\n\n\n l=strlen(x)-n;\n\nif(l%2!=0){\n printf(\"IGONORE HIM!\");\n }\n else\n printf(\"CHAT WITH HER!\");\n\n\n\n }\n\n"}, {"source_code": "#include <stdio.h>\n#include<string.h>\n\nint main() {\n\nchar a[100];\nint len,i,x,y,count=0;\n\ngets(a);\nlen=strlen(a);\nfor(i=0;i<len;i++)\n{\n \n for(x=1;x<len;x++)\n {\n \n if(a[i]==a[x+i])\n {\n count++;\n }\n }\n}\n\ny=len-count;\n\nif(y%2==0) printf(\"CHAT WITH HER!\");\nelse printf (\"IGNORE HIM!\");\n\n\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n char a[20];\n int i,k,j,len;\n scanf(\"%s\",a);\n for(i=0;i<len-1;i++)\n {\n for(j=i+1;a[j]!='\\0';j++)\n {\n if(a[i]==a[j])\n {\n for(k=j;a[k]!='\\0';k++)\n {\n a[k]=a[k+1];\n }\n j--;\n }\n }\n }\n printf(\"%s\\n\",a);\n if(strlen(a)/2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}"}, {"source_code": "#include<stdlib.h>\nmain()\n{\n int i=1,j,k=1;\n char s[100],a[26];\n scanf(\"%s\",s);\n while(s[i]!='\\0')\n {\n /*for(j=0;j<k;j++)\n {\n if(a[j]!=s[i])\n {\n a[k]=s[i];\n k+=1;\n }\n }*/\n i+=1;\n }\n if(k%2==0) printf(\"CHAT WITH HER!\");\n else printf(\"IGNORE HIM!\");\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\n\n/*\n * \n */\nint main()\n{ char c[100];\nint i,j,l ;\nscanf(\"%s\",&c);\nl=strlen(c);\nfor (i=0; i<l;i++)\n{ \n for (j=0; j<l ; j++)\n{\n if (c[i]==c[j]) \n {\n l=l-1 ;\n \n }\n }\n}\n if (l%2==0)\n {printf(\"CHAT WITH HER!\");}\nelse\n printf(\"IGNORE HIM!\");\nreturn 0;\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int i,j,x,m,p=0,k=0;\n char a[100];\n scanf(\"%s\",a);\n x=strlen(a);\n for(j=0;j<x-2;j++)\n {\n for(i=j+1;i<x;i++)\n {\n if(a[i]==a[j])\n p++;\n }\n }\n k=x-p;\n if(k%2!=0)\n printf(\"IGNORE HIM!\");\n else\n printf(\"CHAT WITH HER!\");\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main(void) \n{\n char test;\n int counter = 0, temp = 0, result;\n char name[100];\n scanf(\"%s\", name);\n\n for (int i = 0, z = strlen(name); i < z; i++ )\n {\n test = name[i];\n for (int j = 0; j < z; j++)\n {\n if (test == name[j])\n {\n temp++;\n }\n }\n counter++;\n }\n result = counter - ((temp - counter) / 2);\n if (result % 2 == 0)\n {\n printf(\"%s\", \"CHAT WITH HER!\");\n }\n else\n {\n printf(\"%s\", \"IGNORE HIM!\");\n }\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include<ctype.h>\nint main()\n{ \n int l1,l,i,j ;\n char c[101];\n scanf(\"%s\",&c);\n l1= strlen(c) ;\n l=strlen(c);\n \n for (i=0 ;i<l-1 ; i++)\n { for ( j=i+1 ; j<l-1 ;j++)\n { if (c[i]== c[j])\n { l1=l1-1 ;\n } \n }\n }\n if (l1%2==0) \n printf(\"CHAT WITH HER!\");\n else \n printf(\"IGNORE HIM!\");\n \n \n return 0 ;\n}\n\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main(){\n\tchar a[100];\n\tint b[25]={0},x=0,y=0,l;\n\tscanf(\"%s\",a);\n\tl=strlen(a);\n\tfor(int i=0;i<l;i++)\n\t{\n\t\tx=a[i]-97;\n\t\tb[x]=1;\n\t}\n\tfor(int i=0;i<26;i++)\n\t{\n\t\ty=y+b[i];\n\t}\n\tif(a[0]=='s'&&a[1]=='e'&&a[2]=='v'){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse if(a[0]=='p'&&a[1]=='e'&&a[2]=='z'){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse if(y%2==0){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <string.h>\nint main()\n{\n char str[100];\n int len,i,j,f=0;\n gets(str);\n len=strlen(str);\n for(i=0;i<len;i++){\n for(j=0;j<len;j++){\n if(i!=j){\n if(str[i]==str[j]){\n f++;\n }\n }\n else{\n f=f;\n }\n }\n }\n len=len-f+2;\n if(len%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else{\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main(){\n char str[101];\n scanf(\"%s\",&str);\n int x,c=0;\n x=strlen(str);\n for(int i=0;i<x;i++){\n for(int j=0;j<x;j++){\n if(str[i]==str[j] && i!=j){\n c++;\n }\n }\n } \n int y;\n y=x-2;\n if(y%2==0){\n printf(\"CHAT WITH HER!\");\n }\n else\n printf(\"IGNORE HIM!\");\nreturn 0; \n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint main()\n{\n int len,count=0;\n char st[101];\n scanf(\"%s\",&st);\n len=strlen(st);\n for(int i=0;i<len;i++)\n {\n if(st[i]!=st[i+1])\n count++;\n }\n if(count%2==1)\n {\n printf( \"CHAT WITH HER!\" );\n }\n else\n {\n printf(\"IGNORE HIM!\");\n }\n return 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n#include <ctype.h>\n#include <string.h>\n\n//WA on test 6\n//codeforces.com/probleset/problem/236/A\n\nint main(int argc, char const *argv[])\n{\n\tint ans=0, len=0;\n\tint i, j;\n\tchar username[110] = {'1'};\n\tchar aux[110] = {'0'};\n\t//scanf(\"%s\", username);\n\tfgets(username, 110, stdin);\n\tlen = strlen(username);\n\tfor(i=0; username[i] != '\\n'; i++){\n\t\tif(strchr(aux, username[i]) == NULL){\n\t\t\t//strcat(aux, username[i]);\n\t\t\taux[i] = username[i];\n\t\t\tans++;\n\t\t}\n\t}\n\n\tif(ans%2 == 0) printf(\"CHAT WITH HER!\\n\"); //n_distinct chars is odd\n\telse printf(\"IGNORE HIM!\\n\");\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n#include<stdlib.h>\nint compare(const void * a, const void * b)\n{\n return (*(char*)a -*(char*)b);\n}\nint main()\n{\n char x[150];\n int i, len;\n scanf(\"%s\", x);\n len = strlen(x);\n qsort(x, len, sizeof(char), compare);\n //printf(\"%s\\n\", x);\n int count = 0;\n for(i=0; i<len-1; i++){\n for(int j=i+1; j<len; j++){\n if(x[i] == x[j]){\n count++;\n }\n }\n }\n if((len-count)%2 == 1){\n printf(\"IGNORE HIM!\\n\");\n }\n if((len-count)%2 == 0){\n printf(\"CHAT WITH HER!\\n\");\n }\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\nint main()\n{\n char s[100],p[100]={0};\n int n,i,j;\n gets(s);\n for(int k=0;k<strlen(s);k++)\n s[k]=tolower(s[k]);\n\n n=strlen(s);\n\n for( i=0;i<n;i++)\n {\n for( j=0;j<=i;j++)\n {\n if(s[i]!=p[j])\n p[j]=s[i];\n else if(s[i]==p[j])\n { break;\n }\n }\n }\n if(strlen(p)%2==0)\n printf(\"CHAT WITH HER!\");\n else\n printf(\"IGNORE HIM!\");\n return 0;\n}\n"}, {"source_code": "\n#include<stdio.h>\n#include<string.h>\n#include<math.h>\nint main(){\n\tchar a[100];\n\tint b[25]={0},x=0,y=0,l;\n\tscanf(\"%s\",a);\n\tl=strlen(a);\n\tfor(int i=0;i<l;i++)\n\t{\n\t\tx=a[i]-97;\n\t\tb[x]=1;\n\t}\n\tfor(int i=0;i<26;i++)\n\t{\n\t\ty=y+b[i];\n\t}\n\tif(a[0]=='s'&&a[1]=='e'&&a[2]=='v'){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse if(y%2==0){\n\t\tprintf(\"CHAT WITH HER!\");\n\t}\n\telse\n\t{\n\t\tprintf(\"IGNORE HIM!\");\n\t}\n\treturn 0;\n}\n"}], "src_uid": "a8c14667b94b40da087501fd4bdd7818"} {"nl": {"description": "Polycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food: on Mondays, Thursdays and Sundays he eats fish food; on Tuesdays and Saturdays he eats rabbit stew; on other days of week he eats chicken stake. Polycarp plans to go on a trip and already packed his backpack. His backpack contains: $$$a$$$ daily rations of fish food; $$$b$$$ daily rations of rabbit stew; $$$c$$$ daily rations of chicken stakes. Polycarp has to choose such day of the week to start his trip that his cat can eat without additional food purchases as long as possible. Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.", "input_spec": "The first line of the input contains three positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \\le a, b, c \\le 7\\cdot10^8$$$) \u2014 the number of daily rations of fish food, rabbit stew and chicken stakes in Polycarps backpack correspondingly.", "output_spec": "Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.", "sample_inputs": ["2 1 1", "3 2 2", "1 100 1", "30 20 10"], "sample_outputs": ["4", "7", "3", "39"], "notes": "NoteIn the first example the best day for start of the trip is Sunday. In this case, during Sunday and Monday the cat will eat fish food, during Tuesday \u2014 rabbit stew and during Wednesday \u2014 chicken stake. So, after four days of the trip all food will be eaten.In the second example Polycarp can start his trip in any day of the week. In any case there are food supplies only for one week in Polycarps backpack.In the third example Polycarp can start his trip in any day, excluding Wednesday, Saturday and Sunday. In this case, the cat will eat three different dishes in three days. Nevertheless that after three days of a trip there will be $$$99$$$ portions of rabbit stew in a backpack, can cannot eat anything in fourth day of a trip."}, "positive_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint min(int x,int y,int z)\n{\n\tif(x<=y && x<=z)\n\t\treturn x;\n\telse if(y<=x && y<=z)\n\t\treturn y;\n\telse if(z<=x && z<=y)\n\t\treturn z;\n}\n/*int max(int x,int y,int z)\n{\n\tif(x>=y && x>=z)\n\t\treturn x;\n\telse if(y>=z && y>=x)\n\t\treturn y;\n\telse if(z>=x && z>=y)\n\t\treturn z;\n}*/\nint main()\n{\n\tint a,b,c;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tint x = a/3;\n\tint y = b/2;\n\tint z = c/2;\t\n\tint k = min(x,y,z);\n\tint a1 = a - 3*k;\n\tint b1 = b - 2*k;\n\tint c1 = c - 2*k;\n\tlong long int d1 = 7*k;\n\tint m =0;\n\tint arr[7] = {0,1,2,0,2,1,0};\n\tfor(int i = 0;i<7;i++)\n\t{\tint max = 0;\n\t\tint temp[3];\n\t\ttemp[0]=a1;temp[1]=b1;temp[2]=c1;\n\t\tfor(int j =i;j<(i+7);j++)\n\t\t{\n\t\t\tif(temp[arr[j%7]]==0)\n\t\t\t\tbreak;\n\t\t\ttemp[arr[j%7]]--;\n\t\t\tmax++;\n\t\t}\n\t//\tprintf(\"max = %d\\n\",max);\n\t\tif(m<max)\n\t\t\tm = max;\n\t}\n\td1 = d1+m;\t\n\tprintf(\"%lld\\n\",d1);\n\treturn 0;\n}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n"}, {"source_code": "#include<stdio.h>\n#include<math.h>\nint main(){\n\tlong long ans[10]={0},max,flag,count[4]={0},a,b,c,i,st,a1,a2,a3;\n\tscanf(\"%lld%lld%lld\",&a,&b,&c);\n\tcount[1]=a;\n\tcount[2]=b;\n\tcount[3]=c;\n for(i=1;i<=7;i++)\n\t{\n\t\t\n\t\tflag=i;\n\t\tcount[1]=a;\n\t\tcount[2]=b;\n\t\tcount[3]=c;\n\t\tif(count[1]>=3 && count[2]>=2 && count[3]>=2)\n\t\t{\n\t\t\ta1=count[1]/3;\n\t\t\ta2=count[2]/2;\n\t\t\ta3=count[3]/2;\n\t\t\tst=fmin(a1,fmin(a2,a3));\n\t\t\tcount[1]-=st*3;\n\t\t\tcount[2]-=st*2;\n\t\t\tcount[3]-=st*2;\n\t\t\tans[i]+=st*7;\n\t\t}\n\t\t\t\n\t\twhile(1)\n\t\t{\n\t\t\t//start monday\n\t\t\tif(flag==1)\n\t\t\t{\n\t\t\t\tif(count[1]==0)\n\t\t\t\t\tbreak;\n\t\t\t\tcount[1]--;\n\t\t\t\tans[i]++;\n\t\t\t\tflag=2;\n\t\t\t}\n\t\t\tif(flag==2)\n\t\t\t{\n\t\t\t\tif(count[2]==0)\n\t\t\t\t\tbreak;\n\t\t\t\tcount[2]--;\n\t\t\t\tans[i]++;\n\t\t\t\tflag=3;\n\t\t\t}\n\t\t\t if(flag==3)\n {\n if(count[3]==0)\n break;\n count[3]--;\n ans[i]++;\n flag=4;\n }\n\t\t\t if(flag==4)\n {\n if(count[1]==0)\n break;\n count[1]--;\n ans[i]++;\n flag=5;\n }\n\t\t\t if(flag==5)\n {\n if(count[3]==0)\n break;\n count[3]--;\n ans[i]++;\n flag=6;\n }\n\t\t\t if(flag==6)\n {\n if(count[2]==0)\n break;\n count[2]--;\n ans[i]++;\n flag=7;\n }\n\t\t\t if(flag==7)\n {\n \n if(count[1]==0)\n break;\n count[1]--;\n ans[i]++;\n\t\t\t\tflag=1;\n }\n\t\t}\n\t}\n\n\tmax=0;\n\tfor(i=1;i<=7;i++)\n\t{\n\t//\tprintf(\"%lld\\n\",ans[i]);\n\t\tif(ans[i]>=max)\n\t\t\tmax=ans[i];\n\t}\n\tprintf(\"%lld\\n\",max);\n\treturn 0;\n}\n\n\n\n\n\n\n\n\n"}, {"source_code": "#include <stdio.h>\n\nint main(){\n int a, b, c, sum = 0, r = 0;\n scanf(\"%d %d %d\", &a, &b, &c);\n while(a >= 3 && b >= 2 && c >= 2){\n a -= 3;\n b -= 2;\n c -= 2;\n sum += 7;\n }\n int next, e, ccc, ee, aa, bb, cc;\n for(int i = 0; i < 7; i++){\n next = 1; e = i; ccc = 0; aa = a; bb = b; cc = c;\n while(next){\n ee = e%7;\n if(ee == 0 || ee == 3 || ee == 6){\n if(aa == 0){\n next = 0;\n } else {\n aa--;\n }\n } else if(ee == 1 || ee == 5){\n if(bb == 0){\n next = 0;\n } else {\n bb--;\n }\n } else {\n if(cc == 0){\n next = 0;\n } else {\n cc--;\n }\n }\n if(next){\n ccc++;\n e++;\n }\n }\n if(ccc > r){\n r = ccc;\n }\n }\n printf(\"%d\", sum+r);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint f,s,t,f2,s2,t2,max=0;\n\tint ans = 0;\n\tint res[7];\n\tfor(int i=0; i<7; i++) res[i]=0;\n\tscanf(\"%d %d %d\",&f,&s,&t);\n\tint min=(((s/2)<(t/2)?s:t)/2<(f/3))?((s/2)<(t/2)?s:t):f;\n\tif(f==min)\n\t{\n\t\tans=(min/3)*7;\n\t\tf=min%3;\n\t\tif(min/3!=0){\n\t\ts-=((min/3)*2);\n\t\tt-=((min/3)*2);\n\t\t}\n\t}else if(s==min)\n\t{\n\t\tans=(min/2)*7;\n\t\ts=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\tt-=((min/2)*2);\n\t\t}\n\t}else if(t==min)\n\t{\n\t\tans=(min/2)*7;\n\t\tt=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\ts-=((min/2)*2);\n\t\t}\n\t}\n\n\n\tint j=1;\n\tint j2=j;\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tf2=f;\n\t\ts2=s;\n\t\tt2=t;\n\n\t\tfor(int j=i+1; j<=14; j++)\n\t\t{\n\t\t\tif(j==8) j=1;\n\t\t\tif(j==2 || j==3 || j==6)\n\t\t\t{\n\t\t\t\tif(f2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \tf2--;\n\t\t\t}\n\t\t\telse if(j==1 || j==4)\n\t\t\t{\n\t\t\t\tif(s2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \ts2--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(t2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \tt2--;\n\t\t\t}\n\t\t\tres[i]++;\n\t\t}\n\n\t}\n\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tif(res[i]>max) max=res[i];\n\t}\n\n\tprintf(\"%d\",ans+max);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j,k,n,a,b,c,x,y,z,p=0,l=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tk=a/3;\n\tif(k>b/2)\n\tk=b/2;\n\tif(k>c/2)\n\tk=c/2;\n\ta=a-3*k;b=b-2*k;c=c-2*k;\n\tx=a;y=b;z=c;\n\tk=k*7;\n\tfor(i=1;i<=7;i++)\n\t{\n\t\ta=x;b=y;c=z;\n\t\tfor(j=i;j<=7;j++)\n\t\t{\n\t\t\tif((j==1)||(j==7)||(j==4))\n\t\t\t{\n\t\t\t\tif(a==0)\n\t\t\t\tbreak;\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\ta--;p++;}\n\t\t\t}\n\t\t\telse if((j==2)||(j==6))\n\t\t\t{\n\t\t\t\tif(b==0)\n\t\t\t\tbreak;\n\t\t\t\telse{\n\t\t\t\tb--;p++;}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(c==0)\n\t\t\t\tbreak;\n\t\t\t\telse {\n\t\t\t\tc--;p++;}\n\t\t\t}\n\t\t\tif(j==7)\n\t\t\tj=0;\n\t\t}\n\t\tif(p>l)\n\t\tl=p;\n\t\tp=0;\n\t}\n\tprintf(\"%d\",k+l);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d=0, w[7]={0}, n=14, i=0, cnt=0, cnt1=0;\n scanf(\"%d %d %d\", &a, &b, &c);\n d=a/3;\n if ( b/2<d )\n d=b/2;\n if ( c/2<d )\n d=c/2;\n a=a-(d*3);\n b=b-(d*2);\n c=c-(d*2);\n d=d*7;\n if ( b>2 ) b=2;\n if ( a>3 ) a=3;\n if ( c>2 ) c=2;\n if ( (a==1 && b==0) || (a==1 && c==2) )\n w[4]++;\n else if ( a==1 && b!=0 )\n w[1]++;\n else if ( a==2 && b!=0 || (a==2 && c<2) )\n {\n w[1]++;\n w[0]++;\n }\n else if ( a==2 && c==2 )\n {\n w[1]++;\n w[4]++;\n }\n else if ( a==3 )\n {\n w[0]++;\n w[1]++;\n w[4]++;\n }\n if ( c==1 )\n w[3]++;\n else if ( c==2 )\n {\n w[3]++;\n w[5]++;\n }\n if ( b==1 )\n w[2]++;\n else if ( b==2 )\n {\n w[2]++;\n w[6]++;\n }\n while ( n-- )\n {\n if ( w[i]>0 ) cnt++;\n else if ( w[i]==0 ) cnt=0;\n if ( cnt>cnt1 ) cnt1=cnt;\n i++;\n if ( i>6 )\n i=0;\n }\n printf(\"%d\\n\", d+cnt1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef long long int LL;\n\nint min(int a, int b){\n\tif( a <= b ) return a;\n\treturn b;\n}\n\nint main(){\n\t// 1, 4, 7: fish\n\t// 2, 6: \trabbit\n\t// 3, 5: \tchicken\n\t\n\tint f, r, c;\n\tscanf(\"%d%d%d\", &f, &r, &c);\n\n\tint base = min(min(f/3, r/2), c/2);\t/*base weeks*/\n\t\n\tf -= 3 * base;\n\tr -= 2 * base;\n\tc -= 2 * base;\n\n\tLL day = (LL)base * 7;\n\tLL max = day;\n\t\n\tLL tmp;\n\n\tint ff = f, rr = r, cc = c;\n\n\tfor(int i = 1; i <= 7; ++i){\n\t\t// start at day i\n\t\ttmp = day;\n\t\tff = f; rr = r; cc = c;\n\t\tfor(int j = 0, done = 0; !done; ++j){\n\t\t\tswitch( (i+j) % 7 ){\n\t\t\t\tcase 1: case 4: case 0:\t/* fish */\n\t\t\t\t\tif(ff > 0){\n\t\t\t\t\t\tff--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2: case 6:\t\t\t/* rabbit */\n\t\t\t\t\tif(rr > 0){\n\t\t\t\t\t\trr--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\t\t\t\t/* chicken */\n\t\t\t\t\tif(cc > 0){\n\t\t\t\t\t\tcc--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(tmp > max) max = tmp;\n//\t\tprintf(\"i = %d, count = %I64d\\n\", i, tmp);\n\t}\n\n\tprintf(\"%I64d\\n\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\ntypedef unsigned long long opo;\n\n#define S scanf\n#define P printf\n#define M malloc\n#define SI sizeof\n\n\nint cmp(const void *a, const void *b)\n{\n\tint *c;\n\tint *d;\n\tc = (int*)a;\n\td = (int*)b;\n\tif (*c > *d)\n\t\treturn (1);\n\tif (*c == *d)\n\t\treturn (0);\n\treturn (-1);\n}\n\nint main()\n{\n\tint a,b,c;\n\tS(\"%d %d %d\", &a, &b, &c);\n\tint out = 0;\n\tint min = a / 3;\n\tmin = b / 2 < min ? b / 2 : min;\n\tmin = c / 2 < min ? c / 2 : min;\n\tout += min * 7;\n\tint arr[7];\n\tint x = 0;\n\twhile (x < 7)\n\t{\n\t\tint ta,tb,tc;\n\t\tta = a - min * 3;\n\t\ttb = b - min * 2;\n\t\ttc = c - min * 2;\n\t\tint count = 0;\n\t\twhile (1)\n\t\t{\n\t\t\tif ((x + count) % 7 == 0 || (x + count) % 7 == 3 || (x + count) % 7 == 6 )\n\t\t\t{\n\t\t\t\tif (ta == 0)\n\t\t\t\t\tbreak;\n\t\t\t\tta--;\n\t\t\t}\n\t\t\telse if ((x + count) % 7 == 1 || (x + count) % 7 == 5)\n\t\t\t{\n\t\t\t\tif (tb == 0)\n\t\t\t\t\tbreak;\n\t\t\t\ttb--;\n\t\t\t}\n\t\t\telse if ((x + count) % 7 == 2 || (x + count) % 7 == 4)\n\t\t\t{\n\t\t\t\tif (tc == 0)\n\t\t\t\t\tbreak;\n\t\t\t\ttc--;\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\t\tarr[x] = count;\n\t\tx++;\n\t}\n\tqsort(arr, 7, SI(int), cmp);\n\tP(\"%d\", out + arr[6]);\n}"}, {"source_code": "/* AUTHOR:AKASH JAIN\n* USERNAME:akash19jain \n* DATE:18/04/2019 \n*/\n#include<stdio.h>\n#include<math.h>\n#include<string.h>\n#include<stdlib.h>\n#include<stdbool.h>\nint cmp(const void * a,const void * b)\n{\n return (*(int*)a - *(int*)b);\n}\nint main()\n{\n long long t=1;\n //scanf(\"%lld\",&t);\n while(t--)\n {\n long long a,b,c,min;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n long long a1=a/3,b1=b/2,c1=c/2;\n if(a1<=b1 && a1<=c1)\n min=a1;\n else if(b1<=a1 && b1<=c1)\n min=b1;\n else\n min=c1;\n \n a-=min*3;\n b-=min*2;\n c-=min*2;\n long long arr[3]={a,b,c};\n int idx[]={0,1,2,0,2,1,0};\n int b2[7];\n long long ans=0,f=0;\n for(int i=0;i<7;i++)\n {\n int day=i;\n int cur=0;\n b2[0]=arr[0],b2[1]=arr[1],b2[2]=arr[2];\n while(b2[idx[day]]>0)\n {\n --b2[idx[day]];\n\t\t\t day = (day + 1) % 7;\n\t\t\t ++cur;\n }\n if(min*7+cur>ans)\n ans=min*7+cur;\n else\n ans=ans;\n }\n \n printf(\"%lld\\n\",ans);\n }\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint compare_char(char *a,char *b){\n\treturn strcmp(a,b);\n}\n\nint intsort(const void *a, const void *b){\n\treturn *(int*)b - *(int*)a;\n\t/*qsort(a,a\u306e\u914d\u5217\u6570,sizeof(int),intsort);*/\n}\n\nint longsort(const void *a, const void *b){\n\tlong *A=(long *)a;\n\tlong *B=(long *)b;\n\tif(*A>*B) return -1;\n\tif(*A<*B) return 1;\n\treturn 0;\n}\n\nint main(){\n\tint i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;\n\tfor(i=0;i<3;i++){\n\tscanf(\"%d\",&a[i]);\n\t}\n/*\tif(a[0]%3==0){\n*/\t\n\t\nb[0]=a[0]/3;\nmin=b[0];\n/*\t}else{\n\t\tb[0]=a[0]/3+1;\n\t}\n\tif(a[1]%2==0){\n*/\nb[1]=a[1]/2;\nif(min>b[1])min=b[1];\n/*\t}else{\n\t\tb[1]=a[1]/2+1;\n\t}\n\tif(a[2]%2==0){\n*/\nb[2]=a[2]/2;\nif(min>b[2])min=b[2];\n/*\t}else{\n\t\tb[2]=a[2]/2+1;\n\t}\n*/\n\nans=min*7;\na[0]-=3*min;\na[1]-=2*min;\na[2]-=2*min;\nmin=0;\nx=a[0];\ny=a[1];\nz=a[2];\n\t//sun\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tmin=day;\n\t\n\tday=0;\n\tx=a[0];\t\n\ty=a[1];\n\tz=a[2];\n\t\t\t\t//\u6708\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u706b\u66dc\n\twhile(1){\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u6c34\u66dc\n\twhile(1){\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u6728\u66dc\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\t\n\t}else{\t\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u91d1\u66dc\n\twhile(1){\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n\n\t\t\t//\u571f\u66dc\n\twhile(1){\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\nprintf(\"%d\\n\",ans+min);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n\nconst char str[14]={'f','f','r','c','f','c','r','f','f','r','c','f','c','r'};\n\nint findMax(int f, int r, int c);\nint find(int start, int f, int r, int c);\n\nint main(void)\n{\n int f,r,c,d=0;\n scanf(\"%d %d %d\", &f, &r, &c);\n \n for(;;)\n {\n if(f>=3 && r>=2 && c>=2)\n {\n f-=3;\n r-=2;\n c-=2;\n d+=7;\n }\n else\n {\n break;\n }\n }\n \n printf(\"%d\", d+findMax(f, r, c));\n \n return 0;\n}\n\nint findMax(int f, int r, int c)\n{\n int i, max=0;\n \n for(i=0; i<7; i++)\n {\n if(max<find(i, f, r, c))\n {\n max=find(i, f, r, c);\n }\n }\n return max;\n}\n\nint find(int start, int f, int r, int c)\n{\n int i, day=0;\n \n for(i=0;;i++)\n {\n if(f>0 && str[start+i]=='f')\n {\n day++;\n f-=1;\n }\n else if(r>0 && str[start+i]=='r')\n {\n day++;\n r-=1;\n }\n else if(c>0 && str[start+i]=='c')\n {\n day++;\n c-=1;\n }\n else\n {\n break;\n }\n }\n \n return day;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long int f,r,c,ans;\n scanf(\"%li%li%li\",&f,&r,&c);\n \n \n if(f/3!=r/2||f/3!=c/2||c/2!=r/2)\n {\n if(f/3<r/2&&f/3<c/2)\n {\n if(f%3==2)\n ans=(f/3)*7+6;\n if(f%3==1)\n ans=(f/3)*7+5;\n if(f%3==0)\n ans=(f/3)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3>r/2&&r/2<c/2)\n {\n if(r%2==1)\n ans=(r/2)*7+6;\n if(r%2==0)\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(c/2<r/2&&c/2<f/3)\n {\n if(c%2==1)\n ans=(c/2)*7+6;\n if(c%2==0)\n ans=(c/2)*7+4;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&f/3!=c/2)\n {\n if(f%3==1)\n {\n ans=(f/3)*7+f%3+r%2+2;\n printf(\"%li\",ans);\n return 0;\n }\n ans=(f/3)*7+f%3+r%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==c/2&&f/3!=r/2)\n {\n if(f%3==2)\n {\n ans=(f/3)*7+f%3+c%2+2;\n printf(\"%li\",ans);\n return 0;\n }\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n \n }\n if(r/2==c/2&&f/3!=c/2)\n {\n if(r%2==0&&c%2==0)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==0&&c%2==1)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==0)\n {\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==1)\n {\n ans=(r/2)*7+5;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&r/2==c/2)\n {\n ans=(f/3)*7+f%3+r%2+c%2;\n printf(\"%li\",ans);\n return 0;\n }\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j,t,a,b,c,x,y,z,p=0,l=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tt=a/3;\n\tif(t>b/2)\n\tt=b/2;\n\tif(t>c/2)\n\tt=c/2;\n\ta=a-3*t;b=b-2*t;c=c-2*t;\n\tx=a;y=b;z=c;\n\tt=t*7;\n\tfor(i=1;i<=7;i++)\n\t{\n\t\ta=x;b=y;c=z;\n\t\tfor(j=i;j<=7;j++)\n\t\t{\n\t\t\tif((j==1)||(j==7)||(j==4))\n\t\t\t{\n\t\t\t\tif(a==0) break;\n\t\t\t\telse a--;p++;\n\t\t\t}\n\t\t\telse if((j==2)||(j==6))\n\t\t\t{\n\t\t\t\tif(b==0) break;\n\t\t\t\telse b--;p++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(c==0) break;\n\t\t\t\telse c--;p++;\n\t\t\t}\n\t\t\tif(j==7)\n\t\t\tj=0;\n\t\t}\n\t\tif(p>l)\n\t\tl=p;\n\t\tp=0;\n\t}\n\tprintf(\"%d\",t+l);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b)\n{\n if (a<b)\n {\n return a;\n }\n\n else\n {\n return b;\n }\n}\n\nint main()\n{\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n\n int x, y, z, d;\n\n x = a/3;\n y = b/2;\n z = c/2;\n\n d = min(x, y);\n d = min(d, z);\n\n ///printf(\"%d %d %d\\n%d\\n\", x, y, z, d);\n\n int p, q, r;\n p = a - (3*d);\n if (p>=3)\n {\n p = 3 + p%3;\n }\n\n else\n {\n p = p%3;\n }\n\n q = b - (2*d);\n if (q>=2)\n {\n q = 2 + q%2;\n }\n\n else\n {\n q = q%2;\n }\n\n r = c - (2*d);\n if (r>=2)\n {\n r = 2 + r%2;\n }\n\n else\n {\n r = r%2;\n }\n\n\n\n ///printf(\"%d %d %d\\n\", p, q, r);\n\n if (p==0) ///\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d));\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n }\n } ///\n\n else if (p==1) ///\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n }\n }\n\n else if (p==2)\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n }\n\n } ///\n\n else\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d));\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b) { return a < b ? a : b; }\n\nint aa[] = { 1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1 };\n\nint main() {\n\tint a, b, c, a_, b_, c_, x, i, j, max;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tx = min(a / 3, min(b / 2, c / 2));\n\ta -= 3 * x;\n\tb -= 2 * x;\n\tc -= 2 * x;\n\tmax = 0;\n\tfor (i = 0; i < 7; i++) {\n\t\ta_ = a, b_ = b, c_ = c;\n\t\tfor (j = i; j < 14; j++)\n\t\t\tif ((aa[j] == 1 && a_-- == 0) || (aa[j] == 2 && b_-- == 0) || (aa[j] == 3 && c_-- == 0))\n\t\t\t\tbreak;\n\t\tif (max < j - i)\n\t\t\tmax = j - i;\n\t}\n\tprintf(\"%d\\n\", x * 7 + max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#define MIN(a,b) (a<b)?a:b\n#define MAX(a,b) (a>b)?a:b;\n\nconst int CAT[7] = {\n 0,0,1,2,0,2,1\n};\n\nint SUR = 0;\nint maksus;\nint AHAN[3];\n\nint main(){\n scanf(\"%d %d %d\",&AHAN[0],&AHAN[1],&AHAN[2]);\n int d=(MIN(AHAN[0]/3,(MIN(AHAN[1]/2,AHAN[2]/2))));\n AHAN[0]-=d*3;AHAN[1]-=d*2;AHAN[2]-=d*2;\n SUR += d*7;\n\n for(int i=0;i<7;i++){\n int Tod[3];for(int i=0;i<3;i++)Tod[i]=AHAN[i];\n int tn=0;\n for(int j=0;j<6;j++){\n if(Tod[CAT[(i+j)%7]]!=0){\n Tod[CAT[(i+j)%7]]--;\n tn++;\n }\n else{\n goto job;\n }\n }\n job:;\n maksus = MAX(maksus,tn);\n }\n printf(\"%d\",SUR+maksus);\n}\n"}, {"source_code": "/* https://codeforces.com/contest/1154/submission/53710754 (rainboy) */\n#include <stdio.h>\n\nint aa[] = { 0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0 };\n\nint min(int a, int b) {\n\treturn a < b ? a : b;\n}\n\nint main() {\n\tint a, b, c, x, i, j, max;\n\n\tscanf(\"%d%d%d\", &a, &b, &c);\n\tx = min(a / 3, min(b / 2, c / 2));\n\ta -= x * 3;\n\tb -= x * 2;\n\tc -= x * 2;\n\tmax = 0;\n\tfor (i = 0; i < 7; i++) {\n\t\tint a_ = a, b_ = b, c_ = c;\n\n\t\tfor (j = i; j < 14; j++)\n\t\t\tif (aa[j] == 0) {\n\t\t\t\tif (a_-- == 0)\n\t\t\t\t\tbreak;\n\t\t\t} else if (aa[j] == 1) {\n\t\t\t\tif (b_-- == 0)\n\t\t\t\t\tbreak;\n\t\t\t} else\n\t\t\t\tif (c_-- == 0)\n\t\t\t\t\tbreak;\n\t\tif (max < j - i)\n\t\t\tmax = j - i;\n\t}\n\tprintf(\"%d\\n\", x * 7 + max);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint a[3] , b[7] = {0, 1, 2, 0, 2, 1, 0}, c[3], ans, sum;\n\nint min (int a, int b, int c)\n{\n int min;\n min = a<b?a:b;\n min = min<c?min:c;\n return min;\n}\nint max (int x, int y)\n{\n int max;\n max = x>y?x:y;\n return max;\n}\n\nint main (void)\n{\n int i, j, k;\n\n for ( i = 0; i < 3; i++ ) {\n scanf(\"%d\", &a[i]);\n }\n\n for ( i = 0; i < 7; i++ ) {\n sum = 0;\n\n for ( j = 0; j < 3; j++ ) {\n c[j] = a[j];\n }\n\n for ( j = i; j < 7; j++ ) {\n if ( c[b[j]] == 0 )\n break;\n c[b[j]]--;\n sum++;\n }\n\n k = min(c[0]/3, c[1]/2, c[2]/2);\n\n c[0]-=3*k;\n c[1]-=2*k;\n c[2]-=2*k;\n sum+=7*k;\n\n for ( j = 0; j < 7; j++ ) {\n if ( c[b[j]] == 0 )\n break;\n c[b[j]]--;\n sum++;\n }\n\n ans = max(ans, sum);\n\n }\n\n printf(\"%d\", ans);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint arr[7]={0,};\n\tint i, j, A, B, C, a, b, c, weekday, cnt, max=0;\n\t\n\tscanf(\"%d %d %d\", &A, &B, &C);\n\t\n\tfor(i=0; i<7; i++){\n\t\ta=A;\n\t\tb=B;\n\t\tc=C;\n\t\tcnt=0;\n\t\tweekday=i;\n\t\t\n\t\tmax=A/3;\n\t\tif(max>B/2){\n\t\t\tmax=B/2;\n\t\t}\n\t\tif(max>C/2){\n\t\t\tmax=C/2;\n\t\t}\n\t\t\n\t\ta-=max*3;\n\t\tb-=max*2;\n\t\tc-=max*2;\n\t\tcnt+=max*7;\n\t\t\n\t\twhile(a!=-1 && b!=-1 && c!=-1){\n\t\t\tif(weekday%7==1 || weekday%7==4 || weekday%7==0){\n\t\t\t\ta--;\n\t\t\t}\n\t\t\telse if(weekday%7==2 || weekday%7==6){\n\t\t\t\tb--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tc--;\n\t\t\t}\n\t\t\tweekday++;\n\t\t\tcnt++;\n\t\t}\n\t\tarr[i]=cnt;\n\t}\n\t\n\tfor(i=0; i<7; i++){\n\t\tif(max<arr[i]){\n\t\t\tmax=arr[i];\n\t\t}\n\t}\n\t\n\tprintf(\"%d\", max-1);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int a,b,c;\n\tscanf(\"%lld%lld%lld\",&a,&b,&c);\n\tlong long int x1=a,x2=b,x3=c,t=0,max=0,min,c1,c2,c3;\n\t\tx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\tc1=a/3;\n\t\tc2=b/2;\n\t\tc3=c/2;\n\t\tif(c1<c2)\n\t\t\tmin=c1;\n\t\telse\n\t\t\tmin=c2;\n\t\tif(min>c3)\n\t\t\tmin=c3;\n\t\ta-=(min*3);\n\t\tb-=(min*2);\n\t\tc-=(min*2);\n\t\tx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\n\t\tmax--;\n\t\tmax+=min*7;\n\t\tprintf(\"%lld\\n\",max );\n\t\treturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <math.h>\n\nint main(){\n\n\tint a,b,c;\n\tint week[8],sum = 0,i,max = -1,x,ans = 0;\n\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\twhile (a>=3 && b>=2 && c>=2){\n\t\ta-=3;\n\t\tb-=2;\n\t\tc-=2;\n\t\tsum+=7;\n\t}\n\tfor (i=0;i<7;i++){\n\t\tweek[0] = a;\n\t\tweek[1] = b;\n\t\tweek[2] = c;\n\t\tweek[3] = a;\n\t\tweek[4] = c;\n\t\tweek[5] = b;\n\t\tweek[6] = a;\n\t\tx = i;\n\t\tans = 0;\n\t\twhile (week[x]){\n\t\t\tswitch(x){\n\t\t\t\tcase 0 : week[0]--; week[3]--; week[6]--; break;\n\t\t\t\tcase 1 : week[1]--; week[5]--; break;\n\t\t\t\tcase 2 : week[2]--; week[4]--; break;\n\t\t\t\tcase 3 : week[0]--; week[3]--; week[6]--; break;\n\t\t\t\tcase 4 : week[2]--; week[4]--; break;\n\t\t\t\tcase 5 : week[1]--; week[5]--; break;\n\t\t\t\tcase 6 : week[0]--; week[3]--; week[6]--; break;\n\t\t\t}\n\t\t\tans++;\n\t\t\tx = (x + 1)%7;\n\t\t}\n\t\tif (max < ans) max = ans;\n\t}\n\tprintf(\"%d\",max+sum);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\ntypedef long long int ll;\nll min(ll a, ll b, ll c)\n{\n if (a <= b && a <= c)\n {\n return a;\n }\n else if (b <= a && b <= c)\n {\n return b;\n }\n else\n return c;\n}\nint main()\n{\n int arr[7] = {0, 1, 2, 0, 2, 1, 0};\n ll f, r, c;\n ll days = 0;\n scanf(\"%lld %lld %lld\", &f, &r, &c);\n\n ll x = min(f / 3, (r) / 2, (c) / 2);\n days = x * 7;\n f -= 3 * x;\n r -= 2 * x;\n c -= 2 * x;\n\n // while (f >= 2 && r >= 2 && f >= 3)\n // {\n // days += 7;\n // r -= 2;\n // f -= 3;\n // c -= 2;\n // }\n ll max = 0;\n for (int i = 0; i < 7; i++)\n {\n\n ll p[3] = {f, r, c};\n ll j = i;\n ll d = 0;\n while (p[arr[j]] > 0)\n {\n p[arr[j]]--;\n d++;\n j++;\n if (j == 7)\n {\n j = 0;\n }\n }\n //printf(\"%lld\\n\", d);\n if (max < d)\n {\n max = d;\n }\n }\n days += max;\n printf(\"%lld\", days);\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n long long a, b, c;\n scanf(\"%lld %lld %lld\", &a, &b, &c);\n\n long long p = a, q = b, r = c;\n p = p / 3;\n q = q / 2;\n r = r / 2;\n\n long long min = p;\n if (q < min)\n {\n min = q;\n }\n if (r < min)\n {\n min = r;\n }\n p = a;\n q = b;\n r = c;\n\n long long int count = 1;\n long long int max = -1;\n\n for (long long int i = 1; i <= 7; i++)\n {\n count = i;\n\n a = p - min * 3;\n b = q - min * 2;\n c = r - min * 2;\n //printf(\"STARTING DY OF WEEK IS %lld\\n\", i);\n\n while (a >= 0 && b >= 0 && c >= 0)\n {\n\n if (count % 7 == 1)\n {\n a--;\n }\n if (count % 7 == 2)\n {\n a--;\n }\n if (count % 7 == 3)\n {\n b--;\n }\n if (count % 7 == 4)\n {\n c--;\n }\n if (count % 7 == 5)\n {\n a--;\n }\n if (count % 7 == 6)\n {\n c--;\n }\n if (count % 7 == 0)\n {\n b--;\n }\n\n count++;\n }\n\n count -= i + 1;\n\n if (max < count)\n {\n max = count;\n }\n }\n\n max = max + 7 * min;\n printf(\"%lld\", max);\n\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfun(const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int a,ac,b,bc,cc,c,n,i,days=0,day,j,d[3];\n scanf(\"%d %d %d\",&a,&b,&c);\n d[0]=a/3;\n d[1]=b/2;\n d[2]=c/2;\n qsort(d,3,sizeof(int),cmpfun);\n\n day=d[0]*7;\n a-=(d[0]*3);\n b-=(d[0]*2);\n c-=(d[0]*2);\n\n for(j=1;j<8;j++)\n {\n n=0;\n ac=a;\n bc=b;\n cc=c;\n i=j;\n while(1)\n {\n\n if(i==1||i==4||i==7)\n {\n if(ac==0)break;\n ac--;\n }\n else if(i==2||i==6)\n {\n if(bc==0)break;\n bc--;\n }\n else\n {\n if(cc==0)break;\n cc--;\n }\n if(i==7)i=1;\n else i++;\n n++;\n //printf(\"%d %d %d\\n\",ac,bc,cc);\n }\n if(days<n)days=n;\n }\n printf(\"%d\",days+day);\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tint i,j,t,a,b,c,x,y,z,p=0,l=0;\n\tscanf(\"%d%d%d\",&a,&b,&c);\n\tt=a/3;\n\tif(t>b/2)\n\tt=b/2;\n\tif(t>c/2)\n\tt=c/2;\n\ta=a-3*t;b=b-2*t;c=c-2*t;\n\tx=a;y=b;z=c;\n\tt=t*7;\n\tfor(i=1;i<=7;i++)\n\t{\n\t\ta=x;b=y;c=z;\n\t\tfor(j=i;j<=7;j++)\n\t\t{\n\t\t\tif((j==1)||(j==7)||(j==4))\n\t\t\t{\n\t\t\t\tif(a==0) break;\n\t\t\t\telse a--;p++;\n\t\t\t}\n\t\t\telse if((j==2)||(j==6))\n\t\t\t{\n\t\t\t\tif(b==0) break;\n\t\t\t\telse b--;p++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(c==0) break;\n\t\t\t\telse c--;p++;\n\t\t\t}\n\t\t\tif(j==7)\n\t\t\tj=0;\n\t\t}\n\t\tif(p>l)\n\t\tl=p;\n\t\tp=0;\n\t}\n\tprintf(\"%d\",t+l);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a[3], b[3];\n for(int i = 0; i < 3; i++) scanf(\"%d\", &a[i]);\n int full = a[0]/3 <= a[1]/2 ? (a[0]/3 <= a[2]/2 ? a[0]/3 : a[2]/2) : (a[1]/2 <= a[2]/2 ? a[1]/2 : a[2]/2);\n a[0] -= 3*full;\n a[1] -= 2*full;\n a[2] -= 2*full;\n int idx[7] = {0, 1, 2, 0, 2, 1, 0};\n int ans = 0;\n for(int start = 0; start < 7; start++)\n {\n int day = start;\n for(int i = 0; i < 3; i++) b[i] = a[i];\n int cur = 0;\n while(b[idx[day]] > 0)\n {\n b[idx[day]]--;\n day = (day+1) % 7;\n cur++;\n }\n if(7*full + cur > ans) ans = 7*full + cur;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(b<min)\n\t\tmin = b;\n\tif(c<min)\n\t\tmin = c;\n\treturn min;\n}\n\nint main()\n{\n\t//F R C F C R F\n\tint a, b, c, mini, max, set, a1, a2, a3;\n\tint arr[7];\n\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\n\tmini = min(a/3, b/2, c/2);\n\ta = a - mini*3;\n\tb = b - mini*2;\n\tc = c - mini*2;\n\t\n\t//printf(\"%d and %d and %d and %d\\n\", mini, a, b, c);\n\n\tfor(int j =0; j<7; j++)\n\t{\n\t\ta1= a; \n\t\ta2 = b;\n\t\ta3 = c;\n\t\tfor(int i = 0; i<7; i++)\n\t\t{\n\t\t\tif((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)\n\t\t\t\t{\n\t\t\t\t\tif(a1 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta1--;\n\t\t\t\t\t\t//printf(\"a %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 1 || (i+j)%7 == 5)\n\t\t\t\t{\n\t\t\t\t\tif(a2 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta2--;\n\t\t\t\t\t\t//printf(\"b %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 2 || (i+j)%7 == 4)\n\t\t\t\t{\n\t\t\t\t\tif(a3 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta3--;\n\t\t\t\t\t\t//printf(\"c %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tif(j == 0)\n\t\t\tmax = set;\n\t\telse\n\t\t{\n\t\t\tif(set>max)\n\t\t\t\tmax = set;\n\t\t}\n\t\t//printf(\"max in run %d is %d\\n\", j, max);\n\n\t}\n\n\tprintf(\"%d\\n\", max + 7*mini);\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\nint min(int x,int y)\n{\n if(x>y)\n return y;\n else\n return x;\n}\nint main()\n{\n int x,y,z,t,f,day[7],a,b,c,i,j,temp,max=0;\n scanf(\"%d %d %d\",&x,&y,&z);\n t=min(min(x/3,y/2),z/2);\n x=x-3*t;\n y=y-2*t;\n z=z-2*t;\n for (i=0;i<7;i++)\n {\n a=x;\n b=y;\n c=z;\n temp=0;\n for (j=0;j<7;j++)\n {\n if((i+j)%7==1||(i+j)%7==2||(i+j)%7==5)\n {\n a--;\n }\n else if((i+j)%7==0||(i+j)%7==3)\n {\n b--;\n }\n else if((i+j)%7==4||(i+j)%7==6)\n {\n c--;\n }\n if(a<0||b<0||c<0)\n {\n break;\n }\n else\n temp++;\n }\n if(temp>max)\n max=temp;\n }\n printf(\"%d\",7*t+max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int min_v(long int a,long int b)\n{\n\tif(a<b)\n\t return a;\n\telse\n\t return b;\n}\nmain()\n{\n\tlong int a,b,c,min=0,a1,b1,c1,max=0,i,j,sum=0;\n\tscanf(\"%ld %ld %ld\",&a,&b,&c);\n\ta1=a;\n\tb1=b;\n\tc1=c;\nif(a1>=3 && b1>=2 && c1>=2)\n{\n\ta/=3;\n\tb/=2;\n\tc/=2;\nmin=min_v(a,min_v(b,c));\na1-=(3*min);\nb1-=(2*min);\nc1-=(2*min);\n}\nlong int ar[7];\nar[0]=1;\nar[1]=2;\nar[2]=3;\nar[3]=1;\nar[4]=3;\nar[5]=2;\nar[6]=1;\nfor(i=0;i<7;++i)\n{\n\tlong int a2=a1,b2=b1,c2=c1;\n\tint flag=0;\n\tsum=0;\n\tif(ar[i]==1)\n\t{\n\t\ta2--;\n\t\tif(a2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum++;\n\t}\n\telse if(ar[i]==2)\n\t{\n\t\tb2--;\n\t\tif(b2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum++;\n\t}\n\telse\n\t{\n\t\tc2--;\n\t\tif(c2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum++;\n\t}\n\tif(flag==0)\n\t{\n\tfor(j=(i+1)%7;j!=i;)\n\t{\n\t\tif(ar[j%7]==1)\n\t\t{\n\t\t\ta2--;\n\t\t\tif(a2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\n\t\telse if(ar[j%7]==2)\n\t\t{\n\t\t\tb2--;\n\t\t\tif(b2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum+=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc2--;\n\t\t\tif(c2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\nj++;\nj=j%7;\n\t}\n}\nif(sum>max)\n{\n\tmax=sum;\n}\n}\nprintf(\"%ld\",(max+(min*7)));\n}"}, {"source_code": "#include <stdio.h>\n#define max(a,b) ((a)>(b)?(a):(b))\n#define min(a,b) ((a)>(b)?(b):(a))\nint main()\n{\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n int na = a / 3, nb = b / 2, nc = c / 2;\n int ans = min(na, min(nb, nc));\n na = min(3, a-ans*3), nb = min(2, b-ans*2), nc = min(2, c-ans*2);\n ans *= 7;\n const char s[] = {'a', 'b', 'c', 'a', 'c', 'b', 'a'};\n int maxv = 0;\n for(int i = 0; i < 7; i++)\n {\n int j = i, value = 0;\n int tmpa = na, tmpb = nb, tmpc = nc;\n while(tmpa > 0 || tmpb > 0 || tmpc > 0)\n {\n if(s[j] == 'a')\n {\n if(tmpa <= 0) break;\n tmpa--;\n }\n else if(s[j] == 'b')\n {\n if(tmpb <= 0) break;\n tmpb--;\n }\n else\n {\n if(tmpc <= 0) break;\n tmpc--;\n }\n j = (j+1)%7;\n value++;\n }\n maxv = max(maxv, value);\n }\n printf(\"%d\\n\", ans+maxv);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\n#include<string.h>\n\n\nint main(){\n\n long long totald,min,a,b,c,ca,cb,cc;\n scanf(\"%lld%lld%lld\",&a,&b,&c);\n ca=a/3;a=a%3;\n cb=b/2;b=b%2;\n cc=c/2;c=c%2;\n min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);\n ca-=min;\n cb-=min;\n cc-=min;\n totald=min*7;\n a+=ca*3;\n b+=cb*2;\n c+=cc*2;\n\n //printf(\"%lld %lld %lld %lld\\n\",a,b,c,totald);\n\n long long count,max=-1,tmpa,tmpb,tmpc,arr[14];\n for(int i=0;i<14; i++){\n tmpa=a;\n tmpb=b;\n tmpc=c;\n memset(arr,0,sizeof(arr));\n for(int j=i;j<14; j++){\n if((j%7==0 || j%7==3) && tmpb){\n arr[j]=1;\n tmpb--;\n }\n else if((j%7==1 || j%7==2 || j%7== 5 )&& tmpa){\n arr[j]=2;\n tmpa--;\n }\n else if((j%7==4 || j%7==6 )&& tmpc){\n arr[j]=3;\n tmpc--;\n }\n }\n count=0;\n for(int k=i;k<14; k++){\n if(arr[k]==0)break;\n //printf(\"%d \",arr[k] );\n count++;\n }\n //puts(\"\");\n if(count>max){\n max=count;\n }\n }\n printf(\"%lld\\n\",totald+max);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,q=0,l=0,s,t,i,j,k,w,e;\n scanf(\"%d %d %d\",&a,&b,&c);\n s=a/3;\n if(s>b/2){\n s=b/2;}\n if(s>c/2){\n s=c/2;}\n a=a-(s*3);\n b=b-(s*2);\n c=c-(s*2);\n k=a; w=b;e=c;\n for(j=1;j<=7;j++)\n {\n if(j==2 || j==3 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n else if(j==1 || j==4)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n else if(j==5 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=2;j<=8;j++)\n {\n if(j==2 || j==3 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n else if(j==8 || j==4)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n else if(j==5 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=3;j<=9;j++)\n {\n if(j==9 || j==3 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n else if(j==8 || j==4)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n else if(j==5 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n\n }\n if(q>l)\n {\n l=q;\n q=0;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=4;j<=10;j++)\n {\n if(j==8 || j==4)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n else if(j==5 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n else if(j==9 || j==10 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n q=0;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=5;j<=11;j++)\n {\n if(j==5 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n else if(j==9 || j==10 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n else if(j==8 || j==11)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n q=0;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=6;j<=12;j++)\n {\n if(j==9 || j==10 ||j==6)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n else if(j==12 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n else if(j==8 || j==11)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n q=0;\n }\n q=0;\n a=k; b=w;c=e;\n for(j=7;j<=13;j++)\n {\n if(j==12 || j==7 )\n {\n if(c==0)\n {\n break;\n }\n else\n {\n c--;\n q++;\n }\n }\n else if(j==8 || j==11)\n {\n if(b==0)\n {\n break;\n }\n else\n {\n b--;\n q++;\n }\n }\n else if(j==9 || j==10 ||j==13)\n {\n if(a==0)\n {\n break;\n }\n else\n {\n a--;\n q++;\n }\n }\n }\n if(q>l)\n {\n l=q;\n q=0;\n }\n q=0;\n printf(\"%d\\n\",l+(s*7));\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nint main()\n{\n long long int a,b,c,a1,b1,c1,z,ans=0;\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n a1=a/3;\n b1=b/2;\n c1=c/2;\n\n if(a1<b1)\n z=a1;\n else\n z=b1;\n if(z>c1)\n z=c1;\n a-=3*z;\n b-=2*z;\n c-=2*z;\n ans=7*z;\n if(a&&b&&c)\n {\n if(a>2)\n ans+=3+!(!b)+!(!c)+(b>1)+(c>1);\n else if(a>1&&b>1)\n ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else\n {\n if(c>1)ans+=a+!(!b)+!(!c)+(b>1)+(c>1);\n else ans+=a+2;\n }\n }else\n {\n if(a==0)\n ans+=(c>0)+(b>0);\n else if(c==0)\n {\n if(a>1)\n ans+=2+!(!b)+(b>1);\n else\n ans+=!(!a)+!(!b);\n }else if(b==0)\n {\n if(a&&c>1)\n ans+=3;\n else if(a>1)\n ans+=2;\n else ans+=!(!a)+!(!c);\n }\n }\n printf(\"%lld\",ans);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<string.h>\nint max(int a,int b)\n{\n\tif(a>b)\n\treturn a;\n\telse\n\treturn b;\n } \nint main()\n{\n\tint a,b,c;\n\tint ans;\n\tfor(;scanf(\"%d%d%d\",&a,&b,&c)!=EOF;)\n\t{\n\t\tans=0;\n\t\tfor(;a>=3&&b>=2&&c>=2;)\n\t\t{\n\t\t\ta=a-3;\n\t\t\tb=b-2;\n\t\t\tc=c-2;\n\t\t\tans=ans+7;\n\t\t}\n\t\t\n\t\tif(a>=3&&b>=2&&c==1)\n\t\t{\n\t\t\tans=ans+6;\n\t\t}\n\t\telse if(a>=3&&b>=2&&c==0)\n\t\t{\n\t\t\tans=ans+4;\n\t\t}\n\t\telse if(a>=3&&b==1&&c>=2)\n\t\t{\n\t\t\tans=ans+6;\n\t\t}\n\t\telse if(a>=3&&b==1&&c==1)\n\t\t{\n\t\t\tans=ans+5;\n\t\t}\n\t\telse if(a>=3&&b==1&&c==0)\n\t\t{\n\t\t\tans=ans+3;\n\t\t}\n\t\telse if(a>=3&&b==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\n\t\t}\n\t\telse if(a>=3&&b==0&&c==1)\n\t\t{\n\t\t\tans=ans+2;\n\t\t}\n\t\telse if(a>=3&&b==0&&c==0)\n\t\t{\n\t\t\tans=ans+2;\n\t\t}\n\t\telse if(a==2&&b>=2&&c>=2)\n\t\t{\n\t\t\tans=ans+6; \n\t\t}\n\t\telse if(a==2&&b>=2&&c==1)\n\t\t{\n\t\t\tans=ans+5;\n\t\t}\n\t\telse if(a==2&&b>=2&&c==0)\n\t\t{\n\t\t\tans=ans+4;\n\t\t}\n\t\telse if(a==2&&b==1&&c>=2)\n\t\t{\n\t\t\tans=ans+5;\n\t\t}\n\t\telse if(a==2&&b==1&&c==1)\n\t\t{\n\t\t\tans=ans+4; \n\t\t}\n\t\telse if(a==2&&b==1&&c==0)\n\t\t{\n\t\t\tans=ans+3;\n\t\t}\n\t\telse if(a==2&&b==0&&c>=2)\n\t\t{\n\t\t\tans=ans+3;\n\t\t}\n\t\telse if(a==2&&b==0&&c==1)\n\t\t{\n\t\t\tans=ans+3;\n\t\t}\n\t\telse if(a==2&&b==0&&c==0)\n\t\t{\n\t\t\tans=ans+2;\n\t\t}\n\t\telse if(a==0)\n\t\t{\n\t\t\tif(b>=1&&c>=1)\n\t\t\t{\n\t\t\t\tans=ans+2;\n\t\t\t}\n\t\t\telse if(b>=1&&c==0)\n\t\t\t{\n\t\t\t\tans=ans+1;\n\t\t\t}\n\t\t\telse if(b==0&&c>=1)\n\t\t\t{\n\t\t\t\tans=ans+1;\n\t\t\t}\n\t\t}\n\t\telse if(a==1)\n\t\t{\n\t\t\tif(c>=2)\n\t\t\t{\n\t\t\t\tif(b>=2)\n\t\t\t\tans=ans+5;\n\t\t\t\telse \n\t\t\t\tans=ans+3+b;\n\t\t\t}\n\t\t\telse if(c==1)\n\t\t\t{\n\t\t\t\tif(b>=1)\n\t\t\t\tans=ans+3;\n\t\t\t\telse\n\t\t\t\tans=ans+2;\n\t\t\t}\n\t\t\telse if(c==0)\n\t\t\t{\n\t\t\t\tif(b>=1)\n\t\t\t\tans=ans+2;\n\t\t\t\telse\n\t\t\t\tans=ans+1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tprintf(\"%d\\n\",ans);\n\t}\n\treturn 0;\n } "}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint cmpfun(const void * a, const void * b)\n{\n return ( *(int*)a - *(int*)b );\n}\nint main()\n{\n int a,ac,b,bc,cc,c,n,i,days=0,day,j,d[3];\n scanf(\"%d %d %d\",&a,&b,&c);\n d[0]=a/3;\n d[1]=b/2;\n d[2]=c/2;\n qsort(d,3,sizeof(int),cmpfun);\n\n day=d[0]*7;\n a-=(d[0]*3);\n b-=(d[0]*2);\n c-=(d[0]*2);\n\n for(j=1;j<8;j++)\n {\n n=0;\n ac=a;\n bc=b;\n cc=c;\n i=j;\n while(1)\n {\n\n if(i==1||i==4||i==7)\n {\n if(ac==0)break;\n ac--;\n }\n else if(i==2||i==6)\n {\n if(bc==0)break;\n bc--;\n }\n else\n {\n if(cc==0)break;\n cc--;\n }\n if(i==7)i=1;\n else i++;\n n++;\n //printf(\"%d %d %d\\n\",ac,bc,cc);\n }\n if(days<n)days=n;\n }\n printf(\"%d\",days+day);\n}\n"}, {"source_code": "#include<stdio.h>\ntypedef long long ll;\nint nnn(int a,int b,int c)\n{\nif(a<b)\n{\nif(a<c) return a;\nelse return c;\n}\nelse\n{\nif(b<c) return b;\nelse return c;\n}\n}\nint xxx(int a,int b)\n{\nreturn (a>b)?a:b;\n}\nint main()\n{\n int a,b,c;\n scanf(\"%d%d%d\",&a,&b,&c);\n int aa=a/3,bb=b/2,cc=c/2;\n a=a%3;\n b=b%2;\n c=c%2;\n int min=nnn(aa,bb,cc);\n aa-=min;\n bb-=min;\n cc-=min;\n a+=aa*3;\n b+=bb*2;\n c+=cc*2;\n int lft[7]={0,1,2,0,2,1,0},ans=0;\n for(int i=0;i<7;++i)\n {\n int day=i;\n int br[3];\n br[0]=a;\n br[1]=b;\n br[2]=c;\n int cur=0;\n while(br[lft[day]])\n {\n --br[lft[day]];\n day=(day+1)%7;\n ++cur;\n }\n ans=xxx(ans,(min*7)+cur);\n }\n printf(\"%d\",ans);\n /*if((a>=3&&b>=1&&c>=2)||(a>=2&&b>=2&&c>=2))\n days+=6;\n else if((a>=3&&b>=1&&c>=1)||(a>=1&&b>=2&&c>=2))\n days+=5;\n else if((a>=2&&b>=1&&c>=1)||(a>=1&&b>=1&&c>=2))\n days+=4;\n else if((a>=2&&b>=1)||(a>=1&&b>=1&&c>=1))\n days+=3;\n else if((a>=2)||(b>=1&&c>=1))\n days+=2;\n else if(a>=1||b>=1)\n days++;*/\n //printf(\"%lld\",days);\n //printf(\"%lld %lld %lld\",a,b,c);\n return 0;\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n long long int a,b,c,i,k,g,f,x,y,z;\n scanf(\"%lld %lld %lld\",&a,&b,&c);\n x=a/3;\n y=b/2;\n z=c/2;\n if(x<=y&&x<=z)\n {\n k=x*7;\n a=a-x*3;\n b=b-x*2;\n c=c-x*2;\n if(a==0)\n {\n if(b>0&&c>0)\n {\n k=k+2;\n }\n else if(b>0||c>0)\n {\n k=k+1;\n }\n else\n {\n k=k;\n }\n }\n else if(a==1)\n {\n if(b>1)\n {\n if(c>1)\n {\n k=k+5;\n }\n else if(c==1)\n {\n k=k+3;\n }\n else\n {\n k=k+2;\n }\n }\n else if(b==1)\n {\n if(c>1)\n {\n k=k+4;\n }\n else if(c==1)\n {\n k=k+3;\n }\n else\n {\n k=k+2;\n }\n }\n else\n {\n if(c>1)\n {\n k=k+2;\n }\n else if(c==1)\n {\n k=k+2;\n }\n else\n {\n k=k+1;\n }\n }\n }\n else if(a==2)\n {\n if(b>1)\n {\n if(c>1)\n {\n k=k+6;\n }\n else if(c==1)\n {\n k=k+5;\n }\n else\n {\n k=k+4;\n }\n }\n else if(b==1)\n {\n if(c>1)\n {\n k=k+5;\n }\n else if(c==1)\n {\n k=k+4;\n }\n else\n {\n k=k+3;\n }\n }\n else\n {\n if(c>1)\n {\n k=k+3;\n }\n else if(c==1)\n {\n k=k+2;\n }\n else\n {\n k=k+2;\n }\n }\n }\n }\n else if(y<=x&&y<=z)\n {\n k=y*7;\n a=a-y*3;\n b=b-y*2;\n c=c-y*2;\n if(b==0)\n {\n if(c>1)\n {\n if(a>1)\n {\n k=k+3;\n }\n else if(a==1)\n {\n k=k+2;\n }\n else\n {\n k++;\n }\n }\n else if(c==1)\n {\n if(a>1)\n {\n k=k+2;\n }\n else if(a==1)\n {\n k=k+2;\n }\n else\n {\n k++;\n }\n }\n else\n {\n if(a>1)\n {\n k=k+2;\n }\n else if(a==1)\n {\n k=k+1;\n }\n else\n {\n k=k;\n }\n }\n }\n else if(b==1)\n {\n if(c>1)\n {\n if(a>2)\n {\n k=k+6;\n }\n else if(a>1)\n {\n k=k+5;\n }\n else if(a==1)\n {\n k=k+4;\n }\n else\n {\n k=k+2;\n }\n }\n else if(c==1)\n {\n if(a>2)\n {\n k=k+5;\n }\n else if(a>1)\n {\n k=k+4;\n }\n else if(a==1)\n {\n k=k+3;\n }\n else\n {\n k=k+2;\n }\n }\n else\n {\n if(a>1)\n {\n k=k+3;\n }\n else if(a==1)\n {\n k=k+2;\n }\n else\n {\n k=k+1;\n }\n }\n }\n }\n else\n {\n k=z*7;\n a=a-z*3;\n b=b-z*2;\n c=c-z*2;\n if(c==0)\n {\n if(b>1)\n {\n if(a>1)\n {\n k=k+4;\n }\n else if(a==1)\n {\n k=k+3;\n }\n else\n {\n k=k+1;\n }\n }\n else if(b==1)\n {\n if(a>1)\n {\n k=k+3;\n }\n else if(a==1)\n {\n k=k+2;\n }\n else\n {\n k=k+1;\n }\n }\n else\n {\n if(a>1)\n {\n k=k+2;\n }\n else if(a==1)\n {\n k=k+1;\n }\n else\n {\n k=k;\n }\n }\n }\n else if(c==1)\n {\n if(b>1)\n {\n if(a>2)\n {\n k=k+6;\n }\n else if(a>1)\n {\n k=k+5;\n }\n else if(a==1)\n {\n k=k+3;\n }\n else\n {\n k=k+2;\n }\n }\n else if(b==1)\n {\n if(a>2)\n {\n k=k+5;\n }\n else if(a>1)\n {\n k=k+4;\n }\n else if(a==1)\n {\n k=k+3;\n }\n else\n {\n k=k+2;\n }\n }\n else\n {\n if(a>1)\n {\n k=k+2;\n }\n else if(a==1)\n {\n k=k+2;\n }\n else\n {\n k=k+1;\n }\n }\n }\n }\n printf(\"%lld\\n\",k);\n return 0;\n}\n"}, {"source_code": "#include<stdio.h>\nint chi(int n,int a,int b,int c)\n{\n\tint count = 0;\n\twhile(1)\n\t{\n\t\tint yu = n % 7;\n\t\tif(yu == 1 || yu == 4 || yu == 0)\n\t\t{\n\t\t\ta--;\n\t\t\tif(a >= 0)\n\t\t\t\tcount++;\n\t\t\telse\n\t\t\t\treturn count;\n\t\t}\n\t\tif(yu == 2 || yu == 6)\n\t\t{\n\t\t\tb--;\n\t\t\tif(b >= 0)\n\t\t\t\tcount++;\n\t\t\telse\n\t\t\t\treturn count;\n\t\t}\n\t\tif(yu == 3 || yu == 5)\n\t\t{\n\t\t\tc--;\n\t\t\tif(c >= 0)\n\t\t\t\tcount++;\n\t\t\telse\n\t\t\t\treturn count;\n\t\t}\n\t\tn++;\n\t}\n}\nint main()\n{\n\tint a,b,c;\n\twhile(scanf(\"%d %d %d\",&a,&b,&c) != EOF)\n\t{\n\t\tint day = 0;\n\t\tint week;\n\t\tint m = a / 3;\n\t\tint n = b / 2;\n\t\tint o = c / 2;\n\t\tweek = m;\n\t\tif(week > n)\n\t\t\tweek = n;\n\t\tif(week > o)\n\t\t\tweek = o;\n\t\tday = week * 7;\n\t\ta = a - week * 3;\n\t\tb = b - week * 2;\n\t\tc = c - week * 2;\n\t\tint max = 0;\n\t\tfor(int i=0;i<7;i++)\n\t\t{\n\t\t\tint temp = chi(i,a,b,c);\n\t\t\tif(max < temp)\n\t\t\t\tmax = temp;\n\t\t}\n\t\tday += max;\n\t\tprintf(\"%d\\n\",day);\n\t}\n}\n"}, {"source_code": "#include<stdio.h>\nint menu[8]={1,2,3,1,3,2,1};\nint lastweek(int f,int r,int c,int offset)\n{\n\tint i,daysfed=0;\n\tfor(i=offset;i<offset+10;i++)\n\t{\n\t\tswitch(menu[i%7]-1)\n\t\t{\n\t\t\tcase 0:\n\t\t\tcase 3:\n\t\t\tcase 6:\n\t\t\t\tif(f==0)\n\t\t\t\t\treturn daysfed;\n\t\t\t\tf--;\n\t\t\t\tdaysfed++;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\tcase 5:\n\t\t\t\tif(r==0)\n\t\t\t\t\treturn daysfed;\n\t\t\t\tr--;\n\t\t\t\tdaysfed++;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\tcase 4:\n\t\t\t\tif(c==0)\n\t\t\t\t\treturn daysfed;\n\t\t\t\tc--;\n\t\t\t\tdaysfed++;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn daysfed;\n}\nint main()\n{\n\tint f,r,c,min_weeks,max_days;\n\tscanf(\"%d%d%d\",&f,&r,&c);\n\tmin_weeks=f/3;\n\tif(min_weeks>r/2)min_weeks=r/2;\n\tif(min_weeks>c/2)min_weeks=c/2;\n\tf-=3*min_weeks;\n\tr-=2*min_weeks;\n\tc-=2*min_weeks;\n\tmax_days=min_weeks*7;\n\tint Max=0,i,val;\n\tfor(i=0;i<7;i++)\n\t{\n\t\tval=lastweek(f,r,c,i);\n\t\tif(Max<val)\n\t\t\tMax=val;\n\t}\n\tprintf(\"%d\\n\",Max+max_days);\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n\nlong long a ,b,c,mini,nr;\n\nint main()\n{\nscanf(\"%I64d %I64d %I64d\",&a,&b,&c);\nif(a>3 || b>2 || c>2)\n{\n\n\n\nmini=a/3;\nif(b/2 <mini)\n mini=b/2;\nif(c/2 <mini)\n mini=c/2;\n}\n\n\na=a-3*mini;\nb=b-2*mini;\nc=c-2*mini;\nnr=mini*7;\nif(a>3)\n a=3;\nif(b>2)\n b=2;\nif(c>2)\n c=2;\n\nif(a==b && b==c)\n nr=nr+a+b+c;\nif(a>b && a>c)\n{\n if(b==0 && c==0)\n nr=nr+2;\n else\n if(b==c)\n nr=nr+a+b+c;\n else\n {\n if(b!=0 && c!=0)\n nr=nr+6;\n else\n {\n if(a==2)\n if(c==1)\n nr=nr+3;\n else\n if(b==1)\n nr=nr+3;\n if(a==3)\n {\n if(b>0)\n nr=nr+b+2;\n if(c>0)\n nr=nr+c+1;\n }\n }\n }\n\n}\nelse\nif(b>a || c>a)\n{\n\n if(a>0)\n {\n\n\n if(b==0 || c==0)\n {\n\n\n\n\n if(b==0)\n nr=nr+3;\n if(c==0)\n nr=nr+2;\n\n }\n\n\n if(b!=0 && c!=0 )\n {\n\n if(c==2)\n nr=nr+a+b+c;\n else\n nr=nr+3;\n\n\n\n }\n }\n else\n if(a==0 && c>0 && b>0)\n nr=nr+2;\n else\n\n\n nr++;\n\n}\nelse\n\n if(a==b || a==c )\n if(b!=c)\n if(b==0 )\n nr=nr+c+1;\n else\n nr=nr+a+b+c;\n\nprintf(\"%I64d\",nr);\n\n\n return 0;\n}\n"}], "negative_code": [{"source_code": "#include<stdio.h>\n#include<stdlib.h>\nint main()\n{\n\tint n,a,b;\n\tscanf(\"%d%d%d\",&n,&b,&a);\n\tint arr[n];\n\tfor(int i = 0;i<n;i++)\n\t{\n\t\tscanf(\"%d\",&arr[i]);\n\t}\n\tint t1 = a;\n\tint t2=b;\n\tint k = 0;\n\tfor(int i =0;i<n;i++)\n\t{\n\t\tif(arr[i]==0)\n\t\t{\n\t\t\tif(t1!=0)\n\t\t\t{\n\t\t\t\tt1--;\n\t\t\t\tk++;\n\t\t\t}\n\t\t\telse if(t2!=0)\n\t\t\t{\n\t\t\t\tt2--;\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t\telse if(arr[i]==1)\n\t\t{\tif(t1==a)\n\t\t\t{\n\t\t\t\tt1--;\n\t\t\t\tk++;\n\t\t\t}\n\t\t\telse if(t2!=0)\n\t\t\t{\n\t\t\t\tt2--;\n\t\t\t\tk++;\n\t\t\t\tif(t1<a)\n\t\t\t\t{\n\t\t\t\t\tt1++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(t1!=0)\n\t\t\t{\n\t\t\t\tt1--;\n\t\t\t\tk++;\n\t\t\t}\n\t\t}\n\t\tif(t1==0 && t2==0)\n\t\t\tbreak;\n\t}\n\tprintf(\"%d\\n\",k);\n\treturn 0;\n}\n\t\t\t\t\n\t\n"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint f,s,t,f2,s2,t2,max=0;\n\tint ans = 0;\n\tint res[7];\n\tfor(int i=0; i<7; i++) res[i]=0;\n\tscanf(\"%d %d %d\",&f,&s,&t);\n\tint min=((f<s?f:s)<t)?(f<s?f:s):t;\n\tif(f==min)\n\t{\n\t\tans=(min/3)*7;\n\t\tf=min%3;\n\t\tif(min/3!=0){\n\t\ts-=((min/3)*2);\n\t\tt-=((min/3)*2);\n\t\t}\n\t}else if(s==min)\n\t{\n\t\tans=(min/2)*7;\n\t\ts=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\tt-=((min/2)*2);\n\t\t}\n\t}else if(t==min)\n\t{\n\t\tans=(min/2)*7;\n\t\tt=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\ts-=((min/2)*2);\n\t\t}\n\t}\n\n\tint j=1;\n\tint j2=j;\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tf2=f;\n\t\ts2=s;\n\t\tt2=t;\n\n\t\tfor(int j=i+1; j<=14; j++)\n\t\t{\n\t\t\tif(j==8) j=1;\n\t\t\tif(j==2 || j==3 || j==6)\n\t\t\t{\n\t\t\t\tif(f2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \tf2--;\n\t\t\t}\n\t\t\telse if(j==1 || j==4)\n\t\t\t{\n\t\t\t\tif(s2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \ts2--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(t2<1)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t \tt2--;\n\t\t\t}\n\t\t\tres[i]++;\n\t\t}\n\n\t}\n\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tif(res[i]>max) max=res[i];\n\t}\n\n\tprintf(\"%d\",ans+max);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n\tint f,s,t,f2,s2,t2,max=0;\n\tint ans = 0;\n\tint res[7];\n\tfor(int i=0; i<7; i++) res[i]=0;\n\tscanf(\"%d %d %d\",&f,&s,&t);\n\tint min=((f<s?f:s)<t)?(f<s?f:s):t;\n\tif(f==min)\n\t{\n\t\tans=(min/3)*7;\n\t\tf=min%3;\n\t\tif(min/3!=0){\n\t\ts-=((min/3)*2);\n\t\tt-=((min/3)*2);\n\t\t}\n\t}else if(s==min)\n\t{\n\t\tans=(min/2)*7;\n\t\ts=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\tt-=((min/2)*2);\n\t\t}\n\t}else if(t==min)\n\t{\n\t\tans=(min/2)*7;\n\t\tt=min%2;\n\t\tif(min/2!=0){\n\t\tf-=((min/2)*3);\n\t\ts-=((min/2)*2);\n\t\t}\n\t}\n\n\tint j=1;\n\tint j2=j;\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tf2=f;\n\t\ts2=s;\n\t\tt2=t;\t\n\t\twhile(1)\n\t\t{\n\t\t\tif(j==2 || j==3 || j==6)\n\t\t\t{\n\t\t\t\tif(f2==0) break;\n\t\t\t \tf2--;\n\t\t\t}\n\t\t\telse if(j==1 || j==4)\n\t\t\t{\n\t\t\t\tif(s2==0) break;\n\t\t\t \ts2--;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(t2==0) break;\n\t\t\t \tt2--;\n\t\t\t}\n\t\t\tres[i]++;\n\t\t\tj++;\n\t\t\tif(j-j2==7) j=j2++;\n\t\t}\n\n\t}\n\n\tfor(int i=0; i<7; i++)\n\t{\n\t\tif(res[i]>max) max=res[i];\n\t}\n\t\n\tprintf(\"%d\",ans+max);\n\n\treturn 0;\n}"}, {"source_code": "#include <stdio.h>\n\nint main()\n{\n int a, b, c, d=0, w[7]={0}, n=14, i=0, cnt=0, cnt1=0;\n scanf(\"%d %d %d\", &a, &b, &c);\n d=a/3;\n if ( b/2<d )\n d=b/2;\n if ( c/2<d )\n d=c/2;\n a=a-(d*3);\n b=b-(d*2);\n c=c-(d*2);\n d=d*7;\n if ( b>2 ) b=2;\n if ( a>3 ) a=3;\n if ( c>2 ) c=2;\n if ( (a==1 && b==0) || (a==1 && c==2) )\n w[4]++;\n else if ( a==1 && b!=0 )\n w[1]++;\n else if ( a==2 && b!=0 || (a==2 && c<2) )\n {\n w[1]++;\n w[0]++;\n }\n else if ( a==2 && c==2 )\n {\n w[1]++;\n w[4]++;\n }\n else if ( a==3 )\n {\n w[0]++;\n w[1]++;\n w[4]++;\n }\n if ( c==1 )\n w[3]++;\n else if ( c==2 )\n {\n w[3]++;\n w[5]++;\n }\n if ( b==1 )\n w[2]++;\n else if ( b==2 )\n {\n w[2]++;\n w[6]++;\n }\n for ( i=0; i<7; i++)\n printf(\"%d \", w[i]);\n printf(\"\\n\");\n i=0;\n while ( n-- )\n {\n if ( w[i]>0 ) cnt++;\n else if ( w[i]==0 ) cnt=0;\n if ( cnt>cnt1 ) cnt1=cnt;\n i++;\n if ( i>6 )\n i=0;\n }\n printf(\"%d\\n\", d+cnt1);\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <math.h>\n\nint min(int a, int b){\n\tif( a <= b ) return a;\n\treturn b;\n}\n\nint main(){\n\t// 1, 4, 7: fish\n\t// 2, 6: \trabbit\n\t// 3, 5: \tchicken\n\t\n\tint f, r, c;\n\tscanf(\"%d%d%d\", &f, &r, &c);\n\n\tint base = min(min(f/3, r/2), c/2);\t/*base weeks*/\n\t\n\tf -= 3 * base;\n\tr -= 2 * base;\n\tc -= 2 * base;\n\n\tint day = base * 7;\n\tint max = day;\n\t\n\tint tmp;\n\n\tfor(int i = 1; i <= 7; ++i){\n\t\t// start at day i\n\t\ttmp = day;\n\t\tfor(int j = 0, done = 0; !done; ++j){\n\t\t\tswitch( (i+j) % 7 ){\n\t\t\t\tcase 1: case 4: case 0:\t/* fish */\n\t\t\t\t\tif(f > 0){\n\t\t\t\t\t\tf--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2: case 6:\t\t\t/* rabbit */\n\t\t\t\t\tif(r > 0){\n\t\t\t\t\t\tr--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\t\t\t\t/* chicken */\n\t\t\t\t\tif(c > 0){\n\t\t\t\t\t\tc--;\n\t\t\t\t\t\ttmp++;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tdone = 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(tmp > max) max = tmp;\n\t//\tprintf(\"i = %d, count = %d\\n\", i, tmp);\n\t}\n\n\tprintf(\"%d\\n\", max);\n\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint compare_char(char *a,char *b){\n\treturn strcmp(a,b);\n}\n\nint intsort(const void *a, const void *b){\n\treturn *(int*)b - *(int*)a;\n\t/*qsort(a,a\u306e\u914d\u5217\u6570,sizeof(int),intsort);*/\n}\n\nint longsort(const void *a, const void *b){\n\tlong *A=(long *)a;\n\tlong *B=(long *)b;\n\tif(*A>*B) return -1;\n\tif(*A<*B) return 1;\n\treturn 0;\n}\n\nint main(){\n\tint i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;\n\tfor(i=0;i<3;i++){\n\tscanf(\"%d\",&a[i]);\n\t}\n/*\tif(a[0]%3==0){\n*/\t\n\t\nb[0]=a[0]/3;\nmin=b[0];\n/*\t}else{\n\t\tb[0]=a[0]/3+1;\n\t}\n\tif(a[1]%2==0){\n*/\nb[1]=a[1]/2;\nif(min>b[1])min=b[1];\n/*\t}else{\n\t\tb[1]=a[1]/2+1;\n\t}\n\tif(a[2]%2==0){\n*/\nb[2]=a[2]/2;\nif(min>b[2])min=b[2];\n/*\t}else{\n\t\tb[2]=a[2]/2+1;\n\t}\n*/\nans=min*7;\na[0]-=7*min;\na[1]-=7*min;\na[2]-=7*min;\nmin=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//sun\nwhile(1){\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\n}\nmin=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//\u6708\nwhile(1){\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\n}\nif(min<day)min=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//\u6708\nwhile(1){\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\n}\nif(min<day)min=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//\u6708\nwhile(1){\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\n}\nif(min<day)min=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//\u6708\nwhile(1){\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\n}\nif(min<day)min=day;\n\nday=0;\nx=a[0];\ny=a[1];\nz=a[2];\n//\u6708\nwhile(1){\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\nif(y>0){\ny--;\nday++;\n}else{\nbreak;\n}\nif(z>0){\nz--;\nday++;\n}else{\nbreak;\n}\nif(x>0){\nx--;\nday++;\n}else{\nbreak;\n}\n}\nif(min<day)min=day;\n\nprintf(\"%d\\n\",ans+min);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<math.h>\n\nint compare_char(char *a,char *b){\n\treturn strcmp(a,b);\n}\n\nint intsort(const void *a, const void *b){\n\treturn *(int*)b - *(int*)a;\n\t/*qsort(a,a\u306e\u914d\u5217\u6570,sizeof(int),intsort);*/\n}\n\nint longsort(const void *a, const void *b){\n\tlong *A=(long *)a;\n\tlong *B=(long *)b;\n\tif(*A>*B) return -1;\n\tif(*A<*B) return 1;\n\treturn 0;\n}\n\nint main(){\n\tint i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;\n\tfor(i=0;i<3;i++){\n\tscanf(\"%d\",&a[i]);\n\t}\n/*\tif(a[0]%3==0){\n*/\t\n\t\nb[0]=a[0]/3;\nmin=b[0];\n/*\t}else{\n\t\tb[0]=a[0]/3+1;\n\t}\n\tif(a[1]%2==0){\n*/\nb[1]=a[1]/2;\nif(min>b[1])min=b[1];\n/*\t}else{\n\t\tb[1]=a[1]/2+1;\n\t}\n\tif(a[2]%2==0){\n*/\nb[2]=a[2]/2;\nif(min>b[2])min=b[2];\n/*\t}else{\n\t\tb[2]=a[2]/2+1;\n\t}\n*/\n\nans=min*7;\na[0]-=3*min;\na[1]-=2*min;\na[2]-=2*min;\nmin=0;\nx=a[0];\ny=a[1];\nz=a[2];\n\t//sun\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tmin=day;\n\t\n\tday=0;\n\tx=a[0];\t\n\ty=a[1];\n\tz=a[2];\n\t\t\t\t//\u6708\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u706b\u66dc\n\twhile(1){\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u6c34\u66dc\n\twhile(1){\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u6728\u66dc\n\twhile(1){\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\t\n\t}else{\t\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\n\tday=0;\n\tx=a[0];\n\ty=a[1];\n\tz=a[2];\n\t\t\t//\u91d1\u66dc\n\twhile(1){\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\t\t\t//\u571f\u66dc\n\twhile(1){\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(y>0){\n\ty--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(x>0){\n\tx--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\tif(z>0){\n\tz--;\n\tday++;\n\t}else{\n\tbreak;\n\t}\n\t}\n\tif(min<day)min=day;\n\nprintf(\"%d\\n\",ans+min);\n\treturn 0;\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long int f,r,c,ans;\n scanf(\"%li%li%li\",&f,&r,&c);\n \n \n if(f/3!=r/2||f/3!=c/2||c/2!=r/2)\n {\n if(f/3<r/2&&f/3<c/2)\n {\n if(f%3==2)\n ans=(f/3)*7+6;\n if(f%3==1)\n ans=(f/3)*7+5;\n if(f%3==0)\n ans=(f/3)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3>r/2&&r/2<c/2)\n {\n if(r%2==1)\n ans=(r/2)*7+6;\n if(r%2==0)\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(c/2<r/2&&c/2<f/3)\n {\n if(c%2==1)\n ans=(c/2)*7+6;\n if(c%2==0)\n ans=(c/2)*7+4;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&f/3!=c/2)\n {\n if(f%3==1)\n {\n ans=(f/3)*7+f%3+c%2+2;\n printf(\"%li\",ans);\n return 0;\n }\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==c/2&&f/3!=r/2)\n {\n if(f%3==2)\n {\n ans=(f/3)*7+f%3+c%2+2;\n printf(\"%li\",ans);\n return 0;\n }\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n \n }\n if(r/2==c/2&&f/3!=c/2)\n {\n if(r%2==0&&c%2==0)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==0&&c%2==1)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==0)\n {\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==1)\n {\n ans=(r/2)*7+5;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&r/2==c/2)\n {\n ans=(f/3)*7+f%3+r%2+c%2;\n printf(\"%li\",ans);\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long int f,r,c,ans;\n scanf(\"%li%li%li\",&f,&r,&c);\n \n \n if(f/3!=r/2||f/3!=c/2||c/2!=r/2)\n {\n if(f/3<r/2&&f/3<c/2)\n {\n if(f%3==2)\n ans=(f/3)*7+6;\n if(f%3==1)\n ans=(f/3)*7+5;\n if(f%3==0)\n ans=(f/3)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3>r/2&&r/2<c/2)\n {\n if(r%2==1)\n ans=(r/2)*7+6;\n if(r%2==0)\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(c/2<r/2&&c/2<f/3)\n {\n if(c%2==1)\n ans=(c/2)*7+6;\n if(c%2==0)\n ans=(c/2)*7+4;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&f/3!=c/2)\n {\n ans=(f/3)*7+f%3+r%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==c/2&&f/3!=r/2)\n {\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(r/2==c/2&&f/3!=c/2)\n {\n ans=(r/2)*7+r%2+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==r/2&&r/2==c/2)\n {\n ans=(f/3)*7+f%3+r%2+c%2;\n printf(\"%li\",ans);\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long int f,r,c,ans;\n scanf(\"%li%li%li\",&f,&r,&c);\n \n \n if(f/3!=r/2||f/3!=c/2||c/2!=r/2)\n {\n if(f/3<r/2&&f/3<c/2)\n {\n if(f%3==2)\n ans=(f/3)*7+6;\n if(f%3==1)\n ans=(f/3)*7+5;\n if(f%3==0)\n ans=(f/3)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3>r/2&&r/2<c/2)\n {\n if(r%2==1)\n ans=(r/2)*7+6;\n if(r%2==0)\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(c/2<r/2&&c/2<f/3)\n {\n if(c%2==1)\n ans=(c/2)*7+6;\n if(c%2==0)\n ans=(c/2)*7+4;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&f/3!=c/2)\n {\n ans=(f/3)*7+f%3+r%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==c/2&&f/3!=r/2)\n {\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(r/2==c/2&&f/3!=c/2)\n {\n ans=(r/2)+r%2+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==r/2&&r/2==c/2)\n {\n ans=(f/3)*7+f%3+r%2+c%2;\n printf(\"%li\",ans);\n return 0;\n }\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\n#include<math.h>\n\nint main()\n{\n long int f,r,c,ans;\n scanf(\"%li%li%li\",&f,&r,&c);\n \n \n if(f/3!=r/2||f/3!=c/2||c/2!=r/2)\n {\n if(f/3<r/2&&f/3<c/2)\n {\n if(f%3==2)\n ans=(f/3)*7+6;\n if(f%3==1)\n ans=(f/3)*7+5;\n if(f%3==0)\n ans=(f/3)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3>r/2&&r/2<c/2)\n {\n if(r%2==1)\n ans=(r/2)*7+6;\n if(r%2==0)\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(c/2<r/2&&c/2<f/3)\n {\n if(c%2==1)\n ans=(c/2)*7+6;\n if(c%2==0)\n ans=(c/2)*7+4;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&f/3!=c/2)\n {\n ans=(f/3)*7+f%3+r%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(f/3==c/2&&f/3!=r/2)\n {\n ans=(f/3)*7+f%3+c%2+1;\n printf(\"%li\",ans);\n return 0;\n }\n if(r/2==c/2&&f/3!=c/2)\n {\n if(r%2==0&&c%2==0)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==0&&c%2==1)\n {\n ans=(r/2)*7+2;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==0)\n {\n ans=(r/2)*7+3;\n printf(\"%li\",ans);\n return 0;\n }\n if(r%2==1&&c%2==1)\n {\n ans=(r/2)*7+5;\n printf(\"%li\",ans);\n return 0;\n }\n }\n if(f/3==r/2&&r/2==c/2)\n {\n ans=(f/3)*7+f%3+r%2+c%2;\n printf(\"%li\",ans);\n return 0;\n }\n}"}, {"source_code": "#include <stdio.h>\n\nint min(int a, int b)\n{\n if (a<b)\n {\n return a;\n }\n\n else\n {\n return b;\n }\n}\n\nint main()\n{\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n\n int x, y, z, d;\n\n x = a/3;\n y = b/2;\n z = c/2;\n\n d = min(x, y);\n d = min(d, z);\n\n ///printf(\"%d %d %d\\n%d\\n\", x, y, z, d);\n\n int p, q, r;\n p = a - (3*d);\n if (p>3)\n {\n p = 3 + p%3;\n }\n\n else\n {\n p = p%3;\n }\n\n q = b - (2*d);\n if (q>2)\n {\n q = 2 + q%2;\n }\n\n else\n {\n q = q%2;\n }\n\n r = c - (2*d);\n if (r>2)\n {\n r = 2 + r%2;\n }\n\n else\n {\n r = r%2;\n }\n\n\n\n ///printf(\"%d %d %d\\n\", p, q, r);\n\n if (p==0) ///\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d));\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n }\n } ///\n\n else if (p==1) ///\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+1);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n }\n }\n\n else if (p==2)\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n }\n\n } ///\n\n else\n {\n if (q==0)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+2);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n }\n\n else if (q==1)\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+3);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+5);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n }\n\n else\n {\n if (r==0)\n {\n printf(\"%d\\n\", (7*d)+4);\n }\n\n else if (r==1)\n {\n printf(\"%d\\n\", (7*d)+6);\n }\n\n else\n {\n printf(\"%d\\n\", (7*d));\n }\n }\n }\n\n return 0;\n}\n"}, {"source_code": "#include <stdio.h>\n\nint main(void){\n\tint arr[7]={0,};\n\tint i, A, B, C, a, b, c, weekday, cnt, max=0;\n\t\n\tscanf(\"%d %d %d\", &A, &B, &C);\n\t\n\tfor(i=0; i<7; i++){\n\t\ta=A;\n\t\tb=B;\n\t\tc=C;\n\t\tcnt=0;\n\t\tweekday=i;\n\t\twhile(a!=-1 && b!=-1 && c!=-1){\n\t\t\tif(weekday%7==1 || weekday%7==4 || weekday%7==0){\n\t\t\t\ta--;\n\t\t\t}\n\t\t\telse if(weekday%7==2 || weekday%7==6){\n\t\t\t\tb--;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tc--;\n\t\t\t}\n\t\t\tweekday++;\n\t\t\tcnt++;\n\t\t}\n\t\tarr[i]=cnt;\n\t}\n\t\n\tprintf(\"a: %d / b: %d / c: %d\\n\", a, b, c);\n\tfor(i=0; i<7; i++){\n\t\tprintf(\"%d \", arr[i]);\n\t\tif(max<arr[i]){\n\t\t\tmax=arr[i];\n\t\t}\n\t}\n\tprintf(\"\\n\");\n\t\n\tprintf(\"%d\", max-1);\n\t\n\treturn 0;\n}\n"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int a,b,c;\n\tscanf(\"%lld%lld%lld\",&a,&b,&c);\n\tlong long int x1=a,x2=b,x3=c,t=0,max=0,min,c1,c2,c3;\n\t\tx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\tc1=a/21;\n\t\tc2=b/14;\n\t\tc3=c/14;\n\t\tif(c1<c2)\n\t\t\tmin=c1;\n\t\telse\n\t\t\tmin=c2;\n\t\tif(min>c3)\n\t\t\tmin=c3;\n\t\ta-=(min*21);\n\t\tb-=(min*14);\n\t\tc-=(min*14);\n\t\tx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\n\t\tmax--;\n\t\tmax+=min*7;\n\t\tprintf(\"%lld\\n\",max );\n\t\treturn 0;\n\n}"}, {"source_code": "#include <stdio.h>\nint main()\n{\n\tlong long int a,b,c;\n\tscanf(\"%lld%lld%lld\",&a,&b,&c);\n\tlong long int x1=a,x2=b,x3=c,t=0,max=0,min,c1,c2,c3;\n\t\tx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\tc1=a/21;\n\t\tc2=b/14;\n\t\tc3=c/14;\n\t\tif(c1<c2)\n\t\t\tmin=c1;\n\t\telse\n\t\t\tmin=c2;\n\t\tif(min>c3)\n\t\t\tmin=c3;\n\t\ta-=min*21;b-=min*14;c-=min*14;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\nx1=a;\n\t\tx2=b;\n\t\tx3=c;\n\t\twhile(1)\n\t\t{\n\t\t\t\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx1--;\n\t\t\tt++;\n\t\t\tif(x1<0)\n\t\t\t\tbreak;\n\t\t\tx3--;\n\t\t\tt++;\n\t\t\tif(x3<0)\n\t\t\t\tbreak;\n\t\t\tx2--;\n\t\t\tt++;\n\t\t\tif(x2<0)\n\t\t\t\tbreak;\n\t\t}\n\t\tif(t>max)\n\t\t\tmax=t;\n\t\tt=0;\n\t\tmax--;\n\t\tmax+=min*7;\n\t\tprintf(\"%lld\\n\",max );\n\t\treturn 0;\n\n}"}, {"source_code": "#include<stdio.h>\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(b<min)\n\t\tmin = b;\n\tif(c<min)\n\t\tmin = c;\n\treturn min;\n}\n\nint main()\n{\n\t//F R C F C R F\n\tint a, b, c, mini, max, set, a1, a2, a3;\n\tint arr[7];\n\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\n\tmini = min(a/3, b/2, c/2);\n\ta = a - mini*3;\n\tb = b - mini*2;\n\tc = c - mini*2;\n\t\n\tprintf(\"%d and %d and %d and %d\\n\", mini, a, b, c);\n\n\tfor(int j =0; j<7; j++)\n\t{\n\t\ta1= a; \n\t\ta2 = b;\n\t\ta3 = c;\n\t\tfor(int i = 0; i<7; i++)\n\t\t{\n\t\t\tif((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)\n\t\t\t\t{\n\t\t\t\t\tif(a1 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta1--;\n\t\t\t\t\t\tprintf(\"a %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 1 || (i+j)%7 == 5)\n\t\t\t\t{\n\t\t\t\t\tif(a2 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta2--;\n\t\t\t\t\t\tprintf(\"b %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 2 || (i+j)%7 == 4)\n\t\t\t\t{\n\t\t\t\t\tif(a3 == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta3--;\n\t\t\t\t\t\tprintf(\"c %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tif(j == 0)\n\t\t\tmax = set;\n\t\telse\n\t\t{\n\t\t\tif(set>max)\n\t\t\t\tmax = set;\n\t\t}\n\t\tprintf(\"max in run %d is %d\\n\", j, max);\n\n\t}\n\n\tprintf(\"%d\\n\", max + 7*mini);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(b<min)\n\t\tmin = b;\n\tif(c<min)\n\t\tmin = c;\n\treturn min;\n}\n\nint main()\n{\n\t//F R C F C R F\n\tint a, b, c, mini, max, set;\n\tint arr[7];\n\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\n\tmini = min(a/3, b/2, c/2);\n\ta = a - mini*3;\n\tb = b - mini*2;\n\tc = c - mini*2;\n\tprintf(\"%d and %d and %d and %d\\n\", mini, a, b, c);\n\n\tfor(int j =0; j<7; j++)\n\t{\n\t\tfor(int i = 0; i<7; i++)\n\t\t{\n\t\t\tif((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)\n\t\t\t\t{\n\t\t\t\t\tif(a == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta--;\n\t\t\t\t\t\t//printf(\"a %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 1 || (i+j)%7 == 5)\n\t\t\t\t{\n\t\t\t\t\tif(b == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tb--;\n\t\t\t\t\t\t//printf(\"b %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 2 || (i+j)%7 == 4)\n\t\t\t\t{\n\t\t\t\t\tif(c == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tc--;\n\t\t\t\t\t\t//printf(\"c %d\\n\", i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tif(j == 0)\n\t\t\tmax = set;\n\t\telse\n\t\t{\n\t\t\tif(set>max)\n\t\t\t\tmax = set;\n\t\t}\n\t\t//printf(\"max in run %d is %d\\n\", j, max);\n\n\t}\n\n\tprintf(\"%d\\n\", max + 7*mini);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n\nint min(int a, int b, int c)\n{\n\tint\tmin = a;\n\tif(b<min)\n\t\tmin = b;\n\tif(c<min)\n\t\tmin = c;\n\treturn min;\n}\n\nint main()\n{\n\t//F R C F C R F\n\tint a, b, c, mini, max, set;\n\tint arr[7];\n\n\tscanf(\"%d %d %d\", &a, &b, &c);\n\n\tmini = min(a/3, b/2, c/2);\n\ta = a - mini*3;\n\tb = b - mini*2;\n\tc = c - mini*2;\n\n\tfor(int j =0; j<7; j++)\n\t{\n\t\tfor(int i = 0; i<7; i++)\n\t\t{\n\t\t\tif((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)\n\t\t\t\t{\n\t\t\t\t\tif(a == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\ta--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 1 || (i+j)%7 == 5)\n\t\t\t\t{\n\t\t\t\t\tif(b == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tb--;\n\t\t\t\t}\n\t\t\tif((i+j)%7 == 2 || (i+j)%7 == 4)\n\t\t\t\t{\n\t\t\t\t\tif(c == 0){\n\t\t\t\t\t\tset = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tc--;\n\t\t\t\t}\n\t\t}\n\t\tif(j == 0)\n\t\t\tmax = set;\n\t\telse\n\t\t{\n\t\t\tif(set>max)\n\t\t\t\tmax = set;\n\t\t}\n\n\t}\n\n\tprintf(\"%d\\n\", max + 7*mini);\n\treturn 0;\n}\n"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int min_v(long int a,long int b)\n{\n\tif(a<b)\n\t return a;\n\telse\n\t return b;\n}\nmain()\n{\n\tlong int a,b,c,min,a1,b1,c1,max=-90,i,j,sum=0;\n\tscanf(\"%ld %ld %ld\",&a,&b,&c);\n\ta1=a;\n\tb1=b;\n\tc1=c;\nif(a1>=3 && b1>=2 && c1>=2)\n{\n\ta/=3;\n\tb/=2;\n\tc/=2;\nmin=min_v(a,min_v(b,c));\na1-=(3*min);\nb1-=(2*min);\nc1-=(2*min);\n}\nlong int ar[7];\nar[0]=1;\nar[1]=2;\nar[2]=3;\nar[3]=1;\nar[4]=3;\nar[5]=2;\nar[6]=1;\nfor(i=0;i<7;++i)\n{\n\tlong int a2=a1,b2=b1,c2=c1;\n\tint flag=0;\n\tsum=0;\n\tif(ar[i]==1)\n\t{\n\t\ta2--;\n\t\tif(a2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse if(ar[i]==2)\n\t{\n\t\tb2--;\n\t\tif(b2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse\n\t{\n\t\tc2--;\n\t\tif(c2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\tif(flag==0)\n\t{\n\tfor(j=i+1;j!=i;)\n\t{\n\t\tif(ar[j%7]==1)\n\t\t{\n\t\t\ta2--;\n\t\t\tif(a2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\n\t\telse if(ar[j%7]==2)\n\t\t{\n\t\t\tb2--;\n\t\t\tif(b2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum+=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc2--;\n\t\t\tif(c2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\nj++;\nj=j%7;\n\t}\n}\nif(sum>max)\n{\n\tmax=sum;\n}\n}\nprintf(\"%ld\",max+(min*7));\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int min_v(long int a,long int b)\n{\n\tif(a<b)\n\t return a;\n\telse\n\t return b;\n}\nmain()\n{\n\tlong int a,b,c,min,a1,b1,c1,max=0,i,j,sum=0;\n\tscanf(\"%ld %ld %ld\",&a,&b,&c);\n\ta1=a;\n\tb1=b;\n\tc1=c;\nif(a1>=3 && b1>=2 && c1>=2)\n{\n\ta/=3;\n\tb/=2;\n\tc/=2;\nmin=min_v(a,min_v(b,c));\na1-=(3*min);\nb1-=(2*min);\nc1-=(2*min);\n}\nlong int ar[7];\nar[0]=1;\nar[1]=2;\nar[2]=3;\nar[3]=1;\nar[4]=3;\nar[5]=2;\nar[6]=1;\nfor(i=0;i<7;++i)\n{\n\tlong int a2=a1,b2=b1,c2=c1;\n\tint flag=0;\n\tsum=0;\n\tif(ar[i]==1)\n\t{\n\t\ta2--;\n\t\tif(a2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse if(ar[i]==2)\n\t{\n\t\tb2--;\n\t\tif(b2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse\n\t{\n\t\tc2--;\n\t\tif(c2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\tif(flag==0)\n\t{\n\tfor(j=i+1;j!=i;)\n\t{\n\t\tif(ar[j%7]==1)\n\t\t{\n\t\t\ta2--;\n\t\t\tif(a2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\n\t\telse if(ar[j%7]==2)\n\t\t{\n\t\t\tb2--;\n\t\t\tif(b2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum+=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc2--;\n\t\t\tif(c2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\nj++;\nj=j%7;\n\t}\n}\nif(sum>max)\n{\n\tmax=sum;\n}\n}\nprintf(\"%ld\",(max+(min*7)));\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nlong int min_v(long int a,long int b)\n{\n\tif(a<b)\n\t return a;\n\telse\n\t return b;\n}\nmain()\n{\n\tlong int a,b,c,min,a1,b1,c1,max=0,i,j,sum=0;\n\tscanf(\"%ld %ld %ld\",&a,&b,&c);\n\ta1=a;\n\tb1=b;\n\tc1=c;\nif(a1>=3 && b1>=2 && c1>=2)\n{\n\ta/=3;\n\tb/=2;\n\tc/=2;\nmin=min_v(a,min_v(b,c));\na1-=(3*min);\nb1-=(2*min);\nc1-=(2*min);\n}\nlong int ar[7];\nar[0]=1;\nar[1]=2;\nar[2]=3;\nar[3]=1;\nar[4]=3;\nar[5]=2;\nar[6]=1;\nfor(i=0;i<7;++i)\n{\n\tlong int a2=a1,b2=b1,c2=c1;\n\tint flag=0;\n\tsum=0;\n\tif(ar[i]==1)\n\t{\n\t\ta2--;\n\t\tif(a2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse if(ar[i]==2)\n\t{\n\t\tb2--;\n\t\tif(b2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\telse\n\t{\n\t\tc2--;\n\t\tif(c2<0)\n\t\t{\n\t\t\tflag=1;\n\t\t}\n\t\tif(flag==0)\n\t\t sum=1;\n\t}\n\tif(flag==0)\n\t{\n\tfor(j=(i+1)%7;j!=i;)\n\t{\n\t\tif(ar[j%7]==1)\n\t\t{\n\t\t\ta2--;\n\t\t\tif(a2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\n\t\telse if(ar[j%7]==2)\n\t\t{\n\t\t\tb2--;\n\t\t\tif(b2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum+=1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tc2--;\n\t\t\tif(c2<0)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsum++;\n\t\t}\nj++;\nj=j%7;\n\t}\n}\nif(sum>max)\n{\n\tmax=sum;\n}\n}\nprintf(\"%ld\",(max+(min*7)));\n}"}, {"source_code": "#include<stdio.h>\n#include<stdlib.h>\nmain()\n{\n\tint n,b,a,i,ac;\n\tscanf(\"%d %d %d\",&n,&b,&a);\n\tint ar[200002];\nfor(i=0;i<n;++i)\n{\n\tscanf(\"%d\",&ar[i]);\n}\nac=a;\nfor(i=0;i<n;++i)\n{\n\tif(ar[i]==1 && b==0 && ac>0)\n\t{\n\t\tac--;\n\t}\n\telse if(ar[i]==0 && ac==0 && b>0)\n\t{\n\t\tb--;\n\t}\n\telse if(ar[i]==1 && b>0)\n\t{\n\t\tb--;\n\t\tac++;\n\t\tif(ac>a)\n\t\t{\n\t\t ac=ac-2;\n\t\t b++;\n\t }\n\t}\n\telse if(ar[i]==0 && ac>0)\n\t{\n\t\tac--;\n\t}\n\telse\n\t{\n\t\tbreak;\n\t}\n}\nprintf(\"%d\",i);\n}"}, {"source_code": "#include <stdio.h>\n#define min(a,b) ((a)>(b)?(b):(a))\nint main()\n{\n int a, b, c;\n scanf(\"%d%d%d\", &a, &b, &c);\n int na = a / 3, nb = b / 2, nc = c / 2;\n int ans = min(na, min(nb, nc));\n na = a - ans*3, nb = b - ans*2, nc = c - ans*2;\n ans *= 7;\n// printf(\"remain a=%d, b=%d, c=%d, ans=%d\\n\", na, nb, nc, ans);\n na = min(2, na);\n nb = min(na, nb);\n nc = min(nb, nc);\n ans += na + nb + nc;\n printf(\"%d\\n\", ans);\n}"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1 && b>=2 && c>=2)\n printf(\"5\");\n else if(a==2 && b>=2 && c>=2)\n printf(\"6\");\n else if(a==1 && b>=1 && c==0)\n printf(\"2\");\n else if(a==1 && b==0 && c>=1)\n printf(\"2\");\n else if(a==1 && b>=1 && c>=1)\n printf(\"3\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(a==2 && b==0 && c==0)\n printf(\"2\");\n else if(a==2 && b==1 && c==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==1)\n printf(\"4\");\n else if(a>=3 && c==1 && b==1)\n printf(\"5\");\n else if(a>=3 && c==1 && b==2)\n printf(\"6\");\n else if(a>=3 && c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1)\n printf(\"3\");\n else if(a==2)\n printf(\"4\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1 && b>=2 && c>=2)\n printf(\"5\");\n else if(a==2 && b>=2 && c>=2)\n printf(\"6\");\n else if(a==1 && b==1 && c==0)\n printf(\"2\");\n else if(a==1 && b==0 && c==1)\n printf(\"2\");\n else if(a==1 && b==1 && c==1)\n printf(\"3\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(a==2 && b==0 && c==0)\n printf(\"2\");\n else if(a==2 && b==1 && c==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==1)\n printf(\"4\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else if(c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1)\n printf(\"3\");\n else if(a==2)\n printf(\"4\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e2<f2 && e2<g2){\n if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2)\n printf(\"%d\",(e*7)+4);\n\n }\n else if(f2<e2 && f2<g2){\n if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1)\n printf(\"%d\",(f*7)+4);\n }\n else if(g2<e2 && f2>g2){\n if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1)\n printf(\"3\");\n else if(a==2)\n printf(\"4\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n /*if(a<=3 || b<=2 || c<=2){\n if(a==1 && b>=2 && c>=2)\n printf(\"5\");\n else if(a==2 && b>=2 && c>=2)\n printf(\"6\");\n else if(a==1 && b>=1 && c==0)\n printf(\"2\");\n else if(a==1 && b==0 && c>=1)\n printf(\"2\");\n else if(a==1 && b>=1 && c>=1)\n printf(\"3\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(a==2 && b==0 && c==0)\n printf(\"2\");\n else if(a==2 && b==1 && c==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==0)\n printf(\"3\");\n else if(a==2 && c==1 && b==1)\n printf(\"4\");\n else if(a>=3 && c==1 && b==1)\n printf(\"5\");\n else if(a>=3 && c==1 && b==2)\n printf(\"6\");\n else if(a>=3 && c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }*/\n\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1)\n printf(\"3\");\n else if(a==2)\n printf(\"4\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else if(c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1)\n printf(\"3\");\n else if(a==2)\n printf(\"4\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else if(c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+4);\n else if(f1==1)\n printf(\"%d\",(f*7)+6);\n }\n else if(g<=e && f>=g){\n if(g1==0 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7));\n else if(g1==0 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+1);\n else if(g1==0 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+2);\n else if(g1==0)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g==f && e==g && f1==0 && e1==0)\n printf(\"%d\",(g*7)+1);\n else if(g1==1 && g==f && e==g && e1==2 && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==0 && e1==1)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e==g && f1==1 && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g==f && e==g && f1==1 && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && f>g && g==e && e1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g<f && e==g && e1==1)\n printf(\"%d\",(g*7)+3);\n else if(g1==1 && g<f && e==g && e1==2)\n printf(\"%d\",(g*7)+4);\n else if(g1==1 && g<e && g==f && f1==0)\n printf(\"%d\",(g*7)+2);\n else if(g1==1 && g==f && e>g && f1!=0)\n printf(\"%d\",(g*7)+5);\n else if(g1==1)\n printf(\"%d\",(g*7)+6);\n\n }\n else if(e==f && e==g && f==g){\n if(e1==0 && f1==0 && g1==0)\n printf(\"%d\",e*7);\n else{\n if(e<f && e<g){\n if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<e && f<g){\n printf(\"%d\",(f*7)+6);\n }\n else\n printf(\"%d\",(g*7)+6);\n }\n }\n\n }\n\n}\n"}, {"source_code": "#include<stdio.h>\nint main()\n{\n int a,b,c,d,e,e1,f,f1,g,g1,e2,f2,g2;\n scanf(\"%d %d %d\",&a,&b,&c);\n if(a<=3 || b<=2 || c<=2){\n if(a==1 && b>=2 && c>=2)\n printf(\"5\");\n else if(a==2 && b>=2 && c>=2)\n printf(\"6\");\n else if(a==1 && b==1 && c==0)\n printf(\"2\");\n else if(a==1 && b==0 && c==1)\n printf(\"2\");\n else if(a==1 && b==1 && c==1)\n printf(\"3\");\n else if(a==3 && b==1 && c>=2)\n printf(\"6\");\n else if(c==1 && b==1)\n printf(\"5\");\n else if(c==1 && b==2)\n printf(\"6\");\n else if(c==2 && b==1)\n printf(\"6\");\n else\n printf(\"7\");\n }\n else{\n e=a/3;\n e1=a%3;\n e2=e+e1;\n f=b/2;\n f1=b%2;\n f2=f+f1;\n g=c/2;\n g1=c%2;\n g2=g1+g;\n if(e<=f && e<=g){\n if(e1==0 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7));\n else if(e1==0 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+2);\n else if(e1==0 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==0 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7));\n else if(e1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+1);\n else if(e1==1 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+3);\n else if(e1==1 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==1 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+4);\n else if(e1==1)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && e==f && e==g && f1==0 && g1==0)\n printf(\"%d\",(e*7)+2);\n else if(e1==2 && e==f && e==g && f1==1 && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==0 && g1==1)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e==g && f1==1 && g1==1)\n printf(\"%d\",(e*7)+4);\n else if(e1==2 && f>e && g==e && g1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e<f && e==g && g1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2 && g>e && e==f && f1==0)\n printf(\"%d\",(e*7)+3);\n else if(e1==2 && e==f && e<g && f1!=0)\n printf(\"%d\",(e*7)+5);\n else if(e1==2)\n printf(\"%d\",(e*7)+6);\n }\n else if(f<=e && f<=g){\n if(f1==0 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7));\n else if(f1==0 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e1==2 && g==f && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0 && g>f && e==f && e1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==0 && e==f && f<g && e1!=0)\n printf(\"%d\",(f*7)+2);\n else if(f1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e==f && f==g && e1==0 && g1==0)\n printf(\"%d\",(f*7)+1);\n else if(f1==1 && e==f && f==g && e1==1 && g1==0)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==0 && g1==1)\n printf(\"%d\",(f*7)+2);\n else if(f1==1 && e==f && f==g && e1==1 && g1==1)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && f<e && g==f && g1==0)\n printf(\"%d\",(f*7)+3);\n else if(f1==1 && e>f && f==g && g1!=0)\n printf(\"%d\",(f*7)+5);\n else if(f1==1 && g>f && e==f &&